diff --git a/sdk/containerservice/azure-mgmt-containerservice/_meta.json b/sdk/containerservice/azure-mgmt-containerservice/_meta.json index 964ad6edd30c..07c4a920bf75 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/_meta.json +++ b/sdk/containerservice/azure-mgmt-containerservice/_meta.json @@ -1,11 +1,11 @@ { - "autorest": "3.7.2", + "autorest": "3.8.4", "use": [ - "@autorest/python@5.16.0", - "@autorest/modelerfour@4.19.3" + "@autorest/python@6.0.1", + "@autorest/modelerfour@4.23.5" ], - "commit": "7a33b79a30a2778e4e051708b921b0b46cfe64c8", + "commit": "4dad28a017b65861478e4aa76e0a9eeb785754fd", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest_command": "autorest specification/containerservice/resource-manager/readme.md --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --python3-only --use=@autorest/python@5.16.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", + "autorest_command": "autorest specification/containerservice/resource-manager/readme.md --models-mode=msrest --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.0.1 --use=@autorest/modelerfour@4.23.5 --version=3.8.4 --version-tolerant=False", "readme": "specification/containerservice/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/_configuration.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/_configuration.py index 7536321aae25..c005abaaa2ad 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/_configuration.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/_configuration.py @@ -8,7 +8,7 @@ # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies @@ -18,8 +18,6 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential class ContainerServiceClientConfiguration(Configuration): @@ -28,16 +26,16 @@ class ContainerServiceClientConfiguration(Configuration): Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :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. + :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str """ def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str + credential: "TokenCredential", + subscription_id: str, **kwargs # type: Any ): # type: (...) -> None diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/_container_service_client.py index ce48af7ef7ba..6b35a749af20 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/_container_service_client.py @@ -9,20 +9,17 @@ # regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING - -from msrest import Deserializer, Serializer +from typing import Any, Optional, TYPE_CHECKING from azure.mgmt.core import ARMPipelineClient from azure.profiles import KnownProfiles, ProfileDefinition from azure.profiles.multiapiclient import MultiApiClientMixin from ._configuration import ContainerServiceClientConfiguration +from ._serialization import Deserializer, Serializer if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential class _SDKClient(object): @@ -43,9 +40,9 @@ class ContainerServiceClient(MultiApiClientMixin, _SDKClient): The api-version parameter sets the default API version if the operation group is not described in the profile. - :param credential: Credential needed for the client to connect to Azure. + :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. + :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str :param api_version: API version to use if no profile is provided, or if missing in profile. :type api_version: str @@ -56,7 +53,7 @@ class ContainerServiceClient(MultiApiClientMixin, _SDKClient): :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ - DEFAULT_API_VERSION = '2022-06-01' + DEFAULT_API_VERSION = '2022-07-01' _PROFILE_TAG = "azure.mgmt.containerservice.ContainerServiceClient" LATEST_PROFILE = ProfileDefinition({ _PROFILE_TAG: { @@ -69,10 +66,10 @@ class ContainerServiceClient(MultiApiClientMixin, _SDKClient): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str + credential: "TokenCredential", + subscription_id: str, api_version=None, # type: Optional[str] - base_url="https://management.azure.com", # type: str + base_url: str = "https://management.azure.com", profile=KnownProfiles.default, # type: KnownProfiles **kwargs # type: Any ): @@ -132,6 +129,8 @@ def models(cls, api_version=DEFAULT_API_VERSION): * 2022-05-02-preview: :mod:`v2022_05_02_preview.models` * 2022-06-01: :mod:`v2022_06_01.models` * 2022-06-02-preview: :mod:`v2022_06_02_preview.models` + * 2022-07-01: :mod:`v2022_07_01.models` + * 2022-07-02-preview: :mod:`v2022_07_02_preview.models` """ if api_version == '2017-07-01': from .v2017_07_01 import models @@ -256,6 +255,12 @@ def models(cls, api_version=DEFAULT_API_VERSION): elif api_version == '2022-06-02-preview': from .v2022_06_02_preview import models return models + elif api_version == '2022-07-01': + from .v2022_07_01 import models + return models + elif api_version == '2022-07-02-preview': + from .v2022_07_02_preview import models + return models raise ValueError("API version {} is not available".format(api_version)) @property @@ -296,6 +301,8 @@ def agent_pools(self): * 2022-05-02-preview: :class:`AgentPoolsOperations` * 2022-06-01: :class:`AgentPoolsOperations` * 2022-06-02-preview: :class:`AgentPoolsOperations` + * 2022-07-01: :class:`AgentPoolsOperations` + * 2022-07-02-preview: :class:`AgentPoolsOperations` """ api_version = self._get_api_version('agent_pools') if api_version == '2019-02-01': @@ -366,6 +373,10 @@ def agent_pools(self): from .v2022_06_01.operations import AgentPoolsOperations as OperationClass elif api_version == '2022-06-02-preview': from .v2022_06_02_preview.operations import AgentPoolsOperations as OperationClass + elif api_version == '2022-07-01': + from .v2022_07_01.operations import AgentPoolsOperations as OperationClass + elif api_version == '2022-07-02-preview': + from .v2022_07_02_preview.operations import AgentPoolsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'agent_pools'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -388,10 +399,13 @@ def fleet_members(self): """Instance depends on the API version: * 2022-06-02-preview: :class:`FleetMembersOperations` + * 2022-07-02-preview: :class:`FleetMembersOperations` """ api_version = self._get_api_version('fleet_members') if api_version == '2022-06-02-preview': from .v2022_06_02_preview.operations import FleetMembersOperations as OperationClass + elif api_version == '2022-07-02-preview': + from .v2022_07_02_preview.operations import FleetMembersOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'fleet_members'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -401,10 +415,13 @@ def fleets(self): """Instance depends on the API version: * 2022-06-02-preview: :class:`FleetsOperations` + * 2022-07-02-preview: :class:`FleetsOperations` """ api_version = self._get_api_version('fleets') if api_version == '2022-06-02-preview': from .v2022_06_02_preview.operations import FleetsOperations as OperationClass + elif api_version == '2022-07-02-preview': + from .v2022_07_02_preview.operations import FleetsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'fleets'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -433,6 +450,8 @@ def maintenance_configurations(self): * 2022-05-02-preview: :class:`MaintenanceConfigurationsOperations` * 2022-06-01: :class:`MaintenanceConfigurationsOperations` * 2022-06-02-preview: :class:`MaintenanceConfigurationsOperations` + * 2022-07-01: :class:`MaintenanceConfigurationsOperations` + * 2022-07-02-preview: :class:`MaintenanceConfigurationsOperations` """ api_version = self._get_api_version('maintenance_configurations') if api_version == '2020-12-01': @@ -475,6 +494,10 @@ def maintenance_configurations(self): from .v2022_06_01.operations import MaintenanceConfigurationsOperations as OperationClass elif api_version == '2022-06-02-preview': from .v2022_06_02_preview.operations import MaintenanceConfigurationsOperations as OperationClass + elif api_version == '2022-07-01': + from .v2022_07_01.operations import MaintenanceConfigurationsOperations as OperationClass + elif api_version == '2022-07-02-preview': + from .v2022_07_02_preview.operations import MaintenanceConfigurationsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'maintenance_configurations'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -488,6 +511,7 @@ def managed_cluster_snapshots(self): * 2022-04-02-preview: :class:`ManagedClusterSnapshotsOperations` * 2022-05-02-preview: :class:`ManagedClusterSnapshotsOperations` * 2022-06-02-preview: :class:`ManagedClusterSnapshotsOperations` + * 2022-07-02-preview: :class:`ManagedClusterSnapshotsOperations` """ api_version = self._get_api_version('managed_cluster_snapshots') if api_version == '2022-02-02-preview': @@ -500,6 +524,8 @@ def managed_cluster_snapshots(self): from .v2022_05_02_preview.operations import ManagedClusterSnapshotsOperations as OperationClass elif api_version == '2022-06-02-preview': from .v2022_06_02_preview.operations import ManagedClusterSnapshotsOperations as OperationClass + elif api_version == '2022-07-02-preview': + from .v2022_07_02_preview.operations import ManagedClusterSnapshotsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'managed_cluster_snapshots'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -544,6 +570,8 @@ def managed_clusters(self): * 2022-05-02-preview: :class:`ManagedClustersOperations` * 2022-06-01: :class:`ManagedClustersOperations` * 2022-06-02-preview: :class:`ManagedClustersOperations` + * 2022-07-01: :class:`ManagedClustersOperations` + * 2022-07-02-preview: :class:`ManagedClustersOperations` """ api_version = self._get_api_version('managed_clusters') if api_version == '2018-03-31': @@ -618,6 +646,10 @@ def managed_clusters(self): from .v2022_06_01.operations import ManagedClustersOperations as OperationClass elif api_version == '2022-06-02-preview': from .v2022_06_02_preview.operations import ManagedClustersOperations as OperationClass + elif api_version == '2022-07-01': + from .v2022_07_01.operations import ManagedClustersOperations as OperationClass + elif api_version == '2022-07-02-preview': + from .v2022_07_02_preview.operations import ManagedClustersOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'managed_clusters'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -684,6 +716,8 @@ def operations(self): * 2022-05-02-preview: :class:`Operations` * 2022-06-01: :class:`Operations` * 2022-06-02-preview: :class:`Operations` + * 2022-07-01: :class:`Operations` + * 2022-07-02-preview: :class:`Operations` """ api_version = self._get_api_version('operations') if api_version == '2018-03-31': @@ -758,6 +792,10 @@ def operations(self): from .v2022_06_01.operations import Operations as OperationClass elif api_version == '2022-06-02-preview': from .v2022_06_02_preview.operations import Operations as OperationClass + elif api_version == '2022-07-01': + from .v2022_07_01.operations import Operations as OperationClass + elif api_version == '2022-07-02-preview': + from .v2022_07_02_preview.operations import Operations as OperationClass else: raise ValueError("API version {} does not have operation group 'operations'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -790,6 +828,8 @@ def private_endpoint_connections(self): * 2022-05-02-preview: :class:`PrivateEndpointConnectionsOperations` * 2022-06-01: :class:`PrivateEndpointConnectionsOperations` * 2022-06-02-preview: :class:`PrivateEndpointConnectionsOperations` + * 2022-07-01: :class:`PrivateEndpointConnectionsOperations` + * 2022-07-02-preview: :class:`PrivateEndpointConnectionsOperations` """ api_version = self._get_api_version('private_endpoint_connections') if api_version == '2020-06-01': @@ -840,6 +880,10 @@ def private_endpoint_connections(self): from .v2022_06_01.operations import PrivateEndpointConnectionsOperations as OperationClass elif api_version == '2022-06-02-preview': from .v2022_06_02_preview.operations import PrivateEndpointConnectionsOperations as OperationClass + elif api_version == '2022-07-01': + from .v2022_07_01.operations import PrivateEndpointConnectionsOperations as OperationClass + elif api_version == '2022-07-02-preview': + from .v2022_07_02_preview.operations import PrivateEndpointConnectionsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'private_endpoint_connections'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -870,6 +914,8 @@ def private_link_resources(self): * 2022-05-02-preview: :class:`PrivateLinkResourcesOperations` * 2022-06-01: :class:`PrivateLinkResourcesOperations` * 2022-06-02-preview: :class:`PrivateLinkResourcesOperations` + * 2022-07-01: :class:`PrivateLinkResourcesOperations` + * 2022-07-02-preview: :class:`PrivateLinkResourcesOperations` """ api_version = self._get_api_version('private_link_resources') if api_version == '2020-09-01': @@ -916,6 +962,10 @@ def private_link_resources(self): from .v2022_06_01.operations import PrivateLinkResourcesOperations as OperationClass elif api_version == '2022-06-02-preview': from .v2022_06_02_preview.operations import PrivateLinkResourcesOperations as OperationClass + elif api_version == '2022-07-01': + from .v2022_07_01.operations import PrivateLinkResourcesOperations as OperationClass + elif api_version == '2022-07-02-preview': + from .v2022_07_02_preview.operations import PrivateLinkResourcesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'private_link_resources'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -946,6 +996,8 @@ def resolve_private_link_service_id(self): * 2022-05-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` * 2022-06-01: :class:`ResolvePrivateLinkServiceIdOperations` * 2022-06-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` + * 2022-07-01: :class:`ResolvePrivateLinkServiceIdOperations` + * 2022-07-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` """ api_version = self._get_api_version('resolve_private_link_service_id') if api_version == '2020-09-01': @@ -992,6 +1044,10 @@ def resolve_private_link_service_id(self): from .v2022_06_01.operations import ResolvePrivateLinkServiceIdOperations as OperationClass elif api_version == '2022-06-02-preview': from .v2022_06_02_preview.operations import ResolvePrivateLinkServiceIdOperations as OperationClass + elif api_version == '2022-07-01': + from .v2022_07_01.operations import ResolvePrivateLinkServiceIdOperations as OperationClass + elif api_version == '2022-07-02-preview': + from .v2022_07_02_preview.operations import ResolvePrivateLinkServiceIdOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'resolve_private_link_service_id'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -1015,6 +1071,8 @@ def snapshots(self): * 2022-05-02-preview: :class:`SnapshotsOperations` * 2022-06-01: :class:`SnapshotsOperations` * 2022-06-02-preview: :class:`SnapshotsOperations` + * 2022-07-01: :class:`SnapshotsOperations` + * 2022-07-02-preview: :class:`SnapshotsOperations` """ api_version = self._get_api_version('snapshots') if api_version == '2021-08-01': @@ -1047,6 +1105,10 @@ def snapshots(self): from .v2022_06_01.operations import SnapshotsOperations as OperationClass elif api_version == '2022-06-02-preview': from .v2022_06_02_preview.operations import SnapshotsOperations as OperationClass + elif api_version == '2022-07-01': + from .v2022_07_01.operations import SnapshotsOperations as OperationClass + elif api_version == '2022-07-02-preview': + from .v2022_07_02_preview.operations import SnapshotsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'snapshots'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -1058,6 +1120,7 @@ def trusted_access_role_bindings(self): * 2022-04-02-preview: :class:`TrustedAccessRoleBindingsOperations` * 2022-05-02-preview: :class:`TrustedAccessRoleBindingsOperations` * 2022-06-02-preview: :class:`TrustedAccessRoleBindingsOperations` + * 2022-07-02-preview: :class:`TrustedAccessRoleBindingsOperations` """ api_version = self._get_api_version('trusted_access_role_bindings') if api_version == '2022-04-02-preview': @@ -1066,6 +1129,8 @@ def trusted_access_role_bindings(self): from .v2022_05_02_preview.operations import TrustedAccessRoleBindingsOperations as OperationClass elif api_version == '2022-06-02-preview': from .v2022_06_02_preview.operations import TrustedAccessRoleBindingsOperations as OperationClass + elif api_version == '2022-07-02-preview': + from .v2022_07_02_preview.operations import TrustedAccessRoleBindingsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'trusted_access_role_bindings'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -1077,6 +1142,7 @@ def trusted_access_roles(self): * 2022-04-02-preview: :class:`TrustedAccessRolesOperations` * 2022-05-02-preview: :class:`TrustedAccessRolesOperations` * 2022-06-02-preview: :class:`TrustedAccessRolesOperations` + * 2022-07-02-preview: :class:`TrustedAccessRolesOperations` """ api_version = self._get_api_version('trusted_access_roles') if api_version == '2022-04-02-preview': @@ -1085,6 +1151,8 @@ def trusted_access_roles(self): from .v2022_05_02_preview.operations import TrustedAccessRolesOperations as OperationClass elif api_version == '2022-06-02-preview': from .v2022_06_02_preview.operations import TrustedAccessRolesOperations as OperationClass + elif api_version == '2022-07-02-preview': + from .v2022_07_02_preview.operations import TrustedAccessRolesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'trusted_access_roles'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/_serialization.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/_serialization.py new file mode 100644 index 000000000000..2e44d8666b2b --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/_serialization.py @@ -0,0 +1,2006 @@ +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# pylint: skip-file + +from base64 import b64decode, b64encode +import calendar +import datetime +import decimal +import email +from enum import Enum +import json +import logging +import re +import sys +import codecs +try: + from urllib import quote # type: ignore +except ImportError: + from urllib.parse import quote # type: ignore +import xml.etree.ElementTree as ET + +import isodate + +from typing import Dict, Any, cast, TYPE_CHECKING + +from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback + +_BOM = codecs.BOM_UTF8.decode(encoding='utf-8') + +if TYPE_CHECKING: + from typing import Optional, Union, AnyStr, IO, Mapping + +class RawDeserializer: + + # Accept "text" because we're open minded people... + JSON_REGEXP = re.compile(r'^(application|text)/([a-z+.]+\+)?json$') + + # Name used in context + CONTEXT_NAME = "deserialized_data" + + @classmethod + def deserialize_from_text(cls, data, content_type=None): + # type: (Optional[Union[AnyStr, IO]], Optional[str]) -> Any + """Decode data according to content-type. + + Accept a stream of data as well, but will be load at once in memory for now. + + If no content-type, will return the string version (not bytes, not stream) + + :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. + """ + if hasattr(data, 'read'): + # Assume a stream + data = cast(IO, data).read() + + if isinstance(data, bytes): + data_as_str = data.decode(encoding='utf-8-sig') + else: + # Explain to mypy the correct type. + data_as_str = cast(str, data) + + # Remove Byte Order Mark if present in string + data_as_str = data_as_str.lstrip(_BOM) + + if content_type is None: + return data + + if cls.JSON_REGEXP.match(content_type): + try: + return json.loads(data_as_str) + except ValueError as err: + raise DeserializationError("JSON is invalid: {}".format(err), err) + elif "xml" in (content_type or []): + try: + + try: + if isinstance(data, unicode): # type: ignore + # If I'm Python 2.7 and unicode XML will scream if I try a "fromstring" on unicode string + data_as_str = data_as_str.encode(encoding="utf-8") # type: ignore + except NameError: + pass + + return ET.fromstring(data_as_str) # nosec + except ET.ParseError: + # It might be because the server has an issue, and returned JSON with + # content-type XML.... + # So let's try a JSON load, and if it's still broken + # let's flow the initial exception + def _json_attemp(data): + try: + return True, json.loads(data) + except ValueError: + return False, None # Don't care about this one + success, json_result = _json_attemp(data) + if success: + return json_result + # If i'm here, it's not JSON, it's not XML, let's scream + # and raise the last context in this block (the XML exception) + # The function hack is because Py2.7 messes up with exception + # context otherwise. + _LOGGER.critical("Wasn't XML not JSON, failing") + raise_with_traceback(DeserializationError, "XML is invalid") + raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) + + @classmethod + def deserialize_from_http_generics(cls, body_bytes, headers): + # type: (Optional[Union[AnyStr, IO]], Mapping) -> Any + """Deserialize from HTTP response. + + Use bytes and headers to NOT use any requests/aiohttp or whatever + specific implementation. + Headers will tested for "content-type" + """ + # Try to use content-type from headers if available + content_type = None + if 'content-type' in headers: + content_type = headers['content-type'].split(";")[0].strip().lower() + # Ouch, this server did not declare what it sent... + # Let's guess it's JSON... + # Also, since Autorest was considering that an empty body was a valid JSON, + # need that test as well.... + else: + content_type = "application/json" + + if body_bytes: + return cls.deserialize_from_text(body_bytes, content_type) + return None + +try: + basestring # type: ignore + unicode_str = unicode # type: ignore +except NameError: + basestring = str # type: ignore + unicode_str = str # type: ignore + +_LOGGER = logging.getLogger(__name__) + +try: + _long_type = long # type: ignore +except NameError: + _long_type = int + +class UTC(datetime.tzinfo): + """Time Zone info for handling UTC""" + + def utcoffset(self, dt): + """UTF offset for UTC is 0.""" + return datetime.timedelta(0) + + def tzname(self, dt): + """Timestamp representation.""" + return "Z" + + def dst(self, dt): + """No daylight saving for UTC.""" + return datetime.timedelta(hours=1) + +try: + from datetime import timezone as _FixedOffset +except ImportError: # Python 2.7 + class _FixedOffset(datetime.tzinfo): # type: ignore + """Fixed offset in minutes east from UTC. + Copy/pasted from Python doc + :param datetime.timedelta offset: offset in timedelta format + """ + + def __init__(self, offset): + self.__offset = offset + + def utcoffset(self, dt): + return self.__offset + + def tzname(self, dt): + return str(self.__offset.total_seconds()/3600) + + def __repr__(self): + return "".format(self.tzname(None)) + + def dst(self, dt): + return datetime.timedelta(0) + + def __getinitargs__(self): + return (self.__offset,) + +try: + from datetime import timezone + TZ_UTC = timezone.utc # type: ignore +except ImportError: + TZ_UTC = UTC() # type: ignore + +_FLATTEN = re.compile(r"(? y, + "minimum": lambda x, y: x < y, + "maximum": lambda x, y: x > y, + "minimum_ex": lambda x, y: x <= y, + "maximum_ex": lambda x, y: x >= y, + "min_items": lambda x, y: len(x) < y, + "max_items": lambda x, y: len(x) > y, + "pattern": lambda x, y: not re.match(y, x, re.UNICODE), + "unique": lambda x, y: len(x) != len(set(x)), + "multiple": lambda x, y: x % y != 0 + } + + def __init__(self, classes=None): + self.serialize_type = { + 'iso-8601': Serializer.serialize_iso, + 'rfc-1123': Serializer.serialize_rfc, + 'unix-time': Serializer.serialize_unix, + 'duration': Serializer.serialize_duration, + 'date': Serializer.serialize_date, + 'time': Serializer.serialize_time, + 'decimal': Serializer.serialize_decimal, + 'long': Serializer.serialize_long, + 'bytearray': Serializer.serialize_bytearray, + 'base64': Serializer.serialize_base64, + 'object': self.serialize_object, + '[]': self.serialize_iter, + '{}': self.serialize_dict + } + self.dependencies = dict(classes) if classes else {} + self.key_transformer = full_restapi_key_transformer + self.client_side_validation = True + + def _serialize(self, target_obj, data_type=None, **kwargs): + """Serialize data into a string according to type. + + :param 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. + """ + key_transformer = kwargs.get("key_transformer", self.key_transformer) + keep_readonly = kwargs.get("keep_readonly", False) + if target_obj is None: + return None + + attr_name = None + class_name = target_obj.__class__.__name__ + + if data_type: + return self.serialize_data( + target_obj, data_type, **kwargs) + + if not hasattr(target_obj, "_attribute_map"): + data_type = type(target_obj).__name__ + if data_type in self.basic_types.values(): + return self.serialize_data( + target_obj, data_type, **kwargs) + + # Force "is_xml" kwargs if we detect a XML model + try: + is_xml_model_serialization = kwargs["is_xml"] + except KeyError: + is_xml_model_serialization = kwargs.setdefault("is_xml", target_obj.is_xml_model()) + + serialized = {} + if is_xml_model_serialization: + serialized = target_obj._create_xml_node() + try: + attributes = target_obj._attribute_map + for attr, attr_desc in attributes.items(): + attr_name = attr + if not keep_readonly and target_obj._validation.get(attr_name, {}).get('readonly', False): + continue + + if attr_name == "additional_properties" and attr_desc["key"] == '': + if target_obj.additional_properties is not None: + serialized.update(target_obj.additional_properties) + continue + try: + + orig_attr = getattr(target_obj, attr) + if is_xml_model_serialization: + pass # Don't provide "transformer" for XML for now. Keep "orig_attr" + else: # JSON + keys, orig_attr = key_transformer(attr, attr_desc.copy(), orig_attr) + keys = keys if isinstance(keys, list) else [keys] + + + kwargs["serialization_ctxt"] = attr_desc + new_attr = self.serialize_data(orig_attr, attr_desc['type'], **kwargs) + + + if is_xml_model_serialization: + xml_desc = attr_desc.get('xml', {}) + xml_name = xml_desc.get('name', attr_desc['key']) + xml_prefix = xml_desc.get('prefix', None) + xml_ns = xml_desc.get('ns', None) + if xml_desc.get("attr", False): + if xml_ns: + ET.register_namespace(xml_prefix, xml_ns) + xml_name = "{}{}".format(xml_ns, xml_name) + serialized.set(xml_name, new_attr) + continue + if xml_desc.get("text", False): + serialized.text = new_attr + continue + if isinstance(new_attr, list): + serialized.extend(new_attr) + elif isinstance(new_attr, ET.Element): + # If the down XML has no XML/Name, we MUST replace the tag with the local tag. But keeping the namespaces. + if 'name' not in getattr(orig_attr, '_xml_map', {}): + splitted_tag = new_attr.tag.split("}") + if len(splitted_tag) == 2: # Namespace + new_attr.tag = "}".join([splitted_tag[0], xml_name]) + else: + new_attr.tag = xml_name + serialized.append(new_attr) + else: # That's a basic type + # Integrate namespace if necessary + local_node = _create_xml_node( + xml_name, + xml_prefix, + xml_ns + ) + local_node.text = unicode_str(new_attr) + serialized.append(local_node) + else: # JSON + for k in reversed(keys): + unflattened = {k: new_attr} + new_attr = unflattened + + _new_attr = new_attr + _serialized = serialized + for k in keys: + if k not in _serialized: + _serialized.update(_new_attr) + _new_attr = _new_attr[k] + _serialized = _serialized[k] + except ValueError: + continue + + except (AttributeError, KeyError, TypeError) as err: + msg = "Attribute {} in object {} cannot be serialized.\n{}".format( + attr_name, class_name, str(target_obj)) + raise_with_traceback(SerializationError, msg, err) + else: + return serialized + + def body(self, data, data_type, **kwargs): + """Serialize data intended for a request body. + + :param 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 + """ + + # Just in case this is a dict + internal_data_type = data_type.strip('[]{}') + internal_data_type = self.dependencies.get(internal_data_type, None) + try: + is_xml_model_serialization = kwargs["is_xml"] + except KeyError: + if internal_data_type and issubclass(internal_data_type, Model): + is_xml_model_serialization = kwargs.setdefault("is_xml", internal_data_type.is_xml_model()) + else: + is_xml_model_serialization = False + if internal_data_type and not isinstance(internal_data_type, Enum): + try: + deserializer = Deserializer(self.dependencies) + # Since it's on serialization, it's almost sure that format is not JSON REST + # We're not able to deal with additional properties for now. + deserializer.additional_properties_detection = False + if is_xml_model_serialization: + deserializer.key_extractors = [ + attribute_key_case_insensitive_extractor, + ] + else: + deserializer.key_extractors = [ + rest_key_case_insensitive_extractor, + attribute_key_case_insensitive_extractor, + last_rest_key_case_insensitive_extractor + ] + data = deserializer._deserialize(data_type, data) + except DeserializationError as err: + raise_with_traceback( + SerializationError, "Unable to build a model: "+str(err), err) + + return self._serialize(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 data_type: The type to be serialized from. + :rtype: str + :raises: TypeError if serialization fails. + :raises: ValueError if data is None + """ + try: + output = self.serialize_data(data, data_type, **kwargs) + if data_type == 'bool': + output = json.dumps(output) + + if kwargs.get('skip_quote') is True: + output = str(output) + else: + output = quote(str(output), safe='') + except SerializationError: + raise TypeError("{} must be type {}.".format(name, data_type)) + else: + 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 data_type: The type to be serialized from. + :rtype: str + :raises: TypeError if serialization fails. + :raises: ValueError if data is None + """ + try: + # Treat the list aside, since we don't want to encode the div separator + if data_type.startswith("["): + internal_data_type = data_type[1:-1] + data = [ + self.serialize_data(d, internal_data_type, **kwargs) if d is not None else "" + for d + in data + ] + if not kwargs.get('skip_quote', False): + data = [ + quote(str(d), safe='') + for d + in data + ] + return str(self.serialize_iter(data, internal_data_type, **kwargs)) + + # Not a list, regular serialization + output = self.serialize_data(data, data_type, **kwargs) + if data_type == 'bool': + output = json.dumps(output) + if kwargs.get('skip_quote') is True: + output = str(output) + else: + output = quote(str(output), safe='') + except SerializationError: + raise TypeError("{} must be type {}.".format(name, data_type)) + else: + 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 data_type: The type to be serialized from. + :rtype: str + :raises: TypeError if serialization fails. + :raises: ValueError if data is None + """ + try: + if data_type in ['[str]']: + data = ["" if d is None else d for d in data] + + 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) + + def serialize_data(self, data, data_type, **kwargs): + """Serialize generic data according to supplied data type. + + :param 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. + """ + if data is None: + raise ValueError("No value for given attribute") + + try: + if data_type in self.basic_types.values(): + return self.serialize_basic(data, data_type, **kwargs) + + elif data_type in self.serialize_type: + return self.serialize_type[data_type](data, **kwargs) + + # If dependencies is empty, try with current data class + # It has to be a subclass of Enum anyway + enum_type = self.dependencies.get(data_type, data.__class__) + if issubclass(enum_type, Enum): + return Serializer.serialize_enum(data, enum_obj=enum_type) + + iter_type = data_type[0] + data_type[-1] + if iter_type in self.serialize_type: + return self.serialize_type[iter_type]( + data, data_type[1:-1], **kwargs) + + except (ValueError, TypeError) as err: + msg = "Unable to serialize value: {!r} as type: {!r}." + raise_with_traceback( + SerializationError, msg.format(data, data_type), err) + else: + return self._serialize(data, **kwargs) + + @classmethod + def _get_custom_serializers(cls, data_type, **kwargs): + custom_serializer = kwargs.get("basic_types_serializers", {}).get(data_type) + if custom_serializer: + return custom_serializer + if kwargs.get("is_xml", False): + return cls._xml_basic_types_serializers.get(data_type) + + @classmethod + def serialize_basic(cls, data, data_type, **kwargs): + """Serialize basic builting data type. + Serializes objects to str, int, float or bool. + + Possible 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 str data_type: Type of object in the iterable. + """ + 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 + + @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. + :rtype: str + """ + try: # If I received an enum, return its value + return data.value + except AttributeError: + pass + + try: + if isinstance(data, unicode): + # Don't change it, JSON and XML ElementTree are totally able + # to serialize correctly u'' strings + return data + except NameError: + return str(data) + else: + return str(data) + + def serialize_iter(self, data, iter_type, div=None, **kwargs): + """Serialize iterable. + + Supported kwargs: + - serialization_ctxt dict : The current entry of _attribute_map, or same format. + 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 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'. + :rtype: list, str + """ + if isinstance(data, str): + raise SerializationError("Refuse str type as a valid iter type.") + + serialization_ctxt = kwargs.get("serialization_ctxt", {}) + is_xml = kwargs.get("is_xml", False) + + serialized = [] + for d in data: + try: + serialized.append(self.serialize_data(d, iter_type, **kwargs)) + except ValueError: + serialized.append(None) + + if div: + serialized = ['' if s is None else str(s) for s in serialized] + serialized = div.join(serialized) + + if 'xml' in serialization_ctxt or is_xml: + # XML serialization is more complicated + xml_desc = serialization_ctxt.get('xml', {}) + xml_name = xml_desc.get('name') + if not xml_name: + xml_name = serialization_ctxt['key'] + + # Create a wrap node if necessary (use the fact that Element and list have "append") + is_wrapped = xml_desc.get("wrapped", False) + node_name = xml_desc.get("itemsName", xml_name) + if is_wrapped: + final_result = _create_xml_node( + xml_name, + xml_desc.get('prefix', None), + xml_desc.get('ns', None) + ) + else: + final_result = [] + # All list elements to "local_node" + for el in serialized: + if isinstance(el, ET.Element): + el_node = el + else: + el_node = _create_xml_node( + node_name, + xml_desc.get('prefix', None), + xml_desc.get('ns', None) + ) + if el is not None: # Otherwise it writes "None" :-p + el_node.text = str(el) + final_result.append(el_node) + return final_result + return serialized + + def serialize_dict(self, attr, dict_type, **kwargs): + """Serialize a dictionary of objects. + + :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 + """ + serialization_ctxt = kwargs.get("serialization_ctxt", {}) + serialized = {} + for key, value in attr.items(): + try: + serialized[self.serialize_unicode(key)] = self.serialize_data( + value, dict_type, **kwargs) + except ValueError: + serialized[self.serialize_unicode(key)] = None + + if 'xml' in serialization_ctxt: + # XML serialization is more complicated + xml_desc = serialization_ctxt['xml'] + xml_name = xml_desc['name'] + + final_result = _create_xml_node( + xml_name, + xml_desc.get('prefix', None), + xml_desc.get('ns', None) + ) + for key, value in serialized.items(): + ET.SubElement(final_result, key).text = value + return final_result + + return serialized + + def serialize_object(self, attr, **kwargs): + """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 + cast to str. + + :param dict attr: Object to be serialized. + :rtype: dict or str + """ + if attr is None: + return None + if isinstance(attr, ET.Element): + return attr + obj_type = type(attr) + if obj_type in self.basic_types: + return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs) + if obj_type is _long_type: + return self.serialize_long(attr) + if obj_type is unicode_str: + return self.serialize_unicode(attr) + if obj_type is datetime.datetime: + return self.serialize_iso(attr) + if obj_type is datetime.date: + return self.serialize_date(attr) + if obj_type is datetime.time: + return self.serialize_time(attr) + if obj_type is datetime.timedelta: + return self.serialize_duration(attr) + if obj_type is decimal.Decimal: + 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): + return self._serialize(attr) + + if obj_type == dict: + serialized = {} + for key, value in attr.items(): + try: + serialized[self.serialize_unicode(key)] = self.serialize_object( + value, **kwargs) + except ValueError: + serialized[self.serialize_unicode(key)] = None + return serialized + + if obj_type == list: + serialized = [] + for obj in attr: + try: + serialized.append(self.serialize_object( + obj, **kwargs)) + except ValueError: + pass + return serialized + return str(attr) + + @staticmethod + def serialize_enum(attr, enum_obj=None): + try: + result = attr.value + except AttributeError: + result = attr + try: + enum_obj(result) + return result + except ValueError: + for enum_value in enum_obj: + 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)) + + @staticmethod + def serialize_bytearray(attr, **kwargs): + """Serialize bytearray into base-64 string. + + :param attr: Object to be serialized. + :rtype: str + """ + return b64encode(attr).decode() + + @staticmethod + def serialize_base64(attr, **kwargs): + """Serialize str into base-64 string. + + :param attr: Object to be serialized. + :rtype: str + """ + encoded = b64encode(attr).decode('ascii') + return encoded.strip('=').replace('+', '-').replace('/', '_') + + @staticmethod + def serialize_decimal(attr, **kwargs): + """Serialize Decimal object to float. + + :param attr: Object to be serialized. + :rtype: float + """ + return float(attr) + + @staticmethod + def serialize_long(attr, **kwargs): + """Serialize long (Py2) or int (Py3). + + :param attr: Object to be serialized. + :rtype: int/long + """ + return _long_type(attr) + + @staticmethod + def serialize_date(attr, **kwargs): + """Serialize Date object into ISO-8601 formatted string. + + :param Date attr: Object to be serialized. + :rtype: str + """ + if isinstance(attr, str): + attr = isodate.parse_date(attr) + t = "{:04}-{:02}-{:02}".format(attr.year, attr.month, attr.day) + return t + + @staticmethod + def serialize_time(attr, **kwargs): + """Serialize Time object into ISO-8601 formatted string. + + :param datetime.time attr: Object to be serialized. + :rtype: str + """ + if isinstance(attr, str): + attr = isodate.parse_time(attr) + t = "{:02}:{:02}:{:02}".format(attr.hour, attr.minute, attr.second) + if attr.microsecond: + t += ".{:02}".format(attr.microsecond) + return t + + @staticmethod + def serialize_duration(attr, **kwargs): + """Serialize TimeDelta object into ISO-8601 formatted string. + + :param TimeDelta attr: Object to be serialized. + :rtype: str + """ + if isinstance(attr, str): + attr = isodate.parse_duration(attr) + return isodate.duration_isoformat(attr) + + @staticmethod + def serialize_rfc(attr, **kwargs): + """Serialize Datetime object into RFC-1123 formatted string. + + :param Datetime attr: Object to be serialized. + :rtype: str + :raises: TypeError if format invalid. + """ + 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.") + + return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( + Serializer.days[utc.tm_wday], utc.tm_mday, + Serializer.months[utc.tm_mon], utc.tm_year, + utc.tm_hour, utc.tm_min, utc.tm_sec) + + @staticmethod + def serialize_iso(attr, **kwargs): + """Serialize Datetime object into ISO-8601 formatted string. + + :param Datetime attr: Object to be serialized. + :rtype: str + :raises: SerializationError if format invalid. + """ + if isinstance(attr, str): + attr = isodate.parse_datetime(attr) + try: + if not attr.tzinfo: + _LOGGER.warning( + "Datetime with no tzinfo will be considered UTC.") + utc = attr.utctimetuple() + if utc.tm_year > 9999 or utc.tm_year < 1: + raise OverflowError("Hit max or min date") + + microseconds = str(attr.microsecond).rjust(6,'0').rstrip('0').ljust(3, '0') + if microseconds: + microseconds = '.'+microseconds + date = "{:04}-{:02}-{:02}T{:02}:{:02}:{:02}".format( + utc.tm_year, utc.tm_mon, utc.tm_mday, + utc.tm_hour, utc.tm_min, utc.tm_sec) + return date + microseconds + 'Z' + except (ValueError, OverflowError) as err: + msg = "Unable to serialize datetime object." + raise_with_traceback(SerializationError, msg, err) + except AttributeError as err: + msg = "ISO-8601 object must be valid Datetime object." + raise_with_traceback(TypeError, msg, err) + + @staticmethod + def serialize_unix(attr, **kwargs): + """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 + """ + if isinstance(attr, int): + return attr + try: + 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.") + +def rest_key_extractor(attr, attr_desc, data): + key = attr_desc['key'] + working_data = data + + while '.' in key: + dict_keys = _FLATTEN.split(key) + if len(dict_keys) == 1: + key = _decode_attribute_map_key(dict_keys[0]) + break + working_key = _decode_attribute_map_key(dict_keys[0]) + working_data = working_data.get(working_key, data) + if working_data is None: + # If at any point while following flatten JSON path see None, it means + # that all properties under are None as well + # https://github.com/Azure/msrest-for-python/issues/197 + return None + key = '.'.join(dict_keys[1:]) + + return working_data.get(key) + +def rest_key_case_insensitive_extractor(attr, attr_desc, data): + key = attr_desc['key'] + working_data = data + + while '.' in key: + dict_keys = _FLATTEN.split(key) + if len(dict_keys) == 1: + key = _decode_attribute_map_key(dict_keys[0]) + break + working_key = _decode_attribute_map_key(dict_keys[0]) + working_data = attribute_key_case_insensitive_extractor(working_key, None, working_data) + if working_data is None: + # If at any point while following flatten JSON path see None, it means + # that all properties under are None as well + # https://github.com/Azure/msrest-for-python/issues/197 + return None + key = '.'.join(dict_keys[1:]) + + if working_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. + """ + 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): + """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" + """ + key = attr_desc['key'] + dict_keys = _FLATTEN.split(key) + return attribute_key_case_insensitive_extractor(dict_keys[-1], None, data) + +def attribute_key_extractor(attr, _, data): + return data.get(attr) + +def attribute_key_case_insensitive_extractor(attr, _, data): + found_key = None + lower_attr = attr.lower() + for key in data: + if lower_attr == key.lower(): + found_key = key + break + + return data.get(found_key) + +def _extract_name_from_internal_type(internal_type): + """Given an internal type XML description, extract correct XML name with namespace. + + :param dict internal_type: An model type + :rtype: tuple + :returns: A tuple XML name + namespace dict + """ + internal_type_xml_map = getattr(internal_type, "_xml_map", {}) + xml_name = internal_type_xml_map.get('name', internal_type.__name__) + xml_ns = internal_type_xml_map.get("ns", None) + if xml_ns: + xml_name = "{}{}".format(xml_ns, xml_name) + return xml_name + + +def xml_key_extractor(attr, attr_desc, data): + if isinstance(data, dict): + return None + + # Test if this model is XML ready first + if not isinstance(data, ET.Element): + return None + + xml_desc = attr_desc.get('xml', {}) + xml_name = xml_desc.get('name', attr_desc['key']) + + # Look for a children + is_iter_type = attr_desc['type'].startswith("[") + is_wrapped = xml_desc.get("wrapped", False) + internal_type = attr_desc.get("internalType", None) + internal_type_xml_map = getattr(internal_type, "_xml_map", {}) + + # Integrate namespace if necessary + xml_ns = xml_desc.get('ns', internal_type_xml_map.get("ns", None)) + if xml_ns: + xml_name = "{}{}".format(xml_ns, xml_name) + + # If it's an attribute, that's simple + if xml_desc.get("attr", False): + return data.get(xml_name) + + # If it's x-ms-text, that's simple too + if xml_desc.get("text", False): + return data.text + + # Scenario where I take the local name: + # - Wrapped node + # - Internal type is an enum (considered basic types) + # - Internal type has no XML/Name node + if is_wrapped or (internal_type and (issubclass(internal_type, Enum) or 'name' not in internal_type_xml_map)): + children = data.findall(xml_name) + # If internal type has a local name and it's not a list, I use that name + elif not is_iter_type and internal_type and 'name' in internal_type_xml_map: + xml_name = _extract_name_from_internal_type(internal_type) + children = data.findall(xml_name) + # That's an array + else: + if internal_type: # Complex type, ignore itemsName and use the complex type name + items_name = _extract_name_from_internal_type(internal_type) + else: + items_name = xml_desc.get("itemsName", xml_name) + children = data.findall(items_name) + + if len(children) == 0: + if is_iter_type: + if is_wrapped: + return None # is_wrapped no node, we want None + else: + 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 + )) + 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: + raise DeserializationError("Find several XML '{}' where it was not expected".format(xml_name)) + return children[0] + +class Deserializer(object): + """Response object model deserializer. + + :param dict classes: Class type dictionary for deserializing complex types. + :ivar list key_extractors: Ordered list of extractors to be used by this deserializer. + """ + + 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}]?') + + def __init__(self, classes=None): + self.deserialize_type = { + 'iso-8601': Deserializer.deserialize_iso, + 'rfc-1123': Deserializer.deserialize_rfc, + 'unix-time': Deserializer.deserialize_unix, + 'duration': Deserializer.deserialize_duration, + 'date': Deserializer.deserialize_date, + 'time': Deserializer.deserialize_time, + 'decimal': Deserializer.deserialize_decimal, + 'long': Deserializer.deserialize_long, + 'bytearray': Deserializer.deserialize_bytearray, + 'base64': Deserializer.deserialize_base64, + 'object': self.deserialize_object, + '[]': self.deserialize_iter, + '{}': self.deserialize_dict + } + self.deserialize_expected_types = { + 'duration': (isodate.Duration, datetime.timedelta), + 'iso-8601': (datetime.datetime) + } + self.dependencies = dict(classes) if classes else {} + self.key_extractors = [ + rest_key_extractor, + xml_key_extractor + ] + # Additional properties only works if the "rest_key_extractor" is used to + # extract the keys. Making it to work whatever the key extractor is too much + # complicated, with no real scenario for now. + # So adding a flag to disable additional properties detection. This flag should be + # used if your expect the deserialization to NOT come from a JSON REST syntax. + # Otherwise, result are unexpected + self.additional_properties_detection = True + + def __call__(self, target_obj, response_data, content_type=None): + """Call the deserializer to process a REST response. + + :param str target_obj: Target data type to deserialize to. + :param requests.Response response_data: REST response object. + :param str content_type: Swagger "produces" if available. + :raises: DeserializationError if deserialization fails. + :return: Deserialized object. + """ + data = self._unpack_content(response_data, content_type) + return self._deserialize(target_obj, data) + + def _deserialize(self, target_obj, data): + """Call the deserializer on a model. + + Data needs to be already deserialized as JSON or XML ElementTree + + :param str target_obj: Target data type to deserialize to. + :param object data: Object to deserialize. + :raises: DeserializationError if deserialization fails. + :return: Deserialized 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(): + if attr in constants: + continue + value = getattr(data, attr) + if value is None: + continue + local_type = mapconfig['type'] + internal_data_type = local_type.strip('[]{}') + if internal_data_type not in self.dependencies or isinstance(internal_data_type, Enum): + continue + setattr( + data, + attr, + self._deserialize(local_type, value) + ) + return data + except AttributeError: + return + + response, class_name = self._classify_target(target_obj, data) + + if isinstance(response, basestring): + return self.deserialize_data(data, response) + elif isinstance(response, type) and issubclass(response, Enum): + return self.deserialize_enum(data, response) + + if data is None: + return data + try: + attributes = response._attribute_map + d_attrs = {} + for attr, attr_desc in attributes.items(): + # Check empty string. If it's not empty, someone has a real "additionalProperties"... + if attr == "additional_properties" and attr_desc["key"] == '': + continue + raw_value = None + # Enhance attr_desc with some dynamic data + attr_desc = attr_desc.copy() # Do a copy, do not change the real one + internal_data_type = attr_desc["type"].strip('[]{}') + if internal_data_type in self.dependencies: + attr_desc["internalType"] = self.dependencies[internal_data_type] + + for key_extractor in self.key_extractors: + found_value = key_extractor(attr, attr_desc, data) + if found_value is not None: + if raw_value is not None and raw_value != found_value: + msg = ("Ignoring extracted value '%s' from %s for key '%s'" + " (duplicate extraction, follow extractors order)" ) + _LOGGER.warning( + msg, + found_value, + key_extractor, + attr + ) + continue + raw_value = found_value + + value = self.deserialize_data(raw_value, attr_desc['type']) + d_attrs[attr] = value + except (AttributeError, TypeError, KeyError) as err: + msg = "Unable to deserialize to object: " + class_name + raise_with_traceback(DeserializationError, msg, err) + else: + 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: + return None + if "additional_properties" in attribute_map and attribute_map.get("additional_properties", {}).get("key") != '': + # Check empty string. If it's not empty, someone has a real "additionalProperties" + return None + if isinstance(data, ET.Element): + data = {el.tag: el.text for el in data} + + known_keys = {_decode_attribute_map_key(_FLATTEN.split(desc['key'])[0]) + for desc in attribute_map.values() if desc['key'] != ''} + present_keys = set(data.keys()) + missing_keys = present_keys - known_keys + return {key: data[key] for key in missing_keys} + + def _classify_target(self, target, data): + """Check to see whether the deserialization target object can + be classified into a subclass. + Once classification has been determined, initialize object. + + :param str target: The target object type to deserialize to. + :param str/dict data: The response data to deseralize. + """ + if target is None: + return None, None + + if isinstance(target, basestring): + try: + target = self.dependencies[target] + except KeyError: + return target, target + + try: + target = target._classify(data, self.dependencies) + except AttributeError: + pass # Target is not a Model, no classify + return target, target.__class__.__name__ + + def failsafe_deserialize(self, target_obj, data, content_type=None): + """Ignores any errors encountered in deserialization, + and falls back to not deserializing the object. Recommended + for use in error deserialization, as we want to return the + HttpResponseError to users, and not have them deal with + a deserialization error. + + :param str target_obj: The target object type to deserialize to. + :param str/dict data: The response data to deseralize. + :param str content_type: Swagger "produces" if available. + """ + try: + return self(target_obj, data, content_type=content_type) + except: + _LOGGER.warning( + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", + exc_info=True + ) + return None + + @staticmethod + def _unpack_content(raw_data, content_type=None): + """Extract the correct structure for deserialization. + + If raw_data is a PipelineResponse, try to extract the result of RawDeserializer. + if we can't, raise. Your Pipeline should have a RawDeserializer. + + If not a pipeline response and raw_data is bytes or string, use content-type + to decode it. If no content-type, try JSON. + + 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. + :raises JSONDecodeError: If JSON is requested and parsing is impossible. + :raises UnicodeDecodeError: If bytes is not UTF8 + """ + # Assume this is enough to detect a Pipeline Response without importing it + context = getattr(raw_data, "context", {}) + if context: + if RawDeserializer.CONTEXT_NAME in context: + return context[RawDeserializer.CONTEXT_NAME] + raise ValueError("This pipeline didn't have the RawDeserializer policy; can't deserialize") + + #Assume this is enough to recognize universal_http.ClientResponse without importing it + if hasattr(raw_data, "body"): + return RawDeserializer.deserialize_from_http_generics( + raw_data.text(), + raw_data.headers + ) + + # Assume this enough to recognize requests.Response without importing it. + if hasattr(raw_data, '_content_consumed'): + return RawDeserializer.deserialize_from_http_generics( + raw_data.text, + raw_data.headers + ) + + if isinstance(raw_data, (basestring, bytes)) or hasattr(raw_data, 'read'): + return RawDeserializer.deserialize_from_text(raw_data, content_type) + return raw_data + + 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. + """ + 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')] + 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 + return response_obj + except TypeError as err: + msg = "Unable to deserialize {} into model {}. ".format( + kwargs, response) + raise DeserializationError(msg + str(err)) + else: + try: + for attr, value in attrs.items(): + setattr(response, attr, value) + return response + except Exception as exp: + msg = "Unable to populate response model. " + msg += "Type: {}, Error: {}".format(type(response), exp) + raise DeserializationError(msg) + + def deserialize_data(self, data, data_type): + """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. + """ + if data is None: + return data + + try: + if not data_type: + return data + if data_type in self.basic_types.values(): + return self.deserialize_basic(data, data_type) + if data_type in self.deserialize_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"{}"] + 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) + return data_val + + iter_type = data_type[0] + data_type[-1] + if iter_type in self.deserialize_type: + return self.deserialize_type[iter_type](data, data_type[1:-1]) + + obj_type = self.dependencies[data_type] + if issubclass(obj_type, Enum): + if isinstance(data, ET.Element): + data = data.text + return self.deserialize_enum(data, obj_type) + + except (ValueError, TypeError, AttributeError) as err: + msg = "Unable to deserialize response data." + msg += " Data: {}, {}".format(data, data_type) + raise_with_traceback(DeserializationError, msg, err) + else: + 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. + :rtype: list + """ + if attr is None: + return None + if isinstance(attr, ET.Element): # If I receive an element here, get the children + attr = list(attr) + if not isinstance(attr, (list, set)): + raise DeserializationError("Cannot deserialize as [{}] an object of type {}".format( + iter_type, + type(attr) + )) + return [self.deserialize_data(a, iter_type) for a in attr] + + def deserialize_dict(self, attr, dict_type): + """Deserialize a dictionary. + + :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. + :rtype: dict + """ + if isinstance(attr, list): + return {x['key']: self.deserialize_data(x['value'], dict_type) for x in attr} + + if isinstance(attr, ET.Element): + # Transform value into {"Key": "value"} + 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): + """Deserialize a generic object. + This will be handled as a dictionary. + + :param dict attr: Dictionary to be deserialized. + :rtype: dict + :raises: TypeError if non-builtin datatype encountered. + """ + if attr is None: + return None + if isinstance(attr, ET.Element): + # Do no recurse on XML, just return the tree as-is + return attr + if isinstance(attr, basestring): + return self.deserialize_basic(attr, 'str') + obj_type = type(attr) + if obj_type in self.basic_types: + return self.deserialize_basic(attr, self.basic_types[obj_type]) + if obj_type is _long_type: + return self.deserialize_long(attr) + + if obj_type == dict: + deserialized = {} + for key, value in attr.items(): + try: + deserialized[key] = self.deserialize_object( + value, **kwargs) + except ValueError: + deserialized[key] = None + return deserialized + + if obj_type == list: + deserialized = [] + for obj in attr: + try: + deserialized.append(self.deserialize_object( + obj, **kwargs)) + except ValueError: + pass + return deserialized + + else: + error = "Cannot deserialize generic object with type: " + raise TypeError(error + str(obj_type)) + + def deserialize_basic(self, attr, data_type): + """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 + valid bool values. + + :param str attr: response string to be deserialized. + :param str data_type: deserialization data type. + :rtype: str, int, float or bool + :raises: TypeError if string format is not valid. + """ + # If we're here, data is supposed to be a basic type. + # If it's still an XML node, take the text + if isinstance(attr, ET.Element): + attr = attr.text + if not attr: + 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 + + if data_type == 'bool': + if attr in [True, False, 1, 0]: + return bool(attr) + elif isinstance(attr, basestring): + if attr.lower() in ['true', '1']: + return True + elif 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 + + @staticmethod + def deserialize_unicode(data): + """Preserve unicode objects in Python 2, otherwise return data + as a string. + + :param str data: response string to be deserialized. + :rtype: str or unicode + """ + # We might be here because we have an enum modeled as string, + # and we try to deserialize a partial dict with enum inside + if isinstance(data, Enum): + return data + + # Consider this is real string + try: + if isinstance(data, unicode): + return data + except NameError: + return str(data) + else: + return str(data) + + @staticmethod + def deserialize_enum(data, enum_obj): + """Deserialize string into enum object. + + If the string is not a valid enum value it will be returned as-is + and a warning will be logged. + + :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. + :rtype: Enum + """ + if isinstance(data, enum_obj) or data is None: + return data + if isinstance(data, Enum): + data = data.value + if isinstance(data, int): + # Workaround. We might consider remove it in the future. + # https://github.com/Azure/azure-rest-api-specs/issues/141 + try: + return list(enum_obj.__members__.values())[data] + except IndexError: + error = "{!r} is not a valid index for enum {!r}" + raise DeserializationError(error.format(data, enum_obj)) + try: + return enum_obj(str(data)) + except ValueError: + for enum_value in enum_obj: + if enum_value.value.lower() == str(data).lower(): + return enum_value + # We don't fail anymore for unknown value, we deserialize as a string + _LOGGER.warning("Deserializer is not able to find %s as valid enum in %s", data, enum_obj) + return Deserializer.deserialize_unicode(data) + + @staticmethod + def deserialize_bytearray(attr): + """Deserialize string into bytearray. + + :param str attr: response string to be deserialized. + :rtype: bytearray + :raises: TypeError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + return bytearray(b64decode(attr)) + + @staticmethod + def deserialize_base64(attr): + """Deserialize base64 encoded string into string. + + :param str attr: response string to be deserialized. + :rtype: bytearray + :raises: TypeError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + padding = '=' * (3 - (len(attr) + 3) % 4) + attr = attr + padding + encoded = attr.replace('-', '+').replace('_', '/') + return b64decode(encoded) + + @staticmethod + def deserialize_decimal(attr): + """Deserialize string into Decimal object. + + :param str attr: response string to be deserialized. + :rtype: Decimal + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + return decimal.Decimal(attr) + except decimal.DecimalException as err: + msg = "Invalid decimal {}".format(attr) + raise_with_traceback(DeserializationError, msg, err) + + @staticmethod + def deserialize_long(attr): + """Deserialize string into long (Py2) or int (Py3). + + :param str attr: response string to be deserialized. + :rtype: long or int + :raises: ValueError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + return _long_type(attr) + + @staticmethod + def deserialize_duration(attr): + """Deserialize ISO-8601 formatted string into TimeDelta object. + + :param str attr: response string to be deserialized. + :rtype: TimeDelta + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + duration = isodate.parse_duration(attr) + except(ValueError, OverflowError, AttributeError) as err: + msg = "Cannot deserialize duration object." + raise_with_traceback(DeserializationError, msg, err) + else: + return duration + + @staticmethod + def deserialize_date(attr): + """Deserialize ISO-8601 formatted string into Date object. + + :param str attr: response string to be deserialized. + :rtype: Date + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + if re.search(r"[^\W\d_]", attr, re.I + re.U): + raise DeserializationError("Date must have only digits and -. Received: %s" % attr) + # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. + return isodate.parse_date(attr, defaultmonth=None, defaultday=None) + + @staticmethod + def deserialize_time(attr): + """Deserialize ISO-8601 formatted string into time object. + + :param str attr: response string to be deserialized. + :rtype: datetime.time + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + if re.search(r"[^\W\d_]", attr, re.I + re.U): + raise DeserializationError("Date must have only digits and -. Received: %s" % attr) + return isodate.parse_time(attr) + + @staticmethod + def deserialize_rfc(attr): + """Deserialize RFC-1123 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: Datetime + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + parsed_date = email.utils.parsedate_tz(attr) + date_obj = datetime.datetime( + *parsed_date[:6], + tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0)/60)) + ) + if not date_obj.tzinfo: + date_obj = date_obj.astimezone(tz=TZ_UTC) + except ValueError as err: + msg = "Cannot deserialize to rfc datetime object." + raise_with_traceback(DeserializationError, msg, err) + else: + return date_obj + + @staticmethod + def deserialize_iso(attr): + """Deserialize ISO-8601 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: Datetime + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + attr = attr.upper() + match = Deserializer.valid_date.match(attr) + if not match: + raise ValueError("Invalid datetime string: " + attr) + + check_decimal = attr.split('.') + if len(check_decimal) > 1: + decimal_str = "" + for digit in check_decimal[1]: + if digit.isdigit(): + decimal_str += digit + else: + break + if len(decimal_str) > 6: + attr = attr.replace(decimal_str, decimal_str[0:6]) + + date_obj = isodate.parse_datetime(attr) + test_utc = date_obj.utctimetuple() + if test_utc.tm_year > 9999 or test_utc.tm_year < 1: + raise OverflowError("Hit max or min date") + except(ValueError, OverflowError, AttributeError) as err: + msg = "Cannot deserialize datetime object." + raise_with_traceback(DeserializationError, msg, err) + else: + return date_obj + + @staticmethod + def deserialize_unix(attr): + """Serialize Datetime object into IntTime format. + This is represented as seconds. + + :param int attr: Object to be serialized. + :rtype: Datetime + :raises: DeserializationError if format invalid + """ + if isinstance(attr, ET.Element): + attr = int(attr.text) + try: + date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) + except ValueError as err: + msg = "Cannot deserialize to unix datetime object." + raise_with_traceback(DeserializationError, msg, err) + else: + return date_obj \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/aio/_configuration.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/aio/_configuration.py index adab50e4ac66..1fe78e6c5efd 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/aio/_configuration.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/aio/_configuration.py @@ -26,9 +26,9 @@ class ContainerServiceClientConfiguration(Configuration): Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :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. + :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/aio/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/aio/_container_service_client.py index 379bc4b51476..fb4b41f09c68 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/aio/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/aio/_container_service_client.py @@ -11,17 +11,15 @@ from typing import Any, Optional, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.mgmt.core import AsyncARMPipelineClient from azure.profiles import KnownProfiles, ProfileDefinition from azure.profiles.multiapiclient import MultiApiClientMixin +from .._serialization import Deserializer, Serializer from ._configuration import ContainerServiceClientConfiguration if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential from azure.core.credentials_async import AsyncTokenCredential class _SDKClient(object): @@ -42,9 +40,9 @@ class ContainerServiceClient(MultiApiClientMixin, _SDKClient): The api-version parameter sets the default API version if the operation group is not described in the profile. - :param credential: Credential needed for the client to connect to Azure. + :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. + :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str :param api_version: API version to use if no profile is provided, or if missing in profile. :type api_version: str @@ -55,7 +53,7 @@ class ContainerServiceClient(MultiApiClientMixin, _SDKClient): :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ - DEFAULT_API_VERSION = '2022-06-01' + DEFAULT_API_VERSION = '2022-07-01' _PROFILE_TAG = "azure.mgmt.containerservice.ContainerServiceClient" LATEST_PROFILE = ProfileDefinition({ _PROFILE_TAG: { @@ -131,6 +129,8 @@ def models(cls, api_version=DEFAULT_API_VERSION): * 2022-05-02-preview: :mod:`v2022_05_02_preview.models` * 2022-06-01: :mod:`v2022_06_01.models` * 2022-06-02-preview: :mod:`v2022_06_02_preview.models` + * 2022-07-01: :mod:`v2022_07_01.models` + * 2022-07-02-preview: :mod:`v2022_07_02_preview.models` """ if api_version == '2017-07-01': from ..v2017_07_01 import models @@ -255,6 +255,12 @@ def models(cls, api_version=DEFAULT_API_VERSION): elif api_version == '2022-06-02-preview': from ..v2022_06_02_preview import models return models + elif api_version == '2022-07-01': + from ..v2022_07_01 import models + return models + elif api_version == '2022-07-02-preview': + from ..v2022_07_02_preview import models + return models raise ValueError("API version {} is not available".format(api_version)) @property @@ -295,6 +301,8 @@ def agent_pools(self): * 2022-05-02-preview: :class:`AgentPoolsOperations` * 2022-06-01: :class:`AgentPoolsOperations` * 2022-06-02-preview: :class:`AgentPoolsOperations` + * 2022-07-01: :class:`AgentPoolsOperations` + * 2022-07-02-preview: :class:`AgentPoolsOperations` """ api_version = self._get_api_version('agent_pools') if api_version == '2019-02-01': @@ -365,6 +373,10 @@ def agent_pools(self): from ..v2022_06_01.aio.operations import AgentPoolsOperations as OperationClass elif api_version == '2022-06-02-preview': from ..v2022_06_02_preview.aio.operations import AgentPoolsOperations as OperationClass + elif api_version == '2022-07-01': + from ..v2022_07_01.aio.operations import AgentPoolsOperations as OperationClass + elif api_version == '2022-07-02-preview': + from ..v2022_07_02_preview.aio.operations import AgentPoolsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'agent_pools'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -387,10 +399,13 @@ def fleet_members(self): """Instance depends on the API version: * 2022-06-02-preview: :class:`FleetMembersOperations` + * 2022-07-02-preview: :class:`FleetMembersOperations` """ api_version = self._get_api_version('fleet_members') if api_version == '2022-06-02-preview': from ..v2022_06_02_preview.aio.operations import FleetMembersOperations as OperationClass + elif api_version == '2022-07-02-preview': + from ..v2022_07_02_preview.aio.operations import FleetMembersOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'fleet_members'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -400,10 +415,13 @@ def fleets(self): """Instance depends on the API version: * 2022-06-02-preview: :class:`FleetsOperations` + * 2022-07-02-preview: :class:`FleetsOperations` """ api_version = self._get_api_version('fleets') if api_version == '2022-06-02-preview': from ..v2022_06_02_preview.aio.operations import FleetsOperations as OperationClass + elif api_version == '2022-07-02-preview': + from ..v2022_07_02_preview.aio.operations import FleetsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'fleets'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -432,6 +450,8 @@ def maintenance_configurations(self): * 2022-05-02-preview: :class:`MaintenanceConfigurationsOperations` * 2022-06-01: :class:`MaintenanceConfigurationsOperations` * 2022-06-02-preview: :class:`MaintenanceConfigurationsOperations` + * 2022-07-01: :class:`MaintenanceConfigurationsOperations` + * 2022-07-02-preview: :class:`MaintenanceConfigurationsOperations` """ api_version = self._get_api_version('maintenance_configurations') if api_version == '2020-12-01': @@ -474,6 +494,10 @@ def maintenance_configurations(self): from ..v2022_06_01.aio.operations import MaintenanceConfigurationsOperations as OperationClass elif api_version == '2022-06-02-preview': from ..v2022_06_02_preview.aio.operations import MaintenanceConfigurationsOperations as OperationClass + elif api_version == '2022-07-01': + from ..v2022_07_01.aio.operations import MaintenanceConfigurationsOperations as OperationClass + elif api_version == '2022-07-02-preview': + from ..v2022_07_02_preview.aio.operations import MaintenanceConfigurationsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'maintenance_configurations'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -487,6 +511,7 @@ def managed_cluster_snapshots(self): * 2022-04-02-preview: :class:`ManagedClusterSnapshotsOperations` * 2022-05-02-preview: :class:`ManagedClusterSnapshotsOperations` * 2022-06-02-preview: :class:`ManagedClusterSnapshotsOperations` + * 2022-07-02-preview: :class:`ManagedClusterSnapshotsOperations` """ api_version = self._get_api_version('managed_cluster_snapshots') if api_version == '2022-02-02-preview': @@ -499,6 +524,8 @@ def managed_cluster_snapshots(self): from ..v2022_05_02_preview.aio.operations import ManagedClusterSnapshotsOperations as OperationClass elif api_version == '2022-06-02-preview': from ..v2022_06_02_preview.aio.operations import ManagedClusterSnapshotsOperations as OperationClass + elif api_version == '2022-07-02-preview': + from ..v2022_07_02_preview.aio.operations import ManagedClusterSnapshotsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'managed_cluster_snapshots'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -543,6 +570,8 @@ def managed_clusters(self): * 2022-05-02-preview: :class:`ManagedClustersOperations` * 2022-06-01: :class:`ManagedClustersOperations` * 2022-06-02-preview: :class:`ManagedClustersOperations` + * 2022-07-01: :class:`ManagedClustersOperations` + * 2022-07-02-preview: :class:`ManagedClustersOperations` """ api_version = self._get_api_version('managed_clusters') if api_version == '2018-03-31': @@ -617,6 +646,10 @@ def managed_clusters(self): from ..v2022_06_01.aio.operations import ManagedClustersOperations as OperationClass elif api_version == '2022-06-02-preview': from ..v2022_06_02_preview.aio.operations import ManagedClustersOperations as OperationClass + elif api_version == '2022-07-01': + from ..v2022_07_01.aio.operations import ManagedClustersOperations as OperationClass + elif api_version == '2022-07-02-preview': + from ..v2022_07_02_preview.aio.operations import ManagedClustersOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'managed_clusters'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -683,6 +716,8 @@ def operations(self): * 2022-05-02-preview: :class:`Operations` * 2022-06-01: :class:`Operations` * 2022-06-02-preview: :class:`Operations` + * 2022-07-01: :class:`Operations` + * 2022-07-02-preview: :class:`Operations` """ api_version = self._get_api_version('operations') if api_version == '2018-03-31': @@ -757,6 +792,10 @@ def operations(self): from ..v2022_06_01.aio.operations import Operations as OperationClass elif api_version == '2022-06-02-preview': from ..v2022_06_02_preview.aio.operations import Operations as OperationClass + elif api_version == '2022-07-01': + from ..v2022_07_01.aio.operations import Operations as OperationClass + elif api_version == '2022-07-02-preview': + from ..v2022_07_02_preview.aio.operations import Operations as OperationClass else: raise ValueError("API version {} does not have operation group 'operations'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -789,6 +828,8 @@ def private_endpoint_connections(self): * 2022-05-02-preview: :class:`PrivateEndpointConnectionsOperations` * 2022-06-01: :class:`PrivateEndpointConnectionsOperations` * 2022-06-02-preview: :class:`PrivateEndpointConnectionsOperations` + * 2022-07-01: :class:`PrivateEndpointConnectionsOperations` + * 2022-07-02-preview: :class:`PrivateEndpointConnectionsOperations` """ api_version = self._get_api_version('private_endpoint_connections') if api_version == '2020-06-01': @@ -839,6 +880,10 @@ def private_endpoint_connections(self): from ..v2022_06_01.aio.operations import PrivateEndpointConnectionsOperations as OperationClass elif api_version == '2022-06-02-preview': from ..v2022_06_02_preview.aio.operations import PrivateEndpointConnectionsOperations as OperationClass + elif api_version == '2022-07-01': + from ..v2022_07_01.aio.operations import PrivateEndpointConnectionsOperations as OperationClass + elif api_version == '2022-07-02-preview': + from ..v2022_07_02_preview.aio.operations import PrivateEndpointConnectionsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'private_endpoint_connections'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -869,6 +914,8 @@ def private_link_resources(self): * 2022-05-02-preview: :class:`PrivateLinkResourcesOperations` * 2022-06-01: :class:`PrivateLinkResourcesOperations` * 2022-06-02-preview: :class:`PrivateLinkResourcesOperations` + * 2022-07-01: :class:`PrivateLinkResourcesOperations` + * 2022-07-02-preview: :class:`PrivateLinkResourcesOperations` """ api_version = self._get_api_version('private_link_resources') if api_version == '2020-09-01': @@ -915,6 +962,10 @@ def private_link_resources(self): from ..v2022_06_01.aio.operations import PrivateLinkResourcesOperations as OperationClass elif api_version == '2022-06-02-preview': from ..v2022_06_02_preview.aio.operations import PrivateLinkResourcesOperations as OperationClass + elif api_version == '2022-07-01': + from ..v2022_07_01.aio.operations import PrivateLinkResourcesOperations as OperationClass + elif api_version == '2022-07-02-preview': + from ..v2022_07_02_preview.aio.operations import PrivateLinkResourcesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'private_link_resources'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -945,6 +996,8 @@ def resolve_private_link_service_id(self): * 2022-05-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` * 2022-06-01: :class:`ResolvePrivateLinkServiceIdOperations` * 2022-06-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` + * 2022-07-01: :class:`ResolvePrivateLinkServiceIdOperations` + * 2022-07-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` """ api_version = self._get_api_version('resolve_private_link_service_id') if api_version == '2020-09-01': @@ -991,6 +1044,10 @@ def resolve_private_link_service_id(self): from ..v2022_06_01.aio.operations import ResolvePrivateLinkServiceIdOperations as OperationClass elif api_version == '2022-06-02-preview': from ..v2022_06_02_preview.aio.operations import ResolvePrivateLinkServiceIdOperations as OperationClass + elif api_version == '2022-07-01': + from ..v2022_07_01.aio.operations import ResolvePrivateLinkServiceIdOperations as OperationClass + elif api_version == '2022-07-02-preview': + from ..v2022_07_02_preview.aio.operations import ResolvePrivateLinkServiceIdOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'resolve_private_link_service_id'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -1014,6 +1071,8 @@ def snapshots(self): * 2022-05-02-preview: :class:`SnapshotsOperations` * 2022-06-01: :class:`SnapshotsOperations` * 2022-06-02-preview: :class:`SnapshotsOperations` + * 2022-07-01: :class:`SnapshotsOperations` + * 2022-07-02-preview: :class:`SnapshotsOperations` """ api_version = self._get_api_version('snapshots') if api_version == '2021-08-01': @@ -1046,6 +1105,10 @@ def snapshots(self): from ..v2022_06_01.aio.operations import SnapshotsOperations as OperationClass elif api_version == '2022-06-02-preview': from ..v2022_06_02_preview.aio.operations import SnapshotsOperations as OperationClass + elif api_version == '2022-07-01': + from ..v2022_07_01.aio.operations import SnapshotsOperations as OperationClass + elif api_version == '2022-07-02-preview': + from ..v2022_07_02_preview.aio.operations import SnapshotsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'snapshots'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -1057,6 +1120,7 @@ def trusted_access_role_bindings(self): * 2022-04-02-preview: :class:`TrustedAccessRoleBindingsOperations` * 2022-05-02-preview: :class:`TrustedAccessRoleBindingsOperations` * 2022-06-02-preview: :class:`TrustedAccessRoleBindingsOperations` + * 2022-07-02-preview: :class:`TrustedAccessRoleBindingsOperations` """ api_version = self._get_api_version('trusted_access_role_bindings') if api_version == '2022-04-02-preview': @@ -1065,6 +1129,8 @@ def trusted_access_role_bindings(self): from ..v2022_05_02_preview.aio.operations import TrustedAccessRoleBindingsOperations as OperationClass elif api_version == '2022-06-02-preview': from ..v2022_06_02_preview.aio.operations import TrustedAccessRoleBindingsOperations as OperationClass + elif api_version == '2022-07-02-preview': + from ..v2022_07_02_preview.aio.operations import TrustedAccessRoleBindingsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'trusted_access_role_bindings'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -1076,6 +1142,7 @@ def trusted_access_roles(self): * 2022-04-02-preview: :class:`TrustedAccessRolesOperations` * 2022-05-02-preview: :class:`TrustedAccessRolesOperations` * 2022-06-02-preview: :class:`TrustedAccessRolesOperations` + * 2022-07-02-preview: :class:`TrustedAccessRolesOperations` """ api_version = self._get_api_version('trusted_access_roles') if api_version == '2022-04-02-preview': @@ -1084,6 +1151,8 @@ def trusted_access_roles(self): from ..v2022_05_02_preview.aio.operations import TrustedAccessRolesOperations as OperationClass elif api_version == '2022-06-02-preview': from ..v2022_06_02_preview.aio.operations import TrustedAccessRolesOperations as OperationClass + elif api_version == '2022-07-02-preview': + from ..v2022_07_02_preview.aio.operations import TrustedAccessRolesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'trusted_access_roles'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/models.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/models.py index 03aa4821e7dc..31bcad8eef9c 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/models.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/models.py @@ -6,4 +6,4 @@ # -------------------------------------------------------------------------- from .v2017_07_01.models import * from .v2019_04_30.models import * -from .v2022_06_01.models import * +from .v2022_07_01.models import * diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/__init__.py index 37a5f9e02e6f..a8716d29afe8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/__init__.py @@ -14,7 +14,8 @@ except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['ContainerServiceClient'] + +__all__ = ["ContainerServiceClient"] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/_configuration.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/_configuration.py index aaf2d87e8ea9..24e995b821b3 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/_configuration.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/_configuration.py @@ -18,25 +18,21 @@ VERSION = "unknown" + class ContainerServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ContainerServiceClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str """ - def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - **kwargs: Any - ) -> None: + def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ContainerServiceClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -45,23 +41,24 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-containerservice/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-containerservice/{}".format(VERSION)) self._configure(**kwargs) def _configure( - self, - **kwargs # type: Any + self, **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/_container_service_client.py index 7946cd0a6009..6a5f850dffd7 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/_container_service_client.py @@ -9,12 +9,11 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from . import models +from .._serialization import Deserializer, Serializer from ._configuration import ContainerServiceClientConfiguration from .operations import ContainerServicesOperations @@ -22,16 +21,17 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class ContainerServiceClient: + +class ContainerServiceClient: # pylint: disable=client-accepts-api-version-keyword """The Container Service Client. :ivar container_services: ContainerServicesOperations operations :vartype container_services: azure.mgmt.containerservice.v2017_07_01.operations.ContainerServicesOperations - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -46,7 +46,9 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = ContainerServiceClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = ContainerServiceClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} @@ -57,12 +59,7 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) - - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> HttpResponse: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -71,7 +68,7 @@ def _send_request( >>> response = client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/_metadata.json b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/_metadata.json index ebb1e84b9eac..745d6e65a7e5 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/_metadata.json +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/_metadata.json @@ -10,20 +10,20 @@ "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { "credential": { - "signature": "credential, # type: \"TokenCredential\"", - "description": "Credential needed for the client to connect to Azure.", + "signature": "credential: \"TokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true }, "subscription_id": { - "signature": "subscription_id, # type: str", - "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "signature": "subscription_id: str,", + "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.", "docstring_type": "str", "required": true } @@ -31,13 +31,13 @@ "async": { "credential": { "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure.", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { "signature": "subscription_id: str,", - "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.", "docstring_type": "str", "required": true } @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=\"https://management.azure.com\", # type: str", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/_patch.py index 74e48ecd07cf..f99e77fef986 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/_patch.py @@ -28,4 +28,4 @@ # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + pass diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/_vendor.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/_vendor.py index 138f663c53a4..9aad73fc743e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/_vendor.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/_vendor.py @@ -7,6 +7,7 @@ from azure.core.pipeline.transport import HttpRequest + def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) @@ -14,6 +15,7 @@ def _convert_request(request, files=None): request.set_formdata_body(files) return request + def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -21,7 +23,5 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [ - c for c in formatted_components if "{}".format(key.args[0]) not in c - ] + components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/aio/__init__.py index 37a5f9e02e6f..a8716d29afe8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/aio/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/aio/__init__.py @@ -14,7 +14,8 @@ except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['ContainerServiceClient'] + +__all__ = ["ContainerServiceClient"] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/aio/_configuration.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/aio/_configuration.py index a8fe4a9b5ef1..509910f17c0a 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/aio/_configuration.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/aio/_configuration.py @@ -18,25 +18,21 @@ VERSION = "unknown" + class ContainerServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ContainerServiceClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str """ - def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - **kwargs: Any - ) -> None: + def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ContainerServiceClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -45,22 +41,21 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-containerservice/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-containerservice/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, - **kwargs: Any - ) -> None: - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/aio/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/aio/_container_service_client.py index 4dd58f78ab86..90158b18754f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/aio/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/aio/_container_service_client.py @@ -9,12 +9,11 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from .. import models +from ..._serialization import Deserializer, Serializer from ._configuration import ContainerServiceClientConfiguration from .operations import ContainerServicesOperations @@ -22,16 +21,17 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class ContainerServiceClient: + +class ContainerServiceClient: # pylint: disable=client-accepts-api-version-keyword """The Container Service Client. :ivar container_services: ContainerServicesOperations operations :vartype container_services: azure.mgmt.containerservice.v2017_07_01.aio.operations.ContainerServicesOperations - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -46,7 +46,9 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = ContainerServiceClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = ContainerServiceClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} @@ -57,12 +59,7 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) - - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -71,7 +68,7 @@ def _send_request( >>> response = await client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/aio/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/aio/_patch.py index 74e48ecd07cf..f99e77fef986 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/aio/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/aio/_patch.py @@ -28,4 +28,4 @@ # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + pass diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/aio/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/aio/operations/__init__.py index a96e407a7be1..5a657fde9d43 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/aio/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/aio/operations/__init__.py @@ -11,8 +11,9 @@ from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'ContainerServicesOperations', + "ContainerServicesOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/aio/operations/_container_services_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/aio/operations/_container_services_operations.py index 7d2aae2df1ac..ef94f293cb78 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/aio/operations/_container_services_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/aio/operations/_container_services_operations.py @@ -6,10 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +28,19 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._container_services_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_resource_group_request, build_list_orchestrators_request, build_list_request -T = TypeVar('T') +from ...operations._container_services_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_resource_group_request, + build_list_orchestrators_request, + build_list_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class ContainerServicesOperations: """ .. warning:: @@ -45,45 +60,36 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.ContainerServiceListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.ContainerService"]: """Gets a list of container services in the specified subscription. Gets a list of container services in the specified subscription. The operation returns properties of each container service including state, orchestrator, number of masters and agents, and FQDNs of masters and agents. - :keyword api_version: Api Version. Default value is "2017-07-01". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ContainerServiceListResult or the result of - cls(response) + :return: An iterator like instance of either ContainerService or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2017_07_01.models.ContainerServiceListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2017_07_01.models.ContainerService] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ContainerServiceListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ContainerServiceListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -91,14 +97,7 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + request = HttpRequest("GET", next_link) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -114,10 +113,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -127,41 +124,44 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/containerServices"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/containerServices"} # type: ignore async def _create_or_update_initial( self, resource_group_name: str, container_service_name: str, - parameters: _models.ContainerService, + parameters: Union[_models.ContainerService, IO], **kwargs: Any ) -> _models.ContainerService: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2017-07-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ContainerService] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ContainerService] - _json = self._serialize.body(parameters, 'ContainerService') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ContainerService") - request = build_create_or_update_request_initial( + request = build_create_or_update_request( resource_group_name=resource_group_name, container_service_name=container_service_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -169,10 +169,9 @@ async def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -180,28 +179,29 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ContainerService', pipeline_response) + deserialized = self._deserialize("ContainerService", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('ContainerService', pipeline_response) + deserialized = self._deserialize("ContainerService", pipeline_response) if response.status_code == 202: - deserialized = self._deserialize('ContainerService', pipeline_response) + deserialized = self._deserialize("ContainerService", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/containerServices/{containerServiceName}"} # type: ignore - + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/containerServices/{containerServiceName}"} # type: ignore - @distributed_trace_async + @overload async def begin_create_or_update( self, resource_group_name: str, container_service_name: str, parameters: _models.ContainerService, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.ContainerService]: """Creates or updates a container service. @@ -209,16 +209,17 @@ async def begin_create_or_update( Creates or updates a container service with the specified configuration of orchestrator, masters, and agents. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :param container_service_name: The name of the container service in the specified subscription - and resource group. + and resource group. Required. :type container_service_name: str :param parameters: Parameters supplied to the Create or Update a Container Service operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2017_07_01.models.ContainerService - :keyword api_version: Api Version. Default value is "2017-07-01". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -231,20 +232,97 @@ async def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2017_07_01.models.ContainerService] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + container_service_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ContainerService]: + """Creates or updates a container service. + + Creates or updates a container service with the specified configuration of orchestrator, + masters, and agents. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param container_service_name: The name of the container service in the specified subscription + and resource group. Required. + :type container_service_name: str + :param parameters: Parameters supplied to the Create or Update a Container Service operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ContainerService or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2017_07_01.models.ContainerService] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + container_service_name: str, + parameters: Union[_models.ContainerService, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.ContainerService]: + """Creates or updates a container service. + + Creates or updates a container service with the specified configuration of orchestrator, + masters, and agents. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param container_service_name: The name of the container service in the specified subscription + and resource group. Required. + :type container_service_name: str + :param parameters: Parameters supplied to the Create or Update a Container Service operation. + Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2017_07_01.models.ContainerService or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ContainerService or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2017_07_01.models.ContainerService] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-07-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ContainerService] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ContainerService] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -252,46 +330,39 @@ async def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ContainerService', pipeline_response) + deserialized = self._deserialize("ContainerService", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/containerServices/{containerServiceName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/containerServices/{containerServiceName}"} # type: ignore @distributed_trace_async async def get( - self, - resource_group_name: str, - container_service_name: str, - **kwargs: Any + self, resource_group_name: str, container_service_name: str, **kwargs: Any ) -> _models.ContainerService: """Gets the properties of the specified container service. @@ -299,37 +370,31 @@ async def get( resource group. The operation returns the properties including state, orchestrator, number of masters and agents, and FQDNs of masters and agents. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :param container_service_name: The name of the container service in the specified subscription - and resource group. + and resource group. Required. :type container_service_name: str - :keyword api_version: Api Version. Default value is "2017-07-01". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ContainerService, or the result of cls(response) + :return: ContainerService or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2017_07_01.models.ContainerService - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ContainerService] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ContainerService] - request = build_get_request( resource_group_name=resource_group_name, container_service_name=container_service_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -337,50 +402,42 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ContainerService', pipeline_response) + deserialized = self._deserialize("ContainerService", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/containerServices/{containerServiceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/containerServices/{containerServiceName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - container_service_name: str, - **kwargs: Any + self, resource_group_name: str, container_service_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( + request = build_delete_request( resource_group_name=resource_group_name, container_service_name=container_service_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -388,10 +445,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -401,15 +457,11 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/containerServices/{containerServiceName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/containerServices/{containerServiceName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - container_service_name: str, - **kwargs: Any + async def begin_delete( + self, resource_group_name: str, container_service_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes the specified container service. @@ -418,14 +470,11 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements including storage accounts, VMs, and availability sets. All the other resources created with the container service are part of the same resource group and can be deleted individually. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :param container_service_name: The name of the container service in the specified subscription - and resource group. + and resource group. Required. :type container_service_name: str - :keyword api_version: Api Version. Default value is "2017-07-01". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -436,98 +485,84 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, container_service_name=container_service_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/containerServices/{containerServiceName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/containerServices/{containerServiceName}"} # type: ignore @distributed_trace def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.ContainerServiceListResult]: + self, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ContainerService"]: """Gets a list of container services in the specified resource group. Gets a list of container services in the specified subscription and resource group. The operation returns properties of each container service including state, orchestrator, number of masters and agents, and FQDNs of masters and agents. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :keyword api_version: Api Version. Default value is "2017-07-01". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ContainerServiceListResult or the result of - cls(response) + :return: An iterator like instance of either ContainerService or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2017_07_01.models.ContainerServiceListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2017_07_01.models.ContainerService] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ContainerServiceListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ContainerServiceListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -535,15 +570,7 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + request = HttpRequest("GET", next_link) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -559,10 +586,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -572,18 +597,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/containerServices"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/containerServices"} # type: ignore @distributed_trace_async async def list_orchestrators( - self, - location: str, - resource_type: Optional[str] = None, - **kwargs: Any + self, location: str, resource_type: Optional[str] = None, **kwargs: Any ) -> _models.OrchestratorVersionProfileListResult: """Gets a list of supported orchestrators in the specified subscription. @@ -591,37 +611,31 @@ async def list_orchestrators( properties of each orchestrator including version, available upgrades and whether that version or upgrades are in preview. - :param location: The name of a supported Azure region. + :param location: The name of a supported Azure region. Required. :type location: str :param resource_type: resource type for which the list of orchestrators needs to be returned. Default value is None. :type resource_type: str - :keyword api_version: Api Version. Default value is "2019-04-01". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: OrchestratorVersionProfileListResult, or the result of cls(response) + :return: OrchestratorVersionProfileListResult or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2017_07_01.models.OrchestratorVersionProfileListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OrchestratorVersionProfileListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OrchestratorVersionProfileListResult] - request = build_list_orchestrators_request( - subscription_id=self._config.subscription_id, location=location, - api_version=api_version, + subscription_id=self._config.subscription_id, resource_type=resource_type, - template_url=self.list_orchestrators.metadata['url'], + api_version=api_version, + template_url=self.list_orchestrators.metadata["url"], headers=_headers, params=_params, ) @@ -629,22 +643,20 @@ async def list_orchestrators( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('OrchestratorVersionProfileListResult', pipeline_response) + deserialized = self._deserialize("OrchestratorVersionProfileListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_orchestrators.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/orchestrators"} # type: ignore - + list_orchestrators.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/orchestrators"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/aio/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/aio/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/aio/operations/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/aio/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/models/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/models/__init__.py index 22ff2933917b..cd3660dbeef6 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/models/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/models/__init__.py @@ -25,41 +25,39 @@ from ._models_py3 import OrchestratorVersionProfileListResult from ._models_py3 import Resource - -from ._container_service_client_enums import ( - ContainerServiceOrchestratorTypes, - ContainerServiceStorageProfileTypes, - ContainerServiceVMSizeTypes, - Count, - OSType, -) +from ._container_service_client_enums import ContainerServiceOrchestratorTypes +from ._container_service_client_enums import ContainerServiceStorageProfileTypes +from ._container_service_client_enums import ContainerServiceVMSizeTypes +from ._container_service_client_enums import Count +from ._container_service_client_enums import OSType from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'ContainerService', - 'ContainerServiceAgentPoolProfile', - 'ContainerServiceCustomProfile', - 'ContainerServiceDiagnosticsProfile', - 'ContainerServiceLinuxProfile', - 'ContainerServiceListResult', - 'ContainerServiceMasterProfile', - 'ContainerServiceOrchestratorProfile', - 'ContainerServicePrincipalProfile', - 'ContainerServiceSshConfiguration', - 'ContainerServiceSshPublicKey', - 'ContainerServiceVMDiagnostics', - 'ContainerServiceWindowsProfile', - 'KeyVaultSecretRef', - 'OrchestratorProfile', - 'OrchestratorVersionProfile', - 'OrchestratorVersionProfileListResult', - 'Resource', - 'ContainerServiceOrchestratorTypes', - 'ContainerServiceStorageProfileTypes', - 'ContainerServiceVMSizeTypes', - 'Count', - 'OSType', + "ContainerService", + "ContainerServiceAgentPoolProfile", + "ContainerServiceCustomProfile", + "ContainerServiceDiagnosticsProfile", + "ContainerServiceLinuxProfile", + "ContainerServiceListResult", + "ContainerServiceMasterProfile", + "ContainerServiceOrchestratorProfile", + "ContainerServicePrincipalProfile", + "ContainerServiceSshConfiguration", + "ContainerServiceSshPublicKey", + "ContainerServiceVMDiagnostics", + "ContainerServiceWindowsProfile", + "KeyVaultSecretRef", + "OrchestratorProfile", + "OrchestratorVersionProfile", + "OrchestratorVersionProfileListResult", + "Resource", + "ContainerServiceOrchestratorTypes", + "ContainerServiceStorageProfileTypes", + "ContainerServiceVMSizeTypes", + "Count", + "OSType", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/models/_container_service_client_enums.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/models/_container_service_client_enums.py index 0dc545173c26..e0a03b58e733 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/models/_container_service_client_enums.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/models/_container_service_client_enums.py @@ -21,6 +21,7 @@ class ContainerServiceOrchestratorTypes(str, Enum, metaclass=CaseInsensitiveEnum DOCKER_CE = "DockerCE" CUSTOM = "Custom" + class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the orchestrator choice. @@ -29,9 +30,9 @@ class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEn STORAGE_ACCOUNT = "StorageAccount" MANAGED_DISKS = "ManagedDisks" + class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Size of agent VMs. - """ + """Size of agent VMs.""" STANDARD_A1 = "Standard_A1" STANDARD_A10 = "Standard_A10" @@ -208,6 +209,7 @@ class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): STANDARD_NV24 = "Standard_NV24" STANDARD_NV6 = "Standard_NV6" + class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): """Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, and 5. The default value is 1. @@ -217,9 +219,9 @@ class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): THREE = 3 FIVE = 5 + class OSType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """OsType to be used to specify os type. Choose from Linux and Windows. Default to Linux. - """ + """OsType to be used to specify os type. Choose from Linux and Windows. Default to Linux.""" LINUX = "Linux" WINDOWS = "Windows" diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/models/_models_py3.py index 657fa541206d..3ced7dc7be89 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/models/_models_py3.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/models/_models_py3.py @@ -1,4 +1,5 @@ # coding=utf-8 +# pylint: disable=too-many-lines # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -8,14 +9,14 @@ from typing import Dict, List, Optional, TYPE_CHECKING, Union -import msrest.serialization +from ... import _serialization if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - import __init__ as _models + from .. import models as _models -class Resource(msrest.serialization.Model): +class Resource(_serialization.Model): """The Resource model definition. Variables are only populated by the server, and will be ignored when sending a request. @@ -28,41 +29,35 @@ class Resource(msrest.serialization.Model): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] """ - super(Resource, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -70,7 +65,7 @@ def __init__( self.tags = tags -class ContainerService(Resource): +class ContainerService(Resource): # pylint: disable=too-many-instance-attributes """Container service. Variables are only populated by the server, and will be ignored when sending a request. @@ -83,9 +78,9 @@ class ContainerService(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar provisioning_state: The current deployment or provisioning state, which only appears in the response. @@ -119,28 +114,34 @@ class ContainerService(Resource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'provisioning_state': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'orchestrator_profile': {'key': 'properties.orchestratorProfile', 'type': 'ContainerServiceOrchestratorProfile'}, - 'custom_profile': {'key': 'properties.customProfile', 'type': 'ContainerServiceCustomProfile'}, - 'service_principal_profile': {'key': 'properties.servicePrincipalProfile', 'type': 'ContainerServicePrincipalProfile'}, - 'master_profile': {'key': 'properties.masterProfile', 'type': 'ContainerServiceMasterProfile'}, - 'agent_pool_profiles': {'key': 'properties.agentPoolProfiles', 'type': '[ContainerServiceAgentPoolProfile]'}, - 'windows_profile': {'key': 'properties.windowsProfile', 'type': 'ContainerServiceWindowsProfile'}, - 'linux_profile': {'key': 'properties.linuxProfile', 'type': 'ContainerServiceLinuxProfile'}, - 'diagnostics_profile': {'key': 'properties.diagnosticsProfile', 'type': 'ContainerServiceDiagnosticsProfile'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "orchestrator_profile": { + "key": "properties.orchestratorProfile", + "type": "ContainerServiceOrchestratorProfile", + }, + "custom_profile": {"key": "properties.customProfile", "type": "ContainerServiceCustomProfile"}, + "service_principal_profile": { + "key": "properties.servicePrincipalProfile", + "type": "ContainerServicePrincipalProfile", + }, + "master_profile": {"key": "properties.masterProfile", "type": "ContainerServiceMasterProfile"}, + "agent_pool_profiles": {"key": "properties.agentPoolProfiles", "type": "[ContainerServiceAgentPoolProfile]"}, + "windows_profile": {"key": "properties.windowsProfile", "type": "ContainerServiceWindowsProfile"}, + "linux_profile": {"key": "properties.linuxProfile", "type": "ContainerServiceLinuxProfile"}, + "diagnostics_profile": {"key": "properties.diagnosticsProfile", "type": "ContainerServiceDiagnosticsProfile"}, } def __init__( @@ -159,9 +160,9 @@ def __init__( **kwargs ): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword orchestrator_profile: Profile for the container service orchestrator. :paramtype orchestrator_profile: @@ -190,7 +191,7 @@ def __init__( :paramtype diagnostics_profile: ~azure.mgmt.containerservice.v2017_07_01.models.ContainerServiceDiagnosticsProfile """ - super(ContainerService, self).__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.provisioning_state = None self.orchestrator_profile = orchestrator_profile self.custom_profile = custom_profile @@ -202,20 +203,20 @@ def __init__( self.diagnostics_profile = diagnostics_profile -class ContainerServiceAgentPoolProfile(msrest.serialization.Model): +class ContainerServiceAgentPoolProfile(_serialization.Model): """Profile for the container service agent pool. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar name: Required. Unique name of the agent pool profile in the context of the subscription - and resource group. + :ivar name: Unique name of the agent pool profile in the context of the subscription and + resource group. Required. :vartype name: str :ivar count: Number of agents (VMs) to host docker containers. Allowed values must be in the range of 1 to 100 (inclusive). The default value is 1. :vartype count: int - :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + :ivar vm_size: Size of agent VMs. Required. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -252,7 +253,7 @@ class ContainerServiceAgentPoolProfile(msrest.serialization.Model): "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :vartype vm_size: str or ~azure.mgmt.containerservice.v2017_07_01.models.ContainerServiceVMSizeTypes :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine @@ -268,35 +269,35 @@ class ContainerServiceAgentPoolProfile(msrest.serialization.Model): :vartype ports: list[int] :ivar storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount" and "ManagedDisks". :vartype storage_profile: str or ~azure.mgmt.containerservice.v2017_07_01.models.ContainerServiceStorageProfileTypes :ivar vnet_subnet_id: VNet SubnetID specifies the VNet's subnet identifier. :vartype vnet_subnet_id: str :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Known values are: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux" and "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2017_07_01.models.OSType """ _validation = { - 'name': {'required': True}, - 'count': {'maximum': 100, 'minimum': 1}, - 'vm_size': {'required': True}, - 'os_disk_size_gb': {'maximum': 1023, 'minimum': 0}, - 'fqdn': {'readonly': True}, + "name": {"required": True}, + "count": {"maximum": 100, "minimum": 1}, + "vm_size": {"required": True}, + "os_disk_size_gb": {"maximum": 1023, "minimum": 0}, + "fqdn": {"readonly": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'count': {'key': 'count', 'type': 'int'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'dns_prefix': {'key': 'dnsPrefix', 'type': 'str'}, - 'fqdn': {'key': 'fqdn', 'type': 'str'}, - 'ports': {'key': 'ports', 'type': '[int]'}, - 'storage_profile': {'key': 'storageProfile', 'type': 'str'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'os_type': {'key': 'osType', 'type': 'str'}, + "name": {"key": "name", "type": "str"}, + "count": {"key": "count", "type": "int"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "dns_prefix": {"key": "dnsPrefix", "type": "str"}, + "fqdn": {"key": "fqdn", "type": "str"}, + "ports": {"key": "ports", "type": "[int]"}, + "storage_profile": {"key": "storageProfile", "type": "str"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "os_type": {"key": "osType", "type": "str"}, } def __init__( @@ -304,23 +305,23 @@ def __init__( *, name: str, vm_size: Union[str, "_models.ContainerServiceVMSizeTypes"], - count: Optional[int] = 1, + count: int = 1, os_disk_size_gb: Optional[int] = None, dns_prefix: Optional[str] = None, ports: Optional[List[int]] = None, storage_profile: Optional[Union[str, "_models.ContainerServiceStorageProfileTypes"]] = None, vnet_subnet_id: Optional[str] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", **kwargs ): """ - :keyword name: Required. Unique name of the agent pool profile in the context of the - subscription and resource group. + :keyword name: Unique name of the agent pool profile in the context of the subscription and + resource group. Required. :paramtype name: str :keyword count: Number of agents (VMs) to host docker containers. Allowed values must be in the range of 1 to 100 (inclusive). The default value is 1. :paramtype count: int - :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + :keyword vm_size: Size of agent VMs. Required. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -357,7 +358,7 @@ def __init__( "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :paramtype vm_size: str or ~azure.mgmt.containerservice.v2017_07_01.models.ContainerServiceVMSizeTypes :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every @@ -371,16 +372,16 @@ def __init__( :paramtype ports: list[int] :keyword storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount" and "ManagedDisks". :paramtype storage_profile: str or ~azure.mgmt.containerservice.v2017_07_01.models.ContainerServiceStorageProfileTypes :keyword vnet_subnet_id: VNet SubnetID specifies the VNet's subnet identifier. :paramtype vnet_subnet_id: str :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux" and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2017_07_01.models.OSType """ - super(ContainerServiceAgentPoolProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.count = count self.vm_size = vm_size @@ -393,111 +394,95 @@ def __init__( self.os_type = os_type -class ContainerServiceCustomProfile(msrest.serialization.Model): +class ContainerServiceCustomProfile(_serialization.Model): """Properties to configure a custom container service cluster. All required parameters must be populated in order to send to Azure. - :ivar orchestrator: Required. The name of the custom orchestrator to use. + :ivar orchestrator: The name of the custom orchestrator to use. Required. :vartype orchestrator: str """ _validation = { - 'orchestrator': {'required': True}, + "orchestrator": {"required": True}, } _attribute_map = { - 'orchestrator': {'key': 'orchestrator', 'type': 'str'}, + "orchestrator": {"key": "orchestrator", "type": "str"}, } - def __init__( - self, - *, - orchestrator: str, - **kwargs - ): + def __init__(self, *, orchestrator: str, **kwargs): """ - :keyword orchestrator: Required. The name of the custom orchestrator to use. + :keyword orchestrator: The name of the custom orchestrator to use. Required. :paramtype orchestrator: str """ - super(ContainerServiceCustomProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.orchestrator = orchestrator -class ContainerServiceDiagnosticsProfile(msrest.serialization.Model): +class ContainerServiceDiagnosticsProfile(_serialization.Model): """Profile for diagnostics on the container service cluster. All required parameters must be populated in order to send to Azure. - :ivar vm_diagnostics: Required. Profile for diagnostics on the container service VMs. + :ivar vm_diagnostics: Profile for diagnostics on the container service VMs. Required. :vartype vm_diagnostics: ~azure.mgmt.containerservice.v2017_07_01.models.ContainerServiceVMDiagnostics """ _validation = { - 'vm_diagnostics': {'required': True}, + "vm_diagnostics": {"required": True}, } _attribute_map = { - 'vm_diagnostics': {'key': 'vmDiagnostics', 'type': 'ContainerServiceVMDiagnostics'}, + "vm_diagnostics": {"key": "vmDiagnostics", "type": "ContainerServiceVMDiagnostics"}, } - def __init__( - self, - *, - vm_diagnostics: "_models.ContainerServiceVMDiagnostics", - **kwargs - ): + def __init__(self, *, vm_diagnostics: "_models.ContainerServiceVMDiagnostics", **kwargs): """ - :keyword vm_diagnostics: Required. Profile for diagnostics on the container service VMs. + :keyword vm_diagnostics: Profile for diagnostics on the container service VMs. Required. :paramtype vm_diagnostics: ~azure.mgmt.containerservice.v2017_07_01.models.ContainerServiceVMDiagnostics """ - super(ContainerServiceDiagnosticsProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.vm_diagnostics = vm_diagnostics -class ContainerServiceLinuxProfile(msrest.serialization.Model): +class ContainerServiceLinuxProfile(_serialization.Model): """Profile for Linux VMs in the container service cluster. All required parameters must be populated in order to send to Azure. - :ivar admin_username: Required. The administrator username to use for Linux VMs. + :ivar admin_username: The administrator username to use for Linux VMs. Required. :vartype admin_username: str - :ivar ssh: Required. SSH configuration for Linux-based VMs running on Azure. + :ivar ssh: SSH configuration for Linux-based VMs running on Azure. Required. :vartype ssh: ~azure.mgmt.containerservice.v2017_07_01.models.ContainerServiceSshConfiguration """ _validation = { - 'admin_username': {'required': True, 'pattern': r'^[A-Za-z][-A-Za-z0-9_]*$'}, - 'ssh': {'required': True}, + "admin_username": {"required": True, "pattern": r"^[A-Za-z][-A-Za-z0-9_]*$"}, + "ssh": {"required": True}, } _attribute_map = { - 'admin_username': {'key': 'adminUsername', 'type': 'str'}, - 'ssh': {'key': 'ssh', 'type': 'ContainerServiceSshConfiguration'}, + "admin_username": {"key": "adminUsername", "type": "str"}, + "ssh": {"key": "ssh", "type": "ContainerServiceSshConfiguration"}, } - def __init__( - self, - *, - admin_username: str, - ssh: "_models.ContainerServiceSshConfiguration", - **kwargs - ): + def __init__(self, *, admin_username: str, ssh: "_models.ContainerServiceSshConfiguration", **kwargs): """ - :keyword admin_username: Required. The administrator username to use for Linux VMs. + :keyword admin_username: The administrator username to use for Linux VMs. Required. :paramtype admin_username: str - :keyword ssh: Required. SSH configuration for Linux-based VMs running on Azure. + :keyword ssh: SSH configuration for Linux-based VMs running on Azure. Required. :paramtype ssh: ~azure.mgmt.containerservice.v2017_07_01.models.ContainerServiceSshConfiguration """ - super(ContainerServiceLinuxProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.admin_username = admin_username self.ssh = ssh -class ContainerServiceListResult(msrest.serialization.Model): +class ContainerServiceListResult(_serialization.Model): """The response from the List Container Services operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -509,30 +494,25 @@ class ContainerServiceListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[ContainerService]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[ContainerService]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.ContainerService"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.ContainerService"]] = None, **kwargs): """ :keyword value: The list of container services. :paramtype value: list[~azure.mgmt.containerservice.v2017_07_01.models.ContainerService] """ - super(ContainerServiceListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class ContainerServiceMasterProfile(msrest.serialization.Model): +class ContainerServiceMasterProfile(_serialization.Model): """Profile for the container service master. Variables are only populated by the server, and will be ignored when sending a request. @@ -540,11 +520,11 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar count: Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, - and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". + and 5. The default value is 1. Known values are: 1, 3, and 5. :vartype count: int or ~azure.mgmt.containerservice.v2017_07_01.models.Count - :ivar dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. + :ivar dns_prefix: DNS prefix to be used to create the FQDN for the master pool. Required. :vartype dns_prefix: str - :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + :ivar vm_size: Size of agent VMs. Required. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -581,7 +561,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :vartype vm_size: str or ~azure.mgmt.containerservice.v2017_07_01.models.ContainerServiceVMSizeTypes :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine @@ -595,7 +575,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): :vartype first_consecutive_static_ip: str :ivar storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount" and "ManagedDisks". :vartype storage_profile: str or ~azure.mgmt.containerservice.v2017_07_01.models.ContainerServiceStorageProfileTypes :ivar fqdn: FQDN for the master pool. @@ -603,21 +583,21 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): """ _validation = { - 'dns_prefix': {'required': True}, - 'vm_size': {'required': True}, - 'os_disk_size_gb': {'maximum': 1023, 'minimum': 0}, - 'fqdn': {'readonly': True}, + "dns_prefix": {"required": True}, + "vm_size": {"required": True}, + "os_disk_size_gb": {"maximum": 1023, "minimum": 0}, + "fqdn": {"readonly": True}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'dns_prefix': {'key': 'dnsPrefix', 'type': 'str'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'first_consecutive_static_ip': {'key': 'firstConsecutiveStaticIP', 'type': 'str'}, - 'storage_profile': {'key': 'storageProfile', 'type': 'str'}, - 'fqdn': {'key': 'fqdn', 'type': 'str'}, + "count": {"key": "count", "type": "int"}, + "dns_prefix": {"key": "dnsPrefix", "type": "str"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "first_consecutive_static_ip": {"key": "firstConsecutiveStaticIP", "type": "str"}, + "storage_profile": {"key": "storageProfile", "type": "str"}, + "fqdn": {"key": "fqdn", "type": "str"}, } def __init__( @@ -625,20 +605,20 @@ def __init__( *, dns_prefix: str, vm_size: Union[str, "_models.ContainerServiceVMSizeTypes"], - count: Optional[Union[int, "_models.Count"]] = 1, + count: Union[int, "_models.Count"] = 1, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, - first_consecutive_static_ip: Optional[str] = "10.240.255.5", + first_consecutive_static_ip: str = "10.240.255.5", storage_profile: Optional[Union[str, "_models.ContainerServiceStorageProfileTypes"]] = None, **kwargs ): """ :keyword count: Number of masters (VMs) in the container service cluster. Allowed values are 1, - 3, and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". + 3, and 5. The default value is 1. Known values are: 1, 3, and 5. :paramtype count: int or ~azure.mgmt.containerservice.v2017_07_01.models.Count - :keyword dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. + :keyword dns_prefix: DNS prefix to be used to create the FQDN for the master pool. Required. :paramtype dns_prefix: str - :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + :keyword vm_size: Size of agent VMs. Required. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -675,7 +655,7 @@ def __init__( "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :paramtype vm_size: str or ~azure.mgmt.containerservice.v2017_07_01.models.ContainerServiceVMSizeTypes :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every @@ -689,11 +669,11 @@ def __init__( :paramtype first_consecutive_static_ip: str :keyword storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount" and "ManagedDisks". :paramtype storage_profile: str or ~azure.mgmt.containerservice.v2017_07_01.models.ContainerServiceStorageProfileTypes """ - super(ContainerServiceMasterProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.dns_prefix = dns_prefix self.vm_size = vm_size @@ -704,14 +684,14 @@ def __init__( self.fqdn = None -class ContainerServiceOrchestratorProfile(msrest.serialization.Model): +class ContainerServiceOrchestratorProfile(_serialization.Model): """Profile for the container service orchestrator. All required parameters must be populated in order to send to Azure. - :ivar orchestrator_type: Required. The orchestrator to use to manage container service cluster - resources. Valid values are Kubernetes, Swarm, DCOS, DockerCE and Custom. Known values are: - "Kubernetes", "Swarm", "DCOS", "DockerCE", "Custom". + :ivar orchestrator_type: The orchestrator to use to manage container service cluster resources. + Valid values are Kubernetes, Swarm, DCOS, DockerCE and Custom. Required. Known values are: + "Kubernetes", "Swarm", "DCOS", "DockerCE", and "Custom". :vartype orchestrator_type: str or ~azure.mgmt.containerservice.v2017_07_01.models.ContainerServiceOrchestratorTypes :ivar orchestrator_version: The version of the orchestrator to use. You can specify the @@ -720,12 +700,12 @@ class ContainerServiceOrchestratorProfile(msrest.serialization.Model): """ _validation = { - 'orchestrator_type': {'required': True}, + "orchestrator_type": {"required": True}, } _attribute_map = { - 'orchestrator_type': {'key': 'orchestratorType', 'type': 'str'}, - 'orchestrator_version': {'key': 'orchestratorVersion', 'type': 'str'}, + "orchestrator_type": {"key": "orchestratorType", "type": "str"}, + "orchestrator_version": {"key": "orchestratorVersion", "type": "str"}, } def __init__( @@ -736,26 +716,26 @@ def __init__( **kwargs ): """ - :keyword orchestrator_type: Required. The orchestrator to use to manage container service - cluster resources. Valid values are Kubernetes, Swarm, DCOS, DockerCE and Custom. Known values - are: "Kubernetes", "Swarm", "DCOS", "DockerCE", "Custom". + :keyword orchestrator_type: The orchestrator to use to manage container service cluster + resources. Valid values are Kubernetes, Swarm, DCOS, DockerCE and Custom. Required. Known + values are: "Kubernetes", "Swarm", "DCOS", "DockerCE", and "Custom". :paramtype orchestrator_type: str or ~azure.mgmt.containerservice.v2017_07_01.models.ContainerServiceOrchestratorTypes :keyword orchestrator_version: The version of the orchestrator to use. You can specify the major.minor.patch part of the actual version.For example, you can specify version as "1.6.11". :paramtype orchestrator_version: str """ - super(ContainerServiceOrchestratorProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.orchestrator_type = orchestrator_type self.orchestrator_version = orchestrator_version -class ContainerServicePrincipalProfile(msrest.serialization.Model): +class ContainerServicePrincipalProfile(_serialization.Model): """Information about a service principal identity for the cluster to use for manipulating Azure APIs. Either secret or keyVaultSecretRef must be specified. All required parameters must be populated in order to send to Azure. - :ivar client_id: Required. The ID for the service principal. + :ivar client_id: The ID for the service principal. Required. :vartype client_id: str :ivar secret: The secret password associated with the service principal in plain text. :vartype secret: str @@ -765,13 +745,13 @@ class ContainerServicePrincipalProfile(msrest.serialization.Model): """ _validation = { - 'client_id': {'required': True}, + "client_id": {"required": True}, } _attribute_map = { - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'secret': {'key': 'secret', 'type': 'str'}, - 'key_vault_secret_ref': {'key': 'keyVaultSecretRef', 'type': 'KeyVaultSecretRef'}, + "client_id": {"key": "clientId", "type": "str"}, + "secret": {"key": "secret", "type": "str"}, + "key_vault_secret_ref": {"key": "keyVaultSecretRef", "type": "KeyVaultSecretRef"}, } def __init__( @@ -783,7 +763,7 @@ def __init__( **kwargs ): """ - :keyword client_id: Required. The ID for the service principal. + :keyword client_id: The ID for the service principal. Required. :paramtype client_id: str :keyword secret: The secret password associated with the service principal in plain text. :paramtype secret: str @@ -791,224 +771,199 @@ def __init__( :paramtype key_vault_secret_ref: ~azure.mgmt.containerservice.v2017_07_01.models.KeyVaultSecretRef """ - super(ContainerServicePrincipalProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.client_id = client_id self.secret = secret self.key_vault_secret_ref = key_vault_secret_ref -class ContainerServiceSshConfiguration(msrest.serialization.Model): +class ContainerServiceSshConfiguration(_serialization.Model): """SSH configuration for Linux-based VMs running on Azure. All required parameters must be populated in order to send to Azure. - :ivar public_keys: Required. The list of SSH public keys used to authenticate with Linux-based - VMs. Only expect one key specified. + :ivar public_keys: The list of SSH public keys used to authenticate with Linux-based VMs. Only + expect one key specified. Required. :vartype public_keys: list[~azure.mgmt.containerservice.v2017_07_01.models.ContainerServiceSshPublicKey] """ _validation = { - 'public_keys': {'required': True}, + "public_keys": {"required": True}, } _attribute_map = { - 'public_keys': {'key': 'publicKeys', 'type': '[ContainerServiceSshPublicKey]'}, + "public_keys": {"key": "publicKeys", "type": "[ContainerServiceSshPublicKey]"}, } - def __init__( - self, - *, - public_keys: List["_models.ContainerServiceSshPublicKey"], - **kwargs - ): + def __init__(self, *, public_keys: List["_models.ContainerServiceSshPublicKey"], **kwargs): """ - :keyword public_keys: Required. The list of SSH public keys used to authenticate with - Linux-based VMs. Only expect one key specified. + :keyword public_keys: The list of SSH public keys used to authenticate with Linux-based VMs. + Only expect one key specified. Required. :paramtype public_keys: list[~azure.mgmt.containerservice.v2017_07_01.models.ContainerServiceSshPublicKey] """ - super(ContainerServiceSshConfiguration, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_keys = public_keys -class ContainerServiceSshPublicKey(msrest.serialization.Model): +class ContainerServiceSshPublicKey(_serialization.Model): """Contains information about SSH certificate public key data. All required parameters must be populated in order to send to Azure. - :ivar key_data: Required. Certificate public key used to authenticate with VMs through SSH. The - certificate must be in PEM format with or without headers. + :ivar key_data: Certificate public key used to authenticate with VMs through SSH. The + certificate must be in PEM format with or without headers. Required. :vartype key_data: str """ _validation = { - 'key_data': {'required': True}, + "key_data": {"required": True}, } _attribute_map = { - 'key_data': {'key': 'keyData', 'type': 'str'}, + "key_data": {"key": "keyData", "type": "str"}, } - def __init__( - self, - *, - key_data: str, - **kwargs - ): + def __init__(self, *, key_data: str, **kwargs): """ - :keyword key_data: Required. Certificate public key used to authenticate with VMs through SSH. - The certificate must be in PEM format with or without headers. + :keyword key_data: Certificate public key used to authenticate with VMs through SSH. The + certificate must be in PEM format with or without headers. Required. :paramtype key_data: str """ - super(ContainerServiceSshPublicKey, self).__init__(**kwargs) + super().__init__(**kwargs) self.key_data = key_data -class ContainerServiceVMDiagnostics(msrest.serialization.Model): +class ContainerServiceVMDiagnostics(_serialization.Model): """Profile for diagnostics on the container service VMs. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar enabled: Required. Whether the VM diagnostic agent is provisioned on the VM. + :ivar enabled: Whether the VM diagnostic agent is provisioned on the VM. Required. :vartype enabled: bool :ivar storage_uri: The URI of the storage account where diagnostics are stored. :vartype storage_uri: str """ _validation = { - 'enabled': {'required': True}, - 'storage_uri': {'readonly': True}, + "enabled": {"required": True}, + "storage_uri": {"readonly": True}, } _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'storage_uri': {'key': 'storageUri', 'type': 'str'}, + "enabled": {"key": "enabled", "type": "bool"}, + "storage_uri": {"key": "storageUri", "type": "str"}, } - def __init__( - self, - *, - enabled: bool, - **kwargs - ): + def __init__(self, *, enabled: bool, **kwargs): """ - :keyword enabled: Required. Whether the VM diagnostic agent is provisioned on the VM. + :keyword enabled: Whether the VM diagnostic agent is provisioned on the VM. Required. :paramtype enabled: bool """ - super(ContainerServiceVMDiagnostics, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.storage_uri = None -class ContainerServiceWindowsProfile(msrest.serialization.Model): +class ContainerServiceWindowsProfile(_serialization.Model): """Profile for Windows VMs in the container service cluster. All required parameters must be populated in order to send to Azure. - :ivar admin_username: Required. The administrator username to use for Windows VMs. + :ivar admin_username: The administrator username to use for Windows VMs. Required. :vartype admin_username: str - :ivar admin_password: Required. The administrator password to use for Windows VMs. + :ivar admin_password: The administrator password to use for Windows VMs. Required. :vartype admin_password: str """ _validation = { - 'admin_username': {'required': True, 'pattern': r'^[a-zA-Z0-9]+([._]?[a-zA-Z0-9]+)*$'}, - 'admin_password': {'required': True, 'pattern': r'^(?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$%\^&\*\(\)])[a-zA-Z\d!@#$%\^&\*\(\)]{12,123}$'}, + "admin_username": {"required": True, "pattern": r"^[a-zA-Z0-9]+([._]?[a-zA-Z0-9]+)*$"}, + "admin_password": { + "required": True, + "pattern": r"^(?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$%\^&\*\(\)])[a-zA-Z\d!@#$%\^&\*\(\)]{12,123}$", + }, } _attribute_map = { - 'admin_username': {'key': 'adminUsername', 'type': 'str'}, - 'admin_password': {'key': 'adminPassword', 'type': 'str'}, + "admin_username": {"key": "adminUsername", "type": "str"}, + "admin_password": {"key": "adminPassword", "type": "str"}, } - def __init__( - self, - *, - admin_username: str, - admin_password: str, - **kwargs - ): + def __init__(self, *, admin_username: str, admin_password: str, **kwargs): """ - :keyword admin_username: Required. The administrator username to use for Windows VMs. + :keyword admin_username: The administrator username to use for Windows VMs. Required. :paramtype admin_username: str - :keyword admin_password: Required. The administrator password to use for Windows VMs. + :keyword admin_password: The administrator password to use for Windows VMs. Required. :paramtype admin_password: str """ - super(ContainerServiceWindowsProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.admin_username = admin_username self.admin_password = admin_password -class KeyVaultSecretRef(msrest.serialization.Model): +class KeyVaultSecretRef(_serialization.Model): """Reference to a secret stored in Azure Key Vault. All required parameters must be populated in order to send to Azure. - :ivar vault_id: Required. Key vault identifier. + :ivar vault_id: Key vault identifier. Required. :vartype vault_id: str - :ivar secret_name: Required. The secret name. + :ivar secret_name: The secret name. Required. :vartype secret_name: str :ivar version: The secret version. :vartype version: str """ _validation = { - 'vault_id': {'required': True}, - 'secret_name': {'required': True}, + "vault_id": {"required": True}, + "secret_name": {"required": True}, } _attribute_map = { - 'vault_id': {'key': 'vaultID', 'type': 'str'}, - 'secret_name': {'key': 'secretName', 'type': 'str'}, - 'version': {'key': 'version', 'type': 'str'}, + "vault_id": {"key": "vaultID", "type": "str"}, + "secret_name": {"key": "secretName", "type": "str"}, + "version": {"key": "version", "type": "str"}, } - def __init__( - self, - *, - vault_id: str, - secret_name: str, - version: Optional[str] = None, - **kwargs - ): + def __init__(self, *, vault_id: str, secret_name: str, version: Optional[str] = None, **kwargs): """ - :keyword vault_id: Required. Key vault identifier. + :keyword vault_id: Key vault identifier. Required. :paramtype vault_id: str - :keyword secret_name: Required. The secret name. + :keyword secret_name: The secret name. Required. :paramtype secret_name: str :keyword version: The secret version. :paramtype version: str """ - super(KeyVaultSecretRef, self).__init__(**kwargs) + super().__init__(**kwargs) self.vault_id = vault_id self.secret_name = secret_name self.version = version -class OrchestratorProfile(msrest.serialization.Model): +class OrchestratorProfile(_serialization.Model): """Contains information about orchestrator. All required parameters must be populated in order to send to Azure. :ivar orchestrator_type: Orchestrator type. :vartype orchestrator_type: str - :ivar orchestrator_version: Required. Orchestrator version (major, minor, patch). + :ivar orchestrator_version: Orchestrator version (major, minor, patch). Required. :vartype orchestrator_version: str :ivar is_preview: Whether Kubernetes version is currently in preview. :vartype is_preview: bool """ _validation = { - 'orchestrator_version': {'required': True}, + "orchestrator_version": {"required": True}, } _attribute_map = { - 'orchestrator_type': {'key': 'orchestratorType', 'type': 'str'}, - 'orchestrator_version': {'key': 'orchestratorVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "orchestrator_type": {"key": "orchestratorType", "type": "str"}, + "orchestrator_version": {"key": "orchestratorVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } def __init__( @@ -1022,25 +977,25 @@ def __init__( """ :keyword orchestrator_type: Orchestrator type. :paramtype orchestrator_type: str - :keyword orchestrator_version: Required. Orchestrator version (major, minor, patch). + :keyword orchestrator_version: Orchestrator version (major, minor, patch). Required. :paramtype orchestrator_version: str :keyword is_preview: Whether Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(OrchestratorProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.orchestrator_type = orchestrator_type self.orchestrator_version = orchestrator_version self.is_preview = is_preview -class OrchestratorVersionProfile(msrest.serialization.Model): +class OrchestratorVersionProfile(_serialization.Model): """The profile of an orchestrator and its available versions. All required parameters must be populated in order to send to Azure. - :ivar orchestrator_type: Required. Orchestrator type. + :ivar orchestrator_type: Orchestrator type. Required. :vartype orchestrator_type: str - :ivar orchestrator_version: Required. Orchestrator version (major, minor, patch). + :ivar orchestrator_version: Orchestrator version (major, minor, patch). Required. :vartype orchestrator_version: str :ivar default: Installed by default if version is not specified. :vartype default: bool @@ -1051,16 +1006,16 @@ class OrchestratorVersionProfile(msrest.serialization.Model): """ _validation = { - 'orchestrator_type': {'required': True}, - 'orchestrator_version': {'required': True}, + "orchestrator_type": {"required": True}, + "orchestrator_version": {"required": True}, } _attribute_map = { - 'orchestrator_type': {'key': 'orchestratorType', 'type': 'str'}, - 'orchestrator_version': {'key': 'orchestratorVersion', 'type': 'str'}, - 'default': {'key': 'default', 'type': 'bool'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, - 'upgrades': {'key': 'upgrades', 'type': '[OrchestratorProfile]'}, + "orchestrator_type": {"key": "orchestratorType", "type": "str"}, + "orchestrator_version": {"key": "orchestratorVersion", "type": "str"}, + "default": {"key": "default", "type": "bool"}, + "is_preview": {"key": "isPreview", "type": "bool"}, + "upgrades": {"key": "upgrades", "type": "[OrchestratorProfile]"}, } def __init__( @@ -1074,9 +1029,9 @@ def __init__( **kwargs ): """ - :keyword orchestrator_type: Required. Orchestrator type. + :keyword orchestrator_type: Orchestrator type. Required. :paramtype orchestrator_type: str - :keyword orchestrator_version: Required. Orchestrator version (major, minor, patch). + :keyword orchestrator_version: Orchestrator version (major, minor, patch). Required. :paramtype orchestrator_version: str :keyword default: Installed by default if version is not specified. :paramtype default: bool @@ -1085,7 +1040,7 @@ def __init__( :keyword upgrades: The list of available upgrade versions. :paramtype upgrades: list[~azure.mgmt.containerservice.v2017_07_01.models.OrchestratorProfile] """ - super(OrchestratorVersionProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.orchestrator_type = orchestrator_type self.orchestrator_version = orchestrator_version self.default = default @@ -1093,7 +1048,7 @@ def __init__( self.upgrades = upgrades -class OrchestratorVersionProfileListResult(msrest.serialization.Model): +class OrchestratorVersionProfileListResult(_serialization.Model): """The list of versions for supported orchestrators. Variables are only populated by the server, and will be ignored when sending a request. @@ -1106,37 +1061,32 @@ class OrchestratorVersionProfileListResult(msrest.serialization.Model): :vartype name: str :ivar type: Type of the orchestrator version profile list result. :vartype type: str - :ivar orchestrators: Required. List of orchestrator version profiles. + :ivar orchestrators: List of orchestrator version profiles. Required. :vartype orchestrators: list[~azure.mgmt.containerservice.v2017_07_01.models.OrchestratorVersionProfile] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'orchestrators': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "orchestrators": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'orchestrators': {'key': 'properties.orchestrators', 'type': '[OrchestratorVersionProfile]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "orchestrators": {"key": "properties.orchestrators", "type": "[OrchestratorVersionProfile]"}, } - def __init__( - self, - *, - orchestrators: List["_models.OrchestratorVersionProfile"], - **kwargs - ): + def __init__(self, *, orchestrators: List["_models.OrchestratorVersionProfile"], **kwargs): """ - :keyword orchestrators: Required. List of orchestrator version profiles. + :keyword orchestrators: List of orchestrator version profiles. Required. :paramtype orchestrators: list[~azure.mgmt.containerservice.v2017_07_01.models.OrchestratorVersionProfile] """ - super(OrchestratorVersionProfileListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/models/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/models/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/models/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/models/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/operations/__init__.py index a96e407a7be1..5a657fde9d43 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/operations/__init__.py @@ -11,8 +11,9 @@ from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'ContainerServicesOperations', + "ContainerServicesOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/operations/_container_services_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/operations/_container_services_operations.py index cb6bfc424257..d76a0dafe8bb 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/operations/_container_services_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/operations/_container_services_operations.py @@ -6,11 +6,15 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,230 +26,191 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-07-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/containerServices") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/containerServices" + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_create_or_update_request_initial( - resource_group_name: str, - container_service_name: str, - subscription_id: str, - *, - json: Optional[_models.ContainerService] = None, - content: Any = None, - **kwargs: Any + _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, container_service_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 = kwargs.pop('api_version', _params.pop('api-version', "2017-07-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/containerServices/{containerServiceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/containerServices/{containerServiceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "containerServiceName": _SERIALIZER.url("container_service_name", container_service_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "containerServiceName": _SERIALIZER.url("container_service_name", container_service_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - resource_group_name: str, - container_service_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, container_service_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 = kwargs.pop('api_version', _params.pop('api-version', "2017-07-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/containerServices/{containerServiceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/containerServices/{containerServiceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "containerServiceName": _SERIALIZER.url("container_service_name", container_service_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "containerServiceName": _SERIALIZER.url("container_service_name", container_service_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_delete_request_initial( - resource_group_name: str, - container_service_name: str, - subscription_id: str, - **kwargs: Any + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, container_service_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-07-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/containerServices/{containerServiceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/containerServices/{containerServiceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "containerServiceName": _SERIALIZER.url("container_service_name", container_service_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "containerServiceName": _SERIALIZER.url("container_service_name", container_service_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) -def build_list_by_resource_group_request( - resource_group_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-07-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/containerServices") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/containerServices", + ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_list_orchestrators_request( - subscription_id: str, - location: str, - *, - resource_type: Optional[str] = None, - **kwargs: Any + location: str, subscription_id: str, *, resource_type: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-04-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/orchestrators") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/orchestrators", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "location": _SERIALIZER.url("location", location, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if resource_type is not None: - _params['resource-type'] = _SERIALIZER.query("resource_type", resource_type, 'str') + _params["resource-type"] = _SERIALIZER.query("resource_type", resource_type, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class ContainerServicesOperations: """ @@ -266,45 +231,36 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.ContainerServiceListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.ContainerService"]: """Gets a list of container services in the specified subscription. Gets a list of container services in the specified subscription. The operation returns properties of each container service including state, orchestrator, number of masters and agents, and FQDNs of masters and agents. - :keyword api_version: Api Version. Default value is "2017-07-01". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ContainerServiceListResult or the result of - cls(response) + :return: An iterator like instance of either ContainerService or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2017_07_01.models.ContainerServiceListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2017_07_01.models.ContainerService] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ContainerServiceListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ContainerServiceListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -312,14 +268,7 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + request = HttpRequest("GET", next_link) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -335,10 +284,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -348,41 +295,44 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/containerServices"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/containerServices"} # type: ignore def _create_or_update_initial( self, resource_group_name: str, container_service_name: str, - parameters: _models.ContainerService, + parameters: Union[_models.ContainerService, IO], **kwargs: Any ) -> _models.ContainerService: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2017-07-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ContainerService] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ContainerService] - _json = self._serialize.body(parameters, 'ContainerService') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ContainerService") - request = build_create_or_update_request_initial( + request = build_create_or_update_request( resource_group_name=resource_group_name, container_service_name=container_service_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -390,10 +340,9 @@ def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -401,28 +350,29 @@ def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ContainerService', pipeline_response) + deserialized = self._deserialize("ContainerService", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('ContainerService', pipeline_response) + deserialized = self._deserialize("ContainerService", pipeline_response) if response.status_code == 202: - deserialized = self._deserialize('ContainerService', pipeline_response) + deserialized = self._deserialize("ContainerService", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/containerServices/{containerServiceName}"} # type: ignore + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/containerServices/{containerServiceName}"} # type: ignore - - @distributed_trace + @overload def begin_create_or_update( self, resource_group_name: str, container_service_name: str, parameters: _models.ContainerService, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.ContainerService]: """Creates or updates a container service. @@ -430,16 +380,97 @@ def begin_create_or_update( Creates or updates a container service with the specified configuration of orchestrator, masters, and agents. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :param container_service_name: The name of the container service in the specified subscription - and resource group. + and resource group. Required. :type container_service_name: str :param parameters: Parameters supplied to the Create or Update a Container Service operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2017_07_01.models.ContainerService - :keyword api_version: Api Version. Default value is "2017-07-01". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ContainerService or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2017_07_01.models.ContainerService] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + container_service_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ContainerService]: + """Creates or updates a container service. + + Creates or updates a container service with the specified configuration of orchestrator, + masters, and agents. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param container_service_name: The name of the container service in the specified subscription + and resource group. Required. + :type container_service_name: str + :param parameters: Parameters supplied to the Create or Update a Container Service operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ContainerService or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2017_07_01.models.ContainerService] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + container_service_name: str, + parameters: Union[_models.ContainerService, IO], + **kwargs: Any + ) -> LROPoller[_models.ContainerService]: + """Creates or updates a container service. + + Creates or updates a container service with the specified configuration of orchestrator, + masters, and agents. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param container_service_name: The name of the container service in the specified subscription + and resource group. Required. + :type container_service_name: str + :param parameters: Parameters supplied to the Create or Update a Container Service operation. + Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2017_07_01.models.ContainerService or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -452,20 +483,17 @@ def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2017_07_01.models.ContainerService] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-07-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ContainerService] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ContainerService] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -473,84 +501,69 @@ def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ContainerService', pipeline_response) + deserialized = self._deserialize("ContainerService", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/containerServices/{containerServiceName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/containerServices/{containerServiceName}"} # type: ignore @distributed_trace - def get( - self, - resource_group_name: str, - container_service_name: str, - **kwargs: Any - ) -> _models.ContainerService: + def get(self, resource_group_name: str, container_service_name: str, **kwargs: Any) -> _models.ContainerService: """Gets the properties of the specified container service. Gets the properties of the specified container service in the specified subscription and resource group. The operation returns the properties including state, orchestrator, number of masters and agents, and FQDNs of masters and agents. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :param container_service_name: The name of the container service in the specified subscription - and resource group. + and resource group. Required. :type container_service_name: str - :keyword api_version: Api Version. Default value is "2017-07-01". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ContainerService, or the result of cls(response) + :return: ContainerService or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2017_07_01.models.ContainerService - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ContainerService] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ContainerService] - request = build_get_request( resource_group_name=resource_group_name, container_service_name=container_service_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -558,50 +571,42 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ContainerService', pipeline_response) + deserialized = self._deserialize("ContainerService", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/containerServices/{containerServiceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/containerServices/{containerServiceName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - container_service_name: str, - **kwargs: Any + self, resource_group_name: str, container_service_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( + request = build_delete_request( resource_group_name=resource_group_name, container_service_name=container_service_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -609,10 +614,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -622,16 +626,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/containerServices/{containerServiceName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/containerServices/{containerServiceName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - container_service_name: str, - **kwargs: Any - ) -> LROPoller[None]: + def begin_delete(self, resource_group_name: str, container_service_name: str, **kwargs: Any) -> LROPoller[None]: """Deletes the specified container service. Deletes the specified container service in the specified subscription and resource group. The @@ -639,14 +637,11 @@ def begin_delete( # pylint: disable=inconsistent-return-statements including storage accounts, VMs, and availability sets. All the other resources created with the container service are part of the same resource group and can be deleted individually. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :param container_service_name: The name of the container service in the specified subscription - and resource group. + and resource group. Required. :type container_service_name: str - :keyword api_version: Api Version. Default value is "2017-07-01". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -657,98 +652,82 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, container_service_name=container_service_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/containerServices/{containerServiceName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/containerServices/{containerServiceName}"} # type: ignore @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> Iterable[_models.ContainerServiceListResult]: + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.ContainerService"]: """Gets a list of container services in the specified resource group. Gets a list of container services in the specified subscription and resource group. The operation returns properties of each container service including state, orchestrator, number of masters and agents, and FQDNs of masters and agents. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :keyword api_version: Api Version. Default value is "2017-07-01". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ContainerServiceListResult or the result of - cls(response) + :return: An iterator like instance of either ContainerService or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2017_07_01.models.ContainerServiceListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2017_07_01.models.ContainerService] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ContainerServiceListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ContainerServiceListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -756,15 +735,7 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + request = HttpRequest("GET", next_link) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -780,10 +751,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -793,18 +762,13 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/containerServices"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/containerServices"} # type: ignore @distributed_trace def list_orchestrators( - self, - location: str, - resource_type: Optional[str] = None, - **kwargs: Any + self, location: str, resource_type: Optional[str] = None, **kwargs: Any ) -> _models.OrchestratorVersionProfileListResult: """Gets a list of supported orchestrators in the specified subscription. @@ -812,37 +776,31 @@ def list_orchestrators( properties of each orchestrator including version, available upgrades and whether that version or upgrades are in preview. - :param location: The name of a supported Azure region. + :param location: The name of a supported Azure region. Required. :type location: str :param resource_type: resource type for which the list of orchestrators needs to be returned. Default value is None. :type resource_type: str - :keyword api_version: Api Version. Default value is "2019-04-01". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: OrchestratorVersionProfileListResult, or the result of cls(response) + :return: OrchestratorVersionProfileListResult or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2017_07_01.models.OrchestratorVersionProfileListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OrchestratorVersionProfileListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OrchestratorVersionProfileListResult] - request = build_list_orchestrators_request( - subscription_id=self._config.subscription_id, location=location, - api_version=api_version, + subscription_id=self._config.subscription_id, resource_type=resource_type, - template_url=self.list_orchestrators.metadata['url'], + api_version=api_version, + template_url=self.list_orchestrators.metadata["url"], headers=_headers, params=_params, ) @@ -850,22 +808,20 @@ def list_orchestrators( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('OrchestratorVersionProfileListResult', pipeline_response) + deserialized = self._deserialize("OrchestratorVersionProfileListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_orchestrators.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/orchestrators"} # type: ignore - + list_orchestrators.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/orchestrators"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/operations/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/__init__.py index 37a5f9e02e6f..a8716d29afe8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/__init__.py @@ -14,7 +14,8 @@ except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['ContainerServiceClient'] + +__all__ = ["ContainerServiceClient"] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/_configuration.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/_configuration.py index 159b79fdfd7c..4fc452fe85cd 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/_configuration.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/_configuration.py @@ -18,30 +18,26 @@ VERSION = "unknown" + class ContainerServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ContainerServiceClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2018-03-31". 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: + def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ContainerServiceClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2018-03-31") # type: str + api_version = kwargs.pop("api_version", "2018-03-31") # type: str if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -51,23 +47,24 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-containerservice/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-containerservice/{}".format(VERSION)) self._configure(**kwargs) def _configure( - self, - **kwargs # type: Any + self, **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/_container_service_client.py index 51eafa374445..d7a562a48041 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/_container_service_client.py @@ -9,12 +9,11 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from . import models +from .._serialization import Deserializer, Serializer from ._configuration import ContainerServiceClientConfiguration from .operations import ManagedClustersOperations, Operations @@ -22,7 +21,8 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class ContainerServiceClient: + +class ContainerServiceClient: # pylint: disable=client-accepts-api-version-keyword """The Container Service Client. :ivar operations: Operations operations @@ -30,10 +30,10 @@ class ContainerServiceClient: :ivar managed_clusters: ManagedClustersOperations operations :vartype managed_clusters: azure.mgmt.containerservice.v2018_03_31.operations.ManagedClustersOperations - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -51,26 +51,21 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = ContainerServiceClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = ContainerServiceClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize - ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.managed_clusters = ManagedClustersOperations( self._client, self._config, self._serialize, self._deserialize ) - - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> HttpResponse: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -79,7 +74,7 @@ def _send_request( >>> response = client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/_metadata.json b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/_metadata.json index e021cb137b53..1a3c06152c61 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/_metadata.json +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/_metadata.json @@ -10,20 +10,20 @@ "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { "credential": { - "signature": "credential, # type: \"TokenCredential\"", - "description": "Credential needed for the client to connect to Azure.", + "signature": "credential: \"TokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true }, "subscription_id": { - "signature": "subscription_id, # type: str", - "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "signature": "subscription_id: str,", + "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.", "docstring_type": "str", "required": true } @@ -31,13 +31,13 @@ "async": { "credential": { "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure.", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { "signature": "subscription_id: str,", - "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.", "docstring_type": "str", "required": true } @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=\"https://management.azure.com\", # type: str", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/_patch.py index 74e48ecd07cf..f99e77fef986 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/_patch.py @@ -28,4 +28,4 @@ # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + pass diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/_vendor.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/_vendor.py index 138f663c53a4..9aad73fc743e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/_vendor.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/_vendor.py @@ -7,6 +7,7 @@ from azure.core.pipeline.transport import HttpRequest + def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) @@ -14,6 +15,7 @@ def _convert_request(request, files=None): request.set_formdata_body(files) return request + def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -21,7 +23,5 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [ - c for c in formatted_components if "{}".format(key.args[0]) not in c - ] + components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/aio/__init__.py index 37a5f9e02e6f..a8716d29afe8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/aio/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/aio/__init__.py @@ -14,7 +14,8 @@ except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['ContainerServiceClient'] + +__all__ = ["ContainerServiceClient"] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/aio/_configuration.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/aio/_configuration.py index e9ddcc114036..4501222c8a0e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/aio/_configuration.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/aio/_configuration.py @@ -18,30 +18,26 @@ VERSION = "unknown" + class ContainerServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ContainerServiceClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2018-03-31". 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: + def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ContainerServiceClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2018-03-31") # type: str + api_version = kwargs.pop("api_version", "2018-03-31") # type: str if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -51,22 +47,21 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-containerservice/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-containerservice/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, - **kwargs: Any - ) -> None: - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/aio/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/aio/_container_service_client.py index 5abcaf69854c..7dd8db5d52e0 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/aio/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/aio/_container_service_client.py @@ -9,12 +9,11 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from .. import models +from ..._serialization import Deserializer, Serializer from ._configuration import ContainerServiceClientConfiguration from .operations import ManagedClustersOperations, Operations @@ -22,7 +21,8 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class ContainerServiceClient: + +class ContainerServiceClient: # pylint: disable=client-accepts-api-version-keyword """The Container Service Client. :ivar operations: Operations operations @@ -30,10 +30,10 @@ class ContainerServiceClient: :ivar managed_clusters: ManagedClustersOperations operations :vartype managed_clusters: azure.mgmt.containerservice.v2018_03_31.aio.operations.ManagedClustersOperations - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -51,26 +51,21 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = ContainerServiceClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = ContainerServiceClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize - ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.managed_clusters = ManagedClustersOperations( self._client, self._config, self._serialize, self._deserialize ) - - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -79,7 +74,7 @@ def _send_request( >>> response = await client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/aio/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/aio/_patch.py index 74e48ecd07cf..f99e77fef986 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/aio/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/aio/_patch.py @@ -28,4 +28,4 @@ # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + pass diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/aio/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/aio/operations/__init__.py index 79c2682d6c29..399a909877af 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/aio/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/aio/operations/__init__.py @@ -12,9 +12,10 @@ from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'Operations', - 'ManagedClustersOperations', + "Operations", + "ManagedClustersOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/aio/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/aio/operations/_managed_clusters_operations.py index 61c25479c93d..e7a26ce18ac9 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/aio/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/aio/operations/_managed_clusters_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +29,25 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._managed_clusters_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_access_profile_request, build_get_request, build_get_upgrade_profile_request, build_list_by_resource_group_request, build_list_cluster_admin_credentials_request, build_list_cluster_user_credentials_request, build_list_request, build_reset_aad_profile_request_initial, build_reset_service_principal_profile_request_initial, build_update_tags_request_initial -T = TypeVar('T') +from ...operations._managed_clusters_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_access_profile_request, + build_get_request, + build_get_upgrade_profile_request, + build_list_by_resource_group_request, + build_list_cluster_admin_credentials_request, + build_list_cluster_user_credentials_request, + build_list_request, + build_reset_aad_profile_request, + build_reset_service_principal_profile_request, + build_update_tags_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class ManagedClustersOperations: """ .. warning:: @@ -45,41 +67,35 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.ManagedClusterListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.ManagedCluster"]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. The operation returns properties of each managed cluster. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2018_03_31.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2018_03_31.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-03-31")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -87,14 +103,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -110,10 +123,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -123,50 +134,44 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.ManagedClusterListResult]: + self, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ManagedCluster"]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. The operation returns properties of each managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2018_03_31.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2018_03_31.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-03-31")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -174,15 +179,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -198,10 +199,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -211,51 +210,43 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace_async async def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.ManagedClusterUpgradeProfile: """Gets upgrade profile for a managed cluster. Gets the details of the upgrade profile for a managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterUpgradeProfile, or the result of cls(response) + :return: ManagedClusterUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2018_03_31.models.ManagedClusterUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-03-31")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -263,69 +254,60 @@ async def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterUpgradeProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore @distributed_trace_async async def get_access_profile( - self, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, role_name: str, **kwargs: Any ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. Gets the accessProfile for the specified role name of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param role_name: The name of the role for managed cluster accessProfile resource. + :param role_name: The name of the role for managed cluster accessProfile resource. Required. :type role_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterAccessProfile, or the result of cls(response) + :return: ManagedClusterAccessProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2018_03_31.models.ManagedClusterAccessProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-03-31")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterAccessProfile] - request = build_get_access_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, role_name=role_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_access_profile.metadata['url'], + template_url=self.get_access_profile.metadata["url"], headers=_headers, params=_params, ) @@ -333,64 +315,56 @@ async def get_access_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterAccessProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterAccessProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_access_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore - + get_access_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore @distributed_trace_async async def list_cluster_admin_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster admin credential of a managed cluster. Gets cluster admin credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2018_03_31.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-03-31")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_admin_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_admin_credentials.metadata['url'], + template_url=self.list_cluster_admin_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -398,64 +372,56 @@ async def list_cluster_admin_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_admin_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore - + list_cluster_admin_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore @distributed_trace_async async def list_cluster_user_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster user credential of a managed cluster. Gets cluster user credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2018_03_31.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-03-31")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_user_credentials.metadata['url'], + template_url=self.list_cluster_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -463,64 +429,54 @@ async def list_cluster_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore - + list_cluster_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore @distributed_trace_async - async def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.ManagedCluster: + async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.ManagedCluster: """Gets a managed cluster. Gets the details of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedCluster, or the result of cls(response) + :return: ManagedCluster or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2018_03_31.models.ManagedCluster - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-03-31")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -528,55 +484,54 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _create_or_update_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.ManagedCluster, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-03-31")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'ManagedCluster') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedCluster") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -584,10 +539,9 @@ async def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -595,25 +549,26 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - @distributed_trace_async + @overload async def begin_create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedCluster, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. @@ -621,12 +576,90 @@ async def begin_create_or_update( Creates or updates a managed cluster with the specified configuration for agents and Kubernetes version. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2018_03_31.models.ManagedCluster + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2018_03_31.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster with the specified configuration for agents and Kubernetes + version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2018_03_31.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster with the specified configuration for agents and Kubernetes + version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. Is + either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2018_03_31.models.ManagedCluster or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -639,20 +672,17 @@ async def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2018_03_31.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-03-31")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -660,69 +690,66 @@ async def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _update_tags_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.TagsObject, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-03-31")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request_initial( - subscription_id=self._config.subscription_id, + request = build_update_tags_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_tags_initial.metadata['url'], + content=_content, + template_url=self._update_tags_initial.metadata["url"], headers=_headers, params=_params, ) @@ -730,44 +757,118 @@ async def _update_tags_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_tags_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _update_tags_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - @distributed_trace_async + @overload async def begin_update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates a managed cluster with the specified tags. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2018_03_31.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2018_03_31.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates a managed cluster with the specified tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2018_03_31.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates a managed cluster with the specified tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2018_03_31.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -780,20 +881,17 @@ async def begin_update_tags( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2018_03_31.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-03-31")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, @@ -801,64 +899,54 @@ async def begin_update_tags( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-03-31")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -866,10 +954,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -879,23 +966,17 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: + async def begin_delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Deletes a managed cluster. Deletes the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -907,85 +988,83 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-03-31")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterServicePrincipalProfile, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-03-31")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterServicePrincipalProfile") - request = build_reset_service_principal_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_service_principal_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_service_principal_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_service_principal_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -993,10 +1072,9 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1006,29 +1084,106 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist if cls: return cls(pipeline_response, None, {}) - _reset_service_principal_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + _reset_service_principal_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore - - @distributed_trace_async - async def begin_reset_service_principal_profile( # pylint: disable=inconsistent-return-statements + @overload + async def begin_reset_service_principal_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterServicePrincipalProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: """Reset Service Principal Profile of a managed cluster. Update the service principal Profile for a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a - Managed Cluster. + Managed Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2018_03_31.models.ManagedClusterServicePrincipalProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset Service Principal Profile of a managed cluster. + + Update the service principal Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a + Managed Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset Service Principal Profile of a managed cluster. + + Update the service principal Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a + Managed Cluster. Is either a model type or a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2018_03_31.models.ManagedClusterServicePrincipalProfile or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -1039,20 +1194,17 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-03-31")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1060,67 +1212,68 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_service_principal_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + begin_reset_service_principal_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterAADProfile, + parameters: Union[_models.ManagedClusterAADProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-03-31")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterAADProfile") - request = build_reset_aad_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_aad_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_aad_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_aad_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1128,10 +1281,9 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1141,28 +1293,105 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta if cls: return cls(pipeline_response, None, {}) - _reset_aad_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - + _reset_aad_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - @distributed_trace_async - async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements + @overload + async def begin_reset_aad_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterAADProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: """Reset AAD Profile of a managed cluster. Update the AAD Profile for a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed - Cluster. + Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2018_03_31.models.ManagedClusterAADProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset AAD Profile of a managed cluster. + + Update the AAD Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed + Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterAADProfile, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset AAD Profile of a managed cluster. + + Update the AAD Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed + Cluster. Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2018_03_31.models.ManagedClusterAADProfile or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -1173,20 +1402,17 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-03-31")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1194,34 +1420,30 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_aad_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + begin_reset_aad_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/aio/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/aio/operations/_operations.py index 607554bc1517..4bd7a480cbf5 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/aio/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/aio/operations/_operations.py @@ -7,9 +7,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,9 +27,11 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._operations import build_list_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class Operations: """ .. warning:: @@ -42,36 +51,31 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.OperationListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.OperationValue"]: """Gets a list of compute operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationListResult or the result of cls(response) + :return: An iterator like instance of either OperationValue or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2018_03_31.models.OperationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2018_03_31.models.OperationValue] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-03-31")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -79,13 +83,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -101,10 +103,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -114,8 +114,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.ContainerService/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ContainerService/operations"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/aio/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/aio/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/aio/operations/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/aio/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/models/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/models/__init__.py index 1cfef05788b7..fdfc7ce0780f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/models/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/models/__init__.py @@ -31,49 +31,47 @@ from ._models_py3 import Resource from ._models_py3 import TagsObject - -from ._container_service_client_enums import ( - ContainerServiceStorageProfileTypes, - ContainerServiceVMSizeTypes, - Count, - NetworkPlugin, - NetworkPolicy, - OSType, -) +from ._container_service_client_enums import ContainerServiceStorageProfileTypes +from ._container_service_client_enums import ContainerServiceVMSizeTypes +from ._container_service_client_enums import Count +from ._container_service_client_enums import NetworkPlugin +from ._container_service_client_enums import NetworkPolicy +from ._container_service_client_enums import OSType from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'ContainerServiceDiagnosticsProfile', - 'ContainerServiceLinuxProfile', - 'ContainerServiceMasterProfile', - 'ContainerServiceNetworkProfile', - 'ContainerServiceSshConfiguration', - 'ContainerServiceSshPublicKey', - 'ContainerServiceVMDiagnostics', - 'ContainerServiceWindowsProfile', - 'CredentialResult', - 'CredentialResults', - 'ManagedCluster', - 'ManagedClusterAADProfile', - 'ManagedClusterAccessProfile', - 'ManagedClusterAddonProfile', - 'ManagedClusterAgentPoolProfile', - 'ManagedClusterListResult', - 'ManagedClusterPoolUpgradeProfile', - 'ManagedClusterServicePrincipalProfile', - 'ManagedClusterUpgradeProfile', - 'OperationListResult', - 'OperationValue', - 'OrchestratorProfile', - 'Resource', - 'TagsObject', - 'ContainerServiceStorageProfileTypes', - 'ContainerServiceVMSizeTypes', - 'Count', - 'NetworkPlugin', - 'NetworkPolicy', - 'OSType', + "ContainerServiceDiagnosticsProfile", + "ContainerServiceLinuxProfile", + "ContainerServiceMasterProfile", + "ContainerServiceNetworkProfile", + "ContainerServiceSshConfiguration", + "ContainerServiceSshPublicKey", + "ContainerServiceVMDiagnostics", + "ContainerServiceWindowsProfile", + "CredentialResult", + "CredentialResults", + "ManagedCluster", + "ManagedClusterAADProfile", + "ManagedClusterAccessProfile", + "ManagedClusterAddonProfile", + "ManagedClusterAgentPoolProfile", + "ManagedClusterListResult", + "ManagedClusterPoolUpgradeProfile", + "ManagedClusterServicePrincipalProfile", + "ManagedClusterUpgradeProfile", + "OperationListResult", + "OperationValue", + "OrchestratorProfile", + "Resource", + "TagsObject", + "ContainerServiceStorageProfileTypes", + "ContainerServiceVMSizeTypes", + "Count", + "NetworkPlugin", + "NetworkPolicy", + "OSType", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/models/_container_service_client_enums.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/models/_container_service_client_enums.py index 5835a9bfa4b2..b26e0e63c21a 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/models/_container_service_client_enums.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/models/_container_service_client_enums.py @@ -18,9 +18,9 @@ class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEn STORAGE_ACCOUNT = "StorageAccount" MANAGED_DISKS = "ManagedDisks" + class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Size of agent VMs. - """ + """Size of agent VMs.""" STANDARD_A1 = "Standard_A1" STANDARD_A10 = "Standard_A10" @@ -197,6 +197,7 @@ class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): STANDARD_NV24 = "Standard_NV24" STANDARD_NV6 = "Standard_NV6" + class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): """Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, and 5. The default value is 1. @@ -206,22 +207,22 @@ class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): THREE = 3 FIVE = 5 + class NetworkPlugin(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Network plugin used for building Kubernetes network. - """ + """Network plugin used for building Kubernetes network.""" AZURE = "azure" KUBENET = "kubenet" + class NetworkPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Network policy used for building Kubernetes network. - """ + """Network policy used for building Kubernetes network.""" CALICO = "calico" + class OSType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """OsType to be used to specify os type. Choose from Linux and Windows. Default to Linux. - """ + """OsType to be used to specify os type. Choose from Linux and Windows. Default to Linux.""" LINUX = "Linux" WINDOWS = "Windows" diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/models/_models_py3.py index c548e149a28d..0e1ecb053387 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/models/_models_py3.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/models/_models_py3.py @@ -1,4 +1,5 @@ # coding=utf-8 +# pylint: disable=too-many-lines # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -8,87 +9,76 @@ from typing import Dict, List, Optional, TYPE_CHECKING, Union -import msrest.serialization +from ... import _serialization if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - import __init__ as _models + from .. import models as _models -class ContainerServiceDiagnosticsProfile(msrest.serialization.Model): +class ContainerServiceDiagnosticsProfile(_serialization.Model): """Profile for diagnostics on the container service cluster. All required parameters must be populated in order to send to Azure. - :ivar vm_diagnostics: Required. Profile for diagnostics on the container service VMs. + :ivar vm_diagnostics: Profile for diagnostics on the container service VMs. Required. :vartype vm_diagnostics: ~azure.mgmt.containerservice.v2018_03_31.models.ContainerServiceVMDiagnostics """ _validation = { - 'vm_diagnostics': {'required': True}, + "vm_diagnostics": {"required": True}, } _attribute_map = { - 'vm_diagnostics': {'key': 'vmDiagnostics', 'type': 'ContainerServiceVMDiagnostics'}, + "vm_diagnostics": {"key": "vmDiagnostics", "type": "ContainerServiceVMDiagnostics"}, } - def __init__( - self, - *, - vm_diagnostics: "_models.ContainerServiceVMDiagnostics", - **kwargs - ): + def __init__(self, *, vm_diagnostics: "_models.ContainerServiceVMDiagnostics", **kwargs): """ - :keyword vm_diagnostics: Required. Profile for diagnostics on the container service VMs. + :keyword vm_diagnostics: Profile for diagnostics on the container service VMs. Required. :paramtype vm_diagnostics: ~azure.mgmt.containerservice.v2018_03_31.models.ContainerServiceVMDiagnostics """ - super(ContainerServiceDiagnosticsProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.vm_diagnostics = vm_diagnostics -class ContainerServiceLinuxProfile(msrest.serialization.Model): +class ContainerServiceLinuxProfile(_serialization.Model): """Profile for Linux VMs in the container service cluster. All required parameters must be populated in order to send to Azure. - :ivar admin_username: Required. The administrator username to use for Linux VMs. + :ivar admin_username: The administrator username to use for Linux VMs. Required. :vartype admin_username: str - :ivar ssh: Required. SSH configuration for Linux-based VMs running on Azure. + :ivar ssh: SSH configuration for Linux-based VMs running on Azure. Required. :vartype ssh: ~azure.mgmt.containerservice.v2018_03_31.models.ContainerServiceSshConfiguration """ _validation = { - 'admin_username': {'required': True, 'pattern': r'^[A-Za-z][-A-Za-z0-9_]*$'}, - 'ssh': {'required': True}, + "admin_username": {"required": True, "pattern": r"^[A-Za-z][-A-Za-z0-9_]*$"}, + "ssh": {"required": True}, } _attribute_map = { - 'admin_username': {'key': 'adminUsername', 'type': 'str'}, - 'ssh': {'key': 'ssh', 'type': 'ContainerServiceSshConfiguration'}, + "admin_username": {"key": "adminUsername", "type": "str"}, + "ssh": {"key": "ssh", "type": "ContainerServiceSshConfiguration"}, } - def __init__( - self, - *, - admin_username: str, - ssh: "_models.ContainerServiceSshConfiguration", - **kwargs - ): + def __init__(self, *, admin_username: str, ssh: "_models.ContainerServiceSshConfiguration", **kwargs): """ - :keyword admin_username: Required. The administrator username to use for Linux VMs. + :keyword admin_username: The administrator username to use for Linux VMs. Required. :paramtype admin_username: str - :keyword ssh: Required. SSH configuration for Linux-based VMs running on Azure. + :keyword ssh: SSH configuration for Linux-based VMs running on Azure. Required. :paramtype ssh: ~azure.mgmt.containerservice.v2018_03_31.models.ContainerServiceSshConfiguration """ - super(ContainerServiceLinuxProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.admin_username = admin_username self.ssh = ssh -class ContainerServiceMasterProfile(msrest.serialization.Model): +class ContainerServiceMasterProfile(_serialization.Model): """Profile for the container service master. Variables are only populated by the server, and will be ignored when sending a request. @@ -96,11 +86,11 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar count: Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, - and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". + and 5. The default value is 1. Known values are: 1, 3, and 5. :vartype count: int or ~azure.mgmt.containerservice.v2018_03_31.models.Count - :ivar dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. + :ivar dns_prefix: DNS prefix to be used to create the FQDN for the master pool. Required. :vartype dns_prefix: str - :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + :ivar vm_size: Size of agent VMs. Required. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -137,7 +127,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :vartype vm_size: str or ~azure.mgmt.containerservice.v2018_03_31.models.ContainerServiceVMSizeTypes :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine @@ -151,7 +141,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): :vartype first_consecutive_static_ip: str :ivar storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount" and "ManagedDisks". :vartype storage_profile: str or ~azure.mgmt.containerservice.v2018_03_31.models.ContainerServiceStorageProfileTypes :ivar fqdn: FQDN for the master pool. @@ -159,21 +149,21 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): """ _validation = { - 'dns_prefix': {'required': True}, - 'vm_size': {'required': True}, - 'os_disk_size_gb': {'maximum': 1023, 'minimum': 0}, - 'fqdn': {'readonly': True}, + "dns_prefix": {"required": True}, + "vm_size": {"required": True}, + "os_disk_size_gb": {"maximum": 1023, "minimum": 0}, + "fqdn": {"readonly": True}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'dns_prefix': {'key': 'dnsPrefix', 'type': 'str'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'first_consecutive_static_ip': {'key': 'firstConsecutiveStaticIP', 'type': 'str'}, - 'storage_profile': {'key': 'storageProfile', 'type': 'str'}, - 'fqdn': {'key': 'fqdn', 'type': 'str'}, + "count": {"key": "count", "type": "int"}, + "dns_prefix": {"key": "dnsPrefix", "type": "str"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "first_consecutive_static_ip": {"key": "firstConsecutiveStaticIP", "type": "str"}, + "storage_profile": {"key": "storageProfile", "type": "str"}, + "fqdn": {"key": "fqdn", "type": "str"}, } def __init__( @@ -181,20 +171,20 @@ def __init__( *, dns_prefix: str, vm_size: Union[str, "_models.ContainerServiceVMSizeTypes"], - count: Optional[Union[int, "_models.Count"]] = 1, + count: Union[int, "_models.Count"] = 1, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, - first_consecutive_static_ip: Optional[str] = "10.240.255.5", + first_consecutive_static_ip: str = "10.240.255.5", storage_profile: Optional[Union[str, "_models.ContainerServiceStorageProfileTypes"]] = None, **kwargs ): """ :keyword count: Number of masters (VMs) in the container service cluster. Allowed values are 1, - 3, and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". + 3, and 5. The default value is 1. Known values are: 1, 3, and 5. :paramtype count: int or ~azure.mgmt.containerservice.v2018_03_31.models.Count - :keyword dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. + :keyword dns_prefix: DNS prefix to be used to create the FQDN for the master pool. Required. :paramtype dns_prefix: str - :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + :keyword vm_size: Size of agent VMs. Required. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -231,7 +221,7 @@ def __init__( "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :paramtype vm_size: str or ~azure.mgmt.containerservice.v2018_03_31.models.ContainerServiceVMSizeTypes :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every @@ -245,11 +235,11 @@ def __init__( :paramtype first_consecutive_static_ip: str :keyword storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount" and "ManagedDisks". :paramtype storage_profile: str or ~azure.mgmt.containerservice.v2018_03_31.models.ContainerServiceStorageProfileTypes """ - super(ContainerServiceMasterProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.dns_prefix = dns_prefix self.vm_size = vm_size @@ -260,14 +250,13 @@ def __init__( self.fqdn = None -class ContainerServiceNetworkProfile(msrest.serialization.Model): +class ContainerServiceNetworkProfile(_serialization.Model): """Profile of network configuration. :ivar network_plugin: Network plugin used for building Kubernetes network. Known values are: - "azure", "kubenet". Default value: "kubenet". + "azure" and "kubenet". :vartype network_plugin: str or ~azure.mgmt.containerservice.v2018_03_31.models.NetworkPlugin - :ivar network_policy: Network policy used for building Kubernetes network. Known values are: - "calico". + :ivar network_policy: Network policy used for building Kubernetes network. "calico" :vartype network_policy: str or ~azure.mgmt.containerservice.v2018_03_31.models.NetworkPolicy :ivar pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :vartype pod_cidr: str @@ -283,38 +272,39 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): """ _validation = { - 'pod_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, - 'service_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, - 'dns_service_ip': {'pattern': r'^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$'}, - 'docker_bridge_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, + "pod_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, + "service_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, + "dns_service_ip": { + "pattern": r"^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$" + }, + "docker_bridge_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, } _attribute_map = { - 'network_plugin': {'key': 'networkPlugin', 'type': 'str'}, - 'network_policy': {'key': 'networkPolicy', 'type': 'str'}, - 'pod_cidr': {'key': 'podCidr', 'type': 'str'}, - 'service_cidr': {'key': 'serviceCidr', 'type': 'str'}, - 'dns_service_ip': {'key': 'dnsServiceIP', 'type': 'str'}, - 'docker_bridge_cidr': {'key': 'dockerBridgeCidr', 'type': 'str'}, + "network_plugin": {"key": "networkPlugin", "type": "str"}, + "network_policy": {"key": "networkPolicy", "type": "str"}, + "pod_cidr": {"key": "podCidr", "type": "str"}, + "service_cidr": {"key": "serviceCidr", "type": "str"}, + "dns_service_ip": {"key": "dnsServiceIP", "type": "str"}, + "docker_bridge_cidr": {"key": "dockerBridgeCidr", "type": "str"}, } def __init__( self, *, - network_plugin: Optional[Union[str, "_models.NetworkPlugin"]] = "kubenet", + network_plugin: Union[str, "_models.NetworkPlugin"] = "kubenet", network_policy: Optional[Union[str, "_models.NetworkPolicy"]] = None, - pod_cidr: Optional[str] = "10.244.0.0/16", - service_cidr: Optional[str] = "10.0.0.0/16", - dns_service_ip: Optional[str] = "10.0.0.10", - docker_bridge_cidr: Optional[str] = "172.17.0.1/16", + pod_cidr: str = "10.244.0.0/16", + service_cidr: str = "10.0.0.0/16", + dns_service_ip: str = "10.0.0.10", + docker_bridge_cidr: str = "172.17.0.1/16", **kwargs ): """ :keyword network_plugin: Network plugin used for building Kubernetes network. Known values are: - "azure", "kubenet". Default value: "kubenet". + "azure" and "kubenet". :paramtype network_plugin: str or ~azure.mgmt.containerservice.v2018_03_31.models.NetworkPlugin - :keyword network_policy: Network policy used for building Kubernetes network. Known values are: - "calico". + :keyword network_policy: Network policy used for building Kubernetes network. "calico" :paramtype network_policy: str or ~azure.mgmt.containerservice.v2018_03_31.models.NetworkPolicy :keyword pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :paramtype pod_cidr: str @@ -328,7 +318,7 @@ def __init__( must not overlap with any Subnet IP ranges or the Kubernetes service address range. :paramtype docker_bridge_cidr: str """ - super(ContainerServiceNetworkProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.network_plugin = network_plugin self.network_policy = network_policy self.pod_cidr = pod_cidr @@ -337,152 +327,134 @@ def __init__( self.docker_bridge_cidr = docker_bridge_cidr -class ContainerServiceSshConfiguration(msrest.serialization.Model): +class ContainerServiceSshConfiguration(_serialization.Model): """SSH configuration for Linux-based VMs running on Azure. All required parameters must be populated in order to send to Azure. - :ivar public_keys: Required. The list of SSH public keys used to authenticate with Linux-based - VMs. Only expect one key specified. + :ivar public_keys: The list of SSH public keys used to authenticate with Linux-based VMs. Only + expect one key specified. Required. :vartype public_keys: list[~azure.mgmt.containerservice.v2018_03_31.models.ContainerServiceSshPublicKey] """ _validation = { - 'public_keys': {'required': True}, + "public_keys": {"required": True}, } _attribute_map = { - 'public_keys': {'key': 'publicKeys', 'type': '[ContainerServiceSshPublicKey]'}, + "public_keys": {"key": "publicKeys", "type": "[ContainerServiceSshPublicKey]"}, } - def __init__( - self, - *, - public_keys: List["_models.ContainerServiceSshPublicKey"], - **kwargs - ): + def __init__(self, *, public_keys: List["_models.ContainerServiceSshPublicKey"], **kwargs): """ - :keyword public_keys: Required. The list of SSH public keys used to authenticate with - Linux-based VMs. Only expect one key specified. + :keyword public_keys: The list of SSH public keys used to authenticate with Linux-based VMs. + Only expect one key specified. Required. :paramtype public_keys: list[~azure.mgmt.containerservice.v2018_03_31.models.ContainerServiceSshPublicKey] """ - super(ContainerServiceSshConfiguration, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_keys = public_keys -class ContainerServiceSshPublicKey(msrest.serialization.Model): +class ContainerServiceSshPublicKey(_serialization.Model): """Contains information about SSH certificate public key data. All required parameters must be populated in order to send to Azure. - :ivar key_data: Required. Certificate public key used to authenticate with VMs through SSH. The - certificate must be in PEM format with or without headers. + :ivar key_data: Certificate public key used to authenticate with VMs through SSH. The + certificate must be in PEM format with or without headers. Required. :vartype key_data: str """ _validation = { - 'key_data': {'required': True}, + "key_data": {"required": True}, } _attribute_map = { - 'key_data': {'key': 'keyData', 'type': 'str'}, + "key_data": {"key": "keyData", "type": "str"}, } - def __init__( - self, - *, - key_data: str, - **kwargs - ): + def __init__(self, *, key_data: str, **kwargs): """ - :keyword key_data: Required. Certificate public key used to authenticate with VMs through SSH. - The certificate must be in PEM format with or without headers. + :keyword key_data: Certificate public key used to authenticate with VMs through SSH. The + certificate must be in PEM format with or without headers. Required. :paramtype key_data: str """ - super(ContainerServiceSshPublicKey, self).__init__(**kwargs) + super().__init__(**kwargs) self.key_data = key_data -class ContainerServiceVMDiagnostics(msrest.serialization.Model): +class ContainerServiceVMDiagnostics(_serialization.Model): """Profile for diagnostics on the container service VMs. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar enabled: Required. Whether the VM diagnostic agent is provisioned on the VM. + :ivar enabled: Whether the VM diagnostic agent is provisioned on the VM. Required. :vartype enabled: bool :ivar storage_uri: The URI of the storage account where diagnostics are stored. :vartype storage_uri: str """ _validation = { - 'enabled': {'required': True}, - 'storage_uri': {'readonly': True}, + "enabled": {"required": True}, + "storage_uri": {"readonly": True}, } _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'storage_uri': {'key': 'storageUri', 'type': 'str'}, + "enabled": {"key": "enabled", "type": "bool"}, + "storage_uri": {"key": "storageUri", "type": "str"}, } - def __init__( - self, - *, - enabled: bool, - **kwargs - ): + def __init__(self, *, enabled: bool, **kwargs): """ - :keyword enabled: Required. Whether the VM diagnostic agent is provisioned on the VM. + :keyword enabled: Whether the VM diagnostic agent is provisioned on the VM. Required. :paramtype enabled: bool """ - super(ContainerServiceVMDiagnostics, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.storage_uri = None -class ContainerServiceWindowsProfile(msrest.serialization.Model): +class ContainerServiceWindowsProfile(_serialization.Model): """Profile for Windows VMs in the container service cluster. All required parameters must be populated in order to send to Azure. - :ivar admin_username: Required. The administrator username to use for Windows VMs. + :ivar admin_username: The administrator username to use for Windows VMs. Required. :vartype admin_username: str - :ivar admin_password: Required. The administrator password to use for Windows VMs. + :ivar admin_password: The administrator password to use for Windows VMs. Required. :vartype admin_password: str """ _validation = { - 'admin_username': {'required': True, 'pattern': r'^[a-zA-Z0-9]+([._]?[a-zA-Z0-9]+)*$'}, - 'admin_password': {'required': True, 'pattern': r'^(?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$%\^&\*\(\)])[a-zA-Z\d!@#$%\^&\*\(\)]{12,123}$'}, + "admin_username": {"required": True, "pattern": r"^[a-zA-Z0-9]+([._]?[a-zA-Z0-9]+)*$"}, + "admin_password": { + "required": True, + "pattern": r"^(?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$%\^&\*\(\)])[a-zA-Z\d!@#$%\^&\*\(\)]{12,123}$", + }, } _attribute_map = { - 'admin_username': {'key': 'adminUsername', 'type': 'str'}, - 'admin_password': {'key': 'adminPassword', 'type': 'str'}, + "admin_username": {"key": "adminUsername", "type": "str"}, + "admin_password": {"key": "adminPassword", "type": "str"}, } - def __init__( - self, - *, - admin_username: str, - admin_password: str, - **kwargs - ): + def __init__(self, *, admin_username: str, admin_password: str, **kwargs): """ - :keyword admin_username: Required. The administrator username to use for Windows VMs. + :keyword admin_username: The administrator username to use for Windows VMs. Required. :paramtype admin_username: str - :keyword admin_password: Required. The administrator password to use for Windows VMs. + :keyword admin_password: The administrator password to use for Windows VMs. Required. :paramtype admin_password: str """ - super(ContainerServiceWindowsProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.admin_username = admin_username self.admin_password = admin_password -class CredentialResult(msrest.serialization.Model): +class CredentialResult(_serialization.Model): """The credential result response. Variables are only populated by the server, and will be ignored when sending a request. @@ -490,31 +462,27 @@ class CredentialResult(msrest.serialization.Model): :ivar name: The name of the credential. :vartype name: str :ivar value: Base64-encoded Kubernetes configuration file. - :vartype value: bytearray + :vartype value: bytes """ _validation = { - 'name': {'readonly': True}, - 'value': {'readonly': True}, + "name": {"readonly": True}, + "value": {"readonly": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'bytearray'}, + "name": {"key": "name", "type": "str"}, + "value": {"key": "value", "type": "bytearray"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(CredentialResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.name = None self.value = None -class CredentialResults(msrest.serialization.Model): +class CredentialResults(_serialization.Model): """The list of credential result response. Variables are only populated by the server, and will be ignored when sending a request. @@ -524,24 +492,20 @@ class CredentialResults(msrest.serialization.Model): """ _validation = { - 'kubeconfigs': {'readonly': True}, + "kubeconfigs": {"readonly": True}, } _attribute_map = { - 'kubeconfigs': {'key': 'kubeconfigs', 'type': '[CredentialResult]'}, + "kubeconfigs": {"key": "kubeconfigs", "type": "[CredentialResult]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(CredentialResults, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.kubeconfigs = None -class Resource(msrest.serialization.Model): +class Resource(_serialization.Model): """The Resource model definition. Variables are only populated by the server, and will be ignored when sending a request. @@ -554,41 +518,35 @@ class Resource(msrest.serialization.Model): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] """ - super(Resource, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -596,7 +554,7 @@ def __init__( self.tags = tags -class ManagedCluster(Resource): +class ManagedCluster(Resource): # pylint: disable=too-many-instance-attributes """Managed cluster. Variables are only populated by the server, and will be ignored when sending a request. @@ -609,9 +567,9 @@ class ManagedCluster(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar provisioning_state: The current deployment or provisioning state, which only appears in the response. @@ -648,33 +606,36 @@ class ManagedCluster(Resource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'provisioning_state': {'readonly': True}, - 'fqdn': {'readonly': True}, - 'node_resource_group': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, + "provisioning_state": {"readonly": True}, + "fqdn": {"readonly": True}, + "node_resource_group": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'kubernetes_version': {'key': 'properties.kubernetesVersion', 'type': 'str'}, - 'dns_prefix': {'key': 'properties.dnsPrefix', 'type': 'str'}, - 'fqdn': {'key': 'properties.fqdn', 'type': 'str'}, - 'agent_pool_profiles': {'key': 'properties.agentPoolProfiles', 'type': '[ManagedClusterAgentPoolProfile]'}, - 'linux_profile': {'key': 'properties.linuxProfile', 'type': 'ContainerServiceLinuxProfile'}, - 'service_principal_profile': {'key': 'properties.servicePrincipalProfile', 'type': 'ManagedClusterServicePrincipalProfile'}, - 'addon_profiles': {'key': 'properties.addonProfiles', 'type': '{ManagedClusterAddonProfile}'}, - 'node_resource_group': {'key': 'properties.nodeResourceGroup', 'type': 'str'}, - 'enable_rbac': {'key': 'properties.enableRBAC', 'type': 'bool'}, - 'network_profile': {'key': 'properties.networkProfile', 'type': 'ContainerServiceNetworkProfile'}, - 'aad_profile': {'key': 'properties.aadProfile', 'type': 'ManagedClusterAADProfile'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "dns_prefix": {"key": "properties.dnsPrefix", "type": "str"}, + "fqdn": {"key": "properties.fqdn", "type": "str"}, + "agent_pool_profiles": {"key": "properties.agentPoolProfiles", "type": "[ManagedClusterAgentPoolProfile]"}, + "linux_profile": {"key": "properties.linuxProfile", "type": "ContainerServiceLinuxProfile"}, + "service_principal_profile": { + "key": "properties.servicePrincipalProfile", + "type": "ManagedClusterServicePrincipalProfile", + }, + "addon_profiles": {"key": "properties.addonProfiles", "type": "{ManagedClusterAddonProfile}"}, + "node_resource_group": {"key": "properties.nodeResourceGroup", "type": "str"}, + "enable_rbac": {"key": "properties.enableRBAC", "type": "bool"}, + "network_profile": {"key": "properties.networkProfile", "type": "ContainerServiceNetworkProfile"}, + "aad_profile": {"key": "properties.aadProfile", "type": "ManagedClusterAADProfile"}, } def __init__( @@ -694,9 +655,9 @@ def __init__( **kwargs ): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword kubernetes_version: Version of Kubernetes specified when creating the managed cluster. :paramtype kubernetes_version: str @@ -725,7 +686,7 @@ def __init__( :paramtype aad_profile: ~azure.mgmt.containerservice.v2018_03_31.models.ManagedClusterAADProfile """ - super(ManagedCluster, self).__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.provisioning_state = None self.kubernetes_version = kubernetes_version self.dns_prefix = dns_prefix @@ -740,14 +701,14 @@ def __init__( self.aad_profile = aad_profile -class ManagedClusterAADProfile(msrest.serialization.Model): +class ManagedClusterAADProfile(_serialization.Model): """AADProfile specifies attributes for Azure Active Directory integration. All required parameters must be populated in order to send to Azure. - :ivar client_app_id: Required. The client AAD application ID. + :ivar client_app_id: The client AAD application ID. Required. :vartype client_app_id: str - :ivar server_app_id: Required. The server AAD application ID. + :ivar server_app_id: The server AAD application ID. Required. :vartype server_app_id: str :ivar server_app_secret: The server AAD application secret. :vartype server_app_secret: str @@ -757,15 +718,15 @@ class ManagedClusterAADProfile(msrest.serialization.Model): """ _validation = { - 'client_app_id': {'required': True}, - 'server_app_id': {'required': True}, + "client_app_id": {"required": True}, + "server_app_id": {"required": True}, } _attribute_map = { - 'client_app_id': {'key': 'clientAppID', 'type': 'str'}, - 'server_app_id': {'key': 'serverAppID', 'type': 'str'}, - 'server_app_secret': {'key': 'serverAppSecret', 'type': 'str'}, - 'tenant_id': {'key': 'tenantID', 'type': 'str'}, + "client_app_id": {"key": "clientAppID", "type": "str"}, + "server_app_id": {"key": "serverAppID", "type": "str"}, + "server_app_secret": {"key": "serverAppSecret", "type": "str"}, + "tenant_id": {"key": "tenantID", "type": "str"}, } def __init__( @@ -778,9 +739,9 @@ def __init__( **kwargs ): """ - :keyword client_app_id: Required. The client AAD application ID. + :keyword client_app_id: The client AAD application ID. Required. :paramtype client_app_id: str - :keyword server_app_id: Required. The server AAD application ID. + :keyword server_app_id: The server AAD application ID. Required. :paramtype server_app_id: str :keyword server_app_secret: The server AAD application secret. :paramtype server_app_secret: str @@ -788,7 +749,7 @@ def __init__( tenant of the deployment subscription. :paramtype tenant_id: str """ - super(ManagedClusterAADProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.client_app_id = client_app_id self.server_app_id = server_app_id self.server_app_secret = server_app_secret @@ -808,102 +769,91 @@ class ManagedClusterAccessProfile(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar kube_config: Base64-encoded Kubernetes configuration file. - :vartype kube_config: bytearray + :vartype kube_config: bytes """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'kube_config': {'key': 'properties.kubeConfig', 'type': 'bytearray'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "kube_config": {"key": "properties.kubeConfig", "type": "bytearray"}, } def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - kube_config: Optional[bytearray] = None, - **kwargs + self, *, location: str, tags: Optional[Dict[str, str]] = None, kube_config: Optional[bytes] = None, **kwargs ): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword kube_config: Base64-encoded Kubernetes configuration file. - :paramtype kube_config: bytearray + :paramtype kube_config: bytes """ - super(ManagedClusterAccessProfile, self).__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.kube_config = kube_config -class ManagedClusterAddonProfile(msrest.serialization.Model): +class ManagedClusterAddonProfile(_serialization.Model): """A Kubernetes add-on profile for a managed cluster. All required parameters must be populated in order to send to Azure. - :ivar enabled: Required. Whether the add-on is enabled or not. + :ivar enabled: Whether the add-on is enabled or not. Required. :vartype enabled: bool :ivar config: Key-value pairs for configuring an add-on. :vartype config: dict[str, str] """ _validation = { - 'enabled': {'required': True}, + "enabled": {"required": True}, } _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'config': {'key': 'config', 'type': '{str}'}, + "enabled": {"key": "enabled", "type": "bool"}, + "config": {"key": "config", "type": "{str}"}, } - def __init__( - self, - *, - enabled: bool, - config: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, enabled: bool, config: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword enabled: Required. Whether the add-on is enabled or not. + :keyword enabled: Whether the add-on is enabled or not. Required. :paramtype enabled: bool :keyword config: Key-value pairs for configuring an add-on. :paramtype config: dict[str, str] """ - super(ManagedClusterAddonProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.config = config -class ManagedClusterAgentPoolProfile(msrest.serialization.Model): +class ManagedClusterAgentPoolProfile(_serialization.Model): """Profile for the container service agent pool. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar name: Required. Unique name of the agent pool profile in the context of the subscription - and resource group. + :ivar name: Unique name of the agent pool profile in the context of the subscription and + resource group. Required. :vartype name: str :ivar count: Number of agents (VMs) to host docker containers. Allowed values must be in the range of 1 to 100 (inclusive). The default value is 1. :vartype count: int - :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + :ivar vm_size: Size of agent VMs. Required. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -940,7 +890,7 @@ class ManagedClusterAgentPoolProfile(msrest.serialization.Model): "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :vartype vm_size: str or ~azure.mgmt.containerservice.v2018_03_31.models.ContainerServiceVMSizeTypes :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine @@ -948,7 +898,7 @@ class ManagedClusterAgentPoolProfile(msrest.serialization.Model): the vmSize specified. :vartype os_disk_size_gb: int :ivar storage_profile: Storage profile specifies what kind of storage used. Defaults to - ManagedDisks. Known values are: "StorageAccount", "ManagedDisks". + ManagedDisks. Known values are: "StorageAccount" and "ManagedDisks". :vartype storage_profile: str or ~azure.mgmt.containerservice.v2018_03_31.models.ContainerServiceStorageProfileTypes :ivar vnet_subnet_id: VNet SubnetID specifies the VNet's subnet identifier. @@ -956,27 +906,27 @@ class ManagedClusterAgentPoolProfile(msrest.serialization.Model): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Known values are: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux" and "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2018_03_31.models.OSType """ _validation = { - 'name': {'required': True, 'pattern': r'^[a-z][a-z0-9]{0,11}$'}, - 'count': {'maximum': 100, 'minimum': 1}, - 'vm_size': {'required': True}, - 'os_disk_size_gb': {'maximum': 1023, 'minimum': 0}, - 'storage_profile': {'readonly': True}, + "name": {"required": True, "pattern": r"^[a-z][a-z0-9]{0,11}$"}, + "count": {"maximum": 100, "minimum": 1}, + "vm_size": {"required": True}, + "os_disk_size_gb": {"maximum": 1023, "minimum": 0}, + "storage_profile": {"readonly": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'count': {'key': 'count', 'type': 'int'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'storage_profile': {'key': 'storageProfile', 'type': 'str'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'maxPods', 'type': 'int'}, - 'os_type': {'key': 'osType', 'type': 'str'}, + "name": {"key": "name", "type": "str"}, + "count": {"key": "count", "type": "int"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "storage_profile": {"key": "storageProfile", "type": "str"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "max_pods": {"key": "maxPods", "type": "int"}, + "os_type": {"key": "osType", "type": "str"}, } def __init__( @@ -984,21 +934,21 @@ def __init__( *, name: str, vm_size: Union[str, "_models.ContainerServiceVMSizeTypes"], - count: Optional[int] = 1, + count: int = 1, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", **kwargs ): """ - :keyword name: Required. Unique name of the agent pool profile in the context of the - subscription and resource group. + :keyword name: Unique name of the agent pool profile in the context of the subscription and + resource group. Required. :paramtype name: str :keyword count: Number of agents (VMs) to host docker containers. Allowed values must be in the range of 1 to 100 (inclusive). The default value is 1. :paramtype count: int - :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + :keyword vm_size: Size of agent VMs. Required. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -1035,7 +985,7 @@ def __init__( "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :paramtype vm_size: str or ~azure.mgmt.containerservice.v2018_03_31.models.ContainerServiceVMSizeTypes :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every @@ -1047,10 +997,10 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux" and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2018_03_31.models.OSType """ - super(ManagedClusterAgentPoolProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.count = count self.vm_size = vm_size @@ -1061,7 +1011,7 @@ def __init__( self.os_type = os_type -class ManagedClusterListResult(msrest.serialization.Model): +class ManagedClusterListResult(_serialization.Model): """The response from the List Managed Clusters operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -1073,55 +1023,50 @@ class ManagedClusterListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[ManagedCluster]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[ManagedCluster]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.ManagedCluster"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.ManagedCluster"]] = None, **kwargs): """ :keyword value: The list of managed clusters. :paramtype value: list[~azure.mgmt.containerservice.v2018_03_31.models.ManagedCluster] """ - super(ManagedClusterListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): +class ManagedClusterPoolUpgradeProfile(_serialization.Model): """The list of available upgrade versions. All required parameters must be populated in order to send to Azure. - :ivar kubernetes_version: Required. Kubernetes version (major, minor, patch). + :ivar kubernetes_version: Kubernetes version (major, minor, patch). Required. :vartype kubernetes_version: str :ivar name: Pool name. :vartype name: str - :ivar os_type: Required. OsType to be used to specify os type. Choose from Linux and Windows. - Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to + Linux. Known values are: "Linux" and "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2018_03_31.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: list[str] """ _validation = { - 'kubernetes_version': {'required': True}, - 'os_type': {'required': True}, + "kubernetes_version": {"required": True}, + "os_type": {"required": True}, } _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'upgrades': {'key': 'upgrades', 'type': '[str]'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "os_type": {"key": "osType", "type": "str"}, + "upgrades": {"key": "upgrades", "type": "[str]"}, } def __init__( @@ -1134,62 +1079,56 @@ def __init__( **kwargs ): """ - :keyword kubernetes_version: Required. Kubernetes version (major, minor, patch). + :keyword kubernetes_version: Kubernetes version (major, minor, patch). Required. :paramtype kubernetes_version: str :keyword name: Pool name. :paramtype name: str - :keyword os_type: Required. OsType to be used to specify os type. Choose from Linux and - Windows. Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default + to Linux. Known values are: "Linux" and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2018_03_31.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: list[str] """ - super(ManagedClusterPoolUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.name = name self.os_type = os_type self.upgrades = upgrades -class ManagedClusterServicePrincipalProfile(msrest.serialization.Model): +class ManagedClusterServicePrincipalProfile(_serialization.Model): """Information about a service principal identity for the cluster to use for manipulating Azure APIs. All required parameters must be populated in order to send to Azure. - :ivar client_id: Required. The ID for the service principal. + :ivar client_id: The ID for the service principal. Required. :vartype client_id: str :ivar secret: The secret password associated with the service principal in plain text. :vartype secret: str """ _validation = { - 'client_id': {'required': True}, + "client_id": {"required": True}, } _attribute_map = { - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'secret': {'key': 'secret', 'type': 'str'}, + "client_id": {"key": "clientId", "type": "str"}, + "secret": {"key": "secret", "type": "str"}, } - def __init__( - self, - *, - client_id: str, - secret: Optional[str] = None, - **kwargs - ): + def __init__(self, *, client_id: str, secret: Optional[str] = None, **kwargs): """ - :keyword client_id: Required. The ID for the service principal. + :keyword client_id: The ID for the service principal. Required. :paramtype client_id: str :keyword secret: The secret password associated with the service principal in plain text. :paramtype secret: str """ - super(ManagedClusterServicePrincipalProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.client_id = client_id self.secret = secret -class ManagedClusterUpgradeProfile(msrest.serialization.Model): +class ManagedClusterUpgradeProfile(_serialization.Model): """The list of available upgrades for compute pools. Variables are only populated by the server, and will be ignored when sending a request. @@ -1202,29 +1141,29 @@ class ManagedClusterUpgradeProfile(msrest.serialization.Model): :vartype name: str :ivar type: Type of upgrade profile. :vartype type: str - :ivar control_plane_profile: Required. The list of available upgrade versions for the control - plane. + :ivar control_plane_profile: The list of available upgrade versions for the control plane. + Required. :vartype control_plane_profile: ~azure.mgmt.containerservice.v2018_03_31.models.ManagedClusterPoolUpgradeProfile - :ivar agent_pool_profiles: Required. The list of available upgrade versions for agent pools. + :ivar agent_pool_profiles: The list of available upgrade versions for agent pools. Required. :vartype agent_pool_profiles: list[~azure.mgmt.containerservice.v2018_03_31.models.ManagedClusterPoolUpgradeProfile] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'control_plane_profile': {'required': True}, - 'agent_pool_profiles': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "control_plane_profile": {"required": True}, + "agent_pool_profiles": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'control_plane_profile': {'key': 'properties.controlPlaneProfile', 'type': 'ManagedClusterPoolUpgradeProfile'}, - 'agent_pool_profiles': {'key': 'properties.agentPoolProfiles', 'type': '[ManagedClusterPoolUpgradeProfile]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "control_plane_profile": {"key": "properties.controlPlaneProfile", "type": "ManagedClusterPoolUpgradeProfile"}, + "agent_pool_profiles": {"key": "properties.agentPoolProfiles", "type": "[ManagedClusterPoolUpgradeProfile]"}, } def __init__( @@ -1235,15 +1174,15 @@ def __init__( **kwargs ): """ - :keyword control_plane_profile: Required. The list of available upgrade versions for the - control plane. + :keyword control_plane_profile: The list of available upgrade versions for the control plane. + Required. :paramtype control_plane_profile: ~azure.mgmt.containerservice.v2018_03_31.models.ManagedClusterPoolUpgradeProfile - :keyword agent_pool_profiles: Required. The list of available upgrade versions for agent pools. + :keyword agent_pool_profiles: The list of available upgrade versions for agent pools. Required. :paramtype agent_pool_profiles: list[~azure.mgmt.containerservice.v2018_03_31.models.ManagedClusterPoolUpgradeProfile] """ - super(ManagedClusterUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -1251,7 +1190,7 @@ def __init__( self.agent_pool_profiles = agent_pool_profiles -class OperationListResult(msrest.serialization.Model): +class OperationListResult(_serialization.Model): """The List Compute Operation operation response. Variables are only populated by the server, and will be ignored when sending a request. @@ -1261,24 +1200,20 @@ class OperationListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[OperationValue]'}, + "value": {"key": "value", "type": "[OperationValue]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(OperationListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None -class OperationValue(msrest.serialization.Model): +class OperationValue(_serialization.Model): """Describes the properties of a Compute Operation value. Variables are only populated by the server, and will be ignored when sending a request. @@ -1298,30 +1233,26 @@ class OperationValue(msrest.serialization.Model): """ _validation = { - 'origin': {'readonly': True}, - 'name': {'readonly': True}, - 'operation': {'readonly': True}, - 'resource': {'readonly': True}, - 'description': {'readonly': True}, - 'provider': {'readonly': True}, + "origin": {"readonly": True}, + "name": {"readonly": True}, + "operation": {"readonly": True}, + "resource": {"readonly": True}, + "description": {"readonly": True}, + "provider": {"readonly": True}, } _attribute_map = { - 'origin': {'key': 'origin', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'operation': {'key': 'display.operation', 'type': 'str'}, - 'resource': {'key': 'display.resource', 'type': 'str'}, - 'description': {'key': 'display.description', 'type': 'str'}, - 'provider': {'key': 'display.provider', 'type': 'str'}, + "origin": {"key": "origin", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "operation": {"key": "display.operation", "type": "str"}, + "resource": {"key": "display.resource", "type": "str"}, + "description": {"key": "display.description", "type": "str"}, + "provider": {"key": "display.provider", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(OperationValue, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.origin = None self.name = None self.operation = None @@ -1330,65 +1261,54 @@ def __init__( self.provider = None -class OrchestratorProfile(msrest.serialization.Model): +class OrchestratorProfile(_serialization.Model): """Contains information about orchestrator. All required parameters must be populated in order to send to Azure. - :ivar orchestrator_type: Required. Orchestrator type. + :ivar orchestrator_type: Orchestrator type. Required. :vartype orchestrator_type: str - :ivar orchestrator_version: Required. Orchestrator version (major, minor, patch). + :ivar orchestrator_version: Orchestrator version (major, minor, patch). Required. :vartype orchestrator_version: str """ _validation = { - 'orchestrator_type': {'required': True}, - 'orchestrator_version': {'required': True}, + "orchestrator_type": {"required": True}, + "orchestrator_version": {"required": True}, } _attribute_map = { - 'orchestrator_type': {'key': 'orchestratorType', 'type': 'str'}, - 'orchestrator_version': {'key': 'orchestratorVersion', 'type': 'str'}, + "orchestrator_type": {"key": "orchestratorType", "type": "str"}, + "orchestrator_version": {"key": "orchestratorVersion", "type": "str"}, } - def __init__( - self, - *, - orchestrator_type: str, - orchestrator_version: str, - **kwargs - ): + def __init__(self, *, orchestrator_type: str, orchestrator_version: str, **kwargs): """ - :keyword orchestrator_type: Required. Orchestrator type. + :keyword orchestrator_type: Orchestrator type. Required. :paramtype orchestrator_type: str - :keyword orchestrator_version: Required. Orchestrator version (major, minor, patch). + :keyword orchestrator_version: Orchestrator version (major, minor, patch). Required. :paramtype orchestrator_version: str """ - super(OrchestratorProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.orchestrator_type = orchestrator_type self.orchestrator_version = orchestrator_version -class TagsObject(msrest.serialization.Model): +class TagsObject(_serialization.Model): """Tags object for patch operations. - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] """ _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] """ - super(TagsObject, self).__init__(**kwargs) + super().__init__(**kwargs) self.tags = tags diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/models/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/models/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/models/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/models/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/operations/__init__.py index 79c2682d6c29..399a909877af 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/operations/__init__.py @@ -12,9 +12,10 @@ from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'Operations', - 'ManagedClustersOperations', + "Operations", + "ManagedClustersOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/operations/_managed_clusters_operations.py index 655274ffd5b0..b2081ed5550d 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/operations/_managed_clusters_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,470 +27,378 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-03-31")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters") + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters" + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_resource_group_request( - subscription_id: str, - resource_group_name: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-03-31")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters", + ) # 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', min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_upgrade_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-03-31")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_access_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, role_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 = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-03-31")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "roleName": _SERIALIZER.url("role_name", role_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "roleName": _SERIALIZER.url("role_name", role_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_admin_credentials_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-03-31")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_user_credentials_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-03-31")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: + +def build_get_request(resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-03-31")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedCluster] = None, - content: Any = None, - **kwargs: Any + +def build_create_or_update_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-03-31")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_update_tags_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.TagsObject] = None, - content: Any = None, - **kwargs: Any + +def build_update_tags_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-03-31")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any +def build_delete_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-03-31")) # type: str # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) -def build_reset_service_principal_profile_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedClusterServicePrincipalProfile] = None, - content: Any = None, - **kwargs: Any +def build_reset_service_principal_profile_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-03-31")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_reset_aad_profile_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedClusterAADProfile] = None, - content: Any = None, - **kwargs: Any +def build_reset_aad_profile_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-03-31")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + class ManagedClustersOperations: """ @@ -506,41 +419,35 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.ManagedClusterListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.ManagedCluster"]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. The operation returns properties of each managed cluster. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2018_03_31.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2018_03_31.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-03-31")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -548,14 +455,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -571,10 +475,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -584,50 +486,42 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> Iterable[_models.ManagedClusterListResult]: + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.ManagedCluster"]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. The operation returns properties of each managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2018_03_31.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2018_03_31.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-03-31")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -635,15 +529,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -659,10 +549,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -672,51 +560,43 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.ManagedClusterUpgradeProfile: """Gets upgrade profile for a managed cluster. Gets the details of the upgrade profile for a managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterUpgradeProfile, or the result of cls(response) + :return: ManagedClusterUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2018_03_31.models.ManagedClusterUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-03-31")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -724,69 +604,60 @@ def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterUpgradeProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore @distributed_trace def get_access_profile( - self, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, role_name: str, **kwargs: Any ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. Gets the accessProfile for the specified role name of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param role_name: The name of the role for managed cluster accessProfile resource. + :param role_name: The name of the role for managed cluster accessProfile resource. Required. :type role_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterAccessProfile, or the result of cls(response) + :return: ManagedClusterAccessProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2018_03_31.models.ManagedClusterAccessProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-03-31")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterAccessProfile] - request = build_get_access_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, role_name=role_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_access_profile.metadata['url'], + template_url=self.get_access_profile.metadata["url"], headers=_headers, params=_params, ) @@ -794,64 +665,56 @@ def get_access_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterAccessProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterAccessProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_access_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore - + get_access_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore @distributed_trace def list_cluster_admin_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster admin credential of a managed cluster. Gets cluster admin credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2018_03_31.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-03-31")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_admin_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_admin_credentials.metadata['url'], + template_url=self.list_cluster_admin_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -859,64 +722,56 @@ def list_cluster_admin_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_admin_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore - + list_cluster_admin_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore @distributed_trace def list_cluster_user_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster user credential of a managed cluster. Gets cluster user credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2018_03_31.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-03-31")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_user_credentials.metadata['url'], + template_url=self.list_cluster_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -924,64 +779,54 @@ def list_cluster_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore - + list_cluster_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore @distributed_trace - def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.ManagedCluster: + def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.ManagedCluster: """Gets a managed cluster. Gets the details of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedCluster, or the result of cls(response) + :return: ManagedCluster or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2018_03_31.models.ManagedCluster - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-03-31")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -989,55 +834,54 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _create_or_update_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.ManagedCluster, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-03-31")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'ManagedCluster') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedCluster") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1045,10 +889,9 @@ def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -1056,25 +899,26 @@ def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - @distributed_trace + @overload def begin_create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedCluster, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. @@ -1082,12 +926,90 @@ def begin_create_or_update( Creates or updates a managed cluster with the specified configuration for agents and Kubernetes version. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2018_03_31.models.ManagedCluster + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2018_03_31.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster with the specified configuration for agents and Kubernetes + version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2018_03_31.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster with the specified configuration for agents and Kubernetes + version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. Is + either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2018_03_31.models.ManagedCluster or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1100,20 +1022,17 @@ def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2018_03_31.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-03-31")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -1121,69 +1040,66 @@ def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _update_tags_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.TagsObject, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-03-31")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request_initial( - subscription_id=self._config.subscription_id, + request = build_update_tags_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_tags_initial.metadata['url'], + content=_content, + template_url=self._update_tags_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1191,44 +1107,47 @@ def _update_tags_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_tags_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _update_tags_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - @distributed_trace + @overload def begin_update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates a managed cluster with the specified tags. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2018_03_31.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1241,20 +1160,88 @@ def begin_update_tags( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2018_03_31.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates a managed cluster with the specified tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2018_03_31.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates a managed cluster with the specified tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2018_03_31.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2018_03_31.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-03-31")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, @@ -1262,64 +1249,54 @@ def begin_update_tags( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-03-31")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1327,10 +1304,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1340,23 +1316,17 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> LROPoller[None]: + def begin_delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> LROPoller[None]: """Deletes a managed cluster. Deletes the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1368,85 +1338,83 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-03-31")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterServicePrincipalProfile, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-03-31")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterServicePrincipalProfile") - request = build_reset_service_principal_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_service_principal_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_service_principal_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_service_principal_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1454,10 +1422,9 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1467,29 +1434,33 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re if cls: return cls(pipeline_response, None, {}) - _reset_service_principal_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore - + _reset_service_principal_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore - @distributed_trace - def begin_reset_service_principal_profile( # pylint: disable=inconsistent-return-statements + @overload + def begin_reset_service_principal_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterServicePrincipalProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: """Reset Service Principal Profile of a managed cluster. Update the service principal Profile for a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a - Managed Cluster. + Managed Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2018_03_31.models.ManagedClusterServicePrincipalProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1500,20 +1471,90 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reset Service Principal Profile of a managed cluster. + + Update the service principal Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a + Managed Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Reset Service Principal Profile of a managed cluster. + + Update the service principal Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a + Managed Cluster. Is either a model type or a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2018_03_31.models.ManagedClusterServicePrincipalProfile or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-03-31")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1521,67 +1562,68 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_service_principal_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + begin_reset_service_principal_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterAADProfile, + parameters: Union[_models.ManagedClusterAADProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-03-31")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterAADProfile") - request = build_reset_aad_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_aad_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_aad_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_aad_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1589,10 +1631,9 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1602,28 +1643,32 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement if cls: return cls(pipeline_response, None, {}) - _reset_aad_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - + _reset_aad_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - @distributed_trace - def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements + @overload + def begin_reset_aad_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterAADProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: """Reset AAD Profile of a managed cluster. Update the AAD Profile for a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed - Cluster. + Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2018_03_31.models.ManagedClusterAADProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1634,20 +1679,90 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reset AAD Profile of a managed cluster. + + Update the AAD Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed + Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterAADProfile, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Reset AAD Profile of a managed cluster. + + Update the AAD Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed + Cluster. Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2018_03_31.models.ManagedClusterAADProfile or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-03-31")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1655,34 +1770,30 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_aad_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + begin_reset_aad_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/operations/_operations.py index 7241fae07e66..07bfeb25de23 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/operations/_operations.py @@ -7,10 +7,15 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,38 +25,34 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - **kwargs: Any -) -> HttpRequest: + +def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-03-31")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.ContainerService/operations") # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class Operations: """ @@ -72,36 +73,31 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.OperationListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.OperationValue"]: """Gets a list of compute operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationListResult or the result of cls(response) + :return: An iterator like instance of either OperationValue or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2018_03_31.models.OperationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2018_03_31.models.OperationValue] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-03-31")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -109,13 +105,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -131,10 +125,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -144,8 +136,6 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.ContainerService/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ContainerService/operations"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/operations/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/__init__.py index 37a5f9e02e6f..a8716d29afe8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/__init__.py @@ -14,7 +14,8 @@ except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['ContainerServiceClient'] + +__all__ = ["ContainerServiceClient"] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/_configuration.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/_configuration.py index c47508ea1d20..55b589213caf 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/_configuration.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/_configuration.py @@ -18,30 +18,26 @@ VERSION = "unknown" + class ContainerServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ContainerServiceClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2018-08-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: + def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ContainerServiceClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2018-08-01-preview") # type: str + api_version = kwargs.pop("api_version", "2018-08-01-preview") # type: str if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -51,23 +47,24 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-containerservice/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-containerservice/{}".format(VERSION)) self._configure(**kwargs) def _configure( - self, - **kwargs # type: Any + self, **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/_container_service_client.py index 03a23e2a1d1b..d2e78e6d79c3 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/_container_service_client.py @@ -9,12 +9,11 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from . import models +from .._serialization import Deserializer, Serializer from ._configuration import ContainerServiceClientConfiguration from .operations import ManagedClustersOperations, Operations @@ -22,7 +21,8 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class ContainerServiceClient: + +class ContainerServiceClient: # pylint: disable=client-accepts-api-version-keyword """The Container Service Client. :ivar operations: Operations operations @@ -30,10 +30,10 @@ class ContainerServiceClient: :ivar managed_clusters: ManagedClustersOperations operations :vartype managed_clusters: azure.mgmt.containerservice.v2018_08_01_preview.operations.ManagedClustersOperations - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -51,26 +51,21 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = ContainerServiceClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = ContainerServiceClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize - ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.managed_clusters = ManagedClustersOperations( self._client, self._config, self._serialize, self._deserialize ) - - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> HttpResponse: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -79,7 +74,7 @@ def _send_request( >>> response = client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/_metadata.json b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/_metadata.json index c833c5b4542c..3bb8dbb65b32 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/_metadata.json +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/_metadata.json @@ -10,20 +10,20 @@ "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { "credential": { - "signature": "credential, # type: \"TokenCredential\"", - "description": "Credential needed for the client to connect to Azure.", + "signature": "credential: \"TokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true }, "subscription_id": { - "signature": "subscription_id, # type: str", - "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "signature": "subscription_id: str,", + "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.", "docstring_type": "str", "required": true } @@ -31,13 +31,13 @@ "async": { "credential": { "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure.", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { "signature": "subscription_id: str,", - "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.", "docstring_type": "str", "required": true } @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=\"https://management.azure.com\", # type: str", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/_patch.py index 74e48ecd07cf..f99e77fef986 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/_patch.py @@ -28,4 +28,4 @@ # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + pass diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/_vendor.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/_vendor.py index 138f663c53a4..9aad73fc743e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/_vendor.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/_vendor.py @@ -7,6 +7,7 @@ from azure.core.pipeline.transport import HttpRequest + def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) @@ -14,6 +15,7 @@ def _convert_request(request, files=None): request.set_formdata_body(files) return request + def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -21,7 +23,5 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [ - c for c in formatted_components if "{}".format(key.args[0]) not in c - ] + components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/aio/__init__.py index 37a5f9e02e6f..a8716d29afe8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/aio/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/aio/__init__.py @@ -14,7 +14,8 @@ except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['ContainerServiceClient'] + +__all__ = ["ContainerServiceClient"] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/aio/_configuration.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/aio/_configuration.py index c764615eebae..fc08dcc9189a 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/aio/_configuration.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/aio/_configuration.py @@ -18,30 +18,26 @@ VERSION = "unknown" + class ContainerServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ContainerServiceClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2018-08-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: + def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ContainerServiceClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2018-08-01-preview") # type: str + api_version = kwargs.pop("api_version", "2018-08-01-preview") # type: str if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -51,22 +47,21 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-containerservice/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-containerservice/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, - **kwargs: Any - ) -> None: - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/aio/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/aio/_container_service_client.py index b1847fb3580c..5567065b60c4 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/aio/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/aio/_container_service_client.py @@ -9,12 +9,11 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from .. import models +from ..._serialization import Deserializer, Serializer from ._configuration import ContainerServiceClientConfiguration from .operations import ManagedClustersOperations, Operations @@ -22,7 +21,8 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class ContainerServiceClient: + +class ContainerServiceClient: # pylint: disable=client-accepts-api-version-keyword """The Container Service Client. :ivar operations: Operations operations @@ -30,10 +30,10 @@ class ContainerServiceClient: :ivar managed_clusters: ManagedClustersOperations operations :vartype managed_clusters: azure.mgmt.containerservice.v2018_08_01_preview.aio.operations.ManagedClustersOperations - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -51,26 +51,21 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = ContainerServiceClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = ContainerServiceClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize - ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.managed_clusters = ManagedClustersOperations( self._client, self._config, self._serialize, self._deserialize ) - - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -79,7 +74,7 @@ def _send_request( >>> response = await client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/aio/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/aio/_patch.py index 74e48ecd07cf..f99e77fef986 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/aio/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/aio/_patch.py @@ -28,4 +28,4 @@ # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + pass diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/aio/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/aio/operations/__init__.py index 79c2682d6c29..399a909877af 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/aio/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/aio/operations/__init__.py @@ -12,9 +12,10 @@ from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'Operations', - 'ManagedClustersOperations', + "Operations", + "ManagedClustersOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/aio/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/aio/operations/_managed_clusters_operations.py index 6b9326e28968..79f0c04b1013 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/aio/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/aio/operations/_managed_clusters_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +29,25 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._managed_clusters_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_access_profile_request, build_get_request, build_get_upgrade_profile_request, build_list_by_resource_group_request, build_list_cluster_admin_credentials_request, build_list_cluster_user_credentials_request, build_list_request, build_reset_aad_profile_request_initial, build_reset_service_principal_profile_request_initial, build_update_tags_request_initial -T = TypeVar('T') +from ...operations._managed_clusters_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_access_profile_request, + build_get_request, + build_get_upgrade_profile_request, + build_list_by_resource_group_request, + build_list_cluster_admin_credentials_request, + build_list_cluster_user_credentials_request, + build_list_request, + build_reset_aad_profile_request, + build_reset_service_principal_profile_request, + build_update_tags_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class ManagedClustersOperations: """ .. warning:: @@ -45,41 +67,35 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.ManagedClusterListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.ManagedCluster"]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. The operation returns properties of each managed cluster. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2018_08_01_preview.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2018_08_01_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-08-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -87,14 +103,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -110,10 +123,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -123,50 +134,44 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.ManagedClusterListResult]: + self, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ManagedCluster"]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. The operation returns properties of each managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2018_08_01_preview.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2018_08_01_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-08-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -174,15 +179,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -198,10 +199,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -211,51 +210,43 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace_async async def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.ManagedClusterUpgradeProfile: """Gets upgrade profile for a managed cluster. Gets the details of the upgrade profile for a managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterUpgradeProfile, or the result of cls(response) + :return: ManagedClusterUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2018_08_01_preview.models.ManagedClusterUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-08-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -263,69 +254,60 @@ async def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterUpgradeProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore @distributed_trace_async async def get_access_profile( - self, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, role_name: str, **kwargs: Any ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. Gets the accessProfile for the specified role name of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param role_name: The name of the role for managed cluster accessProfile resource. + :param role_name: The name of the role for managed cluster accessProfile resource. Required. :type role_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterAccessProfile, or the result of cls(response) + :return: ManagedClusterAccessProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2018_08_01_preview.models.ManagedClusterAccessProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-08-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterAccessProfile] - request = build_get_access_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, role_name=role_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_access_profile.metadata['url'], + template_url=self.get_access_profile.metadata["url"], headers=_headers, params=_params, ) @@ -333,64 +315,56 @@ async def get_access_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterAccessProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterAccessProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_access_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore - + get_access_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore @distributed_trace_async async def list_cluster_admin_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster admin credential of a managed cluster. Gets cluster admin credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2018_08_01_preview.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-08-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_admin_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_admin_credentials.metadata['url'], + template_url=self.list_cluster_admin_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -398,64 +372,56 @@ async def list_cluster_admin_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_admin_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore - + list_cluster_admin_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore @distributed_trace_async async def list_cluster_user_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster user credential of a managed cluster. Gets cluster user credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2018_08_01_preview.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-08-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_user_credentials.metadata['url'], + template_url=self.list_cluster_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -463,64 +429,54 @@ async def list_cluster_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore - + list_cluster_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore @distributed_trace_async - async def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.ManagedCluster: + async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.ManagedCluster: """Gets a managed cluster. Gets the details of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedCluster, or the result of cls(response) + :return: ManagedCluster or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2018_08_01_preview.models.ManagedCluster - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-08-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -528,55 +484,54 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _create_or_update_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.ManagedCluster, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-08-01-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'ManagedCluster') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedCluster") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -584,10 +539,9 @@ async def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -595,25 +549,26 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - @distributed_trace_async + @overload async def begin_create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedCluster, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. @@ -621,12 +576,90 @@ async def begin_create_or_update( Creates or updates a managed cluster with the specified configuration for agents and Kubernetes version. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2018_08_01_preview.models.ManagedCluster + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2018_08_01_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster with the specified configuration for agents and Kubernetes + version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2018_08_01_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster with the specified configuration for agents and Kubernetes + version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. Is + either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2018_08_01_preview.models.ManagedCluster or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -639,20 +672,17 @@ async def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2018_08_01_preview.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-08-01-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -660,69 +690,66 @@ async def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _update_tags_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.TagsObject, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-08-01-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request_initial( - subscription_id=self._config.subscription_id, + request = build_update_tags_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_tags_initial.metadata['url'], + content=_content, + template_url=self._update_tags_initial.metadata["url"], headers=_headers, params=_params, ) @@ -730,44 +757,118 @@ async def _update_tags_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_tags_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _update_tags_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - @distributed_trace_async + @overload async def begin_update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates a managed cluster with the specified tags. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2018_08_01_preview.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2018_08_01_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates a managed cluster with the specified tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2018_08_01_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates a managed cluster with the specified tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2018_08_01_preview.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -780,20 +881,17 @@ async def begin_update_tags( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2018_08_01_preview.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-08-01-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, @@ -801,64 +899,54 @@ async def begin_update_tags( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-08-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -866,10 +954,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -879,23 +966,17 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: + async def begin_delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Deletes a managed cluster. Deletes the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -907,85 +988,83 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-08-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterServicePrincipalProfile, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-08-01-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterServicePrincipalProfile") - request = build_reset_service_principal_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_service_principal_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_service_principal_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_service_principal_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -993,10 +1072,9 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1006,29 +1084,107 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist if cls: return cls(pipeline_response, None, {}) - _reset_service_principal_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + _reset_service_principal_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + + @overload + async def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.ManagedClusterServicePrincipalProfile, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset Service Principal Profile of a managed cluster. + + Update the service principal Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a + Managed Cluster. Required. + :type parameters: + ~azure.mgmt.containerservice.v2018_08_01_preview.models.ManagedClusterServicePrincipalProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset Service Principal Profile of a managed cluster. + + Update the service principal Profile for a managed cluster. + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a + Managed Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async - async def begin_reset_service_principal_profile( # pylint: disable=inconsistent-return-statements + async def begin_reset_service_principal_profile( self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterServicePrincipalProfile, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], **kwargs: Any ) -> AsyncLROPoller[None]: """Reset Service Principal Profile of a managed cluster. Update the service principal Profile for a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a - Managed Cluster. + Managed Cluster. Is either a model type or a IO type. Required. :type parameters: ~azure.mgmt.containerservice.v2018_08_01_preview.models.ManagedClusterServicePrincipalProfile + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -1039,20 +1195,17 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-08-01-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1060,67 +1213,68 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_service_principal_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + begin_reset_service_principal_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterAADProfile, + parameters: Union[_models.ManagedClusterAADProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-08-01-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterAADProfile") - request = build_reset_aad_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_aad_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_aad_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_aad_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1128,10 +1282,9 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1141,29 +1294,106 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta if cls: return cls(pipeline_response, None, {}) - _reset_aad_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - + _reset_aad_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - @distributed_trace_async - async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements + @overload + async def begin_reset_aad_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterAADProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: """Reset AAD Profile of a managed cluster. Update the AAD Profile for a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed - Cluster. + Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2018_08_01_preview.models.ManagedClusterAADProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset AAD Profile of a managed cluster. + + Update the AAD Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed + Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterAADProfile, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset AAD Profile of a managed cluster. + + Update the AAD Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed + Cluster. Is either a model type or a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2018_08_01_preview.models.ManagedClusterAADProfile or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -1174,20 +1404,17 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-08-01-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1195,34 +1422,30 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_aad_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + begin_reset_aad_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/aio/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/aio/operations/_operations.py index d2f89a1a0072..a57f2bc9eea9 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/aio/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/aio/operations/_operations.py @@ -7,9 +7,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,9 +27,11 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._operations import build_list_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class Operations: """ .. warning:: @@ -42,36 +51,31 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.OperationListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.OperationValue"]: """Gets a list of compute operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationListResult or the result of cls(response) + :return: An iterator like instance of either OperationValue or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2018_08_01_preview.models.OperationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2018_08_01_preview.models.OperationValue] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-08-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -79,13 +83,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -101,10 +103,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -114,8 +114,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.ContainerService/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ContainerService/operations"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/aio/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/aio/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/aio/operations/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/aio/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/models/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/models/__init__.py index 1ce7f1900a82..1d3c7c3c67fc 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/models/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/models/__init__.py @@ -32,52 +32,50 @@ from ._models_py3 import Resource from ._models_py3 import TagsObject - -from ._container_service_client_enums import ( - AgentPoolType, - ContainerServiceStorageProfileTypes, - ContainerServiceVMSizeTypes, - Count, - NetworkPlugin, - NetworkPolicy, - OSType, -) +from ._container_service_client_enums import AgentPoolType +from ._container_service_client_enums import ContainerServiceStorageProfileTypes +from ._container_service_client_enums import ContainerServiceVMSizeTypes +from ._container_service_client_enums import Count +from ._container_service_client_enums import NetworkPlugin +from ._container_service_client_enums import NetworkPolicy +from ._container_service_client_enums import OSType from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'CloudErrorBody', - 'ContainerServiceDiagnosticsProfile', - 'ContainerServiceLinuxProfile', - 'ContainerServiceMasterProfile', - 'ContainerServiceNetworkProfile', - 'ContainerServiceSshConfiguration', - 'ContainerServiceSshPublicKey', - 'ContainerServiceVMDiagnostics', - 'ContainerServiceWindowsProfile', - 'CredentialResult', - 'CredentialResults', - 'ManagedCluster', - 'ManagedClusterAADProfile', - 'ManagedClusterAccessProfile', - 'ManagedClusterAddonProfile', - 'ManagedClusterAgentPoolProfile', - 'ManagedClusterListResult', - 'ManagedClusterPoolUpgradeProfile', - 'ManagedClusterServicePrincipalProfile', - 'ManagedClusterUpgradeProfile', - 'OperationListResult', - 'OperationValue', - 'OrchestratorProfile', - 'Resource', - 'TagsObject', - 'AgentPoolType', - 'ContainerServiceStorageProfileTypes', - 'ContainerServiceVMSizeTypes', - 'Count', - 'NetworkPlugin', - 'NetworkPolicy', - 'OSType', + "CloudErrorBody", + "ContainerServiceDiagnosticsProfile", + "ContainerServiceLinuxProfile", + "ContainerServiceMasterProfile", + "ContainerServiceNetworkProfile", + "ContainerServiceSshConfiguration", + "ContainerServiceSshPublicKey", + "ContainerServiceVMDiagnostics", + "ContainerServiceWindowsProfile", + "CredentialResult", + "CredentialResults", + "ManagedCluster", + "ManagedClusterAADProfile", + "ManagedClusterAccessProfile", + "ManagedClusterAddonProfile", + "ManagedClusterAgentPoolProfile", + "ManagedClusterListResult", + "ManagedClusterPoolUpgradeProfile", + "ManagedClusterServicePrincipalProfile", + "ManagedClusterUpgradeProfile", + "OperationListResult", + "OperationValue", + "OrchestratorProfile", + "Resource", + "TagsObject", + "AgentPoolType", + "ContainerServiceStorageProfileTypes", + "ContainerServiceVMSizeTypes", + "Count", + "NetworkPlugin", + "NetworkPolicy", + "OSType", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/models/_container_service_client_enums.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/models/_container_service_client_enums.py index e5a5445ed6cb..39c105669351 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/models/_container_service_client_enums.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/models/_container_service_client_enums.py @@ -11,12 +11,12 @@ class AgentPoolType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """AgentPoolType represents types of an agent pool - """ + """AgentPoolType represents types of an agent pool.""" VIRTUAL_MACHINE_SCALE_SETS = "VirtualMachineScaleSets" AVAILABILITY_SET = "AvailabilitySet" + class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the orchestrator choice. @@ -25,9 +25,9 @@ class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEn STORAGE_ACCOUNT = "StorageAccount" MANAGED_DISKS = "ManagedDisks" + class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Size of agent VMs. - """ + """Size of agent VMs.""" STANDARD_A1 = "Standard_A1" STANDARD_A10 = "Standard_A10" @@ -204,6 +204,7 @@ class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): STANDARD_NV24 = "Standard_NV24" STANDARD_NV6 = "Standard_NV6" + class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): """Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, and 5. The default value is 1. @@ -213,22 +214,22 @@ class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): THREE = 3 FIVE = 5 + class NetworkPlugin(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Network plugin used for building Kubernetes network. - """ + """Network plugin used for building Kubernetes network.""" AZURE = "azure" KUBENET = "kubenet" + class NetworkPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Network policy used for building Kubernetes network. - """ + """Network policy used for building Kubernetes network.""" CALICO = "calico" + class OSType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """OsType to be used to specify os type. Choose from Linux and Windows. Default to Linux. - """ + """OsType to be used to specify os type. Choose from Linux and Windows. Default to Linux.""" LINUX = "Linux" WINDOWS = "Windows" diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/models/_models_py3.py index c8a0bdf6f28d..5a40b2de3a50 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/models/_models_py3.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/models/_models_py3.py @@ -1,4 +1,5 @@ # coding=utf-8 +# pylint: disable=too-many-lines # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -8,14 +9,14 @@ from typing import Dict, List, Optional, TYPE_CHECKING, Union -import msrest.serialization +from ... import _serialization if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - import __init__ as _models + from .. import models as _models -class CloudErrorBody(msrest.serialization.Model): +class CloudErrorBody(_serialization.Model): """An error response from the Container service. :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed @@ -32,10 +33,10 @@ class CloudErrorBody(msrest.serialization.Model): """ _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[CloudErrorBody]"}, } def __init__( @@ -61,88 +62,77 @@ def __init__( :paramtype details: list[~azure.mgmt.containerservice.v2018_08_01_preview.models.CloudErrorBody] """ - super(CloudErrorBody, self).__init__(**kwargs) + super().__init__(**kwargs) self.code = code self.message = message self.target = target self.details = details -class ContainerServiceDiagnosticsProfile(msrest.serialization.Model): +class ContainerServiceDiagnosticsProfile(_serialization.Model): """Profile for diagnostics on the container service cluster. All required parameters must be populated in order to send to Azure. - :ivar vm_diagnostics: Required. Profile for diagnostics on the container service VMs. + :ivar vm_diagnostics: Profile for diagnostics on the container service VMs. Required. :vartype vm_diagnostics: ~azure.mgmt.containerservice.v2018_08_01_preview.models.ContainerServiceVMDiagnostics """ _validation = { - 'vm_diagnostics': {'required': True}, + "vm_diagnostics": {"required": True}, } _attribute_map = { - 'vm_diagnostics': {'key': 'vmDiagnostics', 'type': 'ContainerServiceVMDiagnostics'}, + "vm_diagnostics": {"key": "vmDiagnostics", "type": "ContainerServiceVMDiagnostics"}, } - def __init__( - self, - *, - vm_diagnostics: "_models.ContainerServiceVMDiagnostics", - **kwargs - ): + def __init__(self, *, vm_diagnostics: "_models.ContainerServiceVMDiagnostics", **kwargs): """ - :keyword vm_diagnostics: Required. Profile for diagnostics on the container service VMs. + :keyword vm_diagnostics: Profile for diagnostics on the container service VMs. Required. :paramtype vm_diagnostics: ~azure.mgmt.containerservice.v2018_08_01_preview.models.ContainerServiceVMDiagnostics """ - super(ContainerServiceDiagnosticsProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.vm_diagnostics = vm_diagnostics -class ContainerServiceLinuxProfile(msrest.serialization.Model): +class ContainerServiceLinuxProfile(_serialization.Model): """Profile for Linux VMs in the container service cluster. All required parameters must be populated in order to send to Azure. - :ivar admin_username: Required. The administrator username to use for Linux VMs. + :ivar admin_username: The administrator username to use for Linux VMs. Required. :vartype admin_username: str - :ivar ssh: Required. SSH configuration for Linux-based VMs running on Azure. + :ivar ssh: SSH configuration for Linux-based VMs running on Azure. Required. :vartype ssh: ~azure.mgmt.containerservice.v2018_08_01_preview.models.ContainerServiceSshConfiguration """ _validation = { - 'admin_username': {'required': True, 'pattern': r'^[A-Za-z][-A-Za-z0-9_]*$'}, - 'ssh': {'required': True}, + "admin_username": {"required": True, "pattern": r"^[A-Za-z][-A-Za-z0-9_]*$"}, + "ssh": {"required": True}, } _attribute_map = { - 'admin_username': {'key': 'adminUsername', 'type': 'str'}, - 'ssh': {'key': 'ssh', 'type': 'ContainerServiceSshConfiguration'}, + "admin_username": {"key": "adminUsername", "type": "str"}, + "ssh": {"key": "ssh", "type": "ContainerServiceSshConfiguration"}, } - def __init__( - self, - *, - admin_username: str, - ssh: "_models.ContainerServiceSshConfiguration", - **kwargs - ): + def __init__(self, *, admin_username: str, ssh: "_models.ContainerServiceSshConfiguration", **kwargs): """ - :keyword admin_username: Required. The administrator username to use for Linux VMs. + :keyword admin_username: The administrator username to use for Linux VMs. Required. :paramtype admin_username: str - :keyword ssh: Required. SSH configuration for Linux-based VMs running on Azure. + :keyword ssh: SSH configuration for Linux-based VMs running on Azure. Required. :paramtype ssh: ~azure.mgmt.containerservice.v2018_08_01_preview.models.ContainerServiceSshConfiguration """ - super(ContainerServiceLinuxProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.admin_username = admin_username self.ssh = ssh -class ContainerServiceMasterProfile(msrest.serialization.Model): +class ContainerServiceMasterProfile(_serialization.Model): """Profile for the container service master. Variables are only populated by the server, and will be ignored when sending a request. @@ -150,11 +140,11 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar count: Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, - and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". + and 5. The default value is 1. Known values are: 1, 3, and 5. :vartype count: int or ~azure.mgmt.containerservice.v2018_08_01_preview.models.Count - :ivar dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. + :ivar dns_prefix: DNS prefix to be used to create the FQDN for the master pool. Required. :vartype dns_prefix: str - :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + :ivar vm_size: Size of agent VMs. Required. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -191,7 +181,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :vartype vm_size: str or ~azure.mgmt.containerservice.v2018_08_01_preview.models.ContainerServiceVMSizeTypes :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine @@ -205,7 +195,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): :vartype first_consecutive_static_ip: str :ivar storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount" and "ManagedDisks". :vartype storage_profile: str or ~azure.mgmt.containerservice.v2018_08_01_preview.models.ContainerServiceStorageProfileTypes :ivar fqdn: FQDN for the master pool. @@ -213,21 +203,21 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): """ _validation = { - 'dns_prefix': {'required': True}, - 'vm_size': {'required': True}, - 'os_disk_size_gb': {'maximum': 1023, 'minimum': 0}, - 'fqdn': {'readonly': True}, + "dns_prefix": {"required": True}, + "vm_size": {"required": True}, + "os_disk_size_gb": {"maximum": 1023, "minimum": 0}, + "fqdn": {"readonly": True}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'dns_prefix': {'key': 'dnsPrefix', 'type': 'str'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'first_consecutive_static_ip': {'key': 'firstConsecutiveStaticIP', 'type': 'str'}, - 'storage_profile': {'key': 'storageProfile', 'type': 'str'}, - 'fqdn': {'key': 'fqdn', 'type': 'str'}, + "count": {"key": "count", "type": "int"}, + "dns_prefix": {"key": "dnsPrefix", "type": "str"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "first_consecutive_static_ip": {"key": "firstConsecutiveStaticIP", "type": "str"}, + "storage_profile": {"key": "storageProfile", "type": "str"}, + "fqdn": {"key": "fqdn", "type": "str"}, } def __init__( @@ -235,20 +225,20 @@ def __init__( *, dns_prefix: str, vm_size: Union[str, "_models.ContainerServiceVMSizeTypes"], - count: Optional[Union[int, "_models.Count"]] = 1, + count: Union[int, "_models.Count"] = 1, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, - first_consecutive_static_ip: Optional[str] = "10.240.255.5", + first_consecutive_static_ip: str = "10.240.255.5", storage_profile: Optional[Union[str, "_models.ContainerServiceStorageProfileTypes"]] = None, **kwargs ): """ :keyword count: Number of masters (VMs) in the container service cluster. Allowed values are 1, - 3, and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". + 3, and 5. The default value is 1. Known values are: 1, 3, and 5. :paramtype count: int or ~azure.mgmt.containerservice.v2018_08_01_preview.models.Count - :keyword dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. + :keyword dns_prefix: DNS prefix to be used to create the FQDN for the master pool. Required. :paramtype dns_prefix: str - :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + :keyword vm_size: Size of agent VMs. Required. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -285,7 +275,7 @@ def __init__( "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :paramtype vm_size: str or ~azure.mgmt.containerservice.v2018_08_01_preview.models.ContainerServiceVMSizeTypes :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every @@ -299,11 +289,11 @@ def __init__( :paramtype first_consecutive_static_ip: str :keyword storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount" and "ManagedDisks". :paramtype storage_profile: str or ~azure.mgmt.containerservice.v2018_08_01_preview.models.ContainerServiceStorageProfileTypes """ - super(ContainerServiceMasterProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.dns_prefix = dns_prefix self.vm_size = vm_size @@ -314,15 +304,14 @@ def __init__( self.fqdn = None -class ContainerServiceNetworkProfile(msrest.serialization.Model): +class ContainerServiceNetworkProfile(_serialization.Model): """Profile of network configuration. :ivar network_plugin: Network plugin used for building Kubernetes network. Known values are: - "azure", "kubenet". Default value: "kubenet". + "azure" and "kubenet". :vartype network_plugin: str or ~azure.mgmt.containerservice.v2018_08_01_preview.models.NetworkPlugin - :ivar network_policy: Network policy used for building Kubernetes network. Known values are: - "calico". + :ivar network_policy: Network policy used for building Kubernetes network. "calico" :vartype network_policy: str or ~azure.mgmt.containerservice.v2018_08_01_preview.models.NetworkPolicy :ivar pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. @@ -339,39 +328,40 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): """ _validation = { - 'pod_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, - 'service_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, - 'dns_service_ip': {'pattern': r'^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$'}, - 'docker_bridge_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, + "pod_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, + "service_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, + "dns_service_ip": { + "pattern": r"^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$" + }, + "docker_bridge_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, } _attribute_map = { - 'network_plugin': {'key': 'networkPlugin', 'type': 'str'}, - 'network_policy': {'key': 'networkPolicy', 'type': 'str'}, - 'pod_cidr': {'key': 'podCidr', 'type': 'str'}, - 'service_cidr': {'key': 'serviceCidr', 'type': 'str'}, - 'dns_service_ip': {'key': 'dnsServiceIP', 'type': 'str'}, - 'docker_bridge_cidr': {'key': 'dockerBridgeCidr', 'type': 'str'}, + "network_plugin": {"key": "networkPlugin", "type": "str"}, + "network_policy": {"key": "networkPolicy", "type": "str"}, + "pod_cidr": {"key": "podCidr", "type": "str"}, + "service_cidr": {"key": "serviceCidr", "type": "str"}, + "dns_service_ip": {"key": "dnsServiceIP", "type": "str"}, + "docker_bridge_cidr": {"key": "dockerBridgeCidr", "type": "str"}, } def __init__( self, *, - network_plugin: Optional[Union[str, "_models.NetworkPlugin"]] = "kubenet", + network_plugin: Union[str, "_models.NetworkPlugin"] = "kubenet", network_policy: Optional[Union[str, "_models.NetworkPolicy"]] = None, - pod_cidr: Optional[str] = "10.244.0.0/16", - service_cidr: Optional[str] = "10.0.0.0/16", - dns_service_ip: Optional[str] = "10.0.0.10", - docker_bridge_cidr: Optional[str] = "172.17.0.1/16", + pod_cidr: str = "10.244.0.0/16", + service_cidr: str = "10.0.0.0/16", + dns_service_ip: str = "10.0.0.10", + docker_bridge_cidr: str = "172.17.0.1/16", **kwargs ): """ :keyword network_plugin: Network plugin used for building Kubernetes network. Known values are: - "azure", "kubenet". Default value: "kubenet". + "azure" and "kubenet". :paramtype network_plugin: str or ~azure.mgmt.containerservice.v2018_08_01_preview.models.NetworkPlugin - :keyword network_policy: Network policy used for building Kubernetes network. Known values are: - "calico". + :keyword network_policy: Network policy used for building Kubernetes network. "calico" :paramtype network_policy: str or ~azure.mgmt.containerservice.v2018_08_01_preview.models.NetworkPolicy :keyword pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. @@ -386,7 +376,7 @@ def __init__( must not overlap with any Subnet IP ranges or the Kubernetes service address range. :paramtype docker_bridge_cidr: str """ - super(ContainerServiceNetworkProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.network_plugin = network_plugin self.network_policy = network_policy self.pod_cidr = pod_cidr @@ -395,152 +385,134 @@ def __init__( self.docker_bridge_cidr = docker_bridge_cidr -class ContainerServiceSshConfiguration(msrest.serialization.Model): +class ContainerServiceSshConfiguration(_serialization.Model): """SSH configuration for Linux-based VMs running on Azure. All required parameters must be populated in order to send to Azure. - :ivar public_keys: Required. The list of SSH public keys used to authenticate with Linux-based - VMs. Only expect one key specified. + :ivar public_keys: The list of SSH public keys used to authenticate with Linux-based VMs. Only + expect one key specified. Required. :vartype public_keys: list[~azure.mgmt.containerservice.v2018_08_01_preview.models.ContainerServiceSshPublicKey] """ _validation = { - 'public_keys': {'required': True}, + "public_keys": {"required": True}, } _attribute_map = { - 'public_keys': {'key': 'publicKeys', 'type': '[ContainerServiceSshPublicKey]'}, + "public_keys": {"key": "publicKeys", "type": "[ContainerServiceSshPublicKey]"}, } - def __init__( - self, - *, - public_keys: List["_models.ContainerServiceSshPublicKey"], - **kwargs - ): + def __init__(self, *, public_keys: List["_models.ContainerServiceSshPublicKey"], **kwargs): """ - :keyword public_keys: Required. The list of SSH public keys used to authenticate with - Linux-based VMs. Only expect one key specified. + :keyword public_keys: The list of SSH public keys used to authenticate with Linux-based VMs. + Only expect one key specified. Required. :paramtype public_keys: list[~azure.mgmt.containerservice.v2018_08_01_preview.models.ContainerServiceSshPublicKey] """ - super(ContainerServiceSshConfiguration, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_keys = public_keys -class ContainerServiceSshPublicKey(msrest.serialization.Model): +class ContainerServiceSshPublicKey(_serialization.Model): """Contains information about SSH certificate public key data. All required parameters must be populated in order to send to Azure. - :ivar key_data: Required. Certificate public key used to authenticate with VMs through SSH. The - certificate must be in PEM format with or without headers. + :ivar key_data: Certificate public key used to authenticate with VMs through SSH. The + certificate must be in PEM format with or without headers. Required. :vartype key_data: str """ _validation = { - 'key_data': {'required': True}, + "key_data": {"required": True}, } _attribute_map = { - 'key_data': {'key': 'keyData', 'type': 'str'}, + "key_data": {"key": "keyData", "type": "str"}, } - def __init__( - self, - *, - key_data: str, - **kwargs - ): + def __init__(self, *, key_data: str, **kwargs): """ - :keyword key_data: Required. Certificate public key used to authenticate with VMs through SSH. - The certificate must be in PEM format with or without headers. + :keyword key_data: Certificate public key used to authenticate with VMs through SSH. The + certificate must be in PEM format with or without headers. Required. :paramtype key_data: str """ - super(ContainerServiceSshPublicKey, self).__init__(**kwargs) + super().__init__(**kwargs) self.key_data = key_data -class ContainerServiceVMDiagnostics(msrest.serialization.Model): +class ContainerServiceVMDiagnostics(_serialization.Model): """Profile for diagnostics on the container service VMs. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar enabled: Required. Whether the VM diagnostic agent is provisioned on the VM. + :ivar enabled: Whether the VM diagnostic agent is provisioned on the VM. Required. :vartype enabled: bool :ivar storage_uri: The URI of the storage account where diagnostics are stored. :vartype storage_uri: str """ _validation = { - 'enabled': {'required': True}, - 'storage_uri': {'readonly': True}, + "enabled": {"required": True}, + "storage_uri": {"readonly": True}, } _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'storage_uri': {'key': 'storageUri', 'type': 'str'}, + "enabled": {"key": "enabled", "type": "bool"}, + "storage_uri": {"key": "storageUri", "type": "str"}, } - def __init__( - self, - *, - enabled: bool, - **kwargs - ): + def __init__(self, *, enabled: bool, **kwargs): """ - :keyword enabled: Required. Whether the VM diagnostic agent is provisioned on the VM. + :keyword enabled: Whether the VM diagnostic agent is provisioned on the VM. Required. :paramtype enabled: bool """ - super(ContainerServiceVMDiagnostics, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.storage_uri = None -class ContainerServiceWindowsProfile(msrest.serialization.Model): +class ContainerServiceWindowsProfile(_serialization.Model): """Profile for Windows VMs in the container service cluster. All required parameters must be populated in order to send to Azure. - :ivar admin_username: Required. The administrator username to use for Windows VMs. + :ivar admin_username: The administrator username to use for Windows VMs. Required. :vartype admin_username: str - :ivar admin_password: Required. The administrator password to use for Windows VMs. + :ivar admin_password: The administrator password to use for Windows VMs. Required. :vartype admin_password: str """ _validation = { - 'admin_username': {'required': True, 'pattern': r'^[a-zA-Z0-9]+([._]?[a-zA-Z0-9]+)*$'}, - 'admin_password': {'required': True, 'pattern': r'^(?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$%\^&\*\(\)])[a-zA-Z\d!@#$%\^&\*\(\)]{12,123}$'}, + "admin_username": {"required": True, "pattern": r"^[a-zA-Z0-9]+([._]?[a-zA-Z0-9]+)*$"}, + "admin_password": { + "required": True, + "pattern": r"^(?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$%\^&\*\(\)])[a-zA-Z\d!@#$%\^&\*\(\)]{12,123}$", + }, } _attribute_map = { - 'admin_username': {'key': 'adminUsername', 'type': 'str'}, - 'admin_password': {'key': 'adminPassword', 'type': 'str'}, + "admin_username": {"key": "adminUsername", "type": "str"}, + "admin_password": {"key": "adminPassword", "type": "str"}, } - def __init__( - self, - *, - admin_username: str, - admin_password: str, - **kwargs - ): + def __init__(self, *, admin_username: str, admin_password: str, **kwargs): """ - :keyword admin_username: Required. The administrator username to use for Windows VMs. + :keyword admin_username: The administrator username to use for Windows VMs. Required. :paramtype admin_username: str - :keyword admin_password: Required. The administrator password to use for Windows VMs. + :keyword admin_password: The administrator password to use for Windows VMs. Required. :paramtype admin_password: str """ - super(ContainerServiceWindowsProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.admin_username = admin_username self.admin_password = admin_password -class CredentialResult(msrest.serialization.Model): +class CredentialResult(_serialization.Model): """The credential result response. Variables are only populated by the server, and will be ignored when sending a request. @@ -548,31 +520,27 @@ class CredentialResult(msrest.serialization.Model): :ivar name: The name of the credential. :vartype name: str :ivar value: Base64-encoded Kubernetes configuration file. - :vartype value: bytearray + :vartype value: bytes """ _validation = { - 'name': {'readonly': True}, - 'value': {'readonly': True}, + "name": {"readonly": True}, + "value": {"readonly": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'bytearray'}, + "name": {"key": "name", "type": "str"}, + "value": {"key": "value", "type": "bytearray"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(CredentialResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.name = None self.value = None -class CredentialResults(msrest.serialization.Model): +class CredentialResults(_serialization.Model): """The list of credential result response. Variables are only populated by the server, and will be ignored when sending a request. @@ -583,24 +551,20 @@ class CredentialResults(msrest.serialization.Model): """ _validation = { - 'kubeconfigs': {'readonly': True}, + "kubeconfigs": {"readonly": True}, } _attribute_map = { - 'kubeconfigs': {'key': 'kubeconfigs', 'type': '[CredentialResult]'}, + "kubeconfigs": {"key": "kubeconfigs", "type": "[CredentialResult]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(CredentialResults, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.kubeconfigs = None -class Resource(msrest.serialization.Model): +class Resource(_serialization.Model): """The Resource model definition. Variables are only populated by the server, and will be ignored when sending a request. @@ -613,41 +577,35 @@ class Resource(msrest.serialization.Model): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] """ - super(Resource, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -655,7 +613,7 @@ def __init__( self.tags = tags -class ManagedCluster(Resource): +class ManagedCluster(Resource): # pylint: disable=too-many-instance-attributes """Managed cluster. Variables are only populated by the server, and will be ignored when sending a request. @@ -668,9 +626,9 @@ class ManagedCluster(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar provisioning_state: The current deployment or provisioning state, which only appears in the response. @@ -707,33 +665,36 @@ class ManagedCluster(Resource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'provisioning_state': {'readonly': True}, - 'fqdn': {'readonly': True}, - 'node_resource_group': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, + "provisioning_state": {"readonly": True}, + "fqdn": {"readonly": True}, + "node_resource_group": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'kubernetes_version': {'key': 'properties.kubernetesVersion', 'type': 'str'}, - 'dns_prefix': {'key': 'properties.dnsPrefix', 'type': 'str'}, - 'fqdn': {'key': 'properties.fqdn', 'type': 'str'}, - 'agent_pool_profiles': {'key': 'properties.agentPoolProfiles', 'type': '[ManagedClusterAgentPoolProfile]'}, - 'linux_profile': {'key': 'properties.linuxProfile', 'type': 'ContainerServiceLinuxProfile'}, - 'service_principal_profile': {'key': 'properties.servicePrincipalProfile', 'type': 'ManagedClusterServicePrincipalProfile'}, - 'addon_profiles': {'key': 'properties.addonProfiles', 'type': '{ManagedClusterAddonProfile}'}, - 'node_resource_group': {'key': 'properties.nodeResourceGroup', 'type': 'str'}, - 'enable_rbac': {'key': 'properties.enableRBAC', 'type': 'bool'}, - 'network_profile': {'key': 'properties.networkProfile', 'type': 'ContainerServiceNetworkProfile'}, - 'aad_profile': {'key': 'properties.aadProfile', 'type': 'ManagedClusterAADProfile'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "dns_prefix": {"key": "properties.dnsPrefix", "type": "str"}, + "fqdn": {"key": "properties.fqdn", "type": "str"}, + "agent_pool_profiles": {"key": "properties.agentPoolProfiles", "type": "[ManagedClusterAgentPoolProfile]"}, + "linux_profile": {"key": "properties.linuxProfile", "type": "ContainerServiceLinuxProfile"}, + "service_principal_profile": { + "key": "properties.servicePrincipalProfile", + "type": "ManagedClusterServicePrincipalProfile", + }, + "addon_profiles": {"key": "properties.addonProfiles", "type": "{ManagedClusterAddonProfile}"}, + "node_resource_group": {"key": "properties.nodeResourceGroup", "type": "str"}, + "enable_rbac": {"key": "properties.enableRBAC", "type": "bool"}, + "network_profile": {"key": "properties.networkProfile", "type": "ContainerServiceNetworkProfile"}, + "aad_profile": {"key": "properties.aadProfile", "type": "ManagedClusterAADProfile"}, } def __init__( @@ -753,9 +714,9 @@ def __init__( **kwargs ): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword kubernetes_version: Version of Kubernetes specified when creating the managed cluster. :paramtype kubernetes_version: str @@ -783,7 +744,7 @@ def __init__( :paramtype aad_profile: ~azure.mgmt.containerservice.v2018_08_01_preview.models.ManagedClusterAADProfile """ - super(ManagedCluster, self).__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.provisioning_state = None self.kubernetes_version = kubernetes_version self.dns_prefix = dns_prefix @@ -798,14 +759,14 @@ def __init__( self.aad_profile = aad_profile -class ManagedClusterAADProfile(msrest.serialization.Model): +class ManagedClusterAADProfile(_serialization.Model): """AADProfile specifies attributes for Azure Active Directory integration. All required parameters must be populated in order to send to Azure. - :ivar client_app_id: Required. The client AAD application ID. + :ivar client_app_id: The client AAD application ID. Required. :vartype client_app_id: str - :ivar server_app_id: Required. The server AAD application ID. + :ivar server_app_id: The server AAD application ID. Required. :vartype server_app_id: str :ivar server_app_secret: The server AAD application secret. :vartype server_app_secret: str @@ -815,15 +776,15 @@ class ManagedClusterAADProfile(msrest.serialization.Model): """ _validation = { - 'client_app_id': {'required': True}, - 'server_app_id': {'required': True}, + "client_app_id": {"required": True}, + "server_app_id": {"required": True}, } _attribute_map = { - 'client_app_id': {'key': 'clientAppID', 'type': 'str'}, - 'server_app_id': {'key': 'serverAppID', 'type': 'str'}, - 'server_app_secret': {'key': 'serverAppSecret', 'type': 'str'}, - 'tenant_id': {'key': 'tenantID', 'type': 'str'}, + "client_app_id": {"key": "clientAppID", "type": "str"}, + "server_app_id": {"key": "serverAppID", "type": "str"}, + "server_app_secret": {"key": "serverAppSecret", "type": "str"}, + "tenant_id": {"key": "tenantID", "type": "str"}, } def __init__( @@ -836,9 +797,9 @@ def __init__( **kwargs ): """ - :keyword client_app_id: Required. The client AAD application ID. + :keyword client_app_id: The client AAD application ID. Required. :paramtype client_app_id: str - :keyword server_app_id: Required. The server AAD application ID. + :keyword server_app_id: The server AAD application ID. Required. :paramtype server_app_id: str :keyword server_app_secret: The server AAD application secret. :paramtype server_app_secret: str @@ -846,7 +807,7 @@ def __init__( tenant of the deployment subscription. :paramtype tenant_id: str """ - super(ManagedClusterAADProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.client_app_id = client_app_id self.server_app_id = server_app_id self.server_app_secret = server_app_secret @@ -866,100 +827,89 @@ class ManagedClusterAccessProfile(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar kube_config: Base64-encoded Kubernetes configuration file. - :vartype kube_config: bytearray + :vartype kube_config: bytes """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'kube_config': {'key': 'properties.kubeConfig', 'type': 'bytearray'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "kube_config": {"key": "properties.kubeConfig", "type": "bytearray"}, } def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - kube_config: Optional[bytearray] = None, - **kwargs + self, *, location: str, tags: Optional[Dict[str, str]] = None, kube_config: Optional[bytes] = None, **kwargs ): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword kube_config: Base64-encoded Kubernetes configuration file. - :paramtype kube_config: bytearray + :paramtype kube_config: bytes """ - super(ManagedClusterAccessProfile, self).__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.kube_config = kube_config -class ManagedClusterAddonProfile(msrest.serialization.Model): +class ManagedClusterAddonProfile(_serialization.Model): """A Kubernetes add-on profile for a managed cluster. All required parameters must be populated in order to send to Azure. - :ivar enabled: Required. Whether the add-on is enabled or not. + :ivar enabled: Whether the add-on is enabled or not. Required. :vartype enabled: bool :ivar config: Key-value pairs for configuring an add-on. :vartype config: dict[str, str] """ _validation = { - 'enabled': {'required': True}, + "enabled": {"required": True}, } _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'config': {'key': 'config', 'type': '{str}'}, + "enabled": {"key": "enabled", "type": "bool"}, + "config": {"key": "config", "type": "{str}"}, } - def __init__( - self, - *, - enabled: bool, - config: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, enabled: bool, config: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword enabled: Required. Whether the add-on is enabled or not. + :keyword enabled: Whether the add-on is enabled or not. Required. :paramtype enabled: bool :keyword config: Key-value pairs for configuring an add-on. :paramtype config: dict[str, str] """ - super(ManagedClusterAddonProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.config = config -class ManagedClusterAgentPoolProfile(msrest.serialization.Model): +class ManagedClusterAgentPoolProfile(_serialization.Model): # pylint: disable=too-many-instance-attributes """Profile for the container service agent pool. All required parameters must be populated in order to send to Azure. - :ivar name: Required. Unique name of the agent pool profile in the context of the subscription - and resource group. + :ivar name: Unique name of the agent pool profile in the context of the subscription and + resource group. Required. :vartype name: str - :ivar count: Required. Number of agents (VMs) to host docker containers. Allowed values must be - in the range of 1 to 100 (inclusive). The default value is 1. + :ivar count: Number of agents (VMs) to host docker containers. Allowed values must be in the + range of 1 to 100 (inclusive). The default value is 1. :vartype count: int - :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + :ivar vm_size: Size of agent VMs. Required. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -996,7 +946,7 @@ class ManagedClusterAgentPoolProfile(msrest.serialization.Model): "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :vartype vm_size: str or ~azure.mgmt.containerservice.v2018_08_01_preview.models.ContainerServiceVMSizeTypes :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine @@ -1008,7 +958,7 @@ class ManagedClusterAgentPoolProfile(msrest.serialization.Model): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Known values are: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux" and "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2018_08_01_preview.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -1017,29 +967,29 @@ class ManagedClusterAgentPoolProfile(msrest.serialization.Model): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar type: AgentPoolType represents types of an agent pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2018_08_01_preview.models.AgentPoolType """ _validation = { - 'name': {'required': True}, - 'count': {'required': True, 'maximum': 100, 'minimum': 1}, - 'vm_size': {'required': True}, - 'os_disk_size_gb': {'maximum': 1023, 'minimum': 0}, + "name": {"required": True}, + "count": {"required": True, "maximum": 100, "minimum": 1}, + "vm_size": {"required": True}, + "os_disk_size_gb": {"maximum": 1023, "minimum": 0}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'count': {'key': 'count', 'type': 'int'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'maxPods', 'type': 'int'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'max_count': {'key': 'maxCount', 'type': 'int'}, - 'min_count': {'key': 'minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'enableAutoScaling', 'type': 'bool'}, - 'type': {'key': 'type', 'type': 'str'}, + "name": {"key": "name", "type": "str"}, + "count": {"key": "count", "type": "int"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "max_pods": {"key": "maxPods", "type": "int"}, + "os_type": {"key": "osType", "type": "str"}, + "max_count": {"key": "maxCount", "type": "int"}, + "min_count": {"key": "minCount", "type": "int"}, + "enable_auto_scaling": {"key": "enableAutoScaling", "type": "bool"}, + "type": {"key": "type", "type": "str"}, } def __init__( @@ -1051,7 +1001,7 @@ def __init__( os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, @@ -1059,13 +1009,13 @@ def __init__( **kwargs ): """ - :keyword name: Required. Unique name of the agent pool profile in the context of the - subscription and resource group. + :keyword name: Unique name of the agent pool profile in the context of the subscription and + resource group. Required. :paramtype name: str - :keyword count: Required. Number of agents (VMs) to host docker containers. Allowed values must - be in the range of 1 to 100 (inclusive). The default value is 1. + :keyword count: Number of agents (VMs) to host docker containers. Allowed values must be in the + range of 1 to 100 (inclusive). The default value is 1. :paramtype count: int - :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + :keyword vm_size: Size of agent VMs. Required. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -1102,7 +1052,7 @@ def __init__( "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :paramtype vm_size: str or ~azure.mgmt.containerservice.v2018_08_01_preview.models.ContainerServiceVMSizeTypes :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every @@ -1114,7 +1064,7 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux" and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2018_08_01_preview.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -1123,10 +1073,10 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword type: AgentPoolType represents types of an agent pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2018_08_01_preview.models.AgentPoolType """ - super(ManagedClusterAgentPoolProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.count = count self.vm_size = vm_size @@ -1140,7 +1090,7 @@ def __init__( self.type = type -class ManagedClusterListResult(msrest.serialization.Model): +class ManagedClusterListResult(_serialization.Model): """The response from the List Managed Clusters operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -1152,55 +1102,50 @@ class ManagedClusterListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[ManagedCluster]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[ManagedCluster]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.ManagedCluster"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.ManagedCluster"]] = None, **kwargs): """ :keyword value: The list of managed clusters. :paramtype value: list[~azure.mgmt.containerservice.v2018_08_01_preview.models.ManagedCluster] """ - super(ManagedClusterListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): +class ManagedClusterPoolUpgradeProfile(_serialization.Model): """The list of available upgrade versions. All required parameters must be populated in order to send to Azure. - :ivar kubernetes_version: Required. Kubernetes version (major, minor, patch). + :ivar kubernetes_version: Kubernetes version (major, minor, patch). Required. :vartype kubernetes_version: str :ivar name: Pool name. :vartype name: str - :ivar os_type: Required. OsType to be used to specify os type. Choose from Linux and Windows. - Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to + Linux. Known values are: "Linux" and "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2018_08_01_preview.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: list[str] """ _validation = { - 'kubernetes_version': {'required': True}, - 'os_type': {'required': True}, + "kubernetes_version": {"required": True}, + "os_type": {"required": True}, } _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'upgrades': {'key': 'upgrades', 'type': '[str]'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "os_type": {"key": "osType", "type": "str"}, + "upgrades": {"key": "upgrades", "type": "[str]"}, } def __init__( @@ -1213,62 +1158,56 @@ def __init__( **kwargs ): """ - :keyword kubernetes_version: Required. Kubernetes version (major, minor, patch). + :keyword kubernetes_version: Kubernetes version (major, minor, patch). Required. :paramtype kubernetes_version: str :keyword name: Pool name. :paramtype name: str - :keyword os_type: Required. OsType to be used to specify os type. Choose from Linux and - Windows. Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default + to Linux. Known values are: "Linux" and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2018_08_01_preview.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: list[str] """ - super(ManagedClusterPoolUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.name = name self.os_type = os_type self.upgrades = upgrades -class ManagedClusterServicePrincipalProfile(msrest.serialization.Model): +class ManagedClusterServicePrincipalProfile(_serialization.Model): """Information about a service principal identity for the cluster to use for manipulating Azure APIs. All required parameters must be populated in order to send to Azure. - :ivar client_id: Required. The ID for the service principal. + :ivar client_id: The ID for the service principal. Required. :vartype client_id: str :ivar secret: The secret password associated with the service principal in plain text. :vartype secret: str """ _validation = { - 'client_id': {'required': True}, + "client_id": {"required": True}, } _attribute_map = { - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'secret': {'key': 'secret', 'type': 'str'}, + "client_id": {"key": "clientId", "type": "str"}, + "secret": {"key": "secret", "type": "str"}, } - def __init__( - self, - *, - client_id: str, - secret: Optional[str] = None, - **kwargs - ): + def __init__(self, *, client_id: str, secret: Optional[str] = None, **kwargs): """ - :keyword client_id: Required. The ID for the service principal. + :keyword client_id: The ID for the service principal. Required. :paramtype client_id: str :keyword secret: The secret password associated with the service principal in plain text. :paramtype secret: str """ - super(ManagedClusterServicePrincipalProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.client_id = client_id self.secret = secret -class ManagedClusterUpgradeProfile(msrest.serialization.Model): +class ManagedClusterUpgradeProfile(_serialization.Model): """The list of available upgrades for compute pools. Variables are only populated by the server, and will be ignored when sending a request. @@ -1281,29 +1220,29 @@ class ManagedClusterUpgradeProfile(msrest.serialization.Model): :vartype name: str :ivar type: Type of upgrade profile. :vartype type: str - :ivar control_plane_profile: Required. The list of available upgrade versions for the control - plane. + :ivar control_plane_profile: The list of available upgrade versions for the control plane. + Required. :vartype control_plane_profile: ~azure.mgmt.containerservice.v2018_08_01_preview.models.ManagedClusterPoolUpgradeProfile - :ivar agent_pool_profiles: Required. The list of available upgrade versions for agent pools. + :ivar agent_pool_profiles: The list of available upgrade versions for agent pools. Required. :vartype agent_pool_profiles: list[~azure.mgmt.containerservice.v2018_08_01_preview.models.ManagedClusterPoolUpgradeProfile] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'control_plane_profile': {'required': True}, - 'agent_pool_profiles': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "control_plane_profile": {"required": True}, + "agent_pool_profiles": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'control_plane_profile': {'key': 'properties.controlPlaneProfile', 'type': 'ManagedClusterPoolUpgradeProfile'}, - 'agent_pool_profiles': {'key': 'properties.agentPoolProfiles', 'type': '[ManagedClusterPoolUpgradeProfile]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "control_plane_profile": {"key": "properties.controlPlaneProfile", "type": "ManagedClusterPoolUpgradeProfile"}, + "agent_pool_profiles": {"key": "properties.agentPoolProfiles", "type": "[ManagedClusterPoolUpgradeProfile]"}, } def __init__( @@ -1314,15 +1253,15 @@ def __init__( **kwargs ): """ - :keyword control_plane_profile: Required. The list of available upgrade versions for the - control plane. + :keyword control_plane_profile: The list of available upgrade versions for the control plane. + Required. :paramtype control_plane_profile: ~azure.mgmt.containerservice.v2018_08_01_preview.models.ManagedClusterPoolUpgradeProfile - :keyword agent_pool_profiles: Required. The list of available upgrade versions for agent pools. + :keyword agent_pool_profiles: The list of available upgrade versions for agent pools. Required. :paramtype agent_pool_profiles: list[~azure.mgmt.containerservice.v2018_08_01_preview.models.ManagedClusterPoolUpgradeProfile] """ - super(ManagedClusterUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -1330,7 +1269,7 @@ def __init__( self.agent_pool_profiles = agent_pool_profiles -class OperationListResult(msrest.serialization.Model): +class OperationListResult(_serialization.Model): """The List Compute Operation operation response. Variables are only populated by the server, and will be ignored when sending a request. @@ -1340,24 +1279,20 @@ class OperationListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[OperationValue]'}, + "value": {"key": "value", "type": "[OperationValue]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(OperationListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None -class OperationValue(msrest.serialization.Model): +class OperationValue(_serialization.Model): """Describes the properties of a Compute Operation value. Variables are only populated by the server, and will be ignored when sending a request. @@ -1377,30 +1312,26 @@ class OperationValue(msrest.serialization.Model): """ _validation = { - 'origin': {'readonly': True}, - 'name': {'readonly': True}, - 'operation': {'readonly': True}, - 'resource': {'readonly': True}, - 'description': {'readonly': True}, - 'provider': {'readonly': True}, + "origin": {"readonly": True}, + "name": {"readonly": True}, + "operation": {"readonly": True}, + "resource": {"readonly": True}, + "description": {"readonly": True}, + "provider": {"readonly": True}, } _attribute_map = { - 'origin': {'key': 'origin', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'operation': {'key': 'display.operation', 'type': 'str'}, - 'resource': {'key': 'display.resource', 'type': 'str'}, - 'description': {'key': 'display.description', 'type': 'str'}, - 'provider': {'key': 'display.provider', 'type': 'str'}, + "origin": {"key": "origin", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "operation": {"key": "display.operation", "type": "str"}, + "resource": {"key": "display.resource", "type": "str"}, + "description": {"key": "display.description", "type": "str"}, + "provider": {"key": "display.provider", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(OperationValue, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.origin = None self.name = None self.operation = None @@ -1409,65 +1340,54 @@ def __init__( self.provider = None -class OrchestratorProfile(msrest.serialization.Model): +class OrchestratorProfile(_serialization.Model): """Contains information about orchestrator. All required parameters must be populated in order to send to Azure. - :ivar orchestrator_type: Required. Orchestrator type. + :ivar orchestrator_type: Orchestrator type. Required. :vartype orchestrator_type: str - :ivar orchestrator_version: Required. Orchestrator version (major, minor, patch). + :ivar orchestrator_version: Orchestrator version (major, minor, patch). Required. :vartype orchestrator_version: str """ _validation = { - 'orchestrator_type': {'required': True}, - 'orchestrator_version': {'required': True}, + "orchestrator_type": {"required": True}, + "orchestrator_version": {"required": True}, } _attribute_map = { - 'orchestrator_type': {'key': 'orchestratorType', 'type': 'str'}, - 'orchestrator_version': {'key': 'orchestratorVersion', 'type': 'str'}, + "orchestrator_type": {"key": "orchestratorType", "type": "str"}, + "orchestrator_version": {"key": "orchestratorVersion", "type": "str"}, } - def __init__( - self, - *, - orchestrator_type: str, - orchestrator_version: str, - **kwargs - ): + def __init__(self, *, orchestrator_type: str, orchestrator_version: str, **kwargs): """ - :keyword orchestrator_type: Required. Orchestrator type. + :keyword orchestrator_type: Orchestrator type. Required. :paramtype orchestrator_type: str - :keyword orchestrator_version: Required. Orchestrator version (major, minor, patch). + :keyword orchestrator_version: Orchestrator version (major, minor, patch). Required. :paramtype orchestrator_version: str """ - super(OrchestratorProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.orchestrator_type = orchestrator_type self.orchestrator_version = orchestrator_version -class TagsObject(msrest.serialization.Model): +class TagsObject(_serialization.Model): """Tags object for patch operations. - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] """ _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] """ - super(TagsObject, self).__init__(**kwargs) + super().__init__(**kwargs) self.tags = tags diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/models/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/models/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/models/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/models/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/operations/__init__.py index 79c2682d6c29..399a909877af 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/operations/__init__.py @@ -12,9 +12,10 @@ from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'Operations', - 'ManagedClustersOperations', + "Operations", + "ManagedClustersOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/operations/_managed_clusters_operations.py index c259496701bf..eff142ae8c09 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/operations/_managed_clusters_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,476 +27,384 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-08-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters") + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters" + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_resource_group_request( - subscription_id: str, - resource_group_name: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-08-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters", + ) # 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', min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_upgrade_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-08-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_access_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, role_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 = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-08-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "roleName": _SERIALIZER.url("role_name", role_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "roleName": _SERIALIZER.url("role_name", role_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_admin_credentials_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-08-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_user_credentials_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-08-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: + +def build_get_request(resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-08-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedCluster] = None, - content: Any = None, - **kwargs: Any + +def build_create_or_update_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-08-01-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_update_tags_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.TagsObject] = None, - content: Any = None, - **kwargs: Any + +def build_update_tags_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-08-01-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any +def build_delete_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-08-01-preview")) # type: str # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) -def build_reset_service_principal_profile_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedClusterServicePrincipalProfile] = None, - content: Any = None, - **kwargs: Any +def build_reset_service_principal_profile_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-08-01-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_reset_aad_profile_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedClusterAADProfile] = None, - content: Any = None, - **kwargs: Any +def build_reset_aad_profile_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-08-01-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + class ManagedClustersOperations: """ @@ -512,41 +425,35 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.ManagedClusterListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.ManagedCluster"]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. The operation returns properties of each managed cluster. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2018_08_01_preview.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2018_08_01_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-08-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -554,14 +461,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -577,10 +481,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -590,50 +492,42 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> Iterable[_models.ManagedClusterListResult]: + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.ManagedCluster"]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. The operation returns properties of each managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2018_08_01_preview.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2018_08_01_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-08-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -641,15 +535,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -665,10 +555,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -678,51 +566,43 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.ManagedClusterUpgradeProfile: """Gets upgrade profile for a managed cluster. Gets the details of the upgrade profile for a managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterUpgradeProfile, or the result of cls(response) + :return: ManagedClusterUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2018_08_01_preview.models.ManagedClusterUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-08-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -730,69 +610,60 @@ def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterUpgradeProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore @distributed_trace def get_access_profile( - self, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, role_name: str, **kwargs: Any ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. Gets the accessProfile for the specified role name of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param role_name: The name of the role for managed cluster accessProfile resource. + :param role_name: The name of the role for managed cluster accessProfile resource. Required. :type role_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterAccessProfile, or the result of cls(response) + :return: ManagedClusterAccessProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2018_08_01_preview.models.ManagedClusterAccessProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-08-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterAccessProfile] - request = build_get_access_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, role_name=role_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_access_profile.metadata['url'], + template_url=self.get_access_profile.metadata["url"], headers=_headers, params=_params, ) @@ -800,64 +671,56 @@ def get_access_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterAccessProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterAccessProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_access_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore - + get_access_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore @distributed_trace def list_cluster_admin_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster admin credential of a managed cluster. Gets cluster admin credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2018_08_01_preview.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-08-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_admin_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_admin_credentials.metadata['url'], + template_url=self.list_cluster_admin_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -865,64 +728,56 @@ def list_cluster_admin_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_admin_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore - + list_cluster_admin_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore @distributed_trace def list_cluster_user_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster user credential of a managed cluster. Gets cluster user credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2018_08_01_preview.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-08-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_user_credentials.metadata['url'], + template_url=self.list_cluster_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -930,64 +785,54 @@ def list_cluster_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore - + list_cluster_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore @distributed_trace - def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.ManagedCluster: + def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.ManagedCluster: """Gets a managed cluster. Gets the details of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedCluster, or the result of cls(response) + :return: ManagedCluster or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2018_08_01_preview.models.ManagedCluster - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-08-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -995,55 +840,54 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _create_or_update_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.ManagedCluster, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-08-01-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'ManagedCluster') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedCluster") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1051,10 +895,9 @@ def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -1062,25 +905,26 @@ def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - @distributed_trace + @overload def begin_create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedCluster, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. @@ -1088,12 +932,90 @@ def begin_create_or_update( Creates or updates a managed cluster with the specified configuration for agents and Kubernetes version. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2018_08_01_preview.models.ManagedCluster + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2018_08_01_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster with the specified configuration for agents and Kubernetes + version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2018_08_01_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster with the specified configuration for agents and Kubernetes + version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. Is + either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2018_08_01_preview.models.ManagedCluster or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1106,20 +1028,17 @@ def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2018_08_01_preview.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-08-01-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -1127,69 +1046,66 @@ def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _update_tags_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.TagsObject, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-08-01-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request_initial( - subscription_id=self._config.subscription_id, + request = build_update_tags_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_tags_initial.metadata['url'], + content=_content, + template_url=self._update_tags_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1197,44 +1113,47 @@ def _update_tags_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_tags_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _update_tags_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - @distributed_trace + @overload def begin_update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates a managed cluster with the specified tags. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2018_08_01_preview.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1247,20 +1166,88 @@ def begin_update_tags( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2018_08_01_preview.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates a managed cluster with the specified tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2018_08_01_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates a managed cluster with the specified tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2018_08_01_preview.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2018_08_01_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-08-01-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, @@ -1268,64 +1255,54 @@ def begin_update_tags( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-08-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1333,10 +1310,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1346,23 +1322,17 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> LROPoller[None]: + def begin_delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> LROPoller[None]: """Deletes a managed cluster. Deletes the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1374,85 +1344,83 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-08-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterServicePrincipalProfile, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-08-01-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterServicePrincipalProfile") - request = build_reset_service_principal_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_service_principal_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_service_principal_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_service_principal_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1460,10 +1428,9 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1473,29 +1440,107 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re if cls: return cls(pipeline_response, None, {}) - _reset_service_principal_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + _reset_service_principal_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + + @overload + def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.ManagedClusterServicePrincipalProfile, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reset Service Principal Profile of a managed cluster. + Update the service principal Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a + Managed Cluster. Required. + :type parameters: + ~azure.mgmt.containerservice.v2018_08_01_preview.models.ManagedClusterServicePrincipalProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reset Service Principal Profile of a managed cluster. + + Update the service principal Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a + Managed Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace - def begin_reset_service_principal_profile( # pylint: disable=inconsistent-return-statements + def begin_reset_service_principal_profile( self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterServicePrincipalProfile, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], **kwargs: Any ) -> LROPoller[None]: """Reset Service Principal Profile of a managed cluster. Update the service principal Profile for a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a - Managed Cluster. + Managed Cluster. Is either a model type or a IO type. Required. :type parameters: ~azure.mgmt.containerservice.v2018_08_01_preview.models.ManagedClusterServicePrincipalProfile + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1506,20 +1551,17 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-08-01-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1527,67 +1569,68 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_service_principal_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + begin_reset_service_principal_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterAADProfile, + parameters: Union[_models.ManagedClusterAADProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-08-01-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterAADProfile") - request = build_reset_aad_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_aad_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_aad_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_aad_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1595,10 +1638,9 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1608,29 +1650,33 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement if cls: return cls(pipeline_response, None, {}) - _reset_aad_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + _reset_aad_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - - @distributed_trace - def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements + @overload + def begin_reset_aad_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterAADProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: """Reset AAD Profile of a managed cluster. Update the AAD Profile for a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed - Cluster. + Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2018_08_01_preview.models.ManagedClusterAADProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1641,20 +1687,90 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reset AAD Profile of a managed cluster. + + Update the AAD Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed + Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterAADProfile, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Reset AAD Profile of a managed cluster. + + Update the AAD Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed + Cluster. Is either a model type or a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2018_08_01_preview.models.ManagedClusterAADProfile or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-08-01-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1662,34 +1778,30 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_aad_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + begin_reset_aad_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/operations/_operations.py index e89dac78f552..123b04c5c464 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/operations/_operations.py @@ -7,10 +7,15 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,38 +25,34 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - **kwargs: Any -) -> HttpRequest: + +def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-08-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.ContainerService/operations") # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class Operations: """ @@ -72,36 +73,31 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.OperationListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.OperationValue"]: """Gets a list of compute operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationListResult or the result of cls(response) + :return: An iterator like instance of either OperationValue or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2018_08_01_preview.models.OperationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2018_08_01_preview.models.OperationValue] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-08-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -109,13 +105,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -131,10 +125,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -144,8 +136,6 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.ContainerService/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ContainerService/operations"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/operations/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/__init__.py index 37a5f9e02e6f..a8716d29afe8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/__init__.py @@ -14,7 +14,8 @@ except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['ContainerServiceClient'] + +__all__ = ["ContainerServiceClient"] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/_configuration.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/_configuration.py index 70184408ce42..434fa016fc13 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/_configuration.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/_configuration.py @@ -18,30 +18,26 @@ VERSION = "unknown" + class ContainerServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ContainerServiceClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2018-09-30-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: + def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ContainerServiceClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2018-09-30-preview") # type: str + api_version = kwargs.pop("api_version", "2018-09-30-preview") # type: str if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -51,23 +47,24 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-containerservice/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-containerservice/{}".format(VERSION)) self._configure(**kwargs) def _configure( - self, - **kwargs # type: Any + self, **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/_container_service_client.py index f5ad4edbd724..89dffa266515 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/_container_service_client.py @@ -9,12 +9,11 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from . import models +from .._serialization import Deserializer, Serializer from ._configuration import ContainerServiceClientConfiguration from .operations import OpenShiftManagedClustersOperations @@ -22,16 +21,17 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class ContainerServiceClient: + +class ContainerServiceClient: # pylint: disable=client-accepts-api-version-keyword """The Container Service Client. :ivar open_shift_managed_clusters: OpenShiftManagedClustersOperations operations :vartype open_shift_managed_clusters: azure.mgmt.containerservice.v2018_09_30_preview.operations.OpenShiftManagedClustersOperations - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -49,7 +49,9 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = ContainerServiceClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = ContainerServiceClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} @@ -60,12 +62,7 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) - - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> HttpResponse: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -74,7 +71,7 @@ def _send_request( >>> response = client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/_metadata.json b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/_metadata.json index bf92da48ba87..49f4e0d9c360 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/_metadata.json +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/_metadata.json @@ -10,20 +10,20 @@ "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { "credential": { - "signature": "credential, # type: \"TokenCredential\"", - "description": "Credential needed for the client to connect to Azure.", + "signature": "credential: \"TokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true }, "subscription_id": { - "signature": "subscription_id, # type: str", - "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "signature": "subscription_id: str,", + "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.", "docstring_type": "str", "required": true } @@ -31,13 +31,13 @@ "async": { "credential": { "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure.", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { "signature": "subscription_id: str,", - "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.", "docstring_type": "str", "required": true } @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=\"https://management.azure.com\", # type: str", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/_patch.py index 74e48ecd07cf..f99e77fef986 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/_patch.py @@ -28,4 +28,4 @@ # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + pass diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/_vendor.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/_vendor.py index 138f663c53a4..9aad73fc743e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/_vendor.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/_vendor.py @@ -7,6 +7,7 @@ from azure.core.pipeline.transport import HttpRequest + def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) @@ -14,6 +15,7 @@ def _convert_request(request, files=None): request.set_formdata_body(files) return request + def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -21,7 +23,5 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [ - c for c in formatted_components if "{}".format(key.args[0]) not in c - ] + components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/aio/__init__.py index 37a5f9e02e6f..a8716d29afe8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/aio/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/aio/__init__.py @@ -14,7 +14,8 @@ except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['ContainerServiceClient'] + +__all__ = ["ContainerServiceClient"] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/aio/_configuration.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/aio/_configuration.py index 65d98c76fd5e..8ce1c1668c78 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/aio/_configuration.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/aio/_configuration.py @@ -18,30 +18,26 @@ VERSION = "unknown" + class ContainerServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ContainerServiceClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2018-09-30-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: + def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ContainerServiceClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2018-09-30-preview") # type: str + api_version = kwargs.pop("api_version", "2018-09-30-preview") # type: str if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -51,22 +47,21 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-containerservice/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-containerservice/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, - **kwargs: Any - ) -> None: - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/aio/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/aio/_container_service_client.py index a71c11f3d010..a971846dcec1 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/aio/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/aio/_container_service_client.py @@ -9,12 +9,11 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from .. import models +from ..._serialization import Deserializer, Serializer from ._configuration import ContainerServiceClientConfiguration from .operations import OpenShiftManagedClustersOperations @@ -22,16 +21,17 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class ContainerServiceClient: + +class ContainerServiceClient: # pylint: disable=client-accepts-api-version-keyword """The Container Service Client. :ivar open_shift_managed_clusters: OpenShiftManagedClustersOperations operations :vartype open_shift_managed_clusters: azure.mgmt.containerservice.v2018_09_30_preview.aio.operations.OpenShiftManagedClustersOperations - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -49,7 +49,9 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = ContainerServiceClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = ContainerServiceClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} @@ -60,12 +62,7 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) - - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -74,7 +71,7 @@ def _send_request( >>> response = await client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/aio/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/aio/_patch.py index 74e48ecd07cf..f99e77fef986 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/aio/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/aio/_patch.py @@ -28,4 +28,4 @@ # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + pass diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/aio/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/aio/operations/__init__.py index 211a87879804..69775b67d4ba 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/aio/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/aio/operations/__init__.py @@ -11,8 +11,9 @@ from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'OpenShiftManagedClustersOperations', + "OpenShiftManagedClustersOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/aio/operations/_open_shift_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/aio/operations/_open_shift_managed_clusters_operations.py index 9504f0d209a4..c804140cdbfc 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/aio/operations/_open_shift_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/aio/operations/_open_shift_managed_clusters_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +29,19 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._open_shift_managed_clusters_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_resource_group_request, build_list_request, build_update_tags_request_initial -T = TypeVar('T') +from ...operations._open_shift_managed_clusters_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_resource_group_request, + build_list_request, + build_update_tags_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class OpenShiftManagedClustersOperations: """ .. warning:: @@ -45,41 +61,36 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.OpenShiftManagedClusterListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.OpenShiftManagedCluster"]: """Gets a list of OpenShift managed clusters in the specified subscription. Gets a list of OpenShift managed clusters in the specified subscription. The operation returns properties of each OpenShift managed cluster. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OpenShiftManagedClusterListResult or the result of + :return: An iterator like instance of either OpenShiftManagedCluster or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2018_09_30_preview.models.OpenShiftManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2018_09_30_preview.models.OpenShiftManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-09-30-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-30-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OpenShiftManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -87,14 +98,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -110,10 +118,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -123,50 +129,45 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/openShiftManagedClusters"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/openShiftManagedClusters"} # type: ignore @distributed_trace def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.OpenShiftManagedClusterListResult]: + self, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.OpenShiftManagedCluster"]: """Lists OpenShift managed clusters in the specified subscription and resource group. Lists OpenShift managed clusters in the specified subscription and resource group. The operation returns properties of each OpenShift managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OpenShiftManagedClusterListResult or the result of + :return: An iterator like instance of either OpenShiftManagedCluster or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2018_09_30_preview.models.OpenShiftManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2018_09_30_preview.models.OpenShiftManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-09-30-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-30-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OpenShiftManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -174,15 +175,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -198,10 +195,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -211,50 +206,40 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters"} # type: ignore @distributed_trace_async - async def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.OpenShiftManagedCluster: + async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.OpenShiftManagedCluster: """Gets a OpenShift managed cluster. Gets the details of the managed OpenShift cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the OpenShift managed cluster resource. + :param resource_name: The name of the OpenShift managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: OpenShiftManagedCluster, or the result of cls(response) + :return: OpenShiftManagedCluster or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2018_09_30_preview.models.OpenShiftManagedCluster - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-09-30-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-30-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OpenShiftManagedCluster] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -262,55 +247,58 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('OpenShiftManagedCluster', pipeline_response) + deserialized = self._deserialize("OpenShiftManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore async def _create_or_update_initial( self, resource_group_name: str, resource_name: str, - parameters: _models.OpenShiftManagedCluster, + parameters: Union[_models.OpenShiftManagedCluster, IO], **kwargs: Any ) -> _models.OpenShiftManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2018-09-30-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-30-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.OpenShiftManagedCluster] - _json = self._serialize.body(parameters, 'OpenShiftManagedCluster') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "OpenShiftManagedCluster") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -318,10 +306,9 @@ async def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -329,25 +316,26 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('OpenShiftManagedCluster', pipeline_response) + deserialized = self._deserialize("OpenShiftManagedCluster", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('OpenShiftManagedCluster', pipeline_response) + deserialized = self._deserialize("OpenShiftManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore - + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore - @distributed_trace_async + @overload async def begin_create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.OpenShiftManagedCluster, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.OpenShiftManagedCluster]: """Creates or updates an OpenShift managed cluster. @@ -355,14 +343,96 @@ async def begin_create_or_update( Creates or updates a OpenShift managed cluster with the specified configuration for agents and OpenShift version. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the OpenShift managed cluster resource. + :param resource_name: The name of the OpenShift managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Create or Update an OpenShift Managed Cluster - operation. + operation. Required. :type parameters: ~azure.mgmt.containerservice.v2018_09_30_preview.models.OpenShiftManagedCluster + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either OpenShiftManagedCluster or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2018_09_30_preview.models.OpenShiftManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OpenShiftManagedCluster]: + """Creates or updates an OpenShift managed cluster. + + Creates or updates a OpenShift managed cluster with the specified configuration for agents and + OpenShift version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the OpenShift managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Create or Update an OpenShift Managed Cluster + operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either OpenShiftManagedCluster or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2018_09_30_preview.models.OpenShiftManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.OpenShiftManagedCluster, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.OpenShiftManagedCluster]: + """Creates or updates an OpenShift managed cluster. + + Creates or updates a OpenShift managed cluster with the specified configuration for agents and + OpenShift version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the OpenShift managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Create or Update an OpenShift Managed Cluster + operation. Is either a model type or a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2018_09_30_preview.models.OpenShiftManagedCluster or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -375,20 +445,17 @@ async def begin_create_or_update( result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2018_09_30_preview.models.OpenShiftManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-09-30-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-30-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.OpenShiftManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -396,69 +463,66 @@ async def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('OpenShiftManagedCluster', pipeline_response) + deserialized = self._deserialize("OpenShiftManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore async def _update_tags_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.TagsObject, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any ) -> _models.OpenShiftManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2018-09-30-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-30-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.OpenShiftManagedCluster] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request_initial( - subscription_id=self._config.subscription_id, + request = build_update_tags_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_tags_initial.metadata['url'], + content=_content, + template_url=self._update_tags_initial.metadata["url"], headers=_headers, params=_params, ) @@ -466,44 +530,48 @@ async def _update_tags_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('OpenShiftManagedCluster', pipeline_response) + deserialized = self._deserialize("OpenShiftManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_tags_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore + _update_tags_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore - - @distributed_trace_async + @overload async def begin_update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.OpenShiftManagedCluster]: """Updates tags on an OpenShift managed cluster. Updates an OpenShift managed cluster with the specified tags. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the OpenShift managed cluster resource. + :param resource_name: The name of the OpenShift managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Update OpenShift Managed Cluster Tags operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2018_09_30_preview.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -516,20 +584,89 @@ async def begin_update_tags( result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2018_09_30_preview.models.OpenShiftManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OpenShiftManagedCluster]: + """Updates tags on an OpenShift managed cluster. + + Updates an OpenShift managed cluster with the specified tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the OpenShift managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update OpenShift Managed Cluster Tags operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either OpenShiftManagedCluster or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2018_09_30_preview.models.OpenShiftManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.OpenShiftManagedCluster]: + """Updates tags on an OpenShift managed cluster. + + Updates an OpenShift managed cluster with the specified tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the OpenShift managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update OpenShift Managed Cluster Tags operation. + Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2018_09_30_preview.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either OpenShiftManagedCluster or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2018_09_30_preview.models.OpenShiftManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-09-30-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-30-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.OpenShiftManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, @@ -537,64 +674,54 @@ async def begin_update_tags( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('OpenShiftManagedCluster', pipeline_response) + deserialized = self._deserialize("OpenShiftManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore + begin_update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-09-30-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-30-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -602,10 +729,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -615,23 +741,17 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: + async def begin_delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Deletes an OpenShift managed cluster. Deletes the OpenShift managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the OpenShift managed cluster resource. + :param resource_name: The name of the OpenShift managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -643,52 +763,45 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-09-30-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-30-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/aio/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/aio/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/aio/operations/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/aio/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/models/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/models/__init__.py index 421ce777c259..c010ebef8d73 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/models/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/models/__init__.py @@ -21,33 +21,31 @@ from ._models_py3 import Resource from ._models_py3 import TagsObject - -from ._container_service_client_enums import ( - OSType, - OpenShiftAgentPoolProfileRole, - OpenShiftContainerServiceVMSize, -) +from ._container_service_client_enums import OSType +from ._container_service_client_enums import OpenShiftAgentPoolProfileRole +from ._container_service_client_enums import OpenShiftContainerServiceVMSize from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'CloudErrorBody', - 'NetworkProfile', - 'OpenShiftManagedCluster', - 'OpenShiftManagedClusterAADIdentityProvider', - 'OpenShiftManagedClusterAgentPoolProfile', - 'OpenShiftManagedClusterAuthProfile', - 'OpenShiftManagedClusterBaseIdentityProvider', - 'OpenShiftManagedClusterIdentityProvider', - 'OpenShiftManagedClusterListResult', - 'OpenShiftManagedClusterMasterPoolProfile', - 'OpenShiftRouterProfile', - 'PurchasePlan', - 'Resource', - 'TagsObject', - 'OSType', - 'OpenShiftAgentPoolProfileRole', - 'OpenShiftContainerServiceVMSize', + "CloudErrorBody", + "NetworkProfile", + "OpenShiftManagedCluster", + "OpenShiftManagedClusterAADIdentityProvider", + "OpenShiftManagedClusterAgentPoolProfile", + "OpenShiftManagedClusterAuthProfile", + "OpenShiftManagedClusterBaseIdentityProvider", + "OpenShiftManagedClusterIdentityProvider", + "OpenShiftManagedClusterListResult", + "OpenShiftManagedClusterMasterPoolProfile", + "OpenShiftRouterProfile", + "PurchasePlan", + "Resource", + "TagsObject", + "OSType", + "OpenShiftAgentPoolProfileRole", + "OpenShiftContainerServiceVMSize", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/models/_container_service_client_enums.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/models/_container_service_client_enums.py index 6c64f62d0661..115c765d1314 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/models/_container_service_client_enums.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/models/_container_service_client_enums.py @@ -11,15 +11,14 @@ class OpenShiftAgentPoolProfileRole(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """OpenShiftAgentPoolProfileRole represents the role of the AgentPoolProfile. - """ + """OpenShiftAgentPoolProfileRole represents the role of the AgentPoolProfile.""" COMPUTE = "compute" INFRA = "infra" + class OpenShiftContainerServiceVMSize(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Size of OpenShift VMs. - """ + """Size of OpenShift VMs.""" STANDARD_D2_S_V3 = "Standard_D2s_v3" STANDARD_D4_S_V3 = "Standard_D4s_v3" @@ -55,9 +54,9 @@ class OpenShiftContainerServiceVMSize(str, Enum, metaclass=CaseInsensitiveEnumMe STANDARD_L16_S = "Standard_L16s" STANDARD_L32_S = "Standard_L32s" + class OSType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """OsType to be used to specify os type. Choose from Linux and Windows. Default to Linux. - """ + """OsType to be used to specify os type. Choose from Linux and Windows. Default to Linux.""" LINUX = "Linux" WINDOWS = "Windows" diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/models/_models_py3.py index d12307412946..c25b70292432 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/models/_models_py3.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/models/_models_py3.py @@ -1,4 +1,5 @@ # coding=utf-8 +# pylint: disable=too-many-lines # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -8,14 +9,14 @@ from typing import Dict, List, Optional, TYPE_CHECKING, Union -import msrest.serialization +from ... import _serialization if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - import __init__ as _models + from .. import models as _models -class CloudErrorBody(msrest.serialization.Model): +class CloudErrorBody(_serialization.Model): """An error response from the Container service. :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed @@ -32,10 +33,10 @@ class CloudErrorBody(msrest.serialization.Model): """ _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[CloudErrorBody]"}, } def __init__( @@ -61,14 +62,14 @@ def __init__( :paramtype details: list[~azure.mgmt.containerservice.v2018_09_30_preview.models.CloudErrorBody] """ - super(CloudErrorBody, self).__init__(**kwargs) + super().__init__(**kwargs) self.code = code self.message = message self.target = target self.details = details -class NetworkProfile(msrest.serialization.Model): +class NetworkProfile(_serialization.Model): """Represents the OpenShift networking configuration. :ivar vnet_cidr: CIDR for the OpenShift Vnet. @@ -78,29 +79,23 @@ class NetworkProfile(msrest.serialization.Model): """ _attribute_map = { - 'vnet_cidr': {'key': 'vnetCidr', 'type': 'str'}, - 'peer_vnet_id': {'key': 'peerVnetId', 'type': 'str'}, + "vnet_cidr": {"key": "vnetCidr", "type": "str"}, + "peer_vnet_id": {"key": "peerVnetId", "type": "str"}, } - def __init__( - self, - *, - vnet_cidr: Optional[str] = "10.0.0.0/8", - peer_vnet_id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, vnet_cidr: str = "10.0.0.0/8", peer_vnet_id: Optional[str] = None, **kwargs): """ :keyword vnet_cidr: CIDR for the OpenShift Vnet. :paramtype vnet_cidr: str :keyword peer_vnet_id: CIDR of the Vnet to peer. :paramtype peer_vnet_id: str """ - super(NetworkProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.vnet_cidr = vnet_cidr self.peer_vnet_id = peer_vnet_id -class Resource(msrest.serialization.Model): +class Resource(_serialization.Model): """The Resource model definition. Variables are only populated by the server, and will be ignored when sending a request. @@ -113,41 +108,35 @@ class Resource(msrest.serialization.Model): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] """ - super(Resource, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -155,7 +144,7 @@ def __init__( self.tags = tags -class OpenShiftManagedCluster(Resource): +class OpenShiftManagedCluster(Resource): # pylint: disable=too-many-instance-attributes """OpenShift Managed cluster. Variables are only populated by the server, and will be ignored when sending a request. @@ -168,9 +157,9 @@ class OpenShiftManagedCluster(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar plan: Define the resource plan as required by ARM for billing purposes. :vartype plan: ~azure.mgmt.containerservice.v2018_09_30_preview.models.PurchasePlan @@ -201,29 +190,35 @@ class OpenShiftManagedCluster(Resource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'provisioning_state': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'plan': {'key': 'plan', 'type': 'PurchasePlan'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'open_shift_version': {'key': 'properties.openShiftVersion', 'type': 'str'}, - 'public_hostname': {'key': 'properties.publicHostname', 'type': 'str'}, - 'fqdn': {'key': 'properties.fqdn', 'type': 'str'}, - 'network_profile': {'key': 'properties.networkProfile', 'type': 'NetworkProfile'}, - 'router_profiles': {'key': 'properties.routerProfiles', 'type': '[OpenShiftRouterProfile]'}, - 'master_pool_profile': {'key': 'properties.masterPoolProfile', 'type': 'OpenShiftManagedClusterMasterPoolProfile'}, - 'agent_pool_profiles': {'key': 'properties.agentPoolProfiles', 'type': '[OpenShiftManagedClusterAgentPoolProfile]'}, - 'auth_profile': {'key': 'properties.authProfile', 'type': 'OpenShiftManagedClusterAuthProfile'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "plan": {"key": "plan", "type": "PurchasePlan"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "open_shift_version": {"key": "properties.openShiftVersion", "type": "str"}, + "public_hostname": {"key": "properties.publicHostname", "type": "str"}, + "fqdn": {"key": "properties.fqdn", "type": "str"}, + "network_profile": {"key": "properties.networkProfile", "type": "NetworkProfile"}, + "router_profiles": {"key": "properties.routerProfiles", "type": "[OpenShiftRouterProfile]"}, + "master_pool_profile": { + "key": "properties.masterPoolProfile", + "type": "OpenShiftManagedClusterMasterPoolProfile", + }, + "agent_pool_profiles": { + "key": "properties.agentPoolProfiles", + "type": "[OpenShiftManagedClusterAgentPoolProfile]", + }, + "auth_profile": {"key": "properties.authProfile", "type": "OpenShiftManagedClusterAuthProfile"}, } def __init__( @@ -243,9 +238,9 @@ def __init__( **kwargs ): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword plan: Define the resource plan as required by ARM for billing purposes. :paramtype plan: ~azure.mgmt.containerservice.v2018_09_30_preview.models.PurchasePlan @@ -271,7 +266,7 @@ def __init__( :paramtype auth_profile: ~azure.mgmt.containerservice.v2018_09_30_preview.models.OpenShiftManagedClusterAuthProfile """ - super(OpenShiftManagedCluster, self).__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.plan = plan self.provisioning_state = None self.open_shift_version = open_shift_version @@ -284,37 +279,31 @@ def __init__( self.auth_profile = auth_profile -class OpenShiftManagedClusterBaseIdentityProvider(msrest.serialization.Model): +class OpenShiftManagedClusterBaseIdentityProvider(_serialization.Model): """Structure for any Identity provider. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: OpenShiftManagedClusterAADIdentityProvider. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + OpenShiftManagedClusterAADIdentityProvider All required parameters must be populated in order to send to Azure. - :ivar kind: Required. The kind of the provider.Constant filled by server. + :ivar kind: The kind of the provider. Required. :vartype kind: str """ _validation = { - 'kind': {'required': True}, + "kind": {"required": True}, } _attribute_map = { - 'kind': {'key': 'kind', 'type': 'str'}, + "kind": {"key": "kind", "type": "str"}, } - _subtype_map = { - 'kind': {'AADIdentityProvider': 'OpenShiftManagedClusterAADIdentityProvider'} - } + _subtype_map = {"kind": {"AADIdentityProvider": "OpenShiftManagedClusterAADIdentityProvider"}} - def __init__( - self, - **kwargs - ): - """ - """ - super(OpenShiftManagedClusterBaseIdentityProvider, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.kind = None # type: Optional[str] @@ -323,7 +312,7 @@ class OpenShiftManagedClusterAADIdentityProvider(OpenShiftManagedClusterBaseIden All required parameters must be populated in order to send to Azure. - :ivar kind: Required. The kind of the provider.Constant filled by server. + :ivar kind: The kind of the provider. Required. :vartype kind: str :ivar client_id: The clientId password associated with the provider. :vartype client_id: str @@ -336,15 +325,15 @@ class OpenShiftManagedClusterAADIdentityProvider(OpenShiftManagedClusterBaseIden """ _validation = { - 'kind': {'required': True}, + "kind": {"required": True}, } _attribute_map = { - 'kind': {'key': 'kind', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'secret': {'key': 'secret', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'customer_admin_group_id': {'key': 'customerAdminGroupId', 'type': 'str'}, + "kind": {"key": "kind", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + "secret": {"key": "secret", "type": "str"}, + "tenant_id": {"key": "tenantId", "type": "str"}, + "customer_admin_group_id": {"key": "customerAdminGroupId", "type": "str"}, } def __init__( @@ -366,57 +355,57 @@ def __init__( :keyword customer_admin_group_id: The groupId to be granted cluster admin role. :paramtype customer_admin_group_id: str """ - super(OpenShiftManagedClusterAADIdentityProvider, self).__init__(**kwargs) - self.kind = 'AADIdentityProvider' # type: str + super().__init__(**kwargs) + self.kind = "AADIdentityProvider" # type: str self.client_id = client_id self.secret = secret self.tenant_id = tenant_id self.customer_admin_group_id = customer_admin_group_id -class OpenShiftManagedClusterAgentPoolProfile(msrest.serialization.Model): +class OpenShiftManagedClusterAgentPoolProfile(_serialization.Model): """Defines the configuration of the OpenShift cluster VMs. All required parameters must be populated in order to send to Azure. - :ivar name: Required. Unique name of the pool profile in the context of the subscription and - resource group. + :ivar name: Unique name of the pool profile in the context of the subscription and resource + group. Required. :vartype name: str - :ivar count: Required. Number of agents (VMs) to host docker containers. + :ivar count: Number of agents (VMs) to host docker containers. Required. :vartype count: int - :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_D2s_v3", + :ivar vm_size: Size of agent VMs. Required. Known values are: "Standard_D2s_v3", "Standard_D4s_v3", "Standard_D8s_v3", "Standard_D16s_v3", "Standard_D32s_v3", "Standard_D64s_v3", "Standard_DS4_v2", "Standard_DS5_v2", "Standard_F8s_v2", "Standard_F16s_v2", "Standard_F32s_v2", "Standard_F64s_v2", "Standard_F72s_v2", "Standard_F8s", "Standard_F16s", "Standard_E4s_v3", "Standard_E8s_v3", "Standard_E16s_v3", "Standard_E20s_v3", "Standard_E32s_v3", "Standard_E64s_v3", "Standard_GS2", "Standard_GS3", "Standard_GS4", "Standard_GS5", "Standard_DS12_v2", "Standard_DS13_v2", "Standard_DS14_v2", "Standard_DS15_v2", - "Standard_L4s", "Standard_L8s", "Standard_L16s", "Standard_L32s". + "Standard_L4s", "Standard_L8s", "Standard_L16s", and "Standard_L32s". :vartype vm_size: str or ~azure.mgmt.containerservice.v2018_09_30_preview.models.OpenShiftContainerServiceVMSize :ivar subnet_cidr: Subnet CIDR for the peering. :vartype subnet_cidr: str :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Known values are: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux" and "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2018_09_30_preview.models.OSType - :ivar role: Define the role of the AgentPoolProfile. Known values are: "compute", "infra". + :ivar role: Define the role of the AgentPoolProfile. Known values are: "compute" and "infra". :vartype role: str or ~azure.mgmt.containerservice.v2018_09_30_preview.models.OpenShiftAgentPoolProfileRole """ _validation = { - 'name': {'required': True}, - 'count': {'required': True}, - 'vm_size': {'required': True}, + "name": {"required": True}, + "count": {"required": True}, + "vm_size": {"required": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'count': {'key': 'count', 'type': 'int'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'subnet_cidr': {'key': 'subnetCidr', 'type': 'str'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'role': {'key': 'role', 'type': 'str'}, + "name": {"key": "name", "type": "str"}, + "count": {"key": "count", "type": "int"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "subnet_cidr": {"key": "subnetCidr", "type": "str"}, + "os_type": {"key": "osType", "type": "str"}, + "role": {"key": "role", "type": "str"}, } def __init__( @@ -425,37 +414,38 @@ def __init__( name: str, count: int, vm_size: Union[str, "_models.OpenShiftContainerServiceVMSize"], - subnet_cidr: Optional[str] = "10.0.0.0/24", - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + subnet_cidr: str = "10.0.0.0/24", + os_type: Union[str, "_models.OSType"] = "Linux", role: Optional[Union[str, "_models.OpenShiftAgentPoolProfileRole"]] = None, **kwargs ): """ - :keyword name: Required. Unique name of the pool profile in the context of the subscription and - resource group. + :keyword name: Unique name of the pool profile in the context of the subscription and resource + group. Required. :paramtype name: str - :keyword count: Required. Number of agents (VMs) to host docker containers. + :keyword count: Number of agents (VMs) to host docker containers. Required. :paramtype count: int - :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_D2s_v3", + :keyword vm_size: Size of agent VMs. Required. Known values are: "Standard_D2s_v3", "Standard_D4s_v3", "Standard_D8s_v3", "Standard_D16s_v3", "Standard_D32s_v3", "Standard_D64s_v3", "Standard_DS4_v2", "Standard_DS5_v2", "Standard_F8s_v2", "Standard_F16s_v2", "Standard_F32s_v2", "Standard_F64s_v2", "Standard_F72s_v2", "Standard_F8s", "Standard_F16s", "Standard_E4s_v3", "Standard_E8s_v3", "Standard_E16s_v3", "Standard_E20s_v3", "Standard_E32s_v3", "Standard_E64s_v3", "Standard_GS2", "Standard_GS3", "Standard_GS4", "Standard_GS5", "Standard_DS12_v2", "Standard_DS13_v2", "Standard_DS14_v2", "Standard_DS15_v2", - "Standard_L4s", "Standard_L8s", "Standard_L16s", "Standard_L32s". + "Standard_L4s", "Standard_L8s", "Standard_L16s", and "Standard_L32s". :paramtype vm_size: str or ~azure.mgmt.containerservice.v2018_09_30_preview.models.OpenShiftContainerServiceVMSize :keyword subnet_cidr: Subnet CIDR for the peering. :paramtype subnet_cidr: str :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux" and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2018_09_30_preview.models.OSType - :keyword role: Define the role of the AgentPoolProfile. Known values are: "compute", "infra". + :keyword role: Define the role of the AgentPoolProfile. Known values are: "compute" and + "infra". :paramtype role: str or ~azure.mgmt.containerservice.v2018_09_30_preview.models.OpenShiftAgentPoolProfileRole """ - super(OpenShiftManagedClusterAgentPoolProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.count = count self.vm_size = vm_size @@ -464,7 +454,7 @@ def __init__( self.role = role -class OpenShiftManagedClusterAuthProfile(msrest.serialization.Model): +class OpenShiftManagedClusterAuthProfile(_serialization.Model): """Defines all possible authentication profiles for the OpenShift cluster. :ivar identity_providers: Type of authentication profile to use. @@ -473,25 +463,22 @@ class OpenShiftManagedClusterAuthProfile(msrest.serialization.Model): """ _attribute_map = { - 'identity_providers': {'key': 'identityProviders', 'type': '[OpenShiftManagedClusterIdentityProvider]'}, + "identity_providers": {"key": "identityProviders", "type": "[OpenShiftManagedClusterIdentityProvider]"}, } def __init__( - self, - *, - identity_providers: Optional[List["_models.OpenShiftManagedClusterIdentityProvider"]] = None, - **kwargs + self, *, identity_providers: Optional[List["_models.OpenShiftManagedClusterIdentityProvider"]] = None, **kwargs ): """ :keyword identity_providers: Type of authentication profile to use. :paramtype identity_providers: list[~azure.mgmt.containerservice.v2018_09_30_preview.models.OpenShiftManagedClusterIdentityProvider] """ - super(OpenShiftManagedClusterAuthProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.identity_providers = identity_providers -class OpenShiftManagedClusterIdentityProvider(msrest.serialization.Model): +class OpenShiftManagedClusterIdentityProvider(_serialization.Model): """Defines the configuration of the identity providers to be used in the OpenShift cluster. :ivar name: Name of the provider. @@ -502,8 +489,8 @@ class OpenShiftManagedClusterIdentityProvider(msrest.serialization.Model): """ _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'provider': {'key': 'provider', 'type': 'OpenShiftManagedClusterBaseIdentityProvider'}, + "name": {"key": "name", "type": "str"}, + "provider": {"key": "provider", "type": "OpenShiftManagedClusterBaseIdentityProvider"}, } def __init__( @@ -520,12 +507,12 @@ def __init__( :paramtype provider: ~azure.mgmt.containerservice.v2018_09_30_preview.models.OpenShiftManagedClusterBaseIdentityProvider """ - super(OpenShiftManagedClusterIdentityProvider, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.provider = provider -class OpenShiftManagedClusterListResult(msrest.serialization.Model): +class OpenShiftManagedClusterListResult(_serialization.Model): """The response from the List OpenShift Managed Clusters operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -538,31 +525,26 @@ class OpenShiftManagedClusterListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[OpenShiftManagedCluster]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[OpenShiftManagedCluster]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.OpenShiftManagedCluster"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.OpenShiftManagedCluster"]] = None, **kwargs): """ :keyword value: The list of OpenShift managed clusters. :paramtype value: list[~azure.mgmt.containerservice.v2018_09_30_preview.models.OpenShiftManagedCluster] """ - super(OpenShiftManagedClusterListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class OpenShiftManagedClusterMasterPoolProfile(msrest.serialization.Model): +class OpenShiftManagedClusterMasterPoolProfile(_serialization.Model): """OpenShiftManagedClusterMaterPoolProfile contains configuration for OpenShift master VMs. All required parameters must be populated in order to send to Azure. @@ -570,37 +552,37 @@ class OpenShiftManagedClusterMasterPoolProfile(msrest.serialization.Model): :ivar name: Unique name of the master pool profile in the context of the subscription and resource group. :vartype name: str - :ivar count: Required. Number of masters (VMs) to host docker containers. The default value is - 3. + :ivar count: Number of masters (VMs) to host docker containers. The default value is 3. + Required. :vartype count: int - :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_D2s_v3", + :ivar vm_size: Size of agent VMs. Required. Known values are: "Standard_D2s_v3", "Standard_D4s_v3", "Standard_D8s_v3", "Standard_D16s_v3", "Standard_D32s_v3", "Standard_D64s_v3", "Standard_DS4_v2", "Standard_DS5_v2", "Standard_F8s_v2", "Standard_F16s_v2", "Standard_F32s_v2", "Standard_F64s_v2", "Standard_F72s_v2", "Standard_F8s", "Standard_F16s", "Standard_E4s_v3", "Standard_E8s_v3", "Standard_E16s_v3", "Standard_E20s_v3", "Standard_E32s_v3", "Standard_E64s_v3", "Standard_GS2", "Standard_GS3", "Standard_GS4", "Standard_GS5", "Standard_DS12_v2", "Standard_DS13_v2", "Standard_DS14_v2", "Standard_DS15_v2", - "Standard_L4s", "Standard_L8s", "Standard_L16s", "Standard_L32s". + "Standard_L4s", "Standard_L8s", "Standard_L16s", and "Standard_L32s". :vartype vm_size: str or ~azure.mgmt.containerservice.v2018_09_30_preview.models.OpenShiftContainerServiceVMSize :ivar subnet_cidr: Subnet CIDR for the peering. :vartype subnet_cidr: str :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Known values are: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux" and "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2018_09_30_preview.models.OSType """ _validation = { - 'count': {'required': True}, - 'vm_size': {'required': True}, + "count": {"required": True}, + "vm_size": {"required": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'count': {'key': 'count', 'type': 'int'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'subnet_cidr': {'key': 'subnetCidr', 'type': 'str'}, - 'os_type': {'key': 'osType', 'type': 'str'}, + "name": {"key": "name", "type": "str"}, + "count": {"key": "count", "type": "int"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "subnet_cidr": {"key": "subnetCidr", "type": "str"}, + "os_type": {"key": "osType", "type": "str"}, } def __init__( @@ -610,33 +592,33 @@ def __init__( vm_size: Union[str, "_models.OpenShiftContainerServiceVMSize"], name: Optional[str] = None, subnet_cidr: Optional[str] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", **kwargs ): """ :keyword name: Unique name of the master pool profile in the context of the subscription and resource group. :paramtype name: str - :keyword count: Required. Number of masters (VMs) to host docker containers. The default value - is 3. + :keyword count: Number of masters (VMs) to host docker containers. The default value is 3. + Required. :paramtype count: int - :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_D2s_v3", + :keyword vm_size: Size of agent VMs. Required. Known values are: "Standard_D2s_v3", "Standard_D4s_v3", "Standard_D8s_v3", "Standard_D16s_v3", "Standard_D32s_v3", "Standard_D64s_v3", "Standard_DS4_v2", "Standard_DS5_v2", "Standard_F8s_v2", "Standard_F16s_v2", "Standard_F32s_v2", "Standard_F64s_v2", "Standard_F72s_v2", "Standard_F8s", "Standard_F16s", "Standard_E4s_v3", "Standard_E8s_v3", "Standard_E16s_v3", "Standard_E20s_v3", "Standard_E32s_v3", "Standard_E64s_v3", "Standard_GS2", "Standard_GS3", "Standard_GS4", "Standard_GS5", "Standard_DS12_v2", "Standard_DS13_v2", "Standard_DS14_v2", "Standard_DS15_v2", - "Standard_L4s", "Standard_L8s", "Standard_L16s", "Standard_L32s". + "Standard_L4s", "Standard_L8s", "Standard_L16s", and "Standard_L32s". :paramtype vm_size: str or ~azure.mgmt.containerservice.v2018_09_30_preview.models.OpenShiftContainerServiceVMSize :keyword subnet_cidr: Subnet CIDR for the peering. :paramtype subnet_cidr: str :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux" and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2018_09_30_preview.models.OSType """ - super(OpenShiftManagedClusterMasterPoolProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.count = count self.vm_size = vm_size @@ -644,7 +626,7 @@ def __init__( self.os_type = os_type -class OpenShiftRouterProfile(msrest.serialization.Model): +class OpenShiftRouterProfile(_serialization.Model): """Represents an OpenShift router. Variables are only populated by the server, and will be ignored when sending a request. @@ -658,35 +640,29 @@ class OpenShiftRouterProfile(msrest.serialization.Model): """ _validation = { - 'fqdn': {'readonly': True}, + "fqdn": {"readonly": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'public_subdomain': {'key': 'publicSubdomain', 'type': 'str'}, - 'fqdn': {'key': 'fqdn', 'type': 'str'}, + "name": {"key": "name", "type": "str"}, + "public_subdomain": {"key": "publicSubdomain", "type": "str"}, + "fqdn": {"key": "fqdn", "type": "str"}, } - def __init__( - self, - *, - name: Optional[str] = None, - public_subdomain: Optional[str] = None, - **kwargs - ): + def __init__(self, *, name: Optional[str] = None, public_subdomain: Optional[str] = None, **kwargs): """ :keyword name: Name of the router profile. :paramtype name: str :keyword public_subdomain: DNS subdomain for OpenShift router. :paramtype public_subdomain: str """ - super(OpenShiftRouterProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.public_subdomain = public_subdomain self.fqdn = None -class PurchasePlan(msrest.serialization.Model): +class PurchasePlan(_serialization.Model): """Used for establishing the purchase context of any 3rd Party artifact through MarketPlace. :ivar name: The plan ID. @@ -701,10 +677,10 @@ class PurchasePlan(msrest.serialization.Model): """ _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'product': {'key': 'product', 'type': 'str'}, - 'promotion_code': {'key': 'promotionCode', 'type': 'str'}, - 'publisher': {'key': 'publisher', 'type': 'str'}, + "name": {"key": "name", "type": "str"}, + "product": {"key": "product", "type": "str"}, + "promotion_code": {"key": "promotionCode", "type": "str"}, + "publisher": {"key": "publisher", "type": "str"}, } def __init__( @@ -727,33 +703,28 @@ def __init__( :keyword publisher: The plan ID. :paramtype publisher: str """ - super(PurchasePlan, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.product = product self.promotion_code = promotion_code self.publisher = publisher -class TagsObject(msrest.serialization.Model): +class TagsObject(_serialization.Model): """Tags object for patch operations. - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] """ _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] """ - super(TagsObject, self).__init__(**kwargs) + super().__init__(**kwargs) self.tags = tags diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/models/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/models/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/models/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/models/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/operations/__init__.py index 211a87879804..69775b67d4ba 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/operations/__init__.py @@ -11,8 +11,9 @@ from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'OpenShiftManagedClustersOperations', + "OpenShiftManagedClustersOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/operations/_open_shift_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/operations/_open_shift_managed_clusters_operations.py index ed6e6e435ab6..f9663c1d60da 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/operations/_open_shift_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/operations/_open_shift_managed_clusters_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,243 +27,197 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-09-30-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-30-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/openShiftManagedClusters") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/openShiftManagedClusters" + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_resource_group_request( - subscription_id: str, - resource_group_name: str, - **kwargs: Any -) -> HttpRequest: +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-09-30-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-30-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters", + ) # 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', min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: + _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, resource_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-09-30-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-30-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.OpenShiftManagedCluster] = None, - content: Any = None, - **kwargs: Any + _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, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-09-30-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-30-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) - - -def build_update_tags_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.TagsObject] = None, - content: Any = None, - **kwargs: Any + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_tags_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-09-30-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-30-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-09-30-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-30-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class OpenShiftManagedClustersOperations: """ @@ -279,41 +238,36 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.OpenShiftManagedClusterListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.OpenShiftManagedCluster"]: """Gets a list of OpenShift managed clusters in the specified subscription. Gets a list of OpenShift managed clusters in the specified subscription. The operation returns properties of each OpenShift managed cluster. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OpenShiftManagedClusterListResult or the result of + :return: An iterator like instance of either OpenShiftManagedCluster or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2018_09_30_preview.models.OpenShiftManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2018_09_30_preview.models.OpenShiftManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-09-30-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-30-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OpenShiftManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -321,14 +275,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -344,10 +295,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -357,50 +306,45 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/openShiftManagedClusters"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/openShiftManagedClusters"} # type: ignore @distributed_trace def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> Iterable[_models.OpenShiftManagedClusterListResult]: + self, resource_group_name: str, **kwargs: Any + ) -> Iterable["_models.OpenShiftManagedCluster"]: """Lists OpenShift managed clusters in the specified subscription and resource group. Lists OpenShift managed clusters in the specified subscription and resource group. The operation returns properties of each OpenShift managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OpenShiftManagedClusterListResult or the result of + :return: An iterator like instance of either OpenShiftManagedCluster or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2018_09_30_preview.models.OpenShiftManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2018_09_30_preview.models.OpenShiftManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-09-30-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-30-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OpenShiftManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -408,15 +352,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -432,10 +372,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -445,50 +383,40 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters"} # type: ignore @distributed_trace - def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.OpenShiftManagedCluster: + def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.OpenShiftManagedCluster: """Gets a OpenShift managed cluster. Gets the details of the managed OpenShift cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the OpenShift managed cluster resource. + :param resource_name: The name of the OpenShift managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: OpenShiftManagedCluster, or the result of cls(response) + :return: OpenShiftManagedCluster or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2018_09_30_preview.models.OpenShiftManagedCluster - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-09-30-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-30-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OpenShiftManagedCluster] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -496,55 +424,58 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('OpenShiftManagedCluster', pipeline_response) + deserialized = self._deserialize("OpenShiftManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore def _create_or_update_initial( self, resource_group_name: str, resource_name: str, - parameters: _models.OpenShiftManagedCluster, + parameters: Union[_models.OpenShiftManagedCluster, IO], **kwargs: Any ) -> _models.OpenShiftManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2018-09-30-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-30-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.OpenShiftManagedCluster] - _json = self._serialize.body(parameters, 'OpenShiftManagedCluster') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "OpenShiftManagedCluster") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -552,10 +483,9 @@ def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -563,25 +493,26 @@ def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('OpenShiftManagedCluster', pipeline_response) + deserialized = self._deserialize("OpenShiftManagedCluster", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('OpenShiftManagedCluster', pipeline_response) + deserialized = self._deserialize("OpenShiftManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore - - @distributed_trace + @overload def begin_create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.OpenShiftManagedCluster, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.OpenShiftManagedCluster]: """Creates or updates an OpenShift managed cluster. @@ -589,14 +520,17 @@ def begin_create_or_update( Creates or updates a OpenShift managed cluster with the specified configuration for agents and OpenShift version. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the OpenShift managed cluster resource. + :param resource_name: The name of the OpenShift managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Create or Update an OpenShift Managed Cluster - operation. + operation. Required. :type parameters: ~azure.mgmt.containerservice.v2018_09_30_preview.models.OpenShiftManagedCluster + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -609,20 +543,96 @@ def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2018_09_30_preview.models.OpenShiftManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OpenShiftManagedCluster]: + """Creates or updates an OpenShift managed cluster. + + Creates or updates a OpenShift managed cluster with the specified configuration for agents and + OpenShift version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the OpenShift managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Create or Update an OpenShift Managed Cluster + operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either OpenShiftManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2018_09_30_preview.models.OpenShiftManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.OpenShiftManagedCluster, IO], + **kwargs: Any + ) -> LROPoller[_models.OpenShiftManagedCluster]: + """Creates or updates an OpenShift managed cluster. + + Creates or updates a OpenShift managed cluster with the specified configuration for agents and + OpenShift version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the OpenShift managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Create or Update an OpenShift Managed Cluster + operation. Is either a model type or a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2018_09_30_preview.models.OpenShiftManagedCluster or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either OpenShiftManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2018_09_30_preview.models.OpenShiftManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-09-30-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-30-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.OpenShiftManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -630,69 +640,66 @@ def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('OpenShiftManagedCluster', pipeline_response) + deserialized = self._deserialize("OpenShiftManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore def _update_tags_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.TagsObject, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any ) -> _models.OpenShiftManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2018-09-30-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-30-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.OpenShiftManagedCluster] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request_initial( - subscription_id=self._config.subscription_id, + request = build_update_tags_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_tags_initial.metadata['url'], + content=_content, + template_url=self._update_tags_initial.metadata["url"], headers=_headers, params=_params, ) @@ -700,44 +707,87 @@ def _update_tags_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('OpenShiftManagedCluster', pipeline_response) + deserialized = self._deserialize("OpenShiftManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_tags_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore + _update_tags_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore - - @distributed_trace + @overload def begin_update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.OpenShiftManagedCluster]: """Updates tags on an OpenShift managed cluster. Updates an OpenShift managed cluster with the specified tags. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the OpenShift managed cluster resource. + :param resource_name: The name of the OpenShift managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Update OpenShift Managed Cluster Tags operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2018_09_30_preview.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either OpenShiftManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2018_09_30_preview.models.OpenShiftManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OpenShiftManagedCluster]: + """Updates tags on an OpenShift managed cluster. + + Updates an OpenShift managed cluster with the specified tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the OpenShift managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update OpenShift Managed Cluster Tags operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -750,20 +800,50 @@ def begin_update_tags( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2018_09_30_preview.models.OpenShiftManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> LROPoller[_models.OpenShiftManagedCluster]: + """Updates tags on an OpenShift managed cluster. + + Updates an OpenShift managed cluster with the specified tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the OpenShift managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update OpenShift Managed Cluster Tags operation. + Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2018_09_30_preview.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either OpenShiftManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2018_09_30_preview.models.OpenShiftManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-09-30-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-30-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.OpenShiftManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, @@ -771,64 +851,54 @@ def begin_update_tags( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('OpenShiftManagedCluster', pipeline_response) + deserialized = self._deserialize("OpenShiftManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore + begin_update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-09-30-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-30-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -836,10 +906,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -849,23 +918,17 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> LROPoller[None]: + def begin_delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> LROPoller[None]: """Deletes an OpenShift managed cluster. Deletes the OpenShift managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the OpenShift managed cluster resource. + :param resource_name: The name of the OpenShift managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -877,52 +940,45 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-09-30-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-09-30-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/operations/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/__init__.py index 37a5f9e02e6f..a8716d29afe8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/__init__.py @@ -14,7 +14,8 @@ except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['ContainerServiceClient'] + +__all__ = ["ContainerServiceClient"] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/_configuration.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/_configuration.py index 4bb9db4392ea..55a9fdf734f5 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/_configuration.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/_configuration.py @@ -18,30 +18,26 @@ VERSION = "unknown" + class ContainerServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ContainerServiceClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2019-02-01". 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: + def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ContainerServiceClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2019-02-01") # type: str + api_version = kwargs.pop("api_version", "2019-02-01") # type: str if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -51,23 +47,24 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-containerservice/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-containerservice/{}".format(VERSION)) self._configure(**kwargs) def _configure( - self, - **kwargs # type: Any + self, **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/_container_service_client.py index f5c7b03bc284..5b191c73288a 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/_container_service_client.py @@ -9,12 +9,11 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from . import models +from .._serialization import Deserializer, Serializer from ._configuration import ContainerServiceClientConfiguration from .operations import AgentPoolsOperations, ManagedClustersOperations, Operations @@ -22,7 +21,8 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class ContainerServiceClient: + +class ContainerServiceClient: # pylint: disable=client-accepts-api-version-keyword """The Container Service Client. :ivar operations: Operations operations @@ -32,10 +32,10 @@ class ContainerServiceClient: azure.mgmt.containerservice.v2019_02_01.operations.ManagedClustersOperations :ivar agent_pools: AgentPoolsOperations operations :vartype agent_pools: azure.mgmt.containerservice.v2019_02_01.operations.AgentPoolsOperations - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -53,29 +53,22 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = ContainerServiceClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = ContainerServiceClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize - ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.managed_clusters = ManagedClustersOperations( self._client, self._config, self._serialize, self._deserialize ) - self.agent_pools = AgentPoolsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - + self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> HttpResponse: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -84,7 +77,7 @@ def _send_request( >>> response = client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/_metadata.json b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/_metadata.json index e629e12f32d0..d7ddeb82392c 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/_metadata.json +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/_metadata.json @@ -10,20 +10,20 @@ "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { "credential": { - "signature": "credential, # type: \"TokenCredential\"", - "description": "Credential needed for the client to connect to Azure.", + "signature": "credential: \"TokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true }, "subscription_id": { - "signature": "subscription_id, # type: str", - "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "signature": "subscription_id: str,", + "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.", "docstring_type": "str", "required": true } @@ -31,13 +31,13 @@ "async": { "credential": { "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure.", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { "signature": "subscription_id: str,", - "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.", "docstring_type": "str", "required": true } @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=\"https://management.azure.com\", # type: str", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/_patch.py index 74e48ecd07cf..f99e77fef986 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/_patch.py @@ -28,4 +28,4 @@ # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + pass diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/_vendor.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/_vendor.py index 138f663c53a4..9aad73fc743e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/_vendor.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/_vendor.py @@ -7,6 +7,7 @@ from azure.core.pipeline.transport import HttpRequest + def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) @@ -14,6 +15,7 @@ def _convert_request(request, files=None): request.set_formdata_body(files) return request + def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -21,7 +23,5 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [ - c for c in formatted_components if "{}".format(key.args[0]) not in c - ] + components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/aio/__init__.py index 37a5f9e02e6f..a8716d29afe8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/aio/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/aio/__init__.py @@ -14,7 +14,8 @@ except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['ContainerServiceClient'] + +__all__ = ["ContainerServiceClient"] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/aio/_configuration.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/aio/_configuration.py index 1b1d1f84616d..76304ecc6c3e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/aio/_configuration.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/aio/_configuration.py @@ -18,30 +18,26 @@ VERSION = "unknown" + class ContainerServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ContainerServiceClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2019-02-01". 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: + def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ContainerServiceClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2019-02-01") # type: str + api_version = kwargs.pop("api_version", "2019-02-01") # type: str if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -51,22 +47,21 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-containerservice/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-containerservice/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, - **kwargs: Any - ) -> None: - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/aio/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/aio/_container_service_client.py index dc20a61d1d5e..1d4b4af359fb 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/aio/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/aio/_container_service_client.py @@ -9,12 +9,11 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from .. import models +from ..._serialization import Deserializer, Serializer from ._configuration import ContainerServiceClientConfiguration from .operations import AgentPoolsOperations, ManagedClustersOperations, Operations @@ -22,7 +21,8 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class ContainerServiceClient: + +class ContainerServiceClient: # pylint: disable=client-accepts-api-version-keyword """The Container Service Client. :ivar operations: Operations operations @@ -33,10 +33,10 @@ class ContainerServiceClient: :ivar agent_pools: AgentPoolsOperations operations :vartype agent_pools: azure.mgmt.containerservice.v2019_02_01.aio.operations.AgentPoolsOperations - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -54,29 +54,22 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = ContainerServiceClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = ContainerServiceClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize - ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.managed_clusters = ManagedClustersOperations( self._client, self._config, self._serialize, self._deserialize ) - self.agent_pools = AgentPoolsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - + self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -85,7 +78,7 @@ def _send_request( >>> response = await client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/aio/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/aio/_patch.py index 74e48ecd07cf..f99e77fef986 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/aio/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/aio/_patch.py @@ -28,4 +28,4 @@ # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + pass diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/aio/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/aio/operations/__init__.py index 403c0174f052..ee6608454b6b 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/aio/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/aio/operations/__init__.py @@ -13,10 +13,11 @@ from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'Operations', - 'ManagedClustersOperations', - 'AgentPoolsOperations', + "Operations", + "ManagedClustersOperations", + "AgentPoolsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/aio/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/aio/operations/_agent_pools_operations.py index bd0017dc9f1f..565035fb5d8d 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/aio/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/aio/operations/_agent_pools_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +29,17 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._agent_pools_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request -T = TypeVar('T') +from ...operations._agent_pools_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class AgentPoolsOperations: """ .. warning:: @@ -45,48 +59,43 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list( - self, - resource_group_name: str, - managed_cluster_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.AgentPoolListResult]: + self, resource_group_name: str, managed_cluster_name: str, **kwargs: Any + ) -> AsyncIterable["_models.AgentPool"]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. The operation returns properties of each agent pool. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param managed_cluster_name: The name of the managed cluster resource. + :param managed_cluster_name: The name of the managed cluster resource. Required. :type managed_cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AgentPoolListResult or the result of cls(response) + :return: An iterator like instance of either AgentPool or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2019_02_01.models.AgentPoolListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2019_02_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, managed_cluster_name=managed_cluster_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -94,16 +103,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - managed_cluster_name=managed_cluster_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -119,10 +123,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -132,54 +134,45 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{managedClusterName}/agentPools"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{managedClusterName}/agentPools"} # type: ignore @distributed_trace_async async def get( - self, - resource_group_name: str, - managed_cluster_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, managed_cluster_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPool: """Gets the agent pool. Gets the details of the agent pool by managed cluster and resource group. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param managed_cluster_name: The name of the managed cluster resource. + :param managed_cluster_name: The name of the managed cluster resource. Required. :type managed_cluster_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPool, or the result of cls(response) + :return: AgentPool or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_02_01.models.AgentPool - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, managed_cluster_name=managed_cluster_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -187,57 +180,60 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{managedClusterName}/agentPools/{agentPoolName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{managedClusterName}/agentPools/{agentPoolName}"} # type: ignore async def _create_or_update_initial( self, resource_group_name: str, managed_cluster_name: str, agent_pool_name: str, - parameters: _models.AgentPool, + parameters: Union[_models.AgentPool, IO], **kwargs: Any ) -> _models.AgentPool: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - _json = self._serialize.body(parameters, 'AgentPool') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "AgentPool") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, managed_cluster_name=managed_cluster_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -245,10 +241,9 @@ async def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -256,40 +251,87 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{managedClusterName}/agentPools/{agentPoolName}"} # type: ignore + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{managedClusterName}/agentPools/{agentPoolName}"} # type: ignore - - @distributed_trace_async + @overload async def begin_create_or_update( self, resource_group_name: str, managed_cluster_name: str, agent_pool_name: str, parameters: _models.AgentPool, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.AgentPool]: """Creates or updates an agent pool. Creates or updates an agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param managed_cluster_name: The name of the managed cluster resource. + :param managed_cluster_name: The name of the managed cluster resource. Required. :type managed_cluster_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :param parameters: Parameters supplied to the Create or Update an agent pool operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2019_02_01.models.AgentPool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AgentPool or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2019_02_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + managed_cluster_name: str, + agent_pool_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AgentPool]: + """Creates or updates an agent pool. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param managed_cluster_name: The name of the managed cluster resource. Required. + :type managed_cluster_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: Parameters supplied to the Create or Update an agent pool operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -302,20 +344,57 @@ async def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2019_02_01.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + managed_cluster_name: str, + agent_pool_name: str, + parameters: Union[_models.AgentPool, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.AgentPool]: + """Creates or updates an agent pool. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param managed_cluster_name: The name of the managed cluster resource. Required. + :type managed_cluster_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: Parameters supplied to the Create or Update an agent pool operation. Is + either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2019_02_01.models.AgentPool or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AgentPool or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2019_02_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -324,66 +403,55 @@ async def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{managedClusterName}/agentPools/{agentPoolName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{managedClusterName}/agentPools/{agentPoolName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - managed_cluster_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, managed_cluster_name: str, agent_pool_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, managed_cluster_name=managed_cluster_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -391,10 +459,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -404,26 +471,21 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{managedClusterName}/agentPools/{agentPoolName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{managedClusterName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - managed_cluster_name: str, - agent_pool_name: str, - **kwargs: Any + async def begin_delete( + self, resource_group_name: str, managed_cluster_name: str, agent_pool_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes an agent pool. Deletes the agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param managed_cluster_name: The name of the managed cluster resource. + :param managed_cluster_name: The name of the managed cluster resource. Required. :type managed_cluster_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -435,53 +497,46 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, managed_cluster_name=managed_cluster_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{managedClusterName}/agentPools/{agentPoolName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{managedClusterName}/agentPools/{agentPoolName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/aio/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/aio/operations/_managed_clusters_operations.py index 97ebd3ac6231..4fc1400f6da8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/aio/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/aio/operations/_managed_clusters_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +29,25 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._managed_clusters_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_access_profile_request, build_get_request, build_get_upgrade_profile_request, build_list_by_resource_group_request, build_list_cluster_admin_credentials_request, build_list_cluster_user_credentials_request, build_list_request, build_reset_aad_profile_request_initial, build_reset_service_principal_profile_request_initial, build_update_tags_request_initial -T = TypeVar('T') +from ...operations._managed_clusters_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_access_profile_request, + build_get_request, + build_get_upgrade_profile_request, + build_list_by_resource_group_request, + build_list_cluster_admin_credentials_request, + build_list_cluster_user_credentials_request, + build_list_request, + build_reset_aad_profile_request, + build_reset_service_principal_profile_request, + build_update_tags_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class ManagedClustersOperations: """ .. warning:: @@ -45,41 +67,35 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.ManagedClusterListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.ManagedCluster"]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. The operation returns properties of each managed cluster. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2019_02_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2019_02_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -87,14 +103,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -110,10 +123,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -123,50 +134,44 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.ManagedClusterListResult]: + self, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ManagedCluster"]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. The operation returns properties of each managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2019_02_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2019_02_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -174,15 +179,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -198,10 +199,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -211,51 +210,43 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace_async async def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.ManagedClusterUpgradeProfile: """Gets upgrade profile for a managed cluster. Gets the details of the upgrade profile for a managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterUpgradeProfile, or the result of cls(response) + :return: ManagedClusterUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_02_01.models.ManagedClusterUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -263,69 +254,60 @@ async def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterUpgradeProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore @distributed_trace_async async def get_access_profile( - self, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, role_name: str, **kwargs: Any ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. Gets the accessProfile for the specified role name of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param role_name: The name of the role for managed cluster accessProfile resource. + :param role_name: The name of the role for managed cluster accessProfile resource. Required. :type role_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterAccessProfile, or the result of cls(response) + :return: ManagedClusterAccessProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_02_01.models.ManagedClusterAccessProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterAccessProfile] - request = build_get_access_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, role_name=role_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_access_profile.metadata['url'], + template_url=self.get_access_profile.metadata["url"], headers=_headers, params=_params, ) @@ -333,64 +315,56 @@ async def get_access_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterAccessProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterAccessProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_access_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore - + get_access_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore @distributed_trace_async async def list_cluster_admin_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster admin credential of a managed cluster. Gets cluster admin credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_02_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_admin_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_admin_credentials.metadata['url'], + template_url=self.list_cluster_admin_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -398,64 +372,56 @@ async def list_cluster_admin_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_admin_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore - + list_cluster_admin_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore @distributed_trace_async async def list_cluster_user_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster user credential of a managed cluster. Gets cluster user credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_02_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_user_credentials.metadata['url'], + template_url=self.list_cluster_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -463,64 +429,54 @@ async def list_cluster_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore - + list_cluster_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore @distributed_trace_async - async def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.ManagedCluster: + async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.ManagedCluster: """Gets a managed cluster. Gets the details of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedCluster, or the result of cls(response) + :return: ManagedCluster or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_02_01.models.ManagedCluster - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -528,55 +484,54 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _create_or_update_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.ManagedCluster, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'ManagedCluster') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedCluster") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -584,10 +539,9 @@ async def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -595,25 +549,26 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - @distributed_trace_async + @overload async def begin_create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedCluster, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. @@ -621,12 +576,90 @@ async def begin_create_or_update( Creates or updates a managed cluster with the specified configuration for agents and Kubernetes version. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2019_02_01.models.ManagedCluster + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2019_02_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster with the specified configuration for agents and Kubernetes + version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2019_02_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster with the specified configuration for agents and Kubernetes + version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. Is + either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2019_02_01.models.ManagedCluster or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -639,20 +672,17 @@ async def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2019_02_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -660,69 +690,66 @@ async def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _update_tags_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.TagsObject, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request_initial( - subscription_id=self._config.subscription_id, + request = build_update_tags_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_tags_initial.metadata['url'], + content=_content, + template_url=self._update_tags_initial.metadata["url"], headers=_headers, params=_params, ) @@ -730,44 +757,118 @@ async def _update_tags_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_tags_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _update_tags_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - @distributed_trace_async + @overload async def begin_update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates a managed cluster with the specified tags. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2019_02_01.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2019_02_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates a managed cluster with the specified tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2019_02_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates a managed cluster with the specified tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2019_02_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -780,20 +881,17 @@ async def begin_update_tags( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2019_02_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, @@ -801,64 +899,54 @@ async def begin_update_tags( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -866,10 +954,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -879,23 +966,17 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: + async def begin_delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Deletes a managed cluster. Deletes the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -907,85 +988,83 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterServicePrincipalProfile, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterServicePrincipalProfile") - request = build_reset_service_principal_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_service_principal_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_service_principal_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_service_principal_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -993,10 +1072,9 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1006,29 +1084,106 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist if cls: return cls(pipeline_response, None, {}) - _reset_service_principal_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + _reset_service_principal_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore - - @distributed_trace_async - async def begin_reset_service_principal_profile( # pylint: disable=inconsistent-return-statements + @overload + async def begin_reset_service_principal_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterServicePrincipalProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: """Reset Service Principal Profile of a managed cluster. Update the service principal Profile for a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a - Managed Cluster. + Managed Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2019_02_01.models.ManagedClusterServicePrincipalProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset Service Principal Profile of a managed cluster. + + Update the service principal Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a + Managed Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset Service Principal Profile of a managed cluster. + + Update the service principal Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a + Managed Cluster. Is either a model type or a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2019_02_01.models.ManagedClusterServicePrincipalProfile or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -1039,20 +1194,17 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1060,67 +1212,68 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_service_principal_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + begin_reset_service_principal_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterAADProfile, + parameters: Union[_models.ManagedClusterAADProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterAADProfile") - request = build_reset_aad_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_aad_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_aad_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_aad_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1128,10 +1281,9 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1141,28 +1293,105 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta if cls: return cls(pipeline_response, None, {}) - _reset_aad_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - + _reset_aad_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - @distributed_trace_async - async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements + @overload + async def begin_reset_aad_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterAADProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: """Reset AAD Profile of a managed cluster. Update the AAD Profile for a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed - Cluster. + Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2019_02_01.models.ManagedClusterAADProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset AAD Profile of a managed cluster. + + Update the AAD Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed + Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterAADProfile, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset AAD Profile of a managed cluster. + + Update the AAD Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed + Cluster. Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2019_02_01.models.ManagedClusterAADProfile or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -1173,20 +1402,17 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1194,34 +1420,30 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_aad_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + begin_reset_aad_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/aio/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/aio/operations/_operations.py index 33ab55379820..60835c01add7 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/aio/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/aio/operations/_operations.py @@ -7,9 +7,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,9 +27,11 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._operations import build_list_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class Operations: """ .. warning:: @@ -42,36 +51,31 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.OperationListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.OperationValue"]: """Gets a list of compute operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationListResult or the result of cls(response) + :return: An iterator like instance of either OperationValue or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2019_02_01.models.OperationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2019_02_01.models.OperationValue] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -79,13 +83,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -101,10 +103,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -114,8 +114,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.ContainerService/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ContainerService/operations"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/aio/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/aio/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/aio/operations/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/aio/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/models/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/models/__init__.py index 5ff60eebf8ec..37cb030fe014 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/models/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/models/__init__.py @@ -36,56 +36,54 @@ from ._models_py3 import SubResource from ._models_py3 import TagsObject - -from ._container_service_client_enums import ( - AgentPoolType, - ContainerServiceStorageProfileTypes, - ContainerServiceVMSizeTypes, - Count, - NetworkPlugin, - NetworkPolicy, - OSType, -) +from ._container_service_client_enums import AgentPoolType +from ._container_service_client_enums import ContainerServiceStorageProfileTypes +from ._container_service_client_enums import ContainerServiceVMSizeTypes +from ._container_service_client_enums import Count +from ._container_service_client_enums import NetworkPlugin +from ._container_service_client_enums import NetworkPolicy +from ._container_service_client_enums import OSType from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'AgentPool', - 'AgentPoolListResult', - 'CloudErrorBody', - 'ContainerServiceDiagnosticsProfile', - 'ContainerServiceLinuxProfile', - 'ContainerServiceMasterProfile', - 'ContainerServiceNetworkProfile', - 'ContainerServiceSshConfiguration', - 'ContainerServiceSshPublicKey', - 'ContainerServiceVMDiagnostics', - 'ContainerServiceWindowsProfile', - 'CredentialResult', - 'CredentialResults', - 'ManagedCluster', - 'ManagedClusterAADProfile', - 'ManagedClusterAccessProfile', - 'ManagedClusterAddonProfile', - 'ManagedClusterAgentPoolProfile', - 'ManagedClusterAgentPoolProfileProperties', - 'ManagedClusterListResult', - 'ManagedClusterPoolUpgradeProfile', - 'ManagedClusterServicePrincipalProfile', - 'ManagedClusterUpgradeProfile', - 'OperationListResult', - 'OperationValue', - 'OrchestratorProfile', - 'Resource', - 'SubResource', - 'TagsObject', - 'AgentPoolType', - 'ContainerServiceStorageProfileTypes', - 'ContainerServiceVMSizeTypes', - 'Count', - 'NetworkPlugin', - 'NetworkPolicy', - 'OSType', + "AgentPool", + "AgentPoolListResult", + "CloudErrorBody", + "ContainerServiceDiagnosticsProfile", + "ContainerServiceLinuxProfile", + "ContainerServiceMasterProfile", + "ContainerServiceNetworkProfile", + "ContainerServiceSshConfiguration", + "ContainerServiceSshPublicKey", + "ContainerServiceVMDiagnostics", + "ContainerServiceWindowsProfile", + "CredentialResult", + "CredentialResults", + "ManagedCluster", + "ManagedClusterAADProfile", + "ManagedClusterAccessProfile", + "ManagedClusterAddonProfile", + "ManagedClusterAgentPoolProfile", + "ManagedClusterAgentPoolProfileProperties", + "ManagedClusterListResult", + "ManagedClusterPoolUpgradeProfile", + "ManagedClusterServicePrincipalProfile", + "ManagedClusterUpgradeProfile", + "OperationListResult", + "OperationValue", + "OrchestratorProfile", + "Resource", + "SubResource", + "TagsObject", + "AgentPoolType", + "ContainerServiceStorageProfileTypes", + "ContainerServiceVMSizeTypes", + "Count", + "NetworkPlugin", + "NetworkPolicy", + "OSType", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/models/_container_service_client_enums.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/models/_container_service_client_enums.py index 2fec0b6f593f..10628cdcdd2e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/models/_container_service_client_enums.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/models/_container_service_client_enums.py @@ -18,6 +18,7 @@ class AgentPoolType(str, Enum, metaclass=CaseInsensitiveEnumMeta): VIRTUAL_MACHINE_SCALE_SETS = "VirtualMachineScaleSets" AVAILABILITY_SET = "AvailabilitySet" + class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the orchestrator choice. @@ -26,9 +27,9 @@ class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEn STORAGE_ACCOUNT = "StorageAccount" MANAGED_DISKS = "ManagedDisks" + class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Size of agent VMs. - """ + """Size of agent VMs.""" STANDARD_A1 = "Standard_A1" STANDARD_A10 = "Standard_A10" @@ -205,6 +206,7 @@ class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): STANDARD_NV24 = "Standard_NV24" STANDARD_NV6 = "Standard_NV6" + class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): """Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, and 5. The default value is 1. @@ -214,23 +216,23 @@ class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): THREE = 3 FIVE = 5 + class NetworkPlugin(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Network plugin used for building Kubernetes network. - """ + """Network plugin used for building Kubernetes network.""" AZURE = "azure" KUBENET = "kubenet" + class NetworkPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Network policy used for building Kubernetes network. - """ + """Network policy used for building Kubernetes network.""" CALICO = "calico" AZURE = "azure" + class OSType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """OsType to be used to specify os type. Choose from Linux and Windows. Default to Linux. - """ + """OsType to be used to specify os type. Choose from Linux and Windows. Default to Linux.""" LINUX = "Linux" WINDOWS = "Windows" diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/models/_models_py3.py index da614ecc9d39..871bd5609f31 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/models/_models_py3.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/models/_models_py3.py @@ -1,4 +1,5 @@ # coding=utf-8 +# pylint: disable=too-many-lines # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -8,14 +9,14 @@ from typing import Dict, List, Optional, TYPE_CHECKING, Union -import msrest.serialization +from ... import _serialization if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - import __init__ as _models + from .. import models as _models -class SubResource(msrest.serialization.Model): +class SubResource(_serialization.Model): """Reference to another subresource. Variables are only populated by the server, and will be ignored when sending a request. @@ -30,30 +31,26 @@ class SubResource(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(SubResource, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.id = None self.name = None self.type = None -class AgentPool(SubResource): +class AgentPool(SubResource): # pylint: disable=too-many-instance-attributes """Agent Pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -105,7 +102,7 @@ class AgentPool(SubResource): "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :vartype vm_size: str or ~azure.mgmt.containerservice.v2019_02_01.models.ContainerServiceVMSizeTypes :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine @@ -117,7 +114,7 @@ class AgentPool(SubResource): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Known values are: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux" and "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2019_02_01.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -126,7 +123,7 @@ class AgentPool(SubResource): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar type_properties_type: AgentPoolType represents types of an agent pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :vartype type_properties_type: str or ~azure.mgmt.containerservice.v2019_02_01.models.AgentPoolType :ivar orchestrator_version: Version of orchestrator specified when creating the managed @@ -141,42 +138,42 @@ class AgentPool(SubResource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'count': {'maximum': 100, 'minimum': 1}, - 'os_disk_size_gb': {'maximum': 1023, 'minimum': 0}, - 'provisioning_state': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "count": {"maximum": 100, "minimum": 1}, + "os_disk_size_gb": {"maximum": 1023, "minimum": 0}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'count': {'key': 'properties.count', 'type': 'int'}, - 'vm_size': {'key': 'properties.vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'properties.osDiskSizeGB', 'type': 'int'}, - 'vnet_subnet_id': {'key': 'properties.vnetSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'properties.maxPods', 'type': 'int'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'max_count': {'key': 'properties.maxCount', 'type': 'int'}, - 'min_count': {'key': 'properties.minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'properties.enableAutoScaling', 'type': 'bool'}, - 'type_properties_type': {'key': 'properties.type', 'type': 'str'}, - 'orchestrator_version': {'key': 'properties.orchestratorVersion', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'availability_zones': {'key': 'properties.availabilityZones', 'type': '[str]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "count": {"key": "properties.count", "type": "int"}, + "vm_size": {"key": "properties.vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "properties.osDiskSizeGB", "type": "int"}, + "vnet_subnet_id": {"key": "properties.vnetSubnetID", "type": "str"}, + "max_pods": {"key": "properties.maxPods", "type": "int"}, + "os_type": {"key": "properties.osType", "type": "str"}, + "max_count": {"key": "properties.maxCount", "type": "int"}, + "min_count": {"key": "properties.minCount", "type": "int"}, + "enable_auto_scaling": {"key": "properties.enableAutoScaling", "type": "bool"}, + "type_properties_type": {"key": "properties.type", "type": "str"}, + "orchestrator_version": {"key": "properties.orchestratorVersion", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "availability_zones": {"key": "properties.availabilityZones", "type": "[str]"}, } def __init__( self, *, - count: Optional[int] = 1, + count: int = 1, vm_size: Optional[Union[str, "_models.ContainerServiceVMSizeTypes"]] = None, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, @@ -226,7 +223,7 @@ def __init__( "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :paramtype vm_size: str or ~azure.mgmt.containerservice.v2019_02_01.models.ContainerServiceVMSizeTypes :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every @@ -238,7 +235,7 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux" and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2019_02_01.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -247,7 +244,7 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword type_properties_type: AgentPoolType represents types of an agent pool. Known values - are: "VirtualMachineScaleSets", "AvailabilitySet". + are: "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type_properties_type: str or ~azure.mgmt.containerservice.v2019_02_01.models.AgentPoolType :keyword orchestrator_version: Version of orchestrator specified when creating the managed @@ -257,7 +254,7 @@ def __init__( VirtualMachineScaleSets AgentPoolType. :paramtype availability_zones: list[str] """ - super(AgentPool, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.vm_size = vm_size self.os_disk_size_gb = os_disk_size_gb @@ -273,7 +270,7 @@ def __init__( self.availability_zones = availability_zones -class AgentPoolListResult(msrest.serialization.Model): +class AgentPoolListResult(_serialization.Model): """The response from the List Agent Pools operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -285,30 +282,25 @@ class AgentPoolListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[AgentPool]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[AgentPool]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.AgentPool"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.AgentPool"]] = None, **kwargs): """ :keyword value: The list of agent pools. :paramtype value: list[~azure.mgmt.containerservice.v2019_02_01.models.AgentPool] """ - super(AgentPoolListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class CloudErrorBody(msrest.serialization.Model): +class CloudErrorBody(_serialization.Model): """An error response from the Container service. :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed @@ -325,10 +317,10 @@ class CloudErrorBody(msrest.serialization.Model): """ _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[CloudErrorBody]"}, } def __init__( @@ -353,87 +345,76 @@ def __init__( :keyword details: A list of additional details about the error. :paramtype details: list[~azure.mgmt.containerservice.v2019_02_01.models.CloudErrorBody] """ - super(CloudErrorBody, self).__init__(**kwargs) + super().__init__(**kwargs) self.code = code self.message = message self.target = target self.details = details -class ContainerServiceDiagnosticsProfile(msrest.serialization.Model): +class ContainerServiceDiagnosticsProfile(_serialization.Model): """Profile for diagnostics on the container service cluster. All required parameters must be populated in order to send to Azure. - :ivar vm_diagnostics: Required. Profile for diagnostics on the container service VMs. + :ivar vm_diagnostics: Profile for diagnostics on the container service VMs. Required. :vartype vm_diagnostics: ~azure.mgmt.containerservice.v2019_02_01.models.ContainerServiceVMDiagnostics """ _validation = { - 'vm_diagnostics': {'required': True}, + "vm_diagnostics": {"required": True}, } _attribute_map = { - 'vm_diagnostics': {'key': 'vmDiagnostics', 'type': 'ContainerServiceVMDiagnostics'}, + "vm_diagnostics": {"key": "vmDiagnostics", "type": "ContainerServiceVMDiagnostics"}, } - def __init__( - self, - *, - vm_diagnostics: "_models.ContainerServiceVMDiagnostics", - **kwargs - ): + def __init__(self, *, vm_diagnostics: "_models.ContainerServiceVMDiagnostics", **kwargs): """ - :keyword vm_diagnostics: Required. Profile for diagnostics on the container service VMs. + :keyword vm_diagnostics: Profile for diagnostics on the container service VMs. Required. :paramtype vm_diagnostics: ~azure.mgmt.containerservice.v2019_02_01.models.ContainerServiceVMDiagnostics """ - super(ContainerServiceDiagnosticsProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.vm_diagnostics = vm_diagnostics -class ContainerServiceLinuxProfile(msrest.serialization.Model): +class ContainerServiceLinuxProfile(_serialization.Model): """Profile for Linux VMs in the container service cluster. All required parameters must be populated in order to send to Azure. - :ivar admin_username: Required. The administrator username to use for Linux VMs. + :ivar admin_username: The administrator username to use for Linux VMs. Required. :vartype admin_username: str - :ivar ssh: Required. SSH configuration for Linux-based VMs running on Azure. + :ivar ssh: SSH configuration for Linux-based VMs running on Azure. Required. :vartype ssh: ~azure.mgmt.containerservice.v2019_02_01.models.ContainerServiceSshConfiguration """ _validation = { - 'admin_username': {'required': True, 'pattern': r'^[A-Za-z][-A-Za-z0-9_]*$'}, - 'ssh': {'required': True}, + "admin_username": {"required": True, "pattern": r"^[A-Za-z][-A-Za-z0-9_]*$"}, + "ssh": {"required": True}, } _attribute_map = { - 'admin_username': {'key': 'adminUsername', 'type': 'str'}, - 'ssh': {'key': 'ssh', 'type': 'ContainerServiceSshConfiguration'}, + "admin_username": {"key": "adminUsername", "type": "str"}, + "ssh": {"key": "ssh", "type": "ContainerServiceSshConfiguration"}, } - def __init__( - self, - *, - admin_username: str, - ssh: "_models.ContainerServiceSshConfiguration", - **kwargs - ): + def __init__(self, *, admin_username: str, ssh: "_models.ContainerServiceSshConfiguration", **kwargs): """ - :keyword admin_username: Required. The administrator username to use for Linux VMs. + :keyword admin_username: The administrator username to use for Linux VMs. Required. :paramtype admin_username: str - :keyword ssh: Required. SSH configuration for Linux-based VMs running on Azure. + :keyword ssh: SSH configuration for Linux-based VMs running on Azure. Required. :paramtype ssh: ~azure.mgmt.containerservice.v2019_02_01.models.ContainerServiceSshConfiguration """ - super(ContainerServiceLinuxProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.admin_username = admin_username self.ssh = ssh -class ContainerServiceMasterProfile(msrest.serialization.Model): +class ContainerServiceMasterProfile(_serialization.Model): """Profile for the container service master. Variables are only populated by the server, and will be ignored when sending a request. @@ -441,11 +422,11 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar count: Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, - and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". + and 5. The default value is 1. Known values are: 1, 3, and 5. :vartype count: int or ~azure.mgmt.containerservice.v2019_02_01.models.Count - :ivar dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. + :ivar dns_prefix: DNS prefix to be used to create the FQDN for the master pool. Required. :vartype dns_prefix: str - :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + :ivar vm_size: Size of agent VMs. Required. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -482,7 +463,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :vartype vm_size: str or ~azure.mgmt.containerservice.v2019_02_01.models.ContainerServiceVMSizeTypes :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine @@ -496,7 +477,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): :vartype first_consecutive_static_ip: str :ivar storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount" and "ManagedDisks". :vartype storage_profile: str or ~azure.mgmt.containerservice.v2019_02_01.models.ContainerServiceStorageProfileTypes :ivar fqdn: FQDN for the master pool. @@ -504,21 +485,21 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): """ _validation = { - 'dns_prefix': {'required': True}, - 'vm_size': {'required': True}, - 'os_disk_size_gb': {'maximum': 1023, 'minimum': 0}, - 'fqdn': {'readonly': True}, + "dns_prefix": {"required": True}, + "vm_size": {"required": True}, + "os_disk_size_gb": {"maximum": 1023, "minimum": 0}, + "fqdn": {"readonly": True}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'dns_prefix': {'key': 'dnsPrefix', 'type': 'str'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'first_consecutive_static_ip': {'key': 'firstConsecutiveStaticIP', 'type': 'str'}, - 'storage_profile': {'key': 'storageProfile', 'type': 'str'}, - 'fqdn': {'key': 'fqdn', 'type': 'str'}, + "count": {"key": "count", "type": "int"}, + "dns_prefix": {"key": "dnsPrefix", "type": "str"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "first_consecutive_static_ip": {"key": "firstConsecutiveStaticIP", "type": "str"}, + "storage_profile": {"key": "storageProfile", "type": "str"}, + "fqdn": {"key": "fqdn", "type": "str"}, } def __init__( @@ -526,20 +507,20 @@ def __init__( *, dns_prefix: str, vm_size: Union[str, "_models.ContainerServiceVMSizeTypes"], - count: Optional[Union[int, "_models.Count"]] = 1, + count: Union[int, "_models.Count"] = 1, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, - first_consecutive_static_ip: Optional[str] = "10.240.255.5", + first_consecutive_static_ip: str = "10.240.255.5", storage_profile: Optional[Union[str, "_models.ContainerServiceStorageProfileTypes"]] = None, **kwargs ): """ :keyword count: Number of masters (VMs) in the container service cluster. Allowed values are 1, - 3, and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". + 3, and 5. The default value is 1. Known values are: 1, 3, and 5. :paramtype count: int or ~azure.mgmt.containerservice.v2019_02_01.models.Count - :keyword dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. + :keyword dns_prefix: DNS prefix to be used to create the FQDN for the master pool. Required. :paramtype dns_prefix: str - :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + :keyword vm_size: Size of agent VMs. Required. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -576,7 +557,7 @@ def __init__( "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :paramtype vm_size: str or ~azure.mgmt.containerservice.v2019_02_01.models.ContainerServiceVMSizeTypes :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every @@ -590,11 +571,11 @@ def __init__( :paramtype first_consecutive_static_ip: str :keyword storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount" and "ManagedDisks". :paramtype storage_profile: str or ~azure.mgmt.containerservice.v2019_02_01.models.ContainerServiceStorageProfileTypes """ - super(ContainerServiceMasterProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.dns_prefix = dns_prefix self.vm_size = vm_size @@ -605,14 +586,14 @@ def __init__( self.fqdn = None -class ContainerServiceNetworkProfile(msrest.serialization.Model): +class ContainerServiceNetworkProfile(_serialization.Model): """Profile of network configuration. :ivar network_plugin: Network plugin used for building Kubernetes network. Known values are: - "azure", "kubenet". Default value: "kubenet". + "azure" and "kubenet". :vartype network_plugin: str or ~azure.mgmt.containerservice.v2019_02_01.models.NetworkPlugin :ivar network_policy: Network policy used for building Kubernetes network. Known values are: - "calico", "azure". + "calico" and "azure". :vartype network_policy: str or ~azure.mgmt.containerservice.v2019_02_01.models.NetworkPolicy :ivar pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :vartype pod_cidr: str @@ -628,38 +609,40 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): """ _validation = { - 'pod_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, - 'service_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, - 'dns_service_ip': {'pattern': r'^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$'}, - 'docker_bridge_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, + "pod_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, + "service_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, + "dns_service_ip": { + "pattern": r"^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$" + }, + "docker_bridge_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, } _attribute_map = { - 'network_plugin': {'key': 'networkPlugin', 'type': 'str'}, - 'network_policy': {'key': 'networkPolicy', 'type': 'str'}, - 'pod_cidr': {'key': 'podCidr', 'type': 'str'}, - 'service_cidr': {'key': 'serviceCidr', 'type': 'str'}, - 'dns_service_ip': {'key': 'dnsServiceIP', 'type': 'str'}, - 'docker_bridge_cidr': {'key': 'dockerBridgeCidr', 'type': 'str'}, + "network_plugin": {"key": "networkPlugin", "type": "str"}, + "network_policy": {"key": "networkPolicy", "type": "str"}, + "pod_cidr": {"key": "podCidr", "type": "str"}, + "service_cidr": {"key": "serviceCidr", "type": "str"}, + "dns_service_ip": {"key": "dnsServiceIP", "type": "str"}, + "docker_bridge_cidr": {"key": "dockerBridgeCidr", "type": "str"}, } def __init__( self, *, - network_plugin: Optional[Union[str, "_models.NetworkPlugin"]] = "kubenet", + network_plugin: Union[str, "_models.NetworkPlugin"] = "kubenet", network_policy: Optional[Union[str, "_models.NetworkPolicy"]] = None, - pod_cidr: Optional[str] = "10.244.0.0/16", - service_cidr: Optional[str] = "10.0.0.0/16", - dns_service_ip: Optional[str] = "10.0.0.10", - docker_bridge_cidr: Optional[str] = "172.17.0.1/16", + pod_cidr: str = "10.244.0.0/16", + service_cidr: str = "10.0.0.0/16", + dns_service_ip: str = "10.0.0.10", + docker_bridge_cidr: str = "172.17.0.1/16", **kwargs ): """ :keyword network_plugin: Network plugin used for building Kubernetes network. Known values are: - "azure", "kubenet". Default value: "kubenet". + "azure" and "kubenet". :paramtype network_plugin: str or ~azure.mgmt.containerservice.v2019_02_01.models.NetworkPlugin :keyword network_policy: Network policy used for building Kubernetes network. Known values are: - "calico", "azure". + "calico" and "azure". :paramtype network_policy: str or ~azure.mgmt.containerservice.v2019_02_01.models.NetworkPolicy :keyword pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :paramtype pod_cidr: str @@ -673,7 +656,7 @@ def __init__( must not overlap with any Subnet IP ranges or the Kubernetes service address range. :paramtype docker_bridge_cidr: str """ - super(ContainerServiceNetworkProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.network_plugin = network_plugin self.network_policy = network_policy self.pod_cidr = pod_cidr @@ -682,152 +665,134 @@ def __init__( self.docker_bridge_cidr = docker_bridge_cidr -class ContainerServiceSshConfiguration(msrest.serialization.Model): +class ContainerServiceSshConfiguration(_serialization.Model): """SSH configuration for Linux-based VMs running on Azure. All required parameters must be populated in order to send to Azure. - :ivar public_keys: Required. The list of SSH public keys used to authenticate with Linux-based - VMs. Only expect one key specified. + :ivar public_keys: The list of SSH public keys used to authenticate with Linux-based VMs. Only + expect one key specified. Required. :vartype public_keys: list[~azure.mgmt.containerservice.v2019_02_01.models.ContainerServiceSshPublicKey] """ _validation = { - 'public_keys': {'required': True}, + "public_keys": {"required": True}, } _attribute_map = { - 'public_keys': {'key': 'publicKeys', 'type': '[ContainerServiceSshPublicKey]'}, + "public_keys": {"key": "publicKeys", "type": "[ContainerServiceSshPublicKey]"}, } - def __init__( - self, - *, - public_keys: List["_models.ContainerServiceSshPublicKey"], - **kwargs - ): + def __init__(self, *, public_keys: List["_models.ContainerServiceSshPublicKey"], **kwargs): """ - :keyword public_keys: Required. The list of SSH public keys used to authenticate with - Linux-based VMs. Only expect one key specified. + :keyword public_keys: The list of SSH public keys used to authenticate with Linux-based VMs. + Only expect one key specified. Required. :paramtype public_keys: list[~azure.mgmt.containerservice.v2019_02_01.models.ContainerServiceSshPublicKey] """ - super(ContainerServiceSshConfiguration, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_keys = public_keys -class ContainerServiceSshPublicKey(msrest.serialization.Model): +class ContainerServiceSshPublicKey(_serialization.Model): """Contains information about SSH certificate public key data. All required parameters must be populated in order to send to Azure. - :ivar key_data: Required. Certificate public key used to authenticate with VMs through SSH. The - certificate must be in PEM format with or without headers. + :ivar key_data: Certificate public key used to authenticate with VMs through SSH. The + certificate must be in PEM format with or without headers. Required. :vartype key_data: str """ _validation = { - 'key_data': {'required': True}, + "key_data": {"required": True}, } _attribute_map = { - 'key_data': {'key': 'keyData', 'type': 'str'}, + "key_data": {"key": "keyData", "type": "str"}, } - def __init__( - self, - *, - key_data: str, - **kwargs - ): + def __init__(self, *, key_data: str, **kwargs): """ - :keyword key_data: Required. Certificate public key used to authenticate with VMs through SSH. - The certificate must be in PEM format with or without headers. + :keyword key_data: Certificate public key used to authenticate with VMs through SSH. The + certificate must be in PEM format with or without headers. Required. :paramtype key_data: str """ - super(ContainerServiceSshPublicKey, self).__init__(**kwargs) + super().__init__(**kwargs) self.key_data = key_data -class ContainerServiceVMDiagnostics(msrest.serialization.Model): +class ContainerServiceVMDiagnostics(_serialization.Model): """Profile for diagnostics on the container service VMs. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar enabled: Required. Whether the VM diagnostic agent is provisioned on the VM. + :ivar enabled: Whether the VM diagnostic agent is provisioned on the VM. Required. :vartype enabled: bool :ivar storage_uri: The URI of the storage account where diagnostics are stored. :vartype storage_uri: str """ _validation = { - 'enabled': {'required': True}, - 'storage_uri': {'readonly': True}, + "enabled": {"required": True}, + "storage_uri": {"readonly": True}, } _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'storage_uri': {'key': 'storageUri', 'type': 'str'}, + "enabled": {"key": "enabled", "type": "bool"}, + "storage_uri": {"key": "storageUri", "type": "str"}, } - def __init__( - self, - *, - enabled: bool, - **kwargs - ): + def __init__(self, *, enabled: bool, **kwargs): """ - :keyword enabled: Required. Whether the VM diagnostic agent is provisioned on the VM. + :keyword enabled: Whether the VM diagnostic agent is provisioned on the VM. Required. :paramtype enabled: bool """ - super(ContainerServiceVMDiagnostics, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.storage_uri = None -class ContainerServiceWindowsProfile(msrest.serialization.Model): +class ContainerServiceWindowsProfile(_serialization.Model): """Profile for Windows VMs in the container service cluster. All required parameters must be populated in order to send to Azure. - :ivar admin_username: Required. The administrator username to use for Windows VMs. + :ivar admin_username: The administrator username to use for Windows VMs. Required. :vartype admin_username: str - :ivar admin_password: Required. The administrator password to use for Windows VMs. + :ivar admin_password: The administrator password to use for Windows VMs. Required. :vartype admin_password: str """ _validation = { - 'admin_username': {'required': True, 'pattern': r'^[a-zA-Z0-9]+([._]?[a-zA-Z0-9]+)*$'}, - 'admin_password': {'required': True, 'pattern': r'^(?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$%\^&\*\(\)])[a-zA-Z\d!@#$%\^&\*\(\)]{12,123}$'}, + "admin_username": {"required": True, "pattern": r"^[a-zA-Z0-9]+([._]?[a-zA-Z0-9]+)*$"}, + "admin_password": { + "required": True, + "pattern": r"^(?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$%\^&\*\(\)])[a-zA-Z\d!@#$%\^&\*\(\)]{12,123}$", + }, } _attribute_map = { - 'admin_username': {'key': 'adminUsername', 'type': 'str'}, - 'admin_password': {'key': 'adminPassword', 'type': 'str'}, + "admin_username": {"key": "adminUsername", "type": "str"}, + "admin_password": {"key": "adminPassword", "type": "str"}, } - def __init__( - self, - *, - admin_username: str, - admin_password: str, - **kwargs - ): + def __init__(self, *, admin_username: str, admin_password: str, **kwargs): """ - :keyword admin_username: Required. The administrator username to use for Windows VMs. + :keyword admin_username: The administrator username to use for Windows VMs. Required. :paramtype admin_username: str - :keyword admin_password: Required. The administrator password to use for Windows VMs. + :keyword admin_password: The administrator password to use for Windows VMs. Required. :paramtype admin_password: str """ - super(ContainerServiceWindowsProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.admin_username = admin_username self.admin_password = admin_password -class CredentialResult(msrest.serialization.Model): +class CredentialResult(_serialization.Model): """The credential result response. Variables are only populated by the server, and will be ignored when sending a request. @@ -835,31 +800,27 @@ class CredentialResult(msrest.serialization.Model): :ivar name: The name of the credential. :vartype name: str :ivar value: Base64-encoded Kubernetes configuration file. - :vartype value: bytearray + :vartype value: bytes """ _validation = { - 'name': {'readonly': True}, - 'value': {'readonly': True}, + "name": {"readonly": True}, + "value": {"readonly": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'bytearray'}, + "name": {"key": "name", "type": "str"}, + "value": {"key": "value", "type": "bytearray"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(CredentialResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.name = None self.value = None -class CredentialResults(msrest.serialization.Model): +class CredentialResults(_serialization.Model): """The list of credential result response. Variables are only populated by the server, and will be ignored when sending a request. @@ -869,24 +830,20 @@ class CredentialResults(msrest.serialization.Model): """ _validation = { - 'kubeconfigs': {'readonly': True}, + "kubeconfigs": {"readonly": True}, } _attribute_map = { - 'kubeconfigs': {'key': 'kubeconfigs', 'type': '[CredentialResult]'}, + "kubeconfigs": {"key": "kubeconfigs", "type": "[CredentialResult]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(CredentialResults, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.kubeconfigs = None -class Resource(msrest.serialization.Model): +class Resource(_serialization.Model): """The Resource model definition. Variables are only populated by the server, and will be ignored when sending a request. @@ -899,41 +856,35 @@ class Resource(msrest.serialization.Model): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] """ - super(Resource, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -941,7 +892,7 @@ def __init__( self.tags = tags -class ManagedCluster(Resource): +class ManagedCluster(Resource): # pylint: disable=too-many-instance-attributes """Managed cluster. Variables are only populated by the server, and will be ignored when sending a request. @@ -954,9 +905,9 @@ class ManagedCluster(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar provisioning_state: The current deployment or provisioning state, which only appears in the response. @@ -998,35 +949,38 @@ class ManagedCluster(Resource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'provisioning_state': {'readonly': True}, - 'fqdn': {'readonly': True}, - 'node_resource_group': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, + "provisioning_state": {"readonly": True}, + "fqdn": {"readonly": True}, + "node_resource_group": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'kubernetes_version': {'key': 'properties.kubernetesVersion', 'type': 'str'}, - 'dns_prefix': {'key': 'properties.dnsPrefix', 'type': 'str'}, - 'fqdn': {'key': 'properties.fqdn', 'type': 'str'}, - 'agent_pool_profiles': {'key': 'properties.agentPoolProfiles', 'type': '[ManagedClusterAgentPoolProfile]'}, - 'linux_profile': {'key': 'properties.linuxProfile', 'type': 'ContainerServiceLinuxProfile'}, - 'service_principal_profile': {'key': 'properties.servicePrincipalProfile', 'type': 'ManagedClusterServicePrincipalProfile'}, - 'addon_profiles': {'key': 'properties.addonProfiles', 'type': '{ManagedClusterAddonProfile}'}, - 'node_resource_group': {'key': 'properties.nodeResourceGroup', 'type': 'str'}, - 'enable_rbac': {'key': 'properties.enableRBAC', 'type': 'bool'}, - 'enable_pod_security_policy': {'key': 'properties.enablePodSecurityPolicy', 'type': 'bool'}, - 'network_profile': {'key': 'properties.networkProfile', 'type': 'ContainerServiceNetworkProfile'}, - 'aad_profile': {'key': 'properties.aadProfile', 'type': 'ManagedClusterAADProfile'}, - 'api_server_authorized_ip_ranges': {'key': 'properties.apiServerAuthorizedIPRanges', 'type': '[str]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "dns_prefix": {"key": "properties.dnsPrefix", "type": "str"}, + "fqdn": {"key": "properties.fqdn", "type": "str"}, + "agent_pool_profiles": {"key": "properties.agentPoolProfiles", "type": "[ManagedClusterAgentPoolProfile]"}, + "linux_profile": {"key": "properties.linuxProfile", "type": "ContainerServiceLinuxProfile"}, + "service_principal_profile": { + "key": "properties.servicePrincipalProfile", + "type": "ManagedClusterServicePrincipalProfile", + }, + "addon_profiles": {"key": "properties.addonProfiles", "type": "{ManagedClusterAddonProfile}"}, + "node_resource_group": {"key": "properties.nodeResourceGroup", "type": "str"}, + "enable_rbac": {"key": "properties.enableRBAC", "type": "bool"}, + "enable_pod_security_policy": {"key": "properties.enablePodSecurityPolicy", "type": "bool"}, + "network_profile": {"key": "properties.networkProfile", "type": "ContainerServiceNetworkProfile"}, + "aad_profile": {"key": "properties.aadProfile", "type": "ManagedClusterAADProfile"}, + "api_server_authorized_ip_ranges": {"key": "properties.apiServerAuthorizedIPRanges", "type": "[str]"}, } def __init__( @@ -1048,9 +1002,9 @@ def __init__( **kwargs ): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword kubernetes_version: Version of Kubernetes specified when creating the managed cluster. :paramtype kubernetes_version: str @@ -1085,7 +1039,7 @@ def __init__( server. :paramtype api_server_authorized_ip_ranges: list[str] """ - super(ManagedCluster, self).__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.provisioning_state = None self.kubernetes_version = kubernetes_version self.dns_prefix = dns_prefix @@ -1102,14 +1056,14 @@ def __init__( self.api_server_authorized_ip_ranges = api_server_authorized_ip_ranges -class ManagedClusterAADProfile(msrest.serialization.Model): +class ManagedClusterAADProfile(_serialization.Model): """AADProfile specifies attributes for Azure Active Directory integration. All required parameters must be populated in order to send to Azure. - :ivar client_app_id: Required. The client AAD application ID. + :ivar client_app_id: The client AAD application ID. Required. :vartype client_app_id: str - :ivar server_app_id: Required. The server AAD application ID. + :ivar server_app_id: The server AAD application ID. Required. :vartype server_app_id: str :ivar server_app_secret: The server AAD application secret. :vartype server_app_secret: str @@ -1119,15 +1073,15 @@ class ManagedClusterAADProfile(msrest.serialization.Model): """ _validation = { - 'client_app_id': {'required': True}, - 'server_app_id': {'required': True}, + "client_app_id": {"required": True}, + "server_app_id": {"required": True}, } _attribute_map = { - 'client_app_id': {'key': 'clientAppID', 'type': 'str'}, - 'server_app_id': {'key': 'serverAppID', 'type': 'str'}, - 'server_app_secret': {'key': 'serverAppSecret', 'type': 'str'}, - 'tenant_id': {'key': 'tenantID', 'type': 'str'}, + "client_app_id": {"key": "clientAppID", "type": "str"}, + "server_app_id": {"key": "serverAppID", "type": "str"}, + "server_app_secret": {"key": "serverAppSecret", "type": "str"}, + "tenant_id": {"key": "tenantID", "type": "str"}, } def __init__( @@ -1140,9 +1094,9 @@ def __init__( **kwargs ): """ - :keyword client_app_id: Required. The client AAD application ID. + :keyword client_app_id: The client AAD application ID. Required. :paramtype client_app_id: str - :keyword server_app_id: Required. The server AAD application ID. + :keyword server_app_id: The server AAD application ID. Required. :paramtype server_app_id: str :keyword server_app_secret: The server AAD application secret. :paramtype server_app_secret: str @@ -1150,7 +1104,7 @@ def __init__( tenant of the deployment subscription. :paramtype tenant_id: str """ - super(ManagedClusterAADProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.client_app_id = client_app_id self.server_app_id = server_app_id self.server_app_secret = server_app_secret @@ -1170,99 +1124,88 @@ class ManagedClusterAccessProfile(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar kube_config: Base64-encoded Kubernetes configuration file. - :vartype kube_config: bytearray + :vartype kube_config: bytes """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'kube_config': {'key': 'properties.kubeConfig', 'type': 'bytearray'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "kube_config": {"key": "properties.kubeConfig", "type": "bytearray"}, } def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - kube_config: Optional[bytearray] = None, - **kwargs + self, *, location: str, tags: Optional[Dict[str, str]] = None, kube_config: Optional[bytes] = None, **kwargs ): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword kube_config: Base64-encoded Kubernetes configuration file. - :paramtype kube_config: bytearray + :paramtype kube_config: bytes """ - super(ManagedClusterAccessProfile, self).__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.kube_config = kube_config -class ManagedClusterAddonProfile(msrest.serialization.Model): +class ManagedClusterAddonProfile(_serialization.Model): """A Kubernetes add-on profile for a managed cluster. All required parameters must be populated in order to send to Azure. - :ivar enabled: Required. Whether the add-on is enabled or not. + :ivar enabled: Whether the add-on is enabled or not. Required. :vartype enabled: bool :ivar config: Key-value pairs for configuring an add-on. :vartype config: dict[str, str] """ _validation = { - 'enabled': {'required': True}, + "enabled": {"required": True}, } _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'config': {'key': 'config', 'type': '{str}'}, + "enabled": {"key": "enabled", "type": "bool"}, + "config": {"key": "config", "type": "{str}"}, } - def __init__( - self, - *, - enabled: bool, - config: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, enabled: bool, config: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword enabled: Required. Whether the add-on is enabled or not. + :keyword enabled: Whether the add-on is enabled or not. Required. :paramtype enabled: bool :keyword config: Key-value pairs for configuring an add-on. :paramtype config: dict[str, str] """ - super(ManagedClusterAddonProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.config = config -class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): +class ManagedClusterAgentPoolProfileProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes """Properties for the container service agent pool profile. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar count: Required. Number of agents (VMs) to host docker containers. Allowed values must be - in the range of 1 to 100 (inclusive). The default value is 1. + :ivar count: Number of agents (VMs) to host docker containers. Allowed values must be in the + range of 1 to 100 (inclusive). The default value is 1. :vartype count: int - :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + :ivar vm_size: Size of agent VMs. Required. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -1299,7 +1242,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :vartype vm_size: str or ~azure.mgmt.containerservice.v2019_02_01.models.ContainerServiceVMSizeTypes :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine @@ -1311,7 +1254,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Known values are: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux" and "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2019_02_01.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -1320,7 +1263,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar type: AgentPoolType represents types of an agent pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2019_02_01.models.AgentPoolType :ivar orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -1334,26 +1277,26 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): """ _validation = { - 'count': {'required': True, 'maximum': 100, 'minimum': 1}, - 'vm_size': {'required': True}, - 'os_disk_size_gb': {'maximum': 1023, 'minimum': 0}, - 'provisioning_state': {'readonly': True}, + "count": {"required": True, "maximum": 100, "minimum": 1}, + "vm_size": {"required": True}, + "os_disk_size_gb": {"maximum": 1023, "minimum": 0}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'maxPods', 'type': 'int'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'max_count': {'key': 'maxCount', 'type': 'int'}, - 'min_count': {'key': 'minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'enableAutoScaling', 'type': 'bool'}, - 'type': {'key': 'type', 'type': 'str'}, - 'orchestrator_version': {'key': 'orchestratorVersion', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'availability_zones': {'key': 'availabilityZones', 'type': '[str]'}, + "count": {"key": "count", "type": "int"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "max_pods": {"key": "maxPods", "type": "int"}, + "os_type": {"key": "osType", "type": "str"}, + "max_count": {"key": "maxCount", "type": "int"}, + "min_count": {"key": "minCount", "type": "int"}, + "enable_auto_scaling": {"key": "enableAutoScaling", "type": "bool"}, + "type": {"key": "type", "type": "str"}, + "orchestrator_version": {"key": "orchestratorVersion", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "availability_zones": {"key": "availabilityZones", "type": "[str]"}, } def __init__( @@ -1364,7 +1307,7 @@ def __init__( os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, @@ -1374,10 +1317,10 @@ def __init__( **kwargs ): """ - :keyword count: Required. Number of agents (VMs) to host docker containers. Allowed values must - be in the range of 1 to 100 (inclusive). The default value is 1. + :keyword count: Number of agents (VMs) to host docker containers. Allowed values must be in the + range of 1 to 100 (inclusive). The default value is 1. :paramtype count: int - :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + :keyword vm_size: Size of agent VMs. Required. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -1414,7 +1357,7 @@ def __init__( "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :paramtype vm_size: str or ~azure.mgmt.containerservice.v2019_02_01.models.ContainerServiceVMSizeTypes :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every @@ -1426,7 +1369,7 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux" and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2019_02_01.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -1435,7 +1378,7 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword type: AgentPoolType represents types of an agent pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2019_02_01.models.AgentPoolType :keyword orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -1444,7 +1387,7 @@ def __init__( VirtualMachineScaleSets AgentPoolType. :paramtype availability_zones: list[str] """ - super(ManagedClusterAgentPoolProfileProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.vm_size = vm_size self.os_disk_size_gb = os_disk_size_gb @@ -1460,17 +1403,19 @@ def __init__( self.availability_zones = availability_zones -class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): +class ManagedClusterAgentPoolProfile( + ManagedClusterAgentPoolProfileProperties +): # pylint: disable=too-many-instance-attributes """Profile for the container service agent pool. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar count: Required. Number of agents (VMs) to host docker containers. Allowed values must be - in the range of 1 to 100 (inclusive). The default value is 1. + :ivar count: Number of agents (VMs) to host docker containers. Allowed values must be in the + range of 1 to 100 (inclusive). The default value is 1. :vartype count: int - :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + :ivar vm_size: Size of agent VMs. Required. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -1507,7 +1452,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :vartype vm_size: str or ~azure.mgmt.containerservice.v2019_02_01.models.ContainerServiceVMSizeTypes :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine @@ -1519,7 +1464,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Known values are: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux" and "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2019_02_01.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -1528,7 +1473,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar type: AgentPoolType represents types of an agent pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2019_02_01.models.AgentPoolType :ivar orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -1539,34 +1484,34 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar availability_zones: (PREVIEW) Availability zones for nodes. Must use VirtualMachineScaleSets AgentPoolType. :vartype availability_zones: list[str] - :ivar name: Required. Unique name of the agent pool profile in the context of the subscription - and resource group. + :ivar name: Unique name of the agent pool profile in the context of the subscription and + resource group. Required. :vartype name: str """ _validation = { - 'count': {'required': True, 'maximum': 100, 'minimum': 1}, - 'vm_size': {'required': True}, - 'os_disk_size_gb': {'maximum': 1023, 'minimum': 0}, - 'provisioning_state': {'readonly': True}, - 'name': {'required': True, 'pattern': r'^[a-z][a-z0-9]{0,11}$'}, + "count": {"required": True, "maximum": 100, "minimum": 1}, + "vm_size": {"required": True}, + "os_disk_size_gb": {"maximum": 1023, "minimum": 0}, + "provisioning_state": {"readonly": True}, + "name": {"required": True, "pattern": r"^[a-z][a-z0-9]{0,11}$"}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'maxPods', 'type': 'int'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'max_count': {'key': 'maxCount', 'type': 'int'}, - 'min_count': {'key': 'minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'enableAutoScaling', 'type': 'bool'}, - 'type': {'key': 'type', 'type': 'str'}, - 'orchestrator_version': {'key': 'orchestratorVersion', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'availability_zones': {'key': 'availabilityZones', 'type': '[str]'}, - 'name': {'key': 'name', 'type': 'str'}, + "count": {"key": "count", "type": "int"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "max_pods": {"key": "maxPods", "type": "int"}, + "os_type": {"key": "osType", "type": "str"}, + "max_count": {"key": "maxCount", "type": "int"}, + "min_count": {"key": "minCount", "type": "int"}, + "enable_auto_scaling": {"key": "enableAutoScaling", "type": "bool"}, + "type": {"key": "type", "type": "str"}, + "orchestrator_version": {"key": "orchestratorVersion", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "availability_zones": {"key": "availabilityZones", "type": "[str]"}, + "name": {"key": "name", "type": "str"}, } def __init__( @@ -1578,7 +1523,7 @@ def __init__( os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, @@ -1588,10 +1533,10 @@ def __init__( **kwargs ): """ - :keyword count: Required. Number of agents (VMs) to host docker containers. Allowed values must - be in the range of 1 to 100 (inclusive). The default value is 1. + :keyword count: Number of agents (VMs) to host docker containers. Allowed values must be in the + range of 1 to 100 (inclusive). The default value is 1. :paramtype count: int - :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + :keyword vm_size: Size of agent VMs. Required. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -1628,7 +1573,7 @@ def __init__( "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :paramtype vm_size: str or ~azure.mgmt.containerservice.v2019_02_01.models.ContainerServiceVMSizeTypes :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every @@ -1640,7 +1585,7 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux" and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2019_02_01.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -1649,7 +1594,7 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword type: AgentPoolType represents types of an agent pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2019_02_01.models.AgentPoolType :keyword orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -1657,15 +1602,29 @@ def __init__( :keyword availability_zones: (PREVIEW) Availability zones for nodes. Must use VirtualMachineScaleSets AgentPoolType. :paramtype availability_zones: list[str] - :keyword name: Required. Unique name of the agent pool profile in the context of the - subscription and resource group. + :keyword name: Unique name of the agent pool profile in the context of the subscription and + resource group. Required. :paramtype name: str """ - super(ManagedClusterAgentPoolProfile, self).__init__(count=count, vm_size=vm_size, os_disk_size_gb=os_disk_size_gb, vnet_subnet_id=vnet_subnet_id, max_pods=max_pods, os_type=os_type, max_count=max_count, min_count=min_count, enable_auto_scaling=enable_auto_scaling, type=type, orchestrator_version=orchestrator_version, availability_zones=availability_zones, **kwargs) + super().__init__( + count=count, + vm_size=vm_size, + os_disk_size_gb=os_disk_size_gb, + vnet_subnet_id=vnet_subnet_id, + max_pods=max_pods, + os_type=os_type, + max_count=max_count, + min_count=min_count, + enable_auto_scaling=enable_auto_scaling, + type=type, + orchestrator_version=orchestrator_version, + availability_zones=availability_zones, + **kwargs + ) self.name = name -class ManagedClusterListResult(msrest.serialization.Model): +class ManagedClusterListResult(_serialization.Model): """The response from the List Managed Clusters operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -1677,55 +1636,50 @@ class ManagedClusterListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[ManagedCluster]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[ManagedCluster]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.ManagedCluster"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.ManagedCluster"]] = None, **kwargs): """ :keyword value: The list of managed clusters. :paramtype value: list[~azure.mgmt.containerservice.v2019_02_01.models.ManagedCluster] """ - super(ManagedClusterListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): +class ManagedClusterPoolUpgradeProfile(_serialization.Model): """The list of available upgrade versions. All required parameters must be populated in order to send to Azure. - :ivar kubernetes_version: Required. Kubernetes version (major, minor, patch). + :ivar kubernetes_version: Kubernetes version (major, minor, patch). Required. :vartype kubernetes_version: str :ivar name: Pool name. :vartype name: str - :ivar os_type: Required. OsType to be used to specify os type. Choose from Linux and Windows. - Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to + Linux. Known values are: "Linux" and "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2019_02_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: list[str] """ _validation = { - 'kubernetes_version': {'required': True}, - 'os_type': {'required': True}, + "kubernetes_version": {"required": True}, + "os_type": {"required": True}, } _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'upgrades': {'key': 'upgrades', 'type': '[str]'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "os_type": {"key": "osType", "type": "str"}, + "upgrades": {"key": "upgrades", "type": "[str]"}, } def __init__( @@ -1738,62 +1692,56 @@ def __init__( **kwargs ): """ - :keyword kubernetes_version: Required. Kubernetes version (major, minor, patch). + :keyword kubernetes_version: Kubernetes version (major, minor, patch). Required. :paramtype kubernetes_version: str :keyword name: Pool name. :paramtype name: str - :keyword os_type: Required. OsType to be used to specify os type. Choose from Linux and - Windows. Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default + to Linux. Known values are: "Linux" and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2019_02_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: list[str] """ - super(ManagedClusterPoolUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.name = name self.os_type = os_type self.upgrades = upgrades -class ManagedClusterServicePrincipalProfile(msrest.serialization.Model): +class ManagedClusterServicePrincipalProfile(_serialization.Model): """Information about a service principal identity for the cluster to use for manipulating Azure APIs. All required parameters must be populated in order to send to Azure. - :ivar client_id: Required. The ID for the service principal. + :ivar client_id: The ID for the service principal. Required. :vartype client_id: str :ivar secret: The secret password associated with the service principal in plain text. :vartype secret: str """ _validation = { - 'client_id': {'required': True}, + "client_id": {"required": True}, } _attribute_map = { - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'secret': {'key': 'secret', 'type': 'str'}, + "client_id": {"key": "clientId", "type": "str"}, + "secret": {"key": "secret", "type": "str"}, } - def __init__( - self, - *, - client_id: str, - secret: Optional[str] = None, - **kwargs - ): + def __init__(self, *, client_id: str, secret: Optional[str] = None, **kwargs): """ - :keyword client_id: Required. The ID for the service principal. + :keyword client_id: The ID for the service principal. Required. :paramtype client_id: str :keyword secret: The secret password associated with the service principal in plain text. :paramtype secret: str """ - super(ManagedClusterServicePrincipalProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.client_id = client_id self.secret = secret -class ManagedClusterUpgradeProfile(msrest.serialization.Model): +class ManagedClusterUpgradeProfile(_serialization.Model): """The list of available upgrades for compute pools. Variables are only populated by the server, and will be ignored when sending a request. @@ -1806,29 +1754,29 @@ class ManagedClusterUpgradeProfile(msrest.serialization.Model): :vartype name: str :ivar type: Type of upgrade profile. :vartype type: str - :ivar control_plane_profile: Required. The list of available upgrade versions for the control - plane. + :ivar control_plane_profile: The list of available upgrade versions for the control plane. + Required. :vartype control_plane_profile: ~azure.mgmt.containerservice.v2019_02_01.models.ManagedClusterPoolUpgradeProfile - :ivar agent_pool_profiles: Required. The list of available upgrade versions for agent pools. + :ivar agent_pool_profiles: The list of available upgrade versions for agent pools. Required. :vartype agent_pool_profiles: list[~azure.mgmt.containerservice.v2019_02_01.models.ManagedClusterPoolUpgradeProfile] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'control_plane_profile': {'required': True}, - 'agent_pool_profiles': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "control_plane_profile": {"required": True}, + "agent_pool_profiles": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'control_plane_profile': {'key': 'properties.controlPlaneProfile', 'type': 'ManagedClusterPoolUpgradeProfile'}, - 'agent_pool_profiles': {'key': 'properties.agentPoolProfiles', 'type': '[ManagedClusterPoolUpgradeProfile]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "control_plane_profile": {"key": "properties.controlPlaneProfile", "type": "ManagedClusterPoolUpgradeProfile"}, + "agent_pool_profiles": {"key": "properties.agentPoolProfiles", "type": "[ManagedClusterPoolUpgradeProfile]"}, } def __init__( @@ -1839,15 +1787,15 @@ def __init__( **kwargs ): """ - :keyword control_plane_profile: Required. The list of available upgrade versions for the - control plane. + :keyword control_plane_profile: The list of available upgrade versions for the control plane. + Required. :paramtype control_plane_profile: ~azure.mgmt.containerservice.v2019_02_01.models.ManagedClusterPoolUpgradeProfile - :keyword agent_pool_profiles: Required. The list of available upgrade versions for agent pools. + :keyword agent_pool_profiles: The list of available upgrade versions for agent pools. Required. :paramtype agent_pool_profiles: list[~azure.mgmt.containerservice.v2019_02_01.models.ManagedClusterPoolUpgradeProfile] """ - super(ManagedClusterUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -1855,7 +1803,7 @@ def __init__( self.agent_pool_profiles = agent_pool_profiles -class OperationListResult(msrest.serialization.Model): +class OperationListResult(_serialization.Model): """The List Compute Operation operation response. Variables are only populated by the server, and will be ignored when sending a request. @@ -1865,24 +1813,20 @@ class OperationListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[OperationValue]'}, + "value": {"key": "value", "type": "[OperationValue]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(OperationListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None -class OperationValue(msrest.serialization.Model): +class OperationValue(_serialization.Model): """Describes the properties of a Compute Operation value. Variables are only populated by the server, and will be ignored when sending a request. @@ -1902,30 +1846,26 @@ class OperationValue(msrest.serialization.Model): """ _validation = { - 'origin': {'readonly': True}, - 'name': {'readonly': True}, - 'operation': {'readonly': True}, - 'resource': {'readonly': True}, - 'description': {'readonly': True}, - 'provider': {'readonly': True}, + "origin": {"readonly": True}, + "name": {"readonly": True}, + "operation": {"readonly": True}, + "resource": {"readonly": True}, + "description": {"readonly": True}, + "provider": {"readonly": True}, } _attribute_map = { - 'origin': {'key': 'origin', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'operation': {'key': 'display.operation', 'type': 'str'}, - 'resource': {'key': 'display.resource', 'type': 'str'}, - 'description': {'key': 'display.description', 'type': 'str'}, - 'provider': {'key': 'display.provider', 'type': 'str'}, + "origin": {"key": "origin", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "operation": {"key": "display.operation", "type": "str"}, + "resource": {"key": "display.resource", "type": "str"}, + "description": {"key": "display.description", "type": "str"}, + "provider": {"key": "display.provider", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(OperationValue, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.origin = None self.name = None self.operation = None @@ -1934,65 +1874,54 @@ def __init__( self.provider = None -class OrchestratorProfile(msrest.serialization.Model): +class OrchestratorProfile(_serialization.Model): """Contains information about orchestrator. All required parameters must be populated in order to send to Azure. - :ivar orchestrator_type: Required. Orchestrator type. + :ivar orchestrator_type: Orchestrator type. Required. :vartype orchestrator_type: str - :ivar orchestrator_version: Required. Orchestrator version (major, minor, patch). + :ivar orchestrator_version: Orchestrator version (major, minor, patch). Required. :vartype orchestrator_version: str """ _validation = { - 'orchestrator_type': {'required': True}, - 'orchestrator_version': {'required': True}, + "orchestrator_type": {"required": True}, + "orchestrator_version": {"required": True}, } _attribute_map = { - 'orchestrator_type': {'key': 'orchestratorType', 'type': 'str'}, - 'orchestrator_version': {'key': 'orchestratorVersion', 'type': 'str'}, + "orchestrator_type": {"key": "orchestratorType", "type": "str"}, + "orchestrator_version": {"key": "orchestratorVersion", "type": "str"}, } - def __init__( - self, - *, - orchestrator_type: str, - orchestrator_version: str, - **kwargs - ): + def __init__(self, *, orchestrator_type: str, orchestrator_version: str, **kwargs): """ - :keyword orchestrator_type: Required. Orchestrator type. + :keyword orchestrator_type: Orchestrator type. Required. :paramtype orchestrator_type: str - :keyword orchestrator_version: Required. Orchestrator version (major, minor, patch). + :keyword orchestrator_version: Orchestrator version (major, minor, patch). Required. :paramtype orchestrator_version: str """ - super(OrchestratorProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.orchestrator_type = orchestrator_type self.orchestrator_version = orchestrator_version -class TagsObject(msrest.serialization.Model): +class TagsObject(_serialization.Model): """Tags object for patch operations. - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] """ _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] """ - super(TagsObject, self).__init__(**kwargs) + super().__init__(**kwargs) self.tags = tags diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/models/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/models/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/models/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/models/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/operations/__init__.py index 403c0174f052..ee6608454b6b 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/operations/__init__.py @@ -13,10 +13,11 @@ from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'Operations', - 'ManagedClustersOperations', - 'AgentPoolsOperations', + "Operations", + "ManagedClustersOperations", + "AgentPoolsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/operations/_agent_pools_operations.py index afd7a6264cee..eae0cc235b5b 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/operations/_agent_pools_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,173 +27,145 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - subscription_id: str, - resource_group_name: str, - managed_cluster_name: str, - **kwargs: Any + resource_group_name: str, managed_cluster_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 = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-02-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{managedClusterName}/agentPools") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{managedClusterName}/agentPools", + ) # 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', min_length=1), - "managedClusterName": _SERIALIZER.url("managed_cluster_name", managed_cluster_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "managedClusterName": _SERIALIZER.url("managed_cluster_name", managed_cluster_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - subscription_id: str, - resource_group_name: str, - managed_cluster_name: str, - agent_pool_name: str, - **kwargs: Any + resource_group_name: str, managed_cluster_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-02-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{managedClusterName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{managedClusterName}/agentPools/{agentPoolName}", + ) # 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', min_length=1), - "managedClusterName": _SERIALIZER.url("managed_cluster_name", managed_cluster_name, 'str'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "managedClusterName": _SERIALIZER.url("managed_cluster_name", managed_cluster_name, "str"), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - managed_cluster_name: str, - agent_pool_name: str, - *, - json: Optional[_models.AgentPool] = None, - content: Any = None, - **kwargs: Any + _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, managed_cluster_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{managedClusterName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{managedClusterName}/agentPools/{agentPoolName}", + ) # 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', min_length=1), - "managedClusterName": _SERIALIZER.url("managed_cluster_name", managed_cluster_name, 'str'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "managedClusterName": _SERIALIZER.url("managed_cluster_name", managed_cluster_name, "str"), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - managed_cluster_name: str, - agent_pool_name: str, - **kwargs: Any + _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, managed_cluster_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-02-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{managedClusterName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{managedClusterName}/agentPools/{agentPoolName}", + ) # 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', min_length=1), - "managedClusterName": _SERIALIZER.url("managed_cluster_name", managed_cluster_name, 'str'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "managedClusterName": _SERIALIZER.url("managed_cluster_name", managed_cluster_name, "str"), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class AgentPoolsOperations: """ @@ -209,48 +186,40 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - resource_group_name: str, - managed_cluster_name: str, - **kwargs: Any - ) -> Iterable[_models.AgentPoolListResult]: + def list(self, resource_group_name: str, managed_cluster_name: str, **kwargs: Any) -> Iterable["_models.AgentPool"]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. The operation returns properties of each agent pool. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param managed_cluster_name: The name of the managed cluster resource. + :param managed_cluster_name: The name of the managed cluster resource. Required. :type managed_cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AgentPoolListResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2019_02_01.models.AgentPoolListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either AgentPool or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2019_02_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, managed_cluster_name=managed_cluster_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -258,16 +227,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - managed_cluster_name=managed_cluster_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -283,10 +247,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -296,54 +258,45 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{managedClusterName}/agentPools"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{managedClusterName}/agentPools"} # type: ignore @distributed_trace def get( - self, - resource_group_name: str, - managed_cluster_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, managed_cluster_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPool: """Gets the agent pool. Gets the details of the agent pool by managed cluster and resource group. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param managed_cluster_name: The name of the managed cluster resource. + :param managed_cluster_name: The name of the managed cluster resource. Required. :type managed_cluster_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPool, or the result of cls(response) + :return: AgentPool or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_02_01.models.AgentPool - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, managed_cluster_name=managed_cluster_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -351,57 +304,60 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{managedClusterName}/agentPools/{agentPoolName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{managedClusterName}/agentPools/{agentPoolName}"} # type: ignore def _create_or_update_initial( self, resource_group_name: str, managed_cluster_name: str, agent_pool_name: str, - parameters: _models.AgentPool, + parameters: Union[_models.AgentPool, IO], **kwargs: Any ) -> _models.AgentPool: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - _json = self._serialize.body(parameters, 'AgentPool') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "AgentPool") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, managed_cluster_name=managed_cluster_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -409,10 +365,9 @@ def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -420,40 +375,45 @@ def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{managedClusterName}/agentPools/{agentPoolName}"} # type: ignore - + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{managedClusterName}/agentPools/{agentPoolName}"} # type: ignore - @distributed_trace + @overload def begin_create_or_update( self, resource_group_name: str, managed_cluster_name: str, agent_pool_name: str, parameters: _models.AgentPool, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.AgentPool]: """Creates or updates an agent pool. Creates or updates an agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param managed_cluster_name: The name of the managed cluster resource. + :param managed_cluster_name: The name of the managed cluster resource. Required. :type managed_cluster_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :param parameters: Parameters supplied to the Create or Update an agent pool operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2019_02_01.models.AgentPool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -465,20 +425,97 @@ def begin_create_or_update( :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2019_02_01.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + managed_cluster_name: str, + agent_pool_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AgentPool]: + """Creates or updates an agent pool. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param managed_cluster_name: The name of the managed cluster resource. Required. + :type managed_cluster_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: Parameters supplied to the Create or Update an agent pool operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2019_02_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + managed_cluster_name: str, + agent_pool_name: str, + parameters: Union[_models.AgentPool, IO], + **kwargs: Any + ) -> LROPoller[_models.AgentPool]: + """Creates or updates an agent pool. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param managed_cluster_name: The name of the managed cluster resource. Required. + :type managed_cluster_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: Parameters supplied to the Create or Update an agent pool operation. Is + either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2019_02_01.models.AgentPool or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2019_02_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -487,66 +524,55 @@ def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{managedClusterName}/agentPools/{agentPoolName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{managedClusterName}/agentPools/{agentPoolName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - managed_cluster_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, managed_cluster_name: str, agent_pool_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, managed_cluster_name=managed_cluster_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -554,10 +580,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -567,26 +592,21 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{managedClusterName}/agentPools/{agentPoolName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{managedClusterName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - managed_cluster_name: str, - agent_pool_name: str, - **kwargs: Any + def begin_delete( + self, resource_group_name: str, managed_cluster_name: str, agent_pool_name: str, **kwargs: Any ) -> LROPoller[None]: """Deletes an agent pool. Deletes the agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param managed_cluster_name: The name of the managed cluster resource. + :param managed_cluster_name: The name of the managed cluster resource. Required. :type managed_cluster_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -598,53 +618,46 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, managed_cluster_name=managed_cluster_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{managedClusterName}/agentPools/{agentPoolName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{managedClusterName}/agentPools/{agentPoolName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/operations/_managed_clusters_operations.py index 47dd44a44974..b21446872763 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/operations/_managed_clusters_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,483 +27,390 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-02-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters") + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters" + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_resource_group_request( - subscription_id: str, - resource_group_name: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-02-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters", + ) # 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', min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_upgrade_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-02-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_access_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, role_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 = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-02-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), - "roleName": _SERIALIZER.url("role_name", role_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "roleName": _SERIALIZER.url("role_name", role_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_admin_credentials_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-02-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_user_credentials_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-02-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: + +def build_get_request(resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-02-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedCluster] = None, - content: Any = None, - **kwargs: Any + +def build_create_or_update_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_update_tags_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.TagsObject] = None, - content: Any = None, - **kwargs: Any + +def build_update_tags_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any +def build_delete_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-02-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_reset_service_principal_profile_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedClusterServicePrincipalProfile] = None, - content: Any = None, - **kwargs: Any +def build_reset_service_principal_profile_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_reset_aad_profile_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedClusterAADProfile] = None, - content: Any = None, - **kwargs: Any + +def build_reset_aad_profile_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + class ManagedClustersOperations: """ @@ -519,41 +431,35 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.ManagedClusterListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.ManagedCluster"]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. The operation returns properties of each managed cluster. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2019_02_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2019_02_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -561,14 +467,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -584,10 +487,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -597,50 +498,42 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> Iterable[_models.ManagedClusterListResult]: + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.ManagedCluster"]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. The operation returns properties of each managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2019_02_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2019_02_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -648,15 +541,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -672,10 +561,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -685,51 +572,43 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.ManagedClusterUpgradeProfile: """Gets upgrade profile for a managed cluster. Gets the details of the upgrade profile for a managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterUpgradeProfile, or the result of cls(response) + :return: ManagedClusterUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_02_01.models.ManagedClusterUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -737,69 +616,60 @@ def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterUpgradeProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore @distributed_trace def get_access_profile( - self, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, role_name: str, **kwargs: Any ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. Gets the accessProfile for the specified role name of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param role_name: The name of the role for managed cluster accessProfile resource. + :param role_name: The name of the role for managed cluster accessProfile resource. Required. :type role_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterAccessProfile, or the result of cls(response) + :return: ManagedClusterAccessProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_02_01.models.ManagedClusterAccessProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterAccessProfile] - request = build_get_access_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, role_name=role_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_access_profile.metadata['url'], + template_url=self.get_access_profile.metadata["url"], headers=_headers, params=_params, ) @@ -807,64 +677,56 @@ def get_access_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterAccessProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterAccessProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_access_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore - + get_access_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore @distributed_trace def list_cluster_admin_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster admin credential of a managed cluster. Gets cluster admin credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_02_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_admin_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_admin_credentials.metadata['url'], + template_url=self.list_cluster_admin_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -872,64 +734,56 @@ def list_cluster_admin_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_admin_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore - + list_cluster_admin_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore @distributed_trace def list_cluster_user_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster user credential of a managed cluster. Gets cluster user credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_02_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_user_credentials.metadata['url'], + template_url=self.list_cluster_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -937,64 +791,54 @@ def list_cluster_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore - + list_cluster_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore @distributed_trace - def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.ManagedCluster: + def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.ManagedCluster: """Gets a managed cluster. Gets the details of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedCluster, or the result of cls(response) + :return: ManagedCluster or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_02_01.models.ManagedCluster - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -1002,55 +846,54 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _create_or_update_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.ManagedCluster, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'ManagedCluster') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedCluster") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1058,10 +901,9 @@ def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -1069,25 +911,26 @@ def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - - @distributed_trace + @overload def begin_create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedCluster, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. @@ -1095,12 +938,90 @@ def begin_create_or_update( Creates or updates a managed cluster with the specified configuration for agents and Kubernetes version. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2019_02_01.models.ManagedCluster + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2019_02_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster with the specified configuration for agents and Kubernetes + version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2019_02_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster with the specified configuration for agents and Kubernetes + version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. Is + either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2019_02_01.models.ManagedCluster or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1113,20 +1034,17 @@ def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2019_02_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -1134,69 +1052,66 @@ def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _update_tags_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.TagsObject, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request_initial( - subscription_id=self._config.subscription_id, + request = build_update_tags_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_tags_initial.metadata['url'], + content=_content, + template_url=self._update_tags_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1204,44 +1119,118 @@ def _update_tags_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_tags_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _update_tags_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - @distributed_trace + @overload def begin_update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates a managed cluster with the specified tags. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2019_02_01.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2019_02_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates a managed cluster with the specified tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2019_02_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates a managed cluster with the specified tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2019_02_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1254,20 +1243,17 @@ def begin_update_tags( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2019_02_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, @@ -1275,64 +1261,54 @@ def begin_update_tags( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1340,10 +1316,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1353,23 +1328,17 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> LROPoller[None]: + def begin_delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> LROPoller[None]: """Deletes a managed cluster. Deletes the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1381,85 +1350,83 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterServicePrincipalProfile, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterServicePrincipalProfile") - request = build_reset_service_principal_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_service_principal_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_service_principal_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_service_principal_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1467,10 +1434,9 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1480,29 +1446,106 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re if cls: return cls(pipeline_response, None, {}) - _reset_service_principal_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + _reset_service_principal_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore - - @distributed_trace - def begin_reset_service_principal_profile( # pylint: disable=inconsistent-return-statements + @overload + def begin_reset_service_principal_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterServicePrincipalProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: """Reset Service Principal Profile of a managed cluster. Update the service principal Profile for a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a - Managed Cluster. + Managed Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2019_02_01.models.ManagedClusterServicePrincipalProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reset Service Principal Profile of a managed cluster. + + Update the service principal Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a + Managed Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Reset Service Principal Profile of a managed cluster. + + Update the service principal Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a + Managed Cluster. Is either a model type or a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2019_02_01.models.ManagedClusterServicePrincipalProfile or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1513,20 +1556,17 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1534,67 +1574,68 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_service_principal_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + begin_reset_service_principal_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterAADProfile, + parameters: Union[_models.ManagedClusterAADProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterAADProfile") - request = build_reset_aad_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_aad_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_aad_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_aad_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1602,10 +1643,9 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1615,28 +1655,105 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement if cls: return cls(pipeline_response, None, {}) - _reset_aad_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - + _reset_aad_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - @distributed_trace - def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements + @overload + def begin_reset_aad_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterAADProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: """Reset AAD Profile of a managed cluster. Update the AAD Profile for a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed - Cluster. + Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2019_02_01.models.ManagedClusterAADProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reset AAD Profile of a managed cluster. + + Update the AAD Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed + Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterAADProfile, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Reset AAD Profile of a managed cluster. + + Update the AAD Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed + Cluster. Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2019_02_01.models.ManagedClusterAADProfile or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1647,20 +1764,17 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1668,34 +1782,30 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_aad_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + begin_reset_aad_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/operations/_operations.py index e39e3d0c3338..2050239fbb19 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/operations/_operations.py @@ -7,10 +7,15 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,38 +25,34 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - **kwargs: Any -) -> HttpRequest: + +def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-02-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.ContainerService/operations") # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class Operations: """ @@ -72,36 +73,31 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.OperationListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.OperationValue"]: """Gets a list of compute operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationListResult or the result of cls(response) + :return: An iterator like instance of either OperationValue or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2019_02_01.models.OperationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2019_02_01.models.OperationValue] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -109,13 +105,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -131,10 +125,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -144,8 +136,6 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.ContainerService/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ContainerService/operations"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/operations/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/__init__.py index 37a5f9e02e6f..a8716d29afe8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/__init__.py @@ -14,7 +14,8 @@ except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['ContainerServiceClient'] + +__all__ = ["ContainerServiceClient"] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/_configuration.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/_configuration.py index 58569990fb6c..357bcd54b2f1 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/_configuration.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/_configuration.py @@ -18,30 +18,26 @@ VERSION = "unknown" + class ContainerServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ContainerServiceClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2019-04-01". 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: + def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ContainerServiceClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2019-04-01") # type: str + api_version = kwargs.pop("api_version", "2019-04-01") # type: str if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -51,23 +47,24 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-containerservice/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-containerservice/{}".format(VERSION)) self._configure(**kwargs) def _configure( - self, - **kwargs # type: Any + self, **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/_container_service_client.py index 01844ee0d562..734c23ac12f1 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/_container_service_client.py @@ -9,12 +9,11 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from . import models +from .._serialization import Deserializer, Serializer from ._configuration import ContainerServiceClientConfiguration from .operations import AgentPoolsOperations, ManagedClustersOperations, Operations @@ -22,7 +21,8 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class ContainerServiceClient: + +class ContainerServiceClient: # pylint: disable=client-accepts-api-version-keyword """The Container Service Client. :ivar operations: Operations operations @@ -32,10 +32,10 @@ class ContainerServiceClient: azure.mgmt.containerservice.v2019_04_01.operations.ManagedClustersOperations :ivar agent_pools: AgentPoolsOperations operations :vartype agent_pools: azure.mgmt.containerservice.v2019_04_01.operations.AgentPoolsOperations - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -53,29 +53,22 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = ContainerServiceClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = ContainerServiceClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize - ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.managed_clusters = ManagedClustersOperations( self._client, self._config, self._serialize, self._deserialize ) - self.agent_pools = AgentPoolsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - + self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> HttpResponse: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -84,7 +77,7 @@ def _send_request( >>> response = client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/_metadata.json b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/_metadata.json index 111700892536..72ed1f2e75b4 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/_metadata.json +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/_metadata.json @@ -10,20 +10,20 @@ "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { "credential": { - "signature": "credential, # type: \"TokenCredential\"", - "description": "Credential needed for the client to connect to Azure.", + "signature": "credential: \"TokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true }, "subscription_id": { - "signature": "subscription_id, # type: str", - "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "signature": "subscription_id: str,", + "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.", "docstring_type": "str", "required": true } @@ -31,13 +31,13 @@ "async": { "credential": { "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure.", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { "signature": "subscription_id: str,", - "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.", "docstring_type": "str", "required": true } @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=\"https://management.azure.com\", # type: str", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/_patch.py index 74e48ecd07cf..f99e77fef986 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/_patch.py @@ -28,4 +28,4 @@ # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + pass diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/_vendor.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/_vendor.py index 138f663c53a4..9aad73fc743e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/_vendor.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/_vendor.py @@ -7,6 +7,7 @@ from azure.core.pipeline.transport import HttpRequest + def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) @@ -14,6 +15,7 @@ def _convert_request(request, files=None): request.set_formdata_body(files) return request + def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -21,7 +23,5 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [ - c for c in formatted_components if "{}".format(key.args[0]) not in c - ] + components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/aio/__init__.py index 37a5f9e02e6f..a8716d29afe8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/aio/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/aio/__init__.py @@ -14,7 +14,8 @@ except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['ContainerServiceClient'] + +__all__ = ["ContainerServiceClient"] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/aio/_configuration.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/aio/_configuration.py index d21ee1abe1c4..0bc3d5366093 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/aio/_configuration.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/aio/_configuration.py @@ -18,30 +18,26 @@ VERSION = "unknown" + class ContainerServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ContainerServiceClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2019-04-01". 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: + def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ContainerServiceClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2019-04-01") # type: str + api_version = kwargs.pop("api_version", "2019-04-01") # type: str if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -51,22 +47,21 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-containerservice/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-containerservice/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, - **kwargs: Any - ) -> None: - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/aio/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/aio/_container_service_client.py index fcff601fd1aa..2a3890becd41 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/aio/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/aio/_container_service_client.py @@ -9,12 +9,11 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from .. import models +from ..._serialization import Deserializer, Serializer from ._configuration import ContainerServiceClientConfiguration from .operations import AgentPoolsOperations, ManagedClustersOperations, Operations @@ -22,7 +21,8 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class ContainerServiceClient: + +class ContainerServiceClient: # pylint: disable=client-accepts-api-version-keyword """The Container Service Client. :ivar operations: Operations operations @@ -33,10 +33,10 @@ class ContainerServiceClient: :ivar agent_pools: AgentPoolsOperations operations :vartype agent_pools: azure.mgmt.containerservice.v2019_04_01.aio.operations.AgentPoolsOperations - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -54,29 +54,22 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = ContainerServiceClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = ContainerServiceClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize - ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.managed_clusters = ManagedClustersOperations( self._client, self._config, self._serialize, self._deserialize ) - self.agent_pools = AgentPoolsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - + self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -85,7 +78,7 @@ def _send_request( >>> response = await client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/aio/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/aio/_patch.py index 74e48ecd07cf..f99e77fef986 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/aio/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/aio/_patch.py @@ -28,4 +28,4 @@ # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + pass diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/aio/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/aio/operations/__init__.py index 403c0174f052..ee6608454b6b 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/aio/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/aio/operations/__init__.py @@ -13,10 +13,11 @@ from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'Operations', - 'ManagedClustersOperations', - 'AgentPoolsOperations', + "Operations", + "ManagedClustersOperations", + "AgentPoolsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/aio/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/aio/operations/_agent_pools_operations.py index 013a2731f890..3f215daefcc1 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/aio/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/aio/operations/_agent_pools_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +29,17 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._agent_pools_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request -T = TypeVar('T') +from ...operations._agent_pools_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class AgentPoolsOperations: """ .. warning:: @@ -45,48 +59,41 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.AgentPoolListResult]: + def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncIterable["_models.AgentPool"]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. The operation returns properties of each agent pool. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AgentPoolListResult or the result of cls(response) + :return: An iterator like instance of either AgentPool or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2019_04_01.models.AgentPoolListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2019_04_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -94,16 +101,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -119,10 +121,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -132,54 +132,45 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore @distributed_trace_async async def get( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPool: """Gets the agent pool. Gets the details of the agent pool by managed cluster and resource group. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPool, or the result of cls(response) + :return: AgentPool or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_04_01.models.AgentPool - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -187,57 +178,60 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore async def _create_or_update_initial( self, resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: _models.AgentPool, + parameters: Union[_models.AgentPool, IO], **kwargs: Any ) -> _models.AgentPool: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-04-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - _json = self._serialize.body(parameters, 'AgentPool') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "AgentPool") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -245,10 +239,9 @@ async def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -256,40 +249,87 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - - @distributed_trace_async + @overload async def begin_create_or_update( self, resource_group_name: str, resource_name: str, agent_pool_name: str, parameters: _models.AgentPool, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.AgentPool]: """Creates or updates an agent pool. Creates or updates an agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :param parameters: Parameters supplied to the Create or Update an agent pool operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2019_04_01.models.AgentPool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AgentPool or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2019_04_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AgentPool]: + """Creates or updates an agent pool. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: Parameters supplied to the Create or Update an agent pool operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -302,20 +342,57 @@ async def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2019_04_01.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: Union[_models.AgentPool, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.AgentPool]: + """Creates or updates an agent pool. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: Parameters supplied to the Create or Update an agent pool operation. Is + either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2019_04_01.models.AgentPool or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AgentPool or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2019_04_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-04-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -324,66 +401,55 @@ async def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -391,10 +457,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -404,26 +469,21 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + async def begin_delete( + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes an agent pool. Deletes the agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -435,53 +495,46 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/aio/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/aio/operations/_managed_clusters_operations.py index 58979d33fc14..102dc148a916 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/aio/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/aio/operations/_managed_clusters_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +29,25 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._managed_clusters_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_access_profile_request, build_get_request, build_get_upgrade_profile_request, build_list_by_resource_group_request, build_list_cluster_admin_credentials_request, build_list_cluster_user_credentials_request, build_list_request, build_reset_aad_profile_request_initial, build_reset_service_principal_profile_request_initial, build_update_tags_request_initial -T = TypeVar('T') +from ...operations._managed_clusters_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_access_profile_request, + build_get_request, + build_get_upgrade_profile_request, + build_list_by_resource_group_request, + build_list_cluster_admin_credentials_request, + build_list_cluster_user_credentials_request, + build_list_request, + build_reset_aad_profile_request, + build_reset_service_principal_profile_request, + build_update_tags_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class ManagedClustersOperations: """ .. warning:: @@ -45,41 +67,35 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.ManagedClusterListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.ManagedCluster"]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. The operation returns properties of each managed cluster. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2019_04_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2019_04_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -87,14 +103,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -110,10 +123,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -123,50 +134,44 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.ManagedClusterListResult]: + self, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ManagedCluster"]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. The operation returns properties of each managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2019_04_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2019_04_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -174,15 +179,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -198,10 +199,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -211,51 +210,43 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace_async async def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.ManagedClusterUpgradeProfile: """Gets upgrade profile for a managed cluster. Gets the details of the upgrade profile for a managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterUpgradeProfile, or the result of cls(response) + :return: ManagedClusterUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_04_01.models.ManagedClusterUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -263,69 +254,60 @@ async def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterUpgradeProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore @distributed_trace_async async def get_access_profile( - self, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, role_name: str, **kwargs: Any ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. Gets the accessProfile for the specified role name of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param role_name: The name of the role for managed cluster accessProfile resource. + :param role_name: The name of the role for managed cluster accessProfile resource. Required. :type role_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterAccessProfile, or the result of cls(response) + :return: ManagedClusterAccessProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_04_01.models.ManagedClusterAccessProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterAccessProfile] - request = build_get_access_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, role_name=role_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_access_profile.metadata['url'], + template_url=self.get_access_profile.metadata["url"], headers=_headers, params=_params, ) @@ -333,64 +315,56 @@ async def get_access_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterAccessProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterAccessProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_access_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore - + get_access_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore @distributed_trace_async async def list_cluster_admin_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster admin credential of a managed cluster. Gets cluster admin credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_04_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_admin_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_admin_credentials.metadata['url'], + template_url=self.list_cluster_admin_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -398,64 +372,56 @@ async def list_cluster_admin_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_admin_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore - + list_cluster_admin_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore @distributed_trace_async async def list_cluster_user_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster user credential of a managed cluster. Gets cluster user credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_04_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_user_credentials.metadata['url'], + template_url=self.list_cluster_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -463,64 +429,54 @@ async def list_cluster_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore - + list_cluster_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore @distributed_trace_async - async def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.ManagedCluster: + async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.ManagedCluster: """Gets a managed cluster. Gets the details of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedCluster, or the result of cls(response) + :return: ManagedCluster or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_04_01.models.ManagedCluster - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -528,55 +484,54 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _create_or_update_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.ManagedCluster, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-04-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'ManagedCluster') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedCluster") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -584,10 +539,9 @@ async def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -595,25 +549,26 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - @distributed_trace_async + @overload async def begin_create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedCluster, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. @@ -621,12 +576,90 @@ async def begin_create_or_update( Creates or updates a managed cluster with the specified configuration for agents and Kubernetes version. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2019_04_01.models.ManagedCluster + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2019_04_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster with the specified configuration for agents and Kubernetes + version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2019_04_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster with the specified configuration for agents and Kubernetes + version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. Is + either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2019_04_01.models.ManagedCluster or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -639,20 +672,17 @@ async def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2019_04_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-04-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -660,69 +690,66 @@ async def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _update_tags_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.TagsObject, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-04-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request_initial( - subscription_id=self._config.subscription_id, + request = build_update_tags_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_tags_initial.metadata['url'], + content=_content, + template_url=self._update_tags_initial.metadata["url"], headers=_headers, params=_params, ) @@ -730,44 +757,118 @@ async def _update_tags_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_tags_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _update_tags_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - @distributed_trace_async + @overload async def begin_update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates a managed cluster with the specified tags. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2019_04_01.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2019_04_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates a managed cluster with the specified tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2019_04_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates a managed cluster with the specified tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2019_04_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -780,20 +881,17 @@ async def begin_update_tags( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2019_04_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-04-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, @@ -801,64 +899,54 @@ async def begin_update_tags( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -866,10 +954,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -879,23 +966,17 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: + async def begin_delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Deletes a managed cluster. Deletes the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -907,85 +988,83 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterServicePrincipalProfile, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-04-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterServicePrincipalProfile") - request = build_reset_service_principal_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_service_principal_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_service_principal_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_service_principal_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -993,10 +1072,9 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1006,29 +1084,106 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist if cls: return cls(pipeline_response, None, {}) - _reset_service_principal_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + _reset_service_principal_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore - - @distributed_trace_async - async def begin_reset_service_principal_profile( # pylint: disable=inconsistent-return-statements + @overload + async def begin_reset_service_principal_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterServicePrincipalProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: """Reset Service Principal Profile of a managed cluster. Update the service principal Profile for a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a - Managed Cluster. + Managed Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2019_04_01.models.ManagedClusterServicePrincipalProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset Service Principal Profile of a managed cluster. + + Update the service principal Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a + Managed Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset Service Principal Profile of a managed cluster. + + Update the service principal Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a + Managed Cluster. Is either a model type or a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2019_04_01.models.ManagedClusterServicePrincipalProfile or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -1039,20 +1194,17 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-04-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1060,67 +1212,68 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_service_principal_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + begin_reset_service_principal_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterAADProfile, + parameters: Union[_models.ManagedClusterAADProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-04-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterAADProfile") - request = build_reset_aad_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_aad_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_aad_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_aad_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1128,10 +1281,9 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1141,28 +1293,105 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta if cls: return cls(pipeline_response, None, {}) - _reset_aad_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - + _reset_aad_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - @distributed_trace_async - async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements + @overload + async def begin_reset_aad_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterAADProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: """Reset AAD Profile of a managed cluster. Update the AAD Profile for a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed - Cluster. + Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2019_04_01.models.ManagedClusterAADProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset AAD Profile of a managed cluster. + + Update the AAD Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed + Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterAADProfile, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset AAD Profile of a managed cluster. + + Update the AAD Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed + Cluster. Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2019_04_01.models.ManagedClusterAADProfile or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -1173,20 +1402,17 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-04-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1194,34 +1420,30 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_aad_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + begin_reset_aad_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/aio/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/aio/operations/_operations.py index f76846b4a72a..f0d2083c42a0 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/aio/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/aio/operations/_operations.py @@ -7,9 +7,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,9 +27,11 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._operations import build_list_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class Operations: """ .. warning:: @@ -42,36 +51,31 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.OperationListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.OperationValue"]: """Gets a list of compute operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationListResult or the result of cls(response) + :return: An iterator like instance of either OperationValue or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2019_04_01.models.OperationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2019_04_01.models.OperationValue] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -79,13 +83,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -101,10 +103,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -114,8 +114,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.ContainerService/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ContainerService/operations"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/aio/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/aio/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/aio/operations/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/aio/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/models/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/models/__init__.py index 182b437fa9da..c57c6c3fe60f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/models/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/models/__init__.py @@ -37,61 +37,59 @@ from ._models_py3 import SubResource from ._models_py3 import TagsObject - -from ._container_service_client_enums import ( - AgentPoolType, - ContainerServiceStorageProfileTypes, - ContainerServiceVMSizeTypes, - Count, - LoadBalancerSku, - NetworkPlugin, - NetworkPolicy, - OSType, - ResourceIdentityType, -) +from ._container_service_client_enums import AgentPoolType +from ._container_service_client_enums import ContainerServiceStorageProfileTypes +from ._container_service_client_enums import ContainerServiceVMSizeTypes +from ._container_service_client_enums import Count +from ._container_service_client_enums import LoadBalancerSku +from ._container_service_client_enums import NetworkPlugin +from ._container_service_client_enums import NetworkPolicy +from ._container_service_client_enums import OSType +from ._container_service_client_enums import ResourceIdentityType from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'AgentPool', - 'AgentPoolListResult', - 'CloudErrorBody', - 'ContainerServiceDiagnosticsProfile', - 'ContainerServiceLinuxProfile', - 'ContainerServiceMasterProfile', - 'ContainerServiceNetworkProfile', - 'ContainerServiceSshConfiguration', - 'ContainerServiceSshPublicKey', - 'ContainerServiceVMDiagnostics', - 'CredentialResult', - 'CredentialResults', - 'ManagedCluster', - 'ManagedClusterAADProfile', - 'ManagedClusterAccessProfile', - 'ManagedClusterAddonProfile', - 'ManagedClusterAgentPoolProfile', - 'ManagedClusterAgentPoolProfileProperties', - 'ManagedClusterIdentity', - 'ManagedClusterListResult', - 'ManagedClusterPoolUpgradeProfile', - 'ManagedClusterPoolUpgradeProfileUpgradesItem', - 'ManagedClusterServicePrincipalProfile', - 'ManagedClusterUpgradeProfile', - 'ManagedClusterWindowsProfile', - 'OperationListResult', - 'OperationValue', - 'Resource', - 'SubResource', - 'TagsObject', - 'AgentPoolType', - 'ContainerServiceStorageProfileTypes', - 'ContainerServiceVMSizeTypes', - 'Count', - 'LoadBalancerSku', - 'NetworkPlugin', - 'NetworkPolicy', - 'OSType', - 'ResourceIdentityType', + "AgentPool", + "AgentPoolListResult", + "CloudErrorBody", + "ContainerServiceDiagnosticsProfile", + "ContainerServiceLinuxProfile", + "ContainerServiceMasterProfile", + "ContainerServiceNetworkProfile", + "ContainerServiceSshConfiguration", + "ContainerServiceSshPublicKey", + "ContainerServiceVMDiagnostics", + "CredentialResult", + "CredentialResults", + "ManagedCluster", + "ManagedClusterAADProfile", + "ManagedClusterAccessProfile", + "ManagedClusterAddonProfile", + "ManagedClusterAgentPoolProfile", + "ManagedClusterAgentPoolProfileProperties", + "ManagedClusterIdentity", + "ManagedClusterListResult", + "ManagedClusterPoolUpgradeProfile", + "ManagedClusterPoolUpgradeProfileUpgradesItem", + "ManagedClusterServicePrincipalProfile", + "ManagedClusterUpgradeProfile", + "ManagedClusterWindowsProfile", + "OperationListResult", + "OperationValue", + "Resource", + "SubResource", + "TagsObject", + "AgentPoolType", + "ContainerServiceStorageProfileTypes", + "ContainerServiceVMSizeTypes", + "Count", + "LoadBalancerSku", + "NetworkPlugin", + "NetworkPolicy", + "OSType", + "ResourceIdentityType", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/models/_container_service_client_enums.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/models/_container_service_client_enums.py index 0c1e2a74caef..ed855aa6747f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/models/_container_service_client_enums.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/models/_container_service_client_enums.py @@ -18,6 +18,7 @@ class AgentPoolType(str, Enum, metaclass=CaseInsensitiveEnumMeta): VIRTUAL_MACHINE_SCALE_SETS = "VirtualMachineScaleSets" AVAILABILITY_SET = "AvailabilitySet" + class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the orchestrator choice. @@ -26,9 +27,9 @@ class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEn STORAGE_ACCOUNT = "StorageAccount" MANAGED_DISKS = "ManagedDisks" + class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Size of agent VMs. - """ + """Size of agent VMs.""" STANDARD_A1 = "Standard_A1" STANDARD_A10 = "Standard_A10" @@ -205,6 +206,7 @@ class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): STANDARD_NV24 = "Standard_NV24" STANDARD_NV6 = "Standard_NV6" + class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): """Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, and 5. The default value is 1. @@ -214,34 +216,35 @@ class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): THREE = 3 FIVE = 5 + class LoadBalancerSku(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The load balancer sku for the managed cluster. - """ + """The load balancer sku for the managed cluster.""" STANDARD = "standard" BASIC = "basic" + class NetworkPlugin(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Network plugin used for building Kubernetes network. - """ + """Network plugin used for building Kubernetes network.""" AZURE = "azure" KUBENET = "kubenet" + class NetworkPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Network policy used for building Kubernetes network. - """ + """Network policy used for building Kubernetes network.""" CALICO = "calico" AZURE = "azure" + class OSType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """OsType to be used to specify os type. Choose from Linux and Windows. Default to Linux. - """ + """OsType to be used to specify os type. Choose from Linux and Windows. Default to Linux.""" LINUX = "Linux" WINDOWS = "Windows" + class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of identity used for the managed cluster. Type 'SystemAssigned' will use an implicitly created identity in master components and an auto-created user assigned identity in MC_ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/models/_models_py3.py index 1ae97789a100..081065bbb339 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/models/_models_py3.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/models/_models_py3.py @@ -1,4 +1,5 @@ # coding=utf-8 +# pylint: disable=too-many-lines # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -8,14 +9,14 @@ from typing import Dict, List, Optional, TYPE_CHECKING, Union -import msrest.serialization +from ... import _serialization if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - import __init__ as _models + from .. import models as _models -class SubResource(msrest.serialization.Model): +class SubResource(_serialization.Model): """Reference to another subresource. Variables are only populated by the server, and will be ignored when sending a request. @@ -30,30 +31,26 @@ class SubResource(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(SubResource, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.id = None self.name = None self.type = None -class AgentPool(SubResource): +class AgentPool(SubResource): # pylint: disable=too-many-instance-attributes """Agent Pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -105,7 +102,7 @@ class AgentPool(SubResource): "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :vartype vm_size: str or ~azure.mgmt.containerservice.v2019_04_01.models.ContainerServiceVMSizeTypes :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine @@ -117,7 +114,7 @@ class AgentPool(SubResource): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Known values are: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux" and "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2019_04_01.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -126,7 +123,7 @@ class AgentPool(SubResource): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar type_properties_type: AgentPoolType represents types of an agent pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :vartype type_properties_type: str or ~azure.mgmt.containerservice.v2019_04_01.models.AgentPoolType :ivar orchestrator_version: Version of orchestrator specified when creating the managed @@ -141,42 +138,42 @@ class AgentPool(SubResource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'count': {'maximum': 100, 'minimum': 1}, - 'os_disk_size_gb': {'maximum': 1023, 'minimum': 0}, - 'provisioning_state': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "count": {"maximum": 100, "minimum": 1}, + "os_disk_size_gb": {"maximum": 1023, "minimum": 0}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'count': {'key': 'properties.count', 'type': 'int'}, - 'vm_size': {'key': 'properties.vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'properties.osDiskSizeGB', 'type': 'int'}, - 'vnet_subnet_id': {'key': 'properties.vnetSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'properties.maxPods', 'type': 'int'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'max_count': {'key': 'properties.maxCount', 'type': 'int'}, - 'min_count': {'key': 'properties.minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'properties.enableAutoScaling', 'type': 'bool'}, - 'type_properties_type': {'key': 'properties.type', 'type': 'str'}, - 'orchestrator_version': {'key': 'properties.orchestratorVersion', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'availability_zones': {'key': 'properties.availabilityZones', 'type': '[str]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "count": {"key": "properties.count", "type": "int"}, + "vm_size": {"key": "properties.vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "properties.osDiskSizeGB", "type": "int"}, + "vnet_subnet_id": {"key": "properties.vnetSubnetID", "type": "str"}, + "max_pods": {"key": "properties.maxPods", "type": "int"}, + "os_type": {"key": "properties.osType", "type": "str"}, + "max_count": {"key": "properties.maxCount", "type": "int"}, + "min_count": {"key": "properties.minCount", "type": "int"}, + "enable_auto_scaling": {"key": "properties.enableAutoScaling", "type": "bool"}, + "type_properties_type": {"key": "properties.type", "type": "str"}, + "orchestrator_version": {"key": "properties.orchestratorVersion", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "availability_zones": {"key": "properties.availabilityZones", "type": "[str]"}, } def __init__( self, *, - count: Optional[int] = 1, + count: int = 1, vm_size: Optional[Union[str, "_models.ContainerServiceVMSizeTypes"]] = None, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, @@ -226,7 +223,7 @@ def __init__( "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :paramtype vm_size: str or ~azure.mgmt.containerservice.v2019_04_01.models.ContainerServiceVMSizeTypes :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every @@ -238,7 +235,7 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux" and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2019_04_01.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -247,7 +244,7 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword type_properties_type: AgentPoolType represents types of an agent pool. Known values - are: "VirtualMachineScaleSets", "AvailabilitySet". + are: "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type_properties_type: str or ~azure.mgmt.containerservice.v2019_04_01.models.AgentPoolType :keyword orchestrator_version: Version of orchestrator specified when creating the managed @@ -257,7 +254,7 @@ def __init__( VirtualMachineScaleSets AgentPoolType. :paramtype availability_zones: list[str] """ - super(AgentPool, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.vm_size = vm_size self.os_disk_size_gb = os_disk_size_gb @@ -273,7 +270,7 @@ def __init__( self.availability_zones = availability_zones -class AgentPoolListResult(msrest.serialization.Model): +class AgentPoolListResult(_serialization.Model): """The response from the List Agent Pools operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -285,30 +282,25 @@ class AgentPoolListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[AgentPool]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[AgentPool]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.AgentPool"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.AgentPool"]] = None, **kwargs): """ :keyword value: The list of agent pools. :paramtype value: list[~azure.mgmt.containerservice.v2019_04_01.models.AgentPool] """ - super(AgentPoolListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class CloudErrorBody(msrest.serialization.Model): +class CloudErrorBody(_serialization.Model): """An error response from the Container service. :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed @@ -325,10 +317,10 @@ class CloudErrorBody(msrest.serialization.Model): """ _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[CloudErrorBody]"}, } def __init__( @@ -353,87 +345,76 @@ def __init__( :keyword details: A list of additional details about the error. :paramtype details: list[~azure.mgmt.containerservice.v2019_04_01.models.CloudErrorBody] """ - super(CloudErrorBody, self).__init__(**kwargs) + super().__init__(**kwargs) self.code = code self.message = message self.target = target self.details = details -class ContainerServiceDiagnosticsProfile(msrest.serialization.Model): +class ContainerServiceDiagnosticsProfile(_serialization.Model): """Profile for diagnostics on the container service cluster. All required parameters must be populated in order to send to Azure. - :ivar vm_diagnostics: Required. Profile for diagnostics on the container service VMs. + :ivar vm_diagnostics: Profile for diagnostics on the container service VMs. Required. :vartype vm_diagnostics: ~azure.mgmt.containerservice.v2019_04_01.models.ContainerServiceVMDiagnostics """ _validation = { - 'vm_diagnostics': {'required': True}, + "vm_diagnostics": {"required": True}, } _attribute_map = { - 'vm_diagnostics': {'key': 'vmDiagnostics', 'type': 'ContainerServiceVMDiagnostics'}, + "vm_diagnostics": {"key": "vmDiagnostics", "type": "ContainerServiceVMDiagnostics"}, } - def __init__( - self, - *, - vm_diagnostics: "_models.ContainerServiceVMDiagnostics", - **kwargs - ): + def __init__(self, *, vm_diagnostics: "_models.ContainerServiceVMDiagnostics", **kwargs): """ - :keyword vm_diagnostics: Required. Profile for diagnostics on the container service VMs. + :keyword vm_diagnostics: Profile for diagnostics on the container service VMs. Required. :paramtype vm_diagnostics: ~azure.mgmt.containerservice.v2019_04_01.models.ContainerServiceVMDiagnostics """ - super(ContainerServiceDiagnosticsProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.vm_diagnostics = vm_diagnostics -class ContainerServiceLinuxProfile(msrest.serialization.Model): +class ContainerServiceLinuxProfile(_serialization.Model): """Profile for Linux VMs in the container service cluster. All required parameters must be populated in order to send to Azure. - :ivar admin_username: Required. The administrator username to use for Linux VMs. + :ivar admin_username: The administrator username to use for Linux VMs. Required. :vartype admin_username: str - :ivar ssh: Required. SSH configuration for Linux-based VMs running on Azure. + :ivar ssh: SSH configuration for Linux-based VMs running on Azure. Required. :vartype ssh: ~azure.mgmt.containerservice.v2019_04_01.models.ContainerServiceSshConfiguration """ _validation = { - 'admin_username': {'required': True, 'pattern': r'^[A-Za-z][-A-Za-z0-9_]*$'}, - 'ssh': {'required': True}, + "admin_username": {"required": True, "pattern": r"^[A-Za-z][-A-Za-z0-9_]*$"}, + "ssh": {"required": True}, } _attribute_map = { - 'admin_username': {'key': 'adminUsername', 'type': 'str'}, - 'ssh': {'key': 'ssh', 'type': 'ContainerServiceSshConfiguration'}, + "admin_username": {"key": "adminUsername", "type": "str"}, + "ssh": {"key": "ssh", "type": "ContainerServiceSshConfiguration"}, } - def __init__( - self, - *, - admin_username: str, - ssh: "_models.ContainerServiceSshConfiguration", - **kwargs - ): + def __init__(self, *, admin_username: str, ssh: "_models.ContainerServiceSshConfiguration", **kwargs): """ - :keyword admin_username: Required. The administrator username to use for Linux VMs. + :keyword admin_username: The administrator username to use for Linux VMs. Required. :paramtype admin_username: str - :keyword ssh: Required. SSH configuration for Linux-based VMs running on Azure. + :keyword ssh: SSH configuration for Linux-based VMs running on Azure. Required. :paramtype ssh: ~azure.mgmt.containerservice.v2019_04_01.models.ContainerServiceSshConfiguration """ - super(ContainerServiceLinuxProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.admin_username = admin_username self.ssh = ssh -class ContainerServiceMasterProfile(msrest.serialization.Model): +class ContainerServiceMasterProfile(_serialization.Model): """Profile for the container service master. Variables are only populated by the server, and will be ignored when sending a request. @@ -441,11 +422,11 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar count: Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, - and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". + and 5. The default value is 1. Known values are: 1, 3, and 5. :vartype count: int or ~azure.mgmt.containerservice.v2019_04_01.models.Count - :ivar dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. + :ivar dns_prefix: DNS prefix to be used to create the FQDN for the master pool. Required. :vartype dns_prefix: str - :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + :ivar vm_size: Size of agent VMs. Required. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -482,7 +463,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :vartype vm_size: str or ~azure.mgmt.containerservice.v2019_04_01.models.ContainerServiceVMSizeTypes :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine @@ -496,7 +477,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): :vartype first_consecutive_static_ip: str :ivar storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount" and "ManagedDisks". :vartype storage_profile: str or ~azure.mgmt.containerservice.v2019_04_01.models.ContainerServiceStorageProfileTypes :ivar fqdn: FQDN for the master pool. @@ -504,21 +485,21 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): """ _validation = { - 'dns_prefix': {'required': True}, - 'vm_size': {'required': True}, - 'os_disk_size_gb': {'maximum': 1023, 'minimum': 0}, - 'fqdn': {'readonly': True}, + "dns_prefix": {"required": True}, + "vm_size": {"required": True}, + "os_disk_size_gb": {"maximum": 1023, "minimum": 0}, + "fqdn": {"readonly": True}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'dns_prefix': {'key': 'dnsPrefix', 'type': 'str'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'first_consecutive_static_ip': {'key': 'firstConsecutiveStaticIP', 'type': 'str'}, - 'storage_profile': {'key': 'storageProfile', 'type': 'str'}, - 'fqdn': {'key': 'fqdn', 'type': 'str'}, + "count": {"key": "count", "type": "int"}, + "dns_prefix": {"key": "dnsPrefix", "type": "str"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "first_consecutive_static_ip": {"key": "firstConsecutiveStaticIP", "type": "str"}, + "storage_profile": {"key": "storageProfile", "type": "str"}, + "fqdn": {"key": "fqdn", "type": "str"}, } def __init__( @@ -526,20 +507,20 @@ def __init__( *, dns_prefix: str, vm_size: Union[str, "_models.ContainerServiceVMSizeTypes"], - count: Optional[Union[int, "_models.Count"]] = 1, + count: Union[int, "_models.Count"] = 1, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, - first_consecutive_static_ip: Optional[str] = "10.240.255.5", + first_consecutive_static_ip: str = "10.240.255.5", storage_profile: Optional[Union[str, "_models.ContainerServiceStorageProfileTypes"]] = None, **kwargs ): """ :keyword count: Number of masters (VMs) in the container service cluster. Allowed values are 1, - 3, and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". + 3, and 5. The default value is 1. Known values are: 1, 3, and 5. :paramtype count: int or ~azure.mgmt.containerservice.v2019_04_01.models.Count - :keyword dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. + :keyword dns_prefix: DNS prefix to be used to create the FQDN for the master pool. Required. :paramtype dns_prefix: str - :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + :keyword vm_size: Size of agent VMs. Required. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -576,7 +557,7 @@ def __init__( "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :paramtype vm_size: str or ~azure.mgmt.containerservice.v2019_04_01.models.ContainerServiceVMSizeTypes :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every @@ -590,11 +571,11 @@ def __init__( :paramtype first_consecutive_static_ip: str :keyword storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount" and "ManagedDisks". :paramtype storage_profile: str or ~azure.mgmt.containerservice.v2019_04_01.models.ContainerServiceStorageProfileTypes """ - super(ContainerServiceMasterProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.dns_prefix = dns_prefix self.vm_size = vm_size @@ -605,14 +586,14 @@ def __init__( self.fqdn = None -class ContainerServiceNetworkProfile(msrest.serialization.Model): +class ContainerServiceNetworkProfile(_serialization.Model): """Profile of network configuration. :ivar network_plugin: Network plugin used for building Kubernetes network. Known values are: - "azure", "kubenet". Default value: "kubenet". + "azure" and "kubenet". :vartype network_plugin: str or ~azure.mgmt.containerservice.v2019_04_01.models.NetworkPlugin :ivar network_policy: Network policy used for building Kubernetes network. Known values are: - "calico", "azure". + "calico" and "azure". :vartype network_policy: str or ~azure.mgmt.containerservice.v2019_04_01.models.NetworkPolicy :ivar pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :vartype pod_cidr: str @@ -626,46 +607,48 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): must not overlap with any Subnet IP ranges or the Kubernetes service address range. :vartype docker_bridge_cidr: str :ivar load_balancer_sku: The load balancer sku for the managed cluster. Known values are: - "standard", "basic". + "standard" and "basic". :vartype load_balancer_sku: str or ~azure.mgmt.containerservice.v2019_04_01.models.LoadBalancerSku """ _validation = { - 'pod_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, - 'service_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, - 'dns_service_ip': {'pattern': r'^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$'}, - 'docker_bridge_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, + "pod_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, + "service_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, + "dns_service_ip": { + "pattern": r"^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$" + }, + "docker_bridge_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, } _attribute_map = { - 'network_plugin': {'key': 'networkPlugin', 'type': 'str'}, - 'network_policy': {'key': 'networkPolicy', 'type': 'str'}, - 'pod_cidr': {'key': 'podCidr', 'type': 'str'}, - 'service_cidr': {'key': 'serviceCidr', 'type': 'str'}, - 'dns_service_ip': {'key': 'dnsServiceIP', 'type': 'str'}, - 'docker_bridge_cidr': {'key': 'dockerBridgeCidr', 'type': 'str'}, - 'load_balancer_sku': {'key': 'loadBalancerSku', 'type': 'str'}, + "network_plugin": {"key": "networkPlugin", "type": "str"}, + "network_policy": {"key": "networkPolicy", "type": "str"}, + "pod_cidr": {"key": "podCidr", "type": "str"}, + "service_cidr": {"key": "serviceCidr", "type": "str"}, + "dns_service_ip": {"key": "dnsServiceIP", "type": "str"}, + "docker_bridge_cidr": {"key": "dockerBridgeCidr", "type": "str"}, + "load_balancer_sku": {"key": "loadBalancerSku", "type": "str"}, } def __init__( self, *, - network_plugin: Optional[Union[str, "_models.NetworkPlugin"]] = "kubenet", + network_plugin: Union[str, "_models.NetworkPlugin"] = "kubenet", network_policy: Optional[Union[str, "_models.NetworkPolicy"]] = None, - pod_cidr: Optional[str] = "10.244.0.0/16", - service_cidr: Optional[str] = "10.0.0.0/16", - dns_service_ip: Optional[str] = "10.0.0.10", - docker_bridge_cidr: Optional[str] = "172.17.0.1/16", + pod_cidr: str = "10.244.0.0/16", + service_cidr: str = "10.0.0.0/16", + dns_service_ip: str = "10.0.0.10", + docker_bridge_cidr: str = "172.17.0.1/16", load_balancer_sku: Optional[Union[str, "_models.LoadBalancerSku"]] = None, **kwargs ): """ :keyword network_plugin: Network plugin used for building Kubernetes network. Known values are: - "azure", "kubenet". Default value: "kubenet". + "azure" and "kubenet". :paramtype network_plugin: str or ~azure.mgmt.containerservice.v2019_04_01.models.NetworkPlugin :keyword network_policy: Network policy used for building Kubernetes network. Known values are: - "calico", "azure". + "calico" and "azure". :paramtype network_policy: str or ~azure.mgmt.containerservice.v2019_04_01.models.NetworkPolicy :keyword pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :paramtype pod_cidr: str @@ -679,11 +662,11 @@ def __init__( must not overlap with any Subnet IP ranges or the Kubernetes service address range. :paramtype docker_bridge_cidr: str :keyword load_balancer_sku: The load balancer sku for the managed cluster. Known values are: - "standard", "basic". + "standard" and "basic". :paramtype load_balancer_sku: str or ~azure.mgmt.containerservice.v2019_04_01.models.LoadBalancerSku """ - super(ContainerServiceNetworkProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.network_plugin = network_plugin self.network_policy = network_policy self.pod_cidr = pod_cidr @@ -693,113 +676,98 @@ def __init__( self.load_balancer_sku = load_balancer_sku -class ContainerServiceSshConfiguration(msrest.serialization.Model): +class ContainerServiceSshConfiguration(_serialization.Model): """SSH configuration for Linux-based VMs running on Azure. All required parameters must be populated in order to send to Azure. - :ivar public_keys: Required. The list of SSH public keys used to authenticate with Linux-based - VMs. Only expect one key specified. + :ivar public_keys: The list of SSH public keys used to authenticate with Linux-based VMs. Only + expect one key specified. Required. :vartype public_keys: list[~azure.mgmt.containerservice.v2019_04_01.models.ContainerServiceSshPublicKey] """ _validation = { - 'public_keys': {'required': True}, + "public_keys": {"required": True}, } _attribute_map = { - 'public_keys': {'key': 'publicKeys', 'type': '[ContainerServiceSshPublicKey]'}, + "public_keys": {"key": "publicKeys", "type": "[ContainerServiceSshPublicKey]"}, } - def __init__( - self, - *, - public_keys: List["_models.ContainerServiceSshPublicKey"], - **kwargs - ): + def __init__(self, *, public_keys: List["_models.ContainerServiceSshPublicKey"], **kwargs): """ - :keyword public_keys: Required. The list of SSH public keys used to authenticate with - Linux-based VMs. Only expect one key specified. + :keyword public_keys: The list of SSH public keys used to authenticate with Linux-based VMs. + Only expect one key specified. Required. :paramtype public_keys: list[~azure.mgmt.containerservice.v2019_04_01.models.ContainerServiceSshPublicKey] """ - super(ContainerServiceSshConfiguration, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_keys = public_keys -class ContainerServiceSshPublicKey(msrest.serialization.Model): +class ContainerServiceSshPublicKey(_serialization.Model): """Contains information about SSH certificate public key data. All required parameters must be populated in order to send to Azure. - :ivar key_data: Required. Certificate public key used to authenticate with VMs through SSH. The - certificate must be in PEM format with or without headers. + :ivar key_data: Certificate public key used to authenticate with VMs through SSH. The + certificate must be in PEM format with or without headers. Required. :vartype key_data: str """ _validation = { - 'key_data': {'required': True}, + "key_data": {"required": True}, } _attribute_map = { - 'key_data': {'key': 'keyData', 'type': 'str'}, + "key_data": {"key": "keyData", "type": "str"}, } - def __init__( - self, - *, - key_data: str, - **kwargs - ): + def __init__(self, *, key_data: str, **kwargs): """ - :keyword key_data: Required. Certificate public key used to authenticate with VMs through SSH. - The certificate must be in PEM format with or without headers. + :keyword key_data: Certificate public key used to authenticate with VMs through SSH. The + certificate must be in PEM format with or without headers. Required. :paramtype key_data: str """ - super(ContainerServiceSshPublicKey, self).__init__(**kwargs) + super().__init__(**kwargs) self.key_data = key_data -class ContainerServiceVMDiagnostics(msrest.serialization.Model): +class ContainerServiceVMDiagnostics(_serialization.Model): """Profile for diagnostics on the container service VMs. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar enabled: Required. Whether the VM diagnostic agent is provisioned on the VM. + :ivar enabled: Whether the VM diagnostic agent is provisioned on the VM. Required. :vartype enabled: bool :ivar storage_uri: The URI of the storage account where diagnostics are stored. :vartype storage_uri: str """ _validation = { - 'enabled': {'required': True}, - 'storage_uri': {'readonly': True}, + "enabled": {"required": True}, + "storage_uri": {"readonly": True}, } _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'storage_uri': {'key': 'storageUri', 'type': 'str'}, + "enabled": {"key": "enabled", "type": "bool"}, + "storage_uri": {"key": "storageUri", "type": "str"}, } - def __init__( - self, - *, - enabled: bool, - **kwargs - ): + def __init__(self, *, enabled: bool, **kwargs): """ - :keyword enabled: Required. Whether the VM diagnostic agent is provisioned on the VM. + :keyword enabled: Whether the VM diagnostic agent is provisioned on the VM. Required. :paramtype enabled: bool """ - super(ContainerServiceVMDiagnostics, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.storage_uri = None -class CredentialResult(msrest.serialization.Model): +class CredentialResult(_serialization.Model): """The credential result response. Variables are only populated by the server, and will be ignored when sending a request. @@ -807,31 +775,27 @@ class CredentialResult(msrest.serialization.Model): :ivar name: The name of the credential. :vartype name: str :ivar value: Base64-encoded Kubernetes configuration file. - :vartype value: bytearray + :vartype value: bytes """ _validation = { - 'name': {'readonly': True}, - 'value': {'readonly': True}, + "name": {"readonly": True}, + "value": {"readonly": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'bytearray'}, + "name": {"key": "name", "type": "str"}, + "value": {"key": "value", "type": "bytearray"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(CredentialResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.name = None self.value = None -class CredentialResults(msrest.serialization.Model): +class CredentialResults(_serialization.Model): """The list of credential result response. Variables are only populated by the server, and will be ignored when sending a request. @@ -841,24 +805,20 @@ class CredentialResults(msrest.serialization.Model): """ _validation = { - 'kubeconfigs': {'readonly': True}, + "kubeconfigs": {"readonly": True}, } _attribute_map = { - 'kubeconfigs': {'key': 'kubeconfigs', 'type': '[CredentialResult]'}, + "kubeconfigs": {"key": "kubeconfigs", "type": "[CredentialResult]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(CredentialResults, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.kubeconfigs = None -class Resource(msrest.serialization.Model): +class Resource(_serialization.Model): """The Resource model definition. Variables are only populated by the server, and will be ignored when sending a request. @@ -871,41 +831,35 @@ class Resource(msrest.serialization.Model): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] """ - super(Resource, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -913,7 +867,7 @@ def __init__( self.tags = tags -class ManagedCluster(Resource): +class ManagedCluster(Resource): # pylint: disable=too-many-instance-attributes """Managed cluster. Variables are only populated by the server, and will be ignored when sending a request. @@ -926,9 +880,9 @@ class ManagedCluster(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar identity: The identity of the managed cluster, if configured. :vartype identity: ~azure.mgmt.containerservice.v2019_04_01.models.ManagedClusterIdentity @@ -977,38 +931,41 @@ class ManagedCluster(Resource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'provisioning_state': {'readonly': True}, - 'max_agent_pools': {'readonly': True}, - 'fqdn': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, + "provisioning_state": {"readonly": True}, + "max_agent_pools": {"readonly": True}, + "fqdn": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'ManagedClusterIdentity'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'max_agent_pools': {'key': 'properties.maxAgentPools', 'type': 'int'}, - 'kubernetes_version': {'key': 'properties.kubernetesVersion', 'type': 'str'}, - 'dns_prefix': {'key': 'properties.dnsPrefix', 'type': 'str'}, - 'fqdn': {'key': 'properties.fqdn', 'type': 'str'}, - 'agent_pool_profiles': {'key': 'properties.agentPoolProfiles', 'type': '[ManagedClusterAgentPoolProfile]'}, - 'linux_profile': {'key': 'properties.linuxProfile', 'type': 'ContainerServiceLinuxProfile'}, - 'windows_profile': {'key': 'properties.windowsProfile', 'type': 'ManagedClusterWindowsProfile'}, - 'service_principal_profile': {'key': 'properties.servicePrincipalProfile', 'type': 'ManagedClusterServicePrincipalProfile'}, - 'addon_profiles': {'key': 'properties.addonProfiles', 'type': '{ManagedClusterAddonProfile}'}, - 'node_resource_group': {'key': 'properties.nodeResourceGroup', 'type': 'str'}, - 'enable_rbac': {'key': 'properties.enableRBAC', 'type': 'bool'}, - 'enable_pod_security_policy': {'key': 'properties.enablePodSecurityPolicy', 'type': 'bool'}, - 'network_profile': {'key': 'properties.networkProfile', 'type': 'ContainerServiceNetworkProfile'}, - 'aad_profile': {'key': 'properties.aadProfile', 'type': 'ManagedClusterAADProfile'}, - 'api_server_authorized_ip_ranges': {'key': 'properties.apiServerAuthorizedIPRanges', 'type': '[str]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "identity": {"key": "identity", "type": "ManagedClusterIdentity"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "max_agent_pools": {"key": "properties.maxAgentPools", "type": "int"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "dns_prefix": {"key": "properties.dnsPrefix", "type": "str"}, + "fqdn": {"key": "properties.fqdn", "type": "str"}, + "agent_pool_profiles": {"key": "properties.agentPoolProfiles", "type": "[ManagedClusterAgentPoolProfile]"}, + "linux_profile": {"key": "properties.linuxProfile", "type": "ContainerServiceLinuxProfile"}, + "windows_profile": {"key": "properties.windowsProfile", "type": "ManagedClusterWindowsProfile"}, + "service_principal_profile": { + "key": "properties.servicePrincipalProfile", + "type": "ManagedClusterServicePrincipalProfile", + }, + "addon_profiles": {"key": "properties.addonProfiles", "type": "{ManagedClusterAddonProfile}"}, + "node_resource_group": {"key": "properties.nodeResourceGroup", "type": "str"}, + "enable_rbac": {"key": "properties.enableRBAC", "type": "bool"}, + "enable_pod_security_policy": {"key": "properties.enablePodSecurityPolicy", "type": "bool"}, + "network_profile": {"key": "properties.networkProfile", "type": "ContainerServiceNetworkProfile"}, + "aad_profile": {"key": "properties.aadProfile", "type": "ManagedClusterAADProfile"}, + "api_server_authorized_ip_ranges": {"key": "properties.apiServerAuthorizedIPRanges", "type": "[str]"}, } def __init__( @@ -1033,9 +990,9 @@ def __init__( **kwargs ): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword identity: The identity of the managed cluster, if configured. :paramtype identity: ~azure.mgmt.containerservice.v2019_04_01.models.ManagedClusterIdentity @@ -1077,7 +1034,7 @@ def __init__( server. :paramtype api_server_authorized_ip_ranges: list[str] """ - super(ManagedCluster, self).__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.identity = identity self.provisioning_state = None self.max_agent_pools = None @@ -1097,14 +1054,14 @@ def __init__( self.api_server_authorized_ip_ranges = api_server_authorized_ip_ranges -class ManagedClusterAADProfile(msrest.serialization.Model): +class ManagedClusterAADProfile(_serialization.Model): """AADProfile specifies attributes for Azure Active Directory integration. All required parameters must be populated in order to send to Azure. - :ivar client_app_id: Required. The client AAD application ID. + :ivar client_app_id: The client AAD application ID. Required. :vartype client_app_id: str - :ivar server_app_id: Required. The server AAD application ID. + :ivar server_app_id: The server AAD application ID. Required. :vartype server_app_id: str :ivar server_app_secret: The server AAD application secret. :vartype server_app_secret: str @@ -1114,15 +1071,15 @@ class ManagedClusterAADProfile(msrest.serialization.Model): """ _validation = { - 'client_app_id': {'required': True}, - 'server_app_id': {'required': True}, + "client_app_id": {"required": True}, + "server_app_id": {"required": True}, } _attribute_map = { - 'client_app_id': {'key': 'clientAppID', 'type': 'str'}, - 'server_app_id': {'key': 'serverAppID', 'type': 'str'}, - 'server_app_secret': {'key': 'serverAppSecret', 'type': 'str'}, - 'tenant_id': {'key': 'tenantID', 'type': 'str'}, + "client_app_id": {"key": "clientAppID", "type": "str"}, + "server_app_id": {"key": "serverAppID", "type": "str"}, + "server_app_secret": {"key": "serverAppSecret", "type": "str"}, + "tenant_id": {"key": "tenantID", "type": "str"}, } def __init__( @@ -1135,9 +1092,9 @@ def __init__( **kwargs ): """ - :keyword client_app_id: Required. The client AAD application ID. + :keyword client_app_id: The client AAD application ID. Required. :paramtype client_app_id: str - :keyword server_app_id: Required. The server AAD application ID. + :keyword server_app_id: The server AAD application ID. Required. :paramtype server_app_id: str :keyword server_app_secret: The server AAD application secret. :paramtype server_app_secret: str @@ -1145,7 +1102,7 @@ def __init__( tenant of the deployment subscription. :paramtype tenant_id: str """ - super(ManagedClusterAADProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.client_app_id = client_app_id self.server_app_id = server_app_id self.server_app_secret = server_app_secret @@ -1165,99 +1122,88 @@ class ManagedClusterAccessProfile(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar kube_config: Base64-encoded Kubernetes configuration file. - :vartype kube_config: bytearray + :vartype kube_config: bytes """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'kube_config': {'key': 'properties.kubeConfig', 'type': 'bytearray'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "kube_config": {"key": "properties.kubeConfig", "type": "bytearray"}, } def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - kube_config: Optional[bytearray] = None, - **kwargs + self, *, location: str, tags: Optional[Dict[str, str]] = None, kube_config: Optional[bytes] = None, **kwargs ): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword kube_config: Base64-encoded Kubernetes configuration file. - :paramtype kube_config: bytearray + :paramtype kube_config: bytes """ - super(ManagedClusterAccessProfile, self).__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.kube_config = kube_config -class ManagedClusterAddonProfile(msrest.serialization.Model): +class ManagedClusterAddonProfile(_serialization.Model): """A Kubernetes add-on profile for a managed cluster. All required parameters must be populated in order to send to Azure. - :ivar enabled: Required. Whether the add-on is enabled or not. + :ivar enabled: Whether the add-on is enabled or not. Required. :vartype enabled: bool :ivar config: Key-value pairs for configuring an add-on. :vartype config: dict[str, str] """ _validation = { - 'enabled': {'required': True}, + "enabled": {"required": True}, } _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'config': {'key': 'config', 'type': '{str}'}, + "enabled": {"key": "enabled", "type": "bool"}, + "config": {"key": "config", "type": "{str}"}, } - def __init__( - self, - *, - enabled: bool, - config: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, enabled: bool, config: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword enabled: Required. Whether the add-on is enabled or not. + :keyword enabled: Whether the add-on is enabled or not. Required. :paramtype enabled: bool :keyword config: Key-value pairs for configuring an add-on. :paramtype config: dict[str, str] """ - super(ManagedClusterAddonProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.config = config -class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): +class ManagedClusterAgentPoolProfileProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes """Properties for the container service agent pool profile. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar count: Required. Number of agents (VMs) to host docker containers. Allowed values must be - in the range of 1 to 100 (inclusive). The default value is 1. + :ivar count: Number of agents (VMs) to host docker containers. Allowed values must be in the + range of 1 to 100 (inclusive). The default value is 1. :vartype count: int - :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + :ivar vm_size: Size of agent VMs. Required. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -1294,7 +1240,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :vartype vm_size: str or ~azure.mgmt.containerservice.v2019_04_01.models.ContainerServiceVMSizeTypes :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine @@ -1306,7 +1252,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Known values are: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux" and "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2019_04_01.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -1315,7 +1261,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar type: AgentPoolType represents types of an agent pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2019_04_01.models.AgentPoolType :ivar orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -1329,26 +1275,26 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): """ _validation = { - 'count': {'required': True, 'maximum': 100, 'minimum': 1}, - 'vm_size': {'required': True}, - 'os_disk_size_gb': {'maximum': 1023, 'minimum': 0}, - 'provisioning_state': {'readonly': True}, + "count": {"required": True, "maximum": 100, "minimum": 1}, + "vm_size": {"required": True}, + "os_disk_size_gb": {"maximum": 1023, "minimum": 0}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'maxPods', 'type': 'int'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'max_count': {'key': 'maxCount', 'type': 'int'}, - 'min_count': {'key': 'minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'enableAutoScaling', 'type': 'bool'}, - 'type': {'key': 'type', 'type': 'str'}, - 'orchestrator_version': {'key': 'orchestratorVersion', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'availability_zones': {'key': 'availabilityZones', 'type': '[str]'}, + "count": {"key": "count", "type": "int"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "max_pods": {"key": "maxPods", "type": "int"}, + "os_type": {"key": "osType", "type": "str"}, + "max_count": {"key": "maxCount", "type": "int"}, + "min_count": {"key": "minCount", "type": "int"}, + "enable_auto_scaling": {"key": "enableAutoScaling", "type": "bool"}, + "type": {"key": "type", "type": "str"}, + "orchestrator_version": {"key": "orchestratorVersion", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "availability_zones": {"key": "availabilityZones", "type": "[str]"}, } def __init__( @@ -1359,7 +1305,7 @@ def __init__( os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, @@ -1369,10 +1315,10 @@ def __init__( **kwargs ): """ - :keyword count: Required. Number of agents (VMs) to host docker containers. Allowed values must - be in the range of 1 to 100 (inclusive). The default value is 1. + :keyword count: Number of agents (VMs) to host docker containers. Allowed values must be in the + range of 1 to 100 (inclusive). The default value is 1. :paramtype count: int - :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + :keyword vm_size: Size of agent VMs. Required. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -1409,7 +1355,7 @@ def __init__( "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :paramtype vm_size: str or ~azure.mgmt.containerservice.v2019_04_01.models.ContainerServiceVMSizeTypes :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every @@ -1421,7 +1367,7 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux" and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2019_04_01.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -1430,7 +1376,7 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword type: AgentPoolType represents types of an agent pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2019_04_01.models.AgentPoolType :keyword orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -1439,7 +1385,7 @@ def __init__( VirtualMachineScaleSets AgentPoolType. :paramtype availability_zones: list[str] """ - super(ManagedClusterAgentPoolProfileProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.vm_size = vm_size self.os_disk_size_gb = os_disk_size_gb @@ -1455,17 +1401,19 @@ def __init__( self.availability_zones = availability_zones -class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): +class ManagedClusterAgentPoolProfile( + ManagedClusterAgentPoolProfileProperties +): # pylint: disable=too-many-instance-attributes """Profile for the container service agent pool. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar count: Required. Number of agents (VMs) to host docker containers. Allowed values must be - in the range of 1 to 100 (inclusive). The default value is 1. + :ivar count: Number of agents (VMs) to host docker containers. Allowed values must be in the + range of 1 to 100 (inclusive). The default value is 1. :vartype count: int - :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + :ivar vm_size: Size of agent VMs. Required. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -1502,7 +1450,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :vartype vm_size: str or ~azure.mgmt.containerservice.v2019_04_01.models.ContainerServiceVMSizeTypes :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine @@ -1514,7 +1462,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Known values are: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux" and "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2019_04_01.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -1523,7 +1471,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar type: AgentPoolType represents types of an agent pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2019_04_01.models.AgentPoolType :ivar orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -1534,34 +1482,34 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar availability_zones: (PREVIEW) Availability zones for nodes. Must use VirtualMachineScaleSets AgentPoolType. :vartype availability_zones: list[str] - :ivar name: Required. Unique name of the agent pool profile in the context of the subscription - and resource group. + :ivar name: Unique name of the agent pool profile in the context of the subscription and + resource group. Required. :vartype name: str """ _validation = { - 'count': {'required': True, 'maximum': 100, 'minimum': 1}, - 'vm_size': {'required': True}, - 'os_disk_size_gb': {'maximum': 1023, 'minimum': 0}, - 'provisioning_state': {'readonly': True}, - 'name': {'required': True, 'pattern': r'^[a-z][a-z0-9]{0,11}$'}, + "count": {"required": True, "maximum": 100, "minimum": 1}, + "vm_size": {"required": True}, + "os_disk_size_gb": {"maximum": 1023, "minimum": 0}, + "provisioning_state": {"readonly": True}, + "name": {"required": True, "pattern": r"^[a-z][a-z0-9]{0,11}$"}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'maxPods', 'type': 'int'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'max_count': {'key': 'maxCount', 'type': 'int'}, - 'min_count': {'key': 'minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'enableAutoScaling', 'type': 'bool'}, - 'type': {'key': 'type', 'type': 'str'}, - 'orchestrator_version': {'key': 'orchestratorVersion', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'availability_zones': {'key': 'availabilityZones', 'type': '[str]'}, - 'name': {'key': 'name', 'type': 'str'}, + "count": {"key": "count", "type": "int"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "max_pods": {"key": "maxPods", "type": "int"}, + "os_type": {"key": "osType", "type": "str"}, + "max_count": {"key": "maxCount", "type": "int"}, + "min_count": {"key": "minCount", "type": "int"}, + "enable_auto_scaling": {"key": "enableAutoScaling", "type": "bool"}, + "type": {"key": "type", "type": "str"}, + "orchestrator_version": {"key": "orchestratorVersion", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "availability_zones": {"key": "availabilityZones", "type": "[str]"}, + "name": {"key": "name", "type": "str"}, } def __init__( @@ -1573,7 +1521,7 @@ def __init__( os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, @@ -1583,10 +1531,10 @@ def __init__( **kwargs ): """ - :keyword count: Required. Number of agents (VMs) to host docker containers. Allowed values must - be in the range of 1 to 100 (inclusive). The default value is 1. + :keyword count: Number of agents (VMs) to host docker containers. Allowed values must be in the + range of 1 to 100 (inclusive). The default value is 1. :paramtype count: int - :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + :keyword vm_size: Size of agent VMs. Required. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -1623,7 +1571,7 @@ def __init__( "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :paramtype vm_size: str or ~azure.mgmt.containerservice.v2019_04_01.models.ContainerServiceVMSizeTypes :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every @@ -1635,7 +1583,7 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux" and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2019_04_01.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -1644,7 +1592,7 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword type: AgentPoolType represents types of an agent pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2019_04_01.models.AgentPoolType :keyword orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -1652,15 +1600,29 @@ def __init__( :keyword availability_zones: (PREVIEW) Availability zones for nodes. Must use VirtualMachineScaleSets AgentPoolType. :paramtype availability_zones: list[str] - :keyword name: Required. Unique name of the agent pool profile in the context of the - subscription and resource group. + :keyword name: Unique name of the agent pool profile in the context of the subscription and + resource group. Required. :paramtype name: str """ - super(ManagedClusterAgentPoolProfile, self).__init__(count=count, vm_size=vm_size, os_disk_size_gb=os_disk_size_gb, vnet_subnet_id=vnet_subnet_id, max_pods=max_pods, os_type=os_type, max_count=max_count, min_count=min_count, enable_auto_scaling=enable_auto_scaling, type=type, orchestrator_version=orchestrator_version, availability_zones=availability_zones, **kwargs) + super().__init__( + count=count, + vm_size=vm_size, + os_disk_size_gb=os_disk_size_gb, + vnet_subnet_id=vnet_subnet_id, + max_pods=max_pods, + os_type=os_type, + max_count=max_count, + min_count=min_count, + enable_auto_scaling=enable_auto_scaling, + type=type, + orchestrator_version=orchestrator_version, + availability_zones=availability_zones, + **kwargs + ) self.name = name -class ManagedClusterIdentity(msrest.serialization.Model): +class ManagedClusterIdentity(_serialization.Model): """Identity for the managed cluster. Variables are only populated by the server, and will be ignored when sending a request. @@ -1674,41 +1636,36 @@ class ManagedClusterIdentity(msrest.serialization.Model): :ivar type: The type of identity used for the managed cluster. Type 'SystemAssigned' will use an implicitly created identity in master components and an auto-created user assigned identity in MC_ resource group in agent nodes. Type 'None' will not use MSI for the managed cluster, - service principal will be used instead. Known values are: "SystemAssigned", "None". + service principal will be used instead. Known values are: "SystemAssigned" and "None". :vartype type: str or ~azure.mgmt.containerservice.v2019_04_01.models.ResourceIdentityType """ _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, + "principal_id": {"readonly": True}, + "tenant_id": {"readonly": True}, } _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, + "principal_id": {"key": "principalId", "type": "str"}, + "tenant_id": {"key": "tenantId", "type": "str"}, + "type": {"key": "type", "type": "str"}, } - def __init__( - self, - *, - type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, - **kwargs - ): + def __init__(self, *, type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, **kwargs): """ :keyword type: The type of identity used for the managed cluster. Type 'SystemAssigned' will use an implicitly created identity in master components and an auto-created user assigned identity in MC_ resource group in agent nodes. Type 'None' will not use MSI for the managed - cluster, service principal will be used instead. Known values are: "SystemAssigned", "None". + cluster, service principal will be used instead. Known values are: "SystemAssigned" and "None". :paramtype type: str or ~azure.mgmt.containerservice.v2019_04_01.models.ResourceIdentityType """ - super(ManagedClusterIdentity, self).__init__(**kwargs) + super().__init__(**kwargs) self.principal_id = None self.tenant_id = None self.type = type -class ManagedClusterListResult(msrest.serialization.Model): +class ManagedClusterListResult(_serialization.Model): """The response from the List Managed Clusters operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -1720,40 +1677,35 @@ class ManagedClusterListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[ManagedCluster]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[ManagedCluster]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.ManagedCluster"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.ManagedCluster"]] = None, **kwargs): """ :keyword value: The list of managed clusters. :paramtype value: list[~azure.mgmt.containerservice.v2019_04_01.models.ManagedCluster] """ - super(ManagedClusterListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): +class ManagedClusterPoolUpgradeProfile(_serialization.Model): """The list of available upgrade versions. All required parameters must be populated in order to send to Azure. - :ivar kubernetes_version: Required. Kubernetes version (major, minor, patch). + :ivar kubernetes_version: Kubernetes version (major, minor, patch). Required. :vartype kubernetes_version: str :ivar name: Pool name. :vartype name: str - :ivar os_type: Required. OsType to be used to specify os type. Choose from Linux and Windows. - Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to + Linux. Known values are: "Linux" and "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2019_04_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -1761,15 +1713,15 @@ class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): """ _validation = { - 'kubernetes_version': {'required': True}, - 'os_type': {'required': True}, + "kubernetes_version": {"required": True}, + "os_type": {"required": True}, } _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'upgrades': {'key': 'upgrades', 'type': '[ManagedClusterPoolUpgradeProfileUpgradesItem]'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "os_type": {"key": "osType", "type": "str"}, + "upgrades": {"key": "upgrades", "type": "[ManagedClusterPoolUpgradeProfileUpgradesItem]"}, } def __init__( @@ -1782,25 +1734,25 @@ def __init__( **kwargs ): """ - :keyword kubernetes_version: Required. Kubernetes version (major, minor, patch). + :keyword kubernetes_version: Kubernetes version (major, minor, patch). Required. :paramtype kubernetes_version: str :keyword name: Pool name. :paramtype name: str - :keyword os_type: Required. OsType to be used to specify os type. Choose from Linux and - Windows. Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default + to Linux. Known values are: "Linux" and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2019_04_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: list[~azure.mgmt.containerservice.v2019_04_01.models.ManagedClusterPoolUpgradeProfileUpgradesItem] """ - super(ManagedClusterPoolUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.name = name self.os_type = os_type self.upgrades = upgrades -class ManagedClusterPoolUpgradeProfileUpgradesItem(msrest.serialization.Model): +class ManagedClusterPoolUpgradeProfileUpgradesItem(_serialization.Model): """ManagedClusterPoolUpgradeProfileUpgradesItem. :ivar kubernetes_version: Kubernetes version (major, minor, patch). @@ -1810,67 +1762,55 @@ class ManagedClusterPoolUpgradeProfileUpgradesItem(msrest.serialization.Model): """ _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } - def __init__( - self, - *, - kubernetes_version: Optional[str] = None, - is_preview: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, kubernetes_version: Optional[str] = None, is_preview: Optional[bool] = None, **kwargs): """ :keyword kubernetes_version: Kubernetes version (major, minor, patch). :paramtype kubernetes_version: str :keyword is_preview: Whether Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(ManagedClusterPoolUpgradeProfileUpgradesItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.is_preview = is_preview -class ManagedClusterServicePrincipalProfile(msrest.serialization.Model): +class ManagedClusterServicePrincipalProfile(_serialization.Model): """Information about a service principal identity for the cluster to use for manipulating Azure APIs. All required parameters must be populated in order to send to Azure. - :ivar client_id: Required. The ID for the service principal. + :ivar client_id: The ID for the service principal. Required. :vartype client_id: str :ivar secret: The secret password associated with the service principal in plain text. :vartype secret: str """ _validation = { - 'client_id': {'required': True}, + "client_id": {"required": True}, } _attribute_map = { - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'secret': {'key': 'secret', 'type': 'str'}, + "client_id": {"key": "clientId", "type": "str"}, + "secret": {"key": "secret", "type": "str"}, } - def __init__( - self, - *, - client_id: str, - secret: Optional[str] = None, - **kwargs - ): + def __init__(self, *, client_id: str, secret: Optional[str] = None, **kwargs): """ - :keyword client_id: Required. The ID for the service principal. + :keyword client_id: The ID for the service principal. Required. :paramtype client_id: str :keyword secret: The secret password associated with the service principal in plain text. :paramtype secret: str """ - super(ManagedClusterServicePrincipalProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.client_id = client_id self.secret = secret -class ManagedClusterUpgradeProfile(msrest.serialization.Model): +class ManagedClusterUpgradeProfile(_serialization.Model): """The list of available upgrades for compute pools. Variables are only populated by the server, and will be ignored when sending a request. @@ -1883,29 +1823,29 @@ class ManagedClusterUpgradeProfile(msrest.serialization.Model): :vartype name: str :ivar type: Type of upgrade profile. :vartype type: str - :ivar control_plane_profile: Required. The list of available upgrade versions for the control - plane. + :ivar control_plane_profile: The list of available upgrade versions for the control plane. + Required. :vartype control_plane_profile: ~azure.mgmt.containerservice.v2019_04_01.models.ManagedClusterPoolUpgradeProfile - :ivar agent_pool_profiles: Required. The list of available upgrade versions for agent pools. + :ivar agent_pool_profiles: The list of available upgrade versions for agent pools. Required. :vartype agent_pool_profiles: list[~azure.mgmt.containerservice.v2019_04_01.models.ManagedClusterPoolUpgradeProfile] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'control_plane_profile': {'required': True}, - 'agent_pool_profiles': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "control_plane_profile": {"required": True}, + "agent_pool_profiles": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'control_plane_profile': {'key': 'properties.controlPlaneProfile', 'type': 'ManagedClusterPoolUpgradeProfile'}, - 'agent_pool_profiles': {'key': 'properties.agentPoolProfiles', 'type': '[ManagedClusterPoolUpgradeProfile]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "control_plane_profile": {"key": "properties.controlPlaneProfile", "type": "ManagedClusterPoolUpgradeProfile"}, + "agent_pool_profiles": {"key": "properties.agentPoolProfiles", "type": "[ManagedClusterPoolUpgradeProfile]"}, } def __init__( @@ -1916,15 +1856,15 @@ def __init__( **kwargs ): """ - :keyword control_plane_profile: Required. The list of available upgrade versions for the - control plane. + :keyword control_plane_profile: The list of available upgrade versions for the control plane. + Required. :paramtype control_plane_profile: ~azure.mgmt.containerservice.v2019_04_01.models.ManagedClusterPoolUpgradeProfile - :keyword agent_pool_profiles: Required. The list of available upgrade versions for agent pools. + :keyword agent_pool_profiles: The list of available upgrade versions for agent pools. Required. :paramtype agent_pool_profiles: list[~azure.mgmt.containerservice.v2019_04_01.models.ManagedClusterPoolUpgradeProfile] """ - super(ManagedClusterUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -1932,18 +1872,18 @@ def __init__( self.agent_pool_profiles = agent_pool_profiles -class ManagedClusterWindowsProfile(msrest.serialization.Model): +class ManagedClusterWindowsProfile(_serialization.Model): """Profile for Windows VMs in the container service cluster. All required parameters must be populated in order to send to Azure. - :ivar admin_username: Required. Specifies the name of the administrator account. - :code:`
`:code:`
` **restriction:** Cannot end in "." :code:`
`:code:`
` - **Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", "test1", - "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", - "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", - "sys", "test2", "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 - character :code:`
`:code:`
` **Max-length:** 20 characters. + :ivar admin_username: Specifies the name of the administrator account. :code:`
`:code:`
` + **restriction:** Cannot end in "." :code:`
`:code:`
` **Disallowed values:** + "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", + "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", + "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", + "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 character + :code:`
`:code:`
` **Max-length:** 20 characters. Required. :vartype admin_username: str :ivar admin_password: Specifies the password of the administrator account. :code:`
`:code:`
` **Minimum-length:** 8 characters :code:`
`:code:`
` @@ -1956,29 +1896,23 @@ class ManagedClusterWindowsProfile(msrest.serialization.Model): """ _validation = { - 'admin_username': {'required': True}, + "admin_username": {"required": True}, } _attribute_map = { - 'admin_username': {'key': 'adminUsername', 'type': 'str'}, - 'admin_password': {'key': 'adminPassword', 'type': 'str'}, + "admin_username": {"key": "adminUsername", "type": "str"}, + "admin_password": {"key": "adminPassword", "type": "str"}, } - def __init__( - self, - *, - admin_username: str, - admin_password: Optional[str] = None, - **kwargs - ): + def __init__(self, *, admin_username: str, admin_password: Optional[str] = None, **kwargs): """ - :keyword admin_username: Required. Specifies the name of the administrator account. + :keyword admin_username: Specifies the name of the administrator account. :code:`
`:code:`
` **restriction:** Cannot end in "." :code:`
`:code:`
` **Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 - character :code:`
`:code:`
` **Max-length:** 20 characters. + character :code:`
`:code:`
` **Max-length:** 20 characters. Required. :paramtype admin_username: str :keyword admin_password: Specifies the password of the administrator account. :code:`
`:code:`
` **Minimum-length:** 8 characters :code:`
`:code:`
` @@ -1989,12 +1923,12 @@ def __init__( "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!". :paramtype admin_password: str """ - super(ManagedClusterWindowsProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.admin_username = admin_username self.admin_password = admin_password -class OperationListResult(msrest.serialization.Model): +class OperationListResult(_serialization.Model): """The List Compute Operation operation response. Variables are only populated by the server, and will be ignored when sending a request. @@ -2004,24 +1938,20 @@ class OperationListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[OperationValue]'}, + "value": {"key": "value", "type": "[OperationValue]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(OperationListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None -class OperationValue(msrest.serialization.Model): +class OperationValue(_serialization.Model): """Describes the properties of a Compute Operation value. Variables are only populated by the server, and will be ignored when sending a request. @@ -2041,30 +1971,26 @@ class OperationValue(msrest.serialization.Model): """ _validation = { - 'origin': {'readonly': True}, - 'name': {'readonly': True}, - 'operation': {'readonly': True}, - 'resource': {'readonly': True}, - 'description': {'readonly': True}, - 'provider': {'readonly': True}, + "origin": {"readonly": True}, + "name": {"readonly": True}, + "operation": {"readonly": True}, + "resource": {"readonly": True}, + "description": {"readonly": True}, + "provider": {"readonly": True}, } _attribute_map = { - 'origin': {'key': 'origin', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'operation': {'key': 'display.operation', 'type': 'str'}, - 'resource': {'key': 'display.resource', 'type': 'str'}, - 'description': {'key': 'display.description', 'type': 'str'}, - 'provider': {'key': 'display.provider', 'type': 'str'}, + "origin": {"key": "origin", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "operation": {"key": "display.operation", "type": "str"}, + "resource": {"key": "display.resource", "type": "str"}, + "description": {"key": "display.description", "type": "str"}, + "provider": {"key": "display.provider", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(OperationValue, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.origin = None self.name = None self.operation = None @@ -2073,26 +1999,21 @@ def __init__( self.provider = None -class TagsObject(msrest.serialization.Model): +class TagsObject(_serialization.Model): """Tags object for patch operations. - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] """ _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] """ - super(TagsObject, self).__init__(**kwargs) + super().__init__(**kwargs) self.tags = tags diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/models/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/models/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/models/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/models/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/operations/__init__.py index 403c0174f052..ee6608454b6b 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/operations/__init__.py @@ -13,10 +13,11 @@ from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'Operations', - 'ManagedClustersOperations', - 'AgentPoolsOperations', + "Operations", + "ManagedClustersOperations", + "AgentPoolsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/operations/_agent_pools_operations.py index 27ac6d600e9b..5abf2f2a8c74 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/operations/_agent_pools_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,173 +27,173 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-04-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-04-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - *, - json: Optional[_models.AgentPool] = None, - content: Any = None, - **kwargs: Any + _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, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-04-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + _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, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-04-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class AgentPoolsOperations: """ @@ -209,48 +214,40 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> Iterable[_models.AgentPoolListResult]: + def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> Iterable["_models.AgentPool"]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. The operation returns properties of each agent pool. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AgentPoolListResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2019_04_01.models.AgentPoolListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either AgentPool or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2019_04_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -258,16 +255,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -283,10 +275,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -296,54 +286,45 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore @distributed_trace def get( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPool: """Gets the agent pool. Gets the details of the agent pool by managed cluster and resource group. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPool, or the result of cls(response) + :return: AgentPool or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_04_01.models.AgentPool - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -351,57 +332,60 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore def _create_or_update_initial( self, resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: _models.AgentPool, + parameters: Union[_models.AgentPool, IO], **kwargs: Any ) -> _models.AgentPool: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-04-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - _json = self._serialize.body(parameters, 'AgentPool') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "AgentPool") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -409,10 +393,9 @@ def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -420,40 +403,45 @@ def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - @distributed_trace + @overload def begin_create_or_update( self, resource_group_name: str, resource_name: str, agent_pool_name: str, parameters: _models.AgentPool, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.AgentPool]: """Creates or updates an agent pool. Creates or updates an agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :param parameters: Parameters supplied to the Create or Update an agent pool operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2019_04_01.models.AgentPool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -465,20 +453,97 @@ def begin_create_or_update( :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2019_04_01.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AgentPool]: + """Creates or updates an agent pool. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: Parameters supplied to the Create or Update an agent pool operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2019_04_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: Union[_models.AgentPool, IO], + **kwargs: Any + ) -> LROPoller[_models.AgentPool]: + """Creates or updates an agent pool. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: Parameters supplied to the Create or Update an agent pool operation. Is + either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2019_04_01.models.AgentPool or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2019_04_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-04-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -487,66 +552,55 @@ def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -554,10 +608,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -567,26 +620,21 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + def begin_delete( + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> LROPoller[None]: """Deletes an agent pool. Deletes the agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -598,53 +646,46 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/operations/_managed_clusters_operations.py index 5ce275d52716..b6bf37c5b645 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/operations/_managed_clusters_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,483 +27,460 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-04-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters") + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters" + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_resource_group_request( - subscription_id: str, - resource_group_name: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-04-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters", + ) # 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', min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_upgrade_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-04-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_access_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, role_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 = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-04-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "roleName": _SERIALIZER.url("role_name", role_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "roleName": _SERIALIZER.url("role_name", role_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_admin_credentials_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-04-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_user_credentials_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-04-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: + +def build_get_request(resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-04-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedCluster] = None, - content: Any = None, - **kwargs: Any + +def build_create_or_update_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-04-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_update_tags_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.TagsObject] = None, - content: Any = None, - **kwargs: Any + +def build_update_tags_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-04-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any +def build_delete_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-04-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_reset_service_principal_profile_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedClusterServicePrincipalProfile] = None, - content: Any = None, - **kwargs: Any +def build_reset_service_principal_profile_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-04-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_reset_aad_profile_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedClusterAADProfile] = None, - content: Any = None, - **kwargs: Any + +def build_reset_aad_profile_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-04-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + class ManagedClustersOperations: """ @@ -519,41 +501,35 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.ManagedClusterListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.ManagedCluster"]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. The operation returns properties of each managed cluster. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2019_04_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2019_04_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -561,14 +537,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -584,10 +557,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -597,50 +568,42 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> Iterable[_models.ManagedClusterListResult]: + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.ManagedCluster"]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. The operation returns properties of each managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2019_04_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2019_04_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -648,15 +611,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -672,10 +631,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -685,51 +642,43 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.ManagedClusterUpgradeProfile: """Gets upgrade profile for a managed cluster. Gets the details of the upgrade profile for a managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterUpgradeProfile, or the result of cls(response) + :return: ManagedClusterUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_04_01.models.ManagedClusterUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -737,69 +686,60 @@ def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterUpgradeProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore @distributed_trace def get_access_profile( - self, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, role_name: str, **kwargs: Any ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. Gets the accessProfile for the specified role name of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param role_name: The name of the role for managed cluster accessProfile resource. + :param role_name: The name of the role for managed cluster accessProfile resource. Required. :type role_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterAccessProfile, or the result of cls(response) + :return: ManagedClusterAccessProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_04_01.models.ManagedClusterAccessProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterAccessProfile] - request = build_get_access_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, role_name=role_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_access_profile.metadata['url'], + template_url=self.get_access_profile.metadata["url"], headers=_headers, params=_params, ) @@ -807,64 +747,56 @@ def get_access_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterAccessProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterAccessProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_access_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore - + get_access_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore @distributed_trace def list_cluster_admin_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster admin credential of a managed cluster. Gets cluster admin credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_04_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_admin_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_admin_credentials.metadata['url'], + template_url=self.list_cluster_admin_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -872,64 +804,56 @@ def list_cluster_admin_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_admin_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore - + list_cluster_admin_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore @distributed_trace def list_cluster_user_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster user credential of a managed cluster. Gets cluster user credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_04_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_user_credentials.metadata['url'], + template_url=self.list_cluster_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -937,64 +861,54 @@ def list_cluster_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore - + list_cluster_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore @distributed_trace - def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.ManagedCluster: + def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.ManagedCluster: """Gets a managed cluster. Gets the details of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedCluster, or the result of cls(response) + :return: ManagedCluster or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_04_01.models.ManagedCluster - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -1002,55 +916,54 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _create_or_update_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.ManagedCluster, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-04-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'ManagedCluster') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedCluster") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1058,10 +971,9 @@ def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -1069,25 +981,26 @@ def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - - @distributed_trace + @overload def begin_create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedCluster, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. @@ -1095,12 +1008,90 @@ def begin_create_or_update( Creates or updates a managed cluster with the specified configuration for agents and Kubernetes version. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2019_04_01.models.ManagedCluster + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2019_04_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster with the specified configuration for agents and Kubernetes + version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2019_04_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster with the specified configuration for agents and Kubernetes + version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. Is + either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2019_04_01.models.ManagedCluster or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1113,20 +1104,17 @@ def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2019_04_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-04-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -1134,69 +1122,66 @@ def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _update_tags_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.TagsObject, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-04-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request_initial( - subscription_id=self._config.subscription_id, + request = build_update_tags_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_tags_initial.metadata['url'], + content=_content, + template_url=self._update_tags_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1204,44 +1189,118 @@ def _update_tags_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_tags_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _update_tags_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - @distributed_trace + @overload def begin_update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates a managed cluster with the specified tags. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2019_04_01.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2019_04_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates a managed cluster with the specified tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2019_04_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates a managed cluster with the specified tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2019_04_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1254,20 +1313,17 @@ def begin_update_tags( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2019_04_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-04-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, @@ -1275,64 +1331,54 @@ def begin_update_tags( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1340,10 +1386,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1353,23 +1398,17 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> LROPoller[None]: + def begin_delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> LROPoller[None]: """Deletes a managed cluster. Deletes the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1381,85 +1420,83 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterServicePrincipalProfile, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-04-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterServicePrincipalProfile") - request = build_reset_service_principal_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_service_principal_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_service_principal_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_service_principal_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1467,10 +1504,9 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1480,29 +1516,106 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re if cls: return cls(pipeline_response, None, {}) - _reset_service_principal_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + _reset_service_principal_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore - - @distributed_trace - def begin_reset_service_principal_profile( # pylint: disable=inconsistent-return-statements + @overload + def begin_reset_service_principal_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterServicePrincipalProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: """Reset Service Principal Profile of a managed cluster. Update the service principal Profile for a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a - Managed Cluster. + Managed Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2019_04_01.models.ManagedClusterServicePrincipalProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reset Service Principal Profile of a managed cluster. + + Update the service principal Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a + Managed Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Reset Service Principal Profile of a managed cluster. + + Update the service principal Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a + Managed Cluster. Is either a model type or a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2019_04_01.models.ManagedClusterServicePrincipalProfile or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1513,20 +1626,17 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-04-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1534,67 +1644,68 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_service_principal_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + begin_reset_service_principal_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterAADProfile, + parameters: Union[_models.ManagedClusterAADProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-04-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterAADProfile") - request = build_reset_aad_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_aad_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_aad_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_aad_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1602,10 +1713,9 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1615,28 +1725,105 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement if cls: return cls(pipeline_response, None, {}) - _reset_aad_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - + _reset_aad_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - @distributed_trace - def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements + @overload + def begin_reset_aad_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterAADProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: """Reset AAD Profile of a managed cluster. Update the AAD Profile for a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed - Cluster. + Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2019_04_01.models.ManagedClusterAADProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reset AAD Profile of a managed cluster. + + Update the AAD Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed + Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterAADProfile, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Reset AAD Profile of a managed cluster. + + Update the AAD Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed + Cluster. Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2019_04_01.models.ManagedClusterAADProfile or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1647,20 +1834,17 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-04-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1668,34 +1852,30 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_aad_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + begin_reset_aad_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/operations/_operations.py index e70363671387..a2dabf532b8f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/operations/_operations.py @@ -7,10 +7,15 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,38 +25,34 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - **kwargs: Any -) -> HttpRequest: + +def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-04-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.ContainerService/operations") # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class Operations: """ @@ -72,36 +73,31 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.OperationListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.OperationValue"]: """Gets a list of compute operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationListResult or the result of cls(response) + :return: An iterator like instance of either OperationValue or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2019_04_01.models.OperationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2019_04_01.models.OperationValue] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -109,13 +105,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -131,10 +125,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -144,8 +136,6 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.ContainerService/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ContainerService/operations"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/operations/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/__init__.py index 37a5f9e02e6f..a8716d29afe8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/__init__.py @@ -14,7 +14,8 @@ except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['ContainerServiceClient'] + +__all__ = ["ContainerServiceClient"] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/_configuration.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/_configuration.py index 2301b306f79a..0699b08c493f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/_configuration.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/_configuration.py @@ -18,30 +18,26 @@ VERSION = "unknown" + class ContainerServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ContainerServiceClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2019-04-30". 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: + def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ContainerServiceClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2019-04-30") # type: str + api_version = kwargs.pop("api_version", "2019-04-30") # type: str if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -51,23 +47,24 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-containerservice/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-containerservice/{}".format(VERSION)) self._configure(**kwargs) def _configure( - self, - **kwargs # type: Any + self, **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/_container_service_client.py index ec8f09f2259e..6d4531fdac95 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/_container_service_client.py @@ -9,12 +9,11 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from . import models +from .._serialization import Deserializer, Serializer from ._configuration import ContainerServiceClientConfiguration from .operations import OpenShiftManagedClustersOperations @@ -22,16 +21,17 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class ContainerServiceClient: + +class ContainerServiceClient: # pylint: disable=client-accepts-api-version-keyword """The Container Service Client. :ivar open_shift_managed_clusters: OpenShiftManagedClustersOperations operations :vartype open_shift_managed_clusters: azure.mgmt.containerservice.v2019_04_30.operations.OpenShiftManagedClustersOperations - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -49,7 +49,9 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = ContainerServiceClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = ContainerServiceClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} @@ -60,12 +62,7 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) - - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> HttpResponse: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -74,7 +71,7 @@ def _send_request( >>> response = client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/_metadata.json b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/_metadata.json index f6f7e890129d..780e1731b922 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/_metadata.json +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/_metadata.json @@ -10,20 +10,20 @@ "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { "credential": { - "signature": "credential, # type: \"TokenCredential\"", - "description": "Credential needed for the client to connect to Azure.", + "signature": "credential: \"TokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true }, "subscription_id": { - "signature": "subscription_id, # type: str", - "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "signature": "subscription_id: str,", + "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.", "docstring_type": "str", "required": true } @@ -31,13 +31,13 @@ "async": { "credential": { "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure.", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { "signature": "subscription_id: str,", - "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.", "docstring_type": "str", "required": true } @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=\"https://management.azure.com\", # type: str", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/_patch.py index 74e48ecd07cf..f99e77fef986 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/_patch.py @@ -28,4 +28,4 @@ # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + pass diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/_vendor.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/_vendor.py index 138f663c53a4..9aad73fc743e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/_vendor.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/_vendor.py @@ -7,6 +7,7 @@ from azure.core.pipeline.transport import HttpRequest + def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) @@ -14,6 +15,7 @@ def _convert_request(request, files=None): request.set_formdata_body(files) return request + def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -21,7 +23,5 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [ - c for c in formatted_components if "{}".format(key.args[0]) not in c - ] + components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/aio/__init__.py index 37a5f9e02e6f..a8716d29afe8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/aio/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/aio/__init__.py @@ -14,7 +14,8 @@ except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['ContainerServiceClient'] + +__all__ = ["ContainerServiceClient"] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/aio/_configuration.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/aio/_configuration.py index dd0be08c4236..5e2b405f643c 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/aio/_configuration.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/aio/_configuration.py @@ -18,30 +18,26 @@ VERSION = "unknown" + class ContainerServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ContainerServiceClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2019-04-30". 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: + def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ContainerServiceClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2019-04-30") # type: str + api_version = kwargs.pop("api_version", "2019-04-30") # type: str if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -51,22 +47,21 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-containerservice/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-containerservice/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, - **kwargs: Any - ) -> None: - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/aio/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/aio/_container_service_client.py index 518b6b89f5cd..34c7e19ec43a 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/aio/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/aio/_container_service_client.py @@ -9,12 +9,11 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from .. import models +from ..._serialization import Deserializer, Serializer from ._configuration import ContainerServiceClientConfiguration from .operations import OpenShiftManagedClustersOperations @@ -22,16 +21,17 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class ContainerServiceClient: + +class ContainerServiceClient: # pylint: disable=client-accepts-api-version-keyword """The Container Service Client. :ivar open_shift_managed_clusters: OpenShiftManagedClustersOperations operations :vartype open_shift_managed_clusters: azure.mgmt.containerservice.v2019_04_30.aio.operations.OpenShiftManagedClustersOperations - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -49,7 +49,9 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = ContainerServiceClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = ContainerServiceClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} @@ -60,12 +62,7 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) - - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -74,7 +71,7 @@ def _send_request( >>> response = await client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/aio/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/aio/_patch.py index 74e48ecd07cf..f99e77fef986 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/aio/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/aio/_patch.py @@ -28,4 +28,4 @@ # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + pass diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/aio/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/aio/operations/__init__.py index 211a87879804..69775b67d4ba 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/aio/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/aio/operations/__init__.py @@ -11,8 +11,9 @@ from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'OpenShiftManagedClustersOperations', + "OpenShiftManagedClustersOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/aio/operations/_open_shift_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/aio/operations/_open_shift_managed_clusters_operations.py index f675bb3916d1..dcc19392f2eb 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/aio/operations/_open_shift_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/aio/operations/_open_shift_managed_clusters_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +29,19 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._open_shift_managed_clusters_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_resource_group_request, build_list_request, build_update_tags_request_initial -T = TypeVar('T') +from ...operations._open_shift_managed_clusters_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_resource_group_request, + build_list_request, + build_update_tags_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class OpenShiftManagedClustersOperations: """ .. warning:: @@ -45,41 +61,36 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.OpenShiftManagedClusterListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.OpenShiftManagedCluster"]: """Gets a list of OpenShift managed clusters in the specified subscription. Gets a list of OpenShift managed clusters in the specified subscription. The operation returns properties of each OpenShift managed cluster. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OpenShiftManagedClusterListResult or the result of + :return: An iterator like instance of either OpenShiftManagedCluster or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2019_04_30.models.OpenShiftManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2019_04_30.models.OpenShiftManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-30")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-04-30")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OpenShiftManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -87,14 +98,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -110,10 +118,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -123,50 +129,45 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/openShiftManagedClusters"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/openShiftManagedClusters"} # type: ignore @distributed_trace def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.OpenShiftManagedClusterListResult]: + self, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.OpenShiftManagedCluster"]: """Lists OpenShift managed clusters in the specified subscription and resource group. Lists OpenShift managed clusters in the specified subscription and resource group. The operation returns properties of each OpenShift managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OpenShiftManagedClusterListResult or the result of + :return: An iterator like instance of either OpenShiftManagedCluster or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2019_04_30.models.OpenShiftManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2019_04_30.models.OpenShiftManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-30")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-04-30")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OpenShiftManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -174,15 +175,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -198,10 +195,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -211,50 +206,40 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters"} # type: ignore @distributed_trace_async - async def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.OpenShiftManagedCluster: + async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.OpenShiftManagedCluster: """Gets a OpenShift managed cluster. Gets the details of the managed OpenShift cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the OpenShift managed cluster resource. + :param resource_name: The name of the OpenShift managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: OpenShiftManagedCluster, or the result of cls(response) + :return: OpenShiftManagedCluster or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_04_30.models.OpenShiftManagedCluster - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-30")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-04-30")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OpenShiftManagedCluster] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -262,55 +247,58 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('OpenShiftManagedCluster', pipeline_response) + deserialized = self._deserialize("OpenShiftManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore async def _create_or_update_initial( self, resource_group_name: str, resource_name: str, - parameters: _models.OpenShiftManagedCluster, + parameters: Union[_models.OpenShiftManagedCluster, IO], **kwargs: Any ) -> _models.OpenShiftManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2019-04-30")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-04-30")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.OpenShiftManagedCluster] - _json = self._serialize.body(parameters, 'OpenShiftManagedCluster') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "OpenShiftManagedCluster") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -318,10 +306,9 @@ async def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -329,25 +316,26 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('OpenShiftManagedCluster', pipeline_response) + deserialized = self._deserialize("OpenShiftManagedCluster", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('OpenShiftManagedCluster', pipeline_response) + deserialized = self._deserialize("OpenShiftManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore - + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore - @distributed_trace_async + @overload async def begin_create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.OpenShiftManagedCluster, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.OpenShiftManagedCluster]: """Creates or updates an OpenShift managed cluster. @@ -355,13 +343,16 @@ async def begin_create_or_update( Creates or updates a OpenShift managed cluster with the specified configuration for agents and OpenShift version. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the OpenShift managed cluster resource. + :param resource_name: The name of the OpenShift managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Create or Update an OpenShift Managed Cluster - operation. + operation. Required. :type parameters: ~azure.mgmt.containerservice.v2019_04_30.models.OpenShiftManagedCluster + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -374,20 +365,95 @@ async def begin_create_or_update( result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2019_04_30.models.OpenShiftManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OpenShiftManagedCluster]: + """Creates or updates an OpenShift managed cluster. + + Creates or updates a OpenShift managed cluster with the specified configuration for agents and + OpenShift version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the OpenShift managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Create or Update an OpenShift Managed Cluster + operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either OpenShiftManagedCluster or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2019_04_30.models.OpenShiftManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.OpenShiftManagedCluster, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.OpenShiftManagedCluster]: + """Creates or updates an OpenShift managed cluster. + + Creates or updates a OpenShift managed cluster with the specified configuration for agents and + OpenShift version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the OpenShift managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Create or Update an OpenShift Managed Cluster + operation. Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2019_04_30.models.OpenShiftManagedCluster or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either OpenShiftManagedCluster or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2019_04_30.models.OpenShiftManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-30")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-04-30")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.OpenShiftManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -395,69 +461,66 @@ async def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('OpenShiftManagedCluster', pipeline_response) + deserialized = self._deserialize("OpenShiftManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore async def _update_tags_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.TagsObject, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any ) -> _models.OpenShiftManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2019-04-30")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-04-30")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.OpenShiftManagedCluster] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request_initial( - subscription_id=self._config.subscription_id, + request = build_update_tags_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_tags_initial.metadata['url'], + content=_content, + template_url=self._update_tags_initial.metadata["url"], headers=_headers, params=_params, ) @@ -465,44 +528,120 @@ async def _update_tags_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('OpenShiftManagedCluster', pipeline_response) + deserialized = self._deserialize("OpenShiftManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_tags_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore - + _update_tags_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore - @distributed_trace_async + @overload async def begin_update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.OpenShiftManagedCluster]: """Updates tags on an OpenShift managed cluster. Updates an OpenShift managed cluster with the specified tags. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the OpenShift managed cluster resource. + :param resource_name: The name of the OpenShift managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Update OpenShift Managed Cluster Tags operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2019_04_30.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either OpenShiftManagedCluster or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2019_04_30.models.OpenShiftManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OpenShiftManagedCluster]: + """Updates tags on an OpenShift managed cluster. + + Updates an OpenShift managed cluster with the specified tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the OpenShift managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update OpenShift Managed Cluster Tags operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either OpenShiftManagedCluster or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2019_04_30.models.OpenShiftManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.OpenShiftManagedCluster]: + """Updates tags on an OpenShift managed cluster. + + Updates an OpenShift managed cluster with the specified tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the OpenShift managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update OpenShift Managed Cluster Tags operation. + Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2019_04_30.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -515,20 +654,17 @@ async def begin_update_tags( result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2019_04_30.models.OpenShiftManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-30")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-04-30")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.OpenShiftManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, @@ -536,64 +672,54 @@ async def begin_update_tags( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('OpenShiftManagedCluster', pipeline_response) + deserialized = self._deserialize("OpenShiftManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore + begin_update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-30")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-04-30")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -601,10 +727,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -614,23 +739,17 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: + async def begin_delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Deletes an OpenShift managed cluster. Deletes the OpenShift managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the OpenShift managed cluster resource. + :param resource_name: The name of the OpenShift managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -642,52 +761,45 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-30")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-04-30")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/aio/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/aio/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/aio/operations/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/aio/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/models/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/models/__init__.py index 421ce777c259..c010ebef8d73 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/models/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/models/__init__.py @@ -21,33 +21,31 @@ from ._models_py3 import Resource from ._models_py3 import TagsObject - -from ._container_service_client_enums import ( - OSType, - OpenShiftAgentPoolProfileRole, - OpenShiftContainerServiceVMSize, -) +from ._container_service_client_enums import OSType +from ._container_service_client_enums import OpenShiftAgentPoolProfileRole +from ._container_service_client_enums import OpenShiftContainerServiceVMSize from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'CloudErrorBody', - 'NetworkProfile', - 'OpenShiftManagedCluster', - 'OpenShiftManagedClusterAADIdentityProvider', - 'OpenShiftManagedClusterAgentPoolProfile', - 'OpenShiftManagedClusterAuthProfile', - 'OpenShiftManagedClusterBaseIdentityProvider', - 'OpenShiftManagedClusterIdentityProvider', - 'OpenShiftManagedClusterListResult', - 'OpenShiftManagedClusterMasterPoolProfile', - 'OpenShiftRouterProfile', - 'PurchasePlan', - 'Resource', - 'TagsObject', - 'OSType', - 'OpenShiftAgentPoolProfileRole', - 'OpenShiftContainerServiceVMSize', + "CloudErrorBody", + "NetworkProfile", + "OpenShiftManagedCluster", + "OpenShiftManagedClusterAADIdentityProvider", + "OpenShiftManagedClusterAgentPoolProfile", + "OpenShiftManagedClusterAuthProfile", + "OpenShiftManagedClusterBaseIdentityProvider", + "OpenShiftManagedClusterIdentityProvider", + "OpenShiftManagedClusterListResult", + "OpenShiftManagedClusterMasterPoolProfile", + "OpenShiftRouterProfile", + "PurchasePlan", + "Resource", + "TagsObject", + "OSType", + "OpenShiftAgentPoolProfileRole", + "OpenShiftContainerServiceVMSize", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/models/_container_service_client_enums.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/models/_container_service_client_enums.py index 6c64f62d0661..115c765d1314 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/models/_container_service_client_enums.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/models/_container_service_client_enums.py @@ -11,15 +11,14 @@ class OpenShiftAgentPoolProfileRole(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """OpenShiftAgentPoolProfileRole represents the role of the AgentPoolProfile. - """ + """OpenShiftAgentPoolProfileRole represents the role of the AgentPoolProfile.""" COMPUTE = "compute" INFRA = "infra" + class OpenShiftContainerServiceVMSize(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Size of OpenShift VMs. - """ + """Size of OpenShift VMs.""" STANDARD_D2_S_V3 = "Standard_D2s_v3" STANDARD_D4_S_V3 = "Standard_D4s_v3" @@ -55,9 +54,9 @@ class OpenShiftContainerServiceVMSize(str, Enum, metaclass=CaseInsensitiveEnumMe STANDARD_L16_S = "Standard_L16s" STANDARD_L32_S = "Standard_L32s" + class OSType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """OsType to be used to specify os type. Choose from Linux and Windows. Default to Linux. - """ + """OsType to be used to specify os type. Choose from Linux and Windows. Default to Linux.""" LINUX = "Linux" WINDOWS = "Windows" diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/models/_models_py3.py index 47a7d05afb37..f767b24f1e99 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/models/_models_py3.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/models/_models_py3.py @@ -1,4 +1,5 @@ # coding=utf-8 +# pylint: disable=too-many-lines # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -8,14 +9,14 @@ from typing import Dict, List, Optional, TYPE_CHECKING, Union -import msrest.serialization +from ... import _serialization if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - import __init__ as _models + from .. import models as _models -class CloudErrorBody(msrest.serialization.Model): +class CloudErrorBody(_serialization.Model): """An error response from the Container service. :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed @@ -32,10 +33,10 @@ class CloudErrorBody(msrest.serialization.Model): """ _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[CloudErrorBody]"}, } def __init__( @@ -60,14 +61,14 @@ def __init__( :keyword details: A list of additional details about the error. :paramtype details: list[~azure.mgmt.containerservice.v2019_04_30.models.CloudErrorBody] """ - super(CloudErrorBody, self).__init__(**kwargs) + super().__init__(**kwargs) self.code = code self.message = message self.target = target self.details = details -class NetworkProfile(msrest.serialization.Model): +class NetworkProfile(_serialization.Model): """Represents the OpenShift networking configuration. :ivar vnet_cidr: CIDR for the OpenShift Vnet. @@ -79,15 +80,15 @@ class NetworkProfile(msrest.serialization.Model): """ _attribute_map = { - 'vnet_cidr': {'key': 'vnetCidr', 'type': 'str'}, - 'peer_vnet_id': {'key': 'peerVnetId', 'type': 'str'}, - 'vnet_id': {'key': 'vnetId', 'type': 'str'}, + "vnet_cidr": {"key": "vnetCidr", "type": "str"}, + "peer_vnet_id": {"key": "peerVnetId", "type": "str"}, + "vnet_id": {"key": "vnetId", "type": "str"}, } def __init__( self, *, - vnet_cidr: Optional[str] = "10.0.0.0/8", + vnet_cidr: str = "10.0.0.0/8", peer_vnet_id: Optional[str] = None, vnet_id: Optional[str] = None, **kwargs @@ -100,13 +101,13 @@ def __init__( :keyword vnet_id: ID of the Vnet created for OSA cluster. :paramtype vnet_id: str """ - super(NetworkProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.vnet_cidr = vnet_cidr self.peer_vnet_id = peer_vnet_id self.vnet_id = vnet_id -class Resource(msrest.serialization.Model): +class Resource(_serialization.Model): """The Resource model definition. Variables are only populated by the server, and will be ignored when sending a request. @@ -119,41 +120,35 @@ class Resource(msrest.serialization.Model): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] """ - super(Resource, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -161,7 +156,7 @@ def __init__( self.tags = tags -class OpenShiftManagedCluster(Resource): +class OpenShiftManagedCluster(Resource): # pylint: disable=too-many-instance-attributes """OpenShift Managed cluster. Variables are only populated by the server, and will be ignored when sending a request. @@ -174,9 +169,9 @@ class OpenShiftManagedCluster(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar plan: Define the resource plan as required by ARM for billing purposes. :vartype plan: ~azure.mgmt.containerservice.v2019_04_30.models.PurchasePlan @@ -208,33 +203,39 @@ class OpenShiftManagedCluster(Resource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'provisioning_state': {'readonly': True}, - 'cluster_version': {'readonly': True}, - 'public_hostname': {'readonly': True}, - 'fqdn': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, + "provisioning_state": {"readonly": True}, + "cluster_version": {"readonly": True}, + "public_hostname": {"readonly": True}, + "fqdn": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'plan': {'key': 'plan', 'type': 'PurchasePlan'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'open_shift_version': {'key': 'properties.openShiftVersion', 'type': 'str'}, - 'cluster_version': {'key': 'properties.clusterVersion', 'type': 'str'}, - 'public_hostname': {'key': 'properties.publicHostname', 'type': 'str'}, - 'fqdn': {'key': 'properties.fqdn', 'type': 'str'}, - 'network_profile': {'key': 'properties.networkProfile', 'type': 'NetworkProfile'}, - 'router_profiles': {'key': 'properties.routerProfiles', 'type': '[OpenShiftRouterProfile]'}, - 'master_pool_profile': {'key': 'properties.masterPoolProfile', 'type': 'OpenShiftManagedClusterMasterPoolProfile'}, - 'agent_pool_profiles': {'key': 'properties.agentPoolProfiles', 'type': '[OpenShiftManagedClusterAgentPoolProfile]'}, - 'auth_profile': {'key': 'properties.authProfile', 'type': 'OpenShiftManagedClusterAuthProfile'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "plan": {"key": "plan", "type": "PurchasePlan"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "open_shift_version": {"key": "properties.openShiftVersion", "type": "str"}, + "cluster_version": {"key": "properties.clusterVersion", "type": "str"}, + "public_hostname": {"key": "properties.publicHostname", "type": "str"}, + "fqdn": {"key": "properties.fqdn", "type": "str"}, + "network_profile": {"key": "properties.networkProfile", "type": "NetworkProfile"}, + "router_profiles": {"key": "properties.routerProfiles", "type": "[OpenShiftRouterProfile]"}, + "master_pool_profile": { + "key": "properties.masterPoolProfile", + "type": "OpenShiftManagedClusterMasterPoolProfile", + }, + "agent_pool_profiles": { + "key": "properties.agentPoolProfiles", + "type": "[OpenShiftManagedClusterAgentPoolProfile]", + }, + "auth_profile": {"key": "properties.authProfile", "type": "OpenShiftManagedClusterAuthProfile"}, } def __init__( @@ -252,9 +253,9 @@ def __init__( **kwargs ): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword plan: Define the resource plan as required by ARM for billing purposes. :paramtype plan: ~azure.mgmt.containerservice.v2019_04_30.models.PurchasePlan @@ -275,7 +276,7 @@ def __init__( :paramtype auth_profile: ~azure.mgmt.containerservice.v2019_04_30.models.OpenShiftManagedClusterAuthProfile """ - super(OpenShiftManagedCluster, self).__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.plan = plan self.provisioning_state = None self.open_shift_version = open_shift_version @@ -289,37 +290,31 @@ def __init__( self.auth_profile = auth_profile -class OpenShiftManagedClusterBaseIdentityProvider(msrest.serialization.Model): +class OpenShiftManagedClusterBaseIdentityProvider(_serialization.Model): """Structure for any Identity provider. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: OpenShiftManagedClusterAADIdentityProvider. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + OpenShiftManagedClusterAADIdentityProvider All required parameters must be populated in order to send to Azure. - :ivar kind: Required. The kind of the provider.Constant filled by server. + :ivar kind: The kind of the provider. Required. :vartype kind: str """ _validation = { - 'kind': {'required': True}, + "kind": {"required": True}, } _attribute_map = { - 'kind': {'key': 'kind', 'type': 'str'}, + "kind": {"key": "kind", "type": "str"}, } - _subtype_map = { - 'kind': {'AADIdentityProvider': 'OpenShiftManagedClusterAADIdentityProvider'} - } + _subtype_map = {"kind": {"AADIdentityProvider": "OpenShiftManagedClusterAADIdentityProvider"}} - def __init__( - self, - **kwargs - ): - """ - """ - super(OpenShiftManagedClusterBaseIdentityProvider, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.kind = None # type: Optional[str] @@ -328,7 +323,7 @@ class OpenShiftManagedClusterAADIdentityProvider(OpenShiftManagedClusterBaseIden All required parameters must be populated in order to send to Azure. - :ivar kind: Required. The kind of the provider.Constant filled by server. + :ivar kind: The kind of the provider. Required. :vartype kind: str :ivar client_id: The clientId password associated with the provider. :vartype client_id: str @@ -341,15 +336,15 @@ class OpenShiftManagedClusterAADIdentityProvider(OpenShiftManagedClusterBaseIden """ _validation = { - 'kind': {'required': True}, + "kind": {"required": True}, } _attribute_map = { - 'kind': {'key': 'kind', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'secret': {'key': 'secret', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'customer_admin_group_id': {'key': 'customerAdminGroupId', 'type': 'str'}, + "kind": {"key": "kind", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + "secret": {"key": "secret", "type": "str"}, + "tenant_id": {"key": "tenantId", "type": "str"}, + "customer_admin_group_id": {"key": "customerAdminGroupId", "type": "str"}, } def __init__( @@ -371,57 +366,57 @@ def __init__( :keyword customer_admin_group_id: The groupId to be granted cluster admin role. :paramtype customer_admin_group_id: str """ - super(OpenShiftManagedClusterAADIdentityProvider, self).__init__(**kwargs) - self.kind = 'AADIdentityProvider' # type: str + super().__init__(**kwargs) + self.kind = "AADIdentityProvider" # type: str self.client_id = client_id self.secret = secret self.tenant_id = tenant_id self.customer_admin_group_id = customer_admin_group_id -class OpenShiftManagedClusterAgentPoolProfile(msrest.serialization.Model): +class OpenShiftManagedClusterAgentPoolProfile(_serialization.Model): """Defines the configuration of the OpenShift cluster VMs. All required parameters must be populated in order to send to Azure. - :ivar name: Required. Unique name of the pool profile in the context of the subscription and - resource group. + :ivar name: Unique name of the pool profile in the context of the subscription and resource + group. Required. :vartype name: str - :ivar count: Required. Number of agents (VMs) to host docker containers. + :ivar count: Number of agents (VMs) to host docker containers. Required. :vartype count: int - :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_D2s_v3", + :ivar vm_size: Size of agent VMs. Required. Known values are: "Standard_D2s_v3", "Standard_D4s_v3", "Standard_D8s_v3", "Standard_D16s_v3", "Standard_D32s_v3", "Standard_D64s_v3", "Standard_DS4_v2", "Standard_DS5_v2", "Standard_F8s_v2", "Standard_F16s_v2", "Standard_F32s_v2", "Standard_F64s_v2", "Standard_F72s_v2", "Standard_F8s", "Standard_F16s", "Standard_E4s_v3", "Standard_E8s_v3", "Standard_E16s_v3", "Standard_E20s_v3", "Standard_E32s_v3", "Standard_E64s_v3", "Standard_GS2", "Standard_GS3", "Standard_GS4", "Standard_GS5", "Standard_DS12_v2", "Standard_DS13_v2", "Standard_DS14_v2", "Standard_DS15_v2", - "Standard_L4s", "Standard_L8s", "Standard_L16s", "Standard_L32s". + "Standard_L4s", "Standard_L8s", "Standard_L16s", and "Standard_L32s". :vartype vm_size: str or ~azure.mgmt.containerservice.v2019_04_30.models.OpenShiftContainerServiceVMSize :ivar subnet_cidr: Subnet CIDR for the peering. :vartype subnet_cidr: str :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Known values are: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux" and "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2019_04_30.models.OSType - :ivar role: Define the role of the AgentPoolProfile. Known values are: "compute", "infra". + :ivar role: Define the role of the AgentPoolProfile. Known values are: "compute" and "infra". :vartype role: str or ~azure.mgmt.containerservice.v2019_04_30.models.OpenShiftAgentPoolProfileRole """ _validation = { - 'name': {'required': True}, - 'count': {'required': True}, - 'vm_size': {'required': True}, + "name": {"required": True}, + "count": {"required": True}, + "vm_size": {"required": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'count': {'key': 'count', 'type': 'int'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'subnet_cidr': {'key': 'subnetCidr', 'type': 'str'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'role': {'key': 'role', 'type': 'str'}, + "name": {"key": "name", "type": "str"}, + "count": {"key": "count", "type": "int"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "subnet_cidr": {"key": "subnetCidr", "type": "str"}, + "os_type": {"key": "osType", "type": "str"}, + "role": {"key": "role", "type": "str"}, } def __init__( @@ -430,37 +425,38 @@ def __init__( name: str, count: int, vm_size: Union[str, "_models.OpenShiftContainerServiceVMSize"], - subnet_cidr: Optional[str] = "10.0.0.0/24", - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + subnet_cidr: str = "10.0.0.0/24", + os_type: Union[str, "_models.OSType"] = "Linux", role: Optional[Union[str, "_models.OpenShiftAgentPoolProfileRole"]] = None, **kwargs ): """ - :keyword name: Required. Unique name of the pool profile in the context of the subscription and - resource group. + :keyword name: Unique name of the pool profile in the context of the subscription and resource + group. Required. :paramtype name: str - :keyword count: Required. Number of agents (VMs) to host docker containers. + :keyword count: Number of agents (VMs) to host docker containers. Required. :paramtype count: int - :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_D2s_v3", + :keyword vm_size: Size of agent VMs. Required. Known values are: "Standard_D2s_v3", "Standard_D4s_v3", "Standard_D8s_v3", "Standard_D16s_v3", "Standard_D32s_v3", "Standard_D64s_v3", "Standard_DS4_v2", "Standard_DS5_v2", "Standard_F8s_v2", "Standard_F16s_v2", "Standard_F32s_v2", "Standard_F64s_v2", "Standard_F72s_v2", "Standard_F8s", "Standard_F16s", "Standard_E4s_v3", "Standard_E8s_v3", "Standard_E16s_v3", "Standard_E20s_v3", "Standard_E32s_v3", "Standard_E64s_v3", "Standard_GS2", "Standard_GS3", "Standard_GS4", "Standard_GS5", "Standard_DS12_v2", "Standard_DS13_v2", "Standard_DS14_v2", "Standard_DS15_v2", - "Standard_L4s", "Standard_L8s", "Standard_L16s", "Standard_L32s". + "Standard_L4s", "Standard_L8s", "Standard_L16s", and "Standard_L32s". :paramtype vm_size: str or ~azure.mgmt.containerservice.v2019_04_30.models.OpenShiftContainerServiceVMSize :keyword subnet_cidr: Subnet CIDR for the peering. :paramtype subnet_cidr: str :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux" and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2019_04_30.models.OSType - :keyword role: Define the role of the AgentPoolProfile. Known values are: "compute", "infra". + :keyword role: Define the role of the AgentPoolProfile. Known values are: "compute" and + "infra". :paramtype role: str or ~azure.mgmt.containerservice.v2019_04_30.models.OpenShiftAgentPoolProfileRole """ - super(OpenShiftManagedClusterAgentPoolProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.count = count self.vm_size = vm_size @@ -469,7 +465,7 @@ def __init__( self.role = role -class OpenShiftManagedClusterAuthProfile(msrest.serialization.Model): +class OpenShiftManagedClusterAuthProfile(_serialization.Model): """Defines all possible authentication profiles for the OpenShift cluster. :ivar identity_providers: Type of authentication profile to use. @@ -478,25 +474,22 @@ class OpenShiftManagedClusterAuthProfile(msrest.serialization.Model): """ _attribute_map = { - 'identity_providers': {'key': 'identityProviders', 'type': '[OpenShiftManagedClusterIdentityProvider]'}, + "identity_providers": {"key": "identityProviders", "type": "[OpenShiftManagedClusterIdentityProvider]"}, } def __init__( - self, - *, - identity_providers: Optional[List["_models.OpenShiftManagedClusterIdentityProvider"]] = None, - **kwargs + self, *, identity_providers: Optional[List["_models.OpenShiftManagedClusterIdentityProvider"]] = None, **kwargs ): """ :keyword identity_providers: Type of authentication profile to use. :paramtype identity_providers: list[~azure.mgmt.containerservice.v2019_04_30.models.OpenShiftManagedClusterIdentityProvider] """ - super(OpenShiftManagedClusterAuthProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.identity_providers = identity_providers -class OpenShiftManagedClusterIdentityProvider(msrest.serialization.Model): +class OpenShiftManagedClusterIdentityProvider(_serialization.Model): """Defines the configuration of the identity providers to be used in the OpenShift cluster. :ivar name: Name of the provider. @@ -507,8 +500,8 @@ class OpenShiftManagedClusterIdentityProvider(msrest.serialization.Model): """ _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'provider': {'key': 'provider', 'type': 'OpenShiftManagedClusterBaseIdentityProvider'}, + "name": {"key": "name", "type": "str"}, + "provider": {"key": "provider", "type": "OpenShiftManagedClusterBaseIdentityProvider"}, } def __init__( @@ -525,12 +518,12 @@ def __init__( :paramtype provider: ~azure.mgmt.containerservice.v2019_04_30.models.OpenShiftManagedClusterBaseIdentityProvider """ - super(OpenShiftManagedClusterIdentityProvider, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.provider = provider -class OpenShiftManagedClusterListResult(msrest.serialization.Model): +class OpenShiftManagedClusterListResult(_serialization.Model): """The response from the List OpenShift Managed Clusters operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -542,30 +535,25 @@ class OpenShiftManagedClusterListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[OpenShiftManagedCluster]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[OpenShiftManagedCluster]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.OpenShiftManagedCluster"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.OpenShiftManagedCluster"]] = None, **kwargs): """ :keyword value: The list of OpenShift managed clusters. :paramtype value: list[~azure.mgmt.containerservice.v2019_04_30.models.OpenShiftManagedCluster] """ - super(OpenShiftManagedClusterListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class OpenShiftManagedClusterMasterPoolProfile(msrest.serialization.Model): +class OpenShiftManagedClusterMasterPoolProfile(_serialization.Model): """OpenShiftManagedClusterMaterPoolProfile contains configuration for OpenShift master VMs. All required parameters must be populated in order to send to Azure. @@ -573,37 +561,37 @@ class OpenShiftManagedClusterMasterPoolProfile(msrest.serialization.Model): :ivar name: Unique name of the master pool profile in the context of the subscription and resource group. :vartype name: str - :ivar count: Required. Number of masters (VMs) to host docker containers. The default value is - 3. + :ivar count: Number of masters (VMs) to host docker containers. The default value is 3. + Required. :vartype count: int - :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_D2s_v3", + :ivar vm_size: Size of agent VMs. Required. Known values are: "Standard_D2s_v3", "Standard_D4s_v3", "Standard_D8s_v3", "Standard_D16s_v3", "Standard_D32s_v3", "Standard_D64s_v3", "Standard_DS4_v2", "Standard_DS5_v2", "Standard_F8s_v2", "Standard_F16s_v2", "Standard_F32s_v2", "Standard_F64s_v2", "Standard_F72s_v2", "Standard_F8s", "Standard_F16s", "Standard_E4s_v3", "Standard_E8s_v3", "Standard_E16s_v3", "Standard_E20s_v3", "Standard_E32s_v3", "Standard_E64s_v3", "Standard_GS2", "Standard_GS3", "Standard_GS4", "Standard_GS5", "Standard_DS12_v2", "Standard_DS13_v2", "Standard_DS14_v2", "Standard_DS15_v2", - "Standard_L4s", "Standard_L8s", "Standard_L16s", "Standard_L32s". + "Standard_L4s", "Standard_L8s", "Standard_L16s", and "Standard_L32s". :vartype vm_size: str or ~azure.mgmt.containerservice.v2019_04_30.models.OpenShiftContainerServiceVMSize :ivar subnet_cidr: Subnet CIDR for the peering. :vartype subnet_cidr: str :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Known values are: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux" and "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2019_04_30.models.OSType """ _validation = { - 'count': {'required': True}, - 'vm_size': {'required': True}, + "count": {"required": True}, + "vm_size": {"required": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'count': {'key': 'count', 'type': 'int'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'subnet_cidr': {'key': 'subnetCidr', 'type': 'str'}, - 'os_type': {'key': 'osType', 'type': 'str'}, + "name": {"key": "name", "type": "str"}, + "count": {"key": "count", "type": "int"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "subnet_cidr": {"key": "subnetCidr", "type": "str"}, + "os_type": {"key": "osType", "type": "str"}, } def __init__( @@ -613,33 +601,33 @@ def __init__( vm_size: Union[str, "_models.OpenShiftContainerServiceVMSize"], name: Optional[str] = None, subnet_cidr: Optional[str] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", **kwargs ): """ :keyword name: Unique name of the master pool profile in the context of the subscription and resource group. :paramtype name: str - :keyword count: Required. Number of masters (VMs) to host docker containers. The default value - is 3. + :keyword count: Number of masters (VMs) to host docker containers. The default value is 3. + Required. :paramtype count: int - :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_D2s_v3", + :keyword vm_size: Size of agent VMs. Required. Known values are: "Standard_D2s_v3", "Standard_D4s_v3", "Standard_D8s_v3", "Standard_D16s_v3", "Standard_D32s_v3", "Standard_D64s_v3", "Standard_DS4_v2", "Standard_DS5_v2", "Standard_F8s_v2", "Standard_F16s_v2", "Standard_F32s_v2", "Standard_F64s_v2", "Standard_F72s_v2", "Standard_F8s", "Standard_F16s", "Standard_E4s_v3", "Standard_E8s_v3", "Standard_E16s_v3", "Standard_E20s_v3", "Standard_E32s_v3", "Standard_E64s_v3", "Standard_GS2", "Standard_GS3", "Standard_GS4", "Standard_GS5", "Standard_DS12_v2", "Standard_DS13_v2", "Standard_DS14_v2", "Standard_DS15_v2", - "Standard_L4s", "Standard_L8s", "Standard_L16s", "Standard_L32s". + "Standard_L4s", "Standard_L8s", "Standard_L16s", and "Standard_L32s". :paramtype vm_size: str or ~azure.mgmt.containerservice.v2019_04_30.models.OpenShiftContainerServiceVMSize :keyword subnet_cidr: Subnet CIDR for the peering. :paramtype subnet_cidr: str :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux" and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2019_04_30.models.OSType """ - super(OpenShiftManagedClusterMasterPoolProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.count = count self.vm_size = vm_size @@ -647,7 +635,7 @@ def __init__( self.os_type = os_type -class OpenShiftRouterProfile(msrest.serialization.Model): +class OpenShiftRouterProfile(_serialization.Model): """Represents an OpenShift router. Variables are only populated by the server, and will be ignored when sending a request. @@ -661,33 +649,28 @@ class OpenShiftRouterProfile(msrest.serialization.Model): """ _validation = { - 'public_subdomain': {'readonly': True}, - 'fqdn': {'readonly': True}, + "public_subdomain": {"readonly": True}, + "fqdn": {"readonly": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'public_subdomain': {'key': 'publicSubdomain', 'type': 'str'}, - 'fqdn': {'key': 'fqdn', 'type': 'str'}, + "name": {"key": "name", "type": "str"}, + "public_subdomain": {"key": "publicSubdomain", "type": "str"}, + "fqdn": {"key": "fqdn", "type": "str"}, } - def __init__( - self, - *, - name: Optional[str] = None, - **kwargs - ): + def __init__(self, *, name: Optional[str] = None, **kwargs): """ :keyword name: Name of the router profile. :paramtype name: str """ - super(OpenShiftRouterProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.public_subdomain = None self.fqdn = None -class PurchasePlan(msrest.serialization.Model): +class PurchasePlan(_serialization.Model): """Used for establishing the purchase context of any 3rd Party artifact through MarketPlace. :ivar name: The plan ID. @@ -702,10 +685,10 @@ class PurchasePlan(msrest.serialization.Model): """ _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'product': {'key': 'product', 'type': 'str'}, - 'promotion_code': {'key': 'promotionCode', 'type': 'str'}, - 'publisher': {'key': 'publisher', 'type': 'str'}, + "name": {"key": "name", "type": "str"}, + "product": {"key": "product", "type": "str"}, + "promotion_code": {"key": "promotionCode", "type": "str"}, + "publisher": {"key": "publisher", "type": "str"}, } def __init__( @@ -728,33 +711,28 @@ def __init__( :keyword publisher: The plan ID. :paramtype publisher: str """ - super(PurchasePlan, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.product = product self.promotion_code = promotion_code self.publisher = publisher -class TagsObject(msrest.serialization.Model): +class TagsObject(_serialization.Model): """Tags object for patch operations. - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] """ _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] """ - super(TagsObject, self).__init__(**kwargs) + super().__init__(**kwargs) self.tags = tags diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/models/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/models/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/models/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/models/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/operations/__init__.py index 211a87879804..69775b67d4ba 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/operations/__init__.py @@ -11,8 +11,9 @@ from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'OpenShiftManagedClustersOperations', + "OpenShiftManagedClustersOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/operations/_open_shift_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/operations/_open_shift_managed_clusters_operations.py index 97238bf99515..fa3fb7aa547c 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/operations/_open_shift_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/operations/_open_shift_managed_clusters_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,243 +27,197 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-30")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-04-30")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/openShiftManagedClusters") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/openShiftManagedClusters" + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_resource_group_request( - subscription_id: str, - resource_group_name: str, - **kwargs: Any -) -> HttpRequest: +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-30")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-04-30")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters", + ) # 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', min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: + _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, resource_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-30")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-04-30")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.OpenShiftManagedCluster] = None, - content: Any = None, - **kwargs: Any + _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, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-30")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-04-30")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) - - -def build_update_tags_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.TagsObject] = None, - content: Any = None, - **kwargs: Any + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_tags_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-30")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-04-30")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-30")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-04-30")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class OpenShiftManagedClustersOperations: """ @@ -279,41 +238,36 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.OpenShiftManagedClusterListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.OpenShiftManagedCluster"]: """Gets a list of OpenShift managed clusters in the specified subscription. Gets a list of OpenShift managed clusters in the specified subscription. The operation returns properties of each OpenShift managed cluster. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OpenShiftManagedClusterListResult or the result of + :return: An iterator like instance of either OpenShiftManagedCluster or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2019_04_30.models.OpenShiftManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2019_04_30.models.OpenShiftManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-30")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-04-30")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OpenShiftManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -321,14 +275,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -344,10 +295,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -357,50 +306,45 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/openShiftManagedClusters"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/openShiftManagedClusters"} # type: ignore @distributed_trace def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> Iterable[_models.OpenShiftManagedClusterListResult]: + self, resource_group_name: str, **kwargs: Any + ) -> Iterable["_models.OpenShiftManagedCluster"]: """Lists OpenShift managed clusters in the specified subscription and resource group. Lists OpenShift managed clusters in the specified subscription and resource group. The operation returns properties of each OpenShift managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OpenShiftManagedClusterListResult or the result of + :return: An iterator like instance of either OpenShiftManagedCluster or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2019_04_30.models.OpenShiftManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2019_04_30.models.OpenShiftManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-30")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-04-30")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OpenShiftManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -408,15 +352,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -432,10 +372,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -445,50 +383,40 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters"} # type: ignore @distributed_trace - def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.OpenShiftManagedCluster: + def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.OpenShiftManagedCluster: """Gets a OpenShift managed cluster. Gets the details of the managed OpenShift cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the OpenShift managed cluster resource. + :param resource_name: The name of the OpenShift managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: OpenShiftManagedCluster, or the result of cls(response) + :return: OpenShiftManagedCluster or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_04_30.models.OpenShiftManagedCluster - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-30")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-04-30")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OpenShiftManagedCluster] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -496,55 +424,58 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('OpenShiftManagedCluster', pipeline_response) + deserialized = self._deserialize("OpenShiftManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore def _create_or_update_initial( self, resource_group_name: str, resource_name: str, - parameters: _models.OpenShiftManagedCluster, + parameters: Union[_models.OpenShiftManagedCluster, IO], **kwargs: Any ) -> _models.OpenShiftManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2019-04-30")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-04-30")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.OpenShiftManagedCluster] - _json = self._serialize.body(parameters, 'OpenShiftManagedCluster') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "OpenShiftManagedCluster") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -552,10 +483,9 @@ def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -563,25 +493,26 @@ def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('OpenShiftManagedCluster', pipeline_response) + deserialized = self._deserialize("OpenShiftManagedCluster", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('OpenShiftManagedCluster', pipeline_response) + deserialized = self._deserialize("OpenShiftManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore - + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore - @distributed_trace + @overload def begin_create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.OpenShiftManagedCluster, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.OpenShiftManagedCluster]: """Creates or updates an OpenShift managed cluster. @@ -589,13 +520,94 @@ def begin_create_or_update( Creates or updates a OpenShift managed cluster with the specified configuration for agents and OpenShift version. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the OpenShift managed cluster resource. + :param resource_name: The name of the OpenShift managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Create or Update an OpenShift Managed Cluster - operation. + operation. Required. :type parameters: ~azure.mgmt.containerservice.v2019_04_30.models.OpenShiftManagedCluster + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either OpenShiftManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2019_04_30.models.OpenShiftManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OpenShiftManagedCluster]: + """Creates or updates an OpenShift managed cluster. + + Creates or updates a OpenShift managed cluster with the specified configuration for agents and + OpenShift version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the OpenShift managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Create or Update an OpenShift Managed Cluster + operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either OpenShiftManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2019_04_30.models.OpenShiftManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.OpenShiftManagedCluster, IO], + **kwargs: Any + ) -> LROPoller[_models.OpenShiftManagedCluster]: + """Creates or updates an OpenShift managed cluster. + + Creates or updates a OpenShift managed cluster with the specified configuration for agents and + OpenShift version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the OpenShift managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Create or Update an OpenShift Managed Cluster + operation. Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2019_04_30.models.OpenShiftManagedCluster or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -608,20 +620,17 @@ def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2019_04_30.models.OpenShiftManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-30")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-04-30")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.OpenShiftManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -629,69 +638,66 @@ def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('OpenShiftManagedCluster', pipeline_response) + deserialized = self._deserialize("OpenShiftManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore def _update_tags_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.TagsObject, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any ) -> _models.OpenShiftManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2019-04-30")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-04-30")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.OpenShiftManagedCluster] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request_initial( - subscription_id=self._config.subscription_id, + request = build_update_tags_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_tags_initial.metadata['url'], + content=_content, + template_url=self._update_tags_initial.metadata["url"], headers=_headers, params=_params, ) @@ -699,44 +705,87 @@ def _update_tags_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('OpenShiftManagedCluster', pipeline_response) + deserialized = self._deserialize("OpenShiftManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_tags_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore + _update_tags_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore - - @distributed_trace + @overload def begin_update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.OpenShiftManagedCluster]: """Updates tags on an OpenShift managed cluster. Updates an OpenShift managed cluster with the specified tags. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the OpenShift managed cluster resource. + :param resource_name: The name of the OpenShift managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Update OpenShift Managed Cluster Tags operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2019_04_30.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either OpenShiftManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2019_04_30.models.OpenShiftManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OpenShiftManagedCluster]: + """Updates tags on an OpenShift managed cluster. + + Updates an OpenShift managed cluster with the specified tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the OpenShift managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update OpenShift Managed Cluster Tags operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -749,20 +798,50 @@ def begin_update_tags( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2019_04_30.models.OpenShiftManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> LROPoller[_models.OpenShiftManagedCluster]: + """Updates tags on an OpenShift managed cluster. + + Updates an OpenShift managed cluster with the specified tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the OpenShift managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update OpenShift Managed Cluster Tags operation. + Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2019_04_30.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either OpenShiftManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2019_04_30.models.OpenShiftManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-30")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-04-30")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.OpenShiftManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, @@ -770,64 +849,54 @@ def begin_update_tags( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('OpenShiftManagedCluster', pipeline_response) + deserialized = self._deserialize("OpenShiftManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore + begin_update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-30")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-04-30")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -835,10 +904,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -848,23 +916,17 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> LROPoller[None]: + def begin_delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> LROPoller[None]: """Deletes an OpenShift managed cluster. Deletes the OpenShift managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the OpenShift managed cluster resource. + :param resource_name: The name of the OpenShift managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -876,52 +938,45 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-30")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-04-30")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/operations/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/__init__.py index 37a5f9e02e6f..a8716d29afe8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/__init__.py @@ -14,7 +14,8 @@ except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['ContainerServiceClient'] + +__all__ = ["ContainerServiceClient"] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/_configuration.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/_configuration.py index cba01815aecf..796b8d0d960c 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/_configuration.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/_configuration.py @@ -18,30 +18,26 @@ VERSION = "unknown" + class ContainerServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ContainerServiceClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2019-06-01". 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: + def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ContainerServiceClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2019-06-01") # type: str + api_version = kwargs.pop("api_version", "2019-06-01") # type: str if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -51,23 +47,24 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-containerservice/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-containerservice/{}".format(VERSION)) self._configure(**kwargs) def _configure( - self, - **kwargs # type: Any + self, **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/_container_service_client.py index d8a6d42b601a..314ccadc90df 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/_container_service_client.py @@ -9,12 +9,11 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from . import models +from .._serialization import Deserializer, Serializer from ._configuration import ContainerServiceClientConfiguration from .operations import AgentPoolsOperations, ManagedClustersOperations, Operations @@ -22,7 +21,8 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class ContainerServiceClient: + +class ContainerServiceClient: # pylint: disable=client-accepts-api-version-keyword """The Container Service Client. :ivar operations: Operations operations @@ -32,10 +32,10 @@ class ContainerServiceClient: azure.mgmt.containerservice.v2019_06_01.operations.ManagedClustersOperations :ivar agent_pools: AgentPoolsOperations operations :vartype agent_pools: azure.mgmt.containerservice.v2019_06_01.operations.AgentPoolsOperations - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -53,29 +53,22 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = ContainerServiceClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = ContainerServiceClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize - ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.managed_clusters = ManagedClustersOperations( self._client, self._config, self._serialize, self._deserialize ) - self.agent_pools = AgentPoolsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - + self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> HttpResponse: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -84,7 +77,7 @@ def _send_request( >>> response = client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/_metadata.json b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/_metadata.json index 6e5552f117f8..fc7c409419ad 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/_metadata.json +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/_metadata.json @@ -10,20 +10,20 @@ "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { "credential": { - "signature": "credential, # type: \"TokenCredential\"", - "description": "Credential needed for the client to connect to Azure.", + "signature": "credential: \"TokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true }, "subscription_id": { - "signature": "subscription_id, # type: str", - "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "signature": "subscription_id: str,", + "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.", "docstring_type": "str", "required": true } @@ -31,13 +31,13 @@ "async": { "credential": { "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure.", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { "signature": "subscription_id: str,", - "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.", "docstring_type": "str", "required": true } @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=\"https://management.azure.com\", # type: str", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/_patch.py index 74e48ecd07cf..f99e77fef986 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/_patch.py @@ -28,4 +28,4 @@ # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + pass diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/_vendor.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/_vendor.py index 138f663c53a4..9aad73fc743e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/_vendor.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/_vendor.py @@ -7,6 +7,7 @@ from azure.core.pipeline.transport import HttpRequest + def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) @@ -14,6 +15,7 @@ def _convert_request(request, files=None): request.set_formdata_body(files) return request + def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -21,7 +23,5 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [ - c for c in formatted_components if "{}".format(key.args[0]) not in c - ] + components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/aio/__init__.py index 37a5f9e02e6f..a8716d29afe8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/aio/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/aio/__init__.py @@ -14,7 +14,8 @@ except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['ContainerServiceClient'] + +__all__ = ["ContainerServiceClient"] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/aio/_configuration.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/aio/_configuration.py index e31ed59e1657..c44edde0ac29 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/aio/_configuration.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/aio/_configuration.py @@ -18,30 +18,26 @@ VERSION = "unknown" + class ContainerServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ContainerServiceClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2019-06-01". 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: + def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ContainerServiceClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2019-06-01") # type: str + api_version = kwargs.pop("api_version", "2019-06-01") # type: str if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -51,22 +47,21 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-containerservice/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-containerservice/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, - **kwargs: Any - ) -> None: - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/aio/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/aio/_container_service_client.py index 8f2a9c6ac6e6..e859946dcaf2 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/aio/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/aio/_container_service_client.py @@ -9,12 +9,11 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from .. import models +from ..._serialization import Deserializer, Serializer from ._configuration import ContainerServiceClientConfiguration from .operations import AgentPoolsOperations, ManagedClustersOperations, Operations @@ -22,7 +21,8 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class ContainerServiceClient: + +class ContainerServiceClient: # pylint: disable=client-accepts-api-version-keyword """The Container Service Client. :ivar operations: Operations operations @@ -33,10 +33,10 @@ class ContainerServiceClient: :ivar agent_pools: AgentPoolsOperations operations :vartype agent_pools: azure.mgmt.containerservice.v2019_06_01.aio.operations.AgentPoolsOperations - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -54,29 +54,22 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = ContainerServiceClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = ContainerServiceClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize - ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.managed_clusters = ManagedClustersOperations( self._client, self._config, self._serialize, self._deserialize ) - self.agent_pools = AgentPoolsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - + self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -85,7 +78,7 @@ def _send_request( >>> response = await client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/aio/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/aio/_patch.py index 74e48ecd07cf..f99e77fef986 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/aio/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/aio/_patch.py @@ -28,4 +28,4 @@ # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + pass diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/aio/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/aio/operations/__init__.py index 403c0174f052..ee6608454b6b 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/aio/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/aio/operations/__init__.py @@ -13,10 +13,11 @@ from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'Operations', - 'ManagedClustersOperations', - 'AgentPoolsOperations', + "Operations", + "ManagedClustersOperations", + "AgentPoolsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/aio/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/aio/operations/_agent_pools_operations.py index 3b525f9ca9b7..add29ba1e2b5 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/aio/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/aio/operations/_agent_pools_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +29,19 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._agent_pools_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_available_agent_pool_versions_request, build_get_request, build_get_upgrade_profile_request, build_list_request -T = TypeVar('T') +from ...operations._agent_pools_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_available_agent_pool_versions_request, + build_get_request, + build_get_upgrade_profile_request, + build_list_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class AgentPoolsOperations: """ .. warning:: @@ -45,48 +61,41 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.AgentPoolListResult]: + def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncIterable["_models.AgentPool"]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. The operation returns properties of each agent pool. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AgentPoolListResult or the result of cls(response) + :return: An iterator like instance of either AgentPool or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2019_06_01.models.AgentPoolListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2019_06_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -94,16 +103,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -119,10 +123,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -132,54 +134,45 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore @distributed_trace_async async def get( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPool: """Gets the agent pool. Gets the details of the agent pool by managed cluster and resource group. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPool, or the result of cls(response) + :return: AgentPool or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_06_01.models.AgentPool - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -187,57 +180,60 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore async def _create_or_update_initial( self, resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: _models.AgentPool, + parameters: Union[_models.AgentPool, IO], **kwargs: Any ) -> _models.AgentPool: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - _json = self._serialize.body(parameters, 'AgentPool') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "AgentPool") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -245,10 +241,9 @@ async def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -256,40 +251,45 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - - @distributed_trace_async + @overload async def begin_create_or_update( self, resource_group_name: str, resource_name: str, agent_pool_name: str, parameters: _models.AgentPool, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.AgentPool]: """Creates or updates an agent pool. Creates or updates an agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :param parameters: Parameters supplied to the Create or Update an agent pool operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2019_06_01.models.AgentPool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -302,20 +302,99 @@ async def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2019_06_01.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AgentPool]: + """Creates or updates an agent pool. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: Parameters supplied to the Create or Update an agent pool operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AgentPool or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2019_06_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: Union[_models.AgentPool, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.AgentPool]: + """Creates or updates an agent pool. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: Parameters supplied to the Create or Update an agent pool operation. Is + either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2019_06_01.models.AgentPool or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AgentPool or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2019_06_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -324,66 +403,55 @@ async def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -391,10 +459,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -404,26 +471,21 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + async def begin_delete( + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes an agent pool. Deletes the agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -435,100 +497,86 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace_async async def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPoolUpgradeProfile: """Gets upgrade profile for an agent pool. Gets the details of the upgrade profile for an agent pool with a specified resource group and managed cluster name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolUpgradeProfile, or the result of cls(response) + :return: AgentPoolUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_06_01.models.AgentPoolUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -536,64 +584,56 @@ async def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolUpgradeProfile', pipeline_response) + deserialized = self._deserialize("AgentPoolUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore @distributed_trace_async async def get_available_agent_pool_versions( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported versions for the specified agent pool. Gets a list of supported versions for the specified agent pool. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolAvailableVersions, or the result of cls(response) + :return: AgentPoolAvailableVersions or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_06_01.models.AgentPoolAvailableVersions - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolAvailableVersions] - request = build_get_available_agent_pool_versions_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_available_agent_pool_versions.metadata['url'], + template_url=self.get_available_agent_pool_versions.metadata["url"], headers=_headers, params=_params, ) @@ -601,22 +641,20 @@ async def get_available_agent_pool_versions( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolAvailableVersions', pipeline_response) + deserialized = self._deserialize("AgentPoolAvailableVersions", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_available_agent_pool_versions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore - + get_available_agent_pool_versions.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/aio/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/aio/operations/_managed_clusters_operations.py index 76f6f0097da1..2d29aa7f55c7 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/aio/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/aio/operations/_managed_clusters_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +29,25 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._managed_clusters_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_access_profile_request, build_get_request, build_get_upgrade_profile_request, build_list_by_resource_group_request, build_list_cluster_admin_credentials_request, build_list_cluster_user_credentials_request, build_list_request, build_reset_aad_profile_request_initial, build_reset_service_principal_profile_request_initial, build_update_tags_request_initial -T = TypeVar('T') +from ...operations._managed_clusters_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_access_profile_request, + build_get_request, + build_get_upgrade_profile_request, + build_list_by_resource_group_request, + build_list_cluster_admin_credentials_request, + build_list_cluster_user_credentials_request, + build_list_request, + build_reset_aad_profile_request, + build_reset_service_principal_profile_request, + build_update_tags_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class ManagedClustersOperations: """ .. warning:: @@ -45,41 +67,35 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.ManagedClusterListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.ManagedCluster"]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. The operation returns properties of each managed cluster. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2019_06_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2019_06_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -87,14 +103,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -110,10 +123,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -123,50 +134,44 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.ManagedClusterListResult]: + self, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ManagedCluster"]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. The operation returns properties of each managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2019_06_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2019_06_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -174,15 +179,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -198,10 +199,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -211,51 +210,43 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace_async async def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.ManagedClusterUpgradeProfile: """Gets upgrade profile for a managed cluster. Gets the details of the upgrade profile for a managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterUpgradeProfile, or the result of cls(response) + :return: ManagedClusterUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_06_01.models.ManagedClusterUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -263,69 +254,60 @@ async def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterUpgradeProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore @distributed_trace_async async def get_access_profile( - self, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, role_name: str, **kwargs: Any ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. Gets the accessProfile for the specified role name of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param role_name: The name of the role for managed cluster accessProfile resource. + :param role_name: The name of the role for managed cluster accessProfile resource. Required. :type role_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterAccessProfile, or the result of cls(response) + :return: ManagedClusterAccessProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_06_01.models.ManagedClusterAccessProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterAccessProfile] - request = build_get_access_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, role_name=role_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_access_profile.metadata['url'], + template_url=self.get_access_profile.metadata["url"], headers=_headers, params=_params, ) @@ -333,64 +315,56 @@ async def get_access_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterAccessProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterAccessProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_access_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore - + get_access_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore @distributed_trace_async async def list_cluster_admin_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster admin credential of a managed cluster. Gets cluster admin credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_06_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_admin_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_admin_credentials.metadata['url'], + template_url=self.list_cluster_admin_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -398,64 +372,56 @@ async def list_cluster_admin_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_admin_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore - + list_cluster_admin_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore @distributed_trace_async async def list_cluster_user_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster user credential of a managed cluster. Gets cluster user credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_06_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_user_credentials.metadata['url'], + template_url=self.list_cluster_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -463,64 +429,54 @@ async def list_cluster_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore - + list_cluster_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore @distributed_trace_async - async def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.ManagedCluster: + async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.ManagedCluster: """Gets a managed cluster. Gets the details of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedCluster, or the result of cls(response) + :return: ManagedCluster or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_06_01.models.ManagedCluster - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -528,55 +484,54 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _create_or_update_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.ManagedCluster, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'ManagedCluster') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedCluster") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -584,10 +539,9 @@ async def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -595,25 +549,26 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - @distributed_trace_async + @overload async def begin_create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedCluster, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. @@ -621,12 +576,90 @@ async def begin_create_or_update( Creates or updates a managed cluster with the specified configuration for agents and Kubernetes version. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2019_06_01.models.ManagedCluster + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2019_06_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster with the specified configuration for agents and Kubernetes + version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2019_06_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster with the specified configuration for agents and Kubernetes + version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. Is + either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2019_06_01.models.ManagedCluster or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -639,20 +672,17 @@ async def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2019_06_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -660,69 +690,66 @@ async def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _update_tags_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.TagsObject, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request_initial( - subscription_id=self._config.subscription_id, + request = build_update_tags_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_tags_initial.metadata['url'], + content=_content, + template_url=self._update_tags_initial.metadata["url"], headers=_headers, params=_params, ) @@ -730,44 +757,118 @@ async def _update_tags_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_tags_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _update_tags_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - @distributed_trace_async + @overload async def begin_update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates a managed cluster with the specified tags. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2019_06_01.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2019_06_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates a managed cluster with the specified tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2019_06_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates a managed cluster with the specified tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2019_06_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -780,20 +881,17 @@ async def begin_update_tags( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2019_06_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, @@ -801,64 +899,54 @@ async def begin_update_tags( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -866,10 +954,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -879,23 +966,17 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: + async def begin_delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Deletes a managed cluster. Deletes the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -907,85 +988,83 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterServicePrincipalProfile, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterServicePrincipalProfile") - request = build_reset_service_principal_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_service_principal_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_service_principal_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_service_principal_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -993,10 +1072,9 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1006,29 +1084,106 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist if cls: return cls(pipeline_response, None, {}) - _reset_service_principal_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + _reset_service_principal_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore - - @distributed_trace_async - async def begin_reset_service_principal_profile( # pylint: disable=inconsistent-return-statements + @overload + async def begin_reset_service_principal_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterServicePrincipalProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: """Reset Service Principal Profile of a managed cluster. Update the service principal Profile for a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a - Managed Cluster. + Managed Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2019_06_01.models.ManagedClusterServicePrincipalProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset Service Principal Profile of a managed cluster. + + Update the service principal Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a + Managed Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset Service Principal Profile of a managed cluster. + + Update the service principal Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a + Managed Cluster. Is either a model type or a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2019_06_01.models.ManagedClusterServicePrincipalProfile or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -1039,20 +1194,17 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1060,67 +1212,68 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_service_principal_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + begin_reset_service_principal_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterAADProfile, + parameters: Union[_models.ManagedClusterAADProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterAADProfile") - request = build_reset_aad_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_aad_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_aad_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_aad_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1128,10 +1281,9 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1141,28 +1293,105 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta if cls: return cls(pipeline_response, None, {}) - _reset_aad_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - + _reset_aad_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - @distributed_trace_async - async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements + @overload + async def begin_reset_aad_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterAADProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: """Reset AAD Profile of a managed cluster. Update the AAD Profile for a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed - Cluster. + Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2019_06_01.models.ManagedClusterAADProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset AAD Profile of a managed cluster. + + Update the AAD Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed + Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterAADProfile, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset AAD Profile of a managed cluster. + + Update the AAD Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed + Cluster. Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2019_06_01.models.ManagedClusterAADProfile or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -1173,20 +1402,17 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1194,34 +1420,30 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_aad_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + begin_reset_aad_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/aio/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/aio/operations/_operations.py index 9310766c942b..5aa802911538 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/aio/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/aio/operations/_operations.py @@ -7,9 +7,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,9 +27,11 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._operations import build_list_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class Operations: """ .. warning:: @@ -42,36 +51,31 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.OperationListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.OperationValue"]: """Gets a list of compute operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationListResult or the result of cls(response) + :return: An iterator like instance of either OperationValue or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2019_06_01.models.OperationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2019_06_01.models.OperationValue] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -79,13 +83,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -101,10 +103,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -114,8 +114,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.ContainerService/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ContainerService/operations"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/aio/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/aio/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/aio/operations/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/aio/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/models/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/models/__init__.py index 9f2008f20441..0cc21ad1d8ae 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/models/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/models/__init__.py @@ -41,69 +41,67 @@ from ._models_py3 import SubResource from ._models_py3 import TagsObject - -from ._container_service_client_enums import ( - AgentPoolType, - ContainerServiceStorageProfileTypes, - ContainerServiceVMSizeTypes, - Count, - LoadBalancerSku, - NetworkPlugin, - NetworkPolicy, - OSType, - ResourceIdentityType, - ScaleSetEvictionPolicy, - ScaleSetPriority, -) +from ._container_service_client_enums import AgentPoolType +from ._container_service_client_enums import ContainerServiceStorageProfileTypes +from ._container_service_client_enums import ContainerServiceVMSizeTypes +from ._container_service_client_enums import Count +from ._container_service_client_enums import LoadBalancerSku +from ._container_service_client_enums import NetworkPlugin +from ._container_service_client_enums import NetworkPolicy +from ._container_service_client_enums import OSType +from ._container_service_client_enums import ResourceIdentityType +from ._container_service_client_enums import ScaleSetEvictionPolicy +from ._container_service_client_enums import ScaleSetPriority from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'AgentPool', - 'AgentPoolAvailableVersions', - 'AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem', - 'AgentPoolListResult', - 'AgentPoolUpgradeProfile', - 'AgentPoolUpgradeProfilePropertiesUpgradesItem', - 'CloudErrorBody', - 'ContainerServiceDiagnosticsProfile', - 'ContainerServiceLinuxProfile', - 'ContainerServiceMasterProfile', - 'ContainerServiceNetworkProfile', - 'ContainerServiceSshConfiguration', - 'ContainerServiceSshPublicKey', - 'ContainerServiceVMDiagnostics', - 'CredentialResult', - 'CredentialResults', - 'ManagedCluster', - 'ManagedClusterAADProfile', - 'ManagedClusterAccessProfile', - 'ManagedClusterAddonProfile', - 'ManagedClusterAgentPoolProfile', - 'ManagedClusterAgentPoolProfileProperties', - 'ManagedClusterIdentity', - 'ManagedClusterListResult', - 'ManagedClusterPoolUpgradeProfile', - 'ManagedClusterPoolUpgradeProfileUpgradesItem', - 'ManagedClusterServicePrincipalProfile', - 'ManagedClusterUpgradeProfile', - 'ManagedClusterWindowsProfile', - 'OperationListResult', - 'OperationValue', - 'Resource', - 'SubResource', - 'TagsObject', - 'AgentPoolType', - 'ContainerServiceStorageProfileTypes', - 'ContainerServiceVMSizeTypes', - 'Count', - 'LoadBalancerSku', - 'NetworkPlugin', - 'NetworkPolicy', - 'OSType', - 'ResourceIdentityType', - 'ScaleSetEvictionPolicy', - 'ScaleSetPriority', + "AgentPool", + "AgentPoolAvailableVersions", + "AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem", + "AgentPoolListResult", + "AgentPoolUpgradeProfile", + "AgentPoolUpgradeProfilePropertiesUpgradesItem", + "CloudErrorBody", + "ContainerServiceDiagnosticsProfile", + "ContainerServiceLinuxProfile", + "ContainerServiceMasterProfile", + "ContainerServiceNetworkProfile", + "ContainerServiceSshConfiguration", + "ContainerServiceSshPublicKey", + "ContainerServiceVMDiagnostics", + "CredentialResult", + "CredentialResults", + "ManagedCluster", + "ManagedClusterAADProfile", + "ManagedClusterAccessProfile", + "ManagedClusterAddonProfile", + "ManagedClusterAgentPoolProfile", + "ManagedClusterAgentPoolProfileProperties", + "ManagedClusterIdentity", + "ManagedClusterListResult", + "ManagedClusterPoolUpgradeProfile", + "ManagedClusterPoolUpgradeProfileUpgradesItem", + "ManagedClusterServicePrincipalProfile", + "ManagedClusterUpgradeProfile", + "ManagedClusterWindowsProfile", + "OperationListResult", + "OperationValue", + "Resource", + "SubResource", + "TagsObject", + "AgentPoolType", + "ContainerServiceStorageProfileTypes", + "ContainerServiceVMSizeTypes", + "Count", + "LoadBalancerSku", + "NetworkPlugin", + "NetworkPolicy", + "OSType", + "ResourceIdentityType", + "ScaleSetEvictionPolicy", + "ScaleSetPriority", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/models/_container_service_client_enums.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/models/_container_service_client_enums.py index f2a8ca90fcb1..955905f1536f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/models/_container_service_client_enums.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/models/_container_service_client_enums.py @@ -18,6 +18,7 @@ class AgentPoolType(str, Enum, metaclass=CaseInsensitiveEnumMeta): VIRTUAL_MACHINE_SCALE_SETS = "VirtualMachineScaleSets" AVAILABILITY_SET = "AvailabilitySet" + class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the orchestrator choice. @@ -26,9 +27,9 @@ class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEn STORAGE_ACCOUNT = "StorageAccount" MANAGED_DISKS = "ManagedDisks" + class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Size of agent VMs. - """ + """Size of agent VMs.""" STANDARD_A1 = "Standard_A1" STANDARD_A10 = "Standard_A10" @@ -205,6 +206,7 @@ class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): STANDARD_NV24 = "Standard_NV24" STANDARD_NV6 = "Standard_NV6" + class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): """Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, and 5. The default value is 1. @@ -214,34 +216,35 @@ class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): THREE = 3 FIVE = 5 + class LoadBalancerSku(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The load balancer sku for the managed cluster. - """ + """The load balancer sku for the managed cluster.""" STANDARD = "standard" BASIC = "basic" + class NetworkPlugin(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Network plugin used for building Kubernetes network. - """ + """Network plugin used for building Kubernetes network.""" AZURE = "azure" KUBENET = "kubenet" + class NetworkPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Network policy used for building Kubernetes network. - """ + """Network policy used for building Kubernetes network.""" CALICO = "calico" AZURE = "azure" + class OSType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """OsType to be used to specify os type. Choose from Linux and Windows. Default to Linux. - """ + """OsType to be used to specify os type. Choose from Linux and Windows. Default to Linux.""" LINUX = "Linux" WINDOWS = "Windows" + class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of identity used for the managed cluster. Type 'SystemAssigned' will use an implicitly created identity in master components and an auto-created user assigned identity in MC_ @@ -252,6 +255,7 @@ class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): SYSTEM_ASSIGNED = "SystemAssigned" NONE = "None" + class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ScaleSetEvictionPolicy to be used to specify eviction policy for low priority virtual machine scale set. Default to Delete. @@ -260,9 +264,9 @@ class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): DELETE = "Delete" DEALLOCATE = "Deallocate" + class ScaleSetPriority(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """ScaleSetPriority to be used to specify virtual machine scale set priority. Default to regular. - """ + """ScaleSetPriority to be used to specify virtual machine scale set priority. Default to regular.""" LOW = "Low" REGULAR = "Regular" diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/models/_models_py3.py index 5c0100772ebd..a30c0aaa42e5 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/models/_models_py3.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/models/_models_py3.py @@ -1,4 +1,5 @@ # coding=utf-8 +# pylint: disable=too-many-lines # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -8,14 +9,14 @@ from typing import Dict, List, Optional, TYPE_CHECKING, Union -import msrest.serialization +from ... import _serialization if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - import __init__ as _models + from .. import models as _models -class SubResource(msrest.serialization.Model): +class SubResource(_serialization.Model): """Reference to another subresource. Variables are only populated by the server, and will be ignored when sending a request. @@ -30,30 +31,26 @@ class SubResource(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(SubResource, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.id = None self.name = None self.type = None -class AgentPool(SubResource): +class AgentPool(SubResource): # pylint: disable=too-many-instance-attributes """Agent Pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -105,7 +102,7 @@ class AgentPool(SubResource): "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :vartype vm_size: str or ~azure.mgmt.containerservice.v2019_06_01.models.ContainerServiceVMSizeTypes :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine @@ -117,7 +114,7 @@ class AgentPool(SubResource): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Known values are: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux" and "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2019_06_01.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -126,7 +123,7 @@ class AgentPool(SubResource): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar type_properties_type: AgentPoolType represents types of an agent pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :vartype type_properties_type: str or ~azure.mgmt.containerservice.v2019_06_01.models.AgentPoolType :ivar orchestrator_version: Version of orchestrator specified when creating the managed @@ -141,12 +138,12 @@ class AgentPool(SubResource): :ivar enable_node_public_ip: Enable public IP for nodes. :vartype enable_node_public_ip: bool :ivar scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Known values are: "Low", "Regular". Default value: "Regular". + priority. Default to regular. Known values are: "Low" and "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2019_06_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy - for low priority virtual machine scale set. Default to Delete. Known values are: "Delete", - "Deallocate". Default value: "Delete". + for low priority virtual machine scale set. Default to Delete. Known values are: "Delete" and + "Deallocate". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2019_06_01.models.ScaleSetEvictionPolicy :ivar node_taints: Taints added to new nodes during node pool create and scale. For example, @@ -155,34 +152,34 @@ class AgentPool(SubResource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'os_disk_size_gb': {'maximum': 1023, 'minimum': 0}, - 'provisioning_state': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "os_disk_size_gb": {"maximum": 1023, "minimum": 0}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'count': {'key': 'properties.count', 'type': 'int'}, - 'vm_size': {'key': 'properties.vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'properties.osDiskSizeGB', 'type': 'int'}, - 'vnet_subnet_id': {'key': 'properties.vnetSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'properties.maxPods', 'type': 'int'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'max_count': {'key': 'properties.maxCount', 'type': 'int'}, - 'min_count': {'key': 'properties.minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'properties.enableAutoScaling', 'type': 'bool'}, - 'type_properties_type': {'key': 'properties.type', 'type': 'str'}, - 'orchestrator_version': {'key': 'properties.orchestratorVersion', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'availability_zones': {'key': 'properties.availabilityZones', 'type': '[str]'}, - 'enable_node_public_ip': {'key': 'properties.enableNodePublicIP', 'type': 'bool'}, - 'scale_set_priority': {'key': 'properties.scaleSetPriority', 'type': 'str'}, - 'scale_set_eviction_policy': {'key': 'properties.scaleSetEvictionPolicy', 'type': 'str'}, - 'node_taints': {'key': 'properties.nodeTaints', 'type': '[str]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "count": {"key": "properties.count", "type": "int"}, + "vm_size": {"key": "properties.vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "properties.osDiskSizeGB", "type": "int"}, + "vnet_subnet_id": {"key": "properties.vnetSubnetID", "type": "str"}, + "max_pods": {"key": "properties.maxPods", "type": "int"}, + "os_type": {"key": "properties.osType", "type": "str"}, + "max_count": {"key": "properties.maxCount", "type": "int"}, + "min_count": {"key": "properties.minCount", "type": "int"}, + "enable_auto_scaling": {"key": "properties.enableAutoScaling", "type": "bool"}, + "type_properties_type": {"key": "properties.type", "type": "str"}, + "orchestrator_version": {"key": "properties.orchestratorVersion", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "availability_zones": {"key": "properties.availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "properties.enableNodePublicIP", "type": "bool"}, + "scale_set_priority": {"key": "properties.scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "properties.scaleSetEvictionPolicy", "type": "str"}, + "node_taints": {"key": "properties.nodeTaints", "type": "[str]"}, } def __init__( @@ -193,7 +190,7 @@ def __init__( os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, @@ -201,8 +198,8 @@ def __init__( orchestrator_version: Optional[str] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, - scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", node_taints: Optional[List[str]] = None, **kwargs ): @@ -247,7 +244,7 @@ def __init__( "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :paramtype vm_size: str or ~azure.mgmt.containerservice.v2019_06_01.models.ContainerServiceVMSizeTypes :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every @@ -259,7 +256,7 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux" and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2019_06_01.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -268,7 +265,7 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword type_properties_type: AgentPoolType represents types of an agent pool. Known values - are: "VirtualMachineScaleSets", "AvailabilitySet". + are: "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type_properties_type: str or ~azure.mgmt.containerservice.v2019_06_01.models.AgentPoolType :keyword orchestrator_version: Version of orchestrator specified when creating the managed @@ -280,19 +277,19 @@ def __init__( :keyword enable_node_public_ip: Enable public IP for nodes. :paramtype enable_node_public_ip: bool :keyword scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Known values are: "Low", "Regular". Default value: "Regular". + priority. Default to regular. Known values are: "Low" and "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2019_06_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy for low priority virtual machine scale set. Default to Delete. Known values are: - "Delete", "Deallocate". Default value: "Delete". + "Delete" and "Deallocate". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2019_06_01.models.ScaleSetEvictionPolicy :keyword node_taints: Taints added to new nodes during node pool create and scale. For example, key=value:NoSchedule. :paramtype node_taints: list[str] """ - super(AgentPool, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.vm_size = vm_size self.os_disk_size_gb = os_disk_size_gb @@ -312,7 +309,7 @@ def __init__( self.node_taints = node_taints -class AgentPoolAvailableVersions(msrest.serialization.Model): +class AgentPoolAvailableVersions(_serialization.Model): """The list of available versions for an agent pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -329,16 +326,19 @@ class AgentPoolAvailableVersions(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'agent_pool_versions': {'key': 'properties.agentPoolVersions', 'type': '[AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "agent_pool_versions": { + "key": "properties.agentPoolVersions", + "type": "[AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem]", + }, } def __init__( @@ -352,14 +352,14 @@ def __init__( :paramtype agent_pool_versions: list[~azure.mgmt.containerservice.v2019_06_01.models.AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem] """ - super(AgentPoolAvailableVersions, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None self.agent_pool_versions = agent_pool_versions -class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(msrest.serialization.Model): +class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(_serialization.Model): """AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem. :ivar default: Whether this version is the default agent pool version. @@ -371,9 +371,9 @@ class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(msrest.serializa """ _attribute_map = { - 'default': {'key': 'default', 'type': 'bool'}, - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "default": {"key": "default", "type": "bool"}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } def __init__( @@ -392,13 +392,13 @@ def __init__( :keyword is_preview: Whether Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.default = default self.kubernetes_version = kubernetes_version self.is_preview = is_preview -class AgentPoolListResult(msrest.serialization.Model): +class AgentPoolListResult(_serialization.Model): """The response from the List Agent Pools operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -410,30 +410,25 @@ class AgentPoolListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[AgentPool]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[AgentPool]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.AgentPool"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.AgentPool"]] = None, **kwargs): """ :keyword value: The list of agent pools. :paramtype value: list[~azure.mgmt.containerservice.v2019_06_01.models.AgentPool] """ - super(AgentPoolListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class AgentPoolUpgradeProfile(msrest.serialization.Model): +class AgentPoolUpgradeProfile(_serialization.Model): """The list of available upgrades for an agent pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -446,10 +441,10 @@ class AgentPoolUpgradeProfile(msrest.serialization.Model): :vartype name: str :ivar type: Type of the agent pool upgrade profile. :vartype type: str - :ivar kubernetes_version: Required. Kubernetes version (major, minor, patch). + :ivar kubernetes_version: Kubernetes version (major, minor, patch). Required. :vartype kubernetes_version: str - :ivar os_type: Required. OsType to be used to specify os type. Choose from Linux and Windows. - Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to + Linux. Known values are: "Linux" and "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2019_06_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -457,20 +452,20 @@ class AgentPoolUpgradeProfile(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kubernetes_version': {'required': True}, - 'os_type': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "kubernetes_version": {"required": True}, + "os_type": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'kubernetes_version': {'key': 'properties.kubernetesVersion', 'type': 'str'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'upgrades': {'key': 'properties.upgrades', 'type': '[AgentPoolUpgradeProfilePropertiesUpgradesItem]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "os_type": {"key": "properties.osType", "type": "str"}, + "upgrades": {"key": "properties.upgrades", "type": "[AgentPoolUpgradeProfilePropertiesUpgradesItem]"}, } def __init__( @@ -482,16 +477,16 @@ def __init__( **kwargs ): """ - :keyword kubernetes_version: Required. Kubernetes version (major, minor, patch). + :keyword kubernetes_version: Kubernetes version (major, minor, patch). Required. :paramtype kubernetes_version: str - :keyword os_type: Required. OsType to be used to specify os type. Choose from Linux and - Windows. Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default + to Linux. Known values are: "Linux" and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2019_06_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: list[~azure.mgmt.containerservice.v2019_06_01.models.AgentPoolUpgradeProfilePropertiesUpgradesItem] """ - super(AgentPoolUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -500,7 +495,7 @@ def __init__( self.upgrades = upgrades -class AgentPoolUpgradeProfilePropertiesUpgradesItem(msrest.serialization.Model): +class AgentPoolUpgradeProfilePropertiesUpgradesItem(_serialization.Model): """AgentPoolUpgradeProfilePropertiesUpgradesItem. :ivar kubernetes_version: Kubernetes version (major, minor, patch). @@ -510,29 +505,23 @@ class AgentPoolUpgradeProfilePropertiesUpgradesItem(msrest.serialization.Model): """ _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } - def __init__( - self, - *, - kubernetes_version: Optional[str] = None, - is_preview: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, kubernetes_version: Optional[str] = None, is_preview: Optional[bool] = None, **kwargs): """ :keyword kubernetes_version: Kubernetes version (major, minor, patch). :paramtype kubernetes_version: str :keyword is_preview: Whether Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(AgentPoolUpgradeProfilePropertiesUpgradesItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.is_preview = is_preview -class CloudErrorBody(msrest.serialization.Model): +class CloudErrorBody(_serialization.Model): """An error response from the Container service. :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed @@ -549,10 +538,10 @@ class CloudErrorBody(msrest.serialization.Model): """ _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[CloudErrorBody]"}, } def __init__( @@ -577,87 +566,76 @@ def __init__( :keyword details: A list of additional details about the error. :paramtype details: list[~azure.mgmt.containerservice.v2019_06_01.models.CloudErrorBody] """ - super(CloudErrorBody, self).__init__(**kwargs) + super().__init__(**kwargs) self.code = code self.message = message self.target = target self.details = details -class ContainerServiceDiagnosticsProfile(msrest.serialization.Model): +class ContainerServiceDiagnosticsProfile(_serialization.Model): """Profile for diagnostics on the container service cluster. All required parameters must be populated in order to send to Azure. - :ivar vm_diagnostics: Required. Profile for diagnostics on the container service VMs. + :ivar vm_diagnostics: Profile for diagnostics on the container service VMs. Required. :vartype vm_diagnostics: ~azure.mgmt.containerservice.v2019_06_01.models.ContainerServiceVMDiagnostics """ _validation = { - 'vm_diagnostics': {'required': True}, + "vm_diagnostics": {"required": True}, } _attribute_map = { - 'vm_diagnostics': {'key': 'vmDiagnostics', 'type': 'ContainerServiceVMDiagnostics'}, + "vm_diagnostics": {"key": "vmDiagnostics", "type": "ContainerServiceVMDiagnostics"}, } - def __init__( - self, - *, - vm_diagnostics: "_models.ContainerServiceVMDiagnostics", - **kwargs - ): + def __init__(self, *, vm_diagnostics: "_models.ContainerServiceVMDiagnostics", **kwargs): """ - :keyword vm_diagnostics: Required. Profile for diagnostics on the container service VMs. + :keyword vm_diagnostics: Profile for diagnostics on the container service VMs. Required. :paramtype vm_diagnostics: ~azure.mgmt.containerservice.v2019_06_01.models.ContainerServiceVMDiagnostics """ - super(ContainerServiceDiagnosticsProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.vm_diagnostics = vm_diagnostics -class ContainerServiceLinuxProfile(msrest.serialization.Model): +class ContainerServiceLinuxProfile(_serialization.Model): """Profile for Linux VMs in the container service cluster. All required parameters must be populated in order to send to Azure. - :ivar admin_username: Required. The administrator username to use for Linux VMs. + :ivar admin_username: The administrator username to use for Linux VMs. Required. :vartype admin_username: str - :ivar ssh: Required. SSH configuration for Linux-based VMs running on Azure. + :ivar ssh: SSH configuration for Linux-based VMs running on Azure. Required. :vartype ssh: ~azure.mgmt.containerservice.v2019_06_01.models.ContainerServiceSshConfiguration """ _validation = { - 'admin_username': {'required': True, 'pattern': r'^[A-Za-z][-A-Za-z0-9_]*$'}, - 'ssh': {'required': True}, + "admin_username": {"required": True, "pattern": r"^[A-Za-z][-A-Za-z0-9_]*$"}, + "ssh": {"required": True}, } _attribute_map = { - 'admin_username': {'key': 'adminUsername', 'type': 'str'}, - 'ssh': {'key': 'ssh', 'type': 'ContainerServiceSshConfiguration'}, + "admin_username": {"key": "adminUsername", "type": "str"}, + "ssh": {"key": "ssh", "type": "ContainerServiceSshConfiguration"}, } - def __init__( - self, - *, - admin_username: str, - ssh: "_models.ContainerServiceSshConfiguration", - **kwargs - ): + def __init__(self, *, admin_username: str, ssh: "_models.ContainerServiceSshConfiguration", **kwargs): """ - :keyword admin_username: Required. The administrator username to use for Linux VMs. + :keyword admin_username: The administrator username to use for Linux VMs. Required. :paramtype admin_username: str - :keyword ssh: Required. SSH configuration for Linux-based VMs running on Azure. + :keyword ssh: SSH configuration for Linux-based VMs running on Azure. Required. :paramtype ssh: ~azure.mgmt.containerservice.v2019_06_01.models.ContainerServiceSshConfiguration """ - super(ContainerServiceLinuxProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.admin_username = admin_username self.ssh = ssh -class ContainerServiceMasterProfile(msrest.serialization.Model): +class ContainerServiceMasterProfile(_serialization.Model): """Profile for the container service master. Variables are only populated by the server, and will be ignored when sending a request. @@ -665,11 +643,11 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar count: Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, - and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". + and 5. The default value is 1. Known values are: 1, 3, and 5. :vartype count: int or ~azure.mgmt.containerservice.v2019_06_01.models.Count - :ivar dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. + :ivar dns_prefix: DNS prefix to be used to create the FQDN for the master pool. Required. :vartype dns_prefix: str - :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + :ivar vm_size: Size of agent VMs. Required. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -706,7 +684,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :vartype vm_size: str or ~azure.mgmt.containerservice.v2019_06_01.models.ContainerServiceVMSizeTypes :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine @@ -720,7 +698,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): :vartype first_consecutive_static_ip: str :ivar storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount" and "ManagedDisks". :vartype storage_profile: str or ~azure.mgmt.containerservice.v2019_06_01.models.ContainerServiceStorageProfileTypes :ivar fqdn: FQDN for the master pool. @@ -728,21 +706,21 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): """ _validation = { - 'dns_prefix': {'required': True}, - 'vm_size': {'required': True}, - 'os_disk_size_gb': {'maximum': 1023, 'minimum': 0}, - 'fqdn': {'readonly': True}, + "dns_prefix": {"required": True}, + "vm_size": {"required": True}, + "os_disk_size_gb": {"maximum": 1023, "minimum": 0}, + "fqdn": {"readonly": True}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'dns_prefix': {'key': 'dnsPrefix', 'type': 'str'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'first_consecutive_static_ip': {'key': 'firstConsecutiveStaticIP', 'type': 'str'}, - 'storage_profile': {'key': 'storageProfile', 'type': 'str'}, - 'fqdn': {'key': 'fqdn', 'type': 'str'}, + "count": {"key": "count", "type": "int"}, + "dns_prefix": {"key": "dnsPrefix", "type": "str"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "first_consecutive_static_ip": {"key": "firstConsecutiveStaticIP", "type": "str"}, + "storage_profile": {"key": "storageProfile", "type": "str"}, + "fqdn": {"key": "fqdn", "type": "str"}, } def __init__( @@ -750,20 +728,20 @@ def __init__( *, dns_prefix: str, vm_size: Union[str, "_models.ContainerServiceVMSizeTypes"], - count: Optional[Union[int, "_models.Count"]] = 1, + count: Union[int, "_models.Count"] = 1, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, - first_consecutive_static_ip: Optional[str] = "10.240.255.5", + first_consecutive_static_ip: str = "10.240.255.5", storage_profile: Optional[Union[str, "_models.ContainerServiceStorageProfileTypes"]] = None, **kwargs ): """ :keyword count: Number of masters (VMs) in the container service cluster. Allowed values are 1, - 3, and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". + 3, and 5. The default value is 1. Known values are: 1, 3, and 5. :paramtype count: int or ~azure.mgmt.containerservice.v2019_06_01.models.Count - :keyword dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. + :keyword dns_prefix: DNS prefix to be used to create the FQDN for the master pool. Required. :paramtype dns_prefix: str - :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + :keyword vm_size: Size of agent VMs. Required. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -800,7 +778,7 @@ def __init__( "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :paramtype vm_size: str or ~azure.mgmt.containerservice.v2019_06_01.models.ContainerServiceVMSizeTypes :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every @@ -814,11 +792,11 @@ def __init__( :paramtype first_consecutive_static_ip: str :keyword storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount" and "ManagedDisks". :paramtype storage_profile: str or ~azure.mgmt.containerservice.v2019_06_01.models.ContainerServiceStorageProfileTypes """ - super(ContainerServiceMasterProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.dns_prefix = dns_prefix self.vm_size = vm_size @@ -829,14 +807,14 @@ def __init__( self.fqdn = None -class ContainerServiceNetworkProfile(msrest.serialization.Model): +class ContainerServiceNetworkProfile(_serialization.Model): """Profile of network configuration. :ivar network_plugin: Network plugin used for building Kubernetes network. Known values are: - "azure", "kubenet". Default value: "kubenet". + "azure" and "kubenet". :vartype network_plugin: str or ~azure.mgmt.containerservice.v2019_06_01.models.NetworkPlugin :ivar network_policy: Network policy used for building Kubernetes network. Known values are: - "calico", "azure". + "calico" and "azure". :vartype network_policy: str or ~azure.mgmt.containerservice.v2019_06_01.models.NetworkPolicy :ivar pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :vartype pod_cidr: str @@ -850,46 +828,48 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): must not overlap with any Subnet IP ranges or the Kubernetes service address range. :vartype docker_bridge_cidr: str :ivar load_balancer_sku: The load balancer sku for the managed cluster. Known values are: - "standard", "basic". + "standard" and "basic". :vartype load_balancer_sku: str or ~azure.mgmt.containerservice.v2019_06_01.models.LoadBalancerSku """ _validation = { - 'pod_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, - 'service_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, - 'dns_service_ip': {'pattern': r'^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$'}, - 'docker_bridge_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, + "pod_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, + "service_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, + "dns_service_ip": { + "pattern": r"^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$" + }, + "docker_bridge_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, } _attribute_map = { - 'network_plugin': {'key': 'networkPlugin', 'type': 'str'}, - 'network_policy': {'key': 'networkPolicy', 'type': 'str'}, - 'pod_cidr': {'key': 'podCidr', 'type': 'str'}, - 'service_cidr': {'key': 'serviceCidr', 'type': 'str'}, - 'dns_service_ip': {'key': 'dnsServiceIP', 'type': 'str'}, - 'docker_bridge_cidr': {'key': 'dockerBridgeCidr', 'type': 'str'}, - 'load_balancer_sku': {'key': 'loadBalancerSku', 'type': 'str'}, + "network_plugin": {"key": "networkPlugin", "type": "str"}, + "network_policy": {"key": "networkPolicy", "type": "str"}, + "pod_cidr": {"key": "podCidr", "type": "str"}, + "service_cidr": {"key": "serviceCidr", "type": "str"}, + "dns_service_ip": {"key": "dnsServiceIP", "type": "str"}, + "docker_bridge_cidr": {"key": "dockerBridgeCidr", "type": "str"}, + "load_balancer_sku": {"key": "loadBalancerSku", "type": "str"}, } def __init__( self, *, - network_plugin: Optional[Union[str, "_models.NetworkPlugin"]] = "kubenet", + network_plugin: Union[str, "_models.NetworkPlugin"] = "kubenet", network_policy: Optional[Union[str, "_models.NetworkPolicy"]] = None, - pod_cidr: Optional[str] = "10.244.0.0/16", - service_cidr: Optional[str] = "10.0.0.0/16", - dns_service_ip: Optional[str] = "10.0.0.10", - docker_bridge_cidr: Optional[str] = "172.17.0.1/16", + pod_cidr: str = "10.244.0.0/16", + service_cidr: str = "10.0.0.0/16", + dns_service_ip: str = "10.0.0.10", + docker_bridge_cidr: str = "172.17.0.1/16", load_balancer_sku: Optional[Union[str, "_models.LoadBalancerSku"]] = None, **kwargs ): """ :keyword network_plugin: Network plugin used for building Kubernetes network. Known values are: - "azure", "kubenet". Default value: "kubenet". + "azure" and "kubenet". :paramtype network_plugin: str or ~azure.mgmt.containerservice.v2019_06_01.models.NetworkPlugin :keyword network_policy: Network policy used for building Kubernetes network. Known values are: - "calico", "azure". + "calico" and "azure". :paramtype network_policy: str or ~azure.mgmt.containerservice.v2019_06_01.models.NetworkPolicy :keyword pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :paramtype pod_cidr: str @@ -903,11 +883,11 @@ def __init__( must not overlap with any Subnet IP ranges or the Kubernetes service address range. :paramtype docker_bridge_cidr: str :keyword load_balancer_sku: The load balancer sku for the managed cluster. Known values are: - "standard", "basic". + "standard" and "basic". :paramtype load_balancer_sku: str or ~azure.mgmt.containerservice.v2019_06_01.models.LoadBalancerSku """ - super(ContainerServiceNetworkProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.network_plugin = network_plugin self.network_policy = network_policy self.pod_cidr = pod_cidr @@ -917,113 +897,98 @@ def __init__( self.load_balancer_sku = load_balancer_sku -class ContainerServiceSshConfiguration(msrest.serialization.Model): +class ContainerServiceSshConfiguration(_serialization.Model): """SSH configuration for Linux-based VMs running on Azure. All required parameters must be populated in order to send to Azure. - :ivar public_keys: Required. The list of SSH public keys used to authenticate with Linux-based - VMs. Only expect one key specified. + :ivar public_keys: The list of SSH public keys used to authenticate with Linux-based VMs. Only + expect one key specified. Required. :vartype public_keys: list[~azure.mgmt.containerservice.v2019_06_01.models.ContainerServiceSshPublicKey] """ _validation = { - 'public_keys': {'required': True}, + "public_keys": {"required": True}, } _attribute_map = { - 'public_keys': {'key': 'publicKeys', 'type': '[ContainerServiceSshPublicKey]'}, + "public_keys": {"key": "publicKeys", "type": "[ContainerServiceSshPublicKey]"}, } - def __init__( - self, - *, - public_keys: List["_models.ContainerServiceSshPublicKey"], - **kwargs - ): + def __init__(self, *, public_keys: List["_models.ContainerServiceSshPublicKey"], **kwargs): """ - :keyword public_keys: Required. The list of SSH public keys used to authenticate with - Linux-based VMs. Only expect one key specified. + :keyword public_keys: The list of SSH public keys used to authenticate with Linux-based VMs. + Only expect one key specified. Required. :paramtype public_keys: list[~azure.mgmt.containerservice.v2019_06_01.models.ContainerServiceSshPublicKey] """ - super(ContainerServiceSshConfiguration, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_keys = public_keys -class ContainerServiceSshPublicKey(msrest.serialization.Model): +class ContainerServiceSshPublicKey(_serialization.Model): """Contains information about SSH certificate public key data. All required parameters must be populated in order to send to Azure. - :ivar key_data: Required. Certificate public key used to authenticate with VMs through SSH. The - certificate must be in PEM format with or without headers. + :ivar key_data: Certificate public key used to authenticate with VMs through SSH. The + certificate must be in PEM format with or without headers. Required. :vartype key_data: str """ _validation = { - 'key_data': {'required': True}, + "key_data": {"required": True}, } _attribute_map = { - 'key_data': {'key': 'keyData', 'type': 'str'}, + "key_data": {"key": "keyData", "type": "str"}, } - def __init__( - self, - *, - key_data: str, - **kwargs - ): + def __init__(self, *, key_data: str, **kwargs): """ - :keyword key_data: Required. Certificate public key used to authenticate with VMs through SSH. - The certificate must be in PEM format with or without headers. + :keyword key_data: Certificate public key used to authenticate with VMs through SSH. The + certificate must be in PEM format with or without headers. Required. :paramtype key_data: str """ - super(ContainerServiceSshPublicKey, self).__init__(**kwargs) + super().__init__(**kwargs) self.key_data = key_data -class ContainerServiceVMDiagnostics(msrest.serialization.Model): +class ContainerServiceVMDiagnostics(_serialization.Model): """Profile for diagnostics on the container service VMs. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar enabled: Required. Whether the VM diagnostic agent is provisioned on the VM. + :ivar enabled: Whether the VM diagnostic agent is provisioned on the VM. Required. :vartype enabled: bool :ivar storage_uri: The URI of the storage account where diagnostics are stored. :vartype storage_uri: str """ _validation = { - 'enabled': {'required': True}, - 'storage_uri': {'readonly': True}, + "enabled": {"required": True}, + "storage_uri": {"readonly": True}, } _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'storage_uri': {'key': 'storageUri', 'type': 'str'}, + "enabled": {"key": "enabled", "type": "bool"}, + "storage_uri": {"key": "storageUri", "type": "str"}, } - def __init__( - self, - *, - enabled: bool, - **kwargs - ): + def __init__(self, *, enabled: bool, **kwargs): """ - :keyword enabled: Required. Whether the VM diagnostic agent is provisioned on the VM. + :keyword enabled: Whether the VM diagnostic agent is provisioned on the VM. Required. :paramtype enabled: bool """ - super(ContainerServiceVMDiagnostics, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.storage_uri = None -class CredentialResult(msrest.serialization.Model): +class CredentialResult(_serialization.Model): """The credential result response. Variables are only populated by the server, and will be ignored when sending a request. @@ -1031,31 +996,27 @@ class CredentialResult(msrest.serialization.Model): :ivar name: The name of the credential. :vartype name: str :ivar value: Base64-encoded Kubernetes configuration file. - :vartype value: bytearray + :vartype value: bytes """ _validation = { - 'name': {'readonly': True}, - 'value': {'readonly': True}, + "name": {"readonly": True}, + "value": {"readonly": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'bytearray'}, + "name": {"key": "name", "type": "str"}, + "value": {"key": "value", "type": "bytearray"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(CredentialResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.name = None self.value = None -class CredentialResults(msrest.serialization.Model): +class CredentialResults(_serialization.Model): """The list of credential result response. Variables are only populated by the server, and will be ignored when sending a request. @@ -1065,24 +1026,20 @@ class CredentialResults(msrest.serialization.Model): """ _validation = { - 'kubeconfigs': {'readonly': True}, + "kubeconfigs": {"readonly": True}, } _attribute_map = { - 'kubeconfigs': {'key': 'kubeconfigs', 'type': '[CredentialResult]'}, + "kubeconfigs": {"key": "kubeconfigs", "type": "[CredentialResult]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(CredentialResults, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.kubeconfigs = None -class Resource(msrest.serialization.Model): +class Resource(_serialization.Model): """The Resource model definition. Variables are only populated by the server, and will be ignored when sending a request. @@ -1095,41 +1052,35 @@ class Resource(msrest.serialization.Model): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] """ - super(Resource, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -1137,7 +1088,7 @@ def __init__( self.tags = tags -class ManagedCluster(Resource): +class ManagedCluster(Resource): # pylint: disable=too-many-instance-attributes """Managed cluster. Variables are only populated by the server, and will be ignored when sending a request. @@ -1150,9 +1101,9 @@ class ManagedCluster(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar identity: The identity of the managed cluster, if configured. :vartype identity: ~azure.mgmt.containerservice.v2019_06_01.models.ManagedClusterIdentity @@ -1201,38 +1152,41 @@ class ManagedCluster(Resource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'provisioning_state': {'readonly': True}, - 'max_agent_pools': {'readonly': True}, - 'fqdn': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, + "provisioning_state": {"readonly": True}, + "max_agent_pools": {"readonly": True}, + "fqdn": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'ManagedClusterIdentity'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'max_agent_pools': {'key': 'properties.maxAgentPools', 'type': 'int'}, - 'kubernetes_version': {'key': 'properties.kubernetesVersion', 'type': 'str'}, - 'dns_prefix': {'key': 'properties.dnsPrefix', 'type': 'str'}, - 'fqdn': {'key': 'properties.fqdn', 'type': 'str'}, - 'agent_pool_profiles': {'key': 'properties.agentPoolProfiles', 'type': '[ManagedClusterAgentPoolProfile]'}, - 'linux_profile': {'key': 'properties.linuxProfile', 'type': 'ContainerServiceLinuxProfile'}, - 'windows_profile': {'key': 'properties.windowsProfile', 'type': 'ManagedClusterWindowsProfile'}, - 'service_principal_profile': {'key': 'properties.servicePrincipalProfile', 'type': 'ManagedClusterServicePrincipalProfile'}, - 'addon_profiles': {'key': 'properties.addonProfiles', 'type': '{ManagedClusterAddonProfile}'}, - 'node_resource_group': {'key': 'properties.nodeResourceGroup', 'type': 'str'}, - 'enable_rbac': {'key': 'properties.enableRBAC', 'type': 'bool'}, - 'enable_pod_security_policy': {'key': 'properties.enablePodSecurityPolicy', 'type': 'bool'}, - 'network_profile': {'key': 'properties.networkProfile', 'type': 'ContainerServiceNetworkProfile'}, - 'aad_profile': {'key': 'properties.aadProfile', 'type': 'ManagedClusterAADProfile'}, - 'api_server_authorized_ip_ranges': {'key': 'properties.apiServerAuthorizedIPRanges', 'type': '[str]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "identity": {"key": "identity", "type": "ManagedClusterIdentity"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "max_agent_pools": {"key": "properties.maxAgentPools", "type": "int"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "dns_prefix": {"key": "properties.dnsPrefix", "type": "str"}, + "fqdn": {"key": "properties.fqdn", "type": "str"}, + "agent_pool_profiles": {"key": "properties.agentPoolProfiles", "type": "[ManagedClusterAgentPoolProfile]"}, + "linux_profile": {"key": "properties.linuxProfile", "type": "ContainerServiceLinuxProfile"}, + "windows_profile": {"key": "properties.windowsProfile", "type": "ManagedClusterWindowsProfile"}, + "service_principal_profile": { + "key": "properties.servicePrincipalProfile", + "type": "ManagedClusterServicePrincipalProfile", + }, + "addon_profiles": {"key": "properties.addonProfiles", "type": "{ManagedClusterAddonProfile}"}, + "node_resource_group": {"key": "properties.nodeResourceGroup", "type": "str"}, + "enable_rbac": {"key": "properties.enableRBAC", "type": "bool"}, + "enable_pod_security_policy": {"key": "properties.enablePodSecurityPolicy", "type": "bool"}, + "network_profile": {"key": "properties.networkProfile", "type": "ContainerServiceNetworkProfile"}, + "aad_profile": {"key": "properties.aadProfile", "type": "ManagedClusterAADProfile"}, + "api_server_authorized_ip_ranges": {"key": "properties.apiServerAuthorizedIPRanges", "type": "[str]"}, } def __init__( @@ -1257,9 +1211,9 @@ def __init__( **kwargs ): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword identity: The identity of the managed cluster, if configured. :paramtype identity: ~azure.mgmt.containerservice.v2019_06_01.models.ManagedClusterIdentity @@ -1301,7 +1255,7 @@ def __init__( server. :paramtype api_server_authorized_ip_ranges: list[str] """ - super(ManagedCluster, self).__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.identity = identity self.provisioning_state = None self.max_agent_pools = None @@ -1321,14 +1275,14 @@ def __init__( self.api_server_authorized_ip_ranges = api_server_authorized_ip_ranges -class ManagedClusterAADProfile(msrest.serialization.Model): +class ManagedClusterAADProfile(_serialization.Model): """AADProfile specifies attributes for Azure Active Directory integration. All required parameters must be populated in order to send to Azure. - :ivar client_app_id: Required. The client AAD application ID. + :ivar client_app_id: The client AAD application ID. Required. :vartype client_app_id: str - :ivar server_app_id: Required. The server AAD application ID. + :ivar server_app_id: The server AAD application ID. Required. :vartype server_app_id: str :ivar server_app_secret: The server AAD application secret. :vartype server_app_secret: str @@ -1338,15 +1292,15 @@ class ManagedClusterAADProfile(msrest.serialization.Model): """ _validation = { - 'client_app_id': {'required': True}, - 'server_app_id': {'required': True}, + "client_app_id": {"required": True}, + "server_app_id": {"required": True}, } _attribute_map = { - 'client_app_id': {'key': 'clientAppID', 'type': 'str'}, - 'server_app_id': {'key': 'serverAppID', 'type': 'str'}, - 'server_app_secret': {'key': 'serverAppSecret', 'type': 'str'}, - 'tenant_id': {'key': 'tenantID', 'type': 'str'}, + "client_app_id": {"key": "clientAppID", "type": "str"}, + "server_app_id": {"key": "serverAppID", "type": "str"}, + "server_app_secret": {"key": "serverAppSecret", "type": "str"}, + "tenant_id": {"key": "tenantID", "type": "str"}, } def __init__( @@ -1359,9 +1313,9 @@ def __init__( **kwargs ): """ - :keyword client_app_id: Required. The client AAD application ID. + :keyword client_app_id: The client AAD application ID. Required. :paramtype client_app_id: str - :keyword server_app_id: Required. The server AAD application ID. + :keyword server_app_id: The server AAD application ID. Required. :paramtype server_app_id: str :keyword server_app_secret: The server AAD application secret. :paramtype server_app_secret: str @@ -1369,7 +1323,7 @@ def __init__( tenant of the deployment subscription. :paramtype tenant_id: str """ - super(ManagedClusterAADProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.client_app_id = client_app_id self.server_app_id = server_app_id self.server_app_secret = server_app_secret @@ -1389,89 +1343,78 @@ class ManagedClusterAccessProfile(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar kube_config: Base64-encoded Kubernetes configuration file. - :vartype kube_config: bytearray + :vartype kube_config: bytes """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'kube_config': {'key': 'properties.kubeConfig', 'type': 'bytearray'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "kube_config": {"key": "properties.kubeConfig", "type": "bytearray"}, } def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - kube_config: Optional[bytearray] = None, - **kwargs + self, *, location: str, tags: Optional[Dict[str, str]] = None, kube_config: Optional[bytes] = None, **kwargs ): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword kube_config: Base64-encoded Kubernetes configuration file. - :paramtype kube_config: bytearray + :paramtype kube_config: bytes """ - super(ManagedClusterAccessProfile, self).__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.kube_config = kube_config -class ManagedClusterAddonProfile(msrest.serialization.Model): +class ManagedClusterAddonProfile(_serialization.Model): """A Kubernetes add-on profile for a managed cluster. All required parameters must be populated in order to send to Azure. - :ivar enabled: Required. Whether the add-on is enabled or not. + :ivar enabled: Whether the add-on is enabled or not. Required. :vartype enabled: bool :ivar config: Key-value pairs for configuring an add-on. :vartype config: dict[str, str] """ _validation = { - 'enabled': {'required': True}, + "enabled": {"required": True}, } _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'config': {'key': 'config', 'type': '{str}'}, + "enabled": {"key": "enabled", "type": "bool"}, + "config": {"key": "config", "type": "{str}"}, } - def __init__( - self, - *, - enabled: bool, - config: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, enabled: bool, config: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword enabled: Required. Whether the add-on is enabled or not. + :keyword enabled: Whether the add-on is enabled or not. Required. :paramtype enabled: bool :keyword config: Key-value pairs for configuring an add-on. :paramtype config: dict[str, str] """ - super(ManagedClusterAddonProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.config = config -class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): +class ManagedClusterAgentPoolProfileProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes """Properties for the container service agent pool profile. Variables are only populated by the server, and will be ignored when sending a request. @@ -1516,7 +1459,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :vartype vm_size: str or ~azure.mgmt.containerservice.v2019_06_01.models.ContainerServiceVMSizeTypes :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine @@ -1528,7 +1471,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Known values are: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux" and "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2019_06_01.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -1537,7 +1480,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar type: AgentPoolType represents types of an agent pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2019_06_01.models.AgentPoolType :ivar orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -1551,12 +1494,12 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar enable_node_public_ip: Enable public IP for nodes. :vartype enable_node_public_ip: bool :ivar scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Known values are: "Low", "Regular". Default value: "Regular". + priority. Default to regular. Known values are: "Low" and "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2019_06_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy - for low priority virtual machine scale set. Default to Delete. Known values are: "Delete", - "Deallocate". Default value: "Delete". + for low priority virtual machine scale set. Default to Delete. Known values are: "Delete" and + "Deallocate". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2019_06_01.models.ScaleSetEvictionPolicy :ivar node_taints: Taints added to new nodes during node pool create and scale. For example, @@ -1565,28 +1508,28 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): """ _validation = { - 'os_disk_size_gb': {'maximum': 1023, 'minimum': 0}, - 'provisioning_state': {'readonly': True}, + "os_disk_size_gb": {"maximum": 1023, "minimum": 0}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'maxPods', 'type': 'int'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'max_count': {'key': 'maxCount', 'type': 'int'}, - 'min_count': {'key': 'minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'enableAutoScaling', 'type': 'bool'}, - 'type': {'key': 'type', 'type': 'str'}, - 'orchestrator_version': {'key': 'orchestratorVersion', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'availability_zones': {'key': 'availabilityZones', 'type': '[str]'}, - 'enable_node_public_ip': {'key': 'enableNodePublicIP', 'type': 'bool'}, - 'scale_set_priority': {'key': 'scaleSetPriority', 'type': 'str'}, - 'scale_set_eviction_policy': {'key': 'scaleSetEvictionPolicy', 'type': 'str'}, - 'node_taints': {'key': 'nodeTaints', 'type': '[str]'}, + "count": {"key": "count", "type": "int"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "max_pods": {"key": "maxPods", "type": "int"}, + "os_type": {"key": "osType", "type": "str"}, + "max_count": {"key": "maxCount", "type": "int"}, + "min_count": {"key": "minCount", "type": "int"}, + "enable_auto_scaling": {"key": "enableAutoScaling", "type": "bool"}, + "type": {"key": "type", "type": "str"}, + "orchestrator_version": {"key": "orchestratorVersion", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "availability_zones": {"key": "availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "enableNodePublicIP", "type": "bool"}, + "scale_set_priority": {"key": "scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "scaleSetEvictionPolicy", "type": "str"}, + "node_taints": {"key": "nodeTaints", "type": "[str]"}, } def __init__( @@ -1597,7 +1540,7 @@ def __init__( os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, @@ -1605,8 +1548,8 @@ def __init__( orchestrator_version: Optional[str] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, - scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", node_taints: Optional[List[str]] = None, **kwargs ): @@ -1651,7 +1594,7 @@ def __init__( "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :paramtype vm_size: str or ~azure.mgmt.containerservice.v2019_06_01.models.ContainerServiceVMSizeTypes :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every @@ -1663,7 +1606,7 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux" and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2019_06_01.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -1672,7 +1615,7 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword type: AgentPoolType represents types of an agent pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2019_06_01.models.AgentPoolType :keyword orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -1683,19 +1626,19 @@ def __init__( :keyword enable_node_public_ip: Enable public IP for nodes. :paramtype enable_node_public_ip: bool :keyword scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Known values are: "Low", "Regular". Default value: "Regular". + priority. Default to regular. Known values are: "Low" and "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2019_06_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy for low priority virtual machine scale set. Default to Delete. Known values are: - "Delete", "Deallocate". Default value: "Delete". + "Delete" and "Deallocate". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2019_06_01.models.ScaleSetEvictionPolicy :keyword node_taints: Taints added to new nodes during node pool create and scale. For example, key=value:NoSchedule. :paramtype node_taints: list[str] """ - super(ManagedClusterAgentPoolProfileProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.vm_size = vm_size self.os_disk_size_gb = os_disk_size_gb @@ -1715,7 +1658,9 @@ def __init__( self.node_taints = node_taints -class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): +class ManagedClusterAgentPoolProfile( + ManagedClusterAgentPoolProfileProperties +): # pylint: disable=too-many-instance-attributes """Profile for the container service agent pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -1762,7 +1707,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :vartype vm_size: str or ~azure.mgmt.containerservice.v2019_06_01.models.ContainerServiceVMSizeTypes :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine @@ -1774,7 +1719,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Known values are: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux" and "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2019_06_01.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -1783,7 +1728,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar type: AgentPoolType represents types of an agent pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2019_06_01.models.AgentPoolType :ivar orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -1797,47 +1742,47 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar enable_node_public_ip: Enable public IP for nodes. :vartype enable_node_public_ip: bool :ivar scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Known values are: "Low", "Regular". Default value: "Regular". + priority. Default to regular. Known values are: "Low" and "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2019_06_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy - for low priority virtual machine scale set. Default to Delete. Known values are: "Delete", - "Deallocate". Default value: "Delete". + for low priority virtual machine scale set. Default to Delete. Known values are: "Delete" and + "Deallocate". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2019_06_01.models.ScaleSetEvictionPolicy :ivar node_taints: Taints added to new nodes during node pool create and scale. For example, key=value:NoSchedule. :vartype node_taints: list[str] - :ivar name: Required. Unique name of the agent pool profile in the context of the subscription - and resource group. + :ivar name: Unique name of the agent pool profile in the context of the subscription and + resource group. Required. :vartype name: str """ _validation = { - 'os_disk_size_gb': {'maximum': 1023, 'minimum': 0}, - 'provisioning_state': {'readonly': True}, - 'name': {'required': True, 'pattern': r'^[a-z][a-z0-9]{0,11}$'}, + "os_disk_size_gb": {"maximum": 1023, "minimum": 0}, + "provisioning_state": {"readonly": True}, + "name": {"required": True, "pattern": r"^[a-z][a-z0-9]{0,11}$"}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'maxPods', 'type': 'int'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'max_count': {'key': 'maxCount', 'type': 'int'}, - 'min_count': {'key': 'minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'enableAutoScaling', 'type': 'bool'}, - 'type': {'key': 'type', 'type': 'str'}, - 'orchestrator_version': {'key': 'orchestratorVersion', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'availability_zones': {'key': 'availabilityZones', 'type': '[str]'}, - 'enable_node_public_ip': {'key': 'enableNodePublicIP', 'type': 'bool'}, - 'scale_set_priority': {'key': 'scaleSetPriority', 'type': 'str'}, - 'scale_set_eviction_policy': {'key': 'scaleSetEvictionPolicy', 'type': 'str'}, - 'node_taints': {'key': 'nodeTaints', 'type': '[str]'}, - 'name': {'key': 'name', 'type': 'str'}, + "count": {"key": "count", "type": "int"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "max_pods": {"key": "maxPods", "type": "int"}, + "os_type": {"key": "osType", "type": "str"}, + "max_count": {"key": "maxCount", "type": "int"}, + "min_count": {"key": "minCount", "type": "int"}, + "enable_auto_scaling": {"key": "enableAutoScaling", "type": "bool"}, + "type": {"key": "type", "type": "str"}, + "orchestrator_version": {"key": "orchestratorVersion", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "availability_zones": {"key": "availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "enableNodePublicIP", "type": "bool"}, + "scale_set_priority": {"key": "scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "scaleSetEvictionPolicy", "type": "str"}, + "node_taints": {"key": "nodeTaints", "type": "[str]"}, + "name": {"key": "name", "type": "str"}, } def __init__( @@ -1849,7 +1794,7 @@ def __init__( os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, @@ -1857,8 +1802,8 @@ def __init__( orchestrator_version: Optional[str] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, - scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", node_taints: Optional[List[str]] = None, **kwargs ): @@ -1903,7 +1848,7 @@ def __init__( "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :paramtype vm_size: str or ~azure.mgmt.containerservice.v2019_06_01.models.ContainerServiceVMSizeTypes :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every @@ -1915,7 +1860,7 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux" and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2019_06_01.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -1924,7 +1869,7 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword type: AgentPoolType represents types of an agent pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2019_06_01.models.AgentPoolType :keyword orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -1935,26 +1880,44 @@ def __init__( :keyword enable_node_public_ip: Enable public IP for nodes. :paramtype enable_node_public_ip: bool :keyword scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Known values are: "Low", "Regular". Default value: "Regular". + priority. Default to regular. Known values are: "Low" and "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2019_06_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy for low priority virtual machine scale set. Default to Delete. Known values are: - "Delete", "Deallocate". Default value: "Delete". + "Delete" and "Deallocate". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2019_06_01.models.ScaleSetEvictionPolicy :keyword node_taints: Taints added to new nodes during node pool create and scale. For example, key=value:NoSchedule. :paramtype node_taints: list[str] - :keyword name: Required. Unique name of the agent pool profile in the context of the - subscription and resource group. + :keyword name: Unique name of the agent pool profile in the context of the subscription and + resource group. Required. :paramtype name: str """ - super(ManagedClusterAgentPoolProfile, self).__init__(count=count, vm_size=vm_size, os_disk_size_gb=os_disk_size_gb, vnet_subnet_id=vnet_subnet_id, max_pods=max_pods, os_type=os_type, max_count=max_count, min_count=min_count, enable_auto_scaling=enable_auto_scaling, type=type, orchestrator_version=orchestrator_version, availability_zones=availability_zones, enable_node_public_ip=enable_node_public_ip, scale_set_priority=scale_set_priority, scale_set_eviction_policy=scale_set_eviction_policy, node_taints=node_taints, **kwargs) + super().__init__( + count=count, + vm_size=vm_size, + os_disk_size_gb=os_disk_size_gb, + vnet_subnet_id=vnet_subnet_id, + max_pods=max_pods, + os_type=os_type, + max_count=max_count, + min_count=min_count, + enable_auto_scaling=enable_auto_scaling, + type=type, + orchestrator_version=orchestrator_version, + availability_zones=availability_zones, + enable_node_public_ip=enable_node_public_ip, + scale_set_priority=scale_set_priority, + scale_set_eviction_policy=scale_set_eviction_policy, + node_taints=node_taints, + **kwargs + ) self.name = name -class ManagedClusterIdentity(msrest.serialization.Model): +class ManagedClusterIdentity(_serialization.Model): """Identity for the managed cluster. Variables are only populated by the server, and will be ignored when sending a request. @@ -1968,41 +1931,36 @@ class ManagedClusterIdentity(msrest.serialization.Model): :ivar type: The type of identity used for the managed cluster. Type 'SystemAssigned' will use an implicitly created identity in master components and an auto-created user assigned identity in MC_ resource group in agent nodes. Type 'None' will not use MSI for the managed cluster, - service principal will be used instead. Known values are: "SystemAssigned", "None". + service principal will be used instead. Known values are: "SystemAssigned" and "None". :vartype type: str or ~azure.mgmt.containerservice.v2019_06_01.models.ResourceIdentityType """ _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, + "principal_id": {"readonly": True}, + "tenant_id": {"readonly": True}, } _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, + "principal_id": {"key": "principalId", "type": "str"}, + "tenant_id": {"key": "tenantId", "type": "str"}, + "type": {"key": "type", "type": "str"}, } - def __init__( - self, - *, - type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, - **kwargs - ): + def __init__(self, *, type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, **kwargs): """ :keyword type: The type of identity used for the managed cluster. Type 'SystemAssigned' will use an implicitly created identity in master components and an auto-created user assigned identity in MC_ resource group in agent nodes. Type 'None' will not use MSI for the managed - cluster, service principal will be used instead. Known values are: "SystemAssigned", "None". + cluster, service principal will be used instead. Known values are: "SystemAssigned" and "None". :paramtype type: str or ~azure.mgmt.containerservice.v2019_06_01.models.ResourceIdentityType """ - super(ManagedClusterIdentity, self).__init__(**kwargs) + super().__init__(**kwargs) self.principal_id = None self.tenant_id = None self.type = type -class ManagedClusterListResult(msrest.serialization.Model): +class ManagedClusterListResult(_serialization.Model): """The response from the List Managed Clusters operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -2014,40 +1972,35 @@ class ManagedClusterListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[ManagedCluster]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[ManagedCluster]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.ManagedCluster"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.ManagedCluster"]] = None, **kwargs): """ :keyword value: The list of managed clusters. :paramtype value: list[~azure.mgmt.containerservice.v2019_06_01.models.ManagedCluster] """ - super(ManagedClusterListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): +class ManagedClusterPoolUpgradeProfile(_serialization.Model): """The list of available upgrade versions. All required parameters must be populated in order to send to Azure. - :ivar kubernetes_version: Required. Kubernetes version (major, minor, patch). + :ivar kubernetes_version: Kubernetes version (major, minor, patch). Required. :vartype kubernetes_version: str :ivar name: Pool name. :vartype name: str - :ivar os_type: Required. OsType to be used to specify os type. Choose from Linux and Windows. - Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to + Linux. Known values are: "Linux" and "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2019_06_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -2055,15 +2008,15 @@ class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): """ _validation = { - 'kubernetes_version': {'required': True}, - 'os_type': {'required': True}, + "kubernetes_version": {"required": True}, + "os_type": {"required": True}, } _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'upgrades': {'key': 'upgrades', 'type': '[ManagedClusterPoolUpgradeProfileUpgradesItem]'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "os_type": {"key": "osType", "type": "str"}, + "upgrades": {"key": "upgrades", "type": "[ManagedClusterPoolUpgradeProfileUpgradesItem]"}, } def __init__( @@ -2076,25 +2029,25 @@ def __init__( **kwargs ): """ - :keyword kubernetes_version: Required. Kubernetes version (major, minor, patch). + :keyword kubernetes_version: Kubernetes version (major, minor, patch). Required. :paramtype kubernetes_version: str :keyword name: Pool name. :paramtype name: str - :keyword os_type: Required. OsType to be used to specify os type. Choose from Linux and - Windows. Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default + to Linux. Known values are: "Linux" and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2019_06_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: list[~azure.mgmt.containerservice.v2019_06_01.models.ManagedClusterPoolUpgradeProfileUpgradesItem] """ - super(ManagedClusterPoolUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.name = name self.os_type = os_type self.upgrades = upgrades -class ManagedClusterPoolUpgradeProfileUpgradesItem(msrest.serialization.Model): +class ManagedClusterPoolUpgradeProfileUpgradesItem(_serialization.Model): """ManagedClusterPoolUpgradeProfileUpgradesItem. :ivar kubernetes_version: Kubernetes version (major, minor, patch). @@ -2104,67 +2057,55 @@ class ManagedClusterPoolUpgradeProfileUpgradesItem(msrest.serialization.Model): """ _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } - def __init__( - self, - *, - kubernetes_version: Optional[str] = None, - is_preview: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, kubernetes_version: Optional[str] = None, is_preview: Optional[bool] = None, **kwargs): """ :keyword kubernetes_version: Kubernetes version (major, minor, patch). :paramtype kubernetes_version: str :keyword is_preview: Whether Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(ManagedClusterPoolUpgradeProfileUpgradesItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.is_preview = is_preview -class ManagedClusterServicePrincipalProfile(msrest.serialization.Model): +class ManagedClusterServicePrincipalProfile(_serialization.Model): """Information about a service principal identity for the cluster to use for manipulating Azure APIs. All required parameters must be populated in order to send to Azure. - :ivar client_id: Required. The ID for the service principal. + :ivar client_id: The ID for the service principal. Required. :vartype client_id: str :ivar secret: The secret password associated with the service principal in plain text. :vartype secret: str """ _validation = { - 'client_id': {'required': True}, + "client_id": {"required": True}, } _attribute_map = { - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'secret': {'key': 'secret', 'type': 'str'}, + "client_id": {"key": "clientId", "type": "str"}, + "secret": {"key": "secret", "type": "str"}, } - def __init__( - self, - *, - client_id: str, - secret: Optional[str] = None, - **kwargs - ): + def __init__(self, *, client_id: str, secret: Optional[str] = None, **kwargs): """ - :keyword client_id: Required. The ID for the service principal. + :keyword client_id: The ID for the service principal. Required. :paramtype client_id: str :keyword secret: The secret password associated with the service principal in plain text. :paramtype secret: str """ - super(ManagedClusterServicePrincipalProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.client_id = client_id self.secret = secret -class ManagedClusterUpgradeProfile(msrest.serialization.Model): +class ManagedClusterUpgradeProfile(_serialization.Model): """The list of available upgrades for compute pools. Variables are only populated by the server, and will be ignored when sending a request. @@ -2177,29 +2118,29 @@ class ManagedClusterUpgradeProfile(msrest.serialization.Model): :vartype name: str :ivar type: Type of upgrade profile. :vartype type: str - :ivar control_plane_profile: Required. The list of available upgrade versions for the control - plane. + :ivar control_plane_profile: The list of available upgrade versions for the control plane. + Required. :vartype control_plane_profile: ~azure.mgmt.containerservice.v2019_06_01.models.ManagedClusterPoolUpgradeProfile - :ivar agent_pool_profiles: Required. The list of available upgrade versions for agent pools. + :ivar agent_pool_profiles: The list of available upgrade versions for agent pools. Required. :vartype agent_pool_profiles: list[~azure.mgmt.containerservice.v2019_06_01.models.ManagedClusterPoolUpgradeProfile] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'control_plane_profile': {'required': True}, - 'agent_pool_profiles': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "control_plane_profile": {"required": True}, + "agent_pool_profiles": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'control_plane_profile': {'key': 'properties.controlPlaneProfile', 'type': 'ManagedClusterPoolUpgradeProfile'}, - 'agent_pool_profiles': {'key': 'properties.agentPoolProfiles', 'type': '[ManagedClusterPoolUpgradeProfile]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "control_plane_profile": {"key": "properties.controlPlaneProfile", "type": "ManagedClusterPoolUpgradeProfile"}, + "agent_pool_profiles": {"key": "properties.agentPoolProfiles", "type": "[ManagedClusterPoolUpgradeProfile]"}, } def __init__( @@ -2210,15 +2151,15 @@ def __init__( **kwargs ): """ - :keyword control_plane_profile: Required. The list of available upgrade versions for the - control plane. + :keyword control_plane_profile: The list of available upgrade versions for the control plane. + Required. :paramtype control_plane_profile: ~azure.mgmt.containerservice.v2019_06_01.models.ManagedClusterPoolUpgradeProfile - :keyword agent_pool_profiles: Required. The list of available upgrade versions for agent pools. + :keyword agent_pool_profiles: The list of available upgrade versions for agent pools. Required. :paramtype agent_pool_profiles: list[~azure.mgmt.containerservice.v2019_06_01.models.ManagedClusterPoolUpgradeProfile] """ - super(ManagedClusterUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -2226,18 +2167,18 @@ def __init__( self.agent_pool_profiles = agent_pool_profiles -class ManagedClusterWindowsProfile(msrest.serialization.Model): +class ManagedClusterWindowsProfile(_serialization.Model): """Profile for Windows VMs in the container service cluster. All required parameters must be populated in order to send to Azure. - :ivar admin_username: Required. Specifies the name of the administrator account. - :code:`
`:code:`
` **restriction:** Cannot end in "." :code:`
`:code:`
` - **Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", "test1", - "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", - "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", - "sys", "test2", "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 - character :code:`
`:code:`
` **Max-length:** 20 characters. + :ivar admin_username: Specifies the name of the administrator account. :code:`
`:code:`
` + **restriction:** Cannot end in "." :code:`
`:code:`
` **Disallowed values:** + "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", + "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", + "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", + "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 character + :code:`
`:code:`
` **Max-length:** 20 characters. Required. :vartype admin_username: str :ivar admin_password: Specifies the password of the administrator account. :code:`
`:code:`
` **Minimum-length:** 8 characters :code:`
`:code:`
` @@ -2250,29 +2191,23 @@ class ManagedClusterWindowsProfile(msrest.serialization.Model): """ _validation = { - 'admin_username': {'required': True}, + "admin_username": {"required": True}, } _attribute_map = { - 'admin_username': {'key': 'adminUsername', 'type': 'str'}, - 'admin_password': {'key': 'adminPassword', 'type': 'str'}, + "admin_username": {"key": "adminUsername", "type": "str"}, + "admin_password": {"key": "adminPassword", "type": "str"}, } - def __init__( - self, - *, - admin_username: str, - admin_password: Optional[str] = None, - **kwargs - ): + def __init__(self, *, admin_username: str, admin_password: Optional[str] = None, **kwargs): """ - :keyword admin_username: Required. Specifies the name of the administrator account. + :keyword admin_username: Specifies the name of the administrator account. :code:`
`:code:`
` **restriction:** Cannot end in "." :code:`
`:code:`
` **Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 - character :code:`
`:code:`
` **Max-length:** 20 characters. + character :code:`
`:code:`
` **Max-length:** 20 characters. Required. :paramtype admin_username: str :keyword admin_password: Specifies the password of the administrator account. :code:`
`:code:`
` **Minimum-length:** 8 characters :code:`
`:code:`
` @@ -2283,12 +2218,12 @@ def __init__( "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!". :paramtype admin_password: str """ - super(ManagedClusterWindowsProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.admin_username = admin_username self.admin_password = admin_password -class OperationListResult(msrest.serialization.Model): +class OperationListResult(_serialization.Model): """The List Compute Operation operation response. Variables are only populated by the server, and will be ignored when sending a request. @@ -2298,24 +2233,20 @@ class OperationListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[OperationValue]'}, + "value": {"key": "value", "type": "[OperationValue]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(OperationListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None -class OperationValue(msrest.serialization.Model): +class OperationValue(_serialization.Model): """Describes the properties of a Compute Operation value. Variables are only populated by the server, and will be ignored when sending a request. @@ -2335,30 +2266,26 @@ class OperationValue(msrest.serialization.Model): """ _validation = { - 'origin': {'readonly': True}, - 'name': {'readonly': True}, - 'operation': {'readonly': True}, - 'resource': {'readonly': True}, - 'description': {'readonly': True}, - 'provider': {'readonly': True}, + "origin": {"readonly": True}, + "name": {"readonly": True}, + "operation": {"readonly": True}, + "resource": {"readonly": True}, + "description": {"readonly": True}, + "provider": {"readonly": True}, } _attribute_map = { - 'origin': {'key': 'origin', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'operation': {'key': 'display.operation', 'type': 'str'}, - 'resource': {'key': 'display.resource', 'type': 'str'}, - 'description': {'key': 'display.description', 'type': 'str'}, - 'provider': {'key': 'display.provider', 'type': 'str'}, + "origin": {"key": "origin", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "operation": {"key": "display.operation", "type": "str"}, + "resource": {"key": "display.resource", "type": "str"}, + "description": {"key": "display.description", "type": "str"}, + "provider": {"key": "display.provider", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(OperationValue, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.origin = None self.name = None self.operation = None @@ -2367,26 +2294,21 @@ def __init__( self.provider = None -class TagsObject(msrest.serialization.Model): +class TagsObject(_serialization.Model): """Tags object for patch operations. - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] """ _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] """ - super(TagsObject, self).__init__(**kwargs) + super().__init__(**kwargs) self.tags = tags diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/models/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/models/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/models/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/models/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/operations/__init__.py index 403c0174f052..ee6608454b6b 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/operations/__init__.py @@ -13,10 +13,11 @@ from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'Operations', - 'ManagedClustersOperations', - 'AgentPoolsOperations', + "Operations", + "ManagedClustersOperations", + "AgentPoolsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/operations/_agent_pools_operations.py index 67e5b285cf7b..bcd7cad9b2c7 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/operations/_agent_pools_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,249 +27,250 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - *, - json: Optional[_models.AgentPool] = None, - content: Any = None, - **kwargs: Any + _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, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + _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, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_get_upgrade_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_available_agent_pool_versions_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class AgentPoolsOperations: """ @@ -285,48 +291,40 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> Iterable[_models.AgentPoolListResult]: + def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> Iterable["_models.AgentPool"]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. The operation returns properties of each agent pool. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AgentPoolListResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2019_06_01.models.AgentPoolListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either AgentPool or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2019_06_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -334,16 +332,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -359,10 +352,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -372,54 +363,45 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore @distributed_trace def get( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPool: """Gets the agent pool. Gets the details of the agent pool by managed cluster and resource group. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPool, or the result of cls(response) + :return: AgentPool or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_06_01.models.AgentPool - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -427,57 +409,60 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore def _create_or_update_initial( self, resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: _models.AgentPool, + parameters: Union[_models.AgentPool, IO], **kwargs: Any ) -> _models.AgentPool: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - _json = self._serialize.body(parameters, 'AgentPool') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "AgentPool") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -485,10 +470,9 @@ def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -496,40 +480,86 @@ def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - - @distributed_trace + @overload def begin_create_or_update( self, resource_group_name: str, resource_name: str, agent_pool_name: str, parameters: _models.AgentPool, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.AgentPool]: """Creates or updates an agent pool. Creates or updates an agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :param parameters: Parameters supplied to the Create or Update an agent pool operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2019_06_01.models.AgentPool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2019_06_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AgentPool]: + """Creates or updates an agent pool. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: Parameters supplied to the Create or Update an agent pool operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -541,20 +571,56 @@ def begin_create_or_update( :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2019_06_01.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: Union[_models.AgentPool, IO], + **kwargs: Any + ) -> LROPoller[_models.AgentPool]: + """Creates or updates an agent pool. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: Parameters supplied to the Create or Update an agent pool operation. Is + either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2019_06_01.models.AgentPool or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2019_06_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -563,66 +629,55 @@ def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -630,10 +685,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -643,26 +697,21 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + def begin_delete( + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> LROPoller[None]: """Deletes an agent pool. Deletes the agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -674,100 +723,86 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPoolUpgradeProfile: """Gets upgrade profile for an agent pool. Gets the details of the upgrade profile for an agent pool with a specified resource group and managed cluster name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolUpgradeProfile, or the result of cls(response) + :return: AgentPoolUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_06_01.models.AgentPoolUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -775,64 +810,56 @@ def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolUpgradeProfile', pipeline_response) + deserialized = self._deserialize("AgentPoolUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore @distributed_trace def get_available_agent_pool_versions( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported versions for the specified agent pool. Gets a list of supported versions for the specified agent pool. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolAvailableVersions, or the result of cls(response) + :return: AgentPoolAvailableVersions or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_06_01.models.AgentPoolAvailableVersions - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolAvailableVersions] - request = build_get_available_agent_pool_versions_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_available_agent_pool_versions.metadata['url'], + template_url=self.get_available_agent_pool_versions.metadata["url"], headers=_headers, params=_params, ) @@ -840,22 +867,20 @@ def get_available_agent_pool_versions( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolAvailableVersions', pipeline_response) + deserialized = self._deserialize("AgentPoolAvailableVersions", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_available_agent_pool_versions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore - + get_available_agent_pool_versions.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/operations/_managed_clusters_operations.py index ed084edeb284..a7fd159e5f54 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/operations/_managed_clusters_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,483 +27,460 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters") + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters" + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_resource_group_request( - subscription_id: str, - resource_group_name: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters", + ) # 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', min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_upgrade_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_access_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, role_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 = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "roleName": _SERIALIZER.url("role_name", role_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "roleName": _SERIALIZER.url("role_name", role_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_admin_credentials_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_user_credentials_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: + +def build_get_request(resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedCluster] = None, - content: Any = None, - **kwargs: Any + +def build_create_or_update_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_update_tags_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.TagsObject] = None, - content: Any = None, - **kwargs: Any + +def build_update_tags_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any +def build_delete_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_reset_service_principal_profile_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedClusterServicePrincipalProfile] = None, - content: Any = None, - **kwargs: Any +def build_reset_service_principal_profile_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_reset_aad_profile_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedClusterAADProfile] = None, - content: Any = None, - **kwargs: Any + +def build_reset_aad_profile_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + class ManagedClustersOperations: """ @@ -519,41 +501,35 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.ManagedClusterListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.ManagedCluster"]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. The operation returns properties of each managed cluster. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2019_06_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2019_06_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -561,14 +537,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -584,10 +557,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -597,50 +568,42 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> Iterable[_models.ManagedClusterListResult]: + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.ManagedCluster"]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. The operation returns properties of each managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2019_06_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2019_06_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -648,15 +611,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -672,10 +631,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -685,51 +642,43 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.ManagedClusterUpgradeProfile: """Gets upgrade profile for a managed cluster. Gets the details of the upgrade profile for a managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterUpgradeProfile, or the result of cls(response) + :return: ManagedClusterUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_06_01.models.ManagedClusterUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -737,69 +686,60 @@ def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterUpgradeProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore @distributed_trace def get_access_profile( - self, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, role_name: str, **kwargs: Any ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. Gets the accessProfile for the specified role name of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param role_name: The name of the role for managed cluster accessProfile resource. + :param role_name: The name of the role for managed cluster accessProfile resource. Required. :type role_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterAccessProfile, or the result of cls(response) + :return: ManagedClusterAccessProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_06_01.models.ManagedClusterAccessProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterAccessProfile] - request = build_get_access_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, role_name=role_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_access_profile.metadata['url'], + template_url=self.get_access_profile.metadata["url"], headers=_headers, params=_params, ) @@ -807,64 +747,56 @@ def get_access_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterAccessProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterAccessProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_access_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore - + get_access_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore @distributed_trace def list_cluster_admin_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster admin credential of a managed cluster. Gets cluster admin credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_06_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_admin_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_admin_credentials.metadata['url'], + template_url=self.list_cluster_admin_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -872,64 +804,56 @@ def list_cluster_admin_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_admin_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore - + list_cluster_admin_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore @distributed_trace def list_cluster_user_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster user credential of a managed cluster. Gets cluster user credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_06_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_user_credentials.metadata['url'], + template_url=self.list_cluster_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -937,64 +861,54 @@ def list_cluster_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore - + list_cluster_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore @distributed_trace - def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.ManagedCluster: + def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.ManagedCluster: """Gets a managed cluster. Gets the details of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedCluster, or the result of cls(response) + :return: ManagedCluster or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_06_01.models.ManagedCluster - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -1002,55 +916,54 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _create_or_update_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.ManagedCluster, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'ManagedCluster') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedCluster") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1058,10 +971,9 @@ def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -1069,25 +981,26 @@ def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - - @distributed_trace + @overload def begin_create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedCluster, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. @@ -1095,12 +1008,90 @@ def begin_create_or_update( Creates or updates a managed cluster with the specified configuration for agents and Kubernetes version. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2019_06_01.models.ManagedCluster + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2019_06_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster with the specified configuration for agents and Kubernetes + version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2019_06_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster with the specified configuration for agents and Kubernetes + version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. Is + either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2019_06_01.models.ManagedCluster or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1113,20 +1104,17 @@ def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2019_06_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -1134,69 +1122,66 @@ def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _update_tags_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.TagsObject, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request_initial( - subscription_id=self._config.subscription_id, + request = build_update_tags_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_tags_initial.metadata['url'], + content=_content, + template_url=self._update_tags_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1204,44 +1189,118 @@ def _update_tags_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_tags_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _update_tags_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - @distributed_trace + @overload def begin_update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates a managed cluster with the specified tags. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2019_06_01.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2019_06_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates a managed cluster with the specified tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2019_06_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates a managed cluster with the specified tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2019_06_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1254,20 +1313,17 @@ def begin_update_tags( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2019_06_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, @@ -1275,64 +1331,54 @@ def begin_update_tags( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1340,10 +1386,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1353,23 +1398,17 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> LROPoller[None]: + def begin_delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> LROPoller[None]: """Deletes a managed cluster. Deletes the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1381,85 +1420,83 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterServicePrincipalProfile, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterServicePrincipalProfile") - request = build_reset_service_principal_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_service_principal_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_service_principal_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_service_principal_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1467,10 +1504,9 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1480,29 +1516,106 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re if cls: return cls(pipeline_response, None, {}) - _reset_service_principal_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + _reset_service_principal_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore - - @distributed_trace - def begin_reset_service_principal_profile( # pylint: disable=inconsistent-return-statements + @overload + def begin_reset_service_principal_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterServicePrincipalProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: """Reset Service Principal Profile of a managed cluster. Update the service principal Profile for a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a - Managed Cluster. + Managed Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2019_06_01.models.ManagedClusterServicePrincipalProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reset Service Principal Profile of a managed cluster. + + Update the service principal Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a + Managed Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Reset Service Principal Profile of a managed cluster. + + Update the service principal Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a + Managed Cluster. Is either a model type or a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2019_06_01.models.ManagedClusterServicePrincipalProfile or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1513,20 +1626,17 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1534,67 +1644,68 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_service_principal_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + begin_reset_service_principal_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterAADProfile, + parameters: Union[_models.ManagedClusterAADProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterAADProfile") - request = build_reset_aad_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_aad_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_aad_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_aad_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1602,10 +1713,9 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1615,28 +1725,105 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement if cls: return cls(pipeline_response, None, {}) - _reset_aad_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - + _reset_aad_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - @distributed_trace - def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements + @overload + def begin_reset_aad_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterAADProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: """Reset AAD Profile of a managed cluster. Update the AAD Profile for a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed - Cluster. + Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2019_06_01.models.ManagedClusterAADProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reset AAD Profile of a managed cluster. + + Update the AAD Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed + Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterAADProfile, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Reset AAD Profile of a managed cluster. + + Update the AAD Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed + Cluster. Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2019_06_01.models.ManagedClusterAADProfile or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1647,20 +1834,17 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1668,34 +1852,30 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_aad_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + begin_reset_aad_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/operations/_operations.py index 9317adca4ae1..dbd553f9b54e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/operations/_operations.py @@ -7,10 +7,15 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,38 +25,34 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - **kwargs: Any -) -> HttpRequest: + +def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.ContainerService/operations") # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class Operations: """ @@ -72,36 +73,31 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.OperationListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.OperationValue"]: """Gets a list of compute operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationListResult or the result of cls(response) + :return: An iterator like instance of either OperationValue or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2019_06_01.models.OperationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2019_06_01.models.OperationValue] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -109,13 +105,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -131,10 +125,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -144,8 +136,6 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.ContainerService/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ContainerService/operations"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/operations/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/__init__.py index 37a5f9e02e6f..a8716d29afe8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/__init__.py @@ -14,7 +14,8 @@ except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['ContainerServiceClient'] + +__all__ = ["ContainerServiceClient"] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/_configuration.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/_configuration.py index 5261a2b8cca0..76cc70d6e097 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/_configuration.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/_configuration.py @@ -18,30 +18,26 @@ VERSION = "unknown" + class ContainerServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ContainerServiceClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2019-08-01". 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: + def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ContainerServiceClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2019-08-01") # type: str + api_version = kwargs.pop("api_version", "2019-08-01") # type: str if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -51,23 +47,24 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-containerservice/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-containerservice/{}".format(VERSION)) self._configure(**kwargs) def _configure( - self, - **kwargs # type: Any + self, **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/_container_service_client.py index f0970f8e9784..b872040f241c 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/_container_service_client.py @@ -9,12 +9,11 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from . import models +from .._serialization import Deserializer, Serializer from ._configuration import ContainerServiceClientConfiguration from .operations import AgentPoolsOperations, ManagedClustersOperations, Operations @@ -22,7 +21,8 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class ContainerServiceClient: + +class ContainerServiceClient: # pylint: disable=client-accepts-api-version-keyword """The Container Service Client. :ivar operations: Operations operations @@ -32,10 +32,10 @@ class ContainerServiceClient: azure.mgmt.containerservice.v2019_08_01.operations.ManagedClustersOperations :ivar agent_pools: AgentPoolsOperations operations :vartype agent_pools: azure.mgmt.containerservice.v2019_08_01.operations.AgentPoolsOperations - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -53,29 +53,22 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = ContainerServiceClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = ContainerServiceClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize - ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.managed_clusters = ManagedClustersOperations( self._client, self._config, self._serialize, self._deserialize ) - self.agent_pools = AgentPoolsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - + self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> HttpResponse: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -84,7 +77,7 @@ def _send_request( >>> response = client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/_metadata.json b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/_metadata.json index 60a5e8048129..49a0e766d16a 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/_metadata.json +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/_metadata.json @@ -10,20 +10,20 @@ "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { "credential": { - "signature": "credential, # type: \"TokenCredential\"", - "description": "Credential needed for the client to connect to Azure.", + "signature": "credential: \"TokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true }, "subscription_id": { - "signature": "subscription_id, # type: str", - "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "signature": "subscription_id: str,", + "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.", "docstring_type": "str", "required": true } @@ -31,13 +31,13 @@ "async": { "credential": { "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure.", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { "signature": "subscription_id: str,", - "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.", "docstring_type": "str", "required": true } @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=\"https://management.azure.com\", # type: str", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/_patch.py index 74e48ecd07cf..f99e77fef986 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/_patch.py @@ -28,4 +28,4 @@ # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + pass diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/_vendor.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/_vendor.py index 138f663c53a4..9aad73fc743e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/_vendor.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/_vendor.py @@ -7,6 +7,7 @@ from azure.core.pipeline.transport import HttpRequest + def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) @@ -14,6 +15,7 @@ def _convert_request(request, files=None): request.set_formdata_body(files) return request + def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -21,7 +23,5 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [ - c for c in formatted_components if "{}".format(key.args[0]) not in c - ] + components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/aio/__init__.py index 37a5f9e02e6f..a8716d29afe8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/aio/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/aio/__init__.py @@ -14,7 +14,8 @@ except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['ContainerServiceClient'] + +__all__ = ["ContainerServiceClient"] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/aio/_configuration.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/aio/_configuration.py index 4813fff52655..d3a8fed55b7a 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/aio/_configuration.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/aio/_configuration.py @@ -18,30 +18,26 @@ VERSION = "unknown" + class ContainerServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ContainerServiceClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2019-08-01". 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: + def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ContainerServiceClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2019-08-01") # type: str + api_version = kwargs.pop("api_version", "2019-08-01") # type: str if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -51,22 +47,21 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-containerservice/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-containerservice/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, - **kwargs: Any - ) -> None: - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/aio/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/aio/_container_service_client.py index e0b9eef51ecf..d8c40167b1ee 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/aio/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/aio/_container_service_client.py @@ -9,12 +9,11 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from .. import models +from ..._serialization import Deserializer, Serializer from ._configuration import ContainerServiceClientConfiguration from .operations import AgentPoolsOperations, ManagedClustersOperations, Operations @@ -22,7 +21,8 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class ContainerServiceClient: + +class ContainerServiceClient: # pylint: disable=client-accepts-api-version-keyword """The Container Service Client. :ivar operations: Operations operations @@ -33,10 +33,10 @@ class ContainerServiceClient: :ivar agent_pools: AgentPoolsOperations operations :vartype agent_pools: azure.mgmt.containerservice.v2019_08_01.aio.operations.AgentPoolsOperations - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -54,29 +54,22 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = ContainerServiceClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = ContainerServiceClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize - ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.managed_clusters = ManagedClustersOperations( self._client, self._config, self._serialize, self._deserialize ) - self.agent_pools = AgentPoolsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - + self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -85,7 +78,7 @@ def _send_request( >>> response = await client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/aio/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/aio/_patch.py index 74e48ecd07cf..f99e77fef986 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/aio/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/aio/_patch.py @@ -28,4 +28,4 @@ # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + pass diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/aio/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/aio/operations/__init__.py index 403c0174f052..ee6608454b6b 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/aio/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/aio/operations/__init__.py @@ -13,10 +13,11 @@ from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'Operations', - 'ManagedClustersOperations', - 'AgentPoolsOperations', + "Operations", + "ManagedClustersOperations", + "AgentPoolsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/aio/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/aio/operations/_agent_pools_operations.py index 84a42659ad19..47e4b8cdab32 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/aio/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/aio/operations/_agent_pools_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +29,19 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._agent_pools_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_available_agent_pool_versions_request, build_get_request, build_get_upgrade_profile_request, build_list_request -T = TypeVar('T') +from ...operations._agent_pools_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_available_agent_pool_versions_request, + build_get_request, + build_get_upgrade_profile_request, + build_list_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class AgentPoolsOperations: """ .. warning:: @@ -45,48 +61,41 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.AgentPoolListResult]: + def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncIterable["_models.AgentPool"]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. The operation returns properties of each agent pool. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AgentPoolListResult or the result of cls(response) + :return: An iterator like instance of either AgentPool or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2019_08_01.models.AgentPoolListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2019_08_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -94,16 +103,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -119,10 +123,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -132,54 +134,45 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore @distributed_trace_async async def get( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPool: """Gets the agent pool. Gets the details of the agent pool by managed cluster and resource group. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPool, or the result of cls(response) + :return: AgentPool or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_08_01.models.AgentPool - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -187,57 +180,60 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore async def _create_or_update_initial( self, resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: _models.AgentPool, + parameters: Union[_models.AgentPool, IO], **kwargs: Any ) -> _models.AgentPool: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - _json = self._serialize.body(parameters, 'AgentPool') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "AgentPool") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -245,10 +241,9 @@ async def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -256,40 +251,45 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - - @distributed_trace_async + @overload async def begin_create_or_update( self, resource_group_name: str, resource_name: str, agent_pool_name: str, parameters: _models.AgentPool, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.AgentPool]: """Creates or updates an agent pool. Creates or updates an agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :param parameters: Parameters supplied to the Create or Update an agent pool operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2019_08_01.models.AgentPool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -302,20 +302,99 @@ async def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2019_08_01.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AgentPool]: + """Creates or updates an agent pool. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: Parameters supplied to the Create or Update an agent pool operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AgentPool or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2019_08_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: Union[_models.AgentPool, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.AgentPool]: + """Creates or updates an agent pool. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: Parameters supplied to the Create or Update an agent pool operation. Is + either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2019_08_01.models.AgentPool or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AgentPool or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2019_08_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -324,66 +403,55 @@ async def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -391,10 +459,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -404,26 +471,21 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + async def begin_delete( + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes an agent pool. Deletes the agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -435,100 +497,86 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace_async async def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPoolUpgradeProfile: """Gets upgrade profile for an agent pool. Gets the details of the upgrade profile for an agent pool with a specified resource group and managed cluster name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolUpgradeProfile, or the result of cls(response) + :return: AgentPoolUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_08_01.models.AgentPoolUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -536,64 +584,56 @@ async def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolUpgradeProfile', pipeline_response) + deserialized = self._deserialize("AgentPoolUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore @distributed_trace_async async def get_available_agent_pool_versions( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported versions for the specified agent pool. Gets a list of supported versions for the specified agent pool. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolAvailableVersions, or the result of cls(response) + :return: AgentPoolAvailableVersions or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_08_01.models.AgentPoolAvailableVersions - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolAvailableVersions] - request = build_get_available_agent_pool_versions_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_available_agent_pool_versions.metadata['url'], + template_url=self.get_available_agent_pool_versions.metadata["url"], headers=_headers, params=_params, ) @@ -601,22 +641,20 @@ async def get_available_agent_pool_versions( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolAvailableVersions', pipeline_response) + deserialized = self._deserialize("AgentPoolAvailableVersions", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_available_agent_pool_versions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore - + get_available_agent_pool_versions.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/aio/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/aio/operations/_managed_clusters_operations.py index 0dea25852d39..aa4cc63b9161 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/aio/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/aio/operations/_managed_clusters_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +29,26 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._managed_clusters_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_access_profile_request, build_get_request, build_get_upgrade_profile_request, build_list_by_resource_group_request, build_list_cluster_admin_credentials_request, build_list_cluster_user_credentials_request, build_list_request, build_reset_aad_profile_request_initial, build_reset_service_principal_profile_request_initial, build_rotate_cluster_certificates_request_initial, build_update_tags_request_initial -T = TypeVar('T') +from ...operations._managed_clusters_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_access_profile_request, + build_get_request, + build_get_upgrade_profile_request, + build_list_by_resource_group_request, + build_list_cluster_admin_credentials_request, + build_list_cluster_user_credentials_request, + build_list_request, + build_reset_aad_profile_request, + build_reset_service_principal_profile_request, + build_rotate_cluster_certificates_request, + build_update_tags_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class ManagedClustersOperations: """ .. warning:: @@ -45,41 +68,35 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.ManagedClusterListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.ManagedCluster"]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. The operation returns properties of each managed cluster. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2019_08_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2019_08_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -87,14 +104,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -110,10 +124,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -123,50 +135,44 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.ManagedClusterListResult]: + self, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ManagedCluster"]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. The operation returns properties of each managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2019_08_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2019_08_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -174,15 +180,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -198,10 +200,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -211,51 +211,43 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace_async async def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.ManagedClusterUpgradeProfile: """Gets upgrade profile for a managed cluster. Gets the details of the upgrade profile for a managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterUpgradeProfile, or the result of cls(response) + :return: ManagedClusterUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_08_01.models.ManagedClusterUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -263,69 +255,60 @@ async def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterUpgradeProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore @distributed_trace_async async def get_access_profile( - self, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, role_name: str, **kwargs: Any ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. Gets the accessProfile for the specified role name of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param role_name: The name of the role for managed cluster accessProfile resource. + :param role_name: The name of the role for managed cluster accessProfile resource. Required. :type role_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterAccessProfile, or the result of cls(response) + :return: ManagedClusterAccessProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_08_01.models.ManagedClusterAccessProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterAccessProfile] - request = build_get_access_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, role_name=role_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_access_profile.metadata['url'], + template_url=self.get_access_profile.metadata["url"], headers=_headers, params=_params, ) @@ -333,64 +316,56 @@ async def get_access_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterAccessProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterAccessProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_access_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore - + get_access_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore @distributed_trace_async async def list_cluster_admin_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster admin credential of a managed cluster. Gets cluster admin credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_08_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_admin_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_admin_credentials.metadata['url'], + template_url=self.list_cluster_admin_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -398,64 +373,56 @@ async def list_cluster_admin_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_admin_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore - + list_cluster_admin_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore @distributed_trace_async async def list_cluster_user_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster user credential of a managed cluster. Gets cluster user credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_08_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_user_credentials.metadata['url'], + template_url=self.list_cluster_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -463,64 +430,54 @@ async def list_cluster_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore - + list_cluster_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore @distributed_trace_async - async def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.ManagedCluster: + async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.ManagedCluster: """Gets a managed cluster. Gets the details of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedCluster, or the result of cls(response) + :return: ManagedCluster or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_08_01.models.ManagedCluster - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -528,55 +485,54 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _create_or_update_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.ManagedCluster, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'ManagedCluster') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedCluster") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -584,10 +540,9 @@ async def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -595,25 +550,26 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - @distributed_trace_async + @overload async def begin_create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedCluster, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. @@ -621,12 +577,90 @@ async def begin_create_or_update( Creates or updates a managed cluster with the specified configuration for agents and Kubernetes version. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2019_08_01.models.ManagedCluster + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2019_08_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster with the specified configuration for agents and Kubernetes + version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2019_08_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster with the specified configuration for agents and Kubernetes + version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. Is + either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2019_08_01.models.ManagedCluster or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -639,20 +673,17 @@ async def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2019_08_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -660,69 +691,66 @@ async def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _update_tags_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.TagsObject, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request_initial( - subscription_id=self._config.subscription_id, + request = build_update_tags_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_tags_initial.metadata['url'], + content=_content, + template_url=self._update_tags_initial.metadata["url"], headers=_headers, params=_params, ) @@ -730,44 +758,118 @@ async def _update_tags_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_tags_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + _update_tags_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - - @distributed_trace_async + @overload async def begin_update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates a managed cluster with the specified tags. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2019_08_01.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2019_08_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates a managed cluster with the specified tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2019_08_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates a managed cluster with the specified tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2019_08_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -780,20 +882,17 @@ async def begin_update_tags( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2019_08_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, @@ -801,64 +900,54 @@ async def begin_update_tags( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -866,10 +955,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -879,23 +967,17 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: + async def begin_delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Deletes a managed cluster. Deletes the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -907,85 +989,83 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterServicePrincipalProfile, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterServicePrincipalProfile") - request = build_reset_service_principal_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_service_principal_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_service_principal_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_service_principal_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -993,10 +1073,9 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1006,29 +1085,106 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist if cls: return cls(pipeline_response, None, {}) - _reset_service_principal_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore - + _reset_service_principal_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore - @distributed_trace_async - async def begin_reset_service_principal_profile( # pylint: disable=inconsistent-return-statements + @overload + async def begin_reset_service_principal_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterServicePrincipalProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: """Reset Service Principal Profile of a managed cluster. Update the service principal Profile for a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a - Managed Cluster. + Managed Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2019_08_01.models.ManagedClusterServicePrincipalProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset Service Principal Profile of a managed cluster. + + Update the service principal Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a + Managed Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset Service Principal Profile of a managed cluster. + + Update the service principal Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a + Managed Cluster. Is either a model type or a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2019_08_01.models.ManagedClusterServicePrincipalProfile or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -1039,20 +1195,17 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1060,67 +1213,68 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_service_principal_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + begin_reset_service_principal_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterAADProfile, + parameters: Union[_models.ManagedClusterAADProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterAADProfile") - request = build_reset_aad_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_aad_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_aad_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_aad_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1128,10 +1282,9 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1141,28 +1294,105 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta if cls: return cls(pipeline_response, None, {}) - _reset_aad_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + _reset_aad_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - - @distributed_trace_async - async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements + @overload + async def begin_reset_aad_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterAADProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: """Reset AAD Profile of a managed cluster. Update the AAD Profile for a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed - Cluster. + Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2019_08_01.models.ManagedClusterAADProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset AAD Profile of a managed cluster. + + Update the AAD Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed + Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterAADProfile, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset AAD Profile of a managed cluster. + + Update the AAD Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed + Cluster. Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2019_08_01.models.ManagedClusterAADProfile or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -1173,20 +1403,17 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1194,62 +1421,52 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_aad_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + begin_reset_aad_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_rotate_cluster_certificates_request_initial( - subscription_id=self._config.subscription_id, + request = build_rotate_cluster_certificates_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._rotate_cluster_certificates_initial.metadata['url'], + template_url=self._rotate_cluster_certificates_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1257,10 +1474,9 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1270,23 +1486,19 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- if cls: return cls(pipeline_response, None, {}) - _rotate_cluster_certificates_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore - + _rotate_cluster_certificates_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore @distributed_trace_async - async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + async def begin_rotate_cluster_certificates( + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Rotate certificates of a managed cluster. Rotate certificates of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1298,52 +1510,45 @@ async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-ret Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._rotate_cluster_certificates_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_rotate_cluster_certificates.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore + begin_rotate_cluster_certificates.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/aio/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/aio/operations/_operations.py index 0ac53c3f7ea1..53f4f6852aa7 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/aio/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/aio/operations/_operations.py @@ -7,9 +7,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,9 +27,11 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._operations import build_list_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class Operations: """ .. warning:: @@ -42,36 +51,31 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.OperationListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.OperationValue"]: """Gets a list of compute operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationListResult or the result of cls(response) + :return: An iterator like instance of either OperationValue or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2019_08_01.models.OperationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2019_08_01.models.OperationValue] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -79,13 +83,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -101,10 +103,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -114,8 +114,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.ContainerService/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ContainerService/operations"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/aio/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/aio/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/aio/operations/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/aio/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/models/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/models/__init__.py index f8a486e34973..51fdad52c264 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/models/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/models/__init__.py @@ -47,75 +47,73 @@ from ._models_py3 import SubResource from ._models_py3 import TagsObject - -from ._container_service_client_enums import ( - AgentPoolType, - ContainerServiceStorageProfileTypes, - ContainerServiceVMSizeTypes, - Count, - LoadBalancerSku, - NetworkPlugin, - NetworkPolicy, - OSType, - ResourceIdentityType, - ScaleSetEvictionPolicy, - ScaleSetPriority, -) +from ._container_service_client_enums import AgentPoolType +from ._container_service_client_enums import ContainerServiceStorageProfileTypes +from ._container_service_client_enums import ContainerServiceVMSizeTypes +from ._container_service_client_enums import Count +from ._container_service_client_enums import LoadBalancerSku +from ._container_service_client_enums import NetworkPlugin +from ._container_service_client_enums import NetworkPolicy +from ._container_service_client_enums import OSType +from ._container_service_client_enums import ResourceIdentityType +from ._container_service_client_enums import ScaleSetEvictionPolicy +from ._container_service_client_enums import ScaleSetPriority from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'AgentPool', - 'AgentPoolAvailableVersions', - 'AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem', - 'AgentPoolListResult', - 'AgentPoolUpgradeProfile', - 'AgentPoolUpgradeProfilePropertiesUpgradesItem', - 'CloudErrorBody', - 'ContainerServiceDiagnosticsProfile', - 'ContainerServiceLinuxProfile', - 'ContainerServiceMasterProfile', - 'ContainerServiceNetworkProfile', - 'ContainerServiceSshConfiguration', - 'ContainerServiceSshPublicKey', - 'ContainerServiceVMDiagnostics', - 'CredentialResult', - 'CredentialResults', - 'ManagedCluster', - 'ManagedClusterAADProfile', - 'ManagedClusterAPIServerAccessProfile', - 'ManagedClusterAccessProfile', - 'ManagedClusterAddonProfile', - 'ManagedClusterAgentPoolProfile', - 'ManagedClusterAgentPoolProfileProperties', - 'ManagedClusterIdentity', - 'ManagedClusterListResult', - 'ManagedClusterLoadBalancerProfile', - 'ManagedClusterLoadBalancerProfileManagedOutboundIPs', - 'ManagedClusterLoadBalancerProfileOutboundIPPrefixes', - 'ManagedClusterLoadBalancerProfileOutboundIPs', - 'ManagedClusterPoolUpgradeProfile', - 'ManagedClusterPoolUpgradeProfileUpgradesItem', - 'ManagedClusterServicePrincipalProfile', - 'ManagedClusterUpgradeProfile', - 'ManagedClusterWindowsProfile', - 'OperationListResult', - 'OperationValue', - 'Resource', - 'ResourceReference', - 'SubResource', - 'TagsObject', - 'AgentPoolType', - 'ContainerServiceStorageProfileTypes', - 'ContainerServiceVMSizeTypes', - 'Count', - 'LoadBalancerSku', - 'NetworkPlugin', - 'NetworkPolicy', - 'OSType', - 'ResourceIdentityType', - 'ScaleSetEvictionPolicy', - 'ScaleSetPriority', + "AgentPool", + "AgentPoolAvailableVersions", + "AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem", + "AgentPoolListResult", + "AgentPoolUpgradeProfile", + "AgentPoolUpgradeProfilePropertiesUpgradesItem", + "CloudErrorBody", + "ContainerServiceDiagnosticsProfile", + "ContainerServiceLinuxProfile", + "ContainerServiceMasterProfile", + "ContainerServiceNetworkProfile", + "ContainerServiceSshConfiguration", + "ContainerServiceSshPublicKey", + "ContainerServiceVMDiagnostics", + "CredentialResult", + "CredentialResults", + "ManagedCluster", + "ManagedClusterAADProfile", + "ManagedClusterAPIServerAccessProfile", + "ManagedClusterAccessProfile", + "ManagedClusterAddonProfile", + "ManagedClusterAgentPoolProfile", + "ManagedClusterAgentPoolProfileProperties", + "ManagedClusterIdentity", + "ManagedClusterListResult", + "ManagedClusterLoadBalancerProfile", + "ManagedClusterLoadBalancerProfileManagedOutboundIPs", + "ManagedClusterLoadBalancerProfileOutboundIPPrefixes", + "ManagedClusterLoadBalancerProfileOutboundIPs", + "ManagedClusterPoolUpgradeProfile", + "ManagedClusterPoolUpgradeProfileUpgradesItem", + "ManagedClusterServicePrincipalProfile", + "ManagedClusterUpgradeProfile", + "ManagedClusterWindowsProfile", + "OperationListResult", + "OperationValue", + "Resource", + "ResourceReference", + "SubResource", + "TagsObject", + "AgentPoolType", + "ContainerServiceStorageProfileTypes", + "ContainerServiceVMSizeTypes", + "Count", + "LoadBalancerSku", + "NetworkPlugin", + "NetworkPolicy", + "OSType", + "ResourceIdentityType", + "ScaleSetEvictionPolicy", + "ScaleSetPriority", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/models/_container_service_client_enums.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/models/_container_service_client_enums.py index f2a8ca90fcb1..955905f1536f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/models/_container_service_client_enums.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/models/_container_service_client_enums.py @@ -18,6 +18,7 @@ class AgentPoolType(str, Enum, metaclass=CaseInsensitiveEnumMeta): VIRTUAL_MACHINE_SCALE_SETS = "VirtualMachineScaleSets" AVAILABILITY_SET = "AvailabilitySet" + class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the orchestrator choice. @@ -26,9 +27,9 @@ class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEn STORAGE_ACCOUNT = "StorageAccount" MANAGED_DISKS = "ManagedDisks" + class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Size of agent VMs. - """ + """Size of agent VMs.""" STANDARD_A1 = "Standard_A1" STANDARD_A10 = "Standard_A10" @@ -205,6 +206,7 @@ class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): STANDARD_NV24 = "Standard_NV24" STANDARD_NV6 = "Standard_NV6" + class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): """Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, and 5. The default value is 1. @@ -214,34 +216,35 @@ class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): THREE = 3 FIVE = 5 + class LoadBalancerSku(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The load balancer sku for the managed cluster. - """ + """The load balancer sku for the managed cluster.""" STANDARD = "standard" BASIC = "basic" + class NetworkPlugin(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Network plugin used for building Kubernetes network. - """ + """Network plugin used for building Kubernetes network.""" AZURE = "azure" KUBENET = "kubenet" + class NetworkPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Network policy used for building Kubernetes network. - """ + """Network policy used for building Kubernetes network.""" CALICO = "calico" AZURE = "azure" + class OSType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """OsType to be used to specify os type. Choose from Linux and Windows. Default to Linux. - """ + """OsType to be used to specify os type. Choose from Linux and Windows. Default to Linux.""" LINUX = "Linux" WINDOWS = "Windows" + class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of identity used for the managed cluster. Type 'SystemAssigned' will use an implicitly created identity in master components and an auto-created user assigned identity in MC_ @@ -252,6 +255,7 @@ class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): SYSTEM_ASSIGNED = "SystemAssigned" NONE = "None" + class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ScaleSetEvictionPolicy to be used to specify eviction policy for low priority virtual machine scale set. Default to Delete. @@ -260,9 +264,9 @@ class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): DELETE = "Delete" DEALLOCATE = "Deallocate" + class ScaleSetPriority(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """ScaleSetPriority to be used to specify virtual machine scale set priority. Default to regular. - """ + """ScaleSetPriority to be used to specify virtual machine scale set priority. Default to regular.""" LOW = "Low" REGULAR = "Regular" diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/models/_models_py3.py index dffe8c1ee456..ff9959aa2f6f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/models/_models_py3.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/models/_models_py3.py @@ -1,4 +1,5 @@ # coding=utf-8 +# pylint: disable=too-many-lines # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -8,14 +9,14 @@ from typing import Dict, List, Optional, TYPE_CHECKING, Union -import msrest.serialization +from ... import _serialization if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - import __init__ as _models + from .. import models as _models -class SubResource(msrest.serialization.Model): +class SubResource(_serialization.Model): """Reference to another subresource. Variables are only populated by the server, and will be ignored when sending a request. @@ -30,30 +31,26 @@ class SubResource(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(SubResource, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.id = None self.name = None self.type = None -class AgentPool(SubResource): +class AgentPool(SubResource): # pylint: disable=too-many-instance-attributes """Agent Pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -105,7 +102,7 @@ class AgentPool(SubResource): "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :vartype vm_size: str or ~azure.mgmt.containerservice.v2019_08_01.models.ContainerServiceVMSizeTypes :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine @@ -117,7 +114,7 @@ class AgentPool(SubResource): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Known values are: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux" and "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2019_08_01.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -126,7 +123,7 @@ class AgentPool(SubResource): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar type_properties_type: AgentPoolType represents types of an agent pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :vartype type_properties_type: str or ~azure.mgmt.containerservice.v2019_08_01.models.AgentPoolType :ivar orchestrator_version: Version of orchestrator specified when creating the managed @@ -141,12 +138,12 @@ class AgentPool(SubResource): :ivar enable_node_public_ip: Enable public IP for nodes. :vartype enable_node_public_ip: bool :ivar scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Known values are: "Low", "Regular". Default value: "Regular". + priority. Default to regular. Known values are: "Low" and "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2019_08_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy - for low priority virtual machine scale set. Default to Delete. Known values are: "Delete", - "Deallocate". Default value: "Delete". + for low priority virtual machine scale set. Default to Delete. Known values are: "Delete" and + "Deallocate". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2019_08_01.models.ScaleSetEvictionPolicy :ivar node_taints: Taints added to new nodes during node pool create and scale. For example, @@ -155,34 +152,34 @@ class AgentPool(SubResource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'os_disk_size_gb': {'maximum': 1023, 'minimum': 0}, - 'provisioning_state': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "os_disk_size_gb": {"maximum": 1023, "minimum": 0}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'count': {'key': 'properties.count', 'type': 'int'}, - 'vm_size': {'key': 'properties.vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'properties.osDiskSizeGB', 'type': 'int'}, - 'vnet_subnet_id': {'key': 'properties.vnetSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'properties.maxPods', 'type': 'int'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'max_count': {'key': 'properties.maxCount', 'type': 'int'}, - 'min_count': {'key': 'properties.minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'properties.enableAutoScaling', 'type': 'bool'}, - 'type_properties_type': {'key': 'properties.type', 'type': 'str'}, - 'orchestrator_version': {'key': 'properties.orchestratorVersion', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'availability_zones': {'key': 'properties.availabilityZones', 'type': '[str]'}, - 'enable_node_public_ip': {'key': 'properties.enableNodePublicIP', 'type': 'bool'}, - 'scale_set_priority': {'key': 'properties.scaleSetPriority', 'type': 'str'}, - 'scale_set_eviction_policy': {'key': 'properties.scaleSetEvictionPolicy', 'type': 'str'}, - 'node_taints': {'key': 'properties.nodeTaints', 'type': '[str]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "count": {"key": "properties.count", "type": "int"}, + "vm_size": {"key": "properties.vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "properties.osDiskSizeGB", "type": "int"}, + "vnet_subnet_id": {"key": "properties.vnetSubnetID", "type": "str"}, + "max_pods": {"key": "properties.maxPods", "type": "int"}, + "os_type": {"key": "properties.osType", "type": "str"}, + "max_count": {"key": "properties.maxCount", "type": "int"}, + "min_count": {"key": "properties.minCount", "type": "int"}, + "enable_auto_scaling": {"key": "properties.enableAutoScaling", "type": "bool"}, + "type_properties_type": {"key": "properties.type", "type": "str"}, + "orchestrator_version": {"key": "properties.orchestratorVersion", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "availability_zones": {"key": "properties.availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "properties.enableNodePublicIP", "type": "bool"}, + "scale_set_priority": {"key": "properties.scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "properties.scaleSetEvictionPolicy", "type": "str"}, + "node_taints": {"key": "properties.nodeTaints", "type": "[str]"}, } def __init__( @@ -193,7 +190,7 @@ def __init__( os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, @@ -201,8 +198,8 @@ def __init__( orchestrator_version: Optional[str] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, - scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", node_taints: Optional[List[str]] = None, **kwargs ): @@ -247,7 +244,7 @@ def __init__( "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :paramtype vm_size: str or ~azure.mgmt.containerservice.v2019_08_01.models.ContainerServiceVMSizeTypes :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every @@ -259,7 +256,7 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux" and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2019_08_01.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -268,7 +265,7 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword type_properties_type: AgentPoolType represents types of an agent pool. Known values - are: "VirtualMachineScaleSets", "AvailabilitySet". + are: "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type_properties_type: str or ~azure.mgmt.containerservice.v2019_08_01.models.AgentPoolType :keyword orchestrator_version: Version of orchestrator specified when creating the managed @@ -280,19 +277,19 @@ def __init__( :keyword enable_node_public_ip: Enable public IP for nodes. :paramtype enable_node_public_ip: bool :keyword scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Known values are: "Low", "Regular". Default value: "Regular". + priority. Default to regular. Known values are: "Low" and "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2019_08_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy for low priority virtual machine scale set. Default to Delete. Known values are: - "Delete", "Deallocate". Default value: "Delete". + "Delete" and "Deallocate". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2019_08_01.models.ScaleSetEvictionPolicy :keyword node_taints: Taints added to new nodes during node pool create and scale. For example, key=value:NoSchedule. :paramtype node_taints: list[str] """ - super(AgentPool, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.vm_size = vm_size self.os_disk_size_gb = os_disk_size_gb @@ -312,7 +309,7 @@ def __init__( self.node_taints = node_taints -class AgentPoolAvailableVersions(msrest.serialization.Model): +class AgentPoolAvailableVersions(_serialization.Model): """The list of available versions for an agent pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -329,16 +326,19 @@ class AgentPoolAvailableVersions(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'agent_pool_versions': {'key': 'properties.agentPoolVersions', 'type': '[AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "agent_pool_versions": { + "key": "properties.agentPoolVersions", + "type": "[AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem]", + }, } def __init__( @@ -352,14 +352,14 @@ def __init__( :paramtype agent_pool_versions: list[~azure.mgmt.containerservice.v2019_08_01.models.AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem] """ - super(AgentPoolAvailableVersions, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None self.agent_pool_versions = agent_pool_versions -class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(msrest.serialization.Model): +class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(_serialization.Model): """AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem. :ivar default: Whether this version is the default agent pool version. @@ -371,9 +371,9 @@ class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(msrest.serializa """ _attribute_map = { - 'default': {'key': 'default', 'type': 'bool'}, - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "default": {"key": "default", "type": "bool"}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } def __init__( @@ -392,13 +392,13 @@ def __init__( :keyword is_preview: Whether Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.default = default self.kubernetes_version = kubernetes_version self.is_preview = is_preview -class AgentPoolListResult(msrest.serialization.Model): +class AgentPoolListResult(_serialization.Model): """The response from the List Agent Pools operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -410,30 +410,25 @@ class AgentPoolListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[AgentPool]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[AgentPool]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.AgentPool"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.AgentPool"]] = None, **kwargs): """ :keyword value: The list of agent pools. :paramtype value: list[~azure.mgmt.containerservice.v2019_08_01.models.AgentPool] """ - super(AgentPoolListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class AgentPoolUpgradeProfile(msrest.serialization.Model): +class AgentPoolUpgradeProfile(_serialization.Model): """The list of available upgrades for an agent pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -446,10 +441,10 @@ class AgentPoolUpgradeProfile(msrest.serialization.Model): :vartype name: str :ivar type: Type of the agent pool upgrade profile. :vartype type: str - :ivar kubernetes_version: Required. Kubernetes version (major, minor, patch). + :ivar kubernetes_version: Kubernetes version (major, minor, patch). Required. :vartype kubernetes_version: str - :ivar os_type: Required. OsType to be used to specify os type. Choose from Linux and Windows. - Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to + Linux. Known values are: "Linux" and "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2019_08_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -457,20 +452,20 @@ class AgentPoolUpgradeProfile(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kubernetes_version': {'required': True}, - 'os_type': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "kubernetes_version": {"required": True}, + "os_type": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'kubernetes_version': {'key': 'properties.kubernetesVersion', 'type': 'str'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'upgrades': {'key': 'properties.upgrades', 'type': '[AgentPoolUpgradeProfilePropertiesUpgradesItem]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "os_type": {"key": "properties.osType", "type": "str"}, + "upgrades": {"key": "properties.upgrades", "type": "[AgentPoolUpgradeProfilePropertiesUpgradesItem]"}, } def __init__( @@ -482,16 +477,16 @@ def __init__( **kwargs ): """ - :keyword kubernetes_version: Required. Kubernetes version (major, minor, patch). + :keyword kubernetes_version: Kubernetes version (major, minor, patch). Required. :paramtype kubernetes_version: str - :keyword os_type: Required. OsType to be used to specify os type. Choose from Linux and - Windows. Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default + to Linux. Known values are: "Linux" and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2019_08_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: list[~azure.mgmt.containerservice.v2019_08_01.models.AgentPoolUpgradeProfilePropertiesUpgradesItem] """ - super(AgentPoolUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -500,7 +495,7 @@ def __init__( self.upgrades = upgrades -class AgentPoolUpgradeProfilePropertiesUpgradesItem(msrest.serialization.Model): +class AgentPoolUpgradeProfilePropertiesUpgradesItem(_serialization.Model): """AgentPoolUpgradeProfilePropertiesUpgradesItem. :ivar kubernetes_version: Kubernetes version (major, minor, patch). @@ -510,29 +505,23 @@ class AgentPoolUpgradeProfilePropertiesUpgradesItem(msrest.serialization.Model): """ _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } - def __init__( - self, - *, - kubernetes_version: Optional[str] = None, - is_preview: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, kubernetes_version: Optional[str] = None, is_preview: Optional[bool] = None, **kwargs): """ :keyword kubernetes_version: Kubernetes version (major, minor, patch). :paramtype kubernetes_version: str :keyword is_preview: Whether Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(AgentPoolUpgradeProfilePropertiesUpgradesItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.is_preview = is_preview -class CloudErrorBody(msrest.serialization.Model): +class CloudErrorBody(_serialization.Model): """An error response from the Container service. :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed @@ -549,10 +538,10 @@ class CloudErrorBody(msrest.serialization.Model): """ _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[CloudErrorBody]"}, } def __init__( @@ -577,87 +566,76 @@ def __init__( :keyword details: A list of additional details about the error. :paramtype details: list[~azure.mgmt.containerservice.v2019_08_01.models.CloudErrorBody] """ - super(CloudErrorBody, self).__init__(**kwargs) + super().__init__(**kwargs) self.code = code self.message = message self.target = target self.details = details -class ContainerServiceDiagnosticsProfile(msrest.serialization.Model): +class ContainerServiceDiagnosticsProfile(_serialization.Model): """Profile for diagnostics on the container service cluster. All required parameters must be populated in order to send to Azure. - :ivar vm_diagnostics: Required. Profile for diagnostics on the container service VMs. + :ivar vm_diagnostics: Profile for diagnostics on the container service VMs. Required. :vartype vm_diagnostics: ~azure.mgmt.containerservice.v2019_08_01.models.ContainerServiceVMDiagnostics """ _validation = { - 'vm_diagnostics': {'required': True}, + "vm_diagnostics": {"required": True}, } _attribute_map = { - 'vm_diagnostics': {'key': 'vmDiagnostics', 'type': 'ContainerServiceVMDiagnostics'}, + "vm_diagnostics": {"key": "vmDiagnostics", "type": "ContainerServiceVMDiagnostics"}, } - def __init__( - self, - *, - vm_diagnostics: "_models.ContainerServiceVMDiagnostics", - **kwargs - ): + def __init__(self, *, vm_diagnostics: "_models.ContainerServiceVMDiagnostics", **kwargs): """ - :keyword vm_diagnostics: Required. Profile for diagnostics on the container service VMs. + :keyword vm_diagnostics: Profile for diagnostics on the container service VMs. Required. :paramtype vm_diagnostics: ~azure.mgmt.containerservice.v2019_08_01.models.ContainerServiceVMDiagnostics """ - super(ContainerServiceDiagnosticsProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.vm_diagnostics = vm_diagnostics -class ContainerServiceLinuxProfile(msrest.serialization.Model): +class ContainerServiceLinuxProfile(_serialization.Model): """Profile for Linux VMs in the container service cluster. All required parameters must be populated in order to send to Azure. - :ivar admin_username: Required. The administrator username to use for Linux VMs. + :ivar admin_username: The administrator username to use for Linux VMs. Required. :vartype admin_username: str - :ivar ssh: Required. SSH configuration for Linux-based VMs running on Azure. + :ivar ssh: SSH configuration for Linux-based VMs running on Azure. Required. :vartype ssh: ~azure.mgmt.containerservice.v2019_08_01.models.ContainerServiceSshConfiguration """ _validation = { - 'admin_username': {'required': True, 'pattern': r'^[A-Za-z][-A-Za-z0-9_]*$'}, - 'ssh': {'required': True}, + "admin_username": {"required": True, "pattern": r"^[A-Za-z][-A-Za-z0-9_]*$"}, + "ssh": {"required": True}, } _attribute_map = { - 'admin_username': {'key': 'adminUsername', 'type': 'str'}, - 'ssh': {'key': 'ssh', 'type': 'ContainerServiceSshConfiguration'}, + "admin_username": {"key": "adminUsername", "type": "str"}, + "ssh": {"key": "ssh", "type": "ContainerServiceSshConfiguration"}, } - def __init__( - self, - *, - admin_username: str, - ssh: "_models.ContainerServiceSshConfiguration", - **kwargs - ): + def __init__(self, *, admin_username: str, ssh: "_models.ContainerServiceSshConfiguration", **kwargs): """ - :keyword admin_username: Required. The administrator username to use for Linux VMs. + :keyword admin_username: The administrator username to use for Linux VMs. Required. :paramtype admin_username: str - :keyword ssh: Required. SSH configuration for Linux-based VMs running on Azure. + :keyword ssh: SSH configuration for Linux-based VMs running on Azure. Required. :paramtype ssh: ~azure.mgmt.containerservice.v2019_08_01.models.ContainerServiceSshConfiguration """ - super(ContainerServiceLinuxProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.admin_username = admin_username self.ssh = ssh -class ContainerServiceMasterProfile(msrest.serialization.Model): +class ContainerServiceMasterProfile(_serialization.Model): """Profile for the container service master. Variables are only populated by the server, and will be ignored when sending a request. @@ -665,11 +643,11 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar count: Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, - and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". + and 5. The default value is 1. Known values are: 1, 3, and 5. :vartype count: int or ~azure.mgmt.containerservice.v2019_08_01.models.Count - :ivar dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. + :ivar dns_prefix: DNS prefix to be used to create the FQDN for the master pool. Required. :vartype dns_prefix: str - :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + :ivar vm_size: Size of agent VMs. Required. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -706,7 +684,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :vartype vm_size: str or ~azure.mgmt.containerservice.v2019_08_01.models.ContainerServiceVMSizeTypes :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine @@ -720,7 +698,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): :vartype first_consecutive_static_ip: str :ivar storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount" and "ManagedDisks". :vartype storage_profile: str or ~azure.mgmt.containerservice.v2019_08_01.models.ContainerServiceStorageProfileTypes :ivar fqdn: FQDN for the master pool. @@ -728,21 +706,21 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): """ _validation = { - 'dns_prefix': {'required': True}, - 'vm_size': {'required': True}, - 'os_disk_size_gb': {'maximum': 1023, 'minimum': 0}, - 'fqdn': {'readonly': True}, + "dns_prefix": {"required": True}, + "vm_size": {"required": True}, + "os_disk_size_gb": {"maximum": 1023, "minimum": 0}, + "fqdn": {"readonly": True}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'dns_prefix': {'key': 'dnsPrefix', 'type': 'str'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'first_consecutive_static_ip': {'key': 'firstConsecutiveStaticIP', 'type': 'str'}, - 'storage_profile': {'key': 'storageProfile', 'type': 'str'}, - 'fqdn': {'key': 'fqdn', 'type': 'str'}, + "count": {"key": "count", "type": "int"}, + "dns_prefix": {"key": "dnsPrefix", "type": "str"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "first_consecutive_static_ip": {"key": "firstConsecutiveStaticIP", "type": "str"}, + "storage_profile": {"key": "storageProfile", "type": "str"}, + "fqdn": {"key": "fqdn", "type": "str"}, } def __init__( @@ -750,20 +728,20 @@ def __init__( *, dns_prefix: str, vm_size: Union[str, "_models.ContainerServiceVMSizeTypes"], - count: Optional[Union[int, "_models.Count"]] = 1, + count: Union[int, "_models.Count"] = 1, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, - first_consecutive_static_ip: Optional[str] = "10.240.255.5", + first_consecutive_static_ip: str = "10.240.255.5", storage_profile: Optional[Union[str, "_models.ContainerServiceStorageProfileTypes"]] = None, **kwargs ): """ :keyword count: Number of masters (VMs) in the container service cluster. Allowed values are 1, - 3, and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". + 3, and 5. The default value is 1. Known values are: 1, 3, and 5. :paramtype count: int or ~azure.mgmt.containerservice.v2019_08_01.models.Count - :keyword dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. + :keyword dns_prefix: DNS prefix to be used to create the FQDN for the master pool. Required. :paramtype dns_prefix: str - :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + :keyword vm_size: Size of agent VMs. Required. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -800,7 +778,7 @@ def __init__( "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :paramtype vm_size: str or ~azure.mgmt.containerservice.v2019_08_01.models.ContainerServiceVMSizeTypes :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every @@ -814,11 +792,11 @@ def __init__( :paramtype first_consecutive_static_ip: str :keyword storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount" and "ManagedDisks". :paramtype storage_profile: str or ~azure.mgmt.containerservice.v2019_08_01.models.ContainerServiceStorageProfileTypes """ - super(ContainerServiceMasterProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.dns_prefix = dns_prefix self.vm_size = vm_size @@ -829,14 +807,14 @@ def __init__( self.fqdn = None -class ContainerServiceNetworkProfile(msrest.serialization.Model): +class ContainerServiceNetworkProfile(_serialization.Model): """Profile of network configuration. :ivar network_plugin: Network plugin used for building Kubernetes network. Known values are: - "azure", "kubenet". Default value: "kubenet". + "azure" and "kubenet". :vartype network_plugin: str or ~azure.mgmt.containerservice.v2019_08_01.models.NetworkPlugin :ivar network_policy: Network policy used for building Kubernetes network. Known values are: - "calico", "azure". + "calico" and "azure". :vartype network_policy: str or ~azure.mgmt.containerservice.v2019_08_01.models.NetworkPolicy :ivar pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :vartype pod_cidr: str @@ -850,7 +828,7 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): must not overlap with any Subnet IP ranges or the Kubernetes service address range. :vartype docker_bridge_cidr: str :ivar load_balancer_sku: The load balancer sku for the managed cluster. Known values are: - "standard", "basic". + "standard" and "basic". :vartype load_balancer_sku: str or ~azure.mgmt.containerservice.v2019_08_01.models.LoadBalancerSku :ivar load_balancer_profile: Profile of the cluster load balancer. @@ -859,42 +837,44 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): """ _validation = { - 'pod_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, - 'service_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, - 'dns_service_ip': {'pattern': r'^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$'}, - 'docker_bridge_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, + "pod_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, + "service_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, + "dns_service_ip": { + "pattern": r"^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$" + }, + "docker_bridge_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, } _attribute_map = { - 'network_plugin': {'key': 'networkPlugin', 'type': 'str'}, - 'network_policy': {'key': 'networkPolicy', 'type': 'str'}, - 'pod_cidr': {'key': 'podCidr', 'type': 'str'}, - 'service_cidr': {'key': 'serviceCidr', 'type': 'str'}, - 'dns_service_ip': {'key': 'dnsServiceIP', 'type': 'str'}, - 'docker_bridge_cidr': {'key': 'dockerBridgeCidr', 'type': 'str'}, - 'load_balancer_sku': {'key': 'loadBalancerSku', 'type': 'str'}, - 'load_balancer_profile': {'key': 'loadBalancerProfile', 'type': 'ManagedClusterLoadBalancerProfile'}, + "network_plugin": {"key": "networkPlugin", "type": "str"}, + "network_policy": {"key": "networkPolicy", "type": "str"}, + "pod_cidr": {"key": "podCidr", "type": "str"}, + "service_cidr": {"key": "serviceCidr", "type": "str"}, + "dns_service_ip": {"key": "dnsServiceIP", "type": "str"}, + "docker_bridge_cidr": {"key": "dockerBridgeCidr", "type": "str"}, + "load_balancer_sku": {"key": "loadBalancerSku", "type": "str"}, + "load_balancer_profile": {"key": "loadBalancerProfile", "type": "ManagedClusterLoadBalancerProfile"}, } def __init__( self, *, - network_plugin: Optional[Union[str, "_models.NetworkPlugin"]] = "kubenet", + network_plugin: Union[str, "_models.NetworkPlugin"] = "kubenet", network_policy: Optional[Union[str, "_models.NetworkPolicy"]] = None, - pod_cidr: Optional[str] = "10.244.0.0/16", - service_cidr: Optional[str] = "10.0.0.0/16", - dns_service_ip: Optional[str] = "10.0.0.10", - docker_bridge_cidr: Optional[str] = "172.17.0.1/16", + pod_cidr: str = "10.244.0.0/16", + service_cidr: str = "10.0.0.0/16", + dns_service_ip: str = "10.0.0.10", + docker_bridge_cidr: str = "172.17.0.1/16", load_balancer_sku: Optional[Union[str, "_models.LoadBalancerSku"]] = None, load_balancer_profile: Optional["_models.ManagedClusterLoadBalancerProfile"] = None, **kwargs ): """ :keyword network_plugin: Network plugin used for building Kubernetes network. Known values are: - "azure", "kubenet". Default value: "kubenet". + "azure" and "kubenet". :paramtype network_plugin: str or ~azure.mgmt.containerservice.v2019_08_01.models.NetworkPlugin :keyword network_policy: Network policy used for building Kubernetes network. Known values are: - "calico", "azure". + "calico" and "azure". :paramtype network_policy: str or ~azure.mgmt.containerservice.v2019_08_01.models.NetworkPolicy :keyword pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :paramtype pod_cidr: str @@ -908,14 +888,14 @@ def __init__( must not overlap with any Subnet IP ranges or the Kubernetes service address range. :paramtype docker_bridge_cidr: str :keyword load_balancer_sku: The load balancer sku for the managed cluster. Known values are: - "standard", "basic". + "standard" and "basic". :paramtype load_balancer_sku: str or ~azure.mgmt.containerservice.v2019_08_01.models.LoadBalancerSku :keyword load_balancer_profile: Profile of the cluster load balancer. :paramtype load_balancer_profile: ~azure.mgmt.containerservice.v2019_08_01.models.ManagedClusterLoadBalancerProfile """ - super(ContainerServiceNetworkProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.network_plugin = network_plugin self.network_policy = network_policy self.pod_cidr = pod_cidr @@ -926,113 +906,98 @@ def __init__( self.load_balancer_profile = load_balancer_profile -class ContainerServiceSshConfiguration(msrest.serialization.Model): +class ContainerServiceSshConfiguration(_serialization.Model): """SSH configuration for Linux-based VMs running on Azure. All required parameters must be populated in order to send to Azure. - :ivar public_keys: Required. The list of SSH public keys used to authenticate with Linux-based - VMs. Only expect one key specified. + :ivar public_keys: The list of SSH public keys used to authenticate with Linux-based VMs. Only + expect one key specified. Required. :vartype public_keys: list[~azure.mgmt.containerservice.v2019_08_01.models.ContainerServiceSshPublicKey] """ _validation = { - 'public_keys': {'required': True}, + "public_keys": {"required": True}, } _attribute_map = { - 'public_keys': {'key': 'publicKeys', 'type': '[ContainerServiceSshPublicKey]'}, + "public_keys": {"key": "publicKeys", "type": "[ContainerServiceSshPublicKey]"}, } - def __init__( - self, - *, - public_keys: List["_models.ContainerServiceSshPublicKey"], - **kwargs - ): + def __init__(self, *, public_keys: List["_models.ContainerServiceSshPublicKey"], **kwargs): """ - :keyword public_keys: Required. The list of SSH public keys used to authenticate with - Linux-based VMs. Only expect one key specified. + :keyword public_keys: The list of SSH public keys used to authenticate with Linux-based VMs. + Only expect one key specified. Required. :paramtype public_keys: list[~azure.mgmt.containerservice.v2019_08_01.models.ContainerServiceSshPublicKey] """ - super(ContainerServiceSshConfiguration, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_keys = public_keys -class ContainerServiceSshPublicKey(msrest.serialization.Model): +class ContainerServiceSshPublicKey(_serialization.Model): """Contains information about SSH certificate public key data. All required parameters must be populated in order to send to Azure. - :ivar key_data: Required. Certificate public key used to authenticate with VMs through SSH. The - certificate must be in PEM format with or without headers. + :ivar key_data: Certificate public key used to authenticate with VMs through SSH. The + certificate must be in PEM format with or without headers. Required. :vartype key_data: str """ _validation = { - 'key_data': {'required': True}, + "key_data": {"required": True}, } _attribute_map = { - 'key_data': {'key': 'keyData', 'type': 'str'}, + "key_data": {"key": "keyData", "type": "str"}, } - def __init__( - self, - *, - key_data: str, - **kwargs - ): + def __init__(self, *, key_data: str, **kwargs): """ - :keyword key_data: Required. Certificate public key used to authenticate with VMs through SSH. - The certificate must be in PEM format with or without headers. + :keyword key_data: Certificate public key used to authenticate with VMs through SSH. The + certificate must be in PEM format with or without headers. Required. :paramtype key_data: str """ - super(ContainerServiceSshPublicKey, self).__init__(**kwargs) + super().__init__(**kwargs) self.key_data = key_data -class ContainerServiceVMDiagnostics(msrest.serialization.Model): +class ContainerServiceVMDiagnostics(_serialization.Model): """Profile for diagnostics on the container service VMs. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar enabled: Required. Whether the VM diagnostic agent is provisioned on the VM. + :ivar enabled: Whether the VM diagnostic agent is provisioned on the VM. Required. :vartype enabled: bool :ivar storage_uri: The URI of the storage account where diagnostics are stored. :vartype storage_uri: str """ _validation = { - 'enabled': {'required': True}, - 'storage_uri': {'readonly': True}, + "enabled": {"required": True}, + "storage_uri": {"readonly": True}, } _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'storage_uri': {'key': 'storageUri', 'type': 'str'}, + "enabled": {"key": "enabled", "type": "bool"}, + "storage_uri": {"key": "storageUri", "type": "str"}, } - def __init__( - self, - *, - enabled: bool, - **kwargs - ): + def __init__(self, *, enabled: bool, **kwargs): """ - :keyword enabled: Required. Whether the VM diagnostic agent is provisioned on the VM. + :keyword enabled: Whether the VM diagnostic agent is provisioned on the VM. Required. :paramtype enabled: bool """ - super(ContainerServiceVMDiagnostics, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.storage_uri = None -class CredentialResult(msrest.serialization.Model): +class CredentialResult(_serialization.Model): """The credential result response. Variables are only populated by the server, and will be ignored when sending a request. @@ -1040,31 +1005,27 @@ class CredentialResult(msrest.serialization.Model): :ivar name: The name of the credential. :vartype name: str :ivar value: Base64-encoded Kubernetes configuration file. - :vartype value: bytearray + :vartype value: bytes """ _validation = { - 'name': {'readonly': True}, - 'value': {'readonly': True}, + "name": {"readonly": True}, + "value": {"readonly": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'bytearray'}, + "name": {"key": "name", "type": "str"}, + "value": {"key": "value", "type": "bytearray"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(CredentialResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.name = None self.value = None -class CredentialResults(msrest.serialization.Model): +class CredentialResults(_serialization.Model): """The list of credential result response. Variables are only populated by the server, and will be ignored when sending a request. @@ -1074,24 +1035,20 @@ class CredentialResults(msrest.serialization.Model): """ _validation = { - 'kubeconfigs': {'readonly': True}, + "kubeconfigs": {"readonly": True}, } _attribute_map = { - 'kubeconfigs': {'key': 'kubeconfigs', 'type': '[CredentialResult]'}, + "kubeconfigs": {"key": "kubeconfigs", "type": "[CredentialResult]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(CredentialResults, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.kubeconfigs = None -class Resource(msrest.serialization.Model): +class Resource(_serialization.Model): """The Resource model definition. Variables are only populated by the server, and will be ignored when sending a request. @@ -1104,41 +1061,35 @@ class Resource(msrest.serialization.Model): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] """ - super(Resource, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -1146,7 +1097,7 @@ def __init__( self.tags = tags -class ManagedCluster(Resource): +class ManagedCluster(Resource): # pylint: disable=too-many-instance-attributes """Managed cluster. Variables are only populated by the server, and will be ignored when sending a request. @@ -1159,9 +1110,9 @@ class ManagedCluster(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar identity: The identity of the managed cluster, if configured. :vartype identity: ~azure.mgmt.containerservice.v2019_08_01.models.ManagedClusterIdentity @@ -1211,38 +1162,44 @@ class ManagedCluster(Resource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'provisioning_state': {'readonly': True}, - 'max_agent_pools': {'readonly': True}, - 'fqdn': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, + "provisioning_state": {"readonly": True}, + "max_agent_pools": {"readonly": True}, + "fqdn": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'ManagedClusterIdentity'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'max_agent_pools': {'key': 'properties.maxAgentPools', 'type': 'int'}, - 'kubernetes_version': {'key': 'properties.kubernetesVersion', 'type': 'str'}, - 'dns_prefix': {'key': 'properties.dnsPrefix', 'type': 'str'}, - 'fqdn': {'key': 'properties.fqdn', 'type': 'str'}, - 'agent_pool_profiles': {'key': 'properties.agentPoolProfiles', 'type': '[ManagedClusterAgentPoolProfile]'}, - 'linux_profile': {'key': 'properties.linuxProfile', 'type': 'ContainerServiceLinuxProfile'}, - 'windows_profile': {'key': 'properties.windowsProfile', 'type': 'ManagedClusterWindowsProfile'}, - 'service_principal_profile': {'key': 'properties.servicePrincipalProfile', 'type': 'ManagedClusterServicePrincipalProfile'}, - 'addon_profiles': {'key': 'properties.addonProfiles', 'type': '{ManagedClusterAddonProfile}'}, - 'node_resource_group': {'key': 'properties.nodeResourceGroup', 'type': 'str'}, - 'enable_rbac': {'key': 'properties.enableRBAC', 'type': 'bool'}, - 'enable_pod_security_policy': {'key': 'properties.enablePodSecurityPolicy', 'type': 'bool'}, - 'network_profile': {'key': 'properties.networkProfile', 'type': 'ContainerServiceNetworkProfile'}, - 'aad_profile': {'key': 'properties.aadProfile', 'type': 'ManagedClusterAADProfile'}, - 'api_server_access_profile': {'key': 'properties.apiServerAccessProfile', 'type': 'ManagedClusterAPIServerAccessProfile'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "identity": {"key": "identity", "type": "ManagedClusterIdentity"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "max_agent_pools": {"key": "properties.maxAgentPools", "type": "int"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "dns_prefix": {"key": "properties.dnsPrefix", "type": "str"}, + "fqdn": {"key": "properties.fqdn", "type": "str"}, + "agent_pool_profiles": {"key": "properties.agentPoolProfiles", "type": "[ManagedClusterAgentPoolProfile]"}, + "linux_profile": {"key": "properties.linuxProfile", "type": "ContainerServiceLinuxProfile"}, + "windows_profile": {"key": "properties.windowsProfile", "type": "ManagedClusterWindowsProfile"}, + "service_principal_profile": { + "key": "properties.servicePrincipalProfile", + "type": "ManagedClusterServicePrincipalProfile", + }, + "addon_profiles": {"key": "properties.addonProfiles", "type": "{ManagedClusterAddonProfile}"}, + "node_resource_group": {"key": "properties.nodeResourceGroup", "type": "str"}, + "enable_rbac": {"key": "properties.enableRBAC", "type": "bool"}, + "enable_pod_security_policy": {"key": "properties.enablePodSecurityPolicy", "type": "bool"}, + "network_profile": {"key": "properties.networkProfile", "type": "ContainerServiceNetworkProfile"}, + "aad_profile": {"key": "properties.aadProfile", "type": "ManagedClusterAADProfile"}, + "api_server_access_profile": { + "key": "properties.apiServerAccessProfile", + "type": "ManagedClusterAPIServerAccessProfile", + }, } def __init__( @@ -1267,9 +1224,9 @@ def __init__( **kwargs ): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword identity: The identity of the managed cluster, if configured. :paramtype identity: ~azure.mgmt.containerservice.v2019_08_01.models.ManagedClusterIdentity @@ -1311,7 +1268,7 @@ def __init__( :paramtype api_server_access_profile: ~azure.mgmt.containerservice.v2019_08_01.models.ManagedClusterAPIServerAccessProfile """ - super(ManagedCluster, self).__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.identity = identity self.provisioning_state = None self.max_agent_pools = None @@ -1331,14 +1288,14 @@ def __init__( self.api_server_access_profile = api_server_access_profile -class ManagedClusterAADProfile(msrest.serialization.Model): +class ManagedClusterAADProfile(_serialization.Model): """AADProfile specifies attributes for Azure Active Directory integration. All required parameters must be populated in order to send to Azure. - :ivar client_app_id: Required. The client AAD application ID. + :ivar client_app_id: The client AAD application ID. Required. :vartype client_app_id: str - :ivar server_app_id: Required. The server AAD application ID. + :ivar server_app_id: The server AAD application ID. Required. :vartype server_app_id: str :ivar server_app_secret: The server AAD application secret. :vartype server_app_secret: str @@ -1348,15 +1305,15 @@ class ManagedClusterAADProfile(msrest.serialization.Model): """ _validation = { - 'client_app_id': {'required': True}, - 'server_app_id': {'required': True}, + "client_app_id": {"required": True}, + "server_app_id": {"required": True}, } _attribute_map = { - 'client_app_id': {'key': 'clientAppID', 'type': 'str'}, - 'server_app_id': {'key': 'serverAppID', 'type': 'str'}, - 'server_app_secret': {'key': 'serverAppSecret', 'type': 'str'}, - 'tenant_id': {'key': 'tenantID', 'type': 'str'}, + "client_app_id": {"key": "clientAppID", "type": "str"}, + "server_app_id": {"key": "serverAppID", "type": "str"}, + "server_app_secret": {"key": "serverAppSecret", "type": "str"}, + "tenant_id": {"key": "tenantID", "type": "str"}, } def __init__( @@ -1369,9 +1326,9 @@ def __init__( **kwargs ): """ - :keyword client_app_id: Required. The client AAD application ID. + :keyword client_app_id: The client AAD application ID. Required. :paramtype client_app_id: str - :keyword server_app_id: Required. The server AAD application ID. + :keyword server_app_id: The server AAD application ID. Required. :paramtype server_app_id: str :keyword server_app_secret: The server AAD application secret. :paramtype server_app_secret: str @@ -1379,7 +1336,7 @@ def __init__( tenant of the deployment subscription. :paramtype tenant_id: str """ - super(ManagedClusterAADProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.client_app_id = client_app_id self.server_app_id = server_app_id self.server_app_secret = server_app_secret @@ -1399,89 +1356,78 @@ class ManagedClusterAccessProfile(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar kube_config: Base64-encoded Kubernetes configuration file. - :vartype kube_config: bytearray + :vartype kube_config: bytes """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'kube_config': {'key': 'properties.kubeConfig', 'type': 'bytearray'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "kube_config": {"key": "properties.kubeConfig", "type": "bytearray"}, } def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - kube_config: Optional[bytearray] = None, - **kwargs + self, *, location: str, tags: Optional[Dict[str, str]] = None, kube_config: Optional[bytes] = None, **kwargs ): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword kube_config: Base64-encoded Kubernetes configuration file. - :paramtype kube_config: bytearray + :paramtype kube_config: bytes """ - super(ManagedClusterAccessProfile, self).__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.kube_config = kube_config -class ManagedClusterAddonProfile(msrest.serialization.Model): +class ManagedClusterAddonProfile(_serialization.Model): """A Kubernetes add-on profile for a managed cluster. All required parameters must be populated in order to send to Azure. - :ivar enabled: Required. Whether the add-on is enabled or not. + :ivar enabled: Whether the add-on is enabled or not. Required. :vartype enabled: bool :ivar config: Key-value pairs for configuring an add-on. :vartype config: dict[str, str] """ _validation = { - 'enabled': {'required': True}, + "enabled": {"required": True}, } _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'config': {'key': 'config', 'type': '{str}'}, + "enabled": {"key": "enabled", "type": "bool"}, + "config": {"key": "config", "type": "{str}"}, } - def __init__( - self, - *, - enabled: bool, - config: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, enabled: bool, config: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword enabled: Required. Whether the add-on is enabled or not. + :keyword enabled: Whether the add-on is enabled or not. Required. :paramtype enabled: bool :keyword config: Key-value pairs for configuring an add-on. :paramtype config: dict[str, str] """ - super(ManagedClusterAddonProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.config = config -class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): +class ManagedClusterAgentPoolProfileProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes """Properties for the container service agent pool profile. Variables are only populated by the server, and will be ignored when sending a request. @@ -1526,7 +1472,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :vartype vm_size: str or ~azure.mgmt.containerservice.v2019_08_01.models.ContainerServiceVMSizeTypes :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine @@ -1538,7 +1484,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Known values are: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux" and "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2019_08_01.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -1547,7 +1493,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar type: AgentPoolType represents types of an agent pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2019_08_01.models.AgentPoolType :ivar orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -1561,12 +1507,12 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar enable_node_public_ip: Enable public IP for nodes. :vartype enable_node_public_ip: bool :ivar scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Known values are: "Low", "Regular". Default value: "Regular". + priority. Default to regular. Known values are: "Low" and "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2019_08_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy - for low priority virtual machine scale set. Default to Delete. Known values are: "Delete", - "Deallocate". Default value: "Delete". + for low priority virtual machine scale set. Default to Delete. Known values are: "Delete" and + "Deallocate". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2019_08_01.models.ScaleSetEvictionPolicy :ivar node_taints: Taints added to new nodes during node pool create and scale. For example, @@ -1575,28 +1521,28 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): """ _validation = { - 'os_disk_size_gb': {'maximum': 1023, 'minimum': 0}, - 'provisioning_state': {'readonly': True}, + "os_disk_size_gb": {"maximum": 1023, "minimum": 0}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'maxPods', 'type': 'int'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'max_count': {'key': 'maxCount', 'type': 'int'}, - 'min_count': {'key': 'minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'enableAutoScaling', 'type': 'bool'}, - 'type': {'key': 'type', 'type': 'str'}, - 'orchestrator_version': {'key': 'orchestratorVersion', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'availability_zones': {'key': 'availabilityZones', 'type': '[str]'}, - 'enable_node_public_ip': {'key': 'enableNodePublicIP', 'type': 'bool'}, - 'scale_set_priority': {'key': 'scaleSetPriority', 'type': 'str'}, - 'scale_set_eviction_policy': {'key': 'scaleSetEvictionPolicy', 'type': 'str'}, - 'node_taints': {'key': 'nodeTaints', 'type': '[str]'}, + "count": {"key": "count", "type": "int"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "max_pods": {"key": "maxPods", "type": "int"}, + "os_type": {"key": "osType", "type": "str"}, + "max_count": {"key": "maxCount", "type": "int"}, + "min_count": {"key": "minCount", "type": "int"}, + "enable_auto_scaling": {"key": "enableAutoScaling", "type": "bool"}, + "type": {"key": "type", "type": "str"}, + "orchestrator_version": {"key": "orchestratorVersion", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "availability_zones": {"key": "availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "enableNodePublicIP", "type": "bool"}, + "scale_set_priority": {"key": "scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "scaleSetEvictionPolicy", "type": "str"}, + "node_taints": {"key": "nodeTaints", "type": "[str]"}, } def __init__( @@ -1607,7 +1553,7 @@ def __init__( os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, @@ -1615,8 +1561,8 @@ def __init__( orchestrator_version: Optional[str] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, - scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", node_taints: Optional[List[str]] = None, **kwargs ): @@ -1661,7 +1607,7 @@ def __init__( "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :paramtype vm_size: str or ~azure.mgmt.containerservice.v2019_08_01.models.ContainerServiceVMSizeTypes :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every @@ -1673,7 +1619,7 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux" and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2019_08_01.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -1682,7 +1628,7 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword type: AgentPoolType represents types of an agent pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2019_08_01.models.AgentPoolType :keyword orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -1693,19 +1639,19 @@ def __init__( :keyword enable_node_public_ip: Enable public IP for nodes. :paramtype enable_node_public_ip: bool :keyword scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Known values are: "Low", "Regular". Default value: "Regular". + priority. Default to regular. Known values are: "Low" and "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2019_08_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy for low priority virtual machine scale set. Default to Delete. Known values are: - "Delete", "Deallocate". Default value: "Delete". + "Delete" and "Deallocate". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2019_08_01.models.ScaleSetEvictionPolicy :keyword node_taints: Taints added to new nodes during node pool create and scale. For example, key=value:NoSchedule. :paramtype node_taints: list[str] """ - super(ManagedClusterAgentPoolProfileProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.vm_size = vm_size self.os_disk_size_gb = os_disk_size_gb @@ -1725,7 +1671,9 @@ def __init__( self.node_taints = node_taints -class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): +class ManagedClusterAgentPoolProfile( + ManagedClusterAgentPoolProfileProperties +): # pylint: disable=too-many-instance-attributes """Profile for the container service agent pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -1772,7 +1720,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :vartype vm_size: str or ~azure.mgmt.containerservice.v2019_08_01.models.ContainerServiceVMSizeTypes :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine @@ -1784,7 +1732,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Known values are: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux" and "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2019_08_01.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -1793,7 +1741,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar type: AgentPoolType represents types of an agent pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2019_08_01.models.AgentPoolType :ivar orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -1807,47 +1755,47 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar enable_node_public_ip: Enable public IP for nodes. :vartype enable_node_public_ip: bool :ivar scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Known values are: "Low", "Regular". Default value: "Regular". + priority. Default to regular. Known values are: "Low" and "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2019_08_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy - for low priority virtual machine scale set. Default to Delete. Known values are: "Delete", - "Deallocate". Default value: "Delete". + for low priority virtual machine scale set. Default to Delete. Known values are: "Delete" and + "Deallocate". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2019_08_01.models.ScaleSetEvictionPolicy :ivar node_taints: Taints added to new nodes during node pool create and scale. For example, key=value:NoSchedule. :vartype node_taints: list[str] - :ivar name: Required. Unique name of the agent pool profile in the context of the subscription - and resource group. + :ivar name: Unique name of the agent pool profile in the context of the subscription and + resource group. Required. :vartype name: str """ _validation = { - 'os_disk_size_gb': {'maximum': 1023, 'minimum': 0}, - 'provisioning_state': {'readonly': True}, - 'name': {'required': True, 'pattern': r'^[a-z][a-z0-9]{0,11}$'}, + "os_disk_size_gb": {"maximum": 1023, "minimum": 0}, + "provisioning_state": {"readonly": True}, + "name": {"required": True, "pattern": r"^[a-z][a-z0-9]{0,11}$"}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'maxPods', 'type': 'int'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'max_count': {'key': 'maxCount', 'type': 'int'}, - 'min_count': {'key': 'minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'enableAutoScaling', 'type': 'bool'}, - 'type': {'key': 'type', 'type': 'str'}, - 'orchestrator_version': {'key': 'orchestratorVersion', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'availability_zones': {'key': 'availabilityZones', 'type': '[str]'}, - 'enable_node_public_ip': {'key': 'enableNodePublicIP', 'type': 'bool'}, - 'scale_set_priority': {'key': 'scaleSetPriority', 'type': 'str'}, - 'scale_set_eviction_policy': {'key': 'scaleSetEvictionPolicy', 'type': 'str'}, - 'node_taints': {'key': 'nodeTaints', 'type': '[str]'}, - 'name': {'key': 'name', 'type': 'str'}, + "count": {"key": "count", "type": "int"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "max_pods": {"key": "maxPods", "type": "int"}, + "os_type": {"key": "osType", "type": "str"}, + "max_count": {"key": "maxCount", "type": "int"}, + "min_count": {"key": "minCount", "type": "int"}, + "enable_auto_scaling": {"key": "enableAutoScaling", "type": "bool"}, + "type": {"key": "type", "type": "str"}, + "orchestrator_version": {"key": "orchestratorVersion", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "availability_zones": {"key": "availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "enableNodePublicIP", "type": "bool"}, + "scale_set_priority": {"key": "scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "scaleSetEvictionPolicy", "type": "str"}, + "node_taints": {"key": "nodeTaints", "type": "[str]"}, + "name": {"key": "name", "type": "str"}, } def __init__( @@ -1859,7 +1807,7 @@ def __init__( os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, @@ -1867,8 +1815,8 @@ def __init__( orchestrator_version: Optional[str] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, - scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", node_taints: Optional[List[str]] = None, **kwargs ): @@ -1913,7 +1861,7 @@ def __init__( "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :paramtype vm_size: str or ~azure.mgmt.containerservice.v2019_08_01.models.ContainerServiceVMSizeTypes :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every @@ -1925,7 +1873,7 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux" and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2019_08_01.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -1934,7 +1882,7 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword type: AgentPoolType represents types of an agent pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2019_08_01.models.AgentPoolType :keyword orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -1945,26 +1893,44 @@ def __init__( :keyword enable_node_public_ip: Enable public IP for nodes. :paramtype enable_node_public_ip: bool :keyword scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Known values are: "Low", "Regular". Default value: "Regular". + priority. Default to regular. Known values are: "Low" and "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2019_08_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy for low priority virtual machine scale set. Default to Delete. Known values are: - "Delete", "Deallocate". Default value: "Delete". + "Delete" and "Deallocate". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2019_08_01.models.ScaleSetEvictionPolicy :keyword node_taints: Taints added to new nodes during node pool create and scale. For example, key=value:NoSchedule. :paramtype node_taints: list[str] - :keyword name: Required. Unique name of the agent pool profile in the context of the - subscription and resource group. + :keyword name: Unique name of the agent pool profile in the context of the subscription and + resource group. Required. :paramtype name: str """ - super(ManagedClusterAgentPoolProfile, self).__init__(count=count, vm_size=vm_size, os_disk_size_gb=os_disk_size_gb, vnet_subnet_id=vnet_subnet_id, max_pods=max_pods, os_type=os_type, max_count=max_count, min_count=min_count, enable_auto_scaling=enable_auto_scaling, type=type, orchestrator_version=orchestrator_version, availability_zones=availability_zones, enable_node_public_ip=enable_node_public_ip, scale_set_priority=scale_set_priority, scale_set_eviction_policy=scale_set_eviction_policy, node_taints=node_taints, **kwargs) + super().__init__( + count=count, + vm_size=vm_size, + os_disk_size_gb=os_disk_size_gb, + vnet_subnet_id=vnet_subnet_id, + max_pods=max_pods, + os_type=os_type, + max_count=max_count, + min_count=min_count, + enable_auto_scaling=enable_auto_scaling, + type=type, + orchestrator_version=orchestrator_version, + availability_zones=availability_zones, + enable_node_public_ip=enable_node_public_ip, + scale_set_priority=scale_set_priority, + scale_set_eviction_policy=scale_set_eviction_policy, + node_taints=node_taints, + **kwargs + ) self.name = name -class ManagedClusterAPIServerAccessProfile(msrest.serialization.Model): +class ManagedClusterAPIServerAccessProfile(_serialization.Model): """Access profile for managed cluster API server. :ivar authorized_ip_ranges: Authorized IP Ranges to kubernetes API server. @@ -1974,8 +1940,8 @@ class ManagedClusterAPIServerAccessProfile(msrest.serialization.Model): """ _attribute_map = { - 'authorized_ip_ranges': {'key': 'authorizedIPRanges', 'type': '[str]'}, - 'enable_private_cluster': {'key': 'enablePrivateCluster', 'type': 'bool'}, + "authorized_ip_ranges": {"key": "authorizedIPRanges", "type": "[str]"}, + "enable_private_cluster": {"key": "enablePrivateCluster", "type": "bool"}, } def __init__( @@ -1991,12 +1957,12 @@ def __init__( :keyword enable_private_cluster: Whether to create the cluster as a private cluster or not. :paramtype enable_private_cluster: bool """ - super(ManagedClusterAPIServerAccessProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.authorized_ip_ranges = authorized_ip_ranges self.enable_private_cluster = enable_private_cluster -class ManagedClusterIdentity(msrest.serialization.Model): +class ManagedClusterIdentity(_serialization.Model): """Identity for the managed cluster. Variables are only populated by the server, and will be ignored when sending a request. @@ -2010,41 +1976,36 @@ class ManagedClusterIdentity(msrest.serialization.Model): :ivar type: The type of identity used for the managed cluster. Type 'SystemAssigned' will use an implicitly created identity in master components and an auto-created user assigned identity in MC_ resource group in agent nodes. Type 'None' will not use MSI for the managed cluster, - service principal will be used instead. Known values are: "SystemAssigned", "None". + service principal will be used instead. Known values are: "SystemAssigned" and "None". :vartype type: str or ~azure.mgmt.containerservice.v2019_08_01.models.ResourceIdentityType """ _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, + "principal_id": {"readonly": True}, + "tenant_id": {"readonly": True}, } _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, + "principal_id": {"key": "principalId", "type": "str"}, + "tenant_id": {"key": "tenantId", "type": "str"}, + "type": {"key": "type", "type": "str"}, } - def __init__( - self, - *, - type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, - **kwargs - ): + def __init__(self, *, type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, **kwargs): """ :keyword type: The type of identity used for the managed cluster. Type 'SystemAssigned' will use an implicitly created identity in master components and an auto-created user assigned identity in MC_ resource group in agent nodes. Type 'None' will not use MSI for the managed - cluster, service principal will be used instead. Known values are: "SystemAssigned", "None". + cluster, service principal will be used instead. Known values are: "SystemAssigned" and "None". :paramtype type: str or ~azure.mgmt.containerservice.v2019_08_01.models.ResourceIdentityType """ - super(ManagedClusterIdentity, self).__init__(**kwargs) + super().__init__(**kwargs) self.principal_id = None self.tenant_id = None self.type = type -class ManagedClusterListResult(msrest.serialization.Model): +class ManagedClusterListResult(_serialization.Model): """The response from the List Managed Clusters operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -2056,30 +2017,25 @@ class ManagedClusterListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[ManagedCluster]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[ManagedCluster]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.ManagedCluster"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.ManagedCluster"]] = None, **kwargs): """ :keyword value: The list of managed clusters. :paramtype value: list[~azure.mgmt.containerservice.v2019_08_01.models.ManagedCluster] """ - super(ManagedClusterListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class ManagedClusterLoadBalancerProfile(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfile(_serialization.Model): """Profile of the managed cluster load balancer. :ivar managed_outbound_i_ps: Desired managed outbound IPs for the cluster load balancer. @@ -2098,10 +2054,16 @@ class ManagedClusterLoadBalancerProfile(msrest.serialization.Model): """ _attribute_map = { - 'managed_outbound_i_ps': {'key': 'managedOutboundIPs', 'type': 'ManagedClusterLoadBalancerProfileManagedOutboundIPs'}, - 'outbound_ip_prefixes': {'key': 'outboundIPPrefixes', 'type': 'ManagedClusterLoadBalancerProfileOutboundIPPrefixes'}, - 'outbound_i_ps': {'key': 'outboundIPs', 'type': 'ManagedClusterLoadBalancerProfileOutboundIPs'}, - 'effective_outbound_i_ps': {'key': 'effectiveOutboundIPs', 'type': '[ResourceReference]'}, + "managed_outbound_i_ps": { + "key": "managedOutboundIPs", + "type": "ManagedClusterLoadBalancerProfileManagedOutboundIPs", + }, + "outbound_ip_prefixes": { + "key": "outboundIPPrefixes", + "type": "ManagedClusterLoadBalancerProfileOutboundIPPrefixes", + }, + "outbound_i_ps": {"key": "outboundIPs", "type": "ManagedClusterLoadBalancerProfileOutboundIPs"}, + "effective_outbound_i_ps": {"key": "effectiveOutboundIPs", "type": "[ResourceReference]"}, } def __init__( @@ -2129,14 +2091,14 @@ def __init__( :paramtype effective_outbound_i_ps: list[~azure.mgmt.containerservice.v2019_08_01.models.ResourceReference] """ - super(ManagedClusterLoadBalancerProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.managed_outbound_i_ps = managed_outbound_i_ps self.outbound_ip_prefixes = outbound_ip_prefixes self.outbound_i_ps = outbound_i_ps self.effective_outbound_i_ps = effective_outbound_i_ps -class ManagedClusterLoadBalancerProfileManagedOutboundIPs(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfileManagedOutboundIPs(_serialization.Model): """Desired managed outbound IPs for the cluster load balancer. :ivar count: Desired number of outbound IP created/managed by Azure for the cluster load @@ -2145,29 +2107,24 @@ class ManagedClusterLoadBalancerProfileManagedOutboundIPs(msrest.serialization.M """ _validation = { - 'count': {'maximum': 100, 'minimum': 1}, + "count": {"maximum": 100, "minimum": 1}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, + "count": {"key": "count", "type": "int"}, } - def __init__( - self, - *, - count: Optional[int] = 1, - **kwargs - ): + def __init__(self, *, count: int = 1, **kwargs): """ :keyword count: Desired number of outbound IP created/managed by Azure for the cluster load balancer. Allowed values must be in the range of 1 to 100 (inclusive). The default value is 1. :paramtype count: int """ - super(ManagedClusterLoadBalancerProfileManagedOutboundIPs, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count -class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(_serialization.Model): """Desired outbound IP Prefix resources for the cluster load balancer. :ivar public_ip_prefixes: A list of public IP prefix resources. @@ -2176,25 +2133,20 @@ class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(msrest.serialization.M """ _attribute_map = { - 'public_ip_prefixes': {'key': 'publicIPPrefixes', 'type': '[ResourceReference]'}, + "public_ip_prefixes": {"key": "publicIPPrefixes", "type": "[ResourceReference]"}, } - def __init__( - self, - *, - public_ip_prefixes: Optional[List["_models.ResourceReference"]] = None, - **kwargs - ): + def __init__(self, *, public_ip_prefixes: Optional[List["_models.ResourceReference"]] = None, **kwargs): """ :keyword public_ip_prefixes: A list of public IP prefix resources. :paramtype public_ip_prefixes: list[~azure.mgmt.containerservice.v2019_08_01.models.ResourceReference] """ - super(ManagedClusterLoadBalancerProfileOutboundIPPrefixes, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_ip_prefixes = public_ip_prefixes -class ManagedClusterLoadBalancerProfileOutboundIPs(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfileOutboundIPs(_serialization.Model): """Desired outbound IP resources for the cluster load balancer. :ivar public_i_ps: A list of public IP resources. @@ -2202,34 +2154,29 @@ class ManagedClusterLoadBalancerProfileOutboundIPs(msrest.serialization.Model): """ _attribute_map = { - 'public_i_ps': {'key': 'publicIPs', 'type': '[ResourceReference]'}, + "public_i_ps": {"key": "publicIPs", "type": "[ResourceReference]"}, } - def __init__( - self, - *, - public_i_ps: Optional[List["_models.ResourceReference"]] = None, - **kwargs - ): + def __init__(self, *, public_i_ps: Optional[List["_models.ResourceReference"]] = None, **kwargs): """ :keyword public_i_ps: A list of public IP resources. :paramtype public_i_ps: list[~azure.mgmt.containerservice.v2019_08_01.models.ResourceReference] """ - super(ManagedClusterLoadBalancerProfileOutboundIPs, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_i_ps = public_i_ps -class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): +class ManagedClusterPoolUpgradeProfile(_serialization.Model): """The list of available upgrade versions. All required parameters must be populated in order to send to Azure. - :ivar kubernetes_version: Required. Kubernetes version (major, minor, patch). + :ivar kubernetes_version: Kubernetes version (major, minor, patch). Required. :vartype kubernetes_version: str :ivar name: Pool name. :vartype name: str - :ivar os_type: Required. OsType to be used to specify os type. Choose from Linux and Windows. - Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to + Linux. Known values are: "Linux" and "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2019_08_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -2237,15 +2184,15 @@ class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): """ _validation = { - 'kubernetes_version': {'required': True}, - 'os_type': {'required': True}, + "kubernetes_version": {"required": True}, + "os_type": {"required": True}, } _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'upgrades': {'key': 'upgrades', 'type': '[ManagedClusterPoolUpgradeProfileUpgradesItem]'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "os_type": {"key": "osType", "type": "str"}, + "upgrades": {"key": "upgrades", "type": "[ManagedClusterPoolUpgradeProfileUpgradesItem]"}, } def __init__( @@ -2258,25 +2205,25 @@ def __init__( **kwargs ): """ - :keyword kubernetes_version: Required. Kubernetes version (major, minor, patch). + :keyword kubernetes_version: Kubernetes version (major, minor, patch). Required. :paramtype kubernetes_version: str :keyword name: Pool name. :paramtype name: str - :keyword os_type: Required. OsType to be used to specify os type. Choose from Linux and - Windows. Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default + to Linux. Known values are: "Linux" and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2019_08_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: list[~azure.mgmt.containerservice.v2019_08_01.models.ManagedClusterPoolUpgradeProfileUpgradesItem] """ - super(ManagedClusterPoolUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.name = name self.os_type = os_type self.upgrades = upgrades -class ManagedClusterPoolUpgradeProfileUpgradesItem(msrest.serialization.Model): +class ManagedClusterPoolUpgradeProfileUpgradesItem(_serialization.Model): """ManagedClusterPoolUpgradeProfileUpgradesItem. :ivar kubernetes_version: Kubernetes version (major, minor, patch). @@ -2286,67 +2233,55 @@ class ManagedClusterPoolUpgradeProfileUpgradesItem(msrest.serialization.Model): """ _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } - def __init__( - self, - *, - kubernetes_version: Optional[str] = None, - is_preview: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, kubernetes_version: Optional[str] = None, is_preview: Optional[bool] = None, **kwargs): """ :keyword kubernetes_version: Kubernetes version (major, minor, patch). :paramtype kubernetes_version: str :keyword is_preview: Whether Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(ManagedClusterPoolUpgradeProfileUpgradesItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.is_preview = is_preview -class ManagedClusterServicePrincipalProfile(msrest.serialization.Model): +class ManagedClusterServicePrincipalProfile(_serialization.Model): """Information about a service principal identity for the cluster to use for manipulating Azure APIs. All required parameters must be populated in order to send to Azure. - :ivar client_id: Required. The ID for the service principal. + :ivar client_id: The ID for the service principal. Required. :vartype client_id: str :ivar secret: The secret password associated with the service principal in plain text. :vartype secret: str """ _validation = { - 'client_id': {'required': True}, + "client_id": {"required": True}, } _attribute_map = { - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'secret': {'key': 'secret', 'type': 'str'}, + "client_id": {"key": "clientId", "type": "str"}, + "secret": {"key": "secret", "type": "str"}, } - def __init__( - self, - *, - client_id: str, - secret: Optional[str] = None, - **kwargs - ): + def __init__(self, *, client_id: str, secret: Optional[str] = None, **kwargs): """ - :keyword client_id: Required. The ID for the service principal. + :keyword client_id: The ID for the service principal. Required. :paramtype client_id: str :keyword secret: The secret password associated with the service principal in plain text. :paramtype secret: str """ - super(ManagedClusterServicePrincipalProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.client_id = client_id self.secret = secret -class ManagedClusterUpgradeProfile(msrest.serialization.Model): +class ManagedClusterUpgradeProfile(_serialization.Model): """The list of available upgrades for compute pools. Variables are only populated by the server, and will be ignored when sending a request. @@ -2359,29 +2294,29 @@ class ManagedClusterUpgradeProfile(msrest.serialization.Model): :vartype name: str :ivar type: Type of upgrade profile. :vartype type: str - :ivar control_plane_profile: Required. The list of available upgrade versions for the control - plane. + :ivar control_plane_profile: The list of available upgrade versions for the control plane. + Required. :vartype control_plane_profile: ~azure.mgmt.containerservice.v2019_08_01.models.ManagedClusterPoolUpgradeProfile - :ivar agent_pool_profiles: Required. The list of available upgrade versions for agent pools. + :ivar agent_pool_profiles: The list of available upgrade versions for agent pools. Required. :vartype agent_pool_profiles: list[~azure.mgmt.containerservice.v2019_08_01.models.ManagedClusterPoolUpgradeProfile] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'control_plane_profile': {'required': True}, - 'agent_pool_profiles': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "control_plane_profile": {"required": True}, + "agent_pool_profiles": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'control_plane_profile': {'key': 'properties.controlPlaneProfile', 'type': 'ManagedClusterPoolUpgradeProfile'}, - 'agent_pool_profiles': {'key': 'properties.agentPoolProfiles', 'type': '[ManagedClusterPoolUpgradeProfile]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "control_plane_profile": {"key": "properties.controlPlaneProfile", "type": "ManagedClusterPoolUpgradeProfile"}, + "agent_pool_profiles": {"key": "properties.agentPoolProfiles", "type": "[ManagedClusterPoolUpgradeProfile]"}, } def __init__( @@ -2392,15 +2327,15 @@ def __init__( **kwargs ): """ - :keyword control_plane_profile: Required. The list of available upgrade versions for the - control plane. + :keyword control_plane_profile: The list of available upgrade versions for the control plane. + Required. :paramtype control_plane_profile: ~azure.mgmt.containerservice.v2019_08_01.models.ManagedClusterPoolUpgradeProfile - :keyword agent_pool_profiles: Required. The list of available upgrade versions for agent pools. + :keyword agent_pool_profiles: The list of available upgrade versions for agent pools. Required. :paramtype agent_pool_profiles: list[~azure.mgmt.containerservice.v2019_08_01.models.ManagedClusterPoolUpgradeProfile] """ - super(ManagedClusterUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -2408,18 +2343,18 @@ def __init__( self.agent_pool_profiles = agent_pool_profiles -class ManagedClusterWindowsProfile(msrest.serialization.Model): +class ManagedClusterWindowsProfile(_serialization.Model): """Profile for Windows VMs in the container service cluster. All required parameters must be populated in order to send to Azure. - :ivar admin_username: Required. Specifies the name of the administrator account. - :code:`
`:code:`
` **restriction:** Cannot end in "." :code:`
`:code:`
` - **Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", "test1", - "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", - "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", - "sys", "test2", "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 - character :code:`
`:code:`
` **Max-length:** 20 characters. + :ivar admin_username: Specifies the name of the administrator account. :code:`
`:code:`
` + **restriction:** Cannot end in "." :code:`
`:code:`
` **Disallowed values:** + "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", + "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", + "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", + "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 character + :code:`
`:code:`
` **Max-length:** 20 characters. Required. :vartype admin_username: str :ivar admin_password: Specifies the password of the administrator account. :code:`
`:code:`
` **Minimum-length:** 8 characters :code:`
`:code:`
` @@ -2432,29 +2367,23 @@ class ManagedClusterWindowsProfile(msrest.serialization.Model): """ _validation = { - 'admin_username': {'required': True}, + "admin_username": {"required": True}, } _attribute_map = { - 'admin_username': {'key': 'adminUsername', 'type': 'str'}, - 'admin_password': {'key': 'adminPassword', 'type': 'str'}, + "admin_username": {"key": "adminUsername", "type": "str"}, + "admin_password": {"key": "adminPassword", "type": "str"}, } - def __init__( - self, - *, - admin_username: str, - admin_password: Optional[str] = None, - **kwargs - ): + def __init__(self, *, admin_username: str, admin_password: Optional[str] = None, **kwargs): """ - :keyword admin_username: Required. Specifies the name of the administrator account. + :keyword admin_username: Specifies the name of the administrator account. :code:`
`:code:`
` **restriction:** Cannot end in "." :code:`
`:code:`
` **Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 - character :code:`
`:code:`
` **Max-length:** 20 characters. + character :code:`
`:code:`
` **Max-length:** 20 characters. Required. :paramtype admin_username: str :keyword admin_password: Specifies the password of the administrator account. :code:`
`:code:`
` **Minimum-length:** 8 characters :code:`
`:code:`
` @@ -2465,12 +2394,12 @@ def __init__( "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!". :paramtype admin_password: str """ - super(ManagedClusterWindowsProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.admin_username = admin_username self.admin_password = admin_password -class OperationListResult(msrest.serialization.Model): +class OperationListResult(_serialization.Model): """The List Compute Operation operation response. Variables are only populated by the server, and will be ignored when sending a request. @@ -2480,24 +2409,20 @@ class OperationListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[OperationValue]'}, + "value": {"key": "value", "type": "[OperationValue]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(OperationListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None -class OperationValue(msrest.serialization.Model): +class OperationValue(_serialization.Model): """Describes the properties of a Compute Operation value. Variables are only populated by the server, and will be ignored when sending a request. @@ -2517,30 +2442,26 @@ class OperationValue(msrest.serialization.Model): """ _validation = { - 'origin': {'readonly': True}, - 'name': {'readonly': True}, - 'operation': {'readonly': True}, - 'resource': {'readonly': True}, - 'description': {'readonly': True}, - 'provider': {'readonly': True}, + "origin": {"readonly": True}, + "name": {"readonly": True}, + "operation": {"readonly": True}, + "resource": {"readonly": True}, + "description": {"readonly": True}, + "provider": {"readonly": True}, } _attribute_map = { - 'origin': {'key': 'origin', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'operation': {'key': 'display.operation', 'type': 'str'}, - 'resource': {'key': 'display.resource', 'type': 'str'}, - 'description': {'key': 'display.description', 'type': 'str'}, - 'provider': {'key': 'display.provider', 'type': 'str'}, + "origin": {"key": "origin", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "operation": {"key": "display.operation", "type": "str"}, + "resource": {"key": "display.resource", "type": "str"}, + "description": {"key": "display.description", "type": "str"}, + "provider": {"key": "display.provider", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(OperationValue, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.origin = None self.name = None self.operation = None @@ -2549,7 +2470,7 @@ def __init__( self.provider = None -class ResourceReference(msrest.serialization.Model): +class ResourceReference(_serialization.Model): """A reference to an Azure resource. :ivar id: The fully qualified Azure resource id. @@ -2557,43 +2478,33 @@ class ResourceReference(msrest.serialization.Model): """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, } - def __init__( - self, - *, - id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin """ :keyword id: The fully qualified Azure resource id. :paramtype id: str """ - super(ResourceReference, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id -class TagsObject(msrest.serialization.Model): +class TagsObject(_serialization.Model): """Tags object for patch operations. - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] """ _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] """ - super(TagsObject, self).__init__(**kwargs) + super().__init__(**kwargs) self.tags = tags diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/models/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/models/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/models/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/models/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/operations/__init__.py index 403c0174f052..ee6608454b6b 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/operations/__init__.py @@ -13,10 +13,11 @@ from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'Operations', - 'ManagedClustersOperations', - 'AgentPoolsOperations', + "Operations", + "ManagedClustersOperations", + "AgentPoolsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/operations/_agent_pools_operations.py index 28349a6c26fc..7bff7d554844 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/operations/_agent_pools_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,249 +27,250 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - *, - json: Optional[_models.AgentPool] = None, - content: Any = None, - **kwargs: Any + _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, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + _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, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_get_upgrade_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_available_agent_pool_versions_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class AgentPoolsOperations: """ @@ -285,48 +291,40 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> Iterable[_models.AgentPoolListResult]: + def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> Iterable["_models.AgentPool"]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. The operation returns properties of each agent pool. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AgentPoolListResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2019_08_01.models.AgentPoolListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either AgentPool or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2019_08_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -334,16 +332,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -359,10 +352,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -372,54 +363,45 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore @distributed_trace def get( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPool: """Gets the agent pool. Gets the details of the agent pool by managed cluster and resource group. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPool, or the result of cls(response) + :return: AgentPool or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_08_01.models.AgentPool - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -427,57 +409,60 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore def _create_or_update_initial( self, resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: _models.AgentPool, + parameters: Union[_models.AgentPool, IO], **kwargs: Any ) -> _models.AgentPool: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - _json = self._serialize.body(parameters, 'AgentPool') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "AgentPool") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -485,10 +470,9 @@ def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -496,40 +480,86 @@ def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - - @distributed_trace + @overload def begin_create_or_update( self, resource_group_name: str, resource_name: str, agent_pool_name: str, parameters: _models.AgentPool, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.AgentPool]: """Creates or updates an agent pool. Creates or updates an agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :param parameters: Parameters supplied to the Create or Update an agent pool operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2019_08_01.models.AgentPool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2019_08_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AgentPool]: + """Creates or updates an agent pool. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: Parameters supplied to the Create or Update an agent pool operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -541,20 +571,56 @@ def begin_create_or_update( :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2019_08_01.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: Union[_models.AgentPool, IO], + **kwargs: Any + ) -> LROPoller[_models.AgentPool]: + """Creates or updates an agent pool. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: Parameters supplied to the Create or Update an agent pool operation. Is + either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2019_08_01.models.AgentPool or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2019_08_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -563,66 +629,55 @@ def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -630,10 +685,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -643,26 +697,21 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + def begin_delete( + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> LROPoller[None]: """Deletes an agent pool. Deletes the agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -674,100 +723,86 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPoolUpgradeProfile: """Gets upgrade profile for an agent pool. Gets the details of the upgrade profile for an agent pool with a specified resource group and managed cluster name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolUpgradeProfile, or the result of cls(response) + :return: AgentPoolUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_08_01.models.AgentPoolUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -775,64 +810,56 @@ def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolUpgradeProfile', pipeline_response) + deserialized = self._deserialize("AgentPoolUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore @distributed_trace def get_available_agent_pool_versions( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported versions for the specified agent pool. Gets a list of supported versions for the specified agent pool. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolAvailableVersions, or the result of cls(response) + :return: AgentPoolAvailableVersions or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_08_01.models.AgentPoolAvailableVersions - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolAvailableVersions] - request = build_get_available_agent_pool_versions_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_available_agent_pool_versions.metadata['url'], + template_url=self.get_available_agent_pool_versions.metadata["url"], headers=_headers, params=_params, ) @@ -840,22 +867,20 @@ def get_available_agent_pool_versions( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolAvailableVersions', pipeline_response) + deserialized = self._deserialize("AgentPoolAvailableVersions", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_available_agent_pool_versions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore - + get_available_agent_pool_versions.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/operations/_managed_clusters_operations.py index 906e90660d66..1117df203557 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/operations/_managed_clusters_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,520 +27,498 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters") + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters" + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_resource_group_request( - subscription_id: str, - resource_group_name: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters", + ) # 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', min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_upgrade_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_access_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, role_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 = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "roleName": _SERIALIZER.url("role_name", role_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "roleName": _SERIALIZER.url("role_name", role_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_admin_credentials_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_user_credentials_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: + +def build_get_request(resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedCluster] = None, - content: Any = None, - **kwargs: Any +def build_create_or_update_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_update_tags_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.TagsObject] = None, - content: Any = None, - **kwargs: Any +def build_update_tags_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + +def build_delete_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_reset_service_principal_profile_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedClusterServicePrincipalProfile] = None, - content: Any = None, - **kwargs: Any +def build_reset_service_principal_profile_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_reset_aad_profile_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedClusterAADProfile] = None, - content: Any = None, - **kwargs: Any +def build_reset_aad_profile_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_rotate_cluster_certificates_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + +def build_rotate_cluster_certificates_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + class ManagedClustersOperations: """ @@ -556,41 +539,35 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.ManagedClusterListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.ManagedCluster"]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. The operation returns properties of each managed cluster. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2019_08_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2019_08_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -598,14 +575,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -621,10 +595,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -634,50 +606,42 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> Iterable[_models.ManagedClusterListResult]: + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.ManagedCluster"]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. The operation returns properties of each managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2019_08_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2019_08_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -685,15 +649,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -709,10 +669,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -722,51 +680,43 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.ManagedClusterUpgradeProfile: """Gets upgrade profile for a managed cluster. Gets the details of the upgrade profile for a managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterUpgradeProfile, or the result of cls(response) + :return: ManagedClusterUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_08_01.models.ManagedClusterUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -774,69 +724,60 @@ def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterUpgradeProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore @distributed_trace def get_access_profile( - self, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, role_name: str, **kwargs: Any ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. Gets the accessProfile for the specified role name of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param role_name: The name of the role for managed cluster accessProfile resource. + :param role_name: The name of the role for managed cluster accessProfile resource. Required. :type role_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterAccessProfile, or the result of cls(response) + :return: ManagedClusterAccessProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_08_01.models.ManagedClusterAccessProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterAccessProfile] - request = build_get_access_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, role_name=role_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_access_profile.metadata['url'], + template_url=self.get_access_profile.metadata["url"], headers=_headers, params=_params, ) @@ -844,64 +785,56 @@ def get_access_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterAccessProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterAccessProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_access_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore - + get_access_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore @distributed_trace def list_cluster_admin_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster admin credential of a managed cluster. Gets cluster admin credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_08_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_admin_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_admin_credentials.metadata['url'], + template_url=self.list_cluster_admin_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -909,64 +842,56 @@ def list_cluster_admin_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_admin_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore - + list_cluster_admin_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore @distributed_trace def list_cluster_user_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster user credential of a managed cluster. Gets cluster user credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_08_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_user_credentials.metadata['url'], + template_url=self.list_cluster_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -974,64 +899,54 @@ def list_cluster_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore - + list_cluster_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore @distributed_trace - def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.ManagedCluster: + def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.ManagedCluster: """Gets a managed cluster. Gets the details of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedCluster, or the result of cls(response) + :return: ManagedCluster or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_08_01.models.ManagedCluster - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -1039,55 +954,54 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _create_or_update_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.ManagedCluster, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'ManagedCluster') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedCluster") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1095,10 +1009,9 @@ def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -1106,25 +1019,26 @@ def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - - @distributed_trace + @overload def begin_create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedCluster, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. @@ -1132,12 +1046,56 @@ def begin_create_or_update( Creates or updates a managed cluster with the specified configuration for agents and Kubernetes version. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2019_08_01.models.ManagedCluster + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2019_08_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster with the specified configuration for agents and Kubernetes + version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1150,20 +1108,51 @@ def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2019_08_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster with the specified configuration for agents and Kubernetes + version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. Is + either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2019_08_01.models.ManagedCluster or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2019_08_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -1171,69 +1160,66 @@ def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _update_tags_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.TagsObject, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request_initial( - subscription_id=self._config.subscription_id, + request = build_update_tags_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_tags_initial.metadata['url'], + content=_content, + template_url=self._update_tags_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1241,44 +1227,85 @@ def _update_tags_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_tags_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _update_tags_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - @distributed_trace + @overload def begin_update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates a managed cluster with the specified tags. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2019_08_01.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2019_08_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates a managed cluster with the specified tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1291,20 +1318,50 @@ def begin_update_tags( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2019_08_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates a managed cluster with the specified tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2019_08_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2019_08_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, @@ -1312,64 +1369,54 @@ def begin_update_tags( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1377,10 +1424,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1390,23 +1436,17 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> LROPoller[None]: + def begin_delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> LROPoller[None]: """Deletes a managed cluster. Deletes the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1418,85 +1458,83 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterServicePrincipalProfile, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterServicePrincipalProfile") - request = build_reset_service_principal_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_service_principal_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_service_principal_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_service_principal_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1504,10 +1542,9 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1517,29 +1554,70 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re if cls: return cls(pipeline_response, None, {}) - _reset_service_principal_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore - + _reset_service_principal_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore - @distributed_trace - def begin_reset_service_principal_profile( # pylint: disable=inconsistent-return-statements + @overload + def begin_reset_service_principal_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterServicePrincipalProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: """Reset Service Principal Profile of a managed cluster. Update the service principal Profile for a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a - Managed Cluster. + Managed Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2019_08_01.models.ManagedClusterServicePrincipalProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reset Service Principal Profile of a managed cluster. + + Update the service principal Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a + Managed Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1550,20 +1628,53 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Reset Service Principal Profile of a managed cluster. + + Update the service principal Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a + Managed Cluster. Is either a model type or a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2019_08_01.models.ManagedClusterServicePrincipalProfile or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1571,67 +1682,68 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_service_principal_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + begin_reset_service_principal_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterAADProfile, + parameters: Union[_models.ManagedClusterAADProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterAADProfile") - request = build_reset_aad_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_aad_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_aad_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_aad_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1639,10 +1751,9 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1652,28 +1763,105 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement if cls: return cls(pipeline_response, None, {}) - _reset_aad_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - + _reset_aad_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - @distributed_trace - def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements + @overload + def begin_reset_aad_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterAADProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: """Reset AAD Profile of a managed cluster. Update the AAD Profile for a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed - Cluster. + Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2019_08_01.models.ManagedClusterAADProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reset AAD Profile of a managed cluster. + + Update the AAD Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed + Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterAADProfile, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Reset AAD Profile of a managed cluster. + + Update the AAD Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed + Cluster. Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2019_08_01.models.ManagedClusterAADProfile or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1684,20 +1872,17 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1705,62 +1890,52 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_aad_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + begin_reset_aad_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_rotate_cluster_certificates_request_initial( - subscription_id=self._config.subscription_id, + request = build_rotate_cluster_certificates_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._rotate_cluster_certificates_initial.metadata['url'], + template_url=self._rotate_cluster_certificates_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1768,10 +1943,9 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1781,23 +1955,19 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return if cls: return cls(pipeline_response, None, {}) - _rotate_cluster_certificates_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore - + _rotate_cluster_certificates_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore @distributed_trace - def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + def begin_rotate_cluster_certificates( + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> LROPoller[None]: """Rotate certificates of a managed cluster. Rotate certificates of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1809,52 +1979,45 @@ def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-st Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._rotate_cluster_certificates_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_rotate_cluster_certificates.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore + begin_rotate_cluster_certificates.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/operations/_operations.py index b12bfabeffd9..dc2d53eb491b 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/operations/_operations.py @@ -7,10 +7,15 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,38 +25,34 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - **kwargs: Any -) -> HttpRequest: + +def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.ContainerService/operations") # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class Operations: """ @@ -72,36 +73,31 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.OperationListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.OperationValue"]: """Gets a list of compute operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationListResult or the result of cls(response) + :return: An iterator like instance of either OperationValue or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2019_08_01.models.OperationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2019_08_01.models.OperationValue] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -109,13 +105,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -131,10 +125,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -144,8 +136,6 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.ContainerService/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ContainerService/operations"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/operations/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/__init__.py index 37a5f9e02e6f..a8716d29afe8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/__init__.py @@ -14,7 +14,8 @@ except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['ContainerServiceClient'] + +__all__ = ["ContainerServiceClient"] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/_configuration.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/_configuration.py index 1e32aaf57638..e5132584df67 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/_configuration.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/_configuration.py @@ -18,30 +18,26 @@ VERSION = "unknown" + class ContainerServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ContainerServiceClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2019-09-30-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: + def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ContainerServiceClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2019-09-30-preview") # type: str + api_version = kwargs.pop("api_version", "2019-09-30-preview") # type: str if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -51,23 +47,24 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-containerservice/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-containerservice/{}".format(VERSION)) self._configure(**kwargs) def _configure( - self, - **kwargs # type: Any + self, **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/_container_service_client.py index 48ac69cd7556..4514cf930a0d 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/_container_service_client.py @@ -9,12 +9,11 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from . import models +from .._serialization import Deserializer, Serializer from ._configuration import ContainerServiceClientConfiguration from .operations import OpenShiftManagedClustersOperations @@ -22,16 +21,17 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class ContainerServiceClient: + +class ContainerServiceClient: # pylint: disable=client-accepts-api-version-keyword """The Container Service Client. :ivar open_shift_managed_clusters: OpenShiftManagedClustersOperations operations :vartype open_shift_managed_clusters: azure.mgmt.containerservice.v2019_09_30_preview.operations.OpenShiftManagedClustersOperations - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -49,7 +49,9 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = ContainerServiceClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = ContainerServiceClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} @@ -60,12 +62,7 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) - - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> HttpResponse: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -74,7 +71,7 @@ def _send_request( >>> response = client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/_metadata.json b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/_metadata.json index 20104156a807..7bf96720fba7 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/_metadata.json +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/_metadata.json @@ -10,20 +10,20 @@ "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { "credential": { - "signature": "credential, # type: \"TokenCredential\"", - "description": "Credential needed for the client to connect to Azure.", + "signature": "credential: \"TokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true }, "subscription_id": { - "signature": "subscription_id, # type: str", - "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "signature": "subscription_id: str,", + "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.", "docstring_type": "str", "required": true } @@ -31,13 +31,13 @@ "async": { "credential": { "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure.", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { "signature": "subscription_id: str,", - "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.", "docstring_type": "str", "required": true } @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=\"https://management.azure.com\", # type: str", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/_patch.py index 74e48ecd07cf..f99e77fef986 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/_patch.py @@ -28,4 +28,4 @@ # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + pass diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/_vendor.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/_vendor.py index 138f663c53a4..9aad73fc743e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/_vendor.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/_vendor.py @@ -7,6 +7,7 @@ from azure.core.pipeline.transport import HttpRequest + def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) @@ -14,6 +15,7 @@ def _convert_request(request, files=None): request.set_formdata_body(files) return request + def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -21,7 +23,5 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [ - c for c in formatted_components if "{}".format(key.args[0]) not in c - ] + components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/aio/__init__.py index 37a5f9e02e6f..a8716d29afe8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/aio/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/aio/__init__.py @@ -14,7 +14,8 @@ except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['ContainerServiceClient'] + +__all__ = ["ContainerServiceClient"] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/aio/_configuration.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/aio/_configuration.py index c81221f56a68..d656f27be8b3 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/aio/_configuration.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/aio/_configuration.py @@ -18,30 +18,26 @@ VERSION = "unknown" + class ContainerServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ContainerServiceClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2019-09-30-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: + def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ContainerServiceClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2019-09-30-preview") # type: str + api_version = kwargs.pop("api_version", "2019-09-30-preview") # type: str if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -51,22 +47,21 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-containerservice/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-containerservice/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, - **kwargs: Any - ) -> None: - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/aio/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/aio/_container_service_client.py index 521c33f7f229..81f566066bf1 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/aio/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/aio/_container_service_client.py @@ -9,12 +9,11 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from .. import models +from ..._serialization import Deserializer, Serializer from ._configuration import ContainerServiceClientConfiguration from .operations import OpenShiftManagedClustersOperations @@ -22,16 +21,17 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class ContainerServiceClient: + +class ContainerServiceClient: # pylint: disable=client-accepts-api-version-keyword """The Container Service Client. :ivar open_shift_managed_clusters: OpenShiftManagedClustersOperations operations :vartype open_shift_managed_clusters: azure.mgmt.containerservice.v2019_09_30_preview.aio.operations.OpenShiftManagedClustersOperations - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -49,7 +49,9 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = ContainerServiceClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = ContainerServiceClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} @@ -60,12 +62,7 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) - - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -74,7 +71,7 @@ def _send_request( >>> response = await client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/aio/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/aio/_patch.py index 74e48ecd07cf..f99e77fef986 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/aio/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/aio/_patch.py @@ -28,4 +28,4 @@ # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + pass diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/aio/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/aio/operations/__init__.py index 211a87879804..69775b67d4ba 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/aio/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/aio/operations/__init__.py @@ -11,8 +11,9 @@ from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'OpenShiftManagedClustersOperations', + "OpenShiftManagedClustersOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/aio/operations/_open_shift_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/aio/operations/_open_shift_managed_clusters_operations.py index 8eda2427fa6b..71584d74a8e0 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/aio/operations/_open_shift_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/aio/operations/_open_shift_managed_clusters_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +29,19 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._open_shift_managed_clusters_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_resource_group_request, build_list_request, build_update_tags_request_initial -T = TypeVar('T') +from ...operations._open_shift_managed_clusters_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_resource_group_request, + build_list_request, + build_update_tags_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class OpenShiftManagedClustersOperations: """ .. warning:: @@ -45,41 +61,36 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.OpenShiftManagedClusterListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.OpenShiftManagedCluster"]: """Gets a list of OpenShift managed clusters in the specified subscription. Gets a list of OpenShift managed clusters in the specified subscription. The operation returns properties of each OpenShift managed cluster. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OpenShiftManagedClusterListResult or the result of + :return: An iterator like instance of either OpenShiftManagedCluster or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2019_09_30_preview.models.OpenShiftManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2019_09_30_preview.models.OpenShiftManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-30-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-09-30-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OpenShiftManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -87,14 +98,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -110,10 +118,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -123,50 +129,45 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/openShiftManagedClusters"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/openShiftManagedClusters"} # type: ignore @distributed_trace def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.OpenShiftManagedClusterListResult]: + self, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.OpenShiftManagedCluster"]: """Lists OpenShift managed clusters in the specified subscription and resource group. Lists OpenShift managed clusters in the specified subscription and resource group. The operation returns properties of each OpenShift managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OpenShiftManagedClusterListResult or the result of + :return: An iterator like instance of either OpenShiftManagedCluster or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2019_09_30_preview.models.OpenShiftManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2019_09_30_preview.models.OpenShiftManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-30-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-09-30-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OpenShiftManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -174,15 +175,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -198,10 +195,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -211,50 +206,40 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters"} # type: ignore @distributed_trace_async - async def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.OpenShiftManagedCluster: + async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.OpenShiftManagedCluster: """Gets a OpenShift managed cluster. Gets the details of the managed OpenShift cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the OpenShift managed cluster resource. + :param resource_name: The name of the OpenShift managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: OpenShiftManagedCluster, or the result of cls(response) + :return: OpenShiftManagedCluster or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_09_30_preview.models.OpenShiftManagedCluster - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-30-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-09-30-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OpenShiftManagedCluster] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -262,55 +247,58 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('OpenShiftManagedCluster', pipeline_response) + deserialized = self._deserialize("OpenShiftManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore async def _create_or_update_initial( self, resource_group_name: str, resource_name: str, - parameters: _models.OpenShiftManagedCluster, + parameters: Union[_models.OpenShiftManagedCluster, IO], **kwargs: Any ) -> _models.OpenShiftManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2019-09-30-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-09-30-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.OpenShiftManagedCluster] - _json = self._serialize.body(parameters, 'OpenShiftManagedCluster') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "OpenShiftManagedCluster") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -318,10 +306,9 @@ async def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -329,25 +316,26 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('OpenShiftManagedCluster', pipeline_response) + deserialized = self._deserialize("OpenShiftManagedCluster", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('OpenShiftManagedCluster', pipeline_response) + deserialized = self._deserialize("OpenShiftManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore - + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore - @distributed_trace_async + @overload async def begin_create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.OpenShiftManagedCluster, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.OpenShiftManagedCluster]: """Creates or updates an OpenShift managed cluster. @@ -355,14 +343,96 @@ async def begin_create_or_update( Creates or updates a OpenShift managed cluster with the specified configuration for agents and OpenShift version. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the OpenShift managed cluster resource. + :param resource_name: The name of the OpenShift managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Create or Update an OpenShift Managed Cluster - operation. + operation. Required. :type parameters: ~azure.mgmt.containerservice.v2019_09_30_preview.models.OpenShiftManagedCluster + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either OpenShiftManagedCluster or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2019_09_30_preview.models.OpenShiftManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OpenShiftManagedCluster]: + """Creates or updates an OpenShift managed cluster. + + Creates or updates a OpenShift managed cluster with the specified configuration for agents and + OpenShift version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the OpenShift managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Create or Update an OpenShift Managed Cluster + operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either OpenShiftManagedCluster or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2019_09_30_preview.models.OpenShiftManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.OpenShiftManagedCluster, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.OpenShiftManagedCluster]: + """Creates or updates an OpenShift managed cluster. + + Creates or updates a OpenShift managed cluster with the specified configuration for agents and + OpenShift version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the OpenShift managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Create or Update an OpenShift Managed Cluster + operation. Is either a model type or a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2019_09_30_preview.models.OpenShiftManagedCluster or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -375,20 +445,17 @@ async def begin_create_or_update( result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2019_09_30_preview.models.OpenShiftManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-30-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-09-30-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.OpenShiftManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -396,69 +463,66 @@ async def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('OpenShiftManagedCluster', pipeline_response) + deserialized = self._deserialize("OpenShiftManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore async def _update_tags_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.TagsObject, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any ) -> _models.OpenShiftManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2019-09-30-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-09-30-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.OpenShiftManagedCluster] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request_initial( - subscription_id=self._config.subscription_id, + request = build_update_tags_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_tags_initial.metadata['url'], + content=_content, + template_url=self._update_tags_initial.metadata["url"], headers=_headers, params=_params, ) @@ -466,44 +530,48 @@ async def _update_tags_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('OpenShiftManagedCluster', pipeline_response) + deserialized = self._deserialize("OpenShiftManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_tags_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore + _update_tags_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore - - @distributed_trace_async + @overload async def begin_update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.OpenShiftManagedCluster]: """Updates tags on an OpenShift managed cluster. Updates an OpenShift managed cluster with the specified tags. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the OpenShift managed cluster resource. + :param resource_name: The name of the OpenShift managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Update OpenShift Managed Cluster Tags operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2019_09_30_preview.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -516,20 +584,89 @@ async def begin_update_tags( result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2019_09_30_preview.models.OpenShiftManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OpenShiftManagedCluster]: + """Updates tags on an OpenShift managed cluster. + + Updates an OpenShift managed cluster with the specified tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the OpenShift managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update OpenShift Managed Cluster Tags operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either OpenShiftManagedCluster or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2019_09_30_preview.models.OpenShiftManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.OpenShiftManagedCluster]: + """Updates tags on an OpenShift managed cluster. + + Updates an OpenShift managed cluster with the specified tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the OpenShift managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update OpenShift Managed Cluster Tags operation. + Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2019_09_30_preview.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either OpenShiftManagedCluster or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2019_09_30_preview.models.OpenShiftManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-30-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-09-30-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.OpenShiftManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, @@ -537,64 +674,54 @@ async def begin_update_tags( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('OpenShiftManagedCluster', pipeline_response) + deserialized = self._deserialize("OpenShiftManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore + begin_update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-30-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-09-30-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -602,10 +729,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -615,23 +741,17 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: + async def begin_delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Deletes an OpenShift managed cluster. Deletes the OpenShift managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the OpenShift managed cluster resource. + :param resource_name: The name of the OpenShift managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -643,52 +763,45 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-30-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-09-30-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/aio/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/aio/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/aio/operations/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/aio/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/models/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/models/__init__.py index 9bca41fa8e77..2deb9de906cc 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/models/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/models/__init__.py @@ -22,34 +22,32 @@ from ._models_py3 import Resource from ._models_py3 import TagsObject - -from ._container_service_client_enums import ( - OSType, - OpenShiftAgentPoolProfileRole, - OpenShiftContainerServiceVMSize, -) +from ._container_service_client_enums import OSType +from ._container_service_client_enums import OpenShiftAgentPoolProfileRole +from ._container_service_client_enums import OpenShiftContainerServiceVMSize from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'CloudErrorBody', - 'NetworkProfile', - 'OpenShiftManagedCluster', - 'OpenShiftManagedClusterAADIdentityProvider', - 'OpenShiftManagedClusterAgentPoolProfile', - 'OpenShiftManagedClusterAuthProfile', - 'OpenShiftManagedClusterBaseIdentityProvider', - 'OpenShiftManagedClusterIdentityProvider', - 'OpenShiftManagedClusterListResult', - 'OpenShiftManagedClusterMasterPoolProfile', - 'OpenShiftManagedClusterMonitorProfile', - 'OpenShiftRouterProfile', - 'PurchasePlan', - 'Resource', - 'TagsObject', - 'OSType', - 'OpenShiftAgentPoolProfileRole', - 'OpenShiftContainerServiceVMSize', + "CloudErrorBody", + "NetworkProfile", + "OpenShiftManagedCluster", + "OpenShiftManagedClusterAADIdentityProvider", + "OpenShiftManagedClusterAgentPoolProfile", + "OpenShiftManagedClusterAuthProfile", + "OpenShiftManagedClusterBaseIdentityProvider", + "OpenShiftManagedClusterIdentityProvider", + "OpenShiftManagedClusterListResult", + "OpenShiftManagedClusterMasterPoolProfile", + "OpenShiftManagedClusterMonitorProfile", + "OpenShiftRouterProfile", + "PurchasePlan", + "Resource", + "TagsObject", + "OSType", + "OpenShiftAgentPoolProfileRole", + "OpenShiftContainerServiceVMSize", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/models/_container_service_client_enums.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/models/_container_service_client_enums.py index 6c64f62d0661..115c765d1314 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/models/_container_service_client_enums.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/models/_container_service_client_enums.py @@ -11,15 +11,14 @@ class OpenShiftAgentPoolProfileRole(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """OpenShiftAgentPoolProfileRole represents the role of the AgentPoolProfile. - """ + """OpenShiftAgentPoolProfileRole represents the role of the AgentPoolProfile.""" COMPUTE = "compute" INFRA = "infra" + class OpenShiftContainerServiceVMSize(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Size of OpenShift VMs. - """ + """Size of OpenShift VMs.""" STANDARD_D2_S_V3 = "Standard_D2s_v3" STANDARD_D4_S_V3 = "Standard_D4s_v3" @@ -55,9 +54,9 @@ class OpenShiftContainerServiceVMSize(str, Enum, metaclass=CaseInsensitiveEnumMe STANDARD_L16_S = "Standard_L16s" STANDARD_L32_S = "Standard_L32s" + class OSType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """OsType to be used to specify os type. Choose from Linux and Windows. Default to Linux. - """ + """OsType to be used to specify os type. Choose from Linux and Windows. Default to Linux.""" LINUX = "Linux" WINDOWS = "Windows" diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/models/_models_py3.py index dbdb7f1cac9b..58ce29519553 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/models/_models_py3.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/models/_models_py3.py @@ -1,4 +1,5 @@ # coding=utf-8 +# pylint: disable=too-many-lines # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -8,14 +9,14 @@ from typing import Dict, List, Optional, TYPE_CHECKING, Union -import msrest.serialization +from ... import _serialization if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - import __init__ as _models + from .. import models as _models -class CloudErrorBody(msrest.serialization.Model): +class CloudErrorBody(_serialization.Model): """An error response from the Container service. :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed @@ -32,10 +33,10 @@ class CloudErrorBody(msrest.serialization.Model): """ _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[CloudErrorBody]"}, } def __init__( @@ -61,14 +62,14 @@ def __init__( :paramtype details: list[~azure.mgmt.containerservice.v2019_09_30_preview.models.CloudErrorBody] """ - super(CloudErrorBody, self).__init__(**kwargs) + super().__init__(**kwargs) self.code = code self.message = message self.target = target self.details = details -class NetworkProfile(msrest.serialization.Model): +class NetworkProfile(_serialization.Model): """Represents the OpenShift networking configuration. :ivar vnet_cidr: CIDR for the OpenShift Vnet. @@ -80,15 +81,15 @@ class NetworkProfile(msrest.serialization.Model): """ _attribute_map = { - 'vnet_cidr': {'key': 'vnetCidr', 'type': 'str'}, - 'peer_vnet_id': {'key': 'peerVnetId', 'type': 'str'}, - 'vnet_id': {'key': 'vnetId', 'type': 'str'}, + "vnet_cidr": {"key": "vnetCidr", "type": "str"}, + "peer_vnet_id": {"key": "peerVnetId", "type": "str"}, + "vnet_id": {"key": "vnetId", "type": "str"}, } def __init__( self, *, - vnet_cidr: Optional[str] = "10.0.0.0/8", + vnet_cidr: str = "10.0.0.0/8", peer_vnet_id: Optional[str] = None, vnet_id: Optional[str] = None, **kwargs @@ -101,13 +102,13 @@ def __init__( :keyword vnet_id: ID of the Vnet created for OSA cluster. :paramtype vnet_id: str """ - super(NetworkProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.vnet_cidr = vnet_cidr self.peer_vnet_id = peer_vnet_id self.vnet_id = vnet_id -class Resource(msrest.serialization.Model): +class Resource(_serialization.Model): """The Resource model definition. Variables are only populated by the server, and will be ignored when sending a request. @@ -120,41 +121,35 @@ class Resource(msrest.serialization.Model): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] """ - super(Resource, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -162,7 +157,7 @@ def __init__( self.tags = tags -class OpenShiftManagedCluster(Resource): +class OpenShiftManagedCluster(Resource): # pylint: disable=too-many-instance-attributes """OpenShift Managed cluster. Variables are only populated by the server, and will be ignored when sending a request. @@ -175,9 +170,9 @@ class OpenShiftManagedCluster(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar plan: Define the resource plan as required by ARM for billing purposes. :vartype plan: ~azure.mgmt.containerservice.v2019_09_30_preview.models.PurchasePlan @@ -213,34 +208,40 @@ class OpenShiftManagedCluster(Resource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'provisioning_state': {'readonly': True}, - 'cluster_version': {'readonly': True}, - 'public_hostname': {'readonly': True}, - 'fqdn': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, + "provisioning_state": {"readonly": True}, + "cluster_version": {"readonly": True}, + "public_hostname": {"readonly": True}, + "fqdn": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'plan': {'key': 'plan', 'type': 'PurchasePlan'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'open_shift_version': {'key': 'properties.openShiftVersion', 'type': 'str'}, - 'cluster_version': {'key': 'properties.clusterVersion', 'type': 'str'}, - 'public_hostname': {'key': 'properties.publicHostname', 'type': 'str'}, - 'fqdn': {'key': 'properties.fqdn', 'type': 'str'}, - 'network_profile': {'key': 'properties.networkProfile', 'type': 'NetworkProfile'}, - 'router_profiles': {'key': 'properties.routerProfiles', 'type': '[OpenShiftRouterProfile]'}, - 'master_pool_profile': {'key': 'properties.masterPoolProfile', 'type': 'OpenShiftManagedClusterMasterPoolProfile'}, - 'agent_pool_profiles': {'key': 'properties.agentPoolProfiles', 'type': '[OpenShiftManagedClusterAgentPoolProfile]'}, - 'auth_profile': {'key': 'properties.authProfile', 'type': 'OpenShiftManagedClusterAuthProfile'}, - 'monitor_profile': {'key': 'properties.monitorProfile', 'type': 'OpenShiftManagedClusterMonitorProfile'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "plan": {"key": "plan", "type": "PurchasePlan"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "open_shift_version": {"key": "properties.openShiftVersion", "type": "str"}, + "cluster_version": {"key": "properties.clusterVersion", "type": "str"}, + "public_hostname": {"key": "properties.publicHostname", "type": "str"}, + "fqdn": {"key": "properties.fqdn", "type": "str"}, + "network_profile": {"key": "properties.networkProfile", "type": "NetworkProfile"}, + "router_profiles": {"key": "properties.routerProfiles", "type": "[OpenShiftRouterProfile]"}, + "master_pool_profile": { + "key": "properties.masterPoolProfile", + "type": "OpenShiftManagedClusterMasterPoolProfile", + }, + "agent_pool_profiles": { + "key": "properties.agentPoolProfiles", + "type": "[OpenShiftManagedClusterAgentPoolProfile]", + }, + "auth_profile": {"key": "properties.authProfile", "type": "OpenShiftManagedClusterAuthProfile"}, + "monitor_profile": {"key": "properties.monitorProfile", "type": "OpenShiftManagedClusterMonitorProfile"}, } def __init__( @@ -259,9 +260,9 @@ def __init__( **kwargs ): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword plan: Define the resource plan as required by ARM for billing purposes. :paramtype plan: ~azure.mgmt.containerservice.v2019_09_30_preview.models.PurchasePlan @@ -286,7 +287,7 @@ def __init__( :paramtype monitor_profile: ~azure.mgmt.containerservice.v2019_09_30_preview.models.OpenShiftManagedClusterMonitorProfile """ - super(OpenShiftManagedCluster, self).__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.plan = plan self.provisioning_state = None self.open_shift_version = open_shift_version @@ -301,37 +302,31 @@ def __init__( self.monitor_profile = monitor_profile -class OpenShiftManagedClusterBaseIdentityProvider(msrest.serialization.Model): +class OpenShiftManagedClusterBaseIdentityProvider(_serialization.Model): """Structure for any Identity provider. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: OpenShiftManagedClusterAADIdentityProvider. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + OpenShiftManagedClusterAADIdentityProvider All required parameters must be populated in order to send to Azure. - :ivar kind: Required. The kind of the provider.Constant filled by server. + :ivar kind: The kind of the provider. Required. :vartype kind: str """ _validation = { - 'kind': {'required': True}, + "kind": {"required": True}, } _attribute_map = { - 'kind': {'key': 'kind', 'type': 'str'}, + "kind": {"key": "kind", "type": "str"}, } - _subtype_map = { - 'kind': {'AADIdentityProvider': 'OpenShiftManagedClusterAADIdentityProvider'} - } + _subtype_map = {"kind": {"AADIdentityProvider": "OpenShiftManagedClusterAADIdentityProvider"}} - def __init__( - self, - **kwargs - ): - """ - """ - super(OpenShiftManagedClusterBaseIdentityProvider, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.kind = None # type: Optional[str] @@ -340,7 +335,7 @@ class OpenShiftManagedClusterAADIdentityProvider(OpenShiftManagedClusterBaseIden All required parameters must be populated in order to send to Azure. - :ivar kind: Required. The kind of the provider.Constant filled by server. + :ivar kind: The kind of the provider. Required. :vartype kind: str :ivar client_id: The clientId password associated with the provider. :vartype client_id: str @@ -353,15 +348,15 @@ class OpenShiftManagedClusterAADIdentityProvider(OpenShiftManagedClusterBaseIden """ _validation = { - 'kind': {'required': True}, + "kind": {"required": True}, } _attribute_map = { - 'kind': {'key': 'kind', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'secret': {'key': 'secret', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'customer_admin_group_id': {'key': 'customerAdminGroupId', 'type': 'str'}, + "kind": {"key": "kind", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + "secret": {"key": "secret", "type": "str"}, + "tenant_id": {"key": "tenantId", "type": "str"}, + "customer_admin_group_id": {"key": "customerAdminGroupId", "type": "str"}, } def __init__( @@ -383,57 +378,57 @@ def __init__( :keyword customer_admin_group_id: The groupId to be granted cluster admin role. :paramtype customer_admin_group_id: str """ - super(OpenShiftManagedClusterAADIdentityProvider, self).__init__(**kwargs) - self.kind = 'AADIdentityProvider' # type: str + super().__init__(**kwargs) + self.kind = "AADIdentityProvider" # type: str self.client_id = client_id self.secret = secret self.tenant_id = tenant_id self.customer_admin_group_id = customer_admin_group_id -class OpenShiftManagedClusterAgentPoolProfile(msrest.serialization.Model): +class OpenShiftManagedClusterAgentPoolProfile(_serialization.Model): """Defines the configuration of the OpenShift cluster VMs. All required parameters must be populated in order to send to Azure. - :ivar name: Required. Unique name of the pool profile in the context of the subscription and - resource group. + :ivar name: Unique name of the pool profile in the context of the subscription and resource + group. Required. :vartype name: str - :ivar count: Required. Number of agents (VMs) to host docker containers. + :ivar count: Number of agents (VMs) to host docker containers. Required. :vartype count: int - :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_D2s_v3", + :ivar vm_size: Size of agent VMs. Required. Known values are: "Standard_D2s_v3", "Standard_D4s_v3", "Standard_D8s_v3", "Standard_D16s_v3", "Standard_D32s_v3", "Standard_D64s_v3", "Standard_DS4_v2", "Standard_DS5_v2", "Standard_F8s_v2", "Standard_F16s_v2", "Standard_F32s_v2", "Standard_F64s_v2", "Standard_F72s_v2", "Standard_F8s", "Standard_F16s", "Standard_E4s_v3", "Standard_E8s_v3", "Standard_E16s_v3", "Standard_E20s_v3", "Standard_E32s_v3", "Standard_E64s_v3", "Standard_GS2", "Standard_GS3", "Standard_GS4", "Standard_GS5", "Standard_DS12_v2", "Standard_DS13_v2", "Standard_DS14_v2", "Standard_DS15_v2", - "Standard_L4s", "Standard_L8s", "Standard_L16s", "Standard_L32s". + "Standard_L4s", "Standard_L8s", "Standard_L16s", and "Standard_L32s". :vartype vm_size: str or ~azure.mgmt.containerservice.v2019_09_30_preview.models.OpenShiftContainerServiceVMSize :ivar subnet_cidr: Subnet CIDR for the peering. :vartype subnet_cidr: str :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Known values are: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux" and "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2019_09_30_preview.models.OSType - :ivar role: Define the role of the AgentPoolProfile. Known values are: "compute", "infra". + :ivar role: Define the role of the AgentPoolProfile. Known values are: "compute" and "infra". :vartype role: str or ~azure.mgmt.containerservice.v2019_09_30_preview.models.OpenShiftAgentPoolProfileRole """ _validation = { - 'name': {'required': True}, - 'count': {'required': True}, - 'vm_size': {'required': True}, + "name": {"required": True}, + "count": {"required": True}, + "vm_size": {"required": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'count': {'key': 'count', 'type': 'int'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'subnet_cidr': {'key': 'subnetCidr', 'type': 'str'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'role': {'key': 'role', 'type': 'str'}, + "name": {"key": "name", "type": "str"}, + "count": {"key": "count", "type": "int"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "subnet_cidr": {"key": "subnetCidr", "type": "str"}, + "os_type": {"key": "osType", "type": "str"}, + "role": {"key": "role", "type": "str"}, } def __init__( @@ -442,37 +437,38 @@ def __init__( name: str, count: int, vm_size: Union[str, "_models.OpenShiftContainerServiceVMSize"], - subnet_cidr: Optional[str] = "10.0.0.0/24", - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + subnet_cidr: str = "10.0.0.0/24", + os_type: Union[str, "_models.OSType"] = "Linux", role: Optional[Union[str, "_models.OpenShiftAgentPoolProfileRole"]] = None, **kwargs ): """ - :keyword name: Required. Unique name of the pool profile in the context of the subscription and - resource group. + :keyword name: Unique name of the pool profile in the context of the subscription and resource + group. Required. :paramtype name: str - :keyword count: Required. Number of agents (VMs) to host docker containers. + :keyword count: Number of agents (VMs) to host docker containers. Required. :paramtype count: int - :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_D2s_v3", + :keyword vm_size: Size of agent VMs. Required. Known values are: "Standard_D2s_v3", "Standard_D4s_v3", "Standard_D8s_v3", "Standard_D16s_v3", "Standard_D32s_v3", "Standard_D64s_v3", "Standard_DS4_v2", "Standard_DS5_v2", "Standard_F8s_v2", "Standard_F16s_v2", "Standard_F32s_v2", "Standard_F64s_v2", "Standard_F72s_v2", "Standard_F8s", "Standard_F16s", "Standard_E4s_v3", "Standard_E8s_v3", "Standard_E16s_v3", "Standard_E20s_v3", "Standard_E32s_v3", "Standard_E64s_v3", "Standard_GS2", "Standard_GS3", "Standard_GS4", "Standard_GS5", "Standard_DS12_v2", "Standard_DS13_v2", "Standard_DS14_v2", "Standard_DS15_v2", - "Standard_L4s", "Standard_L8s", "Standard_L16s", "Standard_L32s". + "Standard_L4s", "Standard_L8s", "Standard_L16s", and "Standard_L32s". :paramtype vm_size: str or ~azure.mgmt.containerservice.v2019_09_30_preview.models.OpenShiftContainerServiceVMSize :keyword subnet_cidr: Subnet CIDR for the peering. :paramtype subnet_cidr: str :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux" and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2019_09_30_preview.models.OSType - :keyword role: Define the role of the AgentPoolProfile. Known values are: "compute", "infra". + :keyword role: Define the role of the AgentPoolProfile. Known values are: "compute" and + "infra". :paramtype role: str or ~azure.mgmt.containerservice.v2019_09_30_preview.models.OpenShiftAgentPoolProfileRole """ - super(OpenShiftManagedClusterAgentPoolProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.count = count self.vm_size = vm_size @@ -481,7 +477,7 @@ def __init__( self.role = role -class OpenShiftManagedClusterAuthProfile(msrest.serialization.Model): +class OpenShiftManagedClusterAuthProfile(_serialization.Model): """Defines all possible authentication profiles for the OpenShift cluster. :ivar identity_providers: Type of authentication profile to use. @@ -490,25 +486,22 @@ class OpenShiftManagedClusterAuthProfile(msrest.serialization.Model): """ _attribute_map = { - 'identity_providers': {'key': 'identityProviders', 'type': '[OpenShiftManagedClusterIdentityProvider]'}, + "identity_providers": {"key": "identityProviders", "type": "[OpenShiftManagedClusterIdentityProvider]"}, } def __init__( - self, - *, - identity_providers: Optional[List["_models.OpenShiftManagedClusterIdentityProvider"]] = None, - **kwargs + self, *, identity_providers: Optional[List["_models.OpenShiftManagedClusterIdentityProvider"]] = None, **kwargs ): """ :keyword identity_providers: Type of authentication profile to use. :paramtype identity_providers: list[~azure.mgmt.containerservice.v2019_09_30_preview.models.OpenShiftManagedClusterIdentityProvider] """ - super(OpenShiftManagedClusterAuthProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.identity_providers = identity_providers -class OpenShiftManagedClusterIdentityProvider(msrest.serialization.Model): +class OpenShiftManagedClusterIdentityProvider(_serialization.Model): """Defines the configuration of the identity providers to be used in the OpenShift cluster. :ivar name: Name of the provider. @@ -519,8 +512,8 @@ class OpenShiftManagedClusterIdentityProvider(msrest.serialization.Model): """ _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'provider': {'key': 'provider', 'type': 'OpenShiftManagedClusterBaseIdentityProvider'}, + "name": {"key": "name", "type": "str"}, + "provider": {"key": "provider", "type": "OpenShiftManagedClusterBaseIdentityProvider"}, } def __init__( @@ -537,12 +530,12 @@ def __init__( :paramtype provider: ~azure.mgmt.containerservice.v2019_09_30_preview.models.OpenShiftManagedClusterBaseIdentityProvider """ - super(OpenShiftManagedClusterIdentityProvider, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.provider = provider -class OpenShiftManagedClusterListResult(msrest.serialization.Model): +class OpenShiftManagedClusterListResult(_serialization.Model): """The response from the List OpenShift Managed Clusters operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -555,31 +548,26 @@ class OpenShiftManagedClusterListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[OpenShiftManagedCluster]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[OpenShiftManagedCluster]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.OpenShiftManagedCluster"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.OpenShiftManagedCluster"]] = None, **kwargs): """ :keyword value: The list of OpenShift managed clusters. :paramtype value: list[~azure.mgmt.containerservice.v2019_09_30_preview.models.OpenShiftManagedCluster] """ - super(OpenShiftManagedClusterListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class OpenShiftManagedClusterMasterPoolProfile(msrest.serialization.Model): +class OpenShiftManagedClusterMasterPoolProfile(_serialization.Model): """OpenShiftManagedClusterMaterPoolProfile contains configuration for OpenShift master VMs. All required parameters must be populated in order to send to Azure. @@ -587,37 +575,37 @@ class OpenShiftManagedClusterMasterPoolProfile(msrest.serialization.Model): :ivar name: Unique name of the master pool profile in the context of the subscription and resource group. :vartype name: str - :ivar count: Required. Number of masters (VMs) to host docker containers. The default value is - 3. + :ivar count: Number of masters (VMs) to host docker containers. The default value is 3. + Required. :vartype count: int - :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_D2s_v3", + :ivar vm_size: Size of agent VMs. Required. Known values are: "Standard_D2s_v3", "Standard_D4s_v3", "Standard_D8s_v3", "Standard_D16s_v3", "Standard_D32s_v3", "Standard_D64s_v3", "Standard_DS4_v2", "Standard_DS5_v2", "Standard_F8s_v2", "Standard_F16s_v2", "Standard_F32s_v2", "Standard_F64s_v2", "Standard_F72s_v2", "Standard_F8s", "Standard_F16s", "Standard_E4s_v3", "Standard_E8s_v3", "Standard_E16s_v3", "Standard_E20s_v3", "Standard_E32s_v3", "Standard_E64s_v3", "Standard_GS2", "Standard_GS3", "Standard_GS4", "Standard_GS5", "Standard_DS12_v2", "Standard_DS13_v2", "Standard_DS14_v2", "Standard_DS15_v2", - "Standard_L4s", "Standard_L8s", "Standard_L16s", "Standard_L32s". + "Standard_L4s", "Standard_L8s", "Standard_L16s", and "Standard_L32s". :vartype vm_size: str or ~azure.mgmt.containerservice.v2019_09_30_preview.models.OpenShiftContainerServiceVMSize :ivar subnet_cidr: Subnet CIDR for the peering. :vartype subnet_cidr: str :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Known values are: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux" and "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2019_09_30_preview.models.OSType """ _validation = { - 'count': {'required': True}, - 'vm_size': {'required': True}, + "count": {"required": True}, + "vm_size": {"required": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'count': {'key': 'count', 'type': 'int'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'subnet_cidr': {'key': 'subnetCidr', 'type': 'str'}, - 'os_type': {'key': 'osType', 'type': 'str'}, + "name": {"key": "name", "type": "str"}, + "count": {"key": "count", "type": "int"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "subnet_cidr": {"key": "subnetCidr", "type": "str"}, + "os_type": {"key": "osType", "type": "str"}, } def __init__( @@ -627,33 +615,33 @@ def __init__( vm_size: Union[str, "_models.OpenShiftContainerServiceVMSize"], name: Optional[str] = None, subnet_cidr: Optional[str] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", **kwargs ): """ :keyword name: Unique name of the master pool profile in the context of the subscription and resource group. :paramtype name: str - :keyword count: Required. Number of masters (VMs) to host docker containers. The default value - is 3. + :keyword count: Number of masters (VMs) to host docker containers. The default value is 3. + Required. :paramtype count: int - :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_D2s_v3", + :keyword vm_size: Size of agent VMs. Required. Known values are: "Standard_D2s_v3", "Standard_D4s_v3", "Standard_D8s_v3", "Standard_D16s_v3", "Standard_D32s_v3", "Standard_D64s_v3", "Standard_DS4_v2", "Standard_DS5_v2", "Standard_F8s_v2", "Standard_F16s_v2", "Standard_F32s_v2", "Standard_F64s_v2", "Standard_F72s_v2", "Standard_F8s", "Standard_F16s", "Standard_E4s_v3", "Standard_E8s_v3", "Standard_E16s_v3", "Standard_E20s_v3", "Standard_E32s_v3", "Standard_E64s_v3", "Standard_GS2", "Standard_GS3", "Standard_GS4", "Standard_GS5", "Standard_DS12_v2", "Standard_DS13_v2", "Standard_DS14_v2", "Standard_DS15_v2", - "Standard_L4s", "Standard_L8s", "Standard_L16s", "Standard_L32s". + "Standard_L4s", "Standard_L8s", "Standard_L16s", and "Standard_L32s". :paramtype vm_size: str or ~azure.mgmt.containerservice.v2019_09_30_preview.models.OpenShiftContainerServiceVMSize :keyword subnet_cidr: Subnet CIDR for the peering. :paramtype subnet_cidr: str :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux" and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2019_09_30_preview.models.OSType """ - super(OpenShiftManagedClusterMasterPoolProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.count = count self.vm_size = vm_size @@ -661,7 +649,7 @@ def __init__( self.os_type = os_type -class OpenShiftManagedClusterMonitorProfile(msrest.serialization.Model): +class OpenShiftManagedClusterMonitorProfile(_serialization.Model): """Defines the configuration for Log Analytics integration. :ivar workspace_resource_id: Azure Resource Manager Resource ID for the Log Analytics workspace @@ -672,17 +660,11 @@ class OpenShiftManagedClusterMonitorProfile(msrest.serialization.Model): """ _attribute_map = { - 'workspace_resource_id': {'key': 'workspaceResourceID', 'type': 'str'}, - 'enabled': {'key': 'enabled', 'type': 'bool'}, + "workspace_resource_id": {"key": "workspaceResourceID", "type": "str"}, + "enabled": {"key": "enabled", "type": "bool"}, } - def __init__( - self, - *, - workspace_resource_id: Optional[str] = None, - enabled: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, workspace_resource_id: Optional[str] = None, enabled: Optional[bool] = None, **kwargs): """ :keyword workspace_resource_id: Azure Resource Manager Resource ID for the Log Analytics workspace to integrate with. @@ -690,12 +672,12 @@ def __init__( :keyword enabled: If the Log analytics integration should be turned on or off. :paramtype enabled: bool """ - super(OpenShiftManagedClusterMonitorProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.workspace_resource_id = workspace_resource_id self.enabled = enabled -class OpenShiftRouterProfile(msrest.serialization.Model): +class OpenShiftRouterProfile(_serialization.Model): """Represents an OpenShift router. Variables are only populated by the server, and will be ignored when sending a request. @@ -709,33 +691,28 @@ class OpenShiftRouterProfile(msrest.serialization.Model): """ _validation = { - 'public_subdomain': {'readonly': True}, - 'fqdn': {'readonly': True}, + "public_subdomain": {"readonly": True}, + "fqdn": {"readonly": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'public_subdomain': {'key': 'publicSubdomain', 'type': 'str'}, - 'fqdn': {'key': 'fqdn', 'type': 'str'}, + "name": {"key": "name", "type": "str"}, + "public_subdomain": {"key": "publicSubdomain", "type": "str"}, + "fqdn": {"key": "fqdn", "type": "str"}, } - def __init__( - self, - *, - name: Optional[str] = None, - **kwargs - ): + def __init__(self, *, name: Optional[str] = None, **kwargs): """ :keyword name: Name of the router profile. :paramtype name: str """ - super(OpenShiftRouterProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.public_subdomain = None self.fqdn = None -class PurchasePlan(msrest.serialization.Model): +class PurchasePlan(_serialization.Model): """Used for establishing the purchase context of any 3rd Party artifact through MarketPlace. :ivar name: The plan ID. @@ -750,10 +727,10 @@ class PurchasePlan(msrest.serialization.Model): """ _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'product': {'key': 'product', 'type': 'str'}, - 'promotion_code': {'key': 'promotionCode', 'type': 'str'}, - 'publisher': {'key': 'publisher', 'type': 'str'}, + "name": {"key": "name", "type": "str"}, + "product": {"key": "product", "type": "str"}, + "promotion_code": {"key": "promotionCode", "type": "str"}, + "publisher": {"key": "publisher", "type": "str"}, } def __init__( @@ -776,33 +753,28 @@ def __init__( :keyword publisher: The plan ID. :paramtype publisher: str """ - super(PurchasePlan, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.product = product self.promotion_code = promotion_code self.publisher = publisher -class TagsObject(msrest.serialization.Model): +class TagsObject(_serialization.Model): """Tags object for patch operations. - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] """ _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] """ - super(TagsObject, self).__init__(**kwargs) + super().__init__(**kwargs) self.tags = tags diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/models/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/models/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/models/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/models/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/operations/__init__.py index 211a87879804..69775b67d4ba 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/operations/__init__.py @@ -11,8 +11,9 @@ from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'OpenShiftManagedClustersOperations', + "OpenShiftManagedClustersOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/operations/_open_shift_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/operations/_open_shift_managed_clusters_operations.py index 50895b9aec19..57dd92c655af 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/operations/_open_shift_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/operations/_open_shift_managed_clusters_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,243 +27,197 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-30-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-09-30-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/openShiftManagedClusters") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/openShiftManagedClusters" + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_resource_group_request( - subscription_id: str, - resource_group_name: str, - **kwargs: Any -) -> HttpRequest: +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-30-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-09-30-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters", + ) # 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', min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: + _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, resource_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-30-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-09-30-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.OpenShiftManagedCluster] = None, - content: Any = None, - **kwargs: Any + _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, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-30-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-09-30-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) - - -def build_update_tags_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.TagsObject] = None, - content: Any = None, - **kwargs: Any + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_tags_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-30-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-09-30-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-30-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-09-30-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class OpenShiftManagedClustersOperations: """ @@ -279,41 +238,36 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.OpenShiftManagedClusterListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.OpenShiftManagedCluster"]: """Gets a list of OpenShift managed clusters in the specified subscription. Gets a list of OpenShift managed clusters in the specified subscription. The operation returns properties of each OpenShift managed cluster. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OpenShiftManagedClusterListResult or the result of + :return: An iterator like instance of either OpenShiftManagedCluster or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2019_09_30_preview.models.OpenShiftManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2019_09_30_preview.models.OpenShiftManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-30-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-09-30-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OpenShiftManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -321,14 +275,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -344,10 +295,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -357,50 +306,45 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/openShiftManagedClusters"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/openShiftManagedClusters"} # type: ignore @distributed_trace def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> Iterable[_models.OpenShiftManagedClusterListResult]: + self, resource_group_name: str, **kwargs: Any + ) -> Iterable["_models.OpenShiftManagedCluster"]: """Lists OpenShift managed clusters in the specified subscription and resource group. Lists OpenShift managed clusters in the specified subscription and resource group. The operation returns properties of each OpenShift managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OpenShiftManagedClusterListResult or the result of + :return: An iterator like instance of either OpenShiftManagedCluster or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2019_09_30_preview.models.OpenShiftManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2019_09_30_preview.models.OpenShiftManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-30-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-09-30-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OpenShiftManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -408,15 +352,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -432,10 +372,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -445,50 +383,40 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters"} # type: ignore @distributed_trace - def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.OpenShiftManagedCluster: + def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.OpenShiftManagedCluster: """Gets a OpenShift managed cluster. Gets the details of the managed OpenShift cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the OpenShift managed cluster resource. + :param resource_name: The name of the OpenShift managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: OpenShiftManagedCluster, or the result of cls(response) + :return: OpenShiftManagedCluster or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_09_30_preview.models.OpenShiftManagedCluster - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-30-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-09-30-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OpenShiftManagedCluster] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -496,55 +424,58 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('OpenShiftManagedCluster', pipeline_response) + deserialized = self._deserialize("OpenShiftManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore def _create_or_update_initial( self, resource_group_name: str, resource_name: str, - parameters: _models.OpenShiftManagedCluster, + parameters: Union[_models.OpenShiftManagedCluster, IO], **kwargs: Any ) -> _models.OpenShiftManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2019-09-30-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-09-30-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.OpenShiftManagedCluster] - _json = self._serialize.body(parameters, 'OpenShiftManagedCluster') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "OpenShiftManagedCluster") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -552,10 +483,9 @@ def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -563,25 +493,26 @@ def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('OpenShiftManagedCluster', pipeline_response) + deserialized = self._deserialize("OpenShiftManagedCluster", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('OpenShiftManagedCluster', pipeline_response) + deserialized = self._deserialize("OpenShiftManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore - - @distributed_trace + @overload def begin_create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.OpenShiftManagedCluster, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.OpenShiftManagedCluster]: """Creates or updates an OpenShift managed cluster. @@ -589,14 +520,17 @@ def begin_create_or_update( Creates or updates a OpenShift managed cluster with the specified configuration for agents and OpenShift version. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the OpenShift managed cluster resource. + :param resource_name: The name of the OpenShift managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Create or Update an OpenShift Managed Cluster - operation. + operation. Required. :type parameters: ~azure.mgmt.containerservice.v2019_09_30_preview.models.OpenShiftManagedCluster + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -609,20 +543,96 @@ def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2019_09_30_preview.models.OpenShiftManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OpenShiftManagedCluster]: + """Creates or updates an OpenShift managed cluster. + + Creates or updates a OpenShift managed cluster with the specified configuration for agents and + OpenShift version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the OpenShift managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Create or Update an OpenShift Managed Cluster + operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either OpenShiftManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2019_09_30_preview.models.OpenShiftManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.OpenShiftManagedCluster, IO], + **kwargs: Any + ) -> LROPoller[_models.OpenShiftManagedCluster]: + """Creates or updates an OpenShift managed cluster. + + Creates or updates a OpenShift managed cluster with the specified configuration for agents and + OpenShift version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the OpenShift managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Create or Update an OpenShift Managed Cluster + operation. Is either a model type or a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2019_09_30_preview.models.OpenShiftManagedCluster or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either OpenShiftManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2019_09_30_preview.models.OpenShiftManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-30-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-09-30-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.OpenShiftManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -630,69 +640,66 @@ def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('OpenShiftManagedCluster', pipeline_response) + deserialized = self._deserialize("OpenShiftManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore def _update_tags_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.TagsObject, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any ) -> _models.OpenShiftManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2019-09-30-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-09-30-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.OpenShiftManagedCluster] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request_initial( - subscription_id=self._config.subscription_id, + request = build_update_tags_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_tags_initial.metadata['url'], + content=_content, + template_url=self._update_tags_initial.metadata["url"], headers=_headers, params=_params, ) @@ -700,44 +707,87 @@ def _update_tags_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('OpenShiftManagedCluster', pipeline_response) + deserialized = self._deserialize("OpenShiftManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_tags_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore + _update_tags_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore - - @distributed_trace + @overload def begin_update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.OpenShiftManagedCluster]: """Updates tags on an OpenShift managed cluster. Updates an OpenShift managed cluster with the specified tags. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the OpenShift managed cluster resource. + :param resource_name: The name of the OpenShift managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Update OpenShift Managed Cluster Tags operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2019_09_30_preview.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either OpenShiftManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2019_09_30_preview.models.OpenShiftManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OpenShiftManagedCluster]: + """Updates tags on an OpenShift managed cluster. + + Updates an OpenShift managed cluster with the specified tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the OpenShift managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update OpenShift Managed Cluster Tags operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -750,20 +800,50 @@ def begin_update_tags( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2019_09_30_preview.models.OpenShiftManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> LROPoller[_models.OpenShiftManagedCluster]: + """Updates tags on an OpenShift managed cluster. + + Updates an OpenShift managed cluster with the specified tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the OpenShift managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update OpenShift Managed Cluster Tags operation. + Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2019_09_30_preview.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either OpenShiftManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2019_09_30_preview.models.OpenShiftManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-30-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-09-30-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.OpenShiftManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, @@ -771,64 +851,54 @@ def begin_update_tags( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('OpenShiftManagedCluster', pipeline_response) + deserialized = self._deserialize("OpenShiftManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore + begin_update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-30-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-09-30-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -836,10 +906,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -849,23 +918,17 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> LROPoller[None]: + def begin_delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> LROPoller[None]: """Deletes an OpenShift managed cluster. Deletes the OpenShift managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the OpenShift managed cluster resource. + :param resource_name: The name of the OpenShift managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -877,52 +940,45 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-30-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-09-30-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/operations/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/__init__.py index 37a5f9e02e6f..a8716d29afe8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/__init__.py @@ -14,7 +14,8 @@ except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['ContainerServiceClient'] + +__all__ = ["ContainerServiceClient"] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/_configuration.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/_configuration.py index 7020525ac37c..6399c6a6b37c 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/_configuration.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/_configuration.py @@ -18,30 +18,26 @@ VERSION = "unknown" + class ContainerServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ContainerServiceClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2019-10-01". 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: + def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ContainerServiceClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2019-10-01") # type: str + api_version = kwargs.pop("api_version", "2019-10-01") # type: str if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -51,23 +47,24 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-containerservice/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-containerservice/{}".format(VERSION)) self._configure(**kwargs) def _configure( - self, - **kwargs # type: Any + self, **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/_container_service_client.py index 1aa2e31ad515..e41ad388160a 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/_container_service_client.py @@ -9,12 +9,11 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from . import models +from .._serialization import Deserializer, Serializer from ._configuration import ContainerServiceClientConfiguration from .operations import AgentPoolsOperations, ManagedClustersOperations, Operations @@ -22,7 +21,8 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class ContainerServiceClient: + +class ContainerServiceClient: # pylint: disable=client-accepts-api-version-keyword """The Container Service Client. :ivar operations: Operations operations @@ -32,10 +32,10 @@ class ContainerServiceClient: azure.mgmt.containerservice.v2019_10_01.operations.ManagedClustersOperations :ivar agent_pools: AgentPoolsOperations operations :vartype agent_pools: azure.mgmt.containerservice.v2019_10_01.operations.AgentPoolsOperations - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -53,29 +53,22 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = ContainerServiceClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = ContainerServiceClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize - ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.managed_clusters = ManagedClustersOperations( self._client, self._config, self._serialize, self._deserialize ) - self.agent_pools = AgentPoolsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - + self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> HttpResponse: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -84,7 +77,7 @@ def _send_request( >>> response = client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/_metadata.json b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/_metadata.json index 04d9e59c67c3..98b4a075a5e0 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/_metadata.json +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/_metadata.json @@ -10,20 +10,20 @@ "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { "credential": { - "signature": "credential, # type: \"TokenCredential\"", - "description": "Credential needed for the client to connect to Azure.", + "signature": "credential: \"TokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true }, "subscription_id": { - "signature": "subscription_id, # type: str", - "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "signature": "subscription_id: str,", + "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.", "docstring_type": "str", "required": true } @@ -31,13 +31,13 @@ "async": { "credential": { "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure.", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { "signature": "subscription_id: str,", - "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.", "docstring_type": "str", "required": true } @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=\"https://management.azure.com\", # type: str", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/_patch.py index 74e48ecd07cf..f99e77fef986 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/_patch.py @@ -28,4 +28,4 @@ # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + pass diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/_vendor.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/_vendor.py index 138f663c53a4..9aad73fc743e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/_vendor.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/_vendor.py @@ -7,6 +7,7 @@ from azure.core.pipeline.transport import HttpRequest + def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) @@ -14,6 +15,7 @@ def _convert_request(request, files=None): request.set_formdata_body(files) return request + def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -21,7 +23,5 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [ - c for c in formatted_components if "{}".format(key.args[0]) not in c - ] + components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/aio/__init__.py index 37a5f9e02e6f..a8716d29afe8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/aio/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/aio/__init__.py @@ -14,7 +14,8 @@ except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['ContainerServiceClient'] + +__all__ = ["ContainerServiceClient"] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/aio/_configuration.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/aio/_configuration.py index 24361dbc735c..6e877f3fe23d 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/aio/_configuration.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/aio/_configuration.py @@ -18,30 +18,26 @@ VERSION = "unknown" + class ContainerServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ContainerServiceClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2019-10-01". 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: + def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ContainerServiceClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2019-10-01") # type: str + api_version = kwargs.pop("api_version", "2019-10-01") # type: str if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -51,22 +47,21 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-containerservice/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-containerservice/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, - **kwargs: Any - ) -> None: - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/aio/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/aio/_container_service_client.py index ae6051baa82c..6d0f209d50e8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/aio/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/aio/_container_service_client.py @@ -9,12 +9,11 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from .. import models +from ..._serialization import Deserializer, Serializer from ._configuration import ContainerServiceClientConfiguration from .operations import AgentPoolsOperations, ManagedClustersOperations, Operations @@ -22,7 +21,8 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class ContainerServiceClient: + +class ContainerServiceClient: # pylint: disable=client-accepts-api-version-keyword """The Container Service Client. :ivar operations: Operations operations @@ -33,10 +33,10 @@ class ContainerServiceClient: :ivar agent_pools: AgentPoolsOperations operations :vartype agent_pools: azure.mgmt.containerservice.v2019_10_01.aio.operations.AgentPoolsOperations - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -54,29 +54,22 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = ContainerServiceClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = ContainerServiceClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize - ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.managed_clusters = ManagedClustersOperations( self._client, self._config, self._serialize, self._deserialize ) - self.agent_pools = AgentPoolsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - + self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -85,7 +78,7 @@ def _send_request( >>> response = await client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/aio/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/aio/_patch.py index 74e48ecd07cf..f99e77fef986 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/aio/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/aio/_patch.py @@ -28,4 +28,4 @@ # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + pass diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/aio/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/aio/operations/__init__.py index 403c0174f052..ee6608454b6b 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/aio/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/aio/operations/__init__.py @@ -13,10 +13,11 @@ from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'Operations', - 'ManagedClustersOperations', - 'AgentPoolsOperations', + "Operations", + "ManagedClustersOperations", + "AgentPoolsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/aio/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/aio/operations/_agent_pools_operations.py index e0e16c336d86..e111e12496b3 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/aio/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/aio/operations/_agent_pools_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +29,19 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._agent_pools_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_available_agent_pool_versions_request, build_get_request, build_get_upgrade_profile_request, build_list_request -T = TypeVar('T') +from ...operations._agent_pools_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_available_agent_pool_versions_request, + build_get_request, + build_get_upgrade_profile_request, + build_list_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class AgentPoolsOperations: """ .. warning:: @@ -45,48 +61,41 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.AgentPoolListResult]: + def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncIterable["_models.AgentPool"]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. The operation returns properties of each agent pool. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AgentPoolListResult or the result of cls(response) + :return: An iterator like instance of either AgentPool or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2019_10_01.models.AgentPoolListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2019_10_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -94,16 +103,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -119,10 +123,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -132,54 +134,45 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore @distributed_trace_async async def get( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPool: """Gets the agent pool. Gets the details of the agent pool by managed cluster and resource group. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPool, or the result of cls(response) + :return: AgentPool or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_10_01.models.AgentPool - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -187,57 +180,60 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore async def _create_or_update_initial( self, resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: _models.AgentPool, + parameters: Union[_models.AgentPool, IO], **kwargs: Any ) -> _models.AgentPool: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - _json = self._serialize.body(parameters, 'AgentPool') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "AgentPool") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -245,10 +241,9 @@ async def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -256,40 +251,45 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - - @distributed_trace_async + @overload async def begin_create_or_update( self, resource_group_name: str, resource_name: str, agent_pool_name: str, parameters: _models.AgentPool, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.AgentPool]: """Creates or updates an agent pool. Creates or updates an agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :param parameters: Parameters supplied to the Create or Update an agent pool operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2019_10_01.models.AgentPool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -302,20 +302,99 @@ async def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2019_10_01.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AgentPool]: + """Creates or updates an agent pool. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: Parameters supplied to the Create or Update an agent pool operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AgentPool or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2019_10_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: Union[_models.AgentPool, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.AgentPool]: + """Creates or updates an agent pool. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: Parameters supplied to the Create or Update an agent pool operation. Is + either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2019_10_01.models.AgentPool or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AgentPool or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2019_10_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -324,66 +403,55 @@ async def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -391,10 +459,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -404,26 +471,21 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + async def begin_delete( + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes an agent pool. Deletes the agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -435,100 +497,86 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace_async async def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPoolUpgradeProfile: """Gets upgrade profile for an agent pool. Gets the details of the upgrade profile for an agent pool with a specified resource group and managed cluster name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolUpgradeProfile, or the result of cls(response) + :return: AgentPoolUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_10_01.models.AgentPoolUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -536,64 +584,56 @@ async def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolUpgradeProfile', pipeline_response) + deserialized = self._deserialize("AgentPoolUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore @distributed_trace_async async def get_available_agent_pool_versions( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported versions for the specified agent pool. Gets a list of supported versions for the specified agent pool. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolAvailableVersions, or the result of cls(response) + :return: AgentPoolAvailableVersions or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_10_01.models.AgentPoolAvailableVersions - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolAvailableVersions] - request = build_get_available_agent_pool_versions_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_available_agent_pool_versions.metadata['url'], + template_url=self.get_available_agent_pool_versions.metadata["url"], headers=_headers, params=_params, ) @@ -601,22 +641,20 @@ async def get_available_agent_pool_versions( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolAvailableVersions', pipeline_response) + deserialized = self._deserialize("AgentPoolAvailableVersions", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_available_agent_pool_versions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore - + get_available_agent_pool_versions.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/aio/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/aio/operations/_managed_clusters_operations.py index 6e0a24de85e8..9837357ae284 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/aio/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/aio/operations/_managed_clusters_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +29,27 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._managed_clusters_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_access_profile_request, build_get_request, build_get_upgrade_profile_request, build_list_by_resource_group_request, build_list_cluster_admin_credentials_request, build_list_cluster_monitoring_user_credentials_request, build_list_cluster_user_credentials_request, build_list_request, build_reset_aad_profile_request_initial, build_reset_service_principal_profile_request_initial, build_rotate_cluster_certificates_request_initial, build_update_tags_request_initial -T = TypeVar('T') +from ...operations._managed_clusters_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_access_profile_request, + build_get_request, + build_get_upgrade_profile_request, + build_list_by_resource_group_request, + build_list_cluster_admin_credentials_request, + build_list_cluster_monitoring_user_credentials_request, + build_list_cluster_user_credentials_request, + build_list_request, + build_reset_aad_profile_request, + build_reset_service_principal_profile_request, + build_rotate_cluster_certificates_request, + build_update_tags_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class ManagedClustersOperations: """ .. warning:: @@ -45,41 +69,35 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.ManagedClusterListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.ManagedCluster"]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. The operation returns properties of each managed cluster. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2019_10_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2019_10_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -87,14 +105,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -110,10 +125,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -123,50 +136,44 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.ManagedClusterListResult]: + self, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ManagedCluster"]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. The operation returns properties of each managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2019_10_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2019_10_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -174,15 +181,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -198,10 +201,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -211,51 +212,43 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace_async async def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.ManagedClusterUpgradeProfile: """Gets upgrade profile for a managed cluster. Gets the details of the upgrade profile for a managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterUpgradeProfile, or the result of cls(response) + :return: ManagedClusterUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_10_01.models.ManagedClusterUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -263,69 +256,60 @@ async def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterUpgradeProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore @distributed_trace_async async def get_access_profile( - self, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, role_name: str, **kwargs: Any ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. Gets the accessProfile for the specified role name of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param role_name: The name of the role for managed cluster accessProfile resource. + :param role_name: The name of the role for managed cluster accessProfile resource. Required. :type role_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterAccessProfile, or the result of cls(response) + :return: ManagedClusterAccessProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_10_01.models.ManagedClusterAccessProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterAccessProfile] - request = build_get_access_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, role_name=role_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_access_profile.metadata['url'], + template_url=self.get_access_profile.metadata["url"], headers=_headers, params=_params, ) @@ -333,64 +317,56 @@ async def get_access_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterAccessProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterAccessProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_access_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore - + get_access_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore @distributed_trace_async async def list_cluster_admin_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster admin credential of a managed cluster. Gets cluster admin credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_10_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_admin_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_admin_credentials.metadata['url'], + template_url=self.list_cluster_admin_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -398,64 +374,56 @@ async def list_cluster_admin_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_admin_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore - + list_cluster_admin_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore @distributed_trace_async async def list_cluster_user_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster user credential of a managed cluster. Gets cluster user credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_10_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_user_credentials.metadata['url'], + template_url=self.list_cluster_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -463,65 +431,57 @@ async def list_cluster_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore - + list_cluster_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore @distributed_trace_async async def list_cluster_monitoring_user_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster monitoring user credential of a managed cluster. Gets cluster monitoring user credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_10_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_monitoring_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + template_url=self.list_cluster_monitoring_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -529,64 +489,54 @@ async def list_cluster_monitoring_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_monitoring_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore - + list_cluster_monitoring_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore @distributed_trace_async - async def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.ManagedCluster: + async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.ManagedCluster: """Gets a managed cluster. Gets the details of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedCluster, or the result of cls(response) + :return: ManagedCluster or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_10_01.models.ManagedCluster - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -594,55 +544,54 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _create_or_update_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.ManagedCluster, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'ManagedCluster') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedCluster") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -650,10 +599,9 @@ async def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -661,25 +609,26 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - @distributed_trace_async + @overload async def begin_create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedCluster, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. @@ -687,12 +636,90 @@ async def begin_create_or_update( Creates or updates a managed cluster with the specified configuration for agents and Kubernetes version. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2019_10_01.models.ManagedCluster + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2019_10_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster with the specified configuration for agents and Kubernetes + version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2019_10_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster with the specified configuration for agents and Kubernetes + version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. Is + either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2019_10_01.models.ManagedCluster or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -705,20 +732,17 @@ async def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2019_10_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -726,69 +750,66 @@ async def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _update_tags_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.TagsObject, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request_initial( - subscription_id=self._config.subscription_id, + request = build_update_tags_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_tags_initial.metadata['url'], + content=_content, + template_url=self._update_tags_initial.metadata["url"], headers=_headers, params=_params, ) @@ -796,44 +817,85 @@ async def _update_tags_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_tags_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _update_tags_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - @distributed_trace_async + @overload async def begin_update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates a managed cluster with the specified tags. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2019_10_01.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2019_10_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates a managed cluster with the specified tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -846,20 +908,50 @@ async def begin_update_tags( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2019_10_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates a managed cluster with the specified tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2019_10_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2019_10_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, @@ -867,64 +959,54 @@ async def begin_update_tags( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -932,10 +1014,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -945,23 +1026,17 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: + async def begin_delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Deletes a managed cluster. Deletes the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -973,85 +1048,83 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterServicePrincipalProfile, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterServicePrincipalProfile") - request = build_reset_service_principal_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_service_principal_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_service_principal_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_service_principal_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1059,10 +1132,9 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1072,29 +1144,106 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist if cls: return cls(pipeline_response, None, {}) - _reset_service_principal_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore - + _reset_service_principal_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore - @distributed_trace_async - async def begin_reset_service_principal_profile( # pylint: disable=inconsistent-return-statements + @overload + async def begin_reset_service_principal_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterServicePrincipalProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: """Reset Service Principal Profile of a managed cluster. Update the service principal Profile for a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a - Managed Cluster. + Managed Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2019_10_01.models.ManagedClusterServicePrincipalProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset Service Principal Profile of a managed cluster. + + Update the service principal Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a + Managed Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset Service Principal Profile of a managed cluster. + + Update the service principal Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a + Managed Cluster. Is either a model type or a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2019_10_01.models.ManagedClusterServicePrincipalProfile or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -1105,20 +1254,17 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1126,67 +1272,68 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_service_principal_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + begin_reset_service_principal_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterAADProfile, + parameters: Union[_models.ManagedClusterAADProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterAADProfile") - request = build_reset_aad_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_aad_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_aad_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_aad_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1194,10 +1341,9 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1207,28 +1353,69 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta if cls: return cls(pipeline_response, None, {}) - _reset_aad_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - + _reset_aad_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - @distributed_trace_async - async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements + @overload + async def begin_reset_aad_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterAADProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: """Reset AAD Profile of a managed cluster. Update the AAD Profile for a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed - Cluster. + Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2019_10_01.models.ManagedClusterAADProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset AAD Profile of a managed cluster. + + Update the AAD Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed + Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -1239,20 +1426,53 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterAADProfile, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset AAD Profile of a managed cluster. + + Update the AAD Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed + Cluster. Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2019_10_01.models.ManagedClusterAADProfile or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1260,62 +1480,52 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_aad_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + begin_reset_aad_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_rotate_cluster_certificates_request_initial( - subscription_id=self._config.subscription_id, + request = build_rotate_cluster_certificates_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._rotate_cluster_certificates_initial.metadata['url'], + template_url=self._rotate_cluster_certificates_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1323,10 +1533,9 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1336,23 +1545,19 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- if cls: return cls(pipeline_response, None, {}) - _rotate_cluster_certificates_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore - + _rotate_cluster_certificates_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore @distributed_trace_async - async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + async def begin_rotate_cluster_certificates( + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Rotate certificates of a managed cluster. Rotate certificates of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1364,52 +1569,45 @@ async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-ret Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._rotate_cluster_certificates_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_rotate_cluster_certificates.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore + begin_rotate_cluster_certificates.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/aio/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/aio/operations/_operations.py index 54530a8e359e..dc54b272b300 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/aio/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/aio/operations/_operations.py @@ -7,9 +7,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,9 +27,11 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._operations import build_list_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class Operations: """ .. warning:: @@ -42,36 +51,31 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.OperationListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.OperationValue"]: """Gets a list of compute operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationListResult or the result of cls(response) + :return: An iterator like instance of either OperationValue or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2019_10_01.models.OperationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2019_10_01.models.OperationValue] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -79,13 +83,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -101,10 +103,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -114,8 +114,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.ContainerService/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ContainerService/operations"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/aio/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/aio/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/aio/operations/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/aio/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/models/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/models/__init__.py index f8a486e34973..51fdad52c264 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/models/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/models/__init__.py @@ -47,75 +47,73 @@ from ._models_py3 import SubResource from ._models_py3 import TagsObject - -from ._container_service_client_enums import ( - AgentPoolType, - ContainerServiceStorageProfileTypes, - ContainerServiceVMSizeTypes, - Count, - LoadBalancerSku, - NetworkPlugin, - NetworkPolicy, - OSType, - ResourceIdentityType, - ScaleSetEvictionPolicy, - ScaleSetPriority, -) +from ._container_service_client_enums import AgentPoolType +from ._container_service_client_enums import ContainerServiceStorageProfileTypes +from ._container_service_client_enums import ContainerServiceVMSizeTypes +from ._container_service_client_enums import Count +from ._container_service_client_enums import LoadBalancerSku +from ._container_service_client_enums import NetworkPlugin +from ._container_service_client_enums import NetworkPolicy +from ._container_service_client_enums import OSType +from ._container_service_client_enums import ResourceIdentityType +from ._container_service_client_enums import ScaleSetEvictionPolicy +from ._container_service_client_enums import ScaleSetPriority from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'AgentPool', - 'AgentPoolAvailableVersions', - 'AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem', - 'AgentPoolListResult', - 'AgentPoolUpgradeProfile', - 'AgentPoolUpgradeProfilePropertiesUpgradesItem', - 'CloudErrorBody', - 'ContainerServiceDiagnosticsProfile', - 'ContainerServiceLinuxProfile', - 'ContainerServiceMasterProfile', - 'ContainerServiceNetworkProfile', - 'ContainerServiceSshConfiguration', - 'ContainerServiceSshPublicKey', - 'ContainerServiceVMDiagnostics', - 'CredentialResult', - 'CredentialResults', - 'ManagedCluster', - 'ManagedClusterAADProfile', - 'ManagedClusterAPIServerAccessProfile', - 'ManagedClusterAccessProfile', - 'ManagedClusterAddonProfile', - 'ManagedClusterAgentPoolProfile', - 'ManagedClusterAgentPoolProfileProperties', - 'ManagedClusterIdentity', - 'ManagedClusterListResult', - 'ManagedClusterLoadBalancerProfile', - 'ManagedClusterLoadBalancerProfileManagedOutboundIPs', - 'ManagedClusterLoadBalancerProfileOutboundIPPrefixes', - 'ManagedClusterLoadBalancerProfileOutboundIPs', - 'ManagedClusterPoolUpgradeProfile', - 'ManagedClusterPoolUpgradeProfileUpgradesItem', - 'ManagedClusterServicePrincipalProfile', - 'ManagedClusterUpgradeProfile', - 'ManagedClusterWindowsProfile', - 'OperationListResult', - 'OperationValue', - 'Resource', - 'ResourceReference', - 'SubResource', - 'TagsObject', - 'AgentPoolType', - 'ContainerServiceStorageProfileTypes', - 'ContainerServiceVMSizeTypes', - 'Count', - 'LoadBalancerSku', - 'NetworkPlugin', - 'NetworkPolicy', - 'OSType', - 'ResourceIdentityType', - 'ScaleSetEvictionPolicy', - 'ScaleSetPriority', + "AgentPool", + "AgentPoolAvailableVersions", + "AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem", + "AgentPoolListResult", + "AgentPoolUpgradeProfile", + "AgentPoolUpgradeProfilePropertiesUpgradesItem", + "CloudErrorBody", + "ContainerServiceDiagnosticsProfile", + "ContainerServiceLinuxProfile", + "ContainerServiceMasterProfile", + "ContainerServiceNetworkProfile", + "ContainerServiceSshConfiguration", + "ContainerServiceSshPublicKey", + "ContainerServiceVMDiagnostics", + "CredentialResult", + "CredentialResults", + "ManagedCluster", + "ManagedClusterAADProfile", + "ManagedClusterAPIServerAccessProfile", + "ManagedClusterAccessProfile", + "ManagedClusterAddonProfile", + "ManagedClusterAgentPoolProfile", + "ManagedClusterAgentPoolProfileProperties", + "ManagedClusterIdentity", + "ManagedClusterListResult", + "ManagedClusterLoadBalancerProfile", + "ManagedClusterLoadBalancerProfileManagedOutboundIPs", + "ManagedClusterLoadBalancerProfileOutboundIPPrefixes", + "ManagedClusterLoadBalancerProfileOutboundIPs", + "ManagedClusterPoolUpgradeProfile", + "ManagedClusterPoolUpgradeProfileUpgradesItem", + "ManagedClusterServicePrincipalProfile", + "ManagedClusterUpgradeProfile", + "ManagedClusterWindowsProfile", + "OperationListResult", + "OperationValue", + "Resource", + "ResourceReference", + "SubResource", + "TagsObject", + "AgentPoolType", + "ContainerServiceStorageProfileTypes", + "ContainerServiceVMSizeTypes", + "Count", + "LoadBalancerSku", + "NetworkPlugin", + "NetworkPolicy", + "OSType", + "ResourceIdentityType", + "ScaleSetEvictionPolicy", + "ScaleSetPriority", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/models/_container_service_client_enums.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/models/_container_service_client_enums.py index f2a8ca90fcb1..955905f1536f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/models/_container_service_client_enums.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/models/_container_service_client_enums.py @@ -18,6 +18,7 @@ class AgentPoolType(str, Enum, metaclass=CaseInsensitiveEnumMeta): VIRTUAL_MACHINE_SCALE_SETS = "VirtualMachineScaleSets" AVAILABILITY_SET = "AvailabilitySet" + class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the orchestrator choice. @@ -26,9 +27,9 @@ class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEn STORAGE_ACCOUNT = "StorageAccount" MANAGED_DISKS = "ManagedDisks" + class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Size of agent VMs. - """ + """Size of agent VMs.""" STANDARD_A1 = "Standard_A1" STANDARD_A10 = "Standard_A10" @@ -205,6 +206,7 @@ class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): STANDARD_NV24 = "Standard_NV24" STANDARD_NV6 = "Standard_NV6" + class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): """Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, and 5. The default value is 1. @@ -214,34 +216,35 @@ class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): THREE = 3 FIVE = 5 + class LoadBalancerSku(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The load balancer sku for the managed cluster. - """ + """The load balancer sku for the managed cluster.""" STANDARD = "standard" BASIC = "basic" + class NetworkPlugin(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Network plugin used for building Kubernetes network. - """ + """Network plugin used for building Kubernetes network.""" AZURE = "azure" KUBENET = "kubenet" + class NetworkPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Network policy used for building Kubernetes network. - """ + """Network policy used for building Kubernetes network.""" CALICO = "calico" AZURE = "azure" + class OSType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """OsType to be used to specify os type. Choose from Linux and Windows. Default to Linux. - """ + """OsType to be used to specify os type. Choose from Linux and Windows. Default to Linux.""" LINUX = "Linux" WINDOWS = "Windows" + class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of identity used for the managed cluster. Type 'SystemAssigned' will use an implicitly created identity in master components and an auto-created user assigned identity in MC_ @@ -252,6 +255,7 @@ class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): SYSTEM_ASSIGNED = "SystemAssigned" NONE = "None" + class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ScaleSetEvictionPolicy to be used to specify eviction policy for low priority virtual machine scale set. Default to Delete. @@ -260,9 +264,9 @@ class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): DELETE = "Delete" DEALLOCATE = "Deallocate" + class ScaleSetPriority(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """ScaleSetPriority to be used to specify virtual machine scale set priority. Default to regular. - """ + """ScaleSetPriority to be used to specify virtual machine scale set priority. Default to regular.""" LOW = "Low" REGULAR = "Regular" diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/models/_models_py3.py index a62cbbe0d057..afdc1d9bd309 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/models/_models_py3.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/models/_models_py3.py @@ -1,4 +1,5 @@ # coding=utf-8 +# pylint: disable=too-many-lines # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -8,14 +9,14 @@ from typing import Dict, List, Optional, TYPE_CHECKING, Union -import msrest.serialization +from ... import _serialization if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - import __init__ as _models + from .. import models as _models -class SubResource(msrest.serialization.Model): +class SubResource(_serialization.Model): """Reference to another subresource. Variables are only populated by the server, and will be ignored when sending a request. @@ -30,30 +31,26 @@ class SubResource(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(SubResource, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.id = None self.name = None self.type = None -class AgentPool(SubResource): +class AgentPool(SubResource): # pylint: disable=too-many-instance-attributes """Agent Pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -105,7 +102,7 @@ class AgentPool(SubResource): "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :vartype vm_size: str or ~azure.mgmt.containerservice.v2019_10_01.models.ContainerServiceVMSizeTypes :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine @@ -117,7 +114,7 @@ class AgentPool(SubResource): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Known values are: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux" and "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2019_10_01.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -126,7 +123,7 @@ class AgentPool(SubResource): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar type_properties_type: AgentPoolType represents types of an agent pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :vartype type_properties_type: str or ~azure.mgmt.containerservice.v2019_10_01.models.AgentPoolType :ivar orchestrator_version: Version of orchestrator specified when creating the managed @@ -141,12 +138,12 @@ class AgentPool(SubResource): :ivar enable_node_public_ip: Enable public IP for nodes. :vartype enable_node_public_ip: bool :ivar scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Known values are: "Low", "Regular". Default value: "Regular". + priority. Default to regular. Known values are: "Low" and "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2019_10_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy - for low priority virtual machine scale set. Default to Delete. Known values are: "Delete", - "Deallocate". Default value: "Delete". + for low priority virtual machine scale set. Default to Delete. Known values are: "Delete" and + "Deallocate". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2019_10_01.models.ScaleSetEvictionPolicy :ivar node_taints: Taints added to new nodes during node pool create and scale. For example, @@ -155,34 +152,34 @@ class AgentPool(SubResource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'os_disk_size_gb': {'maximum': 1023, 'minimum': 0}, - 'provisioning_state': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "os_disk_size_gb": {"maximum": 1023, "minimum": 0}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'count': {'key': 'properties.count', 'type': 'int'}, - 'vm_size': {'key': 'properties.vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'properties.osDiskSizeGB', 'type': 'int'}, - 'vnet_subnet_id': {'key': 'properties.vnetSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'properties.maxPods', 'type': 'int'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'max_count': {'key': 'properties.maxCount', 'type': 'int'}, - 'min_count': {'key': 'properties.minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'properties.enableAutoScaling', 'type': 'bool'}, - 'type_properties_type': {'key': 'properties.type', 'type': 'str'}, - 'orchestrator_version': {'key': 'properties.orchestratorVersion', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'availability_zones': {'key': 'properties.availabilityZones', 'type': '[str]'}, - 'enable_node_public_ip': {'key': 'properties.enableNodePublicIP', 'type': 'bool'}, - 'scale_set_priority': {'key': 'properties.scaleSetPriority', 'type': 'str'}, - 'scale_set_eviction_policy': {'key': 'properties.scaleSetEvictionPolicy', 'type': 'str'}, - 'node_taints': {'key': 'properties.nodeTaints', 'type': '[str]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "count": {"key": "properties.count", "type": "int"}, + "vm_size": {"key": "properties.vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "properties.osDiskSizeGB", "type": "int"}, + "vnet_subnet_id": {"key": "properties.vnetSubnetID", "type": "str"}, + "max_pods": {"key": "properties.maxPods", "type": "int"}, + "os_type": {"key": "properties.osType", "type": "str"}, + "max_count": {"key": "properties.maxCount", "type": "int"}, + "min_count": {"key": "properties.minCount", "type": "int"}, + "enable_auto_scaling": {"key": "properties.enableAutoScaling", "type": "bool"}, + "type_properties_type": {"key": "properties.type", "type": "str"}, + "orchestrator_version": {"key": "properties.orchestratorVersion", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "availability_zones": {"key": "properties.availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "properties.enableNodePublicIP", "type": "bool"}, + "scale_set_priority": {"key": "properties.scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "properties.scaleSetEvictionPolicy", "type": "str"}, + "node_taints": {"key": "properties.nodeTaints", "type": "[str]"}, } def __init__( @@ -193,7 +190,7 @@ def __init__( os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, @@ -201,8 +198,8 @@ def __init__( orchestrator_version: Optional[str] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, - scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", node_taints: Optional[List[str]] = None, **kwargs ): @@ -247,7 +244,7 @@ def __init__( "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :paramtype vm_size: str or ~azure.mgmt.containerservice.v2019_10_01.models.ContainerServiceVMSizeTypes :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every @@ -259,7 +256,7 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux" and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2019_10_01.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -268,7 +265,7 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword type_properties_type: AgentPoolType represents types of an agent pool. Known values - are: "VirtualMachineScaleSets", "AvailabilitySet". + are: "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type_properties_type: str or ~azure.mgmt.containerservice.v2019_10_01.models.AgentPoolType :keyword orchestrator_version: Version of orchestrator specified when creating the managed @@ -280,19 +277,19 @@ def __init__( :keyword enable_node_public_ip: Enable public IP for nodes. :paramtype enable_node_public_ip: bool :keyword scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Known values are: "Low", "Regular". Default value: "Regular". + priority. Default to regular. Known values are: "Low" and "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2019_10_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy for low priority virtual machine scale set. Default to Delete. Known values are: - "Delete", "Deallocate". Default value: "Delete". + "Delete" and "Deallocate". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2019_10_01.models.ScaleSetEvictionPolicy :keyword node_taints: Taints added to new nodes during node pool create and scale. For example, key=value:NoSchedule. :paramtype node_taints: list[str] """ - super(AgentPool, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.vm_size = vm_size self.os_disk_size_gb = os_disk_size_gb @@ -312,7 +309,7 @@ def __init__( self.node_taints = node_taints -class AgentPoolAvailableVersions(msrest.serialization.Model): +class AgentPoolAvailableVersions(_serialization.Model): """The list of available versions for an agent pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -329,16 +326,19 @@ class AgentPoolAvailableVersions(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'agent_pool_versions': {'key': 'properties.agentPoolVersions', 'type': '[AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "agent_pool_versions": { + "key": "properties.agentPoolVersions", + "type": "[AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem]", + }, } def __init__( @@ -352,14 +352,14 @@ def __init__( :paramtype agent_pool_versions: list[~azure.mgmt.containerservice.v2019_10_01.models.AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem] """ - super(AgentPoolAvailableVersions, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None self.agent_pool_versions = agent_pool_versions -class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(msrest.serialization.Model): +class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(_serialization.Model): """AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem. :ivar default: Whether this version is the default agent pool version. @@ -371,9 +371,9 @@ class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(msrest.serializa """ _attribute_map = { - 'default': {'key': 'default', 'type': 'bool'}, - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "default": {"key": "default", "type": "bool"}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } def __init__( @@ -392,13 +392,13 @@ def __init__( :keyword is_preview: Whether Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.default = default self.kubernetes_version = kubernetes_version self.is_preview = is_preview -class AgentPoolListResult(msrest.serialization.Model): +class AgentPoolListResult(_serialization.Model): """The response from the List Agent Pools operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -410,30 +410,25 @@ class AgentPoolListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[AgentPool]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[AgentPool]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.AgentPool"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.AgentPool"]] = None, **kwargs): """ :keyword value: The list of agent pools. :paramtype value: list[~azure.mgmt.containerservice.v2019_10_01.models.AgentPool] """ - super(AgentPoolListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class AgentPoolUpgradeProfile(msrest.serialization.Model): +class AgentPoolUpgradeProfile(_serialization.Model): """The list of available upgrades for an agent pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -446,10 +441,10 @@ class AgentPoolUpgradeProfile(msrest.serialization.Model): :vartype name: str :ivar type: Type of the agent pool upgrade profile. :vartype type: str - :ivar kubernetes_version: Required. Kubernetes version (major, minor, patch). + :ivar kubernetes_version: Kubernetes version (major, minor, patch). Required. :vartype kubernetes_version: str - :ivar os_type: Required. OsType to be used to specify os type. Choose from Linux and Windows. - Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to + Linux. Known values are: "Linux" and "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2019_10_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -457,20 +452,20 @@ class AgentPoolUpgradeProfile(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kubernetes_version': {'required': True}, - 'os_type': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "kubernetes_version": {"required": True}, + "os_type": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'kubernetes_version': {'key': 'properties.kubernetesVersion', 'type': 'str'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'upgrades': {'key': 'properties.upgrades', 'type': '[AgentPoolUpgradeProfilePropertiesUpgradesItem]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "os_type": {"key": "properties.osType", "type": "str"}, + "upgrades": {"key": "properties.upgrades", "type": "[AgentPoolUpgradeProfilePropertiesUpgradesItem]"}, } def __init__( @@ -482,16 +477,16 @@ def __init__( **kwargs ): """ - :keyword kubernetes_version: Required. Kubernetes version (major, minor, patch). + :keyword kubernetes_version: Kubernetes version (major, minor, patch). Required. :paramtype kubernetes_version: str - :keyword os_type: Required. OsType to be used to specify os type. Choose from Linux and - Windows. Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default + to Linux. Known values are: "Linux" and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2019_10_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: list[~azure.mgmt.containerservice.v2019_10_01.models.AgentPoolUpgradeProfilePropertiesUpgradesItem] """ - super(AgentPoolUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -500,7 +495,7 @@ def __init__( self.upgrades = upgrades -class AgentPoolUpgradeProfilePropertiesUpgradesItem(msrest.serialization.Model): +class AgentPoolUpgradeProfilePropertiesUpgradesItem(_serialization.Model): """AgentPoolUpgradeProfilePropertiesUpgradesItem. :ivar kubernetes_version: Kubernetes version (major, minor, patch). @@ -510,29 +505,23 @@ class AgentPoolUpgradeProfilePropertiesUpgradesItem(msrest.serialization.Model): """ _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } - def __init__( - self, - *, - kubernetes_version: Optional[str] = None, - is_preview: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, kubernetes_version: Optional[str] = None, is_preview: Optional[bool] = None, **kwargs): """ :keyword kubernetes_version: Kubernetes version (major, minor, patch). :paramtype kubernetes_version: str :keyword is_preview: Whether Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(AgentPoolUpgradeProfilePropertiesUpgradesItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.is_preview = is_preview -class CloudErrorBody(msrest.serialization.Model): +class CloudErrorBody(_serialization.Model): """An error response from the Container service. :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed @@ -549,10 +538,10 @@ class CloudErrorBody(msrest.serialization.Model): """ _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[CloudErrorBody]"}, } def __init__( @@ -577,87 +566,76 @@ def __init__( :keyword details: A list of additional details about the error. :paramtype details: list[~azure.mgmt.containerservice.v2019_10_01.models.CloudErrorBody] """ - super(CloudErrorBody, self).__init__(**kwargs) + super().__init__(**kwargs) self.code = code self.message = message self.target = target self.details = details -class ContainerServiceDiagnosticsProfile(msrest.serialization.Model): +class ContainerServiceDiagnosticsProfile(_serialization.Model): """Profile for diagnostics on the container service cluster. All required parameters must be populated in order to send to Azure. - :ivar vm_diagnostics: Required. Profile for diagnostics on the container service VMs. + :ivar vm_diagnostics: Profile for diagnostics on the container service VMs. Required. :vartype vm_diagnostics: ~azure.mgmt.containerservice.v2019_10_01.models.ContainerServiceVMDiagnostics """ _validation = { - 'vm_diagnostics': {'required': True}, + "vm_diagnostics": {"required": True}, } _attribute_map = { - 'vm_diagnostics': {'key': 'vmDiagnostics', 'type': 'ContainerServiceVMDiagnostics'}, + "vm_diagnostics": {"key": "vmDiagnostics", "type": "ContainerServiceVMDiagnostics"}, } - def __init__( - self, - *, - vm_diagnostics: "_models.ContainerServiceVMDiagnostics", - **kwargs - ): + def __init__(self, *, vm_diagnostics: "_models.ContainerServiceVMDiagnostics", **kwargs): """ - :keyword vm_diagnostics: Required. Profile for diagnostics on the container service VMs. + :keyword vm_diagnostics: Profile for diagnostics on the container service VMs. Required. :paramtype vm_diagnostics: ~azure.mgmt.containerservice.v2019_10_01.models.ContainerServiceVMDiagnostics """ - super(ContainerServiceDiagnosticsProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.vm_diagnostics = vm_diagnostics -class ContainerServiceLinuxProfile(msrest.serialization.Model): +class ContainerServiceLinuxProfile(_serialization.Model): """Profile for Linux VMs in the container service cluster. All required parameters must be populated in order to send to Azure. - :ivar admin_username: Required. The administrator username to use for Linux VMs. + :ivar admin_username: The administrator username to use for Linux VMs. Required. :vartype admin_username: str - :ivar ssh: Required. SSH configuration for Linux-based VMs running on Azure. + :ivar ssh: SSH configuration for Linux-based VMs running on Azure. Required. :vartype ssh: ~azure.mgmt.containerservice.v2019_10_01.models.ContainerServiceSshConfiguration """ _validation = { - 'admin_username': {'required': True, 'pattern': r'^[A-Za-z][-A-Za-z0-9_]*$'}, - 'ssh': {'required': True}, + "admin_username": {"required": True, "pattern": r"^[A-Za-z][-A-Za-z0-9_]*$"}, + "ssh": {"required": True}, } _attribute_map = { - 'admin_username': {'key': 'adminUsername', 'type': 'str'}, - 'ssh': {'key': 'ssh', 'type': 'ContainerServiceSshConfiguration'}, + "admin_username": {"key": "adminUsername", "type": "str"}, + "ssh": {"key": "ssh", "type": "ContainerServiceSshConfiguration"}, } - def __init__( - self, - *, - admin_username: str, - ssh: "_models.ContainerServiceSshConfiguration", - **kwargs - ): + def __init__(self, *, admin_username: str, ssh: "_models.ContainerServiceSshConfiguration", **kwargs): """ - :keyword admin_username: Required. The administrator username to use for Linux VMs. + :keyword admin_username: The administrator username to use for Linux VMs. Required. :paramtype admin_username: str - :keyword ssh: Required. SSH configuration for Linux-based VMs running on Azure. + :keyword ssh: SSH configuration for Linux-based VMs running on Azure. Required. :paramtype ssh: ~azure.mgmt.containerservice.v2019_10_01.models.ContainerServiceSshConfiguration """ - super(ContainerServiceLinuxProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.admin_username = admin_username self.ssh = ssh -class ContainerServiceMasterProfile(msrest.serialization.Model): +class ContainerServiceMasterProfile(_serialization.Model): """Profile for the container service master. Variables are only populated by the server, and will be ignored when sending a request. @@ -665,11 +643,11 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar count: Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, - and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". + and 5. The default value is 1. Known values are: 1, 3, and 5. :vartype count: int or ~azure.mgmt.containerservice.v2019_10_01.models.Count - :ivar dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. + :ivar dns_prefix: DNS prefix to be used to create the FQDN for the master pool. Required. :vartype dns_prefix: str - :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + :ivar vm_size: Size of agent VMs. Required. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -706,7 +684,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :vartype vm_size: str or ~azure.mgmt.containerservice.v2019_10_01.models.ContainerServiceVMSizeTypes :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine @@ -720,7 +698,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): :vartype first_consecutive_static_ip: str :ivar storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount" and "ManagedDisks". :vartype storage_profile: str or ~azure.mgmt.containerservice.v2019_10_01.models.ContainerServiceStorageProfileTypes :ivar fqdn: FQDN for the master pool. @@ -728,21 +706,21 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): """ _validation = { - 'dns_prefix': {'required': True}, - 'vm_size': {'required': True}, - 'os_disk_size_gb': {'maximum': 1023, 'minimum': 0}, - 'fqdn': {'readonly': True}, + "dns_prefix": {"required": True}, + "vm_size": {"required": True}, + "os_disk_size_gb": {"maximum": 1023, "minimum": 0}, + "fqdn": {"readonly": True}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'dns_prefix': {'key': 'dnsPrefix', 'type': 'str'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'first_consecutive_static_ip': {'key': 'firstConsecutiveStaticIP', 'type': 'str'}, - 'storage_profile': {'key': 'storageProfile', 'type': 'str'}, - 'fqdn': {'key': 'fqdn', 'type': 'str'}, + "count": {"key": "count", "type": "int"}, + "dns_prefix": {"key": "dnsPrefix", "type": "str"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "first_consecutive_static_ip": {"key": "firstConsecutiveStaticIP", "type": "str"}, + "storage_profile": {"key": "storageProfile", "type": "str"}, + "fqdn": {"key": "fqdn", "type": "str"}, } def __init__( @@ -750,20 +728,20 @@ def __init__( *, dns_prefix: str, vm_size: Union[str, "_models.ContainerServiceVMSizeTypes"], - count: Optional[Union[int, "_models.Count"]] = 1, + count: Union[int, "_models.Count"] = 1, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, - first_consecutive_static_ip: Optional[str] = "10.240.255.5", + first_consecutive_static_ip: str = "10.240.255.5", storage_profile: Optional[Union[str, "_models.ContainerServiceStorageProfileTypes"]] = None, **kwargs ): """ :keyword count: Number of masters (VMs) in the container service cluster. Allowed values are 1, - 3, and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". + 3, and 5. The default value is 1. Known values are: 1, 3, and 5. :paramtype count: int or ~azure.mgmt.containerservice.v2019_10_01.models.Count - :keyword dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. + :keyword dns_prefix: DNS prefix to be used to create the FQDN for the master pool. Required. :paramtype dns_prefix: str - :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + :keyword vm_size: Size of agent VMs. Required. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -800,7 +778,7 @@ def __init__( "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :paramtype vm_size: str or ~azure.mgmt.containerservice.v2019_10_01.models.ContainerServiceVMSizeTypes :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every @@ -814,11 +792,11 @@ def __init__( :paramtype first_consecutive_static_ip: str :keyword storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount" and "ManagedDisks". :paramtype storage_profile: str or ~azure.mgmt.containerservice.v2019_10_01.models.ContainerServiceStorageProfileTypes """ - super(ContainerServiceMasterProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.dns_prefix = dns_prefix self.vm_size = vm_size @@ -829,14 +807,14 @@ def __init__( self.fqdn = None -class ContainerServiceNetworkProfile(msrest.serialization.Model): +class ContainerServiceNetworkProfile(_serialization.Model): """Profile of network configuration. :ivar network_plugin: Network plugin used for building Kubernetes network. Known values are: - "azure", "kubenet". Default value: "kubenet". + "azure" and "kubenet". :vartype network_plugin: str or ~azure.mgmt.containerservice.v2019_10_01.models.NetworkPlugin :ivar network_policy: Network policy used for building Kubernetes network. Known values are: - "calico", "azure". + "calico" and "azure". :vartype network_policy: str or ~azure.mgmt.containerservice.v2019_10_01.models.NetworkPolicy :ivar pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :vartype pod_cidr: str @@ -850,7 +828,7 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): must not overlap with any Subnet IP ranges or the Kubernetes service address range. :vartype docker_bridge_cidr: str :ivar load_balancer_sku: The load balancer sku for the managed cluster. Known values are: - "standard", "basic". + "standard" and "basic". :vartype load_balancer_sku: str or ~azure.mgmt.containerservice.v2019_10_01.models.LoadBalancerSku :ivar load_balancer_profile: Profile of the cluster load balancer. @@ -859,42 +837,44 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): """ _validation = { - 'pod_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, - 'service_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, - 'dns_service_ip': {'pattern': r'^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$'}, - 'docker_bridge_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, + "pod_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, + "service_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, + "dns_service_ip": { + "pattern": r"^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$" + }, + "docker_bridge_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, } _attribute_map = { - 'network_plugin': {'key': 'networkPlugin', 'type': 'str'}, - 'network_policy': {'key': 'networkPolicy', 'type': 'str'}, - 'pod_cidr': {'key': 'podCidr', 'type': 'str'}, - 'service_cidr': {'key': 'serviceCidr', 'type': 'str'}, - 'dns_service_ip': {'key': 'dnsServiceIP', 'type': 'str'}, - 'docker_bridge_cidr': {'key': 'dockerBridgeCidr', 'type': 'str'}, - 'load_balancer_sku': {'key': 'loadBalancerSku', 'type': 'str'}, - 'load_balancer_profile': {'key': 'loadBalancerProfile', 'type': 'ManagedClusterLoadBalancerProfile'}, + "network_plugin": {"key": "networkPlugin", "type": "str"}, + "network_policy": {"key": "networkPolicy", "type": "str"}, + "pod_cidr": {"key": "podCidr", "type": "str"}, + "service_cidr": {"key": "serviceCidr", "type": "str"}, + "dns_service_ip": {"key": "dnsServiceIP", "type": "str"}, + "docker_bridge_cidr": {"key": "dockerBridgeCidr", "type": "str"}, + "load_balancer_sku": {"key": "loadBalancerSku", "type": "str"}, + "load_balancer_profile": {"key": "loadBalancerProfile", "type": "ManagedClusterLoadBalancerProfile"}, } def __init__( self, *, - network_plugin: Optional[Union[str, "_models.NetworkPlugin"]] = "kubenet", + network_plugin: Union[str, "_models.NetworkPlugin"] = "kubenet", network_policy: Optional[Union[str, "_models.NetworkPolicy"]] = None, - pod_cidr: Optional[str] = "10.244.0.0/16", - service_cidr: Optional[str] = "10.0.0.0/16", - dns_service_ip: Optional[str] = "10.0.0.10", - docker_bridge_cidr: Optional[str] = "172.17.0.1/16", + pod_cidr: str = "10.244.0.0/16", + service_cidr: str = "10.0.0.0/16", + dns_service_ip: str = "10.0.0.10", + docker_bridge_cidr: str = "172.17.0.1/16", load_balancer_sku: Optional[Union[str, "_models.LoadBalancerSku"]] = None, load_balancer_profile: Optional["_models.ManagedClusterLoadBalancerProfile"] = None, **kwargs ): """ :keyword network_plugin: Network plugin used for building Kubernetes network. Known values are: - "azure", "kubenet". Default value: "kubenet". + "azure" and "kubenet". :paramtype network_plugin: str or ~azure.mgmt.containerservice.v2019_10_01.models.NetworkPlugin :keyword network_policy: Network policy used for building Kubernetes network. Known values are: - "calico", "azure". + "calico" and "azure". :paramtype network_policy: str or ~azure.mgmt.containerservice.v2019_10_01.models.NetworkPolicy :keyword pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :paramtype pod_cidr: str @@ -908,14 +888,14 @@ def __init__( must not overlap with any Subnet IP ranges or the Kubernetes service address range. :paramtype docker_bridge_cidr: str :keyword load_balancer_sku: The load balancer sku for the managed cluster. Known values are: - "standard", "basic". + "standard" and "basic". :paramtype load_balancer_sku: str or ~azure.mgmt.containerservice.v2019_10_01.models.LoadBalancerSku :keyword load_balancer_profile: Profile of the cluster load balancer. :paramtype load_balancer_profile: ~azure.mgmt.containerservice.v2019_10_01.models.ManagedClusterLoadBalancerProfile """ - super(ContainerServiceNetworkProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.network_plugin = network_plugin self.network_policy = network_policy self.pod_cidr = pod_cidr @@ -926,113 +906,98 @@ def __init__( self.load_balancer_profile = load_balancer_profile -class ContainerServiceSshConfiguration(msrest.serialization.Model): +class ContainerServiceSshConfiguration(_serialization.Model): """SSH configuration for Linux-based VMs running on Azure. All required parameters must be populated in order to send to Azure. - :ivar public_keys: Required. The list of SSH public keys used to authenticate with Linux-based - VMs. Only expect one key specified. + :ivar public_keys: The list of SSH public keys used to authenticate with Linux-based VMs. Only + expect one key specified. Required. :vartype public_keys: list[~azure.mgmt.containerservice.v2019_10_01.models.ContainerServiceSshPublicKey] """ _validation = { - 'public_keys': {'required': True}, + "public_keys": {"required": True}, } _attribute_map = { - 'public_keys': {'key': 'publicKeys', 'type': '[ContainerServiceSshPublicKey]'}, + "public_keys": {"key": "publicKeys", "type": "[ContainerServiceSshPublicKey]"}, } - def __init__( - self, - *, - public_keys: List["_models.ContainerServiceSshPublicKey"], - **kwargs - ): + def __init__(self, *, public_keys: List["_models.ContainerServiceSshPublicKey"], **kwargs): """ - :keyword public_keys: Required. The list of SSH public keys used to authenticate with - Linux-based VMs. Only expect one key specified. + :keyword public_keys: The list of SSH public keys used to authenticate with Linux-based VMs. + Only expect one key specified. Required. :paramtype public_keys: list[~azure.mgmt.containerservice.v2019_10_01.models.ContainerServiceSshPublicKey] """ - super(ContainerServiceSshConfiguration, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_keys = public_keys -class ContainerServiceSshPublicKey(msrest.serialization.Model): +class ContainerServiceSshPublicKey(_serialization.Model): """Contains information about SSH certificate public key data. All required parameters must be populated in order to send to Azure. - :ivar key_data: Required. Certificate public key used to authenticate with VMs through SSH. The - certificate must be in PEM format with or without headers. + :ivar key_data: Certificate public key used to authenticate with VMs through SSH. The + certificate must be in PEM format with or without headers. Required. :vartype key_data: str """ _validation = { - 'key_data': {'required': True}, + "key_data": {"required": True}, } _attribute_map = { - 'key_data': {'key': 'keyData', 'type': 'str'}, + "key_data": {"key": "keyData", "type": "str"}, } - def __init__( - self, - *, - key_data: str, - **kwargs - ): + def __init__(self, *, key_data: str, **kwargs): """ - :keyword key_data: Required. Certificate public key used to authenticate with VMs through SSH. - The certificate must be in PEM format with or without headers. + :keyword key_data: Certificate public key used to authenticate with VMs through SSH. The + certificate must be in PEM format with or without headers. Required. :paramtype key_data: str """ - super(ContainerServiceSshPublicKey, self).__init__(**kwargs) + super().__init__(**kwargs) self.key_data = key_data -class ContainerServiceVMDiagnostics(msrest.serialization.Model): +class ContainerServiceVMDiagnostics(_serialization.Model): """Profile for diagnostics on the container service VMs. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar enabled: Required. Whether the VM diagnostic agent is provisioned on the VM. + :ivar enabled: Whether the VM diagnostic agent is provisioned on the VM. Required. :vartype enabled: bool :ivar storage_uri: The URI of the storage account where diagnostics are stored. :vartype storage_uri: str """ _validation = { - 'enabled': {'required': True}, - 'storage_uri': {'readonly': True}, + "enabled": {"required": True}, + "storage_uri": {"readonly": True}, } _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'storage_uri': {'key': 'storageUri', 'type': 'str'}, + "enabled": {"key": "enabled", "type": "bool"}, + "storage_uri": {"key": "storageUri", "type": "str"}, } - def __init__( - self, - *, - enabled: bool, - **kwargs - ): + def __init__(self, *, enabled: bool, **kwargs): """ - :keyword enabled: Required. Whether the VM diagnostic agent is provisioned on the VM. + :keyword enabled: Whether the VM diagnostic agent is provisioned on the VM. Required. :paramtype enabled: bool """ - super(ContainerServiceVMDiagnostics, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.storage_uri = None -class CredentialResult(msrest.serialization.Model): +class CredentialResult(_serialization.Model): """The credential result response. Variables are only populated by the server, and will be ignored when sending a request. @@ -1040,31 +1005,27 @@ class CredentialResult(msrest.serialization.Model): :ivar name: The name of the credential. :vartype name: str :ivar value: Base64-encoded Kubernetes configuration file. - :vartype value: bytearray + :vartype value: bytes """ _validation = { - 'name': {'readonly': True}, - 'value': {'readonly': True}, + "name": {"readonly": True}, + "value": {"readonly": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'bytearray'}, + "name": {"key": "name", "type": "str"}, + "value": {"key": "value", "type": "bytearray"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(CredentialResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.name = None self.value = None -class CredentialResults(msrest.serialization.Model): +class CredentialResults(_serialization.Model): """The list of credential result response. Variables are only populated by the server, and will be ignored when sending a request. @@ -1074,24 +1035,20 @@ class CredentialResults(msrest.serialization.Model): """ _validation = { - 'kubeconfigs': {'readonly': True}, + "kubeconfigs": {"readonly": True}, } _attribute_map = { - 'kubeconfigs': {'key': 'kubeconfigs', 'type': '[CredentialResult]'}, + "kubeconfigs": {"key": "kubeconfigs", "type": "[CredentialResult]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(CredentialResults, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.kubeconfigs = None -class Resource(msrest.serialization.Model): +class Resource(_serialization.Model): """The Resource model definition. Variables are only populated by the server, and will be ignored when sending a request. @@ -1104,41 +1061,35 @@ class Resource(msrest.serialization.Model): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] """ - super(Resource, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -1146,7 +1097,7 @@ def __init__( self.tags = tags -class ManagedCluster(Resource): +class ManagedCluster(Resource): # pylint: disable=too-many-instance-attributes """Managed cluster. Variables are only populated by the server, and will be ignored when sending a request. @@ -1159,9 +1110,9 @@ class ManagedCluster(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar identity: The identity of the managed cluster, if configured. :vartype identity: ~azure.mgmt.containerservice.v2019_10_01.models.ManagedClusterIdentity @@ -1213,40 +1164,46 @@ class ManagedCluster(Resource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'provisioning_state': {'readonly': True}, - 'max_agent_pools': {'readonly': True}, - 'fqdn': {'readonly': True}, - 'private_fqdn': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, + "provisioning_state": {"readonly": True}, + "max_agent_pools": {"readonly": True}, + "fqdn": {"readonly": True}, + "private_fqdn": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'ManagedClusterIdentity'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'max_agent_pools': {'key': 'properties.maxAgentPools', 'type': 'int'}, - 'kubernetes_version': {'key': 'properties.kubernetesVersion', 'type': 'str'}, - 'dns_prefix': {'key': 'properties.dnsPrefix', 'type': 'str'}, - 'fqdn': {'key': 'properties.fqdn', 'type': 'str'}, - 'private_fqdn': {'key': 'properties.privateFQDN', 'type': 'str'}, - 'agent_pool_profiles': {'key': 'properties.agentPoolProfiles', 'type': '[ManagedClusterAgentPoolProfile]'}, - 'linux_profile': {'key': 'properties.linuxProfile', 'type': 'ContainerServiceLinuxProfile'}, - 'windows_profile': {'key': 'properties.windowsProfile', 'type': 'ManagedClusterWindowsProfile'}, - 'service_principal_profile': {'key': 'properties.servicePrincipalProfile', 'type': 'ManagedClusterServicePrincipalProfile'}, - 'addon_profiles': {'key': 'properties.addonProfiles', 'type': '{ManagedClusterAddonProfile}'}, - 'node_resource_group': {'key': 'properties.nodeResourceGroup', 'type': 'str'}, - 'enable_rbac': {'key': 'properties.enableRBAC', 'type': 'bool'}, - 'enable_pod_security_policy': {'key': 'properties.enablePodSecurityPolicy', 'type': 'bool'}, - 'network_profile': {'key': 'properties.networkProfile', 'type': 'ContainerServiceNetworkProfile'}, - 'aad_profile': {'key': 'properties.aadProfile', 'type': 'ManagedClusterAADProfile'}, - 'api_server_access_profile': {'key': 'properties.apiServerAccessProfile', 'type': 'ManagedClusterAPIServerAccessProfile'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "identity": {"key": "identity", "type": "ManagedClusterIdentity"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "max_agent_pools": {"key": "properties.maxAgentPools", "type": "int"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "dns_prefix": {"key": "properties.dnsPrefix", "type": "str"}, + "fqdn": {"key": "properties.fqdn", "type": "str"}, + "private_fqdn": {"key": "properties.privateFQDN", "type": "str"}, + "agent_pool_profiles": {"key": "properties.agentPoolProfiles", "type": "[ManagedClusterAgentPoolProfile]"}, + "linux_profile": {"key": "properties.linuxProfile", "type": "ContainerServiceLinuxProfile"}, + "windows_profile": {"key": "properties.windowsProfile", "type": "ManagedClusterWindowsProfile"}, + "service_principal_profile": { + "key": "properties.servicePrincipalProfile", + "type": "ManagedClusterServicePrincipalProfile", + }, + "addon_profiles": {"key": "properties.addonProfiles", "type": "{ManagedClusterAddonProfile}"}, + "node_resource_group": {"key": "properties.nodeResourceGroup", "type": "str"}, + "enable_rbac": {"key": "properties.enableRBAC", "type": "bool"}, + "enable_pod_security_policy": {"key": "properties.enablePodSecurityPolicy", "type": "bool"}, + "network_profile": {"key": "properties.networkProfile", "type": "ContainerServiceNetworkProfile"}, + "aad_profile": {"key": "properties.aadProfile", "type": "ManagedClusterAADProfile"}, + "api_server_access_profile": { + "key": "properties.apiServerAccessProfile", + "type": "ManagedClusterAPIServerAccessProfile", + }, } def __init__( @@ -1271,9 +1228,9 @@ def __init__( **kwargs ): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword identity: The identity of the managed cluster, if configured. :paramtype identity: ~azure.mgmt.containerservice.v2019_10_01.models.ManagedClusterIdentity @@ -1315,7 +1272,7 @@ def __init__( :paramtype api_server_access_profile: ~azure.mgmt.containerservice.v2019_10_01.models.ManagedClusterAPIServerAccessProfile """ - super(ManagedCluster, self).__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.identity = identity self.provisioning_state = None self.max_agent_pools = None @@ -1336,14 +1293,14 @@ def __init__( self.api_server_access_profile = api_server_access_profile -class ManagedClusterAADProfile(msrest.serialization.Model): +class ManagedClusterAADProfile(_serialization.Model): """AADProfile specifies attributes for Azure Active Directory integration. All required parameters must be populated in order to send to Azure. - :ivar client_app_id: Required. The client AAD application ID. + :ivar client_app_id: The client AAD application ID. Required. :vartype client_app_id: str - :ivar server_app_id: Required. The server AAD application ID. + :ivar server_app_id: The server AAD application ID. Required. :vartype server_app_id: str :ivar server_app_secret: The server AAD application secret. :vartype server_app_secret: str @@ -1353,15 +1310,15 @@ class ManagedClusterAADProfile(msrest.serialization.Model): """ _validation = { - 'client_app_id': {'required': True}, - 'server_app_id': {'required': True}, + "client_app_id": {"required": True}, + "server_app_id": {"required": True}, } _attribute_map = { - 'client_app_id': {'key': 'clientAppID', 'type': 'str'}, - 'server_app_id': {'key': 'serverAppID', 'type': 'str'}, - 'server_app_secret': {'key': 'serverAppSecret', 'type': 'str'}, - 'tenant_id': {'key': 'tenantID', 'type': 'str'}, + "client_app_id": {"key": "clientAppID", "type": "str"}, + "server_app_id": {"key": "serverAppID", "type": "str"}, + "server_app_secret": {"key": "serverAppSecret", "type": "str"}, + "tenant_id": {"key": "tenantID", "type": "str"}, } def __init__( @@ -1374,9 +1331,9 @@ def __init__( **kwargs ): """ - :keyword client_app_id: Required. The client AAD application ID. + :keyword client_app_id: The client AAD application ID. Required. :paramtype client_app_id: str - :keyword server_app_id: Required. The server AAD application ID. + :keyword server_app_id: The server AAD application ID. Required. :paramtype server_app_id: str :keyword server_app_secret: The server AAD application secret. :paramtype server_app_secret: str @@ -1384,7 +1341,7 @@ def __init__( tenant of the deployment subscription. :paramtype tenant_id: str """ - super(ManagedClusterAADProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.client_app_id = client_app_id self.server_app_id = server_app_id self.server_app_secret = server_app_secret @@ -1404,89 +1361,78 @@ class ManagedClusterAccessProfile(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar kube_config: Base64-encoded Kubernetes configuration file. - :vartype kube_config: bytearray + :vartype kube_config: bytes """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'kube_config': {'key': 'properties.kubeConfig', 'type': 'bytearray'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "kube_config": {"key": "properties.kubeConfig", "type": "bytearray"}, } def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - kube_config: Optional[bytearray] = None, - **kwargs + self, *, location: str, tags: Optional[Dict[str, str]] = None, kube_config: Optional[bytes] = None, **kwargs ): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword kube_config: Base64-encoded Kubernetes configuration file. - :paramtype kube_config: bytearray + :paramtype kube_config: bytes """ - super(ManagedClusterAccessProfile, self).__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.kube_config = kube_config -class ManagedClusterAddonProfile(msrest.serialization.Model): +class ManagedClusterAddonProfile(_serialization.Model): """A Kubernetes add-on profile for a managed cluster. All required parameters must be populated in order to send to Azure. - :ivar enabled: Required. Whether the add-on is enabled or not. + :ivar enabled: Whether the add-on is enabled or not. Required. :vartype enabled: bool :ivar config: Key-value pairs for configuring an add-on. :vartype config: dict[str, str] """ _validation = { - 'enabled': {'required': True}, + "enabled": {"required": True}, } _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'config': {'key': 'config', 'type': '{str}'}, + "enabled": {"key": "enabled", "type": "bool"}, + "config": {"key": "config", "type": "{str}"}, } - def __init__( - self, - *, - enabled: bool, - config: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, enabled: bool, config: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword enabled: Required. Whether the add-on is enabled or not. + :keyword enabled: Whether the add-on is enabled or not. Required. :paramtype enabled: bool :keyword config: Key-value pairs for configuring an add-on. :paramtype config: dict[str, str] """ - super(ManagedClusterAddonProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.config = config -class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): +class ManagedClusterAgentPoolProfileProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes """Properties for the container service agent pool profile. Variables are only populated by the server, and will be ignored when sending a request. @@ -1531,7 +1477,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :vartype vm_size: str or ~azure.mgmt.containerservice.v2019_10_01.models.ContainerServiceVMSizeTypes :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine @@ -1543,7 +1489,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Known values are: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux" and "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2019_10_01.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -1552,7 +1498,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar type: AgentPoolType represents types of an agent pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2019_10_01.models.AgentPoolType :ivar orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -1566,12 +1512,12 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar enable_node_public_ip: Enable public IP for nodes. :vartype enable_node_public_ip: bool :ivar scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Known values are: "Low", "Regular". Default value: "Regular". + priority. Default to regular. Known values are: "Low" and "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2019_10_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy - for low priority virtual machine scale set. Default to Delete. Known values are: "Delete", - "Deallocate". Default value: "Delete". + for low priority virtual machine scale set. Default to Delete. Known values are: "Delete" and + "Deallocate". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2019_10_01.models.ScaleSetEvictionPolicy :ivar node_taints: Taints added to new nodes during node pool create and scale. For example, @@ -1580,28 +1526,28 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): """ _validation = { - 'os_disk_size_gb': {'maximum': 1023, 'minimum': 0}, - 'provisioning_state': {'readonly': True}, + "os_disk_size_gb": {"maximum": 1023, "minimum": 0}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'maxPods', 'type': 'int'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'max_count': {'key': 'maxCount', 'type': 'int'}, - 'min_count': {'key': 'minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'enableAutoScaling', 'type': 'bool'}, - 'type': {'key': 'type', 'type': 'str'}, - 'orchestrator_version': {'key': 'orchestratorVersion', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'availability_zones': {'key': 'availabilityZones', 'type': '[str]'}, - 'enable_node_public_ip': {'key': 'enableNodePublicIP', 'type': 'bool'}, - 'scale_set_priority': {'key': 'scaleSetPriority', 'type': 'str'}, - 'scale_set_eviction_policy': {'key': 'scaleSetEvictionPolicy', 'type': 'str'}, - 'node_taints': {'key': 'nodeTaints', 'type': '[str]'}, + "count": {"key": "count", "type": "int"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "max_pods": {"key": "maxPods", "type": "int"}, + "os_type": {"key": "osType", "type": "str"}, + "max_count": {"key": "maxCount", "type": "int"}, + "min_count": {"key": "minCount", "type": "int"}, + "enable_auto_scaling": {"key": "enableAutoScaling", "type": "bool"}, + "type": {"key": "type", "type": "str"}, + "orchestrator_version": {"key": "orchestratorVersion", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "availability_zones": {"key": "availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "enableNodePublicIP", "type": "bool"}, + "scale_set_priority": {"key": "scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "scaleSetEvictionPolicy", "type": "str"}, + "node_taints": {"key": "nodeTaints", "type": "[str]"}, } def __init__( @@ -1612,7 +1558,7 @@ def __init__( os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, @@ -1620,8 +1566,8 @@ def __init__( orchestrator_version: Optional[str] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, - scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", node_taints: Optional[List[str]] = None, **kwargs ): @@ -1666,7 +1612,7 @@ def __init__( "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :paramtype vm_size: str or ~azure.mgmt.containerservice.v2019_10_01.models.ContainerServiceVMSizeTypes :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every @@ -1678,7 +1624,7 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux" and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2019_10_01.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -1687,7 +1633,7 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword type: AgentPoolType represents types of an agent pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2019_10_01.models.AgentPoolType :keyword orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -1698,19 +1644,19 @@ def __init__( :keyword enable_node_public_ip: Enable public IP for nodes. :paramtype enable_node_public_ip: bool :keyword scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Known values are: "Low", "Regular". Default value: "Regular". + priority. Default to regular. Known values are: "Low" and "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2019_10_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy for low priority virtual machine scale set. Default to Delete. Known values are: - "Delete", "Deallocate". Default value: "Delete". + "Delete" and "Deallocate". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2019_10_01.models.ScaleSetEvictionPolicy :keyword node_taints: Taints added to new nodes during node pool create and scale. For example, key=value:NoSchedule. :paramtype node_taints: list[str] """ - super(ManagedClusterAgentPoolProfileProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.vm_size = vm_size self.os_disk_size_gb = os_disk_size_gb @@ -1730,7 +1676,9 @@ def __init__( self.node_taints = node_taints -class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): +class ManagedClusterAgentPoolProfile( + ManagedClusterAgentPoolProfileProperties +): # pylint: disable=too-many-instance-attributes """Profile for the container service agent pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -1777,7 +1725,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :vartype vm_size: str or ~azure.mgmt.containerservice.v2019_10_01.models.ContainerServiceVMSizeTypes :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine @@ -1789,7 +1737,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Known values are: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux" and "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2019_10_01.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -1798,7 +1746,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar type: AgentPoolType represents types of an agent pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2019_10_01.models.AgentPoolType :ivar orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -1812,47 +1760,47 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar enable_node_public_ip: Enable public IP for nodes. :vartype enable_node_public_ip: bool :ivar scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Known values are: "Low", "Regular". Default value: "Regular". + priority. Default to regular. Known values are: "Low" and "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2019_10_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy - for low priority virtual machine scale set. Default to Delete. Known values are: "Delete", - "Deallocate". Default value: "Delete". + for low priority virtual machine scale set. Default to Delete. Known values are: "Delete" and + "Deallocate". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2019_10_01.models.ScaleSetEvictionPolicy :ivar node_taints: Taints added to new nodes during node pool create and scale. For example, key=value:NoSchedule. :vartype node_taints: list[str] - :ivar name: Required. Unique name of the agent pool profile in the context of the subscription - and resource group. + :ivar name: Unique name of the agent pool profile in the context of the subscription and + resource group. Required. :vartype name: str """ _validation = { - 'os_disk_size_gb': {'maximum': 1023, 'minimum': 0}, - 'provisioning_state': {'readonly': True}, - 'name': {'required': True, 'pattern': r'^[a-z][a-z0-9]{0,11}$'}, + "os_disk_size_gb": {"maximum": 1023, "minimum": 0}, + "provisioning_state": {"readonly": True}, + "name": {"required": True, "pattern": r"^[a-z][a-z0-9]{0,11}$"}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'maxPods', 'type': 'int'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'max_count': {'key': 'maxCount', 'type': 'int'}, - 'min_count': {'key': 'minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'enableAutoScaling', 'type': 'bool'}, - 'type': {'key': 'type', 'type': 'str'}, - 'orchestrator_version': {'key': 'orchestratorVersion', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'availability_zones': {'key': 'availabilityZones', 'type': '[str]'}, - 'enable_node_public_ip': {'key': 'enableNodePublicIP', 'type': 'bool'}, - 'scale_set_priority': {'key': 'scaleSetPriority', 'type': 'str'}, - 'scale_set_eviction_policy': {'key': 'scaleSetEvictionPolicy', 'type': 'str'}, - 'node_taints': {'key': 'nodeTaints', 'type': '[str]'}, - 'name': {'key': 'name', 'type': 'str'}, + "count": {"key": "count", "type": "int"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "max_pods": {"key": "maxPods", "type": "int"}, + "os_type": {"key": "osType", "type": "str"}, + "max_count": {"key": "maxCount", "type": "int"}, + "min_count": {"key": "minCount", "type": "int"}, + "enable_auto_scaling": {"key": "enableAutoScaling", "type": "bool"}, + "type": {"key": "type", "type": "str"}, + "orchestrator_version": {"key": "orchestratorVersion", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "availability_zones": {"key": "availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "enableNodePublicIP", "type": "bool"}, + "scale_set_priority": {"key": "scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "scaleSetEvictionPolicy", "type": "str"}, + "node_taints": {"key": "nodeTaints", "type": "[str]"}, + "name": {"key": "name", "type": "str"}, } def __init__( @@ -1864,7 +1812,7 @@ def __init__( os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, @@ -1872,8 +1820,8 @@ def __init__( orchestrator_version: Optional[str] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, - scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", node_taints: Optional[List[str]] = None, **kwargs ): @@ -1918,7 +1866,7 @@ def __init__( "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :paramtype vm_size: str or ~azure.mgmt.containerservice.v2019_10_01.models.ContainerServiceVMSizeTypes :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every @@ -1930,7 +1878,7 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux" and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2019_10_01.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -1939,7 +1887,7 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword type: AgentPoolType represents types of an agent pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2019_10_01.models.AgentPoolType :keyword orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -1950,26 +1898,44 @@ def __init__( :keyword enable_node_public_ip: Enable public IP for nodes. :paramtype enable_node_public_ip: bool :keyword scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Known values are: "Low", "Regular". Default value: "Regular". + priority. Default to regular. Known values are: "Low" and "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2019_10_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy for low priority virtual machine scale set. Default to Delete. Known values are: - "Delete", "Deallocate". Default value: "Delete". + "Delete" and "Deallocate". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2019_10_01.models.ScaleSetEvictionPolicy :keyword node_taints: Taints added to new nodes during node pool create and scale. For example, key=value:NoSchedule. :paramtype node_taints: list[str] - :keyword name: Required. Unique name of the agent pool profile in the context of the - subscription and resource group. + :keyword name: Unique name of the agent pool profile in the context of the subscription and + resource group. Required. :paramtype name: str """ - super(ManagedClusterAgentPoolProfile, self).__init__(count=count, vm_size=vm_size, os_disk_size_gb=os_disk_size_gb, vnet_subnet_id=vnet_subnet_id, max_pods=max_pods, os_type=os_type, max_count=max_count, min_count=min_count, enable_auto_scaling=enable_auto_scaling, type=type, orchestrator_version=orchestrator_version, availability_zones=availability_zones, enable_node_public_ip=enable_node_public_ip, scale_set_priority=scale_set_priority, scale_set_eviction_policy=scale_set_eviction_policy, node_taints=node_taints, **kwargs) + super().__init__( + count=count, + vm_size=vm_size, + os_disk_size_gb=os_disk_size_gb, + vnet_subnet_id=vnet_subnet_id, + max_pods=max_pods, + os_type=os_type, + max_count=max_count, + min_count=min_count, + enable_auto_scaling=enable_auto_scaling, + type=type, + orchestrator_version=orchestrator_version, + availability_zones=availability_zones, + enable_node_public_ip=enable_node_public_ip, + scale_set_priority=scale_set_priority, + scale_set_eviction_policy=scale_set_eviction_policy, + node_taints=node_taints, + **kwargs + ) self.name = name -class ManagedClusterAPIServerAccessProfile(msrest.serialization.Model): +class ManagedClusterAPIServerAccessProfile(_serialization.Model): """Access profile for managed cluster API server. :ivar authorized_ip_ranges: Authorized IP Ranges to kubernetes API server. @@ -1979,8 +1945,8 @@ class ManagedClusterAPIServerAccessProfile(msrest.serialization.Model): """ _attribute_map = { - 'authorized_ip_ranges': {'key': 'authorizedIPRanges', 'type': '[str]'}, - 'enable_private_cluster': {'key': 'enablePrivateCluster', 'type': 'bool'}, + "authorized_ip_ranges": {"key": "authorizedIPRanges", "type": "[str]"}, + "enable_private_cluster": {"key": "enablePrivateCluster", "type": "bool"}, } def __init__( @@ -1996,12 +1962,12 @@ def __init__( :keyword enable_private_cluster: Whether to create the cluster as a private cluster or not. :paramtype enable_private_cluster: bool """ - super(ManagedClusterAPIServerAccessProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.authorized_ip_ranges = authorized_ip_ranges self.enable_private_cluster = enable_private_cluster -class ManagedClusterIdentity(msrest.serialization.Model): +class ManagedClusterIdentity(_serialization.Model): """Identity for the managed cluster. Variables are only populated by the server, and will be ignored when sending a request. @@ -2015,41 +1981,36 @@ class ManagedClusterIdentity(msrest.serialization.Model): :ivar type: The type of identity used for the managed cluster. Type 'SystemAssigned' will use an implicitly created identity in master components and an auto-created user assigned identity in MC_ resource group in agent nodes. Type 'None' will not use MSI for the managed cluster, - service principal will be used instead. Known values are: "SystemAssigned", "None". + service principal will be used instead. Known values are: "SystemAssigned" and "None". :vartype type: str or ~azure.mgmt.containerservice.v2019_10_01.models.ResourceIdentityType """ _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, + "principal_id": {"readonly": True}, + "tenant_id": {"readonly": True}, } _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, + "principal_id": {"key": "principalId", "type": "str"}, + "tenant_id": {"key": "tenantId", "type": "str"}, + "type": {"key": "type", "type": "str"}, } - def __init__( - self, - *, - type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, - **kwargs - ): + def __init__(self, *, type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, **kwargs): """ :keyword type: The type of identity used for the managed cluster. Type 'SystemAssigned' will use an implicitly created identity in master components and an auto-created user assigned identity in MC_ resource group in agent nodes. Type 'None' will not use MSI for the managed - cluster, service principal will be used instead. Known values are: "SystemAssigned", "None". + cluster, service principal will be used instead. Known values are: "SystemAssigned" and "None". :paramtype type: str or ~azure.mgmt.containerservice.v2019_10_01.models.ResourceIdentityType """ - super(ManagedClusterIdentity, self).__init__(**kwargs) + super().__init__(**kwargs) self.principal_id = None self.tenant_id = None self.type = type -class ManagedClusterListResult(msrest.serialization.Model): +class ManagedClusterListResult(_serialization.Model): """The response from the List Managed Clusters operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -2061,30 +2022,25 @@ class ManagedClusterListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[ManagedCluster]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[ManagedCluster]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.ManagedCluster"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.ManagedCluster"]] = None, **kwargs): """ :keyword value: The list of managed clusters. :paramtype value: list[~azure.mgmt.containerservice.v2019_10_01.models.ManagedCluster] """ - super(ManagedClusterListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class ManagedClusterLoadBalancerProfile(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfile(_serialization.Model): """Profile of the managed cluster load balancer. :ivar managed_outbound_i_ps: Desired managed outbound IPs for the cluster load balancer. @@ -2103,10 +2059,16 @@ class ManagedClusterLoadBalancerProfile(msrest.serialization.Model): """ _attribute_map = { - 'managed_outbound_i_ps': {'key': 'managedOutboundIPs', 'type': 'ManagedClusterLoadBalancerProfileManagedOutboundIPs'}, - 'outbound_ip_prefixes': {'key': 'outboundIPPrefixes', 'type': 'ManagedClusterLoadBalancerProfileOutboundIPPrefixes'}, - 'outbound_i_ps': {'key': 'outboundIPs', 'type': 'ManagedClusterLoadBalancerProfileOutboundIPs'}, - 'effective_outbound_i_ps': {'key': 'effectiveOutboundIPs', 'type': '[ResourceReference]'}, + "managed_outbound_i_ps": { + "key": "managedOutboundIPs", + "type": "ManagedClusterLoadBalancerProfileManagedOutboundIPs", + }, + "outbound_ip_prefixes": { + "key": "outboundIPPrefixes", + "type": "ManagedClusterLoadBalancerProfileOutboundIPPrefixes", + }, + "outbound_i_ps": {"key": "outboundIPs", "type": "ManagedClusterLoadBalancerProfileOutboundIPs"}, + "effective_outbound_i_ps": {"key": "effectiveOutboundIPs", "type": "[ResourceReference]"}, } def __init__( @@ -2134,14 +2096,14 @@ def __init__( :paramtype effective_outbound_i_ps: list[~azure.mgmt.containerservice.v2019_10_01.models.ResourceReference] """ - super(ManagedClusterLoadBalancerProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.managed_outbound_i_ps = managed_outbound_i_ps self.outbound_ip_prefixes = outbound_ip_prefixes self.outbound_i_ps = outbound_i_ps self.effective_outbound_i_ps = effective_outbound_i_ps -class ManagedClusterLoadBalancerProfileManagedOutboundIPs(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfileManagedOutboundIPs(_serialization.Model): """Desired managed outbound IPs for the cluster load balancer. :ivar count: Desired number of outbound IP created/managed by Azure for the cluster load @@ -2150,29 +2112,24 @@ class ManagedClusterLoadBalancerProfileManagedOutboundIPs(msrest.serialization.M """ _validation = { - 'count': {'maximum': 100, 'minimum': 1}, + "count": {"maximum": 100, "minimum": 1}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, + "count": {"key": "count", "type": "int"}, } - def __init__( - self, - *, - count: Optional[int] = 1, - **kwargs - ): + def __init__(self, *, count: int = 1, **kwargs): """ :keyword count: Desired number of outbound IP created/managed by Azure for the cluster load balancer. Allowed values must be in the range of 1 to 100 (inclusive). The default value is 1. :paramtype count: int """ - super(ManagedClusterLoadBalancerProfileManagedOutboundIPs, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count -class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(_serialization.Model): """Desired outbound IP Prefix resources for the cluster load balancer. :ivar public_ip_prefixes: A list of public IP prefix resources. @@ -2181,25 +2138,20 @@ class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(msrest.serialization.M """ _attribute_map = { - 'public_ip_prefixes': {'key': 'publicIPPrefixes', 'type': '[ResourceReference]'}, + "public_ip_prefixes": {"key": "publicIPPrefixes", "type": "[ResourceReference]"}, } - def __init__( - self, - *, - public_ip_prefixes: Optional[List["_models.ResourceReference"]] = None, - **kwargs - ): + def __init__(self, *, public_ip_prefixes: Optional[List["_models.ResourceReference"]] = None, **kwargs): """ :keyword public_ip_prefixes: A list of public IP prefix resources. :paramtype public_ip_prefixes: list[~azure.mgmt.containerservice.v2019_10_01.models.ResourceReference] """ - super(ManagedClusterLoadBalancerProfileOutboundIPPrefixes, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_ip_prefixes = public_ip_prefixes -class ManagedClusterLoadBalancerProfileOutboundIPs(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfileOutboundIPs(_serialization.Model): """Desired outbound IP resources for the cluster load balancer. :ivar public_i_ps: A list of public IP resources. @@ -2207,34 +2159,29 @@ class ManagedClusterLoadBalancerProfileOutboundIPs(msrest.serialization.Model): """ _attribute_map = { - 'public_i_ps': {'key': 'publicIPs', 'type': '[ResourceReference]'}, + "public_i_ps": {"key": "publicIPs", "type": "[ResourceReference]"}, } - def __init__( - self, - *, - public_i_ps: Optional[List["_models.ResourceReference"]] = None, - **kwargs - ): + def __init__(self, *, public_i_ps: Optional[List["_models.ResourceReference"]] = None, **kwargs): """ :keyword public_i_ps: A list of public IP resources. :paramtype public_i_ps: list[~azure.mgmt.containerservice.v2019_10_01.models.ResourceReference] """ - super(ManagedClusterLoadBalancerProfileOutboundIPs, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_i_ps = public_i_ps -class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): +class ManagedClusterPoolUpgradeProfile(_serialization.Model): """The list of available upgrade versions. All required parameters must be populated in order to send to Azure. - :ivar kubernetes_version: Required. Kubernetes version (major, minor, patch). + :ivar kubernetes_version: Kubernetes version (major, minor, patch). Required. :vartype kubernetes_version: str :ivar name: Pool name. :vartype name: str - :ivar os_type: Required. OsType to be used to specify os type. Choose from Linux and Windows. - Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to + Linux. Known values are: "Linux" and "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2019_10_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -2242,15 +2189,15 @@ class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): """ _validation = { - 'kubernetes_version': {'required': True}, - 'os_type': {'required': True}, + "kubernetes_version": {"required": True}, + "os_type": {"required": True}, } _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'upgrades': {'key': 'upgrades', 'type': '[ManagedClusterPoolUpgradeProfileUpgradesItem]'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "os_type": {"key": "osType", "type": "str"}, + "upgrades": {"key": "upgrades", "type": "[ManagedClusterPoolUpgradeProfileUpgradesItem]"}, } def __init__( @@ -2263,25 +2210,25 @@ def __init__( **kwargs ): """ - :keyword kubernetes_version: Required. Kubernetes version (major, minor, patch). + :keyword kubernetes_version: Kubernetes version (major, minor, patch). Required. :paramtype kubernetes_version: str :keyword name: Pool name. :paramtype name: str - :keyword os_type: Required. OsType to be used to specify os type. Choose from Linux and - Windows. Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default + to Linux. Known values are: "Linux" and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2019_10_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: list[~azure.mgmt.containerservice.v2019_10_01.models.ManagedClusterPoolUpgradeProfileUpgradesItem] """ - super(ManagedClusterPoolUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.name = name self.os_type = os_type self.upgrades = upgrades -class ManagedClusterPoolUpgradeProfileUpgradesItem(msrest.serialization.Model): +class ManagedClusterPoolUpgradeProfileUpgradesItem(_serialization.Model): """ManagedClusterPoolUpgradeProfileUpgradesItem. :ivar kubernetes_version: Kubernetes version (major, minor, patch). @@ -2291,67 +2238,55 @@ class ManagedClusterPoolUpgradeProfileUpgradesItem(msrest.serialization.Model): """ _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } - def __init__( - self, - *, - kubernetes_version: Optional[str] = None, - is_preview: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, kubernetes_version: Optional[str] = None, is_preview: Optional[bool] = None, **kwargs): """ :keyword kubernetes_version: Kubernetes version (major, minor, patch). :paramtype kubernetes_version: str :keyword is_preview: Whether Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(ManagedClusterPoolUpgradeProfileUpgradesItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.is_preview = is_preview -class ManagedClusterServicePrincipalProfile(msrest.serialization.Model): +class ManagedClusterServicePrincipalProfile(_serialization.Model): """Information about a service principal identity for the cluster to use for manipulating Azure APIs. All required parameters must be populated in order to send to Azure. - :ivar client_id: Required. The ID for the service principal. + :ivar client_id: The ID for the service principal. Required. :vartype client_id: str :ivar secret: The secret password associated with the service principal in plain text. :vartype secret: str """ _validation = { - 'client_id': {'required': True}, + "client_id": {"required": True}, } _attribute_map = { - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'secret': {'key': 'secret', 'type': 'str'}, + "client_id": {"key": "clientId", "type": "str"}, + "secret": {"key": "secret", "type": "str"}, } - def __init__( - self, - *, - client_id: str, - secret: Optional[str] = None, - **kwargs - ): + def __init__(self, *, client_id: str, secret: Optional[str] = None, **kwargs): """ - :keyword client_id: Required. The ID for the service principal. + :keyword client_id: The ID for the service principal. Required. :paramtype client_id: str :keyword secret: The secret password associated with the service principal in plain text. :paramtype secret: str """ - super(ManagedClusterServicePrincipalProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.client_id = client_id self.secret = secret -class ManagedClusterUpgradeProfile(msrest.serialization.Model): +class ManagedClusterUpgradeProfile(_serialization.Model): """The list of available upgrades for compute pools. Variables are only populated by the server, and will be ignored when sending a request. @@ -2364,29 +2299,29 @@ class ManagedClusterUpgradeProfile(msrest.serialization.Model): :vartype name: str :ivar type: Type of upgrade profile. :vartype type: str - :ivar control_plane_profile: Required. The list of available upgrade versions for the control - plane. + :ivar control_plane_profile: The list of available upgrade versions for the control plane. + Required. :vartype control_plane_profile: ~azure.mgmt.containerservice.v2019_10_01.models.ManagedClusterPoolUpgradeProfile - :ivar agent_pool_profiles: Required. The list of available upgrade versions for agent pools. + :ivar agent_pool_profiles: The list of available upgrade versions for agent pools. Required. :vartype agent_pool_profiles: list[~azure.mgmt.containerservice.v2019_10_01.models.ManagedClusterPoolUpgradeProfile] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'control_plane_profile': {'required': True}, - 'agent_pool_profiles': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "control_plane_profile": {"required": True}, + "agent_pool_profiles": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'control_plane_profile': {'key': 'properties.controlPlaneProfile', 'type': 'ManagedClusterPoolUpgradeProfile'}, - 'agent_pool_profiles': {'key': 'properties.agentPoolProfiles', 'type': '[ManagedClusterPoolUpgradeProfile]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "control_plane_profile": {"key": "properties.controlPlaneProfile", "type": "ManagedClusterPoolUpgradeProfile"}, + "agent_pool_profiles": {"key": "properties.agentPoolProfiles", "type": "[ManagedClusterPoolUpgradeProfile]"}, } def __init__( @@ -2397,15 +2332,15 @@ def __init__( **kwargs ): """ - :keyword control_plane_profile: Required. The list of available upgrade versions for the - control plane. + :keyword control_plane_profile: The list of available upgrade versions for the control plane. + Required. :paramtype control_plane_profile: ~azure.mgmt.containerservice.v2019_10_01.models.ManagedClusterPoolUpgradeProfile - :keyword agent_pool_profiles: Required. The list of available upgrade versions for agent pools. + :keyword agent_pool_profiles: The list of available upgrade versions for agent pools. Required. :paramtype agent_pool_profiles: list[~azure.mgmt.containerservice.v2019_10_01.models.ManagedClusterPoolUpgradeProfile] """ - super(ManagedClusterUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -2413,18 +2348,18 @@ def __init__( self.agent_pool_profiles = agent_pool_profiles -class ManagedClusterWindowsProfile(msrest.serialization.Model): +class ManagedClusterWindowsProfile(_serialization.Model): """Profile for Windows VMs in the container service cluster. All required parameters must be populated in order to send to Azure. - :ivar admin_username: Required. Specifies the name of the administrator account. - :code:`
`:code:`
` **restriction:** Cannot end in "." :code:`
`:code:`
` - **Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", "test1", - "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", - "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", - "sys", "test2", "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 - character :code:`
`:code:`
` **Max-length:** 20 characters. + :ivar admin_username: Specifies the name of the administrator account. :code:`
`:code:`
` + **restriction:** Cannot end in "." :code:`
`:code:`
` **Disallowed values:** + "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", + "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", + "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", + "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 character + :code:`
`:code:`
` **Max-length:** 20 characters. Required. :vartype admin_username: str :ivar admin_password: Specifies the password of the administrator account. :code:`
`:code:`
` **Minimum-length:** 8 characters :code:`
`:code:`
` @@ -2437,29 +2372,23 @@ class ManagedClusterWindowsProfile(msrest.serialization.Model): """ _validation = { - 'admin_username': {'required': True}, + "admin_username": {"required": True}, } _attribute_map = { - 'admin_username': {'key': 'adminUsername', 'type': 'str'}, - 'admin_password': {'key': 'adminPassword', 'type': 'str'}, + "admin_username": {"key": "adminUsername", "type": "str"}, + "admin_password": {"key": "adminPassword", "type": "str"}, } - def __init__( - self, - *, - admin_username: str, - admin_password: Optional[str] = None, - **kwargs - ): + def __init__(self, *, admin_username: str, admin_password: Optional[str] = None, **kwargs): """ - :keyword admin_username: Required. Specifies the name of the administrator account. + :keyword admin_username: Specifies the name of the administrator account. :code:`
`:code:`
` **restriction:** Cannot end in "." :code:`
`:code:`
` **Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 - character :code:`
`:code:`
` **Max-length:** 20 characters. + character :code:`
`:code:`
` **Max-length:** 20 characters. Required. :paramtype admin_username: str :keyword admin_password: Specifies the password of the administrator account. :code:`
`:code:`
` **Minimum-length:** 8 characters :code:`
`:code:`
` @@ -2470,12 +2399,12 @@ def __init__( "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!". :paramtype admin_password: str """ - super(ManagedClusterWindowsProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.admin_username = admin_username self.admin_password = admin_password -class OperationListResult(msrest.serialization.Model): +class OperationListResult(_serialization.Model): """The List Compute Operation operation response. Variables are only populated by the server, and will be ignored when sending a request. @@ -2485,24 +2414,20 @@ class OperationListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[OperationValue]'}, + "value": {"key": "value", "type": "[OperationValue]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(OperationListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None -class OperationValue(msrest.serialization.Model): +class OperationValue(_serialization.Model): """Describes the properties of a Compute Operation value. Variables are only populated by the server, and will be ignored when sending a request. @@ -2522,30 +2447,26 @@ class OperationValue(msrest.serialization.Model): """ _validation = { - 'origin': {'readonly': True}, - 'name': {'readonly': True}, - 'operation': {'readonly': True}, - 'resource': {'readonly': True}, - 'description': {'readonly': True}, - 'provider': {'readonly': True}, + "origin": {"readonly": True}, + "name": {"readonly": True}, + "operation": {"readonly": True}, + "resource": {"readonly": True}, + "description": {"readonly": True}, + "provider": {"readonly": True}, } _attribute_map = { - 'origin': {'key': 'origin', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'operation': {'key': 'display.operation', 'type': 'str'}, - 'resource': {'key': 'display.resource', 'type': 'str'}, - 'description': {'key': 'display.description', 'type': 'str'}, - 'provider': {'key': 'display.provider', 'type': 'str'}, + "origin": {"key": "origin", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "operation": {"key": "display.operation", "type": "str"}, + "resource": {"key": "display.resource", "type": "str"}, + "description": {"key": "display.description", "type": "str"}, + "provider": {"key": "display.provider", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(OperationValue, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.origin = None self.name = None self.operation = None @@ -2554,7 +2475,7 @@ def __init__( self.provider = None -class ResourceReference(msrest.serialization.Model): +class ResourceReference(_serialization.Model): """A reference to an Azure resource. :ivar id: The fully qualified Azure resource id. @@ -2562,43 +2483,33 @@ class ResourceReference(msrest.serialization.Model): """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, } - def __init__( - self, - *, - id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin """ :keyword id: The fully qualified Azure resource id. :paramtype id: str """ - super(ResourceReference, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id -class TagsObject(msrest.serialization.Model): +class TagsObject(_serialization.Model): """Tags object for patch operations. - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] """ _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] """ - super(TagsObject, self).__init__(**kwargs) + super().__init__(**kwargs) self.tags = tags diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/models/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/models/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/models/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/models/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/operations/__init__.py index 403c0174f052..ee6608454b6b 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/operations/__init__.py @@ -13,10 +13,11 @@ from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'Operations', - 'ManagedClustersOperations', - 'AgentPoolsOperations', + "Operations", + "ManagedClustersOperations", + "AgentPoolsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/operations/_agent_pools_operations.py index 30d32418184d..dcbbf0653ffe 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/operations/_agent_pools_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,249 +27,250 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - *, - json: Optional[_models.AgentPool] = None, - content: Any = None, - **kwargs: Any + _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, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + _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, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_get_upgrade_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_available_agent_pool_versions_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class AgentPoolsOperations: """ @@ -285,48 +291,40 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> Iterable[_models.AgentPoolListResult]: + def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> Iterable["_models.AgentPool"]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. The operation returns properties of each agent pool. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AgentPoolListResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2019_10_01.models.AgentPoolListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either AgentPool or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2019_10_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -334,16 +332,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -359,10 +352,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -372,54 +363,45 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore @distributed_trace def get( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPool: """Gets the agent pool. Gets the details of the agent pool by managed cluster and resource group. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPool, or the result of cls(response) + :return: AgentPool or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_10_01.models.AgentPool - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -427,57 +409,60 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore def _create_or_update_initial( self, resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: _models.AgentPool, + parameters: Union[_models.AgentPool, IO], **kwargs: Any ) -> _models.AgentPool: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - _json = self._serialize.body(parameters, 'AgentPool') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "AgentPool") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -485,10 +470,9 @@ def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -496,40 +480,86 @@ def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - - @distributed_trace + @overload def begin_create_or_update( self, resource_group_name: str, resource_name: str, agent_pool_name: str, parameters: _models.AgentPool, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.AgentPool]: """Creates or updates an agent pool. Creates or updates an agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :param parameters: Parameters supplied to the Create or Update an agent pool operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2019_10_01.models.AgentPool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2019_10_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AgentPool]: + """Creates or updates an agent pool. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: Parameters supplied to the Create or Update an agent pool operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -541,20 +571,56 @@ def begin_create_or_update( :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2019_10_01.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: Union[_models.AgentPool, IO], + **kwargs: Any + ) -> LROPoller[_models.AgentPool]: + """Creates or updates an agent pool. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: Parameters supplied to the Create or Update an agent pool operation. Is + either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2019_10_01.models.AgentPool or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2019_10_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -563,66 +629,55 @@ def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -630,10 +685,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -643,26 +697,21 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + def begin_delete( + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> LROPoller[None]: """Deletes an agent pool. Deletes the agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -674,100 +723,86 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPoolUpgradeProfile: """Gets upgrade profile for an agent pool. Gets the details of the upgrade profile for an agent pool with a specified resource group and managed cluster name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolUpgradeProfile, or the result of cls(response) + :return: AgentPoolUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_10_01.models.AgentPoolUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -775,64 +810,56 @@ def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolUpgradeProfile', pipeline_response) + deserialized = self._deserialize("AgentPoolUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore @distributed_trace def get_available_agent_pool_versions( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported versions for the specified agent pool. Gets a list of supported versions for the specified agent pool. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolAvailableVersions, or the result of cls(response) + :return: AgentPoolAvailableVersions or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_10_01.models.AgentPoolAvailableVersions - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolAvailableVersions] - request = build_get_available_agent_pool_versions_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_available_agent_pool_versions.metadata['url'], + template_url=self.get_available_agent_pool_versions.metadata["url"], headers=_headers, params=_params, ) @@ -840,22 +867,20 @@ def get_available_agent_pool_versions( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolAvailableVersions', pipeline_response) + deserialized = self._deserialize("AgentPoolAvailableVersions", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_available_agent_pool_versions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore - + get_available_agent_pool_versions.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/operations/_managed_clusters_operations.py index e8ebce1fe60d..3e398664cf05 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/operations/_managed_clusters_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,557 +27,536 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters") + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters" + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_resource_group_request( - subscription_id: str, - resource_group_name: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters", + ) # 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', min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_upgrade_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_access_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, role_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 = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "roleName": _SERIALIZER.url("role_name", role_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "roleName": _SERIALIZER.url("role_name", role_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_admin_credentials_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_user_credentials_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_monitoring_user_credentials_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: + +def build_get_request(resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedCluster] = None, - content: Any = None, - **kwargs: Any +def build_create_or_update_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_update_tags_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.TagsObject] = None, - content: Any = None, - **kwargs: Any + +def build_update_tags_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + +def build_delete_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_reset_service_principal_profile_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedClusterServicePrincipalProfile] = None, - content: Any = None, - **kwargs: Any + +def build_reset_service_principal_profile_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_reset_aad_profile_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedClusterAADProfile] = None, - content: Any = None, - **kwargs: Any +def build_reset_aad_profile_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_rotate_cluster_certificates_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any +def build_rotate_cluster_certificates_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + class ManagedClustersOperations: """ @@ -593,41 +577,35 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.ManagedClusterListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.ManagedCluster"]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. The operation returns properties of each managed cluster. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2019_10_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2019_10_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -635,14 +613,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -658,10 +633,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -671,50 +644,42 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> Iterable[_models.ManagedClusterListResult]: + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.ManagedCluster"]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. The operation returns properties of each managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2019_10_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2019_10_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -722,15 +687,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -746,10 +707,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -759,51 +718,43 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.ManagedClusterUpgradeProfile: """Gets upgrade profile for a managed cluster. Gets the details of the upgrade profile for a managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterUpgradeProfile, or the result of cls(response) + :return: ManagedClusterUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_10_01.models.ManagedClusterUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -811,69 +762,60 @@ def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterUpgradeProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore @distributed_trace def get_access_profile( - self, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, role_name: str, **kwargs: Any ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. Gets the accessProfile for the specified role name of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param role_name: The name of the role for managed cluster accessProfile resource. + :param role_name: The name of the role for managed cluster accessProfile resource. Required. :type role_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterAccessProfile, or the result of cls(response) + :return: ManagedClusterAccessProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_10_01.models.ManagedClusterAccessProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterAccessProfile] - request = build_get_access_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, role_name=role_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_access_profile.metadata['url'], + template_url=self.get_access_profile.metadata["url"], headers=_headers, params=_params, ) @@ -881,64 +823,56 @@ def get_access_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterAccessProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterAccessProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_access_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore - + get_access_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore @distributed_trace def list_cluster_admin_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster admin credential of a managed cluster. Gets cluster admin credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_10_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_admin_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_admin_credentials.metadata['url'], + template_url=self.list_cluster_admin_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -946,64 +880,56 @@ def list_cluster_admin_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_admin_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore - + list_cluster_admin_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore @distributed_trace def list_cluster_user_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster user credential of a managed cluster. Gets cluster user credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_10_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_user_credentials.metadata['url'], + template_url=self.list_cluster_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -1011,65 +937,57 @@ def list_cluster_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore - + list_cluster_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore @distributed_trace def list_cluster_monitoring_user_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster monitoring user credential of a managed cluster. Gets cluster monitoring user credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_10_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_monitoring_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + template_url=self.list_cluster_monitoring_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -1077,64 +995,54 @@ def list_cluster_monitoring_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_monitoring_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore - + list_cluster_monitoring_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore @distributed_trace - def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.ManagedCluster: + def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.ManagedCluster: """Gets a managed cluster. Gets the details of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedCluster, or the result of cls(response) + :return: ManagedCluster or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_10_01.models.ManagedCluster - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -1142,55 +1050,54 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _create_or_update_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.ManagedCluster, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'ManagedCluster') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedCluster") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1198,10 +1105,9 @@ def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -1209,25 +1115,26 @@ def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - @distributed_trace + @overload def begin_create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedCluster, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. @@ -1235,12 +1142,16 @@ def begin_create_or_update( Creates or updates a managed cluster with the specified configuration for agents and Kubernetes version. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2019_10_01.models.ManagedCluster + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1253,20 +1164,91 @@ def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2019_10_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster with the specified configuration for agents and Kubernetes + version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2019_10_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster with the specified configuration for agents and Kubernetes + version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. Is + either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2019_10_01.models.ManagedCluster or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2019_10_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -1274,69 +1256,66 @@ def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _update_tags_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.TagsObject, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request_initial( - subscription_id=self._config.subscription_id, + request = build_update_tags_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_tags_initial.metadata['url'], + content=_content, + template_url=self._update_tags_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1344,44 +1323,118 @@ def _update_tags_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_tags_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _update_tags_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - @distributed_trace + @overload def begin_update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates a managed cluster with the specified tags. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2019_10_01.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2019_10_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates a managed cluster with the specified tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2019_10_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates a managed cluster with the specified tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2019_10_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1394,20 +1447,17 @@ def begin_update_tags( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2019_10_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, @@ -1415,64 +1465,54 @@ def begin_update_tags( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1480,10 +1520,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1493,23 +1532,17 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> LROPoller[None]: + def begin_delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> LROPoller[None]: """Deletes a managed cluster. Deletes the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1521,85 +1554,83 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterServicePrincipalProfile, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterServicePrincipalProfile") - request = build_reset_service_principal_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_service_principal_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_service_principal_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_service_principal_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1607,10 +1638,9 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1620,29 +1650,106 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re if cls: return cls(pipeline_response, None, {}) - _reset_service_principal_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore - + _reset_service_principal_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore - @distributed_trace - def begin_reset_service_principal_profile( # pylint: disable=inconsistent-return-statements + @overload + def begin_reset_service_principal_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterServicePrincipalProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: """Reset Service Principal Profile of a managed cluster. Update the service principal Profile for a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a - Managed Cluster. + Managed Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2019_10_01.models.ManagedClusterServicePrincipalProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reset Service Principal Profile of a managed cluster. + + Update the service principal Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a + Managed Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Reset Service Principal Profile of a managed cluster. + + Update the service principal Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a + Managed Cluster. Is either a model type or a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2019_10_01.models.ManagedClusterServicePrincipalProfile or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1653,20 +1760,17 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1674,67 +1778,68 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_service_principal_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + begin_reset_service_principal_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterAADProfile, + parameters: Union[_models.ManagedClusterAADProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterAADProfile") - request = build_reset_aad_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_aad_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_aad_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_aad_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1742,10 +1847,9 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1755,28 +1859,32 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement if cls: return cls(pipeline_response, None, {}) - _reset_aad_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - + _reset_aad_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - @distributed_trace - def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements + @overload + def begin_reset_aad_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterAADProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: """Reset AAD Profile of a managed cluster. Update the AAD Profile for a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed - Cluster. + Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2019_10_01.models.ManagedClusterAADProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1787,20 +1895,90 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reset AAD Profile of a managed cluster. + + Update the AAD Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed + Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterAADProfile, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Reset AAD Profile of a managed cluster. + + Update the AAD Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed + Cluster. Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2019_10_01.models.ManagedClusterAADProfile or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1808,62 +1986,52 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_aad_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + begin_reset_aad_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_rotate_cluster_certificates_request_initial( - subscription_id=self._config.subscription_id, + request = build_rotate_cluster_certificates_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._rotate_cluster_certificates_initial.metadata['url'], + template_url=self._rotate_cluster_certificates_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1871,10 +2039,9 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1884,23 +2051,19 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return if cls: return cls(pipeline_response, None, {}) - _rotate_cluster_certificates_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore - + _rotate_cluster_certificates_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore @distributed_trace - def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + def begin_rotate_cluster_certificates( + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> LROPoller[None]: """Rotate certificates of a managed cluster. Rotate certificates of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1912,52 +2075,45 @@ def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-st Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._rotate_cluster_certificates_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_rotate_cluster_certificates.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore + begin_rotate_cluster_certificates.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/operations/_operations.py index 060ec6897058..61a0cd7dab15 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/operations/_operations.py @@ -7,10 +7,15 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,38 +25,34 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - **kwargs: Any -) -> HttpRequest: + +def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.ContainerService/operations") # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class Operations: """ @@ -72,36 +73,31 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.OperationListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.OperationValue"]: """Gets a list of compute operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationListResult or the result of cls(response) + :return: An iterator like instance of either OperationValue or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2019_10_01.models.OperationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2019_10_01.models.OperationValue] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -109,13 +105,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -131,10 +125,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -144,8 +136,6 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.ContainerService/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ContainerService/operations"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/operations/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/__init__.py index 37a5f9e02e6f..a8716d29afe8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/__init__.py @@ -14,7 +14,8 @@ except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['ContainerServiceClient'] + +__all__ = ["ContainerServiceClient"] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/_configuration.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/_configuration.py index 5ddbb95f3b4c..567d1c6291f3 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/_configuration.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/_configuration.py @@ -18,30 +18,26 @@ VERSION = "unknown" + class ContainerServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ContainerServiceClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2019-10-27-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: + def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ContainerServiceClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2019-10-27-preview") # type: str + api_version = kwargs.pop("api_version", "2019-10-27-preview") # type: str if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -51,23 +47,24 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-containerservice/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-containerservice/{}".format(VERSION)) self._configure(**kwargs) def _configure( - self, - **kwargs # type: Any + self, **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/_container_service_client.py index d7398868c55b..196cbf455a44 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/_container_service_client.py @@ -9,12 +9,11 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from . import models +from .._serialization import Deserializer, Serializer from ._configuration import ContainerServiceClientConfiguration from .operations import OpenShiftManagedClustersOperations @@ -22,16 +21,17 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class ContainerServiceClient: + +class ContainerServiceClient: # pylint: disable=client-accepts-api-version-keyword """The Container Service Client. :ivar open_shift_managed_clusters: OpenShiftManagedClustersOperations operations :vartype open_shift_managed_clusters: azure.mgmt.containerservice.v2019_10_27_preview.operations.OpenShiftManagedClustersOperations - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -49,7 +49,9 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = ContainerServiceClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = ContainerServiceClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} @@ -60,12 +62,7 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) - - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> HttpResponse: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -74,7 +71,7 @@ def _send_request( >>> response = client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/_metadata.json b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/_metadata.json index 02adc3aa8a94..ea3f70b61843 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/_metadata.json +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/_metadata.json @@ -10,20 +10,20 @@ "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { "credential": { - "signature": "credential, # type: \"TokenCredential\"", - "description": "Credential needed for the client to connect to Azure.", + "signature": "credential: \"TokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true }, "subscription_id": { - "signature": "subscription_id, # type: str", - "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "signature": "subscription_id: str,", + "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.", "docstring_type": "str", "required": true } @@ -31,13 +31,13 @@ "async": { "credential": { "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure.", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { "signature": "subscription_id: str,", - "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.", "docstring_type": "str", "required": true } @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=\"https://management.azure.com\", # type: str", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/_patch.py index 74e48ecd07cf..f99e77fef986 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/_patch.py @@ -28,4 +28,4 @@ # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + pass diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/_vendor.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/_vendor.py index 138f663c53a4..9aad73fc743e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/_vendor.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/_vendor.py @@ -7,6 +7,7 @@ from azure.core.pipeline.transport import HttpRequest + def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) @@ -14,6 +15,7 @@ def _convert_request(request, files=None): request.set_formdata_body(files) return request + def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -21,7 +23,5 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [ - c for c in formatted_components if "{}".format(key.args[0]) not in c - ] + components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/aio/__init__.py index 37a5f9e02e6f..a8716d29afe8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/aio/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/aio/__init__.py @@ -14,7 +14,8 @@ except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['ContainerServiceClient'] + +__all__ = ["ContainerServiceClient"] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/aio/_configuration.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/aio/_configuration.py index 6e7b7e06b8f1..1907e2c16b93 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/aio/_configuration.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/aio/_configuration.py @@ -18,30 +18,26 @@ VERSION = "unknown" + class ContainerServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ContainerServiceClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2019-10-27-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: + def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ContainerServiceClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2019-10-27-preview") # type: str + api_version = kwargs.pop("api_version", "2019-10-27-preview") # type: str if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -51,22 +47,21 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-containerservice/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-containerservice/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, - **kwargs: Any - ) -> None: - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/aio/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/aio/_container_service_client.py index f3d3fc73f3a7..bad766e7bbc0 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/aio/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/aio/_container_service_client.py @@ -9,12 +9,11 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from .. import models +from ..._serialization import Deserializer, Serializer from ._configuration import ContainerServiceClientConfiguration from .operations import OpenShiftManagedClustersOperations @@ -22,16 +21,17 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class ContainerServiceClient: + +class ContainerServiceClient: # pylint: disable=client-accepts-api-version-keyword """The Container Service Client. :ivar open_shift_managed_clusters: OpenShiftManagedClustersOperations operations :vartype open_shift_managed_clusters: azure.mgmt.containerservice.v2019_10_27_preview.aio.operations.OpenShiftManagedClustersOperations - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -49,7 +49,9 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = ContainerServiceClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = ContainerServiceClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} @@ -60,12 +62,7 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) - - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -74,7 +71,7 @@ def _send_request( >>> response = await client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/aio/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/aio/_patch.py index 74e48ecd07cf..f99e77fef986 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/aio/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/aio/_patch.py @@ -28,4 +28,4 @@ # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + pass diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/aio/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/aio/operations/__init__.py index 211a87879804..69775b67d4ba 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/aio/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/aio/operations/__init__.py @@ -11,8 +11,9 @@ from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'OpenShiftManagedClustersOperations', + "OpenShiftManagedClustersOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/aio/operations/_open_shift_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/aio/operations/_open_shift_managed_clusters_operations.py index 693e6eb1504f..e730b4268b2c 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/aio/operations/_open_shift_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/aio/operations/_open_shift_managed_clusters_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +29,19 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._open_shift_managed_clusters_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_resource_group_request, build_list_request, build_update_tags_request_initial -T = TypeVar('T') +from ...operations._open_shift_managed_clusters_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_resource_group_request, + build_list_request, + build_update_tags_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class OpenShiftManagedClustersOperations: """ .. warning:: @@ -45,41 +61,36 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.OpenShiftManagedClusterListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.OpenShiftManagedCluster"]: """Gets a list of OpenShift managed clusters in the specified subscription. Gets a list of OpenShift managed clusters in the specified subscription. The operation returns properties of each OpenShift managed cluster. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OpenShiftManagedClusterListResult or the result of + :return: An iterator like instance of either OpenShiftManagedCluster or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2019_10_27_preview.models.OpenShiftManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2019_10_27_preview.models.OpenShiftManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-27-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-27-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OpenShiftManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -87,14 +98,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -110,10 +118,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -123,50 +129,45 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/openShiftManagedClusters"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/openShiftManagedClusters"} # type: ignore @distributed_trace def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.OpenShiftManagedClusterListResult]: + self, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.OpenShiftManagedCluster"]: """Lists OpenShift managed clusters in the specified subscription and resource group. Lists OpenShift managed clusters in the specified subscription and resource group. The operation returns properties of each OpenShift managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OpenShiftManagedClusterListResult or the result of + :return: An iterator like instance of either OpenShiftManagedCluster or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2019_10_27_preview.models.OpenShiftManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2019_10_27_preview.models.OpenShiftManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-27-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-27-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OpenShiftManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -174,15 +175,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -198,10 +195,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -211,50 +206,40 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters"} # type: ignore @distributed_trace_async - async def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.OpenShiftManagedCluster: + async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.OpenShiftManagedCluster: """Gets a OpenShift managed cluster. Gets the details of the managed OpenShift cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the OpenShift managed cluster resource. + :param resource_name: The name of the OpenShift managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: OpenShiftManagedCluster, or the result of cls(response) + :return: OpenShiftManagedCluster or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_10_27_preview.models.OpenShiftManagedCluster - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-27-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-27-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OpenShiftManagedCluster] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -262,55 +247,58 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('OpenShiftManagedCluster', pipeline_response) + deserialized = self._deserialize("OpenShiftManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore async def _create_or_update_initial( self, resource_group_name: str, resource_name: str, - parameters: _models.OpenShiftManagedCluster, + parameters: Union[_models.OpenShiftManagedCluster, IO], **kwargs: Any ) -> _models.OpenShiftManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2019-10-27-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-27-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.OpenShiftManagedCluster] - _json = self._serialize.body(parameters, 'OpenShiftManagedCluster') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "OpenShiftManagedCluster") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -318,10 +306,9 @@ async def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -329,25 +316,26 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('OpenShiftManagedCluster', pipeline_response) + deserialized = self._deserialize("OpenShiftManagedCluster", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('OpenShiftManagedCluster', pipeline_response) + deserialized = self._deserialize("OpenShiftManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore - + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore - @distributed_trace_async + @overload async def begin_create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.OpenShiftManagedCluster, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.OpenShiftManagedCluster]: """Creates or updates an OpenShift managed cluster. @@ -355,14 +343,96 @@ async def begin_create_or_update( Creates or updates a OpenShift managed cluster with the specified configuration for agents and OpenShift version. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the OpenShift managed cluster resource. + :param resource_name: The name of the OpenShift managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Create or Update an OpenShift Managed Cluster - operation. + operation. Required. :type parameters: ~azure.mgmt.containerservice.v2019_10_27_preview.models.OpenShiftManagedCluster + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either OpenShiftManagedCluster or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2019_10_27_preview.models.OpenShiftManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OpenShiftManagedCluster]: + """Creates or updates an OpenShift managed cluster. + + Creates or updates a OpenShift managed cluster with the specified configuration for agents and + OpenShift version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the OpenShift managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Create or Update an OpenShift Managed Cluster + operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either OpenShiftManagedCluster or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2019_10_27_preview.models.OpenShiftManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.OpenShiftManagedCluster, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.OpenShiftManagedCluster]: + """Creates or updates an OpenShift managed cluster. + + Creates or updates a OpenShift managed cluster with the specified configuration for agents and + OpenShift version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the OpenShift managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Create or Update an OpenShift Managed Cluster + operation. Is either a model type or a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2019_10_27_preview.models.OpenShiftManagedCluster or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -375,20 +445,17 @@ async def begin_create_or_update( result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2019_10_27_preview.models.OpenShiftManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-27-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-27-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.OpenShiftManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -396,69 +463,66 @@ async def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('OpenShiftManagedCluster', pipeline_response) + deserialized = self._deserialize("OpenShiftManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore async def _update_tags_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.TagsObject, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any ) -> _models.OpenShiftManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2019-10-27-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-27-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.OpenShiftManagedCluster] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request_initial( - subscription_id=self._config.subscription_id, + request = build_update_tags_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_tags_initial.metadata['url'], + content=_content, + template_url=self._update_tags_initial.metadata["url"], headers=_headers, params=_params, ) @@ -466,44 +530,48 @@ async def _update_tags_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('OpenShiftManagedCluster', pipeline_response) + deserialized = self._deserialize("OpenShiftManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_tags_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore + _update_tags_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore - - @distributed_trace_async + @overload async def begin_update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.OpenShiftManagedCluster]: """Updates tags on an OpenShift managed cluster. Updates an OpenShift managed cluster with the specified tags. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the OpenShift managed cluster resource. + :param resource_name: The name of the OpenShift managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Update OpenShift Managed Cluster Tags operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2019_10_27_preview.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -516,20 +584,89 @@ async def begin_update_tags( result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2019_10_27_preview.models.OpenShiftManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OpenShiftManagedCluster]: + """Updates tags on an OpenShift managed cluster. + + Updates an OpenShift managed cluster with the specified tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the OpenShift managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update OpenShift Managed Cluster Tags operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either OpenShiftManagedCluster or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2019_10_27_preview.models.OpenShiftManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.OpenShiftManagedCluster]: + """Updates tags on an OpenShift managed cluster. + + Updates an OpenShift managed cluster with the specified tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the OpenShift managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update OpenShift Managed Cluster Tags operation. + Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2019_10_27_preview.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either OpenShiftManagedCluster or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2019_10_27_preview.models.OpenShiftManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-27-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-27-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.OpenShiftManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, @@ -537,64 +674,54 @@ async def begin_update_tags( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('OpenShiftManagedCluster', pipeline_response) + deserialized = self._deserialize("OpenShiftManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore + begin_update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-27-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-27-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -602,10 +729,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -615,23 +741,17 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: + async def begin_delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Deletes an OpenShift managed cluster. Deletes the OpenShift managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the OpenShift managed cluster resource. + :param resource_name: The name of the OpenShift managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -643,52 +763,45 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-27-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-27-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/aio/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/aio/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/aio/operations/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/aio/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/models/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/models/__init__.py index 7442a585cecd..efc9c0e55048 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/models/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/models/__init__.py @@ -23,35 +23,33 @@ from ._models_py3 import Resource from ._models_py3 import TagsObject - -from ._container_service_client_enums import ( - OSType, - OpenShiftAgentPoolProfileRole, - OpenShiftContainerServiceVMSize, -) +from ._container_service_client_enums import OSType +from ._container_service_client_enums import OpenShiftAgentPoolProfileRole +from ._container_service_client_enums import OpenShiftContainerServiceVMSize from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'CloudErrorBody', - 'NetworkProfile', - 'OpenShiftAPIProperties', - 'OpenShiftManagedCluster', - 'OpenShiftManagedClusterAADIdentityProvider', - 'OpenShiftManagedClusterAgentPoolProfile', - 'OpenShiftManagedClusterAuthProfile', - 'OpenShiftManagedClusterBaseIdentityProvider', - 'OpenShiftManagedClusterIdentityProvider', - 'OpenShiftManagedClusterListResult', - 'OpenShiftManagedClusterMasterPoolProfile', - 'OpenShiftManagedClusterMonitorProfile', - 'OpenShiftRouterProfile', - 'PurchasePlan', - 'Resource', - 'TagsObject', - 'OSType', - 'OpenShiftAgentPoolProfileRole', - 'OpenShiftContainerServiceVMSize', + "CloudErrorBody", + "NetworkProfile", + "OpenShiftAPIProperties", + "OpenShiftManagedCluster", + "OpenShiftManagedClusterAADIdentityProvider", + "OpenShiftManagedClusterAgentPoolProfile", + "OpenShiftManagedClusterAuthProfile", + "OpenShiftManagedClusterBaseIdentityProvider", + "OpenShiftManagedClusterIdentityProvider", + "OpenShiftManagedClusterListResult", + "OpenShiftManagedClusterMasterPoolProfile", + "OpenShiftManagedClusterMonitorProfile", + "OpenShiftRouterProfile", + "PurchasePlan", + "Resource", + "TagsObject", + "OSType", + "OpenShiftAgentPoolProfileRole", + "OpenShiftContainerServiceVMSize", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/models/_container_service_client_enums.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/models/_container_service_client_enums.py index 6c64f62d0661..115c765d1314 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/models/_container_service_client_enums.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/models/_container_service_client_enums.py @@ -11,15 +11,14 @@ class OpenShiftAgentPoolProfileRole(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """OpenShiftAgentPoolProfileRole represents the role of the AgentPoolProfile. - """ + """OpenShiftAgentPoolProfileRole represents the role of the AgentPoolProfile.""" COMPUTE = "compute" INFRA = "infra" + class OpenShiftContainerServiceVMSize(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Size of OpenShift VMs. - """ + """Size of OpenShift VMs.""" STANDARD_D2_S_V3 = "Standard_D2s_v3" STANDARD_D4_S_V3 = "Standard_D4s_v3" @@ -55,9 +54,9 @@ class OpenShiftContainerServiceVMSize(str, Enum, metaclass=CaseInsensitiveEnumMe STANDARD_L16_S = "Standard_L16s" STANDARD_L32_S = "Standard_L32s" + class OSType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """OsType to be used to specify os type. Choose from Linux and Windows. Default to Linux. - """ + """OsType to be used to specify os type. Choose from Linux and Windows. Default to Linux.""" LINUX = "Linux" WINDOWS = "Windows" diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/models/_models_py3.py index a758b135ff69..1e6896333d11 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/models/_models_py3.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/models/_models_py3.py @@ -1,4 +1,5 @@ # coding=utf-8 +# pylint: disable=too-many-lines # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -8,14 +9,14 @@ from typing import Dict, List, Optional, TYPE_CHECKING, Union -import msrest.serialization +from ... import _serialization if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - import __init__ as _models + from .. import models as _models -class CloudErrorBody(msrest.serialization.Model): +class CloudErrorBody(_serialization.Model): """An error response from the Container service. :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed @@ -32,10 +33,10 @@ class CloudErrorBody(msrest.serialization.Model): """ _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[CloudErrorBody]"}, } def __init__( @@ -61,14 +62,14 @@ def __init__( :paramtype details: list[~azure.mgmt.containerservice.v2019_10_27_preview.models.CloudErrorBody] """ - super(CloudErrorBody, self).__init__(**kwargs) + super().__init__(**kwargs) self.code = code self.message = message self.target = target self.details = details -class NetworkProfile(msrest.serialization.Model): +class NetworkProfile(_serialization.Model): """Represents the OpenShift networking configuration. :ivar vnet_cidr: CIDR for the OpenShift Vnet. @@ -81,15 +82,15 @@ class NetworkProfile(msrest.serialization.Model): """ _attribute_map = { - 'vnet_cidr': {'key': 'vnetCidr', 'type': 'str'}, - 'management_subnet_cidr': {'key': 'managementSubnetCidr', 'type': 'str'}, - 'vnet_id': {'key': 'vnetId', 'type': 'str'}, + "vnet_cidr": {"key": "vnetCidr", "type": "str"}, + "management_subnet_cidr": {"key": "managementSubnetCidr", "type": "str"}, + "vnet_id": {"key": "vnetId", "type": "str"}, } def __init__( self, *, - vnet_cidr: Optional[str] = "10.0.0.0/8", + vnet_cidr: str = "10.0.0.0/8", management_subnet_cidr: Optional[str] = None, vnet_id: Optional[str] = None, **kwargs @@ -103,13 +104,13 @@ def __init__( :keyword vnet_id: ID of the Vnet created for OSA cluster. :paramtype vnet_id: str """ - super(NetworkProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.vnet_cidr = vnet_cidr self.management_subnet_cidr = management_subnet_cidr self.vnet_id = vnet_id -class OpenShiftAPIProperties(msrest.serialization.Model): +class OpenShiftAPIProperties(_serialization.Model): """Defines further properties on the API. :ivar private_api_server: Specifies if API server is public or private. @@ -117,24 +118,19 @@ class OpenShiftAPIProperties(msrest.serialization.Model): """ _attribute_map = { - 'private_api_server': {'key': 'privateApiServer', 'type': 'bool'}, + "private_api_server": {"key": "privateApiServer", "type": "bool"}, } - def __init__( - self, - *, - private_api_server: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, private_api_server: Optional[bool] = None, **kwargs): """ :keyword private_api_server: Specifies if API server is public or private. :paramtype private_api_server: bool """ - super(OpenShiftAPIProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.private_api_server = private_api_server -class Resource(msrest.serialization.Model): +class Resource(_serialization.Model): """The Resource model definition. Variables are only populated by the server, and will be ignored when sending a request. @@ -147,41 +143,35 @@ class Resource(msrest.serialization.Model): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] """ - super(Resource, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -189,7 +179,7 @@ def __init__( self.tags = tags -class OpenShiftManagedCluster(Resource): +class OpenShiftManagedCluster(Resource): # pylint: disable=too-many-instance-attributes """OpenShift Managed cluster. Variables are only populated by the server, and will be ignored when sending a request. @@ -202,9 +192,9 @@ class OpenShiftManagedCluster(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar plan: Define the resource plan as required by ARM for billing purposes. :vartype plan: ~azure.mgmt.containerservice.v2019_10_27_preview.models.PurchasePlan @@ -242,35 +232,41 @@ class OpenShiftManagedCluster(Resource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'provisioning_state': {'readonly': True}, - 'cluster_version': {'readonly': True}, - 'public_hostname': {'readonly': True}, - 'fqdn': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, + "provisioning_state": {"readonly": True}, + "cluster_version": {"readonly": True}, + "public_hostname": {"readonly": True}, + "fqdn": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'plan': {'key': 'plan', 'type': 'PurchasePlan'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'open_shift_version': {'key': 'properties.openShiftVersion', 'type': 'str'}, - 'cluster_version': {'key': 'properties.clusterVersion', 'type': 'str'}, - 'public_hostname': {'key': 'properties.publicHostname', 'type': 'str'}, - 'fqdn': {'key': 'properties.fqdn', 'type': 'str'}, - 'network_profile': {'key': 'properties.networkProfile', 'type': 'NetworkProfile'}, - 'router_profiles': {'key': 'properties.routerProfiles', 'type': '[OpenShiftRouterProfile]'}, - 'master_pool_profile': {'key': 'properties.masterPoolProfile', 'type': 'OpenShiftManagedClusterMasterPoolProfile'}, - 'agent_pool_profiles': {'key': 'properties.agentPoolProfiles', 'type': '[OpenShiftManagedClusterAgentPoolProfile]'}, - 'auth_profile': {'key': 'properties.authProfile', 'type': 'OpenShiftManagedClusterAuthProfile'}, - 'monitor_profile': {'key': 'properties.monitorProfile', 'type': 'OpenShiftManagedClusterMonitorProfile'}, - 'refresh_cluster': {'key': 'properties.refreshCluster', 'type': 'bool'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "plan": {"key": "plan", "type": "PurchasePlan"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "open_shift_version": {"key": "properties.openShiftVersion", "type": "str"}, + "cluster_version": {"key": "properties.clusterVersion", "type": "str"}, + "public_hostname": {"key": "properties.publicHostname", "type": "str"}, + "fqdn": {"key": "properties.fqdn", "type": "str"}, + "network_profile": {"key": "properties.networkProfile", "type": "NetworkProfile"}, + "router_profiles": {"key": "properties.routerProfiles", "type": "[OpenShiftRouterProfile]"}, + "master_pool_profile": { + "key": "properties.masterPoolProfile", + "type": "OpenShiftManagedClusterMasterPoolProfile", + }, + "agent_pool_profiles": { + "key": "properties.agentPoolProfiles", + "type": "[OpenShiftManagedClusterAgentPoolProfile]", + }, + "auth_profile": {"key": "properties.authProfile", "type": "OpenShiftManagedClusterAuthProfile"}, + "monitor_profile": {"key": "properties.monitorProfile", "type": "OpenShiftManagedClusterMonitorProfile"}, + "refresh_cluster": {"key": "properties.refreshCluster", "type": "bool"}, } def __init__( @@ -290,9 +286,9 @@ def __init__( **kwargs ): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword plan: Define the resource plan as required by ARM for billing purposes. :paramtype plan: ~azure.mgmt.containerservice.v2019_10_27_preview.models.PurchasePlan @@ -319,7 +315,7 @@ def __init__( :keyword refresh_cluster: Allows node rotation. :paramtype refresh_cluster: bool """ - super(OpenShiftManagedCluster, self).__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.plan = plan self.provisioning_state = None self.open_shift_version = open_shift_version @@ -335,37 +331,31 @@ def __init__( self.refresh_cluster = refresh_cluster -class OpenShiftManagedClusterBaseIdentityProvider(msrest.serialization.Model): +class OpenShiftManagedClusterBaseIdentityProvider(_serialization.Model): """Structure for any Identity provider. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: OpenShiftManagedClusterAADIdentityProvider. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + OpenShiftManagedClusterAADIdentityProvider All required parameters must be populated in order to send to Azure. - :ivar kind: Required. The kind of the provider.Constant filled by server. + :ivar kind: The kind of the provider. Required. :vartype kind: str """ _validation = { - 'kind': {'required': True}, + "kind": {"required": True}, } _attribute_map = { - 'kind': {'key': 'kind', 'type': 'str'}, + "kind": {"key": "kind", "type": "str"}, } - _subtype_map = { - 'kind': {'AADIdentityProvider': 'OpenShiftManagedClusterAADIdentityProvider'} - } + _subtype_map = {"kind": {"AADIdentityProvider": "OpenShiftManagedClusterAADIdentityProvider"}} - def __init__( - self, - **kwargs - ): - """ - """ - super(OpenShiftManagedClusterBaseIdentityProvider, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.kind = None # type: Optional[str] @@ -374,7 +364,7 @@ class OpenShiftManagedClusterAADIdentityProvider(OpenShiftManagedClusterBaseIden All required parameters must be populated in order to send to Azure. - :ivar kind: Required. The kind of the provider.Constant filled by server. + :ivar kind: The kind of the provider. Required. :vartype kind: str :ivar client_id: The clientId password associated with the provider. :vartype client_id: str @@ -387,15 +377,15 @@ class OpenShiftManagedClusterAADIdentityProvider(OpenShiftManagedClusterBaseIden """ _validation = { - 'kind': {'required': True}, + "kind": {"required": True}, } _attribute_map = { - 'kind': {'key': 'kind', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'secret': {'key': 'secret', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'customer_admin_group_id': {'key': 'customerAdminGroupId', 'type': 'str'}, + "kind": {"key": "kind", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + "secret": {"key": "secret", "type": "str"}, + "tenant_id": {"key": "tenantId", "type": "str"}, + "customer_admin_group_id": {"key": "customerAdminGroupId", "type": "str"}, } def __init__( @@ -417,57 +407,57 @@ def __init__( :keyword customer_admin_group_id: The groupId to be granted cluster admin role. :paramtype customer_admin_group_id: str """ - super(OpenShiftManagedClusterAADIdentityProvider, self).__init__(**kwargs) - self.kind = 'AADIdentityProvider' # type: str + super().__init__(**kwargs) + self.kind = "AADIdentityProvider" # type: str self.client_id = client_id self.secret = secret self.tenant_id = tenant_id self.customer_admin_group_id = customer_admin_group_id -class OpenShiftManagedClusterAgentPoolProfile(msrest.serialization.Model): +class OpenShiftManagedClusterAgentPoolProfile(_serialization.Model): """Defines the configuration of the OpenShift cluster VMs. All required parameters must be populated in order to send to Azure. - :ivar name: Required. Unique name of the pool profile in the context of the subscription and - resource group. + :ivar name: Unique name of the pool profile in the context of the subscription and resource + group. Required. :vartype name: str - :ivar count: Required. Number of agents (VMs) to host docker containers. + :ivar count: Number of agents (VMs) to host docker containers. Required. :vartype count: int - :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_D2s_v3", + :ivar vm_size: Size of agent VMs. Required. Known values are: "Standard_D2s_v3", "Standard_D4s_v3", "Standard_D8s_v3", "Standard_D16s_v3", "Standard_D32s_v3", "Standard_D64s_v3", "Standard_DS4_v2", "Standard_DS5_v2", "Standard_F8s_v2", "Standard_F16s_v2", "Standard_F32s_v2", "Standard_F64s_v2", "Standard_F72s_v2", "Standard_F8s", "Standard_F16s", "Standard_E4s_v3", "Standard_E8s_v3", "Standard_E16s_v3", "Standard_E20s_v3", "Standard_E32s_v3", "Standard_E64s_v3", "Standard_GS2", "Standard_GS3", "Standard_GS4", "Standard_GS5", "Standard_DS12_v2", "Standard_DS13_v2", "Standard_DS14_v2", "Standard_DS15_v2", - "Standard_L4s", "Standard_L8s", "Standard_L16s", "Standard_L32s". + "Standard_L4s", "Standard_L8s", "Standard_L16s", and "Standard_L32s". :vartype vm_size: str or ~azure.mgmt.containerservice.v2019_10_27_preview.models.OpenShiftContainerServiceVMSize :ivar subnet_cidr: Subnet CIDR for the peering. :vartype subnet_cidr: str :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Known values are: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux" and "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2019_10_27_preview.models.OSType - :ivar role: Define the role of the AgentPoolProfile. Known values are: "compute", "infra". + :ivar role: Define the role of the AgentPoolProfile. Known values are: "compute" and "infra". :vartype role: str or ~azure.mgmt.containerservice.v2019_10_27_preview.models.OpenShiftAgentPoolProfileRole """ _validation = { - 'name': {'required': True}, - 'count': {'required': True}, - 'vm_size': {'required': True}, + "name": {"required": True}, + "count": {"required": True}, + "vm_size": {"required": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'count': {'key': 'count', 'type': 'int'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'subnet_cidr': {'key': 'subnetCidr', 'type': 'str'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'role': {'key': 'role', 'type': 'str'}, + "name": {"key": "name", "type": "str"}, + "count": {"key": "count", "type": "int"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "subnet_cidr": {"key": "subnetCidr", "type": "str"}, + "os_type": {"key": "osType", "type": "str"}, + "role": {"key": "role", "type": "str"}, } def __init__( @@ -476,37 +466,38 @@ def __init__( name: str, count: int, vm_size: Union[str, "_models.OpenShiftContainerServiceVMSize"], - subnet_cidr: Optional[str] = "10.0.0.0/24", - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + subnet_cidr: str = "10.0.0.0/24", + os_type: Union[str, "_models.OSType"] = "Linux", role: Optional[Union[str, "_models.OpenShiftAgentPoolProfileRole"]] = None, **kwargs ): """ - :keyword name: Required. Unique name of the pool profile in the context of the subscription and - resource group. + :keyword name: Unique name of the pool profile in the context of the subscription and resource + group. Required. :paramtype name: str - :keyword count: Required. Number of agents (VMs) to host docker containers. + :keyword count: Number of agents (VMs) to host docker containers. Required. :paramtype count: int - :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_D2s_v3", + :keyword vm_size: Size of agent VMs. Required. Known values are: "Standard_D2s_v3", "Standard_D4s_v3", "Standard_D8s_v3", "Standard_D16s_v3", "Standard_D32s_v3", "Standard_D64s_v3", "Standard_DS4_v2", "Standard_DS5_v2", "Standard_F8s_v2", "Standard_F16s_v2", "Standard_F32s_v2", "Standard_F64s_v2", "Standard_F72s_v2", "Standard_F8s", "Standard_F16s", "Standard_E4s_v3", "Standard_E8s_v3", "Standard_E16s_v3", "Standard_E20s_v3", "Standard_E32s_v3", "Standard_E64s_v3", "Standard_GS2", "Standard_GS3", "Standard_GS4", "Standard_GS5", "Standard_DS12_v2", "Standard_DS13_v2", "Standard_DS14_v2", "Standard_DS15_v2", - "Standard_L4s", "Standard_L8s", "Standard_L16s", "Standard_L32s". + "Standard_L4s", "Standard_L8s", "Standard_L16s", and "Standard_L32s". :paramtype vm_size: str or ~azure.mgmt.containerservice.v2019_10_27_preview.models.OpenShiftContainerServiceVMSize :keyword subnet_cidr: Subnet CIDR for the peering. :paramtype subnet_cidr: str :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux" and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2019_10_27_preview.models.OSType - :keyword role: Define the role of the AgentPoolProfile. Known values are: "compute", "infra". + :keyword role: Define the role of the AgentPoolProfile. Known values are: "compute" and + "infra". :paramtype role: str or ~azure.mgmt.containerservice.v2019_10_27_preview.models.OpenShiftAgentPoolProfileRole """ - super(OpenShiftManagedClusterAgentPoolProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.count = count self.vm_size = vm_size @@ -515,7 +506,7 @@ def __init__( self.role = role -class OpenShiftManagedClusterAuthProfile(msrest.serialization.Model): +class OpenShiftManagedClusterAuthProfile(_serialization.Model): """Defines all possible authentication profiles for the OpenShift cluster. :ivar identity_providers: Type of authentication profile to use. @@ -524,25 +515,22 @@ class OpenShiftManagedClusterAuthProfile(msrest.serialization.Model): """ _attribute_map = { - 'identity_providers': {'key': 'identityProviders', 'type': '[OpenShiftManagedClusterIdentityProvider]'}, + "identity_providers": {"key": "identityProviders", "type": "[OpenShiftManagedClusterIdentityProvider]"}, } def __init__( - self, - *, - identity_providers: Optional[List["_models.OpenShiftManagedClusterIdentityProvider"]] = None, - **kwargs + self, *, identity_providers: Optional[List["_models.OpenShiftManagedClusterIdentityProvider"]] = None, **kwargs ): """ :keyword identity_providers: Type of authentication profile to use. :paramtype identity_providers: list[~azure.mgmt.containerservice.v2019_10_27_preview.models.OpenShiftManagedClusterIdentityProvider] """ - super(OpenShiftManagedClusterAuthProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.identity_providers = identity_providers -class OpenShiftManagedClusterIdentityProvider(msrest.serialization.Model): +class OpenShiftManagedClusterIdentityProvider(_serialization.Model): """Defines the configuration of the identity providers to be used in the OpenShift cluster. :ivar name: Name of the provider. @@ -553,8 +541,8 @@ class OpenShiftManagedClusterIdentityProvider(msrest.serialization.Model): """ _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'provider': {'key': 'provider', 'type': 'OpenShiftManagedClusterBaseIdentityProvider'}, + "name": {"key": "name", "type": "str"}, + "provider": {"key": "provider", "type": "OpenShiftManagedClusterBaseIdentityProvider"}, } def __init__( @@ -571,12 +559,12 @@ def __init__( :paramtype provider: ~azure.mgmt.containerservice.v2019_10_27_preview.models.OpenShiftManagedClusterBaseIdentityProvider """ - super(OpenShiftManagedClusterIdentityProvider, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.provider = provider -class OpenShiftManagedClusterListResult(msrest.serialization.Model): +class OpenShiftManagedClusterListResult(_serialization.Model): """The response from the List OpenShift Managed Clusters operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -589,46 +577,41 @@ class OpenShiftManagedClusterListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[OpenShiftManagedCluster]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[OpenShiftManagedCluster]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.OpenShiftManagedCluster"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.OpenShiftManagedCluster"]] = None, **kwargs): """ :keyword value: The list of OpenShift managed clusters. :paramtype value: list[~azure.mgmt.containerservice.v2019_10_27_preview.models.OpenShiftManagedCluster] """ - super(OpenShiftManagedClusterListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class OpenShiftManagedClusterMasterPoolProfile(msrest.serialization.Model): +class OpenShiftManagedClusterMasterPoolProfile(_serialization.Model): """OpenShiftManagedClusterMaterPoolProfile contains configuration for OpenShift master VMs. All required parameters must be populated in order to send to Azure. - :ivar count: Required. Number of masters (VMs) to host docker containers. The default value is - 3. + :ivar count: Number of masters (VMs) to host docker containers. The default value is 3. + Required. :vartype count: int - :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_D2s_v3", + :ivar vm_size: Size of agent VMs. Required. Known values are: "Standard_D2s_v3", "Standard_D4s_v3", "Standard_D8s_v3", "Standard_D16s_v3", "Standard_D32s_v3", "Standard_D64s_v3", "Standard_DS4_v2", "Standard_DS5_v2", "Standard_F8s_v2", "Standard_F16s_v2", "Standard_F32s_v2", "Standard_F64s_v2", "Standard_F72s_v2", "Standard_F8s", "Standard_F16s", "Standard_E4s_v3", "Standard_E8s_v3", "Standard_E16s_v3", "Standard_E20s_v3", "Standard_E32s_v3", "Standard_E64s_v3", "Standard_GS2", "Standard_GS3", "Standard_GS4", "Standard_GS5", "Standard_DS12_v2", "Standard_DS13_v2", "Standard_DS14_v2", "Standard_DS15_v2", - "Standard_L4s", "Standard_L8s", "Standard_L16s", "Standard_L32s". + "Standard_L4s", "Standard_L8s", "Standard_L16s", and "Standard_L32s". :vartype vm_size: str or ~azure.mgmt.containerservice.v2019_10_27_preview.models.OpenShiftContainerServiceVMSize :ivar subnet_cidr: Subnet CIDR for the peering. @@ -639,15 +622,15 @@ class OpenShiftManagedClusterMasterPoolProfile(msrest.serialization.Model): """ _validation = { - 'count': {'required': True}, - 'vm_size': {'required': True}, + "count": {"required": True}, + "vm_size": {"required": True}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'subnet_cidr': {'key': 'subnetCidr', 'type': 'str'}, - 'api_properties': {'key': 'apiProperties', 'type': 'OpenShiftAPIProperties'}, + "count": {"key": "count", "type": "int"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "subnet_cidr": {"key": "subnetCidr", "type": "str"}, + "api_properties": {"key": "apiProperties", "type": "OpenShiftAPIProperties"}, } def __init__( @@ -660,17 +643,17 @@ def __init__( **kwargs ): """ - :keyword count: Required. Number of masters (VMs) to host docker containers. The default value - is 3. + :keyword count: Number of masters (VMs) to host docker containers. The default value is 3. + Required. :paramtype count: int - :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_D2s_v3", + :keyword vm_size: Size of agent VMs. Required. Known values are: "Standard_D2s_v3", "Standard_D4s_v3", "Standard_D8s_v3", "Standard_D16s_v3", "Standard_D32s_v3", "Standard_D64s_v3", "Standard_DS4_v2", "Standard_DS5_v2", "Standard_F8s_v2", "Standard_F16s_v2", "Standard_F32s_v2", "Standard_F64s_v2", "Standard_F72s_v2", "Standard_F8s", "Standard_F16s", "Standard_E4s_v3", "Standard_E8s_v3", "Standard_E16s_v3", "Standard_E20s_v3", "Standard_E32s_v3", "Standard_E64s_v3", "Standard_GS2", "Standard_GS3", "Standard_GS4", "Standard_GS5", "Standard_DS12_v2", "Standard_DS13_v2", "Standard_DS14_v2", "Standard_DS15_v2", - "Standard_L4s", "Standard_L8s", "Standard_L16s", "Standard_L32s". + "Standard_L4s", "Standard_L8s", "Standard_L16s", and "Standard_L32s". :paramtype vm_size: str or ~azure.mgmt.containerservice.v2019_10_27_preview.models.OpenShiftContainerServiceVMSize :keyword subnet_cidr: Subnet CIDR for the peering. @@ -679,14 +662,14 @@ def __init__( :paramtype api_properties: ~azure.mgmt.containerservice.v2019_10_27_preview.models.OpenShiftAPIProperties """ - super(OpenShiftManagedClusterMasterPoolProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.vm_size = vm_size self.subnet_cidr = subnet_cidr self.api_properties = api_properties -class OpenShiftManagedClusterMonitorProfile(msrest.serialization.Model): +class OpenShiftManagedClusterMonitorProfile(_serialization.Model): """Defines the configuration for Log Analytics integration. :ivar workspace_resource_id: Azure Resource Manager Resource ID for the Log Analytics workspace @@ -697,17 +680,11 @@ class OpenShiftManagedClusterMonitorProfile(msrest.serialization.Model): """ _attribute_map = { - 'workspace_resource_id': {'key': 'workspaceResourceID', 'type': 'str'}, - 'enabled': {'key': 'enabled', 'type': 'bool'}, + "workspace_resource_id": {"key": "workspaceResourceID", "type": "str"}, + "enabled": {"key": "enabled", "type": "bool"}, } - def __init__( - self, - *, - workspace_resource_id: Optional[str] = None, - enabled: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, workspace_resource_id: Optional[str] = None, enabled: Optional[bool] = None, **kwargs): """ :keyword workspace_resource_id: Azure Resource Manager Resource ID for the Log Analytics workspace to integrate with. @@ -715,12 +692,12 @@ def __init__( :keyword enabled: If the Log analytics integration should be turned on or off. :paramtype enabled: bool """ - super(OpenShiftManagedClusterMonitorProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.workspace_resource_id = workspace_resource_id self.enabled = enabled -class OpenShiftRouterProfile(msrest.serialization.Model): +class OpenShiftRouterProfile(_serialization.Model): """Represents an OpenShift router. Variables are only populated by the server, and will be ignored when sending a request. @@ -734,33 +711,28 @@ class OpenShiftRouterProfile(msrest.serialization.Model): """ _validation = { - 'public_subdomain': {'readonly': True}, - 'fqdn': {'readonly': True}, + "public_subdomain": {"readonly": True}, + "fqdn": {"readonly": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'public_subdomain': {'key': 'publicSubdomain', 'type': 'str'}, - 'fqdn': {'key': 'fqdn', 'type': 'str'}, + "name": {"key": "name", "type": "str"}, + "public_subdomain": {"key": "publicSubdomain", "type": "str"}, + "fqdn": {"key": "fqdn", "type": "str"}, } - def __init__( - self, - *, - name: Optional[str] = None, - **kwargs - ): + def __init__(self, *, name: Optional[str] = None, **kwargs): """ :keyword name: Name of the router profile. :paramtype name: str """ - super(OpenShiftRouterProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.public_subdomain = None self.fqdn = None -class PurchasePlan(msrest.serialization.Model): +class PurchasePlan(_serialization.Model): """Used for establishing the purchase context of any 3rd Party artifact through MarketPlace. :ivar name: The plan ID. @@ -775,10 +747,10 @@ class PurchasePlan(msrest.serialization.Model): """ _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'product': {'key': 'product', 'type': 'str'}, - 'promotion_code': {'key': 'promotionCode', 'type': 'str'}, - 'publisher': {'key': 'publisher', 'type': 'str'}, + "name": {"key": "name", "type": "str"}, + "product": {"key": "product", "type": "str"}, + "promotion_code": {"key": "promotionCode", "type": "str"}, + "publisher": {"key": "publisher", "type": "str"}, } def __init__( @@ -801,33 +773,28 @@ def __init__( :keyword publisher: The plan ID. :paramtype publisher: str """ - super(PurchasePlan, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.product = product self.promotion_code = promotion_code self.publisher = publisher -class TagsObject(msrest.serialization.Model): +class TagsObject(_serialization.Model): """Tags object for patch operations. - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] """ _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] """ - super(TagsObject, self).__init__(**kwargs) + super().__init__(**kwargs) self.tags = tags diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/models/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/models/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/models/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/models/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/operations/__init__.py index 211a87879804..69775b67d4ba 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/operations/__init__.py @@ -11,8 +11,9 @@ from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'OpenShiftManagedClustersOperations', + "OpenShiftManagedClustersOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/operations/_open_shift_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/operations/_open_shift_managed_clusters_operations.py index 223e9da532af..0c67d002142c 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/operations/_open_shift_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/operations/_open_shift_managed_clusters_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,243 +27,197 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-27-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-27-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/openShiftManagedClusters") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/openShiftManagedClusters" + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_resource_group_request( - subscription_id: str, - resource_group_name: str, - **kwargs: Any -) -> HttpRequest: +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-27-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-27-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters", + ) # 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', min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: + _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, resource_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-27-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-27-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.OpenShiftManagedCluster] = None, - content: Any = None, - **kwargs: Any + _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, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-27-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-27-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) - - -def build_update_tags_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.TagsObject] = None, - content: Any = None, - **kwargs: Any + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_tags_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-27-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-27-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-27-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-27-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class OpenShiftManagedClustersOperations: """ @@ -279,41 +238,36 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.OpenShiftManagedClusterListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.OpenShiftManagedCluster"]: """Gets a list of OpenShift managed clusters in the specified subscription. Gets a list of OpenShift managed clusters in the specified subscription. The operation returns properties of each OpenShift managed cluster. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OpenShiftManagedClusterListResult or the result of + :return: An iterator like instance of either OpenShiftManagedCluster or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2019_10_27_preview.models.OpenShiftManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2019_10_27_preview.models.OpenShiftManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-27-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-27-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OpenShiftManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -321,14 +275,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -344,10 +295,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -357,50 +306,45 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/openShiftManagedClusters"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/openShiftManagedClusters"} # type: ignore @distributed_trace def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> Iterable[_models.OpenShiftManagedClusterListResult]: + self, resource_group_name: str, **kwargs: Any + ) -> Iterable["_models.OpenShiftManagedCluster"]: """Lists OpenShift managed clusters in the specified subscription and resource group. Lists OpenShift managed clusters in the specified subscription and resource group. The operation returns properties of each OpenShift managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OpenShiftManagedClusterListResult or the result of + :return: An iterator like instance of either OpenShiftManagedCluster or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2019_10_27_preview.models.OpenShiftManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2019_10_27_preview.models.OpenShiftManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-27-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-27-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OpenShiftManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -408,15 +352,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -432,10 +372,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -445,50 +383,40 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters"} # type: ignore @distributed_trace - def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.OpenShiftManagedCluster: + def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.OpenShiftManagedCluster: """Gets a OpenShift managed cluster. Gets the details of the managed OpenShift cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the OpenShift managed cluster resource. + :param resource_name: The name of the OpenShift managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: OpenShiftManagedCluster, or the result of cls(response) + :return: OpenShiftManagedCluster or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_10_27_preview.models.OpenShiftManagedCluster - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-27-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-27-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OpenShiftManagedCluster] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -496,55 +424,58 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('OpenShiftManagedCluster', pipeline_response) + deserialized = self._deserialize("OpenShiftManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore def _create_or_update_initial( self, resource_group_name: str, resource_name: str, - parameters: _models.OpenShiftManagedCluster, + parameters: Union[_models.OpenShiftManagedCluster, IO], **kwargs: Any ) -> _models.OpenShiftManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2019-10-27-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-27-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.OpenShiftManagedCluster] - _json = self._serialize.body(parameters, 'OpenShiftManagedCluster') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "OpenShiftManagedCluster") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -552,10 +483,9 @@ def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -563,25 +493,26 @@ def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('OpenShiftManagedCluster', pipeline_response) + deserialized = self._deserialize("OpenShiftManagedCluster", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('OpenShiftManagedCluster', pipeline_response) + deserialized = self._deserialize("OpenShiftManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore - - @distributed_trace + @overload def begin_create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.OpenShiftManagedCluster, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.OpenShiftManagedCluster]: """Creates or updates an OpenShift managed cluster. @@ -589,14 +520,17 @@ def begin_create_or_update( Creates or updates a OpenShift managed cluster with the specified configuration for agents and OpenShift version. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the OpenShift managed cluster resource. + :param resource_name: The name of the OpenShift managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Create or Update an OpenShift Managed Cluster - operation. + operation. Required. :type parameters: ~azure.mgmt.containerservice.v2019_10_27_preview.models.OpenShiftManagedCluster + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -609,20 +543,96 @@ def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2019_10_27_preview.models.OpenShiftManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OpenShiftManagedCluster]: + """Creates or updates an OpenShift managed cluster. + + Creates or updates a OpenShift managed cluster with the specified configuration for agents and + OpenShift version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the OpenShift managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Create or Update an OpenShift Managed Cluster + operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either OpenShiftManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2019_10_27_preview.models.OpenShiftManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.OpenShiftManagedCluster, IO], + **kwargs: Any + ) -> LROPoller[_models.OpenShiftManagedCluster]: + """Creates or updates an OpenShift managed cluster. + + Creates or updates a OpenShift managed cluster with the specified configuration for agents and + OpenShift version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the OpenShift managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Create or Update an OpenShift Managed Cluster + operation. Is either a model type or a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2019_10_27_preview.models.OpenShiftManagedCluster or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either OpenShiftManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2019_10_27_preview.models.OpenShiftManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-27-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-27-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.OpenShiftManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -630,69 +640,66 @@ def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('OpenShiftManagedCluster', pipeline_response) + deserialized = self._deserialize("OpenShiftManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore def _update_tags_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.TagsObject, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any ) -> _models.OpenShiftManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2019-10-27-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-27-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.OpenShiftManagedCluster] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request_initial( - subscription_id=self._config.subscription_id, + request = build_update_tags_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_tags_initial.metadata['url'], + content=_content, + template_url=self._update_tags_initial.metadata["url"], headers=_headers, params=_params, ) @@ -700,44 +707,87 @@ def _update_tags_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('OpenShiftManagedCluster', pipeline_response) + deserialized = self._deserialize("OpenShiftManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_tags_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore + _update_tags_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore - - @distributed_trace + @overload def begin_update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.OpenShiftManagedCluster]: """Updates tags on an OpenShift managed cluster. Updates an OpenShift managed cluster with the specified tags. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the OpenShift managed cluster resource. + :param resource_name: The name of the OpenShift managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Update OpenShift Managed Cluster Tags operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2019_10_27_preview.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either OpenShiftManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2019_10_27_preview.models.OpenShiftManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OpenShiftManagedCluster]: + """Updates tags on an OpenShift managed cluster. + + Updates an OpenShift managed cluster with the specified tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the OpenShift managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update OpenShift Managed Cluster Tags operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -750,20 +800,50 @@ def begin_update_tags( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2019_10_27_preview.models.OpenShiftManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> LROPoller[_models.OpenShiftManagedCluster]: + """Updates tags on an OpenShift managed cluster. + + Updates an OpenShift managed cluster with the specified tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the OpenShift managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update OpenShift Managed Cluster Tags operation. + Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2019_10_27_preview.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either OpenShiftManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2019_10_27_preview.models.OpenShiftManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-27-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-27-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.OpenShiftManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, @@ -771,64 +851,54 @@ def begin_update_tags( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('OpenShiftManagedCluster', pipeline_response) + deserialized = self._deserialize("OpenShiftManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore + begin_update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-27-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-27-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -836,10 +906,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -849,23 +918,17 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> LROPoller[None]: + def begin_delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> LROPoller[None]: """Deletes an OpenShift managed cluster. Deletes the OpenShift managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the OpenShift managed cluster resource. + :param resource_name: The name of the OpenShift managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -877,52 +940,45 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-27-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-10-27-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/operations/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/__init__.py index 37a5f9e02e6f..a8716d29afe8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/__init__.py @@ -14,7 +14,8 @@ except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['ContainerServiceClient'] + +__all__ = ["ContainerServiceClient"] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/_configuration.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/_configuration.py index 1ee3c5c8f99a..9570dc95782a 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/_configuration.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/_configuration.py @@ -18,30 +18,26 @@ VERSION = "unknown" + class ContainerServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ContainerServiceClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2019-11-01". 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: + def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ContainerServiceClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2019-11-01") # type: str + api_version = kwargs.pop("api_version", "2019-11-01") # type: str if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -51,23 +47,24 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-containerservice/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-containerservice/{}".format(VERSION)) self._configure(**kwargs) def _configure( - self, - **kwargs # type: Any + self, **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/_container_service_client.py index 1a5b10f975b6..c3dab29d193d 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/_container_service_client.py @@ -9,12 +9,11 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from . import models +from .._serialization import Deserializer, Serializer from ._configuration import ContainerServiceClientConfiguration from .operations import AgentPoolsOperations, ManagedClustersOperations, Operations @@ -22,7 +21,8 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class ContainerServiceClient: + +class ContainerServiceClient: # pylint: disable=client-accepts-api-version-keyword """The Container Service Client. :ivar operations: Operations operations @@ -32,10 +32,10 @@ class ContainerServiceClient: azure.mgmt.containerservice.v2019_11_01.operations.ManagedClustersOperations :ivar agent_pools: AgentPoolsOperations operations :vartype agent_pools: azure.mgmt.containerservice.v2019_11_01.operations.AgentPoolsOperations - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -53,29 +53,22 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = ContainerServiceClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = ContainerServiceClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize - ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.managed_clusters = ManagedClustersOperations( self._client, self._config, self._serialize, self._deserialize ) - self.agent_pools = AgentPoolsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - + self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> HttpResponse: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -84,7 +77,7 @@ def _send_request( >>> response = client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/_metadata.json b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/_metadata.json index 0629bdd5e7a3..d5918f2869a7 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/_metadata.json +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/_metadata.json @@ -10,20 +10,20 @@ "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { "credential": { - "signature": "credential, # type: \"TokenCredential\"", - "description": "Credential needed for the client to connect to Azure.", + "signature": "credential: \"TokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true }, "subscription_id": { - "signature": "subscription_id, # type: str", - "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "signature": "subscription_id: str,", + "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.", "docstring_type": "str", "required": true } @@ -31,13 +31,13 @@ "async": { "credential": { "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure.", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { "signature": "subscription_id: str,", - "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.", "docstring_type": "str", "required": true } @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=\"https://management.azure.com\", # type: str", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/_patch.py index 74e48ecd07cf..f99e77fef986 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/_patch.py @@ -28,4 +28,4 @@ # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + pass diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/_vendor.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/_vendor.py index 138f663c53a4..9aad73fc743e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/_vendor.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/_vendor.py @@ -7,6 +7,7 @@ from azure.core.pipeline.transport import HttpRequest + def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) @@ -14,6 +15,7 @@ def _convert_request(request, files=None): request.set_formdata_body(files) return request + def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -21,7 +23,5 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [ - c for c in formatted_components if "{}".format(key.args[0]) not in c - ] + components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/aio/__init__.py index 37a5f9e02e6f..a8716d29afe8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/aio/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/aio/__init__.py @@ -14,7 +14,8 @@ except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['ContainerServiceClient'] + +__all__ = ["ContainerServiceClient"] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/aio/_configuration.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/aio/_configuration.py index 2a378f38b4ec..56b12377e0d8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/aio/_configuration.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/aio/_configuration.py @@ -18,30 +18,26 @@ VERSION = "unknown" + class ContainerServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ContainerServiceClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2019-11-01". 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: + def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ContainerServiceClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2019-11-01") # type: str + api_version = kwargs.pop("api_version", "2019-11-01") # type: str if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -51,22 +47,21 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-containerservice/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-containerservice/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, - **kwargs: Any - ) -> None: - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/aio/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/aio/_container_service_client.py index cb39a642d812..528561a8f109 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/aio/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/aio/_container_service_client.py @@ -9,12 +9,11 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from .. import models +from ..._serialization import Deserializer, Serializer from ._configuration import ContainerServiceClientConfiguration from .operations import AgentPoolsOperations, ManagedClustersOperations, Operations @@ -22,7 +21,8 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class ContainerServiceClient: + +class ContainerServiceClient: # pylint: disable=client-accepts-api-version-keyword """The Container Service Client. :ivar operations: Operations operations @@ -33,10 +33,10 @@ class ContainerServiceClient: :ivar agent_pools: AgentPoolsOperations operations :vartype agent_pools: azure.mgmt.containerservice.v2019_11_01.aio.operations.AgentPoolsOperations - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -54,29 +54,22 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = ContainerServiceClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = ContainerServiceClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize - ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.managed_clusters = ManagedClustersOperations( self._client, self._config, self._serialize, self._deserialize ) - self.agent_pools = AgentPoolsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - + self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -85,7 +78,7 @@ def _send_request( >>> response = await client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/aio/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/aio/_patch.py index 74e48ecd07cf..f99e77fef986 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/aio/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/aio/_patch.py @@ -28,4 +28,4 @@ # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + pass diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/aio/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/aio/operations/__init__.py index 403c0174f052..ee6608454b6b 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/aio/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/aio/operations/__init__.py @@ -13,10 +13,11 @@ from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'Operations', - 'ManagedClustersOperations', - 'AgentPoolsOperations', + "Operations", + "ManagedClustersOperations", + "AgentPoolsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/aio/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/aio/operations/_agent_pools_operations.py index 6954d5aa25cd..cf0442e7ea84 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/aio/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/aio/operations/_agent_pools_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +29,19 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._agent_pools_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_available_agent_pool_versions_request, build_get_request, build_get_upgrade_profile_request, build_list_request -T = TypeVar('T') +from ...operations._agent_pools_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_available_agent_pool_versions_request, + build_get_request, + build_get_upgrade_profile_request, + build_list_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class AgentPoolsOperations: """ .. warning:: @@ -45,48 +61,41 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.AgentPoolListResult]: + def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncIterable["_models.AgentPool"]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. The operation returns properties of each agent pool. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AgentPoolListResult or the result of cls(response) + :return: An iterator like instance of either AgentPool or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2019_11_01.models.AgentPoolListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2019_11_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -94,16 +103,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -119,10 +123,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -132,54 +134,45 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore @distributed_trace_async async def get( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPool: """Gets the agent pool. Gets the details of the agent pool by managed cluster and resource group. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPool, or the result of cls(response) + :return: AgentPool or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_11_01.models.AgentPool - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -187,57 +180,60 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore async def _create_or_update_initial( self, resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: _models.AgentPool, + parameters: Union[_models.AgentPool, IO], **kwargs: Any ) -> _models.AgentPool: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - _json = self._serialize.body(parameters, 'AgentPool') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "AgentPool") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -245,10 +241,9 @@ async def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -256,40 +251,45 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - - @distributed_trace_async + @overload async def begin_create_or_update( self, resource_group_name: str, resource_name: str, agent_pool_name: str, parameters: _models.AgentPool, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.AgentPool]: """Creates or updates an agent pool. Creates or updates an agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :param parameters: Parameters supplied to the Create or Update an agent pool operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2019_11_01.models.AgentPool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -302,20 +302,99 @@ async def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2019_11_01.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AgentPool]: + """Creates or updates an agent pool. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: Parameters supplied to the Create or Update an agent pool operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AgentPool or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2019_11_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: Union[_models.AgentPool, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.AgentPool]: + """Creates or updates an agent pool. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: Parameters supplied to the Create or Update an agent pool operation. Is + either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2019_11_01.models.AgentPool or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AgentPool or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2019_11_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -324,66 +403,55 @@ async def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -391,10 +459,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -404,26 +471,21 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + async def begin_delete( + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes an agent pool. Deletes the agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -435,100 +497,86 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace_async async def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPoolUpgradeProfile: """Gets upgrade profile for an agent pool. Gets the details of the upgrade profile for an agent pool with a specified resource group and managed cluster name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolUpgradeProfile, or the result of cls(response) + :return: AgentPoolUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_11_01.models.AgentPoolUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -536,64 +584,56 @@ async def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolUpgradeProfile', pipeline_response) + deserialized = self._deserialize("AgentPoolUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore @distributed_trace_async async def get_available_agent_pool_versions( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported versions for the specified agent pool. Gets a list of supported versions for the specified agent pool. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolAvailableVersions, or the result of cls(response) + :return: AgentPoolAvailableVersions or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_11_01.models.AgentPoolAvailableVersions - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolAvailableVersions] - request = build_get_available_agent_pool_versions_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_available_agent_pool_versions.metadata['url'], + template_url=self.get_available_agent_pool_versions.metadata["url"], headers=_headers, params=_params, ) @@ -601,22 +641,20 @@ async def get_available_agent_pool_versions( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolAvailableVersions', pipeline_response) + deserialized = self._deserialize("AgentPoolAvailableVersions", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_available_agent_pool_versions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore - + get_available_agent_pool_versions.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/aio/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/aio/operations/_managed_clusters_operations.py index d61f8af21ee4..4c0e72095548 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/aio/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/aio/operations/_managed_clusters_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +29,27 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._managed_clusters_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_access_profile_request, build_get_request, build_get_upgrade_profile_request, build_list_by_resource_group_request, build_list_cluster_admin_credentials_request, build_list_cluster_monitoring_user_credentials_request, build_list_cluster_user_credentials_request, build_list_request, build_reset_aad_profile_request_initial, build_reset_service_principal_profile_request_initial, build_rotate_cluster_certificates_request_initial, build_update_tags_request_initial -T = TypeVar('T') +from ...operations._managed_clusters_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_access_profile_request, + build_get_request, + build_get_upgrade_profile_request, + build_list_by_resource_group_request, + build_list_cluster_admin_credentials_request, + build_list_cluster_monitoring_user_credentials_request, + build_list_cluster_user_credentials_request, + build_list_request, + build_reset_aad_profile_request, + build_reset_service_principal_profile_request, + build_rotate_cluster_certificates_request, + build_update_tags_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class ManagedClustersOperations: """ .. warning:: @@ -45,41 +69,35 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.ManagedClusterListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.ManagedCluster"]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. The operation returns properties of each managed cluster. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2019_11_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2019_11_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -87,14 +105,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -110,10 +125,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -123,50 +136,44 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.ManagedClusterListResult]: + self, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ManagedCluster"]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. The operation returns properties of each managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2019_11_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2019_11_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -174,15 +181,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -198,10 +201,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -211,51 +212,43 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace_async async def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.ManagedClusterUpgradeProfile: """Gets upgrade profile for a managed cluster. Gets the details of the upgrade profile for a managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterUpgradeProfile, or the result of cls(response) + :return: ManagedClusterUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_11_01.models.ManagedClusterUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -263,69 +256,60 @@ async def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterUpgradeProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore @distributed_trace_async async def get_access_profile( - self, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, role_name: str, **kwargs: Any ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. Gets the accessProfile for the specified role name of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param role_name: The name of the role for managed cluster accessProfile resource. + :param role_name: The name of the role for managed cluster accessProfile resource. Required. :type role_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterAccessProfile, or the result of cls(response) + :return: ManagedClusterAccessProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_11_01.models.ManagedClusterAccessProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterAccessProfile] - request = build_get_access_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, role_name=role_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_access_profile.metadata['url'], + template_url=self.get_access_profile.metadata["url"], headers=_headers, params=_params, ) @@ -333,64 +317,56 @@ async def get_access_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterAccessProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterAccessProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_access_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore - + get_access_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore @distributed_trace_async async def list_cluster_admin_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster admin credential of a managed cluster. Gets cluster admin credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_11_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_admin_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_admin_credentials.metadata['url'], + template_url=self.list_cluster_admin_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -398,64 +374,56 @@ async def list_cluster_admin_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_admin_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore - + list_cluster_admin_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore @distributed_trace_async async def list_cluster_user_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster user credential of a managed cluster. Gets cluster user credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_11_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_user_credentials.metadata['url'], + template_url=self.list_cluster_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -463,65 +431,57 @@ async def list_cluster_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore - + list_cluster_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore @distributed_trace_async async def list_cluster_monitoring_user_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster monitoring user credential of a managed cluster. Gets cluster monitoring user credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_11_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_monitoring_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + template_url=self.list_cluster_monitoring_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -529,64 +489,54 @@ async def list_cluster_monitoring_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_monitoring_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore - + list_cluster_monitoring_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore @distributed_trace_async - async def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.ManagedCluster: + async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.ManagedCluster: """Gets a managed cluster. Gets the details of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedCluster, or the result of cls(response) + :return: ManagedCluster or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_11_01.models.ManagedCluster - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -594,55 +544,54 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _create_or_update_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.ManagedCluster, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'ManagedCluster') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedCluster") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -650,10 +599,9 @@ async def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -661,25 +609,26 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - @distributed_trace_async + @overload async def begin_create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedCluster, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. @@ -687,12 +636,90 @@ async def begin_create_or_update( Creates or updates a managed cluster with the specified configuration for agents and Kubernetes version. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2019_11_01.models.ManagedCluster + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2019_11_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster with the specified configuration for agents and Kubernetes + version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2019_11_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster with the specified configuration for agents and Kubernetes + version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. Is + either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2019_11_01.models.ManagedCluster or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -705,20 +732,17 @@ async def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2019_11_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -726,69 +750,66 @@ async def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _update_tags_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.TagsObject, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request_initial( - subscription_id=self._config.subscription_id, + request = build_update_tags_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_tags_initial.metadata['url'], + content=_content, + template_url=self._update_tags_initial.metadata["url"], headers=_headers, params=_params, ) @@ -796,44 +817,85 @@ async def _update_tags_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_tags_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _update_tags_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - @distributed_trace_async + @overload async def begin_update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates a managed cluster with the specified tags. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2019_11_01.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2019_11_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates a managed cluster with the specified tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -846,20 +908,50 @@ async def begin_update_tags( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2019_11_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates a managed cluster with the specified tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2019_11_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2019_11_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, @@ -867,64 +959,54 @@ async def begin_update_tags( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -932,10 +1014,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -945,23 +1026,17 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: + async def begin_delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Deletes a managed cluster. Deletes the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -973,85 +1048,83 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterServicePrincipalProfile, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterServicePrincipalProfile") - request = build_reset_service_principal_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_service_principal_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_service_principal_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_service_principal_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1059,10 +1132,9 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1072,29 +1144,106 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist if cls: return cls(pipeline_response, None, {}) - _reset_service_principal_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore - + _reset_service_principal_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore - @distributed_trace_async - async def begin_reset_service_principal_profile( # pylint: disable=inconsistent-return-statements + @overload + async def begin_reset_service_principal_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterServicePrincipalProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: """Reset Service Principal Profile of a managed cluster. Update the service principal Profile for a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a - Managed Cluster. + Managed Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2019_11_01.models.ManagedClusterServicePrincipalProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset Service Principal Profile of a managed cluster. + + Update the service principal Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a + Managed Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset Service Principal Profile of a managed cluster. + + Update the service principal Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a + Managed Cluster. Is either a model type or a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2019_11_01.models.ManagedClusterServicePrincipalProfile or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -1105,20 +1254,17 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1126,67 +1272,68 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_service_principal_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + begin_reset_service_principal_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterAADProfile, + parameters: Union[_models.ManagedClusterAADProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterAADProfile") - request = build_reset_aad_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_aad_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_aad_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_aad_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1194,10 +1341,9 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1207,28 +1353,69 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta if cls: return cls(pipeline_response, None, {}) - _reset_aad_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - + _reset_aad_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - @distributed_trace_async - async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements + @overload + async def begin_reset_aad_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterAADProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: """Reset AAD Profile of a managed cluster. Update the AAD Profile for a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed - Cluster. + Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2019_11_01.models.ManagedClusterAADProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset AAD Profile of a managed cluster. + + Update the AAD Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed + Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -1239,20 +1426,53 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterAADProfile, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset AAD Profile of a managed cluster. + + Update the AAD Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed + Cluster. Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2019_11_01.models.ManagedClusterAADProfile or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1260,62 +1480,52 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_aad_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + begin_reset_aad_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_rotate_cluster_certificates_request_initial( - subscription_id=self._config.subscription_id, + request = build_rotate_cluster_certificates_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._rotate_cluster_certificates_initial.metadata['url'], + template_url=self._rotate_cluster_certificates_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1323,10 +1533,9 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1336,23 +1545,19 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- if cls: return cls(pipeline_response, None, {}) - _rotate_cluster_certificates_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore - + _rotate_cluster_certificates_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore @distributed_trace_async - async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + async def begin_rotate_cluster_certificates( + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Rotate certificates of a managed cluster. Rotate certificates of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1364,52 +1569,45 @@ async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-ret Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._rotate_cluster_certificates_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_rotate_cluster_certificates.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore + begin_rotate_cluster_certificates.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/aio/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/aio/operations/_operations.py index f5c8288f0ab4..30ed3deffce5 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/aio/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/aio/operations/_operations.py @@ -7,9 +7,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,9 +27,11 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._operations import build_list_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class Operations: """ .. warning:: @@ -42,36 +51,31 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.OperationListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.OperationValue"]: """Gets a list of compute operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationListResult or the result of cls(response) + :return: An iterator like instance of either OperationValue or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2019_11_01.models.OperationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2019_11_01.models.OperationValue] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -79,13 +83,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -101,10 +103,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -114,8 +114,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.ContainerService/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ContainerService/operations"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/aio/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/aio/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/aio/operations/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/aio/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/models/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/models/__init__.py index 1a970d9d5e41..0b20e05faf3b 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/models/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/models/__init__.py @@ -50,80 +50,78 @@ from ._models_py3 import TagsObject from ._models_py3 import UserAssignedIdentity - -from ._container_service_client_enums import ( - AgentPoolType, - ContainerServiceStorageProfileTypes, - ContainerServiceVMSizeTypes, - Count, - LoadBalancerSku, - NetworkPlugin, - NetworkPolicy, - OSType, - OutboundType, - ResourceIdentityType, - ScaleSetEvictionPolicy, - ScaleSetPriority, -) +from ._container_service_client_enums import AgentPoolType +from ._container_service_client_enums import ContainerServiceStorageProfileTypes +from ._container_service_client_enums import ContainerServiceVMSizeTypes +from ._container_service_client_enums import Count +from ._container_service_client_enums import LoadBalancerSku +from ._container_service_client_enums import NetworkPlugin +from ._container_service_client_enums import NetworkPolicy +from ._container_service_client_enums import OSType +from ._container_service_client_enums import OutboundType +from ._container_service_client_enums import ResourceIdentityType +from ._container_service_client_enums import ScaleSetEvictionPolicy +from ._container_service_client_enums import ScaleSetPriority from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'AgentPool', - 'AgentPoolAvailableVersions', - 'AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem', - 'AgentPoolListResult', - 'AgentPoolUpgradeProfile', - 'AgentPoolUpgradeProfilePropertiesUpgradesItem', - 'CloudErrorBody', - 'ContainerServiceDiagnosticsProfile', - 'ContainerServiceLinuxProfile', - 'ContainerServiceMasterProfile', - 'ContainerServiceNetworkProfile', - 'ContainerServiceSshConfiguration', - 'ContainerServiceSshPublicKey', - 'ContainerServiceVMDiagnostics', - 'CredentialResult', - 'CredentialResults', - 'ManagedCluster', - 'ManagedClusterAADProfile', - 'ManagedClusterAPIServerAccessProfile', - 'ManagedClusterAccessProfile', - 'ManagedClusterAddonProfile', - 'ManagedClusterAddonProfileIdentity', - 'ManagedClusterAgentPoolProfile', - 'ManagedClusterAgentPoolProfileProperties', - 'ManagedClusterIdentity', - 'ManagedClusterListResult', - 'ManagedClusterLoadBalancerProfile', - 'ManagedClusterLoadBalancerProfileManagedOutboundIPs', - 'ManagedClusterLoadBalancerProfileOutboundIPPrefixes', - 'ManagedClusterLoadBalancerProfileOutboundIPs', - 'ManagedClusterPoolUpgradeProfile', - 'ManagedClusterPoolUpgradeProfileUpgradesItem', - 'ManagedClusterPropertiesIdentityProfileValue', - 'ManagedClusterServicePrincipalProfile', - 'ManagedClusterUpgradeProfile', - 'ManagedClusterWindowsProfile', - 'OperationListResult', - 'OperationValue', - 'Resource', - 'ResourceReference', - 'SubResource', - 'TagsObject', - 'UserAssignedIdentity', - 'AgentPoolType', - 'ContainerServiceStorageProfileTypes', - 'ContainerServiceVMSizeTypes', - 'Count', - 'LoadBalancerSku', - 'NetworkPlugin', - 'NetworkPolicy', - 'OSType', - 'OutboundType', - 'ResourceIdentityType', - 'ScaleSetEvictionPolicy', - 'ScaleSetPriority', + "AgentPool", + "AgentPoolAvailableVersions", + "AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem", + "AgentPoolListResult", + "AgentPoolUpgradeProfile", + "AgentPoolUpgradeProfilePropertiesUpgradesItem", + "CloudErrorBody", + "ContainerServiceDiagnosticsProfile", + "ContainerServiceLinuxProfile", + "ContainerServiceMasterProfile", + "ContainerServiceNetworkProfile", + "ContainerServiceSshConfiguration", + "ContainerServiceSshPublicKey", + "ContainerServiceVMDiagnostics", + "CredentialResult", + "CredentialResults", + "ManagedCluster", + "ManagedClusterAADProfile", + "ManagedClusterAPIServerAccessProfile", + "ManagedClusterAccessProfile", + "ManagedClusterAddonProfile", + "ManagedClusterAddonProfileIdentity", + "ManagedClusterAgentPoolProfile", + "ManagedClusterAgentPoolProfileProperties", + "ManagedClusterIdentity", + "ManagedClusterListResult", + "ManagedClusterLoadBalancerProfile", + "ManagedClusterLoadBalancerProfileManagedOutboundIPs", + "ManagedClusterLoadBalancerProfileOutboundIPPrefixes", + "ManagedClusterLoadBalancerProfileOutboundIPs", + "ManagedClusterPoolUpgradeProfile", + "ManagedClusterPoolUpgradeProfileUpgradesItem", + "ManagedClusterPropertiesIdentityProfileValue", + "ManagedClusterServicePrincipalProfile", + "ManagedClusterUpgradeProfile", + "ManagedClusterWindowsProfile", + "OperationListResult", + "OperationValue", + "Resource", + "ResourceReference", + "SubResource", + "TagsObject", + "UserAssignedIdentity", + "AgentPoolType", + "ContainerServiceStorageProfileTypes", + "ContainerServiceVMSizeTypes", + "Count", + "LoadBalancerSku", + "NetworkPlugin", + "NetworkPolicy", + "OSType", + "OutboundType", + "ResourceIdentityType", + "ScaleSetEvictionPolicy", + "ScaleSetPriority", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/models/_container_service_client_enums.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/models/_container_service_client_enums.py index 137bd739161e..3d7566ee27b4 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/models/_container_service_client_enums.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/models/_container_service_client_enums.py @@ -11,12 +11,12 @@ class AgentPoolType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """AgentPoolType represents types of an agent pool. - """ + """AgentPoolType represents types of an agent pool.""" VIRTUAL_MACHINE_SCALE_SETS = "VirtualMachineScaleSets" AVAILABILITY_SET = "AvailabilitySet" + class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the orchestrator choice. @@ -25,9 +25,9 @@ class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEn STORAGE_ACCOUNT = "StorageAccount" MANAGED_DISKS = "ManagedDisks" + class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Size of agent VMs. - """ + """Size of agent VMs.""" STANDARD_A1 = "Standard_A1" STANDARD_A10 = "Standard_A10" @@ -204,6 +204,7 @@ class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): STANDARD_NV24 = "Standard_NV24" STANDARD_NV6 = "Standard_NV6" + class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): """Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, and 5. The default value is 1. @@ -213,41 +214,42 @@ class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): THREE = 3 FIVE = 5 + class LoadBalancerSku(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The load balancer sku for the managed cluster. - """ + """The load balancer sku for the managed cluster.""" STANDARD = "standard" BASIC = "basic" + class NetworkPlugin(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Network plugin used for building Kubernetes network. - """ + """Network plugin used for building Kubernetes network.""" AZURE = "azure" KUBENET = "kubenet" + class NetworkPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Network policy used for building Kubernetes network. - """ + """Network policy used for building Kubernetes network.""" CALICO = "calico" AZURE = "azure" + class OSType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """OsType to be used to specify os type. Choose from Linux and Windows. Default to Linux. - """ + """OsType to be used to specify os type. Choose from Linux and Windows. Default to Linux.""" LINUX = "Linux" WINDOWS = "Windows" + class OutboundType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The outbound (egress) routing method. - """ + """The outbound (egress) routing method.""" LOAD_BALANCER = "loadBalancer" USER_DEFINED_ROUTING = "userDefinedRouting" + class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of identity used for the managed cluster. Type 'SystemAssigned' will use an implicitly created identity in master components and an auto-created user assigned identity in MC_ @@ -258,6 +260,7 @@ class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): SYSTEM_ASSIGNED = "SystemAssigned" NONE = "None" + class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ScaleSetEvictionPolicy to be used to specify eviction policy for low priority virtual machine scale set. Default to Delete. @@ -266,9 +269,9 @@ class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): DELETE = "Delete" DEALLOCATE = "Deallocate" + class ScaleSetPriority(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """ScaleSetPriority to be used to specify virtual machine scale set priority. Default to regular. - """ + """ScaleSetPriority to be used to specify virtual machine scale set priority. Default to regular.""" LOW = "Low" REGULAR = "Regular" diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/models/_models_py3.py index 21aa796d6e7a..7084264cd93a 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/models/_models_py3.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/models/_models_py3.py @@ -1,4 +1,5 @@ # coding=utf-8 +# pylint: disable=too-many-lines # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -8,14 +9,14 @@ from typing import Dict, List, Optional, TYPE_CHECKING, Union -import msrest.serialization +from ... import _serialization if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - import __init__ as _models + from .. import models as _models -class SubResource(msrest.serialization.Model): +class SubResource(_serialization.Model): """Reference to another subresource. Variables are only populated by the server, and will be ignored when sending a request. @@ -30,30 +31,26 @@ class SubResource(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(SubResource, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.id = None self.name = None self.type = None -class AgentPool(SubResource): +class AgentPool(SubResource): # pylint: disable=too-many-instance-attributes """Agent Pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -105,7 +102,7 @@ class AgentPool(SubResource): "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :vartype vm_size: str or ~azure.mgmt.containerservice.v2019_11_01.models.ContainerServiceVMSizeTypes :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine @@ -117,7 +114,7 @@ class AgentPool(SubResource): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Known values are: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux" and "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2019_11_01.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -126,7 +123,7 @@ class AgentPool(SubResource): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar type_properties_type: AgentPoolType represents types of an agent pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :vartype type_properties_type: str or ~azure.mgmt.containerservice.v2019_11_01.models.AgentPoolType :ivar orchestrator_version: Version of orchestrator specified when creating the managed @@ -141,16 +138,15 @@ class AgentPool(SubResource): :ivar enable_node_public_ip: Enable public IP for nodes. :vartype enable_node_public_ip: bool :ivar scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Known values are: "Low", "Regular". Default value: "Regular". + priority. Default to regular. Known values are: "Low" and "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2019_11_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy - for low priority virtual machine scale set. Default to Delete. Known values are: "Delete", - "Deallocate". Default value: "Delete". + for low priority virtual machine scale set. Default to Delete. Known values are: "Delete" and + "Deallocate". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2019_11_01.models.ScaleSetEvictionPolicy - :ivar tags: A set of tags. Agent pool tags to be persisted on the agent pool virtual machine - scale set. + :ivar tags: Agent pool tags to be persisted on the agent pool virtual machine scale set. :vartype tags: dict[str, str] :ivar node_labels: Agent pool node labels to be persisted across all nodes in agent pool. :vartype node_labels: dict[str, str] @@ -160,36 +156,36 @@ class AgentPool(SubResource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'os_disk_size_gb': {'maximum': 1023, 'minimum': 0}, - 'provisioning_state': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "os_disk_size_gb": {"maximum": 1023, "minimum": 0}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'count': {'key': 'properties.count', 'type': 'int'}, - 'vm_size': {'key': 'properties.vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'properties.osDiskSizeGB', 'type': 'int'}, - 'vnet_subnet_id': {'key': 'properties.vnetSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'properties.maxPods', 'type': 'int'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'max_count': {'key': 'properties.maxCount', 'type': 'int'}, - 'min_count': {'key': 'properties.minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'properties.enableAutoScaling', 'type': 'bool'}, - 'type_properties_type': {'key': 'properties.type', 'type': 'str'}, - 'orchestrator_version': {'key': 'properties.orchestratorVersion', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'availability_zones': {'key': 'properties.availabilityZones', 'type': '[str]'}, - 'enable_node_public_ip': {'key': 'properties.enableNodePublicIP', 'type': 'bool'}, - 'scale_set_priority': {'key': 'properties.scaleSetPriority', 'type': 'str'}, - 'scale_set_eviction_policy': {'key': 'properties.scaleSetEvictionPolicy', 'type': 'str'}, - 'tags': {'key': 'properties.tags', 'type': '{str}'}, - 'node_labels': {'key': 'properties.nodeLabels', 'type': '{str}'}, - 'node_taints': {'key': 'properties.nodeTaints', 'type': '[str]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "count": {"key": "properties.count", "type": "int"}, + "vm_size": {"key": "properties.vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "properties.osDiskSizeGB", "type": "int"}, + "vnet_subnet_id": {"key": "properties.vnetSubnetID", "type": "str"}, + "max_pods": {"key": "properties.maxPods", "type": "int"}, + "os_type": {"key": "properties.osType", "type": "str"}, + "max_count": {"key": "properties.maxCount", "type": "int"}, + "min_count": {"key": "properties.minCount", "type": "int"}, + "enable_auto_scaling": {"key": "properties.enableAutoScaling", "type": "bool"}, + "type_properties_type": {"key": "properties.type", "type": "str"}, + "orchestrator_version": {"key": "properties.orchestratorVersion", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "availability_zones": {"key": "properties.availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "properties.enableNodePublicIP", "type": "bool"}, + "scale_set_priority": {"key": "properties.scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "properties.scaleSetEvictionPolicy", "type": "str"}, + "tags": {"key": "properties.tags", "type": "{str}"}, + "node_labels": {"key": "properties.nodeLabels", "type": "{str}"}, + "node_taints": {"key": "properties.nodeTaints", "type": "[str]"}, } def __init__( @@ -200,7 +196,7 @@ def __init__( os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, @@ -208,8 +204,8 @@ def __init__( orchestrator_version: Optional[str] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, - scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, @@ -256,7 +252,7 @@ def __init__( "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :paramtype vm_size: str or ~azure.mgmt.containerservice.v2019_11_01.models.ContainerServiceVMSizeTypes :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every @@ -268,7 +264,7 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux" and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2019_11_01.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -277,7 +273,7 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword type_properties_type: AgentPoolType represents types of an agent pool. Known values - are: "VirtualMachineScaleSets", "AvailabilitySet". + are: "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type_properties_type: str or ~azure.mgmt.containerservice.v2019_11_01.models.AgentPoolType :keyword orchestrator_version: Version of orchestrator specified when creating the managed @@ -289,16 +285,15 @@ def __init__( :keyword enable_node_public_ip: Enable public IP for nodes. :paramtype enable_node_public_ip: bool :keyword scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Known values are: "Low", "Regular". Default value: "Regular". + priority. Default to regular. Known values are: "Low" and "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2019_11_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy for low priority virtual machine scale set. Default to Delete. Known values are: - "Delete", "Deallocate". Default value: "Delete". + "Delete" and "Deallocate". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2019_11_01.models.ScaleSetEvictionPolicy - :keyword tags: A set of tags. Agent pool tags to be persisted on the agent pool virtual machine - scale set. + :keyword tags: Agent pool tags to be persisted on the agent pool virtual machine scale set. :paramtype tags: dict[str, str] :keyword node_labels: Agent pool node labels to be persisted across all nodes in agent pool. :paramtype node_labels: dict[str, str] @@ -306,7 +301,7 @@ def __init__( key=value:NoSchedule. :paramtype node_taints: list[str] """ - super(AgentPool, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.vm_size = vm_size self.os_disk_size_gb = os_disk_size_gb @@ -328,7 +323,7 @@ def __init__( self.node_taints = node_taints -class AgentPoolAvailableVersions(msrest.serialization.Model): +class AgentPoolAvailableVersions(_serialization.Model): """The list of available versions for an agent pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -345,16 +340,19 @@ class AgentPoolAvailableVersions(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'agent_pool_versions': {'key': 'properties.agentPoolVersions', 'type': '[AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "agent_pool_versions": { + "key": "properties.agentPoolVersions", + "type": "[AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem]", + }, } def __init__( @@ -368,14 +366,14 @@ def __init__( :paramtype agent_pool_versions: list[~azure.mgmt.containerservice.v2019_11_01.models.AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem] """ - super(AgentPoolAvailableVersions, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None self.agent_pool_versions = agent_pool_versions -class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(msrest.serialization.Model): +class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(_serialization.Model): """AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem. :ivar default: Whether this version is the default agent pool version. @@ -387,9 +385,9 @@ class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(msrest.serializa """ _attribute_map = { - 'default': {'key': 'default', 'type': 'bool'}, - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "default": {"key": "default", "type": "bool"}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } def __init__( @@ -408,13 +406,13 @@ def __init__( :keyword is_preview: Whether Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.default = default self.kubernetes_version = kubernetes_version self.is_preview = is_preview -class AgentPoolListResult(msrest.serialization.Model): +class AgentPoolListResult(_serialization.Model): """The response from the List Agent Pools operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -426,30 +424,25 @@ class AgentPoolListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[AgentPool]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[AgentPool]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.AgentPool"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.AgentPool"]] = None, **kwargs): """ :keyword value: The list of agent pools. :paramtype value: list[~azure.mgmt.containerservice.v2019_11_01.models.AgentPool] """ - super(AgentPoolListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class AgentPoolUpgradeProfile(msrest.serialization.Model): +class AgentPoolUpgradeProfile(_serialization.Model): """The list of available upgrades for an agent pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -462,10 +455,10 @@ class AgentPoolUpgradeProfile(msrest.serialization.Model): :vartype name: str :ivar type: Type of the agent pool upgrade profile. :vartype type: str - :ivar kubernetes_version: Required. Kubernetes version (major, minor, patch). + :ivar kubernetes_version: Kubernetes version (major, minor, patch). Required. :vartype kubernetes_version: str - :ivar os_type: Required. OsType to be used to specify os type. Choose from Linux and Windows. - Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to + Linux. Known values are: "Linux" and "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2019_11_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -473,20 +466,20 @@ class AgentPoolUpgradeProfile(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kubernetes_version': {'required': True}, - 'os_type': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "kubernetes_version": {"required": True}, + "os_type": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'kubernetes_version': {'key': 'properties.kubernetesVersion', 'type': 'str'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'upgrades': {'key': 'properties.upgrades', 'type': '[AgentPoolUpgradeProfilePropertiesUpgradesItem]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "os_type": {"key": "properties.osType", "type": "str"}, + "upgrades": {"key": "properties.upgrades", "type": "[AgentPoolUpgradeProfilePropertiesUpgradesItem]"}, } def __init__( @@ -498,16 +491,16 @@ def __init__( **kwargs ): """ - :keyword kubernetes_version: Required. Kubernetes version (major, minor, patch). + :keyword kubernetes_version: Kubernetes version (major, minor, patch). Required. :paramtype kubernetes_version: str - :keyword os_type: Required. OsType to be used to specify os type. Choose from Linux and - Windows. Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default + to Linux. Known values are: "Linux" and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2019_11_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: list[~azure.mgmt.containerservice.v2019_11_01.models.AgentPoolUpgradeProfilePropertiesUpgradesItem] """ - super(AgentPoolUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -516,7 +509,7 @@ def __init__( self.upgrades = upgrades -class AgentPoolUpgradeProfilePropertiesUpgradesItem(msrest.serialization.Model): +class AgentPoolUpgradeProfilePropertiesUpgradesItem(_serialization.Model): """AgentPoolUpgradeProfilePropertiesUpgradesItem. :ivar kubernetes_version: Kubernetes version (major, minor, patch). @@ -526,29 +519,23 @@ class AgentPoolUpgradeProfilePropertiesUpgradesItem(msrest.serialization.Model): """ _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } - def __init__( - self, - *, - kubernetes_version: Optional[str] = None, - is_preview: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, kubernetes_version: Optional[str] = None, is_preview: Optional[bool] = None, **kwargs): """ :keyword kubernetes_version: Kubernetes version (major, minor, patch). :paramtype kubernetes_version: str :keyword is_preview: Whether Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(AgentPoolUpgradeProfilePropertiesUpgradesItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.is_preview = is_preview -class CloudErrorBody(msrest.serialization.Model): +class CloudErrorBody(_serialization.Model): """An error response from the Container service. :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed @@ -565,10 +552,10 @@ class CloudErrorBody(msrest.serialization.Model): """ _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[CloudErrorBody]"}, } def __init__( @@ -593,87 +580,76 @@ def __init__( :keyword details: A list of additional details about the error. :paramtype details: list[~azure.mgmt.containerservice.v2019_11_01.models.CloudErrorBody] """ - super(CloudErrorBody, self).__init__(**kwargs) + super().__init__(**kwargs) self.code = code self.message = message self.target = target self.details = details -class ContainerServiceDiagnosticsProfile(msrest.serialization.Model): +class ContainerServiceDiagnosticsProfile(_serialization.Model): """Profile for diagnostics on the container service cluster. All required parameters must be populated in order to send to Azure. - :ivar vm_diagnostics: Required. Profile for diagnostics on the container service VMs. + :ivar vm_diagnostics: Profile for diagnostics on the container service VMs. Required. :vartype vm_diagnostics: ~azure.mgmt.containerservice.v2019_11_01.models.ContainerServiceVMDiagnostics """ _validation = { - 'vm_diagnostics': {'required': True}, + "vm_diagnostics": {"required": True}, } _attribute_map = { - 'vm_diagnostics': {'key': 'vmDiagnostics', 'type': 'ContainerServiceVMDiagnostics'}, + "vm_diagnostics": {"key": "vmDiagnostics", "type": "ContainerServiceVMDiagnostics"}, } - def __init__( - self, - *, - vm_diagnostics: "_models.ContainerServiceVMDiagnostics", - **kwargs - ): + def __init__(self, *, vm_diagnostics: "_models.ContainerServiceVMDiagnostics", **kwargs): """ - :keyword vm_diagnostics: Required. Profile for diagnostics on the container service VMs. + :keyword vm_diagnostics: Profile for diagnostics on the container service VMs. Required. :paramtype vm_diagnostics: ~azure.mgmt.containerservice.v2019_11_01.models.ContainerServiceVMDiagnostics """ - super(ContainerServiceDiagnosticsProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.vm_diagnostics = vm_diagnostics -class ContainerServiceLinuxProfile(msrest.serialization.Model): +class ContainerServiceLinuxProfile(_serialization.Model): """Profile for Linux VMs in the container service cluster. All required parameters must be populated in order to send to Azure. - :ivar admin_username: Required. The administrator username to use for Linux VMs. + :ivar admin_username: The administrator username to use for Linux VMs. Required. :vartype admin_username: str - :ivar ssh: Required. SSH configuration for Linux-based VMs running on Azure. + :ivar ssh: SSH configuration for Linux-based VMs running on Azure. Required. :vartype ssh: ~azure.mgmt.containerservice.v2019_11_01.models.ContainerServiceSshConfiguration """ _validation = { - 'admin_username': {'required': True, 'pattern': r'^[A-Za-z][-A-Za-z0-9_]*$'}, - 'ssh': {'required': True}, + "admin_username": {"required": True, "pattern": r"^[A-Za-z][-A-Za-z0-9_]*$"}, + "ssh": {"required": True}, } _attribute_map = { - 'admin_username': {'key': 'adminUsername', 'type': 'str'}, - 'ssh': {'key': 'ssh', 'type': 'ContainerServiceSshConfiguration'}, + "admin_username": {"key": "adminUsername", "type": "str"}, + "ssh": {"key": "ssh", "type": "ContainerServiceSshConfiguration"}, } - def __init__( - self, - *, - admin_username: str, - ssh: "_models.ContainerServiceSshConfiguration", - **kwargs - ): + def __init__(self, *, admin_username: str, ssh: "_models.ContainerServiceSshConfiguration", **kwargs): """ - :keyword admin_username: Required. The administrator username to use for Linux VMs. + :keyword admin_username: The administrator username to use for Linux VMs. Required. :paramtype admin_username: str - :keyword ssh: Required. SSH configuration for Linux-based VMs running on Azure. + :keyword ssh: SSH configuration for Linux-based VMs running on Azure. Required. :paramtype ssh: ~azure.mgmt.containerservice.v2019_11_01.models.ContainerServiceSshConfiguration """ - super(ContainerServiceLinuxProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.admin_username = admin_username self.ssh = ssh -class ContainerServiceMasterProfile(msrest.serialization.Model): +class ContainerServiceMasterProfile(_serialization.Model): """Profile for the container service master. Variables are only populated by the server, and will be ignored when sending a request. @@ -681,11 +657,11 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar count: Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, - and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". + and 5. The default value is 1. Known values are: 1, 3, and 5. :vartype count: int or ~azure.mgmt.containerservice.v2019_11_01.models.Count - :ivar dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. + :ivar dns_prefix: DNS prefix to be used to create the FQDN for the master pool. Required. :vartype dns_prefix: str - :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + :ivar vm_size: Size of agent VMs. Required. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -722,7 +698,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :vartype vm_size: str or ~azure.mgmt.containerservice.v2019_11_01.models.ContainerServiceVMSizeTypes :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine @@ -736,7 +712,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): :vartype first_consecutive_static_ip: str :ivar storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount" and "ManagedDisks". :vartype storage_profile: str or ~azure.mgmt.containerservice.v2019_11_01.models.ContainerServiceStorageProfileTypes :ivar fqdn: FQDN for the master pool. @@ -744,21 +720,21 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): """ _validation = { - 'dns_prefix': {'required': True}, - 'vm_size': {'required': True}, - 'os_disk_size_gb': {'maximum': 1023, 'minimum': 0}, - 'fqdn': {'readonly': True}, + "dns_prefix": {"required": True}, + "vm_size": {"required": True}, + "os_disk_size_gb": {"maximum": 1023, "minimum": 0}, + "fqdn": {"readonly": True}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'dns_prefix': {'key': 'dnsPrefix', 'type': 'str'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'first_consecutive_static_ip': {'key': 'firstConsecutiveStaticIP', 'type': 'str'}, - 'storage_profile': {'key': 'storageProfile', 'type': 'str'}, - 'fqdn': {'key': 'fqdn', 'type': 'str'}, + "count": {"key": "count", "type": "int"}, + "dns_prefix": {"key": "dnsPrefix", "type": "str"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "first_consecutive_static_ip": {"key": "firstConsecutiveStaticIP", "type": "str"}, + "storage_profile": {"key": "storageProfile", "type": "str"}, + "fqdn": {"key": "fqdn", "type": "str"}, } def __init__( @@ -766,20 +742,20 @@ def __init__( *, dns_prefix: str, vm_size: Union[str, "_models.ContainerServiceVMSizeTypes"], - count: Optional[Union[int, "_models.Count"]] = 1, + count: Union[int, "_models.Count"] = 1, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, - first_consecutive_static_ip: Optional[str] = "10.240.255.5", + first_consecutive_static_ip: str = "10.240.255.5", storage_profile: Optional[Union[str, "_models.ContainerServiceStorageProfileTypes"]] = None, **kwargs ): """ :keyword count: Number of masters (VMs) in the container service cluster. Allowed values are 1, - 3, and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". + 3, and 5. The default value is 1. Known values are: 1, 3, and 5. :paramtype count: int or ~azure.mgmt.containerservice.v2019_11_01.models.Count - :keyword dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. + :keyword dns_prefix: DNS prefix to be used to create the FQDN for the master pool. Required. :paramtype dns_prefix: str - :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + :keyword vm_size: Size of agent VMs. Required. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -816,7 +792,7 @@ def __init__( "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :paramtype vm_size: str or ~azure.mgmt.containerservice.v2019_11_01.models.ContainerServiceVMSizeTypes :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every @@ -830,11 +806,11 @@ def __init__( :paramtype first_consecutive_static_ip: str :keyword storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount" and "ManagedDisks". :paramtype storage_profile: str or ~azure.mgmt.containerservice.v2019_11_01.models.ContainerServiceStorageProfileTypes """ - super(ContainerServiceMasterProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.dns_prefix = dns_prefix self.vm_size = vm_size @@ -845,14 +821,14 @@ def __init__( self.fqdn = None -class ContainerServiceNetworkProfile(msrest.serialization.Model): +class ContainerServiceNetworkProfile(_serialization.Model): """Profile of network configuration. :ivar network_plugin: Network plugin used for building Kubernetes network. Known values are: - "azure", "kubenet". Default value: "kubenet". + "azure" and "kubenet". :vartype network_plugin: str or ~azure.mgmt.containerservice.v2019_11_01.models.NetworkPlugin :ivar network_policy: Network policy used for building Kubernetes network. Known values are: - "calico", "azure". + "calico" and "azure". :vartype network_policy: str or ~azure.mgmt.containerservice.v2019_11_01.models.NetworkPolicy :ivar pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :vartype pod_cidr: str @@ -865,11 +841,11 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): :ivar docker_bridge_cidr: A CIDR notation IP range assigned to the Docker bridge network. It must not overlap with any Subnet IP ranges or the Kubernetes service address range. :vartype docker_bridge_cidr: str - :ivar outbound_type: The outbound (egress) routing method. Known values are: "loadBalancer", - "userDefinedRouting". Default value: "loadBalancer". + :ivar outbound_type: The outbound (egress) routing method. Known values are: "loadBalancer" and + "userDefinedRouting". :vartype outbound_type: str or ~azure.mgmt.containerservice.v2019_11_01.models.OutboundType :ivar load_balancer_sku: The load balancer sku for the managed cluster. Known values are: - "standard", "basic". + "standard" and "basic". :vartype load_balancer_sku: str or ~azure.mgmt.containerservice.v2019_11_01.models.LoadBalancerSku :ivar load_balancer_profile: Profile of the cluster load balancer. @@ -878,44 +854,46 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): """ _validation = { - 'pod_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, - 'service_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, - 'dns_service_ip': {'pattern': r'^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$'}, - 'docker_bridge_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, + "pod_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, + "service_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, + "dns_service_ip": { + "pattern": r"^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$" + }, + "docker_bridge_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, } _attribute_map = { - 'network_plugin': {'key': 'networkPlugin', 'type': 'str'}, - 'network_policy': {'key': 'networkPolicy', 'type': 'str'}, - 'pod_cidr': {'key': 'podCidr', 'type': 'str'}, - 'service_cidr': {'key': 'serviceCidr', 'type': 'str'}, - 'dns_service_ip': {'key': 'dnsServiceIP', 'type': 'str'}, - 'docker_bridge_cidr': {'key': 'dockerBridgeCidr', 'type': 'str'}, - 'outbound_type': {'key': 'outboundType', 'type': 'str'}, - 'load_balancer_sku': {'key': 'loadBalancerSku', 'type': 'str'}, - 'load_balancer_profile': {'key': 'loadBalancerProfile', 'type': 'ManagedClusterLoadBalancerProfile'}, + "network_plugin": {"key": "networkPlugin", "type": "str"}, + "network_policy": {"key": "networkPolicy", "type": "str"}, + "pod_cidr": {"key": "podCidr", "type": "str"}, + "service_cidr": {"key": "serviceCidr", "type": "str"}, + "dns_service_ip": {"key": "dnsServiceIP", "type": "str"}, + "docker_bridge_cidr": {"key": "dockerBridgeCidr", "type": "str"}, + "outbound_type": {"key": "outboundType", "type": "str"}, + "load_balancer_sku": {"key": "loadBalancerSku", "type": "str"}, + "load_balancer_profile": {"key": "loadBalancerProfile", "type": "ManagedClusterLoadBalancerProfile"}, } def __init__( self, *, - network_plugin: Optional[Union[str, "_models.NetworkPlugin"]] = "kubenet", + network_plugin: Union[str, "_models.NetworkPlugin"] = "kubenet", network_policy: Optional[Union[str, "_models.NetworkPolicy"]] = None, - pod_cidr: Optional[str] = "10.244.0.0/16", - service_cidr: Optional[str] = "10.0.0.0/16", - dns_service_ip: Optional[str] = "10.0.0.10", - docker_bridge_cidr: Optional[str] = "172.17.0.1/16", - outbound_type: Optional[Union[str, "_models.OutboundType"]] = "loadBalancer", + pod_cidr: str = "10.244.0.0/16", + service_cidr: str = "10.0.0.0/16", + dns_service_ip: str = "10.0.0.10", + docker_bridge_cidr: str = "172.17.0.1/16", + outbound_type: Union[str, "_models.OutboundType"] = "loadBalancer", load_balancer_sku: Optional[Union[str, "_models.LoadBalancerSku"]] = None, load_balancer_profile: Optional["_models.ManagedClusterLoadBalancerProfile"] = None, **kwargs ): """ :keyword network_plugin: Network plugin used for building Kubernetes network. Known values are: - "azure", "kubenet". Default value: "kubenet". + "azure" and "kubenet". :paramtype network_plugin: str or ~azure.mgmt.containerservice.v2019_11_01.models.NetworkPlugin :keyword network_policy: Network policy used for building Kubernetes network. Known values are: - "calico", "azure". + "calico" and "azure". :paramtype network_policy: str or ~azure.mgmt.containerservice.v2019_11_01.models.NetworkPolicy :keyword pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :paramtype pod_cidr: str @@ -928,18 +906,18 @@ def __init__( :keyword docker_bridge_cidr: A CIDR notation IP range assigned to the Docker bridge network. It must not overlap with any Subnet IP ranges or the Kubernetes service address range. :paramtype docker_bridge_cidr: str - :keyword outbound_type: The outbound (egress) routing method. Known values are: "loadBalancer", - "userDefinedRouting". Default value: "loadBalancer". + :keyword outbound_type: The outbound (egress) routing method. Known values are: "loadBalancer" + and "userDefinedRouting". :paramtype outbound_type: str or ~azure.mgmt.containerservice.v2019_11_01.models.OutboundType :keyword load_balancer_sku: The load balancer sku for the managed cluster. Known values are: - "standard", "basic". + "standard" and "basic". :paramtype load_balancer_sku: str or ~azure.mgmt.containerservice.v2019_11_01.models.LoadBalancerSku :keyword load_balancer_profile: Profile of the cluster load balancer. :paramtype load_balancer_profile: ~azure.mgmt.containerservice.v2019_11_01.models.ManagedClusterLoadBalancerProfile """ - super(ContainerServiceNetworkProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.network_plugin = network_plugin self.network_policy = network_policy self.pod_cidr = pod_cidr @@ -951,113 +929,98 @@ def __init__( self.load_balancer_profile = load_balancer_profile -class ContainerServiceSshConfiguration(msrest.serialization.Model): +class ContainerServiceSshConfiguration(_serialization.Model): """SSH configuration for Linux-based VMs running on Azure. All required parameters must be populated in order to send to Azure. - :ivar public_keys: Required. The list of SSH public keys used to authenticate with Linux-based - VMs. Only expect one key specified. + :ivar public_keys: The list of SSH public keys used to authenticate with Linux-based VMs. Only + expect one key specified. Required. :vartype public_keys: list[~azure.mgmt.containerservice.v2019_11_01.models.ContainerServiceSshPublicKey] """ _validation = { - 'public_keys': {'required': True}, + "public_keys": {"required": True}, } _attribute_map = { - 'public_keys': {'key': 'publicKeys', 'type': '[ContainerServiceSshPublicKey]'}, + "public_keys": {"key": "publicKeys", "type": "[ContainerServiceSshPublicKey]"}, } - def __init__( - self, - *, - public_keys: List["_models.ContainerServiceSshPublicKey"], - **kwargs - ): + def __init__(self, *, public_keys: List["_models.ContainerServiceSshPublicKey"], **kwargs): """ - :keyword public_keys: Required. The list of SSH public keys used to authenticate with - Linux-based VMs. Only expect one key specified. + :keyword public_keys: The list of SSH public keys used to authenticate with Linux-based VMs. + Only expect one key specified. Required. :paramtype public_keys: list[~azure.mgmt.containerservice.v2019_11_01.models.ContainerServiceSshPublicKey] """ - super(ContainerServiceSshConfiguration, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_keys = public_keys -class ContainerServiceSshPublicKey(msrest.serialization.Model): +class ContainerServiceSshPublicKey(_serialization.Model): """Contains information about SSH certificate public key data. All required parameters must be populated in order to send to Azure. - :ivar key_data: Required. Certificate public key used to authenticate with VMs through SSH. The - certificate must be in PEM format with or without headers. + :ivar key_data: Certificate public key used to authenticate with VMs through SSH. The + certificate must be in PEM format with or without headers. Required. :vartype key_data: str """ _validation = { - 'key_data': {'required': True}, + "key_data": {"required": True}, } _attribute_map = { - 'key_data': {'key': 'keyData', 'type': 'str'}, + "key_data": {"key": "keyData", "type": "str"}, } - def __init__( - self, - *, - key_data: str, - **kwargs - ): + def __init__(self, *, key_data: str, **kwargs): """ - :keyword key_data: Required. Certificate public key used to authenticate with VMs through SSH. - The certificate must be in PEM format with or without headers. + :keyword key_data: Certificate public key used to authenticate with VMs through SSH. The + certificate must be in PEM format with or without headers. Required. :paramtype key_data: str """ - super(ContainerServiceSshPublicKey, self).__init__(**kwargs) + super().__init__(**kwargs) self.key_data = key_data -class ContainerServiceVMDiagnostics(msrest.serialization.Model): +class ContainerServiceVMDiagnostics(_serialization.Model): """Profile for diagnostics on the container service VMs. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar enabled: Required. Whether the VM diagnostic agent is provisioned on the VM. + :ivar enabled: Whether the VM diagnostic agent is provisioned on the VM. Required. :vartype enabled: bool :ivar storage_uri: The URI of the storage account where diagnostics are stored. :vartype storage_uri: str """ _validation = { - 'enabled': {'required': True}, - 'storage_uri': {'readonly': True}, + "enabled": {"required": True}, + "storage_uri": {"readonly": True}, } _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'storage_uri': {'key': 'storageUri', 'type': 'str'}, + "enabled": {"key": "enabled", "type": "bool"}, + "storage_uri": {"key": "storageUri", "type": "str"}, } - def __init__( - self, - *, - enabled: bool, - **kwargs - ): + def __init__(self, *, enabled: bool, **kwargs): """ - :keyword enabled: Required. Whether the VM diagnostic agent is provisioned on the VM. + :keyword enabled: Whether the VM diagnostic agent is provisioned on the VM. Required. :paramtype enabled: bool """ - super(ContainerServiceVMDiagnostics, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.storage_uri = None -class CredentialResult(msrest.serialization.Model): +class CredentialResult(_serialization.Model): """The credential result response. Variables are only populated by the server, and will be ignored when sending a request. @@ -1065,31 +1028,27 @@ class CredentialResult(msrest.serialization.Model): :ivar name: The name of the credential. :vartype name: str :ivar value: Base64-encoded Kubernetes configuration file. - :vartype value: bytearray + :vartype value: bytes """ _validation = { - 'name': {'readonly': True}, - 'value': {'readonly': True}, + "name": {"readonly": True}, + "value": {"readonly": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'bytearray'}, + "name": {"key": "name", "type": "str"}, + "value": {"key": "value", "type": "bytearray"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(CredentialResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.name = None self.value = None -class CredentialResults(msrest.serialization.Model): +class CredentialResults(_serialization.Model): """The list of credential result response. Variables are only populated by the server, and will be ignored when sending a request. @@ -1099,24 +1058,20 @@ class CredentialResults(msrest.serialization.Model): """ _validation = { - 'kubeconfigs': {'readonly': True}, + "kubeconfigs": {"readonly": True}, } _attribute_map = { - 'kubeconfigs': {'key': 'kubeconfigs', 'type': '[CredentialResult]'}, + "kubeconfigs": {"key": "kubeconfigs", "type": "[CredentialResult]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(CredentialResults, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.kubeconfigs = None -class Resource(msrest.serialization.Model): +class Resource(_serialization.Model): """The Resource model definition. Variables are only populated by the server, and will be ignored when sending a request. @@ -1129,41 +1084,35 @@ class Resource(msrest.serialization.Model): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] """ - super(Resource, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -1171,7 +1120,7 @@ def __init__( self.tags = tags -class ManagedCluster(Resource): +class ManagedCluster(Resource): # pylint: disable=too-many-instance-attributes """Managed cluster. Variables are only populated by the server, and will be ignored when sending a request. @@ -1184,9 +1133,9 @@ class ManagedCluster(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar identity: The identity of the managed cluster, if configured. :vartype identity: ~azure.mgmt.containerservice.v2019_11_01.models.ManagedClusterIdentity @@ -1241,44 +1190,53 @@ class ManagedCluster(Resource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'provisioning_state': {'readonly': True}, - 'max_agent_pools': {'readonly': True}, - 'fqdn': {'readonly': True}, - 'private_fqdn': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, + "provisioning_state": {"readonly": True}, + "max_agent_pools": {"readonly": True}, + "fqdn": {"readonly": True}, + "private_fqdn": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'ManagedClusterIdentity'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'max_agent_pools': {'key': 'properties.maxAgentPools', 'type': 'int'}, - 'kubernetes_version': {'key': 'properties.kubernetesVersion', 'type': 'str'}, - 'dns_prefix': {'key': 'properties.dnsPrefix', 'type': 'str'}, - 'fqdn': {'key': 'properties.fqdn', 'type': 'str'}, - 'private_fqdn': {'key': 'properties.privateFQDN', 'type': 'str'}, - 'agent_pool_profiles': {'key': 'properties.agentPoolProfiles', 'type': '[ManagedClusterAgentPoolProfile]'}, - 'linux_profile': {'key': 'properties.linuxProfile', 'type': 'ContainerServiceLinuxProfile'}, - 'windows_profile': {'key': 'properties.windowsProfile', 'type': 'ManagedClusterWindowsProfile'}, - 'service_principal_profile': {'key': 'properties.servicePrincipalProfile', 'type': 'ManagedClusterServicePrincipalProfile'}, - 'addon_profiles': {'key': 'properties.addonProfiles', 'type': '{ManagedClusterAddonProfile}'}, - 'node_resource_group': {'key': 'properties.nodeResourceGroup', 'type': 'str'}, - 'enable_rbac': {'key': 'properties.enableRBAC', 'type': 'bool'}, - 'enable_pod_security_policy': {'key': 'properties.enablePodSecurityPolicy', 'type': 'bool'}, - 'network_profile': {'key': 'properties.networkProfile', 'type': 'ContainerServiceNetworkProfile'}, - 'aad_profile': {'key': 'properties.aadProfile', 'type': 'ManagedClusterAADProfile'}, - 'api_server_access_profile': {'key': 'properties.apiServerAccessProfile', 'type': 'ManagedClusterAPIServerAccessProfile'}, - 'identity_profile': {'key': 'properties.identityProfile', 'type': '{ManagedClusterPropertiesIdentityProfileValue}'}, - } - - def __init__( + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "identity": {"key": "identity", "type": "ManagedClusterIdentity"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "max_agent_pools": {"key": "properties.maxAgentPools", "type": "int"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "dns_prefix": {"key": "properties.dnsPrefix", "type": "str"}, + "fqdn": {"key": "properties.fqdn", "type": "str"}, + "private_fqdn": {"key": "properties.privateFQDN", "type": "str"}, + "agent_pool_profiles": {"key": "properties.agentPoolProfiles", "type": "[ManagedClusterAgentPoolProfile]"}, + "linux_profile": {"key": "properties.linuxProfile", "type": "ContainerServiceLinuxProfile"}, + "windows_profile": {"key": "properties.windowsProfile", "type": "ManagedClusterWindowsProfile"}, + "service_principal_profile": { + "key": "properties.servicePrincipalProfile", + "type": "ManagedClusterServicePrincipalProfile", + }, + "addon_profiles": {"key": "properties.addonProfiles", "type": "{ManagedClusterAddonProfile}"}, + "node_resource_group": {"key": "properties.nodeResourceGroup", "type": "str"}, + "enable_rbac": {"key": "properties.enableRBAC", "type": "bool"}, + "enable_pod_security_policy": {"key": "properties.enablePodSecurityPolicy", "type": "bool"}, + "network_profile": {"key": "properties.networkProfile", "type": "ContainerServiceNetworkProfile"}, + "aad_profile": {"key": "properties.aadProfile", "type": "ManagedClusterAADProfile"}, + "api_server_access_profile": { + "key": "properties.apiServerAccessProfile", + "type": "ManagedClusterAPIServerAccessProfile", + }, + "identity_profile": { + "key": "properties.identityProfile", + "type": "{ManagedClusterPropertiesIdentityProfileValue}", + }, + } + + def __init__( # pylint: disable=too-many-locals self, *, location: str, @@ -1301,9 +1259,9 @@ def __init__( **kwargs ): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword identity: The identity of the managed cluster, if configured. :paramtype identity: ~azure.mgmt.containerservice.v2019_11_01.models.ManagedClusterIdentity @@ -1348,7 +1306,7 @@ def __init__( :paramtype identity_profile: dict[str, ~azure.mgmt.containerservice.v2019_11_01.models.ManagedClusterPropertiesIdentityProfileValue] """ - super(ManagedCluster, self).__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.identity = identity self.provisioning_state = None self.max_agent_pools = None @@ -1370,14 +1328,14 @@ def __init__( self.identity_profile = identity_profile -class ManagedClusterAADProfile(msrest.serialization.Model): +class ManagedClusterAADProfile(_serialization.Model): """AADProfile specifies attributes for Azure Active Directory integration. All required parameters must be populated in order to send to Azure. - :ivar client_app_id: Required. The client AAD application ID. + :ivar client_app_id: The client AAD application ID. Required. :vartype client_app_id: str - :ivar server_app_id: Required. The server AAD application ID. + :ivar server_app_id: The server AAD application ID. Required. :vartype server_app_id: str :ivar server_app_secret: The server AAD application secret. :vartype server_app_secret: str @@ -1387,15 +1345,15 @@ class ManagedClusterAADProfile(msrest.serialization.Model): """ _validation = { - 'client_app_id': {'required': True}, - 'server_app_id': {'required': True}, + "client_app_id": {"required": True}, + "server_app_id": {"required": True}, } _attribute_map = { - 'client_app_id': {'key': 'clientAppID', 'type': 'str'}, - 'server_app_id': {'key': 'serverAppID', 'type': 'str'}, - 'server_app_secret': {'key': 'serverAppSecret', 'type': 'str'}, - 'tenant_id': {'key': 'tenantID', 'type': 'str'}, + "client_app_id": {"key": "clientAppID", "type": "str"}, + "server_app_id": {"key": "serverAppID", "type": "str"}, + "server_app_secret": {"key": "serverAppSecret", "type": "str"}, + "tenant_id": {"key": "tenantID", "type": "str"}, } def __init__( @@ -1408,9 +1366,9 @@ def __init__( **kwargs ): """ - :keyword client_app_id: Required. The client AAD application ID. + :keyword client_app_id: The client AAD application ID. Required. :paramtype client_app_id: str - :keyword server_app_id: Required. The server AAD application ID. + :keyword server_app_id: The server AAD application ID. Required. :paramtype server_app_id: str :keyword server_app_secret: The server AAD application secret. :paramtype server_app_secret: str @@ -1418,7 +1376,7 @@ def __init__( tenant of the deployment subscription. :paramtype tenant_id: str """ - super(ManagedClusterAADProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.client_app_id = client_app_id self.server_app_id = server_app_id self.server_app_secret = server_app_secret @@ -1438,58 +1396,53 @@ class ManagedClusterAccessProfile(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar kube_config: Base64-encoded Kubernetes configuration file. - :vartype kube_config: bytearray + :vartype kube_config: bytes """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'kube_config': {'key': 'properties.kubeConfig', 'type': 'bytearray'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "kube_config": {"key": "properties.kubeConfig", "type": "bytearray"}, } def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - kube_config: Optional[bytearray] = None, - **kwargs + self, *, location: str, tags: Optional[Dict[str, str]] = None, kube_config: Optional[bytes] = None, **kwargs ): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword kube_config: Base64-encoded Kubernetes configuration file. - :paramtype kube_config: bytearray + :paramtype kube_config: bytes """ - super(ManagedClusterAccessProfile, self).__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.kube_config = kube_config -class ManagedClusterAddonProfile(msrest.serialization.Model): +class ManagedClusterAddonProfile(_serialization.Model): """A Kubernetes add-on profile for a managed cluster. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar enabled: Required. Whether the add-on is enabled or not. + :ivar enabled: Whether the add-on is enabled or not. Required. :vartype enabled: bool :ivar config: Key-value pairs for configuring an add-on. :vartype config: dict[str, str] @@ -1499,36 +1452,30 @@ class ManagedClusterAddonProfile(msrest.serialization.Model): """ _validation = { - 'enabled': {'required': True}, - 'identity': {'readonly': True}, + "enabled": {"required": True}, + "identity": {"readonly": True}, } _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'config': {'key': 'config', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'ManagedClusterAddonProfileIdentity'}, + "enabled": {"key": "enabled", "type": "bool"}, + "config": {"key": "config", "type": "{str}"}, + "identity": {"key": "identity", "type": "ManagedClusterAddonProfileIdentity"}, } - def __init__( - self, - *, - enabled: bool, - config: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, enabled: bool, config: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword enabled: Required. Whether the add-on is enabled or not. + :keyword enabled: Whether the add-on is enabled or not. Required. :paramtype enabled: bool :keyword config: Key-value pairs for configuring an add-on. :paramtype config: dict[str, str] """ - super(ManagedClusterAddonProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.config = config self.identity = None -class UserAssignedIdentity(msrest.serialization.Model): +class UserAssignedIdentity(_serialization.Model): """UserAssignedIdentity. :ivar resource_id: The resource id of the user assigned identity. @@ -1540,9 +1487,9 @@ class UserAssignedIdentity(msrest.serialization.Model): """ _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'object_id': {'key': 'objectId', 'type': 'str'}, + "resource_id": {"key": "resourceId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + "object_id": {"key": "objectId", "type": "str"}, } def __init__( @@ -1561,7 +1508,7 @@ def __init__( :keyword object_id: The object id of the user assigned identity. :paramtype object_id: str """ - super(UserAssignedIdentity, self).__init__(**kwargs) + super().__init__(**kwargs) self.resource_id = resource_id self.client_id = client_id self.object_id = object_id @@ -1579,9 +1526,9 @@ class ManagedClusterAddonProfileIdentity(UserAssignedIdentity): """ _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'object_id': {'key': 'objectId', 'type': 'str'}, + "resource_id": {"key": "resourceId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + "object_id": {"key": "objectId", "type": "str"}, } def __init__( @@ -1600,10 +1547,10 @@ def __init__( :keyword object_id: The object id of the user assigned identity. :paramtype object_id: str """ - super(ManagedClusterAddonProfileIdentity, self).__init__(resource_id=resource_id, client_id=client_id, object_id=object_id, **kwargs) + super().__init__(resource_id=resource_id, client_id=client_id, object_id=object_id, **kwargs) -class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): +class ManagedClusterAgentPoolProfileProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes """Properties for the container service agent pool profile. Variables are only populated by the server, and will be ignored when sending a request. @@ -1648,7 +1595,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :vartype vm_size: str or ~azure.mgmt.containerservice.v2019_11_01.models.ContainerServiceVMSizeTypes :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine @@ -1660,7 +1607,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Known values are: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux" and "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2019_11_01.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -1669,7 +1616,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar type: AgentPoolType represents types of an agent pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2019_11_01.models.AgentPoolType :ivar orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -1683,16 +1630,15 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar enable_node_public_ip: Enable public IP for nodes. :vartype enable_node_public_ip: bool :ivar scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Known values are: "Low", "Regular". Default value: "Regular". + priority. Default to regular. Known values are: "Low" and "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2019_11_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy - for low priority virtual machine scale set. Default to Delete. Known values are: "Delete", - "Deallocate". Default value: "Delete". + for low priority virtual machine scale set. Default to Delete. Known values are: "Delete" and + "Deallocate". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2019_11_01.models.ScaleSetEvictionPolicy - :ivar tags: A set of tags. Agent pool tags to be persisted on the agent pool virtual machine - scale set. + :ivar tags: Agent pool tags to be persisted on the agent pool virtual machine scale set. :vartype tags: dict[str, str] :ivar node_labels: Agent pool node labels to be persisted across all nodes in agent pool. :vartype node_labels: dict[str, str] @@ -1702,30 +1648,30 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): """ _validation = { - 'os_disk_size_gb': {'maximum': 1023, 'minimum': 0}, - 'provisioning_state': {'readonly': True}, + "os_disk_size_gb": {"maximum": 1023, "minimum": 0}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'maxPods', 'type': 'int'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'max_count': {'key': 'maxCount', 'type': 'int'}, - 'min_count': {'key': 'minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'enableAutoScaling', 'type': 'bool'}, - 'type': {'key': 'type', 'type': 'str'}, - 'orchestrator_version': {'key': 'orchestratorVersion', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'availability_zones': {'key': 'availabilityZones', 'type': '[str]'}, - 'enable_node_public_ip': {'key': 'enableNodePublicIP', 'type': 'bool'}, - 'scale_set_priority': {'key': 'scaleSetPriority', 'type': 'str'}, - 'scale_set_eviction_policy': {'key': 'scaleSetEvictionPolicy', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'node_labels': {'key': 'nodeLabels', 'type': '{str}'}, - 'node_taints': {'key': 'nodeTaints', 'type': '[str]'}, + "count": {"key": "count", "type": "int"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "max_pods": {"key": "maxPods", "type": "int"}, + "os_type": {"key": "osType", "type": "str"}, + "max_count": {"key": "maxCount", "type": "int"}, + "min_count": {"key": "minCount", "type": "int"}, + "enable_auto_scaling": {"key": "enableAutoScaling", "type": "bool"}, + "type": {"key": "type", "type": "str"}, + "orchestrator_version": {"key": "orchestratorVersion", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "availability_zones": {"key": "availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "enableNodePublicIP", "type": "bool"}, + "scale_set_priority": {"key": "scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "scaleSetEvictionPolicy", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "node_labels": {"key": "nodeLabels", "type": "{str}"}, + "node_taints": {"key": "nodeTaints", "type": "[str]"}, } def __init__( @@ -1736,7 +1682,7 @@ def __init__( os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, @@ -1744,8 +1690,8 @@ def __init__( orchestrator_version: Optional[str] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, - scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, @@ -1792,7 +1738,7 @@ def __init__( "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :paramtype vm_size: str or ~azure.mgmt.containerservice.v2019_11_01.models.ContainerServiceVMSizeTypes :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every @@ -1804,7 +1750,7 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux" and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2019_11_01.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -1813,7 +1759,7 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword type: AgentPoolType represents types of an agent pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2019_11_01.models.AgentPoolType :keyword orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -1824,16 +1770,15 @@ def __init__( :keyword enable_node_public_ip: Enable public IP for nodes. :paramtype enable_node_public_ip: bool :keyword scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Known values are: "Low", "Regular". Default value: "Regular". + priority. Default to regular. Known values are: "Low" and "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2019_11_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy for low priority virtual machine scale set. Default to Delete. Known values are: - "Delete", "Deallocate". Default value: "Delete". + "Delete" and "Deallocate". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2019_11_01.models.ScaleSetEvictionPolicy - :keyword tags: A set of tags. Agent pool tags to be persisted on the agent pool virtual machine - scale set. + :keyword tags: Agent pool tags to be persisted on the agent pool virtual machine scale set. :paramtype tags: dict[str, str] :keyword node_labels: Agent pool node labels to be persisted across all nodes in agent pool. :paramtype node_labels: dict[str, str] @@ -1841,7 +1786,7 @@ def __init__( key=value:NoSchedule. :paramtype node_taints: list[str] """ - super(ManagedClusterAgentPoolProfileProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.vm_size = vm_size self.os_disk_size_gb = os_disk_size_gb @@ -1863,7 +1808,9 @@ def __init__( self.node_taints = node_taints -class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): +class ManagedClusterAgentPoolProfile( + ManagedClusterAgentPoolProfileProperties +): # pylint: disable=too-many-instance-attributes """Profile for the container service agent pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -1910,7 +1857,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :vartype vm_size: str or ~azure.mgmt.containerservice.v2019_11_01.models.ContainerServiceVMSizeTypes :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine @@ -1922,7 +1869,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Known values are: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux" and "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2019_11_01.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -1931,7 +1878,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar type: AgentPoolType represents types of an agent pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2019_11_01.models.AgentPoolType :ivar orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -1945,54 +1892,53 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar enable_node_public_ip: Enable public IP for nodes. :vartype enable_node_public_ip: bool :ivar scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Known values are: "Low", "Regular". Default value: "Regular". + priority. Default to regular. Known values are: "Low" and "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2019_11_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy - for low priority virtual machine scale set. Default to Delete. Known values are: "Delete", - "Deallocate". Default value: "Delete". + for low priority virtual machine scale set. Default to Delete. Known values are: "Delete" and + "Deallocate". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2019_11_01.models.ScaleSetEvictionPolicy - :ivar tags: A set of tags. Agent pool tags to be persisted on the agent pool virtual machine - scale set. + :ivar tags: Agent pool tags to be persisted on the agent pool virtual machine scale set. :vartype tags: dict[str, str] :ivar node_labels: Agent pool node labels to be persisted across all nodes in agent pool. :vartype node_labels: dict[str, str] :ivar node_taints: Taints added to new nodes during node pool create and scale. For example, key=value:NoSchedule. :vartype node_taints: list[str] - :ivar name: Required. Unique name of the agent pool profile in the context of the subscription - and resource group. + :ivar name: Unique name of the agent pool profile in the context of the subscription and + resource group. Required. :vartype name: str """ _validation = { - 'os_disk_size_gb': {'maximum': 1023, 'minimum': 0}, - 'provisioning_state': {'readonly': True}, - 'name': {'required': True, 'pattern': r'^[a-z][a-z0-9]{0,11}$'}, + "os_disk_size_gb": {"maximum": 1023, "minimum": 0}, + "provisioning_state": {"readonly": True}, + "name": {"required": True, "pattern": r"^[a-z][a-z0-9]{0,11}$"}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'maxPods', 'type': 'int'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'max_count': {'key': 'maxCount', 'type': 'int'}, - 'min_count': {'key': 'minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'enableAutoScaling', 'type': 'bool'}, - 'type': {'key': 'type', 'type': 'str'}, - 'orchestrator_version': {'key': 'orchestratorVersion', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'availability_zones': {'key': 'availabilityZones', 'type': '[str]'}, - 'enable_node_public_ip': {'key': 'enableNodePublicIP', 'type': 'bool'}, - 'scale_set_priority': {'key': 'scaleSetPriority', 'type': 'str'}, - 'scale_set_eviction_policy': {'key': 'scaleSetEvictionPolicy', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'node_labels': {'key': 'nodeLabels', 'type': '{str}'}, - 'node_taints': {'key': 'nodeTaints', 'type': '[str]'}, - 'name': {'key': 'name', 'type': 'str'}, + "count": {"key": "count", "type": "int"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "max_pods": {"key": "maxPods", "type": "int"}, + "os_type": {"key": "osType", "type": "str"}, + "max_count": {"key": "maxCount", "type": "int"}, + "min_count": {"key": "minCount", "type": "int"}, + "enable_auto_scaling": {"key": "enableAutoScaling", "type": "bool"}, + "type": {"key": "type", "type": "str"}, + "orchestrator_version": {"key": "orchestratorVersion", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "availability_zones": {"key": "availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "enableNodePublicIP", "type": "bool"}, + "scale_set_priority": {"key": "scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "scaleSetEvictionPolicy", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "node_labels": {"key": "nodeLabels", "type": "{str}"}, + "node_taints": {"key": "nodeTaints", "type": "[str]"}, + "name": {"key": "name", "type": "str"}, } def __init__( @@ -2004,7 +1950,7 @@ def __init__( os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, @@ -2012,8 +1958,8 @@ def __init__( orchestrator_version: Optional[str] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, - scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, @@ -2060,7 +2006,7 @@ def __init__( "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :paramtype vm_size: str or ~azure.mgmt.containerservice.v2019_11_01.models.ContainerServiceVMSizeTypes :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every @@ -2072,7 +2018,7 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux" and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2019_11_01.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -2081,7 +2027,7 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword type: AgentPoolType represents types of an agent pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2019_11_01.models.AgentPoolType :keyword orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -2092,31 +2038,50 @@ def __init__( :keyword enable_node_public_ip: Enable public IP for nodes. :paramtype enable_node_public_ip: bool :keyword scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Known values are: "Low", "Regular". Default value: "Regular". + priority. Default to regular. Known values are: "Low" and "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2019_11_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy for low priority virtual machine scale set. Default to Delete. Known values are: - "Delete", "Deallocate". Default value: "Delete". + "Delete" and "Deallocate". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2019_11_01.models.ScaleSetEvictionPolicy - :keyword tags: A set of tags. Agent pool tags to be persisted on the agent pool virtual machine - scale set. + :keyword tags: Agent pool tags to be persisted on the agent pool virtual machine scale set. :paramtype tags: dict[str, str] :keyword node_labels: Agent pool node labels to be persisted across all nodes in agent pool. :paramtype node_labels: dict[str, str] :keyword node_taints: Taints added to new nodes during node pool create and scale. For example, key=value:NoSchedule. :paramtype node_taints: list[str] - :keyword name: Required. Unique name of the agent pool profile in the context of the - subscription and resource group. + :keyword name: Unique name of the agent pool profile in the context of the subscription and + resource group. Required. :paramtype name: str """ - super(ManagedClusterAgentPoolProfile, self).__init__(count=count, vm_size=vm_size, os_disk_size_gb=os_disk_size_gb, vnet_subnet_id=vnet_subnet_id, max_pods=max_pods, os_type=os_type, max_count=max_count, min_count=min_count, enable_auto_scaling=enable_auto_scaling, type=type, orchestrator_version=orchestrator_version, availability_zones=availability_zones, enable_node_public_ip=enable_node_public_ip, scale_set_priority=scale_set_priority, scale_set_eviction_policy=scale_set_eviction_policy, tags=tags, node_labels=node_labels, node_taints=node_taints, **kwargs) + super().__init__( + count=count, + vm_size=vm_size, + os_disk_size_gb=os_disk_size_gb, + vnet_subnet_id=vnet_subnet_id, + max_pods=max_pods, + os_type=os_type, + max_count=max_count, + min_count=min_count, + enable_auto_scaling=enable_auto_scaling, + type=type, + orchestrator_version=orchestrator_version, + availability_zones=availability_zones, + enable_node_public_ip=enable_node_public_ip, + scale_set_priority=scale_set_priority, + scale_set_eviction_policy=scale_set_eviction_policy, + tags=tags, + node_labels=node_labels, + node_taints=node_taints, + **kwargs + ) self.name = name -class ManagedClusterAPIServerAccessProfile(msrest.serialization.Model): +class ManagedClusterAPIServerAccessProfile(_serialization.Model): """Access profile for managed cluster API server. :ivar authorized_ip_ranges: Authorized IP Ranges to kubernetes API server. @@ -2126,8 +2091,8 @@ class ManagedClusterAPIServerAccessProfile(msrest.serialization.Model): """ _attribute_map = { - 'authorized_ip_ranges': {'key': 'authorizedIPRanges', 'type': '[str]'}, - 'enable_private_cluster': {'key': 'enablePrivateCluster', 'type': 'bool'}, + "authorized_ip_ranges": {"key": "authorizedIPRanges", "type": "[str]"}, + "enable_private_cluster": {"key": "enablePrivateCluster", "type": "bool"}, } def __init__( @@ -2143,12 +2108,12 @@ def __init__( :keyword enable_private_cluster: Whether to create the cluster as a private cluster or not. :paramtype enable_private_cluster: bool """ - super(ManagedClusterAPIServerAccessProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.authorized_ip_ranges = authorized_ip_ranges self.enable_private_cluster = enable_private_cluster -class ManagedClusterIdentity(msrest.serialization.Model): +class ManagedClusterIdentity(_serialization.Model): """Identity for the managed cluster. Variables are only populated by the server, and will be ignored when sending a request. @@ -2162,41 +2127,36 @@ class ManagedClusterIdentity(msrest.serialization.Model): :ivar type: The type of identity used for the managed cluster. Type 'SystemAssigned' will use an implicitly created identity in master components and an auto-created user assigned identity in MC_ resource group in agent nodes. Type 'None' will not use MSI for the managed cluster, - service principal will be used instead. Known values are: "SystemAssigned", "None". + service principal will be used instead. Known values are: "SystemAssigned" and "None". :vartype type: str or ~azure.mgmt.containerservice.v2019_11_01.models.ResourceIdentityType """ _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, + "principal_id": {"readonly": True}, + "tenant_id": {"readonly": True}, } _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, + "principal_id": {"key": "principalId", "type": "str"}, + "tenant_id": {"key": "tenantId", "type": "str"}, + "type": {"key": "type", "type": "str"}, } - def __init__( - self, - *, - type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, - **kwargs - ): + def __init__(self, *, type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, **kwargs): """ :keyword type: The type of identity used for the managed cluster. Type 'SystemAssigned' will use an implicitly created identity in master components and an auto-created user assigned identity in MC_ resource group in agent nodes. Type 'None' will not use MSI for the managed - cluster, service principal will be used instead. Known values are: "SystemAssigned", "None". + cluster, service principal will be used instead. Known values are: "SystemAssigned" and "None". :paramtype type: str or ~azure.mgmt.containerservice.v2019_11_01.models.ResourceIdentityType """ - super(ManagedClusterIdentity, self).__init__(**kwargs) + super().__init__(**kwargs) self.principal_id = None self.tenant_id = None self.type = type -class ManagedClusterListResult(msrest.serialization.Model): +class ManagedClusterListResult(_serialization.Model): """The response from the List Managed Clusters operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -2208,30 +2168,25 @@ class ManagedClusterListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[ManagedCluster]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[ManagedCluster]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.ManagedCluster"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.ManagedCluster"]] = None, **kwargs): """ :keyword value: The list of managed clusters. :paramtype value: list[~azure.mgmt.containerservice.v2019_11_01.models.ManagedCluster] """ - super(ManagedClusterListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class ManagedClusterLoadBalancerProfile(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfile(_serialization.Model): """Profile of the managed cluster load balancer. :ivar managed_outbound_i_ps: Desired managed outbound IPs for the cluster load balancer. @@ -2257,17 +2212,23 @@ class ManagedClusterLoadBalancerProfile(msrest.serialization.Model): """ _validation = { - 'allocated_outbound_ports': {'maximum': 64000, 'minimum': 0}, - 'idle_timeout_in_minutes': {'maximum': 120, 'minimum': 4}, + "allocated_outbound_ports": {"maximum": 64000, "minimum": 0}, + "idle_timeout_in_minutes": {"maximum": 120, "minimum": 4}, } _attribute_map = { - 'managed_outbound_i_ps': {'key': 'managedOutboundIPs', 'type': 'ManagedClusterLoadBalancerProfileManagedOutboundIPs'}, - 'outbound_ip_prefixes': {'key': 'outboundIPPrefixes', 'type': 'ManagedClusterLoadBalancerProfileOutboundIPPrefixes'}, - 'outbound_i_ps': {'key': 'outboundIPs', 'type': 'ManagedClusterLoadBalancerProfileOutboundIPs'}, - 'effective_outbound_i_ps': {'key': 'effectiveOutboundIPs', 'type': '[ResourceReference]'}, - 'allocated_outbound_ports': {'key': 'allocatedOutboundPorts', 'type': 'int'}, - 'idle_timeout_in_minutes': {'key': 'idleTimeoutInMinutes', 'type': 'int'}, + "managed_outbound_i_ps": { + "key": "managedOutboundIPs", + "type": "ManagedClusterLoadBalancerProfileManagedOutboundIPs", + }, + "outbound_ip_prefixes": { + "key": "outboundIPPrefixes", + "type": "ManagedClusterLoadBalancerProfileOutboundIPPrefixes", + }, + "outbound_i_ps": {"key": "outboundIPs", "type": "ManagedClusterLoadBalancerProfileOutboundIPs"}, + "effective_outbound_i_ps": {"key": "effectiveOutboundIPs", "type": "[ResourceReference]"}, + "allocated_outbound_ports": {"key": "allocatedOutboundPorts", "type": "int"}, + "idle_timeout_in_minutes": {"key": "idleTimeoutInMinutes", "type": "int"}, } def __init__( @@ -2277,8 +2238,8 @@ def __init__( outbound_ip_prefixes: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPPrefixes"] = None, outbound_i_ps: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPs"] = None, effective_outbound_i_ps: Optional[List["_models.ResourceReference"]] = None, - allocated_outbound_ports: Optional[int] = 0, - idle_timeout_in_minutes: Optional[int] = 30, + allocated_outbound_ports: int = 0, + idle_timeout_in_minutes: int = 30, **kwargs ): """ @@ -2304,7 +2265,7 @@ def __init__( must be in the range of 4 to 120 (inclusive). The default value is 30 minutes. :paramtype idle_timeout_in_minutes: int """ - super(ManagedClusterLoadBalancerProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.managed_outbound_i_ps = managed_outbound_i_ps self.outbound_ip_prefixes = outbound_ip_prefixes self.outbound_i_ps = outbound_i_ps @@ -2313,7 +2274,7 @@ def __init__( self.idle_timeout_in_minutes = idle_timeout_in_minutes -class ManagedClusterLoadBalancerProfileManagedOutboundIPs(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfileManagedOutboundIPs(_serialization.Model): """Desired managed outbound IPs for the cluster load balancer. :ivar count: Desired number of outbound IP created/managed by Azure for the cluster load @@ -2322,29 +2283,24 @@ class ManagedClusterLoadBalancerProfileManagedOutboundIPs(msrest.serialization.M """ _validation = { - 'count': {'maximum': 100, 'minimum': 1}, + "count": {"maximum": 100, "minimum": 1}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, + "count": {"key": "count", "type": "int"}, } - def __init__( - self, - *, - count: Optional[int] = 1, - **kwargs - ): + def __init__(self, *, count: int = 1, **kwargs): """ :keyword count: Desired number of outbound IP created/managed by Azure for the cluster load balancer. Allowed values must be in the range of 1 to 100 (inclusive). The default value is 1. :paramtype count: int """ - super(ManagedClusterLoadBalancerProfileManagedOutboundIPs, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count -class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(_serialization.Model): """Desired outbound IP Prefix resources for the cluster load balancer. :ivar public_ip_prefixes: A list of public IP prefix resources. @@ -2353,25 +2309,20 @@ class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(msrest.serialization.M """ _attribute_map = { - 'public_ip_prefixes': {'key': 'publicIPPrefixes', 'type': '[ResourceReference]'}, + "public_ip_prefixes": {"key": "publicIPPrefixes", "type": "[ResourceReference]"}, } - def __init__( - self, - *, - public_ip_prefixes: Optional[List["_models.ResourceReference"]] = None, - **kwargs - ): + def __init__(self, *, public_ip_prefixes: Optional[List["_models.ResourceReference"]] = None, **kwargs): """ :keyword public_ip_prefixes: A list of public IP prefix resources. :paramtype public_ip_prefixes: list[~azure.mgmt.containerservice.v2019_11_01.models.ResourceReference] """ - super(ManagedClusterLoadBalancerProfileOutboundIPPrefixes, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_ip_prefixes = public_ip_prefixes -class ManagedClusterLoadBalancerProfileOutboundIPs(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfileOutboundIPs(_serialization.Model): """Desired outbound IP resources for the cluster load balancer. :ivar public_i_ps: A list of public IP resources. @@ -2379,34 +2330,29 @@ class ManagedClusterLoadBalancerProfileOutboundIPs(msrest.serialization.Model): """ _attribute_map = { - 'public_i_ps': {'key': 'publicIPs', 'type': '[ResourceReference]'}, + "public_i_ps": {"key": "publicIPs", "type": "[ResourceReference]"}, } - def __init__( - self, - *, - public_i_ps: Optional[List["_models.ResourceReference"]] = None, - **kwargs - ): + def __init__(self, *, public_i_ps: Optional[List["_models.ResourceReference"]] = None, **kwargs): """ :keyword public_i_ps: A list of public IP resources. :paramtype public_i_ps: list[~azure.mgmt.containerservice.v2019_11_01.models.ResourceReference] """ - super(ManagedClusterLoadBalancerProfileOutboundIPs, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_i_ps = public_i_ps -class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): +class ManagedClusterPoolUpgradeProfile(_serialization.Model): """The list of available upgrade versions. All required parameters must be populated in order to send to Azure. - :ivar kubernetes_version: Required. Kubernetes version (major, minor, patch). + :ivar kubernetes_version: Kubernetes version (major, minor, patch). Required. :vartype kubernetes_version: str :ivar name: Pool name. :vartype name: str - :ivar os_type: Required. OsType to be used to specify os type. Choose from Linux and Windows. - Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to + Linux. Known values are: "Linux" and "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2019_11_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -2414,15 +2360,15 @@ class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): """ _validation = { - 'kubernetes_version': {'required': True}, - 'os_type': {'required': True}, + "kubernetes_version": {"required": True}, + "os_type": {"required": True}, } _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'upgrades': {'key': 'upgrades', 'type': '[ManagedClusterPoolUpgradeProfileUpgradesItem]'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "os_type": {"key": "osType", "type": "str"}, + "upgrades": {"key": "upgrades", "type": "[ManagedClusterPoolUpgradeProfileUpgradesItem]"}, } def __init__( @@ -2435,25 +2381,25 @@ def __init__( **kwargs ): """ - :keyword kubernetes_version: Required. Kubernetes version (major, minor, patch). + :keyword kubernetes_version: Kubernetes version (major, minor, patch). Required. :paramtype kubernetes_version: str :keyword name: Pool name. :paramtype name: str - :keyword os_type: Required. OsType to be used to specify os type. Choose from Linux and - Windows. Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default + to Linux. Known values are: "Linux" and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2019_11_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: list[~azure.mgmt.containerservice.v2019_11_01.models.ManagedClusterPoolUpgradeProfileUpgradesItem] """ - super(ManagedClusterPoolUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.name = name self.os_type = os_type self.upgrades = upgrades -class ManagedClusterPoolUpgradeProfileUpgradesItem(msrest.serialization.Model): +class ManagedClusterPoolUpgradeProfileUpgradesItem(_serialization.Model): """ManagedClusterPoolUpgradeProfileUpgradesItem. :ivar kubernetes_version: Kubernetes version (major, minor, patch). @@ -2463,24 +2409,18 @@ class ManagedClusterPoolUpgradeProfileUpgradesItem(msrest.serialization.Model): """ _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } - def __init__( - self, - *, - kubernetes_version: Optional[str] = None, - is_preview: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, kubernetes_version: Optional[str] = None, is_preview: Optional[bool] = None, **kwargs): """ :keyword kubernetes_version: Kubernetes version (major, minor, patch). :paramtype kubernetes_version: str :keyword is_preview: Whether Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(ManagedClusterPoolUpgradeProfileUpgradesItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.is_preview = is_preview @@ -2497,9 +2437,9 @@ class ManagedClusterPropertiesIdentityProfileValue(UserAssignedIdentity): """ _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'object_id': {'key': 'objectId', 'type': 'str'}, + "resource_id": {"key": "resourceId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + "object_id": {"key": "objectId", "type": "str"}, } def __init__( @@ -2518,48 +2458,42 @@ def __init__( :keyword object_id: The object id of the user assigned identity. :paramtype object_id: str """ - super(ManagedClusterPropertiesIdentityProfileValue, self).__init__(resource_id=resource_id, client_id=client_id, object_id=object_id, **kwargs) + super().__init__(resource_id=resource_id, client_id=client_id, object_id=object_id, **kwargs) -class ManagedClusterServicePrincipalProfile(msrest.serialization.Model): +class ManagedClusterServicePrincipalProfile(_serialization.Model): """Information about a service principal identity for the cluster to use for manipulating Azure APIs. All required parameters must be populated in order to send to Azure. - :ivar client_id: Required. The ID for the service principal. + :ivar client_id: The ID for the service principal. Required. :vartype client_id: str :ivar secret: The secret password associated with the service principal in plain text. :vartype secret: str """ _validation = { - 'client_id': {'required': True}, + "client_id": {"required": True}, } _attribute_map = { - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'secret': {'key': 'secret', 'type': 'str'}, + "client_id": {"key": "clientId", "type": "str"}, + "secret": {"key": "secret", "type": "str"}, } - def __init__( - self, - *, - client_id: str, - secret: Optional[str] = None, - **kwargs - ): + def __init__(self, *, client_id: str, secret: Optional[str] = None, **kwargs): """ - :keyword client_id: Required. The ID for the service principal. + :keyword client_id: The ID for the service principal. Required. :paramtype client_id: str :keyword secret: The secret password associated with the service principal in plain text. :paramtype secret: str """ - super(ManagedClusterServicePrincipalProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.client_id = client_id self.secret = secret -class ManagedClusterUpgradeProfile(msrest.serialization.Model): +class ManagedClusterUpgradeProfile(_serialization.Model): """The list of available upgrades for compute pools. Variables are only populated by the server, and will be ignored when sending a request. @@ -2572,29 +2506,29 @@ class ManagedClusterUpgradeProfile(msrest.serialization.Model): :vartype name: str :ivar type: Type of upgrade profile. :vartype type: str - :ivar control_plane_profile: Required. The list of available upgrade versions for the control - plane. + :ivar control_plane_profile: The list of available upgrade versions for the control plane. + Required. :vartype control_plane_profile: ~azure.mgmt.containerservice.v2019_11_01.models.ManagedClusterPoolUpgradeProfile - :ivar agent_pool_profiles: Required. The list of available upgrade versions for agent pools. + :ivar agent_pool_profiles: The list of available upgrade versions for agent pools. Required. :vartype agent_pool_profiles: list[~azure.mgmt.containerservice.v2019_11_01.models.ManagedClusterPoolUpgradeProfile] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'control_plane_profile': {'required': True}, - 'agent_pool_profiles': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "control_plane_profile": {"required": True}, + "agent_pool_profiles": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'control_plane_profile': {'key': 'properties.controlPlaneProfile', 'type': 'ManagedClusterPoolUpgradeProfile'}, - 'agent_pool_profiles': {'key': 'properties.agentPoolProfiles', 'type': '[ManagedClusterPoolUpgradeProfile]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "control_plane_profile": {"key": "properties.controlPlaneProfile", "type": "ManagedClusterPoolUpgradeProfile"}, + "agent_pool_profiles": {"key": "properties.agentPoolProfiles", "type": "[ManagedClusterPoolUpgradeProfile]"}, } def __init__( @@ -2605,15 +2539,15 @@ def __init__( **kwargs ): """ - :keyword control_plane_profile: Required. The list of available upgrade versions for the - control plane. + :keyword control_plane_profile: The list of available upgrade versions for the control plane. + Required. :paramtype control_plane_profile: ~azure.mgmt.containerservice.v2019_11_01.models.ManagedClusterPoolUpgradeProfile - :keyword agent_pool_profiles: Required. The list of available upgrade versions for agent pools. + :keyword agent_pool_profiles: The list of available upgrade versions for agent pools. Required. :paramtype agent_pool_profiles: list[~azure.mgmt.containerservice.v2019_11_01.models.ManagedClusterPoolUpgradeProfile] """ - super(ManagedClusterUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -2621,18 +2555,18 @@ def __init__( self.agent_pool_profiles = agent_pool_profiles -class ManagedClusterWindowsProfile(msrest.serialization.Model): +class ManagedClusterWindowsProfile(_serialization.Model): """Profile for Windows VMs in the container service cluster. All required parameters must be populated in order to send to Azure. - :ivar admin_username: Required. Specifies the name of the administrator account. - :code:`
`:code:`
` **restriction:** Cannot end in "." :code:`
`:code:`
` - **Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", "test1", - "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", - "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", - "sys", "test2", "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 - character :code:`
`:code:`
` **Max-length:** 20 characters. + :ivar admin_username: Specifies the name of the administrator account. :code:`
`:code:`
` + **restriction:** Cannot end in "." :code:`
`:code:`
` **Disallowed values:** + "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", + "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", + "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", + "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 character + :code:`
`:code:`
` **Max-length:** 20 characters. Required. :vartype admin_username: str :ivar admin_password: Specifies the password of the administrator account. :code:`
`:code:`
` **Minimum-length:** 8 characters :code:`
`:code:`
` @@ -2645,29 +2579,23 @@ class ManagedClusterWindowsProfile(msrest.serialization.Model): """ _validation = { - 'admin_username': {'required': True}, + "admin_username": {"required": True}, } _attribute_map = { - 'admin_username': {'key': 'adminUsername', 'type': 'str'}, - 'admin_password': {'key': 'adminPassword', 'type': 'str'}, + "admin_username": {"key": "adminUsername", "type": "str"}, + "admin_password": {"key": "adminPassword", "type": "str"}, } - def __init__( - self, - *, - admin_username: str, - admin_password: Optional[str] = None, - **kwargs - ): + def __init__(self, *, admin_username: str, admin_password: Optional[str] = None, **kwargs): """ - :keyword admin_username: Required. Specifies the name of the administrator account. + :keyword admin_username: Specifies the name of the administrator account. :code:`
`:code:`
` **restriction:** Cannot end in "." :code:`
`:code:`
` **Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 - character :code:`
`:code:`
` **Max-length:** 20 characters. + character :code:`
`:code:`
` **Max-length:** 20 characters. Required. :paramtype admin_username: str :keyword admin_password: Specifies the password of the administrator account. :code:`
`:code:`
` **Minimum-length:** 8 characters :code:`
`:code:`
` @@ -2678,12 +2606,12 @@ def __init__( "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!". :paramtype admin_password: str """ - super(ManagedClusterWindowsProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.admin_username = admin_username self.admin_password = admin_password -class OperationListResult(msrest.serialization.Model): +class OperationListResult(_serialization.Model): """The List Compute Operation operation response. Variables are only populated by the server, and will be ignored when sending a request. @@ -2693,24 +2621,20 @@ class OperationListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[OperationValue]'}, + "value": {"key": "value", "type": "[OperationValue]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(OperationListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None -class OperationValue(msrest.serialization.Model): +class OperationValue(_serialization.Model): """Describes the properties of a Compute Operation value. Variables are only populated by the server, and will be ignored when sending a request. @@ -2730,30 +2654,26 @@ class OperationValue(msrest.serialization.Model): """ _validation = { - 'origin': {'readonly': True}, - 'name': {'readonly': True}, - 'operation': {'readonly': True}, - 'resource': {'readonly': True}, - 'description': {'readonly': True}, - 'provider': {'readonly': True}, + "origin": {"readonly": True}, + "name": {"readonly": True}, + "operation": {"readonly": True}, + "resource": {"readonly": True}, + "description": {"readonly": True}, + "provider": {"readonly": True}, } _attribute_map = { - 'origin': {'key': 'origin', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'operation': {'key': 'display.operation', 'type': 'str'}, - 'resource': {'key': 'display.resource', 'type': 'str'}, - 'description': {'key': 'display.description', 'type': 'str'}, - 'provider': {'key': 'display.provider', 'type': 'str'}, + "origin": {"key": "origin", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "operation": {"key": "display.operation", "type": "str"}, + "resource": {"key": "display.resource", "type": "str"}, + "description": {"key": "display.description", "type": "str"}, + "provider": {"key": "display.provider", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(OperationValue, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.origin = None self.name = None self.operation = None @@ -2762,7 +2682,7 @@ def __init__( self.provider = None -class ResourceReference(msrest.serialization.Model): +class ResourceReference(_serialization.Model): """A reference to an Azure resource. :ivar id: The fully qualified Azure resource id. @@ -2770,43 +2690,33 @@ class ResourceReference(msrest.serialization.Model): """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, } - def __init__( - self, - *, - id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin """ :keyword id: The fully qualified Azure resource id. :paramtype id: str """ - super(ResourceReference, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id -class TagsObject(msrest.serialization.Model): +class TagsObject(_serialization.Model): """Tags object for patch operations. - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] """ _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] """ - super(TagsObject, self).__init__(**kwargs) + super().__init__(**kwargs) self.tags = tags diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/models/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/models/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/models/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/models/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/operations/__init__.py index 403c0174f052..ee6608454b6b 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/operations/__init__.py @@ -13,10 +13,11 @@ from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'Operations', - 'ManagedClustersOperations', - 'AgentPoolsOperations', + "Operations", + "ManagedClustersOperations", + "AgentPoolsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/operations/_agent_pools_operations.py index d2d41d58e55e..5b54729dcf53 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/operations/_agent_pools_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,249 +27,250 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - *, - json: Optional[_models.AgentPool] = None, - content: Any = None, - **kwargs: Any + _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, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + _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, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_get_upgrade_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_available_agent_pool_versions_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class AgentPoolsOperations: """ @@ -285,48 +291,40 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> Iterable[_models.AgentPoolListResult]: + def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> Iterable["_models.AgentPool"]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. The operation returns properties of each agent pool. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AgentPoolListResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2019_11_01.models.AgentPoolListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either AgentPool or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2019_11_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -334,16 +332,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -359,10 +352,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -372,54 +363,45 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore @distributed_trace def get( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPool: """Gets the agent pool. Gets the details of the agent pool by managed cluster and resource group. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPool, or the result of cls(response) + :return: AgentPool or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_11_01.models.AgentPool - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -427,57 +409,60 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore def _create_or_update_initial( self, resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: _models.AgentPool, + parameters: Union[_models.AgentPool, IO], **kwargs: Any ) -> _models.AgentPool: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - _json = self._serialize.body(parameters, 'AgentPool') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "AgentPool") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -485,10 +470,9 @@ def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -496,40 +480,86 @@ def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - - @distributed_trace + @overload def begin_create_or_update( self, resource_group_name: str, resource_name: str, agent_pool_name: str, parameters: _models.AgentPool, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.AgentPool]: """Creates or updates an agent pool. Creates or updates an agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :param parameters: Parameters supplied to the Create or Update an agent pool operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2019_11_01.models.AgentPool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2019_11_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AgentPool]: + """Creates or updates an agent pool. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: Parameters supplied to the Create or Update an agent pool operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -541,20 +571,56 @@ def begin_create_or_update( :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2019_11_01.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: Union[_models.AgentPool, IO], + **kwargs: Any + ) -> LROPoller[_models.AgentPool]: + """Creates or updates an agent pool. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: Parameters supplied to the Create or Update an agent pool operation. Is + either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2019_11_01.models.AgentPool or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2019_11_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -563,66 +629,55 @@ def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -630,10 +685,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -643,26 +697,21 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + def begin_delete( + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> LROPoller[None]: """Deletes an agent pool. Deletes the agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -674,100 +723,86 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPoolUpgradeProfile: """Gets upgrade profile for an agent pool. Gets the details of the upgrade profile for an agent pool with a specified resource group and managed cluster name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolUpgradeProfile, or the result of cls(response) + :return: AgentPoolUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_11_01.models.AgentPoolUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -775,64 +810,56 @@ def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolUpgradeProfile', pipeline_response) + deserialized = self._deserialize("AgentPoolUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore @distributed_trace def get_available_agent_pool_versions( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported versions for the specified agent pool. Gets a list of supported versions for the specified agent pool. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolAvailableVersions, or the result of cls(response) + :return: AgentPoolAvailableVersions or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_11_01.models.AgentPoolAvailableVersions - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolAvailableVersions] - request = build_get_available_agent_pool_versions_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_available_agent_pool_versions.metadata['url'], + template_url=self.get_available_agent_pool_versions.metadata["url"], headers=_headers, params=_params, ) @@ -840,22 +867,20 @@ def get_available_agent_pool_versions( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolAvailableVersions', pipeline_response) + deserialized = self._deserialize("AgentPoolAvailableVersions", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_available_agent_pool_versions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore - + get_available_agent_pool_versions.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/operations/_managed_clusters_operations.py index db962d360131..a2bb9d06f7ed 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/operations/_managed_clusters_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,557 +27,536 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters") + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters" + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_resource_group_request( - subscription_id: str, - resource_group_name: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters", + ) # 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', min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_upgrade_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_access_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, role_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 = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "roleName": _SERIALIZER.url("role_name", role_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "roleName": _SERIALIZER.url("role_name", role_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_admin_credentials_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_user_credentials_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_monitoring_user_credentials_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: + +def build_get_request(resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedCluster] = None, - content: Any = None, - **kwargs: Any +def build_create_or_update_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_update_tags_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.TagsObject] = None, - content: Any = None, - **kwargs: Any + +def build_update_tags_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + +def build_delete_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_reset_service_principal_profile_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedClusterServicePrincipalProfile] = None, - content: Any = None, - **kwargs: Any + +def build_reset_service_principal_profile_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_reset_aad_profile_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedClusterAADProfile] = None, - content: Any = None, - **kwargs: Any +def build_reset_aad_profile_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_rotate_cluster_certificates_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any +def build_rotate_cluster_certificates_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + class ManagedClustersOperations: """ @@ -593,41 +577,35 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.ManagedClusterListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.ManagedCluster"]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. The operation returns properties of each managed cluster. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2019_11_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2019_11_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -635,14 +613,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -658,10 +633,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -671,50 +644,42 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> Iterable[_models.ManagedClusterListResult]: + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.ManagedCluster"]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. The operation returns properties of each managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2019_11_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2019_11_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -722,15 +687,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -746,10 +707,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -759,51 +718,43 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.ManagedClusterUpgradeProfile: """Gets upgrade profile for a managed cluster. Gets the details of the upgrade profile for a managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterUpgradeProfile, or the result of cls(response) + :return: ManagedClusterUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_11_01.models.ManagedClusterUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -811,69 +762,60 @@ def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterUpgradeProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore @distributed_trace def get_access_profile( - self, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, role_name: str, **kwargs: Any ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. Gets the accessProfile for the specified role name of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param role_name: The name of the role for managed cluster accessProfile resource. + :param role_name: The name of the role for managed cluster accessProfile resource. Required. :type role_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterAccessProfile, or the result of cls(response) + :return: ManagedClusterAccessProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_11_01.models.ManagedClusterAccessProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterAccessProfile] - request = build_get_access_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, role_name=role_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_access_profile.metadata['url'], + template_url=self.get_access_profile.metadata["url"], headers=_headers, params=_params, ) @@ -881,64 +823,56 @@ def get_access_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterAccessProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterAccessProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_access_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore - + get_access_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore @distributed_trace def list_cluster_admin_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster admin credential of a managed cluster. Gets cluster admin credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_11_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_admin_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_admin_credentials.metadata['url'], + template_url=self.list_cluster_admin_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -946,64 +880,56 @@ def list_cluster_admin_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_admin_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore - + list_cluster_admin_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore @distributed_trace def list_cluster_user_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster user credential of a managed cluster. Gets cluster user credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_11_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_user_credentials.metadata['url'], + template_url=self.list_cluster_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -1011,65 +937,57 @@ def list_cluster_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore - + list_cluster_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore @distributed_trace def list_cluster_monitoring_user_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster monitoring user credential of a managed cluster. Gets cluster monitoring user credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_11_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_monitoring_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + template_url=self.list_cluster_monitoring_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -1077,64 +995,54 @@ def list_cluster_monitoring_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_monitoring_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore - + list_cluster_monitoring_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore @distributed_trace - def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.ManagedCluster: + def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.ManagedCluster: """Gets a managed cluster. Gets the details of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedCluster, or the result of cls(response) + :return: ManagedCluster or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2019_11_01.models.ManagedCluster - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -1142,55 +1050,54 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _create_or_update_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.ManagedCluster, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'ManagedCluster') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedCluster") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1198,10 +1105,9 @@ def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -1209,25 +1115,26 @@ def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - @distributed_trace + @overload def begin_create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedCluster, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. @@ -1235,12 +1142,16 @@ def begin_create_or_update( Creates or updates a managed cluster with the specified configuration for agents and Kubernetes version. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2019_11_01.models.ManagedCluster + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1253,20 +1164,91 @@ def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2019_11_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster with the specified configuration for agents and Kubernetes + version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2019_11_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster with the specified configuration for agents and Kubernetes + version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. Is + either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2019_11_01.models.ManagedCluster or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2019_11_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -1274,69 +1256,66 @@ def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _update_tags_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.TagsObject, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request_initial( - subscription_id=self._config.subscription_id, + request = build_update_tags_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_tags_initial.metadata['url'], + content=_content, + template_url=self._update_tags_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1344,44 +1323,118 @@ def _update_tags_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_tags_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _update_tags_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - @distributed_trace + @overload def begin_update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates a managed cluster with the specified tags. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2019_11_01.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2019_11_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates a managed cluster with the specified tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2019_11_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates a managed cluster with the specified tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2019_11_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1394,20 +1447,17 @@ def begin_update_tags( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2019_11_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, @@ -1415,64 +1465,54 @@ def begin_update_tags( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1480,10 +1520,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1493,23 +1532,17 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> LROPoller[None]: + def begin_delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> LROPoller[None]: """Deletes a managed cluster. Deletes the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1521,85 +1554,83 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterServicePrincipalProfile, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterServicePrincipalProfile") - request = build_reset_service_principal_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_service_principal_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_service_principal_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_service_principal_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1607,10 +1638,9 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1620,29 +1650,106 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re if cls: return cls(pipeline_response, None, {}) - _reset_service_principal_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore - + _reset_service_principal_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore - @distributed_trace - def begin_reset_service_principal_profile( # pylint: disable=inconsistent-return-statements + @overload + def begin_reset_service_principal_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterServicePrincipalProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: """Reset Service Principal Profile of a managed cluster. Update the service principal Profile for a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a - Managed Cluster. + Managed Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2019_11_01.models.ManagedClusterServicePrincipalProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reset Service Principal Profile of a managed cluster. + + Update the service principal Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a + Managed Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Reset Service Principal Profile of a managed cluster. + + Update the service principal Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a + Managed Cluster. Is either a model type or a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2019_11_01.models.ManagedClusterServicePrincipalProfile or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1653,20 +1760,17 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1674,67 +1778,68 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_service_principal_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + begin_reset_service_principal_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterAADProfile, + parameters: Union[_models.ManagedClusterAADProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterAADProfile") - request = build_reset_aad_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_aad_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_aad_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_aad_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1742,10 +1847,9 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1755,28 +1859,32 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement if cls: return cls(pipeline_response, None, {}) - _reset_aad_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - + _reset_aad_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - @distributed_trace - def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements + @overload + def begin_reset_aad_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterAADProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: """Reset AAD Profile of a managed cluster. Update the AAD Profile for a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed - Cluster. + Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2019_11_01.models.ManagedClusterAADProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1787,20 +1895,90 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reset AAD Profile of a managed cluster. + + Update the AAD Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed + Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterAADProfile, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Reset AAD Profile of a managed cluster. + + Update the AAD Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed + Cluster. Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2019_11_01.models.ManagedClusterAADProfile or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1808,62 +1986,52 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_aad_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + begin_reset_aad_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_rotate_cluster_certificates_request_initial( - subscription_id=self._config.subscription_id, + request = build_rotate_cluster_certificates_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._rotate_cluster_certificates_initial.metadata['url'], + template_url=self._rotate_cluster_certificates_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1871,10 +2039,9 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1884,23 +2051,19 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return if cls: return cls(pipeline_response, None, {}) - _rotate_cluster_certificates_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore - + _rotate_cluster_certificates_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore @distributed_trace - def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + def begin_rotate_cluster_certificates( + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> LROPoller[None]: """Rotate certificates of a managed cluster. Rotate certificates of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1912,52 +2075,45 @@ def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-st Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._rotate_cluster_certificates_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_rotate_cluster_certificates.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore + begin_rotate_cluster_certificates.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/operations/_operations.py index 37606e5d60f1..a54a1d4b246b 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/operations/_operations.py @@ -7,10 +7,15 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,38 +25,34 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - **kwargs: Any -) -> HttpRequest: + +def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.ContainerService/operations") # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class Operations: """ @@ -72,36 +73,31 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.OperationListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.OperationValue"]: """Gets a list of compute operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationListResult or the result of cls(response) + :return: An iterator like instance of either OperationValue or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2019_11_01.models.OperationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2019_11_01.models.OperationValue] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -109,13 +105,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -131,10 +125,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -144,8 +136,6 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.ContainerService/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ContainerService/operations"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/operations/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/__init__.py index 37a5f9e02e6f..a8716d29afe8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/__init__.py @@ -14,7 +14,8 @@ except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['ContainerServiceClient'] + +__all__ = ["ContainerServiceClient"] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/_configuration.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/_configuration.py index 963f78b10529..f0539bf3eb3e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/_configuration.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/_configuration.py @@ -18,30 +18,26 @@ VERSION = "unknown" + class ContainerServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ContainerServiceClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2020-01-01". 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: + def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ContainerServiceClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2020-01-01") # type: str + api_version = kwargs.pop("api_version", "2020-01-01") # type: str if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -51,23 +47,24 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-containerservice/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-containerservice/{}".format(VERSION)) self._configure(**kwargs) def _configure( - self, - **kwargs # type: Any + self, **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/_container_service_client.py index acd9735116d1..20e75e3b68d1 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/_container_service_client.py @@ -9,12 +9,11 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from . import models +from .._serialization import Deserializer, Serializer from ._configuration import ContainerServiceClientConfiguration from .operations import AgentPoolsOperations, ManagedClustersOperations, Operations @@ -22,7 +21,8 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class ContainerServiceClient: + +class ContainerServiceClient: # pylint: disable=client-accepts-api-version-keyword """The Container Service Client. :ivar operations: Operations operations @@ -32,10 +32,10 @@ class ContainerServiceClient: azure.mgmt.containerservice.v2020_01_01.operations.ManagedClustersOperations :ivar agent_pools: AgentPoolsOperations operations :vartype agent_pools: azure.mgmt.containerservice.v2020_01_01.operations.AgentPoolsOperations - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -53,29 +53,22 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = ContainerServiceClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = ContainerServiceClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize - ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.managed_clusters = ManagedClustersOperations( self._client, self._config, self._serialize, self._deserialize ) - self.agent_pools = AgentPoolsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - + self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> HttpResponse: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -84,7 +77,7 @@ def _send_request( >>> response = client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/_metadata.json b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/_metadata.json index 8a1c81fa64b4..50ec370387c9 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/_metadata.json +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/_metadata.json @@ -10,20 +10,20 @@ "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { "credential": { - "signature": "credential, # type: \"TokenCredential\"", - "description": "Credential needed for the client to connect to Azure.", + "signature": "credential: \"TokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true }, "subscription_id": { - "signature": "subscription_id, # type: str", - "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "signature": "subscription_id: str,", + "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.", "docstring_type": "str", "required": true } @@ -31,13 +31,13 @@ "async": { "credential": { "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure.", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { "signature": "subscription_id: str,", - "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.", "docstring_type": "str", "required": true } @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=\"https://management.azure.com\", # type: str", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/_patch.py index 74e48ecd07cf..f99e77fef986 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/_patch.py @@ -28,4 +28,4 @@ # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + pass diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/_vendor.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/_vendor.py index 138f663c53a4..9aad73fc743e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/_vendor.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/_vendor.py @@ -7,6 +7,7 @@ from azure.core.pipeline.transport import HttpRequest + def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) @@ -14,6 +15,7 @@ def _convert_request(request, files=None): request.set_formdata_body(files) return request + def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -21,7 +23,5 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [ - c for c in formatted_components if "{}".format(key.args[0]) not in c - ] + components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/aio/__init__.py index 37a5f9e02e6f..a8716d29afe8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/aio/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/aio/__init__.py @@ -14,7 +14,8 @@ except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['ContainerServiceClient'] + +__all__ = ["ContainerServiceClient"] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/aio/_configuration.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/aio/_configuration.py index 3f5d6bcdd8f7..9f0f1b9ae264 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/aio/_configuration.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/aio/_configuration.py @@ -18,30 +18,26 @@ VERSION = "unknown" + class ContainerServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ContainerServiceClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2020-01-01". 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: + def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ContainerServiceClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2020-01-01") # type: str + api_version = kwargs.pop("api_version", "2020-01-01") # type: str if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -51,22 +47,21 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-containerservice/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-containerservice/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, - **kwargs: Any - ) -> None: - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/aio/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/aio/_container_service_client.py index 86ef60fc8346..290ee64a450c 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/aio/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/aio/_container_service_client.py @@ -9,12 +9,11 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from .. import models +from ..._serialization import Deserializer, Serializer from ._configuration import ContainerServiceClientConfiguration from .operations import AgentPoolsOperations, ManagedClustersOperations, Operations @@ -22,7 +21,8 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class ContainerServiceClient: + +class ContainerServiceClient: # pylint: disable=client-accepts-api-version-keyword """The Container Service Client. :ivar operations: Operations operations @@ -33,10 +33,10 @@ class ContainerServiceClient: :ivar agent_pools: AgentPoolsOperations operations :vartype agent_pools: azure.mgmt.containerservice.v2020_01_01.aio.operations.AgentPoolsOperations - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -54,29 +54,22 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = ContainerServiceClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = ContainerServiceClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize - ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.managed_clusters = ManagedClustersOperations( self._client, self._config, self._serialize, self._deserialize ) - self.agent_pools = AgentPoolsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - + self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -85,7 +78,7 @@ def _send_request( >>> response = await client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/aio/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/aio/_patch.py index 74e48ecd07cf..f99e77fef986 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/aio/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/aio/_patch.py @@ -28,4 +28,4 @@ # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + pass diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/aio/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/aio/operations/__init__.py index 403c0174f052..ee6608454b6b 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/aio/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/aio/operations/__init__.py @@ -13,10 +13,11 @@ from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'Operations', - 'ManagedClustersOperations', - 'AgentPoolsOperations', + "Operations", + "ManagedClustersOperations", + "AgentPoolsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/aio/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/aio/operations/_agent_pools_operations.py index 4727d9943df1..f3d54051c4e5 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/aio/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/aio/operations/_agent_pools_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +29,19 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._agent_pools_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_available_agent_pool_versions_request, build_get_request, build_get_upgrade_profile_request, build_list_request -T = TypeVar('T') +from ...operations._agent_pools_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_available_agent_pool_versions_request, + build_get_request, + build_get_upgrade_profile_request, + build_list_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class AgentPoolsOperations: """ .. warning:: @@ -45,48 +61,41 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.AgentPoolListResult]: + def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncIterable["_models.AgentPool"]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. The operation returns properties of each agent pool. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AgentPoolListResult or the result of cls(response) + :return: An iterator like instance of either AgentPool or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_01_01.models.AgentPoolListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_01_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -94,16 +103,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -119,10 +123,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -132,54 +134,45 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore @distributed_trace_async async def get( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPool: """Gets the agent pool. Gets the details of the agent pool by managed cluster and resource group. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPool, or the result of cls(response) + :return: AgentPool or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_01_01.models.AgentPool - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -187,57 +180,60 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore async def _create_or_update_initial( self, resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: _models.AgentPool, + parameters: Union[_models.AgentPool, IO], **kwargs: Any ) -> _models.AgentPool: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - _json = self._serialize.body(parameters, 'AgentPool') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "AgentPool") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -245,10 +241,9 @@ async def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -256,40 +251,45 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - - @distributed_trace_async + @overload async def begin_create_or_update( self, resource_group_name: str, resource_name: str, agent_pool_name: str, parameters: _models.AgentPool, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.AgentPool]: """Creates or updates an agent pool. Creates or updates an agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :param parameters: Parameters supplied to the Create or Update an agent pool operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2020_01_01.models.AgentPool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -302,20 +302,99 @@ async def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_01_01.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AgentPool]: + """Creates or updates an agent pool. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: Parameters supplied to the Create or Update an agent pool operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AgentPool or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_01_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: Union[_models.AgentPool, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.AgentPool]: + """Creates or updates an agent pool. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: Parameters supplied to the Create or Update an agent pool operation. Is + either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2020_01_01.models.AgentPool or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AgentPool or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_01_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -324,66 +403,55 @@ async def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -391,10 +459,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -404,26 +471,21 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + async def begin_delete( + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes an agent pool. Deletes the agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -435,100 +497,86 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace_async async def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPoolUpgradeProfile: """Gets upgrade profile for an agent pool. Gets the details of the upgrade profile for an agent pool with a specified resource group and managed cluster name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolUpgradeProfile, or the result of cls(response) + :return: AgentPoolUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_01_01.models.AgentPoolUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -536,64 +584,56 @@ async def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolUpgradeProfile', pipeline_response) + deserialized = self._deserialize("AgentPoolUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore @distributed_trace_async async def get_available_agent_pool_versions( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported versions for the specified agent pool. Gets a list of supported versions for the specified agent pool. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolAvailableVersions, or the result of cls(response) + :return: AgentPoolAvailableVersions or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_01_01.models.AgentPoolAvailableVersions - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolAvailableVersions] - request = build_get_available_agent_pool_versions_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_available_agent_pool_versions.metadata['url'], + template_url=self.get_available_agent_pool_versions.metadata["url"], headers=_headers, params=_params, ) @@ -601,22 +641,20 @@ async def get_available_agent_pool_versions( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolAvailableVersions', pipeline_response) + deserialized = self._deserialize("AgentPoolAvailableVersions", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_available_agent_pool_versions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore - + get_available_agent_pool_versions.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/aio/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/aio/operations/_managed_clusters_operations.py index 848351e472fc..0ed00a0cfc02 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/aio/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/aio/operations/_managed_clusters_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +29,27 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._managed_clusters_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_access_profile_request, build_get_request, build_get_upgrade_profile_request, build_list_by_resource_group_request, build_list_cluster_admin_credentials_request, build_list_cluster_monitoring_user_credentials_request, build_list_cluster_user_credentials_request, build_list_request, build_reset_aad_profile_request_initial, build_reset_service_principal_profile_request_initial, build_rotate_cluster_certificates_request_initial, build_update_tags_request_initial -T = TypeVar('T') +from ...operations._managed_clusters_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_access_profile_request, + build_get_request, + build_get_upgrade_profile_request, + build_list_by_resource_group_request, + build_list_cluster_admin_credentials_request, + build_list_cluster_monitoring_user_credentials_request, + build_list_cluster_user_credentials_request, + build_list_request, + build_reset_aad_profile_request, + build_reset_service_principal_profile_request, + build_rotate_cluster_certificates_request, + build_update_tags_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class ManagedClustersOperations: """ .. warning:: @@ -45,41 +69,35 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.ManagedClusterListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.ManagedCluster"]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. The operation returns properties of each managed cluster. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_01_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_01_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -87,14 +105,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -110,10 +125,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -123,50 +136,44 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.ManagedClusterListResult]: + self, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ManagedCluster"]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. The operation returns properties of each managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_01_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_01_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -174,15 +181,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -198,10 +201,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -211,51 +212,43 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace_async async def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.ManagedClusterUpgradeProfile: """Gets upgrade profile for a managed cluster. Gets the details of the upgrade profile for a managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterUpgradeProfile, or the result of cls(response) + :return: ManagedClusterUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_01_01.models.ManagedClusterUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -263,69 +256,60 @@ async def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterUpgradeProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore @distributed_trace_async async def get_access_profile( - self, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, role_name: str, **kwargs: Any ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. Gets the accessProfile for the specified role name of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param role_name: The name of the role for managed cluster accessProfile resource. + :param role_name: The name of the role for managed cluster accessProfile resource. Required. :type role_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterAccessProfile, or the result of cls(response) + :return: ManagedClusterAccessProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_01_01.models.ManagedClusterAccessProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterAccessProfile] - request = build_get_access_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, role_name=role_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_access_profile.metadata['url'], + template_url=self.get_access_profile.metadata["url"], headers=_headers, params=_params, ) @@ -333,64 +317,56 @@ async def get_access_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterAccessProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterAccessProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_access_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore - + get_access_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore @distributed_trace_async async def list_cluster_admin_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster admin credential of a managed cluster. Gets cluster admin credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_01_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_admin_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_admin_credentials.metadata['url'], + template_url=self.list_cluster_admin_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -398,64 +374,56 @@ async def list_cluster_admin_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_admin_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore - + list_cluster_admin_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore @distributed_trace_async async def list_cluster_user_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster user credential of a managed cluster. Gets cluster user credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_01_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_user_credentials.metadata['url'], + template_url=self.list_cluster_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -463,65 +431,57 @@ async def list_cluster_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore - + list_cluster_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore @distributed_trace_async async def list_cluster_monitoring_user_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster monitoring user credential of a managed cluster. Gets cluster monitoring user credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_01_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_monitoring_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + template_url=self.list_cluster_monitoring_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -529,64 +489,54 @@ async def list_cluster_monitoring_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_monitoring_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore - + list_cluster_monitoring_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore @distributed_trace_async - async def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.ManagedCluster: + async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.ManagedCluster: """Gets a managed cluster. Gets the details of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedCluster, or the result of cls(response) + :return: ManagedCluster or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_01_01.models.ManagedCluster - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -594,55 +544,54 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _create_or_update_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.ManagedCluster, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'ManagedCluster') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedCluster") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -650,10 +599,9 @@ async def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -661,25 +609,26 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - @distributed_trace_async + @overload async def begin_create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedCluster, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. @@ -687,12 +636,90 @@ async def begin_create_or_update( Creates or updates a managed cluster with the specified configuration for agents and Kubernetes version. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2020_01_01.models.ManagedCluster + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_01_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster with the specified configuration for agents and Kubernetes + version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_01_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster with the specified configuration for agents and Kubernetes + version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. Is + either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2020_01_01.models.ManagedCluster or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -705,20 +732,17 @@ async def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_01_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -726,69 +750,66 @@ async def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _update_tags_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.TagsObject, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request_initial( - subscription_id=self._config.subscription_id, + request = build_update_tags_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_tags_initial.metadata['url'], + content=_content, + template_url=self._update_tags_initial.metadata["url"], headers=_headers, params=_params, ) @@ -796,44 +817,85 @@ async def _update_tags_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_tags_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _update_tags_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - @distributed_trace_async + @overload async def begin_update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates a managed cluster with the specified tags. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2020_01_01.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_01_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates a managed cluster with the specified tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -846,20 +908,50 @@ async def begin_update_tags( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_01_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates a managed cluster with the specified tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2020_01_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_01_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, @@ -867,64 +959,54 @@ async def begin_update_tags( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -932,10 +1014,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -945,23 +1026,17 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: + async def begin_delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Deletes a managed cluster. Deletes the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -973,85 +1048,83 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterServicePrincipalProfile, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterServicePrincipalProfile") - request = build_reset_service_principal_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_service_principal_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_service_principal_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_service_principal_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1059,10 +1132,9 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1072,29 +1144,106 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist if cls: return cls(pipeline_response, None, {}) - _reset_service_principal_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore - + _reset_service_principal_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore - @distributed_trace_async - async def begin_reset_service_principal_profile( # pylint: disable=inconsistent-return-statements + @overload + async def begin_reset_service_principal_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterServicePrincipalProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: """Reset Service Principal Profile of a managed cluster. Update the service principal Profile for a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a - Managed Cluster. + Managed Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2020_01_01.models.ManagedClusterServicePrincipalProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset Service Principal Profile of a managed cluster. + + Update the service principal Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a + Managed Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset Service Principal Profile of a managed cluster. + + Update the service principal Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a + Managed Cluster. Is either a model type or a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2020_01_01.models.ManagedClusterServicePrincipalProfile or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -1105,20 +1254,17 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1126,67 +1272,68 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_service_principal_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + begin_reset_service_principal_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterAADProfile, + parameters: Union[_models.ManagedClusterAADProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterAADProfile") - request = build_reset_aad_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_aad_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_aad_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_aad_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1194,10 +1341,9 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1207,28 +1353,69 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta if cls: return cls(pipeline_response, None, {}) - _reset_aad_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - + _reset_aad_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - @distributed_trace_async - async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements + @overload + async def begin_reset_aad_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterAADProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: """Reset AAD Profile of a managed cluster. Update the AAD Profile for a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed - Cluster. + Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2020_01_01.models.ManagedClusterAADProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset AAD Profile of a managed cluster. + + Update the AAD Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed + Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -1239,20 +1426,53 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterAADProfile, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset AAD Profile of a managed cluster. + + Update the AAD Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed + Cluster. Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2020_01_01.models.ManagedClusterAADProfile or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1260,62 +1480,52 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_aad_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + begin_reset_aad_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_rotate_cluster_certificates_request_initial( - subscription_id=self._config.subscription_id, + request = build_rotate_cluster_certificates_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._rotate_cluster_certificates_initial.metadata['url'], + template_url=self._rotate_cluster_certificates_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1323,10 +1533,9 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1336,23 +1545,19 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- if cls: return cls(pipeline_response, None, {}) - _rotate_cluster_certificates_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore - + _rotate_cluster_certificates_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore @distributed_trace_async - async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + async def begin_rotate_cluster_certificates( + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Rotate certificates of a managed cluster. Rotate certificates of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1364,52 +1569,45 @@ async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-ret Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._rotate_cluster_certificates_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_rotate_cluster_certificates.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore + begin_rotate_cluster_certificates.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/aio/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/aio/operations/_operations.py index 389ef366ace5..67cc938bd358 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/aio/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/aio/operations/_operations.py @@ -7,9 +7,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,9 +27,11 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._operations import build_list_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class Operations: """ .. warning:: @@ -42,36 +51,31 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.OperationListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.OperationValue"]: """Gets a list of compute operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationListResult or the result of cls(response) + :return: An iterator like instance of either OperationValue or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_01_01.models.OperationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_01_01.models.OperationValue] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -79,13 +83,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -101,10 +103,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -114,8 +114,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.ContainerService/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ContainerService/operations"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/aio/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/aio/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/aio/operations/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/aio/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/models/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/models/__init__.py index 1a970d9d5e41..0b20e05faf3b 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/models/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/models/__init__.py @@ -50,80 +50,78 @@ from ._models_py3 import TagsObject from ._models_py3 import UserAssignedIdentity - -from ._container_service_client_enums import ( - AgentPoolType, - ContainerServiceStorageProfileTypes, - ContainerServiceVMSizeTypes, - Count, - LoadBalancerSku, - NetworkPlugin, - NetworkPolicy, - OSType, - OutboundType, - ResourceIdentityType, - ScaleSetEvictionPolicy, - ScaleSetPriority, -) +from ._container_service_client_enums import AgentPoolType +from ._container_service_client_enums import ContainerServiceStorageProfileTypes +from ._container_service_client_enums import ContainerServiceVMSizeTypes +from ._container_service_client_enums import Count +from ._container_service_client_enums import LoadBalancerSku +from ._container_service_client_enums import NetworkPlugin +from ._container_service_client_enums import NetworkPolicy +from ._container_service_client_enums import OSType +from ._container_service_client_enums import OutboundType +from ._container_service_client_enums import ResourceIdentityType +from ._container_service_client_enums import ScaleSetEvictionPolicy +from ._container_service_client_enums import ScaleSetPriority from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'AgentPool', - 'AgentPoolAvailableVersions', - 'AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem', - 'AgentPoolListResult', - 'AgentPoolUpgradeProfile', - 'AgentPoolUpgradeProfilePropertiesUpgradesItem', - 'CloudErrorBody', - 'ContainerServiceDiagnosticsProfile', - 'ContainerServiceLinuxProfile', - 'ContainerServiceMasterProfile', - 'ContainerServiceNetworkProfile', - 'ContainerServiceSshConfiguration', - 'ContainerServiceSshPublicKey', - 'ContainerServiceVMDiagnostics', - 'CredentialResult', - 'CredentialResults', - 'ManagedCluster', - 'ManagedClusterAADProfile', - 'ManagedClusterAPIServerAccessProfile', - 'ManagedClusterAccessProfile', - 'ManagedClusterAddonProfile', - 'ManagedClusterAddonProfileIdentity', - 'ManagedClusterAgentPoolProfile', - 'ManagedClusterAgentPoolProfileProperties', - 'ManagedClusterIdentity', - 'ManagedClusterListResult', - 'ManagedClusterLoadBalancerProfile', - 'ManagedClusterLoadBalancerProfileManagedOutboundIPs', - 'ManagedClusterLoadBalancerProfileOutboundIPPrefixes', - 'ManagedClusterLoadBalancerProfileOutboundIPs', - 'ManagedClusterPoolUpgradeProfile', - 'ManagedClusterPoolUpgradeProfileUpgradesItem', - 'ManagedClusterPropertiesIdentityProfileValue', - 'ManagedClusterServicePrincipalProfile', - 'ManagedClusterUpgradeProfile', - 'ManagedClusterWindowsProfile', - 'OperationListResult', - 'OperationValue', - 'Resource', - 'ResourceReference', - 'SubResource', - 'TagsObject', - 'UserAssignedIdentity', - 'AgentPoolType', - 'ContainerServiceStorageProfileTypes', - 'ContainerServiceVMSizeTypes', - 'Count', - 'LoadBalancerSku', - 'NetworkPlugin', - 'NetworkPolicy', - 'OSType', - 'OutboundType', - 'ResourceIdentityType', - 'ScaleSetEvictionPolicy', - 'ScaleSetPriority', + "AgentPool", + "AgentPoolAvailableVersions", + "AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem", + "AgentPoolListResult", + "AgentPoolUpgradeProfile", + "AgentPoolUpgradeProfilePropertiesUpgradesItem", + "CloudErrorBody", + "ContainerServiceDiagnosticsProfile", + "ContainerServiceLinuxProfile", + "ContainerServiceMasterProfile", + "ContainerServiceNetworkProfile", + "ContainerServiceSshConfiguration", + "ContainerServiceSshPublicKey", + "ContainerServiceVMDiagnostics", + "CredentialResult", + "CredentialResults", + "ManagedCluster", + "ManagedClusterAADProfile", + "ManagedClusterAPIServerAccessProfile", + "ManagedClusterAccessProfile", + "ManagedClusterAddonProfile", + "ManagedClusterAddonProfileIdentity", + "ManagedClusterAgentPoolProfile", + "ManagedClusterAgentPoolProfileProperties", + "ManagedClusterIdentity", + "ManagedClusterListResult", + "ManagedClusterLoadBalancerProfile", + "ManagedClusterLoadBalancerProfileManagedOutboundIPs", + "ManagedClusterLoadBalancerProfileOutboundIPPrefixes", + "ManagedClusterLoadBalancerProfileOutboundIPs", + "ManagedClusterPoolUpgradeProfile", + "ManagedClusterPoolUpgradeProfileUpgradesItem", + "ManagedClusterPropertiesIdentityProfileValue", + "ManagedClusterServicePrincipalProfile", + "ManagedClusterUpgradeProfile", + "ManagedClusterWindowsProfile", + "OperationListResult", + "OperationValue", + "Resource", + "ResourceReference", + "SubResource", + "TagsObject", + "UserAssignedIdentity", + "AgentPoolType", + "ContainerServiceStorageProfileTypes", + "ContainerServiceVMSizeTypes", + "Count", + "LoadBalancerSku", + "NetworkPlugin", + "NetworkPolicy", + "OSType", + "OutboundType", + "ResourceIdentityType", + "ScaleSetEvictionPolicy", + "ScaleSetPriority", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/models/_container_service_client_enums.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/models/_container_service_client_enums.py index 137bd739161e..3d7566ee27b4 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/models/_container_service_client_enums.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/models/_container_service_client_enums.py @@ -11,12 +11,12 @@ class AgentPoolType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """AgentPoolType represents types of an agent pool. - """ + """AgentPoolType represents types of an agent pool.""" VIRTUAL_MACHINE_SCALE_SETS = "VirtualMachineScaleSets" AVAILABILITY_SET = "AvailabilitySet" + class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the orchestrator choice. @@ -25,9 +25,9 @@ class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEn STORAGE_ACCOUNT = "StorageAccount" MANAGED_DISKS = "ManagedDisks" + class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Size of agent VMs. - """ + """Size of agent VMs.""" STANDARD_A1 = "Standard_A1" STANDARD_A10 = "Standard_A10" @@ -204,6 +204,7 @@ class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): STANDARD_NV24 = "Standard_NV24" STANDARD_NV6 = "Standard_NV6" + class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): """Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, and 5. The default value is 1. @@ -213,41 +214,42 @@ class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): THREE = 3 FIVE = 5 + class LoadBalancerSku(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The load balancer sku for the managed cluster. - """ + """The load balancer sku for the managed cluster.""" STANDARD = "standard" BASIC = "basic" + class NetworkPlugin(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Network plugin used for building Kubernetes network. - """ + """Network plugin used for building Kubernetes network.""" AZURE = "azure" KUBENET = "kubenet" + class NetworkPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Network policy used for building Kubernetes network. - """ + """Network policy used for building Kubernetes network.""" CALICO = "calico" AZURE = "azure" + class OSType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """OsType to be used to specify os type. Choose from Linux and Windows. Default to Linux. - """ + """OsType to be used to specify os type. Choose from Linux and Windows. Default to Linux.""" LINUX = "Linux" WINDOWS = "Windows" + class OutboundType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The outbound (egress) routing method. - """ + """The outbound (egress) routing method.""" LOAD_BALANCER = "loadBalancer" USER_DEFINED_ROUTING = "userDefinedRouting" + class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of identity used for the managed cluster. Type 'SystemAssigned' will use an implicitly created identity in master components and an auto-created user assigned identity in MC_ @@ -258,6 +260,7 @@ class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): SYSTEM_ASSIGNED = "SystemAssigned" NONE = "None" + class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ScaleSetEvictionPolicy to be used to specify eviction policy for low priority virtual machine scale set. Default to Delete. @@ -266,9 +269,9 @@ class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): DELETE = "Delete" DEALLOCATE = "Deallocate" + class ScaleSetPriority(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """ScaleSetPriority to be used to specify virtual machine scale set priority. Default to regular. - """ + """ScaleSetPriority to be used to specify virtual machine scale set priority. Default to regular.""" LOW = "Low" REGULAR = "Regular" diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/models/_models_py3.py index 8438ddca33a9..aca284963b06 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/models/_models_py3.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/models/_models_py3.py @@ -1,4 +1,5 @@ # coding=utf-8 +# pylint: disable=too-many-lines # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -8,14 +9,14 @@ from typing import Dict, List, Optional, TYPE_CHECKING, Union -import msrest.serialization +from ... import _serialization if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - import __init__ as _models + from .. import models as _models -class SubResource(msrest.serialization.Model): +class SubResource(_serialization.Model): """Reference to another subresource. Variables are only populated by the server, and will be ignored when sending a request. @@ -30,30 +31,26 @@ class SubResource(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(SubResource, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.id = None self.name = None self.type = None -class AgentPool(SubResource): +class AgentPool(SubResource): # pylint: disable=too-many-instance-attributes """Agent Pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -105,7 +102,7 @@ class AgentPool(SubResource): "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :vartype vm_size: str or ~azure.mgmt.containerservice.v2020_01_01.models.ContainerServiceVMSizeTypes :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine @@ -117,7 +114,7 @@ class AgentPool(SubResource): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Known values are: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux" and "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2020_01_01.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -126,7 +123,7 @@ class AgentPool(SubResource): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar type_properties_type: AgentPoolType represents types of an agent pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :vartype type_properties_type: str or ~azure.mgmt.containerservice.v2020_01_01.models.AgentPoolType :ivar orchestrator_version: Version of orchestrator specified when creating the managed @@ -141,16 +138,15 @@ class AgentPool(SubResource): :ivar enable_node_public_ip: Enable public IP for nodes. :vartype enable_node_public_ip: bool :ivar scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Known values are: "Low", "Regular". Default value: "Regular". + priority. Default to regular. Known values are: "Low" and "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_01_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy - for low priority virtual machine scale set. Default to Delete. Known values are: "Delete", - "Deallocate". Default value: "Delete". + for low priority virtual machine scale set. Default to Delete. Known values are: "Delete" and + "Deallocate". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_01_01.models.ScaleSetEvictionPolicy - :ivar tags: A set of tags. Agent pool tags to be persisted on the agent pool virtual machine - scale set. + :ivar tags: Agent pool tags to be persisted on the agent pool virtual machine scale set. :vartype tags: dict[str, str] :ivar node_labels: Agent pool node labels to be persisted across all nodes in agent pool. :vartype node_labels: dict[str, str] @@ -160,36 +156,36 @@ class AgentPool(SubResource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'os_disk_size_gb': {'maximum': 1023, 'minimum': 0}, - 'provisioning_state': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "os_disk_size_gb": {"maximum": 1023, "minimum": 0}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'count': {'key': 'properties.count', 'type': 'int'}, - 'vm_size': {'key': 'properties.vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'properties.osDiskSizeGB', 'type': 'int'}, - 'vnet_subnet_id': {'key': 'properties.vnetSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'properties.maxPods', 'type': 'int'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'max_count': {'key': 'properties.maxCount', 'type': 'int'}, - 'min_count': {'key': 'properties.minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'properties.enableAutoScaling', 'type': 'bool'}, - 'type_properties_type': {'key': 'properties.type', 'type': 'str'}, - 'orchestrator_version': {'key': 'properties.orchestratorVersion', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'availability_zones': {'key': 'properties.availabilityZones', 'type': '[str]'}, - 'enable_node_public_ip': {'key': 'properties.enableNodePublicIP', 'type': 'bool'}, - 'scale_set_priority': {'key': 'properties.scaleSetPriority', 'type': 'str'}, - 'scale_set_eviction_policy': {'key': 'properties.scaleSetEvictionPolicy', 'type': 'str'}, - 'tags': {'key': 'properties.tags', 'type': '{str}'}, - 'node_labels': {'key': 'properties.nodeLabels', 'type': '{str}'}, - 'node_taints': {'key': 'properties.nodeTaints', 'type': '[str]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "count": {"key": "properties.count", "type": "int"}, + "vm_size": {"key": "properties.vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "properties.osDiskSizeGB", "type": "int"}, + "vnet_subnet_id": {"key": "properties.vnetSubnetID", "type": "str"}, + "max_pods": {"key": "properties.maxPods", "type": "int"}, + "os_type": {"key": "properties.osType", "type": "str"}, + "max_count": {"key": "properties.maxCount", "type": "int"}, + "min_count": {"key": "properties.minCount", "type": "int"}, + "enable_auto_scaling": {"key": "properties.enableAutoScaling", "type": "bool"}, + "type_properties_type": {"key": "properties.type", "type": "str"}, + "orchestrator_version": {"key": "properties.orchestratorVersion", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "availability_zones": {"key": "properties.availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "properties.enableNodePublicIP", "type": "bool"}, + "scale_set_priority": {"key": "properties.scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "properties.scaleSetEvictionPolicy", "type": "str"}, + "tags": {"key": "properties.tags", "type": "{str}"}, + "node_labels": {"key": "properties.nodeLabels", "type": "{str}"}, + "node_taints": {"key": "properties.nodeTaints", "type": "[str]"}, } def __init__( @@ -200,7 +196,7 @@ def __init__( os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, @@ -208,8 +204,8 @@ def __init__( orchestrator_version: Optional[str] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, - scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, @@ -256,7 +252,7 @@ def __init__( "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :paramtype vm_size: str or ~azure.mgmt.containerservice.v2020_01_01.models.ContainerServiceVMSizeTypes :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every @@ -268,7 +264,7 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux" and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2020_01_01.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -277,7 +273,7 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword type_properties_type: AgentPoolType represents types of an agent pool. Known values - are: "VirtualMachineScaleSets", "AvailabilitySet". + are: "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type_properties_type: str or ~azure.mgmt.containerservice.v2020_01_01.models.AgentPoolType :keyword orchestrator_version: Version of orchestrator specified when creating the managed @@ -289,16 +285,15 @@ def __init__( :keyword enable_node_public_ip: Enable public IP for nodes. :paramtype enable_node_public_ip: bool :keyword scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Known values are: "Low", "Regular". Default value: "Regular". + priority. Default to regular. Known values are: "Low" and "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_01_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy for low priority virtual machine scale set. Default to Delete. Known values are: - "Delete", "Deallocate". Default value: "Delete". + "Delete" and "Deallocate". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_01_01.models.ScaleSetEvictionPolicy - :keyword tags: A set of tags. Agent pool tags to be persisted on the agent pool virtual machine - scale set. + :keyword tags: Agent pool tags to be persisted on the agent pool virtual machine scale set. :paramtype tags: dict[str, str] :keyword node_labels: Agent pool node labels to be persisted across all nodes in agent pool. :paramtype node_labels: dict[str, str] @@ -306,7 +301,7 @@ def __init__( key=value:NoSchedule. :paramtype node_taints: list[str] """ - super(AgentPool, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.vm_size = vm_size self.os_disk_size_gb = os_disk_size_gb @@ -328,7 +323,7 @@ def __init__( self.node_taints = node_taints -class AgentPoolAvailableVersions(msrest.serialization.Model): +class AgentPoolAvailableVersions(_serialization.Model): """The list of available versions for an agent pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -345,16 +340,19 @@ class AgentPoolAvailableVersions(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'agent_pool_versions': {'key': 'properties.agentPoolVersions', 'type': '[AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "agent_pool_versions": { + "key": "properties.agentPoolVersions", + "type": "[AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem]", + }, } def __init__( @@ -368,14 +366,14 @@ def __init__( :paramtype agent_pool_versions: list[~azure.mgmt.containerservice.v2020_01_01.models.AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem] """ - super(AgentPoolAvailableVersions, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None self.agent_pool_versions = agent_pool_versions -class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(msrest.serialization.Model): +class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(_serialization.Model): """AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem. :ivar default: Whether this version is the default agent pool version. @@ -387,9 +385,9 @@ class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(msrest.serializa """ _attribute_map = { - 'default': {'key': 'default', 'type': 'bool'}, - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "default": {"key": "default", "type": "bool"}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } def __init__( @@ -408,13 +406,13 @@ def __init__( :keyword is_preview: Whether Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.default = default self.kubernetes_version = kubernetes_version self.is_preview = is_preview -class AgentPoolListResult(msrest.serialization.Model): +class AgentPoolListResult(_serialization.Model): """The response from the List Agent Pools operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -426,30 +424,25 @@ class AgentPoolListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[AgentPool]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[AgentPool]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.AgentPool"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.AgentPool"]] = None, **kwargs): """ :keyword value: The list of agent pools. :paramtype value: list[~azure.mgmt.containerservice.v2020_01_01.models.AgentPool] """ - super(AgentPoolListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class AgentPoolUpgradeProfile(msrest.serialization.Model): +class AgentPoolUpgradeProfile(_serialization.Model): """The list of available upgrades for an agent pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -462,10 +455,10 @@ class AgentPoolUpgradeProfile(msrest.serialization.Model): :vartype name: str :ivar type: Type of the agent pool upgrade profile. :vartype type: str - :ivar kubernetes_version: Required. Kubernetes version (major, minor, patch). + :ivar kubernetes_version: Kubernetes version (major, minor, patch). Required. :vartype kubernetes_version: str - :ivar os_type: Required. OsType to be used to specify os type. Choose from Linux and Windows. - Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to + Linux. Known values are: "Linux" and "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2020_01_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -473,20 +466,20 @@ class AgentPoolUpgradeProfile(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kubernetes_version': {'required': True}, - 'os_type': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "kubernetes_version": {"required": True}, + "os_type": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'kubernetes_version': {'key': 'properties.kubernetesVersion', 'type': 'str'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'upgrades': {'key': 'properties.upgrades', 'type': '[AgentPoolUpgradeProfilePropertiesUpgradesItem]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "os_type": {"key": "properties.osType", "type": "str"}, + "upgrades": {"key": "properties.upgrades", "type": "[AgentPoolUpgradeProfilePropertiesUpgradesItem]"}, } def __init__( @@ -498,16 +491,16 @@ def __init__( **kwargs ): """ - :keyword kubernetes_version: Required. Kubernetes version (major, minor, patch). + :keyword kubernetes_version: Kubernetes version (major, minor, patch). Required. :paramtype kubernetes_version: str - :keyword os_type: Required. OsType to be used to specify os type. Choose from Linux and - Windows. Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default + to Linux. Known values are: "Linux" and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2020_01_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: list[~azure.mgmt.containerservice.v2020_01_01.models.AgentPoolUpgradeProfilePropertiesUpgradesItem] """ - super(AgentPoolUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -516,7 +509,7 @@ def __init__( self.upgrades = upgrades -class AgentPoolUpgradeProfilePropertiesUpgradesItem(msrest.serialization.Model): +class AgentPoolUpgradeProfilePropertiesUpgradesItem(_serialization.Model): """AgentPoolUpgradeProfilePropertiesUpgradesItem. :ivar kubernetes_version: Kubernetes version (major, minor, patch). @@ -526,29 +519,23 @@ class AgentPoolUpgradeProfilePropertiesUpgradesItem(msrest.serialization.Model): """ _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } - def __init__( - self, - *, - kubernetes_version: Optional[str] = None, - is_preview: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, kubernetes_version: Optional[str] = None, is_preview: Optional[bool] = None, **kwargs): """ :keyword kubernetes_version: Kubernetes version (major, minor, patch). :paramtype kubernetes_version: str :keyword is_preview: Whether Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(AgentPoolUpgradeProfilePropertiesUpgradesItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.is_preview = is_preview -class CloudErrorBody(msrest.serialization.Model): +class CloudErrorBody(_serialization.Model): """An error response from the Container service. :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed @@ -565,10 +552,10 @@ class CloudErrorBody(msrest.serialization.Model): """ _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[CloudErrorBody]"}, } def __init__( @@ -593,87 +580,76 @@ def __init__( :keyword details: A list of additional details about the error. :paramtype details: list[~azure.mgmt.containerservice.v2020_01_01.models.CloudErrorBody] """ - super(CloudErrorBody, self).__init__(**kwargs) + super().__init__(**kwargs) self.code = code self.message = message self.target = target self.details = details -class ContainerServiceDiagnosticsProfile(msrest.serialization.Model): +class ContainerServiceDiagnosticsProfile(_serialization.Model): """Profile for diagnostics on the container service cluster. All required parameters must be populated in order to send to Azure. - :ivar vm_diagnostics: Required. Profile for diagnostics on the container service VMs. + :ivar vm_diagnostics: Profile for diagnostics on the container service VMs. Required. :vartype vm_diagnostics: ~azure.mgmt.containerservice.v2020_01_01.models.ContainerServiceVMDiagnostics """ _validation = { - 'vm_diagnostics': {'required': True}, + "vm_diagnostics": {"required": True}, } _attribute_map = { - 'vm_diagnostics': {'key': 'vmDiagnostics', 'type': 'ContainerServiceVMDiagnostics'}, + "vm_diagnostics": {"key": "vmDiagnostics", "type": "ContainerServiceVMDiagnostics"}, } - def __init__( - self, - *, - vm_diagnostics: "_models.ContainerServiceVMDiagnostics", - **kwargs - ): + def __init__(self, *, vm_diagnostics: "_models.ContainerServiceVMDiagnostics", **kwargs): """ - :keyword vm_diagnostics: Required. Profile for diagnostics on the container service VMs. + :keyword vm_diagnostics: Profile for diagnostics on the container service VMs. Required. :paramtype vm_diagnostics: ~azure.mgmt.containerservice.v2020_01_01.models.ContainerServiceVMDiagnostics """ - super(ContainerServiceDiagnosticsProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.vm_diagnostics = vm_diagnostics -class ContainerServiceLinuxProfile(msrest.serialization.Model): +class ContainerServiceLinuxProfile(_serialization.Model): """Profile for Linux VMs in the container service cluster. All required parameters must be populated in order to send to Azure. - :ivar admin_username: Required. The administrator username to use for Linux VMs. + :ivar admin_username: The administrator username to use for Linux VMs. Required. :vartype admin_username: str - :ivar ssh: Required. SSH configuration for Linux-based VMs running on Azure. + :ivar ssh: SSH configuration for Linux-based VMs running on Azure. Required. :vartype ssh: ~azure.mgmt.containerservice.v2020_01_01.models.ContainerServiceSshConfiguration """ _validation = { - 'admin_username': {'required': True, 'pattern': r'^[A-Za-z][-A-Za-z0-9_]*$'}, - 'ssh': {'required': True}, + "admin_username": {"required": True, "pattern": r"^[A-Za-z][-A-Za-z0-9_]*$"}, + "ssh": {"required": True}, } _attribute_map = { - 'admin_username': {'key': 'adminUsername', 'type': 'str'}, - 'ssh': {'key': 'ssh', 'type': 'ContainerServiceSshConfiguration'}, + "admin_username": {"key": "adminUsername", "type": "str"}, + "ssh": {"key": "ssh", "type": "ContainerServiceSshConfiguration"}, } - def __init__( - self, - *, - admin_username: str, - ssh: "_models.ContainerServiceSshConfiguration", - **kwargs - ): + def __init__(self, *, admin_username: str, ssh: "_models.ContainerServiceSshConfiguration", **kwargs): """ - :keyword admin_username: Required. The administrator username to use for Linux VMs. + :keyword admin_username: The administrator username to use for Linux VMs. Required. :paramtype admin_username: str - :keyword ssh: Required. SSH configuration for Linux-based VMs running on Azure. + :keyword ssh: SSH configuration for Linux-based VMs running on Azure. Required. :paramtype ssh: ~azure.mgmt.containerservice.v2020_01_01.models.ContainerServiceSshConfiguration """ - super(ContainerServiceLinuxProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.admin_username = admin_username self.ssh = ssh -class ContainerServiceMasterProfile(msrest.serialization.Model): +class ContainerServiceMasterProfile(_serialization.Model): """Profile for the container service master. Variables are only populated by the server, and will be ignored when sending a request. @@ -681,11 +657,11 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar count: Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, - and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". + and 5. The default value is 1. Known values are: 1, 3, and 5. :vartype count: int or ~azure.mgmt.containerservice.v2020_01_01.models.Count - :ivar dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. + :ivar dns_prefix: DNS prefix to be used to create the FQDN for the master pool. Required. :vartype dns_prefix: str - :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + :ivar vm_size: Size of agent VMs. Required. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -722,7 +698,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :vartype vm_size: str or ~azure.mgmt.containerservice.v2020_01_01.models.ContainerServiceVMSizeTypes :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine @@ -736,7 +712,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): :vartype first_consecutive_static_ip: str :ivar storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount" and "ManagedDisks". :vartype storage_profile: str or ~azure.mgmt.containerservice.v2020_01_01.models.ContainerServiceStorageProfileTypes :ivar fqdn: FQDN for the master pool. @@ -744,21 +720,21 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): """ _validation = { - 'dns_prefix': {'required': True}, - 'vm_size': {'required': True}, - 'os_disk_size_gb': {'maximum': 1023, 'minimum': 0}, - 'fqdn': {'readonly': True}, + "dns_prefix": {"required": True}, + "vm_size": {"required": True}, + "os_disk_size_gb": {"maximum": 1023, "minimum": 0}, + "fqdn": {"readonly": True}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'dns_prefix': {'key': 'dnsPrefix', 'type': 'str'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'first_consecutive_static_ip': {'key': 'firstConsecutiveStaticIP', 'type': 'str'}, - 'storage_profile': {'key': 'storageProfile', 'type': 'str'}, - 'fqdn': {'key': 'fqdn', 'type': 'str'}, + "count": {"key": "count", "type": "int"}, + "dns_prefix": {"key": "dnsPrefix", "type": "str"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "first_consecutive_static_ip": {"key": "firstConsecutiveStaticIP", "type": "str"}, + "storage_profile": {"key": "storageProfile", "type": "str"}, + "fqdn": {"key": "fqdn", "type": "str"}, } def __init__( @@ -766,20 +742,20 @@ def __init__( *, dns_prefix: str, vm_size: Union[str, "_models.ContainerServiceVMSizeTypes"], - count: Optional[Union[int, "_models.Count"]] = 1, + count: Union[int, "_models.Count"] = 1, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, - first_consecutive_static_ip: Optional[str] = "10.240.255.5", + first_consecutive_static_ip: str = "10.240.255.5", storage_profile: Optional[Union[str, "_models.ContainerServiceStorageProfileTypes"]] = None, **kwargs ): """ :keyword count: Number of masters (VMs) in the container service cluster. Allowed values are 1, - 3, and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". + 3, and 5. The default value is 1. Known values are: 1, 3, and 5. :paramtype count: int or ~azure.mgmt.containerservice.v2020_01_01.models.Count - :keyword dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. + :keyword dns_prefix: DNS prefix to be used to create the FQDN for the master pool. Required. :paramtype dns_prefix: str - :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + :keyword vm_size: Size of agent VMs. Required. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -816,7 +792,7 @@ def __init__( "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :paramtype vm_size: str or ~azure.mgmt.containerservice.v2020_01_01.models.ContainerServiceVMSizeTypes :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every @@ -830,11 +806,11 @@ def __init__( :paramtype first_consecutive_static_ip: str :keyword storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount" and "ManagedDisks". :paramtype storage_profile: str or ~azure.mgmt.containerservice.v2020_01_01.models.ContainerServiceStorageProfileTypes """ - super(ContainerServiceMasterProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.dns_prefix = dns_prefix self.vm_size = vm_size @@ -845,14 +821,14 @@ def __init__( self.fqdn = None -class ContainerServiceNetworkProfile(msrest.serialization.Model): +class ContainerServiceNetworkProfile(_serialization.Model): """Profile of network configuration. :ivar network_plugin: Network plugin used for building Kubernetes network. Known values are: - "azure", "kubenet". Default value: "kubenet". + "azure" and "kubenet". :vartype network_plugin: str or ~azure.mgmt.containerservice.v2020_01_01.models.NetworkPlugin :ivar network_policy: Network policy used for building Kubernetes network. Known values are: - "calico", "azure". + "calico" and "azure". :vartype network_policy: str or ~azure.mgmt.containerservice.v2020_01_01.models.NetworkPolicy :ivar pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :vartype pod_cidr: str @@ -865,11 +841,11 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): :ivar docker_bridge_cidr: A CIDR notation IP range assigned to the Docker bridge network. It must not overlap with any Subnet IP ranges or the Kubernetes service address range. :vartype docker_bridge_cidr: str - :ivar outbound_type: The outbound (egress) routing method. Known values are: "loadBalancer", - "userDefinedRouting". Default value: "loadBalancer". + :ivar outbound_type: The outbound (egress) routing method. Known values are: "loadBalancer" and + "userDefinedRouting". :vartype outbound_type: str or ~azure.mgmt.containerservice.v2020_01_01.models.OutboundType :ivar load_balancer_sku: The load balancer sku for the managed cluster. Known values are: - "standard", "basic". + "standard" and "basic". :vartype load_balancer_sku: str or ~azure.mgmt.containerservice.v2020_01_01.models.LoadBalancerSku :ivar load_balancer_profile: Profile of the cluster load balancer. @@ -878,44 +854,46 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): """ _validation = { - 'pod_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, - 'service_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, - 'dns_service_ip': {'pattern': r'^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$'}, - 'docker_bridge_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, + "pod_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, + "service_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, + "dns_service_ip": { + "pattern": r"^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$" + }, + "docker_bridge_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, } _attribute_map = { - 'network_plugin': {'key': 'networkPlugin', 'type': 'str'}, - 'network_policy': {'key': 'networkPolicy', 'type': 'str'}, - 'pod_cidr': {'key': 'podCidr', 'type': 'str'}, - 'service_cidr': {'key': 'serviceCidr', 'type': 'str'}, - 'dns_service_ip': {'key': 'dnsServiceIP', 'type': 'str'}, - 'docker_bridge_cidr': {'key': 'dockerBridgeCidr', 'type': 'str'}, - 'outbound_type': {'key': 'outboundType', 'type': 'str'}, - 'load_balancer_sku': {'key': 'loadBalancerSku', 'type': 'str'}, - 'load_balancer_profile': {'key': 'loadBalancerProfile', 'type': 'ManagedClusterLoadBalancerProfile'}, + "network_plugin": {"key": "networkPlugin", "type": "str"}, + "network_policy": {"key": "networkPolicy", "type": "str"}, + "pod_cidr": {"key": "podCidr", "type": "str"}, + "service_cidr": {"key": "serviceCidr", "type": "str"}, + "dns_service_ip": {"key": "dnsServiceIP", "type": "str"}, + "docker_bridge_cidr": {"key": "dockerBridgeCidr", "type": "str"}, + "outbound_type": {"key": "outboundType", "type": "str"}, + "load_balancer_sku": {"key": "loadBalancerSku", "type": "str"}, + "load_balancer_profile": {"key": "loadBalancerProfile", "type": "ManagedClusterLoadBalancerProfile"}, } def __init__( self, *, - network_plugin: Optional[Union[str, "_models.NetworkPlugin"]] = "kubenet", + network_plugin: Union[str, "_models.NetworkPlugin"] = "kubenet", network_policy: Optional[Union[str, "_models.NetworkPolicy"]] = None, - pod_cidr: Optional[str] = "10.244.0.0/16", - service_cidr: Optional[str] = "10.0.0.0/16", - dns_service_ip: Optional[str] = "10.0.0.10", - docker_bridge_cidr: Optional[str] = "172.17.0.1/16", - outbound_type: Optional[Union[str, "_models.OutboundType"]] = "loadBalancer", + pod_cidr: str = "10.244.0.0/16", + service_cidr: str = "10.0.0.0/16", + dns_service_ip: str = "10.0.0.10", + docker_bridge_cidr: str = "172.17.0.1/16", + outbound_type: Union[str, "_models.OutboundType"] = "loadBalancer", load_balancer_sku: Optional[Union[str, "_models.LoadBalancerSku"]] = None, load_balancer_profile: Optional["_models.ManagedClusterLoadBalancerProfile"] = None, **kwargs ): """ :keyword network_plugin: Network plugin used for building Kubernetes network. Known values are: - "azure", "kubenet". Default value: "kubenet". + "azure" and "kubenet". :paramtype network_plugin: str or ~azure.mgmt.containerservice.v2020_01_01.models.NetworkPlugin :keyword network_policy: Network policy used for building Kubernetes network. Known values are: - "calico", "azure". + "calico" and "azure". :paramtype network_policy: str or ~azure.mgmt.containerservice.v2020_01_01.models.NetworkPolicy :keyword pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :paramtype pod_cidr: str @@ -928,18 +906,18 @@ def __init__( :keyword docker_bridge_cidr: A CIDR notation IP range assigned to the Docker bridge network. It must not overlap with any Subnet IP ranges or the Kubernetes service address range. :paramtype docker_bridge_cidr: str - :keyword outbound_type: The outbound (egress) routing method. Known values are: "loadBalancer", - "userDefinedRouting". Default value: "loadBalancer". + :keyword outbound_type: The outbound (egress) routing method. Known values are: "loadBalancer" + and "userDefinedRouting". :paramtype outbound_type: str or ~azure.mgmt.containerservice.v2020_01_01.models.OutboundType :keyword load_balancer_sku: The load balancer sku for the managed cluster. Known values are: - "standard", "basic". + "standard" and "basic". :paramtype load_balancer_sku: str or ~azure.mgmt.containerservice.v2020_01_01.models.LoadBalancerSku :keyword load_balancer_profile: Profile of the cluster load balancer. :paramtype load_balancer_profile: ~azure.mgmt.containerservice.v2020_01_01.models.ManagedClusterLoadBalancerProfile """ - super(ContainerServiceNetworkProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.network_plugin = network_plugin self.network_policy = network_policy self.pod_cidr = pod_cidr @@ -951,113 +929,98 @@ def __init__( self.load_balancer_profile = load_balancer_profile -class ContainerServiceSshConfiguration(msrest.serialization.Model): +class ContainerServiceSshConfiguration(_serialization.Model): """SSH configuration for Linux-based VMs running on Azure. All required parameters must be populated in order to send to Azure. - :ivar public_keys: Required. The list of SSH public keys used to authenticate with Linux-based - VMs. Only expect one key specified. + :ivar public_keys: The list of SSH public keys used to authenticate with Linux-based VMs. Only + expect one key specified. Required. :vartype public_keys: list[~azure.mgmt.containerservice.v2020_01_01.models.ContainerServiceSshPublicKey] """ _validation = { - 'public_keys': {'required': True}, + "public_keys": {"required": True}, } _attribute_map = { - 'public_keys': {'key': 'publicKeys', 'type': '[ContainerServiceSshPublicKey]'}, + "public_keys": {"key": "publicKeys", "type": "[ContainerServiceSshPublicKey]"}, } - def __init__( - self, - *, - public_keys: List["_models.ContainerServiceSshPublicKey"], - **kwargs - ): + def __init__(self, *, public_keys: List["_models.ContainerServiceSshPublicKey"], **kwargs): """ - :keyword public_keys: Required. The list of SSH public keys used to authenticate with - Linux-based VMs. Only expect one key specified. + :keyword public_keys: The list of SSH public keys used to authenticate with Linux-based VMs. + Only expect one key specified. Required. :paramtype public_keys: list[~azure.mgmt.containerservice.v2020_01_01.models.ContainerServiceSshPublicKey] """ - super(ContainerServiceSshConfiguration, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_keys = public_keys -class ContainerServiceSshPublicKey(msrest.serialization.Model): +class ContainerServiceSshPublicKey(_serialization.Model): """Contains information about SSH certificate public key data. All required parameters must be populated in order to send to Azure. - :ivar key_data: Required. Certificate public key used to authenticate with VMs through SSH. The - certificate must be in PEM format with or without headers. + :ivar key_data: Certificate public key used to authenticate with VMs through SSH. The + certificate must be in PEM format with or without headers. Required. :vartype key_data: str """ _validation = { - 'key_data': {'required': True}, + "key_data": {"required": True}, } _attribute_map = { - 'key_data': {'key': 'keyData', 'type': 'str'}, + "key_data": {"key": "keyData", "type": "str"}, } - def __init__( - self, - *, - key_data: str, - **kwargs - ): + def __init__(self, *, key_data: str, **kwargs): """ - :keyword key_data: Required. Certificate public key used to authenticate with VMs through SSH. - The certificate must be in PEM format with or without headers. + :keyword key_data: Certificate public key used to authenticate with VMs through SSH. The + certificate must be in PEM format with or without headers. Required. :paramtype key_data: str """ - super(ContainerServiceSshPublicKey, self).__init__(**kwargs) + super().__init__(**kwargs) self.key_data = key_data -class ContainerServiceVMDiagnostics(msrest.serialization.Model): +class ContainerServiceVMDiagnostics(_serialization.Model): """Profile for diagnostics on the container service VMs. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar enabled: Required. Whether the VM diagnostic agent is provisioned on the VM. + :ivar enabled: Whether the VM diagnostic agent is provisioned on the VM. Required. :vartype enabled: bool :ivar storage_uri: The URI of the storage account where diagnostics are stored. :vartype storage_uri: str """ _validation = { - 'enabled': {'required': True}, - 'storage_uri': {'readonly': True}, + "enabled": {"required": True}, + "storage_uri": {"readonly": True}, } _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'storage_uri': {'key': 'storageUri', 'type': 'str'}, + "enabled": {"key": "enabled", "type": "bool"}, + "storage_uri": {"key": "storageUri", "type": "str"}, } - def __init__( - self, - *, - enabled: bool, - **kwargs - ): + def __init__(self, *, enabled: bool, **kwargs): """ - :keyword enabled: Required. Whether the VM diagnostic agent is provisioned on the VM. + :keyword enabled: Whether the VM diagnostic agent is provisioned on the VM. Required. :paramtype enabled: bool """ - super(ContainerServiceVMDiagnostics, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.storage_uri = None -class CredentialResult(msrest.serialization.Model): +class CredentialResult(_serialization.Model): """The credential result response. Variables are only populated by the server, and will be ignored when sending a request. @@ -1065,31 +1028,27 @@ class CredentialResult(msrest.serialization.Model): :ivar name: The name of the credential. :vartype name: str :ivar value: Base64-encoded Kubernetes configuration file. - :vartype value: bytearray + :vartype value: bytes """ _validation = { - 'name': {'readonly': True}, - 'value': {'readonly': True}, + "name": {"readonly": True}, + "value": {"readonly": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'bytearray'}, + "name": {"key": "name", "type": "str"}, + "value": {"key": "value", "type": "bytearray"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(CredentialResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.name = None self.value = None -class CredentialResults(msrest.serialization.Model): +class CredentialResults(_serialization.Model): """The list of credential result response. Variables are only populated by the server, and will be ignored when sending a request. @@ -1099,24 +1058,20 @@ class CredentialResults(msrest.serialization.Model): """ _validation = { - 'kubeconfigs': {'readonly': True}, + "kubeconfigs": {"readonly": True}, } _attribute_map = { - 'kubeconfigs': {'key': 'kubeconfigs', 'type': '[CredentialResult]'}, + "kubeconfigs": {"key": "kubeconfigs", "type": "[CredentialResult]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(CredentialResults, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.kubeconfigs = None -class Resource(msrest.serialization.Model): +class Resource(_serialization.Model): """The Resource model definition. Variables are only populated by the server, and will be ignored when sending a request. @@ -1129,41 +1084,35 @@ class Resource(msrest.serialization.Model): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] """ - super(Resource, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -1171,7 +1120,7 @@ def __init__( self.tags = tags -class ManagedCluster(Resource): +class ManagedCluster(Resource): # pylint: disable=too-many-instance-attributes """Managed cluster. Variables are only populated by the server, and will be ignored when sending a request. @@ -1184,9 +1133,9 @@ class ManagedCluster(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar identity: The identity of the managed cluster, if configured. :vartype identity: ~azure.mgmt.containerservice.v2020_01_01.models.ManagedClusterIdentity @@ -1244,45 +1193,54 @@ class ManagedCluster(Resource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'provisioning_state': {'readonly': True}, - 'max_agent_pools': {'readonly': True}, - 'fqdn': {'readonly': True}, - 'private_fqdn': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, + "provisioning_state": {"readonly": True}, + "max_agent_pools": {"readonly": True}, + "fqdn": {"readonly": True}, + "private_fqdn": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'ManagedClusterIdentity'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'max_agent_pools': {'key': 'properties.maxAgentPools', 'type': 'int'}, - 'kubernetes_version': {'key': 'properties.kubernetesVersion', 'type': 'str'}, - 'dns_prefix': {'key': 'properties.dnsPrefix', 'type': 'str'}, - 'fqdn': {'key': 'properties.fqdn', 'type': 'str'}, - 'private_fqdn': {'key': 'properties.privateFQDN', 'type': 'str'}, - 'agent_pool_profiles': {'key': 'properties.agentPoolProfiles', 'type': '[ManagedClusterAgentPoolProfile]'}, - 'linux_profile': {'key': 'properties.linuxProfile', 'type': 'ContainerServiceLinuxProfile'}, - 'windows_profile': {'key': 'properties.windowsProfile', 'type': 'ManagedClusterWindowsProfile'}, - 'service_principal_profile': {'key': 'properties.servicePrincipalProfile', 'type': 'ManagedClusterServicePrincipalProfile'}, - 'addon_profiles': {'key': 'properties.addonProfiles', 'type': '{ManagedClusterAddonProfile}'}, - 'node_resource_group': {'key': 'properties.nodeResourceGroup', 'type': 'str'}, - 'enable_rbac': {'key': 'properties.enableRBAC', 'type': 'bool'}, - 'enable_pod_security_policy': {'key': 'properties.enablePodSecurityPolicy', 'type': 'bool'}, - 'network_profile': {'key': 'properties.networkProfile', 'type': 'ContainerServiceNetworkProfile'}, - 'aad_profile': {'key': 'properties.aadProfile', 'type': 'ManagedClusterAADProfile'}, - 'api_server_access_profile': {'key': 'properties.apiServerAccessProfile', 'type': 'ManagedClusterAPIServerAccessProfile'}, - 'disk_encryption_set_id': {'key': 'properties.diskEncryptionSetID', 'type': 'str'}, - 'identity_profile': {'key': 'properties.identityProfile', 'type': '{ManagedClusterPropertiesIdentityProfileValue}'}, - } - - def __init__( + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "identity": {"key": "identity", "type": "ManagedClusterIdentity"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "max_agent_pools": {"key": "properties.maxAgentPools", "type": "int"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "dns_prefix": {"key": "properties.dnsPrefix", "type": "str"}, + "fqdn": {"key": "properties.fqdn", "type": "str"}, + "private_fqdn": {"key": "properties.privateFQDN", "type": "str"}, + "agent_pool_profiles": {"key": "properties.agentPoolProfiles", "type": "[ManagedClusterAgentPoolProfile]"}, + "linux_profile": {"key": "properties.linuxProfile", "type": "ContainerServiceLinuxProfile"}, + "windows_profile": {"key": "properties.windowsProfile", "type": "ManagedClusterWindowsProfile"}, + "service_principal_profile": { + "key": "properties.servicePrincipalProfile", + "type": "ManagedClusterServicePrincipalProfile", + }, + "addon_profiles": {"key": "properties.addonProfiles", "type": "{ManagedClusterAddonProfile}"}, + "node_resource_group": {"key": "properties.nodeResourceGroup", "type": "str"}, + "enable_rbac": {"key": "properties.enableRBAC", "type": "bool"}, + "enable_pod_security_policy": {"key": "properties.enablePodSecurityPolicy", "type": "bool"}, + "network_profile": {"key": "properties.networkProfile", "type": "ContainerServiceNetworkProfile"}, + "aad_profile": {"key": "properties.aadProfile", "type": "ManagedClusterAADProfile"}, + "api_server_access_profile": { + "key": "properties.apiServerAccessProfile", + "type": "ManagedClusterAPIServerAccessProfile", + }, + "disk_encryption_set_id": {"key": "properties.diskEncryptionSetID", "type": "str"}, + "identity_profile": { + "key": "properties.identityProfile", + "type": "{ManagedClusterPropertiesIdentityProfileValue}", + }, + } + + def __init__( # pylint: disable=too-many-locals self, *, location: str, @@ -1306,9 +1264,9 @@ def __init__( **kwargs ): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword identity: The identity of the managed cluster, if configured. :paramtype identity: ~azure.mgmt.containerservice.v2020_01_01.models.ManagedClusterIdentity @@ -1356,7 +1314,7 @@ def __init__( :paramtype identity_profile: dict[str, ~azure.mgmt.containerservice.v2020_01_01.models.ManagedClusterPropertiesIdentityProfileValue] """ - super(ManagedCluster, self).__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.identity = identity self.provisioning_state = None self.max_agent_pools = None @@ -1379,14 +1337,14 @@ def __init__( self.identity_profile = identity_profile -class ManagedClusterAADProfile(msrest.serialization.Model): +class ManagedClusterAADProfile(_serialization.Model): """AADProfile specifies attributes for Azure Active Directory integration. All required parameters must be populated in order to send to Azure. - :ivar client_app_id: Required. The client AAD application ID. + :ivar client_app_id: The client AAD application ID. Required. :vartype client_app_id: str - :ivar server_app_id: Required. The server AAD application ID. + :ivar server_app_id: The server AAD application ID. Required. :vartype server_app_id: str :ivar server_app_secret: The server AAD application secret. :vartype server_app_secret: str @@ -1396,15 +1354,15 @@ class ManagedClusterAADProfile(msrest.serialization.Model): """ _validation = { - 'client_app_id': {'required': True}, - 'server_app_id': {'required': True}, + "client_app_id": {"required": True}, + "server_app_id": {"required": True}, } _attribute_map = { - 'client_app_id': {'key': 'clientAppID', 'type': 'str'}, - 'server_app_id': {'key': 'serverAppID', 'type': 'str'}, - 'server_app_secret': {'key': 'serverAppSecret', 'type': 'str'}, - 'tenant_id': {'key': 'tenantID', 'type': 'str'}, + "client_app_id": {"key": "clientAppID", "type": "str"}, + "server_app_id": {"key": "serverAppID", "type": "str"}, + "server_app_secret": {"key": "serverAppSecret", "type": "str"}, + "tenant_id": {"key": "tenantID", "type": "str"}, } def __init__( @@ -1417,9 +1375,9 @@ def __init__( **kwargs ): """ - :keyword client_app_id: Required. The client AAD application ID. + :keyword client_app_id: The client AAD application ID. Required. :paramtype client_app_id: str - :keyword server_app_id: Required. The server AAD application ID. + :keyword server_app_id: The server AAD application ID. Required. :paramtype server_app_id: str :keyword server_app_secret: The server AAD application secret. :paramtype server_app_secret: str @@ -1427,7 +1385,7 @@ def __init__( tenant of the deployment subscription. :paramtype tenant_id: str """ - super(ManagedClusterAADProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.client_app_id = client_app_id self.server_app_id = server_app_id self.server_app_secret = server_app_secret @@ -1447,58 +1405,53 @@ class ManagedClusterAccessProfile(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar kube_config: Base64-encoded Kubernetes configuration file. - :vartype kube_config: bytearray + :vartype kube_config: bytes """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'kube_config': {'key': 'properties.kubeConfig', 'type': 'bytearray'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "kube_config": {"key": "properties.kubeConfig", "type": "bytearray"}, } def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - kube_config: Optional[bytearray] = None, - **kwargs + self, *, location: str, tags: Optional[Dict[str, str]] = None, kube_config: Optional[bytes] = None, **kwargs ): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword kube_config: Base64-encoded Kubernetes configuration file. - :paramtype kube_config: bytearray + :paramtype kube_config: bytes """ - super(ManagedClusterAccessProfile, self).__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.kube_config = kube_config -class ManagedClusterAddonProfile(msrest.serialization.Model): +class ManagedClusterAddonProfile(_serialization.Model): """A Kubernetes add-on profile for a managed cluster. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar enabled: Required. Whether the add-on is enabled or not. + :ivar enabled: Whether the add-on is enabled or not. Required. :vartype enabled: bool :ivar config: Key-value pairs for configuring an add-on. :vartype config: dict[str, str] @@ -1508,36 +1461,30 @@ class ManagedClusterAddonProfile(msrest.serialization.Model): """ _validation = { - 'enabled': {'required': True}, - 'identity': {'readonly': True}, + "enabled": {"required": True}, + "identity": {"readonly": True}, } _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'config': {'key': 'config', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'ManagedClusterAddonProfileIdentity'}, + "enabled": {"key": "enabled", "type": "bool"}, + "config": {"key": "config", "type": "{str}"}, + "identity": {"key": "identity", "type": "ManagedClusterAddonProfileIdentity"}, } - def __init__( - self, - *, - enabled: bool, - config: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, enabled: bool, config: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword enabled: Required. Whether the add-on is enabled or not. + :keyword enabled: Whether the add-on is enabled or not. Required. :paramtype enabled: bool :keyword config: Key-value pairs for configuring an add-on. :paramtype config: dict[str, str] """ - super(ManagedClusterAddonProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.config = config self.identity = None -class UserAssignedIdentity(msrest.serialization.Model): +class UserAssignedIdentity(_serialization.Model): """UserAssignedIdentity. :ivar resource_id: The resource id of the user assigned identity. @@ -1549,9 +1496,9 @@ class UserAssignedIdentity(msrest.serialization.Model): """ _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'object_id': {'key': 'objectId', 'type': 'str'}, + "resource_id": {"key": "resourceId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + "object_id": {"key": "objectId", "type": "str"}, } def __init__( @@ -1570,7 +1517,7 @@ def __init__( :keyword object_id: The object id of the user assigned identity. :paramtype object_id: str """ - super(UserAssignedIdentity, self).__init__(**kwargs) + super().__init__(**kwargs) self.resource_id = resource_id self.client_id = client_id self.object_id = object_id @@ -1588,9 +1535,9 @@ class ManagedClusterAddonProfileIdentity(UserAssignedIdentity): """ _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'object_id': {'key': 'objectId', 'type': 'str'}, + "resource_id": {"key": "resourceId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + "object_id": {"key": "objectId", "type": "str"}, } def __init__( @@ -1609,10 +1556,10 @@ def __init__( :keyword object_id: The object id of the user assigned identity. :paramtype object_id: str """ - super(ManagedClusterAddonProfileIdentity, self).__init__(resource_id=resource_id, client_id=client_id, object_id=object_id, **kwargs) + super().__init__(resource_id=resource_id, client_id=client_id, object_id=object_id, **kwargs) -class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): +class ManagedClusterAgentPoolProfileProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes """Properties for the container service agent pool profile. Variables are only populated by the server, and will be ignored when sending a request. @@ -1657,7 +1604,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :vartype vm_size: str or ~azure.mgmt.containerservice.v2020_01_01.models.ContainerServiceVMSizeTypes :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine @@ -1669,7 +1616,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Known values are: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux" and "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2020_01_01.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -1678,7 +1625,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar type: AgentPoolType represents types of an agent pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2020_01_01.models.AgentPoolType :ivar orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -1692,16 +1639,15 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar enable_node_public_ip: Enable public IP for nodes. :vartype enable_node_public_ip: bool :ivar scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Known values are: "Low", "Regular". Default value: "Regular". + priority. Default to regular. Known values are: "Low" and "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_01_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy - for low priority virtual machine scale set. Default to Delete. Known values are: "Delete", - "Deallocate". Default value: "Delete". + for low priority virtual machine scale set. Default to Delete. Known values are: "Delete" and + "Deallocate". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_01_01.models.ScaleSetEvictionPolicy - :ivar tags: A set of tags. Agent pool tags to be persisted on the agent pool virtual machine - scale set. + :ivar tags: Agent pool tags to be persisted on the agent pool virtual machine scale set. :vartype tags: dict[str, str] :ivar node_labels: Agent pool node labels to be persisted across all nodes in agent pool. :vartype node_labels: dict[str, str] @@ -1711,30 +1657,30 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): """ _validation = { - 'os_disk_size_gb': {'maximum': 1023, 'minimum': 0}, - 'provisioning_state': {'readonly': True}, + "os_disk_size_gb": {"maximum": 1023, "minimum": 0}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'maxPods', 'type': 'int'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'max_count': {'key': 'maxCount', 'type': 'int'}, - 'min_count': {'key': 'minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'enableAutoScaling', 'type': 'bool'}, - 'type': {'key': 'type', 'type': 'str'}, - 'orchestrator_version': {'key': 'orchestratorVersion', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'availability_zones': {'key': 'availabilityZones', 'type': '[str]'}, - 'enable_node_public_ip': {'key': 'enableNodePublicIP', 'type': 'bool'}, - 'scale_set_priority': {'key': 'scaleSetPriority', 'type': 'str'}, - 'scale_set_eviction_policy': {'key': 'scaleSetEvictionPolicy', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'node_labels': {'key': 'nodeLabels', 'type': '{str}'}, - 'node_taints': {'key': 'nodeTaints', 'type': '[str]'}, + "count": {"key": "count", "type": "int"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "max_pods": {"key": "maxPods", "type": "int"}, + "os_type": {"key": "osType", "type": "str"}, + "max_count": {"key": "maxCount", "type": "int"}, + "min_count": {"key": "minCount", "type": "int"}, + "enable_auto_scaling": {"key": "enableAutoScaling", "type": "bool"}, + "type": {"key": "type", "type": "str"}, + "orchestrator_version": {"key": "orchestratorVersion", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "availability_zones": {"key": "availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "enableNodePublicIP", "type": "bool"}, + "scale_set_priority": {"key": "scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "scaleSetEvictionPolicy", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "node_labels": {"key": "nodeLabels", "type": "{str}"}, + "node_taints": {"key": "nodeTaints", "type": "[str]"}, } def __init__( @@ -1745,7 +1691,7 @@ def __init__( os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, @@ -1753,8 +1699,8 @@ def __init__( orchestrator_version: Optional[str] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, - scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, @@ -1801,7 +1747,7 @@ def __init__( "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :paramtype vm_size: str or ~azure.mgmt.containerservice.v2020_01_01.models.ContainerServiceVMSizeTypes :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every @@ -1813,7 +1759,7 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux" and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2020_01_01.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -1822,7 +1768,7 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword type: AgentPoolType represents types of an agent pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2020_01_01.models.AgentPoolType :keyword orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -1833,16 +1779,15 @@ def __init__( :keyword enable_node_public_ip: Enable public IP for nodes. :paramtype enable_node_public_ip: bool :keyword scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Known values are: "Low", "Regular". Default value: "Regular". + priority. Default to regular. Known values are: "Low" and "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_01_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy for low priority virtual machine scale set. Default to Delete. Known values are: - "Delete", "Deallocate". Default value: "Delete". + "Delete" and "Deallocate". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_01_01.models.ScaleSetEvictionPolicy - :keyword tags: A set of tags. Agent pool tags to be persisted on the agent pool virtual machine - scale set. + :keyword tags: Agent pool tags to be persisted on the agent pool virtual machine scale set. :paramtype tags: dict[str, str] :keyword node_labels: Agent pool node labels to be persisted across all nodes in agent pool. :paramtype node_labels: dict[str, str] @@ -1850,7 +1795,7 @@ def __init__( key=value:NoSchedule. :paramtype node_taints: list[str] """ - super(ManagedClusterAgentPoolProfileProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.vm_size = vm_size self.os_disk_size_gb = os_disk_size_gb @@ -1872,7 +1817,9 @@ def __init__( self.node_taints = node_taints -class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): +class ManagedClusterAgentPoolProfile( + ManagedClusterAgentPoolProfileProperties +): # pylint: disable=too-many-instance-attributes """Profile for the container service agent pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -1919,7 +1866,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :vartype vm_size: str or ~azure.mgmt.containerservice.v2020_01_01.models.ContainerServiceVMSizeTypes :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine @@ -1931,7 +1878,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Known values are: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux" and "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2020_01_01.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -1940,7 +1887,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar type: AgentPoolType represents types of an agent pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2020_01_01.models.AgentPoolType :ivar orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -1954,54 +1901,53 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar enable_node_public_ip: Enable public IP for nodes. :vartype enable_node_public_ip: bool :ivar scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Known values are: "Low", "Regular". Default value: "Regular". + priority. Default to regular. Known values are: "Low" and "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_01_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy - for low priority virtual machine scale set. Default to Delete. Known values are: "Delete", - "Deallocate". Default value: "Delete". + for low priority virtual machine scale set. Default to Delete. Known values are: "Delete" and + "Deallocate". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_01_01.models.ScaleSetEvictionPolicy - :ivar tags: A set of tags. Agent pool tags to be persisted on the agent pool virtual machine - scale set. + :ivar tags: Agent pool tags to be persisted on the agent pool virtual machine scale set. :vartype tags: dict[str, str] :ivar node_labels: Agent pool node labels to be persisted across all nodes in agent pool. :vartype node_labels: dict[str, str] :ivar node_taints: Taints added to new nodes during node pool create and scale. For example, key=value:NoSchedule. :vartype node_taints: list[str] - :ivar name: Required. Unique name of the agent pool profile in the context of the subscription - and resource group. + :ivar name: Unique name of the agent pool profile in the context of the subscription and + resource group. Required. :vartype name: str """ _validation = { - 'os_disk_size_gb': {'maximum': 1023, 'minimum': 0}, - 'provisioning_state': {'readonly': True}, - 'name': {'required': True, 'pattern': r'^[a-z][a-z0-9]{0,11}$'}, + "os_disk_size_gb": {"maximum": 1023, "minimum": 0}, + "provisioning_state": {"readonly": True}, + "name": {"required": True, "pattern": r"^[a-z][a-z0-9]{0,11}$"}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'maxPods', 'type': 'int'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'max_count': {'key': 'maxCount', 'type': 'int'}, - 'min_count': {'key': 'minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'enableAutoScaling', 'type': 'bool'}, - 'type': {'key': 'type', 'type': 'str'}, - 'orchestrator_version': {'key': 'orchestratorVersion', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'availability_zones': {'key': 'availabilityZones', 'type': '[str]'}, - 'enable_node_public_ip': {'key': 'enableNodePublicIP', 'type': 'bool'}, - 'scale_set_priority': {'key': 'scaleSetPriority', 'type': 'str'}, - 'scale_set_eviction_policy': {'key': 'scaleSetEvictionPolicy', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'node_labels': {'key': 'nodeLabels', 'type': '{str}'}, - 'node_taints': {'key': 'nodeTaints', 'type': '[str]'}, - 'name': {'key': 'name', 'type': 'str'}, + "count": {"key": "count", "type": "int"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "max_pods": {"key": "maxPods", "type": "int"}, + "os_type": {"key": "osType", "type": "str"}, + "max_count": {"key": "maxCount", "type": "int"}, + "min_count": {"key": "minCount", "type": "int"}, + "enable_auto_scaling": {"key": "enableAutoScaling", "type": "bool"}, + "type": {"key": "type", "type": "str"}, + "orchestrator_version": {"key": "orchestratorVersion", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "availability_zones": {"key": "availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "enableNodePublicIP", "type": "bool"}, + "scale_set_priority": {"key": "scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "scaleSetEvictionPolicy", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "node_labels": {"key": "nodeLabels", "type": "{str}"}, + "node_taints": {"key": "nodeTaints", "type": "[str]"}, + "name": {"key": "name", "type": "str"}, } def __init__( @@ -2013,7 +1959,7 @@ def __init__( os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, @@ -2021,8 +1967,8 @@ def __init__( orchestrator_version: Optional[str] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, - scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, @@ -2069,7 +2015,7 @@ def __init__( "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :paramtype vm_size: str or ~azure.mgmt.containerservice.v2020_01_01.models.ContainerServiceVMSizeTypes :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every @@ -2081,7 +2027,7 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux" and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2020_01_01.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -2090,7 +2036,7 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword type: AgentPoolType represents types of an agent pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2020_01_01.models.AgentPoolType :keyword orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -2101,31 +2047,50 @@ def __init__( :keyword enable_node_public_ip: Enable public IP for nodes. :paramtype enable_node_public_ip: bool :keyword scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Known values are: "Low", "Regular". Default value: "Regular". + priority. Default to regular. Known values are: "Low" and "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_01_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy for low priority virtual machine scale set. Default to Delete. Known values are: - "Delete", "Deallocate". Default value: "Delete". + "Delete" and "Deallocate". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_01_01.models.ScaleSetEvictionPolicy - :keyword tags: A set of tags. Agent pool tags to be persisted on the agent pool virtual machine - scale set. + :keyword tags: Agent pool tags to be persisted on the agent pool virtual machine scale set. :paramtype tags: dict[str, str] :keyword node_labels: Agent pool node labels to be persisted across all nodes in agent pool. :paramtype node_labels: dict[str, str] :keyword node_taints: Taints added to new nodes during node pool create and scale. For example, key=value:NoSchedule. :paramtype node_taints: list[str] - :keyword name: Required. Unique name of the agent pool profile in the context of the - subscription and resource group. + :keyword name: Unique name of the agent pool profile in the context of the subscription and + resource group. Required. :paramtype name: str """ - super(ManagedClusterAgentPoolProfile, self).__init__(count=count, vm_size=vm_size, os_disk_size_gb=os_disk_size_gb, vnet_subnet_id=vnet_subnet_id, max_pods=max_pods, os_type=os_type, max_count=max_count, min_count=min_count, enable_auto_scaling=enable_auto_scaling, type=type, orchestrator_version=orchestrator_version, availability_zones=availability_zones, enable_node_public_ip=enable_node_public_ip, scale_set_priority=scale_set_priority, scale_set_eviction_policy=scale_set_eviction_policy, tags=tags, node_labels=node_labels, node_taints=node_taints, **kwargs) + super().__init__( + count=count, + vm_size=vm_size, + os_disk_size_gb=os_disk_size_gb, + vnet_subnet_id=vnet_subnet_id, + max_pods=max_pods, + os_type=os_type, + max_count=max_count, + min_count=min_count, + enable_auto_scaling=enable_auto_scaling, + type=type, + orchestrator_version=orchestrator_version, + availability_zones=availability_zones, + enable_node_public_ip=enable_node_public_ip, + scale_set_priority=scale_set_priority, + scale_set_eviction_policy=scale_set_eviction_policy, + tags=tags, + node_labels=node_labels, + node_taints=node_taints, + **kwargs + ) self.name = name -class ManagedClusterAPIServerAccessProfile(msrest.serialization.Model): +class ManagedClusterAPIServerAccessProfile(_serialization.Model): """Access profile for managed cluster API server. :ivar authorized_ip_ranges: Authorized IP Ranges to kubernetes API server. @@ -2135,8 +2100,8 @@ class ManagedClusterAPIServerAccessProfile(msrest.serialization.Model): """ _attribute_map = { - 'authorized_ip_ranges': {'key': 'authorizedIPRanges', 'type': '[str]'}, - 'enable_private_cluster': {'key': 'enablePrivateCluster', 'type': 'bool'}, + "authorized_ip_ranges": {"key": "authorizedIPRanges", "type": "[str]"}, + "enable_private_cluster": {"key": "enablePrivateCluster", "type": "bool"}, } def __init__( @@ -2152,12 +2117,12 @@ def __init__( :keyword enable_private_cluster: Whether to create the cluster as a private cluster or not. :paramtype enable_private_cluster: bool """ - super(ManagedClusterAPIServerAccessProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.authorized_ip_ranges = authorized_ip_ranges self.enable_private_cluster = enable_private_cluster -class ManagedClusterIdentity(msrest.serialization.Model): +class ManagedClusterIdentity(_serialization.Model): """Identity for the managed cluster. Variables are only populated by the server, and will be ignored when sending a request. @@ -2171,41 +2136,36 @@ class ManagedClusterIdentity(msrest.serialization.Model): :ivar type: The type of identity used for the managed cluster. Type 'SystemAssigned' will use an implicitly created identity in master components and an auto-created user assigned identity in MC_ resource group in agent nodes. Type 'None' will not use MSI for the managed cluster, - service principal will be used instead. Known values are: "SystemAssigned", "None". + service principal will be used instead. Known values are: "SystemAssigned" and "None". :vartype type: str or ~azure.mgmt.containerservice.v2020_01_01.models.ResourceIdentityType """ _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, + "principal_id": {"readonly": True}, + "tenant_id": {"readonly": True}, } _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, + "principal_id": {"key": "principalId", "type": "str"}, + "tenant_id": {"key": "tenantId", "type": "str"}, + "type": {"key": "type", "type": "str"}, } - def __init__( - self, - *, - type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, - **kwargs - ): + def __init__(self, *, type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, **kwargs): """ :keyword type: The type of identity used for the managed cluster. Type 'SystemAssigned' will use an implicitly created identity in master components and an auto-created user assigned identity in MC_ resource group in agent nodes. Type 'None' will not use MSI for the managed - cluster, service principal will be used instead. Known values are: "SystemAssigned", "None". + cluster, service principal will be used instead. Known values are: "SystemAssigned" and "None". :paramtype type: str or ~azure.mgmt.containerservice.v2020_01_01.models.ResourceIdentityType """ - super(ManagedClusterIdentity, self).__init__(**kwargs) + super().__init__(**kwargs) self.principal_id = None self.tenant_id = None self.type = type -class ManagedClusterListResult(msrest.serialization.Model): +class ManagedClusterListResult(_serialization.Model): """The response from the List Managed Clusters operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -2217,30 +2177,25 @@ class ManagedClusterListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[ManagedCluster]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[ManagedCluster]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.ManagedCluster"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.ManagedCluster"]] = None, **kwargs): """ :keyword value: The list of managed clusters. :paramtype value: list[~azure.mgmt.containerservice.v2020_01_01.models.ManagedCluster] """ - super(ManagedClusterListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class ManagedClusterLoadBalancerProfile(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfile(_serialization.Model): """Profile of the managed cluster load balancer. :ivar managed_outbound_i_ps: Desired managed outbound IPs for the cluster load balancer. @@ -2266,17 +2221,23 @@ class ManagedClusterLoadBalancerProfile(msrest.serialization.Model): """ _validation = { - 'allocated_outbound_ports': {'maximum': 64000, 'minimum': 0}, - 'idle_timeout_in_minutes': {'maximum': 120, 'minimum': 4}, + "allocated_outbound_ports": {"maximum": 64000, "minimum": 0}, + "idle_timeout_in_minutes": {"maximum": 120, "minimum": 4}, } _attribute_map = { - 'managed_outbound_i_ps': {'key': 'managedOutboundIPs', 'type': 'ManagedClusterLoadBalancerProfileManagedOutboundIPs'}, - 'outbound_ip_prefixes': {'key': 'outboundIPPrefixes', 'type': 'ManagedClusterLoadBalancerProfileOutboundIPPrefixes'}, - 'outbound_i_ps': {'key': 'outboundIPs', 'type': 'ManagedClusterLoadBalancerProfileOutboundIPs'}, - 'effective_outbound_i_ps': {'key': 'effectiveOutboundIPs', 'type': '[ResourceReference]'}, - 'allocated_outbound_ports': {'key': 'allocatedOutboundPorts', 'type': 'int'}, - 'idle_timeout_in_minutes': {'key': 'idleTimeoutInMinutes', 'type': 'int'}, + "managed_outbound_i_ps": { + "key": "managedOutboundIPs", + "type": "ManagedClusterLoadBalancerProfileManagedOutboundIPs", + }, + "outbound_ip_prefixes": { + "key": "outboundIPPrefixes", + "type": "ManagedClusterLoadBalancerProfileOutboundIPPrefixes", + }, + "outbound_i_ps": {"key": "outboundIPs", "type": "ManagedClusterLoadBalancerProfileOutboundIPs"}, + "effective_outbound_i_ps": {"key": "effectiveOutboundIPs", "type": "[ResourceReference]"}, + "allocated_outbound_ports": {"key": "allocatedOutboundPorts", "type": "int"}, + "idle_timeout_in_minutes": {"key": "idleTimeoutInMinutes", "type": "int"}, } def __init__( @@ -2286,8 +2247,8 @@ def __init__( outbound_ip_prefixes: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPPrefixes"] = None, outbound_i_ps: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPs"] = None, effective_outbound_i_ps: Optional[List["_models.ResourceReference"]] = None, - allocated_outbound_ports: Optional[int] = 0, - idle_timeout_in_minutes: Optional[int] = 30, + allocated_outbound_ports: int = 0, + idle_timeout_in_minutes: int = 30, **kwargs ): """ @@ -2313,7 +2274,7 @@ def __init__( must be in the range of 4 to 120 (inclusive). The default value is 30 minutes. :paramtype idle_timeout_in_minutes: int """ - super(ManagedClusterLoadBalancerProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.managed_outbound_i_ps = managed_outbound_i_ps self.outbound_ip_prefixes = outbound_ip_prefixes self.outbound_i_ps = outbound_i_ps @@ -2322,7 +2283,7 @@ def __init__( self.idle_timeout_in_minutes = idle_timeout_in_minutes -class ManagedClusterLoadBalancerProfileManagedOutboundIPs(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfileManagedOutboundIPs(_serialization.Model): """Desired managed outbound IPs for the cluster load balancer. :ivar count: Desired number of outbound IP created/managed by Azure for the cluster load @@ -2331,29 +2292,24 @@ class ManagedClusterLoadBalancerProfileManagedOutboundIPs(msrest.serialization.M """ _validation = { - 'count': {'maximum': 100, 'minimum': 1}, + "count": {"maximum": 100, "minimum": 1}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, + "count": {"key": "count", "type": "int"}, } - def __init__( - self, - *, - count: Optional[int] = 1, - **kwargs - ): + def __init__(self, *, count: int = 1, **kwargs): """ :keyword count: Desired number of outbound IP created/managed by Azure for the cluster load balancer. Allowed values must be in the range of 1 to 100 (inclusive). The default value is 1. :paramtype count: int """ - super(ManagedClusterLoadBalancerProfileManagedOutboundIPs, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count -class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(_serialization.Model): """Desired outbound IP Prefix resources for the cluster load balancer. :ivar public_ip_prefixes: A list of public IP prefix resources. @@ -2362,25 +2318,20 @@ class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(msrest.serialization.M """ _attribute_map = { - 'public_ip_prefixes': {'key': 'publicIPPrefixes', 'type': '[ResourceReference]'}, + "public_ip_prefixes": {"key": "publicIPPrefixes", "type": "[ResourceReference]"}, } - def __init__( - self, - *, - public_ip_prefixes: Optional[List["_models.ResourceReference"]] = None, - **kwargs - ): + def __init__(self, *, public_ip_prefixes: Optional[List["_models.ResourceReference"]] = None, **kwargs): """ :keyword public_ip_prefixes: A list of public IP prefix resources. :paramtype public_ip_prefixes: list[~azure.mgmt.containerservice.v2020_01_01.models.ResourceReference] """ - super(ManagedClusterLoadBalancerProfileOutboundIPPrefixes, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_ip_prefixes = public_ip_prefixes -class ManagedClusterLoadBalancerProfileOutboundIPs(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfileOutboundIPs(_serialization.Model): """Desired outbound IP resources for the cluster load balancer. :ivar public_i_ps: A list of public IP resources. @@ -2388,34 +2339,29 @@ class ManagedClusterLoadBalancerProfileOutboundIPs(msrest.serialization.Model): """ _attribute_map = { - 'public_i_ps': {'key': 'publicIPs', 'type': '[ResourceReference]'}, + "public_i_ps": {"key": "publicIPs", "type": "[ResourceReference]"}, } - def __init__( - self, - *, - public_i_ps: Optional[List["_models.ResourceReference"]] = None, - **kwargs - ): + def __init__(self, *, public_i_ps: Optional[List["_models.ResourceReference"]] = None, **kwargs): """ :keyword public_i_ps: A list of public IP resources. :paramtype public_i_ps: list[~azure.mgmt.containerservice.v2020_01_01.models.ResourceReference] """ - super(ManagedClusterLoadBalancerProfileOutboundIPs, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_i_ps = public_i_ps -class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): +class ManagedClusterPoolUpgradeProfile(_serialization.Model): """The list of available upgrade versions. All required parameters must be populated in order to send to Azure. - :ivar kubernetes_version: Required. Kubernetes version (major, minor, patch). + :ivar kubernetes_version: Kubernetes version (major, minor, patch). Required. :vartype kubernetes_version: str :ivar name: Pool name. :vartype name: str - :ivar os_type: Required. OsType to be used to specify os type. Choose from Linux and Windows. - Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to + Linux. Known values are: "Linux" and "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2020_01_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -2423,15 +2369,15 @@ class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): """ _validation = { - 'kubernetes_version': {'required': True}, - 'os_type': {'required': True}, + "kubernetes_version": {"required": True}, + "os_type": {"required": True}, } _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'upgrades': {'key': 'upgrades', 'type': '[ManagedClusterPoolUpgradeProfileUpgradesItem]'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "os_type": {"key": "osType", "type": "str"}, + "upgrades": {"key": "upgrades", "type": "[ManagedClusterPoolUpgradeProfileUpgradesItem]"}, } def __init__( @@ -2444,25 +2390,25 @@ def __init__( **kwargs ): """ - :keyword kubernetes_version: Required. Kubernetes version (major, minor, patch). + :keyword kubernetes_version: Kubernetes version (major, minor, patch). Required. :paramtype kubernetes_version: str :keyword name: Pool name. :paramtype name: str - :keyword os_type: Required. OsType to be used to specify os type. Choose from Linux and - Windows. Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default + to Linux. Known values are: "Linux" and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2020_01_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: list[~azure.mgmt.containerservice.v2020_01_01.models.ManagedClusterPoolUpgradeProfileUpgradesItem] """ - super(ManagedClusterPoolUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.name = name self.os_type = os_type self.upgrades = upgrades -class ManagedClusterPoolUpgradeProfileUpgradesItem(msrest.serialization.Model): +class ManagedClusterPoolUpgradeProfileUpgradesItem(_serialization.Model): """ManagedClusterPoolUpgradeProfileUpgradesItem. :ivar kubernetes_version: Kubernetes version (major, minor, patch). @@ -2472,24 +2418,18 @@ class ManagedClusterPoolUpgradeProfileUpgradesItem(msrest.serialization.Model): """ _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } - def __init__( - self, - *, - kubernetes_version: Optional[str] = None, - is_preview: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, kubernetes_version: Optional[str] = None, is_preview: Optional[bool] = None, **kwargs): """ :keyword kubernetes_version: Kubernetes version (major, minor, patch). :paramtype kubernetes_version: str :keyword is_preview: Whether Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(ManagedClusterPoolUpgradeProfileUpgradesItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.is_preview = is_preview @@ -2506,9 +2446,9 @@ class ManagedClusterPropertiesIdentityProfileValue(UserAssignedIdentity): """ _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'object_id': {'key': 'objectId', 'type': 'str'}, + "resource_id": {"key": "resourceId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + "object_id": {"key": "objectId", "type": "str"}, } def __init__( @@ -2527,48 +2467,42 @@ def __init__( :keyword object_id: The object id of the user assigned identity. :paramtype object_id: str """ - super(ManagedClusterPropertiesIdentityProfileValue, self).__init__(resource_id=resource_id, client_id=client_id, object_id=object_id, **kwargs) + super().__init__(resource_id=resource_id, client_id=client_id, object_id=object_id, **kwargs) -class ManagedClusterServicePrincipalProfile(msrest.serialization.Model): +class ManagedClusterServicePrincipalProfile(_serialization.Model): """Information about a service principal identity for the cluster to use for manipulating Azure APIs. All required parameters must be populated in order to send to Azure. - :ivar client_id: Required. The ID for the service principal. + :ivar client_id: The ID for the service principal. Required. :vartype client_id: str :ivar secret: The secret password associated with the service principal in plain text. :vartype secret: str """ _validation = { - 'client_id': {'required': True}, + "client_id": {"required": True}, } _attribute_map = { - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'secret': {'key': 'secret', 'type': 'str'}, + "client_id": {"key": "clientId", "type": "str"}, + "secret": {"key": "secret", "type": "str"}, } - def __init__( - self, - *, - client_id: str, - secret: Optional[str] = None, - **kwargs - ): + def __init__(self, *, client_id: str, secret: Optional[str] = None, **kwargs): """ - :keyword client_id: Required. The ID for the service principal. + :keyword client_id: The ID for the service principal. Required. :paramtype client_id: str :keyword secret: The secret password associated with the service principal in plain text. :paramtype secret: str """ - super(ManagedClusterServicePrincipalProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.client_id = client_id self.secret = secret -class ManagedClusterUpgradeProfile(msrest.serialization.Model): +class ManagedClusterUpgradeProfile(_serialization.Model): """The list of available upgrades for compute pools. Variables are only populated by the server, and will be ignored when sending a request. @@ -2581,29 +2515,29 @@ class ManagedClusterUpgradeProfile(msrest.serialization.Model): :vartype name: str :ivar type: Type of upgrade profile. :vartype type: str - :ivar control_plane_profile: Required. The list of available upgrade versions for the control - plane. + :ivar control_plane_profile: The list of available upgrade versions for the control plane. + Required. :vartype control_plane_profile: ~azure.mgmt.containerservice.v2020_01_01.models.ManagedClusterPoolUpgradeProfile - :ivar agent_pool_profiles: Required. The list of available upgrade versions for agent pools. + :ivar agent_pool_profiles: The list of available upgrade versions for agent pools. Required. :vartype agent_pool_profiles: list[~azure.mgmt.containerservice.v2020_01_01.models.ManagedClusterPoolUpgradeProfile] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'control_plane_profile': {'required': True}, - 'agent_pool_profiles': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "control_plane_profile": {"required": True}, + "agent_pool_profiles": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'control_plane_profile': {'key': 'properties.controlPlaneProfile', 'type': 'ManagedClusterPoolUpgradeProfile'}, - 'agent_pool_profiles': {'key': 'properties.agentPoolProfiles', 'type': '[ManagedClusterPoolUpgradeProfile]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "control_plane_profile": {"key": "properties.controlPlaneProfile", "type": "ManagedClusterPoolUpgradeProfile"}, + "agent_pool_profiles": {"key": "properties.agentPoolProfiles", "type": "[ManagedClusterPoolUpgradeProfile]"}, } def __init__( @@ -2614,15 +2548,15 @@ def __init__( **kwargs ): """ - :keyword control_plane_profile: Required. The list of available upgrade versions for the - control plane. + :keyword control_plane_profile: The list of available upgrade versions for the control plane. + Required. :paramtype control_plane_profile: ~azure.mgmt.containerservice.v2020_01_01.models.ManagedClusterPoolUpgradeProfile - :keyword agent_pool_profiles: Required. The list of available upgrade versions for agent pools. + :keyword agent_pool_profiles: The list of available upgrade versions for agent pools. Required. :paramtype agent_pool_profiles: list[~azure.mgmt.containerservice.v2020_01_01.models.ManagedClusterPoolUpgradeProfile] """ - super(ManagedClusterUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -2630,18 +2564,18 @@ def __init__( self.agent_pool_profiles = agent_pool_profiles -class ManagedClusterWindowsProfile(msrest.serialization.Model): +class ManagedClusterWindowsProfile(_serialization.Model): """Profile for Windows VMs in the container service cluster. All required parameters must be populated in order to send to Azure. - :ivar admin_username: Required. Specifies the name of the administrator account. - :code:`
`:code:`
` **restriction:** Cannot end in "." :code:`
`:code:`
` - **Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", "test1", - "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", - "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", - "sys", "test2", "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 - character :code:`
`:code:`
` **Max-length:** 20 characters. + :ivar admin_username: Specifies the name of the administrator account. :code:`
`:code:`
` + **restriction:** Cannot end in "." :code:`
`:code:`
` **Disallowed values:** + "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", + "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", + "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", + "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 character + :code:`
`:code:`
` **Max-length:** 20 characters. Required. :vartype admin_username: str :ivar admin_password: Specifies the password of the administrator account. :code:`
`:code:`
` **Minimum-length:** 8 characters :code:`
`:code:`
` @@ -2654,29 +2588,23 @@ class ManagedClusterWindowsProfile(msrest.serialization.Model): """ _validation = { - 'admin_username': {'required': True}, + "admin_username": {"required": True}, } _attribute_map = { - 'admin_username': {'key': 'adminUsername', 'type': 'str'}, - 'admin_password': {'key': 'adminPassword', 'type': 'str'}, + "admin_username": {"key": "adminUsername", "type": "str"}, + "admin_password": {"key": "adminPassword", "type": "str"}, } - def __init__( - self, - *, - admin_username: str, - admin_password: Optional[str] = None, - **kwargs - ): + def __init__(self, *, admin_username: str, admin_password: Optional[str] = None, **kwargs): """ - :keyword admin_username: Required. Specifies the name of the administrator account. + :keyword admin_username: Specifies the name of the administrator account. :code:`
`:code:`
` **restriction:** Cannot end in "." :code:`
`:code:`
` **Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 - character :code:`
`:code:`
` **Max-length:** 20 characters. + character :code:`
`:code:`
` **Max-length:** 20 characters. Required. :paramtype admin_username: str :keyword admin_password: Specifies the password of the administrator account. :code:`
`:code:`
` **Minimum-length:** 8 characters :code:`
`:code:`
` @@ -2687,12 +2615,12 @@ def __init__( "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!". :paramtype admin_password: str """ - super(ManagedClusterWindowsProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.admin_username = admin_username self.admin_password = admin_password -class OperationListResult(msrest.serialization.Model): +class OperationListResult(_serialization.Model): """The List Compute Operation operation response. Variables are only populated by the server, and will be ignored when sending a request. @@ -2702,24 +2630,20 @@ class OperationListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[OperationValue]'}, + "value": {"key": "value", "type": "[OperationValue]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(OperationListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None -class OperationValue(msrest.serialization.Model): +class OperationValue(_serialization.Model): """Describes the properties of a Compute Operation value. Variables are only populated by the server, and will be ignored when sending a request. @@ -2739,30 +2663,26 @@ class OperationValue(msrest.serialization.Model): """ _validation = { - 'origin': {'readonly': True}, - 'name': {'readonly': True}, - 'operation': {'readonly': True}, - 'resource': {'readonly': True}, - 'description': {'readonly': True}, - 'provider': {'readonly': True}, + "origin": {"readonly": True}, + "name": {"readonly": True}, + "operation": {"readonly": True}, + "resource": {"readonly": True}, + "description": {"readonly": True}, + "provider": {"readonly": True}, } _attribute_map = { - 'origin': {'key': 'origin', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'operation': {'key': 'display.operation', 'type': 'str'}, - 'resource': {'key': 'display.resource', 'type': 'str'}, - 'description': {'key': 'display.description', 'type': 'str'}, - 'provider': {'key': 'display.provider', 'type': 'str'}, + "origin": {"key": "origin", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "operation": {"key": "display.operation", "type": "str"}, + "resource": {"key": "display.resource", "type": "str"}, + "description": {"key": "display.description", "type": "str"}, + "provider": {"key": "display.provider", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(OperationValue, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.origin = None self.name = None self.operation = None @@ -2771,7 +2691,7 @@ def __init__( self.provider = None -class ResourceReference(msrest.serialization.Model): +class ResourceReference(_serialization.Model): """A reference to an Azure resource. :ivar id: The fully qualified Azure resource id. @@ -2779,43 +2699,33 @@ class ResourceReference(msrest.serialization.Model): """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, } - def __init__( - self, - *, - id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin """ :keyword id: The fully qualified Azure resource id. :paramtype id: str """ - super(ResourceReference, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id -class TagsObject(msrest.serialization.Model): +class TagsObject(_serialization.Model): """Tags object for patch operations. - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] """ _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] """ - super(TagsObject, self).__init__(**kwargs) + super().__init__(**kwargs) self.tags = tags diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/models/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/models/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/models/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/models/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/operations/__init__.py index 403c0174f052..ee6608454b6b 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/operations/__init__.py @@ -13,10 +13,11 @@ from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'Operations', - 'ManagedClustersOperations', - 'AgentPoolsOperations', + "Operations", + "ManagedClustersOperations", + "AgentPoolsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/operations/_agent_pools_operations.py index 10adc78a0b23..aec58265fe0a 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/operations/_agent_pools_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,249 +27,250 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - *, - json: Optional[_models.AgentPool] = None, - content: Any = None, - **kwargs: Any + _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, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + _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, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_get_upgrade_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_available_agent_pool_versions_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class AgentPoolsOperations: """ @@ -285,48 +291,40 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> Iterable[_models.AgentPoolListResult]: + def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> Iterable["_models.AgentPool"]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. The operation returns properties of each agent pool. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AgentPoolListResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_01_01.models.AgentPoolListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either AgentPool or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_01_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -334,16 +332,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -359,10 +352,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -372,54 +363,45 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore @distributed_trace def get( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPool: """Gets the agent pool. Gets the details of the agent pool by managed cluster and resource group. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPool, or the result of cls(response) + :return: AgentPool or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_01_01.models.AgentPool - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -427,57 +409,60 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore def _create_or_update_initial( self, resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: _models.AgentPool, + parameters: Union[_models.AgentPool, IO], **kwargs: Any ) -> _models.AgentPool: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - _json = self._serialize.body(parameters, 'AgentPool') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "AgentPool") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -485,10 +470,9 @@ def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -496,40 +480,86 @@ def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - - @distributed_trace + @overload def begin_create_or_update( self, resource_group_name: str, resource_name: str, agent_pool_name: str, parameters: _models.AgentPool, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.AgentPool]: """Creates or updates an agent pool. Creates or updates an agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :param parameters: Parameters supplied to the Create or Update an agent pool operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2020_01_01.models.AgentPool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_01_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AgentPool]: + """Creates or updates an agent pool. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: Parameters supplied to the Create or Update an agent pool operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -541,20 +571,56 @@ def begin_create_or_update( :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_01_01.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: Union[_models.AgentPool, IO], + **kwargs: Any + ) -> LROPoller[_models.AgentPool]: + """Creates or updates an agent pool. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: Parameters supplied to the Create or Update an agent pool operation. Is + either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2020_01_01.models.AgentPool or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_01_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -563,66 +629,55 @@ def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -630,10 +685,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -643,26 +697,21 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + def begin_delete( + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> LROPoller[None]: """Deletes an agent pool. Deletes the agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -674,100 +723,86 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPoolUpgradeProfile: """Gets upgrade profile for an agent pool. Gets the details of the upgrade profile for an agent pool with a specified resource group and managed cluster name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolUpgradeProfile, or the result of cls(response) + :return: AgentPoolUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_01_01.models.AgentPoolUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -775,64 +810,56 @@ def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolUpgradeProfile', pipeline_response) + deserialized = self._deserialize("AgentPoolUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore @distributed_trace def get_available_agent_pool_versions( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported versions for the specified agent pool. Gets a list of supported versions for the specified agent pool. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolAvailableVersions, or the result of cls(response) + :return: AgentPoolAvailableVersions or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_01_01.models.AgentPoolAvailableVersions - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolAvailableVersions] - request = build_get_available_agent_pool_versions_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_available_agent_pool_versions.metadata['url'], + template_url=self.get_available_agent_pool_versions.metadata["url"], headers=_headers, params=_params, ) @@ -840,22 +867,20 @@ def get_available_agent_pool_versions( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolAvailableVersions', pipeline_response) + deserialized = self._deserialize("AgentPoolAvailableVersions", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_available_agent_pool_versions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore - + get_available_agent_pool_versions.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/operations/_managed_clusters_operations.py index 02861423438a..b2a0d9394158 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/operations/_managed_clusters_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,557 +27,536 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters") + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters" + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_resource_group_request( - subscription_id: str, - resource_group_name: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters", + ) # 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', min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_upgrade_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_access_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, role_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 = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "roleName": _SERIALIZER.url("role_name", role_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "roleName": _SERIALIZER.url("role_name", role_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_admin_credentials_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_user_credentials_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_monitoring_user_credentials_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: + +def build_get_request(resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedCluster] = None, - content: Any = None, - **kwargs: Any +def build_create_or_update_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_update_tags_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.TagsObject] = None, - content: Any = None, - **kwargs: Any + +def build_update_tags_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + +def build_delete_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_reset_service_principal_profile_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedClusterServicePrincipalProfile] = None, - content: Any = None, - **kwargs: Any + +def build_reset_service_principal_profile_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_reset_aad_profile_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedClusterAADProfile] = None, - content: Any = None, - **kwargs: Any +def build_reset_aad_profile_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_rotate_cluster_certificates_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any +def build_rotate_cluster_certificates_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + class ManagedClustersOperations: """ @@ -593,41 +577,35 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.ManagedClusterListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.ManagedCluster"]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. The operation returns properties of each managed cluster. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_01_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_01_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -635,14 +613,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -658,10 +633,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -671,50 +644,42 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> Iterable[_models.ManagedClusterListResult]: + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.ManagedCluster"]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. The operation returns properties of each managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_01_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_01_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -722,15 +687,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -746,10 +707,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -759,51 +718,43 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.ManagedClusterUpgradeProfile: """Gets upgrade profile for a managed cluster. Gets the details of the upgrade profile for a managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterUpgradeProfile, or the result of cls(response) + :return: ManagedClusterUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_01_01.models.ManagedClusterUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -811,69 +762,60 @@ def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterUpgradeProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore @distributed_trace def get_access_profile( - self, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, role_name: str, **kwargs: Any ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. Gets the accessProfile for the specified role name of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param role_name: The name of the role for managed cluster accessProfile resource. + :param role_name: The name of the role for managed cluster accessProfile resource. Required. :type role_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterAccessProfile, or the result of cls(response) + :return: ManagedClusterAccessProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_01_01.models.ManagedClusterAccessProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterAccessProfile] - request = build_get_access_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, role_name=role_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_access_profile.metadata['url'], + template_url=self.get_access_profile.metadata["url"], headers=_headers, params=_params, ) @@ -881,64 +823,56 @@ def get_access_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterAccessProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterAccessProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_access_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore - + get_access_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore @distributed_trace def list_cluster_admin_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster admin credential of a managed cluster. Gets cluster admin credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_01_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_admin_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_admin_credentials.metadata['url'], + template_url=self.list_cluster_admin_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -946,64 +880,56 @@ def list_cluster_admin_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_admin_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore - + list_cluster_admin_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore @distributed_trace def list_cluster_user_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster user credential of a managed cluster. Gets cluster user credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_01_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_user_credentials.metadata['url'], + template_url=self.list_cluster_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -1011,65 +937,57 @@ def list_cluster_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore - + list_cluster_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore @distributed_trace def list_cluster_monitoring_user_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster monitoring user credential of a managed cluster. Gets cluster monitoring user credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_01_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_monitoring_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + template_url=self.list_cluster_monitoring_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -1077,64 +995,54 @@ def list_cluster_monitoring_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_monitoring_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore - + list_cluster_monitoring_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore @distributed_trace - def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.ManagedCluster: + def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.ManagedCluster: """Gets a managed cluster. Gets the details of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedCluster, or the result of cls(response) + :return: ManagedCluster or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_01_01.models.ManagedCluster - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -1142,55 +1050,54 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _create_or_update_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.ManagedCluster, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'ManagedCluster') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedCluster") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1198,10 +1105,9 @@ def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -1209,25 +1115,26 @@ def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - @distributed_trace + @overload def begin_create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedCluster, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. @@ -1235,12 +1142,16 @@ def begin_create_or_update( Creates or updates a managed cluster with the specified configuration for agents and Kubernetes version. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2020_01_01.models.ManagedCluster + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1253,20 +1164,91 @@ def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_01_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster with the specified configuration for agents and Kubernetes + version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_01_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster with the specified configuration for agents and Kubernetes + version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. Is + either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2020_01_01.models.ManagedCluster or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_01_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -1274,69 +1256,66 @@ def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _update_tags_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.TagsObject, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request_initial( - subscription_id=self._config.subscription_id, + request = build_update_tags_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_tags_initial.metadata['url'], + content=_content, + template_url=self._update_tags_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1344,44 +1323,118 @@ def _update_tags_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_tags_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _update_tags_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - @distributed_trace + @overload def begin_update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates a managed cluster with the specified tags. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2020_01_01.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_01_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates a managed cluster with the specified tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_01_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates a managed cluster with the specified tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2020_01_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1394,20 +1447,17 @@ def begin_update_tags( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_01_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, @@ -1415,64 +1465,54 @@ def begin_update_tags( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1480,10 +1520,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1493,23 +1532,17 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> LROPoller[None]: + def begin_delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> LROPoller[None]: """Deletes a managed cluster. Deletes the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1521,85 +1554,83 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterServicePrincipalProfile, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterServicePrincipalProfile") - request = build_reset_service_principal_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_service_principal_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_service_principal_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_service_principal_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1607,10 +1638,9 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1620,29 +1650,106 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re if cls: return cls(pipeline_response, None, {}) - _reset_service_principal_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore - + _reset_service_principal_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore - @distributed_trace - def begin_reset_service_principal_profile( # pylint: disable=inconsistent-return-statements + @overload + def begin_reset_service_principal_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterServicePrincipalProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: """Reset Service Principal Profile of a managed cluster. Update the service principal Profile for a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a - Managed Cluster. + Managed Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2020_01_01.models.ManagedClusterServicePrincipalProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reset Service Principal Profile of a managed cluster. + + Update the service principal Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a + Managed Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Reset Service Principal Profile of a managed cluster. + + Update the service principal Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a + Managed Cluster. Is either a model type or a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2020_01_01.models.ManagedClusterServicePrincipalProfile or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1653,20 +1760,17 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1674,67 +1778,68 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_service_principal_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + begin_reset_service_principal_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterAADProfile, + parameters: Union[_models.ManagedClusterAADProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterAADProfile") - request = build_reset_aad_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_aad_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_aad_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_aad_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1742,10 +1847,9 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1755,28 +1859,32 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement if cls: return cls(pipeline_response, None, {}) - _reset_aad_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - + _reset_aad_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - @distributed_trace - def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements + @overload + def begin_reset_aad_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterAADProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: """Reset AAD Profile of a managed cluster. Update the AAD Profile for a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed - Cluster. + Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2020_01_01.models.ManagedClusterAADProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1787,20 +1895,90 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reset AAD Profile of a managed cluster. + + Update the AAD Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed + Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterAADProfile, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Reset AAD Profile of a managed cluster. + + Update the AAD Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed + Cluster. Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2020_01_01.models.ManagedClusterAADProfile or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1808,62 +1986,52 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_aad_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + begin_reset_aad_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_rotate_cluster_certificates_request_initial( - subscription_id=self._config.subscription_id, + request = build_rotate_cluster_certificates_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._rotate_cluster_certificates_initial.metadata['url'], + template_url=self._rotate_cluster_certificates_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1871,10 +2039,9 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1884,23 +2051,19 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return if cls: return cls(pipeline_response, None, {}) - _rotate_cluster_certificates_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore - + _rotate_cluster_certificates_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore @distributed_trace - def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + def begin_rotate_cluster_certificates( + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> LROPoller[None]: """Rotate certificates of a managed cluster. Rotate certificates of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1912,52 +2075,45 @@ def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-st Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._rotate_cluster_certificates_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_rotate_cluster_certificates.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore + begin_rotate_cluster_certificates.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/operations/_operations.py index 37be3ae467f6..11ac5b52b57f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/operations/_operations.py @@ -7,10 +7,15 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,38 +25,34 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - **kwargs: Any -) -> HttpRequest: + +def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.ContainerService/operations") # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class Operations: """ @@ -72,36 +73,31 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.OperationListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.OperationValue"]: """Gets a list of compute operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationListResult or the result of cls(response) + :return: An iterator like instance of either OperationValue or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_01_01.models.OperationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_01_01.models.OperationValue] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -109,13 +105,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -131,10 +125,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -144,8 +136,6 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.ContainerService/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ContainerService/operations"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/operations/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/__init__.py index 37a5f9e02e6f..a8716d29afe8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/__init__.py @@ -14,7 +14,8 @@ except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['ContainerServiceClient'] + +__all__ = ["ContainerServiceClient"] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/_configuration.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/_configuration.py index aeb8440e96da..fbfb956ecef0 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/_configuration.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/_configuration.py @@ -18,30 +18,26 @@ VERSION = "unknown" + class ContainerServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ContainerServiceClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2020-02-01". 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: + def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ContainerServiceClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2020-02-01") # type: str + api_version = kwargs.pop("api_version", "2020-02-01") # type: str if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -51,23 +47,24 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-containerservice/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-containerservice/{}".format(VERSION)) self._configure(**kwargs) def _configure( - self, - **kwargs # type: Any + self, **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/_container_service_client.py index f35376cde3d3..d078054932b8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/_container_service_client.py @@ -9,12 +9,11 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from . import models +from .._serialization import Deserializer, Serializer from ._configuration import ContainerServiceClientConfiguration from .operations import AgentPoolsOperations, ManagedClustersOperations, Operations @@ -22,7 +21,8 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class ContainerServiceClient: + +class ContainerServiceClient: # pylint: disable=client-accepts-api-version-keyword """The Container Service Client. :ivar operations: Operations operations @@ -32,10 +32,10 @@ class ContainerServiceClient: azure.mgmt.containerservice.v2020_02_01.operations.ManagedClustersOperations :ivar agent_pools: AgentPoolsOperations operations :vartype agent_pools: azure.mgmt.containerservice.v2020_02_01.operations.AgentPoolsOperations - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -53,29 +53,22 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = ContainerServiceClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = ContainerServiceClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize - ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.managed_clusters = ManagedClustersOperations( self._client, self._config, self._serialize, self._deserialize ) - self.agent_pools = AgentPoolsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - + self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> HttpResponse: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -84,7 +77,7 @@ def _send_request( >>> response = client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/_metadata.json b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/_metadata.json index ca9bc65d6334..70a853c8dbbf 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/_metadata.json +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/_metadata.json @@ -10,20 +10,20 @@ "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { "credential": { - "signature": "credential, # type: \"TokenCredential\"", - "description": "Credential needed for the client to connect to Azure.", + "signature": "credential: \"TokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true }, "subscription_id": { - "signature": "subscription_id, # type: str", - "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "signature": "subscription_id: str,", + "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.", "docstring_type": "str", "required": true } @@ -31,13 +31,13 @@ "async": { "credential": { "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure.", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { "signature": "subscription_id: str,", - "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.", "docstring_type": "str", "required": true } @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=\"https://management.azure.com\", # type: str", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/_patch.py index 74e48ecd07cf..f99e77fef986 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/_patch.py @@ -28,4 +28,4 @@ # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + pass diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/_vendor.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/_vendor.py index 138f663c53a4..9aad73fc743e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/_vendor.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/_vendor.py @@ -7,6 +7,7 @@ from azure.core.pipeline.transport import HttpRequest + def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) @@ -14,6 +15,7 @@ def _convert_request(request, files=None): request.set_formdata_body(files) return request + def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -21,7 +23,5 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [ - c for c in formatted_components if "{}".format(key.args[0]) not in c - ] + components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/aio/__init__.py index 37a5f9e02e6f..a8716d29afe8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/aio/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/aio/__init__.py @@ -14,7 +14,8 @@ except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['ContainerServiceClient'] + +__all__ = ["ContainerServiceClient"] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/aio/_configuration.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/aio/_configuration.py index 1bef1391ba70..d1c4af7689e0 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/aio/_configuration.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/aio/_configuration.py @@ -18,30 +18,26 @@ VERSION = "unknown" + class ContainerServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ContainerServiceClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2020-02-01". 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: + def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ContainerServiceClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2020-02-01") # type: str + api_version = kwargs.pop("api_version", "2020-02-01") # type: str if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -51,22 +47,21 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-containerservice/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-containerservice/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, - **kwargs: Any - ) -> None: - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/aio/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/aio/_container_service_client.py index 7db5f15edb2d..75dee02b896c 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/aio/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/aio/_container_service_client.py @@ -9,12 +9,11 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from .. import models +from ..._serialization import Deserializer, Serializer from ._configuration import ContainerServiceClientConfiguration from .operations import AgentPoolsOperations, ManagedClustersOperations, Operations @@ -22,7 +21,8 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class ContainerServiceClient: + +class ContainerServiceClient: # pylint: disable=client-accepts-api-version-keyword """The Container Service Client. :ivar operations: Operations operations @@ -33,10 +33,10 @@ class ContainerServiceClient: :ivar agent_pools: AgentPoolsOperations operations :vartype agent_pools: azure.mgmt.containerservice.v2020_02_01.aio.operations.AgentPoolsOperations - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -54,29 +54,22 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = ContainerServiceClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = ContainerServiceClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize - ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.managed_clusters = ManagedClustersOperations( self._client, self._config, self._serialize, self._deserialize ) - self.agent_pools = AgentPoolsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - + self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -85,7 +78,7 @@ def _send_request( >>> response = await client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/aio/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/aio/_patch.py index 74e48ecd07cf..f99e77fef986 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/aio/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/aio/_patch.py @@ -28,4 +28,4 @@ # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + pass diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/aio/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/aio/operations/__init__.py index 403c0174f052..ee6608454b6b 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/aio/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/aio/operations/__init__.py @@ -13,10 +13,11 @@ from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'Operations', - 'ManagedClustersOperations', - 'AgentPoolsOperations', + "Operations", + "ManagedClustersOperations", + "AgentPoolsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/aio/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/aio/operations/_agent_pools_operations.py index 88fd6e5a069a..b4758a1ea7ad 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/aio/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/aio/operations/_agent_pools_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +29,19 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._agent_pools_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_available_agent_pool_versions_request, build_get_request, build_get_upgrade_profile_request, build_list_request -T = TypeVar('T') +from ...operations._agent_pools_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_available_agent_pool_versions_request, + build_get_request, + build_get_upgrade_profile_request, + build_list_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class AgentPoolsOperations: """ .. warning:: @@ -45,48 +61,41 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.AgentPoolListResult]: + def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncIterable["_models.AgentPool"]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. The operation returns properties of each agent pool. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AgentPoolListResult or the result of cls(response) + :return: An iterator like instance of either AgentPool or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_02_01.models.AgentPoolListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_02_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -94,16 +103,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -119,10 +123,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -132,54 +134,45 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore @distributed_trace_async async def get( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPool: """Gets the agent pool. Gets the details of the agent pool by managed cluster and resource group. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPool, or the result of cls(response) + :return: AgentPool or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_02_01.models.AgentPool - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -187,57 +180,60 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore async def _create_or_update_initial( self, resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: _models.AgentPool, + parameters: Union[_models.AgentPool, IO], **kwargs: Any ) -> _models.AgentPool: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - _json = self._serialize.body(parameters, 'AgentPool') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "AgentPool") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -245,10 +241,9 @@ async def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -256,40 +251,45 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - - @distributed_trace_async + @overload async def begin_create_or_update( self, resource_group_name: str, resource_name: str, agent_pool_name: str, parameters: _models.AgentPool, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.AgentPool]: """Creates or updates an agent pool. Creates or updates an agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :param parameters: Parameters supplied to the Create or Update an agent pool operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2020_02_01.models.AgentPool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -302,20 +302,99 @@ async def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_02_01.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AgentPool]: + """Creates or updates an agent pool. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: Parameters supplied to the Create or Update an agent pool operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AgentPool or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_02_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: Union[_models.AgentPool, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.AgentPool]: + """Creates or updates an agent pool. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: Parameters supplied to the Create or Update an agent pool operation. Is + either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2020_02_01.models.AgentPool or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AgentPool or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_02_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -324,66 +403,55 @@ async def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -391,10 +459,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -404,26 +471,21 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + async def begin_delete( + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes an agent pool. Deletes the agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -435,100 +497,86 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace_async async def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPoolUpgradeProfile: """Gets upgrade profile for an agent pool. Gets the details of the upgrade profile for an agent pool with a specified resource group and managed cluster name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolUpgradeProfile, or the result of cls(response) + :return: AgentPoolUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_02_01.models.AgentPoolUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -536,64 +584,56 @@ async def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolUpgradeProfile', pipeline_response) + deserialized = self._deserialize("AgentPoolUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore @distributed_trace_async async def get_available_agent_pool_versions( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported versions for the specified agent pool. Gets a list of supported versions for the specified agent pool. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolAvailableVersions, or the result of cls(response) + :return: AgentPoolAvailableVersions or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_02_01.models.AgentPoolAvailableVersions - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolAvailableVersions] - request = build_get_available_agent_pool_versions_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_available_agent_pool_versions.metadata['url'], + template_url=self.get_available_agent_pool_versions.metadata["url"], headers=_headers, params=_params, ) @@ -601,22 +641,20 @@ async def get_available_agent_pool_versions( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolAvailableVersions', pipeline_response) + deserialized = self._deserialize("AgentPoolAvailableVersions", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_available_agent_pool_versions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore - + get_available_agent_pool_versions.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/aio/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/aio/operations/_managed_clusters_operations.py index 2ff63228fb1f..68346523fcda 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/aio/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/aio/operations/_managed_clusters_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +29,27 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._managed_clusters_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_access_profile_request, build_get_request, build_get_upgrade_profile_request, build_list_by_resource_group_request, build_list_cluster_admin_credentials_request, build_list_cluster_monitoring_user_credentials_request, build_list_cluster_user_credentials_request, build_list_request, build_reset_aad_profile_request_initial, build_reset_service_principal_profile_request_initial, build_rotate_cluster_certificates_request_initial, build_update_tags_request_initial -T = TypeVar('T') +from ...operations._managed_clusters_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_access_profile_request, + build_get_request, + build_get_upgrade_profile_request, + build_list_by_resource_group_request, + build_list_cluster_admin_credentials_request, + build_list_cluster_monitoring_user_credentials_request, + build_list_cluster_user_credentials_request, + build_list_request, + build_reset_aad_profile_request, + build_reset_service_principal_profile_request, + build_rotate_cluster_certificates_request, + build_update_tags_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class ManagedClustersOperations: """ .. warning:: @@ -45,41 +69,35 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.ManagedClusterListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.ManagedCluster"]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. The operation returns properties of each managed cluster. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_02_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_02_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -87,14 +105,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -110,10 +125,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -123,50 +136,44 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.ManagedClusterListResult]: + self, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ManagedCluster"]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. The operation returns properties of each managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_02_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_02_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -174,15 +181,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -198,10 +201,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -211,51 +212,43 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace_async async def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.ManagedClusterUpgradeProfile: """Gets upgrade profile for a managed cluster. Gets the details of the upgrade profile for a managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterUpgradeProfile, or the result of cls(response) + :return: ManagedClusterUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_02_01.models.ManagedClusterUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -263,69 +256,60 @@ async def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterUpgradeProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore @distributed_trace_async async def get_access_profile( - self, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, role_name: str, **kwargs: Any ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. Gets the accessProfile for the specified role name of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param role_name: The name of the role for managed cluster accessProfile resource. + :param role_name: The name of the role for managed cluster accessProfile resource. Required. :type role_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterAccessProfile, or the result of cls(response) + :return: ManagedClusterAccessProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_02_01.models.ManagedClusterAccessProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterAccessProfile] - request = build_get_access_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, role_name=role_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_access_profile.metadata['url'], + template_url=self.get_access_profile.metadata["url"], headers=_headers, params=_params, ) @@ -333,64 +317,56 @@ async def get_access_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterAccessProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterAccessProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_access_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore - + get_access_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore @distributed_trace_async async def list_cluster_admin_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster admin credential of a managed cluster. Gets cluster admin credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_02_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_admin_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_admin_credentials.metadata['url'], + template_url=self.list_cluster_admin_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -398,64 +374,56 @@ async def list_cluster_admin_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_admin_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore - + list_cluster_admin_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore @distributed_trace_async async def list_cluster_user_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster user credential of a managed cluster. Gets cluster user credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_02_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_user_credentials.metadata['url'], + template_url=self.list_cluster_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -463,65 +431,57 @@ async def list_cluster_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore - + list_cluster_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore @distributed_trace_async async def list_cluster_monitoring_user_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster monitoring user credential of a managed cluster. Gets cluster monitoring user credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_02_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_monitoring_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + template_url=self.list_cluster_monitoring_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -529,64 +489,54 @@ async def list_cluster_monitoring_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_monitoring_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore - + list_cluster_monitoring_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore @distributed_trace_async - async def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.ManagedCluster: + async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.ManagedCluster: """Gets a managed cluster. Gets the details of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedCluster, or the result of cls(response) + :return: ManagedCluster or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_02_01.models.ManagedCluster - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -594,55 +544,54 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _create_or_update_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.ManagedCluster, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'ManagedCluster') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedCluster") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -650,10 +599,9 @@ async def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -661,25 +609,26 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - @distributed_trace_async + @overload async def begin_create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedCluster, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. @@ -687,12 +636,90 @@ async def begin_create_or_update( Creates or updates a managed cluster with the specified configuration for agents and Kubernetes version. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2020_02_01.models.ManagedCluster + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_02_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster with the specified configuration for agents and Kubernetes + version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_02_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster with the specified configuration for agents and Kubernetes + version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. Is + either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2020_02_01.models.ManagedCluster or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -705,20 +732,17 @@ async def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_02_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -726,69 +750,66 @@ async def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _update_tags_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.TagsObject, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request_initial( - subscription_id=self._config.subscription_id, + request = build_update_tags_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_tags_initial.metadata['url'], + content=_content, + template_url=self._update_tags_initial.metadata["url"], headers=_headers, params=_params, ) @@ -796,44 +817,85 @@ async def _update_tags_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_tags_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _update_tags_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - @distributed_trace_async + @overload async def begin_update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates a managed cluster with the specified tags. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2020_02_01.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_02_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates a managed cluster with the specified tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -846,20 +908,50 @@ async def begin_update_tags( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_02_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates a managed cluster with the specified tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2020_02_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_02_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, @@ -867,64 +959,54 @@ async def begin_update_tags( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -932,10 +1014,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -945,23 +1026,17 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: + async def begin_delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Deletes a managed cluster. Deletes the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -973,85 +1048,83 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterServicePrincipalProfile, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterServicePrincipalProfile") - request = build_reset_service_principal_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_service_principal_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_service_principal_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_service_principal_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1059,10 +1132,9 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1072,29 +1144,106 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist if cls: return cls(pipeline_response, None, {}) - _reset_service_principal_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore - + _reset_service_principal_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore - @distributed_trace_async - async def begin_reset_service_principal_profile( # pylint: disable=inconsistent-return-statements + @overload + async def begin_reset_service_principal_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterServicePrincipalProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: """Reset Service Principal Profile of a managed cluster. Update the service principal Profile for a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a - Managed Cluster. + Managed Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2020_02_01.models.ManagedClusterServicePrincipalProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset Service Principal Profile of a managed cluster. + + Update the service principal Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a + Managed Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset Service Principal Profile of a managed cluster. + + Update the service principal Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a + Managed Cluster. Is either a model type or a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2020_02_01.models.ManagedClusterServicePrincipalProfile or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -1105,20 +1254,17 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1126,67 +1272,68 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_service_principal_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + begin_reset_service_principal_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterAADProfile, + parameters: Union[_models.ManagedClusterAADProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterAADProfile") - request = build_reset_aad_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_aad_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_aad_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_aad_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1194,10 +1341,9 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1207,28 +1353,69 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta if cls: return cls(pipeline_response, None, {}) - _reset_aad_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - + _reset_aad_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - @distributed_trace_async - async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements + @overload + async def begin_reset_aad_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterAADProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: """Reset AAD Profile of a managed cluster. Update the AAD Profile for a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed - Cluster. + Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2020_02_01.models.ManagedClusterAADProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset AAD Profile of a managed cluster. + + Update the AAD Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed + Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -1239,20 +1426,53 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterAADProfile, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset AAD Profile of a managed cluster. + + Update the AAD Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed + Cluster. Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2020_02_01.models.ManagedClusterAADProfile or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1260,62 +1480,52 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_aad_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + begin_reset_aad_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_rotate_cluster_certificates_request_initial( - subscription_id=self._config.subscription_id, + request = build_rotate_cluster_certificates_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._rotate_cluster_certificates_initial.metadata['url'], + template_url=self._rotate_cluster_certificates_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1323,10 +1533,9 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1336,23 +1545,19 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- if cls: return cls(pipeline_response, None, {}) - _rotate_cluster_certificates_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore - + _rotate_cluster_certificates_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore @distributed_trace_async - async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + async def begin_rotate_cluster_certificates( + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Rotate certificates of a managed cluster. Rotate certificates of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1364,52 +1569,45 @@ async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-ret Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._rotate_cluster_certificates_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_rotate_cluster_certificates.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore + begin_rotate_cluster_certificates.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/aio/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/aio/operations/_operations.py index 453f193b5b4a..c42c0d333b03 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/aio/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/aio/operations/_operations.py @@ -7,9 +7,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,9 +27,11 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._operations import build_list_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class Operations: """ .. warning:: @@ -42,36 +51,31 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.OperationListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.OperationValue"]: """Gets a list of compute operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationListResult or the result of cls(response) + :return: An iterator like instance of either OperationValue or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_02_01.models.OperationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_02_01.models.OperationValue] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -79,13 +83,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -101,10 +103,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -114,8 +114,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.ContainerService/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ContainerService/operations"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/aio/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/aio/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/aio/operations/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/aio/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/models/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/models/__init__.py index d27b03c32a54..bca82cc587d8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/models/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/models/__init__.py @@ -51,83 +51,81 @@ from ._models_py3 import TagsObject from ._models_py3 import UserAssignedIdentity - -from ._container_service_client_enums import ( - AgentPoolType, - ContainerServiceStorageProfileTypes, - ContainerServiceVMSizeTypes, - Count, - LoadBalancerSku, - NetworkMode, - NetworkPlugin, - NetworkPolicy, - OSType, - OutboundType, - ResourceIdentityType, - ScaleSetEvictionPolicy, - ScaleSetPriority, -) +from ._container_service_client_enums import AgentPoolType +from ._container_service_client_enums import ContainerServiceStorageProfileTypes +from ._container_service_client_enums import ContainerServiceVMSizeTypes +from ._container_service_client_enums import Count +from ._container_service_client_enums import LoadBalancerSku +from ._container_service_client_enums import NetworkMode +from ._container_service_client_enums import NetworkPlugin +from ._container_service_client_enums import NetworkPolicy +from ._container_service_client_enums import OSType +from ._container_service_client_enums import OutboundType +from ._container_service_client_enums import ResourceIdentityType +from ._container_service_client_enums import ScaleSetEvictionPolicy +from ._container_service_client_enums import ScaleSetPriority from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'AgentPool', - 'AgentPoolAvailableVersions', - 'AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem', - 'AgentPoolListResult', - 'AgentPoolUpgradeProfile', - 'AgentPoolUpgradeProfilePropertiesUpgradesItem', - 'CloudErrorBody', - 'ContainerServiceDiagnosticsProfile', - 'ContainerServiceLinuxProfile', - 'ContainerServiceMasterProfile', - 'ContainerServiceNetworkProfile', - 'ContainerServiceSshConfiguration', - 'ContainerServiceSshPublicKey', - 'ContainerServiceVMDiagnostics', - 'CredentialResult', - 'CredentialResults', - 'ManagedCluster', - 'ManagedClusterAADProfile', - 'ManagedClusterAPIServerAccessProfile', - 'ManagedClusterAccessProfile', - 'ManagedClusterAddonProfile', - 'ManagedClusterAddonProfileIdentity', - 'ManagedClusterAgentPoolProfile', - 'ManagedClusterAgentPoolProfileProperties', - 'ManagedClusterIdentity', - 'ManagedClusterListResult', - 'ManagedClusterLoadBalancerProfile', - 'ManagedClusterLoadBalancerProfileManagedOutboundIPs', - 'ManagedClusterLoadBalancerProfileOutboundIPPrefixes', - 'ManagedClusterLoadBalancerProfileOutboundIPs', - 'ManagedClusterPoolUpgradeProfile', - 'ManagedClusterPoolUpgradeProfileUpgradesItem', - 'ManagedClusterPropertiesAutoScalerProfile', - 'ManagedClusterPropertiesIdentityProfileValue', - 'ManagedClusterServicePrincipalProfile', - 'ManagedClusterUpgradeProfile', - 'ManagedClusterWindowsProfile', - 'OperationListResult', - 'OperationValue', - 'Resource', - 'ResourceReference', - 'SubResource', - 'TagsObject', - 'UserAssignedIdentity', - 'AgentPoolType', - 'ContainerServiceStorageProfileTypes', - 'ContainerServiceVMSizeTypes', - 'Count', - 'LoadBalancerSku', - 'NetworkMode', - 'NetworkPlugin', - 'NetworkPolicy', - 'OSType', - 'OutboundType', - 'ResourceIdentityType', - 'ScaleSetEvictionPolicy', - 'ScaleSetPriority', + "AgentPool", + "AgentPoolAvailableVersions", + "AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem", + "AgentPoolListResult", + "AgentPoolUpgradeProfile", + "AgentPoolUpgradeProfilePropertiesUpgradesItem", + "CloudErrorBody", + "ContainerServiceDiagnosticsProfile", + "ContainerServiceLinuxProfile", + "ContainerServiceMasterProfile", + "ContainerServiceNetworkProfile", + "ContainerServiceSshConfiguration", + "ContainerServiceSshPublicKey", + "ContainerServiceVMDiagnostics", + "CredentialResult", + "CredentialResults", + "ManagedCluster", + "ManagedClusterAADProfile", + "ManagedClusterAPIServerAccessProfile", + "ManagedClusterAccessProfile", + "ManagedClusterAddonProfile", + "ManagedClusterAddonProfileIdentity", + "ManagedClusterAgentPoolProfile", + "ManagedClusterAgentPoolProfileProperties", + "ManagedClusterIdentity", + "ManagedClusterListResult", + "ManagedClusterLoadBalancerProfile", + "ManagedClusterLoadBalancerProfileManagedOutboundIPs", + "ManagedClusterLoadBalancerProfileOutboundIPPrefixes", + "ManagedClusterLoadBalancerProfileOutboundIPs", + "ManagedClusterPoolUpgradeProfile", + "ManagedClusterPoolUpgradeProfileUpgradesItem", + "ManagedClusterPropertiesAutoScalerProfile", + "ManagedClusterPropertiesIdentityProfileValue", + "ManagedClusterServicePrincipalProfile", + "ManagedClusterUpgradeProfile", + "ManagedClusterWindowsProfile", + "OperationListResult", + "OperationValue", + "Resource", + "ResourceReference", + "SubResource", + "TagsObject", + "UserAssignedIdentity", + "AgentPoolType", + "ContainerServiceStorageProfileTypes", + "ContainerServiceVMSizeTypes", + "Count", + "LoadBalancerSku", + "NetworkMode", + "NetworkPlugin", + "NetworkPolicy", + "OSType", + "OutboundType", + "ResourceIdentityType", + "ScaleSetEvictionPolicy", + "ScaleSetPriority", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/models/_container_service_client_enums.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/models/_container_service_client_enums.py index c85b3fdbf115..13ec83b0da71 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/models/_container_service_client_enums.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/models/_container_service_client_enums.py @@ -11,12 +11,12 @@ class AgentPoolType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """AgentPoolType represents types of an agent pool. - """ + """AgentPoolType represents types of an agent pool.""" VIRTUAL_MACHINE_SCALE_SETS = "VirtualMachineScaleSets" AVAILABILITY_SET = "AvailabilitySet" + class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the orchestrator choice. @@ -25,9 +25,9 @@ class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEn STORAGE_ACCOUNT = "StorageAccount" MANAGED_DISKS = "ManagedDisks" + class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Size of agent VMs. - """ + """Size of agent VMs.""" STANDARD_A1 = "Standard_A1" STANDARD_A10 = "Standard_A10" @@ -204,6 +204,7 @@ class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): STANDARD_NV24 = "Standard_NV24" STANDARD_NV6 = "Standard_NV6" + class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): """Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, and 5. The default value is 1. @@ -213,48 +214,49 @@ class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): THREE = 3 FIVE = 5 + class LoadBalancerSku(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The load balancer sku for the managed cluster. - """ + """The load balancer sku for the managed cluster.""" STANDARD = "standard" BASIC = "basic" + class NetworkMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Network mode used for building Kubernetes network. - """ + """Network mode used for building Kubernetes network.""" TRANSPARENT = "transparent" BRIDGE = "bridge" + class NetworkPlugin(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Network plugin used for building Kubernetes network. - """ + """Network plugin used for building Kubernetes network.""" AZURE = "azure" KUBENET = "kubenet" + class NetworkPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Network policy used for building Kubernetes network. - """ + """Network policy used for building Kubernetes network.""" CALICO = "calico" AZURE = "azure" + class OSType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """OsType to be used to specify os type. Choose from Linux and Windows. Default to Linux. - """ + """OsType to be used to specify os type. Choose from Linux and Windows. Default to Linux.""" LINUX = "Linux" WINDOWS = "Windows" + class OutboundType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The outbound (egress) routing method. - """ + """The outbound (egress) routing method.""" LOAD_BALANCER = "loadBalancer" USER_DEFINED_ROUTING = "userDefinedRouting" + class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of identity used for the managed cluster. Type 'SystemAssigned' will use an implicitly created identity in master components and an auto-created user assigned identity in MC_ @@ -265,6 +267,7 @@ class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): SYSTEM_ASSIGNED = "SystemAssigned" NONE = "None" + class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ScaleSetEvictionPolicy to be used to specify eviction policy for Spot or low priority virtual machine scale set. Default to Delete. @@ -273,9 +276,9 @@ class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): DELETE = "Delete" DEALLOCATE = "Deallocate" + class ScaleSetPriority(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """ScaleSetPriority to be used to specify virtual machine scale set priority. Default to regular. - """ + """ScaleSetPriority to be used to specify virtual machine scale set priority. Default to regular.""" SPOT = "Spot" LOW = "Low" diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/models/_models_py3.py index bfec8a5ef9d3..773e3ab40089 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/models/_models_py3.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/models/_models_py3.py @@ -1,4 +1,5 @@ # coding=utf-8 +# pylint: disable=too-many-lines # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -8,14 +9,14 @@ from typing import Dict, List, Optional, TYPE_CHECKING, Union -import msrest.serialization +from ... import _serialization if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - import __init__ as _models + from .. import models as _models -class SubResource(msrest.serialization.Model): +class SubResource(_serialization.Model): """Reference to another subresource. Variables are only populated by the server, and will be ignored when sending a request. @@ -30,30 +31,26 @@ class SubResource(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(SubResource, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.id = None self.name = None self.type = None -class AgentPool(SubResource): +class AgentPool(SubResource): # pylint: disable=too-many-instance-attributes """Agent Pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -105,7 +102,7 @@ class AgentPool(SubResource): "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :vartype vm_size: str or ~azure.mgmt.containerservice.v2020_02_01.models.ContainerServiceVMSizeTypes :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine @@ -117,7 +114,7 @@ class AgentPool(SubResource): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Known values are: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux" and "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2020_02_01.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -126,7 +123,7 @@ class AgentPool(SubResource): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar type_properties_type: AgentPoolType represents types of an agent pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :vartype type_properties_type: str or ~azure.mgmt.containerservice.v2020_02_01.models.AgentPoolType :ivar orchestrator_version: Version of orchestrator specified when creating the managed @@ -141,21 +138,19 @@ class AgentPool(SubResource): :ivar enable_node_public_ip: Enable public IP for nodes. :vartype enable_node_public_ip: bool :ivar scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Known values are: "Spot", "Low", "Regular". Default value: - "Regular". + priority. Default to regular. Known values are: "Spot", "Low", and "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_02_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy for Spot or low priority virtual machine scale set. Default to Delete. Known values are: - "Delete", "Deallocate". Default value: "Delete". + "Delete" and "Deallocate". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_02_01.models.ScaleSetEvictionPolicy :ivar spot_max_price: SpotMaxPrice to be used to specify the maximum price you are willing to pay in US Dollars. Possible values are any decimal value greater than zero or -1 which indicates default price to be up-to on-demand. :vartype spot_max_price: float - :ivar tags: A set of tags. Agent pool tags to be persisted on the agent pool virtual machine - scale set. + :ivar tags: Agent pool tags to be persisted on the agent pool virtual machine scale set. :vartype tags: dict[str, str] :ivar node_labels: Agent pool node labels to be persisted across all nodes in agent pool. :vartype node_labels: dict[str, str] @@ -165,37 +160,37 @@ class AgentPool(SubResource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'os_disk_size_gb': {'maximum': 1023, 'minimum': 0}, - 'provisioning_state': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "os_disk_size_gb": {"maximum": 1023, "minimum": 0}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'count': {'key': 'properties.count', 'type': 'int'}, - 'vm_size': {'key': 'properties.vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'properties.osDiskSizeGB', 'type': 'int'}, - 'vnet_subnet_id': {'key': 'properties.vnetSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'properties.maxPods', 'type': 'int'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'max_count': {'key': 'properties.maxCount', 'type': 'int'}, - 'min_count': {'key': 'properties.minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'properties.enableAutoScaling', 'type': 'bool'}, - 'type_properties_type': {'key': 'properties.type', 'type': 'str'}, - 'orchestrator_version': {'key': 'properties.orchestratorVersion', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'availability_zones': {'key': 'properties.availabilityZones', 'type': '[str]'}, - 'enable_node_public_ip': {'key': 'properties.enableNodePublicIP', 'type': 'bool'}, - 'scale_set_priority': {'key': 'properties.scaleSetPriority', 'type': 'str'}, - 'scale_set_eviction_policy': {'key': 'properties.scaleSetEvictionPolicy', 'type': 'str'}, - 'spot_max_price': {'key': 'properties.spotMaxPrice', 'type': 'float'}, - 'tags': {'key': 'properties.tags', 'type': '{str}'}, - 'node_labels': {'key': 'properties.nodeLabels', 'type': '{str}'}, - 'node_taints': {'key': 'properties.nodeTaints', 'type': '[str]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "count": {"key": "properties.count", "type": "int"}, + "vm_size": {"key": "properties.vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "properties.osDiskSizeGB", "type": "int"}, + "vnet_subnet_id": {"key": "properties.vnetSubnetID", "type": "str"}, + "max_pods": {"key": "properties.maxPods", "type": "int"}, + "os_type": {"key": "properties.osType", "type": "str"}, + "max_count": {"key": "properties.maxCount", "type": "int"}, + "min_count": {"key": "properties.minCount", "type": "int"}, + "enable_auto_scaling": {"key": "properties.enableAutoScaling", "type": "bool"}, + "type_properties_type": {"key": "properties.type", "type": "str"}, + "orchestrator_version": {"key": "properties.orchestratorVersion", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "availability_zones": {"key": "properties.availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "properties.enableNodePublicIP", "type": "bool"}, + "scale_set_priority": {"key": "properties.scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "properties.scaleSetEvictionPolicy", "type": "str"}, + "spot_max_price": {"key": "properties.spotMaxPrice", "type": "float"}, + "tags": {"key": "properties.tags", "type": "{str}"}, + "node_labels": {"key": "properties.nodeLabels", "type": "{str}"}, + "node_taints": {"key": "properties.nodeTaints", "type": "[str]"}, } def __init__( @@ -206,7 +201,7 @@ def __init__( os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, @@ -214,9 +209,9 @@ def __init__( orchestrator_version: Optional[str] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, - scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", - spot_max_price: Optional[float] = -1, + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", + spot_max_price: float = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, @@ -263,7 +258,7 @@ def __init__( "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :paramtype vm_size: str or ~azure.mgmt.containerservice.v2020_02_01.models.ContainerServiceVMSizeTypes :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every @@ -275,7 +270,7 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux" and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2020_02_01.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -284,7 +279,7 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword type_properties_type: AgentPoolType represents types of an agent pool. Known values - are: "VirtualMachineScaleSets", "AvailabilitySet". + are: "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type_properties_type: str or ~azure.mgmt.containerservice.v2020_02_01.models.AgentPoolType :keyword orchestrator_version: Version of orchestrator specified when creating the managed @@ -296,21 +291,19 @@ def __init__( :keyword enable_node_public_ip: Enable public IP for nodes. :paramtype enable_node_public_ip: bool :keyword scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Known values are: "Spot", "Low", "Regular". Default value: - "Regular". + priority. Default to regular. Known values are: "Spot", "Low", and "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_02_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy for Spot or low priority virtual machine scale set. Default to Delete. Known values are: - "Delete", "Deallocate". Default value: "Delete". + "Delete" and "Deallocate". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_02_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: SpotMaxPrice to be used to specify the maximum price you are willing to pay in US Dollars. Possible values are any decimal value greater than zero or -1 which indicates default price to be up-to on-demand. :paramtype spot_max_price: float - :keyword tags: A set of tags. Agent pool tags to be persisted on the agent pool virtual machine - scale set. + :keyword tags: Agent pool tags to be persisted on the agent pool virtual machine scale set. :paramtype tags: dict[str, str] :keyword node_labels: Agent pool node labels to be persisted across all nodes in agent pool. :paramtype node_labels: dict[str, str] @@ -318,7 +311,7 @@ def __init__( key=value:NoSchedule. :paramtype node_taints: list[str] """ - super(AgentPool, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.vm_size = vm_size self.os_disk_size_gb = os_disk_size_gb @@ -341,7 +334,7 @@ def __init__( self.node_taints = node_taints -class AgentPoolAvailableVersions(msrest.serialization.Model): +class AgentPoolAvailableVersions(_serialization.Model): """The list of available versions for an agent pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -358,16 +351,19 @@ class AgentPoolAvailableVersions(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'agent_pool_versions': {'key': 'properties.agentPoolVersions', 'type': '[AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "agent_pool_versions": { + "key": "properties.agentPoolVersions", + "type": "[AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem]", + }, } def __init__( @@ -381,14 +377,14 @@ def __init__( :paramtype agent_pool_versions: list[~azure.mgmt.containerservice.v2020_02_01.models.AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem] """ - super(AgentPoolAvailableVersions, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None self.agent_pool_versions = agent_pool_versions -class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(msrest.serialization.Model): +class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(_serialization.Model): """AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem. :ivar default: Whether this version is the default agent pool version. @@ -400,9 +396,9 @@ class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(msrest.serializa """ _attribute_map = { - 'default': {'key': 'default', 'type': 'bool'}, - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "default": {"key": "default", "type": "bool"}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } def __init__( @@ -421,13 +417,13 @@ def __init__( :keyword is_preview: Whether Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.default = default self.kubernetes_version = kubernetes_version self.is_preview = is_preview -class AgentPoolListResult(msrest.serialization.Model): +class AgentPoolListResult(_serialization.Model): """The response from the List Agent Pools operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -439,30 +435,25 @@ class AgentPoolListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[AgentPool]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[AgentPool]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.AgentPool"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.AgentPool"]] = None, **kwargs): """ :keyword value: The list of agent pools. :paramtype value: list[~azure.mgmt.containerservice.v2020_02_01.models.AgentPool] """ - super(AgentPoolListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class AgentPoolUpgradeProfile(msrest.serialization.Model): +class AgentPoolUpgradeProfile(_serialization.Model): """The list of available upgrades for an agent pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -475,10 +466,10 @@ class AgentPoolUpgradeProfile(msrest.serialization.Model): :vartype name: str :ivar type: Type of the agent pool upgrade profile. :vartype type: str - :ivar kubernetes_version: Required. Kubernetes version (major, minor, patch). + :ivar kubernetes_version: Kubernetes version (major, minor, patch). Required. :vartype kubernetes_version: str - :ivar os_type: Required. OsType to be used to specify os type. Choose from Linux and Windows. - Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to + Linux. Known values are: "Linux" and "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2020_02_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -486,20 +477,20 @@ class AgentPoolUpgradeProfile(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kubernetes_version': {'required': True}, - 'os_type': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "kubernetes_version": {"required": True}, + "os_type": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'kubernetes_version': {'key': 'properties.kubernetesVersion', 'type': 'str'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'upgrades': {'key': 'properties.upgrades', 'type': '[AgentPoolUpgradeProfilePropertiesUpgradesItem]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "os_type": {"key": "properties.osType", "type": "str"}, + "upgrades": {"key": "properties.upgrades", "type": "[AgentPoolUpgradeProfilePropertiesUpgradesItem]"}, } def __init__( @@ -511,16 +502,16 @@ def __init__( **kwargs ): """ - :keyword kubernetes_version: Required. Kubernetes version (major, minor, patch). + :keyword kubernetes_version: Kubernetes version (major, minor, patch). Required. :paramtype kubernetes_version: str - :keyword os_type: Required. OsType to be used to specify os type. Choose from Linux and - Windows. Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default + to Linux. Known values are: "Linux" and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2020_02_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: list[~azure.mgmt.containerservice.v2020_02_01.models.AgentPoolUpgradeProfilePropertiesUpgradesItem] """ - super(AgentPoolUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -529,7 +520,7 @@ def __init__( self.upgrades = upgrades -class AgentPoolUpgradeProfilePropertiesUpgradesItem(msrest.serialization.Model): +class AgentPoolUpgradeProfilePropertiesUpgradesItem(_serialization.Model): """AgentPoolUpgradeProfilePropertiesUpgradesItem. :ivar kubernetes_version: Kubernetes version (major, minor, patch). @@ -539,29 +530,23 @@ class AgentPoolUpgradeProfilePropertiesUpgradesItem(msrest.serialization.Model): """ _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } - def __init__( - self, - *, - kubernetes_version: Optional[str] = None, - is_preview: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, kubernetes_version: Optional[str] = None, is_preview: Optional[bool] = None, **kwargs): """ :keyword kubernetes_version: Kubernetes version (major, minor, patch). :paramtype kubernetes_version: str :keyword is_preview: Whether Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(AgentPoolUpgradeProfilePropertiesUpgradesItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.is_preview = is_preview -class CloudErrorBody(msrest.serialization.Model): +class CloudErrorBody(_serialization.Model): """An error response from the Container service. :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed @@ -578,10 +563,10 @@ class CloudErrorBody(msrest.serialization.Model): """ _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[CloudErrorBody]"}, } def __init__( @@ -606,87 +591,76 @@ def __init__( :keyword details: A list of additional details about the error. :paramtype details: list[~azure.mgmt.containerservice.v2020_02_01.models.CloudErrorBody] """ - super(CloudErrorBody, self).__init__(**kwargs) + super().__init__(**kwargs) self.code = code self.message = message self.target = target self.details = details -class ContainerServiceDiagnosticsProfile(msrest.serialization.Model): +class ContainerServiceDiagnosticsProfile(_serialization.Model): """Profile for diagnostics on the container service cluster. All required parameters must be populated in order to send to Azure. - :ivar vm_diagnostics: Required. Profile for diagnostics on the container service VMs. + :ivar vm_diagnostics: Profile for diagnostics on the container service VMs. Required. :vartype vm_diagnostics: ~azure.mgmt.containerservice.v2020_02_01.models.ContainerServiceVMDiagnostics """ _validation = { - 'vm_diagnostics': {'required': True}, + "vm_diagnostics": {"required": True}, } _attribute_map = { - 'vm_diagnostics': {'key': 'vmDiagnostics', 'type': 'ContainerServiceVMDiagnostics'}, + "vm_diagnostics": {"key": "vmDiagnostics", "type": "ContainerServiceVMDiagnostics"}, } - def __init__( - self, - *, - vm_diagnostics: "_models.ContainerServiceVMDiagnostics", - **kwargs - ): + def __init__(self, *, vm_diagnostics: "_models.ContainerServiceVMDiagnostics", **kwargs): """ - :keyword vm_diagnostics: Required. Profile for diagnostics on the container service VMs. + :keyword vm_diagnostics: Profile for diagnostics on the container service VMs. Required. :paramtype vm_diagnostics: ~azure.mgmt.containerservice.v2020_02_01.models.ContainerServiceVMDiagnostics """ - super(ContainerServiceDiagnosticsProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.vm_diagnostics = vm_diagnostics -class ContainerServiceLinuxProfile(msrest.serialization.Model): +class ContainerServiceLinuxProfile(_serialization.Model): """Profile for Linux VMs in the container service cluster. All required parameters must be populated in order to send to Azure. - :ivar admin_username: Required. The administrator username to use for Linux VMs. + :ivar admin_username: The administrator username to use for Linux VMs. Required. :vartype admin_username: str - :ivar ssh: Required. SSH configuration for Linux-based VMs running on Azure. + :ivar ssh: SSH configuration for Linux-based VMs running on Azure. Required. :vartype ssh: ~azure.mgmt.containerservice.v2020_02_01.models.ContainerServiceSshConfiguration """ _validation = { - 'admin_username': {'required': True, 'pattern': r'^[A-Za-z][-A-Za-z0-9_]*$'}, - 'ssh': {'required': True}, + "admin_username": {"required": True, "pattern": r"^[A-Za-z][-A-Za-z0-9_]*$"}, + "ssh": {"required": True}, } _attribute_map = { - 'admin_username': {'key': 'adminUsername', 'type': 'str'}, - 'ssh': {'key': 'ssh', 'type': 'ContainerServiceSshConfiguration'}, + "admin_username": {"key": "adminUsername", "type": "str"}, + "ssh": {"key": "ssh", "type": "ContainerServiceSshConfiguration"}, } - def __init__( - self, - *, - admin_username: str, - ssh: "_models.ContainerServiceSshConfiguration", - **kwargs - ): + def __init__(self, *, admin_username: str, ssh: "_models.ContainerServiceSshConfiguration", **kwargs): """ - :keyword admin_username: Required. The administrator username to use for Linux VMs. + :keyword admin_username: The administrator username to use for Linux VMs. Required. :paramtype admin_username: str - :keyword ssh: Required. SSH configuration for Linux-based VMs running on Azure. + :keyword ssh: SSH configuration for Linux-based VMs running on Azure. Required. :paramtype ssh: ~azure.mgmt.containerservice.v2020_02_01.models.ContainerServiceSshConfiguration """ - super(ContainerServiceLinuxProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.admin_username = admin_username self.ssh = ssh -class ContainerServiceMasterProfile(msrest.serialization.Model): +class ContainerServiceMasterProfile(_serialization.Model): """Profile for the container service master. Variables are only populated by the server, and will be ignored when sending a request. @@ -694,11 +668,11 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar count: Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, - and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". + and 5. The default value is 1. Known values are: 1, 3, and 5. :vartype count: int or ~azure.mgmt.containerservice.v2020_02_01.models.Count - :ivar dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. + :ivar dns_prefix: DNS prefix to be used to create the FQDN for the master pool. Required. :vartype dns_prefix: str - :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + :ivar vm_size: Size of agent VMs. Required. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -735,7 +709,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :vartype vm_size: str or ~azure.mgmt.containerservice.v2020_02_01.models.ContainerServiceVMSizeTypes :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine @@ -749,7 +723,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): :vartype first_consecutive_static_ip: str :ivar storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount" and "ManagedDisks". :vartype storage_profile: str or ~azure.mgmt.containerservice.v2020_02_01.models.ContainerServiceStorageProfileTypes :ivar fqdn: FQDN for the master pool. @@ -757,21 +731,21 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): """ _validation = { - 'dns_prefix': {'required': True}, - 'vm_size': {'required': True}, - 'os_disk_size_gb': {'maximum': 1023, 'minimum': 0}, - 'fqdn': {'readonly': True}, + "dns_prefix": {"required": True}, + "vm_size": {"required": True}, + "os_disk_size_gb": {"maximum": 1023, "minimum": 0}, + "fqdn": {"readonly": True}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'dns_prefix': {'key': 'dnsPrefix', 'type': 'str'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'first_consecutive_static_ip': {'key': 'firstConsecutiveStaticIP', 'type': 'str'}, - 'storage_profile': {'key': 'storageProfile', 'type': 'str'}, - 'fqdn': {'key': 'fqdn', 'type': 'str'}, + "count": {"key": "count", "type": "int"}, + "dns_prefix": {"key": "dnsPrefix", "type": "str"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "first_consecutive_static_ip": {"key": "firstConsecutiveStaticIP", "type": "str"}, + "storage_profile": {"key": "storageProfile", "type": "str"}, + "fqdn": {"key": "fqdn", "type": "str"}, } def __init__( @@ -779,20 +753,20 @@ def __init__( *, dns_prefix: str, vm_size: Union[str, "_models.ContainerServiceVMSizeTypes"], - count: Optional[Union[int, "_models.Count"]] = 1, + count: Union[int, "_models.Count"] = 1, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, - first_consecutive_static_ip: Optional[str] = "10.240.255.5", + first_consecutive_static_ip: str = "10.240.255.5", storage_profile: Optional[Union[str, "_models.ContainerServiceStorageProfileTypes"]] = None, **kwargs ): """ :keyword count: Number of masters (VMs) in the container service cluster. Allowed values are 1, - 3, and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". + 3, and 5. The default value is 1. Known values are: 1, 3, and 5. :paramtype count: int or ~azure.mgmt.containerservice.v2020_02_01.models.Count - :keyword dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. + :keyword dns_prefix: DNS prefix to be used to create the FQDN for the master pool. Required. :paramtype dns_prefix: str - :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + :keyword vm_size: Size of agent VMs. Required. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -829,7 +803,7 @@ def __init__( "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :paramtype vm_size: str or ~azure.mgmt.containerservice.v2020_02_01.models.ContainerServiceVMSizeTypes :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every @@ -843,11 +817,11 @@ def __init__( :paramtype first_consecutive_static_ip: str :keyword storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount" and "ManagedDisks". :paramtype storage_profile: str or ~azure.mgmt.containerservice.v2020_02_01.models.ContainerServiceStorageProfileTypes """ - super(ContainerServiceMasterProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.dns_prefix = dns_prefix self.vm_size = vm_size @@ -858,17 +832,17 @@ def __init__( self.fqdn = None -class ContainerServiceNetworkProfile(msrest.serialization.Model): +class ContainerServiceNetworkProfile(_serialization.Model): """Profile of network configuration. :ivar network_plugin: Network plugin used for building Kubernetes network. Known values are: - "azure", "kubenet". Default value: "kubenet". + "azure" and "kubenet". :vartype network_plugin: str or ~azure.mgmt.containerservice.v2020_02_01.models.NetworkPlugin :ivar network_policy: Network policy used for building Kubernetes network. Known values are: - "calico", "azure". + "calico" and "azure". :vartype network_policy: str or ~azure.mgmt.containerservice.v2020_02_01.models.NetworkPolicy :ivar network_mode: Network mode used for building Kubernetes network. Known values are: - "transparent", "bridge". + "transparent" and "bridge". :vartype network_mode: str or ~azure.mgmt.containerservice.v2020_02_01.models.NetworkMode :ivar pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :vartype pod_cidr: str @@ -881,11 +855,11 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): :ivar docker_bridge_cidr: A CIDR notation IP range assigned to the Docker bridge network. It must not overlap with any Subnet IP ranges or the Kubernetes service address range. :vartype docker_bridge_cidr: str - :ivar outbound_type: The outbound (egress) routing method. Known values are: "loadBalancer", - "userDefinedRouting". Default value: "loadBalancer". + :ivar outbound_type: The outbound (egress) routing method. Known values are: "loadBalancer" and + "userDefinedRouting". :vartype outbound_type: str or ~azure.mgmt.containerservice.v2020_02_01.models.OutboundType :ivar load_balancer_sku: The load balancer sku for the managed cluster. Known values are: - "standard", "basic". + "standard" and "basic". :vartype load_balancer_sku: str or ~azure.mgmt.containerservice.v2020_02_01.models.LoadBalancerSku :ivar load_balancer_profile: Profile of the cluster load balancer. @@ -894,49 +868,51 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): """ _validation = { - 'pod_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, - 'service_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, - 'dns_service_ip': {'pattern': r'^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$'}, - 'docker_bridge_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, + "pod_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, + "service_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, + "dns_service_ip": { + "pattern": r"^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$" + }, + "docker_bridge_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, } _attribute_map = { - 'network_plugin': {'key': 'networkPlugin', 'type': 'str'}, - 'network_policy': {'key': 'networkPolicy', 'type': 'str'}, - 'network_mode': {'key': 'networkMode', 'type': 'str'}, - 'pod_cidr': {'key': 'podCidr', 'type': 'str'}, - 'service_cidr': {'key': 'serviceCidr', 'type': 'str'}, - 'dns_service_ip': {'key': 'dnsServiceIP', 'type': 'str'}, - 'docker_bridge_cidr': {'key': 'dockerBridgeCidr', 'type': 'str'}, - 'outbound_type': {'key': 'outboundType', 'type': 'str'}, - 'load_balancer_sku': {'key': 'loadBalancerSku', 'type': 'str'}, - 'load_balancer_profile': {'key': 'loadBalancerProfile', 'type': 'ManagedClusterLoadBalancerProfile'}, + "network_plugin": {"key": "networkPlugin", "type": "str"}, + "network_policy": {"key": "networkPolicy", "type": "str"}, + "network_mode": {"key": "networkMode", "type": "str"}, + "pod_cidr": {"key": "podCidr", "type": "str"}, + "service_cidr": {"key": "serviceCidr", "type": "str"}, + "dns_service_ip": {"key": "dnsServiceIP", "type": "str"}, + "docker_bridge_cidr": {"key": "dockerBridgeCidr", "type": "str"}, + "outbound_type": {"key": "outboundType", "type": "str"}, + "load_balancer_sku": {"key": "loadBalancerSku", "type": "str"}, + "load_balancer_profile": {"key": "loadBalancerProfile", "type": "ManagedClusterLoadBalancerProfile"}, } def __init__( self, *, - network_plugin: Optional[Union[str, "_models.NetworkPlugin"]] = "kubenet", + network_plugin: Union[str, "_models.NetworkPlugin"] = "kubenet", network_policy: Optional[Union[str, "_models.NetworkPolicy"]] = None, network_mode: Optional[Union[str, "_models.NetworkMode"]] = None, - pod_cidr: Optional[str] = "10.244.0.0/16", - service_cidr: Optional[str] = "10.0.0.0/16", - dns_service_ip: Optional[str] = "10.0.0.10", - docker_bridge_cidr: Optional[str] = "172.17.0.1/16", - outbound_type: Optional[Union[str, "_models.OutboundType"]] = "loadBalancer", + pod_cidr: str = "10.244.0.0/16", + service_cidr: str = "10.0.0.0/16", + dns_service_ip: str = "10.0.0.10", + docker_bridge_cidr: str = "172.17.0.1/16", + outbound_type: Union[str, "_models.OutboundType"] = "loadBalancer", load_balancer_sku: Optional[Union[str, "_models.LoadBalancerSku"]] = None, load_balancer_profile: Optional["_models.ManagedClusterLoadBalancerProfile"] = None, **kwargs ): """ :keyword network_plugin: Network plugin used for building Kubernetes network. Known values are: - "azure", "kubenet". Default value: "kubenet". + "azure" and "kubenet". :paramtype network_plugin: str or ~azure.mgmt.containerservice.v2020_02_01.models.NetworkPlugin :keyword network_policy: Network policy used for building Kubernetes network. Known values are: - "calico", "azure". + "calico" and "azure". :paramtype network_policy: str or ~azure.mgmt.containerservice.v2020_02_01.models.NetworkPolicy :keyword network_mode: Network mode used for building Kubernetes network. Known values are: - "transparent", "bridge". + "transparent" and "bridge". :paramtype network_mode: str or ~azure.mgmt.containerservice.v2020_02_01.models.NetworkMode :keyword pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :paramtype pod_cidr: str @@ -949,18 +925,18 @@ def __init__( :keyword docker_bridge_cidr: A CIDR notation IP range assigned to the Docker bridge network. It must not overlap with any Subnet IP ranges or the Kubernetes service address range. :paramtype docker_bridge_cidr: str - :keyword outbound_type: The outbound (egress) routing method. Known values are: "loadBalancer", - "userDefinedRouting". Default value: "loadBalancer". + :keyword outbound_type: The outbound (egress) routing method. Known values are: "loadBalancer" + and "userDefinedRouting". :paramtype outbound_type: str or ~azure.mgmt.containerservice.v2020_02_01.models.OutboundType :keyword load_balancer_sku: The load balancer sku for the managed cluster. Known values are: - "standard", "basic". + "standard" and "basic". :paramtype load_balancer_sku: str or ~azure.mgmt.containerservice.v2020_02_01.models.LoadBalancerSku :keyword load_balancer_profile: Profile of the cluster load balancer. :paramtype load_balancer_profile: ~azure.mgmt.containerservice.v2020_02_01.models.ManagedClusterLoadBalancerProfile """ - super(ContainerServiceNetworkProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.network_plugin = network_plugin self.network_policy = network_policy self.network_mode = network_mode @@ -973,113 +949,98 @@ def __init__( self.load_balancer_profile = load_balancer_profile -class ContainerServiceSshConfiguration(msrest.serialization.Model): +class ContainerServiceSshConfiguration(_serialization.Model): """SSH configuration for Linux-based VMs running on Azure. All required parameters must be populated in order to send to Azure. - :ivar public_keys: Required. The list of SSH public keys used to authenticate with Linux-based - VMs. Only expect one key specified. + :ivar public_keys: The list of SSH public keys used to authenticate with Linux-based VMs. Only + expect one key specified. Required. :vartype public_keys: list[~azure.mgmt.containerservice.v2020_02_01.models.ContainerServiceSshPublicKey] """ _validation = { - 'public_keys': {'required': True}, + "public_keys": {"required": True}, } _attribute_map = { - 'public_keys': {'key': 'publicKeys', 'type': '[ContainerServiceSshPublicKey]'}, + "public_keys": {"key": "publicKeys", "type": "[ContainerServiceSshPublicKey]"}, } - def __init__( - self, - *, - public_keys: List["_models.ContainerServiceSshPublicKey"], - **kwargs - ): + def __init__(self, *, public_keys: List["_models.ContainerServiceSshPublicKey"], **kwargs): """ - :keyword public_keys: Required. The list of SSH public keys used to authenticate with - Linux-based VMs. Only expect one key specified. + :keyword public_keys: The list of SSH public keys used to authenticate with Linux-based VMs. + Only expect one key specified. Required. :paramtype public_keys: list[~azure.mgmt.containerservice.v2020_02_01.models.ContainerServiceSshPublicKey] """ - super(ContainerServiceSshConfiguration, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_keys = public_keys -class ContainerServiceSshPublicKey(msrest.serialization.Model): +class ContainerServiceSshPublicKey(_serialization.Model): """Contains information about SSH certificate public key data. All required parameters must be populated in order to send to Azure. - :ivar key_data: Required. Certificate public key used to authenticate with VMs through SSH. The - certificate must be in PEM format with or without headers. + :ivar key_data: Certificate public key used to authenticate with VMs through SSH. The + certificate must be in PEM format with or without headers. Required. :vartype key_data: str """ _validation = { - 'key_data': {'required': True}, + "key_data": {"required": True}, } _attribute_map = { - 'key_data': {'key': 'keyData', 'type': 'str'}, + "key_data": {"key": "keyData", "type": "str"}, } - def __init__( - self, - *, - key_data: str, - **kwargs - ): + def __init__(self, *, key_data: str, **kwargs): """ - :keyword key_data: Required. Certificate public key used to authenticate with VMs through SSH. - The certificate must be in PEM format with or without headers. + :keyword key_data: Certificate public key used to authenticate with VMs through SSH. The + certificate must be in PEM format with or without headers. Required. :paramtype key_data: str """ - super(ContainerServiceSshPublicKey, self).__init__(**kwargs) + super().__init__(**kwargs) self.key_data = key_data -class ContainerServiceVMDiagnostics(msrest.serialization.Model): +class ContainerServiceVMDiagnostics(_serialization.Model): """Profile for diagnostics on the container service VMs. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar enabled: Required. Whether the VM diagnostic agent is provisioned on the VM. + :ivar enabled: Whether the VM diagnostic agent is provisioned on the VM. Required. :vartype enabled: bool :ivar storage_uri: The URI of the storage account where diagnostics are stored. :vartype storage_uri: str """ _validation = { - 'enabled': {'required': True}, - 'storage_uri': {'readonly': True}, + "enabled": {"required": True}, + "storage_uri": {"readonly": True}, } _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'storage_uri': {'key': 'storageUri', 'type': 'str'}, + "enabled": {"key": "enabled", "type": "bool"}, + "storage_uri": {"key": "storageUri", "type": "str"}, } - def __init__( - self, - *, - enabled: bool, - **kwargs - ): + def __init__(self, *, enabled: bool, **kwargs): """ - :keyword enabled: Required. Whether the VM diagnostic agent is provisioned on the VM. + :keyword enabled: Whether the VM diagnostic agent is provisioned on the VM. Required. :paramtype enabled: bool """ - super(ContainerServiceVMDiagnostics, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.storage_uri = None -class CredentialResult(msrest.serialization.Model): +class CredentialResult(_serialization.Model): """The credential result response. Variables are only populated by the server, and will be ignored when sending a request. @@ -1087,31 +1048,27 @@ class CredentialResult(msrest.serialization.Model): :ivar name: The name of the credential. :vartype name: str :ivar value: Base64-encoded Kubernetes configuration file. - :vartype value: bytearray + :vartype value: bytes """ _validation = { - 'name': {'readonly': True}, - 'value': {'readonly': True}, + "name": {"readonly": True}, + "value": {"readonly": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'bytearray'}, + "name": {"key": "name", "type": "str"}, + "value": {"key": "value", "type": "bytearray"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(CredentialResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.name = None self.value = None -class CredentialResults(msrest.serialization.Model): +class CredentialResults(_serialization.Model): """The list of credential result response. Variables are only populated by the server, and will be ignored when sending a request. @@ -1121,24 +1078,20 @@ class CredentialResults(msrest.serialization.Model): """ _validation = { - 'kubeconfigs': {'readonly': True}, + "kubeconfigs": {"readonly": True}, } _attribute_map = { - 'kubeconfigs': {'key': 'kubeconfigs', 'type': '[CredentialResult]'}, + "kubeconfigs": {"key": "kubeconfigs", "type": "[CredentialResult]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(CredentialResults, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.kubeconfigs = None -class Resource(msrest.serialization.Model): +class Resource(_serialization.Model): """The Resource model definition. Variables are only populated by the server, and will be ignored when sending a request. @@ -1151,41 +1104,35 @@ class Resource(msrest.serialization.Model): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] """ - super(Resource, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -1193,7 +1140,7 @@ def __init__( self.tags = tags -class ManagedCluster(Resource): +class ManagedCluster(Resource): # pylint: disable=too-many-instance-attributes """Managed cluster. Variables are only populated by the server, and will be ignored when sending a request. @@ -1206,9 +1153,9 @@ class ManagedCluster(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar identity: The identity of the managed cluster, if configured. :vartype identity: ~azure.mgmt.containerservice.v2020_02_01.models.ManagedClusterIdentity @@ -1269,46 +1216,58 @@ class ManagedCluster(Resource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'provisioning_state': {'readonly': True}, - 'max_agent_pools': {'readonly': True}, - 'fqdn': {'readonly': True}, - 'private_fqdn': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, + "provisioning_state": {"readonly": True}, + "max_agent_pools": {"readonly": True}, + "fqdn": {"readonly": True}, + "private_fqdn": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'ManagedClusterIdentity'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'max_agent_pools': {'key': 'properties.maxAgentPools', 'type': 'int'}, - 'kubernetes_version': {'key': 'properties.kubernetesVersion', 'type': 'str'}, - 'dns_prefix': {'key': 'properties.dnsPrefix', 'type': 'str'}, - 'fqdn': {'key': 'properties.fqdn', 'type': 'str'}, - 'private_fqdn': {'key': 'properties.privateFQDN', 'type': 'str'}, - 'agent_pool_profiles': {'key': 'properties.agentPoolProfiles', 'type': '[ManagedClusterAgentPoolProfile]'}, - 'linux_profile': {'key': 'properties.linuxProfile', 'type': 'ContainerServiceLinuxProfile'}, - 'windows_profile': {'key': 'properties.windowsProfile', 'type': 'ManagedClusterWindowsProfile'}, - 'service_principal_profile': {'key': 'properties.servicePrincipalProfile', 'type': 'ManagedClusterServicePrincipalProfile'}, - 'addon_profiles': {'key': 'properties.addonProfiles', 'type': '{ManagedClusterAddonProfile}'}, - 'node_resource_group': {'key': 'properties.nodeResourceGroup', 'type': 'str'}, - 'enable_rbac': {'key': 'properties.enableRBAC', 'type': 'bool'}, - 'enable_pod_security_policy': {'key': 'properties.enablePodSecurityPolicy', 'type': 'bool'}, - 'network_profile': {'key': 'properties.networkProfile', 'type': 'ContainerServiceNetworkProfile'}, - 'aad_profile': {'key': 'properties.aadProfile', 'type': 'ManagedClusterAADProfile'}, - 'auto_scaler_profile': {'key': 'properties.autoScalerProfile', 'type': 'ManagedClusterPropertiesAutoScalerProfile'}, - 'api_server_access_profile': {'key': 'properties.apiServerAccessProfile', 'type': 'ManagedClusterAPIServerAccessProfile'}, - 'disk_encryption_set_id': {'key': 'properties.diskEncryptionSetID', 'type': 'str'}, - 'identity_profile': {'key': 'properties.identityProfile', 'type': '{ManagedClusterPropertiesIdentityProfileValue}'}, - } - - def __init__( + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "identity": {"key": "identity", "type": "ManagedClusterIdentity"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "max_agent_pools": {"key": "properties.maxAgentPools", "type": "int"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "dns_prefix": {"key": "properties.dnsPrefix", "type": "str"}, + "fqdn": {"key": "properties.fqdn", "type": "str"}, + "private_fqdn": {"key": "properties.privateFQDN", "type": "str"}, + "agent_pool_profiles": {"key": "properties.agentPoolProfiles", "type": "[ManagedClusterAgentPoolProfile]"}, + "linux_profile": {"key": "properties.linuxProfile", "type": "ContainerServiceLinuxProfile"}, + "windows_profile": {"key": "properties.windowsProfile", "type": "ManagedClusterWindowsProfile"}, + "service_principal_profile": { + "key": "properties.servicePrincipalProfile", + "type": "ManagedClusterServicePrincipalProfile", + }, + "addon_profiles": {"key": "properties.addonProfiles", "type": "{ManagedClusterAddonProfile}"}, + "node_resource_group": {"key": "properties.nodeResourceGroup", "type": "str"}, + "enable_rbac": {"key": "properties.enableRBAC", "type": "bool"}, + "enable_pod_security_policy": {"key": "properties.enablePodSecurityPolicy", "type": "bool"}, + "network_profile": {"key": "properties.networkProfile", "type": "ContainerServiceNetworkProfile"}, + "aad_profile": {"key": "properties.aadProfile", "type": "ManagedClusterAADProfile"}, + "auto_scaler_profile": { + "key": "properties.autoScalerProfile", + "type": "ManagedClusterPropertiesAutoScalerProfile", + }, + "api_server_access_profile": { + "key": "properties.apiServerAccessProfile", + "type": "ManagedClusterAPIServerAccessProfile", + }, + "disk_encryption_set_id": {"key": "properties.diskEncryptionSetID", "type": "str"}, + "identity_profile": { + "key": "properties.identityProfile", + "type": "{ManagedClusterPropertiesIdentityProfileValue}", + }, + } + + def __init__( # pylint: disable=too-many-locals self, *, location: str, @@ -1333,9 +1292,9 @@ def __init__( **kwargs ): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword identity: The identity of the managed cluster, if configured. :paramtype identity: ~azure.mgmt.containerservice.v2020_02_01.models.ManagedClusterIdentity @@ -1386,7 +1345,7 @@ def __init__( :paramtype identity_profile: dict[str, ~azure.mgmt.containerservice.v2020_02_01.models.ManagedClusterPropertiesIdentityProfileValue] """ - super(ManagedCluster, self).__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.identity = identity self.provisioning_state = None self.max_agent_pools = None @@ -1410,14 +1369,14 @@ def __init__( self.identity_profile = identity_profile -class ManagedClusterAADProfile(msrest.serialization.Model): +class ManagedClusterAADProfile(_serialization.Model): """AADProfile specifies attributes for Azure Active Directory integration. All required parameters must be populated in order to send to Azure. - :ivar client_app_id: Required. The client AAD application ID. + :ivar client_app_id: The client AAD application ID. Required. :vartype client_app_id: str - :ivar server_app_id: Required. The server AAD application ID. + :ivar server_app_id: The server AAD application ID. Required. :vartype server_app_id: str :ivar server_app_secret: The server AAD application secret. :vartype server_app_secret: str @@ -1427,15 +1386,15 @@ class ManagedClusterAADProfile(msrest.serialization.Model): """ _validation = { - 'client_app_id': {'required': True}, - 'server_app_id': {'required': True}, + "client_app_id": {"required": True}, + "server_app_id": {"required": True}, } _attribute_map = { - 'client_app_id': {'key': 'clientAppID', 'type': 'str'}, - 'server_app_id': {'key': 'serverAppID', 'type': 'str'}, - 'server_app_secret': {'key': 'serverAppSecret', 'type': 'str'}, - 'tenant_id': {'key': 'tenantID', 'type': 'str'}, + "client_app_id": {"key": "clientAppID", "type": "str"}, + "server_app_id": {"key": "serverAppID", "type": "str"}, + "server_app_secret": {"key": "serverAppSecret", "type": "str"}, + "tenant_id": {"key": "tenantID", "type": "str"}, } def __init__( @@ -1448,9 +1407,9 @@ def __init__( **kwargs ): """ - :keyword client_app_id: Required. The client AAD application ID. + :keyword client_app_id: The client AAD application ID. Required. :paramtype client_app_id: str - :keyword server_app_id: Required. The server AAD application ID. + :keyword server_app_id: The server AAD application ID. Required. :paramtype server_app_id: str :keyword server_app_secret: The server AAD application secret. :paramtype server_app_secret: str @@ -1458,7 +1417,7 @@ def __init__( tenant of the deployment subscription. :paramtype tenant_id: str """ - super(ManagedClusterAADProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.client_app_id = client_app_id self.server_app_id = server_app_id self.server_app_secret = server_app_secret @@ -1478,58 +1437,53 @@ class ManagedClusterAccessProfile(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar kube_config: Base64-encoded Kubernetes configuration file. - :vartype kube_config: bytearray + :vartype kube_config: bytes """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'kube_config': {'key': 'properties.kubeConfig', 'type': 'bytearray'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "kube_config": {"key": "properties.kubeConfig", "type": "bytearray"}, } def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - kube_config: Optional[bytearray] = None, - **kwargs + self, *, location: str, tags: Optional[Dict[str, str]] = None, kube_config: Optional[bytes] = None, **kwargs ): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword kube_config: Base64-encoded Kubernetes configuration file. - :paramtype kube_config: bytearray + :paramtype kube_config: bytes """ - super(ManagedClusterAccessProfile, self).__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.kube_config = kube_config -class ManagedClusterAddonProfile(msrest.serialization.Model): +class ManagedClusterAddonProfile(_serialization.Model): """A Kubernetes add-on profile for a managed cluster. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar enabled: Required. Whether the add-on is enabled or not. + :ivar enabled: Whether the add-on is enabled or not. Required. :vartype enabled: bool :ivar config: Key-value pairs for configuring an add-on. :vartype config: dict[str, str] @@ -1539,36 +1493,30 @@ class ManagedClusterAddonProfile(msrest.serialization.Model): """ _validation = { - 'enabled': {'required': True}, - 'identity': {'readonly': True}, + "enabled": {"required": True}, + "identity": {"readonly": True}, } _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'config': {'key': 'config', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'ManagedClusterAddonProfileIdentity'}, + "enabled": {"key": "enabled", "type": "bool"}, + "config": {"key": "config", "type": "{str}"}, + "identity": {"key": "identity", "type": "ManagedClusterAddonProfileIdentity"}, } - def __init__( - self, - *, - enabled: bool, - config: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, enabled: bool, config: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword enabled: Required. Whether the add-on is enabled or not. + :keyword enabled: Whether the add-on is enabled or not. Required. :paramtype enabled: bool :keyword config: Key-value pairs for configuring an add-on. :paramtype config: dict[str, str] """ - super(ManagedClusterAddonProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.config = config self.identity = None -class UserAssignedIdentity(msrest.serialization.Model): +class UserAssignedIdentity(_serialization.Model): """UserAssignedIdentity. :ivar resource_id: The resource id of the user assigned identity. @@ -1580,9 +1528,9 @@ class UserAssignedIdentity(msrest.serialization.Model): """ _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'object_id': {'key': 'objectId', 'type': 'str'}, + "resource_id": {"key": "resourceId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + "object_id": {"key": "objectId", "type": "str"}, } def __init__( @@ -1601,7 +1549,7 @@ def __init__( :keyword object_id: The object id of the user assigned identity. :paramtype object_id: str """ - super(UserAssignedIdentity, self).__init__(**kwargs) + super().__init__(**kwargs) self.resource_id = resource_id self.client_id = client_id self.object_id = object_id @@ -1619,9 +1567,9 @@ class ManagedClusterAddonProfileIdentity(UserAssignedIdentity): """ _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'object_id': {'key': 'objectId', 'type': 'str'}, + "resource_id": {"key": "resourceId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + "object_id": {"key": "objectId", "type": "str"}, } def __init__( @@ -1640,10 +1588,10 @@ def __init__( :keyword object_id: The object id of the user assigned identity. :paramtype object_id: str """ - super(ManagedClusterAddonProfileIdentity, self).__init__(resource_id=resource_id, client_id=client_id, object_id=object_id, **kwargs) + super().__init__(resource_id=resource_id, client_id=client_id, object_id=object_id, **kwargs) -class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): +class ManagedClusterAgentPoolProfileProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes """Properties for the container service agent pool profile. Variables are only populated by the server, and will be ignored when sending a request. @@ -1688,7 +1636,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :vartype vm_size: str or ~azure.mgmt.containerservice.v2020_02_01.models.ContainerServiceVMSizeTypes :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine @@ -1700,7 +1648,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Known values are: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux" and "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2020_02_01.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -1709,7 +1657,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar type: AgentPoolType represents types of an agent pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2020_02_01.models.AgentPoolType :ivar orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -1723,21 +1671,19 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar enable_node_public_ip: Enable public IP for nodes. :vartype enable_node_public_ip: bool :ivar scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Known values are: "Spot", "Low", "Regular". Default value: - "Regular". + priority. Default to regular. Known values are: "Spot", "Low", and "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_02_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy for Spot or low priority virtual machine scale set. Default to Delete. Known values are: - "Delete", "Deallocate". Default value: "Delete". + "Delete" and "Deallocate". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_02_01.models.ScaleSetEvictionPolicy :ivar spot_max_price: SpotMaxPrice to be used to specify the maximum price you are willing to pay in US Dollars. Possible values are any decimal value greater than zero or -1 which indicates default price to be up-to on-demand. :vartype spot_max_price: float - :ivar tags: A set of tags. Agent pool tags to be persisted on the agent pool virtual machine - scale set. + :ivar tags: Agent pool tags to be persisted on the agent pool virtual machine scale set. :vartype tags: dict[str, str] :ivar node_labels: Agent pool node labels to be persisted across all nodes in agent pool. :vartype node_labels: dict[str, str] @@ -1747,31 +1693,31 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): """ _validation = { - 'os_disk_size_gb': {'maximum': 1023, 'minimum': 0}, - 'provisioning_state': {'readonly': True}, + "os_disk_size_gb": {"maximum": 1023, "minimum": 0}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'maxPods', 'type': 'int'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'max_count': {'key': 'maxCount', 'type': 'int'}, - 'min_count': {'key': 'minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'enableAutoScaling', 'type': 'bool'}, - 'type': {'key': 'type', 'type': 'str'}, - 'orchestrator_version': {'key': 'orchestratorVersion', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'availability_zones': {'key': 'availabilityZones', 'type': '[str]'}, - 'enable_node_public_ip': {'key': 'enableNodePublicIP', 'type': 'bool'}, - 'scale_set_priority': {'key': 'scaleSetPriority', 'type': 'str'}, - 'scale_set_eviction_policy': {'key': 'scaleSetEvictionPolicy', 'type': 'str'}, - 'spot_max_price': {'key': 'spotMaxPrice', 'type': 'float'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'node_labels': {'key': 'nodeLabels', 'type': '{str}'}, - 'node_taints': {'key': 'nodeTaints', 'type': '[str]'}, + "count": {"key": "count", "type": "int"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "max_pods": {"key": "maxPods", "type": "int"}, + "os_type": {"key": "osType", "type": "str"}, + "max_count": {"key": "maxCount", "type": "int"}, + "min_count": {"key": "minCount", "type": "int"}, + "enable_auto_scaling": {"key": "enableAutoScaling", "type": "bool"}, + "type": {"key": "type", "type": "str"}, + "orchestrator_version": {"key": "orchestratorVersion", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "availability_zones": {"key": "availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "enableNodePublicIP", "type": "bool"}, + "scale_set_priority": {"key": "scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "scaleSetEvictionPolicy", "type": "str"}, + "spot_max_price": {"key": "spotMaxPrice", "type": "float"}, + "tags": {"key": "tags", "type": "{str}"}, + "node_labels": {"key": "nodeLabels", "type": "{str}"}, + "node_taints": {"key": "nodeTaints", "type": "[str]"}, } def __init__( @@ -1782,7 +1728,7 @@ def __init__( os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, @@ -1790,9 +1736,9 @@ def __init__( orchestrator_version: Optional[str] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, - scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", - spot_max_price: Optional[float] = -1, + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", + spot_max_price: float = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, @@ -1839,7 +1785,7 @@ def __init__( "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :paramtype vm_size: str or ~azure.mgmt.containerservice.v2020_02_01.models.ContainerServiceVMSizeTypes :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every @@ -1851,7 +1797,7 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux" and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2020_02_01.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -1860,7 +1806,7 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword type: AgentPoolType represents types of an agent pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2020_02_01.models.AgentPoolType :keyword orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -1871,21 +1817,19 @@ def __init__( :keyword enable_node_public_ip: Enable public IP for nodes. :paramtype enable_node_public_ip: bool :keyword scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Known values are: "Spot", "Low", "Regular". Default value: - "Regular". + priority. Default to regular. Known values are: "Spot", "Low", and "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_02_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy for Spot or low priority virtual machine scale set. Default to Delete. Known values are: - "Delete", "Deallocate". Default value: "Delete". + "Delete" and "Deallocate". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_02_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: SpotMaxPrice to be used to specify the maximum price you are willing to pay in US Dollars. Possible values are any decimal value greater than zero or -1 which indicates default price to be up-to on-demand. :paramtype spot_max_price: float - :keyword tags: A set of tags. Agent pool tags to be persisted on the agent pool virtual machine - scale set. + :keyword tags: Agent pool tags to be persisted on the agent pool virtual machine scale set. :paramtype tags: dict[str, str] :keyword node_labels: Agent pool node labels to be persisted across all nodes in agent pool. :paramtype node_labels: dict[str, str] @@ -1893,7 +1837,7 @@ def __init__( key=value:NoSchedule. :paramtype node_taints: list[str] """ - super(ManagedClusterAgentPoolProfileProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.vm_size = vm_size self.os_disk_size_gb = os_disk_size_gb @@ -1916,7 +1860,9 @@ def __init__( self.node_taints = node_taints -class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): +class ManagedClusterAgentPoolProfile( + ManagedClusterAgentPoolProfileProperties +): # pylint: disable=too-many-instance-attributes """Profile for the container service agent pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -1963,7 +1909,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :vartype vm_size: str or ~azure.mgmt.containerservice.v2020_02_01.models.ContainerServiceVMSizeTypes :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine @@ -1975,7 +1921,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Known values are: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux" and "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2020_02_01.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -1984,7 +1930,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar type: AgentPoolType represents types of an agent pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2020_02_01.models.AgentPoolType :ivar orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -1998,60 +1944,58 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar enable_node_public_ip: Enable public IP for nodes. :vartype enable_node_public_ip: bool :ivar scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Known values are: "Spot", "Low", "Regular". Default value: - "Regular". + priority. Default to regular. Known values are: "Spot", "Low", and "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_02_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy for Spot or low priority virtual machine scale set. Default to Delete. Known values are: - "Delete", "Deallocate". Default value: "Delete". + "Delete" and "Deallocate". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_02_01.models.ScaleSetEvictionPolicy :ivar spot_max_price: SpotMaxPrice to be used to specify the maximum price you are willing to pay in US Dollars. Possible values are any decimal value greater than zero or -1 which indicates default price to be up-to on-demand. :vartype spot_max_price: float - :ivar tags: A set of tags. Agent pool tags to be persisted on the agent pool virtual machine - scale set. + :ivar tags: Agent pool tags to be persisted on the agent pool virtual machine scale set. :vartype tags: dict[str, str] :ivar node_labels: Agent pool node labels to be persisted across all nodes in agent pool. :vartype node_labels: dict[str, str] :ivar node_taints: Taints added to new nodes during node pool create and scale. For example, key=value:NoSchedule. :vartype node_taints: list[str] - :ivar name: Required. Unique name of the agent pool profile in the context of the subscription - and resource group. + :ivar name: Unique name of the agent pool profile in the context of the subscription and + resource group. Required. :vartype name: str """ _validation = { - 'os_disk_size_gb': {'maximum': 1023, 'minimum': 0}, - 'provisioning_state': {'readonly': True}, - 'name': {'required': True, 'pattern': r'^[a-z][a-z0-9]{0,11}$'}, + "os_disk_size_gb": {"maximum": 1023, "minimum": 0}, + "provisioning_state": {"readonly": True}, + "name": {"required": True, "pattern": r"^[a-z][a-z0-9]{0,11}$"}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'maxPods', 'type': 'int'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'max_count': {'key': 'maxCount', 'type': 'int'}, - 'min_count': {'key': 'minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'enableAutoScaling', 'type': 'bool'}, - 'type': {'key': 'type', 'type': 'str'}, - 'orchestrator_version': {'key': 'orchestratorVersion', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'availability_zones': {'key': 'availabilityZones', 'type': '[str]'}, - 'enable_node_public_ip': {'key': 'enableNodePublicIP', 'type': 'bool'}, - 'scale_set_priority': {'key': 'scaleSetPriority', 'type': 'str'}, - 'scale_set_eviction_policy': {'key': 'scaleSetEvictionPolicy', 'type': 'str'}, - 'spot_max_price': {'key': 'spotMaxPrice', 'type': 'float'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'node_labels': {'key': 'nodeLabels', 'type': '{str}'}, - 'node_taints': {'key': 'nodeTaints', 'type': '[str]'}, - 'name': {'key': 'name', 'type': 'str'}, + "count": {"key": "count", "type": "int"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "max_pods": {"key": "maxPods", "type": "int"}, + "os_type": {"key": "osType", "type": "str"}, + "max_count": {"key": "maxCount", "type": "int"}, + "min_count": {"key": "minCount", "type": "int"}, + "enable_auto_scaling": {"key": "enableAutoScaling", "type": "bool"}, + "type": {"key": "type", "type": "str"}, + "orchestrator_version": {"key": "orchestratorVersion", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "availability_zones": {"key": "availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "enableNodePublicIP", "type": "bool"}, + "scale_set_priority": {"key": "scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "scaleSetEvictionPolicy", "type": "str"}, + "spot_max_price": {"key": "spotMaxPrice", "type": "float"}, + "tags": {"key": "tags", "type": "{str}"}, + "node_labels": {"key": "nodeLabels", "type": "{str}"}, + "node_taints": {"key": "nodeTaints", "type": "[str]"}, + "name": {"key": "name", "type": "str"}, } def __init__( @@ -2063,7 +2007,7 @@ def __init__( os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, @@ -2071,9 +2015,9 @@ def __init__( orchestrator_version: Optional[str] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, - scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", - spot_max_price: Optional[float] = -1, + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", + spot_max_price: float = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, @@ -2120,7 +2064,7 @@ def __init__( "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :paramtype vm_size: str or ~azure.mgmt.containerservice.v2020_02_01.models.ContainerServiceVMSizeTypes :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every @@ -2132,7 +2076,7 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux" and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2020_02_01.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -2141,7 +2085,7 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword type: AgentPoolType represents types of an agent pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2020_02_01.models.AgentPoolType :keyword orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -2152,36 +2096,55 @@ def __init__( :keyword enable_node_public_ip: Enable public IP for nodes. :paramtype enable_node_public_ip: bool :keyword scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Known values are: "Spot", "Low", "Regular". Default value: - "Regular". + priority. Default to regular. Known values are: "Spot", "Low", and "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_02_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy for Spot or low priority virtual machine scale set. Default to Delete. Known values are: - "Delete", "Deallocate". Default value: "Delete". + "Delete" and "Deallocate". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_02_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: SpotMaxPrice to be used to specify the maximum price you are willing to pay in US Dollars. Possible values are any decimal value greater than zero or -1 which indicates default price to be up-to on-demand. :paramtype spot_max_price: float - :keyword tags: A set of tags. Agent pool tags to be persisted on the agent pool virtual machine - scale set. + :keyword tags: Agent pool tags to be persisted on the agent pool virtual machine scale set. :paramtype tags: dict[str, str] :keyword node_labels: Agent pool node labels to be persisted across all nodes in agent pool. :paramtype node_labels: dict[str, str] :keyword node_taints: Taints added to new nodes during node pool create and scale. For example, key=value:NoSchedule. :paramtype node_taints: list[str] - :keyword name: Required. Unique name of the agent pool profile in the context of the - subscription and resource group. + :keyword name: Unique name of the agent pool profile in the context of the subscription and + resource group. Required. :paramtype name: str """ - super(ManagedClusterAgentPoolProfile, self).__init__(count=count, vm_size=vm_size, os_disk_size_gb=os_disk_size_gb, vnet_subnet_id=vnet_subnet_id, max_pods=max_pods, os_type=os_type, max_count=max_count, min_count=min_count, enable_auto_scaling=enable_auto_scaling, type=type, orchestrator_version=orchestrator_version, availability_zones=availability_zones, enable_node_public_ip=enable_node_public_ip, scale_set_priority=scale_set_priority, scale_set_eviction_policy=scale_set_eviction_policy, spot_max_price=spot_max_price, tags=tags, node_labels=node_labels, node_taints=node_taints, **kwargs) + super().__init__( + count=count, + vm_size=vm_size, + os_disk_size_gb=os_disk_size_gb, + vnet_subnet_id=vnet_subnet_id, + max_pods=max_pods, + os_type=os_type, + max_count=max_count, + min_count=min_count, + enable_auto_scaling=enable_auto_scaling, + type=type, + orchestrator_version=orchestrator_version, + availability_zones=availability_zones, + enable_node_public_ip=enable_node_public_ip, + scale_set_priority=scale_set_priority, + scale_set_eviction_policy=scale_set_eviction_policy, + spot_max_price=spot_max_price, + tags=tags, + node_labels=node_labels, + node_taints=node_taints, + **kwargs + ) self.name = name -class ManagedClusterAPIServerAccessProfile(msrest.serialization.Model): +class ManagedClusterAPIServerAccessProfile(_serialization.Model): """Access profile for managed cluster API server. :ivar authorized_ip_ranges: Authorized IP Ranges to kubernetes API server. @@ -2191,8 +2154,8 @@ class ManagedClusterAPIServerAccessProfile(msrest.serialization.Model): """ _attribute_map = { - 'authorized_ip_ranges': {'key': 'authorizedIPRanges', 'type': '[str]'}, - 'enable_private_cluster': {'key': 'enablePrivateCluster', 'type': 'bool'}, + "authorized_ip_ranges": {"key": "authorizedIPRanges", "type": "[str]"}, + "enable_private_cluster": {"key": "enablePrivateCluster", "type": "bool"}, } def __init__( @@ -2208,12 +2171,12 @@ def __init__( :keyword enable_private_cluster: Whether to create the cluster as a private cluster or not. :paramtype enable_private_cluster: bool """ - super(ManagedClusterAPIServerAccessProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.authorized_ip_ranges = authorized_ip_ranges self.enable_private_cluster = enable_private_cluster -class ManagedClusterIdentity(msrest.serialization.Model): +class ManagedClusterIdentity(_serialization.Model): """Identity for the managed cluster. Variables are only populated by the server, and will be ignored when sending a request. @@ -2227,41 +2190,36 @@ class ManagedClusterIdentity(msrest.serialization.Model): :ivar type: The type of identity used for the managed cluster. Type 'SystemAssigned' will use an implicitly created identity in master components and an auto-created user assigned identity in MC_ resource group in agent nodes. Type 'None' will not use MSI for the managed cluster, - service principal will be used instead. Known values are: "SystemAssigned", "None". + service principal will be used instead. Known values are: "SystemAssigned" and "None". :vartype type: str or ~azure.mgmt.containerservice.v2020_02_01.models.ResourceIdentityType """ _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, + "principal_id": {"readonly": True}, + "tenant_id": {"readonly": True}, } _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, + "principal_id": {"key": "principalId", "type": "str"}, + "tenant_id": {"key": "tenantId", "type": "str"}, + "type": {"key": "type", "type": "str"}, } - def __init__( - self, - *, - type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, - **kwargs - ): + def __init__(self, *, type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, **kwargs): """ :keyword type: The type of identity used for the managed cluster. Type 'SystemAssigned' will use an implicitly created identity in master components and an auto-created user assigned identity in MC_ resource group in agent nodes. Type 'None' will not use MSI for the managed - cluster, service principal will be used instead. Known values are: "SystemAssigned", "None". + cluster, service principal will be used instead. Known values are: "SystemAssigned" and "None". :paramtype type: str or ~azure.mgmt.containerservice.v2020_02_01.models.ResourceIdentityType """ - super(ManagedClusterIdentity, self).__init__(**kwargs) + super().__init__(**kwargs) self.principal_id = None self.tenant_id = None self.type = type -class ManagedClusterListResult(msrest.serialization.Model): +class ManagedClusterListResult(_serialization.Model): """The response from the List Managed Clusters operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -2273,30 +2231,25 @@ class ManagedClusterListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[ManagedCluster]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[ManagedCluster]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.ManagedCluster"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.ManagedCluster"]] = None, **kwargs): """ :keyword value: The list of managed clusters. :paramtype value: list[~azure.mgmt.containerservice.v2020_02_01.models.ManagedCluster] """ - super(ManagedClusterListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class ManagedClusterLoadBalancerProfile(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfile(_serialization.Model): """Profile of the managed cluster load balancer. :ivar managed_outbound_i_ps: Desired managed outbound IPs for the cluster load balancer. @@ -2322,17 +2275,23 @@ class ManagedClusterLoadBalancerProfile(msrest.serialization.Model): """ _validation = { - 'allocated_outbound_ports': {'maximum': 64000, 'minimum': 0}, - 'idle_timeout_in_minutes': {'maximum': 120, 'minimum': 4}, + "allocated_outbound_ports": {"maximum": 64000, "minimum": 0}, + "idle_timeout_in_minutes": {"maximum": 120, "minimum": 4}, } _attribute_map = { - 'managed_outbound_i_ps': {'key': 'managedOutboundIPs', 'type': 'ManagedClusterLoadBalancerProfileManagedOutboundIPs'}, - 'outbound_ip_prefixes': {'key': 'outboundIPPrefixes', 'type': 'ManagedClusterLoadBalancerProfileOutboundIPPrefixes'}, - 'outbound_i_ps': {'key': 'outboundIPs', 'type': 'ManagedClusterLoadBalancerProfileOutboundIPs'}, - 'effective_outbound_i_ps': {'key': 'effectiveOutboundIPs', 'type': '[ResourceReference]'}, - 'allocated_outbound_ports': {'key': 'allocatedOutboundPorts', 'type': 'int'}, - 'idle_timeout_in_minutes': {'key': 'idleTimeoutInMinutes', 'type': 'int'}, + "managed_outbound_i_ps": { + "key": "managedOutboundIPs", + "type": "ManagedClusterLoadBalancerProfileManagedOutboundIPs", + }, + "outbound_ip_prefixes": { + "key": "outboundIPPrefixes", + "type": "ManagedClusterLoadBalancerProfileOutboundIPPrefixes", + }, + "outbound_i_ps": {"key": "outboundIPs", "type": "ManagedClusterLoadBalancerProfileOutboundIPs"}, + "effective_outbound_i_ps": {"key": "effectiveOutboundIPs", "type": "[ResourceReference]"}, + "allocated_outbound_ports": {"key": "allocatedOutboundPorts", "type": "int"}, + "idle_timeout_in_minutes": {"key": "idleTimeoutInMinutes", "type": "int"}, } def __init__( @@ -2342,8 +2301,8 @@ def __init__( outbound_ip_prefixes: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPPrefixes"] = None, outbound_i_ps: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPs"] = None, effective_outbound_i_ps: Optional[List["_models.ResourceReference"]] = None, - allocated_outbound_ports: Optional[int] = 0, - idle_timeout_in_minutes: Optional[int] = 30, + allocated_outbound_ports: int = 0, + idle_timeout_in_minutes: int = 30, **kwargs ): """ @@ -2369,7 +2328,7 @@ def __init__( must be in the range of 4 to 120 (inclusive). The default value is 30 minutes. :paramtype idle_timeout_in_minutes: int """ - super(ManagedClusterLoadBalancerProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.managed_outbound_i_ps = managed_outbound_i_ps self.outbound_ip_prefixes = outbound_ip_prefixes self.outbound_i_ps = outbound_i_ps @@ -2378,7 +2337,7 @@ def __init__( self.idle_timeout_in_minutes = idle_timeout_in_minutes -class ManagedClusterLoadBalancerProfileManagedOutboundIPs(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfileManagedOutboundIPs(_serialization.Model): """Desired managed outbound IPs for the cluster load balancer. :ivar count: Desired number of outbound IP created/managed by Azure for the cluster load @@ -2387,29 +2346,24 @@ class ManagedClusterLoadBalancerProfileManagedOutboundIPs(msrest.serialization.M """ _validation = { - 'count': {'maximum': 100, 'minimum': 1}, + "count": {"maximum": 100, "minimum": 1}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, + "count": {"key": "count", "type": "int"}, } - def __init__( - self, - *, - count: Optional[int] = 1, - **kwargs - ): + def __init__(self, *, count: int = 1, **kwargs): """ :keyword count: Desired number of outbound IP created/managed by Azure for the cluster load balancer. Allowed values must be in the range of 1 to 100 (inclusive). The default value is 1. :paramtype count: int """ - super(ManagedClusterLoadBalancerProfileManagedOutboundIPs, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count -class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(_serialization.Model): """Desired outbound IP Prefix resources for the cluster load balancer. :ivar public_ip_prefixes: A list of public IP prefix resources. @@ -2418,25 +2372,20 @@ class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(msrest.serialization.M """ _attribute_map = { - 'public_ip_prefixes': {'key': 'publicIPPrefixes', 'type': '[ResourceReference]'}, + "public_ip_prefixes": {"key": "publicIPPrefixes", "type": "[ResourceReference]"}, } - def __init__( - self, - *, - public_ip_prefixes: Optional[List["_models.ResourceReference"]] = None, - **kwargs - ): + def __init__(self, *, public_ip_prefixes: Optional[List["_models.ResourceReference"]] = None, **kwargs): """ :keyword public_ip_prefixes: A list of public IP prefix resources. :paramtype public_ip_prefixes: list[~azure.mgmt.containerservice.v2020_02_01.models.ResourceReference] """ - super(ManagedClusterLoadBalancerProfileOutboundIPPrefixes, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_ip_prefixes = public_ip_prefixes -class ManagedClusterLoadBalancerProfileOutboundIPs(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfileOutboundIPs(_serialization.Model): """Desired outbound IP resources for the cluster load balancer. :ivar public_i_ps: A list of public IP resources. @@ -2444,34 +2393,29 @@ class ManagedClusterLoadBalancerProfileOutboundIPs(msrest.serialization.Model): """ _attribute_map = { - 'public_i_ps': {'key': 'publicIPs', 'type': '[ResourceReference]'}, + "public_i_ps": {"key": "publicIPs", "type": "[ResourceReference]"}, } - def __init__( - self, - *, - public_i_ps: Optional[List["_models.ResourceReference"]] = None, - **kwargs - ): + def __init__(self, *, public_i_ps: Optional[List["_models.ResourceReference"]] = None, **kwargs): """ :keyword public_i_ps: A list of public IP resources. :paramtype public_i_ps: list[~azure.mgmt.containerservice.v2020_02_01.models.ResourceReference] """ - super(ManagedClusterLoadBalancerProfileOutboundIPs, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_i_ps = public_i_ps -class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): +class ManagedClusterPoolUpgradeProfile(_serialization.Model): """The list of available upgrade versions. All required parameters must be populated in order to send to Azure. - :ivar kubernetes_version: Required. Kubernetes version (major, minor, patch). + :ivar kubernetes_version: Kubernetes version (major, minor, patch). Required. :vartype kubernetes_version: str :ivar name: Pool name. :vartype name: str - :ivar os_type: Required. OsType to be used to specify os type. Choose from Linux and Windows. - Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to + Linux. Known values are: "Linux" and "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2020_02_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -2479,15 +2423,15 @@ class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): """ _validation = { - 'kubernetes_version': {'required': True}, - 'os_type': {'required': True}, + "kubernetes_version": {"required": True}, + "os_type": {"required": True}, } _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'upgrades': {'key': 'upgrades', 'type': '[ManagedClusterPoolUpgradeProfileUpgradesItem]'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "os_type": {"key": "osType", "type": "str"}, + "upgrades": {"key": "upgrades", "type": "[ManagedClusterPoolUpgradeProfileUpgradesItem]"}, } def __init__( @@ -2500,25 +2444,25 @@ def __init__( **kwargs ): """ - :keyword kubernetes_version: Required. Kubernetes version (major, minor, patch). + :keyword kubernetes_version: Kubernetes version (major, minor, patch). Required. :paramtype kubernetes_version: str :keyword name: Pool name. :paramtype name: str - :keyword os_type: Required. OsType to be used to specify os type. Choose from Linux and - Windows. Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default + to Linux. Known values are: "Linux" and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2020_02_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: list[~azure.mgmt.containerservice.v2020_02_01.models.ManagedClusterPoolUpgradeProfileUpgradesItem] """ - super(ManagedClusterPoolUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.name = name self.os_type = os_type self.upgrades = upgrades -class ManagedClusterPoolUpgradeProfileUpgradesItem(msrest.serialization.Model): +class ManagedClusterPoolUpgradeProfileUpgradesItem(_serialization.Model): """ManagedClusterPoolUpgradeProfileUpgradesItem. :ivar kubernetes_version: Kubernetes version (major, minor, patch). @@ -2528,29 +2472,23 @@ class ManagedClusterPoolUpgradeProfileUpgradesItem(msrest.serialization.Model): """ _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } - def __init__( - self, - *, - kubernetes_version: Optional[str] = None, - is_preview: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, kubernetes_version: Optional[str] = None, is_preview: Optional[bool] = None, **kwargs): """ :keyword kubernetes_version: Kubernetes version (major, minor, patch). :paramtype kubernetes_version: str :keyword is_preview: Whether Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(ManagedClusterPoolUpgradeProfileUpgradesItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.is_preview = is_preview -class ManagedClusterPropertiesAutoScalerProfile(msrest.serialization.Model): +class ManagedClusterPropertiesAutoScalerProfile(_serialization.Model): """Parameters to be applied to the cluster-autoscaler when enabled. :ivar scan_interval: @@ -2572,14 +2510,14 @@ class ManagedClusterPropertiesAutoScalerProfile(msrest.serialization.Model): """ _attribute_map = { - 'scan_interval': {'key': 'scan-interval', 'type': 'str'}, - 'scale_down_delay_after_add': {'key': 'scale-down-delay-after-add', 'type': 'str'}, - 'scale_down_delay_after_delete': {'key': 'scale-down-delay-after-delete', 'type': 'str'}, - 'scale_down_delay_after_failure': {'key': 'scale-down-delay-after-failure', 'type': 'str'}, - 'scale_down_unneeded_time': {'key': 'scale-down-unneeded-time', 'type': 'str'}, - 'scale_down_unready_time': {'key': 'scale-down-unready-time', 'type': 'str'}, - 'scale_down_utilization_threshold': {'key': 'scale-down-utilization-threshold', 'type': 'str'}, - 'max_graceful_termination_sec': {'key': 'max-graceful-termination-sec', 'type': 'str'}, + "scan_interval": {"key": "scan-interval", "type": "str"}, + "scale_down_delay_after_add": {"key": "scale-down-delay-after-add", "type": "str"}, + "scale_down_delay_after_delete": {"key": "scale-down-delay-after-delete", "type": "str"}, + "scale_down_delay_after_failure": {"key": "scale-down-delay-after-failure", "type": "str"}, + "scale_down_unneeded_time": {"key": "scale-down-unneeded-time", "type": "str"}, + "scale_down_unready_time": {"key": "scale-down-unready-time", "type": "str"}, + "scale_down_utilization_threshold": {"key": "scale-down-utilization-threshold", "type": "str"}, + "max_graceful_termination_sec": {"key": "max-graceful-termination-sec", "type": "str"}, } def __init__( @@ -2613,7 +2551,7 @@ def __init__( :keyword max_graceful_termination_sec: :paramtype max_graceful_termination_sec: str """ - super(ManagedClusterPropertiesAutoScalerProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.scan_interval = scan_interval self.scale_down_delay_after_add = scale_down_delay_after_add self.scale_down_delay_after_delete = scale_down_delay_after_delete @@ -2636,9 +2574,9 @@ class ManagedClusterPropertiesIdentityProfileValue(UserAssignedIdentity): """ _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'object_id': {'key': 'objectId', 'type': 'str'}, + "resource_id": {"key": "resourceId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + "object_id": {"key": "objectId", "type": "str"}, } def __init__( @@ -2657,48 +2595,42 @@ def __init__( :keyword object_id: The object id of the user assigned identity. :paramtype object_id: str """ - super(ManagedClusterPropertiesIdentityProfileValue, self).__init__(resource_id=resource_id, client_id=client_id, object_id=object_id, **kwargs) + super().__init__(resource_id=resource_id, client_id=client_id, object_id=object_id, **kwargs) -class ManagedClusterServicePrincipalProfile(msrest.serialization.Model): +class ManagedClusterServicePrincipalProfile(_serialization.Model): """Information about a service principal identity for the cluster to use for manipulating Azure APIs. All required parameters must be populated in order to send to Azure. - :ivar client_id: Required. The ID for the service principal. + :ivar client_id: The ID for the service principal. Required. :vartype client_id: str :ivar secret: The secret password associated with the service principal in plain text. :vartype secret: str """ _validation = { - 'client_id': {'required': True}, + "client_id": {"required": True}, } _attribute_map = { - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'secret': {'key': 'secret', 'type': 'str'}, + "client_id": {"key": "clientId", "type": "str"}, + "secret": {"key": "secret", "type": "str"}, } - def __init__( - self, - *, - client_id: str, - secret: Optional[str] = None, - **kwargs - ): + def __init__(self, *, client_id: str, secret: Optional[str] = None, **kwargs): """ - :keyword client_id: Required. The ID for the service principal. + :keyword client_id: The ID for the service principal. Required. :paramtype client_id: str :keyword secret: The secret password associated with the service principal in plain text. :paramtype secret: str """ - super(ManagedClusterServicePrincipalProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.client_id = client_id self.secret = secret -class ManagedClusterUpgradeProfile(msrest.serialization.Model): +class ManagedClusterUpgradeProfile(_serialization.Model): """The list of available upgrades for compute pools. Variables are only populated by the server, and will be ignored when sending a request. @@ -2711,29 +2643,29 @@ class ManagedClusterUpgradeProfile(msrest.serialization.Model): :vartype name: str :ivar type: Type of upgrade profile. :vartype type: str - :ivar control_plane_profile: Required. The list of available upgrade versions for the control - plane. + :ivar control_plane_profile: The list of available upgrade versions for the control plane. + Required. :vartype control_plane_profile: ~azure.mgmt.containerservice.v2020_02_01.models.ManagedClusterPoolUpgradeProfile - :ivar agent_pool_profiles: Required. The list of available upgrade versions for agent pools. + :ivar agent_pool_profiles: The list of available upgrade versions for agent pools. Required. :vartype agent_pool_profiles: list[~azure.mgmt.containerservice.v2020_02_01.models.ManagedClusterPoolUpgradeProfile] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'control_plane_profile': {'required': True}, - 'agent_pool_profiles': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "control_plane_profile": {"required": True}, + "agent_pool_profiles": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'control_plane_profile': {'key': 'properties.controlPlaneProfile', 'type': 'ManagedClusterPoolUpgradeProfile'}, - 'agent_pool_profiles': {'key': 'properties.agentPoolProfiles', 'type': '[ManagedClusterPoolUpgradeProfile]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "control_plane_profile": {"key": "properties.controlPlaneProfile", "type": "ManagedClusterPoolUpgradeProfile"}, + "agent_pool_profiles": {"key": "properties.agentPoolProfiles", "type": "[ManagedClusterPoolUpgradeProfile]"}, } def __init__( @@ -2744,15 +2676,15 @@ def __init__( **kwargs ): """ - :keyword control_plane_profile: Required. The list of available upgrade versions for the - control plane. + :keyword control_plane_profile: The list of available upgrade versions for the control plane. + Required. :paramtype control_plane_profile: ~azure.mgmt.containerservice.v2020_02_01.models.ManagedClusterPoolUpgradeProfile - :keyword agent_pool_profiles: Required. The list of available upgrade versions for agent pools. + :keyword agent_pool_profiles: The list of available upgrade versions for agent pools. Required. :paramtype agent_pool_profiles: list[~azure.mgmt.containerservice.v2020_02_01.models.ManagedClusterPoolUpgradeProfile] """ - super(ManagedClusterUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -2760,18 +2692,18 @@ def __init__( self.agent_pool_profiles = agent_pool_profiles -class ManagedClusterWindowsProfile(msrest.serialization.Model): +class ManagedClusterWindowsProfile(_serialization.Model): """Profile for Windows VMs in the container service cluster. All required parameters must be populated in order to send to Azure. - :ivar admin_username: Required. Specifies the name of the administrator account. - :code:`
`:code:`
` **restriction:** Cannot end in "." :code:`
`:code:`
` - **Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", "test1", - "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", - "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", - "sys", "test2", "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 - character :code:`
`:code:`
` **Max-length:** 20 characters. + :ivar admin_username: Specifies the name of the administrator account. :code:`
`:code:`
` + **restriction:** Cannot end in "." :code:`
`:code:`
` **Disallowed values:** + "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", + "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", + "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", + "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 character + :code:`
`:code:`
` **Max-length:** 20 characters. Required. :vartype admin_username: str :ivar admin_password: Specifies the password of the administrator account. :code:`
`:code:`
` **Minimum-length:** 8 characters :code:`
`:code:`
` @@ -2784,29 +2716,23 @@ class ManagedClusterWindowsProfile(msrest.serialization.Model): """ _validation = { - 'admin_username': {'required': True}, + "admin_username": {"required": True}, } _attribute_map = { - 'admin_username': {'key': 'adminUsername', 'type': 'str'}, - 'admin_password': {'key': 'adminPassword', 'type': 'str'}, + "admin_username": {"key": "adminUsername", "type": "str"}, + "admin_password": {"key": "adminPassword", "type": "str"}, } - def __init__( - self, - *, - admin_username: str, - admin_password: Optional[str] = None, - **kwargs - ): + def __init__(self, *, admin_username: str, admin_password: Optional[str] = None, **kwargs): """ - :keyword admin_username: Required. Specifies the name of the administrator account. + :keyword admin_username: Specifies the name of the administrator account. :code:`
`:code:`
` **restriction:** Cannot end in "." :code:`
`:code:`
` **Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 - character :code:`
`:code:`
` **Max-length:** 20 characters. + character :code:`
`:code:`
` **Max-length:** 20 characters. Required. :paramtype admin_username: str :keyword admin_password: Specifies the password of the administrator account. :code:`
`:code:`
` **Minimum-length:** 8 characters :code:`
`:code:`
` @@ -2817,12 +2743,12 @@ def __init__( "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!". :paramtype admin_password: str """ - super(ManagedClusterWindowsProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.admin_username = admin_username self.admin_password = admin_password -class OperationListResult(msrest.serialization.Model): +class OperationListResult(_serialization.Model): """The List Compute Operation operation response. Variables are only populated by the server, and will be ignored when sending a request. @@ -2832,24 +2758,20 @@ class OperationListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[OperationValue]'}, + "value": {"key": "value", "type": "[OperationValue]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(OperationListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None -class OperationValue(msrest.serialization.Model): +class OperationValue(_serialization.Model): """Describes the properties of a Compute Operation value. Variables are only populated by the server, and will be ignored when sending a request. @@ -2869,30 +2791,26 @@ class OperationValue(msrest.serialization.Model): """ _validation = { - 'origin': {'readonly': True}, - 'name': {'readonly': True}, - 'operation': {'readonly': True}, - 'resource': {'readonly': True}, - 'description': {'readonly': True}, - 'provider': {'readonly': True}, + "origin": {"readonly": True}, + "name": {"readonly": True}, + "operation": {"readonly": True}, + "resource": {"readonly": True}, + "description": {"readonly": True}, + "provider": {"readonly": True}, } _attribute_map = { - 'origin': {'key': 'origin', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'operation': {'key': 'display.operation', 'type': 'str'}, - 'resource': {'key': 'display.resource', 'type': 'str'}, - 'description': {'key': 'display.description', 'type': 'str'}, - 'provider': {'key': 'display.provider', 'type': 'str'}, + "origin": {"key": "origin", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "operation": {"key": "display.operation", "type": "str"}, + "resource": {"key": "display.resource", "type": "str"}, + "description": {"key": "display.description", "type": "str"}, + "provider": {"key": "display.provider", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(OperationValue, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.origin = None self.name = None self.operation = None @@ -2901,7 +2819,7 @@ def __init__( self.provider = None -class ResourceReference(msrest.serialization.Model): +class ResourceReference(_serialization.Model): """A reference to an Azure resource. :ivar id: The fully qualified Azure resource id. @@ -2909,43 +2827,33 @@ class ResourceReference(msrest.serialization.Model): """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, } - def __init__( - self, - *, - id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin """ :keyword id: The fully qualified Azure resource id. :paramtype id: str """ - super(ResourceReference, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id -class TagsObject(msrest.serialization.Model): +class TagsObject(_serialization.Model): """Tags object for patch operations. - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] """ _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] """ - super(TagsObject, self).__init__(**kwargs) + super().__init__(**kwargs) self.tags = tags diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/models/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/models/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/models/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/models/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/operations/__init__.py index 403c0174f052..ee6608454b6b 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/operations/__init__.py @@ -13,10 +13,11 @@ from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'Operations', - 'ManagedClustersOperations', - 'AgentPoolsOperations', + "Operations", + "ManagedClustersOperations", + "AgentPoolsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/operations/_agent_pools_operations.py index f49b9a360b15..58951f86bc1a 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/operations/_agent_pools_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,249 +27,250 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-02-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-02-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - *, - json: Optional[_models.AgentPool] = None, - content: Any = None, - **kwargs: Any + _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, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + _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, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-02-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_get_upgrade_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-02-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_available_agent_pool_versions_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-02-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class AgentPoolsOperations: """ @@ -285,48 +291,40 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> Iterable[_models.AgentPoolListResult]: + def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> Iterable["_models.AgentPool"]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. The operation returns properties of each agent pool. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AgentPoolListResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_02_01.models.AgentPoolListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either AgentPool or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_02_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -334,16 +332,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -359,10 +352,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -372,54 +363,45 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore @distributed_trace def get( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPool: """Gets the agent pool. Gets the details of the agent pool by managed cluster and resource group. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPool, or the result of cls(response) + :return: AgentPool or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_02_01.models.AgentPool - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -427,57 +409,60 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore def _create_or_update_initial( self, resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: _models.AgentPool, + parameters: Union[_models.AgentPool, IO], **kwargs: Any ) -> _models.AgentPool: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - _json = self._serialize.body(parameters, 'AgentPool') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "AgentPool") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -485,10 +470,9 @@ def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -496,40 +480,86 @@ def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - - @distributed_trace + @overload def begin_create_or_update( self, resource_group_name: str, resource_name: str, agent_pool_name: str, parameters: _models.AgentPool, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.AgentPool]: """Creates or updates an agent pool. Creates or updates an agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :param parameters: Parameters supplied to the Create or Update an agent pool operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2020_02_01.models.AgentPool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_02_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AgentPool]: + """Creates or updates an agent pool. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: Parameters supplied to the Create or Update an agent pool operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -541,20 +571,56 @@ def begin_create_or_update( :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_02_01.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: Union[_models.AgentPool, IO], + **kwargs: Any + ) -> LROPoller[_models.AgentPool]: + """Creates or updates an agent pool. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: Parameters supplied to the Create or Update an agent pool operation. Is + either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2020_02_01.models.AgentPool or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_02_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -563,66 +629,55 @@ def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -630,10 +685,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -643,26 +697,21 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + def begin_delete( + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> LROPoller[None]: """Deletes an agent pool. Deletes the agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -674,100 +723,86 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPoolUpgradeProfile: """Gets upgrade profile for an agent pool. Gets the details of the upgrade profile for an agent pool with a specified resource group and managed cluster name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolUpgradeProfile, or the result of cls(response) + :return: AgentPoolUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_02_01.models.AgentPoolUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -775,64 +810,56 @@ def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolUpgradeProfile', pipeline_response) + deserialized = self._deserialize("AgentPoolUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore @distributed_trace def get_available_agent_pool_versions( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported versions for the specified agent pool. Gets a list of supported versions for the specified agent pool. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolAvailableVersions, or the result of cls(response) + :return: AgentPoolAvailableVersions or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_02_01.models.AgentPoolAvailableVersions - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolAvailableVersions] - request = build_get_available_agent_pool_versions_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_available_agent_pool_versions.metadata['url'], + template_url=self.get_available_agent_pool_versions.metadata["url"], headers=_headers, params=_params, ) @@ -840,22 +867,20 @@ def get_available_agent_pool_versions( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolAvailableVersions', pipeline_response) + deserialized = self._deserialize("AgentPoolAvailableVersions", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_available_agent_pool_versions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore - + get_available_agent_pool_versions.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/operations/_managed_clusters_operations.py index aa208df218fb..452ddf6d7a54 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/operations/_managed_clusters_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,557 +27,536 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-02-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters") + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters" + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_resource_group_request( - subscription_id: str, - resource_group_name: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-02-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters", + ) # 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', min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_upgrade_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-02-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_access_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, role_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 = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-02-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "roleName": _SERIALIZER.url("role_name", role_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "roleName": _SERIALIZER.url("role_name", role_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_admin_credentials_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-02-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_user_credentials_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-02-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_monitoring_user_credentials_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-02-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: + +def build_get_request(resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-02-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedCluster] = None, - content: Any = None, - **kwargs: Any +def build_create_or_update_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_update_tags_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.TagsObject] = None, - content: Any = None, - **kwargs: Any + +def build_update_tags_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + +def build_delete_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-02-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_reset_service_principal_profile_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedClusterServicePrincipalProfile] = None, - content: Any = None, - **kwargs: Any + +def build_reset_service_principal_profile_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_reset_aad_profile_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedClusterAADProfile] = None, - content: Any = None, - **kwargs: Any +def build_reset_aad_profile_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_rotate_cluster_certificates_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any +def build_rotate_cluster_certificates_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-02-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + class ManagedClustersOperations: """ @@ -593,41 +577,35 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.ManagedClusterListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.ManagedCluster"]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. The operation returns properties of each managed cluster. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_02_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_02_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -635,14 +613,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -658,10 +633,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -671,50 +644,42 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> Iterable[_models.ManagedClusterListResult]: + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.ManagedCluster"]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. The operation returns properties of each managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_02_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_02_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -722,15 +687,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -746,10 +707,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -759,51 +718,43 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.ManagedClusterUpgradeProfile: """Gets upgrade profile for a managed cluster. Gets the details of the upgrade profile for a managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterUpgradeProfile, or the result of cls(response) + :return: ManagedClusterUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_02_01.models.ManagedClusterUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -811,69 +762,60 @@ def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterUpgradeProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore @distributed_trace def get_access_profile( - self, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, role_name: str, **kwargs: Any ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. Gets the accessProfile for the specified role name of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param role_name: The name of the role for managed cluster accessProfile resource. + :param role_name: The name of the role for managed cluster accessProfile resource. Required. :type role_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterAccessProfile, or the result of cls(response) + :return: ManagedClusterAccessProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_02_01.models.ManagedClusterAccessProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterAccessProfile] - request = build_get_access_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, role_name=role_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_access_profile.metadata['url'], + template_url=self.get_access_profile.metadata["url"], headers=_headers, params=_params, ) @@ -881,64 +823,56 @@ def get_access_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterAccessProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterAccessProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_access_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore - + get_access_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore @distributed_trace def list_cluster_admin_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster admin credential of a managed cluster. Gets cluster admin credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_02_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_admin_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_admin_credentials.metadata['url'], + template_url=self.list_cluster_admin_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -946,64 +880,56 @@ def list_cluster_admin_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_admin_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore - + list_cluster_admin_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore @distributed_trace def list_cluster_user_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster user credential of a managed cluster. Gets cluster user credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_02_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_user_credentials.metadata['url'], + template_url=self.list_cluster_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -1011,65 +937,57 @@ def list_cluster_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore - + list_cluster_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore @distributed_trace def list_cluster_monitoring_user_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster monitoring user credential of a managed cluster. Gets cluster monitoring user credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_02_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_monitoring_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + template_url=self.list_cluster_monitoring_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -1077,64 +995,54 @@ def list_cluster_monitoring_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_monitoring_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore - + list_cluster_monitoring_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore @distributed_trace - def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.ManagedCluster: + def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.ManagedCluster: """Gets a managed cluster. Gets the details of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedCluster, or the result of cls(response) + :return: ManagedCluster or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_02_01.models.ManagedCluster - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -1142,55 +1050,54 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _create_or_update_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.ManagedCluster, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'ManagedCluster') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedCluster") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1198,10 +1105,9 @@ def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -1209,25 +1115,26 @@ def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - @distributed_trace + @overload def begin_create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedCluster, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. @@ -1235,12 +1142,16 @@ def begin_create_or_update( Creates or updates a managed cluster with the specified configuration for agents and Kubernetes version. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2020_02_01.models.ManagedCluster + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1253,20 +1164,91 @@ def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_02_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster with the specified configuration for agents and Kubernetes + version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_02_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster with the specified configuration for agents and Kubernetes + version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. Is + either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2020_02_01.models.ManagedCluster or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_02_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -1274,69 +1256,66 @@ def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _update_tags_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.TagsObject, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request_initial( - subscription_id=self._config.subscription_id, + request = build_update_tags_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_tags_initial.metadata['url'], + content=_content, + template_url=self._update_tags_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1344,44 +1323,118 @@ def _update_tags_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_tags_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _update_tags_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - @distributed_trace + @overload def begin_update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates a managed cluster with the specified tags. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2020_02_01.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_02_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates a managed cluster with the specified tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_02_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates a managed cluster with the specified tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2020_02_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1394,20 +1447,17 @@ def begin_update_tags( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_02_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, @@ -1415,64 +1465,54 @@ def begin_update_tags( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1480,10 +1520,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1493,23 +1532,17 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> LROPoller[None]: + def begin_delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> LROPoller[None]: """Deletes a managed cluster. Deletes the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1521,85 +1554,83 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterServicePrincipalProfile, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterServicePrincipalProfile") - request = build_reset_service_principal_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_service_principal_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_service_principal_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_service_principal_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1607,10 +1638,9 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1620,29 +1650,106 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re if cls: return cls(pipeline_response, None, {}) - _reset_service_principal_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore - + _reset_service_principal_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore - @distributed_trace - def begin_reset_service_principal_profile( # pylint: disable=inconsistent-return-statements + @overload + def begin_reset_service_principal_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterServicePrincipalProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: """Reset Service Principal Profile of a managed cluster. Update the service principal Profile for a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a - Managed Cluster. + Managed Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2020_02_01.models.ManagedClusterServicePrincipalProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reset Service Principal Profile of a managed cluster. + + Update the service principal Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a + Managed Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Reset Service Principal Profile of a managed cluster. + + Update the service principal Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a + Managed Cluster. Is either a model type or a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2020_02_01.models.ManagedClusterServicePrincipalProfile or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1653,20 +1760,17 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1674,67 +1778,68 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_service_principal_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + begin_reset_service_principal_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterAADProfile, + parameters: Union[_models.ManagedClusterAADProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterAADProfile") - request = build_reset_aad_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_aad_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_aad_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_aad_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1742,10 +1847,9 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1755,28 +1859,32 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement if cls: return cls(pipeline_response, None, {}) - _reset_aad_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - + _reset_aad_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - @distributed_trace - def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements + @overload + def begin_reset_aad_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterAADProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: """Reset AAD Profile of a managed cluster. Update the AAD Profile for a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed - Cluster. + Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2020_02_01.models.ManagedClusterAADProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1787,20 +1895,90 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reset AAD Profile of a managed cluster. + + Update the AAD Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed + Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterAADProfile, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Reset AAD Profile of a managed cluster. + + Update the AAD Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed + Cluster. Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2020_02_01.models.ManagedClusterAADProfile or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1808,62 +1986,52 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_aad_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + begin_reset_aad_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_rotate_cluster_certificates_request_initial( - subscription_id=self._config.subscription_id, + request = build_rotate_cluster_certificates_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._rotate_cluster_certificates_initial.metadata['url'], + template_url=self._rotate_cluster_certificates_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1871,10 +2039,9 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1884,23 +2051,19 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return if cls: return cls(pipeline_response, None, {}) - _rotate_cluster_certificates_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore - + _rotate_cluster_certificates_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore @distributed_trace - def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + def begin_rotate_cluster_certificates( + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> LROPoller[None]: """Rotate certificates of a managed cluster. Rotate certificates of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1912,52 +2075,45 @@ def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-st Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._rotate_cluster_certificates_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_rotate_cluster_certificates.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore + begin_rotate_cluster_certificates.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/operations/_operations.py index c4f8b331e113..8fea3a448f94 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/operations/_operations.py @@ -7,10 +7,15 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,38 +25,34 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - **kwargs: Any -) -> HttpRequest: + +def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-02-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.ContainerService/operations") # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class Operations: """ @@ -72,36 +73,31 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.OperationListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.OperationValue"]: """Gets a list of compute operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationListResult or the result of cls(response) + :return: An iterator like instance of either OperationValue or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_02_01.models.OperationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_02_01.models.OperationValue] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -109,13 +105,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -131,10 +125,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -144,8 +136,6 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.ContainerService/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ContainerService/operations"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/operations/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/__init__.py index 37a5f9e02e6f..a8716d29afe8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/__init__.py @@ -14,7 +14,8 @@ except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['ContainerServiceClient'] + +__all__ = ["ContainerServiceClient"] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/_configuration.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/_configuration.py index 3a83f8ab5a0d..00f921ef7d62 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/_configuration.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/_configuration.py @@ -18,30 +18,26 @@ VERSION = "unknown" + class ContainerServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ContainerServiceClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2020-03-01". 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: + def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ContainerServiceClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2020-03-01") # type: str + api_version = kwargs.pop("api_version", "2020-03-01") # type: str if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -51,23 +47,24 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-containerservice/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-containerservice/{}".format(VERSION)) self._configure(**kwargs) def _configure( - self, - **kwargs # type: Any + self, **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/_container_service_client.py index 3af0440deec6..8eae1481eeba 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/_container_service_client.py @@ -9,12 +9,11 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from . import models +from .._serialization import Deserializer, Serializer from ._configuration import ContainerServiceClientConfiguration from .operations import AgentPoolsOperations, ManagedClustersOperations, Operations @@ -22,7 +21,8 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class ContainerServiceClient: + +class ContainerServiceClient: # pylint: disable=client-accepts-api-version-keyword """The Container Service Client. :ivar operations: Operations operations @@ -32,10 +32,10 @@ class ContainerServiceClient: azure.mgmt.containerservice.v2020_03_01.operations.ManagedClustersOperations :ivar agent_pools: AgentPoolsOperations operations :vartype agent_pools: azure.mgmt.containerservice.v2020_03_01.operations.AgentPoolsOperations - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -53,29 +53,22 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = ContainerServiceClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = ContainerServiceClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize - ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.managed_clusters = ManagedClustersOperations( self._client, self._config, self._serialize, self._deserialize ) - self.agent_pools = AgentPoolsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - + self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> HttpResponse: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -84,7 +77,7 @@ def _send_request( >>> response = client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/_metadata.json b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/_metadata.json index d6e1585818aa..e1e60cde7b17 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/_metadata.json +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/_metadata.json @@ -10,20 +10,20 @@ "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { "credential": { - "signature": "credential, # type: \"TokenCredential\"", - "description": "Credential needed for the client to connect to Azure.", + "signature": "credential: \"TokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true }, "subscription_id": { - "signature": "subscription_id, # type: str", - "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "signature": "subscription_id: str,", + "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.", "docstring_type": "str", "required": true } @@ -31,13 +31,13 @@ "async": { "credential": { "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure.", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { "signature": "subscription_id: str,", - "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.", "docstring_type": "str", "required": true } @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=\"https://management.azure.com\", # type: str", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/_patch.py index 74e48ecd07cf..f99e77fef986 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/_patch.py @@ -28,4 +28,4 @@ # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + pass diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/_vendor.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/_vendor.py index 138f663c53a4..9aad73fc743e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/_vendor.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/_vendor.py @@ -7,6 +7,7 @@ from azure.core.pipeline.transport import HttpRequest + def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) @@ -14,6 +15,7 @@ def _convert_request(request, files=None): request.set_formdata_body(files) return request + def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -21,7 +23,5 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [ - c for c in formatted_components if "{}".format(key.args[0]) not in c - ] + components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/aio/__init__.py index 37a5f9e02e6f..a8716d29afe8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/aio/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/aio/__init__.py @@ -14,7 +14,8 @@ except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['ContainerServiceClient'] + +__all__ = ["ContainerServiceClient"] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/aio/_configuration.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/aio/_configuration.py index 2535fbe85110..ed42ed2be309 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/aio/_configuration.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/aio/_configuration.py @@ -18,30 +18,26 @@ VERSION = "unknown" + class ContainerServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ContainerServiceClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2020-03-01". 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: + def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ContainerServiceClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2020-03-01") # type: str + api_version = kwargs.pop("api_version", "2020-03-01") # type: str if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -51,22 +47,21 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-containerservice/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-containerservice/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, - **kwargs: Any - ) -> None: - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/aio/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/aio/_container_service_client.py index fe38c25df9d1..364d80196d38 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/aio/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/aio/_container_service_client.py @@ -9,12 +9,11 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from .. import models +from ..._serialization import Deserializer, Serializer from ._configuration import ContainerServiceClientConfiguration from .operations import AgentPoolsOperations, ManagedClustersOperations, Operations @@ -22,7 +21,8 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class ContainerServiceClient: + +class ContainerServiceClient: # pylint: disable=client-accepts-api-version-keyword """The Container Service Client. :ivar operations: Operations operations @@ -33,10 +33,10 @@ class ContainerServiceClient: :ivar agent_pools: AgentPoolsOperations operations :vartype agent_pools: azure.mgmt.containerservice.v2020_03_01.aio.operations.AgentPoolsOperations - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -54,29 +54,22 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = ContainerServiceClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = ContainerServiceClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize - ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.managed_clusters = ManagedClustersOperations( self._client, self._config, self._serialize, self._deserialize ) - self.agent_pools = AgentPoolsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - + self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -85,7 +78,7 @@ def _send_request( >>> response = await client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/aio/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/aio/_patch.py index 74e48ecd07cf..f99e77fef986 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/aio/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/aio/_patch.py @@ -28,4 +28,4 @@ # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + pass diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/aio/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/aio/operations/__init__.py index 403c0174f052..ee6608454b6b 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/aio/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/aio/operations/__init__.py @@ -13,10 +13,11 @@ from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'Operations', - 'ManagedClustersOperations', - 'AgentPoolsOperations', + "Operations", + "ManagedClustersOperations", + "AgentPoolsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/aio/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/aio/operations/_agent_pools_operations.py index bb194f88ef35..7342f3eca497 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/aio/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/aio/operations/_agent_pools_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +29,19 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._agent_pools_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_available_agent_pool_versions_request, build_get_request, build_get_upgrade_profile_request, build_list_request -T = TypeVar('T') +from ...operations._agent_pools_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_available_agent_pool_versions_request, + build_get_request, + build_get_upgrade_profile_request, + build_list_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class AgentPoolsOperations: """ .. warning:: @@ -45,48 +61,41 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.AgentPoolListResult]: + def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncIterable["_models.AgentPool"]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. The operation returns properties of each agent pool. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AgentPoolListResult or the result of cls(response) + :return: An iterator like instance of either AgentPool or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_03_01.models.AgentPoolListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_03_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -94,16 +103,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -119,10 +123,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -132,54 +134,45 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore @distributed_trace_async async def get( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPool: """Gets the agent pool. Gets the details of the agent pool by managed cluster and resource group. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPool, or the result of cls(response) + :return: AgentPool or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_03_01.models.AgentPool - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -187,57 +180,60 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore async def _create_or_update_initial( self, resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: _models.AgentPool, + parameters: Union[_models.AgentPool, IO], **kwargs: Any ) -> _models.AgentPool: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - _json = self._serialize.body(parameters, 'AgentPool') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "AgentPool") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -245,10 +241,9 @@ async def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -256,40 +251,45 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - - @distributed_trace_async + @overload async def begin_create_or_update( self, resource_group_name: str, resource_name: str, agent_pool_name: str, parameters: _models.AgentPool, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.AgentPool]: """Creates or updates an agent pool. Creates or updates an agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :param parameters: Parameters supplied to the Create or Update an agent pool operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2020_03_01.models.AgentPool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -302,20 +302,99 @@ async def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_03_01.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AgentPool]: + """Creates or updates an agent pool. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: Parameters supplied to the Create or Update an agent pool operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AgentPool or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_03_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: Union[_models.AgentPool, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.AgentPool]: + """Creates or updates an agent pool. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: Parameters supplied to the Create or Update an agent pool operation. Is + either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2020_03_01.models.AgentPool or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AgentPool or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_03_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -324,66 +403,55 @@ async def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -391,10 +459,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -404,26 +471,21 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + async def begin_delete( + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes an agent pool. Deletes the agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -435,100 +497,86 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace_async async def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPoolUpgradeProfile: """Gets upgrade profile for an agent pool. Gets the details of the upgrade profile for an agent pool with a specified resource group and managed cluster name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolUpgradeProfile, or the result of cls(response) + :return: AgentPoolUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_03_01.models.AgentPoolUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -536,64 +584,56 @@ async def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolUpgradeProfile', pipeline_response) + deserialized = self._deserialize("AgentPoolUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore @distributed_trace_async async def get_available_agent_pool_versions( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported versions for the specified agent pool. Gets a list of supported versions for the specified agent pool. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolAvailableVersions, or the result of cls(response) + :return: AgentPoolAvailableVersions or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_03_01.models.AgentPoolAvailableVersions - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolAvailableVersions] - request = build_get_available_agent_pool_versions_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_available_agent_pool_versions.metadata['url'], + template_url=self.get_available_agent_pool_versions.metadata["url"], headers=_headers, params=_params, ) @@ -601,22 +641,20 @@ async def get_available_agent_pool_versions( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolAvailableVersions', pipeline_response) + deserialized = self._deserialize("AgentPoolAvailableVersions", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_available_agent_pool_versions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore - + get_available_agent_pool_versions.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/aio/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/aio/operations/_managed_clusters_operations.py index 82a58bc1f3ad..fffdc6f406f2 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/aio/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/aio/operations/_managed_clusters_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +29,27 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._managed_clusters_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_access_profile_request, build_get_request, build_get_upgrade_profile_request, build_list_by_resource_group_request, build_list_cluster_admin_credentials_request, build_list_cluster_monitoring_user_credentials_request, build_list_cluster_user_credentials_request, build_list_request, build_reset_aad_profile_request_initial, build_reset_service_principal_profile_request_initial, build_rotate_cluster_certificates_request_initial, build_update_tags_request_initial -T = TypeVar('T') +from ...operations._managed_clusters_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_access_profile_request, + build_get_request, + build_get_upgrade_profile_request, + build_list_by_resource_group_request, + build_list_cluster_admin_credentials_request, + build_list_cluster_monitoring_user_credentials_request, + build_list_cluster_user_credentials_request, + build_list_request, + build_reset_aad_profile_request, + build_reset_service_principal_profile_request, + build_rotate_cluster_certificates_request, + build_update_tags_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class ManagedClustersOperations: """ .. warning:: @@ -45,41 +69,35 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.ManagedClusterListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.ManagedCluster"]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. The operation returns properties of each managed cluster. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_03_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_03_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -87,14 +105,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -110,10 +125,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -123,50 +136,44 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.ManagedClusterListResult]: + self, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ManagedCluster"]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. The operation returns properties of each managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_03_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_03_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -174,15 +181,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -198,10 +201,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -211,51 +212,43 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace_async async def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.ManagedClusterUpgradeProfile: """Gets upgrade profile for a managed cluster. Gets the details of the upgrade profile for a managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterUpgradeProfile, or the result of cls(response) + :return: ManagedClusterUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_03_01.models.ManagedClusterUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -263,69 +256,60 @@ async def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterUpgradeProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore @distributed_trace_async async def get_access_profile( - self, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, role_name: str, **kwargs: Any ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. Gets the accessProfile for the specified role name of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param role_name: The name of the role for managed cluster accessProfile resource. + :param role_name: The name of the role for managed cluster accessProfile resource. Required. :type role_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterAccessProfile, or the result of cls(response) + :return: ManagedClusterAccessProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_03_01.models.ManagedClusterAccessProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterAccessProfile] - request = build_get_access_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, role_name=role_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_access_profile.metadata['url'], + template_url=self.get_access_profile.metadata["url"], headers=_headers, params=_params, ) @@ -333,64 +317,56 @@ async def get_access_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterAccessProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterAccessProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_access_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore - + get_access_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore @distributed_trace_async async def list_cluster_admin_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster admin credential of a managed cluster. Gets cluster admin credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_03_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_admin_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_admin_credentials.metadata['url'], + template_url=self.list_cluster_admin_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -398,64 +374,56 @@ async def list_cluster_admin_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_admin_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore - + list_cluster_admin_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore @distributed_trace_async async def list_cluster_user_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster user credential of a managed cluster. Gets cluster user credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_03_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_user_credentials.metadata['url'], + template_url=self.list_cluster_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -463,65 +431,57 @@ async def list_cluster_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore - + list_cluster_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore @distributed_trace_async async def list_cluster_monitoring_user_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster monitoring user credential of a managed cluster. Gets cluster monitoring user credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_03_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_monitoring_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + template_url=self.list_cluster_monitoring_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -529,64 +489,54 @@ async def list_cluster_monitoring_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_monitoring_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore - + list_cluster_monitoring_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore @distributed_trace_async - async def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.ManagedCluster: + async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.ManagedCluster: """Gets a managed cluster. Gets the details of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedCluster, or the result of cls(response) + :return: ManagedCluster or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_03_01.models.ManagedCluster - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -594,55 +544,54 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _create_or_update_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.ManagedCluster, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'ManagedCluster') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedCluster") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -650,10 +599,9 @@ async def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -661,25 +609,26 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - @distributed_trace_async + @overload async def begin_create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedCluster, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. @@ -687,12 +636,90 @@ async def begin_create_or_update( Creates or updates a managed cluster with the specified configuration for agents and Kubernetes version. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2020_03_01.models.ManagedCluster + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_03_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster with the specified configuration for agents and Kubernetes + version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_03_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster with the specified configuration for agents and Kubernetes + version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. Is + either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2020_03_01.models.ManagedCluster or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -705,20 +732,17 @@ async def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_03_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -726,69 +750,66 @@ async def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _update_tags_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.TagsObject, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request_initial( - subscription_id=self._config.subscription_id, + request = build_update_tags_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_tags_initial.metadata['url'], + content=_content, + template_url=self._update_tags_initial.metadata["url"], headers=_headers, params=_params, ) @@ -796,44 +817,85 @@ async def _update_tags_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_tags_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _update_tags_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - @distributed_trace_async + @overload async def begin_update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates a managed cluster with the specified tags. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2020_03_01.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_03_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates a managed cluster with the specified tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -846,20 +908,50 @@ async def begin_update_tags( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_03_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates a managed cluster with the specified tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2020_03_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_03_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, @@ -867,64 +959,54 @@ async def begin_update_tags( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -932,10 +1014,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -945,23 +1026,17 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: + async def begin_delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Deletes a managed cluster. Deletes the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -973,85 +1048,83 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterServicePrincipalProfile, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterServicePrincipalProfile") - request = build_reset_service_principal_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_service_principal_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_service_principal_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_service_principal_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1059,10 +1132,9 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1072,29 +1144,106 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist if cls: return cls(pipeline_response, None, {}) - _reset_service_principal_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore - + _reset_service_principal_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore - @distributed_trace_async - async def begin_reset_service_principal_profile( # pylint: disable=inconsistent-return-statements + @overload + async def begin_reset_service_principal_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterServicePrincipalProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: """Reset Service Principal Profile of a managed cluster. Update the service principal Profile for a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a - Managed Cluster. + Managed Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2020_03_01.models.ManagedClusterServicePrincipalProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset Service Principal Profile of a managed cluster. + + Update the service principal Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a + Managed Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset Service Principal Profile of a managed cluster. + + Update the service principal Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a + Managed Cluster. Is either a model type or a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2020_03_01.models.ManagedClusterServicePrincipalProfile or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -1105,20 +1254,17 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1126,67 +1272,68 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_service_principal_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + begin_reset_service_principal_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterAADProfile, + parameters: Union[_models.ManagedClusterAADProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterAADProfile") - request = build_reset_aad_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_aad_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_aad_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_aad_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1194,10 +1341,9 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1207,28 +1353,69 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta if cls: return cls(pipeline_response, None, {}) - _reset_aad_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - + _reset_aad_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - @distributed_trace_async - async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements + @overload + async def begin_reset_aad_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterAADProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: """Reset AAD Profile of a managed cluster. Update the AAD Profile for a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed - Cluster. + Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2020_03_01.models.ManagedClusterAADProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset AAD Profile of a managed cluster. + + Update the AAD Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed + Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -1239,20 +1426,53 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterAADProfile, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset AAD Profile of a managed cluster. + + Update the AAD Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed + Cluster. Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2020_03_01.models.ManagedClusterAADProfile or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1260,62 +1480,52 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_aad_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + begin_reset_aad_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_rotate_cluster_certificates_request_initial( - subscription_id=self._config.subscription_id, + request = build_rotate_cluster_certificates_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._rotate_cluster_certificates_initial.metadata['url'], + template_url=self._rotate_cluster_certificates_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1323,10 +1533,9 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1336,23 +1545,19 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- if cls: return cls(pipeline_response, None, {}) - _rotate_cluster_certificates_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore - + _rotate_cluster_certificates_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore @distributed_trace_async - async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + async def begin_rotate_cluster_certificates( + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Rotate certificates of a managed cluster. Rotate certificates of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1364,52 +1569,45 @@ async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-ret Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._rotate_cluster_certificates_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_rotate_cluster_certificates.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore + begin_rotate_cluster_certificates.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/aio/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/aio/operations/_operations.py index 73fb21f8242d..3ffed01935bf 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/aio/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/aio/operations/_operations.py @@ -7,9 +7,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,9 +27,11 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._operations import build_list_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class Operations: """ .. warning:: @@ -42,36 +51,31 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.OperationListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.OperationValue"]: """Gets a list of compute operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationListResult or the result of cls(response) + :return: An iterator like instance of either OperationValue or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_03_01.models.OperationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_03_01.models.OperationValue] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -79,13 +83,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -101,10 +103,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -114,8 +114,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.ContainerService/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ContainerService/operations"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/aio/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/aio/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/aio/operations/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/aio/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/models/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/models/__init__.py index ee6bfbcd2b80..e0f8263d7d19 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/models/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/models/__init__.py @@ -53,91 +53,89 @@ from ._models_py3 import TagsObject from ._models_py3 import UserAssignedIdentity - -from ._container_service_client_enums import ( - AgentPoolMode, - AgentPoolType, - ContainerServiceStorageProfileTypes, - ContainerServiceVMSizeTypes, - Count, - LoadBalancerSku, - ManagedClusterSKUName, - ManagedClusterSKUTier, - NetworkMode, - NetworkPlugin, - NetworkPolicy, - OSType, - OutboundType, - ResourceIdentityType, - ScaleSetEvictionPolicy, - ScaleSetPriority, -) +from ._container_service_client_enums import AgentPoolMode +from ._container_service_client_enums import AgentPoolType +from ._container_service_client_enums import ContainerServiceStorageProfileTypes +from ._container_service_client_enums import ContainerServiceVMSizeTypes +from ._container_service_client_enums import Count +from ._container_service_client_enums import LoadBalancerSku +from ._container_service_client_enums import ManagedClusterSKUName +from ._container_service_client_enums import ManagedClusterSKUTier +from ._container_service_client_enums import NetworkMode +from ._container_service_client_enums import NetworkPlugin +from ._container_service_client_enums import NetworkPolicy +from ._container_service_client_enums import OSType +from ._container_service_client_enums import OutboundType +from ._container_service_client_enums import ResourceIdentityType +from ._container_service_client_enums import ScaleSetEvictionPolicy +from ._container_service_client_enums import ScaleSetPriority from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'AgentPool', - 'AgentPoolAvailableVersions', - 'AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem', - 'AgentPoolListResult', - 'AgentPoolUpgradeProfile', - 'AgentPoolUpgradeProfilePropertiesUpgradesItem', - 'BaseManagedCluster', - 'CloudErrorBody', - 'ContainerServiceDiagnosticsProfile', - 'ContainerServiceLinuxProfile', - 'ContainerServiceMasterProfile', - 'ContainerServiceNetworkProfile', - 'ContainerServiceSshConfiguration', - 'ContainerServiceSshPublicKey', - 'ContainerServiceVMDiagnostics', - 'CredentialResult', - 'CredentialResults', - 'ManagedCluster', - 'ManagedClusterAADProfile', - 'ManagedClusterAPIServerAccessProfile', - 'ManagedClusterAccessProfile', - 'ManagedClusterAddonProfile', - 'ManagedClusterAddonProfileIdentity', - 'ManagedClusterAgentPoolProfile', - 'ManagedClusterAgentPoolProfileProperties', - 'ManagedClusterIdentity', - 'ManagedClusterListResult', - 'ManagedClusterLoadBalancerProfile', - 'ManagedClusterLoadBalancerProfileManagedOutboundIPs', - 'ManagedClusterLoadBalancerProfileOutboundIPPrefixes', - 'ManagedClusterLoadBalancerProfileOutboundIPs', - 'ManagedClusterPoolUpgradeProfile', - 'ManagedClusterPoolUpgradeProfileUpgradesItem', - 'ManagedClusterPropertiesAutoScalerProfile', - 'ManagedClusterPropertiesIdentityProfileValue', - 'ManagedClusterSKU', - 'ManagedClusterServicePrincipalProfile', - 'ManagedClusterUpgradeProfile', - 'ManagedClusterWindowsProfile', - 'OperationListResult', - 'OperationValue', - 'Resource', - 'ResourceReference', - 'SubResource', - 'TagsObject', - 'UserAssignedIdentity', - 'AgentPoolMode', - 'AgentPoolType', - 'ContainerServiceStorageProfileTypes', - 'ContainerServiceVMSizeTypes', - 'Count', - 'LoadBalancerSku', - 'ManagedClusterSKUName', - 'ManagedClusterSKUTier', - 'NetworkMode', - 'NetworkPlugin', - 'NetworkPolicy', - 'OSType', - 'OutboundType', - 'ResourceIdentityType', - 'ScaleSetEvictionPolicy', - 'ScaleSetPriority', + "AgentPool", + "AgentPoolAvailableVersions", + "AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem", + "AgentPoolListResult", + "AgentPoolUpgradeProfile", + "AgentPoolUpgradeProfilePropertiesUpgradesItem", + "BaseManagedCluster", + "CloudErrorBody", + "ContainerServiceDiagnosticsProfile", + "ContainerServiceLinuxProfile", + "ContainerServiceMasterProfile", + "ContainerServiceNetworkProfile", + "ContainerServiceSshConfiguration", + "ContainerServiceSshPublicKey", + "ContainerServiceVMDiagnostics", + "CredentialResult", + "CredentialResults", + "ManagedCluster", + "ManagedClusterAADProfile", + "ManagedClusterAPIServerAccessProfile", + "ManagedClusterAccessProfile", + "ManagedClusterAddonProfile", + "ManagedClusterAddonProfileIdentity", + "ManagedClusterAgentPoolProfile", + "ManagedClusterAgentPoolProfileProperties", + "ManagedClusterIdentity", + "ManagedClusterListResult", + "ManagedClusterLoadBalancerProfile", + "ManagedClusterLoadBalancerProfileManagedOutboundIPs", + "ManagedClusterLoadBalancerProfileOutboundIPPrefixes", + "ManagedClusterLoadBalancerProfileOutboundIPs", + "ManagedClusterPoolUpgradeProfile", + "ManagedClusterPoolUpgradeProfileUpgradesItem", + "ManagedClusterPropertiesAutoScalerProfile", + "ManagedClusterPropertiesIdentityProfileValue", + "ManagedClusterSKU", + "ManagedClusterServicePrincipalProfile", + "ManagedClusterUpgradeProfile", + "ManagedClusterWindowsProfile", + "OperationListResult", + "OperationValue", + "Resource", + "ResourceReference", + "SubResource", + "TagsObject", + "UserAssignedIdentity", + "AgentPoolMode", + "AgentPoolType", + "ContainerServiceStorageProfileTypes", + "ContainerServiceVMSizeTypes", + "Count", + "LoadBalancerSku", + "ManagedClusterSKUName", + "ManagedClusterSKUTier", + "NetworkMode", + "NetworkPlugin", + "NetworkPolicy", + "OSType", + "OutboundType", + "ResourceIdentityType", + "ScaleSetEvictionPolicy", + "ScaleSetPriority", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/models/_container_service_client_enums.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/models/_container_service_client_enums.py index 2b17b2cc88e8..b5451c2a9dec 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/models/_container_service_client_enums.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/models/_container_service_client_enums.py @@ -11,19 +11,19 @@ class AgentPoolMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """AgentPoolMode represents mode of an agent pool. - """ + """AgentPoolMode represents mode of an agent pool.""" SYSTEM = "System" USER = "User" + class AgentPoolType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """AgentPoolType represents types of an agent pool. - """ + """AgentPoolType represents types of an agent pool.""" VIRTUAL_MACHINE_SCALE_SETS = "VirtualMachineScaleSets" AVAILABILITY_SET = "AvailabilitySet" + class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the orchestrator choice. @@ -32,9 +32,9 @@ class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEn STORAGE_ACCOUNT = "StorageAccount" MANAGED_DISKS = "ManagedDisks" + class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Size of agent VMs. - """ + """Size of agent VMs.""" STANDARD_A1 = "Standard_A1" STANDARD_A10 = "Standard_A10" @@ -211,6 +211,7 @@ class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): STANDARD_NV24 = "Standard_NV24" STANDARD_NV6 = "Standard_NV6" + class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): """Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, and 5. The default value is 1. @@ -220,61 +221,62 @@ class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): THREE = 3 FIVE = 5 + class LoadBalancerSku(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The load balancer sku for the managed cluster. - """ + """The load balancer sku for the managed cluster.""" STANDARD = "standard" BASIC = "basic" + class ManagedClusterSKUName(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Name of a managed cluster SKU. - """ + """Name of a managed cluster SKU.""" BASIC = "Basic" + class ManagedClusterSKUTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Tier of a managed cluster SKU. - """ + """Tier of a managed cluster SKU.""" PAID = "Paid" FREE = "Free" + class NetworkMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Network mode used for building Kubernetes network. - """ + """Network mode used for building Kubernetes network.""" TRANSPARENT = "transparent" BRIDGE = "bridge" + class NetworkPlugin(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Network plugin used for building Kubernetes network. - """ + """Network plugin used for building Kubernetes network.""" AZURE = "azure" KUBENET = "kubenet" + class NetworkPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Network policy used for building Kubernetes network. - """ + """Network policy used for building Kubernetes network.""" CALICO = "calico" AZURE = "azure" + class OSType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """OsType to be used to specify os type. Choose from Linux and Windows. Default to Linux. - """ + """OsType to be used to specify os type. Choose from Linux and Windows. Default to Linux.""" LINUX = "Linux" WINDOWS = "Windows" + class OutboundType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The outbound (egress) routing method. - """ + """The outbound (egress) routing method.""" LOAD_BALANCER = "loadBalancer" USER_DEFINED_ROUTING = "userDefinedRouting" + class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of identity used for the managed cluster. Type 'SystemAssigned' will use an implicitly created identity in master components and an auto-created user assigned identity in MC_ @@ -285,6 +287,7 @@ class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): SYSTEM_ASSIGNED = "SystemAssigned" NONE = "None" + class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ScaleSetEvictionPolicy to be used to specify eviction policy for Spot or low priority virtual machine scale set. Default to Delete. @@ -293,9 +296,9 @@ class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): DELETE = "Delete" DEALLOCATE = "Deallocate" + class ScaleSetPriority(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """ScaleSetPriority to be used to specify virtual machine scale set priority. Default to regular. - """ + """ScaleSetPriority to be used to specify virtual machine scale set priority. Default to regular.""" SPOT = "Spot" LOW = "Low" diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/models/_models_py3.py index 0cc9cca28ea1..fb98d1e2232f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/models/_models_py3.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/models/_models_py3.py @@ -1,4 +1,5 @@ # coding=utf-8 +# pylint: disable=too-many-lines # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -8,14 +9,14 @@ from typing import Dict, List, Optional, TYPE_CHECKING, Union -import msrest.serialization +from ... import _serialization if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - import __init__ as _models + from .. import models as _models -class SubResource(msrest.serialization.Model): +class SubResource(_serialization.Model): """Reference to another subresource. Variables are only populated by the server, and will be ignored when sending a request. @@ -30,30 +31,26 @@ class SubResource(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(SubResource, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.id = None self.name = None self.type = None -class AgentPool(SubResource): +class AgentPool(SubResource): # pylint: disable=too-many-instance-attributes """Agent Pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -106,7 +103,7 @@ class AgentPool(SubResource): "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :vartype vm_size: str or ~azure.mgmt.containerservice.v2020_03_01.models.ContainerServiceVMSizeTypes :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine @@ -118,7 +115,7 @@ class AgentPool(SubResource): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Known values are: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux" and "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2020_03_01.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -127,10 +124,11 @@ class AgentPool(SubResource): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar type_properties_type: AgentPoolType represents types of an agent pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :vartype type_properties_type: str or ~azure.mgmt.containerservice.v2020_03_01.models.AgentPoolType - :ivar mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", "User". + :ivar mode: AgentPoolMode represents mode of an agent pool. Known values are: "System" and + "User". :vartype mode: str or ~azure.mgmt.containerservice.v2020_03_01.models.AgentPoolMode :ivar orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -144,21 +142,19 @@ class AgentPool(SubResource): :ivar enable_node_public_ip: Enable public IP for nodes. :vartype enable_node_public_ip: bool :ivar scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Known values are: "Spot", "Low", "Regular". Default value: - "Regular". + priority. Default to regular. Known values are: "Spot", "Low", and "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_03_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy for Spot or low priority virtual machine scale set. Default to Delete. Known values are: - "Delete", "Deallocate". Default value: "Delete". + "Delete" and "Deallocate". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_03_01.models.ScaleSetEvictionPolicy :ivar spot_max_price: SpotMaxPrice to be used to specify the maximum price you are willing to pay in US Dollars. Possible values are any decimal value greater than zero or -1 which indicates default price to be up-to on-demand. :vartype spot_max_price: float - :ivar tags: A set of tags. Agent pool tags to be persisted on the agent pool virtual machine - scale set. + :ivar tags: Agent pool tags to be persisted on the agent pool virtual machine scale set. :vartype tags: dict[str, str] :ivar node_labels: Agent pool node labels to be persisted across all nodes in agent pool. :vartype node_labels: dict[str, str] @@ -168,41 +164,41 @@ class AgentPool(SubResource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'os_disk_size_gb': {'maximum': 1023, 'minimum': 0}, - 'provisioning_state': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "os_disk_size_gb": {"maximum": 1023, "minimum": 0}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'count': {'key': 'properties.count', 'type': 'int'}, - 'vm_size': {'key': 'properties.vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'properties.osDiskSizeGB', 'type': 'int'}, - 'vnet_subnet_id': {'key': 'properties.vnetSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'properties.maxPods', 'type': 'int'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'max_count': {'key': 'properties.maxCount', 'type': 'int'}, - 'min_count': {'key': 'properties.minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'properties.enableAutoScaling', 'type': 'bool'}, - 'type_properties_type': {'key': 'properties.type', 'type': 'str'}, - 'mode': {'key': 'properties.mode', 'type': 'str'}, - 'orchestrator_version': {'key': 'properties.orchestratorVersion', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'availability_zones': {'key': 'properties.availabilityZones', 'type': '[str]'}, - 'enable_node_public_ip': {'key': 'properties.enableNodePublicIP', 'type': 'bool'}, - 'scale_set_priority': {'key': 'properties.scaleSetPriority', 'type': 'str'}, - 'scale_set_eviction_policy': {'key': 'properties.scaleSetEvictionPolicy', 'type': 'str'}, - 'spot_max_price': {'key': 'properties.spotMaxPrice', 'type': 'float'}, - 'tags': {'key': 'properties.tags', 'type': '{str}'}, - 'node_labels': {'key': 'properties.nodeLabels', 'type': '{str}'}, - 'node_taints': {'key': 'properties.nodeTaints', 'type': '[str]'}, - } - - def __init__( + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "count": {"key": "properties.count", "type": "int"}, + "vm_size": {"key": "properties.vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "properties.osDiskSizeGB", "type": "int"}, + "vnet_subnet_id": {"key": "properties.vnetSubnetID", "type": "str"}, + "max_pods": {"key": "properties.maxPods", "type": "int"}, + "os_type": {"key": "properties.osType", "type": "str"}, + "max_count": {"key": "properties.maxCount", "type": "int"}, + "min_count": {"key": "properties.minCount", "type": "int"}, + "enable_auto_scaling": {"key": "properties.enableAutoScaling", "type": "bool"}, + "type_properties_type": {"key": "properties.type", "type": "str"}, + "mode": {"key": "properties.mode", "type": "str"}, + "orchestrator_version": {"key": "properties.orchestratorVersion", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "availability_zones": {"key": "properties.availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "properties.enableNodePublicIP", "type": "bool"}, + "scale_set_priority": {"key": "properties.scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "properties.scaleSetEvictionPolicy", "type": "str"}, + "spot_max_price": {"key": "properties.spotMaxPrice", "type": "float"}, + "tags": {"key": "properties.tags", "type": "{str}"}, + "node_labels": {"key": "properties.nodeLabels", "type": "{str}"}, + "node_taints": {"key": "properties.nodeTaints", "type": "[str]"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, count: Optional[int] = None, @@ -210,7 +206,7 @@ def __init__( os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, @@ -219,9 +215,9 @@ def __init__( orchestrator_version: Optional[str] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, - scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", - spot_max_price: Optional[float] = -1, + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", + spot_max_price: float = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, @@ -269,7 +265,7 @@ def __init__( "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :paramtype vm_size: str or ~azure.mgmt.containerservice.v2020_03_01.models.ContainerServiceVMSizeTypes :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every @@ -281,7 +277,7 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux" and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2020_03_01.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -290,10 +286,10 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword type_properties_type: AgentPoolType represents types of an agent pool. Known values - are: "VirtualMachineScaleSets", "AvailabilitySet". + are: "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type_properties_type: str or ~azure.mgmt.containerservice.v2020_03_01.models.AgentPoolType - :keyword mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", + :keyword mode: AgentPoolMode represents mode of an agent pool. Known values are: "System" and "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2020_03_01.models.AgentPoolMode :keyword orchestrator_version: Version of orchestrator specified when creating the managed @@ -305,21 +301,19 @@ def __init__( :keyword enable_node_public_ip: Enable public IP for nodes. :paramtype enable_node_public_ip: bool :keyword scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Known values are: "Spot", "Low", "Regular". Default value: - "Regular". + priority. Default to regular. Known values are: "Spot", "Low", and "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_03_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy for Spot or low priority virtual machine scale set. Default to Delete. Known values are: - "Delete", "Deallocate". Default value: "Delete". + "Delete" and "Deallocate". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_03_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: SpotMaxPrice to be used to specify the maximum price you are willing to pay in US Dollars. Possible values are any decimal value greater than zero or -1 which indicates default price to be up-to on-demand. :paramtype spot_max_price: float - :keyword tags: A set of tags. Agent pool tags to be persisted on the agent pool virtual machine - scale set. + :keyword tags: Agent pool tags to be persisted on the agent pool virtual machine scale set. :paramtype tags: dict[str, str] :keyword node_labels: Agent pool node labels to be persisted across all nodes in agent pool. :paramtype node_labels: dict[str, str] @@ -327,7 +321,7 @@ def __init__( key=value:NoSchedule. :paramtype node_taints: list[str] """ - super(AgentPool, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.vm_size = vm_size self.os_disk_size_gb = os_disk_size_gb @@ -351,7 +345,7 @@ def __init__( self.node_taints = node_taints -class AgentPoolAvailableVersions(msrest.serialization.Model): +class AgentPoolAvailableVersions(_serialization.Model): """The list of available versions for an agent pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -368,16 +362,19 @@ class AgentPoolAvailableVersions(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'agent_pool_versions': {'key': 'properties.agentPoolVersions', 'type': '[AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "agent_pool_versions": { + "key": "properties.agentPoolVersions", + "type": "[AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem]", + }, } def __init__( @@ -391,14 +388,14 @@ def __init__( :paramtype agent_pool_versions: list[~azure.mgmt.containerservice.v2020_03_01.models.AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem] """ - super(AgentPoolAvailableVersions, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None self.agent_pool_versions = agent_pool_versions -class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(msrest.serialization.Model): +class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(_serialization.Model): """AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem. :ivar default: Whether this version is the default agent pool version. @@ -410,9 +407,9 @@ class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(msrest.serializa """ _attribute_map = { - 'default': {'key': 'default', 'type': 'bool'}, - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "default": {"key": "default", "type": "bool"}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } def __init__( @@ -431,13 +428,13 @@ def __init__( :keyword is_preview: Whether Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.default = default self.kubernetes_version = kubernetes_version self.is_preview = is_preview -class AgentPoolListResult(msrest.serialization.Model): +class AgentPoolListResult(_serialization.Model): """The response from the List Agent Pools operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -449,30 +446,25 @@ class AgentPoolListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[AgentPool]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[AgentPool]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.AgentPool"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.AgentPool"]] = None, **kwargs): """ :keyword value: The list of agent pools. :paramtype value: list[~azure.mgmt.containerservice.v2020_03_01.models.AgentPool] """ - super(AgentPoolListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class AgentPoolUpgradeProfile(msrest.serialization.Model): +class AgentPoolUpgradeProfile(_serialization.Model): """The list of available upgrades for an agent pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -485,10 +477,10 @@ class AgentPoolUpgradeProfile(msrest.serialization.Model): :vartype name: str :ivar type: Type of the agent pool upgrade profile. :vartype type: str - :ivar kubernetes_version: Required. Kubernetes version (major, minor, patch). + :ivar kubernetes_version: Kubernetes version (major, minor, patch). Required. :vartype kubernetes_version: str - :ivar os_type: Required. OsType to be used to specify os type. Choose from Linux and Windows. - Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to + Linux. Known values are: "Linux" and "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2020_03_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -496,20 +488,20 @@ class AgentPoolUpgradeProfile(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kubernetes_version': {'required': True}, - 'os_type': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "kubernetes_version": {"required": True}, + "os_type": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'kubernetes_version': {'key': 'properties.kubernetesVersion', 'type': 'str'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'upgrades': {'key': 'properties.upgrades', 'type': '[AgentPoolUpgradeProfilePropertiesUpgradesItem]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "os_type": {"key": "properties.osType", "type": "str"}, + "upgrades": {"key": "properties.upgrades", "type": "[AgentPoolUpgradeProfilePropertiesUpgradesItem]"}, } def __init__( @@ -521,16 +513,16 @@ def __init__( **kwargs ): """ - :keyword kubernetes_version: Required. Kubernetes version (major, minor, patch). + :keyword kubernetes_version: Kubernetes version (major, minor, patch). Required. :paramtype kubernetes_version: str - :keyword os_type: Required. OsType to be used to specify os type. Choose from Linux and - Windows. Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default + to Linux. Known values are: "Linux" and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2020_03_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: list[~azure.mgmt.containerservice.v2020_03_01.models.AgentPoolUpgradeProfilePropertiesUpgradesItem] """ - super(AgentPoolUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -539,7 +531,7 @@ def __init__( self.upgrades = upgrades -class AgentPoolUpgradeProfilePropertiesUpgradesItem(msrest.serialization.Model): +class AgentPoolUpgradeProfilePropertiesUpgradesItem(_serialization.Model): """AgentPoolUpgradeProfilePropertiesUpgradesItem. :ivar kubernetes_version: Kubernetes version (major, minor, patch). @@ -549,29 +541,23 @@ class AgentPoolUpgradeProfilePropertiesUpgradesItem(msrest.serialization.Model): """ _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } - def __init__( - self, - *, - kubernetes_version: Optional[str] = None, - is_preview: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, kubernetes_version: Optional[str] = None, is_preview: Optional[bool] = None, **kwargs): """ :keyword kubernetes_version: Kubernetes version (major, minor, patch). :paramtype kubernetes_version: str :keyword is_preview: Whether Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(AgentPoolUpgradeProfilePropertiesUpgradesItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.is_preview = is_preview -class BaseManagedCluster(msrest.serialization.Model): +class BaseManagedCluster(_serialization.Model): # pylint: disable=too-many-instance-attributes """BaseManagedCluster. Variables are only populated by the server, and will be ignored when sending a request. @@ -635,34 +621,46 @@ class BaseManagedCluster(msrest.serialization.Model): """ _validation = { - 'provisioning_state': {'readonly': True}, - 'max_agent_pools': {'readonly': True}, - 'fqdn': {'readonly': True}, - 'private_fqdn': {'readonly': True}, + "provisioning_state": {"readonly": True}, + "max_agent_pools": {"readonly": True}, + "fqdn": {"readonly": True}, + "private_fqdn": {"readonly": True}, } _attribute_map = { - 'identity': {'key': 'identity', 'type': 'ManagedClusterIdentity'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'max_agent_pools': {'key': 'properties.maxAgentPools', 'type': 'int'}, - 'kubernetes_version': {'key': 'properties.kubernetesVersion', 'type': 'str'}, - 'dns_prefix': {'key': 'properties.dnsPrefix', 'type': 'str'}, - 'fqdn': {'key': 'properties.fqdn', 'type': 'str'}, - 'private_fqdn': {'key': 'properties.privateFQDN', 'type': 'str'}, - 'agent_pool_profiles': {'key': 'properties.agentPoolProfiles', 'type': '[ManagedClusterAgentPoolProfile]'}, - 'linux_profile': {'key': 'properties.linuxProfile', 'type': 'ContainerServiceLinuxProfile'}, - 'windows_profile': {'key': 'properties.windowsProfile', 'type': 'ManagedClusterWindowsProfile'}, - 'service_principal_profile': {'key': 'properties.servicePrincipalProfile', 'type': 'ManagedClusterServicePrincipalProfile'}, - 'addon_profiles': {'key': 'properties.addonProfiles', 'type': '{ManagedClusterAddonProfile}'}, - 'node_resource_group': {'key': 'properties.nodeResourceGroup', 'type': 'str'}, - 'enable_rbac': {'key': 'properties.enableRBAC', 'type': 'bool'}, - 'enable_pod_security_policy': {'key': 'properties.enablePodSecurityPolicy', 'type': 'bool'}, - 'network_profile': {'key': 'properties.networkProfile', 'type': 'ContainerServiceNetworkProfile'}, - 'aad_profile': {'key': 'properties.aadProfile', 'type': 'ManagedClusterAADProfile'}, - 'auto_scaler_profile': {'key': 'properties.autoScalerProfile', 'type': 'ManagedClusterPropertiesAutoScalerProfile'}, - 'api_server_access_profile': {'key': 'properties.apiServerAccessProfile', 'type': 'ManagedClusterAPIServerAccessProfile'}, - 'disk_encryption_set_id': {'key': 'properties.diskEncryptionSetID', 'type': 'str'}, - 'identity_profile': {'key': 'properties.identityProfile', 'type': '{ManagedClusterPropertiesIdentityProfileValue}'}, + "identity": {"key": "identity", "type": "ManagedClusterIdentity"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "max_agent_pools": {"key": "properties.maxAgentPools", "type": "int"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "dns_prefix": {"key": "properties.dnsPrefix", "type": "str"}, + "fqdn": {"key": "properties.fqdn", "type": "str"}, + "private_fqdn": {"key": "properties.privateFQDN", "type": "str"}, + "agent_pool_profiles": {"key": "properties.agentPoolProfiles", "type": "[ManagedClusterAgentPoolProfile]"}, + "linux_profile": {"key": "properties.linuxProfile", "type": "ContainerServiceLinuxProfile"}, + "windows_profile": {"key": "properties.windowsProfile", "type": "ManagedClusterWindowsProfile"}, + "service_principal_profile": { + "key": "properties.servicePrincipalProfile", + "type": "ManagedClusterServicePrincipalProfile", + }, + "addon_profiles": {"key": "properties.addonProfiles", "type": "{ManagedClusterAddonProfile}"}, + "node_resource_group": {"key": "properties.nodeResourceGroup", "type": "str"}, + "enable_rbac": {"key": "properties.enableRBAC", "type": "bool"}, + "enable_pod_security_policy": {"key": "properties.enablePodSecurityPolicy", "type": "bool"}, + "network_profile": {"key": "properties.networkProfile", "type": "ContainerServiceNetworkProfile"}, + "aad_profile": {"key": "properties.aadProfile", "type": "ManagedClusterAADProfile"}, + "auto_scaler_profile": { + "key": "properties.autoScalerProfile", + "type": "ManagedClusterPropertiesAutoScalerProfile", + }, + "api_server_access_profile": { + "key": "properties.apiServerAccessProfile", + "type": "ManagedClusterAPIServerAccessProfile", + }, + "disk_encryption_set_id": {"key": "properties.diskEncryptionSetID", "type": "str"}, + "identity_profile": { + "key": "properties.identityProfile", + "type": "{ManagedClusterPropertiesIdentityProfileValue}", + }, } def __init__( @@ -737,7 +735,7 @@ def __init__( :paramtype identity_profile: dict[str, ~azure.mgmt.containerservice.v2020_03_01.models.ManagedClusterPropertiesIdentityProfileValue] """ - super(BaseManagedCluster, self).__init__(**kwargs) + super().__init__(**kwargs) self.identity = identity self.provisioning_state = None self.max_agent_pools = None @@ -761,7 +759,7 @@ def __init__( self.identity_profile = identity_profile -class CloudErrorBody(msrest.serialization.Model): +class CloudErrorBody(_serialization.Model): """An error response from the Container service. :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed @@ -778,10 +776,10 @@ class CloudErrorBody(msrest.serialization.Model): """ _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[CloudErrorBody]"}, } def __init__( @@ -806,87 +804,76 @@ def __init__( :keyword details: A list of additional details about the error. :paramtype details: list[~azure.mgmt.containerservice.v2020_03_01.models.CloudErrorBody] """ - super(CloudErrorBody, self).__init__(**kwargs) + super().__init__(**kwargs) self.code = code self.message = message self.target = target self.details = details -class ContainerServiceDiagnosticsProfile(msrest.serialization.Model): +class ContainerServiceDiagnosticsProfile(_serialization.Model): """Profile for diagnostics on the container service cluster. All required parameters must be populated in order to send to Azure. - :ivar vm_diagnostics: Required. Profile for diagnostics on the container service VMs. + :ivar vm_diagnostics: Profile for diagnostics on the container service VMs. Required. :vartype vm_diagnostics: ~azure.mgmt.containerservice.v2020_03_01.models.ContainerServiceVMDiagnostics """ _validation = { - 'vm_diagnostics': {'required': True}, + "vm_diagnostics": {"required": True}, } _attribute_map = { - 'vm_diagnostics': {'key': 'vmDiagnostics', 'type': 'ContainerServiceVMDiagnostics'}, + "vm_diagnostics": {"key": "vmDiagnostics", "type": "ContainerServiceVMDiagnostics"}, } - def __init__( - self, - *, - vm_diagnostics: "_models.ContainerServiceVMDiagnostics", - **kwargs - ): + def __init__(self, *, vm_diagnostics: "_models.ContainerServiceVMDiagnostics", **kwargs): """ - :keyword vm_diagnostics: Required. Profile for diagnostics on the container service VMs. + :keyword vm_diagnostics: Profile for diagnostics on the container service VMs. Required. :paramtype vm_diagnostics: ~azure.mgmt.containerservice.v2020_03_01.models.ContainerServiceVMDiagnostics """ - super(ContainerServiceDiagnosticsProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.vm_diagnostics = vm_diagnostics -class ContainerServiceLinuxProfile(msrest.serialization.Model): +class ContainerServiceLinuxProfile(_serialization.Model): """Profile for Linux VMs in the container service cluster. All required parameters must be populated in order to send to Azure. - :ivar admin_username: Required. The administrator username to use for Linux VMs. + :ivar admin_username: The administrator username to use for Linux VMs. Required. :vartype admin_username: str - :ivar ssh: Required. SSH configuration for Linux-based VMs running on Azure. + :ivar ssh: SSH configuration for Linux-based VMs running on Azure. Required. :vartype ssh: ~azure.mgmt.containerservice.v2020_03_01.models.ContainerServiceSshConfiguration """ _validation = { - 'admin_username': {'required': True, 'pattern': r'^[A-Za-z][-A-Za-z0-9_]*$'}, - 'ssh': {'required': True}, + "admin_username": {"required": True, "pattern": r"^[A-Za-z][-A-Za-z0-9_]*$"}, + "ssh": {"required": True}, } _attribute_map = { - 'admin_username': {'key': 'adminUsername', 'type': 'str'}, - 'ssh': {'key': 'ssh', 'type': 'ContainerServiceSshConfiguration'}, + "admin_username": {"key": "adminUsername", "type": "str"}, + "ssh": {"key": "ssh", "type": "ContainerServiceSshConfiguration"}, } - def __init__( - self, - *, - admin_username: str, - ssh: "_models.ContainerServiceSshConfiguration", - **kwargs - ): + def __init__(self, *, admin_username: str, ssh: "_models.ContainerServiceSshConfiguration", **kwargs): """ - :keyword admin_username: Required. The administrator username to use for Linux VMs. + :keyword admin_username: The administrator username to use for Linux VMs. Required. :paramtype admin_username: str - :keyword ssh: Required. SSH configuration for Linux-based VMs running on Azure. + :keyword ssh: SSH configuration for Linux-based VMs running on Azure. Required. :paramtype ssh: ~azure.mgmt.containerservice.v2020_03_01.models.ContainerServiceSshConfiguration """ - super(ContainerServiceLinuxProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.admin_username = admin_username self.ssh = ssh -class ContainerServiceMasterProfile(msrest.serialization.Model): +class ContainerServiceMasterProfile(_serialization.Model): """Profile for the container service master. Variables are only populated by the server, and will be ignored when sending a request. @@ -894,11 +881,11 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar count: Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, - and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". + and 5. The default value is 1. Known values are: 1, 3, and 5. :vartype count: int or ~azure.mgmt.containerservice.v2020_03_01.models.Count - :ivar dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. + :ivar dns_prefix: DNS prefix to be used to create the FQDN for the master pool. Required. :vartype dns_prefix: str - :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + :ivar vm_size: Size of agent VMs. Required. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -935,7 +922,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :vartype vm_size: str or ~azure.mgmt.containerservice.v2020_03_01.models.ContainerServiceVMSizeTypes :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine @@ -949,7 +936,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): :vartype first_consecutive_static_ip: str :ivar storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount" and "ManagedDisks". :vartype storage_profile: str or ~azure.mgmt.containerservice.v2020_03_01.models.ContainerServiceStorageProfileTypes :ivar fqdn: FQDN for the master pool. @@ -957,21 +944,21 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): """ _validation = { - 'dns_prefix': {'required': True}, - 'vm_size': {'required': True}, - 'os_disk_size_gb': {'maximum': 1023, 'minimum': 0}, - 'fqdn': {'readonly': True}, + "dns_prefix": {"required": True}, + "vm_size": {"required": True}, + "os_disk_size_gb": {"maximum": 1023, "minimum": 0}, + "fqdn": {"readonly": True}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'dns_prefix': {'key': 'dnsPrefix', 'type': 'str'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'first_consecutive_static_ip': {'key': 'firstConsecutiveStaticIP', 'type': 'str'}, - 'storage_profile': {'key': 'storageProfile', 'type': 'str'}, - 'fqdn': {'key': 'fqdn', 'type': 'str'}, + "count": {"key": "count", "type": "int"}, + "dns_prefix": {"key": "dnsPrefix", "type": "str"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "first_consecutive_static_ip": {"key": "firstConsecutiveStaticIP", "type": "str"}, + "storage_profile": {"key": "storageProfile", "type": "str"}, + "fqdn": {"key": "fqdn", "type": "str"}, } def __init__( @@ -979,20 +966,20 @@ def __init__( *, dns_prefix: str, vm_size: Union[str, "_models.ContainerServiceVMSizeTypes"], - count: Optional[Union[int, "_models.Count"]] = 1, + count: Union[int, "_models.Count"] = 1, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, - first_consecutive_static_ip: Optional[str] = "10.240.255.5", + first_consecutive_static_ip: str = "10.240.255.5", storage_profile: Optional[Union[str, "_models.ContainerServiceStorageProfileTypes"]] = None, **kwargs ): """ :keyword count: Number of masters (VMs) in the container service cluster. Allowed values are 1, - 3, and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". + 3, and 5. The default value is 1. Known values are: 1, 3, and 5. :paramtype count: int or ~azure.mgmt.containerservice.v2020_03_01.models.Count - :keyword dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. + :keyword dns_prefix: DNS prefix to be used to create the FQDN for the master pool. Required. :paramtype dns_prefix: str - :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + :keyword vm_size: Size of agent VMs. Required. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -1029,7 +1016,7 @@ def __init__( "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :paramtype vm_size: str or ~azure.mgmt.containerservice.v2020_03_01.models.ContainerServiceVMSizeTypes :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every @@ -1043,11 +1030,11 @@ def __init__( :paramtype first_consecutive_static_ip: str :keyword storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount" and "ManagedDisks". :paramtype storage_profile: str or ~azure.mgmt.containerservice.v2020_03_01.models.ContainerServiceStorageProfileTypes """ - super(ContainerServiceMasterProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.dns_prefix = dns_prefix self.vm_size = vm_size @@ -1058,17 +1045,17 @@ def __init__( self.fqdn = None -class ContainerServiceNetworkProfile(msrest.serialization.Model): +class ContainerServiceNetworkProfile(_serialization.Model): """Profile of network configuration. :ivar network_plugin: Network plugin used for building Kubernetes network. Known values are: - "azure", "kubenet". Default value: "kubenet". + "azure" and "kubenet". :vartype network_plugin: str or ~azure.mgmt.containerservice.v2020_03_01.models.NetworkPlugin :ivar network_policy: Network policy used for building Kubernetes network. Known values are: - "calico", "azure". + "calico" and "azure". :vartype network_policy: str or ~azure.mgmt.containerservice.v2020_03_01.models.NetworkPolicy :ivar network_mode: Network mode used for building Kubernetes network. Known values are: - "transparent", "bridge". + "transparent" and "bridge". :vartype network_mode: str or ~azure.mgmt.containerservice.v2020_03_01.models.NetworkMode :ivar pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :vartype pod_cidr: str @@ -1081,11 +1068,11 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): :ivar docker_bridge_cidr: A CIDR notation IP range assigned to the Docker bridge network. It must not overlap with any Subnet IP ranges or the Kubernetes service address range. :vartype docker_bridge_cidr: str - :ivar outbound_type: The outbound (egress) routing method. Known values are: "loadBalancer", - "userDefinedRouting". Default value: "loadBalancer". + :ivar outbound_type: The outbound (egress) routing method. Known values are: "loadBalancer" and + "userDefinedRouting". :vartype outbound_type: str or ~azure.mgmt.containerservice.v2020_03_01.models.OutboundType :ivar load_balancer_sku: The load balancer sku for the managed cluster. Known values are: - "standard", "basic". + "standard" and "basic". :vartype load_balancer_sku: str or ~azure.mgmt.containerservice.v2020_03_01.models.LoadBalancerSku :ivar load_balancer_profile: Profile of the cluster load balancer. @@ -1094,49 +1081,51 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): """ _validation = { - 'pod_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, - 'service_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, - 'dns_service_ip': {'pattern': r'^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$'}, - 'docker_bridge_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, + "pod_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, + "service_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, + "dns_service_ip": { + "pattern": r"^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$" + }, + "docker_bridge_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, } _attribute_map = { - 'network_plugin': {'key': 'networkPlugin', 'type': 'str'}, - 'network_policy': {'key': 'networkPolicy', 'type': 'str'}, - 'network_mode': {'key': 'networkMode', 'type': 'str'}, - 'pod_cidr': {'key': 'podCidr', 'type': 'str'}, - 'service_cidr': {'key': 'serviceCidr', 'type': 'str'}, - 'dns_service_ip': {'key': 'dnsServiceIP', 'type': 'str'}, - 'docker_bridge_cidr': {'key': 'dockerBridgeCidr', 'type': 'str'}, - 'outbound_type': {'key': 'outboundType', 'type': 'str'}, - 'load_balancer_sku': {'key': 'loadBalancerSku', 'type': 'str'}, - 'load_balancer_profile': {'key': 'loadBalancerProfile', 'type': 'ManagedClusterLoadBalancerProfile'}, + "network_plugin": {"key": "networkPlugin", "type": "str"}, + "network_policy": {"key": "networkPolicy", "type": "str"}, + "network_mode": {"key": "networkMode", "type": "str"}, + "pod_cidr": {"key": "podCidr", "type": "str"}, + "service_cidr": {"key": "serviceCidr", "type": "str"}, + "dns_service_ip": {"key": "dnsServiceIP", "type": "str"}, + "docker_bridge_cidr": {"key": "dockerBridgeCidr", "type": "str"}, + "outbound_type": {"key": "outboundType", "type": "str"}, + "load_balancer_sku": {"key": "loadBalancerSku", "type": "str"}, + "load_balancer_profile": {"key": "loadBalancerProfile", "type": "ManagedClusterLoadBalancerProfile"}, } def __init__( self, *, - network_plugin: Optional[Union[str, "_models.NetworkPlugin"]] = "kubenet", + network_plugin: Union[str, "_models.NetworkPlugin"] = "kubenet", network_policy: Optional[Union[str, "_models.NetworkPolicy"]] = None, network_mode: Optional[Union[str, "_models.NetworkMode"]] = None, - pod_cidr: Optional[str] = "10.244.0.0/16", - service_cidr: Optional[str] = "10.0.0.0/16", - dns_service_ip: Optional[str] = "10.0.0.10", - docker_bridge_cidr: Optional[str] = "172.17.0.1/16", - outbound_type: Optional[Union[str, "_models.OutboundType"]] = "loadBalancer", + pod_cidr: str = "10.244.0.0/16", + service_cidr: str = "10.0.0.0/16", + dns_service_ip: str = "10.0.0.10", + docker_bridge_cidr: str = "172.17.0.1/16", + outbound_type: Union[str, "_models.OutboundType"] = "loadBalancer", load_balancer_sku: Optional[Union[str, "_models.LoadBalancerSku"]] = None, load_balancer_profile: Optional["_models.ManagedClusterLoadBalancerProfile"] = None, **kwargs ): """ :keyword network_plugin: Network plugin used for building Kubernetes network. Known values are: - "azure", "kubenet". Default value: "kubenet". + "azure" and "kubenet". :paramtype network_plugin: str or ~azure.mgmt.containerservice.v2020_03_01.models.NetworkPlugin :keyword network_policy: Network policy used for building Kubernetes network. Known values are: - "calico", "azure". + "calico" and "azure". :paramtype network_policy: str or ~azure.mgmt.containerservice.v2020_03_01.models.NetworkPolicy :keyword network_mode: Network mode used for building Kubernetes network. Known values are: - "transparent", "bridge". + "transparent" and "bridge". :paramtype network_mode: str or ~azure.mgmt.containerservice.v2020_03_01.models.NetworkMode :keyword pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :paramtype pod_cidr: str @@ -1149,18 +1138,18 @@ def __init__( :keyword docker_bridge_cidr: A CIDR notation IP range assigned to the Docker bridge network. It must not overlap with any Subnet IP ranges or the Kubernetes service address range. :paramtype docker_bridge_cidr: str - :keyword outbound_type: The outbound (egress) routing method. Known values are: "loadBalancer", - "userDefinedRouting". Default value: "loadBalancer". + :keyword outbound_type: The outbound (egress) routing method. Known values are: "loadBalancer" + and "userDefinedRouting". :paramtype outbound_type: str or ~azure.mgmt.containerservice.v2020_03_01.models.OutboundType :keyword load_balancer_sku: The load balancer sku for the managed cluster. Known values are: - "standard", "basic". + "standard" and "basic". :paramtype load_balancer_sku: str or ~azure.mgmt.containerservice.v2020_03_01.models.LoadBalancerSku :keyword load_balancer_profile: Profile of the cluster load balancer. :paramtype load_balancer_profile: ~azure.mgmt.containerservice.v2020_03_01.models.ManagedClusterLoadBalancerProfile """ - super(ContainerServiceNetworkProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.network_plugin = network_plugin self.network_policy = network_policy self.network_mode = network_mode @@ -1173,113 +1162,98 @@ def __init__( self.load_balancer_profile = load_balancer_profile -class ContainerServiceSshConfiguration(msrest.serialization.Model): +class ContainerServiceSshConfiguration(_serialization.Model): """SSH configuration for Linux-based VMs running on Azure. All required parameters must be populated in order to send to Azure. - :ivar public_keys: Required. The list of SSH public keys used to authenticate with Linux-based - VMs. Only expect one key specified. + :ivar public_keys: The list of SSH public keys used to authenticate with Linux-based VMs. Only + expect one key specified. Required. :vartype public_keys: list[~azure.mgmt.containerservice.v2020_03_01.models.ContainerServiceSshPublicKey] """ _validation = { - 'public_keys': {'required': True}, + "public_keys": {"required": True}, } _attribute_map = { - 'public_keys': {'key': 'publicKeys', 'type': '[ContainerServiceSshPublicKey]'}, + "public_keys": {"key": "publicKeys", "type": "[ContainerServiceSshPublicKey]"}, } - def __init__( - self, - *, - public_keys: List["_models.ContainerServiceSshPublicKey"], - **kwargs - ): + def __init__(self, *, public_keys: List["_models.ContainerServiceSshPublicKey"], **kwargs): """ - :keyword public_keys: Required. The list of SSH public keys used to authenticate with - Linux-based VMs. Only expect one key specified. + :keyword public_keys: The list of SSH public keys used to authenticate with Linux-based VMs. + Only expect one key specified. Required. :paramtype public_keys: list[~azure.mgmt.containerservice.v2020_03_01.models.ContainerServiceSshPublicKey] """ - super(ContainerServiceSshConfiguration, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_keys = public_keys -class ContainerServiceSshPublicKey(msrest.serialization.Model): +class ContainerServiceSshPublicKey(_serialization.Model): """Contains information about SSH certificate public key data. All required parameters must be populated in order to send to Azure. - :ivar key_data: Required. Certificate public key used to authenticate with VMs through SSH. The - certificate must be in PEM format with or without headers. + :ivar key_data: Certificate public key used to authenticate with VMs through SSH. The + certificate must be in PEM format with or without headers. Required. :vartype key_data: str """ _validation = { - 'key_data': {'required': True}, + "key_data": {"required": True}, } _attribute_map = { - 'key_data': {'key': 'keyData', 'type': 'str'}, + "key_data": {"key": "keyData", "type": "str"}, } - def __init__( - self, - *, - key_data: str, - **kwargs - ): + def __init__(self, *, key_data: str, **kwargs): """ - :keyword key_data: Required. Certificate public key used to authenticate with VMs through SSH. - The certificate must be in PEM format with or without headers. + :keyword key_data: Certificate public key used to authenticate with VMs through SSH. The + certificate must be in PEM format with or without headers. Required. :paramtype key_data: str """ - super(ContainerServiceSshPublicKey, self).__init__(**kwargs) + super().__init__(**kwargs) self.key_data = key_data -class ContainerServiceVMDiagnostics(msrest.serialization.Model): +class ContainerServiceVMDiagnostics(_serialization.Model): """Profile for diagnostics on the container service VMs. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar enabled: Required. Whether the VM diagnostic agent is provisioned on the VM. + :ivar enabled: Whether the VM diagnostic agent is provisioned on the VM. Required. :vartype enabled: bool :ivar storage_uri: The URI of the storage account where diagnostics are stored. :vartype storage_uri: str """ _validation = { - 'enabled': {'required': True}, - 'storage_uri': {'readonly': True}, + "enabled": {"required": True}, + "storage_uri": {"readonly": True}, } _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'storage_uri': {'key': 'storageUri', 'type': 'str'}, + "enabled": {"key": "enabled", "type": "bool"}, + "storage_uri": {"key": "storageUri", "type": "str"}, } - def __init__( - self, - *, - enabled: bool, - **kwargs - ): + def __init__(self, *, enabled: bool, **kwargs): """ - :keyword enabled: Required. Whether the VM diagnostic agent is provisioned on the VM. + :keyword enabled: Whether the VM diagnostic agent is provisioned on the VM. Required. :paramtype enabled: bool """ - super(ContainerServiceVMDiagnostics, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.storage_uri = None -class CredentialResult(msrest.serialization.Model): +class CredentialResult(_serialization.Model): """The credential result response. Variables are only populated by the server, and will be ignored when sending a request. @@ -1287,31 +1261,27 @@ class CredentialResult(msrest.serialization.Model): :ivar name: The name of the credential. :vartype name: str :ivar value: Base64-encoded Kubernetes configuration file. - :vartype value: bytearray + :vartype value: bytes """ _validation = { - 'name': {'readonly': True}, - 'value': {'readonly': True}, + "name": {"readonly": True}, + "value": {"readonly": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'bytearray'}, + "name": {"key": "name", "type": "str"}, + "value": {"key": "value", "type": "bytearray"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(CredentialResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.name = None self.value = None -class CredentialResults(msrest.serialization.Model): +class CredentialResults(_serialization.Model): """The list of credential result response. Variables are only populated by the server, and will be ignored when sending a request. @@ -1321,24 +1291,20 @@ class CredentialResults(msrest.serialization.Model): """ _validation = { - 'kubeconfigs': {'readonly': True}, + "kubeconfigs": {"readonly": True}, } _attribute_map = { - 'kubeconfigs': {'key': 'kubeconfigs', 'type': '[CredentialResult]'}, + "kubeconfigs": {"key": "kubeconfigs", "type": "[CredentialResult]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(CredentialResults, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.kubeconfigs = None -class Resource(msrest.serialization.Model): +class Resource(_serialization.Model): """The Resource model definition. Variables are only populated by the server, and will be ignored when sending a request. @@ -1351,41 +1317,35 @@ class Resource(msrest.serialization.Model): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] """ - super(Resource, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -1393,7 +1353,7 @@ def __init__( self.tags = tags -class ManagedCluster(Resource, BaseManagedCluster): +class ManagedCluster(Resource, BaseManagedCluster): # pylint: disable=too-many-instance-attributes """Managed cluster. Variables are only populated by the server, and will be ignored when sending a request. @@ -1462,56 +1422,68 @@ class ManagedCluster(Resource, BaseManagedCluster): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar sku: The managed cluster SKU. :vartype sku: ~azure.mgmt.containerservice.v2020_03_01.models.ManagedClusterSKU """ _validation = { - 'provisioning_state': {'readonly': True}, - 'max_agent_pools': {'readonly': True}, - 'fqdn': {'readonly': True}, - 'private_fqdn': {'readonly': True}, - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, + "provisioning_state": {"readonly": True}, + "max_agent_pools": {"readonly": True}, + "fqdn": {"readonly": True}, + "private_fqdn": {"readonly": True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { - 'identity': {'key': 'identity', 'type': 'ManagedClusterIdentity'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'max_agent_pools': {'key': 'properties.maxAgentPools', 'type': 'int'}, - 'kubernetes_version': {'key': 'properties.kubernetesVersion', 'type': 'str'}, - 'dns_prefix': {'key': 'properties.dnsPrefix', 'type': 'str'}, - 'fqdn': {'key': 'properties.fqdn', 'type': 'str'}, - 'private_fqdn': {'key': 'properties.privateFQDN', 'type': 'str'}, - 'agent_pool_profiles': {'key': 'properties.agentPoolProfiles', 'type': '[ManagedClusterAgentPoolProfile]'}, - 'linux_profile': {'key': 'properties.linuxProfile', 'type': 'ContainerServiceLinuxProfile'}, - 'windows_profile': {'key': 'properties.windowsProfile', 'type': 'ManagedClusterWindowsProfile'}, - 'service_principal_profile': {'key': 'properties.servicePrincipalProfile', 'type': 'ManagedClusterServicePrincipalProfile'}, - 'addon_profiles': {'key': 'properties.addonProfiles', 'type': '{ManagedClusterAddonProfile}'}, - 'node_resource_group': {'key': 'properties.nodeResourceGroup', 'type': 'str'}, - 'enable_rbac': {'key': 'properties.enableRBAC', 'type': 'bool'}, - 'enable_pod_security_policy': {'key': 'properties.enablePodSecurityPolicy', 'type': 'bool'}, - 'network_profile': {'key': 'properties.networkProfile', 'type': 'ContainerServiceNetworkProfile'}, - 'aad_profile': {'key': 'properties.aadProfile', 'type': 'ManagedClusterAADProfile'}, - 'auto_scaler_profile': {'key': 'properties.autoScalerProfile', 'type': 'ManagedClusterPropertiesAutoScalerProfile'}, - 'api_server_access_profile': {'key': 'properties.apiServerAccessProfile', 'type': 'ManagedClusterAPIServerAccessProfile'}, - 'disk_encryption_set_id': {'key': 'properties.diskEncryptionSetID', 'type': 'str'}, - 'identity_profile': {'key': 'properties.identityProfile', 'type': '{ManagedClusterPropertiesIdentityProfileValue}'}, - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'ManagedClusterSKU'}, - } - - def __init__( + "identity": {"key": "identity", "type": "ManagedClusterIdentity"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "max_agent_pools": {"key": "properties.maxAgentPools", "type": "int"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "dns_prefix": {"key": "properties.dnsPrefix", "type": "str"}, + "fqdn": {"key": "properties.fqdn", "type": "str"}, + "private_fqdn": {"key": "properties.privateFQDN", "type": "str"}, + "agent_pool_profiles": {"key": "properties.agentPoolProfiles", "type": "[ManagedClusterAgentPoolProfile]"}, + "linux_profile": {"key": "properties.linuxProfile", "type": "ContainerServiceLinuxProfile"}, + "windows_profile": {"key": "properties.windowsProfile", "type": "ManagedClusterWindowsProfile"}, + "service_principal_profile": { + "key": "properties.servicePrincipalProfile", + "type": "ManagedClusterServicePrincipalProfile", + }, + "addon_profiles": {"key": "properties.addonProfiles", "type": "{ManagedClusterAddonProfile}"}, + "node_resource_group": {"key": "properties.nodeResourceGroup", "type": "str"}, + "enable_rbac": {"key": "properties.enableRBAC", "type": "bool"}, + "enable_pod_security_policy": {"key": "properties.enablePodSecurityPolicy", "type": "bool"}, + "network_profile": {"key": "properties.networkProfile", "type": "ContainerServiceNetworkProfile"}, + "aad_profile": {"key": "properties.aadProfile", "type": "ManagedClusterAADProfile"}, + "auto_scaler_profile": { + "key": "properties.autoScalerProfile", + "type": "ManagedClusterPropertiesAutoScalerProfile", + }, + "api_server_access_profile": { + "key": "properties.apiServerAccessProfile", + "type": "ManagedClusterAPIServerAccessProfile", + }, + "disk_encryption_set_id": {"key": "properties.diskEncryptionSetID", "type": "str"}, + "identity_profile": { + "key": "properties.identityProfile", + "type": "{ManagedClusterPropertiesIdentityProfileValue}", + }, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "sku": {"key": "sku", "type": "ManagedClusterSKU"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, location: str, @@ -1585,14 +1557,35 @@ def __init__( :keyword identity_profile: Identities associated with the cluster. :paramtype identity_profile: dict[str, ~azure.mgmt.containerservice.v2020_03_01.models.ManagedClusterPropertiesIdentityProfileValue] - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword sku: The managed cluster SKU. :paramtype sku: ~azure.mgmt.containerservice.v2020_03_01.models.ManagedClusterSKU """ - super(ManagedCluster, self).__init__(location=location, tags=tags, identity=identity, kubernetes_version=kubernetes_version, dns_prefix=dns_prefix, agent_pool_profiles=agent_pool_profiles, linux_profile=linux_profile, windows_profile=windows_profile, service_principal_profile=service_principal_profile, addon_profiles=addon_profiles, node_resource_group=node_resource_group, enable_rbac=enable_rbac, enable_pod_security_policy=enable_pod_security_policy, network_profile=network_profile, aad_profile=aad_profile, auto_scaler_profile=auto_scaler_profile, api_server_access_profile=api_server_access_profile, disk_encryption_set_id=disk_encryption_set_id, identity_profile=identity_profile, **kwargs) + super().__init__( + location=location, + tags=tags, + identity=identity, + kubernetes_version=kubernetes_version, + dns_prefix=dns_prefix, + agent_pool_profiles=agent_pool_profiles, + linux_profile=linux_profile, + windows_profile=windows_profile, + service_principal_profile=service_principal_profile, + addon_profiles=addon_profiles, + node_resource_group=node_resource_group, + enable_rbac=enable_rbac, + enable_pod_security_policy=enable_pod_security_policy, + network_profile=network_profile, + aad_profile=aad_profile, + auto_scaler_profile=auto_scaler_profile, + api_server_access_profile=api_server_access_profile, + disk_encryption_set_id=disk_encryption_set_id, + identity_profile=identity_profile, + **kwargs + ) self.identity = identity self.provisioning_state = None self.max_agent_pools = None @@ -1622,7 +1615,7 @@ def __init__( self.tags = tags -class ManagedClusterAADProfile(msrest.serialization.Model): +class ManagedClusterAADProfile(_serialization.Model): """AADProfile specifies attributes for Azure Active Directory integration. :ivar managed: Whether to enable managed AAD. @@ -1641,12 +1634,12 @@ class ManagedClusterAADProfile(msrest.serialization.Model): """ _attribute_map = { - 'managed': {'key': 'managed', 'type': 'bool'}, - 'admin_group_object_i_ds': {'key': 'adminGroupObjectIDs', 'type': '[str]'}, - 'client_app_id': {'key': 'clientAppID', 'type': 'str'}, - 'server_app_id': {'key': 'serverAppID', 'type': 'str'}, - 'server_app_secret': {'key': 'serverAppSecret', 'type': 'str'}, - 'tenant_id': {'key': 'tenantID', 'type': 'str'}, + "managed": {"key": "managed", "type": "bool"}, + "admin_group_object_i_ds": {"key": "adminGroupObjectIDs", "type": "[str]"}, + "client_app_id": {"key": "clientAppID", "type": "str"}, + "server_app_id": {"key": "serverAppID", "type": "str"}, + "server_app_secret": {"key": "serverAppSecret", "type": "str"}, + "tenant_id": {"key": "tenantID", "type": "str"}, } def __init__( @@ -1676,7 +1669,7 @@ def __init__( tenant of the deployment subscription. :paramtype tenant_id: str """ - super(ManagedClusterAADProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.managed = managed self.admin_group_object_i_ds = admin_group_object_i_ds self.client_app_id = client_app_id @@ -1698,58 +1691,53 @@ class ManagedClusterAccessProfile(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar kube_config: Base64-encoded Kubernetes configuration file. - :vartype kube_config: bytearray + :vartype kube_config: bytes """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'kube_config': {'key': 'properties.kubeConfig', 'type': 'bytearray'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "kube_config": {"key": "properties.kubeConfig", "type": "bytearray"}, } def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - kube_config: Optional[bytearray] = None, - **kwargs + self, *, location: str, tags: Optional[Dict[str, str]] = None, kube_config: Optional[bytes] = None, **kwargs ): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword kube_config: Base64-encoded Kubernetes configuration file. - :paramtype kube_config: bytearray + :paramtype kube_config: bytes """ - super(ManagedClusterAccessProfile, self).__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.kube_config = kube_config -class ManagedClusterAddonProfile(msrest.serialization.Model): +class ManagedClusterAddonProfile(_serialization.Model): """A Kubernetes add-on profile for a managed cluster. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar enabled: Required. Whether the add-on is enabled or not. + :ivar enabled: Whether the add-on is enabled or not. Required. :vartype enabled: bool :ivar config: Key-value pairs for configuring an add-on. :vartype config: dict[str, str] @@ -1759,36 +1747,30 @@ class ManagedClusterAddonProfile(msrest.serialization.Model): """ _validation = { - 'enabled': {'required': True}, - 'identity': {'readonly': True}, + "enabled": {"required": True}, + "identity": {"readonly": True}, } _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'config': {'key': 'config', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'ManagedClusterAddonProfileIdentity'}, + "enabled": {"key": "enabled", "type": "bool"}, + "config": {"key": "config", "type": "{str}"}, + "identity": {"key": "identity", "type": "ManagedClusterAddonProfileIdentity"}, } - def __init__( - self, - *, - enabled: bool, - config: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, enabled: bool, config: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword enabled: Required. Whether the add-on is enabled or not. + :keyword enabled: Whether the add-on is enabled or not. Required. :paramtype enabled: bool :keyword config: Key-value pairs for configuring an add-on. :paramtype config: dict[str, str] """ - super(ManagedClusterAddonProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.config = config self.identity = None -class UserAssignedIdentity(msrest.serialization.Model): +class UserAssignedIdentity(_serialization.Model): """UserAssignedIdentity. :ivar resource_id: The resource id of the user assigned identity. @@ -1800,9 +1782,9 @@ class UserAssignedIdentity(msrest.serialization.Model): """ _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'object_id': {'key': 'objectId', 'type': 'str'}, + "resource_id": {"key": "resourceId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + "object_id": {"key": "objectId", "type": "str"}, } def __init__( @@ -1821,7 +1803,7 @@ def __init__( :keyword object_id: The object id of the user assigned identity. :paramtype object_id: str """ - super(UserAssignedIdentity, self).__init__(**kwargs) + super().__init__(**kwargs) self.resource_id = resource_id self.client_id = client_id self.object_id = object_id @@ -1839,9 +1821,9 @@ class ManagedClusterAddonProfileIdentity(UserAssignedIdentity): """ _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'object_id': {'key': 'objectId', 'type': 'str'}, + "resource_id": {"key": "resourceId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + "object_id": {"key": "objectId", "type": "str"}, } def __init__( @@ -1860,10 +1842,10 @@ def __init__( :keyword object_id: The object id of the user assigned identity. :paramtype object_id: str """ - super(ManagedClusterAddonProfileIdentity, self).__init__(resource_id=resource_id, client_id=client_id, object_id=object_id, **kwargs) + super().__init__(resource_id=resource_id, client_id=client_id, object_id=object_id, **kwargs) -class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): +class ManagedClusterAgentPoolProfileProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes """Properties for the container service agent pool profile. Variables are only populated by the server, and will be ignored when sending a request. @@ -1909,7 +1891,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :vartype vm_size: str or ~azure.mgmt.containerservice.v2020_03_01.models.ContainerServiceVMSizeTypes :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine @@ -1921,7 +1903,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Known values are: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux" and "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2020_03_01.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -1930,9 +1912,10 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar type: AgentPoolType represents types of an agent pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2020_03_01.models.AgentPoolType - :ivar mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", "User". + :ivar mode: AgentPoolMode represents mode of an agent pool. Known values are: "System" and + "User". :vartype mode: str or ~azure.mgmt.containerservice.v2020_03_01.models.AgentPoolMode :ivar orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -1946,21 +1929,19 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar enable_node_public_ip: Enable public IP for nodes. :vartype enable_node_public_ip: bool :ivar scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Known values are: "Spot", "Low", "Regular". Default value: - "Regular". + priority. Default to regular. Known values are: "Spot", "Low", and "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_03_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy for Spot or low priority virtual machine scale set. Default to Delete. Known values are: - "Delete", "Deallocate". Default value: "Delete". + "Delete" and "Deallocate". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_03_01.models.ScaleSetEvictionPolicy :ivar spot_max_price: SpotMaxPrice to be used to specify the maximum price you are willing to pay in US Dollars. Possible values are any decimal value greater than zero or -1 which indicates default price to be up-to on-demand. :vartype spot_max_price: float - :ivar tags: A set of tags. Agent pool tags to be persisted on the agent pool virtual machine - scale set. + :ivar tags: Agent pool tags to be persisted on the agent pool virtual machine scale set. :vartype tags: dict[str, str] :ivar node_labels: Agent pool node labels to be persisted across all nodes in agent pool. :vartype node_labels: dict[str, str] @@ -1970,32 +1951,32 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): """ _validation = { - 'os_disk_size_gb': {'maximum': 1023, 'minimum': 0}, - 'provisioning_state': {'readonly': True}, + "os_disk_size_gb": {"maximum": 1023, "minimum": 0}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'maxPods', 'type': 'int'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'max_count': {'key': 'maxCount', 'type': 'int'}, - 'min_count': {'key': 'minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'enableAutoScaling', 'type': 'bool'}, - 'type': {'key': 'type', 'type': 'str'}, - 'mode': {'key': 'mode', 'type': 'str'}, - 'orchestrator_version': {'key': 'orchestratorVersion', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'availability_zones': {'key': 'availabilityZones', 'type': '[str]'}, - 'enable_node_public_ip': {'key': 'enableNodePublicIP', 'type': 'bool'}, - 'scale_set_priority': {'key': 'scaleSetPriority', 'type': 'str'}, - 'scale_set_eviction_policy': {'key': 'scaleSetEvictionPolicy', 'type': 'str'}, - 'spot_max_price': {'key': 'spotMaxPrice', 'type': 'float'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'node_labels': {'key': 'nodeLabels', 'type': '{str}'}, - 'node_taints': {'key': 'nodeTaints', 'type': '[str]'}, + "count": {"key": "count", "type": "int"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "max_pods": {"key": "maxPods", "type": "int"}, + "os_type": {"key": "osType", "type": "str"}, + "max_count": {"key": "maxCount", "type": "int"}, + "min_count": {"key": "minCount", "type": "int"}, + "enable_auto_scaling": {"key": "enableAutoScaling", "type": "bool"}, + "type": {"key": "type", "type": "str"}, + "mode": {"key": "mode", "type": "str"}, + "orchestrator_version": {"key": "orchestratorVersion", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "availability_zones": {"key": "availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "enableNodePublicIP", "type": "bool"}, + "scale_set_priority": {"key": "scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "scaleSetEvictionPolicy", "type": "str"}, + "spot_max_price": {"key": "spotMaxPrice", "type": "float"}, + "tags": {"key": "tags", "type": "{str}"}, + "node_labels": {"key": "nodeLabels", "type": "{str}"}, + "node_taints": {"key": "nodeTaints", "type": "[str]"}, } def __init__( @@ -2006,7 +1987,7 @@ def __init__( os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, @@ -2015,9 +1996,9 @@ def __init__( orchestrator_version: Optional[str] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, - scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", - spot_max_price: Optional[float] = -1, + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", + spot_max_price: float = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, @@ -2065,7 +2046,7 @@ def __init__( "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :paramtype vm_size: str or ~azure.mgmt.containerservice.v2020_03_01.models.ContainerServiceVMSizeTypes :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every @@ -2077,7 +2058,7 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux" and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2020_03_01.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -2086,9 +2067,9 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword type: AgentPoolType represents types of an agent pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2020_03_01.models.AgentPoolType - :keyword mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", + :keyword mode: AgentPoolMode represents mode of an agent pool. Known values are: "System" and "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2020_03_01.models.AgentPoolMode :keyword orchestrator_version: Version of orchestrator specified when creating the managed @@ -2100,21 +2081,19 @@ def __init__( :keyword enable_node_public_ip: Enable public IP for nodes. :paramtype enable_node_public_ip: bool :keyword scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Known values are: "Spot", "Low", "Regular". Default value: - "Regular". + priority. Default to regular. Known values are: "Spot", "Low", and "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_03_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy for Spot or low priority virtual machine scale set. Default to Delete. Known values are: - "Delete", "Deallocate". Default value: "Delete". + "Delete" and "Deallocate". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_03_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: SpotMaxPrice to be used to specify the maximum price you are willing to pay in US Dollars. Possible values are any decimal value greater than zero or -1 which indicates default price to be up-to on-demand. :paramtype spot_max_price: float - :keyword tags: A set of tags. Agent pool tags to be persisted on the agent pool virtual machine - scale set. + :keyword tags: Agent pool tags to be persisted on the agent pool virtual machine scale set. :paramtype tags: dict[str, str] :keyword node_labels: Agent pool node labels to be persisted across all nodes in agent pool. :paramtype node_labels: dict[str, str] @@ -2122,7 +2101,7 @@ def __init__( key=value:NoSchedule. :paramtype node_taints: list[str] """ - super(ManagedClusterAgentPoolProfileProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.vm_size = vm_size self.os_disk_size_gb = os_disk_size_gb @@ -2146,7 +2125,9 @@ def __init__( self.node_taints = node_taints -class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): +class ManagedClusterAgentPoolProfile( + ManagedClusterAgentPoolProfileProperties +): # pylint: disable=too-many-instance-attributes """Profile for the container service agent pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -2194,7 +2175,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :vartype vm_size: str or ~azure.mgmt.containerservice.v2020_03_01.models.ContainerServiceVMSizeTypes :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine @@ -2206,7 +2187,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Known values are: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux" and "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2020_03_01.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -2215,9 +2196,10 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar type: AgentPoolType represents types of an agent pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2020_03_01.models.AgentPoolType - :ivar mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", "User". + :ivar mode: AgentPoolMode represents mode of an agent pool. Known values are: "System" and + "User". :vartype mode: str or ~azure.mgmt.containerservice.v2020_03_01.models.AgentPoolMode :ivar orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -2231,61 +2213,59 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar enable_node_public_ip: Enable public IP for nodes. :vartype enable_node_public_ip: bool :ivar scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Known values are: "Spot", "Low", "Regular". Default value: - "Regular". + priority. Default to regular. Known values are: "Spot", "Low", and "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_03_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy for Spot or low priority virtual machine scale set. Default to Delete. Known values are: - "Delete", "Deallocate". Default value: "Delete". + "Delete" and "Deallocate". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_03_01.models.ScaleSetEvictionPolicy :ivar spot_max_price: SpotMaxPrice to be used to specify the maximum price you are willing to pay in US Dollars. Possible values are any decimal value greater than zero or -1 which indicates default price to be up-to on-demand. :vartype spot_max_price: float - :ivar tags: A set of tags. Agent pool tags to be persisted on the agent pool virtual machine - scale set. + :ivar tags: Agent pool tags to be persisted on the agent pool virtual machine scale set. :vartype tags: dict[str, str] :ivar node_labels: Agent pool node labels to be persisted across all nodes in agent pool. :vartype node_labels: dict[str, str] :ivar node_taints: Taints added to new nodes during node pool create and scale. For example, key=value:NoSchedule. :vartype node_taints: list[str] - :ivar name: Required. Unique name of the agent pool profile in the context of the subscription - and resource group. + :ivar name: Unique name of the agent pool profile in the context of the subscription and + resource group. Required. :vartype name: str """ _validation = { - 'os_disk_size_gb': {'maximum': 1023, 'minimum': 0}, - 'provisioning_state': {'readonly': True}, - 'name': {'required': True, 'pattern': r'^[a-z][a-z0-9]{0,11}$'}, + "os_disk_size_gb": {"maximum": 1023, "minimum": 0}, + "provisioning_state": {"readonly": True}, + "name": {"required": True, "pattern": r"^[a-z][a-z0-9]{0,11}$"}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'maxPods', 'type': 'int'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'max_count': {'key': 'maxCount', 'type': 'int'}, - 'min_count': {'key': 'minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'enableAutoScaling', 'type': 'bool'}, - 'type': {'key': 'type', 'type': 'str'}, - 'mode': {'key': 'mode', 'type': 'str'}, - 'orchestrator_version': {'key': 'orchestratorVersion', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'availability_zones': {'key': 'availabilityZones', 'type': '[str]'}, - 'enable_node_public_ip': {'key': 'enableNodePublicIP', 'type': 'bool'}, - 'scale_set_priority': {'key': 'scaleSetPriority', 'type': 'str'}, - 'scale_set_eviction_policy': {'key': 'scaleSetEvictionPolicy', 'type': 'str'}, - 'spot_max_price': {'key': 'spotMaxPrice', 'type': 'float'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'node_labels': {'key': 'nodeLabels', 'type': '{str}'}, - 'node_taints': {'key': 'nodeTaints', 'type': '[str]'}, - 'name': {'key': 'name', 'type': 'str'}, + "count": {"key": "count", "type": "int"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "max_pods": {"key": "maxPods", "type": "int"}, + "os_type": {"key": "osType", "type": "str"}, + "max_count": {"key": "maxCount", "type": "int"}, + "min_count": {"key": "minCount", "type": "int"}, + "enable_auto_scaling": {"key": "enableAutoScaling", "type": "bool"}, + "type": {"key": "type", "type": "str"}, + "mode": {"key": "mode", "type": "str"}, + "orchestrator_version": {"key": "orchestratorVersion", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "availability_zones": {"key": "availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "enableNodePublicIP", "type": "bool"}, + "scale_set_priority": {"key": "scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "scaleSetEvictionPolicy", "type": "str"}, + "spot_max_price": {"key": "spotMaxPrice", "type": "float"}, + "tags": {"key": "tags", "type": "{str}"}, + "node_labels": {"key": "nodeLabels", "type": "{str}"}, + "node_taints": {"key": "nodeTaints", "type": "[str]"}, + "name": {"key": "name", "type": "str"}, } def __init__( @@ -2297,7 +2277,7 @@ def __init__( os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, @@ -2306,9 +2286,9 @@ def __init__( orchestrator_version: Optional[str] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, - scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", - spot_max_price: Optional[float] = -1, + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", + spot_max_price: float = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, @@ -2356,7 +2336,7 @@ def __init__( "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :paramtype vm_size: str or ~azure.mgmt.containerservice.v2020_03_01.models.ContainerServiceVMSizeTypes :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every @@ -2368,7 +2348,7 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux" and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2020_03_01.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -2377,9 +2357,9 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword type: AgentPoolType represents types of an agent pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2020_03_01.models.AgentPoolType - :keyword mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", + :keyword mode: AgentPoolMode represents mode of an agent pool. Known values are: "System" and "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2020_03_01.models.AgentPoolMode :keyword orchestrator_version: Version of orchestrator specified when creating the managed @@ -2391,36 +2371,56 @@ def __init__( :keyword enable_node_public_ip: Enable public IP for nodes. :paramtype enable_node_public_ip: bool :keyword scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Known values are: "Spot", "Low", "Regular". Default value: - "Regular". + priority. Default to regular. Known values are: "Spot", "Low", and "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_03_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy for Spot or low priority virtual machine scale set. Default to Delete. Known values are: - "Delete", "Deallocate". Default value: "Delete". + "Delete" and "Deallocate". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_03_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: SpotMaxPrice to be used to specify the maximum price you are willing to pay in US Dollars. Possible values are any decimal value greater than zero or -1 which indicates default price to be up-to on-demand. :paramtype spot_max_price: float - :keyword tags: A set of tags. Agent pool tags to be persisted on the agent pool virtual machine - scale set. + :keyword tags: Agent pool tags to be persisted on the agent pool virtual machine scale set. :paramtype tags: dict[str, str] :keyword node_labels: Agent pool node labels to be persisted across all nodes in agent pool. :paramtype node_labels: dict[str, str] :keyword node_taints: Taints added to new nodes during node pool create and scale. For example, key=value:NoSchedule. :paramtype node_taints: list[str] - :keyword name: Required. Unique name of the agent pool profile in the context of the - subscription and resource group. + :keyword name: Unique name of the agent pool profile in the context of the subscription and + resource group. Required. :paramtype name: str """ - super(ManagedClusterAgentPoolProfile, self).__init__(count=count, vm_size=vm_size, os_disk_size_gb=os_disk_size_gb, vnet_subnet_id=vnet_subnet_id, max_pods=max_pods, os_type=os_type, max_count=max_count, min_count=min_count, enable_auto_scaling=enable_auto_scaling, type=type, mode=mode, orchestrator_version=orchestrator_version, availability_zones=availability_zones, enable_node_public_ip=enable_node_public_ip, scale_set_priority=scale_set_priority, scale_set_eviction_policy=scale_set_eviction_policy, spot_max_price=spot_max_price, tags=tags, node_labels=node_labels, node_taints=node_taints, **kwargs) + super().__init__( + count=count, + vm_size=vm_size, + os_disk_size_gb=os_disk_size_gb, + vnet_subnet_id=vnet_subnet_id, + max_pods=max_pods, + os_type=os_type, + max_count=max_count, + min_count=min_count, + enable_auto_scaling=enable_auto_scaling, + type=type, + mode=mode, + orchestrator_version=orchestrator_version, + availability_zones=availability_zones, + enable_node_public_ip=enable_node_public_ip, + scale_set_priority=scale_set_priority, + scale_set_eviction_policy=scale_set_eviction_policy, + spot_max_price=spot_max_price, + tags=tags, + node_labels=node_labels, + node_taints=node_taints, + **kwargs + ) self.name = name -class ManagedClusterAPIServerAccessProfile(msrest.serialization.Model): +class ManagedClusterAPIServerAccessProfile(_serialization.Model): """Access profile for managed cluster API server. :ivar authorized_ip_ranges: Authorized IP Ranges to kubernetes API server. @@ -2430,8 +2430,8 @@ class ManagedClusterAPIServerAccessProfile(msrest.serialization.Model): """ _attribute_map = { - 'authorized_ip_ranges': {'key': 'authorizedIPRanges', 'type': '[str]'}, - 'enable_private_cluster': {'key': 'enablePrivateCluster', 'type': 'bool'}, + "authorized_ip_ranges": {"key": "authorizedIPRanges", "type": "[str]"}, + "enable_private_cluster": {"key": "enablePrivateCluster", "type": "bool"}, } def __init__( @@ -2447,12 +2447,12 @@ def __init__( :keyword enable_private_cluster: Whether to create the cluster as a private cluster or not. :paramtype enable_private_cluster: bool """ - super(ManagedClusterAPIServerAccessProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.authorized_ip_ranges = authorized_ip_ranges self.enable_private_cluster = enable_private_cluster -class ManagedClusterIdentity(msrest.serialization.Model): +class ManagedClusterIdentity(_serialization.Model): """Identity for the managed cluster. Variables are only populated by the server, and will be ignored when sending a request. @@ -2466,41 +2466,36 @@ class ManagedClusterIdentity(msrest.serialization.Model): :ivar type: The type of identity used for the managed cluster. Type 'SystemAssigned' will use an implicitly created identity in master components and an auto-created user assigned identity in MC_ resource group in agent nodes. Type 'None' will not use MSI for the managed cluster, - service principal will be used instead. Known values are: "SystemAssigned", "None". + service principal will be used instead. Known values are: "SystemAssigned" and "None". :vartype type: str or ~azure.mgmt.containerservice.v2020_03_01.models.ResourceIdentityType """ _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, + "principal_id": {"readonly": True}, + "tenant_id": {"readonly": True}, } _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, + "principal_id": {"key": "principalId", "type": "str"}, + "tenant_id": {"key": "tenantId", "type": "str"}, + "type": {"key": "type", "type": "str"}, } - def __init__( - self, - *, - type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, - **kwargs - ): + def __init__(self, *, type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, **kwargs): """ :keyword type: The type of identity used for the managed cluster. Type 'SystemAssigned' will use an implicitly created identity in master components and an auto-created user assigned identity in MC_ resource group in agent nodes. Type 'None' will not use MSI for the managed - cluster, service principal will be used instead. Known values are: "SystemAssigned", "None". + cluster, service principal will be used instead. Known values are: "SystemAssigned" and "None". :paramtype type: str or ~azure.mgmt.containerservice.v2020_03_01.models.ResourceIdentityType """ - super(ManagedClusterIdentity, self).__init__(**kwargs) + super().__init__(**kwargs) self.principal_id = None self.tenant_id = None self.type = type -class ManagedClusterListResult(msrest.serialization.Model): +class ManagedClusterListResult(_serialization.Model): """The response from the List Managed Clusters operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -2512,30 +2507,25 @@ class ManagedClusterListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[ManagedCluster]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[ManagedCluster]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.ManagedCluster"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.ManagedCluster"]] = None, **kwargs): """ :keyword value: The list of managed clusters. :paramtype value: list[~azure.mgmt.containerservice.v2020_03_01.models.ManagedCluster] """ - super(ManagedClusterListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class ManagedClusterLoadBalancerProfile(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfile(_serialization.Model): """Profile of the managed cluster load balancer. :ivar managed_outbound_i_ps: Desired managed outbound IPs for the cluster load balancer. @@ -2561,17 +2551,23 @@ class ManagedClusterLoadBalancerProfile(msrest.serialization.Model): """ _validation = { - 'allocated_outbound_ports': {'maximum': 64000, 'minimum': 0}, - 'idle_timeout_in_minutes': {'maximum': 120, 'minimum': 4}, + "allocated_outbound_ports": {"maximum": 64000, "minimum": 0}, + "idle_timeout_in_minutes": {"maximum": 120, "minimum": 4}, } _attribute_map = { - 'managed_outbound_i_ps': {'key': 'managedOutboundIPs', 'type': 'ManagedClusterLoadBalancerProfileManagedOutboundIPs'}, - 'outbound_ip_prefixes': {'key': 'outboundIPPrefixes', 'type': 'ManagedClusterLoadBalancerProfileOutboundIPPrefixes'}, - 'outbound_i_ps': {'key': 'outboundIPs', 'type': 'ManagedClusterLoadBalancerProfileOutboundIPs'}, - 'effective_outbound_i_ps': {'key': 'effectiveOutboundIPs', 'type': '[ResourceReference]'}, - 'allocated_outbound_ports': {'key': 'allocatedOutboundPorts', 'type': 'int'}, - 'idle_timeout_in_minutes': {'key': 'idleTimeoutInMinutes', 'type': 'int'}, + "managed_outbound_i_ps": { + "key": "managedOutboundIPs", + "type": "ManagedClusterLoadBalancerProfileManagedOutboundIPs", + }, + "outbound_ip_prefixes": { + "key": "outboundIPPrefixes", + "type": "ManagedClusterLoadBalancerProfileOutboundIPPrefixes", + }, + "outbound_i_ps": {"key": "outboundIPs", "type": "ManagedClusterLoadBalancerProfileOutboundIPs"}, + "effective_outbound_i_ps": {"key": "effectiveOutboundIPs", "type": "[ResourceReference]"}, + "allocated_outbound_ports": {"key": "allocatedOutboundPorts", "type": "int"}, + "idle_timeout_in_minutes": {"key": "idleTimeoutInMinutes", "type": "int"}, } def __init__( @@ -2581,8 +2577,8 @@ def __init__( outbound_ip_prefixes: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPPrefixes"] = None, outbound_i_ps: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPs"] = None, effective_outbound_i_ps: Optional[List["_models.ResourceReference"]] = None, - allocated_outbound_ports: Optional[int] = 0, - idle_timeout_in_minutes: Optional[int] = 30, + allocated_outbound_ports: int = 0, + idle_timeout_in_minutes: int = 30, **kwargs ): """ @@ -2608,7 +2604,7 @@ def __init__( must be in the range of 4 to 120 (inclusive). The default value is 30 minutes. :paramtype idle_timeout_in_minutes: int """ - super(ManagedClusterLoadBalancerProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.managed_outbound_i_ps = managed_outbound_i_ps self.outbound_ip_prefixes = outbound_ip_prefixes self.outbound_i_ps = outbound_i_ps @@ -2617,7 +2613,7 @@ def __init__( self.idle_timeout_in_minutes = idle_timeout_in_minutes -class ManagedClusterLoadBalancerProfileManagedOutboundIPs(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfileManagedOutboundIPs(_serialization.Model): """Desired managed outbound IPs for the cluster load balancer. :ivar count: Desired number of outbound IP created/managed by Azure for the cluster load @@ -2626,29 +2622,24 @@ class ManagedClusterLoadBalancerProfileManagedOutboundIPs(msrest.serialization.M """ _validation = { - 'count': {'maximum': 100, 'minimum': 1}, + "count": {"maximum": 100, "minimum": 1}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, + "count": {"key": "count", "type": "int"}, } - def __init__( - self, - *, - count: Optional[int] = 1, - **kwargs - ): + def __init__(self, *, count: int = 1, **kwargs): """ :keyword count: Desired number of outbound IP created/managed by Azure for the cluster load balancer. Allowed values must be in the range of 1 to 100 (inclusive). The default value is 1. :paramtype count: int """ - super(ManagedClusterLoadBalancerProfileManagedOutboundIPs, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count -class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(_serialization.Model): """Desired outbound IP Prefix resources for the cluster load balancer. :ivar public_ip_prefixes: A list of public IP prefix resources. @@ -2657,25 +2648,20 @@ class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(msrest.serialization.M """ _attribute_map = { - 'public_ip_prefixes': {'key': 'publicIPPrefixes', 'type': '[ResourceReference]'}, + "public_ip_prefixes": {"key": "publicIPPrefixes", "type": "[ResourceReference]"}, } - def __init__( - self, - *, - public_ip_prefixes: Optional[List["_models.ResourceReference"]] = None, - **kwargs - ): + def __init__(self, *, public_ip_prefixes: Optional[List["_models.ResourceReference"]] = None, **kwargs): """ :keyword public_ip_prefixes: A list of public IP prefix resources. :paramtype public_ip_prefixes: list[~azure.mgmt.containerservice.v2020_03_01.models.ResourceReference] """ - super(ManagedClusterLoadBalancerProfileOutboundIPPrefixes, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_ip_prefixes = public_ip_prefixes -class ManagedClusterLoadBalancerProfileOutboundIPs(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfileOutboundIPs(_serialization.Model): """Desired outbound IP resources for the cluster load balancer. :ivar public_i_ps: A list of public IP resources. @@ -2683,34 +2669,29 @@ class ManagedClusterLoadBalancerProfileOutboundIPs(msrest.serialization.Model): """ _attribute_map = { - 'public_i_ps': {'key': 'publicIPs', 'type': '[ResourceReference]'}, + "public_i_ps": {"key": "publicIPs", "type": "[ResourceReference]"}, } - def __init__( - self, - *, - public_i_ps: Optional[List["_models.ResourceReference"]] = None, - **kwargs - ): + def __init__(self, *, public_i_ps: Optional[List["_models.ResourceReference"]] = None, **kwargs): """ :keyword public_i_ps: A list of public IP resources. :paramtype public_i_ps: list[~azure.mgmt.containerservice.v2020_03_01.models.ResourceReference] """ - super(ManagedClusterLoadBalancerProfileOutboundIPs, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_i_ps = public_i_ps -class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): +class ManagedClusterPoolUpgradeProfile(_serialization.Model): """The list of available upgrade versions. All required parameters must be populated in order to send to Azure. - :ivar kubernetes_version: Required. Kubernetes version (major, minor, patch). + :ivar kubernetes_version: Kubernetes version (major, minor, patch). Required. :vartype kubernetes_version: str :ivar name: Pool name. :vartype name: str - :ivar os_type: Required. OsType to be used to specify os type. Choose from Linux and Windows. - Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to + Linux. Known values are: "Linux" and "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2020_03_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -2718,15 +2699,15 @@ class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): """ _validation = { - 'kubernetes_version': {'required': True}, - 'os_type': {'required': True}, + "kubernetes_version": {"required": True}, + "os_type": {"required": True}, } _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'upgrades': {'key': 'upgrades', 'type': '[ManagedClusterPoolUpgradeProfileUpgradesItem]'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "os_type": {"key": "osType", "type": "str"}, + "upgrades": {"key": "upgrades", "type": "[ManagedClusterPoolUpgradeProfileUpgradesItem]"}, } def __init__( @@ -2739,25 +2720,25 @@ def __init__( **kwargs ): """ - :keyword kubernetes_version: Required. Kubernetes version (major, minor, patch). + :keyword kubernetes_version: Kubernetes version (major, minor, patch). Required. :paramtype kubernetes_version: str :keyword name: Pool name. :paramtype name: str - :keyword os_type: Required. OsType to be used to specify os type. Choose from Linux and - Windows. Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default + to Linux. Known values are: "Linux" and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2020_03_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: list[~azure.mgmt.containerservice.v2020_03_01.models.ManagedClusterPoolUpgradeProfileUpgradesItem] """ - super(ManagedClusterPoolUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.name = name self.os_type = os_type self.upgrades = upgrades -class ManagedClusterPoolUpgradeProfileUpgradesItem(msrest.serialization.Model): +class ManagedClusterPoolUpgradeProfileUpgradesItem(_serialization.Model): """ManagedClusterPoolUpgradeProfileUpgradesItem. :ivar kubernetes_version: Kubernetes version (major, minor, patch). @@ -2767,29 +2748,23 @@ class ManagedClusterPoolUpgradeProfileUpgradesItem(msrest.serialization.Model): """ _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } - def __init__( - self, - *, - kubernetes_version: Optional[str] = None, - is_preview: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, kubernetes_version: Optional[str] = None, is_preview: Optional[bool] = None, **kwargs): """ :keyword kubernetes_version: Kubernetes version (major, minor, patch). :paramtype kubernetes_version: str :keyword is_preview: Whether Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(ManagedClusterPoolUpgradeProfileUpgradesItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.is_preview = is_preview -class ManagedClusterPropertiesAutoScalerProfile(msrest.serialization.Model): +class ManagedClusterPropertiesAutoScalerProfile(_serialization.Model): """Parameters to be applied to the cluster-autoscaler when enabled. :ivar balance_similar_node_groups: @@ -2813,15 +2788,15 @@ class ManagedClusterPropertiesAutoScalerProfile(msrest.serialization.Model): """ _attribute_map = { - 'balance_similar_node_groups': {'key': 'balance-similar-node-groups', 'type': 'str'}, - 'scan_interval': {'key': 'scan-interval', 'type': 'str'}, - 'scale_down_delay_after_add': {'key': 'scale-down-delay-after-add', 'type': 'str'}, - 'scale_down_delay_after_delete': {'key': 'scale-down-delay-after-delete', 'type': 'str'}, - 'scale_down_delay_after_failure': {'key': 'scale-down-delay-after-failure', 'type': 'str'}, - 'scale_down_unneeded_time': {'key': 'scale-down-unneeded-time', 'type': 'str'}, - 'scale_down_unready_time': {'key': 'scale-down-unready-time', 'type': 'str'}, - 'scale_down_utilization_threshold': {'key': 'scale-down-utilization-threshold', 'type': 'str'}, - 'max_graceful_termination_sec': {'key': 'max-graceful-termination-sec', 'type': 'str'}, + "balance_similar_node_groups": {"key": "balance-similar-node-groups", "type": "str"}, + "scan_interval": {"key": "scan-interval", "type": "str"}, + "scale_down_delay_after_add": {"key": "scale-down-delay-after-add", "type": "str"}, + "scale_down_delay_after_delete": {"key": "scale-down-delay-after-delete", "type": "str"}, + "scale_down_delay_after_failure": {"key": "scale-down-delay-after-failure", "type": "str"}, + "scale_down_unneeded_time": {"key": "scale-down-unneeded-time", "type": "str"}, + "scale_down_unready_time": {"key": "scale-down-unready-time", "type": "str"}, + "scale_down_utilization_threshold": {"key": "scale-down-utilization-threshold", "type": "str"}, + "max_graceful_termination_sec": {"key": "max-graceful-termination-sec", "type": "str"}, } def __init__( @@ -2858,7 +2833,7 @@ def __init__( :keyword max_graceful_termination_sec: :paramtype max_graceful_termination_sec: str """ - super(ManagedClusterPropertiesAutoScalerProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.balance_similar_node_groups = balance_similar_node_groups self.scan_interval = scan_interval self.scale_down_delay_after_add = scale_down_delay_after_add @@ -2882,9 +2857,9 @@ class ManagedClusterPropertiesIdentityProfileValue(UserAssignedIdentity): """ _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'object_id': {'key': 'objectId', 'type': 'str'}, + "resource_id": {"key": "resourceId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + "object_id": {"key": "objectId", "type": "str"}, } def __init__( @@ -2903,59 +2878,53 @@ def __init__( :keyword object_id: The object id of the user assigned identity. :paramtype object_id: str """ - super(ManagedClusterPropertiesIdentityProfileValue, self).__init__(resource_id=resource_id, client_id=client_id, object_id=object_id, **kwargs) + super().__init__(resource_id=resource_id, client_id=client_id, object_id=object_id, **kwargs) -class ManagedClusterServicePrincipalProfile(msrest.serialization.Model): +class ManagedClusterServicePrincipalProfile(_serialization.Model): """Information about a service principal identity for the cluster to use for manipulating Azure APIs. All required parameters must be populated in order to send to Azure. - :ivar client_id: Required. The ID for the service principal. + :ivar client_id: The ID for the service principal. Required. :vartype client_id: str :ivar secret: The secret password associated with the service principal in plain text. :vartype secret: str """ _validation = { - 'client_id': {'required': True}, + "client_id": {"required": True}, } _attribute_map = { - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'secret': {'key': 'secret', 'type': 'str'}, + "client_id": {"key": "clientId", "type": "str"}, + "secret": {"key": "secret", "type": "str"}, } - def __init__( - self, - *, - client_id: str, - secret: Optional[str] = None, - **kwargs - ): + def __init__(self, *, client_id: str, secret: Optional[str] = None, **kwargs): """ - :keyword client_id: Required. The ID for the service principal. + :keyword client_id: The ID for the service principal. Required. :paramtype client_id: str :keyword secret: The secret password associated with the service principal in plain text. :paramtype secret: str """ - super(ManagedClusterServicePrincipalProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.client_id = client_id self.secret = secret -class ManagedClusterSKU(msrest.serialization.Model): +class ManagedClusterSKU(_serialization.Model): """ManagedClusterSKU. - :ivar name: Name of a managed cluster SKU. Known values are: "Basic". + :ivar name: Name of a managed cluster SKU. "Basic" :vartype name: str or ~azure.mgmt.containerservice.v2020_03_01.models.ManagedClusterSKUName - :ivar tier: Tier of a managed cluster SKU. Known values are: "Paid", "Free". + :ivar tier: Tier of a managed cluster SKU. Known values are: "Paid" and "Free". :vartype tier: str or ~azure.mgmt.containerservice.v2020_03_01.models.ManagedClusterSKUTier """ _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, + "name": {"key": "name", "type": "str"}, + "tier": {"key": "tier", "type": "str"}, } def __init__( @@ -2966,17 +2935,17 @@ def __init__( **kwargs ): """ - :keyword name: Name of a managed cluster SKU. Known values are: "Basic". + :keyword name: Name of a managed cluster SKU. "Basic" :paramtype name: str or ~azure.mgmt.containerservice.v2020_03_01.models.ManagedClusterSKUName - :keyword tier: Tier of a managed cluster SKU. Known values are: "Paid", "Free". + :keyword tier: Tier of a managed cluster SKU. Known values are: "Paid" and "Free". :paramtype tier: str or ~azure.mgmt.containerservice.v2020_03_01.models.ManagedClusterSKUTier """ - super(ManagedClusterSKU, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.tier = tier -class ManagedClusterUpgradeProfile(msrest.serialization.Model): +class ManagedClusterUpgradeProfile(_serialization.Model): """The list of available upgrades for compute pools. Variables are only populated by the server, and will be ignored when sending a request. @@ -2989,29 +2958,29 @@ class ManagedClusterUpgradeProfile(msrest.serialization.Model): :vartype name: str :ivar type: Type of upgrade profile. :vartype type: str - :ivar control_plane_profile: Required. The list of available upgrade versions for the control - plane. + :ivar control_plane_profile: The list of available upgrade versions for the control plane. + Required. :vartype control_plane_profile: ~azure.mgmt.containerservice.v2020_03_01.models.ManagedClusterPoolUpgradeProfile - :ivar agent_pool_profiles: Required. The list of available upgrade versions for agent pools. + :ivar agent_pool_profiles: The list of available upgrade versions for agent pools. Required. :vartype agent_pool_profiles: list[~azure.mgmt.containerservice.v2020_03_01.models.ManagedClusterPoolUpgradeProfile] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'control_plane_profile': {'required': True}, - 'agent_pool_profiles': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "control_plane_profile": {"required": True}, + "agent_pool_profiles": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'control_plane_profile': {'key': 'properties.controlPlaneProfile', 'type': 'ManagedClusterPoolUpgradeProfile'}, - 'agent_pool_profiles': {'key': 'properties.agentPoolProfiles', 'type': '[ManagedClusterPoolUpgradeProfile]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "control_plane_profile": {"key": "properties.controlPlaneProfile", "type": "ManagedClusterPoolUpgradeProfile"}, + "agent_pool_profiles": {"key": "properties.agentPoolProfiles", "type": "[ManagedClusterPoolUpgradeProfile]"}, } def __init__( @@ -3022,15 +2991,15 @@ def __init__( **kwargs ): """ - :keyword control_plane_profile: Required. The list of available upgrade versions for the - control plane. + :keyword control_plane_profile: The list of available upgrade versions for the control plane. + Required. :paramtype control_plane_profile: ~azure.mgmt.containerservice.v2020_03_01.models.ManagedClusterPoolUpgradeProfile - :keyword agent_pool_profiles: Required. The list of available upgrade versions for agent pools. + :keyword agent_pool_profiles: The list of available upgrade versions for agent pools. Required. :paramtype agent_pool_profiles: list[~azure.mgmt.containerservice.v2020_03_01.models.ManagedClusterPoolUpgradeProfile] """ - super(ManagedClusterUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -3038,18 +3007,18 @@ def __init__( self.agent_pool_profiles = agent_pool_profiles -class ManagedClusterWindowsProfile(msrest.serialization.Model): +class ManagedClusterWindowsProfile(_serialization.Model): """Profile for Windows VMs in the container service cluster. All required parameters must be populated in order to send to Azure. - :ivar admin_username: Required. Specifies the name of the administrator account. - :code:`
`:code:`
` **restriction:** Cannot end in "." :code:`
`:code:`
` - **Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", "test1", - "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", - "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", - "sys", "test2", "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 - character :code:`
`:code:`
` **Max-length:** 20 characters. + :ivar admin_username: Specifies the name of the administrator account. :code:`
`:code:`
` + **restriction:** Cannot end in "." :code:`
`:code:`
` **Disallowed values:** + "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", + "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", + "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", + "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 character + :code:`
`:code:`
` **Max-length:** 20 characters. Required. :vartype admin_username: str :ivar admin_password: Specifies the password of the administrator account. :code:`
`:code:`
` **Minimum-length:** 8 characters :code:`
`:code:`
` @@ -3062,29 +3031,23 @@ class ManagedClusterWindowsProfile(msrest.serialization.Model): """ _validation = { - 'admin_username': {'required': True}, + "admin_username": {"required": True}, } _attribute_map = { - 'admin_username': {'key': 'adminUsername', 'type': 'str'}, - 'admin_password': {'key': 'adminPassword', 'type': 'str'}, + "admin_username": {"key": "adminUsername", "type": "str"}, + "admin_password": {"key": "adminPassword", "type": "str"}, } - def __init__( - self, - *, - admin_username: str, - admin_password: Optional[str] = None, - **kwargs - ): + def __init__(self, *, admin_username: str, admin_password: Optional[str] = None, **kwargs): """ - :keyword admin_username: Required. Specifies the name of the administrator account. + :keyword admin_username: Specifies the name of the administrator account. :code:`
`:code:`
` **restriction:** Cannot end in "." :code:`
`:code:`
` **Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 - character :code:`
`:code:`
` **Max-length:** 20 characters. + character :code:`
`:code:`
` **Max-length:** 20 characters. Required. :paramtype admin_username: str :keyword admin_password: Specifies the password of the administrator account. :code:`
`:code:`
` **Minimum-length:** 8 characters :code:`
`:code:`
` @@ -3095,12 +3058,12 @@ def __init__( "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!". :paramtype admin_password: str """ - super(ManagedClusterWindowsProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.admin_username = admin_username self.admin_password = admin_password -class OperationListResult(msrest.serialization.Model): +class OperationListResult(_serialization.Model): """The List Compute Operation operation response. Variables are only populated by the server, and will be ignored when sending a request. @@ -3110,24 +3073,20 @@ class OperationListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[OperationValue]'}, + "value": {"key": "value", "type": "[OperationValue]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(OperationListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None -class OperationValue(msrest.serialization.Model): +class OperationValue(_serialization.Model): """Describes the properties of a Compute Operation value. Variables are only populated by the server, and will be ignored when sending a request. @@ -3147,30 +3106,26 @@ class OperationValue(msrest.serialization.Model): """ _validation = { - 'origin': {'readonly': True}, - 'name': {'readonly': True}, - 'operation': {'readonly': True}, - 'resource': {'readonly': True}, - 'description': {'readonly': True}, - 'provider': {'readonly': True}, + "origin": {"readonly": True}, + "name": {"readonly": True}, + "operation": {"readonly": True}, + "resource": {"readonly": True}, + "description": {"readonly": True}, + "provider": {"readonly": True}, } _attribute_map = { - 'origin': {'key': 'origin', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'operation': {'key': 'display.operation', 'type': 'str'}, - 'resource': {'key': 'display.resource', 'type': 'str'}, - 'description': {'key': 'display.description', 'type': 'str'}, - 'provider': {'key': 'display.provider', 'type': 'str'}, + "origin": {"key": "origin", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "operation": {"key": "display.operation", "type": "str"}, + "resource": {"key": "display.resource", "type": "str"}, + "description": {"key": "display.description", "type": "str"}, + "provider": {"key": "display.provider", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(OperationValue, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.origin = None self.name = None self.operation = None @@ -3179,7 +3134,7 @@ def __init__( self.provider = None -class ResourceReference(msrest.serialization.Model): +class ResourceReference(_serialization.Model): """A reference to an Azure resource. :ivar id: The fully qualified Azure resource id. @@ -3187,43 +3142,33 @@ class ResourceReference(msrest.serialization.Model): """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, } - def __init__( - self, - *, - id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin """ :keyword id: The fully qualified Azure resource id. :paramtype id: str """ - super(ResourceReference, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id -class TagsObject(msrest.serialization.Model): +class TagsObject(_serialization.Model): """Tags object for patch operations. - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] """ _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] """ - super(TagsObject, self).__init__(**kwargs) + super().__init__(**kwargs) self.tags = tags diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/models/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/models/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/models/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/models/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/operations/__init__.py index 403c0174f052..ee6608454b6b 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/operations/__init__.py @@ -13,10 +13,11 @@ from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'Operations', - 'ManagedClustersOperations', - 'AgentPoolsOperations', + "Operations", + "ManagedClustersOperations", + "AgentPoolsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/operations/_agent_pools_operations.py index 7340d4418472..354d12e1dc33 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/operations/_agent_pools_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,249 +27,250 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - *, - json: Optional[_models.AgentPool] = None, - content: Any = None, - **kwargs: Any + _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, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + _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, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_get_upgrade_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_available_agent_pool_versions_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class AgentPoolsOperations: """ @@ -285,48 +291,40 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> Iterable[_models.AgentPoolListResult]: + def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> Iterable["_models.AgentPool"]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. The operation returns properties of each agent pool. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AgentPoolListResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_03_01.models.AgentPoolListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either AgentPool or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_03_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -334,16 +332,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -359,10 +352,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -372,54 +363,45 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore @distributed_trace def get( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPool: """Gets the agent pool. Gets the details of the agent pool by managed cluster and resource group. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPool, or the result of cls(response) + :return: AgentPool or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_03_01.models.AgentPool - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -427,57 +409,60 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore def _create_or_update_initial( self, resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: _models.AgentPool, + parameters: Union[_models.AgentPool, IO], **kwargs: Any ) -> _models.AgentPool: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - _json = self._serialize.body(parameters, 'AgentPool') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "AgentPool") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -485,10 +470,9 @@ def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -496,40 +480,86 @@ def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - - @distributed_trace + @overload def begin_create_or_update( self, resource_group_name: str, resource_name: str, agent_pool_name: str, parameters: _models.AgentPool, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.AgentPool]: """Creates or updates an agent pool. Creates or updates an agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :param parameters: Parameters supplied to the Create or Update an agent pool operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2020_03_01.models.AgentPool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_03_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AgentPool]: + """Creates or updates an agent pool. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: Parameters supplied to the Create or Update an agent pool operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -541,20 +571,56 @@ def begin_create_or_update( :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_03_01.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: Union[_models.AgentPool, IO], + **kwargs: Any + ) -> LROPoller[_models.AgentPool]: + """Creates or updates an agent pool. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: Parameters supplied to the Create or Update an agent pool operation. Is + either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2020_03_01.models.AgentPool or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_03_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -563,66 +629,55 @@ def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -630,10 +685,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -643,26 +697,21 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + def begin_delete( + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> LROPoller[None]: """Deletes an agent pool. Deletes the agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -674,100 +723,86 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPoolUpgradeProfile: """Gets upgrade profile for an agent pool. Gets the details of the upgrade profile for an agent pool with a specified resource group and managed cluster name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolUpgradeProfile, or the result of cls(response) + :return: AgentPoolUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_03_01.models.AgentPoolUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -775,64 +810,56 @@ def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolUpgradeProfile', pipeline_response) + deserialized = self._deserialize("AgentPoolUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore @distributed_trace def get_available_agent_pool_versions( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported versions for the specified agent pool. Gets a list of supported versions for the specified agent pool. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolAvailableVersions, or the result of cls(response) + :return: AgentPoolAvailableVersions or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_03_01.models.AgentPoolAvailableVersions - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolAvailableVersions] - request = build_get_available_agent_pool_versions_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_available_agent_pool_versions.metadata['url'], + template_url=self.get_available_agent_pool_versions.metadata["url"], headers=_headers, params=_params, ) @@ -840,22 +867,20 @@ def get_available_agent_pool_versions( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolAvailableVersions', pipeline_response) + deserialized = self._deserialize("AgentPoolAvailableVersions", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_available_agent_pool_versions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore - + get_available_agent_pool_versions.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/operations/_managed_clusters_operations.py index e4555d18389a..b0817af1e5fd 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/operations/_managed_clusters_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,557 +27,536 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters") + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters" + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_resource_group_request( - subscription_id: str, - resource_group_name: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters", + ) # 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', min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_upgrade_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_access_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, role_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 = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "roleName": _SERIALIZER.url("role_name", role_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "roleName": _SERIALIZER.url("role_name", role_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_admin_credentials_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_user_credentials_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_monitoring_user_credentials_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: + +def build_get_request(resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedCluster] = None, - content: Any = None, - **kwargs: Any +def build_create_or_update_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_update_tags_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.TagsObject] = None, - content: Any = None, - **kwargs: Any + +def build_update_tags_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + +def build_delete_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_reset_service_principal_profile_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedClusterServicePrincipalProfile] = None, - content: Any = None, - **kwargs: Any + +def build_reset_service_principal_profile_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_reset_aad_profile_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedClusterAADProfile] = None, - content: Any = None, - **kwargs: Any +def build_reset_aad_profile_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_rotate_cluster_certificates_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any +def build_rotate_cluster_certificates_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + class ManagedClustersOperations: """ @@ -593,41 +577,35 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.ManagedClusterListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.ManagedCluster"]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. The operation returns properties of each managed cluster. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_03_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_03_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -635,14 +613,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -658,10 +633,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -671,50 +644,42 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> Iterable[_models.ManagedClusterListResult]: + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.ManagedCluster"]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. The operation returns properties of each managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_03_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_03_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -722,15 +687,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -746,10 +707,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -759,51 +718,43 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.ManagedClusterUpgradeProfile: """Gets upgrade profile for a managed cluster. Gets the details of the upgrade profile for a managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterUpgradeProfile, or the result of cls(response) + :return: ManagedClusterUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_03_01.models.ManagedClusterUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -811,69 +762,60 @@ def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterUpgradeProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore @distributed_trace def get_access_profile( - self, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, role_name: str, **kwargs: Any ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. Gets the accessProfile for the specified role name of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param role_name: The name of the role for managed cluster accessProfile resource. + :param role_name: The name of the role for managed cluster accessProfile resource. Required. :type role_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterAccessProfile, or the result of cls(response) + :return: ManagedClusterAccessProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_03_01.models.ManagedClusterAccessProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterAccessProfile] - request = build_get_access_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, role_name=role_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_access_profile.metadata['url'], + template_url=self.get_access_profile.metadata["url"], headers=_headers, params=_params, ) @@ -881,64 +823,56 @@ def get_access_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterAccessProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterAccessProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_access_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore - + get_access_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore @distributed_trace def list_cluster_admin_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster admin credential of a managed cluster. Gets cluster admin credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_03_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_admin_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_admin_credentials.metadata['url'], + template_url=self.list_cluster_admin_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -946,64 +880,56 @@ def list_cluster_admin_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_admin_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore - + list_cluster_admin_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore @distributed_trace def list_cluster_user_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster user credential of a managed cluster. Gets cluster user credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_03_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_user_credentials.metadata['url'], + template_url=self.list_cluster_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -1011,65 +937,57 @@ def list_cluster_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore - + list_cluster_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore @distributed_trace def list_cluster_monitoring_user_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster monitoring user credential of a managed cluster. Gets cluster monitoring user credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_03_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_monitoring_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + template_url=self.list_cluster_monitoring_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -1077,64 +995,54 @@ def list_cluster_monitoring_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_monitoring_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore - + list_cluster_monitoring_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore @distributed_trace - def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.ManagedCluster: + def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.ManagedCluster: """Gets a managed cluster. Gets the details of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedCluster, or the result of cls(response) + :return: ManagedCluster or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_03_01.models.ManagedCluster - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -1142,55 +1050,54 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _create_or_update_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.ManagedCluster, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'ManagedCluster') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedCluster") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1198,10 +1105,9 @@ def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -1209,25 +1115,26 @@ def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - @distributed_trace + @overload def begin_create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedCluster, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. @@ -1235,12 +1142,16 @@ def begin_create_or_update( Creates or updates a managed cluster with the specified configuration for agents and Kubernetes version. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2020_03_01.models.ManagedCluster + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1253,20 +1164,91 @@ def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_03_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster with the specified configuration for agents and Kubernetes + version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_03_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster with the specified configuration for agents and Kubernetes + version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. Is + either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2020_03_01.models.ManagedCluster or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_03_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -1274,69 +1256,66 @@ def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _update_tags_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.TagsObject, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request_initial( - subscription_id=self._config.subscription_id, + request = build_update_tags_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_tags_initial.metadata['url'], + content=_content, + template_url=self._update_tags_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1344,44 +1323,118 @@ def _update_tags_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_tags_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _update_tags_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - @distributed_trace + @overload def begin_update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates a managed cluster with the specified tags. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2020_03_01.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_03_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates a managed cluster with the specified tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_03_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates a managed cluster with the specified tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2020_03_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1394,20 +1447,17 @@ def begin_update_tags( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_03_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, @@ -1415,64 +1465,54 @@ def begin_update_tags( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1480,10 +1520,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1493,23 +1532,17 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> LROPoller[None]: + def begin_delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> LROPoller[None]: """Deletes a managed cluster. Deletes the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1521,85 +1554,83 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterServicePrincipalProfile, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterServicePrincipalProfile") - request = build_reset_service_principal_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_service_principal_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_service_principal_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_service_principal_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1607,10 +1638,9 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1620,29 +1650,106 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re if cls: return cls(pipeline_response, None, {}) - _reset_service_principal_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore - + _reset_service_principal_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore - @distributed_trace - def begin_reset_service_principal_profile( # pylint: disable=inconsistent-return-statements + @overload + def begin_reset_service_principal_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterServicePrincipalProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: """Reset Service Principal Profile of a managed cluster. Update the service principal Profile for a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a - Managed Cluster. + Managed Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2020_03_01.models.ManagedClusterServicePrincipalProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reset Service Principal Profile of a managed cluster. + + Update the service principal Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a + Managed Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Reset Service Principal Profile of a managed cluster. + + Update the service principal Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a + Managed Cluster. Is either a model type or a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2020_03_01.models.ManagedClusterServicePrincipalProfile or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1653,20 +1760,17 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1674,67 +1778,68 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_service_principal_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + begin_reset_service_principal_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterAADProfile, + parameters: Union[_models.ManagedClusterAADProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterAADProfile") - request = build_reset_aad_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_aad_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_aad_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_aad_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1742,10 +1847,9 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1755,28 +1859,32 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement if cls: return cls(pipeline_response, None, {}) - _reset_aad_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - + _reset_aad_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - @distributed_trace - def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements + @overload + def begin_reset_aad_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterAADProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: """Reset AAD Profile of a managed cluster. Update the AAD Profile for a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed - Cluster. + Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2020_03_01.models.ManagedClusterAADProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1787,20 +1895,90 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reset AAD Profile of a managed cluster. + + Update the AAD Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed + Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterAADProfile, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Reset AAD Profile of a managed cluster. + + Update the AAD Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed + Cluster. Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2020_03_01.models.ManagedClusterAADProfile or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1808,62 +1986,52 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_aad_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + begin_reset_aad_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_rotate_cluster_certificates_request_initial( - subscription_id=self._config.subscription_id, + request = build_rotate_cluster_certificates_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._rotate_cluster_certificates_initial.metadata['url'], + template_url=self._rotate_cluster_certificates_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1871,10 +2039,9 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1884,23 +2051,19 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return if cls: return cls(pipeline_response, None, {}) - _rotate_cluster_certificates_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore - + _rotate_cluster_certificates_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore @distributed_trace - def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + def begin_rotate_cluster_certificates( + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> LROPoller[None]: """Rotate certificates of a managed cluster. Rotate certificates of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1912,52 +2075,45 @@ def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-st Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._rotate_cluster_certificates_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_rotate_cluster_certificates.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore + begin_rotate_cluster_certificates.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/operations/_operations.py index 4a174c2bb327..8a55fac292ab 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/operations/_operations.py @@ -7,10 +7,15 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,38 +25,34 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - **kwargs: Any -) -> HttpRequest: + +def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.ContainerService/operations") # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class Operations: """ @@ -72,36 +73,31 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.OperationListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.OperationValue"]: """Gets a list of compute operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationListResult or the result of cls(response) + :return: An iterator like instance of either OperationValue or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_03_01.models.OperationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_03_01.models.OperationValue] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -109,13 +105,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -131,10 +125,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -144,8 +136,6 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.ContainerService/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ContainerService/operations"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/operations/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/__init__.py index 37a5f9e02e6f..a8716d29afe8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/__init__.py @@ -14,7 +14,8 @@ except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['ContainerServiceClient'] + +__all__ = ["ContainerServiceClient"] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/_configuration.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/_configuration.py index 12ddea0ed680..d342e9e6b044 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/_configuration.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/_configuration.py @@ -18,30 +18,26 @@ VERSION = "unknown" + class ContainerServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ContainerServiceClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2020-04-01". 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: + def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ContainerServiceClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2020-04-01") # type: str + api_version = kwargs.pop("api_version", "2020-04-01") # type: str if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -51,23 +47,24 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-containerservice/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-containerservice/{}".format(VERSION)) self._configure(**kwargs) def _configure( - self, - **kwargs # type: Any + self, **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/_container_service_client.py index 5453f317a26f..85c8c32ab2eb 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/_container_service_client.py @@ -9,12 +9,11 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from . import models +from .._serialization import Deserializer, Serializer from ._configuration import ContainerServiceClientConfiguration from .operations import AgentPoolsOperations, ManagedClustersOperations, Operations @@ -22,7 +21,8 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class ContainerServiceClient: + +class ContainerServiceClient: # pylint: disable=client-accepts-api-version-keyword """The Container Service Client. :ivar operations: Operations operations @@ -32,10 +32,10 @@ class ContainerServiceClient: azure.mgmt.containerservice.v2020_04_01.operations.ManagedClustersOperations :ivar agent_pools: AgentPoolsOperations operations :vartype agent_pools: azure.mgmt.containerservice.v2020_04_01.operations.AgentPoolsOperations - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -53,29 +53,22 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = ContainerServiceClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = ContainerServiceClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize - ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.managed_clusters = ManagedClustersOperations( self._client, self._config, self._serialize, self._deserialize ) - self.agent_pools = AgentPoolsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - + self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> HttpResponse: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -84,7 +77,7 @@ def _send_request( >>> response = client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/_metadata.json b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/_metadata.json index f62b7db02e73..bd5c9feae6d9 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/_metadata.json +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/_metadata.json @@ -10,20 +10,20 @@ "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { "credential": { - "signature": "credential, # type: \"TokenCredential\"", - "description": "Credential needed for the client to connect to Azure.", + "signature": "credential: \"TokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true }, "subscription_id": { - "signature": "subscription_id, # type: str", - "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "signature": "subscription_id: str,", + "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.", "docstring_type": "str", "required": true } @@ -31,13 +31,13 @@ "async": { "credential": { "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure.", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { "signature": "subscription_id: str,", - "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.", "docstring_type": "str", "required": true } @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=\"https://management.azure.com\", # type: str", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/_patch.py index 74e48ecd07cf..f99e77fef986 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/_patch.py @@ -28,4 +28,4 @@ # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + pass diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/_vendor.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/_vendor.py index 138f663c53a4..9aad73fc743e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/_vendor.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/_vendor.py @@ -7,6 +7,7 @@ from azure.core.pipeline.transport import HttpRequest + def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) @@ -14,6 +15,7 @@ def _convert_request(request, files=None): request.set_formdata_body(files) return request + def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -21,7 +23,5 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [ - c for c in formatted_components if "{}".format(key.args[0]) not in c - ] + components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/aio/__init__.py index 37a5f9e02e6f..a8716d29afe8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/aio/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/aio/__init__.py @@ -14,7 +14,8 @@ except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['ContainerServiceClient'] + +__all__ = ["ContainerServiceClient"] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/aio/_configuration.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/aio/_configuration.py index bd94ceb21aee..a456a32f574f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/aio/_configuration.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/aio/_configuration.py @@ -18,30 +18,26 @@ VERSION = "unknown" + class ContainerServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ContainerServiceClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2020-04-01". 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: + def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ContainerServiceClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2020-04-01") # type: str + api_version = kwargs.pop("api_version", "2020-04-01") # type: str if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -51,22 +47,21 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-containerservice/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-containerservice/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, - **kwargs: Any - ) -> None: - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/aio/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/aio/_container_service_client.py index fb7557c25e9a..2cb4b7eba546 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/aio/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/aio/_container_service_client.py @@ -9,12 +9,11 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from .. import models +from ..._serialization import Deserializer, Serializer from ._configuration import ContainerServiceClientConfiguration from .operations import AgentPoolsOperations, ManagedClustersOperations, Operations @@ -22,7 +21,8 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class ContainerServiceClient: + +class ContainerServiceClient: # pylint: disable=client-accepts-api-version-keyword """The Container Service Client. :ivar operations: Operations operations @@ -33,10 +33,10 @@ class ContainerServiceClient: :ivar agent_pools: AgentPoolsOperations operations :vartype agent_pools: azure.mgmt.containerservice.v2020_04_01.aio.operations.AgentPoolsOperations - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -54,29 +54,22 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = ContainerServiceClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = ContainerServiceClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize - ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.managed_clusters = ManagedClustersOperations( self._client, self._config, self._serialize, self._deserialize ) - self.agent_pools = AgentPoolsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - + self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -85,7 +78,7 @@ def _send_request( >>> response = await client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/aio/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/aio/_patch.py index 74e48ecd07cf..f99e77fef986 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/aio/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/aio/_patch.py @@ -28,4 +28,4 @@ # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + pass diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/aio/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/aio/operations/__init__.py index 403c0174f052..ee6608454b6b 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/aio/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/aio/operations/__init__.py @@ -13,10 +13,11 @@ from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'Operations', - 'ManagedClustersOperations', - 'AgentPoolsOperations', + "Operations", + "ManagedClustersOperations", + "AgentPoolsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/aio/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/aio/operations/_agent_pools_operations.py index 897f100993ea..1a6fdde7378f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/aio/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/aio/operations/_agent_pools_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +29,19 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._agent_pools_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_available_agent_pool_versions_request, build_get_request, build_get_upgrade_profile_request, build_list_request -T = TypeVar('T') +from ...operations._agent_pools_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_available_agent_pool_versions_request, + build_get_request, + build_get_upgrade_profile_request, + build_list_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class AgentPoolsOperations: """ .. warning:: @@ -45,48 +61,41 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.AgentPoolListResult]: + def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncIterable["_models.AgentPool"]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. The operation returns properties of each agent pool. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AgentPoolListResult or the result of cls(response) + :return: An iterator like instance of either AgentPool or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_04_01.models.AgentPoolListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_04_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -94,16 +103,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -119,10 +123,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -132,54 +134,45 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore @distributed_trace_async async def get( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPool: """Gets the agent pool. Gets the details of the agent pool by managed cluster and resource group. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPool, or the result of cls(response) + :return: AgentPool or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_04_01.models.AgentPool - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -187,57 +180,60 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore async def _create_or_update_initial( self, resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: _models.AgentPool, + parameters: Union[_models.AgentPool, IO], **kwargs: Any ) -> _models.AgentPool: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - _json = self._serialize.body(parameters, 'AgentPool') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "AgentPool") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -245,10 +241,9 @@ async def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -256,40 +251,45 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - - @distributed_trace_async + @overload async def begin_create_or_update( self, resource_group_name: str, resource_name: str, agent_pool_name: str, parameters: _models.AgentPool, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.AgentPool]: """Creates or updates an agent pool. Creates or updates an agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :param parameters: Parameters supplied to the Create or Update an agent pool operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2020_04_01.models.AgentPool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -302,20 +302,99 @@ async def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_04_01.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AgentPool]: + """Creates or updates an agent pool. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: Parameters supplied to the Create or Update an agent pool operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AgentPool or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_04_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: Union[_models.AgentPool, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.AgentPool]: + """Creates or updates an agent pool. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: Parameters supplied to the Create or Update an agent pool operation. Is + either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2020_04_01.models.AgentPool or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AgentPool or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_04_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -324,66 +403,55 @@ async def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -391,10 +459,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -404,26 +471,21 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + async def begin_delete( + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes an agent pool. Deletes the agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -435,100 +497,86 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace_async async def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPoolUpgradeProfile: """Gets upgrade profile for an agent pool. Gets the details of the upgrade profile for an agent pool with a specified resource group and managed cluster name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolUpgradeProfile, or the result of cls(response) + :return: AgentPoolUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_04_01.models.AgentPoolUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -536,64 +584,56 @@ async def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolUpgradeProfile', pipeline_response) + deserialized = self._deserialize("AgentPoolUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore @distributed_trace_async async def get_available_agent_pool_versions( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported versions for the specified agent pool. Gets a list of supported versions for the specified agent pool. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolAvailableVersions, or the result of cls(response) + :return: AgentPoolAvailableVersions or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_04_01.models.AgentPoolAvailableVersions - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolAvailableVersions] - request = build_get_available_agent_pool_versions_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_available_agent_pool_versions.metadata['url'], + template_url=self.get_available_agent_pool_versions.metadata["url"], headers=_headers, params=_params, ) @@ -601,22 +641,20 @@ async def get_available_agent_pool_versions( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolAvailableVersions', pipeline_response) + deserialized = self._deserialize("AgentPoolAvailableVersions", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_available_agent_pool_versions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore - + get_available_agent_pool_versions.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/aio/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/aio/operations/_managed_clusters_operations.py index f253c07eccc3..16fb1873784e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/aio/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/aio/operations/_managed_clusters_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +29,27 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._managed_clusters_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_access_profile_request, build_get_request, build_get_upgrade_profile_request, build_list_by_resource_group_request, build_list_cluster_admin_credentials_request, build_list_cluster_monitoring_user_credentials_request, build_list_cluster_user_credentials_request, build_list_request, build_reset_aad_profile_request_initial, build_reset_service_principal_profile_request_initial, build_rotate_cluster_certificates_request_initial, build_update_tags_request_initial -T = TypeVar('T') +from ...operations._managed_clusters_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_access_profile_request, + build_get_request, + build_get_upgrade_profile_request, + build_list_by_resource_group_request, + build_list_cluster_admin_credentials_request, + build_list_cluster_monitoring_user_credentials_request, + build_list_cluster_user_credentials_request, + build_list_request, + build_reset_aad_profile_request, + build_reset_service_principal_profile_request, + build_rotate_cluster_certificates_request, + build_update_tags_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class ManagedClustersOperations: """ .. warning:: @@ -45,41 +69,35 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.ManagedClusterListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.ManagedCluster"]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. The operation returns properties of each managed cluster. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_04_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_04_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -87,14 +105,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -110,10 +125,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -123,50 +136,44 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.ManagedClusterListResult]: + self, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ManagedCluster"]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. The operation returns properties of each managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_04_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_04_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -174,15 +181,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -198,10 +201,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -211,51 +212,43 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace_async async def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.ManagedClusterUpgradeProfile: """Gets upgrade profile for a managed cluster. Gets the details of the upgrade profile for a managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterUpgradeProfile, or the result of cls(response) + :return: ManagedClusterUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_04_01.models.ManagedClusterUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -263,33 +256,27 @@ async def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterUpgradeProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore @distributed_trace_async async def get_access_profile( - self, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, role_name: str, **kwargs: Any ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. @@ -300,36 +287,33 @@ async def get_access_profile( `ListClusterAdminCredentials `_ . - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param role_name: The name of the role for managed cluster accessProfile resource. + :param role_name: The name of the role for managed cluster accessProfile resource. Required. :type role_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterAccessProfile, or the result of cls(response) + :return: ManagedClusterAccessProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_04_01.models.ManagedClusterAccessProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterAccessProfile] - request = build_get_access_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, role_name=role_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_access_profile.metadata['url'], + template_url=self.get_access_profile.metadata["url"], headers=_headers, params=_params, ) @@ -337,64 +321,56 @@ async def get_access_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterAccessProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterAccessProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_access_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore - + get_access_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore @distributed_trace_async async def list_cluster_admin_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster admin credential of a managed cluster. Gets cluster admin credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_04_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_admin_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_admin_credentials.metadata['url'], + template_url=self.list_cluster_admin_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -402,64 +378,56 @@ async def list_cluster_admin_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_admin_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore - + list_cluster_admin_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore @distributed_trace_async async def list_cluster_user_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster user credential of a managed cluster. Gets cluster user credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_04_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_user_credentials.metadata['url'], + template_url=self.list_cluster_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -467,65 +435,57 @@ async def list_cluster_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore - + list_cluster_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore @distributed_trace_async async def list_cluster_monitoring_user_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster monitoring user credential of a managed cluster. Gets cluster monitoring user credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_04_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_monitoring_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + template_url=self.list_cluster_monitoring_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -533,64 +493,54 @@ async def list_cluster_monitoring_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_monitoring_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore - + list_cluster_monitoring_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore @distributed_trace_async - async def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.ManagedCluster: + async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.ManagedCluster: """Gets a managed cluster. Gets the details of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedCluster, or the result of cls(response) + :return: ManagedCluster or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_04_01.models.ManagedCluster - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -598,55 +548,54 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _create_or_update_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.ManagedCluster, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'ManagedCluster') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedCluster") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -654,10 +603,9 @@ async def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -665,25 +613,26 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - @distributed_trace_async + @overload async def begin_create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedCluster, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. @@ -691,12 +640,90 @@ async def begin_create_or_update( Creates or updates a managed cluster with the specified configuration for agents and Kubernetes version. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2020_04_01.models.ManagedCluster + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_04_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster with the specified configuration for agents and Kubernetes + version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_04_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster with the specified configuration for agents and Kubernetes + version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. Is + either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2020_04_01.models.ManagedCluster or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -709,20 +736,17 @@ async def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_04_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -730,69 +754,66 @@ async def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _update_tags_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.TagsObject, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request_initial( - subscription_id=self._config.subscription_id, + request = build_update_tags_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_tags_initial.metadata['url'], + content=_content, + template_url=self._update_tags_initial.metadata["url"], headers=_headers, params=_params, ) @@ -800,44 +821,85 @@ async def _update_tags_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_tags_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _update_tags_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - @distributed_trace_async + @overload async def begin_update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates a managed cluster with the specified tags. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2020_04_01.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_04_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates a managed cluster with the specified tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -850,20 +912,50 @@ async def begin_update_tags( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_04_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates a managed cluster with the specified tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2020_04_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_04_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, @@ -871,64 +963,54 @@ async def begin_update_tags( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -936,10 +1018,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -949,23 +1030,17 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: + async def begin_delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Deletes a managed cluster. Deletes the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -977,85 +1052,83 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterServicePrincipalProfile, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterServicePrincipalProfile") - request = build_reset_service_principal_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_service_principal_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_service_principal_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_service_principal_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1063,10 +1136,9 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1076,29 +1148,106 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist if cls: return cls(pipeline_response, None, {}) - _reset_service_principal_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore - + _reset_service_principal_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore - @distributed_trace_async - async def begin_reset_service_principal_profile( # pylint: disable=inconsistent-return-statements + @overload + async def begin_reset_service_principal_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterServicePrincipalProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: """Reset Service Principal Profile of a managed cluster. Update the service principal Profile for a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a - Managed Cluster. + Managed Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2020_04_01.models.ManagedClusterServicePrincipalProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset Service Principal Profile of a managed cluster. + + Update the service principal Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a + Managed Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset Service Principal Profile of a managed cluster. + + Update the service principal Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a + Managed Cluster. Is either a model type or a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2020_04_01.models.ManagedClusterServicePrincipalProfile or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -1109,20 +1258,17 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1130,67 +1276,68 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_service_principal_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + begin_reset_service_principal_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterAADProfile, + parameters: Union[_models.ManagedClusterAADProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterAADProfile") - request = build_reset_aad_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_aad_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_aad_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_aad_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1198,10 +1345,9 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1211,28 +1357,69 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta if cls: return cls(pipeline_response, None, {}) - _reset_aad_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - + _reset_aad_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - @distributed_trace_async - async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements + @overload + async def begin_reset_aad_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterAADProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: """Reset AAD Profile of a managed cluster. Update the AAD Profile for a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed - Cluster. + Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2020_04_01.models.ManagedClusterAADProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset AAD Profile of a managed cluster. + + Update the AAD Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed + Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -1243,20 +1430,53 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterAADProfile, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset AAD Profile of a managed cluster. + + Update the AAD Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed + Cluster. Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2020_04_01.models.ManagedClusterAADProfile or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1264,62 +1484,52 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_aad_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + begin_reset_aad_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_rotate_cluster_certificates_request_initial( - subscription_id=self._config.subscription_id, + request = build_rotate_cluster_certificates_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._rotate_cluster_certificates_initial.metadata['url'], + template_url=self._rotate_cluster_certificates_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1327,10 +1537,9 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1340,23 +1549,19 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- if cls: return cls(pipeline_response, None, {}) - _rotate_cluster_certificates_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore - + _rotate_cluster_certificates_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore @distributed_trace_async - async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + async def begin_rotate_cluster_certificates( + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Rotate certificates of a managed cluster. Rotate certificates of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1368,52 +1573,45 @@ async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-ret Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._rotate_cluster_certificates_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_rotate_cluster_certificates.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore + begin_rotate_cluster_certificates.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/aio/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/aio/operations/_operations.py index 75d4196ea8f7..d6e33a35c2a3 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/aio/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/aio/operations/_operations.py @@ -7,9 +7,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,9 +27,11 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._operations import build_list_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class Operations: """ .. warning:: @@ -42,36 +51,31 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.OperationListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.OperationValue"]: """Gets a list of compute operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationListResult or the result of cls(response) + :return: An iterator like instance of either OperationValue or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_04_01.models.OperationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_04_01.models.OperationValue] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -79,13 +83,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -101,10 +103,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -114,8 +114,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.ContainerService/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ContainerService/operations"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/aio/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/aio/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/aio/operations/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/aio/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/models/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/models/__init__.py index 56476cc49a88..e8826af0c989 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/models/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/models/__init__.py @@ -54,92 +54,90 @@ from ._models_py3 import TagsObject from ._models_py3 import UserAssignedIdentity - -from ._container_service_client_enums import ( - AgentPoolMode, - AgentPoolType, - ContainerServiceStorageProfileTypes, - ContainerServiceVMSizeTypes, - Count, - LoadBalancerSku, - ManagedClusterSKUName, - ManagedClusterSKUTier, - NetworkMode, - NetworkPlugin, - NetworkPolicy, - OSType, - OutboundType, - ResourceIdentityType, - ScaleSetEvictionPolicy, - ScaleSetPriority, -) +from ._container_service_client_enums import AgentPoolMode +from ._container_service_client_enums import AgentPoolType +from ._container_service_client_enums import ContainerServiceStorageProfileTypes +from ._container_service_client_enums import ContainerServiceVMSizeTypes +from ._container_service_client_enums import Count +from ._container_service_client_enums import LoadBalancerSku +from ._container_service_client_enums import ManagedClusterSKUName +from ._container_service_client_enums import ManagedClusterSKUTier +from ._container_service_client_enums import NetworkMode +from ._container_service_client_enums import NetworkPlugin +from ._container_service_client_enums import NetworkPolicy +from ._container_service_client_enums import OSType +from ._container_service_client_enums import OutboundType +from ._container_service_client_enums import ResourceIdentityType +from ._container_service_client_enums import ScaleSetEvictionPolicy +from ._container_service_client_enums import ScaleSetPriority from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'AgentPool', - 'AgentPoolAvailableVersions', - 'AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem', - 'AgentPoolListResult', - 'AgentPoolUpgradeProfile', - 'AgentPoolUpgradeProfilePropertiesUpgradesItem', - 'AgentPoolUpgradeSettings', - 'BaseManagedCluster', - 'CloudErrorBody', - 'ContainerServiceDiagnosticsProfile', - 'ContainerServiceLinuxProfile', - 'ContainerServiceMasterProfile', - 'ContainerServiceNetworkProfile', - 'ContainerServiceSshConfiguration', - 'ContainerServiceSshPublicKey', - 'ContainerServiceVMDiagnostics', - 'CredentialResult', - 'CredentialResults', - 'ManagedCluster', - 'ManagedClusterAADProfile', - 'ManagedClusterAPIServerAccessProfile', - 'ManagedClusterAccessProfile', - 'ManagedClusterAddonProfile', - 'ManagedClusterAddonProfileIdentity', - 'ManagedClusterAgentPoolProfile', - 'ManagedClusterAgentPoolProfileProperties', - 'ManagedClusterIdentity', - 'ManagedClusterListResult', - 'ManagedClusterLoadBalancerProfile', - 'ManagedClusterLoadBalancerProfileManagedOutboundIPs', - 'ManagedClusterLoadBalancerProfileOutboundIPPrefixes', - 'ManagedClusterLoadBalancerProfileOutboundIPs', - 'ManagedClusterPoolUpgradeProfile', - 'ManagedClusterPoolUpgradeProfileUpgradesItem', - 'ManagedClusterPropertiesAutoScalerProfile', - 'ManagedClusterPropertiesIdentityProfileValue', - 'ManagedClusterSKU', - 'ManagedClusterServicePrincipalProfile', - 'ManagedClusterUpgradeProfile', - 'ManagedClusterWindowsProfile', - 'OperationListResult', - 'OperationValue', - 'Resource', - 'ResourceReference', - 'SubResource', - 'TagsObject', - 'UserAssignedIdentity', - 'AgentPoolMode', - 'AgentPoolType', - 'ContainerServiceStorageProfileTypes', - 'ContainerServiceVMSizeTypes', - 'Count', - 'LoadBalancerSku', - 'ManagedClusterSKUName', - 'ManagedClusterSKUTier', - 'NetworkMode', - 'NetworkPlugin', - 'NetworkPolicy', - 'OSType', - 'OutboundType', - 'ResourceIdentityType', - 'ScaleSetEvictionPolicy', - 'ScaleSetPriority', + "AgentPool", + "AgentPoolAvailableVersions", + "AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem", + "AgentPoolListResult", + "AgentPoolUpgradeProfile", + "AgentPoolUpgradeProfilePropertiesUpgradesItem", + "AgentPoolUpgradeSettings", + "BaseManagedCluster", + "CloudErrorBody", + "ContainerServiceDiagnosticsProfile", + "ContainerServiceLinuxProfile", + "ContainerServiceMasterProfile", + "ContainerServiceNetworkProfile", + "ContainerServiceSshConfiguration", + "ContainerServiceSshPublicKey", + "ContainerServiceVMDiagnostics", + "CredentialResult", + "CredentialResults", + "ManagedCluster", + "ManagedClusterAADProfile", + "ManagedClusterAPIServerAccessProfile", + "ManagedClusterAccessProfile", + "ManagedClusterAddonProfile", + "ManagedClusterAddonProfileIdentity", + "ManagedClusterAgentPoolProfile", + "ManagedClusterAgentPoolProfileProperties", + "ManagedClusterIdentity", + "ManagedClusterListResult", + "ManagedClusterLoadBalancerProfile", + "ManagedClusterLoadBalancerProfileManagedOutboundIPs", + "ManagedClusterLoadBalancerProfileOutboundIPPrefixes", + "ManagedClusterLoadBalancerProfileOutboundIPs", + "ManagedClusterPoolUpgradeProfile", + "ManagedClusterPoolUpgradeProfileUpgradesItem", + "ManagedClusterPropertiesAutoScalerProfile", + "ManagedClusterPropertiesIdentityProfileValue", + "ManagedClusterSKU", + "ManagedClusterServicePrincipalProfile", + "ManagedClusterUpgradeProfile", + "ManagedClusterWindowsProfile", + "OperationListResult", + "OperationValue", + "Resource", + "ResourceReference", + "SubResource", + "TagsObject", + "UserAssignedIdentity", + "AgentPoolMode", + "AgentPoolType", + "ContainerServiceStorageProfileTypes", + "ContainerServiceVMSizeTypes", + "Count", + "LoadBalancerSku", + "ManagedClusterSKUName", + "ManagedClusterSKUTier", + "NetworkMode", + "NetworkPlugin", + "NetworkPolicy", + "OSType", + "OutboundType", + "ResourceIdentityType", + "ScaleSetEvictionPolicy", + "ScaleSetPriority", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/models/_container_service_client_enums.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/models/_container_service_client_enums.py index 2d070cb2ffce..417de9577b77 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/models/_container_service_client_enums.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/models/_container_service_client_enums.py @@ -11,19 +11,19 @@ class AgentPoolMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """AgentPoolMode represents mode of an agent pool. - """ + """AgentPoolMode represents mode of an agent pool.""" SYSTEM = "System" USER = "User" + class AgentPoolType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """AgentPoolType represents types of an agent pool. - """ + """AgentPoolType represents types of an agent pool.""" VIRTUAL_MACHINE_SCALE_SETS = "VirtualMachineScaleSets" AVAILABILITY_SET = "AvailabilitySet" + class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the orchestrator choice. @@ -32,9 +32,9 @@ class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEn STORAGE_ACCOUNT = "StorageAccount" MANAGED_DISKS = "ManagedDisks" + class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Size of agent VMs. - """ + """Size of agent VMs.""" STANDARD_A1 = "Standard_A1" STANDARD_A10 = "Standard_A10" @@ -211,6 +211,7 @@ class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): STANDARD_NV24 = "Standard_NV24" STANDARD_NV6 = "Standard_NV6" + class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): """Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, and 5. The default value is 1. @@ -220,61 +221,62 @@ class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): THREE = 3 FIVE = 5 + class LoadBalancerSku(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The load balancer sku for the managed cluster. - """ + """The load balancer sku for the managed cluster.""" STANDARD = "standard" BASIC = "basic" + class ManagedClusterSKUName(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Name of a managed cluster SKU. - """ + """Name of a managed cluster SKU.""" BASIC = "Basic" + class ManagedClusterSKUTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Tier of a managed cluster SKU. - """ + """Tier of a managed cluster SKU.""" PAID = "Paid" FREE = "Free" + class NetworkMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Network mode used for building Kubernetes network. - """ + """Network mode used for building Kubernetes network.""" TRANSPARENT = "transparent" BRIDGE = "bridge" + class NetworkPlugin(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Network plugin used for building Kubernetes network. - """ + """Network plugin used for building Kubernetes network.""" AZURE = "azure" KUBENET = "kubenet" + class NetworkPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Network policy used for building Kubernetes network. - """ + """Network policy used for building Kubernetes network.""" CALICO = "calico" AZURE = "azure" + class OSType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """OsType to be used to specify os type. Choose from Linux and Windows. Default to Linux. - """ + """OsType to be used to specify os type. Choose from Linux and Windows. Default to Linux.""" LINUX = "Linux" WINDOWS = "Windows" + class OutboundType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The outbound (egress) routing method. - """ + """The outbound (egress) routing method.""" LOAD_BALANCER = "loadBalancer" USER_DEFINED_ROUTING = "userDefinedRouting" + class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of identity used for the managed cluster. Type 'SystemAssigned' will use an implicitly created identity in master components and an auto-created user assigned identity in MC_ @@ -285,6 +287,7 @@ class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): SYSTEM_ASSIGNED = "SystemAssigned" NONE = "None" + class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ScaleSetEvictionPolicy to be used to specify eviction policy for Spot virtual machine scale set. Default to Delete. @@ -293,9 +296,9 @@ class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): DELETE = "Delete" DEALLOCATE = "Deallocate" + class ScaleSetPriority(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """ScaleSetPriority to be used to specify virtual machine scale set priority. Default to regular. - """ + """ScaleSetPriority to be used to specify virtual machine scale set priority. Default to regular.""" SPOT = "Spot" REGULAR = "Regular" diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/models/_models_py3.py index 74f512963268..834ad4d9fc91 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/models/_models_py3.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/models/_models_py3.py @@ -1,4 +1,5 @@ # coding=utf-8 +# pylint: disable=too-many-lines # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -8,14 +9,14 @@ from typing import Dict, List, Optional, TYPE_CHECKING, Union -import msrest.serialization +from ... import _serialization if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - import __init__ as _models + from .. import models as _models -class SubResource(msrest.serialization.Model): +class SubResource(_serialization.Model): """Reference to another subresource. Variables are only populated by the server, and will be ignored when sending a request. @@ -30,30 +31,26 @@ class SubResource(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(SubResource, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.id = None self.name = None self.type = None -class AgentPool(SubResource): +class AgentPool(SubResource): # pylint: disable=too-many-instance-attributes """Agent Pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -106,7 +103,7 @@ class AgentPool(SubResource): "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :vartype vm_size: str or ~azure.mgmt.containerservice.v2020_04_01.models.ContainerServiceVMSizeTypes :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine @@ -118,7 +115,7 @@ class AgentPool(SubResource): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Known values are: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux" and "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2020_04_01.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -127,10 +124,11 @@ class AgentPool(SubResource): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar type_properties_type: AgentPoolType represents types of an agent pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :vartype type_properties_type: str or ~azure.mgmt.containerservice.v2020_04_01.models.AgentPoolType - :ivar mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", "User". + :ivar mode: AgentPoolMode represents mode of an agent pool. Known values are: "System" and + "User". :vartype mode: str or ~azure.mgmt.containerservice.v2020_04_01.models.AgentPoolMode :ivar orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -149,20 +147,19 @@ class AgentPool(SubResource): :ivar enable_node_public_ip: Enable public IP for nodes. :vartype enable_node_public_ip: bool :ivar scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Known values are: "Spot", "Regular". Default value: "Regular". + priority. Default to regular. Known values are: "Spot" and "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_04_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy - for Spot virtual machine scale set. Default to Delete. Known values are: "Delete", - "Deallocate". Default value: "Delete". + for Spot virtual machine scale set. Default to Delete. Known values are: "Delete" and + "Deallocate". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_04_01.models.ScaleSetEvictionPolicy :ivar spot_max_price: SpotMaxPrice to be used to specify the maximum price you are willing to pay in US Dollars. Possible values are any decimal value greater than zero or -1 which indicates default price to be up-to on-demand. :vartype spot_max_price: float - :ivar tags: A set of tags. Agent pool tags to be persisted on the agent pool virtual machine - scale set. + :ivar tags: Agent pool tags to be persisted on the agent pool virtual machine scale set. :vartype tags: dict[str, str] :ivar node_labels: Agent pool node labels to be persisted across all nodes in agent pool. :vartype node_labels: dict[str, str] @@ -172,43 +169,43 @@ class AgentPool(SubResource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'os_disk_size_gb': {'maximum': 1023, 'minimum': 0}, - 'provisioning_state': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "os_disk_size_gb": {"maximum": 1023, "minimum": 0}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'count': {'key': 'properties.count', 'type': 'int'}, - 'vm_size': {'key': 'properties.vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'properties.osDiskSizeGB', 'type': 'int'}, - 'vnet_subnet_id': {'key': 'properties.vnetSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'properties.maxPods', 'type': 'int'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'max_count': {'key': 'properties.maxCount', 'type': 'int'}, - 'min_count': {'key': 'properties.minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'properties.enableAutoScaling', 'type': 'bool'}, - 'type_properties_type': {'key': 'properties.type', 'type': 'str'}, - 'mode': {'key': 'properties.mode', 'type': 'str'}, - 'orchestrator_version': {'key': 'properties.orchestratorVersion', 'type': 'str'}, - 'node_image_version': {'key': 'properties.nodeImageVersion', 'type': 'str'}, - 'upgrade_settings': {'key': 'properties.upgradeSettings', 'type': 'AgentPoolUpgradeSettings'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'availability_zones': {'key': 'properties.availabilityZones', 'type': '[str]'}, - 'enable_node_public_ip': {'key': 'properties.enableNodePublicIP', 'type': 'bool'}, - 'scale_set_priority': {'key': 'properties.scaleSetPriority', 'type': 'str'}, - 'scale_set_eviction_policy': {'key': 'properties.scaleSetEvictionPolicy', 'type': 'str'}, - 'spot_max_price': {'key': 'properties.spotMaxPrice', 'type': 'float'}, - 'tags': {'key': 'properties.tags', 'type': '{str}'}, - 'node_labels': {'key': 'properties.nodeLabels', 'type': '{str}'}, - 'node_taints': {'key': 'properties.nodeTaints', 'type': '[str]'}, - } - - def __init__( + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "count": {"key": "properties.count", "type": "int"}, + "vm_size": {"key": "properties.vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "properties.osDiskSizeGB", "type": "int"}, + "vnet_subnet_id": {"key": "properties.vnetSubnetID", "type": "str"}, + "max_pods": {"key": "properties.maxPods", "type": "int"}, + "os_type": {"key": "properties.osType", "type": "str"}, + "max_count": {"key": "properties.maxCount", "type": "int"}, + "min_count": {"key": "properties.minCount", "type": "int"}, + "enable_auto_scaling": {"key": "properties.enableAutoScaling", "type": "bool"}, + "type_properties_type": {"key": "properties.type", "type": "str"}, + "mode": {"key": "properties.mode", "type": "str"}, + "orchestrator_version": {"key": "properties.orchestratorVersion", "type": "str"}, + "node_image_version": {"key": "properties.nodeImageVersion", "type": "str"}, + "upgrade_settings": {"key": "properties.upgradeSettings", "type": "AgentPoolUpgradeSettings"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "availability_zones": {"key": "properties.availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "properties.enableNodePublicIP", "type": "bool"}, + "scale_set_priority": {"key": "properties.scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "properties.scaleSetEvictionPolicy", "type": "str"}, + "spot_max_price": {"key": "properties.spotMaxPrice", "type": "float"}, + "tags": {"key": "properties.tags", "type": "{str}"}, + "node_labels": {"key": "properties.nodeLabels", "type": "{str}"}, + "node_taints": {"key": "properties.nodeTaints", "type": "[str]"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, count: Optional[int] = None, @@ -216,7 +213,7 @@ def __init__( os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, @@ -227,9 +224,9 @@ def __init__( upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, - scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", - spot_max_price: Optional[float] = -1, + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", + spot_max_price: float = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, @@ -277,7 +274,7 @@ def __init__( "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :paramtype vm_size: str or ~azure.mgmt.containerservice.v2020_04_01.models.ContainerServiceVMSizeTypes :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every @@ -289,7 +286,7 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux" and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2020_04_01.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -298,10 +295,10 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword type_properties_type: AgentPoolType represents types of an agent pool. Known values - are: "VirtualMachineScaleSets", "AvailabilitySet". + are: "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type_properties_type: str or ~azure.mgmt.containerservice.v2020_04_01.models.AgentPoolType - :keyword mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", + :keyword mode: AgentPoolMode represents mode of an agent pool. Known values are: "System" and "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2020_04_01.models.AgentPoolMode :keyword orchestrator_version: Version of orchestrator specified when creating the managed @@ -318,20 +315,19 @@ def __init__( :keyword enable_node_public_ip: Enable public IP for nodes. :paramtype enable_node_public_ip: bool :keyword scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Known values are: "Spot", "Regular". Default value: "Regular". + priority. Default to regular. Known values are: "Spot" and "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_04_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction - policy for Spot virtual machine scale set. Default to Delete. Known values are: "Delete", - "Deallocate". Default value: "Delete". + policy for Spot virtual machine scale set. Default to Delete. Known values are: "Delete" and + "Deallocate". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_04_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: SpotMaxPrice to be used to specify the maximum price you are willing to pay in US Dollars. Possible values are any decimal value greater than zero or -1 which indicates default price to be up-to on-demand. :paramtype spot_max_price: float - :keyword tags: A set of tags. Agent pool tags to be persisted on the agent pool virtual machine - scale set. + :keyword tags: Agent pool tags to be persisted on the agent pool virtual machine scale set. :paramtype tags: dict[str, str] :keyword node_labels: Agent pool node labels to be persisted across all nodes in agent pool. :paramtype node_labels: dict[str, str] @@ -339,7 +335,7 @@ def __init__( key=value:NoSchedule. :paramtype node_taints: list[str] """ - super(AgentPool, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.vm_size = vm_size self.os_disk_size_gb = os_disk_size_gb @@ -365,7 +361,7 @@ def __init__( self.node_taints = node_taints -class AgentPoolAvailableVersions(msrest.serialization.Model): +class AgentPoolAvailableVersions(_serialization.Model): """The list of available versions for an agent pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -382,16 +378,19 @@ class AgentPoolAvailableVersions(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'agent_pool_versions': {'key': 'properties.agentPoolVersions', 'type': '[AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "agent_pool_versions": { + "key": "properties.agentPoolVersions", + "type": "[AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem]", + }, } def __init__( @@ -405,14 +404,14 @@ def __init__( :paramtype agent_pool_versions: list[~azure.mgmt.containerservice.v2020_04_01.models.AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem] """ - super(AgentPoolAvailableVersions, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None self.agent_pool_versions = agent_pool_versions -class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(msrest.serialization.Model): +class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(_serialization.Model): """AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem. :ivar default: Whether this version is the default agent pool version. @@ -424,9 +423,9 @@ class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(msrest.serializa """ _attribute_map = { - 'default': {'key': 'default', 'type': 'bool'}, - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "default": {"key": "default", "type": "bool"}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } def __init__( @@ -445,13 +444,13 @@ def __init__( :keyword is_preview: Whether Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.default = default self.kubernetes_version = kubernetes_version self.is_preview = is_preview -class AgentPoolListResult(msrest.serialization.Model): +class AgentPoolListResult(_serialization.Model): """The response from the List Agent Pools operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -463,30 +462,25 @@ class AgentPoolListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[AgentPool]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[AgentPool]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.AgentPool"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.AgentPool"]] = None, **kwargs): """ :keyword value: The list of agent pools. :paramtype value: list[~azure.mgmt.containerservice.v2020_04_01.models.AgentPool] """ - super(AgentPoolListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class AgentPoolUpgradeProfile(msrest.serialization.Model): +class AgentPoolUpgradeProfile(_serialization.Model): """The list of available upgrades for an agent pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -499,10 +493,10 @@ class AgentPoolUpgradeProfile(msrest.serialization.Model): :vartype name: str :ivar type: Type of the agent pool upgrade profile. :vartype type: str - :ivar kubernetes_version: Required. Kubernetes version (major, minor, patch). + :ivar kubernetes_version: Kubernetes version (major, minor, patch). Required. :vartype kubernetes_version: str - :ivar os_type: Required. OsType to be used to specify os type. Choose from Linux and Windows. - Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to + Linux. Known values are: "Linux" and "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2020_04_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -513,21 +507,21 @@ class AgentPoolUpgradeProfile(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kubernetes_version': {'required': True}, - 'os_type': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "kubernetes_version": {"required": True}, + "os_type": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'kubernetes_version': {'key': 'properties.kubernetesVersion', 'type': 'str'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'upgrades': {'key': 'properties.upgrades', 'type': '[AgentPoolUpgradeProfilePropertiesUpgradesItem]'}, - 'latest_node_image_version': {'key': 'properties.latestNodeImageVersion', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "os_type": {"key": "properties.osType", "type": "str"}, + "upgrades": {"key": "properties.upgrades", "type": "[AgentPoolUpgradeProfilePropertiesUpgradesItem]"}, + "latest_node_image_version": {"key": "properties.latestNodeImageVersion", "type": "str"}, } def __init__( @@ -540,10 +534,10 @@ def __init__( **kwargs ): """ - :keyword kubernetes_version: Required. Kubernetes version (major, minor, patch). + :keyword kubernetes_version: Kubernetes version (major, minor, patch). Required. :paramtype kubernetes_version: str - :keyword os_type: Required. OsType to be used to specify os type. Choose from Linux and - Windows. Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default + to Linux. Known values are: "Linux" and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2020_04_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: @@ -552,7 +546,7 @@ def __init__( image version. :paramtype latest_node_image_version: str """ - super(AgentPoolUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -562,7 +556,7 @@ def __init__( self.latest_node_image_version = latest_node_image_version -class AgentPoolUpgradeProfilePropertiesUpgradesItem(msrest.serialization.Model): +class AgentPoolUpgradeProfilePropertiesUpgradesItem(_serialization.Model): """AgentPoolUpgradeProfilePropertiesUpgradesItem. :ivar kubernetes_version: Kubernetes version (major, minor, patch). @@ -572,29 +566,23 @@ class AgentPoolUpgradeProfilePropertiesUpgradesItem(msrest.serialization.Model): """ _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } - def __init__( - self, - *, - kubernetes_version: Optional[str] = None, - is_preview: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, kubernetes_version: Optional[str] = None, is_preview: Optional[bool] = None, **kwargs): """ :keyword kubernetes_version: Kubernetes version (major, minor, patch). :paramtype kubernetes_version: str :keyword is_preview: Whether Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(AgentPoolUpgradeProfilePropertiesUpgradesItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.is_preview = is_preview -class AgentPoolUpgradeSettings(msrest.serialization.Model): +class AgentPoolUpgradeSettings(_serialization.Model): """Settings for upgrading an agentpool. :ivar max_surge: Count or percentage of additional nodes to be added during upgrade. If empty @@ -603,25 +591,20 @@ class AgentPoolUpgradeSettings(msrest.serialization.Model): """ _attribute_map = { - 'max_surge': {'key': 'maxSurge', 'type': 'str'}, + "max_surge": {"key": "maxSurge", "type": "str"}, } - def __init__( - self, - *, - max_surge: Optional[str] = None, - **kwargs - ): + def __init__(self, *, max_surge: Optional[str] = None, **kwargs): """ :keyword max_surge: Count or percentage of additional nodes to be added during upgrade. If empty uses AKS default. :paramtype max_surge: str """ - super(AgentPoolUpgradeSettings, self).__init__(**kwargs) + super().__init__(**kwargs) self.max_surge = max_surge -class BaseManagedCluster(msrest.serialization.Model): +class BaseManagedCluster(_serialization.Model): # pylint: disable=too-many-instance-attributes """BaseManagedCluster. Variables are only populated by the server, and will be ignored when sending a request. @@ -685,34 +668,46 @@ class BaseManagedCluster(msrest.serialization.Model): """ _validation = { - 'provisioning_state': {'readonly': True}, - 'max_agent_pools': {'readonly': True}, - 'fqdn': {'readonly': True}, - 'private_fqdn': {'readonly': True}, + "provisioning_state": {"readonly": True}, + "max_agent_pools": {"readonly": True}, + "fqdn": {"readonly": True}, + "private_fqdn": {"readonly": True}, } _attribute_map = { - 'identity': {'key': 'identity', 'type': 'ManagedClusterIdentity'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'max_agent_pools': {'key': 'properties.maxAgentPools', 'type': 'int'}, - 'kubernetes_version': {'key': 'properties.kubernetesVersion', 'type': 'str'}, - 'dns_prefix': {'key': 'properties.dnsPrefix', 'type': 'str'}, - 'fqdn': {'key': 'properties.fqdn', 'type': 'str'}, - 'private_fqdn': {'key': 'properties.privateFQDN', 'type': 'str'}, - 'agent_pool_profiles': {'key': 'properties.agentPoolProfiles', 'type': '[ManagedClusterAgentPoolProfile]'}, - 'linux_profile': {'key': 'properties.linuxProfile', 'type': 'ContainerServiceLinuxProfile'}, - 'windows_profile': {'key': 'properties.windowsProfile', 'type': 'ManagedClusterWindowsProfile'}, - 'service_principal_profile': {'key': 'properties.servicePrincipalProfile', 'type': 'ManagedClusterServicePrincipalProfile'}, - 'addon_profiles': {'key': 'properties.addonProfiles', 'type': '{ManagedClusterAddonProfile}'}, - 'node_resource_group': {'key': 'properties.nodeResourceGroup', 'type': 'str'}, - 'enable_rbac': {'key': 'properties.enableRBAC', 'type': 'bool'}, - 'enable_pod_security_policy': {'key': 'properties.enablePodSecurityPolicy', 'type': 'bool'}, - 'network_profile': {'key': 'properties.networkProfile', 'type': 'ContainerServiceNetworkProfile'}, - 'aad_profile': {'key': 'properties.aadProfile', 'type': 'ManagedClusterAADProfile'}, - 'auto_scaler_profile': {'key': 'properties.autoScalerProfile', 'type': 'ManagedClusterPropertiesAutoScalerProfile'}, - 'api_server_access_profile': {'key': 'properties.apiServerAccessProfile', 'type': 'ManagedClusterAPIServerAccessProfile'}, - 'disk_encryption_set_id': {'key': 'properties.diskEncryptionSetID', 'type': 'str'}, - 'identity_profile': {'key': 'properties.identityProfile', 'type': '{ManagedClusterPropertiesIdentityProfileValue}'}, + "identity": {"key": "identity", "type": "ManagedClusterIdentity"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "max_agent_pools": {"key": "properties.maxAgentPools", "type": "int"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "dns_prefix": {"key": "properties.dnsPrefix", "type": "str"}, + "fqdn": {"key": "properties.fqdn", "type": "str"}, + "private_fqdn": {"key": "properties.privateFQDN", "type": "str"}, + "agent_pool_profiles": {"key": "properties.agentPoolProfiles", "type": "[ManagedClusterAgentPoolProfile]"}, + "linux_profile": {"key": "properties.linuxProfile", "type": "ContainerServiceLinuxProfile"}, + "windows_profile": {"key": "properties.windowsProfile", "type": "ManagedClusterWindowsProfile"}, + "service_principal_profile": { + "key": "properties.servicePrincipalProfile", + "type": "ManagedClusterServicePrincipalProfile", + }, + "addon_profiles": {"key": "properties.addonProfiles", "type": "{ManagedClusterAddonProfile}"}, + "node_resource_group": {"key": "properties.nodeResourceGroup", "type": "str"}, + "enable_rbac": {"key": "properties.enableRBAC", "type": "bool"}, + "enable_pod_security_policy": {"key": "properties.enablePodSecurityPolicy", "type": "bool"}, + "network_profile": {"key": "properties.networkProfile", "type": "ContainerServiceNetworkProfile"}, + "aad_profile": {"key": "properties.aadProfile", "type": "ManagedClusterAADProfile"}, + "auto_scaler_profile": { + "key": "properties.autoScalerProfile", + "type": "ManagedClusterPropertiesAutoScalerProfile", + }, + "api_server_access_profile": { + "key": "properties.apiServerAccessProfile", + "type": "ManagedClusterAPIServerAccessProfile", + }, + "disk_encryption_set_id": {"key": "properties.diskEncryptionSetID", "type": "str"}, + "identity_profile": { + "key": "properties.identityProfile", + "type": "{ManagedClusterPropertiesIdentityProfileValue}", + }, } def __init__( @@ -787,7 +782,7 @@ def __init__( :paramtype identity_profile: dict[str, ~azure.mgmt.containerservice.v2020_04_01.models.ManagedClusterPropertiesIdentityProfileValue] """ - super(BaseManagedCluster, self).__init__(**kwargs) + super().__init__(**kwargs) self.identity = identity self.provisioning_state = None self.max_agent_pools = None @@ -811,7 +806,7 @@ def __init__( self.identity_profile = identity_profile -class CloudErrorBody(msrest.serialization.Model): +class CloudErrorBody(_serialization.Model): """An error response from the Container service. :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed @@ -828,10 +823,10 @@ class CloudErrorBody(msrest.serialization.Model): """ _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[CloudErrorBody]"}, } def __init__( @@ -856,87 +851,76 @@ def __init__( :keyword details: A list of additional details about the error. :paramtype details: list[~azure.mgmt.containerservice.v2020_04_01.models.CloudErrorBody] """ - super(CloudErrorBody, self).__init__(**kwargs) + super().__init__(**kwargs) self.code = code self.message = message self.target = target self.details = details -class ContainerServiceDiagnosticsProfile(msrest.serialization.Model): +class ContainerServiceDiagnosticsProfile(_serialization.Model): """Profile for diagnostics on the container service cluster. All required parameters must be populated in order to send to Azure. - :ivar vm_diagnostics: Required. Profile for diagnostics on the container service VMs. + :ivar vm_diagnostics: Profile for diagnostics on the container service VMs. Required. :vartype vm_diagnostics: ~azure.mgmt.containerservice.v2020_04_01.models.ContainerServiceVMDiagnostics """ _validation = { - 'vm_diagnostics': {'required': True}, + "vm_diagnostics": {"required": True}, } _attribute_map = { - 'vm_diagnostics': {'key': 'vmDiagnostics', 'type': 'ContainerServiceVMDiagnostics'}, + "vm_diagnostics": {"key": "vmDiagnostics", "type": "ContainerServiceVMDiagnostics"}, } - def __init__( - self, - *, - vm_diagnostics: "_models.ContainerServiceVMDiagnostics", - **kwargs - ): + def __init__(self, *, vm_diagnostics: "_models.ContainerServiceVMDiagnostics", **kwargs): """ - :keyword vm_diagnostics: Required. Profile for diagnostics on the container service VMs. + :keyword vm_diagnostics: Profile for diagnostics on the container service VMs. Required. :paramtype vm_diagnostics: ~azure.mgmt.containerservice.v2020_04_01.models.ContainerServiceVMDiagnostics """ - super(ContainerServiceDiagnosticsProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.vm_diagnostics = vm_diagnostics -class ContainerServiceLinuxProfile(msrest.serialization.Model): +class ContainerServiceLinuxProfile(_serialization.Model): """Profile for Linux VMs in the container service cluster. All required parameters must be populated in order to send to Azure. - :ivar admin_username: Required. The administrator username to use for Linux VMs. + :ivar admin_username: The administrator username to use for Linux VMs. Required. :vartype admin_username: str - :ivar ssh: Required. SSH configuration for Linux-based VMs running on Azure. + :ivar ssh: SSH configuration for Linux-based VMs running on Azure. Required. :vartype ssh: ~azure.mgmt.containerservice.v2020_04_01.models.ContainerServiceSshConfiguration """ _validation = { - 'admin_username': {'required': True, 'pattern': r'^[A-Za-z][-A-Za-z0-9_]*$'}, - 'ssh': {'required': True}, + "admin_username": {"required": True, "pattern": r"^[A-Za-z][-A-Za-z0-9_]*$"}, + "ssh": {"required": True}, } _attribute_map = { - 'admin_username': {'key': 'adminUsername', 'type': 'str'}, - 'ssh': {'key': 'ssh', 'type': 'ContainerServiceSshConfiguration'}, + "admin_username": {"key": "adminUsername", "type": "str"}, + "ssh": {"key": "ssh", "type": "ContainerServiceSshConfiguration"}, } - def __init__( - self, - *, - admin_username: str, - ssh: "_models.ContainerServiceSshConfiguration", - **kwargs - ): + def __init__(self, *, admin_username: str, ssh: "_models.ContainerServiceSshConfiguration", **kwargs): """ - :keyword admin_username: Required. The administrator username to use for Linux VMs. + :keyword admin_username: The administrator username to use for Linux VMs. Required. :paramtype admin_username: str - :keyword ssh: Required. SSH configuration for Linux-based VMs running on Azure. + :keyword ssh: SSH configuration for Linux-based VMs running on Azure. Required. :paramtype ssh: ~azure.mgmt.containerservice.v2020_04_01.models.ContainerServiceSshConfiguration """ - super(ContainerServiceLinuxProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.admin_username = admin_username self.ssh = ssh -class ContainerServiceMasterProfile(msrest.serialization.Model): +class ContainerServiceMasterProfile(_serialization.Model): """Profile for the container service master. Variables are only populated by the server, and will be ignored when sending a request. @@ -944,11 +928,11 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar count: Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, - and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". + and 5. The default value is 1. Known values are: 1, 3, and 5. :vartype count: int or ~azure.mgmt.containerservice.v2020_04_01.models.Count - :ivar dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. + :ivar dns_prefix: DNS prefix to be used to create the FQDN for the master pool. Required. :vartype dns_prefix: str - :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + :ivar vm_size: Size of agent VMs. Required. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -985,7 +969,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :vartype vm_size: str or ~azure.mgmt.containerservice.v2020_04_01.models.ContainerServiceVMSizeTypes :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine @@ -999,7 +983,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): :vartype first_consecutive_static_ip: str :ivar storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount" and "ManagedDisks". :vartype storage_profile: str or ~azure.mgmt.containerservice.v2020_04_01.models.ContainerServiceStorageProfileTypes :ivar fqdn: FQDN for the master pool. @@ -1007,21 +991,21 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): """ _validation = { - 'dns_prefix': {'required': True}, - 'vm_size': {'required': True}, - 'os_disk_size_gb': {'maximum': 1023, 'minimum': 0}, - 'fqdn': {'readonly': True}, + "dns_prefix": {"required": True}, + "vm_size": {"required": True}, + "os_disk_size_gb": {"maximum": 1023, "minimum": 0}, + "fqdn": {"readonly": True}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'dns_prefix': {'key': 'dnsPrefix', 'type': 'str'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'first_consecutive_static_ip': {'key': 'firstConsecutiveStaticIP', 'type': 'str'}, - 'storage_profile': {'key': 'storageProfile', 'type': 'str'}, - 'fqdn': {'key': 'fqdn', 'type': 'str'}, + "count": {"key": "count", "type": "int"}, + "dns_prefix": {"key": "dnsPrefix", "type": "str"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "first_consecutive_static_ip": {"key": "firstConsecutiveStaticIP", "type": "str"}, + "storage_profile": {"key": "storageProfile", "type": "str"}, + "fqdn": {"key": "fqdn", "type": "str"}, } def __init__( @@ -1029,20 +1013,20 @@ def __init__( *, dns_prefix: str, vm_size: Union[str, "_models.ContainerServiceVMSizeTypes"], - count: Optional[Union[int, "_models.Count"]] = 1, + count: Union[int, "_models.Count"] = 1, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, - first_consecutive_static_ip: Optional[str] = "10.240.255.5", + first_consecutive_static_ip: str = "10.240.255.5", storage_profile: Optional[Union[str, "_models.ContainerServiceStorageProfileTypes"]] = None, **kwargs ): """ :keyword count: Number of masters (VMs) in the container service cluster. Allowed values are 1, - 3, and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". + 3, and 5. The default value is 1. Known values are: 1, 3, and 5. :paramtype count: int or ~azure.mgmt.containerservice.v2020_04_01.models.Count - :keyword dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. + :keyword dns_prefix: DNS prefix to be used to create the FQDN for the master pool. Required. :paramtype dns_prefix: str - :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + :keyword vm_size: Size of agent VMs. Required. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -1079,7 +1063,7 @@ def __init__( "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :paramtype vm_size: str or ~azure.mgmt.containerservice.v2020_04_01.models.ContainerServiceVMSizeTypes :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every @@ -1093,11 +1077,11 @@ def __init__( :paramtype first_consecutive_static_ip: str :keyword storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount" and "ManagedDisks". :paramtype storage_profile: str or ~azure.mgmt.containerservice.v2020_04_01.models.ContainerServiceStorageProfileTypes """ - super(ContainerServiceMasterProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.dns_prefix = dns_prefix self.vm_size = vm_size @@ -1108,17 +1092,17 @@ def __init__( self.fqdn = None -class ContainerServiceNetworkProfile(msrest.serialization.Model): +class ContainerServiceNetworkProfile(_serialization.Model): """Profile of network configuration. :ivar network_plugin: Network plugin used for building Kubernetes network. Known values are: - "azure", "kubenet". Default value: "kubenet". + "azure" and "kubenet". :vartype network_plugin: str or ~azure.mgmt.containerservice.v2020_04_01.models.NetworkPlugin :ivar network_policy: Network policy used for building Kubernetes network. Known values are: - "calico", "azure". + "calico" and "azure". :vartype network_policy: str or ~azure.mgmt.containerservice.v2020_04_01.models.NetworkPolicy :ivar network_mode: Network mode used for building Kubernetes network. Known values are: - "transparent", "bridge". + "transparent" and "bridge". :vartype network_mode: str or ~azure.mgmt.containerservice.v2020_04_01.models.NetworkMode :ivar pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :vartype pod_cidr: str @@ -1131,11 +1115,11 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): :ivar docker_bridge_cidr: A CIDR notation IP range assigned to the Docker bridge network. It must not overlap with any Subnet IP ranges or the Kubernetes service address range. :vartype docker_bridge_cidr: str - :ivar outbound_type: The outbound (egress) routing method. Known values are: "loadBalancer", - "userDefinedRouting". Default value: "loadBalancer". + :ivar outbound_type: The outbound (egress) routing method. Known values are: "loadBalancer" and + "userDefinedRouting". :vartype outbound_type: str or ~azure.mgmt.containerservice.v2020_04_01.models.OutboundType :ivar load_balancer_sku: The load balancer sku for the managed cluster. Known values are: - "standard", "basic". + "standard" and "basic". :vartype load_balancer_sku: str or ~azure.mgmt.containerservice.v2020_04_01.models.LoadBalancerSku :ivar load_balancer_profile: Profile of the cluster load balancer. @@ -1144,49 +1128,51 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): """ _validation = { - 'pod_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, - 'service_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, - 'dns_service_ip': {'pattern': r'^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$'}, - 'docker_bridge_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, + "pod_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, + "service_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, + "dns_service_ip": { + "pattern": r"^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$" + }, + "docker_bridge_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, } _attribute_map = { - 'network_plugin': {'key': 'networkPlugin', 'type': 'str'}, - 'network_policy': {'key': 'networkPolicy', 'type': 'str'}, - 'network_mode': {'key': 'networkMode', 'type': 'str'}, - 'pod_cidr': {'key': 'podCidr', 'type': 'str'}, - 'service_cidr': {'key': 'serviceCidr', 'type': 'str'}, - 'dns_service_ip': {'key': 'dnsServiceIP', 'type': 'str'}, - 'docker_bridge_cidr': {'key': 'dockerBridgeCidr', 'type': 'str'}, - 'outbound_type': {'key': 'outboundType', 'type': 'str'}, - 'load_balancer_sku': {'key': 'loadBalancerSku', 'type': 'str'}, - 'load_balancer_profile': {'key': 'loadBalancerProfile', 'type': 'ManagedClusterLoadBalancerProfile'}, + "network_plugin": {"key": "networkPlugin", "type": "str"}, + "network_policy": {"key": "networkPolicy", "type": "str"}, + "network_mode": {"key": "networkMode", "type": "str"}, + "pod_cidr": {"key": "podCidr", "type": "str"}, + "service_cidr": {"key": "serviceCidr", "type": "str"}, + "dns_service_ip": {"key": "dnsServiceIP", "type": "str"}, + "docker_bridge_cidr": {"key": "dockerBridgeCidr", "type": "str"}, + "outbound_type": {"key": "outboundType", "type": "str"}, + "load_balancer_sku": {"key": "loadBalancerSku", "type": "str"}, + "load_balancer_profile": {"key": "loadBalancerProfile", "type": "ManagedClusterLoadBalancerProfile"}, } def __init__( self, *, - network_plugin: Optional[Union[str, "_models.NetworkPlugin"]] = "kubenet", + network_plugin: Union[str, "_models.NetworkPlugin"] = "kubenet", network_policy: Optional[Union[str, "_models.NetworkPolicy"]] = None, network_mode: Optional[Union[str, "_models.NetworkMode"]] = None, - pod_cidr: Optional[str] = "10.244.0.0/16", - service_cidr: Optional[str] = "10.0.0.0/16", - dns_service_ip: Optional[str] = "10.0.0.10", - docker_bridge_cidr: Optional[str] = "172.17.0.1/16", - outbound_type: Optional[Union[str, "_models.OutboundType"]] = "loadBalancer", + pod_cidr: str = "10.244.0.0/16", + service_cidr: str = "10.0.0.0/16", + dns_service_ip: str = "10.0.0.10", + docker_bridge_cidr: str = "172.17.0.1/16", + outbound_type: Union[str, "_models.OutboundType"] = "loadBalancer", load_balancer_sku: Optional[Union[str, "_models.LoadBalancerSku"]] = None, load_balancer_profile: Optional["_models.ManagedClusterLoadBalancerProfile"] = None, **kwargs ): """ :keyword network_plugin: Network plugin used for building Kubernetes network. Known values are: - "azure", "kubenet". Default value: "kubenet". + "azure" and "kubenet". :paramtype network_plugin: str or ~azure.mgmt.containerservice.v2020_04_01.models.NetworkPlugin :keyword network_policy: Network policy used for building Kubernetes network. Known values are: - "calico", "azure". + "calico" and "azure". :paramtype network_policy: str or ~azure.mgmt.containerservice.v2020_04_01.models.NetworkPolicy :keyword network_mode: Network mode used for building Kubernetes network. Known values are: - "transparent", "bridge". + "transparent" and "bridge". :paramtype network_mode: str or ~azure.mgmt.containerservice.v2020_04_01.models.NetworkMode :keyword pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :paramtype pod_cidr: str @@ -1199,18 +1185,18 @@ def __init__( :keyword docker_bridge_cidr: A CIDR notation IP range assigned to the Docker bridge network. It must not overlap with any Subnet IP ranges or the Kubernetes service address range. :paramtype docker_bridge_cidr: str - :keyword outbound_type: The outbound (egress) routing method. Known values are: "loadBalancer", - "userDefinedRouting". Default value: "loadBalancer". + :keyword outbound_type: The outbound (egress) routing method. Known values are: "loadBalancer" + and "userDefinedRouting". :paramtype outbound_type: str or ~azure.mgmt.containerservice.v2020_04_01.models.OutboundType :keyword load_balancer_sku: The load balancer sku for the managed cluster. Known values are: - "standard", "basic". + "standard" and "basic". :paramtype load_balancer_sku: str or ~azure.mgmt.containerservice.v2020_04_01.models.LoadBalancerSku :keyword load_balancer_profile: Profile of the cluster load balancer. :paramtype load_balancer_profile: ~azure.mgmt.containerservice.v2020_04_01.models.ManagedClusterLoadBalancerProfile """ - super(ContainerServiceNetworkProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.network_plugin = network_plugin self.network_policy = network_policy self.network_mode = network_mode @@ -1223,113 +1209,98 @@ def __init__( self.load_balancer_profile = load_balancer_profile -class ContainerServiceSshConfiguration(msrest.serialization.Model): +class ContainerServiceSshConfiguration(_serialization.Model): """SSH configuration for Linux-based VMs running on Azure. All required parameters must be populated in order to send to Azure. - :ivar public_keys: Required. The list of SSH public keys used to authenticate with Linux-based - VMs. Only expect one key specified. + :ivar public_keys: The list of SSH public keys used to authenticate with Linux-based VMs. Only + expect one key specified. Required. :vartype public_keys: list[~azure.mgmt.containerservice.v2020_04_01.models.ContainerServiceSshPublicKey] """ _validation = { - 'public_keys': {'required': True}, + "public_keys": {"required": True}, } _attribute_map = { - 'public_keys': {'key': 'publicKeys', 'type': '[ContainerServiceSshPublicKey]'}, + "public_keys": {"key": "publicKeys", "type": "[ContainerServiceSshPublicKey]"}, } - def __init__( - self, - *, - public_keys: List["_models.ContainerServiceSshPublicKey"], - **kwargs - ): + def __init__(self, *, public_keys: List["_models.ContainerServiceSshPublicKey"], **kwargs): """ - :keyword public_keys: Required. The list of SSH public keys used to authenticate with - Linux-based VMs. Only expect one key specified. + :keyword public_keys: The list of SSH public keys used to authenticate with Linux-based VMs. + Only expect one key specified. Required. :paramtype public_keys: list[~azure.mgmt.containerservice.v2020_04_01.models.ContainerServiceSshPublicKey] """ - super(ContainerServiceSshConfiguration, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_keys = public_keys -class ContainerServiceSshPublicKey(msrest.serialization.Model): +class ContainerServiceSshPublicKey(_serialization.Model): """Contains information about SSH certificate public key data. All required parameters must be populated in order to send to Azure. - :ivar key_data: Required. Certificate public key used to authenticate with VMs through SSH. The - certificate must be in PEM format with or without headers. + :ivar key_data: Certificate public key used to authenticate with VMs through SSH. The + certificate must be in PEM format with or without headers. Required. :vartype key_data: str """ _validation = { - 'key_data': {'required': True}, + "key_data": {"required": True}, } _attribute_map = { - 'key_data': {'key': 'keyData', 'type': 'str'}, + "key_data": {"key": "keyData", "type": "str"}, } - def __init__( - self, - *, - key_data: str, - **kwargs - ): + def __init__(self, *, key_data: str, **kwargs): """ - :keyword key_data: Required. Certificate public key used to authenticate with VMs through SSH. - The certificate must be in PEM format with or without headers. + :keyword key_data: Certificate public key used to authenticate with VMs through SSH. The + certificate must be in PEM format with or without headers. Required. :paramtype key_data: str """ - super(ContainerServiceSshPublicKey, self).__init__(**kwargs) + super().__init__(**kwargs) self.key_data = key_data -class ContainerServiceVMDiagnostics(msrest.serialization.Model): +class ContainerServiceVMDiagnostics(_serialization.Model): """Profile for diagnostics on the container service VMs. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar enabled: Required. Whether the VM diagnostic agent is provisioned on the VM. + :ivar enabled: Whether the VM diagnostic agent is provisioned on the VM. Required. :vartype enabled: bool :ivar storage_uri: The URI of the storage account where diagnostics are stored. :vartype storage_uri: str """ _validation = { - 'enabled': {'required': True}, - 'storage_uri': {'readonly': True}, + "enabled": {"required": True}, + "storage_uri": {"readonly": True}, } _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'storage_uri': {'key': 'storageUri', 'type': 'str'}, + "enabled": {"key": "enabled", "type": "bool"}, + "storage_uri": {"key": "storageUri", "type": "str"}, } - def __init__( - self, - *, - enabled: bool, - **kwargs - ): + def __init__(self, *, enabled: bool, **kwargs): """ - :keyword enabled: Required. Whether the VM diagnostic agent is provisioned on the VM. + :keyword enabled: Whether the VM diagnostic agent is provisioned on the VM. Required. :paramtype enabled: bool """ - super(ContainerServiceVMDiagnostics, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.storage_uri = None -class CredentialResult(msrest.serialization.Model): +class CredentialResult(_serialization.Model): """The credential result response. Variables are only populated by the server, and will be ignored when sending a request. @@ -1337,31 +1308,27 @@ class CredentialResult(msrest.serialization.Model): :ivar name: The name of the credential. :vartype name: str :ivar value: Base64-encoded Kubernetes configuration file. - :vartype value: bytearray + :vartype value: bytes """ _validation = { - 'name': {'readonly': True}, - 'value': {'readonly': True}, + "name": {"readonly": True}, + "value": {"readonly": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'bytearray'}, + "name": {"key": "name", "type": "str"}, + "value": {"key": "value", "type": "bytearray"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(CredentialResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.name = None self.value = None -class CredentialResults(msrest.serialization.Model): +class CredentialResults(_serialization.Model): """The list of credential result response. Variables are only populated by the server, and will be ignored when sending a request. @@ -1371,24 +1338,20 @@ class CredentialResults(msrest.serialization.Model): """ _validation = { - 'kubeconfigs': {'readonly': True}, + "kubeconfigs": {"readonly": True}, } _attribute_map = { - 'kubeconfigs': {'key': 'kubeconfigs', 'type': '[CredentialResult]'}, + "kubeconfigs": {"key": "kubeconfigs", "type": "[CredentialResult]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(CredentialResults, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.kubeconfigs = None -class Resource(msrest.serialization.Model): +class Resource(_serialization.Model): """The Resource model definition. Variables are only populated by the server, and will be ignored when sending a request. @@ -1401,41 +1364,35 @@ class Resource(msrest.serialization.Model): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] """ - super(Resource, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -1443,7 +1400,7 @@ def __init__( self.tags = tags -class ManagedCluster(Resource, BaseManagedCluster): +class ManagedCluster(Resource, BaseManagedCluster): # pylint: disable=too-many-instance-attributes """Managed cluster. Variables are only populated by the server, and will be ignored when sending a request. @@ -1512,56 +1469,68 @@ class ManagedCluster(Resource, BaseManagedCluster): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar sku: The managed cluster SKU. :vartype sku: ~azure.mgmt.containerservice.v2020_04_01.models.ManagedClusterSKU """ _validation = { - 'provisioning_state': {'readonly': True}, - 'max_agent_pools': {'readonly': True}, - 'fqdn': {'readonly': True}, - 'private_fqdn': {'readonly': True}, - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, + "provisioning_state": {"readonly": True}, + "max_agent_pools": {"readonly": True}, + "fqdn": {"readonly": True}, + "private_fqdn": {"readonly": True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { - 'identity': {'key': 'identity', 'type': 'ManagedClusterIdentity'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'max_agent_pools': {'key': 'properties.maxAgentPools', 'type': 'int'}, - 'kubernetes_version': {'key': 'properties.kubernetesVersion', 'type': 'str'}, - 'dns_prefix': {'key': 'properties.dnsPrefix', 'type': 'str'}, - 'fqdn': {'key': 'properties.fqdn', 'type': 'str'}, - 'private_fqdn': {'key': 'properties.privateFQDN', 'type': 'str'}, - 'agent_pool_profiles': {'key': 'properties.agentPoolProfiles', 'type': '[ManagedClusterAgentPoolProfile]'}, - 'linux_profile': {'key': 'properties.linuxProfile', 'type': 'ContainerServiceLinuxProfile'}, - 'windows_profile': {'key': 'properties.windowsProfile', 'type': 'ManagedClusterWindowsProfile'}, - 'service_principal_profile': {'key': 'properties.servicePrincipalProfile', 'type': 'ManagedClusterServicePrincipalProfile'}, - 'addon_profiles': {'key': 'properties.addonProfiles', 'type': '{ManagedClusterAddonProfile}'}, - 'node_resource_group': {'key': 'properties.nodeResourceGroup', 'type': 'str'}, - 'enable_rbac': {'key': 'properties.enableRBAC', 'type': 'bool'}, - 'enable_pod_security_policy': {'key': 'properties.enablePodSecurityPolicy', 'type': 'bool'}, - 'network_profile': {'key': 'properties.networkProfile', 'type': 'ContainerServiceNetworkProfile'}, - 'aad_profile': {'key': 'properties.aadProfile', 'type': 'ManagedClusterAADProfile'}, - 'auto_scaler_profile': {'key': 'properties.autoScalerProfile', 'type': 'ManagedClusterPropertiesAutoScalerProfile'}, - 'api_server_access_profile': {'key': 'properties.apiServerAccessProfile', 'type': 'ManagedClusterAPIServerAccessProfile'}, - 'disk_encryption_set_id': {'key': 'properties.diskEncryptionSetID', 'type': 'str'}, - 'identity_profile': {'key': 'properties.identityProfile', 'type': '{ManagedClusterPropertiesIdentityProfileValue}'}, - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'ManagedClusterSKU'}, - } - - def __init__( + "identity": {"key": "identity", "type": "ManagedClusterIdentity"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "max_agent_pools": {"key": "properties.maxAgentPools", "type": "int"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "dns_prefix": {"key": "properties.dnsPrefix", "type": "str"}, + "fqdn": {"key": "properties.fqdn", "type": "str"}, + "private_fqdn": {"key": "properties.privateFQDN", "type": "str"}, + "agent_pool_profiles": {"key": "properties.agentPoolProfiles", "type": "[ManagedClusterAgentPoolProfile]"}, + "linux_profile": {"key": "properties.linuxProfile", "type": "ContainerServiceLinuxProfile"}, + "windows_profile": {"key": "properties.windowsProfile", "type": "ManagedClusterWindowsProfile"}, + "service_principal_profile": { + "key": "properties.servicePrincipalProfile", + "type": "ManagedClusterServicePrincipalProfile", + }, + "addon_profiles": {"key": "properties.addonProfiles", "type": "{ManagedClusterAddonProfile}"}, + "node_resource_group": {"key": "properties.nodeResourceGroup", "type": "str"}, + "enable_rbac": {"key": "properties.enableRBAC", "type": "bool"}, + "enable_pod_security_policy": {"key": "properties.enablePodSecurityPolicy", "type": "bool"}, + "network_profile": {"key": "properties.networkProfile", "type": "ContainerServiceNetworkProfile"}, + "aad_profile": {"key": "properties.aadProfile", "type": "ManagedClusterAADProfile"}, + "auto_scaler_profile": { + "key": "properties.autoScalerProfile", + "type": "ManagedClusterPropertiesAutoScalerProfile", + }, + "api_server_access_profile": { + "key": "properties.apiServerAccessProfile", + "type": "ManagedClusterAPIServerAccessProfile", + }, + "disk_encryption_set_id": {"key": "properties.diskEncryptionSetID", "type": "str"}, + "identity_profile": { + "key": "properties.identityProfile", + "type": "{ManagedClusterPropertiesIdentityProfileValue}", + }, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "sku": {"key": "sku", "type": "ManagedClusterSKU"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, location: str, @@ -1635,14 +1604,35 @@ def __init__( :keyword identity_profile: Identities associated with the cluster. :paramtype identity_profile: dict[str, ~azure.mgmt.containerservice.v2020_04_01.models.ManagedClusterPropertiesIdentityProfileValue] - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword sku: The managed cluster SKU. :paramtype sku: ~azure.mgmt.containerservice.v2020_04_01.models.ManagedClusterSKU """ - super(ManagedCluster, self).__init__(location=location, tags=tags, identity=identity, kubernetes_version=kubernetes_version, dns_prefix=dns_prefix, agent_pool_profiles=agent_pool_profiles, linux_profile=linux_profile, windows_profile=windows_profile, service_principal_profile=service_principal_profile, addon_profiles=addon_profiles, node_resource_group=node_resource_group, enable_rbac=enable_rbac, enable_pod_security_policy=enable_pod_security_policy, network_profile=network_profile, aad_profile=aad_profile, auto_scaler_profile=auto_scaler_profile, api_server_access_profile=api_server_access_profile, disk_encryption_set_id=disk_encryption_set_id, identity_profile=identity_profile, **kwargs) + super().__init__( + location=location, + tags=tags, + identity=identity, + kubernetes_version=kubernetes_version, + dns_prefix=dns_prefix, + agent_pool_profiles=agent_pool_profiles, + linux_profile=linux_profile, + windows_profile=windows_profile, + service_principal_profile=service_principal_profile, + addon_profiles=addon_profiles, + node_resource_group=node_resource_group, + enable_rbac=enable_rbac, + enable_pod_security_policy=enable_pod_security_policy, + network_profile=network_profile, + aad_profile=aad_profile, + auto_scaler_profile=auto_scaler_profile, + api_server_access_profile=api_server_access_profile, + disk_encryption_set_id=disk_encryption_set_id, + identity_profile=identity_profile, + **kwargs + ) self.identity = identity self.provisioning_state = None self.max_agent_pools = None @@ -1672,7 +1662,7 @@ def __init__( self.tags = tags -class ManagedClusterAADProfile(msrest.serialization.Model): +class ManagedClusterAADProfile(_serialization.Model): """AADProfile specifies attributes for Azure Active Directory integration. :ivar managed: Whether to enable managed AAD. @@ -1691,12 +1681,12 @@ class ManagedClusterAADProfile(msrest.serialization.Model): """ _attribute_map = { - 'managed': {'key': 'managed', 'type': 'bool'}, - 'admin_group_object_i_ds': {'key': 'adminGroupObjectIDs', 'type': '[str]'}, - 'client_app_id': {'key': 'clientAppID', 'type': 'str'}, - 'server_app_id': {'key': 'serverAppID', 'type': 'str'}, - 'server_app_secret': {'key': 'serverAppSecret', 'type': 'str'}, - 'tenant_id': {'key': 'tenantID', 'type': 'str'}, + "managed": {"key": "managed", "type": "bool"}, + "admin_group_object_i_ds": {"key": "adminGroupObjectIDs", "type": "[str]"}, + "client_app_id": {"key": "clientAppID", "type": "str"}, + "server_app_id": {"key": "serverAppID", "type": "str"}, + "server_app_secret": {"key": "serverAppSecret", "type": "str"}, + "tenant_id": {"key": "tenantID", "type": "str"}, } def __init__( @@ -1726,7 +1716,7 @@ def __init__( tenant of the deployment subscription. :paramtype tenant_id: str """ - super(ManagedClusterAADProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.managed = managed self.admin_group_object_i_ds = admin_group_object_i_ds self.client_app_id = client_app_id @@ -1748,58 +1738,53 @@ class ManagedClusterAccessProfile(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar kube_config: Base64-encoded Kubernetes configuration file. - :vartype kube_config: bytearray + :vartype kube_config: bytes """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'kube_config': {'key': 'properties.kubeConfig', 'type': 'bytearray'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "kube_config": {"key": "properties.kubeConfig", "type": "bytearray"}, } def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - kube_config: Optional[bytearray] = None, - **kwargs + self, *, location: str, tags: Optional[Dict[str, str]] = None, kube_config: Optional[bytes] = None, **kwargs ): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword kube_config: Base64-encoded Kubernetes configuration file. - :paramtype kube_config: bytearray + :paramtype kube_config: bytes """ - super(ManagedClusterAccessProfile, self).__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.kube_config = kube_config -class ManagedClusterAddonProfile(msrest.serialization.Model): +class ManagedClusterAddonProfile(_serialization.Model): """A Kubernetes add-on profile for a managed cluster. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar enabled: Required. Whether the add-on is enabled or not. + :ivar enabled: Whether the add-on is enabled or not. Required. :vartype enabled: bool :ivar config: Key-value pairs for configuring an add-on. :vartype config: dict[str, str] @@ -1809,36 +1794,30 @@ class ManagedClusterAddonProfile(msrest.serialization.Model): """ _validation = { - 'enabled': {'required': True}, - 'identity': {'readonly': True}, + "enabled": {"required": True}, + "identity": {"readonly": True}, } _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'config': {'key': 'config', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'ManagedClusterAddonProfileIdentity'}, + "enabled": {"key": "enabled", "type": "bool"}, + "config": {"key": "config", "type": "{str}"}, + "identity": {"key": "identity", "type": "ManagedClusterAddonProfileIdentity"}, } - def __init__( - self, - *, - enabled: bool, - config: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, enabled: bool, config: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword enabled: Required. Whether the add-on is enabled or not. + :keyword enabled: Whether the add-on is enabled or not. Required. :paramtype enabled: bool :keyword config: Key-value pairs for configuring an add-on. :paramtype config: dict[str, str] """ - super(ManagedClusterAddonProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.config = config self.identity = None -class UserAssignedIdentity(msrest.serialization.Model): +class UserAssignedIdentity(_serialization.Model): """UserAssignedIdentity. :ivar resource_id: The resource id of the user assigned identity. @@ -1850,9 +1829,9 @@ class UserAssignedIdentity(msrest.serialization.Model): """ _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'object_id': {'key': 'objectId', 'type': 'str'}, + "resource_id": {"key": "resourceId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + "object_id": {"key": "objectId", "type": "str"}, } def __init__( @@ -1871,7 +1850,7 @@ def __init__( :keyword object_id: The object id of the user assigned identity. :paramtype object_id: str """ - super(UserAssignedIdentity, self).__init__(**kwargs) + super().__init__(**kwargs) self.resource_id = resource_id self.client_id = client_id self.object_id = object_id @@ -1889,9 +1868,9 @@ class ManagedClusterAddonProfileIdentity(UserAssignedIdentity): """ _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'object_id': {'key': 'objectId', 'type': 'str'}, + "resource_id": {"key": "resourceId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + "object_id": {"key": "objectId", "type": "str"}, } def __init__( @@ -1910,10 +1889,10 @@ def __init__( :keyword object_id: The object id of the user assigned identity. :paramtype object_id: str """ - super(ManagedClusterAddonProfileIdentity, self).__init__(resource_id=resource_id, client_id=client_id, object_id=object_id, **kwargs) + super().__init__(resource_id=resource_id, client_id=client_id, object_id=object_id, **kwargs) -class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): +class ManagedClusterAgentPoolProfileProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes """Properties for the container service agent pool profile. Variables are only populated by the server, and will be ignored when sending a request. @@ -1959,7 +1938,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :vartype vm_size: str or ~azure.mgmt.containerservice.v2020_04_01.models.ContainerServiceVMSizeTypes :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine @@ -1971,7 +1950,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Known values are: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux" and "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2020_04_01.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -1980,9 +1959,10 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar type: AgentPoolType represents types of an agent pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2020_04_01.models.AgentPoolType - :ivar mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", "User". + :ivar mode: AgentPoolMode represents mode of an agent pool. Known values are: "System" and + "User". :vartype mode: str or ~azure.mgmt.containerservice.v2020_04_01.models.AgentPoolMode :ivar orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -2001,20 +1981,19 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar enable_node_public_ip: Enable public IP for nodes. :vartype enable_node_public_ip: bool :ivar scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Known values are: "Spot", "Regular". Default value: "Regular". + priority. Default to regular. Known values are: "Spot" and "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_04_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy - for Spot virtual machine scale set. Default to Delete. Known values are: "Delete", - "Deallocate". Default value: "Delete". + for Spot virtual machine scale set. Default to Delete. Known values are: "Delete" and + "Deallocate". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_04_01.models.ScaleSetEvictionPolicy :ivar spot_max_price: SpotMaxPrice to be used to specify the maximum price you are willing to pay in US Dollars. Possible values are any decimal value greater than zero or -1 which indicates default price to be up-to on-demand. :vartype spot_max_price: float - :ivar tags: A set of tags. Agent pool tags to be persisted on the agent pool virtual machine - scale set. + :ivar tags: Agent pool tags to be persisted on the agent pool virtual machine scale set. :vartype tags: dict[str, str] :ivar node_labels: Agent pool node labels to be persisted across all nodes in agent pool. :vartype node_labels: dict[str, str] @@ -2024,34 +2003,34 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): """ _validation = { - 'os_disk_size_gb': {'maximum': 1023, 'minimum': 0}, - 'provisioning_state': {'readonly': True}, + "os_disk_size_gb": {"maximum": 1023, "minimum": 0}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'maxPods', 'type': 'int'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'max_count': {'key': 'maxCount', 'type': 'int'}, - 'min_count': {'key': 'minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'enableAutoScaling', 'type': 'bool'}, - 'type': {'key': 'type', 'type': 'str'}, - 'mode': {'key': 'mode', 'type': 'str'}, - 'orchestrator_version': {'key': 'orchestratorVersion', 'type': 'str'}, - 'node_image_version': {'key': 'nodeImageVersion', 'type': 'str'}, - 'upgrade_settings': {'key': 'upgradeSettings', 'type': 'AgentPoolUpgradeSettings'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'availability_zones': {'key': 'availabilityZones', 'type': '[str]'}, - 'enable_node_public_ip': {'key': 'enableNodePublicIP', 'type': 'bool'}, - 'scale_set_priority': {'key': 'scaleSetPriority', 'type': 'str'}, - 'scale_set_eviction_policy': {'key': 'scaleSetEvictionPolicy', 'type': 'str'}, - 'spot_max_price': {'key': 'spotMaxPrice', 'type': 'float'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'node_labels': {'key': 'nodeLabels', 'type': '{str}'}, - 'node_taints': {'key': 'nodeTaints', 'type': '[str]'}, + "count": {"key": "count", "type": "int"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "max_pods": {"key": "maxPods", "type": "int"}, + "os_type": {"key": "osType", "type": "str"}, + "max_count": {"key": "maxCount", "type": "int"}, + "min_count": {"key": "minCount", "type": "int"}, + "enable_auto_scaling": {"key": "enableAutoScaling", "type": "bool"}, + "type": {"key": "type", "type": "str"}, + "mode": {"key": "mode", "type": "str"}, + "orchestrator_version": {"key": "orchestratorVersion", "type": "str"}, + "node_image_version": {"key": "nodeImageVersion", "type": "str"}, + "upgrade_settings": {"key": "upgradeSettings", "type": "AgentPoolUpgradeSettings"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "availability_zones": {"key": "availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "enableNodePublicIP", "type": "bool"}, + "scale_set_priority": {"key": "scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "scaleSetEvictionPolicy", "type": "str"}, + "spot_max_price": {"key": "spotMaxPrice", "type": "float"}, + "tags": {"key": "tags", "type": "{str}"}, + "node_labels": {"key": "nodeLabels", "type": "{str}"}, + "node_taints": {"key": "nodeTaints", "type": "[str]"}, } def __init__( @@ -2062,7 +2041,7 @@ def __init__( os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, @@ -2073,9 +2052,9 @@ def __init__( upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, - scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", - spot_max_price: Optional[float] = -1, + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", + spot_max_price: float = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, @@ -2123,7 +2102,7 @@ def __init__( "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :paramtype vm_size: str or ~azure.mgmt.containerservice.v2020_04_01.models.ContainerServiceVMSizeTypes :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every @@ -2135,7 +2114,7 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux" and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2020_04_01.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -2144,9 +2123,9 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword type: AgentPoolType represents types of an agent pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2020_04_01.models.AgentPoolType - :keyword mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", + :keyword mode: AgentPoolMode represents mode of an agent pool. Known values are: "System" and "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2020_04_01.models.AgentPoolMode :keyword orchestrator_version: Version of orchestrator specified when creating the managed @@ -2163,20 +2142,19 @@ def __init__( :keyword enable_node_public_ip: Enable public IP for nodes. :paramtype enable_node_public_ip: bool :keyword scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Known values are: "Spot", "Regular". Default value: "Regular". + priority. Default to regular. Known values are: "Spot" and "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_04_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction - policy for Spot virtual machine scale set. Default to Delete. Known values are: "Delete", - "Deallocate". Default value: "Delete". + policy for Spot virtual machine scale set. Default to Delete. Known values are: "Delete" and + "Deallocate". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_04_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: SpotMaxPrice to be used to specify the maximum price you are willing to pay in US Dollars. Possible values are any decimal value greater than zero or -1 which indicates default price to be up-to on-demand. :paramtype spot_max_price: float - :keyword tags: A set of tags. Agent pool tags to be persisted on the agent pool virtual machine - scale set. + :keyword tags: Agent pool tags to be persisted on the agent pool virtual machine scale set. :paramtype tags: dict[str, str] :keyword node_labels: Agent pool node labels to be persisted across all nodes in agent pool. :paramtype node_labels: dict[str, str] @@ -2184,7 +2162,7 @@ def __init__( key=value:NoSchedule. :paramtype node_taints: list[str] """ - super(ManagedClusterAgentPoolProfileProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.vm_size = vm_size self.os_disk_size_gb = os_disk_size_gb @@ -2210,7 +2188,9 @@ def __init__( self.node_taints = node_taints -class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): +class ManagedClusterAgentPoolProfile( + ManagedClusterAgentPoolProfileProperties +): # pylint: disable=too-many-instance-attributes """Profile for the container service agent pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -2258,7 +2238,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :vartype vm_size: str or ~azure.mgmt.containerservice.v2020_04_01.models.ContainerServiceVMSizeTypes :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine @@ -2270,7 +2250,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Known values are: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux" and "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2020_04_01.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -2279,9 +2259,10 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar type: AgentPoolType represents types of an agent pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2020_04_01.models.AgentPoolType - :ivar mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", "User". + :ivar mode: AgentPoolMode represents mode of an agent pool. Known values are: "System" and + "User". :vartype mode: str or ~azure.mgmt.containerservice.v2020_04_01.models.AgentPoolMode :ivar orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -2300,65 +2281,64 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar enable_node_public_ip: Enable public IP for nodes. :vartype enable_node_public_ip: bool :ivar scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Known values are: "Spot", "Regular". Default value: "Regular". + priority. Default to regular. Known values are: "Spot" and "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_04_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy - for Spot virtual machine scale set. Default to Delete. Known values are: "Delete", - "Deallocate". Default value: "Delete". + for Spot virtual machine scale set. Default to Delete. Known values are: "Delete" and + "Deallocate". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_04_01.models.ScaleSetEvictionPolicy :ivar spot_max_price: SpotMaxPrice to be used to specify the maximum price you are willing to pay in US Dollars. Possible values are any decimal value greater than zero or -1 which indicates default price to be up-to on-demand. :vartype spot_max_price: float - :ivar tags: A set of tags. Agent pool tags to be persisted on the agent pool virtual machine - scale set. + :ivar tags: Agent pool tags to be persisted on the agent pool virtual machine scale set. :vartype tags: dict[str, str] :ivar node_labels: Agent pool node labels to be persisted across all nodes in agent pool. :vartype node_labels: dict[str, str] :ivar node_taints: Taints added to new nodes during node pool create and scale. For example, key=value:NoSchedule. :vartype node_taints: list[str] - :ivar name: Required. Unique name of the agent pool profile in the context of the subscription - and resource group. + :ivar name: Unique name of the agent pool profile in the context of the subscription and + resource group. Required. :vartype name: str """ _validation = { - 'os_disk_size_gb': {'maximum': 1023, 'minimum': 0}, - 'provisioning_state': {'readonly': True}, - 'name': {'required': True, 'pattern': r'^[a-z][a-z0-9]{0,11}$'}, + "os_disk_size_gb": {"maximum": 1023, "minimum": 0}, + "provisioning_state": {"readonly": True}, + "name": {"required": True, "pattern": r"^[a-z][a-z0-9]{0,11}$"}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'maxPods', 'type': 'int'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'max_count': {'key': 'maxCount', 'type': 'int'}, - 'min_count': {'key': 'minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'enableAutoScaling', 'type': 'bool'}, - 'type': {'key': 'type', 'type': 'str'}, - 'mode': {'key': 'mode', 'type': 'str'}, - 'orchestrator_version': {'key': 'orchestratorVersion', 'type': 'str'}, - 'node_image_version': {'key': 'nodeImageVersion', 'type': 'str'}, - 'upgrade_settings': {'key': 'upgradeSettings', 'type': 'AgentPoolUpgradeSettings'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'availability_zones': {'key': 'availabilityZones', 'type': '[str]'}, - 'enable_node_public_ip': {'key': 'enableNodePublicIP', 'type': 'bool'}, - 'scale_set_priority': {'key': 'scaleSetPriority', 'type': 'str'}, - 'scale_set_eviction_policy': {'key': 'scaleSetEvictionPolicy', 'type': 'str'}, - 'spot_max_price': {'key': 'spotMaxPrice', 'type': 'float'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'node_labels': {'key': 'nodeLabels', 'type': '{str}'}, - 'node_taints': {'key': 'nodeTaints', 'type': '[str]'}, - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( + "count": {"key": "count", "type": "int"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "max_pods": {"key": "maxPods", "type": "int"}, + "os_type": {"key": "osType", "type": "str"}, + "max_count": {"key": "maxCount", "type": "int"}, + "min_count": {"key": "minCount", "type": "int"}, + "enable_auto_scaling": {"key": "enableAutoScaling", "type": "bool"}, + "type": {"key": "type", "type": "str"}, + "mode": {"key": "mode", "type": "str"}, + "orchestrator_version": {"key": "orchestratorVersion", "type": "str"}, + "node_image_version": {"key": "nodeImageVersion", "type": "str"}, + "upgrade_settings": {"key": "upgradeSettings", "type": "AgentPoolUpgradeSettings"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "availability_zones": {"key": "availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "enableNodePublicIP", "type": "bool"}, + "scale_set_priority": {"key": "scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "scaleSetEvictionPolicy", "type": "str"}, + "spot_max_price": {"key": "spotMaxPrice", "type": "float"}, + "tags": {"key": "tags", "type": "{str}"}, + "node_labels": {"key": "nodeLabels", "type": "{str}"}, + "node_taints": {"key": "nodeTaints", "type": "[str]"}, + "name": {"key": "name", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, name: str, @@ -2367,7 +2347,7 @@ def __init__( os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, @@ -2378,9 +2358,9 @@ def __init__( upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, - scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", - spot_max_price: Optional[float] = -1, + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", + spot_max_price: float = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, @@ -2428,7 +2408,7 @@ def __init__( "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :paramtype vm_size: str or ~azure.mgmt.containerservice.v2020_04_01.models.ContainerServiceVMSizeTypes :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every @@ -2440,7 +2420,7 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux" and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2020_04_01.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -2449,9 +2429,9 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword type: AgentPoolType represents types of an agent pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2020_04_01.models.AgentPoolType - :keyword mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", + :keyword mode: AgentPoolMode represents mode of an agent pool. Known values are: "System" and "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2020_04_01.models.AgentPoolMode :keyword orchestrator_version: Version of orchestrator specified when creating the managed @@ -2468,35 +2448,58 @@ def __init__( :keyword enable_node_public_ip: Enable public IP for nodes. :paramtype enable_node_public_ip: bool :keyword scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Known values are: "Spot", "Regular". Default value: "Regular". + priority. Default to regular. Known values are: "Spot" and "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_04_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction - policy for Spot virtual machine scale set. Default to Delete. Known values are: "Delete", - "Deallocate". Default value: "Delete". + policy for Spot virtual machine scale set. Default to Delete. Known values are: "Delete" and + "Deallocate". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_04_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: SpotMaxPrice to be used to specify the maximum price you are willing to pay in US Dollars. Possible values are any decimal value greater than zero or -1 which indicates default price to be up-to on-demand. :paramtype spot_max_price: float - :keyword tags: A set of tags. Agent pool tags to be persisted on the agent pool virtual machine - scale set. + :keyword tags: Agent pool tags to be persisted on the agent pool virtual machine scale set. :paramtype tags: dict[str, str] :keyword node_labels: Agent pool node labels to be persisted across all nodes in agent pool. :paramtype node_labels: dict[str, str] :keyword node_taints: Taints added to new nodes during node pool create and scale. For example, key=value:NoSchedule. :paramtype node_taints: list[str] - :keyword name: Required. Unique name of the agent pool profile in the context of the - subscription and resource group. + :keyword name: Unique name of the agent pool profile in the context of the subscription and + resource group. Required. :paramtype name: str """ - super(ManagedClusterAgentPoolProfile, self).__init__(count=count, vm_size=vm_size, os_disk_size_gb=os_disk_size_gb, vnet_subnet_id=vnet_subnet_id, max_pods=max_pods, os_type=os_type, max_count=max_count, min_count=min_count, enable_auto_scaling=enable_auto_scaling, type=type, mode=mode, orchestrator_version=orchestrator_version, node_image_version=node_image_version, upgrade_settings=upgrade_settings, availability_zones=availability_zones, enable_node_public_ip=enable_node_public_ip, scale_set_priority=scale_set_priority, scale_set_eviction_policy=scale_set_eviction_policy, spot_max_price=spot_max_price, tags=tags, node_labels=node_labels, node_taints=node_taints, **kwargs) + super().__init__( + count=count, + vm_size=vm_size, + os_disk_size_gb=os_disk_size_gb, + vnet_subnet_id=vnet_subnet_id, + max_pods=max_pods, + os_type=os_type, + max_count=max_count, + min_count=min_count, + enable_auto_scaling=enable_auto_scaling, + type=type, + mode=mode, + orchestrator_version=orchestrator_version, + node_image_version=node_image_version, + upgrade_settings=upgrade_settings, + availability_zones=availability_zones, + enable_node_public_ip=enable_node_public_ip, + scale_set_priority=scale_set_priority, + scale_set_eviction_policy=scale_set_eviction_policy, + spot_max_price=spot_max_price, + tags=tags, + node_labels=node_labels, + node_taints=node_taints, + **kwargs + ) self.name = name -class ManagedClusterAPIServerAccessProfile(msrest.serialization.Model): +class ManagedClusterAPIServerAccessProfile(_serialization.Model): """Access profile for managed cluster API server. :ivar authorized_ip_ranges: Authorized IP Ranges to kubernetes API server. @@ -2506,8 +2509,8 @@ class ManagedClusterAPIServerAccessProfile(msrest.serialization.Model): """ _attribute_map = { - 'authorized_ip_ranges': {'key': 'authorizedIPRanges', 'type': '[str]'}, - 'enable_private_cluster': {'key': 'enablePrivateCluster', 'type': 'bool'}, + "authorized_ip_ranges": {"key": "authorizedIPRanges", "type": "[str]"}, + "enable_private_cluster": {"key": "enablePrivateCluster", "type": "bool"}, } def __init__( @@ -2523,12 +2526,12 @@ def __init__( :keyword enable_private_cluster: Whether to create the cluster as a private cluster or not. :paramtype enable_private_cluster: bool """ - super(ManagedClusterAPIServerAccessProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.authorized_ip_ranges = authorized_ip_ranges self.enable_private_cluster = enable_private_cluster -class ManagedClusterIdentity(msrest.serialization.Model): +class ManagedClusterIdentity(_serialization.Model): """Identity for the managed cluster. Variables are only populated by the server, and will be ignored when sending a request. @@ -2542,41 +2545,36 @@ class ManagedClusterIdentity(msrest.serialization.Model): :ivar type: The type of identity used for the managed cluster. Type 'SystemAssigned' will use an implicitly created identity in master components and an auto-created user assigned identity in MC_ resource group in agent nodes. Type 'None' will not use MSI for the managed cluster, - service principal will be used instead. Known values are: "SystemAssigned", "None". + service principal will be used instead. Known values are: "SystemAssigned" and "None". :vartype type: str or ~azure.mgmt.containerservice.v2020_04_01.models.ResourceIdentityType """ _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, + "principal_id": {"readonly": True}, + "tenant_id": {"readonly": True}, } _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, + "principal_id": {"key": "principalId", "type": "str"}, + "tenant_id": {"key": "tenantId", "type": "str"}, + "type": {"key": "type", "type": "str"}, } - def __init__( - self, - *, - type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, - **kwargs - ): + def __init__(self, *, type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, **kwargs): """ :keyword type: The type of identity used for the managed cluster. Type 'SystemAssigned' will use an implicitly created identity in master components and an auto-created user assigned identity in MC_ resource group in agent nodes. Type 'None' will not use MSI for the managed - cluster, service principal will be used instead. Known values are: "SystemAssigned", "None". + cluster, service principal will be used instead. Known values are: "SystemAssigned" and "None". :paramtype type: str or ~azure.mgmt.containerservice.v2020_04_01.models.ResourceIdentityType """ - super(ManagedClusterIdentity, self).__init__(**kwargs) + super().__init__(**kwargs) self.principal_id = None self.tenant_id = None self.type = type -class ManagedClusterListResult(msrest.serialization.Model): +class ManagedClusterListResult(_serialization.Model): """The response from the List Managed Clusters operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -2588,30 +2586,25 @@ class ManagedClusterListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[ManagedCluster]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[ManagedCluster]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.ManagedCluster"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.ManagedCluster"]] = None, **kwargs): """ :keyword value: The list of managed clusters. :paramtype value: list[~azure.mgmt.containerservice.v2020_04_01.models.ManagedCluster] """ - super(ManagedClusterListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class ManagedClusterLoadBalancerProfile(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfile(_serialization.Model): """Profile of the managed cluster load balancer. :ivar managed_outbound_i_ps: Desired managed outbound IPs for the cluster load balancer. @@ -2637,17 +2630,23 @@ class ManagedClusterLoadBalancerProfile(msrest.serialization.Model): """ _validation = { - 'allocated_outbound_ports': {'maximum': 64000, 'minimum': 0}, - 'idle_timeout_in_minutes': {'maximum': 120, 'minimum': 4}, + "allocated_outbound_ports": {"maximum": 64000, "minimum": 0}, + "idle_timeout_in_minutes": {"maximum": 120, "minimum": 4}, } _attribute_map = { - 'managed_outbound_i_ps': {'key': 'managedOutboundIPs', 'type': 'ManagedClusterLoadBalancerProfileManagedOutboundIPs'}, - 'outbound_ip_prefixes': {'key': 'outboundIPPrefixes', 'type': 'ManagedClusterLoadBalancerProfileOutboundIPPrefixes'}, - 'outbound_i_ps': {'key': 'outboundIPs', 'type': 'ManagedClusterLoadBalancerProfileOutboundIPs'}, - 'effective_outbound_i_ps': {'key': 'effectiveOutboundIPs', 'type': '[ResourceReference]'}, - 'allocated_outbound_ports': {'key': 'allocatedOutboundPorts', 'type': 'int'}, - 'idle_timeout_in_minutes': {'key': 'idleTimeoutInMinutes', 'type': 'int'}, + "managed_outbound_i_ps": { + "key": "managedOutboundIPs", + "type": "ManagedClusterLoadBalancerProfileManagedOutboundIPs", + }, + "outbound_ip_prefixes": { + "key": "outboundIPPrefixes", + "type": "ManagedClusterLoadBalancerProfileOutboundIPPrefixes", + }, + "outbound_i_ps": {"key": "outboundIPs", "type": "ManagedClusterLoadBalancerProfileOutboundIPs"}, + "effective_outbound_i_ps": {"key": "effectiveOutboundIPs", "type": "[ResourceReference]"}, + "allocated_outbound_ports": {"key": "allocatedOutboundPorts", "type": "int"}, + "idle_timeout_in_minutes": {"key": "idleTimeoutInMinutes", "type": "int"}, } def __init__( @@ -2657,8 +2656,8 @@ def __init__( outbound_ip_prefixes: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPPrefixes"] = None, outbound_i_ps: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPs"] = None, effective_outbound_i_ps: Optional[List["_models.ResourceReference"]] = None, - allocated_outbound_ports: Optional[int] = 0, - idle_timeout_in_minutes: Optional[int] = 30, + allocated_outbound_ports: int = 0, + idle_timeout_in_minutes: int = 30, **kwargs ): """ @@ -2684,7 +2683,7 @@ def __init__( must be in the range of 4 to 120 (inclusive). The default value is 30 minutes. :paramtype idle_timeout_in_minutes: int """ - super(ManagedClusterLoadBalancerProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.managed_outbound_i_ps = managed_outbound_i_ps self.outbound_ip_prefixes = outbound_ip_prefixes self.outbound_i_ps = outbound_i_ps @@ -2693,7 +2692,7 @@ def __init__( self.idle_timeout_in_minutes = idle_timeout_in_minutes -class ManagedClusterLoadBalancerProfileManagedOutboundIPs(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfileManagedOutboundIPs(_serialization.Model): """Desired managed outbound IPs for the cluster load balancer. :ivar count: Desired number of outbound IP created/managed by Azure for the cluster load @@ -2702,29 +2701,24 @@ class ManagedClusterLoadBalancerProfileManagedOutboundIPs(msrest.serialization.M """ _validation = { - 'count': {'maximum': 100, 'minimum': 1}, + "count": {"maximum": 100, "minimum": 1}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, + "count": {"key": "count", "type": "int"}, } - def __init__( - self, - *, - count: Optional[int] = 1, - **kwargs - ): + def __init__(self, *, count: int = 1, **kwargs): """ :keyword count: Desired number of outbound IP created/managed by Azure for the cluster load balancer. Allowed values must be in the range of 1 to 100 (inclusive). The default value is 1. :paramtype count: int """ - super(ManagedClusterLoadBalancerProfileManagedOutboundIPs, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count -class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(_serialization.Model): """Desired outbound IP Prefix resources for the cluster load balancer. :ivar public_ip_prefixes: A list of public IP prefix resources. @@ -2733,25 +2727,20 @@ class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(msrest.serialization.M """ _attribute_map = { - 'public_ip_prefixes': {'key': 'publicIPPrefixes', 'type': '[ResourceReference]'}, + "public_ip_prefixes": {"key": "publicIPPrefixes", "type": "[ResourceReference]"}, } - def __init__( - self, - *, - public_ip_prefixes: Optional[List["_models.ResourceReference"]] = None, - **kwargs - ): + def __init__(self, *, public_ip_prefixes: Optional[List["_models.ResourceReference"]] = None, **kwargs): """ :keyword public_ip_prefixes: A list of public IP prefix resources. :paramtype public_ip_prefixes: list[~azure.mgmt.containerservice.v2020_04_01.models.ResourceReference] """ - super(ManagedClusterLoadBalancerProfileOutboundIPPrefixes, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_ip_prefixes = public_ip_prefixes -class ManagedClusterLoadBalancerProfileOutboundIPs(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfileOutboundIPs(_serialization.Model): """Desired outbound IP resources for the cluster load balancer. :ivar public_i_ps: A list of public IP resources. @@ -2759,34 +2748,29 @@ class ManagedClusterLoadBalancerProfileOutboundIPs(msrest.serialization.Model): """ _attribute_map = { - 'public_i_ps': {'key': 'publicIPs', 'type': '[ResourceReference]'}, + "public_i_ps": {"key": "publicIPs", "type": "[ResourceReference]"}, } - def __init__( - self, - *, - public_i_ps: Optional[List["_models.ResourceReference"]] = None, - **kwargs - ): + def __init__(self, *, public_i_ps: Optional[List["_models.ResourceReference"]] = None, **kwargs): """ :keyword public_i_ps: A list of public IP resources. :paramtype public_i_ps: list[~azure.mgmt.containerservice.v2020_04_01.models.ResourceReference] """ - super(ManagedClusterLoadBalancerProfileOutboundIPs, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_i_ps = public_i_ps -class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): +class ManagedClusterPoolUpgradeProfile(_serialization.Model): """The list of available upgrade versions. All required parameters must be populated in order to send to Azure. - :ivar kubernetes_version: Required. Kubernetes version (major, minor, patch). + :ivar kubernetes_version: Kubernetes version (major, minor, patch). Required. :vartype kubernetes_version: str :ivar name: Pool name. :vartype name: str - :ivar os_type: Required. OsType to be used to specify os type. Choose from Linux and Windows. - Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to + Linux. Known values are: "Linux" and "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2020_04_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -2794,15 +2778,15 @@ class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): """ _validation = { - 'kubernetes_version': {'required': True}, - 'os_type': {'required': True}, + "kubernetes_version": {"required": True}, + "os_type": {"required": True}, } _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'upgrades': {'key': 'upgrades', 'type': '[ManagedClusterPoolUpgradeProfileUpgradesItem]'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "os_type": {"key": "osType", "type": "str"}, + "upgrades": {"key": "upgrades", "type": "[ManagedClusterPoolUpgradeProfileUpgradesItem]"}, } def __init__( @@ -2815,25 +2799,25 @@ def __init__( **kwargs ): """ - :keyword kubernetes_version: Required. Kubernetes version (major, minor, patch). + :keyword kubernetes_version: Kubernetes version (major, minor, patch). Required. :paramtype kubernetes_version: str :keyword name: Pool name. :paramtype name: str - :keyword os_type: Required. OsType to be used to specify os type. Choose from Linux and - Windows. Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default + to Linux. Known values are: "Linux" and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2020_04_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: list[~azure.mgmt.containerservice.v2020_04_01.models.ManagedClusterPoolUpgradeProfileUpgradesItem] """ - super(ManagedClusterPoolUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.name = name self.os_type = os_type self.upgrades = upgrades -class ManagedClusterPoolUpgradeProfileUpgradesItem(msrest.serialization.Model): +class ManagedClusterPoolUpgradeProfileUpgradesItem(_serialization.Model): """ManagedClusterPoolUpgradeProfileUpgradesItem. :ivar kubernetes_version: Kubernetes version (major, minor, patch). @@ -2843,29 +2827,23 @@ class ManagedClusterPoolUpgradeProfileUpgradesItem(msrest.serialization.Model): """ _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } - def __init__( - self, - *, - kubernetes_version: Optional[str] = None, - is_preview: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, kubernetes_version: Optional[str] = None, is_preview: Optional[bool] = None, **kwargs): """ :keyword kubernetes_version: Kubernetes version (major, minor, patch). :paramtype kubernetes_version: str :keyword is_preview: Whether Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(ManagedClusterPoolUpgradeProfileUpgradesItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.is_preview = is_preview -class ManagedClusterPropertiesAutoScalerProfile(msrest.serialization.Model): +class ManagedClusterPropertiesAutoScalerProfile(_serialization.Model): """Parameters to be applied to the cluster-autoscaler when enabled. :ivar balance_similar_node_groups: @@ -2889,15 +2867,15 @@ class ManagedClusterPropertiesAutoScalerProfile(msrest.serialization.Model): """ _attribute_map = { - 'balance_similar_node_groups': {'key': 'balance-similar-node-groups', 'type': 'str'}, - 'scan_interval': {'key': 'scan-interval', 'type': 'str'}, - 'scale_down_delay_after_add': {'key': 'scale-down-delay-after-add', 'type': 'str'}, - 'scale_down_delay_after_delete': {'key': 'scale-down-delay-after-delete', 'type': 'str'}, - 'scale_down_delay_after_failure': {'key': 'scale-down-delay-after-failure', 'type': 'str'}, - 'scale_down_unneeded_time': {'key': 'scale-down-unneeded-time', 'type': 'str'}, - 'scale_down_unready_time': {'key': 'scale-down-unready-time', 'type': 'str'}, - 'scale_down_utilization_threshold': {'key': 'scale-down-utilization-threshold', 'type': 'str'}, - 'max_graceful_termination_sec': {'key': 'max-graceful-termination-sec', 'type': 'str'}, + "balance_similar_node_groups": {"key": "balance-similar-node-groups", "type": "str"}, + "scan_interval": {"key": "scan-interval", "type": "str"}, + "scale_down_delay_after_add": {"key": "scale-down-delay-after-add", "type": "str"}, + "scale_down_delay_after_delete": {"key": "scale-down-delay-after-delete", "type": "str"}, + "scale_down_delay_after_failure": {"key": "scale-down-delay-after-failure", "type": "str"}, + "scale_down_unneeded_time": {"key": "scale-down-unneeded-time", "type": "str"}, + "scale_down_unready_time": {"key": "scale-down-unready-time", "type": "str"}, + "scale_down_utilization_threshold": {"key": "scale-down-utilization-threshold", "type": "str"}, + "max_graceful_termination_sec": {"key": "max-graceful-termination-sec", "type": "str"}, } def __init__( @@ -2934,7 +2912,7 @@ def __init__( :keyword max_graceful_termination_sec: :paramtype max_graceful_termination_sec: str """ - super(ManagedClusterPropertiesAutoScalerProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.balance_similar_node_groups = balance_similar_node_groups self.scan_interval = scan_interval self.scale_down_delay_after_add = scale_down_delay_after_add @@ -2958,9 +2936,9 @@ class ManagedClusterPropertiesIdentityProfileValue(UserAssignedIdentity): """ _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'object_id': {'key': 'objectId', 'type': 'str'}, + "resource_id": {"key": "resourceId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + "object_id": {"key": "objectId", "type": "str"}, } def __init__( @@ -2979,59 +2957,53 @@ def __init__( :keyword object_id: The object id of the user assigned identity. :paramtype object_id: str """ - super(ManagedClusterPropertiesIdentityProfileValue, self).__init__(resource_id=resource_id, client_id=client_id, object_id=object_id, **kwargs) + super().__init__(resource_id=resource_id, client_id=client_id, object_id=object_id, **kwargs) -class ManagedClusterServicePrincipalProfile(msrest.serialization.Model): +class ManagedClusterServicePrincipalProfile(_serialization.Model): """Information about a service principal identity for the cluster to use for manipulating Azure APIs. All required parameters must be populated in order to send to Azure. - :ivar client_id: Required. The ID for the service principal. + :ivar client_id: The ID for the service principal. Required. :vartype client_id: str :ivar secret: The secret password associated with the service principal in plain text. :vartype secret: str """ _validation = { - 'client_id': {'required': True}, + "client_id": {"required": True}, } _attribute_map = { - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'secret': {'key': 'secret', 'type': 'str'}, + "client_id": {"key": "clientId", "type": "str"}, + "secret": {"key": "secret", "type": "str"}, } - def __init__( - self, - *, - client_id: str, - secret: Optional[str] = None, - **kwargs - ): + def __init__(self, *, client_id: str, secret: Optional[str] = None, **kwargs): """ - :keyword client_id: Required. The ID for the service principal. + :keyword client_id: The ID for the service principal. Required. :paramtype client_id: str :keyword secret: The secret password associated with the service principal in plain text. :paramtype secret: str """ - super(ManagedClusterServicePrincipalProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.client_id = client_id self.secret = secret -class ManagedClusterSKU(msrest.serialization.Model): +class ManagedClusterSKU(_serialization.Model): """ManagedClusterSKU. - :ivar name: Name of a managed cluster SKU. Known values are: "Basic". + :ivar name: Name of a managed cluster SKU. "Basic" :vartype name: str or ~azure.mgmt.containerservice.v2020_04_01.models.ManagedClusterSKUName - :ivar tier: Tier of a managed cluster SKU. Known values are: "Paid", "Free". + :ivar tier: Tier of a managed cluster SKU. Known values are: "Paid" and "Free". :vartype tier: str or ~azure.mgmt.containerservice.v2020_04_01.models.ManagedClusterSKUTier """ _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, + "name": {"key": "name", "type": "str"}, + "tier": {"key": "tier", "type": "str"}, } def __init__( @@ -3042,17 +3014,17 @@ def __init__( **kwargs ): """ - :keyword name: Name of a managed cluster SKU. Known values are: "Basic". + :keyword name: Name of a managed cluster SKU. "Basic" :paramtype name: str or ~azure.mgmt.containerservice.v2020_04_01.models.ManagedClusterSKUName - :keyword tier: Tier of a managed cluster SKU. Known values are: "Paid", "Free". + :keyword tier: Tier of a managed cluster SKU. Known values are: "Paid" and "Free". :paramtype tier: str or ~azure.mgmt.containerservice.v2020_04_01.models.ManagedClusterSKUTier """ - super(ManagedClusterSKU, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.tier = tier -class ManagedClusterUpgradeProfile(msrest.serialization.Model): +class ManagedClusterUpgradeProfile(_serialization.Model): """The list of available upgrades for compute pools. Variables are only populated by the server, and will be ignored when sending a request. @@ -3065,29 +3037,29 @@ class ManagedClusterUpgradeProfile(msrest.serialization.Model): :vartype name: str :ivar type: Type of upgrade profile. :vartype type: str - :ivar control_plane_profile: Required. The list of available upgrade versions for the control - plane. + :ivar control_plane_profile: The list of available upgrade versions for the control plane. + Required. :vartype control_plane_profile: ~azure.mgmt.containerservice.v2020_04_01.models.ManagedClusterPoolUpgradeProfile - :ivar agent_pool_profiles: Required. The list of available upgrade versions for agent pools. + :ivar agent_pool_profiles: The list of available upgrade versions for agent pools. Required. :vartype agent_pool_profiles: list[~azure.mgmt.containerservice.v2020_04_01.models.ManagedClusterPoolUpgradeProfile] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'control_plane_profile': {'required': True}, - 'agent_pool_profiles': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "control_plane_profile": {"required": True}, + "agent_pool_profiles": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'control_plane_profile': {'key': 'properties.controlPlaneProfile', 'type': 'ManagedClusterPoolUpgradeProfile'}, - 'agent_pool_profiles': {'key': 'properties.agentPoolProfiles', 'type': '[ManagedClusterPoolUpgradeProfile]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "control_plane_profile": {"key": "properties.controlPlaneProfile", "type": "ManagedClusterPoolUpgradeProfile"}, + "agent_pool_profiles": {"key": "properties.agentPoolProfiles", "type": "[ManagedClusterPoolUpgradeProfile]"}, } def __init__( @@ -3098,15 +3070,15 @@ def __init__( **kwargs ): """ - :keyword control_plane_profile: Required. The list of available upgrade versions for the - control plane. + :keyword control_plane_profile: The list of available upgrade versions for the control plane. + Required. :paramtype control_plane_profile: ~azure.mgmt.containerservice.v2020_04_01.models.ManagedClusterPoolUpgradeProfile - :keyword agent_pool_profiles: Required. The list of available upgrade versions for agent pools. + :keyword agent_pool_profiles: The list of available upgrade versions for agent pools. Required. :paramtype agent_pool_profiles: list[~azure.mgmt.containerservice.v2020_04_01.models.ManagedClusterPoolUpgradeProfile] """ - super(ManagedClusterUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -3114,18 +3086,18 @@ def __init__( self.agent_pool_profiles = agent_pool_profiles -class ManagedClusterWindowsProfile(msrest.serialization.Model): +class ManagedClusterWindowsProfile(_serialization.Model): """Profile for Windows VMs in the container service cluster. All required parameters must be populated in order to send to Azure. - :ivar admin_username: Required. Specifies the name of the administrator account. - :code:`
`:code:`
` **restriction:** Cannot end in "." :code:`
`:code:`
` - **Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", "test1", - "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", - "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", - "sys", "test2", "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 - character :code:`
`:code:`
` **Max-length:** 20 characters. + :ivar admin_username: Specifies the name of the administrator account. :code:`
`:code:`
` + **restriction:** Cannot end in "." :code:`
`:code:`
` **Disallowed values:** + "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", + "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", + "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", + "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 character + :code:`
`:code:`
` **Max-length:** 20 characters. Required. :vartype admin_username: str :ivar admin_password: Specifies the password of the administrator account. :code:`
`:code:`
` **Minimum-length:** 8 characters :code:`
`:code:`
` @@ -3138,29 +3110,23 @@ class ManagedClusterWindowsProfile(msrest.serialization.Model): """ _validation = { - 'admin_username': {'required': True}, + "admin_username": {"required": True}, } _attribute_map = { - 'admin_username': {'key': 'adminUsername', 'type': 'str'}, - 'admin_password': {'key': 'adminPassword', 'type': 'str'}, + "admin_username": {"key": "adminUsername", "type": "str"}, + "admin_password": {"key": "adminPassword", "type": "str"}, } - def __init__( - self, - *, - admin_username: str, - admin_password: Optional[str] = None, - **kwargs - ): + def __init__(self, *, admin_username: str, admin_password: Optional[str] = None, **kwargs): """ - :keyword admin_username: Required. Specifies the name of the administrator account. + :keyword admin_username: Specifies the name of the administrator account. :code:`
`:code:`
` **restriction:** Cannot end in "." :code:`
`:code:`
` **Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 - character :code:`
`:code:`
` **Max-length:** 20 characters. + character :code:`
`:code:`
` **Max-length:** 20 characters. Required. :paramtype admin_username: str :keyword admin_password: Specifies the password of the administrator account. :code:`
`:code:`
` **Minimum-length:** 8 characters :code:`
`:code:`
` @@ -3171,12 +3137,12 @@ def __init__( "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!". :paramtype admin_password: str """ - super(ManagedClusterWindowsProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.admin_username = admin_username self.admin_password = admin_password -class OperationListResult(msrest.serialization.Model): +class OperationListResult(_serialization.Model): """The List Compute Operation operation response. Variables are only populated by the server, and will be ignored when sending a request. @@ -3186,24 +3152,20 @@ class OperationListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[OperationValue]'}, + "value": {"key": "value", "type": "[OperationValue]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(OperationListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None -class OperationValue(msrest.serialization.Model): +class OperationValue(_serialization.Model): """Describes the properties of a Compute Operation value. Variables are only populated by the server, and will be ignored when sending a request. @@ -3223,30 +3185,26 @@ class OperationValue(msrest.serialization.Model): """ _validation = { - 'origin': {'readonly': True}, - 'name': {'readonly': True}, - 'operation': {'readonly': True}, - 'resource': {'readonly': True}, - 'description': {'readonly': True}, - 'provider': {'readonly': True}, + "origin": {"readonly": True}, + "name": {"readonly": True}, + "operation": {"readonly": True}, + "resource": {"readonly": True}, + "description": {"readonly": True}, + "provider": {"readonly": True}, } _attribute_map = { - 'origin': {'key': 'origin', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'operation': {'key': 'display.operation', 'type': 'str'}, - 'resource': {'key': 'display.resource', 'type': 'str'}, - 'description': {'key': 'display.description', 'type': 'str'}, - 'provider': {'key': 'display.provider', 'type': 'str'}, + "origin": {"key": "origin", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "operation": {"key": "display.operation", "type": "str"}, + "resource": {"key": "display.resource", "type": "str"}, + "description": {"key": "display.description", "type": "str"}, + "provider": {"key": "display.provider", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(OperationValue, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.origin = None self.name = None self.operation = None @@ -3255,7 +3213,7 @@ def __init__( self.provider = None -class ResourceReference(msrest.serialization.Model): +class ResourceReference(_serialization.Model): """A reference to an Azure resource. :ivar id: The fully qualified Azure resource id. @@ -3263,43 +3221,33 @@ class ResourceReference(msrest.serialization.Model): """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, } - def __init__( - self, - *, - id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin """ :keyword id: The fully qualified Azure resource id. :paramtype id: str """ - super(ResourceReference, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id -class TagsObject(msrest.serialization.Model): +class TagsObject(_serialization.Model): """Tags object for patch operations. - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] """ _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] """ - super(TagsObject, self).__init__(**kwargs) + super().__init__(**kwargs) self.tags = tags diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/models/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/models/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/models/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/models/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/operations/__init__.py index 403c0174f052..ee6608454b6b 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/operations/__init__.py @@ -13,10 +13,11 @@ from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'Operations', - 'ManagedClustersOperations', - 'AgentPoolsOperations', + "Operations", + "ManagedClustersOperations", + "AgentPoolsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/operations/_agent_pools_operations.py index 58336626fb9d..e9efff27aaa8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/operations/_agent_pools_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,249 +27,250 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - *, - json: Optional[_models.AgentPool] = None, - content: Any = None, - **kwargs: Any + _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, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + _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, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_get_upgrade_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_available_agent_pool_versions_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class AgentPoolsOperations: """ @@ -285,48 +291,40 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> Iterable[_models.AgentPoolListResult]: + def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> Iterable["_models.AgentPool"]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. The operation returns properties of each agent pool. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AgentPoolListResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_04_01.models.AgentPoolListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either AgentPool or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_04_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -334,16 +332,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -359,10 +352,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -372,54 +363,45 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore @distributed_trace def get( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPool: """Gets the agent pool. Gets the details of the agent pool by managed cluster and resource group. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPool, or the result of cls(response) + :return: AgentPool or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_04_01.models.AgentPool - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -427,57 +409,60 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore def _create_or_update_initial( self, resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: _models.AgentPool, + parameters: Union[_models.AgentPool, IO], **kwargs: Any ) -> _models.AgentPool: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - _json = self._serialize.body(parameters, 'AgentPool') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "AgentPool") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -485,10 +470,9 @@ def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -496,40 +480,86 @@ def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - - @distributed_trace + @overload def begin_create_or_update( self, resource_group_name: str, resource_name: str, agent_pool_name: str, parameters: _models.AgentPool, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.AgentPool]: """Creates or updates an agent pool. Creates or updates an agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :param parameters: Parameters supplied to the Create or Update an agent pool operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2020_04_01.models.AgentPool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_04_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AgentPool]: + """Creates or updates an agent pool. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: Parameters supplied to the Create or Update an agent pool operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -541,20 +571,56 @@ def begin_create_or_update( :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_04_01.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: Union[_models.AgentPool, IO], + **kwargs: Any + ) -> LROPoller[_models.AgentPool]: + """Creates or updates an agent pool. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: Parameters supplied to the Create or Update an agent pool operation. Is + either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2020_04_01.models.AgentPool or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_04_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -563,66 +629,55 @@ def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -630,10 +685,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -643,26 +697,21 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + def begin_delete( + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> LROPoller[None]: """Deletes an agent pool. Deletes the agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -674,100 +723,86 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPoolUpgradeProfile: """Gets upgrade profile for an agent pool. Gets the details of the upgrade profile for an agent pool with a specified resource group and managed cluster name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolUpgradeProfile, or the result of cls(response) + :return: AgentPoolUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_04_01.models.AgentPoolUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -775,64 +810,56 @@ def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolUpgradeProfile', pipeline_response) + deserialized = self._deserialize("AgentPoolUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore @distributed_trace def get_available_agent_pool_versions( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported versions for the specified agent pool. Gets a list of supported versions for the specified agent pool. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolAvailableVersions, or the result of cls(response) + :return: AgentPoolAvailableVersions or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_04_01.models.AgentPoolAvailableVersions - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolAvailableVersions] - request = build_get_available_agent_pool_versions_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_available_agent_pool_versions.metadata['url'], + template_url=self.get_available_agent_pool_versions.metadata["url"], headers=_headers, params=_params, ) @@ -840,22 +867,20 @@ def get_available_agent_pool_versions( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolAvailableVersions', pipeline_response) + deserialized = self._deserialize("AgentPoolAvailableVersions", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_available_agent_pool_versions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore - + get_available_agent_pool_versions.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/operations/_managed_clusters_operations.py index 3241dd953a65..14e22f1f6a69 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/operations/_managed_clusters_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,557 +27,536 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters") + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters" + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_resource_group_request( - subscription_id: str, - resource_group_name: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters", + ) # 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', min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_upgrade_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_access_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, role_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 = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "roleName": _SERIALIZER.url("role_name", role_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "roleName": _SERIALIZER.url("role_name", role_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_admin_credentials_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_user_credentials_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_monitoring_user_credentials_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: + +def build_get_request(resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedCluster] = None, - content: Any = None, - **kwargs: Any +def build_create_or_update_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_update_tags_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.TagsObject] = None, - content: Any = None, - **kwargs: Any + +def build_update_tags_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + +def build_delete_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_reset_service_principal_profile_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedClusterServicePrincipalProfile] = None, - content: Any = None, - **kwargs: Any + +def build_reset_service_principal_profile_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_reset_aad_profile_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedClusterAADProfile] = None, - content: Any = None, - **kwargs: Any +def build_reset_aad_profile_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_rotate_cluster_certificates_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any +def build_rotate_cluster_certificates_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + class ManagedClustersOperations: """ @@ -593,41 +577,35 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.ManagedClusterListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.ManagedCluster"]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. The operation returns properties of each managed cluster. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_04_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_04_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -635,14 +613,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -658,10 +633,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -671,50 +644,42 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> Iterable[_models.ManagedClusterListResult]: + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.ManagedCluster"]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. The operation returns properties of each managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_04_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_04_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -722,15 +687,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -746,10 +707,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -759,51 +718,43 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.ManagedClusterUpgradeProfile: """Gets upgrade profile for a managed cluster. Gets the details of the upgrade profile for a managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterUpgradeProfile, or the result of cls(response) + :return: ManagedClusterUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_04_01.models.ManagedClusterUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -811,33 +762,27 @@ def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterUpgradeProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore @distributed_trace def get_access_profile( - self, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, role_name: str, **kwargs: Any ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. @@ -848,36 +793,33 @@ def get_access_profile( `ListClusterAdminCredentials `_ . - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param role_name: The name of the role for managed cluster accessProfile resource. + :param role_name: The name of the role for managed cluster accessProfile resource. Required. :type role_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterAccessProfile, or the result of cls(response) + :return: ManagedClusterAccessProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_04_01.models.ManagedClusterAccessProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterAccessProfile] - request = build_get_access_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, role_name=role_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_access_profile.metadata['url'], + template_url=self.get_access_profile.metadata["url"], headers=_headers, params=_params, ) @@ -885,64 +827,56 @@ def get_access_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterAccessProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterAccessProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_access_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore - + get_access_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore @distributed_trace def list_cluster_admin_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster admin credential of a managed cluster. Gets cluster admin credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_04_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_admin_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_admin_credentials.metadata['url'], + template_url=self.list_cluster_admin_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -950,64 +884,56 @@ def list_cluster_admin_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_admin_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore - + list_cluster_admin_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore @distributed_trace def list_cluster_user_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster user credential of a managed cluster. Gets cluster user credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_04_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_user_credentials.metadata['url'], + template_url=self.list_cluster_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -1015,65 +941,57 @@ def list_cluster_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore - + list_cluster_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore @distributed_trace def list_cluster_monitoring_user_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster monitoring user credential of a managed cluster. Gets cluster monitoring user credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_04_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_monitoring_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + template_url=self.list_cluster_monitoring_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -1081,64 +999,54 @@ def list_cluster_monitoring_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_monitoring_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore - + list_cluster_monitoring_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore @distributed_trace - def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.ManagedCluster: + def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.ManagedCluster: """Gets a managed cluster. Gets the details of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedCluster, or the result of cls(response) + :return: ManagedCluster or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_04_01.models.ManagedCluster - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -1146,55 +1054,54 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _create_or_update_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.ManagedCluster, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'ManagedCluster') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedCluster") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1202,10 +1109,9 @@ def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -1213,25 +1119,26 @@ def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - @distributed_trace + @overload def begin_create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedCluster, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. @@ -1239,12 +1146,16 @@ def begin_create_or_update( Creates or updates a managed cluster with the specified configuration for agents and Kubernetes version. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2020_04_01.models.ManagedCluster + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1257,20 +1168,91 @@ def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_04_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster with the specified configuration for agents and Kubernetes + version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_04_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster with the specified configuration for agents and Kubernetes + version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. Is + either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2020_04_01.models.ManagedCluster or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_04_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -1278,69 +1260,66 @@ def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _update_tags_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.TagsObject, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request_initial( - subscription_id=self._config.subscription_id, + request = build_update_tags_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_tags_initial.metadata['url'], + content=_content, + template_url=self._update_tags_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1348,44 +1327,118 @@ def _update_tags_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_tags_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _update_tags_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - @distributed_trace + @overload def begin_update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates a managed cluster with the specified tags. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2020_04_01.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_04_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates a managed cluster with the specified tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_04_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates a managed cluster with the specified tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2020_04_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1398,20 +1451,17 @@ def begin_update_tags( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_04_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, @@ -1419,64 +1469,54 @@ def begin_update_tags( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1484,10 +1524,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1497,23 +1536,17 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> LROPoller[None]: + def begin_delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> LROPoller[None]: """Deletes a managed cluster. Deletes the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1525,85 +1558,83 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterServicePrincipalProfile, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterServicePrincipalProfile") - request = build_reset_service_principal_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_service_principal_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_service_principal_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_service_principal_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1611,10 +1642,9 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1624,29 +1654,106 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re if cls: return cls(pipeline_response, None, {}) - _reset_service_principal_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore - + _reset_service_principal_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore - @distributed_trace - def begin_reset_service_principal_profile( # pylint: disable=inconsistent-return-statements + @overload + def begin_reset_service_principal_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterServicePrincipalProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: """Reset Service Principal Profile of a managed cluster. Update the service principal Profile for a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a - Managed Cluster. + Managed Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2020_04_01.models.ManagedClusterServicePrincipalProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reset Service Principal Profile of a managed cluster. + + Update the service principal Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a + Managed Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Reset Service Principal Profile of a managed cluster. + + Update the service principal Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a + Managed Cluster. Is either a model type or a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2020_04_01.models.ManagedClusterServicePrincipalProfile or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1657,20 +1764,17 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1678,67 +1782,68 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_service_principal_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + begin_reset_service_principal_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterAADProfile, + parameters: Union[_models.ManagedClusterAADProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterAADProfile") - request = build_reset_aad_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_aad_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_aad_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_aad_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1746,10 +1851,9 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1759,28 +1863,32 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement if cls: return cls(pipeline_response, None, {}) - _reset_aad_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - + _reset_aad_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - @distributed_trace - def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements + @overload + def begin_reset_aad_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterAADProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: """Reset AAD Profile of a managed cluster. Update the AAD Profile for a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed - Cluster. + Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2020_04_01.models.ManagedClusterAADProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1791,20 +1899,90 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reset AAD Profile of a managed cluster. + + Update the AAD Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed + Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterAADProfile, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Reset AAD Profile of a managed cluster. + + Update the AAD Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed + Cluster. Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2020_04_01.models.ManagedClusterAADProfile or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1812,62 +1990,52 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_aad_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + begin_reset_aad_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_rotate_cluster_certificates_request_initial( - subscription_id=self._config.subscription_id, + request = build_rotate_cluster_certificates_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._rotate_cluster_certificates_initial.metadata['url'], + template_url=self._rotate_cluster_certificates_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1875,10 +2043,9 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1888,23 +2055,19 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return if cls: return cls(pipeline_response, None, {}) - _rotate_cluster_certificates_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore - + _rotate_cluster_certificates_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore @distributed_trace - def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + def begin_rotate_cluster_certificates( + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> LROPoller[None]: """Rotate certificates of a managed cluster. Rotate certificates of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1916,52 +2079,45 @@ def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-st Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._rotate_cluster_certificates_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_rotate_cluster_certificates.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore + begin_rotate_cluster_certificates.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/operations/_operations.py index 8302dbe34877..0f3bd119bb59 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/operations/_operations.py @@ -7,10 +7,15 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,38 +25,34 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - **kwargs: Any -) -> HttpRequest: + +def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.ContainerService/operations") # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class Operations: """ @@ -72,36 +73,31 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.OperationListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.OperationValue"]: """Gets a list of compute operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationListResult or the result of cls(response) + :return: An iterator like instance of either OperationValue or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_04_01.models.OperationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_04_01.models.OperationValue] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -109,13 +105,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -131,10 +125,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -144,8 +136,6 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.ContainerService/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ContainerService/operations"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/operations/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/__init__.py index 37a5f9e02e6f..a8716d29afe8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/__init__.py @@ -14,7 +14,8 @@ except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['ContainerServiceClient'] + +__all__ = ["ContainerServiceClient"] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/_configuration.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/_configuration.py index fafaf822c480..87e74ececadd 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/_configuration.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/_configuration.py @@ -18,30 +18,26 @@ VERSION = "unknown" + class ContainerServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ContainerServiceClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2020-06-01". 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: + def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ContainerServiceClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2020-06-01") # type: str + api_version = kwargs.pop("api_version", "2020-06-01") # type: str if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -51,23 +47,24 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-containerservice/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-containerservice/{}".format(VERSION)) self._configure(**kwargs) def _configure( - self, - **kwargs # type: Any + self, **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/_container_service_client.py index 90ba5f3b4303..801f50f58c8b 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/_container_service_client.py @@ -9,20 +9,25 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from . import models +from .._serialization import Deserializer, Serializer from ._configuration import ContainerServiceClientConfiguration -from .operations import AgentPoolsOperations, ManagedClustersOperations, Operations, PrivateEndpointConnectionsOperations +from .operations import ( + AgentPoolsOperations, + ManagedClustersOperations, + Operations, + PrivateEndpointConnectionsOperations, +) if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class ContainerServiceClient: + +class ContainerServiceClient: # pylint: disable=client-accepts-api-version-keyword """The Container Service Client. :ivar operations: Operations operations @@ -35,10 +40,10 @@ class ContainerServiceClient: :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations :vartype private_endpoint_connections: azure.mgmt.containerservice.v2020_06_01.operations.PrivateEndpointConnectionsOperations - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -56,32 +61,25 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = ContainerServiceClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = ContainerServiceClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize - ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.managed_clusters = ManagedClustersOperations( self._client, self._config, self._serialize, self._deserialize ) - self.agent_pools = AgentPoolsOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) self.private_endpoint_connections = PrivateEndpointConnectionsOperations( self._client, self._config, self._serialize, self._deserialize ) - - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> HttpResponse: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -90,7 +88,7 @@ def _send_request( >>> response = client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/_metadata.json b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/_metadata.json index c6c85b7f8b13..1a4c95fb2101 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/_metadata.json +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/_metadata.json @@ -10,20 +10,20 @@ "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { "credential": { - "signature": "credential, # type: \"TokenCredential\"", - "description": "Credential needed for the client to connect to Azure.", + "signature": "credential: \"TokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true }, "subscription_id": { - "signature": "subscription_id, # type: str", - "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "signature": "subscription_id: str,", + "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.", "docstring_type": "str", "required": true } @@ -31,13 +31,13 @@ "async": { "credential": { "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure.", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { "signature": "subscription_id: str,", - "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.", "docstring_type": "str", "required": true } @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=\"https://management.azure.com\", # type: str", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/_patch.py index 74e48ecd07cf..f99e77fef986 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/_patch.py @@ -28,4 +28,4 @@ # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + pass diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/_vendor.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/_vendor.py index 138f663c53a4..9aad73fc743e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/_vendor.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/_vendor.py @@ -7,6 +7,7 @@ from azure.core.pipeline.transport import HttpRequest + def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) @@ -14,6 +15,7 @@ def _convert_request(request, files=None): request.set_formdata_body(files) return request + def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -21,7 +23,5 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [ - c for c in formatted_components if "{}".format(key.args[0]) not in c - ] + components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/aio/__init__.py index 37a5f9e02e6f..a8716d29afe8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/aio/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/aio/__init__.py @@ -14,7 +14,8 @@ except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['ContainerServiceClient'] + +__all__ = ["ContainerServiceClient"] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/aio/_configuration.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/aio/_configuration.py index 507223fb8cf9..303aa9b324c3 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/aio/_configuration.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/aio/_configuration.py @@ -18,30 +18,26 @@ VERSION = "unknown" + class ContainerServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ContainerServiceClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2020-06-01". 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: + def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ContainerServiceClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2020-06-01") # type: str + api_version = kwargs.pop("api_version", "2020-06-01") # type: str if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -51,22 +47,21 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-containerservice/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-containerservice/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, - **kwargs: Any - ) -> None: - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/aio/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/aio/_container_service_client.py index 1654eaafb8e5..4fc493aaa422 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/aio/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/aio/_container_service_client.py @@ -9,20 +9,25 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from .. import models +from ..._serialization import Deserializer, Serializer from ._configuration import ContainerServiceClientConfiguration -from .operations import AgentPoolsOperations, ManagedClustersOperations, Operations, PrivateEndpointConnectionsOperations +from .operations import ( + AgentPoolsOperations, + ManagedClustersOperations, + Operations, + PrivateEndpointConnectionsOperations, +) if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class ContainerServiceClient: + +class ContainerServiceClient: # pylint: disable=client-accepts-api-version-keyword """The Container Service Client. :ivar operations: Operations operations @@ -36,10 +41,10 @@ class ContainerServiceClient: :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations :vartype private_endpoint_connections: azure.mgmt.containerservice.v2020_06_01.aio.operations.PrivateEndpointConnectionsOperations - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -57,32 +62,25 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = ContainerServiceClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = ContainerServiceClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize - ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.managed_clusters = ManagedClustersOperations( self._client, self._config, self._serialize, self._deserialize ) - self.agent_pools = AgentPoolsOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) self.private_endpoint_connections = PrivateEndpointConnectionsOperations( self._client, self._config, self._serialize, self._deserialize ) - - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -91,7 +89,7 @@ def _send_request( >>> response = await client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/aio/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/aio/_patch.py index 74e48ecd07cf..f99e77fef986 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/aio/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/aio/_patch.py @@ -28,4 +28,4 @@ # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + pass diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/aio/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/aio/operations/__init__.py index 9ef6890a9e03..65da25631a4b 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/aio/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/aio/operations/__init__.py @@ -14,11 +14,12 @@ from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'Operations', - 'ManagedClustersOperations', - 'AgentPoolsOperations', - 'PrivateEndpointConnectionsOperations', + "Operations", + "ManagedClustersOperations", + "AgentPoolsOperations", + "PrivateEndpointConnectionsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/aio/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/aio/operations/_agent_pools_operations.py index e25792974a42..1f9826a1db3d 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/aio/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/aio/operations/_agent_pools_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +29,19 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._agent_pools_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_available_agent_pool_versions_request, build_get_request, build_get_upgrade_profile_request, build_list_request -T = TypeVar('T') +from ...operations._agent_pools_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_available_agent_pool_versions_request, + build_get_request, + build_get_upgrade_profile_request, + build_list_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class AgentPoolsOperations: """ .. warning:: @@ -45,48 +61,41 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.AgentPoolListResult]: + def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncIterable["_models.AgentPool"]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. The operation returns properties of each agent pool. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AgentPoolListResult or the result of cls(response) + :return: An iterator like instance of either AgentPool or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_06_01.models.AgentPoolListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_06_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -94,16 +103,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -119,10 +123,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -132,54 +134,45 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore @distributed_trace_async async def get( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPool: """Gets the agent pool. Gets the details of the agent pool by managed cluster and resource group. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPool, or the result of cls(response) + :return: AgentPool or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_06_01.models.AgentPool - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -187,57 +180,60 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore async def _create_or_update_initial( self, resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: _models.AgentPool, + parameters: Union[_models.AgentPool, IO], **kwargs: Any ) -> _models.AgentPool: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - _json = self._serialize.body(parameters, 'AgentPool') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "AgentPool") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -245,10 +241,9 @@ async def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -256,40 +251,45 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - - @distributed_trace_async + @overload async def begin_create_or_update( self, resource_group_name: str, resource_name: str, agent_pool_name: str, parameters: _models.AgentPool, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.AgentPool]: """Creates or updates an agent pool. Creates or updates an agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :param parameters: Parameters supplied to the Create or Update an agent pool operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2020_06_01.models.AgentPool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -302,20 +302,99 @@ async def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_06_01.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AgentPool]: + """Creates or updates an agent pool. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: Parameters supplied to the Create or Update an agent pool operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AgentPool or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_06_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: Union[_models.AgentPool, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.AgentPool]: + """Creates or updates an agent pool. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: Parameters supplied to the Create or Update an agent pool operation. Is + either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2020_06_01.models.AgentPool or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AgentPool or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_06_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -324,66 +403,55 @@ async def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -391,10 +459,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -404,26 +471,21 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + async def begin_delete( + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes an agent pool. Deletes the agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -435,100 +497,86 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace_async async def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPoolUpgradeProfile: """Gets upgrade profile for an agent pool. Gets the details of the upgrade profile for an agent pool with a specified resource group and managed cluster name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolUpgradeProfile, or the result of cls(response) + :return: AgentPoolUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_06_01.models.AgentPoolUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -536,64 +584,56 @@ async def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolUpgradeProfile', pipeline_response) + deserialized = self._deserialize("AgentPoolUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore @distributed_trace_async async def get_available_agent_pool_versions( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported versions for the specified agent pool. Gets a list of supported versions for the specified agent pool. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolAvailableVersions, or the result of cls(response) + :return: AgentPoolAvailableVersions or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_06_01.models.AgentPoolAvailableVersions - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolAvailableVersions] - request = build_get_available_agent_pool_versions_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_available_agent_pool_versions.metadata['url'], + template_url=self.get_available_agent_pool_versions.metadata["url"], headers=_headers, params=_params, ) @@ -601,22 +641,20 @@ async def get_available_agent_pool_versions( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolAvailableVersions', pipeline_response) + deserialized = self._deserialize("AgentPoolAvailableVersions", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_available_agent_pool_versions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore - + get_available_agent_pool_versions.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/aio/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/aio/operations/_managed_clusters_operations.py index 749378b6ae80..ce2a359ad065 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/aio/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/aio/operations/_managed_clusters_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +29,27 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._managed_clusters_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_access_profile_request, build_get_request, build_get_upgrade_profile_request, build_list_by_resource_group_request, build_list_cluster_admin_credentials_request, build_list_cluster_monitoring_user_credentials_request, build_list_cluster_user_credentials_request, build_list_request, build_reset_aad_profile_request_initial, build_reset_service_principal_profile_request_initial, build_rotate_cluster_certificates_request_initial, build_update_tags_request_initial -T = TypeVar('T') +from ...operations._managed_clusters_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_access_profile_request, + build_get_request, + build_get_upgrade_profile_request, + build_list_by_resource_group_request, + build_list_cluster_admin_credentials_request, + build_list_cluster_monitoring_user_credentials_request, + build_list_cluster_user_credentials_request, + build_list_request, + build_reset_aad_profile_request, + build_reset_service_principal_profile_request, + build_rotate_cluster_certificates_request, + build_update_tags_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class ManagedClustersOperations: """ .. warning:: @@ -45,41 +69,35 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.ManagedClusterListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.ManagedCluster"]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. The operation returns properties of each managed cluster. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_06_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_06_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -87,14 +105,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -110,10 +125,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -123,50 +136,44 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.ManagedClusterListResult]: + self, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ManagedCluster"]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. The operation returns properties of each managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_06_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_06_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -174,15 +181,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -198,10 +201,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -211,51 +212,43 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace_async async def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.ManagedClusterUpgradeProfile: """Gets upgrade profile for a managed cluster. Gets the details of the upgrade profile for a managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterUpgradeProfile, or the result of cls(response) + :return: ManagedClusterUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_06_01.models.ManagedClusterUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -263,33 +256,27 @@ async def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterUpgradeProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore @distributed_trace_async async def get_access_profile( - self, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, role_name: str, **kwargs: Any ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. @@ -300,36 +287,33 @@ async def get_access_profile( `ListClusterAdminCredentials `_ . - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param role_name: The name of the role for managed cluster accessProfile resource. + :param role_name: The name of the role for managed cluster accessProfile resource. Required. :type role_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterAccessProfile, or the result of cls(response) + :return: ManagedClusterAccessProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_06_01.models.ManagedClusterAccessProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterAccessProfile] - request = build_get_access_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, role_name=role_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_access_profile.metadata['url'], + template_url=self.get_access_profile.metadata["url"], headers=_headers, params=_params, ) @@ -337,64 +321,56 @@ async def get_access_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterAccessProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterAccessProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_access_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore - + get_access_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore @distributed_trace_async async def list_cluster_admin_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster admin credential of a managed cluster. Gets cluster admin credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_06_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_admin_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_admin_credentials.metadata['url'], + template_url=self.list_cluster_admin_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -402,64 +378,56 @@ async def list_cluster_admin_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_admin_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore - + list_cluster_admin_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore @distributed_trace_async async def list_cluster_user_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster user credential of a managed cluster. Gets cluster user credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_06_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_user_credentials.metadata['url'], + template_url=self.list_cluster_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -467,65 +435,57 @@ async def list_cluster_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore - + list_cluster_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore @distributed_trace_async async def list_cluster_monitoring_user_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster monitoring user credential of a managed cluster. Gets cluster monitoring user credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_06_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_monitoring_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + template_url=self.list_cluster_monitoring_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -533,64 +493,54 @@ async def list_cluster_monitoring_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_monitoring_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore - + list_cluster_monitoring_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore @distributed_trace_async - async def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.ManagedCluster: + async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.ManagedCluster: """Gets a managed cluster. Gets the details of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedCluster, or the result of cls(response) + :return: ManagedCluster or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_06_01.models.ManagedCluster - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -598,55 +548,54 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _create_or_update_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.ManagedCluster, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'ManagedCluster') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedCluster") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -654,10 +603,9 @@ async def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -665,25 +613,26 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - @distributed_trace_async + @overload async def begin_create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedCluster, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. @@ -691,12 +640,90 @@ async def begin_create_or_update( Creates or updates a managed cluster with the specified configuration for agents and Kubernetes version. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2020_06_01.models.ManagedCluster + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_06_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster with the specified configuration for agents and Kubernetes + version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_06_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster with the specified configuration for agents and Kubernetes + version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. Is + either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2020_06_01.models.ManagedCluster or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -709,20 +736,17 @@ async def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_06_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -730,69 +754,66 @@ async def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _update_tags_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.TagsObject, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request_initial( - subscription_id=self._config.subscription_id, + request = build_update_tags_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_tags_initial.metadata['url'], + content=_content, + template_url=self._update_tags_initial.metadata["url"], headers=_headers, params=_params, ) @@ -800,44 +821,85 @@ async def _update_tags_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_tags_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _update_tags_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - @distributed_trace_async + @overload async def begin_update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates a managed cluster with the specified tags. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2020_06_01.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_06_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates a managed cluster with the specified tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -850,20 +912,50 @@ async def begin_update_tags( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_06_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates a managed cluster with the specified tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2020_06_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_06_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, @@ -871,64 +963,54 @@ async def begin_update_tags( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -936,10 +1018,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -949,23 +1030,17 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: + async def begin_delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Deletes a managed cluster. Deletes the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -977,85 +1052,83 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterServicePrincipalProfile, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterServicePrincipalProfile") - request = build_reset_service_principal_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_service_principal_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_service_principal_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_service_principal_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1063,10 +1136,9 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1076,29 +1148,106 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist if cls: return cls(pipeline_response, None, {}) - _reset_service_principal_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore - + _reset_service_principal_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore - @distributed_trace_async - async def begin_reset_service_principal_profile( # pylint: disable=inconsistent-return-statements + @overload + async def begin_reset_service_principal_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterServicePrincipalProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: """Reset Service Principal Profile of a managed cluster. Update the service principal Profile for a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a - Managed Cluster. + Managed Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2020_06_01.models.ManagedClusterServicePrincipalProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset Service Principal Profile of a managed cluster. + + Update the service principal Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a + Managed Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset Service Principal Profile of a managed cluster. + + Update the service principal Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a + Managed Cluster. Is either a model type or a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2020_06_01.models.ManagedClusterServicePrincipalProfile or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -1109,20 +1258,17 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1130,67 +1276,68 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_service_principal_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + begin_reset_service_principal_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterAADProfile, + parameters: Union[_models.ManagedClusterAADProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterAADProfile") - request = build_reset_aad_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_aad_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_aad_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_aad_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1198,10 +1345,9 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1211,28 +1357,69 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta if cls: return cls(pipeline_response, None, {}) - _reset_aad_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - + _reset_aad_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - @distributed_trace_async - async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements + @overload + async def begin_reset_aad_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterAADProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: """Reset AAD Profile of a managed cluster. Update the AAD Profile for a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed - Cluster. + Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2020_06_01.models.ManagedClusterAADProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset AAD Profile of a managed cluster. + + Update the AAD Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed + Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -1243,20 +1430,53 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterAADProfile, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset AAD Profile of a managed cluster. + + Update the AAD Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed + Cluster. Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2020_06_01.models.ManagedClusterAADProfile or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1264,62 +1484,52 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_aad_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + begin_reset_aad_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_rotate_cluster_certificates_request_initial( - subscription_id=self._config.subscription_id, + request = build_rotate_cluster_certificates_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._rotate_cluster_certificates_initial.metadata['url'], + template_url=self._rotate_cluster_certificates_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1327,10 +1537,9 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1340,23 +1549,19 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- if cls: return cls(pipeline_response, None, {}) - _rotate_cluster_certificates_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore - + _rotate_cluster_certificates_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore @distributed_trace_async - async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + async def begin_rotate_cluster_certificates( + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Rotate certificates of a managed cluster. Rotate certificates of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1368,52 +1573,45 @@ async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-ret Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._rotate_cluster_certificates_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_rotate_cluster_certificates.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore + begin_rotate_cluster_certificates.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/aio/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/aio/operations/_operations.py index 221ad62cb953..f2436882250f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/aio/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/aio/operations/_operations.py @@ -7,9 +7,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,9 +27,11 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._operations import build_list_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class Operations: """ .. warning:: @@ -42,36 +51,31 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.OperationListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.OperationValue"]: """Gets a list of compute operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationListResult or the result of cls(response) + :return: An iterator like instance of either OperationValue or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_06_01.models.OperationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_06_01.models.OperationValue] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -79,13 +83,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -101,10 +103,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -114,8 +114,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.ContainerService/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ContainerService/operations"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/aio/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/aio/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/aio/operations/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/aio/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/aio/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/aio/operations/_private_endpoint_connections_operations.py index b1c492445c60..989064d18d57 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/aio/operations/_private_endpoint_connections_operations.py @@ -6,9 +6,15 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -20,10 +26,17 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._private_endpoint_connections_operations import build_delete_request_initial, build_get_request, build_list_request, build_update_request -T = TypeVar('T') +from ...operations._private_endpoint_connections_operations import ( + build_delete_request, + build_get_request, + build_list_request, + build_update_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class PrivateEndpointConnectionsOperations: """ .. warning:: @@ -43,46 +56,39 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async async def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnectionListResult: """Gets a list of private endpoint connections in the specified managed cluster. Gets a list of private endpoint connections in the specified managed cluster. The operation returns properties of each private endpoint connection. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnectionListResult, or the result of cls(response) + :return: PrivateEndpointConnectionListResult or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_06_01.models.PrivateEndpointConnectionListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnectionListResult] - request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -90,68 +96,59 @@ async def list( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore - + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore @distributed_trace_async async def get( - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnection: """Gets the private endpoint connection. Gets the details of the private endpoint connection by managed cluster and resource group. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_06_01.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -159,75 +156,149 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - - @distributed_trace_async + @overload async def update( self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, parameters: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateEndpointConnection: """Updates a private endpoint connection. Updates a private endpoint connection in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :param parameters: Parameters supplied to the Update a private endpoint connection operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2020_06_01.models.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_06_01.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + async def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: Parameters supplied to the Update a private endpoint connection operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2020_06_01.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: Union[_models.PrivateEndpointConnection, IO], + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: Parameters supplied to the Update a private endpoint connection operation. + Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2020_06_01.models.PrivateEndpointConnection or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2020_06_01.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - _json = self._serialize.body(parameters, 'PrivateEndpointConnection') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateEndpointConnection") request = build_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update.metadata['url'], + content=_content, + template_url=self.update.metadata["url"], headers=_headers, params=_params, ) @@ -235,52 +306,43 @@ async def update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -288,10 +350,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -301,26 +362,21 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + async def begin_delete( + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes a private endpoint connection. Deletes the private endpoint connection in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -332,53 +388,46 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/models/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/models/__init__.py index fd094911ee92..d20d9885df1e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/models/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/models/__init__.py @@ -59,101 +59,99 @@ from ._models_py3 import TagsObject from ._models_py3 import UserAssignedIdentity - -from ._container_service_client_enums import ( - AgentPoolMode, - AgentPoolType, - ConnectionStatus, - ContainerServiceStorageProfileTypes, - ContainerServiceVMSizeTypes, - Count, - LoadBalancerSku, - ManagedClusterSKUName, - ManagedClusterSKUTier, - NetworkMode, - NetworkPlugin, - NetworkPolicy, - OSType, - OutboundType, - PrivateEndpointConnectionProvisioningState, - ResourceIdentityType, - ScaleSetEvictionPolicy, - ScaleSetPriority, -) +from ._container_service_client_enums import AgentPoolMode +from ._container_service_client_enums import AgentPoolType +from ._container_service_client_enums import ConnectionStatus +from ._container_service_client_enums import ContainerServiceStorageProfileTypes +from ._container_service_client_enums import ContainerServiceVMSizeTypes +from ._container_service_client_enums import Count +from ._container_service_client_enums import LoadBalancerSku +from ._container_service_client_enums import ManagedClusterSKUName +from ._container_service_client_enums import ManagedClusterSKUTier +from ._container_service_client_enums import NetworkMode +from ._container_service_client_enums import NetworkPlugin +from ._container_service_client_enums import NetworkPolicy +from ._container_service_client_enums import OSType +from ._container_service_client_enums import OutboundType +from ._container_service_client_enums import PrivateEndpointConnectionProvisioningState +from ._container_service_client_enums import ResourceIdentityType +from ._container_service_client_enums import ScaleSetEvictionPolicy +from ._container_service_client_enums import ScaleSetPriority from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'AgentPool', - 'AgentPoolAvailableVersions', - 'AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem', - 'AgentPoolListResult', - 'AgentPoolUpgradeProfile', - 'AgentPoolUpgradeProfilePropertiesUpgradesItem', - 'AgentPoolUpgradeSettings', - 'BaseManagedCluster', - 'CloudErrorBody', - 'ContainerServiceDiagnosticsProfile', - 'ContainerServiceLinuxProfile', - 'ContainerServiceMasterProfile', - 'ContainerServiceNetworkProfile', - 'ContainerServiceSshConfiguration', - 'ContainerServiceSshPublicKey', - 'ContainerServiceVMDiagnostics', - 'CredentialResult', - 'CredentialResults', - 'ManagedCluster', - 'ManagedClusterAADProfile', - 'ManagedClusterAPIServerAccessProfile', - 'ManagedClusterAccessProfile', - 'ManagedClusterAddonProfile', - 'ManagedClusterAddonProfileIdentity', - 'ManagedClusterAgentPoolProfile', - 'ManagedClusterAgentPoolProfileProperties', - 'ManagedClusterIdentity', - 'ManagedClusterIdentityUserAssignedIdentitiesValue', - 'ManagedClusterListResult', - 'ManagedClusterLoadBalancerProfile', - 'ManagedClusterLoadBalancerProfileManagedOutboundIPs', - 'ManagedClusterLoadBalancerProfileOutboundIPPrefixes', - 'ManagedClusterLoadBalancerProfileOutboundIPs', - 'ManagedClusterPoolUpgradeProfile', - 'ManagedClusterPoolUpgradeProfileUpgradesItem', - 'ManagedClusterPropertiesAutoScalerProfile', - 'ManagedClusterPropertiesIdentityProfileValue', - 'ManagedClusterSKU', - 'ManagedClusterServicePrincipalProfile', - 'ManagedClusterUpgradeProfile', - 'ManagedClusterWindowsProfile', - 'OperationListResult', - 'OperationValue', - 'PrivateEndpoint', - 'PrivateEndpointConnection', - 'PrivateEndpointConnectionListResult', - 'PrivateLinkServiceConnectionState', - 'Resource', - 'ResourceReference', - 'SubResource', - 'TagsObject', - 'UserAssignedIdentity', - 'AgentPoolMode', - 'AgentPoolType', - 'ConnectionStatus', - 'ContainerServiceStorageProfileTypes', - 'ContainerServiceVMSizeTypes', - 'Count', - 'LoadBalancerSku', - 'ManagedClusterSKUName', - 'ManagedClusterSKUTier', - 'NetworkMode', - 'NetworkPlugin', - 'NetworkPolicy', - 'OSType', - 'OutboundType', - 'PrivateEndpointConnectionProvisioningState', - 'ResourceIdentityType', - 'ScaleSetEvictionPolicy', - 'ScaleSetPriority', + "AgentPool", + "AgentPoolAvailableVersions", + "AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem", + "AgentPoolListResult", + "AgentPoolUpgradeProfile", + "AgentPoolUpgradeProfilePropertiesUpgradesItem", + "AgentPoolUpgradeSettings", + "BaseManagedCluster", + "CloudErrorBody", + "ContainerServiceDiagnosticsProfile", + "ContainerServiceLinuxProfile", + "ContainerServiceMasterProfile", + "ContainerServiceNetworkProfile", + "ContainerServiceSshConfiguration", + "ContainerServiceSshPublicKey", + "ContainerServiceVMDiagnostics", + "CredentialResult", + "CredentialResults", + "ManagedCluster", + "ManagedClusterAADProfile", + "ManagedClusterAPIServerAccessProfile", + "ManagedClusterAccessProfile", + "ManagedClusterAddonProfile", + "ManagedClusterAddonProfileIdentity", + "ManagedClusterAgentPoolProfile", + "ManagedClusterAgentPoolProfileProperties", + "ManagedClusterIdentity", + "ManagedClusterIdentityUserAssignedIdentitiesValue", + "ManagedClusterListResult", + "ManagedClusterLoadBalancerProfile", + "ManagedClusterLoadBalancerProfileManagedOutboundIPs", + "ManagedClusterLoadBalancerProfileOutboundIPPrefixes", + "ManagedClusterLoadBalancerProfileOutboundIPs", + "ManagedClusterPoolUpgradeProfile", + "ManagedClusterPoolUpgradeProfileUpgradesItem", + "ManagedClusterPropertiesAutoScalerProfile", + "ManagedClusterPropertiesIdentityProfileValue", + "ManagedClusterSKU", + "ManagedClusterServicePrincipalProfile", + "ManagedClusterUpgradeProfile", + "ManagedClusterWindowsProfile", + "OperationListResult", + "OperationValue", + "PrivateEndpoint", + "PrivateEndpointConnection", + "PrivateEndpointConnectionListResult", + "PrivateLinkServiceConnectionState", + "Resource", + "ResourceReference", + "SubResource", + "TagsObject", + "UserAssignedIdentity", + "AgentPoolMode", + "AgentPoolType", + "ConnectionStatus", + "ContainerServiceStorageProfileTypes", + "ContainerServiceVMSizeTypes", + "Count", + "LoadBalancerSku", + "ManagedClusterSKUName", + "ManagedClusterSKUTier", + "NetworkMode", + "NetworkPlugin", + "NetworkPolicy", + "OSType", + "OutboundType", + "PrivateEndpointConnectionProvisioningState", + "ResourceIdentityType", + "ScaleSetEvictionPolicy", + "ScaleSetPriority", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/models/_container_service_client_enums.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/models/_container_service_client_enums.py index a2ea966b17c8..26064eda8775 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/models/_container_service_client_enums.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/models/_container_service_client_enums.py @@ -11,28 +11,28 @@ class AgentPoolMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """AgentPoolMode represents mode of an agent pool. - """ + """AgentPoolMode represents mode of an agent pool.""" SYSTEM = "System" USER = "User" + class AgentPoolType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """AgentPoolType represents types of an agent pool. - """ + """AgentPoolType represents types of an agent pool.""" VIRTUAL_MACHINE_SCALE_SETS = "VirtualMachineScaleSets" AVAILABILITY_SET = "AvailabilitySet" + class ConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The private link service connection status. - """ + """The private link service connection status.""" PENDING = "Pending" APPROVED = "Approved" REJECTED = "Rejected" DISCONNECTED = "Disconnected" + class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the orchestrator choice. @@ -41,9 +41,9 @@ class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEn STORAGE_ACCOUNT = "StorageAccount" MANAGED_DISKS = "ManagedDisks" + class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Size of agent VMs. - """ + """Size of agent VMs.""" STANDARD_A1 = "Standard_A1" STANDARD_A10 = "Standard_A10" @@ -220,6 +220,7 @@ class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): STANDARD_NV24 = "Standard_NV24" STANDARD_NV6 = "Standard_NV6" + class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): """Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, and 5. The default value is 1. @@ -229,70 +230,71 @@ class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): THREE = 3 FIVE = 5 + class LoadBalancerSku(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The load balancer sku for the managed cluster. - """ + """The load balancer sku for the managed cluster.""" STANDARD = "standard" BASIC = "basic" + class ManagedClusterSKUName(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Name of a managed cluster SKU. - """ + """Name of a managed cluster SKU.""" BASIC = "Basic" + class ManagedClusterSKUTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Tier of a managed cluster SKU. - """ + """Tier of a managed cluster SKU.""" PAID = "Paid" FREE = "Free" + class NetworkMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Network mode used for building Kubernetes network. - """ + """Network mode used for building Kubernetes network.""" TRANSPARENT = "transparent" BRIDGE = "bridge" + class NetworkPlugin(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Network plugin used for building Kubernetes network. - """ + """Network plugin used for building Kubernetes network.""" AZURE = "azure" KUBENET = "kubenet" + class NetworkPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Network policy used for building Kubernetes network. - """ + """Network policy used for building Kubernetes network.""" CALICO = "calico" AZURE = "azure" + class OSType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """OsType to be used to specify os type. Choose from Linux and Windows. Default to Linux. - """ + """OsType to be used to specify os type. Choose from Linux and Windows. Default to Linux.""" LINUX = "Linux" WINDOWS = "Windows" + class OutboundType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The outbound (egress) routing method. - """ + """The outbound (egress) routing method.""" LOAD_BALANCER = "loadBalancer" USER_DEFINED_ROUTING = "userDefinedRouting" + class PrivateEndpointConnectionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The current provisioning state. - """ + """The current provisioning state.""" SUCCEEDED = "Succeeded" CREATING = "Creating" DELETING = "Deleting" FAILED = "Failed" + class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of identity used for the managed cluster. Type 'SystemAssigned' will use an implicitly created identity in master components and an auto-created user assigned identity in MC_ @@ -304,6 +306,7 @@ class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): USER_ASSIGNED = "UserAssigned" NONE = "None" + class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ScaleSetEvictionPolicy to be used to specify eviction policy for Spot virtual machine scale set. Default to Delete. @@ -312,9 +315,9 @@ class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): DELETE = "Delete" DEALLOCATE = "Deallocate" + class ScaleSetPriority(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """ScaleSetPriority to be used to specify virtual machine scale set priority. Default to regular. - """ + """ScaleSetPriority to be used to specify virtual machine scale set priority. Default to regular.""" SPOT = "Spot" REGULAR = "Regular" diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/models/_models_py3.py index 2d89a734ab29..15c9640933e3 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/models/_models_py3.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/models/_models_py3.py @@ -1,4 +1,5 @@ # coding=utf-8 +# pylint: disable=too-many-lines # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -8,14 +9,14 @@ from typing import Dict, List, Optional, TYPE_CHECKING, Union -import msrest.serialization +from ... import _serialization if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - import __init__ as _models + from .. import models as _models -class SubResource(msrest.serialization.Model): +class SubResource(_serialization.Model): """Reference to another subresource. Variables are only populated by the server, and will be ignored when sending a request. @@ -30,30 +31,26 @@ class SubResource(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(SubResource, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.id = None self.name = None self.type = None -class AgentPool(SubResource): +class AgentPool(SubResource): # pylint: disable=too-many-instance-attributes """Agent Pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -106,7 +103,7 @@ class AgentPool(SubResource): "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :vartype vm_size: str or ~azure.mgmt.containerservice.v2020_06_01.models.ContainerServiceVMSizeTypes :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine @@ -118,7 +115,7 @@ class AgentPool(SubResource): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Known values are: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux" and "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2020_06_01.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -127,10 +124,11 @@ class AgentPool(SubResource): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar type_properties_type: AgentPoolType represents types of an agent pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :vartype type_properties_type: str or ~azure.mgmt.containerservice.v2020_06_01.models.AgentPoolType - :ivar mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", "User". + :ivar mode: AgentPoolMode represents mode of an agent pool. Known values are: "System" and + "User". :vartype mode: str or ~azure.mgmt.containerservice.v2020_06_01.models.AgentPoolMode :ivar orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -149,20 +147,19 @@ class AgentPool(SubResource): :ivar enable_node_public_ip: Enable public IP for nodes. :vartype enable_node_public_ip: bool :ivar scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Known values are: "Spot", "Regular". Default value: "Regular". + priority. Default to regular. Known values are: "Spot" and "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_06_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy - for Spot virtual machine scale set. Default to Delete. Known values are: "Delete", - "Deallocate". Default value: "Delete". + for Spot virtual machine scale set. Default to Delete. Known values are: "Delete" and + "Deallocate". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_06_01.models.ScaleSetEvictionPolicy :ivar spot_max_price: SpotMaxPrice to be used to specify the maximum price you are willing to pay in US Dollars. Possible values are any decimal value greater than zero or -1 which indicates default price to be up-to on-demand. :vartype spot_max_price: float - :ivar tags: A set of tags. Agent pool tags to be persisted on the agent pool virtual machine - scale set. + :ivar tags: Agent pool tags to be persisted on the agent pool virtual machine scale set. :vartype tags: dict[str, str] :ivar node_labels: Agent pool node labels to be persisted across all nodes in agent pool. :vartype node_labels: dict[str, str] @@ -174,44 +171,44 @@ class AgentPool(SubResource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'os_disk_size_gb': {'maximum': 1023, 'minimum': 0}, - 'provisioning_state': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "os_disk_size_gb": {"maximum": 1023, "minimum": 0}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'count': {'key': 'properties.count', 'type': 'int'}, - 'vm_size': {'key': 'properties.vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'properties.osDiskSizeGB', 'type': 'int'}, - 'vnet_subnet_id': {'key': 'properties.vnetSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'properties.maxPods', 'type': 'int'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'max_count': {'key': 'properties.maxCount', 'type': 'int'}, - 'min_count': {'key': 'properties.minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'properties.enableAutoScaling', 'type': 'bool'}, - 'type_properties_type': {'key': 'properties.type', 'type': 'str'}, - 'mode': {'key': 'properties.mode', 'type': 'str'}, - 'orchestrator_version': {'key': 'properties.orchestratorVersion', 'type': 'str'}, - 'node_image_version': {'key': 'properties.nodeImageVersion', 'type': 'str'}, - 'upgrade_settings': {'key': 'properties.upgradeSettings', 'type': 'AgentPoolUpgradeSettings'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'availability_zones': {'key': 'properties.availabilityZones', 'type': '[str]'}, - 'enable_node_public_ip': {'key': 'properties.enableNodePublicIP', 'type': 'bool'}, - 'scale_set_priority': {'key': 'properties.scaleSetPriority', 'type': 'str'}, - 'scale_set_eviction_policy': {'key': 'properties.scaleSetEvictionPolicy', 'type': 'str'}, - 'spot_max_price': {'key': 'properties.spotMaxPrice', 'type': 'float'}, - 'tags': {'key': 'properties.tags', 'type': '{str}'}, - 'node_labels': {'key': 'properties.nodeLabels', 'type': '{str}'}, - 'node_taints': {'key': 'properties.nodeTaints', 'type': '[str]'}, - 'proximity_placement_group_id': {'key': 'properties.proximityPlacementGroupID', 'type': 'str'}, - } - - def __init__( + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "count": {"key": "properties.count", "type": "int"}, + "vm_size": {"key": "properties.vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "properties.osDiskSizeGB", "type": "int"}, + "vnet_subnet_id": {"key": "properties.vnetSubnetID", "type": "str"}, + "max_pods": {"key": "properties.maxPods", "type": "int"}, + "os_type": {"key": "properties.osType", "type": "str"}, + "max_count": {"key": "properties.maxCount", "type": "int"}, + "min_count": {"key": "properties.minCount", "type": "int"}, + "enable_auto_scaling": {"key": "properties.enableAutoScaling", "type": "bool"}, + "type_properties_type": {"key": "properties.type", "type": "str"}, + "mode": {"key": "properties.mode", "type": "str"}, + "orchestrator_version": {"key": "properties.orchestratorVersion", "type": "str"}, + "node_image_version": {"key": "properties.nodeImageVersion", "type": "str"}, + "upgrade_settings": {"key": "properties.upgradeSettings", "type": "AgentPoolUpgradeSettings"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "availability_zones": {"key": "properties.availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "properties.enableNodePublicIP", "type": "bool"}, + "scale_set_priority": {"key": "properties.scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "properties.scaleSetEvictionPolicy", "type": "str"}, + "spot_max_price": {"key": "properties.spotMaxPrice", "type": "float"}, + "tags": {"key": "properties.tags", "type": "{str}"}, + "node_labels": {"key": "properties.nodeLabels", "type": "{str}"}, + "node_taints": {"key": "properties.nodeTaints", "type": "[str]"}, + "proximity_placement_group_id": {"key": "properties.proximityPlacementGroupID", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, count: Optional[int] = None, @@ -219,7 +216,7 @@ def __init__( os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, @@ -230,9 +227,9 @@ def __init__( upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, - scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", - spot_max_price: Optional[float] = -1, + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", + spot_max_price: float = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, @@ -281,7 +278,7 @@ def __init__( "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :paramtype vm_size: str or ~azure.mgmt.containerservice.v2020_06_01.models.ContainerServiceVMSizeTypes :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every @@ -293,7 +290,7 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux" and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2020_06_01.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -302,10 +299,10 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword type_properties_type: AgentPoolType represents types of an agent pool. Known values - are: "VirtualMachineScaleSets", "AvailabilitySet". + are: "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type_properties_type: str or ~azure.mgmt.containerservice.v2020_06_01.models.AgentPoolType - :keyword mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", + :keyword mode: AgentPoolMode represents mode of an agent pool. Known values are: "System" and "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2020_06_01.models.AgentPoolMode :keyword orchestrator_version: Version of orchestrator specified when creating the managed @@ -322,20 +319,19 @@ def __init__( :keyword enable_node_public_ip: Enable public IP for nodes. :paramtype enable_node_public_ip: bool :keyword scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Known values are: "Spot", "Regular". Default value: "Regular". + priority. Default to regular. Known values are: "Spot" and "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_06_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction - policy for Spot virtual machine scale set. Default to Delete. Known values are: "Delete", - "Deallocate". Default value: "Delete". + policy for Spot virtual machine scale set. Default to Delete. Known values are: "Delete" and + "Deallocate". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_06_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: SpotMaxPrice to be used to specify the maximum price you are willing to pay in US Dollars. Possible values are any decimal value greater than zero or -1 which indicates default price to be up-to on-demand. :paramtype spot_max_price: float - :keyword tags: A set of tags. Agent pool tags to be persisted on the agent pool virtual machine - scale set. + :keyword tags: Agent pool tags to be persisted on the agent pool virtual machine scale set. :paramtype tags: dict[str, str] :keyword node_labels: Agent pool node labels to be persisted across all nodes in agent pool. :paramtype node_labels: dict[str, str] @@ -345,7 +341,7 @@ def __init__( :keyword proximity_placement_group_id: The ID for Proximity Placement Group. :paramtype proximity_placement_group_id: str """ - super(AgentPool, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.vm_size = vm_size self.os_disk_size_gb = os_disk_size_gb @@ -372,7 +368,7 @@ def __init__( self.proximity_placement_group_id = proximity_placement_group_id -class AgentPoolAvailableVersions(msrest.serialization.Model): +class AgentPoolAvailableVersions(_serialization.Model): """The list of available versions for an agent pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -389,16 +385,19 @@ class AgentPoolAvailableVersions(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'agent_pool_versions': {'key': 'properties.agentPoolVersions', 'type': '[AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "agent_pool_versions": { + "key": "properties.agentPoolVersions", + "type": "[AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem]", + }, } def __init__( @@ -412,14 +411,14 @@ def __init__( :paramtype agent_pool_versions: list[~azure.mgmt.containerservice.v2020_06_01.models.AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem] """ - super(AgentPoolAvailableVersions, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None self.agent_pool_versions = agent_pool_versions -class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(msrest.serialization.Model): +class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(_serialization.Model): """AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem. :ivar default: Whether this version is the default agent pool version. @@ -431,9 +430,9 @@ class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(msrest.serializa """ _attribute_map = { - 'default': {'key': 'default', 'type': 'bool'}, - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "default": {"key": "default", "type": "bool"}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } def __init__( @@ -452,13 +451,13 @@ def __init__( :keyword is_preview: Whether Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.default = default self.kubernetes_version = kubernetes_version self.is_preview = is_preview -class AgentPoolListResult(msrest.serialization.Model): +class AgentPoolListResult(_serialization.Model): """The response from the List Agent Pools operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -470,30 +469,25 @@ class AgentPoolListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[AgentPool]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[AgentPool]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.AgentPool"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.AgentPool"]] = None, **kwargs): """ :keyword value: The list of agent pools. :paramtype value: list[~azure.mgmt.containerservice.v2020_06_01.models.AgentPool] """ - super(AgentPoolListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class AgentPoolUpgradeProfile(msrest.serialization.Model): +class AgentPoolUpgradeProfile(_serialization.Model): """The list of available upgrades for an agent pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -506,10 +500,10 @@ class AgentPoolUpgradeProfile(msrest.serialization.Model): :vartype name: str :ivar type: Type of the agent pool upgrade profile. :vartype type: str - :ivar kubernetes_version: Required. Kubernetes version (major, minor, patch). + :ivar kubernetes_version: Kubernetes version (major, minor, patch). Required. :vartype kubernetes_version: str - :ivar os_type: Required. OsType to be used to specify os type. Choose from Linux and Windows. - Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to + Linux. Known values are: "Linux" and "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2020_06_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -520,21 +514,21 @@ class AgentPoolUpgradeProfile(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kubernetes_version': {'required': True}, - 'os_type': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "kubernetes_version": {"required": True}, + "os_type": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'kubernetes_version': {'key': 'properties.kubernetesVersion', 'type': 'str'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'upgrades': {'key': 'properties.upgrades', 'type': '[AgentPoolUpgradeProfilePropertiesUpgradesItem]'}, - 'latest_node_image_version': {'key': 'properties.latestNodeImageVersion', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "os_type": {"key": "properties.osType", "type": "str"}, + "upgrades": {"key": "properties.upgrades", "type": "[AgentPoolUpgradeProfilePropertiesUpgradesItem]"}, + "latest_node_image_version": {"key": "properties.latestNodeImageVersion", "type": "str"}, } def __init__( @@ -547,10 +541,10 @@ def __init__( **kwargs ): """ - :keyword kubernetes_version: Required. Kubernetes version (major, minor, patch). + :keyword kubernetes_version: Kubernetes version (major, minor, patch). Required. :paramtype kubernetes_version: str - :keyword os_type: Required. OsType to be used to specify os type. Choose from Linux and - Windows. Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default + to Linux. Known values are: "Linux" and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2020_06_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: @@ -559,7 +553,7 @@ def __init__( image version. :paramtype latest_node_image_version: str """ - super(AgentPoolUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -569,7 +563,7 @@ def __init__( self.latest_node_image_version = latest_node_image_version -class AgentPoolUpgradeProfilePropertiesUpgradesItem(msrest.serialization.Model): +class AgentPoolUpgradeProfilePropertiesUpgradesItem(_serialization.Model): """AgentPoolUpgradeProfilePropertiesUpgradesItem. :ivar kubernetes_version: Kubernetes version (major, minor, patch). @@ -579,29 +573,23 @@ class AgentPoolUpgradeProfilePropertiesUpgradesItem(msrest.serialization.Model): """ _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } - def __init__( - self, - *, - kubernetes_version: Optional[str] = None, - is_preview: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, kubernetes_version: Optional[str] = None, is_preview: Optional[bool] = None, **kwargs): """ :keyword kubernetes_version: Kubernetes version (major, minor, patch). :paramtype kubernetes_version: str :keyword is_preview: Whether Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(AgentPoolUpgradeProfilePropertiesUpgradesItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.is_preview = is_preview -class AgentPoolUpgradeSettings(msrest.serialization.Model): +class AgentPoolUpgradeSettings(_serialization.Model): """Settings for upgrading an agentpool. :ivar max_surge: Count or percentage of additional nodes to be added during upgrade. If empty @@ -610,25 +598,20 @@ class AgentPoolUpgradeSettings(msrest.serialization.Model): """ _attribute_map = { - 'max_surge': {'key': 'maxSurge', 'type': 'str'}, + "max_surge": {"key": "maxSurge", "type": "str"}, } - def __init__( - self, - *, - max_surge: Optional[str] = None, - **kwargs - ): + def __init__(self, *, max_surge: Optional[str] = None, **kwargs): """ :keyword max_surge: Count or percentage of additional nodes to be added during upgrade. If empty uses AKS default. :paramtype max_surge: str """ - super(AgentPoolUpgradeSettings, self).__init__(**kwargs) + super().__init__(**kwargs) self.max_surge = max_surge -class BaseManagedCluster(msrest.serialization.Model): +class BaseManagedCluster(_serialization.Model): # pylint: disable=too-many-instance-attributes """BaseManagedCluster. Variables are only populated by the server, and will be ignored when sending a request. @@ -692,34 +675,46 @@ class BaseManagedCluster(msrest.serialization.Model): """ _validation = { - 'provisioning_state': {'readonly': True}, - 'max_agent_pools': {'readonly': True}, - 'fqdn': {'readonly': True}, - 'private_fqdn': {'readonly': True}, + "provisioning_state": {"readonly": True}, + "max_agent_pools": {"readonly": True}, + "fqdn": {"readonly": True}, + "private_fqdn": {"readonly": True}, } _attribute_map = { - 'identity': {'key': 'identity', 'type': 'ManagedClusterIdentity'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'max_agent_pools': {'key': 'properties.maxAgentPools', 'type': 'int'}, - 'kubernetes_version': {'key': 'properties.kubernetesVersion', 'type': 'str'}, - 'dns_prefix': {'key': 'properties.dnsPrefix', 'type': 'str'}, - 'fqdn': {'key': 'properties.fqdn', 'type': 'str'}, - 'private_fqdn': {'key': 'properties.privateFQDN', 'type': 'str'}, - 'agent_pool_profiles': {'key': 'properties.agentPoolProfiles', 'type': '[ManagedClusterAgentPoolProfile]'}, - 'linux_profile': {'key': 'properties.linuxProfile', 'type': 'ContainerServiceLinuxProfile'}, - 'windows_profile': {'key': 'properties.windowsProfile', 'type': 'ManagedClusterWindowsProfile'}, - 'service_principal_profile': {'key': 'properties.servicePrincipalProfile', 'type': 'ManagedClusterServicePrincipalProfile'}, - 'addon_profiles': {'key': 'properties.addonProfiles', 'type': '{ManagedClusterAddonProfile}'}, - 'node_resource_group': {'key': 'properties.nodeResourceGroup', 'type': 'str'}, - 'enable_rbac': {'key': 'properties.enableRBAC', 'type': 'bool'}, - 'enable_pod_security_policy': {'key': 'properties.enablePodSecurityPolicy', 'type': 'bool'}, - 'network_profile': {'key': 'properties.networkProfile', 'type': 'ContainerServiceNetworkProfile'}, - 'aad_profile': {'key': 'properties.aadProfile', 'type': 'ManagedClusterAADProfile'}, - 'auto_scaler_profile': {'key': 'properties.autoScalerProfile', 'type': 'ManagedClusterPropertiesAutoScalerProfile'}, - 'api_server_access_profile': {'key': 'properties.apiServerAccessProfile', 'type': 'ManagedClusterAPIServerAccessProfile'}, - 'disk_encryption_set_id': {'key': 'properties.diskEncryptionSetID', 'type': 'str'}, - 'identity_profile': {'key': 'properties.identityProfile', 'type': '{ManagedClusterPropertiesIdentityProfileValue}'}, + "identity": {"key": "identity", "type": "ManagedClusterIdentity"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "max_agent_pools": {"key": "properties.maxAgentPools", "type": "int"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "dns_prefix": {"key": "properties.dnsPrefix", "type": "str"}, + "fqdn": {"key": "properties.fqdn", "type": "str"}, + "private_fqdn": {"key": "properties.privateFQDN", "type": "str"}, + "agent_pool_profiles": {"key": "properties.agentPoolProfiles", "type": "[ManagedClusterAgentPoolProfile]"}, + "linux_profile": {"key": "properties.linuxProfile", "type": "ContainerServiceLinuxProfile"}, + "windows_profile": {"key": "properties.windowsProfile", "type": "ManagedClusterWindowsProfile"}, + "service_principal_profile": { + "key": "properties.servicePrincipalProfile", + "type": "ManagedClusterServicePrincipalProfile", + }, + "addon_profiles": {"key": "properties.addonProfiles", "type": "{ManagedClusterAddonProfile}"}, + "node_resource_group": {"key": "properties.nodeResourceGroup", "type": "str"}, + "enable_rbac": {"key": "properties.enableRBAC", "type": "bool"}, + "enable_pod_security_policy": {"key": "properties.enablePodSecurityPolicy", "type": "bool"}, + "network_profile": {"key": "properties.networkProfile", "type": "ContainerServiceNetworkProfile"}, + "aad_profile": {"key": "properties.aadProfile", "type": "ManagedClusterAADProfile"}, + "auto_scaler_profile": { + "key": "properties.autoScalerProfile", + "type": "ManagedClusterPropertiesAutoScalerProfile", + }, + "api_server_access_profile": { + "key": "properties.apiServerAccessProfile", + "type": "ManagedClusterAPIServerAccessProfile", + }, + "disk_encryption_set_id": {"key": "properties.diskEncryptionSetID", "type": "str"}, + "identity_profile": { + "key": "properties.identityProfile", + "type": "{ManagedClusterPropertiesIdentityProfileValue}", + }, } def __init__( @@ -794,7 +789,7 @@ def __init__( :paramtype identity_profile: dict[str, ~azure.mgmt.containerservice.v2020_06_01.models.ManagedClusterPropertiesIdentityProfileValue] """ - super(BaseManagedCluster, self).__init__(**kwargs) + super().__init__(**kwargs) self.identity = identity self.provisioning_state = None self.max_agent_pools = None @@ -818,7 +813,7 @@ def __init__( self.identity_profile = identity_profile -class CloudErrorBody(msrest.serialization.Model): +class CloudErrorBody(_serialization.Model): """An error response from the Container service. :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed @@ -835,10 +830,10 @@ class CloudErrorBody(msrest.serialization.Model): """ _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[CloudErrorBody]"}, } def __init__( @@ -863,87 +858,76 @@ def __init__( :keyword details: A list of additional details about the error. :paramtype details: list[~azure.mgmt.containerservice.v2020_06_01.models.CloudErrorBody] """ - super(CloudErrorBody, self).__init__(**kwargs) + super().__init__(**kwargs) self.code = code self.message = message self.target = target self.details = details -class ContainerServiceDiagnosticsProfile(msrest.serialization.Model): +class ContainerServiceDiagnosticsProfile(_serialization.Model): """Profile for diagnostics on the container service cluster. All required parameters must be populated in order to send to Azure. - :ivar vm_diagnostics: Required. Profile for diagnostics on the container service VMs. + :ivar vm_diagnostics: Profile for diagnostics on the container service VMs. Required. :vartype vm_diagnostics: ~azure.mgmt.containerservice.v2020_06_01.models.ContainerServiceVMDiagnostics """ _validation = { - 'vm_diagnostics': {'required': True}, + "vm_diagnostics": {"required": True}, } _attribute_map = { - 'vm_diagnostics': {'key': 'vmDiagnostics', 'type': 'ContainerServiceVMDiagnostics'}, + "vm_diagnostics": {"key": "vmDiagnostics", "type": "ContainerServiceVMDiagnostics"}, } - def __init__( - self, - *, - vm_diagnostics: "_models.ContainerServiceVMDiagnostics", - **kwargs - ): + def __init__(self, *, vm_diagnostics: "_models.ContainerServiceVMDiagnostics", **kwargs): """ - :keyword vm_diagnostics: Required. Profile for diagnostics on the container service VMs. + :keyword vm_diagnostics: Profile for diagnostics on the container service VMs. Required. :paramtype vm_diagnostics: ~azure.mgmt.containerservice.v2020_06_01.models.ContainerServiceVMDiagnostics """ - super(ContainerServiceDiagnosticsProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.vm_diagnostics = vm_diagnostics -class ContainerServiceLinuxProfile(msrest.serialization.Model): +class ContainerServiceLinuxProfile(_serialization.Model): """Profile for Linux VMs in the container service cluster. All required parameters must be populated in order to send to Azure. - :ivar admin_username: Required. The administrator username to use for Linux VMs. + :ivar admin_username: The administrator username to use for Linux VMs. Required. :vartype admin_username: str - :ivar ssh: Required. SSH configuration for Linux-based VMs running on Azure. + :ivar ssh: SSH configuration for Linux-based VMs running on Azure. Required. :vartype ssh: ~azure.mgmt.containerservice.v2020_06_01.models.ContainerServiceSshConfiguration """ _validation = { - 'admin_username': {'required': True, 'pattern': r'^[A-Za-z][-A-Za-z0-9_]*$'}, - 'ssh': {'required': True}, + "admin_username": {"required": True, "pattern": r"^[A-Za-z][-A-Za-z0-9_]*$"}, + "ssh": {"required": True}, } _attribute_map = { - 'admin_username': {'key': 'adminUsername', 'type': 'str'}, - 'ssh': {'key': 'ssh', 'type': 'ContainerServiceSshConfiguration'}, + "admin_username": {"key": "adminUsername", "type": "str"}, + "ssh": {"key": "ssh", "type": "ContainerServiceSshConfiguration"}, } - def __init__( - self, - *, - admin_username: str, - ssh: "_models.ContainerServiceSshConfiguration", - **kwargs - ): + def __init__(self, *, admin_username: str, ssh: "_models.ContainerServiceSshConfiguration", **kwargs): """ - :keyword admin_username: Required. The administrator username to use for Linux VMs. + :keyword admin_username: The administrator username to use for Linux VMs. Required. :paramtype admin_username: str - :keyword ssh: Required. SSH configuration for Linux-based VMs running on Azure. + :keyword ssh: SSH configuration for Linux-based VMs running on Azure. Required. :paramtype ssh: ~azure.mgmt.containerservice.v2020_06_01.models.ContainerServiceSshConfiguration """ - super(ContainerServiceLinuxProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.admin_username = admin_username self.ssh = ssh -class ContainerServiceMasterProfile(msrest.serialization.Model): +class ContainerServiceMasterProfile(_serialization.Model): """Profile for the container service master. Variables are only populated by the server, and will be ignored when sending a request. @@ -951,11 +935,11 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar count: Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, - and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". + and 5. The default value is 1. Known values are: 1, 3, and 5. :vartype count: int or ~azure.mgmt.containerservice.v2020_06_01.models.Count - :ivar dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. + :ivar dns_prefix: DNS prefix to be used to create the FQDN for the master pool. Required. :vartype dns_prefix: str - :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + :ivar vm_size: Size of agent VMs. Required. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -992,7 +976,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :vartype vm_size: str or ~azure.mgmt.containerservice.v2020_06_01.models.ContainerServiceVMSizeTypes :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine @@ -1006,7 +990,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): :vartype first_consecutive_static_ip: str :ivar storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount" and "ManagedDisks". :vartype storage_profile: str or ~azure.mgmt.containerservice.v2020_06_01.models.ContainerServiceStorageProfileTypes :ivar fqdn: FQDN for the master pool. @@ -1014,21 +998,21 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): """ _validation = { - 'dns_prefix': {'required': True}, - 'vm_size': {'required': True}, - 'os_disk_size_gb': {'maximum': 1023, 'minimum': 0}, - 'fqdn': {'readonly': True}, + "dns_prefix": {"required": True}, + "vm_size": {"required": True}, + "os_disk_size_gb": {"maximum": 1023, "minimum": 0}, + "fqdn": {"readonly": True}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'dns_prefix': {'key': 'dnsPrefix', 'type': 'str'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'first_consecutive_static_ip': {'key': 'firstConsecutiveStaticIP', 'type': 'str'}, - 'storage_profile': {'key': 'storageProfile', 'type': 'str'}, - 'fqdn': {'key': 'fqdn', 'type': 'str'}, + "count": {"key": "count", "type": "int"}, + "dns_prefix": {"key": "dnsPrefix", "type": "str"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "first_consecutive_static_ip": {"key": "firstConsecutiveStaticIP", "type": "str"}, + "storage_profile": {"key": "storageProfile", "type": "str"}, + "fqdn": {"key": "fqdn", "type": "str"}, } def __init__( @@ -1036,20 +1020,20 @@ def __init__( *, dns_prefix: str, vm_size: Union[str, "_models.ContainerServiceVMSizeTypes"], - count: Optional[Union[int, "_models.Count"]] = 1, + count: Union[int, "_models.Count"] = 1, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, - first_consecutive_static_ip: Optional[str] = "10.240.255.5", + first_consecutive_static_ip: str = "10.240.255.5", storage_profile: Optional[Union[str, "_models.ContainerServiceStorageProfileTypes"]] = None, **kwargs ): """ :keyword count: Number of masters (VMs) in the container service cluster. Allowed values are 1, - 3, and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". + 3, and 5. The default value is 1. Known values are: 1, 3, and 5. :paramtype count: int or ~azure.mgmt.containerservice.v2020_06_01.models.Count - :keyword dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. + :keyword dns_prefix: DNS prefix to be used to create the FQDN for the master pool. Required. :paramtype dns_prefix: str - :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + :keyword vm_size: Size of agent VMs. Required. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -1086,7 +1070,7 @@ def __init__( "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :paramtype vm_size: str or ~azure.mgmt.containerservice.v2020_06_01.models.ContainerServiceVMSizeTypes :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every @@ -1100,11 +1084,11 @@ def __init__( :paramtype first_consecutive_static_ip: str :keyword storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount" and "ManagedDisks". :paramtype storage_profile: str or ~azure.mgmt.containerservice.v2020_06_01.models.ContainerServiceStorageProfileTypes """ - super(ContainerServiceMasterProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.dns_prefix = dns_prefix self.vm_size = vm_size @@ -1115,17 +1099,17 @@ def __init__( self.fqdn = None -class ContainerServiceNetworkProfile(msrest.serialization.Model): +class ContainerServiceNetworkProfile(_serialization.Model): """Profile of network configuration. :ivar network_plugin: Network plugin used for building Kubernetes network. Known values are: - "azure", "kubenet". Default value: "kubenet". + "azure" and "kubenet". :vartype network_plugin: str or ~azure.mgmt.containerservice.v2020_06_01.models.NetworkPlugin :ivar network_policy: Network policy used for building Kubernetes network. Known values are: - "calico", "azure". + "calico" and "azure". :vartype network_policy: str or ~azure.mgmt.containerservice.v2020_06_01.models.NetworkPolicy :ivar network_mode: Network mode used for building Kubernetes network. Known values are: - "transparent", "bridge". + "transparent" and "bridge". :vartype network_mode: str or ~azure.mgmt.containerservice.v2020_06_01.models.NetworkMode :ivar pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :vartype pod_cidr: str @@ -1138,11 +1122,11 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): :ivar docker_bridge_cidr: A CIDR notation IP range assigned to the Docker bridge network. It must not overlap with any Subnet IP ranges or the Kubernetes service address range. :vartype docker_bridge_cidr: str - :ivar outbound_type: The outbound (egress) routing method. Known values are: "loadBalancer", - "userDefinedRouting". Default value: "loadBalancer". + :ivar outbound_type: The outbound (egress) routing method. Known values are: "loadBalancer" and + "userDefinedRouting". :vartype outbound_type: str or ~azure.mgmt.containerservice.v2020_06_01.models.OutboundType :ivar load_balancer_sku: The load balancer sku for the managed cluster. Known values are: - "standard", "basic". + "standard" and "basic". :vartype load_balancer_sku: str or ~azure.mgmt.containerservice.v2020_06_01.models.LoadBalancerSku :ivar load_balancer_profile: Profile of the cluster load balancer. @@ -1151,49 +1135,51 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): """ _validation = { - 'pod_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, - 'service_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, - 'dns_service_ip': {'pattern': r'^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$'}, - 'docker_bridge_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, + "pod_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, + "service_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, + "dns_service_ip": { + "pattern": r"^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$" + }, + "docker_bridge_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, } _attribute_map = { - 'network_plugin': {'key': 'networkPlugin', 'type': 'str'}, - 'network_policy': {'key': 'networkPolicy', 'type': 'str'}, - 'network_mode': {'key': 'networkMode', 'type': 'str'}, - 'pod_cidr': {'key': 'podCidr', 'type': 'str'}, - 'service_cidr': {'key': 'serviceCidr', 'type': 'str'}, - 'dns_service_ip': {'key': 'dnsServiceIP', 'type': 'str'}, - 'docker_bridge_cidr': {'key': 'dockerBridgeCidr', 'type': 'str'}, - 'outbound_type': {'key': 'outboundType', 'type': 'str'}, - 'load_balancer_sku': {'key': 'loadBalancerSku', 'type': 'str'}, - 'load_balancer_profile': {'key': 'loadBalancerProfile', 'type': 'ManagedClusterLoadBalancerProfile'}, + "network_plugin": {"key": "networkPlugin", "type": "str"}, + "network_policy": {"key": "networkPolicy", "type": "str"}, + "network_mode": {"key": "networkMode", "type": "str"}, + "pod_cidr": {"key": "podCidr", "type": "str"}, + "service_cidr": {"key": "serviceCidr", "type": "str"}, + "dns_service_ip": {"key": "dnsServiceIP", "type": "str"}, + "docker_bridge_cidr": {"key": "dockerBridgeCidr", "type": "str"}, + "outbound_type": {"key": "outboundType", "type": "str"}, + "load_balancer_sku": {"key": "loadBalancerSku", "type": "str"}, + "load_balancer_profile": {"key": "loadBalancerProfile", "type": "ManagedClusterLoadBalancerProfile"}, } def __init__( self, *, - network_plugin: Optional[Union[str, "_models.NetworkPlugin"]] = "kubenet", + network_plugin: Union[str, "_models.NetworkPlugin"] = "kubenet", network_policy: Optional[Union[str, "_models.NetworkPolicy"]] = None, network_mode: Optional[Union[str, "_models.NetworkMode"]] = None, - pod_cidr: Optional[str] = "10.244.0.0/16", - service_cidr: Optional[str] = "10.0.0.0/16", - dns_service_ip: Optional[str] = "10.0.0.10", - docker_bridge_cidr: Optional[str] = "172.17.0.1/16", - outbound_type: Optional[Union[str, "_models.OutboundType"]] = "loadBalancer", + pod_cidr: str = "10.244.0.0/16", + service_cidr: str = "10.0.0.0/16", + dns_service_ip: str = "10.0.0.10", + docker_bridge_cidr: str = "172.17.0.1/16", + outbound_type: Union[str, "_models.OutboundType"] = "loadBalancer", load_balancer_sku: Optional[Union[str, "_models.LoadBalancerSku"]] = None, load_balancer_profile: Optional["_models.ManagedClusterLoadBalancerProfile"] = None, **kwargs ): """ :keyword network_plugin: Network plugin used for building Kubernetes network. Known values are: - "azure", "kubenet". Default value: "kubenet". + "azure" and "kubenet". :paramtype network_plugin: str or ~azure.mgmt.containerservice.v2020_06_01.models.NetworkPlugin :keyword network_policy: Network policy used for building Kubernetes network. Known values are: - "calico", "azure". + "calico" and "azure". :paramtype network_policy: str or ~azure.mgmt.containerservice.v2020_06_01.models.NetworkPolicy :keyword network_mode: Network mode used for building Kubernetes network. Known values are: - "transparent", "bridge". + "transparent" and "bridge". :paramtype network_mode: str or ~azure.mgmt.containerservice.v2020_06_01.models.NetworkMode :keyword pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :paramtype pod_cidr: str @@ -1206,18 +1192,18 @@ def __init__( :keyword docker_bridge_cidr: A CIDR notation IP range assigned to the Docker bridge network. It must not overlap with any Subnet IP ranges or the Kubernetes service address range. :paramtype docker_bridge_cidr: str - :keyword outbound_type: The outbound (egress) routing method. Known values are: "loadBalancer", - "userDefinedRouting". Default value: "loadBalancer". + :keyword outbound_type: The outbound (egress) routing method. Known values are: "loadBalancer" + and "userDefinedRouting". :paramtype outbound_type: str or ~azure.mgmt.containerservice.v2020_06_01.models.OutboundType :keyword load_balancer_sku: The load balancer sku for the managed cluster. Known values are: - "standard", "basic". + "standard" and "basic". :paramtype load_balancer_sku: str or ~azure.mgmt.containerservice.v2020_06_01.models.LoadBalancerSku :keyword load_balancer_profile: Profile of the cluster load balancer. :paramtype load_balancer_profile: ~azure.mgmt.containerservice.v2020_06_01.models.ManagedClusterLoadBalancerProfile """ - super(ContainerServiceNetworkProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.network_plugin = network_plugin self.network_policy = network_policy self.network_mode = network_mode @@ -1230,113 +1216,98 @@ def __init__( self.load_balancer_profile = load_balancer_profile -class ContainerServiceSshConfiguration(msrest.serialization.Model): +class ContainerServiceSshConfiguration(_serialization.Model): """SSH configuration for Linux-based VMs running on Azure. All required parameters must be populated in order to send to Azure. - :ivar public_keys: Required. The list of SSH public keys used to authenticate with Linux-based - VMs. Only expect one key specified. + :ivar public_keys: The list of SSH public keys used to authenticate with Linux-based VMs. Only + expect one key specified. Required. :vartype public_keys: list[~azure.mgmt.containerservice.v2020_06_01.models.ContainerServiceSshPublicKey] """ _validation = { - 'public_keys': {'required': True}, + "public_keys": {"required": True}, } _attribute_map = { - 'public_keys': {'key': 'publicKeys', 'type': '[ContainerServiceSshPublicKey]'}, + "public_keys": {"key": "publicKeys", "type": "[ContainerServiceSshPublicKey]"}, } - def __init__( - self, - *, - public_keys: List["_models.ContainerServiceSshPublicKey"], - **kwargs - ): + def __init__(self, *, public_keys: List["_models.ContainerServiceSshPublicKey"], **kwargs): """ - :keyword public_keys: Required. The list of SSH public keys used to authenticate with - Linux-based VMs. Only expect one key specified. + :keyword public_keys: The list of SSH public keys used to authenticate with Linux-based VMs. + Only expect one key specified. Required. :paramtype public_keys: list[~azure.mgmt.containerservice.v2020_06_01.models.ContainerServiceSshPublicKey] """ - super(ContainerServiceSshConfiguration, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_keys = public_keys -class ContainerServiceSshPublicKey(msrest.serialization.Model): +class ContainerServiceSshPublicKey(_serialization.Model): """Contains information about SSH certificate public key data. All required parameters must be populated in order to send to Azure. - :ivar key_data: Required. Certificate public key used to authenticate with VMs through SSH. The - certificate must be in PEM format with or without headers. + :ivar key_data: Certificate public key used to authenticate with VMs through SSH. The + certificate must be in PEM format with or without headers. Required. :vartype key_data: str """ _validation = { - 'key_data': {'required': True}, + "key_data": {"required": True}, } _attribute_map = { - 'key_data': {'key': 'keyData', 'type': 'str'}, + "key_data": {"key": "keyData", "type": "str"}, } - def __init__( - self, - *, - key_data: str, - **kwargs - ): + def __init__(self, *, key_data: str, **kwargs): """ - :keyword key_data: Required. Certificate public key used to authenticate with VMs through SSH. - The certificate must be in PEM format with or without headers. + :keyword key_data: Certificate public key used to authenticate with VMs through SSH. The + certificate must be in PEM format with or without headers. Required. :paramtype key_data: str """ - super(ContainerServiceSshPublicKey, self).__init__(**kwargs) + super().__init__(**kwargs) self.key_data = key_data -class ContainerServiceVMDiagnostics(msrest.serialization.Model): +class ContainerServiceVMDiagnostics(_serialization.Model): """Profile for diagnostics on the container service VMs. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar enabled: Required. Whether the VM diagnostic agent is provisioned on the VM. + :ivar enabled: Whether the VM diagnostic agent is provisioned on the VM. Required. :vartype enabled: bool :ivar storage_uri: The URI of the storage account where diagnostics are stored. :vartype storage_uri: str """ _validation = { - 'enabled': {'required': True}, - 'storage_uri': {'readonly': True}, + "enabled": {"required": True}, + "storage_uri": {"readonly": True}, } _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'storage_uri': {'key': 'storageUri', 'type': 'str'}, + "enabled": {"key": "enabled", "type": "bool"}, + "storage_uri": {"key": "storageUri", "type": "str"}, } - def __init__( - self, - *, - enabled: bool, - **kwargs - ): + def __init__(self, *, enabled: bool, **kwargs): """ - :keyword enabled: Required. Whether the VM diagnostic agent is provisioned on the VM. + :keyword enabled: Whether the VM diagnostic agent is provisioned on the VM. Required. :paramtype enabled: bool """ - super(ContainerServiceVMDiagnostics, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.storage_uri = None -class CredentialResult(msrest.serialization.Model): +class CredentialResult(_serialization.Model): """The credential result response. Variables are only populated by the server, and will be ignored when sending a request. @@ -1344,31 +1315,27 @@ class CredentialResult(msrest.serialization.Model): :ivar name: The name of the credential. :vartype name: str :ivar value: Base64-encoded Kubernetes configuration file. - :vartype value: bytearray + :vartype value: bytes """ _validation = { - 'name': {'readonly': True}, - 'value': {'readonly': True}, + "name": {"readonly": True}, + "value": {"readonly": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'bytearray'}, + "name": {"key": "name", "type": "str"}, + "value": {"key": "value", "type": "bytearray"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(CredentialResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.name = None self.value = None -class CredentialResults(msrest.serialization.Model): +class CredentialResults(_serialization.Model): """The list of credential result response. Variables are only populated by the server, and will be ignored when sending a request. @@ -1378,24 +1345,20 @@ class CredentialResults(msrest.serialization.Model): """ _validation = { - 'kubeconfigs': {'readonly': True}, + "kubeconfigs": {"readonly": True}, } _attribute_map = { - 'kubeconfigs': {'key': 'kubeconfigs', 'type': '[CredentialResult]'}, + "kubeconfigs": {"key": "kubeconfigs", "type": "[CredentialResult]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(CredentialResults, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.kubeconfigs = None -class Resource(msrest.serialization.Model): +class Resource(_serialization.Model): """The Resource model definition. Variables are only populated by the server, and will be ignored when sending a request. @@ -1408,41 +1371,35 @@ class Resource(msrest.serialization.Model): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] """ - super(Resource, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -1450,7 +1407,7 @@ def __init__( self.tags = tags -class ManagedCluster(Resource, BaseManagedCluster): +class ManagedCluster(Resource, BaseManagedCluster): # pylint: disable=too-many-instance-attributes """Managed cluster. Variables are only populated by the server, and will be ignored when sending a request. @@ -1519,56 +1476,68 @@ class ManagedCluster(Resource, BaseManagedCluster): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar sku: The managed cluster SKU. :vartype sku: ~azure.mgmt.containerservice.v2020_06_01.models.ManagedClusterSKU """ _validation = { - 'provisioning_state': {'readonly': True}, - 'max_agent_pools': {'readonly': True}, - 'fqdn': {'readonly': True}, - 'private_fqdn': {'readonly': True}, - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, + "provisioning_state": {"readonly": True}, + "max_agent_pools": {"readonly": True}, + "fqdn": {"readonly": True}, + "private_fqdn": {"readonly": True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { - 'identity': {'key': 'identity', 'type': 'ManagedClusterIdentity'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'max_agent_pools': {'key': 'properties.maxAgentPools', 'type': 'int'}, - 'kubernetes_version': {'key': 'properties.kubernetesVersion', 'type': 'str'}, - 'dns_prefix': {'key': 'properties.dnsPrefix', 'type': 'str'}, - 'fqdn': {'key': 'properties.fqdn', 'type': 'str'}, - 'private_fqdn': {'key': 'properties.privateFQDN', 'type': 'str'}, - 'agent_pool_profiles': {'key': 'properties.agentPoolProfiles', 'type': '[ManagedClusterAgentPoolProfile]'}, - 'linux_profile': {'key': 'properties.linuxProfile', 'type': 'ContainerServiceLinuxProfile'}, - 'windows_profile': {'key': 'properties.windowsProfile', 'type': 'ManagedClusterWindowsProfile'}, - 'service_principal_profile': {'key': 'properties.servicePrincipalProfile', 'type': 'ManagedClusterServicePrincipalProfile'}, - 'addon_profiles': {'key': 'properties.addonProfiles', 'type': '{ManagedClusterAddonProfile}'}, - 'node_resource_group': {'key': 'properties.nodeResourceGroup', 'type': 'str'}, - 'enable_rbac': {'key': 'properties.enableRBAC', 'type': 'bool'}, - 'enable_pod_security_policy': {'key': 'properties.enablePodSecurityPolicy', 'type': 'bool'}, - 'network_profile': {'key': 'properties.networkProfile', 'type': 'ContainerServiceNetworkProfile'}, - 'aad_profile': {'key': 'properties.aadProfile', 'type': 'ManagedClusterAADProfile'}, - 'auto_scaler_profile': {'key': 'properties.autoScalerProfile', 'type': 'ManagedClusterPropertiesAutoScalerProfile'}, - 'api_server_access_profile': {'key': 'properties.apiServerAccessProfile', 'type': 'ManagedClusterAPIServerAccessProfile'}, - 'disk_encryption_set_id': {'key': 'properties.diskEncryptionSetID', 'type': 'str'}, - 'identity_profile': {'key': 'properties.identityProfile', 'type': '{ManagedClusterPropertiesIdentityProfileValue}'}, - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'ManagedClusterSKU'}, - } - - def __init__( + "identity": {"key": "identity", "type": "ManagedClusterIdentity"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "max_agent_pools": {"key": "properties.maxAgentPools", "type": "int"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "dns_prefix": {"key": "properties.dnsPrefix", "type": "str"}, + "fqdn": {"key": "properties.fqdn", "type": "str"}, + "private_fqdn": {"key": "properties.privateFQDN", "type": "str"}, + "agent_pool_profiles": {"key": "properties.agentPoolProfiles", "type": "[ManagedClusterAgentPoolProfile]"}, + "linux_profile": {"key": "properties.linuxProfile", "type": "ContainerServiceLinuxProfile"}, + "windows_profile": {"key": "properties.windowsProfile", "type": "ManagedClusterWindowsProfile"}, + "service_principal_profile": { + "key": "properties.servicePrincipalProfile", + "type": "ManagedClusterServicePrincipalProfile", + }, + "addon_profiles": {"key": "properties.addonProfiles", "type": "{ManagedClusterAddonProfile}"}, + "node_resource_group": {"key": "properties.nodeResourceGroup", "type": "str"}, + "enable_rbac": {"key": "properties.enableRBAC", "type": "bool"}, + "enable_pod_security_policy": {"key": "properties.enablePodSecurityPolicy", "type": "bool"}, + "network_profile": {"key": "properties.networkProfile", "type": "ContainerServiceNetworkProfile"}, + "aad_profile": {"key": "properties.aadProfile", "type": "ManagedClusterAADProfile"}, + "auto_scaler_profile": { + "key": "properties.autoScalerProfile", + "type": "ManagedClusterPropertiesAutoScalerProfile", + }, + "api_server_access_profile": { + "key": "properties.apiServerAccessProfile", + "type": "ManagedClusterAPIServerAccessProfile", + }, + "disk_encryption_set_id": {"key": "properties.diskEncryptionSetID", "type": "str"}, + "identity_profile": { + "key": "properties.identityProfile", + "type": "{ManagedClusterPropertiesIdentityProfileValue}", + }, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "sku": {"key": "sku", "type": "ManagedClusterSKU"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, location: str, @@ -1642,14 +1611,35 @@ def __init__( :keyword identity_profile: Identities associated with the cluster. :paramtype identity_profile: dict[str, ~azure.mgmt.containerservice.v2020_06_01.models.ManagedClusterPropertiesIdentityProfileValue] - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword sku: The managed cluster SKU. :paramtype sku: ~azure.mgmt.containerservice.v2020_06_01.models.ManagedClusterSKU """ - super(ManagedCluster, self).__init__(location=location, tags=tags, identity=identity, kubernetes_version=kubernetes_version, dns_prefix=dns_prefix, agent_pool_profiles=agent_pool_profiles, linux_profile=linux_profile, windows_profile=windows_profile, service_principal_profile=service_principal_profile, addon_profiles=addon_profiles, node_resource_group=node_resource_group, enable_rbac=enable_rbac, enable_pod_security_policy=enable_pod_security_policy, network_profile=network_profile, aad_profile=aad_profile, auto_scaler_profile=auto_scaler_profile, api_server_access_profile=api_server_access_profile, disk_encryption_set_id=disk_encryption_set_id, identity_profile=identity_profile, **kwargs) + super().__init__( + location=location, + tags=tags, + identity=identity, + kubernetes_version=kubernetes_version, + dns_prefix=dns_prefix, + agent_pool_profiles=agent_pool_profiles, + linux_profile=linux_profile, + windows_profile=windows_profile, + service_principal_profile=service_principal_profile, + addon_profiles=addon_profiles, + node_resource_group=node_resource_group, + enable_rbac=enable_rbac, + enable_pod_security_policy=enable_pod_security_policy, + network_profile=network_profile, + aad_profile=aad_profile, + auto_scaler_profile=auto_scaler_profile, + api_server_access_profile=api_server_access_profile, + disk_encryption_set_id=disk_encryption_set_id, + identity_profile=identity_profile, + **kwargs + ) self.identity = identity self.provisioning_state = None self.max_agent_pools = None @@ -1679,7 +1669,7 @@ def __init__( self.tags = tags -class ManagedClusterAADProfile(msrest.serialization.Model): +class ManagedClusterAADProfile(_serialization.Model): """AADProfile specifies attributes for Azure Active Directory integration. :ivar managed: Whether to enable managed AAD. @@ -1700,13 +1690,13 @@ class ManagedClusterAADProfile(msrest.serialization.Model): """ _attribute_map = { - 'managed': {'key': 'managed', 'type': 'bool'}, - 'enable_azure_rbac': {'key': 'enableAzureRBAC', 'type': 'bool'}, - 'admin_group_object_i_ds': {'key': 'adminGroupObjectIDs', 'type': '[str]'}, - 'client_app_id': {'key': 'clientAppID', 'type': 'str'}, - 'server_app_id': {'key': 'serverAppID', 'type': 'str'}, - 'server_app_secret': {'key': 'serverAppSecret', 'type': 'str'}, - 'tenant_id': {'key': 'tenantID', 'type': 'str'}, + "managed": {"key": "managed", "type": "bool"}, + "enable_azure_rbac": {"key": "enableAzureRBAC", "type": "bool"}, + "admin_group_object_i_ds": {"key": "adminGroupObjectIDs", "type": "[str]"}, + "client_app_id": {"key": "clientAppID", "type": "str"}, + "server_app_id": {"key": "serverAppID", "type": "str"}, + "server_app_secret": {"key": "serverAppSecret", "type": "str"}, + "tenant_id": {"key": "tenantID", "type": "str"}, } def __init__( @@ -1739,7 +1729,7 @@ def __init__( tenant of the deployment subscription. :paramtype tenant_id: str """ - super(ManagedClusterAADProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.managed = managed self.enable_azure_rbac = enable_azure_rbac self.admin_group_object_i_ds = admin_group_object_i_ds @@ -1762,58 +1752,53 @@ class ManagedClusterAccessProfile(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar kube_config: Base64-encoded Kubernetes configuration file. - :vartype kube_config: bytearray + :vartype kube_config: bytes """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'kube_config': {'key': 'properties.kubeConfig', 'type': 'bytearray'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "kube_config": {"key": "properties.kubeConfig", "type": "bytearray"}, } def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - kube_config: Optional[bytearray] = None, - **kwargs + self, *, location: str, tags: Optional[Dict[str, str]] = None, kube_config: Optional[bytes] = None, **kwargs ): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword kube_config: Base64-encoded Kubernetes configuration file. - :paramtype kube_config: bytearray + :paramtype kube_config: bytes """ - super(ManagedClusterAccessProfile, self).__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.kube_config = kube_config -class ManagedClusterAddonProfile(msrest.serialization.Model): +class ManagedClusterAddonProfile(_serialization.Model): """A Kubernetes add-on profile for a managed cluster. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar enabled: Required. Whether the add-on is enabled or not. + :ivar enabled: Whether the add-on is enabled or not. Required. :vartype enabled: bool :ivar config: Key-value pairs for configuring an add-on. :vartype config: dict[str, str] @@ -1823,36 +1808,30 @@ class ManagedClusterAddonProfile(msrest.serialization.Model): """ _validation = { - 'enabled': {'required': True}, - 'identity': {'readonly': True}, + "enabled": {"required": True}, + "identity": {"readonly": True}, } _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'config': {'key': 'config', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'ManagedClusterAddonProfileIdentity'}, + "enabled": {"key": "enabled", "type": "bool"}, + "config": {"key": "config", "type": "{str}"}, + "identity": {"key": "identity", "type": "ManagedClusterAddonProfileIdentity"}, } - def __init__( - self, - *, - enabled: bool, - config: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, enabled: bool, config: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword enabled: Required. Whether the add-on is enabled or not. + :keyword enabled: Whether the add-on is enabled or not. Required. :paramtype enabled: bool :keyword config: Key-value pairs for configuring an add-on. :paramtype config: dict[str, str] """ - super(ManagedClusterAddonProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.config = config self.identity = None -class UserAssignedIdentity(msrest.serialization.Model): +class UserAssignedIdentity(_serialization.Model): """UserAssignedIdentity. :ivar resource_id: The resource id of the user assigned identity. @@ -1864,9 +1843,9 @@ class UserAssignedIdentity(msrest.serialization.Model): """ _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'object_id': {'key': 'objectId', 'type': 'str'}, + "resource_id": {"key": "resourceId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + "object_id": {"key": "objectId", "type": "str"}, } def __init__( @@ -1885,7 +1864,7 @@ def __init__( :keyword object_id: The object id of the user assigned identity. :paramtype object_id: str """ - super(UserAssignedIdentity, self).__init__(**kwargs) + super().__init__(**kwargs) self.resource_id = resource_id self.client_id = client_id self.object_id = object_id @@ -1903,9 +1882,9 @@ class ManagedClusterAddonProfileIdentity(UserAssignedIdentity): """ _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'object_id': {'key': 'objectId', 'type': 'str'}, + "resource_id": {"key": "resourceId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + "object_id": {"key": "objectId", "type": "str"}, } def __init__( @@ -1924,10 +1903,10 @@ def __init__( :keyword object_id: The object id of the user assigned identity. :paramtype object_id: str """ - super(ManagedClusterAddonProfileIdentity, self).__init__(resource_id=resource_id, client_id=client_id, object_id=object_id, **kwargs) + super().__init__(resource_id=resource_id, client_id=client_id, object_id=object_id, **kwargs) -class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): +class ManagedClusterAgentPoolProfileProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes """Properties for the container service agent pool profile. Variables are only populated by the server, and will be ignored when sending a request. @@ -1973,7 +1952,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :vartype vm_size: str or ~azure.mgmt.containerservice.v2020_06_01.models.ContainerServiceVMSizeTypes :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine @@ -1985,7 +1964,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Known values are: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux" and "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2020_06_01.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -1994,9 +1973,10 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar type: AgentPoolType represents types of an agent pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2020_06_01.models.AgentPoolType - :ivar mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", "User". + :ivar mode: AgentPoolMode represents mode of an agent pool. Known values are: "System" and + "User". :vartype mode: str or ~azure.mgmt.containerservice.v2020_06_01.models.AgentPoolMode :ivar orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -2015,20 +1995,19 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar enable_node_public_ip: Enable public IP for nodes. :vartype enable_node_public_ip: bool :ivar scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Known values are: "Spot", "Regular". Default value: "Regular". + priority. Default to regular. Known values are: "Spot" and "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_06_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy - for Spot virtual machine scale set. Default to Delete. Known values are: "Delete", - "Deallocate". Default value: "Delete". + for Spot virtual machine scale set. Default to Delete. Known values are: "Delete" and + "Deallocate". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_06_01.models.ScaleSetEvictionPolicy :ivar spot_max_price: SpotMaxPrice to be used to specify the maximum price you are willing to pay in US Dollars. Possible values are any decimal value greater than zero or -1 which indicates default price to be up-to on-demand. :vartype spot_max_price: float - :ivar tags: A set of tags. Agent pool tags to be persisted on the agent pool virtual machine - scale set. + :ivar tags: Agent pool tags to be persisted on the agent pool virtual machine scale set. :vartype tags: dict[str, str] :ivar node_labels: Agent pool node labels to be persisted across all nodes in agent pool. :vartype node_labels: dict[str, str] @@ -2040,38 +2019,38 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): """ _validation = { - 'os_disk_size_gb': {'maximum': 1023, 'minimum': 0}, - 'provisioning_state': {'readonly': True}, + "os_disk_size_gb": {"maximum": 1023, "minimum": 0}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'maxPods', 'type': 'int'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'max_count': {'key': 'maxCount', 'type': 'int'}, - 'min_count': {'key': 'minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'enableAutoScaling', 'type': 'bool'}, - 'type': {'key': 'type', 'type': 'str'}, - 'mode': {'key': 'mode', 'type': 'str'}, - 'orchestrator_version': {'key': 'orchestratorVersion', 'type': 'str'}, - 'node_image_version': {'key': 'nodeImageVersion', 'type': 'str'}, - 'upgrade_settings': {'key': 'upgradeSettings', 'type': 'AgentPoolUpgradeSettings'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'availability_zones': {'key': 'availabilityZones', 'type': '[str]'}, - 'enable_node_public_ip': {'key': 'enableNodePublicIP', 'type': 'bool'}, - 'scale_set_priority': {'key': 'scaleSetPriority', 'type': 'str'}, - 'scale_set_eviction_policy': {'key': 'scaleSetEvictionPolicy', 'type': 'str'}, - 'spot_max_price': {'key': 'spotMaxPrice', 'type': 'float'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'node_labels': {'key': 'nodeLabels', 'type': '{str}'}, - 'node_taints': {'key': 'nodeTaints', 'type': '[str]'}, - 'proximity_placement_group_id': {'key': 'proximityPlacementGroupID', 'type': 'str'}, - } - - def __init__( + "count": {"key": "count", "type": "int"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "max_pods": {"key": "maxPods", "type": "int"}, + "os_type": {"key": "osType", "type": "str"}, + "max_count": {"key": "maxCount", "type": "int"}, + "min_count": {"key": "minCount", "type": "int"}, + "enable_auto_scaling": {"key": "enableAutoScaling", "type": "bool"}, + "type": {"key": "type", "type": "str"}, + "mode": {"key": "mode", "type": "str"}, + "orchestrator_version": {"key": "orchestratorVersion", "type": "str"}, + "node_image_version": {"key": "nodeImageVersion", "type": "str"}, + "upgrade_settings": {"key": "upgradeSettings", "type": "AgentPoolUpgradeSettings"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "availability_zones": {"key": "availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "enableNodePublicIP", "type": "bool"}, + "scale_set_priority": {"key": "scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "scaleSetEvictionPolicy", "type": "str"}, + "spot_max_price": {"key": "spotMaxPrice", "type": "float"}, + "tags": {"key": "tags", "type": "{str}"}, + "node_labels": {"key": "nodeLabels", "type": "{str}"}, + "node_taints": {"key": "nodeTaints", "type": "[str]"}, + "proximity_placement_group_id": {"key": "proximityPlacementGroupID", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, count: Optional[int] = None, @@ -2079,7 +2058,7 @@ def __init__( os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, @@ -2090,9 +2069,9 @@ def __init__( upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, - scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", - spot_max_price: Optional[float] = -1, + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", + spot_max_price: float = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, @@ -2141,7 +2120,7 @@ def __init__( "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :paramtype vm_size: str or ~azure.mgmt.containerservice.v2020_06_01.models.ContainerServiceVMSizeTypes :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every @@ -2153,7 +2132,7 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux" and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2020_06_01.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -2162,9 +2141,9 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword type: AgentPoolType represents types of an agent pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2020_06_01.models.AgentPoolType - :keyword mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", + :keyword mode: AgentPoolMode represents mode of an agent pool. Known values are: "System" and "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2020_06_01.models.AgentPoolMode :keyword orchestrator_version: Version of orchestrator specified when creating the managed @@ -2181,20 +2160,19 @@ def __init__( :keyword enable_node_public_ip: Enable public IP for nodes. :paramtype enable_node_public_ip: bool :keyword scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Known values are: "Spot", "Regular". Default value: "Regular". + priority. Default to regular. Known values are: "Spot" and "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_06_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction - policy for Spot virtual machine scale set. Default to Delete. Known values are: "Delete", - "Deallocate". Default value: "Delete". + policy for Spot virtual machine scale set. Default to Delete. Known values are: "Delete" and + "Deallocate". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_06_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: SpotMaxPrice to be used to specify the maximum price you are willing to pay in US Dollars. Possible values are any decimal value greater than zero or -1 which indicates default price to be up-to on-demand. :paramtype spot_max_price: float - :keyword tags: A set of tags. Agent pool tags to be persisted on the agent pool virtual machine - scale set. + :keyword tags: Agent pool tags to be persisted on the agent pool virtual machine scale set. :paramtype tags: dict[str, str] :keyword node_labels: Agent pool node labels to be persisted across all nodes in agent pool. :paramtype node_labels: dict[str, str] @@ -2204,7 +2182,7 @@ def __init__( :keyword proximity_placement_group_id: The ID for Proximity Placement Group. :paramtype proximity_placement_group_id: str """ - super(ManagedClusterAgentPoolProfileProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.vm_size = vm_size self.os_disk_size_gb = os_disk_size_gb @@ -2231,7 +2209,9 @@ def __init__( self.proximity_placement_group_id = proximity_placement_group_id -class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): +class ManagedClusterAgentPoolProfile( + ManagedClusterAgentPoolProfileProperties +): # pylint: disable=too-many-instance-attributes """Profile for the container service agent pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -2279,7 +2259,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :vartype vm_size: str or ~azure.mgmt.containerservice.v2020_06_01.models.ContainerServiceVMSizeTypes :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine @@ -2291,7 +2271,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Known values are: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux" and "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2020_06_01.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -2300,9 +2280,10 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar type: AgentPoolType represents types of an agent pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2020_06_01.models.AgentPoolType - :ivar mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", "User". + :ivar mode: AgentPoolMode represents mode of an agent pool. Known values are: "System" and + "User". :vartype mode: str or ~azure.mgmt.containerservice.v2020_06_01.models.AgentPoolMode :ivar orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -2321,20 +2302,19 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar enable_node_public_ip: Enable public IP for nodes. :vartype enable_node_public_ip: bool :ivar scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Known values are: "Spot", "Regular". Default value: "Regular". + priority. Default to regular. Known values are: "Spot" and "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_06_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy - for Spot virtual machine scale set. Default to Delete. Known values are: "Delete", - "Deallocate". Default value: "Delete". + for Spot virtual machine scale set. Default to Delete. Known values are: "Delete" and + "Deallocate". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_06_01.models.ScaleSetEvictionPolicy :ivar spot_max_price: SpotMaxPrice to be used to specify the maximum price you are willing to pay in US Dollars. Possible values are any decimal value greater than zero or -1 which indicates default price to be up-to on-demand. :vartype spot_max_price: float - :ivar tags: A set of tags. Agent pool tags to be persisted on the agent pool virtual machine - scale set. + :ivar tags: Agent pool tags to be persisted on the agent pool virtual machine scale set. :vartype tags: dict[str, str] :ivar node_labels: Agent pool node labels to be persisted across all nodes in agent pool. :vartype node_labels: dict[str, str] @@ -2343,46 +2323,46 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :vartype node_taints: list[str] :ivar proximity_placement_group_id: The ID for Proximity Placement Group. :vartype proximity_placement_group_id: str - :ivar name: Required. Unique name of the agent pool profile in the context of the subscription - and resource group. + :ivar name: Unique name of the agent pool profile in the context of the subscription and + resource group. Required. :vartype name: str """ _validation = { - 'os_disk_size_gb': {'maximum': 1023, 'minimum': 0}, - 'provisioning_state': {'readonly': True}, - 'name': {'required': True, 'pattern': r'^[a-z][a-z0-9]{0,11}$'}, + "os_disk_size_gb": {"maximum": 1023, "minimum": 0}, + "provisioning_state": {"readonly": True}, + "name": {"required": True, "pattern": r"^[a-z][a-z0-9]{0,11}$"}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'maxPods', 'type': 'int'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'max_count': {'key': 'maxCount', 'type': 'int'}, - 'min_count': {'key': 'minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'enableAutoScaling', 'type': 'bool'}, - 'type': {'key': 'type', 'type': 'str'}, - 'mode': {'key': 'mode', 'type': 'str'}, - 'orchestrator_version': {'key': 'orchestratorVersion', 'type': 'str'}, - 'node_image_version': {'key': 'nodeImageVersion', 'type': 'str'}, - 'upgrade_settings': {'key': 'upgradeSettings', 'type': 'AgentPoolUpgradeSettings'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'availability_zones': {'key': 'availabilityZones', 'type': '[str]'}, - 'enable_node_public_ip': {'key': 'enableNodePublicIP', 'type': 'bool'}, - 'scale_set_priority': {'key': 'scaleSetPriority', 'type': 'str'}, - 'scale_set_eviction_policy': {'key': 'scaleSetEvictionPolicy', 'type': 'str'}, - 'spot_max_price': {'key': 'spotMaxPrice', 'type': 'float'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'node_labels': {'key': 'nodeLabels', 'type': '{str}'}, - 'node_taints': {'key': 'nodeTaints', 'type': '[str]'}, - 'proximity_placement_group_id': {'key': 'proximityPlacementGroupID', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( + "count": {"key": "count", "type": "int"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "max_pods": {"key": "maxPods", "type": "int"}, + "os_type": {"key": "osType", "type": "str"}, + "max_count": {"key": "maxCount", "type": "int"}, + "min_count": {"key": "minCount", "type": "int"}, + "enable_auto_scaling": {"key": "enableAutoScaling", "type": "bool"}, + "type": {"key": "type", "type": "str"}, + "mode": {"key": "mode", "type": "str"}, + "orchestrator_version": {"key": "orchestratorVersion", "type": "str"}, + "node_image_version": {"key": "nodeImageVersion", "type": "str"}, + "upgrade_settings": {"key": "upgradeSettings", "type": "AgentPoolUpgradeSettings"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "availability_zones": {"key": "availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "enableNodePublicIP", "type": "bool"}, + "scale_set_priority": {"key": "scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "scaleSetEvictionPolicy", "type": "str"}, + "spot_max_price": {"key": "spotMaxPrice", "type": "float"}, + "tags": {"key": "tags", "type": "{str}"}, + "node_labels": {"key": "nodeLabels", "type": "{str}"}, + "node_taints": {"key": "nodeTaints", "type": "[str]"}, + "proximity_placement_group_id": {"key": "proximityPlacementGroupID", "type": "str"}, + "name": {"key": "name", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, name: str, @@ -2391,7 +2371,7 @@ def __init__( os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, @@ -2402,9 +2382,9 @@ def __init__( upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, - scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", - spot_max_price: Optional[float] = -1, + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", + spot_max_price: float = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, @@ -2453,7 +2433,7 @@ def __init__( "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :paramtype vm_size: str or ~azure.mgmt.containerservice.v2020_06_01.models.ContainerServiceVMSizeTypes :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every @@ -2465,7 +2445,7 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux" and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2020_06_01.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -2474,9 +2454,9 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword type: AgentPoolType represents types of an agent pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2020_06_01.models.AgentPoolType - :keyword mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", + :keyword mode: AgentPoolMode represents mode of an agent pool. Known values are: "System" and "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2020_06_01.models.AgentPoolMode :keyword orchestrator_version: Version of orchestrator specified when creating the managed @@ -2493,20 +2473,19 @@ def __init__( :keyword enable_node_public_ip: Enable public IP for nodes. :paramtype enable_node_public_ip: bool :keyword scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Known values are: "Spot", "Regular". Default value: "Regular". + priority. Default to regular. Known values are: "Spot" and "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_06_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction - policy for Spot virtual machine scale set. Default to Delete. Known values are: "Delete", - "Deallocate". Default value: "Delete". + policy for Spot virtual machine scale set. Default to Delete. Known values are: "Delete" and + "Deallocate". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_06_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: SpotMaxPrice to be used to specify the maximum price you are willing to pay in US Dollars. Possible values are any decimal value greater than zero or -1 which indicates default price to be up-to on-demand. :paramtype spot_max_price: float - :keyword tags: A set of tags. Agent pool tags to be persisted on the agent pool virtual machine - scale set. + :keyword tags: Agent pool tags to be persisted on the agent pool virtual machine scale set. :paramtype tags: dict[str, str] :keyword node_labels: Agent pool node labels to be persisted across all nodes in agent pool. :paramtype node_labels: dict[str, str] @@ -2515,15 +2494,40 @@ def __init__( :paramtype node_taints: list[str] :keyword proximity_placement_group_id: The ID for Proximity Placement Group. :paramtype proximity_placement_group_id: str - :keyword name: Required. Unique name of the agent pool profile in the context of the - subscription and resource group. + :keyword name: Unique name of the agent pool profile in the context of the subscription and + resource group. Required. :paramtype name: str """ - super(ManagedClusterAgentPoolProfile, self).__init__(count=count, vm_size=vm_size, os_disk_size_gb=os_disk_size_gb, vnet_subnet_id=vnet_subnet_id, max_pods=max_pods, os_type=os_type, max_count=max_count, min_count=min_count, enable_auto_scaling=enable_auto_scaling, type=type, mode=mode, orchestrator_version=orchestrator_version, node_image_version=node_image_version, upgrade_settings=upgrade_settings, availability_zones=availability_zones, enable_node_public_ip=enable_node_public_ip, scale_set_priority=scale_set_priority, scale_set_eviction_policy=scale_set_eviction_policy, spot_max_price=spot_max_price, tags=tags, node_labels=node_labels, node_taints=node_taints, proximity_placement_group_id=proximity_placement_group_id, **kwargs) + super().__init__( + count=count, + vm_size=vm_size, + os_disk_size_gb=os_disk_size_gb, + vnet_subnet_id=vnet_subnet_id, + max_pods=max_pods, + os_type=os_type, + max_count=max_count, + min_count=min_count, + enable_auto_scaling=enable_auto_scaling, + type=type, + mode=mode, + orchestrator_version=orchestrator_version, + node_image_version=node_image_version, + upgrade_settings=upgrade_settings, + availability_zones=availability_zones, + enable_node_public_ip=enable_node_public_ip, + scale_set_priority=scale_set_priority, + scale_set_eviction_policy=scale_set_eviction_policy, + spot_max_price=spot_max_price, + tags=tags, + node_labels=node_labels, + node_taints=node_taints, + proximity_placement_group_id=proximity_placement_group_id, + **kwargs + ) self.name = name -class ManagedClusterAPIServerAccessProfile(msrest.serialization.Model): +class ManagedClusterAPIServerAccessProfile(_serialization.Model): """Access profile for managed cluster API server. :ivar authorized_ip_ranges: Authorized IP Ranges to kubernetes API server. @@ -2533,8 +2537,8 @@ class ManagedClusterAPIServerAccessProfile(msrest.serialization.Model): """ _attribute_map = { - 'authorized_ip_ranges': {'key': 'authorizedIPRanges', 'type': '[str]'}, - 'enable_private_cluster': {'key': 'enablePrivateCluster', 'type': 'bool'}, + "authorized_ip_ranges": {"key": "authorizedIPRanges", "type": "[str]"}, + "enable_private_cluster": {"key": "enablePrivateCluster", "type": "bool"}, } def __init__( @@ -2550,12 +2554,12 @@ def __init__( :keyword enable_private_cluster: Whether to create the cluster as a private cluster or not. :paramtype enable_private_cluster: bool """ - super(ManagedClusterAPIServerAccessProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.authorized_ip_ranges = authorized_ip_ranges self.enable_private_cluster = enable_private_cluster -class ManagedClusterIdentity(msrest.serialization.Model): +class ManagedClusterIdentity(_serialization.Model): """Identity for the managed cluster. Variables are only populated by the server, and will be ignored when sending a request. @@ -2569,7 +2573,7 @@ class ManagedClusterIdentity(msrest.serialization.Model): :ivar type: The type of identity used for the managed cluster. Type 'SystemAssigned' will use an implicitly created identity in master components and an auto-created user assigned identity in MC_ resource group in agent nodes. Type 'None' will not use MSI for the managed cluster, - service principal will be used instead. Known values are: "SystemAssigned", "UserAssigned", + service principal will be used instead. Known values are: "SystemAssigned", "UserAssigned", and "None". :vartype type: str or ~azure.mgmt.containerservice.v2020_06_01.models.ResourceIdentityType :ivar user_assigned_identities: The user identity associated with the managed cluster. This @@ -2581,22 +2585,27 @@ class ManagedClusterIdentity(msrest.serialization.Model): """ _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, + "principal_id": {"readonly": True}, + "tenant_id": {"readonly": True}, } _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{ManagedClusterIdentityUserAssignedIdentitiesValue}'}, + "principal_id": {"key": "principalId", "type": "str"}, + "tenant_id": {"key": "tenantId", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "user_assigned_identities": { + "key": "userAssignedIdentities", + "type": "{ManagedClusterIdentityUserAssignedIdentitiesValue}", + }, } def __init__( self, *, type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, - user_assigned_identities: Optional[Dict[str, "_models.ManagedClusterIdentityUserAssignedIdentitiesValue"]] = None, + user_assigned_identities: Optional[ + Dict[str, "_models.ManagedClusterIdentityUserAssignedIdentitiesValue"] + ] = None, **kwargs ): """ @@ -2604,7 +2613,7 @@ def __init__( use an implicitly created identity in master components and an auto-created user assigned identity in MC_ resource group in agent nodes. Type 'None' will not use MSI for the managed cluster, service principal will be used instead. Known values are: "SystemAssigned", - "UserAssigned", "None". + "UserAssigned", and "None". :paramtype type: str or ~azure.mgmt.containerservice.v2020_06_01.models.ResourceIdentityType :keyword user_assigned_identities: The user identity associated with the managed cluster. This identity will be used in control plane and only one user assigned identity is allowed. The user @@ -2613,14 +2622,14 @@ def __init__( :paramtype user_assigned_identities: dict[str, ~azure.mgmt.containerservice.v2020_06_01.models.ManagedClusterIdentityUserAssignedIdentitiesValue] """ - super(ManagedClusterIdentity, self).__init__(**kwargs) + super().__init__(**kwargs) self.principal_id = None self.tenant_id = None self.type = type self.user_assigned_identities = user_assigned_identities -class ManagedClusterIdentityUserAssignedIdentitiesValue(msrest.serialization.Model): +class ManagedClusterIdentityUserAssignedIdentitiesValue(_serialization.Model): """ManagedClusterIdentityUserAssignedIdentitiesValue. Variables are only populated by the server, and will be ignored when sending a request. @@ -2632,27 +2641,23 @@ class ManagedClusterIdentityUserAssignedIdentitiesValue(msrest.serialization.Mod """ _validation = { - 'principal_id': {'readonly': True}, - 'client_id': {'readonly': True}, + "principal_id": {"readonly": True}, + "client_id": {"readonly": True}, } _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, + "principal_id": {"key": "principalId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(ManagedClusterIdentityUserAssignedIdentitiesValue, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.principal_id = None self.client_id = None -class ManagedClusterListResult(msrest.serialization.Model): +class ManagedClusterListResult(_serialization.Model): """The response from the List Managed Clusters operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -2664,30 +2669,25 @@ class ManagedClusterListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[ManagedCluster]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[ManagedCluster]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.ManagedCluster"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.ManagedCluster"]] = None, **kwargs): """ :keyword value: The list of managed clusters. :paramtype value: list[~azure.mgmt.containerservice.v2020_06_01.models.ManagedCluster] """ - super(ManagedClusterListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class ManagedClusterLoadBalancerProfile(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfile(_serialization.Model): """Profile of the managed cluster load balancer. :ivar managed_outbound_i_ps: Desired managed outbound IPs for the cluster load balancer. @@ -2713,17 +2713,23 @@ class ManagedClusterLoadBalancerProfile(msrest.serialization.Model): """ _validation = { - 'allocated_outbound_ports': {'maximum': 64000, 'minimum': 0}, - 'idle_timeout_in_minutes': {'maximum': 120, 'minimum': 4}, + "allocated_outbound_ports": {"maximum": 64000, "minimum": 0}, + "idle_timeout_in_minutes": {"maximum": 120, "minimum": 4}, } _attribute_map = { - 'managed_outbound_i_ps': {'key': 'managedOutboundIPs', 'type': 'ManagedClusterLoadBalancerProfileManagedOutboundIPs'}, - 'outbound_ip_prefixes': {'key': 'outboundIPPrefixes', 'type': 'ManagedClusterLoadBalancerProfileOutboundIPPrefixes'}, - 'outbound_i_ps': {'key': 'outboundIPs', 'type': 'ManagedClusterLoadBalancerProfileOutboundIPs'}, - 'effective_outbound_i_ps': {'key': 'effectiveOutboundIPs', 'type': '[ResourceReference]'}, - 'allocated_outbound_ports': {'key': 'allocatedOutboundPorts', 'type': 'int'}, - 'idle_timeout_in_minutes': {'key': 'idleTimeoutInMinutes', 'type': 'int'}, + "managed_outbound_i_ps": { + "key": "managedOutboundIPs", + "type": "ManagedClusterLoadBalancerProfileManagedOutboundIPs", + }, + "outbound_ip_prefixes": { + "key": "outboundIPPrefixes", + "type": "ManagedClusterLoadBalancerProfileOutboundIPPrefixes", + }, + "outbound_i_ps": {"key": "outboundIPs", "type": "ManagedClusterLoadBalancerProfileOutboundIPs"}, + "effective_outbound_i_ps": {"key": "effectiveOutboundIPs", "type": "[ResourceReference]"}, + "allocated_outbound_ports": {"key": "allocatedOutboundPorts", "type": "int"}, + "idle_timeout_in_minutes": {"key": "idleTimeoutInMinutes", "type": "int"}, } def __init__( @@ -2733,8 +2739,8 @@ def __init__( outbound_ip_prefixes: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPPrefixes"] = None, outbound_i_ps: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPs"] = None, effective_outbound_i_ps: Optional[List["_models.ResourceReference"]] = None, - allocated_outbound_ports: Optional[int] = 0, - idle_timeout_in_minutes: Optional[int] = 30, + allocated_outbound_ports: int = 0, + idle_timeout_in_minutes: int = 30, **kwargs ): """ @@ -2760,7 +2766,7 @@ def __init__( must be in the range of 4 to 120 (inclusive). The default value is 30 minutes. :paramtype idle_timeout_in_minutes: int """ - super(ManagedClusterLoadBalancerProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.managed_outbound_i_ps = managed_outbound_i_ps self.outbound_ip_prefixes = outbound_ip_prefixes self.outbound_i_ps = outbound_i_ps @@ -2769,7 +2775,7 @@ def __init__( self.idle_timeout_in_minutes = idle_timeout_in_minutes -class ManagedClusterLoadBalancerProfileManagedOutboundIPs(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfileManagedOutboundIPs(_serialization.Model): """Desired managed outbound IPs for the cluster load balancer. :ivar count: Desired number of outbound IP created/managed by Azure for the cluster load @@ -2778,29 +2784,24 @@ class ManagedClusterLoadBalancerProfileManagedOutboundIPs(msrest.serialization.M """ _validation = { - 'count': {'maximum': 100, 'minimum': 1}, + "count": {"maximum": 100, "minimum": 1}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, + "count": {"key": "count", "type": "int"}, } - def __init__( - self, - *, - count: Optional[int] = 1, - **kwargs - ): + def __init__(self, *, count: int = 1, **kwargs): """ :keyword count: Desired number of outbound IP created/managed by Azure for the cluster load balancer. Allowed values must be in the range of 1 to 100 (inclusive). The default value is 1. :paramtype count: int """ - super(ManagedClusterLoadBalancerProfileManagedOutboundIPs, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count -class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(_serialization.Model): """Desired outbound IP Prefix resources for the cluster load balancer. :ivar public_ip_prefixes: A list of public IP prefix resources. @@ -2809,25 +2810,20 @@ class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(msrest.serialization.M """ _attribute_map = { - 'public_ip_prefixes': {'key': 'publicIPPrefixes', 'type': '[ResourceReference]'}, + "public_ip_prefixes": {"key": "publicIPPrefixes", "type": "[ResourceReference]"}, } - def __init__( - self, - *, - public_ip_prefixes: Optional[List["_models.ResourceReference"]] = None, - **kwargs - ): + def __init__(self, *, public_ip_prefixes: Optional[List["_models.ResourceReference"]] = None, **kwargs): """ :keyword public_ip_prefixes: A list of public IP prefix resources. :paramtype public_ip_prefixes: list[~azure.mgmt.containerservice.v2020_06_01.models.ResourceReference] """ - super(ManagedClusterLoadBalancerProfileOutboundIPPrefixes, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_ip_prefixes = public_ip_prefixes -class ManagedClusterLoadBalancerProfileOutboundIPs(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfileOutboundIPs(_serialization.Model): """Desired outbound IP resources for the cluster load balancer. :ivar public_i_ps: A list of public IP resources. @@ -2835,34 +2831,29 @@ class ManagedClusterLoadBalancerProfileOutboundIPs(msrest.serialization.Model): """ _attribute_map = { - 'public_i_ps': {'key': 'publicIPs', 'type': '[ResourceReference]'}, + "public_i_ps": {"key": "publicIPs", "type": "[ResourceReference]"}, } - def __init__( - self, - *, - public_i_ps: Optional[List["_models.ResourceReference"]] = None, - **kwargs - ): + def __init__(self, *, public_i_ps: Optional[List["_models.ResourceReference"]] = None, **kwargs): """ :keyword public_i_ps: A list of public IP resources. :paramtype public_i_ps: list[~azure.mgmt.containerservice.v2020_06_01.models.ResourceReference] """ - super(ManagedClusterLoadBalancerProfileOutboundIPs, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_i_ps = public_i_ps -class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): +class ManagedClusterPoolUpgradeProfile(_serialization.Model): """The list of available upgrade versions. All required parameters must be populated in order to send to Azure. - :ivar kubernetes_version: Required. Kubernetes version (major, minor, patch). + :ivar kubernetes_version: Kubernetes version (major, minor, patch). Required. :vartype kubernetes_version: str :ivar name: Pool name. :vartype name: str - :ivar os_type: Required. OsType to be used to specify os type. Choose from Linux and Windows. - Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to + Linux. Known values are: "Linux" and "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2020_06_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -2870,15 +2861,15 @@ class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): """ _validation = { - 'kubernetes_version': {'required': True}, - 'os_type': {'required': True}, + "kubernetes_version": {"required": True}, + "os_type": {"required": True}, } _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'upgrades': {'key': 'upgrades', 'type': '[ManagedClusterPoolUpgradeProfileUpgradesItem]'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "os_type": {"key": "osType", "type": "str"}, + "upgrades": {"key": "upgrades", "type": "[ManagedClusterPoolUpgradeProfileUpgradesItem]"}, } def __init__( @@ -2891,25 +2882,25 @@ def __init__( **kwargs ): """ - :keyword kubernetes_version: Required. Kubernetes version (major, minor, patch). + :keyword kubernetes_version: Kubernetes version (major, minor, patch). Required. :paramtype kubernetes_version: str :keyword name: Pool name. :paramtype name: str - :keyword os_type: Required. OsType to be used to specify os type. Choose from Linux and - Windows. Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default + to Linux. Known values are: "Linux" and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2020_06_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: list[~azure.mgmt.containerservice.v2020_06_01.models.ManagedClusterPoolUpgradeProfileUpgradesItem] """ - super(ManagedClusterPoolUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.name = name self.os_type = os_type self.upgrades = upgrades -class ManagedClusterPoolUpgradeProfileUpgradesItem(msrest.serialization.Model): +class ManagedClusterPoolUpgradeProfileUpgradesItem(_serialization.Model): """ManagedClusterPoolUpgradeProfileUpgradesItem. :ivar kubernetes_version: Kubernetes version (major, minor, patch). @@ -2919,29 +2910,23 @@ class ManagedClusterPoolUpgradeProfileUpgradesItem(msrest.serialization.Model): """ _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } - def __init__( - self, - *, - kubernetes_version: Optional[str] = None, - is_preview: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, kubernetes_version: Optional[str] = None, is_preview: Optional[bool] = None, **kwargs): """ :keyword kubernetes_version: Kubernetes version (major, minor, patch). :paramtype kubernetes_version: str :keyword is_preview: Whether Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(ManagedClusterPoolUpgradeProfileUpgradesItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.is_preview = is_preview -class ManagedClusterPropertiesAutoScalerProfile(msrest.serialization.Model): +class ManagedClusterPropertiesAutoScalerProfile(_serialization.Model): """Parameters to be applied to the cluster-autoscaler when enabled. :ivar balance_similar_node_groups: @@ -2965,15 +2950,15 @@ class ManagedClusterPropertiesAutoScalerProfile(msrest.serialization.Model): """ _attribute_map = { - 'balance_similar_node_groups': {'key': 'balance-similar-node-groups', 'type': 'str'}, - 'scan_interval': {'key': 'scan-interval', 'type': 'str'}, - 'scale_down_delay_after_add': {'key': 'scale-down-delay-after-add', 'type': 'str'}, - 'scale_down_delay_after_delete': {'key': 'scale-down-delay-after-delete', 'type': 'str'}, - 'scale_down_delay_after_failure': {'key': 'scale-down-delay-after-failure', 'type': 'str'}, - 'scale_down_unneeded_time': {'key': 'scale-down-unneeded-time', 'type': 'str'}, - 'scale_down_unready_time': {'key': 'scale-down-unready-time', 'type': 'str'}, - 'scale_down_utilization_threshold': {'key': 'scale-down-utilization-threshold', 'type': 'str'}, - 'max_graceful_termination_sec': {'key': 'max-graceful-termination-sec', 'type': 'str'}, + "balance_similar_node_groups": {"key": "balance-similar-node-groups", "type": "str"}, + "scan_interval": {"key": "scan-interval", "type": "str"}, + "scale_down_delay_after_add": {"key": "scale-down-delay-after-add", "type": "str"}, + "scale_down_delay_after_delete": {"key": "scale-down-delay-after-delete", "type": "str"}, + "scale_down_delay_after_failure": {"key": "scale-down-delay-after-failure", "type": "str"}, + "scale_down_unneeded_time": {"key": "scale-down-unneeded-time", "type": "str"}, + "scale_down_unready_time": {"key": "scale-down-unready-time", "type": "str"}, + "scale_down_utilization_threshold": {"key": "scale-down-utilization-threshold", "type": "str"}, + "max_graceful_termination_sec": {"key": "max-graceful-termination-sec", "type": "str"}, } def __init__( @@ -3010,7 +2995,7 @@ def __init__( :keyword max_graceful_termination_sec: :paramtype max_graceful_termination_sec: str """ - super(ManagedClusterPropertiesAutoScalerProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.balance_similar_node_groups = balance_similar_node_groups self.scan_interval = scan_interval self.scale_down_delay_after_add = scale_down_delay_after_add @@ -3034,9 +3019,9 @@ class ManagedClusterPropertiesIdentityProfileValue(UserAssignedIdentity): """ _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'object_id': {'key': 'objectId', 'type': 'str'}, + "resource_id": {"key": "resourceId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + "object_id": {"key": "objectId", "type": "str"}, } def __init__( @@ -3055,59 +3040,53 @@ def __init__( :keyword object_id: The object id of the user assigned identity. :paramtype object_id: str """ - super(ManagedClusterPropertiesIdentityProfileValue, self).__init__(resource_id=resource_id, client_id=client_id, object_id=object_id, **kwargs) + super().__init__(resource_id=resource_id, client_id=client_id, object_id=object_id, **kwargs) -class ManagedClusterServicePrincipalProfile(msrest.serialization.Model): +class ManagedClusterServicePrincipalProfile(_serialization.Model): """Information about a service principal identity for the cluster to use for manipulating Azure APIs. All required parameters must be populated in order to send to Azure. - :ivar client_id: Required. The ID for the service principal. + :ivar client_id: The ID for the service principal. Required. :vartype client_id: str :ivar secret: The secret password associated with the service principal in plain text. :vartype secret: str """ _validation = { - 'client_id': {'required': True}, + "client_id": {"required": True}, } _attribute_map = { - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'secret': {'key': 'secret', 'type': 'str'}, + "client_id": {"key": "clientId", "type": "str"}, + "secret": {"key": "secret", "type": "str"}, } - def __init__( - self, - *, - client_id: str, - secret: Optional[str] = None, - **kwargs - ): + def __init__(self, *, client_id: str, secret: Optional[str] = None, **kwargs): """ - :keyword client_id: Required. The ID for the service principal. + :keyword client_id: The ID for the service principal. Required. :paramtype client_id: str :keyword secret: The secret password associated with the service principal in plain text. :paramtype secret: str """ - super(ManagedClusterServicePrincipalProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.client_id = client_id self.secret = secret -class ManagedClusterSKU(msrest.serialization.Model): +class ManagedClusterSKU(_serialization.Model): """ManagedClusterSKU. - :ivar name: Name of a managed cluster SKU. Known values are: "Basic". + :ivar name: Name of a managed cluster SKU. "Basic" :vartype name: str or ~azure.mgmt.containerservice.v2020_06_01.models.ManagedClusterSKUName - :ivar tier: Tier of a managed cluster SKU. Known values are: "Paid", "Free". + :ivar tier: Tier of a managed cluster SKU. Known values are: "Paid" and "Free". :vartype tier: str or ~azure.mgmt.containerservice.v2020_06_01.models.ManagedClusterSKUTier """ _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, + "name": {"key": "name", "type": "str"}, + "tier": {"key": "tier", "type": "str"}, } def __init__( @@ -3118,17 +3097,17 @@ def __init__( **kwargs ): """ - :keyword name: Name of a managed cluster SKU. Known values are: "Basic". + :keyword name: Name of a managed cluster SKU. "Basic" :paramtype name: str or ~azure.mgmt.containerservice.v2020_06_01.models.ManagedClusterSKUName - :keyword tier: Tier of a managed cluster SKU. Known values are: "Paid", "Free". + :keyword tier: Tier of a managed cluster SKU. Known values are: "Paid" and "Free". :paramtype tier: str or ~azure.mgmt.containerservice.v2020_06_01.models.ManagedClusterSKUTier """ - super(ManagedClusterSKU, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.tier = tier -class ManagedClusterUpgradeProfile(msrest.serialization.Model): +class ManagedClusterUpgradeProfile(_serialization.Model): """The list of available upgrades for compute pools. Variables are only populated by the server, and will be ignored when sending a request. @@ -3141,29 +3120,29 @@ class ManagedClusterUpgradeProfile(msrest.serialization.Model): :vartype name: str :ivar type: Type of upgrade profile. :vartype type: str - :ivar control_plane_profile: Required. The list of available upgrade versions for the control - plane. + :ivar control_plane_profile: The list of available upgrade versions for the control plane. + Required. :vartype control_plane_profile: ~azure.mgmt.containerservice.v2020_06_01.models.ManagedClusterPoolUpgradeProfile - :ivar agent_pool_profiles: Required. The list of available upgrade versions for agent pools. + :ivar agent_pool_profiles: The list of available upgrade versions for agent pools. Required. :vartype agent_pool_profiles: list[~azure.mgmt.containerservice.v2020_06_01.models.ManagedClusterPoolUpgradeProfile] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'control_plane_profile': {'required': True}, - 'agent_pool_profiles': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "control_plane_profile": {"required": True}, + "agent_pool_profiles": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'control_plane_profile': {'key': 'properties.controlPlaneProfile', 'type': 'ManagedClusterPoolUpgradeProfile'}, - 'agent_pool_profiles': {'key': 'properties.agentPoolProfiles', 'type': '[ManagedClusterPoolUpgradeProfile]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "control_plane_profile": {"key": "properties.controlPlaneProfile", "type": "ManagedClusterPoolUpgradeProfile"}, + "agent_pool_profiles": {"key": "properties.agentPoolProfiles", "type": "[ManagedClusterPoolUpgradeProfile]"}, } def __init__( @@ -3174,15 +3153,15 @@ def __init__( **kwargs ): """ - :keyword control_plane_profile: Required. The list of available upgrade versions for the - control plane. + :keyword control_plane_profile: The list of available upgrade versions for the control plane. + Required. :paramtype control_plane_profile: ~azure.mgmt.containerservice.v2020_06_01.models.ManagedClusterPoolUpgradeProfile - :keyword agent_pool_profiles: Required. The list of available upgrade versions for agent pools. + :keyword agent_pool_profiles: The list of available upgrade versions for agent pools. Required. :paramtype agent_pool_profiles: list[~azure.mgmt.containerservice.v2020_06_01.models.ManagedClusterPoolUpgradeProfile] """ - super(ManagedClusterUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -3190,18 +3169,18 @@ def __init__( self.agent_pool_profiles = agent_pool_profiles -class ManagedClusterWindowsProfile(msrest.serialization.Model): +class ManagedClusterWindowsProfile(_serialization.Model): """Profile for Windows VMs in the container service cluster. All required parameters must be populated in order to send to Azure. - :ivar admin_username: Required. Specifies the name of the administrator account. - :code:`
`:code:`
` **restriction:** Cannot end in "." :code:`
`:code:`
` - **Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", "test1", - "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", - "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", - "sys", "test2", "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 - character :code:`
`:code:`
` **Max-length:** 20 characters. + :ivar admin_username: Specifies the name of the administrator account. :code:`
`:code:`
` + **restriction:** Cannot end in "." :code:`
`:code:`
` **Disallowed values:** + "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", + "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", + "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", + "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 character + :code:`
`:code:`
` **Max-length:** 20 characters. Required. :vartype admin_username: str :ivar admin_password: Specifies the password of the administrator account. :code:`
`:code:`
` **Minimum-length:** 8 characters :code:`
`:code:`
` @@ -3214,29 +3193,23 @@ class ManagedClusterWindowsProfile(msrest.serialization.Model): """ _validation = { - 'admin_username': {'required': True}, + "admin_username": {"required": True}, } _attribute_map = { - 'admin_username': {'key': 'adminUsername', 'type': 'str'}, - 'admin_password': {'key': 'adminPassword', 'type': 'str'}, + "admin_username": {"key": "adminUsername", "type": "str"}, + "admin_password": {"key": "adminPassword", "type": "str"}, } - def __init__( - self, - *, - admin_username: str, - admin_password: Optional[str] = None, - **kwargs - ): + def __init__(self, *, admin_username: str, admin_password: Optional[str] = None, **kwargs): """ - :keyword admin_username: Required. Specifies the name of the administrator account. + :keyword admin_username: Specifies the name of the administrator account. :code:`
`:code:`
` **restriction:** Cannot end in "." :code:`
`:code:`
` **Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 - character :code:`
`:code:`
` **Max-length:** 20 characters. + character :code:`
`:code:`
` **Max-length:** 20 characters. Required. :paramtype admin_username: str :keyword admin_password: Specifies the password of the administrator account. :code:`
`:code:`
` **Minimum-length:** 8 characters :code:`
`:code:`
` @@ -3247,12 +3220,12 @@ def __init__( "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!". :paramtype admin_password: str """ - super(ManagedClusterWindowsProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.admin_username = admin_username self.admin_password = admin_password -class OperationListResult(msrest.serialization.Model): +class OperationListResult(_serialization.Model): """The List Compute Operation operation response. Variables are only populated by the server, and will be ignored when sending a request. @@ -3262,24 +3235,20 @@ class OperationListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[OperationValue]'}, + "value": {"key": "value", "type": "[OperationValue]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(OperationListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None -class OperationValue(msrest.serialization.Model): +class OperationValue(_serialization.Model): """Describes the properties of a Compute Operation value. Variables are only populated by the server, and will be ignored when sending a request. @@ -3299,30 +3268,26 @@ class OperationValue(msrest.serialization.Model): """ _validation = { - 'origin': {'readonly': True}, - 'name': {'readonly': True}, - 'operation': {'readonly': True}, - 'resource': {'readonly': True}, - 'description': {'readonly': True}, - 'provider': {'readonly': True}, + "origin": {"readonly": True}, + "name": {"readonly": True}, + "operation": {"readonly": True}, + "resource": {"readonly": True}, + "description": {"readonly": True}, + "provider": {"readonly": True}, } _attribute_map = { - 'origin': {'key': 'origin', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'operation': {'key': 'display.operation', 'type': 'str'}, - 'resource': {'key': 'display.resource', 'type': 'str'}, - 'description': {'key': 'display.description', 'type': 'str'}, - 'provider': {'key': 'display.provider', 'type': 'str'}, + "origin": {"key": "origin", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "operation": {"key": "display.operation", "type": "str"}, + "resource": {"key": "display.resource", "type": "str"}, + "description": {"key": "display.description", "type": "str"}, + "provider": {"key": "display.provider", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(OperationValue, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.origin = None self.name = None self.operation = None @@ -3331,7 +3296,7 @@ def __init__( self.provider = None -class PrivateEndpoint(msrest.serialization.Model): +class PrivateEndpoint(_serialization.Model): """Private endpoint which a connection belongs to. :ivar id: The resource Id for private endpoint. @@ -3339,24 +3304,19 @@ class PrivateEndpoint(msrest.serialization.Model): """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, } - def __init__( - self, - *, - id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin """ :keyword id: The resource Id for private endpoint. :paramtype id: str """ - super(PrivateEndpoint, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id -class PrivateEndpointConnection(msrest.serialization.Model): +class PrivateEndpointConnection(_serialization.Model): """A private endpoint connection. Variables are only populated by the server, and will be ignored when sending a request. @@ -3368,7 +3328,7 @@ class PrivateEndpointConnection(msrest.serialization.Model): :ivar type: The resource type. :vartype type: str :ivar provisioning_state: The current provisioning state. Known values are: "Succeeded", - "Creating", "Deleting", "Failed". + "Creating", "Deleting", and "Failed". :vartype provisioning_state: str or ~azure.mgmt.containerservice.v2020_06_01.models.PrivateEndpointConnectionProvisioningState :ivar private_endpoint: The resource of private endpoint. @@ -3380,19 +3340,22 @@ class PrivateEndpointConnection(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'provisioning_state': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, - 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "private_endpoint": {"key": "properties.privateEndpoint", "type": "PrivateEndpoint"}, + "private_link_service_connection_state": { + "key": "properties.privateLinkServiceConnectionState", + "type": "PrivateLinkServiceConnectionState", + }, } def __init__( @@ -3410,7 +3373,7 @@ def __init__( :paramtype private_link_service_connection_state: ~azure.mgmt.containerservice.v2020_06_01.models.PrivateLinkServiceConnectionState """ - super(PrivateEndpointConnection, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -3419,7 +3382,7 @@ def __init__( self.private_link_service_connection_state = private_link_service_connection_state -class PrivateEndpointConnectionListResult(msrest.serialization.Model): +class PrivateEndpointConnectionListResult(_serialization.Model): """A list of private endpoint connections. :ivar value: The collection value. @@ -3427,37 +3390,32 @@ class PrivateEndpointConnectionListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, + "value": {"key": "value", "type": "[PrivateEndpointConnection]"}, } - def __init__( - self, - *, - value: Optional[List["_models.PrivateEndpointConnection"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.PrivateEndpointConnection"]] = None, **kwargs): """ :keyword value: The collection value. :paramtype value: list[~azure.mgmt.containerservice.v2020_06_01.models.PrivateEndpointConnection] """ - super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value -class PrivateLinkServiceConnectionState(msrest.serialization.Model): +class PrivateLinkServiceConnectionState(_serialization.Model): """The state of a private link service connection. :ivar status: The private link service connection status. Known values are: "Pending", - "Approved", "Rejected", "Disconnected". + "Approved", "Rejected", and "Disconnected". :vartype status: str or ~azure.mgmt.containerservice.v2020_06_01.models.ConnectionStatus :ivar description: The private link service connection description. :vartype description: str """ _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, + "status": {"key": "status", "type": "str"}, + "description": {"key": "description", "type": "str"}, } def __init__( @@ -3469,17 +3427,17 @@ def __init__( ): """ :keyword status: The private link service connection status. Known values are: "Pending", - "Approved", "Rejected", "Disconnected". + "Approved", "Rejected", and "Disconnected". :paramtype status: str or ~azure.mgmt.containerservice.v2020_06_01.models.ConnectionStatus :keyword description: The private link service connection description. :paramtype description: str """ - super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) + super().__init__(**kwargs) self.status = status self.description = description -class ResourceReference(msrest.serialization.Model): +class ResourceReference(_serialization.Model): """A reference to an Azure resource. :ivar id: The fully qualified Azure resource id. @@ -3487,43 +3445,33 @@ class ResourceReference(msrest.serialization.Model): """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, } - def __init__( - self, - *, - id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin """ :keyword id: The fully qualified Azure resource id. :paramtype id: str """ - super(ResourceReference, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id -class TagsObject(msrest.serialization.Model): +class TagsObject(_serialization.Model): """Tags object for patch operations. - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] """ _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] """ - super(TagsObject, self).__init__(**kwargs) + super().__init__(**kwargs) self.tags = tags diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/models/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/models/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/models/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/models/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/operations/__init__.py index 9ef6890a9e03..65da25631a4b 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/operations/__init__.py @@ -14,11 +14,12 @@ from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'Operations', - 'ManagedClustersOperations', - 'AgentPoolsOperations', - 'PrivateEndpointConnectionsOperations', + "Operations", + "ManagedClustersOperations", + "AgentPoolsOperations", + "PrivateEndpointConnectionsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/operations/_agent_pools_operations.py index edb6a6f65953..c000b52ae74e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/operations/_agent_pools_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,249 +27,250 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - *, - json: Optional[_models.AgentPool] = None, - content: Any = None, - **kwargs: Any + _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, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + _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, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_get_upgrade_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_available_agent_pool_versions_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class AgentPoolsOperations: """ @@ -285,48 +291,40 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> Iterable[_models.AgentPoolListResult]: + def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> Iterable["_models.AgentPool"]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. The operation returns properties of each agent pool. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AgentPoolListResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_06_01.models.AgentPoolListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either AgentPool or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_06_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -334,16 +332,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -359,10 +352,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -372,54 +363,45 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore @distributed_trace def get( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPool: """Gets the agent pool. Gets the details of the agent pool by managed cluster and resource group. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPool, or the result of cls(response) + :return: AgentPool or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_06_01.models.AgentPool - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -427,57 +409,60 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore def _create_or_update_initial( self, resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: _models.AgentPool, + parameters: Union[_models.AgentPool, IO], **kwargs: Any ) -> _models.AgentPool: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - _json = self._serialize.body(parameters, 'AgentPool') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "AgentPool") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -485,10 +470,9 @@ def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -496,40 +480,86 @@ def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - - @distributed_trace + @overload def begin_create_or_update( self, resource_group_name: str, resource_name: str, agent_pool_name: str, parameters: _models.AgentPool, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.AgentPool]: """Creates or updates an agent pool. Creates or updates an agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :param parameters: Parameters supplied to the Create or Update an agent pool operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2020_06_01.models.AgentPool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_06_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AgentPool]: + """Creates or updates an agent pool. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: Parameters supplied to the Create or Update an agent pool operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -541,20 +571,56 @@ def begin_create_or_update( :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_06_01.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: Union[_models.AgentPool, IO], + **kwargs: Any + ) -> LROPoller[_models.AgentPool]: + """Creates or updates an agent pool. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: Parameters supplied to the Create or Update an agent pool operation. Is + either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2020_06_01.models.AgentPool or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_06_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -563,66 +629,55 @@ def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -630,10 +685,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -643,26 +697,21 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + def begin_delete( + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> LROPoller[None]: """Deletes an agent pool. Deletes the agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -674,100 +723,86 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPoolUpgradeProfile: """Gets upgrade profile for an agent pool. Gets the details of the upgrade profile for an agent pool with a specified resource group and managed cluster name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolUpgradeProfile, or the result of cls(response) + :return: AgentPoolUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_06_01.models.AgentPoolUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -775,64 +810,56 @@ def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolUpgradeProfile', pipeline_response) + deserialized = self._deserialize("AgentPoolUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore @distributed_trace def get_available_agent_pool_versions( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported versions for the specified agent pool. Gets a list of supported versions for the specified agent pool. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolAvailableVersions, or the result of cls(response) + :return: AgentPoolAvailableVersions or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_06_01.models.AgentPoolAvailableVersions - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolAvailableVersions] - request = build_get_available_agent_pool_versions_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_available_agent_pool_versions.metadata['url'], + template_url=self.get_available_agent_pool_versions.metadata["url"], headers=_headers, params=_params, ) @@ -840,22 +867,20 @@ def get_available_agent_pool_versions( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolAvailableVersions', pipeline_response) + deserialized = self._deserialize("AgentPoolAvailableVersions", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_available_agent_pool_versions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore - + get_available_agent_pool_versions.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/operations/_managed_clusters_operations.py index 62bb702f62c8..dc52c87e9f19 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/operations/_managed_clusters_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,557 +27,536 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters") + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters" + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_resource_group_request( - subscription_id: str, - resource_group_name: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters", + ) # 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', min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_upgrade_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_access_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, role_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 = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "roleName": _SERIALIZER.url("role_name", role_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "roleName": _SERIALIZER.url("role_name", role_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_admin_credentials_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_user_credentials_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_monitoring_user_credentials_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: + +def build_get_request(resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedCluster] = None, - content: Any = None, - **kwargs: Any +def build_create_or_update_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_update_tags_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.TagsObject] = None, - content: Any = None, - **kwargs: Any + +def build_update_tags_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + +def build_delete_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_reset_service_principal_profile_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedClusterServicePrincipalProfile] = None, - content: Any = None, - **kwargs: Any + +def build_reset_service_principal_profile_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_reset_aad_profile_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedClusterAADProfile] = None, - content: Any = None, - **kwargs: Any +def build_reset_aad_profile_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_rotate_cluster_certificates_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any +def build_rotate_cluster_certificates_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + class ManagedClustersOperations: """ @@ -593,41 +577,35 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.ManagedClusterListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.ManagedCluster"]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. The operation returns properties of each managed cluster. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_06_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_06_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -635,14 +613,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -658,10 +633,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -671,50 +644,42 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> Iterable[_models.ManagedClusterListResult]: + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.ManagedCluster"]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. The operation returns properties of each managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_06_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_06_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -722,15 +687,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -746,10 +707,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -759,51 +718,43 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.ManagedClusterUpgradeProfile: """Gets upgrade profile for a managed cluster. Gets the details of the upgrade profile for a managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterUpgradeProfile, or the result of cls(response) + :return: ManagedClusterUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_06_01.models.ManagedClusterUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -811,33 +762,27 @@ def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterUpgradeProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore @distributed_trace def get_access_profile( - self, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, role_name: str, **kwargs: Any ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. @@ -848,36 +793,33 @@ def get_access_profile( `ListClusterAdminCredentials `_ . - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param role_name: The name of the role for managed cluster accessProfile resource. + :param role_name: The name of the role for managed cluster accessProfile resource. Required. :type role_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterAccessProfile, or the result of cls(response) + :return: ManagedClusterAccessProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_06_01.models.ManagedClusterAccessProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterAccessProfile] - request = build_get_access_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, role_name=role_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_access_profile.metadata['url'], + template_url=self.get_access_profile.metadata["url"], headers=_headers, params=_params, ) @@ -885,64 +827,56 @@ def get_access_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterAccessProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterAccessProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_access_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore - + get_access_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore @distributed_trace def list_cluster_admin_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster admin credential of a managed cluster. Gets cluster admin credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_06_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_admin_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_admin_credentials.metadata['url'], + template_url=self.list_cluster_admin_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -950,64 +884,56 @@ def list_cluster_admin_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_admin_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore - + list_cluster_admin_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore @distributed_trace def list_cluster_user_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster user credential of a managed cluster. Gets cluster user credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_06_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_user_credentials.metadata['url'], + template_url=self.list_cluster_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -1015,65 +941,57 @@ def list_cluster_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore - + list_cluster_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore @distributed_trace def list_cluster_monitoring_user_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster monitoring user credential of a managed cluster. Gets cluster monitoring user credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_06_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_monitoring_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + template_url=self.list_cluster_monitoring_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -1081,64 +999,54 @@ def list_cluster_monitoring_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_monitoring_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore - + list_cluster_monitoring_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore @distributed_trace - def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.ManagedCluster: + def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.ManagedCluster: """Gets a managed cluster. Gets the details of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedCluster, or the result of cls(response) + :return: ManagedCluster or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_06_01.models.ManagedCluster - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -1146,55 +1054,54 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _create_or_update_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.ManagedCluster, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'ManagedCluster') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedCluster") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1202,10 +1109,9 @@ def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -1213,25 +1119,26 @@ def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - @distributed_trace + @overload def begin_create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedCluster, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. @@ -1239,12 +1146,16 @@ def begin_create_or_update( Creates or updates a managed cluster with the specified configuration for agents and Kubernetes version. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2020_06_01.models.ManagedCluster + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1257,20 +1168,91 @@ def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_06_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster with the specified configuration for agents and Kubernetes + version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_06_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster with the specified configuration for agents and Kubernetes + version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. Is + either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2020_06_01.models.ManagedCluster or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_06_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -1278,69 +1260,66 @@ def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _update_tags_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.TagsObject, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request_initial( - subscription_id=self._config.subscription_id, + request = build_update_tags_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_tags_initial.metadata['url'], + content=_content, + template_url=self._update_tags_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1348,44 +1327,118 @@ def _update_tags_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_tags_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _update_tags_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - @distributed_trace + @overload def begin_update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates a managed cluster with the specified tags. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2020_06_01.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_06_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates a managed cluster with the specified tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_06_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates a managed cluster with the specified tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2020_06_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1398,20 +1451,17 @@ def begin_update_tags( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_06_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, @@ -1419,64 +1469,54 @@ def begin_update_tags( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1484,10 +1524,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1497,23 +1536,17 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> LROPoller[None]: + def begin_delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> LROPoller[None]: """Deletes a managed cluster. Deletes the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1525,85 +1558,83 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterServicePrincipalProfile, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterServicePrincipalProfile") - request = build_reset_service_principal_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_service_principal_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_service_principal_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_service_principal_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1611,10 +1642,9 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1624,29 +1654,106 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re if cls: return cls(pipeline_response, None, {}) - _reset_service_principal_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore - + _reset_service_principal_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore - @distributed_trace - def begin_reset_service_principal_profile( # pylint: disable=inconsistent-return-statements + @overload + def begin_reset_service_principal_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterServicePrincipalProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: """Reset Service Principal Profile of a managed cluster. Update the service principal Profile for a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a - Managed Cluster. + Managed Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2020_06_01.models.ManagedClusterServicePrincipalProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reset Service Principal Profile of a managed cluster. + + Update the service principal Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a + Managed Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Reset Service Principal Profile of a managed cluster. + + Update the service principal Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a + Managed Cluster. Is either a model type or a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2020_06_01.models.ManagedClusterServicePrincipalProfile or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1657,20 +1764,17 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1678,67 +1782,68 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_service_principal_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + begin_reset_service_principal_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterAADProfile, + parameters: Union[_models.ManagedClusterAADProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterAADProfile") - request = build_reset_aad_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_aad_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_aad_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_aad_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1746,10 +1851,9 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1759,28 +1863,32 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement if cls: return cls(pipeline_response, None, {}) - _reset_aad_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - + _reset_aad_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - @distributed_trace - def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements + @overload + def begin_reset_aad_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterAADProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: """Reset AAD Profile of a managed cluster. Update the AAD Profile for a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed - Cluster. + Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2020_06_01.models.ManagedClusterAADProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1791,20 +1899,90 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reset AAD Profile of a managed cluster. + + Update the AAD Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed + Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterAADProfile, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Reset AAD Profile of a managed cluster. + + Update the AAD Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed + Cluster. Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2020_06_01.models.ManagedClusterAADProfile or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1812,62 +1990,52 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_aad_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + begin_reset_aad_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_rotate_cluster_certificates_request_initial( - subscription_id=self._config.subscription_id, + request = build_rotate_cluster_certificates_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._rotate_cluster_certificates_initial.metadata['url'], + template_url=self._rotate_cluster_certificates_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1875,10 +2043,9 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1888,23 +2055,19 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return if cls: return cls(pipeline_response, None, {}) - _rotate_cluster_certificates_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore - + _rotate_cluster_certificates_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore @distributed_trace - def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + def begin_rotate_cluster_certificates( + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> LROPoller[None]: """Rotate certificates of a managed cluster. Rotate certificates of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1916,52 +2079,45 @@ def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-st Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._rotate_cluster_certificates_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_rotate_cluster_certificates.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore + begin_rotate_cluster_certificates.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/operations/_operations.py index 7d1a57187b59..f0da068131f4 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/operations/_operations.py @@ -7,10 +7,15 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,38 +25,34 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - **kwargs: Any -) -> HttpRequest: + +def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.ContainerService/operations") # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class Operations: """ @@ -72,36 +73,31 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.OperationListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.OperationValue"]: """Gets a list of compute operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationListResult or the result of cls(response) + :return: An iterator like instance of either OperationValue or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_06_01.models.OperationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_06_01.models.OperationValue] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -109,13 +105,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -131,10 +125,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -144,8 +136,6 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.ContainerService/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ContainerService/operations"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/operations/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/operations/_private_endpoint_connections_operations.py index 557dbb933621..9b7417067af5 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/operations/_private_endpoint_connections_operations.py @@ -6,11 +6,15 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod @@ -21,173 +25,191 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - subscription_id: str, resource_group_name: str, resource_name: str, private_endpoint_connection_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 = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_update_request( - subscription_id: str, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, - *, - json: Optional[_models.PrivateEndpointConnection] = None, - content: Any = None, + subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request_initial( - subscription_id: str, +def build_delete_request( resource_group_name: str, resource_name: str, private_endpoint_connection_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 = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class PrivateEndpointConnectionsOperations: """ @@ -208,46 +230,39 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnectionListResult: """Gets a list of private endpoint connections in the specified managed cluster. Gets a list of private endpoint connections in the specified managed cluster. The operation returns properties of each private endpoint connection. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnectionListResult, or the result of cls(response) + :return: PrivateEndpointConnectionListResult or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_06_01.models.PrivateEndpointConnectionListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnectionListResult] - request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -255,68 +270,59 @@ def list( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore - + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore @distributed_trace def get( - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnection: """Gets the private endpoint connection. Gets the details of the private endpoint connection by managed cluster and resource group. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_06_01.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -324,75 +330,149 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - @distributed_trace + @overload def update( self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, parameters: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateEndpointConnection: """Updates a private endpoint connection. Updates a private endpoint connection in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :param parameters: Parameters supplied to the Update a private endpoint connection operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2020_06_01.models.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2020_06_01.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: Parameters supplied to the Update a private endpoint connection operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_06_01.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @distributed_trace + def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: Union[_models.PrivateEndpointConnection, IO], + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: Parameters supplied to the Update a private endpoint connection operation. + Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2020_06_01.models.PrivateEndpointConnection or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2020_06_01.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - _json = self._serialize.body(parameters, 'PrivateEndpointConnection') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateEndpointConnection") request = build_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update.metadata['url'], + content=_content, + template_url=self.update.metadata["url"], headers=_headers, params=_params, ) @@ -400,52 +480,43 @@ def update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -453,10 +524,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -466,26 +536,21 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + def begin_delete( + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> LROPoller[None]: """Deletes a private endpoint connection. Deletes the private endpoint connection in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -497,53 +562,46 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/__init__.py index 37a5f9e02e6f..a8716d29afe8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/__init__.py @@ -14,7 +14,8 @@ except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['ContainerServiceClient'] + +__all__ = ["ContainerServiceClient"] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/_configuration.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/_configuration.py index 460c5897943d..e8b6063d7379 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/_configuration.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/_configuration.py @@ -18,30 +18,26 @@ VERSION = "unknown" + class ContainerServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ContainerServiceClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2020-07-01". 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: + def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ContainerServiceClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2020-07-01") # type: str + api_version = kwargs.pop("api_version", "2020-07-01") # type: str if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -51,23 +47,24 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-containerservice/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-containerservice/{}".format(VERSION)) self._configure(**kwargs) def _configure( - self, - **kwargs # type: Any + self, **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/_container_service_client.py index d081c9189e72..7255ca6edbf7 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/_container_service_client.py @@ -9,20 +9,25 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from . import models +from .._serialization import Deserializer, Serializer from ._configuration import ContainerServiceClientConfiguration -from .operations import AgentPoolsOperations, ManagedClustersOperations, Operations, PrivateEndpointConnectionsOperations +from .operations import ( + AgentPoolsOperations, + ManagedClustersOperations, + Operations, + PrivateEndpointConnectionsOperations, +) if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class ContainerServiceClient: + +class ContainerServiceClient: # pylint: disable=client-accepts-api-version-keyword """The Container Service Client. :ivar operations: Operations operations @@ -35,10 +40,10 @@ class ContainerServiceClient: :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations :vartype private_endpoint_connections: azure.mgmt.containerservice.v2020_07_01.operations.PrivateEndpointConnectionsOperations - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -56,32 +61,25 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = ContainerServiceClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = ContainerServiceClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize - ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.managed_clusters = ManagedClustersOperations( self._client, self._config, self._serialize, self._deserialize ) - self.agent_pools = AgentPoolsOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) self.private_endpoint_connections = PrivateEndpointConnectionsOperations( self._client, self._config, self._serialize, self._deserialize ) - - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> HttpResponse: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -90,7 +88,7 @@ def _send_request( >>> response = client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/_metadata.json b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/_metadata.json index a918c23d102f..2cd8dc3c6bba 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/_metadata.json +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/_metadata.json @@ -10,20 +10,20 @@ "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { "credential": { - "signature": "credential, # type: \"TokenCredential\"", - "description": "Credential needed for the client to connect to Azure.", + "signature": "credential: \"TokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true }, "subscription_id": { - "signature": "subscription_id, # type: str", - "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "signature": "subscription_id: str,", + "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.", "docstring_type": "str", "required": true } @@ -31,13 +31,13 @@ "async": { "credential": { "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure.", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { "signature": "subscription_id: str,", - "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.", "docstring_type": "str", "required": true } @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=\"https://management.azure.com\", # type: str", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/_patch.py index 74e48ecd07cf..f99e77fef986 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/_patch.py @@ -28,4 +28,4 @@ # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + pass diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/_vendor.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/_vendor.py index 138f663c53a4..9aad73fc743e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/_vendor.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/_vendor.py @@ -7,6 +7,7 @@ from azure.core.pipeline.transport import HttpRequest + def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) @@ -14,6 +15,7 @@ def _convert_request(request, files=None): request.set_formdata_body(files) return request + def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -21,7 +23,5 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [ - c for c in formatted_components if "{}".format(key.args[0]) not in c - ] + components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/aio/__init__.py index 37a5f9e02e6f..a8716d29afe8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/aio/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/aio/__init__.py @@ -14,7 +14,8 @@ except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['ContainerServiceClient'] + +__all__ = ["ContainerServiceClient"] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/aio/_configuration.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/aio/_configuration.py index 33a5c6f52ddd..ea3193a0c6b7 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/aio/_configuration.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/aio/_configuration.py @@ -18,30 +18,26 @@ VERSION = "unknown" + class ContainerServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ContainerServiceClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2020-07-01". 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: + def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ContainerServiceClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2020-07-01") # type: str + api_version = kwargs.pop("api_version", "2020-07-01") # type: str if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -51,22 +47,21 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-containerservice/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-containerservice/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, - **kwargs: Any - ) -> None: - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/aio/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/aio/_container_service_client.py index 6a79a0e958c0..6a7ed4d33160 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/aio/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/aio/_container_service_client.py @@ -9,20 +9,25 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from .. import models +from ..._serialization import Deserializer, Serializer from ._configuration import ContainerServiceClientConfiguration -from .operations import AgentPoolsOperations, ManagedClustersOperations, Operations, PrivateEndpointConnectionsOperations +from .operations import ( + AgentPoolsOperations, + ManagedClustersOperations, + Operations, + PrivateEndpointConnectionsOperations, +) if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class ContainerServiceClient: + +class ContainerServiceClient: # pylint: disable=client-accepts-api-version-keyword """The Container Service Client. :ivar operations: Operations operations @@ -36,10 +41,10 @@ class ContainerServiceClient: :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations :vartype private_endpoint_connections: azure.mgmt.containerservice.v2020_07_01.aio.operations.PrivateEndpointConnectionsOperations - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -57,32 +62,25 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = ContainerServiceClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = ContainerServiceClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize - ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.managed_clusters = ManagedClustersOperations( self._client, self._config, self._serialize, self._deserialize ) - self.agent_pools = AgentPoolsOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) self.private_endpoint_connections = PrivateEndpointConnectionsOperations( self._client, self._config, self._serialize, self._deserialize ) - - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -91,7 +89,7 @@ def _send_request( >>> response = await client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/aio/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/aio/_patch.py index 74e48ecd07cf..f99e77fef986 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/aio/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/aio/_patch.py @@ -28,4 +28,4 @@ # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + pass diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/aio/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/aio/operations/__init__.py index 9ef6890a9e03..65da25631a4b 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/aio/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/aio/operations/__init__.py @@ -14,11 +14,12 @@ from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'Operations', - 'ManagedClustersOperations', - 'AgentPoolsOperations', - 'PrivateEndpointConnectionsOperations', + "Operations", + "ManagedClustersOperations", + "AgentPoolsOperations", + "PrivateEndpointConnectionsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/aio/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/aio/operations/_agent_pools_operations.py index 4db150fe871e..97a0a3557913 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/aio/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/aio/operations/_agent_pools_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +29,20 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._agent_pools_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_available_agent_pool_versions_request, build_get_request, build_get_upgrade_profile_request, build_list_request, build_upgrade_node_image_version_request_initial -T = TypeVar('T') +from ...operations._agent_pools_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_available_agent_pool_versions_request, + build_get_request, + build_get_upgrade_profile_request, + build_list_request, + build_upgrade_node_image_version_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class AgentPoolsOperations: """ .. warning:: @@ -45,48 +62,41 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.AgentPoolListResult]: + def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncIterable["_models.AgentPool"]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. The operation returns properties of each agent pool. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AgentPoolListResult or the result of cls(response) + :return: An iterator like instance of either AgentPool or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_07_01.models.AgentPoolListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_07_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -94,16 +104,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -119,10 +124,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -132,54 +135,45 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore @distributed_trace_async async def get( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPool: """Gets the agent pool. Gets the details of the agent pool by managed cluster and resource group. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPool, or the result of cls(response) + :return: AgentPool or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_07_01.models.AgentPool - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -187,57 +181,60 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore async def _create_or_update_initial( self, resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: _models.AgentPool, + parameters: Union[_models.AgentPool, IO], **kwargs: Any ) -> _models.AgentPool: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - _json = self._serialize.body(parameters, 'AgentPool') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "AgentPool") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -245,10 +242,9 @@ async def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -256,40 +252,127 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - @distributed_trace_async + @overload async def begin_create_or_update( self, resource_group_name: str, resource_name: str, agent_pool_name: str, parameters: _models.AgentPool, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.AgentPool]: """Creates or updates an agent pool. Creates or updates an agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :param parameters: Parameters supplied to the Create or Update an agent pool operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2020_07_01.models.AgentPool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AgentPool or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_07_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AgentPool]: + """Creates or updates an agent pool. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: Parameters supplied to the Create or Update an agent pool operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AgentPool or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_07_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: Union[_models.AgentPool, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.AgentPool]: + """Creates or updates an agent pool. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: Parameters supplied to the Create or Update an agent pool operation. Is + either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2020_07_01.models.AgentPool or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -302,20 +385,17 @@ async def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_07_01.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -324,66 +404,55 @@ async def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -391,10 +460,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -404,26 +472,21 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + async def begin_delete( + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes an agent pool. Deletes the agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -435,100 +498,86 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace_async async def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPoolUpgradeProfile: """Gets upgrade profile for an agent pool. Gets the details of the upgrade profile for an agent pool with a specified resource group and managed cluster name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolUpgradeProfile, or the result of cls(response) + :return: AgentPoolUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_07_01.models.AgentPoolUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -536,64 +585,56 @@ async def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolUpgradeProfile', pipeline_response) + deserialized = self._deserialize("AgentPoolUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore @distributed_trace_async async def get_available_agent_pool_versions( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported versions for the specified agent pool. Gets a list of supported versions for the specified agent pool. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolAvailableVersions, or the result of cls(response) + :return: AgentPoolAvailableVersions or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_07_01.models.AgentPoolAvailableVersions - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolAvailableVersions] - request = build_get_available_agent_pool_versions_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_available_agent_pool_versions.metadata['url'], + template_url=self.get_available_agent_pool_versions.metadata["url"], headers=_headers, params=_params, ) @@ -601,52 +642,43 @@ async def get_available_agent_pool_versions( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolAvailableVersions', pipeline_response) + deserialized = self._deserialize("AgentPoolAvailableVersions", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_available_agent_pool_versions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore - + get_available_agent_pool_versions.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore async def _upgrade_node_image_version_initial( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> Optional[_models.AgentPool]: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.AgentPool]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.AgentPool]] - - request = build_upgrade_node_image_version_request_initial( - subscription_id=self._config.subscription_id, + request = build_upgrade_node_image_version_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._upgrade_node_image_version_initial.metadata['url'], + template_url=self._upgrade_node_image_version_initial.metadata["url"], headers=_headers, params=_params, ) @@ -654,10 +686,9 @@ async def _upgrade_node_image_version_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -666,33 +697,28 @@ async def _upgrade_node_image_version_initial( deserialized = None if response.status_code == 202: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _upgrade_node_image_version_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore - + _upgrade_node_image_version_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore @distributed_trace_async async def begin_upgrade_node_image_version( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any - ) -> AsyncLROPoller[_models.AgentPool]: + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: """Upgrade node image version of an agent pool to the latest. Upgrade node image version of an agent pool to the latest. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -706,55 +732,48 @@ async def begin_upgrade_node_image_version( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_07_01.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._upgrade_node_image_version_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_upgrade_node_image_version.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore + begin_upgrade_node_image_version.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/aio/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/aio/operations/_managed_clusters_operations.py index d8866572d965..a22f01dbccef 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/aio/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/aio/operations/_managed_clusters_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +29,27 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._managed_clusters_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_access_profile_request, build_get_request, build_get_upgrade_profile_request, build_list_by_resource_group_request, build_list_cluster_admin_credentials_request, build_list_cluster_monitoring_user_credentials_request, build_list_cluster_user_credentials_request, build_list_request, build_reset_aad_profile_request_initial, build_reset_service_principal_profile_request_initial, build_rotate_cluster_certificates_request_initial, build_update_tags_request_initial -T = TypeVar('T') +from ...operations._managed_clusters_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_access_profile_request, + build_get_request, + build_get_upgrade_profile_request, + build_list_by_resource_group_request, + build_list_cluster_admin_credentials_request, + build_list_cluster_monitoring_user_credentials_request, + build_list_cluster_user_credentials_request, + build_list_request, + build_reset_aad_profile_request, + build_reset_service_principal_profile_request, + build_rotate_cluster_certificates_request, + build_update_tags_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class ManagedClustersOperations: """ .. warning:: @@ -45,41 +69,35 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.ManagedClusterListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.ManagedCluster"]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. The operation returns properties of each managed cluster. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_07_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_07_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -87,14 +105,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -110,10 +125,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -123,50 +136,44 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.ManagedClusterListResult]: + self, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ManagedCluster"]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. The operation returns properties of each managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_07_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_07_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -174,15 +181,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -198,10 +201,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -211,51 +212,43 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace_async async def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.ManagedClusterUpgradeProfile: """Gets upgrade profile for a managed cluster. Gets the details of the upgrade profile for a managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterUpgradeProfile, or the result of cls(response) + :return: ManagedClusterUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_07_01.models.ManagedClusterUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -263,33 +256,27 @@ async def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterUpgradeProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore @distributed_trace_async async def get_access_profile( - self, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, role_name: str, **kwargs: Any ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. @@ -300,36 +287,33 @@ async def get_access_profile( `ListClusterAdminCredentials `_ . - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param role_name: The name of the role for managed cluster accessProfile resource. + :param role_name: The name of the role for managed cluster accessProfile resource. Required. :type role_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterAccessProfile, or the result of cls(response) + :return: ManagedClusterAccessProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_07_01.models.ManagedClusterAccessProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterAccessProfile] - request = build_get_access_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, role_name=role_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_access_profile.metadata['url'], + template_url=self.get_access_profile.metadata["url"], headers=_headers, params=_params, ) @@ -337,64 +321,56 @@ async def get_access_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterAccessProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterAccessProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_access_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore - + get_access_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore @distributed_trace_async async def list_cluster_admin_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster admin credential of a managed cluster. Gets cluster admin credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_07_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_admin_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_admin_credentials.metadata['url'], + template_url=self.list_cluster_admin_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -402,64 +378,56 @@ async def list_cluster_admin_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_admin_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore - + list_cluster_admin_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore @distributed_trace_async async def list_cluster_user_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster user credential of a managed cluster. Gets cluster user credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_07_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_user_credentials.metadata['url'], + template_url=self.list_cluster_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -467,65 +435,57 @@ async def list_cluster_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore - + list_cluster_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore @distributed_trace_async async def list_cluster_monitoring_user_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster monitoring user credential of a managed cluster. Gets cluster monitoring user credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_07_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_monitoring_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + template_url=self.list_cluster_monitoring_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -533,64 +493,54 @@ async def list_cluster_monitoring_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_monitoring_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore - + list_cluster_monitoring_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore @distributed_trace_async - async def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.ManagedCluster: + async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.ManagedCluster: """Gets a managed cluster. Gets the details of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedCluster, or the result of cls(response) + :return: ManagedCluster or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_07_01.models.ManagedCluster - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -598,55 +548,54 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _create_or_update_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.ManagedCluster, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'ManagedCluster') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedCluster") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -654,10 +603,9 @@ async def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -665,25 +613,26 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - @distributed_trace_async + @overload async def begin_create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedCluster, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. @@ -691,12 +640,90 @@ async def begin_create_or_update( Creates or updates a managed cluster with the specified configuration for agents and Kubernetes version. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2020_07_01.models.ManagedCluster + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_07_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster with the specified configuration for agents and Kubernetes + version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_07_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster with the specified configuration for agents and Kubernetes + version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. Is + either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2020_07_01.models.ManagedCluster or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -709,20 +736,17 @@ async def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_07_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -730,69 +754,66 @@ async def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _update_tags_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.TagsObject, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request_initial( - subscription_id=self._config.subscription_id, + request = build_update_tags_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_tags_initial.metadata['url'], + content=_content, + template_url=self._update_tags_initial.metadata["url"], headers=_headers, params=_params, ) @@ -800,44 +821,85 @@ async def _update_tags_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_tags_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _update_tags_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - @distributed_trace_async + @overload async def begin_update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates a managed cluster with the specified tags. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2020_07_01.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_07_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates a managed cluster with the specified tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -850,20 +912,50 @@ async def begin_update_tags( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_07_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates a managed cluster with the specified tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2020_07_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_07_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, @@ -871,64 +963,54 @@ async def begin_update_tags( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -936,10 +1018,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -949,23 +1030,17 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: + async def begin_delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Deletes a managed cluster. Deletes the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -977,85 +1052,83 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterServicePrincipalProfile, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterServicePrincipalProfile") - request = build_reset_service_principal_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_service_principal_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_service_principal_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_service_principal_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1063,10 +1136,9 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1076,29 +1148,106 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist if cls: return cls(pipeline_response, None, {}) - _reset_service_principal_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore - + _reset_service_principal_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore - @distributed_trace_async - async def begin_reset_service_principal_profile( # pylint: disable=inconsistent-return-statements + @overload + async def begin_reset_service_principal_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterServicePrincipalProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: """Reset Service Principal Profile of a managed cluster. Update the service principal Profile for a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a - Managed Cluster. + Managed Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2020_07_01.models.ManagedClusterServicePrincipalProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset Service Principal Profile of a managed cluster. + + Update the service principal Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a + Managed Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset Service Principal Profile of a managed cluster. + + Update the service principal Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a + Managed Cluster. Is either a model type or a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2020_07_01.models.ManagedClusterServicePrincipalProfile or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -1109,20 +1258,17 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1130,67 +1276,68 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_service_principal_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + begin_reset_service_principal_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterAADProfile, + parameters: Union[_models.ManagedClusterAADProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterAADProfile") - request = build_reset_aad_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_aad_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_aad_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_aad_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1198,10 +1345,9 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1211,28 +1357,69 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta if cls: return cls(pipeline_response, None, {}) - _reset_aad_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - + _reset_aad_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - @distributed_trace_async - async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements + @overload + async def begin_reset_aad_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterAADProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: """Reset AAD Profile of a managed cluster. Update the AAD Profile for a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed - Cluster. + Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2020_07_01.models.ManagedClusterAADProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset AAD Profile of a managed cluster. + + Update the AAD Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed + Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -1243,20 +1430,53 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterAADProfile, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset AAD Profile of a managed cluster. + + Update the AAD Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed + Cluster. Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2020_07_01.models.ManagedClusterAADProfile or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1264,62 +1484,52 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_aad_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + begin_reset_aad_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_rotate_cluster_certificates_request_initial( - subscription_id=self._config.subscription_id, + request = build_rotate_cluster_certificates_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._rotate_cluster_certificates_initial.metadata['url'], + template_url=self._rotate_cluster_certificates_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1327,10 +1537,9 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1340,23 +1549,19 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- if cls: return cls(pipeline_response, None, {}) - _rotate_cluster_certificates_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore - + _rotate_cluster_certificates_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore @distributed_trace_async - async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + async def begin_rotate_cluster_certificates( + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Rotate certificates of a managed cluster. Rotate certificates of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1368,52 +1573,45 @@ async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-ret Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._rotate_cluster_certificates_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_rotate_cluster_certificates.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore + begin_rotate_cluster_certificates.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/aio/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/aio/operations/_operations.py index 7b2e40d5c252..73fdd10e4635 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/aio/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/aio/operations/_operations.py @@ -7,9 +7,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,9 +27,11 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._operations import build_list_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class Operations: """ .. warning:: @@ -42,36 +51,31 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.OperationListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.OperationValue"]: """Gets a list of compute operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationListResult or the result of cls(response) + :return: An iterator like instance of either OperationValue or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_07_01.models.OperationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_07_01.models.OperationValue] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -79,13 +83,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -101,10 +103,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -114,8 +114,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.ContainerService/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ContainerService/operations"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/aio/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/aio/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/aio/operations/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/aio/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/aio/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/aio/operations/_private_endpoint_connections_operations.py index 622697e7dff4..4d39527f84e2 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/aio/operations/_private_endpoint_connections_operations.py @@ -6,9 +6,15 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -20,10 +26,17 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._private_endpoint_connections_operations import build_delete_request_initial, build_get_request, build_list_request, build_update_request -T = TypeVar('T') +from ...operations._private_endpoint_connections_operations import ( + build_delete_request, + build_get_request, + build_list_request, + build_update_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class PrivateEndpointConnectionsOperations: """ .. warning:: @@ -43,46 +56,39 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async async def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnectionListResult: """Gets a list of private endpoint connections in the specified managed cluster. Gets a list of private endpoint connections in the specified managed cluster. The operation returns properties of each private endpoint connection. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnectionListResult, or the result of cls(response) + :return: PrivateEndpointConnectionListResult or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_07_01.models.PrivateEndpointConnectionListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnectionListResult] - request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -90,68 +96,59 @@ async def list( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore - + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore @distributed_trace_async async def get( - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnection: """Gets the private endpoint connection. Gets the details of the private endpoint connection by managed cluster and resource group. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_07_01.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -159,75 +156,149 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - - @distributed_trace_async + @overload async def update( self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, parameters: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateEndpointConnection: """Updates a private endpoint connection. Updates a private endpoint connection in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :param parameters: Parameters supplied to the Update a private endpoint connection operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2020_07_01.models.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_07_01.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + async def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: Parameters supplied to the Update a private endpoint connection operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2020_07_01.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: Union[_models.PrivateEndpointConnection, IO], + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: Parameters supplied to the Update a private endpoint connection operation. + Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2020_07_01.models.PrivateEndpointConnection or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2020_07_01.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - _json = self._serialize.body(parameters, 'PrivateEndpointConnection') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateEndpointConnection") request = build_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update.metadata['url'], + content=_content, + template_url=self.update.metadata["url"], headers=_headers, params=_params, ) @@ -235,52 +306,43 @@ async def update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -288,10 +350,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -301,26 +362,21 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + async def begin_delete( + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes a private endpoint connection. Deletes the private endpoint connection in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -332,53 +388,46 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/models/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/models/__init__.py index fd24e398e7fa..2e9bf83cafab 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/models/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/models/__init__.py @@ -59,103 +59,101 @@ from ._models_py3 import TagsObject from ._models_py3 import UserAssignedIdentity - -from ._container_service_client_enums import ( - AgentPoolMode, - AgentPoolType, - ConnectionStatus, - ContainerServiceStorageProfileTypes, - ContainerServiceVMSizeTypes, - Count, - LicenseType, - LoadBalancerSku, - ManagedClusterSKUName, - ManagedClusterSKUTier, - NetworkMode, - NetworkPlugin, - NetworkPolicy, - OSType, - OutboundType, - PrivateEndpointConnectionProvisioningState, - ResourceIdentityType, - ScaleSetEvictionPolicy, - ScaleSetPriority, -) +from ._container_service_client_enums import AgentPoolMode +from ._container_service_client_enums import AgentPoolType +from ._container_service_client_enums import ConnectionStatus +from ._container_service_client_enums import ContainerServiceStorageProfileTypes +from ._container_service_client_enums import ContainerServiceVMSizeTypes +from ._container_service_client_enums import Count +from ._container_service_client_enums import LicenseType +from ._container_service_client_enums import LoadBalancerSku +from ._container_service_client_enums import ManagedClusterSKUName +from ._container_service_client_enums import ManagedClusterSKUTier +from ._container_service_client_enums import NetworkMode +from ._container_service_client_enums import NetworkPlugin +from ._container_service_client_enums import NetworkPolicy +from ._container_service_client_enums import OSType +from ._container_service_client_enums import OutboundType +from ._container_service_client_enums import PrivateEndpointConnectionProvisioningState +from ._container_service_client_enums import ResourceIdentityType +from ._container_service_client_enums import ScaleSetEvictionPolicy +from ._container_service_client_enums import ScaleSetPriority from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'AgentPool', - 'AgentPoolAvailableVersions', - 'AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem', - 'AgentPoolListResult', - 'AgentPoolUpgradeProfile', - 'AgentPoolUpgradeProfilePropertiesUpgradesItem', - 'AgentPoolUpgradeSettings', - 'BaseManagedCluster', - 'CloudErrorBody', - 'ContainerServiceDiagnosticsProfile', - 'ContainerServiceLinuxProfile', - 'ContainerServiceMasterProfile', - 'ContainerServiceNetworkProfile', - 'ContainerServiceSshConfiguration', - 'ContainerServiceSshPublicKey', - 'ContainerServiceVMDiagnostics', - 'CredentialResult', - 'CredentialResults', - 'ManagedCluster', - 'ManagedClusterAADProfile', - 'ManagedClusterAPIServerAccessProfile', - 'ManagedClusterAccessProfile', - 'ManagedClusterAddonProfile', - 'ManagedClusterAddonProfileIdentity', - 'ManagedClusterAgentPoolProfile', - 'ManagedClusterAgentPoolProfileProperties', - 'ManagedClusterIdentity', - 'ManagedClusterIdentityUserAssignedIdentitiesValue', - 'ManagedClusterListResult', - 'ManagedClusterLoadBalancerProfile', - 'ManagedClusterLoadBalancerProfileManagedOutboundIPs', - 'ManagedClusterLoadBalancerProfileOutboundIPPrefixes', - 'ManagedClusterLoadBalancerProfileOutboundIPs', - 'ManagedClusterPoolUpgradeProfile', - 'ManagedClusterPoolUpgradeProfileUpgradesItem', - 'ManagedClusterPropertiesAutoScalerProfile', - 'ManagedClusterPropertiesIdentityProfileValue', - 'ManagedClusterSKU', - 'ManagedClusterServicePrincipalProfile', - 'ManagedClusterUpgradeProfile', - 'ManagedClusterWindowsProfile', - 'OperationListResult', - 'OperationValue', - 'PrivateEndpoint', - 'PrivateEndpointConnection', - 'PrivateEndpointConnectionListResult', - 'PrivateLinkServiceConnectionState', - 'Resource', - 'ResourceReference', - 'SubResource', - 'TagsObject', - 'UserAssignedIdentity', - 'AgentPoolMode', - 'AgentPoolType', - 'ConnectionStatus', - 'ContainerServiceStorageProfileTypes', - 'ContainerServiceVMSizeTypes', - 'Count', - 'LicenseType', - 'LoadBalancerSku', - 'ManagedClusterSKUName', - 'ManagedClusterSKUTier', - 'NetworkMode', - 'NetworkPlugin', - 'NetworkPolicy', - 'OSType', - 'OutboundType', - 'PrivateEndpointConnectionProvisioningState', - 'ResourceIdentityType', - 'ScaleSetEvictionPolicy', - 'ScaleSetPriority', + "AgentPool", + "AgentPoolAvailableVersions", + "AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem", + "AgentPoolListResult", + "AgentPoolUpgradeProfile", + "AgentPoolUpgradeProfilePropertiesUpgradesItem", + "AgentPoolUpgradeSettings", + "BaseManagedCluster", + "CloudErrorBody", + "ContainerServiceDiagnosticsProfile", + "ContainerServiceLinuxProfile", + "ContainerServiceMasterProfile", + "ContainerServiceNetworkProfile", + "ContainerServiceSshConfiguration", + "ContainerServiceSshPublicKey", + "ContainerServiceVMDiagnostics", + "CredentialResult", + "CredentialResults", + "ManagedCluster", + "ManagedClusterAADProfile", + "ManagedClusterAPIServerAccessProfile", + "ManagedClusterAccessProfile", + "ManagedClusterAddonProfile", + "ManagedClusterAddonProfileIdentity", + "ManagedClusterAgentPoolProfile", + "ManagedClusterAgentPoolProfileProperties", + "ManagedClusterIdentity", + "ManagedClusterIdentityUserAssignedIdentitiesValue", + "ManagedClusterListResult", + "ManagedClusterLoadBalancerProfile", + "ManagedClusterLoadBalancerProfileManagedOutboundIPs", + "ManagedClusterLoadBalancerProfileOutboundIPPrefixes", + "ManagedClusterLoadBalancerProfileOutboundIPs", + "ManagedClusterPoolUpgradeProfile", + "ManagedClusterPoolUpgradeProfileUpgradesItem", + "ManagedClusterPropertiesAutoScalerProfile", + "ManagedClusterPropertiesIdentityProfileValue", + "ManagedClusterSKU", + "ManagedClusterServicePrincipalProfile", + "ManagedClusterUpgradeProfile", + "ManagedClusterWindowsProfile", + "OperationListResult", + "OperationValue", + "PrivateEndpoint", + "PrivateEndpointConnection", + "PrivateEndpointConnectionListResult", + "PrivateLinkServiceConnectionState", + "Resource", + "ResourceReference", + "SubResource", + "TagsObject", + "UserAssignedIdentity", + "AgentPoolMode", + "AgentPoolType", + "ConnectionStatus", + "ContainerServiceStorageProfileTypes", + "ContainerServiceVMSizeTypes", + "Count", + "LicenseType", + "LoadBalancerSku", + "ManagedClusterSKUName", + "ManagedClusterSKUTier", + "NetworkMode", + "NetworkPlugin", + "NetworkPolicy", + "OSType", + "OutboundType", + "PrivateEndpointConnectionProvisioningState", + "ResourceIdentityType", + "ScaleSetEvictionPolicy", + "ScaleSetPriority", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/models/_container_service_client_enums.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/models/_container_service_client_enums.py index 28581c645ead..0576009e70c3 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/models/_container_service_client_enums.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/models/_container_service_client_enums.py @@ -11,28 +11,28 @@ class AgentPoolMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """AgentPoolMode represents mode of an agent pool. - """ + """AgentPoolMode represents mode of an agent pool.""" SYSTEM = "System" USER = "User" + class AgentPoolType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """AgentPoolType represents types of an agent pool. - """ + """AgentPoolType represents types of an agent pool.""" VIRTUAL_MACHINE_SCALE_SETS = "VirtualMachineScaleSets" AVAILABILITY_SET = "AvailabilitySet" + class ConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The private link service connection status. - """ + """The private link service connection status.""" PENDING = "Pending" APPROVED = "Approved" REJECTED = "Rejected" DISCONNECTED = "Disconnected" + class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the orchestrator choice. @@ -41,9 +41,9 @@ class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEn STORAGE_ACCOUNT = "StorageAccount" MANAGED_DISKS = "ManagedDisks" + class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Size of agent VMs. - """ + """Size of agent VMs.""" STANDARD_A1 = "Standard_A1" STANDARD_A10 = "Standard_A10" @@ -220,6 +220,7 @@ class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): STANDARD_NV24 = "Standard_NV24" STANDARD_NV6 = "Standard_NV6" + class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): """Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, and 5. The default value is 1. @@ -229,6 +230,7 @@ class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): THREE = 3 FIVE = 5 + class LicenseType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The licenseType to use for Windows VMs. Windows_Server is used to enable Azure Hybrid User Benefits for Windows VMs. @@ -237,70 +239,71 @@ class LicenseType(str, Enum, metaclass=CaseInsensitiveEnumMeta): NONE = "None" WINDOWS_SERVER = "Windows_Server" + class LoadBalancerSku(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The load balancer sku for the managed cluster. - """ + """The load balancer sku for the managed cluster.""" STANDARD = "standard" BASIC = "basic" + class ManagedClusterSKUName(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Name of a managed cluster SKU. - """ + """Name of a managed cluster SKU.""" BASIC = "Basic" + class ManagedClusterSKUTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Tier of a managed cluster SKU. - """ + """Tier of a managed cluster SKU.""" PAID = "Paid" FREE = "Free" + class NetworkMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Network mode used for building Kubernetes network. - """ + """Network mode used for building Kubernetes network.""" TRANSPARENT = "transparent" BRIDGE = "bridge" + class NetworkPlugin(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Network plugin used for building Kubernetes network. - """ + """Network plugin used for building Kubernetes network.""" AZURE = "azure" KUBENET = "kubenet" + class NetworkPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Network policy used for building Kubernetes network. - """ + """Network policy used for building Kubernetes network.""" CALICO = "calico" AZURE = "azure" + class OSType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """OsType to be used to specify os type. Choose from Linux and Windows. Default to Linux. - """ + """OsType to be used to specify os type. Choose from Linux and Windows. Default to Linux.""" LINUX = "Linux" WINDOWS = "Windows" + class OutboundType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The outbound (egress) routing method. - """ + """The outbound (egress) routing method.""" LOAD_BALANCER = "loadBalancer" USER_DEFINED_ROUTING = "userDefinedRouting" + class PrivateEndpointConnectionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The current provisioning state. - """ + """The current provisioning state.""" SUCCEEDED = "Succeeded" CREATING = "Creating" DELETING = "Deleting" FAILED = "Failed" + class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of identity used for the managed cluster. Type 'SystemAssigned' will use an implicitly created identity in master components and an auto-created user assigned identity in MC_ @@ -312,6 +315,7 @@ class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): USER_ASSIGNED = "UserAssigned" NONE = "None" + class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ScaleSetEvictionPolicy to be used to specify eviction policy for Spot virtual machine scale set. Default to Delete. @@ -320,9 +324,9 @@ class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): DELETE = "Delete" DEALLOCATE = "Deallocate" + class ScaleSetPriority(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """ScaleSetPriority to be used to specify virtual machine scale set priority. Default to regular. - """ + """ScaleSetPriority to be used to specify virtual machine scale set priority. Default to regular.""" SPOT = "Spot" REGULAR = "Regular" diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/models/_models_py3.py index d84b26c16881..bac3408bef54 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/models/_models_py3.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/models/_models_py3.py @@ -1,4 +1,5 @@ # coding=utf-8 +# pylint: disable=too-many-lines # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -8,14 +9,14 @@ from typing import Dict, List, Optional, TYPE_CHECKING, Union -import msrest.serialization +from ... import _serialization if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - import __init__ as _models + from .. import models as _models -class SubResource(msrest.serialization.Model): +class SubResource(_serialization.Model): """Reference to another subresource. Variables are only populated by the server, and will be ignored when sending a request. @@ -30,30 +31,26 @@ class SubResource(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(SubResource, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.id = None self.name = None self.type = None -class AgentPool(SubResource): +class AgentPool(SubResource): # pylint: disable=too-many-instance-attributes """Agent Pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -106,7 +103,7 @@ class AgentPool(SubResource): "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :vartype vm_size: str or ~azure.mgmt.containerservice.v2020_07_01.models.ContainerServiceVMSizeTypes :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine @@ -118,7 +115,7 @@ class AgentPool(SubResource): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Known values are: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux" and "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2020_07_01.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -127,10 +124,11 @@ class AgentPool(SubResource): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar type_properties_type: AgentPoolType represents types of an agent pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :vartype type_properties_type: str or ~azure.mgmt.containerservice.v2020_07_01.models.AgentPoolType - :ivar mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", "User". + :ivar mode: AgentPoolMode represents mode of an agent pool. Known values are: "System" and + "User". :vartype mode: str or ~azure.mgmt.containerservice.v2020_07_01.models.AgentPoolMode :ivar orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -149,20 +147,19 @@ class AgentPool(SubResource): :ivar enable_node_public_ip: Enable public IP for nodes. :vartype enable_node_public_ip: bool :ivar scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Known values are: "Spot", "Regular". Default value: "Regular". + priority. Default to regular. Known values are: "Spot" and "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_07_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy - for Spot virtual machine scale set. Default to Delete. Known values are: "Delete", - "Deallocate". Default value: "Delete". + for Spot virtual machine scale set. Default to Delete. Known values are: "Delete" and + "Deallocate". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_07_01.models.ScaleSetEvictionPolicy :ivar spot_max_price: SpotMaxPrice to be used to specify the maximum price you are willing to pay in US Dollars. Possible values are any decimal value greater than zero or -1 which indicates default price to be up-to on-demand. :vartype spot_max_price: float - :ivar tags: A set of tags. Agent pool tags to be persisted on the agent pool virtual machine - scale set. + :ivar tags: Agent pool tags to be persisted on the agent pool virtual machine scale set. :vartype tags: dict[str, str] :ivar node_labels: Agent pool node labels to be persisted across all nodes in agent pool. :vartype node_labels: dict[str, str] @@ -174,45 +171,45 @@ class AgentPool(SubResource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'os_disk_size_gb': {'maximum': 1023, 'minimum': 0}, - 'node_image_version': {'readonly': True}, - 'provisioning_state': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "os_disk_size_gb": {"maximum": 1023, "minimum": 0}, + "node_image_version": {"readonly": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'count': {'key': 'properties.count', 'type': 'int'}, - 'vm_size': {'key': 'properties.vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'properties.osDiskSizeGB', 'type': 'int'}, - 'vnet_subnet_id': {'key': 'properties.vnetSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'properties.maxPods', 'type': 'int'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'max_count': {'key': 'properties.maxCount', 'type': 'int'}, - 'min_count': {'key': 'properties.minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'properties.enableAutoScaling', 'type': 'bool'}, - 'type_properties_type': {'key': 'properties.type', 'type': 'str'}, - 'mode': {'key': 'properties.mode', 'type': 'str'}, - 'orchestrator_version': {'key': 'properties.orchestratorVersion', 'type': 'str'}, - 'node_image_version': {'key': 'properties.nodeImageVersion', 'type': 'str'}, - 'upgrade_settings': {'key': 'properties.upgradeSettings', 'type': 'AgentPoolUpgradeSettings'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'availability_zones': {'key': 'properties.availabilityZones', 'type': '[str]'}, - 'enable_node_public_ip': {'key': 'properties.enableNodePublicIP', 'type': 'bool'}, - 'scale_set_priority': {'key': 'properties.scaleSetPriority', 'type': 'str'}, - 'scale_set_eviction_policy': {'key': 'properties.scaleSetEvictionPolicy', 'type': 'str'}, - 'spot_max_price': {'key': 'properties.spotMaxPrice', 'type': 'float'}, - 'tags': {'key': 'properties.tags', 'type': '{str}'}, - 'node_labels': {'key': 'properties.nodeLabels', 'type': '{str}'}, - 'node_taints': {'key': 'properties.nodeTaints', 'type': '[str]'}, - 'proximity_placement_group_id': {'key': 'properties.proximityPlacementGroupID', 'type': 'str'}, - } - - def __init__( + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "count": {"key": "properties.count", "type": "int"}, + "vm_size": {"key": "properties.vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "properties.osDiskSizeGB", "type": "int"}, + "vnet_subnet_id": {"key": "properties.vnetSubnetID", "type": "str"}, + "max_pods": {"key": "properties.maxPods", "type": "int"}, + "os_type": {"key": "properties.osType", "type": "str"}, + "max_count": {"key": "properties.maxCount", "type": "int"}, + "min_count": {"key": "properties.minCount", "type": "int"}, + "enable_auto_scaling": {"key": "properties.enableAutoScaling", "type": "bool"}, + "type_properties_type": {"key": "properties.type", "type": "str"}, + "mode": {"key": "properties.mode", "type": "str"}, + "orchestrator_version": {"key": "properties.orchestratorVersion", "type": "str"}, + "node_image_version": {"key": "properties.nodeImageVersion", "type": "str"}, + "upgrade_settings": {"key": "properties.upgradeSettings", "type": "AgentPoolUpgradeSettings"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "availability_zones": {"key": "properties.availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "properties.enableNodePublicIP", "type": "bool"}, + "scale_set_priority": {"key": "properties.scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "properties.scaleSetEvictionPolicy", "type": "str"}, + "spot_max_price": {"key": "properties.spotMaxPrice", "type": "float"}, + "tags": {"key": "properties.tags", "type": "{str}"}, + "node_labels": {"key": "properties.nodeLabels", "type": "{str}"}, + "node_taints": {"key": "properties.nodeTaints", "type": "[str]"}, + "proximity_placement_group_id": {"key": "properties.proximityPlacementGroupID", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, count: Optional[int] = None, @@ -220,7 +217,7 @@ def __init__( os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, @@ -230,9 +227,9 @@ def __init__( upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, - scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", - spot_max_price: Optional[float] = -1, + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", + spot_max_price: float = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, @@ -281,7 +278,7 @@ def __init__( "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :paramtype vm_size: str or ~azure.mgmt.containerservice.v2020_07_01.models.ContainerServiceVMSizeTypes :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every @@ -293,7 +290,7 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux" and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2020_07_01.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -302,10 +299,10 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword type_properties_type: AgentPoolType represents types of an agent pool. Known values - are: "VirtualMachineScaleSets", "AvailabilitySet". + are: "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type_properties_type: str or ~azure.mgmt.containerservice.v2020_07_01.models.AgentPoolType - :keyword mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", + :keyword mode: AgentPoolMode represents mode of an agent pool. Known values are: "System" and "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2020_07_01.models.AgentPoolMode :keyword orchestrator_version: Version of orchestrator specified when creating the managed @@ -320,20 +317,19 @@ def __init__( :keyword enable_node_public_ip: Enable public IP for nodes. :paramtype enable_node_public_ip: bool :keyword scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Known values are: "Spot", "Regular". Default value: "Regular". + priority. Default to regular. Known values are: "Spot" and "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_07_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction - policy for Spot virtual machine scale set. Default to Delete. Known values are: "Delete", - "Deallocate". Default value: "Delete". + policy for Spot virtual machine scale set. Default to Delete. Known values are: "Delete" and + "Deallocate". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_07_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: SpotMaxPrice to be used to specify the maximum price you are willing to pay in US Dollars. Possible values are any decimal value greater than zero or -1 which indicates default price to be up-to on-demand. :paramtype spot_max_price: float - :keyword tags: A set of tags. Agent pool tags to be persisted on the agent pool virtual machine - scale set. + :keyword tags: Agent pool tags to be persisted on the agent pool virtual machine scale set. :paramtype tags: dict[str, str] :keyword node_labels: Agent pool node labels to be persisted across all nodes in agent pool. :paramtype node_labels: dict[str, str] @@ -343,7 +339,7 @@ def __init__( :keyword proximity_placement_group_id: The ID for Proximity Placement Group. :paramtype proximity_placement_group_id: str """ - super(AgentPool, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.vm_size = vm_size self.os_disk_size_gb = os_disk_size_gb @@ -370,7 +366,7 @@ def __init__( self.proximity_placement_group_id = proximity_placement_group_id -class AgentPoolAvailableVersions(msrest.serialization.Model): +class AgentPoolAvailableVersions(_serialization.Model): """The list of available versions for an agent pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -387,16 +383,19 @@ class AgentPoolAvailableVersions(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'agent_pool_versions': {'key': 'properties.agentPoolVersions', 'type': '[AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "agent_pool_versions": { + "key": "properties.agentPoolVersions", + "type": "[AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem]", + }, } def __init__( @@ -410,14 +409,14 @@ def __init__( :paramtype agent_pool_versions: list[~azure.mgmt.containerservice.v2020_07_01.models.AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem] """ - super(AgentPoolAvailableVersions, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None self.agent_pool_versions = agent_pool_versions -class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(msrest.serialization.Model): +class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(_serialization.Model): """AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem. :ivar default: Whether this version is the default agent pool version. @@ -429,9 +428,9 @@ class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(msrest.serializa """ _attribute_map = { - 'default': {'key': 'default', 'type': 'bool'}, - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "default": {"key": "default", "type": "bool"}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } def __init__( @@ -450,13 +449,13 @@ def __init__( :keyword is_preview: Whether Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.default = default self.kubernetes_version = kubernetes_version self.is_preview = is_preview -class AgentPoolListResult(msrest.serialization.Model): +class AgentPoolListResult(_serialization.Model): """The response from the List Agent Pools operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -468,30 +467,25 @@ class AgentPoolListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[AgentPool]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[AgentPool]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.AgentPool"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.AgentPool"]] = None, **kwargs): """ :keyword value: The list of agent pools. :paramtype value: list[~azure.mgmt.containerservice.v2020_07_01.models.AgentPool] """ - super(AgentPoolListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class AgentPoolUpgradeProfile(msrest.serialization.Model): +class AgentPoolUpgradeProfile(_serialization.Model): """The list of available upgrades for an agent pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -504,10 +498,10 @@ class AgentPoolUpgradeProfile(msrest.serialization.Model): :vartype name: str :ivar type: Type of the agent pool upgrade profile. :vartype type: str - :ivar kubernetes_version: Required. Kubernetes version (major, minor, patch). + :ivar kubernetes_version: Kubernetes version (major, minor, patch). Required. :vartype kubernetes_version: str - :ivar os_type: Required. OsType to be used to specify os type. Choose from Linux and Windows. - Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to + Linux. Known values are: "Linux" and "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2020_07_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -518,21 +512,21 @@ class AgentPoolUpgradeProfile(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kubernetes_version': {'required': True}, - 'os_type': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "kubernetes_version": {"required": True}, + "os_type": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'kubernetes_version': {'key': 'properties.kubernetesVersion', 'type': 'str'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'upgrades': {'key': 'properties.upgrades', 'type': '[AgentPoolUpgradeProfilePropertiesUpgradesItem]'}, - 'latest_node_image_version': {'key': 'properties.latestNodeImageVersion', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "os_type": {"key": "properties.osType", "type": "str"}, + "upgrades": {"key": "properties.upgrades", "type": "[AgentPoolUpgradeProfilePropertiesUpgradesItem]"}, + "latest_node_image_version": {"key": "properties.latestNodeImageVersion", "type": "str"}, } def __init__( @@ -545,10 +539,10 @@ def __init__( **kwargs ): """ - :keyword kubernetes_version: Required. Kubernetes version (major, minor, patch). + :keyword kubernetes_version: Kubernetes version (major, minor, patch). Required. :paramtype kubernetes_version: str - :keyword os_type: Required. OsType to be used to specify os type. Choose from Linux and - Windows. Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default + to Linux. Known values are: "Linux" and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2020_07_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: @@ -557,7 +551,7 @@ def __init__( image version. :paramtype latest_node_image_version: str """ - super(AgentPoolUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -567,7 +561,7 @@ def __init__( self.latest_node_image_version = latest_node_image_version -class AgentPoolUpgradeProfilePropertiesUpgradesItem(msrest.serialization.Model): +class AgentPoolUpgradeProfilePropertiesUpgradesItem(_serialization.Model): """AgentPoolUpgradeProfilePropertiesUpgradesItem. :ivar kubernetes_version: Kubernetes version (major, minor, patch). @@ -577,29 +571,23 @@ class AgentPoolUpgradeProfilePropertiesUpgradesItem(msrest.serialization.Model): """ _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } - def __init__( - self, - *, - kubernetes_version: Optional[str] = None, - is_preview: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, kubernetes_version: Optional[str] = None, is_preview: Optional[bool] = None, **kwargs): """ :keyword kubernetes_version: Kubernetes version (major, minor, patch). :paramtype kubernetes_version: str :keyword is_preview: Whether Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(AgentPoolUpgradeProfilePropertiesUpgradesItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.is_preview = is_preview -class AgentPoolUpgradeSettings(msrest.serialization.Model): +class AgentPoolUpgradeSettings(_serialization.Model): """Settings for upgrading an agentpool. :ivar max_surge: Count or percentage of additional nodes to be added during upgrade. If empty @@ -608,25 +596,20 @@ class AgentPoolUpgradeSettings(msrest.serialization.Model): """ _attribute_map = { - 'max_surge': {'key': 'maxSurge', 'type': 'str'}, + "max_surge": {"key": "maxSurge", "type": "str"}, } - def __init__( - self, - *, - max_surge: Optional[str] = None, - **kwargs - ): + def __init__(self, *, max_surge: Optional[str] = None, **kwargs): """ :keyword max_surge: Count or percentage of additional nodes to be added during upgrade. If empty uses AKS default. :paramtype max_surge: str """ - super(AgentPoolUpgradeSettings, self).__init__(**kwargs) + super().__init__(**kwargs) self.max_surge = max_surge -class BaseManagedCluster(msrest.serialization.Model): +class BaseManagedCluster(_serialization.Model): # pylint: disable=too-many-instance-attributes """BaseManagedCluster. Variables are only populated by the server, and will be ignored when sending a request. @@ -690,34 +673,46 @@ class BaseManagedCluster(msrest.serialization.Model): """ _validation = { - 'provisioning_state': {'readonly': True}, - 'max_agent_pools': {'readonly': True}, - 'fqdn': {'readonly': True}, - 'private_fqdn': {'readonly': True}, + "provisioning_state": {"readonly": True}, + "max_agent_pools": {"readonly": True}, + "fqdn": {"readonly": True}, + "private_fqdn": {"readonly": True}, } _attribute_map = { - 'identity': {'key': 'identity', 'type': 'ManagedClusterIdentity'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'max_agent_pools': {'key': 'properties.maxAgentPools', 'type': 'int'}, - 'kubernetes_version': {'key': 'properties.kubernetesVersion', 'type': 'str'}, - 'dns_prefix': {'key': 'properties.dnsPrefix', 'type': 'str'}, - 'fqdn': {'key': 'properties.fqdn', 'type': 'str'}, - 'private_fqdn': {'key': 'properties.privateFQDN', 'type': 'str'}, - 'agent_pool_profiles': {'key': 'properties.agentPoolProfiles', 'type': '[ManagedClusterAgentPoolProfile]'}, - 'linux_profile': {'key': 'properties.linuxProfile', 'type': 'ContainerServiceLinuxProfile'}, - 'windows_profile': {'key': 'properties.windowsProfile', 'type': 'ManagedClusterWindowsProfile'}, - 'service_principal_profile': {'key': 'properties.servicePrincipalProfile', 'type': 'ManagedClusterServicePrincipalProfile'}, - 'addon_profiles': {'key': 'properties.addonProfiles', 'type': '{ManagedClusterAddonProfile}'}, - 'node_resource_group': {'key': 'properties.nodeResourceGroup', 'type': 'str'}, - 'enable_rbac': {'key': 'properties.enableRBAC', 'type': 'bool'}, - 'enable_pod_security_policy': {'key': 'properties.enablePodSecurityPolicy', 'type': 'bool'}, - 'network_profile': {'key': 'properties.networkProfile', 'type': 'ContainerServiceNetworkProfile'}, - 'aad_profile': {'key': 'properties.aadProfile', 'type': 'ManagedClusterAADProfile'}, - 'auto_scaler_profile': {'key': 'properties.autoScalerProfile', 'type': 'ManagedClusterPropertiesAutoScalerProfile'}, - 'api_server_access_profile': {'key': 'properties.apiServerAccessProfile', 'type': 'ManagedClusterAPIServerAccessProfile'}, - 'disk_encryption_set_id': {'key': 'properties.diskEncryptionSetID', 'type': 'str'}, - 'identity_profile': {'key': 'properties.identityProfile', 'type': '{ManagedClusterPropertiesIdentityProfileValue}'}, + "identity": {"key": "identity", "type": "ManagedClusterIdentity"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "max_agent_pools": {"key": "properties.maxAgentPools", "type": "int"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "dns_prefix": {"key": "properties.dnsPrefix", "type": "str"}, + "fqdn": {"key": "properties.fqdn", "type": "str"}, + "private_fqdn": {"key": "properties.privateFQDN", "type": "str"}, + "agent_pool_profiles": {"key": "properties.agentPoolProfiles", "type": "[ManagedClusterAgentPoolProfile]"}, + "linux_profile": {"key": "properties.linuxProfile", "type": "ContainerServiceLinuxProfile"}, + "windows_profile": {"key": "properties.windowsProfile", "type": "ManagedClusterWindowsProfile"}, + "service_principal_profile": { + "key": "properties.servicePrincipalProfile", + "type": "ManagedClusterServicePrincipalProfile", + }, + "addon_profiles": {"key": "properties.addonProfiles", "type": "{ManagedClusterAddonProfile}"}, + "node_resource_group": {"key": "properties.nodeResourceGroup", "type": "str"}, + "enable_rbac": {"key": "properties.enableRBAC", "type": "bool"}, + "enable_pod_security_policy": {"key": "properties.enablePodSecurityPolicy", "type": "bool"}, + "network_profile": {"key": "properties.networkProfile", "type": "ContainerServiceNetworkProfile"}, + "aad_profile": {"key": "properties.aadProfile", "type": "ManagedClusterAADProfile"}, + "auto_scaler_profile": { + "key": "properties.autoScalerProfile", + "type": "ManagedClusterPropertiesAutoScalerProfile", + }, + "api_server_access_profile": { + "key": "properties.apiServerAccessProfile", + "type": "ManagedClusterAPIServerAccessProfile", + }, + "disk_encryption_set_id": {"key": "properties.diskEncryptionSetID", "type": "str"}, + "identity_profile": { + "key": "properties.identityProfile", + "type": "{ManagedClusterPropertiesIdentityProfileValue}", + }, } def __init__( @@ -792,7 +787,7 @@ def __init__( :paramtype identity_profile: dict[str, ~azure.mgmt.containerservice.v2020_07_01.models.ManagedClusterPropertiesIdentityProfileValue] """ - super(BaseManagedCluster, self).__init__(**kwargs) + super().__init__(**kwargs) self.identity = identity self.provisioning_state = None self.max_agent_pools = None @@ -816,7 +811,7 @@ def __init__( self.identity_profile = identity_profile -class CloudErrorBody(msrest.serialization.Model): +class CloudErrorBody(_serialization.Model): """An error response from the Container service. :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed @@ -833,10 +828,10 @@ class CloudErrorBody(msrest.serialization.Model): """ _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[CloudErrorBody]"}, } def __init__( @@ -861,87 +856,76 @@ def __init__( :keyword details: A list of additional details about the error. :paramtype details: list[~azure.mgmt.containerservice.v2020_07_01.models.CloudErrorBody] """ - super(CloudErrorBody, self).__init__(**kwargs) + super().__init__(**kwargs) self.code = code self.message = message self.target = target self.details = details -class ContainerServiceDiagnosticsProfile(msrest.serialization.Model): +class ContainerServiceDiagnosticsProfile(_serialization.Model): """Profile for diagnostics on the container service cluster. All required parameters must be populated in order to send to Azure. - :ivar vm_diagnostics: Required. Profile for diagnostics on the container service VMs. + :ivar vm_diagnostics: Profile for diagnostics on the container service VMs. Required. :vartype vm_diagnostics: ~azure.mgmt.containerservice.v2020_07_01.models.ContainerServiceVMDiagnostics """ _validation = { - 'vm_diagnostics': {'required': True}, + "vm_diagnostics": {"required": True}, } _attribute_map = { - 'vm_diagnostics': {'key': 'vmDiagnostics', 'type': 'ContainerServiceVMDiagnostics'}, + "vm_diagnostics": {"key": "vmDiagnostics", "type": "ContainerServiceVMDiagnostics"}, } - def __init__( - self, - *, - vm_diagnostics: "_models.ContainerServiceVMDiagnostics", - **kwargs - ): + def __init__(self, *, vm_diagnostics: "_models.ContainerServiceVMDiagnostics", **kwargs): """ - :keyword vm_diagnostics: Required. Profile for diagnostics on the container service VMs. + :keyword vm_diagnostics: Profile for diagnostics on the container service VMs. Required. :paramtype vm_diagnostics: ~azure.mgmt.containerservice.v2020_07_01.models.ContainerServiceVMDiagnostics """ - super(ContainerServiceDiagnosticsProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.vm_diagnostics = vm_diagnostics -class ContainerServiceLinuxProfile(msrest.serialization.Model): +class ContainerServiceLinuxProfile(_serialization.Model): """Profile for Linux VMs in the container service cluster. All required parameters must be populated in order to send to Azure. - :ivar admin_username: Required. The administrator username to use for Linux VMs. + :ivar admin_username: The administrator username to use for Linux VMs. Required. :vartype admin_username: str - :ivar ssh: Required. SSH configuration for Linux-based VMs running on Azure. + :ivar ssh: SSH configuration for Linux-based VMs running on Azure. Required. :vartype ssh: ~azure.mgmt.containerservice.v2020_07_01.models.ContainerServiceSshConfiguration """ _validation = { - 'admin_username': {'required': True, 'pattern': r'^[A-Za-z][-A-Za-z0-9_]*$'}, - 'ssh': {'required': True}, + "admin_username": {"required": True, "pattern": r"^[A-Za-z][-A-Za-z0-9_]*$"}, + "ssh": {"required": True}, } _attribute_map = { - 'admin_username': {'key': 'adminUsername', 'type': 'str'}, - 'ssh': {'key': 'ssh', 'type': 'ContainerServiceSshConfiguration'}, + "admin_username": {"key": "adminUsername", "type": "str"}, + "ssh": {"key": "ssh", "type": "ContainerServiceSshConfiguration"}, } - def __init__( - self, - *, - admin_username: str, - ssh: "_models.ContainerServiceSshConfiguration", - **kwargs - ): + def __init__(self, *, admin_username: str, ssh: "_models.ContainerServiceSshConfiguration", **kwargs): """ - :keyword admin_username: Required. The administrator username to use for Linux VMs. + :keyword admin_username: The administrator username to use for Linux VMs. Required. :paramtype admin_username: str - :keyword ssh: Required. SSH configuration for Linux-based VMs running on Azure. + :keyword ssh: SSH configuration for Linux-based VMs running on Azure. Required. :paramtype ssh: ~azure.mgmt.containerservice.v2020_07_01.models.ContainerServiceSshConfiguration """ - super(ContainerServiceLinuxProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.admin_username = admin_username self.ssh = ssh -class ContainerServiceMasterProfile(msrest.serialization.Model): +class ContainerServiceMasterProfile(_serialization.Model): """Profile for the container service master. Variables are only populated by the server, and will be ignored when sending a request. @@ -949,11 +933,11 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar count: Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, - and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". + and 5. The default value is 1. Known values are: 1, 3, and 5. :vartype count: int or ~azure.mgmt.containerservice.v2020_07_01.models.Count - :ivar dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. + :ivar dns_prefix: DNS prefix to be used to create the FQDN for the master pool. Required. :vartype dns_prefix: str - :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + :ivar vm_size: Size of agent VMs. Required. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -990,7 +974,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :vartype vm_size: str or ~azure.mgmt.containerservice.v2020_07_01.models.ContainerServiceVMSizeTypes :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine @@ -1004,7 +988,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): :vartype first_consecutive_static_ip: str :ivar storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount" and "ManagedDisks". :vartype storage_profile: str or ~azure.mgmt.containerservice.v2020_07_01.models.ContainerServiceStorageProfileTypes :ivar fqdn: FQDN for the master pool. @@ -1012,21 +996,21 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): """ _validation = { - 'dns_prefix': {'required': True}, - 'vm_size': {'required': True}, - 'os_disk_size_gb': {'maximum': 1023, 'minimum': 0}, - 'fqdn': {'readonly': True}, + "dns_prefix": {"required": True}, + "vm_size": {"required": True}, + "os_disk_size_gb": {"maximum": 1023, "minimum": 0}, + "fqdn": {"readonly": True}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'dns_prefix': {'key': 'dnsPrefix', 'type': 'str'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'first_consecutive_static_ip': {'key': 'firstConsecutiveStaticIP', 'type': 'str'}, - 'storage_profile': {'key': 'storageProfile', 'type': 'str'}, - 'fqdn': {'key': 'fqdn', 'type': 'str'}, + "count": {"key": "count", "type": "int"}, + "dns_prefix": {"key": "dnsPrefix", "type": "str"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "first_consecutive_static_ip": {"key": "firstConsecutiveStaticIP", "type": "str"}, + "storage_profile": {"key": "storageProfile", "type": "str"}, + "fqdn": {"key": "fqdn", "type": "str"}, } def __init__( @@ -1034,20 +1018,20 @@ def __init__( *, dns_prefix: str, vm_size: Union[str, "_models.ContainerServiceVMSizeTypes"], - count: Optional[Union[int, "_models.Count"]] = 1, + count: Union[int, "_models.Count"] = 1, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, - first_consecutive_static_ip: Optional[str] = "10.240.255.5", + first_consecutive_static_ip: str = "10.240.255.5", storage_profile: Optional[Union[str, "_models.ContainerServiceStorageProfileTypes"]] = None, **kwargs ): """ :keyword count: Number of masters (VMs) in the container service cluster. Allowed values are 1, - 3, and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". + 3, and 5. The default value is 1. Known values are: 1, 3, and 5. :paramtype count: int or ~azure.mgmt.containerservice.v2020_07_01.models.Count - :keyword dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. + :keyword dns_prefix: DNS prefix to be used to create the FQDN for the master pool. Required. :paramtype dns_prefix: str - :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + :keyword vm_size: Size of agent VMs. Required. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -1084,7 +1068,7 @@ def __init__( "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :paramtype vm_size: str or ~azure.mgmt.containerservice.v2020_07_01.models.ContainerServiceVMSizeTypes :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every @@ -1098,11 +1082,11 @@ def __init__( :paramtype first_consecutive_static_ip: str :keyword storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount" and "ManagedDisks". :paramtype storage_profile: str or ~azure.mgmt.containerservice.v2020_07_01.models.ContainerServiceStorageProfileTypes """ - super(ContainerServiceMasterProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.dns_prefix = dns_prefix self.vm_size = vm_size @@ -1113,17 +1097,17 @@ def __init__( self.fqdn = None -class ContainerServiceNetworkProfile(msrest.serialization.Model): +class ContainerServiceNetworkProfile(_serialization.Model): """Profile of network configuration. :ivar network_plugin: Network plugin used for building Kubernetes network. Known values are: - "azure", "kubenet". Default value: "kubenet". + "azure" and "kubenet". :vartype network_plugin: str or ~azure.mgmt.containerservice.v2020_07_01.models.NetworkPlugin :ivar network_policy: Network policy used for building Kubernetes network. Known values are: - "calico", "azure". + "calico" and "azure". :vartype network_policy: str or ~azure.mgmt.containerservice.v2020_07_01.models.NetworkPolicy :ivar network_mode: Network mode used for building Kubernetes network. Known values are: - "transparent", "bridge". + "transparent" and "bridge". :vartype network_mode: str or ~azure.mgmt.containerservice.v2020_07_01.models.NetworkMode :ivar pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :vartype pod_cidr: str @@ -1136,11 +1120,11 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): :ivar docker_bridge_cidr: A CIDR notation IP range assigned to the Docker bridge network. It must not overlap with any Subnet IP ranges or the Kubernetes service address range. :vartype docker_bridge_cidr: str - :ivar outbound_type: The outbound (egress) routing method. Known values are: "loadBalancer", - "userDefinedRouting". Default value: "loadBalancer". + :ivar outbound_type: The outbound (egress) routing method. Known values are: "loadBalancer" and + "userDefinedRouting". :vartype outbound_type: str or ~azure.mgmt.containerservice.v2020_07_01.models.OutboundType :ivar load_balancer_sku: The load balancer sku for the managed cluster. Known values are: - "standard", "basic". + "standard" and "basic". :vartype load_balancer_sku: str or ~azure.mgmt.containerservice.v2020_07_01.models.LoadBalancerSku :ivar load_balancer_profile: Profile of the cluster load balancer. @@ -1149,49 +1133,51 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): """ _validation = { - 'pod_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, - 'service_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, - 'dns_service_ip': {'pattern': r'^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$'}, - 'docker_bridge_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, + "pod_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, + "service_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, + "dns_service_ip": { + "pattern": r"^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$" + }, + "docker_bridge_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, } _attribute_map = { - 'network_plugin': {'key': 'networkPlugin', 'type': 'str'}, - 'network_policy': {'key': 'networkPolicy', 'type': 'str'}, - 'network_mode': {'key': 'networkMode', 'type': 'str'}, - 'pod_cidr': {'key': 'podCidr', 'type': 'str'}, - 'service_cidr': {'key': 'serviceCidr', 'type': 'str'}, - 'dns_service_ip': {'key': 'dnsServiceIP', 'type': 'str'}, - 'docker_bridge_cidr': {'key': 'dockerBridgeCidr', 'type': 'str'}, - 'outbound_type': {'key': 'outboundType', 'type': 'str'}, - 'load_balancer_sku': {'key': 'loadBalancerSku', 'type': 'str'}, - 'load_balancer_profile': {'key': 'loadBalancerProfile', 'type': 'ManagedClusterLoadBalancerProfile'}, + "network_plugin": {"key": "networkPlugin", "type": "str"}, + "network_policy": {"key": "networkPolicy", "type": "str"}, + "network_mode": {"key": "networkMode", "type": "str"}, + "pod_cidr": {"key": "podCidr", "type": "str"}, + "service_cidr": {"key": "serviceCidr", "type": "str"}, + "dns_service_ip": {"key": "dnsServiceIP", "type": "str"}, + "docker_bridge_cidr": {"key": "dockerBridgeCidr", "type": "str"}, + "outbound_type": {"key": "outboundType", "type": "str"}, + "load_balancer_sku": {"key": "loadBalancerSku", "type": "str"}, + "load_balancer_profile": {"key": "loadBalancerProfile", "type": "ManagedClusterLoadBalancerProfile"}, } def __init__( self, *, - network_plugin: Optional[Union[str, "_models.NetworkPlugin"]] = "kubenet", + network_plugin: Union[str, "_models.NetworkPlugin"] = "kubenet", network_policy: Optional[Union[str, "_models.NetworkPolicy"]] = None, network_mode: Optional[Union[str, "_models.NetworkMode"]] = None, - pod_cidr: Optional[str] = "10.244.0.0/16", - service_cidr: Optional[str] = "10.0.0.0/16", - dns_service_ip: Optional[str] = "10.0.0.10", - docker_bridge_cidr: Optional[str] = "172.17.0.1/16", - outbound_type: Optional[Union[str, "_models.OutboundType"]] = "loadBalancer", + pod_cidr: str = "10.244.0.0/16", + service_cidr: str = "10.0.0.0/16", + dns_service_ip: str = "10.0.0.10", + docker_bridge_cidr: str = "172.17.0.1/16", + outbound_type: Union[str, "_models.OutboundType"] = "loadBalancer", load_balancer_sku: Optional[Union[str, "_models.LoadBalancerSku"]] = None, load_balancer_profile: Optional["_models.ManagedClusterLoadBalancerProfile"] = None, **kwargs ): """ :keyword network_plugin: Network plugin used for building Kubernetes network. Known values are: - "azure", "kubenet". Default value: "kubenet". + "azure" and "kubenet". :paramtype network_plugin: str or ~azure.mgmt.containerservice.v2020_07_01.models.NetworkPlugin :keyword network_policy: Network policy used for building Kubernetes network. Known values are: - "calico", "azure". + "calico" and "azure". :paramtype network_policy: str or ~azure.mgmt.containerservice.v2020_07_01.models.NetworkPolicy :keyword network_mode: Network mode used for building Kubernetes network. Known values are: - "transparent", "bridge". + "transparent" and "bridge". :paramtype network_mode: str or ~azure.mgmt.containerservice.v2020_07_01.models.NetworkMode :keyword pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :paramtype pod_cidr: str @@ -1204,18 +1190,18 @@ def __init__( :keyword docker_bridge_cidr: A CIDR notation IP range assigned to the Docker bridge network. It must not overlap with any Subnet IP ranges or the Kubernetes service address range. :paramtype docker_bridge_cidr: str - :keyword outbound_type: The outbound (egress) routing method. Known values are: "loadBalancer", - "userDefinedRouting". Default value: "loadBalancer". + :keyword outbound_type: The outbound (egress) routing method. Known values are: "loadBalancer" + and "userDefinedRouting". :paramtype outbound_type: str or ~azure.mgmt.containerservice.v2020_07_01.models.OutboundType :keyword load_balancer_sku: The load balancer sku for the managed cluster. Known values are: - "standard", "basic". + "standard" and "basic". :paramtype load_balancer_sku: str or ~azure.mgmt.containerservice.v2020_07_01.models.LoadBalancerSku :keyword load_balancer_profile: Profile of the cluster load balancer. :paramtype load_balancer_profile: ~azure.mgmt.containerservice.v2020_07_01.models.ManagedClusterLoadBalancerProfile """ - super(ContainerServiceNetworkProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.network_plugin = network_plugin self.network_policy = network_policy self.network_mode = network_mode @@ -1228,113 +1214,98 @@ def __init__( self.load_balancer_profile = load_balancer_profile -class ContainerServiceSshConfiguration(msrest.serialization.Model): +class ContainerServiceSshConfiguration(_serialization.Model): """SSH configuration for Linux-based VMs running on Azure. All required parameters must be populated in order to send to Azure. - :ivar public_keys: Required. The list of SSH public keys used to authenticate with Linux-based - VMs. Only expect one key specified. + :ivar public_keys: The list of SSH public keys used to authenticate with Linux-based VMs. Only + expect one key specified. Required. :vartype public_keys: list[~azure.mgmt.containerservice.v2020_07_01.models.ContainerServiceSshPublicKey] """ _validation = { - 'public_keys': {'required': True}, + "public_keys": {"required": True}, } _attribute_map = { - 'public_keys': {'key': 'publicKeys', 'type': '[ContainerServiceSshPublicKey]'}, + "public_keys": {"key": "publicKeys", "type": "[ContainerServiceSshPublicKey]"}, } - def __init__( - self, - *, - public_keys: List["_models.ContainerServiceSshPublicKey"], - **kwargs - ): + def __init__(self, *, public_keys: List["_models.ContainerServiceSshPublicKey"], **kwargs): """ - :keyword public_keys: Required. The list of SSH public keys used to authenticate with - Linux-based VMs. Only expect one key specified. + :keyword public_keys: The list of SSH public keys used to authenticate with Linux-based VMs. + Only expect one key specified. Required. :paramtype public_keys: list[~azure.mgmt.containerservice.v2020_07_01.models.ContainerServiceSshPublicKey] """ - super(ContainerServiceSshConfiguration, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_keys = public_keys -class ContainerServiceSshPublicKey(msrest.serialization.Model): +class ContainerServiceSshPublicKey(_serialization.Model): """Contains information about SSH certificate public key data. All required parameters must be populated in order to send to Azure. - :ivar key_data: Required. Certificate public key used to authenticate with VMs through SSH. The - certificate must be in PEM format with or without headers. + :ivar key_data: Certificate public key used to authenticate with VMs through SSH. The + certificate must be in PEM format with or without headers. Required. :vartype key_data: str """ _validation = { - 'key_data': {'required': True}, + "key_data": {"required": True}, } _attribute_map = { - 'key_data': {'key': 'keyData', 'type': 'str'}, + "key_data": {"key": "keyData", "type": "str"}, } - def __init__( - self, - *, - key_data: str, - **kwargs - ): + def __init__(self, *, key_data: str, **kwargs): """ - :keyword key_data: Required. Certificate public key used to authenticate with VMs through SSH. - The certificate must be in PEM format with or without headers. + :keyword key_data: Certificate public key used to authenticate with VMs through SSH. The + certificate must be in PEM format with or without headers. Required. :paramtype key_data: str """ - super(ContainerServiceSshPublicKey, self).__init__(**kwargs) + super().__init__(**kwargs) self.key_data = key_data -class ContainerServiceVMDiagnostics(msrest.serialization.Model): +class ContainerServiceVMDiagnostics(_serialization.Model): """Profile for diagnostics on the container service VMs. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar enabled: Required. Whether the VM diagnostic agent is provisioned on the VM. + :ivar enabled: Whether the VM diagnostic agent is provisioned on the VM. Required. :vartype enabled: bool :ivar storage_uri: The URI of the storage account where diagnostics are stored. :vartype storage_uri: str """ _validation = { - 'enabled': {'required': True}, - 'storage_uri': {'readonly': True}, + "enabled": {"required": True}, + "storage_uri": {"readonly": True}, } _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'storage_uri': {'key': 'storageUri', 'type': 'str'}, + "enabled": {"key": "enabled", "type": "bool"}, + "storage_uri": {"key": "storageUri", "type": "str"}, } - def __init__( - self, - *, - enabled: bool, - **kwargs - ): + def __init__(self, *, enabled: bool, **kwargs): """ - :keyword enabled: Required. Whether the VM diagnostic agent is provisioned on the VM. + :keyword enabled: Whether the VM diagnostic agent is provisioned on the VM. Required. :paramtype enabled: bool """ - super(ContainerServiceVMDiagnostics, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.storage_uri = None -class CredentialResult(msrest.serialization.Model): +class CredentialResult(_serialization.Model): """The credential result response. Variables are only populated by the server, and will be ignored when sending a request. @@ -1342,31 +1313,27 @@ class CredentialResult(msrest.serialization.Model): :ivar name: The name of the credential. :vartype name: str :ivar value: Base64-encoded Kubernetes configuration file. - :vartype value: bytearray + :vartype value: bytes """ _validation = { - 'name': {'readonly': True}, - 'value': {'readonly': True}, + "name": {"readonly": True}, + "value": {"readonly": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'bytearray'}, + "name": {"key": "name", "type": "str"}, + "value": {"key": "value", "type": "bytearray"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(CredentialResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.name = None self.value = None -class CredentialResults(msrest.serialization.Model): +class CredentialResults(_serialization.Model): """The list of credential result response. Variables are only populated by the server, and will be ignored when sending a request. @@ -1376,24 +1343,20 @@ class CredentialResults(msrest.serialization.Model): """ _validation = { - 'kubeconfigs': {'readonly': True}, + "kubeconfigs": {"readonly": True}, } _attribute_map = { - 'kubeconfigs': {'key': 'kubeconfigs', 'type': '[CredentialResult]'}, + "kubeconfigs": {"key": "kubeconfigs", "type": "[CredentialResult]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(CredentialResults, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.kubeconfigs = None -class Resource(msrest.serialization.Model): +class Resource(_serialization.Model): """The Resource model definition. Variables are only populated by the server, and will be ignored when sending a request. @@ -1406,41 +1369,35 @@ class Resource(msrest.serialization.Model): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] """ - super(Resource, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -1448,7 +1405,7 @@ def __init__( self.tags = tags -class ManagedCluster(Resource, BaseManagedCluster): +class ManagedCluster(Resource, BaseManagedCluster): # pylint: disable=too-many-instance-attributes """Managed cluster. Variables are only populated by the server, and will be ignored when sending a request. @@ -1517,56 +1474,68 @@ class ManagedCluster(Resource, BaseManagedCluster): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar sku: The managed cluster SKU. :vartype sku: ~azure.mgmt.containerservice.v2020_07_01.models.ManagedClusterSKU """ _validation = { - 'provisioning_state': {'readonly': True}, - 'max_agent_pools': {'readonly': True}, - 'fqdn': {'readonly': True}, - 'private_fqdn': {'readonly': True}, - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, + "provisioning_state": {"readonly": True}, + "max_agent_pools": {"readonly": True}, + "fqdn": {"readonly": True}, + "private_fqdn": {"readonly": True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { - 'identity': {'key': 'identity', 'type': 'ManagedClusterIdentity'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'max_agent_pools': {'key': 'properties.maxAgentPools', 'type': 'int'}, - 'kubernetes_version': {'key': 'properties.kubernetesVersion', 'type': 'str'}, - 'dns_prefix': {'key': 'properties.dnsPrefix', 'type': 'str'}, - 'fqdn': {'key': 'properties.fqdn', 'type': 'str'}, - 'private_fqdn': {'key': 'properties.privateFQDN', 'type': 'str'}, - 'agent_pool_profiles': {'key': 'properties.agentPoolProfiles', 'type': '[ManagedClusterAgentPoolProfile]'}, - 'linux_profile': {'key': 'properties.linuxProfile', 'type': 'ContainerServiceLinuxProfile'}, - 'windows_profile': {'key': 'properties.windowsProfile', 'type': 'ManagedClusterWindowsProfile'}, - 'service_principal_profile': {'key': 'properties.servicePrincipalProfile', 'type': 'ManagedClusterServicePrincipalProfile'}, - 'addon_profiles': {'key': 'properties.addonProfiles', 'type': '{ManagedClusterAddonProfile}'}, - 'node_resource_group': {'key': 'properties.nodeResourceGroup', 'type': 'str'}, - 'enable_rbac': {'key': 'properties.enableRBAC', 'type': 'bool'}, - 'enable_pod_security_policy': {'key': 'properties.enablePodSecurityPolicy', 'type': 'bool'}, - 'network_profile': {'key': 'properties.networkProfile', 'type': 'ContainerServiceNetworkProfile'}, - 'aad_profile': {'key': 'properties.aadProfile', 'type': 'ManagedClusterAADProfile'}, - 'auto_scaler_profile': {'key': 'properties.autoScalerProfile', 'type': 'ManagedClusterPropertiesAutoScalerProfile'}, - 'api_server_access_profile': {'key': 'properties.apiServerAccessProfile', 'type': 'ManagedClusterAPIServerAccessProfile'}, - 'disk_encryption_set_id': {'key': 'properties.diskEncryptionSetID', 'type': 'str'}, - 'identity_profile': {'key': 'properties.identityProfile', 'type': '{ManagedClusterPropertiesIdentityProfileValue}'}, - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'ManagedClusterSKU'}, - } - - def __init__( + "identity": {"key": "identity", "type": "ManagedClusterIdentity"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "max_agent_pools": {"key": "properties.maxAgentPools", "type": "int"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "dns_prefix": {"key": "properties.dnsPrefix", "type": "str"}, + "fqdn": {"key": "properties.fqdn", "type": "str"}, + "private_fqdn": {"key": "properties.privateFQDN", "type": "str"}, + "agent_pool_profiles": {"key": "properties.agentPoolProfiles", "type": "[ManagedClusterAgentPoolProfile]"}, + "linux_profile": {"key": "properties.linuxProfile", "type": "ContainerServiceLinuxProfile"}, + "windows_profile": {"key": "properties.windowsProfile", "type": "ManagedClusterWindowsProfile"}, + "service_principal_profile": { + "key": "properties.servicePrincipalProfile", + "type": "ManagedClusterServicePrincipalProfile", + }, + "addon_profiles": {"key": "properties.addonProfiles", "type": "{ManagedClusterAddonProfile}"}, + "node_resource_group": {"key": "properties.nodeResourceGroup", "type": "str"}, + "enable_rbac": {"key": "properties.enableRBAC", "type": "bool"}, + "enable_pod_security_policy": {"key": "properties.enablePodSecurityPolicy", "type": "bool"}, + "network_profile": {"key": "properties.networkProfile", "type": "ContainerServiceNetworkProfile"}, + "aad_profile": {"key": "properties.aadProfile", "type": "ManagedClusterAADProfile"}, + "auto_scaler_profile": { + "key": "properties.autoScalerProfile", + "type": "ManagedClusterPropertiesAutoScalerProfile", + }, + "api_server_access_profile": { + "key": "properties.apiServerAccessProfile", + "type": "ManagedClusterAPIServerAccessProfile", + }, + "disk_encryption_set_id": {"key": "properties.diskEncryptionSetID", "type": "str"}, + "identity_profile": { + "key": "properties.identityProfile", + "type": "{ManagedClusterPropertiesIdentityProfileValue}", + }, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "sku": {"key": "sku", "type": "ManagedClusterSKU"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, location: str, @@ -1640,14 +1609,35 @@ def __init__( :keyword identity_profile: Identities associated with the cluster. :paramtype identity_profile: dict[str, ~azure.mgmt.containerservice.v2020_07_01.models.ManagedClusterPropertiesIdentityProfileValue] - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword sku: The managed cluster SKU. :paramtype sku: ~azure.mgmt.containerservice.v2020_07_01.models.ManagedClusterSKU """ - super(ManagedCluster, self).__init__(location=location, tags=tags, identity=identity, kubernetes_version=kubernetes_version, dns_prefix=dns_prefix, agent_pool_profiles=agent_pool_profiles, linux_profile=linux_profile, windows_profile=windows_profile, service_principal_profile=service_principal_profile, addon_profiles=addon_profiles, node_resource_group=node_resource_group, enable_rbac=enable_rbac, enable_pod_security_policy=enable_pod_security_policy, network_profile=network_profile, aad_profile=aad_profile, auto_scaler_profile=auto_scaler_profile, api_server_access_profile=api_server_access_profile, disk_encryption_set_id=disk_encryption_set_id, identity_profile=identity_profile, **kwargs) + super().__init__( + location=location, + tags=tags, + identity=identity, + kubernetes_version=kubernetes_version, + dns_prefix=dns_prefix, + agent_pool_profiles=agent_pool_profiles, + linux_profile=linux_profile, + windows_profile=windows_profile, + service_principal_profile=service_principal_profile, + addon_profiles=addon_profiles, + node_resource_group=node_resource_group, + enable_rbac=enable_rbac, + enable_pod_security_policy=enable_pod_security_policy, + network_profile=network_profile, + aad_profile=aad_profile, + auto_scaler_profile=auto_scaler_profile, + api_server_access_profile=api_server_access_profile, + disk_encryption_set_id=disk_encryption_set_id, + identity_profile=identity_profile, + **kwargs + ) self.identity = identity self.provisioning_state = None self.max_agent_pools = None @@ -1677,7 +1667,7 @@ def __init__( self.tags = tags -class ManagedClusterAADProfile(msrest.serialization.Model): +class ManagedClusterAADProfile(_serialization.Model): """AADProfile specifies attributes for Azure Active Directory integration. :ivar managed: Whether to enable managed AAD. @@ -1698,13 +1688,13 @@ class ManagedClusterAADProfile(msrest.serialization.Model): """ _attribute_map = { - 'managed': {'key': 'managed', 'type': 'bool'}, - 'enable_azure_rbac': {'key': 'enableAzureRBAC', 'type': 'bool'}, - 'admin_group_object_i_ds': {'key': 'adminGroupObjectIDs', 'type': '[str]'}, - 'client_app_id': {'key': 'clientAppID', 'type': 'str'}, - 'server_app_id': {'key': 'serverAppID', 'type': 'str'}, - 'server_app_secret': {'key': 'serverAppSecret', 'type': 'str'}, - 'tenant_id': {'key': 'tenantID', 'type': 'str'}, + "managed": {"key": "managed", "type": "bool"}, + "enable_azure_rbac": {"key": "enableAzureRBAC", "type": "bool"}, + "admin_group_object_i_ds": {"key": "adminGroupObjectIDs", "type": "[str]"}, + "client_app_id": {"key": "clientAppID", "type": "str"}, + "server_app_id": {"key": "serverAppID", "type": "str"}, + "server_app_secret": {"key": "serverAppSecret", "type": "str"}, + "tenant_id": {"key": "tenantID", "type": "str"}, } def __init__( @@ -1737,7 +1727,7 @@ def __init__( tenant of the deployment subscription. :paramtype tenant_id: str """ - super(ManagedClusterAADProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.managed = managed self.enable_azure_rbac = enable_azure_rbac self.admin_group_object_i_ds = admin_group_object_i_ds @@ -1760,58 +1750,53 @@ class ManagedClusterAccessProfile(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar kube_config: Base64-encoded Kubernetes configuration file. - :vartype kube_config: bytearray + :vartype kube_config: bytes """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'kube_config': {'key': 'properties.kubeConfig', 'type': 'bytearray'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "kube_config": {"key": "properties.kubeConfig", "type": "bytearray"}, } def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - kube_config: Optional[bytearray] = None, - **kwargs + self, *, location: str, tags: Optional[Dict[str, str]] = None, kube_config: Optional[bytes] = None, **kwargs ): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword kube_config: Base64-encoded Kubernetes configuration file. - :paramtype kube_config: bytearray + :paramtype kube_config: bytes """ - super(ManagedClusterAccessProfile, self).__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.kube_config = kube_config -class ManagedClusterAddonProfile(msrest.serialization.Model): +class ManagedClusterAddonProfile(_serialization.Model): """A Kubernetes add-on profile for a managed cluster. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar enabled: Required. Whether the add-on is enabled or not. + :ivar enabled: Whether the add-on is enabled or not. Required. :vartype enabled: bool :ivar config: Key-value pairs for configuring an add-on. :vartype config: dict[str, str] @@ -1821,36 +1806,30 @@ class ManagedClusterAddonProfile(msrest.serialization.Model): """ _validation = { - 'enabled': {'required': True}, - 'identity': {'readonly': True}, + "enabled": {"required": True}, + "identity": {"readonly": True}, } _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'config': {'key': 'config', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'ManagedClusterAddonProfileIdentity'}, + "enabled": {"key": "enabled", "type": "bool"}, + "config": {"key": "config", "type": "{str}"}, + "identity": {"key": "identity", "type": "ManagedClusterAddonProfileIdentity"}, } - def __init__( - self, - *, - enabled: bool, - config: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, enabled: bool, config: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword enabled: Required. Whether the add-on is enabled or not. + :keyword enabled: Whether the add-on is enabled or not. Required. :paramtype enabled: bool :keyword config: Key-value pairs for configuring an add-on. :paramtype config: dict[str, str] """ - super(ManagedClusterAddonProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.config = config self.identity = None -class UserAssignedIdentity(msrest.serialization.Model): +class UserAssignedIdentity(_serialization.Model): """UserAssignedIdentity. :ivar resource_id: The resource id of the user assigned identity. @@ -1862,9 +1841,9 @@ class UserAssignedIdentity(msrest.serialization.Model): """ _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'object_id': {'key': 'objectId', 'type': 'str'}, + "resource_id": {"key": "resourceId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + "object_id": {"key": "objectId", "type": "str"}, } def __init__( @@ -1883,7 +1862,7 @@ def __init__( :keyword object_id: The object id of the user assigned identity. :paramtype object_id: str """ - super(UserAssignedIdentity, self).__init__(**kwargs) + super().__init__(**kwargs) self.resource_id = resource_id self.client_id = client_id self.object_id = object_id @@ -1901,9 +1880,9 @@ class ManagedClusterAddonProfileIdentity(UserAssignedIdentity): """ _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'object_id': {'key': 'objectId', 'type': 'str'}, + "resource_id": {"key": "resourceId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + "object_id": {"key": "objectId", "type": "str"}, } def __init__( @@ -1922,10 +1901,10 @@ def __init__( :keyword object_id: The object id of the user assigned identity. :paramtype object_id: str """ - super(ManagedClusterAddonProfileIdentity, self).__init__(resource_id=resource_id, client_id=client_id, object_id=object_id, **kwargs) + super().__init__(resource_id=resource_id, client_id=client_id, object_id=object_id, **kwargs) -class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): +class ManagedClusterAgentPoolProfileProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes """Properties for the container service agent pool profile. Variables are only populated by the server, and will be ignored when sending a request. @@ -1971,7 +1950,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :vartype vm_size: str or ~azure.mgmt.containerservice.v2020_07_01.models.ContainerServiceVMSizeTypes :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine @@ -1983,7 +1962,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Known values are: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux" and "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2020_07_01.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -1992,9 +1971,10 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar type: AgentPoolType represents types of an agent pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2020_07_01.models.AgentPoolType - :ivar mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", "User". + :ivar mode: AgentPoolMode represents mode of an agent pool. Known values are: "System" and + "User". :vartype mode: str or ~azure.mgmt.containerservice.v2020_07_01.models.AgentPoolMode :ivar orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -2013,20 +1993,19 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar enable_node_public_ip: Enable public IP for nodes. :vartype enable_node_public_ip: bool :ivar scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Known values are: "Spot", "Regular". Default value: "Regular". + priority. Default to regular. Known values are: "Spot" and "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_07_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy - for Spot virtual machine scale set. Default to Delete. Known values are: "Delete", - "Deallocate". Default value: "Delete". + for Spot virtual machine scale set. Default to Delete. Known values are: "Delete" and + "Deallocate". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_07_01.models.ScaleSetEvictionPolicy :ivar spot_max_price: SpotMaxPrice to be used to specify the maximum price you are willing to pay in US Dollars. Possible values are any decimal value greater than zero or -1 which indicates default price to be up-to on-demand. :vartype spot_max_price: float - :ivar tags: A set of tags. Agent pool tags to be persisted on the agent pool virtual machine - scale set. + :ivar tags: Agent pool tags to be persisted on the agent pool virtual machine scale set. :vartype tags: dict[str, str] :ivar node_labels: Agent pool node labels to be persisted across all nodes in agent pool. :vartype node_labels: dict[str, str] @@ -2038,39 +2017,39 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): """ _validation = { - 'os_disk_size_gb': {'maximum': 1023, 'minimum': 0}, - 'node_image_version': {'readonly': True}, - 'provisioning_state': {'readonly': True}, + "os_disk_size_gb": {"maximum": 1023, "minimum": 0}, + "node_image_version": {"readonly": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'maxPods', 'type': 'int'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'max_count': {'key': 'maxCount', 'type': 'int'}, - 'min_count': {'key': 'minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'enableAutoScaling', 'type': 'bool'}, - 'type': {'key': 'type', 'type': 'str'}, - 'mode': {'key': 'mode', 'type': 'str'}, - 'orchestrator_version': {'key': 'orchestratorVersion', 'type': 'str'}, - 'node_image_version': {'key': 'nodeImageVersion', 'type': 'str'}, - 'upgrade_settings': {'key': 'upgradeSettings', 'type': 'AgentPoolUpgradeSettings'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'availability_zones': {'key': 'availabilityZones', 'type': '[str]'}, - 'enable_node_public_ip': {'key': 'enableNodePublicIP', 'type': 'bool'}, - 'scale_set_priority': {'key': 'scaleSetPriority', 'type': 'str'}, - 'scale_set_eviction_policy': {'key': 'scaleSetEvictionPolicy', 'type': 'str'}, - 'spot_max_price': {'key': 'spotMaxPrice', 'type': 'float'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'node_labels': {'key': 'nodeLabels', 'type': '{str}'}, - 'node_taints': {'key': 'nodeTaints', 'type': '[str]'}, - 'proximity_placement_group_id': {'key': 'proximityPlacementGroupID', 'type': 'str'}, - } - - def __init__( + "count": {"key": "count", "type": "int"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "max_pods": {"key": "maxPods", "type": "int"}, + "os_type": {"key": "osType", "type": "str"}, + "max_count": {"key": "maxCount", "type": "int"}, + "min_count": {"key": "minCount", "type": "int"}, + "enable_auto_scaling": {"key": "enableAutoScaling", "type": "bool"}, + "type": {"key": "type", "type": "str"}, + "mode": {"key": "mode", "type": "str"}, + "orchestrator_version": {"key": "orchestratorVersion", "type": "str"}, + "node_image_version": {"key": "nodeImageVersion", "type": "str"}, + "upgrade_settings": {"key": "upgradeSettings", "type": "AgentPoolUpgradeSettings"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "availability_zones": {"key": "availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "enableNodePublicIP", "type": "bool"}, + "scale_set_priority": {"key": "scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "scaleSetEvictionPolicy", "type": "str"}, + "spot_max_price": {"key": "spotMaxPrice", "type": "float"}, + "tags": {"key": "tags", "type": "{str}"}, + "node_labels": {"key": "nodeLabels", "type": "{str}"}, + "node_taints": {"key": "nodeTaints", "type": "[str]"}, + "proximity_placement_group_id": {"key": "proximityPlacementGroupID", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, count: Optional[int] = None, @@ -2078,7 +2057,7 @@ def __init__( os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, @@ -2088,9 +2067,9 @@ def __init__( upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, - scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", - spot_max_price: Optional[float] = -1, + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", + spot_max_price: float = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, @@ -2139,7 +2118,7 @@ def __init__( "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :paramtype vm_size: str or ~azure.mgmt.containerservice.v2020_07_01.models.ContainerServiceVMSizeTypes :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every @@ -2151,7 +2130,7 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux" and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2020_07_01.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -2160,9 +2139,9 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword type: AgentPoolType represents types of an agent pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2020_07_01.models.AgentPoolType - :keyword mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", + :keyword mode: AgentPoolMode represents mode of an agent pool. Known values are: "System" and "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2020_07_01.models.AgentPoolMode :keyword orchestrator_version: Version of orchestrator specified when creating the managed @@ -2177,20 +2156,19 @@ def __init__( :keyword enable_node_public_ip: Enable public IP for nodes. :paramtype enable_node_public_ip: bool :keyword scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Known values are: "Spot", "Regular". Default value: "Regular". + priority. Default to regular. Known values are: "Spot" and "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_07_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction - policy for Spot virtual machine scale set. Default to Delete. Known values are: "Delete", - "Deallocate". Default value: "Delete". + policy for Spot virtual machine scale set. Default to Delete. Known values are: "Delete" and + "Deallocate". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_07_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: SpotMaxPrice to be used to specify the maximum price you are willing to pay in US Dollars. Possible values are any decimal value greater than zero or -1 which indicates default price to be up-to on-demand. :paramtype spot_max_price: float - :keyword tags: A set of tags. Agent pool tags to be persisted on the agent pool virtual machine - scale set. + :keyword tags: Agent pool tags to be persisted on the agent pool virtual machine scale set. :paramtype tags: dict[str, str] :keyword node_labels: Agent pool node labels to be persisted across all nodes in agent pool. :paramtype node_labels: dict[str, str] @@ -2200,7 +2178,7 @@ def __init__( :keyword proximity_placement_group_id: The ID for Proximity Placement Group. :paramtype proximity_placement_group_id: str """ - super(ManagedClusterAgentPoolProfileProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.vm_size = vm_size self.os_disk_size_gb = os_disk_size_gb @@ -2227,7 +2205,9 @@ def __init__( self.proximity_placement_group_id = proximity_placement_group_id -class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): +class ManagedClusterAgentPoolProfile( + ManagedClusterAgentPoolProfileProperties +): # pylint: disable=too-many-instance-attributes """Profile for the container service agent pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -2275,7 +2255,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :vartype vm_size: str or ~azure.mgmt.containerservice.v2020_07_01.models.ContainerServiceVMSizeTypes :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine @@ -2287,7 +2267,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Known values are: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux" and "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2020_07_01.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -2296,9 +2276,10 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar type: AgentPoolType represents types of an agent pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2020_07_01.models.AgentPoolType - :ivar mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", "User". + :ivar mode: AgentPoolMode represents mode of an agent pool. Known values are: "System" and + "User". :vartype mode: str or ~azure.mgmt.containerservice.v2020_07_01.models.AgentPoolMode :ivar orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -2317,20 +2298,19 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar enable_node_public_ip: Enable public IP for nodes. :vartype enable_node_public_ip: bool :ivar scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Known values are: "Spot", "Regular". Default value: "Regular". + priority. Default to regular. Known values are: "Spot" and "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_07_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy - for Spot virtual machine scale set. Default to Delete. Known values are: "Delete", - "Deallocate". Default value: "Delete". + for Spot virtual machine scale set. Default to Delete. Known values are: "Delete" and + "Deallocate". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_07_01.models.ScaleSetEvictionPolicy :ivar spot_max_price: SpotMaxPrice to be used to specify the maximum price you are willing to pay in US Dollars. Possible values are any decimal value greater than zero or -1 which indicates default price to be up-to on-demand. :vartype spot_max_price: float - :ivar tags: A set of tags. Agent pool tags to be persisted on the agent pool virtual machine - scale set. + :ivar tags: Agent pool tags to be persisted on the agent pool virtual machine scale set. :vartype tags: dict[str, str] :ivar node_labels: Agent pool node labels to be persisted across all nodes in agent pool. :vartype node_labels: dict[str, str] @@ -2339,47 +2319,47 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :vartype node_taints: list[str] :ivar proximity_placement_group_id: The ID for Proximity Placement Group. :vartype proximity_placement_group_id: str - :ivar name: Required. Unique name of the agent pool profile in the context of the subscription - and resource group. + :ivar name: Unique name of the agent pool profile in the context of the subscription and + resource group. Required. :vartype name: str """ _validation = { - 'os_disk_size_gb': {'maximum': 1023, 'minimum': 0}, - 'node_image_version': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'name': {'required': True, 'pattern': r'^[a-z][a-z0-9]{0,11}$'}, + "os_disk_size_gb": {"maximum": 1023, "minimum": 0}, + "node_image_version": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "name": {"required": True, "pattern": r"^[a-z][a-z0-9]{0,11}$"}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'maxPods', 'type': 'int'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'max_count': {'key': 'maxCount', 'type': 'int'}, - 'min_count': {'key': 'minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'enableAutoScaling', 'type': 'bool'}, - 'type': {'key': 'type', 'type': 'str'}, - 'mode': {'key': 'mode', 'type': 'str'}, - 'orchestrator_version': {'key': 'orchestratorVersion', 'type': 'str'}, - 'node_image_version': {'key': 'nodeImageVersion', 'type': 'str'}, - 'upgrade_settings': {'key': 'upgradeSettings', 'type': 'AgentPoolUpgradeSettings'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'availability_zones': {'key': 'availabilityZones', 'type': '[str]'}, - 'enable_node_public_ip': {'key': 'enableNodePublicIP', 'type': 'bool'}, - 'scale_set_priority': {'key': 'scaleSetPriority', 'type': 'str'}, - 'scale_set_eviction_policy': {'key': 'scaleSetEvictionPolicy', 'type': 'str'}, - 'spot_max_price': {'key': 'spotMaxPrice', 'type': 'float'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'node_labels': {'key': 'nodeLabels', 'type': '{str}'}, - 'node_taints': {'key': 'nodeTaints', 'type': '[str]'}, - 'proximity_placement_group_id': {'key': 'proximityPlacementGroupID', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( + "count": {"key": "count", "type": "int"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "max_pods": {"key": "maxPods", "type": "int"}, + "os_type": {"key": "osType", "type": "str"}, + "max_count": {"key": "maxCount", "type": "int"}, + "min_count": {"key": "minCount", "type": "int"}, + "enable_auto_scaling": {"key": "enableAutoScaling", "type": "bool"}, + "type": {"key": "type", "type": "str"}, + "mode": {"key": "mode", "type": "str"}, + "orchestrator_version": {"key": "orchestratorVersion", "type": "str"}, + "node_image_version": {"key": "nodeImageVersion", "type": "str"}, + "upgrade_settings": {"key": "upgradeSettings", "type": "AgentPoolUpgradeSettings"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "availability_zones": {"key": "availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "enableNodePublicIP", "type": "bool"}, + "scale_set_priority": {"key": "scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "scaleSetEvictionPolicy", "type": "str"}, + "spot_max_price": {"key": "spotMaxPrice", "type": "float"}, + "tags": {"key": "tags", "type": "{str}"}, + "node_labels": {"key": "nodeLabels", "type": "{str}"}, + "node_taints": {"key": "nodeTaints", "type": "[str]"}, + "proximity_placement_group_id": {"key": "proximityPlacementGroupID", "type": "str"}, + "name": {"key": "name", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, name: str, @@ -2388,7 +2368,7 @@ def __init__( os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, @@ -2398,9 +2378,9 @@ def __init__( upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, - scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", - spot_max_price: Optional[float] = -1, + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", + spot_max_price: float = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, @@ -2449,7 +2429,7 @@ def __init__( "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :paramtype vm_size: str or ~azure.mgmt.containerservice.v2020_07_01.models.ContainerServiceVMSizeTypes :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every @@ -2461,7 +2441,7 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux" and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2020_07_01.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -2470,9 +2450,9 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword type: AgentPoolType represents types of an agent pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2020_07_01.models.AgentPoolType - :keyword mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", + :keyword mode: AgentPoolMode represents mode of an agent pool. Known values are: "System" and "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2020_07_01.models.AgentPoolMode :keyword orchestrator_version: Version of orchestrator specified when creating the managed @@ -2487,20 +2467,19 @@ def __init__( :keyword enable_node_public_ip: Enable public IP for nodes. :paramtype enable_node_public_ip: bool :keyword scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Known values are: "Spot", "Regular". Default value: "Regular". + priority. Default to regular. Known values are: "Spot" and "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_07_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction - policy for Spot virtual machine scale set. Default to Delete. Known values are: "Delete", - "Deallocate". Default value: "Delete". + policy for Spot virtual machine scale set. Default to Delete. Known values are: "Delete" and + "Deallocate". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_07_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: SpotMaxPrice to be used to specify the maximum price you are willing to pay in US Dollars. Possible values are any decimal value greater than zero or -1 which indicates default price to be up-to on-demand. :paramtype spot_max_price: float - :keyword tags: A set of tags. Agent pool tags to be persisted on the agent pool virtual machine - scale set. + :keyword tags: Agent pool tags to be persisted on the agent pool virtual machine scale set. :paramtype tags: dict[str, str] :keyword node_labels: Agent pool node labels to be persisted across all nodes in agent pool. :paramtype node_labels: dict[str, str] @@ -2509,15 +2488,39 @@ def __init__( :paramtype node_taints: list[str] :keyword proximity_placement_group_id: The ID for Proximity Placement Group. :paramtype proximity_placement_group_id: str - :keyword name: Required. Unique name of the agent pool profile in the context of the - subscription and resource group. + :keyword name: Unique name of the agent pool profile in the context of the subscription and + resource group. Required. :paramtype name: str """ - super(ManagedClusterAgentPoolProfile, self).__init__(count=count, vm_size=vm_size, os_disk_size_gb=os_disk_size_gb, vnet_subnet_id=vnet_subnet_id, max_pods=max_pods, os_type=os_type, max_count=max_count, min_count=min_count, enable_auto_scaling=enable_auto_scaling, type=type, mode=mode, orchestrator_version=orchestrator_version, upgrade_settings=upgrade_settings, availability_zones=availability_zones, enable_node_public_ip=enable_node_public_ip, scale_set_priority=scale_set_priority, scale_set_eviction_policy=scale_set_eviction_policy, spot_max_price=spot_max_price, tags=tags, node_labels=node_labels, node_taints=node_taints, proximity_placement_group_id=proximity_placement_group_id, **kwargs) + super().__init__( + count=count, + vm_size=vm_size, + os_disk_size_gb=os_disk_size_gb, + vnet_subnet_id=vnet_subnet_id, + max_pods=max_pods, + os_type=os_type, + max_count=max_count, + min_count=min_count, + enable_auto_scaling=enable_auto_scaling, + type=type, + mode=mode, + orchestrator_version=orchestrator_version, + upgrade_settings=upgrade_settings, + availability_zones=availability_zones, + enable_node_public_ip=enable_node_public_ip, + scale_set_priority=scale_set_priority, + scale_set_eviction_policy=scale_set_eviction_policy, + spot_max_price=spot_max_price, + tags=tags, + node_labels=node_labels, + node_taints=node_taints, + proximity_placement_group_id=proximity_placement_group_id, + **kwargs + ) self.name = name -class ManagedClusterAPIServerAccessProfile(msrest.serialization.Model): +class ManagedClusterAPIServerAccessProfile(_serialization.Model): """Access profile for managed cluster API server. :ivar authorized_ip_ranges: Authorized IP Ranges to kubernetes API server. @@ -2527,8 +2530,8 @@ class ManagedClusterAPIServerAccessProfile(msrest.serialization.Model): """ _attribute_map = { - 'authorized_ip_ranges': {'key': 'authorizedIPRanges', 'type': '[str]'}, - 'enable_private_cluster': {'key': 'enablePrivateCluster', 'type': 'bool'}, + "authorized_ip_ranges": {"key": "authorizedIPRanges", "type": "[str]"}, + "enable_private_cluster": {"key": "enablePrivateCluster", "type": "bool"}, } def __init__( @@ -2544,12 +2547,12 @@ def __init__( :keyword enable_private_cluster: Whether to create the cluster as a private cluster or not. :paramtype enable_private_cluster: bool """ - super(ManagedClusterAPIServerAccessProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.authorized_ip_ranges = authorized_ip_ranges self.enable_private_cluster = enable_private_cluster -class ManagedClusterIdentity(msrest.serialization.Model): +class ManagedClusterIdentity(_serialization.Model): """Identity for the managed cluster. Variables are only populated by the server, and will be ignored when sending a request. @@ -2563,7 +2566,7 @@ class ManagedClusterIdentity(msrest.serialization.Model): :ivar type: The type of identity used for the managed cluster. Type 'SystemAssigned' will use an implicitly created identity in master components and an auto-created user assigned identity in MC_ resource group in agent nodes. Type 'None' will not use MSI for the managed cluster, - service principal will be used instead. Known values are: "SystemAssigned", "UserAssigned", + service principal will be used instead. Known values are: "SystemAssigned", "UserAssigned", and "None". :vartype type: str or ~azure.mgmt.containerservice.v2020_07_01.models.ResourceIdentityType :ivar user_assigned_identities: The user identity associated with the managed cluster. This @@ -2575,22 +2578,27 @@ class ManagedClusterIdentity(msrest.serialization.Model): """ _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, + "principal_id": {"readonly": True}, + "tenant_id": {"readonly": True}, } _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{ManagedClusterIdentityUserAssignedIdentitiesValue}'}, + "principal_id": {"key": "principalId", "type": "str"}, + "tenant_id": {"key": "tenantId", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "user_assigned_identities": { + "key": "userAssignedIdentities", + "type": "{ManagedClusterIdentityUserAssignedIdentitiesValue}", + }, } def __init__( self, *, type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, - user_assigned_identities: Optional[Dict[str, "_models.ManagedClusterIdentityUserAssignedIdentitiesValue"]] = None, + user_assigned_identities: Optional[ + Dict[str, "_models.ManagedClusterIdentityUserAssignedIdentitiesValue"] + ] = None, **kwargs ): """ @@ -2598,7 +2606,7 @@ def __init__( use an implicitly created identity in master components and an auto-created user assigned identity in MC_ resource group in agent nodes. Type 'None' will not use MSI for the managed cluster, service principal will be used instead. Known values are: "SystemAssigned", - "UserAssigned", "None". + "UserAssigned", and "None". :paramtype type: str or ~azure.mgmt.containerservice.v2020_07_01.models.ResourceIdentityType :keyword user_assigned_identities: The user identity associated with the managed cluster. This identity will be used in control plane and only one user assigned identity is allowed. The user @@ -2607,14 +2615,14 @@ def __init__( :paramtype user_assigned_identities: dict[str, ~azure.mgmt.containerservice.v2020_07_01.models.ManagedClusterIdentityUserAssignedIdentitiesValue] """ - super(ManagedClusterIdentity, self).__init__(**kwargs) + super().__init__(**kwargs) self.principal_id = None self.tenant_id = None self.type = type self.user_assigned_identities = user_assigned_identities -class ManagedClusterIdentityUserAssignedIdentitiesValue(msrest.serialization.Model): +class ManagedClusterIdentityUserAssignedIdentitiesValue(_serialization.Model): """ManagedClusterIdentityUserAssignedIdentitiesValue. Variables are only populated by the server, and will be ignored when sending a request. @@ -2626,27 +2634,23 @@ class ManagedClusterIdentityUserAssignedIdentitiesValue(msrest.serialization.Mod """ _validation = { - 'principal_id': {'readonly': True}, - 'client_id': {'readonly': True}, + "principal_id": {"readonly": True}, + "client_id": {"readonly": True}, } _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, + "principal_id": {"key": "principalId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(ManagedClusterIdentityUserAssignedIdentitiesValue, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.principal_id = None self.client_id = None -class ManagedClusterListResult(msrest.serialization.Model): +class ManagedClusterListResult(_serialization.Model): """The response from the List Managed Clusters operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -2658,30 +2662,25 @@ class ManagedClusterListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[ManagedCluster]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[ManagedCluster]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.ManagedCluster"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.ManagedCluster"]] = None, **kwargs): """ :keyword value: The list of managed clusters. :paramtype value: list[~azure.mgmt.containerservice.v2020_07_01.models.ManagedCluster] """ - super(ManagedClusterListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class ManagedClusterLoadBalancerProfile(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfile(_serialization.Model): """Profile of the managed cluster load balancer. :ivar managed_outbound_i_ps: Desired managed outbound IPs for the cluster load balancer. @@ -2707,17 +2706,23 @@ class ManagedClusterLoadBalancerProfile(msrest.serialization.Model): """ _validation = { - 'allocated_outbound_ports': {'maximum': 64000, 'minimum': 0}, - 'idle_timeout_in_minutes': {'maximum': 120, 'minimum': 4}, + "allocated_outbound_ports": {"maximum": 64000, "minimum": 0}, + "idle_timeout_in_minutes": {"maximum": 120, "minimum": 4}, } _attribute_map = { - 'managed_outbound_i_ps': {'key': 'managedOutboundIPs', 'type': 'ManagedClusterLoadBalancerProfileManagedOutboundIPs'}, - 'outbound_ip_prefixes': {'key': 'outboundIPPrefixes', 'type': 'ManagedClusterLoadBalancerProfileOutboundIPPrefixes'}, - 'outbound_i_ps': {'key': 'outboundIPs', 'type': 'ManagedClusterLoadBalancerProfileOutboundIPs'}, - 'effective_outbound_i_ps': {'key': 'effectiveOutboundIPs', 'type': '[ResourceReference]'}, - 'allocated_outbound_ports': {'key': 'allocatedOutboundPorts', 'type': 'int'}, - 'idle_timeout_in_minutes': {'key': 'idleTimeoutInMinutes', 'type': 'int'}, + "managed_outbound_i_ps": { + "key": "managedOutboundIPs", + "type": "ManagedClusterLoadBalancerProfileManagedOutboundIPs", + }, + "outbound_ip_prefixes": { + "key": "outboundIPPrefixes", + "type": "ManagedClusterLoadBalancerProfileOutboundIPPrefixes", + }, + "outbound_i_ps": {"key": "outboundIPs", "type": "ManagedClusterLoadBalancerProfileOutboundIPs"}, + "effective_outbound_i_ps": {"key": "effectiveOutboundIPs", "type": "[ResourceReference]"}, + "allocated_outbound_ports": {"key": "allocatedOutboundPorts", "type": "int"}, + "idle_timeout_in_minutes": {"key": "idleTimeoutInMinutes", "type": "int"}, } def __init__( @@ -2727,8 +2732,8 @@ def __init__( outbound_ip_prefixes: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPPrefixes"] = None, outbound_i_ps: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPs"] = None, effective_outbound_i_ps: Optional[List["_models.ResourceReference"]] = None, - allocated_outbound_ports: Optional[int] = 0, - idle_timeout_in_minutes: Optional[int] = 30, + allocated_outbound_ports: int = 0, + idle_timeout_in_minutes: int = 30, **kwargs ): """ @@ -2754,7 +2759,7 @@ def __init__( must be in the range of 4 to 120 (inclusive). The default value is 30 minutes. :paramtype idle_timeout_in_minutes: int """ - super(ManagedClusterLoadBalancerProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.managed_outbound_i_ps = managed_outbound_i_ps self.outbound_ip_prefixes = outbound_ip_prefixes self.outbound_i_ps = outbound_i_ps @@ -2763,7 +2768,7 @@ def __init__( self.idle_timeout_in_minutes = idle_timeout_in_minutes -class ManagedClusterLoadBalancerProfileManagedOutboundIPs(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfileManagedOutboundIPs(_serialization.Model): """Desired managed outbound IPs for the cluster load balancer. :ivar count: Desired number of outbound IP created/managed by Azure for the cluster load @@ -2772,29 +2777,24 @@ class ManagedClusterLoadBalancerProfileManagedOutboundIPs(msrest.serialization.M """ _validation = { - 'count': {'maximum': 100, 'minimum': 1}, + "count": {"maximum": 100, "minimum": 1}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, + "count": {"key": "count", "type": "int"}, } - def __init__( - self, - *, - count: Optional[int] = 1, - **kwargs - ): + def __init__(self, *, count: int = 1, **kwargs): """ :keyword count: Desired number of outbound IP created/managed by Azure for the cluster load balancer. Allowed values must be in the range of 1 to 100 (inclusive). The default value is 1. :paramtype count: int """ - super(ManagedClusterLoadBalancerProfileManagedOutboundIPs, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count -class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(_serialization.Model): """Desired outbound IP Prefix resources for the cluster load balancer. :ivar public_ip_prefixes: A list of public IP prefix resources. @@ -2803,25 +2803,20 @@ class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(msrest.serialization.M """ _attribute_map = { - 'public_ip_prefixes': {'key': 'publicIPPrefixes', 'type': '[ResourceReference]'}, + "public_ip_prefixes": {"key": "publicIPPrefixes", "type": "[ResourceReference]"}, } - def __init__( - self, - *, - public_ip_prefixes: Optional[List["_models.ResourceReference"]] = None, - **kwargs - ): + def __init__(self, *, public_ip_prefixes: Optional[List["_models.ResourceReference"]] = None, **kwargs): """ :keyword public_ip_prefixes: A list of public IP prefix resources. :paramtype public_ip_prefixes: list[~azure.mgmt.containerservice.v2020_07_01.models.ResourceReference] """ - super(ManagedClusterLoadBalancerProfileOutboundIPPrefixes, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_ip_prefixes = public_ip_prefixes -class ManagedClusterLoadBalancerProfileOutboundIPs(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfileOutboundIPs(_serialization.Model): """Desired outbound IP resources for the cluster load balancer. :ivar public_i_ps: A list of public IP resources. @@ -2829,34 +2824,29 @@ class ManagedClusterLoadBalancerProfileOutboundIPs(msrest.serialization.Model): """ _attribute_map = { - 'public_i_ps': {'key': 'publicIPs', 'type': '[ResourceReference]'}, + "public_i_ps": {"key": "publicIPs", "type": "[ResourceReference]"}, } - def __init__( - self, - *, - public_i_ps: Optional[List["_models.ResourceReference"]] = None, - **kwargs - ): + def __init__(self, *, public_i_ps: Optional[List["_models.ResourceReference"]] = None, **kwargs): """ :keyword public_i_ps: A list of public IP resources. :paramtype public_i_ps: list[~azure.mgmt.containerservice.v2020_07_01.models.ResourceReference] """ - super(ManagedClusterLoadBalancerProfileOutboundIPs, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_i_ps = public_i_ps -class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): +class ManagedClusterPoolUpgradeProfile(_serialization.Model): """The list of available upgrade versions. All required parameters must be populated in order to send to Azure. - :ivar kubernetes_version: Required. Kubernetes version (major, minor, patch). + :ivar kubernetes_version: Kubernetes version (major, minor, patch). Required. :vartype kubernetes_version: str :ivar name: Pool name. :vartype name: str - :ivar os_type: Required. OsType to be used to specify os type. Choose from Linux and Windows. - Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to + Linux. Known values are: "Linux" and "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2020_07_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -2864,15 +2854,15 @@ class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): """ _validation = { - 'kubernetes_version': {'required': True}, - 'os_type': {'required': True}, + "kubernetes_version": {"required": True}, + "os_type": {"required": True}, } _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'upgrades': {'key': 'upgrades', 'type': '[ManagedClusterPoolUpgradeProfileUpgradesItem]'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "os_type": {"key": "osType", "type": "str"}, + "upgrades": {"key": "upgrades", "type": "[ManagedClusterPoolUpgradeProfileUpgradesItem]"}, } def __init__( @@ -2885,25 +2875,25 @@ def __init__( **kwargs ): """ - :keyword kubernetes_version: Required. Kubernetes version (major, minor, patch). + :keyword kubernetes_version: Kubernetes version (major, minor, patch). Required. :paramtype kubernetes_version: str :keyword name: Pool name. :paramtype name: str - :keyword os_type: Required. OsType to be used to specify os type. Choose from Linux and - Windows. Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default + to Linux. Known values are: "Linux" and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2020_07_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: list[~azure.mgmt.containerservice.v2020_07_01.models.ManagedClusterPoolUpgradeProfileUpgradesItem] """ - super(ManagedClusterPoolUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.name = name self.os_type = os_type self.upgrades = upgrades -class ManagedClusterPoolUpgradeProfileUpgradesItem(msrest.serialization.Model): +class ManagedClusterPoolUpgradeProfileUpgradesItem(_serialization.Model): """ManagedClusterPoolUpgradeProfileUpgradesItem. :ivar kubernetes_version: Kubernetes version (major, minor, patch). @@ -2913,29 +2903,23 @@ class ManagedClusterPoolUpgradeProfileUpgradesItem(msrest.serialization.Model): """ _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } - def __init__( - self, - *, - kubernetes_version: Optional[str] = None, - is_preview: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, kubernetes_version: Optional[str] = None, is_preview: Optional[bool] = None, **kwargs): """ :keyword kubernetes_version: Kubernetes version (major, minor, patch). :paramtype kubernetes_version: str :keyword is_preview: Whether Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(ManagedClusterPoolUpgradeProfileUpgradesItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.is_preview = is_preview -class ManagedClusterPropertiesAutoScalerProfile(msrest.serialization.Model): +class ManagedClusterPropertiesAutoScalerProfile(_serialization.Model): """Parameters to be applied to the cluster-autoscaler when enabled. :ivar balance_similar_node_groups: @@ -2959,15 +2943,15 @@ class ManagedClusterPropertiesAutoScalerProfile(msrest.serialization.Model): """ _attribute_map = { - 'balance_similar_node_groups': {'key': 'balance-similar-node-groups', 'type': 'str'}, - 'scan_interval': {'key': 'scan-interval', 'type': 'str'}, - 'scale_down_delay_after_add': {'key': 'scale-down-delay-after-add', 'type': 'str'}, - 'scale_down_delay_after_delete': {'key': 'scale-down-delay-after-delete', 'type': 'str'}, - 'scale_down_delay_after_failure': {'key': 'scale-down-delay-after-failure', 'type': 'str'}, - 'scale_down_unneeded_time': {'key': 'scale-down-unneeded-time', 'type': 'str'}, - 'scale_down_unready_time': {'key': 'scale-down-unready-time', 'type': 'str'}, - 'scale_down_utilization_threshold': {'key': 'scale-down-utilization-threshold', 'type': 'str'}, - 'max_graceful_termination_sec': {'key': 'max-graceful-termination-sec', 'type': 'str'}, + "balance_similar_node_groups": {"key": "balance-similar-node-groups", "type": "str"}, + "scan_interval": {"key": "scan-interval", "type": "str"}, + "scale_down_delay_after_add": {"key": "scale-down-delay-after-add", "type": "str"}, + "scale_down_delay_after_delete": {"key": "scale-down-delay-after-delete", "type": "str"}, + "scale_down_delay_after_failure": {"key": "scale-down-delay-after-failure", "type": "str"}, + "scale_down_unneeded_time": {"key": "scale-down-unneeded-time", "type": "str"}, + "scale_down_unready_time": {"key": "scale-down-unready-time", "type": "str"}, + "scale_down_utilization_threshold": {"key": "scale-down-utilization-threshold", "type": "str"}, + "max_graceful_termination_sec": {"key": "max-graceful-termination-sec", "type": "str"}, } def __init__( @@ -3004,7 +2988,7 @@ def __init__( :keyword max_graceful_termination_sec: :paramtype max_graceful_termination_sec: str """ - super(ManagedClusterPropertiesAutoScalerProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.balance_similar_node_groups = balance_similar_node_groups self.scan_interval = scan_interval self.scale_down_delay_after_add = scale_down_delay_after_add @@ -3028,9 +3012,9 @@ class ManagedClusterPropertiesIdentityProfileValue(UserAssignedIdentity): """ _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'object_id': {'key': 'objectId', 'type': 'str'}, + "resource_id": {"key": "resourceId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + "object_id": {"key": "objectId", "type": "str"}, } def __init__( @@ -3049,59 +3033,53 @@ def __init__( :keyword object_id: The object id of the user assigned identity. :paramtype object_id: str """ - super(ManagedClusterPropertiesIdentityProfileValue, self).__init__(resource_id=resource_id, client_id=client_id, object_id=object_id, **kwargs) + super().__init__(resource_id=resource_id, client_id=client_id, object_id=object_id, **kwargs) -class ManagedClusterServicePrincipalProfile(msrest.serialization.Model): +class ManagedClusterServicePrincipalProfile(_serialization.Model): """Information about a service principal identity for the cluster to use for manipulating Azure APIs. All required parameters must be populated in order to send to Azure. - :ivar client_id: Required. The ID for the service principal. + :ivar client_id: The ID for the service principal. Required. :vartype client_id: str :ivar secret: The secret password associated with the service principal in plain text. :vartype secret: str """ _validation = { - 'client_id': {'required': True}, + "client_id": {"required": True}, } _attribute_map = { - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'secret': {'key': 'secret', 'type': 'str'}, + "client_id": {"key": "clientId", "type": "str"}, + "secret": {"key": "secret", "type": "str"}, } - def __init__( - self, - *, - client_id: str, - secret: Optional[str] = None, - **kwargs - ): + def __init__(self, *, client_id: str, secret: Optional[str] = None, **kwargs): """ - :keyword client_id: Required. The ID for the service principal. + :keyword client_id: The ID for the service principal. Required. :paramtype client_id: str :keyword secret: The secret password associated with the service principal in plain text. :paramtype secret: str """ - super(ManagedClusterServicePrincipalProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.client_id = client_id self.secret = secret -class ManagedClusterSKU(msrest.serialization.Model): +class ManagedClusterSKU(_serialization.Model): """ManagedClusterSKU. - :ivar name: Name of a managed cluster SKU. Known values are: "Basic". + :ivar name: Name of a managed cluster SKU. "Basic" :vartype name: str or ~azure.mgmt.containerservice.v2020_07_01.models.ManagedClusterSKUName - :ivar tier: Tier of a managed cluster SKU. Known values are: "Paid", "Free". + :ivar tier: Tier of a managed cluster SKU. Known values are: "Paid" and "Free". :vartype tier: str or ~azure.mgmt.containerservice.v2020_07_01.models.ManagedClusterSKUTier """ _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, + "name": {"key": "name", "type": "str"}, + "tier": {"key": "tier", "type": "str"}, } def __init__( @@ -3112,17 +3090,17 @@ def __init__( **kwargs ): """ - :keyword name: Name of a managed cluster SKU. Known values are: "Basic". + :keyword name: Name of a managed cluster SKU. "Basic" :paramtype name: str or ~azure.mgmt.containerservice.v2020_07_01.models.ManagedClusterSKUName - :keyword tier: Tier of a managed cluster SKU. Known values are: "Paid", "Free". + :keyword tier: Tier of a managed cluster SKU. Known values are: "Paid" and "Free". :paramtype tier: str or ~azure.mgmt.containerservice.v2020_07_01.models.ManagedClusterSKUTier """ - super(ManagedClusterSKU, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.tier = tier -class ManagedClusterUpgradeProfile(msrest.serialization.Model): +class ManagedClusterUpgradeProfile(_serialization.Model): """The list of available upgrades for compute pools. Variables are only populated by the server, and will be ignored when sending a request. @@ -3135,29 +3113,29 @@ class ManagedClusterUpgradeProfile(msrest.serialization.Model): :vartype name: str :ivar type: Type of upgrade profile. :vartype type: str - :ivar control_plane_profile: Required. The list of available upgrade versions for the control - plane. + :ivar control_plane_profile: The list of available upgrade versions for the control plane. + Required. :vartype control_plane_profile: ~azure.mgmt.containerservice.v2020_07_01.models.ManagedClusterPoolUpgradeProfile - :ivar agent_pool_profiles: Required. The list of available upgrade versions for agent pools. + :ivar agent_pool_profiles: The list of available upgrade versions for agent pools. Required. :vartype agent_pool_profiles: list[~azure.mgmt.containerservice.v2020_07_01.models.ManagedClusterPoolUpgradeProfile] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'control_plane_profile': {'required': True}, - 'agent_pool_profiles': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "control_plane_profile": {"required": True}, + "agent_pool_profiles": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'control_plane_profile': {'key': 'properties.controlPlaneProfile', 'type': 'ManagedClusterPoolUpgradeProfile'}, - 'agent_pool_profiles': {'key': 'properties.agentPoolProfiles', 'type': '[ManagedClusterPoolUpgradeProfile]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "control_plane_profile": {"key": "properties.controlPlaneProfile", "type": "ManagedClusterPoolUpgradeProfile"}, + "agent_pool_profiles": {"key": "properties.agentPoolProfiles", "type": "[ManagedClusterPoolUpgradeProfile]"}, } def __init__( @@ -3168,15 +3146,15 @@ def __init__( **kwargs ): """ - :keyword control_plane_profile: Required. The list of available upgrade versions for the - control plane. + :keyword control_plane_profile: The list of available upgrade versions for the control plane. + Required. :paramtype control_plane_profile: ~azure.mgmt.containerservice.v2020_07_01.models.ManagedClusterPoolUpgradeProfile - :keyword agent_pool_profiles: Required. The list of available upgrade versions for agent pools. + :keyword agent_pool_profiles: The list of available upgrade versions for agent pools. Required. :paramtype agent_pool_profiles: list[~azure.mgmt.containerservice.v2020_07_01.models.ManagedClusterPoolUpgradeProfile] """ - super(ManagedClusterUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -3184,18 +3162,18 @@ def __init__( self.agent_pool_profiles = agent_pool_profiles -class ManagedClusterWindowsProfile(msrest.serialization.Model): +class ManagedClusterWindowsProfile(_serialization.Model): """Profile for Windows VMs in the container service cluster. All required parameters must be populated in order to send to Azure. - :ivar admin_username: Required. Specifies the name of the administrator account. - :code:`
`:code:`
` **restriction:** Cannot end in "." :code:`
`:code:`
` - **Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", "test1", - "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", - "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", - "sys", "test2", "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 - character :code:`
`:code:`
` **Max-length:** 20 characters. + :ivar admin_username: Specifies the name of the administrator account. :code:`
`:code:`
` + **restriction:** Cannot end in "." :code:`
`:code:`
` **Disallowed values:** + "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", + "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", + "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", + "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 character + :code:`
`:code:`
` **Max-length:** 20 characters. Required. :vartype admin_username: str :ivar admin_password: Specifies the password of the administrator account. :code:`
`:code:`
` **Minimum-length:** 8 characters :code:`
`:code:`
` @@ -3206,18 +3184,18 @@ class ManagedClusterWindowsProfile(msrest.serialization.Model): "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!". :vartype admin_password: str :ivar license_type: The licenseType to use for Windows VMs. Windows_Server is used to enable - Azure Hybrid User Benefits for Windows VMs. Known values are: "None", "Windows_Server". + Azure Hybrid User Benefits for Windows VMs. Known values are: "None" and "Windows_Server". :vartype license_type: str or ~azure.mgmt.containerservice.v2020_07_01.models.LicenseType """ _validation = { - 'admin_username': {'required': True}, + "admin_username": {"required": True}, } _attribute_map = { - 'admin_username': {'key': 'adminUsername', 'type': 'str'}, - 'admin_password': {'key': 'adminPassword', 'type': 'str'}, - 'license_type': {'key': 'licenseType', 'type': 'str'}, + "admin_username": {"key": "adminUsername", "type": "str"}, + "admin_password": {"key": "adminPassword", "type": "str"}, + "license_type": {"key": "licenseType", "type": "str"}, } def __init__( @@ -3229,13 +3207,13 @@ def __init__( **kwargs ): """ - :keyword admin_username: Required. Specifies the name of the administrator account. + :keyword admin_username: Specifies the name of the administrator account. :code:`
`:code:`
` **restriction:** Cannot end in "." :code:`
`:code:`
` **Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 - character :code:`
`:code:`
` **Max-length:** 20 characters. + character :code:`
`:code:`
` **Max-length:** 20 characters. Required. :paramtype admin_username: str :keyword admin_password: Specifies the password of the administrator account. :code:`
`:code:`
` **Minimum-length:** 8 characters :code:`
`:code:`
` @@ -3246,16 +3224,16 @@ def __init__( "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!". :paramtype admin_password: str :keyword license_type: The licenseType to use for Windows VMs. Windows_Server is used to enable - Azure Hybrid User Benefits for Windows VMs. Known values are: "None", "Windows_Server". + Azure Hybrid User Benefits for Windows VMs. Known values are: "None" and "Windows_Server". :paramtype license_type: str or ~azure.mgmt.containerservice.v2020_07_01.models.LicenseType """ - super(ManagedClusterWindowsProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.admin_username = admin_username self.admin_password = admin_password self.license_type = license_type -class OperationListResult(msrest.serialization.Model): +class OperationListResult(_serialization.Model): """The List Compute Operation operation response. Variables are only populated by the server, and will be ignored when sending a request. @@ -3265,24 +3243,20 @@ class OperationListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[OperationValue]'}, + "value": {"key": "value", "type": "[OperationValue]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(OperationListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None -class OperationValue(msrest.serialization.Model): +class OperationValue(_serialization.Model): """Describes the properties of a Compute Operation value. Variables are only populated by the server, and will be ignored when sending a request. @@ -3302,30 +3276,26 @@ class OperationValue(msrest.serialization.Model): """ _validation = { - 'origin': {'readonly': True}, - 'name': {'readonly': True}, - 'operation': {'readonly': True}, - 'resource': {'readonly': True}, - 'description': {'readonly': True}, - 'provider': {'readonly': True}, + "origin": {"readonly": True}, + "name": {"readonly": True}, + "operation": {"readonly": True}, + "resource": {"readonly": True}, + "description": {"readonly": True}, + "provider": {"readonly": True}, } _attribute_map = { - 'origin': {'key': 'origin', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'operation': {'key': 'display.operation', 'type': 'str'}, - 'resource': {'key': 'display.resource', 'type': 'str'}, - 'description': {'key': 'display.description', 'type': 'str'}, - 'provider': {'key': 'display.provider', 'type': 'str'}, + "origin": {"key": "origin", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "operation": {"key": "display.operation", "type": "str"}, + "resource": {"key": "display.resource", "type": "str"}, + "description": {"key": "display.description", "type": "str"}, + "provider": {"key": "display.provider", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(OperationValue, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.origin = None self.name = None self.operation = None @@ -3334,7 +3304,7 @@ def __init__( self.provider = None -class PrivateEndpoint(msrest.serialization.Model): +class PrivateEndpoint(_serialization.Model): """Private endpoint which a connection belongs to. :ivar id: The resource Id for private endpoint. @@ -3342,24 +3312,19 @@ class PrivateEndpoint(msrest.serialization.Model): """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, } - def __init__( - self, - *, - id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin """ :keyword id: The resource Id for private endpoint. :paramtype id: str """ - super(PrivateEndpoint, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id -class PrivateEndpointConnection(msrest.serialization.Model): +class PrivateEndpointConnection(_serialization.Model): """A private endpoint connection. Variables are only populated by the server, and will be ignored when sending a request. @@ -3371,7 +3336,7 @@ class PrivateEndpointConnection(msrest.serialization.Model): :ivar type: The resource type. :vartype type: str :ivar provisioning_state: The current provisioning state. Known values are: "Succeeded", - "Creating", "Deleting", "Failed". + "Creating", "Deleting", and "Failed". :vartype provisioning_state: str or ~azure.mgmt.containerservice.v2020_07_01.models.PrivateEndpointConnectionProvisioningState :ivar private_endpoint: The resource of private endpoint. @@ -3383,19 +3348,22 @@ class PrivateEndpointConnection(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'provisioning_state': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, - 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "private_endpoint": {"key": "properties.privateEndpoint", "type": "PrivateEndpoint"}, + "private_link_service_connection_state": { + "key": "properties.privateLinkServiceConnectionState", + "type": "PrivateLinkServiceConnectionState", + }, } def __init__( @@ -3413,7 +3381,7 @@ def __init__( :paramtype private_link_service_connection_state: ~azure.mgmt.containerservice.v2020_07_01.models.PrivateLinkServiceConnectionState """ - super(PrivateEndpointConnection, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -3422,7 +3390,7 @@ def __init__( self.private_link_service_connection_state = private_link_service_connection_state -class PrivateEndpointConnectionListResult(msrest.serialization.Model): +class PrivateEndpointConnectionListResult(_serialization.Model): """A list of private endpoint connections. :ivar value: The collection value. @@ -3430,37 +3398,32 @@ class PrivateEndpointConnectionListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, + "value": {"key": "value", "type": "[PrivateEndpointConnection]"}, } - def __init__( - self, - *, - value: Optional[List["_models.PrivateEndpointConnection"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.PrivateEndpointConnection"]] = None, **kwargs): """ :keyword value: The collection value. :paramtype value: list[~azure.mgmt.containerservice.v2020_07_01.models.PrivateEndpointConnection] """ - super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value -class PrivateLinkServiceConnectionState(msrest.serialization.Model): +class PrivateLinkServiceConnectionState(_serialization.Model): """The state of a private link service connection. :ivar status: The private link service connection status. Known values are: "Pending", - "Approved", "Rejected", "Disconnected". + "Approved", "Rejected", and "Disconnected". :vartype status: str or ~azure.mgmt.containerservice.v2020_07_01.models.ConnectionStatus :ivar description: The private link service connection description. :vartype description: str """ _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, + "status": {"key": "status", "type": "str"}, + "description": {"key": "description", "type": "str"}, } def __init__( @@ -3472,17 +3435,17 @@ def __init__( ): """ :keyword status: The private link service connection status. Known values are: "Pending", - "Approved", "Rejected", "Disconnected". + "Approved", "Rejected", and "Disconnected". :paramtype status: str or ~azure.mgmt.containerservice.v2020_07_01.models.ConnectionStatus :keyword description: The private link service connection description. :paramtype description: str """ - super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) + super().__init__(**kwargs) self.status = status self.description = description -class ResourceReference(msrest.serialization.Model): +class ResourceReference(_serialization.Model): """A reference to an Azure resource. :ivar id: The fully qualified Azure resource id. @@ -3490,43 +3453,33 @@ class ResourceReference(msrest.serialization.Model): """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, } - def __init__( - self, - *, - id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin """ :keyword id: The fully qualified Azure resource id. :paramtype id: str """ - super(ResourceReference, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id -class TagsObject(msrest.serialization.Model): +class TagsObject(_serialization.Model): """Tags object for patch operations. - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] """ _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] """ - super(TagsObject, self).__init__(**kwargs) + super().__init__(**kwargs) self.tags = tags diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/models/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/models/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/models/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/models/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/operations/__init__.py index 9ef6890a9e03..65da25631a4b 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/operations/__init__.py @@ -14,11 +14,12 @@ from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'Operations', - 'ManagedClustersOperations', - 'AgentPoolsOperations', - 'PrivateEndpointConnectionsOperations', + "Operations", + "ManagedClustersOperations", + "AgentPoolsOperations", + "PrivateEndpointConnectionsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/operations/_agent_pools_operations.py index 08745b928202..046bf324a848 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/operations/_agent_pools_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,288 +27,289 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - *, - json: Optional[_models.AgentPool] = None, - content: Any = None, - **kwargs: Any + _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, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + _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, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_get_upgrade_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_available_agent_pool_versions_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_upgrade_node_image_version_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_upgrade_node_image_version_request( + resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class AgentPoolsOperations: """ @@ -324,48 +330,40 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> Iterable[_models.AgentPoolListResult]: + def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> Iterable["_models.AgentPool"]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. The operation returns properties of each agent pool. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AgentPoolListResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_07_01.models.AgentPoolListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either AgentPool or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_07_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -373,16 +371,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -398,10 +391,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -411,54 +402,45 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore @distributed_trace def get( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPool: """Gets the agent pool. Gets the details of the agent pool by managed cluster and resource group. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPool, or the result of cls(response) + :return: AgentPool or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_07_01.models.AgentPool - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -466,57 +448,60 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore def _create_or_update_initial( self, resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: _models.AgentPool, + parameters: Union[_models.AgentPool, IO], **kwargs: Any ) -> _models.AgentPool: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - _json = self._serialize.body(parameters, 'AgentPool') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "AgentPool") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -524,10 +509,9 @@ def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -535,40 +519,125 @@ def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - @distributed_trace + @overload def begin_create_or_update( self, resource_group_name: str, resource_name: str, agent_pool_name: str, parameters: _models.AgentPool, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.AgentPool]: """Creates or updates an agent pool. Creates or updates an agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :param parameters: Parameters supplied to the Create or Update an agent pool operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2020_07_01.models.AgentPool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_07_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AgentPool]: + """Creates or updates an agent pool. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: Parameters supplied to the Create or Update an agent pool operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_07_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: Union[_models.AgentPool, IO], + **kwargs: Any + ) -> LROPoller[_models.AgentPool]: + """Creates or updates an agent pool. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: Parameters supplied to the Create or Update an agent pool operation. Is + either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2020_07_01.models.AgentPool or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -580,20 +649,17 @@ def begin_create_or_update( :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_07_01.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -602,66 +668,55 @@ def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -669,10 +724,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -682,26 +736,21 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + def begin_delete( + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> LROPoller[None]: """Deletes an agent pool. Deletes the agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -713,100 +762,86 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPoolUpgradeProfile: """Gets upgrade profile for an agent pool. Gets the details of the upgrade profile for an agent pool with a specified resource group and managed cluster name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolUpgradeProfile, or the result of cls(response) + :return: AgentPoolUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_07_01.models.AgentPoolUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -814,64 +849,56 @@ def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolUpgradeProfile', pipeline_response) + deserialized = self._deserialize("AgentPoolUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore @distributed_trace def get_available_agent_pool_versions( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported versions for the specified agent pool. Gets a list of supported versions for the specified agent pool. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolAvailableVersions, or the result of cls(response) + :return: AgentPoolAvailableVersions or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_07_01.models.AgentPoolAvailableVersions - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolAvailableVersions] - request = build_get_available_agent_pool_versions_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_available_agent_pool_versions.metadata['url'], + template_url=self.get_available_agent_pool_versions.metadata["url"], headers=_headers, params=_params, ) @@ -879,52 +906,43 @@ def get_available_agent_pool_versions( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolAvailableVersions', pipeline_response) + deserialized = self._deserialize("AgentPoolAvailableVersions", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_available_agent_pool_versions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore - + get_available_agent_pool_versions.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore def _upgrade_node_image_version_initial( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> Optional[_models.AgentPool]: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.AgentPool]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.AgentPool]] - - request = build_upgrade_node_image_version_request_initial( - subscription_id=self._config.subscription_id, + request = build_upgrade_node_image_version_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._upgrade_node_image_version_initial.metadata['url'], + template_url=self._upgrade_node_image_version_initial.metadata["url"], headers=_headers, params=_params, ) @@ -932,10 +950,9 @@ def _upgrade_node_image_version_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -944,33 +961,28 @@ def _upgrade_node_image_version_initial( deserialized = None if response.status_code == 202: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _upgrade_node_image_version_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore - + _upgrade_node_image_version_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore @distributed_trace def begin_upgrade_node_image_version( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any - ) -> LROPoller[_models.AgentPool]: + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any + ) -> LROPoller[None]: """Upgrade node image version of an agent pool to the latest. Upgrade node image version of an agent pool to the latest. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -983,55 +995,48 @@ def begin_upgrade_node_image_version( :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_07_01.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._upgrade_node_image_version_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_upgrade_node_image_version.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore + begin_upgrade_node_image_version.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/operations/_managed_clusters_operations.py index e2bfc3120eca..84550dd64a6b 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/operations/_managed_clusters_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,557 +27,536 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters") + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters" + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_resource_group_request( - subscription_id: str, - resource_group_name: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters", + ) # 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', min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_upgrade_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_access_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, role_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 = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "roleName": _SERIALIZER.url("role_name", role_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "roleName": _SERIALIZER.url("role_name", role_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_admin_credentials_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_user_credentials_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_monitoring_user_credentials_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: + +def build_get_request(resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedCluster] = None, - content: Any = None, - **kwargs: Any +def build_create_or_update_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_update_tags_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.TagsObject] = None, - content: Any = None, - **kwargs: Any + +def build_update_tags_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + +def build_delete_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_reset_service_principal_profile_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedClusterServicePrincipalProfile] = None, - content: Any = None, - **kwargs: Any + +def build_reset_service_principal_profile_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_reset_aad_profile_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedClusterAADProfile] = None, - content: Any = None, - **kwargs: Any +def build_reset_aad_profile_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_rotate_cluster_certificates_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any +def build_rotate_cluster_certificates_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + class ManagedClustersOperations: """ @@ -593,41 +577,35 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.ManagedClusterListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.ManagedCluster"]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. The operation returns properties of each managed cluster. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_07_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_07_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -635,14 +613,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -658,10 +633,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -671,50 +644,42 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> Iterable[_models.ManagedClusterListResult]: + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.ManagedCluster"]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. The operation returns properties of each managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_07_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_07_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -722,15 +687,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -746,10 +707,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -759,51 +718,43 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.ManagedClusterUpgradeProfile: """Gets upgrade profile for a managed cluster. Gets the details of the upgrade profile for a managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterUpgradeProfile, or the result of cls(response) + :return: ManagedClusterUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_07_01.models.ManagedClusterUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -811,33 +762,27 @@ def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterUpgradeProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore @distributed_trace def get_access_profile( - self, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, role_name: str, **kwargs: Any ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. @@ -848,36 +793,33 @@ def get_access_profile( `ListClusterAdminCredentials `_ . - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param role_name: The name of the role for managed cluster accessProfile resource. + :param role_name: The name of the role for managed cluster accessProfile resource. Required. :type role_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterAccessProfile, or the result of cls(response) + :return: ManagedClusterAccessProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_07_01.models.ManagedClusterAccessProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterAccessProfile] - request = build_get_access_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, role_name=role_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_access_profile.metadata['url'], + template_url=self.get_access_profile.metadata["url"], headers=_headers, params=_params, ) @@ -885,64 +827,56 @@ def get_access_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterAccessProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterAccessProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_access_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore - + get_access_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore @distributed_trace def list_cluster_admin_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster admin credential of a managed cluster. Gets cluster admin credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_07_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_admin_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_admin_credentials.metadata['url'], + template_url=self.list_cluster_admin_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -950,64 +884,56 @@ def list_cluster_admin_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_admin_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore - + list_cluster_admin_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore @distributed_trace def list_cluster_user_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster user credential of a managed cluster. Gets cluster user credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_07_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_user_credentials.metadata['url'], + template_url=self.list_cluster_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -1015,65 +941,57 @@ def list_cluster_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore - + list_cluster_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore @distributed_trace def list_cluster_monitoring_user_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster monitoring user credential of a managed cluster. Gets cluster monitoring user credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_07_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_monitoring_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + template_url=self.list_cluster_monitoring_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -1081,64 +999,54 @@ def list_cluster_monitoring_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_monitoring_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore - + list_cluster_monitoring_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore @distributed_trace - def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.ManagedCluster: + def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.ManagedCluster: """Gets a managed cluster. Gets the details of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedCluster, or the result of cls(response) + :return: ManagedCluster or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_07_01.models.ManagedCluster - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -1146,55 +1054,54 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _create_or_update_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.ManagedCluster, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'ManagedCluster') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedCluster") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1202,10 +1109,9 @@ def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -1213,25 +1119,26 @@ def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - @distributed_trace + @overload def begin_create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedCluster, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. @@ -1239,12 +1146,16 @@ def begin_create_or_update( Creates or updates a managed cluster with the specified configuration for agents and Kubernetes version. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2020_07_01.models.ManagedCluster + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1257,20 +1168,91 @@ def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_07_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster with the specified configuration for agents and Kubernetes + version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_07_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster with the specified configuration for agents and Kubernetes + version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. Is + either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2020_07_01.models.ManagedCluster or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_07_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -1278,69 +1260,66 @@ def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _update_tags_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.TagsObject, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request_initial( - subscription_id=self._config.subscription_id, + request = build_update_tags_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_tags_initial.metadata['url'], + content=_content, + template_url=self._update_tags_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1348,44 +1327,118 @@ def _update_tags_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_tags_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _update_tags_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - @distributed_trace + @overload def begin_update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates a managed cluster with the specified tags. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2020_07_01.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_07_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates a managed cluster with the specified tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_07_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates a managed cluster with the specified tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2020_07_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1398,20 +1451,17 @@ def begin_update_tags( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_07_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, @@ -1419,64 +1469,54 @@ def begin_update_tags( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1484,10 +1524,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1497,23 +1536,17 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> LROPoller[None]: + def begin_delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> LROPoller[None]: """Deletes a managed cluster. Deletes the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1525,85 +1558,83 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterServicePrincipalProfile, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterServicePrincipalProfile") - request = build_reset_service_principal_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_service_principal_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_service_principal_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_service_principal_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1611,10 +1642,9 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1624,29 +1654,106 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re if cls: return cls(pipeline_response, None, {}) - _reset_service_principal_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore - + _reset_service_principal_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore - @distributed_trace - def begin_reset_service_principal_profile( # pylint: disable=inconsistent-return-statements + @overload + def begin_reset_service_principal_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterServicePrincipalProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: """Reset Service Principal Profile of a managed cluster. Update the service principal Profile for a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a - Managed Cluster. + Managed Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2020_07_01.models.ManagedClusterServicePrincipalProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reset Service Principal Profile of a managed cluster. + + Update the service principal Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a + Managed Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Reset Service Principal Profile of a managed cluster. + + Update the service principal Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a + Managed Cluster. Is either a model type or a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2020_07_01.models.ManagedClusterServicePrincipalProfile or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1657,20 +1764,17 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1678,67 +1782,68 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_service_principal_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + begin_reset_service_principal_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterAADProfile, + parameters: Union[_models.ManagedClusterAADProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterAADProfile") - request = build_reset_aad_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_aad_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_aad_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_aad_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1746,10 +1851,9 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1759,28 +1863,32 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement if cls: return cls(pipeline_response, None, {}) - _reset_aad_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - + _reset_aad_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - @distributed_trace - def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements + @overload + def begin_reset_aad_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterAADProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: """Reset AAD Profile of a managed cluster. Update the AAD Profile for a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed - Cluster. + Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2020_07_01.models.ManagedClusterAADProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1791,20 +1899,90 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reset AAD Profile of a managed cluster. + + Update the AAD Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed + Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterAADProfile, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Reset AAD Profile of a managed cluster. + + Update the AAD Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed + Cluster. Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2020_07_01.models.ManagedClusterAADProfile or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1812,62 +1990,52 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_aad_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + begin_reset_aad_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_rotate_cluster_certificates_request_initial( - subscription_id=self._config.subscription_id, + request = build_rotate_cluster_certificates_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._rotate_cluster_certificates_initial.metadata['url'], + template_url=self._rotate_cluster_certificates_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1875,10 +2043,9 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1888,23 +2055,19 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return if cls: return cls(pipeline_response, None, {}) - _rotate_cluster_certificates_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore - + _rotate_cluster_certificates_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore @distributed_trace - def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + def begin_rotate_cluster_certificates( + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> LROPoller[None]: """Rotate certificates of a managed cluster. Rotate certificates of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1916,52 +2079,45 @@ def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-st Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._rotate_cluster_certificates_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_rotate_cluster_certificates.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore + begin_rotate_cluster_certificates.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/operations/_operations.py index 4cff3e6c5d1c..bb7a9304a193 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/operations/_operations.py @@ -7,10 +7,15 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,38 +25,34 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - **kwargs: Any -) -> HttpRequest: + +def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.ContainerService/operations") # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class Operations: """ @@ -72,36 +73,31 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.OperationListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.OperationValue"]: """Gets a list of compute operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationListResult or the result of cls(response) + :return: An iterator like instance of either OperationValue or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_07_01.models.OperationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_07_01.models.OperationValue] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -109,13 +105,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -131,10 +125,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -144,8 +136,6 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.ContainerService/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ContainerService/operations"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/operations/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/operations/_private_endpoint_connections_operations.py index 3cae8a7f0882..07df300b322b 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/operations/_private_endpoint_connections_operations.py @@ -6,11 +6,15 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod @@ -21,173 +25,191 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - subscription_id: str, resource_group_name: str, resource_name: str, private_endpoint_connection_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 = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_update_request( - subscription_id: str, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, - *, - json: Optional[_models.PrivateEndpointConnection] = None, - content: Any = None, + subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request_initial( - subscription_id: str, +def build_delete_request( resource_group_name: str, resource_name: str, private_endpoint_connection_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 = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class PrivateEndpointConnectionsOperations: """ @@ -208,46 +230,39 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnectionListResult: """Gets a list of private endpoint connections in the specified managed cluster. Gets a list of private endpoint connections in the specified managed cluster. The operation returns properties of each private endpoint connection. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnectionListResult, or the result of cls(response) + :return: PrivateEndpointConnectionListResult or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_07_01.models.PrivateEndpointConnectionListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnectionListResult] - request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -255,68 +270,59 @@ def list( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore - + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore @distributed_trace def get( - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnection: """Gets the private endpoint connection. Gets the details of the private endpoint connection by managed cluster and resource group. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_07_01.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -324,75 +330,149 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - @distributed_trace + @overload def update( self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, parameters: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateEndpointConnection: """Updates a private endpoint connection. Updates a private endpoint connection in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :param parameters: Parameters supplied to the Update a private endpoint connection operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2020_07_01.models.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2020_07_01.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: Parameters supplied to the Update a private endpoint connection operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_07_01.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @distributed_trace + def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: Union[_models.PrivateEndpointConnection, IO], + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: Parameters supplied to the Update a private endpoint connection operation. + Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2020_07_01.models.PrivateEndpointConnection or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2020_07_01.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - _json = self._serialize.body(parameters, 'PrivateEndpointConnection') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateEndpointConnection") request = build_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update.metadata['url'], + content=_content, + template_url=self.update.metadata["url"], headers=_headers, params=_params, ) @@ -400,52 +480,43 @@ def update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -453,10 +524,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -466,26 +536,21 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + def begin_delete( + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> LROPoller[None]: """Deletes a private endpoint connection. Deletes the private endpoint connection in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -497,53 +562,46 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/__init__.py index 37a5f9e02e6f..a8716d29afe8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/__init__.py @@ -14,7 +14,8 @@ except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['ContainerServiceClient'] + +__all__ = ["ContainerServiceClient"] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/_configuration.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/_configuration.py index 4eb24a463bdf..8c7bbb8538af 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/_configuration.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/_configuration.py @@ -18,30 +18,26 @@ VERSION = "unknown" + class ContainerServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ContainerServiceClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2020-09-01". 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: + def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ContainerServiceClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2020-09-01") # type: str + api_version = kwargs.pop("api_version", "2020-09-01") # type: str if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -51,23 +47,24 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-containerservice/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-containerservice/{}".format(VERSION)) self._configure(**kwargs) def _configure( - self, - **kwargs # type: Any + self, **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/_container_service_client.py index 4aaa3fd573e2..b2fd6bb95cff 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/_container_service_client.py @@ -9,20 +9,27 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from . import models +from .._serialization import Deserializer, Serializer from ._configuration import ContainerServiceClientConfiguration -from .operations import AgentPoolsOperations, ManagedClustersOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, ResolvePrivateLinkServiceIdOperations +from .operations import ( + AgentPoolsOperations, + ManagedClustersOperations, + Operations, + PrivateEndpointConnectionsOperations, + PrivateLinkResourcesOperations, + ResolvePrivateLinkServiceIdOperations, +) if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class ContainerServiceClient: + +class ContainerServiceClient: # pylint: disable=client-accepts-api-version-keyword """The Container Service Client. :ivar operations: Operations operations @@ -41,10 +48,10 @@ class ContainerServiceClient: :ivar resolve_private_link_service_id: ResolvePrivateLinkServiceIdOperations operations :vartype resolve_private_link_service_id: azure.mgmt.containerservice.v2020_09_01.operations.ResolvePrivateLinkServiceIdOperations - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -62,22 +69,20 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = ContainerServiceClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = ContainerServiceClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize - ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.managed_clusters = ManagedClustersOperations( self._client, self._config, self._serialize, self._deserialize ) - self.agent_pools = AgentPoolsOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) self.private_endpoint_connections = PrivateEndpointConnectionsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -88,12 +93,7 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) - - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> HttpResponse: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -102,7 +102,7 @@ def _send_request( >>> response = client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/_metadata.json b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/_metadata.json index 7f26142c5d6b..f454d7c15a1b 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/_metadata.json +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/_metadata.json @@ -10,20 +10,20 @@ "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { "credential": { - "signature": "credential, # type: \"TokenCredential\"", - "description": "Credential needed for the client to connect to Azure.", + "signature": "credential: \"TokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true }, "subscription_id": { - "signature": "subscription_id, # type: str", - "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "signature": "subscription_id: str,", + "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.", "docstring_type": "str", "required": true } @@ -31,13 +31,13 @@ "async": { "credential": { "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure.", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { "signature": "subscription_id: str,", - "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.", "docstring_type": "str", "required": true } @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=\"https://management.azure.com\", # type: str", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/_patch.py index 74e48ecd07cf..f99e77fef986 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/_patch.py @@ -28,4 +28,4 @@ # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + pass diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/_vendor.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/_vendor.py index 138f663c53a4..9aad73fc743e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/_vendor.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/_vendor.py @@ -7,6 +7,7 @@ from azure.core.pipeline.transport import HttpRequest + def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) @@ -14,6 +15,7 @@ def _convert_request(request, files=None): request.set_formdata_body(files) return request + def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -21,7 +23,5 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [ - c for c in formatted_components if "{}".format(key.args[0]) not in c - ] + components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/aio/__init__.py index 37a5f9e02e6f..a8716d29afe8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/aio/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/aio/__init__.py @@ -14,7 +14,8 @@ except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['ContainerServiceClient'] + +__all__ = ["ContainerServiceClient"] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/aio/_configuration.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/aio/_configuration.py index 432a53e77a74..c506a0562d1b 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/aio/_configuration.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/aio/_configuration.py @@ -18,30 +18,26 @@ VERSION = "unknown" + class ContainerServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ContainerServiceClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2020-09-01". 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: + def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ContainerServiceClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2020-09-01") # type: str + api_version = kwargs.pop("api_version", "2020-09-01") # type: str if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -51,22 +47,21 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-containerservice/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-containerservice/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, - **kwargs: Any - ) -> None: - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/aio/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/aio/_container_service_client.py index 221bdc1896d3..1c919c649353 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/aio/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/aio/_container_service_client.py @@ -9,20 +9,27 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from .. import models +from ..._serialization import Deserializer, Serializer from ._configuration import ContainerServiceClientConfiguration -from .operations import AgentPoolsOperations, ManagedClustersOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, ResolvePrivateLinkServiceIdOperations +from .operations import ( + AgentPoolsOperations, + ManagedClustersOperations, + Operations, + PrivateEndpointConnectionsOperations, + PrivateLinkResourcesOperations, + ResolvePrivateLinkServiceIdOperations, +) if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class ContainerServiceClient: + +class ContainerServiceClient: # pylint: disable=client-accepts-api-version-keyword """The Container Service Client. :ivar operations: Operations operations @@ -42,10 +49,10 @@ class ContainerServiceClient: :ivar resolve_private_link_service_id: ResolvePrivateLinkServiceIdOperations operations :vartype resolve_private_link_service_id: azure.mgmt.containerservice.v2020_09_01.aio.operations.ResolvePrivateLinkServiceIdOperations - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -63,22 +70,20 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = ContainerServiceClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = ContainerServiceClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize - ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.managed_clusters = ManagedClustersOperations( self._client, self._config, self._serialize, self._deserialize ) - self.agent_pools = AgentPoolsOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) self.private_endpoint_connections = PrivateEndpointConnectionsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -89,12 +94,7 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) - - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -103,7 +103,7 @@ def _send_request( >>> response = await client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/aio/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/aio/_patch.py index 74e48ecd07cf..f99e77fef986 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/aio/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/aio/_patch.py @@ -28,4 +28,4 @@ # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + pass diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/aio/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/aio/operations/__init__.py index eb76d54a688d..160f4be0e9d7 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/aio/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/aio/operations/__init__.py @@ -16,13 +16,14 @@ from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'Operations', - 'ManagedClustersOperations', - 'AgentPoolsOperations', - 'PrivateEndpointConnectionsOperations', - 'PrivateLinkResourcesOperations', - 'ResolvePrivateLinkServiceIdOperations', + "Operations", + "ManagedClustersOperations", + "AgentPoolsOperations", + "PrivateEndpointConnectionsOperations", + "PrivateLinkResourcesOperations", + "ResolvePrivateLinkServiceIdOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/aio/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/aio/operations/_agent_pools_operations.py index 3a92f26aa0d1..874b5a828dad 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/aio/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/aio/operations/_agent_pools_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +29,20 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._agent_pools_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_available_agent_pool_versions_request, build_get_request, build_get_upgrade_profile_request, build_list_request, build_upgrade_node_image_version_request_initial -T = TypeVar('T') +from ...operations._agent_pools_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_available_agent_pool_versions_request, + build_get_request, + build_get_upgrade_profile_request, + build_list_request, + build_upgrade_node_image_version_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class AgentPoolsOperations: """ .. warning:: @@ -45,48 +62,41 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.AgentPoolListResult]: + def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncIterable["_models.AgentPool"]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. The operation returns properties of each agent pool. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AgentPoolListResult or the result of cls(response) + :return: An iterator like instance of either AgentPool or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_09_01.models.AgentPoolListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_09_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -94,16 +104,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -119,10 +124,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -132,54 +135,45 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore @distributed_trace_async async def get( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPool: """Gets the agent pool. Gets the details of the agent pool by managed cluster and resource group. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPool, or the result of cls(response) + :return: AgentPool or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_09_01.models.AgentPool - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -187,57 +181,60 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore async def _create_or_update_initial( self, resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: _models.AgentPool, + parameters: Union[_models.AgentPool, IO], **kwargs: Any ) -> _models.AgentPool: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - _json = self._serialize.body(parameters, 'AgentPool') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "AgentPool") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -245,10 +242,9 @@ async def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -256,40 +252,127 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - @distributed_trace_async + @overload async def begin_create_or_update( self, resource_group_name: str, resource_name: str, agent_pool_name: str, parameters: _models.AgentPool, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.AgentPool]: """Creates or updates an agent pool. Creates or updates an agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :param parameters: Parameters supplied to the Create or Update an agent pool operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2020_09_01.models.AgentPool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AgentPool or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_09_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AgentPool]: + """Creates or updates an agent pool. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: Parameters supplied to the Create or Update an agent pool operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AgentPool or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_09_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: Union[_models.AgentPool, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.AgentPool]: + """Creates or updates an agent pool. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: Parameters supplied to the Create or Update an agent pool operation. Is + either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2020_09_01.models.AgentPool or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -302,20 +385,17 @@ async def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_09_01.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -324,66 +404,55 @@ async def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -391,10 +460,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -404,26 +472,21 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + async def begin_delete( + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes an agent pool. Deletes the agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -435,100 +498,86 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace_async async def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPoolUpgradeProfile: """Gets upgrade profile for an agent pool. Gets the details of the upgrade profile for an agent pool with a specified resource group and managed cluster name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolUpgradeProfile, or the result of cls(response) + :return: AgentPoolUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_09_01.models.AgentPoolUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -536,64 +585,56 @@ async def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolUpgradeProfile', pipeline_response) + deserialized = self._deserialize("AgentPoolUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore @distributed_trace_async async def get_available_agent_pool_versions( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported versions for the specified agent pool. Gets a list of supported versions for the specified agent pool. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolAvailableVersions, or the result of cls(response) + :return: AgentPoolAvailableVersions or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_09_01.models.AgentPoolAvailableVersions - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolAvailableVersions] - request = build_get_available_agent_pool_versions_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_available_agent_pool_versions.metadata['url'], + template_url=self.get_available_agent_pool_versions.metadata["url"], headers=_headers, params=_params, ) @@ -601,52 +642,43 @@ async def get_available_agent_pool_versions( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolAvailableVersions', pipeline_response) + deserialized = self._deserialize("AgentPoolAvailableVersions", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_available_agent_pool_versions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore - + get_available_agent_pool_versions.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore async def _upgrade_node_image_version_initial( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> Optional[_models.AgentPool]: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.AgentPool]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.AgentPool]] - - request = build_upgrade_node_image_version_request_initial( - subscription_id=self._config.subscription_id, + request = build_upgrade_node_image_version_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._upgrade_node_image_version_initial.metadata['url'], + template_url=self._upgrade_node_image_version_initial.metadata["url"], headers=_headers, params=_params, ) @@ -654,10 +686,9 @@ async def _upgrade_node_image_version_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -666,33 +697,28 @@ async def _upgrade_node_image_version_initial( deserialized = None if response.status_code == 202: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _upgrade_node_image_version_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore - + _upgrade_node_image_version_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore @distributed_trace_async async def begin_upgrade_node_image_version( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any - ) -> AsyncLROPoller[_models.AgentPool]: + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: """Upgrade node image version of an agent pool to the latest. Upgrade node image version of an agent pool to the latest. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -706,55 +732,48 @@ async def begin_upgrade_node_image_version( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_09_01.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._upgrade_node_image_version_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_upgrade_node_image_version.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore + begin_upgrade_node_image_version.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/aio/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/aio/operations/_managed_clusters_operations.py index b623c811741a..6724e49f1f9f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/aio/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/aio/operations/_managed_clusters_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +29,29 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._managed_clusters_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_access_profile_request, build_get_request, build_get_upgrade_profile_request, build_list_by_resource_group_request, build_list_cluster_admin_credentials_request, build_list_cluster_monitoring_user_credentials_request, build_list_cluster_user_credentials_request, build_list_request, build_reset_aad_profile_request_initial, build_reset_service_principal_profile_request_initial, build_rotate_cluster_certificates_request_initial, build_start_request_initial, build_stop_request_initial, build_update_tags_request_initial -T = TypeVar('T') +from ...operations._managed_clusters_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_access_profile_request, + build_get_request, + build_get_upgrade_profile_request, + build_list_by_resource_group_request, + build_list_cluster_admin_credentials_request, + build_list_cluster_monitoring_user_credentials_request, + build_list_cluster_user_credentials_request, + build_list_request, + build_reset_aad_profile_request, + build_reset_service_principal_profile_request, + build_rotate_cluster_certificates_request, + build_start_request, + build_stop_request, + build_update_tags_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class ManagedClustersOperations: # pylint: disable=too-many-public-methods """ .. warning:: @@ -45,41 +71,35 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.ManagedClusterListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.ManagedCluster"]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. The operation returns properties of each managed cluster. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_09_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_09_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -87,14 +107,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -110,10 +127,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -123,50 +138,44 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.ManagedClusterListResult]: + self, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ManagedCluster"]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. The operation returns properties of each managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_09_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_09_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -174,15 +183,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -198,10 +203,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -211,51 +214,43 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace_async async def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.ManagedClusterUpgradeProfile: """Gets upgrade profile for a managed cluster. Gets the details of the upgrade profile for a managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterUpgradeProfile, or the result of cls(response) + :return: ManagedClusterUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_09_01.models.ManagedClusterUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -263,33 +258,27 @@ async def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterUpgradeProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore @distributed_trace_async async def get_access_profile( - self, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, role_name: str, **kwargs: Any ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. @@ -300,36 +289,33 @@ async def get_access_profile( `ListClusterAdminCredentials `_ . - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param role_name: The name of the role for managed cluster accessProfile resource. + :param role_name: The name of the role for managed cluster accessProfile resource. Required. :type role_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterAccessProfile, or the result of cls(response) + :return: ManagedClusterAccessProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_09_01.models.ManagedClusterAccessProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterAccessProfile] - request = build_get_access_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, role_name=role_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_access_profile.metadata['url'], + template_url=self.get_access_profile.metadata["url"], headers=_headers, params=_params, ) @@ -337,64 +323,56 @@ async def get_access_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterAccessProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterAccessProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_access_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore - + get_access_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore @distributed_trace_async async def list_cluster_admin_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster admin credential of a managed cluster. Gets cluster admin credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_09_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_admin_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_admin_credentials.metadata['url'], + template_url=self.list_cluster_admin_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -402,64 +380,56 @@ async def list_cluster_admin_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_admin_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore - + list_cluster_admin_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore @distributed_trace_async async def list_cluster_user_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster user credential of a managed cluster. Gets cluster user credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_09_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_user_credentials.metadata['url'], + template_url=self.list_cluster_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -467,65 +437,57 @@ async def list_cluster_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore - + list_cluster_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore @distributed_trace_async async def list_cluster_monitoring_user_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster monitoring user credential of a managed cluster. Gets cluster monitoring user credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_09_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_monitoring_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + template_url=self.list_cluster_monitoring_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -533,64 +495,54 @@ async def list_cluster_monitoring_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_monitoring_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore - + list_cluster_monitoring_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore @distributed_trace_async - async def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.ManagedCluster: + async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.ManagedCluster: """Gets a managed cluster. Gets the details of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedCluster, or the result of cls(response) + :return: ManagedCluster or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_09_01.models.ManagedCluster - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -598,55 +550,54 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _create_or_update_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.ManagedCluster, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'ManagedCluster') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedCluster") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -654,10 +605,9 @@ async def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -665,25 +615,26 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - @distributed_trace_async + @overload async def begin_create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedCluster, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. @@ -691,12 +642,16 @@ async def begin_create_or_update( Creates or updates a managed cluster with the specified configuration for agents and Kubernetes version. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2020_09_01.models.ManagedCluster + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -709,20 +664,91 @@ async def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_09_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster with the specified configuration for agents and Kubernetes + version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_09_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster with the specified configuration for agents and Kubernetes + version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. Is + either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2020_09_01.models.ManagedCluster or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_09_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -730,69 +756,66 @@ async def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _update_tags_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.TagsObject, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request_initial( - subscription_id=self._config.subscription_id, + request = build_update_tags_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_tags_initial.metadata['url'], + content=_content, + template_url=self._update_tags_initial.metadata["url"], headers=_headers, params=_params, ) @@ -800,44 +823,118 @@ async def _update_tags_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_tags_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _update_tags_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - @distributed_trace_async + @overload async def begin_update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates a managed cluster with the specified tags. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2020_09_01.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_09_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates a managed cluster with the specified tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_09_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates a managed cluster with the specified tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2020_09_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -850,20 +947,17 @@ async def begin_update_tags( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_09_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, @@ -871,64 +965,54 @@ async def begin_update_tags( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -936,10 +1020,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -949,23 +1032,17 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: + async def begin_delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Deletes a managed cluster. Deletes the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -977,85 +1054,83 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterServicePrincipalProfile, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterServicePrincipalProfile") - request = build_reset_service_principal_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_service_principal_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_service_principal_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_service_principal_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1063,10 +1138,9 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1076,29 +1150,33 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist if cls: return cls(pipeline_response, None, {}) - _reset_service_principal_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + _reset_service_principal_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore - - @distributed_trace_async - async def begin_reset_service_principal_profile( # pylint: disable=inconsistent-return-statements + @overload + async def begin_reset_service_principal_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterServicePrincipalProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: """Reset Service Principal Profile of a managed cluster. Update the service principal Profile for a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a - Managed Cluster. + Managed Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2020_09_01.models.ManagedClusterServicePrincipalProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -1109,20 +1187,90 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset Service Principal Profile of a managed cluster. + + Update the service principal Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a + Managed Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset Service Principal Profile of a managed cluster. + + Update the service principal Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a + Managed Cluster. Is either a model type or a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2020_09_01.models.ManagedClusterServicePrincipalProfile or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1130,67 +1278,68 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_service_principal_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + begin_reset_service_principal_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterAADProfile, + parameters: Union[_models.ManagedClusterAADProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterAADProfile") - request = build_reset_aad_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_aad_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_aad_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_aad_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1198,10 +1347,9 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1211,28 +1359,32 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta if cls: return cls(pipeline_response, None, {}) - _reset_aad_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - + _reset_aad_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - @distributed_trace_async - async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements + @overload + async def begin_reset_aad_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterAADProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: """Reset AAD Profile of a managed cluster. Update the AAD Profile for a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed - Cluster. + Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2020_09_01.models.ManagedClusterAADProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -1243,20 +1395,90 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset AAD Profile of a managed cluster. + + Update the AAD Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed + Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterAADProfile, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset AAD Profile of a managed cluster. + + Update the AAD Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed + Cluster. Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2020_09_01.models.ManagedClusterAADProfile or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1264,62 +1486,52 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_aad_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + begin_reset_aad_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_rotate_cluster_certificates_request_initial( - subscription_id=self._config.subscription_id, + request = build_rotate_cluster_certificates_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._rotate_cluster_certificates_initial.metadata['url'], + template_url=self._rotate_cluster_certificates_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1327,10 +1539,9 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1340,23 +1551,19 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- if cls: return cls(pipeline_response, None, {}) - _rotate_cluster_certificates_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore - + _rotate_cluster_certificates_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore @distributed_trace_async - async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + async def begin_rotate_cluster_certificates( + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Rotate certificates of a managed cluster. Rotate certificates of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1368,80 +1575,67 @@ async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-ret Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._rotate_cluster_certificates_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_rotate_cluster_certificates.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore + begin_rotate_cluster_certificates.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore async def _stop_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_stop_request_initial( - subscription_id=self._config.subscription_id, + request = build_stop_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._stop_initial.metadata['url'], + template_url=self._stop_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1449,10 +1643,9 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1462,23 +1655,17 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore - + _stop_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore @distributed_trace_async - async def begin_stop( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: + async def begin_stop(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Stop Managed Cluster. Stops a Running Managed Cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1490,80 +1677,67 @@ async def begin_stop( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._stop_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore + begin_stop.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore async def _start_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_start_request_initial( - subscription_id=self._config.subscription_id, + request = build_start_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._start_initial.metadata['url'], + template_url=self._start_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1571,10 +1745,9 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1584,23 +1757,17 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore - + _start_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore @distributed_trace_async - async def begin_start( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: + async def begin_start(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Start Managed Cluster. Starts a Stopped Managed Cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1612,52 +1779,45 @@ async def begin_start( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._start_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore + begin_start.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/aio/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/aio/operations/_operations.py index 313fba28651c..7dd80f14ba46 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/aio/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/aio/operations/_operations.py @@ -7,9 +7,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,9 +27,11 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._operations import build_list_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class Operations: """ .. warning:: @@ -42,36 +51,31 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.OperationListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.OperationValue"]: """Gets a list of compute operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationListResult or the result of cls(response) + :return: An iterator like instance of either OperationValue or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_09_01.models.OperationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_09_01.models.OperationValue] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -79,13 +83,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -101,10 +103,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -114,8 +114,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.ContainerService/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ContainerService/operations"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/aio/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/aio/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/aio/operations/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/aio/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/aio/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/aio/operations/_private_endpoint_connections_operations.py index 175d745992d5..eef1fc2a07be 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/aio/operations/_private_endpoint_connections_operations.py @@ -6,9 +6,15 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -20,10 +26,17 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._private_endpoint_connections_operations import build_delete_request_initial, build_get_request, build_list_request, build_update_request -T = TypeVar('T') +from ...operations._private_endpoint_connections_operations import ( + build_delete_request, + build_get_request, + build_list_request, + build_update_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class PrivateEndpointConnectionsOperations: """ .. warning:: @@ -43,46 +56,39 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async async def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnectionListResult: """Gets a list of private endpoint connections in the specified managed cluster. Gets a list of private endpoint connections in the specified managed cluster. The operation returns properties of each private endpoint connection. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnectionListResult, or the result of cls(response) + :return: PrivateEndpointConnectionListResult or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_09_01.models.PrivateEndpointConnectionListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnectionListResult] - request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -90,68 +96,59 @@ async def list( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore - + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore @distributed_trace_async async def get( - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnection: """Gets the private endpoint connection. Gets the details of the private endpoint connection by managed cluster and resource group. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_09_01.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -159,75 +156,149 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - - @distributed_trace_async + @overload async def update( self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, parameters: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateEndpointConnection: """Updates a private endpoint connection. Updates a private endpoint connection in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :param parameters: Parameters supplied to the Update a private endpoint connection operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2020_09_01.models.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_09_01.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + async def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: Parameters supplied to the Update a private endpoint connection operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2020_09_01.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: Union[_models.PrivateEndpointConnection, IO], + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: Parameters supplied to the Update a private endpoint connection operation. + Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2020_09_01.models.PrivateEndpointConnection or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2020_09_01.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - _json = self._serialize.body(parameters, 'PrivateEndpointConnection') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateEndpointConnection") request = build_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update.metadata['url'], + content=_content, + template_url=self.update.metadata["url"], headers=_headers, params=_params, ) @@ -235,52 +306,43 @@ async def update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -288,10 +350,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -301,26 +362,21 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + async def begin_delete( + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes a private endpoint connection. Deletes the private endpoint connection in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -332,53 +388,46 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/aio/operations/_private_link_resources_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/aio/operations/_private_link_resources_operations.py index d507c5d4248a..9476386405e2 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/aio/operations/_private_link_resources_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/aio/operations/_private_link_resources_operations.py @@ -8,7 +8,13 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -19,9 +25,11 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._private_link_resources_operations import build_list_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class PrivateLinkResourcesOperations: """ .. warning:: @@ -41,46 +49,39 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async async def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.PrivateLinkResourcesListResult: """Gets a list of private link resources in the specified managed cluster. Gets a list of private link resources in the specified managed cluster. The operation returns properties of each private link resource. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResourcesListResult, or the result of cls(response) + :return: PrivateLinkResourcesListResult or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_09_01.models.PrivateLinkResourcesListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResourcesListResult] - request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -88,22 +89,20 @@ async def list( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResourcesListResult', pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources"} # type: ignore - + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/aio/operations/_resolve_private_link_service_id_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/aio/operations/_resolve_private_link_service_id_operations.py index 49ebedef0dd1..3d5d7fe9f480 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/aio/operations/_resolve_private_link_service_id_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/aio/operations/_resolve_private_link_service_id_operations.py @@ -6,9 +6,15 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -19,9 +25,11 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._resolve_private_link_service_id_operations import build_post_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class ResolvePrivateLinkServiceIdOperations: """ .. warning:: @@ -41,53 +49,120 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async + @overload async def post( self, resource_group_name: str, resource_name: str, parameters: _models.PrivateLinkResource, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateLinkResource: """Gets the private link service ID for the specified managed cluster. Gets the private link service ID the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters (name, groupId) supplied in order to resolve a private link - service ID. + service ID. Required. :type parameters: ~azure.mgmt.containerservice.v2020_09_01.models.PrivateLinkResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2020_09_01.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def post( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters (name, groupId) supplied in order to resolve a private link + service ID. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResource, or the result of cls(response) + :return: PrivateLinkResource or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_09_01.models.PrivateLinkResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @distributed_trace_async + async def post( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.PrivateLinkResource, IO], + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters (name, groupId) supplied in order to resolve a private link + service ID. Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2020_09_01.models.PrivateLinkResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2020_09_01.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResource] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResource] - _json = self._serialize.body(parameters, 'PrivateLinkResource') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateLinkResource") request = build_post_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.post.metadata['url'], + content=_content, + template_url=self.post.metadata["url"], headers=_headers, params=_params, ) @@ -95,22 +170,20 @@ async def post( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResource', pipeline_response) + deserialized = self._deserialize("PrivateLinkResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - post.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId"} # type: ignore - + post.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/models/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/models/__init__.py index 2d917ca249da..53c75d6ca4a2 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/models/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/models/__init__.py @@ -62,112 +62,110 @@ from ._models_py3 import TagsObject from ._models_py3 import UserAssignedIdentity - -from ._container_service_client_enums import ( - AgentPoolMode, - AgentPoolType, - Code, - ConnectionStatus, - ContainerServiceStorageProfileTypes, - ContainerServiceVMSizeTypes, - Count, - Expander, - LicenseType, - LoadBalancerSku, - ManagedClusterSKUName, - ManagedClusterSKUTier, - NetworkMode, - NetworkPlugin, - NetworkPolicy, - OSDiskType, - OSType, - OutboundType, - PrivateEndpointConnectionProvisioningState, - ResourceIdentityType, - ScaleSetEvictionPolicy, - ScaleSetPriority, -) +from ._container_service_client_enums import AgentPoolMode +from ._container_service_client_enums import AgentPoolType +from ._container_service_client_enums import Code +from ._container_service_client_enums import ConnectionStatus +from ._container_service_client_enums import ContainerServiceStorageProfileTypes +from ._container_service_client_enums import ContainerServiceVMSizeTypes +from ._container_service_client_enums import Count +from ._container_service_client_enums import Expander +from ._container_service_client_enums import LicenseType +from ._container_service_client_enums import LoadBalancerSku +from ._container_service_client_enums import ManagedClusterSKUName +from ._container_service_client_enums import ManagedClusterSKUTier +from ._container_service_client_enums import NetworkMode +from ._container_service_client_enums import NetworkPlugin +from ._container_service_client_enums import NetworkPolicy +from ._container_service_client_enums import OSDiskType +from ._container_service_client_enums import OSType +from ._container_service_client_enums import OutboundType +from ._container_service_client_enums import PrivateEndpointConnectionProvisioningState +from ._container_service_client_enums import ResourceIdentityType +from ._container_service_client_enums import ScaleSetEvictionPolicy +from ._container_service_client_enums import ScaleSetPriority from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'AgentPool', - 'AgentPoolAvailableVersions', - 'AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem', - 'AgentPoolListResult', - 'AgentPoolUpgradeProfile', - 'AgentPoolUpgradeProfilePropertiesUpgradesItem', - 'AgentPoolUpgradeSettings', - 'BaseManagedCluster', - 'CloudErrorBody', - 'ContainerServiceDiagnosticsProfile', - 'ContainerServiceLinuxProfile', - 'ContainerServiceMasterProfile', - 'ContainerServiceNetworkProfile', - 'ContainerServiceSshConfiguration', - 'ContainerServiceSshPublicKey', - 'ContainerServiceVMDiagnostics', - 'CredentialResult', - 'CredentialResults', - 'ManagedCluster', - 'ManagedClusterAADProfile', - 'ManagedClusterAPIServerAccessProfile', - 'ManagedClusterAccessProfile', - 'ManagedClusterAddonProfile', - 'ManagedClusterAddonProfileIdentity', - 'ManagedClusterAgentPoolProfile', - 'ManagedClusterAgentPoolProfileProperties', - 'ManagedClusterIdentity', - 'ManagedClusterIdentityUserAssignedIdentitiesValue', - 'ManagedClusterListResult', - 'ManagedClusterLoadBalancerProfile', - 'ManagedClusterLoadBalancerProfileManagedOutboundIPs', - 'ManagedClusterLoadBalancerProfileOutboundIPPrefixes', - 'ManagedClusterLoadBalancerProfileOutboundIPs', - 'ManagedClusterPoolUpgradeProfile', - 'ManagedClusterPoolUpgradeProfileUpgradesItem', - 'ManagedClusterPropertiesAutoScalerProfile', - 'ManagedClusterPropertiesIdentityProfileValue', - 'ManagedClusterSKU', - 'ManagedClusterServicePrincipalProfile', - 'ManagedClusterUpgradeProfile', - 'ManagedClusterWindowsProfile', - 'OperationListResult', - 'OperationValue', - 'PowerState', - 'PrivateEndpoint', - 'PrivateEndpointConnection', - 'PrivateEndpointConnectionListResult', - 'PrivateLinkResource', - 'PrivateLinkResourcesListResult', - 'PrivateLinkServiceConnectionState', - 'Resource', - 'ResourceReference', - 'SubResource', - 'TagsObject', - 'UserAssignedIdentity', - 'AgentPoolMode', - 'AgentPoolType', - 'Code', - 'ConnectionStatus', - 'ContainerServiceStorageProfileTypes', - 'ContainerServiceVMSizeTypes', - 'Count', - 'Expander', - 'LicenseType', - 'LoadBalancerSku', - 'ManagedClusterSKUName', - 'ManagedClusterSKUTier', - 'NetworkMode', - 'NetworkPlugin', - 'NetworkPolicy', - 'OSDiskType', - 'OSType', - 'OutboundType', - 'PrivateEndpointConnectionProvisioningState', - 'ResourceIdentityType', - 'ScaleSetEvictionPolicy', - 'ScaleSetPriority', + "AgentPool", + "AgentPoolAvailableVersions", + "AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem", + "AgentPoolListResult", + "AgentPoolUpgradeProfile", + "AgentPoolUpgradeProfilePropertiesUpgradesItem", + "AgentPoolUpgradeSettings", + "BaseManagedCluster", + "CloudErrorBody", + "ContainerServiceDiagnosticsProfile", + "ContainerServiceLinuxProfile", + "ContainerServiceMasterProfile", + "ContainerServiceNetworkProfile", + "ContainerServiceSshConfiguration", + "ContainerServiceSshPublicKey", + "ContainerServiceVMDiagnostics", + "CredentialResult", + "CredentialResults", + "ManagedCluster", + "ManagedClusterAADProfile", + "ManagedClusterAPIServerAccessProfile", + "ManagedClusterAccessProfile", + "ManagedClusterAddonProfile", + "ManagedClusterAddonProfileIdentity", + "ManagedClusterAgentPoolProfile", + "ManagedClusterAgentPoolProfileProperties", + "ManagedClusterIdentity", + "ManagedClusterIdentityUserAssignedIdentitiesValue", + "ManagedClusterListResult", + "ManagedClusterLoadBalancerProfile", + "ManagedClusterLoadBalancerProfileManagedOutboundIPs", + "ManagedClusterLoadBalancerProfileOutboundIPPrefixes", + "ManagedClusterLoadBalancerProfileOutboundIPs", + "ManagedClusterPoolUpgradeProfile", + "ManagedClusterPoolUpgradeProfileUpgradesItem", + "ManagedClusterPropertiesAutoScalerProfile", + "ManagedClusterPropertiesIdentityProfileValue", + "ManagedClusterSKU", + "ManagedClusterServicePrincipalProfile", + "ManagedClusterUpgradeProfile", + "ManagedClusterWindowsProfile", + "OperationListResult", + "OperationValue", + "PowerState", + "PrivateEndpoint", + "PrivateEndpointConnection", + "PrivateEndpointConnectionListResult", + "PrivateLinkResource", + "PrivateLinkResourcesListResult", + "PrivateLinkServiceConnectionState", + "Resource", + "ResourceReference", + "SubResource", + "TagsObject", + "UserAssignedIdentity", + "AgentPoolMode", + "AgentPoolType", + "Code", + "ConnectionStatus", + "ContainerServiceStorageProfileTypes", + "ContainerServiceVMSizeTypes", + "Count", + "Expander", + "LicenseType", + "LoadBalancerSku", + "ManagedClusterSKUName", + "ManagedClusterSKUTier", + "NetworkMode", + "NetworkPlugin", + "NetworkPolicy", + "OSDiskType", + "OSType", + "OutboundType", + "PrivateEndpointConnectionProvisioningState", + "ResourceIdentityType", + "ScaleSetEvictionPolicy", + "ScaleSetPriority", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/models/_container_service_client_enums.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/models/_container_service_client_enums.py index dd728798c217..e4ecbc6d6f60 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/models/_container_service_client_enums.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/models/_container_service_client_enums.py @@ -11,35 +11,35 @@ class AgentPoolMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """AgentPoolMode represents mode of an agent pool. - """ + """AgentPoolMode represents mode of an agent pool.""" SYSTEM = "System" USER = "User" + class AgentPoolType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """AgentPoolType represents types of an agent pool. - """ + """AgentPoolType represents types of an agent pool.""" VIRTUAL_MACHINE_SCALE_SETS = "VirtualMachineScaleSets" AVAILABILITY_SET = "AvailabilitySet" + class Code(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Tells whether the cluster is Running or Stopped - """ + """Tells whether the cluster is Running or Stopped.""" RUNNING = "Running" STOPPED = "Stopped" + class ConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The private link service connection status. - """ + """The private link service connection status.""" PENDING = "Pending" APPROVED = "Approved" REJECTED = "Rejected" DISCONNECTED = "Disconnected" + class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the orchestrator choice. @@ -48,9 +48,9 @@ class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEn STORAGE_ACCOUNT = "StorageAccount" MANAGED_DISKS = "ManagedDisks" + class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Size of agent VMs. - """ + """Size of agent VMs.""" STANDARD_A1 = "Standard_A1" STANDARD_A10 = "Standard_A10" @@ -227,6 +227,7 @@ class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): STANDARD_NV24 = "Standard_NV24" STANDARD_NV6 = "Standard_NV6" + class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): """Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, and 5. The default value is 1. @@ -236,12 +237,15 @@ class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): THREE = 3 FIVE = 5 + class Expander(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Expander.""" LEAST_WASTE = "least-waste" MOST_PODS = "most-pods" RANDOM = "random" + class LicenseType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The licenseType to use for Windows VMs. Windows_Server is used to enable Azure Hybrid User Benefits for Windows VMs. @@ -250,77 +254,78 @@ class LicenseType(str, Enum, metaclass=CaseInsensitiveEnumMeta): NONE = "None" WINDOWS_SERVER = "Windows_Server" + class LoadBalancerSku(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The load balancer sku for the managed cluster. - """ + """The load balancer sku for the managed cluster.""" STANDARD = "standard" BASIC = "basic" + class ManagedClusterSKUName(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Name of a managed cluster SKU. - """ + """Name of a managed cluster SKU.""" BASIC = "Basic" + class ManagedClusterSKUTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Tier of a managed cluster SKU. - """ + """Tier of a managed cluster SKU.""" PAID = "Paid" FREE = "Free" + class NetworkMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Network mode used for building Kubernetes network. - """ + """Network mode used for building Kubernetes network.""" TRANSPARENT = "transparent" BRIDGE = "bridge" + class NetworkPlugin(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Network plugin used for building Kubernetes network. - """ + """Network plugin used for building Kubernetes network.""" AZURE = "azure" KUBENET = "kubenet" + class NetworkPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Network policy used for building Kubernetes network. - """ + """Network policy used for building Kubernetes network.""" CALICO = "calico" AZURE = "azure" + class OSDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """OSDiskType represents the type of an OS disk on an agent pool. - """ + """OSDiskType represents the type of an OS disk on an agent pool.""" MANAGED = "Managed" EPHEMERAL = "Ephemeral" + class OSType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """OsType to be used to specify os type. Choose from Linux and Windows. Default to Linux. - """ + """OsType to be used to specify os type. Choose from Linux and Windows. Default to Linux.""" LINUX = "Linux" WINDOWS = "Windows" + class OutboundType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The outbound (egress) routing method. - """ + """The outbound (egress) routing method.""" LOAD_BALANCER = "loadBalancer" USER_DEFINED_ROUTING = "userDefinedRouting" + class PrivateEndpointConnectionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The current provisioning state. - """ + """The current provisioning state.""" SUCCEEDED = "Succeeded" CREATING = "Creating" DELETING = "Deleting" FAILED = "Failed" + class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of identity used for the managed cluster. Type 'SystemAssigned' will use an implicitly created identity in master components and an auto-created user assigned identity in MC_ @@ -332,6 +337,7 @@ class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): USER_ASSIGNED = "UserAssigned" NONE = "None" + class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ScaleSetEvictionPolicy to be used to specify eviction policy for Spot virtual machine scale set. Default to Delete. @@ -340,9 +346,9 @@ class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): DELETE = "Delete" DEALLOCATE = "Deallocate" + class ScaleSetPriority(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """ScaleSetPriority to be used to specify virtual machine scale set priority. Default to regular. - """ + """ScaleSetPriority to be used to specify virtual machine scale set priority. Default to regular.""" SPOT = "Spot" REGULAR = "Regular" diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/models/_models_py3.py index c544b912e67e..16d108b2b88b 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/models/_models_py3.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/models/_models_py3.py @@ -1,4 +1,5 @@ # coding=utf-8 +# pylint: disable=too-many-lines # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -8,14 +9,14 @@ from typing import Dict, List, Optional, TYPE_CHECKING, Union -import msrest.serialization +from ... import _serialization if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - import __init__ as _models + from .. import models as _models -class SubResource(msrest.serialization.Model): +class SubResource(_serialization.Model): """Reference to another subresource. Variables are only populated by the server, and will be ignored when sending a request. @@ -30,30 +31,26 @@ class SubResource(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(SubResource, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.id = None self.name = None self.type = None -class AgentPool(SubResource): +class AgentPool(SubResource): # pylint: disable=too-many-instance-attributes """Agent Pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -106,7 +103,7 @@ class AgentPool(SubResource): "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :vartype vm_size: str or ~azure.mgmt.containerservice.v2020_09_01.models.ContainerServiceVMSizeTypes :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine @@ -115,14 +112,14 @@ class AgentPool(SubResource): :vartype os_disk_size_gb: int :ivar os_disk_type: OS disk type to be used for machines in a given agent pool. Allowed values are 'Ephemeral' and 'Managed'. Defaults to 'Managed'. May not be changed after creation. Known - values are: "Managed", "Ephemeral". + values are: "Managed" and "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2020_09_01.models.OSDiskType :ivar vnet_subnet_id: VNet SubnetID specifies the VNet's subnet identifier. :vartype vnet_subnet_id: str :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Known values are: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux" and "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2020_09_01.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -131,10 +128,11 @@ class AgentPool(SubResource): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar type_properties_type: AgentPoolType represents types of an agent pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :vartype type_properties_type: str or ~azure.mgmt.containerservice.v2020_09_01.models.AgentPoolType - :ivar mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", "User". + :ivar mode: AgentPoolMode represents mode of an agent pool. Known values are: "System" and + "User". :vartype mode: str or ~azure.mgmt.containerservice.v2020_09_01.models.AgentPoolMode :ivar orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -155,20 +153,19 @@ class AgentPool(SubResource): :ivar enable_node_public_ip: Enable public IP for nodes. :vartype enable_node_public_ip: bool :ivar scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Known values are: "Spot", "Regular". Default value: "Regular". + priority. Default to regular. Known values are: "Spot" and "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_09_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy - for Spot virtual machine scale set. Default to Delete. Known values are: "Delete", - "Deallocate". Default value: "Delete". + for Spot virtual machine scale set. Default to Delete. Known values are: "Delete" and + "Deallocate". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_09_01.models.ScaleSetEvictionPolicy :ivar spot_max_price: SpotMaxPrice to be used to specify the maximum price you are willing to pay in US Dollars. Possible values are any decimal value greater than zero or -1 which indicates default price to be up-to on-demand. :vartype spot_max_price: float - :ivar tags: A set of tags. Agent pool tags to be persisted on the agent pool virtual machine - scale set. + :ivar tags: Agent pool tags to be persisted on the agent pool virtual machine scale set. :vartype tags: dict[str, str] :ivar node_labels: Agent pool node labels to be persisted across all nodes in agent pool. :vartype node_labels: dict[str, str] @@ -180,48 +177,48 @@ class AgentPool(SubResource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'os_disk_size_gb': {'maximum': 1023, 'minimum': 0}, - 'node_image_version': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'power_state': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "os_disk_size_gb": {"maximum": 1023, "minimum": 0}, + "node_image_version": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "power_state": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'count': {'key': 'properties.count', 'type': 'int'}, - 'vm_size': {'key': 'properties.vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'properties.osDiskSizeGB', 'type': 'int'}, - 'os_disk_type': {'key': 'properties.osDiskType', 'type': 'str'}, - 'vnet_subnet_id': {'key': 'properties.vnetSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'properties.maxPods', 'type': 'int'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'max_count': {'key': 'properties.maxCount', 'type': 'int'}, - 'min_count': {'key': 'properties.minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'properties.enableAutoScaling', 'type': 'bool'}, - 'type_properties_type': {'key': 'properties.type', 'type': 'str'}, - 'mode': {'key': 'properties.mode', 'type': 'str'}, - 'orchestrator_version': {'key': 'properties.orchestratorVersion', 'type': 'str'}, - 'node_image_version': {'key': 'properties.nodeImageVersion', 'type': 'str'}, - 'upgrade_settings': {'key': 'properties.upgradeSettings', 'type': 'AgentPoolUpgradeSettings'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'power_state': {'key': 'properties.powerState', 'type': 'PowerState'}, - 'availability_zones': {'key': 'properties.availabilityZones', 'type': '[str]'}, - 'enable_node_public_ip': {'key': 'properties.enableNodePublicIP', 'type': 'bool'}, - 'scale_set_priority': {'key': 'properties.scaleSetPriority', 'type': 'str'}, - 'scale_set_eviction_policy': {'key': 'properties.scaleSetEvictionPolicy', 'type': 'str'}, - 'spot_max_price': {'key': 'properties.spotMaxPrice', 'type': 'float'}, - 'tags': {'key': 'properties.tags', 'type': '{str}'}, - 'node_labels': {'key': 'properties.nodeLabels', 'type': '{str}'}, - 'node_taints': {'key': 'properties.nodeTaints', 'type': '[str]'}, - 'proximity_placement_group_id': {'key': 'properties.proximityPlacementGroupID', 'type': 'str'}, - } - - def __init__( + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "count": {"key": "properties.count", "type": "int"}, + "vm_size": {"key": "properties.vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "properties.osDiskSizeGB", "type": "int"}, + "os_disk_type": {"key": "properties.osDiskType", "type": "str"}, + "vnet_subnet_id": {"key": "properties.vnetSubnetID", "type": "str"}, + "max_pods": {"key": "properties.maxPods", "type": "int"}, + "os_type": {"key": "properties.osType", "type": "str"}, + "max_count": {"key": "properties.maxCount", "type": "int"}, + "min_count": {"key": "properties.minCount", "type": "int"}, + "enable_auto_scaling": {"key": "properties.enableAutoScaling", "type": "bool"}, + "type_properties_type": {"key": "properties.type", "type": "str"}, + "mode": {"key": "properties.mode", "type": "str"}, + "orchestrator_version": {"key": "properties.orchestratorVersion", "type": "str"}, + "node_image_version": {"key": "properties.nodeImageVersion", "type": "str"}, + "upgrade_settings": {"key": "properties.upgradeSettings", "type": "AgentPoolUpgradeSettings"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "power_state": {"key": "properties.powerState", "type": "PowerState"}, + "availability_zones": {"key": "properties.availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "properties.enableNodePublicIP", "type": "bool"}, + "scale_set_priority": {"key": "properties.scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "properties.scaleSetEvictionPolicy", "type": "str"}, + "spot_max_price": {"key": "properties.spotMaxPrice", "type": "float"}, + "tags": {"key": "properties.tags", "type": "{str}"}, + "node_labels": {"key": "properties.nodeLabels", "type": "{str}"}, + "node_taints": {"key": "properties.nodeTaints", "type": "[str]"}, + "proximity_placement_group_id": {"key": "properties.proximityPlacementGroupID", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, count: Optional[int] = None, @@ -230,7 +227,7 @@ def __init__( os_disk_type: Optional[Union[str, "_models.OSDiskType"]] = None, vnet_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, @@ -240,9 +237,9 @@ def __init__( upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, - scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", - spot_max_price: Optional[float] = -1, + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", + spot_max_price: float = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, @@ -291,7 +288,7 @@ def __init__( "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :paramtype vm_size: str or ~azure.mgmt.containerservice.v2020_09_01.models.ContainerServiceVMSizeTypes :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every @@ -300,14 +297,14 @@ def __init__( :paramtype os_disk_size_gb: int :keyword os_disk_type: OS disk type to be used for machines in a given agent pool. Allowed values are 'Ephemeral' and 'Managed'. Defaults to 'Managed'. May not be changed after creation. - Known values are: "Managed", "Ephemeral". + Known values are: "Managed" and "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2020_09_01.models.OSDiskType :keyword vnet_subnet_id: VNet SubnetID specifies the VNet's subnet identifier. :paramtype vnet_subnet_id: str :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux" and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2020_09_01.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -316,10 +313,10 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword type_properties_type: AgentPoolType represents types of an agent pool. Known values - are: "VirtualMachineScaleSets", "AvailabilitySet". + are: "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type_properties_type: str or ~azure.mgmt.containerservice.v2020_09_01.models.AgentPoolType - :keyword mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", + :keyword mode: AgentPoolMode represents mode of an agent pool. Known values are: "System" and "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2020_09_01.models.AgentPoolMode :keyword orchestrator_version: Version of orchestrator specified when creating the managed @@ -334,20 +331,19 @@ def __init__( :keyword enable_node_public_ip: Enable public IP for nodes. :paramtype enable_node_public_ip: bool :keyword scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Known values are: "Spot", "Regular". Default value: "Regular". + priority. Default to regular. Known values are: "Spot" and "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_09_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction - policy for Spot virtual machine scale set. Default to Delete. Known values are: "Delete", - "Deallocate". Default value: "Delete". + policy for Spot virtual machine scale set. Default to Delete. Known values are: "Delete" and + "Deallocate". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_09_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: SpotMaxPrice to be used to specify the maximum price you are willing to pay in US Dollars. Possible values are any decimal value greater than zero or -1 which indicates default price to be up-to on-demand. :paramtype spot_max_price: float - :keyword tags: A set of tags. Agent pool tags to be persisted on the agent pool virtual machine - scale set. + :keyword tags: Agent pool tags to be persisted on the agent pool virtual machine scale set. :paramtype tags: dict[str, str] :keyword node_labels: Agent pool node labels to be persisted across all nodes in agent pool. :paramtype node_labels: dict[str, str] @@ -357,7 +353,7 @@ def __init__( :keyword proximity_placement_group_id: The ID for Proximity Placement Group. :paramtype proximity_placement_group_id: str """ - super(AgentPool, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.vm_size = vm_size self.os_disk_size_gb = os_disk_size_gb @@ -386,7 +382,7 @@ def __init__( self.proximity_placement_group_id = proximity_placement_group_id -class AgentPoolAvailableVersions(msrest.serialization.Model): +class AgentPoolAvailableVersions(_serialization.Model): """The list of available versions for an agent pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -403,16 +399,19 @@ class AgentPoolAvailableVersions(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'agent_pool_versions': {'key': 'properties.agentPoolVersions', 'type': '[AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "agent_pool_versions": { + "key": "properties.agentPoolVersions", + "type": "[AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem]", + }, } def __init__( @@ -426,14 +425,14 @@ def __init__( :paramtype agent_pool_versions: list[~azure.mgmt.containerservice.v2020_09_01.models.AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem] """ - super(AgentPoolAvailableVersions, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None self.agent_pool_versions = agent_pool_versions -class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(msrest.serialization.Model): +class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(_serialization.Model): """AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem. :ivar default: Whether this version is the default agent pool version. @@ -445,9 +444,9 @@ class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(msrest.serializa """ _attribute_map = { - 'default': {'key': 'default', 'type': 'bool'}, - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "default": {"key": "default", "type": "bool"}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } def __init__( @@ -466,13 +465,13 @@ def __init__( :keyword is_preview: Whether Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.default = default self.kubernetes_version = kubernetes_version self.is_preview = is_preview -class AgentPoolListResult(msrest.serialization.Model): +class AgentPoolListResult(_serialization.Model): """The response from the List Agent Pools operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -484,30 +483,25 @@ class AgentPoolListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[AgentPool]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[AgentPool]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.AgentPool"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.AgentPool"]] = None, **kwargs): """ :keyword value: The list of agent pools. :paramtype value: list[~azure.mgmt.containerservice.v2020_09_01.models.AgentPool] """ - super(AgentPoolListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class AgentPoolUpgradeProfile(msrest.serialization.Model): +class AgentPoolUpgradeProfile(_serialization.Model): """The list of available upgrades for an agent pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -520,10 +514,10 @@ class AgentPoolUpgradeProfile(msrest.serialization.Model): :vartype name: str :ivar type: Type of the agent pool upgrade profile. :vartype type: str - :ivar kubernetes_version: Required. Kubernetes version (major, minor, patch). + :ivar kubernetes_version: Kubernetes version (major, minor, patch). Required. :vartype kubernetes_version: str - :ivar os_type: Required. OsType to be used to specify os type. Choose from Linux and Windows. - Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to + Linux. Known values are: "Linux" and "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2020_09_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -534,21 +528,21 @@ class AgentPoolUpgradeProfile(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kubernetes_version': {'required': True}, - 'os_type': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "kubernetes_version": {"required": True}, + "os_type": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'kubernetes_version': {'key': 'properties.kubernetesVersion', 'type': 'str'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'upgrades': {'key': 'properties.upgrades', 'type': '[AgentPoolUpgradeProfilePropertiesUpgradesItem]'}, - 'latest_node_image_version': {'key': 'properties.latestNodeImageVersion', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "os_type": {"key": "properties.osType", "type": "str"}, + "upgrades": {"key": "properties.upgrades", "type": "[AgentPoolUpgradeProfilePropertiesUpgradesItem]"}, + "latest_node_image_version": {"key": "properties.latestNodeImageVersion", "type": "str"}, } def __init__( @@ -561,10 +555,10 @@ def __init__( **kwargs ): """ - :keyword kubernetes_version: Required. Kubernetes version (major, minor, patch). + :keyword kubernetes_version: Kubernetes version (major, minor, patch). Required. :paramtype kubernetes_version: str - :keyword os_type: Required. OsType to be used to specify os type. Choose from Linux and - Windows. Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default + to Linux. Known values are: "Linux" and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2020_09_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: @@ -573,7 +567,7 @@ def __init__( image version. :paramtype latest_node_image_version: str """ - super(AgentPoolUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -583,7 +577,7 @@ def __init__( self.latest_node_image_version = latest_node_image_version -class AgentPoolUpgradeProfilePropertiesUpgradesItem(msrest.serialization.Model): +class AgentPoolUpgradeProfilePropertiesUpgradesItem(_serialization.Model): """AgentPoolUpgradeProfilePropertiesUpgradesItem. :ivar kubernetes_version: Kubernetes version (major, minor, patch). @@ -593,29 +587,23 @@ class AgentPoolUpgradeProfilePropertiesUpgradesItem(msrest.serialization.Model): """ _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } - def __init__( - self, - *, - kubernetes_version: Optional[str] = None, - is_preview: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, kubernetes_version: Optional[str] = None, is_preview: Optional[bool] = None, **kwargs): """ :keyword kubernetes_version: Kubernetes version (major, minor, patch). :paramtype kubernetes_version: str :keyword is_preview: Whether Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(AgentPoolUpgradeProfilePropertiesUpgradesItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.is_preview = is_preview -class AgentPoolUpgradeSettings(msrest.serialization.Model): +class AgentPoolUpgradeSettings(_serialization.Model): """Settings for upgrading an agentpool. :ivar max_surge: Count or percentage of additional nodes to be added during upgrade. If empty @@ -624,25 +612,20 @@ class AgentPoolUpgradeSettings(msrest.serialization.Model): """ _attribute_map = { - 'max_surge': {'key': 'maxSurge', 'type': 'str'}, + "max_surge": {"key": "maxSurge", "type": "str"}, } - def __init__( - self, - *, - max_surge: Optional[str] = None, - **kwargs - ): + def __init__(self, *, max_surge: Optional[str] = None, **kwargs): """ :keyword max_surge: Count or percentage of additional nodes to be added during upgrade. If empty uses AKS default. :paramtype max_surge: str """ - super(AgentPoolUpgradeSettings, self).__init__(**kwargs) + super().__init__(**kwargs) self.max_surge = max_surge -class BaseManagedCluster(msrest.serialization.Model): +class BaseManagedCluster(_serialization.Model): # pylint: disable=too-many-instance-attributes """BaseManagedCluster. Variables are only populated by the server, and will be ignored when sending a request. @@ -708,36 +691,48 @@ class BaseManagedCluster(msrest.serialization.Model): """ _validation = { - 'provisioning_state': {'readonly': True}, - 'power_state': {'readonly': True}, - 'max_agent_pools': {'readonly': True}, - 'fqdn': {'readonly': True}, - 'private_fqdn': {'readonly': True}, + "provisioning_state": {"readonly": True}, + "power_state": {"readonly": True}, + "max_agent_pools": {"readonly": True}, + "fqdn": {"readonly": True}, + "private_fqdn": {"readonly": True}, } _attribute_map = { - 'identity': {'key': 'identity', 'type': 'ManagedClusterIdentity'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'power_state': {'key': 'properties.powerState', 'type': 'PowerState'}, - 'max_agent_pools': {'key': 'properties.maxAgentPools', 'type': 'int'}, - 'kubernetes_version': {'key': 'properties.kubernetesVersion', 'type': 'str'}, - 'dns_prefix': {'key': 'properties.dnsPrefix', 'type': 'str'}, - 'fqdn': {'key': 'properties.fqdn', 'type': 'str'}, - 'private_fqdn': {'key': 'properties.privateFQDN', 'type': 'str'}, - 'agent_pool_profiles': {'key': 'properties.agentPoolProfiles', 'type': '[ManagedClusterAgentPoolProfile]'}, - 'linux_profile': {'key': 'properties.linuxProfile', 'type': 'ContainerServiceLinuxProfile'}, - 'windows_profile': {'key': 'properties.windowsProfile', 'type': 'ManagedClusterWindowsProfile'}, - 'service_principal_profile': {'key': 'properties.servicePrincipalProfile', 'type': 'ManagedClusterServicePrincipalProfile'}, - 'addon_profiles': {'key': 'properties.addonProfiles', 'type': '{ManagedClusterAddonProfile}'}, - 'node_resource_group': {'key': 'properties.nodeResourceGroup', 'type': 'str'}, - 'enable_rbac': {'key': 'properties.enableRBAC', 'type': 'bool'}, - 'enable_pod_security_policy': {'key': 'properties.enablePodSecurityPolicy', 'type': 'bool'}, - 'network_profile': {'key': 'properties.networkProfile', 'type': 'ContainerServiceNetworkProfile'}, - 'aad_profile': {'key': 'properties.aadProfile', 'type': 'ManagedClusterAADProfile'}, - 'auto_scaler_profile': {'key': 'properties.autoScalerProfile', 'type': 'ManagedClusterPropertiesAutoScalerProfile'}, - 'api_server_access_profile': {'key': 'properties.apiServerAccessProfile', 'type': 'ManagedClusterAPIServerAccessProfile'}, - 'disk_encryption_set_id': {'key': 'properties.diskEncryptionSetID', 'type': 'str'}, - 'identity_profile': {'key': 'properties.identityProfile', 'type': '{ManagedClusterPropertiesIdentityProfileValue}'}, + "identity": {"key": "identity", "type": "ManagedClusterIdentity"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "power_state": {"key": "properties.powerState", "type": "PowerState"}, + "max_agent_pools": {"key": "properties.maxAgentPools", "type": "int"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "dns_prefix": {"key": "properties.dnsPrefix", "type": "str"}, + "fqdn": {"key": "properties.fqdn", "type": "str"}, + "private_fqdn": {"key": "properties.privateFQDN", "type": "str"}, + "agent_pool_profiles": {"key": "properties.agentPoolProfiles", "type": "[ManagedClusterAgentPoolProfile]"}, + "linux_profile": {"key": "properties.linuxProfile", "type": "ContainerServiceLinuxProfile"}, + "windows_profile": {"key": "properties.windowsProfile", "type": "ManagedClusterWindowsProfile"}, + "service_principal_profile": { + "key": "properties.servicePrincipalProfile", + "type": "ManagedClusterServicePrincipalProfile", + }, + "addon_profiles": {"key": "properties.addonProfiles", "type": "{ManagedClusterAddonProfile}"}, + "node_resource_group": {"key": "properties.nodeResourceGroup", "type": "str"}, + "enable_rbac": {"key": "properties.enableRBAC", "type": "bool"}, + "enable_pod_security_policy": {"key": "properties.enablePodSecurityPolicy", "type": "bool"}, + "network_profile": {"key": "properties.networkProfile", "type": "ContainerServiceNetworkProfile"}, + "aad_profile": {"key": "properties.aadProfile", "type": "ManagedClusterAADProfile"}, + "auto_scaler_profile": { + "key": "properties.autoScalerProfile", + "type": "ManagedClusterPropertiesAutoScalerProfile", + }, + "api_server_access_profile": { + "key": "properties.apiServerAccessProfile", + "type": "ManagedClusterAPIServerAccessProfile", + }, + "disk_encryption_set_id": {"key": "properties.diskEncryptionSetID", "type": "str"}, + "identity_profile": { + "key": "properties.identityProfile", + "type": "{ManagedClusterPropertiesIdentityProfileValue}", + }, } def __init__( @@ -812,7 +807,7 @@ def __init__( :paramtype identity_profile: dict[str, ~azure.mgmt.containerservice.v2020_09_01.models.ManagedClusterPropertiesIdentityProfileValue] """ - super(BaseManagedCluster, self).__init__(**kwargs) + super().__init__(**kwargs) self.identity = identity self.provisioning_state = None self.power_state = None @@ -837,7 +832,7 @@ def __init__( self.identity_profile = identity_profile -class CloudErrorBody(msrest.serialization.Model): +class CloudErrorBody(_serialization.Model): """An error response from the Container service. :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed @@ -854,10 +849,10 @@ class CloudErrorBody(msrest.serialization.Model): """ _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[CloudErrorBody]"}, } def __init__( @@ -882,87 +877,76 @@ def __init__( :keyword details: A list of additional details about the error. :paramtype details: list[~azure.mgmt.containerservice.v2020_09_01.models.CloudErrorBody] """ - super(CloudErrorBody, self).__init__(**kwargs) + super().__init__(**kwargs) self.code = code self.message = message self.target = target self.details = details -class ContainerServiceDiagnosticsProfile(msrest.serialization.Model): +class ContainerServiceDiagnosticsProfile(_serialization.Model): """Profile for diagnostics on the container service cluster. All required parameters must be populated in order to send to Azure. - :ivar vm_diagnostics: Required. Profile for diagnostics on the container service VMs. + :ivar vm_diagnostics: Profile for diagnostics on the container service VMs. Required. :vartype vm_diagnostics: ~azure.mgmt.containerservice.v2020_09_01.models.ContainerServiceVMDiagnostics """ _validation = { - 'vm_diagnostics': {'required': True}, + "vm_diagnostics": {"required": True}, } _attribute_map = { - 'vm_diagnostics': {'key': 'vmDiagnostics', 'type': 'ContainerServiceVMDiagnostics'}, + "vm_diagnostics": {"key": "vmDiagnostics", "type": "ContainerServiceVMDiagnostics"}, } - def __init__( - self, - *, - vm_diagnostics: "_models.ContainerServiceVMDiagnostics", - **kwargs - ): + def __init__(self, *, vm_diagnostics: "_models.ContainerServiceVMDiagnostics", **kwargs): """ - :keyword vm_diagnostics: Required. Profile for diagnostics on the container service VMs. + :keyword vm_diagnostics: Profile for diagnostics on the container service VMs. Required. :paramtype vm_diagnostics: ~azure.mgmt.containerservice.v2020_09_01.models.ContainerServiceVMDiagnostics """ - super(ContainerServiceDiagnosticsProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.vm_diagnostics = vm_diagnostics -class ContainerServiceLinuxProfile(msrest.serialization.Model): +class ContainerServiceLinuxProfile(_serialization.Model): """Profile for Linux VMs in the container service cluster. All required parameters must be populated in order to send to Azure. - :ivar admin_username: Required. The administrator username to use for Linux VMs. + :ivar admin_username: The administrator username to use for Linux VMs. Required. :vartype admin_username: str - :ivar ssh: Required. SSH configuration for Linux-based VMs running on Azure. + :ivar ssh: SSH configuration for Linux-based VMs running on Azure. Required. :vartype ssh: ~azure.mgmt.containerservice.v2020_09_01.models.ContainerServiceSshConfiguration """ _validation = { - 'admin_username': {'required': True, 'pattern': r'^[A-Za-z][-A-Za-z0-9_]*$'}, - 'ssh': {'required': True}, + "admin_username": {"required": True, "pattern": r"^[A-Za-z][-A-Za-z0-9_]*$"}, + "ssh": {"required": True}, } _attribute_map = { - 'admin_username': {'key': 'adminUsername', 'type': 'str'}, - 'ssh': {'key': 'ssh', 'type': 'ContainerServiceSshConfiguration'}, + "admin_username": {"key": "adminUsername", "type": "str"}, + "ssh": {"key": "ssh", "type": "ContainerServiceSshConfiguration"}, } - def __init__( - self, - *, - admin_username: str, - ssh: "_models.ContainerServiceSshConfiguration", - **kwargs - ): + def __init__(self, *, admin_username: str, ssh: "_models.ContainerServiceSshConfiguration", **kwargs): """ - :keyword admin_username: Required. The administrator username to use for Linux VMs. + :keyword admin_username: The administrator username to use for Linux VMs. Required. :paramtype admin_username: str - :keyword ssh: Required. SSH configuration for Linux-based VMs running on Azure. + :keyword ssh: SSH configuration for Linux-based VMs running on Azure. Required. :paramtype ssh: ~azure.mgmt.containerservice.v2020_09_01.models.ContainerServiceSshConfiguration """ - super(ContainerServiceLinuxProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.admin_username = admin_username self.ssh = ssh -class ContainerServiceMasterProfile(msrest.serialization.Model): +class ContainerServiceMasterProfile(_serialization.Model): """Profile for the container service master. Variables are only populated by the server, and will be ignored when sending a request. @@ -970,11 +954,11 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar count: Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, - and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". + and 5. The default value is 1. Known values are: 1, 3, and 5. :vartype count: int or ~azure.mgmt.containerservice.v2020_09_01.models.Count - :ivar dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. + :ivar dns_prefix: DNS prefix to be used to create the FQDN for the master pool. Required. :vartype dns_prefix: str - :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + :ivar vm_size: Size of agent VMs. Required. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -1011,7 +995,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :vartype vm_size: str or ~azure.mgmt.containerservice.v2020_09_01.models.ContainerServiceVMSizeTypes :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine @@ -1025,7 +1009,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): :vartype first_consecutive_static_ip: str :ivar storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount" and "ManagedDisks". :vartype storage_profile: str or ~azure.mgmt.containerservice.v2020_09_01.models.ContainerServiceStorageProfileTypes :ivar fqdn: FQDN for the master pool. @@ -1033,21 +1017,21 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): """ _validation = { - 'dns_prefix': {'required': True}, - 'vm_size': {'required': True}, - 'os_disk_size_gb': {'maximum': 1023, 'minimum': 0}, - 'fqdn': {'readonly': True}, + "dns_prefix": {"required": True}, + "vm_size": {"required": True}, + "os_disk_size_gb": {"maximum": 1023, "minimum": 0}, + "fqdn": {"readonly": True}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'dns_prefix': {'key': 'dnsPrefix', 'type': 'str'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'first_consecutive_static_ip': {'key': 'firstConsecutiveStaticIP', 'type': 'str'}, - 'storage_profile': {'key': 'storageProfile', 'type': 'str'}, - 'fqdn': {'key': 'fqdn', 'type': 'str'}, + "count": {"key": "count", "type": "int"}, + "dns_prefix": {"key": "dnsPrefix", "type": "str"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "first_consecutive_static_ip": {"key": "firstConsecutiveStaticIP", "type": "str"}, + "storage_profile": {"key": "storageProfile", "type": "str"}, + "fqdn": {"key": "fqdn", "type": "str"}, } def __init__( @@ -1055,20 +1039,20 @@ def __init__( *, dns_prefix: str, vm_size: Union[str, "_models.ContainerServiceVMSizeTypes"], - count: Optional[Union[int, "_models.Count"]] = 1, + count: Union[int, "_models.Count"] = 1, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, - first_consecutive_static_ip: Optional[str] = "10.240.255.5", + first_consecutive_static_ip: str = "10.240.255.5", storage_profile: Optional[Union[str, "_models.ContainerServiceStorageProfileTypes"]] = None, **kwargs ): """ :keyword count: Number of masters (VMs) in the container service cluster. Allowed values are 1, - 3, and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". + 3, and 5. The default value is 1. Known values are: 1, 3, and 5. :paramtype count: int or ~azure.mgmt.containerservice.v2020_09_01.models.Count - :keyword dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. + :keyword dns_prefix: DNS prefix to be used to create the FQDN for the master pool. Required. :paramtype dns_prefix: str - :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + :keyword vm_size: Size of agent VMs. Required. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -1105,7 +1089,7 @@ def __init__( "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :paramtype vm_size: str or ~azure.mgmt.containerservice.v2020_09_01.models.ContainerServiceVMSizeTypes :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every @@ -1119,11 +1103,11 @@ def __init__( :paramtype first_consecutive_static_ip: str :keyword storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount" and "ManagedDisks". :paramtype storage_profile: str or ~azure.mgmt.containerservice.v2020_09_01.models.ContainerServiceStorageProfileTypes """ - super(ContainerServiceMasterProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.dns_prefix = dns_prefix self.vm_size = vm_size @@ -1134,17 +1118,17 @@ def __init__( self.fqdn = None -class ContainerServiceNetworkProfile(msrest.serialization.Model): +class ContainerServiceNetworkProfile(_serialization.Model): """Profile of network configuration. :ivar network_plugin: Network plugin used for building Kubernetes network. Known values are: - "azure", "kubenet". Default value: "kubenet". + "azure" and "kubenet". :vartype network_plugin: str or ~azure.mgmt.containerservice.v2020_09_01.models.NetworkPlugin :ivar network_policy: Network policy used for building Kubernetes network. Known values are: - "calico", "azure". + "calico" and "azure". :vartype network_policy: str or ~azure.mgmt.containerservice.v2020_09_01.models.NetworkPolicy :ivar network_mode: Network mode used for building Kubernetes network. Known values are: - "transparent", "bridge". + "transparent" and "bridge". :vartype network_mode: str or ~azure.mgmt.containerservice.v2020_09_01.models.NetworkMode :ivar pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :vartype pod_cidr: str @@ -1157,11 +1141,11 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): :ivar docker_bridge_cidr: A CIDR notation IP range assigned to the Docker bridge network. It must not overlap with any Subnet IP ranges or the Kubernetes service address range. :vartype docker_bridge_cidr: str - :ivar outbound_type: The outbound (egress) routing method. Known values are: "loadBalancer", - "userDefinedRouting". Default value: "loadBalancer". + :ivar outbound_type: The outbound (egress) routing method. Known values are: "loadBalancer" and + "userDefinedRouting". :vartype outbound_type: str or ~azure.mgmt.containerservice.v2020_09_01.models.OutboundType :ivar load_balancer_sku: The load balancer sku for the managed cluster. Known values are: - "standard", "basic". + "standard" and "basic". :vartype load_balancer_sku: str or ~azure.mgmt.containerservice.v2020_09_01.models.LoadBalancerSku :ivar load_balancer_profile: Profile of the cluster load balancer. @@ -1170,49 +1154,51 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): """ _validation = { - 'pod_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, - 'service_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, - 'dns_service_ip': {'pattern': r'^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$'}, - 'docker_bridge_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, + "pod_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, + "service_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, + "dns_service_ip": { + "pattern": r"^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$" + }, + "docker_bridge_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, } _attribute_map = { - 'network_plugin': {'key': 'networkPlugin', 'type': 'str'}, - 'network_policy': {'key': 'networkPolicy', 'type': 'str'}, - 'network_mode': {'key': 'networkMode', 'type': 'str'}, - 'pod_cidr': {'key': 'podCidr', 'type': 'str'}, - 'service_cidr': {'key': 'serviceCidr', 'type': 'str'}, - 'dns_service_ip': {'key': 'dnsServiceIP', 'type': 'str'}, - 'docker_bridge_cidr': {'key': 'dockerBridgeCidr', 'type': 'str'}, - 'outbound_type': {'key': 'outboundType', 'type': 'str'}, - 'load_balancer_sku': {'key': 'loadBalancerSku', 'type': 'str'}, - 'load_balancer_profile': {'key': 'loadBalancerProfile', 'type': 'ManagedClusterLoadBalancerProfile'}, + "network_plugin": {"key": "networkPlugin", "type": "str"}, + "network_policy": {"key": "networkPolicy", "type": "str"}, + "network_mode": {"key": "networkMode", "type": "str"}, + "pod_cidr": {"key": "podCidr", "type": "str"}, + "service_cidr": {"key": "serviceCidr", "type": "str"}, + "dns_service_ip": {"key": "dnsServiceIP", "type": "str"}, + "docker_bridge_cidr": {"key": "dockerBridgeCidr", "type": "str"}, + "outbound_type": {"key": "outboundType", "type": "str"}, + "load_balancer_sku": {"key": "loadBalancerSku", "type": "str"}, + "load_balancer_profile": {"key": "loadBalancerProfile", "type": "ManagedClusterLoadBalancerProfile"}, } def __init__( self, *, - network_plugin: Optional[Union[str, "_models.NetworkPlugin"]] = "kubenet", + network_plugin: Union[str, "_models.NetworkPlugin"] = "kubenet", network_policy: Optional[Union[str, "_models.NetworkPolicy"]] = None, network_mode: Optional[Union[str, "_models.NetworkMode"]] = None, - pod_cidr: Optional[str] = "10.244.0.0/16", - service_cidr: Optional[str] = "10.0.0.0/16", - dns_service_ip: Optional[str] = "10.0.0.10", - docker_bridge_cidr: Optional[str] = "172.17.0.1/16", - outbound_type: Optional[Union[str, "_models.OutboundType"]] = "loadBalancer", + pod_cidr: str = "10.244.0.0/16", + service_cidr: str = "10.0.0.0/16", + dns_service_ip: str = "10.0.0.10", + docker_bridge_cidr: str = "172.17.0.1/16", + outbound_type: Union[str, "_models.OutboundType"] = "loadBalancer", load_balancer_sku: Optional[Union[str, "_models.LoadBalancerSku"]] = None, load_balancer_profile: Optional["_models.ManagedClusterLoadBalancerProfile"] = None, **kwargs ): """ :keyword network_plugin: Network plugin used for building Kubernetes network. Known values are: - "azure", "kubenet". Default value: "kubenet". + "azure" and "kubenet". :paramtype network_plugin: str or ~azure.mgmt.containerservice.v2020_09_01.models.NetworkPlugin :keyword network_policy: Network policy used for building Kubernetes network. Known values are: - "calico", "azure". + "calico" and "azure". :paramtype network_policy: str or ~azure.mgmt.containerservice.v2020_09_01.models.NetworkPolicy :keyword network_mode: Network mode used for building Kubernetes network. Known values are: - "transparent", "bridge". + "transparent" and "bridge". :paramtype network_mode: str or ~azure.mgmt.containerservice.v2020_09_01.models.NetworkMode :keyword pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :paramtype pod_cidr: str @@ -1225,18 +1211,18 @@ def __init__( :keyword docker_bridge_cidr: A CIDR notation IP range assigned to the Docker bridge network. It must not overlap with any Subnet IP ranges or the Kubernetes service address range. :paramtype docker_bridge_cidr: str - :keyword outbound_type: The outbound (egress) routing method. Known values are: "loadBalancer", - "userDefinedRouting". Default value: "loadBalancer". + :keyword outbound_type: The outbound (egress) routing method. Known values are: "loadBalancer" + and "userDefinedRouting". :paramtype outbound_type: str or ~azure.mgmt.containerservice.v2020_09_01.models.OutboundType :keyword load_balancer_sku: The load balancer sku for the managed cluster. Known values are: - "standard", "basic". + "standard" and "basic". :paramtype load_balancer_sku: str or ~azure.mgmt.containerservice.v2020_09_01.models.LoadBalancerSku :keyword load_balancer_profile: Profile of the cluster load balancer. :paramtype load_balancer_profile: ~azure.mgmt.containerservice.v2020_09_01.models.ManagedClusterLoadBalancerProfile """ - super(ContainerServiceNetworkProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.network_plugin = network_plugin self.network_policy = network_policy self.network_mode = network_mode @@ -1249,113 +1235,98 @@ def __init__( self.load_balancer_profile = load_balancer_profile -class ContainerServiceSshConfiguration(msrest.serialization.Model): +class ContainerServiceSshConfiguration(_serialization.Model): """SSH configuration for Linux-based VMs running on Azure. All required parameters must be populated in order to send to Azure. - :ivar public_keys: Required. The list of SSH public keys used to authenticate with Linux-based - VMs. Only expect one key specified. + :ivar public_keys: The list of SSH public keys used to authenticate with Linux-based VMs. Only + expect one key specified. Required. :vartype public_keys: list[~azure.mgmt.containerservice.v2020_09_01.models.ContainerServiceSshPublicKey] """ _validation = { - 'public_keys': {'required': True}, + "public_keys": {"required": True}, } _attribute_map = { - 'public_keys': {'key': 'publicKeys', 'type': '[ContainerServiceSshPublicKey]'}, + "public_keys": {"key": "publicKeys", "type": "[ContainerServiceSshPublicKey]"}, } - def __init__( - self, - *, - public_keys: List["_models.ContainerServiceSshPublicKey"], - **kwargs - ): + def __init__(self, *, public_keys: List["_models.ContainerServiceSshPublicKey"], **kwargs): """ - :keyword public_keys: Required. The list of SSH public keys used to authenticate with - Linux-based VMs. Only expect one key specified. + :keyword public_keys: The list of SSH public keys used to authenticate with Linux-based VMs. + Only expect one key specified. Required. :paramtype public_keys: list[~azure.mgmt.containerservice.v2020_09_01.models.ContainerServiceSshPublicKey] """ - super(ContainerServiceSshConfiguration, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_keys = public_keys -class ContainerServiceSshPublicKey(msrest.serialization.Model): +class ContainerServiceSshPublicKey(_serialization.Model): """Contains information about SSH certificate public key data. All required parameters must be populated in order to send to Azure. - :ivar key_data: Required. Certificate public key used to authenticate with VMs through SSH. The - certificate must be in PEM format with or without headers. + :ivar key_data: Certificate public key used to authenticate with VMs through SSH. The + certificate must be in PEM format with or without headers. Required. :vartype key_data: str """ _validation = { - 'key_data': {'required': True}, + "key_data": {"required": True}, } _attribute_map = { - 'key_data': {'key': 'keyData', 'type': 'str'}, + "key_data": {"key": "keyData", "type": "str"}, } - def __init__( - self, - *, - key_data: str, - **kwargs - ): + def __init__(self, *, key_data: str, **kwargs): """ - :keyword key_data: Required. Certificate public key used to authenticate with VMs through SSH. - The certificate must be in PEM format with or without headers. + :keyword key_data: Certificate public key used to authenticate with VMs through SSH. The + certificate must be in PEM format with or without headers. Required. :paramtype key_data: str """ - super(ContainerServiceSshPublicKey, self).__init__(**kwargs) + super().__init__(**kwargs) self.key_data = key_data -class ContainerServiceVMDiagnostics(msrest.serialization.Model): +class ContainerServiceVMDiagnostics(_serialization.Model): """Profile for diagnostics on the container service VMs. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar enabled: Required. Whether the VM diagnostic agent is provisioned on the VM. + :ivar enabled: Whether the VM diagnostic agent is provisioned on the VM. Required. :vartype enabled: bool :ivar storage_uri: The URI of the storage account where diagnostics are stored. :vartype storage_uri: str """ _validation = { - 'enabled': {'required': True}, - 'storage_uri': {'readonly': True}, + "enabled": {"required": True}, + "storage_uri": {"readonly": True}, } _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'storage_uri': {'key': 'storageUri', 'type': 'str'}, + "enabled": {"key": "enabled", "type": "bool"}, + "storage_uri": {"key": "storageUri", "type": "str"}, } - def __init__( - self, - *, - enabled: bool, - **kwargs - ): + def __init__(self, *, enabled: bool, **kwargs): """ - :keyword enabled: Required. Whether the VM diagnostic agent is provisioned on the VM. + :keyword enabled: Whether the VM diagnostic agent is provisioned on the VM. Required. :paramtype enabled: bool """ - super(ContainerServiceVMDiagnostics, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.storage_uri = None -class CredentialResult(msrest.serialization.Model): +class CredentialResult(_serialization.Model): """The credential result response. Variables are only populated by the server, and will be ignored when sending a request. @@ -1363,31 +1334,27 @@ class CredentialResult(msrest.serialization.Model): :ivar name: The name of the credential. :vartype name: str :ivar value: Base64-encoded Kubernetes configuration file. - :vartype value: bytearray + :vartype value: bytes """ _validation = { - 'name': {'readonly': True}, - 'value': {'readonly': True}, + "name": {"readonly": True}, + "value": {"readonly": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'bytearray'}, + "name": {"key": "name", "type": "str"}, + "value": {"key": "value", "type": "bytearray"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(CredentialResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.name = None self.value = None -class CredentialResults(msrest.serialization.Model): +class CredentialResults(_serialization.Model): """The list of credential result response. Variables are only populated by the server, and will be ignored when sending a request. @@ -1397,24 +1364,20 @@ class CredentialResults(msrest.serialization.Model): """ _validation = { - 'kubeconfigs': {'readonly': True}, + "kubeconfigs": {"readonly": True}, } _attribute_map = { - 'kubeconfigs': {'key': 'kubeconfigs', 'type': '[CredentialResult]'}, + "kubeconfigs": {"key": "kubeconfigs", "type": "[CredentialResult]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(CredentialResults, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.kubeconfigs = None -class Resource(msrest.serialization.Model): +class Resource(_serialization.Model): """The Resource model definition. Variables are only populated by the server, and will be ignored when sending a request. @@ -1427,41 +1390,35 @@ class Resource(msrest.serialization.Model): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] """ - super(Resource, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -1469,7 +1426,7 @@ def __init__( self.tags = tags -class ManagedCluster(Resource, BaseManagedCluster): +class ManagedCluster(Resource, BaseManagedCluster): # pylint: disable=too-many-instance-attributes """Managed cluster. Variables are only populated by the server, and will be ignored when sending a request. @@ -1540,58 +1497,70 @@ class ManagedCluster(Resource, BaseManagedCluster): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar sku: The managed cluster SKU. :vartype sku: ~azure.mgmt.containerservice.v2020_09_01.models.ManagedClusterSKU """ _validation = { - 'provisioning_state': {'readonly': True}, - 'power_state': {'readonly': True}, - 'max_agent_pools': {'readonly': True}, - 'fqdn': {'readonly': True}, - 'private_fqdn': {'readonly': True}, - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, + "provisioning_state": {"readonly": True}, + "power_state": {"readonly": True}, + "max_agent_pools": {"readonly": True}, + "fqdn": {"readonly": True}, + "private_fqdn": {"readonly": True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { - 'identity': {'key': 'identity', 'type': 'ManagedClusterIdentity'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'power_state': {'key': 'properties.powerState', 'type': 'PowerState'}, - 'max_agent_pools': {'key': 'properties.maxAgentPools', 'type': 'int'}, - 'kubernetes_version': {'key': 'properties.kubernetesVersion', 'type': 'str'}, - 'dns_prefix': {'key': 'properties.dnsPrefix', 'type': 'str'}, - 'fqdn': {'key': 'properties.fqdn', 'type': 'str'}, - 'private_fqdn': {'key': 'properties.privateFQDN', 'type': 'str'}, - 'agent_pool_profiles': {'key': 'properties.agentPoolProfiles', 'type': '[ManagedClusterAgentPoolProfile]'}, - 'linux_profile': {'key': 'properties.linuxProfile', 'type': 'ContainerServiceLinuxProfile'}, - 'windows_profile': {'key': 'properties.windowsProfile', 'type': 'ManagedClusterWindowsProfile'}, - 'service_principal_profile': {'key': 'properties.servicePrincipalProfile', 'type': 'ManagedClusterServicePrincipalProfile'}, - 'addon_profiles': {'key': 'properties.addonProfiles', 'type': '{ManagedClusterAddonProfile}'}, - 'node_resource_group': {'key': 'properties.nodeResourceGroup', 'type': 'str'}, - 'enable_rbac': {'key': 'properties.enableRBAC', 'type': 'bool'}, - 'enable_pod_security_policy': {'key': 'properties.enablePodSecurityPolicy', 'type': 'bool'}, - 'network_profile': {'key': 'properties.networkProfile', 'type': 'ContainerServiceNetworkProfile'}, - 'aad_profile': {'key': 'properties.aadProfile', 'type': 'ManagedClusterAADProfile'}, - 'auto_scaler_profile': {'key': 'properties.autoScalerProfile', 'type': 'ManagedClusterPropertiesAutoScalerProfile'}, - 'api_server_access_profile': {'key': 'properties.apiServerAccessProfile', 'type': 'ManagedClusterAPIServerAccessProfile'}, - 'disk_encryption_set_id': {'key': 'properties.diskEncryptionSetID', 'type': 'str'}, - 'identity_profile': {'key': 'properties.identityProfile', 'type': '{ManagedClusterPropertiesIdentityProfileValue}'}, - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'ManagedClusterSKU'}, - } - - def __init__( + "identity": {"key": "identity", "type": "ManagedClusterIdentity"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "power_state": {"key": "properties.powerState", "type": "PowerState"}, + "max_agent_pools": {"key": "properties.maxAgentPools", "type": "int"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "dns_prefix": {"key": "properties.dnsPrefix", "type": "str"}, + "fqdn": {"key": "properties.fqdn", "type": "str"}, + "private_fqdn": {"key": "properties.privateFQDN", "type": "str"}, + "agent_pool_profiles": {"key": "properties.agentPoolProfiles", "type": "[ManagedClusterAgentPoolProfile]"}, + "linux_profile": {"key": "properties.linuxProfile", "type": "ContainerServiceLinuxProfile"}, + "windows_profile": {"key": "properties.windowsProfile", "type": "ManagedClusterWindowsProfile"}, + "service_principal_profile": { + "key": "properties.servicePrincipalProfile", + "type": "ManagedClusterServicePrincipalProfile", + }, + "addon_profiles": {"key": "properties.addonProfiles", "type": "{ManagedClusterAddonProfile}"}, + "node_resource_group": {"key": "properties.nodeResourceGroup", "type": "str"}, + "enable_rbac": {"key": "properties.enableRBAC", "type": "bool"}, + "enable_pod_security_policy": {"key": "properties.enablePodSecurityPolicy", "type": "bool"}, + "network_profile": {"key": "properties.networkProfile", "type": "ContainerServiceNetworkProfile"}, + "aad_profile": {"key": "properties.aadProfile", "type": "ManagedClusterAADProfile"}, + "auto_scaler_profile": { + "key": "properties.autoScalerProfile", + "type": "ManagedClusterPropertiesAutoScalerProfile", + }, + "api_server_access_profile": { + "key": "properties.apiServerAccessProfile", + "type": "ManagedClusterAPIServerAccessProfile", + }, + "disk_encryption_set_id": {"key": "properties.diskEncryptionSetID", "type": "str"}, + "identity_profile": { + "key": "properties.identityProfile", + "type": "{ManagedClusterPropertiesIdentityProfileValue}", + }, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "sku": {"key": "sku", "type": "ManagedClusterSKU"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, location: str, @@ -1665,14 +1634,35 @@ def __init__( :keyword identity_profile: Identities associated with the cluster. :paramtype identity_profile: dict[str, ~azure.mgmt.containerservice.v2020_09_01.models.ManagedClusterPropertiesIdentityProfileValue] - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword sku: The managed cluster SKU. :paramtype sku: ~azure.mgmt.containerservice.v2020_09_01.models.ManagedClusterSKU """ - super(ManagedCluster, self).__init__(location=location, tags=tags, identity=identity, kubernetes_version=kubernetes_version, dns_prefix=dns_prefix, agent_pool_profiles=agent_pool_profiles, linux_profile=linux_profile, windows_profile=windows_profile, service_principal_profile=service_principal_profile, addon_profiles=addon_profiles, node_resource_group=node_resource_group, enable_rbac=enable_rbac, enable_pod_security_policy=enable_pod_security_policy, network_profile=network_profile, aad_profile=aad_profile, auto_scaler_profile=auto_scaler_profile, api_server_access_profile=api_server_access_profile, disk_encryption_set_id=disk_encryption_set_id, identity_profile=identity_profile, **kwargs) + super().__init__( + location=location, + tags=tags, + identity=identity, + kubernetes_version=kubernetes_version, + dns_prefix=dns_prefix, + agent_pool_profiles=agent_pool_profiles, + linux_profile=linux_profile, + windows_profile=windows_profile, + service_principal_profile=service_principal_profile, + addon_profiles=addon_profiles, + node_resource_group=node_resource_group, + enable_rbac=enable_rbac, + enable_pod_security_policy=enable_pod_security_policy, + network_profile=network_profile, + aad_profile=aad_profile, + auto_scaler_profile=auto_scaler_profile, + api_server_access_profile=api_server_access_profile, + disk_encryption_set_id=disk_encryption_set_id, + identity_profile=identity_profile, + **kwargs + ) self.identity = identity self.provisioning_state = None self.power_state = None @@ -1703,7 +1693,7 @@ def __init__( self.tags = tags -class ManagedClusterAADProfile(msrest.serialization.Model): +class ManagedClusterAADProfile(_serialization.Model): """AADProfile specifies attributes for Azure Active Directory integration. :ivar managed: Whether to enable managed AAD. @@ -1724,13 +1714,13 @@ class ManagedClusterAADProfile(msrest.serialization.Model): """ _attribute_map = { - 'managed': {'key': 'managed', 'type': 'bool'}, - 'enable_azure_rbac': {'key': 'enableAzureRBAC', 'type': 'bool'}, - 'admin_group_object_i_ds': {'key': 'adminGroupObjectIDs', 'type': '[str]'}, - 'client_app_id': {'key': 'clientAppID', 'type': 'str'}, - 'server_app_id': {'key': 'serverAppID', 'type': 'str'}, - 'server_app_secret': {'key': 'serverAppSecret', 'type': 'str'}, - 'tenant_id': {'key': 'tenantID', 'type': 'str'}, + "managed": {"key": "managed", "type": "bool"}, + "enable_azure_rbac": {"key": "enableAzureRBAC", "type": "bool"}, + "admin_group_object_i_ds": {"key": "adminGroupObjectIDs", "type": "[str]"}, + "client_app_id": {"key": "clientAppID", "type": "str"}, + "server_app_id": {"key": "serverAppID", "type": "str"}, + "server_app_secret": {"key": "serverAppSecret", "type": "str"}, + "tenant_id": {"key": "tenantID", "type": "str"}, } def __init__( @@ -1763,7 +1753,7 @@ def __init__( tenant of the deployment subscription. :paramtype tenant_id: str """ - super(ManagedClusterAADProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.managed = managed self.enable_azure_rbac = enable_azure_rbac self.admin_group_object_i_ds = admin_group_object_i_ds @@ -1786,58 +1776,53 @@ class ManagedClusterAccessProfile(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar kube_config: Base64-encoded Kubernetes configuration file. - :vartype kube_config: bytearray + :vartype kube_config: bytes """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'kube_config': {'key': 'properties.kubeConfig', 'type': 'bytearray'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "kube_config": {"key": "properties.kubeConfig", "type": "bytearray"}, } def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - kube_config: Optional[bytearray] = None, - **kwargs + self, *, location: str, tags: Optional[Dict[str, str]] = None, kube_config: Optional[bytes] = None, **kwargs ): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword kube_config: Base64-encoded Kubernetes configuration file. - :paramtype kube_config: bytearray + :paramtype kube_config: bytes """ - super(ManagedClusterAccessProfile, self).__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.kube_config = kube_config -class ManagedClusterAddonProfile(msrest.serialization.Model): +class ManagedClusterAddonProfile(_serialization.Model): """A Kubernetes add-on profile for a managed cluster. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar enabled: Required. Whether the add-on is enabled or not. + :ivar enabled: Whether the add-on is enabled or not. Required. :vartype enabled: bool :ivar config: Key-value pairs for configuring an add-on. :vartype config: dict[str, str] @@ -1847,36 +1832,30 @@ class ManagedClusterAddonProfile(msrest.serialization.Model): """ _validation = { - 'enabled': {'required': True}, - 'identity': {'readonly': True}, + "enabled": {"required": True}, + "identity": {"readonly": True}, } _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'config': {'key': 'config', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'ManagedClusterAddonProfileIdentity'}, + "enabled": {"key": "enabled", "type": "bool"}, + "config": {"key": "config", "type": "{str}"}, + "identity": {"key": "identity", "type": "ManagedClusterAddonProfileIdentity"}, } - def __init__( - self, - *, - enabled: bool, - config: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, enabled: bool, config: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword enabled: Required. Whether the add-on is enabled or not. + :keyword enabled: Whether the add-on is enabled or not. Required. :paramtype enabled: bool :keyword config: Key-value pairs for configuring an add-on. :paramtype config: dict[str, str] """ - super(ManagedClusterAddonProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.config = config self.identity = None -class UserAssignedIdentity(msrest.serialization.Model): +class UserAssignedIdentity(_serialization.Model): """UserAssignedIdentity. :ivar resource_id: The resource id of the user assigned identity. @@ -1888,9 +1867,9 @@ class UserAssignedIdentity(msrest.serialization.Model): """ _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'object_id': {'key': 'objectId', 'type': 'str'}, + "resource_id": {"key": "resourceId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + "object_id": {"key": "objectId", "type": "str"}, } def __init__( @@ -1909,7 +1888,7 @@ def __init__( :keyword object_id: The object id of the user assigned identity. :paramtype object_id: str """ - super(UserAssignedIdentity, self).__init__(**kwargs) + super().__init__(**kwargs) self.resource_id = resource_id self.client_id = client_id self.object_id = object_id @@ -1927,9 +1906,9 @@ class ManagedClusterAddonProfileIdentity(UserAssignedIdentity): """ _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'object_id': {'key': 'objectId', 'type': 'str'}, + "resource_id": {"key": "resourceId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + "object_id": {"key": "objectId", "type": "str"}, } def __init__( @@ -1948,10 +1927,10 @@ def __init__( :keyword object_id: The object id of the user assigned identity. :paramtype object_id: str """ - super(ManagedClusterAddonProfileIdentity, self).__init__(resource_id=resource_id, client_id=client_id, object_id=object_id, **kwargs) + super().__init__(resource_id=resource_id, client_id=client_id, object_id=object_id, **kwargs) -class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): +class ManagedClusterAgentPoolProfileProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes """Properties for the container service agent pool profile. Variables are only populated by the server, and will be ignored when sending a request. @@ -1997,7 +1976,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :vartype vm_size: str or ~azure.mgmt.containerservice.v2020_09_01.models.ContainerServiceVMSizeTypes :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine @@ -2006,14 +1985,14 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :vartype os_disk_size_gb: int :ivar os_disk_type: OS disk type to be used for machines in a given agent pool. Allowed values are 'Ephemeral' and 'Managed'. Defaults to 'Managed'. May not be changed after creation. Known - values are: "Managed", "Ephemeral". + values are: "Managed" and "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2020_09_01.models.OSDiskType :ivar vnet_subnet_id: VNet SubnetID specifies the VNet's subnet identifier. :vartype vnet_subnet_id: str :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Known values are: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux" and "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2020_09_01.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -2022,9 +2001,10 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar type: AgentPoolType represents types of an agent pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2020_09_01.models.AgentPoolType - :ivar mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", "User". + :ivar mode: AgentPoolMode represents mode of an agent pool. Known values are: "System" and + "User". :vartype mode: str or ~azure.mgmt.containerservice.v2020_09_01.models.AgentPoolMode :ivar orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -2045,20 +2025,19 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar enable_node_public_ip: Enable public IP for nodes. :vartype enable_node_public_ip: bool :ivar scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Known values are: "Spot", "Regular". Default value: "Regular". + priority. Default to regular. Known values are: "Spot" and "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_09_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy - for Spot virtual machine scale set. Default to Delete. Known values are: "Delete", - "Deallocate". Default value: "Delete". + for Spot virtual machine scale set. Default to Delete. Known values are: "Delete" and + "Deallocate". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_09_01.models.ScaleSetEvictionPolicy :ivar spot_max_price: SpotMaxPrice to be used to specify the maximum price you are willing to pay in US Dollars. Possible values are any decimal value greater than zero or -1 which indicates default price to be up-to on-demand. :vartype spot_max_price: float - :ivar tags: A set of tags. Agent pool tags to be persisted on the agent pool virtual machine - scale set. + :ivar tags: Agent pool tags to be persisted on the agent pool virtual machine scale set. :vartype tags: dict[str, str] :ivar node_labels: Agent pool node labels to be persisted across all nodes in agent pool. :vartype node_labels: dict[str, str] @@ -2070,42 +2049,42 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): """ _validation = { - 'os_disk_size_gb': {'maximum': 1023, 'minimum': 0}, - 'node_image_version': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'power_state': {'readonly': True}, + "os_disk_size_gb": {"maximum": 1023, "minimum": 0}, + "node_image_version": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "power_state": {"readonly": True}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'os_disk_type': {'key': 'osDiskType', 'type': 'str'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'maxPods', 'type': 'int'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'max_count': {'key': 'maxCount', 'type': 'int'}, - 'min_count': {'key': 'minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'enableAutoScaling', 'type': 'bool'}, - 'type': {'key': 'type', 'type': 'str'}, - 'mode': {'key': 'mode', 'type': 'str'}, - 'orchestrator_version': {'key': 'orchestratorVersion', 'type': 'str'}, - 'node_image_version': {'key': 'nodeImageVersion', 'type': 'str'}, - 'upgrade_settings': {'key': 'upgradeSettings', 'type': 'AgentPoolUpgradeSettings'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'power_state': {'key': 'powerState', 'type': 'PowerState'}, - 'availability_zones': {'key': 'availabilityZones', 'type': '[str]'}, - 'enable_node_public_ip': {'key': 'enableNodePublicIP', 'type': 'bool'}, - 'scale_set_priority': {'key': 'scaleSetPriority', 'type': 'str'}, - 'scale_set_eviction_policy': {'key': 'scaleSetEvictionPolicy', 'type': 'str'}, - 'spot_max_price': {'key': 'spotMaxPrice', 'type': 'float'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'node_labels': {'key': 'nodeLabels', 'type': '{str}'}, - 'node_taints': {'key': 'nodeTaints', 'type': '[str]'}, - 'proximity_placement_group_id': {'key': 'proximityPlacementGroupID', 'type': 'str'}, - } - - def __init__( + "count": {"key": "count", "type": "int"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "os_disk_type": {"key": "osDiskType", "type": "str"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "max_pods": {"key": "maxPods", "type": "int"}, + "os_type": {"key": "osType", "type": "str"}, + "max_count": {"key": "maxCount", "type": "int"}, + "min_count": {"key": "minCount", "type": "int"}, + "enable_auto_scaling": {"key": "enableAutoScaling", "type": "bool"}, + "type": {"key": "type", "type": "str"}, + "mode": {"key": "mode", "type": "str"}, + "orchestrator_version": {"key": "orchestratorVersion", "type": "str"}, + "node_image_version": {"key": "nodeImageVersion", "type": "str"}, + "upgrade_settings": {"key": "upgradeSettings", "type": "AgentPoolUpgradeSettings"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "power_state": {"key": "powerState", "type": "PowerState"}, + "availability_zones": {"key": "availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "enableNodePublicIP", "type": "bool"}, + "scale_set_priority": {"key": "scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "scaleSetEvictionPolicy", "type": "str"}, + "spot_max_price": {"key": "spotMaxPrice", "type": "float"}, + "tags": {"key": "tags", "type": "{str}"}, + "node_labels": {"key": "nodeLabels", "type": "{str}"}, + "node_taints": {"key": "nodeTaints", "type": "[str]"}, + "proximity_placement_group_id": {"key": "proximityPlacementGroupID", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, count: Optional[int] = None, @@ -2114,7 +2093,7 @@ def __init__( os_disk_type: Optional[Union[str, "_models.OSDiskType"]] = None, vnet_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, @@ -2124,9 +2103,9 @@ def __init__( upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, - scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", - spot_max_price: Optional[float] = -1, + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", + spot_max_price: float = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, @@ -2175,7 +2154,7 @@ def __init__( "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :paramtype vm_size: str or ~azure.mgmt.containerservice.v2020_09_01.models.ContainerServiceVMSizeTypes :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every @@ -2184,14 +2163,14 @@ def __init__( :paramtype os_disk_size_gb: int :keyword os_disk_type: OS disk type to be used for machines in a given agent pool. Allowed values are 'Ephemeral' and 'Managed'. Defaults to 'Managed'. May not be changed after creation. - Known values are: "Managed", "Ephemeral". + Known values are: "Managed" and "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2020_09_01.models.OSDiskType :keyword vnet_subnet_id: VNet SubnetID specifies the VNet's subnet identifier. :paramtype vnet_subnet_id: str :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux" and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2020_09_01.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -2200,9 +2179,9 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword type: AgentPoolType represents types of an agent pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2020_09_01.models.AgentPoolType - :keyword mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", + :keyword mode: AgentPoolMode represents mode of an agent pool. Known values are: "System" and "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2020_09_01.models.AgentPoolMode :keyword orchestrator_version: Version of orchestrator specified when creating the managed @@ -2217,20 +2196,19 @@ def __init__( :keyword enable_node_public_ip: Enable public IP for nodes. :paramtype enable_node_public_ip: bool :keyword scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Known values are: "Spot", "Regular". Default value: "Regular". + priority. Default to regular. Known values are: "Spot" and "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_09_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction - policy for Spot virtual machine scale set. Default to Delete. Known values are: "Delete", - "Deallocate". Default value: "Delete". + policy for Spot virtual machine scale set. Default to Delete. Known values are: "Delete" and + "Deallocate". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_09_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: SpotMaxPrice to be used to specify the maximum price you are willing to pay in US Dollars. Possible values are any decimal value greater than zero or -1 which indicates default price to be up-to on-demand. :paramtype spot_max_price: float - :keyword tags: A set of tags. Agent pool tags to be persisted on the agent pool virtual machine - scale set. + :keyword tags: Agent pool tags to be persisted on the agent pool virtual machine scale set. :paramtype tags: dict[str, str] :keyword node_labels: Agent pool node labels to be persisted across all nodes in agent pool. :paramtype node_labels: dict[str, str] @@ -2240,7 +2218,7 @@ def __init__( :keyword proximity_placement_group_id: The ID for Proximity Placement Group. :paramtype proximity_placement_group_id: str """ - super(ManagedClusterAgentPoolProfileProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.vm_size = vm_size self.os_disk_size_gb = os_disk_size_gb @@ -2269,7 +2247,9 @@ def __init__( self.proximity_placement_group_id = proximity_placement_group_id -class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): +class ManagedClusterAgentPoolProfile( + ManagedClusterAgentPoolProfileProperties +): # pylint: disable=too-many-instance-attributes """Profile for the container service agent pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -2317,7 +2297,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :vartype vm_size: str or ~azure.mgmt.containerservice.v2020_09_01.models.ContainerServiceVMSizeTypes :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine @@ -2326,14 +2306,14 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :vartype os_disk_size_gb: int :ivar os_disk_type: OS disk type to be used for machines in a given agent pool. Allowed values are 'Ephemeral' and 'Managed'. Defaults to 'Managed'. May not be changed after creation. Known - values are: "Managed", "Ephemeral". + values are: "Managed" and "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2020_09_01.models.OSDiskType :ivar vnet_subnet_id: VNet SubnetID specifies the VNet's subnet identifier. :vartype vnet_subnet_id: str :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Known values are: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux" and "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2020_09_01.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -2342,9 +2322,10 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar type: AgentPoolType represents types of an agent pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2020_09_01.models.AgentPoolType - :ivar mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", "User". + :ivar mode: AgentPoolMode represents mode of an agent pool. Known values are: "System" and + "User". :vartype mode: str or ~azure.mgmt.containerservice.v2020_09_01.models.AgentPoolMode :ivar orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -2365,20 +2346,19 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar enable_node_public_ip: Enable public IP for nodes. :vartype enable_node_public_ip: bool :ivar scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Known values are: "Spot", "Regular". Default value: "Regular". + priority. Default to regular. Known values are: "Spot" and "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_09_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy - for Spot virtual machine scale set. Default to Delete. Known values are: "Delete", - "Deallocate". Default value: "Delete". + for Spot virtual machine scale set. Default to Delete. Known values are: "Delete" and + "Deallocate". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_09_01.models.ScaleSetEvictionPolicy :ivar spot_max_price: SpotMaxPrice to be used to specify the maximum price you are willing to pay in US Dollars. Possible values are any decimal value greater than zero or -1 which indicates default price to be up-to on-demand. :vartype spot_max_price: float - :ivar tags: A set of tags. Agent pool tags to be persisted on the agent pool virtual machine - scale set. + :ivar tags: Agent pool tags to be persisted on the agent pool virtual machine scale set. :vartype tags: dict[str, str] :ivar node_labels: Agent pool node labels to be persisted across all nodes in agent pool. :vartype node_labels: dict[str, str] @@ -2387,50 +2367,50 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :vartype node_taints: list[str] :ivar proximity_placement_group_id: The ID for Proximity Placement Group. :vartype proximity_placement_group_id: str - :ivar name: Required. Unique name of the agent pool profile in the context of the subscription - and resource group. + :ivar name: Unique name of the agent pool profile in the context of the subscription and + resource group. Required. :vartype name: str """ _validation = { - 'os_disk_size_gb': {'maximum': 1023, 'minimum': 0}, - 'node_image_version': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'power_state': {'readonly': True}, - 'name': {'required': True, 'pattern': r'^[a-z][a-z0-9]{0,11}$'}, + "os_disk_size_gb": {"maximum": 1023, "minimum": 0}, + "node_image_version": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "power_state": {"readonly": True}, + "name": {"required": True, "pattern": r"^[a-z][a-z0-9]{0,11}$"}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'os_disk_type': {'key': 'osDiskType', 'type': 'str'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'maxPods', 'type': 'int'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'max_count': {'key': 'maxCount', 'type': 'int'}, - 'min_count': {'key': 'minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'enableAutoScaling', 'type': 'bool'}, - 'type': {'key': 'type', 'type': 'str'}, - 'mode': {'key': 'mode', 'type': 'str'}, - 'orchestrator_version': {'key': 'orchestratorVersion', 'type': 'str'}, - 'node_image_version': {'key': 'nodeImageVersion', 'type': 'str'}, - 'upgrade_settings': {'key': 'upgradeSettings', 'type': 'AgentPoolUpgradeSettings'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'power_state': {'key': 'powerState', 'type': 'PowerState'}, - 'availability_zones': {'key': 'availabilityZones', 'type': '[str]'}, - 'enable_node_public_ip': {'key': 'enableNodePublicIP', 'type': 'bool'}, - 'scale_set_priority': {'key': 'scaleSetPriority', 'type': 'str'}, - 'scale_set_eviction_policy': {'key': 'scaleSetEvictionPolicy', 'type': 'str'}, - 'spot_max_price': {'key': 'spotMaxPrice', 'type': 'float'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'node_labels': {'key': 'nodeLabels', 'type': '{str}'}, - 'node_taints': {'key': 'nodeTaints', 'type': '[str]'}, - 'proximity_placement_group_id': {'key': 'proximityPlacementGroupID', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( + "count": {"key": "count", "type": "int"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "os_disk_type": {"key": "osDiskType", "type": "str"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "max_pods": {"key": "maxPods", "type": "int"}, + "os_type": {"key": "osType", "type": "str"}, + "max_count": {"key": "maxCount", "type": "int"}, + "min_count": {"key": "minCount", "type": "int"}, + "enable_auto_scaling": {"key": "enableAutoScaling", "type": "bool"}, + "type": {"key": "type", "type": "str"}, + "mode": {"key": "mode", "type": "str"}, + "orchestrator_version": {"key": "orchestratorVersion", "type": "str"}, + "node_image_version": {"key": "nodeImageVersion", "type": "str"}, + "upgrade_settings": {"key": "upgradeSettings", "type": "AgentPoolUpgradeSettings"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "power_state": {"key": "powerState", "type": "PowerState"}, + "availability_zones": {"key": "availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "enableNodePublicIP", "type": "bool"}, + "scale_set_priority": {"key": "scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "scaleSetEvictionPolicy", "type": "str"}, + "spot_max_price": {"key": "spotMaxPrice", "type": "float"}, + "tags": {"key": "tags", "type": "{str}"}, + "node_labels": {"key": "nodeLabels", "type": "{str}"}, + "node_taints": {"key": "nodeTaints", "type": "[str]"}, + "proximity_placement_group_id": {"key": "proximityPlacementGroupID", "type": "str"}, + "name": {"key": "name", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, name: str, @@ -2440,7 +2420,7 @@ def __init__( os_disk_type: Optional[Union[str, "_models.OSDiskType"]] = None, vnet_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, @@ -2450,9 +2430,9 @@ def __init__( upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, - scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", - spot_max_price: Optional[float] = -1, + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", + spot_max_price: float = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, @@ -2501,7 +2481,7 @@ def __init__( "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :paramtype vm_size: str or ~azure.mgmt.containerservice.v2020_09_01.models.ContainerServiceVMSizeTypes :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every @@ -2510,14 +2490,14 @@ def __init__( :paramtype os_disk_size_gb: int :keyword os_disk_type: OS disk type to be used for machines in a given agent pool. Allowed values are 'Ephemeral' and 'Managed'. Defaults to 'Managed'. May not be changed after creation. - Known values are: "Managed", "Ephemeral". + Known values are: "Managed" and "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2020_09_01.models.OSDiskType :keyword vnet_subnet_id: VNet SubnetID specifies the VNet's subnet identifier. :paramtype vnet_subnet_id: str :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux" and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2020_09_01.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -2526,9 +2506,9 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword type: AgentPoolType represents types of an agent pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2020_09_01.models.AgentPoolType - :keyword mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", + :keyword mode: AgentPoolMode represents mode of an agent pool. Known values are: "System" and "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2020_09_01.models.AgentPoolMode :keyword orchestrator_version: Version of orchestrator specified when creating the managed @@ -2543,20 +2523,19 @@ def __init__( :keyword enable_node_public_ip: Enable public IP for nodes. :paramtype enable_node_public_ip: bool :keyword scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Known values are: "Spot", "Regular". Default value: "Regular". + priority. Default to regular. Known values are: "Spot" and "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_09_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction - policy for Spot virtual machine scale set. Default to Delete. Known values are: "Delete", - "Deallocate". Default value: "Delete". + policy for Spot virtual machine scale set. Default to Delete. Known values are: "Delete" and + "Deallocate". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_09_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: SpotMaxPrice to be used to specify the maximum price you are willing to pay in US Dollars. Possible values are any decimal value greater than zero or -1 which indicates default price to be up-to on-demand. :paramtype spot_max_price: float - :keyword tags: A set of tags. Agent pool tags to be persisted on the agent pool virtual machine - scale set. + :keyword tags: Agent pool tags to be persisted on the agent pool virtual machine scale set. :paramtype tags: dict[str, str] :keyword node_labels: Agent pool node labels to be persisted across all nodes in agent pool. :paramtype node_labels: dict[str, str] @@ -2565,15 +2544,40 @@ def __init__( :paramtype node_taints: list[str] :keyword proximity_placement_group_id: The ID for Proximity Placement Group. :paramtype proximity_placement_group_id: str - :keyword name: Required. Unique name of the agent pool profile in the context of the - subscription and resource group. + :keyword name: Unique name of the agent pool profile in the context of the subscription and + resource group. Required. :paramtype name: str """ - super(ManagedClusterAgentPoolProfile, self).__init__(count=count, vm_size=vm_size, os_disk_size_gb=os_disk_size_gb, os_disk_type=os_disk_type, vnet_subnet_id=vnet_subnet_id, max_pods=max_pods, os_type=os_type, max_count=max_count, min_count=min_count, enable_auto_scaling=enable_auto_scaling, type=type, mode=mode, orchestrator_version=orchestrator_version, upgrade_settings=upgrade_settings, availability_zones=availability_zones, enable_node_public_ip=enable_node_public_ip, scale_set_priority=scale_set_priority, scale_set_eviction_policy=scale_set_eviction_policy, spot_max_price=spot_max_price, tags=tags, node_labels=node_labels, node_taints=node_taints, proximity_placement_group_id=proximity_placement_group_id, **kwargs) + super().__init__( + count=count, + vm_size=vm_size, + os_disk_size_gb=os_disk_size_gb, + os_disk_type=os_disk_type, + vnet_subnet_id=vnet_subnet_id, + max_pods=max_pods, + os_type=os_type, + max_count=max_count, + min_count=min_count, + enable_auto_scaling=enable_auto_scaling, + type=type, + mode=mode, + orchestrator_version=orchestrator_version, + upgrade_settings=upgrade_settings, + availability_zones=availability_zones, + enable_node_public_ip=enable_node_public_ip, + scale_set_priority=scale_set_priority, + scale_set_eviction_policy=scale_set_eviction_policy, + spot_max_price=spot_max_price, + tags=tags, + node_labels=node_labels, + node_taints=node_taints, + proximity_placement_group_id=proximity_placement_group_id, + **kwargs + ) self.name = name -class ManagedClusterAPIServerAccessProfile(msrest.serialization.Model): +class ManagedClusterAPIServerAccessProfile(_serialization.Model): """Access profile for managed cluster API server. :ivar authorized_ip_ranges: Authorized IP Ranges to kubernetes API server. @@ -2583,8 +2587,8 @@ class ManagedClusterAPIServerAccessProfile(msrest.serialization.Model): """ _attribute_map = { - 'authorized_ip_ranges': {'key': 'authorizedIPRanges', 'type': '[str]'}, - 'enable_private_cluster': {'key': 'enablePrivateCluster', 'type': 'bool'}, + "authorized_ip_ranges": {"key": "authorizedIPRanges", "type": "[str]"}, + "enable_private_cluster": {"key": "enablePrivateCluster", "type": "bool"}, } def __init__( @@ -2600,12 +2604,12 @@ def __init__( :keyword enable_private_cluster: Whether to create the cluster as a private cluster or not. :paramtype enable_private_cluster: bool """ - super(ManagedClusterAPIServerAccessProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.authorized_ip_ranges = authorized_ip_ranges self.enable_private_cluster = enable_private_cluster -class ManagedClusterIdentity(msrest.serialization.Model): +class ManagedClusterIdentity(_serialization.Model): """Identity for the managed cluster. Variables are only populated by the server, and will be ignored when sending a request. @@ -2619,7 +2623,7 @@ class ManagedClusterIdentity(msrest.serialization.Model): :ivar type: The type of identity used for the managed cluster. Type 'SystemAssigned' will use an implicitly created identity in master components and an auto-created user assigned identity in MC_ resource group in agent nodes. Type 'None' will not use MSI for the managed cluster, - service principal will be used instead. Known values are: "SystemAssigned", "UserAssigned", + service principal will be used instead. Known values are: "SystemAssigned", "UserAssigned", and "None". :vartype type: str or ~azure.mgmt.containerservice.v2020_09_01.models.ResourceIdentityType :ivar user_assigned_identities: The user identity associated with the managed cluster. This @@ -2631,22 +2635,27 @@ class ManagedClusterIdentity(msrest.serialization.Model): """ _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, + "principal_id": {"readonly": True}, + "tenant_id": {"readonly": True}, } _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{ManagedClusterIdentityUserAssignedIdentitiesValue}'}, + "principal_id": {"key": "principalId", "type": "str"}, + "tenant_id": {"key": "tenantId", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "user_assigned_identities": { + "key": "userAssignedIdentities", + "type": "{ManagedClusterIdentityUserAssignedIdentitiesValue}", + }, } def __init__( self, *, type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, - user_assigned_identities: Optional[Dict[str, "_models.ManagedClusterIdentityUserAssignedIdentitiesValue"]] = None, + user_assigned_identities: Optional[ + Dict[str, "_models.ManagedClusterIdentityUserAssignedIdentitiesValue"] + ] = None, **kwargs ): """ @@ -2654,7 +2663,7 @@ def __init__( use an implicitly created identity in master components and an auto-created user assigned identity in MC_ resource group in agent nodes. Type 'None' will not use MSI for the managed cluster, service principal will be used instead. Known values are: "SystemAssigned", - "UserAssigned", "None". + "UserAssigned", and "None". :paramtype type: str or ~azure.mgmt.containerservice.v2020_09_01.models.ResourceIdentityType :keyword user_assigned_identities: The user identity associated with the managed cluster. This identity will be used in control plane and only one user assigned identity is allowed. The user @@ -2663,14 +2672,14 @@ def __init__( :paramtype user_assigned_identities: dict[str, ~azure.mgmt.containerservice.v2020_09_01.models.ManagedClusterIdentityUserAssignedIdentitiesValue] """ - super(ManagedClusterIdentity, self).__init__(**kwargs) + super().__init__(**kwargs) self.principal_id = None self.tenant_id = None self.type = type self.user_assigned_identities = user_assigned_identities -class ManagedClusterIdentityUserAssignedIdentitiesValue(msrest.serialization.Model): +class ManagedClusterIdentityUserAssignedIdentitiesValue(_serialization.Model): """ManagedClusterIdentityUserAssignedIdentitiesValue. Variables are only populated by the server, and will be ignored when sending a request. @@ -2682,27 +2691,23 @@ class ManagedClusterIdentityUserAssignedIdentitiesValue(msrest.serialization.Mod """ _validation = { - 'principal_id': {'readonly': True}, - 'client_id': {'readonly': True}, + "principal_id": {"readonly": True}, + "client_id": {"readonly": True}, } _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, + "principal_id": {"key": "principalId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(ManagedClusterIdentityUserAssignedIdentitiesValue, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.principal_id = None self.client_id = None -class ManagedClusterListResult(msrest.serialization.Model): +class ManagedClusterListResult(_serialization.Model): """The response from the List Managed Clusters operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -2714,30 +2719,25 @@ class ManagedClusterListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[ManagedCluster]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[ManagedCluster]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.ManagedCluster"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.ManagedCluster"]] = None, **kwargs): """ :keyword value: The list of managed clusters. :paramtype value: list[~azure.mgmt.containerservice.v2020_09_01.models.ManagedCluster] """ - super(ManagedClusterListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class ManagedClusterLoadBalancerProfile(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfile(_serialization.Model): """Profile of the managed cluster load balancer. :ivar managed_outbound_i_ps: Desired managed outbound IPs for the cluster load balancer. @@ -2763,17 +2763,23 @@ class ManagedClusterLoadBalancerProfile(msrest.serialization.Model): """ _validation = { - 'allocated_outbound_ports': {'maximum': 64000, 'minimum': 0}, - 'idle_timeout_in_minutes': {'maximum': 120, 'minimum': 4}, + "allocated_outbound_ports": {"maximum": 64000, "minimum": 0}, + "idle_timeout_in_minutes": {"maximum": 120, "minimum": 4}, } _attribute_map = { - 'managed_outbound_i_ps': {'key': 'managedOutboundIPs', 'type': 'ManagedClusterLoadBalancerProfileManagedOutboundIPs'}, - 'outbound_ip_prefixes': {'key': 'outboundIPPrefixes', 'type': 'ManagedClusterLoadBalancerProfileOutboundIPPrefixes'}, - 'outbound_i_ps': {'key': 'outboundIPs', 'type': 'ManagedClusterLoadBalancerProfileOutboundIPs'}, - 'effective_outbound_i_ps': {'key': 'effectiveOutboundIPs', 'type': '[ResourceReference]'}, - 'allocated_outbound_ports': {'key': 'allocatedOutboundPorts', 'type': 'int'}, - 'idle_timeout_in_minutes': {'key': 'idleTimeoutInMinutes', 'type': 'int'}, + "managed_outbound_i_ps": { + "key": "managedOutboundIPs", + "type": "ManagedClusterLoadBalancerProfileManagedOutboundIPs", + }, + "outbound_ip_prefixes": { + "key": "outboundIPPrefixes", + "type": "ManagedClusterLoadBalancerProfileOutboundIPPrefixes", + }, + "outbound_i_ps": {"key": "outboundIPs", "type": "ManagedClusterLoadBalancerProfileOutboundIPs"}, + "effective_outbound_i_ps": {"key": "effectiveOutboundIPs", "type": "[ResourceReference]"}, + "allocated_outbound_ports": {"key": "allocatedOutboundPorts", "type": "int"}, + "idle_timeout_in_minutes": {"key": "idleTimeoutInMinutes", "type": "int"}, } def __init__( @@ -2783,8 +2789,8 @@ def __init__( outbound_ip_prefixes: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPPrefixes"] = None, outbound_i_ps: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPs"] = None, effective_outbound_i_ps: Optional[List["_models.ResourceReference"]] = None, - allocated_outbound_ports: Optional[int] = 0, - idle_timeout_in_minutes: Optional[int] = 30, + allocated_outbound_ports: int = 0, + idle_timeout_in_minutes: int = 30, **kwargs ): """ @@ -2810,7 +2816,7 @@ def __init__( must be in the range of 4 to 120 (inclusive). The default value is 30 minutes. :paramtype idle_timeout_in_minutes: int """ - super(ManagedClusterLoadBalancerProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.managed_outbound_i_ps = managed_outbound_i_ps self.outbound_ip_prefixes = outbound_ip_prefixes self.outbound_i_ps = outbound_i_ps @@ -2819,7 +2825,7 @@ def __init__( self.idle_timeout_in_minutes = idle_timeout_in_minutes -class ManagedClusterLoadBalancerProfileManagedOutboundIPs(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfileManagedOutboundIPs(_serialization.Model): """Desired managed outbound IPs for the cluster load balancer. :ivar count: Desired number of outbound IP created/managed by Azure for the cluster load @@ -2828,29 +2834,24 @@ class ManagedClusterLoadBalancerProfileManagedOutboundIPs(msrest.serialization.M """ _validation = { - 'count': {'maximum': 100, 'minimum': 1}, + "count": {"maximum": 100, "minimum": 1}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, + "count": {"key": "count", "type": "int"}, } - def __init__( - self, - *, - count: Optional[int] = 1, - **kwargs - ): + def __init__(self, *, count: int = 1, **kwargs): """ :keyword count: Desired number of outbound IP created/managed by Azure for the cluster load balancer. Allowed values must be in the range of 1 to 100 (inclusive). The default value is 1. :paramtype count: int """ - super(ManagedClusterLoadBalancerProfileManagedOutboundIPs, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count -class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(_serialization.Model): """Desired outbound IP Prefix resources for the cluster load balancer. :ivar public_ip_prefixes: A list of public IP prefix resources. @@ -2859,25 +2860,20 @@ class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(msrest.serialization.M """ _attribute_map = { - 'public_ip_prefixes': {'key': 'publicIPPrefixes', 'type': '[ResourceReference]'}, + "public_ip_prefixes": {"key": "publicIPPrefixes", "type": "[ResourceReference]"}, } - def __init__( - self, - *, - public_ip_prefixes: Optional[List["_models.ResourceReference"]] = None, - **kwargs - ): + def __init__(self, *, public_ip_prefixes: Optional[List["_models.ResourceReference"]] = None, **kwargs): """ :keyword public_ip_prefixes: A list of public IP prefix resources. :paramtype public_ip_prefixes: list[~azure.mgmt.containerservice.v2020_09_01.models.ResourceReference] """ - super(ManagedClusterLoadBalancerProfileOutboundIPPrefixes, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_ip_prefixes = public_ip_prefixes -class ManagedClusterLoadBalancerProfileOutboundIPs(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfileOutboundIPs(_serialization.Model): """Desired outbound IP resources for the cluster load balancer. :ivar public_i_ps: A list of public IP resources. @@ -2885,34 +2881,29 @@ class ManagedClusterLoadBalancerProfileOutboundIPs(msrest.serialization.Model): """ _attribute_map = { - 'public_i_ps': {'key': 'publicIPs', 'type': '[ResourceReference]'}, + "public_i_ps": {"key": "publicIPs", "type": "[ResourceReference]"}, } - def __init__( - self, - *, - public_i_ps: Optional[List["_models.ResourceReference"]] = None, - **kwargs - ): + def __init__(self, *, public_i_ps: Optional[List["_models.ResourceReference"]] = None, **kwargs): """ :keyword public_i_ps: A list of public IP resources. :paramtype public_i_ps: list[~azure.mgmt.containerservice.v2020_09_01.models.ResourceReference] """ - super(ManagedClusterLoadBalancerProfileOutboundIPs, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_i_ps = public_i_ps -class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): +class ManagedClusterPoolUpgradeProfile(_serialization.Model): """The list of available upgrade versions. All required parameters must be populated in order to send to Azure. - :ivar kubernetes_version: Required. Kubernetes version (major, minor, patch). + :ivar kubernetes_version: Kubernetes version (major, minor, patch). Required. :vartype kubernetes_version: str :ivar name: Pool name. :vartype name: str - :ivar os_type: Required. OsType to be used to specify os type. Choose from Linux and Windows. - Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to + Linux. Known values are: "Linux" and "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2020_09_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -2920,15 +2911,15 @@ class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): """ _validation = { - 'kubernetes_version': {'required': True}, - 'os_type': {'required': True}, + "kubernetes_version": {"required": True}, + "os_type": {"required": True}, } _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'upgrades': {'key': 'upgrades', 'type': '[ManagedClusterPoolUpgradeProfileUpgradesItem]'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "os_type": {"key": "osType", "type": "str"}, + "upgrades": {"key": "upgrades", "type": "[ManagedClusterPoolUpgradeProfileUpgradesItem]"}, } def __init__( @@ -2941,25 +2932,25 @@ def __init__( **kwargs ): """ - :keyword kubernetes_version: Required. Kubernetes version (major, minor, patch). + :keyword kubernetes_version: Kubernetes version (major, minor, patch). Required. :paramtype kubernetes_version: str :keyword name: Pool name. :paramtype name: str - :keyword os_type: Required. OsType to be used to specify os type. Choose from Linux and - Windows. Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default + to Linux. Known values are: "Linux" and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2020_09_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: list[~azure.mgmt.containerservice.v2020_09_01.models.ManagedClusterPoolUpgradeProfileUpgradesItem] """ - super(ManagedClusterPoolUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.name = name self.os_type = os_type self.upgrades = upgrades -class ManagedClusterPoolUpgradeProfileUpgradesItem(msrest.serialization.Model): +class ManagedClusterPoolUpgradeProfileUpgradesItem(_serialization.Model): """ManagedClusterPoolUpgradeProfileUpgradesItem. :ivar kubernetes_version: Kubernetes version (major, minor, patch). @@ -2969,34 +2960,28 @@ class ManagedClusterPoolUpgradeProfileUpgradesItem(msrest.serialization.Model): """ _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } - def __init__( - self, - *, - kubernetes_version: Optional[str] = None, - is_preview: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, kubernetes_version: Optional[str] = None, is_preview: Optional[bool] = None, **kwargs): """ :keyword kubernetes_version: Kubernetes version (major, minor, patch). :paramtype kubernetes_version: str :keyword is_preview: Whether Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(ManagedClusterPoolUpgradeProfileUpgradesItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.is_preview = is_preview -class ManagedClusterPropertiesAutoScalerProfile(msrest.serialization.Model): +class ManagedClusterPropertiesAutoScalerProfile(_serialization.Model): # pylint: disable=too-many-instance-attributes """Parameters to be applied to the cluster-autoscaler when enabled. :ivar balance_similar_node_groups: :vartype balance_similar_node_groups: str - :ivar expander: Known values are: "least-waste", "most-pods", "random". + :ivar expander: Known values are: "least-waste", "most-pods", and "random". :vartype expander: str or ~azure.mgmt.containerservice.v2020_09_01.models.Expander :ivar max_empty_bulk_delete: :vartype max_empty_bulk_delete: str @@ -3029,22 +3014,22 @@ class ManagedClusterPropertiesAutoScalerProfile(msrest.serialization.Model): """ _attribute_map = { - 'balance_similar_node_groups': {'key': 'balance-similar-node-groups', 'type': 'str'}, - 'expander': {'key': 'expander', 'type': 'str'}, - 'max_empty_bulk_delete': {'key': 'max-empty-bulk-delete', 'type': 'str'}, - 'max_graceful_termination_sec': {'key': 'max-graceful-termination-sec', 'type': 'str'}, - 'max_total_unready_percentage': {'key': 'max-total-unready-percentage', 'type': 'str'}, - 'new_pod_scale_up_delay': {'key': 'new-pod-scale-up-delay', 'type': 'str'}, - 'ok_total_unready_count': {'key': 'ok-total-unready-count', 'type': 'str'}, - 'scan_interval': {'key': 'scan-interval', 'type': 'str'}, - 'scale_down_delay_after_add': {'key': 'scale-down-delay-after-add', 'type': 'str'}, - 'scale_down_delay_after_delete': {'key': 'scale-down-delay-after-delete', 'type': 'str'}, - 'scale_down_delay_after_failure': {'key': 'scale-down-delay-after-failure', 'type': 'str'}, - 'scale_down_unneeded_time': {'key': 'scale-down-unneeded-time', 'type': 'str'}, - 'scale_down_unready_time': {'key': 'scale-down-unready-time', 'type': 'str'}, - 'scale_down_utilization_threshold': {'key': 'scale-down-utilization-threshold', 'type': 'str'}, - 'skip_nodes_with_local_storage': {'key': 'skip-nodes-with-local-storage', 'type': 'str'}, - 'skip_nodes_with_system_pods': {'key': 'skip-nodes-with-system-pods', 'type': 'str'}, + "balance_similar_node_groups": {"key": "balance-similar-node-groups", "type": "str"}, + "expander": {"key": "expander", "type": "str"}, + "max_empty_bulk_delete": {"key": "max-empty-bulk-delete", "type": "str"}, + "max_graceful_termination_sec": {"key": "max-graceful-termination-sec", "type": "str"}, + "max_total_unready_percentage": {"key": "max-total-unready-percentage", "type": "str"}, + "new_pod_scale_up_delay": {"key": "new-pod-scale-up-delay", "type": "str"}, + "ok_total_unready_count": {"key": "ok-total-unready-count", "type": "str"}, + "scan_interval": {"key": "scan-interval", "type": "str"}, + "scale_down_delay_after_add": {"key": "scale-down-delay-after-add", "type": "str"}, + "scale_down_delay_after_delete": {"key": "scale-down-delay-after-delete", "type": "str"}, + "scale_down_delay_after_failure": {"key": "scale-down-delay-after-failure", "type": "str"}, + "scale_down_unneeded_time": {"key": "scale-down-unneeded-time", "type": "str"}, + "scale_down_unready_time": {"key": "scale-down-unready-time", "type": "str"}, + "scale_down_utilization_threshold": {"key": "scale-down-utilization-threshold", "type": "str"}, + "skip_nodes_with_local_storage": {"key": "skip-nodes-with-local-storage", "type": "str"}, + "skip_nodes_with_system_pods": {"key": "skip-nodes-with-system-pods", "type": "str"}, } def __init__( @@ -3071,7 +3056,7 @@ def __init__( """ :keyword balance_similar_node_groups: :paramtype balance_similar_node_groups: str - :keyword expander: Known values are: "least-waste", "most-pods", "random". + :keyword expander: Known values are: "least-waste", "most-pods", and "random". :paramtype expander: str or ~azure.mgmt.containerservice.v2020_09_01.models.Expander :keyword max_empty_bulk_delete: :paramtype max_empty_bulk_delete: str @@ -3102,7 +3087,7 @@ def __init__( :keyword skip_nodes_with_system_pods: :paramtype skip_nodes_with_system_pods: str """ - super(ManagedClusterPropertiesAutoScalerProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.balance_similar_node_groups = balance_similar_node_groups self.expander = expander self.max_empty_bulk_delete = max_empty_bulk_delete @@ -3133,9 +3118,9 @@ class ManagedClusterPropertiesIdentityProfileValue(UserAssignedIdentity): """ _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'object_id': {'key': 'objectId', 'type': 'str'}, + "resource_id": {"key": "resourceId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + "object_id": {"key": "objectId", "type": "str"}, } def __init__( @@ -3154,59 +3139,53 @@ def __init__( :keyword object_id: The object id of the user assigned identity. :paramtype object_id: str """ - super(ManagedClusterPropertiesIdentityProfileValue, self).__init__(resource_id=resource_id, client_id=client_id, object_id=object_id, **kwargs) + super().__init__(resource_id=resource_id, client_id=client_id, object_id=object_id, **kwargs) -class ManagedClusterServicePrincipalProfile(msrest.serialization.Model): +class ManagedClusterServicePrincipalProfile(_serialization.Model): """Information about a service principal identity for the cluster to use for manipulating Azure APIs. All required parameters must be populated in order to send to Azure. - :ivar client_id: Required. The ID for the service principal. + :ivar client_id: The ID for the service principal. Required. :vartype client_id: str :ivar secret: The secret password associated with the service principal in plain text. :vartype secret: str """ _validation = { - 'client_id': {'required': True}, + "client_id": {"required": True}, } _attribute_map = { - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'secret': {'key': 'secret', 'type': 'str'}, + "client_id": {"key": "clientId", "type": "str"}, + "secret": {"key": "secret", "type": "str"}, } - def __init__( - self, - *, - client_id: str, - secret: Optional[str] = None, - **kwargs - ): + def __init__(self, *, client_id: str, secret: Optional[str] = None, **kwargs): """ - :keyword client_id: Required. The ID for the service principal. + :keyword client_id: The ID for the service principal. Required. :paramtype client_id: str :keyword secret: The secret password associated with the service principal in plain text. :paramtype secret: str """ - super(ManagedClusterServicePrincipalProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.client_id = client_id self.secret = secret -class ManagedClusterSKU(msrest.serialization.Model): +class ManagedClusterSKU(_serialization.Model): """ManagedClusterSKU. - :ivar name: Name of a managed cluster SKU. Known values are: "Basic". + :ivar name: Name of a managed cluster SKU. "Basic" :vartype name: str or ~azure.mgmt.containerservice.v2020_09_01.models.ManagedClusterSKUName - :ivar tier: Tier of a managed cluster SKU. Known values are: "Paid", "Free". + :ivar tier: Tier of a managed cluster SKU. Known values are: "Paid" and "Free". :vartype tier: str or ~azure.mgmt.containerservice.v2020_09_01.models.ManagedClusterSKUTier """ _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, + "name": {"key": "name", "type": "str"}, + "tier": {"key": "tier", "type": "str"}, } def __init__( @@ -3217,17 +3196,17 @@ def __init__( **kwargs ): """ - :keyword name: Name of a managed cluster SKU. Known values are: "Basic". + :keyword name: Name of a managed cluster SKU. "Basic" :paramtype name: str or ~azure.mgmt.containerservice.v2020_09_01.models.ManagedClusterSKUName - :keyword tier: Tier of a managed cluster SKU. Known values are: "Paid", "Free". + :keyword tier: Tier of a managed cluster SKU. Known values are: "Paid" and "Free". :paramtype tier: str or ~azure.mgmt.containerservice.v2020_09_01.models.ManagedClusterSKUTier """ - super(ManagedClusterSKU, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.tier = tier -class ManagedClusterUpgradeProfile(msrest.serialization.Model): +class ManagedClusterUpgradeProfile(_serialization.Model): """The list of available upgrades for compute pools. Variables are only populated by the server, and will be ignored when sending a request. @@ -3240,29 +3219,29 @@ class ManagedClusterUpgradeProfile(msrest.serialization.Model): :vartype name: str :ivar type: Type of upgrade profile. :vartype type: str - :ivar control_plane_profile: Required. The list of available upgrade versions for the control - plane. + :ivar control_plane_profile: The list of available upgrade versions for the control plane. + Required. :vartype control_plane_profile: ~azure.mgmt.containerservice.v2020_09_01.models.ManagedClusterPoolUpgradeProfile - :ivar agent_pool_profiles: Required. The list of available upgrade versions for agent pools. + :ivar agent_pool_profiles: The list of available upgrade versions for agent pools. Required. :vartype agent_pool_profiles: list[~azure.mgmt.containerservice.v2020_09_01.models.ManagedClusterPoolUpgradeProfile] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'control_plane_profile': {'required': True}, - 'agent_pool_profiles': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "control_plane_profile": {"required": True}, + "agent_pool_profiles": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'control_plane_profile': {'key': 'properties.controlPlaneProfile', 'type': 'ManagedClusterPoolUpgradeProfile'}, - 'agent_pool_profiles': {'key': 'properties.agentPoolProfiles', 'type': '[ManagedClusterPoolUpgradeProfile]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "control_plane_profile": {"key": "properties.controlPlaneProfile", "type": "ManagedClusterPoolUpgradeProfile"}, + "agent_pool_profiles": {"key": "properties.agentPoolProfiles", "type": "[ManagedClusterPoolUpgradeProfile]"}, } def __init__( @@ -3273,15 +3252,15 @@ def __init__( **kwargs ): """ - :keyword control_plane_profile: Required. The list of available upgrade versions for the - control plane. + :keyword control_plane_profile: The list of available upgrade versions for the control plane. + Required. :paramtype control_plane_profile: ~azure.mgmt.containerservice.v2020_09_01.models.ManagedClusterPoolUpgradeProfile - :keyword agent_pool_profiles: Required. The list of available upgrade versions for agent pools. + :keyword agent_pool_profiles: The list of available upgrade versions for agent pools. Required. :paramtype agent_pool_profiles: list[~azure.mgmt.containerservice.v2020_09_01.models.ManagedClusterPoolUpgradeProfile] """ - super(ManagedClusterUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -3289,18 +3268,18 @@ def __init__( self.agent_pool_profiles = agent_pool_profiles -class ManagedClusterWindowsProfile(msrest.serialization.Model): +class ManagedClusterWindowsProfile(_serialization.Model): """Profile for Windows VMs in the container service cluster. All required parameters must be populated in order to send to Azure. - :ivar admin_username: Required. Specifies the name of the administrator account. - :code:`
`:code:`
` **restriction:** Cannot end in "." :code:`
`:code:`
` - **Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", "test1", - "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", - "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", - "sys", "test2", "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 - character :code:`
`:code:`
` **Max-length:** 20 characters. + :ivar admin_username: Specifies the name of the administrator account. :code:`
`:code:`
` + **restriction:** Cannot end in "." :code:`
`:code:`
` **Disallowed values:** + "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", + "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", + "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", + "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 character + :code:`
`:code:`
` **Max-length:** 20 characters. Required. :vartype admin_username: str :ivar admin_password: Specifies the password of the administrator account. :code:`
`:code:`
` **Minimum-length:** 8 characters :code:`
`:code:`
` @@ -3311,18 +3290,18 @@ class ManagedClusterWindowsProfile(msrest.serialization.Model): "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!". :vartype admin_password: str :ivar license_type: The licenseType to use for Windows VMs. Windows_Server is used to enable - Azure Hybrid User Benefits for Windows VMs. Known values are: "None", "Windows_Server". + Azure Hybrid User Benefits for Windows VMs. Known values are: "None" and "Windows_Server". :vartype license_type: str or ~azure.mgmt.containerservice.v2020_09_01.models.LicenseType """ _validation = { - 'admin_username': {'required': True}, + "admin_username": {"required": True}, } _attribute_map = { - 'admin_username': {'key': 'adminUsername', 'type': 'str'}, - 'admin_password': {'key': 'adminPassword', 'type': 'str'}, - 'license_type': {'key': 'licenseType', 'type': 'str'}, + "admin_username": {"key": "adminUsername", "type": "str"}, + "admin_password": {"key": "adminPassword", "type": "str"}, + "license_type": {"key": "licenseType", "type": "str"}, } def __init__( @@ -3334,13 +3313,13 @@ def __init__( **kwargs ): """ - :keyword admin_username: Required. Specifies the name of the administrator account. + :keyword admin_username: Specifies the name of the administrator account. :code:`
`:code:`
` **restriction:** Cannot end in "." :code:`
`:code:`
` **Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 - character :code:`
`:code:`
` **Max-length:** 20 characters. + character :code:`
`:code:`
` **Max-length:** 20 characters. Required. :paramtype admin_username: str :keyword admin_password: Specifies the password of the administrator account. :code:`
`:code:`
` **Minimum-length:** 8 characters :code:`
`:code:`
` @@ -3351,16 +3330,16 @@ def __init__( "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!". :paramtype admin_password: str :keyword license_type: The licenseType to use for Windows VMs. Windows_Server is used to enable - Azure Hybrid User Benefits for Windows VMs. Known values are: "None", "Windows_Server". + Azure Hybrid User Benefits for Windows VMs. Known values are: "None" and "Windows_Server". :paramtype license_type: str or ~azure.mgmt.containerservice.v2020_09_01.models.LicenseType """ - super(ManagedClusterWindowsProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.admin_username = admin_username self.admin_password = admin_password self.license_type = license_type -class OperationListResult(msrest.serialization.Model): +class OperationListResult(_serialization.Model): """The List Compute Operation operation response. Variables are only populated by the server, and will be ignored when sending a request. @@ -3370,24 +3349,20 @@ class OperationListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[OperationValue]'}, + "value": {"key": "value", "type": "[OperationValue]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(OperationListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None -class OperationValue(msrest.serialization.Model): +class OperationValue(_serialization.Model): """Describes the properties of a Compute Operation value. Variables are only populated by the server, and will be ignored when sending a request. @@ -3407,30 +3382,26 @@ class OperationValue(msrest.serialization.Model): """ _validation = { - 'origin': {'readonly': True}, - 'name': {'readonly': True}, - 'operation': {'readonly': True}, - 'resource': {'readonly': True}, - 'description': {'readonly': True}, - 'provider': {'readonly': True}, + "origin": {"readonly": True}, + "name": {"readonly": True}, + "operation": {"readonly": True}, + "resource": {"readonly": True}, + "description": {"readonly": True}, + "provider": {"readonly": True}, } _attribute_map = { - 'origin': {'key': 'origin', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'operation': {'key': 'display.operation', 'type': 'str'}, - 'resource': {'key': 'display.resource', 'type': 'str'}, - 'description': {'key': 'display.description', 'type': 'str'}, - 'provider': {'key': 'display.provider', 'type': 'str'}, + "origin": {"key": "origin", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "operation": {"key": "display.operation", "type": "str"}, + "resource": {"key": "display.resource", "type": "str"}, + "description": {"key": "display.description", "type": "str"}, + "provider": {"key": "display.provider", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(OperationValue, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.origin = None self.name = None self.operation = None @@ -3439,34 +3410,29 @@ def __init__( self.provider = None -class PowerState(msrest.serialization.Model): +class PowerState(_serialization.Model): """Describes the Power State of the cluster. - :ivar code: Tells whether the cluster is Running or Stopped. Known values are: "Running", + :ivar code: Tells whether the cluster is Running or Stopped. Known values are: "Running" and "Stopped". :vartype code: str or ~azure.mgmt.containerservice.v2020_09_01.models.Code """ _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, + "code": {"key": "code", "type": "str"}, } - def __init__( - self, - *, - code: Optional[Union[str, "_models.Code"]] = None, - **kwargs - ): + def __init__(self, *, code: Optional[Union[str, "_models.Code"]] = None, **kwargs): """ - :keyword code: Tells whether the cluster is Running or Stopped. Known values are: "Running", + :keyword code: Tells whether the cluster is Running or Stopped. Known values are: "Running" and "Stopped". :paramtype code: str or ~azure.mgmt.containerservice.v2020_09_01.models.Code """ - super(PowerState, self).__init__(**kwargs) + super().__init__(**kwargs) self.code = code -class PrivateEndpoint(msrest.serialization.Model): +class PrivateEndpoint(_serialization.Model): """Private endpoint which a connection belongs to. :ivar id: The resource Id for private endpoint. @@ -3474,24 +3440,19 @@ class PrivateEndpoint(msrest.serialization.Model): """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, } - def __init__( - self, - *, - id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin """ :keyword id: The resource Id for private endpoint. :paramtype id: str """ - super(PrivateEndpoint, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id -class PrivateEndpointConnection(msrest.serialization.Model): +class PrivateEndpointConnection(_serialization.Model): """A private endpoint connection. Variables are only populated by the server, and will be ignored when sending a request. @@ -3503,7 +3464,7 @@ class PrivateEndpointConnection(msrest.serialization.Model): :ivar type: The resource type. :vartype type: str :ivar provisioning_state: The current provisioning state. Known values are: "Succeeded", - "Creating", "Deleting", "Failed". + "Creating", "Deleting", and "Failed". :vartype provisioning_state: str or ~azure.mgmt.containerservice.v2020_09_01.models.PrivateEndpointConnectionProvisioningState :ivar private_endpoint: The resource of private endpoint. @@ -3515,19 +3476,22 @@ class PrivateEndpointConnection(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'provisioning_state': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, - 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "private_endpoint": {"key": "properties.privateEndpoint", "type": "PrivateEndpoint"}, + "private_link_service_connection_state": { + "key": "properties.privateLinkServiceConnectionState", + "type": "PrivateLinkServiceConnectionState", + }, } def __init__( @@ -3545,7 +3509,7 @@ def __init__( :paramtype private_link_service_connection_state: ~azure.mgmt.containerservice.v2020_09_01.models.PrivateLinkServiceConnectionState """ - super(PrivateEndpointConnection, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -3554,7 +3518,7 @@ def __init__( self.private_link_service_connection_state = private_link_service_connection_state -class PrivateEndpointConnectionListResult(msrest.serialization.Model): +class PrivateEndpointConnectionListResult(_serialization.Model): """A list of private endpoint connections. :ivar value: The collection value. @@ -3562,25 +3526,20 @@ class PrivateEndpointConnectionListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, + "value": {"key": "value", "type": "[PrivateEndpointConnection]"}, } - def __init__( - self, - *, - value: Optional[List["_models.PrivateEndpointConnection"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.PrivateEndpointConnection"]] = None, **kwargs): """ :keyword value: The collection value. :paramtype value: list[~azure.mgmt.containerservice.v2020_09_01.models.PrivateEndpointConnection] """ - super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value -class PrivateLinkResource(msrest.serialization.Model): +class PrivateLinkResource(_serialization.Model): """A private link resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -3601,22 +3560,22 @@ class PrivateLinkResource(msrest.serialization.Model): """ _validation = { - 'private_link_service_id': {'readonly': True}, + "private_link_service_id": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'group_id': {'key': 'groupId', 'type': 'str'}, - 'required_members': {'key': 'requiredMembers', 'type': '[str]'}, - 'private_link_service_id': {'key': 'privateLinkServiceID', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "group_id": {"key": "groupId", "type": "str"}, + "required_members": {"key": "requiredMembers", "type": "[str]"}, + "private_link_service_id": {"key": "privateLinkServiceID", "type": "str"}, } def __init__( self, *, - id: Optional[str] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin name: Optional[str] = None, type: Optional[str] = None, group_id: Optional[str] = None, @@ -3635,7 +3594,7 @@ def __init__( :keyword required_members: RequiredMembers of the resource. :paramtype required_members: list[str] """ - super(PrivateLinkResource, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id self.name = name self.type = type @@ -3644,7 +3603,7 @@ def __init__( self.private_link_service_id = None -class PrivateLinkResourcesListResult(msrest.serialization.Model): +class PrivateLinkResourcesListResult(_serialization.Model): """A list of private link resources. :ivar value: The collection value. @@ -3652,36 +3611,31 @@ class PrivateLinkResourcesListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, + "value": {"key": "value", "type": "[PrivateLinkResource]"}, } - def __init__( - self, - *, - value: Optional[List["_models.PrivateLinkResource"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.PrivateLinkResource"]] = None, **kwargs): """ :keyword value: The collection value. :paramtype value: list[~azure.mgmt.containerservice.v2020_09_01.models.PrivateLinkResource] """ - super(PrivateLinkResourcesListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value -class PrivateLinkServiceConnectionState(msrest.serialization.Model): +class PrivateLinkServiceConnectionState(_serialization.Model): """The state of a private link service connection. :ivar status: The private link service connection status. Known values are: "Pending", - "Approved", "Rejected", "Disconnected". + "Approved", "Rejected", and "Disconnected". :vartype status: str or ~azure.mgmt.containerservice.v2020_09_01.models.ConnectionStatus :ivar description: The private link service connection description. :vartype description: str """ _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, + "status": {"key": "status", "type": "str"}, + "description": {"key": "description", "type": "str"}, } def __init__( @@ -3693,17 +3647,17 @@ def __init__( ): """ :keyword status: The private link service connection status. Known values are: "Pending", - "Approved", "Rejected", "Disconnected". + "Approved", "Rejected", and "Disconnected". :paramtype status: str or ~azure.mgmt.containerservice.v2020_09_01.models.ConnectionStatus :keyword description: The private link service connection description. :paramtype description: str """ - super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) + super().__init__(**kwargs) self.status = status self.description = description -class ResourceReference(msrest.serialization.Model): +class ResourceReference(_serialization.Model): """A reference to an Azure resource. :ivar id: The fully qualified Azure resource id. @@ -3711,43 +3665,33 @@ class ResourceReference(msrest.serialization.Model): """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, } - def __init__( - self, - *, - id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin """ :keyword id: The fully qualified Azure resource id. :paramtype id: str """ - super(ResourceReference, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id -class TagsObject(msrest.serialization.Model): +class TagsObject(_serialization.Model): """Tags object for patch operations. - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] """ _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] """ - super(TagsObject, self).__init__(**kwargs) + super().__init__(**kwargs) self.tags = tags diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/models/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/models/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/models/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/models/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/operations/__init__.py index eb76d54a688d..160f4be0e9d7 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/operations/__init__.py @@ -16,13 +16,14 @@ from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'Operations', - 'ManagedClustersOperations', - 'AgentPoolsOperations', - 'PrivateEndpointConnectionsOperations', - 'PrivateLinkResourcesOperations', - 'ResolvePrivateLinkServiceIdOperations', + "Operations", + "ManagedClustersOperations", + "AgentPoolsOperations", + "PrivateEndpointConnectionsOperations", + "PrivateLinkResourcesOperations", + "ResolvePrivateLinkServiceIdOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/operations/_agent_pools_operations.py index 5e1f510fa0c8..ca408ec87598 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/operations/_agent_pools_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,288 +27,289 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - *, - json: Optional[_models.AgentPool] = None, - content: Any = None, - **kwargs: Any + _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, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + _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, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_get_upgrade_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_available_agent_pool_versions_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_upgrade_node_image_version_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_upgrade_node_image_version_request( + resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class AgentPoolsOperations: """ @@ -324,48 +330,40 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> Iterable[_models.AgentPoolListResult]: + def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> Iterable["_models.AgentPool"]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. The operation returns properties of each agent pool. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AgentPoolListResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_09_01.models.AgentPoolListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either AgentPool or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_09_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -373,16 +371,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -398,10 +391,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -411,54 +402,45 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore @distributed_trace def get( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPool: """Gets the agent pool. Gets the details of the agent pool by managed cluster and resource group. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPool, or the result of cls(response) + :return: AgentPool or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_09_01.models.AgentPool - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -466,57 +448,60 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore def _create_or_update_initial( self, resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: _models.AgentPool, + parameters: Union[_models.AgentPool, IO], **kwargs: Any ) -> _models.AgentPool: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - _json = self._serialize.body(parameters, 'AgentPool') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "AgentPool") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -524,10 +509,9 @@ def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -535,40 +519,125 @@ def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - @distributed_trace + @overload def begin_create_or_update( self, resource_group_name: str, resource_name: str, agent_pool_name: str, parameters: _models.AgentPool, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.AgentPool]: """Creates or updates an agent pool. Creates or updates an agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :param parameters: Parameters supplied to the Create or Update an agent pool operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2020_09_01.models.AgentPool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_09_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AgentPool]: + """Creates or updates an agent pool. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: Parameters supplied to the Create or Update an agent pool operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_09_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: Union[_models.AgentPool, IO], + **kwargs: Any + ) -> LROPoller[_models.AgentPool]: + """Creates or updates an agent pool. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: Parameters supplied to the Create or Update an agent pool operation. Is + either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2020_09_01.models.AgentPool or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -580,20 +649,17 @@ def begin_create_or_update( :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_09_01.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -602,66 +668,55 @@ def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -669,10 +724,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -682,26 +736,21 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + def begin_delete( + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> LROPoller[None]: """Deletes an agent pool. Deletes the agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -713,100 +762,86 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPoolUpgradeProfile: """Gets upgrade profile for an agent pool. Gets the details of the upgrade profile for an agent pool with a specified resource group and managed cluster name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolUpgradeProfile, or the result of cls(response) + :return: AgentPoolUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_09_01.models.AgentPoolUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -814,64 +849,56 @@ def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolUpgradeProfile', pipeline_response) + deserialized = self._deserialize("AgentPoolUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore @distributed_trace def get_available_agent_pool_versions( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported versions for the specified agent pool. Gets a list of supported versions for the specified agent pool. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolAvailableVersions, or the result of cls(response) + :return: AgentPoolAvailableVersions or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_09_01.models.AgentPoolAvailableVersions - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolAvailableVersions] - request = build_get_available_agent_pool_versions_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_available_agent_pool_versions.metadata['url'], + template_url=self.get_available_agent_pool_versions.metadata["url"], headers=_headers, params=_params, ) @@ -879,52 +906,43 @@ def get_available_agent_pool_versions( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolAvailableVersions', pipeline_response) + deserialized = self._deserialize("AgentPoolAvailableVersions", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_available_agent_pool_versions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore - + get_available_agent_pool_versions.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore def _upgrade_node_image_version_initial( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> Optional[_models.AgentPool]: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.AgentPool]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.AgentPool]] - - request = build_upgrade_node_image_version_request_initial( - subscription_id=self._config.subscription_id, + request = build_upgrade_node_image_version_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._upgrade_node_image_version_initial.metadata['url'], + template_url=self._upgrade_node_image_version_initial.metadata["url"], headers=_headers, params=_params, ) @@ -932,10 +950,9 @@ def _upgrade_node_image_version_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -944,33 +961,28 @@ def _upgrade_node_image_version_initial( deserialized = None if response.status_code == 202: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _upgrade_node_image_version_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore - + _upgrade_node_image_version_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore @distributed_trace def begin_upgrade_node_image_version( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any - ) -> LROPoller[_models.AgentPool]: + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any + ) -> LROPoller[None]: """Upgrade node image version of an agent pool to the latest. Upgrade node image version of an agent pool to the latest. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -983,55 +995,48 @@ def begin_upgrade_node_image_version( :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_09_01.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._upgrade_node_image_version_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_upgrade_node_image_version.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore + begin_upgrade_node_image_version.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/operations/_managed_clusters_operations.py index 568aaaef0364..a2aab5ad864d 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/operations/_managed_clusters_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,631 +27,612 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters") + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters" + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_resource_group_request( - subscription_id: str, - resource_group_name: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters", + ) # 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', min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_upgrade_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_access_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, role_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 = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "roleName": _SERIALIZER.url("role_name", role_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "roleName": _SERIALIZER.url("role_name", role_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_admin_credentials_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_user_credentials_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_monitoring_user_credentials_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: + +def build_get_request(resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedCluster] = None, - content: Any = None, - **kwargs: Any + +def build_create_or_update_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_update_tags_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.TagsObject] = None, - content: Any = None, - **kwargs: Any + +def build_update_tags_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any +def build_delete_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_reset_service_principal_profile_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedClusterServicePrincipalProfile] = None, - content: Any = None, - **kwargs: Any +def build_reset_service_principal_profile_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_reset_aad_profile_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedClusterAADProfile] = None, - content: Any = None, - **kwargs: Any +def build_reset_aad_profile_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_rotate_cluster_certificates_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any +def build_rotate_cluster_certificates_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_stop_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + +def build_stop_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_start_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + +def build_start_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + class ManagedClustersOperations: # pylint: disable=too-many-public-methods """ @@ -667,41 +653,35 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.ManagedClusterListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.ManagedCluster"]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. The operation returns properties of each managed cluster. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_09_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_09_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -709,14 +689,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -732,10 +709,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -745,50 +720,42 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> Iterable[_models.ManagedClusterListResult]: + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.ManagedCluster"]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. The operation returns properties of each managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_09_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_09_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -796,15 +763,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -820,10 +783,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -833,51 +794,43 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.ManagedClusterUpgradeProfile: """Gets upgrade profile for a managed cluster. Gets the details of the upgrade profile for a managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterUpgradeProfile, or the result of cls(response) + :return: ManagedClusterUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_09_01.models.ManagedClusterUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -885,33 +838,27 @@ def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterUpgradeProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore @distributed_trace def get_access_profile( - self, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, role_name: str, **kwargs: Any ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. @@ -922,36 +869,33 @@ def get_access_profile( `ListClusterAdminCredentials `_ . - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param role_name: The name of the role for managed cluster accessProfile resource. + :param role_name: The name of the role for managed cluster accessProfile resource. Required. :type role_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterAccessProfile, or the result of cls(response) + :return: ManagedClusterAccessProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_09_01.models.ManagedClusterAccessProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterAccessProfile] - request = build_get_access_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, role_name=role_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_access_profile.metadata['url'], + template_url=self.get_access_profile.metadata["url"], headers=_headers, params=_params, ) @@ -959,64 +903,56 @@ def get_access_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterAccessProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterAccessProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_access_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore - + get_access_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore @distributed_trace def list_cluster_admin_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster admin credential of a managed cluster. Gets cluster admin credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_09_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_admin_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_admin_credentials.metadata['url'], + template_url=self.list_cluster_admin_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -1024,64 +960,56 @@ def list_cluster_admin_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_admin_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore - + list_cluster_admin_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore @distributed_trace def list_cluster_user_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster user credential of a managed cluster. Gets cluster user credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_09_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_user_credentials.metadata['url'], + template_url=self.list_cluster_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -1089,65 +1017,57 @@ def list_cluster_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore - + list_cluster_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore @distributed_trace def list_cluster_monitoring_user_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster monitoring user credential of a managed cluster. Gets cluster monitoring user credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_09_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_monitoring_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + template_url=self.list_cluster_monitoring_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -1155,64 +1075,54 @@ def list_cluster_monitoring_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_monitoring_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore - + list_cluster_monitoring_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore @distributed_trace - def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.ManagedCluster: + def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.ManagedCluster: """Gets a managed cluster. Gets the details of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedCluster, or the result of cls(response) + :return: ManagedCluster or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_09_01.models.ManagedCluster - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -1220,55 +1130,54 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _create_or_update_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.ManagedCluster, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'ManagedCluster') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedCluster") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1276,10 +1185,9 @@ def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -1287,25 +1195,26 @@ def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - @distributed_trace + @overload def begin_create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedCluster, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. @@ -1313,12 +1222,90 @@ def begin_create_or_update( Creates or updates a managed cluster with the specified configuration for agents and Kubernetes version. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2020_09_01.models.ManagedCluster + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_09_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster with the specified configuration for agents and Kubernetes + version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_09_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster with the specified configuration for agents and Kubernetes + version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. Is + either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2020_09_01.models.ManagedCluster or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1331,20 +1318,17 @@ def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_09_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -1352,69 +1336,66 @@ def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _update_tags_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.TagsObject, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request_initial( - subscription_id=self._config.subscription_id, + request = build_update_tags_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_tags_initial.metadata['url'], + content=_content, + template_url=self._update_tags_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1422,44 +1403,118 @@ def _update_tags_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_tags_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + _update_tags_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - - @distributed_trace + @overload def begin_update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates a managed cluster with the specified tags. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2020_09_01.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_09_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates a managed cluster with the specified tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_09_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates a managed cluster with the specified tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2020_09_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1472,20 +1527,17 @@ def begin_update_tags( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_09_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, @@ -1493,64 +1545,54 @@ def begin_update_tags( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1558,10 +1600,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1571,23 +1612,17 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> LROPoller[None]: + def begin_delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> LROPoller[None]: """Deletes a managed cluster. Deletes the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1599,85 +1634,83 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterServicePrincipalProfile, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterServicePrincipalProfile") - request = build_reset_service_principal_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_service_principal_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_service_principal_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_service_principal_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1685,10 +1718,9 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1698,29 +1730,33 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re if cls: return cls(pipeline_response, None, {}) - _reset_service_principal_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + _reset_service_principal_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore - - @distributed_trace - def begin_reset_service_principal_profile( # pylint: disable=inconsistent-return-statements + @overload + def begin_reset_service_principal_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterServicePrincipalProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: """Reset Service Principal Profile of a managed cluster. Update the service principal Profile for a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a - Managed Cluster. + Managed Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2020_09_01.models.ManagedClusterServicePrincipalProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1731,20 +1767,90 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reset Service Principal Profile of a managed cluster. + + Update the service principal Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a + Managed Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Reset Service Principal Profile of a managed cluster. + + Update the service principal Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a + Managed Cluster. Is either a model type or a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2020_09_01.models.ManagedClusterServicePrincipalProfile or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1752,67 +1858,68 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_service_principal_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + begin_reset_service_principal_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterAADProfile, + parameters: Union[_models.ManagedClusterAADProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterAADProfile") - request = build_reset_aad_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_aad_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_aad_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_aad_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1820,10 +1927,9 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1833,28 +1939,105 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement if cls: return cls(pipeline_response, None, {}) - _reset_aad_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - + _reset_aad_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - @distributed_trace - def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements + @overload + def begin_reset_aad_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterAADProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: """Reset AAD Profile of a managed cluster. Update the AAD Profile for a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed - Cluster. + Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2020_09_01.models.ManagedClusterAADProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reset AAD Profile of a managed cluster. + + Update the AAD Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed + Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterAADProfile, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Reset AAD Profile of a managed cluster. + + Update the AAD Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed + Cluster. Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2020_09_01.models.ManagedClusterAADProfile or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1865,20 +2048,17 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1886,62 +2066,52 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_aad_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + begin_reset_aad_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_rotate_cluster_certificates_request_initial( - subscription_id=self._config.subscription_id, + request = build_rotate_cluster_certificates_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._rotate_cluster_certificates_initial.metadata['url'], + template_url=self._rotate_cluster_certificates_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1949,10 +2119,9 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1962,23 +2131,19 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return if cls: return cls(pipeline_response, None, {}) - _rotate_cluster_certificates_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore - + _rotate_cluster_certificates_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore @distributed_trace - def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + def begin_rotate_cluster_certificates( + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> LROPoller[None]: """Rotate certificates of a managed cluster. Rotate certificates of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1990,80 +2155,67 @@ def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-st Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._rotate_cluster_certificates_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_rotate_cluster_certificates.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore + begin_rotate_cluster_certificates.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore def _stop_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_stop_request_initial( - subscription_id=self._config.subscription_id, + request = build_stop_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._stop_initial.metadata['url'], + template_url=self._stop_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2071,10 +2223,9 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -2084,23 +2235,17 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore - + _stop_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore @distributed_trace - def begin_stop( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> LROPoller[None]: + def begin_stop(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> LROPoller[None]: """Stop Managed Cluster. Stops a Running Managed Cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -2112,80 +2257,67 @@ def begin_stop( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._stop_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore + begin_stop.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore def _start_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_start_request_initial( - subscription_id=self._config.subscription_id, + request = build_start_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._start_initial.metadata['url'], + template_url=self._start_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2193,10 +2325,9 @@ def _start_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -2206,23 +2337,17 @@ def _start_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore - + _start_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore @distributed_trace - def begin_start( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> LROPoller[None]: + def begin_start(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> LROPoller[None]: """Start Managed Cluster. Starts a Stopped Managed Cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -2234,52 +2359,45 @@ def begin_start( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._start_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore + begin_start.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/operations/_operations.py index 6fd09a9df09d..faad11f5b798 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/operations/_operations.py @@ -7,10 +7,15 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,38 +25,34 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - **kwargs: Any -) -> HttpRequest: + +def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.ContainerService/operations") # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class Operations: """ @@ -72,36 +73,31 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.OperationListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.OperationValue"]: """Gets a list of compute operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationListResult or the result of cls(response) + :return: An iterator like instance of either OperationValue or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_09_01.models.OperationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_09_01.models.OperationValue] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -109,13 +105,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -131,10 +125,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -144,8 +136,6 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.ContainerService/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ContainerService/operations"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/operations/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/operations/_private_endpoint_connections_operations.py index cf02deff8bcb..d2500ab3d970 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/operations/_private_endpoint_connections_operations.py @@ -6,11 +6,15 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod @@ -21,173 +25,191 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - subscription_id: str, resource_group_name: str, resource_name: str, private_endpoint_connection_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 = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_update_request( - subscription_id: str, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, - *, - json: Optional[_models.PrivateEndpointConnection] = None, - content: Any = None, + subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request_initial( - subscription_id: str, +def build_delete_request( resource_group_name: str, resource_name: str, private_endpoint_connection_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 = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class PrivateEndpointConnectionsOperations: """ @@ -208,46 +230,39 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnectionListResult: """Gets a list of private endpoint connections in the specified managed cluster. Gets a list of private endpoint connections in the specified managed cluster. The operation returns properties of each private endpoint connection. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnectionListResult, or the result of cls(response) + :return: PrivateEndpointConnectionListResult or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_09_01.models.PrivateEndpointConnectionListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnectionListResult] - request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -255,68 +270,59 @@ def list( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore - + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore @distributed_trace def get( - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnection: """Gets the private endpoint connection. Gets the details of the private endpoint connection by managed cluster and resource group. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_09_01.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -324,75 +330,149 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - @distributed_trace + @overload def update( self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, parameters: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateEndpointConnection: """Updates a private endpoint connection. Updates a private endpoint connection in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :param parameters: Parameters supplied to the Update a private endpoint connection operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2020_09_01.models.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2020_09_01.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: Parameters supplied to the Update a private endpoint connection operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_09_01.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @distributed_trace + def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: Union[_models.PrivateEndpointConnection, IO], + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: Parameters supplied to the Update a private endpoint connection operation. + Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2020_09_01.models.PrivateEndpointConnection or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2020_09_01.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - _json = self._serialize.body(parameters, 'PrivateEndpointConnection') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateEndpointConnection") request = build_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update.metadata['url'], + content=_content, + template_url=self.update.metadata["url"], headers=_headers, params=_params, ) @@ -400,52 +480,43 @@ def update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -453,10 +524,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -466,26 +536,21 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + def begin_delete( + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> LROPoller[None]: """Deletes a private endpoint connection. Deletes the private endpoint connection in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -497,53 +562,46 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/operations/_private_link_resources_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/operations/_private_link_resources_operations.py index f31e3cc4497f..a397500db9bf 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/operations/_private_link_resources_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/operations/_private_link_resources_operations.py @@ -8,9 +8,13 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -19,48 +23,53 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class PrivateLinkResourcesOperations: """ @@ -81,46 +90,39 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.PrivateLinkResourcesListResult: """Gets a list of private link resources in the specified managed cluster. Gets a list of private link resources in the specified managed cluster. The operation returns properties of each private link resource. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResourcesListResult, or the result of cls(response) + :return: PrivateLinkResourcesListResult or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_09_01.models.PrivateLinkResourcesListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResourcesListResult] - request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -128,22 +130,20 @@ def list( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResourcesListResult', pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources"} # type: ignore - + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/operations/_resolve_private_link_service_id_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/operations/_resolve_private_link_service_id_operations.py index fbe88eeffcda..f4766ab95f56 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/operations/_resolve_private_link_service_id_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/operations/_resolve_private_link_service_id_operations.py @@ -6,11 +6,15 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -19,56 +23,56 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_post_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.PrivateLinkResource] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + class ResolvePrivateLinkServiceIdOperations: """ @@ -89,53 +93,120 @@ def __init__(self, *args, **kwargs): 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 + @overload def post( self, resource_group_name: str, resource_name: str, parameters: _models.PrivateLinkResource, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateLinkResource: """Gets the private link service ID for the specified managed cluster. Gets the private link service ID the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters (name, groupId) supplied in order to resolve a private link - service ID. + service ID. Required. :type parameters: ~azure.mgmt.containerservice.v2020_09_01.models.PrivateLinkResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResource, or the result of cls(response) + :return: PrivateLinkResource or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_09_01.models.PrivateLinkResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + def post( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters (name, groupId) supplied in order to resolve a private link + service ID. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2020_09_01.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def post( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.PrivateLinkResource, IO], + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters (name, groupId) supplied in order to resolve a private link + service ID. Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2020_09_01.models.PrivateLinkResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2020_09_01.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResource] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResource] - _json = self._serialize.body(parameters, 'PrivateLinkResource') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateLinkResource") request = build_post_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.post.metadata['url'], + content=_content, + template_url=self.post.metadata["url"], headers=_headers, params=_params, ) @@ -143,22 +214,20 @@ def post( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResource', pipeline_response) + deserialized = self._deserialize("PrivateLinkResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - post.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId"} # type: ignore - + post.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/__init__.py index 37a5f9e02e6f..a8716d29afe8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/__init__.py @@ -14,7 +14,8 @@ except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['ContainerServiceClient'] + +__all__ = ["ContainerServiceClient"] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/_configuration.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/_configuration.py index e4b51d4eac22..39a6e62e6725 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/_configuration.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/_configuration.py @@ -18,30 +18,26 @@ VERSION = "unknown" + class ContainerServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ContainerServiceClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2020-11-01". 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: + def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ContainerServiceClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2020-11-01") # type: str + api_version = kwargs.pop("api_version", "2020-11-01") # type: str if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -51,23 +47,24 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-containerservice/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-containerservice/{}".format(VERSION)) self._configure(**kwargs) def _configure( - self, - **kwargs # type: Any + self, **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/_container_service_client.py index ea8bfb2a321e..7a066dc89478 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/_container_service_client.py @@ -9,20 +9,27 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from . import models +from .._serialization import Deserializer, Serializer from ._configuration import ContainerServiceClientConfiguration -from .operations import AgentPoolsOperations, ManagedClustersOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, ResolvePrivateLinkServiceIdOperations +from .operations import ( + AgentPoolsOperations, + ManagedClustersOperations, + Operations, + PrivateEndpointConnectionsOperations, + PrivateLinkResourcesOperations, + ResolvePrivateLinkServiceIdOperations, +) if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class ContainerServiceClient: + +class ContainerServiceClient: # pylint: disable=client-accepts-api-version-keyword """The Container Service Client. :ivar operations: Operations operations @@ -41,10 +48,10 @@ class ContainerServiceClient: :ivar resolve_private_link_service_id: ResolvePrivateLinkServiceIdOperations operations :vartype resolve_private_link_service_id: azure.mgmt.containerservice.v2020_11_01.operations.ResolvePrivateLinkServiceIdOperations - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -62,22 +69,20 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = ContainerServiceClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = ContainerServiceClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize - ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.managed_clusters = ManagedClustersOperations( self._client, self._config, self._serialize, self._deserialize ) - self.agent_pools = AgentPoolsOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) self.private_endpoint_connections = PrivateEndpointConnectionsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -88,12 +93,7 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) - - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> HttpResponse: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -102,7 +102,7 @@ def _send_request( >>> response = client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/_metadata.json b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/_metadata.json index 78bccde16ab3..ddbf070f2b9d 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/_metadata.json +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/_metadata.json @@ -10,20 +10,20 @@ "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { "credential": { - "signature": "credential, # type: \"TokenCredential\"", - "description": "Credential needed for the client to connect to Azure.", + "signature": "credential: \"TokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true }, "subscription_id": { - "signature": "subscription_id, # type: str", - "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "signature": "subscription_id: str,", + "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.", "docstring_type": "str", "required": true } @@ -31,13 +31,13 @@ "async": { "credential": { "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure.", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { "signature": "subscription_id: str,", - "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.", "docstring_type": "str", "required": true } @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=\"https://management.azure.com\", # type: str", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/_patch.py index 74e48ecd07cf..f99e77fef986 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/_patch.py @@ -28,4 +28,4 @@ # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + pass diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/_vendor.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/_vendor.py index 138f663c53a4..9aad73fc743e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/_vendor.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/_vendor.py @@ -7,6 +7,7 @@ from azure.core.pipeline.transport import HttpRequest + def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) @@ -14,6 +15,7 @@ def _convert_request(request, files=None): request.set_formdata_body(files) return request + def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -21,7 +23,5 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [ - c for c in formatted_components if "{}".format(key.args[0]) not in c - ] + components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/aio/__init__.py index 37a5f9e02e6f..a8716d29afe8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/aio/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/aio/__init__.py @@ -14,7 +14,8 @@ except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['ContainerServiceClient'] + +__all__ = ["ContainerServiceClient"] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/aio/_configuration.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/aio/_configuration.py index a7cc14f3571a..356f752ac699 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/aio/_configuration.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/aio/_configuration.py @@ -18,30 +18,26 @@ VERSION = "unknown" + class ContainerServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ContainerServiceClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2020-11-01". 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: + def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ContainerServiceClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2020-11-01") # type: str + api_version = kwargs.pop("api_version", "2020-11-01") # type: str if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -51,22 +47,21 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-containerservice/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-containerservice/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, - **kwargs: Any - ) -> None: - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/aio/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/aio/_container_service_client.py index 30f0b9dadd72..9b48b5e0479c 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/aio/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/aio/_container_service_client.py @@ -9,20 +9,27 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from .. import models +from ..._serialization import Deserializer, Serializer from ._configuration import ContainerServiceClientConfiguration -from .operations import AgentPoolsOperations, ManagedClustersOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, ResolvePrivateLinkServiceIdOperations +from .operations import ( + AgentPoolsOperations, + ManagedClustersOperations, + Operations, + PrivateEndpointConnectionsOperations, + PrivateLinkResourcesOperations, + ResolvePrivateLinkServiceIdOperations, +) if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class ContainerServiceClient: + +class ContainerServiceClient: # pylint: disable=client-accepts-api-version-keyword """The Container Service Client. :ivar operations: Operations operations @@ -42,10 +49,10 @@ class ContainerServiceClient: :ivar resolve_private_link_service_id: ResolvePrivateLinkServiceIdOperations operations :vartype resolve_private_link_service_id: azure.mgmt.containerservice.v2020_11_01.aio.operations.ResolvePrivateLinkServiceIdOperations - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -63,22 +70,20 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = ContainerServiceClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = ContainerServiceClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize - ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.managed_clusters = ManagedClustersOperations( self._client, self._config, self._serialize, self._deserialize ) - self.agent_pools = AgentPoolsOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) self.private_endpoint_connections = PrivateEndpointConnectionsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -89,12 +94,7 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) - - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -103,7 +103,7 @@ def _send_request( >>> response = await client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/aio/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/aio/_patch.py index 74e48ecd07cf..f99e77fef986 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/aio/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/aio/_patch.py @@ -28,4 +28,4 @@ # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + pass diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/aio/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/aio/operations/__init__.py index eb76d54a688d..160f4be0e9d7 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/aio/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/aio/operations/__init__.py @@ -16,13 +16,14 @@ from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'Operations', - 'ManagedClustersOperations', - 'AgentPoolsOperations', - 'PrivateEndpointConnectionsOperations', - 'PrivateLinkResourcesOperations', - 'ResolvePrivateLinkServiceIdOperations', + "Operations", + "ManagedClustersOperations", + "AgentPoolsOperations", + "PrivateEndpointConnectionsOperations", + "PrivateLinkResourcesOperations", + "ResolvePrivateLinkServiceIdOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/aio/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/aio/operations/_agent_pools_operations.py index 8ee57914f1ff..af39e954ae30 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/aio/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/aio/operations/_agent_pools_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +29,20 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._agent_pools_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_available_agent_pool_versions_request, build_get_request, build_get_upgrade_profile_request, build_list_request, build_upgrade_node_image_version_request_initial -T = TypeVar('T') +from ...operations._agent_pools_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_available_agent_pool_versions_request, + build_get_request, + build_get_upgrade_profile_request, + build_list_request, + build_upgrade_node_image_version_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class AgentPoolsOperations: """ .. warning:: @@ -45,48 +62,41 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.AgentPoolListResult]: + def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncIterable["_models.AgentPool"]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. The operation returns properties of each agent pool. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AgentPoolListResult or the result of cls(response) + :return: An iterator like instance of either AgentPool or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_11_01.models.AgentPoolListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_11_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -94,16 +104,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -119,10 +124,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -132,54 +135,45 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore @distributed_trace_async async def get( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPool: """Gets the agent pool. Gets the details of the agent pool by managed cluster and resource group. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPool, or the result of cls(response) + :return: AgentPool or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_11_01.models.AgentPool - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -187,57 +181,60 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore async def _create_or_update_initial( self, resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: _models.AgentPool, + parameters: Union[_models.AgentPool, IO], **kwargs: Any ) -> _models.AgentPool: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - _json = self._serialize.body(parameters, 'AgentPool') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "AgentPool") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -245,10 +242,9 @@ async def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -256,40 +252,127 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - @distributed_trace_async + @overload async def begin_create_or_update( self, resource_group_name: str, resource_name: str, agent_pool_name: str, parameters: _models.AgentPool, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.AgentPool]: """Creates or updates an agent pool. Creates or updates an agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :param parameters: Parameters supplied to the Create or Update an agent pool operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2020_11_01.models.AgentPool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AgentPool or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_11_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AgentPool]: + """Creates or updates an agent pool. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: Parameters supplied to the Create or Update an agent pool operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AgentPool or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_11_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: Union[_models.AgentPool, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.AgentPool]: + """Creates or updates an agent pool. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: Parameters supplied to the Create or Update an agent pool operation. Is + either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2020_11_01.models.AgentPool or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -302,20 +385,17 @@ async def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_11_01.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -324,66 +404,55 @@ async def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -391,10 +460,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -404,26 +472,21 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + async def begin_delete( + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes an agent pool. Deletes the agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -435,100 +498,86 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace_async async def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPoolUpgradeProfile: """Gets upgrade profile for an agent pool. Gets the details of the upgrade profile for an agent pool with a specified resource group and managed cluster name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolUpgradeProfile, or the result of cls(response) + :return: AgentPoolUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_11_01.models.AgentPoolUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -536,64 +585,56 @@ async def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolUpgradeProfile', pipeline_response) + deserialized = self._deserialize("AgentPoolUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore @distributed_trace_async async def get_available_agent_pool_versions( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported versions for the specified agent pool. Gets a list of supported versions for the specified agent pool. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolAvailableVersions, or the result of cls(response) + :return: AgentPoolAvailableVersions or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_11_01.models.AgentPoolAvailableVersions - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolAvailableVersions] - request = build_get_available_agent_pool_versions_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_available_agent_pool_versions.metadata['url'], + template_url=self.get_available_agent_pool_versions.metadata["url"], headers=_headers, params=_params, ) @@ -601,52 +642,43 @@ async def get_available_agent_pool_versions( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolAvailableVersions', pipeline_response) + deserialized = self._deserialize("AgentPoolAvailableVersions", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_available_agent_pool_versions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore - + get_available_agent_pool_versions.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore async def _upgrade_node_image_version_initial( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> Optional[_models.AgentPool]: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.AgentPool]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.AgentPool]] - - request = build_upgrade_node_image_version_request_initial( - subscription_id=self._config.subscription_id, + request = build_upgrade_node_image_version_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._upgrade_node_image_version_initial.metadata['url'], + template_url=self._upgrade_node_image_version_initial.metadata["url"], headers=_headers, params=_params, ) @@ -654,10 +686,9 @@ async def _upgrade_node_image_version_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -666,33 +697,28 @@ async def _upgrade_node_image_version_initial( deserialized = None if response.status_code == 202: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _upgrade_node_image_version_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore - + _upgrade_node_image_version_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore @distributed_trace_async async def begin_upgrade_node_image_version( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any - ) -> AsyncLROPoller[_models.AgentPool]: + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: """Upgrade node image version of an agent pool to the latest. Upgrade node image version of an agent pool to the latest. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -706,55 +732,48 @@ async def begin_upgrade_node_image_version( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_11_01.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._upgrade_node_image_version_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_upgrade_node_image_version.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore + begin_upgrade_node_image_version.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/aio/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/aio/operations/_managed_clusters_operations.py index 9d727cd7b5d7..25599988c37b 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/aio/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/aio/operations/_managed_clusters_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +29,29 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._managed_clusters_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_access_profile_request, build_get_request, build_get_upgrade_profile_request, build_list_by_resource_group_request, build_list_cluster_admin_credentials_request, build_list_cluster_monitoring_user_credentials_request, build_list_cluster_user_credentials_request, build_list_request, build_reset_aad_profile_request_initial, build_reset_service_principal_profile_request_initial, build_rotate_cluster_certificates_request_initial, build_start_request_initial, build_stop_request_initial, build_update_tags_request_initial -T = TypeVar('T') +from ...operations._managed_clusters_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_access_profile_request, + build_get_request, + build_get_upgrade_profile_request, + build_list_by_resource_group_request, + build_list_cluster_admin_credentials_request, + build_list_cluster_monitoring_user_credentials_request, + build_list_cluster_user_credentials_request, + build_list_request, + build_reset_aad_profile_request, + build_reset_service_principal_profile_request, + build_rotate_cluster_certificates_request, + build_start_request, + build_stop_request, + build_update_tags_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class ManagedClustersOperations: # pylint: disable=too-many-public-methods """ .. warning:: @@ -45,41 +71,35 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.ManagedClusterListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.ManagedCluster"]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. The operation returns properties of each managed cluster. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_11_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_11_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -87,14 +107,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -110,10 +127,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -123,50 +138,44 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.ManagedClusterListResult]: + self, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ManagedCluster"]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. The operation returns properties of each managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_11_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_11_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -174,15 +183,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -198,10 +203,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -211,51 +214,43 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace_async async def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.ManagedClusterUpgradeProfile: """Gets upgrade profile for a managed cluster. Gets the details of the upgrade profile for a managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterUpgradeProfile, or the result of cls(response) + :return: ManagedClusterUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_11_01.models.ManagedClusterUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -263,33 +258,27 @@ async def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterUpgradeProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore @distributed_trace_async async def get_access_profile( - self, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, role_name: str, **kwargs: Any ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. @@ -300,36 +289,33 @@ async def get_access_profile( `ListClusterAdminCredentials `_ . - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param role_name: The name of the role for managed cluster accessProfile resource. + :param role_name: The name of the role for managed cluster accessProfile resource. Required. :type role_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterAccessProfile, or the result of cls(response) + :return: ManagedClusterAccessProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_11_01.models.ManagedClusterAccessProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterAccessProfile] - request = build_get_access_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, role_name=role_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_access_profile.metadata['url'], + template_url=self.get_access_profile.metadata["url"], headers=_headers, params=_params, ) @@ -337,64 +323,56 @@ async def get_access_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterAccessProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterAccessProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_access_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore - + get_access_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore @distributed_trace_async async def list_cluster_admin_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster admin credential of a managed cluster. Gets cluster admin credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_11_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_admin_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_admin_credentials.metadata['url'], + template_url=self.list_cluster_admin_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -402,64 +380,56 @@ async def list_cluster_admin_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_admin_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore - + list_cluster_admin_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore @distributed_trace_async async def list_cluster_user_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster user credential of a managed cluster. Gets cluster user credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_11_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_user_credentials.metadata['url'], + template_url=self.list_cluster_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -467,65 +437,57 @@ async def list_cluster_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore - + list_cluster_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore @distributed_trace_async async def list_cluster_monitoring_user_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster monitoring user credential of a managed cluster. Gets cluster monitoring user credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_11_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_monitoring_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + template_url=self.list_cluster_monitoring_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -533,64 +495,54 @@ async def list_cluster_monitoring_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_monitoring_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore - + list_cluster_monitoring_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore @distributed_trace_async - async def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.ManagedCluster: + async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.ManagedCluster: """Gets a managed cluster. Gets the details of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedCluster, or the result of cls(response) + :return: ManagedCluster or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_11_01.models.ManagedCluster - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -598,55 +550,54 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _create_or_update_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.ManagedCluster, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'ManagedCluster') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedCluster") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -654,10 +605,9 @@ async def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -665,25 +615,26 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - @distributed_trace_async + @overload async def begin_create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedCluster, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. @@ -691,12 +642,16 @@ async def begin_create_or_update( Creates or updates a managed cluster with the specified configuration for agents and Kubernetes version. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2020_11_01.models.ManagedCluster + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -709,20 +664,91 @@ async def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_11_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster with the specified configuration for agents and Kubernetes + version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_11_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster with the specified configuration for agents and Kubernetes + version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. Is + either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2020_11_01.models.ManagedCluster or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_11_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -730,69 +756,66 @@ async def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _update_tags_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.TagsObject, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request_initial( - subscription_id=self._config.subscription_id, + request = build_update_tags_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_tags_initial.metadata['url'], + content=_content, + template_url=self._update_tags_initial.metadata["url"], headers=_headers, params=_params, ) @@ -800,44 +823,118 @@ async def _update_tags_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_tags_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _update_tags_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - @distributed_trace_async + @overload async def begin_update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates a managed cluster with the specified tags. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2020_11_01.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_11_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates a managed cluster with the specified tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_11_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates a managed cluster with the specified tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2020_11_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -850,20 +947,17 @@ async def begin_update_tags( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_11_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, @@ -871,64 +965,54 @@ async def begin_update_tags( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -936,10 +1020,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -949,23 +1032,17 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: + async def begin_delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Deletes a managed cluster. Deletes the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -977,85 +1054,83 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterServicePrincipalProfile, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterServicePrincipalProfile") - request = build_reset_service_principal_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_service_principal_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_service_principal_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_service_principal_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1063,10 +1138,9 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1076,29 +1150,33 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist if cls: return cls(pipeline_response, None, {}) - _reset_service_principal_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + _reset_service_principal_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore - - @distributed_trace_async - async def begin_reset_service_principal_profile( # pylint: disable=inconsistent-return-statements + @overload + async def begin_reset_service_principal_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterServicePrincipalProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: """Reset Service Principal Profile of a managed cluster. Update the service principal Profile for a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a - Managed Cluster. + Managed Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2020_11_01.models.ManagedClusterServicePrincipalProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -1109,20 +1187,90 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset Service Principal Profile of a managed cluster. + + Update the service principal Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a + Managed Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset Service Principal Profile of a managed cluster. + + Update the service principal Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a + Managed Cluster. Is either a model type or a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2020_11_01.models.ManagedClusterServicePrincipalProfile or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1130,67 +1278,68 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_service_principal_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + begin_reset_service_principal_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterAADProfile, + parameters: Union[_models.ManagedClusterAADProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterAADProfile") - request = build_reset_aad_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_aad_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_aad_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_aad_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1198,10 +1347,9 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1211,28 +1359,32 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta if cls: return cls(pipeline_response, None, {}) - _reset_aad_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - + _reset_aad_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - @distributed_trace_async - async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements + @overload + async def begin_reset_aad_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterAADProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: """Reset AAD Profile of a managed cluster. Update the AAD Profile for a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed - Cluster. + Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2020_11_01.models.ManagedClusterAADProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -1243,20 +1395,90 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset AAD Profile of a managed cluster. + + Update the AAD Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed + Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterAADProfile, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset AAD Profile of a managed cluster. + + Update the AAD Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed + Cluster. Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2020_11_01.models.ManagedClusterAADProfile or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1264,62 +1486,52 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_aad_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + begin_reset_aad_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_rotate_cluster_certificates_request_initial( - subscription_id=self._config.subscription_id, + request = build_rotate_cluster_certificates_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._rotate_cluster_certificates_initial.metadata['url'], + template_url=self._rotate_cluster_certificates_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1327,10 +1539,9 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1340,23 +1551,19 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- if cls: return cls(pipeline_response, None, {}) - _rotate_cluster_certificates_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore - + _rotate_cluster_certificates_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore @distributed_trace_async - async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + async def begin_rotate_cluster_certificates( + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Rotate certificates of a managed cluster. Rotate certificates of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1368,80 +1575,67 @@ async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-ret Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._rotate_cluster_certificates_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_rotate_cluster_certificates.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore + begin_rotate_cluster_certificates.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore async def _stop_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_stop_request_initial( - subscription_id=self._config.subscription_id, + request = build_stop_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._stop_initial.metadata['url'], + template_url=self._stop_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1449,10 +1643,9 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1462,23 +1655,17 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore - + _stop_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore @distributed_trace_async - async def begin_stop( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: + async def begin_stop(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Stop Managed Cluster. Stops a Running Managed Cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1490,80 +1677,67 @@ async def begin_stop( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._stop_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore + begin_stop.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore async def _start_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_start_request_initial( - subscription_id=self._config.subscription_id, + request = build_start_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._start_initial.metadata['url'], + template_url=self._start_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1571,10 +1745,9 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1584,23 +1757,17 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore - + _start_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore @distributed_trace_async - async def begin_start( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: + async def begin_start(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Start Managed Cluster. Starts a Stopped Managed Cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1612,52 +1779,45 @@ async def begin_start( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._start_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore + begin_start.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/aio/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/aio/operations/_operations.py index 833db596b9b3..2f147875e3bd 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/aio/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/aio/operations/_operations.py @@ -7,9 +7,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,9 +27,11 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._operations import build_list_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class Operations: """ .. warning:: @@ -42,36 +51,31 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.OperationListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.OperationValue"]: """Gets a list of compute operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationListResult or the result of cls(response) + :return: An iterator like instance of either OperationValue or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_11_01.models.OperationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_11_01.models.OperationValue] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -79,13 +83,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -101,10 +103,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -114,8 +114,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.ContainerService/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ContainerService/operations"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/aio/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/aio/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/aio/operations/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/aio/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/aio/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/aio/operations/_private_endpoint_connections_operations.py index 8019d0d4876a..18f549161ad0 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/aio/operations/_private_endpoint_connections_operations.py @@ -6,9 +6,15 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -20,10 +26,17 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._private_endpoint_connections_operations import build_delete_request_initial, build_get_request, build_list_request, build_update_request -T = TypeVar('T') +from ...operations._private_endpoint_connections_operations import ( + build_delete_request, + build_get_request, + build_list_request, + build_update_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class PrivateEndpointConnectionsOperations: """ .. warning:: @@ -43,46 +56,39 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async async def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnectionListResult: """Gets a list of private endpoint connections in the specified managed cluster. Gets a list of private endpoint connections in the specified managed cluster. The operation returns properties of each private endpoint connection. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnectionListResult, or the result of cls(response) + :return: PrivateEndpointConnectionListResult or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_11_01.models.PrivateEndpointConnectionListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnectionListResult] - request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -90,68 +96,59 @@ async def list( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore - + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore @distributed_trace_async async def get( - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnection: """Gets the private endpoint connection. Gets the details of the private endpoint connection by managed cluster and resource group. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_11_01.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -159,75 +156,149 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - - @distributed_trace_async + @overload async def update( self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, parameters: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateEndpointConnection: """Updates a private endpoint connection. Updates a private endpoint connection in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :param parameters: Parameters supplied to the Update a private endpoint connection operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2020_11_01.models.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_11_01.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + async def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: Parameters supplied to the Update a private endpoint connection operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2020_11_01.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: Union[_models.PrivateEndpointConnection, IO], + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: Parameters supplied to the Update a private endpoint connection operation. + Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2020_11_01.models.PrivateEndpointConnection or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2020_11_01.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - _json = self._serialize.body(parameters, 'PrivateEndpointConnection') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateEndpointConnection") request = build_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update.metadata['url'], + content=_content, + template_url=self.update.metadata["url"], headers=_headers, params=_params, ) @@ -235,52 +306,43 @@ async def update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -288,10 +350,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -301,26 +362,21 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + async def begin_delete( + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes a private endpoint connection. Deletes the private endpoint connection in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -332,53 +388,46 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/aio/operations/_private_link_resources_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/aio/operations/_private_link_resources_operations.py index 66037b98cc9f..27482bf45351 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/aio/operations/_private_link_resources_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/aio/operations/_private_link_resources_operations.py @@ -8,7 +8,13 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -19,9 +25,11 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._private_link_resources_operations import build_list_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class PrivateLinkResourcesOperations: """ .. warning:: @@ -41,46 +49,39 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async async def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.PrivateLinkResourcesListResult: """Gets a list of private link resources in the specified managed cluster. Gets a list of private link resources in the specified managed cluster. The operation returns properties of each private link resource. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResourcesListResult, or the result of cls(response) + :return: PrivateLinkResourcesListResult or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_11_01.models.PrivateLinkResourcesListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResourcesListResult] - request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -88,22 +89,20 @@ async def list( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResourcesListResult', pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources"} # type: ignore - + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/aio/operations/_resolve_private_link_service_id_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/aio/operations/_resolve_private_link_service_id_operations.py index 23f1958ae8ae..4bbd0777aa18 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/aio/operations/_resolve_private_link_service_id_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/aio/operations/_resolve_private_link_service_id_operations.py @@ -6,9 +6,15 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -19,9 +25,11 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._resolve_private_link_service_id_operations import build_post_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class ResolvePrivateLinkServiceIdOperations: """ .. warning:: @@ -41,53 +49,120 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async + @overload async def post( self, resource_group_name: str, resource_name: str, parameters: _models.PrivateLinkResource, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateLinkResource: """Gets the private link service ID for the specified managed cluster. Gets the private link service ID the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters (name, groupId) supplied in order to resolve a private link - service ID. + service ID. Required. :type parameters: ~azure.mgmt.containerservice.v2020_11_01.models.PrivateLinkResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2020_11_01.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def post( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters (name, groupId) supplied in order to resolve a private link + service ID. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResource, or the result of cls(response) + :return: PrivateLinkResource or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_11_01.models.PrivateLinkResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @distributed_trace_async + async def post( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.PrivateLinkResource, IO], + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters (name, groupId) supplied in order to resolve a private link + service ID. Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2020_11_01.models.PrivateLinkResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2020_11_01.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResource] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResource] - _json = self._serialize.body(parameters, 'PrivateLinkResource') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateLinkResource") request = build_post_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.post.metadata['url'], + content=_content, + template_url=self.post.metadata["url"], headers=_headers, params=_params, ) @@ -95,22 +170,20 @@ async def post( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResource', pipeline_response) + deserialized = self._deserialize("PrivateLinkResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - post.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId"} # type: ignore - + post.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/models/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/models/__init__.py index 92aee945b85a..1a3e3f7a7ec1 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/models/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/models/__init__.py @@ -16,7 +16,9 @@ from ._models_py3 import CloudError from ._models_py3 import CloudErrorBody from ._models_py3 import Components1Q1Og48SchemasManagedclusterAllof1 -from ._models_py3 import Components1Umhcm8SchemasManagedclusteridentityPropertiesUserassignedidentitiesAdditionalproperties +from ._models_py3 import ( + Components1Umhcm8SchemasManagedclusteridentityPropertiesUserassignedidentitiesAdditionalproperties, +) from ._models_py3 import ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties from ._models_py3 import ContainerServiceDiagnosticsProfile from ._models_py3 import ContainerServiceLinuxProfile @@ -71,125 +73,123 @@ from ._models_py3 import TagsObject from ._models_py3 import UserAssignedIdentity - -from ._container_service_client_enums import ( - AgentPoolMode, - AgentPoolType, - Code, - ConnectionStatus, - ContainerServiceStorageProfileTypes, - ContainerServiceVMSizeTypes, - Count, - Expander, - LicenseType, - LoadBalancerSku, - ManagedClusterPodIdentityProvisioningState, - ManagedClusterSKUName, - ManagedClusterSKUTier, - NetworkMode, - NetworkPlugin, - NetworkPolicy, - OSDiskType, - OSType, - OutboundType, - PrivateEndpointConnectionProvisioningState, - ResourceIdentityType, - ScaleSetEvictionPolicy, - ScaleSetPriority, - UpgradeChannel, -) +from ._container_service_client_enums import AgentPoolMode +from ._container_service_client_enums import AgentPoolType +from ._container_service_client_enums import Code +from ._container_service_client_enums import ConnectionStatus +from ._container_service_client_enums import ContainerServiceStorageProfileTypes +from ._container_service_client_enums import ContainerServiceVMSizeTypes +from ._container_service_client_enums import Count +from ._container_service_client_enums import Expander +from ._container_service_client_enums import LicenseType +from ._container_service_client_enums import LoadBalancerSku +from ._container_service_client_enums import ManagedClusterPodIdentityProvisioningState +from ._container_service_client_enums import ManagedClusterSKUName +from ._container_service_client_enums import ManagedClusterSKUTier +from ._container_service_client_enums import NetworkMode +from ._container_service_client_enums import NetworkPlugin +from ._container_service_client_enums import NetworkPolicy +from ._container_service_client_enums import OSDiskType +from ._container_service_client_enums import OSType +from ._container_service_client_enums import OutboundType +from ._container_service_client_enums import PrivateEndpointConnectionProvisioningState +from ._container_service_client_enums import ResourceIdentityType +from ._container_service_client_enums import ScaleSetEvictionPolicy +from ._container_service_client_enums import ScaleSetPriority +from ._container_service_client_enums import UpgradeChannel from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'AgentPool', - 'AgentPoolAvailableVersions', - 'AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem', - 'AgentPoolListResult', - 'AgentPoolUpgradeProfile', - 'AgentPoolUpgradeProfilePropertiesUpgradesItem', - 'AgentPoolUpgradeSettings', - 'CloudError', - 'CloudErrorBody', - 'Components1Q1Og48SchemasManagedclusterAllof1', - 'Components1Umhcm8SchemasManagedclusteridentityPropertiesUserassignedidentitiesAdditionalproperties', - 'ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties', - 'ContainerServiceDiagnosticsProfile', - 'ContainerServiceLinuxProfile', - 'ContainerServiceMasterProfile', - 'ContainerServiceNetworkProfile', - 'ContainerServiceSshConfiguration', - 'ContainerServiceSshPublicKey', - 'ContainerServiceVMDiagnostics', - 'CredentialResult', - 'CredentialResults', - 'KubeletConfig', - 'LinuxOSConfig', - 'ManagedCluster', - 'ManagedClusterAADProfile', - 'ManagedClusterAPIServerAccessProfile', - 'ManagedClusterAccessProfile', - 'ManagedClusterAddonProfile', - 'ManagedClusterAddonProfileIdentity', - 'ManagedClusterAgentPoolProfile', - 'ManagedClusterAgentPoolProfileProperties', - 'ManagedClusterAutoUpgradeProfile', - 'ManagedClusterIdentity', - 'ManagedClusterListResult', - 'ManagedClusterLoadBalancerProfile', - 'ManagedClusterLoadBalancerProfileManagedOutboundIPs', - 'ManagedClusterLoadBalancerProfileOutboundIPPrefixes', - 'ManagedClusterLoadBalancerProfileOutboundIPs', - 'ManagedClusterPodIdentity', - 'ManagedClusterPodIdentityException', - 'ManagedClusterPodIdentityProfile', - 'ManagedClusterPodIdentityProvisioningInfo', - 'ManagedClusterPoolUpgradeProfile', - 'ManagedClusterPoolUpgradeProfileUpgradesItem', - 'ManagedClusterPropertiesAutoScalerProfile', - 'ManagedClusterSKU', - 'ManagedClusterServicePrincipalProfile', - 'ManagedClusterUpgradeProfile', - 'ManagedClusterWindowsProfile', - 'OperationListResult', - 'OperationValue', - 'PowerState', - 'PrivateEndpoint', - 'PrivateEndpointConnection', - 'PrivateEndpointConnectionListResult', - 'PrivateLinkResource', - 'PrivateLinkResourcesListResult', - 'PrivateLinkServiceConnectionState', - 'Resource', - 'ResourceReference', - 'SubResource', - 'SysctlConfig', - 'TagsObject', - 'UserAssignedIdentity', - 'AgentPoolMode', - 'AgentPoolType', - 'Code', - 'ConnectionStatus', - 'ContainerServiceStorageProfileTypes', - 'ContainerServiceVMSizeTypes', - 'Count', - 'Expander', - 'LicenseType', - 'LoadBalancerSku', - 'ManagedClusterPodIdentityProvisioningState', - 'ManagedClusterSKUName', - 'ManagedClusterSKUTier', - 'NetworkMode', - 'NetworkPlugin', - 'NetworkPolicy', - 'OSDiskType', - 'OSType', - 'OutboundType', - 'PrivateEndpointConnectionProvisioningState', - 'ResourceIdentityType', - 'ScaleSetEvictionPolicy', - 'ScaleSetPriority', - 'UpgradeChannel', + "AgentPool", + "AgentPoolAvailableVersions", + "AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem", + "AgentPoolListResult", + "AgentPoolUpgradeProfile", + "AgentPoolUpgradeProfilePropertiesUpgradesItem", + "AgentPoolUpgradeSettings", + "CloudError", + "CloudErrorBody", + "Components1Q1Og48SchemasManagedclusterAllof1", + "Components1Umhcm8SchemasManagedclusteridentityPropertiesUserassignedidentitiesAdditionalproperties", + "ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties", + "ContainerServiceDiagnosticsProfile", + "ContainerServiceLinuxProfile", + "ContainerServiceMasterProfile", + "ContainerServiceNetworkProfile", + "ContainerServiceSshConfiguration", + "ContainerServiceSshPublicKey", + "ContainerServiceVMDiagnostics", + "CredentialResult", + "CredentialResults", + "KubeletConfig", + "LinuxOSConfig", + "ManagedCluster", + "ManagedClusterAADProfile", + "ManagedClusterAPIServerAccessProfile", + "ManagedClusterAccessProfile", + "ManagedClusterAddonProfile", + "ManagedClusterAddonProfileIdentity", + "ManagedClusterAgentPoolProfile", + "ManagedClusterAgentPoolProfileProperties", + "ManagedClusterAutoUpgradeProfile", + "ManagedClusterIdentity", + "ManagedClusterListResult", + "ManagedClusterLoadBalancerProfile", + "ManagedClusterLoadBalancerProfileManagedOutboundIPs", + "ManagedClusterLoadBalancerProfileOutboundIPPrefixes", + "ManagedClusterLoadBalancerProfileOutboundIPs", + "ManagedClusterPodIdentity", + "ManagedClusterPodIdentityException", + "ManagedClusterPodIdentityProfile", + "ManagedClusterPodIdentityProvisioningInfo", + "ManagedClusterPoolUpgradeProfile", + "ManagedClusterPoolUpgradeProfileUpgradesItem", + "ManagedClusterPropertiesAutoScalerProfile", + "ManagedClusterSKU", + "ManagedClusterServicePrincipalProfile", + "ManagedClusterUpgradeProfile", + "ManagedClusterWindowsProfile", + "OperationListResult", + "OperationValue", + "PowerState", + "PrivateEndpoint", + "PrivateEndpointConnection", + "PrivateEndpointConnectionListResult", + "PrivateLinkResource", + "PrivateLinkResourcesListResult", + "PrivateLinkServiceConnectionState", + "Resource", + "ResourceReference", + "SubResource", + "SysctlConfig", + "TagsObject", + "UserAssignedIdentity", + "AgentPoolMode", + "AgentPoolType", + "Code", + "ConnectionStatus", + "ContainerServiceStorageProfileTypes", + "ContainerServiceVMSizeTypes", + "Count", + "Expander", + "LicenseType", + "LoadBalancerSku", + "ManagedClusterPodIdentityProvisioningState", + "ManagedClusterSKUName", + "ManagedClusterSKUTier", + "NetworkMode", + "NetworkPlugin", + "NetworkPolicy", + "OSDiskType", + "OSType", + "OutboundType", + "PrivateEndpointConnectionProvisioningState", + "ResourceIdentityType", + "ScaleSetEvictionPolicy", + "ScaleSetPriority", + "UpgradeChannel", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/models/_container_service_client_enums.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/models/_container_service_client_enums.py index 8594b1e58606..060ea1fba155 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/models/_container_service_client_enums.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/models/_container_service_client_enums.py @@ -11,35 +11,35 @@ class AgentPoolMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """AgentPoolMode represents mode of an agent pool. - """ + """AgentPoolMode represents mode of an agent pool.""" SYSTEM = "System" USER = "User" + class AgentPoolType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """AgentPoolType represents types of an agent pool. - """ + """AgentPoolType represents types of an agent pool.""" VIRTUAL_MACHINE_SCALE_SETS = "VirtualMachineScaleSets" AVAILABILITY_SET = "AvailabilitySet" + class Code(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Tells whether the cluster is Running or Stopped - """ + """Tells whether the cluster is Running or Stopped.""" RUNNING = "Running" STOPPED = "Stopped" + class ConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The private link service connection status. - """ + """The private link service connection status.""" PENDING = "Pending" APPROVED = "Approved" REJECTED = "Rejected" DISCONNECTED = "Disconnected" + class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the orchestrator choice. @@ -48,9 +48,9 @@ class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEn STORAGE_ACCOUNT = "StorageAccount" MANAGED_DISKS = "ManagedDisks" + class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Size of agent VMs. - """ + """Size of agent VMs.""" STANDARD_A1 = "Standard_A1" STANDARD_A10 = "Standard_A10" @@ -227,6 +227,7 @@ class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): STANDARD_NV24 = "Standard_NV24" STANDARD_NV6 = "Standard_NV6" + class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): """Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, and 5. The default value is 1. @@ -236,12 +237,15 @@ class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): THREE = 3 FIVE = 5 + class Expander(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Expander.""" LEAST_WASTE = "least-waste" MOST_PODS = "most-pods" RANDOM = "random" + class LicenseType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The licenseType to use for Windows VMs. Windows_Server is used to enable Azure Hybrid User Benefits for Windows VMs. @@ -250,86 +254,87 @@ class LicenseType(str, Enum, metaclass=CaseInsensitiveEnumMeta): NONE = "None" WINDOWS_SERVER = "Windows_Server" + class LoadBalancerSku(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The load balancer sku for the managed cluster. - """ + """The load balancer sku for the managed cluster.""" STANDARD = "standard" BASIC = "basic" + class ManagedClusterPodIdentityProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The current provisioning state of the pod identity. - """ + """The current provisioning state of the pod identity.""" ASSIGNED = "Assigned" UPDATING = "Updating" DELETING = "Deleting" FAILED = "Failed" + class ManagedClusterSKUName(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Name of a managed cluster SKU. - """ + """Name of a managed cluster SKU.""" BASIC = "Basic" + class ManagedClusterSKUTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Tier of a managed cluster SKU. - """ + """Tier of a managed cluster SKU.""" PAID = "Paid" FREE = "Free" + class NetworkMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Network mode used for building Kubernetes network. - """ + """Network mode used for building Kubernetes network.""" TRANSPARENT = "transparent" BRIDGE = "bridge" + class NetworkPlugin(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Network plugin used for building Kubernetes network. - """ + """Network plugin used for building Kubernetes network.""" AZURE = "azure" KUBENET = "kubenet" + class NetworkPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Network policy used for building Kubernetes network. - """ + """Network policy used for building Kubernetes network.""" CALICO = "calico" AZURE = "azure" + class OSDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """OSDiskType represents the type of an OS disk on an agent pool. - """ + """OSDiskType represents the type of an OS disk on an agent pool.""" MANAGED = "Managed" EPHEMERAL = "Ephemeral" + class OSType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """OsType to be used to specify os type. Choose from Linux and Windows. Default to Linux. - """ + """OsType to be used to specify os type. Choose from Linux and Windows. Default to Linux.""" LINUX = "Linux" WINDOWS = "Windows" + class OutboundType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The outbound (egress) routing method. - """ + """The outbound (egress) routing method.""" LOAD_BALANCER = "loadBalancer" USER_DEFINED_ROUTING = "userDefinedRouting" + class PrivateEndpointConnectionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The current provisioning state. - """ + """The current provisioning state.""" SUCCEEDED = "Succeeded" CREATING = "Creating" DELETING = "Deleting" FAILED = "Failed" + class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of identity used for the managed cluster. Type 'SystemAssigned' will use an implicitly created identity in master components and an auto-created user assigned identity in MC_ @@ -341,6 +346,7 @@ class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): USER_ASSIGNED = "UserAssigned" NONE = "None" + class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ScaleSetEvictionPolicy to be used to specify eviction policy for Spot virtual machine scale set. Default to Delete. @@ -349,16 +355,16 @@ class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): DELETE = "Delete" DEALLOCATE = "Deallocate" + class ScaleSetPriority(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """ScaleSetPriority to be used to specify virtual machine scale set priority. Default to regular. - """ + """ScaleSetPriority to be used to specify virtual machine scale set priority. Default to regular.""" SPOT = "Spot" REGULAR = "Regular" + class UpgradeChannel(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """upgrade channel for auto upgrade. - """ + """upgrade channel for auto upgrade.""" RAPID = "rapid" STABLE = "stable" diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/models/_models_py3.py index b071690b509a..04aff302cea4 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/models/_models_py3.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/models/_models_py3.py @@ -1,4 +1,5 @@ # coding=utf-8 +# pylint: disable=too-many-lines # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -8,14 +9,14 @@ from typing import Dict, List, Optional, TYPE_CHECKING, Union -import msrest.serialization +from ... import _serialization if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - import __init__ as _models + from .. import models as _models -class SubResource(msrest.serialization.Model): +class SubResource(_serialization.Model): """Reference to another subresource. Variables are only populated by the server, and will be ignored when sending a request. @@ -30,30 +31,26 @@ class SubResource(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(SubResource, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.id = None self.name = None self.type = None -class AgentPool(SubResource): +class AgentPool(SubResource): # pylint: disable=too-many-instance-attributes """Agent Pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -106,7 +103,7 @@ class AgentPool(SubResource): "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :vartype vm_size: str or ~azure.mgmt.containerservice.v2020_11_01.models.ContainerServiceVMSizeTypes :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine @@ -116,7 +113,7 @@ class AgentPool(SubResource): :ivar os_disk_type: OS disk type to be used for machines in a given agent pool. Allowed values are 'Ephemeral' and 'Managed'. If unspecified, defaults to 'Ephemeral' when the VM supports ephemeral OS and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults - to 'Managed'. May not be changed after creation. Known values are: "Managed", "Ephemeral". + to 'Managed'. May not be changed after creation. Known values are: "Managed" and "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2020_11_01.models.OSDiskType :ivar vnet_subnet_id: VNet SubnetID specifies the VNet's subnet identifier for nodes and maybe pods. @@ -126,7 +123,7 @@ class AgentPool(SubResource): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Known values are: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux" and "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2020_11_01.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -135,10 +132,11 @@ class AgentPool(SubResource): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar type_properties_type: AgentPoolType represents types of an agent pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :vartype type_properties_type: str or ~azure.mgmt.containerservice.v2020_11_01.models.AgentPoolType - :ivar mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", "User". + :ivar mode: AgentPoolMode represents mode of an agent pool. Known values are: "System" and + "User". :vartype mode: str or ~azure.mgmt.containerservice.v2020_11_01.models.AgentPoolMode :ivar orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -159,20 +157,19 @@ class AgentPool(SubResource): :ivar enable_node_public_ip: Enable public IP for nodes. :vartype enable_node_public_ip: bool :ivar scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Known values are: "Spot", "Regular". Default value: "Regular". + priority. Default to regular. Known values are: "Spot" and "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_11_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy - for Spot virtual machine scale set. Default to Delete. Known values are: "Delete", - "Deallocate". Default value: "Delete". + for Spot virtual machine scale set. Default to Delete. Known values are: "Delete" and + "Deallocate". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_11_01.models.ScaleSetEvictionPolicy :ivar spot_max_price: SpotMaxPrice to be used to specify the maximum price you are willing to pay in US Dollars. Possible values are any decimal value greater than zero or -1 which indicates default price to be up-to on-demand. :vartype spot_max_price: float - :ivar tags: A set of tags. Agent pool tags to be persisted on the agent pool virtual machine - scale set. + :ivar tags: Agent pool tags to be persisted on the agent pool virtual machine scale set. :vartype tags: dict[str, str] :ivar node_labels: Agent pool node labels to be persisted across all nodes in agent pool. :vartype node_labels: dict[str, str] @@ -188,51 +185,51 @@ class AgentPool(SubResource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'os_disk_size_gb': {'maximum': 1023, 'minimum': 0}, - 'node_image_version': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'power_state': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "os_disk_size_gb": {"maximum": 1023, "minimum": 0}, + "node_image_version": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "power_state": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'count': {'key': 'properties.count', 'type': 'int'}, - 'vm_size': {'key': 'properties.vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'properties.osDiskSizeGB', 'type': 'int'}, - 'os_disk_type': {'key': 'properties.osDiskType', 'type': 'str'}, - 'vnet_subnet_id': {'key': 'properties.vnetSubnetID', 'type': 'str'}, - 'pod_subnet_id': {'key': 'properties.podSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'properties.maxPods', 'type': 'int'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'max_count': {'key': 'properties.maxCount', 'type': 'int'}, - 'min_count': {'key': 'properties.minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'properties.enableAutoScaling', 'type': 'bool'}, - 'type_properties_type': {'key': 'properties.type', 'type': 'str'}, - 'mode': {'key': 'properties.mode', 'type': 'str'}, - 'orchestrator_version': {'key': 'properties.orchestratorVersion', 'type': 'str'}, - 'node_image_version': {'key': 'properties.nodeImageVersion', 'type': 'str'}, - 'upgrade_settings': {'key': 'properties.upgradeSettings', 'type': 'AgentPoolUpgradeSettings'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'power_state': {'key': 'properties.powerState', 'type': 'PowerState'}, - 'availability_zones': {'key': 'properties.availabilityZones', 'type': '[str]'}, - 'enable_node_public_ip': {'key': 'properties.enableNodePublicIP', 'type': 'bool'}, - 'scale_set_priority': {'key': 'properties.scaleSetPriority', 'type': 'str'}, - 'scale_set_eviction_policy': {'key': 'properties.scaleSetEvictionPolicy', 'type': 'str'}, - 'spot_max_price': {'key': 'properties.spotMaxPrice', 'type': 'float'}, - 'tags': {'key': 'properties.tags', 'type': '{str}'}, - 'node_labels': {'key': 'properties.nodeLabels', 'type': '{str}'}, - 'node_taints': {'key': 'properties.nodeTaints', 'type': '[str]'}, - 'proximity_placement_group_id': {'key': 'properties.proximityPlacementGroupID', 'type': 'str'}, - 'kubelet_config': {'key': 'properties.kubeletConfig', 'type': 'KubeletConfig'}, - 'linux_os_config': {'key': 'properties.linuxOSConfig', 'type': 'LinuxOSConfig'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "count": {"key": "properties.count", "type": "int"}, + "vm_size": {"key": "properties.vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "properties.osDiskSizeGB", "type": "int"}, + "os_disk_type": {"key": "properties.osDiskType", "type": "str"}, + "vnet_subnet_id": {"key": "properties.vnetSubnetID", "type": "str"}, + "pod_subnet_id": {"key": "properties.podSubnetID", "type": "str"}, + "max_pods": {"key": "properties.maxPods", "type": "int"}, + "os_type": {"key": "properties.osType", "type": "str"}, + "max_count": {"key": "properties.maxCount", "type": "int"}, + "min_count": {"key": "properties.minCount", "type": "int"}, + "enable_auto_scaling": {"key": "properties.enableAutoScaling", "type": "bool"}, + "type_properties_type": {"key": "properties.type", "type": "str"}, + "mode": {"key": "properties.mode", "type": "str"}, + "orchestrator_version": {"key": "properties.orchestratorVersion", "type": "str"}, + "node_image_version": {"key": "properties.nodeImageVersion", "type": "str"}, + "upgrade_settings": {"key": "properties.upgradeSettings", "type": "AgentPoolUpgradeSettings"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "power_state": {"key": "properties.powerState", "type": "PowerState"}, + "availability_zones": {"key": "properties.availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "properties.enableNodePublicIP", "type": "bool"}, + "scale_set_priority": {"key": "properties.scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "properties.scaleSetEvictionPolicy", "type": "str"}, + "spot_max_price": {"key": "properties.spotMaxPrice", "type": "float"}, + "tags": {"key": "properties.tags", "type": "{str}"}, + "node_labels": {"key": "properties.nodeLabels", "type": "{str}"}, + "node_taints": {"key": "properties.nodeTaints", "type": "[str]"}, + "proximity_placement_group_id": {"key": "properties.proximityPlacementGroupID", "type": "str"}, + "kubelet_config": {"key": "properties.kubeletConfig", "type": "KubeletConfig"}, + "linux_os_config": {"key": "properties.linuxOSConfig", "type": "LinuxOSConfig"}, } - def __init__( + def __init__( # pylint: disable=too-many-locals self, *, count: Optional[int] = None, @@ -242,7 +239,7 @@ def __init__( vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, @@ -252,9 +249,9 @@ def __init__( upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, - scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", - spot_max_price: Optional[float] = -1, + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", + spot_max_price: float = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, @@ -305,7 +302,7 @@ def __init__( "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :paramtype vm_size: str or ~azure.mgmt.containerservice.v2020_11_01.models.ContainerServiceVMSizeTypes :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every @@ -315,7 +312,7 @@ def __init__( :keyword os_disk_type: OS disk type to be used for machines in a given agent pool. Allowed values are 'Ephemeral' and 'Managed'. If unspecified, defaults to 'Ephemeral' when the VM supports ephemeral OS and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, - defaults to 'Managed'. May not be changed after creation. Known values are: "Managed", + defaults to 'Managed'. May not be changed after creation. Known values are: "Managed" and "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2020_11_01.models.OSDiskType :keyword vnet_subnet_id: VNet SubnetID specifies the VNet's subnet identifier for nodes and @@ -326,7 +323,7 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux" and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2020_11_01.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -335,10 +332,10 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword type_properties_type: AgentPoolType represents types of an agent pool. Known values - are: "VirtualMachineScaleSets", "AvailabilitySet". + are: "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type_properties_type: str or ~azure.mgmt.containerservice.v2020_11_01.models.AgentPoolType - :keyword mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", + :keyword mode: AgentPoolMode represents mode of an agent pool. Known values are: "System" and "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2020_11_01.models.AgentPoolMode :keyword orchestrator_version: Version of orchestrator specified when creating the managed @@ -353,20 +350,19 @@ def __init__( :keyword enable_node_public_ip: Enable public IP for nodes. :paramtype enable_node_public_ip: bool :keyword scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Known values are: "Spot", "Regular". Default value: "Regular". + priority. Default to regular. Known values are: "Spot" and "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_11_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction - policy for Spot virtual machine scale set. Default to Delete. Known values are: "Delete", - "Deallocate". Default value: "Delete". + policy for Spot virtual machine scale set. Default to Delete. Known values are: "Delete" and + "Deallocate". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_11_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: SpotMaxPrice to be used to specify the maximum price you are willing to pay in US Dollars. Possible values are any decimal value greater than zero or -1 which indicates default price to be up-to on-demand. :paramtype spot_max_price: float - :keyword tags: A set of tags. Agent pool tags to be persisted on the agent pool virtual machine - scale set. + :keyword tags: Agent pool tags to be persisted on the agent pool virtual machine scale set. :paramtype tags: dict[str, str] :keyword node_labels: Agent pool node labels to be persisted across all nodes in agent pool. :paramtype node_labels: dict[str, str] @@ -380,7 +376,7 @@ def __init__( :keyword linux_os_config: LinuxOSConfig specifies the OS configuration of linux agent nodes. :paramtype linux_os_config: ~azure.mgmt.containerservice.v2020_11_01.models.LinuxOSConfig """ - super(AgentPool, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.vm_size = vm_size self.os_disk_size_gb = os_disk_size_gb @@ -412,7 +408,7 @@ def __init__( self.linux_os_config = linux_os_config -class AgentPoolAvailableVersions(msrest.serialization.Model): +class AgentPoolAvailableVersions(_serialization.Model): """The list of available versions for an agent pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -429,16 +425,19 @@ class AgentPoolAvailableVersions(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'agent_pool_versions': {'key': 'properties.agentPoolVersions', 'type': '[AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "agent_pool_versions": { + "key": "properties.agentPoolVersions", + "type": "[AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem]", + }, } def __init__( @@ -452,14 +451,14 @@ def __init__( :paramtype agent_pool_versions: list[~azure.mgmt.containerservice.v2020_11_01.models.AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem] """ - super(AgentPoolAvailableVersions, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None self.agent_pool_versions = agent_pool_versions -class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(msrest.serialization.Model): +class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(_serialization.Model): """AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem. :ivar default: Whether this version is the default agent pool version. @@ -471,9 +470,9 @@ class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(msrest.serializa """ _attribute_map = { - 'default': {'key': 'default', 'type': 'bool'}, - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "default": {"key": "default", "type": "bool"}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } def __init__( @@ -492,13 +491,13 @@ def __init__( :keyword is_preview: Whether Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.default = default self.kubernetes_version = kubernetes_version self.is_preview = is_preview -class AgentPoolListResult(msrest.serialization.Model): +class AgentPoolListResult(_serialization.Model): """The response from the List Agent Pools operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -510,30 +509,25 @@ class AgentPoolListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[AgentPool]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[AgentPool]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.AgentPool"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.AgentPool"]] = None, **kwargs): """ :keyword value: The list of agent pools. :paramtype value: list[~azure.mgmt.containerservice.v2020_11_01.models.AgentPool] """ - super(AgentPoolListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class AgentPoolUpgradeProfile(msrest.serialization.Model): +class AgentPoolUpgradeProfile(_serialization.Model): """The list of available upgrades for an agent pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -546,10 +540,10 @@ class AgentPoolUpgradeProfile(msrest.serialization.Model): :vartype name: str :ivar type: Type of the agent pool upgrade profile. :vartype type: str - :ivar kubernetes_version: Required. Kubernetes version (major, minor, patch). + :ivar kubernetes_version: Kubernetes version (major, minor, patch). Required. :vartype kubernetes_version: str - :ivar os_type: Required. OsType to be used to specify os type. Choose from Linux and Windows. - Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to + Linux. Known values are: "Linux" and "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2020_11_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -560,21 +554,21 @@ class AgentPoolUpgradeProfile(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kubernetes_version': {'required': True}, - 'os_type': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "kubernetes_version": {"required": True}, + "os_type": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'kubernetes_version': {'key': 'properties.kubernetesVersion', 'type': 'str'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'upgrades': {'key': 'properties.upgrades', 'type': '[AgentPoolUpgradeProfilePropertiesUpgradesItem]'}, - 'latest_node_image_version': {'key': 'properties.latestNodeImageVersion', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "os_type": {"key": "properties.osType", "type": "str"}, + "upgrades": {"key": "properties.upgrades", "type": "[AgentPoolUpgradeProfilePropertiesUpgradesItem]"}, + "latest_node_image_version": {"key": "properties.latestNodeImageVersion", "type": "str"}, } def __init__( @@ -587,10 +581,10 @@ def __init__( **kwargs ): """ - :keyword kubernetes_version: Required. Kubernetes version (major, minor, patch). + :keyword kubernetes_version: Kubernetes version (major, minor, patch). Required. :paramtype kubernetes_version: str - :keyword os_type: Required. OsType to be used to specify os type. Choose from Linux and - Windows. Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default + to Linux. Known values are: "Linux" and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2020_11_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: @@ -599,7 +593,7 @@ def __init__( image version. :paramtype latest_node_image_version: str """ - super(AgentPoolUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -609,7 +603,7 @@ def __init__( self.latest_node_image_version = latest_node_image_version -class AgentPoolUpgradeProfilePropertiesUpgradesItem(msrest.serialization.Model): +class AgentPoolUpgradeProfilePropertiesUpgradesItem(_serialization.Model): """AgentPoolUpgradeProfilePropertiesUpgradesItem. :ivar kubernetes_version: Kubernetes version (major, minor, patch). @@ -619,29 +613,23 @@ class AgentPoolUpgradeProfilePropertiesUpgradesItem(msrest.serialization.Model): """ _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } - def __init__( - self, - *, - kubernetes_version: Optional[str] = None, - is_preview: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, kubernetes_version: Optional[str] = None, is_preview: Optional[bool] = None, **kwargs): """ :keyword kubernetes_version: Kubernetes version (major, minor, patch). :paramtype kubernetes_version: str :keyword is_preview: Whether Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(AgentPoolUpgradeProfilePropertiesUpgradesItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.is_preview = is_preview -class AgentPoolUpgradeSettings(msrest.serialization.Model): +class AgentPoolUpgradeSettings(_serialization.Model): """Settings for upgrading an agentpool. :ivar max_surge: Count or percentage of additional nodes to be added during upgrade. If empty @@ -650,25 +638,20 @@ class AgentPoolUpgradeSettings(msrest.serialization.Model): """ _attribute_map = { - 'max_surge': {'key': 'maxSurge', 'type': 'str'}, + "max_surge": {"key": "maxSurge", "type": "str"}, } - def __init__( - self, - *, - max_surge: Optional[str] = None, - **kwargs - ): + def __init__(self, *, max_surge: Optional[str] = None, **kwargs): """ :keyword max_surge: Count or percentage of additional nodes to be added during upgrade. If empty uses AKS default. :paramtype max_surge: str """ - super(AgentPoolUpgradeSettings, self).__init__(**kwargs) + super().__init__(**kwargs) self.max_surge = max_surge -class CloudError(msrest.serialization.Model): +class CloudError(_serialization.Model): """An error response from the Container service. :ivar error: Details about the error. @@ -676,24 +659,19 @@ class CloudError(msrest.serialization.Model): """ _attribute_map = { - 'error': {'key': 'error', 'type': 'CloudErrorBody'}, + "error": {"key": "error", "type": "CloudErrorBody"}, } - def __init__( - self, - *, - error: Optional["_models.CloudErrorBody"] = None, - **kwargs - ): + def __init__(self, *, error: Optional["_models.CloudErrorBody"] = None, **kwargs): """ :keyword error: Details about the error. :paramtype error: ~azure.mgmt.containerservice.v2020_11_01.models.CloudErrorBody """ - super(CloudError, self).__init__(**kwargs) + super().__init__(**kwargs) self.error = error -class CloudErrorBody(msrest.serialization.Model): +class CloudErrorBody(_serialization.Model): """An error response from the Container service. :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed @@ -710,10 +688,10 @@ class CloudErrorBody(msrest.serialization.Model): """ _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[CloudErrorBody]"}, } def __init__( @@ -738,14 +716,16 @@ def __init__( :keyword details: A list of additional details about the error. :paramtype details: list[~azure.mgmt.containerservice.v2020_11_01.models.CloudErrorBody] """ - super(CloudErrorBody, self).__init__(**kwargs) + super().__init__(**kwargs) self.code = code self.message = message self.target = target self.details = details -class Components1Q1Og48SchemasManagedclusterAllof1(msrest.serialization.Model): +class Components1Q1Og48SchemasManagedclusterAllof1( + _serialization.Model +): # pylint: disable=too-many-instance-attributes """Components1Q1Og48SchemasManagedclusterAllof1. Variables are only populated by the server, and will be ignored when sending a request. @@ -817,41 +797,53 @@ class Components1Q1Og48SchemasManagedclusterAllof1(msrest.serialization.Model): """ _validation = { - 'provisioning_state': {'readonly': True}, - 'power_state': {'readonly': True}, - 'max_agent_pools': {'readonly': True}, - 'fqdn': {'readonly': True}, - 'private_fqdn': {'readonly': True}, + "provisioning_state": {"readonly": True}, + "power_state": {"readonly": True}, + "max_agent_pools": {"readonly": True}, + "fqdn": {"readonly": True}, + "private_fqdn": {"readonly": True}, } _attribute_map = { - 'identity': {'key': 'identity', 'type': 'ManagedClusterIdentity'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'power_state': {'key': 'properties.powerState', 'type': 'PowerState'}, - 'max_agent_pools': {'key': 'properties.maxAgentPools', 'type': 'int'}, - 'kubernetes_version': {'key': 'properties.kubernetesVersion', 'type': 'str'}, - 'dns_prefix': {'key': 'properties.dnsPrefix', 'type': 'str'}, - 'fqdn': {'key': 'properties.fqdn', 'type': 'str'}, - 'private_fqdn': {'key': 'properties.privateFQDN', 'type': 'str'}, - 'agent_pool_profiles': {'key': 'properties.agentPoolProfiles', 'type': '[ManagedClusterAgentPoolProfile]'}, - 'linux_profile': {'key': 'properties.linuxProfile', 'type': 'ContainerServiceLinuxProfile'}, - 'windows_profile': {'key': 'properties.windowsProfile', 'type': 'ManagedClusterWindowsProfile'}, - 'service_principal_profile': {'key': 'properties.servicePrincipalProfile', 'type': 'ManagedClusterServicePrincipalProfile'}, - 'addon_profiles': {'key': 'properties.addonProfiles', 'type': '{ManagedClusterAddonProfile}'}, - 'pod_identity_profile': {'key': 'properties.podIdentityProfile', 'type': 'ManagedClusterPodIdentityProfile'}, - 'node_resource_group': {'key': 'properties.nodeResourceGroup', 'type': 'str'}, - 'enable_rbac': {'key': 'properties.enableRBAC', 'type': 'bool'}, - 'enable_pod_security_policy': {'key': 'properties.enablePodSecurityPolicy', 'type': 'bool'}, - 'network_profile': {'key': 'properties.networkProfile', 'type': 'ContainerServiceNetworkProfile'}, - 'aad_profile': {'key': 'properties.aadProfile', 'type': 'ManagedClusterAADProfile'}, - 'auto_upgrade_profile': {'key': 'properties.autoUpgradeProfile', 'type': 'ManagedClusterAutoUpgradeProfile'}, - 'auto_scaler_profile': {'key': 'properties.autoScalerProfile', 'type': 'ManagedClusterPropertiesAutoScalerProfile'}, - 'api_server_access_profile': {'key': 'properties.apiServerAccessProfile', 'type': 'ManagedClusterAPIServerAccessProfile'}, - 'disk_encryption_set_id': {'key': 'properties.diskEncryptionSetID', 'type': 'str'}, - 'identity_profile': {'key': 'properties.identityProfile', 'type': '{ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties}'}, + "identity": {"key": "identity", "type": "ManagedClusterIdentity"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "power_state": {"key": "properties.powerState", "type": "PowerState"}, + "max_agent_pools": {"key": "properties.maxAgentPools", "type": "int"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "dns_prefix": {"key": "properties.dnsPrefix", "type": "str"}, + "fqdn": {"key": "properties.fqdn", "type": "str"}, + "private_fqdn": {"key": "properties.privateFQDN", "type": "str"}, + "agent_pool_profiles": {"key": "properties.agentPoolProfiles", "type": "[ManagedClusterAgentPoolProfile]"}, + "linux_profile": {"key": "properties.linuxProfile", "type": "ContainerServiceLinuxProfile"}, + "windows_profile": {"key": "properties.windowsProfile", "type": "ManagedClusterWindowsProfile"}, + "service_principal_profile": { + "key": "properties.servicePrincipalProfile", + "type": "ManagedClusterServicePrincipalProfile", + }, + "addon_profiles": {"key": "properties.addonProfiles", "type": "{ManagedClusterAddonProfile}"}, + "pod_identity_profile": {"key": "properties.podIdentityProfile", "type": "ManagedClusterPodIdentityProfile"}, + "node_resource_group": {"key": "properties.nodeResourceGroup", "type": "str"}, + "enable_rbac": {"key": "properties.enableRBAC", "type": "bool"}, + "enable_pod_security_policy": {"key": "properties.enablePodSecurityPolicy", "type": "bool"}, + "network_profile": {"key": "properties.networkProfile", "type": "ContainerServiceNetworkProfile"}, + "aad_profile": {"key": "properties.aadProfile", "type": "ManagedClusterAADProfile"}, + "auto_upgrade_profile": {"key": "properties.autoUpgradeProfile", "type": "ManagedClusterAutoUpgradeProfile"}, + "auto_scaler_profile": { + "key": "properties.autoScalerProfile", + "type": "ManagedClusterPropertiesAutoScalerProfile", + }, + "api_server_access_profile": { + "key": "properties.apiServerAccessProfile", + "type": "ManagedClusterAPIServerAccessProfile", + }, + "disk_encryption_set_id": {"key": "properties.diskEncryptionSetID", "type": "str"}, + "identity_profile": { + "key": "properties.identityProfile", + "type": "{ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties}", + }, } - def __init__( + def __init__( # pylint: disable=too-many-locals self, *, identity: Optional["_models.ManagedClusterIdentity"] = None, @@ -872,7 +864,12 @@ def __init__( auto_scaler_profile: Optional["_models.ManagedClusterPropertiesAutoScalerProfile"] = None, api_server_access_profile: Optional["_models.ManagedClusterAPIServerAccessProfile"] = None, disk_encryption_set_id: Optional[str] = None, - identity_profile: Optional[Dict[str, "_models.ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties"]] = None, + identity_profile: Optional[ + Dict[ + str, + "_models.ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties", + ] + ] = None, **kwargs ): """ @@ -931,7 +928,7 @@ def __init__( :paramtype identity_profile: dict[str, ~azure.mgmt.containerservice.v2020_11_01.models.ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties] """ - super(Components1Q1Og48SchemasManagedclusterAllof1, self).__init__(**kwargs) + super().__init__(**kwargs) self.identity = identity self.provisioning_state = None self.power_state = None @@ -958,7 +955,9 @@ def __init__( self.identity_profile = identity_profile -class Components1Umhcm8SchemasManagedclusteridentityPropertiesUserassignedidentitiesAdditionalproperties(msrest.serialization.Model): +class Components1Umhcm8SchemasManagedclusteridentityPropertiesUserassignedidentitiesAdditionalproperties( + _serialization.Model +): """Components1Umhcm8SchemasManagedclusteridentityPropertiesUserassignedidentitiesAdditionalproperties. Variables are only populated by the server, and will be ignored when sending a request. @@ -970,27 +969,23 @@ class Components1Umhcm8SchemasManagedclusteridentityPropertiesUserassignedidenti """ _validation = { - 'principal_id': {'readonly': True}, - 'client_id': {'readonly': True}, + "principal_id": {"readonly": True}, + "client_id": {"readonly": True}, } _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, + "principal_id": {"key": "principalId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(Components1Umhcm8SchemasManagedclusteridentityPropertiesUserassignedidentitiesAdditionalproperties, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.principal_id = None self.client_id = None -class UserAssignedIdentity(msrest.serialization.Model): +class UserAssignedIdentity(_serialization.Model): """UserAssignedIdentity. :ivar resource_id: The resource id of the user assigned identity. @@ -1002,9 +997,9 @@ class UserAssignedIdentity(msrest.serialization.Model): """ _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'object_id': {'key': 'objectId', 'type': 'str'}, + "resource_id": {"key": "resourceId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + "object_id": {"key": "objectId", "type": "str"}, } def __init__( @@ -1023,13 +1018,15 @@ def __init__( :keyword object_id: The object id of the user assigned identity. :paramtype object_id: str """ - super(UserAssignedIdentity, self).__init__(**kwargs) + super().__init__(**kwargs) self.resource_id = resource_id self.client_id = client_id self.object_id = object_id -class ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties(UserAssignedIdentity): +class ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties( + UserAssignedIdentity +): """ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties. :ivar resource_id: The resource id of the user assigned identity. @@ -1041,9 +1038,9 @@ class ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAd """ _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'object_id': {'key': 'objectId', 'type': 'str'}, + "resource_id": {"key": "resourceId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + "object_id": {"key": "objectId", "type": "str"}, } def __init__( @@ -1062,83 +1059,72 @@ def __init__( :keyword object_id: The object id of the user assigned identity. :paramtype object_id: str """ - super(ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties, self).__init__(resource_id=resource_id, client_id=client_id, object_id=object_id, **kwargs) + super().__init__(resource_id=resource_id, client_id=client_id, object_id=object_id, **kwargs) -class ContainerServiceDiagnosticsProfile(msrest.serialization.Model): +class ContainerServiceDiagnosticsProfile(_serialization.Model): """Profile for diagnostics on the container service cluster. All required parameters must be populated in order to send to Azure. - :ivar vm_diagnostics: Required. Profile for diagnostics on the container service VMs. + :ivar vm_diagnostics: Profile for diagnostics on the container service VMs. Required. :vartype vm_diagnostics: ~azure.mgmt.containerservice.v2020_11_01.models.ContainerServiceVMDiagnostics """ _validation = { - 'vm_diagnostics': {'required': True}, + "vm_diagnostics": {"required": True}, } _attribute_map = { - 'vm_diagnostics': {'key': 'vmDiagnostics', 'type': 'ContainerServiceVMDiagnostics'}, + "vm_diagnostics": {"key": "vmDiagnostics", "type": "ContainerServiceVMDiagnostics"}, } - def __init__( - self, - *, - vm_diagnostics: "_models.ContainerServiceVMDiagnostics", - **kwargs - ): + def __init__(self, *, vm_diagnostics: "_models.ContainerServiceVMDiagnostics", **kwargs): """ - :keyword vm_diagnostics: Required. Profile for diagnostics on the container service VMs. + :keyword vm_diagnostics: Profile for diagnostics on the container service VMs. Required. :paramtype vm_diagnostics: ~azure.mgmt.containerservice.v2020_11_01.models.ContainerServiceVMDiagnostics """ - super(ContainerServiceDiagnosticsProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.vm_diagnostics = vm_diagnostics -class ContainerServiceLinuxProfile(msrest.serialization.Model): +class ContainerServiceLinuxProfile(_serialization.Model): """Profile for Linux VMs in the container service cluster. All required parameters must be populated in order to send to Azure. - :ivar admin_username: Required. The administrator username to use for Linux VMs. + :ivar admin_username: The administrator username to use for Linux VMs. Required. :vartype admin_username: str - :ivar ssh: Required. SSH configuration for Linux-based VMs running on Azure. + :ivar ssh: SSH configuration for Linux-based VMs running on Azure. Required. :vartype ssh: ~azure.mgmt.containerservice.v2020_11_01.models.ContainerServiceSshConfiguration """ _validation = { - 'admin_username': {'required': True, 'pattern': r'^[A-Za-z][-A-Za-z0-9_]*$'}, - 'ssh': {'required': True}, + "admin_username": {"required": True, "pattern": r"^[A-Za-z][-A-Za-z0-9_]*$"}, + "ssh": {"required": True}, } _attribute_map = { - 'admin_username': {'key': 'adminUsername', 'type': 'str'}, - 'ssh': {'key': 'ssh', 'type': 'ContainerServiceSshConfiguration'}, + "admin_username": {"key": "adminUsername", "type": "str"}, + "ssh": {"key": "ssh", "type": "ContainerServiceSshConfiguration"}, } - def __init__( - self, - *, - admin_username: str, - ssh: "_models.ContainerServiceSshConfiguration", - **kwargs - ): + def __init__(self, *, admin_username: str, ssh: "_models.ContainerServiceSshConfiguration", **kwargs): """ - :keyword admin_username: Required. The administrator username to use for Linux VMs. + :keyword admin_username: The administrator username to use for Linux VMs. Required. :paramtype admin_username: str - :keyword ssh: Required. SSH configuration for Linux-based VMs running on Azure. + :keyword ssh: SSH configuration for Linux-based VMs running on Azure. Required. :paramtype ssh: ~azure.mgmt.containerservice.v2020_11_01.models.ContainerServiceSshConfiguration """ - super(ContainerServiceLinuxProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.admin_username = admin_username self.ssh = ssh -class ContainerServiceMasterProfile(msrest.serialization.Model): +class ContainerServiceMasterProfile(_serialization.Model): """Profile for the container service master. Variables are only populated by the server, and will be ignored when sending a request. @@ -1146,11 +1132,11 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar count: Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, - and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". + and 5. The default value is 1. Known values are: 1, 3, and 5. :vartype count: int or ~azure.mgmt.containerservice.v2020_11_01.models.Count - :ivar dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. + :ivar dns_prefix: DNS prefix to be used to create the FQDN for the master pool. Required. :vartype dns_prefix: str - :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + :ivar vm_size: Size of agent VMs. Required. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -1187,7 +1173,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :vartype vm_size: str or ~azure.mgmt.containerservice.v2020_11_01.models.ContainerServiceVMSizeTypes :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine @@ -1201,7 +1187,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): :vartype first_consecutive_static_ip: str :ivar storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount" and "ManagedDisks". :vartype storage_profile: str or ~azure.mgmt.containerservice.v2020_11_01.models.ContainerServiceStorageProfileTypes :ivar fqdn: FQDN for the master pool. @@ -1209,21 +1195,21 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): """ _validation = { - 'dns_prefix': {'required': True}, - 'vm_size': {'required': True}, - 'os_disk_size_gb': {'maximum': 1023, 'minimum': 0}, - 'fqdn': {'readonly': True}, + "dns_prefix": {"required": True}, + "vm_size": {"required": True}, + "os_disk_size_gb": {"maximum": 1023, "minimum": 0}, + "fqdn": {"readonly": True}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'dns_prefix': {'key': 'dnsPrefix', 'type': 'str'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'first_consecutive_static_ip': {'key': 'firstConsecutiveStaticIP', 'type': 'str'}, - 'storage_profile': {'key': 'storageProfile', 'type': 'str'}, - 'fqdn': {'key': 'fqdn', 'type': 'str'}, + "count": {"key": "count", "type": "int"}, + "dns_prefix": {"key": "dnsPrefix", "type": "str"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "first_consecutive_static_ip": {"key": "firstConsecutiveStaticIP", "type": "str"}, + "storage_profile": {"key": "storageProfile", "type": "str"}, + "fqdn": {"key": "fqdn", "type": "str"}, } def __init__( @@ -1231,20 +1217,20 @@ def __init__( *, dns_prefix: str, vm_size: Union[str, "_models.ContainerServiceVMSizeTypes"], - count: Optional[Union[int, "_models.Count"]] = 1, + count: Union[int, "_models.Count"] = 1, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, - first_consecutive_static_ip: Optional[str] = "10.240.255.5", + first_consecutive_static_ip: str = "10.240.255.5", storage_profile: Optional[Union[str, "_models.ContainerServiceStorageProfileTypes"]] = None, **kwargs ): """ :keyword count: Number of masters (VMs) in the container service cluster. Allowed values are 1, - 3, and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". + 3, and 5. The default value is 1. Known values are: 1, 3, and 5. :paramtype count: int or ~azure.mgmt.containerservice.v2020_11_01.models.Count - :keyword dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. + :keyword dns_prefix: DNS prefix to be used to create the FQDN for the master pool. Required. :paramtype dns_prefix: str - :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + :keyword vm_size: Size of agent VMs. Required. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -1281,7 +1267,7 @@ def __init__( "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :paramtype vm_size: str or ~azure.mgmt.containerservice.v2020_11_01.models.ContainerServiceVMSizeTypes :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every @@ -1295,11 +1281,11 @@ def __init__( :paramtype first_consecutive_static_ip: str :keyword storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount" and "ManagedDisks". :paramtype storage_profile: str or ~azure.mgmt.containerservice.v2020_11_01.models.ContainerServiceStorageProfileTypes """ - super(ContainerServiceMasterProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.dns_prefix = dns_prefix self.vm_size = vm_size @@ -1310,17 +1296,17 @@ def __init__( self.fqdn = None -class ContainerServiceNetworkProfile(msrest.serialization.Model): +class ContainerServiceNetworkProfile(_serialization.Model): """Profile of network configuration. :ivar network_plugin: Network plugin used for building Kubernetes network. Known values are: - "azure", "kubenet". Default value: "kubenet". + "azure" and "kubenet". :vartype network_plugin: str or ~azure.mgmt.containerservice.v2020_11_01.models.NetworkPlugin :ivar network_policy: Network policy used for building Kubernetes network. Known values are: - "calico", "azure". + "calico" and "azure". :vartype network_policy: str or ~azure.mgmt.containerservice.v2020_11_01.models.NetworkPolicy :ivar network_mode: Network mode used for building Kubernetes network. Known values are: - "transparent", "bridge". + "transparent" and "bridge". :vartype network_mode: str or ~azure.mgmt.containerservice.v2020_11_01.models.NetworkMode :ivar pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :vartype pod_cidr: str @@ -1333,11 +1319,11 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): :ivar docker_bridge_cidr: A CIDR notation IP range assigned to the Docker bridge network. It must not overlap with any Subnet IP ranges or the Kubernetes service address range. :vartype docker_bridge_cidr: str - :ivar outbound_type: The outbound (egress) routing method. Known values are: "loadBalancer", - "userDefinedRouting". Default value: "loadBalancer". + :ivar outbound_type: The outbound (egress) routing method. Known values are: "loadBalancer" and + "userDefinedRouting". :vartype outbound_type: str or ~azure.mgmt.containerservice.v2020_11_01.models.OutboundType :ivar load_balancer_sku: The load balancer sku for the managed cluster. Known values are: - "standard", "basic". + "standard" and "basic". :vartype load_balancer_sku: str or ~azure.mgmt.containerservice.v2020_11_01.models.LoadBalancerSku :ivar load_balancer_profile: Profile of the cluster load balancer. @@ -1346,49 +1332,51 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): """ _validation = { - 'pod_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, - 'service_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, - 'dns_service_ip': {'pattern': r'^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$'}, - 'docker_bridge_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, + "pod_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, + "service_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, + "dns_service_ip": { + "pattern": r"^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$" + }, + "docker_bridge_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, } _attribute_map = { - 'network_plugin': {'key': 'networkPlugin', 'type': 'str'}, - 'network_policy': {'key': 'networkPolicy', 'type': 'str'}, - 'network_mode': {'key': 'networkMode', 'type': 'str'}, - 'pod_cidr': {'key': 'podCidr', 'type': 'str'}, - 'service_cidr': {'key': 'serviceCidr', 'type': 'str'}, - 'dns_service_ip': {'key': 'dnsServiceIP', 'type': 'str'}, - 'docker_bridge_cidr': {'key': 'dockerBridgeCidr', 'type': 'str'}, - 'outbound_type': {'key': 'outboundType', 'type': 'str'}, - 'load_balancer_sku': {'key': 'loadBalancerSku', 'type': 'str'}, - 'load_balancer_profile': {'key': 'loadBalancerProfile', 'type': 'ManagedClusterLoadBalancerProfile'}, + "network_plugin": {"key": "networkPlugin", "type": "str"}, + "network_policy": {"key": "networkPolicy", "type": "str"}, + "network_mode": {"key": "networkMode", "type": "str"}, + "pod_cidr": {"key": "podCidr", "type": "str"}, + "service_cidr": {"key": "serviceCidr", "type": "str"}, + "dns_service_ip": {"key": "dnsServiceIP", "type": "str"}, + "docker_bridge_cidr": {"key": "dockerBridgeCidr", "type": "str"}, + "outbound_type": {"key": "outboundType", "type": "str"}, + "load_balancer_sku": {"key": "loadBalancerSku", "type": "str"}, + "load_balancer_profile": {"key": "loadBalancerProfile", "type": "ManagedClusterLoadBalancerProfile"}, } def __init__( self, *, - network_plugin: Optional[Union[str, "_models.NetworkPlugin"]] = "kubenet", + network_plugin: Union[str, "_models.NetworkPlugin"] = "kubenet", network_policy: Optional[Union[str, "_models.NetworkPolicy"]] = None, network_mode: Optional[Union[str, "_models.NetworkMode"]] = None, - pod_cidr: Optional[str] = "10.244.0.0/16", - service_cidr: Optional[str] = "10.0.0.0/16", - dns_service_ip: Optional[str] = "10.0.0.10", - docker_bridge_cidr: Optional[str] = "172.17.0.1/16", - outbound_type: Optional[Union[str, "_models.OutboundType"]] = "loadBalancer", + pod_cidr: str = "10.244.0.0/16", + service_cidr: str = "10.0.0.0/16", + dns_service_ip: str = "10.0.0.10", + docker_bridge_cidr: str = "172.17.0.1/16", + outbound_type: Union[str, "_models.OutboundType"] = "loadBalancer", load_balancer_sku: Optional[Union[str, "_models.LoadBalancerSku"]] = None, load_balancer_profile: Optional["_models.ManagedClusterLoadBalancerProfile"] = None, **kwargs ): """ :keyword network_plugin: Network plugin used for building Kubernetes network. Known values are: - "azure", "kubenet". Default value: "kubenet". + "azure" and "kubenet". :paramtype network_plugin: str or ~azure.mgmt.containerservice.v2020_11_01.models.NetworkPlugin :keyword network_policy: Network policy used for building Kubernetes network. Known values are: - "calico", "azure". + "calico" and "azure". :paramtype network_policy: str or ~azure.mgmt.containerservice.v2020_11_01.models.NetworkPolicy :keyword network_mode: Network mode used for building Kubernetes network. Known values are: - "transparent", "bridge". + "transparent" and "bridge". :paramtype network_mode: str or ~azure.mgmt.containerservice.v2020_11_01.models.NetworkMode :keyword pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :paramtype pod_cidr: str @@ -1401,18 +1389,18 @@ def __init__( :keyword docker_bridge_cidr: A CIDR notation IP range assigned to the Docker bridge network. It must not overlap with any Subnet IP ranges or the Kubernetes service address range. :paramtype docker_bridge_cidr: str - :keyword outbound_type: The outbound (egress) routing method. Known values are: "loadBalancer", - "userDefinedRouting". Default value: "loadBalancer". + :keyword outbound_type: The outbound (egress) routing method. Known values are: "loadBalancer" + and "userDefinedRouting". :paramtype outbound_type: str or ~azure.mgmt.containerservice.v2020_11_01.models.OutboundType :keyword load_balancer_sku: The load balancer sku for the managed cluster. Known values are: - "standard", "basic". + "standard" and "basic". :paramtype load_balancer_sku: str or ~azure.mgmt.containerservice.v2020_11_01.models.LoadBalancerSku :keyword load_balancer_profile: Profile of the cluster load balancer. :paramtype load_balancer_profile: ~azure.mgmt.containerservice.v2020_11_01.models.ManagedClusterLoadBalancerProfile """ - super(ContainerServiceNetworkProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.network_plugin = network_plugin self.network_policy = network_policy self.network_mode = network_mode @@ -1425,113 +1413,98 @@ def __init__( self.load_balancer_profile = load_balancer_profile -class ContainerServiceSshConfiguration(msrest.serialization.Model): +class ContainerServiceSshConfiguration(_serialization.Model): """SSH configuration for Linux-based VMs running on Azure. All required parameters must be populated in order to send to Azure. - :ivar public_keys: Required. The list of SSH public keys used to authenticate with Linux-based - VMs. Only expect one key specified. + :ivar public_keys: The list of SSH public keys used to authenticate with Linux-based VMs. Only + expect one key specified. Required. :vartype public_keys: list[~azure.mgmt.containerservice.v2020_11_01.models.ContainerServiceSshPublicKey] """ _validation = { - 'public_keys': {'required': True}, + "public_keys": {"required": True}, } _attribute_map = { - 'public_keys': {'key': 'publicKeys', 'type': '[ContainerServiceSshPublicKey]'}, + "public_keys": {"key": "publicKeys", "type": "[ContainerServiceSshPublicKey]"}, } - def __init__( - self, - *, - public_keys: List["_models.ContainerServiceSshPublicKey"], - **kwargs - ): + def __init__(self, *, public_keys: List["_models.ContainerServiceSshPublicKey"], **kwargs): """ - :keyword public_keys: Required. The list of SSH public keys used to authenticate with - Linux-based VMs. Only expect one key specified. + :keyword public_keys: The list of SSH public keys used to authenticate with Linux-based VMs. + Only expect one key specified. Required. :paramtype public_keys: list[~azure.mgmt.containerservice.v2020_11_01.models.ContainerServiceSshPublicKey] """ - super(ContainerServiceSshConfiguration, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_keys = public_keys -class ContainerServiceSshPublicKey(msrest.serialization.Model): +class ContainerServiceSshPublicKey(_serialization.Model): """Contains information about SSH certificate public key data. All required parameters must be populated in order to send to Azure. - :ivar key_data: Required. Certificate public key used to authenticate with VMs through SSH. The - certificate must be in PEM format with or without headers. + :ivar key_data: Certificate public key used to authenticate with VMs through SSH. The + certificate must be in PEM format with or without headers. Required. :vartype key_data: str """ _validation = { - 'key_data': {'required': True}, + "key_data": {"required": True}, } _attribute_map = { - 'key_data': {'key': 'keyData', 'type': 'str'}, + "key_data": {"key": "keyData", "type": "str"}, } - def __init__( - self, - *, - key_data: str, - **kwargs - ): + def __init__(self, *, key_data: str, **kwargs): """ - :keyword key_data: Required. Certificate public key used to authenticate with VMs through SSH. - The certificate must be in PEM format with or without headers. + :keyword key_data: Certificate public key used to authenticate with VMs through SSH. The + certificate must be in PEM format with or without headers. Required. :paramtype key_data: str """ - super(ContainerServiceSshPublicKey, self).__init__(**kwargs) + super().__init__(**kwargs) self.key_data = key_data -class ContainerServiceVMDiagnostics(msrest.serialization.Model): +class ContainerServiceVMDiagnostics(_serialization.Model): """Profile for diagnostics on the container service VMs. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar enabled: Required. Whether the VM diagnostic agent is provisioned on the VM. + :ivar enabled: Whether the VM diagnostic agent is provisioned on the VM. Required. :vartype enabled: bool :ivar storage_uri: The URI of the storage account where diagnostics are stored. :vartype storage_uri: str """ _validation = { - 'enabled': {'required': True}, - 'storage_uri': {'readonly': True}, + "enabled": {"required": True}, + "storage_uri": {"readonly": True}, } _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'storage_uri': {'key': 'storageUri', 'type': 'str'}, + "enabled": {"key": "enabled", "type": "bool"}, + "storage_uri": {"key": "storageUri", "type": "str"}, } - def __init__( - self, - *, - enabled: bool, - **kwargs - ): + def __init__(self, *, enabled: bool, **kwargs): """ - :keyword enabled: Required. Whether the VM diagnostic agent is provisioned on the VM. + :keyword enabled: Whether the VM diagnostic agent is provisioned on the VM. Required. :paramtype enabled: bool """ - super(ContainerServiceVMDiagnostics, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.storage_uri = None -class CredentialResult(msrest.serialization.Model): +class CredentialResult(_serialization.Model): """The credential result response. Variables are only populated by the server, and will be ignored when sending a request. @@ -1539,31 +1512,27 @@ class CredentialResult(msrest.serialization.Model): :ivar name: The name of the credential. :vartype name: str :ivar value: Base64-encoded Kubernetes configuration file. - :vartype value: bytearray + :vartype value: bytes """ _validation = { - 'name': {'readonly': True}, - 'value': {'readonly': True}, + "name": {"readonly": True}, + "value": {"readonly": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'bytearray'}, + "name": {"key": "name", "type": "str"}, + "value": {"key": "value", "type": "bytearray"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(CredentialResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.name = None self.value = None -class CredentialResults(msrest.serialization.Model): +class CredentialResults(_serialization.Model): """The list of credential result response. Variables are only populated by the server, and will be ignored when sending a request. @@ -1573,24 +1542,20 @@ class CredentialResults(msrest.serialization.Model): """ _validation = { - 'kubeconfigs': {'readonly': True}, + "kubeconfigs": {"readonly": True}, } _attribute_map = { - 'kubeconfigs': {'key': 'kubeconfigs', 'type': '[CredentialResult]'}, + "kubeconfigs": {"key": "kubeconfigs", "type": "[CredentialResult]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(CredentialResults, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.kubeconfigs = None -class KubeletConfig(msrest.serialization.Model): +class KubeletConfig(_serialization.Model): """Kubelet configurations of agent nodes. :ivar cpu_manager_policy: CPU Manager policy to use. @@ -1616,14 +1581,14 @@ class KubeletConfig(msrest.serialization.Model): """ _attribute_map = { - 'cpu_manager_policy': {'key': 'cpuManagerPolicy', 'type': 'str'}, - 'cpu_cfs_quota': {'key': 'cpuCfsQuota', 'type': 'bool'}, - 'cpu_cfs_quota_period': {'key': 'cpuCfsQuotaPeriod', 'type': 'str'}, - 'image_gc_high_threshold': {'key': 'imageGcHighThreshold', 'type': 'int'}, - 'image_gc_low_threshold': {'key': 'imageGcLowThreshold', 'type': 'int'}, - 'topology_manager_policy': {'key': 'topologyManagerPolicy', 'type': 'str'}, - 'allowed_unsafe_sysctls': {'key': 'allowedUnsafeSysctls', 'type': '[str]'}, - 'fail_swap_on': {'key': 'failSwapOn', 'type': 'bool'}, + "cpu_manager_policy": {"key": "cpuManagerPolicy", "type": "str"}, + "cpu_cfs_quota": {"key": "cpuCfsQuota", "type": "bool"}, + "cpu_cfs_quota_period": {"key": "cpuCfsQuotaPeriod", "type": "str"}, + "image_gc_high_threshold": {"key": "imageGcHighThreshold", "type": "int"}, + "image_gc_low_threshold": {"key": "imageGcLowThreshold", "type": "int"}, + "topology_manager_policy": {"key": "topologyManagerPolicy", "type": "str"}, + "allowed_unsafe_sysctls": {"key": "allowedUnsafeSysctls", "type": "[str]"}, + "fail_swap_on": {"key": "failSwapOn", "type": "bool"}, } def __init__( @@ -1662,7 +1627,7 @@ def __init__( on the node. :paramtype fail_swap_on: bool """ - super(KubeletConfig, self).__init__(**kwargs) + super().__init__(**kwargs) self.cpu_manager_policy = cpu_manager_policy self.cpu_cfs_quota = cpu_cfs_quota self.cpu_cfs_quota_period = cpu_cfs_quota_period @@ -1673,7 +1638,7 @@ def __init__( self.fail_swap_on = fail_swap_on -class LinuxOSConfig(msrest.serialization.Model): +class LinuxOSConfig(_serialization.Model): """OS configurations of Linux agent nodes. :ivar sysctls: Sysctl settings for Linux agent nodes. @@ -1688,10 +1653,10 @@ class LinuxOSConfig(msrest.serialization.Model): """ _attribute_map = { - 'sysctls': {'key': 'sysctls', 'type': 'SysctlConfig'}, - 'transparent_huge_page_enabled': {'key': 'transparentHugePageEnabled', 'type': 'str'}, - 'transparent_huge_page_defrag': {'key': 'transparentHugePageDefrag', 'type': 'str'}, - 'swap_file_size_mb': {'key': 'swapFileSizeMB', 'type': 'int'}, + "sysctls": {"key": "sysctls", "type": "SysctlConfig"}, + "transparent_huge_page_enabled": {"key": "transparentHugePageEnabled", "type": "str"}, + "transparent_huge_page_defrag": {"key": "transparentHugePageDefrag", "type": "str"}, + "swap_file_size_mb": {"key": "swapFileSizeMB", "type": "int"}, } def __init__( @@ -1714,14 +1679,14 @@ def __init__( on each node. :paramtype swap_file_size_mb: int """ - super(LinuxOSConfig, self).__init__(**kwargs) + super().__init__(**kwargs) self.sysctls = sysctls self.transparent_huge_page_enabled = transparent_huge_page_enabled self.transparent_huge_page_defrag = transparent_huge_page_defrag self.swap_file_size_mb = swap_file_size_mb -class Resource(msrest.serialization.Model): +class Resource(_serialization.Model): """The Resource model definition. Variables are only populated by the server, and will be ignored when sending a request. @@ -1734,41 +1699,35 @@ class Resource(msrest.serialization.Model): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] """ - super(Resource, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -1776,7 +1735,9 @@ def __init__( self.tags = tags -class ManagedCluster(Resource, Components1Q1Og48SchemasManagedclusterAllof1): +class ManagedCluster( + Resource, Components1Q1Og48SchemasManagedclusterAllof1 +): # pylint: disable=too-many-instance-attributes """Managed cluster. Variables are only populated by the server, and will be ignored when sending a request. @@ -1853,60 +1814,72 @@ class ManagedCluster(Resource, Components1Q1Og48SchemasManagedclusterAllof1): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar sku: The managed cluster SKU. :vartype sku: ~azure.mgmt.containerservice.v2020_11_01.models.ManagedClusterSKU """ _validation = { - 'provisioning_state': {'readonly': True}, - 'power_state': {'readonly': True}, - 'max_agent_pools': {'readonly': True}, - 'fqdn': {'readonly': True}, - 'private_fqdn': {'readonly': True}, - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, + "provisioning_state": {"readonly": True}, + "power_state": {"readonly": True}, + "max_agent_pools": {"readonly": True}, + "fqdn": {"readonly": True}, + "private_fqdn": {"readonly": True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { - 'identity': {'key': 'identity', 'type': 'ManagedClusterIdentity'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'power_state': {'key': 'properties.powerState', 'type': 'PowerState'}, - 'max_agent_pools': {'key': 'properties.maxAgentPools', 'type': 'int'}, - 'kubernetes_version': {'key': 'properties.kubernetesVersion', 'type': 'str'}, - 'dns_prefix': {'key': 'properties.dnsPrefix', 'type': 'str'}, - 'fqdn': {'key': 'properties.fqdn', 'type': 'str'}, - 'private_fqdn': {'key': 'properties.privateFQDN', 'type': 'str'}, - 'agent_pool_profiles': {'key': 'properties.agentPoolProfiles', 'type': '[ManagedClusterAgentPoolProfile]'}, - 'linux_profile': {'key': 'properties.linuxProfile', 'type': 'ContainerServiceLinuxProfile'}, - 'windows_profile': {'key': 'properties.windowsProfile', 'type': 'ManagedClusterWindowsProfile'}, - 'service_principal_profile': {'key': 'properties.servicePrincipalProfile', 'type': 'ManagedClusterServicePrincipalProfile'}, - 'addon_profiles': {'key': 'properties.addonProfiles', 'type': '{ManagedClusterAddonProfile}'}, - 'pod_identity_profile': {'key': 'properties.podIdentityProfile', 'type': 'ManagedClusterPodIdentityProfile'}, - 'node_resource_group': {'key': 'properties.nodeResourceGroup', 'type': 'str'}, - 'enable_rbac': {'key': 'properties.enableRBAC', 'type': 'bool'}, - 'enable_pod_security_policy': {'key': 'properties.enablePodSecurityPolicy', 'type': 'bool'}, - 'network_profile': {'key': 'properties.networkProfile', 'type': 'ContainerServiceNetworkProfile'}, - 'aad_profile': {'key': 'properties.aadProfile', 'type': 'ManagedClusterAADProfile'}, - 'auto_upgrade_profile': {'key': 'properties.autoUpgradeProfile', 'type': 'ManagedClusterAutoUpgradeProfile'}, - 'auto_scaler_profile': {'key': 'properties.autoScalerProfile', 'type': 'ManagedClusterPropertiesAutoScalerProfile'}, - 'api_server_access_profile': {'key': 'properties.apiServerAccessProfile', 'type': 'ManagedClusterAPIServerAccessProfile'}, - 'disk_encryption_set_id': {'key': 'properties.diskEncryptionSetID', 'type': 'str'}, - 'identity_profile': {'key': 'properties.identityProfile', 'type': '{ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties}'}, - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'ManagedClusterSKU'}, + "identity": {"key": "identity", "type": "ManagedClusterIdentity"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "power_state": {"key": "properties.powerState", "type": "PowerState"}, + "max_agent_pools": {"key": "properties.maxAgentPools", "type": "int"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "dns_prefix": {"key": "properties.dnsPrefix", "type": "str"}, + "fqdn": {"key": "properties.fqdn", "type": "str"}, + "private_fqdn": {"key": "properties.privateFQDN", "type": "str"}, + "agent_pool_profiles": {"key": "properties.agentPoolProfiles", "type": "[ManagedClusterAgentPoolProfile]"}, + "linux_profile": {"key": "properties.linuxProfile", "type": "ContainerServiceLinuxProfile"}, + "windows_profile": {"key": "properties.windowsProfile", "type": "ManagedClusterWindowsProfile"}, + "service_principal_profile": { + "key": "properties.servicePrincipalProfile", + "type": "ManagedClusterServicePrincipalProfile", + }, + "addon_profiles": {"key": "properties.addonProfiles", "type": "{ManagedClusterAddonProfile}"}, + "pod_identity_profile": {"key": "properties.podIdentityProfile", "type": "ManagedClusterPodIdentityProfile"}, + "node_resource_group": {"key": "properties.nodeResourceGroup", "type": "str"}, + "enable_rbac": {"key": "properties.enableRBAC", "type": "bool"}, + "enable_pod_security_policy": {"key": "properties.enablePodSecurityPolicy", "type": "bool"}, + "network_profile": {"key": "properties.networkProfile", "type": "ContainerServiceNetworkProfile"}, + "aad_profile": {"key": "properties.aadProfile", "type": "ManagedClusterAADProfile"}, + "auto_upgrade_profile": {"key": "properties.autoUpgradeProfile", "type": "ManagedClusterAutoUpgradeProfile"}, + "auto_scaler_profile": { + "key": "properties.autoScalerProfile", + "type": "ManagedClusterPropertiesAutoScalerProfile", + }, + "api_server_access_profile": { + "key": "properties.apiServerAccessProfile", + "type": "ManagedClusterAPIServerAccessProfile", + }, + "disk_encryption_set_id": {"key": "properties.diskEncryptionSetID", "type": "str"}, + "identity_profile": { + "key": "properties.identityProfile", + "type": "{ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties}", + }, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "sku": {"key": "sku", "type": "ManagedClusterSKU"}, } - def __init__( + def __init__( # pylint: disable=too-many-locals self, *, location: str, @@ -1928,7 +1901,12 @@ def __init__( auto_scaler_profile: Optional["_models.ManagedClusterPropertiesAutoScalerProfile"] = None, api_server_access_profile: Optional["_models.ManagedClusterAPIServerAccessProfile"] = None, disk_encryption_set_id: Optional[str] = None, - identity_profile: Optional[Dict[str, "_models.ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties"]] = None, + identity_profile: Optional[ + Dict[ + str, + "_models.ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties", + ] + ] = None, tags: Optional[Dict[str, str]] = None, sku: Optional["_models.ManagedClusterSKU"] = None, **kwargs @@ -1988,14 +1966,37 @@ def __init__( :keyword identity_profile: Identities associated with the cluster. :paramtype identity_profile: dict[str, ~azure.mgmt.containerservice.v2020_11_01.models.ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties] - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword sku: The managed cluster SKU. :paramtype sku: ~azure.mgmt.containerservice.v2020_11_01.models.ManagedClusterSKU """ - super(ManagedCluster, self).__init__(location=location, tags=tags, identity=identity, kubernetes_version=kubernetes_version, dns_prefix=dns_prefix, agent_pool_profiles=agent_pool_profiles, linux_profile=linux_profile, windows_profile=windows_profile, service_principal_profile=service_principal_profile, addon_profiles=addon_profiles, pod_identity_profile=pod_identity_profile, node_resource_group=node_resource_group, enable_rbac=enable_rbac, enable_pod_security_policy=enable_pod_security_policy, network_profile=network_profile, aad_profile=aad_profile, auto_upgrade_profile=auto_upgrade_profile, auto_scaler_profile=auto_scaler_profile, api_server_access_profile=api_server_access_profile, disk_encryption_set_id=disk_encryption_set_id, identity_profile=identity_profile, **kwargs) + super().__init__( + location=location, + tags=tags, + identity=identity, + kubernetes_version=kubernetes_version, + dns_prefix=dns_prefix, + agent_pool_profiles=agent_pool_profiles, + linux_profile=linux_profile, + windows_profile=windows_profile, + service_principal_profile=service_principal_profile, + addon_profiles=addon_profiles, + pod_identity_profile=pod_identity_profile, + node_resource_group=node_resource_group, + enable_rbac=enable_rbac, + enable_pod_security_policy=enable_pod_security_policy, + network_profile=network_profile, + aad_profile=aad_profile, + auto_upgrade_profile=auto_upgrade_profile, + auto_scaler_profile=auto_scaler_profile, + api_server_access_profile=api_server_access_profile, + disk_encryption_set_id=disk_encryption_set_id, + identity_profile=identity_profile, + **kwargs + ) self.identity = identity self.provisioning_state = None self.power_state = None @@ -2028,7 +2029,7 @@ def __init__( self.tags = tags -class ManagedClusterAADProfile(msrest.serialization.Model): +class ManagedClusterAADProfile(_serialization.Model): """AADProfile specifies attributes for Azure Active Directory integration. :ivar managed: Whether to enable managed AAD. @@ -2049,13 +2050,13 @@ class ManagedClusterAADProfile(msrest.serialization.Model): """ _attribute_map = { - 'managed': {'key': 'managed', 'type': 'bool'}, - 'enable_azure_rbac': {'key': 'enableAzureRBAC', 'type': 'bool'}, - 'admin_group_object_i_ds': {'key': 'adminGroupObjectIDs', 'type': '[str]'}, - 'client_app_id': {'key': 'clientAppID', 'type': 'str'}, - 'server_app_id': {'key': 'serverAppID', 'type': 'str'}, - 'server_app_secret': {'key': 'serverAppSecret', 'type': 'str'}, - 'tenant_id': {'key': 'tenantID', 'type': 'str'}, + "managed": {"key": "managed", "type": "bool"}, + "enable_azure_rbac": {"key": "enableAzureRBAC", "type": "bool"}, + "admin_group_object_i_ds": {"key": "adminGroupObjectIDs", "type": "[str]"}, + "client_app_id": {"key": "clientAppID", "type": "str"}, + "server_app_id": {"key": "serverAppID", "type": "str"}, + "server_app_secret": {"key": "serverAppSecret", "type": "str"}, + "tenant_id": {"key": "tenantID", "type": "str"}, } def __init__( @@ -2088,7 +2089,7 @@ def __init__( tenant of the deployment subscription. :paramtype tenant_id: str """ - super(ManagedClusterAADProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.managed = managed self.enable_azure_rbac = enable_azure_rbac self.admin_group_object_i_ds = admin_group_object_i_ds @@ -2111,58 +2112,53 @@ class ManagedClusterAccessProfile(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar kube_config: Base64-encoded Kubernetes configuration file. - :vartype kube_config: bytearray + :vartype kube_config: bytes """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'kube_config': {'key': 'properties.kubeConfig', 'type': 'bytearray'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "kube_config": {"key": "properties.kubeConfig", "type": "bytearray"}, } def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - kube_config: Optional[bytearray] = None, - **kwargs + self, *, location: str, tags: Optional[Dict[str, str]] = None, kube_config: Optional[bytes] = None, **kwargs ): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword kube_config: Base64-encoded Kubernetes configuration file. - :paramtype kube_config: bytearray + :paramtype kube_config: bytes """ - super(ManagedClusterAccessProfile, self).__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.kube_config = kube_config -class ManagedClusterAddonProfile(msrest.serialization.Model): +class ManagedClusterAddonProfile(_serialization.Model): """A Kubernetes add-on profile for a managed cluster. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar enabled: Required. Whether the add-on is enabled or not. + :ivar enabled: Whether the add-on is enabled or not. Required. :vartype enabled: bool :ivar config: Key-value pairs for configuring an add-on. :vartype config: dict[str, str] @@ -2172,30 +2168,24 @@ class ManagedClusterAddonProfile(msrest.serialization.Model): """ _validation = { - 'enabled': {'required': True}, - 'identity': {'readonly': True}, + "enabled": {"required": True}, + "identity": {"readonly": True}, } _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'config': {'key': 'config', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'ManagedClusterAddonProfileIdentity'}, + "enabled": {"key": "enabled", "type": "bool"}, + "config": {"key": "config", "type": "{str}"}, + "identity": {"key": "identity", "type": "ManagedClusterAddonProfileIdentity"}, } - def __init__( - self, - *, - enabled: bool, - config: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, enabled: bool, config: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword enabled: Required. Whether the add-on is enabled or not. + :keyword enabled: Whether the add-on is enabled or not. Required. :paramtype enabled: bool :keyword config: Key-value pairs for configuring an add-on. :paramtype config: dict[str, str] """ - super(ManagedClusterAddonProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.config = config self.identity = None @@ -2213,9 +2203,9 @@ class ManagedClusterAddonProfileIdentity(UserAssignedIdentity): """ _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'object_id': {'key': 'objectId', 'type': 'str'}, + "resource_id": {"key": "resourceId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + "object_id": {"key": "objectId", "type": "str"}, } def __init__( @@ -2234,10 +2224,10 @@ def __init__( :keyword object_id: The object id of the user assigned identity. :paramtype object_id: str """ - super(ManagedClusterAddonProfileIdentity, self).__init__(resource_id=resource_id, client_id=client_id, object_id=object_id, **kwargs) + super().__init__(resource_id=resource_id, client_id=client_id, object_id=object_id, **kwargs) -class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): +class ManagedClusterAgentPoolProfileProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes """Properties for the container service agent pool profile. Variables are only populated by the server, and will be ignored when sending a request. @@ -2283,7 +2273,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :vartype vm_size: str or ~azure.mgmt.containerservice.v2020_11_01.models.ContainerServiceVMSizeTypes :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine @@ -2293,7 +2283,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar os_disk_type: OS disk type to be used for machines in a given agent pool. Allowed values are 'Ephemeral' and 'Managed'. If unspecified, defaults to 'Ephemeral' when the VM supports ephemeral OS and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults - to 'Managed'. May not be changed after creation. Known values are: "Managed", "Ephemeral". + to 'Managed'. May not be changed after creation. Known values are: "Managed" and "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2020_11_01.models.OSDiskType :ivar vnet_subnet_id: VNet SubnetID specifies the VNet's subnet identifier for nodes and maybe pods. @@ -2303,7 +2293,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Known values are: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux" and "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2020_11_01.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -2312,9 +2302,10 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar type: AgentPoolType represents types of an agent pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2020_11_01.models.AgentPoolType - :ivar mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", "User". + :ivar mode: AgentPoolMode represents mode of an agent pool. Known values are: "System" and + "User". :vartype mode: str or ~azure.mgmt.containerservice.v2020_11_01.models.AgentPoolMode :ivar orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -2335,20 +2326,19 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar enable_node_public_ip: Enable public IP for nodes. :vartype enable_node_public_ip: bool :ivar scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Known values are: "Spot", "Regular". Default value: "Regular". + priority. Default to regular. Known values are: "Spot" and "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_11_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy - for Spot virtual machine scale set. Default to Delete. Known values are: "Delete", - "Deallocate". Default value: "Delete". + for Spot virtual machine scale set. Default to Delete. Known values are: "Delete" and + "Deallocate". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_11_01.models.ScaleSetEvictionPolicy :ivar spot_max_price: SpotMaxPrice to be used to specify the maximum price you are willing to pay in US Dollars. Possible values are any decimal value greater than zero or -1 which indicates default price to be up-to on-demand. :vartype spot_max_price: float - :ivar tags: A set of tags. Agent pool tags to be persisted on the agent pool virtual machine - scale set. + :ivar tags: Agent pool tags to be persisted on the agent pool virtual machine scale set. :vartype tags: dict[str, str] :ivar node_labels: Agent pool node labels to be persisted across all nodes in agent pool. :vartype node_labels: dict[str, str] @@ -2364,45 +2354,45 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): """ _validation = { - 'os_disk_size_gb': {'maximum': 1023, 'minimum': 0}, - 'node_image_version': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'power_state': {'readonly': True}, + "os_disk_size_gb": {"maximum": 1023, "minimum": 0}, + "node_image_version": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "power_state": {"readonly": True}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'os_disk_type': {'key': 'osDiskType', 'type': 'str'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'pod_subnet_id': {'key': 'podSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'maxPods', 'type': 'int'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'max_count': {'key': 'maxCount', 'type': 'int'}, - 'min_count': {'key': 'minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'enableAutoScaling', 'type': 'bool'}, - 'type': {'key': 'type', 'type': 'str'}, - 'mode': {'key': 'mode', 'type': 'str'}, - 'orchestrator_version': {'key': 'orchestratorVersion', 'type': 'str'}, - 'node_image_version': {'key': 'nodeImageVersion', 'type': 'str'}, - 'upgrade_settings': {'key': 'upgradeSettings', 'type': 'AgentPoolUpgradeSettings'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'power_state': {'key': 'powerState', 'type': 'PowerState'}, - 'availability_zones': {'key': 'availabilityZones', 'type': '[str]'}, - 'enable_node_public_ip': {'key': 'enableNodePublicIP', 'type': 'bool'}, - 'scale_set_priority': {'key': 'scaleSetPriority', 'type': 'str'}, - 'scale_set_eviction_policy': {'key': 'scaleSetEvictionPolicy', 'type': 'str'}, - 'spot_max_price': {'key': 'spotMaxPrice', 'type': 'float'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'node_labels': {'key': 'nodeLabels', 'type': '{str}'}, - 'node_taints': {'key': 'nodeTaints', 'type': '[str]'}, - 'proximity_placement_group_id': {'key': 'proximityPlacementGroupID', 'type': 'str'}, - 'kubelet_config': {'key': 'kubeletConfig', 'type': 'KubeletConfig'}, - 'linux_os_config': {'key': 'linuxOSConfig', 'type': 'LinuxOSConfig'}, + "count": {"key": "count", "type": "int"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "os_disk_type": {"key": "osDiskType", "type": "str"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "pod_subnet_id": {"key": "podSubnetID", "type": "str"}, + "max_pods": {"key": "maxPods", "type": "int"}, + "os_type": {"key": "osType", "type": "str"}, + "max_count": {"key": "maxCount", "type": "int"}, + "min_count": {"key": "minCount", "type": "int"}, + "enable_auto_scaling": {"key": "enableAutoScaling", "type": "bool"}, + "type": {"key": "type", "type": "str"}, + "mode": {"key": "mode", "type": "str"}, + "orchestrator_version": {"key": "orchestratorVersion", "type": "str"}, + "node_image_version": {"key": "nodeImageVersion", "type": "str"}, + "upgrade_settings": {"key": "upgradeSettings", "type": "AgentPoolUpgradeSettings"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "power_state": {"key": "powerState", "type": "PowerState"}, + "availability_zones": {"key": "availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "enableNodePublicIP", "type": "bool"}, + "scale_set_priority": {"key": "scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "scaleSetEvictionPolicy", "type": "str"}, + "spot_max_price": {"key": "spotMaxPrice", "type": "float"}, + "tags": {"key": "tags", "type": "{str}"}, + "node_labels": {"key": "nodeLabels", "type": "{str}"}, + "node_taints": {"key": "nodeTaints", "type": "[str]"}, + "proximity_placement_group_id": {"key": "proximityPlacementGroupID", "type": "str"}, + "kubelet_config": {"key": "kubeletConfig", "type": "KubeletConfig"}, + "linux_os_config": {"key": "linuxOSConfig", "type": "LinuxOSConfig"}, } - def __init__( + def __init__( # pylint: disable=too-many-locals self, *, count: Optional[int] = None, @@ -2412,7 +2402,7 @@ def __init__( vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, @@ -2422,9 +2412,9 @@ def __init__( upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, - scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", - spot_max_price: Optional[float] = -1, + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", + spot_max_price: float = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, @@ -2475,7 +2465,7 @@ def __init__( "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :paramtype vm_size: str or ~azure.mgmt.containerservice.v2020_11_01.models.ContainerServiceVMSizeTypes :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every @@ -2485,7 +2475,7 @@ def __init__( :keyword os_disk_type: OS disk type to be used for machines in a given agent pool. Allowed values are 'Ephemeral' and 'Managed'. If unspecified, defaults to 'Ephemeral' when the VM supports ephemeral OS and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, - defaults to 'Managed'. May not be changed after creation. Known values are: "Managed", + defaults to 'Managed'. May not be changed after creation. Known values are: "Managed" and "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2020_11_01.models.OSDiskType :keyword vnet_subnet_id: VNet SubnetID specifies the VNet's subnet identifier for nodes and @@ -2496,7 +2486,7 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux" and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2020_11_01.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -2505,9 +2495,9 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword type: AgentPoolType represents types of an agent pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2020_11_01.models.AgentPoolType - :keyword mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", + :keyword mode: AgentPoolMode represents mode of an agent pool. Known values are: "System" and "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2020_11_01.models.AgentPoolMode :keyword orchestrator_version: Version of orchestrator specified when creating the managed @@ -2522,20 +2512,19 @@ def __init__( :keyword enable_node_public_ip: Enable public IP for nodes. :paramtype enable_node_public_ip: bool :keyword scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Known values are: "Spot", "Regular". Default value: "Regular". + priority. Default to regular. Known values are: "Spot" and "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_11_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction - policy for Spot virtual machine scale set. Default to Delete. Known values are: "Delete", - "Deallocate". Default value: "Delete". + policy for Spot virtual machine scale set. Default to Delete. Known values are: "Delete" and + "Deallocate". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_11_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: SpotMaxPrice to be used to specify the maximum price you are willing to pay in US Dollars. Possible values are any decimal value greater than zero or -1 which indicates default price to be up-to on-demand. :paramtype spot_max_price: float - :keyword tags: A set of tags. Agent pool tags to be persisted on the agent pool virtual machine - scale set. + :keyword tags: Agent pool tags to be persisted on the agent pool virtual machine scale set. :paramtype tags: dict[str, str] :keyword node_labels: Agent pool node labels to be persisted across all nodes in agent pool. :paramtype node_labels: dict[str, str] @@ -2549,7 +2538,7 @@ def __init__( :keyword linux_os_config: LinuxOSConfig specifies the OS configuration of linux agent nodes. :paramtype linux_os_config: ~azure.mgmt.containerservice.v2020_11_01.models.LinuxOSConfig """ - super(ManagedClusterAgentPoolProfileProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.vm_size = vm_size self.os_disk_size_gb = os_disk_size_gb @@ -2581,7 +2570,9 @@ def __init__( self.linux_os_config = linux_os_config -class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): +class ManagedClusterAgentPoolProfile( + ManagedClusterAgentPoolProfileProperties +): # pylint: disable=too-many-instance-attributes """Profile for the container service agent pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -2629,7 +2620,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :vartype vm_size: str or ~azure.mgmt.containerservice.v2020_11_01.models.ContainerServiceVMSizeTypes :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine @@ -2639,7 +2630,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar os_disk_type: OS disk type to be used for machines in a given agent pool. Allowed values are 'Ephemeral' and 'Managed'. If unspecified, defaults to 'Ephemeral' when the VM supports ephemeral OS and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults - to 'Managed'. May not be changed after creation. Known values are: "Managed", "Ephemeral". + to 'Managed'. May not be changed after creation. Known values are: "Managed" and "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2020_11_01.models.OSDiskType :ivar vnet_subnet_id: VNet SubnetID specifies the VNet's subnet identifier for nodes and maybe pods. @@ -2649,7 +2640,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Known values are: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux" and "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2020_11_01.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -2658,9 +2649,10 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar type: AgentPoolType represents types of an agent pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2020_11_01.models.AgentPoolType - :ivar mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", "User". + :ivar mode: AgentPoolMode represents mode of an agent pool. Known values are: "System" and + "User". :vartype mode: str or ~azure.mgmt.containerservice.v2020_11_01.models.AgentPoolMode :ivar orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -2681,20 +2673,19 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar enable_node_public_ip: Enable public IP for nodes. :vartype enable_node_public_ip: bool :ivar scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Known values are: "Spot", "Regular". Default value: "Regular". + priority. Default to regular. Known values are: "Spot" and "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_11_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy - for Spot virtual machine scale set. Default to Delete. Known values are: "Delete", - "Deallocate". Default value: "Delete". + for Spot virtual machine scale set. Default to Delete. Known values are: "Delete" and + "Deallocate". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_11_01.models.ScaleSetEvictionPolicy :ivar spot_max_price: SpotMaxPrice to be used to specify the maximum price you are willing to pay in US Dollars. Possible values are any decimal value greater than zero or -1 which indicates default price to be up-to on-demand. :vartype spot_max_price: float - :ivar tags: A set of tags. Agent pool tags to be persisted on the agent pool virtual machine - scale set. + :ivar tags: Agent pool tags to be persisted on the agent pool virtual machine scale set. :vartype tags: dict[str, str] :ivar node_labels: Agent pool node labels to be persisted across all nodes in agent pool. :vartype node_labels: dict[str, str] @@ -2707,53 +2698,53 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :vartype kubelet_config: ~azure.mgmt.containerservice.v2020_11_01.models.KubeletConfig :ivar linux_os_config: LinuxOSConfig specifies the OS configuration of linux agent nodes. :vartype linux_os_config: ~azure.mgmt.containerservice.v2020_11_01.models.LinuxOSConfig - :ivar name: Required. Unique name of the agent pool profile in the context of the subscription - and resource group. + :ivar name: Unique name of the agent pool profile in the context of the subscription and + resource group. Required. :vartype name: str """ _validation = { - 'os_disk_size_gb': {'maximum': 1023, 'minimum': 0}, - 'node_image_version': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'power_state': {'readonly': True}, - 'name': {'required': True, 'pattern': r'^[a-z][a-z0-9]{0,11}$'}, + "os_disk_size_gb": {"maximum": 1023, "minimum": 0}, + "node_image_version": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "power_state": {"readonly": True}, + "name": {"required": True, "pattern": r"^[a-z][a-z0-9]{0,11}$"}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'os_disk_type': {'key': 'osDiskType', 'type': 'str'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'pod_subnet_id': {'key': 'podSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'maxPods', 'type': 'int'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'max_count': {'key': 'maxCount', 'type': 'int'}, - 'min_count': {'key': 'minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'enableAutoScaling', 'type': 'bool'}, - 'type': {'key': 'type', 'type': 'str'}, - 'mode': {'key': 'mode', 'type': 'str'}, - 'orchestrator_version': {'key': 'orchestratorVersion', 'type': 'str'}, - 'node_image_version': {'key': 'nodeImageVersion', 'type': 'str'}, - 'upgrade_settings': {'key': 'upgradeSettings', 'type': 'AgentPoolUpgradeSettings'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'power_state': {'key': 'powerState', 'type': 'PowerState'}, - 'availability_zones': {'key': 'availabilityZones', 'type': '[str]'}, - 'enable_node_public_ip': {'key': 'enableNodePublicIP', 'type': 'bool'}, - 'scale_set_priority': {'key': 'scaleSetPriority', 'type': 'str'}, - 'scale_set_eviction_policy': {'key': 'scaleSetEvictionPolicy', 'type': 'str'}, - 'spot_max_price': {'key': 'spotMaxPrice', 'type': 'float'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'node_labels': {'key': 'nodeLabels', 'type': '{str}'}, - 'node_taints': {'key': 'nodeTaints', 'type': '[str]'}, - 'proximity_placement_group_id': {'key': 'proximityPlacementGroupID', 'type': 'str'}, - 'kubelet_config': {'key': 'kubeletConfig', 'type': 'KubeletConfig'}, - 'linux_os_config': {'key': 'linuxOSConfig', 'type': 'LinuxOSConfig'}, - 'name': {'key': 'name', 'type': 'str'}, + "count": {"key": "count", "type": "int"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "os_disk_type": {"key": "osDiskType", "type": "str"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "pod_subnet_id": {"key": "podSubnetID", "type": "str"}, + "max_pods": {"key": "maxPods", "type": "int"}, + "os_type": {"key": "osType", "type": "str"}, + "max_count": {"key": "maxCount", "type": "int"}, + "min_count": {"key": "minCount", "type": "int"}, + "enable_auto_scaling": {"key": "enableAutoScaling", "type": "bool"}, + "type": {"key": "type", "type": "str"}, + "mode": {"key": "mode", "type": "str"}, + "orchestrator_version": {"key": "orchestratorVersion", "type": "str"}, + "node_image_version": {"key": "nodeImageVersion", "type": "str"}, + "upgrade_settings": {"key": "upgradeSettings", "type": "AgentPoolUpgradeSettings"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "power_state": {"key": "powerState", "type": "PowerState"}, + "availability_zones": {"key": "availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "enableNodePublicIP", "type": "bool"}, + "scale_set_priority": {"key": "scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "scaleSetEvictionPolicy", "type": "str"}, + "spot_max_price": {"key": "spotMaxPrice", "type": "float"}, + "tags": {"key": "tags", "type": "{str}"}, + "node_labels": {"key": "nodeLabels", "type": "{str}"}, + "node_taints": {"key": "nodeTaints", "type": "[str]"}, + "proximity_placement_group_id": {"key": "proximityPlacementGroupID", "type": "str"}, + "kubelet_config": {"key": "kubeletConfig", "type": "KubeletConfig"}, + "linux_os_config": {"key": "linuxOSConfig", "type": "LinuxOSConfig"}, + "name": {"key": "name", "type": "str"}, } - def __init__( + def __init__( # pylint: disable=too-many-locals self, *, name: str, @@ -2764,7 +2755,7 @@ def __init__( vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, @@ -2774,9 +2765,9 @@ def __init__( upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, - scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", - spot_max_price: Optional[float] = -1, + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", + spot_max_price: float = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, @@ -2827,7 +2818,7 @@ def __init__( "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :paramtype vm_size: str or ~azure.mgmt.containerservice.v2020_11_01.models.ContainerServiceVMSizeTypes :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every @@ -2837,7 +2828,7 @@ def __init__( :keyword os_disk_type: OS disk type to be used for machines in a given agent pool. Allowed values are 'Ephemeral' and 'Managed'. If unspecified, defaults to 'Ephemeral' when the VM supports ephemeral OS and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, - defaults to 'Managed'. May not be changed after creation. Known values are: "Managed", + defaults to 'Managed'. May not be changed after creation. Known values are: "Managed" and "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2020_11_01.models.OSDiskType :keyword vnet_subnet_id: VNet SubnetID specifies the VNet's subnet identifier for nodes and @@ -2848,7 +2839,7 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux" and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2020_11_01.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -2857,9 +2848,9 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword type: AgentPoolType represents types of an agent pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2020_11_01.models.AgentPoolType - :keyword mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", + :keyword mode: AgentPoolMode represents mode of an agent pool. Known values are: "System" and "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2020_11_01.models.AgentPoolMode :keyword orchestrator_version: Version of orchestrator specified when creating the managed @@ -2874,20 +2865,19 @@ def __init__( :keyword enable_node_public_ip: Enable public IP for nodes. :paramtype enable_node_public_ip: bool :keyword scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Known values are: "Spot", "Regular". Default value: "Regular". + priority. Default to regular. Known values are: "Spot" and "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_11_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction - policy for Spot virtual machine scale set. Default to Delete. Known values are: "Delete", - "Deallocate". Default value: "Delete". + policy for Spot virtual machine scale set. Default to Delete. Known values are: "Delete" and + "Deallocate". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_11_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: SpotMaxPrice to be used to specify the maximum price you are willing to pay in US Dollars. Possible values are any decimal value greater than zero or -1 which indicates default price to be up-to on-demand. :paramtype spot_max_price: float - :keyword tags: A set of tags. Agent pool tags to be persisted on the agent pool virtual machine - scale set. + :keyword tags: Agent pool tags to be persisted on the agent pool virtual machine scale set. :paramtype tags: dict[str, str] :keyword node_labels: Agent pool node labels to be persisted across all nodes in agent pool. :paramtype node_labels: dict[str, str] @@ -2900,15 +2890,43 @@ def __init__( :paramtype kubelet_config: ~azure.mgmt.containerservice.v2020_11_01.models.KubeletConfig :keyword linux_os_config: LinuxOSConfig specifies the OS configuration of linux agent nodes. :paramtype linux_os_config: ~azure.mgmt.containerservice.v2020_11_01.models.LinuxOSConfig - :keyword name: Required. Unique name of the agent pool profile in the context of the - subscription and resource group. + :keyword name: Unique name of the agent pool profile in the context of the subscription and + resource group. Required. :paramtype name: str """ - super(ManagedClusterAgentPoolProfile, self).__init__(count=count, vm_size=vm_size, os_disk_size_gb=os_disk_size_gb, os_disk_type=os_disk_type, vnet_subnet_id=vnet_subnet_id, pod_subnet_id=pod_subnet_id, max_pods=max_pods, os_type=os_type, max_count=max_count, min_count=min_count, enable_auto_scaling=enable_auto_scaling, type=type, mode=mode, orchestrator_version=orchestrator_version, upgrade_settings=upgrade_settings, availability_zones=availability_zones, enable_node_public_ip=enable_node_public_ip, scale_set_priority=scale_set_priority, scale_set_eviction_policy=scale_set_eviction_policy, spot_max_price=spot_max_price, tags=tags, node_labels=node_labels, node_taints=node_taints, proximity_placement_group_id=proximity_placement_group_id, kubelet_config=kubelet_config, linux_os_config=linux_os_config, **kwargs) + super().__init__( + count=count, + vm_size=vm_size, + os_disk_size_gb=os_disk_size_gb, + os_disk_type=os_disk_type, + vnet_subnet_id=vnet_subnet_id, + pod_subnet_id=pod_subnet_id, + max_pods=max_pods, + os_type=os_type, + max_count=max_count, + min_count=min_count, + enable_auto_scaling=enable_auto_scaling, + type=type, + mode=mode, + orchestrator_version=orchestrator_version, + upgrade_settings=upgrade_settings, + availability_zones=availability_zones, + enable_node_public_ip=enable_node_public_ip, + scale_set_priority=scale_set_priority, + scale_set_eviction_policy=scale_set_eviction_policy, + spot_max_price=spot_max_price, + tags=tags, + node_labels=node_labels, + node_taints=node_taints, + proximity_placement_group_id=proximity_placement_group_id, + kubelet_config=kubelet_config, + linux_os_config=linux_os_config, + **kwargs + ) self.name = name -class ManagedClusterAPIServerAccessProfile(msrest.serialization.Model): +class ManagedClusterAPIServerAccessProfile(_serialization.Model): """Access profile for managed cluster API server. :ivar authorized_ip_ranges: Authorized IP Ranges to kubernetes API server. @@ -2920,9 +2938,9 @@ class ManagedClusterAPIServerAccessProfile(msrest.serialization.Model): """ _attribute_map = { - 'authorized_ip_ranges': {'key': 'authorizedIPRanges', 'type': '[str]'}, - 'enable_private_cluster': {'key': 'enablePrivateCluster', 'type': 'bool'}, - 'private_dns_zone': {'key': 'privateDNSZone', 'type': 'str'}, + "authorized_ip_ranges": {"key": "authorizedIPRanges", "type": "[str]"}, + "enable_private_cluster": {"key": "enablePrivateCluster", "type": "bool"}, + "private_dns_zone": {"key": "privateDNSZone", "type": "str"}, } def __init__( @@ -2941,41 +2959,36 @@ def __init__( :keyword private_dns_zone: Private dns zone mode for private cluster. :paramtype private_dns_zone: str """ - super(ManagedClusterAPIServerAccessProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.authorized_ip_ranges = authorized_ip_ranges self.enable_private_cluster = enable_private_cluster self.private_dns_zone = private_dns_zone -class ManagedClusterAutoUpgradeProfile(msrest.serialization.Model): +class ManagedClusterAutoUpgradeProfile(_serialization.Model): """Auto upgrade profile for a managed cluster. :ivar upgrade_channel: upgrade channel for auto upgrade. Known values are: "rapid", "stable", - "patch", "none". + "patch", and "none". :vartype upgrade_channel: str or ~azure.mgmt.containerservice.v2020_11_01.models.UpgradeChannel """ _attribute_map = { - 'upgrade_channel': {'key': 'upgradeChannel', 'type': 'str'}, + "upgrade_channel": {"key": "upgradeChannel", "type": "str"}, } - def __init__( - self, - *, - upgrade_channel: Optional[Union[str, "_models.UpgradeChannel"]] = None, - **kwargs - ): + def __init__(self, *, upgrade_channel: Optional[Union[str, "_models.UpgradeChannel"]] = None, **kwargs): """ :keyword upgrade_channel: upgrade channel for auto upgrade. Known values are: "rapid", - "stable", "patch", "none". + "stable", "patch", and "none". :paramtype upgrade_channel: str or ~azure.mgmt.containerservice.v2020_11_01.models.UpgradeChannel """ - super(ManagedClusterAutoUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.upgrade_channel = upgrade_channel -class ManagedClusterIdentity(msrest.serialization.Model): +class ManagedClusterIdentity(_serialization.Model): """Identity for the managed cluster. Variables are only populated by the server, and will be ignored when sending a request. @@ -2989,7 +3002,7 @@ class ManagedClusterIdentity(msrest.serialization.Model): :ivar type: The type of identity used for the managed cluster. Type 'SystemAssigned' will use an implicitly created identity in master components and an auto-created user assigned identity in MC_ resource group in agent nodes. Type 'None' will not use MSI for the managed cluster, - service principal will be used instead. Known values are: "SystemAssigned", "UserAssigned", + service principal will be used instead. Known values are: "SystemAssigned", "UserAssigned", and "None". :vartype type: str or ~azure.mgmt.containerservice.v2020_11_01.models.ResourceIdentityType :ivar user_assigned_identities: The user identity associated with the managed cluster. This @@ -3001,22 +3014,30 @@ class ManagedClusterIdentity(msrest.serialization.Model): """ _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, + "principal_id": {"readonly": True}, + "tenant_id": {"readonly": True}, } _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{Components1Umhcm8SchemasManagedclusteridentityPropertiesUserassignedidentitiesAdditionalproperties}'}, + "principal_id": {"key": "principalId", "type": "str"}, + "tenant_id": {"key": "tenantId", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "user_assigned_identities": { + "key": "userAssignedIdentities", + "type": "{Components1Umhcm8SchemasManagedclusteridentityPropertiesUserassignedidentitiesAdditionalproperties}", + }, } def __init__( self, *, type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, - user_assigned_identities: Optional[Dict[str, "_models.Components1Umhcm8SchemasManagedclusteridentityPropertiesUserassignedidentitiesAdditionalproperties"]] = None, + user_assigned_identities: Optional[ + Dict[ + str, + "_models.Components1Umhcm8SchemasManagedclusteridentityPropertiesUserassignedidentitiesAdditionalproperties", + ] + ] = None, **kwargs ): """ @@ -3024,7 +3045,7 @@ def __init__( use an implicitly created identity in master components and an auto-created user assigned identity in MC_ resource group in agent nodes. Type 'None' will not use MSI for the managed cluster, service principal will be used instead. Known values are: "SystemAssigned", - "UserAssigned", "None". + "UserAssigned", and "None". :paramtype type: str or ~azure.mgmt.containerservice.v2020_11_01.models.ResourceIdentityType :keyword user_assigned_identities: The user identity associated with the managed cluster. This identity will be used in control plane and only one user assigned identity is allowed. The user @@ -3033,14 +3054,14 @@ def __init__( :paramtype user_assigned_identities: dict[str, ~azure.mgmt.containerservice.v2020_11_01.models.Components1Umhcm8SchemasManagedclusteridentityPropertiesUserassignedidentitiesAdditionalproperties] """ - super(ManagedClusterIdentity, self).__init__(**kwargs) + super().__init__(**kwargs) self.principal_id = None self.tenant_id = None self.type = type self.user_assigned_identities = user_assigned_identities -class ManagedClusterListResult(msrest.serialization.Model): +class ManagedClusterListResult(_serialization.Model): """The response from the List Managed Clusters operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -3052,30 +3073,25 @@ class ManagedClusterListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[ManagedCluster]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[ManagedCluster]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.ManagedCluster"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.ManagedCluster"]] = None, **kwargs): """ :keyword value: The list of managed clusters. :paramtype value: list[~azure.mgmt.containerservice.v2020_11_01.models.ManagedCluster] """ - super(ManagedClusterListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class ManagedClusterLoadBalancerProfile(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfile(_serialization.Model): """Profile of the managed cluster load balancer. :ivar managed_outbound_i_ps: Desired managed outbound IPs for the cluster load balancer. @@ -3101,17 +3117,23 @@ class ManagedClusterLoadBalancerProfile(msrest.serialization.Model): """ _validation = { - 'allocated_outbound_ports': {'maximum': 64000, 'minimum': 0}, - 'idle_timeout_in_minutes': {'maximum': 120, 'minimum': 4}, + "allocated_outbound_ports": {"maximum": 64000, "minimum": 0}, + "idle_timeout_in_minutes": {"maximum": 120, "minimum": 4}, } _attribute_map = { - 'managed_outbound_i_ps': {'key': 'managedOutboundIPs', 'type': 'ManagedClusterLoadBalancerProfileManagedOutboundIPs'}, - 'outbound_ip_prefixes': {'key': 'outboundIPPrefixes', 'type': 'ManagedClusterLoadBalancerProfileOutboundIPPrefixes'}, - 'outbound_i_ps': {'key': 'outboundIPs', 'type': 'ManagedClusterLoadBalancerProfileOutboundIPs'}, - 'effective_outbound_i_ps': {'key': 'effectiveOutboundIPs', 'type': '[ResourceReference]'}, - 'allocated_outbound_ports': {'key': 'allocatedOutboundPorts', 'type': 'int'}, - 'idle_timeout_in_minutes': {'key': 'idleTimeoutInMinutes', 'type': 'int'}, + "managed_outbound_i_ps": { + "key": "managedOutboundIPs", + "type": "ManagedClusterLoadBalancerProfileManagedOutboundIPs", + }, + "outbound_ip_prefixes": { + "key": "outboundIPPrefixes", + "type": "ManagedClusterLoadBalancerProfileOutboundIPPrefixes", + }, + "outbound_i_ps": {"key": "outboundIPs", "type": "ManagedClusterLoadBalancerProfileOutboundIPs"}, + "effective_outbound_i_ps": {"key": "effectiveOutboundIPs", "type": "[ResourceReference]"}, + "allocated_outbound_ports": {"key": "allocatedOutboundPorts", "type": "int"}, + "idle_timeout_in_minutes": {"key": "idleTimeoutInMinutes", "type": "int"}, } def __init__( @@ -3121,8 +3143,8 @@ def __init__( outbound_ip_prefixes: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPPrefixes"] = None, outbound_i_ps: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPs"] = None, effective_outbound_i_ps: Optional[List["_models.ResourceReference"]] = None, - allocated_outbound_ports: Optional[int] = 0, - idle_timeout_in_minutes: Optional[int] = 30, + allocated_outbound_ports: int = 0, + idle_timeout_in_minutes: int = 30, **kwargs ): """ @@ -3148,7 +3170,7 @@ def __init__( must be in the range of 4 to 120 (inclusive). The default value is 30 minutes. :paramtype idle_timeout_in_minutes: int """ - super(ManagedClusterLoadBalancerProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.managed_outbound_i_ps = managed_outbound_i_ps self.outbound_ip_prefixes = outbound_ip_prefixes self.outbound_i_ps = outbound_i_ps @@ -3157,7 +3179,7 @@ def __init__( self.idle_timeout_in_minutes = idle_timeout_in_minutes -class ManagedClusterLoadBalancerProfileManagedOutboundIPs(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfileManagedOutboundIPs(_serialization.Model): """Desired managed outbound IPs for the cluster load balancer. :ivar count: Desired number of outbound IP created/managed by Azure for the cluster load @@ -3166,29 +3188,24 @@ class ManagedClusterLoadBalancerProfileManagedOutboundIPs(msrest.serialization.M """ _validation = { - 'count': {'maximum': 100, 'minimum': 1}, + "count": {"maximum": 100, "minimum": 1}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, + "count": {"key": "count", "type": "int"}, } - def __init__( - self, - *, - count: Optional[int] = 1, - **kwargs - ): + def __init__(self, *, count: int = 1, **kwargs): """ :keyword count: Desired number of outbound IP created/managed by Azure for the cluster load balancer. Allowed values must be in the range of 1 to 100 (inclusive). The default value is 1. :paramtype count: int """ - super(ManagedClusterLoadBalancerProfileManagedOutboundIPs, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count -class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(_serialization.Model): """Desired outbound IP Prefix resources for the cluster load balancer. :ivar public_ip_prefixes: A list of public IP prefix resources. @@ -3197,25 +3214,20 @@ class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(msrest.serialization.M """ _attribute_map = { - 'public_ip_prefixes': {'key': 'publicIPPrefixes', 'type': '[ResourceReference]'}, + "public_ip_prefixes": {"key": "publicIPPrefixes", "type": "[ResourceReference]"}, } - def __init__( - self, - *, - public_ip_prefixes: Optional[List["_models.ResourceReference"]] = None, - **kwargs - ): + def __init__(self, *, public_ip_prefixes: Optional[List["_models.ResourceReference"]] = None, **kwargs): """ :keyword public_ip_prefixes: A list of public IP prefix resources. :paramtype public_ip_prefixes: list[~azure.mgmt.containerservice.v2020_11_01.models.ResourceReference] """ - super(ManagedClusterLoadBalancerProfileOutboundIPPrefixes, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_ip_prefixes = public_ip_prefixes -class ManagedClusterLoadBalancerProfileOutboundIPs(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfileOutboundIPs(_serialization.Model): """Desired outbound IP resources for the cluster load balancer. :ivar public_i_ps: A list of public IP resources. @@ -3223,38 +3235,33 @@ class ManagedClusterLoadBalancerProfileOutboundIPs(msrest.serialization.Model): """ _attribute_map = { - 'public_i_ps': {'key': 'publicIPs', 'type': '[ResourceReference]'}, + "public_i_ps": {"key": "publicIPs", "type": "[ResourceReference]"}, } - def __init__( - self, - *, - public_i_ps: Optional[List["_models.ResourceReference"]] = None, - **kwargs - ): + def __init__(self, *, public_i_ps: Optional[List["_models.ResourceReference"]] = None, **kwargs): """ :keyword public_i_ps: A list of public IP resources. :paramtype public_i_ps: list[~azure.mgmt.containerservice.v2020_11_01.models.ResourceReference] """ - super(ManagedClusterLoadBalancerProfileOutboundIPs, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_i_ps = public_i_ps -class ManagedClusterPodIdentity(msrest.serialization.Model): +class ManagedClusterPodIdentity(_serialization.Model): """ManagedClusterPodIdentity. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar name: Required. Name of the pod identity. + :ivar name: Name of the pod identity. Required. :vartype name: str - :ivar namespace: Required. Namespace of the pod identity. + :ivar namespace: Namespace of the pod identity. Required. :vartype namespace: str - :ivar identity: Required. Information of the user assigned identity. + :ivar identity: Information of the user assigned identity. Required. :vartype identity: ~azure.mgmt.containerservice.v2020_11_01.models.UserAssignedIdentity :ivar provisioning_state: The current provisioning state of the pod identity. Known values are: - "Assigned", "Updating", "Deleting", "Failed". + "Assigned", "Updating", "Deleting", and "Failed". :vartype provisioning_state: str or ~azure.mgmt.containerservice.v2020_11_01.models.ManagedClusterPodIdentityProvisioningState :ivar provisioning_info: @@ -3263,38 +3270,31 @@ class ManagedClusterPodIdentity(msrest.serialization.Model): """ _validation = { - 'name': {'required': True}, - 'namespace': {'required': True}, - 'identity': {'required': True}, - 'provisioning_state': {'readonly': True}, - 'provisioning_info': {'readonly': True}, + "name": {"required": True}, + "namespace": {"required": True}, + "identity": {"required": True}, + "provisioning_state": {"readonly": True}, + "provisioning_info": {"readonly": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'namespace': {'key': 'namespace', 'type': 'str'}, - 'identity': {'key': 'identity', 'type': 'UserAssignedIdentity'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'provisioning_info': {'key': 'provisioningInfo', 'type': 'ManagedClusterPodIdentityProvisioningInfo'}, + "name": {"key": "name", "type": "str"}, + "namespace": {"key": "namespace", "type": "str"}, + "identity": {"key": "identity", "type": "UserAssignedIdentity"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "provisioning_info": {"key": "provisioningInfo", "type": "ManagedClusterPodIdentityProvisioningInfo"}, } - def __init__( - self, - *, - name: str, - namespace: str, - identity: "_models.UserAssignedIdentity", - **kwargs - ): + def __init__(self, *, name: str, namespace: str, identity: "_models.UserAssignedIdentity", **kwargs): """ - :keyword name: Required. Name of the pod identity. + :keyword name: Name of the pod identity. Required. :paramtype name: str - :keyword namespace: Required. Namespace of the pod identity. + :keyword namespace: Namespace of the pod identity. Required. :paramtype namespace: str - :keyword identity: Required. Information of the user assigned identity. + :keyword identity: Information of the user assigned identity. Required. :paramtype identity: ~azure.mgmt.containerservice.v2020_11_01.models.UserAssignedIdentity """ - super(ManagedClusterPodIdentity, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.namespace = namespace self.identity = identity @@ -3302,54 +3302,47 @@ def __init__( self.provisioning_info = None -class ManagedClusterPodIdentityException(msrest.serialization.Model): +class ManagedClusterPodIdentityException(_serialization.Model): """ManagedClusterPodIdentityException. All required parameters must be populated in order to send to Azure. - :ivar name: Required. Name of the pod identity exception. + :ivar name: Name of the pod identity exception. Required. :vartype name: str - :ivar namespace: Required. Namespace of the pod identity exception. + :ivar namespace: Namespace of the pod identity exception. Required. :vartype namespace: str - :ivar pod_labels: Required. Pod labels to match. + :ivar pod_labels: Pod labels to match. Required. :vartype pod_labels: dict[str, str] """ _validation = { - 'name': {'required': True}, - 'namespace': {'required': True}, - 'pod_labels': {'required': True}, + "name": {"required": True}, + "namespace": {"required": True}, + "pod_labels": {"required": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'namespace': {'key': 'namespace', 'type': 'str'}, - 'pod_labels': {'key': 'podLabels', 'type': '{str}'}, + "name": {"key": "name", "type": "str"}, + "namespace": {"key": "namespace", "type": "str"}, + "pod_labels": {"key": "podLabels", "type": "{str}"}, } - def __init__( - self, - *, - name: str, - namespace: str, - pod_labels: Dict[str, str], - **kwargs - ): + def __init__(self, *, name: str, namespace: str, pod_labels: Dict[str, str], **kwargs): """ - :keyword name: Required. Name of the pod identity exception. + :keyword name: Name of the pod identity exception. Required. :paramtype name: str - :keyword namespace: Required. Namespace of the pod identity exception. + :keyword namespace: Namespace of the pod identity exception. Required. :paramtype namespace: str - :keyword pod_labels: Required. Pod labels to match. + :keyword pod_labels: Pod labels to match. Required. :paramtype pod_labels: dict[str, str] """ - super(ManagedClusterPodIdentityException, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.namespace = namespace self.pod_labels = pod_labels -class ManagedClusterPodIdentityProfile(msrest.serialization.Model): +class ManagedClusterPodIdentityProfile(_serialization.Model): """ManagedClusterPodIdentityProfile. :ivar enabled: Whether the pod identity addon is enabled. @@ -3363,9 +3356,12 @@ class ManagedClusterPodIdentityProfile(msrest.serialization.Model): """ _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '[ManagedClusterPodIdentity]'}, - 'user_assigned_identity_exceptions': {'key': 'userAssignedIdentityExceptions', 'type': '[ManagedClusterPodIdentityException]'}, + "enabled": {"key": "enabled", "type": "bool"}, + "user_assigned_identities": {"key": "userAssignedIdentities", "type": "[ManagedClusterPodIdentity]"}, + "user_assigned_identity_exceptions": { + "key": "userAssignedIdentityExceptions", + "type": "[ManagedClusterPodIdentityException]", + }, } def __init__( @@ -3386,13 +3382,13 @@ def __init__( :paramtype user_assigned_identity_exceptions: list[~azure.mgmt.containerservice.v2020_11_01.models.ManagedClusterPodIdentityException] """ - super(ManagedClusterPodIdentityProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.user_assigned_identities = user_assigned_identities self.user_assigned_identity_exceptions = user_assigned_identity_exceptions -class ManagedClusterPodIdentityProvisioningInfo(msrest.serialization.Model): +class ManagedClusterPodIdentityProvisioningInfo(_serialization.Model): """ManagedClusterPodIdentityProvisioningInfo. :ivar error: Pod identity assignment error (if any). @@ -3400,34 +3396,29 @@ class ManagedClusterPodIdentityProvisioningInfo(msrest.serialization.Model): """ _attribute_map = { - 'error': {'key': 'error', 'type': 'CloudError'}, + "error": {"key": "error", "type": "CloudError"}, } - def __init__( - self, - *, - error: Optional["_models.CloudError"] = None, - **kwargs - ): + def __init__(self, *, error: Optional["_models.CloudError"] = None, **kwargs): """ :keyword error: Pod identity assignment error (if any). :paramtype error: ~azure.mgmt.containerservice.v2020_11_01.models.CloudError """ - super(ManagedClusterPodIdentityProvisioningInfo, self).__init__(**kwargs) + super().__init__(**kwargs) self.error = error -class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): +class ManagedClusterPoolUpgradeProfile(_serialization.Model): """The list of available upgrade versions. All required parameters must be populated in order to send to Azure. - :ivar kubernetes_version: Required. Kubernetes version (major, minor, patch). + :ivar kubernetes_version: Kubernetes version (major, minor, patch). Required. :vartype kubernetes_version: str :ivar name: Pool name. :vartype name: str - :ivar os_type: Required. OsType to be used to specify os type. Choose from Linux and Windows. - Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to + Linux. Known values are: "Linux" and "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2020_11_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -3435,15 +3426,15 @@ class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): """ _validation = { - 'kubernetes_version': {'required': True}, - 'os_type': {'required': True}, + "kubernetes_version": {"required": True}, + "os_type": {"required": True}, } _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'upgrades': {'key': 'upgrades', 'type': '[ManagedClusterPoolUpgradeProfileUpgradesItem]'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "os_type": {"key": "osType", "type": "str"}, + "upgrades": {"key": "upgrades", "type": "[ManagedClusterPoolUpgradeProfileUpgradesItem]"}, } def __init__( @@ -3456,25 +3447,25 @@ def __init__( **kwargs ): """ - :keyword kubernetes_version: Required. Kubernetes version (major, minor, patch). + :keyword kubernetes_version: Kubernetes version (major, minor, patch). Required. :paramtype kubernetes_version: str :keyword name: Pool name. :paramtype name: str - :keyword os_type: Required. OsType to be used to specify os type. Choose from Linux and - Windows. Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default + to Linux. Known values are: "Linux" and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2020_11_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: list[~azure.mgmt.containerservice.v2020_11_01.models.ManagedClusterPoolUpgradeProfileUpgradesItem] """ - super(ManagedClusterPoolUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.name = name self.os_type = os_type self.upgrades = upgrades -class ManagedClusterPoolUpgradeProfileUpgradesItem(msrest.serialization.Model): +class ManagedClusterPoolUpgradeProfileUpgradesItem(_serialization.Model): """ManagedClusterPoolUpgradeProfileUpgradesItem. :ivar kubernetes_version: Kubernetes version (major, minor, patch). @@ -3484,34 +3475,28 @@ class ManagedClusterPoolUpgradeProfileUpgradesItem(msrest.serialization.Model): """ _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } - def __init__( - self, - *, - kubernetes_version: Optional[str] = None, - is_preview: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, kubernetes_version: Optional[str] = None, is_preview: Optional[bool] = None, **kwargs): """ :keyword kubernetes_version: Kubernetes version (major, minor, patch). :paramtype kubernetes_version: str :keyword is_preview: Whether Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(ManagedClusterPoolUpgradeProfileUpgradesItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.is_preview = is_preview -class ManagedClusterPropertiesAutoScalerProfile(msrest.serialization.Model): +class ManagedClusterPropertiesAutoScalerProfile(_serialization.Model): # pylint: disable=too-many-instance-attributes """Parameters to be applied to the cluster-autoscaler when enabled. :ivar balance_similar_node_groups: :vartype balance_similar_node_groups: str - :ivar expander: Known values are: "least-waste", "most-pods", "random". + :ivar expander: Known values are: "least-waste", "most-pods", and "random". :vartype expander: str or ~azure.mgmt.containerservice.v2020_11_01.models.Expander :ivar max_empty_bulk_delete: :vartype max_empty_bulk_delete: str @@ -3544,22 +3529,22 @@ class ManagedClusterPropertiesAutoScalerProfile(msrest.serialization.Model): """ _attribute_map = { - 'balance_similar_node_groups': {'key': 'balance-similar-node-groups', 'type': 'str'}, - 'expander': {'key': 'expander', 'type': 'str'}, - 'max_empty_bulk_delete': {'key': 'max-empty-bulk-delete', 'type': 'str'}, - 'max_graceful_termination_sec': {'key': 'max-graceful-termination-sec', 'type': 'str'}, - 'max_total_unready_percentage': {'key': 'max-total-unready-percentage', 'type': 'str'}, - 'new_pod_scale_up_delay': {'key': 'new-pod-scale-up-delay', 'type': 'str'}, - 'ok_total_unready_count': {'key': 'ok-total-unready-count', 'type': 'str'}, - 'scan_interval': {'key': 'scan-interval', 'type': 'str'}, - 'scale_down_delay_after_add': {'key': 'scale-down-delay-after-add', 'type': 'str'}, - 'scale_down_delay_after_delete': {'key': 'scale-down-delay-after-delete', 'type': 'str'}, - 'scale_down_delay_after_failure': {'key': 'scale-down-delay-after-failure', 'type': 'str'}, - 'scale_down_unneeded_time': {'key': 'scale-down-unneeded-time', 'type': 'str'}, - 'scale_down_unready_time': {'key': 'scale-down-unready-time', 'type': 'str'}, - 'scale_down_utilization_threshold': {'key': 'scale-down-utilization-threshold', 'type': 'str'}, - 'skip_nodes_with_local_storage': {'key': 'skip-nodes-with-local-storage', 'type': 'str'}, - 'skip_nodes_with_system_pods': {'key': 'skip-nodes-with-system-pods', 'type': 'str'}, + "balance_similar_node_groups": {"key": "balance-similar-node-groups", "type": "str"}, + "expander": {"key": "expander", "type": "str"}, + "max_empty_bulk_delete": {"key": "max-empty-bulk-delete", "type": "str"}, + "max_graceful_termination_sec": {"key": "max-graceful-termination-sec", "type": "str"}, + "max_total_unready_percentage": {"key": "max-total-unready-percentage", "type": "str"}, + "new_pod_scale_up_delay": {"key": "new-pod-scale-up-delay", "type": "str"}, + "ok_total_unready_count": {"key": "ok-total-unready-count", "type": "str"}, + "scan_interval": {"key": "scan-interval", "type": "str"}, + "scale_down_delay_after_add": {"key": "scale-down-delay-after-add", "type": "str"}, + "scale_down_delay_after_delete": {"key": "scale-down-delay-after-delete", "type": "str"}, + "scale_down_delay_after_failure": {"key": "scale-down-delay-after-failure", "type": "str"}, + "scale_down_unneeded_time": {"key": "scale-down-unneeded-time", "type": "str"}, + "scale_down_unready_time": {"key": "scale-down-unready-time", "type": "str"}, + "scale_down_utilization_threshold": {"key": "scale-down-utilization-threshold", "type": "str"}, + "skip_nodes_with_local_storage": {"key": "skip-nodes-with-local-storage", "type": "str"}, + "skip_nodes_with_system_pods": {"key": "skip-nodes-with-system-pods", "type": "str"}, } def __init__( @@ -3586,7 +3571,7 @@ def __init__( """ :keyword balance_similar_node_groups: :paramtype balance_similar_node_groups: str - :keyword expander: Known values are: "least-waste", "most-pods", "random". + :keyword expander: Known values are: "least-waste", "most-pods", and "random". :paramtype expander: str or ~azure.mgmt.containerservice.v2020_11_01.models.Expander :keyword max_empty_bulk_delete: :paramtype max_empty_bulk_delete: str @@ -3617,7 +3602,7 @@ def __init__( :keyword skip_nodes_with_system_pods: :paramtype skip_nodes_with_system_pods: str """ - super(ManagedClusterPropertiesAutoScalerProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.balance_similar_node_groups = balance_similar_node_groups self.expander = expander self.max_empty_bulk_delete = max_empty_bulk_delete @@ -3636,56 +3621,50 @@ def __init__( self.skip_nodes_with_system_pods = skip_nodes_with_system_pods -class ManagedClusterServicePrincipalProfile(msrest.serialization.Model): +class ManagedClusterServicePrincipalProfile(_serialization.Model): """Information about a service principal identity for the cluster to use for manipulating Azure APIs. All required parameters must be populated in order to send to Azure. - :ivar client_id: Required. The ID for the service principal. + :ivar client_id: The ID for the service principal. Required. :vartype client_id: str :ivar secret: The secret password associated with the service principal in plain text. :vartype secret: str """ _validation = { - 'client_id': {'required': True}, + "client_id": {"required": True}, } _attribute_map = { - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'secret': {'key': 'secret', 'type': 'str'}, + "client_id": {"key": "clientId", "type": "str"}, + "secret": {"key": "secret", "type": "str"}, } - def __init__( - self, - *, - client_id: str, - secret: Optional[str] = None, - **kwargs - ): + def __init__(self, *, client_id: str, secret: Optional[str] = None, **kwargs): """ - :keyword client_id: Required. The ID for the service principal. + :keyword client_id: The ID for the service principal. Required. :paramtype client_id: str :keyword secret: The secret password associated with the service principal in plain text. :paramtype secret: str """ - super(ManagedClusterServicePrincipalProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.client_id = client_id self.secret = secret -class ManagedClusterSKU(msrest.serialization.Model): +class ManagedClusterSKU(_serialization.Model): """ManagedClusterSKU. - :ivar name: Name of a managed cluster SKU. Known values are: "Basic". + :ivar name: Name of a managed cluster SKU. "Basic" :vartype name: str or ~azure.mgmt.containerservice.v2020_11_01.models.ManagedClusterSKUName - :ivar tier: Tier of a managed cluster SKU. Known values are: "Paid", "Free". + :ivar tier: Tier of a managed cluster SKU. Known values are: "Paid" and "Free". :vartype tier: str or ~azure.mgmt.containerservice.v2020_11_01.models.ManagedClusterSKUTier """ _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, + "name": {"key": "name", "type": "str"}, + "tier": {"key": "tier", "type": "str"}, } def __init__( @@ -3696,17 +3675,17 @@ def __init__( **kwargs ): """ - :keyword name: Name of a managed cluster SKU. Known values are: "Basic". + :keyword name: Name of a managed cluster SKU. "Basic" :paramtype name: str or ~azure.mgmt.containerservice.v2020_11_01.models.ManagedClusterSKUName - :keyword tier: Tier of a managed cluster SKU. Known values are: "Paid", "Free". + :keyword tier: Tier of a managed cluster SKU. Known values are: "Paid" and "Free". :paramtype tier: str or ~azure.mgmt.containerservice.v2020_11_01.models.ManagedClusterSKUTier """ - super(ManagedClusterSKU, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.tier = tier -class ManagedClusterUpgradeProfile(msrest.serialization.Model): +class ManagedClusterUpgradeProfile(_serialization.Model): """The list of available upgrades for compute pools. Variables are only populated by the server, and will be ignored when sending a request. @@ -3719,29 +3698,29 @@ class ManagedClusterUpgradeProfile(msrest.serialization.Model): :vartype name: str :ivar type: Type of upgrade profile. :vartype type: str - :ivar control_plane_profile: Required. The list of available upgrade versions for the control - plane. + :ivar control_plane_profile: The list of available upgrade versions for the control plane. + Required. :vartype control_plane_profile: ~azure.mgmt.containerservice.v2020_11_01.models.ManagedClusterPoolUpgradeProfile - :ivar agent_pool_profiles: Required. The list of available upgrade versions for agent pools. + :ivar agent_pool_profiles: The list of available upgrade versions for agent pools. Required. :vartype agent_pool_profiles: list[~azure.mgmt.containerservice.v2020_11_01.models.ManagedClusterPoolUpgradeProfile] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'control_plane_profile': {'required': True}, - 'agent_pool_profiles': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "control_plane_profile": {"required": True}, + "agent_pool_profiles": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'control_plane_profile': {'key': 'properties.controlPlaneProfile', 'type': 'ManagedClusterPoolUpgradeProfile'}, - 'agent_pool_profiles': {'key': 'properties.agentPoolProfiles', 'type': '[ManagedClusterPoolUpgradeProfile]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "control_plane_profile": {"key": "properties.controlPlaneProfile", "type": "ManagedClusterPoolUpgradeProfile"}, + "agent_pool_profiles": {"key": "properties.agentPoolProfiles", "type": "[ManagedClusterPoolUpgradeProfile]"}, } def __init__( @@ -3752,15 +3731,15 @@ def __init__( **kwargs ): """ - :keyword control_plane_profile: Required. The list of available upgrade versions for the - control plane. + :keyword control_plane_profile: The list of available upgrade versions for the control plane. + Required. :paramtype control_plane_profile: ~azure.mgmt.containerservice.v2020_11_01.models.ManagedClusterPoolUpgradeProfile - :keyword agent_pool_profiles: Required. The list of available upgrade versions for agent pools. + :keyword agent_pool_profiles: The list of available upgrade versions for agent pools. Required. :paramtype agent_pool_profiles: list[~azure.mgmt.containerservice.v2020_11_01.models.ManagedClusterPoolUpgradeProfile] """ - super(ManagedClusterUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -3768,18 +3747,18 @@ def __init__( self.agent_pool_profiles = agent_pool_profiles -class ManagedClusterWindowsProfile(msrest.serialization.Model): +class ManagedClusterWindowsProfile(_serialization.Model): """Profile for Windows VMs in the container service cluster. All required parameters must be populated in order to send to Azure. - :ivar admin_username: Required. Specifies the name of the administrator account. - :code:`
`:code:`
` **restriction:** Cannot end in "." :code:`
`:code:`
` - **Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", "test1", - "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", - "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", - "sys", "test2", "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 - character :code:`
`:code:`
` **Max-length:** 20 characters. + :ivar admin_username: Specifies the name of the administrator account. :code:`
`:code:`
` + **restriction:** Cannot end in "." :code:`
`:code:`
` **Disallowed values:** + "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", + "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", + "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", + "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 character + :code:`
`:code:`
` **Max-length:** 20 characters. Required. :vartype admin_username: str :ivar admin_password: Specifies the password of the administrator account. :code:`
`:code:`
` **Minimum-length:** 8 characters :code:`
`:code:`
` @@ -3790,18 +3769,18 @@ class ManagedClusterWindowsProfile(msrest.serialization.Model): "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!". :vartype admin_password: str :ivar license_type: The licenseType to use for Windows VMs. Windows_Server is used to enable - Azure Hybrid User Benefits for Windows VMs. Known values are: "None", "Windows_Server". + Azure Hybrid User Benefits for Windows VMs. Known values are: "None" and "Windows_Server". :vartype license_type: str or ~azure.mgmt.containerservice.v2020_11_01.models.LicenseType """ _validation = { - 'admin_username': {'required': True}, + "admin_username": {"required": True}, } _attribute_map = { - 'admin_username': {'key': 'adminUsername', 'type': 'str'}, - 'admin_password': {'key': 'adminPassword', 'type': 'str'}, - 'license_type': {'key': 'licenseType', 'type': 'str'}, + "admin_username": {"key": "adminUsername", "type": "str"}, + "admin_password": {"key": "adminPassword", "type": "str"}, + "license_type": {"key": "licenseType", "type": "str"}, } def __init__( @@ -3813,13 +3792,13 @@ def __init__( **kwargs ): """ - :keyword admin_username: Required. Specifies the name of the administrator account. + :keyword admin_username: Specifies the name of the administrator account. :code:`
`:code:`
` **restriction:** Cannot end in "." :code:`
`:code:`
` **Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 - character :code:`
`:code:`
` **Max-length:** 20 characters. + character :code:`
`:code:`
` **Max-length:** 20 characters. Required. :paramtype admin_username: str :keyword admin_password: Specifies the password of the administrator account. :code:`
`:code:`
` **Minimum-length:** 8 characters :code:`
`:code:`
` @@ -3830,16 +3809,16 @@ def __init__( "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!". :paramtype admin_password: str :keyword license_type: The licenseType to use for Windows VMs. Windows_Server is used to enable - Azure Hybrid User Benefits for Windows VMs. Known values are: "None", "Windows_Server". + Azure Hybrid User Benefits for Windows VMs. Known values are: "None" and "Windows_Server". :paramtype license_type: str or ~azure.mgmt.containerservice.v2020_11_01.models.LicenseType """ - super(ManagedClusterWindowsProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.admin_username = admin_username self.admin_password = admin_password self.license_type = license_type -class OperationListResult(msrest.serialization.Model): +class OperationListResult(_serialization.Model): """The List Compute Operation operation response. Variables are only populated by the server, and will be ignored when sending a request. @@ -3849,24 +3828,20 @@ class OperationListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[OperationValue]'}, + "value": {"key": "value", "type": "[OperationValue]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(OperationListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None -class OperationValue(msrest.serialization.Model): +class OperationValue(_serialization.Model): """Describes the properties of a Compute Operation value. Variables are only populated by the server, and will be ignored when sending a request. @@ -3886,30 +3861,26 @@ class OperationValue(msrest.serialization.Model): """ _validation = { - 'origin': {'readonly': True}, - 'name': {'readonly': True}, - 'operation': {'readonly': True}, - 'resource': {'readonly': True}, - 'description': {'readonly': True}, - 'provider': {'readonly': True}, + "origin": {"readonly": True}, + "name": {"readonly": True}, + "operation": {"readonly": True}, + "resource": {"readonly": True}, + "description": {"readonly": True}, + "provider": {"readonly": True}, } _attribute_map = { - 'origin': {'key': 'origin', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'operation': {'key': 'display.operation', 'type': 'str'}, - 'resource': {'key': 'display.resource', 'type': 'str'}, - 'description': {'key': 'display.description', 'type': 'str'}, - 'provider': {'key': 'display.provider', 'type': 'str'}, + "origin": {"key": "origin", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "operation": {"key": "display.operation", "type": "str"}, + "resource": {"key": "display.resource", "type": "str"}, + "description": {"key": "display.description", "type": "str"}, + "provider": {"key": "display.provider", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(OperationValue, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.origin = None self.name = None self.operation = None @@ -3918,34 +3889,29 @@ def __init__( self.provider = None -class PowerState(msrest.serialization.Model): +class PowerState(_serialization.Model): """Describes the Power State of the cluster. - :ivar code: Tells whether the cluster is Running or Stopped. Known values are: "Running", + :ivar code: Tells whether the cluster is Running or Stopped. Known values are: "Running" and "Stopped". :vartype code: str or ~azure.mgmt.containerservice.v2020_11_01.models.Code """ _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, + "code": {"key": "code", "type": "str"}, } - def __init__( - self, - *, - code: Optional[Union[str, "_models.Code"]] = None, - **kwargs - ): + def __init__(self, *, code: Optional[Union[str, "_models.Code"]] = None, **kwargs): """ - :keyword code: Tells whether the cluster is Running or Stopped. Known values are: "Running", + :keyword code: Tells whether the cluster is Running or Stopped. Known values are: "Running" and "Stopped". :paramtype code: str or ~azure.mgmt.containerservice.v2020_11_01.models.Code """ - super(PowerState, self).__init__(**kwargs) + super().__init__(**kwargs) self.code = code -class PrivateEndpoint(msrest.serialization.Model): +class PrivateEndpoint(_serialization.Model): """Private endpoint which a connection belongs to. :ivar id: The resource Id for private endpoint. @@ -3953,24 +3919,19 @@ class PrivateEndpoint(msrest.serialization.Model): """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, } - def __init__( - self, - *, - id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin """ :keyword id: The resource Id for private endpoint. :paramtype id: str """ - super(PrivateEndpoint, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id -class PrivateEndpointConnection(msrest.serialization.Model): +class PrivateEndpointConnection(_serialization.Model): """A private endpoint connection. Variables are only populated by the server, and will be ignored when sending a request. @@ -3982,7 +3943,7 @@ class PrivateEndpointConnection(msrest.serialization.Model): :ivar type: The resource type. :vartype type: str :ivar provisioning_state: The current provisioning state. Known values are: "Succeeded", - "Creating", "Deleting", "Failed". + "Creating", "Deleting", and "Failed". :vartype provisioning_state: str or ~azure.mgmt.containerservice.v2020_11_01.models.PrivateEndpointConnectionProvisioningState :ivar private_endpoint: The resource of private endpoint. @@ -3994,19 +3955,22 @@ class PrivateEndpointConnection(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'provisioning_state': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, - 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "private_endpoint": {"key": "properties.privateEndpoint", "type": "PrivateEndpoint"}, + "private_link_service_connection_state": { + "key": "properties.privateLinkServiceConnectionState", + "type": "PrivateLinkServiceConnectionState", + }, } def __init__( @@ -4024,7 +3988,7 @@ def __init__( :paramtype private_link_service_connection_state: ~azure.mgmt.containerservice.v2020_11_01.models.PrivateLinkServiceConnectionState """ - super(PrivateEndpointConnection, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -4033,7 +3997,7 @@ def __init__( self.private_link_service_connection_state = private_link_service_connection_state -class PrivateEndpointConnectionListResult(msrest.serialization.Model): +class PrivateEndpointConnectionListResult(_serialization.Model): """A list of private endpoint connections. :ivar value: The collection value. @@ -4041,25 +4005,20 @@ class PrivateEndpointConnectionListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, + "value": {"key": "value", "type": "[PrivateEndpointConnection]"}, } - def __init__( - self, - *, - value: Optional[List["_models.PrivateEndpointConnection"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.PrivateEndpointConnection"]] = None, **kwargs): """ :keyword value: The collection value. :paramtype value: list[~azure.mgmt.containerservice.v2020_11_01.models.PrivateEndpointConnection] """ - super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value -class PrivateLinkResource(msrest.serialization.Model): +class PrivateLinkResource(_serialization.Model): """A private link resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -4080,22 +4039,22 @@ class PrivateLinkResource(msrest.serialization.Model): """ _validation = { - 'private_link_service_id': {'readonly': True}, + "private_link_service_id": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'group_id': {'key': 'groupId', 'type': 'str'}, - 'required_members': {'key': 'requiredMembers', 'type': '[str]'}, - 'private_link_service_id': {'key': 'privateLinkServiceID', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "group_id": {"key": "groupId", "type": "str"}, + "required_members": {"key": "requiredMembers", "type": "[str]"}, + "private_link_service_id": {"key": "privateLinkServiceID", "type": "str"}, } def __init__( self, *, - id: Optional[str] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin name: Optional[str] = None, type: Optional[str] = None, group_id: Optional[str] = None, @@ -4114,7 +4073,7 @@ def __init__( :keyword required_members: RequiredMembers of the resource. :paramtype required_members: list[str] """ - super(PrivateLinkResource, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id self.name = name self.type = type @@ -4123,7 +4082,7 @@ def __init__( self.private_link_service_id = None -class PrivateLinkResourcesListResult(msrest.serialization.Model): +class PrivateLinkResourcesListResult(_serialization.Model): """A list of private link resources. :ivar value: The collection value. @@ -4131,36 +4090,31 @@ class PrivateLinkResourcesListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, + "value": {"key": "value", "type": "[PrivateLinkResource]"}, } - def __init__( - self, - *, - value: Optional[List["_models.PrivateLinkResource"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.PrivateLinkResource"]] = None, **kwargs): """ :keyword value: The collection value. :paramtype value: list[~azure.mgmt.containerservice.v2020_11_01.models.PrivateLinkResource] """ - super(PrivateLinkResourcesListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value -class PrivateLinkServiceConnectionState(msrest.serialization.Model): +class PrivateLinkServiceConnectionState(_serialization.Model): """The state of a private link service connection. :ivar status: The private link service connection status. Known values are: "Pending", - "Approved", "Rejected", "Disconnected". + "Approved", "Rejected", and "Disconnected". :vartype status: str or ~azure.mgmt.containerservice.v2020_11_01.models.ConnectionStatus :ivar description: The private link service connection description. :vartype description: str """ _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, + "status": {"key": "status", "type": "str"}, + "description": {"key": "description", "type": "str"}, } def __init__( @@ -4172,17 +4126,17 @@ def __init__( ): """ :keyword status: The private link service connection status. Known values are: "Pending", - "Approved", "Rejected", "Disconnected". + "Approved", "Rejected", and "Disconnected". :paramtype status: str or ~azure.mgmt.containerservice.v2020_11_01.models.ConnectionStatus :keyword description: The private link service connection description. :paramtype description: str """ - super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) + super().__init__(**kwargs) self.status = status self.description = description -class ResourceReference(msrest.serialization.Model): +class ResourceReference(_serialization.Model): """A reference to an Azure resource. :ivar id: The fully qualified Azure resource id. @@ -4190,24 +4144,19 @@ class ResourceReference(msrest.serialization.Model): """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, } - def __init__( - self, - *, - id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin """ :keyword id: The fully qualified Azure resource id. :paramtype id: str """ - super(ResourceReference, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id -class SysctlConfig(msrest.serialization.Model): +class SysctlConfig(_serialization.Model): # pylint: disable=too-many-instance-attributes """Sysctl settings for Linux agent nodes. :ivar net_core_somaxconn: Sysctl setting net.core.somaxconn. @@ -4269,37 +4218,37 @@ class SysctlConfig(msrest.serialization.Model): """ _attribute_map = { - 'net_core_somaxconn': {'key': 'netCoreSomaxconn', 'type': 'int'}, - 'net_core_netdev_max_backlog': {'key': 'netCoreNetdevMaxBacklog', 'type': 'int'}, - 'net_core_rmem_max': {'key': 'netCoreRmemMax', 'type': 'int'}, - 'net_core_wmem_max': {'key': 'netCoreWmemMax', 'type': 'int'}, - 'net_core_optmem_max': {'key': 'netCoreOptmemMax', 'type': 'int'}, - 'net_ipv4_tcp_max_syn_backlog': {'key': 'netIpv4TcpMaxSynBacklog', 'type': 'int'}, - 'net_ipv4_tcp_max_tw_buckets': {'key': 'netIpv4TcpMaxTwBuckets', 'type': 'int'}, - 'net_ipv4_tcp_fin_timeout': {'key': 'netIpv4TcpFinTimeout', 'type': 'int'}, - 'net_ipv4_tcp_keepalive_time': {'key': 'netIpv4TcpKeepaliveTime', 'type': 'int'}, - 'net_ipv4_tcp_keepalive_probes': {'key': 'netIpv4TcpKeepaliveProbes', 'type': 'int'}, - 'net_ipv4_tcpkeepalive_intvl': {'key': 'netIpv4TcpkeepaliveIntvl', 'type': 'int'}, - 'net_ipv4_tcp_rmem': {'key': 'netIpv4TcpRmem', 'type': 'int'}, - 'net_ipv4_tcp_wmem': {'key': 'netIpv4TcpWmem', 'type': 'int'}, - 'net_ipv4_tcp_tw_reuse': {'key': 'netIpv4TcpTwReuse', 'type': 'bool'}, - 'net_ipv4_ip_local_port_range': {'key': 'netIpv4IpLocalPortRange', 'type': 'str'}, - 'net_ipv4_neigh_default_gc_thresh1': {'key': 'netIpv4NeighDefaultGcThresh1', 'type': 'int'}, - 'net_ipv4_neigh_default_gc_thresh2': {'key': 'netIpv4NeighDefaultGcThresh2', 'type': 'int'}, - 'net_ipv4_neigh_default_gc_thresh3': {'key': 'netIpv4NeighDefaultGcThresh3', 'type': 'int'}, - 'net_netfilter_nf_conntrack_max': {'key': 'netNetfilterNfConntrackMax', 'type': 'int'}, - 'net_netfilter_nf_conntrack_buckets': {'key': 'netNetfilterNfConntrackBuckets', 'type': 'int'}, - 'fs_inotify_max_user_watches': {'key': 'fsInotifyMaxUserWatches', 'type': 'int'}, - 'fs_file_max': {'key': 'fsFileMax', 'type': 'int'}, - 'fs_aio_max_nr': {'key': 'fsAioMaxNr', 'type': 'int'}, - 'fs_nr_open': {'key': 'fsNrOpen', 'type': 'int'}, - 'kernel_threads_max': {'key': 'kernelThreadsMax', 'type': 'int'}, - 'vm_max_map_count': {'key': 'vmMaxMapCount', 'type': 'int'}, - 'vm_swappiness': {'key': 'vmSwappiness', 'type': 'int'}, - 'vm_vfs_cache_pressure': {'key': 'vmVfsCachePressure', 'type': 'int'}, + "net_core_somaxconn": {"key": "netCoreSomaxconn", "type": "int"}, + "net_core_netdev_max_backlog": {"key": "netCoreNetdevMaxBacklog", "type": "int"}, + "net_core_rmem_max": {"key": "netCoreRmemMax", "type": "int"}, + "net_core_wmem_max": {"key": "netCoreWmemMax", "type": "int"}, + "net_core_optmem_max": {"key": "netCoreOptmemMax", "type": "int"}, + "net_ipv4_tcp_max_syn_backlog": {"key": "netIpv4TcpMaxSynBacklog", "type": "int"}, + "net_ipv4_tcp_max_tw_buckets": {"key": "netIpv4TcpMaxTwBuckets", "type": "int"}, + "net_ipv4_tcp_fin_timeout": {"key": "netIpv4TcpFinTimeout", "type": "int"}, + "net_ipv4_tcp_keepalive_time": {"key": "netIpv4TcpKeepaliveTime", "type": "int"}, + "net_ipv4_tcp_keepalive_probes": {"key": "netIpv4TcpKeepaliveProbes", "type": "int"}, + "net_ipv4_tcpkeepalive_intvl": {"key": "netIpv4TcpkeepaliveIntvl", "type": "int"}, + "net_ipv4_tcp_rmem": {"key": "netIpv4TcpRmem", "type": "int"}, + "net_ipv4_tcp_wmem": {"key": "netIpv4TcpWmem", "type": "int"}, + "net_ipv4_tcp_tw_reuse": {"key": "netIpv4TcpTwReuse", "type": "bool"}, + "net_ipv4_ip_local_port_range": {"key": "netIpv4IpLocalPortRange", "type": "str"}, + "net_ipv4_neigh_default_gc_thresh1": {"key": "netIpv4NeighDefaultGcThresh1", "type": "int"}, + "net_ipv4_neigh_default_gc_thresh2": {"key": "netIpv4NeighDefaultGcThresh2", "type": "int"}, + "net_ipv4_neigh_default_gc_thresh3": {"key": "netIpv4NeighDefaultGcThresh3", "type": "int"}, + "net_netfilter_nf_conntrack_max": {"key": "netNetfilterNfConntrackMax", "type": "int"}, + "net_netfilter_nf_conntrack_buckets": {"key": "netNetfilterNfConntrackBuckets", "type": "int"}, + "fs_inotify_max_user_watches": {"key": "fsInotifyMaxUserWatches", "type": "int"}, + "fs_file_max": {"key": "fsFileMax", "type": "int"}, + "fs_aio_max_nr": {"key": "fsAioMaxNr", "type": "int"}, + "fs_nr_open": {"key": "fsNrOpen", "type": "int"}, + "kernel_threads_max": {"key": "kernelThreadsMax", "type": "int"}, + "vm_max_map_count": {"key": "vmMaxMapCount", "type": "int"}, + "vm_swappiness": {"key": "vmSwappiness", "type": "int"}, + "vm_vfs_cache_pressure": {"key": "vmVfsCachePressure", "type": "int"}, } - def __init__( + def __init__( # pylint: disable=too-many-locals self, *, net_core_somaxconn: Optional[int] = None, @@ -4390,7 +4339,7 @@ def __init__( :keyword vm_vfs_cache_pressure: Sysctl setting vm.vfs_cache_pressure. :paramtype vm_vfs_cache_pressure: int """ - super(SysctlConfig, self).__init__(**kwargs) + super().__init__(**kwargs) self.net_core_somaxconn = net_core_somaxconn self.net_core_netdev_max_backlog = net_core_netdev_max_backlog self.net_core_rmem_max = net_core_rmem_max @@ -4421,26 +4370,21 @@ def __init__( self.vm_vfs_cache_pressure = vm_vfs_cache_pressure -class TagsObject(msrest.serialization.Model): +class TagsObject(_serialization.Model): """Tags object for patch operations. - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] """ _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] """ - super(TagsObject, self).__init__(**kwargs) + super().__init__(**kwargs) self.tags = tags diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/models/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/models/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/models/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/models/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/operations/__init__.py index eb76d54a688d..160f4be0e9d7 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/operations/__init__.py @@ -16,13 +16,14 @@ from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'Operations', - 'ManagedClustersOperations', - 'AgentPoolsOperations', - 'PrivateEndpointConnectionsOperations', - 'PrivateLinkResourcesOperations', - 'ResolvePrivateLinkServiceIdOperations', + "Operations", + "ManagedClustersOperations", + "AgentPoolsOperations", + "PrivateEndpointConnectionsOperations", + "PrivateLinkResourcesOperations", + "ResolvePrivateLinkServiceIdOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/operations/_agent_pools_operations.py index 218afacf1374..c3f85c5631d9 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/operations/_agent_pools_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,288 +27,289 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - *, - json: Optional[_models.AgentPool] = None, - content: Any = None, - **kwargs: Any + _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, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + _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, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_get_upgrade_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_available_agent_pool_versions_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_upgrade_node_image_version_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_upgrade_node_image_version_request( + resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class AgentPoolsOperations: """ @@ -324,48 +330,40 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> Iterable[_models.AgentPoolListResult]: + def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> Iterable["_models.AgentPool"]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. The operation returns properties of each agent pool. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AgentPoolListResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_11_01.models.AgentPoolListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either AgentPool or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_11_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -373,16 +371,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -398,10 +391,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -411,54 +402,45 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore @distributed_trace def get( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPool: """Gets the agent pool. Gets the details of the agent pool by managed cluster and resource group. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPool, or the result of cls(response) + :return: AgentPool or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_11_01.models.AgentPool - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -466,57 +448,60 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore def _create_or_update_initial( self, resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: _models.AgentPool, + parameters: Union[_models.AgentPool, IO], **kwargs: Any ) -> _models.AgentPool: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - _json = self._serialize.body(parameters, 'AgentPool') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "AgentPool") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -524,10 +509,9 @@ def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -535,40 +519,125 @@ def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - @distributed_trace + @overload def begin_create_or_update( self, resource_group_name: str, resource_name: str, agent_pool_name: str, parameters: _models.AgentPool, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.AgentPool]: """Creates or updates an agent pool. Creates or updates an agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :param parameters: Parameters supplied to the Create or Update an agent pool operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2020_11_01.models.AgentPool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_11_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AgentPool]: + """Creates or updates an agent pool. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: Parameters supplied to the Create or Update an agent pool operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_11_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: Union[_models.AgentPool, IO], + **kwargs: Any + ) -> LROPoller[_models.AgentPool]: + """Creates or updates an agent pool. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: Parameters supplied to the Create or Update an agent pool operation. Is + either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2020_11_01.models.AgentPool or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -580,20 +649,17 @@ def begin_create_or_update( :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_11_01.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -602,66 +668,55 @@ def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -669,10 +724,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -682,26 +736,21 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + def begin_delete( + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> LROPoller[None]: """Deletes an agent pool. Deletes the agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -713,100 +762,86 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPoolUpgradeProfile: """Gets upgrade profile for an agent pool. Gets the details of the upgrade profile for an agent pool with a specified resource group and managed cluster name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolUpgradeProfile, or the result of cls(response) + :return: AgentPoolUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_11_01.models.AgentPoolUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -814,64 +849,56 @@ def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolUpgradeProfile', pipeline_response) + deserialized = self._deserialize("AgentPoolUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore @distributed_trace def get_available_agent_pool_versions( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported versions for the specified agent pool. Gets a list of supported versions for the specified agent pool. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolAvailableVersions, or the result of cls(response) + :return: AgentPoolAvailableVersions or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_11_01.models.AgentPoolAvailableVersions - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolAvailableVersions] - request = build_get_available_agent_pool_versions_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_available_agent_pool_versions.metadata['url'], + template_url=self.get_available_agent_pool_versions.metadata["url"], headers=_headers, params=_params, ) @@ -879,52 +906,43 @@ def get_available_agent_pool_versions( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolAvailableVersions', pipeline_response) + deserialized = self._deserialize("AgentPoolAvailableVersions", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_available_agent_pool_versions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore - + get_available_agent_pool_versions.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore def _upgrade_node_image_version_initial( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> Optional[_models.AgentPool]: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.AgentPool]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.AgentPool]] - - request = build_upgrade_node_image_version_request_initial( - subscription_id=self._config.subscription_id, + request = build_upgrade_node_image_version_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._upgrade_node_image_version_initial.metadata['url'], + template_url=self._upgrade_node_image_version_initial.metadata["url"], headers=_headers, params=_params, ) @@ -932,10 +950,9 @@ def _upgrade_node_image_version_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -944,33 +961,28 @@ def _upgrade_node_image_version_initial( deserialized = None if response.status_code == 202: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _upgrade_node_image_version_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore - + _upgrade_node_image_version_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore @distributed_trace def begin_upgrade_node_image_version( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any - ) -> LROPoller[_models.AgentPool]: + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any + ) -> LROPoller[None]: """Upgrade node image version of an agent pool to the latest. Upgrade node image version of an agent pool to the latest. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -983,55 +995,48 @@ def begin_upgrade_node_image_version( :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_11_01.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._upgrade_node_image_version_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_upgrade_node_image_version.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore + begin_upgrade_node_image_version.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/operations/_managed_clusters_operations.py index 59eec46cd15c..a3c00bf17e37 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/operations/_managed_clusters_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,631 +27,612 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters") + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters" + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_resource_group_request( - subscription_id: str, - resource_group_name: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters", + ) # 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', min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_upgrade_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_access_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, role_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 = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "roleName": _SERIALIZER.url("role_name", role_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "roleName": _SERIALIZER.url("role_name", role_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_admin_credentials_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_user_credentials_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_monitoring_user_credentials_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: + +def build_get_request(resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedCluster] = None, - content: Any = None, - **kwargs: Any + +def build_create_or_update_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_update_tags_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.TagsObject] = None, - content: Any = None, - **kwargs: Any + +def build_update_tags_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any +def build_delete_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_reset_service_principal_profile_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedClusterServicePrincipalProfile] = None, - content: Any = None, - **kwargs: Any +def build_reset_service_principal_profile_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_reset_aad_profile_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedClusterAADProfile] = None, - content: Any = None, - **kwargs: Any +def build_reset_aad_profile_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_rotate_cluster_certificates_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any +def build_rotate_cluster_certificates_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_stop_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + +def build_stop_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_start_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + +def build_start_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + class ManagedClustersOperations: # pylint: disable=too-many-public-methods """ @@ -667,41 +653,35 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.ManagedClusterListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.ManagedCluster"]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. The operation returns properties of each managed cluster. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_11_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_11_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -709,14 +689,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -732,10 +709,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -745,50 +720,42 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> Iterable[_models.ManagedClusterListResult]: + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.ManagedCluster"]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. The operation returns properties of each managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_11_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_11_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -796,15 +763,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -820,10 +783,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -833,51 +794,43 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.ManagedClusterUpgradeProfile: """Gets upgrade profile for a managed cluster. Gets the details of the upgrade profile for a managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterUpgradeProfile, or the result of cls(response) + :return: ManagedClusterUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_11_01.models.ManagedClusterUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -885,33 +838,27 @@ def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterUpgradeProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore @distributed_trace def get_access_profile( - self, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, role_name: str, **kwargs: Any ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. @@ -922,36 +869,33 @@ def get_access_profile( `ListClusterAdminCredentials `_ . - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param role_name: The name of the role for managed cluster accessProfile resource. + :param role_name: The name of the role for managed cluster accessProfile resource. Required. :type role_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterAccessProfile, or the result of cls(response) + :return: ManagedClusterAccessProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_11_01.models.ManagedClusterAccessProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterAccessProfile] - request = build_get_access_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, role_name=role_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_access_profile.metadata['url'], + template_url=self.get_access_profile.metadata["url"], headers=_headers, params=_params, ) @@ -959,64 +903,56 @@ def get_access_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterAccessProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterAccessProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_access_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore - + get_access_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore @distributed_trace def list_cluster_admin_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster admin credential of a managed cluster. Gets cluster admin credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_11_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_admin_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_admin_credentials.metadata['url'], + template_url=self.list_cluster_admin_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -1024,64 +960,56 @@ def list_cluster_admin_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_admin_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore - + list_cluster_admin_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore @distributed_trace def list_cluster_user_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster user credential of a managed cluster. Gets cluster user credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_11_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_user_credentials.metadata['url'], + template_url=self.list_cluster_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -1089,65 +1017,57 @@ def list_cluster_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore - + list_cluster_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore @distributed_trace def list_cluster_monitoring_user_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster monitoring user credential of a managed cluster. Gets cluster monitoring user credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_11_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_monitoring_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + template_url=self.list_cluster_monitoring_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -1155,64 +1075,54 @@ def list_cluster_monitoring_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_monitoring_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore - + list_cluster_monitoring_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore @distributed_trace - def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.ManagedCluster: + def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.ManagedCluster: """Gets a managed cluster. Gets the details of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedCluster, or the result of cls(response) + :return: ManagedCluster or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_11_01.models.ManagedCluster - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -1220,55 +1130,54 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _create_or_update_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.ManagedCluster, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'ManagedCluster') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedCluster") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1276,10 +1185,9 @@ def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -1287,25 +1195,26 @@ def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - @distributed_trace + @overload def begin_create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedCluster, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. @@ -1313,12 +1222,90 @@ def begin_create_or_update( Creates or updates a managed cluster with the specified configuration for agents and Kubernetes version. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2020_11_01.models.ManagedCluster + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_11_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster with the specified configuration for agents and Kubernetes + version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_11_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster with the specified configuration for agents and Kubernetes + version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. Is + either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2020_11_01.models.ManagedCluster or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1331,20 +1318,17 @@ def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_11_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -1352,69 +1336,66 @@ def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _update_tags_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.TagsObject, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request_initial( - subscription_id=self._config.subscription_id, + request = build_update_tags_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_tags_initial.metadata['url'], + content=_content, + template_url=self._update_tags_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1422,44 +1403,118 @@ def _update_tags_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_tags_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + _update_tags_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - - @distributed_trace + @overload def begin_update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates a managed cluster with the specified tags. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2020_11_01.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_11_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates a managed cluster with the specified tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_11_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates a managed cluster with the specified tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2020_11_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1472,20 +1527,17 @@ def begin_update_tags( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_11_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, @@ -1493,64 +1545,54 @@ def begin_update_tags( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1558,10 +1600,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1571,23 +1612,17 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> LROPoller[None]: + def begin_delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> LROPoller[None]: """Deletes a managed cluster. Deletes the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1599,85 +1634,83 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterServicePrincipalProfile, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterServicePrincipalProfile") - request = build_reset_service_principal_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_service_principal_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_service_principal_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_service_principal_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1685,10 +1718,9 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1698,29 +1730,33 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re if cls: return cls(pipeline_response, None, {}) - _reset_service_principal_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + _reset_service_principal_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore - - @distributed_trace - def begin_reset_service_principal_profile( # pylint: disable=inconsistent-return-statements + @overload + def begin_reset_service_principal_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterServicePrincipalProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: """Reset Service Principal Profile of a managed cluster. Update the service principal Profile for a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a - Managed Cluster. + Managed Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2020_11_01.models.ManagedClusterServicePrincipalProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1731,20 +1767,90 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reset Service Principal Profile of a managed cluster. + + Update the service principal Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a + Managed Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Reset Service Principal Profile of a managed cluster. + + Update the service principal Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a + Managed Cluster. Is either a model type or a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2020_11_01.models.ManagedClusterServicePrincipalProfile or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1752,67 +1858,68 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_service_principal_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + begin_reset_service_principal_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterAADProfile, + parameters: Union[_models.ManagedClusterAADProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterAADProfile") - request = build_reset_aad_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_aad_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_aad_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_aad_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1820,10 +1927,9 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1833,28 +1939,105 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement if cls: return cls(pipeline_response, None, {}) - _reset_aad_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - + _reset_aad_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - @distributed_trace - def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements + @overload + def begin_reset_aad_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterAADProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: """Reset AAD Profile of a managed cluster. Update the AAD Profile for a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed - Cluster. + Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2020_11_01.models.ManagedClusterAADProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reset AAD Profile of a managed cluster. + + Update the AAD Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed + Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterAADProfile, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Reset AAD Profile of a managed cluster. + + Update the AAD Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed + Cluster. Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2020_11_01.models.ManagedClusterAADProfile or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1865,20 +2048,17 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1886,62 +2066,52 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_aad_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + begin_reset_aad_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_rotate_cluster_certificates_request_initial( - subscription_id=self._config.subscription_id, + request = build_rotate_cluster_certificates_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._rotate_cluster_certificates_initial.metadata['url'], + template_url=self._rotate_cluster_certificates_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1949,10 +2119,9 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1962,23 +2131,19 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return if cls: return cls(pipeline_response, None, {}) - _rotate_cluster_certificates_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore - + _rotate_cluster_certificates_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore @distributed_trace - def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + def begin_rotate_cluster_certificates( + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> LROPoller[None]: """Rotate certificates of a managed cluster. Rotate certificates of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1990,80 +2155,67 @@ def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-st Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._rotate_cluster_certificates_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_rotate_cluster_certificates.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore + begin_rotate_cluster_certificates.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore def _stop_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_stop_request_initial( - subscription_id=self._config.subscription_id, + request = build_stop_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._stop_initial.metadata['url'], + template_url=self._stop_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2071,10 +2223,9 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -2084,23 +2235,17 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore - + _stop_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore @distributed_trace - def begin_stop( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> LROPoller[None]: + def begin_stop(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> LROPoller[None]: """Stop Managed Cluster. Stops a Running Managed Cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -2112,80 +2257,67 @@ def begin_stop( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._stop_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore + begin_stop.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore def _start_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_start_request_initial( - subscription_id=self._config.subscription_id, + request = build_start_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._start_initial.metadata['url'], + template_url=self._start_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2193,10 +2325,9 @@ def _start_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -2206,23 +2337,17 @@ def _start_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore - + _start_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore @distributed_trace - def begin_start( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> LROPoller[None]: + def begin_start(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> LROPoller[None]: """Start Managed Cluster. Starts a Stopped Managed Cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -2234,52 +2359,45 @@ def begin_start( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._start_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore + begin_start.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/operations/_operations.py index c52e9624e511..fae5cbe6c180 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/operations/_operations.py @@ -7,10 +7,15 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,38 +25,34 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - **kwargs: Any -) -> HttpRequest: + +def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.ContainerService/operations") # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class Operations: """ @@ -72,36 +73,31 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.OperationListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.OperationValue"]: """Gets a list of compute operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationListResult or the result of cls(response) + :return: An iterator like instance of either OperationValue or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_11_01.models.OperationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_11_01.models.OperationValue] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -109,13 +105,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -131,10 +125,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -144,8 +136,6 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.ContainerService/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ContainerService/operations"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/operations/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/operations/_private_endpoint_connections_operations.py index 9ecd5d738c59..cb027b3f9aad 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/operations/_private_endpoint_connections_operations.py @@ -6,11 +6,15 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod @@ -21,173 +25,191 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - subscription_id: str, resource_group_name: str, resource_name: str, private_endpoint_connection_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 = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_update_request( - subscription_id: str, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, - *, - json: Optional[_models.PrivateEndpointConnection] = None, - content: Any = None, + subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request_initial( - subscription_id: str, +def build_delete_request( resource_group_name: str, resource_name: str, private_endpoint_connection_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 = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class PrivateEndpointConnectionsOperations: """ @@ -208,46 +230,39 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnectionListResult: """Gets a list of private endpoint connections in the specified managed cluster. Gets a list of private endpoint connections in the specified managed cluster. The operation returns properties of each private endpoint connection. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnectionListResult, or the result of cls(response) + :return: PrivateEndpointConnectionListResult or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_11_01.models.PrivateEndpointConnectionListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnectionListResult] - request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -255,68 +270,59 @@ def list( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore - + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore @distributed_trace def get( - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnection: """Gets the private endpoint connection. Gets the details of the private endpoint connection by managed cluster and resource group. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_11_01.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -324,75 +330,149 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - @distributed_trace + @overload def update( self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, parameters: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateEndpointConnection: """Updates a private endpoint connection. Updates a private endpoint connection in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :param parameters: Parameters supplied to the Update a private endpoint connection operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2020_11_01.models.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2020_11_01.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: Parameters supplied to the Update a private endpoint connection operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_11_01.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @distributed_trace + def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: Union[_models.PrivateEndpointConnection, IO], + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: Parameters supplied to the Update a private endpoint connection operation. + Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2020_11_01.models.PrivateEndpointConnection or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2020_11_01.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - _json = self._serialize.body(parameters, 'PrivateEndpointConnection') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateEndpointConnection") request = build_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update.metadata['url'], + content=_content, + template_url=self.update.metadata["url"], headers=_headers, params=_params, ) @@ -400,52 +480,43 @@ def update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -453,10 +524,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -466,26 +536,21 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + def begin_delete( + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> LROPoller[None]: """Deletes a private endpoint connection. Deletes the private endpoint connection in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -497,53 +562,46 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/operations/_private_link_resources_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/operations/_private_link_resources_operations.py index a6d4e0d782ef..37e2d8e45e9c 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/operations/_private_link_resources_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/operations/_private_link_resources_operations.py @@ -8,9 +8,13 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -19,48 +23,53 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class PrivateLinkResourcesOperations: """ @@ -81,46 +90,39 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.PrivateLinkResourcesListResult: """Gets a list of private link resources in the specified managed cluster. Gets a list of private link resources in the specified managed cluster. The operation returns properties of each private link resource. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResourcesListResult, or the result of cls(response) + :return: PrivateLinkResourcesListResult or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_11_01.models.PrivateLinkResourcesListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResourcesListResult] - request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -128,22 +130,20 @@ def list( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResourcesListResult', pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources"} # type: ignore - + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/operations/_resolve_private_link_service_id_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/operations/_resolve_private_link_service_id_operations.py index 391170934689..3becbef0788c 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/operations/_resolve_private_link_service_id_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/operations/_resolve_private_link_service_id_operations.py @@ -6,11 +6,15 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -19,56 +23,56 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_post_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.PrivateLinkResource] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + class ResolvePrivateLinkServiceIdOperations: """ @@ -89,53 +93,120 @@ def __init__(self, *args, **kwargs): 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 + @overload def post( self, resource_group_name: str, resource_name: str, parameters: _models.PrivateLinkResource, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateLinkResource: """Gets the private link service ID for the specified managed cluster. Gets the private link service ID the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters (name, groupId) supplied in order to resolve a private link - service ID. + service ID. Required. :type parameters: ~azure.mgmt.containerservice.v2020_11_01.models.PrivateLinkResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResource, or the result of cls(response) + :return: PrivateLinkResource or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_11_01.models.PrivateLinkResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + def post( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters (name, groupId) supplied in order to resolve a private link + service ID. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2020_11_01.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def post( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.PrivateLinkResource, IO], + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters (name, groupId) supplied in order to resolve a private link + service ID. Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2020_11_01.models.PrivateLinkResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2020_11_01.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResource] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-11-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResource] - _json = self._serialize.body(parameters, 'PrivateLinkResource') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateLinkResource") request = build_post_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.post.metadata['url'], + content=_content, + template_url=self.post.metadata["url"], headers=_headers, params=_params, ) @@ -143,22 +214,20 @@ def post( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResource', pipeline_response) + deserialized = self._deserialize("PrivateLinkResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - post.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId"} # type: ignore - + post.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/__init__.py index 37a5f9e02e6f..a8716d29afe8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/__init__.py @@ -14,7 +14,8 @@ except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['ContainerServiceClient'] + +__all__ = ["ContainerServiceClient"] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/_configuration.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/_configuration.py index 28a7e804b71a..07fcacb82b31 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/_configuration.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/_configuration.py @@ -18,30 +18,26 @@ VERSION = "unknown" + class ContainerServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ContainerServiceClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2020-12-01". 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: + def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ContainerServiceClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2020-12-01") # type: str + api_version = kwargs.pop("api_version", "2020-12-01") # type: str if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -51,23 +47,24 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-containerservice/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-containerservice/{}".format(VERSION)) self._configure(**kwargs) def _configure( - self, - **kwargs # type: Any + self, **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/_container_service_client.py index a2548045810c..6bfe09f2db30 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/_container_service_client.py @@ -9,20 +9,28 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from . import models +from .._serialization import Deserializer, Serializer from ._configuration import ContainerServiceClientConfiguration -from .operations import AgentPoolsOperations, MaintenanceConfigurationsOperations, ManagedClustersOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, ResolvePrivateLinkServiceIdOperations +from .operations import ( + AgentPoolsOperations, + MaintenanceConfigurationsOperations, + ManagedClustersOperations, + Operations, + PrivateEndpointConnectionsOperations, + PrivateLinkResourcesOperations, + ResolvePrivateLinkServiceIdOperations, +) if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class ContainerServiceClient: # pylint: disable=too-many-instance-attributes + +class ContainerServiceClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """The Container Service Client. :ivar operations: Operations operations @@ -44,10 +52,10 @@ class ContainerServiceClient: # pylint: disable=too-many-instance-attributes :ivar resolve_private_link_service_id: ResolvePrivateLinkServiceIdOperations operations :vartype resolve_private_link_service_id: azure.mgmt.containerservice.v2020_12_01.operations.ResolvePrivateLinkServiceIdOperations - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -65,25 +73,23 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = ContainerServiceClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = ContainerServiceClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize - ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.managed_clusters = ManagedClustersOperations( self._client, self._config, self._serialize, self._deserialize ) self.maintenance_configurations = MaintenanceConfigurationsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.agent_pools = AgentPoolsOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) self.private_endpoint_connections = PrivateEndpointConnectionsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -94,12 +100,7 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) - - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> HttpResponse: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -108,7 +109,7 @@ def _send_request( >>> response = client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/_metadata.json b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/_metadata.json index 1a7cf163b2c9..532621b2cc2a 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/_metadata.json +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/_metadata.json @@ -10,20 +10,20 @@ "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { "credential": { - "signature": "credential, # type: \"TokenCredential\"", - "description": "Credential needed for the client to connect to Azure.", + "signature": "credential: \"TokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true }, "subscription_id": { - "signature": "subscription_id, # type: str", - "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "signature": "subscription_id: str,", + "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.", "docstring_type": "str", "required": true } @@ -31,13 +31,13 @@ "async": { "credential": { "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure.", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { "signature": "subscription_id: str,", - "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.", "docstring_type": "str", "required": true } @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=\"https://management.azure.com\", # type: str", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/_patch.py index 74e48ecd07cf..f99e77fef986 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/_patch.py @@ -28,4 +28,4 @@ # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + pass diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/_vendor.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/_vendor.py index 138f663c53a4..9aad73fc743e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/_vendor.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/_vendor.py @@ -7,6 +7,7 @@ from azure.core.pipeline.transport import HttpRequest + def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) @@ -14,6 +15,7 @@ def _convert_request(request, files=None): request.set_formdata_body(files) return request + def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -21,7 +23,5 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [ - c for c in formatted_components if "{}".format(key.args[0]) not in c - ] + components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/aio/__init__.py index 37a5f9e02e6f..a8716d29afe8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/aio/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/aio/__init__.py @@ -14,7 +14,8 @@ except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['ContainerServiceClient'] + +__all__ = ["ContainerServiceClient"] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/aio/_configuration.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/aio/_configuration.py index 5d98f0eed481..265db4a3a11e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/aio/_configuration.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/aio/_configuration.py @@ -18,30 +18,26 @@ VERSION = "unknown" + class ContainerServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ContainerServiceClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2020-12-01". 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: + def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ContainerServiceClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2020-12-01") # type: str + api_version = kwargs.pop("api_version", "2020-12-01") # type: str if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -51,22 +47,21 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-containerservice/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-containerservice/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, - **kwargs: Any - ) -> None: - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/aio/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/aio/_container_service_client.py index 3c197000ebe3..b48a22f7ab01 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/aio/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/aio/_container_service_client.py @@ -9,20 +9,28 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from .. import models +from ..._serialization import Deserializer, Serializer from ._configuration import ContainerServiceClientConfiguration -from .operations import AgentPoolsOperations, MaintenanceConfigurationsOperations, ManagedClustersOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, ResolvePrivateLinkServiceIdOperations +from .operations import ( + AgentPoolsOperations, + MaintenanceConfigurationsOperations, + ManagedClustersOperations, + Operations, + PrivateEndpointConnectionsOperations, + PrivateLinkResourcesOperations, + ResolvePrivateLinkServiceIdOperations, +) if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class ContainerServiceClient: # pylint: disable=too-many-instance-attributes + +class ContainerServiceClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """The Container Service Client. :ivar operations: Operations operations @@ -45,10 +53,10 @@ class ContainerServiceClient: # pylint: disable=too-many-instance-attributes :ivar resolve_private_link_service_id: ResolvePrivateLinkServiceIdOperations operations :vartype resolve_private_link_service_id: azure.mgmt.containerservice.v2020_12_01.aio.operations.ResolvePrivateLinkServiceIdOperations - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -66,25 +74,23 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = ContainerServiceClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = ContainerServiceClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize - ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.managed_clusters = ManagedClustersOperations( self._client, self._config, self._serialize, self._deserialize ) self.maintenance_configurations = MaintenanceConfigurationsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.agent_pools = AgentPoolsOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) self.private_endpoint_connections = PrivateEndpointConnectionsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -95,12 +101,7 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) - - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -109,7 +110,7 @@ def _send_request( >>> response = await client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/aio/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/aio/_patch.py index 74e48ecd07cf..f99e77fef986 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/aio/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/aio/_patch.py @@ -28,4 +28,4 @@ # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + pass diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/aio/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/aio/operations/__init__.py index f0e265d9f2f4..f27b588ca549 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/aio/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/aio/operations/__init__.py @@ -17,14 +17,15 @@ from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'Operations', - 'ManagedClustersOperations', - 'MaintenanceConfigurationsOperations', - 'AgentPoolsOperations', - 'PrivateEndpointConnectionsOperations', - 'PrivateLinkResourcesOperations', - 'ResolvePrivateLinkServiceIdOperations', + "Operations", + "ManagedClustersOperations", + "MaintenanceConfigurationsOperations", + "AgentPoolsOperations", + "PrivateEndpointConnectionsOperations", + "PrivateLinkResourcesOperations", + "ResolvePrivateLinkServiceIdOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/aio/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/aio/operations/_agent_pools_operations.py index fa4a7d5d4adf..97e3bc201120 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/aio/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/aio/operations/_agent_pools_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +29,20 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._agent_pools_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_available_agent_pool_versions_request, build_get_request, build_get_upgrade_profile_request, build_list_request, build_upgrade_node_image_version_request_initial -T = TypeVar('T') +from ...operations._agent_pools_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_available_agent_pool_versions_request, + build_get_request, + build_get_upgrade_profile_request, + build_list_request, + build_upgrade_node_image_version_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class AgentPoolsOperations: """ .. warning:: @@ -45,48 +62,41 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.AgentPoolListResult]: + def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncIterable["_models.AgentPool"]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. The operation returns properties of each agent pool. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AgentPoolListResult or the result of cls(response) + :return: An iterator like instance of either AgentPool or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_12_01.models.AgentPoolListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_12_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -94,16 +104,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -119,10 +124,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -132,54 +135,45 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore @distributed_trace_async async def get( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPool: """Gets the agent pool. Gets the details of the agent pool by managed cluster and resource group. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPool, or the result of cls(response) + :return: AgentPool or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_12_01.models.AgentPool - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -187,57 +181,60 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore async def _create_or_update_initial( self, resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: _models.AgentPool, + parameters: Union[_models.AgentPool, IO], **kwargs: Any ) -> _models.AgentPool: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - _json = self._serialize.body(parameters, 'AgentPool') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "AgentPool") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -245,10 +242,9 @@ async def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -256,40 +252,127 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - @distributed_trace_async + @overload async def begin_create_or_update( self, resource_group_name: str, resource_name: str, agent_pool_name: str, parameters: _models.AgentPool, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.AgentPool]: """Creates or updates an agent pool. Creates or updates an agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :param parameters: Parameters supplied to the Create or Update an agent pool operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2020_12_01.models.AgentPool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AgentPool or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_12_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AgentPool]: + """Creates or updates an agent pool. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: Parameters supplied to the Create or Update an agent pool operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AgentPool or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_12_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: Union[_models.AgentPool, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.AgentPool]: + """Creates or updates an agent pool. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: Parameters supplied to the Create or Update an agent pool operation. Is + either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2020_12_01.models.AgentPool or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -302,20 +385,17 @@ async def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_12_01.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -324,66 +404,55 @@ async def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -391,10 +460,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -404,26 +472,21 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + async def begin_delete( + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes an agent pool. Deletes the agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -435,100 +498,86 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace_async async def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPoolUpgradeProfile: """Gets upgrade profile for an agent pool. Gets the details of the upgrade profile for an agent pool with a specified resource group and managed cluster name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolUpgradeProfile, or the result of cls(response) + :return: AgentPoolUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_12_01.models.AgentPoolUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -536,64 +585,56 @@ async def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolUpgradeProfile', pipeline_response) + deserialized = self._deserialize("AgentPoolUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore @distributed_trace_async async def get_available_agent_pool_versions( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported versions for the specified agent pool. Gets a list of supported versions for the specified agent pool. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolAvailableVersions, or the result of cls(response) + :return: AgentPoolAvailableVersions or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_12_01.models.AgentPoolAvailableVersions - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolAvailableVersions] - request = build_get_available_agent_pool_versions_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_available_agent_pool_versions.metadata['url'], + template_url=self.get_available_agent_pool_versions.metadata["url"], headers=_headers, params=_params, ) @@ -601,52 +642,43 @@ async def get_available_agent_pool_versions( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolAvailableVersions', pipeline_response) + deserialized = self._deserialize("AgentPoolAvailableVersions", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_available_agent_pool_versions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore - + get_available_agent_pool_versions.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore async def _upgrade_node_image_version_initial( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> Optional[_models.AgentPool]: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.AgentPool]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.AgentPool]] - - request = build_upgrade_node_image_version_request_initial( - subscription_id=self._config.subscription_id, + request = build_upgrade_node_image_version_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._upgrade_node_image_version_initial.metadata['url'], + template_url=self._upgrade_node_image_version_initial.metadata["url"], headers=_headers, params=_params, ) @@ -654,10 +686,9 @@ async def _upgrade_node_image_version_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -666,33 +697,28 @@ async def _upgrade_node_image_version_initial( deserialized = None if response.status_code == 202: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _upgrade_node_image_version_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore - + _upgrade_node_image_version_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore @distributed_trace_async async def begin_upgrade_node_image_version( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any - ) -> AsyncLROPoller[_models.AgentPool]: + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: """Upgrade node image version of an agent pool to the latest. Upgrade node image version of an agent pool to the latest. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -706,55 +732,48 @@ async def begin_upgrade_node_image_version( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_12_01.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._upgrade_node_image_version_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_upgrade_node_image_version.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore + begin_upgrade_node_image_version.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/aio/operations/_maintenance_configurations_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/aio/operations/_maintenance_configurations_operations.py index c9cbad256630..ed6271eca0df 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/aio/operations/_maintenance_configurations_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/aio/operations/_maintenance_configurations_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,10 +27,17 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._maintenance_configurations_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_managed_cluster_request -T = TypeVar('T') +from ...operations._maintenance_configurations_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_managed_cluster_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class MaintenanceConfigurationsOperations: """ .. warning:: @@ -43,49 +57,44 @@ def __init__(self, *args, **kwargs) -> None: 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_managed_cluster( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.MaintenanceConfigurationListResult]: + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> AsyncIterable["_models.MaintenanceConfiguration"]: """Gets a list of maintenance configurations in the specified managed cluster. Gets a list of maintenance configurations in the specified managed cluster. The operation returns properties of each maintenance configuration. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either MaintenanceConfigurationListResult or the result - of cls(response) + :return: An iterator like instance of either MaintenanceConfiguration or the result of + cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_12_01.models.MaintenanceConfigurationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_12_01.models.MaintenanceConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfigurationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfigurationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_managed_cluster_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_managed_cluster.metadata['url'], + template_url=self.list_by_managed_cluster.metadata["url"], headers=_headers, params=_params, ) @@ -93,16 +102,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_managed_cluster_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -118,10 +122,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -131,54 +133,45 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_managed_cluster.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations"} # type: ignore + list_by_managed_cluster.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations"} # type: ignore @distributed_trace_async async def get( - self, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, config_name: str, **kwargs: Any ) -> _models.MaintenanceConfiguration: """Gets the maintenance configuration. Gets the details of maintenance configurations by managed cluster and resource group. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: MaintenanceConfiguration, or the result of cls(response) + :return: MaintenanceConfiguration or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_12_01.models.MaintenanceConfiguration - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfiguration] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -186,76 +179,149 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) + deserialized = self._deserialize("MaintenanceConfiguration", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - @distributed_trace_async + @overload async def create_or_update( self, resource_group_name: str, resource_name: str, config_name: str, parameters: _models.MaintenanceConfiguration, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.MaintenanceConfiguration: """Creates or updates a maintenance configurations. Creates or updates a maintenance configuration in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str :param parameters: Parameters supplied to the Create or Update a default maintenance - configuration. + configuration. Required. :type parameters: ~azure.mgmt.containerservice.v2020_12_01.models.MaintenanceConfiguration + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: MaintenanceConfiguration, or the result of cls(response) + :return: MaintenanceConfiguration or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_12_01.models.MaintenanceConfiguration - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configurations. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: Parameters supplied to the Create or Update a default maintenance + configuration. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2020_12_01.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: Union[_models.MaintenanceConfiguration, IO], + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configurations. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: Parameters supplied to the Create or Update a default maintenance + configuration. Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2020_12_01.models.MaintenanceConfiguration or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2020_12_01.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfiguration] - _json = self._serialize.body(parameters, 'MaintenanceConfiguration') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "MaintenanceConfiguration") request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) @@ -263,68 +329,59 @@ async def create_or_update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) + deserialized = self._deserialize("MaintenanceConfiguration", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, config_name: str, **kwargs: Any ) -> None: """Deletes a maintenance configuration. Deletes the maintenance configuration in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) @@ -332,10 +389,9 @@ async def delete( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -345,5 +401,4 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/aio/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/aio/operations/_managed_clusters_operations.py index f79d7b7fb019..4b3856298d32 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/aio/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/aio/operations/_managed_clusters_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +29,29 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._managed_clusters_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_access_profile_request, build_get_request, build_get_upgrade_profile_request, build_list_by_resource_group_request, build_list_cluster_admin_credentials_request, build_list_cluster_monitoring_user_credentials_request, build_list_cluster_user_credentials_request, build_list_request, build_reset_aad_profile_request_initial, build_reset_service_principal_profile_request_initial, build_rotate_cluster_certificates_request_initial, build_start_request_initial, build_stop_request_initial, build_update_tags_request_initial -T = TypeVar('T') +from ...operations._managed_clusters_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_access_profile_request, + build_get_request, + build_get_upgrade_profile_request, + build_list_by_resource_group_request, + build_list_cluster_admin_credentials_request, + build_list_cluster_monitoring_user_credentials_request, + build_list_cluster_user_credentials_request, + build_list_request, + build_reset_aad_profile_request, + build_reset_service_principal_profile_request, + build_rotate_cluster_certificates_request, + build_start_request, + build_stop_request, + build_update_tags_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class ManagedClustersOperations: # pylint: disable=too-many-public-methods """ .. warning:: @@ -45,41 +71,35 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.ManagedClusterListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.ManagedCluster"]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. The operation returns properties of each managed cluster. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_12_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_12_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -87,14 +107,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -110,10 +127,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -123,50 +138,44 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.ManagedClusterListResult]: + self, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ManagedCluster"]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. The operation returns properties of each managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_12_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_12_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -174,15 +183,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -198,10 +203,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -211,51 +214,43 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace_async async def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.ManagedClusterUpgradeProfile: """Gets upgrade profile for a managed cluster. Gets the details of the upgrade profile for a managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterUpgradeProfile, or the result of cls(response) + :return: ManagedClusterUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_12_01.models.ManagedClusterUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -263,33 +258,27 @@ async def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterUpgradeProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore @distributed_trace_async async def get_access_profile( - self, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, role_name: str, **kwargs: Any ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. @@ -300,36 +289,33 @@ async def get_access_profile( `ListClusterAdminCredentials `_ . - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param role_name: The name of the role for managed cluster accessProfile resource. + :param role_name: The name of the role for managed cluster accessProfile resource. Required. :type role_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterAccessProfile, or the result of cls(response) + :return: ManagedClusterAccessProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_12_01.models.ManagedClusterAccessProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterAccessProfile] - request = build_get_access_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, role_name=role_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_access_profile.metadata['url'], + template_url=self.get_access_profile.metadata["url"], headers=_headers, params=_params, ) @@ -337,64 +323,56 @@ async def get_access_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterAccessProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterAccessProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_access_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore - + get_access_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore @distributed_trace_async async def list_cluster_admin_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster admin credential of a managed cluster. Gets cluster admin credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_12_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_admin_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_admin_credentials.metadata['url'], + template_url=self.list_cluster_admin_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -402,64 +380,56 @@ async def list_cluster_admin_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_admin_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore - + list_cluster_admin_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore @distributed_trace_async async def list_cluster_user_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster user credential of a managed cluster. Gets cluster user credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_12_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_user_credentials.metadata['url'], + template_url=self.list_cluster_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -467,65 +437,57 @@ async def list_cluster_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore - + list_cluster_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore @distributed_trace_async async def list_cluster_monitoring_user_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster monitoring user credential of a managed cluster. Gets cluster monitoring user credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_12_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_monitoring_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + template_url=self.list_cluster_monitoring_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -533,64 +495,54 @@ async def list_cluster_monitoring_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_monitoring_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore - + list_cluster_monitoring_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore @distributed_trace_async - async def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.ManagedCluster: + async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.ManagedCluster: """Gets a managed cluster. Gets the details of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedCluster, or the result of cls(response) + :return: ManagedCluster or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_12_01.models.ManagedCluster - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -598,55 +550,54 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _create_or_update_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.ManagedCluster, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'ManagedCluster') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedCluster") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -654,10 +605,9 @@ async def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -665,25 +615,26 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - @distributed_trace_async + @overload async def begin_create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedCluster, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. @@ -691,12 +642,16 @@ async def begin_create_or_update( Creates or updates a managed cluster with the specified configuration for agents and Kubernetes version. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2020_12_01.models.ManagedCluster + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -709,20 +664,91 @@ async def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_12_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster with the specified configuration for agents and Kubernetes + version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_12_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster with the specified configuration for agents and Kubernetes + version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. Is + either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2020_12_01.models.ManagedCluster or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_12_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -730,69 +756,66 @@ async def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _update_tags_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.TagsObject, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request_initial( - subscription_id=self._config.subscription_id, + request = build_update_tags_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_tags_initial.metadata['url'], + content=_content, + template_url=self._update_tags_initial.metadata["url"], headers=_headers, params=_params, ) @@ -800,44 +823,118 @@ async def _update_tags_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_tags_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _update_tags_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - @distributed_trace_async + @overload async def begin_update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates a managed cluster with the specified tags. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2020_12_01.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_12_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates a managed cluster with the specified tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_12_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates a managed cluster with the specified tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2020_12_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -850,20 +947,17 @@ async def begin_update_tags( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_12_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, @@ -871,64 +965,54 @@ async def begin_update_tags( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -936,10 +1020,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -949,23 +1032,17 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: + async def begin_delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Deletes a managed cluster. Deletes the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -977,85 +1054,83 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterServicePrincipalProfile, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterServicePrincipalProfile") - request = build_reset_service_principal_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_service_principal_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_service_principal_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_service_principal_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1063,10 +1138,9 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1076,29 +1150,33 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist if cls: return cls(pipeline_response, None, {}) - _reset_service_principal_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + _reset_service_principal_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore - - @distributed_trace_async - async def begin_reset_service_principal_profile( # pylint: disable=inconsistent-return-statements + @overload + async def begin_reset_service_principal_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterServicePrincipalProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: """Reset Service Principal Profile of a managed cluster. Update the service principal Profile for a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a - Managed Cluster. + Managed Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2020_12_01.models.ManagedClusterServicePrincipalProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -1109,20 +1187,90 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset Service Principal Profile of a managed cluster. + + Update the service principal Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a + Managed Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset Service Principal Profile of a managed cluster. + + Update the service principal Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a + Managed Cluster. Is either a model type or a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2020_12_01.models.ManagedClusterServicePrincipalProfile or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1130,67 +1278,68 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_service_principal_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + begin_reset_service_principal_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterAADProfile, + parameters: Union[_models.ManagedClusterAADProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterAADProfile") - request = build_reset_aad_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_aad_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_aad_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_aad_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1198,10 +1347,9 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1211,28 +1359,32 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta if cls: return cls(pipeline_response, None, {}) - _reset_aad_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - + _reset_aad_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - @distributed_trace_async - async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements + @overload + async def begin_reset_aad_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterAADProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: """Reset AAD Profile of a managed cluster. Update the AAD Profile for a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed - Cluster. + Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2020_12_01.models.ManagedClusterAADProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -1243,20 +1395,90 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset AAD Profile of a managed cluster. + + Update the AAD Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed + Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterAADProfile, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset AAD Profile of a managed cluster. + + Update the AAD Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed + Cluster. Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2020_12_01.models.ManagedClusterAADProfile or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1264,62 +1486,52 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_aad_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + begin_reset_aad_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_rotate_cluster_certificates_request_initial( - subscription_id=self._config.subscription_id, + request = build_rotate_cluster_certificates_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._rotate_cluster_certificates_initial.metadata['url'], + template_url=self._rotate_cluster_certificates_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1327,10 +1539,9 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1340,23 +1551,19 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- if cls: return cls(pipeline_response, None, {}) - _rotate_cluster_certificates_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore - + _rotate_cluster_certificates_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore @distributed_trace_async - async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + async def begin_rotate_cluster_certificates( + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Rotate certificates of a managed cluster. Rotate certificates of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1368,80 +1575,67 @@ async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-ret Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._rotate_cluster_certificates_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_rotate_cluster_certificates.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore + begin_rotate_cluster_certificates.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore async def _stop_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_stop_request_initial( - subscription_id=self._config.subscription_id, + request = build_stop_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._stop_initial.metadata['url'], + template_url=self._stop_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1449,10 +1643,9 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1462,23 +1655,17 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore - + _stop_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore @distributed_trace_async - async def begin_stop( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: + async def begin_stop(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Stop Managed Cluster. Stops a Running Managed Cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1490,80 +1677,67 @@ async def begin_stop( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._stop_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore + begin_stop.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore async def _start_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_start_request_initial( - subscription_id=self._config.subscription_id, + request = build_start_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._start_initial.metadata['url'], + template_url=self._start_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1571,10 +1745,9 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1584,23 +1757,17 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore - + _start_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore @distributed_trace_async - async def begin_start( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: + async def begin_start(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Start Managed Cluster. Starts a Stopped Managed Cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1612,52 +1779,45 @@ async def begin_start( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._start_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore + begin_start.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/aio/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/aio/operations/_operations.py index a7fc7fcd0629..3d1cdb9c4e6d 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/aio/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/aio/operations/_operations.py @@ -7,9 +7,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,9 +27,11 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._operations import build_list_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class Operations: """ .. warning:: @@ -42,36 +51,31 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.OperationListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.OperationValue"]: """Gets a list of compute operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationListResult or the result of cls(response) + :return: An iterator like instance of either OperationValue or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_12_01.models.OperationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_12_01.models.OperationValue] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -79,13 +83,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -101,10 +103,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -114,8 +114,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.ContainerService/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ContainerService/operations"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/aio/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/aio/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/aio/operations/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/aio/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/aio/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/aio/operations/_private_endpoint_connections_operations.py index 095e525d66a8..c0f0bd6215e4 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/aio/operations/_private_endpoint_connections_operations.py @@ -6,9 +6,15 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -20,10 +26,17 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._private_endpoint_connections_operations import build_delete_request_initial, build_get_request, build_list_request, build_update_request -T = TypeVar('T') +from ...operations._private_endpoint_connections_operations import ( + build_delete_request, + build_get_request, + build_list_request, + build_update_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class PrivateEndpointConnectionsOperations: """ .. warning:: @@ -43,46 +56,39 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async async def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnectionListResult: """Gets a list of private endpoint connections in the specified managed cluster. Gets a list of private endpoint connections in the specified managed cluster. The operation returns properties of each private endpoint connection. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnectionListResult, or the result of cls(response) + :return: PrivateEndpointConnectionListResult or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_12_01.models.PrivateEndpointConnectionListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnectionListResult] - request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -90,68 +96,59 @@ async def list( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore - + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore @distributed_trace_async async def get( - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnection: """Gets the private endpoint connection. Gets the details of the private endpoint connection by managed cluster and resource group. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_12_01.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -159,75 +156,149 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - - @distributed_trace_async + @overload async def update( self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, parameters: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateEndpointConnection: """Updates a private endpoint connection. Updates a private endpoint connection in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :param parameters: Parameters supplied to the Update a private endpoint connection operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2020_12_01.models.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_12_01.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + async def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: Parameters supplied to the Update a private endpoint connection operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2020_12_01.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: Union[_models.PrivateEndpointConnection, IO], + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: Parameters supplied to the Update a private endpoint connection operation. + Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2020_12_01.models.PrivateEndpointConnection or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2020_12_01.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - _json = self._serialize.body(parameters, 'PrivateEndpointConnection') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateEndpointConnection") request = build_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update.metadata['url'], + content=_content, + template_url=self.update.metadata["url"], headers=_headers, params=_params, ) @@ -235,52 +306,43 @@ async def update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -288,10 +350,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -301,26 +362,21 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + async def begin_delete( + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes a private endpoint connection. Deletes the private endpoint connection in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -332,53 +388,46 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/aio/operations/_private_link_resources_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/aio/operations/_private_link_resources_operations.py index 2c5a8f962f88..cbeb3d58e89c 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/aio/operations/_private_link_resources_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/aio/operations/_private_link_resources_operations.py @@ -8,7 +8,13 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -19,9 +25,11 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._private_link_resources_operations import build_list_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class PrivateLinkResourcesOperations: """ .. warning:: @@ -41,46 +49,39 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async async def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.PrivateLinkResourcesListResult: """Gets a list of private link resources in the specified managed cluster. Gets a list of private link resources in the specified managed cluster. The operation returns properties of each private link resource. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResourcesListResult, or the result of cls(response) + :return: PrivateLinkResourcesListResult or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_12_01.models.PrivateLinkResourcesListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResourcesListResult] - request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -88,22 +89,20 @@ async def list( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResourcesListResult', pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources"} # type: ignore - + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/aio/operations/_resolve_private_link_service_id_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/aio/operations/_resolve_private_link_service_id_operations.py index dfee2f6625b1..809fdad856d6 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/aio/operations/_resolve_private_link_service_id_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/aio/operations/_resolve_private_link_service_id_operations.py @@ -6,9 +6,15 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -19,9 +25,11 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._resolve_private_link_service_id_operations import build_post_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class ResolvePrivateLinkServiceIdOperations: """ .. warning:: @@ -41,53 +49,120 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async + @overload async def post( self, resource_group_name: str, resource_name: str, parameters: _models.PrivateLinkResource, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateLinkResource: """Gets the private link service ID for the specified managed cluster. Gets the private link service ID the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters (name, groupId) supplied in order to resolve a private link - service ID. + service ID. Required. :type parameters: ~azure.mgmt.containerservice.v2020_12_01.models.PrivateLinkResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2020_12_01.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def post( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters (name, groupId) supplied in order to resolve a private link + service ID. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResource, or the result of cls(response) + :return: PrivateLinkResource or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_12_01.models.PrivateLinkResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @distributed_trace_async + async def post( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.PrivateLinkResource, IO], + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters (name, groupId) supplied in order to resolve a private link + service ID. Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2020_12_01.models.PrivateLinkResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2020_12_01.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResource] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResource] - _json = self._serialize.body(parameters, 'PrivateLinkResource') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateLinkResource") request = build_post_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.post.metadata['url'], + content=_content, + template_url=self.post.metadata["url"], headers=_headers, params=_params, ) @@ -95,22 +170,20 @@ async def post( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResource', pipeline_response) + deserialized = self._deserialize("PrivateLinkResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - post.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId"} # type: ignore - + post.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/models/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/models/__init__.py index 2b519b694a35..71fbf2f7c08e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/models/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/models/__init__.py @@ -16,7 +16,9 @@ from ._models_py3 import CloudError from ._models_py3 import CloudErrorBody from ._models_py3 import Components1Q1Og48SchemasManagedclusterAllof1 -from ._models_py3 import Components1Umhcm8SchemasManagedclusteridentityPropertiesUserassignedidentitiesAdditionalproperties +from ._models_py3 import ( + Components1Umhcm8SchemasManagedclusteridentityPropertiesUserassignedidentitiesAdditionalproperties, +) from ._models_py3 import ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties from ._models_py3 import ContainerServiceDiagnosticsProfile from ._models_py3 import ContainerServiceLinuxProfile @@ -76,136 +78,134 @@ from ._models_py3 import TimeSpan from ._models_py3 import UserAssignedIdentity - -from ._container_service_client_enums import ( - AgentPoolMode, - AgentPoolType, - Code, - ConnectionStatus, - ContainerServiceStorageProfileTypes, - ContainerServiceVMSizeTypes, - Count, - CreatedByType, - Expander, - KubeletDiskType, - LicenseType, - LoadBalancerSku, - ManagedClusterPodIdentityProvisioningState, - ManagedClusterSKUName, - ManagedClusterSKUTier, - NetworkMode, - NetworkPlugin, - NetworkPolicy, - OSDiskType, - OSType, - OutboundType, - PrivateEndpointConnectionProvisioningState, - ResourceIdentityType, - ScaleSetEvictionPolicy, - ScaleSetPriority, - UpgradeChannel, - WeekDay, -) +from ._container_service_client_enums import AgentPoolMode +from ._container_service_client_enums import AgentPoolType +from ._container_service_client_enums import Code +from ._container_service_client_enums import ConnectionStatus +from ._container_service_client_enums import ContainerServiceStorageProfileTypes +from ._container_service_client_enums import ContainerServiceVMSizeTypes +from ._container_service_client_enums import Count +from ._container_service_client_enums import CreatedByType +from ._container_service_client_enums import Expander +from ._container_service_client_enums import KubeletDiskType +from ._container_service_client_enums import LicenseType +from ._container_service_client_enums import LoadBalancerSku +from ._container_service_client_enums import ManagedClusterPodIdentityProvisioningState +from ._container_service_client_enums import ManagedClusterSKUName +from ._container_service_client_enums import ManagedClusterSKUTier +from ._container_service_client_enums import NetworkMode +from ._container_service_client_enums import NetworkPlugin +from ._container_service_client_enums import NetworkPolicy +from ._container_service_client_enums import OSDiskType +from ._container_service_client_enums import OSType +from ._container_service_client_enums import OutboundType +from ._container_service_client_enums import PrivateEndpointConnectionProvisioningState +from ._container_service_client_enums import ResourceIdentityType +from ._container_service_client_enums import ScaleSetEvictionPolicy +from ._container_service_client_enums import ScaleSetPriority +from ._container_service_client_enums import UpgradeChannel +from ._container_service_client_enums import WeekDay from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'AgentPool', - 'AgentPoolAvailableVersions', - 'AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem', - 'AgentPoolListResult', - 'AgentPoolUpgradeProfile', - 'AgentPoolUpgradeProfilePropertiesUpgradesItem', - 'AgentPoolUpgradeSettings', - 'CloudError', - 'CloudErrorBody', - 'Components1Q1Og48SchemasManagedclusterAllof1', - 'Components1Umhcm8SchemasManagedclusteridentityPropertiesUserassignedidentitiesAdditionalproperties', - 'ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties', - 'ContainerServiceDiagnosticsProfile', - 'ContainerServiceLinuxProfile', - 'ContainerServiceMasterProfile', - 'ContainerServiceNetworkProfile', - 'ContainerServiceSshConfiguration', - 'ContainerServiceSshPublicKey', - 'ContainerServiceVMDiagnostics', - 'CredentialResult', - 'CredentialResults', - 'KubeletConfig', - 'LinuxOSConfig', - 'MaintenanceConfiguration', - 'MaintenanceConfigurationListResult', - 'ManagedCluster', - 'ManagedClusterAADProfile', - 'ManagedClusterAPIServerAccessProfile', - 'ManagedClusterAccessProfile', - 'ManagedClusterAddonProfile', - 'ManagedClusterAddonProfileIdentity', - 'ManagedClusterAgentPoolProfile', - 'ManagedClusterAgentPoolProfileProperties', - 'ManagedClusterAutoUpgradeProfile', - 'ManagedClusterIdentity', - 'ManagedClusterListResult', - 'ManagedClusterLoadBalancerProfile', - 'ManagedClusterLoadBalancerProfileManagedOutboundIPs', - 'ManagedClusterLoadBalancerProfileOutboundIPPrefixes', - 'ManagedClusterLoadBalancerProfileOutboundIPs', - 'ManagedClusterPodIdentity', - 'ManagedClusterPodIdentityException', - 'ManagedClusterPodIdentityProfile', - 'ManagedClusterPodIdentityProvisioningInfo', - 'ManagedClusterPoolUpgradeProfile', - 'ManagedClusterPoolUpgradeProfileUpgradesItem', - 'ManagedClusterPropertiesAutoScalerProfile', - 'ManagedClusterSKU', - 'ManagedClusterServicePrincipalProfile', - 'ManagedClusterUpgradeProfile', - 'ManagedClusterWindowsProfile', - 'OperationListResult', - 'OperationValue', - 'PowerState', - 'PrivateEndpoint', - 'PrivateEndpointConnection', - 'PrivateEndpointConnectionListResult', - 'PrivateLinkResource', - 'PrivateLinkResourcesListResult', - 'PrivateLinkServiceConnectionState', - 'Resource', - 'ResourceReference', - 'SubResource', - 'SysctlConfig', - 'SystemData', - 'TagsObject', - 'TimeInWeek', - 'TimeSpan', - 'UserAssignedIdentity', - 'AgentPoolMode', - 'AgentPoolType', - 'Code', - 'ConnectionStatus', - 'ContainerServiceStorageProfileTypes', - 'ContainerServiceVMSizeTypes', - 'Count', - 'CreatedByType', - 'Expander', - 'KubeletDiskType', - 'LicenseType', - 'LoadBalancerSku', - 'ManagedClusterPodIdentityProvisioningState', - 'ManagedClusterSKUName', - 'ManagedClusterSKUTier', - 'NetworkMode', - 'NetworkPlugin', - 'NetworkPolicy', - 'OSDiskType', - 'OSType', - 'OutboundType', - 'PrivateEndpointConnectionProvisioningState', - 'ResourceIdentityType', - 'ScaleSetEvictionPolicy', - 'ScaleSetPriority', - 'UpgradeChannel', - 'WeekDay', + "AgentPool", + "AgentPoolAvailableVersions", + "AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem", + "AgentPoolListResult", + "AgentPoolUpgradeProfile", + "AgentPoolUpgradeProfilePropertiesUpgradesItem", + "AgentPoolUpgradeSettings", + "CloudError", + "CloudErrorBody", + "Components1Q1Og48SchemasManagedclusterAllof1", + "Components1Umhcm8SchemasManagedclusteridentityPropertiesUserassignedidentitiesAdditionalproperties", + "ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties", + "ContainerServiceDiagnosticsProfile", + "ContainerServiceLinuxProfile", + "ContainerServiceMasterProfile", + "ContainerServiceNetworkProfile", + "ContainerServiceSshConfiguration", + "ContainerServiceSshPublicKey", + "ContainerServiceVMDiagnostics", + "CredentialResult", + "CredentialResults", + "KubeletConfig", + "LinuxOSConfig", + "MaintenanceConfiguration", + "MaintenanceConfigurationListResult", + "ManagedCluster", + "ManagedClusterAADProfile", + "ManagedClusterAPIServerAccessProfile", + "ManagedClusterAccessProfile", + "ManagedClusterAddonProfile", + "ManagedClusterAddonProfileIdentity", + "ManagedClusterAgentPoolProfile", + "ManagedClusterAgentPoolProfileProperties", + "ManagedClusterAutoUpgradeProfile", + "ManagedClusterIdentity", + "ManagedClusterListResult", + "ManagedClusterLoadBalancerProfile", + "ManagedClusterLoadBalancerProfileManagedOutboundIPs", + "ManagedClusterLoadBalancerProfileOutboundIPPrefixes", + "ManagedClusterLoadBalancerProfileOutboundIPs", + "ManagedClusterPodIdentity", + "ManagedClusterPodIdentityException", + "ManagedClusterPodIdentityProfile", + "ManagedClusterPodIdentityProvisioningInfo", + "ManagedClusterPoolUpgradeProfile", + "ManagedClusterPoolUpgradeProfileUpgradesItem", + "ManagedClusterPropertiesAutoScalerProfile", + "ManagedClusterSKU", + "ManagedClusterServicePrincipalProfile", + "ManagedClusterUpgradeProfile", + "ManagedClusterWindowsProfile", + "OperationListResult", + "OperationValue", + "PowerState", + "PrivateEndpoint", + "PrivateEndpointConnection", + "PrivateEndpointConnectionListResult", + "PrivateLinkResource", + "PrivateLinkResourcesListResult", + "PrivateLinkServiceConnectionState", + "Resource", + "ResourceReference", + "SubResource", + "SysctlConfig", + "SystemData", + "TagsObject", + "TimeInWeek", + "TimeSpan", + "UserAssignedIdentity", + "AgentPoolMode", + "AgentPoolType", + "Code", + "ConnectionStatus", + "ContainerServiceStorageProfileTypes", + "ContainerServiceVMSizeTypes", + "Count", + "CreatedByType", + "Expander", + "KubeletDiskType", + "LicenseType", + "LoadBalancerSku", + "ManagedClusterPodIdentityProvisioningState", + "ManagedClusterSKUName", + "ManagedClusterSKUTier", + "NetworkMode", + "NetworkPlugin", + "NetworkPolicy", + "OSDiskType", + "OSType", + "OutboundType", + "PrivateEndpointConnectionProvisioningState", + "ResourceIdentityType", + "ScaleSetEvictionPolicy", + "ScaleSetPriority", + "UpgradeChannel", + "WeekDay", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/models/_container_service_client_enums.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/models/_container_service_client_enums.py index 4e881844aa0f..a15ccabd6038 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/models/_container_service_client_enums.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/models/_container_service_client_enums.py @@ -11,35 +11,35 @@ class AgentPoolMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """AgentPoolMode represents mode of an agent pool. - """ + """AgentPoolMode represents mode of an agent pool.""" SYSTEM = "System" USER = "User" + class AgentPoolType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """AgentPoolType represents types of an agent pool. - """ + """AgentPoolType represents types of an agent pool.""" VIRTUAL_MACHINE_SCALE_SETS = "VirtualMachineScaleSets" AVAILABILITY_SET = "AvailabilitySet" + class Code(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Tells whether the cluster is Running or Stopped - """ + """Tells whether the cluster is Running or Stopped.""" RUNNING = "Running" STOPPED = "Stopped" + class ConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The private link service connection status. - """ + """The private link service connection status.""" PENDING = "Pending" APPROVED = "Approved" REJECTED = "Rejected" DISCONNECTED = "Disconnected" + class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the orchestrator choice. @@ -48,9 +48,9 @@ class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEn STORAGE_ACCOUNT = "StorageAccount" MANAGED_DISKS = "ManagedDisks" + class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Size of agent VMs. - """ + """Size of agent VMs.""" STANDARD_A1 = "Standard_A1" STANDARD_A10 = "Standard_A10" @@ -227,6 +227,7 @@ class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): STANDARD_NV24 = "Standard_NV24" STANDARD_NV6 = "Standard_NV6" + class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): """Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, and 5. The default value is 1. @@ -236,22 +237,25 @@ class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): THREE = 3 FIVE = 5 + class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of identity that created the resource. - """ + """The type of identity that created the resource.""" USER = "User" APPLICATION = "Application" MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" + class Expander(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Expander.""" LEAST_WASTE = "least-waste" MOST_PODS = "most-pods" PRIORITY = "priority" RANDOM = "random" + class KubeletDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """KubeletDiskType determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. Currently allows one value, OS, resulting in Kubelet using the OS @@ -260,6 +264,7 @@ class KubeletDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): OS = "OS" + class LicenseType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The licenseType to use for Windows VMs. Windows_Server is used to enable Azure Hybrid User Benefits for Windows VMs. @@ -268,86 +273,87 @@ class LicenseType(str, Enum, metaclass=CaseInsensitiveEnumMeta): NONE = "None" WINDOWS_SERVER = "Windows_Server" + class LoadBalancerSku(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The load balancer sku for the managed cluster. - """ + """The load balancer sku for the managed cluster.""" STANDARD = "standard" BASIC = "basic" + class ManagedClusterPodIdentityProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The current provisioning state of the pod identity. - """ + """The current provisioning state of the pod identity.""" ASSIGNED = "Assigned" UPDATING = "Updating" DELETING = "Deleting" FAILED = "Failed" + class ManagedClusterSKUName(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Name of a managed cluster SKU. - """ + """Name of a managed cluster SKU.""" BASIC = "Basic" + class ManagedClusterSKUTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Tier of a managed cluster SKU. - """ + """Tier of a managed cluster SKU.""" PAID = "Paid" FREE = "Free" + class NetworkMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Network mode used for building Kubernetes network. - """ + """Network mode used for building Kubernetes network.""" TRANSPARENT = "transparent" BRIDGE = "bridge" + class NetworkPlugin(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Network plugin used for building Kubernetes network. - """ + """Network plugin used for building Kubernetes network.""" AZURE = "azure" KUBENET = "kubenet" + class NetworkPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Network policy used for building Kubernetes network. - """ + """Network policy used for building Kubernetes network.""" CALICO = "calico" AZURE = "azure" + class OSDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """OSDiskType represents the type of an OS disk on an agent pool. - """ + """OSDiskType represents the type of an OS disk on an agent pool.""" MANAGED = "Managed" EPHEMERAL = "Ephemeral" + class OSType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """OsType to be used to specify os type. Choose from Linux and Windows. Default to Linux. - """ + """OsType to be used to specify os type. Choose from Linux and Windows. Default to Linux.""" LINUX = "Linux" WINDOWS = "Windows" + class OutboundType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The outbound (egress) routing method. - """ + """The outbound (egress) routing method.""" LOAD_BALANCER = "loadBalancer" USER_DEFINED_ROUTING = "userDefinedRouting" + class PrivateEndpointConnectionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The current provisioning state. - """ + """The current provisioning state.""" SUCCEEDED = "Succeeded" CREATING = "Creating" DELETING = "Deleting" FAILED = "Failed" + class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of identity used for the managed cluster. Type 'SystemAssigned' will use an implicitly created identity in master components and an auto-created user assigned identity in MC_ @@ -359,6 +365,7 @@ class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): USER_ASSIGNED = "UserAssigned" NONE = "None" + class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ScaleSetEvictionPolicy to be used to specify eviction policy for Spot virtual machine scale set. Default to Delete. @@ -367,25 +374,25 @@ class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): DELETE = "Delete" DEALLOCATE = "Deallocate" + class ScaleSetPriority(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """ScaleSetPriority to be used to specify virtual machine scale set priority. Default to regular. - """ + """ScaleSetPriority to be used to specify virtual machine scale set priority. Default to regular.""" SPOT = "Spot" REGULAR = "Regular" + class UpgradeChannel(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """upgrade channel for auto upgrade. - """ + """upgrade channel for auto upgrade.""" RAPID = "rapid" STABLE = "stable" PATCH = "patch" NONE = "none" + class WeekDay(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The weekday enum. - """ + """The weekday enum.""" SUNDAY = "Sunday" MONDAY = "Monday" diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/models/_models_py3.py index 975b312a106b..0f1a788d5493 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/models/_models_py3.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/models/_models_py3.py @@ -1,4 +1,5 @@ # coding=utf-8 +# pylint: disable=too-many-lines # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -9,14 +10,14 @@ import datetime from typing import Dict, List, Optional, TYPE_CHECKING, Union -import msrest.serialization +from ... import _serialization if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - import __init__ as _models + from .. import models as _models -class SubResource(msrest.serialization.Model): +class SubResource(_serialization.Model): """Reference to another subresource. Variables are only populated by the server, and will be ignored when sending a request. @@ -31,30 +32,26 @@ class SubResource(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(SubResource, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.id = None self.name = None self.type = None -class AgentPool(SubResource): +class AgentPool(SubResource): # pylint: disable=too-many-instance-attributes """Agent Pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -107,7 +104,7 @@ class AgentPool(SubResource): "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :vartype vm_size: str or ~azure.mgmt.containerservice.v2020_12_01.models.ContainerServiceVMSizeTypes :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine @@ -117,11 +114,11 @@ class AgentPool(SubResource): :ivar os_disk_type: OS disk type to be used for machines in a given agent pool. Allowed values are 'Ephemeral' and 'Managed'. If unspecified, defaults to 'Ephemeral' when the VM supports ephemeral OS and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults - to 'Managed'. May not be changed after creation. Known values are: "Managed", "Ephemeral". + to 'Managed'. May not be changed after creation. Known values are: "Managed" and "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2020_12_01.models.OSDiskType :ivar kubelet_disk_type: KubeletDiskType determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. Currently allows one value, OS, - resulting in Kubelet using the OS disk for data. Known values are: "OS". + resulting in Kubelet using the OS disk for data. "OS" :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2020_12_01.models.KubeletDiskType :ivar vnet_subnet_id: VNet SubnetID specifies the VNet's subnet identifier for nodes and maybe @@ -132,7 +129,7 @@ class AgentPool(SubResource): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Known values are: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux" and "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2020_12_01.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -141,10 +138,11 @@ class AgentPool(SubResource): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar type_properties_type: AgentPoolType represents types of an agent pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :vartype type_properties_type: str or ~azure.mgmt.containerservice.v2020_12_01.models.AgentPoolType - :ivar mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", "User". + :ivar mode: AgentPoolMode represents mode of an agent pool. Known values are: "System" and + "User". :vartype mode: str or ~azure.mgmt.containerservice.v2020_12_01.models.AgentPoolMode :ivar orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -165,20 +163,19 @@ class AgentPool(SubResource): :ivar enable_node_public_ip: Enable public IP for nodes. :vartype enable_node_public_ip: bool :ivar scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Known values are: "Spot", "Regular". Default value: "Regular". + priority. Default to regular. Known values are: "Spot" and "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_12_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy - for Spot virtual machine scale set. Default to Delete. Known values are: "Delete", - "Deallocate". Default value: "Delete". + for Spot virtual machine scale set. Default to Delete. Known values are: "Delete" and + "Deallocate". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_12_01.models.ScaleSetEvictionPolicy :ivar spot_max_price: SpotMaxPrice to be used to specify the maximum price you are willing to pay in US Dollars. Possible values are any decimal value greater than zero or -1 which indicates default price to be up-to on-demand. :vartype spot_max_price: float - :ivar tags: A set of tags. Agent pool tags to be persisted on the agent pool virtual machine - scale set. + :ivar tags: Agent pool tags to be persisted on the agent pool virtual machine scale set. :vartype tags: dict[str, str] :ivar node_labels: Agent pool node labels to be persisted across all nodes in agent pool. :vartype node_labels: dict[str, str] @@ -196,53 +193,53 @@ class AgentPool(SubResource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'os_disk_size_gb': {'maximum': 1023, 'minimum': 0}, - 'node_image_version': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'power_state': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "os_disk_size_gb": {"maximum": 1023, "minimum": 0}, + "node_image_version": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "power_state": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'count': {'key': 'properties.count', 'type': 'int'}, - 'vm_size': {'key': 'properties.vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'properties.osDiskSizeGB', 'type': 'int'}, - 'os_disk_type': {'key': 'properties.osDiskType', 'type': 'str'}, - 'kubelet_disk_type': {'key': 'properties.kubeletDiskType', 'type': 'str'}, - 'vnet_subnet_id': {'key': 'properties.vnetSubnetID', 'type': 'str'}, - 'pod_subnet_id': {'key': 'properties.podSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'properties.maxPods', 'type': 'int'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'max_count': {'key': 'properties.maxCount', 'type': 'int'}, - 'min_count': {'key': 'properties.minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'properties.enableAutoScaling', 'type': 'bool'}, - 'type_properties_type': {'key': 'properties.type', 'type': 'str'}, - 'mode': {'key': 'properties.mode', 'type': 'str'}, - 'orchestrator_version': {'key': 'properties.orchestratorVersion', 'type': 'str'}, - 'node_image_version': {'key': 'properties.nodeImageVersion', 'type': 'str'}, - 'upgrade_settings': {'key': 'properties.upgradeSettings', 'type': 'AgentPoolUpgradeSettings'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'power_state': {'key': 'properties.powerState', 'type': 'PowerState'}, - 'availability_zones': {'key': 'properties.availabilityZones', 'type': '[str]'}, - 'enable_node_public_ip': {'key': 'properties.enableNodePublicIP', 'type': 'bool'}, - 'scale_set_priority': {'key': 'properties.scaleSetPriority', 'type': 'str'}, - 'scale_set_eviction_policy': {'key': 'properties.scaleSetEvictionPolicy', 'type': 'str'}, - 'spot_max_price': {'key': 'properties.spotMaxPrice', 'type': 'float'}, - 'tags': {'key': 'properties.tags', 'type': '{str}'}, - 'node_labels': {'key': 'properties.nodeLabels', 'type': '{str}'}, - 'node_taints': {'key': 'properties.nodeTaints', 'type': '[str]'}, - 'proximity_placement_group_id': {'key': 'properties.proximityPlacementGroupID', 'type': 'str'}, - 'kubelet_config': {'key': 'properties.kubeletConfig', 'type': 'KubeletConfig'}, - 'linux_os_config': {'key': 'properties.linuxOSConfig', 'type': 'LinuxOSConfig'}, - 'enable_encryption_at_host': {'key': 'properties.enableEncryptionAtHost', 'type': 'bool'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "count": {"key": "properties.count", "type": "int"}, + "vm_size": {"key": "properties.vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "properties.osDiskSizeGB", "type": "int"}, + "os_disk_type": {"key": "properties.osDiskType", "type": "str"}, + "kubelet_disk_type": {"key": "properties.kubeletDiskType", "type": "str"}, + "vnet_subnet_id": {"key": "properties.vnetSubnetID", "type": "str"}, + "pod_subnet_id": {"key": "properties.podSubnetID", "type": "str"}, + "max_pods": {"key": "properties.maxPods", "type": "int"}, + "os_type": {"key": "properties.osType", "type": "str"}, + "max_count": {"key": "properties.maxCount", "type": "int"}, + "min_count": {"key": "properties.minCount", "type": "int"}, + "enable_auto_scaling": {"key": "properties.enableAutoScaling", "type": "bool"}, + "type_properties_type": {"key": "properties.type", "type": "str"}, + "mode": {"key": "properties.mode", "type": "str"}, + "orchestrator_version": {"key": "properties.orchestratorVersion", "type": "str"}, + "node_image_version": {"key": "properties.nodeImageVersion", "type": "str"}, + "upgrade_settings": {"key": "properties.upgradeSettings", "type": "AgentPoolUpgradeSettings"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "power_state": {"key": "properties.powerState", "type": "PowerState"}, + "availability_zones": {"key": "properties.availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "properties.enableNodePublicIP", "type": "bool"}, + "scale_set_priority": {"key": "properties.scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "properties.scaleSetEvictionPolicy", "type": "str"}, + "spot_max_price": {"key": "properties.spotMaxPrice", "type": "float"}, + "tags": {"key": "properties.tags", "type": "{str}"}, + "node_labels": {"key": "properties.nodeLabels", "type": "{str}"}, + "node_taints": {"key": "properties.nodeTaints", "type": "[str]"}, + "proximity_placement_group_id": {"key": "properties.proximityPlacementGroupID", "type": "str"}, + "kubelet_config": {"key": "properties.kubeletConfig", "type": "KubeletConfig"}, + "linux_os_config": {"key": "properties.linuxOSConfig", "type": "LinuxOSConfig"}, + "enable_encryption_at_host": {"key": "properties.enableEncryptionAtHost", "type": "bool"}, } - def __init__( + def __init__( # pylint: disable=too-many-locals self, *, count: Optional[int] = None, @@ -253,7 +250,7 @@ def __init__( vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, @@ -263,9 +260,9 @@ def __init__( upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, - scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", - spot_max_price: Optional[float] = -1, + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", + spot_max_price: float = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, @@ -317,7 +314,7 @@ def __init__( "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :paramtype vm_size: str or ~azure.mgmt.containerservice.v2020_12_01.models.ContainerServiceVMSizeTypes :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every @@ -327,12 +324,12 @@ def __init__( :keyword os_disk_type: OS disk type to be used for machines in a given agent pool. Allowed values are 'Ephemeral' and 'Managed'. If unspecified, defaults to 'Ephemeral' when the VM supports ephemeral OS and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, - defaults to 'Managed'. May not be changed after creation. Known values are: "Managed", + defaults to 'Managed'. May not be changed after creation. Known values are: "Managed" and "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2020_12_01.models.OSDiskType :keyword kubelet_disk_type: KubeletDiskType determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. Currently allows one value, OS, - resulting in Kubelet using the OS disk for data. Known values are: "OS". + resulting in Kubelet using the OS disk for data. "OS" :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2020_12_01.models.KubeletDiskType :keyword vnet_subnet_id: VNet SubnetID specifies the VNet's subnet identifier for nodes and @@ -343,7 +340,7 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux" and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2020_12_01.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -352,10 +349,10 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword type_properties_type: AgentPoolType represents types of an agent pool. Known values - are: "VirtualMachineScaleSets", "AvailabilitySet". + are: "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type_properties_type: str or ~azure.mgmt.containerservice.v2020_12_01.models.AgentPoolType - :keyword mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", + :keyword mode: AgentPoolMode represents mode of an agent pool. Known values are: "System" and "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2020_12_01.models.AgentPoolMode :keyword orchestrator_version: Version of orchestrator specified when creating the managed @@ -370,20 +367,19 @@ def __init__( :keyword enable_node_public_ip: Enable public IP for nodes. :paramtype enable_node_public_ip: bool :keyword scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Known values are: "Spot", "Regular". Default value: "Regular". + priority. Default to regular. Known values are: "Spot" and "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_12_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction - policy for Spot virtual machine scale set. Default to Delete. Known values are: "Delete", - "Deallocate". Default value: "Delete". + policy for Spot virtual machine scale set. Default to Delete. Known values are: "Delete" and + "Deallocate". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_12_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: SpotMaxPrice to be used to specify the maximum price you are willing to pay in US Dollars. Possible values are any decimal value greater than zero or -1 which indicates default price to be up-to on-demand. :paramtype spot_max_price: float - :keyword tags: A set of tags. Agent pool tags to be persisted on the agent pool virtual machine - scale set. + :keyword tags: Agent pool tags to be persisted on the agent pool virtual machine scale set. :paramtype tags: dict[str, str] :keyword node_labels: Agent pool node labels to be persisted across all nodes in agent pool. :paramtype node_labels: dict[str, str] @@ -399,7 +395,7 @@ def __init__( :keyword enable_encryption_at_host: Whether to enable EncryptionAtHost. :paramtype enable_encryption_at_host: bool """ - super(AgentPool, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.vm_size = vm_size self.os_disk_size_gb = os_disk_size_gb @@ -433,7 +429,7 @@ def __init__( self.enable_encryption_at_host = enable_encryption_at_host -class AgentPoolAvailableVersions(msrest.serialization.Model): +class AgentPoolAvailableVersions(_serialization.Model): """The list of available versions for an agent pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -450,16 +446,19 @@ class AgentPoolAvailableVersions(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'agent_pool_versions': {'key': 'properties.agentPoolVersions', 'type': '[AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "agent_pool_versions": { + "key": "properties.agentPoolVersions", + "type": "[AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem]", + }, } def __init__( @@ -473,14 +472,14 @@ def __init__( :paramtype agent_pool_versions: list[~azure.mgmt.containerservice.v2020_12_01.models.AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem] """ - super(AgentPoolAvailableVersions, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None self.agent_pool_versions = agent_pool_versions -class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(msrest.serialization.Model): +class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(_serialization.Model): """AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem. :ivar default: Whether this version is the default agent pool version. @@ -492,9 +491,9 @@ class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(msrest.serializa """ _attribute_map = { - 'default': {'key': 'default', 'type': 'bool'}, - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "default": {"key": "default", "type": "bool"}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } def __init__( @@ -513,13 +512,13 @@ def __init__( :keyword is_preview: Whether Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.default = default self.kubernetes_version = kubernetes_version self.is_preview = is_preview -class AgentPoolListResult(msrest.serialization.Model): +class AgentPoolListResult(_serialization.Model): """The response from the List Agent Pools operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -531,30 +530,25 @@ class AgentPoolListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[AgentPool]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[AgentPool]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.AgentPool"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.AgentPool"]] = None, **kwargs): """ :keyword value: The list of agent pools. :paramtype value: list[~azure.mgmt.containerservice.v2020_12_01.models.AgentPool] """ - super(AgentPoolListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class AgentPoolUpgradeProfile(msrest.serialization.Model): +class AgentPoolUpgradeProfile(_serialization.Model): """The list of available upgrades for an agent pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -567,10 +561,10 @@ class AgentPoolUpgradeProfile(msrest.serialization.Model): :vartype name: str :ivar type: Type of the agent pool upgrade profile. :vartype type: str - :ivar kubernetes_version: Required. Kubernetes version (major, minor, patch). + :ivar kubernetes_version: Kubernetes version (major, minor, patch). Required. :vartype kubernetes_version: str - :ivar os_type: Required. OsType to be used to specify os type. Choose from Linux and Windows. - Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to + Linux. Known values are: "Linux" and "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2020_12_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -581,21 +575,21 @@ class AgentPoolUpgradeProfile(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kubernetes_version': {'required': True}, - 'os_type': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "kubernetes_version": {"required": True}, + "os_type": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'kubernetes_version': {'key': 'properties.kubernetesVersion', 'type': 'str'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'upgrades': {'key': 'properties.upgrades', 'type': '[AgentPoolUpgradeProfilePropertiesUpgradesItem]'}, - 'latest_node_image_version': {'key': 'properties.latestNodeImageVersion', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "os_type": {"key": "properties.osType", "type": "str"}, + "upgrades": {"key": "properties.upgrades", "type": "[AgentPoolUpgradeProfilePropertiesUpgradesItem]"}, + "latest_node_image_version": {"key": "properties.latestNodeImageVersion", "type": "str"}, } def __init__( @@ -608,10 +602,10 @@ def __init__( **kwargs ): """ - :keyword kubernetes_version: Required. Kubernetes version (major, minor, patch). + :keyword kubernetes_version: Kubernetes version (major, minor, patch). Required. :paramtype kubernetes_version: str - :keyword os_type: Required. OsType to be used to specify os type. Choose from Linux and - Windows. Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default + to Linux. Known values are: "Linux" and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2020_12_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: @@ -620,7 +614,7 @@ def __init__( image version. :paramtype latest_node_image_version: str """ - super(AgentPoolUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -630,7 +624,7 @@ def __init__( self.latest_node_image_version = latest_node_image_version -class AgentPoolUpgradeProfilePropertiesUpgradesItem(msrest.serialization.Model): +class AgentPoolUpgradeProfilePropertiesUpgradesItem(_serialization.Model): """AgentPoolUpgradeProfilePropertiesUpgradesItem. :ivar kubernetes_version: Kubernetes version (major, minor, patch). @@ -640,29 +634,23 @@ class AgentPoolUpgradeProfilePropertiesUpgradesItem(msrest.serialization.Model): """ _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } - def __init__( - self, - *, - kubernetes_version: Optional[str] = None, - is_preview: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, kubernetes_version: Optional[str] = None, is_preview: Optional[bool] = None, **kwargs): """ :keyword kubernetes_version: Kubernetes version (major, minor, patch). :paramtype kubernetes_version: str :keyword is_preview: Whether Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(AgentPoolUpgradeProfilePropertiesUpgradesItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.is_preview = is_preview -class AgentPoolUpgradeSettings(msrest.serialization.Model): +class AgentPoolUpgradeSettings(_serialization.Model): """Settings for upgrading an agentpool. :ivar max_surge: Count or percentage of additional nodes to be added during upgrade. If empty @@ -671,25 +659,20 @@ class AgentPoolUpgradeSettings(msrest.serialization.Model): """ _attribute_map = { - 'max_surge': {'key': 'maxSurge', 'type': 'str'}, + "max_surge": {"key": "maxSurge", "type": "str"}, } - def __init__( - self, - *, - max_surge: Optional[str] = None, - **kwargs - ): + def __init__(self, *, max_surge: Optional[str] = None, **kwargs): """ :keyword max_surge: Count or percentage of additional nodes to be added during upgrade. If empty uses AKS default. :paramtype max_surge: str """ - super(AgentPoolUpgradeSettings, self).__init__(**kwargs) + super().__init__(**kwargs) self.max_surge = max_surge -class CloudError(msrest.serialization.Model): +class CloudError(_serialization.Model): """An error response from the Container service. :ivar error: Details about the error. @@ -697,24 +680,19 @@ class CloudError(msrest.serialization.Model): """ _attribute_map = { - 'error': {'key': 'error', 'type': 'CloudErrorBody'}, + "error": {"key": "error", "type": "CloudErrorBody"}, } - def __init__( - self, - *, - error: Optional["_models.CloudErrorBody"] = None, - **kwargs - ): + def __init__(self, *, error: Optional["_models.CloudErrorBody"] = None, **kwargs): """ :keyword error: Details about the error. :paramtype error: ~azure.mgmt.containerservice.v2020_12_01.models.CloudErrorBody """ - super(CloudError, self).__init__(**kwargs) + super().__init__(**kwargs) self.error = error -class CloudErrorBody(msrest.serialization.Model): +class CloudErrorBody(_serialization.Model): """An error response from the Container service. :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed @@ -731,10 +709,10 @@ class CloudErrorBody(msrest.serialization.Model): """ _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[CloudErrorBody]"}, } def __init__( @@ -759,14 +737,16 @@ def __init__( :keyword details: A list of additional details about the error. :paramtype details: list[~azure.mgmt.containerservice.v2020_12_01.models.CloudErrorBody] """ - super(CloudErrorBody, self).__init__(**kwargs) + super().__init__(**kwargs) self.code = code self.message = message self.target = target self.details = details -class Components1Q1Og48SchemasManagedclusterAllof1(msrest.serialization.Model): +class Components1Q1Og48SchemasManagedclusterAllof1( + _serialization.Model +): # pylint: disable=too-many-instance-attributes """Components1Q1Og48SchemasManagedclusterAllof1. Variables are only populated by the server, and will be ignored when sending a request. @@ -838,41 +818,53 @@ class Components1Q1Og48SchemasManagedclusterAllof1(msrest.serialization.Model): """ _validation = { - 'provisioning_state': {'readonly': True}, - 'power_state': {'readonly': True}, - 'max_agent_pools': {'readonly': True}, - 'fqdn': {'readonly': True}, - 'private_fqdn': {'readonly': True}, + "provisioning_state": {"readonly": True}, + "power_state": {"readonly": True}, + "max_agent_pools": {"readonly": True}, + "fqdn": {"readonly": True}, + "private_fqdn": {"readonly": True}, } _attribute_map = { - 'identity': {'key': 'identity', 'type': 'ManagedClusterIdentity'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'power_state': {'key': 'properties.powerState', 'type': 'PowerState'}, - 'max_agent_pools': {'key': 'properties.maxAgentPools', 'type': 'int'}, - 'kubernetes_version': {'key': 'properties.kubernetesVersion', 'type': 'str'}, - 'dns_prefix': {'key': 'properties.dnsPrefix', 'type': 'str'}, - 'fqdn': {'key': 'properties.fqdn', 'type': 'str'}, - 'private_fqdn': {'key': 'properties.privateFQDN', 'type': 'str'}, - 'agent_pool_profiles': {'key': 'properties.agentPoolProfiles', 'type': '[ManagedClusterAgentPoolProfile]'}, - 'linux_profile': {'key': 'properties.linuxProfile', 'type': 'ContainerServiceLinuxProfile'}, - 'windows_profile': {'key': 'properties.windowsProfile', 'type': 'ManagedClusterWindowsProfile'}, - 'service_principal_profile': {'key': 'properties.servicePrincipalProfile', 'type': 'ManagedClusterServicePrincipalProfile'}, - 'addon_profiles': {'key': 'properties.addonProfiles', 'type': '{ManagedClusterAddonProfile}'}, - 'pod_identity_profile': {'key': 'properties.podIdentityProfile', 'type': 'ManagedClusterPodIdentityProfile'}, - 'node_resource_group': {'key': 'properties.nodeResourceGroup', 'type': 'str'}, - 'enable_rbac': {'key': 'properties.enableRBAC', 'type': 'bool'}, - 'enable_pod_security_policy': {'key': 'properties.enablePodSecurityPolicy', 'type': 'bool'}, - 'network_profile': {'key': 'properties.networkProfile', 'type': 'ContainerServiceNetworkProfile'}, - 'aad_profile': {'key': 'properties.aadProfile', 'type': 'ManagedClusterAADProfile'}, - 'auto_upgrade_profile': {'key': 'properties.autoUpgradeProfile', 'type': 'ManagedClusterAutoUpgradeProfile'}, - 'auto_scaler_profile': {'key': 'properties.autoScalerProfile', 'type': 'ManagedClusterPropertiesAutoScalerProfile'}, - 'api_server_access_profile': {'key': 'properties.apiServerAccessProfile', 'type': 'ManagedClusterAPIServerAccessProfile'}, - 'disk_encryption_set_id': {'key': 'properties.diskEncryptionSetID', 'type': 'str'}, - 'identity_profile': {'key': 'properties.identityProfile', 'type': '{ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties}'}, + "identity": {"key": "identity", "type": "ManagedClusterIdentity"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "power_state": {"key": "properties.powerState", "type": "PowerState"}, + "max_agent_pools": {"key": "properties.maxAgentPools", "type": "int"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "dns_prefix": {"key": "properties.dnsPrefix", "type": "str"}, + "fqdn": {"key": "properties.fqdn", "type": "str"}, + "private_fqdn": {"key": "properties.privateFQDN", "type": "str"}, + "agent_pool_profiles": {"key": "properties.agentPoolProfiles", "type": "[ManagedClusterAgentPoolProfile]"}, + "linux_profile": {"key": "properties.linuxProfile", "type": "ContainerServiceLinuxProfile"}, + "windows_profile": {"key": "properties.windowsProfile", "type": "ManagedClusterWindowsProfile"}, + "service_principal_profile": { + "key": "properties.servicePrincipalProfile", + "type": "ManagedClusterServicePrincipalProfile", + }, + "addon_profiles": {"key": "properties.addonProfiles", "type": "{ManagedClusterAddonProfile}"}, + "pod_identity_profile": {"key": "properties.podIdentityProfile", "type": "ManagedClusterPodIdentityProfile"}, + "node_resource_group": {"key": "properties.nodeResourceGroup", "type": "str"}, + "enable_rbac": {"key": "properties.enableRBAC", "type": "bool"}, + "enable_pod_security_policy": {"key": "properties.enablePodSecurityPolicy", "type": "bool"}, + "network_profile": {"key": "properties.networkProfile", "type": "ContainerServiceNetworkProfile"}, + "aad_profile": {"key": "properties.aadProfile", "type": "ManagedClusterAADProfile"}, + "auto_upgrade_profile": {"key": "properties.autoUpgradeProfile", "type": "ManagedClusterAutoUpgradeProfile"}, + "auto_scaler_profile": { + "key": "properties.autoScalerProfile", + "type": "ManagedClusterPropertiesAutoScalerProfile", + }, + "api_server_access_profile": { + "key": "properties.apiServerAccessProfile", + "type": "ManagedClusterAPIServerAccessProfile", + }, + "disk_encryption_set_id": {"key": "properties.diskEncryptionSetID", "type": "str"}, + "identity_profile": { + "key": "properties.identityProfile", + "type": "{ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties}", + }, } - def __init__( + def __init__( # pylint: disable=too-many-locals self, *, identity: Optional["_models.ManagedClusterIdentity"] = None, @@ -893,7 +885,12 @@ def __init__( auto_scaler_profile: Optional["_models.ManagedClusterPropertiesAutoScalerProfile"] = None, api_server_access_profile: Optional["_models.ManagedClusterAPIServerAccessProfile"] = None, disk_encryption_set_id: Optional[str] = None, - identity_profile: Optional[Dict[str, "_models.ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties"]] = None, + identity_profile: Optional[ + Dict[ + str, + "_models.ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties", + ] + ] = None, **kwargs ): """ @@ -952,7 +949,7 @@ def __init__( :paramtype identity_profile: dict[str, ~azure.mgmt.containerservice.v2020_12_01.models.ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties] """ - super(Components1Q1Og48SchemasManagedclusterAllof1, self).__init__(**kwargs) + super().__init__(**kwargs) self.identity = identity self.provisioning_state = None self.power_state = None @@ -979,7 +976,9 @@ def __init__( self.identity_profile = identity_profile -class Components1Umhcm8SchemasManagedclusteridentityPropertiesUserassignedidentitiesAdditionalproperties(msrest.serialization.Model): +class Components1Umhcm8SchemasManagedclusteridentityPropertiesUserassignedidentitiesAdditionalproperties( + _serialization.Model +): """Components1Umhcm8SchemasManagedclusteridentityPropertiesUserassignedidentitiesAdditionalproperties. Variables are only populated by the server, and will be ignored when sending a request. @@ -991,27 +990,23 @@ class Components1Umhcm8SchemasManagedclusteridentityPropertiesUserassignedidenti """ _validation = { - 'principal_id': {'readonly': True}, - 'client_id': {'readonly': True}, + "principal_id": {"readonly": True}, + "client_id": {"readonly": True}, } _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, + "principal_id": {"key": "principalId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(Components1Umhcm8SchemasManagedclusteridentityPropertiesUserassignedidentitiesAdditionalproperties, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.principal_id = None self.client_id = None -class UserAssignedIdentity(msrest.serialization.Model): +class UserAssignedIdentity(_serialization.Model): """UserAssignedIdentity. :ivar resource_id: The resource id of the user assigned identity. @@ -1023,9 +1018,9 @@ class UserAssignedIdentity(msrest.serialization.Model): """ _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'object_id': {'key': 'objectId', 'type': 'str'}, + "resource_id": {"key": "resourceId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + "object_id": {"key": "objectId", "type": "str"}, } def __init__( @@ -1044,13 +1039,15 @@ def __init__( :keyword object_id: The object id of the user assigned identity. :paramtype object_id: str """ - super(UserAssignedIdentity, self).__init__(**kwargs) + super().__init__(**kwargs) self.resource_id = resource_id self.client_id = client_id self.object_id = object_id -class ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties(UserAssignedIdentity): +class ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties( + UserAssignedIdentity +): """ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties. :ivar resource_id: The resource id of the user assigned identity. @@ -1062,9 +1059,9 @@ class ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAd """ _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'object_id': {'key': 'objectId', 'type': 'str'}, + "resource_id": {"key": "resourceId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + "object_id": {"key": "objectId", "type": "str"}, } def __init__( @@ -1083,83 +1080,72 @@ def __init__( :keyword object_id: The object id of the user assigned identity. :paramtype object_id: str """ - super(ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties, self).__init__(resource_id=resource_id, client_id=client_id, object_id=object_id, **kwargs) + super().__init__(resource_id=resource_id, client_id=client_id, object_id=object_id, **kwargs) -class ContainerServiceDiagnosticsProfile(msrest.serialization.Model): +class ContainerServiceDiagnosticsProfile(_serialization.Model): """Profile for diagnostics on the container service cluster. All required parameters must be populated in order to send to Azure. - :ivar vm_diagnostics: Required. Profile for diagnostics on the container service VMs. + :ivar vm_diagnostics: Profile for diagnostics on the container service VMs. Required. :vartype vm_diagnostics: ~azure.mgmt.containerservice.v2020_12_01.models.ContainerServiceVMDiagnostics """ _validation = { - 'vm_diagnostics': {'required': True}, + "vm_diagnostics": {"required": True}, } _attribute_map = { - 'vm_diagnostics': {'key': 'vmDiagnostics', 'type': 'ContainerServiceVMDiagnostics'}, + "vm_diagnostics": {"key": "vmDiagnostics", "type": "ContainerServiceVMDiagnostics"}, } - def __init__( - self, - *, - vm_diagnostics: "_models.ContainerServiceVMDiagnostics", - **kwargs - ): + def __init__(self, *, vm_diagnostics: "_models.ContainerServiceVMDiagnostics", **kwargs): """ - :keyword vm_diagnostics: Required. Profile for diagnostics on the container service VMs. + :keyword vm_diagnostics: Profile for diagnostics on the container service VMs. Required. :paramtype vm_diagnostics: ~azure.mgmt.containerservice.v2020_12_01.models.ContainerServiceVMDiagnostics """ - super(ContainerServiceDiagnosticsProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.vm_diagnostics = vm_diagnostics -class ContainerServiceLinuxProfile(msrest.serialization.Model): +class ContainerServiceLinuxProfile(_serialization.Model): """Profile for Linux VMs in the container service cluster. All required parameters must be populated in order to send to Azure. - :ivar admin_username: Required. The administrator username to use for Linux VMs. + :ivar admin_username: The administrator username to use for Linux VMs. Required. :vartype admin_username: str - :ivar ssh: Required. SSH configuration for Linux-based VMs running on Azure. + :ivar ssh: SSH configuration for Linux-based VMs running on Azure. Required. :vartype ssh: ~azure.mgmt.containerservice.v2020_12_01.models.ContainerServiceSshConfiguration """ _validation = { - 'admin_username': {'required': True, 'pattern': r'^[A-Za-z][-A-Za-z0-9_]*$'}, - 'ssh': {'required': True}, + "admin_username": {"required": True, "pattern": r"^[A-Za-z][-A-Za-z0-9_]*$"}, + "ssh": {"required": True}, } _attribute_map = { - 'admin_username': {'key': 'adminUsername', 'type': 'str'}, - 'ssh': {'key': 'ssh', 'type': 'ContainerServiceSshConfiguration'}, + "admin_username": {"key": "adminUsername", "type": "str"}, + "ssh": {"key": "ssh", "type": "ContainerServiceSshConfiguration"}, } - def __init__( - self, - *, - admin_username: str, - ssh: "_models.ContainerServiceSshConfiguration", - **kwargs - ): + def __init__(self, *, admin_username: str, ssh: "_models.ContainerServiceSshConfiguration", **kwargs): """ - :keyword admin_username: Required. The administrator username to use for Linux VMs. + :keyword admin_username: The administrator username to use for Linux VMs. Required. :paramtype admin_username: str - :keyword ssh: Required. SSH configuration for Linux-based VMs running on Azure. + :keyword ssh: SSH configuration for Linux-based VMs running on Azure. Required. :paramtype ssh: ~azure.mgmt.containerservice.v2020_12_01.models.ContainerServiceSshConfiguration """ - super(ContainerServiceLinuxProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.admin_username = admin_username self.ssh = ssh -class ContainerServiceMasterProfile(msrest.serialization.Model): +class ContainerServiceMasterProfile(_serialization.Model): """Profile for the container service master. Variables are only populated by the server, and will be ignored when sending a request. @@ -1167,11 +1153,11 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar count: Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, - and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". + and 5. The default value is 1. Known values are: 1, 3, and 5. :vartype count: int or ~azure.mgmt.containerservice.v2020_12_01.models.Count - :ivar dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. + :ivar dns_prefix: DNS prefix to be used to create the FQDN for the master pool. Required. :vartype dns_prefix: str - :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + :ivar vm_size: Size of agent VMs. Required. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -1208,7 +1194,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :vartype vm_size: str or ~azure.mgmt.containerservice.v2020_12_01.models.ContainerServiceVMSizeTypes :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine @@ -1222,7 +1208,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): :vartype first_consecutive_static_ip: str :ivar storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount" and "ManagedDisks". :vartype storage_profile: str or ~azure.mgmt.containerservice.v2020_12_01.models.ContainerServiceStorageProfileTypes :ivar fqdn: FQDN for the master pool. @@ -1230,21 +1216,21 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): """ _validation = { - 'dns_prefix': {'required': True}, - 'vm_size': {'required': True}, - 'os_disk_size_gb': {'maximum': 1023, 'minimum': 0}, - 'fqdn': {'readonly': True}, + "dns_prefix": {"required": True}, + "vm_size": {"required": True}, + "os_disk_size_gb": {"maximum": 1023, "minimum": 0}, + "fqdn": {"readonly": True}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'dns_prefix': {'key': 'dnsPrefix', 'type': 'str'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'first_consecutive_static_ip': {'key': 'firstConsecutiveStaticIP', 'type': 'str'}, - 'storage_profile': {'key': 'storageProfile', 'type': 'str'}, - 'fqdn': {'key': 'fqdn', 'type': 'str'}, + "count": {"key": "count", "type": "int"}, + "dns_prefix": {"key": "dnsPrefix", "type": "str"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "first_consecutive_static_ip": {"key": "firstConsecutiveStaticIP", "type": "str"}, + "storage_profile": {"key": "storageProfile", "type": "str"}, + "fqdn": {"key": "fqdn", "type": "str"}, } def __init__( @@ -1252,20 +1238,20 @@ def __init__( *, dns_prefix: str, vm_size: Union[str, "_models.ContainerServiceVMSizeTypes"], - count: Optional[Union[int, "_models.Count"]] = 1, + count: Union[int, "_models.Count"] = 1, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, - first_consecutive_static_ip: Optional[str] = "10.240.255.5", + first_consecutive_static_ip: str = "10.240.255.5", storage_profile: Optional[Union[str, "_models.ContainerServiceStorageProfileTypes"]] = None, **kwargs ): """ :keyword count: Number of masters (VMs) in the container service cluster. Allowed values are 1, - 3, and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". + 3, and 5. The default value is 1. Known values are: 1, 3, and 5. :paramtype count: int or ~azure.mgmt.containerservice.v2020_12_01.models.Count - :keyword dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. + :keyword dns_prefix: DNS prefix to be used to create the FQDN for the master pool. Required. :paramtype dns_prefix: str - :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + :keyword vm_size: Size of agent VMs. Required. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -1302,7 +1288,7 @@ def __init__( "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :paramtype vm_size: str or ~azure.mgmt.containerservice.v2020_12_01.models.ContainerServiceVMSizeTypes :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every @@ -1316,11 +1302,11 @@ def __init__( :paramtype first_consecutive_static_ip: str :keyword storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount" and "ManagedDisks". :paramtype storage_profile: str or ~azure.mgmt.containerservice.v2020_12_01.models.ContainerServiceStorageProfileTypes """ - super(ContainerServiceMasterProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.dns_prefix = dns_prefix self.vm_size = vm_size @@ -1331,17 +1317,17 @@ def __init__( self.fqdn = None -class ContainerServiceNetworkProfile(msrest.serialization.Model): +class ContainerServiceNetworkProfile(_serialization.Model): """Profile of network configuration. :ivar network_plugin: Network plugin used for building Kubernetes network. Known values are: - "azure", "kubenet". Default value: "kubenet". + "azure" and "kubenet". :vartype network_plugin: str or ~azure.mgmt.containerservice.v2020_12_01.models.NetworkPlugin :ivar network_policy: Network policy used for building Kubernetes network. Known values are: - "calico", "azure". + "calico" and "azure". :vartype network_policy: str or ~azure.mgmt.containerservice.v2020_12_01.models.NetworkPolicy :ivar network_mode: Network mode used for building Kubernetes network. Known values are: - "transparent", "bridge". + "transparent" and "bridge". :vartype network_mode: str or ~azure.mgmt.containerservice.v2020_12_01.models.NetworkMode :ivar pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :vartype pod_cidr: str @@ -1354,11 +1340,11 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): :ivar docker_bridge_cidr: A CIDR notation IP range assigned to the Docker bridge network. It must not overlap with any Subnet IP ranges or the Kubernetes service address range. :vartype docker_bridge_cidr: str - :ivar outbound_type: The outbound (egress) routing method. Known values are: "loadBalancer", - "userDefinedRouting". Default value: "loadBalancer". + :ivar outbound_type: The outbound (egress) routing method. Known values are: "loadBalancer" and + "userDefinedRouting". :vartype outbound_type: str or ~azure.mgmt.containerservice.v2020_12_01.models.OutboundType :ivar load_balancer_sku: The load balancer sku for the managed cluster. Known values are: - "standard", "basic". + "standard" and "basic". :vartype load_balancer_sku: str or ~azure.mgmt.containerservice.v2020_12_01.models.LoadBalancerSku :ivar load_balancer_profile: Profile of the cluster load balancer. @@ -1367,49 +1353,51 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): """ _validation = { - 'pod_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, - 'service_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, - 'dns_service_ip': {'pattern': r'^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$'}, - 'docker_bridge_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, + "pod_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, + "service_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, + "dns_service_ip": { + "pattern": r"^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$" + }, + "docker_bridge_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, } _attribute_map = { - 'network_plugin': {'key': 'networkPlugin', 'type': 'str'}, - 'network_policy': {'key': 'networkPolicy', 'type': 'str'}, - 'network_mode': {'key': 'networkMode', 'type': 'str'}, - 'pod_cidr': {'key': 'podCidr', 'type': 'str'}, - 'service_cidr': {'key': 'serviceCidr', 'type': 'str'}, - 'dns_service_ip': {'key': 'dnsServiceIP', 'type': 'str'}, - 'docker_bridge_cidr': {'key': 'dockerBridgeCidr', 'type': 'str'}, - 'outbound_type': {'key': 'outboundType', 'type': 'str'}, - 'load_balancer_sku': {'key': 'loadBalancerSku', 'type': 'str'}, - 'load_balancer_profile': {'key': 'loadBalancerProfile', 'type': 'ManagedClusterLoadBalancerProfile'}, + "network_plugin": {"key": "networkPlugin", "type": "str"}, + "network_policy": {"key": "networkPolicy", "type": "str"}, + "network_mode": {"key": "networkMode", "type": "str"}, + "pod_cidr": {"key": "podCidr", "type": "str"}, + "service_cidr": {"key": "serviceCidr", "type": "str"}, + "dns_service_ip": {"key": "dnsServiceIP", "type": "str"}, + "docker_bridge_cidr": {"key": "dockerBridgeCidr", "type": "str"}, + "outbound_type": {"key": "outboundType", "type": "str"}, + "load_balancer_sku": {"key": "loadBalancerSku", "type": "str"}, + "load_balancer_profile": {"key": "loadBalancerProfile", "type": "ManagedClusterLoadBalancerProfile"}, } def __init__( self, *, - network_plugin: Optional[Union[str, "_models.NetworkPlugin"]] = "kubenet", + network_plugin: Union[str, "_models.NetworkPlugin"] = "kubenet", network_policy: Optional[Union[str, "_models.NetworkPolicy"]] = None, network_mode: Optional[Union[str, "_models.NetworkMode"]] = None, - pod_cidr: Optional[str] = "10.244.0.0/16", - service_cidr: Optional[str] = "10.0.0.0/16", - dns_service_ip: Optional[str] = "10.0.0.10", - docker_bridge_cidr: Optional[str] = "172.17.0.1/16", - outbound_type: Optional[Union[str, "_models.OutboundType"]] = "loadBalancer", + pod_cidr: str = "10.244.0.0/16", + service_cidr: str = "10.0.0.0/16", + dns_service_ip: str = "10.0.0.10", + docker_bridge_cidr: str = "172.17.0.1/16", + outbound_type: Union[str, "_models.OutboundType"] = "loadBalancer", load_balancer_sku: Optional[Union[str, "_models.LoadBalancerSku"]] = None, load_balancer_profile: Optional["_models.ManagedClusterLoadBalancerProfile"] = None, **kwargs ): """ :keyword network_plugin: Network plugin used for building Kubernetes network. Known values are: - "azure", "kubenet". Default value: "kubenet". + "azure" and "kubenet". :paramtype network_plugin: str or ~azure.mgmt.containerservice.v2020_12_01.models.NetworkPlugin :keyword network_policy: Network policy used for building Kubernetes network. Known values are: - "calico", "azure". + "calico" and "azure". :paramtype network_policy: str or ~azure.mgmt.containerservice.v2020_12_01.models.NetworkPolicy :keyword network_mode: Network mode used for building Kubernetes network. Known values are: - "transparent", "bridge". + "transparent" and "bridge". :paramtype network_mode: str or ~azure.mgmt.containerservice.v2020_12_01.models.NetworkMode :keyword pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :paramtype pod_cidr: str @@ -1422,18 +1410,18 @@ def __init__( :keyword docker_bridge_cidr: A CIDR notation IP range assigned to the Docker bridge network. It must not overlap with any Subnet IP ranges or the Kubernetes service address range. :paramtype docker_bridge_cidr: str - :keyword outbound_type: The outbound (egress) routing method. Known values are: "loadBalancer", - "userDefinedRouting". Default value: "loadBalancer". + :keyword outbound_type: The outbound (egress) routing method. Known values are: "loadBalancer" + and "userDefinedRouting". :paramtype outbound_type: str or ~azure.mgmt.containerservice.v2020_12_01.models.OutboundType :keyword load_balancer_sku: The load balancer sku for the managed cluster. Known values are: - "standard", "basic". + "standard" and "basic". :paramtype load_balancer_sku: str or ~azure.mgmt.containerservice.v2020_12_01.models.LoadBalancerSku :keyword load_balancer_profile: Profile of the cluster load balancer. :paramtype load_balancer_profile: ~azure.mgmt.containerservice.v2020_12_01.models.ManagedClusterLoadBalancerProfile """ - super(ContainerServiceNetworkProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.network_plugin = network_plugin self.network_policy = network_policy self.network_mode = network_mode @@ -1446,113 +1434,98 @@ def __init__( self.load_balancer_profile = load_balancer_profile -class ContainerServiceSshConfiguration(msrest.serialization.Model): +class ContainerServiceSshConfiguration(_serialization.Model): """SSH configuration for Linux-based VMs running on Azure. All required parameters must be populated in order to send to Azure. - :ivar public_keys: Required. The list of SSH public keys used to authenticate with Linux-based - VMs. Only expect one key specified. + :ivar public_keys: The list of SSH public keys used to authenticate with Linux-based VMs. Only + expect one key specified. Required. :vartype public_keys: list[~azure.mgmt.containerservice.v2020_12_01.models.ContainerServiceSshPublicKey] """ _validation = { - 'public_keys': {'required': True}, + "public_keys": {"required": True}, } _attribute_map = { - 'public_keys': {'key': 'publicKeys', 'type': '[ContainerServiceSshPublicKey]'}, + "public_keys": {"key": "publicKeys", "type": "[ContainerServiceSshPublicKey]"}, } - def __init__( - self, - *, - public_keys: List["_models.ContainerServiceSshPublicKey"], - **kwargs - ): + def __init__(self, *, public_keys: List["_models.ContainerServiceSshPublicKey"], **kwargs): """ - :keyword public_keys: Required. The list of SSH public keys used to authenticate with - Linux-based VMs. Only expect one key specified. + :keyword public_keys: The list of SSH public keys used to authenticate with Linux-based VMs. + Only expect one key specified. Required. :paramtype public_keys: list[~azure.mgmt.containerservice.v2020_12_01.models.ContainerServiceSshPublicKey] """ - super(ContainerServiceSshConfiguration, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_keys = public_keys -class ContainerServiceSshPublicKey(msrest.serialization.Model): +class ContainerServiceSshPublicKey(_serialization.Model): """Contains information about SSH certificate public key data. All required parameters must be populated in order to send to Azure. - :ivar key_data: Required. Certificate public key used to authenticate with VMs through SSH. The - certificate must be in PEM format with or without headers. + :ivar key_data: Certificate public key used to authenticate with VMs through SSH. The + certificate must be in PEM format with or without headers. Required. :vartype key_data: str """ _validation = { - 'key_data': {'required': True}, + "key_data": {"required": True}, } _attribute_map = { - 'key_data': {'key': 'keyData', 'type': 'str'}, + "key_data": {"key": "keyData", "type": "str"}, } - def __init__( - self, - *, - key_data: str, - **kwargs - ): + def __init__(self, *, key_data: str, **kwargs): """ - :keyword key_data: Required. Certificate public key used to authenticate with VMs through SSH. - The certificate must be in PEM format with or without headers. + :keyword key_data: Certificate public key used to authenticate with VMs through SSH. The + certificate must be in PEM format with or without headers. Required. :paramtype key_data: str """ - super(ContainerServiceSshPublicKey, self).__init__(**kwargs) + super().__init__(**kwargs) self.key_data = key_data -class ContainerServiceVMDiagnostics(msrest.serialization.Model): +class ContainerServiceVMDiagnostics(_serialization.Model): """Profile for diagnostics on the container service VMs. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar enabled: Required. Whether the VM diagnostic agent is provisioned on the VM. + :ivar enabled: Whether the VM diagnostic agent is provisioned on the VM. Required. :vartype enabled: bool :ivar storage_uri: The URI of the storage account where diagnostics are stored. :vartype storage_uri: str """ _validation = { - 'enabled': {'required': True}, - 'storage_uri': {'readonly': True}, + "enabled": {"required": True}, + "storage_uri": {"readonly": True}, } _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'storage_uri': {'key': 'storageUri', 'type': 'str'}, + "enabled": {"key": "enabled", "type": "bool"}, + "storage_uri": {"key": "storageUri", "type": "str"}, } - def __init__( - self, - *, - enabled: bool, - **kwargs - ): + def __init__(self, *, enabled: bool, **kwargs): """ - :keyword enabled: Required. Whether the VM diagnostic agent is provisioned on the VM. + :keyword enabled: Whether the VM diagnostic agent is provisioned on the VM. Required. :paramtype enabled: bool """ - super(ContainerServiceVMDiagnostics, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.storage_uri = None -class CredentialResult(msrest.serialization.Model): +class CredentialResult(_serialization.Model): """The credential result response. Variables are only populated by the server, and will be ignored when sending a request. @@ -1560,31 +1533,27 @@ class CredentialResult(msrest.serialization.Model): :ivar name: The name of the credential. :vartype name: str :ivar value: Base64-encoded Kubernetes configuration file. - :vartype value: bytearray + :vartype value: bytes """ _validation = { - 'name': {'readonly': True}, - 'value': {'readonly': True}, + "name": {"readonly": True}, + "value": {"readonly": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'bytearray'}, + "name": {"key": "name", "type": "str"}, + "value": {"key": "value", "type": "bytearray"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(CredentialResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.name = None self.value = None -class CredentialResults(msrest.serialization.Model): +class CredentialResults(_serialization.Model): """The list of credential result response. Variables are only populated by the server, and will be ignored when sending a request. @@ -1594,24 +1563,20 @@ class CredentialResults(msrest.serialization.Model): """ _validation = { - 'kubeconfigs': {'readonly': True}, + "kubeconfigs": {"readonly": True}, } _attribute_map = { - 'kubeconfigs': {'key': 'kubeconfigs', 'type': '[CredentialResult]'}, + "kubeconfigs": {"key": "kubeconfigs", "type": "[CredentialResult]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(CredentialResults, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.kubeconfigs = None -class KubeletConfig(msrest.serialization.Model): +class KubeletConfig(_serialization.Model): # pylint: disable=too-many-instance-attributes """Kubelet configurations of agent nodes. :ivar cpu_manager_policy: CPU Manager policy to use. @@ -1645,21 +1610,21 @@ class KubeletConfig(msrest.serialization.Model): """ _validation = { - 'container_log_max_files': {'minimum': 2}, + "container_log_max_files": {"minimum": 2}, } _attribute_map = { - 'cpu_manager_policy': {'key': 'cpuManagerPolicy', 'type': 'str'}, - 'cpu_cfs_quota': {'key': 'cpuCfsQuota', 'type': 'bool'}, - 'cpu_cfs_quota_period': {'key': 'cpuCfsQuotaPeriod', 'type': 'str'}, - 'image_gc_high_threshold': {'key': 'imageGcHighThreshold', 'type': 'int'}, - 'image_gc_low_threshold': {'key': 'imageGcLowThreshold', 'type': 'int'}, - 'topology_manager_policy': {'key': 'topologyManagerPolicy', 'type': 'str'}, - 'allowed_unsafe_sysctls': {'key': 'allowedUnsafeSysctls', 'type': '[str]'}, - 'fail_swap_on': {'key': 'failSwapOn', 'type': 'bool'}, - 'container_log_max_size_mb': {'key': 'containerLogMaxSizeMB', 'type': 'int'}, - 'container_log_max_files': {'key': 'containerLogMaxFiles', 'type': 'int'}, - 'pod_max_pids': {'key': 'podMaxPids', 'type': 'int'}, + "cpu_manager_policy": {"key": "cpuManagerPolicy", "type": "str"}, + "cpu_cfs_quota": {"key": "cpuCfsQuota", "type": "bool"}, + "cpu_cfs_quota_period": {"key": "cpuCfsQuotaPeriod", "type": "str"}, + "image_gc_high_threshold": {"key": "imageGcHighThreshold", "type": "int"}, + "image_gc_low_threshold": {"key": "imageGcLowThreshold", "type": "int"}, + "topology_manager_policy": {"key": "topologyManagerPolicy", "type": "str"}, + "allowed_unsafe_sysctls": {"key": "allowedUnsafeSysctls", "type": "[str]"}, + "fail_swap_on": {"key": "failSwapOn", "type": "bool"}, + "container_log_max_size_mb": {"key": "containerLogMaxSizeMB", "type": "int"}, + "container_log_max_files": {"key": "containerLogMaxFiles", "type": "int"}, + "pod_max_pids": {"key": "podMaxPids", "type": "int"}, } def __init__( @@ -1709,7 +1674,7 @@ def __init__( :keyword pod_max_pids: The maximum number of processes per pod. :paramtype pod_max_pids: int """ - super(KubeletConfig, self).__init__(**kwargs) + super().__init__(**kwargs) self.cpu_manager_policy = cpu_manager_policy self.cpu_cfs_quota = cpu_cfs_quota self.cpu_cfs_quota_period = cpu_cfs_quota_period @@ -1723,7 +1688,7 @@ def __init__( self.pod_max_pids = pod_max_pids -class LinuxOSConfig(msrest.serialization.Model): +class LinuxOSConfig(_serialization.Model): """OS configurations of Linux agent nodes. :ivar sysctls: Sysctl settings for Linux agent nodes. @@ -1738,10 +1703,10 @@ class LinuxOSConfig(msrest.serialization.Model): """ _attribute_map = { - 'sysctls': {'key': 'sysctls', 'type': 'SysctlConfig'}, - 'transparent_huge_page_enabled': {'key': 'transparentHugePageEnabled', 'type': 'str'}, - 'transparent_huge_page_defrag': {'key': 'transparentHugePageDefrag', 'type': 'str'}, - 'swap_file_size_mb': {'key': 'swapFileSizeMB', 'type': 'int'}, + "sysctls": {"key": "sysctls", "type": "SysctlConfig"}, + "transparent_huge_page_enabled": {"key": "transparentHugePageEnabled", "type": "str"}, + "transparent_huge_page_defrag": {"key": "transparentHugePageDefrag", "type": "str"}, + "swap_file_size_mb": {"key": "swapFileSizeMB", "type": "int"}, } def __init__( @@ -1764,7 +1729,7 @@ def __init__( on each node. :paramtype swap_file_size_mb: int """ - super(LinuxOSConfig, self).__init__(**kwargs) + super().__init__(**kwargs) self.sysctls = sysctls self.transparent_huge_page_enabled = transparent_huge_page_enabled self.transparent_huge_page_defrag = transparent_huge_page_defrag @@ -1792,19 +1757,19 @@ class MaintenanceConfiguration(SubResource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, + "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'}, - 'time_in_week': {'key': 'properties.timeInWeek', 'type': '[TimeInWeek]'}, - 'not_allowed_time': {'key': 'properties.notAllowedTime', 'type': '[TimeSpan]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "time_in_week": {"key": "properties.timeInWeek", "type": "[TimeInWeek]"}, + "not_allowed_time": {"key": "properties.notAllowedTime", "type": "[TimeSpan]"}, } def __init__( @@ -1820,13 +1785,13 @@ def __init__( :keyword not_allowed_time: Time slots on which upgrade is not allowed. :paramtype not_allowed_time: list[~azure.mgmt.containerservice.v2020_12_01.models.TimeSpan] """ - super(MaintenanceConfiguration, self).__init__(**kwargs) + super().__init__(**kwargs) self.system_data = None self.time_in_week = time_in_week self.not_allowed_time = not_allowed_time -class MaintenanceConfigurationListResult(msrest.serialization.Model): +class MaintenanceConfigurationListResult(_serialization.Model): """The response from the List maintenance configurations operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -1838,31 +1803,26 @@ class MaintenanceConfigurationListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[MaintenanceConfiguration]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[MaintenanceConfiguration]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.MaintenanceConfiguration"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.MaintenanceConfiguration"]] = None, **kwargs): """ :keyword value: The list of maintenance configurations. :paramtype value: list[~azure.mgmt.containerservice.v2020_12_01.models.MaintenanceConfiguration] """ - super(MaintenanceConfigurationListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class Resource(msrest.serialization.Model): +class Resource(_serialization.Model): """The Resource model definition. Variables are only populated by the server, and will be ignored when sending a request. @@ -1875,41 +1835,35 @@ class Resource(msrest.serialization.Model): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] """ - super(Resource, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -1917,7 +1871,9 @@ def __init__( self.tags = tags -class ManagedCluster(Resource, Components1Q1Og48SchemasManagedclusterAllof1): +class ManagedCluster( + Resource, Components1Q1Og48SchemasManagedclusterAllof1 +): # pylint: disable=too-many-instance-attributes """Managed cluster. Variables are only populated by the server, and will be ignored when sending a request. @@ -1994,60 +1950,72 @@ class ManagedCluster(Resource, Components1Q1Og48SchemasManagedclusterAllof1): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar sku: The managed cluster SKU. :vartype sku: ~azure.mgmt.containerservice.v2020_12_01.models.ManagedClusterSKU """ _validation = { - 'provisioning_state': {'readonly': True}, - 'power_state': {'readonly': True}, - 'max_agent_pools': {'readonly': True}, - 'fqdn': {'readonly': True}, - 'private_fqdn': {'readonly': True}, - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, + "provisioning_state": {"readonly": True}, + "power_state": {"readonly": True}, + "max_agent_pools": {"readonly": True}, + "fqdn": {"readonly": True}, + "private_fqdn": {"readonly": True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { - 'identity': {'key': 'identity', 'type': 'ManagedClusterIdentity'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'power_state': {'key': 'properties.powerState', 'type': 'PowerState'}, - 'max_agent_pools': {'key': 'properties.maxAgentPools', 'type': 'int'}, - 'kubernetes_version': {'key': 'properties.kubernetesVersion', 'type': 'str'}, - 'dns_prefix': {'key': 'properties.dnsPrefix', 'type': 'str'}, - 'fqdn': {'key': 'properties.fqdn', 'type': 'str'}, - 'private_fqdn': {'key': 'properties.privateFQDN', 'type': 'str'}, - 'agent_pool_profiles': {'key': 'properties.agentPoolProfiles', 'type': '[ManagedClusterAgentPoolProfile]'}, - 'linux_profile': {'key': 'properties.linuxProfile', 'type': 'ContainerServiceLinuxProfile'}, - 'windows_profile': {'key': 'properties.windowsProfile', 'type': 'ManagedClusterWindowsProfile'}, - 'service_principal_profile': {'key': 'properties.servicePrincipalProfile', 'type': 'ManagedClusterServicePrincipalProfile'}, - 'addon_profiles': {'key': 'properties.addonProfiles', 'type': '{ManagedClusterAddonProfile}'}, - 'pod_identity_profile': {'key': 'properties.podIdentityProfile', 'type': 'ManagedClusterPodIdentityProfile'}, - 'node_resource_group': {'key': 'properties.nodeResourceGroup', 'type': 'str'}, - 'enable_rbac': {'key': 'properties.enableRBAC', 'type': 'bool'}, - 'enable_pod_security_policy': {'key': 'properties.enablePodSecurityPolicy', 'type': 'bool'}, - 'network_profile': {'key': 'properties.networkProfile', 'type': 'ContainerServiceNetworkProfile'}, - 'aad_profile': {'key': 'properties.aadProfile', 'type': 'ManagedClusterAADProfile'}, - 'auto_upgrade_profile': {'key': 'properties.autoUpgradeProfile', 'type': 'ManagedClusterAutoUpgradeProfile'}, - 'auto_scaler_profile': {'key': 'properties.autoScalerProfile', 'type': 'ManagedClusterPropertiesAutoScalerProfile'}, - 'api_server_access_profile': {'key': 'properties.apiServerAccessProfile', 'type': 'ManagedClusterAPIServerAccessProfile'}, - 'disk_encryption_set_id': {'key': 'properties.diskEncryptionSetID', 'type': 'str'}, - 'identity_profile': {'key': 'properties.identityProfile', 'type': '{ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties}'}, - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'ManagedClusterSKU'}, + "identity": {"key": "identity", "type": "ManagedClusterIdentity"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "power_state": {"key": "properties.powerState", "type": "PowerState"}, + "max_agent_pools": {"key": "properties.maxAgentPools", "type": "int"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "dns_prefix": {"key": "properties.dnsPrefix", "type": "str"}, + "fqdn": {"key": "properties.fqdn", "type": "str"}, + "private_fqdn": {"key": "properties.privateFQDN", "type": "str"}, + "agent_pool_profiles": {"key": "properties.agentPoolProfiles", "type": "[ManagedClusterAgentPoolProfile]"}, + "linux_profile": {"key": "properties.linuxProfile", "type": "ContainerServiceLinuxProfile"}, + "windows_profile": {"key": "properties.windowsProfile", "type": "ManagedClusterWindowsProfile"}, + "service_principal_profile": { + "key": "properties.servicePrincipalProfile", + "type": "ManagedClusterServicePrincipalProfile", + }, + "addon_profiles": {"key": "properties.addonProfiles", "type": "{ManagedClusterAddonProfile}"}, + "pod_identity_profile": {"key": "properties.podIdentityProfile", "type": "ManagedClusterPodIdentityProfile"}, + "node_resource_group": {"key": "properties.nodeResourceGroup", "type": "str"}, + "enable_rbac": {"key": "properties.enableRBAC", "type": "bool"}, + "enable_pod_security_policy": {"key": "properties.enablePodSecurityPolicy", "type": "bool"}, + "network_profile": {"key": "properties.networkProfile", "type": "ContainerServiceNetworkProfile"}, + "aad_profile": {"key": "properties.aadProfile", "type": "ManagedClusterAADProfile"}, + "auto_upgrade_profile": {"key": "properties.autoUpgradeProfile", "type": "ManagedClusterAutoUpgradeProfile"}, + "auto_scaler_profile": { + "key": "properties.autoScalerProfile", + "type": "ManagedClusterPropertiesAutoScalerProfile", + }, + "api_server_access_profile": { + "key": "properties.apiServerAccessProfile", + "type": "ManagedClusterAPIServerAccessProfile", + }, + "disk_encryption_set_id": {"key": "properties.diskEncryptionSetID", "type": "str"}, + "identity_profile": { + "key": "properties.identityProfile", + "type": "{ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties}", + }, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "sku": {"key": "sku", "type": "ManagedClusterSKU"}, } - def __init__( + def __init__( # pylint: disable=too-many-locals self, *, location: str, @@ -2069,7 +2037,12 @@ def __init__( auto_scaler_profile: Optional["_models.ManagedClusterPropertiesAutoScalerProfile"] = None, api_server_access_profile: Optional["_models.ManagedClusterAPIServerAccessProfile"] = None, disk_encryption_set_id: Optional[str] = None, - identity_profile: Optional[Dict[str, "_models.ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties"]] = None, + identity_profile: Optional[ + Dict[ + str, + "_models.ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties", + ] + ] = None, tags: Optional[Dict[str, str]] = None, sku: Optional["_models.ManagedClusterSKU"] = None, **kwargs @@ -2129,14 +2102,37 @@ def __init__( :keyword identity_profile: Identities associated with the cluster. :paramtype identity_profile: dict[str, ~azure.mgmt.containerservice.v2020_12_01.models.ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties] - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword sku: The managed cluster SKU. :paramtype sku: ~azure.mgmt.containerservice.v2020_12_01.models.ManagedClusterSKU """ - super(ManagedCluster, self).__init__(location=location, tags=tags, identity=identity, kubernetes_version=kubernetes_version, dns_prefix=dns_prefix, agent_pool_profiles=agent_pool_profiles, linux_profile=linux_profile, windows_profile=windows_profile, service_principal_profile=service_principal_profile, addon_profiles=addon_profiles, pod_identity_profile=pod_identity_profile, node_resource_group=node_resource_group, enable_rbac=enable_rbac, enable_pod_security_policy=enable_pod_security_policy, network_profile=network_profile, aad_profile=aad_profile, auto_upgrade_profile=auto_upgrade_profile, auto_scaler_profile=auto_scaler_profile, api_server_access_profile=api_server_access_profile, disk_encryption_set_id=disk_encryption_set_id, identity_profile=identity_profile, **kwargs) + super().__init__( + location=location, + tags=tags, + identity=identity, + kubernetes_version=kubernetes_version, + dns_prefix=dns_prefix, + agent_pool_profiles=agent_pool_profiles, + linux_profile=linux_profile, + windows_profile=windows_profile, + service_principal_profile=service_principal_profile, + addon_profiles=addon_profiles, + pod_identity_profile=pod_identity_profile, + node_resource_group=node_resource_group, + enable_rbac=enable_rbac, + enable_pod_security_policy=enable_pod_security_policy, + network_profile=network_profile, + aad_profile=aad_profile, + auto_upgrade_profile=auto_upgrade_profile, + auto_scaler_profile=auto_scaler_profile, + api_server_access_profile=api_server_access_profile, + disk_encryption_set_id=disk_encryption_set_id, + identity_profile=identity_profile, + **kwargs + ) self.identity = identity self.provisioning_state = None self.power_state = None @@ -2169,7 +2165,7 @@ def __init__( self.tags = tags -class ManagedClusterAADProfile(msrest.serialization.Model): +class ManagedClusterAADProfile(_serialization.Model): """AADProfile specifies attributes for Azure Active Directory integration. :ivar managed: Whether to enable managed AAD. @@ -2190,13 +2186,13 @@ class ManagedClusterAADProfile(msrest.serialization.Model): """ _attribute_map = { - 'managed': {'key': 'managed', 'type': 'bool'}, - 'enable_azure_rbac': {'key': 'enableAzureRBAC', 'type': 'bool'}, - 'admin_group_object_i_ds': {'key': 'adminGroupObjectIDs', 'type': '[str]'}, - 'client_app_id': {'key': 'clientAppID', 'type': 'str'}, - 'server_app_id': {'key': 'serverAppID', 'type': 'str'}, - 'server_app_secret': {'key': 'serverAppSecret', 'type': 'str'}, - 'tenant_id': {'key': 'tenantID', 'type': 'str'}, + "managed": {"key": "managed", "type": "bool"}, + "enable_azure_rbac": {"key": "enableAzureRBAC", "type": "bool"}, + "admin_group_object_i_ds": {"key": "adminGroupObjectIDs", "type": "[str]"}, + "client_app_id": {"key": "clientAppID", "type": "str"}, + "server_app_id": {"key": "serverAppID", "type": "str"}, + "server_app_secret": {"key": "serverAppSecret", "type": "str"}, + "tenant_id": {"key": "tenantID", "type": "str"}, } def __init__( @@ -2229,7 +2225,7 @@ def __init__( tenant of the deployment subscription. :paramtype tenant_id: str """ - super(ManagedClusterAADProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.managed = managed self.enable_azure_rbac = enable_azure_rbac self.admin_group_object_i_ds = admin_group_object_i_ds @@ -2252,58 +2248,53 @@ class ManagedClusterAccessProfile(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar kube_config: Base64-encoded Kubernetes configuration file. - :vartype kube_config: bytearray + :vartype kube_config: bytes """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'kube_config': {'key': 'properties.kubeConfig', 'type': 'bytearray'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "kube_config": {"key": "properties.kubeConfig", "type": "bytearray"}, } def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - kube_config: Optional[bytearray] = None, - **kwargs + self, *, location: str, tags: Optional[Dict[str, str]] = None, kube_config: Optional[bytes] = None, **kwargs ): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword kube_config: Base64-encoded Kubernetes configuration file. - :paramtype kube_config: bytearray + :paramtype kube_config: bytes """ - super(ManagedClusterAccessProfile, self).__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.kube_config = kube_config -class ManagedClusterAddonProfile(msrest.serialization.Model): +class ManagedClusterAddonProfile(_serialization.Model): """A Kubernetes add-on profile for a managed cluster. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar enabled: Required. Whether the add-on is enabled or not. + :ivar enabled: Whether the add-on is enabled or not. Required. :vartype enabled: bool :ivar config: Key-value pairs for configuring an add-on. :vartype config: dict[str, str] @@ -2313,30 +2304,24 @@ class ManagedClusterAddonProfile(msrest.serialization.Model): """ _validation = { - 'enabled': {'required': True}, - 'identity': {'readonly': True}, + "enabled": {"required": True}, + "identity": {"readonly": True}, } _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'config': {'key': 'config', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'ManagedClusterAddonProfileIdentity'}, + "enabled": {"key": "enabled", "type": "bool"}, + "config": {"key": "config", "type": "{str}"}, + "identity": {"key": "identity", "type": "ManagedClusterAddonProfileIdentity"}, } - def __init__( - self, - *, - enabled: bool, - config: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, enabled: bool, config: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword enabled: Required. Whether the add-on is enabled or not. + :keyword enabled: Whether the add-on is enabled or not. Required. :paramtype enabled: bool :keyword config: Key-value pairs for configuring an add-on. :paramtype config: dict[str, str] """ - super(ManagedClusterAddonProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.config = config self.identity = None @@ -2354,9 +2339,9 @@ class ManagedClusterAddonProfileIdentity(UserAssignedIdentity): """ _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'object_id': {'key': 'objectId', 'type': 'str'}, + "resource_id": {"key": "resourceId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + "object_id": {"key": "objectId", "type": "str"}, } def __init__( @@ -2375,10 +2360,10 @@ def __init__( :keyword object_id: The object id of the user assigned identity. :paramtype object_id: str """ - super(ManagedClusterAddonProfileIdentity, self).__init__(resource_id=resource_id, client_id=client_id, object_id=object_id, **kwargs) + super().__init__(resource_id=resource_id, client_id=client_id, object_id=object_id, **kwargs) -class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): +class ManagedClusterAgentPoolProfileProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes """Properties for the container service agent pool profile. Variables are only populated by the server, and will be ignored when sending a request. @@ -2424,7 +2409,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :vartype vm_size: str or ~azure.mgmt.containerservice.v2020_12_01.models.ContainerServiceVMSizeTypes :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine @@ -2434,11 +2419,11 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar os_disk_type: OS disk type to be used for machines in a given agent pool. Allowed values are 'Ephemeral' and 'Managed'. If unspecified, defaults to 'Ephemeral' when the VM supports ephemeral OS and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults - to 'Managed'. May not be changed after creation. Known values are: "Managed", "Ephemeral". + to 'Managed'. May not be changed after creation. Known values are: "Managed" and "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2020_12_01.models.OSDiskType :ivar kubelet_disk_type: KubeletDiskType determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. Currently allows one value, OS, - resulting in Kubelet using the OS disk for data. Known values are: "OS". + resulting in Kubelet using the OS disk for data. "OS" :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2020_12_01.models.KubeletDiskType :ivar vnet_subnet_id: VNet SubnetID specifies the VNet's subnet identifier for nodes and maybe @@ -2449,7 +2434,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Known values are: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux" and "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2020_12_01.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -2458,9 +2443,10 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar type: AgentPoolType represents types of an agent pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2020_12_01.models.AgentPoolType - :ivar mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", "User". + :ivar mode: AgentPoolMode represents mode of an agent pool. Known values are: "System" and + "User". :vartype mode: str or ~azure.mgmt.containerservice.v2020_12_01.models.AgentPoolMode :ivar orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -2481,20 +2467,19 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar enable_node_public_ip: Enable public IP for nodes. :vartype enable_node_public_ip: bool :ivar scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Known values are: "Spot", "Regular". Default value: "Regular". + priority. Default to regular. Known values are: "Spot" and "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_12_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy - for Spot virtual machine scale set. Default to Delete. Known values are: "Delete", - "Deallocate". Default value: "Delete". + for Spot virtual machine scale set. Default to Delete. Known values are: "Delete" and + "Deallocate". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_12_01.models.ScaleSetEvictionPolicy :ivar spot_max_price: SpotMaxPrice to be used to specify the maximum price you are willing to pay in US Dollars. Possible values are any decimal value greater than zero or -1 which indicates default price to be up-to on-demand. :vartype spot_max_price: float - :ivar tags: A set of tags. Agent pool tags to be persisted on the agent pool virtual machine - scale set. + :ivar tags: Agent pool tags to be persisted on the agent pool virtual machine scale set. :vartype tags: dict[str, str] :ivar node_labels: Agent pool node labels to be persisted across all nodes in agent pool. :vartype node_labels: dict[str, str] @@ -2512,47 +2497,47 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): """ _validation = { - 'os_disk_size_gb': {'maximum': 1023, 'minimum': 0}, - 'node_image_version': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'power_state': {'readonly': True}, + "os_disk_size_gb": {"maximum": 1023, "minimum": 0}, + "node_image_version": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "power_state": {"readonly": True}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'os_disk_type': {'key': 'osDiskType', 'type': 'str'}, - 'kubelet_disk_type': {'key': 'kubeletDiskType', 'type': 'str'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'pod_subnet_id': {'key': 'podSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'maxPods', 'type': 'int'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'max_count': {'key': 'maxCount', 'type': 'int'}, - 'min_count': {'key': 'minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'enableAutoScaling', 'type': 'bool'}, - 'type': {'key': 'type', 'type': 'str'}, - 'mode': {'key': 'mode', 'type': 'str'}, - 'orchestrator_version': {'key': 'orchestratorVersion', 'type': 'str'}, - 'node_image_version': {'key': 'nodeImageVersion', 'type': 'str'}, - 'upgrade_settings': {'key': 'upgradeSettings', 'type': 'AgentPoolUpgradeSettings'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'power_state': {'key': 'powerState', 'type': 'PowerState'}, - 'availability_zones': {'key': 'availabilityZones', 'type': '[str]'}, - 'enable_node_public_ip': {'key': 'enableNodePublicIP', 'type': 'bool'}, - 'scale_set_priority': {'key': 'scaleSetPriority', 'type': 'str'}, - 'scale_set_eviction_policy': {'key': 'scaleSetEvictionPolicy', 'type': 'str'}, - 'spot_max_price': {'key': 'spotMaxPrice', 'type': 'float'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'node_labels': {'key': 'nodeLabels', 'type': '{str}'}, - 'node_taints': {'key': 'nodeTaints', 'type': '[str]'}, - 'proximity_placement_group_id': {'key': 'proximityPlacementGroupID', 'type': 'str'}, - 'kubelet_config': {'key': 'kubeletConfig', 'type': 'KubeletConfig'}, - 'linux_os_config': {'key': 'linuxOSConfig', 'type': 'LinuxOSConfig'}, - 'enable_encryption_at_host': {'key': 'enableEncryptionAtHost', 'type': 'bool'}, + "count": {"key": "count", "type": "int"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "os_disk_type": {"key": "osDiskType", "type": "str"}, + "kubelet_disk_type": {"key": "kubeletDiskType", "type": "str"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "pod_subnet_id": {"key": "podSubnetID", "type": "str"}, + "max_pods": {"key": "maxPods", "type": "int"}, + "os_type": {"key": "osType", "type": "str"}, + "max_count": {"key": "maxCount", "type": "int"}, + "min_count": {"key": "minCount", "type": "int"}, + "enable_auto_scaling": {"key": "enableAutoScaling", "type": "bool"}, + "type": {"key": "type", "type": "str"}, + "mode": {"key": "mode", "type": "str"}, + "orchestrator_version": {"key": "orchestratorVersion", "type": "str"}, + "node_image_version": {"key": "nodeImageVersion", "type": "str"}, + "upgrade_settings": {"key": "upgradeSettings", "type": "AgentPoolUpgradeSettings"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "power_state": {"key": "powerState", "type": "PowerState"}, + "availability_zones": {"key": "availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "enableNodePublicIP", "type": "bool"}, + "scale_set_priority": {"key": "scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "scaleSetEvictionPolicy", "type": "str"}, + "spot_max_price": {"key": "spotMaxPrice", "type": "float"}, + "tags": {"key": "tags", "type": "{str}"}, + "node_labels": {"key": "nodeLabels", "type": "{str}"}, + "node_taints": {"key": "nodeTaints", "type": "[str]"}, + "proximity_placement_group_id": {"key": "proximityPlacementGroupID", "type": "str"}, + "kubelet_config": {"key": "kubeletConfig", "type": "KubeletConfig"}, + "linux_os_config": {"key": "linuxOSConfig", "type": "LinuxOSConfig"}, + "enable_encryption_at_host": {"key": "enableEncryptionAtHost", "type": "bool"}, } - def __init__( + def __init__( # pylint: disable=too-many-locals self, *, count: Optional[int] = None, @@ -2563,7 +2548,7 @@ def __init__( vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, @@ -2573,9 +2558,9 @@ def __init__( upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, - scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", - spot_max_price: Optional[float] = -1, + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", + spot_max_price: float = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, @@ -2627,7 +2612,7 @@ def __init__( "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :paramtype vm_size: str or ~azure.mgmt.containerservice.v2020_12_01.models.ContainerServiceVMSizeTypes :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every @@ -2637,12 +2622,12 @@ def __init__( :keyword os_disk_type: OS disk type to be used for machines in a given agent pool. Allowed values are 'Ephemeral' and 'Managed'. If unspecified, defaults to 'Ephemeral' when the VM supports ephemeral OS and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, - defaults to 'Managed'. May not be changed after creation. Known values are: "Managed", + defaults to 'Managed'. May not be changed after creation. Known values are: "Managed" and "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2020_12_01.models.OSDiskType :keyword kubelet_disk_type: KubeletDiskType determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. Currently allows one value, OS, - resulting in Kubelet using the OS disk for data. Known values are: "OS". + resulting in Kubelet using the OS disk for data. "OS" :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2020_12_01.models.KubeletDiskType :keyword vnet_subnet_id: VNet SubnetID specifies the VNet's subnet identifier for nodes and @@ -2653,7 +2638,7 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux" and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2020_12_01.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -2662,9 +2647,9 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword type: AgentPoolType represents types of an agent pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2020_12_01.models.AgentPoolType - :keyword mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", + :keyword mode: AgentPoolMode represents mode of an agent pool. Known values are: "System" and "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2020_12_01.models.AgentPoolMode :keyword orchestrator_version: Version of orchestrator specified when creating the managed @@ -2679,20 +2664,19 @@ def __init__( :keyword enable_node_public_ip: Enable public IP for nodes. :paramtype enable_node_public_ip: bool :keyword scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Known values are: "Spot", "Regular". Default value: "Regular". + priority. Default to regular. Known values are: "Spot" and "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_12_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction - policy for Spot virtual machine scale set. Default to Delete. Known values are: "Delete", - "Deallocate". Default value: "Delete". + policy for Spot virtual machine scale set. Default to Delete. Known values are: "Delete" and + "Deallocate". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_12_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: SpotMaxPrice to be used to specify the maximum price you are willing to pay in US Dollars. Possible values are any decimal value greater than zero or -1 which indicates default price to be up-to on-demand. :paramtype spot_max_price: float - :keyword tags: A set of tags. Agent pool tags to be persisted on the agent pool virtual machine - scale set. + :keyword tags: Agent pool tags to be persisted on the agent pool virtual machine scale set. :paramtype tags: dict[str, str] :keyword node_labels: Agent pool node labels to be persisted across all nodes in agent pool. :paramtype node_labels: dict[str, str] @@ -2708,7 +2692,7 @@ def __init__( :keyword enable_encryption_at_host: Whether to enable EncryptionAtHost. :paramtype enable_encryption_at_host: bool """ - super(ManagedClusterAgentPoolProfileProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.vm_size = vm_size self.os_disk_size_gb = os_disk_size_gb @@ -2742,7 +2726,9 @@ def __init__( self.enable_encryption_at_host = enable_encryption_at_host -class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): +class ManagedClusterAgentPoolProfile( + ManagedClusterAgentPoolProfileProperties +): # pylint: disable=too-many-instance-attributes """Profile for the container service agent pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -2790,7 +2776,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :vartype vm_size: str or ~azure.mgmt.containerservice.v2020_12_01.models.ContainerServiceVMSizeTypes :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine @@ -2800,11 +2786,11 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar os_disk_type: OS disk type to be used for machines in a given agent pool. Allowed values are 'Ephemeral' and 'Managed'. If unspecified, defaults to 'Ephemeral' when the VM supports ephemeral OS and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults - to 'Managed'. May not be changed after creation. Known values are: "Managed", "Ephemeral". + to 'Managed'. May not be changed after creation. Known values are: "Managed" and "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2020_12_01.models.OSDiskType :ivar kubelet_disk_type: KubeletDiskType determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. Currently allows one value, OS, - resulting in Kubelet using the OS disk for data. Known values are: "OS". + resulting in Kubelet using the OS disk for data. "OS" :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2020_12_01.models.KubeletDiskType :ivar vnet_subnet_id: VNet SubnetID specifies the VNet's subnet identifier for nodes and maybe @@ -2815,7 +2801,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Known values are: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux" and "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2020_12_01.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -2824,9 +2810,10 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar type: AgentPoolType represents types of an agent pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2020_12_01.models.AgentPoolType - :ivar mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", "User". + :ivar mode: AgentPoolMode represents mode of an agent pool. Known values are: "System" and + "User". :vartype mode: str or ~azure.mgmt.containerservice.v2020_12_01.models.AgentPoolMode :ivar orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -2847,20 +2834,19 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar enable_node_public_ip: Enable public IP for nodes. :vartype enable_node_public_ip: bool :ivar scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Known values are: "Spot", "Regular". Default value: "Regular". + priority. Default to regular. Known values are: "Spot" and "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_12_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy - for Spot virtual machine scale set. Default to Delete. Known values are: "Delete", - "Deallocate". Default value: "Delete". + for Spot virtual machine scale set. Default to Delete. Known values are: "Delete" and + "Deallocate". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_12_01.models.ScaleSetEvictionPolicy :ivar spot_max_price: SpotMaxPrice to be used to specify the maximum price you are willing to pay in US Dollars. Possible values are any decimal value greater than zero or -1 which indicates default price to be up-to on-demand. :vartype spot_max_price: float - :ivar tags: A set of tags. Agent pool tags to be persisted on the agent pool virtual machine - scale set. + :ivar tags: Agent pool tags to be persisted on the agent pool virtual machine scale set. :vartype tags: dict[str, str] :ivar node_labels: Agent pool node labels to be persisted across all nodes in agent pool. :vartype node_labels: dict[str, str] @@ -2875,55 +2861,55 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :vartype linux_os_config: ~azure.mgmt.containerservice.v2020_12_01.models.LinuxOSConfig :ivar enable_encryption_at_host: Whether to enable EncryptionAtHost. :vartype enable_encryption_at_host: bool - :ivar name: Required. Unique name of the agent pool profile in the context of the subscription - and resource group. + :ivar name: Unique name of the agent pool profile in the context of the subscription and + resource group. Required. :vartype name: str """ _validation = { - 'os_disk_size_gb': {'maximum': 1023, 'minimum': 0}, - 'node_image_version': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'power_state': {'readonly': True}, - 'name': {'required': True, 'pattern': r'^[a-z][a-z0-9]{0,11}$'}, + "os_disk_size_gb": {"maximum": 1023, "minimum": 0}, + "node_image_version": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "power_state": {"readonly": True}, + "name": {"required": True, "pattern": r"^[a-z][a-z0-9]{0,11}$"}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'os_disk_type': {'key': 'osDiskType', 'type': 'str'}, - 'kubelet_disk_type': {'key': 'kubeletDiskType', 'type': 'str'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'pod_subnet_id': {'key': 'podSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'maxPods', 'type': 'int'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'max_count': {'key': 'maxCount', 'type': 'int'}, - 'min_count': {'key': 'minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'enableAutoScaling', 'type': 'bool'}, - 'type': {'key': 'type', 'type': 'str'}, - 'mode': {'key': 'mode', 'type': 'str'}, - 'orchestrator_version': {'key': 'orchestratorVersion', 'type': 'str'}, - 'node_image_version': {'key': 'nodeImageVersion', 'type': 'str'}, - 'upgrade_settings': {'key': 'upgradeSettings', 'type': 'AgentPoolUpgradeSettings'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'power_state': {'key': 'powerState', 'type': 'PowerState'}, - 'availability_zones': {'key': 'availabilityZones', 'type': '[str]'}, - 'enable_node_public_ip': {'key': 'enableNodePublicIP', 'type': 'bool'}, - 'scale_set_priority': {'key': 'scaleSetPriority', 'type': 'str'}, - 'scale_set_eviction_policy': {'key': 'scaleSetEvictionPolicy', 'type': 'str'}, - 'spot_max_price': {'key': 'spotMaxPrice', 'type': 'float'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'node_labels': {'key': 'nodeLabels', 'type': '{str}'}, - 'node_taints': {'key': 'nodeTaints', 'type': '[str]'}, - 'proximity_placement_group_id': {'key': 'proximityPlacementGroupID', 'type': 'str'}, - 'kubelet_config': {'key': 'kubeletConfig', 'type': 'KubeletConfig'}, - 'linux_os_config': {'key': 'linuxOSConfig', 'type': 'LinuxOSConfig'}, - 'enable_encryption_at_host': {'key': 'enableEncryptionAtHost', 'type': 'bool'}, - 'name': {'key': 'name', 'type': 'str'}, + "count": {"key": "count", "type": "int"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "os_disk_type": {"key": "osDiskType", "type": "str"}, + "kubelet_disk_type": {"key": "kubeletDiskType", "type": "str"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "pod_subnet_id": {"key": "podSubnetID", "type": "str"}, + "max_pods": {"key": "maxPods", "type": "int"}, + "os_type": {"key": "osType", "type": "str"}, + "max_count": {"key": "maxCount", "type": "int"}, + "min_count": {"key": "minCount", "type": "int"}, + "enable_auto_scaling": {"key": "enableAutoScaling", "type": "bool"}, + "type": {"key": "type", "type": "str"}, + "mode": {"key": "mode", "type": "str"}, + "orchestrator_version": {"key": "orchestratorVersion", "type": "str"}, + "node_image_version": {"key": "nodeImageVersion", "type": "str"}, + "upgrade_settings": {"key": "upgradeSettings", "type": "AgentPoolUpgradeSettings"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "power_state": {"key": "powerState", "type": "PowerState"}, + "availability_zones": {"key": "availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "enableNodePublicIP", "type": "bool"}, + "scale_set_priority": {"key": "scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "scaleSetEvictionPolicy", "type": "str"}, + "spot_max_price": {"key": "spotMaxPrice", "type": "float"}, + "tags": {"key": "tags", "type": "{str}"}, + "node_labels": {"key": "nodeLabels", "type": "{str}"}, + "node_taints": {"key": "nodeTaints", "type": "[str]"}, + "proximity_placement_group_id": {"key": "proximityPlacementGroupID", "type": "str"}, + "kubelet_config": {"key": "kubeletConfig", "type": "KubeletConfig"}, + "linux_os_config": {"key": "linuxOSConfig", "type": "LinuxOSConfig"}, + "enable_encryption_at_host": {"key": "enableEncryptionAtHost", "type": "bool"}, + "name": {"key": "name", "type": "str"}, } - def __init__( + def __init__( # pylint: disable=too-many-locals self, *, name: str, @@ -2935,7 +2921,7 @@ def __init__( vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, @@ -2945,9 +2931,9 @@ def __init__( upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, - scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", - spot_max_price: Optional[float] = -1, + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", + spot_max_price: float = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, @@ -2999,7 +2985,7 @@ def __init__( "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :paramtype vm_size: str or ~azure.mgmt.containerservice.v2020_12_01.models.ContainerServiceVMSizeTypes :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every @@ -3009,12 +2995,12 @@ def __init__( :keyword os_disk_type: OS disk type to be used for machines in a given agent pool. Allowed values are 'Ephemeral' and 'Managed'. If unspecified, defaults to 'Ephemeral' when the VM supports ephemeral OS and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, - defaults to 'Managed'. May not be changed after creation. Known values are: "Managed", + defaults to 'Managed'. May not be changed after creation. Known values are: "Managed" and "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2020_12_01.models.OSDiskType :keyword kubelet_disk_type: KubeletDiskType determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. Currently allows one value, OS, - resulting in Kubelet using the OS disk for data. Known values are: "OS". + resulting in Kubelet using the OS disk for data. "OS" :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2020_12_01.models.KubeletDiskType :keyword vnet_subnet_id: VNet SubnetID specifies the VNet's subnet identifier for nodes and @@ -3025,7 +3011,7 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux" and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2020_12_01.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -3034,9 +3020,9 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword type: AgentPoolType represents types of an agent pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2020_12_01.models.AgentPoolType - :keyword mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", + :keyword mode: AgentPoolMode represents mode of an agent pool. Known values are: "System" and "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2020_12_01.models.AgentPoolMode :keyword orchestrator_version: Version of orchestrator specified when creating the managed @@ -3051,20 +3037,19 @@ def __init__( :keyword enable_node_public_ip: Enable public IP for nodes. :paramtype enable_node_public_ip: bool :keyword scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Known values are: "Spot", "Regular". Default value: "Regular". + priority. Default to regular. Known values are: "Spot" and "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_12_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction - policy for Spot virtual machine scale set. Default to Delete. Known values are: "Delete", - "Deallocate". Default value: "Delete". + policy for Spot virtual machine scale set. Default to Delete. Known values are: "Delete" and + "Deallocate". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_12_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: SpotMaxPrice to be used to specify the maximum price you are willing to pay in US Dollars. Possible values are any decimal value greater than zero or -1 which indicates default price to be up-to on-demand. :paramtype spot_max_price: float - :keyword tags: A set of tags. Agent pool tags to be persisted on the agent pool virtual machine - scale set. + :keyword tags: Agent pool tags to be persisted on the agent pool virtual machine scale set. :paramtype tags: dict[str, str] :keyword node_labels: Agent pool node labels to be persisted across all nodes in agent pool. :paramtype node_labels: dict[str, str] @@ -3079,15 +3064,45 @@ def __init__( :paramtype linux_os_config: ~azure.mgmt.containerservice.v2020_12_01.models.LinuxOSConfig :keyword enable_encryption_at_host: Whether to enable EncryptionAtHost. :paramtype enable_encryption_at_host: bool - :keyword name: Required. Unique name of the agent pool profile in the context of the - subscription and resource group. + :keyword name: Unique name of the agent pool profile in the context of the subscription and + resource group. Required. :paramtype name: str """ - super(ManagedClusterAgentPoolProfile, self).__init__(count=count, vm_size=vm_size, os_disk_size_gb=os_disk_size_gb, os_disk_type=os_disk_type, kubelet_disk_type=kubelet_disk_type, vnet_subnet_id=vnet_subnet_id, pod_subnet_id=pod_subnet_id, max_pods=max_pods, os_type=os_type, max_count=max_count, min_count=min_count, enable_auto_scaling=enable_auto_scaling, type=type, mode=mode, orchestrator_version=orchestrator_version, upgrade_settings=upgrade_settings, availability_zones=availability_zones, enable_node_public_ip=enable_node_public_ip, scale_set_priority=scale_set_priority, scale_set_eviction_policy=scale_set_eviction_policy, spot_max_price=spot_max_price, tags=tags, node_labels=node_labels, node_taints=node_taints, proximity_placement_group_id=proximity_placement_group_id, kubelet_config=kubelet_config, linux_os_config=linux_os_config, enable_encryption_at_host=enable_encryption_at_host, **kwargs) + super().__init__( + count=count, + vm_size=vm_size, + os_disk_size_gb=os_disk_size_gb, + os_disk_type=os_disk_type, + kubelet_disk_type=kubelet_disk_type, + vnet_subnet_id=vnet_subnet_id, + pod_subnet_id=pod_subnet_id, + max_pods=max_pods, + os_type=os_type, + max_count=max_count, + min_count=min_count, + enable_auto_scaling=enable_auto_scaling, + type=type, + mode=mode, + orchestrator_version=orchestrator_version, + upgrade_settings=upgrade_settings, + availability_zones=availability_zones, + enable_node_public_ip=enable_node_public_ip, + scale_set_priority=scale_set_priority, + scale_set_eviction_policy=scale_set_eviction_policy, + spot_max_price=spot_max_price, + tags=tags, + node_labels=node_labels, + node_taints=node_taints, + proximity_placement_group_id=proximity_placement_group_id, + kubelet_config=kubelet_config, + linux_os_config=linux_os_config, + enable_encryption_at_host=enable_encryption_at_host, + **kwargs + ) self.name = name -class ManagedClusterAPIServerAccessProfile(msrest.serialization.Model): +class ManagedClusterAPIServerAccessProfile(_serialization.Model): """Access profile for managed cluster API server. :ivar authorized_ip_ranges: Authorized IP Ranges to kubernetes API server. @@ -3099,9 +3114,9 @@ class ManagedClusterAPIServerAccessProfile(msrest.serialization.Model): """ _attribute_map = { - 'authorized_ip_ranges': {'key': 'authorizedIPRanges', 'type': '[str]'}, - 'enable_private_cluster': {'key': 'enablePrivateCluster', 'type': 'bool'}, - 'private_dns_zone': {'key': 'privateDNSZone', 'type': 'str'}, + "authorized_ip_ranges": {"key": "authorizedIPRanges", "type": "[str]"}, + "enable_private_cluster": {"key": "enablePrivateCluster", "type": "bool"}, + "private_dns_zone": {"key": "privateDNSZone", "type": "str"}, } def __init__( @@ -3120,41 +3135,36 @@ def __init__( :keyword private_dns_zone: Private dns zone mode for private cluster. :paramtype private_dns_zone: str """ - super(ManagedClusterAPIServerAccessProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.authorized_ip_ranges = authorized_ip_ranges self.enable_private_cluster = enable_private_cluster self.private_dns_zone = private_dns_zone -class ManagedClusterAutoUpgradeProfile(msrest.serialization.Model): +class ManagedClusterAutoUpgradeProfile(_serialization.Model): """Auto upgrade profile for a managed cluster. :ivar upgrade_channel: upgrade channel for auto upgrade. Known values are: "rapid", "stable", - "patch", "none". + "patch", and "none". :vartype upgrade_channel: str or ~azure.mgmt.containerservice.v2020_12_01.models.UpgradeChannel """ _attribute_map = { - 'upgrade_channel': {'key': 'upgradeChannel', 'type': 'str'}, + "upgrade_channel": {"key": "upgradeChannel", "type": "str"}, } - def __init__( - self, - *, - upgrade_channel: Optional[Union[str, "_models.UpgradeChannel"]] = None, - **kwargs - ): + def __init__(self, *, upgrade_channel: Optional[Union[str, "_models.UpgradeChannel"]] = None, **kwargs): """ :keyword upgrade_channel: upgrade channel for auto upgrade. Known values are: "rapid", - "stable", "patch", "none". + "stable", "patch", and "none". :paramtype upgrade_channel: str or ~azure.mgmt.containerservice.v2020_12_01.models.UpgradeChannel """ - super(ManagedClusterAutoUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.upgrade_channel = upgrade_channel -class ManagedClusterIdentity(msrest.serialization.Model): +class ManagedClusterIdentity(_serialization.Model): """Identity for the managed cluster. Variables are only populated by the server, and will be ignored when sending a request. @@ -3168,7 +3178,7 @@ class ManagedClusterIdentity(msrest.serialization.Model): :ivar type: The type of identity used for the managed cluster. Type 'SystemAssigned' will use an implicitly created identity in master components and an auto-created user assigned identity in MC_ resource group in agent nodes. Type 'None' will not use MSI for the managed cluster, - service principal will be used instead. Known values are: "SystemAssigned", "UserAssigned", + service principal will be used instead. Known values are: "SystemAssigned", "UserAssigned", and "None". :vartype type: str or ~azure.mgmt.containerservice.v2020_12_01.models.ResourceIdentityType :ivar user_assigned_identities: The user identity associated with the managed cluster. This @@ -3180,22 +3190,30 @@ class ManagedClusterIdentity(msrest.serialization.Model): """ _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, + "principal_id": {"readonly": True}, + "tenant_id": {"readonly": True}, } _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{Components1Umhcm8SchemasManagedclusteridentityPropertiesUserassignedidentitiesAdditionalproperties}'}, + "principal_id": {"key": "principalId", "type": "str"}, + "tenant_id": {"key": "tenantId", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "user_assigned_identities": { + "key": "userAssignedIdentities", + "type": "{Components1Umhcm8SchemasManagedclusteridentityPropertiesUserassignedidentitiesAdditionalproperties}", + }, } def __init__( self, *, type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, - user_assigned_identities: Optional[Dict[str, "_models.Components1Umhcm8SchemasManagedclusteridentityPropertiesUserassignedidentitiesAdditionalproperties"]] = None, + user_assigned_identities: Optional[ + Dict[ + str, + "_models.Components1Umhcm8SchemasManagedclusteridentityPropertiesUserassignedidentitiesAdditionalproperties", + ] + ] = None, **kwargs ): """ @@ -3203,7 +3221,7 @@ def __init__( use an implicitly created identity in master components and an auto-created user assigned identity in MC_ resource group in agent nodes. Type 'None' will not use MSI for the managed cluster, service principal will be used instead. Known values are: "SystemAssigned", - "UserAssigned", "None". + "UserAssigned", and "None". :paramtype type: str or ~azure.mgmt.containerservice.v2020_12_01.models.ResourceIdentityType :keyword user_assigned_identities: The user identity associated with the managed cluster. This identity will be used in control plane and only one user assigned identity is allowed. The user @@ -3212,14 +3230,14 @@ def __init__( :paramtype user_assigned_identities: dict[str, ~azure.mgmt.containerservice.v2020_12_01.models.Components1Umhcm8SchemasManagedclusteridentityPropertiesUserassignedidentitiesAdditionalproperties] """ - super(ManagedClusterIdentity, self).__init__(**kwargs) + super().__init__(**kwargs) self.principal_id = None self.tenant_id = None self.type = type self.user_assigned_identities = user_assigned_identities -class ManagedClusterListResult(msrest.serialization.Model): +class ManagedClusterListResult(_serialization.Model): """The response from the List Managed Clusters operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -3231,30 +3249,25 @@ class ManagedClusterListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[ManagedCluster]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[ManagedCluster]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.ManagedCluster"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.ManagedCluster"]] = None, **kwargs): """ :keyword value: The list of managed clusters. :paramtype value: list[~azure.mgmt.containerservice.v2020_12_01.models.ManagedCluster] """ - super(ManagedClusterListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class ManagedClusterLoadBalancerProfile(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfile(_serialization.Model): """Profile of the managed cluster load balancer. :ivar managed_outbound_i_ps: Desired managed outbound IPs for the cluster load balancer. @@ -3280,17 +3293,23 @@ class ManagedClusterLoadBalancerProfile(msrest.serialization.Model): """ _validation = { - 'allocated_outbound_ports': {'maximum': 64000, 'minimum': 0}, - 'idle_timeout_in_minutes': {'maximum': 120, 'minimum': 4}, + "allocated_outbound_ports": {"maximum": 64000, "minimum": 0}, + "idle_timeout_in_minutes": {"maximum": 120, "minimum": 4}, } _attribute_map = { - 'managed_outbound_i_ps': {'key': 'managedOutboundIPs', 'type': 'ManagedClusterLoadBalancerProfileManagedOutboundIPs'}, - 'outbound_ip_prefixes': {'key': 'outboundIPPrefixes', 'type': 'ManagedClusterLoadBalancerProfileOutboundIPPrefixes'}, - 'outbound_i_ps': {'key': 'outboundIPs', 'type': 'ManagedClusterLoadBalancerProfileOutboundIPs'}, - 'effective_outbound_i_ps': {'key': 'effectiveOutboundIPs', 'type': '[ResourceReference]'}, - 'allocated_outbound_ports': {'key': 'allocatedOutboundPorts', 'type': 'int'}, - 'idle_timeout_in_minutes': {'key': 'idleTimeoutInMinutes', 'type': 'int'}, + "managed_outbound_i_ps": { + "key": "managedOutboundIPs", + "type": "ManagedClusterLoadBalancerProfileManagedOutboundIPs", + }, + "outbound_ip_prefixes": { + "key": "outboundIPPrefixes", + "type": "ManagedClusterLoadBalancerProfileOutboundIPPrefixes", + }, + "outbound_i_ps": {"key": "outboundIPs", "type": "ManagedClusterLoadBalancerProfileOutboundIPs"}, + "effective_outbound_i_ps": {"key": "effectiveOutboundIPs", "type": "[ResourceReference]"}, + "allocated_outbound_ports": {"key": "allocatedOutboundPorts", "type": "int"}, + "idle_timeout_in_minutes": {"key": "idleTimeoutInMinutes", "type": "int"}, } def __init__( @@ -3300,8 +3319,8 @@ def __init__( outbound_ip_prefixes: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPPrefixes"] = None, outbound_i_ps: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPs"] = None, effective_outbound_i_ps: Optional[List["_models.ResourceReference"]] = None, - allocated_outbound_ports: Optional[int] = 0, - idle_timeout_in_minutes: Optional[int] = 30, + allocated_outbound_ports: int = 0, + idle_timeout_in_minutes: int = 30, **kwargs ): """ @@ -3327,7 +3346,7 @@ def __init__( must be in the range of 4 to 120 (inclusive). The default value is 30 minutes. :paramtype idle_timeout_in_minutes: int """ - super(ManagedClusterLoadBalancerProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.managed_outbound_i_ps = managed_outbound_i_ps self.outbound_ip_prefixes = outbound_ip_prefixes self.outbound_i_ps = outbound_i_ps @@ -3336,7 +3355,7 @@ def __init__( self.idle_timeout_in_minutes = idle_timeout_in_minutes -class ManagedClusterLoadBalancerProfileManagedOutboundIPs(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfileManagedOutboundIPs(_serialization.Model): """Desired managed outbound IPs for the cluster load balancer. :ivar count: Desired number of outbound IP created/managed by Azure for the cluster load @@ -3345,29 +3364,24 @@ class ManagedClusterLoadBalancerProfileManagedOutboundIPs(msrest.serialization.M """ _validation = { - 'count': {'maximum': 100, 'minimum': 1}, + "count": {"maximum": 100, "minimum": 1}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, + "count": {"key": "count", "type": "int"}, } - def __init__( - self, - *, - count: Optional[int] = 1, - **kwargs - ): + def __init__(self, *, count: int = 1, **kwargs): """ :keyword count: Desired number of outbound IP created/managed by Azure for the cluster load balancer. Allowed values must be in the range of 1 to 100 (inclusive). The default value is 1. :paramtype count: int """ - super(ManagedClusterLoadBalancerProfileManagedOutboundIPs, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count -class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(_serialization.Model): """Desired outbound IP Prefix resources for the cluster load balancer. :ivar public_ip_prefixes: A list of public IP prefix resources. @@ -3376,25 +3390,20 @@ class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(msrest.serialization.M """ _attribute_map = { - 'public_ip_prefixes': {'key': 'publicIPPrefixes', 'type': '[ResourceReference]'}, + "public_ip_prefixes": {"key": "publicIPPrefixes", "type": "[ResourceReference]"}, } - def __init__( - self, - *, - public_ip_prefixes: Optional[List["_models.ResourceReference"]] = None, - **kwargs - ): + def __init__(self, *, public_ip_prefixes: Optional[List["_models.ResourceReference"]] = None, **kwargs): """ :keyword public_ip_prefixes: A list of public IP prefix resources. :paramtype public_ip_prefixes: list[~azure.mgmt.containerservice.v2020_12_01.models.ResourceReference] """ - super(ManagedClusterLoadBalancerProfileOutboundIPPrefixes, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_ip_prefixes = public_ip_prefixes -class ManagedClusterLoadBalancerProfileOutboundIPs(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfileOutboundIPs(_serialization.Model): """Desired outbound IP resources for the cluster load balancer. :ivar public_i_ps: A list of public IP resources. @@ -3402,38 +3411,33 @@ class ManagedClusterLoadBalancerProfileOutboundIPs(msrest.serialization.Model): """ _attribute_map = { - 'public_i_ps': {'key': 'publicIPs', 'type': '[ResourceReference]'}, + "public_i_ps": {"key": "publicIPs", "type": "[ResourceReference]"}, } - def __init__( - self, - *, - public_i_ps: Optional[List["_models.ResourceReference"]] = None, - **kwargs - ): + def __init__(self, *, public_i_ps: Optional[List["_models.ResourceReference"]] = None, **kwargs): """ :keyword public_i_ps: A list of public IP resources. :paramtype public_i_ps: list[~azure.mgmt.containerservice.v2020_12_01.models.ResourceReference] """ - super(ManagedClusterLoadBalancerProfileOutboundIPs, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_i_ps = public_i_ps -class ManagedClusterPodIdentity(msrest.serialization.Model): +class ManagedClusterPodIdentity(_serialization.Model): """ManagedClusterPodIdentity. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar name: Required. Name of the pod identity. + :ivar name: Name of the pod identity. Required. :vartype name: str - :ivar namespace: Required. Namespace of the pod identity. + :ivar namespace: Namespace of the pod identity. Required. :vartype namespace: str - :ivar identity: Required. Information of the user assigned identity. + :ivar identity: Information of the user assigned identity. Required. :vartype identity: ~azure.mgmt.containerservice.v2020_12_01.models.UserAssignedIdentity :ivar provisioning_state: The current provisioning state of the pod identity. Known values are: - "Assigned", "Updating", "Deleting", "Failed". + "Assigned", "Updating", "Deleting", and "Failed". :vartype provisioning_state: str or ~azure.mgmt.containerservice.v2020_12_01.models.ManagedClusterPodIdentityProvisioningState :ivar provisioning_info: @@ -3442,38 +3446,31 @@ class ManagedClusterPodIdentity(msrest.serialization.Model): """ _validation = { - 'name': {'required': True}, - 'namespace': {'required': True}, - 'identity': {'required': True}, - 'provisioning_state': {'readonly': True}, - 'provisioning_info': {'readonly': True}, + "name": {"required": True}, + "namespace": {"required": True}, + "identity": {"required": True}, + "provisioning_state": {"readonly": True}, + "provisioning_info": {"readonly": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'namespace': {'key': 'namespace', 'type': 'str'}, - 'identity': {'key': 'identity', 'type': 'UserAssignedIdentity'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'provisioning_info': {'key': 'provisioningInfo', 'type': 'ManagedClusterPodIdentityProvisioningInfo'}, + "name": {"key": "name", "type": "str"}, + "namespace": {"key": "namespace", "type": "str"}, + "identity": {"key": "identity", "type": "UserAssignedIdentity"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "provisioning_info": {"key": "provisioningInfo", "type": "ManagedClusterPodIdentityProvisioningInfo"}, } - def __init__( - self, - *, - name: str, - namespace: str, - identity: "_models.UserAssignedIdentity", - **kwargs - ): + def __init__(self, *, name: str, namespace: str, identity: "_models.UserAssignedIdentity", **kwargs): """ - :keyword name: Required. Name of the pod identity. + :keyword name: Name of the pod identity. Required. :paramtype name: str - :keyword namespace: Required. Namespace of the pod identity. + :keyword namespace: Namespace of the pod identity. Required. :paramtype namespace: str - :keyword identity: Required. Information of the user assigned identity. + :keyword identity: Information of the user assigned identity. Required. :paramtype identity: ~azure.mgmt.containerservice.v2020_12_01.models.UserAssignedIdentity """ - super(ManagedClusterPodIdentity, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.namespace = namespace self.identity = identity @@ -3481,54 +3478,47 @@ def __init__( self.provisioning_info = None -class ManagedClusterPodIdentityException(msrest.serialization.Model): +class ManagedClusterPodIdentityException(_serialization.Model): """ManagedClusterPodIdentityException. All required parameters must be populated in order to send to Azure. - :ivar name: Required. Name of the pod identity exception. + :ivar name: Name of the pod identity exception. Required. :vartype name: str - :ivar namespace: Required. Namespace of the pod identity exception. + :ivar namespace: Namespace of the pod identity exception. Required. :vartype namespace: str - :ivar pod_labels: Required. Pod labels to match. + :ivar pod_labels: Pod labels to match. Required. :vartype pod_labels: dict[str, str] """ _validation = { - 'name': {'required': True}, - 'namespace': {'required': True}, - 'pod_labels': {'required': True}, + "name": {"required": True}, + "namespace": {"required": True}, + "pod_labels": {"required": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'namespace': {'key': 'namespace', 'type': 'str'}, - 'pod_labels': {'key': 'podLabels', 'type': '{str}'}, + "name": {"key": "name", "type": "str"}, + "namespace": {"key": "namespace", "type": "str"}, + "pod_labels": {"key": "podLabels", "type": "{str}"}, } - def __init__( - self, - *, - name: str, - namespace: str, - pod_labels: Dict[str, str], - **kwargs - ): + def __init__(self, *, name: str, namespace: str, pod_labels: Dict[str, str], **kwargs): """ - :keyword name: Required. Name of the pod identity exception. + :keyword name: Name of the pod identity exception. Required. :paramtype name: str - :keyword namespace: Required. Namespace of the pod identity exception. + :keyword namespace: Namespace of the pod identity exception. Required. :paramtype namespace: str - :keyword pod_labels: Required. Pod labels to match. + :keyword pod_labels: Pod labels to match. Required. :paramtype pod_labels: dict[str, str] """ - super(ManagedClusterPodIdentityException, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.namespace = namespace self.pod_labels = pod_labels -class ManagedClusterPodIdentityProfile(msrest.serialization.Model): +class ManagedClusterPodIdentityProfile(_serialization.Model): """ManagedClusterPodIdentityProfile. :ivar enabled: Whether the pod identity addon is enabled. @@ -3542,9 +3532,12 @@ class ManagedClusterPodIdentityProfile(msrest.serialization.Model): """ _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '[ManagedClusterPodIdentity]'}, - 'user_assigned_identity_exceptions': {'key': 'userAssignedIdentityExceptions', 'type': '[ManagedClusterPodIdentityException]'}, + "enabled": {"key": "enabled", "type": "bool"}, + "user_assigned_identities": {"key": "userAssignedIdentities", "type": "[ManagedClusterPodIdentity]"}, + "user_assigned_identity_exceptions": { + "key": "userAssignedIdentityExceptions", + "type": "[ManagedClusterPodIdentityException]", + }, } def __init__( @@ -3565,13 +3558,13 @@ def __init__( :paramtype user_assigned_identity_exceptions: list[~azure.mgmt.containerservice.v2020_12_01.models.ManagedClusterPodIdentityException] """ - super(ManagedClusterPodIdentityProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.user_assigned_identities = user_assigned_identities self.user_assigned_identity_exceptions = user_assigned_identity_exceptions -class ManagedClusterPodIdentityProvisioningInfo(msrest.serialization.Model): +class ManagedClusterPodIdentityProvisioningInfo(_serialization.Model): """ManagedClusterPodIdentityProvisioningInfo. :ivar error: Pod identity assignment error (if any). @@ -3579,34 +3572,29 @@ class ManagedClusterPodIdentityProvisioningInfo(msrest.serialization.Model): """ _attribute_map = { - 'error': {'key': 'error', 'type': 'CloudError'}, + "error": {"key": "error", "type": "CloudError"}, } - def __init__( - self, - *, - error: Optional["_models.CloudError"] = None, - **kwargs - ): + def __init__(self, *, error: Optional["_models.CloudError"] = None, **kwargs): """ :keyword error: Pod identity assignment error (if any). :paramtype error: ~azure.mgmt.containerservice.v2020_12_01.models.CloudError """ - super(ManagedClusterPodIdentityProvisioningInfo, self).__init__(**kwargs) + super().__init__(**kwargs) self.error = error -class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): +class ManagedClusterPoolUpgradeProfile(_serialization.Model): """The list of available upgrade versions. All required parameters must be populated in order to send to Azure. - :ivar kubernetes_version: Required. Kubernetes version (major, minor, patch). + :ivar kubernetes_version: Kubernetes version (major, minor, patch). Required. :vartype kubernetes_version: str :ivar name: Pool name. :vartype name: str - :ivar os_type: Required. OsType to be used to specify os type. Choose from Linux and Windows. - Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to + Linux. Known values are: "Linux" and "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2020_12_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -3614,15 +3602,15 @@ class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): """ _validation = { - 'kubernetes_version': {'required': True}, - 'os_type': {'required': True}, + "kubernetes_version": {"required": True}, + "os_type": {"required": True}, } _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'upgrades': {'key': 'upgrades', 'type': '[ManagedClusterPoolUpgradeProfileUpgradesItem]'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "os_type": {"key": "osType", "type": "str"}, + "upgrades": {"key": "upgrades", "type": "[ManagedClusterPoolUpgradeProfileUpgradesItem]"}, } def __init__( @@ -3635,25 +3623,25 @@ def __init__( **kwargs ): """ - :keyword kubernetes_version: Required. Kubernetes version (major, minor, patch). + :keyword kubernetes_version: Kubernetes version (major, minor, patch). Required. :paramtype kubernetes_version: str :keyword name: Pool name. :paramtype name: str - :keyword os_type: Required. OsType to be used to specify os type. Choose from Linux and - Windows. Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default + to Linux. Known values are: "Linux" and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2020_12_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: list[~azure.mgmt.containerservice.v2020_12_01.models.ManagedClusterPoolUpgradeProfileUpgradesItem] """ - super(ManagedClusterPoolUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.name = name self.os_type = os_type self.upgrades = upgrades -class ManagedClusterPoolUpgradeProfileUpgradesItem(msrest.serialization.Model): +class ManagedClusterPoolUpgradeProfileUpgradesItem(_serialization.Model): """ManagedClusterPoolUpgradeProfileUpgradesItem. :ivar kubernetes_version: Kubernetes version (major, minor, patch). @@ -3663,34 +3651,28 @@ class ManagedClusterPoolUpgradeProfileUpgradesItem(msrest.serialization.Model): """ _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } - def __init__( - self, - *, - kubernetes_version: Optional[str] = None, - is_preview: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, kubernetes_version: Optional[str] = None, is_preview: Optional[bool] = None, **kwargs): """ :keyword kubernetes_version: Kubernetes version (major, minor, patch). :paramtype kubernetes_version: str :keyword is_preview: Whether Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(ManagedClusterPoolUpgradeProfileUpgradesItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.is_preview = is_preview -class ManagedClusterPropertiesAutoScalerProfile(msrest.serialization.Model): +class ManagedClusterPropertiesAutoScalerProfile(_serialization.Model): # pylint: disable=too-many-instance-attributes """Parameters to be applied to the cluster-autoscaler when enabled. :ivar balance_similar_node_groups: :vartype balance_similar_node_groups: str - :ivar expander: Known values are: "least-waste", "most-pods", "priority", "random". + :ivar expander: Known values are: "least-waste", "most-pods", "priority", and "random". :vartype expander: str or ~azure.mgmt.containerservice.v2020_12_01.models.Expander :ivar max_empty_bulk_delete: :vartype max_empty_bulk_delete: str @@ -3725,23 +3707,23 @@ class ManagedClusterPropertiesAutoScalerProfile(msrest.serialization.Model): """ _attribute_map = { - 'balance_similar_node_groups': {'key': 'balance-similar-node-groups', 'type': 'str'}, - 'expander': {'key': 'expander', 'type': 'str'}, - 'max_empty_bulk_delete': {'key': 'max-empty-bulk-delete', 'type': 'str'}, - 'max_graceful_termination_sec': {'key': 'max-graceful-termination-sec', 'type': 'str'}, - 'max_node_provision_time': {'key': 'max-node-provision-time', 'type': 'str'}, - 'max_total_unready_percentage': {'key': 'max-total-unready-percentage', 'type': 'str'}, - 'new_pod_scale_up_delay': {'key': 'new-pod-scale-up-delay', 'type': 'str'}, - 'ok_total_unready_count': {'key': 'ok-total-unready-count', 'type': 'str'}, - 'scan_interval': {'key': 'scan-interval', 'type': 'str'}, - 'scale_down_delay_after_add': {'key': 'scale-down-delay-after-add', 'type': 'str'}, - 'scale_down_delay_after_delete': {'key': 'scale-down-delay-after-delete', 'type': 'str'}, - 'scale_down_delay_after_failure': {'key': 'scale-down-delay-after-failure', 'type': 'str'}, - 'scale_down_unneeded_time': {'key': 'scale-down-unneeded-time', 'type': 'str'}, - 'scale_down_unready_time': {'key': 'scale-down-unready-time', 'type': 'str'}, - 'scale_down_utilization_threshold': {'key': 'scale-down-utilization-threshold', 'type': 'str'}, - 'skip_nodes_with_local_storage': {'key': 'skip-nodes-with-local-storage', 'type': 'str'}, - 'skip_nodes_with_system_pods': {'key': 'skip-nodes-with-system-pods', 'type': 'str'}, + "balance_similar_node_groups": {"key": "balance-similar-node-groups", "type": "str"}, + "expander": {"key": "expander", "type": "str"}, + "max_empty_bulk_delete": {"key": "max-empty-bulk-delete", "type": "str"}, + "max_graceful_termination_sec": {"key": "max-graceful-termination-sec", "type": "str"}, + "max_node_provision_time": {"key": "max-node-provision-time", "type": "str"}, + "max_total_unready_percentage": {"key": "max-total-unready-percentage", "type": "str"}, + "new_pod_scale_up_delay": {"key": "new-pod-scale-up-delay", "type": "str"}, + "ok_total_unready_count": {"key": "ok-total-unready-count", "type": "str"}, + "scan_interval": {"key": "scan-interval", "type": "str"}, + "scale_down_delay_after_add": {"key": "scale-down-delay-after-add", "type": "str"}, + "scale_down_delay_after_delete": {"key": "scale-down-delay-after-delete", "type": "str"}, + "scale_down_delay_after_failure": {"key": "scale-down-delay-after-failure", "type": "str"}, + "scale_down_unneeded_time": {"key": "scale-down-unneeded-time", "type": "str"}, + "scale_down_unready_time": {"key": "scale-down-unready-time", "type": "str"}, + "scale_down_utilization_threshold": {"key": "scale-down-utilization-threshold", "type": "str"}, + "skip_nodes_with_local_storage": {"key": "skip-nodes-with-local-storage", "type": "str"}, + "skip_nodes_with_system_pods": {"key": "skip-nodes-with-system-pods", "type": "str"}, } def __init__( @@ -3769,7 +3751,7 @@ def __init__( """ :keyword balance_similar_node_groups: :paramtype balance_similar_node_groups: str - :keyword expander: Known values are: "least-waste", "most-pods", "priority", "random". + :keyword expander: Known values are: "least-waste", "most-pods", "priority", and "random". :paramtype expander: str or ~azure.mgmt.containerservice.v2020_12_01.models.Expander :keyword max_empty_bulk_delete: :paramtype max_empty_bulk_delete: str @@ -3802,7 +3784,7 @@ def __init__( :keyword skip_nodes_with_system_pods: :paramtype skip_nodes_with_system_pods: str """ - super(ManagedClusterPropertiesAutoScalerProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.balance_similar_node_groups = balance_similar_node_groups self.expander = expander self.max_empty_bulk_delete = max_empty_bulk_delete @@ -3822,56 +3804,50 @@ def __init__( self.skip_nodes_with_system_pods = skip_nodes_with_system_pods -class ManagedClusterServicePrincipalProfile(msrest.serialization.Model): +class ManagedClusterServicePrincipalProfile(_serialization.Model): """Information about a service principal identity for the cluster to use for manipulating Azure APIs. All required parameters must be populated in order to send to Azure. - :ivar client_id: Required. The ID for the service principal. + :ivar client_id: The ID for the service principal. Required. :vartype client_id: str :ivar secret: The secret password associated with the service principal in plain text. :vartype secret: str """ _validation = { - 'client_id': {'required': True}, + "client_id": {"required": True}, } _attribute_map = { - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'secret': {'key': 'secret', 'type': 'str'}, + "client_id": {"key": "clientId", "type": "str"}, + "secret": {"key": "secret", "type": "str"}, } - def __init__( - self, - *, - client_id: str, - secret: Optional[str] = None, - **kwargs - ): + def __init__(self, *, client_id: str, secret: Optional[str] = None, **kwargs): """ - :keyword client_id: Required. The ID for the service principal. + :keyword client_id: The ID for the service principal. Required. :paramtype client_id: str :keyword secret: The secret password associated with the service principal in plain text. :paramtype secret: str """ - super(ManagedClusterServicePrincipalProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.client_id = client_id self.secret = secret -class ManagedClusterSKU(msrest.serialization.Model): +class ManagedClusterSKU(_serialization.Model): """ManagedClusterSKU. - :ivar name: Name of a managed cluster SKU. Known values are: "Basic". + :ivar name: Name of a managed cluster SKU. "Basic" :vartype name: str or ~azure.mgmt.containerservice.v2020_12_01.models.ManagedClusterSKUName - :ivar tier: Tier of a managed cluster SKU. Known values are: "Paid", "Free". + :ivar tier: Tier of a managed cluster SKU. Known values are: "Paid" and "Free". :vartype tier: str or ~azure.mgmt.containerservice.v2020_12_01.models.ManagedClusterSKUTier """ _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, + "name": {"key": "name", "type": "str"}, + "tier": {"key": "tier", "type": "str"}, } def __init__( @@ -3882,17 +3858,17 @@ def __init__( **kwargs ): """ - :keyword name: Name of a managed cluster SKU. Known values are: "Basic". + :keyword name: Name of a managed cluster SKU. "Basic" :paramtype name: str or ~azure.mgmt.containerservice.v2020_12_01.models.ManagedClusterSKUName - :keyword tier: Tier of a managed cluster SKU. Known values are: "Paid", "Free". + :keyword tier: Tier of a managed cluster SKU. Known values are: "Paid" and "Free". :paramtype tier: str or ~azure.mgmt.containerservice.v2020_12_01.models.ManagedClusterSKUTier """ - super(ManagedClusterSKU, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.tier = tier -class ManagedClusterUpgradeProfile(msrest.serialization.Model): +class ManagedClusterUpgradeProfile(_serialization.Model): """The list of available upgrades for compute pools. Variables are only populated by the server, and will be ignored when sending a request. @@ -3905,29 +3881,29 @@ class ManagedClusterUpgradeProfile(msrest.serialization.Model): :vartype name: str :ivar type: Type of upgrade profile. :vartype type: str - :ivar control_plane_profile: Required. The list of available upgrade versions for the control - plane. + :ivar control_plane_profile: The list of available upgrade versions for the control plane. + Required. :vartype control_plane_profile: ~azure.mgmt.containerservice.v2020_12_01.models.ManagedClusterPoolUpgradeProfile - :ivar agent_pool_profiles: Required. The list of available upgrade versions for agent pools. + :ivar agent_pool_profiles: The list of available upgrade versions for agent pools. Required. :vartype agent_pool_profiles: list[~azure.mgmt.containerservice.v2020_12_01.models.ManagedClusterPoolUpgradeProfile] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'control_plane_profile': {'required': True}, - 'agent_pool_profiles': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "control_plane_profile": {"required": True}, + "agent_pool_profiles": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'control_plane_profile': {'key': 'properties.controlPlaneProfile', 'type': 'ManagedClusterPoolUpgradeProfile'}, - 'agent_pool_profiles': {'key': 'properties.agentPoolProfiles', 'type': '[ManagedClusterPoolUpgradeProfile]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "control_plane_profile": {"key": "properties.controlPlaneProfile", "type": "ManagedClusterPoolUpgradeProfile"}, + "agent_pool_profiles": {"key": "properties.agentPoolProfiles", "type": "[ManagedClusterPoolUpgradeProfile]"}, } def __init__( @@ -3938,15 +3914,15 @@ def __init__( **kwargs ): """ - :keyword control_plane_profile: Required. The list of available upgrade versions for the - control plane. + :keyword control_plane_profile: The list of available upgrade versions for the control plane. + Required. :paramtype control_plane_profile: ~azure.mgmt.containerservice.v2020_12_01.models.ManagedClusterPoolUpgradeProfile - :keyword agent_pool_profiles: Required. The list of available upgrade versions for agent pools. + :keyword agent_pool_profiles: The list of available upgrade versions for agent pools. Required. :paramtype agent_pool_profiles: list[~azure.mgmt.containerservice.v2020_12_01.models.ManagedClusterPoolUpgradeProfile] """ - super(ManagedClusterUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -3954,18 +3930,18 @@ def __init__( self.agent_pool_profiles = agent_pool_profiles -class ManagedClusterWindowsProfile(msrest.serialization.Model): +class ManagedClusterWindowsProfile(_serialization.Model): """Profile for Windows VMs in the container service cluster. All required parameters must be populated in order to send to Azure. - :ivar admin_username: Required. Specifies the name of the administrator account. - :code:`
`:code:`
` **restriction:** Cannot end in "." :code:`
`:code:`
` - **Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", "test1", - "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", - "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", - "sys", "test2", "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 - character :code:`
`:code:`
` **Max-length:** 20 characters. + :ivar admin_username: Specifies the name of the administrator account. :code:`
`:code:`
` + **restriction:** Cannot end in "." :code:`
`:code:`
` **Disallowed values:** + "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", + "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", + "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", + "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 character + :code:`
`:code:`
` **Max-length:** 20 characters. Required. :vartype admin_username: str :ivar admin_password: Specifies the password of the administrator account. :code:`
`:code:`
` **Minimum-length:** 8 characters :code:`
`:code:`
` @@ -3976,18 +3952,18 @@ class ManagedClusterWindowsProfile(msrest.serialization.Model): "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!". :vartype admin_password: str :ivar license_type: The licenseType to use for Windows VMs. Windows_Server is used to enable - Azure Hybrid User Benefits for Windows VMs. Known values are: "None", "Windows_Server". + Azure Hybrid User Benefits for Windows VMs. Known values are: "None" and "Windows_Server". :vartype license_type: str or ~azure.mgmt.containerservice.v2020_12_01.models.LicenseType """ _validation = { - 'admin_username': {'required': True}, + "admin_username": {"required": True}, } _attribute_map = { - 'admin_username': {'key': 'adminUsername', 'type': 'str'}, - 'admin_password': {'key': 'adminPassword', 'type': 'str'}, - 'license_type': {'key': 'licenseType', 'type': 'str'}, + "admin_username": {"key": "adminUsername", "type": "str"}, + "admin_password": {"key": "adminPassword", "type": "str"}, + "license_type": {"key": "licenseType", "type": "str"}, } def __init__( @@ -3999,13 +3975,13 @@ def __init__( **kwargs ): """ - :keyword admin_username: Required. Specifies the name of the administrator account. + :keyword admin_username: Specifies the name of the administrator account. :code:`
`:code:`
` **restriction:** Cannot end in "." :code:`
`:code:`
` **Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 - character :code:`
`:code:`
` **Max-length:** 20 characters. + character :code:`
`:code:`
` **Max-length:** 20 characters. Required. :paramtype admin_username: str :keyword admin_password: Specifies the password of the administrator account. :code:`
`:code:`
` **Minimum-length:** 8 characters :code:`
`:code:`
` @@ -4016,16 +3992,16 @@ def __init__( "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!". :paramtype admin_password: str :keyword license_type: The licenseType to use for Windows VMs. Windows_Server is used to enable - Azure Hybrid User Benefits for Windows VMs. Known values are: "None", "Windows_Server". + Azure Hybrid User Benefits for Windows VMs. Known values are: "None" and "Windows_Server". :paramtype license_type: str or ~azure.mgmt.containerservice.v2020_12_01.models.LicenseType """ - super(ManagedClusterWindowsProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.admin_username = admin_username self.admin_password = admin_password self.license_type = license_type -class OperationListResult(msrest.serialization.Model): +class OperationListResult(_serialization.Model): """The List Compute Operation operation response. Variables are only populated by the server, and will be ignored when sending a request. @@ -4035,24 +4011,20 @@ class OperationListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[OperationValue]'}, + "value": {"key": "value", "type": "[OperationValue]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(OperationListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None -class OperationValue(msrest.serialization.Model): +class OperationValue(_serialization.Model): """Describes the properties of a Compute Operation value. Variables are only populated by the server, and will be ignored when sending a request. @@ -4072,30 +4044,26 @@ class OperationValue(msrest.serialization.Model): """ _validation = { - 'origin': {'readonly': True}, - 'name': {'readonly': True}, - 'operation': {'readonly': True}, - 'resource': {'readonly': True}, - 'description': {'readonly': True}, - 'provider': {'readonly': True}, + "origin": {"readonly": True}, + "name": {"readonly": True}, + "operation": {"readonly": True}, + "resource": {"readonly": True}, + "description": {"readonly": True}, + "provider": {"readonly": True}, } _attribute_map = { - 'origin': {'key': 'origin', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'operation': {'key': 'display.operation', 'type': 'str'}, - 'resource': {'key': 'display.resource', 'type': 'str'}, - 'description': {'key': 'display.description', 'type': 'str'}, - 'provider': {'key': 'display.provider', 'type': 'str'}, + "origin": {"key": "origin", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "operation": {"key": "display.operation", "type": "str"}, + "resource": {"key": "display.resource", "type": "str"}, + "description": {"key": "display.description", "type": "str"}, + "provider": {"key": "display.provider", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(OperationValue, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.origin = None self.name = None self.operation = None @@ -4104,34 +4072,29 @@ def __init__( self.provider = None -class PowerState(msrest.serialization.Model): +class PowerState(_serialization.Model): """Describes the Power State of the cluster. - :ivar code: Tells whether the cluster is Running or Stopped. Known values are: "Running", + :ivar code: Tells whether the cluster is Running or Stopped. Known values are: "Running" and "Stopped". :vartype code: str or ~azure.mgmt.containerservice.v2020_12_01.models.Code """ _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, + "code": {"key": "code", "type": "str"}, } - def __init__( - self, - *, - code: Optional[Union[str, "_models.Code"]] = None, - **kwargs - ): + def __init__(self, *, code: Optional[Union[str, "_models.Code"]] = None, **kwargs): """ - :keyword code: Tells whether the cluster is Running or Stopped. Known values are: "Running", + :keyword code: Tells whether the cluster is Running or Stopped. Known values are: "Running" and "Stopped". :paramtype code: str or ~azure.mgmt.containerservice.v2020_12_01.models.Code """ - super(PowerState, self).__init__(**kwargs) + super().__init__(**kwargs) self.code = code -class PrivateEndpoint(msrest.serialization.Model): +class PrivateEndpoint(_serialization.Model): """Private endpoint which a connection belongs to. :ivar id: The resource Id for private endpoint. @@ -4139,24 +4102,19 @@ class PrivateEndpoint(msrest.serialization.Model): """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, } - def __init__( - self, - *, - id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin """ :keyword id: The resource Id for private endpoint. :paramtype id: str """ - super(PrivateEndpoint, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id -class PrivateEndpointConnection(msrest.serialization.Model): +class PrivateEndpointConnection(_serialization.Model): """A private endpoint connection. Variables are only populated by the server, and will be ignored when sending a request. @@ -4168,7 +4126,7 @@ class PrivateEndpointConnection(msrest.serialization.Model): :ivar type: The resource type. :vartype type: str :ivar provisioning_state: The current provisioning state. Known values are: "Succeeded", - "Creating", "Deleting", "Failed". + "Creating", "Deleting", and "Failed". :vartype provisioning_state: str or ~azure.mgmt.containerservice.v2020_12_01.models.PrivateEndpointConnectionProvisioningState :ivar private_endpoint: The resource of private endpoint. @@ -4180,19 +4138,22 @@ class PrivateEndpointConnection(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'provisioning_state': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, - 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "private_endpoint": {"key": "properties.privateEndpoint", "type": "PrivateEndpoint"}, + "private_link_service_connection_state": { + "key": "properties.privateLinkServiceConnectionState", + "type": "PrivateLinkServiceConnectionState", + }, } def __init__( @@ -4210,7 +4171,7 @@ def __init__( :paramtype private_link_service_connection_state: ~azure.mgmt.containerservice.v2020_12_01.models.PrivateLinkServiceConnectionState """ - super(PrivateEndpointConnection, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -4219,7 +4180,7 @@ def __init__( self.private_link_service_connection_state = private_link_service_connection_state -class PrivateEndpointConnectionListResult(msrest.serialization.Model): +class PrivateEndpointConnectionListResult(_serialization.Model): """A list of private endpoint connections. :ivar value: The collection value. @@ -4227,25 +4188,20 @@ class PrivateEndpointConnectionListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, + "value": {"key": "value", "type": "[PrivateEndpointConnection]"}, } - def __init__( - self, - *, - value: Optional[List["_models.PrivateEndpointConnection"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.PrivateEndpointConnection"]] = None, **kwargs): """ :keyword value: The collection value. :paramtype value: list[~azure.mgmt.containerservice.v2020_12_01.models.PrivateEndpointConnection] """ - super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value -class PrivateLinkResource(msrest.serialization.Model): +class PrivateLinkResource(_serialization.Model): """A private link resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -4266,22 +4222,22 @@ class PrivateLinkResource(msrest.serialization.Model): """ _validation = { - 'private_link_service_id': {'readonly': True}, + "private_link_service_id": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'group_id': {'key': 'groupId', 'type': 'str'}, - 'required_members': {'key': 'requiredMembers', 'type': '[str]'}, - 'private_link_service_id': {'key': 'privateLinkServiceID', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "group_id": {"key": "groupId", "type": "str"}, + "required_members": {"key": "requiredMembers", "type": "[str]"}, + "private_link_service_id": {"key": "privateLinkServiceID", "type": "str"}, } def __init__( self, *, - id: Optional[str] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin name: Optional[str] = None, type: Optional[str] = None, group_id: Optional[str] = None, @@ -4300,7 +4256,7 @@ def __init__( :keyword required_members: RequiredMembers of the resource. :paramtype required_members: list[str] """ - super(PrivateLinkResource, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id self.name = name self.type = type @@ -4309,7 +4265,7 @@ def __init__( self.private_link_service_id = None -class PrivateLinkResourcesListResult(msrest.serialization.Model): +class PrivateLinkResourcesListResult(_serialization.Model): """A list of private link resources. :ivar value: The collection value. @@ -4317,36 +4273,31 @@ class PrivateLinkResourcesListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, + "value": {"key": "value", "type": "[PrivateLinkResource]"}, } - def __init__( - self, - *, - value: Optional[List["_models.PrivateLinkResource"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.PrivateLinkResource"]] = None, **kwargs): """ :keyword value: The collection value. :paramtype value: list[~azure.mgmt.containerservice.v2020_12_01.models.PrivateLinkResource] """ - super(PrivateLinkResourcesListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value -class PrivateLinkServiceConnectionState(msrest.serialization.Model): +class PrivateLinkServiceConnectionState(_serialization.Model): """The state of a private link service connection. :ivar status: The private link service connection status. Known values are: "Pending", - "Approved", "Rejected", "Disconnected". + "Approved", "Rejected", and "Disconnected". :vartype status: str or ~azure.mgmt.containerservice.v2020_12_01.models.ConnectionStatus :ivar description: The private link service connection description. :vartype description: str """ _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, + "status": {"key": "status", "type": "str"}, + "description": {"key": "description", "type": "str"}, } def __init__( @@ -4358,17 +4309,17 @@ def __init__( ): """ :keyword status: The private link service connection status. Known values are: "Pending", - "Approved", "Rejected", "Disconnected". + "Approved", "Rejected", and "Disconnected". :paramtype status: str or ~azure.mgmt.containerservice.v2020_12_01.models.ConnectionStatus :keyword description: The private link service connection description. :paramtype description: str """ - super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) + super().__init__(**kwargs) self.status = status self.description = description -class ResourceReference(msrest.serialization.Model): +class ResourceReference(_serialization.Model): """A reference to an Azure resource. :ivar id: The fully qualified Azure resource id. @@ -4376,24 +4327,19 @@ class ResourceReference(msrest.serialization.Model): """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, } - def __init__( - self, - *, - id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin """ :keyword id: The fully qualified Azure resource id. :paramtype id: str """ - super(ResourceReference, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id -class SysctlConfig(msrest.serialization.Model): +class SysctlConfig(_serialization.Model): # pylint: disable=too-many-instance-attributes """Sysctl settings for Linux agent nodes. :ivar net_core_somaxconn: Sysctl setting net.core.somaxconn. @@ -4455,37 +4401,37 @@ class SysctlConfig(msrest.serialization.Model): """ _attribute_map = { - 'net_core_somaxconn': {'key': 'netCoreSomaxconn', 'type': 'int'}, - 'net_core_netdev_max_backlog': {'key': 'netCoreNetdevMaxBacklog', 'type': 'int'}, - 'net_core_rmem_default': {'key': 'netCoreRmemDefault', 'type': 'int'}, - 'net_core_rmem_max': {'key': 'netCoreRmemMax', 'type': 'int'}, - 'net_core_wmem_default': {'key': 'netCoreWmemDefault', 'type': 'int'}, - 'net_core_wmem_max': {'key': 'netCoreWmemMax', 'type': 'int'}, - 'net_core_optmem_max': {'key': 'netCoreOptmemMax', 'type': 'int'}, - 'net_ipv4_tcp_max_syn_backlog': {'key': 'netIpv4TcpMaxSynBacklog', 'type': 'int'}, - 'net_ipv4_tcp_max_tw_buckets': {'key': 'netIpv4TcpMaxTwBuckets', 'type': 'int'}, - 'net_ipv4_tcp_fin_timeout': {'key': 'netIpv4TcpFinTimeout', 'type': 'int'}, - 'net_ipv4_tcp_keepalive_time': {'key': 'netIpv4TcpKeepaliveTime', 'type': 'int'}, - 'net_ipv4_tcp_keepalive_probes': {'key': 'netIpv4TcpKeepaliveProbes', 'type': 'int'}, - 'net_ipv4_tcpkeepalive_intvl': {'key': 'netIpv4TcpkeepaliveIntvl', 'type': 'int'}, - 'net_ipv4_tcp_tw_reuse': {'key': 'netIpv4TcpTwReuse', 'type': 'bool'}, - 'net_ipv4_ip_local_port_range': {'key': 'netIpv4IpLocalPortRange', 'type': 'str'}, - 'net_ipv4_neigh_default_gc_thresh1': {'key': 'netIpv4NeighDefaultGcThresh1', 'type': 'int'}, - 'net_ipv4_neigh_default_gc_thresh2': {'key': 'netIpv4NeighDefaultGcThresh2', 'type': 'int'}, - 'net_ipv4_neigh_default_gc_thresh3': {'key': 'netIpv4NeighDefaultGcThresh3', 'type': 'int'}, - 'net_netfilter_nf_conntrack_max': {'key': 'netNetfilterNfConntrackMax', 'type': 'int'}, - 'net_netfilter_nf_conntrack_buckets': {'key': 'netNetfilterNfConntrackBuckets', 'type': 'int'}, - 'fs_inotify_max_user_watches': {'key': 'fsInotifyMaxUserWatches', 'type': 'int'}, - 'fs_file_max': {'key': 'fsFileMax', 'type': 'int'}, - 'fs_aio_max_nr': {'key': 'fsAioMaxNr', 'type': 'int'}, - 'fs_nr_open': {'key': 'fsNrOpen', 'type': 'int'}, - 'kernel_threads_max': {'key': 'kernelThreadsMax', 'type': 'int'}, - 'vm_max_map_count': {'key': 'vmMaxMapCount', 'type': 'int'}, - 'vm_swappiness': {'key': 'vmSwappiness', 'type': 'int'}, - 'vm_vfs_cache_pressure': {'key': 'vmVfsCachePressure', 'type': 'int'}, + "net_core_somaxconn": {"key": "netCoreSomaxconn", "type": "int"}, + "net_core_netdev_max_backlog": {"key": "netCoreNetdevMaxBacklog", "type": "int"}, + "net_core_rmem_default": {"key": "netCoreRmemDefault", "type": "int"}, + "net_core_rmem_max": {"key": "netCoreRmemMax", "type": "int"}, + "net_core_wmem_default": {"key": "netCoreWmemDefault", "type": "int"}, + "net_core_wmem_max": {"key": "netCoreWmemMax", "type": "int"}, + "net_core_optmem_max": {"key": "netCoreOptmemMax", "type": "int"}, + "net_ipv4_tcp_max_syn_backlog": {"key": "netIpv4TcpMaxSynBacklog", "type": "int"}, + "net_ipv4_tcp_max_tw_buckets": {"key": "netIpv4TcpMaxTwBuckets", "type": "int"}, + "net_ipv4_tcp_fin_timeout": {"key": "netIpv4TcpFinTimeout", "type": "int"}, + "net_ipv4_tcp_keepalive_time": {"key": "netIpv4TcpKeepaliveTime", "type": "int"}, + "net_ipv4_tcp_keepalive_probes": {"key": "netIpv4TcpKeepaliveProbes", "type": "int"}, + "net_ipv4_tcpkeepalive_intvl": {"key": "netIpv4TcpkeepaliveIntvl", "type": "int"}, + "net_ipv4_tcp_tw_reuse": {"key": "netIpv4TcpTwReuse", "type": "bool"}, + "net_ipv4_ip_local_port_range": {"key": "netIpv4IpLocalPortRange", "type": "str"}, + "net_ipv4_neigh_default_gc_thresh1": {"key": "netIpv4NeighDefaultGcThresh1", "type": "int"}, + "net_ipv4_neigh_default_gc_thresh2": {"key": "netIpv4NeighDefaultGcThresh2", "type": "int"}, + "net_ipv4_neigh_default_gc_thresh3": {"key": "netIpv4NeighDefaultGcThresh3", "type": "int"}, + "net_netfilter_nf_conntrack_max": {"key": "netNetfilterNfConntrackMax", "type": "int"}, + "net_netfilter_nf_conntrack_buckets": {"key": "netNetfilterNfConntrackBuckets", "type": "int"}, + "fs_inotify_max_user_watches": {"key": "fsInotifyMaxUserWatches", "type": "int"}, + "fs_file_max": {"key": "fsFileMax", "type": "int"}, + "fs_aio_max_nr": {"key": "fsAioMaxNr", "type": "int"}, + "fs_nr_open": {"key": "fsNrOpen", "type": "int"}, + "kernel_threads_max": {"key": "kernelThreadsMax", "type": "int"}, + "vm_max_map_count": {"key": "vmMaxMapCount", "type": "int"}, + "vm_swappiness": {"key": "vmSwappiness", "type": "int"}, + "vm_vfs_cache_pressure": {"key": "vmVfsCachePressure", "type": "int"}, } - def __init__( + def __init__( # pylint: disable=too-many-locals self, *, net_core_somaxconn: Optional[int] = None, @@ -4576,7 +4522,7 @@ def __init__( :keyword vm_vfs_cache_pressure: Sysctl setting vm.vfs_cache_pressure. :paramtype vm_vfs_cache_pressure: int """ - super(SysctlConfig, self).__init__(**kwargs) + super().__init__(**kwargs) self.net_core_somaxconn = net_core_somaxconn self.net_core_netdev_max_backlog = net_core_netdev_max_backlog self.net_core_rmem_default = net_core_rmem_default @@ -4607,20 +4553,20 @@ def __init__( self.vm_vfs_cache_pressure = vm_vfs_cache_pressure -class SystemData(msrest.serialization.Model): +class SystemData(_serialization.Model): """Metadata pertaining to creation and last modification of the resource. :ivar created_by: The identity that created the resource. :vartype created_by: str :ivar created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", "Key". + "User", "Application", "ManagedIdentity", and "Key". :vartype created_by_type: str or ~azure.mgmt.containerservice.v2020_12_01.models.CreatedByType :ivar created_at: The timestamp of resource creation (UTC). :vartype created_at: ~datetime.datetime :ivar last_modified_by: The identity that last modified the resource. :vartype last_modified_by: str :ivar last_modified_by_type: The type of identity that last modified the resource. Known values - are: "User", "Application", "ManagedIdentity", "Key". + are: "User", "Application", "ManagedIdentity", and "Key". :vartype last_modified_by_type: str or ~azure.mgmt.containerservice.v2020_12_01.models.CreatedByType :ivar last_modified_at: The type of identity that last modified the resource. @@ -4628,12 +4574,12 @@ class SystemData(msrest.serialization.Model): """ _attribute_map = { - 'created_by': {'key': 'createdBy', 'type': 'str'}, - 'created_by_type': {'key': 'createdByType', 'type': 'str'}, - 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, - 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, - 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, - 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + "created_by": {"key": "createdBy", "type": "str"}, + "created_by_type": {"key": "createdByType", "type": "str"}, + "created_at": {"key": "createdAt", "type": "iso-8601"}, + "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, + "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, + "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, } def __init__( @@ -4651,7 +4597,7 @@ def __init__( :keyword created_by: The identity that created the resource. :paramtype created_by: str :keyword created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", "Key". + "User", "Application", "ManagedIdentity", and "Key". :paramtype created_by_type: str or ~azure.mgmt.containerservice.v2020_12_01.models.CreatedByType :keyword created_at: The timestamp of resource creation (UTC). @@ -4659,13 +4605,13 @@ def __init__( :keyword last_modified_by: The identity that last modified the resource. :paramtype last_modified_by: str :keyword last_modified_by_type: The type of identity that last modified the resource. Known - values are: "User", "Application", "ManagedIdentity", "Key". + values are: "User", "Application", "ManagedIdentity", and "Key". :paramtype last_modified_by_type: str or ~azure.mgmt.containerservice.v2020_12_01.models.CreatedByType :keyword last_modified_at: The type of identity that last modified the resource. :paramtype last_modified_at: ~datetime.datetime """ - super(SystemData, self).__init__(**kwargs) + super().__init__(**kwargs) self.created_by = created_by self.created_by_type = created_by_type self.created_at = created_at @@ -4674,66 +4620,57 @@ def __init__( self.last_modified_at = last_modified_at -class TagsObject(msrest.serialization.Model): +class TagsObject(_serialization.Model): """Tags object for patch operations. - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] """ _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] """ - super(TagsObject, self).__init__(**kwargs) + super().__init__(**kwargs) self.tags = tags -class TimeInWeek(msrest.serialization.Model): +class TimeInWeek(_serialization.Model): """Time in a week. :ivar day: A day in a week. Known values are: "Sunday", "Monday", "Tuesday", "Wednesday", - "Thursday", "Friday", "Saturday". + "Thursday", "Friday", and "Saturday". :vartype day: str or ~azure.mgmt.containerservice.v2020_12_01.models.WeekDay :ivar hour_slots: hour slots in a day. :vartype hour_slots: list[int] """ _attribute_map = { - 'day': {'key': 'day', 'type': 'str'}, - 'hour_slots': {'key': 'hourSlots', 'type': '[int]'}, + "day": {"key": "day", "type": "str"}, + "hour_slots": {"key": "hourSlots", "type": "[int]"}, } def __init__( - self, - *, - day: Optional[Union[str, "_models.WeekDay"]] = None, - hour_slots: Optional[List[int]] = None, - **kwargs + self, *, day: Optional[Union[str, "_models.WeekDay"]] = None, hour_slots: Optional[List[int]] = None, **kwargs ): """ :keyword day: A day in a week. Known values are: "Sunday", "Monday", "Tuesday", "Wednesday", - "Thursday", "Friday", "Saturday". + "Thursday", "Friday", and "Saturday". :paramtype day: str or ~azure.mgmt.containerservice.v2020_12_01.models.WeekDay :keyword hour_slots: hour slots in a day. :paramtype hour_slots: list[int] """ - super(TimeInWeek, self).__init__(**kwargs) + super().__init__(**kwargs) self.day = day self.hour_slots = hour_slots -class TimeSpan(msrest.serialization.Model): +class TimeSpan(_serialization.Model): """The time span with start and end properties. :ivar start: The start of a time span. @@ -4743,23 +4680,17 @@ class TimeSpan(msrest.serialization.Model): """ _attribute_map = { - 'start': {'key': 'start', 'type': 'iso-8601'}, - 'end': {'key': 'end', 'type': 'iso-8601'}, + "start": {"key": "start", "type": "iso-8601"}, + "end": {"key": "end", "type": "iso-8601"}, } - def __init__( - self, - *, - start: Optional[datetime.datetime] = None, - end: Optional[datetime.datetime] = None, - **kwargs - ): + def __init__(self, *, start: Optional[datetime.datetime] = None, end: Optional[datetime.datetime] = None, **kwargs): """ :keyword start: The start of a time span. :paramtype start: ~datetime.datetime :keyword end: The end of a time span. :paramtype end: ~datetime.datetime """ - super(TimeSpan, self).__init__(**kwargs) + super().__init__(**kwargs) self.start = start self.end = end diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/models/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/models/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/models/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/models/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/operations/__init__.py index f0e265d9f2f4..f27b588ca549 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/operations/__init__.py @@ -17,14 +17,15 @@ from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'Operations', - 'ManagedClustersOperations', - 'MaintenanceConfigurationsOperations', - 'AgentPoolsOperations', - 'PrivateEndpointConnectionsOperations', - 'PrivateLinkResourcesOperations', - 'ResolvePrivateLinkServiceIdOperations', + "Operations", + "ManagedClustersOperations", + "MaintenanceConfigurationsOperations", + "AgentPoolsOperations", + "PrivateEndpointConnectionsOperations", + "PrivateLinkResourcesOperations", + "ResolvePrivateLinkServiceIdOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/operations/_agent_pools_operations.py index fbc8ae77123f..f0bc5d05c06b 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/operations/_agent_pools_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,288 +27,289 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - *, - json: Optional[_models.AgentPool] = None, - content: Any = None, - **kwargs: Any + _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, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + _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, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_get_upgrade_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_available_agent_pool_versions_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_upgrade_node_image_version_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_upgrade_node_image_version_request( + resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class AgentPoolsOperations: """ @@ -324,48 +330,40 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> Iterable[_models.AgentPoolListResult]: + def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> Iterable["_models.AgentPool"]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. The operation returns properties of each agent pool. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AgentPoolListResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_12_01.models.AgentPoolListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either AgentPool or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_12_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -373,16 +371,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -398,10 +391,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -411,54 +402,45 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore @distributed_trace def get( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPool: """Gets the agent pool. Gets the details of the agent pool by managed cluster and resource group. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPool, or the result of cls(response) + :return: AgentPool or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_12_01.models.AgentPool - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -466,57 +448,60 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore def _create_or_update_initial( self, resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: _models.AgentPool, + parameters: Union[_models.AgentPool, IO], **kwargs: Any ) -> _models.AgentPool: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - _json = self._serialize.body(parameters, 'AgentPool') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "AgentPool") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -524,10 +509,9 @@ def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -535,40 +519,125 @@ def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - @distributed_trace + @overload def begin_create_or_update( self, resource_group_name: str, resource_name: str, agent_pool_name: str, parameters: _models.AgentPool, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.AgentPool]: """Creates or updates an agent pool. Creates or updates an agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :param parameters: Parameters supplied to the Create or Update an agent pool operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2020_12_01.models.AgentPool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_12_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AgentPool]: + """Creates or updates an agent pool. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: Parameters supplied to the Create or Update an agent pool operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_12_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: Union[_models.AgentPool, IO], + **kwargs: Any + ) -> LROPoller[_models.AgentPool]: + """Creates or updates an agent pool. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: Parameters supplied to the Create or Update an agent pool operation. Is + either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2020_12_01.models.AgentPool or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -580,20 +649,17 @@ def begin_create_or_update( :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_12_01.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -602,66 +668,55 @@ def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -669,10 +724,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -682,26 +736,21 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + def begin_delete( + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> LROPoller[None]: """Deletes an agent pool. Deletes the agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -713,100 +762,86 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPoolUpgradeProfile: """Gets upgrade profile for an agent pool. Gets the details of the upgrade profile for an agent pool with a specified resource group and managed cluster name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolUpgradeProfile, or the result of cls(response) + :return: AgentPoolUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_12_01.models.AgentPoolUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -814,64 +849,56 @@ def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolUpgradeProfile', pipeline_response) + deserialized = self._deserialize("AgentPoolUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore @distributed_trace def get_available_agent_pool_versions( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported versions for the specified agent pool. Gets a list of supported versions for the specified agent pool. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolAvailableVersions, or the result of cls(response) + :return: AgentPoolAvailableVersions or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_12_01.models.AgentPoolAvailableVersions - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolAvailableVersions] - request = build_get_available_agent_pool_versions_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_available_agent_pool_versions.metadata['url'], + template_url=self.get_available_agent_pool_versions.metadata["url"], headers=_headers, params=_params, ) @@ -879,52 +906,43 @@ def get_available_agent_pool_versions( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolAvailableVersions', pipeline_response) + deserialized = self._deserialize("AgentPoolAvailableVersions", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_available_agent_pool_versions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore - + get_available_agent_pool_versions.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore def _upgrade_node_image_version_initial( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> Optional[_models.AgentPool]: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.AgentPool]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.AgentPool]] - - request = build_upgrade_node_image_version_request_initial( - subscription_id=self._config.subscription_id, + request = build_upgrade_node_image_version_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._upgrade_node_image_version_initial.metadata['url'], + template_url=self._upgrade_node_image_version_initial.metadata["url"], headers=_headers, params=_params, ) @@ -932,10 +950,9 @@ def _upgrade_node_image_version_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -944,33 +961,28 @@ def _upgrade_node_image_version_initial( deserialized = None if response.status_code == 202: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _upgrade_node_image_version_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore - + _upgrade_node_image_version_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore @distributed_trace def begin_upgrade_node_image_version( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any - ) -> LROPoller[_models.AgentPool]: + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any + ) -> LROPoller[None]: """Upgrade node image version of an agent pool to the latest. Upgrade node image version of an agent pool to the latest. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -983,55 +995,48 @@ def begin_upgrade_node_image_version( :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_12_01.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._upgrade_node_image_version_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_upgrade_node_image_version.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore + begin_upgrade_node_image_version.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/operations/_maintenance_configurations_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/operations/_maintenance_configurations_operations.py index 74057e5a7aac..e592bfd39e7a 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/operations/_maintenance_configurations_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/operations/_maintenance_configurations_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,173 +25,173 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +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_managed_cluster_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, config_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 = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "configName": _SERIALIZER.url("config_name", config_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "configName": _SERIALIZER.url("config_name", config_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - config_name: str, - *, - json: Optional[_models.MaintenanceConfiguration] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, resource_name: str, config_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 = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "configName": _SERIALIZER.url("config_name", config_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "configName": _SERIALIZER.url("config_name", config_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, config_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 = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "configName": _SERIALIZER.url("config_name", config_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "configName": _SERIALIZER.url("config_name", config_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class MaintenanceConfigurationsOperations: """ @@ -207,49 +212,44 @@ def __init__(self, *args, **kwargs): 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_managed_cluster( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> Iterable[_models.MaintenanceConfigurationListResult]: + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> Iterable["_models.MaintenanceConfiguration"]: """Gets a list of maintenance configurations in the specified managed cluster. Gets a list of maintenance configurations in the specified managed cluster. The operation returns properties of each maintenance configuration. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either MaintenanceConfigurationListResult or the result - of cls(response) + :return: An iterator like instance of either MaintenanceConfiguration or the result of + cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_12_01.models.MaintenanceConfigurationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_12_01.models.MaintenanceConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfigurationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfigurationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_managed_cluster_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_managed_cluster.metadata['url'], + template_url=self.list_by_managed_cluster.metadata["url"], headers=_headers, params=_params, ) @@ -257,16 +257,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_managed_cluster_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -282,10 +277,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -295,54 +288,45 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_managed_cluster.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations"} # type: ignore + list_by_managed_cluster.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations"} # type: ignore @distributed_trace def get( - self, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, config_name: str, **kwargs: Any ) -> _models.MaintenanceConfiguration: """Gets the maintenance configuration. Gets the details of maintenance configurations by managed cluster and resource group. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: MaintenanceConfiguration, or the result of cls(response) + :return: MaintenanceConfiguration or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_12_01.models.MaintenanceConfiguration - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfiguration] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -350,76 +334,149 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) + deserialized = self._deserialize("MaintenanceConfiguration", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - - @distributed_trace + @overload def create_or_update( self, resource_group_name: str, resource_name: str, config_name: str, parameters: _models.MaintenanceConfiguration, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.MaintenanceConfiguration: """Creates or updates a maintenance configurations. Creates or updates a maintenance configuration in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str :param parameters: Parameters supplied to the Create or Update a default maintenance - configuration. + configuration. Required. :type parameters: ~azure.mgmt.containerservice.v2020_12_01.models.MaintenanceConfiguration + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: MaintenanceConfiguration, or the result of cls(response) + :return: MaintenanceConfiguration or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_12_01.models.MaintenanceConfiguration - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configurations. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: Parameters supplied to the Create or Update a default maintenance + configuration. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2020_12_01.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: Union[_models.MaintenanceConfiguration, IO], + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configurations. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: Parameters supplied to the Create or Update a default maintenance + configuration. Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2020_12_01.models.MaintenanceConfiguration or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2020_12_01.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfiguration] - _json = self._serialize.body(parameters, 'MaintenanceConfiguration') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "MaintenanceConfiguration") request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) @@ -427,68 +484,59 @@ def create_or_update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) + deserialized = self._deserialize("MaintenanceConfiguration", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore @distributed_trace def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, config_name: str, **kwargs: Any ) -> None: """Deletes a maintenance configuration. Deletes the maintenance configuration in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) @@ -496,10 +544,9 @@ def delete( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -509,5 +556,4 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/operations/_managed_clusters_operations.py index 293f2c66f701..3db2cbf4a49f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/operations/_managed_clusters_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,631 +27,612 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters") + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters" + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_resource_group_request( - subscription_id: str, - resource_group_name: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters", + ) # 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', min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_upgrade_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_access_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, role_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 = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "roleName": _SERIALIZER.url("role_name", role_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "roleName": _SERIALIZER.url("role_name", role_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_admin_credentials_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_user_credentials_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_monitoring_user_credentials_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: + +def build_get_request(resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedCluster] = None, - content: Any = None, - **kwargs: Any + +def build_create_or_update_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_update_tags_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.TagsObject] = None, - content: Any = None, - **kwargs: Any + +def build_update_tags_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any +def build_delete_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_reset_service_principal_profile_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedClusterServicePrincipalProfile] = None, - content: Any = None, - **kwargs: Any +def build_reset_service_principal_profile_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_reset_aad_profile_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedClusterAADProfile] = None, - content: Any = None, - **kwargs: Any +def build_reset_aad_profile_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_rotate_cluster_certificates_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any +def build_rotate_cluster_certificates_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_stop_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + +def build_stop_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_start_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + +def build_start_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + class ManagedClustersOperations: # pylint: disable=too-many-public-methods """ @@ -667,41 +653,35 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.ManagedClusterListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.ManagedCluster"]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. The operation returns properties of each managed cluster. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_12_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_12_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -709,14 +689,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -732,10 +709,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -745,50 +720,42 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> Iterable[_models.ManagedClusterListResult]: + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.ManagedCluster"]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. The operation returns properties of each managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_12_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_12_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -796,15 +763,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -820,10 +783,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -833,51 +794,43 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.ManagedClusterUpgradeProfile: """Gets upgrade profile for a managed cluster. Gets the details of the upgrade profile for a managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterUpgradeProfile, or the result of cls(response) + :return: ManagedClusterUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_12_01.models.ManagedClusterUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -885,33 +838,27 @@ def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterUpgradeProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore @distributed_trace def get_access_profile( - self, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, role_name: str, **kwargs: Any ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. @@ -922,36 +869,33 @@ def get_access_profile( `ListClusterAdminCredentials `_ . - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param role_name: The name of the role for managed cluster accessProfile resource. + :param role_name: The name of the role for managed cluster accessProfile resource. Required. :type role_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterAccessProfile, or the result of cls(response) + :return: ManagedClusterAccessProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_12_01.models.ManagedClusterAccessProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterAccessProfile] - request = build_get_access_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, role_name=role_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_access_profile.metadata['url'], + template_url=self.get_access_profile.metadata["url"], headers=_headers, params=_params, ) @@ -959,64 +903,56 @@ def get_access_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterAccessProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterAccessProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_access_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore - + get_access_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore @distributed_trace def list_cluster_admin_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster admin credential of a managed cluster. Gets cluster admin credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_12_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_admin_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_admin_credentials.metadata['url'], + template_url=self.list_cluster_admin_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -1024,64 +960,56 @@ def list_cluster_admin_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_admin_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore - + list_cluster_admin_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore @distributed_trace def list_cluster_user_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster user credential of a managed cluster. Gets cluster user credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_12_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_user_credentials.metadata['url'], + template_url=self.list_cluster_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -1089,65 +1017,57 @@ def list_cluster_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore - + list_cluster_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore @distributed_trace def list_cluster_monitoring_user_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster monitoring user credential of a managed cluster. Gets cluster monitoring user credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_12_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_monitoring_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + template_url=self.list_cluster_monitoring_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -1155,64 +1075,54 @@ def list_cluster_monitoring_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_monitoring_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore - + list_cluster_monitoring_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore @distributed_trace - def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.ManagedCluster: + def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.ManagedCluster: """Gets a managed cluster. Gets the details of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedCluster, or the result of cls(response) + :return: ManagedCluster or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_12_01.models.ManagedCluster - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -1220,55 +1130,54 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _create_or_update_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.ManagedCluster, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'ManagedCluster') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedCluster") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1276,10 +1185,9 @@ def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -1287,25 +1195,26 @@ def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - @distributed_trace + @overload def begin_create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedCluster, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. @@ -1313,12 +1222,90 @@ def begin_create_or_update( Creates or updates a managed cluster with the specified configuration for agents and Kubernetes version. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2020_12_01.models.ManagedCluster + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_12_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster with the specified configuration for agents and Kubernetes + version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_12_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster with the specified configuration for agents and Kubernetes + version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. Is + either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2020_12_01.models.ManagedCluster or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1331,20 +1318,17 @@ def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_12_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -1352,69 +1336,66 @@ def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _update_tags_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.TagsObject, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request_initial( - subscription_id=self._config.subscription_id, + request = build_update_tags_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_tags_initial.metadata['url'], + content=_content, + template_url=self._update_tags_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1422,44 +1403,118 @@ def _update_tags_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_tags_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + _update_tags_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - - @distributed_trace + @overload def begin_update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates a managed cluster with the specified tags. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2020_12_01.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_12_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates a managed cluster with the specified tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_12_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates a managed cluster with the specified tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2020_12_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1472,20 +1527,17 @@ def begin_update_tags( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_12_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, @@ -1493,64 +1545,54 @@ def begin_update_tags( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1558,10 +1600,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1571,23 +1612,17 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> LROPoller[None]: + def begin_delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> LROPoller[None]: """Deletes a managed cluster. Deletes the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1599,85 +1634,83 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterServicePrincipalProfile, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterServicePrincipalProfile") - request = build_reset_service_principal_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_service_principal_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_service_principal_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_service_principal_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1685,10 +1718,9 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1698,29 +1730,33 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re if cls: return cls(pipeline_response, None, {}) - _reset_service_principal_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + _reset_service_principal_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore - - @distributed_trace - def begin_reset_service_principal_profile( # pylint: disable=inconsistent-return-statements + @overload + def begin_reset_service_principal_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterServicePrincipalProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: """Reset Service Principal Profile of a managed cluster. Update the service principal Profile for a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a - Managed Cluster. + Managed Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2020_12_01.models.ManagedClusterServicePrincipalProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1731,20 +1767,90 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reset Service Principal Profile of a managed cluster. + + Update the service principal Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a + Managed Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Reset Service Principal Profile of a managed cluster. + + Update the service principal Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a + Managed Cluster. Is either a model type or a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2020_12_01.models.ManagedClusterServicePrincipalProfile or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1752,67 +1858,68 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_service_principal_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + begin_reset_service_principal_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterAADProfile, + parameters: Union[_models.ManagedClusterAADProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterAADProfile") - request = build_reset_aad_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_aad_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_aad_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_aad_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1820,10 +1927,9 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1833,28 +1939,105 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement if cls: return cls(pipeline_response, None, {}) - _reset_aad_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - + _reset_aad_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - @distributed_trace - def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements + @overload + def begin_reset_aad_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterAADProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: """Reset AAD Profile of a managed cluster. Update the AAD Profile for a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed - Cluster. + Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2020_12_01.models.ManagedClusterAADProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reset AAD Profile of a managed cluster. + + Update the AAD Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed + Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterAADProfile, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Reset AAD Profile of a managed cluster. + + Update the AAD Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed + Cluster. Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2020_12_01.models.ManagedClusterAADProfile or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1865,20 +2048,17 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1886,62 +2066,52 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_aad_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + begin_reset_aad_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_rotate_cluster_certificates_request_initial( - subscription_id=self._config.subscription_id, + request = build_rotate_cluster_certificates_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._rotate_cluster_certificates_initial.metadata['url'], + template_url=self._rotate_cluster_certificates_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1949,10 +2119,9 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1962,23 +2131,19 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return if cls: return cls(pipeline_response, None, {}) - _rotate_cluster_certificates_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore - + _rotate_cluster_certificates_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore @distributed_trace - def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + def begin_rotate_cluster_certificates( + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> LROPoller[None]: """Rotate certificates of a managed cluster. Rotate certificates of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1990,80 +2155,67 @@ def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-st Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._rotate_cluster_certificates_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_rotate_cluster_certificates.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore + begin_rotate_cluster_certificates.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore def _stop_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_stop_request_initial( - subscription_id=self._config.subscription_id, + request = build_stop_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._stop_initial.metadata['url'], + template_url=self._stop_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2071,10 +2223,9 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -2084,23 +2235,17 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore - + _stop_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore @distributed_trace - def begin_stop( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> LROPoller[None]: + def begin_stop(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> LROPoller[None]: """Stop Managed Cluster. Stops a Running Managed Cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -2112,80 +2257,67 @@ def begin_stop( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._stop_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore + begin_stop.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore def _start_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_start_request_initial( - subscription_id=self._config.subscription_id, + request = build_start_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._start_initial.metadata['url'], + template_url=self._start_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2193,10 +2325,9 @@ def _start_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -2206,23 +2337,17 @@ def _start_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore - + _start_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore @distributed_trace - def begin_start( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> LROPoller[None]: + def begin_start(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> LROPoller[None]: """Start Managed Cluster. Starts a Stopped Managed Cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -2234,52 +2359,45 @@ def begin_start( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._start_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore + begin_start.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/operations/_operations.py index 586ba5759e64..a3e383c1ba7c 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/operations/_operations.py @@ -7,10 +7,15 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,38 +25,34 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - **kwargs: Any -) -> HttpRequest: + +def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.ContainerService/operations") # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class Operations: """ @@ -72,36 +73,31 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.OperationListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.OperationValue"]: """Gets a list of compute operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationListResult or the result of cls(response) + :return: An iterator like instance of either OperationValue or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_12_01.models.OperationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_12_01.models.OperationValue] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -109,13 +105,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -131,10 +125,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -144,8 +136,6 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.ContainerService/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ContainerService/operations"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/operations/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/operations/_private_endpoint_connections_operations.py index 529f804ca58a..5886486f78dc 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/operations/_private_endpoint_connections_operations.py @@ -6,11 +6,15 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod @@ -21,173 +25,191 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - subscription_id: str, resource_group_name: str, resource_name: str, private_endpoint_connection_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 = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_update_request( - subscription_id: str, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, - *, - json: Optional[_models.PrivateEndpointConnection] = None, - content: Any = None, + subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request_initial( - subscription_id: str, +def build_delete_request( resource_group_name: str, resource_name: str, private_endpoint_connection_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 = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class PrivateEndpointConnectionsOperations: """ @@ -208,46 +230,39 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnectionListResult: """Gets a list of private endpoint connections in the specified managed cluster. Gets a list of private endpoint connections in the specified managed cluster. The operation returns properties of each private endpoint connection. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnectionListResult, or the result of cls(response) + :return: PrivateEndpointConnectionListResult or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_12_01.models.PrivateEndpointConnectionListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnectionListResult] - request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -255,68 +270,59 @@ def list( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore - + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore @distributed_trace def get( - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnection: """Gets the private endpoint connection. Gets the details of the private endpoint connection by managed cluster and resource group. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_12_01.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -324,75 +330,149 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - @distributed_trace + @overload def update( self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, parameters: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateEndpointConnection: """Updates a private endpoint connection. Updates a private endpoint connection in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :param parameters: Parameters supplied to the Update a private endpoint connection operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2020_12_01.models.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2020_12_01.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: Parameters supplied to the Update a private endpoint connection operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_12_01.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @distributed_trace + def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: Union[_models.PrivateEndpointConnection, IO], + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: Parameters supplied to the Update a private endpoint connection operation. + Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2020_12_01.models.PrivateEndpointConnection or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2020_12_01.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - _json = self._serialize.body(parameters, 'PrivateEndpointConnection') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateEndpointConnection") request = build_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update.metadata['url'], + content=_content, + template_url=self.update.metadata["url"], headers=_headers, params=_params, ) @@ -400,52 +480,43 @@ def update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -453,10 +524,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -466,26 +536,21 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + def begin_delete( + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> LROPoller[None]: """Deletes a private endpoint connection. Deletes the private endpoint connection in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -497,53 +562,46 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/operations/_private_link_resources_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/operations/_private_link_resources_operations.py index fd1fb9720e43..cb35044e3435 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/operations/_private_link_resources_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/operations/_private_link_resources_operations.py @@ -8,9 +8,13 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -19,48 +23,53 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class PrivateLinkResourcesOperations: """ @@ -81,46 +90,39 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.PrivateLinkResourcesListResult: """Gets a list of private link resources in the specified managed cluster. Gets a list of private link resources in the specified managed cluster. The operation returns properties of each private link resource. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResourcesListResult, or the result of cls(response) + :return: PrivateLinkResourcesListResult or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_12_01.models.PrivateLinkResourcesListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResourcesListResult] - request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -128,22 +130,20 @@ def list( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResourcesListResult', pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources"} # type: ignore - + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/operations/_resolve_private_link_service_id_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/operations/_resolve_private_link_service_id_operations.py index 462ec3e1c801..ee9985b0dc1a 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/operations/_resolve_private_link_service_id_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/operations/_resolve_private_link_service_id_operations.py @@ -6,11 +6,15 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -19,56 +23,56 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_post_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.PrivateLinkResource] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + class ResolvePrivateLinkServiceIdOperations: """ @@ -89,53 +93,120 @@ def __init__(self, *args, **kwargs): 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 + @overload def post( self, resource_group_name: str, resource_name: str, parameters: _models.PrivateLinkResource, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateLinkResource: """Gets the private link service ID for the specified managed cluster. Gets the private link service ID the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters (name, groupId) supplied in order to resolve a private link - service ID. + service ID. Required. :type parameters: ~azure.mgmt.containerservice.v2020_12_01.models.PrivateLinkResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResource, or the result of cls(response) + :return: PrivateLinkResource or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2020_12_01.models.PrivateLinkResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + def post( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters (name, groupId) supplied in order to resolve a private link + service ID. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2020_12_01.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def post( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.PrivateLinkResource, IO], + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters (name, groupId) supplied in order to resolve a private link + service ID. Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2020_12_01.models.PrivateLinkResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2020_12_01.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResource] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-12-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResource] - _json = self._serialize.body(parameters, 'PrivateLinkResource') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateLinkResource") request = build_post_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.post.metadata['url'], + content=_content, + template_url=self.post.metadata["url"], headers=_headers, params=_params, ) @@ -143,22 +214,20 @@ def post( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResource', pipeline_response) + deserialized = self._deserialize("PrivateLinkResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - post.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId"} # type: ignore - + post.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/__init__.py index 37a5f9e02e6f..a8716d29afe8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/__init__.py @@ -14,7 +14,8 @@ except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['ContainerServiceClient'] + +__all__ = ["ContainerServiceClient"] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/_configuration.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/_configuration.py index 6623f333cbed..0713db3c9713 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/_configuration.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/_configuration.py @@ -18,30 +18,26 @@ VERSION = "unknown" + class ContainerServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ContainerServiceClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2021-02-01". 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: + def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ContainerServiceClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2021-02-01") # type: str + api_version = kwargs.pop("api_version", "2021-02-01") # type: str if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -51,23 +47,24 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-containerservice/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-containerservice/{}".format(VERSION)) self._configure(**kwargs) def _configure( - self, - **kwargs # type: Any + self, **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/_container_service_client.py index 6573744c0f54..af38fa34351b 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/_container_service_client.py @@ -9,20 +9,28 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from . import models +from .._serialization import Deserializer, Serializer from ._configuration import ContainerServiceClientConfiguration -from .operations import AgentPoolsOperations, MaintenanceConfigurationsOperations, ManagedClustersOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, ResolvePrivateLinkServiceIdOperations +from .operations import ( + AgentPoolsOperations, + MaintenanceConfigurationsOperations, + ManagedClustersOperations, + Operations, + PrivateEndpointConnectionsOperations, + PrivateLinkResourcesOperations, + ResolvePrivateLinkServiceIdOperations, +) if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class ContainerServiceClient: # pylint: disable=too-many-instance-attributes + +class ContainerServiceClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """The Container Service Client. :ivar operations: Operations operations @@ -44,10 +52,10 @@ class ContainerServiceClient: # pylint: disable=too-many-instance-attributes :ivar resolve_private_link_service_id: ResolvePrivateLinkServiceIdOperations operations :vartype resolve_private_link_service_id: azure.mgmt.containerservice.v2021_02_01.operations.ResolvePrivateLinkServiceIdOperations - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -65,25 +73,23 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = ContainerServiceClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = ContainerServiceClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize - ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.managed_clusters = ManagedClustersOperations( self._client, self._config, self._serialize, self._deserialize ) self.maintenance_configurations = MaintenanceConfigurationsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.agent_pools = AgentPoolsOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) self.private_endpoint_connections = PrivateEndpointConnectionsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -94,12 +100,7 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) - - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> HttpResponse: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -108,7 +109,7 @@ def _send_request( >>> response = client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/_metadata.json b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/_metadata.json index 3d2357cf8d19..5440b2d5feac 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/_metadata.json +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/_metadata.json @@ -10,20 +10,20 @@ "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { "credential": { - "signature": "credential, # type: \"TokenCredential\"", - "description": "Credential needed for the client to connect to Azure.", + "signature": "credential: \"TokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true }, "subscription_id": { - "signature": "subscription_id, # type: str", - "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "signature": "subscription_id: str,", + "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.", "docstring_type": "str", "required": true } @@ -31,13 +31,13 @@ "async": { "credential": { "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure.", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { "signature": "subscription_id: str,", - "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.", "docstring_type": "str", "required": true } @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=\"https://management.azure.com\", # type: str", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/_patch.py index 74e48ecd07cf..f99e77fef986 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/_patch.py @@ -28,4 +28,4 @@ # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + pass diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/_vendor.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/_vendor.py index 138f663c53a4..9aad73fc743e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/_vendor.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/_vendor.py @@ -7,6 +7,7 @@ from azure.core.pipeline.transport import HttpRequest + def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) @@ -14,6 +15,7 @@ def _convert_request(request, files=None): request.set_formdata_body(files) return request + def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -21,7 +23,5 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [ - c for c in formatted_components if "{}".format(key.args[0]) not in c - ] + components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/aio/__init__.py index 37a5f9e02e6f..a8716d29afe8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/aio/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/aio/__init__.py @@ -14,7 +14,8 @@ except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['ContainerServiceClient'] + +__all__ = ["ContainerServiceClient"] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/aio/_configuration.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/aio/_configuration.py index 20fe6d7c5b30..198f59f7a18f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/aio/_configuration.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/aio/_configuration.py @@ -18,30 +18,26 @@ VERSION = "unknown" + class ContainerServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ContainerServiceClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2021-02-01". 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: + def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ContainerServiceClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2021-02-01") # type: str + api_version = kwargs.pop("api_version", "2021-02-01") # type: str if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -51,22 +47,21 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-containerservice/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-containerservice/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, - **kwargs: Any - ) -> None: - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/aio/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/aio/_container_service_client.py index d82390031685..904057a8c092 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/aio/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/aio/_container_service_client.py @@ -9,20 +9,28 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from .. import models +from ..._serialization import Deserializer, Serializer from ._configuration import ContainerServiceClientConfiguration -from .operations import AgentPoolsOperations, MaintenanceConfigurationsOperations, ManagedClustersOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, ResolvePrivateLinkServiceIdOperations +from .operations import ( + AgentPoolsOperations, + MaintenanceConfigurationsOperations, + ManagedClustersOperations, + Operations, + PrivateEndpointConnectionsOperations, + PrivateLinkResourcesOperations, + ResolvePrivateLinkServiceIdOperations, +) if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class ContainerServiceClient: # pylint: disable=too-many-instance-attributes + +class ContainerServiceClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """The Container Service Client. :ivar operations: Operations operations @@ -45,10 +53,10 @@ class ContainerServiceClient: # pylint: disable=too-many-instance-attributes :ivar resolve_private_link_service_id: ResolvePrivateLinkServiceIdOperations operations :vartype resolve_private_link_service_id: azure.mgmt.containerservice.v2021_02_01.aio.operations.ResolvePrivateLinkServiceIdOperations - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -66,25 +74,23 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = ContainerServiceClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = ContainerServiceClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize - ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.managed_clusters = ManagedClustersOperations( self._client, self._config, self._serialize, self._deserialize ) self.maintenance_configurations = MaintenanceConfigurationsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.agent_pools = AgentPoolsOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) self.private_endpoint_connections = PrivateEndpointConnectionsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -95,12 +101,7 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) - - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -109,7 +110,7 @@ def _send_request( >>> response = await client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/aio/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/aio/_patch.py index 74e48ecd07cf..f99e77fef986 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/aio/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/aio/_patch.py @@ -28,4 +28,4 @@ # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + pass diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/aio/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/aio/operations/__init__.py index f0e265d9f2f4..f27b588ca549 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/aio/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/aio/operations/__init__.py @@ -17,14 +17,15 @@ from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'Operations', - 'ManagedClustersOperations', - 'MaintenanceConfigurationsOperations', - 'AgentPoolsOperations', - 'PrivateEndpointConnectionsOperations', - 'PrivateLinkResourcesOperations', - 'ResolvePrivateLinkServiceIdOperations', + "Operations", + "ManagedClustersOperations", + "MaintenanceConfigurationsOperations", + "AgentPoolsOperations", + "PrivateEndpointConnectionsOperations", + "PrivateLinkResourcesOperations", + "ResolvePrivateLinkServiceIdOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/aio/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/aio/operations/_agent_pools_operations.py index 261e85dc56b7..f40eb03dd826 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/aio/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/aio/operations/_agent_pools_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +29,20 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._agent_pools_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_available_agent_pool_versions_request, build_get_request, build_get_upgrade_profile_request, build_list_request, build_upgrade_node_image_version_request_initial -T = TypeVar('T') +from ...operations._agent_pools_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_available_agent_pool_versions_request, + build_get_request, + build_get_upgrade_profile_request, + build_list_request, + build_upgrade_node_image_version_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class AgentPoolsOperations: """ .. warning:: @@ -45,48 +62,41 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.AgentPoolListResult]: + def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncIterable["_models.AgentPool"]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. The operation returns properties of each agent pool. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AgentPoolListResult or the result of cls(response) + :return: An iterator like instance of either AgentPool or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_02_01.models.AgentPoolListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_02_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -94,16 +104,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -119,10 +124,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -132,54 +135,45 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore @distributed_trace_async async def get( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPool: """Gets the agent pool. Gets the details of the agent pool by managed cluster and resource group. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPool, or the result of cls(response) + :return: AgentPool or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_02_01.models.AgentPool - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -187,57 +181,60 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore async def _create_or_update_initial( self, resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: _models.AgentPool, + parameters: Union[_models.AgentPool, IO], **kwargs: Any ) -> _models.AgentPool: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - _json = self._serialize.body(parameters, 'AgentPool') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "AgentPool") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -245,10 +242,9 @@ async def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -256,40 +252,127 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - @distributed_trace_async + @overload async def begin_create_or_update( self, resource_group_name: str, resource_name: str, agent_pool_name: str, parameters: _models.AgentPool, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.AgentPool]: """Creates or updates an agent pool. Creates or updates an agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :param parameters: Parameters supplied to the Create or Update an agent pool operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2021_02_01.models.AgentPool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AgentPool or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_02_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AgentPool]: + """Creates or updates an agent pool. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: Parameters supplied to the Create or Update an agent pool operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AgentPool or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_02_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: Union[_models.AgentPool, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.AgentPool]: + """Creates or updates an agent pool. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: Parameters supplied to the Create or Update an agent pool operation. Is + either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_02_01.models.AgentPool or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -302,20 +385,17 @@ async def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_02_01.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -324,66 +404,55 @@ async def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -391,10 +460,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -404,26 +472,21 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + async def begin_delete( + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes an agent pool. Deletes the agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -435,100 +498,86 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace_async async def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPoolUpgradeProfile: """Gets upgrade profile for an agent pool. Gets the details of the upgrade profile for an agent pool with a specified resource group and managed cluster name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolUpgradeProfile, or the result of cls(response) + :return: AgentPoolUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_02_01.models.AgentPoolUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -536,64 +585,56 @@ async def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolUpgradeProfile', pipeline_response) + deserialized = self._deserialize("AgentPoolUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore @distributed_trace_async async def get_available_agent_pool_versions( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported versions for the specified agent pool. Gets a list of supported versions for the specified agent pool. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolAvailableVersions, or the result of cls(response) + :return: AgentPoolAvailableVersions or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_02_01.models.AgentPoolAvailableVersions - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolAvailableVersions] - request = build_get_available_agent_pool_versions_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_available_agent_pool_versions.metadata['url'], + template_url=self.get_available_agent_pool_versions.metadata["url"], headers=_headers, params=_params, ) @@ -601,52 +642,43 @@ async def get_available_agent_pool_versions( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolAvailableVersions', pipeline_response) + deserialized = self._deserialize("AgentPoolAvailableVersions", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_available_agent_pool_versions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore - + get_available_agent_pool_versions.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore async def _upgrade_node_image_version_initial( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> Optional[_models.AgentPool]: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.AgentPool]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.AgentPool]] - - request = build_upgrade_node_image_version_request_initial( - subscription_id=self._config.subscription_id, + request = build_upgrade_node_image_version_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._upgrade_node_image_version_initial.metadata['url'], + template_url=self._upgrade_node_image_version_initial.metadata["url"], headers=_headers, params=_params, ) @@ -654,10 +686,9 @@ async def _upgrade_node_image_version_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -666,33 +697,28 @@ async def _upgrade_node_image_version_initial( deserialized = None if response.status_code == 202: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _upgrade_node_image_version_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore - + _upgrade_node_image_version_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore @distributed_trace_async async def begin_upgrade_node_image_version( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any - ) -> AsyncLROPoller[_models.AgentPool]: + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: """Upgrade node image version of an agent pool to the latest. Upgrade node image version of an agent pool to the latest. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -706,55 +732,48 @@ async def begin_upgrade_node_image_version( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_02_01.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._upgrade_node_image_version_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_upgrade_node_image_version.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore + begin_upgrade_node_image_version.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/aio/operations/_maintenance_configurations_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/aio/operations/_maintenance_configurations_operations.py index 206cda0e4f2a..8a1816b1f095 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/aio/operations/_maintenance_configurations_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/aio/operations/_maintenance_configurations_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,10 +27,17 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._maintenance_configurations_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_managed_cluster_request -T = TypeVar('T') +from ...operations._maintenance_configurations_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_managed_cluster_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class MaintenanceConfigurationsOperations: """ .. warning:: @@ -43,49 +57,44 @@ def __init__(self, *args, **kwargs) -> None: 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_managed_cluster( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.MaintenanceConfigurationListResult]: + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> AsyncIterable["_models.MaintenanceConfiguration"]: """Gets a list of maintenance configurations in the specified managed cluster. Gets a list of maintenance configurations in the specified managed cluster. The operation returns properties of each maintenance configuration. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either MaintenanceConfigurationListResult or the result - of cls(response) + :return: An iterator like instance of either MaintenanceConfiguration or the result of + cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_02_01.models.MaintenanceConfigurationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_02_01.models.MaintenanceConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfigurationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfigurationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_managed_cluster_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_managed_cluster.metadata['url'], + template_url=self.list_by_managed_cluster.metadata["url"], headers=_headers, params=_params, ) @@ -93,16 +102,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_managed_cluster_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -118,10 +122,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -131,54 +133,45 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_managed_cluster.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations"} # type: ignore + list_by_managed_cluster.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations"} # type: ignore @distributed_trace_async async def get( - self, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, config_name: str, **kwargs: Any ) -> _models.MaintenanceConfiguration: """Gets the maintenance configuration. Gets the details of maintenance configurations by managed cluster and resource group. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: MaintenanceConfiguration, or the result of cls(response) + :return: MaintenanceConfiguration or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_02_01.models.MaintenanceConfiguration - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfiguration] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -186,76 +179,149 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) + deserialized = self._deserialize("MaintenanceConfiguration", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - @distributed_trace_async + @overload async def create_or_update( self, resource_group_name: str, resource_name: str, config_name: str, parameters: _models.MaintenanceConfiguration, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.MaintenanceConfiguration: """Creates or updates a maintenance configurations. Creates or updates a maintenance configuration in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str :param parameters: Parameters supplied to the Create or Update a default maintenance - configuration. + configuration. Required. :type parameters: ~azure.mgmt.containerservice.v2021_02_01.models.MaintenanceConfiguration + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: MaintenanceConfiguration, or the result of cls(response) + :return: MaintenanceConfiguration or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_02_01.models.MaintenanceConfiguration - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configurations. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: Parameters supplied to the Create or Update a default maintenance + configuration. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_02_01.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: Union[_models.MaintenanceConfiguration, IO], + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configurations. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: Parameters supplied to the Create or Update a default maintenance + configuration. Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_02_01.models.MaintenanceConfiguration or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_02_01.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfiguration] - _json = self._serialize.body(parameters, 'MaintenanceConfiguration') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "MaintenanceConfiguration") request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) @@ -263,68 +329,59 @@ async def create_or_update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) + deserialized = self._deserialize("MaintenanceConfiguration", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, config_name: str, **kwargs: Any ) -> None: """Deletes a maintenance configuration. Deletes the maintenance configuration in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) @@ -332,10 +389,9 @@ async def delete( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -345,5 +401,4 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/aio/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/aio/operations/_managed_clusters_operations.py index d504d2cb2f66..f3e1b2167023 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/aio/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/aio/operations/_managed_clusters_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +29,29 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._managed_clusters_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_access_profile_request, build_get_request, build_get_upgrade_profile_request, build_list_by_resource_group_request, build_list_cluster_admin_credentials_request, build_list_cluster_monitoring_user_credentials_request, build_list_cluster_user_credentials_request, build_list_request, build_reset_aad_profile_request_initial, build_reset_service_principal_profile_request_initial, build_rotate_cluster_certificates_request_initial, build_start_request_initial, build_stop_request_initial, build_update_tags_request_initial -T = TypeVar('T') +from ...operations._managed_clusters_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_access_profile_request, + build_get_request, + build_get_upgrade_profile_request, + build_list_by_resource_group_request, + build_list_cluster_admin_credentials_request, + build_list_cluster_monitoring_user_credentials_request, + build_list_cluster_user_credentials_request, + build_list_request, + build_reset_aad_profile_request, + build_reset_service_principal_profile_request, + build_rotate_cluster_certificates_request, + build_start_request, + build_stop_request, + build_update_tags_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class ManagedClustersOperations: # pylint: disable=too-many-public-methods """ .. warning:: @@ -45,41 +71,35 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.ManagedClusterListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.ManagedCluster"]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. The operation returns properties of each managed cluster. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_02_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_02_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -87,14 +107,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -110,10 +127,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -123,50 +138,44 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.ManagedClusterListResult]: + self, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ManagedCluster"]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. The operation returns properties of each managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_02_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_02_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -174,15 +183,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -198,10 +203,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -211,51 +214,43 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace_async async def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.ManagedClusterUpgradeProfile: """Gets upgrade profile for a managed cluster. Gets the details of the upgrade profile for a managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterUpgradeProfile, or the result of cls(response) + :return: ManagedClusterUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_02_01.models.ManagedClusterUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -263,33 +258,27 @@ async def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterUpgradeProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore @distributed_trace_async async def get_access_profile( - self, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, role_name: str, **kwargs: Any ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. @@ -300,36 +289,33 @@ async def get_access_profile( `ListClusterAdminCredentials `_ . - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param role_name: The name of the role for managed cluster accessProfile resource. + :param role_name: The name of the role for managed cluster accessProfile resource. Required. :type role_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterAccessProfile, or the result of cls(response) + :return: ManagedClusterAccessProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_02_01.models.ManagedClusterAccessProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterAccessProfile] - request = build_get_access_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, role_name=role_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_access_profile.metadata['url'], + template_url=self.get_access_profile.metadata["url"], headers=_headers, params=_params, ) @@ -337,64 +323,56 @@ async def get_access_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterAccessProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterAccessProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_access_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore - + get_access_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore @distributed_trace_async async def list_cluster_admin_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster admin credential of a managed cluster. Gets cluster admin credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_02_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_admin_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_admin_credentials.metadata['url'], + template_url=self.list_cluster_admin_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -402,64 +380,56 @@ async def list_cluster_admin_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_admin_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore - + list_cluster_admin_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore @distributed_trace_async async def list_cluster_user_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster user credential of a managed cluster. Gets cluster user credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_02_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_user_credentials.metadata['url'], + template_url=self.list_cluster_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -467,65 +437,57 @@ async def list_cluster_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore - + list_cluster_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore @distributed_trace_async async def list_cluster_monitoring_user_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster monitoring user credential of a managed cluster. Gets cluster monitoring user credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_02_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_monitoring_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + template_url=self.list_cluster_monitoring_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -533,64 +495,54 @@ async def list_cluster_monitoring_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_monitoring_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore - + list_cluster_monitoring_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore @distributed_trace_async - async def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.ManagedCluster: + async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.ManagedCluster: """Gets a managed cluster. Gets the details of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedCluster, or the result of cls(response) + :return: ManagedCluster or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_02_01.models.ManagedCluster - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -598,55 +550,54 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _create_or_update_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.ManagedCluster, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'ManagedCluster') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedCluster") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -654,10 +605,9 @@ async def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -665,25 +615,26 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - @distributed_trace_async + @overload async def begin_create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedCluster, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. @@ -691,12 +642,16 @@ async def begin_create_or_update( Creates or updates a managed cluster with the specified configuration for agents and Kubernetes version. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2021_02_01.models.ManagedCluster + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -709,20 +664,91 @@ async def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_02_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster with the specified configuration for agents and Kubernetes + version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_02_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster with the specified configuration for agents and Kubernetes + version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. Is + either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_02_01.models.ManagedCluster or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_02_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -730,69 +756,66 @@ async def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _update_tags_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.TagsObject, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request_initial( - subscription_id=self._config.subscription_id, + request = build_update_tags_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_tags_initial.metadata['url'], + content=_content, + template_url=self._update_tags_initial.metadata["url"], headers=_headers, params=_params, ) @@ -800,44 +823,118 @@ async def _update_tags_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_tags_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _update_tags_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - @distributed_trace_async + @overload async def begin_update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates a managed cluster with the specified tags. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2021_02_01.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_02_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates a managed cluster with the specified tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_02_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates a managed cluster with the specified tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_02_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -850,20 +947,17 @@ async def begin_update_tags( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_02_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, @@ -871,64 +965,54 @@ async def begin_update_tags( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -936,10 +1020,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -949,23 +1032,17 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: + async def begin_delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Deletes a managed cluster. Deletes the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -977,85 +1054,83 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterServicePrincipalProfile, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterServicePrincipalProfile") - request = build_reset_service_principal_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_service_principal_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_service_principal_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_service_principal_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1063,10 +1138,9 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1076,29 +1150,33 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist if cls: return cls(pipeline_response, None, {}) - _reset_service_principal_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + _reset_service_principal_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore - - @distributed_trace_async - async def begin_reset_service_principal_profile( # pylint: disable=inconsistent-return-statements + @overload + async def begin_reset_service_principal_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterServicePrincipalProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: """Reset Service Principal Profile of a managed cluster. Update the service principal Profile for a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a - Managed Cluster. + Managed Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2021_02_01.models.ManagedClusterServicePrincipalProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -1109,20 +1187,90 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset Service Principal Profile of a managed cluster. + + Update the service principal Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a + Managed Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset Service Principal Profile of a managed cluster. + + Update the service principal Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a + Managed Cluster. Is either a model type or a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2021_02_01.models.ManagedClusterServicePrincipalProfile or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1130,67 +1278,68 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_service_principal_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + begin_reset_service_principal_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterAADProfile, + parameters: Union[_models.ManagedClusterAADProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterAADProfile") - request = build_reset_aad_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_aad_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_aad_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_aad_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1198,10 +1347,9 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1211,28 +1359,32 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta if cls: return cls(pipeline_response, None, {}) - _reset_aad_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - + _reset_aad_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - @distributed_trace_async - async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements + @overload + async def begin_reset_aad_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterAADProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: """Reset AAD Profile of a managed cluster. Update the AAD Profile for a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed - Cluster. + Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2021_02_01.models.ManagedClusterAADProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -1243,20 +1395,90 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset AAD Profile of a managed cluster. + + Update the AAD Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed + Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterAADProfile, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset AAD Profile of a managed cluster. + + Update the AAD Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed + Cluster. Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_02_01.models.ManagedClusterAADProfile or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1264,62 +1486,52 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_aad_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + begin_reset_aad_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_rotate_cluster_certificates_request_initial( - subscription_id=self._config.subscription_id, + request = build_rotate_cluster_certificates_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._rotate_cluster_certificates_initial.metadata['url'], + template_url=self._rotate_cluster_certificates_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1327,10 +1539,9 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1340,23 +1551,19 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- if cls: return cls(pipeline_response, None, {}) - _rotate_cluster_certificates_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore - + _rotate_cluster_certificates_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore @distributed_trace_async - async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + async def begin_rotate_cluster_certificates( + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Rotate certificates of a managed cluster. Rotate certificates of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1368,80 +1575,67 @@ async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-ret Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._rotate_cluster_certificates_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_rotate_cluster_certificates.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore + begin_rotate_cluster_certificates.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore async def _stop_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_stop_request_initial( - subscription_id=self._config.subscription_id, + request = build_stop_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._stop_initial.metadata['url'], + template_url=self._stop_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1449,10 +1643,9 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1462,23 +1655,17 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore - + _stop_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore @distributed_trace_async - async def begin_stop( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: + async def begin_stop(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Stop Managed Cluster. Stops a Running Managed Cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1490,80 +1677,67 @@ async def begin_stop( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._stop_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore + begin_stop.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore async def _start_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_start_request_initial( - subscription_id=self._config.subscription_id, + request = build_start_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._start_initial.metadata['url'], + template_url=self._start_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1571,10 +1745,9 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1584,23 +1757,17 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore - + _start_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore @distributed_trace_async - async def begin_start( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: + async def begin_start(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Start Managed Cluster. Starts a Stopped Managed Cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1612,52 +1779,45 @@ async def begin_start( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._start_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore + begin_start.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/aio/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/aio/operations/_operations.py index 9e0d13c8fa5e..ae547d693fd7 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/aio/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/aio/operations/_operations.py @@ -7,9 +7,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,9 +27,11 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._operations import build_list_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class Operations: """ .. warning:: @@ -42,36 +51,31 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.OperationListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.OperationValue"]: """Gets a list of compute operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationListResult or the result of cls(response) + :return: An iterator like instance of either OperationValue or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_02_01.models.OperationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_02_01.models.OperationValue] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -79,13 +83,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -101,10 +103,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -114,8 +114,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.ContainerService/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ContainerService/operations"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/aio/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/aio/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/aio/operations/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/aio/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/aio/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/aio/operations/_private_endpoint_connections_operations.py index d012423ce30f..4d6b88da8c49 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/aio/operations/_private_endpoint_connections_operations.py @@ -6,9 +6,15 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -20,10 +26,17 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._private_endpoint_connections_operations import build_delete_request_initial, build_get_request, build_list_request, build_update_request -T = TypeVar('T') +from ...operations._private_endpoint_connections_operations import ( + build_delete_request, + build_get_request, + build_list_request, + build_update_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class PrivateEndpointConnectionsOperations: """ .. warning:: @@ -43,46 +56,39 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async async def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnectionListResult: """Gets a list of private endpoint connections in the specified managed cluster. Gets a list of private endpoint connections in the specified managed cluster. The operation returns properties of each private endpoint connection. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnectionListResult, or the result of cls(response) + :return: PrivateEndpointConnectionListResult or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_02_01.models.PrivateEndpointConnectionListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnectionListResult] - request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -90,68 +96,59 @@ async def list( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore - + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore @distributed_trace_async async def get( - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnection: """Gets the private endpoint connection. Gets the details of the private endpoint connection by managed cluster and resource group. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_02_01.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -159,75 +156,149 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - - @distributed_trace_async + @overload async def update( self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, parameters: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateEndpointConnection: """Updates a private endpoint connection. Updates a private endpoint connection in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :param parameters: Parameters supplied to the Update a private endpoint connection operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2021_02_01.models.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_02_01.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + async def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: Parameters supplied to the Update a private endpoint connection operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_02_01.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: Union[_models.PrivateEndpointConnection, IO], + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: Parameters supplied to the Update a private endpoint connection operation. + Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_02_01.models.PrivateEndpointConnection or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_02_01.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - _json = self._serialize.body(parameters, 'PrivateEndpointConnection') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateEndpointConnection") request = build_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update.metadata['url'], + content=_content, + template_url=self.update.metadata["url"], headers=_headers, params=_params, ) @@ -235,52 +306,43 @@ async def update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -288,10 +350,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -301,26 +362,21 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + async def begin_delete( + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes a private endpoint connection. Deletes the private endpoint connection in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -332,53 +388,46 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/aio/operations/_private_link_resources_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/aio/operations/_private_link_resources_operations.py index 56aa8f5c5a1d..bb77f517b637 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/aio/operations/_private_link_resources_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/aio/operations/_private_link_resources_operations.py @@ -8,7 +8,13 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -19,9 +25,11 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._private_link_resources_operations import build_list_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class PrivateLinkResourcesOperations: """ .. warning:: @@ -41,46 +49,39 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async async def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.PrivateLinkResourcesListResult: """Gets a list of private link resources in the specified managed cluster. Gets a list of private link resources in the specified managed cluster. The operation returns properties of each private link resource. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResourcesListResult, or the result of cls(response) + :return: PrivateLinkResourcesListResult or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_02_01.models.PrivateLinkResourcesListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResourcesListResult] - request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -88,22 +89,20 @@ async def list( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResourcesListResult', pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources"} # type: ignore - + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/aio/operations/_resolve_private_link_service_id_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/aio/operations/_resolve_private_link_service_id_operations.py index 8b2309b2d73e..447846592f84 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/aio/operations/_resolve_private_link_service_id_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/aio/operations/_resolve_private_link_service_id_operations.py @@ -6,9 +6,15 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -19,9 +25,11 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._resolve_private_link_service_id_operations import build_post_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class ResolvePrivateLinkServiceIdOperations: """ .. warning:: @@ -41,53 +49,120 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async + @overload async def post( self, resource_group_name: str, resource_name: str, parameters: _models.PrivateLinkResource, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateLinkResource: """Gets the private link service ID for the specified managed cluster. Gets the private link service ID the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters (name, groupId) supplied in order to resolve a private link - service ID. + service ID. Required. :type parameters: ~azure.mgmt.containerservice.v2021_02_01.models.PrivateLinkResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_02_01.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def post( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters (name, groupId) supplied in order to resolve a private link + service ID. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResource, or the result of cls(response) + :return: PrivateLinkResource or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_02_01.models.PrivateLinkResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @distributed_trace_async + async def post( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.PrivateLinkResource, IO], + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters (name, groupId) supplied in order to resolve a private link + service ID. Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_02_01.models.PrivateLinkResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_02_01.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResource] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResource] - _json = self._serialize.body(parameters, 'PrivateLinkResource') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateLinkResource") request = build_post_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.post.metadata['url'], + content=_content, + template_url=self.post.metadata["url"], headers=_headers, params=_params, ) @@ -95,22 +170,20 @@ async def post( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResource', pipeline_response) + deserialized = self._deserialize("PrivateLinkResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - post.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId"} # type: ignore - + post.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/models/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/models/__init__.py index 2b519b694a35..71fbf2f7c08e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/models/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/models/__init__.py @@ -16,7 +16,9 @@ from ._models_py3 import CloudError from ._models_py3 import CloudErrorBody from ._models_py3 import Components1Q1Og48SchemasManagedclusterAllof1 -from ._models_py3 import Components1Umhcm8SchemasManagedclusteridentityPropertiesUserassignedidentitiesAdditionalproperties +from ._models_py3 import ( + Components1Umhcm8SchemasManagedclusteridentityPropertiesUserassignedidentitiesAdditionalproperties, +) from ._models_py3 import ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties from ._models_py3 import ContainerServiceDiagnosticsProfile from ._models_py3 import ContainerServiceLinuxProfile @@ -76,136 +78,134 @@ from ._models_py3 import TimeSpan from ._models_py3 import UserAssignedIdentity - -from ._container_service_client_enums import ( - AgentPoolMode, - AgentPoolType, - Code, - ConnectionStatus, - ContainerServiceStorageProfileTypes, - ContainerServiceVMSizeTypes, - Count, - CreatedByType, - Expander, - KubeletDiskType, - LicenseType, - LoadBalancerSku, - ManagedClusterPodIdentityProvisioningState, - ManagedClusterSKUName, - ManagedClusterSKUTier, - NetworkMode, - NetworkPlugin, - NetworkPolicy, - OSDiskType, - OSType, - OutboundType, - PrivateEndpointConnectionProvisioningState, - ResourceIdentityType, - ScaleSetEvictionPolicy, - ScaleSetPriority, - UpgradeChannel, - WeekDay, -) +from ._container_service_client_enums import AgentPoolMode +from ._container_service_client_enums import AgentPoolType +from ._container_service_client_enums import Code +from ._container_service_client_enums import ConnectionStatus +from ._container_service_client_enums import ContainerServiceStorageProfileTypes +from ._container_service_client_enums import ContainerServiceVMSizeTypes +from ._container_service_client_enums import Count +from ._container_service_client_enums import CreatedByType +from ._container_service_client_enums import Expander +from ._container_service_client_enums import KubeletDiskType +from ._container_service_client_enums import LicenseType +from ._container_service_client_enums import LoadBalancerSku +from ._container_service_client_enums import ManagedClusterPodIdentityProvisioningState +from ._container_service_client_enums import ManagedClusterSKUName +from ._container_service_client_enums import ManagedClusterSKUTier +from ._container_service_client_enums import NetworkMode +from ._container_service_client_enums import NetworkPlugin +from ._container_service_client_enums import NetworkPolicy +from ._container_service_client_enums import OSDiskType +from ._container_service_client_enums import OSType +from ._container_service_client_enums import OutboundType +from ._container_service_client_enums import PrivateEndpointConnectionProvisioningState +from ._container_service_client_enums import ResourceIdentityType +from ._container_service_client_enums import ScaleSetEvictionPolicy +from ._container_service_client_enums import ScaleSetPriority +from ._container_service_client_enums import UpgradeChannel +from ._container_service_client_enums import WeekDay from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'AgentPool', - 'AgentPoolAvailableVersions', - 'AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem', - 'AgentPoolListResult', - 'AgentPoolUpgradeProfile', - 'AgentPoolUpgradeProfilePropertiesUpgradesItem', - 'AgentPoolUpgradeSettings', - 'CloudError', - 'CloudErrorBody', - 'Components1Q1Og48SchemasManagedclusterAllof1', - 'Components1Umhcm8SchemasManagedclusteridentityPropertiesUserassignedidentitiesAdditionalproperties', - 'ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties', - 'ContainerServiceDiagnosticsProfile', - 'ContainerServiceLinuxProfile', - 'ContainerServiceMasterProfile', - 'ContainerServiceNetworkProfile', - 'ContainerServiceSshConfiguration', - 'ContainerServiceSshPublicKey', - 'ContainerServiceVMDiagnostics', - 'CredentialResult', - 'CredentialResults', - 'KubeletConfig', - 'LinuxOSConfig', - 'MaintenanceConfiguration', - 'MaintenanceConfigurationListResult', - 'ManagedCluster', - 'ManagedClusterAADProfile', - 'ManagedClusterAPIServerAccessProfile', - 'ManagedClusterAccessProfile', - 'ManagedClusterAddonProfile', - 'ManagedClusterAddonProfileIdentity', - 'ManagedClusterAgentPoolProfile', - 'ManagedClusterAgentPoolProfileProperties', - 'ManagedClusterAutoUpgradeProfile', - 'ManagedClusterIdentity', - 'ManagedClusterListResult', - 'ManagedClusterLoadBalancerProfile', - 'ManagedClusterLoadBalancerProfileManagedOutboundIPs', - 'ManagedClusterLoadBalancerProfileOutboundIPPrefixes', - 'ManagedClusterLoadBalancerProfileOutboundIPs', - 'ManagedClusterPodIdentity', - 'ManagedClusterPodIdentityException', - 'ManagedClusterPodIdentityProfile', - 'ManagedClusterPodIdentityProvisioningInfo', - 'ManagedClusterPoolUpgradeProfile', - 'ManagedClusterPoolUpgradeProfileUpgradesItem', - 'ManagedClusterPropertiesAutoScalerProfile', - 'ManagedClusterSKU', - 'ManagedClusterServicePrincipalProfile', - 'ManagedClusterUpgradeProfile', - 'ManagedClusterWindowsProfile', - 'OperationListResult', - 'OperationValue', - 'PowerState', - 'PrivateEndpoint', - 'PrivateEndpointConnection', - 'PrivateEndpointConnectionListResult', - 'PrivateLinkResource', - 'PrivateLinkResourcesListResult', - 'PrivateLinkServiceConnectionState', - 'Resource', - 'ResourceReference', - 'SubResource', - 'SysctlConfig', - 'SystemData', - 'TagsObject', - 'TimeInWeek', - 'TimeSpan', - 'UserAssignedIdentity', - 'AgentPoolMode', - 'AgentPoolType', - 'Code', - 'ConnectionStatus', - 'ContainerServiceStorageProfileTypes', - 'ContainerServiceVMSizeTypes', - 'Count', - 'CreatedByType', - 'Expander', - 'KubeletDiskType', - 'LicenseType', - 'LoadBalancerSku', - 'ManagedClusterPodIdentityProvisioningState', - 'ManagedClusterSKUName', - 'ManagedClusterSKUTier', - 'NetworkMode', - 'NetworkPlugin', - 'NetworkPolicy', - 'OSDiskType', - 'OSType', - 'OutboundType', - 'PrivateEndpointConnectionProvisioningState', - 'ResourceIdentityType', - 'ScaleSetEvictionPolicy', - 'ScaleSetPriority', - 'UpgradeChannel', - 'WeekDay', + "AgentPool", + "AgentPoolAvailableVersions", + "AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem", + "AgentPoolListResult", + "AgentPoolUpgradeProfile", + "AgentPoolUpgradeProfilePropertiesUpgradesItem", + "AgentPoolUpgradeSettings", + "CloudError", + "CloudErrorBody", + "Components1Q1Og48SchemasManagedclusterAllof1", + "Components1Umhcm8SchemasManagedclusteridentityPropertiesUserassignedidentitiesAdditionalproperties", + "ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties", + "ContainerServiceDiagnosticsProfile", + "ContainerServiceLinuxProfile", + "ContainerServiceMasterProfile", + "ContainerServiceNetworkProfile", + "ContainerServiceSshConfiguration", + "ContainerServiceSshPublicKey", + "ContainerServiceVMDiagnostics", + "CredentialResult", + "CredentialResults", + "KubeletConfig", + "LinuxOSConfig", + "MaintenanceConfiguration", + "MaintenanceConfigurationListResult", + "ManagedCluster", + "ManagedClusterAADProfile", + "ManagedClusterAPIServerAccessProfile", + "ManagedClusterAccessProfile", + "ManagedClusterAddonProfile", + "ManagedClusterAddonProfileIdentity", + "ManagedClusterAgentPoolProfile", + "ManagedClusterAgentPoolProfileProperties", + "ManagedClusterAutoUpgradeProfile", + "ManagedClusterIdentity", + "ManagedClusterListResult", + "ManagedClusterLoadBalancerProfile", + "ManagedClusterLoadBalancerProfileManagedOutboundIPs", + "ManagedClusterLoadBalancerProfileOutboundIPPrefixes", + "ManagedClusterLoadBalancerProfileOutboundIPs", + "ManagedClusterPodIdentity", + "ManagedClusterPodIdentityException", + "ManagedClusterPodIdentityProfile", + "ManagedClusterPodIdentityProvisioningInfo", + "ManagedClusterPoolUpgradeProfile", + "ManagedClusterPoolUpgradeProfileUpgradesItem", + "ManagedClusterPropertiesAutoScalerProfile", + "ManagedClusterSKU", + "ManagedClusterServicePrincipalProfile", + "ManagedClusterUpgradeProfile", + "ManagedClusterWindowsProfile", + "OperationListResult", + "OperationValue", + "PowerState", + "PrivateEndpoint", + "PrivateEndpointConnection", + "PrivateEndpointConnectionListResult", + "PrivateLinkResource", + "PrivateLinkResourcesListResult", + "PrivateLinkServiceConnectionState", + "Resource", + "ResourceReference", + "SubResource", + "SysctlConfig", + "SystemData", + "TagsObject", + "TimeInWeek", + "TimeSpan", + "UserAssignedIdentity", + "AgentPoolMode", + "AgentPoolType", + "Code", + "ConnectionStatus", + "ContainerServiceStorageProfileTypes", + "ContainerServiceVMSizeTypes", + "Count", + "CreatedByType", + "Expander", + "KubeletDiskType", + "LicenseType", + "LoadBalancerSku", + "ManagedClusterPodIdentityProvisioningState", + "ManagedClusterSKUName", + "ManagedClusterSKUTier", + "NetworkMode", + "NetworkPlugin", + "NetworkPolicy", + "OSDiskType", + "OSType", + "OutboundType", + "PrivateEndpointConnectionProvisioningState", + "ResourceIdentityType", + "ScaleSetEvictionPolicy", + "ScaleSetPriority", + "UpgradeChannel", + "WeekDay", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/models/_container_service_client_enums.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/models/_container_service_client_enums.py index 0f1e6fd4800b..2f1e8921522f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/models/_container_service_client_enums.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/models/_container_service_client_enums.py @@ -11,35 +11,35 @@ class AgentPoolMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """AgentPoolMode represents mode of an agent pool. - """ + """AgentPoolMode represents mode of an agent pool.""" SYSTEM = "System" USER = "User" + class AgentPoolType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """AgentPoolType represents types of an agent pool. - """ + """AgentPoolType represents types of an agent pool.""" VIRTUAL_MACHINE_SCALE_SETS = "VirtualMachineScaleSets" AVAILABILITY_SET = "AvailabilitySet" + class Code(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Tells whether the cluster is Running or Stopped - """ + """Tells whether the cluster is Running or Stopped.""" RUNNING = "Running" STOPPED = "Stopped" + class ConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The private link service connection status. - """ + """The private link service connection status.""" PENDING = "Pending" APPROVED = "Approved" REJECTED = "Rejected" DISCONNECTED = "Disconnected" + class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the orchestrator choice. @@ -48,9 +48,9 @@ class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEn STORAGE_ACCOUNT = "StorageAccount" MANAGED_DISKS = "ManagedDisks" + class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Size of agent VMs. - """ + """Size of agent VMs.""" STANDARD_A1 = "Standard_A1" STANDARD_A10 = "Standard_A10" @@ -227,6 +227,7 @@ class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): STANDARD_NV24 = "Standard_NV24" STANDARD_NV6 = "Standard_NV6" + class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): """Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, and 5. The default value is 1. @@ -236,22 +237,25 @@ class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): THREE = 3 FIVE = 5 + class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of identity that created the resource. - """ + """The type of identity that created the resource.""" USER = "User" APPLICATION = "Application" MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" + class Expander(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Expander.""" LEAST_WASTE = "least-waste" MOST_PODS = "most-pods" PRIORITY = "priority" RANDOM = "random" + class KubeletDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """KubeletDiskType determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. Allowed values: 'OS', 'Temporary' (preview). @@ -260,6 +264,7 @@ class KubeletDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): OS = "OS" TEMPORARY = "Temporary" + class LicenseType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The licenseType to use for Windows VMs. Windows_Server is used to enable Azure Hybrid User Benefits for Windows VMs. @@ -268,86 +273,87 @@ class LicenseType(str, Enum, metaclass=CaseInsensitiveEnumMeta): NONE = "None" WINDOWS_SERVER = "Windows_Server" + class LoadBalancerSku(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The load balancer sku for the managed cluster. - """ + """The load balancer sku for the managed cluster.""" STANDARD = "standard" BASIC = "basic" + class ManagedClusterPodIdentityProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The current provisioning state of the pod identity. - """ + """The current provisioning state of the pod identity.""" ASSIGNED = "Assigned" UPDATING = "Updating" DELETING = "Deleting" FAILED = "Failed" + class ManagedClusterSKUName(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Name of a managed cluster SKU. - """ + """Name of a managed cluster SKU.""" BASIC = "Basic" + class ManagedClusterSKUTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Tier of a managed cluster SKU. - """ + """Tier of a managed cluster SKU.""" PAID = "Paid" FREE = "Free" + class NetworkMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Network mode used for building Kubernetes network. - """ + """Network mode used for building Kubernetes network.""" TRANSPARENT = "transparent" BRIDGE = "bridge" + class NetworkPlugin(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Network plugin used for building Kubernetes network. - """ + """Network plugin used for building Kubernetes network.""" AZURE = "azure" KUBENET = "kubenet" + class NetworkPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Network policy used for building Kubernetes network. - """ + """Network policy used for building Kubernetes network.""" CALICO = "calico" AZURE = "azure" + class OSDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """OSDiskType represents the type of an OS disk on an agent pool. - """ + """OSDiskType represents the type of an OS disk on an agent pool.""" MANAGED = "Managed" EPHEMERAL = "Ephemeral" + class OSType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """OsType to be used to specify os type. Choose from Linux and Windows. Default to Linux. - """ + """OsType to be used to specify os type. Choose from Linux and Windows. Default to Linux.""" LINUX = "Linux" WINDOWS = "Windows" + class OutboundType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The outbound (egress) routing method. - """ + """The outbound (egress) routing method.""" LOAD_BALANCER = "loadBalancer" USER_DEFINED_ROUTING = "userDefinedRouting" + class PrivateEndpointConnectionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The current provisioning state. - """ + """The current provisioning state.""" SUCCEEDED = "Succeeded" CREATING = "Creating" DELETING = "Deleting" FAILED = "Failed" + class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of identity used for the managed cluster. Type 'SystemAssigned' will use an implicitly created identity in master components and an auto-created user assigned identity in MC_ @@ -359,6 +365,7 @@ class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): USER_ASSIGNED = "UserAssigned" NONE = "None" + class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ScaleSetEvictionPolicy to be used to specify eviction policy for Spot virtual machine scale set. Default to Delete. @@ -367,25 +374,25 @@ class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): DELETE = "Delete" DEALLOCATE = "Deallocate" + class ScaleSetPriority(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """ScaleSetPriority to be used to specify virtual machine scale set priority. Default to regular. - """ + """ScaleSetPriority to be used to specify virtual machine scale set priority. Default to regular.""" SPOT = "Spot" REGULAR = "Regular" + class UpgradeChannel(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """upgrade channel for auto upgrade. - """ + """upgrade channel for auto upgrade.""" RAPID = "rapid" STABLE = "stable" PATCH = "patch" NONE = "none" + class WeekDay(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The weekday enum. - """ + """The weekday enum.""" SUNDAY = "Sunday" MONDAY = "Monday" diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/models/_models_py3.py index d2af4c7f68e0..a4bbaec58a19 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/models/_models_py3.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/models/_models_py3.py @@ -1,4 +1,5 @@ # coding=utf-8 +# pylint: disable=too-many-lines # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -9,14 +10,14 @@ import datetime from typing import Dict, List, Optional, TYPE_CHECKING, Union -import msrest.serialization +from ... import _serialization if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - import __init__ as _models + from .. import models as _models -class SubResource(msrest.serialization.Model): +class SubResource(_serialization.Model): """Reference to another subresource. Variables are only populated by the server, and will be ignored when sending a request. @@ -31,30 +32,26 @@ class SubResource(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(SubResource, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.id = None self.name = None self.type = None -class AgentPool(SubResource): +class AgentPool(SubResource): # pylint: disable=too-many-instance-attributes """Agent Pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -107,7 +104,7 @@ class AgentPool(SubResource): "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :vartype vm_size: str or ~azure.mgmt.containerservice.v2021_02_01.models.ContainerServiceVMSizeTypes :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine @@ -117,11 +114,11 @@ class AgentPool(SubResource): :ivar os_disk_type: OS disk type to be used for machines in a given agent pool. Allowed values are 'Ephemeral' and 'Managed'. If unspecified, defaults to 'Ephemeral' when the VM supports ephemeral OS and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults - to 'Managed'. May not be changed after creation. Known values are: "Managed", "Ephemeral". + to 'Managed'. May not be changed after creation. Known values are: "Managed" and "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2021_02_01.models.OSDiskType :ivar kubelet_disk_type: KubeletDiskType determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. Currently allows one value, OS, - resulting in Kubelet using the OS disk for data. Known values are: "OS", "Temporary". + resulting in Kubelet using the OS disk for data. Known values are: "OS" and "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2021_02_01.models.KubeletDiskType :ivar vnet_subnet_id: VNet SubnetID specifies the VNet's subnet identifier for nodes and maybe @@ -132,7 +129,7 @@ class AgentPool(SubResource): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Known values are: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux" and "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2021_02_01.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -141,10 +138,11 @@ class AgentPool(SubResource): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar type_properties_type: AgentPoolType represents types of an agent pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :vartype type_properties_type: str or ~azure.mgmt.containerservice.v2021_02_01.models.AgentPoolType - :ivar mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", "User". + :ivar mode: AgentPoolMode represents mode of an agent pool. Known values are: "System" and + "User". :vartype mode: str or ~azure.mgmt.containerservice.v2021_02_01.models.AgentPoolMode :ivar orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -168,20 +166,19 @@ class AgentPool(SubResource): IP Prefix. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Known values are: "Spot", "Regular". Default value: "Regular". + priority. Default to regular. Known values are: "Spot" and "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2021_02_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy - for Spot virtual machine scale set. Default to Delete. Known values are: "Delete", - "Deallocate". Default value: "Delete". + for Spot virtual machine scale set. Default to Delete. Known values are: "Delete" and + "Deallocate". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2021_02_01.models.ScaleSetEvictionPolicy :ivar spot_max_price: SpotMaxPrice to be used to specify the maximum price you are willing to pay in US Dollars. Possible values are any decimal value greater than zero or -1 which indicates default price to be up-to on-demand. :vartype spot_max_price: float - :ivar tags: A set of tags. Agent pool tags to be persisted on the agent pool virtual machine - scale set. + :ivar tags: Agent pool tags to be persisted on the agent pool virtual machine scale set. :vartype tags: dict[str, str] :ivar node_labels: Agent pool node labels to be persisted across all nodes in agent pool. :vartype node_labels: dict[str, str] @@ -199,54 +196,54 @@ class AgentPool(SubResource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'os_disk_size_gb': {'maximum': 1023, 'minimum': 0}, - 'node_image_version': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'power_state': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "os_disk_size_gb": {"maximum": 1023, "minimum": 0}, + "node_image_version": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "power_state": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'count': {'key': 'properties.count', 'type': 'int'}, - 'vm_size': {'key': 'properties.vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'properties.osDiskSizeGB', 'type': 'int'}, - 'os_disk_type': {'key': 'properties.osDiskType', 'type': 'str'}, - 'kubelet_disk_type': {'key': 'properties.kubeletDiskType', 'type': 'str'}, - 'vnet_subnet_id': {'key': 'properties.vnetSubnetID', 'type': 'str'}, - 'pod_subnet_id': {'key': 'properties.podSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'properties.maxPods', 'type': 'int'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'max_count': {'key': 'properties.maxCount', 'type': 'int'}, - 'min_count': {'key': 'properties.minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'properties.enableAutoScaling', 'type': 'bool'}, - 'type_properties_type': {'key': 'properties.type', 'type': 'str'}, - 'mode': {'key': 'properties.mode', 'type': 'str'}, - 'orchestrator_version': {'key': 'properties.orchestratorVersion', 'type': 'str'}, - 'node_image_version': {'key': 'properties.nodeImageVersion', 'type': 'str'}, - 'upgrade_settings': {'key': 'properties.upgradeSettings', 'type': 'AgentPoolUpgradeSettings'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'power_state': {'key': 'properties.powerState', 'type': 'PowerState'}, - 'availability_zones': {'key': 'properties.availabilityZones', 'type': '[str]'}, - 'enable_node_public_ip': {'key': 'properties.enableNodePublicIP', 'type': 'bool'}, - 'node_public_ip_prefix_id': {'key': 'properties.nodePublicIPPrefixID', 'type': 'str'}, - 'scale_set_priority': {'key': 'properties.scaleSetPriority', 'type': 'str'}, - 'scale_set_eviction_policy': {'key': 'properties.scaleSetEvictionPolicy', 'type': 'str'}, - 'spot_max_price': {'key': 'properties.spotMaxPrice', 'type': 'float'}, - 'tags': {'key': 'properties.tags', 'type': '{str}'}, - 'node_labels': {'key': 'properties.nodeLabels', 'type': '{str}'}, - 'node_taints': {'key': 'properties.nodeTaints', 'type': '[str]'}, - 'proximity_placement_group_id': {'key': 'properties.proximityPlacementGroupID', 'type': 'str'}, - 'kubelet_config': {'key': 'properties.kubeletConfig', 'type': 'KubeletConfig'}, - 'linux_os_config': {'key': 'properties.linuxOSConfig', 'type': 'LinuxOSConfig'}, - 'enable_encryption_at_host': {'key': 'properties.enableEncryptionAtHost', 'type': 'bool'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "count": {"key": "properties.count", "type": "int"}, + "vm_size": {"key": "properties.vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "properties.osDiskSizeGB", "type": "int"}, + "os_disk_type": {"key": "properties.osDiskType", "type": "str"}, + "kubelet_disk_type": {"key": "properties.kubeletDiskType", "type": "str"}, + "vnet_subnet_id": {"key": "properties.vnetSubnetID", "type": "str"}, + "pod_subnet_id": {"key": "properties.podSubnetID", "type": "str"}, + "max_pods": {"key": "properties.maxPods", "type": "int"}, + "os_type": {"key": "properties.osType", "type": "str"}, + "max_count": {"key": "properties.maxCount", "type": "int"}, + "min_count": {"key": "properties.minCount", "type": "int"}, + "enable_auto_scaling": {"key": "properties.enableAutoScaling", "type": "bool"}, + "type_properties_type": {"key": "properties.type", "type": "str"}, + "mode": {"key": "properties.mode", "type": "str"}, + "orchestrator_version": {"key": "properties.orchestratorVersion", "type": "str"}, + "node_image_version": {"key": "properties.nodeImageVersion", "type": "str"}, + "upgrade_settings": {"key": "properties.upgradeSettings", "type": "AgentPoolUpgradeSettings"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "power_state": {"key": "properties.powerState", "type": "PowerState"}, + "availability_zones": {"key": "properties.availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "properties.enableNodePublicIP", "type": "bool"}, + "node_public_ip_prefix_id": {"key": "properties.nodePublicIPPrefixID", "type": "str"}, + "scale_set_priority": {"key": "properties.scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "properties.scaleSetEvictionPolicy", "type": "str"}, + "spot_max_price": {"key": "properties.spotMaxPrice", "type": "float"}, + "tags": {"key": "properties.tags", "type": "{str}"}, + "node_labels": {"key": "properties.nodeLabels", "type": "{str}"}, + "node_taints": {"key": "properties.nodeTaints", "type": "[str]"}, + "proximity_placement_group_id": {"key": "properties.proximityPlacementGroupID", "type": "str"}, + "kubelet_config": {"key": "properties.kubeletConfig", "type": "KubeletConfig"}, + "linux_os_config": {"key": "properties.linuxOSConfig", "type": "LinuxOSConfig"}, + "enable_encryption_at_host": {"key": "properties.enableEncryptionAtHost", "type": "bool"}, } - def __init__( + def __init__( # pylint: disable=too-many-locals self, *, count: Optional[int] = None, @@ -257,7 +254,7 @@ def __init__( vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, @@ -268,9 +265,9 @@ def __init__( availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", - spot_max_price: Optional[float] = -1, + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", + spot_max_price: float = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, @@ -322,7 +319,7 @@ def __init__( "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :paramtype vm_size: str or ~azure.mgmt.containerservice.v2021_02_01.models.ContainerServiceVMSizeTypes :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every @@ -332,12 +329,12 @@ def __init__( :keyword os_disk_type: OS disk type to be used for machines in a given agent pool. Allowed values are 'Ephemeral' and 'Managed'. If unspecified, defaults to 'Ephemeral' when the VM supports ephemeral OS and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, - defaults to 'Managed'. May not be changed after creation. Known values are: "Managed", + defaults to 'Managed'. May not be changed after creation. Known values are: "Managed" and "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2021_02_01.models.OSDiskType :keyword kubelet_disk_type: KubeletDiskType determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. Currently allows one value, OS, - resulting in Kubelet using the OS disk for data. Known values are: "OS", "Temporary". + resulting in Kubelet using the OS disk for data. Known values are: "OS" and "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2021_02_01.models.KubeletDiskType :keyword vnet_subnet_id: VNet SubnetID specifies the VNet's subnet identifier for nodes and @@ -348,7 +345,7 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux" and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2021_02_01.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -357,10 +354,10 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword type_properties_type: AgentPoolType represents types of an agent pool. Known values - are: "VirtualMachineScaleSets", "AvailabilitySet". + are: "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type_properties_type: str or ~azure.mgmt.containerservice.v2021_02_01.models.AgentPoolType - :keyword mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", + :keyword mode: AgentPoolMode represents mode of an agent pool. Known values are: "System" and "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2021_02_01.models.AgentPoolMode :keyword orchestrator_version: Version of orchestrator specified when creating the managed @@ -378,20 +375,19 @@ def __init__( Public IP Prefix. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Known values are: "Spot", "Regular". Default value: "Regular". + priority. Default to regular. Known values are: "Spot" and "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2021_02_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction - policy for Spot virtual machine scale set. Default to Delete. Known values are: "Delete", - "Deallocate". Default value: "Delete". + policy for Spot virtual machine scale set. Default to Delete. Known values are: "Delete" and + "Deallocate". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2021_02_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: SpotMaxPrice to be used to specify the maximum price you are willing to pay in US Dollars. Possible values are any decimal value greater than zero or -1 which indicates default price to be up-to on-demand. :paramtype spot_max_price: float - :keyword tags: A set of tags. Agent pool tags to be persisted on the agent pool virtual machine - scale set. + :keyword tags: Agent pool tags to be persisted on the agent pool virtual machine scale set. :paramtype tags: dict[str, str] :keyword node_labels: Agent pool node labels to be persisted across all nodes in agent pool. :paramtype node_labels: dict[str, str] @@ -407,7 +403,7 @@ def __init__( :keyword enable_encryption_at_host: Whether to enable EncryptionAtHost. :paramtype enable_encryption_at_host: bool """ - super(AgentPool, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.vm_size = vm_size self.os_disk_size_gb = os_disk_size_gb @@ -442,7 +438,7 @@ def __init__( self.enable_encryption_at_host = enable_encryption_at_host -class AgentPoolAvailableVersions(msrest.serialization.Model): +class AgentPoolAvailableVersions(_serialization.Model): """The list of available versions for an agent pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -459,16 +455,19 @@ class AgentPoolAvailableVersions(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'agent_pool_versions': {'key': 'properties.agentPoolVersions', 'type': '[AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "agent_pool_versions": { + "key": "properties.agentPoolVersions", + "type": "[AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem]", + }, } def __init__( @@ -482,14 +481,14 @@ def __init__( :paramtype agent_pool_versions: list[~azure.mgmt.containerservice.v2021_02_01.models.AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem] """ - super(AgentPoolAvailableVersions, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None self.agent_pool_versions = agent_pool_versions -class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(msrest.serialization.Model): +class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(_serialization.Model): """AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem. :ivar default: Whether this version is the default agent pool version. @@ -501,9 +500,9 @@ class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(msrest.serializa """ _attribute_map = { - 'default': {'key': 'default', 'type': 'bool'}, - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "default": {"key": "default", "type": "bool"}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } def __init__( @@ -522,13 +521,13 @@ def __init__( :keyword is_preview: Whether Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.default = default self.kubernetes_version = kubernetes_version self.is_preview = is_preview -class AgentPoolListResult(msrest.serialization.Model): +class AgentPoolListResult(_serialization.Model): """The response from the List Agent Pools operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -540,30 +539,25 @@ class AgentPoolListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[AgentPool]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[AgentPool]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.AgentPool"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.AgentPool"]] = None, **kwargs): """ :keyword value: The list of agent pools. :paramtype value: list[~azure.mgmt.containerservice.v2021_02_01.models.AgentPool] """ - super(AgentPoolListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class AgentPoolUpgradeProfile(msrest.serialization.Model): +class AgentPoolUpgradeProfile(_serialization.Model): """The list of available upgrades for an agent pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -576,10 +570,10 @@ class AgentPoolUpgradeProfile(msrest.serialization.Model): :vartype name: str :ivar type: Type of the agent pool upgrade profile. :vartype type: str - :ivar kubernetes_version: Required. Kubernetes version (major, minor, patch). + :ivar kubernetes_version: Kubernetes version (major, minor, patch). Required. :vartype kubernetes_version: str - :ivar os_type: Required. OsType to be used to specify os type. Choose from Linux and Windows. - Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to + Linux. Known values are: "Linux" and "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2021_02_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -590,21 +584,21 @@ class AgentPoolUpgradeProfile(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kubernetes_version': {'required': True}, - 'os_type': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "kubernetes_version": {"required": True}, + "os_type": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'kubernetes_version': {'key': 'properties.kubernetesVersion', 'type': 'str'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'upgrades': {'key': 'properties.upgrades', 'type': '[AgentPoolUpgradeProfilePropertiesUpgradesItem]'}, - 'latest_node_image_version': {'key': 'properties.latestNodeImageVersion', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "os_type": {"key": "properties.osType", "type": "str"}, + "upgrades": {"key": "properties.upgrades", "type": "[AgentPoolUpgradeProfilePropertiesUpgradesItem]"}, + "latest_node_image_version": {"key": "properties.latestNodeImageVersion", "type": "str"}, } def __init__( @@ -617,10 +611,10 @@ def __init__( **kwargs ): """ - :keyword kubernetes_version: Required. Kubernetes version (major, minor, patch). + :keyword kubernetes_version: Kubernetes version (major, minor, patch). Required. :paramtype kubernetes_version: str - :keyword os_type: Required. OsType to be used to specify os type. Choose from Linux and - Windows. Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default + to Linux. Known values are: "Linux" and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2021_02_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: @@ -629,7 +623,7 @@ def __init__( image version. :paramtype latest_node_image_version: str """ - super(AgentPoolUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -639,7 +633,7 @@ def __init__( self.latest_node_image_version = latest_node_image_version -class AgentPoolUpgradeProfilePropertiesUpgradesItem(msrest.serialization.Model): +class AgentPoolUpgradeProfilePropertiesUpgradesItem(_serialization.Model): """AgentPoolUpgradeProfilePropertiesUpgradesItem. :ivar kubernetes_version: Kubernetes version (major, minor, patch). @@ -649,29 +643,23 @@ class AgentPoolUpgradeProfilePropertiesUpgradesItem(msrest.serialization.Model): """ _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } - def __init__( - self, - *, - kubernetes_version: Optional[str] = None, - is_preview: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, kubernetes_version: Optional[str] = None, is_preview: Optional[bool] = None, **kwargs): """ :keyword kubernetes_version: Kubernetes version (major, minor, patch). :paramtype kubernetes_version: str :keyword is_preview: Whether Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(AgentPoolUpgradeProfilePropertiesUpgradesItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.is_preview = is_preview -class AgentPoolUpgradeSettings(msrest.serialization.Model): +class AgentPoolUpgradeSettings(_serialization.Model): """Settings for upgrading an agentpool. :ivar max_surge: Count or percentage of additional nodes to be added during upgrade. If empty @@ -680,25 +668,20 @@ class AgentPoolUpgradeSettings(msrest.serialization.Model): """ _attribute_map = { - 'max_surge': {'key': 'maxSurge', 'type': 'str'}, + "max_surge": {"key": "maxSurge", "type": "str"}, } - def __init__( - self, - *, - max_surge: Optional[str] = None, - **kwargs - ): + def __init__(self, *, max_surge: Optional[str] = None, **kwargs): """ :keyword max_surge: Count or percentage of additional nodes to be added during upgrade. If empty uses AKS default. :paramtype max_surge: str """ - super(AgentPoolUpgradeSettings, self).__init__(**kwargs) + super().__init__(**kwargs) self.max_surge = max_surge -class CloudError(msrest.serialization.Model): +class CloudError(_serialization.Model): """An error response from the Container service. :ivar error: Details about the error. @@ -706,24 +689,19 @@ class CloudError(msrest.serialization.Model): """ _attribute_map = { - 'error': {'key': 'error', 'type': 'CloudErrorBody'}, + "error": {"key": "error", "type": "CloudErrorBody"}, } - def __init__( - self, - *, - error: Optional["_models.CloudErrorBody"] = None, - **kwargs - ): + def __init__(self, *, error: Optional["_models.CloudErrorBody"] = None, **kwargs): """ :keyword error: Details about the error. :paramtype error: ~azure.mgmt.containerservice.v2021_02_01.models.CloudErrorBody """ - super(CloudError, self).__init__(**kwargs) + super().__init__(**kwargs) self.error = error -class CloudErrorBody(msrest.serialization.Model): +class CloudErrorBody(_serialization.Model): """An error response from the Container service. :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed @@ -740,10 +718,10 @@ class CloudErrorBody(msrest.serialization.Model): """ _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[CloudErrorBody]"}, } def __init__( @@ -768,14 +746,16 @@ def __init__( :keyword details: A list of additional details about the error. :paramtype details: list[~azure.mgmt.containerservice.v2021_02_01.models.CloudErrorBody] """ - super(CloudErrorBody, self).__init__(**kwargs) + super().__init__(**kwargs) self.code = code self.message = message self.target = target self.details = details -class Components1Q1Og48SchemasManagedclusterAllof1(msrest.serialization.Model): +class Components1Q1Og48SchemasManagedclusterAllof1( + _serialization.Model +): # pylint: disable=too-many-instance-attributes """Components1Q1Og48SchemasManagedclusterAllof1. Variables are only populated by the server, and will be ignored when sending a request. @@ -852,44 +832,56 @@ class Components1Q1Og48SchemasManagedclusterAllof1(msrest.serialization.Model): """ _validation = { - 'provisioning_state': {'readonly': True}, - 'power_state': {'readonly': True}, - 'max_agent_pools': {'readonly': True}, - 'fqdn': {'readonly': True}, - 'private_fqdn': {'readonly': True}, - 'azure_portal_fqdn': {'readonly': True}, + "provisioning_state": {"readonly": True}, + "power_state": {"readonly": True}, + "max_agent_pools": {"readonly": True}, + "fqdn": {"readonly": True}, + "private_fqdn": {"readonly": True}, + "azure_portal_fqdn": {"readonly": True}, } _attribute_map = { - 'identity': {'key': 'identity', 'type': 'ManagedClusterIdentity'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'power_state': {'key': 'properties.powerState', 'type': 'PowerState'}, - 'max_agent_pools': {'key': 'properties.maxAgentPools', 'type': 'int'}, - 'kubernetes_version': {'key': 'properties.kubernetesVersion', 'type': 'str'}, - 'dns_prefix': {'key': 'properties.dnsPrefix', 'type': 'str'}, - 'fqdn_subdomain': {'key': 'properties.fqdnSubdomain', 'type': 'str'}, - 'fqdn': {'key': 'properties.fqdn', 'type': 'str'}, - 'private_fqdn': {'key': 'properties.privateFQDN', 'type': 'str'}, - 'azure_portal_fqdn': {'key': 'properties.azurePortalFQDN', 'type': 'str'}, - 'agent_pool_profiles': {'key': 'properties.agentPoolProfiles', 'type': '[ManagedClusterAgentPoolProfile]'}, - 'linux_profile': {'key': 'properties.linuxProfile', 'type': 'ContainerServiceLinuxProfile'}, - 'windows_profile': {'key': 'properties.windowsProfile', 'type': 'ManagedClusterWindowsProfile'}, - 'service_principal_profile': {'key': 'properties.servicePrincipalProfile', 'type': 'ManagedClusterServicePrincipalProfile'}, - 'addon_profiles': {'key': 'properties.addonProfiles', 'type': '{ManagedClusterAddonProfile}'}, - 'pod_identity_profile': {'key': 'properties.podIdentityProfile', 'type': 'ManagedClusterPodIdentityProfile'}, - 'node_resource_group': {'key': 'properties.nodeResourceGroup', 'type': 'str'}, - 'enable_rbac': {'key': 'properties.enableRBAC', 'type': 'bool'}, - 'enable_pod_security_policy': {'key': 'properties.enablePodSecurityPolicy', 'type': 'bool'}, - 'network_profile': {'key': 'properties.networkProfile', 'type': 'ContainerServiceNetworkProfile'}, - 'aad_profile': {'key': 'properties.aadProfile', 'type': 'ManagedClusterAADProfile'}, - 'auto_upgrade_profile': {'key': 'properties.autoUpgradeProfile', 'type': 'ManagedClusterAutoUpgradeProfile'}, - 'auto_scaler_profile': {'key': 'properties.autoScalerProfile', 'type': 'ManagedClusterPropertiesAutoScalerProfile'}, - 'api_server_access_profile': {'key': 'properties.apiServerAccessProfile', 'type': 'ManagedClusterAPIServerAccessProfile'}, - 'disk_encryption_set_id': {'key': 'properties.diskEncryptionSetID', 'type': 'str'}, - 'identity_profile': {'key': 'properties.identityProfile', 'type': '{ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties}'}, + "identity": {"key": "identity", "type": "ManagedClusterIdentity"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "power_state": {"key": "properties.powerState", "type": "PowerState"}, + "max_agent_pools": {"key": "properties.maxAgentPools", "type": "int"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "dns_prefix": {"key": "properties.dnsPrefix", "type": "str"}, + "fqdn_subdomain": {"key": "properties.fqdnSubdomain", "type": "str"}, + "fqdn": {"key": "properties.fqdn", "type": "str"}, + "private_fqdn": {"key": "properties.privateFQDN", "type": "str"}, + "azure_portal_fqdn": {"key": "properties.azurePortalFQDN", "type": "str"}, + "agent_pool_profiles": {"key": "properties.agentPoolProfiles", "type": "[ManagedClusterAgentPoolProfile]"}, + "linux_profile": {"key": "properties.linuxProfile", "type": "ContainerServiceLinuxProfile"}, + "windows_profile": {"key": "properties.windowsProfile", "type": "ManagedClusterWindowsProfile"}, + "service_principal_profile": { + "key": "properties.servicePrincipalProfile", + "type": "ManagedClusterServicePrincipalProfile", + }, + "addon_profiles": {"key": "properties.addonProfiles", "type": "{ManagedClusterAddonProfile}"}, + "pod_identity_profile": {"key": "properties.podIdentityProfile", "type": "ManagedClusterPodIdentityProfile"}, + "node_resource_group": {"key": "properties.nodeResourceGroup", "type": "str"}, + "enable_rbac": {"key": "properties.enableRBAC", "type": "bool"}, + "enable_pod_security_policy": {"key": "properties.enablePodSecurityPolicy", "type": "bool"}, + "network_profile": {"key": "properties.networkProfile", "type": "ContainerServiceNetworkProfile"}, + "aad_profile": {"key": "properties.aadProfile", "type": "ManagedClusterAADProfile"}, + "auto_upgrade_profile": {"key": "properties.autoUpgradeProfile", "type": "ManagedClusterAutoUpgradeProfile"}, + "auto_scaler_profile": { + "key": "properties.autoScalerProfile", + "type": "ManagedClusterPropertiesAutoScalerProfile", + }, + "api_server_access_profile": { + "key": "properties.apiServerAccessProfile", + "type": "ManagedClusterAPIServerAccessProfile", + }, + "disk_encryption_set_id": {"key": "properties.diskEncryptionSetID", "type": "str"}, + "identity_profile": { + "key": "properties.identityProfile", + "type": "{ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties}", + }, } - def __init__( + def __init__( # pylint: disable=too-many-locals self, *, identity: Optional["_models.ManagedClusterIdentity"] = None, @@ -911,7 +903,12 @@ def __init__( auto_scaler_profile: Optional["_models.ManagedClusterPropertiesAutoScalerProfile"] = None, api_server_access_profile: Optional["_models.ManagedClusterAPIServerAccessProfile"] = None, disk_encryption_set_id: Optional[str] = None, - identity_profile: Optional[Dict[str, "_models.ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties"]] = None, + identity_profile: Optional[ + Dict[ + str, + "_models.ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties", + ] + ] = None, **kwargs ): """ @@ -973,7 +970,7 @@ def __init__( :paramtype identity_profile: dict[str, ~azure.mgmt.containerservice.v2021_02_01.models.ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties] """ - super(Components1Q1Og48SchemasManagedclusterAllof1, self).__init__(**kwargs) + super().__init__(**kwargs) self.identity = identity self.provisioning_state = None self.power_state = None @@ -1002,7 +999,9 @@ def __init__( self.identity_profile = identity_profile -class Components1Umhcm8SchemasManagedclusteridentityPropertiesUserassignedidentitiesAdditionalproperties(msrest.serialization.Model): +class Components1Umhcm8SchemasManagedclusteridentityPropertiesUserassignedidentitiesAdditionalproperties( + _serialization.Model +): """Components1Umhcm8SchemasManagedclusteridentityPropertiesUserassignedidentitiesAdditionalproperties. Variables are only populated by the server, and will be ignored when sending a request. @@ -1014,27 +1013,23 @@ class Components1Umhcm8SchemasManagedclusteridentityPropertiesUserassignedidenti """ _validation = { - 'principal_id': {'readonly': True}, - 'client_id': {'readonly': True}, + "principal_id": {"readonly": True}, + "client_id": {"readonly": True}, } _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, + "principal_id": {"key": "principalId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(Components1Umhcm8SchemasManagedclusteridentityPropertiesUserassignedidentitiesAdditionalproperties, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.principal_id = None self.client_id = None -class UserAssignedIdentity(msrest.serialization.Model): +class UserAssignedIdentity(_serialization.Model): """UserAssignedIdentity. :ivar resource_id: The resource id of the user assigned identity. @@ -1046,9 +1041,9 @@ class UserAssignedIdentity(msrest.serialization.Model): """ _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'object_id': {'key': 'objectId', 'type': 'str'}, + "resource_id": {"key": "resourceId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + "object_id": {"key": "objectId", "type": "str"}, } def __init__( @@ -1067,13 +1062,15 @@ def __init__( :keyword object_id: The object id of the user assigned identity. :paramtype object_id: str """ - super(UserAssignedIdentity, self).__init__(**kwargs) + super().__init__(**kwargs) self.resource_id = resource_id self.client_id = client_id self.object_id = object_id -class ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties(UserAssignedIdentity): +class ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties( + UserAssignedIdentity +): """ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties. :ivar resource_id: The resource id of the user assigned identity. @@ -1085,9 +1082,9 @@ class ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAd """ _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'object_id': {'key': 'objectId', 'type': 'str'}, + "resource_id": {"key": "resourceId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + "object_id": {"key": "objectId", "type": "str"}, } def __init__( @@ -1106,83 +1103,72 @@ def __init__( :keyword object_id: The object id of the user assigned identity. :paramtype object_id: str """ - super(ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties, self).__init__(resource_id=resource_id, client_id=client_id, object_id=object_id, **kwargs) + super().__init__(resource_id=resource_id, client_id=client_id, object_id=object_id, **kwargs) -class ContainerServiceDiagnosticsProfile(msrest.serialization.Model): +class ContainerServiceDiagnosticsProfile(_serialization.Model): """Profile for diagnostics on the container service cluster. All required parameters must be populated in order to send to Azure. - :ivar vm_diagnostics: Required. Profile for diagnostics on the container service VMs. + :ivar vm_diagnostics: Profile for diagnostics on the container service VMs. Required. :vartype vm_diagnostics: ~azure.mgmt.containerservice.v2021_02_01.models.ContainerServiceVMDiagnostics """ _validation = { - 'vm_diagnostics': {'required': True}, + "vm_diagnostics": {"required": True}, } _attribute_map = { - 'vm_diagnostics': {'key': 'vmDiagnostics', 'type': 'ContainerServiceVMDiagnostics'}, + "vm_diagnostics": {"key": "vmDiagnostics", "type": "ContainerServiceVMDiagnostics"}, } - def __init__( - self, - *, - vm_diagnostics: "_models.ContainerServiceVMDiagnostics", - **kwargs - ): + def __init__(self, *, vm_diagnostics: "_models.ContainerServiceVMDiagnostics", **kwargs): """ - :keyword vm_diagnostics: Required. Profile for diagnostics on the container service VMs. + :keyword vm_diagnostics: Profile for diagnostics on the container service VMs. Required. :paramtype vm_diagnostics: ~azure.mgmt.containerservice.v2021_02_01.models.ContainerServiceVMDiagnostics """ - super(ContainerServiceDiagnosticsProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.vm_diagnostics = vm_diagnostics -class ContainerServiceLinuxProfile(msrest.serialization.Model): +class ContainerServiceLinuxProfile(_serialization.Model): """Profile for Linux VMs in the container service cluster. All required parameters must be populated in order to send to Azure. - :ivar admin_username: Required. The administrator username to use for Linux VMs. + :ivar admin_username: The administrator username to use for Linux VMs. Required. :vartype admin_username: str - :ivar ssh: Required. SSH configuration for Linux-based VMs running on Azure. + :ivar ssh: SSH configuration for Linux-based VMs running on Azure. Required. :vartype ssh: ~azure.mgmt.containerservice.v2021_02_01.models.ContainerServiceSshConfiguration """ _validation = { - 'admin_username': {'required': True, 'pattern': r'^[A-Za-z][-A-Za-z0-9_]*$'}, - 'ssh': {'required': True}, + "admin_username": {"required": True, "pattern": r"^[A-Za-z][-A-Za-z0-9_]*$"}, + "ssh": {"required": True}, } _attribute_map = { - 'admin_username': {'key': 'adminUsername', 'type': 'str'}, - 'ssh': {'key': 'ssh', 'type': 'ContainerServiceSshConfiguration'}, + "admin_username": {"key": "adminUsername", "type": "str"}, + "ssh": {"key": "ssh", "type": "ContainerServiceSshConfiguration"}, } - def __init__( - self, - *, - admin_username: str, - ssh: "_models.ContainerServiceSshConfiguration", - **kwargs - ): + def __init__(self, *, admin_username: str, ssh: "_models.ContainerServiceSshConfiguration", **kwargs): """ - :keyword admin_username: Required. The administrator username to use for Linux VMs. + :keyword admin_username: The administrator username to use for Linux VMs. Required. :paramtype admin_username: str - :keyword ssh: Required. SSH configuration for Linux-based VMs running on Azure. + :keyword ssh: SSH configuration for Linux-based VMs running on Azure. Required. :paramtype ssh: ~azure.mgmt.containerservice.v2021_02_01.models.ContainerServiceSshConfiguration """ - super(ContainerServiceLinuxProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.admin_username = admin_username self.ssh = ssh -class ContainerServiceMasterProfile(msrest.serialization.Model): +class ContainerServiceMasterProfile(_serialization.Model): """Profile for the container service master. Variables are only populated by the server, and will be ignored when sending a request. @@ -1190,11 +1176,11 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar count: Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, - and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". + and 5. The default value is 1. Known values are: 1, 3, and 5. :vartype count: int or ~azure.mgmt.containerservice.v2021_02_01.models.Count - :ivar dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. + :ivar dns_prefix: DNS prefix to be used to create the FQDN for the master pool. Required. :vartype dns_prefix: str - :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + :ivar vm_size: Size of agent VMs. Required. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -1231,7 +1217,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :vartype vm_size: str or ~azure.mgmt.containerservice.v2021_02_01.models.ContainerServiceVMSizeTypes :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine @@ -1245,7 +1231,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): :vartype first_consecutive_static_ip: str :ivar storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount" and "ManagedDisks". :vartype storage_profile: str or ~azure.mgmt.containerservice.v2021_02_01.models.ContainerServiceStorageProfileTypes :ivar fqdn: FQDN for the master pool. @@ -1253,21 +1239,21 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): """ _validation = { - 'dns_prefix': {'required': True}, - 'vm_size': {'required': True}, - 'os_disk_size_gb': {'maximum': 1023, 'minimum': 0}, - 'fqdn': {'readonly': True}, + "dns_prefix": {"required": True}, + "vm_size": {"required": True}, + "os_disk_size_gb": {"maximum": 1023, "minimum": 0}, + "fqdn": {"readonly": True}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'dns_prefix': {'key': 'dnsPrefix', 'type': 'str'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'first_consecutive_static_ip': {'key': 'firstConsecutiveStaticIP', 'type': 'str'}, - 'storage_profile': {'key': 'storageProfile', 'type': 'str'}, - 'fqdn': {'key': 'fqdn', 'type': 'str'}, + "count": {"key": "count", "type": "int"}, + "dns_prefix": {"key": "dnsPrefix", "type": "str"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "first_consecutive_static_ip": {"key": "firstConsecutiveStaticIP", "type": "str"}, + "storage_profile": {"key": "storageProfile", "type": "str"}, + "fqdn": {"key": "fqdn", "type": "str"}, } def __init__( @@ -1275,20 +1261,20 @@ def __init__( *, dns_prefix: str, vm_size: Union[str, "_models.ContainerServiceVMSizeTypes"], - count: Optional[Union[int, "_models.Count"]] = 1, + count: Union[int, "_models.Count"] = 1, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, - first_consecutive_static_ip: Optional[str] = "10.240.255.5", + first_consecutive_static_ip: str = "10.240.255.5", storage_profile: Optional[Union[str, "_models.ContainerServiceStorageProfileTypes"]] = None, **kwargs ): """ :keyword count: Number of masters (VMs) in the container service cluster. Allowed values are 1, - 3, and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". + 3, and 5. The default value is 1. Known values are: 1, 3, and 5. :paramtype count: int or ~azure.mgmt.containerservice.v2021_02_01.models.Count - :keyword dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. + :keyword dns_prefix: DNS prefix to be used to create the FQDN for the master pool. Required. :paramtype dns_prefix: str - :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + :keyword vm_size: Size of agent VMs. Required. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -1325,7 +1311,7 @@ def __init__( "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :paramtype vm_size: str or ~azure.mgmt.containerservice.v2021_02_01.models.ContainerServiceVMSizeTypes :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every @@ -1339,11 +1325,11 @@ def __init__( :paramtype first_consecutive_static_ip: str :keyword storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount" and "ManagedDisks". :paramtype storage_profile: str or ~azure.mgmt.containerservice.v2021_02_01.models.ContainerServiceStorageProfileTypes """ - super(ContainerServiceMasterProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.dns_prefix = dns_prefix self.vm_size = vm_size @@ -1354,17 +1340,17 @@ def __init__( self.fqdn = None -class ContainerServiceNetworkProfile(msrest.serialization.Model): +class ContainerServiceNetworkProfile(_serialization.Model): """Profile of network configuration. :ivar network_plugin: Network plugin used for building Kubernetes network. Known values are: - "azure", "kubenet". Default value: "kubenet". + "azure" and "kubenet". :vartype network_plugin: str or ~azure.mgmt.containerservice.v2021_02_01.models.NetworkPlugin :ivar network_policy: Network policy used for building Kubernetes network. Known values are: - "calico", "azure". + "calico" and "azure". :vartype network_policy: str or ~azure.mgmt.containerservice.v2021_02_01.models.NetworkPolicy :ivar network_mode: Network mode used for building Kubernetes network. Known values are: - "transparent", "bridge". + "transparent" and "bridge". :vartype network_mode: str or ~azure.mgmt.containerservice.v2021_02_01.models.NetworkMode :ivar pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :vartype pod_cidr: str @@ -1377,11 +1363,11 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): :ivar docker_bridge_cidr: A CIDR notation IP range assigned to the Docker bridge network. It must not overlap with any Subnet IP ranges or the Kubernetes service address range. :vartype docker_bridge_cidr: str - :ivar outbound_type: The outbound (egress) routing method. Known values are: "loadBalancer", - "userDefinedRouting". Default value: "loadBalancer". + :ivar outbound_type: The outbound (egress) routing method. Known values are: "loadBalancer" and + "userDefinedRouting". :vartype outbound_type: str or ~azure.mgmt.containerservice.v2021_02_01.models.OutboundType :ivar load_balancer_sku: The load balancer sku for the managed cluster. Known values are: - "standard", "basic". + "standard" and "basic". :vartype load_balancer_sku: str or ~azure.mgmt.containerservice.v2021_02_01.models.LoadBalancerSku :ivar load_balancer_profile: Profile of the cluster load balancer. @@ -1390,49 +1376,51 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): """ _validation = { - 'pod_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, - 'service_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, - 'dns_service_ip': {'pattern': r'^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$'}, - 'docker_bridge_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, + "pod_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, + "service_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, + "dns_service_ip": { + "pattern": r"^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$" + }, + "docker_bridge_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, } _attribute_map = { - 'network_plugin': {'key': 'networkPlugin', 'type': 'str'}, - 'network_policy': {'key': 'networkPolicy', 'type': 'str'}, - 'network_mode': {'key': 'networkMode', 'type': 'str'}, - 'pod_cidr': {'key': 'podCidr', 'type': 'str'}, - 'service_cidr': {'key': 'serviceCidr', 'type': 'str'}, - 'dns_service_ip': {'key': 'dnsServiceIP', 'type': 'str'}, - 'docker_bridge_cidr': {'key': 'dockerBridgeCidr', 'type': 'str'}, - 'outbound_type': {'key': 'outboundType', 'type': 'str'}, - 'load_balancer_sku': {'key': 'loadBalancerSku', 'type': 'str'}, - 'load_balancer_profile': {'key': 'loadBalancerProfile', 'type': 'ManagedClusterLoadBalancerProfile'}, + "network_plugin": {"key": "networkPlugin", "type": "str"}, + "network_policy": {"key": "networkPolicy", "type": "str"}, + "network_mode": {"key": "networkMode", "type": "str"}, + "pod_cidr": {"key": "podCidr", "type": "str"}, + "service_cidr": {"key": "serviceCidr", "type": "str"}, + "dns_service_ip": {"key": "dnsServiceIP", "type": "str"}, + "docker_bridge_cidr": {"key": "dockerBridgeCidr", "type": "str"}, + "outbound_type": {"key": "outboundType", "type": "str"}, + "load_balancer_sku": {"key": "loadBalancerSku", "type": "str"}, + "load_balancer_profile": {"key": "loadBalancerProfile", "type": "ManagedClusterLoadBalancerProfile"}, } def __init__( self, *, - network_plugin: Optional[Union[str, "_models.NetworkPlugin"]] = "kubenet", + network_plugin: Union[str, "_models.NetworkPlugin"] = "kubenet", network_policy: Optional[Union[str, "_models.NetworkPolicy"]] = None, network_mode: Optional[Union[str, "_models.NetworkMode"]] = None, - pod_cidr: Optional[str] = "10.244.0.0/16", - service_cidr: Optional[str] = "10.0.0.0/16", - dns_service_ip: Optional[str] = "10.0.0.10", - docker_bridge_cidr: Optional[str] = "172.17.0.1/16", - outbound_type: Optional[Union[str, "_models.OutboundType"]] = "loadBalancer", + pod_cidr: str = "10.244.0.0/16", + service_cidr: str = "10.0.0.0/16", + dns_service_ip: str = "10.0.0.10", + docker_bridge_cidr: str = "172.17.0.1/16", + outbound_type: Union[str, "_models.OutboundType"] = "loadBalancer", load_balancer_sku: Optional[Union[str, "_models.LoadBalancerSku"]] = None, load_balancer_profile: Optional["_models.ManagedClusterLoadBalancerProfile"] = None, **kwargs ): """ :keyword network_plugin: Network plugin used for building Kubernetes network. Known values are: - "azure", "kubenet". Default value: "kubenet". + "azure" and "kubenet". :paramtype network_plugin: str or ~azure.mgmt.containerservice.v2021_02_01.models.NetworkPlugin :keyword network_policy: Network policy used for building Kubernetes network. Known values are: - "calico", "azure". + "calico" and "azure". :paramtype network_policy: str or ~azure.mgmt.containerservice.v2021_02_01.models.NetworkPolicy :keyword network_mode: Network mode used for building Kubernetes network. Known values are: - "transparent", "bridge". + "transparent" and "bridge". :paramtype network_mode: str or ~azure.mgmt.containerservice.v2021_02_01.models.NetworkMode :keyword pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :paramtype pod_cidr: str @@ -1445,18 +1433,18 @@ def __init__( :keyword docker_bridge_cidr: A CIDR notation IP range assigned to the Docker bridge network. It must not overlap with any Subnet IP ranges or the Kubernetes service address range. :paramtype docker_bridge_cidr: str - :keyword outbound_type: The outbound (egress) routing method. Known values are: "loadBalancer", - "userDefinedRouting". Default value: "loadBalancer". + :keyword outbound_type: The outbound (egress) routing method. Known values are: "loadBalancer" + and "userDefinedRouting". :paramtype outbound_type: str or ~azure.mgmt.containerservice.v2021_02_01.models.OutboundType :keyword load_balancer_sku: The load balancer sku for the managed cluster. Known values are: - "standard", "basic". + "standard" and "basic". :paramtype load_balancer_sku: str or ~azure.mgmt.containerservice.v2021_02_01.models.LoadBalancerSku :keyword load_balancer_profile: Profile of the cluster load balancer. :paramtype load_balancer_profile: ~azure.mgmt.containerservice.v2021_02_01.models.ManagedClusterLoadBalancerProfile """ - super(ContainerServiceNetworkProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.network_plugin = network_plugin self.network_policy = network_policy self.network_mode = network_mode @@ -1469,113 +1457,98 @@ def __init__( self.load_balancer_profile = load_balancer_profile -class ContainerServiceSshConfiguration(msrest.serialization.Model): +class ContainerServiceSshConfiguration(_serialization.Model): """SSH configuration for Linux-based VMs running on Azure. All required parameters must be populated in order to send to Azure. - :ivar public_keys: Required. The list of SSH public keys used to authenticate with Linux-based - VMs. Only expect one key specified. + :ivar public_keys: The list of SSH public keys used to authenticate with Linux-based VMs. Only + expect one key specified. Required. :vartype public_keys: list[~azure.mgmt.containerservice.v2021_02_01.models.ContainerServiceSshPublicKey] """ _validation = { - 'public_keys': {'required': True}, + "public_keys": {"required": True}, } _attribute_map = { - 'public_keys': {'key': 'publicKeys', 'type': '[ContainerServiceSshPublicKey]'}, + "public_keys": {"key": "publicKeys", "type": "[ContainerServiceSshPublicKey]"}, } - def __init__( - self, - *, - public_keys: List["_models.ContainerServiceSshPublicKey"], - **kwargs - ): + def __init__(self, *, public_keys: List["_models.ContainerServiceSshPublicKey"], **kwargs): """ - :keyword public_keys: Required. The list of SSH public keys used to authenticate with - Linux-based VMs. Only expect one key specified. + :keyword public_keys: The list of SSH public keys used to authenticate with Linux-based VMs. + Only expect one key specified. Required. :paramtype public_keys: list[~azure.mgmt.containerservice.v2021_02_01.models.ContainerServiceSshPublicKey] """ - super(ContainerServiceSshConfiguration, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_keys = public_keys -class ContainerServiceSshPublicKey(msrest.serialization.Model): +class ContainerServiceSshPublicKey(_serialization.Model): """Contains information about SSH certificate public key data. All required parameters must be populated in order to send to Azure. - :ivar key_data: Required. Certificate public key used to authenticate with VMs through SSH. The - certificate must be in PEM format with or without headers. + :ivar key_data: Certificate public key used to authenticate with VMs through SSH. The + certificate must be in PEM format with or without headers. Required. :vartype key_data: str """ _validation = { - 'key_data': {'required': True}, + "key_data": {"required": True}, } _attribute_map = { - 'key_data': {'key': 'keyData', 'type': 'str'}, + "key_data": {"key": "keyData", "type": "str"}, } - def __init__( - self, - *, - key_data: str, - **kwargs - ): + def __init__(self, *, key_data: str, **kwargs): """ - :keyword key_data: Required. Certificate public key used to authenticate with VMs through SSH. - The certificate must be in PEM format with or without headers. + :keyword key_data: Certificate public key used to authenticate with VMs through SSH. The + certificate must be in PEM format with or without headers. Required. :paramtype key_data: str """ - super(ContainerServiceSshPublicKey, self).__init__(**kwargs) + super().__init__(**kwargs) self.key_data = key_data -class ContainerServiceVMDiagnostics(msrest.serialization.Model): +class ContainerServiceVMDiagnostics(_serialization.Model): """Profile for diagnostics on the container service VMs. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar enabled: Required. Whether the VM diagnostic agent is provisioned on the VM. + :ivar enabled: Whether the VM diagnostic agent is provisioned on the VM. Required. :vartype enabled: bool :ivar storage_uri: The URI of the storage account where diagnostics are stored. :vartype storage_uri: str """ _validation = { - 'enabled': {'required': True}, - 'storage_uri': {'readonly': True}, + "enabled": {"required": True}, + "storage_uri": {"readonly": True}, } _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'storage_uri': {'key': 'storageUri', 'type': 'str'}, + "enabled": {"key": "enabled", "type": "bool"}, + "storage_uri": {"key": "storageUri", "type": "str"}, } - def __init__( - self, - *, - enabled: bool, - **kwargs - ): + def __init__(self, *, enabled: bool, **kwargs): """ - :keyword enabled: Required. Whether the VM diagnostic agent is provisioned on the VM. + :keyword enabled: Whether the VM diagnostic agent is provisioned on the VM. Required. :paramtype enabled: bool """ - super(ContainerServiceVMDiagnostics, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.storage_uri = None -class CredentialResult(msrest.serialization.Model): +class CredentialResult(_serialization.Model): """The credential result response. Variables are only populated by the server, and will be ignored when sending a request. @@ -1583,31 +1556,27 @@ class CredentialResult(msrest.serialization.Model): :ivar name: The name of the credential. :vartype name: str :ivar value: Base64-encoded Kubernetes configuration file. - :vartype value: bytearray + :vartype value: bytes """ _validation = { - 'name': {'readonly': True}, - 'value': {'readonly': True}, + "name": {"readonly": True}, + "value": {"readonly": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'bytearray'}, + "name": {"key": "name", "type": "str"}, + "value": {"key": "value", "type": "bytearray"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(CredentialResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.name = None self.value = None -class CredentialResults(msrest.serialization.Model): +class CredentialResults(_serialization.Model): """The list of credential result response. Variables are only populated by the server, and will be ignored when sending a request. @@ -1617,24 +1586,20 @@ class CredentialResults(msrest.serialization.Model): """ _validation = { - 'kubeconfigs': {'readonly': True}, + "kubeconfigs": {"readonly": True}, } _attribute_map = { - 'kubeconfigs': {'key': 'kubeconfigs', 'type': '[CredentialResult]'}, + "kubeconfigs": {"key": "kubeconfigs", "type": "[CredentialResult]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(CredentialResults, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.kubeconfigs = None -class KubeletConfig(msrest.serialization.Model): +class KubeletConfig(_serialization.Model): # pylint: disable=too-many-instance-attributes """Kubelet configurations of agent nodes. :ivar cpu_manager_policy: CPU Manager policy to use. @@ -1668,21 +1633,21 @@ class KubeletConfig(msrest.serialization.Model): """ _validation = { - 'container_log_max_files': {'minimum': 2}, + "container_log_max_files": {"minimum": 2}, } _attribute_map = { - 'cpu_manager_policy': {'key': 'cpuManagerPolicy', 'type': 'str'}, - 'cpu_cfs_quota': {'key': 'cpuCfsQuota', 'type': 'bool'}, - 'cpu_cfs_quota_period': {'key': 'cpuCfsQuotaPeriod', 'type': 'str'}, - 'image_gc_high_threshold': {'key': 'imageGcHighThreshold', 'type': 'int'}, - 'image_gc_low_threshold': {'key': 'imageGcLowThreshold', 'type': 'int'}, - 'topology_manager_policy': {'key': 'topologyManagerPolicy', 'type': 'str'}, - 'allowed_unsafe_sysctls': {'key': 'allowedUnsafeSysctls', 'type': '[str]'}, - 'fail_swap_on': {'key': 'failSwapOn', 'type': 'bool'}, - 'container_log_max_size_mb': {'key': 'containerLogMaxSizeMB', 'type': 'int'}, - 'container_log_max_files': {'key': 'containerLogMaxFiles', 'type': 'int'}, - 'pod_max_pids': {'key': 'podMaxPids', 'type': 'int'}, + "cpu_manager_policy": {"key": "cpuManagerPolicy", "type": "str"}, + "cpu_cfs_quota": {"key": "cpuCfsQuota", "type": "bool"}, + "cpu_cfs_quota_period": {"key": "cpuCfsQuotaPeriod", "type": "str"}, + "image_gc_high_threshold": {"key": "imageGcHighThreshold", "type": "int"}, + "image_gc_low_threshold": {"key": "imageGcLowThreshold", "type": "int"}, + "topology_manager_policy": {"key": "topologyManagerPolicy", "type": "str"}, + "allowed_unsafe_sysctls": {"key": "allowedUnsafeSysctls", "type": "[str]"}, + "fail_swap_on": {"key": "failSwapOn", "type": "bool"}, + "container_log_max_size_mb": {"key": "containerLogMaxSizeMB", "type": "int"}, + "container_log_max_files": {"key": "containerLogMaxFiles", "type": "int"}, + "pod_max_pids": {"key": "podMaxPids", "type": "int"}, } def __init__( @@ -1732,7 +1697,7 @@ def __init__( :keyword pod_max_pids: The maximum number of processes per pod. :paramtype pod_max_pids: int """ - super(KubeletConfig, self).__init__(**kwargs) + super().__init__(**kwargs) self.cpu_manager_policy = cpu_manager_policy self.cpu_cfs_quota = cpu_cfs_quota self.cpu_cfs_quota_period = cpu_cfs_quota_period @@ -1746,7 +1711,7 @@ def __init__( self.pod_max_pids = pod_max_pids -class LinuxOSConfig(msrest.serialization.Model): +class LinuxOSConfig(_serialization.Model): """OS configurations of Linux agent nodes. :ivar sysctls: Sysctl settings for Linux agent nodes. @@ -1761,10 +1726,10 @@ class LinuxOSConfig(msrest.serialization.Model): """ _attribute_map = { - 'sysctls': {'key': 'sysctls', 'type': 'SysctlConfig'}, - 'transparent_huge_page_enabled': {'key': 'transparentHugePageEnabled', 'type': 'str'}, - 'transparent_huge_page_defrag': {'key': 'transparentHugePageDefrag', 'type': 'str'}, - 'swap_file_size_mb': {'key': 'swapFileSizeMB', 'type': 'int'}, + "sysctls": {"key": "sysctls", "type": "SysctlConfig"}, + "transparent_huge_page_enabled": {"key": "transparentHugePageEnabled", "type": "str"}, + "transparent_huge_page_defrag": {"key": "transparentHugePageDefrag", "type": "str"}, + "swap_file_size_mb": {"key": "swapFileSizeMB", "type": "int"}, } def __init__( @@ -1787,7 +1752,7 @@ def __init__( on each node. :paramtype swap_file_size_mb: int """ - super(LinuxOSConfig, self).__init__(**kwargs) + super().__init__(**kwargs) self.sysctls = sysctls self.transparent_huge_page_enabled = transparent_huge_page_enabled self.transparent_huge_page_defrag = transparent_huge_page_defrag @@ -1815,19 +1780,19 @@ class MaintenanceConfiguration(SubResource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, + "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'}, - 'time_in_week': {'key': 'properties.timeInWeek', 'type': '[TimeInWeek]'}, - 'not_allowed_time': {'key': 'properties.notAllowedTime', 'type': '[TimeSpan]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "time_in_week": {"key": "properties.timeInWeek", "type": "[TimeInWeek]"}, + "not_allowed_time": {"key": "properties.notAllowedTime", "type": "[TimeSpan]"}, } def __init__( @@ -1843,13 +1808,13 @@ def __init__( :keyword not_allowed_time: Time slots on which upgrade is not allowed. :paramtype not_allowed_time: list[~azure.mgmt.containerservice.v2021_02_01.models.TimeSpan] """ - super(MaintenanceConfiguration, self).__init__(**kwargs) + super().__init__(**kwargs) self.system_data = None self.time_in_week = time_in_week self.not_allowed_time = not_allowed_time -class MaintenanceConfigurationListResult(msrest.serialization.Model): +class MaintenanceConfigurationListResult(_serialization.Model): """The response from the List maintenance configurations operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -1861,31 +1826,26 @@ class MaintenanceConfigurationListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[MaintenanceConfiguration]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[MaintenanceConfiguration]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.MaintenanceConfiguration"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.MaintenanceConfiguration"]] = None, **kwargs): """ :keyword value: The list of maintenance configurations. :paramtype value: list[~azure.mgmt.containerservice.v2021_02_01.models.MaintenanceConfiguration] """ - super(MaintenanceConfigurationListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class Resource(msrest.serialization.Model): +class Resource(_serialization.Model): """The Resource model definition. Variables are only populated by the server, and will be ignored when sending a request. @@ -1898,41 +1858,35 @@ class Resource(msrest.serialization.Model): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] """ - super(Resource, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -1940,7 +1894,9 @@ def __init__( self.tags = tags -class ManagedCluster(Resource, Components1Q1Og48SchemasManagedclusterAllof1): +class ManagedCluster( + Resource, Components1Q1Og48SchemasManagedclusterAllof1 +): # pylint: disable=too-many-instance-attributes """Managed cluster. Variables are only populated by the server, and will be ignored when sending a request. @@ -2022,63 +1978,75 @@ class ManagedCluster(Resource, Components1Q1Og48SchemasManagedclusterAllof1): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar sku: The managed cluster SKU. :vartype sku: ~azure.mgmt.containerservice.v2021_02_01.models.ManagedClusterSKU """ _validation = { - 'provisioning_state': {'readonly': True}, - 'power_state': {'readonly': True}, - 'max_agent_pools': {'readonly': True}, - 'fqdn': {'readonly': True}, - 'private_fqdn': {'readonly': True}, - 'azure_portal_fqdn': {'readonly': True}, - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, + "provisioning_state": {"readonly": True}, + "power_state": {"readonly": True}, + "max_agent_pools": {"readonly": True}, + "fqdn": {"readonly": True}, + "private_fqdn": {"readonly": True}, + "azure_portal_fqdn": {"readonly": True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { - 'identity': {'key': 'identity', 'type': 'ManagedClusterIdentity'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'power_state': {'key': 'properties.powerState', 'type': 'PowerState'}, - 'max_agent_pools': {'key': 'properties.maxAgentPools', 'type': 'int'}, - 'kubernetes_version': {'key': 'properties.kubernetesVersion', 'type': 'str'}, - 'dns_prefix': {'key': 'properties.dnsPrefix', 'type': 'str'}, - 'fqdn_subdomain': {'key': 'properties.fqdnSubdomain', 'type': 'str'}, - 'fqdn': {'key': 'properties.fqdn', 'type': 'str'}, - 'private_fqdn': {'key': 'properties.privateFQDN', 'type': 'str'}, - 'azure_portal_fqdn': {'key': 'properties.azurePortalFQDN', 'type': 'str'}, - 'agent_pool_profiles': {'key': 'properties.agentPoolProfiles', 'type': '[ManagedClusterAgentPoolProfile]'}, - 'linux_profile': {'key': 'properties.linuxProfile', 'type': 'ContainerServiceLinuxProfile'}, - 'windows_profile': {'key': 'properties.windowsProfile', 'type': 'ManagedClusterWindowsProfile'}, - 'service_principal_profile': {'key': 'properties.servicePrincipalProfile', 'type': 'ManagedClusterServicePrincipalProfile'}, - 'addon_profiles': {'key': 'properties.addonProfiles', 'type': '{ManagedClusterAddonProfile}'}, - 'pod_identity_profile': {'key': 'properties.podIdentityProfile', 'type': 'ManagedClusterPodIdentityProfile'}, - 'node_resource_group': {'key': 'properties.nodeResourceGroup', 'type': 'str'}, - 'enable_rbac': {'key': 'properties.enableRBAC', 'type': 'bool'}, - 'enable_pod_security_policy': {'key': 'properties.enablePodSecurityPolicy', 'type': 'bool'}, - 'network_profile': {'key': 'properties.networkProfile', 'type': 'ContainerServiceNetworkProfile'}, - 'aad_profile': {'key': 'properties.aadProfile', 'type': 'ManagedClusterAADProfile'}, - 'auto_upgrade_profile': {'key': 'properties.autoUpgradeProfile', 'type': 'ManagedClusterAutoUpgradeProfile'}, - 'auto_scaler_profile': {'key': 'properties.autoScalerProfile', 'type': 'ManagedClusterPropertiesAutoScalerProfile'}, - 'api_server_access_profile': {'key': 'properties.apiServerAccessProfile', 'type': 'ManagedClusterAPIServerAccessProfile'}, - 'disk_encryption_set_id': {'key': 'properties.diskEncryptionSetID', 'type': 'str'}, - 'identity_profile': {'key': 'properties.identityProfile', 'type': '{ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties}'}, - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'ManagedClusterSKU'}, + "identity": {"key": "identity", "type": "ManagedClusterIdentity"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "power_state": {"key": "properties.powerState", "type": "PowerState"}, + "max_agent_pools": {"key": "properties.maxAgentPools", "type": "int"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "dns_prefix": {"key": "properties.dnsPrefix", "type": "str"}, + "fqdn_subdomain": {"key": "properties.fqdnSubdomain", "type": "str"}, + "fqdn": {"key": "properties.fqdn", "type": "str"}, + "private_fqdn": {"key": "properties.privateFQDN", "type": "str"}, + "azure_portal_fqdn": {"key": "properties.azurePortalFQDN", "type": "str"}, + "agent_pool_profiles": {"key": "properties.agentPoolProfiles", "type": "[ManagedClusterAgentPoolProfile]"}, + "linux_profile": {"key": "properties.linuxProfile", "type": "ContainerServiceLinuxProfile"}, + "windows_profile": {"key": "properties.windowsProfile", "type": "ManagedClusterWindowsProfile"}, + "service_principal_profile": { + "key": "properties.servicePrincipalProfile", + "type": "ManagedClusterServicePrincipalProfile", + }, + "addon_profiles": {"key": "properties.addonProfiles", "type": "{ManagedClusterAddonProfile}"}, + "pod_identity_profile": {"key": "properties.podIdentityProfile", "type": "ManagedClusterPodIdentityProfile"}, + "node_resource_group": {"key": "properties.nodeResourceGroup", "type": "str"}, + "enable_rbac": {"key": "properties.enableRBAC", "type": "bool"}, + "enable_pod_security_policy": {"key": "properties.enablePodSecurityPolicy", "type": "bool"}, + "network_profile": {"key": "properties.networkProfile", "type": "ContainerServiceNetworkProfile"}, + "aad_profile": {"key": "properties.aadProfile", "type": "ManagedClusterAADProfile"}, + "auto_upgrade_profile": {"key": "properties.autoUpgradeProfile", "type": "ManagedClusterAutoUpgradeProfile"}, + "auto_scaler_profile": { + "key": "properties.autoScalerProfile", + "type": "ManagedClusterPropertiesAutoScalerProfile", + }, + "api_server_access_profile": { + "key": "properties.apiServerAccessProfile", + "type": "ManagedClusterAPIServerAccessProfile", + }, + "disk_encryption_set_id": {"key": "properties.diskEncryptionSetID", "type": "str"}, + "identity_profile": { + "key": "properties.identityProfile", + "type": "{ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties}", + }, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "sku": {"key": "sku", "type": "ManagedClusterSKU"}, } - def __init__( + def __init__( # pylint: disable=too-many-locals self, *, location: str, @@ -2101,7 +2069,12 @@ def __init__( auto_scaler_profile: Optional["_models.ManagedClusterPropertiesAutoScalerProfile"] = None, api_server_access_profile: Optional["_models.ManagedClusterAPIServerAccessProfile"] = None, disk_encryption_set_id: Optional[str] = None, - identity_profile: Optional[Dict[str, "_models.ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties"]] = None, + identity_profile: Optional[ + Dict[ + str, + "_models.ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties", + ] + ] = None, tags: Optional[Dict[str, str]] = None, sku: Optional["_models.ManagedClusterSKU"] = None, **kwargs @@ -2164,14 +2137,38 @@ def __init__( :keyword identity_profile: Identities associated with the cluster. :paramtype identity_profile: dict[str, ~azure.mgmt.containerservice.v2021_02_01.models.ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties] - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword sku: The managed cluster SKU. :paramtype sku: ~azure.mgmt.containerservice.v2021_02_01.models.ManagedClusterSKU """ - super(ManagedCluster, self).__init__(location=location, tags=tags, identity=identity, kubernetes_version=kubernetes_version, dns_prefix=dns_prefix, fqdn_subdomain=fqdn_subdomain, agent_pool_profiles=agent_pool_profiles, linux_profile=linux_profile, windows_profile=windows_profile, service_principal_profile=service_principal_profile, addon_profiles=addon_profiles, pod_identity_profile=pod_identity_profile, node_resource_group=node_resource_group, enable_rbac=enable_rbac, enable_pod_security_policy=enable_pod_security_policy, network_profile=network_profile, aad_profile=aad_profile, auto_upgrade_profile=auto_upgrade_profile, auto_scaler_profile=auto_scaler_profile, api_server_access_profile=api_server_access_profile, disk_encryption_set_id=disk_encryption_set_id, identity_profile=identity_profile, **kwargs) + super().__init__( + location=location, + tags=tags, + identity=identity, + kubernetes_version=kubernetes_version, + dns_prefix=dns_prefix, + fqdn_subdomain=fqdn_subdomain, + agent_pool_profiles=agent_pool_profiles, + linux_profile=linux_profile, + windows_profile=windows_profile, + service_principal_profile=service_principal_profile, + addon_profiles=addon_profiles, + pod_identity_profile=pod_identity_profile, + node_resource_group=node_resource_group, + enable_rbac=enable_rbac, + enable_pod_security_policy=enable_pod_security_policy, + network_profile=network_profile, + aad_profile=aad_profile, + auto_upgrade_profile=auto_upgrade_profile, + auto_scaler_profile=auto_scaler_profile, + api_server_access_profile=api_server_access_profile, + disk_encryption_set_id=disk_encryption_set_id, + identity_profile=identity_profile, + **kwargs + ) self.identity = identity self.provisioning_state = None self.power_state = None @@ -2206,7 +2203,7 @@ def __init__( self.tags = tags -class ManagedClusterAADProfile(msrest.serialization.Model): +class ManagedClusterAADProfile(_serialization.Model): """AADProfile specifies attributes for Azure Active Directory integration. :ivar managed: Whether to enable managed AAD. @@ -2227,13 +2224,13 @@ class ManagedClusterAADProfile(msrest.serialization.Model): """ _attribute_map = { - 'managed': {'key': 'managed', 'type': 'bool'}, - 'enable_azure_rbac': {'key': 'enableAzureRBAC', 'type': 'bool'}, - 'admin_group_object_i_ds': {'key': 'adminGroupObjectIDs', 'type': '[str]'}, - 'client_app_id': {'key': 'clientAppID', 'type': 'str'}, - 'server_app_id': {'key': 'serverAppID', 'type': 'str'}, - 'server_app_secret': {'key': 'serverAppSecret', 'type': 'str'}, - 'tenant_id': {'key': 'tenantID', 'type': 'str'}, + "managed": {"key": "managed", "type": "bool"}, + "enable_azure_rbac": {"key": "enableAzureRBAC", "type": "bool"}, + "admin_group_object_i_ds": {"key": "adminGroupObjectIDs", "type": "[str]"}, + "client_app_id": {"key": "clientAppID", "type": "str"}, + "server_app_id": {"key": "serverAppID", "type": "str"}, + "server_app_secret": {"key": "serverAppSecret", "type": "str"}, + "tenant_id": {"key": "tenantID", "type": "str"}, } def __init__( @@ -2266,7 +2263,7 @@ def __init__( tenant of the deployment subscription. :paramtype tenant_id: str """ - super(ManagedClusterAADProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.managed = managed self.enable_azure_rbac = enable_azure_rbac self.admin_group_object_i_ds = admin_group_object_i_ds @@ -2289,58 +2286,53 @@ class ManagedClusterAccessProfile(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar kube_config: Base64-encoded Kubernetes configuration file. - :vartype kube_config: bytearray + :vartype kube_config: bytes """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'kube_config': {'key': 'properties.kubeConfig', 'type': 'bytearray'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "kube_config": {"key": "properties.kubeConfig", "type": "bytearray"}, } def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - kube_config: Optional[bytearray] = None, - **kwargs + self, *, location: str, tags: Optional[Dict[str, str]] = None, kube_config: Optional[bytes] = None, **kwargs ): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword kube_config: Base64-encoded Kubernetes configuration file. - :paramtype kube_config: bytearray + :paramtype kube_config: bytes """ - super(ManagedClusterAccessProfile, self).__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.kube_config = kube_config -class ManagedClusterAddonProfile(msrest.serialization.Model): +class ManagedClusterAddonProfile(_serialization.Model): """A Kubernetes add-on profile for a managed cluster. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar enabled: Required. Whether the add-on is enabled or not. + :ivar enabled: Whether the add-on is enabled or not. Required. :vartype enabled: bool :ivar config: Key-value pairs for configuring an add-on. :vartype config: dict[str, str] @@ -2350,30 +2342,24 @@ class ManagedClusterAddonProfile(msrest.serialization.Model): """ _validation = { - 'enabled': {'required': True}, - 'identity': {'readonly': True}, + "enabled": {"required": True}, + "identity": {"readonly": True}, } _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'config': {'key': 'config', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'ManagedClusterAddonProfileIdentity'}, + "enabled": {"key": "enabled", "type": "bool"}, + "config": {"key": "config", "type": "{str}"}, + "identity": {"key": "identity", "type": "ManagedClusterAddonProfileIdentity"}, } - def __init__( - self, - *, - enabled: bool, - config: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, enabled: bool, config: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword enabled: Required. Whether the add-on is enabled or not. + :keyword enabled: Whether the add-on is enabled or not. Required. :paramtype enabled: bool :keyword config: Key-value pairs for configuring an add-on. :paramtype config: dict[str, str] """ - super(ManagedClusterAddonProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.config = config self.identity = None @@ -2391,9 +2377,9 @@ class ManagedClusterAddonProfileIdentity(UserAssignedIdentity): """ _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'object_id': {'key': 'objectId', 'type': 'str'}, + "resource_id": {"key": "resourceId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + "object_id": {"key": "objectId", "type": "str"}, } def __init__( @@ -2412,10 +2398,10 @@ def __init__( :keyword object_id: The object id of the user assigned identity. :paramtype object_id: str """ - super(ManagedClusterAddonProfileIdentity, self).__init__(resource_id=resource_id, client_id=client_id, object_id=object_id, **kwargs) + super().__init__(resource_id=resource_id, client_id=client_id, object_id=object_id, **kwargs) -class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): +class ManagedClusterAgentPoolProfileProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes """Properties for the container service agent pool profile. Variables are only populated by the server, and will be ignored when sending a request. @@ -2461,7 +2447,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :vartype vm_size: str or ~azure.mgmt.containerservice.v2021_02_01.models.ContainerServiceVMSizeTypes :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine @@ -2471,11 +2457,11 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar os_disk_type: OS disk type to be used for machines in a given agent pool. Allowed values are 'Ephemeral' and 'Managed'. If unspecified, defaults to 'Ephemeral' when the VM supports ephemeral OS and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults - to 'Managed'. May not be changed after creation. Known values are: "Managed", "Ephemeral". + to 'Managed'. May not be changed after creation. Known values are: "Managed" and "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2021_02_01.models.OSDiskType :ivar kubelet_disk_type: KubeletDiskType determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. Currently allows one value, OS, - resulting in Kubelet using the OS disk for data. Known values are: "OS", "Temporary". + resulting in Kubelet using the OS disk for data. Known values are: "OS" and "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2021_02_01.models.KubeletDiskType :ivar vnet_subnet_id: VNet SubnetID specifies the VNet's subnet identifier for nodes and maybe @@ -2486,7 +2472,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Known values are: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux" and "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2021_02_01.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -2495,9 +2481,10 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar type: AgentPoolType represents types of an agent pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2021_02_01.models.AgentPoolType - :ivar mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", "User". + :ivar mode: AgentPoolMode represents mode of an agent pool. Known values are: "System" and + "User". :vartype mode: str or ~azure.mgmt.containerservice.v2021_02_01.models.AgentPoolMode :ivar orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -2521,20 +2508,19 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): IP Prefix. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Known values are: "Spot", "Regular". Default value: "Regular". + priority. Default to regular. Known values are: "Spot" and "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2021_02_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy - for Spot virtual machine scale set. Default to Delete. Known values are: "Delete", - "Deallocate". Default value: "Delete". + for Spot virtual machine scale set. Default to Delete. Known values are: "Delete" and + "Deallocate". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2021_02_01.models.ScaleSetEvictionPolicy :ivar spot_max_price: SpotMaxPrice to be used to specify the maximum price you are willing to pay in US Dollars. Possible values are any decimal value greater than zero or -1 which indicates default price to be up-to on-demand. :vartype spot_max_price: float - :ivar tags: A set of tags. Agent pool tags to be persisted on the agent pool virtual machine - scale set. + :ivar tags: Agent pool tags to be persisted on the agent pool virtual machine scale set. :vartype tags: dict[str, str] :ivar node_labels: Agent pool node labels to be persisted across all nodes in agent pool. :vartype node_labels: dict[str, str] @@ -2552,48 +2538,48 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): """ _validation = { - 'os_disk_size_gb': {'maximum': 1023, 'minimum': 0}, - 'node_image_version': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'power_state': {'readonly': True}, + "os_disk_size_gb": {"maximum": 1023, "minimum": 0}, + "node_image_version": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "power_state": {"readonly": True}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'os_disk_type': {'key': 'osDiskType', 'type': 'str'}, - 'kubelet_disk_type': {'key': 'kubeletDiskType', 'type': 'str'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'pod_subnet_id': {'key': 'podSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'maxPods', 'type': 'int'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'max_count': {'key': 'maxCount', 'type': 'int'}, - 'min_count': {'key': 'minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'enableAutoScaling', 'type': 'bool'}, - 'type': {'key': 'type', 'type': 'str'}, - 'mode': {'key': 'mode', 'type': 'str'}, - 'orchestrator_version': {'key': 'orchestratorVersion', 'type': 'str'}, - 'node_image_version': {'key': 'nodeImageVersion', 'type': 'str'}, - 'upgrade_settings': {'key': 'upgradeSettings', 'type': 'AgentPoolUpgradeSettings'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'power_state': {'key': 'powerState', 'type': 'PowerState'}, - 'availability_zones': {'key': 'availabilityZones', 'type': '[str]'}, - 'enable_node_public_ip': {'key': 'enableNodePublicIP', 'type': 'bool'}, - 'node_public_ip_prefix_id': {'key': 'nodePublicIPPrefixID', 'type': 'str'}, - 'scale_set_priority': {'key': 'scaleSetPriority', 'type': 'str'}, - 'scale_set_eviction_policy': {'key': 'scaleSetEvictionPolicy', 'type': 'str'}, - 'spot_max_price': {'key': 'spotMaxPrice', 'type': 'float'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'node_labels': {'key': 'nodeLabels', 'type': '{str}'}, - 'node_taints': {'key': 'nodeTaints', 'type': '[str]'}, - 'proximity_placement_group_id': {'key': 'proximityPlacementGroupID', 'type': 'str'}, - 'kubelet_config': {'key': 'kubeletConfig', 'type': 'KubeletConfig'}, - 'linux_os_config': {'key': 'linuxOSConfig', 'type': 'LinuxOSConfig'}, - 'enable_encryption_at_host': {'key': 'enableEncryptionAtHost', 'type': 'bool'}, + "count": {"key": "count", "type": "int"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "os_disk_type": {"key": "osDiskType", "type": "str"}, + "kubelet_disk_type": {"key": "kubeletDiskType", "type": "str"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "pod_subnet_id": {"key": "podSubnetID", "type": "str"}, + "max_pods": {"key": "maxPods", "type": "int"}, + "os_type": {"key": "osType", "type": "str"}, + "max_count": {"key": "maxCount", "type": "int"}, + "min_count": {"key": "minCount", "type": "int"}, + "enable_auto_scaling": {"key": "enableAutoScaling", "type": "bool"}, + "type": {"key": "type", "type": "str"}, + "mode": {"key": "mode", "type": "str"}, + "orchestrator_version": {"key": "orchestratorVersion", "type": "str"}, + "node_image_version": {"key": "nodeImageVersion", "type": "str"}, + "upgrade_settings": {"key": "upgradeSettings", "type": "AgentPoolUpgradeSettings"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "power_state": {"key": "powerState", "type": "PowerState"}, + "availability_zones": {"key": "availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "enableNodePublicIP", "type": "bool"}, + "node_public_ip_prefix_id": {"key": "nodePublicIPPrefixID", "type": "str"}, + "scale_set_priority": {"key": "scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "scaleSetEvictionPolicy", "type": "str"}, + "spot_max_price": {"key": "spotMaxPrice", "type": "float"}, + "tags": {"key": "tags", "type": "{str}"}, + "node_labels": {"key": "nodeLabels", "type": "{str}"}, + "node_taints": {"key": "nodeTaints", "type": "[str]"}, + "proximity_placement_group_id": {"key": "proximityPlacementGroupID", "type": "str"}, + "kubelet_config": {"key": "kubeletConfig", "type": "KubeletConfig"}, + "linux_os_config": {"key": "linuxOSConfig", "type": "LinuxOSConfig"}, + "enable_encryption_at_host": {"key": "enableEncryptionAtHost", "type": "bool"}, } - def __init__( + def __init__( # pylint: disable=too-many-locals self, *, count: Optional[int] = None, @@ -2604,7 +2590,7 @@ def __init__( vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, @@ -2615,9 +2601,9 @@ def __init__( availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", - spot_max_price: Optional[float] = -1, + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", + spot_max_price: float = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, @@ -2669,7 +2655,7 @@ def __init__( "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :paramtype vm_size: str or ~azure.mgmt.containerservice.v2021_02_01.models.ContainerServiceVMSizeTypes :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every @@ -2679,12 +2665,12 @@ def __init__( :keyword os_disk_type: OS disk type to be used for machines in a given agent pool. Allowed values are 'Ephemeral' and 'Managed'. If unspecified, defaults to 'Ephemeral' when the VM supports ephemeral OS and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, - defaults to 'Managed'. May not be changed after creation. Known values are: "Managed", + defaults to 'Managed'. May not be changed after creation. Known values are: "Managed" and "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2021_02_01.models.OSDiskType :keyword kubelet_disk_type: KubeletDiskType determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. Currently allows one value, OS, - resulting in Kubelet using the OS disk for data. Known values are: "OS", "Temporary". + resulting in Kubelet using the OS disk for data. Known values are: "OS" and "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2021_02_01.models.KubeletDiskType :keyword vnet_subnet_id: VNet SubnetID specifies the VNet's subnet identifier for nodes and @@ -2695,7 +2681,7 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux" and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2021_02_01.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -2704,9 +2690,9 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword type: AgentPoolType represents types of an agent pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2021_02_01.models.AgentPoolType - :keyword mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", + :keyword mode: AgentPoolMode represents mode of an agent pool. Known values are: "System" and "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2021_02_01.models.AgentPoolMode :keyword orchestrator_version: Version of orchestrator specified when creating the managed @@ -2724,20 +2710,19 @@ def __init__( Public IP Prefix. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Known values are: "Spot", "Regular". Default value: "Regular". + priority. Default to regular. Known values are: "Spot" and "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2021_02_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction - policy for Spot virtual machine scale set. Default to Delete. Known values are: "Delete", - "Deallocate". Default value: "Delete". + policy for Spot virtual machine scale set. Default to Delete. Known values are: "Delete" and + "Deallocate". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2021_02_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: SpotMaxPrice to be used to specify the maximum price you are willing to pay in US Dollars. Possible values are any decimal value greater than zero or -1 which indicates default price to be up-to on-demand. :paramtype spot_max_price: float - :keyword tags: A set of tags. Agent pool tags to be persisted on the agent pool virtual machine - scale set. + :keyword tags: Agent pool tags to be persisted on the agent pool virtual machine scale set. :paramtype tags: dict[str, str] :keyword node_labels: Agent pool node labels to be persisted across all nodes in agent pool. :paramtype node_labels: dict[str, str] @@ -2753,7 +2738,7 @@ def __init__( :keyword enable_encryption_at_host: Whether to enable EncryptionAtHost. :paramtype enable_encryption_at_host: bool """ - super(ManagedClusterAgentPoolProfileProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.vm_size = vm_size self.os_disk_size_gb = os_disk_size_gb @@ -2788,7 +2773,9 @@ def __init__( self.enable_encryption_at_host = enable_encryption_at_host -class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): +class ManagedClusterAgentPoolProfile( + ManagedClusterAgentPoolProfileProperties +): # pylint: disable=too-many-instance-attributes """Profile for the container service agent pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -2836,7 +2823,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :vartype vm_size: str or ~azure.mgmt.containerservice.v2021_02_01.models.ContainerServiceVMSizeTypes :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine @@ -2846,11 +2833,11 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar os_disk_type: OS disk type to be used for machines in a given agent pool. Allowed values are 'Ephemeral' and 'Managed'. If unspecified, defaults to 'Ephemeral' when the VM supports ephemeral OS and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults - to 'Managed'. May not be changed after creation. Known values are: "Managed", "Ephemeral". + to 'Managed'. May not be changed after creation. Known values are: "Managed" and "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2021_02_01.models.OSDiskType :ivar kubelet_disk_type: KubeletDiskType determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. Currently allows one value, OS, - resulting in Kubelet using the OS disk for data. Known values are: "OS", "Temporary". + resulting in Kubelet using the OS disk for data. Known values are: "OS" and "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2021_02_01.models.KubeletDiskType :ivar vnet_subnet_id: VNet SubnetID specifies the VNet's subnet identifier for nodes and maybe @@ -2861,7 +2848,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Known values are: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux" and "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2021_02_01.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -2870,9 +2857,10 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar type: AgentPoolType represents types of an agent pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2021_02_01.models.AgentPoolType - :ivar mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", "User". + :ivar mode: AgentPoolMode represents mode of an agent pool. Known values are: "System" and + "User". :vartype mode: str or ~azure.mgmt.containerservice.v2021_02_01.models.AgentPoolMode :ivar orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -2896,20 +2884,19 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): IP Prefix. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Known values are: "Spot", "Regular". Default value: "Regular". + priority. Default to regular. Known values are: "Spot" and "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2021_02_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy - for Spot virtual machine scale set. Default to Delete. Known values are: "Delete", - "Deallocate". Default value: "Delete". + for Spot virtual machine scale set. Default to Delete. Known values are: "Delete" and + "Deallocate". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2021_02_01.models.ScaleSetEvictionPolicy :ivar spot_max_price: SpotMaxPrice to be used to specify the maximum price you are willing to pay in US Dollars. Possible values are any decimal value greater than zero or -1 which indicates default price to be up-to on-demand. :vartype spot_max_price: float - :ivar tags: A set of tags. Agent pool tags to be persisted on the agent pool virtual machine - scale set. + :ivar tags: Agent pool tags to be persisted on the agent pool virtual machine scale set. :vartype tags: dict[str, str] :ivar node_labels: Agent pool node labels to be persisted across all nodes in agent pool. :vartype node_labels: dict[str, str] @@ -2924,56 +2911,56 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :vartype linux_os_config: ~azure.mgmt.containerservice.v2021_02_01.models.LinuxOSConfig :ivar enable_encryption_at_host: Whether to enable EncryptionAtHost. :vartype enable_encryption_at_host: bool - :ivar name: Required. Unique name of the agent pool profile in the context of the subscription - and resource group. + :ivar name: Unique name of the agent pool profile in the context of the subscription and + resource group. Required. :vartype name: str """ _validation = { - 'os_disk_size_gb': {'maximum': 1023, 'minimum': 0}, - 'node_image_version': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'power_state': {'readonly': True}, - 'name': {'required': True, 'pattern': r'^[a-z][a-z0-9]{0,11}$'}, + "os_disk_size_gb": {"maximum": 1023, "minimum": 0}, + "node_image_version": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "power_state": {"readonly": True}, + "name": {"required": True, "pattern": r"^[a-z][a-z0-9]{0,11}$"}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'os_disk_type': {'key': 'osDiskType', 'type': 'str'}, - 'kubelet_disk_type': {'key': 'kubeletDiskType', 'type': 'str'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'pod_subnet_id': {'key': 'podSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'maxPods', 'type': 'int'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'max_count': {'key': 'maxCount', 'type': 'int'}, - 'min_count': {'key': 'minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'enableAutoScaling', 'type': 'bool'}, - 'type': {'key': 'type', 'type': 'str'}, - 'mode': {'key': 'mode', 'type': 'str'}, - 'orchestrator_version': {'key': 'orchestratorVersion', 'type': 'str'}, - 'node_image_version': {'key': 'nodeImageVersion', 'type': 'str'}, - 'upgrade_settings': {'key': 'upgradeSettings', 'type': 'AgentPoolUpgradeSettings'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'power_state': {'key': 'powerState', 'type': 'PowerState'}, - 'availability_zones': {'key': 'availabilityZones', 'type': '[str]'}, - 'enable_node_public_ip': {'key': 'enableNodePublicIP', 'type': 'bool'}, - 'node_public_ip_prefix_id': {'key': 'nodePublicIPPrefixID', 'type': 'str'}, - 'scale_set_priority': {'key': 'scaleSetPriority', 'type': 'str'}, - 'scale_set_eviction_policy': {'key': 'scaleSetEvictionPolicy', 'type': 'str'}, - 'spot_max_price': {'key': 'spotMaxPrice', 'type': 'float'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'node_labels': {'key': 'nodeLabels', 'type': '{str}'}, - 'node_taints': {'key': 'nodeTaints', 'type': '[str]'}, - 'proximity_placement_group_id': {'key': 'proximityPlacementGroupID', 'type': 'str'}, - 'kubelet_config': {'key': 'kubeletConfig', 'type': 'KubeletConfig'}, - 'linux_os_config': {'key': 'linuxOSConfig', 'type': 'LinuxOSConfig'}, - 'enable_encryption_at_host': {'key': 'enableEncryptionAtHost', 'type': 'bool'}, - 'name': {'key': 'name', 'type': 'str'}, + "count": {"key": "count", "type": "int"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "os_disk_type": {"key": "osDiskType", "type": "str"}, + "kubelet_disk_type": {"key": "kubeletDiskType", "type": "str"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "pod_subnet_id": {"key": "podSubnetID", "type": "str"}, + "max_pods": {"key": "maxPods", "type": "int"}, + "os_type": {"key": "osType", "type": "str"}, + "max_count": {"key": "maxCount", "type": "int"}, + "min_count": {"key": "minCount", "type": "int"}, + "enable_auto_scaling": {"key": "enableAutoScaling", "type": "bool"}, + "type": {"key": "type", "type": "str"}, + "mode": {"key": "mode", "type": "str"}, + "orchestrator_version": {"key": "orchestratorVersion", "type": "str"}, + "node_image_version": {"key": "nodeImageVersion", "type": "str"}, + "upgrade_settings": {"key": "upgradeSettings", "type": "AgentPoolUpgradeSettings"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "power_state": {"key": "powerState", "type": "PowerState"}, + "availability_zones": {"key": "availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "enableNodePublicIP", "type": "bool"}, + "node_public_ip_prefix_id": {"key": "nodePublicIPPrefixID", "type": "str"}, + "scale_set_priority": {"key": "scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "scaleSetEvictionPolicy", "type": "str"}, + "spot_max_price": {"key": "spotMaxPrice", "type": "float"}, + "tags": {"key": "tags", "type": "{str}"}, + "node_labels": {"key": "nodeLabels", "type": "{str}"}, + "node_taints": {"key": "nodeTaints", "type": "[str]"}, + "proximity_placement_group_id": {"key": "proximityPlacementGroupID", "type": "str"}, + "kubelet_config": {"key": "kubeletConfig", "type": "KubeletConfig"}, + "linux_os_config": {"key": "linuxOSConfig", "type": "LinuxOSConfig"}, + "enable_encryption_at_host": {"key": "enableEncryptionAtHost", "type": "bool"}, + "name": {"key": "name", "type": "str"}, } - def __init__( + def __init__( # pylint: disable=too-many-locals self, *, name: str, @@ -2985,7 +2972,7 @@ def __init__( vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, @@ -2996,9 +2983,9 @@ def __init__( availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", - spot_max_price: Optional[float] = -1, + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", + spot_max_price: float = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, @@ -3050,7 +3037,7 @@ def __init__( "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :paramtype vm_size: str or ~azure.mgmt.containerservice.v2021_02_01.models.ContainerServiceVMSizeTypes :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every @@ -3060,12 +3047,12 @@ def __init__( :keyword os_disk_type: OS disk type to be used for machines in a given agent pool. Allowed values are 'Ephemeral' and 'Managed'. If unspecified, defaults to 'Ephemeral' when the VM supports ephemeral OS and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, - defaults to 'Managed'. May not be changed after creation. Known values are: "Managed", + defaults to 'Managed'. May not be changed after creation. Known values are: "Managed" and "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2021_02_01.models.OSDiskType :keyword kubelet_disk_type: KubeletDiskType determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. Currently allows one value, OS, - resulting in Kubelet using the OS disk for data. Known values are: "OS", "Temporary". + resulting in Kubelet using the OS disk for data. Known values are: "OS" and "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2021_02_01.models.KubeletDiskType :keyword vnet_subnet_id: VNet SubnetID specifies the VNet's subnet identifier for nodes and @@ -3076,7 +3063,7 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux" and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2021_02_01.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -3085,9 +3072,9 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword type: AgentPoolType represents types of an agent pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2021_02_01.models.AgentPoolType - :keyword mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", + :keyword mode: AgentPoolMode represents mode of an agent pool. Known values are: "System" and "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2021_02_01.models.AgentPoolMode :keyword orchestrator_version: Version of orchestrator specified when creating the managed @@ -3105,20 +3092,19 @@ def __init__( Public IP Prefix. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Known values are: "Spot", "Regular". Default value: "Regular". + priority. Default to regular. Known values are: "Spot" and "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2021_02_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction - policy for Spot virtual machine scale set. Default to Delete. Known values are: "Delete", - "Deallocate". Default value: "Delete". + policy for Spot virtual machine scale set. Default to Delete. Known values are: "Delete" and + "Deallocate". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2021_02_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: SpotMaxPrice to be used to specify the maximum price you are willing to pay in US Dollars. Possible values are any decimal value greater than zero or -1 which indicates default price to be up-to on-demand. :paramtype spot_max_price: float - :keyword tags: A set of tags. Agent pool tags to be persisted on the agent pool virtual machine - scale set. + :keyword tags: Agent pool tags to be persisted on the agent pool virtual machine scale set. :paramtype tags: dict[str, str] :keyword node_labels: Agent pool node labels to be persisted across all nodes in agent pool. :paramtype node_labels: dict[str, str] @@ -3133,15 +3119,46 @@ def __init__( :paramtype linux_os_config: ~azure.mgmt.containerservice.v2021_02_01.models.LinuxOSConfig :keyword enable_encryption_at_host: Whether to enable EncryptionAtHost. :paramtype enable_encryption_at_host: bool - :keyword name: Required. Unique name of the agent pool profile in the context of the - subscription and resource group. + :keyword name: Unique name of the agent pool profile in the context of the subscription and + resource group. Required. :paramtype name: str """ - super(ManagedClusterAgentPoolProfile, self).__init__(count=count, vm_size=vm_size, os_disk_size_gb=os_disk_size_gb, os_disk_type=os_disk_type, kubelet_disk_type=kubelet_disk_type, vnet_subnet_id=vnet_subnet_id, pod_subnet_id=pod_subnet_id, max_pods=max_pods, os_type=os_type, max_count=max_count, min_count=min_count, enable_auto_scaling=enable_auto_scaling, type=type, mode=mode, orchestrator_version=orchestrator_version, upgrade_settings=upgrade_settings, availability_zones=availability_zones, enable_node_public_ip=enable_node_public_ip, node_public_ip_prefix_id=node_public_ip_prefix_id, scale_set_priority=scale_set_priority, scale_set_eviction_policy=scale_set_eviction_policy, spot_max_price=spot_max_price, tags=tags, node_labels=node_labels, node_taints=node_taints, proximity_placement_group_id=proximity_placement_group_id, kubelet_config=kubelet_config, linux_os_config=linux_os_config, enable_encryption_at_host=enable_encryption_at_host, **kwargs) + super().__init__( + count=count, + vm_size=vm_size, + os_disk_size_gb=os_disk_size_gb, + os_disk_type=os_disk_type, + kubelet_disk_type=kubelet_disk_type, + vnet_subnet_id=vnet_subnet_id, + pod_subnet_id=pod_subnet_id, + max_pods=max_pods, + os_type=os_type, + max_count=max_count, + min_count=min_count, + enable_auto_scaling=enable_auto_scaling, + type=type, + mode=mode, + orchestrator_version=orchestrator_version, + upgrade_settings=upgrade_settings, + availability_zones=availability_zones, + enable_node_public_ip=enable_node_public_ip, + node_public_ip_prefix_id=node_public_ip_prefix_id, + scale_set_priority=scale_set_priority, + scale_set_eviction_policy=scale_set_eviction_policy, + spot_max_price=spot_max_price, + tags=tags, + node_labels=node_labels, + node_taints=node_taints, + proximity_placement_group_id=proximity_placement_group_id, + kubelet_config=kubelet_config, + linux_os_config=linux_os_config, + enable_encryption_at_host=enable_encryption_at_host, + **kwargs + ) self.name = name -class ManagedClusterAPIServerAccessProfile(msrest.serialization.Model): +class ManagedClusterAPIServerAccessProfile(_serialization.Model): """Access profile for managed cluster API server. :ivar authorized_ip_ranges: Authorized IP Ranges to kubernetes API server. @@ -3153,9 +3170,9 @@ class ManagedClusterAPIServerAccessProfile(msrest.serialization.Model): """ _attribute_map = { - 'authorized_ip_ranges': {'key': 'authorizedIPRanges', 'type': '[str]'}, - 'enable_private_cluster': {'key': 'enablePrivateCluster', 'type': 'bool'}, - 'private_dns_zone': {'key': 'privateDNSZone', 'type': 'str'}, + "authorized_ip_ranges": {"key": "authorizedIPRanges", "type": "[str]"}, + "enable_private_cluster": {"key": "enablePrivateCluster", "type": "bool"}, + "private_dns_zone": {"key": "privateDNSZone", "type": "str"}, } def __init__( @@ -3174,41 +3191,36 @@ def __init__( :keyword private_dns_zone: Private dns zone mode for private cluster. :paramtype private_dns_zone: str """ - super(ManagedClusterAPIServerAccessProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.authorized_ip_ranges = authorized_ip_ranges self.enable_private_cluster = enable_private_cluster self.private_dns_zone = private_dns_zone -class ManagedClusterAutoUpgradeProfile(msrest.serialization.Model): +class ManagedClusterAutoUpgradeProfile(_serialization.Model): """Auto upgrade profile for a managed cluster. :ivar upgrade_channel: upgrade channel for auto upgrade. Known values are: "rapid", "stable", - "patch", "none". + "patch", and "none". :vartype upgrade_channel: str or ~azure.mgmt.containerservice.v2021_02_01.models.UpgradeChannel """ _attribute_map = { - 'upgrade_channel': {'key': 'upgradeChannel', 'type': 'str'}, + "upgrade_channel": {"key": "upgradeChannel", "type": "str"}, } - def __init__( - self, - *, - upgrade_channel: Optional[Union[str, "_models.UpgradeChannel"]] = None, - **kwargs - ): + def __init__(self, *, upgrade_channel: Optional[Union[str, "_models.UpgradeChannel"]] = None, **kwargs): """ :keyword upgrade_channel: upgrade channel for auto upgrade. Known values are: "rapid", - "stable", "patch", "none". + "stable", "patch", and "none". :paramtype upgrade_channel: str or ~azure.mgmt.containerservice.v2021_02_01.models.UpgradeChannel """ - super(ManagedClusterAutoUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.upgrade_channel = upgrade_channel -class ManagedClusterIdentity(msrest.serialization.Model): +class ManagedClusterIdentity(_serialization.Model): """Identity for the managed cluster. Variables are only populated by the server, and will be ignored when sending a request. @@ -3222,7 +3234,7 @@ class ManagedClusterIdentity(msrest.serialization.Model): :ivar type: The type of identity used for the managed cluster. Type 'SystemAssigned' will use an implicitly created identity in master components and an auto-created user assigned identity in MC_ resource group in agent nodes. Type 'None' will not use MSI for the managed cluster, - service principal will be used instead. Known values are: "SystemAssigned", "UserAssigned", + service principal will be used instead. Known values are: "SystemAssigned", "UserAssigned", and "None". :vartype type: str or ~azure.mgmt.containerservice.v2021_02_01.models.ResourceIdentityType :ivar user_assigned_identities: The user identity associated with the managed cluster. This @@ -3234,22 +3246,30 @@ class ManagedClusterIdentity(msrest.serialization.Model): """ _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, + "principal_id": {"readonly": True}, + "tenant_id": {"readonly": True}, } _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{Components1Umhcm8SchemasManagedclusteridentityPropertiesUserassignedidentitiesAdditionalproperties}'}, + "principal_id": {"key": "principalId", "type": "str"}, + "tenant_id": {"key": "tenantId", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "user_assigned_identities": { + "key": "userAssignedIdentities", + "type": "{Components1Umhcm8SchemasManagedclusteridentityPropertiesUserassignedidentitiesAdditionalproperties}", + }, } def __init__( self, *, type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, - user_assigned_identities: Optional[Dict[str, "_models.Components1Umhcm8SchemasManagedclusteridentityPropertiesUserassignedidentitiesAdditionalproperties"]] = None, + user_assigned_identities: Optional[ + Dict[ + str, + "_models.Components1Umhcm8SchemasManagedclusteridentityPropertiesUserassignedidentitiesAdditionalproperties", + ] + ] = None, **kwargs ): """ @@ -3257,7 +3277,7 @@ def __init__( use an implicitly created identity in master components and an auto-created user assigned identity in MC_ resource group in agent nodes. Type 'None' will not use MSI for the managed cluster, service principal will be used instead. Known values are: "SystemAssigned", - "UserAssigned", "None". + "UserAssigned", and "None". :paramtype type: str or ~azure.mgmt.containerservice.v2021_02_01.models.ResourceIdentityType :keyword user_assigned_identities: The user identity associated with the managed cluster. This identity will be used in control plane and only one user assigned identity is allowed. The user @@ -3266,14 +3286,14 @@ def __init__( :paramtype user_assigned_identities: dict[str, ~azure.mgmt.containerservice.v2021_02_01.models.Components1Umhcm8SchemasManagedclusteridentityPropertiesUserassignedidentitiesAdditionalproperties] """ - super(ManagedClusterIdentity, self).__init__(**kwargs) + super().__init__(**kwargs) self.principal_id = None self.tenant_id = None self.type = type self.user_assigned_identities = user_assigned_identities -class ManagedClusterListResult(msrest.serialization.Model): +class ManagedClusterListResult(_serialization.Model): """The response from the List Managed Clusters operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -3285,30 +3305,25 @@ class ManagedClusterListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[ManagedCluster]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[ManagedCluster]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.ManagedCluster"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.ManagedCluster"]] = None, **kwargs): """ :keyword value: The list of managed clusters. :paramtype value: list[~azure.mgmt.containerservice.v2021_02_01.models.ManagedCluster] """ - super(ManagedClusterListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class ManagedClusterLoadBalancerProfile(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfile(_serialization.Model): """Profile of the managed cluster load balancer. :ivar managed_outbound_i_ps: Desired managed outbound IPs for the cluster load balancer. @@ -3334,17 +3349,23 @@ class ManagedClusterLoadBalancerProfile(msrest.serialization.Model): """ _validation = { - 'allocated_outbound_ports': {'maximum': 64000, 'minimum': 0}, - 'idle_timeout_in_minutes': {'maximum': 120, 'minimum': 4}, + "allocated_outbound_ports": {"maximum": 64000, "minimum": 0}, + "idle_timeout_in_minutes": {"maximum": 120, "minimum": 4}, } _attribute_map = { - 'managed_outbound_i_ps': {'key': 'managedOutboundIPs', 'type': 'ManagedClusterLoadBalancerProfileManagedOutboundIPs'}, - 'outbound_ip_prefixes': {'key': 'outboundIPPrefixes', 'type': 'ManagedClusterLoadBalancerProfileOutboundIPPrefixes'}, - 'outbound_i_ps': {'key': 'outboundIPs', 'type': 'ManagedClusterLoadBalancerProfileOutboundIPs'}, - 'effective_outbound_i_ps': {'key': 'effectiveOutboundIPs', 'type': '[ResourceReference]'}, - 'allocated_outbound_ports': {'key': 'allocatedOutboundPorts', 'type': 'int'}, - 'idle_timeout_in_minutes': {'key': 'idleTimeoutInMinutes', 'type': 'int'}, + "managed_outbound_i_ps": { + "key": "managedOutboundIPs", + "type": "ManagedClusterLoadBalancerProfileManagedOutboundIPs", + }, + "outbound_ip_prefixes": { + "key": "outboundIPPrefixes", + "type": "ManagedClusterLoadBalancerProfileOutboundIPPrefixes", + }, + "outbound_i_ps": {"key": "outboundIPs", "type": "ManagedClusterLoadBalancerProfileOutboundIPs"}, + "effective_outbound_i_ps": {"key": "effectiveOutboundIPs", "type": "[ResourceReference]"}, + "allocated_outbound_ports": {"key": "allocatedOutboundPorts", "type": "int"}, + "idle_timeout_in_minutes": {"key": "idleTimeoutInMinutes", "type": "int"}, } def __init__( @@ -3354,8 +3375,8 @@ def __init__( outbound_ip_prefixes: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPPrefixes"] = None, outbound_i_ps: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPs"] = None, effective_outbound_i_ps: Optional[List["_models.ResourceReference"]] = None, - allocated_outbound_ports: Optional[int] = 0, - idle_timeout_in_minutes: Optional[int] = 30, + allocated_outbound_ports: int = 0, + idle_timeout_in_minutes: int = 30, **kwargs ): """ @@ -3381,7 +3402,7 @@ def __init__( must be in the range of 4 to 120 (inclusive). The default value is 30 minutes. :paramtype idle_timeout_in_minutes: int """ - super(ManagedClusterLoadBalancerProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.managed_outbound_i_ps = managed_outbound_i_ps self.outbound_ip_prefixes = outbound_ip_prefixes self.outbound_i_ps = outbound_i_ps @@ -3390,7 +3411,7 @@ def __init__( self.idle_timeout_in_minutes = idle_timeout_in_minutes -class ManagedClusterLoadBalancerProfileManagedOutboundIPs(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfileManagedOutboundIPs(_serialization.Model): """Desired managed outbound IPs for the cluster load balancer. :ivar count: Desired number of outbound IP created/managed by Azure for the cluster load @@ -3399,29 +3420,24 @@ class ManagedClusterLoadBalancerProfileManagedOutboundIPs(msrest.serialization.M """ _validation = { - 'count': {'maximum': 100, 'minimum': 1}, + "count": {"maximum": 100, "minimum": 1}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, + "count": {"key": "count", "type": "int"}, } - def __init__( - self, - *, - count: Optional[int] = 1, - **kwargs - ): + def __init__(self, *, count: int = 1, **kwargs): """ :keyword count: Desired number of outbound IP created/managed by Azure for the cluster load balancer. Allowed values must be in the range of 1 to 100 (inclusive). The default value is 1. :paramtype count: int """ - super(ManagedClusterLoadBalancerProfileManagedOutboundIPs, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count -class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(_serialization.Model): """Desired outbound IP Prefix resources for the cluster load balancer. :ivar public_ip_prefixes: A list of public IP prefix resources. @@ -3430,25 +3446,20 @@ class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(msrest.serialization.M """ _attribute_map = { - 'public_ip_prefixes': {'key': 'publicIPPrefixes', 'type': '[ResourceReference]'}, + "public_ip_prefixes": {"key": "publicIPPrefixes", "type": "[ResourceReference]"}, } - def __init__( - self, - *, - public_ip_prefixes: Optional[List["_models.ResourceReference"]] = None, - **kwargs - ): + def __init__(self, *, public_ip_prefixes: Optional[List["_models.ResourceReference"]] = None, **kwargs): """ :keyword public_ip_prefixes: A list of public IP prefix resources. :paramtype public_ip_prefixes: list[~azure.mgmt.containerservice.v2021_02_01.models.ResourceReference] """ - super(ManagedClusterLoadBalancerProfileOutboundIPPrefixes, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_ip_prefixes = public_ip_prefixes -class ManagedClusterLoadBalancerProfileOutboundIPs(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfileOutboundIPs(_serialization.Model): """Desired outbound IP resources for the cluster load balancer. :ivar public_i_ps: A list of public IP resources. @@ -3456,38 +3467,33 @@ class ManagedClusterLoadBalancerProfileOutboundIPs(msrest.serialization.Model): """ _attribute_map = { - 'public_i_ps': {'key': 'publicIPs', 'type': '[ResourceReference]'}, + "public_i_ps": {"key": "publicIPs", "type": "[ResourceReference]"}, } - def __init__( - self, - *, - public_i_ps: Optional[List["_models.ResourceReference"]] = None, - **kwargs - ): + def __init__(self, *, public_i_ps: Optional[List["_models.ResourceReference"]] = None, **kwargs): """ :keyword public_i_ps: A list of public IP resources. :paramtype public_i_ps: list[~azure.mgmt.containerservice.v2021_02_01.models.ResourceReference] """ - super(ManagedClusterLoadBalancerProfileOutboundIPs, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_i_ps = public_i_ps -class ManagedClusterPodIdentity(msrest.serialization.Model): +class ManagedClusterPodIdentity(_serialization.Model): """ManagedClusterPodIdentity. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar name: Required. Name of the pod identity. + :ivar name: Name of the pod identity. Required. :vartype name: str - :ivar namespace: Required. Namespace of the pod identity. + :ivar namespace: Namespace of the pod identity. Required. :vartype namespace: str - :ivar identity: Required. Information of the user assigned identity. + :ivar identity: Information of the user assigned identity. Required. :vartype identity: ~azure.mgmt.containerservice.v2021_02_01.models.UserAssignedIdentity :ivar provisioning_state: The current provisioning state of the pod identity. Known values are: - "Assigned", "Updating", "Deleting", "Failed". + "Assigned", "Updating", "Deleting", and "Failed". :vartype provisioning_state: str or ~azure.mgmt.containerservice.v2021_02_01.models.ManagedClusterPodIdentityProvisioningState :ivar provisioning_info: @@ -3496,38 +3502,31 @@ class ManagedClusterPodIdentity(msrest.serialization.Model): """ _validation = { - 'name': {'required': True}, - 'namespace': {'required': True}, - 'identity': {'required': True}, - 'provisioning_state': {'readonly': True}, - 'provisioning_info': {'readonly': True}, + "name": {"required": True}, + "namespace": {"required": True}, + "identity": {"required": True}, + "provisioning_state": {"readonly": True}, + "provisioning_info": {"readonly": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'namespace': {'key': 'namespace', 'type': 'str'}, - 'identity': {'key': 'identity', 'type': 'UserAssignedIdentity'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'provisioning_info': {'key': 'provisioningInfo', 'type': 'ManagedClusterPodIdentityProvisioningInfo'}, + "name": {"key": "name", "type": "str"}, + "namespace": {"key": "namespace", "type": "str"}, + "identity": {"key": "identity", "type": "UserAssignedIdentity"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "provisioning_info": {"key": "provisioningInfo", "type": "ManagedClusterPodIdentityProvisioningInfo"}, } - def __init__( - self, - *, - name: str, - namespace: str, - identity: "_models.UserAssignedIdentity", - **kwargs - ): + def __init__(self, *, name: str, namespace: str, identity: "_models.UserAssignedIdentity", **kwargs): """ - :keyword name: Required. Name of the pod identity. + :keyword name: Name of the pod identity. Required. :paramtype name: str - :keyword namespace: Required. Namespace of the pod identity. + :keyword namespace: Namespace of the pod identity. Required. :paramtype namespace: str - :keyword identity: Required. Information of the user assigned identity. + :keyword identity: Information of the user assigned identity. Required. :paramtype identity: ~azure.mgmt.containerservice.v2021_02_01.models.UserAssignedIdentity """ - super(ManagedClusterPodIdentity, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.namespace = namespace self.identity = identity @@ -3535,54 +3534,47 @@ def __init__( self.provisioning_info = None -class ManagedClusterPodIdentityException(msrest.serialization.Model): +class ManagedClusterPodIdentityException(_serialization.Model): """ManagedClusterPodIdentityException. All required parameters must be populated in order to send to Azure. - :ivar name: Required. Name of the pod identity exception. + :ivar name: Name of the pod identity exception. Required. :vartype name: str - :ivar namespace: Required. Namespace of the pod identity exception. + :ivar namespace: Namespace of the pod identity exception. Required. :vartype namespace: str - :ivar pod_labels: Required. Pod labels to match. + :ivar pod_labels: Pod labels to match. Required. :vartype pod_labels: dict[str, str] """ _validation = { - 'name': {'required': True}, - 'namespace': {'required': True}, - 'pod_labels': {'required': True}, + "name": {"required": True}, + "namespace": {"required": True}, + "pod_labels": {"required": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'namespace': {'key': 'namespace', 'type': 'str'}, - 'pod_labels': {'key': 'podLabels', 'type': '{str}'}, + "name": {"key": "name", "type": "str"}, + "namespace": {"key": "namespace", "type": "str"}, + "pod_labels": {"key": "podLabels", "type": "{str}"}, } - def __init__( - self, - *, - name: str, - namespace: str, - pod_labels: Dict[str, str], - **kwargs - ): + def __init__(self, *, name: str, namespace: str, pod_labels: Dict[str, str], **kwargs): """ - :keyword name: Required. Name of the pod identity exception. + :keyword name: Name of the pod identity exception. Required. :paramtype name: str - :keyword namespace: Required. Namespace of the pod identity exception. + :keyword namespace: Namespace of the pod identity exception. Required. :paramtype namespace: str - :keyword pod_labels: Required. Pod labels to match. + :keyword pod_labels: Pod labels to match. Required. :paramtype pod_labels: dict[str, str] """ - super(ManagedClusterPodIdentityException, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.namespace = namespace self.pod_labels = pod_labels -class ManagedClusterPodIdentityProfile(msrest.serialization.Model): +class ManagedClusterPodIdentityProfile(_serialization.Model): """ManagedClusterPodIdentityProfile. :ivar enabled: Whether the pod identity addon is enabled. @@ -3599,10 +3591,13 @@ class ManagedClusterPodIdentityProfile(msrest.serialization.Model): """ _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'allow_network_plugin_kubenet': {'key': 'allowNetworkPluginKubenet', 'type': 'bool'}, - 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '[ManagedClusterPodIdentity]'}, - 'user_assigned_identity_exceptions': {'key': 'userAssignedIdentityExceptions', 'type': '[ManagedClusterPodIdentityException]'}, + "enabled": {"key": "enabled", "type": "bool"}, + "allow_network_plugin_kubenet": {"key": "allowNetworkPluginKubenet", "type": "bool"}, + "user_assigned_identities": {"key": "userAssignedIdentities", "type": "[ManagedClusterPodIdentity]"}, + "user_assigned_identity_exceptions": { + "key": "userAssignedIdentityExceptions", + "type": "[ManagedClusterPodIdentityException]", + }, } def __init__( @@ -3627,14 +3622,14 @@ def __init__( :paramtype user_assigned_identity_exceptions: list[~azure.mgmt.containerservice.v2021_02_01.models.ManagedClusterPodIdentityException] """ - super(ManagedClusterPodIdentityProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.allow_network_plugin_kubenet = allow_network_plugin_kubenet self.user_assigned_identities = user_assigned_identities self.user_assigned_identity_exceptions = user_assigned_identity_exceptions -class ManagedClusterPodIdentityProvisioningInfo(msrest.serialization.Model): +class ManagedClusterPodIdentityProvisioningInfo(_serialization.Model): """ManagedClusterPodIdentityProvisioningInfo. :ivar error: Pod identity assignment error (if any). @@ -3642,34 +3637,29 @@ class ManagedClusterPodIdentityProvisioningInfo(msrest.serialization.Model): """ _attribute_map = { - 'error': {'key': 'error', 'type': 'CloudError'}, + "error": {"key": "error", "type": "CloudError"}, } - def __init__( - self, - *, - error: Optional["_models.CloudError"] = None, - **kwargs - ): + def __init__(self, *, error: Optional["_models.CloudError"] = None, **kwargs): """ :keyword error: Pod identity assignment error (if any). :paramtype error: ~azure.mgmt.containerservice.v2021_02_01.models.CloudError """ - super(ManagedClusterPodIdentityProvisioningInfo, self).__init__(**kwargs) + super().__init__(**kwargs) self.error = error -class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): +class ManagedClusterPoolUpgradeProfile(_serialization.Model): """The list of available upgrade versions. All required parameters must be populated in order to send to Azure. - :ivar kubernetes_version: Required. Kubernetes version (major, minor, patch). + :ivar kubernetes_version: Kubernetes version (major, minor, patch). Required. :vartype kubernetes_version: str :ivar name: Pool name. :vartype name: str - :ivar os_type: Required. OsType to be used to specify os type. Choose from Linux and Windows. - Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to + Linux. Known values are: "Linux" and "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2021_02_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -3677,15 +3667,15 @@ class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): """ _validation = { - 'kubernetes_version': {'required': True}, - 'os_type': {'required': True}, + "kubernetes_version": {"required": True}, + "os_type": {"required": True}, } _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'upgrades': {'key': 'upgrades', 'type': '[ManagedClusterPoolUpgradeProfileUpgradesItem]'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "os_type": {"key": "osType", "type": "str"}, + "upgrades": {"key": "upgrades", "type": "[ManagedClusterPoolUpgradeProfileUpgradesItem]"}, } def __init__( @@ -3698,25 +3688,25 @@ def __init__( **kwargs ): """ - :keyword kubernetes_version: Required. Kubernetes version (major, minor, patch). + :keyword kubernetes_version: Kubernetes version (major, minor, patch). Required. :paramtype kubernetes_version: str :keyword name: Pool name. :paramtype name: str - :keyword os_type: Required. OsType to be used to specify os type. Choose from Linux and - Windows. Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default + to Linux. Known values are: "Linux" and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2021_02_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: list[~azure.mgmt.containerservice.v2021_02_01.models.ManagedClusterPoolUpgradeProfileUpgradesItem] """ - super(ManagedClusterPoolUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.name = name self.os_type = os_type self.upgrades = upgrades -class ManagedClusterPoolUpgradeProfileUpgradesItem(msrest.serialization.Model): +class ManagedClusterPoolUpgradeProfileUpgradesItem(_serialization.Model): """ManagedClusterPoolUpgradeProfileUpgradesItem. :ivar kubernetes_version: Kubernetes version (major, minor, patch). @@ -3726,34 +3716,28 @@ class ManagedClusterPoolUpgradeProfileUpgradesItem(msrest.serialization.Model): """ _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } - def __init__( - self, - *, - kubernetes_version: Optional[str] = None, - is_preview: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, kubernetes_version: Optional[str] = None, is_preview: Optional[bool] = None, **kwargs): """ :keyword kubernetes_version: Kubernetes version (major, minor, patch). :paramtype kubernetes_version: str :keyword is_preview: Whether Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(ManagedClusterPoolUpgradeProfileUpgradesItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.is_preview = is_preview -class ManagedClusterPropertiesAutoScalerProfile(msrest.serialization.Model): +class ManagedClusterPropertiesAutoScalerProfile(_serialization.Model): # pylint: disable=too-many-instance-attributes """Parameters to be applied to the cluster-autoscaler when enabled. :ivar balance_similar_node_groups: :vartype balance_similar_node_groups: str - :ivar expander: Known values are: "least-waste", "most-pods", "priority", "random". + :ivar expander: Known values are: "least-waste", "most-pods", "priority", and "random". :vartype expander: str or ~azure.mgmt.containerservice.v2021_02_01.models.Expander :ivar max_empty_bulk_delete: :vartype max_empty_bulk_delete: str @@ -3788,23 +3772,23 @@ class ManagedClusterPropertiesAutoScalerProfile(msrest.serialization.Model): """ _attribute_map = { - 'balance_similar_node_groups': {'key': 'balance-similar-node-groups', 'type': 'str'}, - 'expander': {'key': 'expander', 'type': 'str'}, - 'max_empty_bulk_delete': {'key': 'max-empty-bulk-delete', 'type': 'str'}, - 'max_graceful_termination_sec': {'key': 'max-graceful-termination-sec', 'type': 'str'}, - 'max_node_provision_time': {'key': 'max-node-provision-time', 'type': 'str'}, - 'max_total_unready_percentage': {'key': 'max-total-unready-percentage', 'type': 'str'}, - 'new_pod_scale_up_delay': {'key': 'new-pod-scale-up-delay', 'type': 'str'}, - 'ok_total_unready_count': {'key': 'ok-total-unready-count', 'type': 'str'}, - 'scan_interval': {'key': 'scan-interval', 'type': 'str'}, - 'scale_down_delay_after_add': {'key': 'scale-down-delay-after-add', 'type': 'str'}, - 'scale_down_delay_after_delete': {'key': 'scale-down-delay-after-delete', 'type': 'str'}, - 'scale_down_delay_after_failure': {'key': 'scale-down-delay-after-failure', 'type': 'str'}, - 'scale_down_unneeded_time': {'key': 'scale-down-unneeded-time', 'type': 'str'}, - 'scale_down_unready_time': {'key': 'scale-down-unready-time', 'type': 'str'}, - 'scale_down_utilization_threshold': {'key': 'scale-down-utilization-threshold', 'type': 'str'}, - 'skip_nodes_with_local_storage': {'key': 'skip-nodes-with-local-storage', 'type': 'str'}, - 'skip_nodes_with_system_pods': {'key': 'skip-nodes-with-system-pods', 'type': 'str'}, + "balance_similar_node_groups": {"key": "balance-similar-node-groups", "type": "str"}, + "expander": {"key": "expander", "type": "str"}, + "max_empty_bulk_delete": {"key": "max-empty-bulk-delete", "type": "str"}, + "max_graceful_termination_sec": {"key": "max-graceful-termination-sec", "type": "str"}, + "max_node_provision_time": {"key": "max-node-provision-time", "type": "str"}, + "max_total_unready_percentage": {"key": "max-total-unready-percentage", "type": "str"}, + "new_pod_scale_up_delay": {"key": "new-pod-scale-up-delay", "type": "str"}, + "ok_total_unready_count": {"key": "ok-total-unready-count", "type": "str"}, + "scan_interval": {"key": "scan-interval", "type": "str"}, + "scale_down_delay_after_add": {"key": "scale-down-delay-after-add", "type": "str"}, + "scale_down_delay_after_delete": {"key": "scale-down-delay-after-delete", "type": "str"}, + "scale_down_delay_after_failure": {"key": "scale-down-delay-after-failure", "type": "str"}, + "scale_down_unneeded_time": {"key": "scale-down-unneeded-time", "type": "str"}, + "scale_down_unready_time": {"key": "scale-down-unready-time", "type": "str"}, + "scale_down_utilization_threshold": {"key": "scale-down-utilization-threshold", "type": "str"}, + "skip_nodes_with_local_storage": {"key": "skip-nodes-with-local-storage", "type": "str"}, + "skip_nodes_with_system_pods": {"key": "skip-nodes-with-system-pods", "type": "str"}, } def __init__( @@ -3832,7 +3816,7 @@ def __init__( """ :keyword balance_similar_node_groups: :paramtype balance_similar_node_groups: str - :keyword expander: Known values are: "least-waste", "most-pods", "priority", "random". + :keyword expander: Known values are: "least-waste", "most-pods", "priority", and "random". :paramtype expander: str or ~azure.mgmt.containerservice.v2021_02_01.models.Expander :keyword max_empty_bulk_delete: :paramtype max_empty_bulk_delete: str @@ -3865,7 +3849,7 @@ def __init__( :keyword skip_nodes_with_system_pods: :paramtype skip_nodes_with_system_pods: str """ - super(ManagedClusterPropertiesAutoScalerProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.balance_similar_node_groups = balance_similar_node_groups self.expander = expander self.max_empty_bulk_delete = max_empty_bulk_delete @@ -3885,56 +3869,50 @@ def __init__( self.skip_nodes_with_system_pods = skip_nodes_with_system_pods -class ManagedClusterServicePrincipalProfile(msrest.serialization.Model): +class ManagedClusterServicePrincipalProfile(_serialization.Model): """Information about a service principal identity for the cluster to use for manipulating Azure APIs. All required parameters must be populated in order to send to Azure. - :ivar client_id: Required. The ID for the service principal. + :ivar client_id: The ID for the service principal. Required. :vartype client_id: str :ivar secret: The secret password associated with the service principal in plain text. :vartype secret: str """ _validation = { - 'client_id': {'required': True}, + "client_id": {"required": True}, } _attribute_map = { - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'secret': {'key': 'secret', 'type': 'str'}, + "client_id": {"key": "clientId", "type": "str"}, + "secret": {"key": "secret", "type": "str"}, } - def __init__( - self, - *, - client_id: str, - secret: Optional[str] = None, - **kwargs - ): + def __init__(self, *, client_id: str, secret: Optional[str] = None, **kwargs): """ - :keyword client_id: Required. The ID for the service principal. + :keyword client_id: The ID for the service principal. Required. :paramtype client_id: str :keyword secret: The secret password associated with the service principal in plain text. :paramtype secret: str """ - super(ManagedClusterServicePrincipalProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.client_id = client_id self.secret = secret -class ManagedClusterSKU(msrest.serialization.Model): +class ManagedClusterSKU(_serialization.Model): """ManagedClusterSKU. - :ivar name: Name of a managed cluster SKU. Known values are: "Basic". + :ivar name: Name of a managed cluster SKU. "Basic" :vartype name: str or ~azure.mgmt.containerservice.v2021_02_01.models.ManagedClusterSKUName - :ivar tier: Tier of a managed cluster SKU. Known values are: "Paid", "Free". + :ivar tier: Tier of a managed cluster SKU. Known values are: "Paid" and "Free". :vartype tier: str or ~azure.mgmt.containerservice.v2021_02_01.models.ManagedClusterSKUTier """ _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, + "name": {"key": "name", "type": "str"}, + "tier": {"key": "tier", "type": "str"}, } def __init__( @@ -3945,17 +3923,17 @@ def __init__( **kwargs ): """ - :keyword name: Name of a managed cluster SKU. Known values are: "Basic". + :keyword name: Name of a managed cluster SKU. "Basic" :paramtype name: str or ~azure.mgmt.containerservice.v2021_02_01.models.ManagedClusterSKUName - :keyword tier: Tier of a managed cluster SKU. Known values are: "Paid", "Free". + :keyword tier: Tier of a managed cluster SKU. Known values are: "Paid" and "Free". :paramtype tier: str or ~azure.mgmt.containerservice.v2021_02_01.models.ManagedClusterSKUTier """ - super(ManagedClusterSKU, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.tier = tier -class ManagedClusterUpgradeProfile(msrest.serialization.Model): +class ManagedClusterUpgradeProfile(_serialization.Model): """The list of available upgrades for compute pools. Variables are only populated by the server, and will be ignored when sending a request. @@ -3968,29 +3946,29 @@ class ManagedClusterUpgradeProfile(msrest.serialization.Model): :vartype name: str :ivar type: Type of upgrade profile. :vartype type: str - :ivar control_plane_profile: Required. The list of available upgrade versions for the control - plane. + :ivar control_plane_profile: The list of available upgrade versions for the control plane. + Required. :vartype control_plane_profile: ~azure.mgmt.containerservice.v2021_02_01.models.ManagedClusterPoolUpgradeProfile - :ivar agent_pool_profiles: Required. The list of available upgrade versions for agent pools. + :ivar agent_pool_profiles: The list of available upgrade versions for agent pools. Required. :vartype agent_pool_profiles: list[~azure.mgmt.containerservice.v2021_02_01.models.ManagedClusterPoolUpgradeProfile] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'control_plane_profile': {'required': True}, - 'agent_pool_profiles': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "control_plane_profile": {"required": True}, + "agent_pool_profiles": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'control_plane_profile': {'key': 'properties.controlPlaneProfile', 'type': 'ManagedClusterPoolUpgradeProfile'}, - 'agent_pool_profiles': {'key': 'properties.agentPoolProfiles', 'type': '[ManagedClusterPoolUpgradeProfile]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "control_plane_profile": {"key": "properties.controlPlaneProfile", "type": "ManagedClusterPoolUpgradeProfile"}, + "agent_pool_profiles": {"key": "properties.agentPoolProfiles", "type": "[ManagedClusterPoolUpgradeProfile]"}, } def __init__( @@ -4001,15 +3979,15 @@ def __init__( **kwargs ): """ - :keyword control_plane_profile: Required. The list of available upgrade versions for the - control plane. + :keyword control_plane_profile: The list of available upgrade versions for the control plane. + Required. :paramtype control_plane_profile: ~azure.mgmt.containerservice.v2021_02_01.models.ManagedClusterPoolUpgradeProfile - :keyword agent_pool_profiles: Required. The list of available upgrade versions for agent pools. + :keyword agent_pool_profiles: The list of available upgrade versions for agent pools. Required. :paramtype agent_pool_profiles: list[~azure.mgmt.containerservice.v2021_02_01.models.ManagedClusterPoolUpgradeProfile] """ - super(ManagedClusterUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -4017,18 +3995,18 @@ def __init__( self.agent_pool_profiles = agent_pool_profiles -class ManagedClusterWindowsProfile(msrest.serialization.Model): +class ManagedClusterWindowsProfile(_serialization.Model): """Profile for Windows VMs in the container service cluster. All required parameters must be populated in order to send to Azure. - :ivar admin_username: Required. Specifies the name of the administrator account. - :code:`
`:code:`
` **restriction:** Cannot end in "." :code:`
`:code:`
` - **Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", "test1", - "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", - "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", - "sys", "test2", "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 - character :code:`
`:code:`
` **Max-length:** 20 characters. + :ivar admin_username: Specifies the name of the administrator account. :code:`
`:code:`
` + **restriction:** Cannot end in "." :code:`
`:code:`
` **Disallowed values:** + "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", + "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", + "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", + "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 character + :code:`
`:code:`
` **Max-length:** 20 characters. Required. :vartype admin_username: str :ivar admin_password: Specifies the password of the administrator account. :code:`
`:code:`
` **Minimum-length:** 8 characters :code:`
`:code:`
` @@ -4039,18 +4017,18 @@ class ManagedClusterWindowsProfile(msrest.serialization.Model): "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!". :vartype admin_password: str :ivar license_type: The licenseType to use for Windows VMs. Windows_Server is used to enable - Azure Hybrid User Benefits for Windows VMs. Known values are: "None", "Windows_Server". + Azure Hybrid User Benefits for Windows VMs. Known values are: "None" and "Windows_Server". :vartype license_type: str or ~azure.mgmt.containerservice.v2021_02_01.models.LicenseType """ _validation = { - 'admin_username': {'required': True}, + "admin_username": {"required": True}, } _attribute_map = { - 'admin_username': {'key': 'adminUsername', 'type': 'str'}, - 'admin_password': {'key': 'adminPassword', 'type': 'str'}, - 'license_type': {'key': 'licenseType', 'type': 'str'}, + "admin_username": {"key": "adminUsername", "type": "str"}, + "admin_password": {"key": "adminPassword", "type": "str"}, + "license_type": {"key": "licenseType", "type": "str"}, } def __init__( @@ -4062,13 +4040,13 @@ def __init__( **kwargs ): """ - :keyword admin_username: Required. Specifies the name of the administrator account. + :keyword admin_username: Specifies the name of the administrator account. :code:`
`:code:`
` **restriction:** Cannot end in "." :code:`
`:code:`
` **Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 - character :code:`
`:code:`
` **Max-length:** 20 characters. + character :code:`
`:code:`
` **Max-length:** 20 characters. Required. :paramtype admin_username: str :keyword admin_password: Specifies the password of the administrator account. :code:`
`:code:`
` **Minimum-length:** 8 characters :code:`
`:code:`
` @@ -4079,16 +4057,16 @@ def __init__( "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!". :paramtype admin_password: str :keyword license_type: The licenseType to use for Windows VMs. Windows_Server is used to enable - Azure Hybrid User Benefits for Windows VMs. Known values are: "None", "Windows_Server". + Azure Hybrid User Benefits for Windows VMs. Known values are: "None" and "Windows_Server". :paramtype license_type: str or ~azure.mgmt.containerservice.v2021_02_01.models.LicenseType """ - super(ManagedClusterWindowsProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.admin_username = admin_username self.admin_password = admin_password self.license_type = license_type -class OperationListResult(msrest.serialization.Model): +class OperationListResult(_serialization.Model): """The List Compute Operation operation response. Variables are only populated by the server, and will be ignored when sending a request. @@ -4098,24 +4076,20 @@ class OperationListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[OperationValue]'}, + "value": {"key": "value", "type": "[OperationValue]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(OperationListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None -class OperationValue(msrest.serialization.Model): +class OperationValue(_serialization.Model): """Describes the properties of a Compute Operation value. Variables are only populated by the server, and will be ignored when sending a request. @@ -4135,30 +4109,26 @@ class OperationValue(msrest.serialization.Model): """ _validation = { - 'origin': {'readonly': True}, - 'name': {'readonly': True}, - 'operation': {'readonly': True}, - 'resource': {'readonly': True}, - 'description': {'readonly': True}, - 'provider': {'readonly': True}, + "origin": {"readonly": True}, + "name": {"readonly": True}, + "operation": {"readonly": True}, + "resource": {"readonly": True}, + "description": {"readonly": True}, + "provider": {"readonly": True}, } _attribute_map = { - 'origin': {'key': 'origin', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'operation': {'key': 'display.operation', 'type': 'str'}, - 'resource': {'key': 'display.resource', 'type': 'str'}, - 'description': {'key': 'display.description', 'type': 'str'}, - 'provider': {'key': 'display.provider', 'type': 'str'}, + "origin": {"key": "origin", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "operation": {"key": "display.operation", "type": "str"}, + "resource": {"key": "display.resource", "type": "str"}, + "description": {"key": "display.description", "type": "str"}, + "provider": {"key": "display.provider", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(OperationValue, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.origin = None self.name = None self.operation = None @@ -4167,34 +4137,29 @@ def __init__( self.provider = None -class PowerState(msrest.serialization.Model): +class PowerState(_serialization.Model): """Describes the Power State of the cluster. - :ivar code: Tells whether the cluster is Running or Stopped. Known values are: "Running", + :ivar code: Tells whether the cluster is Running or Stopped. Known values are: "Running" and "Stopped". :vartype code: str or ~azure.mgmt.containerservice.v2021_02_01.models.Code """ _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, + "code": {"key": "code", "type": "str"}, } - def __init__( - self, - *, - code: Optional[Union[str, "_models.Code"]] = None, - **kwargs - ): + def __init__(self, *, code: Optional[Union[str, "_models.Code"]] = None, **kwargs): """ - :keyword code: Tells whether the cluster is Running or Stopped. Known values are: "Running", + :keyword code: Tells whether the cluster is Running or Stopped. Known values are: "Running" and "Stopped". :paramtype code: str or ~azure.mgmt.containerservice.v2021_02_01.models.Code """ - super(PowerState, self).__init__(**kwargs) + super().__init__(**kwargs) self.code = code -class PrivateEndpoint(msrest.serialization.Model): +class PrivateEndpoint(_serialization.Model): """Private endpoint which a connection belongs to. :ivar id: The resource Id for private endpoint. @@ -4202,24 +4167,19 @@ class PrivateEndpoint(msrest.serialization.Model): """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, } - def __init__( - self, - *, - id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin """ :keyword id: The resource Id for private endpoint. :paramtype id: str """ - super(PrivateEndpoint, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id -class PrivateEndpointConnection(msrest.serialization.Model): +class PrivateEndpointConnection(_serialization.Model): """A private endpoint connection. Variables are only populated by the server, and will be ignored when sending a request. @@ -4231,7 +4191,7 @@ class PrivateEndpointConnection(msrest.serialization.Model): :ivar type: The resource type. :vartype type: str :ivar provisioning_state: The current provisioning state. Known values are: "Succeeded", - "Creating", "Deleting", "Failed". + "Creating", "Deleting", and "Failed". :vartype provisioning_state: str or ~azure.mgmt.containerservice.v2021_02_01.models.PrivateEndpointConnectionProvisioningState :ivar private_endpoint: The resource of private endpoint. @@ -4243,19 +4203,22 @@ class PrivateEndpointConnection(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'provisioning_state': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, - 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "private_endpoint": {"key": "properties.privateEndpoint", "type": "PrivateEndpoint"}, + "private_link_service_connection_state": { + "key": "properties.privateLinkServiceConnectionState", + "type": "PrivateLinkServiceConnectionState", + }, } def __init__( @@ -4273,7 +4236,7 @@ def __init__( :paramtype private_link_service_connection_state: ~azure.mgmt.containerservice.v2021_02_01.models.PrivateLinkServiceConnectionState """ - super(PrivateEndpointConnection, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -4282,7 +4245,7 @@ def __init__( self.private_link_service_connection_state = private_link_service_connection_state -class PrivateEndpointConnectionListResult(msrest.serialization.Model): +class PrivateEndpointConnectionListResult(_serialization.Model): """A list of private endpoint connections. :ivar value: The collection value. @@ -4290,25 +4253,20 @@ class PrivateEndpointConnectionListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, + "value": {"key": "value", "type": "[PrivateEndpointConnection]"}, } - def __init__( - self, - *, - value: Optional[List["_models.PrivateEndpointConnection"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.PrivateEndpointConnection"]] = None, **kwargs): """ :keyword value: The collection value. :paramtype value: list[~azure.mgmt.containerservice.v2021_02_01.models.PrivateEndpointConnection] """ - super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value -class PrivateLinkResource(msrest.serialization.Model): +class PrivateLinkResource(_serialization.Model): """A private link resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -4329,22 +4287,22 @@ class PrivateLinkResource(msrest.serialization.Model): """ _validation = { - 'private_link_service_id': {'readonly': True}, + "private_link_service_id": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'group_id': {'key': 'groupId', 'type': 'str'}, - 'required_members': {'key': 'requiredMembers', 'type': '[str]'}, - 'private_link_service_id': {'key': 'privateLinkServiceID', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "group_id": {"key": "groupId", "type": "str"}, + "required_members": {"key": "requiredMembers", "type": "[str]"}, + "private_link_service_id": {"key": "privateLinkServiceID", "type": "str"}, } def __init__( self, *, - id: Optional[str] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin name: Optional[str] = None, type: Optional[str] = None, group_id: Optional[str] = None, @@ -4363,7 +4321,7 @@ def __init__( :keyword required_members: RequiredMembers of the resource. :paramtype required_members: list[str] """ - super(PrivateLinkResource, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id self.name = name self.type = type @@ -4372,7 +4330,7 @@ def __init__( self.private_link_service_id = None -class PrivateLinkResourcesListResult(msrest.serialization.Model): +class PrivateLinkResourcesListResult(_serialization.Model): """A list of private link resources. :ivar value: The collection value. @@ -4380,36 +4338,31 @@ class PrivateLinkResourcesListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, + "value": {"key": "value", "type": "[PrivateLinkResource]"}, } - def __init__( - self, - *, - value: Optional[List["_models.PrivateLinkResource"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.PrivateLinkResource"]] = None, **kwargs): """ :keyword value: The collection value. :paramtype value: list[~azure.mgmt.containerservice.v2021_02_01.models.PrivateLinkResource] """ - super(PrivateLinkResourcesListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value -class PrivateLinkServiceConnectionState(msrest.serialization.Model): +class PrivateLinkServiceConnectionState(_serialization.Model): """The state of a private link service connection. :ivar status: The private link service connection status. Known values are: "Pending", - "Approved", "Rejected", "Disconnected". + "Approved", "Rejected", and "Disconnected". :vartype status: str or ~azure.mgmt.containerservice.v2021_02_01.models.ConnectionStatus :ivar description: The private link service connection description. :vartype description: str """ _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, + "status": {"key": "status", "type": "str"}, + "description": {"key": "description", "type": "str"}, } def __init__( @@ -4421,17 +4374,17 @@ def __init__( ): """ :keyword status: The private link service connection status. Known values are: "Pending", - "Approved", "Rejected", "Disconnected". + "Approved", "Rejected", and "Disconnected". :paramtype status: str or ~azure.mgmt.containerservice.v2021_02_01.models.ConnectionStatus :keyword description: The private link service connection description. :paramtype description: str """ - super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) + super().__init__(**kwargs) self.status = status self.description = description -class ResourceReference(msrest.serialization.Model): +class ResourceReference(_serialization.Model): """A reference to an Azure resource. :ivar id: The fully qualified Azure resource id. @@ -4439,24 +4392,19 @@ class ResourceReference(msrest.serialization.Model): """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, } - def __init__( - self, - *, - id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin """ :keyword id: The fully qualified Azure resource id. :paramtype id: str """ - super(ResourceReference, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id -class SysctlConfig(msrest.serialization.Model): +class SysctlConfig(_serialization.Model): # pylint: disable=too-many-instance-attributes """Sysctl settings for Linux agent nodes. :ivar net_core_somaxconn: Sysctl setting net.core.somaxconn. @@ -4518,37 +4466,37 @@ class SysctlConfig(msrest.serialization.Model): """ _attribute_map = { - 'net_core_somaxconn': {'key': 'netCoreSomaxconn', 'type': 'int'}, - 'net_core_netdev_max_backlog': {'key': 'netCoreNetdevMaxBacklog', 'type': 'int'}, - 'net_core_rmem_default': {'key': 'netCoreRmemDefault', 'type': 'int'}, - 'net_core_rmem_max': {'key': 'netCoreRmemMax', 'type': 'int'}, - 'net_core_wmem_default': {'key': 'netCoreWmemDefault', 'type': 'int'}, - 'net_core_wmem_max': {'key': 'netCoreWmemMax', 'type': 'int'}, - 'net_core_optmem_max': {'key': 'netCoreOptmemMax', 'type': 'int'}, - 'net_ipv4_tcp_max_syn_backlog': {'key': 'netIpv4TcpMaxSynBacklog', 'type': 'int'}, - 'net_ipv4_tcp_max_tw_buckets': {'key': 'netIpv4TcpMaxTwBuckets', 'type': 'int'}, - 'net_ipv4_tcp_fin_timeout': {'key': 'netIpv4TcpFinTimeout', 'type': 'int'}, - 'net_ipv4_tcp_keepalive_time': {'key': 'netIpv4TcpKeepaliveTime', 'type': 'int'}, - 'net_ipv4_tcp_keepalive_probes': {'key': 'netIpv4TcpKeepaliveProbes', 'type': 'int'}, - 'net_ipv4_tcpkeepalive_intvl': {'key': 'netIpv4TcpkeepaliveIntvl', 'type': 'int'}, - 'net_ipv4_tcp_tw_reuse': {'key': 'netIpv4TcpTwReuse', 'type': 'bool'}, - 'net_ipv4_ip_local_port_range': {'key': 'netIpv4IpLocalPortRange', 'type': 'str'}, - 'net_ipv4_neigh_default_gc_thresh1': {'key': 'netIpv4NeighDefaultGcThresh1', 'type': 'int'}, - 'net_ipv4_neigh_default_gc_thresh2': {'key': 'netIpv4NeighDefaultGcThresh2', 'type': 'int'}, - 'net_ipv4_neigh_default_gc_thresh3': {'key': 'netIpv4NeighDefaultGcThresh3', 'type': 'int'}, - 'net_netfilter_nf_conntrack_max': {'key': 'netNetfilterNfConntrackMax', 'type': 'int'}, - 'net_netfilter_nf_conntrack_buckets': {'key': 'netNetfilterNfConntrackBuckets', 'type': 'int'}, - 'fs_inotify_max_user_watches': {'key': 'fsInotifyMaxUserWatches', 'type': 'int'}, - 'fs_file_max': {'key': 'fsFileMax', 'type': 'int'}, - 'fs_aio_max_nr': {'key': 'fsAioMaxNr', 'type': 'int'}, - 'fs_nr_open': {'key': 'fsNrOpen', 'type': 'int'}, - 'kernel_threads_max': {'key': 'kernelThreadsMax', 'type': 'int'}, - 'vm_max_map_count': {'key': 'vmMaxMapCount', 'type': 'int'}, - 'vm_swappiness': {'key': 'vmSwappiness', 'type': 'int'}, - 'vm_vfs_cache_pressure': {'key': 'vmVfsCachePressure', 'type': 'int'}, + "net_core_somaxconn": {"key": "netCoreSomaxconn", "type": "int"}, + "net_core_netdev_max_backlog": {"key": "netCoreNetdevMaxBacklog", "type": "int"}, + "net_core_rmem_default": {"key": "netCoreRmemDefault", "type": "int"}, + "net_core_rmem_max": {"key": "netCoreRmemMax", "type": "int"}, + "net_core_wmem_default": {"key": "netCoreWmemDefault", "type": "int"}, + "net_core_wmem_max": {"key": "netCoreWmemMax", "type": "int"}, + "net_core_optmem_max": {"key": "netCoreOptmemMax", "type": "int"}, + "net_ipv4_tcp_max_syn_backlog": {"key": "netIpv4TcpMaxSynBacklog", "type": "int"}, + "net_ipv4_tcp_max_tw_buckets": {"key": "netIpv4TcpMaxTwBuckets", "type": "int"}, + "net_ipv4_tcp_fin_timeout": {"key": "netIpv4TcpFinTimeout", "type": "int"}, + "net_ipv4_tcp_keepalive_time": {"key": "netIpv4TcpKeepaliveTime", "type": "int"}, + "net_ipv4_tcp_keepalive_probes": {"key": "netIpv4TcpKeepaliveProbes", "type": "int"}, + "net_ipv4_tcpkeepalive_intvl": {"key": "netIpv4TcpkeepaliveIntvl", "type": "int"}, + "net_ipv4_tcp_tw_reuse": {"key": "netIpv4TcpTwReuse", "type": "bool"}, + "net_ipv4_ip_local_port_range": {"key": "netIpv4IpLocalPortRange", "type": "str"}, + "net_ipv4_neigh_default_gc_thresh1": {"key": "netIpv4NeighDefaultGcThresh1", "type": "int"}, + "net_ipv4_neigh_default_gc_thresh2": {"key": "netIpv4NeighDefaultGcThresh2", "type": "int"}, + "net_ipv4_neigh_default_gc_thresh3": {"key": "netIpv4NeighDefaultGcThresh3", "type": "int"}, + "net_netfilter_nf_conntrack_max": {"key": "netNetfilterNfConntrackMax", "type": "int"}, + "net_netfilter_nf_conntrack_buckets": {"key": "netNetfilterNfConntrackBuckets", "type": "int"}, + "fs_inotify_max_user_watches": {"key": "fsInotifyMaxUserWatches", "type": "int"}, + "fs_file_max": {"key": "fsFileMax", "type": "int"}, + "fs_aio_max_nr": {"key": "fsAioMaxNr", "type": "int"}, + "fs_nr_open": {"key": "fsNrOpen", "type": "int"}, + "kernel_threads_max": {"key": "kernelThreadsMax", "type": "int"}, + "vm_max_map_count": {"key": "vmMaxMapCount", "type": "int"}, + "vm_swappiness": {"key": "vmSwappiness", "type": "int"}, + "vm_vfs_cache_pressure": {"key": "vmVfsCachePressure", "type": "int"}, } - def __init__( + def __init__( # pylint: disable=too-many-locals self, *, net_core_somaxconn: Optional[int] = None, @@ -4639,7 +4587,7 @@ def __init__( :keyword vm_vfs_cache_pressure: Sysctl setting vm.vfs_cache_pressure. :paramtype vm_vfs_cache_pressure: int """ - super(SysctlConfig, self).__init__(**kwargs) + super().__init__(**kwargs) self.net_core_somaxconn = net_core_somaxconn self.net_core_netdev_max_backlog = net_core_netdev_max_backlog self.net_core_rmem_default = net_core_rmem_default @@ -4670,20 +4618,20 @@ def __init__( self.vm_vfs_cache_pressure = vm_vfs_cache_pressure -class SystemData(msrest.serialization.Model): +class SystemData(_serialization.Model): """Metadata pertaining to creation and last modification of the resource. :ivar created_by: The identity that created the resource. :vartype created_by: str :ivar created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", "Key". + "User", "Application", "ManagedIdentity", and "Key". :vartype created_by_type: str or ~azure.mgmt.containerservice.v2021_02_01.models.CreatedByType :ivar created_at: The timestamp of resource creation (UTC). :vartype created_at: ~datetime.datetime :ivar last_modified_by: The identity that last modified the resource. :vartype last_modified_by: str :ivar last_modified_by_type: The type of identity that last modified the resource. Known values - are: "User", "Application", "ManagedIdentity", "Key". + are: "User", "Application", "ManagedIdentity", and "Key". :vartype last_modified_by_type: str or ~azure.mgmt.containerservice.v2021_02_01.models.CreatedByType :ivar last_modified_at: The type of identity that last modified the resource. @@ -4691,12 +4639,12 @@ class SystemData(msrest.serialization.Model): """ _attribute_map = { - 'created_by': {'key': 'createdBy', 'type': 'str'}, - 'created_by_type': {'key': 'createdByType', 'type': 'str'}, - 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, - 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, - 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, - 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + "created_by": {"key": "createdBy", "type": "str"}, + "created_by_type": {"key": "createdByType", "type": "str"}, + "created_at": {"key": "createdAt", "type": "iso-8601"}, + "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, + "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, + "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, } def __init__( @@ -4714,7 +4662,7 @@ def __init__( :keyword created_by: The identity that created the resource. :paramtype created_by: str :keyword created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", "Key". + "User", "Application", "ManagedIdentity", and "Key". :paramtype created_by_type: str or ~azure.mgmt.containerservice.v2021_02_01.models.CreatedByType :keyword created_at: The timestamp of resource creation (UTC). @@ -4722,13 +4670,13 @@ def __init__( :keyword last_modified_by: The identity that last modified the resource. :paramtype last_modified_by: str :keyword last_modified_by_type: The type of identity that last modified the resource. Known - values are: "User", "Application", "ManagedIdentity", "Key". + values are: "User", "Application", "ManagedIdentity", and "Key". :paramtype last_modified_by_type: str or ~azure.mgmt.containerservice.v2021_02_01.models.CreatedByType :keyword last_modified_at: The type of identity that last modified the resource. :paramtype last_modified_at: ~datetime.datetime """ - super(SystemData, self).__init__(**kwargs) + super().__init__(**kwargs) self.created_by = created_by self.created_by_type = created_by_type self.created_at = created_at @@ -4737,66 +4685,57 @@ def __init__( self.last_modified_at = last_modified_at -class TagsObject(msrest.serialization.Model): +class TagsObject(_serialization.Model): """Tags object for patch operations. - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] """ _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] """ - super(TagsObject, self).__init__(**kwargs) + super().__init__(**kwargs) self.tags = tags -class TimeInWeek(msrest.serialization.Model): +class TimeInWeek(_serialization.Model): """Time in a week. :ivar day: A day in a week. Known values are: "Sunday", "Monday", "Tuesday", "Wednesday", - "Thursday", "Friday", "Saturday". + "Thursday", "Friday", and "Saturday". :vartype day: str or ~azure.mgmt.containerservice.v2021_02_01.models.WeekDay :ivar hour_slots: hour slots in a day. :vartype hour_slots: list[int] """ _attribute_map = { - 'day': {'key': 'day', 'type': 'str'}, - 'hour_slots': {'key': 'hourSlots', 'type': '[int]'}, + "day": {"key": "day", "type": "str"}, + "hour_slots": {"key": "hourSlots", "type": "[int]"}, } def __init__( - self, - *, - day: Optional[Union[str, "_models.WeekDay"]] = None, - hour_slots: Optional[List[int]] = None, - **kwargs + self, *, day: Optional[Union[str, "_models.WeekDay"]] = None, hour_slots: Optional[List[int]] = None, **kwargs ): """ :keyword day: A day in a week. Known values are: "Sunday", "Monday", "Tuesday", "Wednesday", - "Thursday", "Friday", "Saturday". + "Thursday", "Friday", and "Saturday". :paramtype day: str or ~azure.mgmt.containerservice.v2021_02_01.models.WeekDay :keyword hour_slots: hour slots in a day. :paramtype hour_slots: list[int] """ - super(TimeInWeek, self).__init__(**kwargs) + super().__init__(**kwargs) self.day = day self.hour_slots = hour_slots -class TimeSpan(msrest.serialization.Model): +class TimeSpan(_serialization.Model): """The time span with start and end properties. :ivar start: The start of a time span. @@ -4806,23 +4745,17 @@ class TimeSpan(msrest.serialization.Model): """ _attribute_map = { - 'start': {'key': 'start', 'type': 'iso-8601'}, - 'end': {'key': 'end', 'type': 'iso-8601'}, + "start": {"key": "start", "type": "iso-8601"}, + "end": {"key": "end", "type": "iso-8601"}, } - def __init__( - self, - *, - start: Optional[datetime.datetime] = None, - end: Optional[datetime.datetime] = None, - **kwargs - ): + def __init__(self, *, start: Optional[datetime.datetime] = None, end: Optional[datetime.datetime] = None, **kwargs): """ :keyword start: The start of a time span. :paramtype start: ~datetime.datetime :keyword end: The end of a time span. :paramtype end: ~datetime.datetime """ - super(TimeSpan, self).__init__(**kwargs) + super().__init__(**kwargs) self.start = start self.end = end diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/models/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/models/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/models/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/models/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/operations/__init__.py index f0e265d9f2f4..f27b588ca549 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/operations/__init__.py @@ -17,14 +17,15 @@ from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'Operations', - 'ManagedClustersOperations', - 'MaintenanceConfigurationsOperations', - 'AgentPoolsOperations', - 'PrivateEndpointConnectionsOperations', - 'PrivateLinkResourcesOperations', - 'ResolvePrivateLinkServiceIdOperations', + "Operations", + "ManagedClustersOperations", + "MaintenanceConfigurationsOperations", + "AgentPoolsOperations", + "PrivateEndpointConnectionsOperations", + "PrivateLinkResourcesOperations", + "ResolvePrivateLinkServiceIdOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/operations/_agent_pools_operations.py index e04d0e8a8af4..75104479e6b1 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/operations/_agent_pools_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,288 +27,289 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - *, - json: Optional[_models.AgentPool] = None, - content: Any = None, - **kwargs: Any + _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, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + _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, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_get_upgrade_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_available_agent_pool_versions_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_upgrade_node_image_version_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_upgrade_node_image_version_request( + resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class AgentPoolsOperations: """ @@ -324,48 +330,40 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> Iterable[_models.AgentPoolListResult]: + def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> Iterable["_models.AgentPool"]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. The operation returns properties of each agent pool. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AgentPoolListResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_02_01.models.AgentPoolListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either AgentPool or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_02_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -373,16 +371,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -398,10 +391,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -411,54 +402,45 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore @distributed_trace def get( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPool: """Gets the agent pool. Gets the details of the agent pool by managed cluster and resource group. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPool, or the result of cls(response) + :return: AgentPool or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_02_01.models.AgentPool - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -466,57 +448,60 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore def _create_or_update_initial( self, resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: _models.AgentPool, + parameters: Union[_models.AgentPool, IO], **kwargs: Any ) -> _models.AgentPool: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - _json = self._serialize.body(parameters, 'AgentPool') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "AgentPool") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -524,10 +509,9 @@ def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -535,40 +519,125 @@ def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - @distributed_trace + @overload def begin_create_or_update( self, resource_group_name: str, resource_name: str, agent_pool_name: str, parameters: _models.AgentPool, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.AgentPool]: """Creates or updates an agent pool. Creates or updates an agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :param parameters: Parameters supplied to the Create or Update an agent pool operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2021_02_01.models.AgentPool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_02_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AgentPool]: + """Creates or updates an agent pool. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: Parameters supplied to the Create or Update an agent pool operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_02_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: Union[_models.AgentPool, IO], + **kwargs: Any + ) -> LROPoller[_models.AgentPool]: + """Creates or updates an agent pool. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: Parameters supplied to the Create or Update an agent pool operation. Is + either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_02_01.models.AgentPool or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -580,20 +649,17 @@ def begin_create_or_update( :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_02_01.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -602,66 +668,55 @@ def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -669,10 +724,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -682,26 +736,21 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + def begin_delete( + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> LROPoller[None]: """Deletes an agent pool. Deletes the agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -713,100 +762,86 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPoolUpgradeProfile: """Gets upgrade profile for an agent pool. Gets the details of the upgrade profile for an agent pool with a specified resource group and managed cluster name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolUpgradeProfile, or the result of cls(response) + :return: AgentPoolUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_02_01.models.AgentPoolUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -814,64 +849,56 @@ def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolUpgradeProfile', pipeline_response) + deserialized = self._deserialize("AgentPoolUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore @distributed_trace def get_available_agent_pool_versions( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported versions for the specified agent pool. Gets a list of supported versions for the specified agent pool. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolAvailableVersions, or the result of cls(response) + :return: AgentPoolAvailableVersions or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_02_01.models.AgentPoolAvailableVersions - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolAvailableVersions] - request = build_get_available_agent_pool_versions_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_available_agent_pool_versions.metadata['url'], + template_url=self.get_available_agent_pool_versions.metadata["url"], headers=_headers, params=_params, ) @@ -879,52 +906,43 @@ def get_available_agent_pool_versions( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolAvailableVersions', pipeline_response) + deserialized = self._deserialize("AgentPoolAvailableVersions", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_available_agent_pool_versions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore - + get_available_agent_pool_versions.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore def _upgrade_node_image_version_initial( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> Optional[_models.AgentPool]: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.AgentPool]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.AgentPool]] - - request = build_upgrade_node_image_version_request_initial( - subscription_id=self._config.subscription_id, + request = build_upgrade_node_image_version_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._upgrade_node_image_version_initial.metadata['url'], + template_url=self._upgrade_node_image_version_initial.metadata["url"], headers=_headers, params=_params, ) @@ -932,10 +950,9 @@ def _upgrade_node_image_version_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -944,33 +961,28 @@ def _upgrade_node_image_version_initial( deserialized = None if response.status_code == 202: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _upgrade_node_image_version_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore - + _upgrade_node_image_version_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore @distributed_trace def begin_upgrade_node_image_version( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any - ) -> LROPoller[_models.AgentPool]: + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any + ) -> LROPoller[None]: """Upgrade node image version of an agent pool to the latest. Upgrade node image version of an agent pool to the latest. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -983,55 +995,48 @@ def begin_upgrade_node_image_version( :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_02_01.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._upgrade_node_image_version_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_upgrade_node_image_version.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore + begin_upgrade_node_image_version.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/operations/_maintenance_configurations_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/operations/_maintenance_configurations_operations.py index 88558b929767..c749ecd77009 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/operations/_maintenance_configurations_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/operations/_maintenance_configurations_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,173 +25,173 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +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_managed_cluster_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, config_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 = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "configName": _SERIALIZER.url("config_name", config_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "configName": _SERIALIZER.url("config_name", config_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - config_name: str, - *, - json: Optional[_models.MaintenanceConfiguration] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, resource_name: str, config_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 = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "configName": _SERIALIZER.url("config_name", config_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "configName": _SERIALIZER.url("config_name", config_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, config_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 = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "configName": _SERIALIZER.url("config_name", config_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "configName": _SERIALIZER.url("config_name", config_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class MaintenanceConfigurationsOperations: """ @@ -207,49 +212,44 @@ def __init__(self, *args, **kwargs): 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_managed_cluster( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> Iterable[_models.MaintenanceConfigurationListResult]: + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> Iterable["_models.MaintenanceConfiguration"]: """Gets a list of maintenance configurations in the specified managed cluster. Gets a list of maintenance configurations in the specified managed cluster. The operation returns properties of each maintenance configuration. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either MaintenanceConfigurationListResult or the result - of cls(response) + :return: An iterator like instance of either MaintenanceConfiguration or the result of + cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_02_01.models.MaintenanceConfigurationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_02_01.models.MaintenanceConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfigurationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfigurationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_managed_cluster_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_managed_cluster.metadata['url'], + template_url=self.list_by_managed_cluster.metadata["url"], headers=_headers, params=_params, ) @@ -257,16 +257,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_managed_cluster_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -282,10 +277,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -295,54 +288,45 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_managed_cluster.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations"} # type: ignore + list_by_managed_cluster.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations"} # type: ignore @distributed_trace def get( - self, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, config_name: str, **kwargs: Any ) -> _models.MaintenanceConfiguration: """Gets the maintenance configuration. Gets the details of maintenance configurations by managed cluster and resource group. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: MaintenanceConfiguration, or the result of cls(response) + :return: MaintenanceConfiguration or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_02_01.models.MaintenanceConfiguration - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfiguration] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -350,76 +334,149 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) + deserialized = self._deserialize("MaintenanceConfiguration", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - - @distributed_trace + @overload def create_or_update( self, resource_group_name: str, resource_name: str, config_name: str, parameters: _models.MaintenanceConfiguration, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.MaintenanceConfiguration: """Creates or updates a maintenance configurations. Creates or updates a maintenance configuration in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str :param parameters: Parameters supplied to the Create or Update a default maintenance - configuration. + configuration. Required. :type parameters: ~azure.mgmt.containerservice.v2021_02_01.models.MaintenanceConfiguration + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: MaintenanceConfiguration, or the result of cls(response) + :return: MaintenanceConfiguration or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_02_01.models.MaintenanceConfiguration - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configurations. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: Parameters supplied to the Create or Update a default maintenance + configuration. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_02_01.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: Union[_models.MaintenanceConfiguration, IO], + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configurations. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: Parameters supplied to the Create or Update a default maintenance + configuration. Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_02_01.models.MaintenanceConfiguration or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_02_01.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfiguration] - _json = self._serialize.body(parameters, 'MaintenanceConfiguration') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "MaintenanceConfiguration") request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) @@ -427,68 +484,59 @@ def create_or_update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) + deserialized = self._deserialize("MaintenanceConfiguration", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore @distributed_trace def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, config_name: str, **kwargs: Any ) -> None: """Deletes a maintenance configuration. Deletes the maintenance configuration in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) @@ -496,10 +544,9 @@ def delete( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -509,5 +556,4 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/operations/_managed_clusters_operations.py index 7d7efc8074af..69a52df4a524 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/operations/_managed_clusters_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,631 +27,612 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters") + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters" + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_resource_group_request( - subscription_id: str, - resource_group_name: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters", + ) # 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', min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_upgrade_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_access_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, role_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 = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "roleName": _SERIALIZER.url("role_name", role_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "roleName": _SERIALIZER.url("role_name", role_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_admin_credentials_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_user_credentials_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_monitoring_user_credentials_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: + +def build_get_request(resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedCluster] = None, - content: Any = None, - **kwargs: Any + +def build_create_or_update_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_update_tags_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.TagsObject] = None, - content: Any = None, - **kwargs: Any + +def build_update_tags_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any +def build_delete_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_reset_service_principal_profile_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedClusterServicePrincipalProfile] = None, - content: Any = None, - **kwargs: Any +def build_reset_service_principal_profile_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_reset_aad_profile_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedClusterAADProfile] = None, - content: Any = None, - **kwargs: Any +def build_reset_aad_profile_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_rotate_cluster_certificates_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any +def build_rotate_cluster_certificates_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_stop_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + +def build_stop_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_start_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + +def build_start_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + class ManagedClustersOperations: # pylint: disable=too-many-public-methods """ @@ -667,41 +653,35 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.ManagedClusterListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.ManagedCluster"]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. The operation returns properties of each managed cluster. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_02_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_02_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -709,14 +689,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -732,10 +709,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -745,50 +720,42 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> Iterable[_models.ManagedClusterListResult]: + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.ManagedCluster"]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. The operation returns properties of each managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_02_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_02_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -796,15 +763,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -820,10 +783,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -833,51 +794,43 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.ManagedClusterUpgradeProfile: """Gets upgrade profile for a managed cluster. Gets the details of the upgrade profile for a managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterUpgradeProfile, or the result of cls(response) + :return: ManagedClusterUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_02_01.models.ManagedClusterUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -885,33 +838,27 @@ def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterUpgradeProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore @distributed_trace def get_access_profile( - self, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, role_name: str, **kwargs: Any ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. @@ -922,36 +869,33 @@ def get_access_profile( `ListClusterAdminCredentials `_ . - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param role_name: The name of the role for managed cluster accessProfile resource. + :param role_name: The name of the role for managed cluster accessProfile resource. Required. :type role_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterAccessProfile, or the result of cls(response) + :return: ManagedClusterAccessProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_02_01.models.ManagedClusterAccessProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterAccessProfile] - request = build_get_access_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, role_name=role_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_access_profile.metadata['url'], + template_url=self.get_access_profile.metadata["url"], headers=_headers, params=_params, ) @@ -959,64 +903,56 @@ def get_access_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterAccessProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterAccessProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_access_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore - + get_access_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore @distributed_trace def list_cluster_admin_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster admin credential of a managed cluster. Gets cluster admin credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_02_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_admin_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_admin_credentials.metadata['url'], + template_url=self.list_cluster_admin_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -1024,64 +960,56 @@ def list_cluster_admin_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_admin_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore - + list_cluster_admin_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore @distributed_trace def list_cluster_user_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster user credential of a managed cluster. Gets cluster user credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_02_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_user_credentials.metadata['url'], + template_url=self.list_cluster_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -1089,65 +1017,57 @@ def list_cluster_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore - + list_cluster_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore @distributed_trace def list_cluster_monitoring_user_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster monitoring user credential of a managed cluster. Gets cluster monitoring user credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_02_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_monitoring_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + template_url=self.list_cluster_monitoring_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -1155,64 +1075,54 @@ def list_cluster_monitoring_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_monitoring_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore - + list_cluster_monitoring_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore @distributed_trace - def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.ManagedCluster: + def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.ManagedCluster: """Gets a managed cluster. Gets the details of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedCluster, or the result of cls(response) + :return: ManagedCluster or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_02_01.models.ManagedCluster - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -1220,55 +1130,54 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _create_or_update_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.ManagedCluster, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'ManagedCluster') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedCluster") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1276,10 +1185,9 @@ def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -1287,25 +1195,26 @@ def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - @distributed_trace + @overload def begin_create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedCluster, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. @@ -1313,12 +1222,90 @@ def begin_create_or_update( Creates or updates a managed cluster with the specified configuration for agents and Kubernetes version. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2021_02_01.models.ManagedCluster + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_02_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster with the specified configuration for agents and Kubernetes + version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_02_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster with the specified configuration for agents and Kubernetes + version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. Is + either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_02_01.models.ManagedCluster or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1331,20 +1318,17 @@ def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_02_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -1352,69 +1336,66 @@ def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _update_tags_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.TagsObject, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request_initial( - subscription_id=self._config.subscription_id, + request = build_update_tags_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_tags_initial.metadata['url'], + content=_content, + template_url=self._update_tags_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1422,44 +1403,118 @@ def _update_tags_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_tags_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + _update_tags_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - - @distributed_trace + @overload def begin_update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates a managed cluster with the specified tags. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2021_02_01.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_02_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates a managed cluster with the specified tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_02_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates a managed cluster with the specified tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_02_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1472,20 +1527,17 @@ def begin_update_tags( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_02_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, @@ -1493,64 +1545,54 @@ def begin_update_tags( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1558,10 +1600,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1571,23 +1612,17 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> LROPoller[None]: + def begin_delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> LROPoller[None]: """Deletes a managed cluster. Deletes the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1599,85 +1634,83 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterServicePrincipalProfile, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterServicePrincipalProfile") - request = build_reset_service_principal_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_service_principal_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_service_principal_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_service_principal_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1685,10 +1718,9 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1698,29 +1730,33 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re if cls: return cls(pipeline_response, None, {}) - _reset_service_principal_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + _reset_service_principal_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore - - @distributed_trace - def begin_reset_service_principal_profile( # pylint: disable=inconsistent-return-statements + @overload + def begin_reset_service_principal_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterServicePrincipalProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: """Reset Service Principal Profile of a managed cluster. Update the service principal Profile for a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a - Managed Cluster. + Managed Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2021_02_01.models.ManagedClusterServicePrincipalProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1731,20 +1767,90 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reset Service Principal Profile of a managed cluster. + + Update the service principal Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a + Managed Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Reset Service Principal Profile of a managed cluster. + + Update the service principal Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a + Managed Cluster. Is either a model type or a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2021_02_01.models.ManagedClusterServicePrincipalProfile or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1752,67 +1858,68 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_service_principal_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + begin_reset_service_principal_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterAADProfile, + parameters: Union[_models.ManagedClusterAADProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterAADProfile") - request = build_reset_aad_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_aad_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_aad_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_aad_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1820,10 +1927,9 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1833,28 +1939,105 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement if cls: return cls(pipeline_response, None, {}) - _reset_aad_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - + _reset_aad_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - @distributed_trace - def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements + @overload + def begin_reset_aad_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterAADProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: """Reset AAD Profile of a managed cluster. Update the AAD Profile for a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed - Cluster. + Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2021_02_01.models.ManagedClusterAADProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reset AAD Profile of a managed cluster. + + Update the AAD Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed + Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterAADProfile, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Reset AAD Profile of a managed cluster. + + Update the AAD Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed + Cluster. Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_02_01.models.ManagedClusterAADProfile or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1865,20 +2048,17 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1886,62 +2066,52 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_aad_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + begin_reset_aad_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_rotate_cluster_certificates_request_initial( - subscription_id=self._config.subscription_id, + request = build_rotate_cluster_certificates_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._rotate_cluster_certificates_initial.metadata['url'], + template_url=self._rotate_cluster_certificates_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1949,10 +2119,9 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1962,23 +2131,19 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return if cls: return cls(pipeline_response, None, {}) - _rotate_cluster_certificates_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore - + _rotate_cluster_certificates_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore @distributed_trace - def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + def begin_rotate_cluster_certificates( + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> LROPoller[None]: """Rotate certificates of a managed cluster. Rotate certificates of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1990,80 +2155,67 @@ def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-st Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._rotate_cluster_certificates_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_rotate_cluster_certificates.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore + begin_rotate_cluster_certificates.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore def _stop_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_stop_request_initial( - subscription_id=self._config.subscription_id, + request = build_stop_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._stop_initial.metadata['url'], + template_url=self._stop_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2071,10 +2223,9 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -2084,23 +2235,17 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore - + _stop_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore @distributed_trace - def begin_stop( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> LROPoller[None]: + def begin_stop(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> LROPoller[None]: """Stop Managed Cluster. Stops a Running Managed Cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -2112,80 +2257,67 @@ def begin_stop( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._stop_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore + begin_stop.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore def _start_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_start_request_initial( - subscription_id=self._config.subscription_id, + request = build_start_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._start_initial.metadata['url'], + template_url=self._start_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2193,10 +2325,9 @@ def _start_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -2206,23 +2337,17 @@ def _start_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore - + _start_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore @distributed_trace - def begin_start( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> LROPoller[None]: + def begin_start(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> LROPoller[None]: """Start Managed Cluster. Starts a Stopped Managed Cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -2234,52 +2359,45 @@ def begin_start( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._start_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore + begin_start.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/operations/_operations.py index 0efd52cb8701..50d6e9b469f7 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/operations/_operations.py @@ -7,10 +7,15 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,38 +25,34 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - **kwargs: Any -) -> HttpRequest: + +def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.ContainerService/operations") # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class Operations: """ @@ -72,36 +73,31 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.OperationListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.OperationValue"]: """Gets a list of compute operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationListResult or the result of cls(response) + :return: An iterator like instance of either OperationValue or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_02_01.models.OperationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_02_01.models.OperationValue] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -109,13 +105,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -131,10 +125,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -144,8 +136,6 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.ContainerService/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ContainerService/operations"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/operations/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/operations/_private_endpoint_connections_operations.py index a3da829e02c7..d1d8585a795c 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/operations/_private_endpoint_connections_operations.py @@ -6,11 +6,15 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod @@ -21,173 +25,191 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - subscription_id: str, resource_group_name: str, resource_name: str, private_endpoint_connection_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 = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_update_request( - subscription_id: str, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, - *, - json: Optional[_models.PrivateEndpointConnection] = None, - content: Any = None, + subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request_initial( - subscription_id: str, +def build_delete_request( resource_group_name: str, resource_name: str, private_endpoint_connection_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 = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class PrivateEndpointConnectionsOperations: """ @@ -208,46 +230,39 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnectionListResult: """Gets a list of private endpoint connections in the specified managed cluster. Gets a list of private endpoint connections in the specified managed cluster. The operation returns properties of each private endpoint connection. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnectionListResult, or the result of cls(response) + :return: PrivateEndpointConnectionListResult or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_02_01.models.PrivateEndpointConnectionListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnectionListResult] - request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -255,68 +270,59 @@ def list( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore - + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore @distributed_trace def get( - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnection: """Gets the private endpoint connection. Gets the details of the private endpoint connection by managed cluster and resource group. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_02_01.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -324,75 +330,149 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - @distributed_trace + @overload def update( self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, parameters: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateEndpointConnection: """Updates a private endpoint connection. Updates a private endpoint connection in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :param parameters: Parameters supplied to the Update a private endpoint connection operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2021_02_01.models.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_02_01.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: Parameters supplied to the Update a private endpoint connection operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_02_01.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @distributed_trace + def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: Union[_models.PrivateEndpointConnection, IO], + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: Parameters supplied to the Update a private endpoint connection operation. + Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_02_01.models.PrivateEndpointConnection or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_02_01.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - _json = self._serialize.body(parameters, 'PrivateEndpointConnection') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateEndpointConnection") request = build_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update.metadata['url'], + content=_content, + template_url=self.update.metadata["url"], headers=_headers, params=_params, ) @@ -400,52 +480,43 @@ def update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -453,10 +524,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -466,26 +536,21 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + def begin_delete( + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> LROPoller[None]: """Deletes a private endpoint connection. Deletes the private endpoint connection in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -497,53 +562,46 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/operations/_private_link_resources_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/operations/_private_link_resources_operations.py index 5ed0f7be72c8..86bedfeae09e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/operations/_private_link_resources_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/operations/_private_link_resources_operations.py @@ -8,9 +8,13 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -19,48 +23,53 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class PrivateLinkResourcesOperations: """ @@ -81,46 +90,39 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.PrivateLinkResourcesListResult: """Gets a list of private link resources in the specified managed cluster. Gets a list of private link resources in the specified managed cluster. The operation returns properties of each private link resource. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResourcesListResult, or the result of cls(response) + :return: PrivateLinkResourcesListResult or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_02_01.models.PrivateLinkResourcesListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResourcesListResult] - request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -128,22 +130,20 @@ def list( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResourcesListResult', pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources"} # type: ignore - + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/operations/_resolve_private_link_service_id_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/operations/_resolve_private_link_service_id_operations.py index e7afe109326e..68f237d7fc5e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/operations/_resolve_private_link_service_id_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/operations/_resolve_private_link_service_id_operations.py @@ -6,11 +6,15 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -19,56 +23,56 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_post_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.PrivateLinkResource] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + class ResolvePrivateLinkServiceIdOperations: """ @@ -89,53 +93,120 @@ def __init__(self, *args, **kwargs): 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 + @overload def post( self, resource_group_name: str, resource_name: str, parameters: _models.PrivateLinkResource, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateLinkResource: """Gets the private link service ID for the specified managed cluster. Gets the private link service ID the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters (name, groupId) supplied in order to resolve a private link - service ID. + service ID. Required. :type parameters: ~azure.mgmt.containerservice.v2021_02_01.models.PrivateLinkResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResource, or the result of cls(response) + :return: PrivateLinkResource or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_02_01.models.PrivateLinkResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + def post( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters (name, groupId) supplied in order to resolve a private link + service ID. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_02_01.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def post( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.PrivateLinkResource, IO], + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters (name, groupId) supplied in order to resolve a private link + service ID. Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_02_01.models.PrivateLinkResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_02_01.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResource] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResource] - _json = self._serialize.body(parameters, 'PrivateLinkResource') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateLinkResource") request = build_post_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.post.metadata['url'], + content=_content, + template_url=self.post.metadata["url"], headers=_headers, params=_params, ) @@ -143,22 +214,20 @@ def post( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResource', pipeline_response) + deserialized = self._deserialize("PrivateLinkResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - post.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId"} # type: ignore - + post.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/__init__.py index 37a5f9e02e6f..a8716d29afe8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/__init__.py @@ -14,7 +14,8 @@ except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['ContainerServiceClient'] + +__all__ = ["ContainerServiceClient"] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/_configuration.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/_configuration.py index ac9fbb5bffd2..94f16641fee6 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/_configuration.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/_configuration.py @@ -18,30 +18,26 @@ VERSION = "unknown" + class ContainerServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ContainerServiceClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2021-03-01". 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: + def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ContainerServiceClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2021-03-01") # type: str + api_version = kwargs.pop("api_version", "2021-03-01") # type: str if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -51,23 +47,24 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-containerservice/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-containerservice/{}".format(VERSION)) self._configure(**kwargs) def _configure( - self, - **kwargs # type: Any + self, **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/_container_service_client.py index 8de79f417824..5ba170b4df1f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/_container_service_client.py @@ -9,20 +9,28 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from . import models +from .._serialization import Deserializer, Serializer from ._configuration import ContainerServiceClientConfiguration -from .operations import AgentPoolsOperations, MaintenanceConfigurationsOperations, ManagedClustersOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, ResolvePrivateLinkServiceIdOperations +from .operations import ( + AgentPoolsOperations, + MaintenanceConfigurationsOperations, + ManagedClustersOperations, + Operations, + PrivateEndpointConnectionsOperations, + PrivateLinkResourcesOperations, + ResolvePrivateLinkServiceIdOperations, +) if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class ContainerServiceClient: # pylint: disable=too-many-instance-attributes + +class ContainerServiceClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """The Container Service Client. :ivar operations: Operations operations @@ -44,10 +52,10 @@ class ContainerServiceClient: # pylint: disable=too-many-instance-attributes :ivar resolve_private_link_service_id: ResolvePrivateLinkServiceIdOperations operations :vartype resolve_private_link_service_id: azure.mgmt.containerservice.v2021_03_01.operations.ResolvePrivateLinkServiceIdOperations - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -65,25 +73,23 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = ContainerServiceClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = ContainerServiceClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize - ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.managed_clusters = ManagedClustersOperations( self._client, self._config, self._serialize, self._deserialize ) self.maintenance_configurations = MaintenanceConfigurationsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.agent_pools = AgentPoolsOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) self.private_endpoint_connections = PrivateEndpointConnectionsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -94,12 +100,7 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) - - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> HttpResponse: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -108,7 +109,7 @@ def _send_request( >>> response = client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/_metadata.json b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/_metadata.json index e9c012f31a03..c797688d9c68 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/_metadata.json +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/_metadata.json @@ -10,20 +10,20 @@ "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { "credential": { - "signature": "credential, # type: \"TokenCredential\"", - "description": "Credential needed for the client to connect to Azure.", + "signature": "credential: \"TokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true }, "subscription_id": { - "signature": "subscription_id, # type: str", - "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "signature": "subscription_id: str,", + "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.", "docstring_type": "str", "required": true } @@ -31,13 +31,13 @@ "async": { "credential": { "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure.", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { "signature": "subscription_id: str,", - "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.", "docstring_type": "str", "required": true } @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=\"https://management.azure.com\", # type: str", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/_patch.py index 74e48ecd07cf..f99e77fef986 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/_patch.py @@ -28,4 +28,4 @@ # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + pass diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/_vendor.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/_vendor.py index 138f663c53a4..9aad73fc743e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/_vendor.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/_vendor.py @@ -7,6 +7,7 @@ from azure.core.pipeline.transport import HttpRequest + def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) @@ -14,6 +15,7 @@ def _convert_request(request, files=None): request.set_formdata_body(files) return request + def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -21,7 +23,5 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [ - c for c in formatted_components if "{}".format(key.args[0]) not in c - ] + components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/aio/__init__.py index 37a5f9e02e6f..a8716d29afe8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/aio/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/aio/__init__.py @@ -14,7 +14,8 @@ except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['ContainerServiceClient'] + +__all__ = ["ContainerServiceClient"] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/aio/_configuration.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/aio/_configuration.py index 607bce2568bf..1f429d6578c0 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/aio/_configuration.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/aio/_configuration.py @@ -18,30 +18,26 @@ VERSION = "unknown" + class ContainerServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ContainerServiceClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2021-03-01". 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: + def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ContainerServiceClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2021-03-01") # type: str + api_version = kwargs.pop("api_version", "2021-03-01") # type: str if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -51,22 +47,21 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-containerservice/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-containerservice/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, - **kwargs: Any - ) -> None: - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/aio/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/aio/_container_service_client.py index 165e0e5b603f..8b81c448ece2 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/aio/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/aio/_container_service_client.py @@ -9,20 +9,28 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from .. import models +from ..._serialization import Deserializer, Serializer from ._configuration import ContainerServiceClientConfiguration -from .operations import AgentPoolsOperations, MaintenanceConfigurationsOperations, ManagedClustersOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, ResolvePrivateLinkServiceIdOperations +from .operations import ( + AgentPoolsOperations, + MaintenanceConfigurationsOperations, + ManagedClustersOperations, + Operations, + PrivateEndpointConnectionsOperations, + PrivateLinkResourcesOperations, + ResolvePrivateLinkServiceIdOperations, +) if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class ContainerServiceClient: # pylint: disable=too-many-instance-attributes + +class ContainerServiceClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """The Container Service Client. :ivar operations: Operations operations @@ -45,10 +53,10 @@ class ContainerServiceClient: # pylint: disable=too-many-instance-attributes :ivar resolve_private_link_service_id: ResolvePrivateLinkServiceIdOperations operations :vartype resolve_private_link_service_id: azure.mgmt.containerservice.v2021_03_01.aio.operations.ResolvePrivateLinkServiceIdOperations - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -66,25 +74,23 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = ContainerServiceClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = ContainerServiceClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize - ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.managed_clusters = ManagedClustersOperations( self._client, self._config, self._serialize, self._deserialize ) self.maintenance_configurations = MaintenanceConfigurationsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.agent_pools = AgentPoolsOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) self.private_endpoint_connections = PrivateEndpointConnectionsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -95,12 +101,7 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) - - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -109,7 +110,7 @@ def _send_request( >>> response = await client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/aio/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/aio/_patch.py index 74e48ecd07cf..f99e77fef986 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/aio/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/aio/_patch.py @@ -28,4 +28,4 @@ # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + pass diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/aio/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/aio/operations/__init__.py index f0e265d9f2f4..f27b588ca549 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/aio/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/aio/operations/__init__.py @@ -17,14 +17,15 @@ from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'Operations', - 'ManagedClustersOperations', - 'MaintenanceConfigurationsOperations', - 'AgentPoolsOperations', - 'PrivateEndpointConnectionsOperations', - 'PrivateLinkResourcesOperations', - 'ResolvePrivateLinkServiceIdOperations', + "Operations", + "ManagedClustersOperations", + "MaintenanceConfigurationsOperations", + "AgentPoolsOperations", + "PrivateEndpointConnectionsOperations", + "PrivateLinkResourcesOperations", + "ResolvePrivateLinkServiceIdOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/aio/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/aio/operations/_agent_pools_operations.py index 7ed3c2082315..8706fc27e7ec 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/aio/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/aio/operations/_agent_pools_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +29,20 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._agent_pools_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_available_agent_pool_versions_request, build_get_request, build_get_upgrade_profile_request, build_list_request, build_upgrade_node_image_version_request_initial -T = TypeVar('T') +from ...operations._agent_pools_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_available_agent_pool_versions_request, + build_get_request, + build_get_upgrade_profile_request, + build_list_request, + build_upgrade_node_image_version_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class AgentPoolsOperations: """ .. warning:: @@ -45,48 +62,41 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.AgentPoolListResult]: + def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncIterable["_models.AgentPool"]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. The operation returns properties of each agent pool. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AgentPoolListResult or the result of cls(response) + :return: An iterator like instance of either AgentPool or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_03_01.models.AgentPoolListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_03_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -94,16 +104,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -119,10 +124,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -132,54 +135,45 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore @distributed_trace_async async def get( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPool: """Gets the agent pool. Gets the details of the agent pool by managed cluster and resource group. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPool, or the result of cls(response) + :return: AgentPool or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_03_01.models.AgentPool - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -187,57 +181,60 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore async def _create_or_update_initial( self, resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: _models.AgentPool, + parameters: Union[_models.AgentPool, IO], **kwargs: Any ) -> _models.AgentPool: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - _json = self._serialize.body(parameters, 'AgentPool') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "AgentPool") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -245,10 +242,9 @@ async def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -256,40 +252,127 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - @distributed_trace_async + @overload async def begin_create_or_update( self, resource_group_name: str, resource_name: str, agent_pool_name: str, parameters: _models.AgentPool, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.AgentPool]: """Creates or updates an agent pool. Creates or updates an agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :param parameters: Parameters supplied to the Create or Update an agent pool operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2021_03_01.models.AgentPool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AgentPool or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_03_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AgentPool]: + """Creates or updates an agent pool. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: Parameters supplied to the Create or Update an agent pool operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AgentPool or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_03_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: Union[_models.AgentPool, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.AgentPool]: + """Creates or updates an agent pool. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: Parameters supplied to the Create or Update an agent pool operation. Is + either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_03_01.models.AgentPool or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -302,20 +385,17 @@ async def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_03_01.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -324,66 +404,55 @@ async def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -391,10 +460,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -404,26 +472,21 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + async def begin_delete( + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes an agent pool. Deletes the agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -435,100 +498,86 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace_async async def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPoolUpgradeProfile: """Gets upgrade profile for an agent pool. Gets the details of the upgrade profile for an agent pool with a specified resource group and managed cluster name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolUpgradeProfile, or the result of cls(response) + :return: AgentPoolUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_03_01.models.AgentPoolUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -536,64 +585,56 @@ async def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolUpgradeProfile', pipeline_response) + deserialized = self._deserialize("AgentPoolUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore @distributed_trace_async async def get_available_agent_pool_versions( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported versions for the specified agent pool. Gets a list of supported versions for the specified agent pool. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolAvailableVersions, or the result of cls(response) + :return: AgentPoolAvailableVersions or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_03_01.models.AgentPoolAvailableVersions - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolAvailableVersions] - request = build_get_available_agent_pool_versions_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_available_agent_pool_versions.metadata['url'], + template_url=self.get_available_agent_pool_versions.metadata["url"], headers=_headers, params=_params, ) @@ -601,52 +642,43 @@ async def get_available_agent_pool_versions( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolAvailableVersions', pipeline_response) + deserialized = self._deserialize("AgentPoolAvailableVersions", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_available_agent_pool_versions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore - + get_available_agent_pool_versions.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore async def _upgrade_node_image_version_initial( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> Optional[_models.AgentPool]: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.AgentPool]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.AgentPool]] - - request = build_upgrade_node_image_version_request_initial( - subscription_id=self._config.subscription_id, + request = build_upgrade_node_image_version_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._upgrade_node_image_version_initial.metadata['url'], + template_url=self._upgrade_node_image_version_initial.metadata["url"], headers=_headers, params=_params, ) @@ -654,10 +686,9 @@ async def _upgrade_node_image_version_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -666,33 +697,28 @@ async def _upgrade_node_image_version_initial( deserialized = None if response.status_code == 202: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _upgrade_node_image_version_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore - + _upgrade_node_image_version_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore @distributed_trace_async async def begin_upgrade_node_image_version( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any - ) -> AsyncLROPoller[_models.AgentPool]: + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: """Upgrade node image version of an agent pool to the latest. Upgrade node image version of an agent pool to the latest. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -706,55 +732,48 @@ async def begin_upgrade_node_image_version( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_03_01.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._upgrade_node_image_version_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_upgrade_node_image_version.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore + begin_upgrade_node_image_version.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/aio/operations/_maintenance_configurations_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/aio/operations/_maintenance_configurations_operations.py index 4cbfba2d1ac0..5980e70f30cb 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/aio/operations/_maintenance_configurations_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/aio/operations/_maintenance_configurations_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,10 +27,17 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._maintenance_configurations_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_managed_cluster_request -T = TypeVar('T') +from ...operations._maintenance_configurations_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_managed_cluster_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class MaintenanceConfigurationsOperations: """ .. warning:: @@ -43,49 +57,44 @@ def __init__(self, *args, **kwargs) -> None: 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_managed_cluster( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.MaintenanceConfigurationListResult]: + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> AsyncIterable["_models.MaintenanceConfiguration"]: """Gets a list of maintenance configurations in the specified managed cluster. Gets a list of maintenance configurations in the specified managed cluster. The operation returns properties of each maintenance configuration. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either MaintenanceConfigurationListResult or the result - of cls(response) + :return: An iterator like instance of either MaintenanceConfiguration or the result of + cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_03_01.models.MaintenanceConfigurationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_03_01.models.MaintenanceConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfigurationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfigurationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_managed_cluster_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_managed_cluster.metadata['url'], + template_url=self.list_by_managed_cluster.metadata["url"], headers=_headers, params=_params, ) @@ -93,16 +102,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_managed_cluster_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -118,10 +122,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -131,54 +133,45 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_managed_cluster.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations"} # type: ignore + list_by_managed_cluster.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations"} # type: ignore @distributed_trace_async async def get( - self, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, config_name: str, **kwargs: Any ) -> _models.MaintenanceConfiguration: """Gets the maintenance configuration. Gets the details of maintenance configurations by managed cluster and resource group. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: MaintenanceConfiguration, or the result of cls(response) + :return: MaintenanceConfiguration or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_03_01.models.MaintenanceConfiguration - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfiguration] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -186,76 +179,149 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) + deserialized = self._deserialize("MaintenanceConfiguration", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - @distributed_trace_async + @overload async def create_or_update( self, resource_group_name: str, resource_name: str, config_name: str, parameters: _models.MaintenanceConfiguration, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.MaintenanceConfiguration: """Creates or updates a maintenance configurations. Creates or updates a maintenance configuration in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str :param parameters: Parameters supplied to the Create or Update a default maintenance - configuration. + configuration. Required. :type parameters: ~azure.mgmt.containerservice.v2021_03_01.models.MaintenanceConfiguration + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: MaintenanceConfiguration, or the result of cls(response) + :return: MaintenanceConfiguration or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_03_01.models.MaintenanceConfiguration - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configurations. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: Parameters supplied to the Create or Update a default maintenance + configuration. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_03_01.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: Union[_models.MaintenanceConfiguration, IO], + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configurations. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: Parameters supplied to the Create or Update a default maintenance + configuration. Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_03_01.models.MaintenanceConfiguration or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_03_01.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfiguration] - _json = self._serialize.body(parameters, 'MaintenanceConfiguration') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "MaintenanceConfiguration") request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) @@ -263,68 +329,59 @@ async def create_or_update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) + deserialized = self._deserialize("MaintenanceConfiguration", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, config_name: str, **kwargs: Any ) -> None: """Deletes a maintenance configuration. Deletes the maintenance configuration in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) @@ -332,10 +389,9 @@ async def delete( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -345,5 +401,4 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/aio/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/aio/operations/_managed_clusters_operations.py index b118de1e5908..a84584791ca0 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/aio/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/aio/operations/_managed_clusters_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +29,32 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._managed_clusters_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_access_profile_request, build_get_command_result_request, build_get_os_options_request, build_get_request, build_get_upgrade_profile_request, build_list_by_resource_group_request, build_list_cluster_admin_credentials_request, build_list_cluster_monitoring_user_credentials_request, build_list_cluster_user_credentials_request, build_list_request, build_reset_aad_profile_request_initial, build_reset_service_principal_profile_request_initial, build_rotate_cluster_certificates_request_initial, build_run_command_request_initial, build_start_request_initial, build_stop_request_initial, build_update_tags_request_initial -T = TypeVar('T') +from ...operations._managed_clusters_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_access_profile_request, + build_get_command_result_request, + build_get_os_options_request, + build_get_request, + build_get_upgrade_profile_request, + build_list_by_resource_group_request, + build_list_cluster_admin_credentials_request, + build_list_cluster_monitoring_user_credentials_request, + build_list_cluster_user_credentials_request, + build_list_request, + build_reset_aad_profile_request, + build_reset_service_principal_profile_request, + build_rotate_cluster_certificates_request, + build_run_command_request, + build_start_request, + build_stop_request, + build_update_tags_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class ManagedClustersOperations: # pylint: disable=too-many-public-methods """ .. warning:: @@ -45,46 +74,39 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async async def get_os_options( - self, - location: str, - resource_type: Optional[str] = None, - **kwargs: Any + self, location: str, resource_type: Optional[str] = None, **kwargs: Any ) -> _models.OSOptionProfile: """Gets supported OS options in the specified subscription. Gets supported OS options in the specified subscription. - :param location: The name of a supported Azure region. + :param location: The name of a supported Azure region. Required. :type location: str :param resource_type: resource type for which the OS options needs to be returned. Default value is None. :type resource_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: OSOptionProfile, or the result of cls(response) + :return: OSOptionProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_03_01.models.OSOptionProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OSOptionProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OSOptionProfile] - request = build_get_os_options_request( - subscription_id=self._config.subscription_id, location=location, - api_version=api_version, + subscription_id=self._config.subscription_id, resource_type=resource_type, - template_url=self.get_os_options.metadata['url'], + api_version=api_version, + template_url=self.get_os_options.metadata["url"], headers=_headers, params=_params, ) @@ -92,60 +114,53 @@ async def get_os_options( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('OSOptionProfile', pipeline_response) + deserialized = self._deserialize("OSOptionProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_os_options.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default"} # type: ignore - + get_os_options.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default"} # type: ignore @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.ManagedClusterListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.ManagedCluster"]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. The operation returns properties of each managed cluster. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_03_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_03_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -153,14 +168,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -176,10 +188,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -189,50 +199,44 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.ManagedClusterListResult]: + self, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ManagedCluster"]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. The operation returns properties of each managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_03_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_03_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -240,15 +244,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -264,10 +264,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -277,51 +275,43 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace_async async def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.ManagedClusterUpgradeProfile: """Gets upgrade profile for a managed cluster. Gets the details of the upgrade profile for a managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterUpgradeProfile, or the result of cls(response) + :return: ManagedClusterUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_03_01.models.ManagedClusterUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -329,33 +319,27 @@ async def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterUpgradeProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore @distributed_trace_async async def get_access_profile( - self, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, role_name: str, **kwargs: Any ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. @@ -366,36 +350,33 @@ async def get_access_profile( `ListClusterAdminCredentials `_ . - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param role_name: The name of the role for managed cluster accessProfile resource. + :param role_name: The name of the role for managed cluster accessProfile resource. Required. :type role_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterAccessProfile, or the result of cls(response) + :return: ManagedClusterAccessProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_03_01.models.ManagedClusterAccessProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterAccessProfile] - request = build_get_access_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, role_name=role_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_access_profile.metadata['url'], + template_url=self.get_access_profile.metadata["url"], headers=_headers, params=_params, ) @@ -403,64 +384,56 @@ async def get_access_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterAccessProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterAccessProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_access_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore - + get_access_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore @distributed_trace_async async def list_cluster_admin_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster admin credential of a managed cluster. Gets cluster admin credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_03_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_admin_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_admin_credentials.metadata['url'], + template_url=self.list_cluster_admin_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -468,64 +441,56 @@ async def list_cluster_admin_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_admin_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore - + list_cluster_admin_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore @distributed_trace_async async def list_cluster_user_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster user credential of a managed cluster. Gets cluster user credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_03_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_user_credentials.metadata['url'], + template_url=self.list_cluster_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -533,65 +498,57 @@ async def list_cluster_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore - + list_cluster_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore @distributed_trace_async async def list_cluster_monitoring_user_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster monitoring user credential of a managed cluster. Gets cluster monitoring user credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_03_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_monitoring_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + template_url=self.list_cluster_monitoring_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -599,64 +556,54 @@ async def list_cluster_monitoring_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_monitoring_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore - + list_cluster_monitoring_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore @distributed_trace_async - async def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.ManagedCluster: + async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.ManagedCluster: """Gets a managed cluster. Gets the details of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedCluster, or the result of cls(response) + :return: ManagedCluster or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_03_01.models.ManagedCluster - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -664,55 +611,54 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _create_or_update_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.ManagedCluster, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'ManagedCluster') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedCluster") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -720,10 +666,9 @@ async def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -731,25 +676,26 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - @distributed_trace_async + @overload async def begin_create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedCluster, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. @@ -757,12 +703,16 @@ async def begin_create_or_update( Creates or updates a managed cluster with the specified configuration for agents and Kubernetes version. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2021_03_01.models.ManagedCluster + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -775,20 +725,91 @@ async def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_03_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster with the specified configuration for agents and Kubernetes + version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_03_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster with the specified configuration for agents and Kubernetes + version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. Is + either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_03_01.models.ManagedCluster or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_03_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -796,69 +817,66 @@ async def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _update_tags_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.TagsObject, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request_initial( - subscription_id=self._config.subscription_id, + request = build_update_tags_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_tags_initial.metadata['url'], + content=_content, + template_url=self._update_tags_initial.metadata["url"], headers=_headers, params=_params, ) @@ -866,44 +884,85 @@ async def _update_tags_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_tags_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _update_tags_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - @distributed_trace_async + @overload async def begin_update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates a managed cluster with the specified tags. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2021_03_01.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_03_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates a managed cluster with the specified tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -916,20 +975,50 @@ async def begin_update_tags( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_03_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates a managed cluster with the specified tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_03_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_03_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, @@ -937,64 +1026,54 @@ async def begin_update_tags( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1002,10 +1081,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1015,23 +1093,17 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: + async def begin_delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Deletes a managed cluster. Deletes the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1043,85 +1115,83 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterServicePrincipalProfile, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterServicePrincipalProfile") - request = build_reset_service_principal_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_service_principal_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_service_principal_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_service_principal_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1129,10 +1199,9 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1142,29 +1211,106 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist if cls: return cls(pipeline_response, None, {}) - _reset_service_principal_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + _reset_service_principal_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore - - @distributed_trace_async - async def begin_reset_service_principal_profile( # pylint: disable=inconsistent-return-statements + @overload + async def begin_reset_service_principal_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterServicePrincipalProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: """Reset Service Principal Profile of a managed cluster. Update the service principal Profile for a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a - Managed Cluster. + Managed Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2021_03_01.models.ManagedClusterServicePrincipalProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset Service Principal Profile of a managed cluster. + + Update the service principal Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a + Managed Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset Service Principal Profile of a managed cluster. + + Update the service principal Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a + Managed Cluster. Is either a model type or a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2021_03_01.models.ManagedClusterServicePrincipalProfile or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -1175,20 +1321,17 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1196,67 +1339,68 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_service_principal_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + begin_reset_service_principal_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterAADProfile, + parameters: Union[_models.ManagedClusterAADProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterAADProfile") - request = build_reset_aad_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_aad_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_aad_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_aad_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1264,10 +1408,9 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1277,28 +1420,69 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta if cls: return cls(pipeline_response, None, {}) - _reset_aad_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + _reset_aad_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - - @distributed_trace_async - async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements + @overload + async def begin_reset_aad_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterAADProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: """Reset AAD Profile of a managed cluster. Update the AAD Profile for a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed - Cluster. + Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2021_03_01.models.ManagedClusterAADProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset AAD Profile of a managed cluster. + + Update the AAD Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed + Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -1309,20 +1493,53 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterAADProfile, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset AAD Profile of a managed cluster. + + Update the AAD Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed + Cluster. Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_03_01.models.ManagedClusterAADProfile or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1330,62 +1547,52 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_aad_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + begin_reset_aad_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_rotate_cluster_certificates_request_initial( - subscription_id=self._config.subscription_id, + request = build_rotate_cluster_certificates_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._rotate_cluster_certificates_initial.metadata['url'], + template_url=self._rotate_cluster_certificates_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1393,10 +1600,9 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1406,23 +1612,19 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- if cls: return cls(pipeline_response, None, {}) - _rotate_cluster_certificates_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore - + _rotate_cluster_certificates_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore @distributed_trace_async - async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + async def begin_rotate_cluster_certificates( + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Rotate certificates of a managed cluster. Rotate certificates of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1434,80 +1636,67 @@ async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-ret Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._rotate_cluster_certificates_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_rotate_cluster_certificates.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore + begin_rotate_cluster_certificates.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore async def _stop_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_stop_request_initial( - subscription_id=self._config.subscription_id, + request = build_stop_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._stop_initial.metadata['url'], + template_url=self._stop_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1515,10 +1704,9 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1528,23 +1716,17 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore - + _stop_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore @distributed_trace_async - async def begin_stop( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: + async def begin_stop(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Stop Managed Cluster. Stops a Running Managed Cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1556,80 +1738,67 @@ async def begin_stop( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._stop_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore + begin_stop.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore async def _start_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_start_request_initial( - subscription_id=self._config.subscription_id, + request = build_start_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._start_initial.metadata['url'], + template_url=self._start_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1637,10 +1806,9 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1650,23 +1818,17 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore - + _start_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore @distributed_trace_async - async def begin_start( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: + async def begin_start(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Start Managed Cluster. Starts a Stopped Managed Cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1678,85 +1840,83 @@ async def begin_start( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._start_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore + begin_start.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore async def _run_command_initial( self, resource_group_name: str, resource_name: str, - request_payload: _models.RunCommandRequest, + request_payload: Union[_models.RunCommandRequest, IO], **kwargs: Any ) -> Optional[_models.RunCommandResult]: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RunCommandResult]] - _json = self._serialize.body(request_payload, 'RunCommandRequest') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(request_payload, (IO, bytes)): + _content = request_payload + else: + _json = self._serialize.body(request_payload, "RunCommandRequest") - request = build_run_command_request_initial( - subscription_id=self._config.subscription_id, + request = build_run_command_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._run_command_initial.metadata['url'], + content=_content, + template_url=self._run_command_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1764,10 +1924,9 @@ async def _run_command_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1776,22 +1935,23 @@ async def _run_command_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _run_command_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore - + _run_command_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore - @distributed_trace_async + @overload async def begin_run_command( self, resource_group_name: str, resource_name: str, request_payload: _models.RunCommandRequest, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.RunCommandResult]: """Run Command against Managed Kubernetes Service. @@ -1799,12 +1959,54 @@ async def begin_run_command( Submit a command to run against managed kubernetes service, it will create a pod to run the command. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param request_payload: Parameters supplied to the RunCommand operation. + :param request_payload: Parameters supplied to the RunCommand operation. Required. :type request_payload: ~azure.mgmt.containerservice.v2021_03_01.models.RunCommandRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RunCommandResult or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_03_01.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_run_command( + self, + resource_group_name: str, + resource_name: str, + request_payload: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.RunCommandResult]: + """Run Command against Managed Kubernetes Service. + + Submit a command to run against managed kubernetes service, it will create a pod to run the + command. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param request_payload: Parameters supplied to the RunCommand operation. Required. + :type request_payload: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -1817,20 +2019,55 @@ async def begin_run_command( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_03_01.models.RunCommandResult] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_run_command( + self, + resource_group_name: str, + resource_name: str, + request_payload: Union[_models.RunCommandRequest, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.RunCommandResult]: + """Run Command against Managed Kubernetes Service. + + Submit a command to run against managed kubernetes service, it will create a pod to run the + command. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param request_payload: Parameters supplied to the RunCommand operation. Is either a model type + or a IO type. Required. + :type request_payload: ~azure.mgmt.containerservice.v2021_03_01.models.RunCommandRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RunCommandResult or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_03_01.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.RunCommandResult] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.RunCommandResult] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._run_command_initial( # type: ignore resource_group_name=resource_group_name, @@ -1838,82 +2075,71 @@ async def begin_run_command( request_payload=request_payload, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_run_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore + begin_run_command.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore @distributed_trace_async async def get_command_result( - self, - resource_group_name: str, - resource_name: str, - command_id: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, command_id: str, **kwargs: Any ) -> Optional[_models.RunCommandResult]: """Get command result. Get command result from previous runCommand invoke. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param command_id: Id of the command request. + :param command_id: Id of the command request. Required. :type command_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: RunCommandResult, or the result of cls(response) + :return: RunCommandResult or None or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_03_01.models.RunCommandResult or None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RunCommandResult]] - request = build_get_command_result_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, command_id=command_id, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_command_result.metadata['url'], + template_url=self.get_command_result.metadata["url"], headers=_headers, params=_params, ) @@ -1921,10 +2147,9 @@ async def get_command_result( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1933,12 +2158,11 @@ async def get_command_result( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_command_result.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}"} # type: ignore - + get_command_result.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/aio/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/aio/operations/_operations.py index edeba6417e11..5941abd5a6bd 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/aio/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/aio/operations/_operations.py @@ -7,9 +7,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,9 +27,11 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._operations import build_list_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class Operations: """ .. warning:: @@ -42,36 +51,31 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.OperationListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.OperationValue"]: """Gets a list of compute operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationListResult or the result of cls(response) + :return: An iterator like instance of either OperationValue or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_03_01.models.OperationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_03_01.models.OperationValue] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -79,13 +83,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -101,10 +103,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -114,8 +114,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.ContainerService/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ContainerService/operations"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/aio/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/aio/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/aio/operations/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/aio/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/aio/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/aio/operations/_private_endpoint_connections_operations.py index 8085617aed3b..1f83730a91dc 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/aio/operations/_private_endpoint_connections_operations.py @@ -6,9 +6,15 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -20,10 +26,17 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._private_endpoint_connections_operations import build_delete_request_initial, build_get_request, build_list_request, build_update_request -T = TypeVar('T') +from ...operations._private_endpoint_connections_operations import ( + build_delete_request, + build_get_request, + build_list_request, + build_update_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class PrivateEndpointConnectionsOperations: """ .. warning:: @@ -43,46 +56,39 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async async def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnectionListResult: """Gets a list of private endpoint connections in the specified managed cluster. Gets a list of private endpoint connections in the specified managed cluster. The operation returns properties of each private endpoint connection. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnectionListResult, or the result of cls(response) + :return: PrivateEndpointConnectionListResult or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_03_01.models.PrivateEndpointConnectionListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnectionListResult] - request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -90,68 +96,59 @@ async def list( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore - + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore @distributed_trace_async async def get( - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnection: """Gets the private endpoint connection. Gets the details of the private endpoint connection by managed cluster and resource group. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_03_01.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -159,75 +156,149 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - - @distributed_trace_async + @overload async def update( self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, parameters: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateEndpointConnection: """Updates a private endpoint connection. Updates a private endpoint connection in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :param parameters: Parameters supplied to the Update a private endpoint connection operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2021_03_01.models.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_03_01.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + async def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: Parameters supplied to the Update a private endpoint connection operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_03_01.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: Union[_models.PrivateEndpointConnection, IO], + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: Parameters supplied to the Update a private endpoint connection operation. + Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_03_01.models.PrivateEndpointConnection or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_03_01.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - _json = self._serialize.body(parameters, 'PrivateEndpointConnection') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateEndpointConnection") request = build_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update.metadata['url'], + content=_content, + template_url=self.update.metadata["url"], headers=_headers, params=_params, ) @@ -235,52 +306,43 @@ async def update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -288,10 +350,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -301,26 +362,21 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + async def begin_delete( + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes a private endpoint connection. Deletes the private endpoint connection in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -332,53 +388,46 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/aio/operations/_private_link_resources_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/aio/operations/_private_link_resources_operations.py index f06ce0395869..30c0b6b6a9be 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/aio/operations/_private_link_resources_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/aio/operations/_private_link_resources_operations.py @@ -8,7 +8,13 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -19,9 +25,11 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._private_link_resources_operations import build_list_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class PrivateLinkResourcesOperations: """ .. warning:: @@ -41,46 +49,39 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async async def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.PrivateLinkResourcesListResult: """Gets a list of private link resources in the specified managed cluster. Gets a list of private link resources in the specified managed cluster. The operation returns properties of each private link resource. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResourcesListResult, or the result of cls(response) + :return: PrivateLinkResourcesListResult or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_03_01.models.PrivateLinkResourcesListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResourcesListResult] - request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -88,22 +89,20 @@ async def list( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResourcesListResult', pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources"} # type: ignore - + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/aio/operations/_resolve_private_link_service_id_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/aio/operations/_resolve_private_link_service_id_operations.py index 2ced089f1e5b..ab2f33a7733a 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/aio/operations/_resolve_private_link_service_id_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/aio/operations/_resolve_private_link_service_id_operations.py @@ -6,9 +6,15 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -19,9 +25,11 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._resolve_private_link_service_id_operations import build_post_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class ResolvePrivateLinkServiceIdOperations: """ .. warning:: @@ -41,53 +49,120 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async + @overload async def post( self, resource_group_name: str, resource_name: str, parameters: _models.PrivateLinkResource, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateLinkResource: """Gets the private link service ID for the specified managed cluster. Gets the private link service ID the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters (name, groupId) supplied in order to resolve a private link - service ID. + service ID. Required. :type parameters: ~azure.mgmt.containerservice.v2021_03_01.models.PrivateLinkResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_03_01.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def post( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters (name, groupId) supplied in order to resolve a private link + service ID. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResource, or the result of cls(response) + :return: PrivateLinkResource or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_03_01.models.PrivateLinkResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @distributed_trace_async + async def post( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.PrivateLinkResource, IO], + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters (name, groupId) supplied in order to resolve a private link + service ID. Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_03_01.models.PrivateLinkResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_03_01.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResource] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResource] - _json = self._serialize.body(parameters, 'PrivateLinkResource') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateLinkResource") request = build_post_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.post.metadata['url'], + content=_content, + template_url=self.post.metadata["url"], headers=_headers, params=_params, ) @@ -95,22 +170,20 @@ async def post( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResource', pipeline_response) + deserialized = self._deserialize("PrivateLinkResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - post.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId"} # type: ignore - + post.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/models/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/models/__init__.py index 3d22d386cb28..d3c1073ccd38 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/models/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/models/__init__.py @@ -16,7 +16,9 @@ from ._models_py3 import CloudError from ._models_py3 import CloudErrorBody from ._models_py3 import Components1Q1Og48SchemasManagedclusterAllof1 -from ._models_py3 import Components1Umhcm8SchemasManagedclusteridentityPropertiesUserassignedidentitiesAdditionalproperties +from ._models_py3 import ( + Components1Umhcm8SchemasManagedclusteridentityPropertiesUserassignedidentitiesAdditionalproperties, +) from ._models_py3 import ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties from ._models_py3 import ContainerServiceDiagnosticsProfile from ._models_py3 import ContainerServiceLinuxProfile @@ -82,148 +84,146 @@ from ._models_py3 import TimeSpan from ._models_py3 import UserAssignedIdentity - -from ._container_service_client_enums import ( - AgentPoolMode, - AgentPoolType, - Code, - ConnectionStatus, - ContainerServiceStorageProfileTypes, - ContainerServiceVMSizeTypes, - Count, - CreatedByType, - Expander, - ExtendedLocationTypes, - GPUInstanceProfile, - KubeletDiskType, - LicenseType, - LoadBalancerSku, - ManagedClusterPodIdentityProvisioningState, - ManagedClusterSKUName, - ManagedClusterSKUTier, - NetworkMode, - NetworkPlugin, - NetworkPolicy, - OSDiskType, - OSSKU, - OSType, - OutboundType, - PrivateEndpointConnectionProvisioningState, - ResourceIdentityType, - ScaleSetEvictionPolicy, - ScaleSetPriority, - UpgradeChannel, - WeekDay, -) +from ._container_service_client_enums import AgentPoolMode +from ._container_service_client_enums import AgentPoolType +from ._container_service_client_enums import Code +from ._container_service_client_enums import ConnectionStatus +from ._container_service_client_enums import ContainerServiceStorageProfileTypes +from ._container_service_client_enums import ContainerServiceVMSizeTypes +from ._container_service_client_enums import Count +from ._container_service_client_enums import CreatedByType +from ._container_service_client_enums import Expander +from ._container_service_client_enums import ExtendedLocationTypes +from ._container_service_client_enums import GPUInstanceProfile +from ._container_service_client_enums import KubeletDiskType +from ._container_service_client_enums import LicenseType +from ._container_service_client_enums import LoadBalancerSku +from ._container_service_client_enums import ManagedClusterPodIdentityProvisioningState +from ._container_service_client_enums import ManagedClusterSKUName +from ._container_service_client_enums import ManagedClusterSKUTier +from ._container_service_client_enums import NetworkMode +from ._container_service_client_enums import NetworkPlugin +from ._container_service_client_enums import NetworkPolicy +from ._container_service_client_enums import OSDiskType +from ._container_service_client_enums import OSSKU +from ._container_service_client_enums import OSType +from ._container_service_client_enums import OutboundType +from ._container_service_client_enums import PrivateEndpointConnectionProvisioningState +from ._container_service_client_enums import ResourceIdentityType +from ._container_service_client_enums import ScaleSetEvictionPolicy +from ._container_service_client_enums import ScaleSetPriority +from ._container_service_client_enums import UpgradeChannel +from ._container_service_client_enums import WeekDay from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'AgentPool', - 'AgentPoolAvailableVersions', - 'AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem', - 'AgentPoolListResult', - 'AgentPoolUpgradeProfile', - 'AgentPoolUpgradeProfilePropertiesUpgradesItem', - 'AgentPoolUpgradeSettings', - 'CloudError', - 'CloudErrorBody', - 'Components1Q1Og48SchemasManagedclusterAllof1', - 'Components1Umhcm8SchemasManagedclusteridentityPropertiesUserassignedidentitiesAdditionalproperties', - 'ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties', - 'ContainerServiceDiagnosticsProfile', - 'ContainerServiceLinuxProfile', - 'ContainerServiceMasterProfile', - 'ContainerServiceNetworkProfile', - 'ContainerServiceSshConfiguration', - 'ContainerServiceSshPublicKey', - 'ContainerServiceVMDiagnostics', - 'CredentialResult', - 'CredentialResults', - 'ExtendedLocation', - 'KubeletConfig', - 'LinuxOSConfig', - 'MaintenanceConfiguration', - 'MaintenanceConfigurationListResult', - 'ManagedCluster', - 'ManagedClusterAADProfile', - 'ManagedClusterAPIServerAccessProfile', - 'ManagedClusterAccessProfile', - 'ManagedClusterAddonProfile', - 'ManagedClusterAddonProfileIdentity', - 'ManagedClusterAgentPoolProfile', - 'ManagedClusterAgentPoolProfileProperties', - 'ManagedClusterAutoUpgradeProfile', - 'ManagedClusterHTTPProxyConfig', - 'ManagedClusterIdentity', - 'ManagedClusterListResult', - 'ManagedClusterLoadBalancerProfile', - 'ManagedClusterLoadBalancerProfileManagedOutboundIPs', - 'ManagedClusterLoadBalancerProfileOutboundIPPrefixes', - 'ManagedClusterLoadBalancerProfileOutboundIPs', - 'ManagedClusterPodIdentity', - 'ManagedClusterPodIdentityException', - 'ManagedClusterPodIdentityProfile', - 'ManagedClusterPodIdentityProvisioningInfo', - 'ManagedClusterPoolUpgradeProfile', - 'ManagedClusterPoolUpgradeProfileUpgradesItem', - 'ManagedClusterPropertiesAutoScalerProfile', - 'ManagedClusterSKU', - 'ManagedClusterServicePrincipalProfile', - 'ManagedClusterUpgradeProfile', - 'ManagedClusterWindowsProfile', - 'OSOptionProfile', - 'OSOptionProperty', - 'OperationListResult', - 'OperationValue', - 'PowerState', - 'PrivateEndpoint', - 'PrivateEndpointConnection', - 'PrivateEndpointConnectionListResult', - 'PrivateLinkResource', - 'PrivateLinkResourcesListResult', - 'PrivateLinkServiceConnectionState', - 'Resource', - 'ResourceReference', - 'RunCommandRequest', - 'RunCommandResult', - 'SubResource', - 'SysctlConfig', - 'SystemData', - 'TagsObject', - 'TimeInWeek', - 'TimeSpan', - 'UserAssignedIdentity', - 'AgentPoolMode', - 'AgentPoolType', - 'Code', - 'ConnectionStatus', - 'ContainerServiceStorageProfileTypes', - 'ContainerServiceVMSizeTypes', - 'Count', - 'CreatedByType', - 'Expander', - 'ExtendedLocationTypes', - 'GPUInstanceProfile', - 'KubeletDiskType', - 'LicenseType', - 'LoadBalancerSku', - 'ManagedClusterPodIdentityProvisioningState', - 'ManagedClusterSKUName', - 'ManagedClusterSKUTier', - 'NetworkMode', - 'NetworkPlugin', - 'NetworkPolicy', - 'OSDiskType', - 'OSSKU', - 'OSType', - 'OutboundType', - 'PrivateEndpointConnectionProvisioningState', - 'ResourceIdentityType', - 'ScaleSetEvictionPolicy', - 'ScaleSetPriority', - 'UpgradeChannel', - 'WeekDay', + "AgentPool", + "AgentPoolAvailableVersions", + "AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem", + "AgentPoolListResult", + "AgentPoolUpgradeProfile", + "AgentPoolUpgradeProfilePropertiesUpgradesItem", + "AgentPoolUpgradeSettings", + "CloudError", + "CloudErrorBody", + "Components1Q1Og48SchemasManagedclusterAllof1", + "Components1Umhcm8SchemasManagedclusteridentityPropertiesUserassignedidentitiesAdditionalproperties", + "ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties", + "ContainerServiceDiagnosticsProfile", + "ContainerServiceLinuxProfile", + "ContainerServiceMasterProfile", + "ContainerServiceNetworkProfile", + "ContainerServiceSshConfiguration", + "ContainerServiceSshPublicKey", + "ContainerServiceVMDiagnostics", + "CredentialResult", + "CredentialResults", + "ExtendedLocation", + "KubeletConfig", + "LinuxOSConfig", + "MaintenanceConfiguration", + "MaintenanceConfigurationListResult", + "ManagedCluster", + "ManagedClusterAADProfile", + "ManagedClusterAPIServerAccessProfile", + "ManagedClusterAccessProfile", + "ManagedClusterAddonProfile", + "ManagedClusterAddonProfileIdentity", + "ManagedClusterAgentPoolProfile", + "ManagedClusterAgentPoolProfileProperties", + "ManagedClusterAutoUpgradeProfile", + "ManagedClusterHTTPProxyConfig", + "ManagedClusterIdentity", + "ManagedClusterListResult", + "ManagedClusterLoadBalancerProfile", + "ManagedClusterLoadBalancerProfileManagedOutboundIPs", + "ManagedClusterLoadBalancerProfileOutboundIPPrefixes", + "ManagedClusterLoadBalancerProfileOutboundIPs", + "ManagedClusterPodIdentity", + "ManagedClusterPodIdentityException", + "ManagedClusterPodIdentityProfile", + "ManagedClusterPodIdentityProvisioningInfo", + "ManagedClusterPoolUpgradeProfile", + "ManagedClusterPoolUpgradeProfileUpgradesItem", + "ManagedClusterPropertiesAutoScalerProfile", + "ManagedClusterSKU", + "ManagedClusterServicePrincipalProfile", + "ManagedClusterUpgradeProfile", + "ManagedClusterWindowsProfile", + "OSOptionProfile", + "OSOptionProperty", + "OperationListResult", + "OperationValue", + "PowerState", + "PrivateEndpoint", + "PrivateEndpointConnection", + "PrivateEndpointConnectionListResult", + "PrivateLinkResource", + "PrivateLinkResourcesListResult", + "PrivateLinkServiceConnectionState", + "Resource", + "ResourceReference", + "RunCommandRequest", + "RunCommandResult", + "SubResource", + "SysctlConfig", + "SystemData", + "TagsObject", + "TimeInWeek", + "TimeSpan", + "UserAssignedIdentity", + "AgentPoolMode", + "AgentPoolType", + "Code", + "ConnectionStatus", + "ContainerServiceStorageProfileTypes", + "ContainerServiceVMSizeTypes", + "Count", + "CreatedByType", + "Expander", + "ExtendedLocationTypes", + "GPUInstanceProfile", + "KubeletDiskType", + "LicenseType", + "LoadBalancerSku", + "ManagedClusterPodIdentityProvisioningState", + "ManagedClusterSKUName", + "ManagedClusterSKUTier", + "NetworkMode", + "NetworkPlugin", + "NetworkPolicy", + "OSDiskType", + "OSSKU", + "OSType", + "OutboundType", + "PrivateEndpointConnectionProvisioningState", + "ResourceIdentityType", + "ScaleSetEvictionPolicy", + "ScaleSetPriority", + "UpgradeChannel", + "WeekDay", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/models/_container_service_client_enums.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/models/_container_service_client_enums.py index fa53aa10e316..4114a06fad63 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/models/_container_service_client_enums.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/models/_container_service_client_enums.py @@ -11,35 +11,35 @@ class AgentPoolMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """AgentPoolMode represents mode of an agent pool. - """ + """AgentPoolMode represents mode of an agent pool.""" SYSTEM = "System" USER = "User" + class AgentPoolType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """AgentPoolType represents types of an agent pool. - """ + """AgentPoolType represents types of an agent pool.""" VIRTUAL_MACHINE_SCALE_SETS = "VirtualMachineScaleSets" AVAILABILITY_SET = "AvailabilitySet" + class Code(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Tells whether the cluster is Running or Stopped - """ + """Tells whether the cluster is Running or Stopped.""" RUNNING = "Running" STOPPED = "Stopped" + class ConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The private link service connection status. - """ + """The private link service connection status.""" PENDING = "Pending" APPROVED = "Approved" REJECTED = "Rejected" DISCONNECTED = "Disconnected" + class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the orchestrator choice. @@ -48,9 +48,9 @@ class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEn STORAGE_ACCOUNT = "StorageAccount" MANAGED_DISKS = "ManagedDisks" + class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Size of agent VMs. - """ + """Size of agent VMs.""" STANDARD_A1 = "Standard_A1" STANDARD_A10 = "Standard_A10" @@ -227,6 +227,7 @@ class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): STANDARD_NV24 = "Standard_NV24" STANDARD_NV6 = "Standard_NV6" + class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): """Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, and 5. The default value is 1. @@ -236,28 +237,31 @@ class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): THREE = 3 FIVE = 5 + class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of identity that created the resource. - """ + """The type of identity that created the resource.""" USER = "User" APPLICATION = "Application" MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" + class Expander(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Expander.""" LEAST_WASTE = "least-waste" MOST_PODS = "most-pods" PRIORITY = "priority" RANDOM = "random" + class ExtendedLocationTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of extendedLocation. - """ + """The type of extendedLocation.""" EDGE_ZONE = "EdgeZone" + class GPUInstanceProfile(str, Enum, metaclass=CaseInsensitiveEnumMeta): """GPUInstanceProfile to be used to specify GPU MIG instance profile for supported GPU VM SKU. Supported values are MIG1g, MIG2g, MIG3g, MIG4g and MIG7g. @@ -269,6 +273,7 @@ class GPUInstanceProfile(str, Enum, metaclass=CaseInsensitiveEnumMeta): MIG4_G = "MIG4g" MIG7_G = "MIG7g" + class KubeletDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """KubeletDiskType determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. Allowed values: 'OS', 'Temporary' (preview). @@ -277,6 +282,7 @@ class KubeletDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): OS = "OS" TEMPORARY = "Temporary" + class LicenseType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The licenseType to use for Windows VMs. Windows_Server is used to enable Azure Hybrid User Benefits for Windows VMs. @@ -285,63 +291,64 @@ class LicenseType(str, Enum, metaclass=CaseInsensitiveEnumMeta): NONE = "None" WINDOWS_SERVER = "Windows_Server" + class LoadBalancerSku(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The load balancer sku for the managed cluster. - """ + """The load balancer sku for the managed cluster.""" STANDARD = "standard" BASIC = "basic" + class ManagedClusterPodIdentityProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The current provisioning state of the pod identity. - """ + """The current provisioning state of the pod identity.""" ASSIGNED = "Assigned" UPDATING = "Updating" DELETING = "Deleting" FAILED = "Failed" + class ManagedClusterSKUName(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Name of a managed cluster SKU. - """ + """Name of a managed cluster SKU.""" BASIC = "Basic" + class ManagedClusterSKUTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Tier of a managed cluster SKU. - """ + """Tier of a managed cluster SKU.""" PAID = "Paid" FREE = "Free" + class NetworkMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Network mode used for building Kubernetes network. - """ + """Network mode used for building Kubernetes network.""" TRANSPARENT = "transparent" BRIDGE = "bridge" + class NetworkPlugin(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Network plugin used for building Kubernetes network. - """ + """Network plugin used for building Kubernetes network.""" AZURE = "azure" KUBENET = "kubenet" + class NetworkPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Network policy used for building Kubernetes network. - """ + """Network policy used for building Kubernetes network.""" CALICO = "calico" AZURE = "azure" + class OSDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """OSDiskType represents the type of an OS disk on an agent pool. - """ + """OSDiskType represents the type of an OS disk on an agent pool.""" MANAGED = "Managed" EPHEMERAL = "Ephemeral" + class OSSKU(str, Enum, metaclass=CaseInsensitiveEnumMeta): """OsSKU to be used to specify os sku. Choose from Ubuntu(default) and CBLMariner for Linux OSType. Not applicable to Windows OSType. @@ -350,29 +357,30 @@ class OSSKU(str, Enum, metaclass=CaseInsensitiveEnumMeta): UBUNTU = "Ubuntu" CBL_MARINER = "CBLMariner" + class OSType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """OsType to be used to specify os type. Choose from Linux and Windows. Default to Linux. - """ + """OsType to be used to specify os type. Choose from Linux and Windows. Default to Linux.""" LINUX = "Linux" WINDOWS = "Windows" + class OutboundType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The outbound (egress) routing method. - """ + """The outbound (egress) routing method.""" LOAD_BALANCER = "loadBalancer" USER_DEFINED_ROUTING = "userDefinedRouting" + class PrivateEndpointConnectionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The current provisioning state. - """ + """The current provisioning state.""" SUCCEEDED = "Succeeded" CREATING = "Creating" DELETING = "Deleting" FAILED = "Failed" + class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of identity used for the managed cluster. Type 'SystemAssigned' will use an implicitly created identity in master components and an auto-created user assigned identity in MC_ @@ -384,6 +392,7 @@ class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): USER_ASSIGNED = "UserAssigned" NONE = "None" + class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ScaleSetEvictionPolicy to be used to specify eviction policy for Spot virtual machine scale set. Default to Delete. @@ -392,16 +401,16 @@ class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): DELETE = "Delete" DEALLOCATE = "Deallocate" + class ScaleSetPriority(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """ScaleSetPriority to be used to specify virtual machine scale set priority. Default to regular. - """ + """ScaleSetPriority to be used to specify virtual machine scale set priority. Default to regular.""" SPOT = "Spot" REGULAR = "Regular" + class UpgradeChannel(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """upgrade channel for auto upgrade. - """ + """upgrade channel for auto upgrade.""" RAPID = "rapid" STABLE = "stable" @@ -409,9 +418,9 @@ class UpgradeChannel(str, Enum, metaclass=CaseInsensitiveEnumMeta): NODE_IMAGE = "node-image" NONE = "none" + class WeekDay(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The weekday enum. - """ + """The weekday enum.""" SUNDAY = "Sunday" MONDAY = "Monday" diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/models/_models_py3.py index 4b2820cd2ad7..876c6ae782dc 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/models/_models_py3.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/models/_models_py3.py @@ -1,4 +1,5 @@ # coding=utf-8 +# pylint: disable=too-many-lines # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -9,14 +10,14 @@ import datetime from typing import Dict, List, Optional, TYPE_CHECKING, Union -import msrest.serialization +from ... import _serialization if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - import __init__ as _models + from .. import models as _models -class SubResource(msrest.serialization.Model): +class SubResource(_serialization.Model): """Reference to another subresource. Variables are only populated by the server, and will be ignored when sending a request. @@ -31,30 +32,26 @@ class SubResource(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(SubResource, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.id = None self.name = None self.type = None -class AgentPool(SubResource): +class AgentPool(SubResource): # pylint: disable=too-many-instance-attributes """Agent Pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -79,11 +76,11 @@ class AgentPool(SubResource): :ivar os_disk_type: OS disk type to be used for machines in a given agent pool. Allowed values are 'Ephemeral' and 'Managed'. If unspecified, defaults to 'Ephemeral' when the VM supports ephemeral OS and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults - to 'Managed'. May not be changed after creation. Known values are: "Managed", "Ephemeral". + to 'Managed'. May not be changed after creation. Known values are: "Managed" and "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2021_03_01.models.OSDiskType :ivar kubelet_disk_type: KubeletDiskType determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. Currently allows one value, OS, - resulting in Kubelet using the OS disk for data. Known values are: "OS", "Temporary". + resulting in Kubelet using the OS disk for data. Known values are: "OS" and "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2021_03_01.models.KubeletDiskType :ivar vnet_subnet_id: VNet SubnetID specifies the VNet's subnet identifier for nodes and maybe @@ -94,10 +91,11 @@ class AgentPool(SubResource): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Known values are: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux" and "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2021_03_01.models.OSType :ivar os_sku: OsSKU to be used to specify os sku. Choose from Ubuntu(default) and CBLMariner - for Linux OSType. Not applicable to Windows OSType. Known values are: "Ubuntu", "CBLMariner". + for Linux OSType. Not applicable to Windows OSType. Known values are: "Ubuntu" and + "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2021_03_01.models.OSSKU :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -106,10 +104,11 @@ class AgentPool(SubResource): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar type_properties_type: AgentPoolType represents types of an agent pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :vartype type_properties_type: str or ~azure.mgmt.containerservice.v2021_03_01.models.AgentPoolType - :ivar mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", "User". + :ivar mode: AgentPoolMode represents mode of an agent pool. Known values are: "System" and + "User". :vartype mode: str or ~azure.mgmt.containerservice.v2021_03_01.models.AgentPoolMode :ivar orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -133,20 +132,19 @@ class AgentPool(SubResource): IP Prefix. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Known values are: "Spot", "Regular". Default value: "Regular". + priority. Default to regular. Known values are: "Spot" and "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2021_03_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy - for Spot virtual machine scale set. Default to Delete. Known values are: "Delete", - "Deallocate". Default value: "Delete". + for Spot virtual machine scale set. Default to Delete. Known values are: "Delete" and + "Deallocate". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2021_03_01.models.ScaleSetEvictionPolicy :ivar spot_max_price: SpotMaxPrice to be used to specify the maximum price you are willing to pay in US Dollars. Possible values are any decimal value greater than zero or -1 which indicates default price to be up-to on-demand. :vartype spot_max_price: float - :ivar tags: A set of tags. Agent pool tags to be persisted on the agent pool virtual machine - scale set. + :ivar tags: Agent pool tags to be persisted on the agent pool virtual machine scale set. :vartype tags: dict[str, str] :ivar node_labels: Agent pool node labels to be persisted across all nodes in agent pool. :vartype node_labels: dict[str, str] @@ -165,63 +163,63 @@ class AgentPool(SubResource): :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile for supported GPU VM SKU. Supported values are MIG1g, MIG2g, MIG3g, MIG4g and MIG7g. Known - values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2021_03_01.models.GPUInstanceProfile """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'os_disk_size_gb': {'maximum': 2048, 'minimum': 0}, - 'node_image_version': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'power_state': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "os_disk_size_gb": {"maximum": 2048, "minimum": 0}, + "node_image_version": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "power_state": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'count': {'key': 'properties.count', 'type': 'int'}, - 'vm_size': {'key': 'properties.vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'properties.osDiskSizeGB', 'type': 'int'}, - 'os_disk_type': {'key': 'properties.osDiskType', 'type': 'str'}, - 'kubelet_disk_type': {'key': 'properties.kubeletDiskType', 'type': 'str'}, - 'vnet_subnet_id': {'key': 'properties.vnetSubnetID', 'type': 'str'}, - 'pod_subnet_id': {'key': 'properties.podSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'properties.maxPods', 'type': 'int'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'os_sku': {'key': 'properties.osSKU', 'type': 'str'}, - 'max_count': {'key': 'properties.maxCount', 'type': 'int'}, - 'min_count': {'key': 'properties.minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'properties.enableAutoScaling', 'type': 'bool'}, - 'type_properties_type': {'key': 'properties.type', 'type': 'str'}, - 'mode': {'key': 'properties.mode', 'type': 'str'}, - 'orchestrator_version': {'key': 'properties.orchestratorVersion', 'type': 'str'}, - 'node_image_version': {'key': 'properties.nodeImageVersion', 'type': 'str'}, - 'upgrade_settings': {'key': 'properties.upgradeSettings', 'type': 'AgentPoolUpgradeSettings'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'power_state': {'key': 'properties.powerState', 'type': 'PowerState'}, - 'availability_zones': {'key': 'properties.availabilityZones', 'type': '[str]'}, - 'enable_node_public_ip': {'key': 'properties.enableNodePublicIP', 'type': 'bool'}, - 'node_public_ip_prefix_id': {'key': 'properties.nodePublicIPPrefixID', 'type': 'str'}, - 'scale_set_priority': {'key': 'properties.scaleSetPriority', 'type': 'str'}, - 'scale_set_eviction_policy': {'key': 'properties.scaleSetEvictionPolicy', 'type': 'str'}, - 'spot_max_price': {'key': 'properties.spotMaxPrice', 'type': 'float'}, - 'tags': {'key': 'properties.tags', 'type': '{str}'}, - 'node_labels': {'key': 'properties.nodeLabels', 'type': '{str}'}, - 'node_taints': {'key': 'properties.nodeTaints', 'type': '[str]'}, - 'proximity_placement_group_id': {'key': 'properties.proximityPlacementGroupID', 'type': 'str'}, - 'kubelet_config': {'key': 'properties.kubeletConfig', 'type': 'KubeletConfig'}, - 'linux_os_config': {'key': 'properties.linuxOSConfig', 'type': 'LinuxOSConfig'}, - 'enable_encryption_at_host': {'key': 'properties.enableEncryptionAtHost', 'type': 'bool'}, - 'enable_fips': {'key': 'properties.enableFIPS', 'type': 'bool'}, - 'gpu_instance_profile': {'key': 'properties.gpuInstanceProfile', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "count": {"key": "properties.count", "type": "int"}, + "vm_size": {"key": "properties.vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "properties.osDiskSizeGB", "type": "int"}, + "os_disk_type": {"key": "properties.osDiskType", "type": "str"}, + "kubelet_disk_type": {"key": "properties.kubeletDiskType", "type": "str"}, + "vnet_subnet_id": {"key": "properties.vnetSubnetID", "type": "str"}, + "pod_subnet_id": {"key": "properties.podSubnetID", "type": "str"}, + "max_pods": {"key": "properties.maxPods", "type": "int"}, + "os_type": {"key": "properties.osType", "type": "str"}, + "os_sku": {"key": "properties.osSKU", "type": "str"}, + "max_count": {"key": "properties.maxCount", "type": "int"}, + "min_count": {"key": "properties.minCount", "type": "int"}, + "enable_auto_scaling": {"key": "properties.enableAutoScaling", "type": "bool"}, + "type_properties_type": {"key": "properties.type", "type": "str"}, + "mode": {"key": "properties.mode", "type": "str"}, + "orchestrator_version": {"key": "properties.orchestratorVersion", "type": "str"}, + "node_image_version": {"key": "properties.nodeImageVersion", "type": "str"}, + "upgrade_settings": {"key": "properties.upgradeSettings", "type": "AgentPoolUpgradeSettings"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "power_state": {"key": "properties.powerState", "type": "PowerState"}, + "availability_zones": {"key": "properties.availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "properties.enableNodePublicIP", "type": "bool"}, + "node_public_ip_prefix_id": {"key": "properties.nodePublicIPPrefixID", "type": "str"}, + "scale_set_priority": {"key": "properties.scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "properties.scaleSetEvictionPolicy", "type": "str"}, + "spot_max_price": {"key": "properties.spotMaxPrice", "type": "float"}, + "tags": {"key": "properties.tags", "type": "{str}"}, + "node_labels": {"key": "properties.nodeLabels", "type": "{str}"}, + "node_taints": {"key": "properties.nodeTaints", "type": "[str]"}, + "proximity_placement_group_id": {"key": "properties.proximityPlacementGroupID", "type": "str"}, + "kubelet_config": {"key": "properties.kubeletConfig", "type": "KubeletConfig"}, + "linux_os_config": {"key": "properties.linuxOSConfig", "type": "LinuxOSConfig"}, + "enable_encryption_at_host": {"key": "properties.enableEncryptionAtHost", "type": "bool"}, + "enable_fips": {"key": "properties.enableFIPS", "type": "bool"}, + "gpu_instance_profile": {"key": "properties.gpuInstanceProfile", "type": "str"}, } - def __init__( + def __init__( # pylint: disable=too-many-locals self, *, count: Optional[int] = None, @@ -232,7 +230,7 @@ def __init__( vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, @@ -244,9 +242,9 @@ def __init__( availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", - spot_max_price: Optional[float] = -1, + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", + spot_max_price: float = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, @@ -272,12 +270,12 @@ def __init__( :keyword os_disk_type: OS disk type to be used for machines in a given agent pool. Allowed values are 'Ephemeral' and 'Managed'. If unspecified, defaults to 'Ephemeral' when the VM supports ephemeral OS and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, - defaults to 'Managed'. May not be changed after creation. Known values are: "Managed", + defaults to 'Managed'. May not be changed after creation. Known values are: "Managed" and "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2021_03_01.models.OSDiskType :keyword kubelet_disk_type: KubeletDiskType determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. Currently allows one value, OS, - resulting in Kubelet using the OS disk for data. Known values are: "OS", "Temporary". + resulting in Kubelet using the OS disk for data. Known values are: "OS" and "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2021_03_01.models.KubeletDiskType :keyword vnet_subnet_id: VNet SubnetID specifies the VNet's subnet identifier for nodes and @@ -288,10 +286,11 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux" and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2021_03_01.models.OSType :keyword os_sku: OsSKU to be used to specify os sku. Choose from Ubuntu(default) and CBLMariner - for Linux OSType. Not applicable to Windows OSType. Known values are: "Ubuntu", "CBLMariner". + for Linux OSType. Not applicable to Windows OSType. Known values are: "Ubuntu" and + "CBLMariner". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2021_03_01.models.OSSKU :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -300,10 +299,10 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword type_properties_type: AgentPoolType represents types of an agent pool. Known values - are: "VirtualMachineScaleSets", "AvailabilitySet". + are: "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type_properties_type: str or ~azure.mgmt.containerservice.v2021_03_01.models.AgentPoolType - :keyword mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", + :keyword mode: AgentPoolMode represents mode of an agent pool. Known values are: "System" and "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2021_03_01.models.AgentPoolMode :keyword orchestrator_version: Version of orchestrator specified when creating the managed @@ -321,20 +320,19 @@ def __init__( Public IP Prefix. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Known values are: "Spot", "Regular". Default value: "Regular". + priority. Default to regular. Known values are: "Spot" and "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2021_03_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction - policy for Spot virtual machine scale set. Default to Delete. Known values are: "Delete", - "Deallocate". Default value: "Delete". + policy for Spot virtual machine scale set. Default to Delete. Known values are: "Delete" and + "Deallocate". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2021_03_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: SpotMaxPrice to be used to specify the maximum price you are willing to pay in US Dollars. Possible values are any decimal value greater than zero or -1 which indicates default price to be up-to on-demand. :paramtype spot_max_price: float - :keyword tags: A set of tags. Agent pool tags to be persisted on the agent pool virtual machine - scale set. + :keyword tags: Agent pool tags to be persisted on the agent pool virtual machine scale set. :paramtype tags: dict[str, str] :keyword node_labels: Agent pool node labels to be persisted across all nodes in agent pool. :paramtype node_labels: dict[str, str] @@ -353,11 +351,11 @@ def __init__( :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile for supported GPU VM SKU. Supported values are MIG1g, MIG2g, MIG3g, MIG4g and MIG7g. - Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2021_03_01.models.GPUInstanceProfile """ - super(AgentPool, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.vm_size = vm_size self.os_disk_size_gb = os_disk_size_gb @@ -395,7 +393,7 @@ def __init__( self.gpu_instance_profile = gpu_instance_profile -class AgentPoolAvailableVersions(msrest.serialization.Model): +class AgentPoolAvailableVersions(_serialization.Model): """The list of available versions for an agent pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -412,16 +410,19 @@ class AgentPoolAvailableVersions(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'agent_pool_versions': {'key': 'properties.agentPoolVersions', 'type': '[AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "agent_pool_versions": { + "key": "properties.agentPoolVersions", + "type": "[AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem]", + }, } def __init__( @@ -435,14 +436,14 @@ def __init__( :paramtype agent_pool_versions: list[~azure.mgmt.containerservice.v2021_03_01.models.AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem] """ - super(AgentPoolAvailableVersions, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None self.agent_pool_versions = agent_pool_versions -class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(msrest.serialization.Model): +class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(_serialization.Model): """AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem. :ivar default: Whether this version is the default agent pool version. @@ -454,9 +455,9 @@ class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(msrest.serializa """ _attribute_map = { - 'default': {'key': 'default', 'type': 'bool'}, - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "default": {"key": "default", "type": "bool"}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } def __init__( @@ -475,13 +476,13 @@ def __init__( :keyword is_preview: Whether Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.default = default self.kubernetes_version = kubernetes_version self.is_preview = is_preview -class AgentPoolListResult(msrest.serialization.Model): +class AgentPoolListResult(_serialization.Model): """The response from the List Agent Pools operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -493,30 +494,25 @@ class AgentPoolListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[AgentPool]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[AgentPool]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.AgentPool"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.AgentPool"]] = None, **kwargs): """ :keyword value: The list of agent pools. :paramtype value: list[~azure.mgmt.containerservice.v2021_03_01.models.AgentPool] """ - super(AgentPoolListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class AgentPoolUpgradeProfile(msrest.serialization.Model): +class AgentPoolUpgradeProfile(_serialization.Model): """The list of available upgrades for an agent pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -529,10 +525,10 @@ class AgentPoolUpgradeProfile(msrest.serialization.Model): :vartype name: str :ivar type: Type of the agent pool upgrade profile. :vartype type: str - :ivar kubernetes_version: Required. Kubernetes version (major, minor, patch). + :ivar kubernetes_version: Kubernetes version (major, minor, patch). Required. :vartype kubernetes_version: str - :ivar os_type: Required. OsType to be used to specify os type. Choose from Linux and Windows. - Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to + Linux. Known values are: "Linux" and "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2021_03_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -543,21 +539,21 @@ class AgentPoolUpgradeProfile(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kubernetes_version': {'required': True}, - 'os_type': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "kubernetes_version": {"required": True}, + "os_type": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'kubernetes_version': {'key': 'properties.kubernetesVersion', 'type': 'str'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'upgrades': {'key': 'properties.upgrades', 'type': '[AgentPoolUpgradeProfilePropertiesUpgradesItem]'}, - 'latest_node_image_version': {'key': 'properties.latestNodeImageVersion', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "os_type": {"key": "properties.osType", "type": "str"}, + "upgrades": {"key": "properties.upgrades", "type": "[AgentPoolUpgradeProfilePropertiesUpgradesItem]"}, + "latest_node_image_version": {"key": "properties.latestNodeImageVersion", "type": "str"}, } def __init__( @@ -570,10 +566,10 @@ def __init__( **kwargs ): """ - :keyword kubernetes_version: Required. Kubernetes version (major, minor, patch). + :keyword kubernetes_version: Kubernetes version (major, minor, patch). Required. :paramtype kubernetes_version: str - :keyword os_type: Required. OsType to be used to specify os type. Choose from Linux and - Windows. Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default + to Linux. Known values are: "Linux" and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2021_03_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: @@ -582,7 +578,7 @@ def __init__( image version. :paramtype latest_node_image_version: str """ - super(AgentPoolUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -592,7 +588,7 @@ def __init__( self.latest_node_image_version = latest_node_image_version -class AgentPoolUpgradeProfilePropertiesUpgradesItem(msrest.serialization.Model): +class AgentPoolUpgradeProfilePropertiesUpgradesItem(_serialization.Model): """AgentPoolUpgradeProfilePropertiesUpgradesItem. :ivar kubernetes_version: Kubernetes version (major, minor, patch). @@ -602,29 +598,23 @@ class AgentPoolUpgradeProfilePropertiesUpgradesItem(msrest.serialization.Model): """ _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } - def __init__( - self, - *, - kubernetes_version: Optional[str] = None, - is_preview: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, kubernetes_version: Optional[str] = None, is_preview: Optional[bool] = None, **kwargs): """ :keyword kubernetes_version: Kubernetes version (major, minor, patch). :paramtype kubernetes_version: str :keyword is_preview: Whether Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(AgentPoolUpgradeProfilePropertiesUpgradesItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.is_preview = is_preview -class AgentPoolUpgradeSettings(msrest.serialization.Model): +class AgentPoolUpgradeSettings(_serialization.Model): """Settings for upgrading an agentpool. :ivar max_surge: Count or percentage of additional nodes to be added during upgrade. If empty @@ -633,25 +623,20 @@ class AgentPoolUpgradeSettings(msrest.serialization.Model): """ _attribute_map = { - 'max_surge': {'key': 'maxSurge', 'type': 'str'}, + "max_surge": {"key": "maxSurge", "type": "str"}, } - def __init__( - self, - *, - max_surge: Optional[str] = None, - **kwargs - ): + def __init__(self, *, max_surge: Optional[str] = None, **kwargs): """ :keyword max_surge: Count or percentage of additional nodes to be added during upgrade. If empty uses AKS default. :paramtype max_surge: str """ - super(AgentPoolUpgradeSettings, self).__init__(**kwargs) + super().__init__(**kwargs) self.max_surge = max_surge -class CloudError(msrest.serialization.Model): +class CloudError(_serialization.Model): """An error response from the Container service. :ivar error: Details about the error. @@ -659,24 +644,19 @@ class CloudError(msrest.serialization.Model): """ _attribute_map = { - 'error': {'key': 'error', 'type': 'CloudErrorBody'}, + "error": {"key": "error", "type": "CloudErrorBody"}, } - def __init__( - self, - *, - error: Optional["_models.CloudErrorBody"] = None, - **kwargs - ): + def __init__(self, *, error: Optional["_models.CloudErrorBody"] = None, **kwargs): """ :keyword error: Details about the error. :paramtype error: ~azure.mgmt.containerservice.v2021_03_01.models.CloudErrorBody """ - super(CloudError, self).__init__(**kwargs) + super().__init__(**kwargs) self.error = error -class CloudErrorBody(msrest.serialization.Model): +class CloudErrorBody(_serialization.Model): """An error response from the Container service. :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed @@ -693,10 +673,10 @@ class CloudErrorBody(msrest.serialization.Model): """ _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[CloudErrorBody]"}, } def __init__( @@ -721,14 +701,16 @@ def __init__( :keyword details: A list of additional details about the error. :paramtype details: list[~azure.mgmt.containerservice.v2021_03_01.models.CloudErrorBody] """ - super(CloudErrorBody, self).__init__(**kwargs) + super().__init__(**kwargs) self.code = code self.message = message self.target = target self.details = details -class Components1Q1Og48SchemasManagedclusterAllof1(msrest.serialization.Model): +class Components1Q1Og48SchemasManagedclusterAllof1( + _serialization.Model +): # pylint: disable=too-many-instance-attributes """Components1Q1Og48SchemasManagedclusterAllof1. Variables are only populated by the server, and will be ignored when sending a request. @@ -814,47 +796,59 @@ class Components1Q1Og48SchemasManagedclusterAllof1(msrest.serialization.Model): """ _validation = { - 'provisioning_state': {'readonly': True}, - 'power_state': {'readonly': True}, - 'max_agent_pools': {'readonly': True}, - 'fqdn': {'readonly': True}, - 'private_fqdn': {'readonly': True}, - 'azure_portal_fqdn': {'readonly': True}, + "provisioning_state": {"readonly": True}, + "power_state": {"readonly": True}, + "max_agent_pools": {"readonly": True}, + "fqdn": {"readonly": True}, + "private_fqdn": {"readonly": True}, + "azure_portal_fqdn": {"readonly": True}, } _attribute_map = { - 'identity': {'key': 'identity', 'type': 'ManagedClusterIdentity'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'power_state': {'key': 'properties.powerState', 'type': 'PowerState'}, - 'max_agent_pools': {'key': 'properties.maxAgentPools', 'type': 'int'}, - 'kubernetes_version': {'key': 'properties.kubernetesVersion', 'type': 'str'}, - 'dns_prefix': {'key': 'properties.dnsPrefix', 'type': 'str'}, - 'fqdn_subdomain': {'key': 'properties.fqdnSubdomain', 'type': 'str'}, - 'fqdn': {'key': 'properties.fqdn', 'type': 'str'}, - 'private_fqdn': {'key': 'properties.privateFQDN', 'type': 'str'}, - 'azure_portal_fqdn': {'key': 'properties.azurePortalFQDN', 'type': 'str'}, - 'agent_pool_profiles': {'key': 'properties.agentPoolProfiles', 'type': '[ManagedClusterAgentPoolProfile]'}, - 'linux_profile': {'key': 'properties.linuxProfile', 'type': 'ContainerServiceLinuxProfile'}, - 'windows_profile': {'key': 'properties.windowsProfile', 'type': 'ManagedClusterWindowsProfile'}, - 'service_principal_profile': {'key': 'properties.servicePrincipalProfile', 'type': 'ManagedClusterServicePrincipalProfile'}, - 'addon_profiles': {'key': 'properties.addonProfiles', 'type': '{ManagedClusterAddonProfile}'}, - 'pod_identity_profile': {'key': 'properties.podIdentityProfile', 'type': 'ManagedClusterPodIdentityProfile'}, - 'node_resource_group': {'key': 'properties.nodeResourceGroup', 'type': 'str'}, - 'enable_rbac': {'key': 'properties.enableRBAC', 'type': 'bool'}, - 'enable_pod_security_policy': {'key': 'properties.enablePodSecurityPolicy', 'type': 'bool'}, - 'network_profile': {'key': 'properties.networkProfile', 'type': 'ContainerServiceNetworkProfile'}, - 'aad_profile': {'key': 'properties.aadProfile', 'type': 'ManagedClusterAADProfile'}, - 'auto_upgrade_profile': {'key': 'properties.autoUpgradeProfile', 'type': 'ManagedClusterAutoUpgradeProfile'}, - 'auto_scaler_profile': {'key': 'properties.autoScalerProfile', 'type': 'ManagedClusterPropertiesAutoScalerProfile'}, - 'api_server_access_profile': {'key': 'properties.apiServerAccessProfile', 'type': 'ManagedClusterAPIServerAccessProfile'}, - 'disk_encryption_set_id': {'key': 'properties.diskEncryptionSetID', 'type': 'str'}, - 'identity_profile': {'key': 'properties.identityProfile', 'type': '{ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties}'}, - 'private_link_resources': {'key': 'properties.privateLinkResources', 'type': '[PrivateLinkResource]'}, - 'disable_local_accounts': {'key': 'properties.disableLocalAccounts', 'type': 'bool'}, - 'http_proxy_config': {'key': 'properties.httpProxyConfig', 'type': 'ManagedClusterHTTPProxyConfig'}, + "identity": {"key": "identity", "type": "ManagedClusterIdentity"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "power_state": {"key": "properties.powerState", "type": "PowerState"}, + "max_agent_pools": {"key": "properties.maxAgentPools", "type": "int"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "dns_prefix": {"key": "properties.dnsPrefix", "type": "str"}, + "fqdn_subdomain": {"key": "properties.fqdnSubdomain", "type": "str"}, + "fqdn": {"key": "properties.fqdn", "type": "str"}, + "private_fqdn": {"key": "properties.privateFQDN", "type": "str"}, + "azure_portal_fqdn": {"key": "properties.azurePortalFQDN", "type": "str"}, + "agent_pool_profiles": {"key": "properties.agentPoolProfiles", "type": "[ManagedClusterAgentPoolProfile]"}, + "linux_profile": {"key": "properties.linuxProfile", "type": "ContainerServiceLinuxProfile"}, + "windows_profile": {"key": "properties.windowsProfile", "type": "ManagedClusterWindowsProfile"}, + "service_principal_profile": { + "key": "properties.servicePrincipalProfile", + "type": "ManagedClusterServicePrincipalProfile", + }, + "addon_profiles": {"key": "properties.addonProfiles", "type": "{ManagedClusterAddonProfile}"}, + "pod_identity_profile": {"key": "properties.podIdentityProfile", "type": "ManagedClusterPodIdentityProfile"}, + "node_resource_group": {"key": "properties.nodeResourceGroup", "type": "str"}, + "enable_rbac": {"key": "properties.enableRBAC", "type": "bool"}, + "enable_pod_security_policy": {"key": "properties.enablePodSecurityPolicy", "type": "bool"}, + "network_profile": {"key": "properties.networkProfile", "type": "ContainerServiceNetworkProfile"}, + "aad_profile": {"key": "properties.aadProfile", "type": "ManagedClusterAADProfile"}, + "auto_upgrade_profile": {"key": "properties.autoUpgradeProfile", "type": "ManagedClusterAutoUpgradeProfile"}, + "auto_scaler_profile": { + "key": "properties.autoScalerProfile", + "type": "ManagedClusterPropertiesAutoScalerProfile", + }, + "api_server_access_profile": { + "key": "properties.apiServerAccessProfile", + "type": "ManagedClusterAPIServerAccessProfile", + }, + "disk_encryption_set_id": {"key": "properties.diskEncryptionSetID", "type": "str"}, + "identity_profile": { + "key": "properties.identityProfile", + "type": "{ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties}", + }, + "private_link_resources": {"key": "properties.privateLinkResources", "type": "[PrivateLinkResource]"}, + "disable_local_accounts": {"key": "properties.disableLocalAccounts", "type": "bool"}, + "http_proxy_config": {"key": "properties.httpProxyConfig", "type": "ManagedClusterHTTPProxyConfig"}, } - def __init__( + def __init__( # pylint: disable=too-many-locals self, *, identity: Optional["_models.ManagedClusterIdentity"] = None, @@ -876,7 +870,12 @@ def __init__( auto_scaler_profile: Optional["_models.ManagedClusterPropertiesAutoScalerProfile"] = None, api_server_access_profile: Optional["_models.ManagedClusterAPIServerAccessProfile"] = None, disk_encryption_set_id: Optional[str] = None, - identity_profile: Optional[Dict[str, "_models.ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties"]] = None, + identity_profile: Optional[ + Dict[ + str, + "_models.ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties", + ] + ] = None, private_link_resources: Optional[List["_models.PrivateLinkResource"]] = None, disable_local_accounts: Optional[bool] = None, http_proxy_config: Optional["_models.ManagedClusterHTTPProxyConfig"] = None, @@ -951,7 +950,7 @@ def __init__( :paramtype http_proxy_config: ~azure.mgmt.containerservice.v2021_03_01.models.ManagedClusterHTTPProxyConfig """ - super(Components1Q1Og48SchemasManagedclusterAllof1, self).__init__(**kwargs) + super().__init__(**kwargs) self.identity = identity self.provisioning_state = None self.power_state = None @@ -983,7 +982,9 @@ def __init__( self.http_proxy_config = http_proxy_config -class Components1Umhcm8SchemasManagedclusteridentityPropertiesUserassignedidentitiesAdditionalproperties(msrest.serialization.Model): +class Components1Umhcm8SchemasManagedclusteridentityPropertiesUserassignedidentitiesAdditionalproperties( + _serialization.Model +): """Components1Umhcm8SchemasManagedclusteridentityPropertiesUserassignedidentitiesAdditionalproperties. Variables are only populated by the server, and will be ignored when sending a request. @@ -995,27 +996,23 @@ class Components1Umhcm8SchemasManagedclusteridentityPropertiesUserassignedidenti """ _validation = { - 'principal_id': {'readonly': True}, - 'client_id': {'readonly': True}, + "principal_id": {"readonly": True}, + "client_id": {"readonly": True}, } _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, + "principal_id": {"key": "principalId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(Components1Umhcm8SchemasManagedclusteridentityPropertiesUserassignedidentitiesAdditionalproperties, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.principal_id = None self.client_id = None -class UserAssignedIdentity(msrest.serialization.Model): +class UserAssignedIdentity(_serialization.Model): """UserAssignedIdentity. :ivar resource_id: The resource id of the user assigned identity. @@ -1027,9 +1024,9 @@ class UserAssignedIdentity(msrest.serialization.Model): """ _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'object_id': {'key': 'objectId', 'type': 'str'}, + "resource_id": {"key": "resourceId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + "object_id": {"key": "objectId", "type": "str"}, } def __init__( @@ -1048,13 +1045,15 @@ def __init__( :keyword object_id: The object id of the user assigned identity. :paramtype object_id: str """ - super(UserAssignedIdentity, self).__init__(**kwargs) + super().__init__(**kwargs) self.resource_id = resource_id self.client_id = client_id self.object_id = object_id -class ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties(UserAssignedIdentity): +class ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties( + UserAssignedIdentity +): """ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties. :ivar resource_id: The resource id of the user assigned identity. @@ -1066,9 +1065,9 @@ class ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAd """ _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'object_id': {'key': 'objectId', 'type': 'str'}, + "resource_id": {"key": "resourceId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + "object_id": {"key": "objectId", "type": "str"}, } def __init__( @@ -1087,83 +1086,72 @@ def __init__( :keyword object_id: The object id of the user assigned identity. :paramtype object_id: str """ - super(ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties, self).__init__(resource_id=resource_id, client_id=client_id, object_id=object_id, **kwargs) + super().__init__(resource_id=resource_id, client_id=client_id, object_id=object_id, **kwargs) -class ContainerServiceDiagnosticsProfile(msrest.serialization.Model): +class ContainerServiceDiagnosticsProfile(_serialization.Model): """Profile for diagnostics on the container service cluster. All required parameters must be populated in order to send to Azure. - :ivar vm_diagnostics: Required. Profile for diagnostics on the container service VMs. + :ivar vm_diagnostics: Profile for diagnostics on the container service VMs. Required. :vartype vm_diagnostics: ~azure.mgmt.containerservice.v2021_03_01.models.ContainerServiceVMDiagnostics """ _validation = { - 'vm_diagnostics': {'required': True}, + "vm_diagnostics": {"required": True}, } _attribute_map = { - 'vm_diagnostics': {'key': 'vmDiagnostics', 'type': 'ContainerServiceVMDiagnostics'}, + "vm_diagnostics": {"key": "vmDiagnostics", "type": "ContainerServiceVMDiagnostics"}, } - def __init__( - self, - *, - vm_diagnostics: "_models.ContainerServiceVMDiagnostics", - **kwargs - ): + def __init__(self, *, vm_diagnostics: "_models.ContainerServiceVMDiagnostics", **kwargs): """ - :keyword vm_diagnostics: Required. Profile for diagnostics on the container service VMs. + :keyword vm_diagnostics: Profile for diagnostics on the container service VMs. Required. :paramtype vm_diagnostics: ~azure.mgmt.containerservice.v2021_03_01.models.ContainerServiceVMDiagnostics """ - super(ContainerServiceDiagnosticsProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.vm_diagnostics = vm_diagnostics -class ContainerServiceLinuxProfile(msrest.serialization.Model): +class ContainerServiceLinuxProfile(_serialization.Model): """Profile for Linux VMs in the container service cluster. All required parameters must be populated in order to send to Azure. - :ivar admin_username: Required. The administrator username to use for Linux VMs. + :ivar admin_username: The administrator username to use for Linux VMs. Required. :vartype admin_username: str - :ivar ssh: Required. SSH configuration for Linux-based VMs running on Azure. + :ivar ssh: SSH configuration for Linux-based VMs running on Azure. Required. :vartype ssh: ~azure.mgmt.containerservice.v2021_03_01.models.ContainerServiceSshConfiguration """ _validation = { - 'admin_username': {'required': True, 'pattern': r'^[A-Za-z][-A-Za-z0-9_]*$'}, - 'ssh': {'required': True}, + "admin_username": {"required": True, "pattern": r"^[A-Za-z][-A-Za-z0-9_]*$"}, + "ssh": {"required": True}, } _attribute_map = { - 'admin_username': {'key': 'adminUsername', 'type': 'str'}, - 'ssh': {'key': 'ssh', 'type': 'ContainerServiceSshConfiguration'}, + "admin_username": {"key": "adminUsername", "type": "str"}, + "ssh": {"key": "ssh", "type": "ContainerServiceSshConfiguration"}, } - def __init__( - self, - *, - admin_username: str, - ssh: "_models.ContainerServiceSshConfiguration", - **kwargs - ): + def __init__(self, *, admin_username: str, ssh: "_models.ContainerServiceSshConfiguration", **kwargs): """ - :keyword admin_username: Required. The administrator username to use for Linux VMs. + :keyword admin_username: The administrator username to use for Linux VMs. Required. :paramtype admin_username: str - :keyword ssh: Required. SSH configuration for Linux-based VMs running on Azure. + :keyword ssh: SSH configuration for Linux-based VMs running on Azure. Required. :paramtype ssh: ~azure.mgmt.containerservice.v2021_03_01.models.ContainerServiceSshConfiguration """ - super(ContainerServiceLinuxProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.admin_username = admin_username self.ssh = ssh -class ContainerServiceMasterProfile(msrest.serialization.Model): +class ContainerServiceMasterProfile(_serialization.Model): """Profile for the container service master. Variables are only populated by the server, and will be ignored when sending a request. @@ -1171,11 +1159,11 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar count: Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, - and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". + and 5. The default value is 1. Known values are: 1, 3, and 5. :vartype count: int or ~azure.mgmt.containerservice.v2021_03_01.models.Count - :ivar dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. + :ivar dns_prefix: DNS prefix to be used to create the FQDN for the master pool. Required. :vartype dns_prefix: str - :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + :ivar vm_size: Size of agent VMs. Required. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -1212,7 +1200,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :vartype vm_size: str or ~azure.mgmt.containerservice.v2021_03_01.models.ContainerServiceVMSizeTypes :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine @@ -1226,7 +1214,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): :vartype first_consecutive_static_ip: str :ivar storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount" and "ManagedDisks". :vartype storage_profile: str or ~azure.mgmt.containerservice.v2021_03_01.models.ContainerServiceStorageProfileTypes :ivar fqdn: FQDN for the master pool. @@ -1234,21 +1222,21 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): """ _validation = { - 'dns_prefix': {'required': True}, - 'vm_size': {'required': True}, - 'os_disk_size_gb': {'maximum': 2048, 'minimum': 0}, - 'fqdn': {'readonly': True}, + "dns_prefix": {"required": True}, + "vm_size": {"required": True}, + "os_disk_size_gb": {"maximum": 2048, "minimum": 0}, + "fqdn": {"readonly": True}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'dns_prefix': {'key': 'dnsPrefix', 'type': 'str'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'first_consecutive_static_ip': {'key': 'firstConsecutiveStaticIP', 'type': 'str'}, - 'storage_profile': {'key': 'storageProfile', 'type': 'str'}, - 'fqdn': {'key': 'fqdn', 'type': 'str'}, + "count": {"key": "count", "type": "int"}, + "dns_prefix": {"key": "dnsPrefix", "type": "str"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "first_consecutive_static_ip": {"key": "firstConsecutiveStaticIP", "type": "str"}, + "storage_profile": {"key": "storageProfile", "type": "str"}, + "fqdn": {"key": "fqdn", "type": "str"}, } def __init__( @@ -1256,20 +1244,20 @@ def __init__( *, dns_prefix: str, vm_size: Union[str, "_models.ContainerServiceVMSizeTypes"], - count: Optional[Union[int, "_models.Count"]] = 1, + count: Union[int, "_models.Count"] = 1, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, - first_consecutive_static_ip: Optional[str] = "10.240.255.5", + first_consecutive_static_ip: str = "10.240.255.5", storage_profile: Optional[Union[str, "_models.ContainerServiceStorageProfileTypes"]] = None, **kwargs ): """ :keyword count: Number of masters (VMs) in the container service cluster. Allowed values are 1, - 3, and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". + 3, and 5. The default value is 1. Known values are: 1, 3, and 5. :paramtype count: int or ~azure.mgmt.containerservice.v2021_03_01.models.Count - :keyword dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. + :keyword dns_prefix: DNS prefix to be used to create the FQDN for the master pool. Required. :paramtype dns_prefix: str - :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + :keyword vm_size: Size of agent VMs. Required. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -1306,7 +1294,7 @@ def __init__( "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :paramtype vm_size: str or ~azure.mgmt.containerservice.v2021_03_01.models.ContainerServiceVMSizeTypes :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every @@ -1320,11 +1308,11 @@ def __init__( :paramtype first_consecutive_static_ip: str :keyword storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount" and "ManagedDisks". :paramtype storage_profile: str or ~azure.mgmt.containerservice.v2021_03_01.models.ContainerServiceStorageProfileTypes """ - super(ContainerServiceMasterProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.dns_prefix = dns_prefix self.vm_size = vm_size @@ -1335,17 +1323,17 @@ def __init__( self.fqdn = None -class ContainerServiceNetworkProfile(msrest.serialization.Model): +class ContainerServiceNetworkProfile(_serialization.Model): """Profile of network configuration. :ivar network_plugin: Network plugin used for building Kubernetes network. Known values are: - "azure", "kubenet". Default value: "kubenet". + "azure" and "kubenet". :vartype network_plugin: str or ~azure.mgmt.containerservice.v2021_03_01.models.NetworkPlugin :ivar network_policy: Network policy used for building Kubernetes network. Known values are: - "calico", "azure". + "calico" and "azure". :vartype network_policy: str or ~azure.mgmt.containerservice.v2021_03_01.models.NetworkPolicy :ivar network_mode: Network mode used for building Kubernetes network. Known values are: - "transparent", "bridge". + "transparent" and "bridge". :vartype network_mode: str or ~azure.mgmt.containerservice.v2021_03_01.models.NetworkMode :ivar pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :vartype pod_cidr: str @@ -1358,11 +1346,11 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): :ivar docker_bridge_cidr: A CIDR notation IP range assigned to the Docker bridge network. It must not overlap with any Subnet IP ranges or the Kubernetes service address range. :vartype docker_bridge_cidr: str - :ivar outbound_type: The outbound (egress) routing method. Known values are: "loadBalancer", - "userDefinedRouting". Default value: "loadBalancer". + :ivar outbound_type: The outbound (egress) routing method. Known values are: "loadBalancer" and + "userDefinedRouting". :vartype outbound_type: str or ~azure.mgmt.containerservice.v2021_03_01.models.OutboundType :ivar load_balancer_sku: The load balancer sku for the managed cluster. Known values are: - "standard", "basic". + "standard" and "basic". :vartype load_balancer_sku: str or ~azure.mgmt.containerservice.v2021_03_01.models.LoadBalancerSku :ivar load_balancer_profile: Profile of the cluster load balancer. @@ -1371,49 +1359,51 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): """ _validation = { - 'pod_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, - 'service_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, - 'dns_service_ip': {'pattern': r'^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$'}, - 'docker_bridge_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, + "pod_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, + "service_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, + "dns_service_ip": { + "pattern": r"^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$" + }, + "docker_bridge_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, } _attribute_map = { - 'network_plugin': {'key': 'networkPlugin', 'type': 'str'}, - 'network_policy': {'key': 'networkPolicy', 'type': 'str'}, - 'network_mode': {'key': 'networkMode', 'type': 'str'}, - 'pod_cidr': {'key': 'podCidr', 'type': 'str'}, - 'service_cidr': {'key': 'serviceCidr', 'type': 'str'}, - 'dns_service_ip': {'key': 'dnsServiceIP', 'type': 'str'}, - 'docker_bridge_cidr': {'key': 'dockerBridgeCidr', 'type': 'str'}, - 'outbound_type': {'key': 'outboundType', 'type': 'str'}, - 'load_balancer_sku': {'key': 'loadBalancerSku', 'type': 'str'}, - 'load_balancer_profile': {'key': 'loadBalancerProfile', 'type': 'ManagedClusterLoadBalancerProfile'}, + "network_plugin": {"key": "networkPlugin", "type": "str"}, + "network_policy": {"key": "networkPolicy", "type": "str"}, + "network_mode": {"key": "networkMode", "type": "str"}, + "pod_cidr": {"key": "podCidr", "type": "str"}, + "service_cidr": {"key": "serviceCidr", "type": "str"}, + "dns_service_ip": {"key": "dnsServiceIP", "type": "str"}, + "docker_bridge_cidr": {"key": "dockerBridgeCidr", "type": "str"}, + "outbound_type": {"key": "outboundType", "type": "str"}, + "load_balancer_sku": {"key": "loadBalancerSku", "type": "str"}, + "load_balancer_profile": {"key": "loadBalancerProfile", "type": "ManagedClusterLoadBalancerProfile"}, } def __init__( self, *, - network_plugin: Optional[Union[str, "_models.NetworkPlugin"]] = "kubenet", + network_plugin: Union[str, "_models.NetworkPlugin"] = "kubenet", network_policy: Optional[Union[str, "_models.NetworkPolicy"]] = None, network_mode: Optional[Union[str, "_models.NetworkMode"]] = None, - pod_cidr: Optional[str] = "10.244.0.0/16", - service_cidr: Optional[str] = "10.0.0.0/16", - dns_service_ip: Optional[str] = "10.0.0.10", - docker_bridge_cidr: Optional[str] = "172.17.0.1/16", - outbound_type: Optional[Union[str, "_models.OutboundType"]] = "loadBalancer", + pod_cidr: str = "10.244.0.0/16", + service_cidr: str = "10.0.0.0/16", + dns_service_ip: str = "10.0.0.10", + docker_bridge_cidr: str = "172.17.0.1/16", + outbound_type: Union[str, "_models.OutboundType"] = "loadBalancer", load_balancer_sku: Optional[Union[str, "_models.LoadBalancerSku"]] = None, load_balancer_profile: Optional["_models.ManagedClusterLoadBalancerProfile"] = None, **kwargs ): """ :keyword network_plugin: Network plugin used for building Kubernetes network. Known values are: - "azure", "kubenet". Default value: "kubenet". + "azure" and "kubenet". :paramtype network_plugin: str or ~azure.mgmt.containerservice.v2021_03_01.models.NetworkPlugin :keyword network_policy: Network policy used for building Kubernetes network. Known values are: - "calico", "azure". + "calico" and "azure". :paramtype network_policy: str or ~azure.mgmt.containerservice.v2021_03_01.models.NetworkPolicy :keyword network_mode: Network mode used for building Kubernetes network. Known values are: - "transparent", "bridge". + "transparent" and "bridge". :paramtype network_mode: str or ~azure.mgmt.containerservice.v2021_03_01.models.NetworkMode :keyword pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :paramtype pod_cidr: str @@ -1426,18 +1416,18 @@ def __init__( :keyword docker_bridge_cidr: A CIDR notation IP range assigned to the Docker bridge network. It must not overlap with any Subnet IP ranges or the Kubernetes service address range. :paramtype docker_bridge_cidr: str - :keyword outbound_type: The outbound (egress) routing method. Known values are: "loadBalancer", - "userDefinedRouting". Default value: "loadBalancer". + :keyword outbound_type: The outbound (egress) routing method. Known values are: "loadBalancer" + and "userDefinedRouting". :paramtype outbound_type: str or ~azure.mgmt.containerservice.v2021_03_01.models.OutboundType :keyword load_balancer_sku: The load balancer sku for the managed cluster. Known values are: - "standard", "basic". + "standard" and "basic". :paramtype load_balancer_sku: str or ~azure.mgmt.containerservice.v2021_03_01.models.LoadBalancerSku :keyword load_balancer_profile: Profile of the cluster load balancer. :paramtype load_balancer_profile: ~azure.mgmt.containerservice.v2021_03_01.models.ManagedClusterLoadBalancerProfile """ - super(ContainerServiceNetworkProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.network_plugin = network_plugin self.network_policy = network_policy self.network_mode = network_mode @@ -1450,113 +1440,98 @@ def __init__( self.load_balancer_profile = load_balancer_profile -class ContainerServiceSshConfiguration(msrest.serialization.Model): +class ContainerServiceSshConfiguration(_serialization.Model): """SSH configuration for Linux-based VMs running on Azure. All required parameters must be populated in order to send to Azure. - :ivar public_keys: Required. The list of SSH public keys used to authenticate with Linux-based - VMs. Only expect one key specified. + :ivar public_keys: The list of SSH public keys used to authenticate with Linux-based VMs. Only + expect one key specified. Required. :vartype public_keys: list[~azure.mgmt.containerservice.v2021_03_01.models.ContainerServiceSshPublicKey] """ _validation = { - 'public_keys': {'required': True}, + "public_keys": {"required": True}, } _attribute_map = { - 'public_keys': {'key': 'publicKeys', 'type': '[ContainerServiceSshPublicKey]'}, + "public_keys": {"key": "publicKeys", "type": "[ContainerServiceSshPublicKey]"}, } - def __init__( - self, - *, - public_keys: List["_models.ContainerServiceSshPublicKey"], - **kwargs - ): + def __init__(self, *, public_keys: List["_models.ContainerServiceSshPublicKey"], **kwargs): """ - :keyword public_keys: Required. The list of SSH public keys used to authenticate with - Linux-based VMs. Only expect one key specified. + :keyword public_keys: The list of SSH public keys used to authenticate with Linux-based VMs. + Only expect one key specified. Required. :paramtype public_keys: list[~azure.mgmt.containerservice.v2021_03_01.models.ContainerServiceSshPublicKey] """ - super(ContainerServiceSshConfiguration, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_keys = public_keys -class ContainerServiceSshPublicKey(msrest.serialization.Model): +class ContainerServiceSshPublicKey(_serialization.Model): """Contains information about SSH certificate public key data. All required parameters must be populated in order to send to Azure. - :ivar key_data: Required. Certificate public key used to authenticate with VMs through SSH. The - certificate must be in PEM format with or without headers. + :ivar key_data: Certificate public key used to authenticate with VMs through SSH. The + certificate must be in PEM format with or without headers. Required. :vartype key_data: str """ _validation = { - 'key_data': {'required': True}, + "key_data": {"required": True}, } _attribute_map = { - 'key_data': {'key': 'keyData', 'type': 'str'}, + "key_data": {"key": "keyData", "type": "str"}, } - def __init__( - self, - *, - key_data: str, - **kwargs - ): + def __init__(self, *, key_data: str, **kwargs): """ - :keyword key_data: Required. Certificate public key used to authenticate with VMs through SSH. - The certificate must be in PEM format with or without headers. + :keyword key_data: Certificate public key used to authenticate with VMs through SSH. The + certificate must be in PEM format with or without headers. Required. :paramtype key_data: str """ - super(ContainerServiceSshPublicKey, self).__init__(**kwargs) + super().__init__(**kwargs) self.key_data = key_data -class ContainerServiceVMDiagnostics(msrest.serialization.Model): +class ContainerServiceVMDiagnostics(_serialization.Model): """Profile for diagnostics on the container service VMs. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar enabled: Required. Whether the VM diagnostic agent is provisioned on the VM. + :ivar enabled: Whether the VM diagnostic agent is provisioned on the VM. Required. :vartype enabled: bool :ivar storage_uri: The URI of the storage account where diagnostics are stored. :vartype storage_uri: str """ _validation = { - 'enabled': {'required': True}, - 'storage_uri': {'readonly': True}, + "enabled": {"required": True}, + "storage_uri": {"readonly": True}, } _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'storage_uri': {'key': 'storageUri', 'type': 'str'}, + "enabled": {"key": "enabled", "type": "bool"}, + "storage_uri": {"key": "storageUri", "type": "str"}, } - def __init__( - self, - *, - enabled: bool, - **kwargs - ): + def __init__(self, *, enabled: bool, **kwargs): """ - :keyword enabled: Required. Whether the VM diagnostic agent is provisioned on the VM. + :keyword enabled: Whether the VM diagnostic agent is provisioned on the VM. Required. :paramtype enabled: bool """ - super(ContainerServiceVMDiagnostics, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.storage_uri = None -class CredentialResult(msrest.serialization.Model): +class CredentialResult(_serialization.Model): """The credential result response. Variables are only populated by the server, and will be ignored when sending a request. @@ -1564,31 +1539,27 @@ class CredentialResult(msrest.serialization.Model): :ivar name: The name of the credential. :vartype name: str :ivar value: Base64-encoded Kubernetes configuration file. - :vartype value: bytearray + :vartype value: bytes """ _validation = { - 'name': {'readonly': True}, - 'value': {'readonly': True}, + "name": {"readonly": True}, + "value": {"readonly": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'bytearray'}, + "name": {"key": "name", "type": "str"}, + "value": {"key": "value", "type": "bytearray"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(CredentialResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.name = None self.value = None -class CredentialResults(msrest.serialization.Model): +class CredentialResults(_serialization.Model): """The list of credential result response. Variables are only populated by the server, and will be ignored when sending a request. @@ -1598,35 +1569,31 @@ class CredentialResults(msrest.serialization.Model): """ _validation = { - 'kubeconfigs': {'readonly': True}, + "kubeconfigs": {"readonly": True}, } _attribute_map = { - 'kubeconfigs': {'key': 'kubeconfigs', 'type': '[CredentialResult]'}, + "kubeconfigs": {"key": "kubeconfigs", "type": "[CredentialResult]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(CredentialResults, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.kubeconfigs = None -class ExtendedLocation(msrest.serialization.Model): +class ExtendedLocation(_serialization.Model): """The complex type of the extended location. :ivar name: The name of the extended location. :vartype name: str - :ivar type: The type of the extended location. Known values are: "EdgeZone". + :ivar type: The type of the extended location. "EdgeZone" :vartype type: str or ~azure.mgmt.containerservice.v2021_03_01.models.ExtendedLocationTypes """ _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, } def __init__( @@ -1639,15 +1606,15 @@ def __init__( """ :keyword name: The name of the extended location. :paramtype name: str - :keyword type: The type of the extended location. Known values are: "EdgeZone". + :keyword type: The type of the extended location. "EdgeZone" :paramtype type: str or ~azure.mgmt.containerservice.v2021_03_01.models.ExtendedLocationTypes """ - super(ExtendedLocation, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.type = type -class KubeletConfig(msrest.serialization.Model): +class KubeletConfig(_serialization.Model): # pylint: disable=too-many-instance-attributes """Kubelet configurations of agent nodes. :ivar cpu_manager_policy: CPU Manager policy to use. @@ -1681,21 +1648,21 @@ class KubeletConfig(msrest.serialization.Model): """ _validation = { - 'container_log_max_files': {'minimum': 2}, + "container_log_max_files": {"minimum": 2}, } _attribute_map = { - 'cpu_manager_policy': {'key': 'cpuManagerPolicy', 'type': 'str'}, - 'cpu_cfs_quota': {'key': 'cpuCfsQuota', 'type': 'bool'}, - 'cpu_cfs_quota_period': {'key': 'cpuCfsQuotaPeriod', 'type': 'str'}, - 'image_gc_high_threshold': {'key': 'imageGcHighThreshold', 'type': 'int'}, - 'image_gc_low_threshold': {'key': 'imageGcLowThreshold', 'type': 'int'}, - 'topology_manager_policy': {'key': 'topologyManagerPolicy', 'type': 'str'}, - 'allowed_unsafe_sysctls': {'key': 'allowedUnsafeSysctls', 'type': '[str]'}, - 'fail_swap_on': {'key': 'failSwapOn', 'type': 'bool'}, - 'container_log_max_size_mb': {'key': 'containerLogMaxSizeMB', 'type': 'int'}, - 'container_log_max_files': {'key': 'containerLogMaxFiles', 'type': 'int'}, - 'pod_max_pids': {'key': 'podMaxPids', 'type': 'int'}, + "cpu_manager_policy": {"key": "cpuManagerPolicy", "type": "str"}, + "cpu_cfs_quota": {"key": "cpuCfsQuota", "type": "bool"}, + "cpu_cfs_quota_period": {"key": "cpuCfsQuotaPeriod", "type": "str"}, + "image_gc_high_threshold": {"key": "imageGcHighThreshold", "type": "int"}, + "image_gc_low_threshold": {"key": "imageGcLowThreshold", "type": "int"}, + "topology_manager_policy": {"key": "topologyManagerPolicy", "type": "str"}, + "allowed_unsafe_sysctls": {"key": "allowedUnsafeSysctls", "type": "[str]"}, + "fail_swap_on": {"key": "failSwapOn", "type": "bool"}, + "container_log_max_size_mb": {"key": "containerLogMaxSizeMB", "type": "int"}, + "container_log_max_files": {"key": "containerLogMaxFiles", "type": "int"}, + "pod_max_pids": {"key": "podMaxPids", "type": "int"}, } def __init__( @@ -1745,7 +1712,7 @@ def __init__( :keyword pod_max_pids: The maximum number of processes per pod. :paramtype pod_max_pids: int """ - super(KubeletConfig, self).__init__(**kwargs) + super().__init__(**kwargs) self.cpu_manager_policy = cpu_manager_policy self.cpu_cfs_quota = cpu_cfs_quota self.cpu_cfs_quota_period = cpu_cfs_quota_period @@ -1759,7 +1726,7 @@ def __init__( self.pod_max_pids = pod_max_pids -class LinuxOSConfig(msrest.serialization.Model): +class LinuxOSConfig(_serialization.Model): """OS configurations of Linux agent nodes. :ivar sysctls: Sysctl settings for Linux agent nodes. @@ -1774,10 +1741,10 @@ class LinuxOSConfig(msrest.serialization.Model): """ _attribute_map = { - 'sysctls': {'key': 'sysctls', 'type': 'SysctlConfig'}, - 'transparent_huge_page_enabled': {'key': 'transparentHugePageEnabled', 'type': 'str'}, - 'transparent_huge_page_defrag': {'key': 'transparentHugePageDefrag', 'type': 'str'}, - 'swap_file_size_mb': {'key': 'swapFileSizeMB', 'type': 'int'}, + "sysctls": {"key": "sysctls", "type": "SysctlConfig"}, + "transparent_huge_page_enabled": {"key": "transparentHugePageEnabled", "type": "str"}, + "transparent_huge_page_defrag": {"key": "transparentHugePageDefrag", "type": "str"}, + "swap_file_size_mb": {"key": "swapFileSizeMB", "type": "int"}, } def __init__( @@ -1800,7 +1767,7 @@ def __init__( on each node. :paramtype swap_file_size_mb: int """ - super(LinuxOSConfig, self).__init__(**kwargs) + super().__init__(**kwargs) self.sysctls = sysctls self.transparent_huge_page_enabled = transparent_huge_page_enabled self.transparent_huge_page_defrag = transparent_huge_page_defrag @@ -1828,19 +1795,19 @@ class MaintenanceConfiguration(SubResource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, + "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'}, - 'time_in_week': {'key': 'properties.timeInWeek', 'type': '[TimeInWeek]'}, - 'not_allowed_time': {'key': 'properties.notAllowedTime', 'type': '[TimeSpan]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "time_in_week": {"key": "properties.timeInWeek", "type": "[TimeInWeek]"}, + "not_allowed_time": {"key": "properties.notAllowedTime", "type": "[TimeSpan]"}, } def __init__( @@ -1856,13 +1823,13 @@ def __init__( :keyword not_allowed_time: Time slots on which upgrade is not allowed. :paramtype not_allowed_time: list[~azure.mgmt.containerservice.v2021_03_01.models.TimeSpan] """ - super(MaintenanceConfiguration, self).__init__(**kwargs) + super().__init__(**kwargs) self.system_data = None self.time_in_week = time_in_week self.not_allowed_time = not_allowed_time -class MaintenanceConfigurationListResult(msrest.serialization.Model): +class MaintenanceConfigurationListResult(_serialization.Model): """The response from the List maintenance configurations operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -1874,31 +1841,26 @@ class MaintenanceConfigurationListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[MaintenanceConfiguration]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[MaintenanceConfiguration]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.MaintenanceConfiguration"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.MaintenanceConfiguration"]] = None, **kwargs): """ :keyword value: The list of maintenance configurations. :paramtype value: list[~azure.mgmt.containerservice.v2021_03_01.models.MaintenanceConfiguration] """ - super(MaintenanceConfigurationListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class Resource(msrest.serialization.Model): +class Resource(_serialization.Model): """The Resource model definition. Variables are only populated by the server, and will be ignored when sending a request. @@ -1911,41 +1873,35 @@ class Resource(msrest.serialization.Model): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] """ - super(Resource, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -1953,7 +1909,9 @@ def __init__( self.tags = tags -class ManagedCluster(Resource, Components1Q1Og48SchemasManagedclusterAllof1): +class ManagedCluster( + Resource, Components1Q1Og48SchemasManagedclusterAllof1 +): # pylint: disable=too-many-instance-attributes """Managed cluster. Variables are only populated by the server, and will be ignored when sending a request. @@ -2044,9 +2002,9 @@ class ManagedCluster(Resource, Components1Q1Og48SchemasManagedclusterAllof1): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar sku: The managed cluster SKU. :vartype sku: ~azure.mgmt.containerservice.v2021_03_01.models.ManagedClusterSKU @@ -2055,58 +2013,70 @@ class ManagedCluster(Resource, Components1Q1Og48SchemasManagedclusterAllof1): """ _validation = { - 'provisioning_state': {'readonly': True}, - 'power_state': {'readonly': True}, - 'max_agent_pools': {'readonly': True}, - 'fqdn': {'readonly': True}, - 'private_fqdn': {'readonly': True}, - 'azure_portal_fqdn': {'readonly': True}, - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, + "provisioning_state": {"readonly": True}, + "power_state": {"readonly": True}, + "max_agent_pools": {"readonly": True}, + "fqdn": {"readonly": True}, + "private_fqdn": {"readonly": True}, + "azure_portal_fqdn": {"readonly": True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { - 'identity': {'key': 'identity', 'type': 'ManagedClusterIdentity'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'power_state': {'key': 'properties.powerState', 'type': 'PowerState'}, - 'max_agent_pools': {'key': 'properties.maxAgentPools', 'type': 'int'}, - 'kubernetes_version': {'key': 'properties.kubernetesVersion', 'type': 'str'}, - 'dns_prefix': {'key': 'properties.dnsPrefix', 'type': 'str'}, - 'fqdn_subdomain': {'key': 'properties.fqdnSubdomain', 'type': 'str'}, - 'fqdn': {'key': 'properties.fqdn', 'type': 'str'}, - 'private_fqdn': {'key': 'properties.privateFQDN', 'type': 'str'}, - 'azure_portal_fqdn': {'key': 'properties.azurePortalFQDN', 'type': 'str'}, - 'agent_pool_profiles': {'key': 'properties.agentPoolProfiles', 'type': '[ManagedClusterAgentPoolProfile]'}, - 'linux_profile': {'key': 'properties.linuxProfile', 'type': 'ContainerServiceLinuxProfile'}, - 'windows_profile': {'key': 'properties.windowsProfile', 'type': 'ManagedClusterWindowsProfile'}, - 'service_principal_profile': {'key': 'properties.servicePrincipalProfile', 'type': 'ManagedClusterServicePrincipalProfile'}, - 'addon_profiles': {'key': 'properties.addonProfiles', 'type': '{ManagedClusterAddonProfile}'}, - 'pod_identity_profile': {'key': 'properties.podIdentityProfile', 'type': 'ManagedClusterPodIdentityProfile'}, - 'node_resource_group': {'key': 'properties.nodeResourceGroup', 'type': 'str'}, - 'enable_rbac': {'key': 'properties.enableRBAC', 'type': 'bool'}, - 'enable_pod_security_policy': {'key': 'properties.enablePodSecurityPolicy', 'type': 'bool'}, - 'network_profile': {'key': 'properties.networkProfile', 'type': 'ContainerServiceNetworkProfile'}, - 'aad_profile': {'key': 'properties.aadProfile', 'type': 'ManagedClusterAADProfile'}, - 'auto_upgrade_profile': {'key': 'properties.autoUpgradeProfile', 'type': 'ManagedClusterAutoUpgradeProfile'}, - 'auto_scaler_profile': {'key': 'properties.autoScalerProfile', 'type': 'ManagedClusterPropertiesAutoScalerProfile'}, - 'api_server_access_profile': {'key': 'properties.apiServerAccessProfile', 'type': 'ManagedClusterAPIServerAccessProfile'}, - 'disk_encryption_set_id': {'key': 'properties.diskEncryptionSetID', 'type': 'str'}, - 'identity_profile': {'key': 'properties.identityProfile', 'type': '{ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties}'}, - 'private_link_resources': {'key': 'properties.privateLinkResources', 'type': '[PrivateLinkResource]'}, - 'disable_local_accounts': {'key': 'properties.disableLocalAccounts', 'type': 'bool'}, - 'http_proxy_config': {'key': 'properties.httpProxyConfig', 'type': 'ManagedClusterHTTPProxyConfig'}, - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'ManagedClusterSKU'}, - 'extended_location': {'key': 'extendedLocation', 'type': 'ExtendedLocation'}, + "identity": {"key": "identity", "type": "ManagedClusterIdentity"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "power_state": {"key": "properties.powerState", "type": "PowerState"}, + "max_agent_pools": {"key": "properties.maxAgentPools", "type": "int"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "dns_prefix": {"key": "properties.dnsPrefix", "type": "str"}, + "fqdn_subdomain": {"key": "properties.fqdnSubdomain", "type": "str"}, + "fqdn": {"key": "properties.fqdn", "type": "str"}, + "private_fqdn": {"key": "properties.privateFQDN", "type": "str"}, + "azure_portal_fqdn": {"key": "properties.azurePortalFQDN", "type": "str"}, + "agent_pool_profiles": {"key": "properties.agentPoolProfiles", "type": "[ManagedClusterAgentPoolProfile]"}, + "linux_profile": {"key": "properties.linuxProfile", "type": "ContainerServiceLinuxProfile"}, + "windows_profile": {"key": "properties.windowsProfile", "type": "ManagedClusterWindowsProfile"}, + "service_principal_profile": { + "key": "properties.servicePrincipalProfile", + "type": "ManagedClusterServicePrincipalProfile", + }, + "addon_profiles": {"key": "properties.addonProfiles", "type": "{ManagedClusterAddonProfile}"}, + "pod_identity_profile": {"key": "properties.podIdentityProfile", "type": "ManagedClusterPodIdentityProfile"}, + "node_resource_group": {"key": "properties.nodeResourceGroup", "type": "str"}, + "enable_rbac": {"key": "properties.enableRBAC", "type": "bool"}, + "enable_pod_security_policy": {"key": "properties.enablePodSecurityPolicy", "type": "bool"}, + "network_profile": {"key": "properties.networkProfile", "type": "ContainerServiceNetworkProfile"}, + "aad_profile": {"key": "properties.aadProfile", "type": "ManagedClusterAADProfile"}, + "auto_upgrade_profile": {"key": "properties.autoUpgradeProfile", "type": "ManagedClusterAutoUpgradeProfile"}, + "auto_scaler_profile": { + "key": "properties.autoScalerProfile", + "type": "ManagedClusterPropertiesAutoScalerProfile", + }, + "api_server_access_profile": { + "key": "properties.apiServerAccessProfile", + "type": "ManagedClusterAPIServerAccessProfile", + }, + "disk_encryption_set_id": {"key": "properties.diskEncryptionSetID", "type": "str"}, + "identity_profile": { + "key": "properties.identityProfile", + "type": "{ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties}", + }, + "private_link_resources": {"key": "properties.privateLinkResources", "type": "[PrivateLinkResource]"}, + "disable_local_accounts": {"key": "properties.disableLocalAccounts", "type": "bool"}, + "http_proxy_config": {"key": "properties.httpProxyConfig", "type": "ManagedClusterHTTPProxyConfig"}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "sku": {"key": "sku", "type": "ManagedClusterSKU"}, + "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, } - def __init__( + def __init__( # pylint: disable=too-many-locals self, *, location: str, @@ -2129,7 +2099,12 @@ def __init__( auto_scaler_profile: Optional["_models.ManagedClusterPropertiesAutoScalerProfile"] = None, api_server_access_profile: Optional["_models.ManagedClusterAPIServerAccessProfile"] = None, disk_encryption_set_id: Optional[str] = None, - identity_profile: Optional[Dict[str, "_models.ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties"]] = None, + identity_profile: Optional[ + Dict[ + str, + "_models.ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties", + ] + ] = None, private_link_resources: Optional[List["_models.PrivateLinkResource"]] = None, disable_local_accounts: Optional[bool] = None, http_proxy_config: Optional["_models.ManagedClusterHTTPProxyConfig"] = None, @@ -2206,16 +2181,43 @@ def __init__( servers. :paramtype http_proxy_config: ~azure.mgmt.containerservice.v2021_03_01.models.ManagedClusterHTTPProxyConfig - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword sku: The managed cluster SKU. :paramtype sku: ~azure.mgmt.containerservice.v2021_03_01.models.ManagedClusterSKU :keyword extended_location: The extended location of the Virtual Machine. :paramtype extended_location: ~azure.mgmt.containerservice.v2021_03_01.models.ExtendedLocation """ - super(ManagedCluster, self).__init__(location=location, tags=tags, identity=identity, kubernetes_version=kubernetes_version, dns_prefix=dns_prefix, fqdn_subdomain=fqdn_subdomain, agent_pool_profiles=agent_pool_profiles, linux_profile=linux_profile, windows_profile=windows_profile, service_principal_profile=service_principal_profile, addon_profiles=addon_profiles, pod_identity_profile=pod_identity_profile, node_resource_group=node_resource_group, enable_rbac=enable_rbac, enable_pod_security_policy=enable_pod_security_policy, network_profile=network_profile, aad_profile=aad_profile, auto_upgrade_profile=auto_upgrade_profile, auto_scaler_profile=auto_scaler_profile, api_server_access_profile=api_server_access_profile, disk_encryption_set_id=disk_encryption_set_id, identity_profile=identity_profile, private_link_resources=private_link_resources, disable_local_accounts=disable_local_accounts, http_proxy_config=http_proxy_config, **kwargs) + super().__init__( + location=location, + tags=tags, + identity=identity, + kubernetes_version=kubernetes_version, + dns_prefix=dns_prefix, + fqdn_subdomain=fqdn_subdomain, + agent_pool_profiles=agent_pool_profiles, + linux_profile=linux_profile, + windows_profile=windows_profile, + service_principal_profile=service_principal_profile, + addon_profiles=addon_profiles, + pod_identity_profile=pod_identity_profile, + node_resource_group=node_resource_group, + enable_rbac=enable_rbac, + enable_pod_security_policy=enable_pod_security_policy, + network_profile=network_profile, + aad_profile=aad_profile, + auto_upgrade_profile=auto_upgrade_profile, + auto_scaler_profile=auto_scaler_profile, + api_server_access_profile=api_server_access_profile, + disk_encryption_set_id=disk_encryption_set_id, + identity_profile=identity_profile, + private_link_resources=private_link_resources, + disable_local_accounts=disable_local_accounts, + http_proxy_config=http_proxy_config, + **kwargs + ) self.identity = identity self.provisioning_state = None self.power_state = None @@ -2254,7 +2256,7 @@ def __init__( self.tags = tags -class ManagedClusterAADProfile(msrest.serialization.Model): +class ManagedClusterAADProfile(_serialization.Model): """AADProfile specifies attributes for Azure Active Directory integration. :ivar managed: Whether to enable managed AAD. @@ -2275,13 +2277,13 @@ class ManagedClusterAADProfile(msrest.serialization.Model): """ _attribute_map = { - 'managed': {'key': 'managed', 'type': 'bool'}, - 'enable_azure_rbac': {'key': 'enableAzureRBAC', 'type': 'bool'}, - 'admin_group_object_i_ds': {'key': 'adminGroupObjectIDs', 'type': '[str]'}, - 'client_app_id': {'key': 'clientAppID', 'type': 'str'}, - 'server_app_id': {'key': 'serverAppID', 'type': 'str'}, - 'server_app_secret': {'key': 'serverAppSecret', 'type': 'str'}, - 'tenant_id': {'key': 'tenantID', 'type': 'str'}, + "managed": {"key": "managed", "type": "bool"}, + "enable_azure_rbac": {"key": "enableAzureRBAC", "type": "bool"}, + "admin_group_object_i_ds": {"key": "adminGroupObjectIDs", "type": "[str]"}, + "client_app_id": {"key": "clientAppID", "type": "str"}, + "server_app_id": {"key": "serverAppID", "type": "str"}, + "server_app_secret": {"key": "serverAppSecret", "type": "str"}, + "tenant_id": {"key": "tenantID", "type": "str"}, } def __init__( @@ -2314,7 +2316,7 @@ def __init__( tenant of the deployment subscription. :paramtype tenant_id: str """ - super(ManagedClusterAADProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.managed = managed self.enable_azure_rbac = enable_azure_rbac self.admin_group_object_i_ds = admin_group_object_i_ds @@ -2337,58 +2339,53 @@ class ManagedClusterAccessProfile(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar kube_config: Base64-encoded Kubernetes configuration file. - :vartype kube_config: bytearray + :vartype kube_config: bytes """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'kube_config': {'key': 'properties.kubeConfig', 'type': 'bytearray'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "kube_config": {"key": "properties.kubeConfig", "type": "bytearray"}, } def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - kube_config: Optional[bytearray] = None, - **kwargs + self, *, location: str, tags: Optional[Dict[str, str]] = None, kube_config: Optional[bytes] = None, **kwargs ): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword kube_config: Base64-encoded Kubernetes configuration file. - :paramtype kube_config: bytearray + :paramtype kube_config: bytes """ - super(ManagedClusterAccessProfile, self).__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.kube_config = kube_config -class ManagedClusterAddonProfile(msrest.serialization.Model): +class ManagedClusterAddonProfile(_serialization.Model): """A Kubernetes add-on profile for a managed cluster. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar enabled: Required. Whether the add-on is enabled or not. + :ivar enabled: Whether the add-on is enabled or not. Required. :vartype enabled: bool :ivar config: Key-value pairs for configuring an add-on. :vartype config: dict[str, str] @@ -2398,30 +2395,24 @@ class ManagedClusterAddonProfile(msrest.serialization.Model): """ _validation = { - 'enabled': {'required': True}, - 'identity': {'readonly': True}, + "enabled": {"required": True}, + "identity": {"readonly": True}, } _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'config': {'key': 'config', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'ManagedClusterAddonProfileIdentity'}, + "enabled": {"key": "enabled", "type": "bool"}, + "config": {"key": "config", "type": "{str}"}, + "identity": {"key": "identity", "type": "ManagedClusterAddonProfileIdentity"}, } - def __init__( - self, - *, - enabled: bool, - config: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, enabled: bool, config: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword enabled: Required. Whether the add-on is enabled or not. + :keyword enabled: Whether the add-on is enabled or not. Required. :paramtype enabled: bool :keyword config: Key-value pairs for configuring an add-on. :paramtype config: dict[str, str] """ - super(ManagedClusterAddonProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.config = config self.identity = None @@ -2439,9 +2430,9 @@ class ManagedClusterAddonProfileIdentity(UserAssignedIdentity): """ _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'object_id': {'key': 'objectId', 'type': 'str'}, + "resource_id": {"key": "resourceId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + "object_id": {"key": "objectId", "type": "str"}, } def __init__( @@ -2460,10 +2451,10 @@ def __init__( :keyword object_id: The object id of the user assigned identity. :paramtype object_id: str """ - super(ManagedClusterAddonProfileIdentity, self).__init__(resource_id=resource_id, client_id=client_id, object_id=object_id, **kwargs) + super().__init__(resource_id=resource_id, client_id=client_id, object_id=object_id, **kwargs) -class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): +class ManagedClusterAgentPoolProfileProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes """Properties for the container service agent pool profile. Variables are only populated by the server, and will be ignored when sending a request. @@ -2481,11 +2472,11 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar os_disk_type: OS disk type to be used for machines in a given agent pool. Allowed values are 'Ephemeral' and 'Managed'. If unspecified, defaults to 'Ephemeral' when the VM supports ephemeral OS and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults - to 'Managed'. May not be changed after creation. Known values are: "Managed", "Ephemeral". + to 'Managed'. May not be changed after creation. Known values are: "Managed" and "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2021_03_01.models.OSDiskType :ivar kubelet_disk_type: KubeletDiskType determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. Currently allows one value, OS, - resulting in Kubelet using the OS disk for data. Known values are: "OS", "Temporary". + resulting in Kubelet using the OS disk for data. Known values are: "OS" and "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2021_03_01.models.KubeletDiskType :ivar vnet_subnet_id: VNet SubnetID specifies the VNet's subnet identifier for nodes and maybe @@ -2496,10 +2487,11 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Known values are: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux" and "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2021_03_01.models.OSType :ivar os_sku: OsSKU to be used to specify os sku. Choose from Ubuntu(default) and CBLMariner - for Linux OSType. Not applicable to Windows OSType. Known values are: "Ubuntu", "CBLMariner". + for Linux OSType. Not applicable to Windows OSType. Known values are: "Ubuntu" and + "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2021_03_01.models.OSSKU :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -2508,9 +2500,10 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar type: AgentPoolType represents types of an agent pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2021_03_01.models.AgentPoolType - :ivar mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", "User". + :ivar mode: AgentPoolMode represents mode of an agent pool. Known values are: "System" and + "User". :vartype mode: str or ~azure.mgmt.containerservice.v2021_03_01.models.AgentPoolMode :ivar orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -2534,20 +2527,19 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): IP Prefix. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Known values are: "Spot", "Regular". Default value: "Regular". + priority. Default to regular. Known values are: "Spot" and "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2021_03_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy - for Spot virtual machine scale set. Default to Delete. Known values are: "Delete", - "Deallocate". Default value: "Delete". + for Spot virtual machine scale set. Default to Delete. Known values are: "Delete" and + "Deallocate". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2021_03_01.models.ScaleSetEvictionPolicy :ivar spot_max_price: SpotMaxPrice to be used to specify the maximum price you are willing to pay in US Dollars. Possible values are any decimal value greater than zero or -1 which indicates default price to be up-to on-demand. :vartype spot_max_price: float - :ivar tags: A set of tags. Agent pool tags to be persisted on the agent pool virtual machine - scale set. + :ivar tags: Agent pool tags to be persisted on the agent pool virtual machine scale set. :vartype tags: dict[str, str] :ivar node_labels: Agent pool node labels to be persisted across all nodes in agent pool. :vartype node_labels: dict[str, str] @@ -2566,57 +2558,57 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile for supported GPU VM SKU. Supported values are MIG1g, MIG2g, MIG3g, MIG4g and MIG7g. Known - values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2021_03_01.models.GPUInstanceProfile """ _validation = { - 'os_disk_size_gb': {'maximum': 2048, 'minimum': 0}, - 'node_image_version': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'power_state': {'readonly': True}, + "os_disk_size_gb": {"maximum": 2048, "minimum": 0}, + "node_image_version": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "power_state": {"readonly": True}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'os_disk_type': {'key': 'osDiskType', 'type': 'str'}, - 'kubelet_disk_type': {'key': 'kubeletDiskType', 'type': 'str'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'pod_subnet_id': {'key': 'podSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'maxPods', 'type': 'int'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'os_sku': {'key': 'osSKU', 'type': 'str'}, - 'max_count': {'key': 'maxCount', 'type': 'int'}, - 'min_count': {'key': 'minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'enableAutoScaling', 'type': 'bool'}, - 'type': {'key': 'type', 'type': 'str'}, - 'mode': {'key': 'mode', 'type': 'str'}, - 'orchestrator_version': {'key': 'orchestratorVersion', 'type': 'str'}, - 'node_image_version': {'key': 'nodeImageVersion', 'type': 'str'}, - 'upgrade_settings': {'key': 'upgradeSettings', 'type': 'AgentPoolUpgradeSettings'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'power_state': {'key': 'powerState', 'type': 'PowerState'}, - 'availability_zones': {'key': 'availabilityZones', 'type': '[str]'}, - 'enable_node_public_ip': {'key': 'enableNodePublicIP', 'type': 'bool'}, - 'node_public_ip_prefix_id': {'key': 'nodePublicIPPrefixID', 'type': 'str'}, - 'scale_set_priority': {'key': 'scaleSetPriority', 'type': 'str'}, - 'scale_set_eviction_policy': {'key': 'scaleSetEvictionPolicy', 'type': 'str'}, - 'spot_max_price': {'key': 'spotMaxPrice', 'type': 'float'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'node_labels': {'key': 'nodeLabels', 'type': '{str}'}, - 'node_taints': {'key': 'nodeTaints', 'type': '[str]'}, - 'proximity_placement_group_id': {'key': 'proximityPlacementGroupID', 'type': 'str'}, - 'kubelet_config': {'key': 'kubeletConfig', 'type': 'KubeletConfig'}, - 'linux_os_config': {'key': 'linuxOSConfig', 'type': 'LinuxOSConfig'}, - 'enable_encryption_at_host': {'key': 'enableEncryptionAtHost', 'type': 'bool'}, - 'enable_fips': {'key': 'enableFIPS', 'type': 'bool'}, - 'gpu_instance_profile': {'key': 'gpuInstanceProfile', 'type': 'str'}, + "count": {"key": "count", "type": "int"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "os_disk_type": {"key": "osDiskType", "type": "str"}, + "kubelet_disk_type": {"key": "kubeletDiskType", "type": "str"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "pod_subnet_id": {"key": "podSubnetID", "type": "str"}, + "max_pods": {"key": "maxPods", "type": "int"}, + "os_type": {"key": "osType", "type": "str"}, + "os_sku": {"key": "osSKU", "type": "str"}, + "max_count": {"key": "maxCount", "type": "int"}, + "min_count": {"key": "minCount", "type": "int"}, + "enable_auto_scaling": {"key": "enableAutoScaling", "type": "bool"}, + "type": {"key": "type", "type": "str"}, + "mode": {"key": "mode", "type": "str"}, + "orchestrator_version": {"key": "orchestratorVersion", "type": "str"}, + "node_image_version": {"key": "nodeImageVersion", "type": "str"}, + "upgrade_settings": {"key": "upgradeSettings", "type": "AgentPoolUpgradeSettings"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "power_state": {"key": "powerState", "type": "PowerState"}, + "availability_zones": {"key": "availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "enableNodePublicIP", "type": "bool"}, + "node_public_ip_prefix_id": {"key": "nodePublicIPPrefixID", "type": "str"}, + "scale_set_priority": {"key": "scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "scaleSetEvictionPolicy", "type": "str"}, + "spot_max_price": {"key": "spotMaxPrice", "type": "float"}, + "tags": {"key": "tags", "type": "{str}"}, + "node_labels": {"key": "nodeLabels", "type": "{str}"}, + "node_taints": {"key": "nodeTaints", "type": "[str]"}, + "proximity_placement_group_id": {"key": "proximityPlacementGroupID", "type": "str"}, + "kubelet_config": {"key": "kubeletConfig", "type": "KubeletConfig"}, + "linux_os_config": {"key": "linuxOSConfig", "type": "LinuxOSConfig"}, + "enable_encryption_at_host": {"key": "enableEncryptionAtHost", "type": "bool"}, + "enable_fips": {"key": "enableFIPS", "type": "bool"}, + "gpu_instance_profile": {"key": "gpuInstanceProfile", "type": "str"}, } - def __init__( + def __init__( # pylint: disable=too-many-locals self, *, count: Optional[int] = None, @@ -2627,7 +2619,7 @@ def __init__( vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, @@ -2639,9 +2631,9 @@ def __init__( availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", - spot_max_price: Optional[float] = -1, + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", + spot_max_price: float = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, @@ -2667,12 +2659,12 @@ def __init__( :keyword os_disk_type: OS disk type to be used for machines in a given agent pool. Allowed values are 'Ephemeral' and 'Managed'. If unspecified, defaults to 'Ephemeral' when the VM supports ephemeral OS and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, - defaults to 'Managed'. May not be changed after creation. Known values are: "Managed", + defaults to 'Managed'. May not be changed after creation. Known values are: "Managed" and "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2021_03_01.models.OSDiskType :keyword kubelet_disk_type: KubeletDiskType determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. Currently allows one value, OS, - resulting in Kubelet using the OS disk for data. Known values are: "OS", "Temporary". + resulting in Kubelet using the OS disk for data. Known values are: "OS" and "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2021_03_01.models.KubeletDiskType :keyword vnet_subnet_id: VNet SubnetID specifies the VNet's subnet identifier for nodes and @@ -2683,10 +2675,11 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux" and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2021_03_01.models.OSType :keyword os_sku: OsSKU to be used to specify os sku. Choose from Ubuntu(default) and CBLMariner - for Linux OSType. Not applicable to Windows OSType. Known values are: "Ubuntu", "CBLMariner". + for Linux OSType. Not applicable to Windows OSType. Known values are: "Ubuntu" and + "CBLMariner". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2021_03_01.models.OSSKU :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -2695,9 +2688,9 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword type: AgentPoolType represents types of an agent pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2021_03_01.models.AgentPoolType - :keyword mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", + :keyword mode: AgentPoolMode represents mode of an agent pool. Known values are: "System" and "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2021_03_01.models.AgentPoolMode :keyword orchestrator_version: Version of orchestrator specified when creating the managed @@ -2715,20 +2708,19 @@ def __init__( Public IP Prefix. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Known values are: "Spot", "Regular". Default value: "Regular". + priority. Default to regular. Known values are: "Spot" and "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2021_03_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction - policy for Spot virtual machine scale set. Default to Delete. Known values are: "Delete", - "Deallocate". Default value: "Delete". + policy for Spot virtual machine scale set. Default to Delete. Known values are: "Delete" and + "Deallocate". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2021_03_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: SpotMaxPrice to be used to specify the maximum price you are willing to pay in US Dollars. Possible values are any decimal value greater than zero or -1 which indicates default price to be up-to on-demand. :paramtype spot_max_price: float - :keyword tags: A set of tags. Agent pool tags to be persisted on the agent pool virtual machine - scale set. + :keyword tags: Agent pool tags to be persisted on the agent pool virtual machine scale set. :paramtype tags: dict[str, str] :keyword node_labels: Agent pool node labels to be persisted across all nodes in agent pool. :paramtype node_labels: dict[str, str] @@ -2747,11 +2739,11 @@ def __init__( :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile for supported GPU VM SKU. Supported values are MIG1g, MIG2g, MIG3g, MIG4g and MIG7g. - Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2021_03_01.models.GPUInstanceProfile """ - super(ManagedClusterAgentPoolProfileProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.vm_size = vm_size self.os_disk_size_gb = os_disk_size_gb @@ -2789,7 +2781,9 @@ def __init__( self.gpu_instance_profile = gpu_instance_profile -class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): +class ManagedClusterAgentPoolProfile( + ManagedClusterAgentPoolProfileProperties +): # pylint: disable=too-many-instance-attributes """Profile for the container service agent pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -2809,11 +2803,11 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar os_disk_type: OS disk type to be used for machines in a given agent pool. Allowed values are 'Ephemeral' and 'Managed'. If unspecified, defaults to 'Ephemeral' when the VM supports ephemeral OS and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults - to 'Managed'. May not be changed after creation. Known values are: "Managed", "Ephemeral". + to 'Managed'. May not be changed after creation. Known values are: "Managed" and "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2021_03_01.models.OSDiskType :ivar kubelet_disk_type: KubeletDiskType determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. Currently allows one value, OS, - resulting in Kubelet using the OS disk for data. Known values are: "OS", "Temporary". + resulting in Kubelet using the OS disk for data. Known values are: "OS" and "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2021_03_01.models.KubeletDiskType :ivar vnet_subnet_id: VNet SubnetID specifies the VNet's subnet identifier for nodes and maybe @@ -2824,10 +2818,11 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Known values are: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux" and "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2021_03_01.models.OSType :ivar os_sku: OsSKU to be used to specify os sku. Choose from Ubuntu(default) and CBLMariner - for Linux OSType. Not applicable to Windows OSType. Known values are: "Ubuntu", "CBLMariner". + for Linux OSType. Not applicable to Windows OSType. Known values are: "Ubuntu" and + "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2021_03_01.models.OSSKU :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -2836,9 +2831,10 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar type: AgentPoolType represents types of an agent pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2021_03_01.models.AgentPoolType - :ivar mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", "User". + :ivar mode: AgentPoolMode represents mode of an agent pool. Known values are: "System" and + "User". :vartype mode: str or ~azure.mgmt.containerservice.v2021_03_01.models.AgentPoolMode :ivar orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -2862,20 +2858,19 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): IP Prefix. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Known values are: "Spot", "Regular". Default value: "Regular". + priority. Default to regular. Known values are: "Spot" and "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2021_03_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy - for Spot virtual machine scale set. Default to Delete. Known values are: "Delete", - "Deallocate". Default value: "Delete". + for Spot virtual machine scale set. Default to Delete. Known values are: "Delete" and + "Deallocate". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2021_03_01.models.ScaleSetEvictionPolicy :ivar spot_max_price: SpotMaxPrice to be used to specify the maximum price you are willing to pay in US Dollars. Possible values are any decimal value greater than zero or -1 which indicates default price to be up-to on-demand. :vartype spot_max_price: float - :ivar tags: A set of tags. Agent pool tags to be persisted on the agent pool virtual machine - scale set. + :ivar tags: Agent pool tags to be persisted on the agent pool virtual machine scale set. :vartype tags: dict[str, str] :ivar node_labels: Agent pool node labels to be persisted across all nodes in agent pool. :vartype node_labels: dict[str, str] @@ -2894,62 +2889,62 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile for supported GPU VM SKU. Supported values are MIG1g, MIG2g, MIG3g, MIG4g and MIG7g. Known - values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2021_03_01.models.GPUInstanceProfile - :ivar name: Required. Unique name of the agent pool profile in the context of the subscription - and resource group. + :ivar name: Unique name of the agent pool profile in the context of the subscription and + resource group. Required. :vartype name: str """ _validation = { - 'os_disk_size_gb': {'maximum': 2048, 'minimum': 0}, - 'node_image_version': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'power_state': {'readonly': True}, - 'name': {'required': True, 'pattern': r'^[a-z][a-z0-9]{0,11}$'}, + "os_disk_size_gb": {"maximum": 2048, "minimum": 0}, + "node_image_version": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "power_state": {"readonly": True}, + "name": {"required": True, "pattern": r"^[a-z][a-z0-9]{0,11}$"}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'os_disk_type': {'key': 'osDiskType', 'type': 'str'}, - 'kubelet_disk_type': {'key': 'kubeletDiskType', 'type': 'str'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'pod_subnet_id': {'key': 'podSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'maxPods', 'type': 'int'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'os_sku': {'key': 'osSKU', 'type': 'str'}, - 'max_count': {'key': 'maxCount', 'type': 'int'}, - 'min_count': {'key': 'minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'enableAutoScaling', 'type': 'bool'}, - 'type': {'key': 'type', 'type': 'str'}, - 'mode': {'key': 'mode', 'type': 'str'}, - 'orchestrator_version': {'key': 'orchestratorVersion', 'type': 'str'}, - 'node_image_version': {'key': 'nodeImageVersion', 'type': 'str'}, - 'upgrade_settings': {'key': 'upgradeSettings', 'type': 'AgentPoolUpgradeSettings'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'power_state': {'key': 'powerState', 'type': 'PowerState'}, - 'availability_zones': {'key': 'availabilityZones', 'type': '[str]'}, - 'enable_node_public_ip': {'key': 'enableNodePublicIP', 'type': 'bool'}, - 'node_public_ip_prefix_id': {'key': 'nodePublicIPPrefixID', 'type': 'str'}, - 'scale_set_priority': {'key': 'scaleSetPriority', 'type': 'str'}, - 'scale_set_eviction_policy': {'key': 'scaleSetEvictionPolicy', 'type': 'str'}, - 'spot_max_price': {'key': 'spotMaxPrice', 'type': 'float'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'node_labels': {'key': 'nodeLabels', 'type': '{str}'}, - 'node_taints': {'key': 'nodeTaints', 'type': '[str]'}, - 'proximity_placement_group_id': {'key': 'proximityPlacementGroupID', 'type': 'str'}, - 'kubelet_config': {'key': 'kubeletConfig', 'type': 'KubeletConfig'}, - 'linux_os_config': {'key': 'linuxOSConfig', 'type': 'LinuxOSConfig'}, - 'enable_encryption_at_host': {'key': 'enableEncryptionAtHost', 'type': 'bool'}, - 'enable_fips': {'key': 'enableFIPS', 'type': 'bool'}, - 'gpu_instance_profile': {'key': 'gpuInstanceProfile', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, + "count": {"key": "count", "type": "int"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "os_disk_type": {"key": "osDiskType", "type": "str"}, + "kubelet_disk_type": {"key": "kubeletDiskType", "type": "str"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "pod_subnet_id": {"key": "podSubnetID", "type": "str"}, + "max_pods": {"key": "maxPods", "type": "int"}, + "os_type": {"key": "osType", "type": "str"}, + "os_sku": {"key": "osSKU", "type": "str"}, + "max_count": {"key": "maxCount", "type": "int"}, + "min_count": {"key": "minCount", "type": "int"}, + "enable_auto_scaling": {"key": "enableAutoScaling", "type": "bool"}, + "type": {"key": "type", "type": "str"}, + "mode": {"key": "mode", "type": "str"}, + "orchestrator_version": {"key": "orchestratorVersion", "type": "str"}, + "node_image_version": {"key": "nodeImageVersion", "type": "str"}, + "upgrade_settings": {"key": "upgradeSettings", "type": "AgentPoolUpgradeSettings"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "power_state": {"key": "powerState", "type": "PowerState"}, + "availability_zones": {"key": "availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "enableNodePublicIP", "type": "bool"}, + "node_public_ip_prefix_id": {"key": "nodePublicIPPrefixID", "type": "str"}, + "scale_set_priority": {"key": "scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "scaleSetEvictionPolicy", "type": "str"}, + "spot_max_price": {"key": "spotMaxPrice", "type": "float"}, + "tags": {"key": "tags", "type": "{str}"}, + "node_labels": {"key": "nodeLabels", "type": "{str}"}, + "node_taints": {"key": "nodeTaints", "type": "[str]"}, + "proximity_placement_group_id": {"key": "proximityPlacementGroupID", "type": "str"}, + "kubelet_config": {"key": "kubeletConfig", "type": "KubeletConfig"}, + "linux_os_config": {"key": "linuxOSConfig", "type": "LinuxOSConfig"}, + "enable_encryption_at_host": {"key": "enableEncryptionAtHost", "type": "bool"}, + "enable_fips": {"key": "enableFIPS", "type": "bool"}, + "gpu_instance_profile": {"key": "gpuInstanceProfile", "type": "str"}, + "name": {"key": "name", "type": "str"}, } - def __init__( + def __init__( # pylint: disable=too-many-locals self, *, name: str, @@ -2961,7 +2956,7 @@ def __init__( vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, @@ -2973,9 +2968,9 @@ def __init__( availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", - spot_max_price: Optional[float] = -1, + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", + spot_max_price: float = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, @@ -3001,12 +2996,12 @@ def __init__( :keyword os_disk_type: OS disk type to be used for machines in a given agent pool. Allowed values are 'Ephemeral' and 'Managed'. If unspecified, defaults to 'Ephemeral' when the VM supports ephemeral OS and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, - defaults to 'Managed'. May not be changed after creation. Known values are: "Managed", + defaults to 'Managed'. May not be changed after creation. Known values are: "Managed" and "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2021_03_01.models.OSDiskType :keyword kubelet_disk_type: KubeletDiskType determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. Currently allows one value, OS, - resulting in Kubelet using the OS disk for data. Known values are: "OS", "Temporary". + resulting in Kubelet using the OS disk for data. Known values are: "OS" and "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2021_03_01.models.KubeletDiskType :keyword vnet_subnet_id: VNet SubnetID specifies the VNet's subnet identifier for nodes and @@ -3017,10 +3012,11 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux" and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2021_03_01.models.OSType :keyword os_sku: OsSKU to be used to specify os sku. Choose from Ubuntu(default) and CBLMariner - for Linux OSType. Not applicable to Windows OSType. Known values are: "Ubuntu", "CBLMariner". + for Linux OSType. Not applicable to Windows OSType. Known values are: "Ubuntu" and + "CBLMariner". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2021_03_01.models.OSSKU :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -3029,9 +3025,9 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword type: AgentPoolType represents types of an agent pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2021_03_01.models.AgentPoolType - :keyword mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", + :keyword mode: AgentPoolMode represents mode of an agent pool. Known values are: "System" and "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2021_03_01.models.AgentPoolMode :keyword orchestrator_version: Version of orchestrator specified when creating the managed @@ -3049,20 +3045,19 @@ def __init__( Public IP Prefix. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Known values are: "Spot", "Regular". Default value: "Regular". + priority. Default to regular. Known values are: "Spot" and "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2021_03_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction - policy for Spot virtual machine scale set. Default to Delete. Known values are: "Delete", - "Deallocate". Default value: "Delete". + policy for Spot virtual machine scale set. Default to Delete. Known values are: "Delete" and + "Deallocate". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2021_03_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: SpotMaxPrice to be used to specify the maximum price you are willing to pay in US Dollars. Possible values are any decimal value greater than zero or -1 which indicates default price to be up-to on-demand. :paramtype spot_max_price: float - :keyword tags: A set of tags. Agent pool tags to be persisted on the agent pool virtual machine - scale set. + :keyword tags: Agent pool tags to be persisted on the agent pool virtual machine scale set. :paramtype tags: dict[str, str] :keyword node_labels: Agent pool node labels to be persisted across all nodes in agent pool. :paramtype node_labels: dict[str, str] @@ -3081,18 +3076,52 @@ def __init__( :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile for supported GPU VM SKU. Supported values are MIG1g, MIG2g, MIG3g, MIG4g and MIG7g. - Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2021_03_01.models.GPUInstanceProfile - :keyword name: Required. Unique name of the agent pool profile in the context of the - subscription and resource group. + :keyword name: Unique name of the agent pool profile in the context of the subscription and + resource group. Required. :paramtype name: str """ - super(ManagedClusterAgentPoolProfile, self).__init__(count=count, vm_size=vm_size, os_disk_size_gb=os_disk_size_gb, os_disk_type=os_disk_type, kubelet_disk_type=kubelet_disk_type, vnet_subnet_id=vnet_subnet_id, pod_subnet_id=pod_subnet_id, max_pods=max_pods, os_type=os_type, os_sku=os_sku, max_count=max_count, min_count=min_count, enable_auto_scaling=enable_auto_scaling, type=type, mode=mode, orchestrator_version=orchestrator_version, upgrade_settings=upgrade_settings, availability_zones=availability_zones, enable_node_public_ip=enable_node_public_ip, node_public_ip_prefix_id=node_public_ip_prefix_id, scale_set_priority=scale_set_priority, scale_set_eviction_policy=scale_set_eviction_policy, spot_max_price=spot_max_price, tags=tags, node_labels=node_labels, node_taints=node_taints, proximity_placement_group_id=proximity_placement_group_id, kubelet_config=kubelet_config, linux_os_config=linux_os_config, enable_encryption_at_host=enable_encryption_at_host, enable_fips=enable_fips, gpu_instance_profile=gpu_instance_profile, **kwargs) + super().__init__( + count=count, + vm_size=vm_size, + os_disk_size_gb=os_disk_size_gb, + os_disk_type=os_disk_type, + kubelet_disk_type=kubelet_disk_type, + vnet_subnet_id=vnet_subnet_id, + pod_subnet_id=pod_subnet_id, + max_pods=max_pods, + os_type=os_type, + os_sku=os_sku, + max_count=max_count, + min_count=min_count, + enable_auto_scaling=enable_auto_scaling, + type=type, + mode=mode, + orchestrator_version=orchestrator_version, + upgrade_settings=upgrade_settings, + availability_zones=availability_zones, + enable_node_public_ip=enable_node_public_ip, + node_public_ip_prefix_id=node_public_ip_prefix_id, + scale_set_priority=scale_set_priority, + scale_set_eviction_policy=scale_set_eviction_policy, + spot_max_price=spot_max_price, + tags=tags, + node_labels=node_labels, + node_taints=node_taints, + proximity_placement_group_id=proximity_placement_group_id, + kubelet_config=kubelet_config, + linux_os_config=linux_os_config, + enable_encryption_at_host=enable_encryption_at_host, + enable_fips=enable_fips, + gpu_instance_profile=gpu_instance_profile, + **kwargs + ) self.name = name -class ManagedClusterAPIServerAccessProfile(msrest.serialization.Model): +class ManagedClusterAPIServerAccessProfile(_serialization.Model): """Access profile for managed cluster API server. :ivar authorized_ip_ranges: Authorized IP Ranges to kubernetes API server. @@ -3104,9 +3133,9 @@ class ManagedClusterAPIServerAccessProfile(msrest.serialization.Model): """ _attribute_map = { - 'authorized_ip_ranges': {'key': 'authorizedIPRanges', 'type': '[str]'}, - 'enable_private_cluster': {'key': 'enablePrivateCluster', 'type': 'bool'}, - 'private_dns_zone': {'key': 'privateDNSZone', 'type': 'str'}, + "authorized_ip_ranges": {"key": "authorizedIPRanges", "type": "[str]"}, + "enable_private_cluster": {"key": "enablePrivateCluster", "type": "bool"}, + "private_dns_zone": {"key": "privateDNSZone", "type": "str"}, } def __init__( @@ -3125,41 +3154,36 @@ def __init__( :keyword private_dns_zone: Private dns zone mode for private cluster. :paramtype private_dns_zone: str """ - super(ManagedClusterAPIServerAccessProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.authorized_ip_ranges = authorized_ip_ranges self.enable_private_cluster = enable_private_cluster self.private_dns_zone = private_dns_zone -class ManagedClusterAutoUpgradeProfile(msrest.serialization.Model): +class ManagedClusterAutoUpgradeProfile(_serialization.Model): """Auto upgrade profile for a managed cluster. :ivar upgrade_channel: upgrade channel for auto upgrade. Known values are: "rapid", "stable", - "patch", "node-image", "none". + "patch", "node-image", and "none". :vartype upgrade_channel: str or ~azure.mgmt.containerservice.v2021_03_01.models.UpgradeChannel """ _attribute_map = { - 'upgrade_channel': {'key': 'upgradeChannel', 'type': 'str'}, + "upgrade_channel": {"key": "upgradeChannel", "type": "str"}, } - def __init__( - self, - *, - upgrade_channel: Optional[Union[str, "_models.UpgradeChannel"]] = None, - **kwargs - ): + def __init__(self, *, upgrade_channel: Optional[Union[str, "_models.UpgradeChannel"]] = None, **kwargs): """ :keyword upgrade_channel: upgrade channel for auto upgrade. Known values are: "rapid", - "stable", "patch", "node-image", "none". + "stable", "patch", "node-image", and "none". :paramtype upgrade_channel: str or ~azure.mgmt.containerservice.v2021_03_01.models.UpgradeChannel """ - super(ManagedClusterAutoUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.upgrade_channel = upgrade_channel -class ManagedClusterHTTPProxyConfig(msrest.serialization.Model): +class ManagedClusterHTTPProxyConfig(_serialization.Model): """Configurations for provisioning the cluster with HTTP proxy servers. :ivar http_proxy: HTTP proxy server endpoint to use. @@ -3173,10 +3197,10 @@ class ManagedClusterHTTPProxyConfig(msrest.serialization.Model): """ _attribute_map = { - 'http_proxy': {'key': 'httpProxy', 'type': 'str'}, - 'https_proxy': {'key': 'httpsProxy', 'type': 'str'}, - 'no_proxy': {'key': 'noProxy', 'type': '[str]'}, - 'trusted_ca': {'key': 'trustedCa', 'type': 'str'}, + "http_proxy": {"key": "httpProxy", "type": "str"}, + "https_proxy": {"key": "httpsProxy", "type": "str"}, + "no_proxy": {"key": "noProxy", "type": "[str]"}, + "trusted_ca": {"key": "trustedCa", "type": "str"}, } def __init__( @@ -3198,14 +3222,14 @@ def __init__( :keyword trusted_ca: Alternative CA cert to use for connecting to proxy servers. :paramtype trusted_ca: str """ - super(ManagedClusterHTTPProxyConfig, self).__init__(**kwargs) + super().__init__(**kwargs) self.http_proxy = http_proxy self.https_proxy = https_proxy self.no_proxy = no_proxy self.trusted_ca = trusted_ca -class ManagedClusterIdentity(msrest.serialization.Model): +class ManagedClusterIdentity(_serialization.Model): """Identity for the managed cluster. Variables are only populated by the server, and will be ignored when sending a request. @@ -3219,7 +3243,7 @@ class ManagedClusterIdentity(msrest.serialization.Model): :ivar type: The type of identity used for the managed cluster. Type 'SystemAssigned' will use an implicitly created identity in master components and an auto-created user assigned identity in MC_ resource group in agent nodes. Type 'None' will not use MSI for the managed cluster, - service principal will be used instead. Known values are: "SystemAssigned", "UserAssigned", + service principal will be used instead. Known values are: "SystemAssigned", "UserAssigned", and "None". :vartype type: str or ~azure.mgmt.containerservice.v2021_03_01.models.ResourceIdentityType :ivar user_assigned_identities: The user identity associated with the managed cluster. This @@ -3231,22 +3255,30 @@ class ManagedClusterIdentity(msrest.serialization.Model): """ _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, + "principal_id": {"readonly": True}, + "tenant_id": {"readonly": True}, } _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{Components1Umhcm8SchemasManagedclusteridentityPropertiesUserassignedidentitiesAdditionalproperties}'}, + "principal_id": {"key": "principalId", "type": "str"}, + "tenant_id": {"key": "tenantId", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "user_assigned_identities": { + "key": "userAssignedIdentities", + "type": "{Components1Umhcm8SchemasManagedclusteridentityPropertiesUserassignedidentitiesAdditionalproperties}", + }, } def __init__( self, *, type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, - user_assigned_identities: Optional[Dict[str, "_models.Components1Umhcm8SchemasManagedclusteridentityPropertiesUserassignedidentitiesAdditionalproperties"]] = None, + user_assigned_identities: Optional[ + Dict[ + str, + "_models.Components1Umhcm8SchemasManagedclusteridentityPropertiesUserassignedidentitiesAdditionalproperties", + ] + ] = None, **kwargs ): """ @@ -3254,7 +3286,7 @@ def __init__( use an implicitly created identity in master components and an auto-created user assigned identity in MC_ resource group in agent nodes. Type 'None' will not use MSI for the managed cluster, service principal will be used instead. Known values are: "SystemAssigned", - "UserAssigned", "None". + "UserAssigned", and "None". :paramtype type: str or ~azure.mgmt.containerservice.v2021_03_01.models.ResourceIdentityType :keyword user_assigned_identities: The user identity associated with the managed cluster. This identity will be used in control plane and only one user assigned identity is allowed. The user @@ -3263,14 +3295,14 @@ def __init__( :paramtype user_assigned_identities: dict[str, ~azure.mgmt.containerservice.v2021_03_01.models.Components1Umhcm8SchemasManagedclusteridentityPropertiesUserassignedidentitiesAdditionalproperties] """ - super(ManagedClusterIdentity, self).__init__(**kwargs) + super().__init__(**kwargs) self.principal_id = None self.tenant_id = None self.type = type self.user_assigned_identities = user_assigned_identities -class ManagedClusterListResult(msrest.serialization.Model): +class ManagedClusterListResult(_serialization.Model): """The response from the List Managed Clusters operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -3282,30 +3314,25 @@ class ManagedClusterListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[ManagedCluster]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[ManagedCluster]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.ManagedCluster"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.ManagedCluster"]] = None, **kwargs): """ :keyword value: The list of managed clusters. :paramtype value: list[~azure.mgmt.containerservice.v2021_03_01.models.ManagedCluster] """ - super(ManagedClusterListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class ManagedClusterLoadBalancerProfile(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfile(_serialization.Model): """Profile of the managed cluster load balancer. :ivar managed_outbound_i_ps: Desired managed outbound IPs for the cluster load balancer. @@ -3331,17 +3358,23 @@ class ManagedClusterLoadBalancerProfile(msrest.serialization.Model): """ _validation = { - 'allocated_outbound_ports': {'maximum': 64000, 'minimum': 0}, - 'idle_timeout_in_minutes': {'maximum': 120, 'minimum': 4}, + "allocated_outbound_ports": {"maximum": 64000, "minimum": 0}, + "idle_timeout_in_minutes": {"maximum": 120, "minimum": 4}, } _attribute_map = { - 'managed_outbound_i_ps': {'key': 'managedOutboundIPs', 'type': 'ManagedClusterLoadBalancerProfileManagedOutboundIPs'}, - 'outbound_ip_prefixes': {'key': 'outboundIPPrefixes', 'type': 'ManagedClusterLoadBalancerProfileOutboundIPPrefixes'}, - 'outbound_i_ps': {'key': 'outboundIPs', 'type': 'ManagedClusterLoadBalancerProfileOutboundIPs'}, - 'effective_outbound_i_ps': {'key': 'effectiveOutboundIPs', 'type': '[ResourceReference]'}, - 'allocated_outbound_ports': {'key': 'allocatedOutboundPorts', 'type': 'int'}, - 'idle_timeout_in_minutes': {'key': 'idleTimeoutInMinutes', 'type': 'int'}, + "managed_outbound_i_ps": { + "key": "managedOutboundIPs", + "type": "ManagedClusterLoadBalancerProfileManagedOutboundIPs", + }, + "outbound_ip_prefixes": { + "key": "outboundIPPrefixes", + "type": "ManagedClusterLoadBalancerProfileOutboundIPPrefixes", + }, + "outbound_i_ps": {"key": "outboundIPs", "type": "ManagedClusterLoadBalancerProfileOutboundIPs"}, + "effective_outbound_i_ps": {"key": "effectiveOutboundIPs", "type": "[ResourceReference]"}, + "allocated_outbound_ports": {"key": "allocatedOutboundPorts", "type": "int"}, + "idle_timeout_in_minutes": {"key": "idleTimeoutInMinutes", "type": "int"}, } def __init__( @@ -3351,8 +3384,8 @@ def __init__( outbound_ip_prefixes: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPPrefixes"] = None, outbound_i_ps: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPs"] = None, effective_outbound_i_ps: Optional[List["_models.ResourceReference"]] = None, - allocated_outbound_ports: Optional[int] = 0, - idle_timeout_in_minutes: Optional[int] = 30, + allocated_outbound_ports: int = 0, + idle_timeout_in_minutes: int = 30, **kwargs ): """ @@ -3378,7 +3411,7 @@ def __init__( must be in the range of 4 to 120 (inclusive). The default value is 30 minutes. :paramtype idle_timeout_in_minutes: int """ - super(ManagedClusterLoadBalancerProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.managed_outbound_i_ps = managed_outbound_i_ps self.outbound_ip_prefixes = outbound_ip_prefixes self.outbound_i_ps = outbound_i_ps @@ -3387,7 +3420,7 @@ def __init__( self.idle_timeout_in_minutes = idle_timeout_in_minutes -class ManagedClusterLoadBalancerProfileManagedOutboundIPs(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfileManagedOutboundIPs(_serialization.Model): """Desired managed outbound IPs for the cluster load balancer. :ivar count: Desired number of outbound IP created/managed by Azure for the cluster load @@ -3396,29 +3429,24 @@ class ManagedClusterLoadBalancerProfileManagedOutboundIPs(msrest.serialization.M """ _validation = { - 'count': {'maximum': 100, 'minimum': 1}, + "count": {"maximum": 100, "minimum": 1}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, + "count": {"key": "count", "type": "int"}, } - def __init__( - self, - *, - count: Optional[int] = 1, - **kwargs - ): + def __init__(self, *, count: int = 1, **kwargs): """ :keyword count: Desired number of outbound IP created/managed by Azure for the cluster load balancer. Allowed values must be in the range of 1 to 100 (inclusive). The default value is 1. :paramtype count: int """ - super(ManagedClusterLoadBalancerProfileManagedOutboundIPs, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count -class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(_serialization.Model): """Desired outbound IP Prefix resources for the cluster load balancer. :ivar public_ip_prefixes: A list of public IP prefix resources. @@ -3427,25 +3455,20 @@ class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(msrest.serialization.M """ _attribute_map = { - 'public_ip_prefixes': {'key': 'publicIPPrefixes', 'type': '[ResourceReference]'}, + "public_ip_prefixes": {"key": "publicIPPrefixes", "type": "[ResourceReference]"}, } - def __init__( - self, - *, - public_ip_prefixes: Optional[List["_models.ResourceReference"]] = None, - **kwargs - ): + def __init__(self, *, public_ip_prefixes: Optional[List["_models.ResourceReference"]] = None, **kwargs): """ :keyword public_ip_prefixes: A list of public IP prefix resources. :paramtype public_ip_prefixes: list[~azure.mgmt.containerservice.v2021_03_01.models.ResourceReference] """ - super(ManagedClusterLoadBalancerProfileOutboundIPPrefixes, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_ip_prefixes = public_ip_prefixes -class ManagedClusterLoadBalancerProfileOutboundIPs(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfileOutboundIPs(_serialization.Model): """Desired outbound IP resources for the cluster load balancer. :ivar public_i_ps: A list of public IP resources. @@ -3453,40 +3476,35 @@ class ManagedClusterLoadBalancerProfileOutboundIPs(msrest.serialization.Model): """ _attribute_map = { - 'public_i_ps': {'key': 'publicIPs', 'type': '[ResourceReference]'}, + "public_i_ps": {"key": "publicIPs", "type": "[ResourceReference]"}, } - def __init__( - self, - *, - public_i_ps: Optional[List["_models.ResourceReference"]] = None, - **kwargs - ): + def __init__(self, *, public_i_ps: Optional[List["_models.ResourceReference"]] = None, **kwargs): """ :keyword public_i_ps: A list of public IP resources. :paramtype public_i_ps: list[~azure.mgmt.containerservice.v2021_03_01.models.ResourceReference] """ - super(ManagedClusterLoadBalancerProfileOutboundIPs, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_i_ps = public_i_ps -class ManagedClusterPodIdentity(msrest.serialization.Model): +class ManagedClusterPodIdentity(_serialization.Model): """ManagedClusterPodIdentity. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar name: Required. Name of the pod identity. + :ivar name: Name of the pod identity. Required. :vartype name: str - :ivar namespace: Required. Namespace of the pod identity. + :ivar namespace: Namespace of the pod identity. Required. :vartype namespace: str :ivar binding_selector: Binding selector to use for the AzureIdentityBinding resource. :vartype binding_selector: str - :ivar identity: Required. Information of the user assigned identity. + :ivar identity: Information of the user assigned identity. Required. :vartype identity: ~azure.mgmt.containerservice.v2021_03_01.models.UserAssignedIdentity :ivar provisioning_state: The current provisioning state of the pod identity. Known values are: - "Assigned", "Updating", "Deleting", "Failed". + "Assigned", "Updating", "Deleting", and "Failed". :vartype provisioning_state: str or ~azure.mgmt.containerservice.v2021_03_01.models.ManagedClusterPodIdentityProvisioningState :ivar provisioning_info: @@ -3495,20 +3513,20 @@ class ManagedClusterPodIdentity(msrest.serialization.Model): """ _validation = { - 'name': {'required': True}, - 'namespace': {'required': True}, - 'identity': {'required': True}, - 'provisioning_state': {'readonly': True}, - 'provisioning_info': {'readonly': True}, + "name": {"required": True}, + "namespace": {"required": True}, + "identity": {"required": True}, + "provisioning_state": {"readonly": True}, + "provisioning_info": {"readonly": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'namespace': {'key': 'namespace', 'type': 'str'}, - 'binding_selector': {'key': 'bindingSelector', 'type': 'str'}, - 'identity': {'key': 'identity', 'type': 'UserAssignedIdentity'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'provisioning_info': {'key': 'provisioningInfo', 'type': 'ManagedClusterPodIdentityProvisioningInfo'}, + "name": {"key": "name", "type": "str"}, + "namespace": {"key": "namespace", "type": "str"}, + "binding_selector": {"key": "bindingSelector", "type": "str"}, + "identity": {"key": "identity", "type": "UserAssignedIdentity"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "provisioning_info": {"key": "provisioningInfo", "type": "ManagedClusterPodIdentityProvisioningInfo"}, } def __init__( @@ -3521,16 +3539,16 @@ def __init__( **kwargs ): """ - :keyword name: Required. Name of the pod identity. + :keyword name: Name of the pod identity. Required. :paramtype name: str - :keyword namespace: Required. Namespace of the pod identity. + :keyword namespace: Namespace of the pod identity. Required. :paramtype namespace: str :keyword binding_selector: Binding selector to use for the AzureIdentityBinding resource. :paramtype binding_selector: str - :keyword identity: Required. Information of the user assigned identity. + :keyword identity: Information of the user assigned identity. Required. :paramtype identity: ~azure.mgmt.containerservice.v2021_03_01.models.UserAssignedIdentity """ - super(ManagedClusterPodIdentity, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.namespace = namespace self.binding_selector = binding_selector @@ -3539,54 +3557,47 @@ def __init__( self.provisioning_info = None -class ManagedClusterPodIdentityException(msrest.serialization.Model): +class ManagedClusterPodIdentityException(_serialization.Model): """ManagedClusterPodIdentityException. All required parameters must be populated in order to send to Azure. - :ivar name: Required. Name of the pod identity exception. + :ivar name: Name of the pod identity exception. Required. :vartype name: str - :ivar namespace: Required. Namespace of the pod identity exception. + :ivar namespace: Namespace of the pod identity exception. Required. :vartype namespace: str - :ivar pod_labels: Required. Pod labels to match. + :ivar pod_labels: Pod labels to match. Required. :vartype pod_labels: dict[str, str] """ _validation = { - 'name': {'required': True}, - 'namespace': {'required': True}, - 'pod_labels': {'required': True}, + "name": {"required": True}, + "namespace": {"required": True}, + "pod_labels": {"required": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'namespace': {'key': 'namespace', 'type': 'str'}, - 'pod_labels': {'key': 'podLabels', 'type': '{str}'}, + "name": {"key": "name", "type": "str"}, + "namespace": {"key": "namespace", "type": "str"}, + "pod_labels": {"key": "podLabels", "type": "{str}"}, } - def __init__( - self, - *, - name: str, - namespace: str, - pod_labels: Dict[str, str], - **kwargs - ): + def __init__(self, *, name: str, namespace: str, pod_labels: Dict[str, str], **kwargs): """ - :keyword name: Required. Name of the pod identity exception. + :keyword name: Name of the pod identity exception. Required. :paramtype name: str - :keyword namespace: Required. Namespace of the pod identity exception. + :keyword namespace: Namespace of the pod identity exception. Required. :paramtype namespace: str - :keyword pod_labels: Required. Pod labels to match. + :keyword pod_labels: Pod labels to match. Required. :paramtype pod_labels: dict[str, str] """ - super(ManagedClusterPodIdentityException, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.namespace = namespace self.pod_labels = pod_labels -class ManagedClusterPodIdentityProfile(msrest.serialization.Model): +class ManagedClusterPodIdentityProfile(_serialization.Model): """ManagedClusterPodIdentityProfile. :ivar enabled: Whether the pod identity addon is enabled. @@ -3603,10 +3614,13 @@ class ManagedClusterPodIdentityProfile(msrest.serialization.Model): """ _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'allow_network_plugin_kubenet': {'key': 'allowNetworkPluginKubenet', 'type': 'bool'}, - 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '[ManagedClusterPodIdentity]'}, - 'user_assigned_identity_exceptions': {'key': 'userAssignedIdentityExceptions', 'type': '[ManagedClusterPodIdentityException]'}, + "enabled": {"key": "enabled", "type": "bool"}, + "allow_network_plugin_kubenet": {"key": "allowNetworkPluginKubenet", "type": "bool"}, + "user_assigned_identities": {"key": "userAssignedIdentities", "type": "[ManagedClusterPodIdentity]"}, + "user_assigned_identity_exceptions": { + "key": "userAssignedIdentityExceptions", + "type": "[ManagedClusterPodIdentityException]", + }, } def __init__( @@ -3631,14 +3645,14 @@ def __init__( :paramtype user_assigned_identity_exceptions: list[~azure.mgmt.containerservice.v2021_03_01.models.ManagedClusterPodIdentityException] """ - super(ManagedClusterPodIdentityProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.allow_network_plugin_kubenet = allow_network_plugin_kubenet self.user_assigned_identities = user_assigned_identities self.user_assigned_identity_exceptions = user_assigned_identity_exceptions -class ManagedClusterPodIdentityProvisioningInfo(msrest.serialization.Model): +class ManagedClusterPodIdentityProvisioningInfo(_serialization.Model): """ManagedClusterPodIdentityProvisioningInfo. :ivar error: Pod identity assignment error (if any). @@ -3646,34 +3660,29 @@ class ManagedClusterPodIdentityProvisioningInfo(msrest.serialization.Model): """ _attribute_map = { - 'error': {'key': 'error', 'type': 'CloudError'}, + "error": {"key": "error", "type": "CloudError"}, } - def __init__( - self, - *, - error: Optional["_models.CloudError"] = None, - **kwargs - ): + def __init__(self, *, error: Optional["_models.CloudError"] = None, **kwargs): """ :keyword error: Pod identity assignment error (if any). :paramtype error: ~azure.mgmt.containerservice.v2021_03_01.models.CloudError """ - super(ManagedClusterPodIdentityProvisioningInfo, self).__init__(**kwargs) + super().__init__(**kwargs) self.error = error -class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): +class ManagedClusterPoolUpgradeProfile(_serialization.Model): """The list of available upgrade versions. All required parameters must be populated in order to send to Azure. - :ivar kubernetes_version: Required. Kubernetes version (major, minor, patch). + :ivar kubernetes_version: Kubernetes version (major, minor, patch). Required. :vartype kubernetes_version: str :ivar name: Pool name. :vartype name: str - :ivar os_type: Required. OsType to be used to specify os type. Choose from Linux and Windows. - Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to + Linux. Known values are: "Linux" and "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2021_03_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -3681,15 +3690,15 @@ class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): """ _validation = { - 'kubernetes_version': {'required': True}, - 'os_type': {'required': True}, + "kubernetes_version": {"required": True}, + "os_type": {"required": True}, } _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'upgrades': {'key': 'upgrades', 'type': '[ManagedClusterPoolUpgradeProfileUpgradesItem]'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "os_type": {"key": "osType", "type": "str"}, + "upgrades": {"key": "upgrades", "type": "[ManagedClusterPoolUpgradeProfileUpgradesItem]"}, } def __init__( @@ -3702,25 +3711,25 @@ def __init__( **kwargs ): """ - :keyword kubernetes_version: Required. Kubernetes version (major, minor, patch). + :keyword kubernetes_version: Kubernetes version (major, minor, patch). Required. :paramtype kubernetes_version: str :keyword name: Pool name. :paramtype name: str - :keyword os_type: Required. OsType to be used to specify os type. Choose from Linux and - Windows. Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". + :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default + to Linux. Known values are: "Linux" and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2021_03_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: list[~azure.mgmt.containerservice.v2021_03_01.models.ManagedClusterPoolUpgradeProfileUpgradesItem] """ - super(ManagedClusterPoolUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.name = name self.os_type = os_type self.upgrades = upgrades -class ManagedClusterPoolUpgradeProfileUpgradesItem(msrest.serialization.Model): +class ManagedClusterPoolUpgradeProfileUpgradesItem(_serialization.Model): """ManagedClusterPoolUpgradeProfileUpgradesItem. :ivar kubernetes_version: Kubernetes version (major, minor, patch). @@ -3730,34 +3739,28 @@ class ManagedClusterPoolUpgradeProfileUpgradesItem(msrest.serialization.Model): """ _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } - def __init__( - self, - *, - kubernetes_version: Optional[str] = None, - is_preview: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, kubernetes_version: Optional[str] = None, is_preview: Optional[bool] = None, **kwargs): """ :keyword kubernetes_version: Kubernetes version (major, minor, patch). :paramtype kubernetes_version: str :keyword is_preview: Whether Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(ManagedClusterPoolUpgradeProfileUpgradesItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.is_preview = is_preview -class ManagedClusterPropertiesAutoScalerProfile(msrest.serialization.Model): +class ManagedClusterPropertiesAutoScalerProfile(_serialization.Model): # pylint: disable=too-many-instance-attributes """Parameters to be applied to the cluster-autoscaler when enabled. :ivar balance_similar_node_groups: :vartype balance_similar_node_groups: str - :ivar expander: Known values are: "least-waste", "most-pods", "priority", "random". + :ivar expander: Known values are: "least-waste", "most-pods", "priority", and "random". :vartype expander: str or ~azure.mgmt.containerservice.v2021_03_01.models.Expander :ivar max_empty_bulk_delete: :vartype max_empty_bulk_delete: str @@ -3792,23 +3795,23 @@ class ManagedClusterPropertiesAutoScalerProfile(msrest.serialization.Model): """ _attribute_map = { - 'balance_similar_node_groups': {'key': 'balance-similar-node-groups', 'type': 'str'}, - 'expander': {'key': 'expander', 'type': 'str'}, - 'max_empty_bulk_delete': {'key': 'max-empty-bulk-delete', 'type': 'str'}, - 'max_graceful_termination_sec': {'key': 'max-graceful-termination-sec', 'type': 'str'}, - 'max_node_provision_time': {'key': 'max-node-provision-time', 'type': 'str'}, - 'max_total_unready_percentage': {'key': 'max-total-unready-percentage', 'type': 'str'}, - 'new_pod_scale_up_delay': {'key': 'new-pod-scale-up-delay', 'type': 'str'}, - 'ok_total_unready_count': {'key': 'ok-total-unready-count', 'type': 'str'}, - 'scan_interval': {'key': 'scan-interval', 'type': 'str'}, - 'scale_down_delay_after_add': {'key': 'scale-down-delay-after-add', 'type': 'str'}, - 'scale_down_delay_after_delete': {'key': 'scale-down-delay-after-delete', 'type': 'str'}, - 'scale_down_delay_after_failure': {'key': 'scale-down-delay-after-failure', 'type': 'str'}, - 'scale_down_unneeded_time': {'key': 'scale-down-unneeded-time', 'type': 'str'}, - 'scale_down_unready_time': {'key': 'scale-down-unready-time', 'type': 'str'}, - 'scale_down_utilization_threshold': {'key': 'scale-down-utilization-threshold', 'type': 'str'}, - 'skip_nodes_with_local_storage': {'key': 'skip-nodes-with-local-storage', 'type': 'str'}, - 'skip_nodes_with_system_pods': {'key': 'skip-nodes-with-system-pods', 'type': 'str'}, + "balance_similar_node_groups": {"key": "balance-similar-node-groups", "type": "str"}, + "expander": {"key": "expander", "type": "str"}, + "max_empty_bulk_delete": {"key": "max-empty-bulk-delete", "type": "str"}, + "max_graceful_termination_sec": {"key": "max-graceful-termination-sec", "type": "str"}, + "max_node_provision_time": {"key": "max-node-provision-time", "type": "str"}, + "max_total_unready_percentage": {"key": "max-total-unready-percentage", "type": "str"}, + "new_pod_scale_up_delay": {"key": "new-pod-scale-up-delay", "type": "str"}, + "ok_total_unready_count": {"key": "ok-total-unready-count", "type": "str"}, + "scan_interval": {"key": "scan-interval", "type": "str"}, + "scale_down_delay_after_add": {"key": "scale-down-delay-after-add", "type": "str"}, + "scale_down_delay_after_delete": {"key": "scale-down-delay-after-delete", "type": "str"}, + "scale_down_delay_after_failure": {"key": "scale-down-delay-after-failure", "type": "str"}, + "scale_down_unneeded_time": {"key": "scale-down-unneeded-time", "type": "str"}, + "scale_down_unready_time": {"key": "scale-down-unready-time", "type": "str"}, + "scale_down_utilization_threshold": {"key": "scale-down-utilization-threshold", "type": "str"}, + "skip_nodes_with_local_storage": {"key": "skip-nodes-with-local-storage", "type": "str"}, + "skip_nodes_with_system_pods": {"key": "skip-nodes-with-system-pods", "type": "str"}, } def __init__( @@ -3836,7 +3839,7 @@ def __init__( """ :keyword balance_similar_node_groups: :paramtype balance_similar_node_groups: str - :keyword expander: Known values are: "least-waste", "most-pods", "priority", "random". + :keyword expander: Known values are: "least-waste", "most-pods", "priority", and "random". :paramtype expander: str or ~azure.mgmt.containerservice.v2021_03_01.models.Expander :keyword max_empty_bulk_delete: :paramtype max_empty_bulk_delete: str @@ -3869,7 +3872,7 @@ def __init__( :keyword skip_nodes_with_system_pods: :paramtype skip_nodes_with_system_pods: str """ - super(ManagedClusterPropertiesAutoScalerProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.balance_similar_node_groups = balance_similar_node_groups self.expander = expander self.max_empty_bulk_delete = max_empty_bulk_delete @@ -3889,56 +3892,50 @@ def __init__( self.skip_nodes_with_system_pods = skip_nodes_with_system_pods -class ManagedClusterServicePrincipalProfile(msrest.serialization.Model): +class ManagedClusterServicePrincipalProfile(_serialization.Model): """Information about a service principal identity for the cluster to use for manipulating Azure APIs. All required parameters must be populated in order to send to Azure. - :ivar client_id: Required. The ID for the service principal. + :ivar client_id: The ID for the service principal. Required. :vartype client_id: str :ivar secret: The secret password associated with the service principal in plain text. :vartype secret: str """ _validation = { - 'client_id': {'required': True}, + "client_id": {"required": True}, } _attribute_map = { - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'secret': {'key': 'secret', 'type': 'str'}, + "client_id": {"key": "clientId", "type": "str"}, + "secret": {"key": "secret", "type": "str"}, } - def __init__( - self, - *, - client_id: str, - secret: Optional[str] = None, - **kwargs - ): + def __init__(self, *, client_id: str, secret: Optional[str] = None, **kwargs): """ - :keyword client_id: Required. The ID for the service principal. + :keyword client_id: The ID for the service principal. Required. :paramtype client_id: str :keyword secret: The secret password associated with the service principal in plain text. :paramtype secret: str """ - super(ManagedClusterServicePrincipalProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.client_id = client_id self.secret = secret -class ManagedClusterSKU(msrest.serialization.Model): +class ManagedClusterSKU(_serialization.Model): """ManagedClusterSKU. - :ivar name: Name of a managed cluster SKU. Known values are: "Basic". + :ivar name: Name of a managed cluster SKU. "Basic" :vartype name: str or ~azure.mgmt.containerservice.v2021_03_01.models.ManagedClusterSKUName - :ivar tier: Tier of a managed cluster SKU. Known values are: "Paid", "Free". + :ivar tier: Tier of a managed cluster SKU. Known values are: "Paid" and "Free". :vartype tier: str or ~azure.mgmt.containerservice.v2021_03_01.models.ManagedClusterSKUTier """ _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, + "name": {"key": "name", "type": "str"}, + "tier": {"key": "tier", "type": "str"}, } def __init__( @@ -3949,17 +3946,17 @@ def __init__( **kwargs ): """ - :keyword name: Name of a managed cluster SKU. Known values are: "Basic". + :keyword name: Name of a managed cluster SKU. "Basic" :paramtype name: str or ~azure.mgmt.containerservice.v2021_03_01.models.ManagedClusterSKUName - :keyword tier: Tier of a managed cluster SKU. Known values are: "Paid", "Free". + :keyword tier: Tier of a managed cluster SKU. Known values are: "Paid" and "Free". :paramtype tier: str or ~azure.mgmt.containerservice.v2021_03_01.models.ManagedClusterSKUTier """ - super(ManagedClusterSKU, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.tier = tier -class ManagedClusterUpgradeProfile(msrest.serialization.Model): +class ManagedClusterUpgradeProfile(_serialization.Model): """The list of available upgrades for compute pools. Variables are only populated by the server, and will be ignored when sending a request. @@ -3972,29 +3969,29 @@ class ManagedClusterUpgradeProfile(msrest.serialization.Model): :vartype name: str :ivar type: Type of upgrade profile. :vartype type: str - :ivar control_plane_profile: Required. The list of available upgrade versions for the control - plane. + :ivar control_plane_profile: The list of available upgrade versions for the control plane. + Required. :vartype control_plane_profile: ~azure.mgmt.containerservice.v2021_03_01.models.ManagedClusterPoolUpgradeProfile - :ivar agent_pool_profiles: Required. The list of available upgrade versions for agent pools. + :ivar agent_pool_profiles: The list of available upgrade versions for agent pools. Required. :vartype agent_pool_profiles: list[~azure.mgmt.containerservice.v2021_03_01.models.ManagedClusterPoolUpgradeProfile] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'control_plane_profile': {'required': True}, - 'agent_pool_profiles': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "control_plane_profile": {"required": True}, + "agent_pool_profiles": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'control_plane_profile': {'key': 'properties.controlPlaneProfile', 'type': 'ManagedClusterPoolUpgradeProfile'}, - 'agent_pool_profiles': {'key': 'properties.agentPoolProfiles', 'type': '[ManagedClusterPoolUpgradeProfile]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "control_plane_profile": {"key": "properties.controlPlaneProfile", "type": "ManagedClusterPoolUpgradeProfile"}, + "agent_pool_profiles": {"key": "properties.agentPoolProfiles", "type": "[ManagedClusterPoolUpgradeProfile]"}, } def __init__( @@ -4005,15 +4002,15 @@ def __init__( **kwargs ): """ - :keyword control_plane_profile: Required. The list of available upgrade versions for the - control plane. + :keyword control_plane_profile: The list of available upgrade versions for the control plane. + Required. :paramtype control_plane_profile: ~azure.mgmt.containerservice.v2021_03_01.models.ManagedClusterPoolUpgradeProfile - :keyword agent_pool_profiles: Required. The list of available upgrade versions for agent pools. + :keyword agent_pool_profiles: The list of available upgrade versions for agent pools. Required. :paramtype agent_pool_profiles: list[~azure.mgmt.containerservice.v2021_03_01.models.ManagedClusterPoolUpgradeProfile] """ - super(ManagedClusterUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -4021,18 +4018,18 @@ def __init__( self.agent_pool_profiles = agent_pool_profiles -class ManagedClusterWindowsProfile(msrest.serialization.Model): +class ManagedClusterWindowsProfile(_serialization.Model): """Profile for Windows VMs in the container service cluster. All required parameters must be populated in order to send to Azure. - :ivar admin_username: Required. Specifies the name of the administrator account. - :code:`
`:code:`
` **restriction:** Cannot end in "." :code:`
`:code:`
` - **Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", "test1", - "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", - "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", - "sys", "test2", "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 - character :code:`
`:code:`
` **Max-length:** 20 characters. + :ivar admin_username: Specifies the name of the administrator account. :code:`
`:code:`
` + **restriction:** Cannot end in "." :code:`
`:code:`
` **Disallowed values:** + "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", + "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", + "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", + "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 character + :code:`
`:code:`
` **Max-length:** 20 characters. Required. :vartype admin_username: str :ivar admin_password: Specifies the password of the administrator account. :code:`
`:code:`
` **Minimum-length:** 8 characters :code:`
`:code:`
` @@ -4043,21 +4040,21 @@ class ManagedClusterWindowsProfile(msrest.serialization.Model): "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!". :vartype admin_password: str :ivar license_type: The licenseType to use for Windows VMs. Windows_Server is used to enable - Azure Hybrid User Benefits for Windows VMs. Known values are: "None", "Windows_Server". + Azure Hybrid User Benefits for Windows VMs. Known values are: "None" and "Windows_Server". :vartype license_type: str or ~azure.mgmt.containerservice.v2021_03_01.models.LicenseType :ivar enable_csi_proxy: Whether to enable CSI proxy. :vartype enable_csi_proxy: bool """ _validation = { - 'admin_username': {'required': True}, + "admin_username": {"required": True}, } _attribute_map = { - 'admin_username': {'key': 'adminUsername', 'type': 'str'}, - 'admin_password': {'key': 'adminPassword', 'type': 'str'}, - 'license_type': {'key': 'licenseType', 'type': 'str'}, - 'enable_csi_proxy': {'key': 'enableCSIProxy', 'type': 'bool'}, + "admin_username": {"key": "adminUsername", "type": "str"}, + "admin_password": {"key": "adminPassword", "type": "str"}, + "license_type": {"key": "licenseType", "type": "str"}, + "enable_csi_proxy": {"key": "enableCSIProxy", "type": "bool"}, } def __init__( @@ -4070,13 +4067,13 @@ def __init__( **kwargs ): """ - :keyword admin_username: Required. Specifies the name of the administrator account. + :keyword admin_username: Specifies the name of the administrator account. :code:`
`:code:`
` **restriction:** Cannot end in "." :code:`
`:code:`
` **Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 - character :code:`
`:code:`
` **Max-length:** 20 characters. + character :code:`
`:code:`
` **Max-length:** 20 characters. Required. :paramtype admin_username: str :keyword admin_password: Specifies the password of the administrator account. :code:`
`:code:`
` **Minimum-length:** 8 characters :code:`
`:code:`
` @@ -4087,19 +4084,19 @@ def __init__( "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!". :paramtype admin_password: str :keyword license_type: The licenseType to use for Windows VMs. Windows_Server is used to enable - Azure Hybrid User Benefits for Windows VMs. Known values are: "None", "Windows_Server". + Azure Hybrid User Benefits for Windows VMs. Known values are: "None" and "Windows_Server". :paramtype license_type: str or ~azure.mgmt.containerservice.v2021_03_01.models.LicenseType :keyword enable_csi_proxy: Whether to enable CSI proxy. :paramtype enable_csi_proxy: bool """ - super(ManagedClusterWindowsProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.admin_username = admin_username self.admin_password = admin_password self.license_type = license_type self.enable_csi_proxy = enable_csi_proxy -class OperationListResult(msrest.serialization.Model): +class OperationListResult(_serialization.Model): """The List Compute Operation operation response. Variables are only populated by the server, and will be ignored when sending a request. @@ -4109,24 +4106,20 @@ class OperationListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[OperationValue]'}, + "value": {"key": "value", "type": "[OperationValue]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(OperationListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None -class OperationValue(msrest.serialization.Model): +class OperationValue(_serialization.Model): """Describes the properties of a Compute Operation value. Variables are only populated by the server, and will be ignored when sending a request. @@ -4146,30 +4139,26 @@ class OperationValue(msrest.serialization.Model): """ _validation = { - 'origin': {'readonly': True}, - 'name': {'readonly': True}, - 'operation': {'readonly': True}, - 'resource': {'readonly': True}, - 'description': {'readonly': True}, - 'provider': {'readonly': True}, + "origin": {"readonly": True}, + "name": {"readonly": True}, + "operation": {"readonly": True}, + "resource": {"readonly": True}, + "description": {"readonly": True}, + "provider": {"readonly": True}, } _attribute_map = { - 'origin': {'key': 'origin', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'operation': {'key': 'display.operation', 'type': 'str'}, - 'resource': {'key': 'display.resource', 'type': 'str'}, - 'description': {'key': 'display.description', 'type': 'str'}, - 'provider': {'key': 'display.provider', 'type': 'str'}, + "origin": {"key": "origin", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "operation": {"key": "display.operation", "type": "str"}, + "resource": {"key": "display.resource", "type": "str"}, + "description": {"key": "display.description", "type": "str"}, + "provider": {"key": "display.provider", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(OperationValue, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.origin = None self.name = None self.operation = None @@ -4178,7 +4167,7 @@ def __init__( self.provider = None -class OSOptionProfile(msrest.serialization.Model): +class OSOptionProfile(_serialization.Model): """The OS option profile. Variables are only populated by the server, and will be ignored when sending a request. @@ -4191,110 +4180,94 @@ class OSOptionProfile(msrest.serialization.Model): :vartype name: str :ivar type: Type of the OS option profile. :vartype type: str - :ivar os_option_property_list: Required. The list of OS option properties. + :ivar os_option_property_list: The list of OS option properties. Required. :vartype os_option_property_list: list[~azure.mgmt.containerservice.v2021_03_01.models.OSOptionProperty] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'os_option_property_list': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "os_option_property_list": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'os_option_property_list': {'key': 'properties.osOptionPropertyList', 'type': '[OSOptionProperty]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "os_option_property_list": {"key": "properties.osOptionPropertyList", "type": "[OSOptionProperty]"}, } - def __init__( - self, - *, - os_option_property_list: List["_models.OSOptionProperty"], - **kwargs - ): + def __init__(self, *, os_option_property_list: List["_models.OSOptionProperty"], **kwargs): """ - :keyword os_option_property_list: Required. The list of OS option properties. + :keyword os_option_property_list: The list of OS option properties. Required. :paramtype os_option_property_list: list[~azure.mgmt.containerservice.v2021_03_01.models.OSOptionProperty] """ - super(OSOptionProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None self.os_option_property_list = os_option_property_list -class OSOptionProperty(msrest.serialization.Model): +class OSOptionProperty(_serialization.Model): """OS option property. All required parameters must be populated in order to send to Azure. - :ivar os_type: Required. OS type. + :ivar os_type: OS type. Required. :vartype os_type: str - :ivar enable_fips_image: Required. Whether FIPS image is enabled. + :ivar enable_fips_image: Whether FIPS image is enabled. Required. :vartype enable_fips_image: bool """ _validation = { - 'os_type': {'required': True}, - 'enable_fips_image': {'required': True}, + "os_type": {"required": True}, + "enable_fips_image": {"required": True}, } _attribute_map = { - 'os_type': {'key': 'os-type', 'type': 'str'}, - 'enable_fips_image': {'key': 'enable-fips-image', 'type': 'bool'}, + "os_type": {"key": "os-type", "type": "str"}, + "enable_fips_image": {"key": "enable-fips-image", "type": "bool"}, } - def __init__( - self, - *, - os_type: str, - enable_fips_image: bool, - **kwargs - ): + def __init__(self, *, os_type: str, enable_fips_image: bool, **kwargs): """ - :keyword os_type: Required. OS type. + :keyword os_type: OS type. Required. :paramtype os_type: str - :keyword enable_fips_image: Required. Whether FIPS image is enabled. + :keyword enable_fips_image: Whether FIPS image is enabled. Required. :paramtype enable_fips_image: bool """ - super(OSOptionProperty, self).__init__(**kwargs) + super().__init__(**kwargs) self.os_type = os_type self.enable_fips_image = enable_fips_image -class PowerState(msrest.serialization.Model): +class PowerState(_serialization.Model): """Describes the Power State of the cluster. - :ivar code: Tells whether the cluster is Running or Stopped. Known values are: "Running", + :ivar code: Tells whether the cluster is Running or Stopped. Known values are: "Running" and "Stopped". :vartype code: str or ~azure.mgmt.containerservice.v2021_03_01.models.Code """ _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, + "code": {"key": "code", "type": "str"}, } - def __init__( - self, - *, - code: Optional[Union[str, "_models.Code"]] = None, - **kwargs - ): + def __init__(self, *, code: Optional[Union[str, "_models.Code"]] = None, **kwargs): """ - :keyword code: Tells whether the cluster is Running or Stopped. Known values are: "Running", + :keyword code: Tells whether the cluster is Running or Stopped. Known values are: "Running" and "Stopped". :paramtype code: str or ~azure.mgmt.containerservice.v2021_03_01.models.Code """ - super(PowerState, self).__init__(**kwargs) + super().__init__(**kwargs) self.code = code -class PrivateEndpoint(msrest.serialization.Model): +class PrivateEndpoint(_serialization.Model): """Private endpoint which a connection belongs to. :ivar id: The resource Id for private endpoint. @@ -4302,24 +4275,19 @@ class PrivateEndpoint(msrest.serialization.Model): """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, } - def __init__( - self, - *, - id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin """ :keyword id: The resource Id for private endpoint. :paramtype id: str """ - super(PrivateEndpoint, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id -class PrivateEndpointConnection(msrest.serialization.Model): +class PrivateEndpointConnection(_serialization.Model): """A private endpoint connection. Variables are only populated by the server, and will be ignored when sending a request. @@ -4331,7 +4299,7 @@ class PrivateEndpointConnection(msrest.serialization.Model): :ivar type: The resource type. :vartype type: str :ivar provisioning_state: The current provisioning state. Known values are: "Succeeded", - "Creating", "Deleting", "Failed". + "Creating", "Deleting", and "Failed". :vartype provisioning_state: str or ~azure.mgmt.containerservice.v2021_03_01.models.PrivateEndpointConnectionProvisioningState :ivar private_endpoint: The resource of private endpoint. @@ -4343,19 +4311,22 @@ class PrivateEndpointConnection(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'provisioning_state': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, - 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "private_endpoint": {"key": "properties.privateEndpoint", "type": "PrivateEndpoint"}, + "private_link_service_connection_state": { + "key": "properties.privateLinkServiceConnectionState", + "type": "PrivateLinkServiceConnectionState", + }, } def __init__( @@ -4373,7 +4344,7 @@ def __init__( :paramtype private_link_service_connection_state: ~azure.mgmt.containerservice.v2021_03_01.models.PrivateLinkServiceConnectionState """ - super(PrivateEndpointConnection, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -4382,7 +4353,7 @@ def __init__( self.private_link_service_connection_state = private_link_service_connection_state -class PrivateEndpointConnectionListResult(msrest.serialization.Model): +class PrivateEndpointConnectionListResult(_serialization.Model): """A list of private endpoint connections. :ivar value: The collection value. @@ -4390,25 +4361,20 @@ class PrivateEndpointConnectionListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, + "value": {"key": "value", "type": "[PrivateEndpointConnection]"}, } - def __init__( - self, - *, - value: Optional[List["_models.PrivateEndpointConnection"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.PrivateEndpointConnection"]] = None, **kwargs): """ :keyword value: The collection value. :paramtype value: list[~azure.mgmt.containerservice.v2021_03_01.models.PrivateEndpointConnection] """ - super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value -class PrivateLinkResource(msrest.serialization.Model): +class PrivateLinkResource(_serialization.Model): """A private link resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -4429,22 +4395,22 @@ class PrivateLinkResource(msrest.serialization.Model): """ _validation = { - 'private_link_service_id': {'readonly': True}, + "private_link_service_id": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'group_id': {'key': 'groupId', 'type': 'str'}, - 'required_members': {'key': 'requiredMembers', 'type': '[str]'}, - 'private_link_service_id': {'key': 'privateLinkServiceID', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "group_id": {"key": "groupId", "type": "str"}, + "required_members": {"key": "requiredMembers", "type": "[str]"}, + "private_link_service_id": {"key": "privateLinkServiceID", "type": "str"}, } def __init__( self, *, - id: Optional[str] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin name: Optional[str] = None, type: Optional[str] = None, group_id: Optional[str] = None, @@ -4463,7 +4429,7 @@ def __init__( :keyword required_members: RequiredMembers of the resource. :paramtype required_members: list[str] """ - super(PrivateLinkResource, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id self.name = name self.type = type @@ -4472,7 +4438,7 @@ def __init__( self.private_link_service_id = None -class PrivateLinkResourcesListResult(msrest.serialization.Model): +class PrivateLinkResourcesListResult(_serialization.Model): """A list of private link resources. :ivar value: The collection value. @@ -4480,36 +4446,31 @@ class PrivateLinkResourcesListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, + "value": {"key": "value", "type": "[PrivateLinkResource]"}, } - def __init__( - self, - *, - value: Optional[List["_models.PrivateLinkResource"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.PrivateLinkResource"]] = None, **kwargs): """ :keyword value: The collection value. :paramtype value: list[~azure.mgmt.containerservice.v2021_03_01.models.PrivateLinkResource] """ - super(PrivateLinkResourcesListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value -class PrivateLinkServiceConnectionState(msrest.serialization.Model): +class PrivateLinkServiceConnectionState(_serialization.Model): """The state of a private link service connection. :ivar status: The private link service connection status. Known values are: "Pending", - "Approved", "Rejected", "Disconnected". + "Approved", "Rejected", and "Disconnected". :vartype status: str or ~azure.mgmt.containerservice.v2021_03_01.models.ConnectionStatus :ivar description: The private link service connection description. :vartype description: str """ _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, + "status": {"key": "status", "type": "str"}, + "description": {"key": "description", "type": "str"}, } def __init__( @@ -4521,17 +4482,17 @@ def __init__( ): """ :keyword status: The private link service connection status. Known values are: "Pending", - "Approved", "Rejected", "Disconnected". + "Approved", "Rejected", and "Disconnected". :paramtype status: str or ~azure.mgmt.containerservice.v2021_03_01.models.ConnectionStatus :keyword description: The private link service connection description. :paramtype description: str """ - super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) + super().__init__(**kwargs) self.status = status self.description = description -class ResourceReference(msrest.serialization.Model): +class ResourceReference(_serialization.Model): """A reference to an Azure resource. :ivar id: The fully qualified Azure resource id. @@ -4539,29 +4500,24 @@ class ResourceReference(msrest.serialization.Model): """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, } - def __init__( - self, - *, - id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin """ :keyword id: The fully qualified Azure resource id. :paramtype id: str """ - super(ResourceReference, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id -class RunCommandRequest(msrest.serialization.Model): +class RunCommandRequest(_serialization.Model): """run command request. All required parameters must be populated in order to send to Azure. - :ivar command: Required. command to run. + :ivar command: command to run. Required. :vartype command: str :ivar context: base64 encoded zip file, contains files required by the command. :vartype context: str @@ -4570,38 +4526,31 @@ class RunCommandRequest(msrest.serialization.Model): """ _validation = { - 'command': {'required': True}, + "command": {"required": True}, } _attribute_map = { - 'command': {'key': 'command', 'type': 'str'}, - 'context': {'key': 'context', 'type': 'str'}, - 'cluster_token': {'key': 'clusterToken', 'type': 'str'}, + "command": {"key": "command", "type": "str"}, + "context": {"key": "context", "type": "str"}, + "cluster_token": {"key": "clusterToken", "type": "str"}, } - def __init__( - self, - *, - command: str, - context: Optional[str] = None, - cluster_token: Optional[str] = None, - **kwargs - ): + def __init__(self, *, command: str, context: Optional[str] = None, cluster_token: Optional[str] = None, **kwargs): """ - :keyword command: Required. command to run. + :keyword command: command to run. Required. :paramtype command: str :keyword context: base64 encoded zip file, contains files required by the command. :paramtype context: str :keyword cluster_token: AuthToken issued for AKS AAD Server App. :paramtype cluster_token: str """ - super(RunCommandRequest, self).__init__(**kwargs) + super().__init__(**kwargs) self.command = command self.context = context self.cluster_token = cluster_token -class RunCommandResult(msrest.serialization.Model): +class RunCommandResult(_serialization.Model): """run command result. Variables are only populated by the server, and will be ignored when sending a request. @@ -4623,32 +4572,28 @@ class RunCommandResult(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'exit_code': {'readonly': True}, - 'started_at': {'readonly': True}, - 'finished_at': {'readonly': True}, - 'logs': {'readonly': True}, - 'reason': {'readonly': True}, + "id": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "exit_code": {"readonly": True}, + "started_at": {"readonly": True}, + "finished_at": {"readonly": True}, + "logs": {"readonly": True}, + "reason": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'exit_code': {'key': 'properties.exitCode', 'type': 'int'}, - 'started_at': {'key': 'properties.startedAt', 'type': 'iso-8601'}, - 'finished_at': {'key': 'properties.finishedAt', 'type': 'iso-8601'}, - 'logs': {'key': 'properties.logs', 'type': 'str'}, - 'reason': {'key': 'properties.reason', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "exit_code": {"key": "properties.exitCode", "type": "int"}, + "started_at": {"key": "properties.startedAt", "type": "iso-8601"}, + "finished_at": {"key": "properties.finishedAt", "type": "iso-8601"}, + "logs": {"key": "properties.logs", "type": "str"}, + "reason": {"key": "properties.reason", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(RunCommandResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.id = None self.provisioning_state = None self.exit_code = None @@ -4658,7 +4603,7 @@ def __init__( self.reason = None -class SysctlConfig(msrest.serialization.Model): +class SysctlConfig(_serialization.Model): # pylint: disable=too-many-instance-attributes """Sysctl settings for Linux agent nodes. :ivar net_core_somaxconn: Sysctl setting net.core.somaxconn. @@ -4720,37 +4665,37 @@ class SysctlConfig(msrest.serialization.Model): """ _attribute_map = { - 'net_core_somaxconn': {'key': 'netCoreSomaxconn', 'type': 'int'}, - 'net_core_netdev_max_backlog': {'key': 'netCoreNetdevMaxBacklog', 'type': 'int'}, - 'net_core_rmem_default': {'key': 'netCoreRmemDefault', 'type': 'int'}, - 'net_core_rmem_max': {'key': 'netCoreRmemMax', 'type': 'int'}, - 'net_core_wmem_default': {'key': 'netCoreWmemDefault', 'type': 'int'}, - 'net_core_wmem_max': {'key': 'netCoreWmemMax', 'type': 'int'}, - 'net_core_optmem_max': {'key': 'netCoreOptmemMax', 'type': 'int'}, - 'net_ipv4_tcp_max_syn_backlog': {'key': 'netIpv4TcpMaxSynBacklog', 'type': 'int'}, - 'net_ipv4_tcp_max_tw_buckets': {'key': 'netIpv4TcpMaxTwBuckets', 'type': 'int'}, - 'net_ipv4_tcp_fin_timeout': {'key': 'netIpv4TcpFinTimeout', 'type': 'int'}, - 'net_ipv4_tcp_keepalive_time': {'key': 'netIpv4TcpKeepaliveTime', 'type': 'int'}, - 'net_ipv4_tcp_keepalive_probes': {'key': 'netIpv4TcpKeepaliveProbes', 'type': 'int'}, - 'net_ipv4_tcpkeepalive_intvl': {'key': 'netIpv4TcpkeepaliveIntvl', 'type': 'int'}, - 'net_ipv4_tcp_tw_reuse': {'key': 'netIpv4TcpTwReuse', 'type': 'bool'}, - 'net_ipv4_ip_local_port_range': {'key': 'netIpv4IpLocalPortRange', 'type': 'str'}, - 'net_ipv4_neigh_default_gc_thresh1': {'key': 'netIpv4NeighDefaultGcThresh1', 'type': 'int'}, - 'net_ipv4_neigh_default_gc_thresh2': {'key': 'netIpv4NeighDefaultGcThresh2', 'type': 'int'}, - 'net_ipv4_neigh_default_gc_thresh3': {'key': 'netIpv4NeighDefaultGcThresh3', 'type': 'int'}, - 'net_netfilter_nf_conntrack_max': {'key': 'netNetfilterNfConntrackMax', 'type': 'int'}, - 'net_netfilter_nf_conntrack_buckets': {'key': 'netNetfilterNfConntrackBuckets', 'type': 'int'}, - 'fs_inotify_max_user_watches': {'key': 'fsInotifyMaxUserWatches', 'type': 'int'}, - 'fs_file_max': {'key': 'fsFileMax', 'type': 'int'}, - 'fs_aio_max_nr': {'key': 'fsAioMaxNr', 'type': 'int'}, - 'fs_nr_open': {'key': 'fsNrOpen', 'type': 'int'}, - 'kernel_threads_max': {'key': 'kernelThreadsMax', 'type': 'int'}, - 'vm_max_map_count': {'key': 'vmMaxMapCount', 'type': 'int'}, - 'vm_swappiness': {'key': 'vmSwappiness', 'type': 'int'}, - 'vm_vfs_cache_pressure': {'key': 'vmVfsCachePressure', 'type': 'int'}, + "net_core_somaxconn": {"key": "netCoreSomaxconn", "type": "int"}, + "net_core_netdev_max_backlog": {"key": "netCoreNetdevMaxBacklog", "type": "int"}, + "net_core_rmem_default": {"key": "netCoreRmemDefault", "type": "int"}, + "net_core_rmem_max": {"key": "netCoreRmemMax", "type": "int"}, + "net_core_wmem_default": {"key": "netCoreWmemDefault", "type": "int"}, + "net_core_wmem_max": {"key": "netCoreWmemMax", "type": "int"}, + "net_core_optmem_max": {"key": "netCoreOptmemMax", "type": "int"}, + "net_ipv4_tcp_max_syn_backlog": {"key": "netIpv4TcpMaxSynBacklog", "type": "int"}, + "net_ipv4_tcp_max_tw_buckets": {"key": "netIpv4TcpMaxTwBuckets", "type": "int"}, + "net_ipv4_tcp_fin_timeout": {"key": "netIpv4TcpFinTimeout", "type": "int"}, + "net_ipv4_tcp_keepalive_time": {"key": "netIpv4TcpKeepaliveTime", "type": "int"}, + "net_ipv4_tcp_keepalive_probes": {"key": "netIpv4TcpKeepaliveProbes", "type": "int"}, + "net_ipv4_tcpkeepalive_intvl": {"key": "netIpv4TcpkeepaliveIntvl", "type": "int"}, + "net_ipv4_tcp_tw_reuse": {"key": "netIpv4TcpTwReuse", "type": "bool"}, + "net_ipv4_ip_local_port_range": {"key": "netIpv4IpLocalPortRange", "type": "str"}, + "net_ipv4_neigh_default_gc_thresh1": {"key": "netIpv4NeighDefaultGcThresh1", "type": "int"}, + "net_ipv4_neigh_default_gc_thresh2": {"key": "netIpv4NeighDefaultGcThresh2", "type": "int"}, + "net_ipv4_neigh_default_gc_thresh3": {"key": "netIpv4NeighDefaultGcThresh3", "type": "int"}, + "net_netfilter_nf_conntrack_max": {"key": "netNetfilterNfConntrackMax", "type": "int"}, + "net_netfilter_nf_conntrack_buckets": {"key": "netNetfilterNfConntrackBuckets", "type": "int"}, + "fs_inotify_max_user_watches": {"key": "fsInotifyMaxUserWatches", "type": "int"}, + "fs_file_max": {"key": "fsFileMax", "type": "int"}, + "fs_aio_max_nr": {"key": "fsAioMaxNr", "type": "int"}, + "fs_nr_open": {"key": "fsNrOpen", "type": "int"}, + "kernel_threads_max": {"key": "kernelThreadsMax", "type": "int"}, + "vm_max_map_count": {"key": "vmMaxMapCount", "type": "int"}, + "vm_swappiness": {"key": "vmSwappiness", "type": "int"}, + "vm_vfs_cache_pressure": {"key": "vmVfsCachePressure", "type": "int"}, } - def __init__( + def __init__( # pylint: disable=too-many-locals self, *, net_core_somaxconn: Optional[int] = None, @@ -4841,7 +4786,7 @@ def __init__( :keyword vm_vfs_cache_pressure: Sysctl setting vm.vfs_cache_pressure. :paramtype vm_vfs_cache_pressure: int """ - super(SysctlConfig, self).__init__(**kwargs) + super().__init__(**kwargs) self.net_core_somaxconn = net_core_somaxconn self.net_core_netdev_max_backlog = net_core_netdev_max_backlog self.net_core_rmem_default = net_core_rmem_default @@ -4872,20 +4817,20 @@ def __init__( self.vm_vfs_cache_pressure = vm_vfs_cache_pressure -class SystemData(msrest.serialization.Model): +class SystemData(_serialization.Model): """Metadata pertaining to creation and last modification of the resource. :ivar created_by: The identity that created the resource. :vartype created_by: str :ivar created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", "Key". + "User", "Application", "ManagedIdentity", and "Key". :vartype created_by_type: str or ~azure.mgmt.containerservice.v2021_03_01.models.CreatedByType :ivar created_at: The timestamp of resource creation (UTC). :vartype created_at: ~datetime.datetime :ivar last_modified_by: The identity that last modified the resource. :vartype last_modified_by: str :ivar last_modified_by_type: The type of identity that last modified the resource. Known values - are: "User", "Application", "ManagedIdentity", "Key". + are: "User", "Application", "ManagedIdentity", and "Key". :vartype last_modified_by_type: str or ~azure.mgmt.containerservice.v2021_03_01.models.CreatedByType :ivar last_modified_at: The type of identity that last modified the resource. @@ -4893,12 +4838,12 @@ class SystemData(msrest.serialization.Model): """ _attribute_map = { - 'created_by': {'key': 'createdBy', 'type': 'str'}, - 'created_by_type': {'key': 'createdByType', 'type': 'str'}, - 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, - 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, - 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, - 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + "created_by": {"key": "createdBy", "type": "str"}, + "created_by_type": {"key": "createdByType", "type": "str"}, + "created_at": {"key": "createdAt", "type": "iso-8601"}, + "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, + "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, + "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, } def __init__( @@ -4916,7 +4861,7 @@ def __init__( :keyword created_by: The identity that created the resource. :paramtype created_by: str :keyword created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", "Key". + "User", "Application", "ManagedIdentity", and "Key". :paramtype created_by_type: str or ~azure.mgmt.containerservice.v2021_03_01.models.CreatedByType :keyword created_at: The timestamp of resource creation (UTC). @@ -4924,13 +4869,13 @@ def __init__( :keyword last_modified_by: The identity that last modified the resource. :paramtype last_modified_by: str :keyword last_modified_by_type: The type of identity that last modified the resource. Known - values are: "User", "Application", "ManagedIdentity", "Key". + values are: "User", "Application", "ManagedIdentity", and "Key". :paramtype last_modified_by_type: str or ~azure.mgmt.containerservice.v2021_03_01.models.CreatedByType :keyword last_modified_at: The type of identity that last modified the resource. :paramtype last_modified_at: ~datetime.datetime """ - super(SystemData, self).__init__(**kwargs) + super().__init__(**kwargs) self.created_by = created_by self.created_by_type = created_by_type self.created_at = created_at @@ -4939,66 +4884,57 @@ def __init__( self.last_modified_at = last_modified_at -class TagsObject(msrest.serialization.Model): +class TagsObject(_serialization.Model): """Tags object for patch operations. - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] """ _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] """ - super(TagsObject, self).__init__(**kwargs) + super().__init__(**kwargs) self.tags = tags -class TimeInWeek(msrest.serialization.Model): +class TimeInWeek(_serialization.Model): """Time in a week. :ivar day: A day in a week. Known values are: "Sunday", "Monday", "Tuesday", "Wednesday", - "Thursday", "Friday", "Saturday". + "Thursday", "Friday", and "Saturday". :vartype day: str or ~azure.mgmt.containerservice.v2021_03_01.models.WeekDay :ivar hour_slots: hour slots in a day. :vartype hour_slots: list[int] """ _attribute_map = { - 'day': {'key': 'day', 'type': 'str'}, - 'hour_slots': {'key': 'hourSlots', 'type': '[int]'}, + "day": {"key": "day", "type": "str"}, + "hour_slots": {"key": "hourSlots", "type": "[int]"}, } def __init__( - self, - *, - day: Optional[Union[str, "_models.WeekDay"]] = None, - hour_slots: Optional[List[int]] = None, - **kwargs + self, *, day: Optional[Union[str, "_models.WeekDay"]] = None, hour_slots: Optional[List[int]] = None, **kwargs ): """ :keyword day: A day in a week. Known values are: "Sunday", "Monday", "Tuesday", "Wednesday", - "Thursday", "Friday", "Saturday". + "Thursday", "Friday", and "Saturday". :paramtype day: str or ~azure.mgmt.containerservice.v2021_03_01.models.WeekDay :keyword hour_slots: hour slots in a day. :paramtype hour_slots: list[int] """ - super(TimeInWeek, self).__init__(**kwargs) + super().__init__(**kwargs) self.day = day self.hour_slots = hour_slots -class TimeSpan(msrest.serialization.Model): +class TimeSpan(_serialization.Model): """The time span with start and end properties. :ivar start: The start of a time span. @@ -5008,23 +4944,17 @@ class TimeSpan(msrest.serialization.Model): """ _attribute_map = { - 'start': {'key': 'start', 'type': 'iso-8601'}, - 'end': {'key': 'end', 'type': 'iso-8601'}, + "start": {"key": "start", "type": "iso-8601"}, + "end": {"key": "end", "type": "iso-8601"}, } - def __init__( - self, - *, - start: Optional[datetime.datetime] = None, - end: Optional[datetime.datetime] = None, - **kwargs - ): + def __init__(self, *, start: Optional[datetime.datetime] = None, end: Optional[datetime.datetime] = None, **kwargs): """ :keyword start: The start of a time span. :paramtype start: ~datetime.datetime :keyword end: The end of a time span. :paramtype end: ~datetime.datetime """ - super(TimeSpan, self).__init__(**kwargs) + super().__init__(**kwargs) self.start = start self.end = end diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/models/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/models/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/models/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/models/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/operations/__init__.py index f0e265d9f2f4..f27b588ca549 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/operations/__init__.py @@ -17,14 +17,15 @@ from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'Operations', - 'ManagedClustersOperations', - 'MaintenanceConfigurationsOperations', - 'AgentPoolsOperations', - 'PrivateEndpointConnectionsOperations', - 'PrivateLinkResourcesOperations', - 'ResolvePrivateLinkServiceIdOperations', + "Operations", + "ManagedClustersOperations", + "MaintenanceConfigurationsOperations", + "AgentPoolsOperations", + "PrivateEndpointConnectionsOperations", + "PrivateLinkResourcesOperations", + "ResolvePrivateLinkServiceIdOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/operations/_agent_pools_operations.py index 7ee26761a1ff..dee74f4db21c 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/operations/_agent_pools_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,288 +27,289 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - *, - json: Optional[_models.AgentPool] = None, - content: Any = None, - **kwargs: Any + _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, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + _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, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_get_upgrade_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_available_agent_pool_versions_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_upgrade_node_image_version_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_upgrade_node_image_version_request( + resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class AgentPoolsOperations: """ @@ -324,48 +330,40 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> Iterable[_models.AgentPoolListResult]: + def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> Iterable["_models.AgentPool"]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. The operation returns properties of each agent pool. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AgentPoolListResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_03_01.models.AgentPoolListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either AgentPool or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_03_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -373,16 +371,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -398,10 +391,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -411,54 +402,45 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore @distributed_trace def get( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPool: """Gets the agent pool. Gets the details of the agent pool by managed cluster and resource group. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPool, or the result of cls(response) + :return: AgentPool or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_03_01.models.AgentPool - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -466,57 +448,60 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore def _create_or_update_initial( self, resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: _models.AgentPool, + parameters: Union[_models.AgentPool, IO], **kwargs: Any ) -> _models.AgentPool: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - _json = self._serialize.body(parameters, 'AgentPool') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "AgentPool") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -524,10 +509,9 @@ def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -535,40 +519,125 @@ def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - @distributed_trace + @overload def begin_create_or_update( self, resource_group_name: str, resource_name: str, agent_pool_name: str, parameters: _models.AgentPool, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.AgentPool]: """Creates or updates an agent pool. Creates or updates an agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :param parameters: Parameters supplied to the Create or Update an agent pool operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2021_03_01.models.AgentPool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_03_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AgentPool]: + """Creates or updates an agent pool. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: Parameters supplied to the Create or Update an agent pool operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_03_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: Union[_models.AgentPool, IO], + **kwargs: Any + ) -> LROPoller[_models.AgentPool]: + """Creates or updates an agent pool. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: Parameters supplied to the Create or Update an agent pool operation. Is + either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_03_01.models.AgentPool or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -580,20 +649,17 @@ def begin_create_or_update( :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_03_01.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -602,66 +668,55 @@ def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -669,10 +724,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -682,26 +736,21 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + def begin_delete( + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> LROPoller[None]: """Deletes an agent pool. Deletes the agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -713,100 +762,86 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPoolUpgradeProfile: """Gets upgrade profile for an agent pool. Gets the details of the upgrade profile for an agent pool with a specified resource group and managed cluster name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolUpgradeProfile, or the result of cls(response) + :return: AgentPoolUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_03_01.models.AgentPoolUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -814,64 +849,56 @@ def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolUpgradeProfile', pipeline_response) + deserialized = self._deserialize("AgentPoolUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore @distributed_trace def get_available_agent_pool_versions( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported versions for the specified agent pool. Gets a list of supported versions for the specified agent pool. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolAvailableVersions, or the result of cls(response) + :return: AgentPoolAvailableVersions or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_03_01.models.AgentPoolAvailableVersions - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolAvailableVersions] - request = build_get_available_agent_pool_versions_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_available_agent_pool_versions.metadata['url'], + template_url=self.get_available_agent_pool_versions.metadata["url"], headers=_headers, params=_params, ) @@ -879,52 +906,43 @@ def get_available_agent_pool_versions( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolAvailableVersions', pipeline_response) + deserialized = self._deserialize("AgentPoolAvailableVersions", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_available_agent_pool_versions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore - + get_available_agent_pool_versions.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore def _upgrade_node_image_version_initial( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> Optional[_models.AgentPool]: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.AgentPool]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.AgentPool]] - - request = build_upgrade_node_image_version_request_initial( - subscription_id=self._config.subscription_id, + request = build_upgrade_node_image_version_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._upgrade_node_image_version_initial.metadata['url'], + template_url=self._upgrade_node_image_version_initial.metadata["url"], headers=_headers, params=_params, ) @@ -932,10 +950,9 @@ def _upgrade_node_image_version_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -944,33 +961,28 @@ def _upgrade_node_image_version_initial( deserialized = None if response.status_code == 202: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _upgrade_node_image_version_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore - + _upgrade_node_image_version_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore @distributed_trace def begin_upgrade_node_image_version( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any - ) -> LROPoller[_models.AgentPool]: + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any + ) -> LROPoller[None]: """Upgrade node image version of an agent pool to the latest. Upgrade node image version of an agent pool to the latest. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -983,55 +995,48 @@ def begin_upgrade_node_image_version( :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_03_01.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._upgrade_node_image_version_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_upgrade_node_image_version.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore + begin_upgrade_node_image_version.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/operations/_maintenance_configurations_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/operations/_maintenance_configurations_operations.py index fc57769537e7..4579bfe10cb0 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/operations/_maintenance_configurations_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/operations/_maintenance_configurations_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,173 +25,173 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +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_managed_cluster_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, config_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 = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "configName": _SERIALIZER.url("config_name", config_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "configName": _SERIALIZER.url("config_name", config_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - config_name: str, - *, - json: Optional[_models.MaintenanceConfiguration] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, resource_name: str, config_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 = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "configName": _SERIALIZER.url("config_name", config_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "configName": _SERIALIZER.url("config_name", config_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, config_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 = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "configName": _SERIALIZER.url("config_name", config_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "configName": _SERIALIZER.url("config_name", config_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class MaintenanceConfigurationsOperations: """ @@ -207,49 +212,44 @@ def __init__(self, *args, **kwargs): 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_managed_cluster( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> Iterable[_models.MaintenanceConfigurationListResult]: + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> Iterable["_models.MaintenanceConfiguration"]: """Gets a list of maintenance configurations in the specified managed cluster. Gets a list of maintenance configurations in the specified managed cluster. The operation returns properties of each maintenance configuration. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either MaintenanceConfigurationListResult or the result - of cls(response) + :return: An iterator like instance of either MaintenanceConfiguration or the result of + cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_03_01.models.MaintenanceConfigurationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_03_01.models.MaintenanceConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfigurationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfigurationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_managed_cluster_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_managed_cluster.metadata['url'], + template_url=self.list_by_managed_cluster.metadata["url"], headers=_headers, params=_params, ) @@ -257,16 +257,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_managed_cluster_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -282,10 +277,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -295,54 +288,45 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_managed_cluster.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations"} # type: ignore + list_by_managed_cluster.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations"} # type: ignore @distributed_trace def get( - self, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, config_name: str, **kwargs: Any ) -> _models.MaintenanceConfiguration: """Gets the maintenance configuration. Gets the details of maintenance configurations by managed cluster and resource group. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: MaintenanceConfiguration, or the result of cls(response) + :return: MaintenanceConfiguration or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_03_01.models.MaintenanceConfiguration - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfiguration] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -350,76 +334,149 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) + deserialized = self._deserialize("MaintenanceConfiguration", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - - @distributed_trace + @overload def create_or_update( self, resource_group_name: str, resource_name: str, config_name: str, parameters: _models.MaintenanceConfiguration, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.MaintenanceConfiguration: """Creates or updates a maintenance configurations. Creates or updates a maintenance configuration in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str :param parameters: Parameters supplied to the Create or Update a default maintenance - configuration. + configuration. Required. :type parameters: ~azure.mgmt.containerservice.v2021_03_01.models.MaintenanceConfiguration + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: MaintenanceConfiguration, or the result of cls(response) + :return: MaintenanceConfiguration or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_03_01.models.MaintenanceConfiguration - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configurations. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: Parameters supplied to the Create or Update a default maintenance + configuration. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_03_01.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: Union[_models.MaintenanceConfiguration, IO], + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configurations. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: Parameters supplied to the Create or Update a default maintenance + configuration. Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_03_01.models.MaintenanceConfiguration or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_03_01.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfiguration] - _json = self._serialize.body(parameters, 'MaintenanceConfiguration') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "MaintenanceConfiguration") request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) @@ -427,68 +484,59 @@ def create_or_update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) + deserialized = self._deserialize("MaintenanceConfiguration", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore @distributed_trace def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, config_name: str, **kwargs: Any ) -> None: """Deletes a maintenance configuration. Deletes the maintenance configuration in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) @@ -496,10 +544,9 @@ def delete( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -509,5 +556,4 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/operations/_managed_clusters_operations.py index 227893546796..cc05fa6b76a1 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/operations/_managed_clusters_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,754 +27,724 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_get_os_options_request( - subscription_id: str, - location: str, - *, - resource_type: Optional[str] = None, - **kwargs: Any + location: str, subscription_id: str, *, resource_type: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "location": _SERIALIZER.url("location", location, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if resource_type is not None: - _params['resource-type'] = _SERIALIZER.query("resource_type", resource_type, 'str') + _params["resource-type"] = _SERIALIZER.query("resource_type", resource_type, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters") + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters" + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_resource_group_request( - subscription_id: str, - resource_group_name: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters", + ) # 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', min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_upgrade_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_access_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, role_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 = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "roleName": _SERIALIZER.url("role_name", role_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "roleName": _SERIALIZER.url("role_name", role_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_admin_credentials_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_user_credentials_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_monitoring_user_credentials_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: + +def build_get_request(resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedCluster] = None, - content: Any = None, - **kwargs: Any +def build_create_or_update_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_update_tags_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.TagsObject] = None, - content: Any = None, - **kwargs: Any +def build_update_tags_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any +def build_delete_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_reset_service_principal_profile_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedClusterServicePrincipalProfile] = None, - content: Any = None, - **kwargs: Any +def build_reset_service_principal_profile_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_reset_aad_profile_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedClusterAADProfile] = None, - content: Any = None, - **kwargs: Any +def build_reset_aad_profile_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_rotate_cluster_certificates_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any +def build_rotate_cluster_certificates_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_stop_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any +def build_stop_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_start_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any +def build_start_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_run_command_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.RunCommandRequest] = None, - content: Any = None, - **kwargs: Any +def build_run_command_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_get_command_result_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - command_id: str, - **kwargs: Any + resource_group_name: str, resource_name: str, command_id: 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "commandId": _SERIALIZER.url("command_id", command_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "commandId": _SERIALIZER.url("command_id", command_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + class ManagedClustersOperations: # pylint: disable=too-many-public-methods """ @@ -790,46 +765,39 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def get_os_options( - self, - location: str, - resource_type: Optional[str] = None, - **kwargs: Any + self, location: str, resource_type: Optional[str] = None, **kwargs: Any ) -> _models.OSOptionProfile: """Gets supported OS options in the specified subscription. Gets supported OS options in the specified subscription. - :param location: The name of a supported Azure region. + :param location: The name of a supported Azure region. Required. :type location: str :param resource_type: resource type for which the OS options needs to be returned. Default value is None. :type resource_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: OSOptionProfile, or the result of cls(response) + :return: OSOptionProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_03_01.models.OSOptionProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OSOptionProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OSOptionProfile] - request = build_get_os_options_request( - subscription_id=self._config.subscription_id, location=location, - api_version=api_version, + subscription_id=self._config.subscription_id, resource_type=resource_type, - template_url=self.get_os_options.metadata['url'], + api_version=api_version, + template_url=self.get_os_options.metadata["url"], headers=_headers, params=_params, ) @@ -837,60 +805,53 @@ def get_os_options( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('OSOptionProfile', pipeline_response) + deserialized = self._deserialize("OSOptionProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_os_options.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default"} # type: ignore - + get_os_options.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default"} # type: ignore @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.ManagedClusterListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.ManagedCluster"]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. The operation returns properties of each managed cluster. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_03_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_03_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -898,14 +859,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -921,10 +879,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -934,50 +890,42 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> Iterable[_models.ManagedClusterListResult]: + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.ManagedCluster"]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. The operation returns properties of each managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_03_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_03_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -985,15 +933,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -1009,10 +953,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1022,51 +964,43 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.ManagedClusterUpgradeProfile: """Gets upgrade profile for a managed cluster. Gets the details of the upgrade profile for a managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterUpgradeProfile, or the result of cls(response) + :return: ManagedClusterUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_03_01.models.ManagedClusterUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -1074,33 +1008,27 @@ def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterUpgradeProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore @distributed_trace def get_access_profile( - self, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, role_name: str, **kwargs: Any ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. @@ -1111,36 +1039,33 @@ def get_access_profile( `ListClusterAdminCredentials `_ . - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param role_name: The name of the role for managed cluster accessProfile resource. + :param role_name: The name of the role for managed cluster accessProfile resource. Required. :type role_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterAccessProfile, or the result of cls(response) + :return: ManagedClusterAccessProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_03_01.models.ManagedClusterAccessProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterAccessProfile] - request = build_get_access_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, role_name=role_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_access_profile.metadata['url'], + template_url=self.get_access_profile.metadata["url"], headers=_headers, params=_params, ) @@ -1148,64 +1073,56 @@ def get_access_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterAccessProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterAccessProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_access_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore - + get_access_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore @distributed_trace def list_cluster_admin_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster admin credential of a managed cluster. Gets cluster admin credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_03_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_admin_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_admin_credentials.metadata['url'], + template_url=self.list_cluster_admin_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -1213,64 +1130,56 @@ def list_cluster_admin_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_admin_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore - + list_cluster_admin_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore @distributed_trace def list_cluster_user_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster user credential of a managed cluster. Gets cluster user credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_03_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_user_credentials.metadata['url'], + template_url=self.list_cluster_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -1278,65 +1187,57 @@ def list_cluster_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore - + list_cluster_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore @distributed_trace def list_cluster_monitoring_user_credentials( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.CredentialResults: """Gets cluster monitoring user credential of a managed cluster. Gets cluster monitoring user credential of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_03_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_monitoring_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + template_url=self.list_cluster_monitoring_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -1344,64 +1245,54 @@ def list_cluster_monitoring_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_monitoring_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore - + list_cluster_monitoring_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore @distributed_trace - def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.ManagedCluster: + def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.ManagedCluster: """Gets a managed cluster. Gets the details of the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedCluster, or the result of cls(response) + :return: ManagedCluster or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_03_01.models.ManagedCluster - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -1409,55 +1300,54 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _create_or_update_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.ManagedCluster, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'ManagedCluster') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedCluster") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1465,10 +1355,9 @@ def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -1476,25 +1365,26 @@ def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - @distributed_trace + @overload def begin_create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedCluster, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. @@ -1502,12 +1392,90 @@ def begin_create_or_update( Creates or updates a managed cluster with the specified configuration for agents and Kubernetes version. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2021_03_01.models.ManagedCluster + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_03_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster with the specified configuration for agents and Kubernetes + version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_03_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster with the specified configuration for agents and Kubernetes + version. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Create or Update a Managed Cluster operation. Is + either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_03_01.models.ManagedCluster or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1520,20 +1488,17 @@ def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_03_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -1541,69 +1506,66 @@ def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _update_tags_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.TagsObject, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request_initial( - subscription_id=self._config.subscription_id, + request = build_update_tags_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_tags_initial.metadata['url'], + content=_content, + template_url=self._update_tags_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1611,44 +1573,47 @@ def _update_tags_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_tags_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + _update_tags_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - - @distributed_trace + @overload def begin_update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates a managed cluster with the specified tags. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2021_03_01.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1661,96 +1626,153 @@ def begin_update_tags( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_03_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._update_tags_initial( # type: ignore - resource_group_name=resource_group_name, - resource_name=resource_name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - def _delete_initial( # pylint: disable=inconsistent-return-statements + @overload + def begin_update_tags( self, resource_group_name: str, resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", **kwargs: Any - ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + ) -> LROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + Updates a managed cluster with the specified tags. - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - headers=_headers, + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_03_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates a managed cluster with the specified tags. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_03_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_03_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_tags_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ManagedCluster", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> None: + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + + request = build_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, params=_params, ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1760,23 +1782,17 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> LROPoller[None]: + def begin_delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> LROPoller[None]: """Deletes a managed cluster. Deletes the managed cluster with a specified resource group and name. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1788,85 +1804,83 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterServicePrincipalProfile, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterServicePrincipalProfile") - request = build_reset_service_principal_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_service_principal_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_service_principal_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_service_principal_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1874,10 +1888,9 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1887,29 +1900,70 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re if cls: return cls(pipeline_response, None, {}) - _reset_service_principal_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore - + _reset_service_principal_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore - @distributed_trace - def begin_reset_service_principal_profile( # pylint: disable=inconsistent-return-statements + @overload + def begin_reset_service_principal_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterServicePrincipalProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: """Reset Service Principal Profile of a managed cluster. Update the service principal Profile for a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a - Managed Cluster. + Managed Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2021_03_01.models.ManagedClusterServicePrincipalProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reset Service Principal Profile of a managed cluster. + + Update the service principal Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a + Managed Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1920,20 +1974,53 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Reset Service Principal Profile of a managed cluster. + + Update the service principal Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset Service Principal Profile operation for a + Managed Cluster. Is either a model type or a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2021_03_01.models.ManagedClusterServicePrincipalProfile or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1941,67 +2028,68 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_service_principal_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + begin_reset_service_principal_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterAADProfile, + parameters: Union[_models.ManagedClusterAADProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterAADProfile") - request = build_reset_aad_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_aad_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_aad_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_aad_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2009,10 +2097,9 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -2022,28 +2109,105 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement if cls: return cls(pipeline_response, None, {}) - _reset_aad_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - + _reset_aad_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - @distributed_trace - def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements + @overload + def begin_reset_aad_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterAADProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: """Reset AAD Profile of a managed cluster. Update the AAD Profile for a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed - Cluster. + Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2021_03_01.models.ManagedClusterAADProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reset AAD Profile of a managed cluster. + + Update the AAD Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed + Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterAADProfile, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Reset AAD Profile of a managed cluster. + + Update the AAD Profile for a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Reset AAD Profile operation for a Managed + Cluster. Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_03_01.models.ManagedClusterAADProfile or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -2054,20 +2218,17 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -2075,62 +2236,52 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_aad_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + begin_reset_aad_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_rotate_cluster_certificates_request_initial( - subscription_id=self._config.subscription_id, + request = build_rotate_cluster_certificates_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._rotate_cluster_certificates_initial.metadata['url'], + template_url=self._rotate_cluster_certificates_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2138,10 +2289,9 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -2151,23 +2301,19 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return if cls: return cls(pipeline_response, None, {}) - _rotate_cluster_certificates_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore - + _rotate_cluster_certificates_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore @distributed_trace - def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + def begin_rotate_cluster_certificates( + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> LROPoller[None]: """Rotate certificates of a managed cluster. Rotate certificates of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -2179,80 +2325,67 @@ def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-st Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._rotate_cluster_certificates_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_rotate_cluster_certificates.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore + begin_rotate_cluster_certificates.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore def _stop_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_stop_request_initial( - subscription_id=self._config.subscription_id, + request = build_stop_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._stop_initial.metadata['url'], + template_url=self._stop_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2260,10 +2393,9 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -2273,23 +2405,17 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore - + _stop_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore @distributed_trace - def begin_stop( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> LROPoller[None]: + def begin_stop(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> LROPoller[None]: """Stop Managed Cluster. Stops a Running Managed Cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -2301,80 +2427,67 @@ def begin_stop( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._stop_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore + begin_stop.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore def _start_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_start_request_initial( - subscription_id=self._config.subscription_id, + request = build_start_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._start_initial.metadata['url'], + template_url=self._start_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2382,10 +2495,9 @@ def _start_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -2395,23 +2507,17 @@ def _start_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore - + _start_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore @distributed_trace - def begin_start( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> LROPoller[None]: + def begin_start(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> LROPoller[None]: """Start Managed Cluster. Starts a Stopped Managed Cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -2423,85 +2529,83 @@ def begin_start( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._start_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore + begin_start.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore def _run_command_initial( self, resource_group_name: str, resource_name: str, - request_payload: _models.RunCommandRequest, + request_payload: Union[_models.RunCommandRequest, IO], **kwargs: Any ) -> Optional[_models.RunCommandResult]: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RunCommandResult]] - _json = self._serialize.body(request_payload, 'RunCommandRequest') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(request_payload, (IO, bytes)): + _content = request_payload + else: + _json = self._serialize.body(request_payload, "RunCommandRequest") - request = build_run_command_request_initial( - subscription_id=self._config.subscription_id, + request = build_run_command_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._run_command_initial.metadata['url'], + content=_content, + template_url=self._run_command_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2509,10 +2613,9 @@ def _run_command_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -2521,22 +2624,23 @@ def _run_command_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _run_command_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore - + _run_command_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore - @distributed_trace + @overload def begin_run_command( self, resource_group_name: str, resource_name: str, request_payload: _models.RunCommandRequest, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.RunCommandResult]: """Run Command against Managed Kubernetes Service. @@ -2544,12 +2648,15 @@ def begin_run_command( Submit a command to run against managed kubernetes service, it will create a pod to run the command. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param request_payload: Parameters supplied to the RunCommand operation. + :param request_payload: Parameters supplied to the RunCommand operation. Required. :type request_payload: ~azure.mgmt.containerservice.v2021_03_01.models.RunCommandRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -2562,20 +2669,94 @@ def begin_run_command( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_03_01.models.RunCommandResult] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_run_command( + self, + resource_group_name: str, + resource_name: str, + request_payload: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RunCommandResult]: + """Run Command against Managed Kubernetes Service. + + Submit a command to run against managed kubernetes service, it will create a pod to run the + command. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param request_payload: Parameters supplied to the RunCommand operation. Required. + :type request_payload: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either RunCommandResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_03_01.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_run_command( + self, + resource_group_name: str, + resource_name: str, + request_payload: Union[_models.RunCommandRequest, IO], + **kwargs: Any + ) -> LROPoller[_models.RunCommandResult]: + """Run Command against Managed Kubernetes Service. + + Submit a command to run against managed kubernetes service, it will create a pod to run the + command. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param request_payload: Parameters supplied to the RunCommand operation. Is either a model type + or a IO type. Required. + :type request_payload: ~azure.mgmt.containerservice.v2021_03_01.models.RunCommandRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either RunCommandResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_03_01.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.RunCommandResult] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.RunCommandResult] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._run_command_initial( # type: ignore resource_group_name=resource_group_name, @@ -2583,82 +2764,71 @@ def begin_run_command( request_payload=request_payload, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_run_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore + begin_run_command.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore @distributed_trace def get_command_result( - self, - resource_group_name: str, - resource_name: str, - command_id: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, command_id: str, **kwargs: Any ) -> Optional[_models.RunCommandResult]: """Get command result. Get command result from previous runCommand invoke. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param command_id: Id of the command request. + :param command_id: Id of the command request. Required. :type command_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: RunCommandResult, or the result of cls(response) + :return: RunCommandResult or None or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_03_01.models.RunCommandResult or None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RunCommandResult]] - request = build_get_command_result_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, command_id=command_id, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_command_result.metadata['url'], + template_url=self.get_command_result.metadata["url"], headers=_headers, params=_params, ) @@ -2666,10 +2836,9 @@ def get_command_result( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -2678,12 +2847,11 @@ def get_command_result( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_command_result.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}"} # type: ignore - + get_command_result.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/operations/_operations.py index b37f9ff585df..38b788ee073c 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/operations/_operations.py @@ -7,10 +7,15 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,38 +25,34 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - **kwargs: Any -) -> HttpRequest: + +def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.ContainerService/operations") # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class Operations: """ @@ -72,36 +73,31 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.OperationListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.OperationValue"]: """Gets a list of compute operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationListResult or the result of cls(response) + :return: An iterator like instance of either OperationValue or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_03_01.models.OperationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_03_01.models.OperationValue] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -109,13 +105,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -131,10 +125,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -144,8 +136,6 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.ContainerService/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ContainerService/operations"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/operations/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/operations/_private_endpoint_connections_operations.py index 3743dd042fa8..0eef696e2fd3 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/operations/_private_endpoint_connections_operations.py @@ -6,11 +6,15 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod @@ -21,173 +25,191 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - subscription_id: str, resource_group_name: str, resource_name: str, private_endpoint_connection_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 = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_update_request( - subscription_id: str, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, - *, - json: Optional[_models.PrivateEndpointConnection] = None, - content: Any = None, + subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request_initial( - subscription_id: str, +def build_delete_request( resource_group_name: str, resource_name: str, private_endpoint_connection_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 = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class PrivateEndpointConnectionsOperations: """ @@ -208,46 +230,39 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnectionListResult: """Gets a list of private endpoint connections in the specified managed cluster. Gets a list of private endpoint connections in the specified managed cluster. The operation returns properties of each private endpoint connection. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnectionListResult, or the result of cls(response) + :return: PrivateEndpointConnectionListResult or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_03_01.models.PrivateEndpointConnectionListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnectionListResult] - request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -255,68 +270,59 @@ def list( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore - + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore @distributed_trace def get( - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnection: """Gets the private endpoint connection. Gets the details of the private endpoint connection by managed cluster and resource group. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_03_01.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -324,75 +330,149 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - @distributed_trace + @overload def update( self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, parameters: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateEndpointConnection: """Updates a private endpoint connection. Updates a private endpoint connection in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :param parameters: Parameters supplied to the Update a private endpoint connection operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2021_03_01.models.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_03_01.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: Parameters supplied to the Update a private endpoint connection operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_03_01.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @distributed_trace + def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: Union[_models.PrivateEndpointConnection, IO], + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: Parameters supplied to the Update a private endpoint connection operation. + Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_03_01.models.PrivateEndpointConnection or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_03_01.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - _json = self._serialize.body(parameters, 'PrivateEndpointConnection') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateEndpointConnection") request = build_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update.metadata['url'], + content=_content, + template_url=self.update.metadata["url"], headers=_headers, params=_params, ) @@ -400,52 +480,43 @@ def update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -453,10 +524,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -466,26 +536,21 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + def begin_delete( + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> LROPoller[None]: """Deletes a private endpoint connection. Deletes the private endpoint connection in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -497,53 +562,46 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/operations/_private_link_resources_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/operations/_private_link_resources_operations.py index 5cdfea5e3eef..f36cad3e28b4 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/operations/_private_link_resources_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/operations/_private_link_resources_operations.py @@ -8,9 +8,13 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -19,48 +23,53 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class PrivateLinkResourcesOperations: """ @@ -81,46 +90,39 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.PrivateLinkResourcesListResult: """Gets a list of private link resources in the specified managed cluster. Gets a list of private link resources in the specified managed cluster. The operation returns properties of each private link resource. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResourcesListResult, or the result of cls(response) + :return: PrivateLinkResourcesListResult or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_03_01.models.PrivateLinkResourcesListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResourcesListResult] - request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -128,22 +130,20 @@ def list( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResourcesListResult', pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources"} # type: ignore - + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/operations/_resolve_private_link_service_id_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/operations/_resolve_private_link_service_id_operations.py index 755ff16fe08f..e93a68bb5208 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/operations/_resolve_private_link_service_id_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/operations/_resolve_private_link_service_id_operations.py @@ -6,11 +6,15 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -19,56 +23,56 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_post_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.PrivateLinkResource] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + class ResolvePrivateLinkServiceIdOperations: """ @@ -89,53 +93,120 @@ def __init__(self, *args, **kwargs): 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 + @overload def post( self, resource_group_name: str, resource_name: str, parameters: _models.PrivateLinkResource, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateLinkResource: """Gets the private link service ID for the specified managed cluster. Gets the private link service ID the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters (name, groupId) supplied in order to resolve a private link - service ID. + service ID. Required. :type parameters: ~azure.mgmt.containerservice.v2021_03_01.models.PrivateLinkResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResource, or the result of cls(response) + :return: PrivateLinkResource or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_03_01.models.PrivateLinkResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + def post( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters (name, groupId) supplied in order to resolve a private link + service ID. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_03_01.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def post( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.PrivateLinkResource, IO], + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters (name, groupId) supplied in order to resolve a private link + service ID. Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_03_01.models.PrivateLinkResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_03_01.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResource] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResource] - _json = self._serialize.body(parameters, 'PrivateLinkResource') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateLinkResource") request = build_post_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.post.metadata['url'], + content=_content, + template_url=self.post.metadata["url"], headers=_headers, params=_params, ) @@ -143,22 +214,20 @@ def post( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResource', pipeline_response) + deserialized = self._deserialize("PrivateLinkResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - post.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId"} # type: ignore - + post.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/__init__.py index 37a5f9e02e6f..a8716d29afe8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/__init__.py @@ -14,7 +14,8 @@ except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['ContainerServiceClient'] + +__all__ = ["ContainerServiceClient"] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/_configuration.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/_configuration.py index 39b0ad4c93dd..9574e18da22b 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/_configuration.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/_configuration.py @@ -18,30 +18,26 @@ VERSION = "unknown" + class ContainerServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ContainerServiceClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2021-05-01". 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: + def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ContainerServiceClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2021-05-01") # type: str + api_version = kwargs.pop("api_version", "2021-05-01") # type: str if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -51,23 +47,24 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-containerservice/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-containerservice/{}".format(VERSION)) self._configure(**kwargs) def _configure( - self, - **kwargs # type: Any + self, **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/_container_service_client.py index 675423a21fb2..4150d5bf9eed 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/_container_service_client.py @@ -9,20 +9,28 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from . import models +from .._serialization import Deserializer, Serializer from ._configuration import ContainerServiceClientConfiguration -from .operations import AgentPoolsOperations, MaintenanceConfigurationsOperations, ManagedClustersOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, ResolvePrivateLinkServiceIdOperations +from .operations import ( + AgentPoolsOperations, + MaintenanceConfigurationsOperations, + ManagedClustersOperations, + Operations, + PrivateEndpointConnectionsOperations, + PrivateLinkResourcesOperations, + ResolvePrivateLinkServiceIdOperations, +) if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class ContainerServiceClient: # pylint: disable=too-many-instance-attributes + +class ContainerServiceClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """The Container Service Client. :ivar operations: Operations operations @@ -44,10 +52,10 @@ class ContainerServiceClient: # pylint: disable=too-many-instance-attributes :ivar resolve_private_link_service_id: ResolvePrivateLinkServiceIdOperations operations :vartype resolve_private_link_service_id: azure.mgmt.containerservice.v2021_05_01.operations.ResolvePrivateLinkServiceIdOperations - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -65,25 +73,23 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = ContainerServiceClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = ContainerServiceClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize - ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.managed_clusters = ManagedClustersOperations( self._client, self._config, self._serialize, self._deserialize ) self.maintenance_configurations = MaintenanceConfigurationsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.agent_pools = AgentPoolsOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) self.private_endpoint_connections = PrivateEndpointConnectionsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -94,12 +100,7 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) - - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> HttpResponse: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -108,7 +109,7 @@ def _send_request( >>> response = client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/_metadata.json b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/_metadata.json index 2d8ab4f41c01..d0bb814886e0 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/_metadata.json +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/_metadata.json @@ -10,20 +10,20 @@ "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { "credential": { - "signature": "credential, # type: \"TokenCredential\"", - "description": "Credential needed for the client to connect to Azure.", + "signature": "credential: \"TokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true }, "subscription_id": { - "signature": "subscription_id, # type: str", - "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "signature": "subscription_id: str,", + "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.", "docstring_type": "str", "required": true } @@ -31,13 +31,13 @@ "async": { "credential": { "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure.", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { "signature": "subscription_id: str,", - "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.", "docstring_type": "str", "required": true } @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=\"https://management.azure.com\", # type: str", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/_patch.py index 74e48ecd07cf..f99e77fef986 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/_patch.py @@ -28,4 +28,4 @@ # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + pass diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/_vendor.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/_vendor.py index 138f663c53a4..9aad73fc743e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/_vendor.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/_vendor.py @@ -7,6 +7,7 @@ from azure.core.pipeline.transport import HttpRequest + def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) @@ -14,6 +15,7 @@ def _convert_request(request, files=None): request.set_formdata_body(files) return request + def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -21,7 +23,5 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [ - c for c in formatted_components if "{}".format(key.args[0]) not in c - ] + components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/aio/__init__.py index 37a5f9e02e6f..a8716d29afe8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/aio/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/aio/__init__.py @@ -14,7 +14,8 @@ except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['ContainerServiceClient'] + +__all__ = ["ContainerServiceClient"] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/aio/_configuration.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/aio/_configuration.py index 91a304b6a70a..49305882499e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/aio/_configuration.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/aio/_configuration.py @@ -18,30 +18,26 @@ VERSION = "unknown" + class ContainerServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ContainerServiceClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2021-05-01". 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: + def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ContainerServiceClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2021-05-01") # type: str + api_version = kwargs.pop("api_version", "2021-05-01") # type: str if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -51,22 +47,21 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-containerservice/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-containerservice/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, - **kwargs: Any - ) -> None: - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/aio/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/aio/_container_service_client.py index 7b89207043ad..a66c4db50976 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/aio/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/aio/_container_service_client.py @@ -9,20 +9,28 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from .. import models +from ..._serialization import Deserializer, Serializer from ._configuration import ContainerServiceClientConfiguration -from .operations import AgentPoolsOperations, MaintenanceConfigurationsOperations, ManagedClustersOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, ResolvePrivateLinkServiceIdOperations +from .operations import ( + AgentPoolsOperations, + MaintenanceConfigurationsOperations, + ManagedClustersOperations, + Operations, + PrivateEndpointConnectionsOperations, + PrivateLinkResourcesOperations, + ResolvePrivateLinkServiceIdOperations, +) if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class ContainerServiceClient: # pylint: disable=too-many-instance-attributes + +class ContainerServiceClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """The Container Service Client. :ivar operations: Operations operations @@ -45,10 +53,10 @@ class ContainerServiceClient: # pylint: disable=too-many-instance-attributes :ivar resolve_private_link_service_id: ResolvePrivateLinkServiceIdOperations operations :vartype resolve_private_link_service_id: azure.mgmt.containerservice.v2021_05_01.aio.operations.ResolvePrivateLinkServiceIdOperations - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -66,25 +74,23 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = ContainerServiceClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = ContainerServiceClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize - ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.managed_clusters = ManagedClustersOperations( self._client, self._config, self._serialize, self._deserialize ) self.maintenance_configurations = MaintenanceConfigurationsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.agent_pools = AgentPoolsOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) self.private_endpoint_connections = PrivateEndpointConnectionsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -95,12 +101,7 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) - - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -109,7 +110,7 @@ def _send_request( >>> response = await client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/aio/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/aio/_patch.py index 74e48ecd07cf..f99e77fef986 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/aio/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/aio/_patch.py @@ -28,4 +28,4 @@ # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + pass diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/aio/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/aio/operations/__init__.py index f0e265d9f2f4..f27b588ca549 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/aio/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/aio/operations/__init__.py @@ -17,14 +17,15 @@ from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'Operations', - 'ManagedClustersOperations', - 'MaintenanceConfigurationsOperations', - 'AgentPoolsOperations', - 'PrivateEndpointConnectionsOperations', - 'PrivateLinkResourcesOperations', - 'ResolvePrivateLinkServiceIdOperations', + "Operations", + "ManagedClustersOperations", + "MaintenanceConfigurationsOperations", + "AgentPoolsOperations", + "PrivateEndpointConnectionsOperations", + "PrivateLinkResourcesOperations", + "ResolvePrivateLinkServiceIdOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/aio/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/aio/operations/_agent_pools_operations.py index 501cc85d2df5..eb4aa10f65b1 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/aio/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/aio/operations/_agent_pools_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +29,20 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._agent_pools_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_available_agent_pool_versions_request, build_get_request, build_get_upgrade_profile_request, build_list_request, build_upgrade_node_image_version_request_initial -T = TypeVar('T') +from ...operations._agent_pools_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_available_agent_pool_versions_request, + build_get_request, + build_get_upgrade_profile_request, + build_list_request, + build_upgrade_node_image_version_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class AgentPoolsOperations: """ .. warning:: @@ -45,47 +62,40 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.AgentPoolListResult]: + def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncIterable["_models.AgentPool"]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AgentPoolListResult or the result of cls(response) + :return: An iterator like instance of either AgentPool or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_05_01.models.AgentPoolListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_05_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -93,16 +103,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -118,10 +123,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -131,54 +134,45 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore @distributed_trace_async async def get( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPool: """Gets the specified managed cluster agent pool. Gets the specified managed cluster agent pool. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPool, or the result of cls(response) + :return: AgentPool or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_05_01.models.AgentPool - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -186,57 +180,60 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore async def _create_or_update_initial( self, resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: _models.AgentPool, + parameters: Union[_models.AgentPool, IO], **kwargs: Any ) -> _models.AgentPool: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - _json = self._serialize.body(parameters, 'AgentPool') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "AgentPool") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -244,10 +241,9 @@ async def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -255,40 +251,44 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - @distributed_trace_async + @overload async def begin_create_or_update( self, resource_group_name: str, resource_name: str, agent_pool_name: str, parameters: _models.AgentPool, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.AgentPool]: """Creates or updates an agent pool in the specified managed cluster. Creates or updates an agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str - :param parameters: The agent pool to create or update. + :param parameters: The agent pool to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2021_05_01.models.AgentPool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -301,20 +301,98 @@ async def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_05_01.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AgentPool]: + """Creates or updates an agent pool in the specified managed cluster. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: The agent pool to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AgentPool or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_05_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: Union[_models.AgentPool, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.AgentPool]: + """Creates or updates an agent pool in the specified managed cluster. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: The agent pool to create or update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.mgmt.containerservice.v2021_05_01.models.AgentPool or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AgentPool or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_05_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -323,66 +401,55 @@ async def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -390,10 +457,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -403,26 +469,21 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + async def begin_delete( + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes an agent pool in the specified managed cluster. Deletes an agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -434,99 +495,85 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace_async async def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPoolUpgradeProfile: """Gets the upgrade profile for an agent pool. Gets the upgrade profile for an agent pool. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolUpgradeProfile, or the result of cls(response) + :return: AgentPoolUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_05_01.models.AgentPoolUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -534,32 +581,27 @@ async def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolUpgradeProfile', pipeline_response) + deserialized = self._deserialize("AgentPoolUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore @distributed_trace_async async def get_available_agent_pool_versions( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported Kubernetes versions for the specified agent pool. @@ -567,33 +609,30 @@ async def get_available_agent_pool_versions( `_ for more details about the version lifecycle. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolAvailableVersions, or the result of cls(response) + :return: AgentPoolAvailableVersions or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_05_01.models.AgentPoolAvailableVersions - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolAvailableVersions] - request = build_get_available_agent_pool_versions_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_available_agent_pool_versions.metadata['url'], + template_url=self.get_available_agent_pool_versions.metadata["url"], headers=_headers, params=_params, ) @@ -601,52 +640,43 @@ async def get_available_agent_pool_versions( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolAvailableVersions', pipeline_response) + deserialized = self._deserialize("AgentPoolAvailableVersions", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_available_agent_pool_versions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore - + get_available_agent_pool_versions.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore async def _upgrade_node_image_version_initial( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> Optional[_models.AgentPool]: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.AgentPool]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.AgentPool]] - - request = build_upgrade_node_image_version_request_initial( - subscription_id=self._config.subscription_id, + request = build_upgrade_node_image_version_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._upgrade_node_image_version_initial.metadata['url'], + template_url=self._upgrade_node_image_version_initial.metadata["url"], headers=_headers, params=_params, ) @@ -654,10 +684,9 @@ async def _upgrade_node_image_version_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -666,35 +695,30 @@ async def _upgrade_node_image_version_initial( deserialized = None if response.status_code == 202: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _upgrade_node_image_version_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore - + _upgrade_node_image_version_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore @distributed_trace_async async def begin_upgrade_node_image_version( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any - ) -> AsyncLROPoller[_models.AgentPool]: + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: """Upgrades the node image version of an agent pool to the latest. Upgrading the node image version of an agent pool applies the newest OS and runtime updates to the nodes. AKS provides one new image per week with the latest updates. For more details on node image versions, see: https://docs.microsoft.com/azure/aks/node-image-upgrade. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -708,55 +732,48 @@ async def begin_upgrade_node_image_version( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_05_01.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._upgrade_node_image_version_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_upgrade_node_image_version.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore + begin_upgrade_node_image_version.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/aio/operations/_maintenance_configurations_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/aio/operations/_maintenance_configurations_operations.py index 51cd7ea9d64e..3ffdd1af5656 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/aio/operations/_maintenance_configurations_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/aio/operations/_maintenance_configurations_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,10 +27,17 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._maintenance_configurations_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_managed_cluster_request -T = TypeVar('T') +from ...operations._maintenance_configurations_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_managed_cluster_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class MaintenanceConfigurationsOperations: """ .. warning:: @@ -43,48 +57,43 @@ def __init__(self, *args, **kwargs) -> None: 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_managed_cluster( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.MaintenanceConfigurationListResult]: + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> AsyncIterable["_models.MaintenanceConfiguration"]: """Gets a list of maintenance configurations in the specified managed cluster. Gets a list of maintenance configurations in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either MaintenanceConfigurationListResult or the result - of cls(response) + :return: An iterator like instance of either MaintenanceConfiguration or the result of + cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_05_01.models.MaintenanceConfigurationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_05_01.models.MaintenanceConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfigurationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfigurationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_managed_cluster_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_managed_cluster.metadata['url'], + template_url=self.list_by_managed_cluster.metadata["url"], headers=_headers, params=_params, ) @@ -92,16 +101,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_managed_cluster_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -117,10 +121,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -130,54 +132,45 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_managed_cluster.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations"} # type: ignore + list_by_managed_cluster.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations"} # type: ignore @distributed_trace_async async def get( - self, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, config_name: str, **kwargs: Any ) -> _models.MaintenanceConfiguration: """Gets the specified maintenance configuration of a managed cluster. Gets the specified maintenance configuration of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: MaintenanceConfiguration, or the result of cls(response) + :return: MaintenanceConfiguration or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_05_01.models.MaintenanceConfiguration - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfiguration] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -185,75 +178,147 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) + deserialized = self._deserialize("MaintenanceConfiguration", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - @distributed_trace_async + @overload async def create_or_update( self, resource_group_name: str, resource_name: str, config_name: str, parameters: _models.MaintenanceConfiguration, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.MaintenanceConfiguration: """Creates or updates a maintenance configuration in the specified managed cluster. Creates or updates a maintenance configuration in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str - :param parameters: The maintenance configuration to create or update. + :param parameters: The maintenance configuration to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2021_05_01.models.MaintenanceConfiguration + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: MaintenanceConfiguration, or the result of cls(response) + :return: MaintenanceConfiguration or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_05_01.models.MaintenanceConfiguration - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configuration in the specified managed cluster. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: The maintenance configuration to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_05_01.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: Union[_models.MaintenanceConfiguration, IO], + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configuration in the specified managed cluster. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: The maintenance configuration to create or update. Is either a model type or + a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_05_01.models.MaintenanceConfiguration or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_05_01.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfiguration] - _json = self._serialize.body(parameters, 'MaintenanceConfiguration') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "MaintenanceConfiguration") request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) @@ -261,68 +326,59 @@ async def create_or_update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) + deserialized = self._deserialize("MaintenanceConfiguration", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, config_name: str, **kwargs: Any ) -> None: """Deletes a maintenance configuration. Deletes a maintenance configuration. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) @@ -330,10 +386,9 @@ async def delete( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -343,5 +398,4 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/aio/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/aio/operations/_managed_clusters_operations.py index 6288ec697fba..83d2d692a08c 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/aio/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/aio/operations/_managed_clusters_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +29,33 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._managed_clusters_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_access_profile_request, build_get_command_result_request, build_get_os_options_request, build_get_request, build_get_upgrade_profile_request, build_list_by_resource_group_request, build_list_cluster_admin_credentials_request, build_list_cluster_monitoring_user_credentials_request, build_list_cluster_user_credentials_request, build_list_outbound_network_dependencies_endpoints_request, build_list_request, build_reset_aad_profile_request_initial, build_reset_service_principal_profile_request_initial, build_rotate_cluster_certificates_request_initial, build_run_command_request_initial, build_start_request_initial, build_stop_request_initial, build_update_tags_request_initial -T = TypeVar('T') +from ...operations._managed_clusters_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_access_profile_request, + build_get_command_result_request, + build_get_os_options_request, + build_get_request, + build_get_upgrade_profile_request, + build_list_by_resource_group_request, + build_list_cluster_admin_credentials_request, + build_list_cluster_monitoring_user_credentials_request, + build_list_cluster_user_credentials_request, + build_list_outbound_network_dependencies_endpoints_request, + build_list_request, + build_reset_aad_profile_request, + build_reset_service_principal_profile_request, + build_rotate_cluster_certificates_request, + build_run_command_request, + build_start_request, + build_stop_request, + build_update_tags_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class ManagedClustersOperations: # pylint: disable=too-many-public-methods """ .. warning:: @@ -45,46 +75,39 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async async def get_os_options( - self, - location: str, - resource_type: Optional[str] = None, - **kwargs: Any + self, location: str, resource_type: Optional[str] = None, **kwargs: Any ) -> _models.OSOptionProfile: """Gets supported OS options in the specified subscription. Gets supported OS options in the specified subscription. - :param location: The name of a supported Azure region. + :param location: The name of a supported Azure region. Required. :type location: str :param resource_type: The resource type for which the OS options needs to be returned. Default value is None. :type resource_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: OSOptionProfile, or the result of cls(response) + :return: OSOptionProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_05_01.models.OSOptionProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OSOptionProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OSOptionProfile] - request = build_get_os_options_request( - subscription_id=self._config.subscription_id, location=location, - api_version=api_version, + subscription_id=self._config.subscription_id, resource_type=resource_type, - template_url=self.get_os_options.metadata['url'], + api_version=api_version, + template_url=self.get_os_options.metadata["url"], headers=_headers, params=_params, ) @@ -92,59 +115,52 @@ async def get_os_options( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('OSOptionProfile', pipeline_response) + deserialized = self._deserialize("OSOptionProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_os_options.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default"} # type: ignore - + get_os_options.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default"} # type: ignore @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.ManagedClusterListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.ManagedCluster"]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_05_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_05_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -152,14 +168,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -175,10 +188,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -188,49 +199,43 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.ManagedClusterListResult]: + self, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ManagedCluster"]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_05_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_05_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -238,15 +243,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -262,10 +263,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -275,50 +274,42 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace_async async def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.ManagedClusterUpgradeProfile: """Gets the upgrade profile of a managed cluster. Gets the upgrade profile of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterUpgradeProfile, or the result of cls(response) + :return: ManagedClusterUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_05_01.models.ManagedClusterUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -326,33 +317,27 @@ async def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterUpgradeProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore @distributed_trace_async async def get_access_profile( - self, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, role_name: str, **kwargs: Any ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. @@ -361,36 +346,33 @@ async def get_access_profile( `ListClusterAdminCredentials `_ . - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param role_name: The name of the role for managed cluster accessProfile resource. + :param role_name: The name of the role for managed cluster accessProfile resource. Required. :type role_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterAccessProfile, or the result of cls(response) + :return: ManagedClusterAccessProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_05_01.models.ManagedClusterAccessProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterAccessProfile] - request = build_get_access_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, role_name=role_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_access_profile.metadata['url'], + template_url=self.get_access_profile.metadata["url"], headers=_headers, params=_params, ) @@ -398,68 +380,59 @@ async def get_access_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterAccessProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterAccessProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_access_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore - + get_access_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore @distributed_trace_async async def list_cluster_admin_credentials( - self, - resource_group_name: str, - resource_name: str, - server_fqdn: Optional[str] = None, - **kwargs: Any + self, resource_group_name: str, resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any ) -> _models.CredentialResults: """Lists the admin credentials of a managed cluster. Lists the admin credentials of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_05_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_admin_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, - template_url=self.list_cluster_admin_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_admin_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -467,68 +440,59 @@ async def list_cluster_admin_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_admin_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore - + list_cluster_admin_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore @distributed_trace_async async def list_cluster_user_credentials( - self, - resource_group_name: str, - resource_name: str, - server_fqdn: Optional[str] = None, - **kwargs: Any + self, resource_group_name: str, resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any ) -> _models.CredentialResults: """Lists the user credentials of a managed cluster. Lists the user credentials of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_05_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, - template_url=self.list_cluster_user_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -536,68 +500,59 @@ async def list_cluster_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore - + list_cluster_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore @distributed_trace_async async def list_cluster_monitoring_user_credentials( - self, - resource_group_name: str, - resource_name: str, - server_fqdn: Optional[str] = None, - **kwargs: Any + self, resource_group_name: str, resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any ) -> _models.CredentialResults: """Lists the cluster monitoring user credentials of a managed cluster. Lists the cluster monitoring user credentials of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_05_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_monitoring_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, - template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_monitoring_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -605,64 +560,54 @@ async def list_cluster_monitoring_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_monitoring_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore - + list_cluster_monitoring_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore @distributed_trace_async - async def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.ManagedCluster: + async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.ManagedCluster: """Gets a managed cluster. Gets a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedCluster, or the result of cls(response) + :return: ManagedCluster or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_05_01.models.ManagedCluster - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -670,55 +615,54 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _create_or_update_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.ManagedCluster, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'ManagedCluster') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedCluster") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -726,10 +670,9 @@ async def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -737,37 +680,41 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - - @distributed_trace_async + @overload async def begin_create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedCluster, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. Creates or updates a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The managed cluster to create or update. + :param parameters: The managed cluster to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2021_05_01.models.ManagedCluster + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -780,20 +727,88 @@ async def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_05_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_05_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster to create or update. Is either a model type or a IO + type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_05_01.models.ManagedCluster or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_05_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -801,69 +816,66 @@ async def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _update_tags_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.TagsObject, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request_initial( - subscription_id=self._config.subscription_id, + request = build_update_tags_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_tags_initial.metadata['url'], + content=_content, + template_url=self._update_tags_initial.metadata["url"], headers=_headers, params=_params, ) @@ -871,44 +883,47 @@ async def _update_tags_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_tags_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + _update_tags_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - - @distributed_trace_async + @overload async def begin_update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates tags on a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2021_05_01.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -921,20 +936,88 @@ async def begin_update_tags( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_05_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates tags on a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_05_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates tags on a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_05_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_05_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, @@ -942,64 +1025,54 @@ async def begin_update_tags( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1007,10 +1080,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1020,23 +1092,17 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: + async def begin_delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Deletes a managed cluster. Deletes a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1048,85 +1114,83 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterServicePrincipalProfile, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterServicePrincipalProfile") - request = build_reset_service_principal_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_service_principal_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_service_principal_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_service_principal_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1134,10 +1198,9 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1147,28 +1210,104 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist if cls: return cls(pipeline_response, None, {}) - _reset_service_principal_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + _reset_service_principal_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore - - @distributed_trace_async - async def begin_reset_service_principal_profile( # pylint: disable=inconsistent-return-statements + @overload + async def begin_reset_service_principal_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterServicePrincipalProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: """Reset the Service Principal Profile of a managed cluster. This action cannot be performed on a cluster that is not using a service principal. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The service principal profile to set on the managed cluster. + :param parameters: The service principal profile to set on the managed cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2021_05_01.models.ManagedClusterServicePrincipalProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset the Service Principal Profile of a managed cluster. + + This action cannot be performed on a cluster that is not using a service principal. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The service principal profile to set on the managed cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset the Service Principal Profile of a managed cluster. + + This action cannot be performed on a cluster that is not using a service principal. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The service principal profile to set on the managed cluster. Is either a + model type or a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2021_05_01.models.ManagedClusterServicePrincipalProfile or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -1179,20 +1318,17 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1200,67 +1336,68 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_service_principal_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + begin_reset_service_principal_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterAADProfile, + parameters: Union[_models.ManagedClusterAADProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterAADProfile") - request = build_reset_aad_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_aad_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_aad_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_aad_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1268,10 +1405,9 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1281,27 +1417,103 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta if cls: return cls(pipeline_response, None, {}) - _reset_aad_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + _reset_aad_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - - @distributed_trace_async - async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements + @overload + async def begin_reset_aad_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterAADProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: """Reset the AAD Profile of a managed cluster. Reset the AAD Profile of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The AAD profile to set on the Managed Cluster. + :param parameters: The AAD profile to set on the Managed Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2021_05_01.models.ManagedClusterAADProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset the AAD Profile of a managed cluster. + + Reset the AAD Profile of a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The AAD profile to set on the Managed Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterAADProfile, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset the AAD Profile of a managed cluster. + + Reset the AAD Profile of a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The AAD profile to set on the Managed Cluster. Is either a model type or a + IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_05_01.models.ManagedClusterAADProfile or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -1312,20 +1524,17 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1333,62 +1542,52 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_aad_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + begin_reset_aad_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_rotate_cluster_certificates_request_initial( - subscription_id=self._config.subscription_id, + request = build_rotate_cluster_certificates_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._rotate_cluster_certificates_initial.metadata['url'], + template_url=self._rotate_cluster_certificates_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1396,10 +1595,9 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1409,24 +1607,20 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- if cls: return cls(pipeline_response, None, {}) - _rotate_cluster_certificates_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore - + _rotate_cluster_certificates_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore @distributed_trace_async - async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + async def begin_rotate_cluster_certificates( + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Rotates the certificates of a managed cluster. See `Certificate rotation `_ for more details about rotating managed cluster certificates. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1438,80 +1632,67 @@ async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-ret Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._rotate_cluster_certificates_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_rotate_cluster_certificates.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore + begin_rotate_cluster_certificates.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore async def _stop_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_stop_request_initial( - subscription_id=self._config.subscription_id, + request = build_stop_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._stop_initial.metadata['url'], + template_url=self._stop_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1519,10 +1700,9 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1532,16 +1712,10 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore - + _stop_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore @distributed_trace_async - async def begin_stop( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: + async def begin_stop(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Stops a Managed Cluster. This can only be performed on Azure Virtual Machine Scale set backed clusters. Stopping a @@ -1550,9 +1724,9 @@ async def begin_stop( # pylint: disable=inconsistent-return-statements `_ for more details about stopping a cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1564,80 +1738,67 @@ async def begin_stop( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._stop_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore + begin_stop.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore async def _start_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_start_request_initial( - subscription_id=self._config.subscription_id, + request = build_start_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._start_initial.metadata['url'], + template_url=self._start_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1645,10 +1806,9 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1658,24 +1818,18 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore - + _start_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore @distributed_trace_async - async def begin_start( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: + async def begin_start(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Starts a previously stopped Managed Cluster. See `starting a cluster `_ for more details about starting a cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1687,85 +1841,83 @@ async def begin_start( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._start_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore + begin_start.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore async def _run_command_initial( self, resource_group_name: str, resource_name: str, - request_payload: _models.RunCommandRequest, + request_payload: Union[_models.RunCommandRequest, IO], **kwargs: Any ) -> Optional[_models.RunCommandResult]: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RunCommandResult]] - _json = self._serialize.body(request_payload, 'RunCommandRequest') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(request_payload, (IO, bytes)): + _content = request_payload + else: + _json = self._serialize.body(request_payload, "RunCommandRequest") - request = build_run_command_request_initial( - subscription_id=self._config.subscription_id, + request = build_run_command_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._run_command_initial.metadata['url'], + content=_content, + template_url=self._run_command_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1773,10 +1925,9 @@ async def _run_command_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1785,22 +1936,23 @@ async def _run_command_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _run_command_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore - + _run_command_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore - @distributed_trace_async + @overload async def begin_run_command( self, resource_group_name: str, resource_name: str, request_payload: _models.RunCommandRequest, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.RunCommandResult]: """Submits a command to run against the Managed Cluster. @@ -1809,12 +1961,15 @@ async def begin_run_command( more information see `AKS Run Command `_. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param request_payload: The run command request. + :param request_payload: The run command request. Required. :type request_payload: ~azure.mgmt.containerservice.v2021_05_01.models.RunCommandRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -1827,20 +1982,95 @@ async def begin_run_command( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_05_01.models.RunCommandResult] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_run_command( + self, + resource_group_name: str, + resource_name: str, + request_payload: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.RunCommandResult]: + """Submits a command to run against the Managed Cluster. + + AKS will create a pod to run the command. This is primarily useful for private clusters. For + more information see `AKS Run Command + `_. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param request_payload: The run command request. Required. + :type request_payload: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RunCommandResult or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_05_01.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_run_command( + self, + resource_group_name: str, + resource_name: str, + request_payload: Union[_models.RunCommandRequest, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.RunCommandResult]: + """Submits a command to run against the Managed Cluster. + + AKS will create a pod to run the command. This is primarily useful for private clusters. For + more information see `AKS Run Command + `_. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param request_payload: The run command request. Is either a model type or a IO type. Required. + :type request_payload: ~azure.mgmt.containerservice.v2021_05_01.models.RunCommandRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RunCommandResult or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_05_01.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.RunCommandResult] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.RunCommandResult] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._run_command_initial( # type: ignore resource_group_name=resource_group_name, @@ -1848,82 +2078,71 @@ async def begin_run_command( request_payload=request_payload, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_run_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore + begin_run_command.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore @distributed_trace_async async def get_command_result( - self, - resource_group_name: str, - resource_name: str, - command_id: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, command_id: str, **kwargs: Any ) -> Optional[_models.RunCommandResult]: """Gets the results of a command which has been run on the Managed Cluster. Gets the results of a command which has been run on the Managed Cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param command_id: Id of the command. + :param command_id: Id of the command. Required. :type command_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: RunCommandResult, or the result of cls(response) + :return: RunCommandResult or None or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_05_01.models.RunCommandResult or None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RunCommandResult]] - request = build_get_command_result_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, command_id=command_id, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_command_result.metadata['url'], + template_url=self.get_command_result.metadata["url"], headers=_headers, params=_params, ) @@ -1931,10 +2150,9 @@ async def get_command_result( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1943,59 +2161,54 @@ async def get_command_result( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_command_result.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}"} # type: ignore - + get_command_result.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}"} # type: ignore @distributed_trace def list_outbound_network_dependencies_endpoints( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.OutboundEnvironmentEndpointCollection]: + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> AsyncIterable["_models.OutboundEnvironmentEndpoint"]: """Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster. Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster. The operation returns properties of each egress endpoint. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OutboundEnvironmentEndpointCollection or the - result of cls(response) + :return: An iterator like instance of either OutboundEnvironmentEndpoint or the result of + cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_05_01.models.OutboundEnvironmentEndpointCollection] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_05_01.models.OutboundEnvironmentEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_outbound_network_dependencies_endpoints_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_outbound_network_dependencies_endpoints.metadata['url'], + template_url=self.list_outbound_network_dependencies_endpoints.metadata["url"], headers=_headers, params=_params, ) @@ -2003,16 +2216,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_outbound_network_dependencies_endpoints_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -2028,10 +2236,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2041,8 +2247,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_outbound_network_dependencies_endpoints.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints"} # type: ignore + list_outbound_network_dependencies_endpoints.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/aio/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/aio/operations/_operations.py index 328b4bb77ed0..e4a1c612d52e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/aio/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/aio/operations/_operations.py @@ -7,9 +7,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,9 +27,11 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._operations import build_list_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class Operations: """ .. warning:: @@ -42,38 +51,33 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.OperationListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.OperationValue"]: """Gets a list of operations. Gets a list of operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationListResult or the result of cls(response) + :return: An iterator like instance of either OperationValue or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_05_01.models.OperationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_05_01.models.OperationValue] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -81,13 +85,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -103,10 +105,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -116,8 +116,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.ContainerService/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ContainerService/operations"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/aio/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/aio/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/aio/operations/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/aio/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/aio/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/aio/operations/_private_endpoint_connections_operations.py index 962a12681d66..c5f2b4570c4c 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/aio/operations/_private_endpoint_connections_operations.py @@ -6,9 +6,15 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -20,10 +26,17 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._private_endpoint_connections_operations import build_delete_request_initial, build_get_request, build_list_request, build_update_request -T = TypeVar('T') +from ...operations._private_endpoint_connections_operations import ( + build_delete_request, + build_get_request, + build_list_request, + build_update_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class PrivateEndpointConnectionsOperations: """ .. warning:: @@ -43,46 +56,39 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async async def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnectionListResult: """Gets a list of private endpoint connections in the specified managed cluster. To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnectionListResult, or the result of cls(response) + :return: PrivateEndpointConnectionListResult or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_05_01.models.PrivateEndpointConnectionListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnectionListResult] - request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -90,69 +96,60 @@ async def list( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore - + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore @distributed_trace_async async def get( - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnection: """Gets the specified private endpoint connection. To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_05_01.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -160,75 +157,147 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - @distributed_trace_async + @overload async def update( self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, parameters: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateEndpointConnection: """Updates a private endpoint connection. Updates a private endpoint connection. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str - :param parameters: The updated private endpoint connection. + :param parameters: The updated private endpoint connection. Required. :type parameters: ~azure.mgmt.containerservice.v2021_05_01.models.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_05_01.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: The updated private endpoint connection. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_05_01.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: Union[_models.PrivateEndpointConnection, IO], + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: The updated private endpoint connection. Is either a model type or a IO + type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_05_01.models.PrivateEndpointConnection or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_05_01.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - _json = self._serialize.body(parameters, 'PrivateEndpointConnection') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateEndpointConnection") request = build_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update.metadata['url'], + content=_content, + template_url=self.update.metadata["url"], headers=_headers, params=_params, ) @@ -236,52 +305,43 @@ async def update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -289,10 +349,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -302,26 +361,21 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + async def begin_delete( + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes a private endpoint connection. Deletes a private endpoint connection. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -333,53 +387,46 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/aio/operations/_private_link_resources_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/aio/operations/_private_link_resources_operations.py index 9049d235536e..b41ec0171a9d 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/aio/operations/_private_link_resources_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/aio/operations/_private_link_resources_operations.py @@ -8,7 +8,13 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -19,9 +25,11 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._private_link_resources_operations import build_list_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class PrivateLinkResourcesOperations: """ .. warning:: @@ -41,46 +49,39 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async async def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.PrivateLinkResourcesListResult: """Gets a list of private link resources in the specified managed cluster. To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResourcesListResult, or the result of cls(response) + :return: PrivateLinkResourcesListResult or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_05_01.models.PrivateLinkResourcesListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResourcesListResult] - request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -88,22 +89,20 @@ async def list( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResourcesListResult', pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources"} # type: ignore - + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/aio/operations/_resolve_private_link_service_id_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/aio/operations/_resolve_private_link_service_id_operations.py index fc8f5bf50aeb..b6115d08758a 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/aio/operations/_resolve_private_link_service_id_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/aio/operations/_resolve_private_link_service_id_operations.py @@ -6,9 +6,15 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -19,9 +25,11 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._resolve_private_link_service_id_operations import build_post_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class ResolvePrivateLinkServiceIdOperations: """ .. warning:: @@ -41,52 +49,118 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async + @overload async def post( self, resource_group_name: str, resource_name: str, parameters: _models.PrivateLinkResource, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateLinkResource: """Gets the private link service ID for the specified managed cluster. Gets the private link service ID for the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters required in order to resolve a private link service ID. + :param parameters: Parameters required in order to resolve a private link service ID. Required. :type parameters: ~azure.mgmt.containerservice.v2021_05_01.models.PrivateLinkResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_05_01.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def post( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID for the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters required in order to resolve a private link service ID. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResource, or the result of cls(response) + :return: PrivateLinkResource or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_05_01.models.PrivateLinkResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @distributed_trace_async + async def post( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.PrivateLinkResource, IO], + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID for the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters required in order to resolve a private link service ID. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_05_01.models.PrivateLinkResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_05_01.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResource] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResource] - _json = self._serialize.body(parameters, 'PrivateLinkResource') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateLinkResource") request = build_post_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.post.metadata['url'], + content=_content, + template_url=self.post.metadata["url"], headers=_headers, params=_params, ) @@ -94,22 +168,20 @@ async def post( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResource', pipeline_response) + deserialized = self._deserialize("PrivateLinkResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - post.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId"} # type: ignore - + post.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/models/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/models/__init__.py index 406c73f5c5c8..68d71e952005 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/models/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/models/__init__.py @@ -15,7 +15,9 @@ from ._models_py3 import AgentPoolUpgradeSettings from ._models_py3 import CloudErrorBody from ._models_py3 import Components1Q1Og48SchemasManagedclusterAllof1 -from ._models_py3 import Components1Umhcm8SchemasManagedclusteridentityPropertiesUserassignedidentitiesAdditionalproperties +from ._models_py3 import ( + Components1Umhcm8SchemasManagedclusteridentityPropertiesUserassignedidentitiesAdditionalproperties, +) from ._models_py3 import ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties from ._models_py3 import ContainerServiceDiagnosticsProfile from ._models_py3 import ContainerServiceLinuxProfile @@ -87,153 +89,151 @@ from ._models_py3 import TimeSpan from ._models_py3 import UserAssignedIdentity - -from ._container_service_client_enums import ( - AgentPoolMode, - AgentPoolType, - Code, - ConnectionStatus, - ContainerServiceStorageProfileTypes, - ContainerServiceVMSizeTypes, - Count, - CreatedByType, - Expander, - ExtendedLocationTypes, - GPUInstanceProfile, - KubeletDiskType, - LicenseType, - LoadBalancerSku, - ManagedClusterPodIdentityProvisioningState, - ManagedClusterSKUName, - ManagedClusterSKUTier, - NetworkMode, - NetworkPlugin, - NetworkPolicy, - OSDiskType, - OSSKU, - OSType, - OutboundType, - PrivateEndpointConnectionProvisioningState, - ResourceIdentityType, - ScaleSetEvictionPolicy, - ScaleSetPriority, - UpgradeChannel, - WeekDay, -) +from ._container_service_client_enums import AgentPoolMode +from ._container_service_client_enums import AgentPoolType +from ._container_service_client_enums import Code +from ._container_service_client_enums import ConnectionStatus +from ._container_service_client_enums import ContainerServiceStorageProfileTypes +from ._container_service_client_enums import ContainerServiceVMSizeTypes +from ._container_service_client_enums import Count +from ._container_service_client_enums import CreatedByType +from ._container_service_client_enums import Expander +from ._container_service_client_enums import ExtendedLocationTypes +from ._container_service_client_enums import GPUInstanceProfile +from ._container_service_client_enums import KubeletDiskType +from ._container_service_client_enums import LicenseType +from ._container_service_client_enums import LoadBalancerSku +from ._container_service_client_enums import ManagedClusterPodIdentityProvisioningState +from ._container_service_client_enums import ManagedClusterSKUName +from ._container_service_client_enums import ManagedClusterSKUTier +from ._container_service_client_enums import NetworkMode +from ._container_service_client_enums import NetworkPlugin +from ._container_service_client_enums import NetworkPolicy +from ._container_service_client_enums import OSDiskType +from ._container_service_client_enums import OSSKU +from ._container_service_client_enums import OSType +from ._container_service_client_enums import OutboundType +from ._container_service_client_enums import PrivateEndpointConnectionProvisioningState +from ._container_service_client_enums import ResourceIdentityType +from ._container_service_client_enums import ScaleSetEvictionPolicy +from ._container_service_client_enums import ScaleSetPriority +from ._container_service_client_enums import UpgradeChannel +from ._container_service_client_enums import WeekDay from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'AgentPool', - 'AgentPoolAvailableVersions', - 'AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem', - 'AgentPoolListResult', - 'AgentPoolUpgradeProfile', - 'AgentPoolUpgradeProfilePropertiesUpgradesItem', - 'AgentPoolUpgradeSettings', - 'CloudErrorBody', - 'Components1Q1Og48SchemasManagedclusterAllof1', - 'Components1Umhcm8SchemasManagedclusteridentityPropertiesUserassignedidentitiesAdditionalproperties', - 'ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties', - 'ContainerServiceDiagnosticsProfile', - 'ContainerServiceLinuxProfile', - 'ContainerServiceMasterProfile', - 'ContainerServiceNetworkProfile', - 'ContainerServiceSshConfiguration', - 'ContainerServiceSshPublicKey', - 'ContainerServiceVMDiagnostics', - 'CredentialResult', - 'CredentialResults', - 'EndpointDependency', - 'EndpointDetail', - 'ExtendedLocation', - 'KubeletConfig', - 'LinuxOSConfig', - 'MaintenanceConfiguration', - 'MaintenanceConfigurationListResult', - 'ManagedCluster', - 'ManagedClusterAADProfile', - 'ManagedClusterAPIServerAccessProfile', - 'ManagedClusterAccessProfile', - 'ManagedClusterAddonProfile', - 'ManagedClusterAddonProfileIdentity', - 'ManagedClusterAgentPoolProfile', - 'ManagedClusterAgentPoolProfileProperties', - 'ManagedClusterAutoUpgradeProfile', - 'ManagedClusterHTTPProxyConfig', - 'ManagedClusterIdentity', - 'ManagedClusterListResult', - 'ManagedClusterLoadBalancerProfile', - 'ManagedClusterLoadBalancerProfileManagedOutboundIPs', - 'ManagedClusterLoadBalancerProfileOutboundIPPrefixes', - 'ManagedClusterLoadBalancerProfileOutboundIPs', - 'ManagedClusterPodIdentity', - 'ManagedClusterPodIdentityException', - 'ManagedClusterPodIdentityProfile', - 'ManagedClusterPodIdentityProvisioningError', - 'ManagedClusterPodIdentityProvisioningErrorBody', - 'ManagedClusterPodIdentityProvisioningInfo', - 'ManagedClusterPoolUpgradeProfile', - 'ManagedClusterPoolUpgradeProfileUpgradesItem', - 'ManagedClusterPropertiesAutoScalerProfile', - 'ManagedClusterSKU', - 'ManagedClusterServicePrincipalProfile', - 'ManagedClusterUpgradeProfile', - 'ManagedClusterWindowsProfile', - 'OSOptionProfile', - 'OSOptionProperty', - 'OperationListResult', - 'OperationValue', - 'OutboundEnvironmentEndpoint', - 'OutboundEnvironmentEndpointCollection', - 'PowerState', - 'PrivateEndpoint', - 'PrivateEndpointConnection', - 'PrivateEndpointConnectionListResult', - 'PrivateLinkResource', - 'PrivateLinkResourcesListResult', - 'PrivateLinkServiceConnectionState', - 'Resource', - 'ResourceReference', - 'RunCommandRequest', - 'RunCommandResult', - 'SubResource', - 'SysctlConfig', - 'SystemData', - 'TagsObject', - 'TimeInWeek', - 'TimeSpan', - 'UserAssignedIdentity', - 'AgentPoolMode', - 'AgentPoolType', - 'Code', - 'ConnectionStatus', - 'ContainerServiceStorageProfileTypes', - 'ContainerServiceVMSizeTypes', - 'Count', - 'CreatedByType', - 'Expander', - 'ExtendedLocationTypes', - 'GPUInstanceProfile', - 'KubeletDiskType', - 'LicenseType', - 'LoadBalancerSku', - 'ManagedClusterPodIdentityProvisioningState', - 'ManagedClusterSKUName', - 'ManagedClusterSKUTier', - 'NetworkMode', - 'NetworkPlugin', - 'NetworkPolicy', - 'OSDiskType', - 'OSSKU', - 'OSType', - 'OutboundType', - 'PrivateEndpointConnectionProvisioningState', - 'ResourceIdentityType', - 'ScaleSetEvictionPolicy', - 'ScaleSetPriority', - 'UpgradeChannel', - 'WeekDay', + "AgentPool", + "AgentPoolAvailableVersions", + "AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem", + "AgentPoolListResult", + "AgentPoolUpgradeProfile", + "AgentPoolUpgradeProfilePropertiesUpgradesItem", + "AgentPoolUpgradeSettings", + "CloudErrorBody", + "Components1Q1Og48SchemasManagedclusterAllof1", + "Components1Umhcm8SchemasManagedclusteridentityPropertiesUserassignedidentitiesAdditionalproperties", + "ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties", + "ContainerServiceDiagnosticsProfile", + "ContainerServiceLinuxProfile", + "ContainerServiceMasterProfile", + "ContainerServiceNetworkProfile", + "ContainerServiceSshConfiguration", + "ContainerServiceSshPublicKey", + "ContainerServiceVMDiagnostics", + "CredentialResult", + "CredentialResults", + "EndpointDependency", + "EndpointDetail", + "ExtendedLocation", + "KubeletConfig", + "LinuxOSConfig", + "MaintenanceConfiguration", + "MaintenanceConfigurationListResult", + "ManagedCluster", + "ManagedClusterAADProfile", + "ManagedClusterAPIServerAccessProfile", + "ManagedClusterAccessProfile", + "ManagedClusterAddonProfile", + "ManagedClusterAddonProfileIdentity", + "ManagedClusterAgentPoolProfile", + "ManagedClusterAgentPoolProfileProperties", + "ManagedClusterAutoUpgradeProfile", + "ManagedClusterHTTPProxyConfig", + "ManagedClusterIdentity", + "ManagedClusterListResult", + "ManagedClusterLoadBalancerProfile", + "ManagedClusterLoadBalancerProfileManagedOutboundIPs", + "ManagedClusterLoadBalancerProfileOutboundIPPrefixes", + "ManagedClusterLoadBalancerProfileOutboundIPs", + "ManagedClusterPodIdentity", + "ManagedClusterPodIdentityException", + "ManagedClusterPodIdentityProfile", + "ManagedClusterPodIdentityProvisioningError", + "ManagedClusterPodIdentityProvisioningErrorBody", + "ManagedClusterPodIdentityProvisioningInfo", + "ManagedClusterPoolUpgradeProfile", + "ManagedClusterPoolUpgradeProfileUpgradesItem", + "ManagedClusterPropertiesAutoScalerProfile", + "ManagedClusterSKU", + "ManagedClusterServicePrincipalProfile", + "ManagedClusterUpgradeProfile", + "ManagedClusterWindowsProfile", + "OSOptionProfile", + "OSOptionProperty", + "OperationListResult", + "OperationValue", + "OutboundEnvironmentEndpoint", + "OutboundEnvironmentEndpointCollection", + "PowerState", + "PrivateEndpoint", + "PrivateEndpointConnection", + "PrivateEndpointConnectionListResult", + "PrivateLinkResource", + "PrivateLinkResourcesListResult", + "PrivateLinkServiceConnectionState", + "Resource", + "ResourceReference", + "RunCommandRequest", + "RunCommandResult", + "SubResource", + "SysctlConfig", + "SystemData", + "TagsObject", + "TimeInWeek", + "TimeSpan", + "UserAssignedIdentity", + "AgentPoolMode", + "AgentPoolType", + "Code", + "ConnectionStatus", + "ContainerServiceStorageProfileTypes", + "ContainerServiceVMSizeTypes", + "Count", + "CreatedByType", + "Expander", + "ExtendedLocationTypes", + "GPUInstanceProfile", + "KubeletDiskType", + "LicenseType", + "LoadBalancerSku", + "ManagedClusterPodIdentityProvisioningState", + "ManagedClusterSKUName", + "ManagedClusterSKUTier", + "NetworkMode", + "NetworkPlugin", + "NetworkPolicy", + "OSDiskType", + "OSSKU", + "OSType", + "OutboundType", + "PrivateEndpointConnectionProvisioningState", + "ResourceIdentityType", + "ScaleSetEvictionPolicy", + "ScaleSetPriority", + "UpgradeChannel", + "WeekDay", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/models/_container_service_client_enums.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/models/_container_service_client_enums.py index 57806c223c4b..5c76ee430fdb 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/models/_container_service_client_enums.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/models/_container_service_client_enums.py @@ -13,7 +13,7 @@ class AgentPoolMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools + https://docs.microsoft.com/azure/aks/use-system-pools. """ #: System agent pools are primarily for hosting critical system pods such as CoreDNS and @@ -23,33 +23,34 @@ class AgentPoolMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: User agent pools are primarily for hosting your application pods. USER = "User" + class AgentPoolType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of Agent Pool. - """ + """The type of Agent Pool.""" #: Create an Agent Pool backed by a Virtual Machine Scale Set. VIRTUAL_MACHINE_SCALE_SETS = "VirtualMachineScaleSets" #: Use of this is strongly discouraged. AVAILABILITY_SET = "AvailabilitySet" + class Code(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Tells whether the cluster is Running or Stopped - """ + """Tells whether the cluster is Running or Stopped.""" #: The cluster is running. RUNNING = "Running" #: The cluster is stopped. STOPPED = "Stopped" + class ConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The private link service connection status. - """ + """The private link service connection status.""" PENDING = "Pending" APPROVED = "Approved" REJECTED = "Rejected" DISCONNECTED = "Disconnected" + class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Specifies what kind of storage to use. If omitted, the default will be chosen on your behalf based on the choice of orchestrator. @@ -58,9 +59,9 @@ class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEn STORAGE_ACCOUNT = "StorageAccount" MANAGED_DISKS = "ManagedDisks" + class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Size of agent VMs. Note: This is no longer maintained. - """ + """Size of agent VMs. Note: This is no longer maintained.""" STANDARD_A1 = "Standard_A1" STANDARD_A10 = "Standard_A10" @@ -237,6 +238,7 @@ class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): STANDARD_NV24 = "Standard_NV24" STANDARD_NV6 = "Standard_NV6" + class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): """Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, and 5. The default value is 1. @@ -246,15 +248,16 @@ class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): THREE = 3 FIVE = 5 + class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of identity that created the resource. - """ + """The type of identity that created the resource.""" USER = "User" APPLICATION = "Application" MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" + class Expander(str, Enum, metaclass=CaseInsensitiveEnumMeta): """If not specified, the default is 'random'. See `expanders `_ @@ -278,15 +281,15 @@ class Expander(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Used when you don't have a particular need for the node groups to scale differently. RANDOM = "random" + class ExtendedLocationTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of extendedLocation. - """ + """The type of extendedLocation.""" EDGE_ZONE = "EdgeZone" + class GPUInstanceProfile(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """GPUInstanceProfile to be used to specify GPU MIG instance profile for supported GPU VM SKU. - """ + """GPUInstanceProfile to be used to specify GPU MIG instance profile for supported GPU VM SKU.""" MIG1_G = "MIG1g" MIG2_G = "MIG2g" @@ -294,6 +297,7 @@ class GPUInstanceProfile(str, Enum, metaclass=CaseInsensitiveEnumMeta): MIG4_G = "MIG4g" MIG7_G = "MIG7g" + class KubeletDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. @@ -304,6 +308,7 @@ class KubeletDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Kubelet will use the temporary disk for its data. TEMPORARY = "Temporary" + class LicenseType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The license type to use for Windows VMs. See `Azure Hybrid User Benefits `_ for more details. @@ -314,6 +319,7 @@ class LicenseType(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Enables Azure Hybrid User Benefits for Windows VMs. WINDOWS_SERVER = "Windows_Server" + class LoadBalancerSku(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The default is 'standard'. See `Azure Load Balancer SKUs `_ for more information about the @@ -327,21 +333,22 @@ class LoadBalancerSku(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Use a basic Load Balancer with limited functionality. BASIC = "basic" + class ManagedClusterPodIdentityProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The current provisioning state of the pod identity. - """ + """The current provisioning state of the pod identity.""" ASSIGNED = "Assigned" UPDATING = "Updating" DELETING = "Deleting" FAILED = "Failed" + class ManagedClusterSKUName(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The name of a managed cluster SKU. - """ + """The name of a managed cluster SKU.""" BASIC = "Basic" + class ManagedClusterSKUTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): """If not specified, the default is 'Free'. See `uptime SLA `_ for more details. @@ -353,20 +360,20 @@ class ManagedClusterSKUTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: No guaranteed SLA, no additional charges. Free tier clusters have an SLO of 99.5%. FREE = "Free" + class NetworkMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """This cannot be specified if networkPlugin is anything other than 'azure'. - """ + """This cannot be specified if networkPlugin is anything other than 'azure'.""" #: No bridge is created. Intra-VM Pod to Pod communication is through IP routes created by Azure #: CNI. See `Transparent Mode `_ for #: more information. TRANSPARENT = "transparent" - #: This is no longer supported. + #: This is no longer supported BRIDGE = "bridge" + class NetworkPlugin(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Network plugin used for building the Kubernetes network. - """ + """Network plugin used for building the Kubernetes network.""" #: Use the Azure CNI network plugin. See `Azure CNI (advanced) networking #: `_ for @@ -377,9 +384,9 @@ class NetworkPlugin(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: information. KUBENET = "kubenet" + class NetworkPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Network policy used for building the Kubernetes network. - """ + """Network policy used for building the Kubernetes network.""" #: Use Calico network policies. See `differences between Azure and Calico policies #: `_ @@ -390,6 +397,7 @@ class NetworkPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: for more information. AZURE = "azure" + class OSDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more @@ -406,22 +414,23 @@ class OSDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: provides lower read/write latency, along with faster node scaling and cluster upgrades. EPHEMERAL = "Ephemeral" + class OSSKU(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Specifies an OS SKU. This value must not be specified if OSType is Windows. - """ + """Specifies an OS SKU. This value must not be specified if OSType is Windows.""" UBUNTU = "Ubuntu" CBL_MARINER = "CBLMariner" + class OSType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The operating system type. The default is Linux. - """ + """The operating system type. The default is Linux.""" #: Use Linux. LINUX = "Linux" #: Use Windows. WINDOWS = "Windows" + class OutboundType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """This can only be set at cluster creation time and cannot be changed later. For more information see `egress outbound type `_. @@ -437,15 +446,16 @@ class OutboundType(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: `_. USER_DEFINED_ROUTING = "userDefinedRouting" + class PrivateEndpointConnectionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The current provisioning state. - """ + """The current provisioning state.""" SUCCEEDED = "Succeeded" CREATING = "Creating" DELETING = "Deleting" FAILED = "Failed" + class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """For more information see `use managed identities in AKS `_. @@ -462,10 +472,11 @@ class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Do not use a managed identity for the Managed Cluster, service principal will be used instead. NONE = "None" + class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The eviction policy specifies what to do with the VM when it is evicted. The default is Delete. For more information about eviction see `spot VMs - `_ + `_. """ #: Nodes in the underlying Scale Set of the node pool are deleted when they're evicted. @@ -475,9 +486,9 @@ class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: cause issues with cluster scaling or upgrading. DEALLOCATE = "Deallocate" + class ScaleSetPriority(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The Virtual Machine Scale Set priority. - """ + """The Virtual Machine Scale Set priority.""" #: Spot priority VMs will be used. There is no SLA for spot nodes. See `spot on AKS #: `_ for more information. @@ -485,6 +496,7 @@ class ScaleSetPriority(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Regular VMs will be used. REGULAR = "Regular" + class UpgradeChannel(str, Enum, metaclass=CaseInsensitiveEnumMeta): """For more information see `setting the AKS cluster auto-upgrade channel `_. @@ -515,9 +527,9 @@ class UpgradeChannel(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Disables auto-upgrades and keeps the cluster at its current version of Kubernetes. NONE = "none" + class WeekDay(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The weekday enum. - """ + """The weekday enum.""" SUNDAY = "Sunday" MONDAY = "Monday" diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/models/_models_py3.py index 81bf7d1d86ef..6855295b182d 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/models/_models_py3.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/models/_models_py3.py @@ -1,4 +1,5 @@ # coding=utf-8 +# pylint: disable=too-many-lines # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -9,14 +10,14 @@ import datetime from typing import Dict, List, Optional, TYPE_CHECKING, Union -import msrest.serialization +from ... import _serialization if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - import __init__ as _models + from .. import models as _models -class SubResource(msrest.serialization.Model): +class SubResource(_serialization.Model): """Reference to another subresource. Variables are only populated by the server, and will be ignored when sending a request. @@ -31,30 +32,26 @@ class SubResource(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(SubResource, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.id = None self.name = None self.type = None -class AgentPool(SubResource): +class AgentPool(SubResource): # pylint: disable=too-many-instance-attributes """Agent Pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -82,10 +79,10 @@ class AgentPool(SubResource): larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2021_05_01.models.OSDiskType :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data - root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2021_05_01.models.KubeletDiskType :ivar vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and used. @@ -99,11 +96,11 @@ class AgentPool(SubResource): :vartype pod_subnet_id: str :ivar max_pods: The maximum number of pods that can run on a node. :vartype max_pods: int - :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2021_05_01.models.OSType :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known - values are: "Ubuntu", "CBLMariner". + values are: "Ubuntu" and "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2021_05_01.models.OSSKU :ivar max_count: The maximum number of nodes for auto-scaling. :vartype max_count: int @@ -111,13 +108,13 @@ class AgentPool(SubResource): :vartype min_count: int :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool - :ivar type_properties_type: The type of Agent Pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + :ivar type_properties_type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets" + and "AvailabilitySet". :vartype type_properties_type: str or ~azure.mgmt.containerservice.v2021_05_01.models.AgentPoolType :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :vartype mode: str or ~azure.mgmt.containerservice.v2021_05_01.models.AgentPoolMode :ivar orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -149,20 +146,18 @@ class AgentPool(SubResource): /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default - is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + is 'Regular'. Known values are: "Spot" and "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2021_05_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2021_05_01.models.ScaleSetEvictionPolicy :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :vartype spot_max_price: float - :ivar tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :ivar tags: The tags to be persisted on the agent pool virtual machine scale set. :vartype tags: dict[str, str] :ivar node_labels: The node labels to be persisted across all nodes in agent pool. :vartype node_labels: dict[str, str] @@ -186,64 +181,64 @@ class AgentPool(SubResource): for more details. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2021_05_01.models.GPUInstanceProfile """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'os_disk_size_gb': {'maximum': 2048, 'minimum': 0}, - 'node_image_version': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'power_state': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "os_disk_size_gb": {"maximum": 2048, "minimum": 0}, + "node_image_version": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "power_state": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'count': {'key': 'properties.count', 'type': 'int'}, - 'vm_size': {'key': 'properties.vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'properties.osDiskSizeGB', 'type': 'int'}, - 'os_disk_type': {'key': 'properties.osDiskType', 'type': 'str'}, - 'kubelet_disk_type': {'key': 'properties.kubeletDiskType', 'type': 'str'}, - 'vnet_subnet_id': {'key': 'properties.vnetSubnetID', 'type': 'str'}, - 'pod_subnet_id': {'key': 'properties.podSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'properties.maxPods', 'type': 'int'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'os_sku': {'key': 'properties.osSKU', 'type': 'str'}, - 'max_count': {'key': 'properties.maxCount', 'type': 'int'}, - 'min_count': {'key': 'properties.minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'properties.enableAutoScaling', 'type': 'bool'}, - 'type_properties_type': {'key': 'properties.type', 'type': 'str'}, - 'mode': {'key': 'properties.mode', 'type': 'str'}, - 'orchestrator_version': {'key': 'properties.orchestratorVersion', 'type': 'str'}, - 'node_image_version': {'key': 'properties.nodeImageVersion', 'type': 'str'}, - 'upgrade_settings': {'key': 'properties.upgradeSettings', 'type': 'AgentPoolUpgradeSettings'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'power_state': {'key': 'properties.powerState', 'type': 'PowerState'}, - 'availability_zones': {'key': 'properties.availabilityZones', 'type': '[str]'}, - 'enable_node_public_ip': {'key': 'properties.enableNodePublicIP', 'type': 'bool'}, - 'node_public_ip_prefix_id': {'key': 'properties.nodePublicIPPrefixID', 'type': 'str'}, - 'scale_set_priority': {'key': 'properties.scaleSetPriority', 'type': 'str'}, - 'scale_set_eviction_policy': {'key': 'properties.scaleSetEvictionPolicy', 'type': 'str'}, - 'spot_max_price': {'key': 'properties.spotMaxPrice', 'type': 'float'}, - 'tags': {'key': 'properties.tags', 'type': '{str}'}, - 'node_labels': {'key': 'properties.nodeLabels', 'type': '{str}'}, - 'node_taints': {'key': 'properties.nodeTaints', 'type': '[str]'}, - 'proximity_placement_group_id': {'key': 'properties.proximityPlacementGroupID', 'type': 'str'}, - 'kubelet_config': {'key': 'properties.kubeletConfig', 'type': 'KubeletConfig'}, - 'linux_os_config': {'key': 'properties.linuxOSConfig', 'type': 'LinuxOSConfig'}, - 'enable_encryption_at_host': {'key': 'properties.enableEncryptionAtHost', 'type': 'bool'}, - 'enable_ultra_ssd': {'key': 'properties.enableUltraSSD', 'type': 'bool'}, - 'enable_fips': {'key': 'properties.enableFIPS', 'type': 'bool'}, - 'gpu_instance_profile': {'key': 'properties.gpuInstanceProfile', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "count": {"key": "properties.count", "type": "int"}, + "vm_size": {"key": "properties.vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "properties.osDiskSizeGB", "type": "int"}, + "os_disk_type": {"key": "properties.osDiskType", "type": "str"}, + "kubelet_disk_type": {"key": "properties.kubeletDiskType", "type": "str"}, + "vnet_subnet_id": {"key": "properties.vnetSubnetID", "type": "str"}, + "pod_subnet_id": {"key": "properties.podSubnetID", "type": "str"}, + "max_pods": {"key": "properties.maxPods", "type": "int"}, + "os_type": {"key": "properties.osType", "type": "str"}, + "os_sku": {"key": "properties.osSKU", "type": "str"}, + "max_count": {"key": "properties.maxCount", "type": "int"}, + "min_count": {"key": "properties.minCount", "type": "int"}, + "enable_auto_scaling": {"key": "properties.enableAutoScaling", "type": "bool"}, + "type_properties_type": {"key": "properties.type", "type": "str"}, + "mode": {"key": "properties.mode", "type": "str"}, + "orchestrator_version": {"key": "properties.orchestratorVersion", "type": "str"}, + "node_image_version": {"key": "properties.nodeImageVersion", "type": "str"}, + "upgrade_settings": {"key": "properties.upgradeSettings", "type": "AgentPoolUpgradeSettings"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "power_state": {"key": "properties.powerState", "type": "PowerState"}, + "availability_zones": {"key": "properties.availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "properties.enableNodePublicIP", "type": "bool"}, + "node_public_ip_prefix_id": {"key": "properties.nodePublicIPPrefixID", "type": "str"}, + "scale_set_priority": {"key": "properties.scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "properties.scaleSetEvictionPolicy", "type": "str"}, + "spot_max_price": {"key": "properties.spotMaxPrice", "type": "float"}, + "tags": {"key": "properties.tags", "type": "{str}"}, + "node_labels": {"key": "properties.nodeLabels", "type": "{str}"}, + "node_taints": {"key": "properties.nodeTaints", "type": "[str]"}, + "proximity_placement_group_id": {"key": "properties.proximityPlacementGroupID", "type": "str"}, + "kubelet_config": {"key": "properties.kubeletConfig", "type": "KubeletConfig"}, + "linux_os_config": {"key": "properties.linuxOSConfig", "type": "LinuxOSConfig"}, + "enable_encryption_at_host": {"key": "properties.enableEncryptionAtHost", "type": "bool"}, + "enable_ultra_ssd": {"key": "properties.enableUltraSSD", "type": "bool"}, + "enable_fips": {"key": "properties.enableFIPS", "type": "bool"}, + "gpu_instance_profile": {"key": "properties.gpuInstanceProfile", "type": "str"}, } - def __init__( + def __init__( # pylint: disable=too-many-locals self, *, count: Optional[int] = None, @@ -254,7 +249,7 @@ def __init__( vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, @@ -266,9 +261,9 @@ def __init__( availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", - spot_max_price: Optional[float] = -1, + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", + spot_max_price: float = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, @@ -298,10 +293,10 @@ def __init__( larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2021_05_01.models.OSDiskType :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime - data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + data root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2021_05_01.models.KubeletDiskType :keyword vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and @@ -315,11 +310,11 @@ def __init__( :paramtype pod_subnet_id: str :keyword max_pods: The maximum number of pods that can run on a node. :paramtype max_pods: int - :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2021_05_01.models.OSType :keyword os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Known values are: "Ubuntu", "CBLMariner". + Known values are: "Ubuntu" and "CBLMariner". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2021_05_01.models.OSSKU :keyword max_count: The maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -328,12 +323,12 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword type_properties_type: The type of Agent Pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type_properties_type: str or ~azure.mgmt.containerservice.v2021_05_01.models.AgentPoolType :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2021_05_01.models.AgentPoolMode :keyword orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -359,20 +354,18 @@ def __init__( /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the - default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + default is 'Regular'. Known values are: "Spot" and "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2021_05_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2021_05_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :paramtype spot_max_price: float - :keyword tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :keyword tags: The tags to be persisted on the agent pool virtual machine scale set. :paramtype tags: dict[str, str] :keyword node_labels: The node labels to be persisted across all nodes in agent pool. :paramtype node_labels: dict[str, str] @@ -396,12 +389,12 @@ def __init__( for more details. :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance - profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2021_05_01.models.GPUInstanceProfile """ - super(AgentPool, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.vm_size = vm_size self.os_disk_size_gb = os_disk_size_gb @@ -440,7 +433,7 @@ def __init__( self.gpu_instance_profile = gpu_instance_profile -class AgentPoolAvailableVersions(msrest.serialization.Model): +class AgentPoolAvailableVersions(_serialization.Model): """The list of available versions for an agent pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -457,16 +450,19 @@ class AgentPoolAvailableVersions(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'agent_pool_versions': {'key': 'properties.agentPoolVersions', 'type': '[AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "agent_pool_versions": { + "key": "properties.agentPoolVersions", + "type": "[AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem]", + }, } def __init__( @@ -480,14 +476,14 @@ def __init__( :paramtype agent_pool_versions: list[~azure.mgmt.containerservice.v2021_05_01.models.AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem] """ - super(AgentPoolAvailableVersions, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None self.agent_pool_versions = agent_pool_versions -class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(msrest.serialization.Model): +class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(_serialization.Model): """AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem. :ivar default: Whether this version is the default agent pool version. @@ -499,9 +495,9 @@ class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(msrest.serializa """ _attribute_map = { - 'default': {'key': 'default', 'type': 'bool'}, - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "default": {"key": "default", "type": "bool"}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } def __init__( @@ -520,13 +516,13 @@ def __init__( :keyword is_preview: Whether Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.default = default self.kubernetes_version = kubernetes_version self.is_preview = is_preview -class AgentPoolListResult(msrest.serialization.Model): +class AgentPoolListResult(_serialization.Model): """The response from the List Agent Pools operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -538,30 +534,25 @@ class AgentPoolListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[AgentPool]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[AgentPool]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.AgentPool"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.AgentPool"]] = None, **kwargs): """ :keyword value: The list of agent pools. :paramtype value: list[~azure.mgmt.containerservice.v2021_05_01.models.AgentPool] """ - super(AgentPoolListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class AgentPoolUpgradeProfile(msrest.serialization.Model): +class AgentPoolUpgradeProfile(_serialization.Model): """The list of available upgrades for an agent pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -574,10 +565,10 @@ class AgentPoolUpgradeProfile(msrest.serialization.Model): :vartype name: str :ivar type: The type of the agent pool upgrade profile. :vartype type: str - :ivar kubernetes_version: Required. The Kubernetes version (major.minor.patch). + :ivar kubernetes_version: The Kubernetes version (major.minor.patch). Required. :vartype kubernetes_version: str - :ivar os_type: Required. The operating system type. The default is Linux. Known values are: - "Linux", "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2021_05_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -587,21 +578,21 @@ class AgentPoolUpgradeProfile(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kubernetes_version': {'required': True}, - 'os_type': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "kubernetes_version": {"required": True}, + "os_type": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'kubernetes_version': {'key': 'properties.kubernetesVersion', 'type': 'str'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'upgrades': {'key': 'properties.upgrades', 'type': '[AgentPoolUpgradeProfilePropertiesUpgradesItem]'}, - 'latest_node_image_version': {'key': 'properties.latestNodeImageVersion', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "os_type": {"key": "properties.osType", "type": "str"}, + "upgrades": {"key": "properties.upgrades", "type": "[AgentPoolUpgradeProfilePropertiesUpgradesItem]"}, + "latest_node_image_version": {"key": "properties.latestNodeImageVersion", "type": "str"}, } def __init__( @@ -614,10 +605,10 @@ def __init__( **kwargs ): """ - :keyword kubernetes_version: Required. The Kubernetes version (major.minor.patch). + :keyword kubernetes_version: The Kubernetes version (major.minor.patch). Required. :paramtype kubernetes_version: str - :keyword os_type: Required. The operating system type. The default is Linux. Known values are: - "Linux", "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2021_05_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: @@ -625,7 +616,7 @@ def __init__( :keyword latest_node_image_version: The latest AKS supported node image version. :paramtype latest_node_image_version: str """ - super(AgentPoolUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -635,7 +626,7 @@ def __init__( self.latest_node_image_version = latest_node_image_version -class AgentPoolUpgradeProfilePropertiesUpgradesItem(msrest.serialization.Model): +class AgentPoolUpgradeProfilePropertiesUpgradesItem(_serialization.Model): """AgentPoolUpgradeProfilePropertiesUpgradesItem. :ivar kubernetes_version: The Kubernetes version (major.minor.patch). @@ -645,29 +636,23 @@ class AgentPoolUpgradeProfilePropertiesUpgradesItem(msrest.serialization.Model): """ _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } - def __init__( - self, - *, - kubernetes_version: Optional[str] = None, - is_preview: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, kubernetes_version: Optional[str] = None, is_preview: Optional[bool] = None, **kwargs): """ :keyword kubernetes_version: The Kubernetes version (major.minor.patch). :paramtype kubernetes_version: str :keyword is_preview: Whether the Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(AgentPoolUpgradeProfilePropertiesUpgradesItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.is_preview = is_preview -class AgentPoolUpgradeSettings(msrest.serialization.Model): +class AgentPoolUpgradeSettings(_serialization.Model): """Settings for upgrading an agentpool. :ivar max_surge: This can either be set to an integer (e.g. '5') or a percentage (e.g. '50%'). @@ -679,15 +664,10 @@ class AgentPoolUpgradeSettings(msrest.serialization.Model): """ _attribute_map = { - 'max_surge': {'key': 'maxSurge', 'type': 'str'}, + "max_surge": {"key": "maxSurge", "type": "str"}, } - def __init__( - self, - *, - max_surge: Optional[str] = None, - **kwargs - ): + def __init__(self, *, max_surge: Optional[str] = None, **kwargs): """ :keyword max_surge: This can either be set to an integer (e.g. '5') or a percentage (e.g. '50%'). If a percentage is specified, it is the percentage of the total agent pool size at the @@ -696,11 +676,11 @@ def __init__( https://docs.microsoft.com/azure/aks/upgrade-cluster#customize-node-surge-upgrade. :paramtype max_surge: str """ - super(AgentPoolUpgradeSettings, self).__init__(**kwargs) + super().__init__(**kwargs) self.max_surge = max_surge -class CloudErrorBody(msrest.serialization.Model): +class CloudErrorBody(_serialization.Model): """An error response from the Container service. :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed @@ -717,10 +697,10 @@ class CloudErrorBody(msrest.serialization.Model): """ _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[CloudErrorBody]"}, } def __init__( @@ -745,14 +725,16 @@ def __init__( :keyword details: A list of additional details about the error. :paramtype details: list[~azure.mgmt.containerservice.v2021_05_01.models.CloudErrorBody] """ - super(CloudErrorBody, self).__init__(**kwargs) + super().__init__(**kwargs) self.code = code self.message = message self.target = target self.details = details -class Components1Q1Og48SchemasManagedclusterAllof1(msrest.serialization.Model): +class Components1Q1Og48SchemasManagedclusterAllof1( + _serialization.Model +): # pylint: disable=too-many-instance-attributes """Components1Q1Og48SchemasManagedclusterAllof1. Variables are only populated by the server, and will be ignored when sending a request. @@ -846,47 +828,59 @@ class Components1Q1Og48SchemasManagedclusterAllof1(msrest.serialization.Model): """ _validation = { - 'provisioning_state': {'readonly': True}, - 'power_state': {'readonly': True}, - 'max_agent_pools': {'readonly': True}, - 'fqdn': {'readonly': True}, - 'private_fqdn': {'readonly': True}, - 'azure_portal_fqdn': {'readonly': True}, + "provisioning_state": {"readonly": True}, + "power_state": {"readonly": True}, + "max_agent_pools": {"readonly": True}, + "fqdn": {"readonly": True}, + "private_fqdn": {"readonly": True}, + "azure_portal_fqdn": {"readonly": True}, } _attribute_map = { - 'identity': {'key': 'identity', 'type': 'ManagedClusterIdentity'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'power_state': {'key': 'properties.powerState', 'type': 'PowerState'}, - 'max_agent_pools': {'key': 'properties.maxAgentPools', 'type': 'int'}, - 'kubernetes_version': {'key': 'properties.kubernetesVersion', 'type': 'str'}, - 'dns_prefix': {'key': 'properties.dnsPrefix', 'type': 'str'}, - 'fqdn_subdomain': {'key': 'properties.fqdnSubdomain', 'type': 'str'}, - 'fqdn': {'key': 'properties.fqdn', 'type': 'str'}, - 'private_fqdn': {'key': 'properties.privateFQDN', 'type': 'str'}, - 'azure_portal_fqdn': {'key': 'properties.azurePortalFQDN', 'type': 'str'}, - 'agent_pool_profiles': {'key': 'properties.agentPoolProfiles', 'type': '[ManagedClusterAgentPoolProfile]'}, - 'linux_profile': {'key': 'properties.linuxProfile', 'type': 'ContainerServiceLinuxProfile'}, - 'windows_profile': {'key': 'properties.windowsProfile', 'type': 'ManagedClusterWindowsProfile'}, - 'service_principal_profile': {'key': 'properties.servicePrincipalProfile', 'type': 'ManagedClusterServicePrincipalProfile'}, - 'addon_profiles': {'key': 'properties.addonProfiles', 'type': '{ManagedClusterAddonProfile}'}, - 'pod_identity_profile': {'key': 'properties.podIdentityProfile', 'type': 'ManagedClusterPodIdentityProfile'}, - 'node_resource_group': {'key': 'properties.nodeResourceGroup', 'type': 'str'}, - 'enable_rbac': {'key': 'properties.enableRBAC', 'type': 'bool'}, - 'enable_pod_security_policy': {'key': 'properties.enablePodSecurityPolicy', 'type': 'bool'}, - 'network_profile': {'key': 'properties.networkProfile', 'type': 'ContainerServiceNetworkProfile'}, - 'aad_profile': {'key': 'properties.aadProfile', 'type': 'ManagedClusterAADProfile'}, - 'auto_upgrade_profile': {'key': 'properties.autoUpgradeProfile', 'type': 'ManagedClusterAutoUpgradeProfile'}, - 'auto_scaler_profile': {'key': 'properties.autoScalerProfile', 'type': 'ManagedClusterPropertiesAutoScalerProfile'}, - 'api_server_access_profile': {'key': 'properties.apiServerAccessProfile', 'type': 'ManagedClusterAPIServerAccessProfile'}, - 'disk_encryption_set_id': {'key': 'properties.diskEncryptionSetID', 'type': 'str'}, - 'identity_profile': {'key': 'properties.identityProfile', 'type': '{ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties}'}, - 'private_link_resources': {'key': 'properties.privateLinkResources', 'type': '[PrivateLinkResource]'}, - 'disable_local_accounts': {'key': 'properties.disableLocalAccounts', 'type': 'bool'}, - 'http_proxy_config': {'key': 'properties.httpProxyConfig', 'type': 'ManagedClusterHTTPProxyConfig'}, + "identity": {"key": "identity", "type": "ManagedClusterIdentity"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "power_state": {"key": "properties.powerState", "type": "PowerState"}, + "max_agent_pools": {"key": "properties.maxAgentPools", "type": "int"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "dns_prefix": {"key": "properties.dnsPrefix", "type": "str"}, + "fqdn_subdomain": {"key": "properties.fqdnSubdomain", "type": "str"}, + "fqdn": {"key": "properties.fqdn", "type": "str"}, + "private_fqdn": {"key": "properties.privateFQDN", "type": "str"}, + "azure_portal_fqdn": {"key": "properties.azurePortalFQDN", "type": "str"}, + "agent_pool_profiles": {"key": "properties.agentPoolProfiles", "type": "[ManagedClusterAgentPoolProfile]"}, + "linux_profile": {"key": "properties.linuxProfile", "type": "ContainerServiceLinuxProfile"}, + "windows_profile": {"key": "properties.windowsProfile", "type": "ManagedClusterWindowsProfile"}, + "service_principal_profile": { + "key": "properties.servicePrincipalProfile", + "type": "ManagedClusterServicePrincipalProfile", + }, + "addon_profiles": {"key": "properties.addonProfiles", "type": "{ManagedClusterAddonProfile}"}, + "pod_identity_profile": {"key": "properties.podIdentityProfile", "type": "ManagedClusterPodIdentityProfile"}, + "node_resource_group": {"key": "properties.nodeResourceGroup", "type": "str"}, + "enable_rbac": {"key": "properties.enableRBAC", "type": "bool"}, + "enable_pod_security_policy": {"key": "properties.enablePodSecurityPolicy", "type": "bool"}, + "network_profile": {"key": "properties.networkProfile", "type": "ContainerServiceNetworkProfile"}, + "aad_profile": {"key": "properties.aadProfile", "type": "ManagedClusterAADProfile"}, + "auto_upgrade_profile": {"key": "properties.autoUpgradeProfile", "type": "ManagedClusterAutoUpgradeProfile"}, + "auto_scaler_profile": { + "key": "properties.autoScalerProfile", + "type": "ManagedClusterPropertiesAutoScalerProfile", + }, + "api_server_access_profile": { + "key": "properties.apiServerAccessProfile", + "type": "ManagedClusterAPIServerAccessProfile", + }, + "disk_encryption_set_id": {"key": "properties.diskEncryptionSetID", "type": "str"}, + "identity_profile": { + "key": "properties.identityProfile", + "type": "{ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties}", + }, + "private_link_resources": {"key": "properties.privateLinkResources", "type": "[PrivateLinkResource]"}, + "disable_local_accounts": {"key": "properties.disableLocalAccounts", "type": "bool"}, + "http_proxy_config": {"key": "properties.httpProxyConfig", "type": "ManagedClusterHTTPProxyConfig"}, } - def __init__( + def __init__( # pylint: disable=too-many-locals self, *, identity: Optional["_models.ManagedClusterIdentity"] = None, @@ -908,7 +902,12 @@ def __init__( auto_scaler_profile: Optional["_models.ManagedClusterPropertiesAutoScalerProfile"] = None, api_server_access_profile: Optional["_models.ManagedClusterAPIServerAccessProfile"] = None, disk_encryption_set_id: Optional[str] = None, - identity_profile: Optional[Dict[str, "_models.ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties"]] = None, + identity_profile: Optional[ + Dict[ + str, + "_models.ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties", + ] + ] = None, private_link_resources: Optional[List["_models.PrivateLinkResource"]] = None, disable_local_accounts: Optional[bool] = None, http_proxy_config: Optional["_models.ManagedClusterHTTPProxyConfig"] = None, @@ -990,7 +989,7 @@ def __init__( :paramtype http_proxy_config: ~azure.mgmt.containerservice.v2021_05_01.models.ManagedClusterHTTPProxyConfig """ - super(Components1Q1Og48SchemasManagedclusterAllof1, self).__init__(**kwargs) + super().__init__(**kwargs) self.identity = identity self.provisioning_state = None self.power_state = None @@ -1022,7 +1021,9 @@ def __init__( self.http_proxy_config = http_proxy_config -class Components1Umhcm8SchemasManagedclusteridentityPropertiesUserassignedidentitiesAdditionalproperties(msrest.serialization.Model): +class Components1Umhcm8SchemasManagedclusteridentityPropertiesUserassignedidentitiesAdditionalproperties( + _serialization.Model +): """Components1Umhcm8SchemasManagedclusteridentityPropertiesUserassignedidentitiesAdditionalproperties. Variables are only populated by the server, and will be ignored when sending a request. @@ -1034,27 +1035,23 @@ class Components1Umhcm8SchemasManagedclusteridentityPropertiesUserassignedidenti """ _validation = { - 'principal_id': {'readonly': True}, - 'client_id': {'readonly': True}, + "principal_id": {"readonly": True}, + "client_id": {"readonly": True}, } _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, + "principal_id": {"key": "principalId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(Components1Umhcm8SchemasManagedclusteridentityPropertiesUserassignedidentitiesAdditionalproperties, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.principal_id = None self.client_id = None -class UserAssignedIdentity(msrest.serialization.Model): +class UserAssignedIdentity(_serialization.Model): """Details about a user assigned identity. :ivar resource_id: The resource ID of the user assigned identity. @@ -1066,9 +1063,9 @@ class UserAssignedIdentity(msrest.serialization.Model): """ _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'object_id': {'key': 'objectId', 'type': 'str'}, + "resource_id": {"key": "resourceId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + "object_id": {"key": "objectId", "type": "str"}, } def __init__( @@ -1087,13 +1084,15 @@ def __init__( :keyword object_id: The object ID of the user assigned identity. :paramtype object_id: str """ - super(UserAssignedIdentity, self).__init__(**kwargs) + super().__init__(**kwargs) self.resource_id = resource_id self.client_id = client_id self.object_id = object_id -class ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties(UserAssignedIdentity): +class ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties( + UserAssignedIdentity +): """ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties. :ivar resource_id: The resource ID of the user assigned identity. @@ -1105,9 +1104,9 @@ class ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAd """ _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'object_id': {'key': 'objectId', 'type': 'str'}, + "resource_id": {"key": "resourceId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + "object_id": {"key": "objectId", "type": "str"}, } def __init__( @@ -1126,83 +1125,72 @@ def __init__( :keyword object_id: The object ID of the user assigned identity. :paramtype object_id: str """ - super(ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties, self).__init__(resource_id=resource_id, client_id=client_id, object_id=object_id, **kwargs) + super().__init__(resource_id=resource_id, client_id=client_id, object_id=object_id, **kwargs) -class ContainerServiceDiagnosticsProfile(msrest.serialization.Model): +class ContainerServiceDiagnosticsProfile(_serialization.Model): """Profile for diagnostics on the container service cluster. All required parameters must be populated in order to send to Azure. - :ivar vm_diagnostics: Required. Profile for diagnostics on the container service VMs. + :ivar vm_diagnostics: Profile for diagnostics on the container service VMs. Required. :vartype vm_diagnostics: ~azure.mgmt.containerservice.v2021_05_01.models.ContainerServiceVMDiagnostics """ _validation = { - 'vm_diagnostics': {'required': True}, + "vm_diagnostics": {"required": True}, } _attribute_map = { - 'vm_diagnostics': {'key': 'vmDiagnostics', 'type': 'ContainerServiceVMDiagnostics'}, + "vm_diagnostics": {"key": "vmDiagnostics", "type": "ContainerServiceVMDiagnostics"}, } - def __init__( - self, - *, - vm_diagnostics: "_models.ContainerServiceVMDiagnostics", - **kwargs - ): + def __init__(self, *, vm_diagnostics: "_models.ContainerServiceVMDiagnostics", **kwargs): """ - :keyword vm_diagnostics: Required. Profile for diagnostics on the container service VMs. + :keyword vm_diagnostics: Profile for diagnostics on the container service VMs. Required. :paramtype vm_diagnostics: ~azure.mgmt.containerservice.v2021_05_01.models.ContainerServiceVMDiagnostics """ - super(ContainerServiceDiagnosticsProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.vm_diagnostics = vm_diagnostics -class ContainerServiceLinuxProfile(msrest.serialization.Model): +class ContainerServiceLinuxProfile(_serialization.Model): """Profile for Linux VMs in the container service cluster. All required parameters must be populated in order to send to Azure. - :ivar admin_username: Required. The administrator username to use for Linux VMs. + :ivar admin_username: The administrator username to use for Linux VMs. Required. :vartype admin_username: str - :ivar ssh: Required. The SSH configuration for Linux-based VMs running on Azure. + :ivar ssh: The SSH configuration for Linux-based VMs running on Azure. Required. :vartype ssh: ~azure.mgmt.containerservice.v2021_05_01.models.ContainerServiceSshConfiguration """ _validation = { - 'admin_username': {'required': True, 'pattern': r'^[A-Za-z][-A-Za-z0-9_]*$'}, - 'ssh': {'required': True}, + "admin_username": {"required": True, "pattern": r"^[A-Za-z][-A-Za-z0-9_]*$"}, + "ssh": {"required": True}, } _attribute_map = { - 'admin_username': {'key': 'adminUsername', 'type': 'str'}, - 'ssh': {'key': 'ssh', 'type': 'ContainerServiceSshConfiguration'}, + "admin_username": {"key": "adminUsername", "type": "str"}, + "ssh": {"key": "ssh", "type": "ContainerServiceSshConfiguration"}, } - def __init__( - self, - *, - admin_username: str, - ssh: "_models.ContainerServiceSshConfiguration", - **kwargs - ): + def __init__(self, *, admin_username: str, ssh: "_models.ContainerServiceSshConfiguration", **kwargs): """ - :keyword admin_username: Required. The administrator username to use for Linux VMs. + :keyword admin_username: The administrator username to use for Linux VMs. Required. :paramtype admin_username: str - :keyword ssh: Required. The SSH configuration for Linux-based VMs running on Azure. + :keyword ssh: The SSH configuration for Linux-based VMs running on Azure. Required. :paramtype ssh: ~azure.mgmt.containerservice.v2021_05_01.models.ContainerServiceSshConfiguration """ - super(ContainerServiceLinuxProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.admin_username = admin_username self.ssh = ssh -class ContainerServiceMasterProfile(msrest.serialization.Model): +class ContainerServiceMasterProfile(_serialization.Model): """Profile for the container service master. Variables are only populated by the server, and will be ignored when sending a request. @@ -1210,11 +1198,11 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar count: Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, - and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". + and 5. The default value is 1. Known values are: 1, 3, and 5. :vartype count: int or ~azure.mgmt.containerservice.v2021_05_01.models.Count - :ivar dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. + :ivar dns_prefix: DNS prefix to be used to create the FQDN for the master pool. Required. :vartype dns_prefix: str - :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + :ivar vm_size: Size of agent VMs. Required. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -1251,7 +1239,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :vartype vm_size: str or ~azure.mgmt.containerservice.v2021_05_01.models.ContainerServiceVMSizeTypes :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine @@ -1265,7 +1253,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): :vartype first_consecutive_static_ip: str :ivar storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount" and "ManagedDisks". :vartype storage_profile: str or ~azure.mgmt.containerservice.v2021_05_01.models.ContainerServiceStorageProfileTypes :ivar fqdn: FQDN for the master pool. @@ -1273,21 +1261,21 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): """ _validation = { - 'dns_prefix': {'required': True}, - 'vm_size': {'required': True}, - 'os_disk_size_gb': {'maximum': 2048, 'minimum': 0}, - 'fqdn': {'readonly': True}, + "dns_prefix": {"required": True}, + "vm_size": {"required": True}, + "os_disk_size_gb": {"maximum": 2048, "minimum": 0}, + "fqdn": {"readonly": True}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'dns_prefix': {'key': 'dnsPrefix', 'type': 'str'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'first_consecutive_static_ip': {'key': 'firstConsecutiveStaticIP', 'type': 'str'}, - 'storage_profile': {'key': 'storageProfile', 'type': 'str'}, - 'fqdn': {'key': 'fqdn', 'type': 'str'}, + "count": {"key": "count", "type": "int"}, + "dns_prefix": {"key": "dnsPrefix", "type": "str"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "first_consecutive_static_ip": {"key": "firstConsecutiveStaticIP", "type": "str"}, + "storage_profile": {"key": "storageProfile", "type": "str"}, + "fqdn": {"key": "fqdn", "type": "str"}, } def __init__( @@ -1295,20 +1283,20 @@ def __init__( *, dns_prefix: str, vm_size: Union[str, "_models.ContainerServiceVMSizeTypes"], - count: Optional[Union[int, "_models.Count"]] = 1, + count: Union[int, "_models.Count"] = 1, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, - first_consecutive_static_ip: Optional[str] = "10.240.255.5", + first_consecutive_static_ip: str = "10.240.255.5", storage_profile: Optional[Union[str, "_models.ContainerServiceStorageProfileTypes"]] = None, **kwargs ): """ :keyword count: Number of masters (VMs) in the container service cluster. Allowed values are 1, - 3, and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". + 3, and 5. The default value is 1. Known values are: 1, 3, and 5. :paramtype count: int or ~azure.mgmt.containerservice.v2021_05_01.models.Count - :keyword dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. + :keyword dns_prefix: DNS prefix to be used to create the FQDN for the master pool. Required. :paramtype dns_prefix: str - :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + :keyword vm_size: Size of agent VMs. Required. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -1345,7 +1333,7 @@ def __init__( "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :paramtype vm_size: str or ~azure.mgmt.containerservice.v2021_05_01.models.ContainerServiceVMSizeTypes :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every @@ -1359,11 +1347,11 @@ def __init__( :paramtype first_consecutive_static_ip: str :keyword storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount" and "ManagedDisks". :paramtype storage_profile: str or ~azure.mgmt.containerservice.v2021_05_01.models.ContainerServiceStorageProfileTypes """ - super(ContainerServiceMasterProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.dns_prefix = dns_prefix self.vm_size = vm_size @@ -1374,17 +1362,17 @@ def __init__( self.fqdn = None -class ContainerServiceNetworkProfile(msrest.serialization.Model): +class ContainerServiceNetworkProfile(_serialization.Model): """Profile of network configuration. :ivar network_plugin: Network plugin used for building the Kubernetes network. Known values - are: "azure", "kubenet". Default value: "kubenet". + are: "azure" and "kubenet". :vartype network_plugin: str or ~azure.mgmt.containerservice.v2021_05_01.models.NetworkPlugin :ivar network_policy: Network policy used for building the Kubernetes network. Known values - are: "calico", "azure". + are: "calico" and "azure". :vartype network_policy: str or ~azure.mgmt.containerservice.v2021_05_01.models.NetworkPolicy :ivar network_mode: This cannot be specified if networkPlugin is anything other than 'azure'. - Known values are: "transparent", "bridge". + Known values are: "transparent" and "bridge". :vartype network_mode: str or ~azure.mgmt.containerservice.v2021_05_01.models.NetworkMode :ivar pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :vartype pod_cidr: str @@ -1399,12 +1387,12 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): :vartype docker_bridge_cidr: str :ivar outbound_type: This can only be set at cluster creation time and cannot be changed later. For more information see `egress outbound type - `_. Known values are: "loadBalancer", - "userDefinedRouting". Default value: "loadBalancer". + `_. Known values are: "loadBalancer" + and "userDefinedRouting". :vartype outbound_type: str or ~azure.mgmt.containerservice.v2021_05_01.models.OutboundType :ivar load_balancer_sku: The default is 'standard'. See `Azure Load Balancer SKUs `_ for more information about the - differences between load balancer SKUs. Known values are: "standard", "basic". + differences between load balancer SKUs. Known values are: "standard" and "basic". :vartype load_balancer_sku: str or ~azure.mgmt.containerservice.v2021_05_01.models.LoadBalancerSku :ivar load_balancer_profile: Profile of the cluster load balancer. @@ -1413,49 +1401,51 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): """ _validation = { - 'pod_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, - 'service_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, - 'dns_service_ip': {'pattern': r'^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$'}, - 'docker_bridge_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, + "pod_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, + "service_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, + "dns_service_ip": { + "pattern": r"^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$" + }, + "docker_bridge_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, } _attribute_map = { - 'network_plugin': {'key': 'networkPlugin', 'type': 'str'}, - 'network_policy': {'key': 'networkPolicy', 'type': 'str'}, - 'network_mode': {'key': 'networkMode', 'type': 'str'}, - 'pod_cidr': {'key': 'podCidr', 'type': 'str'}, - 'service_cidr': {'key': 'serviceCidr', 'type': 'str'}, - 'dns_service_ip': {'key': 'dnsServiceIP', 'type': 'str'}, - 'docker_bridge_cidr': {'key': 'dockerBridgeCidr', 'type': 'str'}, - 'outbound_type': {'key': 'outboundType', 'type': 'str'}, - 'load_balancer_sku': {'key': 'loadBalancerSku', 'type': 'str'}, - 'load_balancer_profile': {'key': 'loadBalancerProfile', 'type': 'ManagedClusterLoadBalancerProfile'}, + "network_plugin": {"key": "networkPlugin", "type": "str"}, + "network_policy": {"key": "networkPolicy", "type": "str"}, + "network_mode": {"key": "networkMode", "type": "str"}, + "pod_cidr": {"key": "podCidr", "type": "str"}, + "service_cidr": {"key": "serviceCidr", "type": "str"}, + "dns_service_ip": {"key": "dnsServiceIP", "type": "str"}, + "docker_bridge_cidr": {"key": "dockerBridgeCidr", "type": "str"}, + "outbound_type": {"key": "outboundType", "type": "str"}, + "load_balancer_sku": {"key": "loadBalancerSku", "type": "str"}, + "load_balancer_profile": {"key": "loadBalancerProfile", "type": "ManagedClusterLoadBalancerProfile"}, } def __init__( self, *, - network_plugin: Optional[Union[str, "_models.NetworkPlugin"]] = "kubenet", + network_plugin: Union[str, "_models.NetworkPlugin"] = "kubenet", network_policy: Optional[Union[str, "_models.NetworkPolicy"]] = None, network_mode: Optional[Union[str, "_models.NetworkMode"]] = None, - pod_cidr: Optional[str] = "10.244.0.0/16", - service_cidr: Optional[str] = "10.0.0.0/16", - dns_service_ip: Optional[str] = "10.0.0.10", - docker_bridge_cidr: Optional[str] = "172.17.0.1/16", - outbound_type: Optional[Union[str, "_models.OutboundType"]] = "loadBalancer", + pod_cidr: str = "10.244.0.0/16", + service_cidr: str = "10.0.0.0/16", + dns_service_ip: str = "10.0.0.10", + docker_bridge_cidr: str = "172.17.0.1/16", + outbound_type: Union[str, "_models.OutboundType"] = "loadBalancer", load_balancer_sku: Optional[Union[str, "_models.LoadBalancerSku"]] = None, load_balancer_profile: Optional["_models.ManagedClusterLoadBalancerProfile"] = None, **kwargs ): """ :keyword network_plugin: Network plugin used for building the Kubernetes network. Known values - are: "azure", "kubenet". Default value: "kubenet". + are: "azure" and "kubenet". :paramtype network_plugin: str or ~azure.mgmt.containerservice.v2021_05_01.models.NetworkPlugin :keyword network_policy: Network policy used for building the Kubernetes network. Known values - are: "calico", "azure". + are: "calico" and "azure". :paramtype network_policy: str or ~azure.mgmt.containerservice.v2021_05_01.models.NetworkPolicy :keyword network_mode: This cannot be specified if networkPlugin is anything other than - 'azure'. Known values are: "transparent", "bridge". + 'azure'. Known values are: "transparent" and "bridge". :paramtype network_mode: str or ~azure.mgmt.containerservice.v2021_05_01.models.NetworkMode :keyword pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :paramtype pod_cidr: str @@ -1470,19 +1460,19 @@ def __init__( :paramtype docker_bridge_cidr: str :keyword outbound_type: This can only be set at cluster creation time and cannot be changed later. For more information see `egress outbound type - `_. Known values are: "loadBalancer", - "userDefinedRouting". Default value: "loadBalancer". + `_. Known values are: "loadBalancer" + and "userDefinedRouting". :paramtype outbound_type: str or ~azure.mgmt.containerservice.v2021_05_01.models.OutboundType :keyword load_balancer_sku: The default is 'standard'. See `Azure Load Balancer SKUs `_ for more information about the - differences between load balancer SKUs. Known values are: "standard", "basic". + differences between load balancer SKUs. Known values are: "standard" and "basic". :paramtype load_balancer_sku: str or ~azure.mgmt.containerservice.v2021_05_01.models.LoadBalancerSku :keyword load_balancer_profile: Profile of the cluster load balancer. :paramtype load_balancer_profile: ~azure.mgmt.containerservice.v2021_05_01.models.ManagedClusterLoadBalancerProfile """ - super(ContainerServiceNetworkProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.network_plugin = network_plugin self.network_policy = network_policy self.network_mode = network_mode @@ -1495,113 +1485,98 @@ def __init__( self.load_balancer_profile = load_balancer_profile -class ContainerServiceSshConfiguration(msrest.serialization.Model): +class ContainerServiceSshConfiguration(_serialization.Model): """SSH configuration for Linux-based VMs running on Azure. All required parameters must be populated in order to send to Azure. - :ivar public_keys: Required. The list of SSH public keys used to authenticate with Linux-based - VMs. A maximum of 1 key may be specified. + :ivar public_keys: The list of SSH public keys used to authenticate with Linux-based VMs. A + maximum of 1 key may be specified. Required. :vartype public_keys: list[~azure.mgmt.containerservice.v2021_05_01.models.ContainerServiceSshPublicKey] """ _validation = { - 'public_keys': {'required': True}, + "public_keys": {"required": True}, } _attribute_map = { - 'public_keys': {'key': 'publicKeys', 'type': '[ContainerServiceSshPublicKey]'}, + "public_keys": {"key": "publicKeys", "type": "[ContainerServiceSshPublicKey]"}, } - def __init__( - self, - *, - public_keys: List["_models.ContainerServiceSshPublicKey"], - **kwargs - ): + def __init__(self, *, public_keys: List["_models.ContainerServiceSshPublicKey"], **kwargs): """ - :keyword public_keys: Required. The list of SSH public keys used to authenticate with - Linux-based VMs. A maximum of 1 key may be specified. + :keyword public_keys: The list of SSH public keys used to authenticate with Linux-based VMs. A + maximum of 1 key may be specified. Required. :paramtype public_keys: list[~azure.mgmt.containerservice.v2021_05_01.models.ContainerServiceSshPublicKey] """ - super(ContainerServiceSshConfiguration, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_keys = public_keys -class ContainerServiceSshPublicKey(msrest.serialization.Model): +class ContainerServiceSshPublicKey(_serialization.Model): """Contains information about SSH certificate public key data. All required parameters must be populated in order to send to Azure. - :ivar key_data: Required. Certificate public key used to authenticate with VMs through SSH. The - certificate must be in PEM format with or without headers. + :ivar key_data: Certificate public key used to authenticate with VMs through SSH. The + certificate must be in PEM format with or without headers. Required. :vartype key_data: str """ _validation = { - 'key_data': {'required': True}, + "key_data": {"required": True}, } _attribute_map = { - 'key_data': {'key': 'keyData', 'type': 'str'}, + "key_data": {"key": "keyData", "type": "str"}, } - def __init__( - self, - *, - key_data: str, - **kwargs - ): + def __init__(self, *, key_data: str, **kwargs): """ - :keyword key_data: Required. Certificate public key used to authenticate with VMs through SSH. - The certificate must be in PEM format with or without headers. + :keyword key_data: Certificate public key used to authenticate with VMs through SSH. The + certificate must be in PEM format with or without headers. Required. :paramtype key_data: str """ - super(ContainerServiceSshPublicKey, self).__init__(**kwargs) + super().__init__(**kwargs) self.key_data = key_data -class ContainerServiceVMDiagnostics(msrest.serialization.Model): +class ContainerServiceVMDiagnostics(_serialization.Model): """Profile for diagnostics on the container service VMs. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar enabled: Required. Whether the VM diagnostic agent is provisioned on the VM. + :ivar enabled: Whether the VM diagnostic agent is provisioned on the VM. Required. :vartype enabled: bool :ivar storage_uri: The URI of the storage account where diagnostics are stored. :vartype storage_uri: str """ _validation = { - 'enabled': {'required': True}, - 'storage_uri': {'readonly': True}, + "enabled": {"required": True}, + "storage_uri": {"readonly": True}, } _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'storage_uri': {'key': 'storageUri', 'type': 'str'}, + "enabled": {"key": "enabled", "type": "bool"}, + "storage_uri": {"key": "storageUri", "type": "str"}, } - def __init__( - self, - *, - enabled: bool, - **kwargs - ): + def __init__(self, *, enabled: bool, **kwargs): """ - :keyword enabled: Required. Whether the VM diagnostic agent is provisioned on the VM. + :keyword enabled: Whether the VM diagnostic agent is provisioned on the VM. Required. :paramtype enabled: bool """ - super(ContainerServiceVMDiagnostics, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.storage_uri = None -class CredentialResult(msrest.serialization.Model): +class CredentialResult(_serialization.Model): """The credential result response. Variables are only populated by the server, and will be ignored when sending a request. @@ -1609,31 +1584,27 @@ class CredentialResult(msrest.serialization.Model): :ivar name: The name of the credential. :vartype name: str :ivar value: Base64-encoded Kubernetes configuration file. - :vartype value: bytearray + :vartype value: bytes """ _validation = { - 'name': {'readonly': True}, - 'value': {'readonly': True}, + "name": {"readonly": True}, + "value": {"readonly": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'bytearray'}, + "name": {"key": "name", "type": "str"}, + "value": {"key": "value", "type": "bytearray"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(CredentialResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.name = None self.value = None -class CredentialResults(msrest.serialization.Model): +class CredentialResults(_serialization.Model): """The list credential result response. Variables are only populated by the server, and will be ignored when sending a request. @@ -1643,24 +1614,20 @@ class CredentialResults(msrest.serialization.Model): """ _validation = { - 'kubeconfigs': {'readonly': True}, + "kubeconfigs": {"readonly": True}, } _attribute_map = { - 'kubeconfigs': {'key': 'kubeconfigs', 'type': '[CredentialResult]'}, + "kubeconfigs": {"key": "kubeconfigs", "type": "[CredentialResult]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(CredentialResults, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.kubeconfigs = None -class EndpointDependency(msrest.serialization.Model): +class EndpointDependency(_serialization.Model): """A domain name that AKS agent nodes are reaching at. :ivar domain_name: The domain name of the dependency. @@ -1670,8 +1637,8 @@ class EndpointDependency(msrest.serialization.Model): """ _attribute_map = { - 'domain_name': {'key': 'domainName', 'type': 'str'}, - 'endpoint_details': {'key': 'endpointDetails', 'type': '[EndpointDetail]'}, + "domain_name": {"key": "domainName", "type": "str"}, + "endpoint_details": {"key": "endpointDetails", "type": "[EndpointDetail]"}, } def __init__( @@ -1688,12 +1655,12 @@ def __init__( :paramtype endpoint_details: list[~azure.mgmt.containerservice.v2021_05_01.models.EndpointDetail] """ - super(EndpointDependency, self).__init__(**kwargs) + super().__init__(**kwargs) self.domain_name = domain_name self.endpoint_details = endpoint_details -class EndpointDetail(msrest.serialization.Model): +class EndpointDetail(_serialization.Model): """connect information from the AKS agent nodes to a single endpoint. :ivar ip_address: An IP Address that Domain Name currently resolves to. @@ -1707,10 +1674,10 @@ class EndpointDetail(msrest.serialization.Model): """ _attribute_map = { - 'ip_address': {'key': 'ipAddress', 'type': 'str'}, - 'port': {'key': 'port', 'type': 'int'}, - 'protocol': {'key': 'protocol', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, + "ip_address": {"key": "ipAddress", "type": "str"}, + "port": {"key": "port", "type": "int"}, + "protocol": {"key": "protocol", "type": "str"}, + "description": {"key": "description", "type": "str"}, } def __init__( @@ -1732,25 +1699,25 @@ def __init__( :keyword description: Description of the detail. :paramtype description: str """ - super(EndpointDetail, self).__init__(**kwargs) + super().__init__(**kwargs) self.ip_address = ip_address self.port = port self.protocol = protocol self.description = description -class ExtendedLocation(msrest.serialization.Model): +class ExtendedLocation(_serialization.Model): """The complex type of the extended location. :ivar name: The name of the extended location. :vartype name: str - :ivar type: The type of the extended location. Known values are: "EdgeZone". + :ivar type: The type of the extended location. "EdgeZone" :vartype type: str or ~azure.mgmt.containerservice.v2021_05_01.models.ExtendedLocationTypes """ _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, } def __init__( @@ -1763,15 +1730,15 @@ def __init__( """ :keyword name: The name of the extended location. :paramtype name: str - :keyword type: The type of the extended location. Known values are: "EdgeZone". + :keyword type: The type of the extended location. "EdgeZone" :paramtype type: str or ~azure.mgmt.containerservice.v2021_05_01.models.ExtendedLocationTypes """ - super(ExtendedLocation, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.type = type -class KubeletConfig(msrest.serialization.Model): +class KubeletConfig(_serialization.Model): # pylint: disable=too-many-instance-attributes """See `AKS custom node configuration `_ for more details. :ivar cpu_manager_policy: The default is 'none'. See `Kubernetes CPU management policies @@ -1811,21 +1778,21 @@ class KubeletConfig(msrest.serialization.Model): """ _validation = { - 'container_log_max_files': {'minimum': 2}, + "container_log_max_files": {"minimum": 2}, } _attribute_map = { - 'cpu_manager_policy': {'key': 'cpuManagerPolicy', 'type': 'str'}, - 'cpu_cfs_quota': {'key': 'cpuCfsQuota', 'type': 'bool'}, - 'cpu_cfs_quota_period': {'key': 'cpuCfsQuotaPeriod', 'type': 'str'}, - 'image_gc_high_threshold': {'key': 'imageGcHighThreshold', 'type': 'int'}, - 'image_gc_low_threshold': {'key': 'imageGcLowThreshold', 'type': 'int'}, - 'topology_manager_policy': {'key': 'topologyManagerPolicy', 'type': 'str'}, - 'allowed_unsafe_sysctls': {'key': 'allowedUnsafeSysctls', 'type': '[str]'}, - 'fail_swap_on': {'key': 'failSwapOn', 'type': 'bool'}, - 'container_log_max_size_mb': {'key': 'containerLogMaxSizeMB', 'type': 'int'}, - 'container_log_max_files': {'key': 'containerLogMaxFiles', 'type': 'int'}, - 'pod_max_pids': {'key': 'podMaxPids', 'type': 'int'}, + "cpu_manager_policy": {"key": "cpuManagerPolicy", "type": "str"}, + "cpu_cfs_quota": {"key": "cpuCfsQuota", "type": "bool"}, + "cpu_cfs_quota_period": {"key": "cpuCfsQuotaPeriod", "type": "str"}, + "image_gc_high_threshold": {"key": "imageGcHighThreshold", "type": "int"}, + "image_gc_low_threshold": {"key": "imageGcLowThreshold", "type": "int"}, + "topology_manager_policy": {"key": "topologyManagerPolicy", "type": "str"}, + "allowed_unsafe_sysctls": {"key": "allowedUnsafeSysctls", "type": "[str]"}, + "fail_swap_on": {"key": "failSwapOn", "type": "bool"}, + "container_log_max_size_mb": {"key": "containerLogMaxSizeMB", "type": "int"}, + "container_log_max_files": {"key": "containerLogMaxFiles", "type": "int"}, + "pod_max_pids": {"key": "podMaxPids", "type": "int"}, } def __init__( @@ -1880,7 +1847,7 @@ def __init__( :keyword pod_max_pids: The maximum number of processes per pod. :paramtype pod_max_pids: int """ - super(KubeletConfig, self).__init__(**kwargs) + super().__init__(**kwargs) self.cpu_manager_policy = cpu_manager_policy self.cpu_cfs_quota = cpu_cfs_quota self.cpu_cfs_quota_period = cpu_cfs_quota_period @@ -1894,7 +1861,7 @@ def __init__( self.pod_max_pids = pod_max_pids -class LinuxOSConfig(msrest.serialization.Model): +class LinuxOSConfig(_serialization.Model): """See `AKS custom node configuration `_ for more details. :ivar sysctls: Sysctl settings for Linux agent nodes. @@ -1913,10 +1880,10 @@ class LinuxOSConfig(msrest.serialization.Model): """ _attribute_map = { - 'sysctls': {'key': 'sysctls', 'type': 'SysctlConfig'}, - 'transparent_huge_page_enabled': {'key': 'transparentHugePageEnabled', 'type': 'str'}, - 'transparent_huge_page_defrag': {'key': 'transparentHugePageDefrag', 'type': 'str'}, - 'swap_file_size_mb': {'key': 'swapFileSizeMB', 'type': 'int'}, + "sysctls": {"key": "sysctls", "type": "SysctlConfig"}, + "transparent_huge_page_enabled": {"key": "transparentHugePageEnabled", "type": "str"}, + "transparent_huge_page_defrag": {"key": "transparentHugePageDefrag", "type": "str"}, + "swap_file_size_mb": {"key": "swapFileSizeMB", "type": "int"}, } def __init__( @@ -1943,7 +1910,7 @@ def __init__( :keyword swap_file_size_mb: The size in MB of a swap file that will be created on each node. :paramtype swap_file_size_mb: int """ - super(LinuxOSConfig, self).__init__(**kwargs) + super().__init__(**kwargs) self.sysctls = sysctls self.transparent_huge_page_enabled = transparent_huge_page_enabled self.transparent_huge_page_defrag = transparent_huge_page_defrag @@ -1972,19 +1939,19 @@ class MaintenanceConfiguration(SubResource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, + "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'}, - 'time_in_week': {'key': 'properties.timeInWeek', 'type': '[TimeInWeek]'}, - 'not_allowed_time': {'key': 'properties.notAllowedTime', 'type': '[TimeSpan]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "time_in_week": {"key": "properties.timeInWeek", "type": "[TimeInWeek]"}, + "not_allowed_time": {"key": "properties.notAllowedTime", "type": "[TimeSpan]"}, } def __init__( @@ -2001,13 +1968,13 @@ def __init__( :keyword not_allowed_time: Time slots on which upgrade is not allowed. :paramtype not_allowed_time: list[~azure.mgmt.containerservice.v2021_05_01.models.TimeSpan] """ - super(MaintenanceConfiguration, self).__init__(**kwargs) + super().__init__(**kwargs) self.system_data = None self.time_in_week = time_in_week self.not_allowed_time = not_allowed_time -class MaintenanceConfigurationListResult(msrest.serialization.Model): +class MaintenanceConfigurationListResult(_serialization.Model): """The response from the List maintenance configurations operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -2019,31 +1986,26 @@ class MaintenanceConfigurationListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[MaintenanceConfiguration]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[MaintenanceConfiguration]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.MaintenanceConfiguration"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.MaintenanceConfiguration"]] = None, **kwargs): """ :keyword value: The list of maintenance configurations. :paramtype value: list[~azure.mgmt.containerservice.v2021_05_01.models.MaintenanceConfiguration] """ - super(MaintenanceConfigurationListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class Resource(msrest.serialization.Model): +class Resource(_serialization.Model): """The Resource model definition. Variables are only populated by the server, and will be ignored when sending a request. @@ -2056,41 +2018,35 @@ class Resource(msrest.serialization.Model): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] """ - super(Resource, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -2098,7 +2054,9 @@ def __init__( self.tags = tags -class ManagedCluster(Resource, Components1Q1Og48SchemasManagedclusterAllof1): +class ManagedCluster( + Resource, Components1Q1Og48SchemasManagedclusterAllof1 +): # pylint: disable=too-many-instance-attributes """Managed cluster. Variables are only populated by the server, and will be ignored when sending a request. @@ -2197,9 +2155,9 @@ class ManagedCluster(Resource, Components1Q1Og48SchemasManagedclusterAllof1): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar sku: The managed cluster SKU. :vartype sku: ~azure.mgmt.containerservice.v2021_05_01.models.ManagedClusterSKU @@ -2208,58 +2166,70 @@ class ManagedCluster(Resource, Components1Q1Og48SchemasManagedclusterAllof1): """ _validation = { - 'provisioning_state': {'readonly': True}, - 'power_state': {'readonly': True}, - 'max_agent_pools': {'readonly': True}, - 'fqdn': {'readonly': True}, - 'private_fqdn': {'readonly': True}, - 'azure_portal_fqdn': {'readonly': True}, - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, + "provisioning_state": {"readonly": True}, + "power_state": {"readonly": True}, + "max_agent_pools": {"readonly": True}, + "fqdn": {"readonly": True}, + "private_fqdn": {"readonly": True}, + "azure_portal_fqdn": {"readonly": True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { - 'identity': {'key': 'identity', 'type': 'ManagedClusterIdentity'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'power_state': {'key': 'properties.powerState', 'type': 'PowerState'}, - 'max_agent_pools': {'key': 'properties.maxAgentPools', 'type': 'int'}, - 'kubernetes_version': {'key': 'properties.kubernetesVersion', 'type': 'str'}, - 'dns_prefix': {'key': 'properties.dnsPrefix', 'type': 'str'}, - 'fqdn_subdomain': {'key': 'properties.fqdnSubdomain', 'type': 'str'}, - 'fqdn': {'key': 'properties.fqdn', 'type': 'str'}, - 'private_fqdn': {'key': 'properties.privateFQDN', 'type': 'str'}, - 'azure_portal_fqdn': {'key': 'properties.azurePortalFQDN', 'type': 'str'}, - 'agent_pool_profiles': {'key': 'properties.agentPoolProfiles', 'type': '[ManagedClusterAgentPoolProfile]'}, - 'linux_profile': {'key': 'properties.linuxProfile', 'type': 'ContainerServiceLinuxProfile'}, - 'windows_profile': {'key': 'properties.windowsProfile', 'type': 'ManagedClusterWindowsProfile'}, - 'service_principal_profile': {'key': 'properties.servicePrincipalProfile', 'type': 'ManagedClusterServicePrincipalProfile'}, - 'addon_profiles': {'key': 'properties.addonProfiles', 'type': '{ManagedClusterAddonProfile}'}, - 'pod_identity_profile': {'key': 'properties.podIdentityProfile', 'type': 'ManagedClusterPodIdentityProfile'}, - 'node_resource_group': {'key': 'properties.nodeResourceGroup', 'type': 'str'}, - 'enable_rbac': {'key': 'properties.enableRBAC', 'type': 'bool'}, - 'enable_pod_security_policy': {'key': 'properties.enablePodSecurityPolicy', 'type': 'bool'}, - 'network_profile': {'key': 'properties.networkProfile', 'type': 'ContainerServiceNetworkProfile'}, - 'aad_profile': {'key': 'properties.aadProfile', 'type': 'ManagedClusterAADProfile'}, - 'auto_upgrade_profile': {'key': 'properties.autoUpgradeProfile', 'type': 'ManagedClusterAutoUpgradeProfile'}, - 'auto_scaler_profile': {'key': 'properties.autoScalerProfile', 'type': 'ManagedClusterPropertiesAutoScalerProfile'}, - 'api_server_access_profile': {'key': 'properties.apiServerAccessProfile', 'type': 'ManagedClusterAPIServerAccessProfile'}, - 'disk_encryption_set_id': {'key': 'properties.diskEncryptionSetID', 'type': 'str'}, - 'identity_profile': {'key': 'properties.identityProfile', 'type': '{ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties}'}, - 'private_link_resources': {'key': 'properties.privateLinkResources', 'type': '[PrivateLinkResource]'}, - 'disable_local_accounts': {'key': 'properties.disableLocalAccounts', 'type': 'bool'}, - 'http_proxy_config': {'key': 'properties.httpProxyConfig', 'type': 'ManagedClusterHTTPProxyConfig'}, - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'ManagedClusterSKU'}, - 'extended_location': {'key': 'extendedLocation', 'type': 'ExtendedLocation'}, + "identity": {"key": "identity", "type": "ManagedClusterIdentity"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "power_state": {"key": "properties.powerState", "type": "PowerState"}, + "max_agent_pools": {"key": "properties.maxAgentPools", "type": "int"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "dns_prefix": {"key": "properties.dnsPrefix", "type": "str"}, + "fqdn_subdomain": {"key": "properties.fqdnSubdomain", "type": "str"}, + "fqdn": {"key": "properties.fqdn", "type": "str"}, + "private_fqdn": {"key": "properties.privateFQDN", "type": "str"}, + "azure_portal_fqdn": {"key": "properties.azurePortalFQDN", "type": "str"}, + "agent_pool_profiles": {"key": "properties.agentPoolProfiles", "type": "[ManagedClusterAgentPoolProfile]"}, + "linux_profile": {"key": "properties.linuxProfile", "type": "ContainerServiceLinuxProfile"}, + "windows_profile": {"key": "properties.windowsProfile", "type": "ManagedClusterWindowsProfile"}, + "service_principal_profile": { + "key": "properties.servicePrincipalProfile", + "type": "ManagedClusterServicePrincipalProfile", + }, + "addon_profiles": {"key": "properties.addonProfiles", "type": "{ManagedClusterAddonProfile}"}, + "pod_identity_profile": {"key": "properties.podIdentityProfile", "type": "ManagedClusterPodIdentityProfile"}, + "node_resource_group": {"key": "properties.nodeResourceGroup", "type": "str"}, + "enable_rbac": {"key": "properties.enableRBAC", "type": "bool"}, + "enable_pod_security_policy": {"key": "properties.enablePodSecurityPolicy", "type": "bool"}, + "network_profile": {"key": "properties.networkProfile", "type": "ContainerServiceNetworkProfile"}, + "aad_profile": {"key": "properties.aadProfile", "type": "ManagedClusterAADProfile"}, + "auto_upgrade_profile": {"key": "properties.autoUpgradeProfile", "type": "ManagedClusterAutoUpgradeProfile"}, + "auto_scaler_profile": { + "key": "properties.autoScalerProfile", + "type": "ManagedClusterPropertiesAutoScalerProfile", + }, + "api_server_access_profile": { + "key": "properties.apiServerAccessProfile", + "type": "ManagedClusterAPIServerAccessProfile", + }, + "disk_encryption_set_id": {"key": "properties.diskEncryptionSetID", "type": "str"}, + "identity_profile": { + "key": "properties.identityProfile", + "type": "{ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties}", + }, + "private_link_resources": {"key": "properties.privateLinkResources", "type": "[PrivateLinkResource]"}, + "disable_local_accounts": {"key": "properties.disableLocalAccounts", "type": "bool"}, + "http_proxy_config": {"key": "properties.httpProxyConfig", "type": "ManagedClusterHTTPProxyConfig"}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "sku": {"key": "sku", "type": "ManagedClusterSKU"}, + "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, } - def __init__( + def __init__( # pylint: disable=too-many-locals self, *, location: str, @@ -2282,7 +2252,12 @@ def __init__( auto_scaler_profile: Optional["_models.ManagedClusterPropertiesAutoScalerProfile"] = None, api_server_access_profile: Optional["_models.ManagedClusterAPIServerAccessProfile"] = None, disk_encryption_set_id: Optional[str] = None, - identity_profile: Optional[Dict[str, "_models.ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties"]] = None, + identity_profile: Optional[ + Dict[ + str, + "_models.ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties", + ] + ] = None, private_link_resources: Optional[List["_models.PrivateLinkResource"]] = None, disable_local_accounts: Optional[bool] = None, http_proxy_config: Optional["_models.ManagedClusterHTTPProxyConfig"] = None, @@ -2366,16 +2341,43 @@ def __init__( servers. :paramtype http_proxy_config: ~azure.mgmt.containerservice.v2021_05_01.models.ManagedClusterHTTPProxyConfig - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword sku: The managed cluster SKU. :paramtype sku: ~azure.mgmt.containerservice.v2021_05_01.models.ManagedClusterSKU :keyword extended_location: The extended location of the Virtual Machine. :paramtype extended_location: ~azure.mgmt.containerservice.v2021_05_01.models.ExtendedLocation """ - super(ManagedCluster, self).__init__(location=location, tags=tags, identity=identity, kubernetes_version=kubernetes_version, dns_prefix=dns_prefix, fqdn_subdomain=fqdn_subdomain, agent_pool_profiles=agent_pool_profiles, linux_profile=linux_profile, windows_profile=windows_profile, service_principal_profile=service_principal_profile, addon_profiles=addon_profiles, pod_identity_profile=pod_identity_profile, node_resource_group=node_resource_group, enable_rbac=enable_rbac, enable_pod_security_policy=enable_pod_security_policy, network_profile=network_profile, aad_profile=aad_profile, auto_upgrade_profile=auto_upgrade_profile, auto_scaler_profile=auto_scaler_profile, api_server_access_profile=api_server_access_profile, disk_encryption_set_id=disk_encryption_set_id, identity_profile=identity_profile, private_link_resources=private_link_resources, disable_local_accounts=disable_local_accounts, http_proxy_config=http_proxy_config, **kwargs) + super().__init__( + location=location, + tags=tags, + identity=identity, + kubernetes_version=kubernetes_version, + dns_prefix=dns_prefix, + fqdn_subdomain=fqdn_subdomain, + agent_pool_profiles=agent_pool_profiles, + linux_profile=linux_profile, + windows_profile=windows_profile, + service_principal_profile=service_principal_profile, + addon_profiles=addon_profiles, + pod_identity_profile=pod_identity_profile, + node_resource_group=node_resource_group, + enable_rbac=enable_rbac, + enable_pod_security_policy=enable_pod_security_policy, + network_profile=network_profile, + aad_profile=aad_profile, + auto_upgrade_profile=auto_upgrade_profile, + auto_scaler_profile=auto_scaler_profile, + api_server_access_profile=api_server_access_profile, + disk_encryption_set_id=disk_encryption_set_id, + identity_profile=identity_profile, + private_link_resources=private_link_resources, + disable_local_accounts=disable_local_accounts, + http_proxy_config=http_proxy_config, + **kwargs + ) self.identity = identity self.provisioning_state = None self.power_state = None @@ -2414,7 +2416,7 @@ def __init__( self.tags = tags -class ManagedClusterAADProfile(msrest.serialization.Model): +class ManagedClusterAADProfile(_serialization.Model): """For more details see `managed AAD on AKS `_. :ivar managed: Whether to enable managed AAD. @@ -2436,13 +2438,13 @@ class ManagedClusterAADProfile(msrest.serialization.Model): """ _attribute_map = { - 'managed': {'key': 'managed', 'type': 'bool'}, - 'enable_azure_rbac': {'key': 'enableAzureRBAC', 'type': 'bool'}, - 'admin_group_object_i_ds': {'key': 'adminGroupObjectIDs', 'type': '[str]'}, - 'client_app_id': {'key': 'clientAppID', 'type': 'str'}, - 'server_app_id': {'key': 'serverAppID', 'type': 'str'}, - 'server_app_secret': {'key': 'serverAppSecret', 'type': 'str'}, - 'tenant_id': {'key': 'tenantID', 'type': 'str'}, + "managed": {"key": "managed", "type": "bool"}, + "enable_azure_rbac": {"key": "enableAzureRBAC", "type": "bool"}, + "admin_group_object_i_ds": {"key": "adminGroupObjectIDs", "type": "[str]"}, + "client_app_id": {"key": "clientAppID", "type": "str"}, + "server_app_id": {"key": "serverAppID", "type": "str"}, + "server_app_secret": {"key": "serverAppSecret", "type": "str"}, + "tenant_id": {"key": "tenantID", "type": "str"}, } def __init__( @@ -2475,7 +2477,7 @@ def __init__( tenant of the deployment subscription. :paramtype tenant_id: str """ - super(ManagedClusterAADProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.managed = managed self.enable_azure_rbac = enable_azure_rbac self.admin_group_object_i_ds = admin_group_object_i_ds @@ -2498,58 +2500,53 @@ class ManagedClusterAccessProfile(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar kube_config: Base64-encoded Kubernetes configuration file. - :vartype kube_config: bytearray + :vartype kube_config: bytes """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'kube_config': {'key': 'properties.kubeConfig', 'type': 'bytearray'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "kube_config": {"key": "properties.kubeConfig", "type": "bytearray"}, } def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - kube_config: Optional[bytearray] = None, - **kwargs + self, *, location: str, tags: Optional[Dict[str, str]] = None, kube_config: Optional[bytes] = None, **kwargs ): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword kube_config: Base64-encoded Kubernetes configuration file. - :paramtype kube_config: bytearray + :paramtype kube_config: bytes """ - super(ManagedClusterAccessProfile, self).__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.kube_config = kube_config -class ManagedClusterAddonProfile(msrest.serialization.Model): +class ManagedClusterAddonProfile(_serialization.Model): """A Kubernetes add-on profile for a managed cluster. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar enabled: Required. Whether the add-on is enabled or not. + :ivar enabled: Whether the add-on is enabled or not. Required. :vartype enabled: bool :ivar config: Key-value pairs for configuring an add-on. :vartype config: dict[str, str] @@ -2559,30 +2556,24 @@ class ManagedClusterAddonProfile(msrest.serialization.Model): """ _validation = { - 'enabled': {'required': True}, - 'identity': {'readonly': True}, + "enabled": {"required": True}, + "identity": {"readonly": True}, } _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'config': {'key': 'config', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'ManagedClusterAddonProfileIdentity'}, + "enabled": {"key": "enabled", "type": "bool"}, + "config": {"key": "config", "type": "{str}"}, + "identity": {"key": "identity", "type": "ManagedClusterAddonProfileIdentity"}, } - def __init__( - self, - *, - enabled: bool, - config: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, enabled: bool, config: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword enabled: Required. Whether the add-on is enabled or not. + :keyword enabled: Whether the add-on is enabled or not. Required. :paramtype enabled: bool :keyword config: Key-value pairs for configuring an add-on. :paramtype config: dict[str, str] """ - super(ManagedClusterAddonProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.config = config self.identity = None @@ -2600,9 +2591,9 @@ class ManagedClusterAddonProfileIdentity(UserAssignedIdentity): """ _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'object_id': {'key': 'objectId', 'type': 'str'}, + "resource_id": {"key": "resourceId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + "object_id": {"key": "objectId", "type": "str"}, } def __init__( @@ -2621,10 +2612,10 @@ def __init__( :keyword object_id: The object ID of the user assigned identity. :paramtype object_id: str """ - super(ManagedClusterAddonProfileIdentity, self).__init__(resource_id=resource_id, client_id=client_id, object_id=object_id, **kwargs) + super().__init__(resource_id=resource_id, client_id=client_id, object_id=object_id, **kwargs) -class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): +class ManagedClusterAgentPoolProfileProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes """Properties for the container service agent pool profile. Variables are only populated by the server, and will be ignored when sending a request. @@ -2645,10 +2636,10 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2021_05_01.models.OSDiskType :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data - root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2021_05_01.models.KubeletDiskType :ivar vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and used. @@ -2662,11 +2653,11 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :vartype pod_subnet_id: str :ivar max_pods: The maximum number of pods that can run on a node. :vartype max_pods: int - :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2021_05_01.models.OSType :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known - values are: "Ubuntu", "CBLMariner". + values are: "Ubuntu" and "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2021_05_01.models.OSSKU :ivar max_count: The maximum number of nodes for auto-scaling. :vartype max_count: int @@ -2674,12 +2665,12 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :vartype min_count: int :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool - :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", + :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets" and "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2021_05_01.models.AgentPoolType :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :vartype mode: str or ~azure.mgmt.containerservice.v2021_05_01.models.AgentPoolMode :ivar orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -2711,20 +2702,18 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default - is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + is 'Regular'. Known values are: "Spot" and "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2021_05_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2021_05_01.models.ScaleSetEvictionPolicy :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :vartype spot_max_price: float - :ivar tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :ivar tags: The tags to be persisted on the agent pool virtual machine scale set. :vartype tags: dict[str, str] :ivar node_labels: The node labels to be persisted across all nodes in agent pool. :vartype node_labels: dict[str, str] @@ -2748,58 +2737,58 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): for more details. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2021_05_01.models.GPUInstanceProfile """ _validation = { - 'os_disk_size_gb': {'maximum': 2048, 'minimum': 0}, - 'node_image_version': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'power_state': {'readonly': True}, + "os_disk_size_gb": {"maximum": 2048, "minimum": 0}, + "node_image_version": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "power_state": {"readonly": True}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'os_disk_type': {'key': 'osDiskType', 'type': 'str'}, - 'kubelet_disk_type': {'key': 'kubeletDiskType', 'type': 'str'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'pod_subnet_id': {'key': 'podSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'maxPods', 'type': 'int'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'os_sku': {'key': 'osSKU', 'type': 'str'}, - 'max_count': {'key': 'maxCount', 'type': 'int'}, - 'min_count': {'key': 'minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'enableAutoScaling', 'type': 'bool'}, - 'type': {'key': 'type', 'type': 'str'}, - 'mode': {'key': 'mode', 'type': 'str'}, - 'orchestrator_version': {'key': 'orchestratorVersion', 'type': 'str'}, - 'node_image_version': {'key': 'nodeImageVersion', 'type': 'str'}, - 'upgrade_settings': {'key': 'upgradeSettings', 'type': 'AgentPoolUpgradeSettings'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'power_state': {'key': 'powerState', 'type': 'PowerState'}, - 'availability_zones': {'key': 'availabilityZones', 'type': '[str]'}, - 'enable_node_public_ip': {'key': 'enableNodePublicIP', 'type': 'bool'}, - 'node_public_ip_prefix_id': {'key': 'nodePublicIPPrefixID', 'type': 'str'}, - 'scale_set_priority': {'key': 'scaleSetPriority', 'type': 'str'}, - 'scale_set_eviction_policy': {'key': 'scaleSetEvictionPolicy', 'type': 'str'}, - 'spot_max_price': {'key': 'spotMaxPrice', 'type': 'float'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'node_labels': {'key': 'nodeLabels', 'type': '{str}'}, - 'node_taints': {'key': 'nodeTaints', 'type': '[str]'}, - 'proximity_placement_group_id': {'key': 'proximityPlacementGroupID', 'type': 'str'}, - 'kubelet_config': {'key': 'kubeletConfig', 'type': 'KubeletConfig'}, - 'linux_os_config': {'key': 'linuxOSConfig', 'type': 'LinuxOSConfig'}, - 'enable_encryption_at_host': {'key': 'enableEncryptionAtHost', 'type': 'bool'}, - 'enable_ultra_ssd': {'key': 'enableUltraSSD', 'type': 'bool'}, - 'enable_fips': {'key': 'enableFIPS', 'type': 'bool'}, - 'gpu_instance_profile': {'key': 'gpuInstanceProfile', 'type': 'str'}, + "count": {"key": "count", "type": "int"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "os_disk_type": {"key": "osDiskType", "type": "str"}, + "kubelet_disk_type": {"key": "kubeletDiskType", "type": "str"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "pod_subnet_id": {"key": "podSubnetID", "type": "str"}, + "max_pods": {"key": "maxPods", "type": "int"}, + "os_type": {"key": "osType", "type": "str"}, + "os_sku": {"key": "osSKU", "type": "str"}, + "max_count": {"key": "maxCount", "type": "int"}, + "min_count": {"key": "minCount", "type": "int"}, + "enable_auto_scaling": {"key": "enableAutoScaling", "type": "bool"}, + "type": {"key": "type", "type": "str"}, + "mode": {"key": "mode", "type": "str"}, + "orchestrator_version": {"key": "orchestratorVersion", "type": "str"}, + "node_image_version": {"key": "nodeImageVersion", "type": "str"}, + "upgrade_settings": {"key": "upgradeSettings", "type": "AgentPoolUpgradeSettings"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "power_state": {"key": "powerState", "type": "PowerState"}, + "availability_zones": {"key": "availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "enableNodePublicIP", "type": "bool"}, + "node_public_ip_prefix_id": {"key": "nodePublicIPPrefixID", "type": "str"}, + "scale_set_priority": {"key": "scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "scaleSetEvictionPolicy", "type": "str"}, + "spot_max_price": {"key": "spotMaxPrice", "type": "float"}, + "tags": {"key": "tags", "type": "{str}"}, + "node_labels": {"key": "nodeLabels", "type": "{str}"}, + "node_taints": {"key": "nodeTaints", "type": "[str]"}, + "proximity_placement_group_id": {"key": "proximityPlacementGroupID", "type": "str"}, + "kubelet_config": {"key": "kubeletConfig", "type": "KubeletConfig"}, + "linux_os_config": {"key": "linuxOSConfig", "type": "LinuxOSConfig"}, + "enable_encryption_at_host": {"key": "enableEncryptionAtHost", "type": "bool"}, + "enable_ultra_ssd": {"key": "enableUltraSSD", "type": "bool"}, + "enable_fips": {"key": "enableFIPS", "type": "bool"}, + "gpu_instance_profile": {"key": "gpuInstanceProfile", "type": "str"}, } - def __init__( + def __init__( # pylint: disable=too-many-locals self, *, count: Optional[int] = None, @@ -2810,7 +2799,7 @@ def __init__( vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, @@ -2822,9 +2811,9 @@ def __init__( availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", - spot_max_price: Optional[float] = -1, + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", + spot_max_price: float = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, @@ -2854,10 +2843,10 @@ def __init__( larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2021_05_01.models.OSDiskType :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime - data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + data root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2021_05_01.models.KubeletDiskType :keyword vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and @@ -2871,11 +2860,11 @@ def __init__( :paramtype pod_subnet_id: str :keyword max_pods: The maximum number of pods that can run on a node. :paramtype max_pods: int - :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2021_05_01.models.OSType :keyword os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Known values are: "Ubuntu", "CBLMariner". + Known values are: "Ubuntu" and "CBLMariner". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2021_05_01.models.OSSKU :keyword max_count: The maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -2883,12 +2872,12 @@ def __init__( :paramtype min_count: int :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool - :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", + :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2021_05_01.models.AgentPoolType :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2021_05_01.models.AgentPoolMode :keyword orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -2914,20 +2903,18 @@ def __init__( /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the - default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + default is 'Regular'. Known values are: "Spot" and "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2021_05_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2021_05_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :paramtype spot_max_price: float - :keyword tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :keyword tags: The tags to be persisted on the agent pool virtual machine scale set. :paramtype tags: dict[str, str] :keyword node_labels: The node labels to be persisted across all nodes in agent pool. :paramtype node_labels: dict[str, str] @@ -2951,12 +2938,12 @@ def __init__( for more details. :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance - profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2021_05_01.models.GPUInstanceProfile """ - super(ManagedClusterAgentPoolProfileProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.vm_size = vm_size self.os_disk_size_gb = os_disk_size_gb @@ -2995,7 +2982,9 @@ def __init__( self.gpu_instance_profile = gpu_instance_profile -class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): +class ManagedClusterAgentPoolProfile( + ManagedClusterAgentPoolProfileProperties +): # pylint: disable=too-many-instance-attributes """Profile for the container service agent pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -3018,10 +3007,10 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2021_05_01.models.OSDiskType :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data - root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2021_05_01.models.KubeletDiskType :ivar vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and used. @@ -3035,11 +3024,11 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :vartype pod_subnet_id: str :ivar max_pods: The maximum number of pods that can run on a node. :vartype max_pods: int - :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2021_05_01.models.OSType :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known - values are: "Ubuntu", "CBLMariner". + values are: "Ubuntu" and "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2021_05_01.models.OSSKU :ivar max_count: The maximum number of nodes for auto-scaling. :vartype max_count: int @@ -3047,12 +3036,12 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :vartype min_count: int :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool - :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", + :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets" and "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2021_05_01.models.AgentPoolType :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :vartype mode: str or ~azure.mgmt.containerservice.v2021_05_01.models.AgentPoolMode :ivar orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -3084,20 +3073,18 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default - is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + is 'Regular'. Known values are: "Spot" and "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2021_05_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2021_05_01.models.ScaleSetEvictionPolicy :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :vartype spot_max_price: float - :ivar tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :ivar tags: The tags to be persisted on the agent pool virtual machine scale set. :vartype tags: dict[str, str] :ivar node_labels: The node labels to be persisted across all nodes in agent pool. :vartype node_labels: dict[str, str] @@ -3121,62 +3108,62 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): for more details. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2021_05_01.models.GPUInstanceProfile - :ivar name: Required. Windows agent pool names must be 6 characters or less. + :ivar name: Windows agent pool names must be 6 characters or less. Required. :vartype name: str """ _validation = { - 'os_disk_size_gb': {'maximum': 2048, 'minimum': 0}, - 'node_image_version': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'power_state': {'readonly': True}, - 'name': {'required': True, 'pattern': r'^[a-z][a-z0-9]{0,11}$'}, + "os_disk_size_gb": {"maximum": 2048, "minimum": 0}, + "node_image_version": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "power_state": {"readonly": True}, + "name": {"required": True, "pattern": r"^[a-z][a-z0-9]{0,11}$"}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'os_disk_type': {'key': 'osDiskType', 'type': 'str'}, - 'kubelet_disk_type': {'key': 'kubeletDiskType', 'type': 'str'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'pod_subnet_id': {'key': 'podSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'maxPods', 'type': 'int'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'os_sku': {'key': 'osSKU', 'type': 'str'}, - 'max_count': {'key': 'maxCount', 'type': 'int'}, - 'min_count': {'key': 'minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'enableAutoScaling', 'type': 'bool'}, - 'type': {'key': 'type', 'type': 'str'}, - 'mode': {'key': 'mode', 'type': 'str'}, - 'orchestrator_version': {'key': 'orchestratorVersion', 'type': 'str'}, - 'node_image_version': {'key': 'nodeImageVersion', 'type': 'str'}, - 'upgrade_settings': {'key': 'upgradeSettings', 'type': 'AgentPoolUpgradeSettings'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'power_state': {'key': 'powerState', 'type': 'PowerState'}, - 'availability_zones': {'key': 'availabilityZones', 'type': '[str]'}, - 'enable_node_public_ip': {'key': 'enableNodePublicIP', 'type': 'bool'}, - 'node_public_ip_prefix_id': {'key': 'nodePublicIPPrefixID', 'type': 'str'}, - 'scale_set_priority': {'key': 'scaleSetPriority', 'type': 'str'}, - 'scale_set_eviction_policy': {'key': 'scaleSetEvictionPolicy', 'type': 'str'}, - 'spot_max_price': {'key': 'spotMaxPrice', 'type': 'float'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'node_labels': {'key': 'nodeLabels', 'type': '{str}'}, - 'node_taints': {'key': 'nodeTaints', 'type': '[str]'}, - 'proximity_placement_group_id': {'key': 'proximityPlacementGroupID', 'type': 'str'}, - 'kubelet_config': {'key': 'kubeletConfig', 'type': 'KubeletConfig'}, - 'linux_os_config': {'key': 'linuxOSConfig', 'type': 'LinuxOSConfig'}, - 'enable_encryption_at_host': {'key': 'enableEncryptionAtHost', 'type': 'bool'}, - 'enable_ultra_ssd': {'key': 'enableUltraSSD', 'type': 'bool'}, - 'enable_fips': {'key': 'enableFIPS', 'type': 'bool'}, - 'gpu_instance_profile': {'key': 'gpuInstanceProfile', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, + "count": {"key": "count", "type": "int"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "os_disk_type": {"key": "osDiskType", "type": "str"}, + "kubelet_disk_type": {"key": "kubeletDiskType", "type": "str"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "pod_subnet_id": {"key": "podSubnetID", "type": "str"}, + "max_pods": {"key": "maxPods", "type": "int"}, + "os_type": {"key": "osType", "type": "str"}, + "os_sku": {"key": "osSKU", "type": "str"}, + "max_count": {"key": "maxCount", "type": "int"}, + "min_count": {"key": "minCount", "type": "int"}, + "enable_auto_scaling": {"key": "enableAutoScaling", "type": "bool"}, + "type": {"key": "type", "type": "str"}, + "mode": {"key": "mode", "type": "str"}, + "orchestrator_version": {"key": "orchestratorVersion", "type": "str"}, + "node_image_version": {"key": "nodeImageVersion", "type": "str"}, + "upgrade_settings": {"key": "upgradeSettings", "type": "AgentPoolUpgradeSettings"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "power_state": {"key": "powerState", "type": "PowerState"}, + "availability_zones": {"key": "availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "enableNodePublicIP", "type": "bool"}, + "node_public_ip_prefix_id": {"key": "nodePublicIPPrefixID", "type": "str"}, + "scale_set_priority": {"key": "scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "scaleSetEvictionPolicy", "type": "str"}, + "spot_max_price": {"key": "spotMaxPrice", "type": "float"}, + "tags": {"key": "tags", "type": "{str}"}, + "node_labels": {"key": "nodeLabels", "type": "{str}"}, + "node_taints": {"key": "nodeTaints", "type": "[str]"}, + "proximity_placement_group_id": {"key": "proximityPlacementGroupID", "type": "str"}, + "kubelet_config": {"key": "kubeletConfig", "type": "KubeletConfig"}, + "linux_os_config": {"key": "linuxOSConfig", "type": "LinuxOSConfig"}, + "enable_encryption_at_host": {"key": "enableEncryptionAtHost", "type": "bool"}, + "enable_ultra_ssd": {"key": "enableUltraSSD", "type": "bool"}, + "enable_fips": {"key": "enableFIPS", "type": "bool"}, + "gpu_instance_profile": {"key": "gpuInstanceProfile", "type": "str"}, + "name": {"key": "name", "type": "str"}, } - def __init__( + def __init__( # pylint: disable=too-many-locals self, *, name: str, @@ -3188,7 +3175,7 @@ def __init__( vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, @@ -3200,9 +3187,9 @@ def __init__( availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", - spot_max_price: Optional[float] = -1, + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", + spot_max_price: float = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, @@ -3232,10 +3219,10 @@ def __init__( larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2021_05_01.models.OSDiskType :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime - data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + data root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2021_05_01.models.KubeletDiskType :keyword vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and @@ -3249,11 +3236,11 @@ def __init__( :paramtype pod_subnet_id: str :keyword max_pods: The maximum number of pods that can run on a node. :paramtype max_pods: int - :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2021_05_01.models.OSType :keyword os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Known values are: "Ubuntu", "CBLMariner". + Known values are: "Ubuntu" and "CBLMariner". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2021_05_01.models.OSSKU :keyword max_count: The maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -3261,12 +3248,12 @@ def __init__( :paramtype min_count: int :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool - :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", + :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2021_05_01.models.AgentPoolType :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2021_05_01.models.AgentPoolMode :keyword orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -3292,20 +3279,18 @@ def __init__( /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the - default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + default is 'Regular'. Known values are: "Spot" and "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2021_05_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2021_05_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :paramtype spot_max_price: float - :keyword tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :keyword tags: The tags to be persisted on the agent pool virtual machine scale set. :paramtype tags: dict[str, str] :keyword node_labels: The node labels to be persisted across all nodes in agent pool. :paramtype node_labels: dict[str, str] @@ -3329,18 +3314,53 @@ def __init__( for more details. :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance - profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2021_05_01.models.GPUInstanceProfile - :keyword name: Required. Windows agent pool names must be 6 characters or less. + :keyword name: Windows agent pool names must be 6 characters or less. Required. :paramtype name: str """ - super(ManagedClusterAgentPoolProfile, self).__init__(count=count, vm_size=vm_size, os_disk_size_gb=os_disk_size_gb, os_disk_type=os_disk_type, kubelet_disk_type=kubelet_disk_type, vnet_subnet_id=vnet_subnet_id, pod_subnet_id=pod_subnet_id, max_pods=max_pods, os_type=os_type, os_sku=os_sku, max_count=max_count, min_count=min_count, enable_auto_scaling=enable_auto_scaling, type=type, mode=mode, orchestrator_version=orchestrator_version, upgrade_settings=upgrade_settings, availability_zones=availability_zones, enable_node_public_ip=enable_node_public_ip, node_public_ip_prefix_id=node_public_ip_prefix_id, scale_set_priority=scale_set_priority, scale_set_eviction_policy=scale_set_eviction_policy, spot_max_price=spot_max_price, tags=tags, node_labels=node_labels, node_taints=node_taints, proximity_placement_group_id=proximity_placement_group_id, kubelet_config=kubelet_config, linux_os_config=linux_os_config, enable_encryption_at_host=enable_encryption_at_host, enable_ultra_ssd=enable_ultra_ssd, enable_fips=enable_fips, gpu_instance_profile=gpu_instance_profile, **kwargs) + super().__init__( + count=count, + vm_size=vm_size, + os_disk_size_gb=os_disk_size_gb, + os_disk_type=os_disk_type, + kubelet_disk_type=kubelet_disk_type, + vnet_subnet_id=vnet_subnet_id, + pod_subnet_id=pod_subnet_id, + max_pods=max_pods, + os_type=os_type, + os_sku=os_sku, + max_count=max_count, + min_count=min_count, + enable_auto_scaling=enable_auto_scaling, + type=type, + mode=mode, + orchestrator_version=orchestrator_version, + upgrade_settings=upgrade_settings, + availability_zones=availability_zones, + enable_node_public_ip=enable_node_public_ip, + node_public_ip_prefix_id=node_public_ip_prefix_id, + scale_set_priority=scale_set_priority, + scale_set_eviction_policy=scale_set_eviction_policy, + spot_max_price=spot_max_price, + tags=tags, + node_labels=node_labels, + node_taints=node_taints, + proximity_placement_group_id=proximity_placement_group_id, + kubelet_config=kubelet_config, + linux_os_config=linux_os_config, + enable_encryption_at_host=enable_encryption_at_host, + enable_ultra_ssd=enable_ultra_ssd, + enable_fips=enable_fips, + gpu_instance_profile=gpu_instance_profile, + **kwargs + ) self.name = name -class ManagedClusterAPIServerAccessProfile(msrest.serialization.Model): +class ManagedClusterAPIServerAccessProfile(_serialization.Model): """Access profile for managed cluster API server. :ivar authorized_ip_ranges: IP ranges are specified in CIDR format, e.g. 137.117.106.88/29. @@ -3361,10 +3381,10 @@ class ManagedClusterAPIServerAccessProfile(msrest.serialization.Model): """ _attribute_map = { - 'authorized_ip_ranges': {'key': 'authorizedIPRanges', 'type': '[str]'}, - 'enable_private_cluster': {'key': 'enablePrivateCluster', 'type': 'bool'}, - 'private_dns_zone': {'key': 'privateDNSZone', 'type': 'str'}, - 'enable_private_cluster_public_fqdn': {'key': 'enablePrivateClusterPublicFQDN', 'type': 'bool'}, + "authorized_ip_ranges": {"key": "authorizedIPRanges", "type": "[str]"}, + "enable_private_cluster": {"key": "enablePrivateCluster", "type": "bool"}, + "private_dns_zone": {"key": "privateDNSZone", "type": "str"}, + "enable_private_cluster_public_fqdn": {"key": "enablePrivateClusterPublicFQDN", "type": "bool"}, } def __init__( @@ -3393,44 +3413,39 @@ def __init__( private cluster or not. :paramtype enable_private_cluster_public_fqdn: bool """ - super(ManagedClusterAPIServerAccessProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.authorized_ip_ranges = authorized_ip_ranges self.enable_private_cluster = enable_private_cluster self.private_dns_zone = private_dns_zone self.enable_private_cluster_public_fqdn = enable_private_cluster_public_fqdn -class ManagedClusterAutoUpgradeProfile(msrest.serialization.Model): +class ManagedClusterAutoUpgradeProfile(_serialization.Model): """Auto upgrade profile for a managed cluster. :ivar upgrade_channel: For more information see `setting the AKS cluster auto-upgrade channel `_. Known values - are: "rapid", "stable", "patch", "node-image", "none". + are: "rapid", "stable", "patch", "node-image", and "none". :vartype upgrade_channel: str or ~azure.mgmt.containerservice.v2021_05_01.models.UpgradeChannel """ _attribute_map = { - 'upgrade_channel': {'key': 'upgradeChannel', 'type': 'str'}, + "upgrade_channel": {"key": "upgradeChannel", "type": "str"}, } - def __init__( - self, - *, - upgrade_channel: Optional[Union[str, "_models.UpgradeChannel"]] = None, - **kwargs - ): + def __init__(self, *, upgrade_channel: Optional[Union[str, "_models.UpgradeChannel"]] = None, **kwargs): """ :keyword upgrade_channel: For more information see `setting the AKS cluster auto-upgrade channel `_. - Known values are: "rapid", "stable", "patch", "node-image", "none". + Known values are: "rapid", "stable", "patch", "node-image", and "none". :paramtype upgrade_channel: str or ~azure.mgmt.containerservice.v2021_05_01.models.UpgradeChannel """ - super(ManagedClusterAutoUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.upgrade_channel = upgrade_channel -class ManagedClusterHTTPProxyConfig(msrest.serialization.Model): +class ManagedClusterHTTPProxyConfig(_serialization.Model): """Cluster HTTP proxy configuration. :ivar http_proxy: The HTTP proxy server endpoint to use. @@ -3444,10 +3459,10 @@ class ManagedClusterHTTPProxyConfig(msrest.serialization.Model): """ _attribute_map = { - 'http_proxy': {'key': 'httpProxy', 'type': 'str'}, - 'https_proxy': {'key': 'httpsProxy', 'type': 'str'}, - 'no_proxy': {'key': 'noProxy', 'type': '[str]'}, - 'trusted_ca': {'key': 'trustedCa', 'type': 'str'}, + "http_proxy": {"key": "httpProxy", "type": "str"}, + "https_proxy": {"key": "httpsProxy", "type": "str"}, + "no_proxy": {"key": "noProxy", "type": "[str]"}, + "trusted_ca": {"key": "trustedCa", "type": "str"}, } def __init__( @@ -3469,14 +3484,14 @@ def __init__( :keyword trusted_ca: Alternative CA cert to use for connecting to proxy servers. :paramtype trusted_ca: str """ - super(ManagedClusterHTTPProxyConfig, self).__init__(**kwargs) + super().__init__(**kwargs) self.http_proxy = http_proxy self.https_proxy = https_proxy self.no_proxy = no_proxy self.trusted_ca = trusted_ca -class ManagedClusterIdentity(msrest.serialization.Model): +class ManagedClusterIdentity(_serialization.Model): """Identity for the managed cluster. Variables are only populated by the server, and will be ignored when sending a request. @@ -3489,7 +3504,7 @@ class ManagedClusterIdentity(msrest.serialization.Model): :vartype tenant_id: str :ivar type: For more information see `use managed identities in AKS `_. Known values are: - "SystemAssigned", "UserAssigned", "None". + "SystemAssigned", "UserAssigned", and "None". :vartype type: str or ~azure.mgmt.containerservice.v2021_05_01.models.ResourceIdentityType :ivar user_assigned_identities: The keys must be ARM resource IDs in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. @@ -3498,42 +3513,50 @@ class ManagedClusterIdentity(msrest.serialization.Model): """ _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, + "principal_id": {"readonly": True}, + "tenant_id": {"readonly": True}, } _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{Components1Umhcm8SchemasManagedclusteridentityPropertiesUserassignedidentitiesAdditionalproperties}'}, + "principal_id": {"key": "principalId", "type": "str"}, + "tenant_id": {"key": "tenantId", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "user_assigned_identities": { + "key": "userAssignedIdentities", + "type": "{Components1Umhcm8SchemasManagedclusteridentityPropertiesUserassignedidentitiesAdditionalproperties}", + }, } def __init__( self, *, type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, - user_assigned_identities: Optional[Dict[str, "_models.Components1Umhcm8SchemasManagedclusteridentityPropertiesUserassignedidentitiesAdditionalproperties"]] = None, + user_assigned_identities: Optional[ + Dict[ + str, + "_models.Components1Umhcm8SchemasManagedclusteridentityPropertiesUserassignedidentitiesAdditionalproperties", + ] + ] = None, **kwargs ): """ :keyword type: For more information see `use managed identities in AKS `_. Known values are: - "SystemAssigned", "UserAssigned", "None". + "SystemAssigned", "UserAssigned", and "None". :paramtype type: str or ~azure.mgmt.containerservice.v2021_05_01.models.ResourceIdentityType :keyword user_assigned_identities: The keys must be ARM resource IDs in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. :paramtype user_assigned_identities: dict[str, ~azure.mgmt.containerservice.v2021_05_01.models.Components1Umhcm8SchemasManagedclusteridentityPropertiesUserassignedidentitiesAdditionalproperties] """ - super(ManagedClusterIdentity, self).__init__(**kwargs) + super().__init__(**kwargs) self.principal_id = None self.tenant_id = None self.type = type self.user_assigned_identities = user_assigned_identities -class ManagedClusterListResult(msrest.serialization.Model): +class ManagedClusterListResult(_serialization.Model): """The response from the List Managed Clusters operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -3545,30 +3568,25 @@ class ManagedClusterListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[ManagedCluster]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[ManagedCluster]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.ManagedCluster"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.ManagedCluster"]] = None, **kwargs): """ :keyword value: The list of managed clusters. :paramtype value: list[~azure.mgmt.containerservice.v2021_05_01.models.ManagedCluster] """ - super(ManagedClusterListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class ManagedClusterLoadBalancerProfile(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfile(_serialization.Model): """Profile of the managed cluster load balancer. :ivar managed_outbound_i_ps: Desired managed outbound IPs for the cluster load balancer. @@ -3594,17 +3612,23 @@ class ManagedClusterLoadBalancerProfile(msrest.serialization.Model): """ _validation = { - 'allocated_outbound_ports': {'maximum': 64000, 'minimum': 0}, - 'idle_timeout_in_minutes': {'maximum': 120, 'minimum': 4}, + "allocated_outbound_ports": {"maximum": 64000, "minimum": 0}, + "idle_timeout_in_minutes": {"maximum": 120, "minimum": 4}, } _attribute_map = { - 'managed_outbound_i_ps': {'key': 'managedOutboundIPs', 'type': 'ManagedClusterLoadBalancerProfileManagedOutboundIPs'}, - 'outbound_ip_prefixes': {'key': 'outboundIPPrefixes', 'type': 'ManagedClusterLoadBalancerProfileOutboundIPPrefixes'}, - 'outbound_i_ps': {'key': 'outboundIPs', 'type': 'ManagedClusterLoadBalancerProfileOutboundIPs'}, - 'effective_outbound_i_ps': {'key': 'effectiveOutboundIPs', 'type': '[ResourceReference]'}, - 'allocated_outbound_ports': {'key': 'allocatedOutboundPorts', 'type': 'int'}, - 'idle_timeout_in_minutes': {'key': 'idleTimeoutInMinutes', 'type': 'int'}, + "managed_outbound_i_ps": { + "key": "managedOutboundIPs", + "type": "ManagedClusterLoadBalancerProfileManagedOutboundIPs", + }, + "outbound_ip_prefixes": { + "key": "outboundIPPrefixes", + "type": "ManagedClusterLoadBalancerProfileOutboundIPPrefixes", + }, + "outbound_i_ps": {"key": "outboundIPs", "type": "ManagedClusterLoadBalancerProfileOutboundIPs"}, + "effective_outbound_i_ps": {"key": "effectiveOutboundIPs", "type": "[ResourceReference]"}, + "allocated_outbound_ports": {"key": "allocatedOutboundPorts", "type": "int"}, + "idle_timeout_in_minutes": {"key": "idleTimeoutInMinutes", "type": "int"}, } def __init__( @@ -3614,8 +3638,8 @@ def __init__( outbound_ip_prefixes: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPPrefixes"] = None, outbound_i_ps: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPs"] = None, effective_outbound_i_ps: Optional[List["_models.ResourceReference"]] = None, - allocated_outbound_ports: Optional[int] = 0, - idle_timeout_in_minutes: Optional[int] = 30, + allocated_outbound_ports: int = 0, + idle_timeout_in_minutes: int = 30, **kwargs ): """ @@ -3641,7 +3665,7 @@ def __init__( are in the range of 4 to 120 (inclusive). The default value is 30 minutes. :paramtype idle_timeout_in_minutes: int """ - super(ManagedClusterLoadBalancerProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.managed_outbound_i_ps = managed_outbound_i_ps self.outbound_ip_prefixes = outbound_ip_prefixes self.outbound_i_ps = outbound_i_ps @@ -3650,7 +3674,7 @@ def __init__( self.idle_timeout_in_minutes = idle_timeout_in_minutes -class ManagedClusterLoadBalancerProfileManagedOutboundIPs(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfileManagedOutboundIPs(_serialization.Model): """Desired managed outbound IPs for the cluster load balancer. :ivar count: The desired number of outbound IPs created/managed by Azure for the cluster load @@ -3659,30 +3683,25 @@ class ManagedClusterLoadBalancerProfileManagedOutboundIPs(msrest.serialization.M """ _validation = { - 'count': {'maximum': 100, 'minimum': 1}, + "count": {"maximum": 100, "minimum": 1}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, + "count": {"key": "count", "type": "int"}, } - def __init__( - self, - *, - count: Optional[int] = 1, - **kwargs - ): + def __init__(self, *, count: int = 1, **kwargs): """ :keyword count: The desired number of outbound IPs created/managed by Azure for the cluster load balancer. Allowed values must be in the range of 1 to 100 (inclusive). The default value is 1. :paramtype count: int """ - super(ManagedClusterLoadBalancerProfileManagedOutboundIPs, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count -class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(_serialization.Model): """Desired outbound IP Prefix resources for the cluster load balancer. :ivar public_ip_prefixes: A list of public IP prefix resources. @@ -3691,25 +3710,20 @@ class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(msrest.serialization.M """ _attribute_map = { - 'public_ip_prefixes': {'key': 'publicIPPrefixes', 'type': '[ResourceReference]'}, + "public_ip_prefixes": {"key": "publicIPPrefixes", "type": "[ResourceReference]"}, } - def __init__( - self, - *, - public_ip_prefixes: Optional[List["_models.ResourceReference"]] = None, - **kwargs - ): + def __init__(self, *, public_ip_prefixes: Optional[List["_models.ResourceReference"]] = None, **kwargs): """ :keyword public_ip_prefixes: A list of public IP prefix resources. :paramtype public_ip_prefixes: list[~azure.mgmt.containerservice.v2021_05_01.models.ResourceReference] """ - super(ManagedClusterLoadBalancerProfileOutboundIPPrefixes, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_ip_prefixes = public_ip_prefixes -class ManagedClusterLoadBalancerProfileOutboundIPs(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfileOutboundIPs(_serialization.Model): """Desired outbound IP resources for the cluster load balancer. :ivar public_i_ps: A list of public IP resources. @@ -3717,40 +3731,35 @@ class ManagedClusterLoadBalancerProfileOutboundIPs(msrest.serialization.Model): """ _attribute_map = { - 'public_i_ps': {'key': 'publicIPs', 'type': '[ResourceReference]'}, + "public_i_ps": {"key": "publicIPs", "type": "[ResourceReference]"}, } - def __init__( - self, - *, - public_i_ps: Optional[List["_models.ResourceReference"]] = None, - **kwargs - ): + def __init__(self, *, public_i_ps: Optional[List["_models.ResourceReference"]] = None, **kwargs): """ :keyword public_i_ps: A list of public IP resources. :paramtype public_i_ps: list[~azure.mgmt.containerservice.v2021_05_01.models.ResourceReference] """ - super(ManagedClusterLoadBalancerProfileOutboundIPs, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_i_ps = public_i_ps -class ManagedClusterPodIdentity(msrest.serialization.Model): +class ManagedClusterPodIdentity(_serialization.Model): """Details about the pod identity assigned to the Managed Cluster. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar name: Required. The name of the pod identity. + :ivar name: The name of the pod identity. Required. :vartype name: str - :ivar namespace: Required. The namespace of the pod identity. + :ivar namespace: The namespace of the pod identity. Required. :vartype namespace: str :ivar binding_selector: The binding selector to use for the AzureIdentityBinding resource. :vartype binding_selector: str - :ivar identity: Required. The user assigned identity details. + :ivar identity: The user assigned identity details. Required. :vartype identity: ~azure.mgmt.containerservice.v2021_05_01.models.UserAssignedIdentity :ivar provisioning_state: The current provisioning state of the pod identity. Known values are: - "Assigned", "Updating", "Deleting", "Failed". + "Assigned", "Updating", "Deleting", and "Failed". :vartype provisioning_state: str or ~azure.mgmt.containerservice.v2021_05_01.models.ManagedClusterPodIdentityProvisioningState :ivar provisioning_info: @@ -3759,20 +3768,20 @@ class ManagedClusterPodIdentity(msrest.serialization.Model): """ _validation = { - 'name': {'required': True}, - 'namespace': {'required': True}, - 'identity': {'required': True}, - 'provisioning_state': {'readonly': True}, - 'provisioning_info': {'readonly': True}, + "name": {"required": True}, + "namespace": {"required": True}, + "identity": {"required": True}, + "provisioning_state": {"readonly": True}, + "provisioning_info": {"readonly": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'namespace': {'key': 'namespace', 'type': 'str'}, - 'binding_selector': {'key': 'bindingSelector', 'type': 'str'}, - 'identity': {'key': 'identity', 'type': 'UserAssignedIdentity'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'provisioning_info': {'key': 'provisioningInfo', 'type': 'ManagedClusterPodIdentityProvisioningInfo'}, + "name": {"key": "name", "type": "str"}, + "namespace": {"key": "namespace", "type": "str"}, + "binding_selector": {"key": "bindingSelector", "type": "str"}, + "identity": {"key": "identity", "type": "UserAssignedIdentity"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "provisioning_info": {"key": "provisioningInfo", "type": "ManagedClusterPodIdentityProvisioningInfo"}, } def __init__( @@ -3785,16 +3794,16 @@ def __init__( **kwargs ): """ - :keyword name: Required. The name of the pod identity. + :keyword name: The name of the pod identity. Required. :paramtype name: str - :keyword namespace: Required. The namespace of the pod identity. + :keyword namespace: The namespace of the pod identity. Required. :paramtype namespace: str :keyword binding_selector: The binding selector to use for the AzureIdentityBinding resource. :paramtype binding_selector: str - :keyword identity: Required. The user assigned identity details. + :keyword identity: The user assigned identity details. Required. :paramtype identity: ~azure.mgmt.containerservice.v2021_05_01.models.UserAssignedIdentity """ - super(ManagedClusterPodIdentity, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.namespace = namespace self.binding_selector = binding_selector @@ -3803,54 +3812,47 @@ def __init__( self.provisioning_info = None -class ManagedClusterPodIdentityException(msrest.serialization.Model): +class ManagedClusterPodIdentityException(_serialization.Model): """See `disable AAD Pod Identity for a specific Pod/Application `_ for more details. All required parameters must be populated in order to send to Azure. - :ivar name: Required. The name of the pod identity exception. + :ivar name: The name of the pod identity exception. Required. :vartype name: str - :ivar namespace: Required. The namespace of the pod identity exception. + :ivar namespace: The namespace of the pod identity exception. Required. :vartype namespace: str - :ivar pod_labels: Required. The pod labels to match. + :ivar pod_labels: The pod labels to match. Required. :vartype pod_labels: dict[str, str] """ _validation = { - 'name': {'required': True}, - 'namespace': {'required': True}, - 'pod_labels': {'required': True}, + "name": {"required": True}, + "namespace": {"required": True}, + "pod_labels": {"required": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'namespace': {'key': 'namespace', 'type': 'str'}, - 'pod_labels': {'key': 'podLabels', 'type': '{str}'}, + "name": {"key": "name", "type": "str"}, + "namespace": {"key": "namespace", "type": "str"}, + "pod_labels": {"key": "podLabels", "type": "{str}"}, } - def __init__( - self, - *, - name: str, - namespace: str, - pod_labels: Dict[str, str], - **kwargs - ): + def __init__(self, *, name: str, namespace: str, pod_labels: Dict[str, str], **kwargs): """ - :keyword name: Required. The name of the pod identity exception. + :keyword name: The name of the pod identity exception. Required. :paramtype name: str - :keyword namespace: Required. The namespace of the pod identity exception. + :keyword namespace: The namespace of the pod identity exception. Required. :paramtype namespace: str - :keyword pod_labels: Required. The pod labels to match. + :keyword pod_labels: The pod labels to match. Required. :paramtype pod_labels: dict[str, str] """ - super(ManagedClusterPodIdentityException, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.namespace = namespace self.pod_labels = pod_labels -class ManagedClusterPodIdentityProfile(msrest.serialization.Model): +class ManagedClusterPodIdentityProfile(_serialization.Model): """See `use AAD pod identity `_ for more details on pod identity integration. :ivar enabled: Whether the pod identity addon is enabled. @@ -3870,10 +3872,13 @@ class ManagedClusterPodIdentityProfile(msrest.serialization.Model): """ _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'allow_network_plugin_kubenet': {'key': 'allowNetworkPluginKubenet', 'type': 'bool'}, - 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '[ManagedClusterPodIdentity]'}, - 'user_assigned_identity_exceptions': {'key': 'userAssignedIdentityExceptions', 'type': '[ManagedClusterPodIdentityException]'}, + "enabled": {"key": "enabled", "type": "bool"}, + "allow_network_plugin_kubenet": {"key": "allowNetworkPluginKubenet", "type": "bool"}, + "user_assigned_identities": {"key": "userAssignedIdentities", "type": "[ManagedClusterPodIdentity]"}, + "user_assigned_identity_exceptions": { + "key": "userAssignedIdentityExceptions", + "type": "[ManagedClusterPodIdentityException]", + }, } def __init__( @@ -3901,14 +3906,14 @@ def __init__( :paramtype user_assigned_identity_exceptions: list[~azure.mgmt.containerservice.v2021_05_01.models.ManagedClusterPodIdentityException] """ - super(ManagedClusterPodIdentityProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.allow_network_plugin_kubenet = allow_network_plugin_kubenet self.user_assigned_identities = user_assigned_identities self.user_assigned_identity_exceptions = user_assigned_identity_exceptions -class ManagedClusterPodIdentityProvisioningError(msrest.serialization.Model): +class ManagedClusterPodIdentityProvisioningError(_serialization.Model): """An error response from the pod identity provisioning. :ivar error: Details about the error. @@ -3917,25 +3922,20 @@ class ManagedClusterPodIdentityProvisioningError(msrest.serialization.Model): """ _attribute_map = { - 'error': {'key': 'error', 'type': 'ManagedClusterPodIdentityProvisioningErrorBody'}, + "error": {"key": "error", "type": "ManagedClusterPodIdentityProvisioningErrorBody"}, } - def __init__( - self, - *, - error: Optional["_models.ManagedClusterPodIdentityProvisioningErrorBody"] = None, - **kwargs - ): + def __init__(self, *, error: Optional["_models.ManagedClusterPodIdentityProvisioningErrorBody"] = None, **kwargs): """ :keyword error: Details about the error. :paramtype error: ~azure.mgmt.containerservice.v2021_05_01.models.ManagedClusterPodIdentityProvisioningErrorBody """ - super(ManagedClusterPodIdentityProvisioningError, self).__init__(**kwargs) + super().__init__(**kwargs) self.error = error -class ManagedClusterPodIdentityProvisioningErrorBody(msrest.serialization.Model): +class ManagedClusterPodIdentityProvisioningErrorBody(_serialization.Model): """An error response from the pod identity provisioning. :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed @@ -3953,10 +3953,10 @@ class ManagedClusterPodIdentityProvisioningErrorBody(msrest.serialization.Model) """ _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[ManagedClusterPodIdentityProvisioningErrorBody]'}, + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[ManagedClusterPodIdentityProvisioningErrorBody]"}, } def __init__( @@ -3982,14 +3982,14 @@ def __init__( :paramtype details: list[~azure.mgmt.containerservice.v2021_05_01.models.ManagedClusterPodIdentityProvisioningErrorBody] """ - super(ManagedClusterPodIdentityProvisioningErrorBody, self).__init__(**kwargs) + super().__init__(**kwargs) self.code = code self.message = message self.target = target self.details = details -class ManagedClusterPodIdentityProvisioningInfo(msrest.serialization.Model): +class ManagedClusterPodIdentityProvisioningInfo(_serialization.Model): """ManagedClusterPodIdentityProvisioningInfo. :ivar error: Pod identity assignment error (if any). @@ -3998,35 +3998,30 @@ class ManagedClusterPodIdentityProvisioningInfo(msrest.serialization.Model): """ _attribute_map = { - 'error': {'key': 'error', 'type': 'ManagedClusterPodIdentityProvisioningError'}, + "error": {"key": "error", "type": "ManagedClusterPodIdentityProvisioningError"}, } - def __init__( - self, - *, - error: Optional["_models.ManagedClusterPodIdentityProvisioningError"] = None, - **kwargs - ): + def __init__(self, *, error: Optional["_models.ManagedClusterPodIdentityProvisioningError"] = None, **kwargs): """ :keyword error: Pod identity assignment error (if any). :paramtype error: ~azure.mgmt.containerservice.v2021_05_01.models.ManagedClusterPodIdentityProvisioningError """ - super(ManagedClusterPodIdentityProvisioningInfo, self).__init__(**kwargs) + super().__init__(**kwargs) self.error = error -class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): +class ManagedClusterPoolUpgradeProfile(_serialization.Model): """The list of available upgrade versions. All required parameters must be populated in order to send to Azure. - :ivar kubernetes_version: Required. The Kubernetes version (major.minor.patch). + :ivar kubernetes_version: The Kubernetes version (major.minor.patch). Required. :vartype kubernetes_version: str :ivar name: The Agent Pool name. :vartype name: str - :ivar os_type: Required. The operating system type. The default is Linux. Known values are: - "Linux", "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2021_05_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -4034,15 +4029,15 @@ class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): """ _validation = { - 'kubernetes_version': {'required': True}, - 'os_type': {'required': True}, + "kubernetes_version": {"required": True}, + "os_type": {"required": True}, } _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'upgrades': {'key': 'upgrades', 'type': '[ManagedClusterPoolUpgradeProfileUpgradesItem]'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "os_type": {"key": "osType", "type": "str"}, + "upgrades": {"key": "upgrades", "type": "[ManagedClusterPoolUpgradeProfileUpgradesItem]"}, } def __init__( @@ -4055,25 +4050,25 @@ def __init__( **kwargs ): """ - :keyword kubernetes_version: Required. The Kubernetes version (major.minor.patch). + :keyword kubernetes_version: The Kubernetes version (major.minor.patch). Required. :paramtype kubernetes_version: str :keyword name: The Agent Pool name. :paramtype name: str - :keyword os_type: Required. The operating system type. The default is Linux. Known values are: - "Linux", "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2021_05_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: list[~azure.mgmt.containerservice.v2021_05_01.models.ManagedClusterPoolUpgradeProfileUpgradesItem] """ - super(ManagedClusterPoolUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.name = name self.os_type = os_type self.upgrades = upgrades -class ManagedClusterPoolUpgradeProfileUpgradesItem(msrest.serialization.Model): +class ManagedClusterPoolUpgradeProfileUpgradesItem(_serialization.Model): """ManagedClusterPoolUpgradeProfileUpgradesItem. :ivar kubernetes_version: The Kubernetes version (major.minor.patch). @@ -4083,36 +4078,30 @@ class ManagedClusterPoolUpgradeProfileUpgradesItem(msrest.serialization.Model): """ _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } - def __init__( - self, - *, - kubernetes_version: Optional[str] = None, - is_preview: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, kubernetes_version: Optional[str] = None, is_preview: Optional[bool] = None, **kwargs): """ :keyword kubernetes_version: The Kubernetes version (major.minor.patch). :paramtype kubernetes_version: str :keyword is_preview: Whether the Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(ManagedClusterPoolUpgradeProfileUpgradesItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.is_preview = is_preview -class ManagedClusterPropertiesAutoScalerProfile(msrest.serialization.Model): +class ManagedClusterPropertiesAutoScalerProfile(_serialization.Model): # pylint: disable=too-many-instance-attributes """Parameters to be applied to the cluster-autoscaler when enabled. :ivar balance_similar_node_groups: Valid values are 'true' and 'false'. :vartype balance_similar_node_groups: str :ivar expander: If not specified, the default is 'random'. See `expanders `_ - for more information. Known values are: "least-waste", "most-pods", "priority", "random". + for more information. Known values are: "least-waste", "most-pods", "priority", and "random". :vartype expander: str or ~azure.mgmt.containerservice.v2021_05_01.models.Expander :ivar max_empty_bulk_delete: The default is 10. :vartype max_empty_bulk_delete: str @@ -4156,23 +4145,23 @@ class ManagedClusterPropertiesAutoScalerProfile(msrest.serialization.Model): """ _attribute_map = { - 'balance_similar_node_groups': {'key': 'balance-similar-node-groups', 'type': 'str'}, - 'expander': {'key': 'expander', 'type': 'str'}, - 'max_empty_bulk_delete': {'key': 'max-empty-bulk-delete', 'type': 'str'}, - 'max_graceful_termination_sec': {'key': 'max-graceful-termination-sec', 'type': 'str'}, - 'max_node_provision_time': {'key': 'max-node-provision-time', 'type': 'str'}, - 'max_total_unready_percentage': {'key': 'max-total-unready-percentage', 'type': 'str'}, - 'new_pod_scale_up_delay': {'key': 'new-pod-scale-up-delay', 'type': 'str'}, - 'ok_total_unready_count': {'key': 'ok-total-unready-count', 'type': 'str'}, - 'scan_interval': {'key': 'scan-interval', 'type': 'str'}, - 'scale_down_delay_after_add': {'key': 'scale-down-delay-after-add', 'type': 'str'}, - 'scale_down_delay_after_delete': {'key': 'scale-down-delay-after-delete', 'type': 'str'}, - 'scale_down_delay_after_failure': {'key': 'scale-down-delay-after-failure', 'type': 'str'}, - 'scale_down_unneeded_time': {'key': 'scale-down-unneeded-time', 'type': 'str'}, - 'scale_down_unready_time': {'key': 'scale-down-unready-time', 'type': 'str'}, - 'scale_down_utilization_threshold': {'key': 'scale-down-utilization-threshold', 'type': 'str'}, - 'skip_nodes_with_local_storage': {'key': 'skip-nodes-with-local-storage', 'type': 'str'}, - 'skip_nodes_with_system_pods': {'key': 'skip-nodes-with-system-pods', 'type': 'str'}, + "balance_similar_node_groups": {"key": "balance-similar-node-groups", "type": "str"}, + "expander": {"key": "expander", "type": "str"}, + "max_empty_bulk_delete": {"key": "max-empty-bulk-delete", "type": "str"}, + "max_graceful_termination_sec": {"key": "max-graceful-termination-sec", "type": "str"}, + "max_node_provision_time": {"key": "max-node-provision-time", "type": "str"}, + "max_total_unready_percentage": {"key": "max-total-unready-percentage", "type": "str"}, + "new_pod_scale_up_delay": {"key": "new-pod-scale-up-delay", "type": "str"}, + "ok_total_unready_count": {"key": "ok-total-unready-count", "type": "str"}, + "scan_interval": {"key": "scan-interval", "type": "str"}, + "scale_down_delay_after_add": {"key": "scale-down-delay-after-add", "type": "str"}, + "scale_down_delay_after_delete": {"key": "scale-down-delay-after-delete", "type": "str"}, + "scale_down_delay_after_failure": {"key": "scale-down-delay-after-failure", "type": "str"}, + "scale_down_unneeded_time": {"key": "scale-down-unneeded-time", "type": "str"}, + "scale_down_unready_time": {"key": "scale-down-unready-time", "type": "str"}, + "scale_down_utilization_threshold": {"key": "scale-down-utilization-threshold", "type": "str"}, + "skip_nodes_with_local_storage": {"key": "skip-nodes-with-local-storage", "type": "str"}, + "skip_nodes_with_system_pods": {"key": "skip-nodes-with-system-pods", "type": "str"}, } def __init__( @@ -4202,7 +4191,7 @@ def __init__( :paramtype balance_similar_node_groups: str :keyword expander: If not specified, the default is 'random'. See `expanders `_ - for more information. Known values are: "least-waste", "most-pods", "priority", "random". + for more information. Known values are: "least-waste", "most-pods", "priority", and "random". :paramtype expander: str or ~azure.mgmt.containerservice.v2021_05_01.models.Expander :keyword max_empty_bulk_delete: The default is 10. :paramtype max_empty_bulk_delete: str @@ -4245,7 +4234,7 @@ def __init__( :keyword skip_nodes_with_system_pods: The default is true. :paramtype skip_nodes_with_system_pods: str """ - super(ManagedClusterPropertiesAutoScalerProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.balance_similar_node_groups = balance_similar_node_groups self.expander = expander self.max_empty_bulk_delete = max_empty_bulk_delete @@ -4265,58 +4254,52 @@ def __init__( self.skip_nodes_with_system_pods = skip_nodes_with_system_pods -class ManagedClusterServicePrincipalProfile(msrest.serialization.Model): +class ManagedClusterServicePrincipalProfile(_serialization.Model): """Information about a service principal identity for the cluster to use for manipulating Azure APIs. All required parameters must be populated in order to send to Azure. - :ivar client_id: Required. The ID for the service principal. + :ivar client_id: The ID for the service principal. Required. :vartype client_id: str :ivar secret: The secret password associated with the service principal in plain text. :vartype secret: str """ _validation = { - 'client_id': {'required': True}, + "client_id": {"required": True}, } _attribute_map = { - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'secret': {'key': 'secret', 'type': 'str'}, + "client_id": {"key": "clientId", "type": "str"}, + "secret": {"key": "secret", "type": "str"}, } - def __init__( - self, - *, - client_id: str, - secret: Optional[str] = None, - **kwargs - ): + def __init__(self, *, client_id: str, secret: Optional[str] = None, **kwargs): """ - :keyword client_id: Required. The ID for the service principal. + :keyword client_id: The ID for the service principal. Required. :paramtype client_id: str :keyword secret: The secret password associated with the service principal in plain text. :paramtype secret: str """ - super(ManagedClusterServicePrincipalProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.client_id = client_id self.secret = secret -class ManagedClusterSKU(msrest.serialization.Model): +class ManagedClusterSKU(_serialization.Model): """The SKU of a Managed Cluster. - :ivar name: The name of a managed cluster SKU. Known values are: "Basic". + :ivar name: The name of a managed cluster SKU. "Basic" :vartype name: str or ~azure.mgmt.containerservice.v2021_05_01.models.ManagedClusterSKUName :ivar tier: If not specified, the default is 'Free'. See `uptime SLA - `_ for more details. Known values are: "Paid", - "Free". + `_ for more details. Known values are: "Paid" + and "Free". :vartype tier: str or ~azure.mgmt.containerservice.v2021_05_01.models.ManagedClusterSKUTier """ _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, + "name": {"key": "name", "type": "str"}, + "tier": {"key": "tier", "type": "str"}, } def __init__( @@ -4327,19 +4310,19 @@ def __init__( **kwargs ): """ - :keyword name: The name of a managed cluster SKU. Known values are: "Basic". + :keyword name: The name of a managed cluster SKU. "Basic" :paramtype name: str or ~azure.mgmt.containerservice.v2021_05_01.models.ManagedClusterSKUName :keyword tier: If not specified, the default is 'Free'. See `uptime SLA - `_ for more details. Known values are: "Paid", - "Free". + `_ for more details. Known values are: "Paid" + and "Free". :paramtype tier: str or ~azure.mgmt.containerservice.v2021_05_01.models.ManagedClusterSKUTier """ - super(ManagedClusterSKU, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.tier = tier -class ManagedClusterUpgradeProfile(msrest.serialization.Model): +class ManagedClusterUpgradeProfile(_serialization.Model): """The list of available upgrades for compute pools. Variables are only populated by the server, and will be ignored when sending a request. @@ -4352,29 +4335,29 @@ class ManagedClusterUpgradeProfile(msrest.serialization.Model): :vartype name: str :ivar type: The type of the upgrade profile. :vartype type: str - :ivar control_plane_profile: Required. The list of available upgrade versions for the control - plane. + :ivar control_plane_profile: The list of available upgrade versions for the control plane. + Required. :vartype control_plane_profile: ~azure.mgmt.containerservice.v2021_05_01.models.ManagedClusterPoolUpgradeProfile - :ivar agent_pool_profiles: Required. The list of available upgrade versions for agent pools. + :ivar agent_pool_profiles: The list of available upgrade versions for agent pools. Required. :vartype agent_pool_profiles: list[~azure.mgmt.containerservice.v2021_05_01.models.ManagedClusterPoolUpgradeProfile] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'control_plane_profile': {'required': True}, - 'agent_pool_profiles': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "control_plane_profile": {"required": True}, + "agent_pool_profiles": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'control_plane_profile': {'key': 'properties.controlPlaneProfile', 'type': 'ManagedClusterPoolUpgradeProfile'}, - 'agent_pool_profiles': {'key': 'properties.agentPoolProfiles', 'type': '[ManagedClusterPoolUpgradeProfile]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "control_plane_profile": {"key": "properties.controlPlaneProfile", "type": "ManagedClusterPoolUpgradeProfile"}, + "agent_pool_profiles": {"key": "properties.agentPoolProfiles", "type": "[ManagedClusterPoolUpgradeProfile]"}, } def __init__( @@ -4385,15 +4368,15 @@ def __init__( **kwargs ): """ - :keyword control_plane_profile: Required. The list of available upgrade versions for the - control plane. + :keyword control_plane_profile: The list of available upgrade versions for the control plane. + Required. :paramtype control_plane_profile: ~azure.mgmt.containerservice.v2021_05_01.models.ManagedClusterPoolUpgradeProfile - :keyword agent_pool_profiles: Required. The list of available upgrade versions for agent pools. + :keyword agent_pool_profiles: The list of available upgrade versions for agent pools. Required. :paramtype agent_pool_profiles: list[~azure.mgmt.containerservice.v2021_05_01.models.ManagedClusterPoolUpgradeProfile] """ - super(ManagedClusterUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -4401,18 +4384,18 @@ def __init__( self.agent_pool_profiles = agent_pool_profiles -class ManagedClusterWindowsProfile(msrest.serialization.Model): +class ManagedClusterWindowsProfile(_serialization.Model): """Profile for Windows VMs in the managed cluster. All required parameters must be populated in order to send to Azure. - :ivar admin_username: Required. Specifies the name of the administrator account. - :code:`
`:code:`
` **Restriction:** Cannot end in "." :code:`
`:code:`
` - **Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", "test1", - "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", - "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", - "sys", "test2", "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 - character :code:`
`:code:`
` **Max-length:** 20 characters. + :ivar admin_username: Specifies the name of the administrator account. :code:`
`:code:`
` + **Restriction:** Cannot end in "." :code:`
`:code:`
` **Disallowed values:** + "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", + "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", + "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", + "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 character + :code:`
`:code:`
` **Max-length:** 20 characters. Required. :vartype admin_username: str :ivar admin_password: Specifies the password of the administrator account. :code:`
`:code:`
` **Minimum-length:** 8 characters :code:`
`:code:`
` @@ -4424,7 +4407,7 @@ class ManagedClusterWindowsProfile(msrest.serialization.Model): :vartype admin_password: str :ivar license_type: The license type to use for Windows VMs. See `Azure Hybrid User Benefits `_ for more details. Known values are: - "None", "Windows_Server". + "None" and "Windows_Server". :vartype license_type: str or ~azure.mgmt.containerservice.v2021_05_01.models.LicenseType :ivar enable_csi_proxy: For more details on CSI proxy, see the `CSI proxy GitHub repo `_. @@ -4432,14 +4415,14 @@ class ManagedClusterWindowsProfile(msrest.serialization.Model): """ _validation = { - 'admin_username': {'required': True}, + "admin_username": {"required": True}, } _attribute_map = { - 'admin_username': {'key': 'adminUsername', 'type': 'str'}, - 'admin_password': {'key': 'adminPassword', 'type': 'str'}, - 'license_type': {'key': 'licenseType', 'type': 'str'}, - 'enable_csi_proxy': {'key': 'enableCSIProxy', 'type': 'bool'}, + "admin_username": {"key": "adminUsername", "type": "str"}, + "admin_password": {"key": "adminPassword", "type": "str"}, + "license_type": {"key": "licenseType", "type": "str"}, + "enable_csi_proxy": {"key": "enableCSIProxy", "type": "bool"}, } def __init__( @@ -4452,13 +4435,13 @@ def __init__( **kwargs ): """ - :keyword admin_username: Required. Specifies the name of the administrator account. + :keyword admin_username: Specifies the name of the administrator account. :code:`
`:code:`
` **Restriction:** Cannot end in "." :code:`
`:code:`
` **Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 - character :code:`
`:code:`
` **Max-length:** 20 characters. + character :code:`
`:code:`
` **Max-length:** 20 characters. Required. :paramtype admin_username: str :keyword admin_password: Specifies the password of the administrator account. :code:`
`:code:`
` **Minimum-length:** 8 characters :code:`
`:code:`
` @@ -4470,20 +4453,20 @@ def __init__( :paramtype admin_password: str :keyword license_type: The license type to use for Windows VMs. See `Azure Hybrid User Benefits `_ for more details. Known values are: - "None", "Windows_Server". + "None" and "Windows_Server". :paramtype license_type: str or ~azure.mgmt.containerservice.v2021_05_01.models.LicenseType :keyword enable_csi_proxy: For more details on CSI proxy, see the `CSI proxy GitHub repo `_. :paramtype enable_csi_proxy: bool """ - super(ManagedClusterWindowsProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.admin_username = admin_username self.admin_password = admin_password self.license_type = license_type self.enable_csi_proxy = enable_csi_proxy -class OperationListResult(msrest.serialization.Model): +class OperationListResult(_serialization.Model): """The List Operation response. Variables are only populated by the server, and will be ignored when sending a request. @@ -4493,24 +4476,20 @@ class OperationListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[OperationValue]'}, + "value": {"key": "value", "type": "[OperationValue]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(OperationListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None -class OperationValue(msrest.serialization.Model): +class OperationValue(_serialization.Model): """Describes the properties of a Operation value. Variables are only populated by the server, and will be ignored when sending a request. @@ -4530,30 +4509,26 @@ class OperationValue(msrest.serialization.Model): """ _validation = { - 'origin': {'readonly': True}, - 'name': {'readonly': True}, - 'operation': {'readonly': True}, - 'resource': {'readonly': True}, - 'description': {'readonly': True}, - 'provider': {'readonly': True}, + "origin": {"readonly": True}, + "name": {"readonly": True}, + "operation": {"readonly": True}, + "resource": {"readonly": True}, + "description": {"readonly": True}, + "provider": {"readonly": True}, } _attribute_map = { - 'origin': {'key': 'origin', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'operation': {'key': 'display.operation', 'type': 'str'}, - 'resource': {'key': 'display.resource', 'type': 'str'}, - 'description': {'key': 'display.description', 'type': 'str'}, - 'provider': {'key': 'display.provider', 'type': 'str'}, + "origin": {"key": "origin", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "operation": {"key": "display.operation", "type": "str"}, + "resource": {"key": "display.resource", "type": "str"}, + "description": {"key": "display.description", "type": "str"}, + "provider": {"key": "display.provider", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(OperationValue, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.origin = None self.name = None self.operation = None @@ -4562,7 +4537,7 @@ def __init__( self.provider = None -class OSOptionProfile(msrest.serialization.Model): +class OSOptionProfile(_serialization.Model): """The OS option profile. Variables are only populated by the server, and will be ignored when sending a request. @@ -4575,83 +4550,72 @@ class OSOptionProfile(msrest.serialization.Model): :vartype name: str :ivar type: The type of the OS option resource. :vartype type: str - :ivar os_option_property_list: Required. The list of OS options. + :ivar os_option_property_list: The list of OS options. Required. :vartype os_option_property_list: list[~azure.mgmt.containerservice.v2021_05_01.models.OSOptionProperty] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'os_option_property_list': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "os_option_property_list": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'os_option_property_list': {'key': 'properties.osOptionPropertyList', 'type': '[OSOptionProperty]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "os_option_property_list": {"key": "properties.osOptionPropertyList", "type": "[OSOptionProperty]"}, } - def __init__( - self, - *, - os_option_property_list: List["_models.OSOptionProperty"], - **kwargs - ): + def __init__(self, *, os_option_property_list: List["_models.OSOptionProperty"], **kwargs): """ - :keyword os_option_property_list: Required. The list of OS options. + :keyword os_option_property_list: The list of OS options. Required. :paramtype os_option_property_list: list[~azure.mgmt.containerservice.v2021_05_01.models.OSOptionProperty] """ - super(OSOptionProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None self.os_option_property_list = os_option_property_list -class OSOptionProperty(msrest.serialization.Model): +class OSOptionProperty(_serialization.Model): """OS option property. All required parameters must be populated in order to send to Azure. - :ivar os_type: Required. The OS type. + :ivar os_type: The OS type. Required. :vartype os_type: str - :ivar enable_fips_image: Required. Whether the image is FIPS-enabled. + :ivar enable_fips_image: Whether the image is FIPS-enabled. Required. :vartype enable_fips_image: bool """ _validation = { - 'os_type': {'required': True}, - 'enable_fips_image': {'required': True}, + "os_type": {"required": True}, + "enable_fips_image": {"required": True}, } _attribute_map = { - 'os_type': {'key': 'os-type', 'type': 'str'}, - 'enable_fips_image': {'key': 'enable-fips-image', 'type': 'bool'}, + "os_type": {"key": "os-type", "type": "str"}, + "enable_fips_image": {"key": "enable-fips-image", "type": "bool"}, } - def __init__( - self, - *, - os_type: str, - enable_fips_image: bool, - **kwargs - ): + def __init__(self, *, os_type: str, enable_fips_image: bool, **kwargs): """ - :keyword os_type: Required. The OS type. + :keyword os_type: The OS type. Required. :paramtype os_type: str - :keyword enable_fips_image: Required. Whether the image is FIPS-enabled. + :keyword enable_fips_image: Whether the image is FIPS-enabled. Required. :paramtype enable_fips_image: bool """ - super(OSOptionProperty, self).__init__(**kwargs) + super().__init__(**kwargs) self.os_type = os_type self.enable_fips_image = enable_fips_image -class OutboundEnvironmentEndpoint(msrest.serialization.Model): +class OutboundEnvironmentEndpoint(_serialization.Model): """Egress endpoints which AKS agent nodes connect to for common purpose. :ivar category: The category of endpoints accessed by the AKS agent node, e.g. @@ -4662,8 +4626,8 @@ class OutboundEnvironmentEndpoint(msrest.serialization.Model): """ _attribute_map = { - 'category': {'key': 'category', 'type': 'str'}, - 'endpoints': {'key': 'endpoints', 'type': '[EndpointDependency]'}, + "category": {"key": "category", "type": "str"}, + "endpoints": {"key": "endpoints", "type": "[EndpointDependency]"}, } def __init__( @@ -4680,19 +4644,19 @@ def __init__( :keyword endpoints: The endpoints that AKS agent nodes connect to. :paramtype endpoints: list[~azure.mgmt.containerservice.v2021_05_01.models.EndpointDependency] """ - super(OutboundEnvironmentEndpoint, self).__init__(**kwargs) + super().__init__(**kwargs) self.category = category self.endpoints = endpoints -class OutboundEnvironmentEndpointCollection(msrest.serialization.Model): +class OutboundEnvironmentEndpointCollection(_serialization.Model): """Collection of OutboundEnvironmentEndpoint. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar value: Required. Collection of resources. + :ivar value: Collection of resources. Required. :vartype value: list[~azure.mgmt.containerservice.v2021_05_01.models.OutboundEnvironmentEndpoint] :ivar next_link: Link to next page of resources. @@ -4700,59 +4664,49 @@ class OutboundEnvironmentEndpointCollection(msrest.serialization.Model): """ _validation = { - 'value': {'required': True}, - 'next_link': {'readonly': True}, + "value": {"required": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[OutboundEnvironmentEndpoint]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[OutboundEnvironmentEndpoint]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: List["_models.OutboundEnvironmentEndpoint"], - **kwargs - ): + def __init__(self, *, value: List["_models.OutboundEnvironmentEndpoint"], **kwargs): """ - :keyword value: Required. Collection of resources. + :keyword value: Collection of resources. Required. :paramtype value: list[~azure.mgmt.containerservice.v2021_05_01.models.OutboundEnvironmentEndpoint] """ - super(OutboundEnvironmentEndpointCollection, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class PowerState(msrest.serialization.Model): +class PowerState(_serialization.Model): """Describes the Power State of the cluster. - :ivar code: Tells whether the cluster is Running or Stopped. Known values are: "Running", + :ivar code: Tells whether the cluster is Running or Stopped. Known values are: "Running" and "Stopped". :vartype code: str or ~azure.mgmt.containerservice.v2021_05_01.models.Code """ _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, + "code": {"key": "code", "type": "str"}, } - def __init__( - self, - *, - code: Optional[Union[str, "_models.Code"]] = None, - **kwargs - ): + def __init__(self, *, code: Optional[Union[str, "_models.Code"]] = None, **kwargs): """ - :keyword code: Tells whether the cluster is Running or Stopped. Known values are: "Running", + :keyword code: Tells whether the cluster is Running or Stopped. Known values are: "Running" and "Stopped". :paramtype code: str or ~azure.mgmt.containerservice.v2021_05_01.models.Code """ - super(PowerState, self).__init__(**kwargs) + super().__init__(**kwargs) self.code = code -class PrivateEndpoint(msrest.serialization.Model): +class PrivateEndpoint(_serialization.Model): """Private endpoint which a connection belongs to. :ivar id: The resource ID of the private endpoint. @@ -4760,24 +4714,19 @@ class PrivateEndpoint(msrest.serialization.Model): """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, } - def __init__( - self, - *, - id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin """ :keyword id: The resource ID of the private endpoint. :paramtype id: str """ - super(PrivateEndpoint, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id -class PrivateEndpointConnection(msrest.serialization.Model): +class PrivateEndpointConnection(_serialization.Model): """A private endpoint connection. Variables are only populated by the server, and will be ignored when sending a request. @@ -4789,7 +4738,7 @@ class PrivateEndpointConnection(msrest.serialization.Model): :ivar type: The resource type. :vartype type: str :ivar provisioning_state: The current provisioning state. Known values are: "Succeeded", - "Creating", "Deleting", "Failed". + "Creating", "Deleting", and "Failed". :vartype provisioning_state: str or ~azure.mgmt.containerservice.v2021_05_01.models.PrivateEndpointConnectionProvisioningState :ivar private_endpoint: The resource of private endpoint. @@ -4801,19 +4750,22 @@ class PrivateEndpointConnection(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'provisioning_state': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, - 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "private_endpoint": {"key": "properties.privateEndpoint", "type": "PrivateEndpoint"}, + "private_link_service_connection_state": { + "key": "properties.privateLinkServiceConnectionState", + "type": "PrivateLinkServiceConnectionState", + }, } def __init__( @@ -4831,7 +4783,7 @@ def __init__( :paramtype private_link_service_connection_state: ~azure.mgmt.containerservice.v2021_05_01.models.PrivateLinkServiceConnectionState """ - super(PrivateEndpointConnection, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -4840,7 +4792,7 @@ def __init__( self.private_link_service_connection_state = private_link_service_connection_state -class PrivateEndpointConnectionListResult(msrest.serialization.Model): +class PrivateEndpointConnectionListResult(_serialization.Model): """A list of private endpoint connections. :ivar value: The collection value. @@ -4848,25 +4800,20 @@ class PrivateEndpointConnectionListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, + "value": {"key": "value", "type": "[PrivateEndpointConnection]"}, } - def __init__( - self, - *, - value: Optional[List["_models.PrivateEndpointConnection"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.PrivateEndpointConnection"]] = None, **kwargs): """ :keyword value: The collection value. :paramtype value: list[~azure.mgmt.containerservice.v2021_05_01.models.PrivateEndpointConnection] """ - super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value -class PrivateLinkResource(msrest.serialization.Model): +class PrivateLinkResource(_serialization.Model): """A private link resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -4887,22 +4834,22 @@ class PrivateLinkResource(msrest.serialization.Model): """ _validation = { - 'private_link_service_id': {'readonly': True}, + "private_link_service_id": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'group_id': {'key': 'groupId', 'type': 'str'}, - 'required_members': {'key': 'requiredMembers', 'type': '[str]'}, - 'private_link_service_id': {'key': 'privateLinkServiceID', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "group_id": {"key": "groupId", "type": "str"}, + "required_members": {"key": "requiredMembers", "type": "[str]"}, + "private_link_service_id": {"key": "privateLinkServiceID", "type": "str"}, } def __init__( self, *, - id: Optional[str] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin name: Optional[str] = None, type: Optional[str] = None, group_id: Optional[str] = None, @@ -4921,7 +4868,7 @@ def __init__( :keyword required_members: The RequiredMembers of the resource. :paramtype required_members: list[str] """ - super(PrivateLinkResource, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id self.name = name self.type = type @@ -4930,7 +4877,7 @@ def __init__( self.private_link_service_id = None -class PrivateLinkResourcesListResult(msrest.serialization.Model): +class PrivateLinkResourcesListResult(_serialization.Model): """A list of private link resources. :ivar value: The collection value. @@ -4938,36 +4885,31 @@ class PrivateLinkResourcesListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, + "value": {"key": "value", "type": "[PrivateLinkResource]"}, } - def __init__( - self, - *, - value: Optional[List["_models.PrivateLinkResource"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.PrivateLinkResource"]] = None, **kwargs): """ :keyword value: The collection value. :paramtype value: list[~azure.mgmt.containerservice.v2021_05_01.models.PrivateLinkResource] """ - super(PrivateLinkResourcesListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value -class PrivateLinkServiceConnectionState(msrest.serialization.Model): +class PrivateLinkServiceConnectionState(_serialization.Model): """The state of a private link service connection. :ivar status: The private link service connection status. Known values are: "Pending", - "Approved", "Rejected", "Disconnected". + "Approved", "Rejected", and "Disconnected". :vartype status: str or ~azure.mgmt.containerservice.v2021_05_01.models.ConnectionStatus :ivar description: The private link service connection description. :vartype description: str """ _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, + "status": {"key": "status", "type": "str"}, + "description": {"key": "description", "type": "str"}, } def __init__( @@ -4979,17 +4921,17 @@ def __init__( ): """ :keyword status: The private link service connection status. Known values are: "Pending", - "Approved", "Rejected", "Disconnected". + "Approved", "Rejected", and "Disconnected". :paramtype status: str or ~azure.mgmt.containerservice.v2021_05_01.models.ConnectionStatus :keyword description: The private link service connection description. :paramtype description: str """ - super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) + super().__init__(**kwargs) self.status = status self.description = description -class ResourceReference(msrest.serialization.Model): +class ResourceReference(_serialization.Model): """A reference to an Azure resource. :ivar id: The fully qualified Azure resource id. @@ -4997,29 +4939,24 @@ class ResourceReference(msrest.serialization.Model): """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, } - def __init__( - self, - *, - id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin """ :keyword id: The fully qualified Azure resource id. :paramtype id: str """ - super(ResourceReference, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id -class RunCommandRequest(msrest.serialization.Model): +class RunCommandRequest(_serialization.Model): """A run command request. All required parameters must be populated in order to send to Azure. - :ivar command: Required. The command to run. + :ivar command: The command to run. Required. :vartype command: str :ivar context: A base64 encoded zip file containing the files required by the command. :vartype context: str @@ -5028,38 +4965,31 @@ class RunCommandRequest(msrest.serialization.Model): """ _validation = { - 'command': {'required': True}, + "command": {"required": True}, } _attribute_map = { - 'command': {'key': 'command', 'type': 'str'}, - 'context': {'key': 'context', 'type': 'str'}, - 'cluster_token': {'key': 'clusterToken', 'type': 'str'}, + "command": {"key": "command", "type": "str"}, + "context": {"key": "context", "type": "str"}, + "cluster_token": {"key": "clusterToken", "type": "str"}, } - def __init__( - self, - *, - command: str, - context: Optional[str] = None, - cluster_token: Optional[str] = None, - **kwargs - ): + def __init__(self, *, command: str, context: Optional[str] = None, cluster_token: Optional[str] = None, **kwargs): """ - :keyword command: Required. The command to run. + :keyword command: The command to run. Required. :paramtype command: str :keyword context: A base64 encoded zip file containing the files required by the command. :paramtype context: str :keyword cluster_token: AuthToken issued for AKS AAD Server App. :paramtype cluster_token: str """ - super(RunCommandRequest, self).__init__(**kwargs) + super().__init__(**kwargs) self.command = command self.context = context self.cluster_token = cluster_token -class RunCommandResult(msrest.serialization.Model): +class RunCommandResult(_serialization.Model): """run command result. Variables are only populated by the server, and will be ignored when sending a request. @@ -5081,32 +5011,28 @@ class RunCommandResult(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'exit_code': {'readonly': True}, - 'started_at': {'readonly': True}, - 'finished_at': {'readonly': True}, - 'logs': {'readonly': True}, - 'reason': {'readonly': True}, + "id": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "exit_code": {"readonly": True}, + "started_at": {"readonly": True}, + "finished_at": {"readonly": True}, + "logs": {"readonly": True}, + "reason": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'exit_code': {'key': 'properties.exitCode', 'type': 'int'}, - 'started_at': {'key': 'properties.startedAt', 'type': 'iso-8601'}, - 'finished_at': {'key': 'properties.finishedAt', 'type': 'iso-8601'}, - 'logs': {'key': 'properties.logs', 'type': 'str'}, - 'reason': {'key': 'properties.reason', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "exit_code": {"key": "properties.exitCode", "type": "int"}, + "started_at": {"key": "properties.startedAt", "type": "iso-8601"}, + "finished_at": {"key": "properties.finishedAt", "type": "iso-8601"}, + "logs": {"key": "properties.logs", "type": "str"}, + "reason": {"key": "properties.reason", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(RunCommandResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.id = None self.provisioning_state = None self.exit_code = None @@ -5116,7 +5042,7 @@ def __init__( self.reason = None -class SysctlConfig(msrest.serialization.Model): +class SysctlConfig(_serialization.Model): # pylint: disable=too-many-instance-attributes """Sysctl settings for Linux agent nodes. :ivar net_core_somaxconn: Sysctl setting net.core.somaxconn. @@ -5178,37 +5104,37 @@ class SysctlConfig(msrest.serialization.Model): """ _attribute_map = { - 'net_core_somaxconn': {'key': 'netCoreSomaxconn', 'type': 'int'}, - 'net_core_netdev_max_backlog': {'key': 'netCoreNetdevMaxBacklog', 'type': 'int'}, - 'net_core_rmem_default': {'key': 'netCoreRmemDefault', 'type': 'int'}, - 'net_core_rmem_max': {'key': 'netCoreRmemMax', 'type': 'int'}, - 'net_core_wmem_default': {'key': 'netCoreWmemDefault', 'type': 'int'}, - 'net_core_wmem_max': {'key': 'netCoreWmemMax', 'type': 'int'}, - 'net_core_optmem_max': {'key': 'netCoreOptmemMax', 'type': 'int'}, - 'net_ipv4_tcp_max_syn_backlog': {'key': 'netIpv4TcpMaxSynBacklog', 'type': 'int'}, - 'net_ipv4_tcp_max_tw_buckets': {'key': 'netIpv4TcpMaxTwBuckets', 'type': 'int'}, - 'net_ipv4_tcp_fin_timeout': {'key': 'netIpv4TcpFinTimeout', 'type': 'int'}, - 'net_ipv4_tcp_keepalive_time': {'key': 'netIpv4TcpKeepaliveTime', 'type': 'int'}, - 'net_ipv4_tcp_keepalive_probes': {'key': 'netIpv4TcpKeepaliveProbes', 'type': 'int'}, - 'net_ipv4_tcpkeepalive_intvl': {'key': 'netIpv4TcpkeepaliveIntvl', 'type': 'int'}, - 'net_ipv4_tcp_tw_reuse': {'key': 'netIpv4TcpTwReuse', 'type': 'bool'}, - 'net_ipv4_ip_local_port_range': {'key': 'netIpv4IpLocalPortRange', 'type': 'str'}, - 'net_ipv4_neigh_default_gc_thresh1': {'key': 'netIpv4NeighDefaultGcThresh1', 'type': 'int'}, - 'net_ipv4_neigh_default_gc_thresh2': {'key': 'netIpv4NeighDefaultGcThresh2', 'type': 'int'}, - 'net_ipv4_neigh_default_gc_thresh3': {'key': 'netIpv4NeighDefaultGcThresh3', 'type': 'int'}, - 'net_netfilter_nf_conntrack_max': {'key': 'netNetfilterNfConntrackMax', 'type': 'int'}, - 'net_netfilter_nf_conntrack_buckets': {'key': 'netNetfilterNfConntrackBuckets', 'type': 'int'}, - 'fs_inotify_max_user_watches': {'key': 'fsInotifyMaxUserWatches', 'type': 'int'}, - 'fs_file_max': {'key': 'fsFileMax', 'type': 'int'}, - 'fs_aio_max_nr': {'key': 'fsAioMaxNr', 'type': 'int'}, - 'fs_nr_open': {'key': 'fsNrOpen', 'type': 'int'}, - 'kernel_threads_max': {'key': 'kernelThreadsMax', 'type': 'int'}, - 'vm_max_map_count': {'key': 'vmMaxMapCount', 'type': 'int'}, - 'vm_swappiness': {'key': 'vmSwappiness', 'type': 'int'}, - 'vm_vfs_cache_pressure': {'key': 'vmVfsCachePressure', 'type': 'int'}, + "net_core_somaxconn": {"key": "netCoreSomaxconn", "type": "int"}, + "net_core_netdev_max_backlog": {"key": "netCoreNetdevMaxBacklog", "type": "int"}, + "net_core_rmem_default": {"key": "netCoreRmemDefault", "type": "int"}, + "net_core_rmem_max": {"key": "netCoreRmemMax", "type": "int"}, + "net_core_wmem_default": {"key": "netCoreWmemDefault", "type": "int"}, + "net_core_wmem_max": {"key": "netCoreWmemMax", "type": "int"}, + "net_core_optmem_max": {"key": "netCoreOptmemMax", "type": "int"}, + "net_ipv4_tcp_max_syn_backlog": {"key": "netIpv4TcpMaxSynBacklog", "type": "int"}, + "net_ipv4_tcp_max_tw_buckets": {"key": "netIpv4TcpMaxTwBuckets", "type": "int"}, + "net_ipv4_tcp_fin_timeout": {"key": "netIpv4TcpFinTimeout", "type": "int"}, + "net_ipv4_tcp_keepalive_time": {"key": "netIpv4TcpKeepaliveTime", "type": "int"}, + "net_ipv4_tcp_keepalive_probes": {"key": "netIpv4TcpKeepaliveProbes", "type": "int"}, + "net_ipv4_tcpkeepalive_intvl": {"key": "netIpv4TcpkeepaliveIntvl", "type": "int"}, + "net_ipv4_tcp_tw_reuse": {"key": "netIpv4TcpTwReuse", "type": "bool"}, + "net_ipv4_ip_local_port_range": {"key": "netIpv4IpLocalPortRange", "type": "str"}, + "net_ipv4_neigh_default_gc_thresh1": {"key": "netIpv4NeighDefaultGcThresh1", "type": "int"}, + "net_ipv4_neigh_default_gc_thresh2": {"key": "netIpv4NeighDefaultGcThresh2", "type": "int"}, + "net_ipv4_neigh_default_gc_thresh3": {"key": "netIpv4NeighDefaultGcThresh3", "type": "int"}, + "net_netfilter_nf_conntrack_max": {"key": "netNetfilterNfConntrackMax", "type": "int"}, + "net_netfilter_nf_conntrack_buckets": {"key": "netNetfilterNfConntrackBuckets", "type": "int"}, + "fs_inotify_max_user_watches": {"key": "fsInotifyMaxUserWatches", "type": "int"}, + "fs_file_max": {"key": "fsFileMax", "type": "int"}, + "fs_aio_max_nr": {"key": "fsAioMaxNr", "type": "int"}, + "fs_nr_open": {"key": "fsNrOpen", "type": "int"}, + "kernel_threads_max": {"key": "kernelThreadsMax", "type": "int"}, + "vm_max_map_count": {"key": "vmMaxMapCount", "type": "int"}, + "vm_swappiness": {"key": "vmSwappiness", "type": "int"}, + "vm_vfs_cache_pressure": {"key": "vmVfsCachePressure", "type": "int"}, } - def __init__( + def __init__( # pylint: disable=too-many-locals self, *, net_core_somaxconn: Optional[int] = None, @@ -5299,7 +5225,7 @@ def __init__( :keyword vm_vfs_cache_pressure: Sysctl setting vm.vfs_cache_pressure. :paramtype vm_vfs_cache_pressure: int """ - super(SysctlConfig, self).__init__(**kwargs) + super().__init__(**kwargs) self.net_core_somaxconn = net_core_somaxconn self.net_core_netdev_max_backlog = net_core_netdev_max_backlog self.net_core_rmem_default = net_core_rmem_default @@ -5330,20 +5256,20 @@ def __init__( self.vm_vfs_cache_pressure = vm_vfs_cache_pressure -class SystemData(msrest.serialization.Model): +class SystemData(_serialization.Model): """Metadata pertaining to creation and last modification of the resource. :ivar created_by: The identity that created the resource. :vartype created_by: str :ivar created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", "Key". + "User", "Application", "ManagedIdentity", and "Key". :vartype created_by_type: str or ~azure.mgmt.containerservice.v2021_05_01.models.CreatedByType :ivar created_at: The UTC timestamp of resource creation. :vartype created_at: ~datetime.datetime :ivar last_modified_by: The identity that last modified the resource. :vartype last_modified_by: str :ivar last_modified_by_type: The type of identity that last modified the resource. Known values - are: "User", "Application", "ManagedIdentity", "Key". + are: "User", "Application", "ManagedIdentity", and "Key". :vartype last_modified_by_type: str or ~azure.mgmt.containerservice.v2021_05_01.models.CreatedByType :ivar last_modified_at: The type of identity that last modified the resource. @@ -5351,12 +5277,12 @@ class SystemData(msrest.serialization.Model): """ _attribute_map = { - 'created_by': {'key': 'createdBy', 'type': 'str'}, - 'created_by_type': {'key': 'createdByType', 'type': 'str'}, - 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, - 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, - 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, - 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + "created_by": {"key": "createdBy", "type": "str"}, + "created_by_type": {"key": "createdByType", "type": "str"}, + "created_at": {"key": "createdAt", "type": "iso-8601"}, + "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, + "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, + "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, } def __init__( @@ -5374,7 +5300,7 @@ def __init__( :keyword created_by: The identity that created the resource. :paramtype created_by: str :keyword created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", "Key". + "User", "Application", "ManagedIdentity", and "Key". :paramtype created_by_type: str or ~azure.mgmt.containerservice.v2021_05_01.models.CreatedByType :keyword created_at: The UTC timestamp of resource creation. @@ -5382,13 +5308,13 @@ def __init__( :keyword last_modified_by: The identity that last modified the resource. :paramtype last_modified_by: str :keyword last_modified_by_type: The type of identity that last modified the resource. Known - values are: "User", "Application", "ManagedIdentity", "Key". + values are: "User", "Application", "ManagedIdentity", and "Key". :paramtype last_modified_by_type: str or ~azure.mgmt.containerservice.v2021_05_01.models.CreatedByType :keyword last_modified_at: The type of identity that last modified the resource. :paramtype last_modified_at: ~datetime.datetime """ - super(SystemData, self).__init__(**kwargs) + super().__init__(**kwargs) self.created_by = created_by self.created_by_type = created_by_type self.created_at = created_at @@ -5397,36 +5323,31 @@ def __init__( self.last_modified_at = last_modified_at -class TagsObject(msrest.serialization.Model): +class TagsObject(_serialization.Model): """Tags object for patch operations. - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] """ _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] """ - super(TagsObject, self).__init__(**kwargs) + super().__init__(**kwargs) self.tags = tags -class TimeInWeek(msrest.serialization.Model): +class TimeInWeek(_serialization.Model): """Time in a week. :ivar day: The day of the week. Known values are: "Sunday", "Monday", "Tuesday", "Wednesday", - "Thursday", "Friday", "Saturday". + "Thursday", "Friday", and "Saturday". :vartype day: str or ~azure.mgmt.containerservice.v2021_05_01.models.WeekDay :ivar hour_slots: Each integer hour represents a time range beginning at 0m after the hour ending at the next hour (non-inclusive). 0 corresponds to 00:00 UTC, 23 corresponds to 23:00 @@ -5435,32 +5356,28 @@ class TimeInWeek(msrest.serialization.Model): """ _attribute_map = { - 'day': {'key': 'day', 'type': 'str'}, - 'hour_slots': {'key': 'hourSlots', 'type': '[int]'}, + "day": {"key": "day", "type": "str"}, + "hour_slots": {"key": "hourSlots", "type": "[int]"}, } def __init__( - self, - *, - day: Optional[Union[str, "_models.WeekDay"]] = None, - hour_slots: Optional[List[int]] = None, - **kwargs + self, *, day: Optional[Union[str, "_models.WeekDay"]] = None, hour_slots: Optional[List[int]] = None, **kwargs ): """ :keyword day: The day of the week. Known values are: "Sunday", "Monday", "Tuesday", - "Wednesday", "Thursday", "Friday", "Saturday". + "Wednesday", "Thursday", "Friday", and "Saturday". :paramtype day: str or ~azure.mgmt.containerservice.v2021_05_01.models.WeekDay :keyword hour_slots: Each integer hour represents a time range beginning at 0m after the hour ending at the next hour (non-inclusive). 0 corresponds to 00:00 UTC, 23 corresponds to 23:00 UTC. Specifying [0, 1] means the 00:00 - 02:00 UTC time range. :paramtype hour_slots: list[int] """ - super(TimeInWeek, self).__init__(**kwargs) + super().__init__(**kwargs) self.day = day self.hour_slots = hour_slots -class TimeSpan(msrest.serialization.Model): +class TimeSpan(_serialization.Model): """For example, between 2021-05-25T13:00:00Z and 2021-05-25T14:00:00Z. :ivar start: The start of a time span. @@ -5470,23 +5387,17 @@ class TimeSpan(msrest.serialization.Model): """ _attribute_map = { - 'start': {'key': 'start', 'type': 'iso-8601'}, - 'end': {'key': 'end', 'type': 'iso-8601'}, + "start": {"key": "start", "type": "iso-8601"}, + "end": {"key": "end", "type": "iso-8601"}, } - def __init__( - self, - *, - start: Optional[datetime.datetime] = None, - end: Optional[datetime.datetime] = None, - **kwargs - ): + def __init__(self, *, start: Optional[datetime.datetime] = None, end: Optional[datetime.datetime] = None, **kwargs): """ :keyword start: The start of a time span. :paramtype start: ~datetime.datetime :keyword end: The end of a time span. :paramtype end: ~datetime.datetime """ - super(TimeSpan, self).__init__(**kwargs) + super().__init__(**kwargs) self.start = start self.end = end diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/models/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/models/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/models/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/models/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/operations/__init__.py index f0e265d9f2f4..f27b588ca549 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/operations/__init__.py @@ -17,14 +17,15 @@ from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'Operations', - 'ManagedClustersOperations', - 'MaintenanceConfigurationsOperations', - 'AgentPoolsOperations', - 'PrivateEndpointConnectionsOperations', - 'PrivateLinkResourcesOperations', - 'ResolvePrivateLinkServiceIdOperations', + "Operations", + "ManagedClustersOperations", + "MaintenanceConfigurationsOperations", + "AgentPoolsOperations", + "PrivateEndpointConnectionsOperations", + "PrivateLinkResourcesOperations", + "ResolvePrivateLinkServiceIdOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/operations/_agent_pools_operations.py index 772efaf3cd2c..d6532caec481 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/operations/_agent_pools_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,288 +27,289 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - *, - json: Optional[_models.AgentPool] = None, - content: Any = None, - **kwargs: Any + _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, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + _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, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_get_upgrade_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_available_agent_pool_versions_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_upgrade_node_image_version_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_upgrade_node_image_version_request( + resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class AgentPoolsOperations: """ @@ -324,47 +330,39 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> Iterable[_models.AgentPoolListResult]: + def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> Iterable["_models.AgentPool"]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AgentPoolListResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_05_01.models.AgentPoolListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either AgentPool or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_05_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -372,16 +370,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -397,10 +390,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -410,54 +401,45 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore @distributed_trace def get( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPool: """Gets the specified managed cluster agent pool. Gets the specified managed cluster agent pool. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPool, or the result of cls(response) + :return: AgentPool or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_05_01.models.AgentPool - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -465,57 +447,60 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore def _create_or_update_initial( self, resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: _models.AgentPool, + parameters: Union[_models.AgentPool, IO], **kwargs: Any ) -> _models.AgentPool: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - _json = self._serialize.body(parameters, 'AgentPool') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "AgentPool") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -523,10 +508,9 @@ def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -534,40 +518,84 @@ def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - @distributed_trace + @overload def begin_create_or_update( self, resource_group_name: str, resource_name: str, agent_pool_name: str, parameters: _models.AgentPool, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.AgentPool]: """Creates or updates an agent pool in the specified managed cluster. Creates or updates an agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str - :param parameters: The agent pool to create or update. + :param parameters: The agent pool to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2021_05_01.models.AgentPool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_05_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AgentPool]: + """Creates or updates an agent pool in the specified managed cluster. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: The agent pool to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -579,20 +607,56 @@ def begin_create_or_update( :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_05_01.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: Union[_models.AgentPool, IO], + **kwargs: Any + ) -> LROPoller[_models.AgentPool]: + """Creates or updates an agent pool in the specified managed cluster. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: The agent pool to create or update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.mgmt.containerservice.v2021_05_01.models.AgentPool or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_05_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -601,66 +665,55 @@ def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -668,10 +721,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -681,26 +733,21 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + def begin_delete( + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> LROPoller[None]: """Deletes an agent pool in the specified managed cluster. Deletes an agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -712,99 +759,85 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPoolUpgradeProfile: """Gets the upgrade profile for an agent pool. Gets the upgrade profile for an agent pool. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolUpgradeProfile, or the result of cls(response) + :return: AgentPoolUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_05_01.models.AgentPoolUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -812,32 +845,27 @@ def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolUpgradeProfile', pipeline_response) + deserialized = self._deserialize("AgentPoolUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore @distributed_trace def get_available_agent_pool_versions( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported Kubernetes versions for the specified agent pool. @@ -845,33 +873,30 @@ def get_available_agent_pool_versions( `_ for more details about the version lifecycle. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolAvailableVersions, or the result of cls(response) + :return: AgentPoolAvailableVersions or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_05_01.models.AgentPoolAvailableVersions - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolAvailableVersions] - request = build_get_available_agent_pool_versions_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_available_agent_pool_versions.metadata['url'], + template_url=self.get_available_agent_pool_versions.metadata["url"], headers=_headers, params=_params, ) @@ -879,52 +904,43 @@ def get_available_agent_pool_versions( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolAvailableVersions', pipeline_response) + deserialized = self._deserialize("AgentPoolAvailableVersions", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_available_agent_pool_versions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore - + get_available_agent_pool_versions.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore def _upgrade_node_image_version_initial( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> Optional[_models.AgentPool]: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.AgentPool]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.AgentPool]] - - request = build_upgrade_node_image_version_request_initial( - subscription_id=self._config.subscription_id, + request = build_upgrade_node_image_version_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._upgrade_node_image_version_initial.metadata['url'], + template_url=self._upgrade_node_image_version_initial.metadata["url"], headers=_headers, params=_params, ) @@ -932,10 +948,9 @@ def _upgrade_node_image_version_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -944,35 +959,30 @@ def _upgrade_node_image_version_initial( deserialized = None if response.status_code == 202: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _upgrade_node_image_version_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore - + _upgrade_node_image_version_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore @distributed_trace def begin_upgrade_node_image_version( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any - ) -> LROPoller[_models.AgentPool]: + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any + ) -> LROPoller[None]: """Upgrades the node image version of an agent pool to the latest. Upgrading the node image version of an agent pool applies the newest OS and runtime updates to the nodes. AKS provides one new image per week with the latest updates. For more details on node image versions, see: https://docs.microsoft.com/azure/aks/node-image-upgrade. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -985,55 +995,48 @@ def begin_upgrade_node_image_version( :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_05_01.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._upgrade_node_image_version_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_upgrade_node_image_version.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore + begin_upgrade_node_image_version.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/operations/_maintenance_configurations_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/operations/_maintenance_configurations_operations.py index c99e6ea5f39e..39e1c95c9cad 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/operations/_maintenance_configurations_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/operations/_maintenance_configurations_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,173 +25,173 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +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_managed_cluster_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, config_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 = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "configName": _SERIALIZER.url("config_name", config_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "configName": _SERIALIZER.url("config_name", config_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - config_name: str, - *, - json: Optional[_models.MaintenanceConfiguration] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, resource_name: str, config_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 = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "configName": _SERIALIZER.url("config_name", config_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "configName": _SERIALIZER.url("config_name", config_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, config_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 = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "configName": _SERIALIZER.url("config_name", config_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "configName": _SERIALIZER.url("config_name", config_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class MaintenanceConfigurationsOperations: """ @@ -207,48 +212,43 @@ def __init__(self, *args, **kwargs): 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_managed_cluster( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> Iterable[_models.MaintenanceConfigurationListResult]: + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> Iterable["_models.MaintenanceConfiguration"]: """Gets a list of maintenance configurations in the specified managed cluster. Gets a list of maintenance configurations in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either MaintenanceConfigurationListResult or the result - of cls(response) + :return: An iterator like instance of either MaintenanceConfiguration or the result of + cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_05_01.models.MaintenanceConfigurationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_05_01.models.MaintenanceConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfigurationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfigurationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_managed_cluster_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_managed_cluster.metadata['url'], + template_url=self.list_by_managed_cluster.metadata["url"], headers=_headers, params=_params, ) @@ -256,16 +256,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_managed_cluster_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -281,10 +276,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -294,54 +287,45 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_managed_cluster.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations"} # type: ignore + list_by_managed_cluster.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations"} # type: ignore @distributed_trace def get( - self, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, config_name: str, **kwargs: Any ) -> _models.MaintenanceConfiguration: """Gets the specified maintenance configuration of a managed cluster. Gets the specified maintenance configuration of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: MaintenanceConfiguration, or the result of cls(response) + :return: MaintenanceConfiguration or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_05_01.models.MaintenanceConfiguration - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfiguration] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -349,75 +333,147 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) + deserialized = self._deserialize("MaintenanceConfiguration", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - @distributed_trace + @overload def create_or_update( self, resource_group_name: str, resource_name: str, config_name: str, parameters: _models.MaintenanceConfiguration, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.MaintenanceConfiguration: """Creates or updates a maintenance configuration in the specified managed cluster. Creates or updates a maintenance configuration in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str - :param parameters: The maintenance configuration to create or update. + :param parameters: The maintenance configuration to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2021_05_01.models.MaintenanceConfiguration + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: MaintenanceConfiguration, or the result of cls(response) + :return: MaintenanceConfiguration or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_05_01.models.MaintenanceConfiguration - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configuration in the specified managed cluster. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: The maintenance configuration to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_05_01.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: Union[_models.MaintenanceConfiguration, IO], + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configuration in the specified managed cluster. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: The maintenance configuration to create or update. Is either a model type or + a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_05_01.models.MaintenanceConfiguration or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_05_01.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfiguration] - _json = self._serialize.body(parameters, 'MaintenanceConfiguration') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "MaintenanceConfiguration") request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) @@ -425,68 +481,59 @@ def create_or_update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) + deserialized = self._deserialize("MaintenanceConfiguration", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore @distributed_trace def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, config_name: str, **kwargs: Any ) -> None: """Deletes a maintenance configuration. Deletes a maintenance configuration. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) @@ -494,10 +541,9 @@ def delete( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -507,5 +553,4 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/operations/_managed_clusters_operations.py index 465c9e0981e4..62ec7b325211 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/operations/_managed_clusters_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,200 +27,183 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_get_os_options_request( - subscription_id: str, - location: str, - *, - resource_type: Optional[str] = None, - **kwargs: Any + location: str, subscription_id: str, *, resource_type: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "location": _SERIALIZER.url("location", location, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if resource_type is not None: - _params['resource-type'] = _SERIALIZER.query("resource_type", resource_type, 'str') + _params["resource-type"] = _SERIALIZER.query("resource_type", resource_type, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters") + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters" + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_resource_group_request( - subscription_id: str, - resource_group_name: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters", + ) # 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', min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_upgrade_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_access_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, role_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 = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "roleName": _SERIALIZER.url("role_name", role_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "roleName": _SERIALIZER.url("role_name", role_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_admin_credentials_request( - subscription_id: str, resource_group_name: str, resource_name: str, + subscription_id: str, *, server_fqdn: Optional[str] = None, **kwargs: Any @@ -223,40 +211,44 @@ def build_list_cluster_admin_credentials_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if server_fqdn is not None: - _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + _params["server-fqdn"] = _SERIALIZER.query("server_fqdn", server_fqdn, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_user_credentials_request( - subscription_id: str, resource_group_name: str, resource_name: str, + subscription_id: str, *, server_fqdn: Optional[str] = None, **kwargs: Any @@ -264,40 +256,44 @@ def build_list_cluster_user_credentials_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if server_fqdn is not None: - _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + _params["server-fqdn"] = _SERIALIZER.query("server_fqdn", server_fqdn, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_monitoring_user_credentials_request( - subscription_id: str, resource_group_name: str, resource_name: str, + subscription_id: str, *, server_fqdn: Optional[str] = None, **kwargs: Any @@ -305,520 +301,509 @@ def build_list_cluster_monitoring_user_credentials_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if server_fqdn is not None: - _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + _params["server-fqdn"] = _SERIALIZER.query("server_fqdn", server_fqdn, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: + +def build_get_request(resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedCluster] = None, - content: Any = None, - **kwargs: Any + +def build_create_or_update_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_update_tags_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.TagsObject] = None, - content: Any = None, - **kwargs: Any + +def build_update_tags_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + +def build_delete_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_reset_service_principal_profile_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedClusterServicePrincipalProfile] = None, - content: Any = None, - **kwargs: Any + +def build_reset_service_principal_profile_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_reset_aad_profile_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedClusterAADProfile] = None, - content: Any = None, - **kwargs: Any + +def build_reset_aad_profile_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_rotate_cluster_certificates_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + +def build_rotate_cluster_certificates_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_stop_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + +def build_stop_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_start_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + +def build_start_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_run_command_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.RunCommandRequest] = None, - content: Any = None, - **kwargs: Any + +def build_run_command_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_get_command_result_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - command_id: str, - **kwargs: Any + resource_group_name: str, resource_name: str, command_id: 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "commandId": _SERIALIZER.url("command_id", command_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "commandId": _SERIALIZER.url("command_id", command_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_list_outbound_network_dependencies_endpoints_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + class ManagedClustersOperations: # pylint: disable=too-many-public-methods """ @@ -839,46 +824,39 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def get_os_options( - self, - location: str, - resource_type: Optional[str] = None, - **kwargs: Any + self, location: str, resource_type: Optional[str] = None, **kwargs: Any ) -> _models.OSOptionProfile: """Gets supported OS options in the specified subscription. Gets supported OS options in the specified subscription. - :param location: The name of a supported Azure region. + :param location: The name of a supported Azure region. Required. :type location: str :param resource_type: The resource type for which the OS options needs to be returned. Default value is None. :type resource_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: OSOptionProfile, or the result of cls(response) + :return: OSOptionProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_05_01.models.OSOptionProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OSOptionProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OSOptionProfile] - request = build_get_os_options_request( - subscription_id=self._config.subscription_id, location=location, - api_version=api_version, + subscription_id=self._config.subscription_id, resource_type=resource_type, - template_url=self.get_os_options.metadata['url'], + api_version=api_version, + template_url=self.get_os_options.metadata["url"], headers=_headers, params=_params, ) @@ -886,59 +864,52 @@ def get_os_options( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('OSOptionProfile', pipeline_response) + deserialized = self._deserialize("OSOptionProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_os_options.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default"} # type: ignore - + get_os_options.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default"} # type: ignore @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.ManagedClusterListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.ManagedCluster"]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_05_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_05_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -946,14 +917,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -969,10 +937,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -982,49 +948,41 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> Iterable[_models.ManagedClusterListResult]: + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.ManagedCluster"]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_05_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_05_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -1032,15 +990,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -1056,10 +1010,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1069,50 +1021,42 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.ManagedClusterUpgradeProfile: """Gets the upgrade profile of a managed cluster. Gets the upgrade profile of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterUpgradeProfile, or the result of cls(response) + :return: ManagedClusterUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_05_01.models.ManagedClusterUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -1120,33 +1064,27 @@ def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterUpgradeProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore @distributed_trace def get_access_profile( - self, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, role_name: str, **kwargs: Any ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. @@ -1155,36 +1093,33 @@ def get_access_profile( `ListClusterAdminCredentials `_ . - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param role_name: The name of the role for managed cluster accessProfile resource. + :param role_name: The name of the role for managed cluster accessProfile resource. Required. :type role_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterAccessProfile, or the result of cls(response) + :return: ManagedClusterAccessProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_05_01.models.ManagedClusterAccessProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterAccessProfile] - request = build_get_access_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, role_name=role_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_access_profile.metadata['url'], + template_url=self.get_access_profile.metadata["url"], headers=_headers, params=_params, ) @@ -1192,68 +1127,59 @@ def get_access_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterAccessProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterAccessProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_access_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore - + get_access_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore @distributed_trace def list_cluster_admin_credentials( - self, - resource_group_name: str, - resource_name: str, - server_fqdn: Optional[str] = None, - **kwargs: Any + self, resource_group_name: str, resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any ) -> _models.CredentialResults: """Lists the admin credentials of a managed cluster. Lists the admin credentials of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_05_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_admin_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, - template_url=self.list_cluster_admin_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_admin_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -1261,68 +1187,59 @@ def list_cluster_admin_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_admin_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore - + list_cluster_admin_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore @distributed_trace def list_cluster_user_credentials( - self, - resource_group_name: str, - resource_name: str, - server_fqdn: Optional[str] = None, - **kwargs: Any + self, resource_group_name: str, resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any ) -> _models.CredentialResults: """Lists the user credentials of a managed cluster. Lists the user credentials of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_05_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, - template_url=self.list_cluster_user_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -1330,68 +1247,59 @@ def list_cluster_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore - + list_cluster_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore @distributed_trace def list_cluster_monitoring_user_credentials( - self, - resource_group_name: str, - resource_name: str, - server_fqdn: Optional[str] = None, - **kwargs: Any + self, resource_group_name: str, resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any ) -> _models.CredentialResults: """Lists the cluster monitoring user credentials of a managed cluster. Lists the cluster monitoring user credentials of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_05_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_monitoring_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, - template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_monitoring_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -1399,64 +1307,54 @@ def list_cluster_monitoring_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_monitoring_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore - + list_cluster_monitoring_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore @distributed_trace - def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.ManagedCluster: + def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.ManagedCluster: """Gets a managed cluster. Gets a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedCluster, or the result of cls(response) + :return: ManagedCluster or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_05_01.models.ManagedCluster - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -1464,55 +1362,54 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _create_or_update_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.ManagedCluster, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'ManagedCluster') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedCluster") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1520,10 +1417,9 @@ def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -1531,37 +1427,41 @@ def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - - @distributed_trace + @overload def begin_create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedCluster, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. Creates or updates a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The managed cluster to create or update. + :param parameters: The managed cluster to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2021_05_01.models.ManagedCluster + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1574,90 +1474,155 @@ def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_05_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._create_or_update_initial( # type: ignore - resource_group_name=resource_group_name, - resource_name=resource_name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop('error_map', None) - def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized + @overload + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + Creates or updates a managed cluster. - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_05_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster to create or update. Is either a model type or a IO + type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_05_01.models.ManagedCluster or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_05_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ManagedCluster", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _update_tags_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.TagsObject, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request_initial( - subscription_id=self._config.subscription_id, + request = build_update_tags_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_tags_initial.metadata['url'], + content=_content, + template_url=self._update_tags_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1665,44 +1630,118 @@ def _update_tags_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_tags_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + _update_tags_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - - @distributed_trace + @overload def begin_update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates tags on a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2021_05_01.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_05_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates tags on a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_05_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates tags on a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_05_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1715,20 +1754,17 @@ def begin_update_tags( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_05_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, @@ -1736,64 +1772,54 @@ def begin_update_tags( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1801,10 +1827,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1814,23 +1839,17 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> LROPoller[None]: + def begin_delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> LROPoller[None]: """Deletes a managed cluster. Deletes a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1842,85 +1861,83 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterServicePrincipalProfile, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterServicePrincipalProfile") - request = build_reset_service_principal_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_service_principal_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_service_principal_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_service_principal_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1928,10 +1945,9 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1941,28 +1957,32 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re if cls: return cls(pipeline_response, None, {}) - _reset_service_principal_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore - + _reset_service_principal_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore - @distributed_trace - def begin_reset_service_principal_profile( # pylint: disable=inconsistent-return-statements + @overload + def begin_reset_service_principal_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterServicePrincipalProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: """Reset the Service Principal Profile of a managed cluster. This action cannot be performed on a cluster that is not using a service principal. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The service principal profile to set on the managed cluster. + :param parameters: The service principal profile to set on the managed cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2021_05_01.models.ManagedClusterServicePrincipalProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1973,20 +1993,89 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reset the Service Principal Profile of a managed cluster. + + This action cannot be performed on a cluster that is not using a service principal. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The service principal profile to set on the managed cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Reset the Service Principal Profile of a managed cluster. + + This action cannot be performed on a cluster that is not using a service principal. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The service principal profile to set on the managed cluster. Is either a + model type or a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2021_05_01.models.ManagedClusterServicePrincipalProfile or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1994,67 +2083,68 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_service_principal_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + begin_reset_service_principal_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterAADProfile, + parameters: Union[_models.ManagedClusterAADProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterAADProfile") - request = build_reset_aad_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_aad_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_aad_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_aad_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2062,10 +2152,9 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -2075,27 +2164,103 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement if cls: return cls(pipeline_response, None, {}) - _reset_aad_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - + _reset_aad_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - @distributed_trace - def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements + @overload + def begin_reset_aad_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterAADProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: """Reset the AAD Profile of a managed cluster. Reset the AAD Profile of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The AAD profile to set on the Managed Cluster. + :param parameters: The AAD profile to set on the Managed Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2021_05_01.models.ManagedClusterAADProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reset the AAD Profile of a managed cluster. + + Reset the AAD Profile of a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The AAD profile to set on the Managed Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterAADProfile, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Reset the AAD Profile of a managed cluster. + + Reset the AAD Profile of a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The AAD profile to set on the Managed Cluster. Is either a model type or a + IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_05_01.models.ManagedClusterAADProfile or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -2106,20 +2271,17 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -2127,62 +2289,52 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_aad_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + begin_reset_aad_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_rotate_cluster_certificates_request_initial( - subscription_id=self._config.subscription_id, + request = build_rotate_cluster_certificates_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._rotate_cluster_certificates_initial.metadata['url'], + template_url=self._rotate_cluster_certificates_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2190,10 +2342,9 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -2203,24 +2354,20 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return if cls: return cls(pipeline_response, None, {}) - _rotate_cluster_certificates_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore - + _rotate_cluster_certificates_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore @distributed_trace - def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + def begin_rotate_cluster_certificates( + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> LROPoller[None]: """Rotates the certificates of a managed cluster. See `Certificate rotation `_ for more details about rotating managed cluster certificates. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -2232,80 +2379,67 @@ def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-st Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._rotate_cluster_certificates_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_rotate_cluster_certificates.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore + begin_rotate_cluster_certificates.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore def _stop_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_stop_request_initial( - subscription_id=self._config.subscription_id, + request = build_stop_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._stop_initial.metadata['url'], + template_url=self._stop_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2313,10 +2447,9 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -2326,16 +2459,10 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore - + _stop_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore @distributed_trace - def begin_stop( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> LROPoller[None]: + def begin_stop(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> LROPoller[None]: """Stops a Managed Cluster. This can only be performed on Azure Virtual Machine Scale set backed clusters. Stopping a @@ -2344,9 +2471,9 @@ def begin_stop( # pylint: disable=inconsistent-return-statements `_ for more details about stopping a cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -2358,80 +2485,67 @@ def begin_stop( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._stop_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore + begin_stop.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore def _start_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_start_request_initial( - subscription_id=self._config.subscription_id, + request = build_start_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._start_initial.metadata['url'], + template_url=self._start_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2439,10 +2553,9 @@ def _start_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -2452,24 +2565,18 @@ def _start_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore - + _start_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore @distributed_trace - def begin_start( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> LROPoller[None]: + def begin_start(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> LROPoller[None]: """Starts a previously stopped Managed Cluster. See `starting a cluster `_ for more details about starting a cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -2481,85 +2588,83 @@ def begin_start( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._start_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore + begin_start.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore def _run_command_initial( self, resource_group_name: str, resource_name: str, - request_payload: _models.RunCommandRequest, + request_payload: Union[_models.RunCommandRequest, IO], **kwargs: Any ) -> Optional[_models.RunCommandResult]: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RunCommandResult]] - _json = self._serialize.body(request_payload, 'RunCommandRequest') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(request_payload, (IO, bytes)): + _content = request_payload + else: + _json = self._serialize.body(request_payload, "RunCommandRequest") - request = build_run_command_request_initial( - subscription_id=self._config.subscription_id, + request = build_run_command_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._run_command_initial.metadata['url'], + content=_content, + template_url=self._run_command_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2567,10 +2672,9 @@ def _run_command_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -2579,22 +2683,23 @@ def _run_command_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _run_command_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore - + _run_command_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore - @distributed_trace + @overload def begin_run_command( self, resource_group_name: str, resource_name: str, request_payload: _models.RunCommandRequest, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.RunCommandResult]: """Submits a command to run against the Managed Cluster. @@ -2603,12 +2708,93 @@ def begin_run_command( more information see `AKS Run Command `_. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param request_payload: The run command request. + :param request_payload: The run command request. Required. :type request_payload: ~azure.mgmt.containerservice.v2021_05_01.models.RunCommandRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either RunCommandResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_05_01.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_run_command( + self, + resource_group_name: str, + resource_name: str, + request_payload: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RunCommandResult]: + """Submits a command to run against the Managed Cluster. + + AKS will create a pod to run the command. This is primarily useful for private clusters. For + more information see `AKS Run Command + `_. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param request_payload: The run command request. Required. + :type request_payload: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either RunCommandResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_05_01.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_run_command( + self, + resource_group_name: str, + resource_name: str, + request_payload: Union[_models.RunCommandRequest, IO], + **kwargs: Any + ) -> LROPoller[_models.RunCommandResult]: + """Submits a command to run against the Managed Cluster. + + AKS will create a pod to run the command. This is primarily useful for private clusters. For + more information see `AKS Run Command + `_. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param request_payload: The run command request. Is either a model type or a IO type. Required. + :type request_payload: ~azure.mgmt.containerservice.v2021_05_01.models.RunCommandRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -2621,20 +2807,17 @@ def begin_run_command( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_05_01.models.RunCommandResult] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.RunCommandResult] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.RunCommandResult] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._run_command_initial( # type: ignore resource_group_name=resource_group_name, @@ -2642,82 +2825,71 @@ def begin_run_command( request_payload=request_payload, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_run_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore + begin_run_command.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore @distributed_trace def get_command_result( - self, - resource_group_name: str, - resource_name: str, - command_id: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, command_id: str, **kwargs: Any ) -> Optional[_models.RunCommandResult]: """Gets the results of a command which has been run on the Managed Cluster. Gets the results of a command which has been run on the Managed Cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param command_id: Id of the command. + :param command_id: Id of the command. Required. :type command_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: RunCommandResult, or the result of cls(response) + :return: RunCommandResult or None or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_05_01.models.RunCommandResult or None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RunCommandResult]] - request = build_get_command_result_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, command_id=command_id, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_command_result.metadata['url'], + template_url=self.get_command_result.metadata["url"], headers=_headers, params=_params, ) @@ -2725,10 +2897,9 @@ def get_command_result( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -2737,59 +2908,54 @@ def get_command_result( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_command_result.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}"} # type: ignore - + get_command_result.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}"} # type: ignore @distributed_trace def list_outbound_network_dependencies_endpoints( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> Iterable[_models.OutboundEnvironmentEndpointCollection]: + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> Iterable["_models.OutboundEnvironmentEndpoint"]: """Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster. Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster. The operation returns properties of each egress endpoint. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OutboundEnvironmentEndpointCollection or the - result of cls(response) + :return: An iterator like instance of either OutboundEnvironmentEndpoint or the result of + cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_05_01.models.OutboundEnvironmentEndpointCollection] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_05_01.models.OutboundEnvironmentEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_outbound_network_dependencies_endpoints_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_outbound_network_dependencies_endpoints.metadata['url'], + template_url=self.list_outbound_network_dependencies_endpoints.metadata["url"], headers=_headers, params=_params, ) @@ -2797,16 +2963,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_outbound_network_dependencies_endpoints_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -2822,10 +2983,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2835,8 +2994,6 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_outbound_network_dependencies_endpoints.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints"} # type: ignore + list_outbound_network_dependencies_endpoints.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/operations/_operations.py index 4a4b89db4298..35dd8f677a04 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/operations/_operations.py @@ -7,10 +7,15 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,38 +25,34 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - **kwargs: Any -) -> HttpRequest: + +def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.ContainerService/operations") # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class Operations: """ @@ -72,38 +73,33 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.OperationListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.OperationValue"]: """Gets a list of operations. Gets a list of operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationListResult or the result of cls(response) + :return: An iterator like instance of either OperationValue or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_05_01.models.OperationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_05_01.models.OperationValue] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -111,13 +107,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -133,10 +127,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -146,8 +138,6 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.ContainerService/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ContainerService/operations"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/operations/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/operations/_private_endpoint_connections_operations.py index dd426c9386f7..0bde80de9aa0 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/operations/_private_endpoint_connections_operations.py @@ -6,11 +6,15 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod @@ -21,173 +25,191 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - subscription_id: str, resource_group_name: str, resource_name: str, private_endpoint_connection_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 = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_update_request( - subscription_id: str, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, - *, - json: Optional[_models.PrivateEndpointConnection] = None, - content: Any = None, + subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request_initial( - subscription_id: str, +def build_delete_request( resource_group_name: str, resource_name: str, private_endpoint_connection_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 = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class PrivateEndpointConnectionsOperations: """ @@ -208,46 +230,39 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnectionListResult: """Gets a list of private endpoint connections in the specified managed cluster. To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnectionListResult, or the result of cls(response) + :return: PrivateEndpointConnectionListResult or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_05_01.models.PrivateEndpointConnectionListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnectionListResult] - request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -255,69 +270,60 @@ def list( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore - + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore @distributed_trace def get( - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnection: """Gets the specified private endpoint connection. To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_05_01.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -325,75 +331,147 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - - @distributed_trace + @overload def update( self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, parameters: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateEndpointConnection: """Updates a private endpoint connection. Updates a private endpoint connection. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str - :param parameters: The updated private endpoint connection. + :param parameters: The updated private endpoint connection. Required. :type parameters: ~azure.mgmt.containerservice.v2021_05_01.models.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_05_01.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: The updated private endpoint connection. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_05_01.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: Union[_models.PrivateEndpointConnection, IO], + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: The updated private endpoint connection. Is either a model type or a IO + type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_05_01.models.PrivateEndpointConnection or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_05_01.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - _json = self._serialize.body(parameters, 'PrivateEndpointConnection') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateEndpointConnection") request = build_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update.metadata['url'], + content=_content, + template_url=self.update.metadata["url"], headers=_headers, params=_params, ) @@ -401,52 +479,43 @@ def update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -454,10 +523,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -467,26 +535,21 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + def begin_delete( + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> LROPoller[None]: """Deletes a private endpoint connection. Deletes a private endpoint connection. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -498,53 +561,46 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/operations/_private_link_resources_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/operations/_private_link_resources_operations.py index 865c73d23f26..457af93da353 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/operations/_private_link_resources_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/operations/_private_link_resources_operations.py @@ -8,9 +8,13 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -19,48 +23,53 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class PrivateLinkResourcesOperations: """ @@ -81,46 +90,39 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.PrivateLinkResourcesListResult: """Gets a list of private link resources in the specified managed cluster. To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResourcesListResult, or the result of cls(response) + :return: PrivateLinkResourcesListResult or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_05_01.models.PrivateLinkResourcesListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResourcesListResult] - request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -128,22 +130,20 @@ def list( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResourcesListResult', pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources"} # type: ignore - + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/operations/_resolve_private_link_service_id_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/operations/_resolve_private_link_service_id_operations.py index 90f710553d08..fd619ff28e66 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/operations/_resolve_private_link_service_id_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/operations/_resolve_private_link_service_id_operations.py @@ -6,11 +6,15 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -19,56 +23,56 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_post_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.PrivateLinkResource] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + class ResolvePrivateLinkServiceIdOperations: """ @@ -89,52 +93,118 @@ def __init__(self, *args, **kwargs): 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 + @overload def post( self, resource_group_name: str, resource_name: str, parameters: _models.PrivateLinkResource, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateLinkResource: """Gets the private link service ID for the specified managed cluster. Gets the private link service ID for the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters required in order to resolve a private link service ID. + :param parameters: Parameters required in order to resolve a private link service ID. Required. :type parameters: ~azure.mgmt.containerservice.v2021_05_01.models.PrivateLinkResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResource, or the result of cls(response) + :return: PrivateLinkResource or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_05_01.models.PrivateLinkResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + def post( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID for the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters required in order to resolve a private link service ID. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_05_01.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def post( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.PrivateLinkResource, IO], + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID for the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters required in order to resolve a private link service ID. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_05_01.models.PrivateLinkResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_05_01.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResource] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResource] - _json = self._serialize.body(parameters, 'PrivateLinkResource') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateLinkResource") request = build_post_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.post.metadata['url'], + content=_content, + template_url=self.post.metadata["url"], headers=_headers, params=_params, ) @@ -142,22 +212,20 @@ def post( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResource', pipeline_response) + deserialized = self._deserialize("PrivateLinkResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - post.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId"} # type: ignore - + post.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/__init__.py index 37a5f9e02e6f..a8716d29afe8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/__init__.py @@ -14,7 +14,8 @@ except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['ContainerServiceClient'] + +__all__ = ["ContainerServiceClient"] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/_configuration.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/_configuration.py index 2509b8962298..9b7940e42173 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/_configuration.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/_configuration.py @@ -18,30 +18,26 @@ VERSION = "unknown" + class ContainerServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ContainerServiceClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2021-07-01". 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: + def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ContainerServiceClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2021-07-01") # type: str + api_version = kwargs.pop("api_version", "2021-07-01") # type: str if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -51,23 +47,24 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-containerservice/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-containerservice/{}".format(VERSION)) self._configure(**kwargs) def _configure( - self, - **kwargs # type: Any + self, **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/_container_service_client.py index 012dd7e2a2c3..db513d5818b3 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/_container_service_client.py @@ -9,20 +9,28 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from . import models +from .._serialization import Deserializer, Serializer from ._configuration import ContainerServiceClientConfiguration -from .operations import AgentPoolsOperations, MaintenanceConfigurationsOperations, ManagedClustersOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, ResolvePrivateLinkServiceIdOperations +from .operations import ( + AgentPoolsOperations, + MaintenanceConfigurationsOperations, + ManagedClustersOperations, + Operations, + PrivateEndpointConnectionsOperations, + PrivateLinkResourcesOperations, + ResolvePrivateLinkServiceIdOperations, +) if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class ContainerServiceClient: # pylint: disable=too-many-instance-attributes + +class ContainerServiceClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """The Container Service Client. :ivar operations: Operations operations @@ -44,10 +52,10 @@ class ContainerServiceClient: # pylint: disable=too-many-instance-attributes :ivar resolve_private_link_service_id: ResolvePrivateLinkServiceIdOperations operations :vartype resolve_private_link_service_id: azure.mgmt.containerservice.v2021_07_01.operations.ResolvePrivateLinkServiceIdOperations - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -65,25 +73,23 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = ContainerServiceClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = ContainerServiceClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize - ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.managed_clusters = ManagedClustersOperations( self._client, self._config, self._serialize, self._deserialize ) self.maintenance_configurations = MaintenanceConfigurationsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.agent_pools = AgentPoolsOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) self.private_endpoint_connections = PrivateEndpointConnectionsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -94,12 +100,7 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) - - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> HttpResponse: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -108,7 +109,7 @@ def _send_request( >>> response = client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/_metadata.json b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/_metadata.json index 15286fb03fc3..be5dd57fba00 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/_metadata.json +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/_metadata.json @@ -10,20 +10,20 @@ "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { "credential": { - "signature": "credential, # type: \"TokenCredential\"", - "description": "Credential needed for the client to connect to Azure.", + "signature": "credential: \"TokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true }, "subscription_id": { - "signature": "subscription_id, # type: str", - "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "signature": "subscription_id: str,", + "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.", "docstring_type": "str", "required": true } @@ -31,13 +31,13 @@ "async": { "credential": { "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure.", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { "signature": "subscription_id: str,", - "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.", "docstring_type": "str", "required": true } @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=\"https://management.azure.com\", # type: str", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/_patch.py index 74e48ecd07cf..f99e77fef986 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/_patch.py @@ -28,4 +28,4 @@ # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + pass diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/_vendor.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/_vendor.py index 138f663c53a4..9aad73fc743e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/_vendor.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/_vendor.py @@ -7,6 +7,7 @@ from azure.core.pipeline.transport import HttpRequest + def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) @@ -14,6 +15,7 @@ def _convert_request(request, files=None): request.set_formdata_body(files) return request + def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -21,7 +23,5 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [ - c for c in formatted_components if "{}".format(key.args[0]) not in c - ] + components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/aio/__init__.py index 37a5f9e02e6f..a8716d29afe8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/aio/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/aio/__init__.py @@ -14,7 +14,8 @@ except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['ContainerServiceClient'] + +__all__ = ["ContainerServiceClient"] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/aio/_configuration.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/aio/_configuration.py index 35d49340efe7..967b7c663e1a 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/aio/_configuration.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/aio/_configuration.py @@ -18,30 +18,26 @@ VERSION = "unknown" + class ContainerServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ContainerServiceClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2021-07-01". 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: + def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ContainerServiceClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2021-07-01") # type: str + api_version = kwargs.pop("api_version", "2021-07-01") # type: str if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -51,22 +47,21 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-containerservice/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-containerservice/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, - **kwargs: Any - ) -> None: - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/aio/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/aio/_container_service_client.py index 4744c95be1f3..0bf57ecac3f0 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/aio/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/aio/_container_service_client.py @@ -9,20 +9,28 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from .. import models +from ..._serialization import Deserializer, Serializer from ._configuration import ContainerServiceClientConfiguration -from .operations import AgentPoolsOperations, MaintenanceConfigurationsOperations, ManagedClustersOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, ResolvePrivateLinkServiceIdOperations +from .operations import ( + AgentPoolsOperations, + MaintenanceConfigurationsOperations, + ManagedClustersOperations, + Operations, + PrivateEndpointConnectionsOperations, + PrivateLinkResourcesOperations, + ResolvePrivateLinkServiceIdOperations, +) if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class ContainerServiceClient: # pylint: disable=too-many-instance-attributes + +class ContainerServiceClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """The Container Service Client. :ivar operations: Operations operations @@ -45,10 +53,10 @@ class ContainerServiceClient: # pylint: disable=too-many-instance-attributes :ivar resolve_private_link_service_id: ResolvePrivateLinkServiceIdOperations operations :vartype resolve_private_link_service_id: azure.mgmt.containerservice.v2021_07_01.aio.operations.ResolvePrivateLinkServiceIdOperations - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -66,25 +74,23 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = ContainerServiceClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = ContainerServiceClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize - ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.managed_clusters = ManagedClustersOperations( self._client, self._config, self._serialize, self._deserialize ) self.maintenance_configurations = MaintenanceConfigurationsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.agent_pools = AgentPoolsOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) self.private_endpoint_connections = PrivateEndpointConnectionsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -95,12 +101,7 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) - - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -109,7 +110,7 @@ def _send_request( >>> response = await client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/aio/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/aio/_patch.py index 74e48ecd07cf..f99e77fef986 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/aio/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/aio/_patch.py @@ -28,4 +28,4 @@ # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + pass diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/aio/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/aio/operations/__init__.py index f0e265d9f2f4..f27b588ca549 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/aio/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/aio/operations/__init__.py @@ -17,14 +17,15 @@ from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'Operations', - 'ManagedClustersOperations', - 'MaintenanceConfigurationsOperations', - 'AgentPoolsOperations', - 'PrivateEndpointConnectionsOperations', - 'PrivateLinkResourcesOperations', - 'ResolvePrivateLinkServiceIdOperations', + "Operations", + "ManagedClustersOperations", + "MaintenanceConfigurationsOperations", + "AgentPoolsOperations", + "PrivateEndpointConnectionsOperations", + "PrivateLinkResourcesOperations", + "ResolvePrivateLinkServiceIdOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/aio/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/aio/operations/_agent_pools_operations.py index 39ba03d9fa8e..6387563b9201 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/aio/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/aio/operations/_agent_pools_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +29,20 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._agent_pools_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_available_agent_pool_versions_request, build_get_request, build_get_upgrade_profile_request, build_list_request, build_upgrade_node_image_version_request_initial -T = TypeVar('T') +from ...operations._agent_pools_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_available_agent_pool_versions_request, + build_get_request, + build_get_upgrade_profile_request, + build_list_request, + build_upgrade_node_image_version_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class AgentPoolsOperations: """ .. warning:: @@ -45,47 +62,40 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.AgentPoolListResult]: + def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncIterable["_models.AgentPool"]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AgentPoolListResult or the result of cls(response) + :return: An iterator like instance of either AgentPool or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_07_01.models.AgentPoolListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_07_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -93,16 +103,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -118,10 +123,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -131,54 +134,45 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore @distributed_trace_async async def get( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPool: """Gets the specified managed cluster agent pool. Gets the specified managed cluster agent pool. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPool, or the result of cls(response) + :return: AgentPool or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_07_01.models.AgentPool - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -186,57 +180,60 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore async def _create_or_update_initial( self, resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: _models.AgentPool, + parameters: Union[_models.AgentPool, IO], **kwargs: Any ) -> _models.AgentPool: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - _json = self._serialize.body(parameters, 'AgentPool') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "AgentPool") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -244,10 +241,9 @@ async def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -255,40 +251,44 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - @distributed_trace_async + @overload async def begin_create_or_update( self, resource_group_name: str, resource_name: str, agent_pool_name: str, parameters: _models.AgentPool, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.AgentPool]: """Creates or updates an agent pool in the specified managed cluster. Creates or updates an agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str - :param parameters: The agent pool to create or update. + :param parameters: The agent pool to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2021_07_01.models.AgentPool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -301,20 +301,98 @@ async def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_07_01.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AgentPool]: + """Creates or updates an agent pool in the specified managed cluster. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: The agent pool to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AgentPool or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_07_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: Union[_models.AgentPool, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.AgentPool]: + """Creates or updates an agent pool in the specified managed cluster. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: The agent pool to create or update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.mgmt.containerservice.v2021_07_01.models.AgentPool or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AgentPool or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_07_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -323,66 +401,55 @@ async def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -390,10 +457,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -403,26 +469,21 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + async def begin_delete( + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes an agent pool in the specified managed cluster. Deletes an agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -434,99 +495,85 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace_async async def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPoolUpgradeProfile: """Gets the upgrade profile for an agent pool. Gets the upgrade profile for an agent pool. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolUpgradeProfile, or the result of cls(response) + :return: AgentPoolUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_07_01.models.AgentPoolUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -534,32 +581,27 @@ async def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolUpgradeProfile', pipeline_response) + deserialized = self._deserialize("AgentPoolUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore @distributed_trace_async async def get_available_agent_pool_versions( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported Kubernetes versions for the specified agent pool. @@ -567,33 +609,30 @@ async def get_available_agent_pool_versions( `_ for more details about the version lifecycle. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolAvailableVersions, or the result of cls(response) + :return: AgentPoolAvailableVersions or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_07_01.models.AgentPoolAvailableVersions - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolAvailableVersions] - request = build_get_available_agent_pool_versions_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_available_agent_pool_versions.metadata['url'], + template_url=self.get_available_agent_pool_versions.metadata["url"], headers=_headers, params=_params, ) @@ -601,52 +640,43 @@ async def get_available_agent_pool_versions( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolAvailableVersions', pipeline_response) + deserialized = self._deserialize("AgentPoolAvailableVersions", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_available_agent_pool_versions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore - + get_available_agent_pool_versions.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore async def _upgrade_node_image_version_initial( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> Optional[_models.AgentPool]: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.AgentPool]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.AgentPool]] - - request = build_upgrade_node_image_version_request_initial( - subscription_id=self._config.subscription_id, + request = build_upgrade_node_image_version_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._upgrade_node_image_version_initial.metadata['url'], + template_url=self._upgrade_node_image_version_initial.metadata["url"], headers=_headers, params=_params, ) @@ -654,10 +684,9 @@ async def _upgrade_node_image_version_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -666,35 +695,30 @@ async def _upgrade_node_image_version_initial( deserialized = None if response.status_code == 202: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _upgrade_node_image_version_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore - + _upgrade_node_image_version_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore @distributed_trace_async async def begin_upgrade_node_image_version( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any - ) -> AsyncLROPoller[_models.AgentPool]: + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: """Upgrades the node image version of an agent pool to the latest. Upgrading the node image version of an agent pool applies the newest OS and runtime updates to the nodes. AKS provides one new image per week with the latest updates. For more details on node image versions, see: https://docs.microsoft.com/azure/aks/node-image-upgrade. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -708,55 +732,48 @@ async def begin_upgrade_node_image_version( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_07_01.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._upgrade_node_image_version_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_upgrade_node_image_version.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore + begin_upgrade_node_image_version.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/aio/operations/_maintenance_configurations_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/aio/operations/_maintenance_configurations_operations.py index e16ec2b6b9b2..6a07282d7a43 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/aio/operations/_maintenance_configurations_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/aio/operations/_maintenance_configurations_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,10 +27,17 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._maintenance_configurations_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_managed_cluster_request -T = TypeVar('T') +from ...operations._maintenance_configurations_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_managed_cluster_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class MaintenanceConfigurationsOperations: """ .. warning:: @@ -43,48 +57,43 @@ def __init__(self, *args, **kwargs) -> None: 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_managed_cluster( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.MaintenanceConfigurationListResult]: + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> AsyncIterable["_models.MaintenanceConfiguration"]: """Gets a list of maintenance configurations in the specified managed cluster. Gets a list of maintenance configurations in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either MaintenanceConfigurationListResult or the result - of cls(response) + :return: An iterator like instance of either MaintenanceConfiguration or the result of + cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_07_01.models.MaintenanceConfigurationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_07_01.models.MaintenanceConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfigurationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfigurationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_managed_cluster_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_managed_cluster.metadata['url'], + template_url=self.list_by_managed_cluster.metadata["url"], headers=_headers, params=_params, ) @@ -92,16 +101,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_managed_cluster_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -117,10 +121,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -130,54 +132,45 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_managed_cluster.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations"} # type: ignore + list_by_managed_cluster.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations"} # type: ignore @distributed_trace_async async def get( - self, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, config_name: str, **kwargs: Any ) -> _models.MaintenanceConfiguration: """Gets the specified maintenance configuration of a managed cluster. Gets the specified maintenance configuration of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: MaintenanceConfiguration, or the result of cls(response) + :return: MaintenanceConfiguration or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_07_01.models.MaintenanceConfiguration - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfiguration] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -185,75 +178,147 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) + deserialized = self._deserialize("MaintenanceConfiguration", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - @distributed_trace_async + @overload async def create_or_update( self, resource_group_name: str, resource_name: str, config_name: str, parameters: _models.MaintenanceConfiguration, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.MaintenanceConfiguration: """Creates or updates a maintenance configuration in the specified managed cluster. Creates or updates a maintenance configuration in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str - :param parameters: The maintenance configuration to create or update. + :param parameters: The maintenance configuration to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2021_07_01.models.MaintenanceConfiguration + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: MaintenanceConfiguration, or the result of cls(response) + :return: MaintenanceConfiguration or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_07_01.models.MaintenanceConfiguration - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configuration in the specified managed cluster. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: The maintenance configuration to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_07_01.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: Union[_models.MaintenanceConfiguration, IO], + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configuration in the specified managed cluster. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: The maintenance configuration to create or update. Is either a model type or + a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_07_01.models.MaintenanceConfiguration or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_07_01.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfiguration] - _json = self._serialize.body(parameters, 'MaintenanceConfiguration') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "MaintenanceConfiguration") request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) @@ -261,68 +326,59 @@ async def create_or_update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) + deserialized = self._deserialize("MaintenanceConfiguration", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, config_name: str, **kwargs: Any ) -> None: """Deletes a maintenance configuration. Deletes a maintenance configuration. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) @@ -330,10 +386,9 @@ async def delete( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -343,5 +398,4 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/aio/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/aio/operations/_managed_clusters_operations.py index 26a3132a0203..3fdf8e6a6783 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/aio/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/aio/operations/_managed_clusters_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +29,33 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._managed_clusters_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_access_profile_request, build_get_command_result_request, build_get_os_options_request, build_get_request, build_get_upgrade_profile_request, build_list_by_resource_group_request, build_list_cluster_admin_credentials_request, build_list_cluster_monitoring_user_credentials_request, build_list_cluster_user_credentials_request, build_list_outbound_network_dependencies_endpoints_request, build_list_request, build_reset_aad_profile_request_initial, build_reset_service_principal_profile_request_initial, build_rotate_cluster_certificates_request_initial, build_run_command_request_initial, build_start_request_initial, build_stop_request_initial, build_update_tags_request_initial -T = TypeVar('T') +from ...operations._managed_clusters_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_access_profile_request, + build_get_command_result_request, + build_get_os_options_request, + build_get_request, + build_get_upgrade_profile_request, + build_list_by_resource_group_request, + build_list_cluster_admin_credentials_request, + build_list_cluster_monitoring_user_credentials_request, + build_list_cluster_user_credentials_request, + build_list_outbound_network_dependencies_endpoints_request, + build_list_request, + build_reset_aad_profile_request, + build_reset_service_principal_profile_request, + build_rotate_cluster_certificates_request, + build_run_command_request, + build_start_request, + build_stop_request, + build_update_tags_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class ManagedClustersOperations: # pylint: disable=too-many-public-methods """ .. warning:: @@ -45,46 +75,39 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async async def get_os_options( - self, - location: str, - resource_type: Optional[str] = None, - **kwargs: Any + self, location: str, resource_type: Optional[str] = None, **kwargs: Any ) -> _models.OSOptionProfile: """Gets supported OS options in the specified subscription. Gets supported OS options in the specified subscription. - :param location: The name of a supported Azure region. + :param location: The name of a supported Azure region. Required. :type location: str :param resource_type: The resource type for which the OS options needs to be returned. Default value is None. :type resource_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: OSOptionProfile, or the result of cls(response) + :return: OSOptionProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_07_01.models.OSOptionProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OSOptionProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OSOptionProfile] - request = build_get_os_options_request( - subscription_id=self._config.subscription_id, location=location, - api_version=api_version, + subscription_id=self._config.subscription_id, resource_type=resource_type, - template_url=self.get_os_options.metadata['url'], + api_version=api_version, + template_url=self.get_os_options.metadata["url"], headers=_headers, params=_params, ) @@ -92,59 +115,52 @@ async def get_os_options( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('OSOptionProfile', pipeline_response) + deserialized = self._deserialize("OSOptionProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_os_options.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default"} # type: ignore - + get_os_options.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default"} # type: ignore @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.ManagedClusterListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.ManagedCluster"]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_07_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_07_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -152,14 +168,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -175,10 +188,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -188,49 +199,43 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.ManagedClusterListResult]: + self, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ManagedCluster"]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_07_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_07_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -238,15 +243,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -262,10 +263,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -275,50 +274,42 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace_async async def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.ManagedClusterUpgradeProfile: """Gets the upgrade profile of a managed cluster. Gets the upgrade profile of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterUpgradeProfile, or the result of cls(response) + :return: ManagedClusterUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_07_01.models.ManagedClusterUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -326,33 +317,27 @@ async def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterUpgradeProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore @distributed_trace_async async def get_access_profile( - self, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, role_name: str, **kwargs: Any ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. @@ -361,36 +346,33 @@ async def get_access_profile( `ListClusterAdminCredentials `_ . - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param role_name: The name of the role for managed cluster accessProfile resource. + :param role_name: The name of the role for managed cluster accessProfile resource. Required. :type role_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterAccessProfile, or the result of cls(response) + :return: ManagedClusterAccessProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_07_01.models.ManagedClusterAccessProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterAccessProfile] - request = build_get_access_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, role_name=role_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_access_profile.metadata['url'], + template_url=self.get_access_profile.metadata["url"], headers=_headers, params=_params, ) @@ -398,68 +380,59 @@ async def get_access_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterAccessProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterAccessProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_access_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore - + get_access_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore @distributed_trace_async async def list_cluster_admin_credentials( - self, - resource_group_name: str, - resource_name: str, - server_fqdn: Optional[str] = None, - **kwargs: Any + self, resource_group_name: str, resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any ) -> _models.CredentialResults: """Lists the admin credentials of a managed cluster. Lists the admin credentials of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_07_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_admin_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, - template_url=self.list_cluster_admin_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_admin_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -467,68 +440,59 @@ async def list_cluster_admin_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_admin_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore - + list_cluster_admin_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore @distributed_trace_async async def list_cluster_user_credentials( - self, - resource_group_name: str, - resource_name: str, - server_fqdn: Optional[str] = None, - **kwargs: Any + self, resource_group_name: str, resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any ) -> _models.CredentialResults: """Lists the user credentials of a managed cluster. Lists the user credentials of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_07_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, - template_url=self.list_cluster_user_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -536,68 +500,59 @@ async def list_cluster_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore - + list_cluster_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore @distributed_trace_async async def list_cluster_monitoring_user_credentials( - self, - resource_group_name: str, - resource_name: str, - server_fqdn: Optional[str] = None, - **kwargs: Any + self, resource_group_name: str, resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any ) -> _models.CredentialResults: """Lists the cluster monitoring user credentials of a managed cluster. Lists the cluster monitoring user credentials of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_07_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_monitoring_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, - template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_monitoring_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -605,64 +560,54 @@ async def list_cluster_monitoring_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_monitoring_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore - + list_cluster_monitoring_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore @distributed_trace_async - async def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.ManagedCluster: + async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.ManagedCluster: """Gets a managed cluster. Gets a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedCluster, or the result of cls(response) + :return: ManagedCluster or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_07_01.models.ManagedCluster - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -670,55 +615,54 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _create_or_update_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.ManagedCluster, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'ManagedCluster') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedCluster") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -726,10 +670,9 @@ async def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -737,37 +680,41 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - - @distributed_trace_async + @overload async def begin_create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedCluster, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. Creates or updates a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The managed cluster to create or update. + :param parameters: The managed cluster to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2021_07_01.models.ManagedCluster + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -780,20 +727,88 @@ async def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_07_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_07_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster to create or update. Is either a model type or a IO + type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_07_01.models.ManagedCluster or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_07_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -801,69 +816,66 @@ async def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _update_tags_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.TagsObject, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request_initial( - subscription_id=self._config.subscription_id, + request = build_update_tags_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_tags_initial.metadata['url'], + content=_content, + template_url=self._update_tags_initial.metadata["url"], headers=_headers, params=_params, ) @@ -871,44 +883,47 @@ async def _update_tags_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_tags_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + _update_tags_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - - @distributed_trace_async + @overload async def begin_update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates tags on a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2021_07_01.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -921,20 +936,88 @@ async def begin_update_tags( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_07_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates tags on a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_07_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates tags on a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_07_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_07_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, @@ -942,64 +1025,54 @@ async def begin_update_tags( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1007,10 +1080,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1020,23 +1092,17 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: + async def begin_delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Deletes a managed cluster. Deletes a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1048,85 +1114,83 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterServicePrincipalProfile, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterServicePrincipalProfile") - request = build_reset_service_principal_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_service_principal_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_service_principal_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_service_principal_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1134,10 +1198,9 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1147,28 +1210,104 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist if cls: return cls(pipeline_response, None, {}) - _reset_service_principal_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + _reset_service_principal_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore - - @distributed_trace_async - async def begin_reset_service_principal_profile( # pylint: disable=inconsistent-return-statements + @overload + async def begin_reset_service_principal_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterServicePrincipalProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: """Reset the Service Principal Profile of a managed cluster. This action cannot be performed on a cluster that is not using a service principal. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The service principal profile to set on the managed cluster. + :param parameters: The service principal profile to set on the managed cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2021_07_01.models.ManagedClusterServicePrincipalProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset the Service Principal Profile of a managed cluster. + + This action cannot be performed on a cluster that is not using a service principal. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The service principal profile to set on the managed cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset the Service Principal Profile of a managed cluster. + + This action cannot be performed on a cluster that is not using a service principal. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The service principal profile to set on the managed cluster. Is either a + model type or a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2021_07_01.models.ManagedClusterServicePrincipalProfile or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -1179,20 +1318,17 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1200,67 +1336,68 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_service_principal_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + begin_reset_service_principal_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterAADProfile, + parameters: Union[_models.ManagedClusterAADProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterAADProfile") - request = build_reset_aad_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_aad_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_aad_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_aad_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1268,10 +1405,9 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1281,27 +1417,103 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta if cls: return cls(pipeline_response, None, {}) - _reset_aad_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + _reset_aad_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - - @distributed_trace_async - async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements + @overload + async def begin_reset_aad_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterAADProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: """Reset the AAD Profile of a managed cluster. Reset the AAD Profile of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The AAD profile to set on the Managed Cluster. + :param parameters: The AAD profile to set on the Managed Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2021_07_01.models.ManagedClusterAADProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset the AAD Profile of a managed cluster. + + Reset the AAD Profile of a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The AAD profile to set on the Managed Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterAADProfile, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset the AAD Profile of a managed cluster. + + Reset the AAD Profile of a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The AAD profile to set on the Managed Cluster. Is either a model type or a + IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_07_01.models.ManagedClusterAADProfile or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -1312,20 +1524,17 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1333,62 +1542,52 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_aad_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + begin_reset_aad_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_rotate_cluster_certificates_request_initial( - subscription_id=self._config.subscription_id, + request = build_rotate_cluster_certificates_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._rotate_cluster_certificates_initial.metadata['url'], + template_url=self._rotate_cluster_certificates_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1396,10 +1595,9 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1409,24 +1607,20 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- if cls: return cls(pipeline_response, None, {}) - _rotate_cluster_certificates_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore - + _rotate_cluster_certificates_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore @distributed_trace_async - async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + async def begin_rotate_cluster_certificates( + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Rotates the certificates of a managed cluster. See `Certificate rotation `_ for more details about rotating managed cluster certificates. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1438,80 +1632,67 @@ async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-ret Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._rotate_cluster_certificates_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_rotate_cluster_certificates.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore + begin_rotate_cluster_certificates.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore async def _stop_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_stop_request_initial( - subscription_id=self._config.subscription_id, + request = build_stop_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._stop_initial.metadata['url'], + template_url=self._stop_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1519,10 +1700,9 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1532,16 +1712,10 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore - + _stop_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore @distributed_trace_async - async def begin_stop( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: + async def begin_stop(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Stops a Managed Cluster. This can only be performed on Azure Virtual Machine Scale set backed clusters. Stopping a @@ -1550,9 +1724,9 @@ async def begin_stop( # pylint: disable=inconsistent-return-statements `_ for more details about stopping a cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1564,80 +1738,67 @@ async def begin_stop( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._stop_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore + begin_stop.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore async def _start_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_start_request_initial( - subscription_id=self._config.subscription_id, + request = build_start_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._start_initial.metadata['url'], + template_url=self._start_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1645,10 +1806,9 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1658,24 +1818,18 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore - + _start_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore @distributed_trace_async - async def begin_start( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: + async def begin_start(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Starts a previously stopped Managed Cluster. See `starting a cluster `_ for more details about starting a cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1687,85 +1841,83 @@ async def begin_start( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._start_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore + begin_start.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore async def _run_command_initial( self, resource_group_name: str, resource_name: str, - request_payload: _models.RunCommandRequest, + request_payload: Union[_models.RunCommandRequest, IO], **kwargs: Any ) -> Optional[_models.RunCommandResult]: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RunCommandResult]] - _json = self._serialize.body(request_payload, 'RunCommandRequest') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(request_payload, (IO, bytes)): + _content = request_payload + else: + _json = self._serialize.body(request_payload, "RunCommandRequest") - request = build_run_command_request_initial( - subscription_id=self._config.subscription_id, + request = build_run_command_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._run_command_initial.metadata['url'], + content=_content, + template_url=self._run_command_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1773,10 +1925,9 @@ async def _run_command_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1785,22 +1936,23 @@ async def _run_command_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _run_command_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore - + _run_command_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore - @distributed_trace_async + @overload async def begin_run_command( self, resource_group_name: str, resource_name: str, request_payload: _models.RunCommandRequest, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.RunCommandResult]: """Submits a command to run against the Managed Cluster. @@ -1809,12 +1961,15 @@ async def begin_run_command( more information see `AKS Run Command `_. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param request_payload: The run command request. + :param request_payload: The run command request. Required. :type request_payload: ~azure.mgmt.containerservice.v2021_07_01.models.RunCommandRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -1827,20 +1982,95 @@ async def begin_run_command( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_07_01.models.RunCommandResult] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_run_command( + self, + resource_group_name: str, + resource_name: str, + request_payload: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.RunCommandResult]: + """Submits a command to run against the Managed Cluster. + + AKS will create a pod to run the command. This is primarily useful for private clusters. For + more information see `AKS Run Command + `_. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param request_payload: The run command request. Required. + :type request_payload: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RunCommandResult or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_07_01.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_run_command( + self, + resource_group_name: str, + resource_name: str, + request_payload: Union[_models.RunCommandRequest, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.RunCommandResult]: + """Submits a command to run against the Managed Cluster. + + AKS will create a pod to run the command. This is primarily useful for private clusters. For + more information see `AKS Run Command + `_. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param request_payload: The run command request. Is either a model type or a IO type. Required. + :type request_payload: ~azure.mgmt.containerservice.v2021_07_01.models.RunCommandRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RunCommandResult or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_07_01.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.RunCommandResult] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.RunCommandResult] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._run_command_initial( # type: ignore resource_group_name=resource_group_name, @@ -1848,82 +2078,71 @@ async def begin_run_command( request_payload=request_payload, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_run_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore + begin_run_command.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore @distributed_trace_async async def get_command_result( - self, - resource_group_name: str, - resource_name: str, - command_id: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, command_id: str, **kwargs: Any ) -> Optional[_models.RunCommandResult]: """Gets the results of a command which has been run on the Managed Cluster. Gets the results of a command which has been run on the Managed Cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param command_id: Id of the command. + :param command_id: Id of the command. Required. :type command_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: RunCommandResult, or the result of cls(response) + :return: RunCommandResult or None or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_07_01.models.RunCommandResult or None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RunCommandResult]] - request = build_get_command_result_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, command_id=command_id, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_command_result.metadata['url'], + template_url=self.get_command_result.metadata["url"], headers=_headers, params=_params, ) @@ -1931,10 +2150,9 @@ async def get_command_result( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1943,59 +2161,54 @@ async def get_command_result( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_command_result.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}"} # type: ignore - + get_command_result.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}"} # type: ignore @distributed_trace def list_outbound_network_dependencies_endpoints( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.OutboundEnvironmentEndpointCollection]: + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> AsyncIterable["_models.OutboundEnvironmentEndpoint"]: """Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster. Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster. The operation returns properties of each egress endpoint. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OutboundEnvironmentEndpointCollection or the - result of cls(response) + :return: An iterator like instance of either OutboundEnvironmentEndpoint or the result of + cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_07_01.models.OutboundEnvironmentEndpointCollection] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_07_01.models.OutboundEnvironmentEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_outbound_network_dependencies_endpoints_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_outbound_network_dependencies_endpoints.metadata['url'], + template_url=self.list_outbound_network_dependencies_endpoints.metadata["url"], headers=_headers, params=_params, ) @@ -2003,16 +2216,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_outbound_network_dependencies_endpoints_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -2028,10 +2236,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2041,8 +2247,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_outbound_network_dependencies_endpoints.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints"} # type: ignore + list_outbound_network_dependencies_endpoints.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/aio/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/aio/operations/_operations.py index 1f56b8faa7b1..d133805886f3 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/aio/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/aio/operations/_operations.py @@ -7,9 +7,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,9 +27,11 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._operations import build_list_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class Operations: """ .. warning:: @@ -42,38 +51,33 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.OperationListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.OperationValue"]: """Gets a list of operations. Gets a list of operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationListResult or the result of cls(response) + :return: An iterator like instance of either OperationValue or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_07_01.models.OperationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_07_01.models.OperationValue] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -81,13 +85,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -103,10 +105,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -116,8 +116,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.ContainerService/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ContainerService/operations"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/aio/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/aio/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/aio/operations/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/aio/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/aio/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/aio/operations/_private_endpoint_connections_operations.py index ac4f47bd6778..7cbe6f37ce51 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/aio/operations/_private_endpoint_connections_operations.py @@ -6,9 +6,15 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -20,10 +26,17 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._private_endpoint_connections_operations import build_delete_request_initial, build_get_request, build_list_request, build_update_request -T = TypeVar('T') +from ...operations._private_endpoint_connections_operations import ( + build_delete_request, + build_get_request, + build_list_request, + build_update_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class PrivateEndpointConnectionsOperations: """ .. warning:: @@ -43,46 +56,39 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async async def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnectionListResult: """Gets a list of private endpoint connections in the specified managed cluster. To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnectionListResult, or the result of cls(response) + :return: PrivateEndpointConnectionListResult or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_07_01.models.PrivateEndpointConnectionListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnectionListResult] - request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -90,69 +96,60 @@ async def list( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore - + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore @distributed_trace_async async def get( - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnection: """Gets the specified private endpoint connection. To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_07_01.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -160,75 +157,147 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - @distributed_trace_async + @overload async def update( self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, parameters: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateEndpointConnection: """Updates a private endpoint connection. Updates a private endpoint connection. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str - :param parameters: The updated private endpoint connection. + :param parameters: The updated private endpoint connection. Required. :type parameters: ~azure.mgmt.containerservice.v2021_07_01.models.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_07_01.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: The updated private endpoint connection. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_07_01.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: Union[_models.PrivateEndpointConnection, IO], + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: The updated private endpoint connection. Is either a model type or a IO + type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_07_01.models.PrivateEndpointConnection or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_07_01.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - _json = self._serialize.body(parameters, 'PrivateEndpointConnection') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateEndpointConnection") request = build_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update.metadata['url'], + content=_content, + template_url=self.update.metadata["url"], headers=_headers, params=_params, ) @@ -236,52 +305,43 @@ async def update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -289,10 +349,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -302,26 +361,21 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + async def begin_delete( + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes a private endpoint connection. Deletes a private endpoint connection. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -333,53 +387,46 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/aio/operations/_private_link_resources_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/aio/operations/_private_link_resources_operations.py index b2aaec80a485..bdc941b273a5 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/aio/operations/_private_link_resources_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/aio/operations/_private_link_resources_operations.py @@ -8,7 +8,13 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -19,9 +25,11 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._private_link_resources_operations import build_list_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class PrivateLinkResourcesOperations: """ .. warning:: @@ -41,46 +49,39 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async async def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.PrivateLinkResourcesListResult: """Gets a list of private link resources in the specified managed cluster. To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResourcesListResult, or the result of cls(response) + :return: PrivateLinkResourcesListResult or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_07_01.models.PrivateLinkResourcesListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResourcesListResult] - request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -88,22 +89,20 @@ async def list( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResourcesListResult', pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources"} # type: ignore - + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/aio/operations/_resolve_private_link_service_id_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/aio/operations/_resolve_private_link_service_id_operations.py index 72c94e17afd3..ab55d258bfe3 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/aio/operations/_resolve_private_link_service_id_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/aio/operations/_resolve_private_link_service_id_operations.py @@ -6,9 +6,15 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -19,9 +25,11 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._resolve_private_link_service_id_operations import build_post_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class ResolvePrivateLinkServiceIdOperations: """ .. warning:: @@ -41,52 +49,118 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async + @overload async def post( self, resource_group_name: str, resource_name: str, parameters: _models.PrivateLinkResource, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateLinkResource: """Gets the private link service ID for the specified managed cluster. Gets the private link service ID for the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters required in order to resolve a private link service ID. + :param parameters: Parameters required in order to resolve a private link service ID. Required. :type parameters: ~azure.mgmt.containerservice.v2021_07_01.models.PrivateLinkResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_07_01.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def post( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID for the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters required in order to resolve a private link service ID. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResource, or the result of cls(response) + :return: PrivateLinkResource or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_07_01.models.PrivateLinkResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @distributed_trace_async + async def post( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.PrivateLinkResource, IO], + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID for the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters required in order to resolve a private link service ID. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_07_01.models.PrivateLinkResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_07_01.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResource] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResource] - _json = self._serialize.body(parameters, 'PrivateLinkResource') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateLinkResource") request = build_post_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.post.metadata['url'], + content=_content, + template_url=self.post.metadata["url"], headers=_headers, params=_params, ) @@ -94,22 +168,20 @@ async def post( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResource', pipeline_response) + deserialized = self._deserialize("PrivateLinkResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - post.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId"} # type: ignore - + post.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/models/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/models/__init__.py index 6fa1f42d9634..061bc03b9fa6 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/models/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/models/__init__.py @@ -89,157 +89,155 @@ from ._models_py3 import TimeSpan from ._models_py3 import UserAssignedIdentity - -from ._container_service_client_enums import ( - AgentPoolMode, - AgentPoolType, - Code, - ConnectionStatus, - ContainerServiceStorageProfileTypes, - ContainerServiceVMSizeTypes, - Count, - CreatedByType, - Expander, - ExtendedLocationTypes, - GPUInstanceProfile, - KubeletDiskType, - LicenseType, - LoadBalancerSku, - ManagedClusterPodIdentityProvisioningState, - ManagedClusterSKUName, - ManagedClusterSKUTier, - NetworkMode, - NetworkPlugin, - NetworkPolicy, - OSDiskType, - OSSKU, - OSType, - OutboundType, - PrivateEndpointConnectionProvisioningState, - ResourceIdentityType, - ScaleDownMode, - ScaleSetEvictionPolicy, - ScaleSetPriority, - UpgradeChannel, - WeekDay, -) +from ._container_service_client_enums import AgentPoolMode +from ._container_service_client_enums import AgentPoolType +from ._container_service_client_enums import Code +from ._container_service_client_enums import ConnectionStatus +from ._container_service_client_enums import ContainerServiceStorageProfileTypes +from ._container_service_client_enums import ContainerServiceVMSizeTypes +from ._container_service_client_enums import Count +from ._container_service_client_enums import CreatedByType +from ._container_service_client_enums import Expander +from ._container_service_client_enums import ExtendedLocationTypes +from ._container_service_client_enums import GPUInstanceProfile +from ._container_service_client_enums import KubeletDiskType +from ._container_service_client_enums import LicenseType +from ._container_service_client_enums import LoadBalancerSku +from ._container_service_client_enums import ManagedClusterPodIdentityProvisioningState +from ._container_service_client_enums import ManagedClusterSKUName +from ._container_service_client_enums import ManagedClusterSKUTier +from ._container_service_client_enums import NetworkMode +from ._container_service_client_enums import NetworkPlugin +from ._container_service_client_enums import NetworkPolicy +from ._container_service_client_enums import OSDiskType +from ._container_service_client_enums import OSSKU +from ._container_service_client_enums import OSType +from ._container_service_client_enums import OutboundType +from ._container_service_client_enums import PrivateEndpointConnectionProvisioningState +from ._container_service_client_enums import ResourceIdentityType +from ._container_service_client_enums import ScaleDownMode +from ._container_service_client_enums import ScaleSetEvictionPolicy +from ._container_service_client_enums import ScaleSetPriority +from ._container_service_client_enums import UpgradeChannel +from ._container_service_client_enums import WeekDay from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'AgentPool', - 'AgentPoolAvailableVersions', - 'AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem', - 'AgentPoolListResult', - 'AgentPoolUpgradeProfile', - 'AgentPoolUpgradeProfilePropertiesUpgradesItem', - 'AgentPoolUpgradeSettings', - 'CloudErrorBody', - 'ContainerServiceDiagnosticsProfile', - 'ContainerServiceLinuxProfile', - 'ContainerServiceMasterProfile', - 'ContainerServiceNetworkProfile', - 'ContainerServiceSshConfiguration', - 'ContainerServiceSshPublicKey', - 'ContainerServiceVMDiagnostics', - 'CredentialResult', - 'CredentialResults', - 'EndpointDependency', - 'EndpointDetail', - 'ExtendedLocation', - 'KubeletConfig', - 'LinuxOSConfig', - 'MaintenanceConfiguration', - 'MaintenanceConfigurationListResult', - 'ManagedCluster', - 'ManagedClusterAADProfile', - 'ManagedClusterAPIServerAccessProfile', - 'ManagedClusterAccessProfile', - 'ManagedClusterAddonProfile', - 'ManagedClusterAddonProfileIdentity', - 'ManagedClusterAgentPoolProfile', - 'ManagedClusterAgentPoolProfileProperties', - 'ManagedClusterAutoUpgradeProfile', - 'ManagedClusterHTTPProxyConfig', - 'ManagedClusterIdentity', - 'ManagedClusterListResult', - 'ManagedClusterLoadBalancerProfile', - 'ManagedClusterLoadBalancerProfileManagedOutboundIPs', - 'ManagedClusterLoadBalancerProfileOutboundIPPrefixes', - 'ManagedClusterLoadBalancerProfileOutboundIPs', - 'ManagedClusterManagedOutboundIPProfile', - 'ManagedClusterNATGatewayProfile', - 'ManagedClusterPodIdentity', - 'ManagedClusterPodIdentityException', - 'ManagedClusterPodIdentityProfile', - 'ManagedClusterPodIdentityProvisioningError', - 'ManagedClusterPodIdentityProvisioningErrorBody', - 'ManagedClusterPodIdentityProvisioningInfo', - 'ManagedClusterPoolUpgradeProfile', - 'ManagedClusterPoolUpgradeProfileUpgradesItem', - 'ManagedClusterPropertiesAutoScalerProfile', - 'ManagedClusterSKU', - 'ManagedClusterSecurityProfile', - 'ManagedClusterSecurityProfileAzureDefender', - 'ManagedClusterServicePrincipalProfile', - 'ManagedClusterUpgradeProfile', - 'ManagedClusterWindowsProfile', - 'ManagedServiceIdentityUserAssignedIdentitiesValue', - 'OSOptionProfile', - 'OSOptionProperty', - 'OperationListResult', - 'OperationValue', - 'OutboundEnvironmentEndpoint', - 'OutboundEnvironmentEndpointCollection', - 'PowerState', - 'PrivateEndpoint', - 'PrivateEndpointConnection', - 'PrivateEndpointConnectionListResult', - 'PrivateLinkResource', - 'PrivateLinkResourcesListResult', - 'PrivateLinkServiceConnectionState', - 'Resource', - 'ResourceReference', - 'RunCommandRequest', - 'RunCommandResult', - 'SubResource', - 'SysctlConfig', - 'SystemData', - 'TagsObject', - 'TimeInWeek', - 'TimeSpan', - 'UserAssignedIdentity', - 'AgentPoolMode', - 'AgentPoolType', - 'Code', - 'ConnectionStatus', - 'ContainerServiceStorageProfileTypes', - 'ContainerServiceVMSizeTypes', - 'Count', - 'CreatedByType', - 'Expander', - 'ExtendedLocationTypes', - 'GPUInstanceProfile', - 'KubeletDiskType', - 'LicenseType', - 'LoadBalancerSku', - 'ManagedClusterPodIdentityProvisioningState', - 'ManagedClusterSKUName', - 'ManagedClusterSKUTier', - 'NetworkMode', - 'NetworkPlugin', - 'NetworkPolicy', - 'OSDiskType', - 'OSSKU', - 'OSType', - 'OutboundType', - 'PrivateEndpointConnectionProvisioningState', - 'ResourceIdentityType', - 'ScaleDownMode', - 'ScaleSetEvictionPolicy', - 'ScaleSetPriority', - 'UpgradeChannel', - 'WeekDay', + "AgentPool", + "AgentPoolAvailableVersions", + "AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem", + "AgentPoolListResult", + "AgentPoolUpgradeProfile", + "AgentPoolUpgradeProfilePropertiesUpgradesItem", + "AgentPoolUpgradeSettings", + "CloudErrorBody", + "ContainerServiceDiagnosticsProfile", + "ContainerServiceLinuxProfile", + "ContainerServiceMasterProfile", + "ContainerServiceNetworkProfile", + "ContainerServiceSshConfiguration", + "ContainerServiceSshPublicKey", + "ContainerServiceVMDiagnostics", + "CredentialResult", + "CredentialResults", + "EndpointDependency", + "EndpointDetail", + "ExtendedLocation", + "KubeletConfig", + "LinuxOSConfig", + "MaintenanceConfiguration", + "MaintenanceConfigurationListResult", + "ManagedCluster", + "ManagedClusterAADProfile", + "ManagedClusterAPIServerAccessProfile", + "ManagedClusterAccessProfile", + "ManagedClusterAddonProfile", + "ManagedClusterAddonProfileIdentity", + "ManagedClusterAgentPoolProfile", + "ManagedClusterAgentPoolProfileProperties", + "ManagedClusterAutoUpgradeProfile", + "ManagedClusterHTTPProxyConfig", + "ManagedClusterIdentity", + "ManagedClusterListResult", + "ManagedClusterLoadBalancerProfile", + "ManagedClusterLoadBalancerProfileManagedOutboundIPs", + "ManagedClusterLoadBalancerProfileOutboundIPPrefixes", + "ManagedClusterLoadBalancerProfileOutboundIPs", + "ManagedClusterManagedOutboundIPProfile", + "ManagedClusterNATGatewayProfile", + "ManagedClusterPodIdentity", + "ManagedClusterPodIdentityException", + "ManagedClusterPodIdentityProfile", + "ManagedClusterPodIdentityProvisioningError", + "ManagedClusterPodIdentityProvisioningErrorBody", + "ManagedClusterPodIdentityProvisioningInfo", + "ManagedClusterPoolUpgradeProfile", + "ManagedClusterPoolUpgradeProfileUpgradesItem", + "ManagedClusterPropertiesAutoScalerProfile", + "ManagedClusterSKU", + "ManagedClusterSecurityProfile", + "ManagedClusterSecurityProfileAzureDefender", + "ManagedClusterServicePrincipalProfile", + "ManagedClusterUpgradeProfile", + "ManagedClusterWindowsProfile", + "ManagedServiceIdentityUserAssignedIdentitiesValue", + "OSOptionProfile", + "OSOptionProperty", + "OperationListResult", + "OperationValue", + "OutboundEnvironmentEndpoint", + "OutboundEnvironmentEndpointCollection", + "PowerState", + "PrivateEndpoint", + "PrivateEndpointConnection", + "PrivateEndpointConnectionListResult", + "PrivateLinkResource", + "PrivateLinkResourcesListResult", + "PrivateLinkServiceConnectionState", + "Resource", + "ResourceReference", + "RunCommandRequest", + "RunCommandResult", + "SubResource", + "SysctlConfig", + "SystemData", + "TagsObject", + "TimeInWeek", + "TimeSpan", + "UserAssignedIdentity", + "AgentPoolMode", + "AgentPoolType", + "Code", + "ConnectionStatus", + "ContainerServiceStorageProfileTypes", + "ContainerServiceVMSizeTypes", + "Count", + "CreatedByType", + "Expander", + "ExtendedLocationTypes", + "GPUInstanceProfile", + "KubeletDiskType", + "LicenseType", + "LoadBalancerSku", + "ManagedClusterPodIdentityProvisioningState", + "ManagedClusterSKUName", + "ManagedClusterSKUTier", + "NetworkMode", + "NetworkPlugin", + "NetworkPolicy", + "OSDiskType", + "OSSKU", + "OSType", + "OutboundType", + "PrivateEndpointConnectionProvisioningState", + "ResourceIdentityType", + "ScaleDownMode", + "ScaleSetEvictionPolicy", + "ScaleSetPriority", + "UpgradeChannel", + "WeekDay", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/models/_container_service_client_enums.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/models/_container_service_client_enums.py index 2954de10e246..92b87806051c 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/models/_container_service_client_enums.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/models/_container_service_client_enums.py @@ -13,7 +13,7 @@ class AgentPoolMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools + https://docs.microsoft.com/azure/aks/use-system-pools. """ #: System agent pools are primarily for hosting critical system pods such as CoreDNS and @@ -23,33 +23,34 @@ class AgentPoolMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: User agent pools are primarily for hosting your application pods. USER = "User" + class AgentPoolType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of Agent Pool. - """ + """The type of Agent Pool.""" #: Create an Agent Pool backed by a Virtual Machine Scale Set. VIRTUAL_MACHINE_SCALE_SETS = "VirtualMachineScaleSets" #: Use of this is strongly discouraged. AVAILABILITY_SET = "AvailabilitySet" + class Code(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Tells whether the cluster is Running or Stopped - """ + """Tells whether the cluster is Running or Stopped.""" #: The cluster is running. RUNNING = "Running" #: The cluster is stopped. STOPPED = "Stopped" + class ConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The private link service connection status. - """ + """The private link service connection status.""" PENDING = "Pending" APPROVED = "Approved" REJECTED = "Rejected" DISCONNECTED = "Disconnected" + class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Specifies what kind of storage to use. If omitted, the default will be chosen on your behalf based on the choice of orchestrator. @@ -58,9 +59,9 @@ class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEn STORAGE_ACCOUNT = "StorageAccount" MANAGED_DISKS = "ManagedDisks" + class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Size of agent VMs. Note: This is no longer maintained. - """ + """Size of agent VMs. Note: This is no longer maintained.""" STANDARD_A1 = "Standard_A1" STANDARD_A10 = "Standard_A10" @@ -237,6 +238,7 @@ class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): STANDARD_NV24 = "Standard_NV24" STANDARD_NV6 = "Standard_NV6" + class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): """Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, and 5. The default value is 1. @@ -246,15 +248,16 @@ class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): THREE = 3 FIVE = 5 + class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of identity that created the resource. - """ + """The type of identity that created the resource.""" USER = "User" APPLICATION = "Application" MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" + class Expander(str, Enum, metaclass=CaseInsensitiveEnumMeta): """If not specified, the default is 'random'. See `expanders `_ @@ -278,15 +281,15 @@ class Expander(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Used when you don't have a particular need for the node groups to scale differently. RANDOM = "random" + class ExtendedLocationTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of extendedLocation. - """ + """The type of extendedLocation.""" EDGE_ZONE = "EdgeZone" + class GPUInstanceProfile(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """GPUInstanceProfile to be used to specify GPU MIG instance profile for supported GPU VM SKU. - """ + """GPUInstanceProfile to be used to specify GPU MIG instance profile for supported GPU VM SKU.""" MIG1_G = "MIG1g" MIG2_G = "MIG2g" @@ -294,6 +297,7 @@ class GPUInstanceProfile(str, Enum, metaclass=CaseInsensitiveEnumMeta): MIG4_G = "MIG4g" MIG7_G = "MIG7g" + class KubeletDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. @@ -304,6 +308,7 @@ class KubeletDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Kubelet will use the temporary disk for its data. TEMPORARY = "Temporary" + class LicenseType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The license type to use for Windows VMs. See `Azure Hybrid User Benefits `_ for more details. @@ -314,6 +319,7 @@ class LicenseType(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Enables Azure Hybrid User Benefits for Windows VMs. WINDOWS_SERVER = "Windows_Server" + class LoadBalancerSku(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The default is 'standard'. See `Azure Load Balancer SKUs `_ for more information about the @@ -327,21 +333,22 @@ class LoadBalancerSku(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Use a basic Load Balancer with limited functionality. BASIC = "basic" + class ManagedClusterPodIdentityProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The current provisioning state of the pod identity. - """ + """The current provisioning state of the pod identity.""" ASSIGNED = "Assigned" UPDATING = "Updating" DELETING = "Deleting" FAILED = "Failed" + class ManagedClusterSKUName(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The name of a managed cluster SKU. - """ + """The name of a managed cluster SKU.""" BASIC = "Basic" + class ManagedClusterSKUTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): """If not specified, the default is 'Free'. See `uptime SLA `_ for more details. @@ -353,20 +360,20 @@ class ManagedClusterSKUTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: No guaranteed SLA, no additional charges. Free tier clusters have an SLO of 99.5%. FREE = "Free" + class NetworkMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """This cannot be specified if networkPlugin is anything other than 'azure'. - """ + """This cannot be specified if networkPlugin is anything other than 'azure'.""" #: No bridge is created. Intra-VM Pod to Pod communication is through IP routes created by Azure #: CNI. See `Transparent Mode `_ for #: more information. TRANSPARENT = "transparent" - #: This is no longer supported. + #: This is no longer supported BRIDGE = "bridge" + class NetworkPlugin(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Network plugin used for building the Kubernetes network. - """ + """Network plugin used for building the Kubernetes network.""" #: Use the Azure CNI network plugin. See `Azure CNI (advanced) networking #: `_ for @@ -377,9 +384,9 @@ class NetworkPlugin(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: information. KUBENET = "kubenet" + class NetworkPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Network policy used for building the Kubernetes network. - """ + """Network policy used for building the Kubernetes network.""" #: Use Calico network policies. See `differences between Azure and Calico policies #: `_ @@ -390,6 +397,7 @@ class NetworkPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: for more information. AZURE = "azure" + class OSDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more @@ -406,22 +414,23 @@ class OSDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: provides lower read/write latency, along with faster node scaling and cluster upgrades. EPHEMERAL = "Ephemeral" + class OSSKU(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Specifies an OS SKU. This value must not be specified if OSType is Windows. - """ + """Specifies an OS SKU. This value must not be specified if OSType is Windows.""" UBUNTU = "Ubuntu" CBL_MARINER = "CBLMariner" + class OSType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The operating system type. The default is Linux. - """ + """The operating system type. The default is Linux.""" #: Use Linux. LINUX = "Linux" #: Use Windows. WINDOWS = "Windows" + class OutboundType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """This can only be set at cluster creation time and cannot be changed later. For more information see `egress outbound type `_. @@ -442,15 +451,16 @@ class OutboundType(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: advanced scenario and requires proper network configuration. USER_ASSIGNED_NAT_GATEWAY = "userAssignedNATGateway" + class PrivateEndpointConnectionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The current provisioning state. - """ + """The current provisioning state.""" SUCCEEDED = "Succeeded" CREATING = "Creating" DELETING = "Deleting" FAILED = "Failed" + class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """For more information see `use managed identities in AKS `_. @@ -467,6 +477,7 @@ class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Do not use a managed identity for the Managed Cluster, service principal will be used instead. NONE = "None" + class ScaleDownMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Describes how VMs are added to or removed from Agent Pools. See `billing states `_. @@ -478,10 +489,11 @@ class ScaleDownMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: during scale down. DEALLOCATE = "Deallocate" + class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The eviction policy specifies what to do with the VM when it is evicted. The default is Delete. For more information about eviction see `spot VMs - `_ + `_. """ #: Nodes in the underlying Scale Set of the node pool are deleted when they're evicted. @@ -491,9 +503,9 @@ class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: cause issues with cluster scaling or upgrading. DEALLOCATE = "Deallocate" + class ScaleSetPriority(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The Virtual Machine Scale Set priority. - """ + """The Virtual Machine Scale Set priority.""" #: Spot priority VMs will be used. There is no SLA for spot nodes. See `spot on AKS #: `_ for more information. @@ -501,6 +513,7 @@ class ScaleSetPriority(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Regular VMs will be used. REGULAR = "Regular" + class UpgradeChannel(str, Enum, metaclass=CaseInsensitiveEnumMeta): """For more information see `setting the AKS cluster auto-upgrade channel `_. @@ -531,9 +544,9 @@ class UpgradeChannel(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Disables auto-upgrades and keeps the cluster at its current version of Kubernetes. NONE = "none" + class WeekDay(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The weekday enum. - """ + """The weekday enum.""" SUNDAY = "Sunday" MONDAY = "Monday" diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/models/_models_py3.py index e3090b44cb1c..4e3c6210f7bb 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/models/_models_py3.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/models/_models_py3.py @@ -1,4 +1,5 @@ # coding=utf-8 +# pylint: disable=too-many-lines # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -9,14 +10,14 @@ import datetime from typing import Dict, List, Optional, TYPE_CHECKING, Union -import msrest.serialization +from ... import _serialization if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - import __init__ as _models + from .. import models as _models -class SubResource(msrest.serialization.Model): +class SubResource(_serialization.Model): """Reference to another subresource. Variables are only populated by the server, and will be ignored when sending a request. @@ -31,30 +32,26 @@ class SubResource(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(SubResource, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.id = None self.name = None self.type = None -class AgentPool(SubResource): +class AgentPool(SubResource): # pylint: disable=too-many-instance-attributes """Agent Pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -82,10 +79,10 @@ class AgentPool(SubResource): larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2021_07_01.models.OSDiskType :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data - root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2021_07_01.models.KubeletDiskType :ivar vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and used. @@ -99,11 +96,11 @@ class AgentPool(SubResource): :vartype pod_subnet_id: str :ivar max_pods: The maximum number of pods that can run on a node. :vartype max_pods: int - :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2021_07_01.models.OSType :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known - values are: "Ubuntu", "CBLMariner". + values are: "Ubuntu" and "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2021_07_01.models.OSSKU :ivar max_count: The maximum number of nodes for auto-scaling. :vartype max_count: int @@ -112,15 +109,15 @@ class AgentPool(SubResource): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it - defaults to Delete. Known values are: "Delete", "Deallocate". + defaults to Delete. Known values are: "Delete" and "Deallocate". :vartype scale_down_mode: str or ~azure.mgmt.containerservice.v2021_07_01.models.ScaleDownMode - :ivar type_properties_type: The type of Agent Pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + :ivar type_properties_type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets" + and "AvailabilitySet". :vartype type_properties_type: str or ~azure.mgmt.containerservice.v2021_07_01.models.AgentPoolType :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :vartype mode: str or ~azure.mgmt.containerservice.v2021_07_01.models.AgentPoolMode :ivar orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -152,20 +149,18 @@ class AgentPool(SubResource): /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default - is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + is 'Regular'. Known values are: "Spot" and "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2021_07_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2021_07_01.models.ScaleSetEvictionPolicy :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :vartype spot_max_price: float - :ivar tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :ivar tags: The tags to be persisted on the agent pool virtual machine scale set. :vartype tags: dict[str, str] :ivar node_labels: The node labels to be persisted across all nodes in agent pool. :vartype node_labels: dict[str, str] @@ -189,65 +184,65 @@ class AgentPool(SubResource): for more details. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2021_07_01.models.GPUInstanceProfile """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'os_disk_size_gb': {'maximum': 2048, 'minimum': 0}, - 'node_image_version': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'power_state': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "os_disk_size_gb": {"maximum": 2048, "minimum": 0}, + "node_image_version": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "power_state": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'count': {'key': 'properties.count', 'type': 'int'}, - 'vm_size': {'key': 'properties.vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'properties.osDiskSizeGB', 'type': 'int'}, - 'os_disk_type': {'key': 'properties.osDiskType', 'type': 'str'}, - 'kubelet_disk_type': {'key': 'properties.kubeletDiskType', 'type': 'str'}, - 'vnet_subnet_id': {'key': 'properties.vnetSubnetID', 'type': 'str'}, - 'pod_subnet_id': {'key': 'properties.podSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'properties.maxPods', 'type': 'int'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'os_sku': {'key': 'properties.osSKU', 'type': 'str'}, - 'max_count': {'key': 'properties.maxCount', 'type': 'int'}, - 'min_count': {'key': 'properties.minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'properties.enableAutoScaling', 'type': 'bool'}, - 'scale_down_mode': {'key': 'properties.scaleDownMode', 'type': 'str'}, - 'type_properties_type': {'key': 'properties.type', 'type': 'str'}, - 'mode': {'key': 'properties.mode', 'type': 'str'}, - 'orchestrator_version': {'key': 'properties.orchestratorVersion', 'type': 'str'}, - 'node_image_version': {'key': 'properties.nodeImageVersion', 'type': 'str'}, - 'upgrade_settings': {'key': 'properties.upgradeSettings', 'type': 'AgentPoolUpgradeSettings'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'power_state': {'key': 'properties.powerState', 'type': 'PowerState'}, - 'availability_zones': {'key': 'properties.availabilityZones', 'type': '[str]'}, - 'enable_node_public_ip': {'key': 'properties.enableNodePublicIP', 'type': 'bool'}, - 'node_public_ip_prefix_id': {'key': 'properties.nodePublicIPPrefixID', 'type': 'str'}, - 'scale_set_priority': {'key': 'properties.scaleSetPriority', 'type': 'str'}, - 'scale_set_eviction_policy': {'key': 'properties.scaleSetEvictionPolicy', 'type': 'str'}, - 'spot_max_price': {'key': 'properties.spotMaxPrice', 'type': 'float'}, - 'tags': {'key': 'properties.tags', 'type': '{str}'}, - 'node_labels': {'key': 'properties.nodeLabels', 'type': '{str}'}, - 'node_taints': {'key': 'properties.nodeTaints', 'type': '[str]'}, - 'proximity_placement_group_id': {'key': 'properties.proximityPlacementGroupID', 'type': 'str'}, - 'kubelet_config': {'key': 'properties.kubeletConfig', 'type': 'KubeletConfig'}, - 'linux_os_config': {'key': 'properties.linuxOSConfig', 'type': 'LinuxOSConfig'}, - 'enable_encryption_at_host': {'key': 'properties.enableEncryptionAtHost', 'type': 'bool'}, - 'enable_ultra_ssd': {'key': 'properties.enableUltraSSD', 'type': 'bool'}, - 'enable_fips': {'key': 'properties.enableFIPS', 'type': 'bool'}, - 'gpu_instance_profile': {'key': 'properties.gpuInstanceProfile', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "count": {"key": "properties.count", "type": "int"}, + "vm_size": {"key": "properties.vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "properties.osDiskSizeGB", "type": "int"}, + "os_disk_type": {"key": "properties.osDiskType", "type": "str"}, + "kubelet_disk_type": {"key": "properties.kubeletDiskType", "type": "str"}, + "vnet_subnet_id": {"key": "properties.vnetSubnetID", "type": "str"}, + "pod_subnet_id": {"key": "properties.podSubnetID", "type": "str"}, + "max_pods": {"key": "properties.maxPods", "type": "int"}, + "os_type": {"key": "properties.osType", "type": "str"}, + "os_sku": {"key": "properties.osSKU", "type": "str"}, + "max_count": {"key": "properties.maxCount", "type": "int"}, + "min_count": {"key": "properties.minCount", "type": "int"}, + "enable_auto_scaling": {"key": "properties.enableAutoScaling", "type": "bool"}, + "scale_down_mode": {"key": "properties.scaleDownMode", "type": "str"}, + "type_properties_type": {"key": "properties.type", "type": "str"}, + "mode": {"key": "properties.mode", "type": "str"}, + "orchestrator_version": {"key": "properties.orchestratorVersion", "type": "str"}, + "node_image_version": {"key": "properties.nodeImageVersion", "type": "str"}, + "upgrade_settings": {"key": "properties.upgradeSettings", "type": "AgentPoolUpgradeSettings"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "power_state": {"key": "properties.powerState", "type": "PowerState"}, + "availability_zones": {"key": "properties.availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "properties.enableNodePublicIP", "type": "bool"}, + "node_public_ip_prefix_id": {"key": "properties.nodePublicIPPrefixID", "type": "str"}, + "scale_set_priority": {"key": "properties.scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "properties.scaleSetEvictionPolicy", "type": "str"}, + "spot_max_price": {"key": "properties.spotMaxPrice", "type": "float"}, + "tags": {"key": "properties.tags", "type": "{str}"}, + "node_labels": {"key": "properties.nodeLabels", "type": "{str}"}, + "node_taints": {"key": "properties.nodeTaints", "type": "[str]"}, + "proximity_placement_group_id": {"key": "properties.proximityPlacementGroupID", "type": "str"}, + "kubelet_config": {"key": "properties.kubeletConfig", "type": "KubeletConfig"}, + "linux_os_config": {"key": "properties.linuxOSConfig", "type": "LinuxOSConfig"}, + "enable_encryption_at_host": {"key": "properties.enableEncryptionAtHost", "type": "bool"}, + "enable_ultra_ssd": {"key": "properties.enableUltraSSD", "type": "bool"}, + "enable_fips": {"key": "properties.enableFIPS", "type": "bool"}, + "gpu_instance_profile": {"key": "properties.gpuInstanceProfile", "type": "str"}, } - def __init__( + def __init__( # pylint: disable=too-many-locals self, *, count: Optional[int] = None, @@ -258,7 +253,7 @@ def __init__( vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, @@ -271,9 +266,9 @@ def __init__( availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", - spot_max_price: Optional[float] = -1, + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", + spot_max_price: float = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, @@ -303,10 +298,10 @@ def __init__( larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2021_07_01.models.OSDiskType :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime - data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + data root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2021_07_01.models.KubeletDiskType :keyword vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and @@ -320,11 +315,11 @@ def __init__( :paramtype pod_subnet_id: str :keyword max_pods: The maximum number of pods that can run on a node. :paramtype max_pods: int - :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2021_07_01.models.OSType :keyword os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Known values are: "Ubuntu", "CBLMariner". + Known values are: "Ubuntu" and "CBLMariner". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2021_07_01.models.OSSKU :keyword max_count: The maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -333,16 +328,16 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, - it defaults to Delete. Known values are: "Delete", "Deallocate". + it defaults to Delete. Known values are: "Delete" and "Deallocate". :paramtype scale_down_mode: str or ~azure.mgmt.containerservice.v2021_07_01.models.ScaleDownMode :keyword type_properties_type: The type of Agent Pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type_properties_type: str or ~azure.mgmt.containerservice.v2021_07_01.models.AgentPoolType :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2021_07_01.models.AgentPoolMode :keyword orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -368,20 +363,18 @@ def __init__( /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the - default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + default is 'Regular'. Known values are: "Spot" and "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2021_07_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2021_07_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :paramtype spot_max_price: float - :keyword tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :keyword tags: The tags to be persisted on the agent pool virtual machine scale set. :paramtype tags: dict[str, str] :keyword node_labels: The node labels to be persisted across all nodes in agent pool. :paramtype node_labels: dict[str, str] @@ -405,12 +398,12 @@ def __init__( for more details. :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance - profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2021_07_01.models.GPUInstanceProfile """ - super(AgentPool, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.vm_size = vm_size self.os_disk_size_gb = os_disk_size_gb @@ -450,7 +443,7 @@ def __init__( self.gpu_instance_profile = gpu_instance_profile -class AgentPoolAvailableVersions(msrest.serialization.Model): +class AgentPoolAvailableVersions(_serialization.Model): """The list of available versions for an agent pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -467,16 +460,19 @@ class AgentPoolAvailableVersions(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'agent_pool_versions': {'key': 'properties.agentPoolVersions', 'type': '[AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "agent_pool_versions": { + "key": "properties.agentPoolVersions", + "type": "[AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem]", + }, } def __init__( @@ -490,14 +486,14 @@ def __init__( :paramtype agent_pool_versions: list[~azure.mgmt.containerservice.v2021_07_01.models.AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem] """ - super(AgentPoolAvailableVersions, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None self.agent_pool_versions = agent_pool_versions -class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(msrest.serialization.Model): +class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(_serialization.Model): """AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem. :ivar default: Whether this version is the default agent pool version. @@ -509,9 +505,9 @@ class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(msrest.serializa """ _attribute_map = { - 'default': {'key': 'default', 'type': 'bool'}, - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "default": {"key": "default", "type": "bool"}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } def __init__( @@ -530,13 +526,13 @@ def __init__( :keyword is_preview: Whether Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.default = default self.kubernetes_version = kubernetes_version self.is_preview = is_preview -class AgentPoolListResult(msrest.serialization.Model): +class AgentPoolListResult(_serialization.Model): """The response from the List Agent Pools operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -548,30 +544,25 @@ class AgentPoolListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[AgentPool]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[AgentPool]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.AgentPool"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.AgentPool"]] = None, **kwargs): """ :keyword value: The list of agent pools. :paramtype value: list[~azure.mgmt.containerservice.v2021_07_01.models.AgentPool] """ - super(AgentPoolListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class AgentPoolUpgradeProfile(msrest.serialization.Model): +class AgentPoolUpgradeProfile(_serialization.Model): """The list of available upgrades for an agent pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -584,10 +575,10 @@ class AgentPoolUpgradeProfile(msrest.serialization.Model): :vartype name: str :ivar type: The type of the agent pool upgrade profile. :vartype type: str - :ivar kubernetes_version: Required. The Kubernetes version (major.minor.patch). + :ivar kubernetes_version: The Kubernetes version (major.minor.patch). Required. :vartype kubernetes_version: str - :ivar os_type: Required. The operating system type. The default is Linux. Known values are: - "Linux", "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2021_07_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -597,21 +588,21 @@ class AgentPoolUpgradeProfile(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kubernetes_version': {'required': True}, - 'os_type': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "kubernetes_version": {"required": True}, + "os_type": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'kubernetes_version': {'key': 'properties.kubernetesVersion', 'type': 'str'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'upgrades': {'key': 'properties.upgrades', 'type': '[AgentPoolUpgradeProfilePropertiesUpgradesItem]'}, - 'latest_node_image_version': {'key': 'properties.latestNodeImageVersion', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "os_type": {"key": "properties.osType", "type": "str"}, + "upgrades": {"key": "properties.upgrades", "type": "[AgentPoolUpgradeProfilePropertiesUpgradesItem]"}, + "latest_node_image_version": {"key": "properties.latestNodeImageVersion", "type": "str"}, } def __init__( @@ -624,10 +615,10 @@ def __init__( **kwargs ): """ - :keyword kubernetes_version: Required. The Kubernetes version (major.minor.patch). + :keyword kubernetes_version: The Kubernetes version (major.minor.patch). Required. :paramtype kubernetes_version: str - :keyword os_type: Required. The operating system type. The default is Linux. Known values are: - "Linux", "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2021_07_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: @@ -635,7 +626,7 @@ def __init__( :keyword latest_node_image_version: The latest AKS supported node image version. :paramtype latest_node_image_version: str """ - super(AgentPoolUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -645,7 +636,7 @@ def __init__( self.latest_node_image_version = latest_node_image_version -class AgentPoolUpgradeProfilePropertiesUpgradesItem(msrest.serialization.Model): +class AgentPoolUpgradeProfilePropertiesUpgradesItem(_serialization.Model): """AgentPoolUpgradeProfilePropertiesUpgradesItem. :ivar kubernetes_version: The Kubernetes version (major.minor.patch). @@ -655,29 +646,23 @@ class AgentPoolUpgradeProfilePropertiesUpgradesItem(msrest.serialization.Model): """ _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } - def __init__( - self, - *, - kubernetes_version: Optional[str] = None, - is_preview: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, kubernetes_version: Optional[str] = None, is_preview: Optional[bool] = None, **kwargs): """ :keyword kubernetes_version: The Kubernetes version (major.minor.patch). :paramtype kubernetes_version: str :keyword is_preview: Whether the Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(AgentPoolUpgradeProfilePropertiesUpgradesItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.is_preview = is_preview -class AgentPoolUpgradeSettings(msrest.serialization.Model): +class AgentPoolUpgradeSettings(_serialization.Model): """Settings for upgrading an agentpool. :ivar max_surge: This can either be set to an integer (e.g. '5') or a percentage (e.g. '50%'). @@ -689,15 +674,10 @@ class AgentPoolUpgradeSettings(msrest.serialization.Model): """ _attribute_map = { - 'max_surge': {'key': 'maxSurge', 'type': 'str'}, + "max_surge": {"key": "maxSurge", "type": "str"}, } - def __init__( - self, - *, - max_surge: Optional[str] = None, - **kwargs - ): + def __init__(self, *, max_surge: Optional[str] = None, **kwargs): """ :keyword max_surge: This can either be set to an integer (e.g. '5') or a percentage (e.g. '50%'). If a percentage is specified, it is the percentage of the total agent pool size at the @@ -706,11 +686,11 @@ def __init__( https://docs.microsoft.com/azure/aks/upgrade-cluster#customize-node-surge-upgrade. :paramtype max_surge: str """ - super(AgentPoolUpgradeSettings, self).__init__(**kwargs) + super().__init__(**kwargs) self.max_surge = max_surge -class CloudErrorBody(msrest.serialization.Model): +class CloudErrorBody(_serialization.Model): """An error response from the Container service. :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed @@ -727,10 +707,10 @@ class CloudErrorBody(msrest.serialization.Model): """ _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[CloudErrorBody]"}, } def __init__( @@ -755,87 +735,76 @@ def __init__( :keyword details: A list of additional details about the error. :paramtype details: list[~azure.mgmt.containerservice.v2021_07_01.models.CloudErrorBody] """ - super(CloudErrorBody, self).__init__(**kwargs) + super().__init__(**kwargs) self.code = code self.message = message self.target = target self.details = details -class ContainerServiceDiagnosticsProfile(msrest.serialization.Model): +class ContainerServiceDiagnosticsProfile(_serialization.Model): """Profile for diagnostics on the container service cluster. All required parameters must be populated in order to send to Azure. - :ivar vm_diagnostics: Required. Profile for diagnostics on the container service VMs. + :ivar vm_diagnostics: Profile for diagnostics on the container service VMs. Required. :vartype vm_diagnostics: ~azure.mgmt.containerservice.v2021_07_01.models.ContainerServiceVMDiagnostics """ _validation = { - 'vm_diagnostics': {'required': True}, + "vm_diagnostics": {"required": True}, } _attribute_map = { - 'vm_diagnostics': {'key': 'vmDiagnostics', 'type': 'ContainerServiceVMDiagnostics'}, + "vm_diagnostics": {"key": "vmDiagnostics", "type": "ContainerServiceVMDiagnostics"}, } - def __init__( - self, - *, - vm_diagnostics: "_models.ContainerServiceVMDiagnostics", - **kwargs - ): + def __init__(self, *, vm_diagnostics: "_models.ContainerServiceVMDiagnostics", **kwargs): """ - :keyword vm_diagnostics: Required. Profile for diagnostics on the container service VMs. + :keyword vm_diagnostics: Profile for diagnostics on the container service VMs. Required. :paramtype vm_diagnostics: ~azure.mgmt.containerservice.v2021_07_01.models.ContainerServiceVMDiagnostics """ - super(ContainerServiceDiagnosticsProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.vm_diagnostics = vm_diagnostics -class ContainerServiceLinuxProfile(msrest.serialization.Model): +class ContainerServiceLinuxProfile(_serialization.Model): """Profile for Linux VMs in the container service cluster. All required parameters must be populated in order to send to Azure. - :ivar admin_username: Required. The administrator username to use for Linux VMs. + :ivar admin_username: The administrator username to use for Linux VMs. Required. :vartype admin_username: str - :ivar ssh: Required. The SSH configuration for Linux-based VMs running on Azure. + :ivar ssh: The SSH configuration for Linux-based VMs running on Azure. Required. :vartype ssh: ~azure.mgmt.containerservice.v2021_07_01.models.ContainerServiceSshConfiguration """ _validation = { - 'admin_username': {'required': True, 'pattern': r'^[A-Za-z][-A-Za-z0-9_]*$'}, - 'ssh': {'required': True}, + "admin_username": {"required": True, "pattern": r"^[A-Za-z][-A-Za-z0-9_]*$"}, + "ssh": {"required": True}, } _attribute_map = { - 'admin_username': {'key': 'adminUsername', 'type': 'str'}, - 'ssh': {'key': 'ssh', 'type': 'ContainerServiceSshConfiguration'}, + "admin_username": {"key": "adminUsername", "type": "str"}, + "ssh": {"key": "ssh", "type": "ContainerServiceSshConfiguration"}, } - def __init__( - self, - *, - admin_username: str, - ssh: "_models.ContainerServiceSshConfiguration", - **kwargs - ): + def __init__(self, *, admin_username: str, ssh: "_models.ContainerServiceSshConfiguration", **kwargs): """ - :keyword admin_username: Required. The administrator username to use for Linux VMs. + :keyword admin_username: The administrator username to use for Linux VMs. Required. :paramtype admin_username: str - :keyword ssh: Required. The SSH configuration for Linux-based VMs running on Azure. + :keyword ssh: The SSH configuration for Linux-based VMs running on Azure. Required. :paramtype ssh: ~azure.mgmt.containerservice.v2021_07_01.models.ContainerServiceSshConfiguration """ - super(ContainerServiceLinuxProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.admin_username = admin_username self.ssh = ssh -class ContainerServiceMasterProfile(msrest.serialization.Model): +class ContainerServiceMasterProfile(_serialization.Model): """Profile for the container service master. Variables are only populated by the server, and will be ignored when sending a request. @@ -843,11 +812,11 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar count: Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, - and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". + and 5. The default value is 1. Known values are: 1, 3, and 5. :vartype count: int or ~azure.mgmt.containerservice.v2021_07_01.models.Count - :ivar dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. + :ivar dns_prefix: DNS prefix to be used to create the FQDN for the master pool. Required. :vartype dns_prefix: str - :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + :ivar vm_size: Size of agent VMs. Required. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -884,7 +853,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :vartype vm_size: str or ~azure.mgmt.containerservice.v2021_07_01.models.ContainerServiceVMSizeTypes :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine @@ -898,7 +867,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): :vartype first_consecutive_static_ip: str :ivar storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount" and "ManagedDisks". :vartype storage_profile: str or ~azure.mgmt.containerservice.v2021_07_01.models.ContainerServiceStorageProfileTypes :ivar fqdn: FQDN for the master pool. @@ -906,21 +875,21 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): """ _validation = { - 'dns_prefix': {'required': True}, - 'vm_size': {'required': True}, - 'os_disk_size_gb': {'maximum': 2048, 'minimum': 0}, - 'fqdn': {'readonly': True}, + "dns_prefix": {"required": True}, + "vm_size": {"required": True}, + "os_disk_size_gb": {"maximum": 2048, "minimum": 0}, + "fqdn": {"readonly": True}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'dns_prefix': {'key': 'dnsPrefix', 'type': 'str'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'first_consecutive_static_ip': {'key': 'firstConsecutiveStaticIP', 'type': 'str'}, - 'storage_profile': {'key': 'storageProfile', 'type': 'str'}, - 'fqdn': {'key': 'fqdn', 'type': 'str'}, + "count": {"key": "count", "type": "int"}, + "dns_prefix": {"key": "dnsPrefix", "type": "str"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "first_consecutive_static_ip": {"key": "firstConsecutiveStaticIP", "type": "str"}, + "storage_profile": {"key": "storageProfile", "type": "str"}, + "fqdn": {"key": "fqdn", "type": "str"}, } def __init__( @@ -928,20 +897,20 @@ def __init__( *, dns_prefix: str, vm_size: Union[str, "_models.ContainerServiceVMSizeTypes"], - count: Optional[Union[int, "_models.Count"]] = 1, + count: Union[int, "_models.Count"] = 1, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, - first_consecutive_static_ip: Optional[str] = "10.240.255.5", + first_consecutive_static_ip: str = "10.240.255.5", storage_profile: Optional[Union[str, "_models.ContainerServiceStorageProfileTypes"]] = None, **kwargs ): """ :keyword count: Number of masters (VMs) in the container service cluster. Allowed values are 1, - 3, and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". + 3, and 5. The default value is 1. Known values are: 1, 3, and 5. :paramtype count: int or ~azure.mgmt.containerservice.v2021_07_01.models.Count - :keyword dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. + :keyword dns_prefix: DNS prefix to be used to create the FQDN for the master pool. Required. :paramtype dns_prefix: str - :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + :keyword vm_size: Size of agent VMs. Required. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -978,7 +947,7 @@ def __init__( "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :paramtype vm_size: str or ~azure.mgmt.containerservice.v2021_07_01.models.ContainerServiceVMSizeTypes :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every @@ -992,11 +961,11 @@ def __init__( :paramtype first_consecutive_static_ip: str :keyword storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount" and "ManagedDisks". :paramtype storage_profile: str or ~azure.mgmt.containerservice.v2021_07_01.models.ContainerServiceStorageProfileTypes """ - super(ContainerServiceMasterProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.dns_prefix = dns_prefix self.vm_size = vm_size @@ -1007,17 +976,17 @@ def __init__( self.fqdn = None -class ContainerServiceNetworkProfile(msrest.serialization.Model): +class ContainerServiceNetworkProfile(_serialization.Model): # pylint: disable=too-many-instance-attributes """Profile of network configuration. :ivar network_plugin: Network plugin used for building the Kubernetes network. Known values - are: "azure", "kubenet". Default value: "kubenet". + are: "azure" and "kubenet". :vartype network_plugin: str or ~azure.mgmt.containerservice.v2021_07_01.models.NetworkPlugin :ivar network_policy: Network policy used for building the Kubernetes network. Known values - are: "calico", "azure". + are: "calico" and "azure". :vartype network_policy: str or ~azure.mgmt.containerservice.v2021_07_01.models.NetworkPolicy :ivar network_mode: This cannot be specified if networkPlugin is anything other than 'azure'. - Known values are: "transparent", "bridge". + Known values are: "transparent" and "bridge". :vartype network_mode: str or ~azure.mgmt.containerservice.v2021_07_01.models.NetworkMode :ivar pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :vartype pod_cidr: str @@ -1033,12 +1002,11 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): :ivar outbound_type: This can only be set at cluster creation time and cannot be changed later. For more information see `egress outbound type `_. Known values are: "loadBalancer", - "userDefinedRouting", "managedNATGateway", "userAssignedNATGateway". Default value: - "loadBalancer". + "userDefinedRouting", "managedNATGateway", and "userAssignedNATGateway". :vartype outbound_type: str or ~azure.mgmt.containerservice.v2021_07_01.models.OutboundType :ivar load_balancer_sku: The default is 'standard'. See `Azure Load Balancer SKUs `_ for more information about the - differences between load balancer SKUs. Known values are: "standard", "basic". + differences between load balancer SKUs. Known values are: "standard" and "basic". :vartype load_balancer_sku: str or ~azure.mgmt.containerservice.v2021_07_01.models.LoadBalancerSku :ivar load_balancer_profile: Profile of the cluster load balancer. @@ -1050,37 +1018,39 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): """ _validation = { - 'pod_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, - 'service_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, - 'dns_service_ip': {'pattern': r'^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$'}, - 'docker_bridge_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, + "pod_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, + "service_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, + "dns_service_ip": { + "pattern": r"^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$" + }, + "docker_bridge_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, } _attribute_map = { - 'network_plugin': {'key': 'networkPlugin', 'type': 'str'}, - 'network_policy': {'key': 'networkPolicy', 'type': 'str'}, - 'network_mode': {'key': 'networkMode', 'type': 'str'}, - 'pod_cidr': {'key': 'podCidr', 'type': 'str'}, - 'service_cidr': {'key': 'serviceCidr', 'type': 'str'}, - 'dns_service_ip': {'key': 'dnsServiceIP', 'type': 'str'}, - 'docker_bridge_cidr': {'key': 'dockerBridgeCidr', 'type': 'str'}, - 'outbound_type': {'key': 'outboundType', 'type': 'str'}, - 'load_balancer_sku': {'key': 'loadBalancerSku', 'type': 'str'}, - 'load_balancer_profile': {'key': 'loadBalancerProfile', 'type': 'ManagedClusterLoadBalancerProfile'}, - 'nat_gateway_profile': {'key': 'natGatewayProfile', 'type': 'ManagedClusterNATGatewayProfile'}, + "network_plugin": {"key": "networkPlugin", "type": "str"}, + "network_policy": {"key": "networkPolicy", "type": "str"}, + "network_mode": {"key": "networkMode", "type": "str"}, + "pod_cidr": {"key": "podCidr", "type": "str"}, + "service_cidr": {"key": "serviceCidr", "type": "str"}, + "dns_service_ip": {"key": "dnsServiceIP", "type": "str"}, + "docker_bridge_cidr": {"key": "dockerBridgeCidr", "type": "str"}, + "outbound_type": {"key": "outboundType", "type": "str"}, + "load_balancer_sku": {"key": "loadBalancerSku", "type": "str"}, + "load_balancer_profile": {"key": "loadBalancerProfile", "type": "ManagedClusterLoadBalancerProfile"}, + "nat_gateway_profile": {"key": "natGatewayProfile", "type": "ManagedClusterNATGatewayProfile"}, } def __init__( self, *, - network_plugin: Optional[Union[str, "_models.NetworkPlugin"]] = "kubenet", + network_plugin: Union[str, "_models.NetworkPlugin"] = "kubenet", network_policy: Optional[Union[str, "_models.NetworkPolicy"]] = None, network_mode: Optional[Union[str, "_models.NetworkMode"]] = None, - pod_cidr: Optional[str] = "10.244.0.0/16", - service_cidr: Optional[str] = "10.0.0.0/16", - dns_service_ip: Optional[str] = "10.0.0.10", - docker_bridge_cidr: Optional[str] = "172.17.0.1/16", - outbound_type: Optional[Union[str, "_models.OutboundType"]] = "loadBalancer", + pod_cidr: str = "10.244.0.0/16", + service_cidr: str = "10.0.0.0/16", + dns_service_ip: str = "10.0.0.10", + docker_bridge_cidr: str = "172.17.0.1/16", + outbound_type: Union[str, "_models.OutboundType"] = "loadBalancer", load_balancer_sku: Optional[Union[str, "_models.LoadBalancerSku"]] = None, load_balancer_profile: Optional["_models.ManagedClusterLoadBalancerProfile"] = None, nat_gateway_profile: Optional["_models.ManagedClusterNATGatewayProfile"] = None, @@ -1088,13 +1058,13 @@ def __init__( ): """ :keyword network_plugin: Network plugin used for building the Kubernetes network. Known values - are: "azure", "kubenet". Default value: "kubenet". + are: "azure" and "kubenet". :paramtype network_plugin: str or ~azure.mgmt.containerservice.v2021_07_01.models.NetworkPlugin :keyword network_policy: Network policy used for building the Kubernetes network. Known values - are: "calico", "azure". + are: "calico" and "azure". :paramtype network_policy: str or ~azure.mgmt.containerservice.v2021_07_01.models.NetworkPolicy :keyword network_mode: This cannot be specified if networkPlugin is anything other than - 'azure'. Known values are: "transparent", "bridge". + 'azure'. Known values are: "transparent" and "bridge". :paramtype network_mode: str or ~azure.mgmt.containerservice.v2021_07_01.models.NetworkMode :keyword pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :paramtype pod_cidr: str @@ -1110,12 +1080,11 @@ def __init__( :keyword outbound_type: This can only be set at cluster creation time and cannot be changed later. For more information see `egress outbound type `_. Known values are: "loadBalancer", - "userDefinedRouting", "managedNATGateway", "userAssignedNATGateway". Default value: - "loadBalancer". + "userDefinedRouting", "managedNATGateway", and "userAssignedNATGateway". :paramtype outbound_type: str or ~azure.mgmt.containerservice.v2021_07_01.models.OutboundType :keyword load_balancer_sku: The default is 'standard'. See `Azure Load Balancer SKUs `_ for more information about the - differences between load balancer SKUs. Known values are: "standard", "basic". + differences between load balancer SKUs. Known values are: "standard" and "basic". :paramtype load_balancer_sku: str or ~azure.mgmt.containerservice.v2021_07_01.models.LoadBalancerSku :keyword load_balancer_profile: Profile of the cluster load balancer. @@ -1125,7 +1094,7 @@ def __init__( :paramtype nat_gateway_profile: ~azure.mgmt.containerservice.v2021_07_01.models.ManagedClusterNATGatewayProfile """ - super(ContainerServiceNetworkProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.network_plugin = network_plugin self.network_policy = network_policy self.network_mode = network_mode @@ -1139,113 +1108,98 @@ def __init__( self.nat_gateway_profile = nat_gateway_profile -class ContainerServiceSshConfiguration(msrest.serialization.Model): +class ContainerServiceSshConfiguration(_serialization.Model): """SSH configuration for Linux-based VMs running on Azure. All required parameters must be populated in order to send to Azure. - :ivar public_keys: Required. The list of SSH public keys used to authenticate with Linux-based - VMs. A maximum of 1 key may be specified. + :ivar public_keys: The list of SSH public keys used to authenticate with Linux-based VMs. A + maximum of 1 key may be specified. Required. :vartype public_keys: list[~azure.mgmt.containerservice.v2021_07_01.models.ContainerServiceSshPublicKey] """ _validation = { - 'public_keys': {'required': True}, + "public_keys": {"required": True}, } _attribute_map = { - 'public_keys': {'key': 'publicKeys', 'type': '[ContainerServiceSshPublicKey]'}, + "public_keys": {"key": "publicKeys", "type": "[ContainerServiceSshPublicKey]"}, } - def __init__( - self, - *, - public_keys: List["_models.ContainerServiceSshPublicKey"], - **kwargs - ): + def __init__(self, *, public_keys: List["_models.ContainerServiceSshPublicKey"], **kwargs): """ - :keyword public_keys: Required. The list of SSH public keys used to authenticate with - Linux-based VMs. A maximum of 1 key may be specified. + :keyword public_keys: The list of SSH public keys used to authenticate with Linux-based VMs. A + maximum of 1 key may be specified. Required. :paramtype public_keys: list[~azure.mgmt.containerservice.v2021_07_01.models.ContainerServiceSshPublicKey] """ - super(ContainerServiceSshConfiguration, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_keys = public_keys -class ContainerServiceSshPublicKey(msrest.serialization.Model): +class ContainerServiceSshPublicKey(_serialization.Model): """Contains information about SSH certificate public key data. All required parameters must be populated in order to send to Azure. - :ivar key_data: Required. Certificate public key used to authenticate with VMs through SSH. The - certificate must be in PEM format with or without headers. + :ivar key_data: Certificate public key used to authenticate with VMs through SSH. The + certificate must be in PEM format with or without headers. Required. :vartype key_data: str """ _validation = { - 'key_data': {'required': True}, + "key_data": {"required": True}, } _attribute_map = { - 'key_data': {'key': 'keyData', 'type': 'str'}, + "key_data": {"key": "keyData", "type": "str"}, } - def __init__( - self, - *, - key_data: str, - **kwargs - ): + def __init__(self, *, key_data: str, **kwargs): """ - :keyword key_data: Required. Certificate public key used to authenticate with VMs through SSH. - The certificate must be in PEM format with or without headers. + :keyword key_data: Certificate public key used to authenticate with VMs through SSH. The + certificate must be in PEM format with or without headers. Required. :paramtype key_data: str """ - super(ContainerServiceSshPublicKey, self).__init__(**kwargs) + super().__init__(**kwargs) self.key_data = key_data -class ContainerServiceVMDiagnostics(msrest.serialization.Model): +class ContainerServiceVMDiagnostics(_serialization.Model): """Profile for diagnostics on the container service VMs. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar enabled: Required. Whether the VM diagnostic agent is provisioned on the VM. + :ivar enabled: Whether the VM diagnostic agent is provisioned on the VM. Required. :vartype enabled: bool :ivar storage_uri: The URI of the storage account where diagnostics are stored. :vartype storage_uri: str """ _validation = { - 'enabled': {'required': True}, - 'storage_uri': {'readonly': True}, + "enabled": {"required": True}, + "storage_uri": {"readonly": True}, } _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'storage_uri': {'key': 'storageUri', 'type': 'str'}, + "enabled": {"key": "enabled", "type": "bool"}, + "storage_uri": {"key": "storageUri", "type": "str"}, } - def __init__( - self, - *, - enabled: bool, - **kwargs - ): + def __init__(self, *, enabled: bool, **kwargs): """ - :keyword enabled: Required. Whether the VM diagnostic agent is provisioned on the VM. + :keyword enabled: Whether the VM diagnostic agent is provisioned on the VM. Required. :paramtype enabled: bool """ - super(ContainerServiceVMDiagnostics, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.storage_uri = None -class CredentialResult(msrest.serialization.Model): +class CredentialResult(_serialization.Model): """The credential result response. Variables are only populated by the server, and will be ignored when sending a request. @@ -1253,31 +1207,27 @@ class CredentialResult(msrest.serialization.Model): :ivar name: The name of the credential. :vartype name: str :ivar value: Base64-encoded Kubernetes configuration file. - :vartype value: bytearray + :vartype value: bytes """ _validation = { - 'name': {'readonly': True}, - 'value': {'readonly': True}, + "name": {"readonly": True}, + "value": {"readonly": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'bytearray'}, + "name": {"key": "name", "type": "str"}, + "value": {"key": "value", "type": "bytearray"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(CredentialResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.name = None self.value = None -class CredentialResults(msrest.serialization.Model): +class CredentialResults(_serialization.Model): """The list credential result response. Variables are only populated by the server, and will be ignored when sending a request. @@ -1287,24 +1237,20 @@ class CredentialResults(msrest.serialization.Model): """ _validation = { - 'kubeconfigs': {'readonly': True}, + "kubeconfigs": {"readonly": True}, } _attribute_map = { - 'kubeconfigs': {'key': 'kubeconfigs', 'type': '[CredentialResult]'}, + "kubeconfigs": {"key": "kubeconfigs", "type": "[CredentialResult]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(CredentialResults, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.kubeconfigs = None -class EndpointDependency(msrest.serialization.Model): +class EndpointDependency(_serialization.Model): """A domain name that AKS agent nodes are reaching at. :ivar domain_name: The domain name of the dependency. @@ -1314,8 +1260,8 @@ class EndpointDependency(msrest.serialization.Model): """ _attribute_map = { - 'domain_name': {'key': 'domainName', 'type': 'str'}, - 'endpoint_details': {'key': 'endpointDetails', 'type': '[EndpointDetail]'}, + "domain_name": {"key": "domainName", "type": "str"}, + "endpoint_details": {"key": "endpointDetails", "type": "[EndpointDetail]"}, } def __init__( @@ -1332,12 +1278,12 @@ def __init__( :paramtype endpoint_details: list[~azure.mgmt.containerservice.v2021_07_01.models.EndpointDetail] """ - super(EndpointDependency, self).__init__(**kwargs) + super().__init__(**kwargs) self.domain_name = domain_name self.endpoint_details = endpoint_details -class EndpointDetail(msrest.serialization.Model): +class EndpointDetail(_serialization.Model): """connect information from the AKS agent nodes to a single endpoint. :ivar ip_address: An IP Address that Domain Name currently resolves to. @@ -1351,10 +1297,10 @@ class EndpointDetail(msrest.serialization.Model): """ _attribute_map = { - 'ip_address': {'key': 'ipAddress', 'type': 'str'}, - 'port': {'key': 'port', 'type': 'int'}, - 'protocol': {'key': 'protocol', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, + "ip_address": {"key": "ipAddress", "type": "str"}, + "port": {"key": "port", "type": "int"}, + "protocol": {"key": "protocol", "type": "str"}, + "description": {"key": "description", "type": "str"}, } def __init__( @@ -1376,25 +1322,25 @@ def __init__( :keyword description: Description of the detail. :paramtype description: str """ - super(EndpointDetail, self).__init__(**kwargs) + super().__init__(**kwargs) self.ip_address = ip_address self.port = port self.protocol = protocol self.description = description -class ExtendedLocation(msrest.serialization.Model): +class ExtendedLocation(_serialization.Model): """The complex type of the extended location. :ivar name: The name of the extended location. :vartype name: str - :ivar type: The type of the extended location. Known values are: "EdgeZone". + :ivar type: The type of the extended location. "EdgeZone" :vartype type: str or ~azure.mgmt.containerservice.v2021_07_01.models.ExtendedLocationTypes """ _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, } def __init__( @@ -1407,15 +1353,15 @@ def __init__( """ :keyword name: The name of the extended location. :paramtype name: str - :keyword type: The type of the extended location. Known values are: "EdgeZone". + :keyword type: The type of the extended location. "EdgeZone" :paramtype type: str or ~azure.mgmt.containerservice.v2021_07_01.models.ExtendedLocationTypes """ - super(ExtendedLocation, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.type = type -class KubeletConfig(msrest.serialization.Model): +class KubeletConfig(_serialization.Model): # pylint: disable=too-many-instance-attributes """See `AKS custom node configuration `_ for more details. :ivar cpu_manager_policy: The default is 'none'. See `Kubernetes CPU management policies @@ -1455,21 +1401,21 @@ class KubeletConfig(msrest.serialization.Model): """ _validation = { - 'container_log_max_files': {'minimum': 2}, + "container_log_max_files": {"minimum": 2}, } _attribute_map = { - 'cpu_manager_policy': {'key': 'cpuManagerPolicy', 'type': 'str'}, - 'cpu_cfs_quota': {'key': 'cpuCfsQuota', 'type': 'bool'}, - 'cpu_cfs_quota_period': {'key': 'cpuCfsQuotaPeriod', 'type': 'str'}, - 'image_gc_high_threshold': {'key': 'imageGcHighThreshold', 'type': 'int'}, - 'image_gc_low_threshold': {'key': 'imageGcLowThreshold', 'type': 'int'}, - 'topology_manager_policy': {'key': 'topologyManagerPolicy', 'type': 'str'}, - 'allowed_unsafe_sysctls': {'key': 'allowedUnsafeSysctls', 'type': '[str]'}, - 'fail_swap_on': {'key': 'failSwapOn', 'type': 'bool'}, - 'container_log_max_size_mb': {'key': 'containerLogMaxSizeMB', 'type': 'int'}, - 'container_log_max_files': {'key': 'containerLogMaxFiles', 'type': 'int'}, - 'pod_max_pids': {'key': 'podMaxPids', 'type': 'int'}, + "cpu_manager_policy": {"key": "cpuManagerPolicy", "type": "str"}, + "cpu_cfs_quota": {"key": "cpuCfsQuota", "type": "bool"}, + "cpu_cfs_quota_period": {"key": "cpuCfsQuotaPeriod", "type": "str"}, + "image_gc_high_threshold": {"key": "imageGcHighThreshold", "type": "int"}, + "image_gc_low_threshold": {"key": "imageGcLowThreshold", "type": "int"}, + "topology_manager_policy": {"key": "topologyManagerPolicy", "type": "str"}, + "allowed_unsafe_sysctls": {"key": "allowedUnsafeSysctls", "type": "[str]"}, + "fail_swap_on": {"key": "failSwapOn", "type": "bool"}, + "container_log_max_size_mb": {"key": "containerLogMaxSizeMB", "type": "int"}, + "container_log_max_files": {"key": "containerLogMaxFiles", "type": "int"}, + "pod_max_pids": {"key": "podMaxPids", "type": "int"}, } def __init__( @@ -1524,7 +1470,7 @@ def __init__( :keyword pod_max_pids: The maximum number of processes per pod. :paramtype pod_max_pids: int """ - super(KubeletConfig, self).__init__(**kwargs) + super().__init__(**kwargs) self.cpu_manager_policy = cpu_manager_policy self.cpu_cfs_quota = cpu_cfs_quota self.cpu_cfs_quota_period = cpu_cfs_quota_period @@ -1538,7 +1484,7 @@ def __init__( self.pod_max_pids = pod_max_pids -class LinuxOSConfig(msrest.serialization.Model): +class LinuxOSConfig(_serialization.Model): """See `AKS custom node configuration `_ for more details. :ivar sysctls: Sysctl settings for Linux agent nodes. @@ -1557,10 +1503,10 @@ class LinuxOSConfig(msrest.serialization.Model): """ _attribute_map = { - 'sysctls': {'key': 'sysctls', 'type': 'SysctlConfig'}, - 'transparent_huge_page_enabled': {'key': 'transparentHugePageEnabled', 'type': 'str'}, - 'transparent_huge_page_defrag': {'key': 'transparentHugePageDefrag', 'type': 'str'}, - 'swap_file_size_mb': {'key': 'swapFileSizeMB', 'type': 'int'}, + "sysctls": {"key": "sysctls", "type": "SysctlConfig"}, + "transparent_huge_page_enabled": {"key": "transparentHugePageEnabled", "type": "str"}, + "transparent_huge_page_defrag": {"key": "transparentHugePageDefrag", "type": "str"}, + "swap_file_size_mb": {"key": "swapFileSizeMB", "type": "int"}, } def __init__( @@ -1587,7 +1533,7 @@ def __init__( :keyword swap_file_size_mb: The size in MB of a swap file that will be created on each node. :paramtype swap_file_size_mb: int """ - super(LinuxOSConfig, self).__init__(**kwargs) + super().__init__(**kwargs) self.sysctls = sysctls self.transparent_huge_page_enabled = transparent_huge_page_enabled self.transparent_huge_page_defrag = transparent_huge_page_defrag @@ -1616,19 +1562,19 @@ class MaintenanceConfiguration(SubResource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, + "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'}, - 'time_in_week': {'key': 'properties.timeInWeek', 'type': '[TimeInWeek]'}, - 'not_allowed_time': {'key': 'properties.notAllowedTime', 'type': '[TimeSpan]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "time_in_week": {"key": "properties.timeInWeek", "type": "[TimeInWeek]"}, + "not_allowed_time": {"key": "properties.notAllowedTime", "type": "[TimeSpan]"}, } def __init__( @@ -1645,13 +1591,13 @@ def __init__( :keyword not_allowed_time: Time slots on which upgrade is not allowed. :paramtype not_allowed_time: list[~azure.mgmt.containerservice.v2021_07_01.models.TimeSpan] """ - super(MaintenanceConfiguration, self).__init__(**kwargs) + super().__init__(**kwargs) self.system_data = None self.time_in_week = time_in_week self.not_allowed_time = not_allowed_time -class MaintenanceConfigurationListResult(msrest.serialization.Model): +class MaintenanceConfigurationListResult(_serialization.Model): """The response from the List maintenance configurations operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -1663,31 +1609,26 @@ class MaintenanceConfigurationListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[MaintenanceConfiguration]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[MaintenanceConfiguration]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.MaintenanceConfiguration"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.MaintenanceConfiguration"]] = None, **kwargs): """ :keyword value: The list of maintenance configurations. :paramtype value: list[~azure.mgmt.containerservice.v2021_07_01.models.MaintenanceConfiguration] """ - super(MaintenanceConfigurationListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class Resource(msrest.serialization.Model): +class Resource(_serialization.Model): """The Resource model definition. Variables are only populated by the server, and will be ignored when sending a request. @@ -1700,41 +1641,35 @@ class Resource(msrest.serialization.Model): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] """ - super(Resource, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -1742,7 +1677,7 @@ def __init__( self.tags = tags -class ManagedCluster(Resource): +class ManagedCluster(Resource): # pylint: disable=too-many-instance-attributes """Managed cluster. Variables are only populated by the server, and will be ignored when sending a request. @@ -1755,9 +1690,9 @@ class ManagedCluster(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar sku: The managed cluster SKU. :vartype sku: ~azure.mgmt.containerservice.v2021_07_01.models.ManagedClusterSKU @@ -1855,59 +1790,68 @@ class ManagedCluster(Resource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'provisioning_state': {'readonly': True}, - 'power_state': {'readonly': True}, - 'max_agent_pools': {'readonly': True}, - 'fqdn': {'readonly': True}, - 'private_fqdn': {'readonly': True}, - 'azure_portal_fqdn': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, + "provisioning_state": {"readonly": True}, + "power_state": {"readonly": True}, + "max_agent_pools": {"readonly": True}, + "fqdn": {"readonly": True}, + "private_fqdn": {"readonly": True}, + "azure_portal_fqdn": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'ManagedClusterSKU'}, - 'extended_location': {'key': 'extendedLocation', 'type': 'ExtendedLocation'}, - 'identity': {'key': 'identity', 'type': 'ManagedClusterIdentity'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'power_state': {'key': 'properties.powerState', 'type': 'PowerState'}, - 'max_agent_pools': {'key': 'properties.maxAgentPools', 'type': 'int'}, - 'kubernetes_version': {'key': 'properties.kubernetesVersion', 'type': 'str'}, - 'dns_prefix': {'key': 'properties.dnsPrefix', 'type': 'str'}, - 'fqdn_subdomain': {'key': 'properties.fqdnSubdomain', 'type': 'str'}, - 'fqdn': {'key': 'properties.fqdn', 'type': 'str'}, - 'private_fqdn': {'key': 'properties.privateFQDN', 'type': 'str'}, - 'azure_portal_fqdn': {'key': 'properties.azurePortalFQDN', 'type': 'str'}, - 'agent_pool_profiles': {'key': 'properties.agentPoolProfiles', 'type': '[ManagedClusterAgentPoolProfile]'}, - 'linux_profile': {'key': 'properties.linuxProfile', 'type': 'ContainerServiceLinuxProfile'}, - 'windows_profile': {'key': 'properties.windowsProfile', 'type': 'ManagedClusterWindowsProfile'}, - 'service_principal_profile': {'key': 'properties.servicePrincipalProfile', 'type': 'ManagedClusterServicePrincipalProfile'}, - 'addon_profiles': {'key': 'properties.addonProfiles', 'type': '{ManagedClusterAddonProfile}'}, - 'pod_identity_profile': {'key': 'properties.podIdentityProfile', 'type': 'ManagedClusterPodIdentityProfile'}, - 'node_resource_group': {'key': 'properties.nodeResourceGroup', 'type': 'str'}, - 'enable_rbac': {'key': 'properties.enableRBAC', 'type': 'bool'}, - 'enable_pod_security_policy': {'key': 'properties.enablePodSecurityPolicy', 'type': 'bool'}, - 'network_profile': {'key': 'properties.networkProfile', 'type': 'ContainerServiceNetworkProfile'}, - 'aad_profile': {'key': 'properties.aadProfile', 'type': 'ManagedClusterAADProfile'}, - 'auto_upgrade_profile': {'key': 'properties.autoUpgradeProfile', 'type': 'ManagedClusterAutoUpgradeProfile'}, - 'auto_scaler_profile': {'key': 'properties.autoScalerProfile', 'type': 'ManagedClusterPropertiesAutoScalerProfile'}, - 'api_server_access_profile': {'key': 'properties.apiServerAccessProfile', 'type': 'ManagedClusterAPIServerAccessProfile'}, - 'disk_encryption_set_id': {'key': 'properties.diskEncryptionSetID', 'type': 'str'}, - 'identity_profile': {'key': 'properties.identityProfile', 'type': '{UserAssignedIdentity}'}, - 'private_link_resources': {'key': 'properties.privateLinkResources', 'type': '[PrivateLinkResource]'}, - 'disable_local_accounts': {'key': 'properties.disableLocalAccounts', 'type': 'bool'}, - 'http_proxy_config': {'key': 'properties.httpProxyConfig', 'type': 'ManagedClusterHTTPProxyConfig'}, - 'security_profile': {'key': 'properties.securityProfile', 'type': 'ManagedClusterSecurityProfile'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "sku": {"key": "sku", "type": "ManagedClusterSKU"}, + "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, + "identity": {"key": "identity", "type": "ManagedClusterIdentity"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "power_state": {"key": "properties.powerState", "type": "PowerState"}, + "max_agent_pools": {"key": "properties.maxAgentPools", "type": "int"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "dns_prefix": {"key": "properties.dnsPrefix", "type": "str"}, + "fqdn_subdomain": {"key": "properties.fqdnSubdomain", "type": "str"}, + "fqdn": {"key": "properties.fqdn", "type": "str"}, + "private_fqdn": {"key": "properties.privateFQDN", "type": "str"}, + "azure_portal_fqdn": {"key": "properties.azurePortalFQDN", "type": "str"}, + "agent_pool_profiles": {"key": "properties.agentPoolProfiles", "type": "[ManagedClusterAgentPoolProfile]"}, + "linux_profile": {"key": "properties.linuxProfile", "type": "ContainerServiceLinuxProfile"}, + "windows_profile": {"key": "properties.windowsProfile", "type": "ManagedClusterWindowsProfile"}, + "service_principal_profile": { + "key": "properties.servicePrincipalProfile", + "type": "ManagedClusterServicePrincipalProfile", + }, + "addon_profiles": {"key": "properties.addonProfiles", "type": "{ManagedClusterAddonProfile}"}, + "pod_identity_profile": {"key": "properties.podIdentityProfile", "type": "ManagedClusterPodIdentityProfile"}, + "node_resource_group": {"key": "properties.nodeResourceGroup", "type": "str"}, + "enable_rbac": {"key": "properties.enableRBAC", "type": "bool"}, + "enable_pod_security_policy": {"key": "properties.enablePodSecurityPolicy", "type": "bool"}, + "network_profile": {"key": "properties.networkProfile", "type": "ContainerServiceNetworkProfile"}, + "aad_profile": {"key": "properties.aadProfile", "type": "ManagedClusterAADProfile"}, + "auto_upgrade_profile": {"key": "properties.autoUpgradeProfile", "type": "ManagedClusterAutoUpgradeProfile"}, + "auto_scaler_profile": { + "key": "properties.autoScalerProfile", + "type": "ManagedClusterPropertiesAutoScalerProfile", + }, + "api_server_access_profile": { + "key": "properties.apiServerAccessProfile", + "type": "ManagedClusterAPIServerAccessProfile", + }, + "disk_encryption_set_id": {"key": "properties.diskEncryptionSetID", "type": "str"}, + "identity_profile": {"key": "properties.identityProfile", "type": "{UserAssignedIdentity}"}, + "private_link_resources": {"key": "properties.privateLinkResources", "type": "[PrivateLinkResource]"}, + "disable_local_accounts": {"key": "properties.disableLocalAccounts", "type": "bool"}, + "http_proxy_config": {"key": "properties.httpProxyConfig", "type": "ManagedClusterHTTPProxyConfig"}, + "security_profile": {"key": "properties.securityProfile", "type": "ManagedClusterSecurityProfile"}, } - def __init__( + def __init__( # pylint: disable=too-many-locals self, *, location: str, @@ -1941,9 +1885,9 @@ def __init__( **kwargs ): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword sku: The managed cluster SKU. :paramtype sku: ~azure.mgmt.containerservice.v2021_07_01.models.ManagedClusterSKU @@ -2027,7 +1971,7 @@ def __init__( :paramtype security_profile: ~azure.mgmt.containerservice.v2021_07_01.models.ManagedClusterSecurityProfile """ - super(ManagedCluster, self).__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.sku = sku self.extended_location = extended_location self.identity = identity @@ -2062,7 +2006,7 @@ def __init__( self.security_profile = security_profile -class ManagedClusterAADProfile(msrest.serialization.Model): +class ManagedClusterAADProfile(_serialization.Model): """For more details see `managed AAD on AKS `_. :ivar managed: Whether to enable managed AAD. @@ -2084,13 +2028,13 @@ class ManagedClusterAADProfile(msrest.serialization.Model): """ _attribute_map = { - 'managed': {'key': 'managed', 'type': 'bool'}, - 'enable_azure_rbac': {'key': 'enableAzureRBAC', 'type': 'bool'}, - 'admin_group_object_i_ds': {'key': 'adminGroupObjectIDs', 'type': '[str]'}, - 'client_app_id': {'key': 'clientAppID', 'type': 'str'}, - 'server_app_id': {'key': 'serverAppID', 'type': 'str'}, - 'server_app_secret': {'key': 'serverAppSecret', 'type': 'str'}, - 'tenant_id': {'key': 'tenantID', 'type': 'str'}, + "managed": {"key": "managed", "type": "bool"}, + "enable_azure_rbac": {"key": "enableAzureRBAC", "type": "bool"}, + "admin_group_object_i_ds": {"key": "adminGroupObjectIDs", "type": "[str]"}, + "client_app_id": {"key": "clientAppID", "type": "str"}, + "server_app_id": {"key": "serverAppID", "type": "str"}, + "server_app_secret": {"key": "serverAppSecret", "type": "str"}, + "tenant_id": {"key": "tenantID", "type": "str"}, } def __init__( @@ -2123,7 +2067,7 @@ def __init__( tenant of the deployment subscription. :paramtype tenant_id: str """ - super(ManagedClusterAADProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.managed = managed self.enable_azure_rbac = enable_azure_rbac self.admin_group_object_i_ds = admin_group_object_i_ds @@ -2146,58 +2090,53 @@ class ManagedClusterAccessProfile(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar kube_config: Base64-encoded Kubernetes configuration file. - :vartype kube_config: bytearray + :vartype kube_config: bytes """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'kube_config': {'key': 'properties.kubeConfig', 'type': 'bytearray'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "kube_config": {"key": "properties.kubeConfig", "type": "bytearray"}, } def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - kube_config: Optional[bytearray] = None, - **kwargs + self, *, location: str, tags: Optional[Dict[str, str]] = None, kube_config: Optional[bytes] = None, **kwargs ): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword kube_config: Base64-encoded Kubernetes configuration file. - :paramtype kube_config: bytearray + :paramtype kube_config: bytes """ - super(ManagedClusterAccessProfile, self).__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.kube_config = kube_config -class ManagedClusterAddonProfile(msrest.serialization.Model): +class ManagedClusterAddonProfile(_serialization.Model): """A Kubernetes add-on profile for a managed cluster. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar enabled: Required. Whether the add-on is enabled or not. + :ivar enabled: Whether the add-on is enabled or not. Required. :vartype enabled: bool :ivar config: Key-value pairs for configuring an add-on. :vartype config: dict[str, str] @@ -2207,36 +2146,30 @@ class ManagedClusterAddonProfile(msrest.serialization.Model): """ _validation = { - 'enabled': {'required': True}, - 'identity': {'readonly': True}, + "enabled": {"required": True}, + "identity": {"readonly": True}, } _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'config': {'key': 'config', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'ManagedClusterAddonProfileIdentity'}, + "enabled": {"key": "enabled", "type": "bool"}, + "config": {"key": "config", "type": "{str}"}, + "identity": {"key": "identity", "type": "ManagedClusterAddonProfileIdentity"}, } - def __init__( - self, - *, - enabled: bool, - config: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, enabled: bool, config: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword enabled: Required. Whether the add-on is enabled or not. + :keyword enabled: Whether the add-on is enabled or not. Required. :paramtype enabled: bool :keyword config: Key-value pairs for configuring an add-on. :paramtype config: dict[str, str] """ - super(ManagedClusterAddonProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.config = config self.identity = None -class UserAssignedIdentity(msrest.serialization.Model): +class UserAssignedIdentity(_serialization.Model): """Details about a user assigned identity. :ivar resource_id: The resource ID of the user assigned identity. @@ -2248,9 +2181,9 @@ class UserAssignedIdentity(msrest.serialization.Model): """ _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'object_id': {'key': 'objectId', 'type': 'str'}, + "resource_id": {"key": "resourceId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + "object_id": {"key": "objectId", "type": "str"}, } def __init__( @@ -2269,7 +2202,7 @@ def __init__( :keyword object_id: The object ID of the user assigned identity. :paramtype object_id: str """ - super(UserAssignedIdentity, self).__init__(**kwargs) + super().__init__(**kwargs) self.resource_id = resource_id self.client_id = client_id self.object_id = object_id @@ -2287,9 +2220,9 @@ class ManagedClusterAddonProfileIdentity(UserAssignedIdentity): """ _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'object_id': {'key': 'objectId', 'type': 'str'}, + "resource_id": {"key": "resourceId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + "object_id": {"key": "objectId", "type": "str"}, } def __init__( @@ -2308,10 +2241,10 @@ def __init__( :keyword object_id: The object ID of the user assigned identity. :paramtype object_id: str """ - super(ManagedClusterAddonProfileIdentity, self).__init__(resource_id=resource_id, client_id=client_id, object_id=object_id, **kwargs) + super().__init__(resource_id=resource_id, client_id=client_id, object_id=object_id, **kwargs) -class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): +class ManagedClusterAgentPoolProfileProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes """Properties for the container service agent pool profile. Variables are only populated by the server, and will be ignored when sending a request. @@ -2332,10 +2265,10 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2021_07_01.models.OSDiskType :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data - root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2021_07_01.models.KubeletDiskType :ivar vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and used. @@ -2349,11 +2282,11 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :vartype pod_subnet_id: str :ivar max_pods: The maximum number of pods that can run on a node. :vartype max_pods: int - :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2021_07_01.models.OSType :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known - values are: "Ubuntu", "CBLMariner". + values are: "Ubuntu" and "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2021_07_01.models.OSSKU :ivar max_count: The maximum number of nodes for auto-scaling. :vartype max_count: int @@ -2362,14 +2295,14 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it - defaults to Delete. Known values are: "Delete", "Deallocate". + defaults to Delete. Known values are: "Delete" and "Deallocate". :vartype scale_down_mode: str or ~azure.mgmt.containerservice.v2021_07_01.models.ScaleDownMode - :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", + :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets" and "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2021_07_01.models.AgentPoolType :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :vartype mode: str or ~azure.mgmt.containerservice.v2021_07_01.models.AgentPoolMode :ivar orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -2401,20 +2334,18 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default - is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + is 'Regular'. Known values are: "Spot" and "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2021_07_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2021_07_01.models.ScaleSetEvictionPolicy :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :vartype spot_max_price: float - :ivar tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :ivar tags: The tags to be persisted on the agent pool virtual machine scale set. :vartype tags: dict[str, str] :ivar node_labels: The node labels to be persisted across all nodes in agent pool. :vartype node_labels: dict[str, str] @@ -2438,59 +2369,59 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): for more details. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2021_07_01.models.GPUInstanceProfile """ _validation = { - 'os_disk_size_gb': {'maximum': 2048, 'minimum': 0}, - 'node_image_version': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'power_state': {'readonly': True}, + "os_disk_size_gb": {"maximum": 2048, "minimum": 0}, + "node_image_version": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "power_state": {"readonly": True}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'os_disk_type': {'key': 'osDiskType', 'type': 'str'}, - 'kubelet_disk_type': {'key': 'kubeletDiskType', 'type': 'str'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'pod_subnet_id': {'key': 'podSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'maxPods', 'type': 'int'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'os_sku': {'key': 'osSKU', 'type': 'str'}, - 'max_count': {'key': 'maxCount', 'type': 'int'}, - 'min_count': {'key': 'minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'enableAutoScaling', 'type': 'bool'}, - 'scale_down_mode': {'key': 'scaleDownMode', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'mode': {'key': 'mode', 'type': 'str'}, - 'orchestrator_version': {'key': 'orchestratorVersion', 'type': 'str'}, - 'node_image_version': {'key': 'nodeImageVersion', 'type': 'str'}, - 'upgrade_settings': {'key': 'upgradeSettings', 'type': 'AgentPoolUpgradeSettings'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'power_state': {'key': 'powerState', 'type': 'PowerState'}, - 'availability_zones': {'key': 'availabilityZones', 'type': '[str]'}, - 'enable_node_public_ip': {'key': 'enableNodePublicIP', 'type': 'bool'}, - 'node_public_ip_prefix_id': {'key': 'nodePublicIPPrefixID', 'type': 'str'}, - 'scale_set_priority': {'key': 'scaleSetPriority', 'type': 'str'}, - 'scale_set_eviction_policy': {'key': 'scaleSetEvictionPolicy', 'type': 'str'}, - 'spot_max_price': {'key': 'spotMaxPrice', 'type': 'float'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'node_labels': {'key': 'nodeLabels', 'type': '{str}'}, - 'node_taints': {'key': 'nodeTaints', 'type': '[str]'}, - 'proximity_placement_group_id': {'key': 'proximityPlacementGroupID', 'type': 'str'}, - 'kubelet_config': {'key': 'kubeletConfig', 'type': 'KubeletConfig'}, - 'linux_os_config': {'key': 'linuxOSConfig', 'type': 'LinuxOSConfig'}, - 'enable_encryption_at_host': {'key': 'enableEncryptionAtHost', 'type': 'bool'}, - 'enable_ultra_ssd': {'key': 'enableUltraSSD', 'type': 'bool'}, - 'enable_fips': {'key': 'enableFIPS', 'type': 'bool'}, - 'gpu_instance_profile': {'key': 'gpuInstanceProfile', 'type': 'str'}, + "count": {"key": "count", "type": "int"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "os_disk_type": {"key": "osDiskType", "type": "str"}, + "kubelet_disk_type": {"key": "kubeletDiskType", "type": "str"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "pod_subnet_id": {"key": "podSubnetID", "type": "str"}, + "max_pods": {"key": "maxPods", "type": "int"}, + "os_type": {"key": "osType", "type": "str"}, + "os_sku": {"key": "osSKU", "type": "str"}, + "max_count": {"key": "maxCount", "type": "int"}, + "min_count": {"key": "minCount", "type": "int"}, + "enable_auto_scaling": {"key": "enableAutoScaling", "type": "bool"}, + "scale_down_mode": {"key": "scaleDownMode", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "mode": {"key": "mode", "type": "str"}, + "orchestrator_version": {"key": "orchestratorVersion", "type": "str"}, + "node_image_version": {"key": "nodeImageVersion", "type": "str"}, + "upgrade_settings": {"key": "upgradeSettings", "type": "AgentPoolUpgradeSettings"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "power_state": {"key": "powerState", "type": "PowerState"}, + "availability_zones": {"key": "availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "enableNodePublicIP", "type": "bool"}, + "node_public_ip_prefix_id": {"key": "nodePublicIPPrefixID", "type": "str"}, + "scale_set_priority": {"key": "scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "scaleSetEvictionPolicy", "type": "str"}, + "spot_max_price": {"key": "spotMaxPrice", "type": "float"}, + "tags": {"key": "tags", "type": "{str}"}, + "node_labels": {"key": "nodeLabels", "type": "{str}"}, + "node_taints": {"key": "nodeTaints", "type": "[str]"}, + "proximity_placement_group_id": {"key": "proximityPlacementGroupID", "type": "str"}, + "kubelet_config": {"key": "kubeletConfig", "type": "KubeletConfig"}, + "linux_os_config": {"key": "linuxOSConfig", "type": "LinuxOSConfig"}, + "enable_encryption_at_host": {"key": "enableEncryptionAtHost", "type": "bool"}, + "enable_ultra_ssd": {"key": "enableUltraSSD", "type": "bool"}, + "enable_fips": {"key": "enableFIPS", "type": "bool"}, + "gpu_instance_profile": {"key": "gpuInstanceProfile", "type": "str"}, } - def __init__( + def __init__( # pylint: disable=too-many-locals self, *, count: Optional[int] = None, @@ -2501,7 +2432,7 @@ def __init__( vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, @@ -2514,9 +2445,9 @@ def __init__( availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", - spot_max_price: Optional[float] = -1, + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", + spot_max_price: float = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, @@ -2546,10 +2477,10 @@ def __init__( larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2021_07_01.models.OSDiskType :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime - data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + data root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2021_07_01.models.KubeletDiskType :keyword vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and @@ -2563,11 +2494,11 @@ def __init__( :paramtype pod_subnet_id: str :keyword max_pods: The maximum number of pods that can run on a node. :paramtype max_pods: int - :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2021_07_01.models.OSType :keyword os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Known values are: "Ubuntu", "CBLMariner". + Known values are: "Ubuntu" and "CBLMariner". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2021_07_01.models.OSSKU :keyword max_count: The maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -2576,15 +2507,15 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, - it defaults to Delete. Known values are: "Delete", "Deallocate". + it defaults to Delete. Known values are: "Delete" and "Deallocate". :paramtype scale_down_mode: str or ~azure.mgmt.containerservice.v2021_07_01.models.ScaleDownMode - :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", + :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2021_07_01.models.AgentPoolType :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2021_07_01.models.AgentPoolMode :keyword orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -2610,20 +2541,18 @@ def __init__( /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the - default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + default is 'Regular'. Known values are: "Spot" and "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2021_07_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2021_07_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :paramtype spot_max_price: float - :keyword tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :keyword tags: The tags to be persisted on the agent pool virtual machine scale set. :paramtype tags: dict[str, str] :keyword node_labels: The node labels to be persisted across all nodes in agent pool. :paramtype node_labels: dict[str, str] @@ -2647,12 +2576,12 @@ def __init__( for more details. :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance - profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2021_07_01.models.GPUInstanceProfile """ - super(ManagedClusterAgentPoolProfileProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.vm_size = vm_size self.os_disk_size_gb = os_disk_size_gb @@ -2692,7 +2621,9 @@ def __init__( self.gpu_instance_profile = gpu_instance_profile -class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): +class ManagedClusterAgentPoolProfile( + ManagedClusterAgentPoolProfileProperties +): # pylint: disable=too-many-instance-attributes """Profile for the container service agent pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -2715,10 +2646,10 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2021_07_01.models.OSDiskType :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data - root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2021_07_01.models.KubeletDiskType :ivar vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and used. @@ -2732,11 +2663,11 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :vartype pod_subnet_id: str :ivar max_pods: The maximum number of pods that can run on a node. :vartype max_pods: int - :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2021_07_01.models.OSType :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known - values are: "Ubuntu", "CBLMariner". + values are: "Ubuntu" and "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2021_07_01.models.OSSKU :ivar max_count: The maximum number of nodes for auto-scaling. :vartype max_count: int @@ -2745,14 +2676,14 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it - defaults to Delete. Known values are: "Delete", "Deallocate". + defaults to Delete. Known values are: "Delete" and "Deallocate". :vartype scale_down_mode: str or ~azure.mgmt.containerservice.v2021_07_01.models.ScaleDownMode - :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", + :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets" and "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2021_07_01.models.AgentPoolType :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :vartype mode: str or ~azure.mgmt.containerservice.v2021_07_01.models.AgentPoolMode :ivar orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -2784,20 +2715,18 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default - is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + is 'Regular'. Known values are: "Spot" and "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2021_07_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2021_07_01.models.ScaleSetEvictionPolicy :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :vartype spot_max_price: float - :ivar tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :ivar tags: The tags to be persisted on the agent pool virtual machine scale set. :vartype tags: dict[str, str] :ivar node_labels: The node labels to be persisted across all nodes in agent pool. :vartype node_labels: dict[str, str] @@ -2821,63 +2750,63 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): for more details. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2021_07_01.models.GPUInstanceProfile - :ivar name: Required. Windows agent pool names must be 6 characters or less. + :ivar name: Windows agent pool names must be 6 characters or less. Required. :vartype name: str """ _validation = { - 'os_disk_size_gb': {'maximum': 2048, 'minimum': 0}, - 'node_image_version': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'power_state': {'readonly': True}, - 'name': {'required': True, 'pattern': r'^[a-z][a-z0-9]{0,11}$'}, + "os_disk_size_gb": {"maximum": 2048, "minimum": 0}, + "node_image_version": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "power_state": {"readonly": True}, + "name": {"required": True, "pattern": r"^[a-z][a-z0-9]{0,11}$"}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'os_disk_type': {'key': 'osDiskType', 'type': 'str'}, - 'kubelet_disk_type': {'key': 'kubeletDiskType', 'type': 'str'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'pod_subnet_id': {'key': 'podSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'maxPods', 'type': 'int'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'os_sku': {'key': 'osSKU', 'type': 'str'}, - 'max_count': {'key': 'maxCount', 'type': 'int'}, - 'min_count': {'key': 'minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'enableAutoScaling', 'type': 'bool'}, - 'scale_down_mode': {'key': 'scaleDownMode', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'mode': {'key': 'mode', 'type': 'str'}, - 'orchestrator_version': {'key': 'orchestratorVersion', 'type': 'str'}, - 'node_image_version': {'key': 'nodeImageVersion', 'type': 'str'}, - 'upgrade_settings': {'key': 'upgradeSettings', 'type': 'AgentPoolUpgradeSettings'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'power_state': {'key': 'powerState', 'type': 'PowerState'}, - 'availability_zones': {'key': 'availabilityZones', 'type': '[str]'}, - 'enable_node_public_ip': {'key': 'enableNodePublicIP', 'type': 'bool'}, - 'node_public_ip_prefix_id': {'key': 'nodePublicIPPrefixID', 'type': 'str'}, - 'scale_set_priority': {'key': 'scaleSetPriority', 'type': 'str'}, - 'scale_set_eviction_policy': {'key': 'scaleSetEvictionPolicy', 'type': 'str'}, - 'spot_max_price': {'key': 'spotMaxPrice', 'type': 'float'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'node_labels': {'key': 'nodeLabels', 'type': '{str}'}, - 'node_taints': {'key': 'nodeTaints', 'type': '[str]'}, - 'proximity_placement_group_id': {'key': 'proximityPlacementGroupID', 'type': 'str'}, - 'kubelet_config': {'key': 'kubeletConfig', 'type': 'KubeletConfig'}, - 'linux_os_config': {'key': 'linuxOSConfig', 'type': 'LinuxOSConfig'}, - 'enable_encryption_at_host': {'key': 'enableEncryptionAtHost', 'type': 'bool'}, - 'enable_ultra_ssd': {'key': 'enableUltraSSD', 'type': 'bool'}, - 'enable_fips': {'key': 'enableFIPS', 'type': 'bool'}, - 'gpu_instance_profile': {'key': 'gpuInstanceProfile', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, + "count": {"key": "count", "type": "int"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "os_disk_type": {"key": "osDiskType", "type": "str"}, + "kubelet_disk_type": {"key": "kubeletDiskType", "type": "str"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "pod_subnet_id": {"key": "podSubnetID", "type": "str"}, + "max_pods": {"key": "maxPods", "type": "int"}, + "os_type": {"key": "osType", "type": "str"}, + "os_sku": {"key": "osSKU", "type": "str"}, + "max_count": {"key": "maxCount", "type": "int"}, + "min_count": {"key": "minCount", "type": "int"}, + "enable_auto_scaling": {"key": "enableAutoScaling", "type": "bool"}, + "scale_down_mode": {"key": "scaleDownMode", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "mode": {"key": "mode", "type": "str"}, + "orchestrator_version": {"key": "orchestratorVersion", "type": "str"}, + "node_image_version": {"key": "nodeImageVersion", "type": "str"}, + "upgrade_settings": {"key": "upgradeSettings", "type": "AgentPoolUpgradeSettings"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "power_state": {"key": "powerState", "type": "PowerState"}, + "availability_zones": {"key": "availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "enableNodePublicIP", "type": "bool"}, + "node_public_ip_prefix_id": {"key": "nodePublicIPPrefixID", "type": "str"}, + "scale_set_priority": {"key": "scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "scaleSetEvictionPolicy", "type": "str"}, + "spot_max_price": {"key": "spotMaxPrice", "type": "float"}, + "tags": {"key": "tags", "type": "{str}"}, + "node_labels": {"key": "nodeLabels", "type": "{str}"}, + "node_taints": {"key": "nodeTaints", "type": "[str]"}, + "proximity_placement_group_id": {"key": "proximityPlacementGroupID", "type": "str"}, + "kubelet_config": {"key": "kubeletConfig", "type": "KubeletConfig"}, + "linux_os_config": {"key": "linuxOSConfig", "type": "LinuxOSConfig"}, + "enable_encryption_at_host": {"key": "enableEncryptionAtHost", "type": "bool"}, + "enable_ultra_ssd": {"key": "enableUltraSSD", "type": "bool"}, + "enable_fips": {"key": "enableFIPS", "type": "bool"}, + "gpu_instance_profile": {"key": "gpuInstanceProfile", "type": "str"}, + "name": {"key": "name", "type": "str"}, } - def __init__( + def __init__( # pylint: disable=too-many-locals self, *, name: str, @@ -2889,7 +2818,7 @@ def __init__( vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, @@ -2902,9 +2831,9 @@ def __init__( availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", - spot_max_price: Optional[float] = -1, + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", + spot_max_price: float = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, @@ -2934,10 +2863,10 @@ def __init__( larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2021_07_01.models.OSDiskType :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime - data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + data root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2021_07_01.models.KubeletDiskType :keyword vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and @@ -2951,11 +2880,11 @@ def __init__( :paramtype pod_subnet_id: str :keyword max_pods: The maximum number of pods that can run on a node. :paramtype max_pods: int - :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2021_07_01.models.OSType :keyword os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Known values are: "Ubuntu", "CBLMariner". + Known values are: "Ubuntu" and "CBLMariner". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2021_07_01.models.OSSKU :keyword max_count: The maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -2964,15 +2893,15 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, - it defaults to Delete. Known values are: "Delete", "Deallocate". + it defaults to Delete. Known values are: "Delete" and "Deallocate". :paramtype scale_down_mode: str or ~azure.mgmt.containerservice.v2021_07_01.models.ScaleDownMode - :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", + :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2021_07_01.models.AgentPoolType :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2021_07_01.models.AgentPoolMode :keyword orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -2998,20 +2927,18 @@ def __init__( /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the - default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + default is 'Regular'. Known values are: "Spot" and "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2021_07_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2021_07_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :paramtype spot_max_price: float - :keyword tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :keyword tags: The tags to be persisted on the agent pool virtual machine scale set. :paramtype tags: dict[str, str] :keyword node_labels: The node labels to be persisted across all nodes in agent pool. :paramtype node_labels: dict[str, str] @@ -3035,18 +2962,54 @@ def __init__( for more details. :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance - profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2021_07_01.models.GPUInstanceProfile - :keyword name: Required. Windows agent pool names must be 6 characters or less. + :keyword name: Windows agent pool names must be 6 characters or less. Required. :paramtype name: str """ - super(ManagedClusterAgentPoolProfile, self).__init__(count=count, vm_size=vm_size, os_disk_size_gb=os_disk_size_gb, os_disk_type=os_disk_type, kubelet_disk_type=kubelet_disk_type, vnet_subnet_id=vnet_subnet_id, pod_subnet_id=pod_subnet_id, max_pods=max_pods, os_type=os_type, os_sku=os_sku, max_count=max_count, min_count=min_count, enable_auto_scaling=enable_auto_scaling, scale_down_mode=scale_down_mode, type=type, mode=mode, orchestrator_version=orchestrator_version, upgrade_settings=upgrade_settings, availability_zones=availability_zones, enable_node_public_ip=enable_node_public_ip, node_public_ip_prefix_id=node_public_ip_prefix_id, scale_set_priority=scale_set_priority, scale_set_eviction_policy=scale_set_eviction_policy, spot_max_price=spot_max_price, tags=tags, node_labels=node_labels, node_taints=node_taints, proximity_placement_group_id=proximity_placement_group_id, kubelet_config=kubelet_config, linux_os_config=linux_os_config, enable_encryption_at_host=enable_encryption_at_host, enable_ultra_ssd=enable_ultra_ssd, enable_fips=enable_fips, gpu_instance_profile=gpu_instance_profile, **kwargs) + super().__init__( + count=count, + vm_size=vm_size, + os_disk_size_gb=os_disk_size_gb, + os_disk_type=os_disk_type, + kubelet_disk_type=kubelet_disk_type, + vnet_subnet_id=vnet_subnet_id, + pod_subnet_id=pod_subnet_id, + max_pods=max_pods, + os_type=os_type, + os_sku=os_sku, + max_count=max_count, + min_count=min_count, + enable_auto_scaling=enable_auto_scaling, + scale_down_mode=scale_down_mode, + type=type, + mode=mode, + orchestrator_version=orchestrator_version, + upgrade_settings=upgrade_settings, + availability_zones=availability_zones, + enable_node_public_ip=enable_node_public_ip, + node_public_ip_prefix_id=node_public_ip_prefix_id, + scale_set_priority=scale_set_priority, + scale_set_eviction_policy=scale_set_eviction_policy, + spot_max_price=spot_max_price, + tags=tags, + node_labels=node_labels, + node_taints=node_taints, + proximity_placement_group_id=proximity_placement_group_id, + kubelet_config=kubelet_config, + linux_os_config=linux_os_config, + enable_encryption_at_host=enable_encryption_at_host, + enable_ultra_ssd=enable_ultra_ssd, + enable_fips=enable_fips, + gpu_instance_profile=gpu_instance_profile, + **kwargs + ) self.name = name -class ManagedClusterAPIServerAccessProfile(msrest.serialization.Model): +class ManagedClusterAPIServerAccessProfile(_serialization.Model): """Access profile for managed cluster API server. :ivar authorized_ip_ranges: IP ranges are specified in CIDR format, e.g. 137.117.106.88/29. @@ -3067,10 +3030,10 @@ class ManagedClusterAPIServerAccessProfile(msrest.serialization.Model): """ _attribute_map = { - 'authorized_ip_ranges': {'key': 'authorizedIPRanges', 'type': '[str]'}, - 'enable_private_cluster': {'key': 'enablePrivateCluster', 'type': 'bool'}, - 'private_dns_zone': {'key': 'privateDNSZone', 'type': 'str'}, - 'enable_private_cluster_public_fqdn': {'key': 'enablePrivateClusterPublicFQDN', 'type': 'bool'}, + "authorized_ip_ranges": {"key": "authorizedIPRanges", "type": "[str]"}, + "enable_private_cluster": {"key": "enablePrivateCluster", "type": "bool"}, + "private_dns_zone": {"key": "privateDNSZone", "type": "str"}, + "enable_private_cluster_public_fqdn": {"key": "enablePrivateClusterPublicFQDN", "type": "bool"}, } def __init__( @@ -3099,44 +3062,39 @@ def __init__( private cluster or not. :paramtype enable_private_cluster_public_fqdn: bool """ - super(ManagedClusterAPIServerAccessProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.authorized_ip_ranges = authorized_ip_ranges self.enable_private_cluster = enable_private_cluster self.private_dns_zone = private_dns_zone self.enable_private_cluster_public_fqdn = enable_private_cluster_public_fqdn -class ManagedClusterAutoUpgradeProfile(msrest.serialization.Model): +class ManagedClusterAutoUpgradeProfile(_serialization.Model): """Auto upgrade profile for a managed cluster. :ivar upgrade_channel: For more information see `setting the AKS cluster auto-upgrade channel `_. Known values - are: "rapid", "stable", "patch", "node-image", "none". + are: "rapid", "stable", "patch", "node-image", and "none". :vartype upgrade_channel: str or ~azure.mgmt.containerservice.v2021_07_01.models.UpgradeChannel """ _attribute_map = { - 'upgrade_channel': {'key': 'upgradeChannel', 'type': 'str'}, + "upgrade_channel": {"key": "upgradeChannel", "type": "str"}, } - def __init__( - self, - *, - upgrade_channel: Optional[Union[str, "_models.UpgradeChannel"]] = None, - **kwargs - ): + def __init__(self, *, upgrade_channel: Optional[Union[str, "_models.UpgradeChannel"]] = None, **kwargs): """ :keyword upgrade_channel: For more information see `setting the AKS cluster auto-upgrade channel `_. - Known values are: "rapid", "stable", "patch", "node-image", "none". + Known values are: "rapid", "stable", "patch", "node-image", and "none". :paramtype upgrade_channel: str or ~azure.mgmt.containerservice.v2021_07_01.models.UpgradeChannel """ - super(ManagedClusterAutoUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.upgrade_channel = upgrade_channel -class ManagedClusterHTTPProxyConfig(msrest.serialization.Model): +class ManagedClusterHTTPProxyConfig(_serialization.Model): """Cluster HTTP proxy configuration. :ivar http_proxy: The HTTP proxy server endpoint to use. @@ -3150,10 +3108,10 @@ class ManagedClusterHTTPProxyConfig(msrest.serialization.Model): """ _attribute_map = { - 'http_proxy': {'key': 'httpProxy', 'type': 'str'}, - 'https_proxy': {'key': 'httpsProxy', 'type': 'str'}, - 'no_proxy': {'key': 'noProxy', 'type': '[str]'}, - 'trusted_ca': {'key': 'trustedCa', 'type': 'str'}, + "http_proxy": {"key": "httpProxy", "type": "str"}, + "https_proxy": {"key": "httpsProxy", "type": "str"}, + "no_proxy": {"key": "noProxy", "type": "[str]"}, + "trusted_ca": {"key": "trustedCa", "type": "str"}, } def __init__( @@ -3175,14 +3133,14 @@ def __init__( :keyword trusted_ca: Alternative CA cert to use for connecting to proxy servers. :paramtype trusted_ca: str """ - super(ManagedClusterHTTPProxyConfig, self).__init__(**kwargs) + super().__init__(**kwargs) self.http_proxy = http_proxy self.https_proxy = https_proxy self.no_proxy = no_proxy self.trusted_ca = trusted_ca -class ManagedClusterIdentity(msrest.serialization.Model): +class ManagedClusterIdentity(_serialization.Model): """Identity for the managed cluster. Variables are only populated by the server, and will be ignored when sending a request. @@ -3195,7 +3153,7 @@ class ManagedClusterIdentity(msrest.serialization.Model): :vartype tenant_id: str :ivar type: For more information see `use managed identities in AKS `_. Known values are: - "SystemAssigned", "UserAssigned", "None". + "SystemAssigned", "UserAssigned", and "None". :vartype type: str or ~azure.mgmt.containerservice.v2021_07_01.models.ResourceIdentityType :ivar user_assigned_identities: The keys must be ARM resource IDs in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. @@ -3204,42 +3162,47 @@ class ManagedClusterIdentity(msrest.serialization.Model): """ _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, + "principal_id": {"readonly": True}, + "tenant_id": {"readonly": True}, } _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{ManagedServiceIdentityUserAssignedIdentitiesValue}'}, + "principal_id": {"key": "principalId", "type": "str"}, + "tenant_id": {"key": "tenantId", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "user_assigned_identities": { + "key": "userAssignedIdentities", + "type": "{ManagedServiceIdentityUserAssignedIdentitiesValue}", + }, } def __init__( self, *, type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, - user_assigned_identities: Optional[Dict[str, "_models.ManagedServiceIdentityUserAssignedIdentitiesValue"]] = None, + user_assigned_identities: Optional[ + Dict[str, "_models.ManagedServiceIdentityUserAssignedIdentitiesValue"] + ] = None, **kwargs ): """ :keyword type: For more information see `use managed identities in AKS `_. Known values are: - "SystemAssigned", "UserAssigned", "None". + "SystemAssigned", "UserAssigned", and "None". :paramtype type: str or ~azure.mgmt.containerservice.v2021_07_01.models.ResourceIdentityType :keyword user_assigned_identities: The keys must be ARM resource IDs in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. :paramtype user_assigned_identities: dict[str, ~azure.mgmt.containerservice.v2021_07_01.models.ManagedServiceIdentityUserAssignedIdentitiesValue] """ - super(ManagedClusterIdentity, self).__init__(**kwargs) + super().__init__(**kwargs) self.principal_id = None self.tenant_id = None self.type = type self.user_assigned_identities = user_assigned_identities -class ManagedClusterListResult(msrest.serialization.Model): +class ManagedClusterListResult(_serialization.Model): """The response from the List Managed Clusters operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -3251,30 +3214,25 @@ class ManagedClusterListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[ManagedCluster]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[ManagedCluster]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.ManagedCluster"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.ManagedCluster"]] = None, **kwargs): """ :keyword value: The list of managed clusters. :paramtype value: list[~azure.mgmt.containerservice.v2021_07_01.models.ManagedCluster] """ - super(ManagedClusterListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class ManagedClusterLoadBalancerProfile(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfile(_serialization.Model): """Profile of the managed cluster load balancer. :ivar managed_outbound_i_ps: Desired managed outbound IPs for the cluster load balancer. @@ -3300,17 +3258,23 @@ class ManagedClusterLoadBalancerProfile(msrest.serialization.Model): """ _validation = { - 'allocated_outbound_ports': {'maximum': 64000, 'minimum': 0}, - 'idle_timeout_in_minutes': {'maximum': 120, 'minimum': 4}, + "allocated_outbound_ports": {"maximum": 64000, "minimum": 0}, + "idle_timeout_in_minutes": {"maximum": 120, "minimum": 4}, } _attribute_map = { - 'managed_outbound_i_ps': {'key': 'managedOutboundIPs', 'type': 'ManagedClusterLoadBalancerProfileManagedOutboundIPs'}, - 'outbound_ip_prefixes': {'key': 'outboundIPPrefixes', 'type': 'ManagedClusterLoadBalancerProfileOutboundIPPrefixes'}, - 'outbound_i_ps': {'key': 'outboundIPs', 'type': 'ManagedClusterLoadBalancerProfileOutboundIPs'}, - 'effective_outbound_i_ps': {'key': 'effectiveOutboundIPs', 'type': '[ResourceReference]'}, - 'allocated_outbound_ports': {'key': 'allocatedOutboundPorts', 'type': 'int'}, - 'idle_timeout_in_minutes': {'key': 'idleTimeoutInMinutes', 'type': 'int'}, + "managed_outbound_i_ps": { + "key": "managedOutboundIPs", + "type": "ManagedClusterLoadBalancerProfileManagedOutboundIPs", + }, + "outbound_ip_prefixes": { + "key": "outboundIPPrefixes", + "type": "ManagedClusterLoadBalancerProfileOutboundIPPrefixes", + }, + "outbound_i_ps": {"key": "outboundIPs", "type": "ManagedClusterLoadBalancerProfileOutboundIPs"}, + "effective_outbound_i_ps": {"key": "effectiveOutboundIPs", "type": "[ResourceReference]"}, + "allocated_outbound_ports": {"key": "allocatedOutboundPorts", "type": "int"}, + "idle_timeout_in_minutes": {"key": "idleTimeoutInMinutes", "type": "int"}, } def __init__( @@ -3320,8 +3284,8 @@ def __init__( outbound_ip_prefixes: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPPrefixes"] = None, outbound_i_ps: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPs"] = None, effective_outbound_i_ps: Optional[List["_models.ResourceReference"]] = None, - allocated_outbound_ports: Optional[int] = 0, - idle_timeout_in_minutes: Optional[int] = 30, + allocated_outbound_ports: int = 0, + idle_timeout_in_minutes: int = 30, **kwargs ): """ @@ -3347,7 +3311,7 @@ def __init__( are in the range of 4 to 120 (inclusive). The default value is 30 minutes. :paramtype idle_timeout_in_minutes: int """ - super(ManagedClusterLoadBalancerProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.managed_outbound_i_ps = managed_outbound_i_ps self.outbound_ip_prefixes = outbound_ip_prefixes self.outbound_i_ps = outbound_i_ps @@ -3356,7 +3320,7 @@ def __init__( self.idle_timeout_in_minutes = idle_timeout_in_minutes -class ManagedClusterLoadBalancerProfileManagedOutboundIPs(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfileManagedOutboundIPs(_serialization.Model): """Desired managed outbound IPs for the cluster load balancer. :ivar count: The desired number of outbound IPs created/managed by Azure for the cluster load @@ -3365,30 +3329,25 @@ class ManagedClusterLoadBalancerProfileManagedOutboundIPs(msrest.serialization.M """ _validation = { - 'count': {'maximum': 100, 'minimum': 1}, + "count": {"maximum": 100, "minimum": 1}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, + "count": {"key": "count", "type": "int"}, } - def __init__( - self, - *, - count: Optional[int] = 1, - **kwargs - ): + def __init__(self, *, count: int = 1, **kwargs): """ :keyword count: The desired number of outbound IPs created/managed by Azure for the cluster load balancer. Allowed values must be in the range of 1 to 100 (inclusive). The default value is 1. :paramtype count: int """ - super(ManagedClusterLoadBalancerProfileManagedOutboundIPs, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count -class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(_serialization.Model): """Desired outbound IP Prefix resources for the cluster load balancer. :ivar public_ip_prefixes: A list of public IP prefix resources. @@ -3397,25 +3356,20 @@ class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(msrest.serialization.M """ _attribute_map = { - 'public_ip_prefixes': {'key': 'publicIPPrefixes', 'type': '[ResourceReference]'}, + "public_ip_prefixes": {"key": "publicIPPrefixes", "type": "[ResourceReference]"}, } - def __init__( - self, - *, - public_ip_prefixes: Optional[List["_models.ResourceReference"]] = None, - **kwargs - ): + def __init__(self, *, public_ip_prefixes: Optional[List["_models.ResourceReference"]] = None, **kwargs): """ :keyword public_ip_prefixes: A list of public IP prefix resources. :paramtype public_ip_prefixes: list[~azure.mgmt.containerservice.v2021_07_01.models.ResourceReference] """ - super(ManagedClusterLoadBalancerProfileOutboundIPPrefixes, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_ip_prefixes = public_ip_prefixes -class ManagedClusterLoadBalancerProfileOutboundIPs(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfileOutboundIPs(_serialization.Model): """Desired outbound IP resources for the cluster load balancer. :ivar public_i_ps: A list of public IP resources. @@ -3423,24 +3377,19 @@ class ManagedClusterLoadBalancerProfileOutboundIPs(msrest.serialization.Model): """ _attribute_map = { - 'public_i_ps': {'key': 'publicIPs', 'type': '[ResourceReference]'}, + "public_i_ps": {"key": "publicIPs", "type": "[ResourceReference]"}, } - def __init__( - self, - *, - public_i_ps: Optional[List["_models.ResourceReference"]] = None, - **kwargs - ): + def __init__(self, *, public_i_ps: Optional[List["_models.ResourceReference"]] = None, **kwargs): """ :keyword public_i_ps: A list of public IP resources. :paramtype public_i_ps: list[~azure.mgmt.containerservice.v2021_07_01.models.ResourceReference] """ - super(ManagedClusterLoadBalancerProfileOutboundIPs, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_i_ps = public_i_ps -class ManagedClusterManagedOutboundIPProfile(msrest.serialization.Model): +class ManagedClusterManagedOutboundIPProfile(_serialization.Model): """Profile of the managed outbound IP resources of the managed cluster. :ivar count: The desired number of outbound IPs created/managed by Azure. Allowed values must @@ -3449,29 +3398,24 @@ class ManagedClusterManagedOutboundIPProfile(msrest.serialization.Model): """ _validation = { - 'count': {'maximum': 16, 'minimum': 1}, + "count": {"maximum": 16, "minimum": 1}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, + "count": {"key": "count", "type": "int"}, } - def __init__( - self, - *, - count: Optional[int] = 1, - **kwargs - ): + def __init__(self, *, count: int = 1, **kwargs): """ :keyword count: The desired number of outbound IPs created/managed by Azure. Allowed values must be in the range of 1 to 16 (inclusive). The default value is 1. :paramtype count: int """ - super(ManagedClusterManagedOutboundIPProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count -class ManagedClusterNATGatewayProfile(msrest.serialization.Model): +class ManagedClusterNATGatewayProfile(_serialization.Model): """Profile of the managed cluster NAT gateway. :ivar managed_outbound_ip_profile: Profile of the managed outbound IP resources of the cluster @@ -3487,13 +3431,16 @@ class ManagedClusterNATGatewayProfile(msrest.serialization.Model): """ _validation = { - 'idle_timeout_in_minutes': {'maximum': 120, 'minimum': 4}, + "idle_timeout_in_minutes": {"maximum": 120, "minimum": 4}, } _attribute_map = { - 'managed_outbound_ip_profile': {'key': 'managedOutboundIPProfile', 'type': 'ManagedClusterManagedOutboundIPProfile'}, - 'effective_outbound_i_ps': {'key': 'effectiveOutboundIPs', 'type': '[ResourceReference]'}, - 'idle_timeout_in_minutes': {'key': 'idleTimeoutInMinutes', 'type': 'int'}, + "managed_outbound_ip_profile": { + "key": "managedOutboundIPProfile", + "type": "ManagedClusterManagedOutboundIPProfile", + }, + "effective_outbound_i_ps": {"key": "effectiveOutboundIPs", "type": "[ResourceReference]"}, + "idle_timeout_in_minutes": {"key": "idleTimeoutInMinutes", "type": "int"}, } def __init__( @@ -3501,7 +3448,7 @@ def __init__( *, managed_outbound_ip_profile: Optional["_models.ManagedClusterManagedOutboundIPProfile"] = None, effective_outbound_i_ps: Optional[List["_models.ResourceReference"]] = None, - idle_timeout_in_minutes: Optional[int] = 4, + idle_timeout_in_minutes: int = 4, **kwargs ): """ @@ -3517,29 +3464,29 @@ def __init__( are in the range of 4 to 120 (inclusive). The default value is 4 minutes. :paramtype idle_timeout_in_minutes: int """ - super(ManagedClusterNATGatewayProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.managed_outbound_ip_profile = managed_outbound_ip_profile self.effective_outbound_i_ps = effective_outbound_i_ps self.idle_timeout_in_minutes = idle_timeout_in_minutes -class ManagedClusterPodIdentity(msrest.serialization.Model): +class ManagedClusterPodIdentity(_serialization.Model): """Details about the pod identity assigned to the Managed Cluster. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar name: Required. The name of the pod identity. + :ivar name: The name of the pod identity. Required. :vartype name: str - :ivar namespace: Required. The namespace of the pod identity. + :ivar namespace: The namespace of the pod identity. Required. :vartype namespace: str :ivar binding_selector: The binding selector to use for the AzureIdentityBinding resource. :vartype binding_selector: str - :ivar identity: Required. The user assigned identity details. + :ivar identity: The user assigned identity details. Required. :vartype identity: ~azure.mgmt.containerservice.v2021_07_01.models.UserAssignedIdentity :ivar provisioning_state: The current provisioning state of the pod identity. Known values are: - "Assigned", "Updating", "Deleting", "Failed". + "Assigned", "Updating", "Deleting", and "Failed". :vartype provisioning_state: str or ~azure.mgmt.containerservice.v2021_07_01.models.ManagedClusterPodIdentityProvisioningState :ivar provisioning_info: @@ -3548,20 +3495,20 @@ class ManagedClusterPodIdentity(msrest.serialization.Model): """ _validation = { - 'name': {'required': True}, - 'namespace': {'required': True}, - 'identity': {'required': True}, - 'provisioning_state': {'readonly': True}, - 'provisioning_info': {'readonly': True}, + "name": {"required": True}, + "namespace": {"required": True}, + "identity": {"required": True}, + "provisioning_state": {"readonly": True}, + "provisioning_info": {"readonly": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'namespace': {'key': 'namespace', 'type': 'str'}, - 'binding_selector': {'key': 'bindingSelector', 'type': 'str'}, - 'identity': {'key': 'identity', 'type': 'UserAssignedIdentity'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'provisioning_info': {'key': 'provisioningInfo', 'type': 'ManagedClusterPodIdentityProvisioningInfo'}, + "name": {"key": "name", "type": "str"}, + "namespace": {"key": "namespace", "type": "str"}, + "binding_selector": {"key": "bindingSelector", "type": "str"}, + "identity": {"key": "identity", "type": "UserAssignedIdentity"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "provisioning_info": {"key": "provisioningInfo", "type": "ManagedClusterPodIdentityProvisioningInfo"}, } def __init__( @@ -3574,16 +3521,16 @@ def __init__( **kwargs ): """ - :keyword name: Required. The name of the pod identity. + :keyword name: The name of the pod identity. Required. :paramtype name: str - :keyword namespace: Required. The namespace of the pod identity. + :keyword namespace: The namespace of the pod identity. Required. :paramtype namespace: str :keyword binding_selector: The binding selector to use for the AzureIdentityBinding resource. :paramtype binding_selector: str - :keyword identity: Required. The user assigned identity details. + :keyword identity: The user assigned identity details. Required. :paramtype identity: ~azure.mgmt.containerservice.v2021_07_01.models.UserAssignedIdentity """ - super(ManagedClusterPodIdentity, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.namespace = namespace self.binding_selector = binding_selector @@ -3592,54 +3539,47 @@ def __init__( self.provisioning_info = None -class ManagedClusterPodIdentityException(msrest.serialization.Model): +class ManagedClusterPodIdentityException(_serialization.Model): """See `disable AAD Pod Identity for a specific Pod/Application `_ for more details. All required parameters must be populated in order to send to Azure. - :ivar name: Required. The name of the pod identity exception. + :ivar name: The name of the pod identity exception. Required. :vartype name: str - :ivar namespace: Required. The namespace of the pod identity exception. + :ivar namespace: The namespace of the pod identity exception. Required. :vartype namespace: str - :ivar pod_labels: Required. The pod labels to match. + :ivar pod_labels: The pod labels to match. Required. :vartype pod_labels: dict[str, str] """ _validation = { - 'name': {'required': True}, - 'namespace': {'required': True}, - 'pod_labels': {'required': True}, + "name": {"required": True}, + "namespace": {"required": True}, + "pod_labels": {"required": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'namespace': {'key': 'namespace', 'type': 'str'}, - 'pod_labels': {'key': 'podLabels', 'type': '{str}'}, + "name": {"key": "name", "type": "str"}, + "namespace": {"key": "namespace", "type": "str"}, + "pod_labels": {"key": "podLabels", "type": "{str}"}, } - def __init__( - self, - *, - name: str, - namespace: str, - pod_labels: Dict[str, str], - **kwargs - ): + def __init__(self, *, name: str, namespace: str, pod_labels: Dict[str, str], **kwargs): """ - :keyword name: Required. The name of the pod identity exception. + :keyword name: The name of the pod identity exception. Required. :paramtype name: str - :keyword namespace: Required. The namespace of the pod identity exception. + :keyword namespace: The namespace of the pod identity exception. Required. :paramtype namespace: str - :keyword pod_labels: Required. The pod labels to match. + :keyword pod_labels: The pod labels to match. Required. :paramtype pod_labels: dict[str, str] """ - super(ManagedClusterPodIdentityException, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.namespace = namespace self.pod_labels = pod_labels -class ManagedClusterPodIdentityProfile(msrest.serialization.Model): +class ManagedClusterPodIdentityProfile(_serialization.Model): """See `use AAD pod identity `_ for more details on pod identity integration. :ivar enabled: Whether the pod identity addon is enabled. @@ -3659,10 +3599,13 @@ class ManagedClusterPodIdentityProfile(msrest.serialization.Model): """ _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'allow_network_plugin_kubenet': {'key': 'allowNetworkPluginKubenet', 'type': 'bool'}, - 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '[ManagedClusterPodIdentity]'}, - 'user_assigned_identity_exceptions': {'key': 'userAssignedIdentityExceptions', 'type': '[ManagedClusterPodIdentityException]'}, + "enabled": {"key": "enabled", "type": "bool"}, + "allow_network_plugin_kubenet": {"key": "allowNetworkPluginKubenet", "type": "bool"}, + "user_assigned_identities": {"key": "userAssignedIdentities", "type": "[ManagedClusterPodIdentity]"}, + "user_assigned_identity_exceptions": { + "key": "userAssignedIdentityExceptions", + "type": "[ManagedClusterPodIdentityException]", + }, } def __init__( @@ -3690,14 +3633,14 @@ def __init__( :paramtype user_assigned_identity_exceptions: list[~azure.mgmt.containerservice.v2021_07_01.models.ManagedClusterPodIdentityException] """ - super(ManagedClusterPodIdentityProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.allow_network_plugin_kubenet = allow_network_plugin_kubenet self.user_assigned_identities = user_assigned_identities self.user_assigned_identity_exceptions = user_assigned_identity_exceptions -class ManagedClusterPodIdentityProvisioningError(msrest.serialization.Model): +class ManagedClusterPodIdentityProvisioningError(_serialization.Model): """An error response from the pod identity provisioning. :ivar error: Details about the error. @@ -3706,25 +3649,20 @@ class ManagedClusterPodIdentityProvisioningError(msrest.serialization.Model): """ _attribute_map = { - 'error': {'key': 'error', 'type': 'ManagedClusterPodIdentityProvisioningErrorBody'}, + "error": {"key": "error", "type": "ManagedClusterPodIdentityProvisioningErrorBody"}, } - def __init__( - self, - *, - error: Optional["_models.ManagedClusterPodIdentityProvisioningErrorBody"] = None, - **kwargs - ): + def __init__(self, *, error: Optional["_models.ManagedClusterPodIdentityProvisioningErrorBody"] = None, **kwargs): """ :keyword error: Details about the error. :paramtype error: ~azure.mgmt.containerservice.v2021_07_01.models.ManagedClusterPodIdentityProvisioningErrorBody """ - super(ManagedClusterPodIdentityProvisioningError, self).__init__(**kwargs) + super().__init__(**kwargs) self.error = error -class ManagedClusterPodIdentityProvisioningErrorBody(msrest.serialization.Model): +class ManagedClusterPodIdentityProvisioningErrorBody(_serialization.Model): """An error response from the pod identity provisioning. :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed @@ -3742,10 +3680,10 @@ class ManagedClusterPodIdentityProvisioningErrorBody(msrest.serialization.Model) """ _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[ManagedClusterPodIdentityProvisioningErrorBody]'}, + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[ManagedClusterPodIdentityProvisioningErrorBody]"}, } def __init__( @@ -3771,14 +3709,14 @@ def __init__( :paramtype details: list[~azure.mgmt.containerservice.v2021_07_01.models.ManagedClusterPodIdentityProvisioningErrorBody] """ - super(ManagedClusterPodIdentityProvisioningErrorBody, self).__init__(**kwargs) + super().__init__(**kwargs) self.code = code self.message = message self.target = target self.details = details -class ManagedClusterPodIdentityProvisioningInfo(msrest.serialization.Model): +class ManagedClusterPodIdentityProvisioningInfo(_serialization.Model): """ManagedClusterPodIdentityProvisioningInfo. :ivar error: Pod identity assignment error (if any). @@ -3787,35 +3725,30 @@ class ManagedClusterPodIdentityProvisioningInfo(msrest.serialization.Model): """ _attribute_map = { - 'error': {'key': 'error', 'type': 'ManagedClusterPodIdentityProvisioningError'}, + "error": {"key": "error", "type": "ManagedClusterPodIdentityProvisioningError"}, } - def __init__( - self, - *, - error: Optional["_models.ManagedClusterPodIdentityProvisioningError"] = None, - **kwargs - ): + def __init__(self, *, error: Optional["_models.ManagedClusterPodIdentityProvisioningError"] = None, **kwargs): """ :keyword error: Pod identity assignment error (if any). :paramtype error: ~azure.mgmt.containerservice.v2021_07_01.models.ManagedClusterPodIdentityProvisioningError """ - super(ManagedClusterPodIdentityProvisioningInfo, self).__init__(**kwargs) + super().__init__(**kwargs) self.error = error -class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): +class ManagedClusterPoolUpgradeProfile(_serialization.Model): """The list of available upgrade versions. All required parameters must be populated in order to send to Azure. - :ivar kubernetes_version: Required. The Kubernetes version (major.minor.patch). + :ivar kubernetes_version: The Kubernetes version (major.minor.patch). Required. :vartype kubernetes_version: str :ivar name: The Agent Pool name. :vartype name: str - :ivar os_type: Required. The operating system type. The default is Linux. Known values are: - "Linux", "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2021_07_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -3823,15 +3756,15 @@ class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): """ _validation = { - 'kubernetes_version': {'required': True}, - 'os_type': {'required': True}, + "kubernetes_version": {"required": True}, + "os_type": {"required": True}, } _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'upgrades': {'key': 'upgrades', 'type': '[ManagedClusterPoolUpgradeProfileUpgradesItem]'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "os_type": {"key": "osType", "type": "str"}, + "upgrades": {"key": "upgrades", "type": "[ManagedClusterPoolUpgradeProfileUpgradesItem]"}, } def __init__( @@ -3844,25 +3777,25 @@ def __init__( **kwargs ): """ - :keyword kubernetes_version: Required. The Kubernetes version (major.minor.patch). + :keyword kubernetes_version: The Kubernetes version (major.minor.patch). Required. :paramtype kubernetes_version: str :keyword name: The Agent Pool name. :paramtype name: str - :keyword os_type: Required. The operating system type. The default is Linux. Known values are: - "Linux", "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2021_07_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: list[~azure.mgmt.containerservice.v2021_07_01.models.ManagedClusterPoolUpgradeProfileUpgradesItem] """ - super(ManagedClusterPoolUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.name = name self.os_type = os_type self.upgrades = upgrades -class ManagedClusterPoolUpgradeProfileUpgradesItem(msrest.serialization.Model): +class ManagedClusterPoolUpgradeProfileUpgradesItem(_serialization.Model): """ManagedClusterPoolUpgradeProfileUpgradesItem. :ivar kubernetes_version: The Kubernetes version (major.minor.patch). @@ -3872,36 +3805,30 @@ class ManagedClusterPoolUpgradeProfileUpgradesItem(msrest.serialization.Model): """ _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } - def __init__( - self, - *, - kubernetes_version: Optional[str] = None, - is_preview: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, kubernetes_version: Optional[str] = None, is_preview: Optional[bool] = None, **kwargs): """ :keyword kubernetes_version: The Kubernetes version (major.minor.patch). :paramtype kubernetes_version: str :keyword is_preview: Whether the Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(ManagedClusterPoolUpgradeProfileUpgradesItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.is_preview = is_preview -class ManagedClusterPropertiesAutoScalerProfile(msrest.serialization.Model): +class ManagedClusterPropertiesAutoScalerProfile(_serialization.Model): # pylint: disable=too-many-instance-attributes """Parameters to be applied to the cluster-autoscaler when enabled. :ivar balance_similar_node_groups: Valid values are 'true' and 'false'. :vartype balance_similar_node_groups: str :ivar expander: If not specified, the default is 'random'. See `expanders `_ - for more information. Known values are: "least-waste", "most-pods", "priority", "random". + for more information. Known values are: "least-waste", "most-pods", "priority", and "random". :vartype expander: str or ~azure.mgmt.containerservice.v2021_07_01.models.Expander :ivar max_empty_bulk_delete: The default is 10. :vartype max_empty_bulk_delete: str @@ -3945,23 +3872,23 @@ class ManagedClusterPropertiesAutoScalerProfile(msrest.serialization.Model): """ _attribute_map = { - 'balance_similar_node_groups': {'key': 'balance-similar-node-groups', 'type': 'str'}, - 'expander': {'key': 'expander', 'type': 'str'}, - 'max_empty_bulk_delete': {'key': 'max-empty-bulk-delete', 'type': 'str'}, - 'max_graceful_termination_sec': {'key': 'max-graceful-termination-sec', 'type': 'str'}, - 'max_node_provision_time': {'key': 'max-node-provision-time', 'type': 'str'}, - 'max_total_unready_percentage': {'key': 'max-total-unready-percentage', 'type': 'str'}, - 'new_pod_scale_up_delay': {'key': 'new-pod-scale-up-delay', 'type': 'str'}, - 'ok_total_unready_count': {'key': 'ok-total-unready-count', 'type': 'str'}, - 'scan_interval': {'key': 'scan-interval', 'type': 'str'}, - 'scale_down_delay_after_add': {'key': 'scale-down-delay-after-add', 'type': 'str'}, - 'scale_down_delay_after_delete': {'key': 'scale-down-delay-after-delete', 'type': 'str'}, - 'scale_down_delay_after_failure': {'key': 'scale-down-delay-after-failure', 'type': 'str'}, - 'scale_down_unneeded_time': {'key': 'scale-down-unneeded-time', 'type': 'str'}, - 'scale_down_unready_time': {'key': 'scale-down-unready-time', 'type': 'str'}, - 'scale_down_utilization_threshold': {'key': 'scale-down-utilization-threshold', 'type': 'str'}, - 'skip_nodes_with_local_storage': {'key': 'skip-nodes-with-local-storage', 'type': 'str'}, - 'skip_nodes_with_system_pods': {'key': 'skip-nodes-with-system-pods', 'type': 'str'}, + "balance_similar_node_groups": {"key": "balance-similar-node-groups", "type": "str"}, + "expander": {"key": "expander", "type": "str"}, + "max_empty_bulk_delete": {"key": "max-empty-bulk-delete", "type": "str"}, + "max_graceful_termination_sec": {"key": "max-graceful-termination-sec", "type": "str"}, + "max_node_provision_time": {"key": "max-node-provision-time", "type": "str"}, + "max_total_unready_percentage": {"key": "max-total-unready-percentage", "type": "str"}, + "new_pod_scale_up_delay": {"key": "new-pod-scale-up-delay", "type": "str"}, + "ok_total_unready_count": {"key": "ok-total-unready-count", "type": "str"}, + "scan_interval": {"key": "scan-interval", "type": "str"}, + "scale_down_delay_after_add": {"key": "scale-down-delay-after-add", "type": "str"}, + "scale_down_delay_after_delete": {"key": "scale-down-delay-after-delete", "type": "str"}, + "scale_down_delay_after_failure": {"key": "scale-down-delay-after-failure", "type": "str"}, + "scale_down_unneeded_time": {"key": "scale-down-unneeded-time", "type": "str"}, + "scale_down_unready_time": {"key": "scale-down-unready-time", "type": "str"}, + "scale_down_utilization_threshold": {"key": "scale-down-utilization-threshold", "type": "str"}, + "skip_nodes_with_local_storage": {"key": "skip-nodes-with-local-storage", "type": "str"}, + "skip_nodes_with_system_pods": {"key": "skip-nodes-with-system-pods", "type": "str"}, } def __init__( @@ -3991,7 +3918,7 @@ def __init__( :paramtype balance_similar_node_groups: str :keyword expander: If not specified, the default is 'random'. See `expanders `_ - for more information. Known values are: "least-waste", "most-pods", "priority", "random". + for more information. Known values are: "least-waste", "most-pods", "priority", and "random". :paramtype expander: str or ~azure.mgmt.containerservice.v2021_07_01.models.Expander :keyword max_empty_bulk_delete: The default is 10. :paramtype max_empty_bulk_delete: str @@ -4034,7 +3961,7 @@ def __init__( :keyword skip_nodes_with_system_pods: The default is true. :paramtype skip_nodes_with_system_pods: str """ - super(ManagedClusterPropertiesAutoScalerProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.balance_similar_node_groups = balance_similar_node_groups self.expander = expander self.max_empty_bulk_delete = max_empty_bulk_delete @@ -4054,7 +3981,7 @@ def __init__( self.skip_nodes_with_system_pods = skip_nodes_with_system_pods -class ManagedClusterSecurityProfile(msrest.serialization.Model): +class ManagedClusterSecurityProfile(_serialization.Model): """Security profile for the container service cluster. :ivar azure_defender: Azure Defender settings for the security profile. @@ -4063,25 +3990,22 @@ class ManagedClusterSecurityProfile(msrest.serialization.Model): """ _attribute_map = { - 'azure_defender': {'key': 'azureDefender', 'type': 'ManagedClusterSecurityProfileAzureDefender'}, + "azure_defender": {"key": "azureDefender", "type": "ManagedClusterSecurityProfileAzureDefender"}, } def __init__( - self, - *, - azure_defender: Optional["_models.ManagedClusterSecurityProfileAzureDefender"] = None, - **kwargs + self, *, azure_defender: Optional["_models.ManagedClusterSecurityProfileAzureDefender"] = None, **kwargs ): """ :keyword azure_defender: Azure Defender settings for the security profile. :paramtype azure_defender: ~azure.mgmt.containerservice.v2021_07_01.models.ManagedClusterSecurityProfileAzureDefender """ - super(ManagedClusterSecurityProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.azure_defender = azure_defender -class ManagedClusterSecurityProfileAzureDefender(msrest.serialization.Model): +class ManagedClusterSecurityProfileAzureDefender(_serialization.Model): """Azure Defender settings for the security profile. :ivar enabled: Whether to enable Azure Defender. @@ -4094,16 +4018,12 @@ class ManagedClusterSecurityProfileAzureDefender(msrest.serialization.Model): """ _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'log_analytics_workspace_resource_id': {'key': 'logAnalyticsWorkspaceResourceId', 'type': 'str'}, + "enabled": {"key": "enabled", "type": "bool"}, + "log_analytics_workspace_resource_id": {"key": "logAnalyticsWorkspaceResourceId", "type": "str"}, } def __init__( - self, - *, - enabled: Optional[bool] = None, - log_analytics_workspace_resource_id: Optional[str] = None, - **kwargs + self, *, enabled: Optional[bool] = None, log_analytics_workspace_resource_id: Optional[str] = None, **kwargs ): """ :keyword enabled: Whether to enable Azure Defender. @@ -4114,63 +4034,57 @@ def __init__( be exists. :paramtype log_analytics_workspace_resource_id: str """ - super(ManagedClusterSecurityProfileAzureDefender, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.log_analytics_workspace_resource_id = log_analytics_workspace_resource_id -class ManagedClusterServicePrincipalProfile(msrest.serialization.Model): +class ManagedClusterServicePrincipalProfile(_serialization.Model): """Information about a service principal identity for the cluster to use for manipulating Azure APIs. All required parameters must be populated in order to send to Azure. - :ivar client_id: Required. The ID for the service principal. + :ivar client_id: The ID for the service principal. Required. :vartype client_id: str :ivar secret: The secret password associated with the service principal in plain text. :vartype secret: str """ _validation = { - 'client_id': {'required': True}, + "client_id": {"required": True}, } _attribute_map = { - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'secret': {'key': 'secret', 'type': 'str'}, + "client_id": {"key": "clientId", "type": "str"}, + "secret": {"key": "secret", "type": "str"}, } - def __init__( - self, - *, - client_id: str, - secret: Optional[str] = None, - **kwargs - ): + def __init__(self, *, client_id: str, secret: Optional[str] = None, **kwargs): """ - :keyword client_id: Required. The ID for the service principal. + :keyword client_id: The ID for the service principal. Required. :paramtype client_id: str :keyword secret: The secret password associated with the service principal in plain text. :paramtype secret: str """ - super(ManagedClusterServicePrincipalProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.client_id = client_id self.secret = secret -class ManagedClusterSKU(msrest.serialization.Model): +class ManagedClusterSKU(_serialization.Model): """The SKU of a Managed Cluster. - :ivar name: The name of a managed cluster SKU. Known values are: "Basic". + :ivar name: The name of a managed cluster SKU. "Basic" :vartype name: str or ~azure.mgmt.containerservice.v2021_07_01.models.ManagedClusterSKUName :ivar tier: If not specified, the default is 'Free'. See `uptime SLA - `_ for more details. Known values are: "Paid", - "Free". + `_ for more details. Known values are: "Paid" + and "Free". :vartype tier: str or ~azure.mgmt.containerservice.v2021_07_01.models.ManagedClusterSKUTier """ _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, + "name": {"key": "name", "type": "str"}, + "tier": {"key": "tier", "type": "str"}, } def __init__( @@ -4181,19 +4095,19 @@ def __init__( **kwargs ): """ - :keyword name: The name of a managed cluster SKU. Known values are: "Basic". + :keyword name: The name of a managed cluster SKU. "Basic" :paramtype name: str or ~azure.mgmt.containerservice.v2021_07_01.models.ManagedClusterSKUName :keyword tier: If not specified, the default is 'Free'. See `uptime SLA - `_ for more details. Known values are: "Paid", - "Free". + `_ for more details. Known values are: "Paid" + and "Free". :paramtype tier: str or ~azure.mgmt.containerservice.v2021_07_01.models.ManagedClusterSKUTier """ - super(ManagedClusterSKU, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.tier = tier -class ManagedClusterUpgradeProfile(msrest.serialization.Model): +class ManagedClusterUpgradeProfile(_serialization.Model): """The list of available upgrades for compute pools. Variables are only populated by the server, and will be ignored when sending a request. @@ -4206,29 +4120,29 @@ class ManagedClusterUpgradeProfile(msrest.serialization.Model): :vartype name: str :ivar type: The type of the upgrade profile. :vartype type: str - :ivar control_plane_profile: Required. The list of available upgrade versions for the control - plane. + :ivar control_plane_profile: The list of available upgrade versions for the control plane. + Required. :vartype control_plane_profile: ~azure.mgmt.containerservice.v2021_07_01.models.ManagedClusterPoolUpgradeProfile - :ivar agent_pool_profiles: Required. The list of available upgrade versions for agent pools. + :ivar agent_pool_profiles: The list of available upgrade versions for agent pools. Required. :vartype agent_pool_profiles: list[~azure.mgmt.containerservice.v2021_07_01.models.ManagedClusterPoolUpgradeProfile] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'control_plane_profile': {'required': True}, - 'agent_pool_profiles': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "control_plane_profile": {"required": True}, + "agent_pool_profiles": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'control_plane_profile': {'key': 'properties.controlPlaneProfile', 'type': 'ManagedClusterPoolUpgradeProfile'}, - 'agent_pool_profiles': {'key': 'properties.agentPoolProfiles', 'type': '[ManagedClusterPoolUpgradeProfile]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "control_plane_profile": {"key": "properties.controlPlaneProfile", "type": "ManagedClusterPoolUpgradeProfile"}, + "agent_pool_profiles": {"key": "properties.agentPoolProfiles", "type": "[ManagedClusterPoolUpgradeProfile]"}, } def __init__( @@ -4239,15 +4153,15 @@ def __init__( **kwargs ): """ - :keyword control_plane_profile: Required. The list of available upgrade versions for the - control plane. + :keyword control_plane_profile: The list of available upgrade versions for the control plane. + Required. :paramtype control_plane_profile: ~azure.mgmt.containerservice.v2021_07_01.models.ManagedClusterPoolUpgradeProfile - :keyword agent_pool_profiles: Required. The list of available upgrade versions for agent pools. + :keyword agent_pool_profiles: The list of available upgrade versions for agent pools. Required. :paramtype agent_pool_profiles: list[~azure.mgmt.containerservice.v2021_07_01.models.ManagedClusterPoolUpgradeProfile] """ - super(ManagedClusterUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -4255,18 +4169,18 @@ def __init__( self.agent_pool_profiles = agent_pool_profiles -class ManagedClusterWindowsProfile(msrest.serialization.Model): +class ManagedClusterWindowsProfile(_serialization.Model): """Profile for Windows VMs in the managed cluster. All required parameters must be populated in order to send to Azure. - :ivar admin_username: Required. Specifies the name of the administrator account. - :code:`
`:code:`
` **Restriction:** Cannot end in "." :code:`
`:code:`
` - **Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", "test1", - "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", - "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", - "sys", "test2", "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 - character :code:`
`:code:`
` **Max-length:** 20 characters. + :ivar admin_username: Specifies the name of the administrator account. :code:`
`:code:`
` + **Restriction:** Cannot end in "." :code:`
`:code:`
` **Disallowed values:** + "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", + "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", + "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", + "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 character + :code:`
`:code:`
` **Max-length:** 20 characters. Required. :vartype admin_username: str :ivar admin_password: Specifies the password of the administrator account. :code:`
`:code:`
` **Minimum-length:** 8 characters :code:`
`:code:`
` @@ -4278,7 +4192,7 @@ class ManagedClusterWindowsProfile(msrest.serialization.Model): :vartype admin_password: str :ivar license_type: The license type to use for Windows VMs. See `Azure Hybrid User Benefits `_ for more details. Known values are: - "None", "Windows_Server". + "None" and "Windows_Server". :vartype license_type: str or ~azure.mgmt.containerservice.v2021_07_01.models.LicenseType :ivar enable_csi_proxy: For more details on CSI proxy, see the `CSI proxy GitHub repo `_. @@ -4286,14 +4200,14 @@ class ManagedClusterWindowsProfile(msrest.serialization.Model): """ _validation = { - 'admin_username': {'required': True}, + "admin_username": {"required": True}, } _attribute_map = { - 'admin_username': {'key': 'adminUsername', 'type': 'str'}, - 'admin_password': {'key': 'adminPassword', 'type': 'str'}, - 'license_type': {'key': 'licenseType', 'type': 'str'}, - 'enable_csi_proxy': {'key': 'enableCSIProxy', 'type': 'bool'}, + "admin_username": {"key": "adminUsername", "type": "str"}, + "admin_password": {"key": "adminPassword", "type": "str"}, + "license_type": {"key": "licenseType", "type": "str"}, + "enable_csi_proxy": {"key": "enableCSIProxy", "type": "bool"}, } def __init__( @@ -4306,13 +4220,13 @@ def __init__( **kwargs ): """ - :keyword admin_username: Required. Specifies the name of the administrator account. + :keyword admin_username: Specifies the name of the administrator account. :code:`
`:code:`
` **Restriction:** Cannot end in "." :code:`
`:code:`
` **Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 - character :code:`
`:code:`
` **Max-length:** 20 characters. + character :code:`
`:code:`
` **Max-length:** 20 characters. Required. :paramtype admin_username: str :keyword admin_password: Specifies the password of the administrator account. :code:`
`:code:`
` **Minimum-length:** 8 characters :code:`
`:code:`
` @@ -4324,20 +4238,20 @@ def __init__( :paramtype admin_password: str :keyword license_type: The license type to use for Windows VMs. See `Azure Hybrid User Benefits `_ for more details. Known values are: - "None", "Windows_Server". + "None" and "Windows_Server". :paramtype license_type: str or ~azure.mgmt.containerservice.v2021_07_01.models.LicenseType :keyword enable_csi_proxy: For more details on CSI proxy, see the `CSI proxy GitHub repo `_. :paramtype enable_csi_proxy: bool """ - super(ManagedClusterWindowsProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.admin_username = admin_username self.admin_password = admin_password self.license_type = license_type self.enable_csi_proxy = enable_csi_proxy -class ManagedServiceIdentityUserAssignedIdentitiesValue(msrest.serialization.Model): +class ManagedServiceIdentityUserAssignedIdentitiesValue(_serialization.Model): """ManagedServiceIdentityUserAssignedIdentitiesValue. Variables are only populated by the server, and will be ignored when sending a request. @@ -4349,27 +4263,23 @@ class ManagedServiceIdentityUserAssignedIdentitiesValue(msrest.serialization.Mod """ _validation = { - 'principal_id': {'readonly': True}, - 'client_id': {'readonly': True}, + "principal_id": {"readonly": True}, + "client_id": {"readonly": True}, } _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, + "principal_id": {"key": "principalId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(ManagedServiceIdentityUserAssignedIdentitiesValue, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.principal_id = None self.client_id = None -class OperationListResult(msrest.serialization.Model): +class OperationListResult(_serialization.Model): """The List Operation response. Variables are only populated by the server, and will be ignored when sending a request. @@ -4379,24 +4289,20 @@ class OperationListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[OperationValue]'}, + "value": {"key": "value", "type": "[OperationValue]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(OperationListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None -class OperationValue(msrest.serialization.Model): +class OperationValue(_serialization.Model): """Describes the properties of a Operation value. Variables are only populated by the server, and will be ignored when sending a request. @@ -4416,30 +4322,26 @@ class OperationValue(msrest.serialization.Model): """ _validation = { - 'origin': {'readonly': True}, - 'name': {'readonly': True}, - 'operation': {'readonly': True}, - 'resource': {'readonly': True}, - 'description': {'readonly': True}, - 'provider': {'readonly': True}, + "origin": {"readonly": True}, + "name": {"readonly": True}, + "operation": {"readonly": True}, + "resource": {"readonly": True}, + "description": {"readonly": True}, + "provider": {"readonly": True}, } _attribute_map = { - 'origin': {'key': 'origin', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'operation': {'key': 'display.operation', 'type': 'str'}, - 'resource': {'key': 'display.resource', 'type': 'str'}, - 'description': {'key': 'display.description', 'type': 'str'}, - 'provider': {'key': 'display.provider', 'type': 'str'}, + "origin": {"key": "origin", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "operation": {"key": "display.operation", "type": "str"}, + "resource": {"key": "display.resource", "type": "str"}, + "description": {"key": "display.description", "type": "str"}, + "provider": {"key": "display.provider", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(OperationValue, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.origin = None self.name = None self.operation = None @@ -4448,7 +4350,7 @@ def __init__( self.provider = None -class OSOptionProfile(msrest.serialization.Model): +class OSOptionProfile(_serialization.Model): """The OS option profile. Variables are only populated by the server, and will be ignored when sending a request. @@ -4461,83 +4363,72 @@ class OSOptionProfile(msrest.serialization.Model): :vartype name: str :ivar type: The type of the OS option resource. :vartype type: str - :ivar os_option_property_list: Required. The list of OS options. + :ivar os_option_property_list: The list of OS options. Required. :vartype os_option_property_list: list[~azure.mgmt.containerservice.v2021_07_01.models.OSOptionProperty] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'os_option_property_list': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "os_option_property_list": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'os_option_property_list': {'key': 'properties.osOptionPropertyList', 'type': '[OSOptionProperty]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "os_option_property_list": {"key": "properties.osOptionPropertyList", "type": "[OSOptionProperty]"}, } - def __init__( - self, - *, - os_option_property_list: List["_models.OSOptionProperty"], - **kwargs - ): + def __init__(self, *, os_option_property_list: List["_models.OSOptionProperty"], **kwargs): """ - :keyword os_option_property_list: Required. The list of OS options. + :keyword os_option_property_list: The list of OS options. Required. :paramtype os_option_property_list: list[~azure.mgmt.containerservice.v2021_07_01.models.OSOptionProperty] """ - super(OSOptionProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None self.os_option_property_list = os_option_property_list -class OSOptionProperty(msrest.serialization.Model): +class OSOptionProperty(_serialization.Model): """OS option property. All required parameters must be populated in order to send to Azure. - :ivar os_type: Required. The OS type. + :ivar os_type: The OS type. Required. :vartype os_type: str - :ivar enable_fips_image: Required. Whether the image is FIPS-enabled. + :ivar enable_fips_image: Whether the image is FIPS-enabled. Required. :vartype enable_fips_image: bool """ _validation = { - 'os_type': {'required': True}, - 'enable_fips_image': {'required': True}, + "os_type": {"required": True}, + "enable_fips_image": {"required": True}, } _attribute_map = { - 'os_type': {'key': 'os-type', 'type': 'str'}, - 'enable_fips_image': {'key': 'enable-fips-image', 'type': 'bool'}, + "os_type": {"key": "os-type", "type": "str"}, + "enable_fips_image": {"key": "enable-fips-image", "type": "bool"}, } - def __init__( - self, - *, - os_type: str, - enable_fips_image: bool, - **kwargs - ): + def __init__(self, *, os_type: str, enable_fips_image: bool, **kwargs): """ - :keyword os_type: Required. The OS type. + :keyword os_type: The OS type. Required. :paramtype os_type: str - :keyword enable_fips_image: Required. Whether the image is FIPS-enabled. + :keyword enable_fips_image: Whether the image is FIPS-enabled. Required. :paramtype enable_fips_image: bool """ - super(OSOptionProperty, self).__init__(**kwargs) + super().__init__(**kwargs) self.os_type = os_type self.enable_fips_image = enable_fips_image -class OutboundEnvironmentEndpoint(msrest.serialization.Model): +class OutboundEnvironmentEndpoint(_serialization.Model): """Egress endpoints which AKS agent nodes connect to for common purpose. :ivar category: The category of endpoints accessed by the AKS agent node, e.g. @@ -4548,8 +4439,8 @@ class OutboundEnvironmentEndpoint(msrest.serialization.Model): """ _attribute_map = { - 'category': {'key': 'category', 'type': 'str'}, - 'endpoints': {'key': 'endpoints', 'type': '[EndpointDependency]'}, + "category": {"key": "category", "type": "str"}, + "endpoints": {"key": "endpoints", "type": "[EndpointDependency]"}, } def __init__( @@ -4566,19 +4457,19 @@ def __init__( :keyword endpoints: The endpoints that AKS agent nodes connect to. :paramtype endpoints: list[~azure.mgmt.containerservice.v2021_07_01.models.EndpointDependency] """ - super(OutboundEnvironmentEndpoint, self).__init__(**kwargs) + super().__init__(**kwargs) self.category = category self.endpoints = endpoints -class OutboundEnvironmentEndpointCollection(msrest.serialization.Model): +class OutboundEnvironmentEndpointCollection(_serialization.Model): """Collection of OutboundEnvironmentEndpoint. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar value: Required. Collection of resources. + :ivar value: Collection of resources. Required. :vartype value: list[~azure.mgmt.containerservice.v2021_07_01.models.OutboundEnvironmentEndpoint] :ivar next_link: Link to next page of resources. @@ -4586,59 +4477,49 @@ class OutboundEnvironmentEndpointCollection(msrest.serialization.Model): """ _validation = { - 'value': {'required': True}, - 'next_link': {'readonly': True}, + "value": {"required": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[OutboundEnvironmentEndpoint]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[OutboundEnvironmentEndpoint]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: List["_models.OutboundEnvironmentEndpoint"], - **kwargs - ): + def __init__(self, *, value: List["_models.OutboundEnvironmentEndpoint"], **kwargs): """ - :keyword value: Required. Collection of resources. + :keyword value: Collection of resources. Required. :paramtype value: list[~azure.mgmt.containerservice.v2021_07_01.models.OutboundEnvironmentEndpoint] """ - super(OutboundEnvironmentEndpointCollection, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class PowerState(msrest.serialization.Model): +class PowerState(_serialization.Model): """Describes the Power State of the cluster. - :ivar code: Tells whether the cluster is Running or Stopped. Known values are: "Running", + :ivar code: Tells whether the cluster is Running or Stopped. Known values are: "Running" and "Stopped". :vartype code: str or ~azure.mgmt.containerservice.v2021_07_01.models.Code """ _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, + "code": {"key": "code", "type": "str"}, } - def __init__( - self, - *, - code: Optional[Union[str, "_models.Code"]] = None, - **kwargs - ): + def __init__(self, *, code: Optional[Union[str, "_models.Code"]] = None, **kwargs): """ - :keyword code: Tells whether the cluster is Running or Stopped. Known values are: "Running", + :keyword code: Tells whether the cluster is Running or Stopped. Known values are: "Running" and "Stopped". :paramtype code: str or ~azure.mgmt.containerservice.v2021_07_01.models.Code """ - super(PowerState, self).__init__(**kwargs) + super().__init__(**kwargs) self.code = code -class PrivateEndpoint(msrest.serialization.Model): +class PrivateEndpoint(_serialization.Model): """Private endpoint which a connection belongs to. :ivar id: The resource ID of the private endpoint. @@ -4646,24 +4527,19 @@ class PrivateEndpoint(msrest.serialization.Model): """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, } - def __init__( - self, - *, - id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin """ :keyword id: The resource ID of the private endpoint. :paramtype id: str """ - super(PrivateEndpoint, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id -class PrivateEndpointConnection(msrest.serialization.Model): +class PrivateEndpointConnection(_serialization.Model): """A private endpoint connection. Variables are only populated by the server, and will be ignored when sending a request. @@ -4675,7 +4551,7 @@ class PrivateEndpointConnection(msrest.serialization.Model): :ivar type: The resource type. :vartype type: str :ivar provisioning_state: The current provisioning state. Known values are: "Succeeded", - "Creating", "Deleting", "Failed". + "Creating", "Deleting", and "Failed". :vartype provisioning_state: str or ~azure.mgmt.containerservice.v2021_07_01.models.PrivateEndpointConnectionProvisioningState :ivar private_endpoint: The resource of private endpoint. @@ -4687,19 +4563,22 @@ class PrivateEndpointConnection(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'provisioning_state': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, - 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "private_endpoint": {"key": "properties.privateEndpoint", "type": "PrivateEndpoint"}, + "private_link_service_connection_state": { + "key": "properties.privateLinkServiceConnectionState", + "type": "PrivateLinkServiceConnectionState", + }, } def __init__( @@ -4717,7 +4596,7 @@ def __init__( :paramtype private_link_service_connection_state: ~azure.mgmt.containerservice.v2021_07_01.models.PrivateLinkServiceConnectionState """ - super(PrivateEndpointConnection, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -4726,7 +4605,7 @@ def __init__( self.private_link_service_connection_state = private_link_service_connection_state -class PrivateEndpointConnectionListResult(msrest.serialization.Model): +class PrivateEndpointConnectionListResult(_serialization.Model): """A list of private endpoint connections. :ivar value: The collection value. @@ -4734,25 +4613,20 @@ class PrivateEndpointConnectionListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, + "value": {"key": "value", "type": "[PrivateEndpointConnection]"}, } - def __init__( - self, - *, - value: Optional[List["_models.PrivateEndpointConnection"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.PrivateEndpointConnection"]] = None, **kwargs): """ :keyword value: The collection value. :paramtype value: list[~azure.mgmt.containerservice.v2021_07_01.models.PrivateEndpointConnection] """ - super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value -class PrivateLinkResource(msrest.serialization.Model): +class PrivateLinkResource(_serialization.Model): """A private link resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -4773,22 +4647,22 @@ class PrivateLinkResource(msrest.serialization.Model): """ _validation = { - 'private_link_service_id': {'readonly': True}, + "private_link_service_id": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'group_id': {'key': 'groupId', 'type': 'str'}, - 'required_members': {'key': 'requiredMembers', 'type': '[str]'}, - 'private_link_service_id': {'key': 'privateLinkServiceID', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "group_id": {"key": "groupId", "type": "str"}, + "required_members": {"key": "requiredMembers", "type": "[str]"}, + "private_link_service_id": {"key": "privateLinkServiceID", "type": "str"}, } def __init__( self, *, - id: Optional[str] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin name: Optional[str] = None, type: Optional[str] = None, group_id: Optional[str] = None, @@ -4807,7 +4681,7 @@ def __init__( :keyword required_members: The RequiredMembers of the resource. :paramtype required_members: list[str] """ - super(PrivateLinkResource, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id self.name = name self.type = type @@ -4816,7 +4690,7 @@ def __init__( self.private_link_service_id = None -class PrivateLinkResourcesListResult(msrest.serialization.Model): +class PrivateLinkResourcesListResult(_serialization.Model): """A list of private link resources. :ivar value: The collection value. @@ -4824,36 +4698,31 @@ class PrivateLinkResourcesListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, + "value": {"key": "value", "type": "[PrivateLinkResource]"}, } - def __init__( - self, - *, - value: Optional[List["_models.PrivateLinkResource"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.PrivateLinkResource"]] = None, **kwargs): """ :keyword value: The collection value. :paramtype value: list[~azure.mgmt.containerservice.v2021_07_01.models.PrivateLinkResource] """ - super(PrivateLinkResourcesListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value -class PrivateLinkServiceConnectionState(msrest.serialization.Model): +class PrivateLinkServiceConnectionState(_serialization.Model): """The state of a private link service connection. :ivar status: The private link service connection status. Known values are: "Pending", - "Approved", "Rejected", "Disconnected". + "Approved", "Rejected", and "Disconnected". :vartype status: str or ~azure.mgmt.containerservice.v2021_07_01.models.ConnectionStatus :ivar description: The private link service connection description. :vartype description: str """ _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, + "status": {"key": "status", "type": "str"}, + "description": {"key": "description", "type": "str"}, } def __init__( @@ -4865,17 +4734,17 @@ def __init__( ): """ :keyword status: The private link service connection status. Known values are: "Pending", - "Approved", "Rejected", "Disconnected". + "Approved", "Rejected", and "Disconnected". :paramtype status: str or ~azure.mgmt.containerservice.v2021_07_01.models.ConnectionStatus :keyword description: The private link service connection description. :paramtype description: str """ - super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) + super().__init__(**kwargs) self.status = status self.description = description -class ResourceReference(msrest.serialization.Model): +class ResourceReference(_serialization.Model): """A reference to an Azure resource. :ivar id: The fully qualified Azure resource id. @@ -4883,29 +4752,24 @@ class ResourceReference(msrest.serialization.Model): """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, } - def __init__( - self, - *, - id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin """ :keyword id: The fully qualified Azure resource id. :paramtype id: str """ - super(ResourceReference, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id -class RunCommandRequest(msrest.serialization.Model): +class RunCommandRequest(_serialization.Model): """A run command request. All required parameters must be populated in order to send to Azure. - :ivar command: Required. The command to run. + :ivar command: The command to run. Required. :vartype command: str :ivar context: A base64 encoded zip file containing the files required by the command. :vartype context: str @@ -4914,38 +4778,31 @@ class RunCommandRequest(msrest.serialization.Model): """ _validation = { - 'command': {'required': True}, + "command": {"required": True}, } _attribute_map = { - 'command': {'key': 'command', 'type': 'str'}, - 'context': {'key': 'context', 'type': 'str'}, - 'cluster_token': {'key': 'clusterToken', 'type': 'str'}, + "command": {"key": "command", "type": "str"}, + "context": {"key": "context", "type": "str"}, + "cluster_token": {"key": "clusterToken", "type": "str"}, } - def __init__( - self, - *, - command: str, - context: Optional[str] = None, - cluster_token: Optional[str] = None, - **kwargs - ): + def __init__(self, *, command: str, context: Optional[str] = None, cluster_token: Optional[str] = None, **kwargs): """ - :keyword command: Required. The command to run. + :keyword command: The command to run. Required. :paramtype command: str :keyword context: A base64 encoded zip file containing the files required by the command. :paramtype context: str :keyword cluster_token: AuthToken issued for AKS AAD Server App. :paramtype cluster_token: str """ - super(RunCommandRequest, self).__init__(**kwargs) + super().__init__(**kwargs) self.command = command self.context = context self.cluster_token = cluster_token -class RunCommandResult(msrest.serialization.Model): +class RunCommandResult(_serialization.Model): """run command result. Variables are only populated by the server, and will be ignored when sending a request. @@ -4967,32 +4824,28 @@ class RunCommandResult(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'exit_code': {'readonly': True}, - 'started_at': {'readonly': True}, - 'finished_at': {'readonly': True}, - 'logs': {'readonly': True}, - 'reason': {'readonly': True}, + "id": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "exit_code": {"readonly": True}, + "started_at": {"readonly": True}, + "finished_at": {"readonly": True}, + "logs": {"readonly": True}, + "reason": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'exit_code': {'key': 'properties.exitCode', 'type': 'int'}, - 'started_at': {'key': 'properties.startedAt', 'type': 'iso-8601'}, - 'finished_at': {'key': 'properties.finishedAt', 'type': 'iso-8601'}, - 'logs': {'key': 'properties.logs', 'type': 'str'}, - 'reason': {'key': 'properties.reason', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "exit_code": {"key": "properties.exitCode", "type": "int"}, + "started_at": {"key": "properties.startedAt", "type": "iso-8601"}, + "finished_at": {"key": "properties.finishedAt", "type": "iso-8601"}, + "logs": {"key": "properties.logs", "type": "str"}, + "reason": {"key": "properties.reason", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(RunCommandResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.id = None self.provisioning_state = None self.exit_code = None @@ -5002,7 +4855,7 @@ def __init__( self.reason = None -class SysctlConfig(msrest.serialization.Model): +class SysctlConfig(_serialization.Model): # pylint: disable=too-many-instance-attributes """Sysctl settings for Linux agent nodes. :ivar net_core_somaxconn: Sysctl setting net.core.somaxconn. @@ -5064,37 +4917,37 @@ class SysctlConfig(msrest.serialization.Model): """ _attribute_map = { - 'net_core_somaxconn': {'key': 'netCoreSomaxconn', 'type': 'int'}, - 'net_core_netdev_max_backlog': {'key': 'netCoreNetdevMaxBacklog', 'type': 'int'}, - 'net_core_rmem_default': {'key': 'netCoreRmemDefault', 'type': 'int'}, - 'net_core_rmem_max': {'key': 'netCoreRmemMax', 'type': 'int'}, - 'net_core_wmem_default': {'key': 'netCoreWmemDefault', 'type': 'int'}, - 'net_core_wmem_max': {'key': 'netCoreWmemMax', 'type': 'int'}, - 'net_core_optmem_max': {'key': 'netCoreOptmemMax', 'type': 'int'}, - 'net_ipv4_tcp_max_syn_backlog': {'key': 'netIpv4TcpMaxSynBacklog', 'type': 'int'}, - 'net_ipv4_tcp_max_tw_buckets': {'key': 'netIpv4TcpMaxTwBuckets', 'type': 'int'}, - 'net_ipv4_tcp_fin_timeout': {'key': 'netIpv4TcpFinTimeout', 'type': 'int'}, - 'net_ipv4_tcp_keepalive_time': {'key': 'netIpv4TcpKeepaliveTime', 'type': 'int'}, - 'net_ipv4_tcp_keepalive_probes': {'key': 'netIpv4TcpKeepaliveProbes', 'type': 'int'}, - 'net_ipv4_tcpkeepalive_intvl': {'key': 'netIpv4TcpkeepaliveIntvl', 'type': 'int'}, - 'net_ipv4_tcp_tw_reuse': {'key': 'netIpv4TcpTwReuse', 'type': 'bool'}, - 'net_ipv4_ip_local_port_range': {'key': 'netIpv4IpLocalPortRange', 'type': 'str'}, - 'net_ipv4_neigh_default_gc_thresh1': {'key': 'netIpv4NeighDefaultGcThresh1', 'type': 'int'}, - 'net_ipv4_neigh_default_gc_thresh2': {'key': 'netIpv4NeighDefaultGcThresh2', 'type': 'int'}, - 'net_ipv4_neigh_default_gc_thresh3': {'key': 'netIpv4NeighDefaultGcThresh3', 'type': 'int'}, - 'net_netfilter_nf_conntrack_max': {'key': 'netNetfilterNfConntrackMax', 'type': 'int'}, - 'net_netfilter_nf_conntrack_buckets': {'key': 'netNetfilterNfConntrackBuckets', 'type': 'int'}, - 'fs_inotify_max_user_watches': {'key': 'fsInotifyMaxUserWatches', 'type': 'int'}, - 'fs_file_max': {'key': 'fsFileMax', 'type': 'int'}, - 'fs_aio_max_nr': {'key': 'fsAioMaxNr', 'type': 'int'}, - 'fs_nr_open': {'key': 'fsNrOpen', 'type': 'int'}, - 'kernel_threads_max': {'key': 'kernelThreadsMax', 'type': 'int'}, - 'vm_max_map_count': {'key': 'vmMaxMapCount', 'type': 'int'}, - 'vm_swappiness': {'key': 'vmSwappiness', 'type': 'int'}, - 'vm_vfs_cache_pressure': {'key': 'vmVfsCachePressure', 'type': 'int'}, + "net_core_somaxconn": {"key": "netCoreSomaxconn", "type": "int"}, + "net_core_netdev_max_backlog": {"key": "netCoreNetdevMaxBacklog", "type": "int"}, + "net_core_rmem_default": {"key": "netCoreRmemDefault", "type": "int"}, + "net_core_rmem_max": {"key": "netCoreRmemMax", "type": "int"}, + "net_core_wmem_default": {"key": "netCoreWmemDefault", "type": "int"}, + "net_core_wmem_max": {"key": "netCoreWmemMax", "type": "int"}, + "net_core_optmem_max": {"key": "netCoreOptmemMax", "type": "int"}, + "net_ipv4_tcp_max_syn_backlog": {"key": "netIpv4TcpMaxSynBacklog", "type": "int"}, + "net_ipv4_tcp_max_tw_buckets": {"key": "netIpv4TcpMaxTwBuckets", "type": "int"}, + "net_ipv4_tcp_fin_timeout": {"key": "netIpv4TcpFinTimeout", "type": "int"}, + "net_ipv4_tcp_keepalive_time": {"key": "netIpv4TcpKeepaliveTime", "type": "int"}, + "net_ipv4_tcp_keepalive_probes": {"key": "netIpv4TcpKeepaliveProbes", "type": "int"}, + "net_ipv4_tcpkeepalive_intvl": {"key": "netIpv4TcpkeepaliveIntvl", "type": "int"}, + "net_ipv4_tcp_tw_reuse": {"key": "netIpv4TcpTwReuse", "type": "bool"}, + "net_ipv4_ip_local_port_range": {"key": "netIpv4IpLocalPortRange", "type": "str"}, + "net_ipv4_neigh_default_gc_thresh1": {"key": "netIpv4NeighDefaultGcThresh1", "type": "int"}, + "net_ipv4_neigh_default_gc_thresh2": {"key": "netIpv4NeighDefaultGcThresh2", "type": "int"}, + "net_ipv4_neigh_default_gc_thresh3": {"key": "netIpv4NeighDefaultGcThresh3", "type": "int"}, + "net_netfilter_nf_conntrack_max": {"key": "netNetfilterNfConntrackMax", "type": "int"}, + "net_netfilter_nf_conntrack_buckets": {"key": "netNetfilterNfConntrackBuckets", "type": "int"}, + "fs_inotify_max_user_watches": {"key": "fsInotifyMaxUserWatches", "type": "int"}, + "fs_file_max": {"key": "fsFileMax", "type": "int"}, + "fs_aio_max_nr": {"key": "fsAioMaxNr", "type": "int"}, + "fs_nr_open": {"key": "fsNrOpen", "type": "int"}, + "kernel_threads_max": {"key": "kernelThreadsMax", "type": "int"}, + "vm_max_map_count": {"key": "vmMaxMapCount", "type": "int"}, + "vm_swappiness": {"key": "vmSwappiness", "type": "int"}, + "vm_vfs_cache_pressure": {"key": "vmVfsCachePressure", "type": "int"}, } - def __init__( + def __init__( # pylint: disable=too-many-locals self, *, net_core_somaxconn: Optional[int] = None, @@ -5185,7 +5038,7 @@ def __init__( :keyword vm_vfs_cache_pressure: Sysctl setting vm.vfs_cache_pressure. :paramtype vm_vfs_cache_pressure: int """ - super(SysctlConfig, self).__init__(**kwargs) + super().__init__(**kwargs) self.net_core_somaxconn = net_core_somaxconn self.net_core_netdev_max_backlog = net_core_netdev_max_backlog self.net_core_rmem_default = net_core_rmem_default @@ -5216,20 +5069,20 @@ def __init__( self.vm_vfs_cache_pressure = vm_vfs_cache_pressure -class SystemData(msrest.serialization.Model): +class SystemData(_serialization.Model): """Metadata pertaining to creation and last modification of the resource. :ivar created_by: The identity that created the resource. :vartype created_by: str :ivar created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", "Key". + "User", "Application", "ManagedIdentity", and "Key". :vartype created_by_type: str or ~azure.mgmt.containerservice.v2021_07_01.models.CreatedByType :ivar created_at: The UTC timestamp of resource creation. :vartype created_at: ~datetime.datetime :ivar last_modified_by: The identity that last modified the resource. :vartype last_modified_by: str :ivar last_modified_by_type: The type of identity that last modified the resource. Known values - are: "User", "Application", "ManagedIdentity", "Key". + are: "User", "Application", "ManagedIdentity", and "Key". :vartype last_modified_by_type: str or ~azure.mgmt.containerservice.v2021_07_01.models.CreatedByType :ivar last_modified_at: The type of identity that last modified the resource. @@ -5237,12 +5090,12 @@ class SystemData(msrest.serialization.Model): """ _attribute_map = { - 'created_by': {'key': 'createdBy', 'type': 'str'}, - 'created_by_type': {'key': 'createdByType', 'type': 'str'}, - 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, - 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, - 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, - 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + "created_by": {"key": "createdBy", "type": "str"}, + "created_by_type": {"key": "createdByType", "type": "str"}, + "created_at": {"key": "createdAt", "type": "iso-8601"}, + "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, + "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, + "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, } def __init__( @@ -5260,7 +5113,7 @@ def __init__( :keyword created_by: The identity that created the resource. :paramtype created_by: str :keyword created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", "Key". + "User", "Application", "ManagedIdentity", and "Key". :paramtype created_by_type: str or ~azure.mgmt.containerservice.v2021_07_01.models.CreatedByType :keyword created_at: The UTC timestamp of resource creation. @@ -5268,13 +5121,13 @@ def __init__( :keyword last_modified_by: The identity that last modified the resource. :paramtype last_modified_by: str :keyword last_modified_by_type: The type of identity that last modified the resource. Known - values are: "User", "Application", "ManagedIdentity", "Key". + values are: "User", "Application", "ManagedIdentity", and "Key". :paramtype last_modified_by_type: str or ~azure.mgmt.containerservice.v2021_07_01.models.CreatedByType :keyword last_modified_at: The type of identity that last modified the resource. :paramtype last_modified_at: ~datetime.datetime """ - super(SystemData, self).__init__(**kwargs) + super().__init__(**kwargs) self.created_by = created_by self.created_by_type = created_by_type self.created_at = created_at @@ -5283,36 +5136,31 @@ def __init__( self.last_modified_at = last_modified_at -class TagsObject(msrest.serialization.Model): +class TagsObject(_serialization.Model): """Tags object for patch operations. - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] """ _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] """ - super(TagsObject, self).__init__(**kwargs) + super().__init__(**kwargs) self.tags = tags -class TimeInWeek(msrest.serialization.Model): +class TimeInWeek(_serialization.Model): """Time in a week. :ivar day: The day of the week. Known values are: "Sunday", "Monday", "Tuesday", "Wednesday", - "Thursday", "Friday", "Saturday". + "Thursday", "Friday", and "Saturday". :vartype day: str or ~azure.mgmt.containerservice.v2021_07_01.models.WeekDay :ivar hour_slots: Each integer hour represents a time range beginning at 0m after the hour ending at the next hour (non-inclusive). 0 corresponds to 00:00 UTC, 23 corresponds to 23:00 @@ -5321,32 +5169,28 @@ class TimeInWeek(msrest.serialization.Model): """ _attribute_map = { - 'day': {'key': 'day', 'type': 'str'}, - 'hour_slots': {'key': 'hourSlots', 'type': '[int]'}, + "day": {"key": "day", "type": "str"}, + "hour_slots": {"key": "hourSlots", "type": "[int]"}, } def __init__( - self, - *, - day: Optional[Union[str, "_models.WeekDay"]] = None, - hour_slots: Optional[List[int]] = None, - **kwargs + self, *, day: Optional[Union[str, "_models.WeekDay"]] = None, hour_slots: Optional[List[int]] = None, **kwargs ): """ :keyword day: The day of the week. Known values are: "Sunday", "Monday", "Tuesday", - "Wednesday", "Thursday", "Friday", "Saturday". + "Wednesday", "Thursday", "Friday", and "Saturday". :paramtype day: str or ~azure.mgmt.containerservice.v2021_07_01.models.WeekDay :keyword hour_slots: Each integer hour represents a time range beginning at 0m after the hour ending at the next hour (non-inclusive). 0 corresponds to 00:00 UTC, 23 corresponds to 23:00 UTC. Specifying [0, 1] means the 00:00 - 02:00 UTC time range. :paramtype hour_slots: list[int] """ - super(TimeInWeek, self).__init__(**kwargs) + super().__init__(**kwargs) self.day = day self.hour_slots = hour_slots -class TimeSpan(msrest.serialization.Model): +class TimeSpan(_serialization.Model): """For example, between 2021-05-25T13:00:00Z and 2021-05-25T14:00:00Z. :ivar start: The start of a time span. @@ -5356,23 +5200,17 @@ class TimeSpan(msrest.serialization.Model): """ _attribute_map = { - 'start': {'key': 'start', 'type': 'iso-8601'}, - 'end': {'key': 'end', 'type': 'iso-8601'}, + "start": {"key": "start", "type": "iso-8601"}, + "end": {"key": "end", "type": "iso-8601"}, } - def __init__( - self, - *, - start: Optional[datetime.datetime] = None, - end: Optional[datetime.datetime] = None, - **kwargs - ): + def __init__(self, *, start: Optional[datetime.datetime] = None, end: Optional[datetime.datetime] = None, **kwargs): """ :keyword start: The start of a time span. :paramtype start: ~datetime.datetime :keyword end: The end of a time span. :paramtype end: ~datetime.datetime """ - super(TimeSpan, self).__init__(**kwargs) + super().__init__(**kwargs) self.start = start self.end = end diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/models/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/models/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/models/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/models/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/operations/__init__.py index f0e265d9f2f4..f27b588ca549 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/operations/__init__.py @@ -17,14 +17,15 @@ from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'Operations', - 'ManagedClustersOperations', - 'MaintenanceConfigurationsOperations', - 'AgentPoolsOperations', - 'PrivateEndpointConnectionsOperations', - 'PrivateLinkResourcesOperations', - 'ResolvePrivateLinkServiceIdOperations', + "Operations", + "ManagedClustersOperations", + "MaintenanceConfigurationsOperations", + "AgentPoolsOperations", + "PrivateEndpointConnectionsOperations", + "PrivateLinkResourcesOperations", + "ResolvePrivateLinkServiceIdOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/operations/_agent_pools_operations.py index 4c8bdf758b1c..ecfaa118f174 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/operations/_agent_pools_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,288 +27,289 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - *, - json: Optional[_models.AgentPool] = None, - content: Any = None, - **kwargs: Any + _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, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + _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, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_get_upgrade_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_available_agent_pool_versions_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_upgrade_node_image_version_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_upgrade_node_image_version_request( + resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class AgentPoolsOperations: """ @@ -324,47 +330,39 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> Iterable[_models.AgentPoolListResult]: + def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> Iterable["_models.AgentPool"]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AgentPoolListResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_07_01.models.AgentPoolListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either AgentPool or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_07_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -372,16 +370,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -397,10 +390,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -410,54 +401,45 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore @distributed_trace def get( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPool: """Gets the specified managed cluster agent pool. Gets the specified managed cluster agent pool. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPool, or the result of cls(response) + :return: AgentPool or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_07_01.models.AgentPool - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -465,57 +447,60 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore def _create_or_update_initial( self, resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: _models.AgentPool, + parameters: Union[_models.AgentPool, IO], **kwargs: Any ) -> _models.AgentPool: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - _json = self._serialize.body(parameters, 'AgentPool') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "AgentPool") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -523,10 +508,9 @@ def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -534,40 +518,84 @@ def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - @distributed_trace + @overload def begin_create_or_update( self, resource_group_name: str, resource_name: str, agent_pool_name: str, parameters: _models.AgentPool, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.AgentPool]: """Creates or updates an agent pool in the specified managed cluster. Creates or updates an agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str - :param parameters: The agent pool to create or update. + :param parameters: The agent pool to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2021_07_01.models.AgentPool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_07_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AgentPool]: + """Creates or updates an agent pool in the specified managed cluster. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: The agent pool to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -579,20 +607,56 @@ def begin_create_or_update( :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_07_01.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: Union[_models.AgentPool, IO], + **kwargs: Any + ) -> LROPoller[_models.AgentPool]: + """Creates or updates an agent pool in the specified managed cluster. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: The agent pool to create or update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.mgmt.containerservice.v2021_07_01.models.AgentPool or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_07_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -601,66 +665,55 @@ def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -668,10 +721,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -681,26 +733,21 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + def begin_delete( + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> LROPoller[None]: """Deletes an agent pool in the specified managed cluster. Deletes an agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -712,99 +759,85 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPoolUpgradeProfile: """Gets the upgrade profile for an agent pool. Gets the upgrade profile for an agent pool. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolUpgradeProfile, or the result of cls(response) + :return: AgentPoolUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_07_01.models.AgentPoolUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -812,32 +845,27 @@ def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolUpgradeProfile', pipeline_response) + deserialized = self._deserialize("AgentPoolUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore @distributed_trace def get_available_agent_pool_versions( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported Kubernetes versions for the specified agent pool. @@ -845,33 +873,30 @@ def get_available_agent_pool_versions( `_ for more details about the version lifecycle. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolAvailableVersions, or the result of cls(response) + :return: AgentPoolAvailableVersions or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_07_01.models.AgentPoolAvailableVersions - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolAvailableVersions] - request = build_get_available_agent_pool_versions_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_available_agent_pool_versions.metadata['url'], + template_url=self.get_available_agent_pool_versions.metadata["url"], headers=_headers, params=_params, ) @@ -879,52 +904,43 @@ def get_available_agent_pool_versions( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolAvailableVersions', pipeline_response) + deserialized = self._deserialize("AgentPoolAvailableVersions", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_available_agent_pool_versions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore - + get_available_agent_pool_versions.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore def _upgrade_node_image_version_initial( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> Optional[_models.AgentPool]: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.AgentPool]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.AgentPool]] - - request = build_upgrade_node_image_version_request_initial( - subscription_id=self._config.subscription_id, + request = build_upgrade_node_image_version_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._upgrade_node_image_version_initial.metadata['url'], + template_url=self._upgrade_node_image_version_initial.metadata["url"], headers=_headers, params=_params, ) @@ -932,10 +948,9 @@ def _upgrade_node_image_version_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -944,35 +959,30 @@ def _upgrade_node_image_version_initial( deserialized = None if response.status_code == 202: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _upgrade_node_image_version_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore - + _upgrade_node_image_version_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore @distributed_trace def begin_upgrade_node_image_version( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any - ) -> LROPoller[_models.AgentPool]: + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any + ) -> LROPoller[None]: """Upgrades the node image version of an agent pool to the latest. Upgrading the node image version of an agent pool applies the newest OS and runtime updates to the nodes. AKS provides one new image per week with the latest updates. For more details on node image versions, see: https://docs.microsoft.com/azure/aks/node-image-upgrade. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -985,55 +995,48 @@ def begin_upgrade_node_image_version( :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_07_01.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._upgrade_node_image_version_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_upgrade_node_image_version.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore + begin_upgrade_node_image_version.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/operations/_maintenance_configurations_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/operations/_maintenance_configurations_operations.py index 18481c77bffd..23e898f61688 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/operations/_maintenance_configurations_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/operations/_maintenance_configurations_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,173 +25,173 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +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_managed_cluster_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, config_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 = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "configName": _SERIALIZER.url("config_name", config_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "configName": _SERIALIZER.url("config_name", config_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - config_name: str, - *, - json: Optional[_models.MaintenanceConfiguration] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, resource_name: str, config_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 = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "configName": _SERIALIZER.url("config_name", config_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "configName": _SERIALIZER.url("config_name", config_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, config_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 = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "configName": _SERIALIZER.url("config_name", config_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "configName": _SERIALIZER.url("config_name", config_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class MaintenanceConfigurationsOperations: """ @@ -207,48 +212,43 @@ def __init__(self, *args, **kwargs): 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_managed_cluster( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> Iterable[_models.MaintenanceConfigurationListResult]: + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> Iterable["_models.MaintenanceConfiguration"]: """Gets a list of maintenance configurations in the specified managed cluster. Gets a list of maintenance configurations in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either MaintenanceConfigurationListResult or the result - of cls(response) + :return: An iterator like instance of either MaintenanceConfiguration or the result of + cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_07_01.models.MaintenanceConfigurationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_07_01.models.MaintenanceConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfigurationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfigurationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_managed_cluster_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_managed_cluster.metadata['url'], + template_url=self.list_by_managed_cluster.metadata["url"], headers=_headers, params=_params, ) @@ -256,16 +256,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_managed_cluster_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -281,10 +276,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -294,54 +287,45 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_managed_cluster.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations"} # type: ignore + list_by_managed_cluster.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations"} # type: ignore @distributed_trace def get( - self, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, config_name: str, **kwargs: Any ) -> _models.MaintenanceConfiguration: """Gets the specified maintenance configuration of a managed cluster. Gets the specified maintenance configuration of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: MaintenanceConfiguration, or the result of cls(response) + :return: MaintenanceConfiguration or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_07_01.models.MaintenanceConfiguration - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfiguration] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -349,75 +333,147 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) + deserialized = self._deserialize("MaintenanceConfiguration", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - @distributed_trace + @overload def create_or_update( self, resource_group_name: str, resource_name: str, config_name: str, parameters: _models.MaintenanceConfiguration, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.MaintenanceConfiguration: """Creates or updates a maintenance configuration in the specified managed cluster. Creates or updates a maintenance configuration in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str - :param parameters: The maintenance configuration to create or update. + :param parameters: The maintenance configuration to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2021_07_01.models.MaintenanceConfiguration + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: MaintenanceConfiguration, or the result of cls(response) + :return: MaintenanceConfiguration or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_07_01.models.MaintenanceConfiguration - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configuration in the specified managed cluster. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: The maintenance configuration to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_07_01.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: Union[_models.MaintenanceConfiguration, IO], + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configuration in the specified managed cluster. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: The maintenance configuration to create or update. Is either a model type or + a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_07_01.models.MaintenanceConfiguration or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_07_01.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfiguration] - _json = self._serialize.body(parameters, 'MaintenanceConfiguration') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "MaintenanceConfiguration") request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) @@ -425,68 +481,59 @@ def create_or_update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) + deserialized = self._deserialize("MaintenanceConfiguration", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore @distributed_trace def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, config_name: str, **kwargs: Any ) -> None: """Deletes a maintenance configuration. Deletes a maintenance configuration. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) @@ -494,10 +541,9 @@ def delete( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -507,5 +553,4 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/operations/_managed_clusters_operations.py index 1f2ee126f4af..aa071dca6fb9 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/operations/_managed_clusters_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,200 +27,183 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_get_os_options_request( - subscription_id: str, - location: str, - *, - resource_type: Optional[str] = None, - **kwargs: Any + location: str, subscription_id: str, *, resource_type: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "location": _SERIALIZER.url("location", location, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if resource_type is not None: - _params['resource-type'] = _SERIALIZER.query("resource_type", resource_type, 'str') + _params["resource-type"] = _SERIALIZER.query("resource_type", resource_type, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters") + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters" + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_resource_group_request( - subscription_id: str, - resource_group_name: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters", + ) # 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', min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_upgrade_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_access_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, role_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 = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "roleName": _SERIALIZER.url("role_name", role_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "roleName": _SERIALIZER.url("role_name", role_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_admin_credentials_request( - subscription_id: str, resource_group_name: str, resource_name: str, + subscription_id: str, *, server_fqdn: Optional[str] = None, **kwargs: Any @@ -223,40 +211,44 @@ def build_list_cluster_admin_credentials_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if server_fqdn is not None: - _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + _params["server-fqdn"] = _SERIALIZER.query("server_fqdn", server_fqdn, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_user_credentials_request( - subscription_id: str, resource_group_name: str, resource_name: str, + subscription_id: str, *, server_fqdn: Optional[str] = None, **kwargs: Any @@ -264,40 +256,44 @@ def build_list_cluster_user_credentials_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if server_fqdn is not None: - _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + _params["server-fqdn"] = _SERIALIZER.query("server_fqdn", server_fqdn, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_monitoring_user_credentials_request( - subscription_id: str, resource_group_name: str, resource_name: str, + subscription_id: str, *, server_fqdn: Optional[str] = None, **kwargs: Any @@ -305,520 +301,509 @@ def build_list_cluster_monitoring_user_credentials_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if server_fqdn is not None: - _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + _params["server-fqdn"] = _SERIALIZER.query("server_fqdn", server_fqdn, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: + +def build_get_request(resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedCluster] = None, - content: Any = None, - **kwargs: Any + +def build_create_or_update_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_update_tags_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.TagsObject] = None, - content: Any = None, - **kwargs: Any + +def build_update_tags_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + +def build_delete_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_reset_service_principal_profile_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedClusterServicePrincipalProfile] = None, - content: Any = None, - **kwargs: Any + +def build_reset_service_principal_profile_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_reset_aad_profile_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedClusterAADProfile] = None, - content: Any = None, - **kwargs: Any + +def build_reset_aad_profile_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_rotate_cluster_certificates_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + +def build_rotate_cluster_certificates_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_stop_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + +def build_stop_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_start_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + +def build_start_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_run_command_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.RunCommandRequest] = None, - content: Any = None, - **kwargs: Any + +def build_run_command_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_get_command_result_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - command_id: str, - **kwargs: Any + resource_group_name: str, resource_name: str, command_id: 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "commandId": _SERIALIZER.url("command_id", command_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "commandId": _SERIALIZER.url("command_id", command_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_list_outbound_network_dependencies_endpoints_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + class ManagedClustersOperations: # pylint: disable=too-many-public-methods """ @@ -839,46 +824,39 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def get_os_options( - self, - location: str, - resource_type: Optional[str] = None, - **kwargs: Any + self, location: str, resource_type: Optional[str] = None, **kwargs: Any ) -> _models.OSOptionProfile: """Gets supported OS options in the specified subscription. Gets supported OS options in the specified subscription. - :param location: The name of a supported Azure region. + :param location: The name of a supported Azure region. Required. :type location: str :param resource_type: The resource type for which the OS options needs to be returned. Default value is None. :type resource_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: OSOptionProfile, or the result of cls(response) + :return: OSOptionProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_07_01.models.OSOptionProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OSOptionProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OSOptionProfile] - request = build_get_os_options_request( - subscription_id=self._config.subscription_id, location=location, - api_version=api_version, + subscription_id=self._config.subscription_id, resource_type=resource_type, - template_url=self.get_os_options.metadata['url'], + api_version=api_version, + template_url=self.get_os_options.metadata["url"], headers=_headers, params=_params, ) @@ -886,59 +864,52 @@ def get_os_options( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('OSOptionProfile', pipeline_response) + deserialized = self._deserialize("OSOptionProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_os_options.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default"} # type: ignore - + get_os_options.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default"} # type: ignore @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.ManagedClusterListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.ManagedCluster"]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_07_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_07_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -946,14 +917,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -969,10 +937,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -982,49 +948,41 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> Iterable[_models.ManagedClusterListResult]: + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.ManagedCluster"]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_07_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_07_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -1032,15 +990,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -1056,10 +1010,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1069,50 +1021,42 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.ManagedClusterUpgradeProfile: """Gets the upgrade profile of a managed cluster. Gets the upgrade profile of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterUpgradeProfile, or the result of cls(response) + :return: ManagedClusterUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_07_01.models.ManagedClusterUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -1120,33 +1064,27 @@ def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterUpgradeProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore @distributed_trace def get_access_profile( - self, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, role_name: str, **kwargs: Any ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. @@ -1155,36 +1093,33 @@ def get_access_profile( `ListClusterAdminCredentials `_ . - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param role_name: The name of the role for managed cluster accessProfile resource. + :param role_name: The name of the role for managed cluster accessProfile resource. Required. :type role_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterAccessProfile, or the result of cls(response) + :return: ManagedClusterAccessProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_07_01.models.ManagedClusterAccessProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterAccessProfile] - request = build_get_access_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, role_name=role_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_access_profile.metadata['url'], + template_url=self.get_access_profile.metadata["url"], headers=_headers, params=_params, ) @@ -1192,68 +1127,59 @@ def get_access_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterAccessProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterAccessProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_access_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore - + get_access_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore @distributed_trace def list_cluster_admin_credentials( - self, - resource_group_name: str, - resource_name: str, - server_fqdn: Optional[str] = None, - **kwargs: Any + self, resource_group_name: str, resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any ) -> _models.CredentialResults: """Lists the admin credentials of a managed cluster. Lists the admin credentials of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_07_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_admin_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, - template_url=self.list_cluster_admin_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_admin_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -1261,68 +1187,59 @@ def list_cluster_admin_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_admin_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore - + list_cluster_admin_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore @distributed_trace def list_cluster_user_credentials( - self, - resource_group_name: str, - resource_name: str, - server_fqdn: Optional[str] = None, - **kwargs: Any + self, resource_group_name: str, resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any ) -> _models.CredentialResults: """Lists the user credentials of a managed cluster. Lists the user credentials of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_07_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, - template_url=self.list_cluster_user_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -1330,68 +1247,59 @@ def list_cluster_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore - + list_cluster_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore @distributed_trace def list_cluster_monitoring_user_credentials( - self, - resource_group_name: str, - resource_name: str, - server_fqdn: Optional[str] = None, - **kwargs: Any + self, resource_group_name: str, resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any ) -> _models.CredentialResults: """Lists the cluster monitoring user credentials of a managed cluster. Lists the cluster monitoring user credentials of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_07_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_monitoring_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, - template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_monitoring_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -1399,64 +1307,54 @@ def list_cluster_monitoring_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_monitoring_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore - + list_cluster_monitoring_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore @distributed_trace - def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.ManagedCluster: + def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.ManagedCluster: """Gets a managed cluster. Gets a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedCluster, or the result of cls(response) + :return: ManagedCluster or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_07_01.models.ManagedCluster - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -1464,55 +1362,54 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _create_or_update_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.ManagedCluster, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'ManagedCluster') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedCluster") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1520,10 +1417,9 @@ def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -1531,37 +1427,41 @@ def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - - @distributed_trace + @overload def begin_create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedCluster, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. Creates or updates a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The managed cluster to create or update. + :param parameters: The managed cluster to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2021_07_01.models.ManagedCluster + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1574,90 +1474,155 @@ def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_07_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._create_or_update_initial( # type: ignore - resource_group_name=resource_group_name, - resource_name=resource_name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop('error_map', None) - def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized + @overload + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + Creates or updates a managed cluster. - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_07_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster to create or update. Is either a model type or a IO + type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_07_01.models.ManagedCluster or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_07_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ManagedCluster", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _update_tags_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.TagsObject, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request_initial( - subscription_id=self._config.subscription_id, + request = build_update_tags_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_tags_initial.metadata['url'], + content=_content, + template_url=self._update_tags_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1665,44 +1630,118 @@ def _update_tags_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_tags_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + _update_tags_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - - @distributed_trace + @overload def begin_update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates tags on a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2021_07_01.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_07_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates tags on a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_07_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates tags on a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_07_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1715,20 +1754,17 @@ def begin_update_tags( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_07_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, @@ -1736,64 +1772,54 @@ def begin_update_tags( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1801,10 +1827,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1814,23 +1839,17 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> LROPoller[None]: + def begin_delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> LROPoller[None]: """Deletes a managed cluster. Deletes a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1842,85 +1861,83 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterServicePrincipalProfile, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterServicePrincipalProfile") - request = build_reset_service_principal_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_service_principal_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_service_principal_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_service_principal_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1928,10 +1945,9 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1941,28 +1957,32 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re if cls: return cls(pipeline_response, None, {}) - _reset_service_principal_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore - + _reset_service_principal_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore - @distributed_trace - def begin_reset_service_principal_profile( # pylint: disable=inconsistent-return-statements + @overload + def begin_reset_service_principal_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterServicePrincipalProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: """Reset the Service Principal Profile of a managed cluster. This action cannot be performed on a cluster that is not using a service principal. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The service principal profile to set on the managed cluster. + :param parameters: The service principal profile to set on the managed cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2021_07_01.models.ManagedClusterServicePrincipalProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1973,20 +1993,89 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reset the Service Principal Profile of a managed cluster. + + This action cannot be performed on a cluster that is not using a service principal. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The service principal profile to set on the managed cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Reset the Service Principal Profile of a managed cluster. + + This action cannot be performed on a cluster that is not using a service principal. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The service principal profile to set on the managed cluster. Is either a + model type or a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2021_07_01.models.ManagedClusterServicePrincipalProfile or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1994,67 +2083,68 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_service_principal_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + begin_reset_service_principal_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterAADProfile, + parameters: Union[_models.ManagedClusterAADProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterAADProfile") - request = build_reset_aad_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_aad_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_aad_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_aad_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2062,10 +2152,9 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -2075,27 +2164,103 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement if cls: return cls(pipeline_response, None, {}) - _reset_aad_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - + _reset_aad_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - @distributed_trace - def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements + @overload + def begin_reset_aad_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterAADProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: """Reset the AAD Profile of a managed cluster. Reset the AAD Profile of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The AAD profile to set on the Managed Cluster. + :param parameters: The AAD profile to set on the Managed Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2021_07_01.models.ManagedClusterAADProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reset the AAD Profile of a managed cluster. + + Reset the AAD Profile of a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The AAD profile to set on the Managed Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterAADProfile, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Reset the AAD Profile of a managed cluster. + + Reset the AAD Profile of a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The AAD profile to set on the Managed Cluster. Is either a model type or a + IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_07_01.models.ManagedClusterAADProfile or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -2106,20 +2271,17 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -2127,62 +2289,52 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_aad_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + begin_reset_aad_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_rotate_cluster_certificates_request_initial( - subscription_id=self._config.subscription_id, + request = build_rotate_cluster_certificates_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._rotate_cluster_certificates_initial.metadata['url'], + template_url=self._rotate_cluster_certificates_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2190,10 +2342,9 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -2203,24 +2354,20 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return if cls: return cls(pipeline_response, None, {}) - _rotate_cluster_certificates_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore - + _rotate_cluster_certificates_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore @distributed_trace - def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + def begin_rotate_cluster_certificates( + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> LROPoller[None]: """Rotates the certificates of a managed cluster. See `Certificate rotation `_ for more details about rotating managed cluster certificates. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -2232,80 +2379,67 @@ def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-st Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._rotate_cluster_certificates_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_rotate_cluster_certificates.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore + begin_rotate_cluster_certificates.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore def _stop_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_stop_request_initial( - subscription_id=self._config.subscription_id, + request = build_stop_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._stop_initial.metadata['url'], + template_url=self._stop_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2313,10 +2447,9 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -2326,16 +2459,10 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore - + _stop_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore @distributed_trace - def begin_stop( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> LROPoller[None]: + def begin_stop(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> LROPoller[None]: """Stops a Managed Cluster. This can only be performed on Azure Virtual Machine Scale set backed clusters. Stopping a @@ -2344,9 +2471,9 @@ def begin_stop( # pylint: disable=inconsistent-return-statements `_ for more details about stopping a cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -2358,80 +2485,67 @@ def begin_stop( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._stop_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore + begin_stop.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore def _start_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_start_request_initial( - subscription_id=self._config.subscription_id, + request = build_start_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._start_initial.metadata['url'], + template_url=self._start_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2439,10 +2553,9 @@ def _start_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -2452,24 +2565,18 @@ def _start_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore - + _start_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore @distributed_trace - def begin_start( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> LROPoller[None]: + def begin_start(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> LROPoller[None]: """Starts a previously stopped Managed Cluster. See `starting a cluster `_ for more details about starting a cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -2481,85 +2588,83 @@ def begin_start( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._start_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore + begin_start.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore def _run_command_initial( self, resource_group_name: str, resource_name: str, - request_payload: _models.RunCommandRequest, + request_payload: Union[_models.RunCommandRequest, IO], **kwargs: Any ) -> Optional[_models.RunCommandResult]: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RunCommandResult]] - _json = self._serialize.body(request_payload, 'RunCommandRequest') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(request_payload, (IO, bytes)): + _content = request_payload + else: + _json = self._serialize.body(request_payload, "RunCommandRequest") - request = build_run_command_request_initial( - subscription_id=self._config.subscription_id, + request = build_run_command_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._run_command_initial.metadata['url'], + content=_content, + template_url=self._run_command_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2567,10 +2672,9 @@ def _run_command_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -2579,22 +2683,23 @@ def _run_command_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _run_command_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore - + _run_command_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore - @distributed_trace + @overload def begin_run_command( self, resource_group_name: str, resource_name: str, request_payload: _models.RunCommandRequest, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.RunCommandResult]: """Submits a command to run against the Managed Cluster. @@ -2603,12 +2708,93 @@ def begin_run_command( more information see `AKS Run Command `_. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param request_payload: The run command request. + :param request_payload: The run command request. Required. :type request_payload: ~azure.mgmt.containerservice.v2021_07_01.models.RunCommandRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either RunCommandResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_07_01.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_run_command( + self, + resource_group_name: str, + resource_name: str, + request_payload: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RunCommandResult]: + """Submits a command to run against the Managed Cluster. + + AKS will create a pod to run the command. This is primarily useful for private clusters. For + more information see `AKS Run Command + `_. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param request_payload: The run command request. Required. + :type request_payload: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either RunCommandResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_07_01.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_run_command( + self, + resource_group_name: str, + resource_name: str, + request_payload: Union[_models.RunCommandRequest, IO], + **kwargs: Any + ) -> LROPoller[_models.RunCommandResult]: + """Submits a command to run against the Managed Cluster. + + AKS will create a pod to run the command. This is primarily useful for private clusters. For + more information see `AKS Run Command + `_. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param request_payload: The run command request. Is either a model type or a IO type. Required. + :type request_payload: ~azure.mgmt.containerservice.v2021_07_01.models.RunCommandRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -2621,20 +2807,17 @@ def begin_run_command( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_07_01.models.RunCommandResult] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.RunCommandResult] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.RunCommandResult] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._run_command_initial( # type: ignore resource_group_name=resource_group_name, @@ -2642,82 +2825,71 @@ def begin_run_command( request_payload=request_payload, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_run_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore + begin_run_command.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore @distributed_trace def get_command_result( - self, - resource_group_name: str, - resource_name: str, - command_id: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, command_id: str, **kwargs: Any ) -> Optional[_models.RunCommandResult]: """Gets the results of a command which has been run on the Managed Cluster. Gets the results of a command which has been run on the Managed Cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param command_id: Id of the command. + :param command_id: Id of the command. Required. :type command_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: RunCommandResult, or the result of cls(response) + :return: RunCommandResult or None or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_07_01.models.RunCommandResult or None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RunCommandResult]] - request = build_get_command_result_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, command_id=command_id, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_command_result.metadata['url'], + template_url=self.get_command_result.metadata["url"], headers=_headers, params=_params, ) @@ -2725,10 +2897,9 @@ def get_command_result( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -2737,59 +2908,54 @@ def get_command_result( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_command_result.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}"} # type: ignore - + get_command_result.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}"} # type: ignore @distributed_trace def list_outbound_network_dependencies_endpoints( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> Iterable[_models.OutboundEnvironmentEndpointCollection]: + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> Iterable["_models.OutboundEnvironmentEndpoint"]: """Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster. Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster. The operation returns properties of each egress endpoint. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OutboundEnvironmentEndpointCollection or the - result of cls(response) + :return: An iterator like instance of either OutboundEnvironmentEndpoint or the result of + cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_07_01.models.OutboundEnvironmentEndpointCollection] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_07_01.models.OutboundEnvironmentEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_outbound_network_dependencies_endpoints_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_outbound_network_dependencies_endpoints.metadata['url'], + template_url=self.list_outbound_network_dependencies_endpoints.metadata["url"], headers=_headers, params=_params, ) @@ -2797,16 +2963,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_outbound_network_dependencies_endpoints_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -2822,10 +2983,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2835,8 +2994,6 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_outbound_network_dependencies_endpoints.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints"} # type: ignore + list_outbound_network_dependencies_endpoints.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/operations/_operations.py index 52dd4bcc98e8..0e78a2e5279f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/operations/_operations.py @@ -7,10 +7,15 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,38 +25,34 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - **kwargs: Any -) -> HttpRequest: + +def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.ContainerService/operations") # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class Operations: """ @@ -72,38 +73,33 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.OperationListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.OperationValue"]: """Gets a list of operations. Gets a list of operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationListResult or the result of cls(response) + :return: An iterator like instance of either OperationValue or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_07_01.models.OperationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_07_01.models.OperationValue] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -111,13 +107,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -133,10 +127,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -146,8 +138,6 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.ContainerService/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ContainerService/operations"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/operations/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/operations/_private_endpoint_connections_operations.py index f95d89d99430..8063a9404041 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/operations/_private_endpoint_connections_operations.py @@ -6,11 +6,15 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod @@ -21,173 +25,191 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - subscription_id: str, resource_group_name: str, resource_name: str, private_endpoint_connection_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 = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_update_request( - subscription_id: str, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, - *, - json: Optional[_models.PrivateEndpointConnection] = None, - content: Any = None, + subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request_initial( - subscription_id: str, +def build_delete_request( resource_group_name: str, resource_name: str, private_endpoint_connection_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 = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class PrivateEndpointConnectionsOperations: """ @@ -208,46 +230,39 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnectionListResult: """Gets a list of private endpoint connections in the specified managed cluster. To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnectionListResult, or the result of cls(response) + :return: PrivateEndpointConnectionListResult or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_07_01.models.PrivateEndpointConnectionListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnectionListResult] - request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -255,69 +270,60 @@ def list( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore - + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore @distributed_trace def get( - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnection: """Gets the specified private endpoint connection. To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_07_01.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -325,75 +331,147 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - - @distributed_trace + @overload def update( self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, parameters: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateEndpointConnection: """Updates a private endpoint connection. Updates a private endpoint connection. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str - :param parameters: The updated private endpoint connection. + :param parameters: The updated private endpoint connection. Required. :type parameters: ~azure.mgmt.containerservice.v2021_07_01.models.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_07_01.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: The updated private endpoint connection. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_07_01.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: Union[_models.PrivateEndpointConnection, IO], + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: The updated private endpoint connection. Is either a model type or a IO + type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_07_01.models.PrivateEndpointConnection or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_07_01.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - _json = self._serialize.body(parameters, 'PrivateEndpointConnection') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateEndpointConnection") request = build_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update.metadata['url'], + content=_content, + template_url=self.update.metadata["url"], headers=_headers, params=_params, ) @@ -401,52 +479,43 @@ def update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -454,10 +523,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -467,26 +535,21 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + def begin_delete( + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> LROPoller[None]: """Deletes a private endpoint connection. Deletes a private endpoint connection. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -498,53 +561,46 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/operations/_private_link_resources_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/operations/_private_link_resources_operations.py index e0c1dbcdb114..4fdf16271b63 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/operations/_private_link_resources_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/operations/_private_link_resources_operations.py @@ -8,9 +8,13 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -19,48 +23,53 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class PrivateLinkResourcesOperations: """ @@ -81,46 +90,39 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.PrivateLinkResourcesListResult: """Gets a list of private link resources in the specified managed cluster. To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResourcesListResult, or the result of cls(response) + :return: PrivateLinkResourcesListResult or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_07_01.models.PrivateLinkResourcesListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResourcesListResult] - request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -128,22 +130,20 @@ def list( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResourcesListResult', pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources"} # type: ignore - + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/operations/_resolve_private_link_service_id_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/operations/_resolve_private_link_service_id_operations.py index 85a323a75cc9..277a0589b6a2 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/operations/_resolve_private_link_service_id_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/operations/_resolve_private_link_service_id_operations.py @@ -6,11 +6,15 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -19,56 +23,56 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_post_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.PrivateLinkResource] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + class ResolvePrivateLinkServiceIdOperations: """ @@ -89,52 +93,118 @@ def __init__(self, *args, **kwargs): 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 + @overload def post( self, resource_group_name: str, resource_name: str, parameters: _models.PrivateLinkResource, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateLinkResource: """Gets the private link service ID for the specified managed cluster. Gets the private link service ID for the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters required in order to resolve a private link service ID. + :param parameters: Parameters required in order to resolve a private link service ID. Required. :type parameters: ~azure.mgmt.containerservice.v2021_07_01.models.PrivateLinkResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResource, or the result of cls(response) + :return: PrivateLinkResource or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_07_01.models.PrivateLinkResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + def post( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID for the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters required in order to resolve a private link service ID. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_07_01.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def post( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.PrivateLinkResource, IO], + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID for the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters required in order to resolve a private link service ID. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_07_01.models.PrivateLinkResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_07_01.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResource] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResource] - _json = self._serialize.body(parameters, 'PrivateLinkResource') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateLinkResource") request = build_post_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.post.metadata['url'], + content=_content, + template_url=self.post.metadata["url"], headers=_headers, params=_params, ) @@ -142,22 +212,20 @@ def post( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResource', pipeline_response) + deserialized = self._deserialize("PrivateLinkResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - post.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId"} # type: ignore - + post.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/__init__.py index 37a5f9e02e6f..a8716d29afe8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/__init__.py @@ -14,7 +14,8 @@ except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['ContainerServiceClient'] + +__all__ = ["ContainerServiceClient"] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/_configuration.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/_configuration.py index 085f010b0b2f..d03e63926d9a 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/_configuration.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/_configuration.py @@ -18,30 +18,26 @@ VERSION = "unknown" + class ContainerServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ContainerServiceClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2021-08-01". 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: + def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ContainerServiceClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + api_version = kwargs.pop("api_version", "2021-08-01") # type: str if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -51,23 +47,24 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-containerservice/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-containerservice/{}".format(VERSION)) self._configure(**kwargs) def _configure( - self, - **kwargs # type: Any + self, **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/_container_service_client.py index a3cb871d8336..10fb1f7fc536 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/_container_service_client.py @@ -9,20 +9,29 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from . import models +from .._serialization import Deserializer, Serializer from ._configuration import ContainerServiceClientConfiguration -from .operations import AgentPoolsOperations, MaintenanceConfigurationsOperations, ManagedClustersOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, ResolvePrivateLinkServiceIdOperations, SnapshotsOperations +from .operations import ( + AgentPoolsOperations, + MaintenanceConfigurationsOperations, + ManagedClustersOperations, + Operations, + PrivateEndpointConnectionsOperations, + PrivateLinkResourcesOperations, + ResolvePrivateLinkServiceIdOperations, + SnapshotsOperations, +) if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class ContainerServiceClient: # pylint: disable=too-many-instance-attributes + +class ContainerServiceClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """The Container Service Client. :ivar operations: Operations operations @@ -46,10 +55,10 @@ class ContainerServiceClient: # pylint: disable=too-many-instance-attributes azure.mgmt.containerservice.v2021_08_01.operations.ResolvePrivateLinkServiceIdOperations :ivar snapshots: SnapshotsOperations operations :vartype snapshots: azure.mgmt.containerservice.v2021_08_01.operations.SnapshotsOperations - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -67,25 +76,23 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = ContainerServiceClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = ContainerServiceClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize - ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.managed_clusters = ManagedClustersOperations( self._client, self._config, self._serialize, self._deserialize ) self.maintenance_configurations = MaintenanceConfigurationsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.agent_pools = AgentPoolsOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) self.private_endpoint_connections = PrivateEndpointConnectionsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -95,16 +102,9 @@ def __init__( self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations( self._client, self._config, self._serialize, self._deserialize ) - self.snapshots = SnapshotsOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.snapshots = SnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) - - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> HttpResponse: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -113,7 +113,7 @@ def _send_request( >>> response = client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/_metadata.json b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/_metadata.json index 7794eb1ddbde..3dfcef8c200c 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/_metadata.json +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/_metadata.json @@ -10,20 +10,20 @@ "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { "credential": { - "signature": "credential, # type: \"TokenCredential\"", - "description": "Credential needed for the client to connect to Azure.", + "signature": "credential: \"TokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true }, "subscription_id": { - "signature": "subscription_id, # type: str", - "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "signature": "subscription_id: str,", + "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.", "docstring_type": "str", "required": true } @@ -31,13 +31,13 @@ "async": { "credential": { "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure.", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { "signature": "subscription_id: str,", - "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.", "docstring_type": "str", "required": true } @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=\"https://management.azure.com\", # type: str", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/_patch.py index 74e48ecd07cf..f99e77fef986 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/_patch.py @@ -28,4 +28,4 @@ # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + pass diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/_vendor.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/_vendor.py index 138f663c53a4..9aad73fc743e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/_vendor.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/_vendor.py @@ -7,6 +7,7 @@ from azure.core.pipeline.transport import HttpRequest + def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) @@ -14,6 +15,7 @@ def _convert_request(request, files=None): request.set_formdata_body(files) return request + def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -21,7 +23,5 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [ - c for c in formatted_components if "{}".format(key.args[0]) not in c - ] + components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/__init__.py index 37a5f9e02e6f..a8716d29afe8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/__init__.py @@ -14,7 +14,8 @@ except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['ContainerServiceClient'] + +__all__ = ["ContainerServiceClient"] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/_configuration.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/_configuration.py index ae3c8edafb02..85db2dab5346 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/_configuration.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/_configuration.py @@ -18,30 +18,26 @@ VERSION = "unknown" + class ContainerServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ContainerServiceClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2021-08-01". 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: + def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ContainerServiceClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + api_version = kwargs.pop("api_version", "2021-08-01") # type: str if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -51,22 +47,21 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-containerservice/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-containerservice/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, - **kwargs: Any - ) -> None: - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/_container_service_client.py index 9211f22d2213..7c23c1de845a 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/_container_service_client.py @@ -9,20 +9,29 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from .. import models +from ..._serialization import Deserializer, Serializer from ._configuration import ContainerServiceClientConfiguration -from .operations import AgentPoolsOperations, MaintenanceConfigurationsOperations, ManagedClustersOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, ResolvePrivateLinkServiceIdOperations, SnapshotsOperations +from .operations import ( + AgentPoolsOperations, + MaintenanceConfigurationsOperations, + ManagedClustersOperations, + Operations, + PrivateEndpointConnectionsOperations, + PrivateLinkResourcesOperations, + ResolvePrivateLinkServiceIdOperations, + SnapshotsOperations, +) if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class ContainerServiceClient: # pylint: disable=too-many-instance-attributes + +class ContainerServiceClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """The Container Service Client. :ivar operations: Operations operations @@ -47,10 +56,10 @@ class ContainerServiceClient: # pylint: disable=too-many-instance-attributes azure.mgmt.containerservice.v2021_08_01.aio.operations.ResolvePrivateLinkServiceIdOperations :ivar snapshots: SnapshotsOperations operations :vartype snapshots: azure.mgmt.containerservice.v2021_08_01.aio.operations.SnapshotsOperations - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -68,25 +77,23 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = ContainerServiceClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = ContainerServiceClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize - ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.managed_clusters = ManagedClustersOperations( self._client, self._config, self._serialize, self._deserialize ) self.maintenance_configurations = MaintenanceConfigurationsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.agent_pools = AgentPoolsOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) self.private_endpoint_connections = PrivateEndpointConnectionsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -96,16 +103,9 @@ def __init__( self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations( self._client, self._config, self._serialize, self._deserialize ) - self.snapshots = SnapshotsOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.snapshots = SnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) - - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -114,7 +114,7 @@ def _send_request( >>> response = await client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/_patch.py index 74e48ecd07cf..f99e77fef986 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/_patch.py @@ -28,4 +28,4 @@ # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + pass diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/operations/__init__.py index e0748876288c..593b23075ce0 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/operations/__init__.py @@ -18,15 +18,16 @@ from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'Operations', - 'ManagedClustersOperations', - 'MaintenanceConfigurationsOperations', - 'AgentPoolsOperations', - 'PrivateEndpointConnectionsOperations', - 'PrivateLinkResourcesOperations', - 'ResolvePrivateLinkServiceIdOperations', - 'SnapshotsOperations', + "Operations", + "ManagedClustersOperations", + "MaintenanceConfigurationsOperations", + "AgentPoolsOperations", + "PrivateEndpointConnectionsOperations", + "PrivateLinkResourcesOperations", + "ResolvePrivateLinkServiceIdOperations", + "SnapshotsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/operations/_agent_pools_operations.py index afdc0001f22c..e2947173879d 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/operations/_agent_pools_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +29,20 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._agent_pools_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_available_agent_pool_versions_request, build_get_request, build_get_upgrade_profile_request, build_list_request, build_upgrade_node_image_version_request_initial -T = TypeVar('T') +from ...operations._agent_pools_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_available_agent_pool_versions_request, + build_get_request, + build_get_upgrade_profile_request, + build_list_request, + build_upgrade_node_image_version_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class AgentPoolsOperations: """ .. warning:: @@ -45,47 +62,40 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.AgentPoolListResult]: + def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncIterable["_models.AgentPool"]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AgentPoolListResult or the result of cls(response) + :return: An iterator like instance of either AgentPool or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_08_01.models.AgentPoolListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_08_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -93,16 +103,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -118,10 +123,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -131,54 +134,45 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore @distributed_trace_async async def get( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPool: """Gets the specified managed cluster agent pool. Gets the specified managed cluster agent pool. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPool, or the result of cls(response) + :return: AgentPool or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.AgentPool - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -186,57 +180,60 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore async def _create_or_update_initial( self, resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: _models.AgentPool, + parameters: Union[_models.AgentPool, IO], **kwargs: Any ) -> _models.AgentPool: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - _json = self._serialize.body(parameters, 'AgentPool') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "AgentPool") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -244,10 +241,9 @@ async def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -255,40 +251,44 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - @distributed_trace_async + @overload async def begin_create_or_update( self, resource_group_name: str, resource_name: str, agent_pool_name: str, parameters: _models.AgentPool, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.AgentPool]: """Creates or updates an agent pool in the specified managed cluster. Creates or updates an agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str - :param parameters: The agent pool to create or update. + :param parameters: The agent pool to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2021_08_01.models.AgentPool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -301,20 +301,98 @@ async def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_08_01.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AgentPool]: + """Creates or updates an agent pool in the specified managed cluster. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: The agent pool to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AgentPool or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_08_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: Union[_models.AgentPool, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.AgentPool]: + """Creates or updates an agent pool in the specified managed cluster. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: The agent pool to create or update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.mgmt.containerservice.v2021_08_01.models.AgentPool or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AgentPool or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_08_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -323,66 +401,55 @@ async def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -390,10 +457,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -403,26 +469,21 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + async def begin_delete( + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes an agent pool in the specified managed cluster. Deletes an agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -434,99 +495,85 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace_async async def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPoolUpgradeProfile: """Gets the upgrade profile for an agent pool. Gets the upgrade profile for an agent pool. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolUpgradeProfile, or the result of cls(response) + :return: AgentPoolUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.AgentPoolUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -534,32 +581,27 @@ async def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolUpgradeProfile', pipeline_response) + deserialized = self._deserialize("AgentPoolUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore @distributed_trace_async async def get_available_agent_pool_versions( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported Kubernetes versions for the specified agent pool. @@ -567,33 +609,30 @@ async def get_available_agent_pool_versions( `_ for more details about the version lifecycle. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolAvailableVersions, or the result of cls(response) + :return: AgentPoolAvailableVersions or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.AgentPoolAvailableVersions - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolAvailableVersions] - request = build_get_available_agent_pool_versions_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_available_agent_pool_versions.metadata['url'], + template_url=self.get_available_agent_pool_versions.metadata["url"], headers=_headers, params=_params, ) @@ -601,52 +640,43 @@ async def get_available_agent_pool_versions( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolAvailableVersions', pipeline_response) + deserialized = self._deserialize("AgentPoolAvailableVersions", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_available_agent_pool_versions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore - + get_available_agent_pool_versions.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore async def _upgrade_node_image_version_initial( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> Optional[_models.AgentPool]: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.AgentPool]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.AgentPool]] - - request = build_upgrade_node_image_version_request_initial( - subscription_id=self._config.subscription_id, + request = build_upgrade_node_image_version_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._upgrade_node_image_version_initial.metadata['url'], + template_url=self._upgrade_node_image_version_initial.metadata["url"], headers=_headers, params=_params, ) @@ -654,10 +684,9 @@ async def _upgrade_node_image_version_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -666,35 +695,30 @@ async def _upgrade_node_image_version_initial( deserialized = None if response.status_code == 202: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _upgrade_node_image_version_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore - + _upgrade_node_image_version_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore @distributed_trace_async async def begin_upgrade_node_image_version( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any - ) -> AsyncLROPoller[_models.AgentPool]: + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: """Upgrades the node image version of an agent pool to the latest. Upgrading the node image version of an agent pool applies the newest OS and runtime updates to the nodes. AKS provides one new image per week with the latest updates. For more details on node image versions, see: https://docs.microsoft.com/azure/aks/node-image-upgrade. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -708,55 +732,48 @@ async def begin_upgrade_node_image_version( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_08_01.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._upgrade_node_image_version_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_upgrade_node_image_version.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore + begin_upgrade_node_image_version.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/operations/_maintenance_configurations_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/operations/_maintenance_configurations_operations.py index c3a2a5767fbb..7136618193d7 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/operations/_maintenance_configurations_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/operations/_maintenance_configurations_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,10 +27,17 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._maintenance_configurations_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_managed_cluster_request -T = TypeVar('T') +from ...operations._maintenance_configurations_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_managed_cluster_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class MaintenanceConfigurationsOperations: """ .. warning:: @@ -43,48 +57,43 @@ def __init__(self, *args, **kwargs) -> None: 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_managed_cluster( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.MaintenanceConfigurationListResult]: + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> AsyncIterable["_models.MaintenanceConfiguration"]: """Gets a list of maintenance configurations in the specified managed cluster. Gets a list of maintenance configurations in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either MaintenanceConfigurationListResult or the result - of cls(response) + :return: An iterator like instance of either MaintenanceConfiguration or the result of + cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_08_01.models.MaintenanceConfigurationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_08_01.models.MaintenanceConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfigurationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfigurationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_managed_cluster_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_managed_cluster.metadata['url'], + template_url=self.list_by_managed_cluster.metadata["url"], headers=_headers, params=_params, ) @@ -92,16 +101,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_managed_cluster_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -117,10 +121,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -130,54 +132,45 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_managed_cluster.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations"} # type: ignore + list_by_managed_cluster.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations"} # type: ignore @distributed_trace_async async def get( - self, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, config_name: str, **kwargs: Any ) -> _models.MaintenanceConfiguration: """Gets the specified maintenance configuration of a managed cluster. Gets the specified maintenance configuration of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: MaintenanceConfiguration, or the result of cls(response) + :return: MaintenanceConfiguration or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.MaintenanceConfiguration - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfiguration] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -185,75 +178,147 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) + deserialized = self._deserialize("MaintenanceConfiguration", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - @distributed_trace_async + @overload async def create_or_update( self, resource_group_name: str, resource_name: str, config_name: str, parameters: _models.MaintenanceConfiguration, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.MaintenanceConfiguration: """Creates or updates a maintenance configuration in the specified managed cluster. Creates or updates a maintenance configuration in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str - :param parameters: The maintenance configuration to create or update. + :param parameters: The maintenance configuration to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2021_08_01.models.MaintenanceConfiguration + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: MaintenanceConfiguration, or the result of cls(response) + :return: MaintenanceConfiguration or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.MaintenanceConfiguration - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configuration in the specified managed cluster. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: The maintenance configuration to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: Union[_models.MaintenanceConfiguration, IO], + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configuration in the specified managed cluster. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: The maintenance configuration to create or update. Is either a model type or + a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_08_01.models.MaintenanceConfiguration or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfiguration] - _json = self._serialize.body(parameters, 'MaintenanceConfiguration') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "MaintenanceConfiguration") request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) @@ -261,68 +326,59 @@ async def create_or_update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) + deserialized = self._deserialize("MaintenanceConfiguration", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, config_name: str, **kwargs: Any ) -> None: """Deletes a maintenance configuration. Deletes a maintenance configuration. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) @@ -330,10 +386,9 @@ async def delete( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -343,5 +398,4 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/operations/_managed_clusters_operations.py index c22a95020c9b..35556e540dcb 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/operations/_managed_clusters_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +29,33 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._managed_clusters_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_access_profile_request, build_get_command_result_request, build_get_os_options_request, build_get_request, build_get_upgrade_profile_request, build_list_by_resource_group_request, build_list_cluster_admin_credentials_request, build_list_cluster_monitoring_user_credentials_request, build_list_cluster_user_credentials_request, build_list_outbound_network_dependencies_endpoints_request, build_list_request, build_reset_aad_profile_request_initial, build_reset_service_principal_profile_request_initial, build_rotate_cluster_certificates_request_initial, build_run_command_request_initial, build_start_request_initial, build_stop_request_initial, build_update_tags_request_initial -T = TypeVar('T') +from ...operations._managed_clusters_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_access_profile_request, + build_get_command_result_request, + build_get_os_options_request, + build_get_request, + build_get_upgrade_profile_request, + build_list_by_resource_group_request, + build_list_cluster_admin_credentials_request, + build_list_cluster_monitoring_user_credentials_request, + build_list_cluster_user_credentials_request, + build_list_outbound_network_dependencies_endpoints_request, + build_list_request, + build_reset_aad_profile_request, + build_reset_service_principal_profile_request, + build_rotate_cluster_certificates_request, + build_run_command_request, + build_start_request, + build_stop_request, + build_update_tags_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class ManagedClustersOperations: # pylint: disable=too-many-public-methods """ .. warning:: @@ -45,46 +75,39 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async async def get_os_options( - self, - location: str, - resource_type: Optional[str] = None, - **kwargs: Any + self, location: str, resource_type: Optional[str] = None, **kwargs: Any ) -> _models.OSOptionProfile: """Gets supported OS options in the specified subscription. Gets supported OS options in the specified subscription. - :param location: The name of a supported Azure region. + :param location: The name of a supported Azure region. Required. :type location: str :param resource_type: The resource type for which the OS options needs to be returned. Default value is None. :type resource_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: OSOptionProfile, or the result of cls(response) + :return: OSOptionProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.OSOptionProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OSOptionProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OSOptionProfile] - request = build_get_os_options_request( - subscription_id=self._config.subscription_id, location=location, - api_version=api_version, + subscription_id=self._config.subscription_id, resource_type=resource_type, - template_url=self.get_os_options.metadata['url'], + api_version=api_version, + template_url=self.get_os_options.metadata["url"], headers=_headers, params=_params, ) @@ -92,59 +115,52 @@ async def get_os_options( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('OSOptionProfile', pipeline_response) + deserialized = self._deserialize("OSOptionProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_os_options.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default"} # type: ignore - + get_os_options.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default"} # type: ignore @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.ManagedClusterListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.ManagedCluster"]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_08_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_08_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -152,14 +168,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -175,10 +188,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -188,49 +199,43 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.ManagedClusterListResult]: + self, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ManagedCluster"]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_08_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_08_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -238,15 +243,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -262,10 +263,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -275,50 +274,42 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace_async async def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.ManagedClusterUpgradeProfile: """Gets the upgrade profile of a managed cluster. Gets the upgrade profile of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterUpgradeProfile, or the result of cls(response) + :return: ManagedClusterUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.ManagedClusterUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -326,33 +317,27 @@ async def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterUpgradeProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore @distributed_trace_async async def get_access_profile( - self, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, role_name: str, **kwargs: Any ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. @@ -361,36 +346,33 @@ async def get_access_profile( `ListClusterAdminCredentials `_ . - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param role_name: The name of the role for managed cluster accessProfile resource. + :param role_name: The name of the role for managed cluster accessProfile resource. Required. :type role_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterAccessProfile, or the result of cls(response) + :return: ManagedClusterAccessProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.ManagedClusterAccessProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterAccessProfile] - request = build_get_access_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, role_name=role_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_access_profile.metadata['url'], + template_url=self.get_access_profile.metadata["url"], headers=_headers, params=_params, ) @@ -398,68 +380,59 @@ async def get_access_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterAccessProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterAccessProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_access_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore - + get_access_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore @distributed_trace_async async def list_cluster_admin_credentials( - self, - resource_group_name: str, - resource_name: str, - server_fqdn: Optional[str] = None, - **kwargs: Any + self, resource_group_name: str, resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any ) -> _models.CredentialResults: """Lists the admin credentials of a managed cluster. Lists the admin credentials of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_admin_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, - template_url=self.list_cluster_admin_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_admin_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -467,68 +440,59 @@ async def list_cluster_admin_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_admin_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore - + list_cluster_admin_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore @distributed_trace_async async def list_cluster_user_credentials( - self, - resource_group_name: str, - resource_name: str, - server_fqdn: Optional[str] = None, - **kwargs: Any + self, resource_group_name: str, resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any ) -> _models.CredentialResults: """Lists the user credentials of a managed cluster. Lists the user credentials of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, - template_url=self.list_cluster_user_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -536,68 +500,59 @@ async def list_cluster_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore - + list_cluster_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore @distributed_trace_async async def list_cluster_monitoring_user_credentials( - self, - resource_group_name: str, - resource_name: str, - server_fqdn: Optional[str] = None, - **kwargs: Any + self, resource_group_name: str, resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any ) -> _models.CredentialResults: """Lists the cluster monitoring user credentials of a managed cluster. Lists the cluster monitoring user credentials of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_monitoring_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, - template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_monitoring_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -605,64 +560,54 @@ async def list_cluster_monitoring_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_monitoring_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore - + list_cluster_monitoring_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore @distributed_trace_async - async def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.ManagedCluster: + async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.ManagedCluster: """Gets a managed cluster. Gets a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedCluster, or the result of cls(response) + :return: ManagedCluster or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.ManagedCluster - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -670,55 +615,54 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _create_or_update_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.ManagedCluster, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'ManagedCluster') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedCluster") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -726,10 +670,9 @@ async def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -737,37 +680,41 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - - @distributed_trace_async + @overload async def begin_create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedCluster, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. Creates or updates a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The managed cluster to create or update. + :param parameters: The managed cluster to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2021_08_01.models.ManagedCluster + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -780,20 +727,88 @@ async def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_08_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_08_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster to create or update. Is either a model type or a IO + type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_08_01.models.ManagedCluster or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_08_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -801,69 +816,66 @@ async def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _update_tags_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.TagsObject, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request_initial( - subscription_id=self._config.subscription_id, + request = build_update_tags_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_tags_initial.metadata['url'], + content=_content, + template_url=self._update_tags_initial.metadata["url"], headers=_headers, params=_params, ) @@ -871,44 +883,47 @@ async def _update_tags_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_tags_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + _update_tags_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - - @distributed_trace_async + @overload async def begin_update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates tags on a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2021_08_01.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -921,20 +936,88 @@ async def begin_update_tags( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_08_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates tags on a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_08_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates tags on a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_08_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_08_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, @@ -942,64 +1025,54 @@ async def begin_update_tags( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1007,10 +1080,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1020,23 +1092,17 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: + async def begin_delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Deletes a managed cluster. Deletes a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1048,85 +1114,83 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterServicePrincipalProfile, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterServicePrincipalProfile") - request = build_reset_service_principal_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_service_principal_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_service_principal_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_service_principal_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1134,10 +1198,9 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1147,28 +1210,104 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist if cls: return cls(pipeline_response, None, {}) - _reset_service_principal_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + _reset_service_principal_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore - - @distributed_trace_async - async def begin_reset_service_principal_profile( # pylint: disable=inconsistent-return-statements + @overload + async def begin_reset_service_principal_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterServicePrincipalProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: """Reset the Service Principal Profile of a managed cluster. This action cannot be performed on a cluster that is not using a service principal. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The service principal profile to set on the managed cluster. + :param parameters: The service principal profile to set on the managed cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2021_08_01.models.ManagedClusterServicePrincipalProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset the Service Principal Profile of a managed cluster. + + This action cannot be performed on a cluster that is not using a service principal. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The service principal profile to set on the managed cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset the Service Principal Profile of a managed cluster. + + This action cannot be performed on a cluster that is not using a service principal. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The service principal profile to set on the managed cluster. Is either a + model type or a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2021_08_01.models.ManagedClusterServicePrincipalProfile or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -1179,20 +1318,17 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1200,67 +1336,68 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_service_principal_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + begin_reset_service_principal_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterAADProfile, + parameters: Union[_models.ManagedClusterAADProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterAADProfile") - request = build_reset_aad_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_aad_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_aad_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_aad_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1268,10 +1405,9 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1281,27 +1417,103 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta if cls: return cls(pipeline_response, None, {}) - _reset_aad_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + _reset_aad_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - - @distributed_trace_async - async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements + @overload + async def begin_reset_aad_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterAADProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: """Reset the AAD Profile of a managed cluster. Reset the AAD Profile of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The AAD profile to set on the Managed Cluster. + :param parameters: The AAD profile to set on the Managed Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2021_08_01.models.ManagedClusterAADProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset the AAD Profile of a managed cluster. + + Reset the AAD Profile of a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The AAD profile to set on the Managed Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterAADProfile, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset the AAD Profile of a managed cluster. + + Reset the AAD Profile of a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The AAD profile to set on the Managed Cluster. Is either a model type or a + IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_08_01.models.ManagedClusterAADProfile or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -1312,20 +1524,17 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1333,62 +1542,52 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_aad_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + begin_reset_aad_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_rotate_cluster_certificates_request_initial( - subscription_id=self._config.subscription_id, + request = build_rotate_cluster_certificates_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._rotate_cluster_certificates_initial.metadata['url'], + template_url=self._rotate_cluster_certificates_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1396,10 +1595,9 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1409,24 +1607,20 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- if cls: return cls(pipeline_response, None, {}) - _rotate_cluster_certificates_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore - + _rotate_cluster_certificates_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore @distributed_trace_async - async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + async def begin_rotate_cluster_certificates( + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Rotates the certificates of a managed cluster. See `Certificate rotation `_ for more details about rotating managed cluster certificates. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1438,80 +1632,67 @@ async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-ret Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._rotate_cluster_certificates_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_rotate_cluster_certificates.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore + begin_rotate_cluster_certificates.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore async def _stop_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_stop_request_initial( - subscription_id=self._config.subscription_id, + request = build_stop_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._stop_initial.metadata['url'], + template_url=self._stop_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1519,10 +1700,9 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1532,16 +1712,10 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore - + _stop_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore @distributed_trace_async - async def begin_stop( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: + async def begin_stop(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Stops a Managed Cluster. This can only be performed on Azure Virtual Machine Scale set backed clusters. Stopping a @@ -1550,9 +1724,9 @@ async def begin_stop( # pylint: disable=inconsistent-return-statements `_ for more details about stopping a cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1564,80 +1738,67 @@ async def begin_stop( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._stop_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore + begin_stop.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore async def _start_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_start_request_initial( - subscription_id=self._config.subscription_id, + request = build_start_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._start_initial.metadata['url'], + template_url=self._start_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1645,10 +1806,9 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1658,24 +1818,18 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore - + _start_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore @distributed_trace_async - async def begin_start( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: + async def begin_start(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Starts a previously stopped Managed Cluster. See `starting a cluster `_ for more details about starting a cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1687,85 +1841,83 @@ async def begin_start( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._start_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore + begin_start.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore async def _run_command_initial( self, resource_group_name: str, resource_name: str, - request_payload: _models.RunCommandRequest, + request_payload: Union[_models.RunCommandRequest, IO], **kwargs: Any ) -> Optional[_models.RunCommandResult]: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RunCommandResult]] - _json = self._serialize.body(request_payload, 'RunCommandRequest') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(request_payload, (IO, bytes)): + _content = request_payload + else: + _json = self._serialize.body(request_payload, "RunCommandRequest") - request = build_run_command_request_initial( - subscription_id=self._config.subscription_id, + request = build_run_command_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._run_command_initial.metadata['url'], + content=_content, + template_url=self._run_command_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1773,10 +1925,9 @@ async def _run_command_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1785,22 +1936,23 @@ async def _run_command_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _run_command_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore - + _run_command_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore - @distributed_trace_async + @overload async def begin_run_command( self, resource_group_name: str, resource_name: str, request_payload: _models.RunCommandRequest, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.RunCommandResult]: """Submits a command to run against the Managed Cluster. @@ -1809,12 +1961,15 @@ async def begin_run_command( more information see `AKS Run Command `_. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param request_payload: The run command request. + :param request_payload: The run command request. Required. :type request_payload: ~azure.mgmt.containerservice.v2021_08_01.models.RunCommandRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -1827,20 +1982,95 @@ async def begin_run_command( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_08_01.models.RunCommandResult] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_run_command( + self, + resource_group_name: str, + resource_name: str, + request_payload: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.RunCommandResult]: + """Submits a command to run against the Managed Cluster. + + AKS will create a pod to run the command. This is primarily useful for private clusters. For + more information see `AKS Run Command + `_. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param request_payload: The run command request. Required. + :type request_payload: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RunCommandResult or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_08_01.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_run_command( + self, + resource_group_name: str, + resource_name: str, + request_payload: Union[_models.RunCommandRequest, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.RunCommandResult]: + """Submits a command to run against the Managed Cluster. + + AKS will create a pod to run the command. This is primarily useful for private clusters. For + more information see `AKS Run Command + `_. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param request_payload: The run command request. Is either a model type or a IO type. Required. + :type request_payload: ~azure.mgmt.containerservice.v2021_08_01.models.RunCommandRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RunCommandResult or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_08_01.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.RunCommandResult] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.RunCommandResult] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._run_command_initial( # type: ignore resource_group_name=resource_group_name, @@ -1848,82 +2078,71 @@ async def begin_run_command( request_payload=request_payload, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_run_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore + begin_run_command.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore @distributed_trace_async async def get_command_result( - self, - resource_group_name: str, - resource_name: str, - command_id: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, command_id: str, **kwargs: Any ) -> Optional[_models.RunCommandResult]: """Gets the results of a command which has been run on the Managed Cluster. Gets the results of a command which has been run on the Managed Cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param command_id: Id of the command. + :param command_id: Id of the command. Required. :type command_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: RunCommandResult, or the result of cls(response) + :return: RunCommandResult or None or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.RunCommandResult or None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RunCommandResult]] - request = build_get_command_result_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, command_id=command_id, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_command_result.metadata['url'], + template_url=self.get_command_result.metadata["url"], headers=_headers, params=_params, ) @@ -1931,10 +2150,9 @@ async def get_command_result( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1943,59 +2161,54 @@ async def get_command_result( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_command_result.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}"} # type: ignore - + get_command_result.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}"} # type: ignore @distributed_trace def list_outbound_network_dependencies_endpoints( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.OutboundEnvironmentEndpointCollection]: + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> AsyncIterable["_models.OutboundEnvironmentEndpoint"]: """Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster. Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster. The operation returns properties of each egress endpoint. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OutboundEnvironmentEndpointCollection or the - result of cls(response) + :return: An iterator like instance of either OutboundEnvironmentEndpoint or the result of + cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_08_01.models.OutboundEnvironmentEndpointCollection] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_08_01.models.OutboundEnvironmentEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_outbound_network_dependencies_endpoints_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_outbound_network_dependencies_endpoints.metadata['url'], + template_url=self.list_outbound_network_dependencies_endpoints.metadata["url"], headers=_headers, params=_params, ) @@ -2003,16 +2216,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_outbound_network_dependencies_endpoints_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -2028,10 +2236,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2041,8 +2247,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_outbound_network_dependencies_endpoints.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints"} # type: ignore + list_outbound_network_dependencies_endpoints.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/operations/_operations.py index a42042da6dc9..afd38f10a5cd 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/operations/_operations.py @@ -7,9 +7,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,9 +27,11 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._operations import build_list_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class Operations: """ .. warning:: @@ -42,38 +51,33 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.OperationListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.OperationValue"]: """Gets a list of operations. Gets a list of operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationListResult or the result of cls(response) + :return: An iterator like instance of either OperationValue or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_08_01.models.OperationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_08_01.models.OperationValue] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -81,13 +85,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -103,10 +105,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -116,8 +116,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.ContainerService/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ContainerService/operations"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/operations/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/operations/_private_endpoint_connections_operations.py index e03d5930a1b2..cc704bfcaed3 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/operations/_private_endpoint_connections_operations.py @@ -6,9 +6,15 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -20,10 +26,17 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._private_endpoint_connections_operations import build_delete_request_initial, build_get_request, build_list_request, build_update_request -T = TypeVar('T') +from ...operations._private_endpoint_connections_operations import ( + build_delete_request, + build_get_request, + build_list_request, + build_update_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class PrivateEndpointConnectionsOperations: """ .. warning:: @@ -43,46 +56,39 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async async def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnectionListResult: """Gets a list of private endpoint connections in the specified managed cluster. To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnectionListResult, or the result of cls(response) + :return: PrivateEndpointConnectionListResult or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.PrivateEndpointConnectionListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnectionListResult] - request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -90,69 +96,60 @@ async def list( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore - + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore @distributed_trace_async async def get( - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnection: """Gets the specified private endpoint connection. To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -160,75 +157,147 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - @distributed_trace_async + @overload async def update( self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, parameters: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateEndpointConnection: """Updates a private endpoint connection. Updates a private endpoint connection. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str - :param parameters: The updated private endpoint connection. + :param parameters: The updated private endpoint connection. Required. :type parameters: ~azure.mgmt.containerservice.v2021_08_01.models.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: The updated private endpoint connection. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: Union[_models.PrivateEndpointConnection, IO], + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: The updated private endpoint connection. Is either a model type or a IO + type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_08_01.models.PrivateEndpointConnection or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - _json = self._serialize.body(parameters, 'PrivateEndpointConnection') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateEndpointConnection") request = build_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update.metadata['url'], + content=_content, + template_url=self.update.metadata["url"], headers=_headers, params=_params, ) @@ -236,52 +305,43 @@ async def update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -289,10 +349,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -302,26 +361,21 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + async def begin_delete( + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes a private endpoint connection. Deletes a private endpoint connection. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -333,53 +387,46 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/operations/_private_link_resources_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/operations/_private_link_resources_operations.py index ed4805ff59d3..75e5c6b2552e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/operations/_private_link_resources_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/operations/_private_link_resources_operations.py @@ -8,7 +8,13 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -19,9 +25,11 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._private_link_resources_operations import build_list_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class PrivateLinkResourcesOperations: """ .. warning:: @@ -41,46 +49,39 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async async def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.PrivateLinkResourcesListResult: """Gets a list of private link resources in the specified managed cluster. To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResourcesListResult, or the result of cls(response) + :return: PrivateLinkResourcesListResult or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.PrivateLinkResourcesListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResourcesListResult] - request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -88,22 +89,20 @@ async def list( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResourcesListResult', pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources"} # type: ignore - + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/operations/_resolve_private_link_service_id_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/operations/_resolve_private_link_service_id_operations.py index 6eed10383efd..5501bae3e682 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/operations/_resolve_private_link_service_id_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/operations/_resolve_private_link_service_id_operations.py @@ -6,9 +6,15 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -19,9 +25,11 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._resolve_private_link_service_id_operations import build_post_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class ResolvePrivateLinkServiceIdOperations: """ .. warning:: @@ -41,52 +49,118 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async + @overload async def post( self, resource_group_name: str, resource_name: str, parameters: _models.PrivateLinkResource, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateLinkResource: """Gets the private link service ID for the specified managed cluster. Gets the private link service ID for the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters required in order to resolve a private link service ID. + :param parameters: Parameters required in order to resolve a private link service ID. Required. :type parameters: ~azure.mgmt.containerservice.v2021_08_01.models.PrivateLinkResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def post( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID for the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters required in order to resolve a private link service ID. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResource, or the result of cls(response) + :return: PrivateLinkResource or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.PrivateLinkResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @distributed_trace_async + async def post( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.PrivateLinkResource, IO], + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID for the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters required in order to resolve a private link service ID. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_08_01.models.PrivateLinkResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResource] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResource] - _json = self._serialize.body(parameters, 'PrivateLinkResource') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateLinkResource") request = build_post_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.post.metadata['url'], + content=_content, + template_url=self.post.metadata["url"], headers=_headers, params=_params, ) @@ -94,22 +168,20 @@ async def post( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResource', pipeline_response) + deserialized = self._deserialize("PrivateLinkResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - post.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId"} # type: ignore - + post.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/operations/_snapshots_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/operations/_snapshots_operations.py index 2042f8feb05a..5420b68e668b 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/operations/_snapshots_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/operations/_snapshots_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,10 +27,19 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._snapshots_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_resource_group_request, build_list_request, build_update_tags_request -T = TypeVar('T') +from ...operations._snapshots_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_resource_group_request, + build_list_request, + build_update_tags_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class SnapshotsOperations: """ .. warning:: @@ -43,39 +59,34 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.SnapshotListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.Snapshot"]: """Gets a list of snapshots in the specified subscription. Gets a list of snapshots in the specified subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SnapshotListResult or the result of cls(response) + :return: An iterator like instance of either Snapshot or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_08_01.models.SnapshotListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_08_01.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SnapshotListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -83,14 +94,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -106,10 +114,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -119,48 +125,41 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots"} # type: ignore @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.SnapshotListResult]: + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.Snapshot"]: """Lists snapshots in the specified subscription and resource group. Lists snapshots in the specified subscription and resource group. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SnapshotListResult or the result of cls(response) + :return: An iterator like instance of either Snapshot or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_08_01.models.SnapshotListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_08_01.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SnapshotListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -168,15 +167,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -192,10 +187,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -205,50 +198,40 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots"} # type: ignore @distributed_trace_async - async def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.Snapshot: + async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.Snapshot: """Gets a snapshot. Gets a snapshot. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Snapshot, or the result of cls(response) + :return: Snapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.Snapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -256,71 +239,132 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - - @distributed_trace_async + @overload async def create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.Snapshot, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.Snapshot: """Creates or updates a snapshot. Creates or updates a snapshot. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The snapshot to create or update. + :param parameters: The snapshot to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2021_08_01.models.Snapshot + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Snapshot: + """Creates or updates a snapshot. + + Creates or updates a snapshot. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The snapshot to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Snapshot, or the result of cls(response) + :return: Snapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.Snapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @distributed_trace_async + async def create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.Snapshot, IO], **kwargs: Any + ) -> _models.Snapshot: + """Creates or updates a snapshot. + + Creates or updates a snapshot. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The snapshot to create or update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.mgmt.containerservice.v2021_08_01.models.Snapshot or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] - _json = self._serialize.body(parameters, 'Snapshot') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "Snapshot") request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) @@ -328,10 +372,9 @@ async def create_or_update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -339,64 +382,126 @@ async def create_or_update( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - @distributed_trace_async + @overload async def update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.Snapshot: """Updates tags on a snapshot. Updates tags on a snapshot. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update snapshot Tags operation. + :param parameters: Parameters supplied to the Update snapshot Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2021_08_01.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Snapshot: + """Updates tags on a snapshot. + + Updates tags on a snapshot. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update snapshot Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> _models.Snapshot: + """Updates tags on a snapshot. + + Updates tags on a snapshot. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update snapshot Tags operation. Is either a model + type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_08_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Snapshot, or the result of cls(response) + :return: Snapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.Snapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") request = build_update_tags_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_tags.metadata['url'], + content=_content, + template_url=self.update_tags.metadata["url"], headers=_headers, params=_params, ) @@ -404,64 +509,56 @@ async def update_tags( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - + update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: """Deletes a snapshot. Deletes a snapshot. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) @@ -469,10 +566,9 @@ async def delete( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -482,5 +578,4 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - + delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/models/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/models/__init__.py index c36cee9c95c1..09954ac9f97e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/models/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/models/__init__.py @@ -92,166 +92,164 @@ from ._models_py3 import TimeSpan from ._models_py3 import UserAssignedIdentity - -from ._container_service_client_enums import ( - AgentPoolMode, - AgentPoolType, - Code, - ConnectionStatus, - ContainerServiceStorageProfileTypes, - ContainerServiceVMSizeTypes, - Count, - CreatedByType, - Expander, - ExtendedLocationTypes, - GPUInstanceProfile, - KubeletDiskType, - LicenseType, - LoadBalancerSku, - ManagedClusterPodIdentityProvisioningState, - ManagedClusterSKUName, - ManagedClusterSKUTier, - NetworkMode, - NetworkPlugin, - NetworkPolicy, - OSDiskType, - OSSKU, - OSType, - OutboundType, - PrivateEndpointConnectionProvisioningState, - PublicNetworkAccess, - ResourceIdentityType, - ScaleDownMode, - ScaleSetEvictionPolicy, - ScaleSetPriority, - SnapshotType, - UpgradeChannel, - WeekDay, - WorkloadRuntime, -) +from ._container_service_client_enums import AgentPoolMode +from ._container_service_client_enums import AgentPoolType +from ._container_service_client_enums import Code +from ._container_service_client_enums import ConnectionStatus +from ._container_service_client_enums import ContainerServiceStorageProfileTypes +from ._container_service_client_enums import ContainerServiceVMSizeTypes +from ._container_service_client_enums import Count +from ._container_service_client_enums import CreatedByType +from ._container_service_client_enums import Expander +from ._container_service_client_enums import ExtendedLocationTypes +from ._container_service_client_enums import GPUInstanceProfile +from ._container_service_client_enums import KubeletDiskType +from ._container_service_client_enums import LicenseType +from ._container_service_client_enums import LoadBalancerSku +from ._container_service_client_enums import ManagedClusterPodIdentityProvisioningState +from ._container_service_client_enums import ManagedClusterSKUName +from ._container_service_client_enums import ManagedClusterSKUTier +from ._container_service_client_enums import NetworkMode +from ._container_service_client_enums import NetworkPlugin +from ._container_service_client_enums import NetworkPolicy +from ._container_service_client_enums import OSDiskType +from ._container_service_client_enums import OSSKU +from ._container_service_client_enums import OSType +from ._container_service_client_enums import OutboundType +from ._container_service_client_enums import PrivateEndpointConnectionProvisioningState +from ._container_service_client_enums import PublicNetworkAccess +from ._container_service_client_enums import ResourceIdentityType +from ._container_service_client_enums import ScaleDownMode +from ._container_service_client_enums import ScaleSetEvictionPolicy +from ._container_service_client_enums import ScaleSetPriority +from ._container_service_client_enums import SnapshotType +from ._container_service_client_enums import UpgradeChannel +from ._container_service_client_enums import WeekDay +from ._container_service_client_enums import WorkloadRuntime from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'AgentPool', - 'AgentPoolAvailableVersions', - 'AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem', - 'AgentPoolListResult', - 'AgentPoolUpgradeProfile', - 'AgentPoolUpgradeProfilePropertiesUpgradesItem', - 'AgentPoolUpgradeSettings', - 'CloudErrorBody', - 'ContainerServiceDiagnosticsProfile', - 'ContainerServiceLinuxProfile', - 'ContainerServiceMasterProfile', - 'ContainerServiceNetworkProfile', - 'ContainerServiceSshConfiguration', - 'ContainerServiceSshPublicKey', - 'ContainerServiceVMDiagnostics', - 'CreationData', - 'CredentialResult', - 'CredentialResults', - 'EndpointDependency', - 'EndpointDetail', - 'ExtendedLocation', - 'KubeletConfig', - 'LinuxOSConfig', - 'MaintenanceConfiguration', - 'MaintenanceConfigurationListResult', - 'ManagedCluster', - 'ManagedClusterAADProfile', - 'ManagedClusterAPIServerAccessProfile', - 'ManagedClusterAccessProfile', - 'ManagedClusterAddonProfile', - 'ManagedClusterAddonProfileIdentity', - 'ManagedClusterAgentPoolProfile', - 'ManagedClusterAgentPoolProfileProperties', - 'ManagedClusterAutoUpgradeProfile', - 'ManagedClusterHTTPProxyConfig', - 'ManagedClusterIdentity', - 'ManagedClusterListResult', - 'ManagedClusterLoadBalancerProfile', - 'ManagedClusterLoadBalancerProfileManagedOutboundIPs', - 'ManagedClusterLoadBalancerProfileOutboundIPPrefixes', - 'ManagedClusterLoadBalancerProfileOutboundIPs', - 'ManagedClusterManagedOutboundIPProfile', - 'ManagedClusterNATGatewayProfile', - 'ManagedClusterPodIdentity', - 'ManagedClusterPodIdentityException', - 'ManagedClusterPodIdentityProfile', - 'ManagedClusterPodIdentityProvisioningError', - 'ManagedClusterPodIdentityProvisioningErrorBody', - 'ManagedClusterPodIdentityProvisioningInfo', - 'ManagedClusterPoolUpgradeProfile', - 'ManagedClusterPoolUpgradeProfileUpgradesItem', - 'ManagedClusterPropertiesAutoScalerProfile', - 'ManagedClusterSKU', - 'ManagedClusterSecurityProfile', - 'ManagedClusterSecurityProfileAzureDefender', - 'ManagedClusterServicePrincipalProfile', - 'ManagedClusterUpgradeProfile', - 'ManagedClusterWindowsProfile', - 'ManagedServiceIdentityUserAssignedIdentitiesValue', - 'OSOptionProfile', - 'OSOptionProperty', - 'OperationListResult', - 'OperationValue', - 'OutboundEnvironmentEndpoint', - 'OutboundEnvironmentEndpointCollection', - 'PowerState', - 'PrivateEndpoint', - 'PrivateEndpointConnection', - 'PrivateEndpointConnectionListResult', - 'PrivateLinkResource', - 'PrivateLinkResourcesListResult', - 'PrivateLinkServiceConnectionState', - 'Resource', - 'ResourceReference', - 'RunCommandRequest', - 'RunCommandResult', - 'Snapshot', - 'SnapshotListResult', - 'SubResource', - 'SysctlConfig', - 'SystemData', - 'TagsObject', - 'TimeInWeek', - 'TimeSpan', - 'UserAssignedIdentity', - 'AgentPoolMode', - 'AgentPoolType', - 'Code', - 'ConnectionStatus', - 'ContainerServiceStorageProfileTypes', - 'ContainerServiceVMSizeTypes', - 'Count', - 'CreatedByType', - 'Expander', - 'ExtendedLocationTypes', - 'GPUInstanceProfile', - 'KubeletDiskType', - 'LicenseType', - 'LoadBalancerSku', - 'ManagedClusterPodIdentityProvisioningState', - 'ManagedClusterSKUName', - 'ManagedClusterSKUTier', - 'NetworkMode', - 'NetworkPlugin', - 'NetworkPolicy', - 'OSDiskType', - 'OSSKU', - 'OSType', - 'OutboundType', - 'PrivateEndpointConnectionProvisioningState', - 'PublicNetworkAccess', - 'ResourceIdentityType', - 'ScaleDownMode', - 'ScaleSetEvictionPolicy', - 'ScaleSetPriority', - 'SnapshotType', - 'UpgradeChannel', - 'WeekDay', - 'WorkloadRuntime', + "AgentPool", + "AgentPoolAvailableVersions", + "AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem", + "AgentPoolListResult", + "AgentPoolUpgradeProfile", + "AgentPoolUpgradeProfilePropertiesUpgradesItem", + "AgentPoolUpgradeSettings", + "CloudErrorBody", + "ContainerServiceDiagnosticsProfile", + "ContainerServiceLinuxProfile", + "ContainerServiceMasterProfile", + "ContainerServiceNetworkProfile", + "ContainerServiceSshConfiguration", + "ContainerServiceSshPublicKey", + "ContainerServiceVMDiagnostics", + "CreationData", + "CredentialResult", + "CredentialResults", + "EndpointDependency", + "EndpointDetail", + "ExtendedLocation", + "KubeletConfig", + "LinuxOSConfig", + "MaintenanceConfiguration", + "MaintenanceConfigurationListResult", + "ManagedCluster", + "ManagedClusterAADProfile", + "ManagedClusterAPIServerAccessProfile", + "ManagedClusterAccessProfile", + "ManagedClusterAddonProfile", + "ManagedClusterAddonProfileIdentity", + "ManagedClusterAgentPoolProfile", + "ManagedClusterAgentPoolProfileProperties", + "ManagedClusterAutoUpgradeProfile", + "ManagedClusterHTTPProxyConfig", + "ManagedClusterIdentity", + "ManagedClusterListResult", + "ManagedClusterLoadBalancerProfile", + "ManagedClusterLoadBalancerProfileManagedOutboundIPs", + "ManagedClusterLoadBalancerProfileOutboundIPPrefixes", + "ManagedClusterLoadBalancerProfileOutboundIPs", + "ManagedClusterManagedOutboundIPProfile", + "ManagedClusterNATGatewayProfile", + "ManagedClusterPodIdentity", + "ManagedClusterPodIdentityException", + "ManagedClusterPodIdentityProfile", + "ManagedClusterPodIdentityProvisioningError", + "ManagedClusterPodIdentityProvisioningErrorBody", + "ManagedClusterPodIdentityProvisioningInfo", + "ManagedClusterPoolUpgradeProfile", + "ManagedClusterPoolUpgradeProfileUpgradesItem", + "ManagedClusterPropertiesAutoScalerProfile", + "ManagedClusterSKU", + "ManagedClusterSecurityProfile", + "ManagedClusterSecurityProfileAzureDefender", + "ManagedClusterServicePrincipalProfile", + "ManagedClusterUpgradeProfile", + "ManagedClusterWindowsProfile", + "ManagedServiceIdentityUserAssignedIdentitiesValue", + "OSOptionProfile", + "OSOptionProperty", + "OperationListResult", + "OperationValue", + "OutboundEnvironmentEndpoint", + "OutboundEnvironmentEndpointCollection", + "PowerState", + "PrivateEndpoint", + "PrivateEndpointConnection", + "PrivateEndpointConnectionListResult", + "PrivateLinkResource", + "PrivateLinkResourcesListResult", + "PrivateLinkServiceConnectionState", + "Resource", + "ResourceReference", + "RunCommandRequest", + "RunCommandResult", + "Snapshot", + "SnapshotListResult", + "SubResource", + "SysctlConfig", + "SystemData", + "TagsObject", + "TimeInWeek", + "TimeSpan", + "UserAssignedIdentity", + "AgentPoolMode", + "AgentPoolType", + "Code", + "ConnectionStatus", + "ContainerServiceStorageProfileTypes", + "ContainerServiceVMSizeTypes", + "Count", + "CreatedByType", + "Expander", + "ExtendedLocationTypes", + "GPUInstanceProfile", + "KubeletDiskType", + "LicenseType", + "LoadBalancerSku", + "ManagedClusterPodIdentityProvisioningState", + "ManagedClusterSKUName", + "ManagedClusterSKUTier", + "NetworkMode", + "NetworkPlugin", + "NetworkPolicy", + "OSDiskType", + "OSSKU", + "OSType", + "OutboundType", + "PrivateEndpointConnectionProvisioningState", + "PublicNetworkAccess", + "ResourceIdentityType", + "ScaleDownMode", + "ScaleSetEvictionPolicy", + "ScaleSetPriority", + "SnapshotType", + "UpgradeChannel", + "WeekDay", + "WorkloadRuntime", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/models/_container_service_client_enums.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/models/_container_service_client_enums.py index ca3b2ccab3e1..cb73561d8d60 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/models/_container_service_client_enums.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/models/_container_service_client_enums.py @@ -13,7 +13,7 @@ class AgentPoolMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools + https://docs.microsoft.com/azure/aks/use-system-pools. """ #: System agent pools are primarily for hosting critical system pods such as CoreDNS and @@ -23,33 +23,34 @@ class AgentPoolMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: User agent pools are primarily for hosting your application pods. USER = "User" + class AgentPoolType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of Agent Pool. - """ + """The type of Agent Pool.""" #: Create an Agent Pool backed by a Virtual Machine Scale Set. VIRTUAL_MACHINE_SCALE_SETS = "VirtualMachineScaleSets" #: Use of this is strongly discouraged. AVAILABILITY_SET = "AvailabilitySet" + class Code(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Tells whether the cluster is Running or Stopped - """ + """Tells whether the cluster is Running or Stopped.""" #: The cluster is running. RUNNING = "Running" #: The cluster is stopped. STOPPED = "Stopped" + class ConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The private link service connection status. - """ + """The private link service connection status.""" PENDING = "Pending" APPROVED = "Approved" REJECTED = "Rejected" DISCONNECTED = "Disconnected" + class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Specifies what kind of storage to use. If omitted, the default will be chosen on your behalf based on the choice of orchestrator. @@ -58,9 +59,9 @@ class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEn STORAGE_ACCOUNT = "StorageAccount" MANAGED_DISKS = "ManagedDisks" + class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Size of agent VMs. Note: This is no longer maintained. - """ + """Size of agent VMs. Note: This is no longer maintained.""" STANDARD_A1 = "Standard_A1" STANDARD_A10 = "Standard_A10" @@ -237,6 +238,7 @@ class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): STANDARD_NV24 = "Standard_NV24" STANDARD_NV6 = "Standard_NV6" + class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): """Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, and 5. The default value is 1. @@ -246,15 +248,16 @@ class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): THREE = 3 FIVE = 5 + class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of identity that created the resource. - """ + """The type of identity that created the resource.""" USER = "User" APPLICATION = "Application" MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" + class Expander(str, Enum, metaclass=CaseInsensitiveEnumMeta): """If not specified, the default is 'random'. See `expanders `_ @@ -278,15 +281,15 @@ class Expander(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Used when you don't have a particular need for the node groups to scale differently. RANDOM = "random" + class ExtendedLocationTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of extendedLocation. - """ + """The type of extendedLocation.""" EDGE_ZONE = "EdgeZone" + class GPUInstanceProfile(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """GPUInstanceProfile to be used to specify GPU MIG instance profile for supported GPU VM SKU. - """ + """GPUInstanceProfile to be used to specify GPU MIG instance profile for supported GPU VM SKU.""" MIG1_G = "MIG1g" MIG2_G = "MIG2g" @@ -294,6 +297,7 @@ class GPUInstanceProfile(str, Enum, metaclass=CaseInsensitiveEnumMeta): MIG4_G = "MIG4g" MIG7_G = "MIG7g" + class KubeletDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. @@ -304,6 +308,7 @@ class KubeletDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Kubelet will use the temporary disk for its data. TEMPORARY = "Temporary" + class LicenseType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The license type to use for Windows VMs. See `Azure Hybrid User Benefits `_ for more details. @@ -314,6 +319,7 @@ class LicenseType(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Enables Azure Hybrid User Benefits for Windows VMs. WINDOWS_SERVER = "Windows_Server" + class LoadBalancerSku(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The default is 'standard'. See `Azure Load Balancer SKUs `_ for more information about the @@ -327,21 +333,22 @@ class LoadBalancerSku(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Use a basic Load Balancer with limited functionality. BASIC = "basic" + class ManagedClusterPodIdentityProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The current provisioning state of the pod identity. - """ + """The current provisioning state of the pod identity.""" ASSIGNED = "Assigned" UPDATING = "Updating" DELETING = "Deleting" FAILED = "Failed" + class ManagedClusterSKUName(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The name of a managed cluster SKU. - """ + """The name of a managed cluster SKU.""" BASIC = "Basic" + class ManagedClusterSKUTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): """If not specified, the default is 'Free'. See `uptime SLA `_ for more details. @@ -353,20 +360,20 @@ class ManagedClusterSKUTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: No guaranteed SLA, no additional charges. Free tier clusters have an SLO of 99.5%. FREE = "Free" + class NetworkMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """This cannot be specified if networkPlugin is anything other than 'azure'. - """ + """This cannot be specified if networkPlugin is anything other than 'azure'.""" #: No bridge is created. Intra-VM Pod to Pod communication is through IP routes created by Azure #: CNI. See `Transparent Mode `_ for #: more information. TRANSPARENT = "transparent" - #: This is no longer supported. + #: This is no longer supported BRIDGE = "bridge" + class NetworkPlugin(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Network plugin used for building the Kubernetes network. - """ + """Network plugin used for building the Kubernetes network.""" #: Use the Azure CNI network plugin. See `Azure CNI (advanced) networking #: `_ for @@ -377,9 +384,9 @@ class NetworkPlugin(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: information. KUBENET = "kubenet" + class NetworkPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Network policy used for building the Kubernetes network. - """ + """Network policy used for building the Kubernetes network.""" #: Use Calico network policies. See `differences between Azure and Calico policies #: `_ @@ -390,6 +397,7 @@ class NetworkPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: for more information. AZURE = "azure" + class OSDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more @@ -406,22 +414,23 @@ class OSDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: provides lower read/write latency, along with faster node scaling and cluster upgrades. EPHEMERAL = "Ephemeral" + class OSSKU(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Specifies an OS SKU. This value must not be specified if OSType is Windows. - """ + """Specifies an OS SKU. This value must not be specified if OSType is Windows.""" UBUNTU = "Ubuntu" CBL_MARINER = "CBLMariner" + class OSType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The operating system type. The default is Linux. - """ + """The operating system type. The default is Linux.""" #: Use Linux. LINUX = "Linux" #: Use Windows. WINDOWS = "Windows" + class OutboundType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """This can only be set at cluster creation time and cannot be changed later. For more information see `egress outbound type `_. @@ -442,23 +451,25 @@ class OutboundType(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: advanced scenario and requires proper network configuration. USER_ASSIGNED_NAT_GATEWAY = "userAssignedNATGateway" + class PrivateEndpointConnectionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The current provisioning state. - """ + """The current provisioning state.""" SUCCEEDED = "Succeeded" CREATING = "Creating" DELETING = "Deleting" FAILED = "Failed" + class PublicNetworkAccess(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Default value is 'Enabled' (case insensitive). Could be set to 'Disabled' to enable private - cluster + cluster. """ ENABLED = "Enabled" DISABLED = "Disabled" + class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """For more information see `use managed identities in AKS `_. @@ -475,6 +486,7 @@ class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Do not use a managed identity for the Managed Cluster, service principal will be used instead. NONE = "None" + class ScaleDownMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Describes how VMs are added to or removed from Agent Pools. See `billing states `_. @@ -486,10 +498,11 @@ class ScaleDownMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: during scale down. DEALLOCATE = "Deallocate" + class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The eviction policy specifies what to do with the VM when it is evicted. The default is Delete. For more information about eviction see `spot VMs - `_ + `_. """ #: Nodes in the underlying Scale Set of the node pool are deleted when they're evicted. @@ -499,9 +512,9 @@ class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: cause issues with cluster scaling or upgrading. DEALLOCATE = "Deallocate" + class ScaleSetPriority(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The Virtual Machine Scale Set priority. - """ + """The Virtual Machine Scale Set priority.""" #: Spot priority VMs will be used. There is no SLA for spot nodes. See `spot on AKS #: `_ for more information. @@ -509,13 +522,14 @@ class ScaleSetPriority(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Regular VMs will be used. REGULAR = "Regular" + class SnapshotType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of a snapshot. The default is NodePool. - """ + """The type of a snapshot. The default is NodePool.""" #: The snapshot is a snapshot of a node pool. NODE_POOL = "NodePool" + class UpgradeChannel(str, Enum, metaclass=CaseInsensitiveEnumMeta): """For more information see `setting the AKS cluster auto-upgrade channel `_. @@ -546,9 +560,9 @@ class UpgradeChannel(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Disables auto-upgrades and keeps the cluster at its current version of Kubernetes. NONE = "none" + class WeekDay(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The weekday enum. - """ + """The weekday enum.""" SUNDAY = "Sunday" MONDAY = "Monday" @@ -558,9 +572,9 @@ class WeekDay(str, Enum, metaclass=CaseInsensitiveEnumMeta): FRIDAY = "Friday" SATURDAY = "Saturday" + class WorkloadRuntime(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Determines the type of workload a node can run. - """ + """Determines the type of workload a node can run.""" #: Nodes will use Kubelet to run standard OCI container workloads. OCI_CONTAINER = "OCIContainer" diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/models/_models_py3.py index 91b6add02111..4e970b8bccdf 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/models/_models_py3.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/models/_models_py3.py @@ -1,4 +1,5 @@ # coding=utf-8 +# pylint: disable=too-many-lines # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -9,14 +10,14 @@ import datetime from typing import Dict, List, Optional, TYPE_CHECKING, Union -import msrest.serialization +from ... import _serialization if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - import __init__ as _models + from .. import models as _models -class SubResource(msrest.serialization.Model): +class SubResource(_serialization.Model): """Reference to another subresource. Variables are only populated by the server, and will be ignored when sending a request. @@ -31,30 +32,26 @@ class SubResource(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(SubResource, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.id = None self.name = None self.type = None -class AgentPool(SubResource): +class AgentPool(SubResource): # pylint: disable=too-many-instance-attributes """Agent Pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -82,14 +79,14 @@ class AgentPool(SubResource): larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2021_08_01.models.OSDiskType :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data - root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2021_08_01.models.KubeletDiskType :ivar workload_runtime: Determines the type of workload a node can run. Known values are: - "OCIContainer", "WasmWasi". + "OCIContainer" and "WasmWasi". :vartype workload_runtime: str or ~azure.mgmt.containerservice.v2021_08_01.models.WorkloadRuntime :ivar vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and used. @@ -103,11 +100,11 @@ class AgentPool(SubResource): :vartype pod_subnet_id: str :ivar max_pods: The maximum number of pods that can run on a node. :vartype max_pods: int - :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2021_08_01.models.OSType :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known - values are: "Ubuntu", "CBLMariner". + values are: "Ubuntu" and "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2021_08_01.models.OSSKU :ivar max_count: The maximum number of nodes for auto-scaling. :vartype max_count: int @@ -116,15 +113,15 @@ class AgentPool(SubResource): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it - defaults to Delete. Known values are: "Delete", "Deallocate". + defaults to Delete. Known values are: "Delete" and "Deallocate". :vartype scale_down_mode: str or ~azure.mgmt.containerservice.v2021_08_01.models.ScaleDownMode - :ivar type_properties_type: The type of Agent Pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + :ivar type_properties_type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets" + and "AvailabilitySet". :vartype type_properties_type: str or ~azure.mgmt.containerservice.v2021_08_01.models.AgentPoolType :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :vartype mode: str or ~azure.mgmt.containerservice.v2021_08_01.models.AgentPoolMode :ivar orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -156,20 +153,18 @@ class AgentPool(SubResource): /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default - is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + is 'Regular'. Known values are: "Spot" and "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2021_08_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2021_08_01.models.ScaleSetEvictionPolicy :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :vartype spot_max_price: float - :ivar tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :ivar tags: The tags to be persisted on the agent pool virtual machine scale set. :vartype tags: dict[str, str] :ivar node_labels: The node labels to be persisted across all nodes in agent pool. :vartype node_labels: dict[str, str] @@ -193,7 +188,7 @@ class AgentPool(SubResource): for more details. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2021_08_01.models.GPUInstanceProfile :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the node pool @@ -202,61 +197,61 @@ class AgentPool(SubResource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'os_disk_size_gb': {'maximum': 2048, 'minimum': 0}, - 'node_image_version': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'power_state': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "os_disk_size_gb": {"maximum": 2048, "minimum": 0}, + "node_image_version": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "power_state": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'count': {'key': 'properties.count', 'type': 'int'}, - 'vm_size': {'key': 'properties.vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'properties.osDiskSizeGB', 'type': 'int'}, - 'os_disk_type': {'key': 'properties.osDiskType', 'type': 'str'}, - 'kubelet_disk_type': {'key': 'properties.kubeletDiskType', 'type': 'str'}, - 'workload_runtime': {'key': 'properties.workloadRuntime', 'type': 'str'}, - 'vnet_subnet_id': {'key': 'properties.vnetSubnetID', 'type': 'str'}, - 'pod_subnet_id': {'key': 'properties.podSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'properties.maxPods', 'type': 'int'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'os_sku': {'key': 'properties.osSKU', 'type': 'str'}, - 'max_count': {'key': 'properties.maxCount', 'type': 'int'}, - 'min_count': {'key': 'properties.minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'properties.enableAutoScaling', 'type': 'bool'}, - 'scale_down_mode': {'key': 'properties.scaleDownMode', 'type': 'str'}, - 'type_properties_type': {'key': 'properties.type', 'type': 'str'}, - 'mode': {'key': 'properties.mode', 'type': 'str'}, - 'orchestrator_version': {'key': 'properties.orchestratorVersion', 'type': 'str'}, - 'node_image_version': {'key': 'properties.nodeImageVersion', 'type': 'str'}, - 'upgrade_settings': {'key': 'properties.upgradeSettings', 'type': 'AgentPoolUpgradeSettings'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'power_state': {'key': 'properties.powerState', 'type': 'PowerState'}, - 'availability_zones': {'key': 'properties.availabilityZones', 'type': '[str]'}, - 'enable_node_public_ip': {'key': 'properties.enableNodePublicIP', 'type': 'bool'}, - 'node_public_ip_prefix_id': {'key': 'properties.nodePublicIPPrefixID', 'type': 'str'}, - 'scale_set_priority': {'key': 'properties.scaleSetPriority', 'type': 'str'}, - 'scale_set_eviction_policy': {'key': 'properties.scaleSetEvictionPolicy', 'type': 'str'}, - 'spot_max_price': {'key': 'properties.spotMaxPrice', 'type': 'float'}, - 'tags': {'key': 'properties.tags', 'type': '{str}'}, - 'node_labels': {'key': 'properties.nodeLabels', 'type': '{str}'}, - 'node_taints': {'key': 'properties.nodeTaints', 'type': '[str]'}, - 'proximity_placement_group_id': {'key': 'properties.proximityPlacementGroupID', 'type': 'str'}, - 'kubelet_config': {'key': 'properties.kubeletConfig', 'type': 'KubeletConfig'}, - 'linux_os_config': {'key': 'properties.linuxOSConfig', 'type': 'LinuxOSConfig'}, - 'enable_encryption_at_host': {'key': 'properties.enableEncryptionAtHost', 'type': 'bool'}, - 'enable_ultra_ssd': {'key': 'properties.enableUltraSSD', 'type': 'bool'}, - 'enable_fips': {'key': 'properties.enableFIPS', 'type': 'bool'}, - 'gpu_instance_profile': {'key': 'properties.gpuInstanceProfile', 'type': 'str'}, - 'creation_data': {'key': 'properties.creationData', 'type': 'CreationData'}, - } - - def __init__( + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "count": {"key": "properties.count", "type": "int"}, + "vm_size": {"key": "properties.vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "properties.osDiskSizeGB", "type": "int"}, + "os_disk_type": {"key": "properties.osDiskType", "type": "str"}, + "kubelet_disk_type": {"key": "properties.kubeletDiskType", "type": "str"}, + "workload_runtime": {"key": "properties.workloadRuntime", "type": "str"}, + "vnet_subnet_id": {"key": "properties.vnetSubnetID", "type": "str"}, + "pod_subnet_id": {"key": "properties.podSubnetID", "type": "str"}, + "max_pods": {"key": "properties.maxPods", "type": "int"}, + "os_type": {"key": "properties.osType", "type": "str"}, + "os_sku": {"key": "properties.osSKU", "type": "str"}, + "max_count": {"key": "properties.maxCount", "type": "int"}, + "min_count": {"key": "properties.minCount", "type": "int"}, + "enable_auto_scaling": {"key": "properties.enableAutoScaling", "type": "bool"}, + "scale_down_mode": {"key": "properties.scaleDownMode", "type": "str"}, + "type_properties_type": {"key": "properties.type", "type": "str"}, + "mode": {"key": "properties.mode", "type": "str"}, + "orchestrator_version": {"key": "properties.orchestratorVersion", "type": "str"}, + "node_image_version": {"key": "properties.nodeImageVersion", "type": "str"}, + "upgrade_settings": {"key": "properties.upgradeSettings", "type": "AgentPoolUpgradeSettings"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "power_state": {"key": "properties.powerState", "type": "PowerState"}, + "availability_zones": {"key": "properties.availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "properties.enableNodePublicIP", "type": "bool"}, + "node_public_ip_prefix_id": {"key": "properties.nodePublicIPPrefixID", "type": "str"}, + "scale_set_priority": {"key": "properties.scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "properties.scaleSetEvictionPolicy", "type": "str"}, + "spot_max_price": {"key": "properties.spotMaxPrice", "type": "float"}, + "tags": {"key": "properties.tags", "type": "{str}"}, + "node_labels": {"key": "properties.nodeLabels", "type": "{str}"}, + "node_taints": {"key": "properties.nodeTaints", "type": "[str]"}, + "proximity_placement_group_id": {"key": "properties.proximityPlacementGroupID", "type": "str"}, + "kubelet_config": {"key": "properties.kubeletConfig", "type": "KubeletConfig"}, + "linux_os_config": {"key": "properties.linuxOSConfig", "type": "LinuxOSConfig"}, + "enable_encryption_at_host": {"key": "properties.enableEncryptionAtHost", "type": "bool"}, + "enable_ultra_ssd": {"key": "properties.enableUltraSSD", "type": "bool"}, + "enable_fips": {"key": "properties.enableFIPS", "type": "bool"}, + "gpu_instance_profile": {"key": "properties.gpuInstanceProfile", "type": "str"}, + "creation_data": {"key": "properties.creationData", "type": "CreationData"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, count: Optional[int] = None, @@ -268,7 +263,7 @@ def __init__( vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, @@ -281,9 +276,9 @@ def __init__( availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", - spot_max_price: Optional[float] = -1, + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", + spot_max_price: float = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, @@ -314,14 +309,14 @@ def __init__( larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2021_08_01.models.OSDiskType :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime - data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + data root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2021_08_01.models.KubeletDiskType :keyword workload_runtime: Determines the type of workload a node can run. Known values are: - "OCIContainer", "WasmWasi". + "OCIContainer" and "WasmWasi". :paramtype workload_runtime: str or ~azure.mgmt.containerservice.v2021_08_01.models.WorkloadRuntime :keyword vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and @@ -335,11 +330,11 @@ def __init__( :paramtype pod_subnet_id: str :keyword max_pods: The maximum number of pods that can run on a node. :paramtype max_pods: int - :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2021_08_01.models.OSType :keyword os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Known values are: "Ubuntu", "CBLMariner". + Known values are: "Ubuntu" and "CBLMariner". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2021_08_01.models.OSSKU :keyword max_count: The maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -348,16 +343,16 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, - it defaults to Delete. Known values are: "Delete", "Deallocate". + it defaults to Delete. Known values are: "Delete" and "Deallocate". :paramtype scale_down_mode: str or ~azure.mgmt.containerservice.v2021_08_01.models.ScaleDownMode :keyword type_properties_type: The type of Agent Pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type_properties_type: str or ~azure.mgmt.containerservice.v2021_08_01.models.AgentPoolType :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2021_08_01.models.AgentPoolMode :keyword orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -383,20 +378,18 @@ def __init__( /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the - default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + default is 'Regular'. Known values are: "Spot" and "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2021_08_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2021_08_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :paramtype spot_max_price: float - :keyword tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :keyword tags: The tags to be persisted on the agent pool virtual machine scale set. :paramtype tags: dict[str, str] :keyword node_labels: The node labels to be persisted across all nodes in agent pool. :paramtype node_labels: dict[str, str] @@ -420,7 +413,7 @@ def __init__( for more details. :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance - profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2021_08_01.models.GPUInstanceProfile @@ -428,7 +421,7 @@ def __init__( pool will be created/upgraded using a snapshot. :paramtype creation_data: ~azure.mgmt.containerservice.v2021_08_01.models.CreationData """ - super(AgentPool, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.vm_size = vm_size self.os_disk_size_gb = os_disk_size_gb @@ -470,7 +463,7 @@ def __init__( self.creation_data = creation_data -class AgentPoolAvailableVersions(msrest.serialization.Model): +class AgentPoolAvailableVersions(_serialization.Model): """The list of available versions for an agent pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -487,16 +480,19 @@ class AgentPoolAvailableVersions(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'agent_pool_versions': {'key': 'properties.agentPoolVersions', 'type': '[AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "agent_pool_versions": { + "key": "properties.agentPoolVersions", + "type": "[AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem]", + }, } def __init__( @@ -510,14 +506,14 @@ def __init__( :paramtype agent_pool_versions: list[~azure.mgmt.containerservice.v2021_08_01.models.AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem] """ - super(AgentPoolAvailableVersions, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None self.agent_pool_versions = agent_pool_versions -class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(msrest.serialization.Model): +class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(_serialization.Model): """AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem. :ivar default: Whether this version is the default agent pool version. @@ -529,9 +525,9 @@ class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(msrest.serializa """ _attribute_map = { - 'default': {'key': 'default', 'type': 'bool'}, - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "default": {"key": "default", "type": "bool"}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } def __init__( @@ -550,13 +546,13 @@ def __init__( :keyword is_preview: Whether Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.default = default self.kubernetes_version = kubernetes_version self.is_preview = is_preview -class AgentPoolListResult(msrest.serialization.Model): +class AgentPoolListResult(_serialization.Model): """The response from the List Agent Pools operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -568,30 +564,25 @@ class AgentPoolListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[AgentPool]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[AgentPool]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.AgentPool"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.AgentPool"]] = None, **kwargs): """ :keyword value: The list of agent pools. :paramtype value: list[~azure.mgmt.containerservice.v2021_08_01.models.AgentPool] """ - super(AgentPoolListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class AgentPoolUpgradeProfile(msrest.serialization.Model): +class AgentPoolUpgradeProfile(_serialization.Model): """The list of available upgrades for an agent pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -604,10 +595,10 @@ class AgentPoolUpgradeProfile(msrest.serialization.Model): :vartype name: str :ivar type: The type of the agent pool upgrade profile. :vartype type: str - :ivar kubernetes_version: Required. The Kubernetes version (major.minor.patch). + :ivar kubernetes_version: The Kubernetes version (major.minor.patch). Required. :vartype kubernetes_version: str - :ivar os_type: Required. The operating system type. The default is Linux. Known values are: - "Linux", "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2021_08_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -617,21 +608,21 @@ class AgentPoolUpgradeProfile(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kubernetes_version': {'required': True}, - 'os_type': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "kubernetes_version": {"required": True}, + "os_type": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'kubernetes_version': {'key': 'properties.kubernetesVersion', 'type': 'str'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'upgrades': {'key': 'properties.upgrades', 'type': '[AgentPoolUpgradeProfilePropertiesUpgradesItem]'}, - 'latest_node_image_version': {'key': 'properties.latestNodeImageVersion', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "os_type": {"key": "properties.osType", "type": "str"}, + "upgrades": {"key": "properties.upgrades", "type": "[AgentPoolUpgradeProfilePropertiesUpgradesItem]"}, + "latest_node_image_version": {"key": "properties.latestNodeImageVersion", "type": "str"}, } def __init__( @@ -644,10 +635,10 @@ def __init__( **kwargs ): """ - :keyword kubernetes_version: Required. The Kubernetes version (major.minor.patch). + :keyword kubernetes_version: The Kubernetes version (major.minor.patch). Required. :paramtype kubernetes_version: str - :keyword os_type: Required. The operating system type. The default is Linux. Known values are: - "Linux", "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2021_08_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: @@ -655,7 +646,7 @@ def __init__( :keyword latest_node_image_version: The latest AKS supported node image version. :paramtype latest_node_image_version: str """ - super(AgentPoolUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -665,7 +656,7 @@ def __init__( self.latest_node_image_version = latest_node_image_version -class AgentPoolUpgradeProfilePropertiesUpgradesItem(msrest.serialization.Model): +class AgentPoolUpgradeProfilePropertiesUpgradesItem(_serialization.Model): """AgentPoolUpgradeProfilePropertiesUpgradesItem. :ivar kubernetes_version: The Kubernetes version (major.minor.patch). @@ -675,29 +666,23 @@ class AgentPoolUpgradeProfilePropertiesUpgradesItem(msrest.serialization.Model): """ _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } - def __init__( - self, - *, - kubernetes_version: Optional[str] = None, - is_preview: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, kubernetes_version: Optional[str] = None, is_preview: Optional[bool] = None, **kwargs): """ :keyword kubernetes_version: The Kubernetes version (major.minor.patch). :paramtype kubernetes_version: str :keyword is_preview: Whether the Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(AgentPoolUpgradeProfilePropertiesUpgradesItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.is_preview = is_preview -class AgentPoolUpgradeSettings(msrest.serialization.Model): +class AgentPoolUpgradeSettings(_serialization.Model): """Settings for upgrading an agentpool. :ivar max_surge: This can either be set to an integer (e.g. '5') or a percentage (e.g. '50%'). @@ -709,15 +694,10 @@ class AgentPoolUpgradeSettings(msrest.serialization.Model): """ _attribute_map = { - 'max_surge': {'key': 'maxSurge', 'type': 'str'}, + "max_surge": {"key": "maxSurge", "type": "str"}, } - def __init__( - self, - *, - max_surge: Optional[str] = None, - **kwargs - ): + def __init__(self, *, max_surge: Optional[str] = None, **kwargs): """ :keyword max_surge: This can either be set to an integer (e.g. '5') or a percentage (e.g. '50%'). If a percentage is specified, it is the percentage of the total agent pool size at the @@ -726,11 +706,11 @@ def __init__( https://docs.microsoft.com/azure/aks/upgrade-cluster#customize-node-surge-upgrade. :paramtype max_surge: str """ - super(AgentPoolUpgradeSettings, self).__init__(**kwargs) + super().__init__(**kwargs) self.max_surge = max_surge -class CloudErrorBody(msrest.serialization.Model): +class CloudErrorBody(_serialization.Model): """An error response from the Container service. :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed @@ -747,10 +727,10 @@ class CloudErrorBody(msrest.serialization.Model): """ _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[CloudErrorBody]"}, } def __init__( @@ -775,87 +755,76 @@ def __init__( :keyword details: A list of additional details about the error. :paramtype details: list[~azure.mgmt.containerservice.v2021_08_01.models.CloudErrorBody] """ - super(CloudErrorBody, self).__init__(**kwargs) + super().__init__(**kwargs) self.code = code self.message = message self.target = target self.details = details -class ContainerServiceDiagnosticsProfile(msrest.serialization.Model): +class ContainerServiceDiagnosticsProfile(_serialization.Model): """Profile for diagnostics on the container service cluster. All required parameters must be populated in order to send to Azure. - :ivar vm_diagnostics: Required. Profile for diagnostics on the container service VMs. + :ivar vm_diagnostics: Profile for diagnostics on the container service VMs. Required. :vartype vm_diagnostics: ~azure.mgmt.containerservice.v2021_08_01.models.ContainerServiceVMDiagnostics """ _validation = { - 'vm_diagnostics': {'required': True}, + "vm_diagnostics": {"required": True}, } _attribute_map = { - 'vm_diagnostics': {'key': 'vmDiagnostics', 'type': 'ContainerServiceVMDiagnostics'}, + "vm_diagnostics": {"key": "vmDiagnostics", "type": "ContainerServiceVMDiagnostics"}, } - def __init__( - self, - *, - vm_diagnostics: "_models.ContainerServiceVMDiagnostics", - **kwargs - ): + def __init__(self, *, vm_diagnostics: "_models.ContainerServiceVMDiagnostics", **kwargs): """ - :keyword vm_diagnostics: Required. Profile for diagnostics on the container service VMs. + :keyword vm_diagnostics: Profile for diagnostics on the container service VMs. Required. :paramtype vm_diagnostics: ~azure.mgmt.containerservice.v2021_08_01.models.ContainerServiceVMDiagnostics """ - super(ContainerServiceDiagnosticsProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.vm_diagnostics = vm_diagnostics -class ContainerServiceLinuxProfile(msrest.serialization.Model): +class ContainerServiceLinuxProfile(_serialization.Model): """Profile for Linux VMs in the container service cluster. All required parameters must be populated in order to send to Azure. - :ivar admin_username: Required. The administrator username to use for Linux VMs. + :ivar admin_username: The administrator username to use for Linux VMs. Required. :vartype admin_username: str - :ivar ssh: Required. The SSH configuration for Linux-based VMs running on Azure. + :ivar ssh: The SSH configuration for Linux-based VMs running on Azure. Required. :vartype ssh: ~azure.mgmt.containerservice.v2021_08_01.models.ContainerServiceSshConfiguration """ _validation = { - 'admin_username': {'required': True, 'pattern': r'^[A-Za-z][-A-Za-z0-9_]*$'}, - 'ssh': {'required': True}, + "admin_username": {"required": True, "pattern": r"^[A-Za-z][-A-Za-z0-9_]*$"}, + "ssh": {"required": True}, } _attribute_map = { - 'admin_username': {'key': 'adminUsername', 'type': 'str'}, - 'ssh': {'key': 'ssh', 'type': 'ContainerServiceSshConfiguration'}, + "admin_username": {"key": "adminUsername", "type": "str"}, + "ssh": {"key": "ssh", "type": "ContainerServiceSshConfiguration"}, } - def __init__( - self, - *, - admin_username: str, - ssh: "_models.ContainerServiceSshConfiguration", - **kwargs - ): + def __init__(self, *, admin_username: str, ssh: "_models.ContainerServiceSshConfiguration", **kwargs): """ - :keyword admin_username: Required. The administrator username to use for Linux VMs. + :keyword admin_username: The administrator username to use for Linux VMs. Required. :paramtype admin_username: str - :keyword ssh: Required. The SSH configuration for Linux-based VMs running on Azure. + :keyword ssh: The SSH configuration for Linux-based VMs running on Azure. Required. :paramtype ssh: ~azure.mgmt.containerservice.v2021_08_01.models.ContainerServiceSshConfiguration """ - super(ContainerServiceLinuxProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.admin_username = admin_username self.ssh = ssh -class ContainerServiceMasterProfile(msrest.serialization.Model): +class ContainerServiceMasterProfile(_serialization.Model): """Profile for the container service master. Variables are only populated by the server, and will be ignored when sending a request. @@ -863,11 +832,11 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar count: Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, - and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". + and 5. The default value is 1. Known values are: 1, 3, and 5. :vartype count: int or ~azure.mgmt.containerservice.v2021_08_01.models.Count - :ivar dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. + :ivar dns_prefix: DNS prefix to be used to create the FQDN for the master pool. Required. :vartype dns_prefix: str - :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + :ivar vm_size: Size of agent VMs. Required. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -904,7 +873,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :vartype vm_size: str or ~azure.mgmt.containerservice.v2021_08_01.models.ContainerServiceVMSizeTypes :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine @@ -918,7 +887,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): :vartype first_consecutive_static_ip: str :ivar storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount" and "ManagedDisks". :vartype storage_profile: str or ~azure.mgmt.containerservice.v2021_08_01.models.ContainerServiceStorageProfileTypes :ivar fqdn: FQDN for the master pool. @@ -926,21 +895,21 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): """ _validation = { - 'dns_prefix': {'required': True}, - 'vm_size': {'required': True}, - 'os_disk_size_gb': {'maximum': 2048, 'minimum': 0}, - 'fqdn': {'readonly': True}, + "dns_prefix": {"required": True}, + "vm_size": {"required": True}, + "os_disk_size_gb": {"maximum": 2048, "minimum": 0}, + "fqdn": {"readonly": True}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'dns_prefix': {'key': 'dnsPrefix', 'type': 'str'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'first_consecutive_static_ip': {'key': 'firstConsecutiveStaticIP', 'type': 'str'}, - 'storage_profile': {'key': 'storageProfile', 'type': 'str'}, - 'fqdn': {'key': 'fqdn', 'type': 'str'}, + "count": {"key": "count", "type": "int"}, + "dns_prefix": {"key": "dnsPrefix", "type": "str"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "first_consecutive_static_ip": {"key": "firstConsecutiveStaticIP", "type": "str"}, + "storage_profile": {"key": "storageProfile", "type": "str"}, + "fqdn": {"key": "fqdn", "type": "str"}, } def __init__( @@ -948,20 +917,20 @@ def __init__( *, dns_prefix: str, vm_size: Union[str, "_models.ContainerServiceVMSizeTypes"], - count: Optional[Union[int, "_models.Count"]] = 1, + count: Union[int, "_models.Count"] = 1, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, - first_consecutive_static_ip: Optional[str] = "10.240.255.5", + first_consecutive_static_ip: str = "10.240.255.5", storage_profile: Optional[Union[str, "_models.ContainerServiceStorageProfileTypes"]] = None, **kwargs ): """ :keyword count: Number of masters (VMs) in the container service cluster. Allowed values are 1, - 3, and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". + 3, and 5. The default value is 1. Known values are: 1, 3, and 5. :paramtype count: int or ~azure.mgmt.containerservice.v2021_08_01.models.Count - :keyword dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. + :keyword dns_prefix: DNS prefix to be used to create the FQDN for the master pool. Required. :paramtype dns_prefix: str - :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + :keyword vm_size: Size of agent VMs. Required. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -998,7 +967,7 @@ def __init__( "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :paramtype vm_size: str or ~azure.mgmt.containerservice.v2021_08_01.models.ContainerServiceVMSizeTypes :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every @@ -1012,11 +981,11 @@ def __init__( :paramtype first_consecutive_static_ip: str :keyword storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount" and "ManagedDisks". :paramtype storage_profile: str or ~azure.mgmt.containerservice.v2021_08_01.models.ContainerServiceStorageProfileTypes """ - super(ContainerServiceMasterProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.dns_prefix = dns_prefix self.vm_size = vm_size @@ -1027,17 +996,17 @@ def __init__( self.fqdn = None -class ContainerServiceNetworkProfile(msrest.serialization.Model): +class ContainerServiceNetworkProfile(_serialization.Model): # pylint: disable=too-many-instance-attributes """Profile of network configuration. :ivar network_plugin: Network plugin used for building the Kubernetes network. Known values - are: "azure", "kubenet". Default value: "kubenet". + are: "azure" and "kubenet". :vartype network_plugin: str or ~azure.mgmt.containerservice.v2021_08_01.models.NetworkPlugin :ivar network_policy: Network policy used for building the Kubernetes network. Known values - are: "calico", "azure". + are: "calico" and "azure". :vartype network_policy: str or ~azure.mgmt.containerservice.v2021_08_01.models.NetworkPolicy :ivar network_mode: This cannot be specified if networkPlugin is anything other than 'azure'. - Known values are: "transparent", "bridge". + Known values are: "transparent" and "bridge". :vartype network_mode: str or ~azure.mgmt.containerservice.v2021_08_01.models.NetworkMode :ivar pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :vartype pod_cidr: str @@ -1053,12 +1022,11 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): :ivar outbound_type: This can only be set at cluster creation time and cannot be changed later. For more information see `egress outbound type `_. Known values are: "loadBalancer", - "userDefinedRouting", "managedNATGateway", "userAssignedNATGateway". Default value: - "loadBalancer". + "userDefinedRouting", "managedNATGateway", and "userAssignedNATGateway". :vartype outbound_type: str or ~azure.mgmt.containerservice.v2021_08_01.models.OutboundType :ivar load_balancer_sku: The default is 'standard'. See `Azure Load Balancer SKUs `_ for more information about the - differences between load balancer SKUs. Known values are: "standard", "basic". + differences between load balancer SKUs. Known values are: "standard" and "basic". :vartype load_balancer_sku: str or ~azure.mgmt.containerservice.v2021_08_01.models.LoadBalancerSku :ivar load_balancer_profile: Profile of the cluster load balancer. @@ -1070,37 +1038,39 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): """ _validation = { - 'pod_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, - 'service_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, - 'dns_service_ip': {'pattern': r'^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$'}, - 'docker_bridge_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, + "pod_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, + "service_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, + "dns_service_ip": { + "pattern": r"^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$" + }, + "docker_bridge_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, } _attribute_map = { - 'network_plugin': {'key': 'networkPlugin', 'type': 'str'}, - 'network_policy': {'key': 'networkPolicy', 'type': 'str'}, - 'network_mode': {'key': 'networkMode', 'type': 'str'}, - 'pod_cidr': {'key': 'podCidr', 'type': 'str'}, - 'service_cidr': {'key': 'serviceCidr', 'type': 'str'}, - 'dns_service_ip': {'key': 'dnsServiceIP', 'type': 'str'}, - 'docker_bridge_cidr': {'key': 'dockerBridgeCidr', 'type': 'str'}, - 'outbound_type': {'key': 'outboundType', 'type': 'str'}, - 'load_balancer_sku': {'key': 'loadBalancerSku', 'type': 'str'}, - 'load_balancer_profile': {'key': 'loadBalancerProfile', 'type': 'ManagedClusterLoadBalancerProfile'}, - 'nat_gateway_profile': {'key': 'natGatewayProfile', 'type': 'ManagedClusterNATGatewayProfile'}, + "network_plugin": {"key": "networkPlugin", "type": "str"}, + "network_policy": {"key": "networkPolicy", "type": "str"}, + "network_mode": {"key": "networkMode", "type": "str"}, + "pod_cidr": {"key": "podCidr", "type": "str"}, + "service_cidr": {"key": "serviceCidr", "type": "str"}, + "dns_service_ip": {"key": "dnsServiceIP", "type": "str"}, + "docker_bridge_cidr": {"key": "dockerBridgeCidr", "type": "str"}, + "outbound_type": {"key": "outboundType", "type": "str"}, + "load_balancer_sku": {"key": "loadBalancerSku", "type": "str"}, + "load_balancer_profile": {"key": "loadBalancerProfile", "type": "ManagedClusterLoadBalancerProfile"}, + "nat_gateway_profile": {"key": "natGatewayProfile", "type": "ManagedClusterNATGatewayProfile"}, } def __init__( self, *, - network_plugin: Optional[Union[str, "_models.NetworkPlugin"]] = "kubenet", + network_plugin: Union[str, "_models.NetworkPlugin"] = "kubenet", network_policy: Optional[Union[str, "_models.NetworkPolicy"]] = None, network_mode: Optional[Union[str, "_models.NetworkMode"]] = None, - pod_cidr: Optional[str] = "10.244.0.0/16", - service_cidr: Optional[str] = "10.0.0.0/16", - dns_service_ip: Optional[str] = "10.0.0.10", - docker_bridge_cidr: Optional[str] = "172.17.0.1/16", - outbound_type: Optional[Union[str, "_models.OutboundType"]] = "loadBalancer", + pod_cidr: str = "10.244.0.0/16", + service_cidr: str = "10.0.0.0/16", + dns_service_ip: str = "10.0.0.10", + docker_bridge_cidr: str = "172.17.0.1/16", + outbound_type: Union[str, "_models.OutboundType"] = "loadBalancer", load_balancer_sku: Optional[Union[str, "_models.LoadBalancerSku"]] = None, load_balancer_profile: Optional["_models.ManagedClusterLoadBalancerProfile"] = None, nat_gateway_profile: Optional["_models.ManagedClusterNATGatewayProfile"] = None, @@ -1108,13 +1078,13 @@ def __init__( ): """ :keyword network_plugin: Network plugin used for building the Kubernetes network. Known values - are: "azure", "kubenet". Default value: "kubenet". + are: "azure" and "kubenet". :paramtype network_plugin: str or ~azure.mgmt.containerservice.v2021_08_01.models.NetworkPlugin :keyword network_policy: Network policy used for building the Kubernetes network. Known values - are: "calico", "azure". + are: "calico" and "azure". :paramtype network_policy: str or ~azure.mgmt.containerservice.v2021_08_01.models.NetworkPolicy :keyword network_mode: This cannot be specified if networkPlugin is anything other than - 'azure'. Known values are: "transparent", "bridge". + 'azure'. Known values are: "transparent" and "bridge". :paramtype network_mode: str or ~azure.mgmt.containerservice.v2021_08_01.models.NetworkMode :keyword pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :paramtype pod_cidr: str @@ -1130,12 +1100,11 @@ def __init__( :keyword outbound_type: This can only be set at cluster creation time and cannot be changed later. For more information see `egress outbound type `_. Known values are: "loadBalancer", - "userDefinedRouting", "managedNATGateway", "userAssignedNATGateway". Default value: - "loadBalancer". + "userDefinedRouting", "managedNATGateway", and "userAssignedNATGateway". :paramtype outbound_type: str or ~azure.mgmt.containerservice.v2021_08_01.models.OutboundType :keyword load_balancer_sku: The default is 'standard'. See `Azure Load Balancer SKUs `_ for more information about the - differences between load balancer SKUs. Known values are: "standard", "basic". + differences between load balancer SKUs. Known values are: "standard" and "basic". :paramtype load_balancer_sku: str or ~azure.mgmt.containerservice.v2021_08_01.models.LoadBalancerSku :keyword load_balancer_profile: Profile of the cluster load balancer. @@ -1145,7 +1114,7 @@ def __init__( :paramtype nat_gateway_profile: ~azure.mgmt.containerservice.v2021_08_01.models.ManagedClusterNATGatewayProfile """ - super(ContainerServiceNetworkProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.network_plugin = network_plugin self.network_policy = network_policy self.network_mode = network_mode @@ -1159,113 +1128,98 @@ def __init__( self.nat_gateway_profile = nat_gateway_profile -class ContainerServiceSshConfiguration(msrest.serialization.Model): +class ContainerServiceSshConfiguration(_serialization.Model): """SSH configuration for Linux-based VMs running on Azure. All required parameters must be populated in order to send to Azure. - :ivar public_keys: Required. The list of SSH public keys used to authenticate with Linux-based - VMs. A maximum of 1 key may be specified. + :ivar public_keys: The list of SSH public keys used to authenticate with Linux-based VMs. A + maximum of 1 key may be specified. Required. :vartype public_keys: list[~azure.mgmt.containerservice.v2021_08_01.models.ContainerServiceSshPublicKey] """ _validation = { - 'public_keys': {'required': True}, + "public_keys": {"required": True}, } _attribute_map = { - 'public_keys': {'key': 'publicKeys', 'type': '[ContainerServiceSshPublicKey]'}, + "public_keys": {"key": "publicKeys", "type": "[ContainerServiceSshPublicKey]"}, } - def __init__( - self, - *, - public_keys: List["_models.ContainerServiceSshPublicKey"], - **kwargs - ): + def __init__(self, *, public_keys: List["_models.ContainerServiceSshPublicKey"], **kwargs): """ - :keyword public_keys: Required. The list of SSH public keys used to authenticate with - Linux-based VMs. A maximum of 1 key may be specified. + :keyword public_keys: The list of SSH public keys used to authenticate with Linux-based VMs. A + maximum of 1 key may be specified. Required. :paramtype public_keys: list[~azure.mgmt.containerservice.v2021_08_01.models.ContainerServiceSshPublicKey] """ - super(ContainerServiceSshConfiguration, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_keys = public_keys -class ContainerServiceSshPublicKey(msrest.serialization.Model): +class ContainerServiceSshPublicKey(_serialization.Model): """Contains information about SSH certificate public key data. All required parameters must be populated in order to send to Azure. - :ivar key_data: Required. Certificate public key used to authenticate with VMs through SSH. The - certificate must be in PEM format with or without headers. + :ivar key_data: Certificate public key used to authenticate with VMs through SSH. The + certificate must be in PEM format with or without headers. Required. :vartype key_data: str """ _validation = { - 'key_data': {'required': True}, + "key_data": {"required": True}, } _attribute_map = { - 'key_data': {'key': 'keyData', 'type': 'str'}, + "key_data": {"key": "keyData", "type": "str"}, } - def __init__( - self, - *, - key_data: str, - **kwargs - ): + def __init__(self, *, key_data: str, **kwargs): """ - :keyword key_data: Required. Certificate public key used to authenticate with VMs through SSH. - The certificate must be in PEM format with or without headers. + :keyword key_data: Certificate public key used to authenticate with VMs through SSH. The + certificate must be in PEM format with or without headers. Required. :paramtype key_data: str """ - super(ContainerServiceSshPublicKey, self).__init__(**kwargs) + super().__init__(**kwargs) self.key_data = key_data -class ContainerServiceVMDiagnostics(msrest.serialization.Model): +class ContainerServiceVMDiagnostics(_serialization.Model): """Profile for diagnostics on the container service VMs. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar enabled: Required. Whether the VM diagnostic agent is provisioned on the VM. + :ivar enabled: Whether the VM diagnostic agent is provisioned on the VM. Required. :vartype enabled: bool :ivar storage_uri: The URI of the storage account where diagnostics are stored. :vartype storage_uri: str """ _validation = { - 'enabled': {'required': True}, - 'storage_uri': {'readonly': True}, + "enabled": {"required": True}, + "storage_uri": {"readonly": True}, } _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'storage_uri': {'key': 'storageUri', 'type': 'str'}, + "enabled": {"key": "enabled", "type": "bool"}, + "storage_uri": {"key": "storageUri", "type": "str"}, } - def __init__( - self, - *, - enabled: bool, - **kwargs - ): + def __init__(self, *, enabled: bool, **kwargs): """ - :keyword enabled: Required. Whether the VM diagnostic agent is provisioned on the VM. + :keyword enabled: Whether the VM diagnostic agent is provisioned on the VM. Required. :paramtype enabled: bool """ - super(ContainerServiceVMDiagnostics, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.storage_uri = None -class CreationData(msrest.serialization.Model): +class CreationData(_serialization.Model): """Data used when creating a target resource from a source resource. :ivar source_resource_id: This is the ARM ID of the source object to be used to create the @@ -1274,25 +1228,20 @@ class CreationData(msrest.serialization.Model): """ _attribute_map = { - 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, + "source_resource_id": {"key": "sourceResourceId", "type": "str"}, } - def __init__( - self, - *, - source_resource_id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, source_resource_id: Optional[str] = None, **kwargs): """ :keyword source_resource_id: This is the ARM ID of the source object to be used to create the target object. :paramtype source_resource_id: str """ - super(CreationData, self).__init__(**kwargs) + super().__init__(**kwargs) self.source_resource_id = source_resource_id -class CredentialResult(msrest.serialization.Model): +class CredentialResult(_serialization.Model): """The credential result response. Variables are only populated by the server, and will be ignored when sending a request. @@ -1300,31 +1249,27 @@ class CredentialResult(msrest.serialization.Model): :ivar name: The name of the credential. :vartype name: str :ivar value: Base64-encoded Kubernetes configuration file. - :vartype value: bytearray + :vartype value: bytes """ _validation = { - 'name': {'readonly': True}, - 'value': {'readonly': True}, + "name": {"readonly": True}, + "value": {"readonly": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'bytearray'}, + "name": {"key": "name", "type": "str"}, + "value": {"key": "value", "type": "bytearray"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(CredentialResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.name = None self.value = None -class CredentialResults(msrest.serialization.Model): +class CredentialResults(_serialization.Model): """The list credential result response. Variables are only populated by the server, and will be ignored when sending a request. @@ -1334,24 +1279,20 @@ class CredentialResults(msrest.serialization.Model): """ _validation = { - 'kubeconfigs': {'readonly': True}, + "kubeconfigs": {"readonly": True}, } _attribute_map = { - 'kubeconfigs': {'key': 'kubeconfigs', 'type': '[CredentialResult]'}, + "kubeconfigs": {"key": "kubeconfigs", "type": "[CredentialResult]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(CredentialResults, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.kubeconfigs = None -class EndpointDependency(msrest.serialization.Model): +class EndpointDependency(_serialization.Model): """A domain name that AKS agent nodes are reaching at. :ivar domain_name: The domain name of the dependency. @@ -1361,8 +1302,8 @@ class EndpointDependency(msrest.serialization.Model): """ _attribute_map = { - 'domain_name': {'key': 'domainName', 'type': 'str'}, - 'endpoint_details': {'key': 'endpointDetails', 'type': '[EndpointDetail]'}, + "domain_name": {"key": "domainName", "type": "str"}, + "endpoint_details": {"key": "endpointDetails", "type": "[EndpointDetail]"}, } def __init__( @@ -1379,12 +1320,12 @@ def __init__( :paramtype endpoint_details: list[~azure.mgmt.containerservice.v2021_08_01.models.EndpointDetail] """ - super(EndpointDependency, self).__init__(**kwargs) + super().__init__(**kwargs) self.domain_name = domain_name self.endpoint_details = endpoint_details -class EndpointDetail(msrest.serialization.Model): +class EndpointDetail(_serialization.Model): """connect information from the AKS agent nodes to a single endpoint. :ivar ip_address: An IP Address that Domain Name currently resolves to. @@ -1398,10 +1339,10 @@ class EndpointDetail(msrest.serialization.Model): """ _attribute_map = { - 'ip_address': {'key': 'ipAddress', 'type': 'str'}, - 'port': {'key': 'port', 'type': 'int'}, - 'protocol': {'key': 'protocol', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, + "ip_address": {"key": "ipAddress", "type": "str"}, + "port": {"key": "port", "type": "int"}, + "protocol": {"key": "protocol", "type": "str"}, + "description": {"key": "description", "type": "str"}, } def __init__( @@ -1423,25 +1364,25 @@ def __init__( :keyword description: Description of the detail. :paramtype description: str """ - super(EndpointDetail, self).__init__(**kwargs) + super().__init__(**kwargs) self.ip_address = ip_address self.port = port self.protocol = protocol self.description = description -class ExtendedLocation(msrest.serialization.Model): +class ExtendedLocation(_serialization.Model): """The complex type of the extended location. :ivar name: The name of the extended location. :vartype name: str - :ivar type: The type of the extended location. Known values are: "EdgeZone". + :ivar type: The type of the extended location. "EdgeZone" :vartype type: str or ~azure.mgmt.containerservice.v2021_08_01.models.ExtendedLocationTypes """ _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, } def __init__( @@ -1454,15 +1395,15 @@ def __init__( """ :keyword name: The name of the extended location. :paramtype name: str - :keyword type: The type of the extended location. Known values are: "EdgeZone". + :keyword type: The type of the extended location. "EdgeZone" :paramtype type: str or ~azure.mgmt.containerservice.v2021_08_01.models.ExtendedLocationTypes """ - super(ExtendedLocation, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.type = type -class KubeletConfig(msrest.serialization.Model): +class KubeletConfig(_serialization.Model): # pylint: disable=too-many-instance-attributes """See `AKS custom node configuration `_ for more details. :ivar cpu_manager_policy: The default is 'none'. See `Kubernetes CPU management policies @@ -1502,21 +1443,21 @@ class KubeletConfig(msrest.serialization.Model): """ _validation = { - 'container_log_max_files': {'minimum': 2}, + "container_log_max_files": {"minimum": 2}, } _attribute_map = { - 'cpu_manager_policy': {'key': 'cpuManagerPolicy', 'type': 'str'}, - 'cpu_cfs_quota': {'key': 'cpuCfsQuota', 'type': 'bool'}, - 'cpu_cfs_quota_period': {'key': 'cpuCfsQuotaPeriod', 'type': 'str'}, - 'image_gc_high_threshold': {'key': 'imageGcHighThreshold', 'type': 'int'}, - 'image_gc_low_threshold': {'key': 'imageGcLowThreshold', 'type': 'int'}, - 'topology_manager_policy': {'key': 'topologyManagerPolicy', 'type': 'str'}, - 'allowed_unsafe_sysctls': {'key': 'allowedUnsafeSysctls', 'type': '[str]'}, - 'fail_swap_on': {'key': 'failSwapOn', 'type': 'bool'}, - 'container_log_max_size_mb': {'key': 'containerLogMaxSizeMB', 'type': 'int'}, - 'container_log_max_files': {'key': 'containerLogMaxFiles', 'type': 'int'}, - 'pod_max_pids': {'key': 'podMaxPids', 'type': 'int'}, + "cpu_manager_policy": {"key": "cpuManagerPolicy", "type": "str"}, + "cpu_cfs_quota": {"key": "cpuCfsQuota", "type": "bool"}, + "cpu_cfs_quota_period": {"key": "cpuCfsQuotaPeriod", "type": "str"}, + "image_gc_high_threshold": {"key": "imageGcHighThreshold", "type": "int"}, + "image_gc_low_threshold": {"key": "imageGcLowThreshold", "type": "int"}, + "topology_manager_policy": {"key": "topologyManagerPolicy", "type": "str"}, + "allowed_unsafe_sysctls": {"key": "allowedUnsafeSysctls", "type": "[str]"}, + "fail_swap_on": {"key": "failSwapOn", "type": "bool"}, + "container_log_max_size_mb": {"key": "containerLogMaxSizeMB", "type": "int"}, + "container_log_max_files": {"key": "containerLogMaxFiles", "type": "int"}, + "pod_max_pids": {"key": "podMaxPids", "type": "int"}, } def __init__( @@ -1571,7 +1512,7 @@ def __init__( :keyword pod_max_pids: The maximum number of processes per pod. :paramtype pod_max_pids: int """ - super(KubeletConfig, self).__init__(**kwargs) + super().__init__(**kwargs) self.cpu_manager_policy = cpu_manager_policy self.cpu_cfs_quota = cpu_cfs_quota self.cpu_cfs_quota_period = cpu_cfs_quota_period @@ -1585,7 +1526,7 @@ def __init__( self.pod_max_pids = pod_max_pids -class LinuxOSConfig(msrest.serialization.Model): +class LinuxOSConfig(_serialization.Model): """See `AKS custom node configuration `_ for more details. :ivar sysctls: Sysctl settings for Linux agent nodes. @@ -1604,10 +1545,10 @@ class LinuxOSConfig(msrest.serialization.Model): """ _attribute_map = { - 'sysctls': {'key': 'sysctls', 'type': 'SysctlConfig'}, - 'transparent_huge_page_enabled': {'key': 'transparentHugePageEnabled', 'type': 'str'}, - 'transparent_huge_page_defrag': {'key': 'transparentHugePageDefrag', 'type': 'str'}, - 'swap_file_size_mb': {'key': 'swapFileSizeMB', 'type': 'int'}, + "sysctls": {"key": "sysctls", "type": "SysctlConfig"}, + "transparent_huge_page_enabled": {"key": "transparentHugePageEnabled", "type": "str"}, + "transparent_huge_page_defrag": {"key": "transparentHugePageDefrag", "type": "str"}, + "swap_file_size_mb": {"key": "swapFileSizeMB", "type": "int"}, } def __init__( @@ -1634,7 +1575,7 @@ def __init__( :keyword swap_file_size_mb: The size in MB of a swap file that will be created on each node. :paramtype swap_file_size_mb: int """ - super(LinuxOSConfig, self).__init__(**kwargs) + super().__init__(**kwargs) self.sysctls = sysctls self.transparent_huge_page_enabled = transparent_huge_page_enabled self.transparent_huge_page_defrag = transparent_huge_page_defrag @@ -1663,19 +1604,19 @@ class MaintenanceConfiguration(SubResource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, + "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'}, - 'time_in_week': {'key': 'properties.timeInWeek', 'type': '[TimeInWeek]'}, - 'not_allowed_time': {'key': 'properties.notAllowedTime', 'type': '[TimeSpan]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "time_in_week": {"key": "properties.timeInWeek", "type": "[TimeInWeek]"}, + "not_allowed_time": {"key": "properties.notAllowedTime", "type": "[TimeSpan]"}, } def __init__( @@ -1692,13 +1633,13 @@ def __init__( :keyword not_allowed_time: Time slots on which upgrade is not allowed. :paramtype not_allowed_time: list[~azure.mgmt.containerservice.v2021_08_01.models.TimeSpan] """ - super(MaintenanceConfiguration, self).__init__(**kwargs) + super().__init__(**kwargs) self.system_data = None self.time_in_week = time_in_week self.not_allowed_time = not_allowed_time -class MaintenanceConfigurationListResult(msrest.serialization.Model): +class MaintenanceConfigurationListResult(_serialization.Model): """The response from the List maintenance configurations operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -1710,31 +1651,26 @@ class MaintenanceConfigurationListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[MaintenanceConfiguration]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[MaintenanceConfiguration]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.MaintenanceConfiguration"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.MaintenanceConfiguration"]] = None, **kwargs): """ :keyword value: The list of maintenance configurations. :paramtype value: list[~azure.mgmt.containerservice.v2021_08_01.models.MaintenanceConfiguration] """ - super(MaintenanceConfigurationListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class Resource(msrest.serialization.Model): +class Resource(_serialization.Model): """The Resource model definition. Variables are only populated by the server, and will be ignored when sending a request. @@ -1747,41 +1683,35 @@ class Resource(msrest.serialization.Model): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] """ - super(Resource, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -1789,7 +1719,7 @@ def __init__( self.tags = tags -class ManagedCluster(Resource): +class ManagedCluster(Resource): # pylint: disable=too-many-instance-attributes """Managed cluster. Variables are only populated by the server, and will be ignored when sending a request. @@ -1802,9 +1732,9 @@ class ManagedCluster(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar sku: The managed cluster SKU. :vartype sku: ~azure.mgmt.containerservice.v2021_08_01.models.ManagedClusterSKU @@ -1900,66 +1830,75 @@ class ManagedCluster(Resource): :vartype security_profile: ~azure.mgmt.containerservice.v2021_08_01.models.ManagedClusterSecurityProfile :ivar public_network_access: Default value is 'Enabled' (case insensitive). Could be set to - 'Disabled' to enable private cluster. Known values are: "Enabled", "Disabled". + 'Disabled' to enable private cluster. Known values are: "Enabled" and "Disabled". :vartype public_network_access: str or ~azure.mgmt.containerservice.v2021_08_01.models.PublicNetworkAccess """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'provisioning_state': {'readonly': True}, - 'power_state': {'readonly': True}, - 'max_agent_pools': {'readonly': True}, - 'fqdn': {'readonly': True}, - 'private_fqdn': {'readonly': True}, - 'azure_portal_fqdn': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, + "provisioning_state": {"readonly": True}, + "power_state": {"readonly": True}, + "max_agent_pools": {"readonly": True}, + "fqdn": {"readonly": True}, + "private_fqdn": {"readonly": True}, + "azure_portal_fqdn": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'ManagedClusterSKU'}, - 'extended_location': {'key': 'extendedLocation', 'type': 'ExtendedLocation'}, - 'identity': {'key': 'identity', 'type': 'ManagedClusterIdentity'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'power_state': {'key': 'properties.powerState', 'type': 'PowerState'}, - 'max_agent_pools': {'key': 'properties.maxAgentPools', 'type': 'int'}, - 'kubernetes_version': {'key': 'properties.kubernetesVersion', 'type': 'str'}, - 'dns_prefix': {'key': 'properties.dnsPrefix', 'type': 'str'}, - 'fqdn_subdomain': {'key': 'properties.fqdnSubdomain', 'type': 'str'}, - 'fqdn': {'key': 'properties.fqdn', 'type': 'str'}, - 'private_fqdn': {'key': 'properties.privateFQDN', 'type': 'str'}, - 'azure_portal_fqdn': {'key': 'properties.azurePortalFQDN', 'type': 'str'}, - 'agent_pool_profiles': {'key': 'properties.agentPoolProfiles', 'type': '[ManagedClusterAgentPoolProfile]'}, - 'linux_profile': {'key': 'properties.linuxProfile', 'type': 'ContainerServiceLinuxProfile'}, - 'windows_profile': {'key': 'properties.windowsProfile', 'type': 'ManagedClusterWindowsProfile'}, - 'service_principal_profile': {'key': 'properties.servicePrincipalProfile', 'type': 'ManagedClusterServicePrincipalProfile'}, - 'addon_profiles': {'key': 'properties.addonProfiles', 'type': '{ManagedClusterAddonProfile}'}, - 'pod_identity_profile': {'key': 'properties.podIdentityProfile', 'type': 'ManagedClusterPodIdentityProfile'}, - 'node_resource_group': {'key': 'properties.nodeResourceGroup', 'type': 'str'}, - 'enable_rbac': {'key': 'properties.enableRBAC', 'type': 'bool'}, - 'enable_pod_security_policy': {'key': 'properties.enablePodSecurityPolicy', 'type': 'bool'}, - 'network_profile': {'key': 'properties.networkProfile', 'type': 'ContainerServiceNetworkProfile'}, - 'aad_profile': {'key': 'properties.aadProfile', 'type': 'ManagedClusterAADProfile'}, - 'auto_upgrade_profile': {'key': 'properties.autoUpgradeProfile', 'type': 'ManagedClusterAutoUpgradeProfile'}, - 'auto_scaler_profile': {'key': 'properties.autoScalerProfile', 'type': 'ManagedClusterPropertiesAutoScalerProfile'}, - 'api_server_access_profile': {'key': 'properties.apiServerAccessProfile', 'type': 'ManagedClusterAPIServerAccessProfile'}, - 'disk_encryption_set_id': {'key': 'properties.diskEncryptionSetID', 'type': 'str'}, - 'identity_profile': {'key': 'properties.identityProfile', 'type': '{UserAssignedIdentity}'}, - 'private_link_resources': {'key': 'properties.privateLinkResources', 'type': '[PrivateLinkResource]'}, - 'disable_local_accounts': {'key': 'properties.disableLocalAccounts', 'type': 'bool'}, - 'http_proxy_config': {'key': 'properties.httpProxyConfig', 'type': 'ManagedClusterHTTPProxyConfig'}, - 'security_profile': {'key': 'properties.securityProfile', 'type': 'ManagedClusterSecurityProfile'}, - 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, - } - - def __init__( + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "sku": {"key": "sku", "type": "ManagedClusterSKU"}, + "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, + "identity": {"key": "identity", "type": "ManagedClusterIdentity"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "power_state": {"key": "properties.powerState", "type": "PowerState"}, + "max_agent_pools": {"key": "properties.maxAgentPools", "type": "int"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "dns_prefix": {"key": "properties.dnsPrefix", "type": "str"}, + "fqdn_subdomain": {"key": "properties.fqdnSubdomain", "type": "str"}, + "fqdn": {"key": "properties.fqdn", "type": "str"}, + "private_fqdn": {"key": "properties.privateFQDN", "type": "str"}, + "azure_portal_fqdn": {"key": "properties.azurePortalFQDN", "type": "str"}, + "agent_pool_profiles": {"key": "properties.agentPoolProfiles", "type": "[ManagedClusterAgentPoolProfile]"}, + "linux_profile": {"key": "properties.linuxProfile", "type": "ContainerServiceLinuxProfile"}, + "windows_profile": {"key": "properties.windowsProfile", "type": "ManagedClusterWindowsProfile"}, + "service_principal_profile": { + "key": "properties.servicePrincipalProfile", + "type": "ManagedClusterServicePrincipalProfile", + }, + "addon_profiles": {"key": "properties.addonProfiles", "type": "{ManagedClusterAddonProfile}"}, + "pod_identity_profile": {"key": "properties.podIdentityProfile", "type": "ManagedClusterPodIdentityProfile"}, + "node_resource_group": {"key": "properties.nodeResourceGroup", "type": "str"}, + "enable_rbac": {"key": "properties.enableRBAC", "type": "bool"}, + "enable_pod_security_policy": {"key": "properties.enablePodSecurityPolicy", "type": "bool"}, + "network_profile": {"key": "properties.networkProfile", "type": "ContainerServiceNetworkProfile"}, + "aad_profile": {"key": "properties.aadProfile", "type": "ManagedClusterAADProfile"}, + "auto_upgrade_profile": {"key": "properties.autoUpgradeProfile", "type": "ManagedClusterAutoUpgradeProfile"}, + "auto_scaler_profile": { + "key": "properties.autoScalerProfile", + "type": "ManagedClusterPropertiesAutoScalerProfile", + }, + "api_server_access_profile": { + "key": "properties.apiServerAccessProfile", + "type": "ManagedClusterAPIServerAccessProfile", + }, + "disk_encryption_set_id": {"key": "properties.diskEncryptionSetID", "type": "str"}, + "identity_profile": {"key": "properties.identityProfile", "type": "{UserAssignedIdentity}"}, + "private_link_resources": {"key": "properties.privateLinkResources", "type": "[PrivateLinkResource]"}, + "disable_local_accounts": {"key": "properties.disableLocalAccounts", "type": "bool"}, + "http_proxy_config": {"key": "properties.httpProxyConfig", "type": "ManagedClusterHTTPProxyConfig"}, + "security_profile": {"key": "properties.securityProfile", "type": "ManagedClusterSecurityProfile"}, + "public_network_access": {"key": "properties.publicNetworkAccess", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, location: str, @@ -1994,9 +1933,9 @@ def __init__( **kwargs ): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword sku: The managed cluster SKU. :paramtype sku: ~azure.mgmt.containerservice.v2021_08_01.models.ManagedClusterSKU @@ -2080,11 +2019,11 @@ def __init__( :paramtype security_profile: ~azure.mgmt.containerservice.v2021_08_01.models.ManagedClusterSecurityProfile :keyword public_network_access: Default value is 'Enabled' (case insensitive). Could be set to - 'Disabled' to enable private cluster. Known values are: "Enabled", "Disabled". + 'Disabled' to enable private cluster. Known values are: "Enabled" and "Disabled". :paramtype public_network_access: str or ~azure.mgmt.containerservice.v2021_08_01.models.PublicNetworkAccess """ - super(ManagedCluster, self).__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.sku = sku self.extended_location = extended_location self.identity = identity @@ -2120,7 +2059,7 @@ def __init__( self.public_network_access = public_network_access -class ManagedClusterAADProfile(msrest.serialization.Model): +class ManagedClusterAADProfile(_serialization.Model): """For more details see `managed AAD on AKS `_. :ivar managed: Whether to enable managed AAD. @@ -2142,13 +2081,13 @@ class ManagedClusterAADProfile(msrest.serialization.Model): """ _attribute_map = { - 'managed': {'key': 'managed', 'type': 'bool'}, - 'enable_azure_rbac': {'key': 'enableAzureRBAC', 'type': 'bool'}, - 'admin_group_object_i_ds': {'key': 'adminGroupObjectIDs', 'type': '[str]'}, - 'client_app_id': {'key': 'clientAppID', 'type': 'str'}, - 'server_app_id': {'key': 'serverAppID', 'type': 'str'}, - 'server_app_secret': {'key': 'serverAppSecret', 'type': 'str'}, - 'tenant_id': {'key': 'tenantID', 'type': 'str'}, + "managed": {"key": "managed", "type": "bool"}, + "enable_azure_rbac": {"key": "enableAzureRBAC", "type": "bool"}, + "admin_group_object_i_ds": {"key": "adminGroupObjectIDs", "type": "[str]"}, + "client_app_id": {"key": "clientAppID", "type": "str"}, + "server_app_id": {"key": "serverAppID", "type": "str"}, + "server_app_secret": {"key": "serverAppSecret", "type": "str"}, + "tenant_id": {"key": "tenantID", "type": "str"}, } def __init__( @@ -2181,7 +2120,7 @@ def __init__( tenant of the deployment subscription. :paramtype tenant_id: str """ - super(ManagedClusterAADProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.managed = managed self.enable_azure_rbac = enable_azure_rbac self.admin_group_object_i_ds = admin_group_object_i_ds @@ -2204,58 +2143,53 @@ class ManagedClusterAccessProfile(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar kube_config: Base64-encoded Kubernetes configuration file. - :vartype kube_config: bytearray + :vartype kube_config: bytes """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'kube_config': {'key': 'properties.kubeConfig', 'type': 'bytearray'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "kube_config": {"key": "properties.kubeConfig", "type": "bytearray"}, } def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - kube_config: Optional[bytearray] = None, - **kwargs + self, *, location: str, tags: Optional[Dict[str, str]] = None, kube_config: Optional[bytes] = None, **kwargs ): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword kube_config: Base64-encoded Kubernetes configuration file. - :paramtype kube_config: bytearray + :paramtype kube_config: bytes """ - super(ManagedClusterAccessProfile, self).__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.kube_config = kube_config -class ManagedClusterAddonProfile(msrest.serialization.Model): +class ManagedClusterAddonProfile(_serialization.Model): """A Kubernetes add-on profile for a managed cluster. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar enabled: Required. Whether the add-on is enabled or not. + :ivar enabled: Whether the add-on is enabled or not. Required. :vartype enabled: bool :ivar config: Key-value pairs for configuring an add-on. :vartype config: dict[str, str] @@ -2265,36 +2199,30 @@ class ManagedClusterAddonProfile(msrest.serialization.Model): """ _validation = { - 'enabled': {'required': True}, - 'identity': {'readonly': True}, + "enabled": {"required": True}, + "identity": {"readonly": True}, } _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'config': {'key': 'config', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'ManagedClusterAddonProfileIdentity'}, + "enabled": {"key": "enabled", "type": "bool"}, + "config": {"key": "config", "type": "{str}"}, + "identity": {"key": "identity", "type": "ManagedClusterAddonProfileIdentity"}, } - def __init__( - self, - *, - enabled: bool, - config: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, enabled: bool, config: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword enabled: Required. Whether the add-on is enabled or not. + :keyword enabled: Whether the add-on is enabled or not. Required. :paramtype enabled: bool :keyword config: Key-value pairs for configuring an add-on. :paramtype config: dict[str, str] """ - super(ManagedClusterAddonProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.config = config self.identity = None -class UserAssignedIdentity(msrest.serialization.Model): +class UserAssignedIdentity(_serialization.Model): """Details about a user assigned identity. :ivar resource_id: The resource ID of the user assigned identity. @@ -2306,9 +2234,9 @@ class UserAssignedIdentity(msrest.serialization.Model): """ _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'object_id': {'key': 'objectId', 'type': 'str'}, + "resource_id": {"key": "resourceId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + "object_id": {"key": "objectId", "type": "str"}, } def __init__( @@ -2327,7 +2255,7 @@ def __init__( :keyword object_id: The object ID of the user assigned identity. :paramtype object_id: str """ - super(UserAssignedIdentity, self).__init__(**kwargs) + super().__init__(**kwargs) self.resource_id = resource_id self.client_id = client_id self.object_id = object_id @@ -2345,9 +2273,9 @@ class ManagedClusterAddonProfileIdentity(UserAssignedIdentity): """ _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'object_id': {'key': 'objectId', 'type': 'str'}, + "resource_id": {"key": "resourceId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + "object_id": {"key": "objectId", "type": "str"}, } def __init__( @@ -2366,10 +2294,10 @@ def __init__( :keyword object_id: The object ID of the user assigned identity. :paramtype object_id: str """ - super(ManagedClusterAddonProfileIdentity, self).__init__(resource_id=resource_id, client_id=client_id, object_id=object_id, **kwargs) + super().__init__(resource_id=resource_id, client_id=client_id, object_id=object_id, **kwargs) -class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): +class ManagedClusterAgentPoolProfileProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes """Properties for the container service agent pool profile. Variables are only populated by the server, and will be ignored when sending a request. @@ -2390,14 +2318,14 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2021_08_01.models.OSDiskType :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data - root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2021_08_01.models.KubeletDiskType :ivar workload_runtime: Determines the type of workload a node can run. Known values are: - "OCIContainer", "WasmWasi". + "OCIContainer" and "WasmWasi". :vartype workload_runtime: str or ~azure.mgmt.containerservice.v2021_08_01.models.WorkloadRuntime :ivar vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and used. @@ -2411,11 +2339,11 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :vartype pod_subnet_id: str :ivar max_pods: The maximum number of pods that can run on a node. :vartype max_pods: int - :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2021_08_01.models.OSType :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known - values are: "Ubuntu", "CBLMariner". + values are: "Ubuntu" and "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2021_08_01.models.OSSKU :ivar max_count: The maximum number of nodes for auto-scaling. :vartype max_count: int @@ -2424,14 +2352,14 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it - defaults to Delete. Known values are: "Delete", "Deallocate". + defaults to Delete. Known values are: "Delete" and "Deallocate". :vartype scale_down_mode: str or ~azure.mgmt.containerservice.v2021_08_01.models.ScaleDownMode - :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", + :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets" and "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2021_08_01.models.AgentPoolType :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :vartype mode: str or ~azure.mgmt.containerservice.v2021_08_01.models.AgentPoolMode :ivar orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -2463,20 +2391,18 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default - is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + is 'Regular'. Known values are: "Spot" and "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2021_08_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2021_08_01.models.ScaleSetEvictionPolicy :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :vartype spot_max_price: float - :ivar tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :ivar tags: The tags to be persisted on the agent pool virtual machine scale set. :vartype tags: dict[str, str] :ivar node_labels: The node labels to be persisted across all nodes in agent pool. :vartype node_labels: dict[str, str] @@ -2500,7 +2426,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): for more details. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2021_08_01.models.GPUInstanceProfile :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the node pool @@ -2509,55 +2435,55 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): """ _validation = { - 'os_disk_size_gb': {'maximum': 2048, 'minimum': 0}, - 'node_image_version': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'power_state': {'readonly': True}, + "os_disk_size_gb": {"maximum": 2048, "minimum": 0}, + "node_image_version": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "power_state": {"readonly": True}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'os_disk_type': {'key': 'osDiskType', 'type': 'str'}, - 'kubelet_disk_type': {'key': 'kubeletDiskType', 'type': 'str'}, - 'workload_runtime': {'key': 'workloadRuntime', 'type': 'str'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'pod_subnet_id': {'key': 'podSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'maxPods', 'type': 'int'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'os_sku': {'key': 'osSKU', 'type': 'str'}, - 'max_count': {'key': 'maxCount', 'type': 'int'}, - 'min_count': {'key': 'minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'enableAutoScaling', 'type': 'bool'}, - 'scale_down_mode': {'key': 'scaleDownMode', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'mode': {'key': 'mode', 'type': 'str'}, - 'orchestrator_version': {'key': 'orchestratorVersion', 'type': 'str'}, - 'node_image_version': {'key': 'nodeImageVersion', 'type': 'str'}, - 'upgrade_settings': {'key': 'upgradeSettings', 'type': 'AgentPoolUpgradeSettings'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'power_state': {'key': 'powerState', 'type': 'PowerState'}, - 'availability_zones': {'key': 'availabilityZones', 'type': '[str]'}, - 'enable_node_public_ip': {'key': 'enableNodePublicIP', 'type': 'bool'}, - 'node_public_ip_prefix_id': {'key': 'nodePublicIPPrefixID', 'type': 'str'}, - 'scale_set_priority': {'key': 'scaleSetPriority', 'type': 'str'}, - 'scale_set_eviction_policy': {'key': 'scaleSetEvictionPolicy', 'type': 'str'}, - 'spot_max_price': {'key': 'spotMaxPrice', 'type': 'float'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'node_labels': {'key': 'nodeLabels', 'type': '{str}'}, - 'node_taints': {'key': 'nodeTaints', 'type': '[str]'}, - 'proximity_placement_group_id': {'key': 'proximityPlacementGroupID', 'type': 'str'}, - 'kubelet_config': {'key': 'kubeletConfig', 'type': 'KubeletConfig'}, - 'linux_os_config': {'key': 'linuxOSConfig', 'type': 'LinuxOSConfig'}, - 'enable_encryption_at_host': {'key': 'enableEncryptionAtHost', 'type': 'bool'}, - 'enable_ultra_ssd': {'key': 'enableUltraSSD', 'type': 'bool'}, - 'enable_fips': {'key': 'enableFIPS', 'type': 'bool'}, - 'gpu_instance_profile': {'key': 'gpuInstanceProfile', 'type': 'str'}, - 'creation_data': {'key': 'creationData', 'type': 'CreationData'}, - } - - def __init__( + "count": {"key": "count", "type": "int"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "os_disk_type": {"key": "osDiskType", "type": "str"}, + "kubelet_disk_type": {"key": "kubeletDiskType", "type": "str"}, + "workload_runtime": {"key": "workloadRuntime", "type": "str"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "pod_subnet_id": {"key": "podSubnetID", "type": "str"}, + "max_pods": {"key": "maxPods", "type": "int"}, + "os_type": {"key": "osType", "type": "str"}, + "os_sku": {"key": "osSKU", "type": "str"}, + "max_count": {"key": "maxCount", "type": "int"}, + "min_count": {"key": "minCount", "type": "int"}, + "enable_auto_scaling": {"key": "enableAutoScaling", "type": "bool"}, + "scale_down_mode": {"key": "scaleDownMode", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "mode": {"key": "mode", "type": "str"}, + "orchestrator_version": {"key": "orchestratorVersion", "type": "str"}, + "node_image_version": {"key": "nodeImageVersion", "type": "str"}, + "upgrade_settings": {"key": "upgradeSettings", "type": "AgentPoolUpgradeSettings"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "power_state": {"key": "powerState", "type": "PowerState"}, + "availability_zones": {"key": "availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "enableNodePublicIP", "type": "bool"}, + "node_public_ip_prefix_id": {"key": "nodePublicIPPrefixID", "type": "str"}, + "scale_set_priority": {"key": "scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "scaleSetEvictionPolicy", "type": "str"}, + "spot_max_price": {"key": "spotMaxPrice", "type": "float"}, + "tags": {"key": "tags", "type": "{str}"}, + "node_labels": {"key": "nodeLabels", "type": "{str}"}, + "node_taints": {"key": "nodeTaints", "type": "[str]"}, + "proximity_placement_group_id": {"key": "proximityPlacementGroupID", "type": "str"}, + "kubelet_config": {"key": "kubeletConfig", "type": "KubeletConfig"}, + "linux_os_config": {"key": "linuxOSConfig", "type": "LinuxOSConfig"}, + "enable_encryption_at_host": {"key": "enableEncryptionAtHost", "type": "bool"}, + "enable_ultra_ssd": {"key": "enableUltraSSD", "type": "bool"}, + "enable_fips": {"key": "enableFIPS", "type": "bool"}, + "gpu_instance_profile": {"key": "gpuInstanceProfile", "type": "str"}, + "creation_data": {"key": "creationData", "type": "CreationData"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, count: Optional[int] = None, @@ -2569,7 +2495,7 @@ def __init__( vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, @@ -2582,9 +2508,9 @@ def __init__( availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", - spot_max_price: Optional[float] = -1, + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", + spot_max_price: float = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, @@ -2615,14 +2541,14 @@ def __init__( larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2021_08_01.models.OSDiskType :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime - data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + data root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2021_08_01.models.KubeletDiskType :keyword workload_runtime: Determines the type of workload a node can run. Known values are: - "OCIContainer", "WasmWasi". + "OCIContainer" and "WasmWasi". :paramtype workload_runtime: str or ~azure.mgmt.containerservice.v2021_08_01.models.WorkloadRuntime :keyword vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and @@ -2636,11 +2562,11 @@ def __init__( :paramtype pod_subnet_id: str :keyword max_pods: The maximum number of pods that can run on a node. :paramtype max_pods: int - :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2021_08_01.models.OSType :keyword os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Known values are: "Ubuntu", "CBLMariner". + Known values are: "Ubuntu" and "CBLMariner". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2021_08_01.models.OSSKU :keyword max_count: The maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -2649,15 +2575,15 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, - it defaults to Delete. Known values are: "Delete", "Deallocate". + it defaults to Delete. Known values are: "Delete" and "Deallocate". :paramtype scale_down_mode: str or ~azure.mgmt.containerservice.v2021_08_01.models.ScaleDownMode - :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", + :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2021_08_01.models.AgentPoolType :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2021_08_01.models.AgentPoolMode :keyword orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -2683,20 +2609,18 @@ def __init__( /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the - default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + default is 'Regular'. Known values are: "Spot" and "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2021_08_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2021_08_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :paramtype spot_max_price: float - :keyword tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :keyword tags: The tags to be persisted on the agent pool virtual machine scale set. :paramtype tags: dict[str, str] :keyword node_labels: The node labels to be persisted across all nodes in agent pool. :paramtype node_labels: dict[str, str] @@ -2720,7 +2644,7 @@ def __init__( for more details. :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance - profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2021_08_01.models.GPUInstanceProfile @@ -2728,7 +2652,7 @@ def __init__( pool will be created/upgraded using a snapshot. :paramtype creation_data: ~azure.mgmt.containerservice.v2021_08_01.models.CreationData """ - super(ManagedClusterAgentPoolProfileProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.vm_size = vm_size self.os_disk_size_gb = os_disk_size_gb @@ -2770,7 +2694,9 @@ def __init__( self.creation_data = creation_data -class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): +class ManagedClusterAgentPoolProfile( + ManagedClusterAgentPoolProfileProperties +): # pylint: disable=too-many-instance-attributes """Profile for the container service agent pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -2793,14 +2719,14 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2021_08_01.models.OSDiskType :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data - root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2021_08_01.models.KubeletDiskType :ivar workload_runtime: Determines the type of workload a node can run. Known values are: - "OCIContainer", "WasmWasi". + "OCIContainer" and "WasmWasi". :vartype workload_runtime: str or ~azure.mgmt.containerservice.v2021_08_01.models.WorkloadRuntime :ivar vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and used. @@ -2814,11 +2740,11 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :vartype pod_subnet_id: str :ivar max_pods: The maximum number of pods that can run on a node. :vartype max_pods: int - :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2021_08_01.models.OSType :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known - values are: "Ubuntu", "CBLMariner". + values are: "Ubuntu" and "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2021_08_01.models.OSSKU :ivar max_count: The maximum number of nodes for auto-scaling. :vartype max_count: int @@ -2827,14 +2753,14 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it - defaults to Delete. Known values are: "Delete", "Deallocate". + defaults to Delete. Known values are: "Delete" and "Deallocate". :vartype scale_down_mode: str or ~azure.mgmt.containerservice.v2021_08_01.models.ScaleDownMode - :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", + :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets" and "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2021_08_01.models.AgentPoolType :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :vartype mode: str or ~azure.mgmt.containerservice.v2021_08_01.models.AgentPoolMode :ivar orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -2866,20 +2792,18 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default - is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + is 'Regular'. Known values are: "Spot" and "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2021_08_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2021_08_01.models.ScaleSetEvictionPolicy :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :vartype spot_max_price: float - :ivar tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :ivar tags: The tags to be persisted on the agent pool virtual machine scale set. :vartype tags: dict[str, str] :ivar node_labels: The node labels to be persisted across all nodes in agent pool. :vartype node_labels: dict[str, str] @@ -2903,68 +2827,68 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): for more details. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2021_08_01.models.GPUInstanceProfile :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the node pool will be created/upgraded using a snapshot. :vartype creation_data: ~azure.mgmt.containerservice.v2021_08_01.models.CreationData - :ivar name: Required. Windows agent pool names must be 6 characters or less. + :ivar name: Windows agent pool names must be 6 characters or less. Required. :vartype name: str """ _validation = { - 'os_disk_size_gb': {'maximum': 2048, 'minimum': 0}, - 'node_image_version': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'power_state': {'readonly': True}, - 'name': {'required': True, 'pattern': r'^[a-z][a-z0-9]{0,11}$'}, + "os_disk_size_gb": {"maximum": 2048, "minimum": 0}, + "node_image_version": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "power_state": {"readonly": True}, + "name": {"required": True, "pattern": r"^[a-z][a-z0-9]{0,11}$"}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'os_disk_type': {'key': 'osDiskType', 'type': 'str'}, - 'kubelet_disk_type': {'key': 'kubeletDiskType', 'type': 'str'}, - 'workload_runtime': {'key': 'workloadRuntime', 'type': 'str'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'pod_subnet_id': {'key': 'podSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'maxPods', 'type': 'int'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'os_sku': {'key': 'osSKU', 'type': 'str'}, - 'max_count': {'key': 'maxCount', 'type': 'int'}, - 'min_count': {'key': 'minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'enableAutoScaling', 'type': 'bool'}, - 'scale_down_mode': {'key': 'scaleDownMode', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'mode': {'key': 'mode', 'type': 'str'}, - 'orchestrator_version': {'key': 'orchestratorVersion', 'type': 'str'}, - 'node_image_version': {'key': 'nodeImageVersion', 'type': 'str'}, - 'upgrade_settings': {'key': 'upgradeSettings', 'type': 'AgentPoolUpgradeSettings'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'power_state': {'key': 'powerState', 'type': 'PowerState'}, - 'availability_zones': {'key': 'availabilityZones', 'type': '[str]'}, - 'enable_node_public_ip': {'key': 'enableNodePublicIP', 'type': 'bool'}, - 'node_public_ip_prefix_id': {'key': 'nodePublicIPPrefixID', 'type': 'str'}, - 'scale_set_priority': {'key': 'scaleSetPriority', 'type': 'str'}, - 'scale_set_eviction_policy': {'key': 'scaleSetEvictionPolicy', 'type': 'str'}, - 'spot_max_price': {'key': 'spotMaxPrice', 'type': 'float'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'node_labels': {'key': 'nodeLabels', 'type': '{str}'}, - 'node_taints': {'key': 'nodeTaints', 'type': '[str]'}, - 'proximity_placement_group_id': {'key': 'proximityPlacementGroupID', 'type': 'str'}, - 'kubelet_config': {'key': 'kubeletConfig', 'type': 'KubeletConfig'}, - 'linux_os_config': {'key': 'linuxOSConfig', 'type': 'LinuxOSConfig'}, - 'enable_encryption_at_host': {'key': 'enableEncryptionAtHost', 'type': 'bool'}, - 'enable_ultra_ssd': {'key': 'enableUltraSSD', 'type': 'bool'}, - 'enable_fips': {'key': 'enableFIPS', 'type': 'bool'}, - 'gpu_instance_profile': {'key': 'gpuInstanceProfile', 'type': 'str'}, - 'creation_data': {'key': 'creationData', 'type': 'CreationData'}, - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( + "count": {"key": "count", "type": "int"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "os_disk_type": {"key": "osDiskType", "type": "str"}, + "kubelet_disk_type": {"key": "kubeletDiskType", "type": "str"}, + "workload_runtime": {"key": "workloadRuntime", "type": "str"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "pod_subnet_id": {"key": "podSubnetID", "type": "str"}, + "max_pods": {"key": "maxPods", "type": "int"}, + "os_type": {"key": "osType", "type": "str"}, + "os_sku": {"key": "osSKU", "type": "str"}, + "max_count": {"key": "maxCount", "type": "int"}, + "min_count": {"key": "minCount", "type": "int"}, + "enable_auto_scaling": {"key": "enableAutoScaling", "type": "bool"}, + "scale_down_mode": {"key": "scaleDownMode", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "mode": {"key": "mode", "type": "str"}, + "orchestrator_version": {"key": "orchestratorVersion", "type": "str"}, + "node_image_version": {"key": "nodeImageVersion", "type": "str"}, + "upgrade_settings": {"key": "upgradeSettings", "type": "AgentPoolUpgradeSettings"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "power_state": {"key": "powerState", "type": "PowerState"}, + "availability_zones": {"key": "availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "enableNodePublicIP", "type": "bool"}, + "node_public_ip_prefix_id": {"key": "nodePublicIPPrefixID", "type": "str"}, + "scale_set_priority": {"key": "scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "scaleSetEvictionPolicy", "type": "str"}, + "spot_max_price": {"key": "spotMaxPrice", "type": "float"}, + "tags": {"key": "tags", "type": "{str}"}, + "node_labels": {"key": "nodeLabels", "type": "{str}"}, + "node_taints": {"key": "nodeTaints", "type": "[str]"}, + "proximity_placement_group_id": {"key": "proximityPlacementGroupID", "type": "str"}, + "kubelet_config": {"key": "kubeletConfig", "type": "KubeletConfig"}, + "linux_os_config": {"key": "linuxOSConfig", "type": "LinuxOSConfig"}, + "enable_encryption_at_host": {"key": "enableEncryptionAtHost", "type": "bool"}, + "enable_ultra_ssd": {"key": "enableUltraSSD", "type": "bool"}, + "enable_fips": {"key": "enableFIPS", "type": "bool"}, + "gpu_instance_profile": {"key": "gpuInstanceProfile", "type": "str"}, + "creation_data": {"key": "creationData", "type": "CreationData"}, + "name": {"key": "name", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, name: str, @@ -2977,7 +2901,7 @@ def __init__( vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, @@ -2990,9 +2914,9 @@ def __init__( availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", - spot_max_price: Optional[float] = -1, + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", + spot_max_price: float = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, @@ -3023,14 +2947,14 @@ def __init__( larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2021_08_01.models.OSDiskType :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime - data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + data root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2021_08_01.models.KubeletDiskType :keyword workload_runtime: Determines the type of workload a node can run. Known values are: - "OCIContainer", "WasmWasi". + "OCIContainer" and "WasmWasi". :paramtype workload_runtime: str or ~azure.mgmt.containerservice.v2021_08_01.models.WorkloadRuntime :keyword vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and @@ -3044,11 +2968,11 @@ def __init__( :paramtype pod_subnet_id: str :keyword max_pods: The maximum number of pods that can run on a node. :paramtype max_pods: int - :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2021_08_01.models.OSType :keyword os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Known values are: "Ubuntu", "CBLMariner". + Known values are: "Ubuntu" and "CBLMariner". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2021_08_01.models.OSSKU :keyword max_count: The maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -3057,15 +2981,15 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, - it defaults to Delete. Known values are: "Delete", "Deallocate". + it defaults to Delete. Known values are: "Delete" and "Deallocate". :paramtype scale_down_mode: str or ~azure.mgmt.containerservice.v2021_08_01.models.ScaleDownMode - :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", + :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2021_08_01.models.AgentPoolType :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2021_08_01.models.AgentPoolMode :keyword orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -3091,20 +3015,18 @@ def __init__( /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the - default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + default is 'Regular'. Known values are: "Spot" and "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2021_08_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2021_08_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :paramtype spot_max_price: float - :keyword tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :keyword tags: The tags to be persisted on the agent pool virtual machine scale set. :paramtype tags: dict[str, str] :keyword node_labels: The node labels to be persisted across all nodes in agent pool. :paramtype node_labels: dict[str, str] @@ -3128,21 +3050,59 @@ def __init__( for more details. :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance - profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2021_08_01.models.GPUInstanceProfile :keyword creation_data: CreationData to be used to specify the source Snapshot ID if the node pool will be created/upgraded using a snapshot. :paramtype creation_data: ~azure.mgmt.containerservice.v2021_08_01.models.CreationData - :keyword name: Required. Windows agent pool names must be 6 characters or less. + :keyword name: Windows agent pool names must be 6 characters or less. Required. :paramtype name: str """ - super(ManagedClusterAgentPoolProfile, self).__init__(count=count, vm_size=vm_size, os_disk_size_gb=os_disk_size_gb, os_disk_type=os_disk_type, kubelet_disk_type=kubelet_disk_type, workload_runtime=workload_runtime, vnet_subnet_id=vnet_subnet_id, pod_subnet_id=pod_subnet_id, max_pods=max_pods, os_type=os_type, os_sku=os_sku, max_count=max_count, min_count=min_count, enable_auto_scaling=enable_auto_scaling, scale_down_mode=scale_down_mode, type=type, mode=mode, orchestrator_version=orchestrator_version, upgrade_settings=upgrade_settings, availability_zones=availability_zones, enable_node_public_ip=enable_node_public_ip, node_public_ip_prefix_id=node_public_ip_prefix_id, scale_set_priority=scale_set_priority, scale_set_eviction_policy=scale_set_eviction_policy, spot_max_price=spot_max_price, tags=tags, node_labels=node_labels, node_taints=node_taints, proximity_placement_group_id=proximity_placement_group_id, kubelet_config=kubelet_config, linux_os_config=linux_os_config, enable_encryption_at_host=enable_encryption_at_host, enable_ultra_ssd=enable_ultra_ssd, enable_fips=enable_fips, gpu_instance_profile=gpu_instance_profile, creation_data=creation_data, **kwargs) + super().__init__( + count=count, + vm_size=vm_size, + os_disk_size_gb=os_disk_size_gb, + os_disk_type=os_disk_type, + kubelet_disk_type=kubelet_disk_type, + workload_runtime=workload_runtime, + vnet_subnet_id=vnet_subnet_id, + pod_subnet_id=pod_subnet_id, + max_pods=max_pods, + os_type=os_type, + os_sku=os_sku, + max_count=max_count, + min_count=min_count, + enable_auto_scaling=enable_auto_scaling, + scale_down_mode=scale_down_mode, + type=type, + mode=mode, + orchestrator_version=orchestrator_version, + upgrade_settings=upgrade_settings, + availability_zones=availability_zones, + enable_node_public_ip=enable_node_public_ip, + node_public_ip_prefix_id=node_public_ip_prefix_id, + scale_set_priority=scale_set_priority, + scale_set_eviction_policy=scale_set_eviction_policy, + spot_max_price=spot_max_price, + tags=tags, + node_labels=node_labels, + node_taints=node_taints, + proximity_placement_group_id=proximity_placement_group_id, + kubelet_config=kubelet_config, + linux_os_config=linux_os_config, + enable_encryption_at_host=enable_encryption_at_host, + enable_ultra_ssd=enable_ultra_ssd, + enable_fips=enable_fips, + gpu_instance_profile=gpu_instance_profile, + creation_data=creation_data, + **kwargs + ) self.name = name -class ManagedClusterAPIServerAccessProfile(msrest.serialization.Model): +class ManagedClusterAPIServerAccessProfile(_serialization.Model): """Access profile for managed cluster API server. :ivar authorized_ip_ranges: IP ranges are specified in CIDR format, e.g. 137.117.106.88/29. @@ -3165,11 +3125,11 @@ class ManagedClusterAPIServerAccessProfile(msrest.serialization.Model): """ _attribute_map = { - 'authorized_ip_ranges': {'key': 'authorizedIPRanges', 'type': '[str]'}, - 'enable_private_cluster': {'key': 'enablePrivateCluster', 'type': 'bool'}, - 'private_dns_zone': {'key': 'privateDNSZone', 'type': 'str'}, - 'enable_private_cluster_public_fqdn': {'key': 'enablePrivateClusterPublicFQDN', 'type': 'bool'}, - 'disable_run_command': {'key': 'disableRunCommand', 'type': 'bool'}, + "authorized_ip_ranges": {"key": "authorizedIPRanges", "type": "[str]"}, + "enable_private_cluster": {"key": "enablePrivateCluster", "type": "bool"}, + "private_dns_zone": {"key": "privateDNSZone", "type": "str"}, + "enable_private_cluster_public_fqdn": {"key": "enablePrivateClusterPublicFQDN", "type": "bool"}, + "disable_run_command": {"key": "disableRunCommand", "type": "bool"}, } def __init__( @@ -3201,7 +3161,7 @@ def __init__( :keyword disable_run_command: Whether to disable run command for the cluster or not. :paramtype disable_run_command: bool """ - super(ManagedClusterAPIServerAccessProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.authorized_ip_ranges = authorized_ip_ranges self.enable_private_cluster = enable_private_cluster self.private_dns_zone = private_dns_zone @@ -3209,37 +3169,32 @@ def __init__( self.disable_run_command = disable_run_command -class ManagedClusterAutoUpgradeProfile(msrest.serialization.Model): +class ManagedClusterAutoUpgradeProfile(_serialization.Model): """Auto upgrade profile for a managed cluster. :ivar upgrade_channel: For more information see `setting the AKS cluster auto-upgrade channel `_. Known values - are: "rapid", "stable", "patch", "node-image", "none". + are: "rapid", "stable", "patch", "node-image", and "none". :vartype upgrade_channel: str or ~azure.mgmt.containerservice.v2021_08_01.models.UpgradeChannel """ _attribute_map = { - 'upgrade_channel': {'key': 'upgradeChannel', 'type': 'str'}, + "upgrade_channel": {"key": "upgradeChannel", "type": "str"}, } - def __init__( - self, - *, - upgrade_channel: Optional[Union[str, "_models.UpgradeChannel"]] = None, - **kwargs - ): + def __init__(self, *, upgrade_channel: Optional[Union[str, "_models.UpgradeChannel"]] = None, **kwargs): """ :keyword upgrade_channel: For more information see `setting the AKS cluster auto-upgrade channel `_. - Known values are: "rapid", "stable", "patch", "node-image", "none". + Known values are: "rapid", "stable", "patch", "node-image", and "none". :paramtype upgrade_channel: str or ~azure.mgmt.containerservice.v2021_08_01.models.UpgradeChannel """ - super(ManagedClusterAutoUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.upgrade_channel = upgrade_channel -class ManagedClusterHTTPProxyConfig(msrest.serialization.Model): +class ManagedClusterHTTPProxyConfig(_serialization.Model): """Cluster HTTP proxy configuration. :ivar http_proxy: The HTTP proxy server endpoint to use. @@ -3253,10 +3208,10 @@ class ManagedClusterHTTPProxyConfig(msrest.serialization.Model): """ _attribute_map = { - 'http_proxy': {'key': 'httpProxy', 'type': 'str'}, - 'https_proxy': {'key': 'httpsProxy', 'type': 'str'}, - 'no_proxy': {'key': 'noProxy', 'type': '[str]'}, - 'trusted_ca': {'key': 'trustedCa', 'type': 'str'}, + "http_proxy": {"key": "httpProxy", "type": "str"}, + "https_proxy": {"key": "httpsProxy", "type": "str"}, + "no_proxy": {"key": "noProxy", "type": "[str]"}, + "trusted_ca": {"key": "trustedCa", "type": "str"}, } def __init__( @@ -3278,14 +3233,14 @@ def __init__( :keyword trusted_ca: Alternative CA cert to use for connecting to proxy servers. :paramtype trusted_ca: str """ - super(ManagedClusterHTTPProxyConfig, self).__init__(**kwargs) + super().__init__(**kwargs) self.http_proxy = http_proxy self.https_proxy = https_proxy self.no_proxy = no_proxy self.trusted_ca = trusted_ca -class ManagedClusterIdentity(msrest.serialization.Model): +class ManagedClusterIdentity(_serialization.Model): """Identity for the managed cluster. Variables are only populated by the server, and will be ignored when sending a request. @@ -3298,7 +3253,7 @@ class ManagedClusterIdentity(msrest.serialization.Model): :vartype tenant_id: str :ivar type: For more information see `use managed identities in AKS `_. Known values are: - "SystemAssigned", "UserAssigned", "None". + "SystemAssigned", "UserAssigned", and "None". :vartype type: str or ~azure.mgmt.containerservice.v2021_08_01.models.ResourceIdentityType :ivar user_assigned_identities: The keys must be ARM resource IDs in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. @@ -3307,42 +3262,47 @@ class ManagedClusterIdentity(msrest.serialization.Model): """ _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, + "principal_id": {"readonly": True}, + "tenant_id": {"readonly": True}, } _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{ManagedServiceIdentityUserAssignedIdentitiesValue}'}, + "principal_id": {"key": "principalId", "type": "str"}, + "tenant_id": {"key": "tenantId", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "user_assigned_identities": { + "key": "userAssignedIdentities", + "type": "{ManagedServiceIdentityUserAssignedIdentitiesValue}", + }, } def __init__( self, *, type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, - user_assigned_identities: Optional[Dict[str, "_models.ManagedServiceIdentityUserAssignedIdentitiesValue"]] = None, + user_assigned_identities: Optional[ + Dict[str, "_models.ManagedServiceIdentityUserAssignedIdentitiesValue"] + ] = None, **kwargs ): """ :keyword type: For more information see `use managed identities in AKS `_. Known values are: - "SystemAssigned", "UserAssigned", "None". + "SystemAssigned", "UserAssigned", and "None". :paramtype type: str or ~azure.mgmt.containerservice.v2021_08_01.models.ResourceIdentityType :keyword user_assigned_identities: The keys must be ARM resource IDs in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. :paramtype user_assigned_identities: dict[str, ~azure.mgmt.containerservice.v2021_08_01.models.ManagedServiceIdentityUserAssignedIdentitiesValue] """ - super(ManagedClusterIdentity, self).__init__(**kwargs) + super().__init__(**kwargs) self.principal_id = None self.tenant_id = None self.type = type self.user_assigned_identities = user_assigned_identities -class ManagedClusterListResult(msrest.serialization.Model): +class ManagedClusterListResult(_serialization.Model): """The response from the List Managed Clusters operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -3354,30 +3314,25 @@ class ManagedClusterListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[ManagedCluster]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[ManagedCluster]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.ManagedCluster"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.ManagedCluster"]] = None, **kwargs): """ :keyword value: The list of managed clusters. :paramtype value: list[~azure.mgmt.containerservice.v2021_08_01.models.ManagedCluster] """ - super(ManagedClusterListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class ManagedClusterLoadBalancerProfile(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfile(_serialization.Model): """Profile of the managed cluster load balancer. :ivar managed_outbound_i_ps: Desired managed outbound IPs for the cluster load balancer. @@ -3406,18 +3361,24 @@ class ManagedClusterLoadBalancerProfile(msrest.serialization.Model): """ _validation = { - 'allocated_outbound_ports': {'maximum': 64000, 'minimum': 0}, - 'idle_timeout_in_minutes': {'maximum': 120, 'minimum': 4}, + "allocated_outbound_ports": {"maximum": 64000, "minimum": 0}, + "idle_timeout_in_minutes": {"maximum": 120, "minimum": 4}, } _attribute_map = { - 'managed_outbound_i_ps': {'key': 'managedOutboundIPs', 'type': 'ManagedClusterLoadBalancerProfileManagedOutboundIPs'}, - 'outbound_ip_prefixes': {'key': 'outboundIPPrefixes', 'type': 'ManagedClusterLoadBalancerProfileOutboundIPPrefixes'}, - 'outbound_i_ps': {'key': 'outboundIPs', 'type': 'ManagedClusterLoadBalancerProfileOutboundIPs'}, - 'effective_outbound_i_ps': {'key': 'effectiveOutboundIPs', 'type': '[ResourceReference]'}, - 'allocated_outbound_ports': {'key': 'allocatedOutboundPorts', 'type': 'int'}, - 'idle_timeout_in_minutes': {'key': 'idleTimeoutInMinutes', 'type': 'int'}, - 'enable_multiple_standard_load_balancers': {'key': 'enableMultipleStandardLoadBalancers', 'type': 'bool'}, + "managed_outbound_i_ps": { + "key": "managedOutboundIPs", + "type": "ManagedClusterLoadBalancerProfileManagedOutboundIPs", + }, + "outbound_ip_prefixes": { + "key": "outboundIPPrefixes", + "type": "ManagedClusterLoadBalancerProfileOutboundIPPrefixes", + }, + "outbound_i_ps": {"key": "outboundIPs", "type": "ManagedClusterLoadBalancerProfileOutboundIPs"}, + "effective_outbound_i_ps": {"key": "effectiveOutboundIPs", "type": "[ResourceReference]"}, + "allocated_outbound_ports": {"key": "allocatedOutboundPorts", "type": "int"}, + "idle_timeout_in_minutes": {"key": "idleTimeoutInMinutes", "type": "int"}, + "enable_multiple_standard_load_balancers": {"key": "enableMultipleStandardLoadBalancers", "type": "bool"}, } def __init__( @@ -3427,8 +3388,8 @@ def __init__( outbound_ip_prefixes: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPPrefixes"] = None, outbound_i_ps: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPs"] = None, effective_outbound_i_ps: Optional[List["_models.ResourceReference"]] = None, - allocated_outbound_ports: Optional[int] = 0, - idle_timeout_in_minutes: Optional[int] = 30, + allocated_outbound_ports: int = 0, + idle_timeout_in_minutes: int = 30, enable_multiple_standard_load_balancers: Optional[bool] = None, **kwargs ): @@ -3458,7 +3419,7 @@ def __init__( AKS cluster or not. :paramtype enable_multiple_standard_load_balancers: bool """ - super(ManagedClusterLoadBalancerProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.managed_outbound_i_ps = managed_outbound_i_ps self.outbound_ip_prefixes = outbound_ip_prefixes self.outbound_i_ps = outbound_i_ps @@ -3468,7 +3429,7 @@ def __init__( self.enable_multiple_standard_load_balancers = enable_multiple_standard_load_balancers -class ManagedClusterLoadBalancerProfileManagedOutboundIPs(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfileManagedOutboundIPs(_serialization.Model): """Desired managed outbound IPs for the cluster load balancer. :ivar count: The desired number of outbound IPs created/managed by Azure for the cluster load @@ -3477,30 +3438,25 @@ class ManagedClusterLoadBalancerProfileManagedOutboundIPs(msrest.serialization.M """ _validation = { - 'count': {'maximum': 100, 'minimum': 1}, + "count": {"maximum": 100, "minimum": 1}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, + "count": {"key": "count", "type": "int"}, } - def __init__( - self, - *, - count: Optional[int] = 1, - **kwargs - ): + def __init__(self, *, count: int = 1, **kwargs): """ :keyword count: The desired number of outbound IPs created/managed by Azure for the cluster load balancer. Allowed values must be in the range of 1 to 100 (inclusive). The default value is 1. :paramtype count: int """ - super(ManagedClusterLoadBalancerProfileManagedOutboundIPs, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count -class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(_serialization.Model): """Desired outbound IP Prefix resources for the cluster load balancer. :ivar public_ip_prefixes: A list of public IP prefix resources. @@ -3509,25 +3465,20 @@ class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(msrest.serialization.M """ _attribute_map = { - 'public_ip_prefixes': {'key': 'publicIPPrefixes', 'type': '[ResourceReference]'}, + "public_ip_prefixes": {"key": "publicIPPrefixes", "type": "[ResourceReference]"}, } - def __init__( - self, - *, - public_ip_prefixes: Optional[List["_models.ResourceReference"]] = None, - **kwargs - ): + def __init__(self, *, public_ip_prefixes: Optional[List["_models.ResourceReference"]] = None, **kwargs): """ :keyword public_ip_prefixes: A list of public IP prefix resources. :paramtype public_ip_prefixes: list[~azure.mgmt.containerservice.v2021_08_01.models.ResourceReference] """ - super(ManagedClusterLoadBalancerProfileOutboundIPPrefixes, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_ip_prefixes = public_ip_prefixes -class ManagedClusterLoadBalancerProfileOutboundIPs(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfileOutboundIPs(_serialization.Model): """Desired outbound IP resources for the cluster load balancer. :ivar public_i_ps: A list of public IP resources. @@ -3535,24 +3486,19 @@ class ManagedClusterLoadBalancerProfileOutboundIPs(msrest.serialization.Model): """ _attribute_map = { - 'public_i_ps': {'key': 'publicIPs', 'type': '[ResourceReference]'}, + "public_i_ps": {"key": "publicIPs", "type": "[ResourceReference]"}, } - def __init__( - self, - *, - public_i_ps: Optional[List["_models.ResourceReference"]] = None, - **kwargs - ): + def __init__(self, *, public_i_ps: Optional[List["_models.ResourceReference"]] = None, **kwargs): """ :keyword public_i_ps: A list of public IP resources. :paramtype public_i_ps: list[~azure.mgmt.containerservice.v2021_08_01.models.ResourceReference] """ - super(ManagedClusterLoadBalancerProfileOutboundIPs, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_i_ps = public_i_ps -class ManagedClusterManagedOutboundIPProfile(msrest.serialization.Model): +class ManagedClusterManagedOutboundIPProfile(_serialization.Model): """Profile of the managed outbound IP resources of the managed cluster. :ivar count: The desired number of outbound IPs created/managed by Azure. Allowed values must @@ -3561,29 +3507,24 @@ class ManagedClusterManagedOutboundIPProfile(msrest.serialization.Model): """ _validation = { - 'count': {'maximum': 16, 'minimum': 1}, + "count": {"maximum": 16, "minimum": 1}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, + "count": {"key": "count", "type": "int"}, } - def __init__( - self, - *, - count: Optional[int] = 1, - **kwargs - ): + def __init__(self, *, count: int = 1, **kwargs): """ :keyword count: The desired number of outbound IPs created/managed by Azure. Allowed values must be in the range of 1 to 16 (inclusive). The default value is 1. :paramtype count: int """ - super(ManagedClusterManagedOutboundIPProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count -class ManagedClusterNATGatewayProfile(msrest.serialization.Model): +class ManagedClusterNATGatewayProfile(_serialization.Model): """Profile of the managed cluster NAT gateway. :ivar managed_outbound_ip_profile: Profile of the managed outbound IP resources of the cluster @@ -3599,13 +3540,16 @@ class ManagedClusterNATGatewayProfile(msrest.serialization.Model): """ _validation = { - 'idle_timeout_in_minutes': {'maximum': 120, 'minimum': 4}, + "idle_timeout_in_minutes": {"maximum": 120, "minimum": 4}, } _attribute_map = { - 'managed_outbound_ip_profile': {'key': 'managedOutboundIPProfile', 'type': 'ManagedClusterManagedOutboundIPProfile'}, - 'effective_outbound_i_ps': {'key': 'effectiveOutboundIPs', 'type': '[ResourceReference]'}, - 'idle_timeout_in_minutes': {'key': 'idleTimeoutInMinutes', 'type': 'int'}, + "managed_outbound_ip_profile": { + "key": "managedOutboundIPProfile", + "type": "ManagedClusterManagedOutboundIPProfile", + }, + "effective_outbound_i_ps": {"key": "effectiveOutboundIPs", "type": "[ResourceReference]"}, + "idle_timeout_in_minutes": {"key": "idleTimeoutInMinutes", "type": "int"}, } def __init__( @@ -3613,7 +3557,7 @@ def __init__( *, managed_outbound_ip_profile: Optional["_models.ManagedClusterManagedOutboundIPProfile"] = None, effective_outbound_i_ps: Optional[List["_models.ResourceReference"]] = None, - idle_timeout_in_minutes: Optional[int] = 4, + idle_timeout_in_minutes: int = 4, **kwargs ): """ @@ -3629,29 +3573,29 @@ def __init__( are in the range of 4 to 120 (inclusive). The default value is 4 minutes. :paramtype idle_timeout_in_minutes: int """ - super(ManagedClusterNATGatewayProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.managed_outbound_ip_profile = managed_outbound_ip_profile self.effective_outbound_i_ps = effective_outbound_i_ps self.idle_timeout_in_minutes = idle_timeout_in_minutes -class ManagedClusterPodIdentity(msrest.serialization.Model): +class ManagedClusterPodIdentity(_serialization.Model): """Details about the pod identity assigned to the Managed Cluster. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar name: Required. The name of the pod identity. + :ivar name: The name of the pod identity. Required. :vartype name: str - :ivar namespace: Required. The namespace of the pod identity. + :ivar namespace: The namespace of the pod identity. Required. :vartype namespace: str :ivar binding_selector: The binding selector to use for the AzureIdentityBinding resource. :vartype binding_selector: str - :ivar identity: Required. The user assigned identity details. + :ivar identity: The user assigned identity details. Required. :vartype identity: ~azure.mgmt.containerservice.v2021_08_01.models.UserAssignedIdentity :ivar provisioning_state: The current provisioning state of the pod identity. Known values are: - "Assigned", "Updating", "Deleting", "Failed". + "Assigned", "Updating", "Deleting", and "Failed". :vartype provisioning_state: str or ~azure.mgmt.containerservice.v2021_08_01.models.ManagedClusterPodIdentityProvisioningState :ivar provisioning_info: @@ -3660,20 +3604,20 @@ class ManagedClusterPodIdentity(msrest.serialization.Model): """ _validation = { - 'name': {'required': True}, - 'namespace': {'required': True}, - 'identity': {'required': True}, - 'provisioning_state': {'readonly': True}, - 'provisioning_info': {'readonly': True}, + "name": {"required": True}, + "namespace": {"required": True}, + "identity": {"required": True}, + "provisioning_state": {"readonly": True}, + "provisioning_info": {"readonly": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'namespace': {'key': 'namespace', 'type': 'str'}, - 'binding_selector': {'key': 'bindingSelector', 'type': 'str'}, - 'identity': {'key': 'identity', 'type': 'UserAssignedIdentity'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'provisioning_info': {'key': 'provisioningInfo', 'type': 'ManagedClusterPodIdentityProvisioningInfo'}, + "name": {"key": "name", "type": "str"}, + "namespace": {"key": "namespace", "type": "str"}, + "binding_selector": {"key": "bindingSelector", "type": "str"}, + "identity": {"key": "identity", "type": "UserAssignedIdentity"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "provisioning_info": {"key": "provisioningInfo", "type": "ManagedClusterPodIdentityProvisioningInfo"}, } def __init__( @@ -3686,16 +3630,16 @@ def __init__( **kwargs ): """ - :keyword name: Required. The name of the pod identity. + :keyword name: The name of the pod identity. Required. :paramtype name: str - :keyword namespace: Required. The namespace of the pod identity. + :keyword namespace: The namespace of the pod identity. Required. :paramtype namespace: str :keyword binding_selector: The binding selector to use for the AzureIdentityBinding resource. :paramtype binding_selector: str - :keyword identity: Required. The user assigned identity details. + :keyword identity: The user assigned identity details. Required. :paramtype identity: ~azure.mgmt.containerservice.v2021_08_01.models.UserAssignedIdentity """ - super(ManagedClusterPodIdentity, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.namespace = namespace self.binding_selector = binding_selector @@ -3704,54 +3648,47 @@ def __init__( self.provisioning_info = None -class ManagedClusterPodIdentityException(msrest.serialization.Model): +class ManagedClusterPodIdentityException(_serialization.Model): """See `disable AAD Pod Identity for a specific Pod/Application `_ for more details. All required parameters must be populated in order to send to Azure. - :ivar name: Required. The name of the pod identity exception. + :ivar name: The name of the pod identity exception. Required. :vartype name: str - :ivar namespace: Required. The namespace of the pod identity exception. + :ivar namespace: The namespace of the pod identity exception. Required. :vartype namespace: str - :ivar pod_labels: Required. The pod labels to match. + :ivar pod_labels: The pod labels to match. Required. :vartype pod_labels: dict[str, str] """ _validation = { - 'name': {'required': True}, - 'namespace': {'required': True}, - 'pod_labels': {'required': True}, + "name": {"required": True}, + "namespace": {"required": True}, + "pod_labels": {"required": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'namespace': {'key': 'namespace', 'type': 'str'}, - 'pod_labels': {'key': 'podLabels', 'type': '{str}'}, + "name": {"key": "name", "type": "str"}, + "namespace": {"key": "namespace", "type": "str"}, + "pod_labels": {"key": "podLabels", "type": "{str}"}, } - def __init__( - self, - *, - name: str, - namespace: str, - pod_labels: Dict[str, str], - **kwargs - ): + def __init__(self, *, name: str, namespace: str, pod_labels: Dict[str, str], **kwargs): """ - :keyword name: Required. The name of the pod identity exception. + :keyword name: The name of the pod identity exception. Required. :paramtype name: str - :keyword namespace: Required. The namespace of the pod identity exception. + :keyword namespace: The namespace of the pod identity exception. Required. :paramtype namespace: str - :keyword pod_labels: Required. The pod labels to match. + :keyword pod_labels: The pod labels to match. Required. :paramtype pod_labels: dict[str, str] """ - super(ManagedClusterPodIdentityException, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.namespace = namespace self.pod_labels = pod_labels -class ManagedClusterPodIdentityProfile(msrest.serialization.Model): +class ManagedClusterPodIdentityProfile(_serialization.Model): """See `use AAD pod identity `_ for more details on pod identity integration. :ivar enabled: Whether the pod identity addon is enabled. @@ -3771,10 +3708,13 @@ class ManagedClusterPodIdentityProfile(msrest.serialization.Model): """ _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'allow_network_plugin_kubenet': {'key': 'allowNetworkPluginKubenet', 'type': 'bool'}, - 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '[ManagedClusterPodIdentity]'}, - 'user_assigned_identity_exceptions': {'key': 'userAssignedIdentityExceptions', 'type': '[ManagedClusterPodIdentityException]'}, + "enabled": {"key": "enabled", "type": "bool"}, + "allow_network_plugin_kubenet": {"key": "allowNetworkPluginKubenet", "type": "bool"}, + "user_assigned_identities": {"key": "userAssignedIdentities", "type": "[ManagedClusterPodIdentity]"}, + "user_assigned_identity_exceptions": { + "key": "userAssignedIdentityExceptions", + "type": "[ManagedClusterPodIdentityException]", + }, } def __init__( @@ -3802,14 +3742,14 @@ def __init__( :paramtype user_assigned_identity_exceptions: list[~azure.mgmt.containerservice.v2021_08_01.models.ManagedClusterPodIdentityException] """ - super(ManagedClusterPodIdentityProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.allow_network_plugin_kubenet = allow_network_plugin_kubenet self.user_assigned_identities = user_assigned_identities self.user_assigned_identity_exceptions = user_assigned_identity_exceptions -class ManagedClusterPodIdentityProvisioningError(msrest.serialization.Model): +class ManagedClusterPodIdentityProvisioningError(_serialization.Model): """An error response from the pod identity provisioning. :ivar error: Details about the error. @@ -3818,25 +3758,20 @@ class ManagedClusterPodIdentityProvisioningError(msrest.serialization.Model): """ _attribute_map = { - 'error': {'key': 'error', 'type': 'ManagedClusterPodIdentityProvisioningErrorBody'}, + "error": {"key": "error", "type": "ManagedClusterPodIdentityProvisioningErrorBody"}, } - def __init__( - self, - *, - error: Optional["_models.ManagedClusterPodIdentityProvisioningErrorBody"] = None, - **kwargs - ): + def __init__(self, *, error: Optional["_models.ManagedClusterPodIdentityProvisioningErrorBody"] = None, **kwargs): """ :keyword error: Details about the error. :paramtype error: ~azure.mgmt.containerservice.v2021_08_01.models.ManagedClusterPodIdentityProvisioningErrorBody """ - super(ManagedClusterPodIdentityProvisioningError, self).__init__(**kwargs) + super().__init__(**kwargs) self.error = error -class ManagedClusterPodIdentityProvisioningErrorBody(msrest.serialization.Model): +class ManagedClusterPodIdentityProvisioningErrorBody(_serialization.Model): """An error response from the pod identity provisioning. :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed @@ -3854,10 +3789,10 @@ class ManagedClusterPodIdentityProvisioningErrorBody(msrest.serialization.Model) """ _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[ManagedClusterPodIdentityProvisioningErrorBody]'}, + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[ManagedClusterPodIdentityProvisioningErrorBody]"}, } def __init__( @@ -3883,14 +3818,14 @@ def __init__( :paramtype details: list[~azure.mgmt.containerservice.v2021_08_01.models.ManagedClusterPodIdentityProvisioningErrorBody] """ - super(ManagedClusterPodIdentityProvisioningErrorBody, self).__init__(**kwargs) + super().__init__(**kwargs) self.code = code self.message = message self.target = target self.details = details -class ManagedClusterPodIdentityProvisioningInfo(msrest.serialization.Model): +class ManagedClusterPodIdentityProvisioningInfo(_serialization.Model): """ManagedClusterPodIdentityProvisioningInfo. :ivar error: Pod identity assignment error (if any). @@ -3899,35 +3834,30 @@ class ManagedClusterPodIdentityProvisioningInfo(msrest.serialization.Model): """ _attribute_map = { - 'error': {'key': 'error', 'type': 'ManagedClusterPodIdentityProvisioningError'}, + "error": {"key": "error", "type": "ManagedClusterPodIdentityProvisioningError"}, } - def __init__( - self, - *, - error: Optional["_models.ManagedClusterPodIdentityProvisioningError"] = None, - **kwargs - ): + def __init__(self, *, error: Optional["_models.ManagedClusterPodIdentityProvisioningError"] = None, **kwargs): """ :keyword error: Pod identity assignment error (if any). :paramtype error: ~azure.mgmt.containerservice.v2021_08_01.models.ManagedClusterPodIdentityProvisioningError """ - super(ManagedClusterPodIdentityProvisioningInfo, self).__init__(**kwargs) + super().__init__(**kwargs) self.error = error -class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): +class ManagedClusterPoolUpgradeProfile(_serialization.Model): """The list of available upgrade versions. All required parameters must be populated in order to send to Azure. - :ivar kubernetes_version: Required. The Kubernetes version (major.minor.patch). + :ivar kubernetes_version: The Kubernetes version (major.minor.patch). Required. :vartype kubernetes_version: str :ivar name: The Agent Pool name. :vartype name: str - :ivar os_type: Required. The operating system type. The default is Linux. Known values are: - "Linux", "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2021_08_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -3935,15 +3865,15 @@ class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): """ _validation = { - 'kubernetes_version': {'required': True}, - 'os_type': {'required': True}, + "kubernetes_version": {"required": True}, + "os_type": {"required": True}, } _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'upgrades': {'key': 'upgrades', 'type': '[ManagedClusterPoolUpgradeProfileUpgradesItem]'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "os_type": {"key": "osType", "type": "str"}, + "upgrades": {"key": "upgrades", "type": "[ManagedClusterPoolUpgradeProfileUpgradesItem]"}, } def __init__( @@ -3956,25 +3886,25 @@ def __init__( **kwargs ): """ - :keyword kubernetes_version: Required. The Kubernetes version (major.minor.patch). + :keyword kubernetes_version: The Kubernetes version (major.minor.patch). Required. :paramtype kubernetes_version: str :keyword name: The Agent Pool name. :paramtype name: str - :keyword os_type: Required. The operating system type. The default is Linux. Known values are: - "Linux", "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2021_08_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: list[~azure.mgmt.containerservice.v2021_08_01.models.ManagedClusterPoolUpgradeProfileUpgradesItem] """ - super(ManagedClusterPoolUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.name = name self.os_type = os_type self.upgrades = upgrades -class ManagedClusterPoolUpgradeProfileUpgradesItem(msrest.serialization.Model): +class ManagedClusterPoolUpgradeProfileUpgradesItem(_serialization.Model): """ManagedClusterPoolUpgradeProfileUpgradesItem. :ivar kubernetes_version: The Kubernetes version (major.minor.patch). @@ -3984,36 +3914,30 @@ class ManagedClusterPoolUpgradeProfileUpgradesItem(msrest.serialization.Model): """ _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } - def __init__( - self, - *, - kubernetes_version: Optional[str] = None, - is_preview: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, kubernetes_version: Optional[str] = None, is_preview: Optional[bool] = None, **kwargs): """ :keyword kubernetes_version: The Kubernetes version (major.minor.patch). :paramtype kubernetes_version: str :keyword is_preview: Whether the Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(ManagedClusterPoolUpgradeProfileUpgradesItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.is_preview = is_preview -class ManagedClusterPropertiesAutoScalerProfile(msrest.serialization.Model): +class ManagedClusterPropertiesAutoScalerProfile(_serialization.Model): # pylint: disable=too-many-instance-attributes """Parameters to be applied to the cluster-autoscaler when enabled. :ivar balance_similar_node_groups: Valid values are 'true' and 'false'. :vartype balance_similar_node_groups: str :ivar expander: If not specified, the default is 'random'. See `expanders `_ - for more information. Known values are: "least-waste", "most-pods", "priority", "random". + for more information. Known values are: "least-waste", "most-pods", "priority", and "random". :vartype expander: str or ~azure.mgmt.containerservice.v2021_08_01.models.Expander :ivar max_empty_bulk_delete: The default is 10. :vartype max_empty_bulk_delete: str @@ -4057,23 +3981,23 @@ class ManagedClusterPropertiesAutoScalerProfile(msrest.serialization.Model): """ _attribute_map = { - 'balance_similar_node_groups': {'key': 'balance-similar-node-groups', 'type': 'str'}, - 'expander': {'key': 'expander', 'type': 'str'}, - 'max_empty_bulk_delete': {'key': 'max-empty-bulk-delete', 'type': 'str'}, - 'max_graceful_termination_sec': {'key': 'max-graceful-termination-sec', 'type': 'str'}, - 'max_node_provision_time': {'key': 'max-node-provision-time', 'type': 'str'}, - 'max_total_unready_percentage': {'key': 'max-total-unready-percentage', 'type': 'str'}, - 'new_pod_scale_up_delay': {'key': 'new-pod-scale-up-delay', 'type': 'str'}, - 'ok_total_unready_count': {'key': 'ok-total-unready-count', 'type': 'str'}, - 'scan_interval': {'key': 'scan-interval', 'type': 'str'}, - 'scale_down_delay_after_add': {'key': 'scale-down-delay-after-add', 'type': 'str'}, - 'scale_down_delay_after_delete': {'key': 'scale-down-delay-after-delete', 'type': 'str'}, - 'scale_down_delay_after_failure': {'key': 'scale-down-delay-after-failure', 'type': 'str'}, - 'scale_down_unneeded_time': {'key': 'scale-down-unneeded-time', 'type': 'str'}, - 'scale_down_unready_time': {'key': 'scale-down-unready-time', 'type': 'str'}, - 'scale_down_utilization_threshold': {'key': 'scale-down-utilization-threshold', 'type': 'str'}, - 'skip_nodes_with_local_storage': {'key': 'skip-nodes-with-local-storage', 'type': 'str'}, - 'skip_nodes_with_system_pods': {'key': 'skip-nodes-with-system-pods', 'type': 'str'}, + "balance_similar_node_groups": {"key": "balance-similar-node-groups", "type": "str"}, + "expander": {"key": "expander", "type": "str"}, + "max_empty_bulk_delete": {"key": "max-empty-bulk-delete", "type": "str"}, + "max_graceful_termination_sec": {"key": "max-graceful-termination-sec", "type": "str"}, + "max_node_provision_time": {"key": "max-node-provision-time", "type": "str"}, + "max_total_unready_percentage": {"key": "max-total-unready-percentage", "type": "str"}, + "new_pod_scale_up_delay": {"key": "new-pod-scale-up-delay", "type": "str"}, + "ok_total_unready_count": {"key": "ok-total-unready-count", "type": "str"}, + "scan_interval": {"key": "scan-interval", "type": "str"}, + "scale_down_delay_after_add": {"key": "scale-down-delay-after-add", "type": "str"}, + "scale_down_delay_after_delete": {"key": "scale-down-delay-after-delete", "type": "str"}, + "scale_down_delay_after_failure": {"key": "scale-down-delay-after-failure", "type": "str"}, + "scale_down_unneeded_time": {"key": "scale-down-unneeded-time", "type": "str"}, + "scale_down_unready_time": {"key": "scale-down-unready-time", "type": "str"}, + "scale_down_utilization_threshold": {"key": "scale-down-utilization-threshold", "type": "str"}, + "skip_nodes_with_local_storage": {"key": "skip-nodes-with-local-storage", "type": "str"}, + "skip_nodes_with_system_pods": {"key": "skip-nodes-with-system-pods", "type": "str"}, } def __init__( @@ -4103,7 +4027,7 @@ def __init__( :paramtype balance_similar_node_groups: str :keyword expander: If not specified, the default is 'random'. See `expanders `_ - for more information. Known values are: "least-waste", "most-pods", "priority", "random". + for more information. Known values are: "least-waste", "most-pods", "priority", and "random". :paramtype expander: str or ~azure.mgmt.containerservice.v2021_08_01.models.Expander :keyword max_empty_bulk_delete: The default is 10. :paramtype max_empty_bulk_delete: str @@ -4146,7 +4070,7 @@ def __init__( :keyword skip_nodes_with_system_pods: The default is true. :paramtype skip_nodes_with_system_pods: str """ - super(ManagedClusterPropertiesAutoScalerProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.balance_similar_node_groups = balance_similar_node_groups self.expander = expander self.max_empty_bulk_delete = max_empty_bulk_delete @@ -4166,7 +4090,7 @@ def __init__( self.skip_nodes_with_system_pods = skip_nodes_with_system_pods -class ManagedClusterSecurityProfile(msrest.serialization.Model): +class ManagedClusterSecurityProfile(_serialization.Model): """Security profile for the container service cluster. :ivar azure_defender: Azure Defender settings for the security profile. @@ -4175,25 +4099,22 @@ class ManagedClusterSecurityProfile(msrest.serialization.Model): """ _attribute_map = { - 'azure_defender': {'key': 'azureDefender', 'type': 'ManagedClusterSecurityProfileAzureDefender'}, + "azure_defender": {"key": "azureDefender", "type": "ManagedClusterSecurityProfileAzureDefender"}, } def __init__( - self, - *, - azure_defender: Optional["_models.ManagedClusterSecurityProfileAzureDefender"] = None, - **kwargs + self, *, azure_defender: Optional["_models.ManagedClusterSecurityProfileAzureDefender"] = None, **kwargs ): """ :keyword azure_defender: Azure Defender settings for the security profile. :paramtype azure_defender: ~azure.mgmt.containerservice.v2021_08_01.models.ManagedClusterSecurityProfileAzureDefender """ - super(ManagedClusterSecurityProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.azure_defender = azure_defender -class ManagedClusterSecurityProfileAzureDefender(msrest.serialization.Model): +class ManagedClusterSecurityProfileAzureDefender(_serialization.Model): """Azure Defender settings for the security profile. :ivar enabled: Whether to enable Azure Defender. @@ -4206,16 +4127,12 @@ class ManagedClusterSecurityProfileAzureDefender(msrest.serialization.Model): """ _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'log_analytics_workspace_resource_id': {'key': 'logAnalyticsWorkspaceResourceId', 'type': 'str'}, + "enabled": {"key": "enabled", "type": "bool"}, + "log_analytics_workspace_resource_id": {"key": "logAnalyticsWorkspaceResourceId", "type": "str"}, } def __init__( - self, - *, - enabled: Optional[bool] = None, - log_analytics_workspace_resource_id: Optional[str] = None, - **kwargs + self, *, enabled: Optional[bool] = None, log_analytics_workspace_resource_id: Optional[str] = None, **kwargs ): """ :keyword enabled: Whether to enable Azure Defender. @@ -4226,63 +4143,57 @@ def __init__( be exists. :paramtype log_analytics_workspace_resource_id: str """ - super(ManagedClusterSecurityProfileAzureDefender, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.log_analytics_workspace_resource_id = log_analytics_workspace_resource_id -class ManagedClusterServicePrincipalProfile(msrest.serialization.Model): +class ManagedClusterServicePrincipalProfile(_serialization.Model): """Information about a service principal identity for the cluster to use for manipulating Azure APIs. All required parameters must be populated in order to send to Azure. - :ivar client_id: Required. The ID for the service principal. + :ivar client_id: The ID for the service principal. Required. :vartype client_id: str :ivar secret: The secret password associated with the service principal in plain text. :vartype secret: str """ _validation = { - 'client_id': {'required': True}, + "client_id": {"required": True}, } _attribute_map = { - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'secret': {'key': 'secret', 'type': 'str'}, + "client_id": {"key": "clientId", "type": "str"}, + "secret": {"key": "secret", "type": "str"}, } - def __init__( - self, - *, - client_id: str, - secret: Optional[str] = None, - **kwargs - ): + def __init__(self, *, client_id: str, secret: Optional[str] = None, **kwargs): """ - :keyword client_id: Required. The ID for the service principal. + :keyword client_id: The ID for the service principal. Required. :paramtype client_id: str :keyword secret: The secret password associated with the service principal in plain text. :paramtype secret: str """ - super(ManagedClusterServicePrincipalProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.client_id = client_id self.secret = secret -class ManagedClusterSKU(msrest.serialization.Model): +class ManagedClusterSKU(_serialization.Model): """The SKU of a Managed Cluster. - :ivar name: The name of a managed cluster SKU. Known values are: "Basic". + :ivar name: The name of a managed cluster SKU. "Basic" :vartype name: str or ~azure.mgmt.containerservice.v2021_08_01.models.ManagedClusterSKUName :ivar tier: If not specified, the default is 'Free'. See `uptime SLA - `_ for more details. Known values are: "Paid", - "Free". + `_ for more details. Known values are: "Paid" + and "Free". :vartype tier: str or ~azure.mgmt.containerservice.v2021_08_01.models.ManagedClusterSKUTier """ _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, + "name": {"key": "name", "type": "str"}, + "tier": {"key": "tier", "type": "str"}, } def __init__( @@ -4293,19 +4204,19 @@ def __init__( **kwargs ): """ - :keyword name: The name of a managed cluster SKU. Known values are: "Basic". + :keyword name: The name of a managed cluster SKU. "Basic" :paramtype name: str or ~azure.mgmt.containerservice.v2021_08_01.models.ManagedClusterSKUName :keyword tier: If not specified, the default is 'Free'. See `uptime SLA - `_ for more details. Known values are: "Paid", - "Free". + `_ for more details. Known values are: "Paid" + and "Free". :paramtype tier: str or ~azure.mgmt.containerservice.v2021_08_01.models.ManagedClusterSKUTier """ - super(ManagedClusterSKU, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.tier = tier -class ManagedClusterUpgradeProfile(msrest.serialization.Model): +class ManagedClusterUpgradeProfile(_serialization.Model): """The list of available upgrades for compute pools. Variables are only populated by the server, and will be ignored when sending a request. @@ -4318,29 +4229,29 @@ class ManagedClusterUpgradeProfile(msrest.serialization.Model): :vartype name: str :ivar type: The type of the upgrade profile. :vartype type: str - :ivar control_plane_profile: Required. The list of available upgrade versions for the control - plane. + :ivar control_plane_profile: The list of available upgrade versions for the control plane. + Required. :vartype control_plane_profile: ~azure.mgmt.containerservice.v2021_08_01.models.ManagedClusterPoolUpgradeProfile - :ivar agent_pool_profiles: Required. The list of available upgrade versions for agent pools. + :ivar agent_pool_profiles: The list of available upgrade versions for agent pools. Required. :vartype agent_pool_profiles: list[~azure.mgmt.containerservice.v2021_08_01.models.ManagedClusterPoolUpgradeProfile] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'control_plane_profile': {'required': True}, - 'agent_pool_profiles': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "control_plane_profile": {"required": True}, + "agent_pool_profiles": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'control_plane_profile': {'key': 'properties.controlPlaneProfile', 'type': 'ManagedClusterPoolUpgradeProfile'}, - 'agent_pool_profiles': {'key': 'properties.agentPoolProfiles', 'type': '[ManagedClusterPoolUpgradeProfile]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "control_plane_profile": {"key": "properties.controlPlaneProfile", "type": "ManagedClusterPoolUpgradeProfile"}, + "agent_pool_profiles": {"key": "properties.agentPoolProfiles", "type": "[ManagedClusterPoolUpgradeProfile]"}, } def __init__( @@ -4351,15 +4262,15 @@ def __init__( **kwargs ): """ - :keyword control_plane_profile: Required. The list of available upgrade versions for the - control plane. + :keyword control_plane_profile: The list of available upgrade versions for the control plane. + Required. :paramtype control_plane_profile: ~azure.mgmt.containerservice.v2021_08_01.models.ManagedClusterPoolUpgradeProfile - :keyword agent_pool_profiles: Required. The list of available upgrade versions for agent pools. + :keyword agent_pool_profiles: The list of available upgrade versions for agent pools. Required. :paramtype agent_pool_profiles: list[~azure.mgmt.containerservice.v2021_08_01.models.ManagedClusterPoolUpgradeProfile] """ - super(ManagedClusterUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -4367,18 +4278,18 @@ def __init__( self.agent_pool_profiles = agent_pool_profiles -class ManagedClusterWindowsProfile(msrest.serialization.Model): +class ManagedClusterWindowsProfile(_serialization.Model): """Profile for Windows VMs in the managed cluster. All required parameters must be populated in order to send to Azure. - :ivar admin_username: Required. Specifies the name of the administrator account. - :code:`
`:code:`
` **Restriction:** Cannot end in "." :code:`
`:code:`
` - **Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", "test1", - "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", - "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", - "sys", "test2", "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 - character :code:`
`:code:`
` **Max-length:** 20 characters. + :ivar admin_username: Specifies the name of the administrator account. :code:`
`:code:`
` + **Restriction:** Cannot end in "." :code:`
`:code:`
` **Disallowed values:** + "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", + "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", + "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", + "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 character + :code:`
`:code:`
` **Max-length:** 20 characters. Required. :vartype admin_username: str :ivar admin_password: Specifies the password of the administrator account. :code:`
`:code:`
` **Minimum-length:** 8 characters :code:`
`:code:`
` @@ -4390,7 +4301,7 @@ class ManagedClusterWindowsProfile(msrest.serialization.Model): :vartype admin_password: str :ivar license_type: The license type to use for Windows VMs. See `Azure Hybrid User Benefits `_ for more details. Known values are: - "None", "Windows_Server". + "None" and "Windows_Server". :vartype license_type: str or ~azure.mgmt.containerservice.v2021_08_01.models.LicenseType :ivar enable_csi_proxy: For more details on CSI proxy, see the `CSI proxy GitHub repo `_. @@ -4398,14 +4309,14 @@ class ManagedClusterWindowsProfile(msrest.serialization.Model): """ _validation = { - 'admin_username': {'required': True}, + "admin_username": {"required": True}, } _attribute_map = { - 'admin_username': {'key': 'adminUsername', 'type': 'str'}, - 'admin_password': {'key': 'adminPassword', 'type': 'str'}, - 'license_type': {'key': 'licenseType', 'type': 'str'}, - 'enable_csi_proxy': {'key': 'enableCSIProxy', 'type': 'bool'}, + "admin_username": {"key": "adminUsername", "type": "str"}, + "admin_password": {"key": "adminPassword", "type": "str"}, + "license_type": {"key": "licenseType", "type": "str"}, + "enable_csi_proxy": {"key": "enableCSIProxy", "type": "bool"}, } def __init__( @@ -4418,13 +4329,13 @@ def __init__( **kwargs ): """ - :keyword admin_username: Required. Specifies the name of the administrator account. + :keyword admin_username: Specifies the name of the administrator account. :code:`
`:code:`
` **Restriction:** Cannot end in "." :code:`
`:code:`
` **Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 - character :code:`
`:code:`
` **Max-length:** 20 characters. + character :code:`
`:code:`
` **Max-length:** 20 characters. Required. :paramtype admin_username: str :keyword admin_password: Specifies the password of the administrator account. :code:`
`:code:`
` **Minimum-length:** 8 characters :code:`
`:code:`
` @@ -4436,20 +4347,20 @@ def __init__( :paramtype admin_password: str :keyword license_type: The license type to use for Windows VMs. See `Azure Hybrid User Benefits `_ for more details. Known values are: - "None", "Windows_Server". + "None" and "Windows_Server". :paramtype license_type: str or ~azure.mgmt.containerservice.v2021_08_01.models.LicenseType :keyword enable_csi_proxy: For more details on CSI proxy, see the `CSI proxy GitHub repo `_. :paramtype enable_csi_proxy: bool """ - super(ManagedClusterWindowsProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.admin_username = admin_username self.admin_password = admin_password self.license_type = license_type self.enable_csi_proxy = enable_csi_proxy -class ManagedServiceIdentityUserAssignedIdentitiesValue(msrest.serialization.Model): +class ManagedServiceIdentityUserAssignedIdentitiesValue(_serialization.Model): """ManagedServiceIdentityUserAssignedIdentitiesValue. Variables are only populated by the server, and will be ignored when sending a request. @@ -4461,27 +4372,23 @@ class ManagedServiceIdentityUserAssignedIdentitiesValue(msrest.serialization.Mod """ _validation = { - 'principal_id': {'readonly': True}, - 'client_id': {'readonly': True}, + "principal_id": {"readonly": True}, + "client_id": {"readonly": True}, } _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, + "principal_id": {"key": "principalId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(ManagedServiceIdentityUserAssignedIdentitiesValue, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.principal_id = None self.client_id = None -class OperationListResult(msrest.serialization.Model): +class OperationListResult(_serialization.Model): """The List Operation response. Variables are only populated by the server, and will be ignored when sending a request. @@ -4491,24 +4398,20 @@ class OperationListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[OperationValue]'}, + "value": {"key": "value", "type": "[OperationValue]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(OperationListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None -class OperationValue(msrest.serialization.Model): +class OperationValue(_serialization.Model): """Describes the properties of a Operation value. Variables are only populated by the server, and will be ignored when sending a request. @@ -4528,30 +4431,26 @@ class OperationValue(msrest.serialization.Model): """ _validation = { - 'origin': {'readonly': True}, - 'name': {'readonly': True}, - 'operation': {'readonly': True}, - 'resource': {'readonly': True}, - 'description': {'readonly': True}, - 'provider': {'readonly': True}, + "origin": {"readonly": True}, + "name": {"readonly": True}, + "operation": {"readonly": True}, + "resource": {"readonly": True}, + "description": {"readonly": True}, + "provider": {"readonly": True}, } _attribute_map = { - 'origin': {'key': 'origin', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'operation': {'key': 'display.operation', 'type': 'str'}, - 'resource': {'key': 'display.resource', 'type': 'str'}, - 'description': {'key': 'display.description', 'type': 'str'}, - 'provider': {'key': 'display.provider', 'type': 'str'}, + "origin": {"key": "origin", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "operation": {"key": "display.operation", "type": "str"}, + "resource": {"key": "display.resource", "type": "str"}, + "description": {"key": "display.description", "type": "str"}, + "provider": {"key": "display.provider", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(OperationValue, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.origin = None self.name = None self.operation = None @@ -4560,7 +4459,7 @@ def __init__( self.provider = None -class OSOptionProfile(msrest.serialization.Model): +class OSOptionProfile(_serialization.Model): """The OS option profile. Variables are only populated by the server, and will be ignored when sending a request. @@ -4573,83 +4472,72 @@ class OSOptionProfile(msrest.serialization.Model): :vartype name: str :ivar type: The type of the OS option resource. :vartype type: str - :ivar os_option_property_list: Required. The list of OS options. + :ivar os_option_property_list: The list of OS options. Required. :vartype os_option_property_list: list[~azure.mgmt.containerservice.v2021_08_01.models.OSOptionProperty] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'os_option_property_list': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "os_option_property_list": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'os_option_property_list': {'key': 'properties.osOptionPropertyList', 'type': '[OSOptionProperty]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "os_option_property_list": {"key": "properties.osOptionPropertyList", "type": "[OSOptionProperty]"}, } - def __init__( - self, - *, - os_option_property_list: List["_models.OSOptionProperty"], - **kwargs - ): + def __init__(self, *, os_option_property_list: List["_models.OSOptionProperty"], **kwargs): """ - :keyword os_option_property_list: Required. The list of OS options. + :keyword os_option_property_list: The list of OS options. Required. :paramtype os_option_property_list: list[~azure.mgmt.containerservice.v2021_08_01.models.OSOptionProperty] """ - super(OSOptionProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None self.os_option_property_list = os_option_property_list -class OSOptionProperty(msrest.serialization.Model): +class OSOptionProperty(_serialization.Model): """OS option property. All required parameters must be populated in order to send to Azure. - :ivar os_type: Required. The OS type. + :ivar os_type: The OS type. Required. :vartype os_type: str - :ivar enable_fips_image: Required. Whether the image is FIPS-enabled. + :ivar enable_fips_image: Whether the image is FIPS-enabled. Required. :vartype enable_fips_image: bool """ _validation = { - 'os_type': {'required': True}, - 'enable_fips_image': {'required': True}, + "os_type": {"required": True}, + "enable_fips_image": {"required": True}, } _attribute_map = { - 'os_type': {'key': 'os-type', 'type': 'str'}, - 'enable_fips_image': {'key': 'enable-fips-image', 'type': 'bool'}, + "os_type": {"key": "os-type", "type": "str"}, + "enable_fips_image": {"key": "enable-fips-image", "type": "bool"}, } - def __init__( - self, - *, - os_type: str, - enable_fips_image: bool, - **kwargs - ): + def __init__(self, *, os_type: str, enable_fips_image: bool, **kwargs): """ - :keyword os_type: Required. The OS type. + :keyword os_type: The OS type. Required. :paramtype os_type: str - :keyword enable_fips_image: Required. Whether the image is FIPS-enabled. + :keyword enable_fips_image: Whether the image is FIPS-enabled. Required. :paramtype enable_fips_image: bool """ - super(OSOptionProperty, self).__init__(**kwargs) + super().__init__(**kwargs) self.os_type = os_type self.enable_fips_image = enable_fips_image -class OutboundEnvironmentEndpoint(msrest.serialization.Model): +class OutboundEnvironmentEndpoint(_serialization.Model): """Egress endpoints which AKS agent nodes connect to for common purpose. :ivar category: The category of endpoints accessed by the AKS agent node, e.g. @@ -4660,8 +4548,8 @@ class OutboundEnvironmentEndpoint(msrest.serialization.Model): """ _attribute_map = { - 'category': {'key': 'category', 'type': 'str'}, - 'endpoints': {'key': 'endpoints', 'type': '[EndpointDependency]'}, + "category": {"key": "category", "type": "str"}, + "endpoints": {"key": "endpoints", "type": "[EndpointDependency]"}, } def __init__( @@ -4678,19 +4566,19 @@ def __init__( :keyword endpoints: The endpoints that AKS agent nodes connect to. :paramtype endpoints: list[~azure.mgmt.containerservice.v2021_08_01.models.EndpointDependency] """ - super(OutboundEnvironmentEndpoint, self).__init__(**kwargs) + super().__init__(**kwargs) self.category = category self.endpoints = endpoints -class OutboundEnvironmentEndpointCollection(msrest.serialization.Model): +class OutboundEnvironmentEndpointCollection(_serialization.Model): """Collection of OutboundEnvironmentEndpoint. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar value: Required. Collection of resources. + :ivar value: Collection of resources. Required. :vartype value: list[~azure.mgmt.containerservice.v2021_08_01.models.OutboundEnvironmentEndpoint] :ivar next_link: Link to next page of resources. @@ -4698,59 +4586,49 @@ class OutboundEnvironmentEndpointCollection(msrest.serialization.Model): """ _validation = { - 'value': {'required': True}, - 'next_link': {'readonly': True}, + "value": {"required": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[OutboundEnvironmentEndpoint]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[OutboundEnvironmentEndpoint]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: List["_models.OutboundEnvironmentEndpoint"], - **kwargs - ): + def __init__(self, *, value: List["_models.OutboundEnvironmentEndpoint"], **kwargs): """ - :keyword value: Required. Collection of resources. + :keyword value: Collection of resources. Required. :paramtype value: list[~azure.mgmt.containerservice.v2021_08_01.models.OutboundEnvironmentEndpoint] """ - super(OutboundEnvironmentEndpointCollection, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class PowerState(msrest.serialization.Model): +class PowerState(_serialization.Model): """Describes the Power State of the cluster. - :ivar code: Tells whether the cluster is Running or Stopped. Known values are: "Running", + :ivar code: Tells whether the cluster is Running or Stopped. Known values are: "Running" and "Stopped". :vartype code: str or ~azure.mgmt.containerservice.v2021_08_01.models.Code """ _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, + "code": {"key": "code", "type": "str"}, } - def __init__( - self, - *, - code: Optional[Union[str, "_models.Code"]] = None, - **kwargs - ): + def __init__(self, *, code: Optional[Union[str, "_models.Code"]] = None, **kwargs): """ - :keyword code: Tells whether the cluster is Running or Stopped. Known values are: "Running", + :keyword code: Tells whether the cluster is Running or Stopped. Known values are: "Running" and "Stopped". :paramtype code: str or ~azure.mgmt.containerservice.v2021_08_01.models.Code """ - super(PowerState, self).__init__(**kwargs) + super().__init__(**kwargs) self.code = code -class PrivateEndpoint(msrest.serialization.Model): +class PrivateEndpoint(_serialization.Model): """Private endpoint which a connection belongs to. :ivar id: The resource ID of the private endpoint. @@ -4758,24 +4636,19 @@ class PrivateEndpoint(msrest.serialization.Model): """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, } - def __init__( - self, - *, - id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin """ :keyword id: The resource ID of the private endpoint. :paramtype id: str """ - super(PrivateEndpoint, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id -class PrivateEndpointConnection(msrest.serialization.Model): +class PrivateEndpointConnection(_serialization.Model): """A private endpoint connection. Variables are only populated by the server, and will be ignored when sending a request. @@ -4787,7 +4660,7 @@ class PrivateEndpointConnection(msrest.serialization.Model): :ivar type: The resource type. :vartype type: str :ivar provisioning_state: The current provisioning state. Known values are: "Succeeded", - "Creating", "Deleting", "Failed". + "Creating", "Deleting", and "Failed". :vartype provisioning_state: str or ~azure.mgmt.containerservice.v2021_08_01.models.PrivateEndpointConnectionProvisioningState :ivar private_endpoint: The resource of private endpoint. @@ -4799,19 +4672,22 @@ class PrivateEndpointConnection(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'provisioning_state': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, - 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "private_endpoint": {"key": "properties.privateEndpoint", "type": "PrivateEndpoint"}, + "private_link_service_connection_state": { + "key": "properties.privateLinkServiceConnectionState", + "type": "PrivateLinkServiceConnectionState", + }, } def __init__( @@ -4829,7 +4705,7 @@ def __init__( :paramtype private_link_service_connection_state: ~azure.mgmt.containerservice.v2021_08_01.models.PrivateLinkServiceConnectionState """ - super(PrivateEndpointConnection, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -4838,7 +4714,7 @@ def __init__( self.private_link_service_connection_state = private_link_service_connection_state -class PrivateEndpointConnectionListResult(msrest.serialization.Model): +class PrivateEndpointConnectionListResult(_serialization.Model): """A list of private endpoint connections. :ivar value: The collection value. @@ -4846,25 +4722,20 @@ class PrivateEndpointConnectionListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, + "value": {"key": "value", "type": "[PrivateEndpointConnection]"}, } - def __init__( - self, - *, - value: Optional[List["_models.PrivateEndpointConnection"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.PrivateEndpointConnection"]] = None, **kwargs): """ :keyword value: The collection value. :paramtype value: list[~azure.mgmt.containerservice.v2021_08_01.models.PrivateEndpointConnection] """ - super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value -class PrivateLinkResource(msrest.serialization.Model): +class PrivateLinkResource(_serialization.Model): """A private link resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -4885,22 +4756,22 @@ class PrivateLinkResource(msrest.serialization.Model): """ _validation = { - 'private_link_service_id': {'readonly': True}, + "private_link_service_id": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'group_id': {'key': 'groupId', 'type': 'str'}, - 'required_members': {'key': 'requiredMembers', 'type': '[str]'}, - 'private_link_service_id': {'key': 'privateLinkServiceID', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "group_id": {"key": "groupId", "type": "str"}, + "required_members": {"key": "requiredMembers", "type": "[str]"}, + "private_link_service_id": {"key": "privateLinkServiceID", "type": "str"}, } def __init__( self, *, - id: Optional[str] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin name: Optional[str] = None, type: Optional[str] = None, group_id: Optional[str] = None, @@ -4919,7 +4790,7 @@ def __init__( :keyword required_members: The RequiredMembers of the resource. :paramtype required_members: list[str] """ - super(PrivateLinkResource, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id self.name = name self.type = type @@ -4928,7 +4799,7 @@ def __init__( self.private_link_service_id = None -class PrivateLinkResourcesListResult(msrest.serialization.Model): +class PrivateLinkResourcesListResult(_serialization.Model): """A list of private link resources. :ivar value: The collection value. @@ -4936,36 +4807,31 @@ class PrivateLinkResourcesListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, + "value": {"key": "value", "type": "[PrivateLinkResource]"}, } - def __init__( - self, - *, - value: Optional[List["_models.PrivateLinkResource"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.PrivateLinkResource"]] = None, **kwargs): """ :keyword value: The collection value. :paramtype value: list[~azure.mgmt.containerservice.v2021_08_01.models.PrivateLinkResource] """ - super(PrivateLinkResourcesListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value -class PrivateLinkServiceConnectionState(msrest.serialization.Model): +class PrivateLinkServiceConnectionState(_serialization.Model): """The state of a private link service connection. :ivar status: The private link service connection status. Known values are: "Pending", - "Approved", "Rejected", "Disconnected". + "Approved", "Rejected", and "Disconnected". :vartype status: str or ~azure.mgmt.containerservice.v2021_08_01.models.ConnectionStatus :ivar description: The private link service connection description. :vartype description: str """ _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, + "status": {"key": "status", "type": "str"}, + "description": {"key": "description", "type": "str"}, } def __init__( @@ -4977,17 +4843,17 @@ def __init__( ): """ :keyword status: The private link service connection status. Known values are: "Pending", - "Approved", "Rejected", "Disconnected". + "Approved", "Rejected", and "Disconnected". :paramtype status: str or ~azure.mgmt.containerservice.v2021_08_01.models.ConnectionStatus :keyword description: The private link service connection description. :paramtype description: str """ - super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) + super().__init__(**kwargs) self.status = status self.description = description -class ResourceReference(msrest.serialization.Model): +class ResourceReference(_serialization.Model): """A reference to an Azure resource. :ivar id: The fully qualified Azure resource id. @@ -4995,29 +4861,24 @@ class ResourceReference(msrest.serialization.Model): """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, } - def __init__( - self, - *, - id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin """ :keyword id: The fully qualified Azure resource id. :paramtype id: str """ - super(ResourceReference, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id -class RunCommandRequest(msrest.serialization.Model): +class RunCommandRequest(_serialization.Model): """A run command request. All required parameters must be populated in order to send to Azure. - :ivar command: Required. The command to run. + :ivar command: The command to run. Required. :vartype command: str :ivar context: A base64 encoded zip file containing the files required by the command. :vartype context: str @@ -5026,38 +4887,31 @@ class RunCommandRequest(msrest.serialization.Model): """ _validation = { - 'command': {'required': True}, + "command": {"required": True}, } _attribute_map = { - 'command': {'key': 'command', 'type': 'str'}, - 'context': {'key': 'context', 'type': 'str'}, - 'cluster_token': {'key': 'clusterToken', 'type': 'str'}, + "command": {"key": "command", "type": "str"}, + "context": {"key": "context", "type": "str"}, + "cluster_token": {"key": "clusterToken", "type": "str"}, } - def __init__( - self, - *, - command: str, - context: Optional[str] = None, - cluster_token: Optional[str] = None, - **kwargs - ): + def __init__(self, *, command: str, context: Optional[str] = None, cluster_token: Optional[str] = None, **kwargs): """ - :keyword command: Required. The command to run. + :keyword command: The command to run. Required. :paramtype command: str :keyword context: A base64 encoded zip file containing the files required by the command. :paramtype context: str :keyword cluster_token: AuthToken issued for AKS AAD Server App. :paramtype cluster_token: str """ - super(RunCommandRequest, self).__init__(**kwargs) + super().__init__(**kwargs) self.command = command self.context = context self.cluster_token = cluster_token -class RunCommandResult(msrest.serialization.Model): +class RunCommandResult(_serialization.Model): """run command result. Variables are only populated by the server, and will be ignored when sending a request. @@ -5079,32 +4933,28 @@ class RunCommandResult(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'exit_code': {'readonly': True}, - 'started_at': {'readonly': True}, - 'finished_at': {'readonly': True}, - 'logs': {'readonly': True}, - 'reason': {'readonly': True}, + "id": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "exit_code": {"readonly": True}, + "started_at": {"readonly": True}, + "finished_at": {"readonly": True}, + "logs": {"readonly": True}, + "reason": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'exit_code': {'key': 'properties.exitCode', 'type': 'int'}, - 'started_at': {'key': 'properties.startedAt', 'type': 'iso-8601'}, - 'finished_at': {'key': 'properties.finishedAt', 'type': 'iso-8601'}, - 'logs': {'key': 'properties.logs', 'type': 'str'}, - 'reason': {'key': 'properties.reason', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(RunCommandResult, self).__init__(**kwargs) + "id": {"key": "id", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "exit_code": {"key": "properties.exitCode", "type": "int"}, + "started_at": {"key": "properties.startedAt", "type": "iso-8601"}, + "finished_at": {"key": "properties.finishedAt", "type": "iso-8601"}, + "logs": {"key": "properties.logs", "type": "str"}, + "reason": {"key": "properties.reason", "type": "str"}, + } + + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.id = None self.provisioning_state = None self.exit_code = None @@ -5127,37 +4977,36 @@ class Snapshot(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar system_data: The system metadata relating to this snapshot. :vartype system_data: ~azure.mgmt.containerservice.v2021_08_01.models.SystemData :ivar creation_data: CreationData to be used to specify the source agent pool resource ID to create this snapshot. :vartype creation_data: ~azure.mgmt.containerservice.v2021_08_01.models.CreationData - :ivar snapshot_type: The type of a snapshot. The default is NodePool. Known values are: - "NodePool". Default value: "NodePool". + :ivar snapshot_type: The type of a snapshot. The default is NodePool. "NodePool" :vartype snapshot_type: str or ~azure.mgmt.containerservice.v2021_08_01.models.SnapshotType """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'system_data': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, + "system_data": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'creation_data': {'key': 'properties.creationData', 'type': 'CreationData'}, - 'snapshot_type': {'key': 'properties.snapshotType', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "creation_data": {"key": "properties.creationData", "type": "CreationData"}, + "snapshot_type": {"key": "properties.snapshotType", "type": "str"}, } def __init__( @@ -5166,28 +5015,27 @@ def __init__( location: str, tags: Optional[Dict[str, str]] = None, creation_data: Optional["_models.CreationData"] = None, - snapshot_type: Optional[Union[str, "_models.SnapshotType"]] = "NodePool", + snapshot_type: Union[str, "_models.SnapshotType"] = "NodePool", **kwargs ): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword creation_data: CreationData to be used to specify the source agent pool resource ID to create this snapshot. :paramtype creation_data: ~azure.mgmt.containerservice.v2021_08_01.models.CreationData - :keyword snapshot_type: The type of a snapshot. The default is NodePool. Known values are: - "NodePool". Default value: "NodePool". + :keyword snapshot_type: The type of a snapshot. The default is NodePool. "NodePool" :paramtype snapshot_type: str or ~azure.mgmt.containerservice.v2021_08_01.models.SnapshotType """ - super(Snapshot, self).__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.system_data = None self.creation_data = creation_data self.snapshot_type = snapshot_type -class SnapshotListResult(msrest.serialization.Model): +class SnapshotListResult(_serialization.Model): """The response from the List Snapshots operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -5199,30 +5047,25 @@ class SnapshotListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[Snapshot]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[Snapshot]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.Snapshot"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.Snapshot"]] = None, **kwargs): """ :keyword value: The list of snapshots. :paramtype value: list[~azure.mgmt.containerservice.v2021_08_01.models.Snapshot] """ - super(SnapshotListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class SysctlConfig(msrest.serialization.Model): +class SysctlConfig(_serialization.Model): # pylint: disable=too-many-instance-attributes """Sysctl settings for Linux agent nodes. :ivar net_core_somaxconn: Sysctl setting net.core.somaxconn. @@ -5284,37 +5127,37 @@ class SysctlConfig(msrest.serialization.Model): """ _attribute_map = { - 'net_core_somaxconn': {'key': 'netCoreSomaxconn', 'type': 'int'}, - 'net_core_netdev_max_backlog': {'key': 'netCoreNetdevMaxBacklog', 'type': 'int'}, - 'net_core_rmem_default': {'key': 'netCoreRmemDefault', 'type': 'int'}, - 'net_core_rmem_max': {'key': 'netCoreRmemMax', 'type': 'int'}, - 'net_core_wmem_default': {'key': 'netCoreWmemDefault', 'type': 'int'}, - 'net_core_wmem_max': {'key': 'netCoreWmemMax', 'type': 'int'}, - 'net_core_optmem_max': {'key': 'netCoreOptmemMax', 'type': 'int'}, - 'net_ipv4_tcp_max_syn_backlog': {'key': 'netIpv4TcpMaxSynBacklog', 'type': 'int'}, - 'net_ipv4_tcp_max_tw_buckets': {'key': 'netIpv4TcpMaxTwBuckets', 'type': 'int'}, - 'net_ipv4_tcp_fin_timeout': {'key': 'netIpv4TcpFinTimeout', 'type': 'int'}, - 'net_ipv4_tcp_keepalive_time': {'key': 'netIpv4TcpKeepaliveTime', 'type': 'int'}, - 'net_ipv4_tcp_keepalive_probes': {'key': 'netIpv4TcpKeepaliveProbes', 'type': 'int'}, - 'net_ipv4_tcpkeepalive_intvl': {'key': 'netIpv4TcpkeepaliveIntvl', 'type': 'int'}, - 'net_ipv4_tcp_tw_reuse': {'key': 'netIpv4TcpTwReuse', 'type': 'bool'}, - 'net_ipv4_ip_local_port_range': {'key': 'netIpv4IpLocalPortRange', 'type': 'str'}, - 'net_ipv4_neigh_default_gc_thresh1': {'key': 'netIpv4NeighDefaultGcThresh1', 'type': 'int'}, - 'net_ipv4_neigh_default_gc_thresh2': {'key': 'netIpv4NeighDefaultGcThresh2', 'type': 'int'}, - 'net_ipv4_neigh_default_gc_thresh3': {'key': 'netIpv4NeighDefaultGcThresh3', 'type': 'int'}, - 'net_netfilter_nf_conntrack_max': {'key': 'netNetfilterNfConntrackMax', 'type': 'int'}, - 'net_netfilter_nf_conntrack_buckets': {'key': 'netNetfilterNfConntrackBuckets', 'type': 'int'}, - 'fs_inotify_max_user_watches': {'key': 'fsInotifyMaxUserWatches', 'type': 'int'}, - 'fs_file_max': {'key': 'fsFileMax', 'type': 'int'}, - 'fs_aio_max_nr': {'key': 'fsAioMaxNr', 'type': 'int'}, - 'fs_nr_open': {'key': 'fsNrOpen', 'type': 'int'}, - 'kernel_threads_max': {'key': 'kernelThreadsMax', 'type': 'int'}, - 'vm_max_map_count': {'key': 'vmMaxMapCount', 'type': 'int'}, - 'vm_swappiness': {'key': 'vmSwappiness', 'type': 'int'}, - 'vm_vfs_cache_pressure': {'key': 'vmVfsCachePressure', 'type': 'int'}, - } - - def __init__( + "net_core_somaxconn": {"key": "netCoreSomaxconn", "type": "int"}, + "net_core_netdev_max_backlog": {"key": "netCoreNetdevMaxBacklog", "type": "int"}, + "net_core_rmem_default": {"key": "netCoreRmemDefault", "type": "int"}, + "net_core_rmem_max": {"key": "netCoreRmemMax", "type": "int"}, + "net_core_wmem_default": {"key": "netCoreWmemDefault", "type": "int"}, + "net_core_wmem_max": {"key": "netCoreWmemMax", "type": "int"}, + "net_core_optmem_max": {"key": "netCoreOptmemMax", "type": "int"}, + "net_ipv4_tcp_max_syn_backlog": {"key": "netIpv4TcpMaxSynBacklog", "type": "int"}, + "net_ipv4_tcp_max_tw_buckets": {"key": "netIpv4TcpMaxTwBuckets", "type": "int"}, + "net_ipv4_tcp_fin_timeout": {"key": "netIpv4TcpFinTimeout", "type": "int"}, + "net_ipv4_tcp_keepalive_time": {"key": "netIpv4TcpKeepaliveTime", "type": "int"}, + "net_ipv4_tcp_keepalive_probes": {"key": "netIpv4TcpKeepaliveProbes", "type": "int"}, + "net_ipv4_tcpkeepalive_intvl": {"key": "netIpv4TcpkeepaliveIntvl", "type": "int"}, + "net_ipv4_tcp_tw_reuse": {"key": "netIpv4TcpTwReuse", "type": "bool"}, + "net_ipv4_ip_local_port_range": {"key": "netIpv4IpLocalPortRange", "type": "str"}, + "net_ipv4_neigh_default_gc_thresh1": {"key": "netIpv4NeighDefaultGcThresh1", "type": "int"}, + "net_ipv4_neigh_default_gc_thresh2": {"key": "netIpv4NeighDefaultGcThresh2", "type": "int"}, + "net_ipv4_neigh_default_gc_thresh3": {"key": "netIpv4NeighDefaultGcThresh3", "type": "int"}, + "net_netfilter_nf_conntrack_max": {"key": "netNetfilterNfConntrackMax", "type": "int"}, + "net_netfilter_nf_conntrack_buckets": {"key": "netNetfilterNfConntrackBuckets", "type": "int"}, + "fs_inotify_max_user_watches": {"key": "fsInotifyMaxUserWatches", "type": "int"}, + "fs_file_max": {"key": "fsFileMax", "type": "int"}, + "fs_aio_max_nr": {"key": "fsAioMaxNr", "type": "int"}, + "fs_nr_open": {"key": "fsNrOpen", "type": "int"}, + "kernel_threads_max": {"key": "kernelThreadsMax", "type": "int"}, + "vm_max_map_count": {"key": "vmMaxMapCount", "type": "int"}, + "vm_swappiness": {"key": "vmSwappiness", "type": "int"}, + "vm_vfs_cache_pressure": {"key": "vmVfsCachePressure", "type": "int"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, net_core_somaxconn: Optional[int] = None, @@ -5405,7 +5248,7 @@ def __init__( :keyword vm_vfs_cache_pressure: Sysctl setting vm.vfs_cache_pressure. :paramtype vm_vfs_cache_pressure: int """ - super(SysctlConfig, self).__init__(**kwargs) + super().__init__(**kwargs) self.net_core_somaxconn = net_core_somaxconn self.net_core_netdev_max_backlog = net_core_netdev_max_backlog self.net_core_rmem_default = net_core_rmem_default @@ -5436,20 +5279,20 @@ def __init__( self.vm_vfs_cache_pressure = vm_vfs_cache_pressure -class SystemData(msrest.serialization.Model): +class SystemData(_serialization.Model): """Metadata pertaining to creation and last modification of the resource. :ivar created_by: The identity that created the resource. :vartype created_by: str :ivar created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", "Key". + "User", "Application", "ManagedIdentity", and "Key". :vartype created_by_type: str or ~azure.mgmt.containerservice.v2021_08_01.models.CreatedByType :ivar created_at: The UTC timestamp of resource creation. :vartype created_at: ~datetime.datetime :ivar last_modified_by: The identity that last modified the resource. :vartype last_modified_by: str :ivar last_modified_by_type: The type of identity that last modified the resource. Known values - are: "User", "Application", "ManagedIdentity", "Key". + are: "User", "Application", "ManagedIdentity", and "Key". :vartype last_modified_by_type: str or ~azure.mgmt.containerservice.v2021_08_01.models.CreatedByType :ivar last_modified_at: The type of identity that last modified the resource. @@ -5457,12 +5300,12 @@ class SystemData(msrest.serialization.Model): """ _attribute_map = { - 'created_by': {'key': 'createdBy', 'type': 'str'}, - 'created_by_type': {'key': 'createdByType', 'type': 'str'}, - 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, - 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, - 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, - 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + "created_by": {"key": "createdBy", "type": "str"}, + "created_by_type": {"key": "createdByType", "type": "str"}, + "created_at": {"key": "createdAt", "type": "iso-8601"}, + "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, + "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, + "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, } def __init__( @@ -5480,7 +5323,7 @@ def __init__( :keyword created_by: The identity that created the resource. :paramtype created_by: str :keyword created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", "Key". + "User", "Application", "ManagedIdentity", and "Key". :paramtype created_by_type: str or ~azure.mgmt.containerservice.v2021_08_01.models.CreatedByType :keyword created_at: The UTC timestamp of resource creation. @@ -5488,13 +5331,13 @@ def __init__( :keyword last_modified_by: The identity that last modified the resource. :paramtype last_modified_by: str :keyword last_modified_by_type: The type of identity that last modified the resource. Known - values are: "User", "Application", "ManagedIdentity", "Key". + values are: "User", "Application", "ManagedIdentity", and "Key". :paramtype last_modified_by_type: str or ~azure.mgmt.containerservice.v2021_08_01.models.CreatedByType :keyword last_modified_at: The type of identity that last modified the resource. :paramtype last_modified_at: ~datetime.datetime """ - super(SystemData, self).__init__(**kwargs) + super().__init__(**kwargs) self.created_by = created_by self.created_by_type = created_by_type self.created_at = created_at @@ -5503,36 +5346,31 @@ def __init__( self.last_modified_at = last_modified_at -class TagsObject(msrest.serialization.Model): +class TagsObject(_serialization.Model): """Tags object for patch operations. - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] """ _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] """ - super(TagsObject, self).__init__(**kwargs) + super().__init__(**kwargs) self.tags = tags -class TimeInWeek(msrest.serialization.Model): +class TimeInWeek(_serialization.Model): """Time in a week. :ivar day: The day of the week. Known values are: "Sunday", "Monday", "Tuesday", "Wednesday", - "Thursday", "Friday", "Saturday". + "Thursday", "Friday", and "Saturday". :vartype day: str or ~azure.mgmt.containerservice.v2021_08_01.models.WeekDay :ivar hour_slots: Each integer hour represents a time range beginning at 0m after the hour ending at the next hour (non-inclusive). 0 corresponds to 00:00 UTC, 23 corresponds to 23:00 @@ -5541,32 +5379,28 @@ class TimeInWeek(msrest.serialization.Model): """ _attribute_map = { - 'day': {'key': 'day', 'type': 'str'}, - 'hour_slots': {'key': 'hourSlots', 'type': '[int]'}, + "day": {"key": "day", "type": "str"}, + "hour_slots": {"key": "hourSlots", "type": "[int]"}, } def __init__( - self, - *, - day: Optional[Union[str, "_models.WeekDay"]] = None, - hour_slots: Optional[List[int]] = None, - **kwargs + self, *, day: Optional[Union[str, "_models.WeekDay"]] = None, hour_slots: Optional[List[int]] = None, **kwargs ): """ :keyword day: The day of the week. Known values are: "Sunday", "Monday", "Tuesday", - "Wednesday", "Thursday", "Friday", "Saturday". + "Wednesday", "Thursday", "Friday", and "Saturday". :paramtype day: str or ~azure.mgmt.containerservice.v2021_08_01.models.WeekDay :keyword hour_slots: Each integer hour represents a time range beginning at 0m after the hour ending at the next hour (non-inclusive). 0 corresponds to 00:00 UTC, 23 corresponds to 23:00 UTC. Specifying [0, 1] means the 00:00 - 02:00 UTC time range. :paramtype hour_slots: list[int] """ - super(TimeInWeek, self).__init__(**kwargs) + super().__init__(**kwargs) self.day = day self.hour_slots = hour_slots -class TimeSpan(msrest.serialization.Model): +class TimeSpan(_serialization.Model): """For example, between 2021-05-25T13:00:00Z and 2021-05-25T14:00:00Z. :ivar start: The start of a time span. @@ -5576,23 +5410,17 @@ class TimeSpan(msrest.serialization.Model): """ _attribute_map = { - 'start': {'key': 'start', 'type': 'iso-8601'}, - 'end': {'key': 'end', 'type': 'iso-8601'}, + "start": {"key": "start", "type": "iso-8601"}, + "end": {"key": "end", "type": "iso-8601"}, } - def __init__( - self, - *, - start: Optional[datetime.datetime] = None, - end: Optional[datetime.datetime] = None, - **kwargs - ): + def __init__(self, *, start: Optional[datetime.datetime] = None, end: Optional[datetime.datetime] = None, **kwargs): """ :keyword start: The start of a time span. :paramtype start: ~datetime.datetime :keyword end: The end of a time span. :paramtype end: ~datetime.datetime """ - super(TimeSpan, self).__init__(**kwargs) + super().__init__(**kwargs) self.start = start self.end = end diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/models/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/models/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/models/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/models/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/operations/__init__.py index e0748876288c..593b23075ce0 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/operations/__init__.py @@ -18,15 +18,16 @@ from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'Operations', - 'ManagedClustersOperations', - 'MaintenanceConfigurationsOperations', - 'AgentPoolsOperations', - 'PrivateEndpointConnectionsOperations', - 'PrivateLinkResourcesOperations', - 'ResolvePrivateLinkServiceIdOperations', - 'SnapshotsOperations', + "Operations", + "ManagedClustersOperations", + "MaintenanceConfigurationsOperations", + "AgentPoolsOperations", + "PrivateEndpointConnectionsOperations", + "PrivateLinkResourcesOperations", + "ResolvePrivateLinkServiceIdOperations", + "SnapshotsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/operations/_agent_pools_operations.py index 1a95ffc16d08..683ce9c6cd80 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/operations/_agent_pools_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,288 +27,289 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - *, - json: Optional[_models.AgentPool] = None, - content: Any = None, - **kwargs: Any + _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, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + _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, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_get_upgrade_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_available_agent_pool_versions_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_upgrade_node_image_version_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_upgrade_node_image_version_request( + resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class AgentPoolsOperations: """ @@ -324,47 +330,39 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> Iterable[_models.AgentPoolListResult]: + def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> Iterable["_models.AgentPool"]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AgentPoolListResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_08_01.models.AgentPoolListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either AgentPool or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_08_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -372,16 +370,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -397,10 +390,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -410,54 +401,45 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore @distributed_trace def get( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPool: """Gets the specified managed cluster agent pool. Gets the specified managed cluster agent pool. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPool, or the result of cls(response) + :return: AgentPool or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.AgentPool - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -465,57 +447,60 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore def _create_or_update_initial( self, resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: _models.AgentPool, + parameters: Union[_models.AgentPool, IO], **kwargs: Any ) -> _models.AgentPool: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - _json = self._serialize.body(parameters, 'AgentPool') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "AgentPool") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -523,10 +508,9 @@ def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -534,40 +518,84 @@ def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - @distributed_trace + @overload def begin_create_or_update( self, resource_group_name: str, resource_name: str, agent_pool_name: str, parameters: _models.AgentPool, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.AgentPool]: """Creates or updates an agent pool in the specified managed cluster. Creates or updates an agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str - :param parameters: The agent pool to create or update. + :param parameters: The agent pool to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2021_08_01.models.AgentPool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_08_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AgentPool]: + """Creates or updates an agent pool in the specified managed cluster. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: The agent pool to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -579,20 +607,56 @@ def begin_create_or_update( :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_08_01.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: Union[_models.AgentPool, IO], + **kwargs: Any + ) -> LROPoller[_models.AgentPool]: + """Creates or updates an agent pool in the specified managed cluster. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: The agent pool to create or update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.mgmt.containerservice.v2021_08_01.models.AgentPool or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_08_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -601,66 +665,55 @@ def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -668,10 +721,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -681,26 +733,21 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + def begin_delete( + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> LROPoller[None]: """Deletes an agent pool in the specified managed cluster. Deletes an agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -712,99 +759,85 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPoolUpgradeProfile: """Gets the upgrade profile for an agent pool. Gets the upgrade profile for an agent pool. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolUpgradeProfile, or the result of cls(response) + :return: AgentPoolUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.AgentPoolUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -812,32 +845,27 @@ def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolUpgradeProfile', pipeline_response) + deserialized = self._deserialize("AgentPoolUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore @distributed_trace def get_available_agent_pool_versions( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported Kubernetes versions for the specified agent pool. @@ -845,33 +873,30 @@ def get_available_agent_pool_versions( `_ for more details about the version lifecycle. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolAvailableVersions, or the result of cls(response) + :return: AgentPoolAvailableVersions or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.AgentPoolAvailableVersions - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolAvailableVersions] - request = build_get_available_agent_pool_versions_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_available_agent_pool_versions.metadata['url'], + template_url=self.get_available_agent_pool_versions.metadata["url"], headers=_headers, params=_params, ) @@ -879,52 +904,43 @@ def get_available_agent_pool_versions( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolAvailableVersions', pipeline_response) + deserialized = self._deserialize("AgentPoolAvailableVersions", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_available_agent_pool_versions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore - + get_available_agent_pool_versions.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore def _upgrade_node_image_version_initial( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> Optional[_models.AgentPool]: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.AgentPool]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.AgentPool]] - - request = build_upgrade_node_image_version_request_initial( - subscription_id=self._config.subscription_id, + request = build_upgrade_node_image_version_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._upgrade_node_image_version_initial.metadata['url'], + template_url=self._upgrade_node_image_version_initial.metadata["url"], headers=_headers, params=_params, ) @@ -932,10 +948,9 @@ def _upgrade_node_image_version_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -944,35 +959,30 @@ def _upgrade_node_image_version_initial( deserialized = None if response.status_code == 202: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _upgrade_node_image_version_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore - + _upgrade_node_image_version_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore @distributed_trace def begin_upgrade_node_image_version( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any - ) -> LROPoller[_models.AgentPool]: + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any + ) -> LROPoller[None]: """Upgrades the node image version of an agent pool to the latest. Upgrading the node image version of an agent pool applies the newest OS and runtime updates to the nodes. AKS provides one new image per week with the latest updates. For more details on node image versions, see: https://docs.microsoft.com/azure/aks/node-image-upgrade. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -985,55 +995,48 @@ def begin_upgrade_node_image_version( :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_08_01.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._upgrade_node_image_version_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_upgrade_node_image_version.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore + begin_upgrade_node_image_version.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/operations/_maintenance_configurations_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/operations/_maintenance_configurations_operations.py index cc5b8afdf7da..56a77c168927 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/operations/_maintenance_configurations_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/operations/_maintenance_configurations_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,173 +25,173 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +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_managed_cluster_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, config_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 = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "configName": _SERIALIZER.url("config_name", config_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "configName": _SERIALIZER.url("config_name", config_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - config_name: str, - *, - json: Optional[_models.MaintenanceConfiguration] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, resource_name: str, config_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 = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "configName": _SERIALIZER.url("config_name", config_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "configName": _SERIALIZER.url("config_name", config_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, config_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 = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "configName": _SERIALIZER.url("config_name", config_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "configName": _SERIALIZER.url("config_name", config_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class MaintenanceConfigurationsOperations: """ @@ -207,48 +212,43 @@ def __init__(self, *args, **kwargs): 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_managed_cluster( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> Iterable[_models.MaintenanceConfigurationListResult]: + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> Iterable["_models.MaintenanceConfiguration"]: """Gets a list of maintenance configurations in the specified managed cluster. Gets a list of maintenance configurations in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either MaintenanceConfigurationListResult or the result - of cls(response) + :return: An iterator like instance of either MaintenanceConfiguration or the result of + cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_08_01.models.MaintenanceConfigurationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_08_01.models.MaintenanceConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfigurationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfigurationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_managed_cluster_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_managed_cluster.metadata['url'], + template_url=self.list_by_managed_cluster.metadata["url"], headers=_headers, params=_params, ) @@ -256,16 +256,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_managed_cluster_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -281,10 +276,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -294,54 +287,45 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_managed_cluster.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations"} # type: ignore + list_by_managed_cluster.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations"} # type: ignore @distributed_trace def get( - self, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, config_name: str, **kwargs: Any ) -> _models.MaintenanceConfiguration: """Gets the specified maintenance configuration of a managed cluster. Gets the specified maintenance configuration of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: MaintenanceConfiguration, or the result of cls(response) + :return: MaintenanceConfiguration or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.MaintenanceConfiguration - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfiguration] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -349,75 +333,147 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) + deserialized = self._deserialize("MaintenanceConfiguration", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - @distributed_trace + @overload def create_or_update( self, resource_group_name: str, resource_name: str, config_name: str, parameters: _models.MaintenanceConfiguration, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.MaintenanceConfiguration: """Creates or updates a maintenance configuration in the specified managed cluster. Creates or updates a maintenance configuration in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str - :param parameters: The maintenance configuration to create or update. + :param parameters: The maintenance configuration to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2021_08_01.models.MaintenanceConfiguration + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: MaintenanceConfiguration, or the result of cls(response) + :return: MaintenanceConfiguration or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.MaintenanceConfiguration - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configuration in the specified managed cluster. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: The maintenance configuration to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: Union[_models.MaintenanceConfiguration, IO], + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configuration in the specified managed cluster. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: The maintenance configuration to create or update. Is either a model type or + a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_08_01.models.MaintenanceConfiguration or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfiguration] - _json = self._serialize.body(parameters, 'MaintenanceConfiguration') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "MaintenanceConfiguration") request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) @@ -425,68 +481,59 @@ def create_or_update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) + deserialized = self._deserialize("MaintenanceConfiguration", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore @distributed_trace def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, config_name: str, **kwargs: Any ) -> None: """Deletes a maintenance configuration. Deletes a maintenance configuration. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) @@ -494,10 +541,9 @@ def delete( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -507,5 +553,4 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/operations/_managed_clusters_operations.py index ac037a8d73f9..c7af6f715abc 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/operations/_managed_clusters_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,200 +27,183 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_get_os_options_request( - subscription_id: str, - location: str, - *, - resource_type: Optional[str] = None, - **kwargs: Any + location: str, subscription_id: str, *, resource_type: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "location": _SERIALIZER.url("location", location, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if resource_type is not None: - _params['resource-type'] = _SERIALIZER.query("resource_type", resource_type, 'str') + _params["resource-type"] = _SERIALIZER.query("resource_type", resource_type, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters") + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters" + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_resource_group_request( - subscription_id: str, - resource_group_name: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters", + ) # 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', min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_upgrade_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_access_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, role_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 = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "roleName": _SERIALIZER.url("role_name", role_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "roleName": _SERIALIZER.url("role_name", role_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_admin_credentials_request( - subscription_id: str, resource_group_name: str, resource_name: str, + subscription_id: str, *, server_fqdn: Optional[str] = None, **kwargs: Any @@ -223,40 +211,44 @@ def build_list_cluster_admin_credentials_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if server_fqdn is not None: - _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + _params["server-fqdn"] = _SERIALIZER.query("server_fqdn", server_fqdn, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_user_credentials_request( - subscription_id: str, resource_group_name: str, resource_name: str, + subscription_id: str, *, server_fqdn: Optional[str] = None, **kwargs: Any @@ -264,40 +256,44 @@ def build_list_cluster_user_credentials_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if server_fqdn is not None: - _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + _params["server-fqdn"] = _SERIALIZER.query("server_fqdn", server_fqdn, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_monitoring_user_credentials_request( - subscription_id: str, resource_group_name: str, resource_name: str, + subscription_id: str, *, server_fqdn: Optional[str] = None, **kwargs: Any @@ -305,520 +301,509 @@ def build_list_cluster_monitoring_user_credentials_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if server_fqdn is not None: - _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + _params["server-fqdn"] = _SERIALIZER.query("server_fqdn", server_fqdn, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: + +def build_get_request(resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedCluster] = None, - content: Any = None, - **kwargs: Any + +def build_create_or_update_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_update_tags_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.TagsObject] = None, - content: Any = None, - **kwargs: Any + +def build_update_tags_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + +def build_delete_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_reset_service_principal_profile_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedClusterServicePrincipalProfile] = None, - content: Any = None, - **kwargs: Any + +def build_reset_service_principal_profile_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_reset_aad_profile_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedClusterAADProfile] = None, - content: Any = None, - **kwargs: Any + +def build_reset_aad_profile_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_rotate_cluster_certificates_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + +def build_rotate_cluster_certificates_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_stop_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + +def build_stop_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_start_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + +def build_start_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_run_command_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.RunCommandRequest] = None, - content: Any = None, - **kwargs: Any + +def build_run_command_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_get_command_result_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - command_id: str, - **kwargs: Any + resource_group_name: str, resource_name: str, command_id: 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "commandId": _SERIALIZER.url("command_id", command_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "commandId": _SERIALIZER.url("command_id", command_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_list_outbound_network_dependencies_endpoints_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + class ManagedClustersOperations: # pylint: disable=too-many-public-methods """ @@ -839,46 +824,39 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def get_os_options( - self, - location: str, - resource_type: Optional[str] = None, - **kwargs: Any + self, location: str, resource_type: Optional[str] = None, **kwargs: Any ) -> _models.OSOptionProfile: """Gets supported OS options in the specified subscription. Gets supported OS options in the specified subscription. - :param location: The name of a supported Azure region. + :param location: The name of a supported Azure region. Required. :type location: str :param resource_type: The resource type for which the OS options needs to be returned. Default value is None. :type resource_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: OSOptionProfile, or the result of cls(response) + :return: OSOptionProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.OSOptionProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OSOptionProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OSOptionProfile] - request = build_get_os_options_request( - subscription_id=self._config.subscription_id, location=location, - api_version=api_version, + subscription_id=self._config.subscription_id, resource_type=resource_type, - template_url=self.get_os_options.metadata['url'], + api_version=api_version, + template_url=self.get_os_options.metadata["url"], headers=_headers, params=_params, ) @@ -886,59 +864,52 @@ def get_os_options( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('OSOptionProfile', pipeline_response) + deserialized = self._deserialize("OSOptionProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_os_options.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default"} # type: ignore - + get_os_options.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default"} # type: ignore @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.ManagedClusterListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.ManagedCluster"]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_08_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_08_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -946,14 +917,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -969,10 +937,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -982,49 +948,41 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> Iterable[_models.ManagedClusterListResult]: + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.ManagedCluster"]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_08_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_08_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -1032,15 +990,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -1056,10 +1010,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1069,50 +1021,42 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.ManagedClusterUpgradeProfile: """Gets the upgrade profile of a managed cluster. Gets the upgrade profile of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterUpgradeProfile, or the result of cls(response) + :return: ManagedClusterUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.ManagedClusterUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -1120,33 +1064,27 @@ def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterUpgradeProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore @distributed_trace def get_access_profile( - self, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, role_name: str, **kwargs: Any ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. @@ -1155,36 +1093,33 @@ def get_access_profile( `ListClusterAdminCredentials `_ . - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param role_name: The name of the role for managed cluster accessProfile resource. + :param role_name: The name of the role for managed cluster accessProfile resource. Required. :type role_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterAccessProfile, or the result of cls(response) + :return: ManagedClusterAccessProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.ManagedClusterAccessProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterAccessProfile] - request = build_get_access_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, role_name=role_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_access_profile.metadata['url'], + template_url=self.get_access_profile.metadata["url"], headers=_headers, params=_params, ) @@ -1192,68 +1127,59 @@ def get_access_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterAccessProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterAccessProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_access_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore - + get_access_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore @distributed_trace def list_cluster_admin_credentials( - self, - resource_group_name: str, - resource_name: str, - server_fqdn: Optional[str] = None, - **kwargs: Any + self, resource_group_name: str, resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any ) -> _models.CredentialResults: """Lists the admin credentials of a managed cluster. Lists the admin credentials of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_admin_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, - template_url=self.list_cluster_admin_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_admin_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -1261,68 +1187,59 @@ def list_cluster_admin_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_admin_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore - + list_cluster_admin_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore @distributed_trace def list_cluster_user_credentials( - self, - resource_group_name: str, - resource_name: str, - server_fqdn: Optional[str] = None, - **kwargs: Any + self, resource_group_name: str, resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any ) -> _models.CredentialResults: """Lists the user credentials of a managed cluster. Lists the user credentials of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, - template_url=self.list_cluster_user_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -1330,68 +1247,59 @@ def list_cluster_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore - + list_cluster_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore @distributed_trace def list_cluster_monitoring_user_credentials( - self, - resource_group_name: str, - resource_name: str, - server_fqdn: Optional[str] = None, - **kwargs: Any + self, resource_group_name: str, resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any ) -> _models.CredentialResults: """Lists the cluster monitoring user credentials of a managed cluster. Lists the cluster monitoring user credentials of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_monitoring_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, - template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_monitoring_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -1399,64 +1307,54 @@ def list_cluster_monitoring_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_monitoring_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore - + list_cluster_monitoring_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore @distributed_trace - def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.ManagedCluster: + def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.ManagedCluster: """Gets a managed cluster. Gets a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedCluster, or the result of cls(response) + :return: ManagedCluster or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.ManagedCluster - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -1464,55 +1362,54 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _create_or_update_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.ManagedCluster, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'ManagedCluster') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedCluster") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1520,10 +1417,9 @@ def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -1531,37 +1427,41 @@ def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - - @distributed_trace + @overload def begin_create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedCluster, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. Creates or updates a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The managed cluster to create or update. + :param parameters: The managed cluster to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2021_08_01.models.ManagedCluster + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1574,90 +1474,155 @@ def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_08_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._create_or_update_initial( # type: ignore - resource_group_name=resource_group_name, - resource_name=resource_name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop('error_map', None) - def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized + @overload + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + Creates or updates a managed cluster. - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_08_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster to create or update. Is either a model type or a IO + type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_08_01.models.ManagedCluster or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_08_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ManagedCluster", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _update_tags_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.TagsObject, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request_initial( - subscription_id=self._config.subscription_id, + request = build_update_tags_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_tags_initial.metadata['url'], + content=_content, + template_url=self._update_tags_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1665,44 +1630,118 @@ def _update_tags_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_tags_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + _update_tags_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - - @distributed_trace + @overload def begin_update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates tags on a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2021_08_01.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_08_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates tags on a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_08_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates tags on a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_08_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1715,20 +1754,17 @@ def begin_update_tags( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_08_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, @@ -1736,64 +1772,54 @@ def begin_update_tags( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1801,10 +1827,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1814,23 +1839,17 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> LROPoller[None]: + def begin_delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> LROPoller[None]: """Deletes a managed cluster. Deletes a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1842,85 +1861,83 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterServicePrincipalProfile, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterServicePrincipalProfile") - request = build_reset_service_principal_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_service_principal_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_service_principal_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_service_principal_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1928,10 +1945,9 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1941,28 +1957,32 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re if cls: return cls(pipeline_response, None, {}) - _reset_service_principal_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore - + _reset_service_principal_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore - @distributed_trace - def begin_reset_service_principal_profile( # pylint: disable=inconsistent-return-statements + @overload + def begin_reset_service_principal_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterServicePrincipalProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: """Reset the Service Principal Profile of a managed cluster. This action cannot be performed on a cluster that is not using a service principal. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The service principal profile to set on the managed cluster. + :param parameters: The service principal profile to set on the managed cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2021_08_01.models.ManagedClusterServicePrincipalProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1973,20 +1993,89 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reset the Service Principal Profile of a managed cluster. + + This action cannot be performed on a cluster that is not using a service principal. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The service principal profile to set on the managed cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Reset the Service Principal Profile of a managed cluster. + + This action cannot be performed on a cluster that is not using a service principal. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The service principal profile to set on the managed cluster. Is either a + model type or a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2021_08_01.models.ManagedClusterServicePrincipalProfile or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1994,67 +2083,68 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_service_principal_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + begin_reset_service_principal_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterAADProfile, + parameters: Union[_models.ManagedClusterAADProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterAADProfile") - request = build_reset_aad_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_aad_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_aad_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_aad_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2062,10 +2152,9 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -2075,27 +2164,103 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement if cls: return cls(pipeline_response, None, {}) - _reset_aad_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - + _reset_aad_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - @distributed_trace - def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements + @overload + def begin_reset_aad_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterAADProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: """Reset the AAD Profile of a managed cluster. Reset the AAD Profile of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The AAD profile to set on the Managed Cluster. + :param parameters: The AAD profile to set on the Managed Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2021_08_01.models.ManagedClusterAADProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reset the AAD Profile of a managed cluster. + + Reset the AAD Profile of a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The AAD profile to set on the Managed Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterAADProfile, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Reset the AAD Profile of a managed cluster. + + Reset the AAD Profile of a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The AAD profile to set on the Managed Cluster. Is either a model type or a + IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_08_01.models.ManagedClusterAADProfile or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -2106,20 +2271,17 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -2127,62 +2289,52 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_aad_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + begin_reset_aad_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_rotate_cluster_certificates_request_initial( - subscription_id=self._config.subscription_id, + request = build_rotate_cluster_certificates_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._rotate_cluster_certificates_initial.metadata['url'], + template_url=self._rotate_cluster_certificates_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2190,10 +2342,9 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -2203,24 +2354,20 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return if cls: return cls(pipeline_response, None, {}) - _rotate_cluster_certificates_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore - + _rotate_cluster_certificates_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore @distributed_trace - def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + def begin_rotate_cluster_certificates( + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> LROPoller[None]: """Rotates the certificates of a managed cluster. See `Certificate rotation `_ for more details about rotating managed cluster certificates. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -2232,80 +2379,67 @@ def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-st Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._rotate_cluster_certificates_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_rotate_cluster_certificates.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore + begin_rotate_cluster_certificates.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore def _stop_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_stop_request_initial( - subscription_id=self._config.subscription_id, + request = build_stop_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._stop_initial.metadata['url'], + template_url=self._stop_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2313,10 +2447,9 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -2326,16 +2459,10 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore - + _stop_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore @distributed_trace - def begin_stop( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> LROPoller[None]: + def begin_stop(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> LROPoller[None]: """Stops a Managed Cluster. This can only be performed on Azure Virtual Machine Scale set backed clusters. Stopping a @@ -2344,9 +2471,9 @@ def begin_stop( # pylint: disable=inconsistent-return-statements `_ for more details about stopping a cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -2358,80 +2485,67 @@ def begin_stop( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._stop_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore + begin_stop.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore def _start_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_start_request_initial( - subscription_id=self._config.subscription_id, + request = build_start_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._start_initial.metadata['url'], + template_url=self._start_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2439,10 +2553,9 @@ def _start_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -2452,24 +2565,18 @@ def _start_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore - + _start_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore @distributed_trace - def begin_start( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> LROPoller[None]: + def begin_start(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> LROPoller[None]: """Starts a previously stopped Managed Cluster. See `starting a cluster `_ for more details about starting a cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -2481,85 +2588,83 @@ def begin_start( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._start_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore + begin_start.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore def _run_command_initial( self, resource_group_name: str, resource_name: str, - request_payload: _models.RunCommandRequest, + request_payload: Union[_models.RunCommandRequest, IO], **kwargs: Any ) -> Optional[_models.RunCommandResult]: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RunCommandResult]] - _json = self._serialize.body(request_payload, 'RunCommandRequest') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(request_payload, (IO, bytes)): + _content = request_payload + else: + _json = self._serialize.body(request_payload, "RunCommandRequest") - request = build_run_command_request_initial( - subscription_id=self._config.subscription_id, + request = build_run_command_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._run_command_initial.metadata['url'], + content=_content, + template_url=self._run_command_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2567,10 +2672,9 @@ def _run_command_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -2579,22 +2683,23 @@ def _run_command_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _run_command_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore - + _run_command_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore - @distributed_trace + @overload def begin_run_command( self, resource_group_name: str, resource_name: str, request_payload: _models.RunCommandRequest, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.RunCommandResult]: """Submits a command to run against the Managed Cluster. @@ -2603,12 +2708,93 @@ def begin_run_command( more information see `AKS Run Command `_. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param request_payload: The run command request. + :param request_payload: The run command request. Required. :type request_payload: ~azure.mgmt.containerservice.v2021_08_01.models.RunCommandRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either RunCommandResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_08_01.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_run_command( + self, + resource_group_name: str, + resource_name: str, + request_payload: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RunCommandResult]: + """Submits a command to run against the Managed Cluster. + + AKS will create a pod to run the command. This is primarily useful for private clusters. For + more information see `AKS Run Command + `_. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param request_payload: The run command request. Required. + :type request_payload: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either RunCommandResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_08_01.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_run_command( + self, + resource_group_name: str, + resource_name: str, + request_payload: Union[_models.RunCommandRequest, IO], + **kwargs: Any + ) -> LROPoller[_models.RunCommandResult]: + """Submits a command to run against the Managed Cluster. + + AKS will create a pod to run the command. This is primarily useful for private clusters. For + more information see `AKS Run Command + `_. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param request_payload: The run command request. Is either a model type or a IO type. Required. + :type request_payload: ~azure.mgmt.containerservice.v2021_08_01.models.RunCommandRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -2621,20 +2807,17 @@ def begin_run_command( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_08_01.models.RunCommandResult] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.RunCommandResult] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.RunCommandResult] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._run_command_initial( # type: ignore resource_group_name=resource_group_name, @@ -2642,82 +2825,71 @@ def begin_run_command( request_payload=request_payload, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_run_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore + begin_run_command.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore @distributed_trace def get_command_result( - self, - resource_group_name: str, - resource_name: str, - command_id: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, command_id: str, **kwargs: Any ) -> Optional[_models.RunCommandResult]: """Gets the results of a command which has been run on the Managed Cluster. Gets the results of a command which has been run on the Managed Cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param command_id: Id of the command. + :param command_id: Id of the command. Required. :type command_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: RunCommandResult, or the result of cls(response) + :return: RunCommandResult or None or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.RunCommandResult or None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RunCommandResult]] - request = build_get_command_result_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, command_id=command_id, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_command_result.metadata['url'], + template_url=self.get_command_result.metadata["url"], headers=_headers, params=_params, ) @@ -2725,10 +2897,9 @@ def get_command_result( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -2737,59 +2908,54 @@ def get_command_result( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_command_result.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}"} # type: ignore - + get_command_result.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}"} # type: ignore @distributed_trace def list_outbound_network_dependencies_endpoints( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> Iterable[_models.OutboundEnvironmentEndpointCollection]: + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> Iterable["_models.OutboundEnvironmentEndpoint"]: """Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster. Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster. The operation returns properties of each egress endpoint. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OutboundEnvironmentEndpointCollection or the - result of cls(response) + :return: An iterator like instance of either OutboundEnvironmentEndpoint or the result of + cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_08_01.models.OutboundEnvironmentEndpointCollection] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_08_01.models.OutboundEnvironmentEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_outbound_network_dependencies_endpoints_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_outbound_network_dependencies_endpoints.metadata['url'], + template_url=self.list_outbound_network_dependencies_endpoints.metadata["url"], headers=_headers, params=_params, ) @@ -2797,16 +2963,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_outbound_network_dependencies_endpoints_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -2822,10 +2983,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2835,8 +2994,6 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_outbound_network_dependencies_endpoints.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints"} # type: ignore + list_outbound_network_dependencies_endpoints.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/operations/_operations.py index c4b2bd11ec2c..ea2e1ed036af 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/operations/_operations.py @@ -7,10 +7,15 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,38 +25,34 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - **kwargs: Any -) -> HttpRequest: + +def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.ContainerService/operations") # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class Operations: """ @@ -72,38 +73,33 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.OperationListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.OperationValue"]: """Gets a list of operations. Gets a list of operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationListResult or the result of cls(response) + :return: An iterator like instance of either OperationValue or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_08_01.models.OperationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_08_01.models.OperationValue] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -111,13 +107,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -133,10 +127,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -146,8 +138,6 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.ContainerService/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ContainerService/operations"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/operations/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/operations/_private_endpoint_connections_operations.py index fe0a196e3d2b..7a1d52b9b840 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/operations/_private_endpoint_connections_operations.py @@ -6,11 +6,15 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod @@ -21,173 +25,191 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - subscription_id: str, resource_group_name: str, resource_name: str, private_endpoint_connection_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 = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_update_request( - subscription_id: str, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, - *, - json: Optional[_models.PrivateEndpointConnection] = None, - content: Any = None, + subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request_initial( - subscription_id: str, +def build_delete_request( resource_group_name: str, resource_name: str, private_endpoint_connection_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 = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class PrivateEndpointConnectionsOperations: """ @@ -208,46 +230,39 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnectionListResult: """Gets a list of private endpoint connections in the specified managed cluster. To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnectionListResult, or the result of cls(response) + :return: PrivateEndpointConnectionListResult or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.PrivateEndpointConnectionListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnectionListResult] - request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -255,69 +270,60 @@ def list( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore - + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore @distributed_trace def get( - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnection: """Gets the specified private endpoint connection. To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -325,75 +331,147 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - - @distributed_trace + @overload def update( self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, parameters: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateEndpointConnection: """Updates a private endpoint connection. Updates a private endpoint connection. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str - :param parameters: The updated private endpoint connection. + :param parameters: The updated private endpoint connection. Required. :type parameters: ~azure.mgmt.containerservice.v2021_08_01.models.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: The updated private endpoint connection. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: Union[_models.PrivateEndpointConnection, IO], + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: The updated private endpoint connection. Is either a model type or a IO + type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_08_01.models.PrivateEndpointConnection or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - _json = self._serialize.body(parameters, 'PrivateEndpointConnection') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateEndpointConnection") request = build_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update.metadata['url'], + content=_content, + template_url=self.update.metadata["url"], headers=_headers, params=_params, ) @@ -401,52 +479,43 @@ def update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -454,10 +523,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -467,26 +535,21 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + def begin_delete( + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> LROPoller[None]: """Deletes a private endpoint connection. Deletes a private endpoint connection. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -498,53 +561,46 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/operations/_private_link_resources_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/operations/_private_link_resources_operations.py index 4a007d8ee85e..4914c2ac36d4 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/operations/_private_link_resources_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/operations/_private_link_resources_operations.py @@ -8,9 +8,13 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -19,48 +23,53 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class PrivateLinkResourcesOperations: """ @@ -81,46 +90,39 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.PrivateLinkResourcesListResult: """Gets a list of private link resources in the specified managed cluster. To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResourcesListResult, or the result of cls(response) + :return: PrivateLinkResourcesListResult or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.PrivateLinkResourcesListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResourcesListResult] - request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -128,22 +130,20 @@ def list( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResourcesListResult', pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources"} # type: ignore - + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/operations/_resolve_private_link_service_id_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/operations/_resolve_private_link_service_id_operations.py index 43970231f11f..9b106dafe2b7 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/operations/_resolve_private_link_service_id_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/operations/_resolve_private_link_service_id_operations.py @@ -6,11 +6,15 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -19,56 +23,56 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_post_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.PrivateLinkResource] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + class ResolvePrivateLinkServiceIdOperations: """ @@ -89,52 +93,118 @@ def __init__(self, *args, **kwargs): 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 + @overload def post( self, resource_group_name: str, resource_name: str, parameters: _models.PrivateLinkResource, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateLinkResource: """Gets the private link service ID for the specified managed cluster. Gets the private link service ID for the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters required in order to resolve a private link service ID. + :param parameters: Parameters required in order to resolve a private link service ID. Required. :type parameters: ~azure.mgmt.containerservice.v2021_08_01.models.PrivateLinkResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResource, or the result of cls(response) + :return: PrivateLinkResource or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.PrivateLinkResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + def post( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID for the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters required in order to resolve a private link service ID. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def post( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.PrivateLinkResource, IO], + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID for the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters required in order to resolve a private link service ID. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_08_01.models.PrivateLinkResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResource] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResource] - _json = self._serialize.body(parameters, 'PrivateLinkResource') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateLinkResource") request = build_post_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.post.metadata['url'], + content=_content, + template_url=self.post.metadata["url"], headers=_headers, params=_params, ) @@ -142,22 +212,20 @@ def post( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResource', pipeline_response) + deserialized = self._deserialize("PrivateLinkResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - post.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId"} # type: ignore - + post.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/operations/_snapshots_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/operations/_snapshots_operations.py index f43d362a5095..5542ecab3886 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/operations/_snapshots_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/operations/_snapshots_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,243 +25,223 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots") path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_resource_group_request( - subscription_id: str, - resource_group_name: str, - **kwargs: Any -) -> HttpRequest: +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots", + ) # 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', min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: + _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, resource_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.Snapshot] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_update_tags_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.TagsObject] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class SnapshotsOperations: """ @@ -277,39 +262,33 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.SnapshotListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.Snapshot"]: """Gets a list of snapshots in the specified subscription. Gets a list of snapshots in the specified subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SnapshotListResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_08_01.models.SnapshotListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either Snapshot or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_08_01.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SnapshotListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -317,14 +296,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -340,10 +316,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -353,48 +327,40 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots"} # type: ignore @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> Iterable[_models.SnapshotListResult]: + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Snapshot"]: """Lists snapshots in the specified subscription and resource group. Lists snapshots in the specified subscription and resource group. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SnapshotListResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_08_01.models.SnapshotListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either Snapshot or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_08_01.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SnapshotListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -402,15 +368,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -426,10 +388,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -439,50 +399,40 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots"} # type: ignore @distributed_trace - def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.Snapshot: + def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.Snapshot: """Gets a snapshot. Gets a snapshot. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Snapshot, or the result of cls(response) + :return: Snapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.Snapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -490,71 +440,132 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - @distributed_trace + @overload def create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.Snapshot, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.Snapshot: """Creates or updates a snapshot. Creates or updates a snapshot. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The snapshot to create or update. + :param parameters: The snapshot to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2021_08_01.models.Snapshot + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Snapshot, or the result of cls(response) + :return: Snapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.Snapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Snapshot: + """Creates or updates a snapshot. + + Creates or updates a snapshot. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The snapshot to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.Snapshot, IO], **kwargs: Any + ) -> _models.Snapshot: + """Creates or updates a snapshot. + + Creates or updates a snapshot. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The snapshot to create or update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.mgmt.containerservice.v2021_08_01.models.Snapshot or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] - _json = self._serialize.body(parameters, 'Snapshot') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "Snapshot") request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) @@ -562,10 +573,9 @@ def create_or_update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -573,64 +583,126 @@ def create_or_update( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - - @distributed_trace + @overload def update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.Snapshot: """Updates tags on a snapshot. Updates tags on a snapshot. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update snapshot Tags operation. + :param parameters: Parameters supplied to the Update snapshot Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2021_08_01.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Snapshot, or the result of cls(response) + :return: Snapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.Snapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + def update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Snapshot: + """Updates tags on a snapshot. + + Updates tags on a snapshot. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update snapshot Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> _models.Snapshot: + """Updates tags on a snapshot. + + Updates tags on a snapshot. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update snapshot Tags operation. Is either a model + type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_08_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") request = build_update_tags_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_tags.metadata['url'], + content=_content, + template_url=self.update_tags.metadata["url"], headers=_headers, params=_params, ) @@ -638,64 +710,56 @@ def update_tags( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - + update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore @distributed_trace def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: """Deletes a snapshot. Deletes a snapshot. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) @@ -703,10 +767,9 @@ def delete( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -716,5 +779,4 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - + delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/__init__.py index 37a5f9e02e6f..a8716d29afe8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/__init__.py @@ -14,7 +14,8 @@ except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['ContainerServiceClient'] + +__all__ = ["ContainerServiceClient"] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/_configuration.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/_configuration.py index 6656a7b295de..ac6d2d3bda88 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/_configuration.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/_configuration.py @@ -18,30 +18,26 @@ VERSION = "unknown" + class ContainerServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ContainerServiceClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2021-09-01". 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: + def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ContainerServiceClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + api_version = kwargs.pop("api_version", "2021-09-01") # type: str if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -51,23 +47,24 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-containerservice/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-containerservice/{}".format(VERSION)) self._configure(**kwargs) def _configure( - self, - **kwargs # type: Any + self, **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/_container_service_client.py index 43c1504691b8..96e46384d2b7 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/_container_service_client.py @@ -9,20 +9,29 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from . import models +from .._serialization import Deserializer, Serializer from ._configuration import ContainerServiceClientConfiguration -from .operations import AgentPoolsOperations, MaintenanceConfigurationsOperations, ManagedClustersOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, ResolvePrivateLinkServiceIdOperations, SnapshotsOperations +from .operations import ( + AgentPoolsOperations, + MaintenanceConfigurationsOperations, + ManagedClustersOperations, + Operations, + PrivateEndpointConnectionsOperations, + PrivateLinkResourcesOperations, + ResolvePrivateLinkServiceIdOperations, + SnapshotsOperations, +) if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class ContainerServiceClient: # pylint: disable=too-many-instance-attributes + +class ContainerServiceClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """The Container Service Client. :ivar operations: Operations operations @@ -46,10 +55,10 @@ class ContainerServiceClient: # pylint: disable=too-many-instance-attributes azure.mgmt.containerservice.v2021_09_01.operations.ResolvePrivateLinkServiceIdOperations :ivar snapshots: SnapshotsOperations operations :vartype snapshots: azure.mgmt.containerservice.v2021_09_01.operations.SnapshotsOperations - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -67,25 +76,23 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = ContainerServiceClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = ContainerServiceClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize - ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.managed_clusters = ManagedClustersOperations( self._client, self._config, self._serialize, self._deserialize ) self.maintenance_configurations = MaintenanceConfigurationsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.agent_pools = AgentPoolsOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) self.private_endpoint_connections = PrivateEndpointConnectionsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -95,16 +102,9 @@ def __init__( self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations( self._client, self._config, self._serialize, self._deserialize ) - self.snapshots = SnapshotsOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.snapshots = SnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) - - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> HttpResponse: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -113,7 +113,7 @@ def _send_request( >>> response = client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/_metadata.json b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/_metadata.json index ab23fcd8cf27..9a79ea8f5d93 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/_metadata.json +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/_metadata.json @@ -10,20 +10,20 @@ "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { "credential": { - "signature": "credential, # type: \"TokenCredential\"", - "description": "Credential needed for the client to connect to Azure.", + "signature": "credential: \"TokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true }, "subscription_id": { - "signature": "subscription_id, # type: str", - "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "signature": "subscription_id: str,", + "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.", "docstring_type": "str", "required": true } @@ -31,13 +31,13 @@ "async": { "credential": { "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure.", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { "signature": "subscription_id: str,", - "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.", "docstring_type": "str", "required": true } @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=\"https://management.azure.com\", # type: str", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/_patch.py index 74e48ecd07cf..f99e77fef986 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/_patch.py @@ -28,4 +28,4 @@ # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + pass diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/_vendor.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/_vendor.py index 138f663c53a4..9aad73fc743e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/_vendor.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/_vendor.py @@ -7,6 +7,7 @@ from azure.core.pipeline.transport import HttpRequest + def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) @@ -14,6 +15,7 @@ def _convert_request(request, files=None): request.set_formdata_body(files) return request + def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -21,7 +23,5 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [ - c for c in formatted_components if "{}".format(key.args[0]) not in c - ] + components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/__init__.py index 37a5f9e02e6f..a8716d29afe8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/__init__.py @@ -14,7 +14,8 @@ except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['ContainerServiceClient'] + +__all__ = ["ContainerServiceClient"] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/_configuration.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/_configuration.py index 9f7706b8d08c..c7d1d81e8142 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/_configuration.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/_configuration.py @@ -18,30 +18,26 @@ VERSION = "unknown" + class ContainerServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ContainerServiceClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2021-09-01". 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: + def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ContainerServiceClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + api_version = kwargs.pop("api_version", "2021-09-01") # type: str if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -51,22 +47,21 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-containerservice/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-containerservice/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, - **kwargs: Any - ) -> None: - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/_container_service_client.py index 97f6400f0688..8df55fc95899 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/_container_service_client.py @@ -9,20 +9,29 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from .. import models +from ..._serialization import Deserializer, Serializer from ._configuration import ContainerServiceClientConfiguration -from .operations import AgentPoolsOperations, MaintenanceConfigurationsOperations, ManagedClustersOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, ResolvePrivateLinkServiceIdOperations, SnapshotsOperations +from .operations import ( + AgentPoolsOperations, + MaintenanceConfigurationsOperations, + ManagedClustersOperations, + Operations, + PrivateEndpointConnectionsOperations, + PrivateLinkResourcesOperations, + ResolvePrivateLinkServiceIdOperations, + SnapshotsOperations, +) if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class ContainerServiceClient: # pylint: disable=too-many-instance-attributes + +class ContainerServiceClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """The Container Service Client. :ivar operations: Operations operations @@ -47,10 +56,10 @@ class ContainerServiceClient: # pylint: disable=too-many-instance-attributes azure.mgmt.containerservice.v2021_09_01.aio.operations.ResolvePrivateLinkServiceIdOperations :ivar snapshots: SnapshotsOperations operations :vartype snapshots: azure.mgmt.containerservice.v2021_09_01.aio.operations.SnapshotsOperations - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -68,25 +77,23 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = ContainerServiceClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = ContainerServiceClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize - ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.managed_clusters = ManagedClustersOperations( self._client, self._config, self._serialize, self._deserialize ) self.maintenance_configurations = MaintenanceConfigurationsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.agent_pools = AgentPoolsOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) self.private_endpoint_connections = PrivateEndpointConnectionsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -96,16 +103,9 @@ def __init__( self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations( self._client, self._config, self._serialize, self._deserialize ) - self.snapshots = SnapshotsOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.snapshots = SnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) - - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -114,7 +114,7 @@ def _send_request( >>> response = await client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/_patch.py index 74e48ecd07cf..f99e77fef986 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/_patch.py @@ -28,4 +28,4 @@ # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + pass diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/operations/__init__.py index e0748876288c..593b23075ce0 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/operations/__init__.py @@ -18,15 +18,16 @@ from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'Operations', - 'ManagedClustersOperations', - 'MaintenanceConfigurationsOperations', - 'AgentPoolsOperations', - 'PrivateEndpointConnectionsOperations', - 'PrivateLinkResourcesOperations', - 'ResolvePrivateLinkServiceIdOperations', - 'SnapshotsOperations', + "Operations", + "ManagedClustersOperations", + "MaintenanceConfigurationsOperations", + "AgentPoolsOperations", + "PrivateEndpointConnectionsOperations", + "PrivateLinkResourcesOperations", + "ResolvePrivateLinkServiceIdOperations", + "SnapshotsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/operations/_agent_pools_operations.py index cfdcdb425447..3be311b94cfa 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/operations/_agent_pools_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +29,20 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._agent_pools_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_available_agent_pool_versions_request, build_get_request, build_get_upgrade_profile_request, build_list_request, build_upgrade_node_image_version_request_initial -T = TypeVar('T') +from ...operations._agent_pools_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_available_agent_pool_versions_request, + build_get_request, + build_get_upgrade_profile_request, + build_list_request, + build_upgrade_node_image_version_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class AgentPoolsOperations: """ .. warning:: @@ -45,47 +62,40 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.AgentPoolListResult]: + def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncIterable["_models.AgentPool"]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AgentPoolListResult or the result of cls(response) + :return: An iterator like instance of either AgentPool or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_09_01.models.AgentPoolListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_09_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -93,16 +103,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -118,10 +123,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -131,54 +134,45 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore @distributed_trace_async async def get( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPool: """Gets the specified managed cluster agent pool. Gets the specified managed cluster agent pool. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPool, or the result of cls(response) + :return: AgentPool or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.AgentPool - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -186,57 +180,60 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore async def _create_or_update_initial( self, resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: _models.AgentPool, + parameters: Union[_models.AgentPool, IO], **kwargs: Any ) -> _models.AgentPool: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - _json = self._serialize.body(parameters, 'AgentPool') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "AgentPool") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -244,10 +241,9 @@ async def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -255,40 +251,44 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - @distributed_trace_async + @overload async def begin_create_or_update( self, resource_group_name: str, resource_name: str, agent_pool_name: str, parameters: _models.AgentPool, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.AgentPool]: """Creates or updates an agent pool in the specified managed cluster. Creates or updates an agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str - :param parameters: The agent pool to create or update. + :param parameters: The agent pool to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2021_09_01.models.AgentPool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -301,20 +301,98 @@ async def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_09_01.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AgentPool]: + """Creates or updates an agent pool in the specified managed cluster. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: The agent pool to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AgentPool or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_09_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: Union[_models.AgentPool, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.AgentPool]: + """Creates or updates an agent pool in the specified managed cluster. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: The agent pool to create or update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.mgmt.containerservice.v2021_09_01.models.AgentPool or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AgentPool or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_09_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -323,66 +401,55 @@ async def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -390,10 +457,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -403,26 +469,21 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + async def begin_delete( + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes an agent pool in the specified managed cluster. Deletes an agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -434,99 +495,85 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace_async async def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPoolUpgradeProfile: """Gets the upgrade profile for an agent pool. Gets the upgrade profile for an agent pool. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolUpgradeProfile, or the result of cls(response) + :return: AgentPoolUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.AgentPoolUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -534,32 +581,27 @@ async def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolUpgradeProfile', pipeline_response) + deserialized = self._deserialize("AgentPoolUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore @distributed_trace_async async def get_available_agent_pool_versions( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported Kubernetes versions for the specified agent pool. @@ -567,33 +609,30 @@ async def get_available_agent_pool_versions( `_ for more details about the version lifecycle. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolAvailableVersions, or the result of cls(response) + :return: AgentPoolAvailableVersions or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.AgentPoolAvailableVersions - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolAvailableVersions] - request = build_get_available_agent_pool_versions_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_available_agent_pool_versions.metadata['url'], + template_url=self.get_available_agent_pool_versions.metadata["url"], headers=_headers, params=_params, ) @@ -601,52 +640,43 @@ async def get_available_agent_pool_versions( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolAvailableVersions', pipeline_response) + deserialized = self._deserialize("AgentPoolAvailableVersions", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_available_agent_pool_versions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore - + get_available_agent_pool_versions.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore async def _upgrade_node_image_version_initial( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> Optional[_models.AgentPool]: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.AgentPool]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.AgentPool]] - - request = build_upgrade_node_image_version_request_initial( - subscription_id=self._config.subscription_id, + request = build_upgrade_node_image_version_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._upgrade_node_image_version_initial.metadata['url'], + template_url=self._upgrade_node_image_version_initial.metadata["url"], headers=_headers, params=_params, ) @@ -654,10 +684,9 @@ async def _upgrade_node_image_version_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -666,35 +695,30 @@ async def _upgrade_node_image_version_initial( deserialized = None if response.status_code == 202: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _upgrade_node_image_version_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore - + _upgrade_node_image_version_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore @distributed_trace_async async def begin_upgrade_node_image_version( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any - ) -> AsyncLROPoller[_models.AgentPool]: + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: """Upgrades the node image version of an agent pool to the latest. Upgrading the node image version of an agent pool applies the newest OS and runtime updates to the nodes. AKS provides one new image per week with the latest updates. For more details on node image versions, see: https://docs.microsoft.com/azure/aks/node-image-upgrade. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -708,55 +732,48 @@ async def begin_upgrade_node_image_version( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_09_01.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._upgrade_node_image_version_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_upgrade_node_image_version.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore + begin_upgrade_node_image_version.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/operations/_maintenance_configurations_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/operations/_maintenance_configurations_operations.py index 402d7c501a2b..df1d1491a5df 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/operations/_maintenance_configurations_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/operations/_maintenance_configurations_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,10 +27,17 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._maintenance_configurations_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_managed_cluster_request -T = TypeVar('T') +from ...operations._maintenance_configurations_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_managed_cluster_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class MaintenanceConfigurationsOperations: """ .. warning:: @@ -43,48 +57,43 @@ def __init__(self, *args, **kwargs) -> None: 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_managed_cluster( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.MaintenanceConfigurationListResult]: + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> AsyncIterable["_models.MaintenanceConfiguration"]: """Gets a list of maintenance configurations in the specified managed cluster. Gets a list of maintenance configurations in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either MaintenanceConfigurationListResult or the result - of cls(response) + :return: An iterator like instance of either MaintenanceConfiguration or the result of + cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_09_01.models.MaintenanceConfigurationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_09_01.models.MaintenanceConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfigurationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfigurationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_managed_cluster_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_managed_cluster.metadata['url'], + template_url=self.list_by_managed_cluster.metadata["url"], headers=_headers, params=_params, ) @@ -92,16 +101,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_managed_cluster_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -117,10 +121,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -130,54 +132,45 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_managed_cluster.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations"} # type: ignore + list_by_managed_cluster.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations"} # type: ignore @distributed_trace_async async def get( - self, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, config_name: str, **kwargs: Any ) -> _models.MaintenanceConfiguration: """Gets the specified maintenance configuration of a managed cluster. Gets the specified maintenance configuration of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: MaintenanceConfiguration, or the result of cls(response) + :return: MaintenanceConfiguration or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.MaintenanceConfiguration - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfiguration] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -185,75 +178,147 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) + deserialized = self._deserialize("MaintenanceConfiguration", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - @distributed_trace_async + @overload async def create_or_update( self, resource_group_name: str, resource_name: str, config_name: str, parameters: _models.MaintenanceConfiguration, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.MaintenanceConfiguration: """Creates or updates a maintenance configuration in the specified managed cluster. Creates or updates a maintenance configuration in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str - :param parameters: The maintenance configuration to create or update. + :param parameters: The maintenance configuration to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2021_09_01.models.MaintenanceConfiguration + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: MaintenanceConfiguration, or the result of cls(response) + :return: MaintenanceConfiguration or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.MaintenanceConfiguration - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configuration in the specified managed cluster. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: The maintenance configuration to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: Union[_models.MaintenanceConfiguration, IO], + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configuration in the specified managed cluster. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: The maintenance configuration to create or update. Is either a model type or + a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_09_01.models.MaintenanceConfiguration or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfiguration] - _json = self._serialize.body(parameters, 'MaintenanceConfiguration') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "MaintenanceConfiguration") request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) @@ -261,68 +326,59 @@ async def create_or_update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) + deserialized = self._deserialize("MaintenanceConfiguration", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, config_name: str, **kwargs: Any ) -> None: """Deletes a maintenance configuration. Deletes a maintenance configuration. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) @@ -330,10 +386,9 @@ async def delete( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -343,5 +398,4 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/operations/_managed_clusters_operations.py index b65314b3786e..d2af69e5b227 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/operations/_managed_clusters_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +29,33 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._managed_clusters_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_access_profile_request, build_get_command_result_request, build_get_os_options_request, build_get_request, build_get_upgrade_profile_request, build_list_by_resource_group_request, build_list_cluster_admin_credentials_request, build_list_cluster_monitoring_user_credentials_request, build_list_cluster_user_credentials_request, build_list_outbound_network_dependencies_endpoints_request, build_list_request, build_reset_aad_profile_request_initial, build_reset_service_principal_profile_request_initial, build_rotate_cluster_certificates_request_initial, build_run_command_request_initial, build_start_request_initial, build_stop_request_initial, build_update_tags_request_initial -T = TypeVar('T') +from ...operations._managed_clusters_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_access_profile_request, + build_get_command_result_request, + build_get_os_options_request, + build_get_request, + build_get_upgrade_profile_request, + build_list_by_resource_group_request, + build_list_cluster_admin_credentials_request, + build_list_cluster_monitoring_user_credentials_request, + build_list_cluster_user_credentials_request, + build_list_outbound_network_dependencies_endpoints_request, + build_list_request, + build_reset_aad_profile_request, + build_reset_service_principal_profile_request, + build_rotate_cluster_certificates_request, + build_run_command_request, + build_start_request, + build_stop_request, + build_update_tags_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class ManagedClustersOperations: # pylint: disable=too-many-public-methods """ .. warning:: @@ -45,46 +75,39 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async async def get_os_options( - self, - location: str, - resource_type: Optional[str] = None, - **kwargs: Any + self, location: str, resource_type: Optional[str] = None, **kwargs: Any ) -> _models.OSOptionProfile: """Gets supported OS options in the specified subscription. Gets supported OS options in the specified subscription. - :param location: The name of a supported Azure region. + :param location: The name of a supported Azure region. Required. :type location: str :param resource_type: The resource type for which the OS options needs to be returned. Default value is None. :type resource_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: OSOptionProfile, or the result of cls(response) + :return: OSOptionProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.OSOptionProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OSOptionProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OSOptionProfile] - request = build_get_os_options_request( - subscription_id=self._config.subscription_id, location=location, - api_version=api_version, + subscription_id=self._config.subscription_id, resource_type=resource_type, - template_url=self.get_os_options.metadata['url'], + api_version=api_version, + template_url=self.get_os_options.metadata["url"], headers=_headers, params=_params, ) @@ -92,59 +115,52 @@ async def get_os_options( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('OSOptionProfile', pipeline_response) + deserialized = self._deserialize("OSOptionProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_os_options.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default"} # type: ignore - + get_os_options.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default"} # type: ignore @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.ManagedClusterListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.ManagedCluster"]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_09_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_09_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -152,14 +168,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -175,10 +188,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -188,49 +199,43 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.ManagedClusterListResult]: + self, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ManagedCluster"]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_09_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_09_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -238,15 +243,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -262,10 +263,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -275,50 +274,42 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace_async async def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.ManagedClusterUpgradeProfile: """Gets the upgrade profile of a managed cluster. Gets the upgrade profile of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterUpgradeProfile, or the result of cls(response) + :return: ManagedClusterUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.ManagedClusterUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -326,33 +317,27 @@ async def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterUpgradeProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore @distributed_trace_async async def get_access_profile( - self, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, role_name: str, **kwargs: Any ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. @@ -361,36 +346,33 @@ async def get_access_profile( `ListClusterAdminCredentials `_ . - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param role_name: The name of the role for managed cluster accessProfile resource. + :param role_name: The name of the role for managed cluster accessProfile resource. Required. :type role_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterAccessProfile, or the result of cls(response) + :return: ManagedClusterAccessProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.ManagedClusterAccessProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterAccessProfile] - request = build_get_access_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, role_name=role_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_access_profile.metadata['url'], + template_url=self.get_access_profile.metadata["url"], headers=_headers, params=_params, ) @@ -398,68 +380,59 @@ async def get_access_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterAccessProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterAccessProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_access_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore - + get_access_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore @distributed_trace_async async def list_cluster_admin_credentials( - self, - resource_group_name: str, - resource_name: str, - server_fqdn: Optional[str] = None, - **kwargs: Any + self, resource_group_name: str, resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any ) -> _models.CredentialResults: """Lists the admin credentials of a managed cluster. Lists the admin credentials of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_admin_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, - template_url=self.list_cluster_admin_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_admin_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -467,68 +440,59 @@ async def list_cluster_admin_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_admin_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore - + list_cluster_admin_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore @distributed_trace_async async def list_cluster_user_credentials( - self, - resource_group_name: str, - resource_name: str, - server_fqdn: Optional[str] = None, - **kwargs: Any + self, resource_group_name: str, resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any ) -> _models.CredentialResults: """Lists the user credentials of a managed cluster. Lists the user credentials of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, - template_url=self.list_cluster_user_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -536,68 +500,59 @@ async def list_cluster_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore - + list_cluster_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore @distributed_trace_async async def list_cluster_monitoring_user_credentials( - self, - resource_group_name: str, - resource_name: str, - server_fqdn: Optional[str] = None, - **kwargs: Any + self, resource_group_name: str, resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any ) -> _models.CredentialResults: """Lists the cluster monitoring user credentials of a managed cluster. Lists the cluster monitoring user credentials of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_monitoring_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, - template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_monitoring_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -605,64 +560,54 @@ async def list_cluster_monitoring_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_monitoring_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore - + list_cluster_monitoring_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore @distributed_trace_async - async def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.ManagedCluster: + async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.ManagedCluster: """Gets a managed cluster. Gets a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedCluster, or the result of cls(response) + :return: ManagedCluster or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.ManagedCluster - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -670,55 +615,54 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _create_or_update_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.ManagedCluster, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'ManagedCluster') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedCluster") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -726,10 +670,9 @@ async def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -737,37 +680,41 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - - @distributed_trace_async + @overload async def begin_create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedCluster, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. Creates or updates a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The managed cluster to create or update. + :param parameters: The managed cluster to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2021_09_01.models.ManagedCluster + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -780,20 +727,88 @@ async def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_09_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_09_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster to create or update. Is either a model type or a IO + type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_09_01.models.ManagedCluster or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_09_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -801,69 +816,66 @@ async def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _update_tags_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.TagsObject, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request_initial( - subscription_id=self._config.subscription_id, + request = build_update_tags_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_tags_initial.metadata['url'], + content=_content, + template_url=self._update_tags_initial.metadata["url"], headers=_headers, params=_params, ) @@ -871,44 +883,47 @@ async def _update_tags_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_tags_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + _update_tags_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - - @distributed_trace_async + @overload async def begin_update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates tags on a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2021_09_01.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -921,20 +936,88 @@ async def begin_update_tags( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_09_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates tags on a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_09_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates tags on a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_09_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_09_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, @@ -942,64 +1025,54 @@ async def begin_update_tags( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1007,10 +1080,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1020,23 +1092,17 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: + async def begin_delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Deletes a managed cluster. Deletes a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1048,85 +1114,83 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterServicePrincipalProfile, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterServicePrincipalProfile") - request = build_reset_service_principal_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_service_principal_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_service_principal_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_service_principal_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1134,10 +1198,9 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1147,28 +1210,104 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist if cls: return cls(pipeline_response, None, {}) - _reset_service_principal_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + _reset_service_principal_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore - - @distributed_trace_async - async def begin_reset_service_principal_profile( # pylint: disable=inconsistent-return-statements + @overload + async def begin_reset_service_principal_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterServicePrincipalProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: """Reset the Service Principal Profile of a managed cluster. This action cannot be performed on a cluster that is not using a service principal. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The service principal profile to set on the managed cluster. + :param parameters: The service principal profile to set on the managed cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2021_09_01.models.ManagedClusterServicePrincipalProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset the Service Principal Profile of a managed cluster. + + This action cannot be performed on a cluster that is not using a service principal. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The service principal profile to set on the managed cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset the Service Principal Profile of a managed cluster. + + This action cannot be performed on a cluster that is not using a service principal. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The service principal profile to set on the managed cluster. Is either a + model type or a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2021_09_01.models.ManagedClusterServicePrincipalProfile or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -1179,20 +1318,17 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1200,67 +1336,68 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_service_principal_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + begin_reset_service_principal_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterAADProfile, + parameters: Union[_models.ManagedClusterAADProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterAADProfile") - request = build_reset_aad_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_aad_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_aad_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_aad_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1268,10 +1405,9 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1281,27 +1417,103 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta if cls: return cls(pipeline_response, None, {}) - _reset_aad_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + _reset_aad_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - - @distributed_trace_async - async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements + @overload + async def begin_reset_aad_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterAADProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: """Reset the AAD Profile of a managed cluster. Reset the AAD Profile of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The AAD profile to set on the Managed Cluster. + :param parameters: The AAD profile to set on the Managed Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2021_09_01.models.ManagedClusterAADProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset the AAD Profile of a managed cluster. + + Reset the AAD Profile of a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The AAD profile to set on the Managed Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterAADProfile, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset the AAD Profile of a managed cluster. + + Reset the AAD Profile of a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The AAD profile to set on the Managed Cluster. Is either a model type or a + IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_09_01.models.ManagedClusterAADProfile or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -1312,20 +1524,17 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1333,62 +1542,52 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_aad_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + begin_reset_aad_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_rotate_cluster_certificates_request_initial( - subscription_id=self._config.subscription_id, + request = build_rotate_cluster_certificates_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._rotate_cluster_certificates_initial.metadata['url'], + template_url=self._rotate_cluster_certificates_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1396,10 +1595,9 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1409,24 +1607,20 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- if cls: return cls(pipeline_response, None, {}) - _rotate_cluster_certificates_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore - + _rotate_cluster_certificates_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore @distributed_trace_async - async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + async def begin_rotate_cluster_certificates( + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Rotates the certificates of a managed cluster. See `Certificate rotation `_ for more details about rotating managed cluster certificates. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1438,80 +1632,67 @@ async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-ret Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._rotate_cluster_certificates_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_rotate_cluster_certificates.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore + begin_rotate_cluster_certificates.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore async def _stop_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_stop_request_initial( - subscription_id=self._config.subscription_id, + request = build_stop_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._stop_initial.metadata['url'], + template_url=self._stop_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1519,10 +1700,9 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1532,16 +1712,10 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore - + _stop_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore @distributed_trace_async - async def begin_stop( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: + async def begin_stop(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Stops a Managed Cluster. This can only be performed on Azure Virtual Machine Scale set backed clusters. Stopping a @@ -1550,9 +1724,9 @@ async def begin_stop( # pylint: disable=inconsistent-return-statements `_ for more details about stopping a cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1564,80 +1738,67 @@ async def begin_stop( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._stop_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore + begin_stop.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore async def _start_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_start_request_initial( - subscription_id=self._config.subscription_id, + request = build_start_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._start_initial.metadata['url'], + template_url=self._start_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1645,10 +1806,9 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1658,24 +1818,18 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore - + _start_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore @distributed_trace_async - async def begin_start( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: + async def begin_start(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Starts a previously stopped Managed Cluster. See `starting a cluster `_ for more details about starting a cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1687,85 +1841,83 @@ async def begin_start( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._start_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore + begin_start.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore async def _run_command_initial( self, resource_group_name: str, resource_name: str, - request_payload: _models.RunCommandRequest, + request_payload: Union[_models.RunCommandRequest, IO], **kwargs: Any ) -> Optional[_models.RunCommandResult]: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RunCommandResult]] - _json = self._serialize.body(request_payload, 'RunCommandRequest') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(request_payload, (IO, bytes)): + _content = request_payload + else: + _json = self._serialize.body(request_payload, "RunCommandRequest") - request = build_run_command_request_initial( - subscription_id=self._config.subscription_id, + request = build_run_command_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._run_command_initial.metadata['url'], + content=_content, + template_url=self._run_command_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1773,10 +1925,9 @@ async def _run_command_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1785,22 +1936,23 @@ async def _run_command_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _run_command_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore - + _run_command_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore - @distributed_trace_async + @overload async def begin_run_command( self, resource_group_name: str, resource_name: str, request_payload: _models.RunCommandRequest, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.RunCommandResult]: """Submits a command to run against the Managed Cluster. @@ -1809,12 +1961,15 @@ async def begin_run_command( more information see `AKS Run Command `_. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param request_payload: The run command request. + :param request_payload: The run command request. Required. :type request_payload: ~azure.mgmt.containerservice.v2021_09_01.models.RunCommandRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -1827,20 +1982,95 @@ async def begin_run_command( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_09_01.models.RunCommandResult] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_run_command( + self, + resource_group_name: str, + resource_name: str, + request_payload: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.RunCommandResult]: + """Submits a command to run against the Managed Cluster. + + AKS will create a pod to run the command. This is primarily useful for private clusters. For + more information see `AKS Run Command + `_. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param request_payload: The run command request. Required. + :type request_payload: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RunCommandResult or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_09_01.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_run_command( + self, + resource_group_name: str, + resource_name: str, + request_payload: Union[_models.RunCommandRequest, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.RunCommandResult]: + """Submits a command to run against the Managed Cluster. + + AKS will create a pod to run the command. This is primarily useful for private clusters. For + more information see `AKS Run Command + `_. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param request_payload: The run command request. Is either a model type or a IO type. Required. + :type request_payload: ~azure.mgmt.containerservice.v2021_09_01.models.RunCommandRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RunCommandResult or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_09_01.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.RunCommandResult] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.RunCommandResult] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._run_command_initial( # type: ignore resource_group_name=resource_group_name, @@ -1848,82 +2078,71 @@ async def begin_run_command( request_payload=request_payload, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_run_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore + begin_run_command.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore @distributed_trace_async async def get_command_result( - self, - resource_group_name: str, - resource_name: str, - command_id: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, command_id: str, **kwargs: Any ) -> Optional[_models.RunCommandResult]: """Gets the results of a command which has been run on the Managed Cluster. Gets the results of a command which has been run on the Managed Cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param command_id: Id of the command. + :param command_id: Id of the command. Required. :type command_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: RunCommandResult, or the result of cls(response) + :return: RunCommandResult or None or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.RunCommandResult or None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RunCommandResult]] - request = build_get_command_result_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, command_id=command_id, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_command_result.metadata['url'], + template_url=self.get_command_result.metadata["url"], headers=_headers, params=_params, ) @@ -1931,10 +2150,9 @@ async def get_command_result( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1943,59 +2161,54 @@ async def get_command_result( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_command_result.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}"} # type: ignore - + get_command_result.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}"} # type: ignore @distributed_trace def list_outbound_network_dependencies_endpoints( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.OutboundEnvironmentEndpointCollection]: + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> AsyncIterable["_models.OutboundEnvironmentEndpoint"]: """Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster. Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster. The operation returns properties of each egress endpoint. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OutboundEnvironmentEndpointCollection or the - result of cls(response) + :return: An iterator like instance of either OutboundEnvironmentEndpoint or the result of + cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_09_01.models.OutboundEnvironmentEndpointCollection] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_09_01.models.OutboundEnvironmentEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_outbound_network_dependencies_endpoints_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_outbound_network_dependencies_endpoints.metadata['url'], + template_url=self.list_outbound_network_dependencies_endpoints.metadata["url"], headers=_headers, params=_params, ) @@ -2003,16 +2216,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_outbound_network_dependencies_endpoints_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -2028,10 +2236,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2041,8 +2247,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_outbound_network_dependencies_endpoints.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints"} # type: ignore + list_outbound_network_dependencies_endpoints.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/operations/_operations.py index 8a491c2c8513..46ecb6e0a529 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/operations/_operations.py @@ -7,9 +7,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,9 +27,11 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._operations import build_list_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class Operations: """ .. warning:: @@ -42,38 +51,33 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.OperationListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.OperationValue"]: """Gets a list of operations. Gets a list of operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationListResult or the result of cls(response) + :return: An iterator like instance of either OperationValue or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_09_01.models.OperationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_09_01.models.OperationValue] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -81,13 +85,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -103,10 +105,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -116,8 +116,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.ContainerService/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ContainerService/operations"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/operations/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/operations/_private_endpoint_connections_operations.py index d8ebc73c6f1c..5c918b3494ea 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/operations/_private_endpoint_connections_operations.py @@ -6,9 +6,15 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -20,10 +26,17 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._private_endpoint_connections_operations import build_delete_request_initial, build_get_request, build_list_request, build_update_request -T = TypeVar('T') +from ...operations._private_endpoint_connections_operations import ( + build_delete_request, + build_get_request, + build_list_request, + build_update_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class PrivateEndpointConnectionsOperations: """ .. warning:: @@ -43,46 +56,39 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async async def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnectionListResult: """Gets a list of private endpoint connections in the specified managed cluster. To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnectionListResult, or the result of cls(response) + :return: PrivateEndpointConnectionListResult or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.PrivateEndpointConnectionListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnectionListResult] - request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -90,69 +96,60 @@ async def list( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore - + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore @distributed_trace_async async def get( - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnection: """Gets the specified private endpoint connection. To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -160,75 +157,147 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - @distributed_trace_async + @overload async def update( self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, parameters: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateEndpointConnection: """Updates a private endpoint connection. Updates a private endpoint connection. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str - :param parameters: The updated private endpoint connection. + :param parameters: The updated private endpoint connection. Required. :type parameters: ~azure.mgmt.containerservice.v2021_09_01.models.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: The updated private endpoint connection. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: Union[_models.PrivateEndpointConnection, IO], + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: The updated private endpoint connection. Is either a model type or a IO + type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_09_01.models.PrivateEndpointConnection or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - _json = self._serialize.body(parameters, 'PrivateEndpointConnection') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateEndpointConnection") request = build_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update.metadata['url'], + content=_content, + template_url=self.update.metadata["url"], headers=_headers, params=_params, ) @@ -236,52 +305,43 @@ async def update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -289,10 +349,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -302,26 +361,21 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + async def begin_delete( + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes a private endpoint connection. Deletes a private endpoint connection. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -333,53 +387,46 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/operations/_private_link_resources_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/operations/_private_link_resources_operations.py index 9d376ffb96dd..3be90c8c874b 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/operations/_private_link_resources_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/operations/_private_link_resources_operations.py @@ -8,7 +8,13 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -19,9 +25,11 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._private_link_resources_operations import build_list_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class PrivateLinkResourcesOperations: """ .. warning:: @@ -41,46 +49,39 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async async def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.PrivateLinkResourcesListResult: """Gets a list of private link resources in the specified managed cluster. To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResourcesListResult, or the result of cls(response) + :return: PrivateLinkResourcesListResult or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.PrivateLinkResourcesListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResourcesListResult] - request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -88,22 +89,20 @@ async def list( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResourcesListResult', pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources"} # type: ignore - + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/operations/_resolve_private_link_service_id_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/operations/_resolve_private_link_service_id_operations.py index fa46de6674f2..7bb3cef2987e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/operations/_resolve_private_link_service_id_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/operations/_resolve_private_link_service_id_operations.py @@ -6,9 +6,15 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -19,9 +25,11 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._resolve_private_link_service_id_operations import build_post_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class ResolvePrivateLinkServiceIdOperations: """ .. warning:: @@ -41,52 +49,118 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async + @overload async def post( self, resource_group_name: str, resource_name: str, parameters: _models.PrivateLinkResource, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateLinkResource: """Gets the private link service ID for the specified managed cluster. Gets the private link service ID for the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters required in order to resolve a private link service ID. + :param parameters: Parameters required in order to resolve a private link service ID. Required. :type parameters: ~azure.mgmt.containerservice.v2021_09_01.models.PrivateLinkResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def post( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID for the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters required in order to resolve a private link service ID. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResource, or the result of cls(response) + :return: PrivateLinkResource or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.PrivateLinkResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @distributed_trace_async + async def post( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.PrivateLinkResource, IO], + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID for the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters required in order to resolve a private link service ID. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_09_01.models.PrivateLinkResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResource] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResource] - _json = self._serialize.body(parameters, 'PrivateLinkResource') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateLinkResource") request = build_post_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.post.metadata['url'], + content=_content, + template_url=self.post.metadata["url"], headers=_headers, params=_params, ) @@ -94,22 +168,20 @@ async def post( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResource', pipeline_response) + deserialized = self._deserialize("PrivateLinkResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - post.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId"} # type: ignore - + post.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/operations/_snapshots_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/operations/_snapshots_operations.py index f12eb8ca4259..047b47b9c56f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/operations/_snapshots_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/operations/_snapshots_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,10 +27,19 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._snapshots_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_resource_group_request, build_list_request, build_update_tags_request -T = TypeVar('T') +from ...operations._snapshots_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_resource_group_request, + build_list_request, + build_update_tags_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class SnapshotsOperations: """ .. warning:: @@ -43,39 +59,34 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.SnapshotListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.Snapshot"]: """Gets a list of snapshots in the specified subscription. Gets a list of snapshots in the specified subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SnapshotListResult or the result of cls(response) + :return: An iterator like instance of either Snapshot or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_09_01.models.SnapshotListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_09_01.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SnapshotListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -83,14 +94,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -106,10 +114,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -119,48 +125,41 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots"} # type: ignore @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.SnapshotListResult]: + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.Snapshot"]: """Lists snapshots in the specified subscription and resource group. Lists snapshots in the specified subscription and resource group. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SnapshotListResult or the result of cls(response) + :return: An iterator like instance of either Snapshot or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_09_01.models.SnapshotListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_09_01.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SnapshotListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -168,15 +167,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -192,10 +187,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -205,50 +198,40 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots"} # type: ignore @distributed_trace_async - async def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.Snapshot: + async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.Snapshot: """Gets a snapshot. Gets a snapshot. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Snapshot, or the result of cls(response) + :return: Snapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.Snapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -256,71 +239,132 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - - @distributed_trace_async + @overload async def create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.Snapshot, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.Snapshot: """Creates or updates a snapshot. Creates or updates a snapshot. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The snapshot to create or update. + :param parameters: The snapshot to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2021_09_01.models.Snapshot + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Snapshot: + """Creates or updates a snapshot. + + Creates or updates a snapshot. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The snapshot to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Snapshot, or the result of cls(response) + :return: Snapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.Snapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @distributed_trace_async + async def create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.Snapshot, IO], **kwargs: Any + ) -> _models.Snapshot: + """Creates or updates a snapshot. + + Creates or updates a snapshot. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The snapshot to create or update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.mgmt.containerservice.v2021_09_01.models.Snapshot or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] - _json = self._serialize.body(parameters, 'Snapshot') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "Snapshot") request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) @@ -328,10 +372,9 @@ async def create_or_update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -339,64 +382,126 @@ async def create_or_update( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - @distributed_trace_async + @overload async def update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.Snapshot: """Updates tags on a snapshot. Updates tags on a snapshot. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update snapshot Tags operation. + :param parameters: Parameters supplied to the Update snapshot Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2021_09_01.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Snapshot: + """Updates tags on a snapshot. + + Updates tags on a snapshot. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update snapshot Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> _models.Snapshot: + """Updates tags on a snapshot. + + Updates tags on a snapshot. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update snapshot Tags operation. Is either a model + type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_09_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Snapshot, or the result of cls(response) + :return: Snapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.Snapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") request = build_update_tags_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_tags.metadata['url'], + content=_content, + template_url=self.update_tags.metadata["url"], headers=_headers, params=_params, ) @@ -404,64 +509,56 @@ async def update_tags( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - + update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: """Deletes a snapshot. Deletes a snapshot. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) @@ -469,10 +566,9 @@ async def delete( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -482,5 +578,4 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - + delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/models/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/models/__init__.py index a55c620d2804..609a472c8f2e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/models/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/models/__init__.py @@ -93,167 +93,165 @@ from ._models_py3 import UserAssignedIdentity from ._models_py3 import WindowsGmsaProfile - -from ._container_service_client_enums import ( - AgentPoolMode, - AgentPoolType, - Code, - ConnectionStatus, - ContainerServiceStorageProfileTypes, - ContainerServiceVMSizeTypes, - Count, - CreatedByType, - Expander, - ExtendedLocationTypes, - GPUInstanceProfile, - KubeletDiskType, - LicenseType, - LoadBalancerSku, - ManagedClusterPodIdentityProvisioningState, - ManagedClusterSKUName, - ManagedClusterSKUTier, - NetworkMode, - NetworkPlugin, - NetworkPolicy, - OSDiskType, - OSSKU, - OSType, - OutboundType, - PrivateEndpointConnectionProvisioningState, - PublicNetworkAccess, - ResourceIdentityType, - ScaleDownMode, - ScaleSetEvictionPolicy, - ScaleSetPriority, - SnapshotType, - UpgradeChannel, - WeekDay, - WorkloadRuntime, -) +from ._container_service_client_enums import AgentPoolMode +from ._container_service_client_enums import AgentPoolType +from ._container_service_client_enums import Code +from ._container_service_client_enums import ConnectionStatus +from ._container_service_client_enums import ContainerServiceStorageProfileTypes +from ._container_service_client_enums import ContainerServiceVMSizeTypes +from ._container_service_client_enums import Count +from ._container_service_client_enums import CreatedByType +from ._container_service_client_enums import Expander +from ._container_service_client_enums import ExtendedLocationTypes +from ._container_service_client_enums import GPUInstanceProfile +from ._container_service_client_enums import KubeletDiskType +from ._container_service_client_enums import LicenseType +from ._container_service_client_enums import LoadBalancerSku +from ._container_service_client_enums import ManagedClusterPodIdentityProvisioningState +from ._container_service_client_enums import ManagedClusterSKUName +from ._container_service_client_enums import ManagedClusterSKUTier +from ._container_service_client_enums import NetworkMode +from ._container_service_client_enums import NetworkPlugin +from ._container_service_client_enums import NetworkPolicy +from ._container_service_client_enums import OSDiskType +from ._container_service_client_enums import OSSKU +from ._container_service_client_enums import OSType +from ._container_service_client_enums import OutboundType +from ._container_service_client_enums import PrivateEndpointConnectionProvisioningState +from ._container_service_client_enums import PublicNetworkAccess +from ._container_service_client_enums import ResourceIdentityType +from ._container_service_client_enums import ScaleDownMode +from ._container_service_client_enums import ScaleSetEvictionPolicy +from ._container_service_client_enums import ScaleSetPriority +from ._container_service_client_enums import SnapshotType +from ._container_service_client_enums import UpgradeChannel +from ._container_service_client_enums import WeekDay +from ._container_service_client_enums import WorkloadRuntime from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'AgentPool', - 'AgentPoolAvailableVersions', - 'AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem', - 'AgentPoolListResult', - 'AgentPoolUpgradeProfile', - 'AgentPoolUpgradeProfilePropertiesUpgradesItem', - 'AgentPoolUpgradeSettings', - 'CloudErrorBody', - 'ContainerServiceDiagnosticsProfile', - 'ContainerServiceLinuxProfile', - 'ContainerServiceMasterProfile', - 'ContainerServiceNetworkProfile', - 'ContainerServiceSshConfiguration', - 'ContainerServiceSshPublicKey', - 'ContainerServiceVMDiagnostics', - 'CreationData', - 'CredentialResult', - 'CredentialResults', - 'EndpointDependency', - 'EndpointDetail', - 'ExtendedLocation', - 'KubeletConfig', - 'LinuxOSConfig', - 'MaintenanceConfiguration', - 'MaintenanceConfigurationListResult', - 'ManagedCluster', - 'ManagedClusterAADProfile', - 'ManagedClusterAPIServerAccessProfile', - 'ManagedClusterAccessProfile', - 'ManagedClusterAddonProfile', - 'ManagedClusterAddonProfileIdentity', - 'ManagedClusterAgentPoolProfile', - 'ManagedClusterAgentPoolProfileProperties', - 'ManagedClusterAutoUpgradeProfile', - 'ManagedClusterHTTPProxyConfig', - 'ManagedClusterIdentity', - 'ManagedClusterListResult', - 'ManagedClusterLoadBalancerProfile', - 'ManagedClusterLoadBalancerProfileManagedOutboundIPs', - 'ManagedClusterLoadBalancerProfileOutboundIPPrefixes', - 'ManagedClusterLoadBalancerProfileOutboundIPs', - 'ManagedClusterManagedOutboundIPProfile', - 'ManagedClusterNATGatewayProfile', - 'ManagedClusterPodIdentity', - 'ManagedClusterPodIdentityException', - 'ManagedClusterPodIdentityProfile', - 'ManagedClusterPodIdentityProvisioningError', - 'ManagedClusterPodIdentityProvisioningErrorBody', - 'ManagedClusterPodIdentityProvisioningInfo', - 'ManagedClusterPoolUpgradeProfile', - 'ManagedClusterPoolUpgradeProfileUpgradesItem', - 'ManagedClusterPropertiesAutoScalerProfile', - 'ManagedClusterSKU', - 'ManagedClusterSecurityProfile', - 'ManagedClusterSecurityProfileAzureDefender', - 'ManagedClusterServicePrincipalProfile', - 'ManagedClusterUpgradeProfile', - 'ManagedClusterWindowsProfile', - 'ManagedServiceIdentityUserAssignedIdentitiesValue', - 'OSOptionProfile', - 'OSOptionProperty', - 'OperationListResult', - 'OperationValue', - 'OutboundEnvironmentEndpoint', - 'OutboundEnvironmentEndpointCollection', - 'PowerState', - 'PrivateEndpoint', - 'PrivateEndpointConnection', - 'PrivateEndpointConnectionListResult', - 'PrivateLinkResource', - 'PrivateLinkResourcesListResult', - 'PrivateLinkServiceConnectionState', - 'Resource', - 'ResourceReference', - 'RunCommandRequest', - 'RunCommandResult', - 'Snapshot', - 'SnapshotListResult', - 'SubResource', - 'SysctlConfig', - 'SystemData', - 'TagsObject', - 'TimeInWeek', - 'TimeSpan', - 'UserAssignedIdentity', - 'WindowsGmsaProfile', - 'AgentPoolMode', - 'AgentPoolType', - 'Code', - 'ConnectionStatus', - 'ContainerServiceStorageProfileTypes', - 'ContainerServiceVMSizeTypes', - 'Count', - 'CreatedByType', - 'Expander', - 'ExtendedLocationTypes', - 'GPUInstanceProfile', - 'KubeletDiskType', - 'LicenseType', - 'LoadBalancerSku', - 'ManagedClusterPodIdentityProvisioningState', - 'ManagedClusterSKUName', - 'ManagedClusterSKUTier', - 'NetworkMode', - 'NetworkPlugin', - 'NetworkPolicy', - 'OSDiskType', - 'OSSKU', - 'OSType', - 'OutboundType', - 'PrivateEndpointConnectionProvisioningState', - 'PublicNetworkAccess', - 'ResourceIdentityType', - 'ScaleDownMode', - 'ScaleSetEvictionPolicy', - 'ScaleSetPriority', - 'SnapshotType', - 'UpgradeChannel', - 'WeekDay', - 'WorkloadRuntime', + "AgentPool", + "AgentPoolAvailableVersions", + "AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem", + "AgentPoolListResult", + "AgentPoolUpgradeProfile", + "AgentPoolUpgradeProfilePropertiesUpgradesItem", + "AgentPoolUpgradeSettings", + "CloudErrorBody", + "ContainerServiceDiagnosticsProfile", + "ContainerServiceLinuxProfile", + "ContainerServiceMasterProfile", + "ContainerServiceNetworkProfile", + "ContainerServiceSshConfiguration", + "ContainerServiceSshPublicKey", + "ContainerServiceVMDiagnostics", + "CreationData", + "CredentialResult", + "CredentialResults", + "EndpointDependency", + "EndpointDetail", + "ExtendedLocation", + "KubeletConfig", + "LinuxOSConfig", + "MaintenanceConfiguration", + "MaintenanceConfigurationListResult", + "ManagedCluster", + "ManagedClusterAADProfile", + "ManagedClusterAPIServerAccessProfile", + "ManagedClusterAccessProfile", + "ManagedClusterAddonProfile", + "ManagedClusterAddonProfileIdentity", + "ManagedClusterAgentPoolProfile", + "ManagedClusterAgentPoolProfileProperties", + "ManagedClusterAutoUpgradeProfile", + "ManagedClusterHTTPProxyConfig", + "ManagedClusterIdentity", + "ManagedClusterListResult", + "ManagedClusterLoadBalancerProfile", + "ManagedClusterLoadBalancerProfileManagedOutboundIPs", + "ManagedClusterLoadBalancerProfileOutboundIPPrefixes", + "ManagedClusterLoadBalancerProfileOutboundIPs", + "ManagedClusterManagedOutboundIPProfile", + "ManagedClusterNATGatewayProfile", + "ManagedClusterPodIdentity", + "ManagedClusterPodIdentityException", + "ManagedClusterPodIdentityProfile", + "ManagedClusterPodIdentityProvisioningError", + "ManagedClusterPodIdentityProvisioningErrorBody", + "ManagedClusterPodIdentityProvisioningInfo", + "ManagedClusterPoolUpgradeProfile", + "ManagedClusterPoolUpgradeProfileUpgradesItem", + "ManagedClusterPropertiesAutoScalerProfile", + "ManagedClusterSKU", + "ManagedClusterSecurityProfile", + "ManagedClusterSecurityProfileAzureDefender", + "ManagedClusterServicePrincipalProfile", + "ManagedClusterUpgradeProfile", + "ManagedClusterWindowsProfile", + "ManagedServiceIdentityUserAssignedIdentitiesValue", + "OSOptionProfile", + "OSOptionProperty", + "OperationListResult", + "OperationValue", + "OutboundEnvironmentEndpoint", + "OutboundEnvironmentEndpointCollection", + "PowerState", + "PrivateEndpoint", + "PrivateEndpointConnection", + "PrivateEndpointConnectionListResult", + "PrivateLinkResource", + "PrivateLinkResourcesListResult", + "PrivateLinkServiceConnectionState", + "Resource", + "ResourceReference", + "RunCommandRequest", + "RunCommandResult", + "Snapshot", + "SnapshotListResult", + "SubResource", + "SysctlConfig", + "SystemData", + "TagsObject", + "TimeInWeek", + "TimeSpan", + "UserAssignedIdentity", + "WindowsGmsaProfile", + "AgentPoolMode", + "AgentPoolType", + "Code", + "ConnectionStatus", + "ContainerServiceStorageProfileTypes", + "ContainerServiceVMSizeTypes", + "Count", + "CreatedByType", + "Expander", + "ExtendedLocationTypes", + "GPUInstanceProfile", + "KubeletDiskType", + "LicenseType", + "LoadBalancerSku", + "ManagedClusterPodIdentityProvisioningState", + "ManagedClusterSKUName", + "ManagedClusterSKUTier", + "NetworkMode", + "NetworkPlugin", + "NetworkPolicy", + "OSDiskType", + "OSSKU", + "OSType", + "OutboundType", + "PrivateEndpointConnectionProvisioningState", + "PublicNetworkAccess", + "ResourceIdentityType", + "ScaleDownMode", + "ScaleSetEvictionPolicy", + "ScaleSetPriority", + "SnapshotType", + "UpgradeChannel", + "WeekDay", + "WorkloadRuntime", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/models/_container_service_client_enums.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/models/_container_service_client_enums.py index ca3b2ccab3e1..cb73561d8d60 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/models/_container_service_client_enums.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/models/_container_service_client_enums.py @@ -13,7 +13,7 @@ class AgentPoolMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools + https://docs.microsoft.com/azure/aks/use-system-pools. """ #: System agent pools are primarily for hosting critical system pods such as CoreDNS and @@ -23,33 +23,34 @@ class AgentPoolMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: User agent pools are primarily for hosting your application pods. USER = "User" + class AgentPoolType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of Agent Pool. - """ + """The type of Agent Pool.""" #: Create an Agent Pool backed by a Virtual Machine Scale Set. VIRTUAL_MACHINE_SCALE_SETS = "VirtualMachineScaleSets" #: Use of this is strongly discouraged. AVAILABILITY_SET = "AvailabilitySet" + class Code(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Tells whether the cluster is Running or Stopped - """ + """Tells whether the cluster is Running or Stopped.""" #: The cluster is running. RUNNING = "Running" #: The cluster is stopped. STOPPED = "Stopped" + class ConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The private link service connection status. - """ + """The private link service connection status.""" PENDING = "Pending" APPROVED = "Approved" REJECTED = "Rejected" DISCONNECTED = "Disconnected" + class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Specifies what kind of storage to use. If omitted, the default will be chosen on your behalf based on the choice of orchestrator. @@ -58,9 +59,9 @@ class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEn STORAGE_ACCOUNT = "StorageAccount" MANAGED_DISKS = "ManagedDisks" + class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Size of agent VMs. Note: This is no longer maintained. - """ + """Size of agent VMs. Note: This is no longer maintained.""" STANDARD_A1 = "Standard_A1" STANDARD_A10 = "Standard_A10" @@ -237,6 +238,7 @@ class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): STANDARD_NV24 = "Standard_NV24" STANDARD_NV6 = "Standard_NV6" + class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): """Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, and 5. The default value is 1. @@ -246,15 +248,16 @@ class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): THREE = 3 FIVE = 5 + class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of identity that created the resource. - """ + """The type of identity that created the resource.""" USER = "User" APPLICATION = "Application" MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" + class Expander(str, Enum, metaclass=CaseInsensitiveEnumMeta): """If not specified, the default is 'random'. See `expanders `_ @@ -278,15 +281,15 @@ class Expander(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Used when you don't have a particular need for the node groups to scale differently. RANDOM = "random" + class ExtendedLocationTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of extendedLocation. - """ + """The type of extendedLocation.""" EDGE_ZONE = "EdgeZone" + class GPUInstanceProfile(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """GPUInstanceProfile to be used to specify GPU MIG instance profile for supported GPU VM SKU. - """ + """GPUInstanceProfile to be used to specify GPU MIG instance profile for supported GPU VM SKU.""" MIG1_G = "MIG1g" MIG2_G = "MIG2g" @@ -294,6 +297,7 @@ class GPUInstanceProfile(str, Enum, metaclass=CaseInsensitiveEnumMeta): MIG4_G = "MIG4g" MIG7_G = "MIG7g" + class KubeletDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. @@ -304,6 +308,7 @@ class KubeletDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Kubelet will use the temporary disk for its data. TEMPORARY = "Temporary" + class LicenseType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The license type to use for Windows VMs. See `Azure Hybrid User Benefits `_ for more details. @@ -314,6 +319,7 @@ class LicenseType(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Enables Azure Hybrid User Benefits for Windows VMs. WINDOWS_SERVER = "Windows_Server" + class LoadBalancerSku(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The default is 'standard'. See `Azure Load Balancer SKUs `_ for more information about the @@ -327,21 +333,22 @@ class LoadBalancerSku(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Use a basic Load Balancer with limited functionality. BASIC = "basic" + class ManagedClusterPodIdentityProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The current provisioning state of the pod identity. - """ + """The current provisioning state of the pod identity.""" ASSIGNED = "Assigned" UPDATING = "Updating" DELETING = "Deleting" FAILED = "Failed" + class ManagedClusterSKUName(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The name of a managed cluster SKU. - """ + """The name of a managed cluster SKU.""" BASIC = "Basic" + class ManagedClusterSKUTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): """If not specified, the default is 'Free'. See `uptime SLA `_ for more details. @@ -353,20 +360,20 @@ class ManagedClusterSKUTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: No guaranteed SLA, no additional charges. Free tier clusters have an SLO of 99.5%. FREE = "Free" + class NetworkMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """This cannot be specified if networkPlugin is anything other than 'azure'. - """ + """This cannot be specified if networkPlugin is anything other than 'azure'.""" #: No bridge is created. Intra-VM Pod to Pod communication is through IP routes created by Azure #: CNI. See `Transparent Mode `_ for #: more information. TRANSPARENT = "transparent" - #: This is no longer supported. + #: This is no longer supported BRIDGE = "bridge" + class NetworkPlugin(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Network plugin used for building the Kubernetes network. - """ + """Network plugin used for building the Kubernetes network.""" #: Use the Azure CNI network plugin. See `Azure CNI (advanced) networking #: `_ for @@ -377,9 +384,9 @@ class NetworkPlugin(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: information. KUBENET = "kubenet" + class NetworkPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Network policy used for building the Kubernetes network. - """ + """Network policy used for building the Kubernetes network.""" #: Use Calico network policies. See `differences between Azure and Calico policies #: `_ @@ -390,6 +397,7 @@ class NetworkPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: for more information. AZURE = "azure" + class OSDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more @@ -406,22 +414,23 @@ class OSDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: provides lower read/write latency, along with faster node scaling and cluster upgrades. EPHEMERAL = "Ephemeral" + class OSSKU(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Specifies an OS SKU. This value must not be specified if OSType is Windows. - """ + """Specifies an OS SKU. This value must not be specified if OSType is Windows.""" UBUNTU = "Ubuntu" CBL_MARINER = "CBLMariner" + class OSType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The operating system type. The default is Linux. - """ + """The operating system type. The default is Linux.""" #: Use Linux. LINUX = "Linux" #: Use Windows. WINDOWS = "Windows" + class OutboundType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """This can only be set at cluster creation time and cannot be changed later. For more information see `egress outbound type `_. @@ -442,23 +451,25 @@ class OutboundType(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: advanced scenario and requires proper network configuration. USER_ASSIGNED_NAT_GATEWAY = "userAssignedNATGateway" + class PrivateEndpointConnectionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The current provisioning state. - """ + """The current provisioning state.""" SUCCEEDED = "Succeeded" CREATING = "Creating" DELETING = "Deleting" FAILED = "Failed" + class PublicNetworkAccess(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Default value is 'Enabled' (case insensitive). Could be set to 'Disabled' to enable private - cluster + cluster. """ ENABLED = "Enabled" DISABLED = "Disabled" + class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """For more information see `use managed identities in AKS `_. @@ -475,6 +486,7 @@ class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Do not use a managed identity for the Managed Cluster, service principal will be used instead. NONE = "None" + class ScaleDownMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Describes how VMs are added to or removed from Agent Pools. See `billing states `_. @@ -486,10 +498,11 @@ class ScaleDownMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: during scale down. DEALLOCATE = "Deallocate" + class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The eviction policy specifies what to do with the VM when it is evicted. The default is Delete. For more information about eviction see `spot VMs - `_ + `_. """ #: Nodes in the underlying Scale Set of the node pool are deleted when they're evicted. @@ -499,9 +512,9 @@ class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: cause issues with cluster scaling or upgrading. DEALLOCATE = "Deallocate" + class ScaleSetPriority(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The Virtual Machine Scale Set priority. - """ + """The Virtual Machine Scale Set priority.""" #: Spot priority VMs will be used. There is no SLA for spot nodes. See `spot on AKS #: `_ for more information. @@ -509,13 +522,14 @@ class ScaleSetPriority(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Regular VMs will be used. REGULAR = "Regular" + class SnapshotType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of a snapshot. The default is NodePool. - """ + """The type of a snapshot. The default is NodePool.""" #: The snapshot is a snapshot of a node pool. NODE_POOL = "NodePool" + class UpgradeChannel(str, Enum, metaclass=CaseInsensitiveEnumMeta): """For more information see `setting the AKS cluster auto-upgrade channel `_. @@ -546,9 +560,9 @@ class UpgradeChannel(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Disables auto-upgrades and keeps the cluster at its current version of Kubernetes. NONE = "none" + class WeekDay(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The weekday enum. - """ + """The weekday enum.""" SUNDAY = "Sunday" MONDAY = "Monday" @@ -558,9 +572,9 @@ class WeekDay(str, Enum, metaclass=CaseInsensitiveEnumMeta): FRIDAY = "Friday" SATURDAY = "Saturday" + class WorkloadRuntime(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Determines the type of workload a node can run. - """ + """Determines the type of workload a node can run.""" #: Nodes will use Kubelet to run standard OCI container workloads. OCI_CONTAINER = "OCIContainer" diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/models/_models_py3.py index ca71353911dc..705ac5ee282c 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/models/_models_py3.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/models/_models_py3.py @@ -1,4 +1,5 @@ # coding=utf-8 +# pylint: disable=too-many-lines # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -9,14 +10,14 @@ import datetime from typing import Dict, List, Optional, TYPE_CHECKING, Union -import msrest.serialization +from ... import _serialization if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - import __init__ as _models + from .. import models as _models -class SubResource(msrest.serialization.Model): +class SubResource(_serialization.Model): """Reference to another subresource. Variables are only populated by the server, and will be ignored when sending a request. @@ -31,30 +32,26 @@ class SubResource(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(SubResource, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.id = None self.name = None self.type = None -class AgentPool(SubResource): +class AgentPool(SubResource): # pylint: disable=too-many-instance-attributes """Agent Pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -82,14 +79,14 @@ class AgentPool(SubResource): larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2021_09_01.models.OSDiskType :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data - root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2021_09_01.models.KubeletDiskType :ivar workload_runtime: Determines the type of workload a node can run. Known values are: - "OCIContainer", "WasmWasi". + "OCIContainer" and "WasmWasi". :vartype workload_runtime: str or ~azure.mgmt.containerservice.v2021_09_01.models.WorkloadRuntime :ivar vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and used. @@ -103,11 +100,11 @@ class AgentPool(SubResource): :vartype pod_subnet_id: str :ivar max_pods: The maximum number of pods that can run on a node. :vartype max_pods: int - :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2021_09_01.models.OSType :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known - values are: "Ubuntu", "CBLMariner". + values are: "Ubuntu" and "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2021_09_01.models.OSSKU :ivar max_count: The maximum number of nodes for auto-scaling. :vartype max_count: int @@ -116,15 +113,15 @@ class AgentPool(SubResource): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it - defaults to Delete. Known values are: "Delete", "Deallocate". + defaults to Delete. Known values are: "Delete" and "Deallocate". :vartype scale_down_mode: str or ~azure.mgmt.containerservice.v2021_09_01.models.ScaleDownMode - :ivar type_properties_type: The type of Agent Pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + :ivar type_properties_type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets" + and "AvailabilitySet". :vartype type_properties_type: str or ~azure.mgmt.containerservice.v2021_09_01.models.AgentPoolType :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :vartype mode: str or ~azure.mgmt.containerservice.v2021_09_01.models.AgentPoolMode :ivar orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -159,20 +156,18 @@ class AgentPool(SubResource): /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default - is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + is 'Regular'. Known values are: "Spot" and "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2021_09_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2021_09_01.models.ScaleSetEvictionPolicy :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :vartype spot_max_price: float - :ivar tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :ivar tags: The tags to be persisted on the agent pool virtual machine scale set. :vartype tags: dict[str, str] :ivar node_labels: The node labels to be persisted across all nodes in agent pool. :vartype node_labels: dict[str, str] @@ -196,7 +191,7 @@ class AgentPool(SubResource): for more details. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2021_09_01.models.GPUInstanceProfile :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the node pool @@ -205,60 +200,60 @@ class AgentPool(SubResource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'os_disk_size_gb': {'maximum': 2048, 'minimum': 0}, - 'node_image_version': {'readonly': True}, - 'provisioning_state': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "os_disk_size_gb": {"maximum": 2048, "minimum": 0}, + "node_image_version": {"readonly": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'count': {'key': 'properties.count', 'type': 'int'}, - 'vm_size': {'key': 'properties.vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'properties.osDiskSizeGB', 'type': 'int'}, - 'os_disk_type': {'key': 'properties.osDiskType', 'type': 'str'}, - 'kubelet_disk_type': {'key': 'properties.kubeletDiskType', 'type': 'str'}, - 'workload_runtime': {'key': 'properties.workloadRuntime', 'type': 'str'}, - 'vnet_subnet_id': {'key': 'properties.vnetSubnetID', 'type': 'str'}, - 'pod_subnet_id': {'key': 'properties.podSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'properties.maxPods', 'type': 'int'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'os_sku': {'key': 'properties.osSKU', 'type': 'str'}, - 'max_count': {'key': 'properties.maxCount', 'type': 'int'}, - 'min_count': {'key': 'properties.minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'properties.enableAutoScaling', 'type': 'bool'}, - 'scale_down_mode': {'key': 'properties.scaleDownMode', 'type': 'str'}, - 'type_properties_type': {'key': 'properties.type', 'type': 'str'}, - 'mode': {'key': 'properties.mode', 'type': 'str'}, - 'orchestrator_version': {'key': 'properties.orchestratorVersion', 'type': 'str'}, - 'node_image_version': {'key': 'properties.nodeImageVersion', 'type': 'str'}, - 'upgrade_settings': {'key': 'properties.upgradeSettings', 'type': 'AgentPoolUpgradeSettings'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'power_state': {'key': 'properties.powerState', 'type': 'PowerState'}, - 'availability_zones': {'key': 'properties.availabilityZones', 'type': '[str]'}, - 'enable_node_public_ip': {'key': 'properties.enableNodePublicIP', 'type': 'bool'}, - 'node_public_ip_prefix_id': {'key': 'properties.nodePublicIPPrefixID', 'type': 'str'}, - 'scale_set_priority': {'key': 'properties.scaleSetPriority', 'type': 'str'}, - 'scale_set_eviction_policy': {'key': 'properties.scaleSetEvictionPolicy', 'type': 'str'}, - 'spot_max_price': {'key': 'properties.spotMaxPrice', 'type': 'float'}, - 'tags': {'key': 'properties.tags', 'type': '{str}'}, - 'node_labels': {'key': 'properties.nodeLabels', 'type': '{str}'}, - 'node_taints': {'key': 'properties.nodeTaints', 'type': '[str]'}, - 'proximity_placement_group_id': {'key': 'properties.proximityPlacementGroupID', 'type': 'str'}, - 'kubelet_config': {'key': 'properties.kubeletConfig', 'type': 'KubeletConfig'}, - 'linux_os_config': {'key': 'properties.linuxOSConfig', 'type': 'LinuxOSConfig'}, - 'enable_encryption_at_host': {'key': 'properties.enableEncryptionAtHost', 'type': 'bool'}, - 'enable_ultra_ssd': {'key': 'properties.enableUltraSSD', 'type': 'bool'}, - 'enable_fips': {'key': 'properties.enableFIPS', 'type': 'bool'}, - 'gpu_instance_profile': {'key': 'properties.gpuInstanceProfile', 'type': 'str'}, - 'creation_data': {'key': 'properties.creationData', 'type': 'CreationData'}, - } - - def __init__( + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "count": {"key": "properties.count", "type": "int"}, + "vm_size": {"key": "properties.vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "properties.osDiskSizeGB", "type": "int"}, + "os_disk_type": {"key": "properties.osDiskType", "type": "str"}, + "kubelet_disk_type": {"key": "properties.kubeletDiskType", "type": "str"}, + "workload_runtime": {"key": "properties.workloadRuntime", "type": "str"}, + "vnet_subnet_id": {"key": "properties.vnetSubnetID", "type": "str"}, + "pod_subnet_id": {"key": "properties.podSubnetID", "type": "str"}, + "max_pods": {"key": "properties.maxPods", "type": "int"}, + "os_type": {"key": "properties.osType", "type": "str"}, + "os_sku": {"key": "properties.osSKU", "type": "str"}, + "max_count": {"key": "properties.maxCount", "type": "int"}, + "min_count": {"key": "properties.minCount", "type": "int"}, + "enable_auto_scaling": {"key": "properties.enableAutoScaling", "type": "bool"}, + "scale_down_mode": {"key": "properties.scaleDownMode", "type": "str"}, + "type_properties_type": {"key": "properties.type", "type": "str"}, + "mode": {"key": "properties.mode", "type": "str"}, + "orchestrator_version": {"key": "properties.orchestratorVersion", "type": "str"}, + "node_image_version": {"key": "properties.nodeImageVersion", "type": "str"}, + "upgrade_settings": {"key": "properties.upgradeSettings", "type": "AgentPoolUpgradeSettings"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "power_state": {"key": "properties.powerState", "type": "PowerState"}, + "availability_zones": {"key": "properties.availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "properties.enableNodePublicIP", "type": "bool"}, + "node_public_ip_prefix_id": {"key": "properties.nodePublicIPPrefixID", "type": "str"}, + "scale_set_priority": {"key": "properties.scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "properties.scaleSetEvictionPolicy", "type": "str"}, + "spot_max_price": {"key": "properties.spotMaxPrice", "type": "float"}, + "tags": {"key": "properties.tags", "type": "{str}"}, + "node_labels": {"key": "properties.nodeLabels", "type": "{str}"}, + "node_taints": {"key": "properties.nodeTaints", "type": "[str]"}, + "proximity_placement_group_id": {"key": "properties.proximityPlacementGroupID", "type": "str"}, + "kubelet_config": {"key": "properties.kubeletConfig", "type": "KubeletConfig"}, + "linux_os_config": {"key": "properties.linuxOSConfig", "type": "LinuxOSConfig"}, + "enable_encryption_at_host": {"key": "properties.enableEncryptionAtHost", "type": "bool"}, + "enable_ultra_ssd": {"key": "properties.enableUltraSSD", "type": "bool"}, + "enable_fips": {"key": "properties.enableFIPS", "type": "bool"}, + "gpu_instance_profile": {"key": "properties.gpuInstanceProfile", "type": "str"}, + "creation_data": {"key": "properties.creationData", "type": "CreationData"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, count: Optional[int] = None, @@ -270,7 +265,7 @@ def __init__( vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, @@ -284,9 +279,9 @@ def __init__( availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", - spot_max_price: Optional[float] = -1, + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", + spot_max_price: float = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, @@ -317,14 +312,14 @@ def __init__( larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2021_09_01.models.OSDiskType :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime - data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + data root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2021_09_01.models.KubeletDiskType :keyword workload_runtime: Determines the type of workload a node can run. Known values are: - "OCIContainer", "WasmWasi". + "OCIContainer" and "WasmWasi". :paramtype workload_runtime: str or ~azure.mgmt.containerservice.v2021_09_01.models.WorkloadRuntime :keyword vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and @@ -338,11 +333,11 @@ def __init__( :paramtype pod_subnet_id: str :keyword max_pods: The maximum number of pods that can run on a node. :paramtype max_pods: int - :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2021_09_01.models.OSType :keyword os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Known values are: "Ubuntu", "CBLMariner". + Known values are: "Ubuntu" and "CBLMariner". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2021_09_01.models.OSSKU :keyword max_count: The maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -351,16 +346,16 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, - it defaults to Delete. Known values are: "Delete", "Deallocate". + it defaults to Delete. Known values are: "Delete" and "Deallocate". :paramtype scale_down_mode: str or ~azure.mgmt.containerservice.v2021_09_01.models.ScaleDownMode :keyword type_properties_type: The type of Agent Pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type_properties_type: str or ~azure.mgmt.containerservice.v2021_09_01.models.AgentPoolType :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2021_09_01.models.AgentPoolMode :keyword orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -391,20 +386,18 @@ def __init__( /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the - default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + default is 'Regular'. Known values are: "Spot" and "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2021_09_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2021_09_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :paramtype spot_max_price: float - :keyword tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :keyword tags: The tags to be persisted on the agent pool virtual machine scale set. :paramtype tags: dict[str, str] :keyword node_labels: The node labels to be persisted across all nodes in agent pool. :paramtype node_labels: dict[str, str] @@ -428,7 +421,7 @@ def __init__( for more details. :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance - profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2021_09_01.models.GPUInstanceProfile @@ -436,7 +429,7 @@ def __init__( pool will be created/upgraded using a snapshot. :paramtype creation_data: ~azure.mgmt.containerservice.v2021_09_01.models.CreationData """ - super(AgentPool, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.vm_size = vm_size self.os_disk_size_gb = os_disk_size_gb @@ -478,7 +471,7 @@ def __init__( self.creation_data = creation_data -class AgentPoolAvailableVersions(msrest.serialization.Model): +class AgentPoolAvailableVersions(_serialization.Model): """The list of available versions for an agent pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -495,16 +488,19 @@ class AgentPoolAvailableVersions(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'agent_pool_versions': {'key': 'properties.agentPoolVersions', 'type': '[AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "agent_pool_versions": { + "key": "properties.agentPoolVersions", + "type": "[AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem]", + }, } def __init__( @@ -518,14 +514,14 @@ def __init__( :paramtype agent_pool_versions: list[~azure.mgmt.containerservice.v2021_09_01.models.AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem] """ - super(AgentPoolAvailableVersions, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None self.agent_pool_versions = agent_pool_versions -class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(msrest.serialization.Model): +class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(_serialization.Model): """AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem. :ivar default: Whether this version is the default agent pool version. @@ -537,9 +533,9 @@ class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(msrest.serializa """ _attribute_map = { - 'default': {'key': 'default', 'type': 'bool'}, - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "default": {"key": "default", "type": "bool"}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } def __init__( @@ -558,13 +554,13 @@ def __init__( :keyword is_preview: Whether Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.default = default self.kubernetes_version = kubernetes_version self.is_preview = is_preview -class AgentPoolListResult(msrest.serialization.Model): +class AgentPoolListResult(_serialization.Model): """The response from the List Agent Pools operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -576,30 +572,25 @@ class AgentPoolListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[AgentPool]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[AgentPool]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.AgentPool"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.AgentPool"]] = None, **kwargs): """ :keyword value: The list of agent pools. :paramtype value: list[~azure.mgmt.containerservice.v2021_09_01.models.AgentPool] """ - super(AgentPoolListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class AgentPoolUpgradeProfile(msrest.serialization.Model): +class AgentPoolUpgradeProfile(_serialization.Model): """The list of available upgrades for an agent pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -612,10 +603,10 @@ class AgentPoolUpgradeProfile(msrest.serialization.Model): :vartype name: str :ivar type: The type of the agent pool upgrade profile. :vartype type: str - :ivar kubernetes_version: Required. The Kubernetes version (major.minor.patch). + :ivar kubernetes_version: The Kubernetes version (major.minor.patch). Required. :vartype kubernetes_version: str - :ivar os_type: Required. The operating system type. The default is Linux. Known values are: - "Linux", "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2021_09_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -625,21 +616,21 @@ class AgentPoolUpgradeProfile(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kubernetes_version': {'required': True}, - 'os_type': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "kubernetes_version": {"required": True}, + "os_type": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'kubernetes_version': {'key': 'properties.kubernetesVersion', 'type': 'str'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'upgrades': {'key': 'properties.upgrades', 'type': '[AgentPoolUpgradeProfilePropertiesUpgradesItem]'}, - 'latest_node_image_version': {'key': 'properties.latestNodeImageVersion', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "os_type": {"key": "properties.osType", "type": "str"}, + "upgrades": {"key": "properties.upgrades", "type": "[AgentPoolUpgradeProfilePropertiesUpgradesItem]"}, + "latest_node_image_version": {"key": "properties.latestNodeImageVersion", "type": "str"}, } def __init__( @@ -652,10 +643,10 @@ def __init__( **kwargs ): """ - :keyword kubernetes_version: Required. The Kubernetes version (major.minor.patch). + :keyword kubernetes_version: The Kubernetes version (major.minor.patch). Required. :paramtype kubernetes_version: str - :keyword os_type: Required. The operating system type. The default is Linux. Known values are: - "Linux", "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2021_09_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: @@ -663,7 +654,7 @@ def __init__( :keyword latest_node_image_version: The latest AKS supported node image version. :paramtype latest_node_image_version: str """ - super(AgentPoolUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -673,7 +664,7 @@ def __init__( self.latest_node_image_version = latest_node_image_version -class AgentPoolUpgradeProfilePropertiesUpgradesItem(msrest.serialization.Model): +class AgentPoolUpgradeProfilePropertiesUpgradesItem(_serialization.Model): """AgentPoolUpgradeProfilePropertiesUpgradesItem. :ivar kubernetes_version: The Kubernetes version (major.minor.patch). @@ -683,29 +674,23 @@ class AgentPoolUpgradeProfilePropertiesUpgradesItem(msrest.serialization.Model): """ _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } - def __init__( - self, - *, - kubernetes_version: Optional[str] = None, - is_preview: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, kubernetes_version: Optional[str] = None, is_preview: Optional[bool] = None, **kwargs): """ :keyword kubernetes_version: The Kubernetes version (major.minor.patch). :paramtype kubernetes_version: str :keyword is_preview: Whether the Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(AgentPoolUpgradeProfilePropertiesUpgradesItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.is_preview = is_preview -class AgentPoolUpgradeSettings(msrest.serialization.Model): +class AgentPoolUpgradeSettings(_serialization.Model): """Settings for upgrading an agentpool. :ivar max_surge: This can either be set to an integer (e.g. '5') or a percentage (e.g. '50%'). @@ -717,15 +702,10 @@ class AgentPoolUpgradeSettings(msrest.serialization.Model): """ _attribute_map = { - 'max_surge': {'key': 'maxSurge', 'type': 'str'}, + "max_surge": {"key": "maxSurge", "type": "str"}, } - def __init__( - self, - *, - max_surge: Optional[str] = None, - **kwargs - ): + def __init__(self, *, max_surge: Optional[str] = None, **kwargs): """ :keyword max_surge: This can either be set to an integer (e.g. '5') or a percentage (e.g. '50%'). If a percentage is specified, it is the percentage of the total agent pool size at the @@ -734,11 +714,11 @@ def __init__( https://docs.microsoft.com/azure/aks/upgrade-cluster#customize-node-surge-upgrade. :paramtype max_surge: str """ - super(AgentPoolUpgradeSettings, self).__init__(**kwargs) + super().__init__(**kwargs) self.max_surge = max_surge -class CloudErrorBody(msrest.serialization.Model): +class CloudErrorBody(_serialization.Model): """An error response from the Container service. :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed @@ -755,10 +735,10 @@ class CloudErrorBody(msrest.serialization.Model): """ _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[CloudErrorBody]"}, } def __init__( @@ -783,87 +763,76 @@ def __init__( :keyword details: A list of additional details about the error. :paramtype details: list[~azure.mgmt.containerservice.v2021_09_01.models.CloudErrorBody] """ - super(CloudErrorBody, self).__init__(**kwargs) + super().__init__(**kwargs) self.code = code self.message = message self.target = target self.details = details -class ContainerServiceDiagnosticsProfile(msrest.serialization.Model): +class ContainerServiceDiagnosticsProfile(_serialization.Model): """Profile for diagnostics on the container service cluster. All required parameters must be populated in order to send to Azure. - :ivar vm_diagnostics: Required. Profile for diagnostics on the container service VMs. + :ivar vm_diagnostics: Profile for diagnostics on the container service VMs. Required. :vartype vm_diagnostics: ~azure.mgmt.containerservice.v2021_09_01.models.ContainerServiceVMDiagnostics """ _validation = { - 'vm_diagnostics': {'required': True}, + "vm_diagnostics": {"required": True}, } _attribute_map = { - 'vm_diagnostics': {'key': 'vmDiagnostics', 'type': 'ContainerServiceVMDiagnostics'}, + "vm_diagnostics": {"key": "vmDiagnostics", "type": "ContainerServiceVMDiagnostics"}, } - def __init__( - self, - *, - vm_diagnostics: "_models.ContainerServiceVMDiagnostics", - **kwargs - ): + def __init__(self, *, vm_diagnostics: "_models.ContainerServiceVMDiagnostics", **kwargs): """ - :keyword vm_diagnostics: Required. Profile for diagnostics on the container service VMs. + :keyword vm_diagnostics: Profile for diagnostics on the container service VMs. Required. :paramtype vm_diagnostics: ~azure.mgmt.containerservice.v2021_09_01.models.ContainerServiceVMDiagnostics """ - super(ContainerServiceDiagnosticsProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.vm_diagnostics = vm_diagnostics -class ContainerServiceLinuxProfile(msrest.serialization.Model): +class ContainerServiceLinuxProfile(_serialization.Model): """Profile for Linux VMs in the container service cluster. All required parameters must be populated in order to send to Azure. - :ivar admin_username: Required. The administrator username to use for Linux VMs. + :ivar admin_username: The administrator username to use for Linux VMs. Required. :vartype admin_username: str - :ivar ssh: Required. The SSH configuration for Linux-based VMs running on Azure. + :ivar ssh: The SSH configuration for Linux-based VMs running on Azure. Required. :vartype ssh: ~azure.mgmt.containerservice.v2021_09_01.models.ContainerServiceSshConfiguration """ _validation = { - 'admin_username': {'required': True, 'pattern': r'^[A-Za-z][-A-Za-z0-9_]*$'}, - 'ssh': {'required': True}, + "admin_username": {"required": True, "pattern": r"^[A-Za-z][-A-Za-z0-9_]*$"}, + "ssh": {"required": True}, } _attribute_map = { - 'admin_username': {'key': 'adminUsername', 'type': 'str'}, - 'ssh': {'key': 'ssh', 'type': 'ContainerServiceSshConfiguration'}, + "admin_username": {"key": "adminUsername", "type": "str"}, + "ssh": {"key": "ssh", "type": "ContainerServiceSshConfiguration"}, } - def __init__( - self, - *, - admin_username: str, - ssh: "_models.ContainerServiceSshConfiguration", - **kwargs - ): + def __init__(self, *, admin_username: str, ssh: "_models.ContainerServiceSshConfiguration", **kwargs): """ - :keyword admin_username: Required. The administrator username to use for Linux VMs. + :keyword admin_username: The administrator username to use for Linux VMs. Required. :paramtype admin_username: str - :keyword ssh: Required. The SSH configuration for Linux-based VMs running on Azure. + :keyword ssh: The SSH configuration for Linux-based VMs running on Azure. Required. :paramtype ssh: ~azure.mgmt.containerservice.v2021_09_01.models.ContainerServiceSshConfiguration """ - super(ContainerServiceLinuxProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.admin_username = admin_username self.ssh = ssh -class ContainerServiceMasterProfile(msrest.serialization.Model): +class ContainerServiceMasterProfile(_serialization.Model): """Profile for the container service master. Variables are only populated by the server, and will be ignored when sending a request. @@ -871,11 +840,11 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar count: Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, - and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". + and 5. The default value is 1. Known values are: 1, 3, and 5. :vartype count: int or ~azure.mgmt.containerservice.v2021_09_01.models.Count - :ivar dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. + :ivar dns_prefix: DNS prefix to be used to create the FQDN for the master pool. Required. :vartype dns_prefix: str - :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + :ivar vm_size: Size of agent VMs. Required. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -912,7 +881,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :vartype vm_size: str or ~azure.mgmt.containerservice.v2021_09_01.models.ContainerServiceVMSizeTypes :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine @@ -926,7 +895,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): :vartype first_consecutive_static_ip: str :ivar storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount" and "ManagedDisks". :vartype storage_profile: str or ~azure.mgmt.containerservice.v2021_09_01.models.ContainerServiceStorageProfileTypes :ivar fqdn: FQDN for the master pool. @@ -934,21 +903,21 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): """ _validation = { - 'dns_prefix': {'required': True}, - 'vm_size': {'required': True}, - 'os_disk_size_gb': {'maximum': 2048, 'minimum': 0}, - 'fqdn': {'readonly': True}, + "dns_prefix": {"required": True}, + "vm_size": {"required": True}, + "os_disk_size_gb": {"maximum": 2048, "minimum": 0}, + "fqdn": {"readonly": True}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'dns_prefix': {'key': 'dnsPrefix', 'type': 'str'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'first_consecutive_static_ip': {'key': 'firstConsecutiveStaticIP', 'type': 'str'}, - 'storage_profile': {'key': 'storageProfile', 'type': 'str'}, - 'fqdn': {'key': 'fqdn', 'type': 'str'}, + "count": {"key": "count", "type": "int"}, + "dns_prefix": {"key": "dnsPrefix", "type": "str"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "first_consecutive_static_ip": {"key": "firstConsecutiveStaticIP", "type": "str"}, + "storage_profile": {"key": "storageProfile", "type": "str"}, + "fqdn": {"key": "fqdn", "type": "str"}, } def __init__( @@ -956,20 +925,20 @@ def __init__( *, dns_prefix: str, vm_size: Union[str, "_models.ContainerServiceVMSizeTypes"], - count: Optional[Union[int, "_models.Count"]] = 1, + count: Union[int, "_models.Count"] = 1, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, - first_consecutive_static_ip: Optional[str] = "10.240.255.5", + first_consecutive_static_ip: str = "10.240.255.5", storage_profile: Optional[Union[str, "_models.ContainerServiceStorageProfileTypes"]] = None, **kwargs ): """ :keyword count: Number of masters (VMs) in the container service cluster. Allowed values are 1, - 3, and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". + 3, and 5. The default value is 1. Known values are: 1, 3, and 5. :paramtype count: int or ~azure.mgmt.containerservice.v2021_09_01.models.Count - :keyword dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. + :keyword dns_prefix: DNS prefix to be used to create the FQDN for the master pool. Required. :paramtype dns_prefix: str - :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + :keyword vm_size: Size of agent VMs. Required. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -1006,7 +975,7 @@ def __init__( "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :paramtype vm_size: str or ~azure.mgmt.containerservice.v2021_09_01.models.ContainerServiceVMSizeTypes :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every @@ -1020,11 +989,11 @@ def __init__( :paramtype first_consecutive_static_ip: str :keyword storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount" and "ManagedDisks". :paramtype storage_profile: str or ~azure.mgmt.containerservice.v2021_09_01.models.ContainerServiceStorageProfileTypes """ - super(ContainerServiceMasterProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.dns_prefix = dns_prefix self.vm_size = vm_size @@ -1035,17 +1004,17 @@ def __init__( self.fqdn = None -class ContainerServiceNetworkProfile(msrest.serialization.Model): +class ContainerServiceNetworkProfile(_serialization.Model): # pylint: disable=too-many-instance-attributes """Profile of network configuration. :ivar network_plugin: Network plugin used for building the Kubernetes network. Known values - are: "azure", "kubenet". Default value: "kubenet". + are: "azure" and "kubenet". :vartype network_plugin: str or ~azure.mgmt.containerservice.v2021_09_01.models.NetworkPlugin :ivar network_policy: Network policy used for building the Kubernetes network. Known values - are: "calico", "azure". + are: "calico" and "azure". :vartype network_policy: str or ~azure.mgmt.containerservice.v2021_09_01.models.NetworkPolicy :ivar network_mode: This cannot be specified if networkPlugin is anything other than 'azure'. - Known values are: "transparent", "bridge". + Known values are: "transparent" and "bridge". :vartype network_mode: str or ~azure.mgmt.containerservice.v2021_09_01.models.NetworkMode :ivar pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :vartype pod_cidr: str @@ -1061,12 +1030,11 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): :ivar outbound_type: This can only be set at cluster creation time and cannot be changed later. For more information see `egress outbound type `_. Known values are: "loadBalancer", - "userDefinedRouting", "managedNATGateway", "userAssignedNATGateway". Default value: - "loadBalancer". + "userDefinedRouting", "managedNATGateway", and "userAssignedNATGateway". :vartype outbound_type: str or ~azure.mgmt.containerservice.v2021_09_01.models.OutboundType :ivar load_balancer_sku: The default is 'standard'. See `Azure Load Balancer SKUs `_ for more information about the - differences between load balancer SKUs. Known values are: "standard", "basic". + differences between load balancer SKUs. Known values are: "standard" and "basic". :vartype load_balancer_sku: str or ~azure.mgmt.containerservice.v2021_09_01.models.LoadBalancerSku :ivar load_balancer_profile: Profile of the cluster load balancer. @@ -1078,37 +1046,39 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): """ _validation = { - 'pod_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, - 'service_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, - 'dns_service_ip': {'pattern': r'^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$'}, - 'docker_bridge_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, + "pod_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, + "service_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, + "dns_service_ip": { + "pattern": r"^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$" + }, + "docker_bridge_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, } _attribute_map = { - 'network_plugin': {'key': 'networkPlugin', 'type': 'str'}, - 'network_policy': {'key': 'networkPolicy', 'type': 'str'}, - 'network_mode': {'key': 'networkMode', 'type': 'str'}, - 'pod_cidr': {'key': 'podCidr', 'type': 'str'}, - 'service_cidr': {'key': 'serviceCidr', 'type': 'str'}, - 'dns_service_ip': {'key': 'dnsServiceIP', 'type': 'str'}, - 'docker_bridge_cidr': {'key': 'dockerBridgeCidr', 'type': 'str'}, - 'outbound_type': {'key': 'outboundType', 'type': 'str'}, - 'load_balancer_sku': {'key': 'loadBalancerSku', 'type': 'str'}, - 'load_balancer_profile': {'key': 'loadBalancerProfile', 'type': 'ManagedClusterLoadBalancerProfile'}, - 'nat_gateway_profile': {'key': 'natGatewayProfile', 'type': 'ManagedClusterNATGatewayProfile'}, + "network_plugin": {"key": "networkPlugin", "type": "str"}, + "network_policy": {"key": "networkPolicy", "type": "str"}, + "network_mode": {"key": "networkMode", "type": "str"}, + "pod_cidr": {"key": "podCidr", "type": "str"}, + "service_cidr": {"key": "serviceCidr", "type": "str"}, + "dns_service_ip": {"key": "dnsServiceIP", "type": "str"}, + "docker_bridge_cidr": {"key": "dockerBridgeCidr", "type": "str"}, + "outbound_type": {"key": "outboundType", "type": "str"}, + "load_balancer_sku": {"key": "loadBalancerSku", "type": "str"}, + "load_balancer_profile": {"key": "loadBalancerProfile", "type": "ManagedClusterLoadBalancerProfile"}, + "nat_gateway_profile": {"key": "natGatewayProfile", "type": "ManagedClusterNATGatewayProfile"}, } def __init__( self, *, - network_plugin: Optional[Union[str, "_models.NetworkPlugin"]] = "kubenet", + network_plugin: Union[str, "_models.NetworkPlugin"] = "kubenet", network_policy: Optional[Union[str, "_models.NetworkPolicy"]] = None, network_mode: Optional[Union[str, "_models.NetworkMode"]] = None, - pod_cidr: Optional[str] = "10.244.0.0/16", - service_cidr: Optional[str] = "10.0.0.0/16", - dns_service_ip: Optional[str] = "10.0.0.10", - docker_bridge_cidr: Optional[str] = "172.17.0.1/16", - outbound_type: Optional[Union[str, "_models.OutboundType"]] = "loadBalancer", + pod_cidr: str = "10.244.0.0/16", + service_cidr: str = "10.0.0.0/16", + dns_service_ip: str = "10.0.0.10", + docker_bridge_cidr: str = "172.17.0.1/16", + outbound_type: Union[str, "_models.OutboundType"] = "loadBalancer", load_balancer_sku: Optional[Union[str, "_models.LoadBalancerSku"]] = None, load_balancer_profile: Optional["_models.ManagedClusterLoadBalancerProfile"] = None, nat_gateway_profile: Optional["_models.ManagedClusterNATGatewayProfile"] = None, @@ -1116,13 +1086,13 @@ def __init__( ): """ :keyword network_plugin: Network plugin used for building the Kubernetes network. Known values - are: "azure", "kubenet". Default value: "kubenet". + are: "azure" and "kubenet". :paramtype network_plugin: str or ~azure.mgmt.containerservice.v2021_09_01.models.NetworkPlugin :keyword network_policy: Network policy used for building the Kubernetes network. Known values - are: "calico", "azure". + are: "calico" and "azure". :paramtype network_policy: str or ~azure.mgmt.containerservice.v2021_09_01.models.NetworkPolicy :keyword network_mode: This cannot be specified if networkPlugin is anything other than - 'azure'. Known values are: "transparent", "bridge". + 'azure'. Known values are: "transparent" and "bridge". :paramtype network_mode: str or ~azure.mgmt.containerservice.v2021_09_01.models.NetworkMode :keyword pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :paramtype pod_cidr: str @@ -1138,12 +1108,11 @@ def __init__( :keyword outbound_type: This can only be set at cluster creation time and cannot be changed later. For more information see `egress outbound type `_. Known values are: "loadBalancer", - "userDefinedRouting", "managedNATGateway", "userAssignedNATGateway". Default value: - "loadBalancer". + "userDefinedRouting", "managedNATGateway", and "userAssignedNATGateway". :paramtype outbound_type: str or ~azure.mgmt.containerservice.v2021_09_01.models.OutboundType :keyword load_balancer_sku: The default is 'standard'. See `Azure Load Balancer SKUs `_ for more information about the - differences between load balancer SKUs. Known values are: "standard", "basic". + differences between load balancer SKUs. Known values are: "standard" and "basic". :paramtype load_balancer_sku: str or ~azure.mgmt.containerservice.v2021_09_01.models.LoadBalancerSku :keyword load_balancer_profile: Profile of the cluster load balancer. @@ -1153,7 +1122,7 @@ def __init__( :paramtype nat_gateway_profile: ~azure.mgmt.containerservice.v2021_09_01.models.ManagedClusterNATGatewayProfile """ - super(ContainerServiceNetworkProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.network_plugin = network_plugin self.network_policy = network_policy self.network_mode = network_mode @@ -1167,113 +1136,98 @@ def __init__( self.nat_gateway_profile = nat_gateway_profile -class ContainerServiceSshConfiguration(msrest.serialization.Model): +class ContainerServiceSshConfiguration(_serialization.Model): """SSH configuration for Linux-based VMs running on Azure. All required parameters must be populated in order to send to Azure. - :ivar public_keys: Required. The list of SSH public keys used to authenticate with Linux-based - VMs. A maximum of 1 key may be specified. + :ivar public_keys: The list of SSH public keys used to authenticate with Linux-based VMs. A + maximum of 1 key may be specified. Required. :vartype public_keys: list[~azure.mgmt.containerservice.v2021_09_01.models.ContainerServiceSshPublicKey] """ _validation = { - 'public_keys': {'required': True}, + "public_keys": {"required": True}, } _attribute_map = { - 'public_keys': {'key': 'publicKeys', 'type': '[ContainerServiceSshPublicKey]'}, + "public_keys": {"key": "publicKeys", "type": "[ContainerServiceSshPublicKey]"}, } - def __init__( - self, - *, - public_keys: List["_models.ContainerServiceSshPublicKey"], - **kwargs - ): + def __init__(self, *, public_keys: List["_models.ContainerServiceSshPublicKey"], **kwargs): """ - :keyword public_keys: Required. The list of SSH public keys used to authenticate with - Linux-based VMs. A maximum of 1 key may be specified. + :keyword public_keys: The list of SSH public keys used to authenticate with Linux-based VMs. A + maximum of 1 key may be specified. Required. :paramtype public_keys: list[~azure.mgmt.containerservice.v2021_09_01.models.ContainerServiceSshPublicKey] """ - super(ContainerServiceSshConfiguration, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_keys = public_keys -class ContainerServiceSshPublicKey(msrest.serialization.Model): +class ContainerServiceSshPublicKey(_serialization.Model): """Contains information about SSH certificate public key data. All required parameters must be populated in order to send to Azure. - :ivar key_data: Required. Certificate public key used to authenticate with VMs through SSH. The - certificate must be in PEM format with or without headers. + :ivar key_data: Certificate public key used to authenticate with VMs through SSH. The + certificate must be in PEM format with or without headers. Required. :vartype key_data: str """ _validation = { - 'key_data': {'required': True}, + "key_data": {"required": True}, } _attribute_map = { - 'key_data': {'key': 'keyData', 'type': 'str'}, + "key_data": {"key": "keyData", "type": "str"}, } - def __init__( - self, - *, - key_data: str, - **kwargs - ): + def __init__(self, *, key_data: str, **kwargs): """ - :keyword key_data: Required. Certificate public key used to authenticate with VMs through SSH. - The certificate must be in PEM format with or without headers. + :keyword key_data: Certificate public key used to authenticate with VMs through SSH. The + certificate must be in PEM format with or without headers. Required. :paramtype key_data: str """ - super(ContainerServiceSshPublicKey, self).__init__(**kwargs) + super().__init__(**kwargs) self.key_data = key_data -class ContainerServiceVMDiagnostics(msrest.serialization.Model): +class ContainerServiceVMDiagnostics(_serialization.Model): """Profile for diagnostics on the container service VMs. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar enabled: Required. Whether the VM diagnostic agent is provisioned on the VM. + :ivar enabled: Whether the VM diagnostic agent is provisioned on the VM. Required. :vartype enabled: bool :ivar storage_uri: The URI of the storage account where diagnostics are stored. :vartype storage_uri: str """ _validation = { - 'enabled': {'required': True}, - 'storage_uri': {'readonly': True}, + "enabled": {"required": True}, + "storage_uri": {"readonly": True}, } _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'storage_uri': {'key': 'storageUri', 'type': 'str'}, + "enabled": {"key": "enabled", "type": "bool"}, + "storage_uri": {"key": "storageUri", "type": "str"}, } - def __init__( - self, - *, - enabled: bool, - **kwargs - ): + def __init__(self, *, enabled: bool, **kwargs): """ - :keyword enabled: Required. Whether the VM diagnostic agent is provisioned on the VM. + :keyword enabled: Whether the VM diagnostic agent is provisioned on the VM. Required. :paramtype enabled: bool """ - super(ContainerServiceVMDiagnostics, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.storage_uri = None -class CreationData(msrest.serialization.Model): +class CreationData(_serialization.Model): """Data used when creating a target resource from a source resource. :ivar source_resource_id: This is the ARM ID of the source object to be used to create the @@ -1282,25 +1236,20 @@ class CreationData(msrest.serialization.Model): """ _attribute_map = { - 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, + "source_resource_id": {"key": "sourceResourceId", "type": "str"}, } - def __init__( - self, - *, - source_resource_id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, source_resource_id: Optional[str] = None, **kwargs): """ :keyword source_resource_id: This is the ARM ID of the source object to be used to create the target object. :paramtype source_resource_id: str """ - super(CreationData, self).__init__(**kwargs) + super().__init__(**kwargs) self.source_resource_id = source_resource_id -class CredentialResult(msrest.serialization.Model): +class CredentialResult(_serialization.Model): """The credential result response. Variables are only populated by the server, and will be ignored when sending a request. @@ -1308,31 +1257,27 @@ class CredentialResult(msrest.serialization.Model): :ivar name: The name of the credential. :vartype name: str :ivar value: Base64-encoded Kubernetes configuration file. - :vartype value: bytearray + :vartype value: bytes """ _validation = { - 'name': {'readonly': True}, - 'value': {'readonly': True}, + "name": {"readonly": True}, + "value": {"readonly": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'bytearray'}, + "name": {"key": "name", "type": "str"}, + "value": {"key": "value", "type": "bytearray"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(CredentialResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.name = None self.value = None -class CredentialResults(msrest.serialization.Model): +class CredentialResults(_serialization.Model): """The list credential result response. Variables are only populated by the server, and will be ignored when sending a request. @@ -1342,24 +1287,20 @@ class CredentialResults(msrest.serialization.Model): """ _validation = { - 'kubeconfigs': {'readonly': True}, + "kubeconfigs": {"readonly": True}, } _attribute_map = { - 'kubeconfigs': {'key': 'kubeconfigs', 'type': '[CredentialResult]'}, + "kubeconfigs": {"key": "kubeconfigs", "type": "[CredentialResult]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(CredentialResults, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.kubeconfigs = None -class EndpointDependency(msrest.serialization.Model): +class EndpointDependency(_serialization.Model): """A domain name that AKS agent nodes are reaching at. :ivar domain_name: The domain name of the dependency. @@ -1369,8 +1310,8 @@ class EndpointDependency(msrest.serialization.Model): """ _attribute_map = { - 'domain_name': {'key': 'domainName', 'type': 'str'}, - 'endpoint_details': {'key': 'endpointDetails', 'type': '[EndpointDetail]'}, + "domain_name": {"key": "domainName", "type": "str"}, + "endpoint_details": {"key": "endpointDetails", "type": "[EndpointDetail]"}, } def __init__( @@ -1387,12 +1328,12 @@ def __init__( :paramtype endpoint_details: list[~azure.mgmt.containerservice.v2021_09_01.models.EndpointDetail] """ - super(EndpointDependency, self).__init__(**kwargs) + super().__init__(**kwargs) self.domain_name = domain_name self.endpoint_details = endpoint_details -class EndpointDetail(msrest.serialization.Model): +class EndpointDetail(_serialization.Model): """connect information from the AKS agent nodes to a single endpoint. :ivar ip_address: An IP Address that Domain Name currently resolves to. @@ -1406,10 +1347,10 @@ class EndpointDetail(msrest.serialization.Model): """ _attribute_map = { - 'ip_address': {'key': 'ipAddress', 'type': 'str'}, - 'port': {'key': 'port', 'type': 'int'}, - 'protocol': {'key': 'protocol', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, + "ip_address": {"key": "ipAddress", "type": "str"}, + "port": {"key": "port", "type": "int"}, + "protocol": {"key": "protocol", "type": "str"}, + "description": {"key": "description", "type": "str"}, } def __init__( @@ -1431,25 +1372,25 @@ def __init__( :keyword description: Description of the detail. :paramtype description: str """ - super(EndpointDetail, self).__init__(**kwargs) + super().__init__(**kwargs) self.ip_address = ip_address self.port = port self.protocol = protocol self.description = description -class ExtendedLocation(msrest.serialization.Model): +class ExtendedLocation(_serialization.Model): """The complex type of the extended location. :ivar name: The name of the extended location. :vartype name: str - :ivar type: The type of the extended location. Known values are: "EdgeZone". + :ivar type: The type of the extended location. "EdgeZone" :vartype type: str or ~azure.mgmt.containerservice.v2021_09_01.models.ExtendedLocationTypes """ _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, } def __init__( @@ -1462,15 +1403,15 @@ def __init__( """ :keyword name: The name of the extended location. :paramtype name: str - :keyword type: The type of the extended location. Known values are: "EdgeZone". + :keyword type: The type of the extended location. "EdgeZone" :paramtype type: str or ~azure.mgmt.containerservice.v2021_09_01.models.ExtendedLocationTypes """ - super(ExtendedLocation, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.type = type -class KubeletConfig(msrest.serialization.Model): +class KubeletConfig(_serialization.Model): # pylint: disable=too-many-instance-attributes """See `AKS custom node configuration `_ for more details. :ivar cpu_manager_policy: The default is 'none'. See `Kubernetes CPU management policies @@ -1510,21 +1451,21 @@ class KubeletConfig(msrest.serialization.Model): """ _validation = { - 'container_log_max_files': {'minimum': 2}, + "container_log_max_files": {"minimum": 2}, } _attribute_map = { - 'cpu_manager_policy': {'key': 'cpuManagerPolicy', 'type': 'str'}, - 'cpu_cfs_quota': {'key': 'cpuCfsQuota', 'type': 'bool'}, - 'cpu_cfs_quota_period': {'key': 'cpuCfsQuotaPeriod', 'type': 'str'}, - 'image_gc_high_threshold': {'key': 'imageGcHighThreshold', 'type': 'int'}, - 'image_gc_low_threshold': {'key': 'imageGcLowThreshold', 'type': 'int'}, - 'topology_manager_policy': {'key': 'topologyManagerPolicy', 'type': 'str'}, - 'allowed_unsafe_sysctls': {'key': 'allowedUnsafeSysctls', 'type': '[str]'}, - 'fail_swap_on': {'key': 'failSwapOn', 'type': 'bool'}, - 'container_log_max_size_mb': {'key': 'containerLogMaxSizeMB', 'type': 'int'}, - 'container_log_max_files': {'key': 'containerLogMaxFiles', 'type': 'int'}, - 'pod_max_pids': {'key': 'podMaxPids', 'type': 'int'}, + "cpu_manager_policy": {"key": "cpuManagerPolicy", "type": "str"}, + "cpu_cfs_quota": {"key": "cpuCfsQuota", "type": "bool"}, + "cpu_cfs_quota_period": {"key": "cpuCfsQuotaPeriod", "type": "str"}, + "image_gc_high_threshold": {"key": "imageGcHighThreshold", "type": "int"}, + "image_gc_low_threshold": {"key": "imageGcLowThreshold", "type": "int"}, + "topology_manager_policy": {"key": "topologyManagerPolicy", "type": "str"}, + "allowed_unsafe_sysctls": {"key": "allowedUnsafeSysctls", "type": "[str]"}, + "fail_swap_on": {"key": "failSwapOn", "type": "bool"}, + "container_log_max_size_mb": {"key": "containerLogMaxSizeMB", "type": "int"}, + "container_log_max_files": {"key": "containerLogMaxFiles", "type": "int"}, + "pod_max_pids": {"key": "podMaxPids", "type": "int"}, } def __init__( @@ -1579,7 +1520,7 @@ def __init__( :keyword pod_max_pids: The maximum number of processes per pod. :paramtype pod_max_pids: int """ - super(KubeletConfig, self).__init__(**kwargs) + super().__init__(**kwargs) self.cpu_manager_policy = cpu_manager_policy self.cpu_cfs_quota = cpu_cfs_quota self.cpu_cfs_quota_period = cpu_cfs_quota_period @@ -1593,7 +1534,7 @@ def __init__( self.pod_max_pids = pod_max_pids -class LinuxOSConfig(msrest.serialization.Model): +class LinuxOSConfig(_serialization.Model): """See `AKS custom node configuration `_ for more details. :ivar sysctls: Sysctl settings for Linux agent nodes. @@ -1612,10 +1553,10 @@ class LinuxOSConfig(msrest.serialization.Model): """ _attribute_map = { - 'sysctls': {'key': 'sysctls', 'type': 'SysctlConfig'}, - 'transparent_huge_page_enabled': {'key': 'transparentHugePageEnabled', 'type': 'str'}, - 'transparent_huge_page_defrag': {'key': 'transparentHugePageDefrag', 'type': 'str'}, - 'swap_file_size_mb': {'key': 'swapFileSizeMB', 'type': 'int'}, + "sysctls": {"key": "sysctls", "type": "SysctlConfig"}, + "transparent_huge_page_enabled": {"key": "transparentHugePageEnabled", "type": "str"}, + "transparent_huge_page_defrag": {"key": "transparentHugePageDefrag", "type": "str"}, + "swap_file_size_mb": {"key": "swapFileSizeMB", "type": "int"}, } def __init__( @@ -1642,7 +1583,7 @@ def __init__( :keyword swap_file_size_mb: The size in MB of a swap file that will be created on each node. :paramtype swap_file_size_mb: int """ - super(LinuxOSConfig, self).__init__(**kwargs) + super().__init__(**kwargs) self.sysctls = sysctls self.transparent_huge_page_enabled = transparent_huge_page_enabled self.transparent_huge_page_defrag = transparent_huge_page_defrag @@ -1671,19 +1612,19 @@ class MaintenanceConfiguration(SubResource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, + "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'}, - 'time_in_week': {'key': 'properties.timeInWeek', 'type': '[TimeInWeek]'}, - 'not_allowed_time': {'key': 'properties.notAllowedTime', 'type': '[TimeSpan]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "time_in_week": {"key": "properties.timeInWeek", "type": "[TimeInWeek]"}, + "not_allowed_time": {"key": "properties.notAllowedTime", "type": "[TimeSpan]"}, } def __init__( @@ -1700,13 +1641,13 @@ def __init__( :keyword not_allowed_time: Time slots on which upgrade is not allowed. :paramtype not_allowed_time: list[~azure.mgmt.containerservice.v2021_09_01.models.TimeSpan] """ - super(MaintenanceConfiguration, self).__init__(**kwargs) + super().__init__(**kwargs) self.system_data = None self.time_in_week = time_in_week self.not_allowed_time = not_allowed_time -class MaintenanceConfigurationListResult(msrest.serialization.Model): +class MaintenanceConfigurationListResult(_serialization.Model): """The response from the List maintenance configurations operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -1718,31 +1659,26 @@ class MaintenanceConfigurationListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[MaintenanceConfiguration]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[MaintenanceConfiguration]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.MaintenanceConfiguration"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.MaintenanceConfiguration"]] = None, **kwargs): """ :keyword value: The list of maintenance configurations. :paramtype value: list[~azure.mgmt.containerservice.v2021_09_01.models.MaintenanceConfiguration] """ - super(MaintenanceConfigurationListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class Resource(msrest.serialization.Model): +class Resource(_serialization.Model): """The Resource model definition. Variables are only populated by the server, and will be ignored when sending a request. @@ -1755,41 +1691,35 @@ class Resource(msrest.serialization.Model): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] """ - super(Resource, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -1797,7 +1727,7 @@ def __init__( self.tags = tags -class ManagedCluster(Resource): +class ManagedCluster(Resource): # pylint: disable=too-many-instance-attributes """Managed cluster. Variables are only populated by the server, and will be ignored when sending a request. @@ -1810,9 +1740,9 @@ class ManagedCluster(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar sku: The managed cluster SKU. :vartype sku: ~azure.mgmt.containerservice.v2021_09_01.models.ManagedClusterSKU @@ -1908,66 +1838,75 @@ class ManagedCluster(Resource): :vartype security_profile: ~azure.mgmt.containerservice.v2021_09_01.models.ManagedClusterSecurityProfile :ivar public_network_access: Default value is 'Enabled' (case insensitive). Could be set to - 'Disabled' to enable private cluster. Known values are: "Enabled", "Disabled". + 'Disabled' to enable private cluster. Known values are: "Enabled" and "Disabled". :vartype public_network_access: str or ~azure.mgmt.containerservice.v2021_09_01.models.PublicNetworkAccess """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'provisioning_state': {'readonly': True}, - 'power_state': {'readonly': True}, - 'max_agent_pools': {'readonly': True}, - 'fqdn': {'readonly': True}, - 'private_fqdn': {'readonly': True}, - 'azure_portal_fqdn': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, + "provisioning_state": {"readonly": True}, + "power_state": {"readonly": True}, + "max_agent_pools": {"readonly": True}, + "fqdn": {"readonly": True}, + "private_fqdn": {"readonly": True}, + "azure_portal_fqdn": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'ManagedClusterSKU'}, - 'extended_location': {'key': 'extendedLocation', 'type': 'ExtendedLocation'}, - 'identity': {'key': 'identity', 'type': 'ManagedClusterIdentity'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'power_state': {'key': 'properties.powerState', 'type': 'PowerState'}, - 'max_agent_pools': {'key': 'properties.maxAgentPools', 'type': 'int'}, - 'kubernetes_version': {'key': 'properties.kubernetesVersion', 'type': 'str'}, - 'dns_prefix': {'key': 'properties.dnsPrefix', 'type': 'str'}, - 'fqdn_subdomain': {'key': 'properties.fqdnSubdomain', 'type': 'str'}, - 'fqdn': {'key': 'properties.fqdn', 'type': 'str'}, - 'private_fqdn': {'key': 'properties.privateFQDN', 'type': 'str'}, - 'azure_portal_fqdn': {'key': 'properties.azurePortalFQDN', 'type': 'str'}, - 'agent_pool_profiles': {'key': 'properties.agentPoolProfiles', 'type': '[ManagedClusterAgentPoolProfile]'}, - 'linux_profile': {'key': 'properties.linuxProfile', 'type': 'ContainerServiceLinuxProfile'}, - 'windows_profile': {'key': 'properties.windowsProfile', 'type': 'ManagedClusterWindowsProfile'}, - 'service_principal_profile': {'key': 'properties.servicePrincipalProfile', 'type': 'ManagedClusterServicePrincipalProfile'}, - 'addon_profiles': {'key': 'properties.addonProfiles', 'type': '{ManagedClusterAddonProfile}'}, - 'pod_identity_profile': {'key': 'properties.podIdentityProfile', 'type': 'ManagedClusterPodIdentityProfile'}, - 'node_resource_group': {'key': 'properties.nodeResourceGroup', 'type': 'str'}, - 'enable_rbac': {'key': 'properties.enableRBAC', 'type': 'bool'}, - 'enable_pod_security_policy': {'key': 'properties.enablePodSecurityPolicy', 'type': 'bool'}, - 'network_profile': {'key': 'properties.networkProfile', 'type': 'ContainerServiceNetworkProfile'}, - 'aad_profile': {'key': 'properties.aadProfile', 'type': 'ManagedClusterAADProfile'}, - 'auto_upgrade_profile': {'key': 'properties.autoUpgradeProfile', 'type': 'ManagedClusterAutoUpgradeProfile'}, - 'auto_scaler_profile': {'key': 'properties.autoScalerProfile', 'type': 'ManagedClusterPropertiesAutoScalerProfile'}, - 'api_server_access_profile': {'key': 'properties.apiServerAccessProfile', 'type': 'ManagedClusterAPIServerAccessProfile'}, - 'disk_encryption_set_id': {'key': 'properties.diskEncryptionSetID', 'type': 'str'}, - 'identity_profile': {'key': 'properties.identityProfile', 'type': '{UserAssignedIdentity}'}, - 'private_link_resources': {'key': 'properties.privateLinkResources', 'type': '[PrivateLinkResource]'}, - 'disable_local_accounts': {'key': 'properties.disableLocalAccounts', 'type': 'bool'}, - 'http_proxy_config': {'key': 'properties.httpProxyConfig', 'type': 'ManagedClusterHTTPProxyConfig'}, - 'security_profile': {'key': 'properties.securityProfile', 'type': 'ManagedClusterSecurityProfile'}, - 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, - } - - def __init__( + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "sku": {"key": "sku", "type": "ManagedClusterSKU"}, + "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, + "identity": {"key": "identity", "type": "ManagedClusterIdentity"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "power_state": {"key": "properties.powerState", "type": "PowerState"}, + "max_agent_pools": {"key": "properties.maxAgentPools", "type": "int"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "dns_prefix": {"key": "properties.dnsPrefix", "type": "str"}, + "fqdn_subdomain": {"key": "properties.fqdnSubdomain", "type": "str"}, + "fqdn": {"key": "properties.fqdn", "type": "str"}, + "private_fqdn": {"key": "properties.privateFQDN", "type": "str"}, + "azure_portal_fqdn": {"key": "properties.azurePortalFQDN", "type": "str"}, + "agent_pool_profiles": {"key": "properties.agentPoolProfiles", "type": "[ManagedClusterAgentPoolProfile]"}, + "linux_profile": {"key": "properties.linuxProfile", "type": "ContainerServiceLinuxProfile"}, + "windows_profile": {"key": "properties.windowsProfile", "type": "ManagedClusterWindowsProfile"}, + "service_principal_profile": { + "key": "properties.servicePrincipalProfile", + "type": "ManagedClusterServicePrincipalProfile", + }, + "addon_profiles": {"key": "properties.addonProfiles", "type": "{ManagedClusterAddonProfile}"}, + "pod_identity_profile": {"key": "properties.podIdentityProfile", "type": "ManagedClusterPodIdentityProfile"}, + "node_resource_group": {"key": "properties.nodeResourceGroup", "type": "str"}, + "enable_rbac": {"key": "properties.enableRBAC", "type": "bool"}, + "enable_pod_security_policy": {"key": "properties.enablePodSecurityPolicy", "type": "bool"}, + "network_profile": {"key": "properties.networkProfile", "type": "ContainerServiceNetworkProfile"}, + "aad_profile": {"key": "properties.aadProfile", "type": "ManagedClusterAADProfile"}, + "auto_upgrade_profile": {"key": "properties.autoUpgradeProfile", "type": "ManagedClusterAutoUpgradeProfile"}, + "auto_scaler_profile": { + "key": "properties.autoScalerProfile", + "type": "ManagedClusterPropertiesAutoScalerProfile", + }, + "api_server_access_profile": { + "key": "properties.apiServerAccessProfile", + "type": "ManagedClusterAPIServerAccessProfile", + }, + "disk_encryption_set_id": {"key": "properties.diskEncryptionSetID", "type": "str"}, + "identity_profile": {"key": "properties.identityProfile", "type": "{UserAssignedIdentity}"}, + "private_link_resources": {"key": "properties.privateLinkResources", "type": "[PrivateLinkResource]"}, + "disable_local_accounts": {"key": "properties.disableLocalAccounts", "type": "bool"}, + "http_proxy_config": {"key": "properties.httpProxyConfig", "type": "ManagedClusterHTTPProxyConfig"}, + "security_profile": {"key": "properties.securityProfile", "type": "ManagedClusterSecurityProfile"}, + "public_network_access": {"key": "properties.publicNetworkAccess", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, location: str, @@ -2002,9 +1941,9 @@ def __init__( **kwargs ): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword sku: The managed cluster SKU. :paramtype sku: ~azure.mgmt.containerservice.v2021_09_01.models.ManagedClusterSKU @@ -2088,11 +2027,11 @@ def __init__( :paramtype security_profile: ~azure.mgmt.containerservice.v2021_09_01.models.ManagedClusterSecurityProfile :keyword public_network_access: Default value is 'Enabled' (case insensitive). Could be set to - 'Disabled' to enable private cluster. Known values are: "Enabled", "Disabled". + 'Disabled' to enable private cluster. Known values are: "Enabled" and "Disabled". :paramtype public_network_access: str or ~azure.mgmt.containerservice.v2021_09_01.models.PublicNetworkAccess """ - super(ManagedCluster, self).__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.sku = sku self.extended_location = extended_location self.identity = identity @@ -2128,7 +2067,7 @@ def __init__( self.public_network_access = public_network_access -class ManagedClusterAADProfile(msrest.serialization.Model): +class ManagedClusterAADProfile(_serialization.Model): """For more details see `managed AAD on AKS `_. :ivar managed: Whether to enable managed AAD. @@ -2150,13 +2089,13 @@ class ManagedClusterAADProfile(msrest.serialization.Model): """ _attribute_map = { - 'managed': {'key': 'managed', 'type': 'bool'}, - 'enable_azure_rbac': {'key': 'enableAzureRBAC', 'type': 'bool'}, - 'admin_group_object_i_ds': {'key': 'adminGroupObjectIDs', 'type': '[str]'}, - 'client_app_id': {'key': 'clientAppID', 'type': 'str'}, - 'server_app_id': {'key': 'serverAppID', 'type': 'str'}, - 'server_app_secret': {'key': 'serverAppSecret', 'type': 'str'}, - 'tenant_id': {'key': 'tenantID', 'type': 'str'}, + "managed": {"key": "managed", "type": "bool"}, + "enable_azure_rbac": {"key": "enableAzureRBAC", "type": "bool"}, + "admin_group_object_i_ds": {"key": "adminGroupObjectIDs", "type": "[str]"}, + "client_app_id": {"key": "clientAppID", "type": "str"}, + "server_app_id": {"key": "serverAppID", "type": "str"}, + "server_app_secret": {"key": "serverAppSecret", "type": "str"}, + "tenant_id": {"key": "tenantID", "type": "str"}, } def __init__( @@ -2189,7 +2128,7 @@ def __init__( tenant of the deployment subscription. :paramtype tenant_id: str """ - super(ManagedClusterAADProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.managed = managed self.enable_azure_rbac = enable_azure_rbac self.admin_group_object_i_ds = admin_group_object_i_ds @@ -2212,58 +2151,53 @@ class ManagedClusterAccessProfile(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar kube_config: Base64-encoded Kubernetes configuration file. - :vartype kube_config: bytearray + :vartype kube_config: bytes """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'kube_config': {'key': 'properties.kubeConfig', 'type': 'bytearray'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "kube_config": {"key": "properties.kubeConfig", "type": "bytearray"}, } def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - kube_config: Optional[bytearray] = None, - **kwargs + self, *, location: str, tags: Optional[Dict[str, str]] = None, kube_config: Optional[bytes] = None, **kwargs ): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword kube_config: Base64-encoded Kubernetes configuration file. - :paramtype kube_config: bytearray + :paramtype kube_config: bytes """ - super(ManagedClusterAccessProfile, self).__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.kube_config = kube_config -class ManagedClusterAddonProfile(msrest.serialization.Model): +class ManagedClusterAddonProfile(_serialization.Model): """A Kubernetes add-on profile for a managed cluster. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar enabled: Required. Whether the add-on is enabled or not. + :ivar enabled: Whether the add-on is enabled or not. Required. :vartype enabled: bool :ivar config: Key-value pairs for configuring an add-on. :vartype config: dict[str, str] @@ -2273,36 +2207,30 @@ class ManagedClusterAddonProfile(msrest.serialization.Model): """ _validation = { - 'enabled': {'required': True}, - 'identity': {'readonly': True}, + "enabled": {"required": True}, + "identity": {"readonly": True}, } _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'config': {'key': 'config', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'ManagedClusterAddonProfileIdentity'}, + "enabled": {"key": "enabled", "type": "bool"}, + "config": {"key": "config", "type": "{str}"}, + "identity": {"key": "identity", "type": "ManagedClusterAddonProfileIdentity"}, } - def __init__( - self, - *, - enabled: bool, - config: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, enabled: bool, config: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword enabled: Required. Whether the add-on is enabled or not. + :keyword enabled: Whether the add-on is enabled or not. Required. :paramtype enabled: bool :keyword config: Key-value pairs for configuring an add-on. :paramtype config: dict[str, str] """ - super(ManagedClusterAddonProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.config = config self.identity = None -class UserAssignedIdentity(msrest.serialization.Model): +class UserAssignedIdentity(_serialization.Model): """Details about a user assigned identity. :ivar resource_id: The resource ID of the user assigned identity. @@ -2314,9 +2242,9 @@ class UserAssignedIdentity(msrest.serialization.Model): """ _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'object_id': {'key': 'objectId', 'type': 'str'}, + "resource_id": {"key": "resourceId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + "object_id": {"key": "objectId", "type": "str"}, } def __init__( @@ -2335,7 +2263,7 @@ def __init__( :keyword object_id: The object ID of the user assigned identity. :paramtype object_id: str """ - super(UserAssignedIdentity, self).__init__(**kwargs) + super().__init__(**kwargs) self.resource_id = resource_id self.client_id = client_id self.object_id = object_id @@ -2353,9 +2281,9 @@ class ManagedClusterAddonProfileIdentity(UserAssignedIdentity): """ _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'object_id': {'key': 'objectId', 'type': 'str'}, + "resource_id": {"key": "resourceId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + "object_id": {"key": "objectId", "type": "str"}, } def __init__( @@ -2374,10 +2302,10 @@ def __init__( :keyword object_id: The object ID of the user assigned identity. :paramtype object_id: str """ - super(ManagedClusterAddonProfileIdentity, self).__init__(resource_id=resource_id, client_id=client_id, object_id=object_id, **kwargs) + super().__init__(resource_id=resource_id, client_id=client_id, object_id=object_id, **kwargs) -class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): +class ManagedClusterAgentPoolProfileProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes """Properties for the container service agent pool profile. Variables are only populated by the server, and will be ignored when sending a request. @@ -2398,14 +2326,14 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2021_09_01.models.OSDiskType :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data - root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2021_09_01.models.KubeletDiskType :ivar workload_runtime: Determines the type of workload a node can run. Known values are: - "OCIContainer", "WasmWasi". + "OCIContainer" and "WasmWasi". :vartype workload_runtime: str or ~azure.mgmt.containerservice.v2021_09_01.models.WorkloadRuntime :ivar vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and used. @@ -2419,11 +2347,11 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :vartype pod_subnet_id: str :ivar max_pods: The maximum number of pods that can run on a node. :vartype max_pods: int - :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2021_09_01.models.OSType :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known - values are: "Ubuntu", "CBLMariner". + values are: "Ubuntu" and "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2021_09_01.models.OSSKU :ivar max_count: The maximum number of nodes for auto-scaling. :vartype max_count: int @@ -2432,14 +2360,14 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it - defaults to Delete. Known values are: "Delete", "Deallocate". + defaults to Delete. Known values are: "Delete" and "Deallocate". :vartype scale_down_mode: str or ~azure.mgmt.containerservice.v2021_09_01.models.ScaleDownMode - :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", + :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets" and "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2021_09_01.models.AgentPoolType :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :vartype mode: str or ~azure.mgmt.containerservice.v2021_09_01.models.AgentPoolMode :ivar orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -2474,20 +2402,18 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default - is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + is 'Regular'. Known values are: "Spot" and "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2021_09_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2021_09_01.models.ScaleSetEvictionPolicy :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :vartype spot_max_price: float - :ivar tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :ivar tags: The tags to be persisted on the agent pool virtual machine scale set. :vartype tags: dict[str, str] :ivar node_labels: The node labels to be persisted across all nodes in agent pool. :vartype node_labels: dict[str, str] @@ -2511,7 +2437,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): for more details. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2021_09_01.models.GPUInstanceProfile :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the node pool @@ -2520,54 +2446,54 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): """ _validation = { - 'os_disk_size_gb': {'maximum': 2048, 'minimum': 0}, - 'node_image_version': {'readonly': True}, - 'provisioning_state': {'readonly': True}, + "os_disk_size_gb": {"maximum": 2048, "minimum": 0}, + "node_image_version": {"readonly": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'os_disk_type': {'key': 'osDiskType', 'type': 'str'}, - 'kubelet_disk_type': {'key': 'kubeletDiskType', 'type': 'str'}, - 'workload_runtime': {'key': 'workloadRuntime', 'type': 'str'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'pod_subnet_id': {'key': 'podSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'maxPods', 'type': 'int'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'os_sku': {'key': 'osSKU', 'type': 'str'}, - 'max_count': {'key': 'maxCount', 'type': 'int'}, - 'min_count': {'key': 'minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'enableAutoScaling', 'type': 'bool'}, - 'scale_down_mode': {'key': 'scaleDownMode', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'mode': {'key': 'mode', 'type': 'str'}, - 'orchestrator_version': {'key': 'orchestratorVersion', 'type': 'str'}, - 'node_image_version': {'key': 'nodeImageVersion', 'type': 'str'}, - 'upgrade_settings': {'key': 'upgradeSettings', 'type': 'AgentPoolUpgradeSettings'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'power_state': {'key': 'powerState', 'type': 'PowerState'}, - 'availability_zones': {'key': 'availabilityZones', 'type': '[str]'}, - 'enable_node_public_ip': {'key': 'enableNodePublicIP', 'type': 'bool'}, - 'node_public_ip_prefix_id': {'key': 'nodePublicIPPrefixID', 'type': 'str'}, - 'scale_set_priority': {'key': 'scaleSetPriority', 'type': 'str'}, - 'scale_set_eviction_policy': {'key': 'scaleSetEvictionPolicy', 'type': 'str'}, - 'spot_max_price': {'key': 'spotMaxPrice', 'type': 'float'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'node_labels': {'key': 'nodeLabels', 'type': '{str}'}, - 'node_taints': {'key': 'nodeTaints', 'type': '[str]'}, - 'proximity_placement_group_id': {'key': 'proximityPlacementGroupID', 'type': 'str'}, - 'kubelet_config': {'key': 'kubeletConfig', 'type': 'KubeletConfig'}, - 'linux_os_config': {'key': 'linuxOSConfig', 'type': 'LinuxOSConfig'}, - 'enable_encryption_at_host': {'key': 'enableEncryptionAtHost', 'type': 'bool'}, - 'enable_ultra_ssd': {'key': 'enableUltraSSD', 'type': 'bool'}, - 'enable_fips': {'key': 'enableFIPS', 'type': 'bool'}, - 'gpu_instance_profile': {'key': 'gpuInstanceProfile', 'type': 'str'}, - 'creation_data': {'key': 'creationData', 'type': 'CreationData'}, - } - - def __init__( + "count": {"key": "count", "type": "int"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "os_disk_type": {"key": "osDiskType", "type": "str"}, + "kubelet_disk_type": {"key": "kubeletDiskType", "type": "str"}, + "workload_runtime": {"key": "workloadRuntime", "type": "str"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "pod_subnet_id": {"key": "podSubnetID", "type": "str"}, + "max_pods": {"key": "maxPods", "type": "int"}, + "os_type": {"key": "osType", "type": "str"}, + "os_sku": {"key": "osSKU", "type": "str"}, + "max_count": {"key": "maxCount", "type": "int"}, + "min_count": {"key": "minCount", "type": "int"}, + "enable_auto_scaling": {"key": "enableAutoScaling", "type": "bool"}, + "scale_down_mode": {"key": "scaleDownMode", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "mode": {"key": "mode", "type": "str"}, + "orchestrator_version": {"key": "orchestratorVersion", "type": "str"}, + "node_image_version": {"key": "nodeImageVersion", "type": "str"}, + "upgrade_settings": {"key": "upgradeSettings", "type": "AgentPoolUpgradeSettings"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "power_state": {"key": "powerState", "type": "PowerState"}, + "availability_zones": {"key": "availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "enableNodePublicIP", "type": "bool"}, + "node_public_ip_prefix_id": {"key": "nodePublicIPPrefixID", "type": "str"}, + "scale_set_priority": {"key": "scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "scaleSetEvictionPolicy", "type": "str"}, + "spot_max_price": {"key": "spotMaxPrice", "type": "float"}, + "tags": {"key": "tags", "type": "{str}"}, + "node_labels": {"key": "nodeLabels", "type": "{str}"}, + "node_taints": {"key": "nodeTaints", "type": "[str]"}, + "proximity_placement_group_id": {"key": "proximityPlacementGroupID", "type": "str"}, + "kubelet_config": {"key": "kubeletConfig", "type": "KubeletConfig"}, + "linux_os_config": {"key": "linuxOSConfig", "type": "LinuxOSConfig"}, + "enable_encryption_at_host": {"key": "enableEncryptionAtHost", "type": "bool"}, + "enable_ultra_ssd": {"key": "enableUltraSSD", "type": "bool"}, + "enable_fips": {"key": "enableFIPS", "type": "bool"}, + "gpu_instance_profile": {"key": "gpuInstanceProfile", "type": "str"}, + "creation_data": {"key": "creationData", "type": "CreationData"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, count: Optional[int] = None, @@ -2579,7 +2505,7 @@ def __init__( vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, @@ -2593,9 +2519,9 @@ def __init__( availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", - spot_max_price: Optional[float] = -1, + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", + spot_max_price: float = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, @@ -2626,14 +2552,14 @@ def __init__( larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2021_09_01.models.OSDiskType :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime - data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + data root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2021_09_01.models.KubeletDiskType :keyword workload_runtime: Determines the type of workload a node can run. Known values are: - "OCIContainer", "WasmWasi". + "OCIContainer" and "WasmWasi". :paramtype workload_runtime: str or ~azure.mgmt.containerservice.v2021_09_01.models.WorkloadRuntime :keyword vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and @@ -2647,11 +2573,11 @@ def __init__( :paramtype pod_subnet_id: str :keyword max_pods: The maximum number of pods that can run on a node. :paramtype max_pods: int - :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2021_09_01.models.OSType :keyword os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Known values are: "Ubuntu", "CBLMariner". + Known values are: "Ubuntu" and "CBLMariner". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2021_09_01.models.OSSKU :keyword max_count: The maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -2660,15 +2586,15 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, - it defaults to Delete. Known values are: "Delete", "Deallocate". + it defaults to Delete. Known values are: "Delete" and "Deallocate". :paramtype scale_down_mode: str or ~azure.mgmt.containerservice.v2021_09_01.models.ScaleDownMode - :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", + :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2021_09_01.models.AgentPoolType :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2021_09_01.models.AgentPoolMode :keyword orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -2699,20 +2625,18 @@ def __init__( /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the - default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + default is 'Regular'. Known values are: "Spot" and "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2021_09_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2021_09_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :paramtype spot_max_price: float - :keyword tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :keyword tags: The tags to be persisted on the agent pool virtual machine scale set. :paramtype tags: dict[str, str] :keyword node_labels: The node labels to be persisted across all nodes in agent pool. :paramtype node_labels: dict[str, str] @@ -2736,7 +2660,7 @@ def __init__( for more details. :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance - profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2021_09_01.models.GPUInstanceProfile @@ -2744,7 +2668,7 @@ def __init__( pool will be created/upgraded using a snapshot. :paramtype creation_data: ~azure.mgmt.containerservice.v2021_09_01.models.CreationData """ - super(ManagedClusterAgentPoolProfileProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.vm_size = vm_size self.os_disk_size_gb = os_disk_size_gb @@ -2786,7 +2710,9 @@ def __init__( self.creation_data = creation_data -class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): +class ManagedClusterAgentPoolProfile( + ManagedClusterAgentPoolProfileProperties +): # pylint: disable=too-many-instance-attributes """Profile for the container service agent pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -2809,14 +2735,14 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2021_09_01.models.OSDiskType :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data - root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2021_09_01.models.KubeletDiskType :ivar workload_runtime: Determines the type of workload a node can run. Known values are: - "OCIContainer", "WasmWasi". + "OCIContainer" and "WasmWasi". :vartype workload_runtime: str or ~azure.mgmt.containerservice.v2021_09_01.models.WorkloadRuntime :ivar vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and used. @@ -2830,11 +2756,11 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :vartype pod_subnet_id: str :ivar max_pods: The maximum number of pods that can run on a node. :vartype max_pods: int - :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2021_09_01.models.OSType :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known - values are: "Ubuntu", "CBLMariner". + values are: "Ubuntu" and "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2021_09_01.models.OSSKU :ivar max_count: The maximum number of nodes for auto-scaling. :vartype max_count: int @@ -2843,14 +2769,14 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it - defaults to Delete. Known values are: "Delete", "Deallocate". + defaults to Delete. Known values are: "Delete" and "Deallocate". :vartype scale_down_mode: str or ~azure.mgmt.containerservice.v2021_09_01.models.ScaleDownMode - :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", + :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets" and "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2021_09_01.models.AgentPoolType :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :vartype mode: str or ~azure.mgmt.containerservice.v2021_09_01.models.AgentPoolMode :ivar orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -2885,20 +2811,18 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default - is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + is 'Regular'. Known values are: "Spot" and "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2021_09_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2021_09_01.models.ScaleSetEvictionPolicy :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :vartype spot_max_price: float - :ivar tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :ivar tags: The tags to be persisted on the agent pool virtual machine scale set. :vartype tags: dict[str, str] :ivar node_labels: The node labels to be persisted across all nodes in agent pool. :vartype node_labels: dict[str, str] @@ -2922,67 +2846,67 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): for more details. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2021_09_01.models.GPUInstanceProfile :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the node pool will be created/upgraded using a snapshot. :vartype creation_data: ~azure.mgmt.containerservice.v2021_09_01.models.CreationData - :ivar name: Required. Windows agent pool names must be 6 characters or less. + :ivar name: Windows agent pool names must be 6 characters or less. Required. :vartype name: str """ _validation = { - 'os_disk_size_gb': {'maximum': 2048, 'minimum': 0}, - 'node_image_version': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'name': {'required': True, 'pattern': r'^[a-z][a-z0-9]{0,11}$'}, + "os_disk_size_gb": {"maximum": 2048, "minimum": 0}, + "node_image_version": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "name": {"required": True, "pattern": r"^[a-z][a-z0-9]{0,11}$"}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'os_disk_type': {'key': 'osDiskType', 'type': 'str'}, - 'kubelet_disk_type': {'key': 'kubeletDiskType', 'type': 'str'}, - 'workload_runtime': {'key': 'workloadRuntime', 'type': 'str'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'pod_subnet_id': {'key': 'podSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'maxPods', 'type': 'int'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'os_sku': {'key': 'osSKU', 'type': 'str'}, - 'max_count': {'key': 'maxCount', 'type': 'int'}, - 'min_count': {'key': 'minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'enableAutoScaling', 'type': 'bool'}, - 'scale_down_mode': {'key': 'scaleDownMode', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'mode': {'key': 'mode', 'type': 'str'}, - 'orchestrator_version': {'key': 'orchestratorVersion', 'type': 'str'}, - 'node_image_version': {'key': 'nodeImageVersion', 'type': 'str'}, - 'upgrade_settings': {'key': 'upgradeSettings', 'type': 'AgentPoolUpgradeSettings'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'power_state': {'key': 'powerState', 'type': 'PowerState'}, - 'availability_zones': {'key': 'availabilityZones', 'type': '[str]'}, - 'enable_node_public_ip': {'key': 'enableNodePublicIP', 'type': 'bool'}, - 'node_public_ip_prefix_id': {'key': 'nodePublicIPPrefixID', 'type': 'str'}, - 'scale_set_priority': {'key': 'scaleSetPriority', 'type': 'str'}, - 'scale_set_eviction_policy': {'key': 'scaleSetEvictionPolicy', 'type': 'str'}, - 'spot_max_price': {'key': 'spotMaxPrice', 'type': 'float'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'node_labels': {'key': 'nodeLabels', 'type': '{str}'}, - 'node_taints': {'key': 'nodeTaints', 'type': '[str]'}, - 'proximity_placement_group_id': {'key': 'proximityPlacementGroupID', 'type': 'str'}, - 'kubelet_config': {'key': 'kubeletConfig', 'type': 'KubeletConfig'}, - 'linux_os_config': {'key': 'linuxOSConfig', 'type': 'LinuxOSConfig'}, - 'enable_encryption_at_host': {'key': 'enableEncryptionAtHost', 'type': 'bool'}, - 'enable_ultra_ssd': {'key': 'enableUltraSSD', 'type': 'bool'}, - 'enable_fips': {'key': 'enableFIPS', 'type': 'bool'}, - 'gpu_instance_profile': {'key': 'gpuInstanceProfile', 'type': 'str'}, - 'creation_data': {'key': 'creationData', 'type': 'CreationData'}, - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( + "count": {"key": "count", "type": "int"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "os_disk_type": {"key": "osDiskType", "type": "str"}, + "kubelet_disk_type": {"key": "kubeletDiskType", "type": "str"}, + "workload_runtime": {"key": "workloadRuntime", "type": "str"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "pod_subnet_id": {"key": "podSubnetID", "type": "str"}, + "max_pods": {"key": "maxPods", "type": "int"}, + "os_type": {"key": "osType", "type": "str"}, + "os_sku": {"key": "osSKU", "type": "str"}, + "max_count": {"key": "maxCount", "type": "int"}, + "min_count": {"key": "minCount", "type": "int"}, + "enable_auto_scaling": {"key": "enableAutoScaling", "type": "bool"}, + "scale_down_mode": {"key": "scaleDownMode", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "mode": {"key": "mode", "type": "str"}, + "orchestrator_version": {"key": "orchestratorVersion", "type": "str"}, + "node_image_version": {"key": "nodeImageVersion", "type": "str"}, + "upgrade_settings": {"key": "upgradeSettings", "type": "AgentPoolUpgradeSettings"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "power_state": {"key": "powerState", "type": "PowerState"}, + "availability_zones": {"key": "availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "enableNodePublicIP", "type": "bool"}, + "node_public_ip_prefix_id": {"key": "nodePublicIPPrefixID", "type": "str"}, + "scale_set_priority": {"key": "scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "scaleSetEvictionPolicy", "type": "str"}, + "spot_max_price": {"key": "spotMaxPrice", "type": "float"}, + "tags": {"key": "tags", "type": "{str}"}, + "node_labels": {"key": "nodeLabels", "type": "{str}"}, + "node_taints": {"key": "nodeTaints", "type": "[str]"}, + "proximity_placement_group_id": {"key": "proximityPlacementGroupID", "type": "str"}, + "kubelet_config": {"key": "kubeletConfig", "type": "KubeletConfig"}, + "linux_os_config": {"key": "linuxOSConfig", "type": "LinuxOSConfig"}, + "enable_encryption_at_host": {"key": "enableEncryptionAtHost", "type": "bool"}, + "enable_ultra_ssd": {"key": "enableUltraSSD", "type": "bool"}, + "enable_fips": {"key": "enableFIPS", "type": "bool"}, + "gpu_instance_profile": {"key": "gpuInstanceProfile", "type": "str"}, + "creation_data": {"key": "creationData", "type": "CreationData"}, + "name": {"key": "name", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, name: str, @@ -2995,7 +2919,7 @@ def __init__( vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, @@ -3009,9 +2933,9 @@ def __init__( availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", - spot_max_price: Optional[float] = -1, + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", + spot_max_price: float = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, @@ -3042,14 +2966,14 @@ def __init__( larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2021_09_01.models.OSDiskType :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime - data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + data root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2021_09_01.models.KubeletDiskType :keyword workload_runtime: Determines the type of workload a node can run. Known values are: - "OCIContainer", "WasmWasi". + "OCIContainer" and "WasmWasi". :paramtype workload_runtime: str or ~azure.mgmt.containerservice.v2021_09_01.models.WorkloadRuntime :keyword vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and @@ -3063,11 +2987,11 @@ def __init__( :paramtype pod_subnet_id: str :keyword max_pods: The maximum number of pods that can run on a node. :paramtype max_pods: int - :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2021_09_01.models.OSType :keyword os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Known values are: "Ubuntu", "CBLMariner". + Known values are: "Ubuntu" and "CBLMariner". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2021_09_01.models.OSSKU :keyword max_count: The maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -3076,15 +3000,15 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, - it defaults to Delete. Known values are: "Delete", "Deallocate". + it defaults to Delete. Known values are: "Delete" and "Deallocate". :paramtype scale_down_mode: str or ~azure.mgmt.containerservice.v2021_09_01.models.ScaleDownMode - :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", + :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2021_09_01.models.AgentPoolType :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2021_09_01.models.AgentPoolMode :keyword orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -3115,20 +3039,18 @@ def __init__( /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the - default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + default is 'Regular'. Known values are: "Spot" and "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2021_09_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2021_09_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :paramtype spot_max_price: float - :keyword tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :keyword tags: The tags to be persisted on the agent pool virtual machine scale set. :paramtype tags: dict[str, str] :keyword node_labels: The node labels to be persisted across all nodes in agent pool. :paramtype node_labels: dict[str, str] @@ -3152,21 +3074,60 @@ def __init__( for more details. :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance - profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2021_09_01.models.GPUInstanceProfile :keyword creation_data: CreationData to be used to specify the source Snapshot ID if the node pool will be created/upgraded using a snapshot. :paramtype creation_data: ~azure.mgmt.containerservice.v2021_09_01.models.CreationData - :keyword name: Required. Windows agent pool names must be 6 characters or less. + :keyword name: Windows agent pool names must be 6 characters or less. Required. :paramtype name: str """ - super(ManagedClusterAgentPoolProfile, self).__init__(count=count, vm_size=vm_size, os_disk_size_gb=os_disk_size_gb, os_disk_type=os_disk_type, kubelet_disk_type=kubelet_disk_type, workload_runtime=workload_runtime, vnet_subnet_id=vnet_subnet_id, pod_subnet_id=pod_subnet_id, max_pods=max_pods, os_type=os_type, os_sku=os_sku, max_count=max_count, min_count=min_count, enable_auto_scaling=enable_auto_scaling, scale_down_mode=scale_down_mode, type=type, mode=mode, orchestrator_version=orchestrator_version, upgrade_settings=upgrade_settings, power_state=power_state, availability_zones=availability_zones, enable_node_public_ip=enable_node_public_ip, node_public_ip_prefix_id=node_public_ip_prefix_id, scale_set_priority=scale_set_priority, scale_set_eviction_policy=scale_set_eviction_policy, spot_max_price=spot_max_price, tags=tags, node_labels=node_labels, node_taints=node_taints, proximity_placement_group_id=proximity_placement_group_id, kubelet_config=kubelet_config, linux_os_config=linux_os_config, enable_encryption_at_host=enable_encryption_at_host, enable_ultra_ssd=enable_ultra_ssd, enable_fips=enable_fips, gpu_instance_profile=gpu_instance_profile, creation_data=creation_data, **kwargs) + super().__init__( + count=count, + vm_size=vm_size, + os_disk_size_gb=os_disk_size_gb, + os_disk_type=os_disk_type, + kubelet_disk_type=kubelet_disk_type, + workload_runtime=workload_runtime, + vnet_subnet_id=vnet_subnet_id, + pod_subnet_id=pod_subnet_id, + max_pods=max_pods, + os_type=os_type, + os_sku=os_sku, + max_count=max_count, + min_count=min_count, + enable_auto_scaling=enable_auto_scaling, + scale_down_mode=scale_down_mode, + type=type, + mode=mode, + orchestrator_version=orchestrator_version, + upgrade_settings=upgrade_settings, + power_state=power_state, + availability_zones=availability_zones, + enable_node_public_ip=enable_node_public_ip, + node_public_ip_prefix_id=node_public_ip_prefix_id, + scale_set_priority=scale_set_priority, + scale_set_eviction_policy=scale_set_eviction_policy, + spot_max_price=spot_max_price, + tags=tags, + node_labels=node_labels, + node_taints=node_taints, + proximity_placement_group_id=proximity_placement_group_id, + kubelet_config=kubelet_config, + linux_os_config=linux_os_config, + enable_encryption_at_host=enable_encryption_at_host, + enable_ultra_ssd=enable_ultra_ssd, + enable_fips=enable_fips, + gpu_instance_profile=gpu_instance_profile, + creation_data=creation_data, + **kwargs + ) self.name = name -class ManagedClusterAPIServerAccessProfile(msrest.serialization.Model): +class ManagedClusterAPIServerAccessProfile(_serialization.Model): """Access profile for managed cluster API server. :ivar authorized_ip_ranges: IP ranges are specified in CIDR format, e.g. 137.117.106.88/29. @@ -3189,11 +3150,11 @@ class ManagedClusterAPIServerAccessProfile(msrest.serialization.Model): """ _attribute_map = { - 'authorized_ip_ranges': {'key': 'authorizedIPRanges', 'type': '[str]'}, - 'enable_private_cluster': {'key': 'enablePrivateCluster', 'type': 'bool'}, - 'private_dns_zone': {'key': 'privateDNSZone', 'type': 'str'}, - 'enable_private_cluster_public_fqdn': {'key': 'enablePrivateClusterPublicFQDN', 'type': 'bool'}, - 'disable_run_command': {'key': 'disableRunCommand', 'type': 'bool'}, + "authorized_ip_ranges": {"key": "authorizedIPRanges", "type": "[str]"}, + "enable_private_cluster": {"key": "enablePrivateCluster", "type": "bool"}, + "private_dns_zone": {"key": "privateDNSZone", "type": "str"}, + "enable_private_cluster_public_fqdn": {"key": "enablePrivateClusterPublicFQDN", "type": "bool"}, + "disable_run_command": {"key": "disableRunCommand", "type": "bool"}, } def __init__( @@ -3225,7 +3186,7 @@ def __init__( :keyword disable_run_command: Whether to disable run command for the cluster or not. :paramtype disable_run_command: bool """ - super(ManagedClusterAPIServerAccessProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.authorized_ip_ranges = authorized_ip_ranges self.enable_private_cluster = enable_private_cluster self.private_dns_zone = private_dns_zone @@ -3233,37 +3194,32 @@ def __init__( self.disable_run_command = disable_run_command -class ManagedClusterAutoUpgradeProfile(msrest.serialization.Model): +class ManagedClusterAutoUpgradeProfile(_serialization.Model): """Auto upgrade profile for a managed cluster. :ivar upgrade_channel: For more information see `setting the AKS cluster auto-upgrade channel `_. Known values - are: "rapid", "stable", "patch", "node-image", "none". + are: "rapid", "stable", "patch", "node-image", and "none". :vartype upgrade_channel: str or ~azure.mgmt.containerservice.v2021_09_01.models.UpgradeChannel """ _attribute_map = { - 'upgrade_channel': {'key': 'upgradeChannel', 'type': 'str'}, + "upgrade_channel": {"key": "upgradeChannel", "type": "str"}, } - def __init__( - self, - *, - upgrade_channel: Optional[Union[str, "_models.UpgradeChannel"]] = None, - **kwargs - ): + def __init__(self, *, upgrade_channel: Optional[Union[str, "_models.UpgradeChannel"]] = None, **kwargs): """ :keyword upgrade_channel: For more information see `setting the AKS cluster auto-upgrade channel `_. - Known values are: "rapid", "stable", "patch", "node-image", "none". + Known values are: "rapid", "stable", "patch", "node-image", and "none". :paramtype upgrade_channel: str or ~azure.mgmt.containerservice.v2021_09_01.models.UpgradeChannel """ - super(ManagedClusterAutoUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.upgrade_channel = upgrade_channel -class ManagedClusterHTTPProxyConfig(msrest.serialization.Model): +class ManagedClusterHTTPProxyConfig(_serialization.Model): """Cluster HTTP proxy configuration. :ivar http_proxy: The HTTP proxy server endpoint to use. @@ -3277,10 +3233,10 @@ class ManagedClusterHTTPProxyConfig(msrest.serialization.Model): """ _attribute_map = { - 'http_proxy': {'key': 'httpProxy', 'type': 'str'}, - 'https_proxy': {'key': 'httpsProxy', 'type': 'str'}, - 'no_proxy': {'key': 'noProxy', 'type': '[str]'}, - 'trusted_ca': {'key': 'trustedCa', 'type': 'str'}, + "http_proxy": {"key": "httpProxy", "type": "str"}, + "https_proxy": {"key": "httpsProxy", "type": "str"}, + "no_proxy": {"key": "noProxy", "type": "[str]"}, + "trusted_ca": {"key": "trustedCa", "type": "str"}, } def __init__( @@ -3302,14 +3258,14 @@ def __init__( :keyword trusted_ca: Alternative CA cert to use for connecting to proxy servers. :paramtype trusted_ca: str """ - super(ManagedClusterHTTPProxyConfig, self).__init__(**kwargs) + super().__init__(**kwargs) self.http_proxy = http_proxy self.https_proxy = https_proxy self.no_proxy = no_proxy self.trusted_ca = trusted_ca -class ManagedClusterIdentity(msrest.serialization.Model): +class ManagedClusterIdentity(_serialization.Model): """Identity for the managed cluster. Variables are only populated by the server, and will be ignored when sending a request. @@ -3322,7 +3278,7 @@ class ManagedClusterIdentity(msrest.serialization.Model): :vartype tenant_id: str :ivar type: For more information see `use managed identities in AKS `_. Known values are: - "SystemAssigned", "UserAssigned", "None". + "SystemAssigned", "UserAssigned", and "None". :vartype type: str or ~azure.mgmt.containerservice.v2021_09_01.models.ResourceIdentityType :ivar user_assigned_identities: The keys must be ARM resource IDs in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. @@ -3331,42 +3287,47 @@ class ManagedClusterIdentity(msrest.serialization.Model): """ _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, + "principal_id": {"readonly": True}, + "tenant_id": {"readonly": True}, } _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{ManagedServiceIdentityUserAssignedIdentitiesValue}'}, + "principal_id": {"key": "principalId", "type": "str"}, + "tenant_id": {"key": "tenantId", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "user_assigned_identities": { + "key": "userAssignedIdentities", + "type": "{ManagedServiceIdentityUserAssignedIdentitiesValue}", + }, } def __init__( self, *, type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, - user_assigned_identities: Optional[Dict[str, "_models.ManagedServiceIdentityUserAssignedIdentitiesValue"]] = None, + user_assigned_identities: Optional[ + Dict[str, "_models.ManagedServiceIdentityUserAssignedIdentitiesValue"] + ] = None, **kwargs ): """ :keyword type: For more information see `use managed identities in AKS `_. Known values are: - "SystemAssigned", "UserAssigned", "None". + "SystemAssigned", "UserAssigned", and "None". :paramtype type: str or ~azure.mgmt.containerservice.v2021_09_01.models.ResourceIdentityType :keyword user_assigned_identities: The keys must be ARM resource IDs in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. :paramtype user_assigned_identities: dict[str, ~azure.mgmt.containerservice.v2021_09_01.models.ManagedServiceIdentityUserAssignedIdentitiesValue] """ - super(ManagedClusterIdentity, self).__init__(**kwargs) + super().__init__(**kwargs) self.principal_id = None self.tenant_id = None self.type = type self.user_assigned_identities = user_assigned_identities -class ManagedClusterListResult(msrest.serialization.Model): +class ManagedClusterListResult(_serialization.Model): """The response from the List Managed Clusters operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -3378,30 +3339,25 @@ class ManagedClusterListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[ManagedCluster]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[ManagedCluster]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.ManagedCluster"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.ManagedCluster"]] = None, **kwargs): """ :keyword value: The list of managed clusters. :paramtype value: list[~azure.mgmt.containerservice.v2021_09_01.models.ManagedCluster] """ - super(ManagedClusterListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class ManagedClusterLoadBalancerProfile(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfile(_serialization.Model): """Profile of the managed cluster load balancer. :ivar managed_outbound_i_ps: Desired managed outbound IPs for the cluster load balancer. @@ -3430,18 +3386,24 @@ class ManagedClusterLoadBalancerProfile(msrest.serialization.Model): """ _validation = { - 'allocated_outbound_ports': {'maximum': 64000, 'minimum': 0}, - 'idle_timeout_in_minutes': {'maximum': 120, 'minimum': 4}, + "allocated_outbound_ports": {"maximum": 64000, "minimum": 0}, + "idle_timeout_in_minutes": {"maximum": 120, "minimum": 4}, } _attribute_map = { - 'managed_outbound_i_ps': {'key': 'managedOutboundIPs', 'type': 'ManagedClusterLoadBalancerProfileManagedOutboundIPs'}, - 'outbound_ip_prefixes': {'key': 'outboundIPPrefixes', 'type': 'ManagedClusterLoadBalancerProfileOutboundIPPrefixes'}, - 'outbound_i_ps': {'key': 'outboundIPs', 'type': 'ManagedClusterLoadBalancerProfileOutboundIPs'}, - 'effective_outbound_i_ps': {'key': 'effectiveOutboundIPs', 'type': '[ResourceReference]'}, - 'allocated_outbound_ports': {'key': 'allocatedOutboundPorts', 'type': 'int'}, - 'idle_timeout_in_minutes': {'key': 'idleTimeoutInMinutes', 'type': 'int'}, - 'enable_multiple_standard_load_balancers': {'key': 'enableMultipleStandardLoadBalancers', 'type': 'bool'}, + "managed_outbound_i_ps": { + "key": "managedOutboundIPs", + "type": "ManagedClusterLoadBalancerProfileManagedOutboundIPs", + }, + "outbound_ip_prefixes": { + "key": "outboundIPPrefixes", + "type": "ManagedClusterLoadBalancerProfileOutboundIPPrefixes", + }, + "outbound_i_ps": {"key": "outboundIPs", "type": "ManagedClusterLoadBalancerProfileOutboundIPs"}, + "effective_outbound_i_ps": {"key": "effectiveOutboundIPs", "type": "[ResourceReference]"}, + "allocated_outbound_ports": {"key": "allocatedOutboundPorts", "type": "int"}, + "idle_timeout_in_minutes": {"key": "idleTimeoutInMinutes", "type": "int"}, + "enable_multiple_standard_load_balancers": {"key": "enableMultipleStandardLoadBalancers", "type": "bool"}, } def __init__( @@ -3451,8 +3413,8 @@ def __init__( outbound_ip_prefixes: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPPrefixes"] = None, outbound_i_ps: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPs"] = None, effective_outbound_i_ps: Optional[List["_models.ResourceReference"]] = None, - allocated_outbound_ports: Optional[int] = 0, - idle_timeout_in_minutes: Optional[int] = 30, + allocated_outbound_ports: int = 0, + idle_timeout_in_minutes: int = 30, enable_multiple_standard_load_balancers: Optional[bool] = None, **kwargs ): @@ -3482,7 +3444,7 @@ def __init__( AKS cluster or not. :paramtype enable_multiple_standard_load_balancers: bool """ - super(ManagedClusterLoadBalancerProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.managed_outbound_i_ps = managed_outbound_i_ps self.outbound_ip_prefixes = outbound_ip_prefixes self.outbound_i_ps = outbound_i_ps @@ -3492,7 +3454,7 @@ def __init__( self.enable_multiple_standard_load_balancers = enable_multiple_standard_load_balancers -class ManagedClusterLoadBalancerProfileManagedOutboundIPs(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfileManagedOutboundIPs(_serialization.Model): """Desired managed outbound IPs for the cluster load balancer. :ivar count: The desired number of outbound IPs created/managed by Azure for the cluster load @@ -3501,30 +3463,25 @@ class ManagedClusterLoadBalancerProfileManagedOutboundIPs(msrest.serialization.M """ _validation = { - 'count': {'maximum': 100, 'minimum': 1}, + "count": {"maximum": 100, "minimum": 1}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, + "count": {"key": "count", "type": "int"}, } - def __init__( - self, - *, - count: Optional[int] = 1, - **kwargs - ): + def __init__(self, *, count: int = 1, **kwargs): """ :keyword count: The desired number of outbound IPs created/managed by Azure for the cluster load balancer. Allowed values must be in the range of 1 to 100 (inclusive). The default value is 1. :paramtype count: int """ - super(ManagedClusterLoadBalancerProfileManagedOutboundIPs, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count -class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(_serialization.Model): """Desired outbound IP Prefix resources for the cluster load balancer. :ivar public_ip_prefixes: A list of public IP prefix resources. @@ -3533,25 +3490,20 @@ class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(msrest.serialization.M """ _attribute_map = { - 'public_ip_prefixes': {'key': 'publicIPPrefixes', 'type': '[ResourceReference]'}, + "public_ip_prefixes": {"key": "publicIPPrefixes", "type": "[ResourceReference]"}, } - def __init__( - self, - *, - public_ip_prefixes: Optional[List["_models.ResourceReference"]] = None, - **kwargs - ): + def __init__(self, *, public_ip_prefixes: Optional[List["_models.ResourceReference"]] = None, **kwargs): """ :keyword public_ip_prefixes: A list of public IP prefix resources. :paramtype public_ip_prefixes: list[~azure.mgmt.containerservice.v2021_09_01.models.ResourceReference] """ - super(ManagedClusterLoadBalancerProfileOutboundIPPrefixes, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_ip_prefixes = public_ip_prefixes -class ManagedClusterLoadBalancerProfileOutboundIPs(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfileOutboundIPs(_serialization.Model): """Desired outbound IP resources for the cluster load balancer. :ivar public_i_ps: A list of public IP resources. @@ -3559,24 +3511,19 @@ class ManagedClusterLoadBalancerProfileOutboundIPs(msrest.serialization.Model): """ _attribute_map = { - 'public_i_ps': {'key': 'publicIPs', 'type': '[ResourceReference]'}, + "public_i_ps": {"key": "publicIPs", "type": "[ResourceReference]"}, } - def __init__( - self, - *, - public_i_ps: Optional[List["_models.ResourceReference"]] = None, - **kwargs - ): + def __init__(self, *, public_i_ps: Optional[List["_models.ResourceReference"]] = None, **kwargs): """ :keyword public_i_ps: A list of public IP resources. :paramtype public_i_ps: list[~azure.mgmt.containerservice.v2021_09_01.models.ResourceReference] """ - super(ManagedClusterLoadBalancerProfileOutboundIPs, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_i_ps = public_i_ps -class ManagedClusterManagedOutboundIPProfile(msrest.serialization.Model): +class ManagedClusterManagedOutboundIPProfile(_serialization.Model): """Profile of the managed outbound IP resources of the managed cluster. :ivar count: The desired number of outbound IPs created/managed by Azure. Allowed values must @@ -3585,29 +3532,24 @@ class ManagedClusterManagedOutboundIPProfile(msrest.serialization.Model): """ _validation = { - 'count': {'maximum': 16, 'minimum': 1}, + "count": {"maximum": 16, "minimum": 1}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, + "count": {"key": "count", "type": "int"}, } - def __init__( - self, - *, - count: Optional[int] = 1, - **kwargs - ): + def __init__(self, *, count: int = 1, **kwargs): """ :keyword count: The desired number of outbound IPs created/managed by Azure. Allowed values must be in the range of 1 to 16 (inclusive). The default value is 1. :paramtype count: int """ - super(ManagedClusterManagedOutboundIPProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count -class ManagedClusterNATGatewayProfile(msrest.serialization.Model): +class ManagedClusterNATGatewayProfile(_serialization.Model): """Profile of the managed cluster NAT gateway. :ivar managed_outbound_ip_profile: Profile of the managed outbound IP resources of the cluster @@ -3623,13 +3565,16 @@ class ManagedClusterNATGatewayProfile(msrest.serialization.Model): """ _validation = { - 'idle_timeout_in_minutes': {'maximum': 120, 'minimum': 4}, + "idle_timeout_in_minutes": {"maximum": 120, "minimum": 4}, } _attribute_map = { - 'managed_outbound_ip_profile': {'key': 'managedOutboundIPProfile', 'type': 'ManagedClusterManagedOutboundIPProfile'}, - 'effective_outbound_i_ps': {'key': 'effectiveOutboundIPs', 'type': '[ResourceReference]'}, - 'idle_timeout_in_minutes': {'key': 'idleTimeoutInMinutes', 'type': 'int'}, + "managed_outbound_ip_profile": { + "key": "managedOutboundIPProfile", + "type": "ManagedClusterManagedOutboundIPProfile", + }, + "effective_outbound_i_ps": {"key": "effectiveOutboundIPs", "type": "[ResourceReference]"}, + "idle_timeout_in_minutes": {"key": "idleTimeoutInMinutes", "type": "int"}, } def __init__( @@ -3637,7 +3582,7 @@ def __init__( *, managed_outbound_ip_profile: Optional["_models.ManagedClusterManagedOutboundIPProfile"] = None, effective_outbound_i_ps: Optional[List["_models.ResourceReference"]] = None, - idle_timeout_in_minutes: Optional[int] = 4, + idle_timeout_in_minutes: int = 4, **kwargs ): """ @@ -3653,29 +3598,29 @@ def __init__( are in the range of 4 to 120 (inclusive). The default value is 4 minutes. :paramtype idle_timeout_in_minutes: int """ - super(ManagedClusterNATGatewayProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.managed_outbound_ip_profile = managed_outbound_ip_profile self.effective_outbound_i_ps = effective_outbound_i_ps self.idle_timeout_in_minutes = idle_timeout_in_minutes -class ManagedClusterPodIdentity(msrest.serialization.Model): +class ManagedClusterPodIdentity(_serialization.Model): """Details about the pod identity assigned to the Managed Cluster. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar name: Required. The name of the pod identity. + :ivar name: The name of the pod identity. Required. :vartype name: str - :ivar namespace: Required. The namespace of the pod identity. + :ivar namespace: The namespace of the pod identity. Required. :vartype namespace: str :ivar binding_selector: The binding selector to use for the AzureIdentityBinding resource. :vartype binding_selector: str - :ivar identity: Required. The user assigned identity details. + :ivar identity: The user assigned identity details. Required. :vartype identity: ~azure.mgmt.containerservice.v2021_09_01.models.UserAssignedIdentity :ivar provisioning_state: The current provisioning state of the pod identity. Known values are: - "Assigned", "Updating", "Deleting", "Failed". + "Assigned", "Updating", "Deleting", and "Failed". :vartype provisioning_state: str or ~azure.mgmt.containerservice.v2021_09_01.models.ManagedClusterPodIdentityProvisioningState :ivar provisioning_info: @@ -3684,20 +3629,20 @@ class ManagedClusterPodIdentity(msrest.serialization.Model): """ _validation = { - 'name': {'required': True}, - 'namespace': {'required': True}, - 'identity': {'required': True}, - 'provisioning_state': {'readonly': True}, - 'provisioning_info': {'readonly': True}, + "name": {"required": True}, + "namespace": {"required": True}, + "identity": {"required": True}, + "provisioning_state": {"readonly": True}, + "provisioning_info": {"readonly": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'namespace': {'key': 'namespace', 'type': 'str'}, - 'binding_selector': {'key': 'bindingSelector', 'type': 'str'}, - 'identity': {'key': 'identity', 'type': 'UserAssignedIdentity'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'provisioning_info': {'key': 'provisioningInfo', 'type': 'ManagedClusterPodIdentityProvisioningInfo'}, + "name": {"key": "name", "type": "str"}, + "namespace": {"key": "namespace", "type": "str"}, + "binding_selector": {"key": "bindingSelector", "type": "str"}, + "identity": {"key": "identity", "type": "UserAssignedIdentity"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "provisioning_info": {"key": "provisioningInfo", "type": "ManagedClusterPodIdentityProvisioningInfo"}, } def __init__( @@ -3710,16 +3655,16 @@ def __init__( **kwargs ): """ - :keyword name: Required. The name of the pod identity. + :keyword name: The name of the pod identity. Required. :paramtype name: str - :keyword namespace: Required. The namespace of the pod identity. + :keyword namespace: The namespace of the pod identity. Required. :paramtype namespace: str :keyword binding_selector: The binding selector to use for the AzureIdentityBinding resource. :paramtype binding_selector: str - :keyword identity: Required. The user assigned identity details. + :keyword identity: The user assigned identity details. Required. :paramtype identity: ~azure.mgmt.containerservice.v2021_09_01.models.UserAssignedIdentity """ - super(ManagedClusterPodIdentity, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.namespace = namespace self.binding_selector = binding_selector @@ -3728,54 +3673,47 @@ def __init__( self.provisioning_info = None -class ManagedClusterPodIdentityException(msrest.serialization.Model): +class ManagedClusterPodIdentityException(_serialization.Model): """See `disable AAD Pod Identity for a specific Pod/Application `_ for more details. All required parameters must be populated in order to send to Azure. - :ivar name: Required. The name of the pod identity exception. + :ivar name: The name of the pod identity exception. Required. :vartype name: str - :ivar namespace: Required. The namespace of the pod identity exception. + :ivar namespace: The namespace of the pod identity exception. Required. :vartype namespace: str - :ivar pod_labels: Required. The pod labels to match. + :ivar pod_labels: The pod labels to match. Required. :vartype pod_labels: dict[str, str] """ _validation = { - 'name': {'required': True}, - 'namespace': {'required': True}, - 'pod_labels': {'required': True}, + "name": {"required": True}, + "namespace": {"required": True}, + "pod_labels": {"required": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'namespace': {'key': 'namespace', 'type': 'str'}, - 'pod_labels': {'key': 'podLabels', 'type': '{str}'}, + "name": {"key": "name", "type": "str"}, + "namespace": {"key": "namespace", "type": "str"}, + "pod_labels": {"key": "podLabels", "type": "{str}"}, } - def __init__( - self, - *, - name: str, - namespace: str, - pod_labels: Dict[str, str], - **kwargs - ): + def __init__(self, *, name: str, namespace: str, pod_labels: Dict[str, str], **kwargs): """ - :keyword name: Required. The name of the pod identity exception. + :keyword name: The name of the pod identity exception. Required. :paramtype name: str - :keyword namespace: Required. The namespace of the pod identity exception. + :keyword namespace: The namespace of the pod identity exception. Required. :paramtype namespace: str - :keyword pod_labels: Required. The pod labels to match. + :keyword pod_labels: The pod labels to match. Required. :paramtype pod_labels: dict[str, str] """ - super(ManagedClusterPodIdentityException, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.namespace = namespace self.pod_labels = pod_labels -class ManagedClusterPodIdentityProfile(msrest.serialization.Model): +class ManagedClusterPodIdentityProfile(_serialization.Model): """See `use AAD pod identity `_ for more details on pod identity integration. :ivar enabled: Whether the pod identity addon is enabled. @@ -3795,10 +3733,13 @@ class ManagedClusterPodIdentityProfile(msrest.serialization.Model): """ _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'allow_network_plugin_kubenet': {'key': 'allowNetworkPluginKubenet', 'type': 'bool'}, - 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '[ManagedClusterPodIdentity]'}, - 'user_assigned_identity_exceptions': {'key': 'userAssignedIdentityExceptions', 'type': '[ManagedClusterPodIdentityException]'}, + "enabled": {"key": "enabled", "type": "bool"}, + "allow_network_plugin_kubenet": {"key": "allowNetworkPluginKubenet", "type": "bool"}, + "user_assigned_identities": {"key": "userAssignedIdentities", "type": "[ManagedClusterPodIdentity]"}, + "user_assigned_identity_exceptions": { + "key": "userAssignedIdentityExceptions", + "type": "[ManagedClusterPodIdentityException]", + }, } def __init__( @@ -3826,14 +3767,14 @@ def __init__( :paramtype user_assigned_identity_exceptions: list[~azure.mgmt.containerservice.v2021_09_01.models.ManagedClusterPodIdentityException] """ - super(ManagedClusterPodIdentityProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.allow_network_plugin_kubenet = allow_network_plugin_kubenet self.user_assigned_identities = user_assigned_identities self.user_assigned_identity_exceptions = user_assigned_identity_exceptions -class ManagedClusterPodIdentityProvisioningError(msrest.serialization.Model): +class ManagedClusterPodIdentityProvisioningError(_serialization.Model): """An error response from the pod identity provisioning. :ivar error: Details about the error. @@ -3842,25 +3783,20 @@ class ManagedClusterPodIdentityProvisioningError(msrest.serialization.Model): """ _attribute_map = { - 'error': {'key': 'error', 'type': 'ManagedClusterPodIdentityProvisioningErrorBody'}, + "error": {"key": "error", "type": "ManagedClusterPodIdentityProvisioningErrorBody"}, } - def __init__( - self, - *, - error: Optional["_models.ManagedClusterPodIdentityProvisioningErrorBody"] = None, - **kwargs - ): + def __init__(self, *, error: Optional["_models.ManagedClusterPodIdentityProvisioningErrorBody"] = None, **kwargs): """ :keyword error: Details about the error. :paramtype error: ~azure.mgmt.containerservice.v2021_09_01.models.ManagedClusterPodIdentityProvisioningErrorBody """ - super(ManagedClusterPodIdentityProvisioningError, self).__init__(**kwargs) + super().__init__(**kwargs) self.error = error -class ManagedClusterPodIdentityProvisioningErrorBody(msrest.serialization.Model): +class ManagedClusterPodIdentityProvisioningErrorBody(_serialization.Model): """An error response from the pod identity provisioning. :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed @@ -3878,10 +3814,10 @@ class ManagedClusterPodIdentityProvisioningErrorBody(msrest.serialization.Model) """ _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[ManagedClusterPodIdentityProvisioningErrorBody]'}, + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[ManagedClusterPodIdentityProvisioningErrorBody]"}, } def __init__( @@ -3907,14 +3843,14 @@ def __init__( :paramtype details: list[~azure.mgmt.containerservice.v2021_09_01.models.ManagedClusterPodIdentityProvisioningErrorBody] """ - super(ManagedClusterPodIdentityProvisioningErrorBody, self).__init__(**kwargs) + super().__init__(**kwargs) self.code = code self.message = message self.target = target self.details = details -class ManagedClusterPodIdentityProvisioningInfo(msrest.serialization.Model): +class ManagedClusterPodIdentityProvisioningInfo(_serialization.Model): """ManagedClusterPodIdentityProvisioningInfo. :ivar error: Pod identity assignment error (if any). @@ -3923,35 +3859,30 @@ class ManagedClusterPodIdentityProvisioningInfo(msrest.serialization.Model): """ _attribute_map = { - 'error': {'key': 'error', 'type': 'ManagedClusterPodIdentityProvisioningError'}, + "error": {"key": "error", "type": "ManagedClusterPodIdentityProvisioningError"}, } - def __init__( - self, - *, - error: Optional["_models.ManagedClusterPodIdentityProvisioningError"] = None, - **kwargs - ): + def __init__(self, *, error: Optional["_models.ManagedClusterPodIdentityProvisioningError"] = None, **kwargs): """ :keyword error: Pod identity assignment error (if any). :paramtype error: ~azure.mgmt.containerservice.v2021_09_01.models.ManagedClusterPodIdentityProvisioningError """ - super(ManagedClusterPodIdentityProvisioningInfo, self).__init__(**kwargs) + super().__init__(**kwargs) self.error = error -class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): +class ManagedClusterPoolUpgradeProfile(_serialization.Model): """The list of available upgrade versions. All required parameters must be populated in order to send to Azure. - :ivar kubernetes_version: Required. The Kubernetes version (major.minor.patch). + :ivar kubernetes_version: The Kubernetes version (major.minor.patch). Required. :vartype kubernetes_version: str :ivar name: The Agent Pool name. :vartype name: str - :ivar os_type: Required. The operating system type. The default is Linux. Known values are: - "Linux", "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2021_09_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -3959,15 +3890,15 @@ class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): """ _validation = { - 'kubernetes_version': {'required': True}, - 'os_type': {'required': True}, + "kubernetes_version": {"required": True}, + "os_type": {"required": True}, } _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'upgrades': {'key': 'upgrades', 'type': '[ManagedClusterPoolUpgradeProfileUpgradesItem]'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "os_type": {"key": "osType", "type": "str"}, + "upgrades": {"key": "upgrades", "type": "[ManagedClusterPoolUpgradeProfileUpgradesItem]"}, } def __init__( @@ -3980,25 +3911,25 @@ def __init__( **kwargs ): """ - :keyword kubernetes_version: Required. The Kubernetes version (major.minor.patch). + :keyword kubernetes_version: The Kubernetes version (major.minor.patch). Required. :paramtype kubernetes_version: str :keyword name: The Agent Pool name. :paramtype name: str - :keyword os_type: Required. The operating system type. The default is Linux. Known values are: - "Linux", "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2021_09_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: list[~azure.mgmt.containerservice.v2021_09_01.models.ManagedClusterPoolUpgradeProfileUpgradesItem] """ - super(ManagedClusterPoolUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.name = name self.os_type = os_type self.upgrades = upgrades -class ManagedClusterPoolUpgradeProfileUpgradesItem(msrest.serialization.Model): +class ManagedClusterPoolUpgradeProfileUpgradesItem(_serialization.Model): """ManagedClusterPoolUpgradeProfileUpgradesItem. :ivar kubernetes_version: The Kubernetes version (major.minor.patch). @@ -4008,36 +3939,30 @@ class ManagedClusterPoolUpgradeProfileUpgradesItem(msrest.serialization.Model): """ _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } - def __init__( - self, - *, - kubernetes_version: Optional[str] = None, - is_preview: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, kubernetes_version: Optional[str] = None, is_preview: Optional[bool] = None, **kwargs): """ :keyword kubernetes_version: The Kubernetes version (major.minor.patch). :paramtype kubernetes_version: str :keyword is_preview: Whether the Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(ManagedClusterPoolUpgradeProfileUpgradesItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.is_preview = is_preview -class ManagedClusterPropertiesAutoScalerProfile(msrest.serialization.Model): +class ManagedClusterPropertiesAutoScalerProfile(_serialization.Model): # pylint: disable=too-many-instance-attributes """Parameters to be applied to the cluster-autoscaler when enabled. :ivar balance_similar_node_groups: Valid values are 'true' and 'false'. :vartype balance_similar_node_groups: str :ivar expander: If not specified, the default is 'random'. See `expanders `_ - for more information. Known values are: "least-waste", "most-pods", "priority", "random". + for more information. Known values are: "least-waste", "most-pods", "priority", and "random". :vartype expander: str or ~azure.mgmt.containerservice.v2021_09_01.models.Expander :ivar max_empty_bulk_delete: The default is 10. :vartype max_empty_bulk_delete: str @@ -4081,23 +4006,23 @@ class ManagedClusterPropertiesAutoScalerProfile(msrest.serialization.Model): """ _attribute_map = { - 'balance_similar_node_groups': {'key': 'balance-similar-node-groups', 'type': 'str'}, - 'expander': {'key': 'expander', 'type': 'str'}, - 'max_empty_bulk_delete': {'key': 'max-empty-bulk-delete', 'type': 'str'}, - 'max_graceful_termination_sec': {'key': 'max-graceful-termination-sec', 'type': 'str'}, - 'max_node_provision_time': {'key': 'max-node-provision-time', 'type': 'str'}, - 'max_total_unready_percentage': {'key': 'max-total-unready-percentage', 'type': 'str'}, - 'new_pod_scale_up_delay': {'key': 'new-pod-scale-up-delay', 'type': 'str'}, - 'ok_total_unready_count': {'key': 'ok-total-unready-count', 'type': 'str'}, - 'scan_interval': {'key': 'scan-interval', 'type': 'str'}, - 'scale_down_delay_after_add': {'key': 'scale-down-delay-after-add', 'type': 'str'}, - 'scale_down_delay_after_delete': {'key': 'scale-down-delay-after-delete', 'type': 'str'}, - 'scale_down_delay_after_failure': {'key': 'scale-down-delay-after-failure', 'type': 'str'}, - 'scale_down_unneeded_time': {'key': 'scale-down-unneeded-time', 'type': 'str'}, - 'scale_down_unready_time': {'key': 'scale-down-unready-time', 'type': 'str'}, - 'scale_down_utilization_threshold': {'key': 'scale-down-utilization-threshold', 'type': 'str'}, - 'skip_nodes_with_local_storage': {'key': 'skip-nodes-with-local-storage', 'type': 'str'}, - 'skip_nodes_with_system_pods': {'key': 'skip-nodes-with-system-pods', 'type': 'str'}, + "balance_similar_node_groups": {"key": "balance-similar-node-groups", "type": "str"}, + "expander": {"key": "expander", "type": "str"}, + "max_empty_bulk_delete": {"key": "max-empty-bulk-delete", "type": "str"}, + "max_graceful_termination_sec": {"key": "max-graceful-termination-sec", "type": "str"}, + "max_node_provision_time": {"key": "max-node-provision-time", "type": "str"}, + "max_total_unready_percentage": {"key": "max-total-unready-percentage", "type": "str"}, + "new_pod_scale_up_delay": {"key": "new-pod-scale-up-delay", "type": "str"}, + "ok_total_unready_count": {"key": "ok-total-unready-count", "type": "str"}, + "scan_interval": {"key": "scan-interval", "type": "str"}, + "scale_down_delay_after_add": {"key": "scale-down-delay-after-add", "type": "str"}, + "scale_down_delay_after_delete": {"key": "scale-down-delay-after-delete", "type": "str"}, + "scale_down_delay_after_failure": {"key": "scale-down-delay-after-failure", "type": "str"}, + "scale_down_unneeded_time": {"key": "scale-down-unneeded-time", "type": "str"}, + "scale_down_unready_time": {"key": "scale-down-unready-time", "type": "str"}, + "scale_down_utilization_threshold": {"key": "scale-down-utilization-threshold", "type": "str"}, + "skip_nodes_with_local_storage": {"key": "skip-nodes-with-local-storage", "type": "str"}, + "skip_nodes_with_system_pods": {"key": "skip-nodes-with-system-pods", "type": "str"}, } def __init__( @@ -4127,7 +4052,7 @@ def __init__( :paramtype balance_similar_node_groups: str :keyword expander: If not specified, the default is 'random'. See `expanders `_ - for more information. Known values are: "least-waste", "most-pods", "priority", "random". + for more information. Known values are: "least-waste", "most-pods", "priority", and "random". :paramtype expander: str or ~azure.mgmt.containerservice.v2021_09_01.models.Expander :keyword max_empty_bulk_delete: The default is 10. :paramtype max_empty_bulk_delete: str @@ -4170,7 +4095,7 @@ def __init__( :keyword skip_nodes_with_system_pods: The default is true. :paramtype skip_nodes_with_system_pods: str """ - super(ManagedClusterPropertiesAutoScalerProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.balance_similar_node_groups = balance_similar_node_groups self.expander = expander self.max_empty_bulk_delete = max_empty_bulk_delete @@ -4190,7 +4115,7 @@ def __init__( self.skip_nodes_with_system_pods = skip_nodes_with_system_pods -class ManagedClusterSecurityProfile(msrest.serialization.Model): +class ManagedClusterSecurityProfile(_serialization.Model): """Security profile for the container service cluster. :ivar azure_defender: Azure Defender settings for the security profile. @@ -4199,25 +4124,22 @@ class ManagedClusterSecurityProfile(msrest.serialization.Model): """ _attribute_map = { - 'azure_defender': {'key': 'azureDefender', 'type': 'ManagedClusterSecurityProfileAzureDefender'}, + "azure_defender": {"key": "azureDefender", "type": "ManagedClusterSecurityProfileAzureDefender"}, } def __init__( - self, - *, - azure_defender: Optional["_models.ManagedClusterSecurityProfileAzureDefender"] = None, - **kwargs + self, *, azure_defender: Optional["_models.ManagedClusterSecurityProfileAzureDefender"] = None, **kwargs ): """ :keyword azure_defender: Azure Defender settings for the security profile. :paramtype azure_defender: ~azure.mgmt.containerservice.v2021_09_01.models.ManagedClusterSecurityProfileAzureDefender """ - super(ManagedClusterSecurityProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.azure_defender = azure_defender -class ManagedClusterSecurityProfileAzureDefender(msrest.serialization.Model): +class ManagedClusterSecurityProfileAzureDefender(_serialization.Model): """Azure Defender settings for the security profile. :ivar enabled: Whether to enable Azure Defender. @@ -4230,16 +4152,12 @@ class ManagedClusterSecurityProfileAzureDefender(msrest.serialization.Model): """ _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'log_analytics_workspace_resource_id': {'key': 'logAnalyticsWorkspaceResourceId', 'type': 'str'}, + "enabled": {"key": "enabled", "type": "bool"}, + "log_analytics_workspace_resource_id": {"key": "logAnalyticsWorkspaceResourceId", "type": "str"}, } def __init__( - self, - *, - enabled: Optional[bool] = None, - log_analytics_workspace_resource_id: Optional[str] = None, - **kwargs + self, *, enabled: Optional[bool] = None, log_analytics_workspace_resource_id: Optional[str] = None, **kwargs ): """ :keyword enabled: Whether to enable Azure Defender. @@ -4250,63 +4168,57 @@ def __init__( be exists. :paramtype log_analytics_workspace_resource_id: str """ - super(ManagedClusterSecurityProfileAzureDefender, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.log_analytics_workspace_resource_id = log_analytics_workspace_resource_id -class ManagedClusterServicePrincipalProfile(msrest.serialization.Model): +class ManagedClusterServicePrincipalProfile(_serialization.Model): """Information about a service principal identity for the cluster to use for manipulating Azure APIs. All required parameters must be populated in order to send to Azure. - :ivar client_id: Required. The ID for the service principal. + :ivar client_id: The ID for the service principal. Required. :vartype client_id: str :ivar secret: The secret password associated with the service principal in plain text. :vartype secret: str """ _validation = { - 'client_id': {'required': True}, + "client_id": {"required": True}, } _attribute_map = { - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'secret': {'key': 'secret', 'type': 'str'}, + "client_id": {"key": "clientId", "type": "str"}, + "secret": {"key": "secret", "type": "str"}, } - def __init__( - self, - *, - client_id: str, - secret: Optional[str] = None, - **kwargs - ): + def __init__(self, *, client_id: str, secret: Optional[str] = None, **kwargs): """ - :keyword client_id: Required. The ID for the service principal. + :keyword client_id: The ID for the service principal. Required. :paramtype client_id: str :keyword secret: The secret password associated with the service principal in plain text. :paramtype secret: str """ - super(ManagedClusterServicePrincipalProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.client_id = client_id self.secret = secret -class ManagedClusterSKU(msrest.serialization.Model): +class ManagedClusterSKU(_serialization.Model): """The SKU of a Managed Cluster. - :ivar name: The name of a managed cluster SKU. Known values are: "Basic". + :ivar name: The name of a managed cluster SKU. "Basic" :vartype name: str or ~azure.mgmt.containerservice.v2021_09_01.models.ManagedClusterSKUName :ivar tier: If not specified, the default is 'Free'. See `uptime SLA - `_ for more details. Known values are: "Paid", - "Free". + `_ for more details. Known values are: "Paid" + and "Free". :vartype tier: str or ~azure.mgmt.containerservice.v2021_09_01.models.ManagedClusterSKUTier """ _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, + "name": {"key": "name", "type": "str"}, + "tier": {"key": "tier", "type": "str"}, } def __init__( @@ -4317,19 +4229,19 @@ def __init__( **kwargs ): """ - :keyword name: The name of a managed cluster SKU. Known values are: "Basic". + :keyword name: The name of a managed cluster SKU. "Basic" :paramtype name: str or ~azure.mgmt.containerservice.v2021_09_01.models.ManagedClusterSKUName :keyword tier: If not specified, the default is 'Free'. See `uptime SLA - `_ for more details. Known values are: "Paid", - "Free". + `_ for more details. Known values are: "Paid" + and "Free". :paramtype tier: str or ~azure.mgmt.containerservice.v2021_09_01.models.ManagedClusterSKUTier """ - super(ManagedClusterSKU, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.tier = tier -class ManagedClusterUpgradeProfile(msrest.serialization.Model): +class ManagedClusterUpgradeProfile(_serialization.Model): """The list of available upgrades for compute pools. Variables are only populated by the server, and will be ignored when sending a request. @@ -4342,29 +4254,29 @@ class ManagedClusterUpgradeProfile(msrest.serialization.Model): :vartype name: str :ivar type: The type of the upgrade profile. :vartype type: str - :ivar control_plane_profile: Required. The list of available upgrade versions for the control - plane. + :ivar control_plane_profile: The list of available upgrade versions for the control plane. + Required. :vartype control_plane_profile: ~azure.mgmt.containerservice.v2021_09_01.models.ManagedClusterPoolUpgradeProfile - :ivar agent_pool_profiles: Required. The list of available upgrade versions for agent pools. + :ivar agent_pool_profiles: The list of available upgrade versions for agent pools. Required. :vartype agent_pool_profiles: list[~azure.mgmt.containerservice.v2021_09_01.models.ManagedClusterPoolUpgradeProfile] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'control_plane_profile': {'required': True}, - 'agent_pool_profiles': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "control_plane_profile": {"required": True}, + "agent_pool_profiles": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'control_plane_profile': {'key': 'properties.controlPlaneProfile', 'type': 'ManagedClusterPoolUpgradeProfile'}, - 'agent_pool_profiles': {'key': 'properties.agentPoolProfiles', 'type': '[ManagedClusterPoolUpgradeProfile]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "control_plane_profile": {"key": "properties.controlPlaneProfile", "type": "ManagedClusterPoolUpgradeProfile"}, + "agent_pool_profiles": {"key": "properties.agentPoolProfiles", "type": "[ManagedClusterPoolUpgradeProfile]"}, } def __init__( @@ -4375,15 +4287,15 @@ def __init__( **kwargs ): """ - :keyword control_plane_profile: Required. The list of available upgrade versions for the - control plane. + :keyword control_plane_profile: The list of available upgrade versions for the control plane. + Required. :paramtype control_plane_profile: ~azure.mgmt.containerservice.v2021_09_01.models.ManagedClusterPoolUpgradeProfile - :keyword agent_pool_profiles: Required. The list of available upgrade versions for agent pools. + :keyword agent_pool_profiles: The list of available upgrade versions for agent pools. Required. :paramtype agent_pool_profiles: list[~azure.mgmt.containerservice.v2021_09_01.models.ManagedClusterPoolUpgradeProfile] """ - super(ManagedClusterUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -4391,18 +4303,18 @@ def __init__( self.agent_pool_profiles = agent_pool_profiles -class ManagedClusterWindowsProfile(msrest.serialization.Model): +class ManagedClusterWindowsProfile(_serialization.Model): """Profile for Windows VMs in the managed cluster. All required parameters must be populated in order to send to Azure. - :ivar admin_username: Required. Specifies the name of the administrator account. - :code:`
`:code:`
` **Restriction:** Cannot end in "." :code:`
`:code:`
` - **Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", "test1", - "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", - "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", - "sys", "test2", "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 - character :code:`
`:code:`
` **Max-length:** 20 characters. + :ivar admin_username: Specifies the name of the administrator account. :code:`
`:code:`
` + **Restriction:** Cannot end in "." :code:`
`:code:`
` **Disallowed values:** + "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", + "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", + "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", + "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 character + :code:`
`:code:`
` **Max-length:** 20 characters. Required. :vartype admin_username: str :ivar admin_password: Specifies the password of the administrator account. :code:`
`:code:`
` **Minimum-length:** 8 characters :code:`
`:code:`
` @@ -4414,7 +4326,7 @@ class ManagedClusterWindowsProfile(msrest.serialization.Model): :vartype admin_password: str :ivar license_type: The license type to use for Windows VMs. See `Azure Hybrid User Benefits `_ for more details. Known values are: - "None", "Windows_Server". + "None" and "Windows_Server". :vartype license_type: str or ~azure.mgmt.containerservice.v2021_09_01.models.LicenseType :ivar enable_csi_proxy: For more details on CSI proxy, see the `CSI proxy GitHub repo `_. @@ -4424,15 +4336,15 @@ class ManagedClusterWindowsProfile(msrest.serialization.Model): """ _validation = { - 'admin_username': {'required': True}, + "admin_username": {"required": True}, } _attribute_map = { - 'admin_username': {'key': 'adminUsername', 'type': 'str'}, - 'admin_password': {'key': 'adminPassword', 'type': 'str'}, - 'license_type': {'key': 'licenseType', 'type': 'str'}, - 'enable_csi_proxy': {'key': 'enableCSIProxy', 'type': 'bool'}, - 'gmsa_profile': {'key': 'gmsaProfile', 'type': 'WindowsGmsaProfile'}, + "admin_username": {"key": "adminUsername", "type": "str"}, + "admin_password": {"key": "adminPassword", "type": "str"}, + "license_type": {"key": "licenseType", "type": "str"}, + "enable_csi_proxy": {"key": "enableCSIProxy", "type": "bool"}, + "gmsa_profile": {"key": "gmsaProfile", "type": "WindowsGmsaProfile"}, } def __init__( @@ -4446,13 +4358,13 @@ def __init__( **kwargs ): """ - :keyword admin_username: Required. Specifies the name of the administrator account. + :keyword admin_username: Specifies the name of the administrator account. :code:`
`:code:`
` **Restriction:** Cannot end in "." :code:`
`:code:`
` **Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 - character :code:`
`:code:`
` **Max-length:** 20 characters. + character :code:`
`:code:`
` **Max-length:** 20 characters. Required. :paramtype admin_username: str :keyword admin_password: Specifies the password of the administrator account. :code:`
`:code:`
` **Minimum-length:** 8 characters :code:`
`:code:`
` @@ -4464,7 +4376,7 @@ def __init__( :paramtype admin_password: str :keyword license_type: The license type to use for Windows VMs. See `Azure Hybrid User Benefits `_ for more details. Known values are: - "None", "Windows_Server". + "None" and "Windows_Server". :paramtype license_type: str or ~azure.mgmt.containerservice.v2021_09_01.models.LicenseType :keyword enable_csi_proxy: For more details on CSI proxy, see the `CSI proxy GitHub repo `_. @@ -4472,7 +4384,7 @@ def __init__( :keyword gmsa_profile: The Windows gMSA Profile in the Managed Cluster. :paramtype gmsa_profile: ~azure.mgmt.containerservice.v2021_09_01.models.WindowsGmsaProfile """ - super(ManagedClusterWindowsProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.admin_username = admin_username self.admin_password = admin_password self.license_type = license_type @@ -4480,7 +4392,7 @@ def __init__( self.gmsa_profile = gmsa_profile -class ManagedServiceIdentityUserAssignedIdentitiesValue(msrest.serialization.Model): +class ManagedServiceIdentityUserAssignedIdentitiesValue(_serialization.Model): """ManagedServiceIdentityUserAssignedIdentitiesValue. Variables are only populated by the server, and will be ignored when sending a request. @@ -4492,27 +4404,23 @@ class ManagedServiceIdentityUserAssignedIdentitiesValue(msrest.serialization.Mod """ _validation = { - 'principal_id': {'readonly': True}, - 'client_id': {'readonly': True}, + "principal_id": {"readonly": True}, + "client_id": {"readonly": True}, } _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, + "principal_id": {"key": "principalId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(ManagedServiceIdentityUserAssignedIdentitiesValue, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.principal_id = None self.client_id = None -class OperationListResult(msrest.serialization.Model): +class OperationListResult(_serialization.Model): """The List Operation response. Variables are only populated by the server, and will be ignored when sending a request. @@ -4522,24 +4430,20 @@ class OperationListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[OperationValue]'}, + "value": {"key": "value", "type": "[OperationValue]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(OperationListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None -class OperationValue(msrest.serialization.Model): +class OperationValue(_serialization.Model): """Describes the properties of a Operation value. Variables are only populated by the server, and will be ignored when sending a request. @@ -4559,30 +4463,26 @@ class OperationValue(msrest.serialization.Model): """ _validation = { - 'origin': {'readonly': True}, - 'name': {'readonly': True}, - 'operation': {'readonly': True}, - 'resource': {'readonly': True}, - 'description': {'readonly': True}, - 'provider': {'readonly': True}, + "origin": {"readonly": True}, + "name": {"readonly": True}, + "operation": {"readonly": True}, + "resource": {"readonly": True}, + "description": {"readonly": True}, + "provider": {"readonly": True}, } _attribute_map = { - 'origin': {'key': 'origin', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'operation': {'key': 'display.operation', 'type': 'str'}, - 'resource': {'key': 'display.resource', 'type': 'str'}, - 'description': {'key': 'display.description', 'type': 'str'}, - 'provider': {'key': 'display.provider', 'type': 'str'}, + "origin": {"key": "origin", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "operation": {"key": "display.operation", "type": "str"}, + "resource": {"key": "display.resource", "type": "str"}, + "description": {"key": "display.description", "type": "str"}, + "provider": {"key": "display.provider", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(OperationValue, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.origin = None self.name = None self.operation = None @@ -4591,7 +4491,7 @@ def __init__( self.provider = None -class OSOptionProfile(msrest.serialization.Model): +class OSOptionProfile(_serialization.Model): """The OS option profile. Variables are only populated by the server, and will be ignored when sending a request. @@ -4604,83 +4504,72 @@ class OSOptionProfile(msrest.serialization.Model): :vartype name: str :ivar type: The type of the OS option resource. :vartype type: str - :ivar os_option_property_list: Required. The list of OS options. + :ivar os_option_property_list: The list of OS options. Required. :vartype os_option_property_list: list[~azure.mgmt.containerservice.v2021_09_01.models.OSOptionProperty] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'os_option_property_list': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "os_option_property_list": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'os_option_property_list': {'key': 'properties.osOptionPropertyList', 'type': '[OSOptionProperty]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "os_option_property_list": {"key": "properties.osOptionPropertyList", "type": "[OSOptionProperty]"}, } - def __init__( - self, - *, - os_option_property_list: List["_models.OSOptionProperty"], - **kwargs - ): + def __init__(self, *, os_option_property_list: List["_models.OSOptionProperty"], **kwargs): """ - :keyword os_option_property_list: Required. The list of OS options. + :keyword os_option_property_list: The list of OS options. Required. :paramtype os_option_property_list: list[~azure.mgmt.containerservice.v2021_09_01.models.OSOptionProperty] """ - super(OSOptionProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None self.os_option_property_list = os_option_property_list -class OSOptionProperty(msrest.serialization.Model): +class OSOptionProperty(_serialization.Model): """OS option property. All required parameters must be populated in order to send to Azure. - :ivar os_type: Required. The OS type. + :ivar os_type: The OS type. Required. :vartype os_type: str - :ivar enable_fips_image: Required. Whether the image is FIPS-enabled. + :ivar enable_fips_image: Whether the image is FIPS-enabled. Required. :vartype enable_fips_image: bool """ _validation = { - 'os_type': {'required': True}, - 'enable_fips_image': {'required': True}, + "os_type": {"required": True}, + "enable_fips_image": {"required": True}, } _attribute_map = { - 'os_type': {'key': 'os-type', 'type': 'str'}, - 'enable_fips_image': {'key': 'enable-fips-image', 'type': 'bool'}, + "os_type": {"key": "os-type", "type": "str"}, + "enable_fips_image": {"key": "enable-fips-image", "type": "bool"}, } - def __init__( - self, - *, - os_type: str, - enable_fips_image: bool, - **kwargs - ): + def __init__(self, *, os_type: str, enable_fips_image: bool, **kwargs): """ - :keyword os_type: Required. The OS type. + :keyword os_type: The OS type. Required. :paramtype os_type: str - :keyword enable_fips_image: Required. Whether the image is FIPS-enabled. + :keyword enable_fips_image: Whether the image is FIPS-enabled. Required. :paramtype enable_fips_image: bool """ - super(OSOptionProperty, self).__init__(**kwargs) + super().__init__(**kwargs) self.os_type = os_type self.enable_fips_image = enable_fips_image -class OutboundEnvironmentEndpoint(msrest.serialization.Model): +class OutboundEnvironmentEndpoint(_serialization.Model): """Egress endpoints which AKS agent nodes connect to for common purpose. :ivar category: The category of endpoints accessed by the AKS agent node, e.g. @@ -4691,8 +4580,8 @@ class OutboundEnvironmentEndpoint(msrest.serialization.Model): """ _attribute_map = { - 'category': {'key': 'category', 'type': 'str'}, - 'endpoints': {'key': 'endpoints', 'type': '[EndpointDependency]'}, + "category": {"key": "category", "type": "str"}, + "endpoints": {"key": "endpoints", "type": "[EndpointDependency]"}, } def __init__( @@ -4709,19 +4598,19 @@ def __init__( :keyword endpoints: The endpoints that AKS agent nodes connect to. :paramtype endpoints: list[~azure.mgmt.containerservice.v2021_09_01.models.EndpointDependency] """ - super(OutboundEnvironmentEndpoint, self).__init__(**kwargs) + super().__init__(**kwargs) self.category = category self.endpoints = endpoints -class OutboundEnvironmentEndpointCollection(msrest.serialization.Model): +class OutboundEnvironmentEndpointCollection(_serialization.Model): """Collection of OutboundEnvironmentEndpoint. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar value: Required. Collection of resources. + :ivar value: Collection of resources. Required. :vartype value: list[~azure.mgmt.containerservice.v2021_09_01.models.OutboundEnvironmentEndpoint] :ivar next_link: Link to next page of resources. @@ -4729,59 +4618,49 @@ class OutboundEnvironmentEndpointCollection(msrest.serialization.Model): """ _validation = { - 'value': {'required': True}, - 'next_link': {'readonly': True}, + "value": {"required": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[OutboundEnvironmentEndpoint]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[OutboundEnvironmentEndpoint]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: List["_models.OutboundEnvironmentEndpoint"], - **kwargs - ): + def __init__(self, *, value: List["_models.OutboundEnvironmentEndpoint"], **kwargs): """ - :keyword value: Required. Collection of resources. + :keyword value: Collection of resources. Required. :paramtype value: list[~azure.mgmt.containerservice.v2021_09_01.models.OutboundEnvironmentEndpoint] """ - super(OutboundEnvironmentEndpointCollection, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class PowerState(msrest.serialization.Model): +class PowerState(_serialization.Model): """Describes the Power State of the cluster. - :ivar code: Tells whether the cluster is Running or Stopped. Known values are: "Running", + :ivar code: Tells whether the cluster is Running or Stopped. Known values are: "Running" and "Stopped". :vartype code: str or ~azure.mgmt.containerservice.v2021_09_01.models.Code """ _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, + "code": {"key": "code", "type": "str"}, } - def __init__( - self, - *, - code: Optional[Union[str, "_models.Code"]] = None, - **kwargs - ): + def __init__(self, *, code: Optional[Union[str, "_models.Code"]] = None, **kwargs): """ - :keyword code: Tells whether the cluster is Running or Stopped. Known values are: "Running", + :keyword code: Tells whether the cluster is Running or Stopped. Known values are: "Running" and "Stopped". :paramtype code: str or ~azure.mgmt.containerservice.v2021_09_01.models.Code """ - super(PowerState, self).__init__(**kwargs) + super().__init__(**kwargs) self.code = code -class PrivateEndpoint(msrest.serialization.Model): +class PrivateEndpoint(_serialization.Model): """Private endpoint which a connection belongs to. :ivar id: The resource ID of the private endpoint. @@ -4789,24 +4668,19 @@ class PrivateEndpoint(msrest.serialization.Model): """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, } - def __init__( - self, - *, - id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin """ :keyword id: The resource ID of the private endpoint. :paramtype id: str """ - super(PrivateEndpoint, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id -class PrivateEndpointConnection(msrest.serialization.Model): +class PrivateEndpointConnection(_serialization.Model): """A private endpoint connection. Variables are only populated by the server, and will be ignored when sending a request. @@ -4818,7 +4692,7 @@ class PrivateEndpointConnection(msrest.serialization.Model): :ivar type: The resource type. :vartype type: str :ivar provisioning_state: The current provisioning state. Known values are: "Succeeded", - "Creating", "Deleting", "Failed". + "Creating", "Deleting", and "Failed". :vartype provisioning_state: str or ~azure.mgmt.containerservice.v2021_09_01.models.PrivateEndpointConnectionProvisioningState :ivar private_endpoint: The resource of private endpoint. @@ -4830,19 +4704,22 @@ class PrivateEndpointConnection(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'provisioning_state': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, - 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "private_endpoint": {"key": "properties.privateEndpoint", "type": "PrivateEndpoint"}, + "private_link_service_connection_state": { + "key": "properties.privateLinkServiceConnectionState", + "type": "PrivateLinkServiceConnectionState", + }, } def __init__( @@ -4860,7 +4737,7 @@ def __init__( :paramtype private_link_service_connection_state: ~azure.mgmt.containerservice.v2021_09_01.models.PrivateLinkServiceConnectionState """ - super(PrivateEndpointConnection, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -4869,7 +4746,7 @@ def __init__( self.private_link_service_connection_state = private_link_service_connection_state -class PrivateEndpointConnectionListResult(msrest.serialization.Model): +class PrivateEndpointConnectionListResult(_serialization.Model): """A list of private endpoint connections. :ivar value: The collection value. @@ -4877,25 +4754,20 @@ class PrivateEndpointConnectionListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, + "value": {"key": "value", "type": "[PrivateEndpointConnection]"}, } - def __init__( - self, - *, - value: Optional[List["_models.PrivateEndpointConnection"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.PrivateEndpointConnection"]] = None, **kwargs): """ :keyword value: The collection value. :paramtype value: list[~azure.mgmt.containerservice.v2021_09_01.models.PrivateEndpointConnection] """ - super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value -class PrivateLinkResource(msrest.serialization.Model): +class PrivateLinkResource(_serialization.Model): """A private link resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -4916,22 +4788,22 @@ class PrivateLinkResource(msrest.serialization.Model): """ _validation = { - 'private_link_service_id': {'readonly': True}, + "private_link_service_id": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'group_id': {'key': 'groupId', 'type': 'str'}, - 'required_members': {'key': 'requiredMembers', 'type': '[str]'}, - 'private_link_service_id': {'key': 'privateLinkServiceID', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "group_id": {"key": "groupId", "type": "str"}, + "required_members": {"key": "requiredMembers", "type": "[str]"}, + "private_link_service_id": {"key": "privateLinkServiceID", "type": "str"}, } def __init__( self, *, - id: Optional[str] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin name: Optional[str] = None, type: Optional[str] = None, group_id: Optional[str] = None, @@ -4950,7 +4822,7 @@ def __init__( :keyword required_members: The RequiredMembers of the resource. :paramtype required_members: list[str] """ - super(PrivateLinkResource, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id self.name = name self.type = type @@ -4959,7 +4831,7 @@ def __init__( self.private_link_service_id = None -class PrivateLinkResourcesListResult(msrest.serialization.Model): +class PrivateLinkResourcesListResult(_serialization.Model): """A list of private link resources. :ivar value: The collection value. @@ -4967,36 +4839,31 @@ class PrivateLinkResourcesListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, + "value": {"key": "value", "type": "[PrivateLinkResource]"}, } - def __init__( - self, - *, - value: Optional[List["_models.PrivateLinkResource"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.PrivateLinkResource"]] = None, **kwargs): """ :keyword value: The collection value. :paramtype value: list[~azure.mgmt.containerservice.v2021_09_01.models.PrivateLinkResource] """ - super(PrivateLinkResourcesListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value -class PrivateLinkServiceConnectionState(msrest.serialization.Model): +class PrivateLinkServiceConnectionState(_serialization.Model): """The state of a private link service connection. :ivar status: The private link service connection status. Known values are: "Pending", - "Approved", "Rejected", "Disconnected". + "Approved", "Rejected", and "Disconnected". :vartype status: str or ~azure.mgmt.containerservice.v2021_09_01.models.ConnectionStatus :ivar description: The private link service connection description. :vartype description: str """ _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, + "status": {"key": "status", "type": "str"}, + "description": {"key": "description", "type": "str"}, } def __init__( @@ -5008,17 +4875,17 @@ def __init__( ): """ :keyword status: The private link service connection status. Known values are: "Pending", - "Approved", "Rejected", "Disconnected". + "Approved", "Rejected", and "Disconnected". :paramtype status: str or ~azure.mgmt.containerservice.v2021_09_01.models.ConnectionStatus :keyword description: The private link service connection description. :paramtype description: str """ - super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) + super().__init__(**kwargs) self.status = status self.description = description -class ResourceReference(msrest.serialization.Model): +class ResourceReference(_serialization.Model): """A reference to an Azure resource. :ivar id: The fully qualified Azure resource id. @@ -5026,29 +4893,24 @@ class ResourceReference(msrest.serialization.Model): """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, } - def __init__( - self, - *, - id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin """ :keyword id: The fully qualified Azure resource id. :paramtype id: str """ - super(ResourceReference, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id -class RunCommandRequest(msrest.serialization.Model): +class RunCommandRequest(_serialization.Model): """A run command request. All required parameters must be populated in order to send to Azure. - :ivar command: Required. The command to run. + :ivar command: The command to run. Required. :vartype command: str :ivar context: A base64 encoded zip file containing the files required by the command. :vartype context: str @@ -5057,38 +4919,31 @@ class RunCommandRequest(msrest.serialization.Model): """ _validation = { - 'command': {'required': True}, + "command": {"required": True}, } _attribute_map = { - 'command': {'key': 'command', 'type': 'str'}, - 'context': {'key': 'context', 'type': 'str'}, - 'cluster_token': {'key': 'clusterToken', 'type': 'str'}, + "command": {"key": "command", "type": "str"}, + "context": {"key": "context", "type": "str"}, + "cluster_token": {"key": "clusterToken", "type": "str"}, } - def __init__( - self, - *, - command: str, - context: Optional[str] = None, - cluster_token: Optional[str] = None, - **kwargs - ): + def __init__(self, *, command: str, context: Optional[str] = None, cluster_token: Optional[str] = None, **kwargs): """ - :keyword command: Required. The command to run. + :keyword command: The command to run. Required. :paramtype command: str :keyword context: A base64 encoded zip file containing the files required by the command. :paramtype context: str :keyword cluster_token: AuthToken issued for AKS AAD Server App. :paramtype cluster_token: str """ - super(RunCommandRequest, self).__init__(**kwargs) + super().__init__(**kwargs) self.command = command self.context = context self.cluster_token = cluster_token -class RunCommandResult(msrest.serialization.Model): +class RunCommandResult(_serialization.Model): """run command result. Variables are only populated by the server, and will be ignored when sending a request. @@ -5110,32 +4965,28 @@ class RunCommandResult(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'exit_code': {'readonly': True}, - 'started_at': {'readonly': True}, - 'finished_at': {'readonly': True}, - 'logs': {'readonly': True}, - 'reason': {'readonly': True}, + "id": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "exit_code": {"readonly": True}, + "started_at": {"readonly": True}, + "finished_at": {"readonly": True}, + "logs": {"readonly": True}, + "reason": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'exit_code': {'key': 'properties.exitCode', 'type': 'int'}, - 'started_at': {'key': 'properties.startedAt', 'type': 'iso-8601'}, - 'finished_at': {'key': 'properties.finishedAt', 'type': 'iso-8601'}, - 'logs': {'key': 'properties.logs', 'type': 'str'}, - 'reason': {'key': 'properties.reason', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(RunCommandResult, self).__init__(**kwargs) + "id": {"key": "id", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "exit_code": {"key": "properties.exitCode", "type": "int"}, + "started_at": {"key": "properties.startedAt", "type": "iso-8601"}, + "finished_at": {"key": "properties.finishedAt", "type": "iso-8601"}, + "logs": {"key": "properties.logs", "type": "str"}, + "reason": {"key": "properties.reason", "type": "str"}, + } + + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.id = None self.provisioning_state = None self.exit_code = None @@ -5145,7 +4996,7 @@ def __init__( self.reason = None -class Snapshot(Resource): +class Snapshot(Resource): # pylint: disable=too-many-instance-attributes """A node pool snapshot resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -5158,27 +5009,26 @@ class Snapshot(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar system_data: The system metadata relating to this snapshot. :vartype system_data: ~azure.mgmt.containerservice.v2021_09_01.models.SystemData :ivar creation_data: CreationData to be used to specify the source agent pool resource ID to create this snapshot. :vartype creation_data: ~azure.mgmt.containerservice.v2021_09_01.models.CreationData - :ivar snapshot_type: The type of a snapshot. The default is NodePool. Known values are: - "NodePool". Default value: "NodePool". + :ivar snapshot_type: The type of a snapshot. The default is NodePool. "NodePool" :vartype snapshot_type: str or ~azure.mgmt.containerservice.v2021_09_01.models.SnapshotType :ivar kubernetes_version: The version of Kubernetes. :vartype kubernetes_version: str :ivar node_image_version: The version of node image. :vartype node_image_version: str - :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2021_09_01.models.OSType :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known - values are: "Ubuntu", "CBLMariner". + values are: "Ubuntu" and "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2021_09_01.models.OSSKU :ivar vm_size: The size of the VM. :vartype vm_size: str @@ -5187,34 +5037,34 @@ class Snapshot(Resource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'system_data': {'readonly': True}, - 'kubernetes_version': {'readonly': True}, - 'node_image_version': {'readonly': True}, - 'os_type': {'readonly': True}, - 'os_sku': {'readonly': True}, - 'vm_size': {'readonly': True}, - 'enable_fips': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, + "system_data": {"readonly": True}, + "kubernetes_version": {"readonly": True}, + "node_image_version": {"readonly": True}, + "os_type": {"readonly": True}, + "os_sku": {"readonly": True}, + "vm_size": {"readonly": True}, + "enable_fips": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'creation_data': {'key': 'properties.creationData', 'type': 'CreationData'}, - 'snapshot_type': {'key': 'properties.snapshotType', 'type': 'str'}, - 'kubernetes_version': {'key': 'properties.kubernetesVersion', 'type': 'str'}, - 'node_image_version': {'key': 'properties.nodeImageVersion', 'type': 'str'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'os_sku': {'key': 'properties.osSku', 'type': 'str'}, - 'vm_size': {'key': 'properties.vmSize', 'type': 'str'}, - 'enable_fips': {'key': 'properties.enableFIPS', 'type': 'bool'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "creation_data": {"key": "properties.creationData", "type": "CreationData"}, + "snapshot_type": {"key": "properties.snapshotType", "type": "str"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "node_image_version": {"key": "properties.nodeImageVersion", "type": "str"}, + "os_type": {"key": "properties.osType", "type": "str"}, + "os_sku": {"key": "properties.osSku", "type": "str"}, + "vm_size": {"key": "properties.vmSize", "type": "str"}, + "enable_fips": {"key": "properties.enableFIPS", "type": "bool"}, } def __init__( @@ -5223,22 +5073,21 @@ def __init__( location: str, tags: Optional[Dict[str, str]] = None, creation_data: Optional["_models.CreationData"] = None, - snapshot_type: Optional[Union[str, "_models.SnapshotType"]] = "NodePool", + snapshot_type: Union[str, "_models.SnapshotType"] = "NodePool", **kwargs ): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword creation_data: CreationData to be used to specify the source agent pool resource ID to create this snapshot. :paramtype creation_data: ~azure.mgmt.containerservice.v2021_09_01.models.CreationData - :keyword snapshot_type: The type of a snapshot. The default is NodePool. Known values are: - "NodePool". Default value: "NodePool". + :keyword snapshot_type: The type of a snapshot. The default is NodePool. "NodePool" :paramtype snapshot_type: str or ~azure.mgmt.containerservice.v2021_09_01.models.SnapshotType """ - super(Snapshot, self).__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.system_data = None self.creation_data = creation_data self.snapshot_type = snapshot_type @@ -5250,7 +5099,7 @@ def __init__( self.enable_fips = None -class SnapshotListResult(msrest.serialization.Model): +class SnapshotListResult(_serialization.Model): """The response from the List Snapshots operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -5262,30 +5111,25 @@ class SnapshotListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[Snapshot]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[Snapshot]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.Snapshot"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.Snapshot"]] = None, **kwargs): """ :keyword value: The list of snapshots. :paramtype value: list[~azure.mgmt.containerservice.v2021_09_01.models.Snapshot] """ - super(SnapshotListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class SysctlConfig(msrest.serialization.Model): +class SysctlConfig(_serialization.Model): # pylint: disable=too-many-instance-attributes """Sysctl settings for Linux agent nodes. :ivar net_core_somaxconn: Sysctl setting net.core.somaxconn. @@ -5347,37 +5191,37 @@ class SysctlConfig(msrest.serialization.Model): """ _attribute_map = { - 'net_core_somaxconn': {'key': 'netCoreSomaxconn', 'type': 'int'}, - 'net_core_netdev_max_backlog': {'key': 'netCoreNetdevMaxBacklog', 'type': 'int'}, - 'net_core_rmem_default': {'key': 'netCoreRmemDefault', 'type': 'int'}, - 'net_core_rmem_max': {'key': 'netCoreRmemMax', 'type': 'int'}, - 'net_core_wmem_default': {'key': 'netCoreWmemDefault', 'type': 'int'}, - 'net_core_wmem_max': {'key': 'netCoreWmemMax', 'type': 'int'}, - 'net_core_optmem_max': {'key': 'netCoreOptmemMax', 'type': 'int'}, - 'net_ipv4_tcp_max_syn_backlog': {'key': 'netIpv4TcpMaxSynBacklog', 'type': 'int'}, - 'net_ipv4_tcp_max_tw_buckets': {'key': 'netIpv4TcpMaxTwBuckets', 'type': 'int'}, - 'net_ipv4_tcp_fin_timeout': {'key': 'netIpv4TcpFinTimeout', 'type': 'int'}, - 'net_ipv4_tcp_keepalive_time': {'key': 'netIpv4TcpKeepaliveTime', 'type': 'int'}, - 'net_ipv4_tcp_keepalive_probes': {'key': 'netIpv4TcpKeepaliveProbes', 'type': 'int'}, - 'net_ipv4_tcpkeepalive_intvl': {'key': 'netIpv4TcpkeepaliveIntvl', 'type': 'int'}, - 'net_ipv4_tcp_tw_reuse': {'key': 'netIpv4TcpTwReuse', 'type': 'bool'}, - 'net_ipv4_ip_local_port_range': {'key': 'netIpv4IpLocalPortRange', 'type': 'str'}, - 'net_ipv4_neigh_default_gc_thresh1': {'key': 'netIpv4NeighDefaultGcThresh1', 'type': 'int'}, - 'net_ipv4_neigh_default_gc_thresh2': {'key': 'netIpv4NeighDefaultGcThresh2', 'type': 'int'}, - 'net_ipv4_neigh_default_gc_thresh3': {'key': 'netIpv4NeighDefaultGcThresh3', 'type': 'int'}, - 'net_netfilter_nf_conntrack_max': {'key': 'netNetfilterNfConntrackMax', 'type': 'int'}, - 'net_netfilter_nf_conntrack_buckets': {'key': 'netNetfilterNfConntrackBuckets', 'type': 'int'}, - 'fs_inotify_max_user_watches': {'key': 'fsInotifyMaxUserWatches', 'type': 'int'}, - 'fs_file_max': {'key': 'fsFileMax', 'type': 'int'}, - 'fs_aio_max_nr': {'key': 'fsAioMaxNr', 'type': 'int'}, - 'fs_nr_open': {'key': 'fsNrOpen', 'type': 'int'}, - 'kernel_threads_max': {'key': 'kernelThreadsMax', 'type': 'int'}, - 'vm_max_map_count': {'key': 'vmMaxMapCount', 'type': 'int'}, - 'vm_swappiness': {'key': 'vmSwappiness', 'type': 'int'}, - 'vm_vfs_cache_pressure': {'key': 'vmVfsCachePressure', 'type': 'int'}, - } - - def __init__( + "net_core_somaxconn": {"key": "netCoreSomaxconn", "type": "int"}, + "net_core_netdev_max_backlog": {"key": "netCoreNetdevMaxBacklog", "type": "int"}, + "net_core_rmem_default": {"key": "netCoreRmemDefault", "type": "int"}, + "net_core_rmem_max": {"key": "netCoreRmemMax", "type": "int"}, + "net_core_wmem_default": {"key": "netCoreWmemDefault", "type": "int"}, + "net_core_wmem_max": {"key": "netCoreWmemMax", "type": "int"}, + "net_core_optmem_max": {"key": "netCoreOptmemMax", "type": "int"}, + "net_ipv4_tcp_max_syn_backlog": {"key": "netIpv4TcpMaxSynBacklog", "type": "int"}, + "net_ipv4_tcp_max_tw_buckets": {"key": "netIpv4TcpMaxTwBuckets", "type": "int"}, + "net_ipv4_tcp_fin_timeout": {"key": "netIpv4TcpFinTimeout", "type": "int"}, + "net_ipv4_tcp_keepalive_time": {"key": "netIpv4TcpKeepaliveTime", "type": "int"}, + "net_ipv4_tcp_keepalive_probes": {"key": "netIpv4TcpKeepaliveProbes", "type": "int"}, + "net_ipv4_tcpkeepalive_intvl": {"key": "netIpv4TcpkeepaliveIntvl", "type": "int"}, + "net_ipv4_tcp_tw_reuse": {"key": "netIpv4TcpTwReuse", "type": "bool"}, + "net_ipv4_ip_local_port_range": {"key": "netIpv4IpLocalPortRange", "type": "str"}, + "net_ipv4_neigh_default_gc_thresh1": {"key": "netIpv4NeighDefaultGcThresh1", "type": "int"}, + "net_ipv4_neigh_default_gc_thresh2": {"key": "netIpv4NeighDefaultGcThresh2", "type": "int"}, + "net_ipv4_neigh_default_gc_thresh3": {"key": "netIpv4NeighDefaultGcThresh3", "type": "int"}, + "net_netfilter_nf_conntrack_max": {"key": "netNetfilterNfConntrackMax", "type": "int"}, + "net_netfilter_nf_conntrack_buckets": {"key": "netNetfilterNfConntrackBuckets", "type": "int"}, + "fs_inotify_max_user_watches": {"key": "fsInotifyMaxUserWatches", "type": "int"}, + "fs_file_max": {"key": "fsFileMax", "type": "int"}, + "fs_aio_max_nr": {"key": "fsAioMaxNr", "type": "int"}, + "fs_nr_open": {"key": "fsNrOpen", "type": "int"}, + "kernel_threads_max": {"key": "kernelThreadsMax", "type": "int"}, + "vm_max_map_count": {"key": "vmMaxMapCount", "type": "int"}, + "vm_swappiness": {"key": "vmSwappiness", "type": "int"}, + "vm_vfs_cache_pressure": {"key": "vmVfsCachePressure", "type": "int"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, net_core_somaxconn: Optional[int] = None, @@ -5468,7 +5312,7 @@ def __init__( :keyword vm_vfs_cache_pressure: Sysctl setting vm.vfs_cache_pressure. :paramtype vm_vfs_cache_pressure: int """ - super(SysctlConfig, self).__init__(**kwargs) + super().__init__(**kwargs) self.net_core_somaxconn = net_core_somaxconn self.net_core_netdev_max_backlog = net_core_netdev_max_backlog self.net_core_rmem_default = net_core_rmem_default @@ -5499,20 +5343,20 @@ def __init__( self.vm_vfs_cache_pressure = vm_vfs_cache_pressure -class SystemData(msrest.serialization.Model): +class SystemData(_serialization.Model): """Metadata pertaining to creation and last modification of the resource. :ivar created_by: The identity that created the resource. :vartype created_by: str :ivar created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", "Key". + "User", "Application", "ManagedIdentity", and "Key". :vartype created_by_type: str or ~azure.mgmt.containerservice.v2021_09_01.models.CreatedByType :ivar created_at: The UTC timestamp of resource creation. :vartype created_at: ~datetime.datetime :ivar last_modified_by: The identity that last modified the resource. :vartype last_modified_by: str :ivar last_modified_by_type: The type of identity that last modified the resource. Known values - are: "User", "Application", "ManagedIdentity", "Key". + are: "User", "Application", "ManagedIdentity", and "Key". :vartype last_modified_by_type: str or ~azure.mgmt.containerservice.v2021_09_01.models.CreatedByType :ivar last_modified_at: The type of identity that last modified the resource. @@ -5520,12 +5364,12 @@ class SystemData(msrest.serialization.Model): """ _attribute_map = { - 'created_by': {'key': 'createdBy', 'type': 'str'}, - 'created_by_type': {'key': 'createdByType', 'type': 'str'}, - 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, - 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, - 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, - 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + "created_by": {"key": "createdBy", "type": "str"}, + "created_by_type": {"key": "createdByType", "type": "str"}, + "created_at": {"key": "createdAt", "type": "iso-8601"}, + "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, + "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, + "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, } def __init__( @@ -5543,7 +5387,7 @@ def __init__( :keyword created_by: The identity that created the resource. :paramtype created_by: str :keyword created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", "Key". + "User", "Application", "ManagedIdentity", and "Key". :paramtype created_by_type: str or ~azure.mgmt.containerservice.v2021_09_01.models.CreatedByType :keyword created_at: The UTC timestamp of resource creation. @@ -5551,13 +5395,13 @@ def __init__( :keyword last_modified_by: The identity that last modified the resource. :paramtype last_modified_by: str :keyword last_modified_by_type: The type of identity that last modified the resource. Known - values are: "User", "Application", "ManagedIdentity", "Key". + values are: "User", "Application", "ManagedIdentity", and "Key". :paramtype last_modified_by_type: str or ~azure.mgmt.containerservice.v2021_09_01.models.CreatedByType :keyword last_modified_at: The type of identity that last modified the resource. :paramtype last_modified_at: ~datetime.datetime """ - super(SystemData, self).__init__(**kwargs) + super().__init__(**kwargs) self.created_by = created_by self.created_by_type = created_by_type self.created_at = created_at @@ -5566,36 +5410,31 @@ def __init__( self.last_modified_at = last_modified_at -class TagsObject(msrest.serialization.Model): +class TagsObject(_serialization.Model): """Tags object for patch operations. - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] """ _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] """ - super(TagsObject, self).__init__(**kwargs) + super().__init__(**kwargs) self.tags = tags -class TimeInWeek(msrest.serialization.Model): +class TimeInWeek(_serialization.Model): """Time in a week. :ivar day: The day of the week. Known values are: "Sunday", "Monday", "Tuesday", "Wednesday", - "Thursday", "Friday", "Saturday". + "Thursday", "Friday", and "Saturday". :vartype day: str or ~azure.mgmt.containerservice.v2021_09_01.models.WeekDay :ivar hour_slots: Each integer hour represents a time range beginning at 0m after the hour ending at the next hour (non-inclusive). 0 corresponds to 00:00 UTC, 23 corresponds to 23:00 @@ -5604,32 +5443,28 @@ class TimeInWeek(msrest.serialization.Model): """ _attribute_map = { - 'day': {'key': 'day', 'type': 'str'}, - 'hour_slots': {'key': 'hourSlots', 'type': '[int]'}, + "day": {"key": "day", "type": "str"}, + "hour_slots": {"key": "hourSlots", "type": "[int]"}, } def __init__( - self, - *, - day: Optional[Union[str, "_models.WeekDay"]] = None, - hour_slots: Optional[List[int]] = None, - **kwargs + self, *, day: Optional[Union[str, "_models.WeekDay"]] = None, hour_slots: Optional[List[int]] = None, **kwargs ): """ :keyword day: The day of the week. Known values are: "Sunday", "Monday", "Tuesday", - "Wednesday", "Thursday", "Friday", "Saturday". + "Wednesday", "Thursday", "Friday", and "Saturday". :paramtype day: str or ~azure.mgmt.containerservice.v2021_09_01.models.WeekDay :keyword hour_slots: Each integer hour represents a time range beginning at 0m after the hour ending at the next hour (non-inclusive). 0 corresponds to 00:00 UTC, 23 corresponds to 23:00 UTC. Specifying [0, 1] means the 00:00 - 02:00 UTC time range. :paramtype hour_slots: list[int] """ - super(TimeInWeek, self).__init__(**kwargs) + super().__init__(**kwargs) self.day = day self.hour_slots = hour_slots -class TimeSpan(msrest.serialization.Model): +class TimeSpan(_serialization.Model): """For example, between 2021-05-25T13:00:00Z and 2021-05-25T14:00:00Z. :ivar start: The start of a time span. @@ -5639,29 +5474,23 @@ class TimeSpan(msrest.serialization.Model): """ _attribute_map = { - 'start': {'key': 'start', 'type': 'iso-8601'}, - 'end': {'key': 'end', 'type': 'iso-8601'}, + "start": {"key": "start", "type": "iso-8601"}, + "end": {"key": "end", "type": "iso-8601"}, } - def __init__( - self, - *, - start: Optional[datetime.datetime] = None, - end: Optional[datetime.datetime] = None, - **kwargs - ): + def __init__(self, *, start: Optional[datetime.datetime] = None, end: Optional[datetime.datetime] = None, **kwargs): """ :keyword start: The start of a time span. :paramtype start: ~datetime.datetime :keyword end: The end of a time span. :paramtype end: ~datetime.datetime """ - super(TimeSpan, self).__init__(**kwargs) + super().__init__(**kwargs) self.start = start self.end = end -class WindowsGmsaProfile(msrest.serialization.Model): +class WindowsGmsaProfile(_serialization.Model): """Windows gMSA Profile in the managed cluster. :ivar enabled: Specifies whether to enable Windows gMSA in the managed cluster. @@ -5677,9 +5506,9 @@ class WindowsGmsaProfile(msrest.serialization.Model): """ _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'dns_server': {'key': 'dnsServer', 'type': 'str'}, - 'root_domain_name': {'key': 'rootDomainName', 'type': 'str'}, + "enabled": {"key": "enabled", "type": "bool"}, + "dns_server": {"key": "dnsServer", "type": "str"}, + "root_domain_name": {"key": "rootDomainName", "type": "str"}, } def __init__( @@ -5702,7 +5531,7 @@ def __init__( which is used to create the managed cluster. :paramtype root_domain_name: str """ - super(WindowsGmsaProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.dns_server = dns_server self.root_domain_name = root_domain_name diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/models/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/models/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/models/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/models/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/operations/__init__.py index e0748876288c..593b23075ce0 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/operations/__init__.py @@ -18,15 +18,16 @@ from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'Operations', - 'ManagedClustersOperations', - 'MaintenanceConfigurationsOperations', - 'AgentPoolsOperations', - 'PrivateEndpointConnectionsOperations', - 'PrivateLinkResourcesOperations', - 'ResolvePrivateLinkServiceIdOperations', - 'SnapshotsOperations', + "Operations", + "ManagedClustersOperations", + "MaintenanceConfigurationsOperations", + "AgentPoolsOperations", + "PrivateEndpointConnectionsOperations", + "PrivateLinkResourcesOperations", + "ResolvePrivateLinkServiceIdOperations", + "SnapshotsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/operations/_agent_pools_operations.py index 8560b3444a52..4673754c55d6 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/operations/_agent_pools_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,288 +27,289 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - *, - json: Optional[_models.AgentPool] = None, - content: Any = None, - **kwargs: Any + _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, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + _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, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_get_upgrade_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_available_agent_pool_versions_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_upgrade_node_image_version_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_upgrade_node_image_version_request( + resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class AgentPoolsOperations: """ @@ -324,47 +330,39 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> Iterable[_models.AgentPoolListResult]: + def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> Iterable["_models.AgentPool"]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AgentPoolListResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_09_01.models.AgentPoolListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either AgentPool or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_09_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -372,16 +370,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -397,10 +390,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -410,54 +401,45 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore @distributed_trace def get( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPool: """Gets the specified managed cluster agent pool. Gets the specified managed cluster agent pool. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPool, or the result of cls(response) + :return: AgentPool or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.AgentPool - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -465,57 +447,60 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore def _create_or_update_initial( self, resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: _models.AgentPool, + parameters: Union[_models.AgentPool, IO], **kwargs: Any ) -> _models.AgentPool: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - _json = self._serialize.body(parameters, 'AgentPool') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "AgentPool") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -523,10 +508,9 @@ def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -534,40 +518,84 @@ def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - @distributed_trace + @overload def begin_create_or_update( self, resource_group_name: str, resource_name: str, agent_pool_name: str, parameters: _models.AgentPool, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.AgentPool]: """Creates or updates an agent pool in the specified managed cluster. Creates or updates an agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str - :param parameters: The agent pool to create or update. + :param parameters: The agent pool to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2021_09_01.models.AgentPool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_09_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AgentPool]: + """Creates or updates an agent pool in the specified managed cluster. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: The agent pool to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -579,20 +607,56 @@ def begin_create_or_update( :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_09_01.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: Union[_models.AgentPool, IO], + **kwargs: Any + ) -> LROPoller[_models.AgentPool]: + """Creates or updates an agent pool in the specified managed cluster. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: The agent pool to create or update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.mgmt.containerservice.v2021_09_01.models.AgentPool or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_09_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -601,66 +665,55 @@ def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -668,10 +721,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -681,26 +733,21 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + def begin_delete( + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> LROPoller[None]: """Deletes an agent pool in the specified managed cluster. Deletes an agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -712,99 +759,85 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPoolUpgradeProfile: """Gets the upgrade profile for an agent pool. Gets the upgrade profile for an agent pool. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolUpgradeProfile, or the result of cls(response) + :return: AgentPoolUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.AgentPoolUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -812,32 +845,27 @@ def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolUpgradeProfile', pipeline_response) + deserialized = self._deserialize("AgentPoolUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore @distributed_trace def get_available_agent_pool_versions( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported Kubernetes versions for the specified agent pool. @@ -845,33 +873,30 @@ def get_available_agent_pool_versions( `_ for more details about the version lifecycle. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolAvailableVersions, or the result of cls(response) + :return: AgentPoolAvailableVersions or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.AgentPoolAvailableVersions - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolAvailableVersions] - request = build_get_available_agent_pool_versions_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_available_agent_pool_versions.metadata['url'], + template_url=self.get_available_agent_pool_versions.metadata["url"], headers=_headers, params=_params, ) @@ -879,52 +904,43 @@ def get_available_agent_pool_versions( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolAvailableVersions', pipeline_response) + deserialized = self._deserialize("AgentPoolAvailableVersions", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_available_agent_pool_versions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore - + get_available_agent_pool_versions.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore def _upgrade_node_image_version_initial( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> Optional[_models.AgentPool]: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.AgentPool]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.AgentPool]] - - request = build_upgrade_node_image_version_request_initial( - subscription_id=self._config.subscription_id, + request = build_upgrade_node_image_version_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._upgrade_node_image_version_initial.metadata['url'], + template_url=self._upgrade_node_image_version_initial.metadata["url"], headers=_headers, params=_params, ) @@ -932,10 +948,9 @@ def _upgrade_node_image_version_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -944,35 +959,30 @@ def _upgrade_node_image_version_initial( deserialized = None if response.status_code == 202: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _upgrade_node_image_version_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore - + _upgrade_node_image_version_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore @distributed_trace def begin_upgrade_node_image_version( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any - ) -> LROPoller[_models.AgentPool]: + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any + ) -> LROPoller[None]: """Upgrades the node image version of an agent pool to the latest. Upgrading the node image version of an agent pool applies the newest OS and runtime updates to the nodes. AKS provides one new image per week with the latest updates. For more details on node image versions, see: https://docs.microsoft.com/azure/aks/node-image-upgrade. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -985,55 +995,48 @@ def begin_upgrade_node_image_version( :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_09_01.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._upgrade_node_image_version_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_upgrade_node_image_version.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore + begin_upgrade_node_image_version.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/operations/_maintenance_configurations_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/operations/_maintenance_configurations_operations.py index b5260990fe12..f3693272eb18 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/operations/_maintenance_configurations_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/operations/_maintenance_configurations_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,173 +25,173 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +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_managed_cluster_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, config_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 = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "configName": _SERIALIZER.url("config_name", config_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "configName": _SERIALIZER.url("config_name", config_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - config_name: str, - *, - json: Optional[_models.MaintenanceConfiguration] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, resource_name: str, config_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 = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "configName": _SERIALIZER.url("config_name", config_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "configName": _SERIALIZER.url("config_name", config_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, config_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 = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "configName": _SERIALIZER.url("config_name", config_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "configName": _SERIALIZER.url("config_name", config_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class MaintenanceConfigurationsOperations: """ @@ -207,48 +212,43 @@ def __init__(self, *args, **kwargs): 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_managed_cluster( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> Iterable[_models.MaintenanceConfigurationListResult]: + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> Iterable["_models.MaintenanceConfiguration"]: """Gets a list of maintenance configurations in the specified managed cluster. Gets a list of maintenance configurations in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either MaintenanceConfigurationListResult or the result - of cls(response) + :return: An iterator like instance of either MaintenanceConfiguration or the result of + cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_09_01.models.MaintenanceConfigurationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_09_01.models.MaintenanceConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfigurationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfigurationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_managed_cluster_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_managed_cluster.metadata['url'], + template_url=self.list_by_managed_cluster.metadata["url"], headers=_headers, params=_params, ) @@ -256,16 +256,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_managed_cluster_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -281,10 +276,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -294,54 +287,45 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_managed_cluster.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations"} # type: ignore + list_by_managed_cluster.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations"} # type: ignore @distributed_trace def get( - self, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, config_name: str, **kwargs: Any ) -> _models.MaintenanceConfiguration: """Gets the specified maintenance configuration of a managed cluster. Gets the specified maintenance configuration of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: MaintenanceConfiguration, or the result of cls(response) + :return: MaintenanceConfiguration or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.MaintenanceConfiguration - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfiguration] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -349,75 +333,147 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) + deserialized = self._deserialize("MaintenanceConfiguration", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - @distributed_trace + @overload def create_or_update( self, resource_group_name: str, resource_name: str, config_name: str, parameters: _models.MaintenanceConfiguration, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.MaintenanceConfiguration: """Creates or updates a maintenance configuration in the specified managed cluster. Creates or updates a maintenance configuration in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str - :param parameters: The maintenance configuration to create or update. + :param parameters: The maintenance configuration to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2021_09_01.models.MaintenanceConfiguration + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: MaintenanceConfiguration, or the result of cls(response) + :return: MaintenanceConfiguration or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.MaintenanceConfiguration - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configuration in the specified managed cluster. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: The maintenance configuration to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: Union[_models.MaintenanceConfiguration, IO], + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configuration in the specified managed cluster. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: The maintenance configuration to create or update. Is either a model type or + a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_09_01.models.MaintenanceConfiguration or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfiguration] - _json = self._serialize.body(parameters, 'MaintenanceConfiguration') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "MaintenanceConfiguration") request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) @@ -425,68 +481,59 @@ def create_or_update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) + deserialized = self._deserialize("MaintenanceConfiguration", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore @distributed_trace def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, config_name: str, **kwargs: Any ) -> None: """Deletes a maintenance configuration. Deletes a maintenance configuration. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) @@ -494,10 +541,9 @@ def delete( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -507,5 +553,4 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/operations/_managed_clusters_operations.py index 55a1ad3df217..97841588c337 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/operations/_managed_clusters_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,200 +27,183 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_get_os_options_request( - subscription_id: str, - location: str, - *, - resource_type: Optional[str] = None, - **kwargs: Any + location: str, subscription_id: str, *, resource_type: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "location": _SERIALIZER.url("location", location, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if resource_type is not None: - _params['resource-type'] = _SERIALIZER.query("resource_type", resource_type, 'str') + _params["resource-type"] = _SERIALIZER.query("resource_type", resource_type, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters") + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters" + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_resource_group_request( - subscription_id: str, - resource_group_name: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters", + ) # 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', min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_upgrade_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_access_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, role_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 = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "roleName": _SERIALIZER.url("role_name", role_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "roleName": _SERIALIZER.url("role_name", role_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_admin_credentials_request( - subscription_id: str, resource_group_name: str, resource_name: str, + subscription_id: str, *, server_fqdn: Optional[str] = None, **kwargs: Any @@ -223,40 +211,44 @@ def build_list_cluster_admin_credentials_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if server_fqdn is not None: - _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + _params["server-fqdn"] = _SERIALIZER.query("server_fqdn", server_fqdn, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_user_credentials_request( - subscription_id: str, resource_group_name: str, resource_name: str, + subscription_id: str, *, server_fqdn: Optional[str] = None, **kwargs: Any @@ -264,40 +256,44 @@ def build_list_cluster_user_credentials_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if server_fqdn is not None: - _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + _params["server-fqdn"] = _SERIALIZER.query("server_fqdn", server_fqdn, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_monitoring_user_credentials_request( - subscription_id: str, resource_group_name: str, resource_name: str, + subscription_id: str, *, server_fqdn: Optional[str] = None, **kwargs: Any @@ -305,520 +301,509 @@ def build_list_cluster_monitoring_user_credentials_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if server_fqdn is not None: - _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + _params["server-fqdn"] = _SERIALIZER.query("server_fqdn", server_fqdn, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: + +def build_get_request(resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedCluster] = None, - content: Any = None, - **kwargs: Any + +def build_create_or_update_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_update_tags_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.TagsObject] = None, - content: Any = None, - **kwargs: Any + +def build_update_tags_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + +def build_delete_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_reset_service_principal_profile_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedClusterServicePrincipalProfile] = None, - content: Any = None, - **kwargs: Any + +def build_reset_service_principal_profile_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_reset_aad_profile_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedClusterAADProfile] = None, - content: Any = None, - **kwargs: Any + +def build_reset_aad_profile_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_rotate_cluster_certificates_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + +def build_rotate_cluster_certificates_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_stop_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + +def build_stop_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_start_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + +def build_start_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_run_command_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.RunCommandRequest] = None, - content: Any = None, - **kwargs: Any + +def build_run_command_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_get_command_result_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - command_id: str, - **kwargs: Any + resource_group_name: str, resource_name: str, command_id: 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "commandId": _SERIALIZER.url("command_id", command_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "commandId": _SERIALIZER.url("command_id", command_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_list_outbound_network_dependencies_endpoints_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + class ManagedClustersOperations: # pylint: disable=too-many-public-methods """ @@ -839,46 +824,39 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def get_os_options( - self, - location: str, - resource_type: Optional[str] = None, - **kwargs: Any + self, location: str, resource_type: Optional[str] = None, **kwargs: Any ) -> _models.OSOptionProfile: """Gets supported OS options in the specified subscription. Gets supported OS options in the specified subscription. - :param location: The name of a supported Azure region. + :param location: The name of a supported Azure region. Required. :type location: str :param resource_type: The resource type for which the OS options needs to be returned. Default value is None. :type resource_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: OSOptionProfile, or the result of cls(response) + :return: OSOptionProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.OSOptionProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OSOptionProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OSOptionProfile] - request = build_get_os_options_request( - subscription_id=self._config.subscription_id, location=location, - api_version=api_version, + subscription_id=self._config.subscription_id, resource_type=resource_type, - template_url=self.get_os_options.metadata['url'], + api_version=api_version, + template_url=self.get_os_options.metadata["url"], headers=_headers, params=_params, ) @@ -886,59 +864,52 @@ def get_os_options( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('OSOptionProfile', pipeline_response) + deserialized = self._deserialize("OSOptionProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_os_options.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default"} # type: ignore - + get_os_options.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default"} # type: ignore @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.ManagedClusterListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.ManagedCluster"]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_09_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_09_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -946,14 +917,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -969,10 +937,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -982,49 +948,41 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> Iterable[_models.ManagedClusterListResult]: + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.ManagedCluster"]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_09_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_09_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -1032,15 +990,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -1056,10 +1010,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1069,50 +1021,42 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.ManagedClusterUpgradeProfile: """Gets the upgrade profile of a managed cluster. Gets the upgrade profile of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterUpgradeProfile, or the result of cls(response) + :return: ManagedClusterUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.ManagedClusterUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -1120,33 +1064,27 @@ def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterUpgradeProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore @distributed_trace def get_access_profile( - self, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, role_name: str, **kwargs: Any ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. @@ -1155,36 +1093,33 @@ def get_access_profile( `ListClusterAdminCredentials `_ . - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param role_name: The name of the role for managed cluster accessProfile resource. + :param role_name: The name of the role for managed cluster accessProfile resource. Required. :type role_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterAccessProfile, or the result of cls(response) + :return: ManagedClusterAccessProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.ManagedClusterAccessProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterAccessProfile] - request = build_get_access_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, role_name=role_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_access_profile.metadata['url'], + template_url=self.get_access_profile.metadata["url"], headers=_headers, params=_params, ) @@ -1192,68 +1127,59 @@ def get_access_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterAccessProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterAccessProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_access_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore - + get_access_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore @distributed_trace def list_cluster_admin_credentials( - self, - resource_group_name: str, - resource_name: str, - server_fqdn: Optional[str] = None, - **kwargs: Any + self, resource_group_name: str, resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any ) -> _models.CredentialResults: """Lists the admin credentials of a managed cluster. Lists the admin credentials of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_admin_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, - template_url=self.list_cluster_admin_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_admin_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -1261,68 +1187,59 @@ def list_cluster_admin_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_admin_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore - + list_cluster_admin_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore @distributed_trace def list_cluster_user_credentials( - self, - resource_group_name: str, - resource_name: str, - server_fqdn: Optional[str] = None, - **kwargs: Any + self, resource_group_name: str, resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any ) -> _models.CredentialResults: """Lists the user credentials of a managed cluster. Lists the user credentials of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, - template_url=self.list_cluster_user_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -1330,68 +1247,59 @@ def list_cluster_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore - + list_cluster_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore @distributed_trace def list_cluster_monitoring_user_credentials( - self, - resource_group_name: str, - resource_name: str, - server_fqdn: Optional[str] = None, - **kwargs: Any + self, resource_group_name: str, resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any ) -> _models.CredentialResults: """Lists the cluster monitoring user credentials of a managed cluster. Lists the cluster monitoring user credentials of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_monitoring_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, - template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_monitoring_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -1399,64 +1307,54 @@ def list_cluster_monitoring_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_monitoring_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore - + list_cluster_monitoring_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore @distributed_trace - def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.ManagedCluster: + def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.ManagedCluster: """Gets a managed cluster. Gets a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedCluster, or the result of cls(response) + :return: ManagedCluster or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.ManagedCluster - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -1464,55 +1362,54 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _create_or_update_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.ManagedCluster, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'ManagedCluster') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedCluster") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1520,10 +1417,9 @@ def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -1531,37 +1427,41 @@ def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - - @distributed_trace + @overload def begin_create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedCluster, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. Creates or updates a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The managed cluster to create or update. + :param parameters: The managed cluster to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2021_09_01.models.ManagedCluster + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1574,90 +1474,155 @@ def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_09_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._create_or_update_initial( # type: ignore - resource_group_name=resource_group_name, - resource_name=resource_name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop('error_map', None) - def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized + @overload + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + Creates or updates a managed cluster. - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_09_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster to create or update. Is either a model type or a IO + type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_09_01.models.ManagedCluster or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_09_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ManagedCluster", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _update_tags_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.TagsObject, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request_initial( - subscription_id=self._config.subscription_id, + request = build_update_tags_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_tags_initial.metadata['url'], + content=_content, + template_url=self._update_tags_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1665,44 +1630,118 @@ def _update_tags_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_tags_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + _update_tags_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - - @distributed_trace + @overload def begin_update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates tags on a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2021_09_01.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_09_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates tags on a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_09_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates tags on a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_09_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1715,20 +1754,17 @@ def begin_update_tags( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_09_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, @@ -1736,64 +1772,54 @@ def begin_update_tags( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1801,10 +1827,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1814,23 +1839,17 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> LROPoller[None]: + def begin_delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> LROPoller[None]: """Deletes a managed cluster. Deletes a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1842,85 +1861,83 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterServicePrincipalProfile, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterServicePrincipalProfile") - request = build_reset_service_principal_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_service_principal_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_service_principal_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_service_principal_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1928,10 +1945,9 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1941,28 +1957,32 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re if cls: return cls(pipeline_response, None, {}) - _reset_service_principal_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore - + _reset_service_principal_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore - @distributed_trace - def begin_reset_service_principal_profile( # pylint: disable=inconsistent-return-statements + @overload + def begin_reset_service_principal_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterServicePrincipalProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: """Reset the Service Principal Profile of a managed cluster. This action cannot be performed on a cluster that is not using a service principal. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The service principal profile to set on the managed cluster. + :param parameters: The service principal profile to set on the managed cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2021_09_01.models.ManagedClusterServicePrincipalProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1973,20 +1993,89 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reset the Service Principal Profile of a managed cluster. + + This action cannot be performed on a cluster that is not using a service principal. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The service principal profile to set on the managed cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Reset the Service Principal Profile of a managed cluster. + + This action cannot be performed on a cluster that is not using a service principal. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The service principal profile to set on the managed cluster. Is either a + model type or a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2021_09_01.models.ManagedClusterServicePrincipalProfile or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1994,67 +2083,68 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_service_principal_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + begin_reset_service_principal_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterAADProfile, + parameters: Union[_models.ManagedClusterAADProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterAADProfile") - request = build_reset_aad_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_aad_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_aad_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_aad_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2062,10 +2152,9 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -2075,27 +2164,103 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement if cls: return cls(pipeline_response, None, {}) - _reset_aad_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - + _reset_aad_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - @distributed_trace - def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements + @overload + def begin_reset_aad_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterAADProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: """Reset the AAD Profile of a managed cluster. Reset the AAD Profile of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The AAD profile to set on the Managed Cluster. + :param parameters: The AAD profile to set on the Managed Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2021_09_01.models.ManagedClusterAADProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reset the AAD Profile of a managed cluster. + + Reset the AAD Profile of a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The AAD profile to set on the Managed Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterAADProfile, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Reset the AAD Profile of a managed cluster. + + Reset the AAD Profile of a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The AAD profile to set on the Managed Cluster. Is either a model type or a + IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_09_01.models.ManagedClusterAADProfile or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -2106,20 +2271,17 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -2127,62 +2289,52 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_aad_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + begin_reset_aad_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_rotate_cluster_certificates_request_initial( - subscription_id=self._config.subscription_id, + request = build_rotate_cluster_certificates_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._rotate_cluster_certificates_initial.metadata['url'], + template_url=self._rotate_cluster_certificates_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2190,10 +2342,9 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -2203,24 +2354,20 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return if cls: return cls(pipeline_response, None, {}) - _rotate_cluster_certificates_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore - + _rotate_cluster_certificates_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore @distributed_trace - def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + def begin_rotate_cluster_certificates( + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> LROPoller[None]: """Rotates the certificates of a managed cluster. See `Certificate rotation `_ for more details about rotating managed cluster certificates. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -2232,80 +2379,67 @@ def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-st Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._rotate_cluster_certificates_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_rotate_cluster_certificates.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore + begin_rotate_cluster_certificates.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore def _stop_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_stop_request_initial( - subscription_id=self._config.subscription_id, + request = build_stop_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._stop_initial.metadata['url'], + template_url=self._stop_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2313,10 +2447,9 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -2326,16 +2459,10 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore - + _stop_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore @distributed_trace - def begin_stop( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> LROPoller[None]: + def begin_stop(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> LROPoller[None]: """Stops a Managed Cluster. This can only be performed on Azure Virtual Machine Scale set backed clusters. Stopping a @@ -2344,9 +2471,9 @@ def begin_stop( # pylint: disable=inconsistent-return-statements `_ for more details about stopping a cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -2358,80 +2485,67 @@ def begin_stop( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._stop_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore + begin_stop.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore def _start_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_start_request_initial( - subscription_id=self._config.subscription_id, + request = build_start_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._start_initial.metadata['url'], + template_url=self._start_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2439,10 +2553,9 @@ def _start_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -2452,24 +2565,18 @@ def _start_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore - + _start_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore @distributed_trace - def begin_start( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> LROPoller[None]: + def begin_start(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> LROPoller[None]: """Starts a previously stopped Managed Cluster. See `starting a cluster `_ for more details about starting a cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -2481,85 +2588,83 @@ def begin_start( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._start_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore + begin_start.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore def _run_command_initial( self, resource_group_name: str, resource_name: str, - request_payload: _models.RunCommandRequest, + request_payload: Union[_models.RunCommandRequest, IO], **kwargs: Any ) -> Optional[_models.RunCommandResult]: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RunCommandResult]] - _json = self._serialize.body(request_payload, 'RunCommandRequest') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(request_payload, (IO, bytes)): + _content = request_payload + else: + _json = self._serialize.body(request_payload, "RunCommandRequest") - request = build_run_command_request_initial( - subscription_id=self._config.subscription_id, + request = build_run_command_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._run_command_initial.metadata['url'], + content=_content, + template_url=self._run_command_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2567,10 +2672,9 @@ def _run_command_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -2579,22 +2683,23 @@ def _run_command_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _run_command_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore - + _run_command_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore - @distributed_trace + @overload def begin_run_command( self, resource_group_name: str, resource_name: str, request_payload: _models.RunCommandRequest, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.RunCommandResult]: """Submits a command to run against the Managed Cluster. @@ -2603,12 +2708,93 @@ def begin_run_command( more information see `AKS Run Command `_. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param request_payload: The run command request. + :param request_payload: The run command request. Required. :type request_payload: ~azure.mgmt.containerservice.v2021_09_01.models.RunCommandRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either RunCommandResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_09_01.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_run_command( + self, + resource_group_name: str, + resource_name: str, + request_payload: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RunCommandResult]: + """Submits a command to run against the Managed Cluster. + + AKS will create a pod to run the command. This is primarily useful for private clusters. For + more information see `AKS Run Command + `_. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param request_payload: The run command request. Required. + :type request_payload: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either RunCommandResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_09_01.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_run_command( + self, + resource_group_name: str, + resource_name: str, + request_payload: Union[_models.RunCommandRequest, IO], + **kwargs: Any + ) -> LROPoller[_models.RunCommandResult]: + """Submits a command to run against the Managed Cluster. + + AKS will create a pod to run the command. This is primarily useful for private clusters. For + more information see `AKS Run Command + `_. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param request_payload: The run command request. Is either a model type or a IO type. Required. + :type request_payload: ~azure.mgmt.containerservice.v2021_09_01.models.RunCommandRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -2621,20 +2807,17 @@ def begin_run_command( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_09_01.models.RunCommandResult] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.RunCommandResult] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.RunCommandResult] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._run_command_initial( # type: ignore resource_group_name=resource_group_name, @@ -2642,82 +2825,71 @@ def begin_run_command( request_payload=request_payload, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_run_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore + begin_run_command.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore @distributed_trace def get_command_result( - self, - resource_group_name: str, - resource_name: str, - command_id: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, command_id: str, **kwargs: Any ) -> Optional[_models.RunCommandResult]: """Gets the results of a command which has been run on the Managed Cluster. Gets the results of a command which has been run on the Managed Cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param command_id: Id of the command. + :param command_id: Id of the command. Required. :type command_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: RunCommandResult, or the result of cls(response) + :return: RunCommandResult or None or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.RunCommandResult or None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RunCommandResult]] - request = build_get_command_result_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, command_id=command_id, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_command_result.metadata['url'], + template_url=self.get_command_result.metadata["url"], headers=_headers, params=_params, ) @@ -2725,10 +2897,9 @@ def get_command_result( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -2737,59 +2908,54 @@ def get_command_result( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_command_result.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}"} # type: ignore - + get_command_result.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}"} # type: ignore @distributed_trace def list_outbound_network_dependencies_endpoints( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> Iterable[_models.OutboundEnvironmentEndpointCollection]: + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> Iterable["_models.OutboundEnvironmentEndpoint"]: """Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster. Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster. The operation returns properties of each egress endpoint. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OutboundEnvironmentEndpointCollection or the - result of cls(response) + :return: An iterator like instance of either OutboundEnvironmentEndpoint or the result of + cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_09_01.models.OutboundEnvironmentEndpointCollection] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_09_01.models.OutboundEnvironmentEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_outbound_network_dependencies_endpoints_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_outbound_network_dependencies_endpoints.metadata['url'], + template_url=self.list_outbound_network_dependencies_endpoints.metadata["url"], headers=_headers, params=_params, ) @@ -2797,16 +2963,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_outbound_network_dependencies_endpoints_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -2822,10 +2983,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2835,8 +2994,6 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_outbound_network_dependencies_endpoints.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints"} # type: ignore + list_outbound_network_dependencies_endpoints.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/operations/_operations.py index dddb70e5a3eb..7912aa081eef 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/operations/_operations.py @@ -7,10 +7,15 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,38 +25,34 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - **kwargs: Any -) -> HttpRequest: + +def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.ContainerService/operations") # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class Operations: """ @@ -72,38 +73,33 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.OperationListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.OperationValue"]: """Gets a list of operations. Gets a list of operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationListResult or the result of cls(response) + :return: An iterator like instance of either OperationValue or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_09_01.models.OperationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_09_01.models.OperationValue] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -111,13 +107,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -133,10 +127,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -146,8 +138,6 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.ContainerService/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ContainerService/operations"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/operations/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/operations/_private_endpoint_connections_operations.py index 4a575d3d6d95..edbdcdfacf0a 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/operations/_private_endpoint_connections_operations.py @@ -6,11 +6,15 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod @@ -21,173 +25,191 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - subscription_id: str, resource_group_name: str, resource_name: str, private_endpoint_connection_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 = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_update_request( - subscription_id: str, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, - *, - json: Optional[_models.PrivateEndpointConnection] = None, - content: Any = None, + subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request_initial( - subscription_id: str, +def build_delete_request( resource_group_name: str, resource_name: str, private_endpoint_connection_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 = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class PrivateEndpointConnectionsOperations: """ @@ -208,46 +230,39 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnectionListResult: """Gets a list of private endpoint connections in the specified managed cluster. To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnectionListResult, or the result of cls(response) + :return: PrivateEndpointConnectionListResult or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.PrivateEndpointConnectionListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnectionListResult] - request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -255,69 +270,60 @@ def list( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore - + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore @distributed_trace def get( - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnection: """Gets the specified private endpoint connection. To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -325,75 +331,147 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - - @distributed_trace + @overload def update( self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, parameters: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateEndpointConnection: """Updates a private endpoint connection. Updates a private endpoint connection. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str - :param parameters: The updated private endpoint connection. + :param parameters: The updated private endpoint connection. Required. :type parameters: ~azure.mgmt.containerservice.v2021_09_01.models.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: The updated private endpoint connection. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: Union[_models.PrivateEndpointConnection, IO], + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: The updated private endpoint connection. Is either a model type or a IO + type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_09_01.models.PrivateEndpointConnection or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - _json = self._serialize.body(parameters, 'PrivateEndpointConnection') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateEndpointConnection") request = build_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update.metadata['url'], + content=_content, + template_url=self.update.metadata["url"], headers=_headers, params=_params, ) @@ -401,52 +479,43 @@ def update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -454,10 +523,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -467,26 +535,21 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + def begin_delete( + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> LROPoller[None]: """Deletes a private endpoint connection. Deletes a private endpoint connection. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -498,53 +561,46 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/operations/_private_link_resources_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/operations/_private_link_resources_operations.py index 72ed10d132a3..99270d780030 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/operations/_private_link_resources_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/operations/_private_link_resources_operations.py @@ -8,9 +8,13 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -19,48 +23,53 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class PrivateLinkResourcesOperations: """ @@ -81,46 +90,39 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.PrivateLinkResourcesListResult: """Gets a list of private link resources in the specified managed cluster. To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResourcesListResult, or the result of cls(response) + :return: PrivateLinkResourcesListResult or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.PrivateLinkResourcesListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResourcesListResult] - request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -128,22 +130,20 @@ def list( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResourcesListResult', pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources"} # type: ignore - + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/operations/_resolve_private_link_service_id_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/operations/_resolve_private_link_service_id_operations.py index d6875eee7e03..2967586ec710 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/operations/_resolve_private_link_service_id_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/operations/_resolve_private_link_service_id_operations.py @@ -6,11 +6,15 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -19,56 +23,56 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_post_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.PrivateLinkResource] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + class ResolvePrivateLinkServiceIdOperations: """ @@ -89,52 +93,118 @@ def __init__(self, *args, **kwargs): 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 + @overload def post( self, resource_group_name: str, resource_name: str, parameters: _models.PrivateLinkResource, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateLinkResource: """Gets the private link service ID for the specified managed cluster. Gets the private link service ID for the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters required in order to resolve a private link service ID. + :param parameters: Parameters required in order to resolve a private link service ID. Required. :type parameters: ~azure.mgmt.containerservice.v2021_09_01.models.PrivateLinkResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResource, or the result of cls(response) + :return: PrivateLinkResource or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.PrivateLinkResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + def post( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID for the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters required in order to resolve a private link service ID. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def post( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.PrivateLinkResource, IO], + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID for the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters required in order to resolve a private link service ID. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_09_01.models.PrivateLinkResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResource] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResource] - _json = self._serialize.body(parameters, 'PrivateLinkResource') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateLinkResource") request = build_post_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.post.metadata['url'], + content=_content, + template_url=self.post.metadata["url"], headers=_headers, params=_params, ) @@ -142,22 +212,20 @@ def post( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResource', pipeline_response) + deserialized = self._deserialize("PrivateLinkResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - post.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId"} # type: ignore - + post.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/operations/_snapshots_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/operations/_snapshots_operations.py index e4b966ca49f3..78b773ffc9ea 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/operations/_snapshots_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/operations/_snapshots_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,243 +25,223 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots") path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_resource_group_request( - subscription_id: str, - resource_group_name: str, - **kwargs: Any -) -> HttpRequest: +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots", + ) # 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', min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: + _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, resource_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.Snapshot] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_update_tags_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.TagsObject] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class SnapshotsOperations: """ @@ -277,39 +262,33 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.SnapshotListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.Snapshot"]: """Gets a list of snapshots in the specified subscription. Gets a list of snapshots in the specified subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SnapshotListResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_09_01.models.SnapshotListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either Snapshot or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_09_01.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SnapshotListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -317,14 +296,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -340,10 +316,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -353,48 +327,40 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots"} # type: ignore @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> Iterable[_models.SnapshotListResult]: + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Snapshot"]: """Lists snapshots in the specified subscription and resource group. Lists snapshots in the specified subscription and resource group. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SnapshotListResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_09_01.models.SnapshotListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either Snapshot or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_09_01.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SnapshotListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -402,15 +368,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -426,10 +388,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -439,50 +399,40 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots"} # type: ignore @distributed_trace - def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.Snapshot: + def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.Snapshot: """Gets a snapshot. Gets a snapshot. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Snapshot, or the result of cls(response) + :return: Snapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.Snapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -490,71 +440,132 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - @distributed_trace + @overload def create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.Snapshot, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.Snapshot: """Creates or updates a snapshot. Creates or updates a snapshot. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The snapshot to create or update. + :param parameters: The snapshot to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2021_09_01.models.Snapshot + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Snapshot, or the result of cls(response) + :return: Snapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.Snapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Snapshot: + """Creates or updates a snapshot. + + Creates or updates a snapshot. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The snapshot to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.Snapshot, IO], **kwargs: Any + ) -> _models.Snapshot: + """Creates or updates a snapshot. + + Creates or updates a snapshot. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The snapshot to create or update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.mgmt.containerservice.v2021_09_01.models.Snapshot or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] - _json = self._serialize.body(parameters, 'Snapshot') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "Snapshot") request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) @@ -562,10 +573,9 @@ def create_or_update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -573,64 +583,126 @@ def create_or_update( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - - @distributed_trace + @overload def update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.Snapshot: """Updates tags on a snapshot. Updates tags on a snapshot. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update snapshot Tags operation. + :param parameters: Parameters supplied to the Update snapshot Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2021_09_01.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Snapshot, or the result of cls(response) + :return: Snapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.Snapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + def update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Snapshot: + """Updates tags on a snapshot. + + Updates tags on a snapshot. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update snapshot Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> _models.Snapshot: + """Updates tags on a snapshot. + + Updates tags on a snapshot. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update snapshot Tags operation. Is either a model + type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_09_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") request = build_update_tags_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_tags.metadata['url'], + content=_content, + template_url=self.update_tags.metadata["url"], headers=_headers, params=_params, ) @@ -638,64 +710,56 @@ def update_tags( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - + update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore @distributed_trace def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: """Deletes a snapshot. Deletes a snapshot. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-09-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) @@ -703,10 +767,9 @@ def delete( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -716,5 +779,4 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - + delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/__init__.py index 37a5f9e02e6f..a8716d29afe8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/__init__.py @@ -14,7 +14,8 @@ except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['ContainerServiceClient'] + +__all__ = ["ContainerServiceClient"] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/_configuration.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/_configuration.py index 8fee63b0f04d..c32010a30727 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/_configuration.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/_configuration.py @@ -18,30 +18,26 @@ VERSION = "unknown" + class ContainerServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ContainerServiceClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2021-10-01". 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: + def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ContainerServiceClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + api_version = kwargs.pop("api_version", "2021-10-01") # type: str if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -51,23 +47,24 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-containerservice/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-containerservice/{}".format(VERSION)) self._configure(**kwargs) def _configure( - self, - **kwargs # type: Any + self, **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/_container_service_client.py index 4d30edae8329..a51cdbe1d0d4 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/_container_service_client.py @@ -9,20 +9,29 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from . import models +from .._serialization import Deserializer, Serializer from ._configuration import ContainerServiceClientConfiguration -from .operations import AgentPoolsOperations, MaintenanceConfigurationsOperations, ManagedClustersOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, ResolvePrivateLinkServiceIdOperations, SnapshotsOperations +from .operations import ( + AgentPoolsOperations, + MaintenanceConfigurationsOperations, + ManagedClustersOperations, + Operations, + PrivateEndpointConnectionsOperations, + PrivateLinkResourcesOperations, + ResolvePrivateLinkServiceIdOperations, + SnapshotsOperations, +) if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class ContainerServiceClient: # pylint: disable=too-many-instance-attributes + +class ContainerServiceClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """The Container Service Client. :ivar operations: Operations operations @@ -46,10 +55,10 @@ class ContainerServiceClient: # pylint: disable=too-many-instance-attributes azure.mgmt.containerservice.v2021_10_01.operations.ResolvePrivateLinkServiceIdOperations :ivar snapshots: SnapshotsOperations operations :vartype snapshots: azure.mgmt.containerservice.v2021_10_01.operations.SnapshotsOperations - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -67,25 +76,23 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = ContainerServiceClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = ContainerServiceClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize - ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.managed_clusters = ManagedClustersOperations( self._client, self._config, self._serialize, self._deserialize ) self.maintenance_configurations = MaintenanceConfigurationsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.agent_pools = AgentPoolsOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) self.private_endpoint_connections = PrivateEndpointConnectionsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -95,16 +102,9 @@ def __init__( self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations( self._client, self._config, self._serialize, self._deserialize ) - self.snapshots = SnapshotsOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.snapshots = SnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) - - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> HttpResponse: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -113,7 +113,7 @@ def _send_request( >>> response = client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/_metadata.json b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/_metadata.json index 22b48a36fd99..92fb63deea1f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/_metadata.json +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/_metadata.json @@ -10,20 +10,20 @@ "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { "credential": { - "signature": "credential, # type: \"TokenCredential\"", - "description": "Credential needed for the client to connect to Azure.", + "signature": "credential: \"TokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true }, "subscription_id": { - "signature": "subscription_id, # type: str", - "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "signature": "subscription_id: str,", + "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.", "docstring_type": "str", "required": true } @@ -31,13 +31,13 @@ "async": { "credential": { "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure.", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { "signature": "subscription_id: str,", - "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.", "docstring_type": "str", "required": true } @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=\"https://management.azure.com\", # type: str", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/_patch.py index 74e48ecd07cf..f99e77fef986 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/_patch.py @@ -28,4 +28,4 @@ # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + pass diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/_vendor.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/_vendor.py index 138f663c53a4..9aad73fc743e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/_vendor.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/_vendor.py @@ -7,6 +7,7 @@ from azure.core.pipeline.transport import HttpRequest + def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) @@ -14,6 +15,7 @@ def _convert_request(request, files=None): request.set_formdata_body(files) return request + def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -21,7 +23,5 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [ - c for c in formatted_components if "{}".format(key.args[0]) not in c - ] + components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/__init__.py index 37a5f9e02e6f..a8716d29afe8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/__init__.py @@ -14,7 +14,8 @@ except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['ContainerServiceClient'] + +__all__ = ["ContainerServiceClient"] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/_configuration.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/_configuration.py index b181210878a3..aad1fdb0f391 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/_configuration.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/_configuration.py @@ -18,30 +18,26 @@ VERSION = "unknown" + class ContainerServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ContainerServiceClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2021-10-01". 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: + def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ContainerServiceClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + api_version = kwargs.pop("api_version", "2021-10-01") # type: str if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -51,22 +47,21 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-containerservice/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-containerservice/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, - **kwargs: Any - ) -> None: - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/_container_service_client.py index 811733b02e20..b9a7584d6207 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/_container_service_client.py @@ -9,20 +9,29 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from .. import models +from ..._serialization import Deserializer, Serializer from ._configuration import ContainerServiceClientConfiguration -from .operations import AgentPoolsOperations, MaintenanceConfigurationsOperations, ManagedClustersOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, ResolvePrivateLinkServiceIdOperations, SnapshotsOperations +from .operations import ( + AgentPoolsOperations, + MaintenanceConfigurationsOperations, + ManagedClustersOperations, + Operations, + PrivateEndpointConnectionsOperations, + PrivateLinkResourcesOperations, + ResolvePrivateLinkServiceIdOperations, + SnapshotsOperations, +) if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class ContainerServiceClient: # pylint: disable=too-many-instance-attributes + +class ContainerServiceClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """The Container Service Client. :ivar operations: Operations operations @@ -47,10 +56,10 @@ class ContainerServiceClient: # pylint: disable=too-many-instance-attributes azure.mgmt.containerservice.v2021_10_01.aio.operations.ResolvePrivateLinkServiceIdOperations :ivar snapshots: SnapshotsOperations operations :vartype snapshots: azure.mgmt.containerservice.v2021_10_01.aio.operations.SnapshotsOperations - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -68,25 +77,23 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = ContainerServiceClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = ContainerServiceClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize - ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.managed_clusters = ManagedClustersOperations( self._client, self._config, self._serialize, self._deserialize ) self.maintenance_configurations = MaintenanceConfigurationsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.agent_pools = AgentPoolsOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) self.private_endpoint_connections = PrivateEndpointConnectionsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -96,16 +103,9 @@ def __init__( self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations( self._client, self._config, self._serialize, self._deserialize ) - self.snapshots = SnapshotsOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.snapshots = SnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) - - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -114,7 +114,7 @@ def _send_request( >>> response = await client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/_patch.py index 74e48ecd07cf..f99e77fef986 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/_patch.py @@ -28,4 +28,4 @@ # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + pass diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/operations/__init__.py index e0748876288c..593b23075ce0 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/operations/__init__.py @@ -18,15 +18,16 @@ from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'Operations', - 'ManagedClustersOperations', - 'MaintenanceConfigurationsOperations', - 'AgentPoolsOperations', - 'PrivateEndpointConnectionsOperations', - 'PrivateLinkResourcesOperations', - 'ResolvePrivateLinkServiceIdOperations', - 'SnapshotsOperations', + "Operations", + "ManagedClustersOperations", + "MaintenanceConfigurationsOperations", + "AgentPoolsOperations", + "PrivateEndpointConnectionsOperations", + "PrivateLinkResourcesOperations", + "ResolvePrivateLinkServiceIdOperations", + "SnapshotsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/operations/_agent_pools_operations.py index 562f9ae8f3b3..90b19b103232 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/operations/_agent_pools_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +29,20 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._agent_pools_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_available_agent_pool_versions_request, build_get_request, build_get_upgrade_profile_request, build_list_request, build_upgrade_node_image_version_request_initial -T = TypeVar('T') +from ...operations._agent_pools_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_available_agent_pool_versions_request, + build_get_request, + build_get_upgrade_profile_request, + build_list_request, + build_upgrade_node_image_version_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class AgentPoolsOperations: """ .. warning:: @@ -45,47 +62,40 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.AgentPoolListResult]: + def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncIterable["_models.AgentPool"]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AgentPoolListResult or the result of cls(response) + :return: An iterator like instance of either AgentPool or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_10_01.models.AgentPoolListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_10_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -93,16 +103,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -118,10 +123,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -131,54 +134,45 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore @distributed_trace_async async def get( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPool: """Gets the specified managed cluster agent pool. Gets the specified managed cluster agent pool. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPool, or the result of cls(response) + :return: AgentPool or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.AgentPool - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -186,57 +180,60 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore async def _create_or_update_initial( self, resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: _models.AgentPool, + parameters: Union[_models.AgentPool, IO], **kwargs: Any ) -> _models.AgentPool: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - _json = self._serialize.body(parameters, 'AgentPool') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "AgentPool") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -244,10 +241,9 @@ async def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -255,40 +251,44 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - - @distributed_trace_async + @overload async def begin_create_or_update( self, resource_group_name: str, resource_name: str, agent_pool_name: str, parameters: _models.AgentPool, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.AgentPool]: """Creates or updates an agent pool in the specified managed cluster. Creates or updates an agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str - :param parameters: The agent pool to create or update. + :param parameters: The agent pool to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2021_10_01.models.AgentPool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -301,20 +301,98 @@ async def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_10_01.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AgentPool]: + """Creates or updates an agent pool in the specified managed cluster. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: The agent pool to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AgentPool or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_10_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: Union[_models.AgentPool, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.AgentPool]: + """Creates or updates an agent pool in the specified managed cluster. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: The agent pool to create or update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.mgmt.containerservice.v2021_10_01.models.AgentPool or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AgentPool or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_10_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -323,66 +401,55 @@ async def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -390,10 +457,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -403,26 +469,21 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + async def begin_delete( + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes an agent pool in the specified managed cluster. Deletes an agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -434,99 +495,85 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace_async async def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPoolUpgradeProfile: """Gets the upgrade profile for an agent pool. Gets the upgrade profile for an agent pool. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolUpgradeProfile, or the result of cls(response) + :return: AgentPoolUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.AgentPoolUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -534,32 +581,27 @@ async def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolUpgradeProfile', pipeline_response) + deserialized = self._deserialize("AgentPoolUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore @distributed_trace_async async def get_available_agent_pool_versions( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported Kubernetes versions for the specified agent pool. @@ -567,33 +609,30 @@ async def get_available_agent_pool_versions( `_ for more details about the version lifecycle. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolAvailableVersions, or the result of cls(response) + :return: AgentPoolAvailableVersions or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.AgentPoolAvailableVersions - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolAvailableVersions] - request = build_get_available_agent_pool_versions_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_available_agent_pool_versions.metadata['url'], + template_url=self.get_available_agent_pool_versions.metadata["url"], headers=_headers, params=_params, ) @@ -601,52 +640,43 @@ async def get_available_agent_pool_versions( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolAvailableVersions', pipeline_response) + deserialized = self._deserialize("AgentPoolAvailableVersions", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_available_agent_pool_versions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore - + get_available_agent_pool_versions.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore async def _upgrade_node_image_version_initial( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> Optional[_models.AgentPool]: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.AgentPool]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.AgentPool]] - - request = build_upgrade_node_image_version_request_initial( - subscription_id=self._config.subscription_id, + request = build_upgrade_node_image_version_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._upgrade_node_image_version_initial.metadata['url'], + template_url=self._upgrade_node_image_version_initial.metadata["url"], headers=_headers, params=_params, ) @@ -654,10 +684,9 @@ async def _upgrade_node_image_version_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -667,37 +696,34 @@ async def _upgrade_node_image_version_initial( deserialized = None response_headers = {} if response.status_code == 202: - response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) - - deserialized = self._deserialize('AgentPool', pipeline_response) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _upgrade_node_image_version_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore - + _upgrade_node_image_version_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore @distributed_trace_async async def begin_upgrade_node_image_version( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any - ) -> AsyncLROPoller[_models.AgentPool]: + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: """Upgrades the node image version of an agent pool to the latest. Upgrading the node image version of an agent pool applies the newest OS and runtime updates to the nodes. AKS provides one new image per week with the latest updates. For more details on node image versions, see: https://docs.microsoft.com/azure/aks/node-image-upgrade. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -711,59 +737,54 @@ async def begin_upgrade_node_image_version( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_10_01.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._upgrade_node_image_version_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) - - deserialized = self._deserialize('AgentPool', pipeline_response) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_upgrade_node_image_version.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore + begin_upgrade_node_image_version.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/operations/_maintenance_configurations_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/operations/_maintenance_configurations_operations.py index dd6b0cdc6d5a..e489bcce69c7 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/operations/_maintenance_configurations_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/operations/_maintenance_configurations_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,10 +27,17 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._maintenance_configurations_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_managed_cluster_request -T = TypeVar('T') +from ...operations._maintenance_configurations_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_managed_cluster_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class MaintenanceConfigurationsOperations: """ .. warning:: @@ -43,48 +57,43 @@ def __init__(self, *args, **kwargs) -> None: 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_managed_cluster( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.MaintenanceConfigurationListResult]: + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> AsyncIterable["_models.MaintenanceConfiguration"]: """Gets a list of maintenance configurations in the specified managed cluster. Gets a list of maintenance configurations in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either MaintenanceConfigurationListResult or the result - of cls(response) + :return: An iterator like instance of either MaintenanceConfiguration or the result of + cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_10_01.models.MaintenanceConfigurationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_10_01.models.MaintenanceConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfigurationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfigurationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_managed_cluster_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_managed_cluster.metadata['url'], + template_url=self.list_by_managed_cluster.metadata["url"], headers=_headers, params=_params, ) @@ -92,16 +101,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_managed_cluster_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -117,10 +121,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -130,54 +132,45 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_managed_cluster.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations"} # type: ignore + list_by_managed_cluster.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations"} # type: ignore @distributed_trace_async async def get( - self, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, config_name: str, **kwargs: Any ) -> _models.MaintenanceConfiguration: """Gets the specified maintenance configuration of a managed cluster. Gets the specified maintenance configuration of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: MaintenanceConfiguration, or the result of cls(response) + :return: MaintenanceConfiguration or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.MaintenanceConfiguration - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfiguration] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -185,75 +178,147 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) + deserialized = self._deserialize("MaintenanceConfiguration", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - @distributed_trace_async + @overload async def create_or_update( self, resource_group_name: str, resource_name: str, config_name: str, parameters: _models.MaintenanceConfiguration, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.MaintenanceConfiguration: """Creates or updates a maintenance configuration in the specified managed cluster. Creates or updates a maintenance configuration in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str - :param parameters: The maintenance configuration to create or update. + :param parameters: The maintenance configuration to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2021_10_01.models.MaintenanceConfiguration + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: MaintenanceConfiguration, or the result of cls(response) + :return: MaintenanceConfiguration or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.MaintenanceConfiguration - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configuration in the specified managed cluster. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: The maintenance configuration to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: Union[_models.MaintenanceConfiguration, IO], + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configuration in the specified managed cluster. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: The maintenance configuration to create or update. Is either a model type or + a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_10_01.models.MaintenanceConfiguration or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfiguration] - _json = self._serialize.body(parameters, 'MaintenanceConfiguration') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "MaintenanceConfiguration") request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) @@ -261,68 +326,59 @@ async def create_or_update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) + deserialized = self._deserialize("MaintenanceConfiguration", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, config_name: str, **kwargs: Any ) -> None: """Deletes a maintenance configuration. Deletes a maintenance configuration. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) @@ -330,10 +386,9 @@ async def delete( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -343,5 +398,4 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/operations/_managed_clusters_operations.py index 580fdff286e7..1ffa6e4644b1 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/operations/_managed_clusters_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +29,33 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._managed_clusters_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_access_profile_request, build_get_command_result_request, build_get_os_options_request, build_get_request, build_get_upgrade_profile_request, build_list_by_resource_group_request, build_list_cluster_admin_credentials_request, build_list_cluster_monitoring_user_credentials_request, build_list_cluster_user_credentials_request, build_list_outbound_network_dependencies_endpoints_request, build_list_request, build_reset_aad_profile_request_initial, build_reset_service_principal_profile_request_initial, build_rotate_cluster_certificates_request_initial, build_run_command_request_initial, build_start_request_initial, build_stop_request_initial, build_update_tags_request_initial -T = TypeVar('T') +from ...operations._managed_clusters_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_access_profile_request, + build_get_command_result_request, + build_get_os_options_request, + build_get_request, + build_get_upgrade_profile_request, + build_list_by_resource_group_request, + build_list_cluster_admin_credentials_request, + build_list_cluster_monitoring_user_credentials_request, + build_list_cluster_user_credentials_request, + build_list_outbound_network_dependencies_endpoints_request, + build_list_request, + build_reset_aad_profile_request, + build_reset_service_principal_profile_request, + build_rotate_cluster_certificates_request, + build_run_command_request, + build_start_request, + build_stop_request, + build_update_tags_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class ManagedClustersOperations: # pylint: disable=too-many-public-methods """ .. warning:: @@ -45,46 +75,39 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async async def get_os_options( - self, - location: str, - resource_type: Optional[str] = None, - **kwargs: Any + self, location: str, resource_type: Optional[str] = None, **kwargs: Any ) -> _models.OSOptionProfile: """Gets supported OS options in the specified subscription. Gets supported OS options in the specified subscription. - :param location: The name of a supported Azure region. + :param location: The name of a supported Azure region. Required. :type location: str :param resource_type: The resource type for which the OS options needs to be returned. Default value is None. :type resource_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: OSOptionProfile, or the result of cls(response) + :return: OSOptionProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.OSOptionProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OSOptionProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OSOptionProfile] - request = build_get_os_options_request( - subscription_id=self._config.subscription_id, location=location, - api_version=api_version, + subscription_id=self._config.subscription_id, resource_type=resource_type, - template_url=self.get_os_options.metadata['url'], + api_version=api_version, + template_url=self.get_os_options.metadata["url"], headers=_headers, params=_params, ) @@ -92,59 +115,52 @@ async def get_os_options( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('OSOptionProfile', pipeline_response) + deserialized = self._deserialize("OSOptionProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_os_options.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default"} # type: ignore - + get_os_options.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default"} # type: ignore @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.ManagedClusterListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.ManagedCluster"]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_10_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_10_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -152,14 +168,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -175,10 +188,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -188,49 +199,43 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.ManagedClusterListResult]: + self, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ManagedCluster"]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_10_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_10_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -238,15 +243,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -262,10 +263,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -275,50 +274,42 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace_async async def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.ManagedClusterUpgradeProfile: """Gets the upgrade profile of a managed cluster. Gets the upgrade profile of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterUpgradeProfile, or the result of cls(response) + :return: ManagedClusterUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.ManagedClusterUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -326,33 +317,27 @@ async def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterUpgradeProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore @distributed_trace_async async def get_access_profile( - self, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, role_name: str, **kwargs: Any ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. @@ -361,36 +346,33 @@ async def get_access_profile( `ListClusterAdminCredentials `_ . - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param role_name: The name of the role for managed cluster accessProfile resource. + :param role_name: The name of the role for managed cluster accessProfile resource. Required. :type role_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterAccessProfile, or the result of cls(response) + :return: ManagedClusterAccessProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.ManagedClusterAccessProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterAccessProfile] - request = build_get_access_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, role_name=role_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_access_profile.metadata['url'], + template_url=self.get_access_profile.metadata["url"], headers=_headers, params=_params, ) @@ -398,68 +380,59 @@ async def get_access_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterAccessProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterAccessProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_access_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore - + get_access_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore @distributed_trace_async async def list_cluster_admin_credentials( - self, - resource_group_name: str, - resource_name: str, - server_fqdn: Optional[str] = None, - **kwargs: Any + self, resource_group_name: str, resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any ) -> _models.CredentialResults: """Lists the admin credentials of a managed cluster. Lists the admin credentials of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_admin_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, - template_url=self.list_cluster_admin_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_admin_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -467,68 +440,59 @@ async def list_cluster_admin_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_admin_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore - + list_cluster_admin_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore @distributed_trace_async async def list_cluster_user_credentials( - self, - resource_group_name: str, - resource_name: str, - server_fqdn: Optional[str] = None, - **kwargs: Any + self, resource_group_name: str, resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any ) -> _models.CredentialResults: """Lists the user credentials of a managed cluster. Lists the user credentials of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, - template_url=self.list_cluster_user_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -536,68 +500,59 @@ async def list_cluster_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore - + list_cluster_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore @distributed_trace_async async def list_cluster_monitoring_user_credentials( - self, - resource_group_name: str, - resource_name: str, - server_fqdn: Optional[str] = None, - **kwargs: Any + self, resource_group_name: str, resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any ) -> _models.CredentialResults: """Lists the cluster monitoring user credentials of a managed cluster. Lists the cluster monitoring user credentials of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_monitoring_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, - template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_monitoring_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -605,64 +560,54 @@ async def list_cluster_monitoring_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_monitoring_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore - + list_cluster_monitoring_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore @distributed_trace_async - async def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.ManagedCluster: + async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.ManagedCluster: """Gets a managed cluster. Gets a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedCluster, or the result of cls(response) + :return: ManagedCluster or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.ManagedCluster - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -670,55 +615,54 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _create_or_update_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.ManagedCluster, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'ManagedCluster') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedCluster") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -726,10 +670,9 @@ async def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -737,37 +680,41 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - - @distributed_trace_async + @overload async def begin_create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedCluster, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. Creates or updates a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The managed cluster to create or update. + :param parameters: The managed cluster to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2021_10_01.models.ManagedCluster + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -780,20 +727,88 @@ async def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_10_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_10_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster to create or update. Is either a model type or a IO + type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_10_01.models.ManagedCluster or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_10_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -801,69 +816,66 @@ async def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _update_tags_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.TagsObject, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request_initial( - subscription_id=self._config.subscription_id, + request = build_update_tags_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_tags_initial.metadata['url'], + content=_content, + template_url=self._update_tags_initial.metadata["url"], headers=_headers, params=_params, ) @@ -871,44 +883,47 @@ async def _update_tags_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_tags_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + _update_tags_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - - @distributed_trace_async + @overload async def begin_update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates tags on a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2021_10_01.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -921,20 +936,88 @@ async def begin_update_tags( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_10_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates tags on a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_10_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates tags on a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_10_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_10_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, @@ -942,64 +1025,54 @@ async def begin_update_tags( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1007,10 +1080,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1020,23 +1092,17 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: + async def begin_delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Deletes a managed cluster. Deletes a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1048,85 +1114,83 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterServicePrincipalProfile, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterServicePrincipalProfile") - request = build_reset_service_principal_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_service_principal_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_service_principal_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_service_principal_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1134,10 +1198,9 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1147,28 +1210,104 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist if cls: return cls(pipeline_response, None, {}) - _reset_service_principal_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + _reset_service_principal_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore - - @distributed_trace_async - async def begin_reset_service_principal_profile( # pylint: disable=inconsistent-return-statements + @overload + async def begin_reset_service_principal_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterServicePrincipalProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: """Reset the Service Principal Profile of a managed cluster. This action cannot be performed on a cluster that is not using a service principal. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The service principal profile to set on the managed cluster. + :param parameters: The service principal profile to set on the managed cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2021_10_01.models.ManagedClusterServicePrincipalProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset the Service Principal Profile of a managed cluster. + + This action cannot be performed on a cluster that is not using a service principal. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The service principal profile to set on the managed cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset the Service Principal Profile of a managed cluster. + + This action cannot be performed on a cluster that is not using a service principal. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The service principal profile to set on the managed cluster. Is either a + model type or a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2021_10_01.models.ManagedClusterServicePrincipalProfile or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -1179,20 +1318,17 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1200,67 +1336,68 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_service_principal_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + begin_reset_service_principal_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterAADProfile, + parameters: Union[_models.ManagedClusterAADProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterAADProfile") - request = build_reset_aad_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_aad_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_aad_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_aad_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1268,10 +1405,9 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1281,27 +1417,103 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta if cls: return cls(pipeline_response, None, {}) - _reset_aad_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + _reset_aad_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - - @distributed_trace_async - async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements + @overload + async def begin_reset_aad_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterAADProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: """Reset the AAD Profile of a managed cluster. Reset the AAD Profile of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The AAD profile to set on the Managed Cluster. + :param parameters: The AAD profile to set on the Managed Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2021_10_01.models.ManagedClusterAADProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset the AAD Profile of a managed cluster. + + Reset the AAD Profile of a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The AAD profile to set on the Managed Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterAADProfile, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset the AAD Profile of a managed cluster. + + Reset the AAD Profile of a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The AAD profile to set on the Managed Cluster. Is either a model type or a + IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_10_01.models.ManagedClusterAADProfile or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -1312,20 +1524,17 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1333,62 +1542,52 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_aad_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + begin_reset_aad_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_rotate_cluster_certificates_request_initial( - subscription_id=self._config.subscription_id, + request = build_rotate_cluster_certificates_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._rotate_cluster_certificates_initial.metadata['url'], + template_url=self._rotate_cluster_certificates_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1396,10 +1595,9 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1409,24 +1607,20 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- if cls: return cls(pipeline_response, None, {}) - _rotate_cluster_certificates_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore - + _rotate_cluster_certificates_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore @distributed_trace_async - async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + async def begin_rotate_cluster_certificates( + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Rotates the certificates of a managed cluster. See `Certificate rotation `_ for more details about rotating managed cluster certificates. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1438,80 +1632,67 @@ async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-ret Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._rotate_cluster_certificates_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_rotate_cluster_certificates.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore + begin_rotate_cluster_certificates.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore async def _stop_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_stop_request_initial( - subscription_id=self._config.subscription_id, + request = build_stop_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._stop_initial.metadata['url'], + template_url=self._stop_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1519,10 +1700,9 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1532,16 +1712,10 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore - + _stop_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore @distributed_trace_async - async def begin_stop( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: + async def begin_stop(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Stops a Managed Cluster. This can only be performed on Azure Virtual Machine Scale set backed clusters. Stopping a @@ -1550,9 +1724,9 @@ async def begin_stop( # pylint: disable=inconsistent-return-statements `_ for more details about stopping a cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1564,80 +1738,67 @@ async def begin_stop( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._stop_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore + begin_stop.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore async def _start_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_start_request_initial( - subscription_id=self._config.subscription_id, + request = build_start_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._start_initial.metadata['url'], + template_url=self._start_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1645,10 +1806,9 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1658,24 +1818,18 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore - + _start_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore @distributed_trace_async - async def begin_start( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: + async def begin_start(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Starts a previously stopped Managed Cluster. See `starting a cluster `_ for more details about starting a cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1687,85 +1841,83 @@ async def begin_start( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._start_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore + begin_start.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore async def _run_command_initial( self, resource_group_name: str, resource_name: str, - request_payload: _models.RunCommandRequest, + request_payload: Union[_models.RunCommandRequest, IO], **kwargs: Any ) -> Optional[_models.RunCommandResult]: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RunCommandResult]] - _json = self._serialize.body(request_payload, 'RunCommandRequest') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(request_payload, (IO, bytes)): + _content = request_payload + else: + _json = self._serialize.body(request_payload, "RunCommandRequest") - request = build_run_command_request_initial( - subscription_id=self._config.subscription_id, + request = build_run_command_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._run_command_initial.metadata['url'], + content=_content, + template_url=self._run_command_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1773,10 +1925,9 @@ async def _run_command_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1785,22 +1936,23 @@ async def _run_command_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _run_command_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore - + _run_command_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore - @distributed_trace_async + @overload async def begin_run_command( self, resource_group_name: str, resource_name: str, request_payload: _models.RunCommandRequest, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.RunCommandResult]: """Submits a command to run against the Managed Cluster. @@ -1809,12 +1961,15 @@ async def begin_run_command( more information see `AKS Run Command `_. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param request_payload: The run command request. + :param request_payload: The run command request. Required. :type request_payload: ~azure.mgmt.containerservice.v2021_10_01.models.RunCommandRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -1827,20 +1982,95 @@ async def begin_run_command( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_10_01.models.RunCommandResult] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_run_command( + self, + resource_group_name: str, + resource_name: str, + request_payload: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.RunCommandResult]: + """Submits a command to run against the Managed Cluster. + + AKS will create a pod to run the command. This is primarily useful for private clusters. For + more information see `AKS Run Command + `_. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param request_payload: The run command request. Required. + :type request_payload: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RunCommandResult or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_10_01.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_run_command( + self, + resource_group_name: str, + resource_name: str, + request_payload: Union[_models.RunCommandRequest, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.RunCommandResult]: + """Submits a command to run against the Managed Cluster. + + AKS will create a pod to run the command. This is primarily useful for private clusters. For + more information see `AKS Run Command + `_. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param request_payload: The run command request. Is either a model type or a IO type. Required. + :type request_payload: ~azure.mgmt.containerservice.v2021_10_01.models.RunCommandRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RunCommandResult or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_10_01.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.RunCommandResult] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.RunCommandResult] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._run_command_initial( # type: ignore resource_group_name=resource_group_name, @@ -1848,82 +2078,71 @@ async def begin_run_command( request_payload=request_payload, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_run_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore + begin_run_command.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore @distributed_trace_async async def get_command_result( - self, - resource_group_name: str, - resource_name: str, - command_id: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, command_id: str, **kwargs: Any ) -> Optional[_models.RunCommandResult]: """Gets the results of a command which has been run on the Managed Cluster. Gets the results of a command which has been run on the Managed Cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param command_id: Id of the command. + :param command_id: Id of the command. Required. :type command_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: RunCommandResult, or the result of cls(response) + :return: RunCommandResult or None or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.RunCommandResult or None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RunCommandResult]] - request = build_get_command_result_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, command_id=command_id, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_command_result.metadata['url'], + template_url=self.get_command_result.metadata["url"], headers=_headers, params=_params, ) @@ -1931,10 +2150,9 @@ async def get_command_result( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1943,59 +2161,54 @@ async def get_command_result( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_command_result.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}"} # type: ignore - + get_command_result.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}"} # type: ignore @distributed_trace def list_outbound_network_dependencies_endpoints( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.OutboundEnvironmentEndpointCollection]: + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> AsyncIterable["_models.OutboundEnvironmentEndpoint"]: """Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster. Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster. The operation returns properties of each egress endpoint. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OutboundEnvironmentEndpointCollection or the - result of cls(response) + :return: An iterator like instance of either OutboundEnvironmentEndpoint or the result of + cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_10_01.models.OutboundEnvironmentEndpointCollection] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_10_01.models.OutboundEnvironmentEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_outbound_network_dependencies_endpoints_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_outbound_network_dependencies_endpoints.metadata['url'], + template_url=self.list_outbound_network_dependencies_endpoints.metadata["url"], headers=_headers, params=_params, ) @@ -2003,16 +2216,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_outbound_network_dependencies_endpoints_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -2028,10 +2236,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2041,8 +2247,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_outbound_network_dependencies_endpoints.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints"} # type: ignore + list_outbound_network_dependencies_endpoints.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/operations/_operations.py index 9e3a9116160f..584b2bd6bde8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/operations/_operations.py @@ -7,9 +7,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,9 +27,11 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._operations import build_list_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class Operations: """ .. warning:: @@ -42,38 +51,33 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.OperationListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.OperationValue"]: """Gets a list of operations. Gets a list of operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationListResult or the result of cls(response) + :return: An iterator like instance of either OperationValue or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_10_01.models.OperationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_10_01.models.OperationValue] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -81,13 +85,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -103,10 +105,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -116,8 +116,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.ContainerService/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ContainerService/operations"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/operations/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/operations/_private_endpoint_connections_operations.py index 80479203b650..4450caa77b64 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/operations/_private_endpoint_connections_operations.py @@ -6,9 +6,15 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -20,10 +26,17 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._private_endpoint_connections_operations import build_delete_request_initial, build_get_request, build_list_request, build_update_request -T = TypeVar('T') +from ...operations._private_endpoint_connections_operations import ( + build_delete_request, + build_get_request, + build_list_request, + build_update_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class PrivateEndpointConnectionsOperations: """ .. warning:: @@ -43,46 +56,39 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async async def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnectionListResult: """Gets a list of private endpoint connections in the specified managed cluster. To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnectionListResult, or the result of cls(response) + :return: PrivateEndpointConnectionListResult or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.PrivateEndpointConnectionListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnectionListResult] - request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -90,69 +96,60 @@ async def list( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore - + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore @distributed_trace_async async def get( - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnection: """Gets the specified private endpoint connection. To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -160,75 +157,147 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - @distributed_trace_async + @overload async def update( self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, parameters: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateEndpointConnection: """Updates a private endpoint connection. Updates a private endpoint connection. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str - :param parameters: The updated private endpoint connection. + :param parameters: The updated private endpoint connection. Required. :type parameters: ~azure.mgmt.containerservice.v2021_10_01.models.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: The updated private endpoint connection. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: Union[_models.PrivateEndpointConnection, IO], + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: The updated private endpoint connection. Is either a model type or a IO + type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_10_01.models.PrivateEndpointConnection or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - _json = self._serialize.body(parameters, 'PrivateEndpointConnection') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateEndpointConnection") request = build_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update.metadata['url'], + content=_content, + template_url=self.update.metadata["url"], headers=_headers, params=_params, ) @@ -236,52 +305,43 @@ async def update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -289,10 +349,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -302,26 +361,21 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + async def begin_delete( + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes a private endpoint connection. Deletes a private endpoint connection. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -333,53 +387,46 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/operations/_private_link_resources_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/operations/_private_link_resources_operations.py index 02136afd64ab..4d1937410933 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/operations/_private_link_resources_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/operations/_private_link_resources_operations.py @@ -8,7 +8,13 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -19,9 +25,11 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._private_link_resources_operations import build_list_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class PrivateLinkResourcesOperations: """ .. warning:: @@ -41,46 +49,39 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async async def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.PrivateLinkResourcesListResult: """Gets a list of private link resources in the specified managed cluster. To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResourcesListResult, or the result of cls(response) + :return: PrivateLinkResourcesListResult or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.PrivateLinkResourcesListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResourcesListResult] - request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -88,22 +89,20 @@ async def list( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResourcesListResult', pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources"} # type: ignore - + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/operations/_resolve_private_link_service_id_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/operations/_resolve_private_link_service_id_operations.py index 8e6150f50c7b..ebd87464c93b 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/operations/_resolve_private_link_service_id_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/operations/_resolve_private_link_service_id_operations.py @@ -6,9 +6,15 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -19,9 +25,11 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._resolve_private_link_service_id_operations import build_post_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class ResolvePrivateLinkServiceIdOperations: """ .. warning:: @@ -41,52 +49,118 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async + @overload async def post( self, resource_group_name: str, resource_name: str, parameters: _models.PrivateLinkResource, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateLinkResource: """Gets the private link service ID for the specified managed cluster. Gets the private link service ID for the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters required in order to resolve a private link service ID. + :param parameters: Parameters required in order to resolve a private link service ID. Required. :type parameters: ~azure.mgmt.containerservice.v2021_10_01.models.PrivateLinkResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def post( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID for the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters required in order to resolve a private link service ID. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResource, or the result of cls(response) + :return: PrivateLinkResource or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.PrivateLinkResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @distributed_trace_async + async def post( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.PrivateLinkResource, IO], + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID for the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters required in order to resolve a private link service ID. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_10_01.models.PrivateLinkResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResource] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResource] - _json = self._serialize.body(parameters, 'PrivateLinkResource') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateLinkResource") request = build_post_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.post.metadata['url'], + content=_content, + template_url=self.post.metadata["url"], headers=_headers, params=_params, ) @@ -94,22 +168,20 @@ async def post( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResource', pipeline_response) + deserialized = self._deserialize("PrivateLinkResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - post.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId"} # type: ignore - + post.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/operations/_snapshots_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/operations/_snapshots_operations.py index b476220190d3..d8b651d1669e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/operations/_snapshots_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/operations/_snapshots_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,10 +27,19 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._snapshots_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_resource_group_request, build_list_request, build_update_tags_request -T = TypeVar('T') +from ...operations._snapshots_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_resource_group_request, + build_list_request, + build_update_tags_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class SnapshotsOperations: """ .. warning:: @@ -43,39 +59,34 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.SnapshotListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.Snapshot"]: """Gets a list of snapshots in the specified subscription. Gets a list of snapshots in the specified subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SnapshotListResult or the result of cls(response) + :return: An iterator like instance of either Snapshot or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_10_01.models.SnapshotListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_10_01.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SnapshotListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -83,14 +94,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -106,10 +114,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -119,48 +125,41 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots"} # type: ignore @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.SnapshotListResult]: + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.Snapshot"]: """Lists snapshots in the specified subscription and resource group. Lists snapshots in the specified subscription and resource group. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SnapshotListResult or the result of cls(response) + :return: An iterator like instance of either Snapshot or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_10_01.models.SnapshotListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_10_01.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SnapshotListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -168,15 +167,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -192,10 +187,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -205,50 +198,40 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots"} # type: ignore @distributed_trace_async - async def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.Snapshot: + async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.Snapshot: """Gets a snapshot. Gets a snapshot. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Snapshot, or the result of cls(response) + :return: Snapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.Snapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -256,71 +239,132 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - - @distributed_trace_async + @overload async def create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.Snapshot, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.Snapshot: """Creates or updates a snapshot. Creates or updates a snapshot. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The snapshot to create or update. + :param parameters: The snapshot to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2021_10_01.models.Snapshot + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Snapshot: + """Creates or updates a snapshot. + + Creates or updates a snapshot. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The snapshot to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Snapshot, or the result of cls(response) + :return: Snapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.Snapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @distributed_trace_async + async def create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.Snapshot, IO], **kwargs: Any + ) -> _models.Snapshot: + """Creates or updates a snapshot. + + Creates or updates a snapshot. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The snapshot to create or update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.mgmt.containerservice.v2021_10_01.models.Snapshot or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] - _json = self._serialize.body(parameters, 'Snapshot') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "Snapshot") request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) @@ -328,10 +372,9 @@ async def create_or_update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -339,64 +382,126 @@ async def create_or_update( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - @distributed_trace_async + @overload async def update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.Snapshot: """Updates tags on a snapshot. Updates tags on a snapshot. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update snapshot Tags operation. + :param parameters: Parameters supplied to the Update snapshot Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2021_10_01.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Snapshot: + """Updates tags on a snapshot. + + Updates tags on a snapshot. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update snapshot Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> _models.Snapshot: + """Updates tags on a snapshot. + + Updates tags on a snapshot. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update snapshot Tags operation. Is either a model + type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_10_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Snapshot, or the result of cls(response) + :return: Snapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.Snapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") request = build_update_tags_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_tags.metadata['url'], + content=_content, + template_url=self.update_tags.metadata["url"], headers=_headers, params=_params, ) @@ -404,64 +509,56 @@ async def update_tags( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - + update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: """Deletes a snapshot. Deletes a snapshot. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) @@ -469,10 +566,9 @@ async def delete( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -482,5 +578,4 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - + delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/models/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/models/__init__.py index ffb280a7c2fe..84770752e13e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/models/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/models/__init__.py @@ -93,169 +93,167 @@ from ._models_py3 import UserAssignedIdentity from ._models_py3 import WindowsGmsaProfile - -from ._container_service_client_enums import ( - AgentPoolMode, - AgentPoolType, - Code, - ConnectionStatus, - ContainerServiceStorageProfileTypes, - ContainerServiceVMSizeTypes, - Count, - CreatedByType, - Expander, - ExtendedLocationTypes, - GPUInstanceProfile, - IpFamily, - KubeletDiskType, - LicenseType, - LoadBalancerSku, - ManagedClusterPodIdentityProvisioningState, - ManagedClusterSKUName, - ManagedClusterSKUTier, - NetworkMode, - NetworkPlugin, - NetworkPolicy, - OSDiskType, - OSSKU, - OSType, - OutboundType, - PrivateEndpointConnectionProvisioningState, - PublicNetworkAccess, - ResourceIdentityType, - ScaleDownMode, - ScaleSetEvictionPolicy, - ScaleSetPriority, - SnapshotType, - UpgradeChannel, - WeekDay, - WorkloadRuntime, -) +from ._container_service_client_enums import AgentPoolMode +from ._container_service_client_enums import AgentPoolType +from ._container_service_client_enums import Code +from ._container_service_client_enums import ConnectionStatus +from ._container_service_client_enums import ContainerServiceStorageProfileTypes +from ._container_service_client_enums import ContainerServiceVMSizeTypes +from ._container_service_client_enums import Count +from ._container_service_client_enums import CreatedByType +from ._container_service_client_enums import Expander +from ._container_service_client_enums import ExtendedLocationTypes +from ._container_service_client_enums import GPUInstanceProfile +from ._container_service_client_enums import IpFamily +from ._container_service_client_enums import KubeletDiskType +from ._container_service_client_enums import LicenseType +from ._container_service_client_enums import LoadBalancerSku +from ._container_service_client_enums import ManagedClusterPodIdentityProvisioningState +from ._container_service_client_enums import ManagedClusterSKUName +from ._container_service_client_enums import ManagedClusterSKUTier +from ._container_service_client_enums import NetworkMode +from ._container_service_client_enums import NetworkPlugin +from ._container_service_client_enums import NetworkPolicy +from ._container_service_client_enums import OSDiskType +from ._container_service_client_enums import OSSKU +from ._container_service_client_enums import OSType +from ._container_service_client_enums import OutboundType +from ._container_service_client_enums import PrivateEndpointConnectionProvisioningState +from ._container_service_client_enums import PublicNetworkAccess +from ._container_service_client_enums import ResourceIdentityType +from ._container_service_client_enums import ScaleDownMode +from ._container_service_client_enums import ScaleSetEvictionPolicy +from ._container_service_client_enums import ScaleSetPriority +from ._container_service_client_enums import SnapshotType +from ._container_service_client_enums import UpgradeChannel +from ._container_service_client_enums import WeekDay +from ._container_service_client_enums import WorkloadRuntime from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'AgentPool', - 'AgentPoolAvailableVersions', - 'AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem', - 'AgentPoolListResult', - 'AgentPoolUpgradeProfile', - 'AgentPoolUpgradeProfilePropertiesUpgradesItem', - 'AgentPoolUpgradeSettings', - 'CloudErrorBody', - 'ContainerServiceDiagnosticsProfile', - 'ContainerServiceLinuxProfile', - 'ContainerServiceMasterProfile', - 'ContainerServiceNetworkProfile', - 'ContainerServiceSshConfiguration', - 'ContainerServiceSshPublicKey', - 'ContainerServiceVMDiagnostics', - 'CreationData', - 'CredentialResult', - 'CredentialResults', - 'EndpointDependency', - 'EndpointDetail', - 'ExtendedLocation', - 'KubeletConfig', - 'LinuxOSConfig', - 'MaintenanceConfiguration', - 'MaintenanceConfigurationListResult', - 'ManagedCluster', - 'ManagedClusterAADProfile', - 'ManagedClusterAPIServerAccessProfile', - 'ManagedClusterAccessProfile', - 'ManagedClusterAddonProfile', - 'ManagedClusterAddonProfileIdentity', - 'ManagedClusterAgentPoolProfile', - 'ManagedClusterAgentPoolProfileProperties', - 'ManagedClusterAutoUpgradeProfile', - 'ManagedClusterHTTPProxyConfig', - 'ManagedClusterIdentity', - 'ManagedClusterListResult', - 'ManagedClusterLoadBalancerProfile', - 'ManagedClusterLoadBalancerProfileManagedOutboundIPs', - 'ManagedClusterLoadBalancerProfileOutboundIPPrefixes', - 'ManagedClusterLoadBalancerProfileOutboundIPs', - 'ManagedClusterManagedOutboundIPProfile', - 'ManagedClusterNATGatewayProfile', - 'ManagedClusterPodIdentity', - 'ManagedClusterPodIdentityException', - 'ManagedClusterPodIdentityProfile', - 'ManagedClusterPodIdentityProvisioningError', - 'ManagedClusterPodIdentityProvisioningErrorBody', - 'ManagedClusterPodIdentityProvisioningInfo', - 'ManagedClusterPoolUpgradeProfile', - 'ManagedClusterPoolUpgradeProfileUpgradesItem', - 'ManagedClusterPropertiesAutoScalerProfile', - 'ManagedClusterSKU', - 'ManagedClusterSecurityProfile', - 'ManagedClusterSecurityProfileAzureDefender', - 'ManagedClusterServicePrincipalProfile', - 'ManagedClusterUpgradeProfile', - 'ManagedClusterWindowsProfile', - 'ManagedServiceIdentityUserAssignedIdentitiesValue', - 'OSOptionProfile', - 'OSOptionProperty', - 'OperationListResult', - 'OperationValue', - 'OutboundEnvironmentEndpoint', - 'OutboundEnvironmentEndpointCollection', - 'PowerState', - 'PrivateEndpoint', - 'PrivateEndpointConnection', - 'PrivateEndpointConnectionListResult', - 'PrivateLinkResource', - 'PrivateLinkResourcesListResult', - 'PrivateLinkServiceConnectionState', - 'Resource', - 'ResourceReference', - 'RunCommandRequest', - 'RunCommandResult', - 'Snapshot', - 'SnapshotListResult', - 'SubResource', - 'SysctlConfig', - 'SystemData', - 'TagsObject', - 'TimeInWeek', - 'TimeSpan', - 'UserAssignedIdentity', - 'WindowsGmsaProfile', - 'AgentPoolMode', - 'AgentPoolType', - 'Code', - 'ConnectionStatus', - 'ContainerServiceStorageProfileTypes', - 'ContainerServiceVMSizeTypes', - 'Count', - 'CreatedByType', - 'Expander', - 'ExtendedLocationTypes', - 'GPUInstanceProfile', - 'IpFamily', - 'KubeletDiskType', - 'LicenseType', - 'LoadBalancerSku', - 'ManagedClusterPodIdentityProvisioningState', - 'ManagedClusterSKUName', - 'ManagedClusterSKUTier', - 'NetworkMode', - 'NetworkPlugin', - 'NetworkPolicy', - 'OSDiskType', - 'OSSKU', - 'OSType', - 'OutboundType', - 'PrivateEndpointConnectionProvisioningState', - 'PublicNetworkAccess', - 'ResourceIdentityType', - 'ScaleDownMode', - 'ScaleSetEvictionPolicy', - 'ScaleSetPriority', - 'SnapshotType', - 'UpgradeChannel', - 'WeekDay', - 'WorkloadRuntime', + "AgentPool", + "AgentPoolAvailableVersions", + "AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem", + "AgentPoolListResult", + "AgentPoolUpgradeProfile", + "AgentPoolUpgradeProfilePropertiesUpgradesItem", + "AgentPoolUpgradeSettings", + "CloudErrorBody", + "ContainerServiceDiagnosticsProfile", + "ContainerServiceLinuxProfile", + "ContainerServiceMasterProfile", + "ContainerServiceNetworkProfile", + "ContainerServiceSshConfiguration", + "ContainerServiceSshPublicKey", + "ContainerServiceVMDiagnostics", + "CreationData", + "CredentialResult", + "CredentialResults", + "EndpointDependency", + "EndpointDetail", + "ExtendedLocation", + "KubeletConfig", + "LinuxOSConfig", + "MaintenanceConfiguration", + "MaintenanceConfigurationListResult", + "ManagedCluster", + "ManagedClusterAADProfile", + "ManagedClusterAPIServerAccessProfile", + "ManagedClusterAccessProfile", + "ManagedClusterAddonProfile", + "ManagedClusterAddonProfileIdentity", + "ManagedClusterAgentPoolProfile", + "ManagedClusterAgentPoolProfileProperties", + "ManagedClusterAutoUpgradeProfile", + "ManagedClusterHTTPProxyConfig", + "ManagedClusterIdentity", + "ManagedClusterListResult", + "ManagedClusterLoadBalancerProfile", + "ManagedClusterLoadBalancerProfileManagedOutboundIPs", + "ManagedClusterLoadBalancerProfileOutboundIPPrefixes", + "ManagedClusterLoadBalancerProfileOutboundIPs", + "ManagedClusterManagedOutboundIPProfile", + "ManagedClusterNATGatewayProfile", + "ManagedClusterPodIdentity", + "ManagedClusterPodIdentityException", + "ManagedClusterPodIdentityProfile", + "ManagedClusterPodIdentityProvisioningError", + "ManagedClusterPodIdentityProvisioningErrorBody", + "ManagedClusterPodIdentityProvisioningInfo", + "ManagedClusterPoolUpgradeProfile", + "ManagedClusterPoolUpgradeProfileUpgradesItem", + "ManagedClusterPropertiesAutoScalerProfile", + "ManagedClusterSKU", + "ManagedClusterSecurityProfile", + "ManagedClusterSecurityProfileAzureDefender", + "ManagedClusterServicePrincipalProfile", + "ManagedClusterUpgradeProfile", + "ManagedClusterWindowsProfile", + "ManagedServiceIdentityUserAssignedIdentitiesValue", + "OSOptionProfile", + "OSOptionProperty", + "OperationListResult", + "OperationValue", + "OutboundEnvironmentEndpoint", + "OutboundEnvironmentEndpointCollection", + "PowerState", + "PrivateEndpoint", + "PrivateEndpointConnection", + "PrivateEndpointConnectionListResult", + "PrivateLinkResource", + "PrivateLinkResourcesListResult", + "PrivateLinkServiceConnectionState", + "Resource", + "ResourceReference", + "RunCommandRequest", + "RunCommandResult", + "Snapshot", + "SnapshotListResult", + "SubResource", + "SysctlConfig", + "SystemData", + "TagsObject", + "TimeInWeek", + "TimeSpan", + "UserAssignedIdentity", + "WindowsGmsaProfile", + "AgentPoolMode", + "AgentPoolType", + "Code", + "ConnectionStatus", + "ContainerServiceStorageProfileTypes", + "ContainerServiceVMSizeTypes", + "Count", + "CreatedByType", + "Expander", + "ExtendedLocationTypes", + "GPUInstanceProfile", + "IpFamily", + "KubeletDiskType", + "LicenseType", + "LoadBalancerSku", + "ManagedClusterPodIdentityProvisioningState", + "ManagedClusterSKUName", + "ManagedClusterSKUTier", + "NetworkMode", + "NetworkPlugin", + "NetworkPolicy", + "OSDiskType", + "OSSKU", + "OSType", + "OutboundType", + "PrivateEndpointConnectionProvisioningState", + "PublicNetworkAccess", + "ResourceIdentityType", + "ScaleDownMode", + "ScaleSetEvictionPolicy", + "ScaleSetPriority", + "SnapshotType", + "UpgradeChannel", + "WeekDay", + "WorkloadRuntime", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/models/_container_service_client_enums.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/models/_container_service_client_enums.py index 145f90c5ecca..5dd606dd070d 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/models/_container_service_client_enums.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/models/_container_service_client_enums.py @@ -13,7 +13,7 @@ class AgentPoolMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools + https://docs.microsoft.com/azure/aks/use-system-pools. """ #: System agent pools are primarily for hosting critical system pods such as CoreDNS and @@ -23,33 +23,34 @@ class AgentPoolMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: User agent pools are primarily for hosting your application pods. USER = "User" + class AgentPoolType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of Agent Pool. - """ + """The type of Agent Pool.""" #: Create an Agent Pool backed by a Virtual Machine Scale Set. VIRTUAL_MACHINE_SCALE_SETS = "VirtualMachineScaleSets" #: Use of this is strongly discouraged. AVAILABILITY_SET = "AvailabilitySet" + class Code(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Tells whether the cluster is Running or Stopped - """ + """Tells whether the cluster is Running or Stopped.""" #: The cluster is running. RUNNING = "Running" #: The cluster is stopped. STOPPED = "Stopped" + class ConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The private link service connection status. - """ + """The private link service connection status.""" PENDING = "Pending" APPROVED = "Approved" REJECTED = "Rejected" DISCONNECTED = "Disconnected" + class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Specifies what kind of storage to use. If omitted, the default will be chosen on your behalf based on the choice of orchestrator. @@ -58,9 +59,9 @@ class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEn STORAGE_ACCOUNT = "StorageAccount" MANAGED_DISKS = "ManagedDisks" + class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Size of agent VMs. Note: This is no longer maintained. - """ + """Size of agent VMs. Note: This is no longer maintained.""" STANDARD_A1 = "Standard_A1" STANDARD_A10 = "Standard_A10" @@ -237,6 +238,7 @@ class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): STANDARD_NV24 = "Standard_NV24" STANDARD_NV6 = "Standard_NV6" + class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): """Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, and 5. The default value is 1. @@ -246,15 +248,16 @@ class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): THREE = 3 FIVE = 5 + class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of identity that created the resource. - """ + """The type of identity that created the resource.""" USER = "User" APPLICATION = "Application" MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" + class Expander(str, Enum, metaclass=CaseInsensitiveEnumMeta): """If not specified, the default is 'random'. See `expanders `_ @@ -278,15 +281,15 @@ class Expander(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Used when you don't have a particular need for the node groups to scale differently. RANDOM = "random" + class ExtendedLocationTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of extendedLocation. - """ + """The type of extendedLocation.""" EDGE_ZONE = "EdgeZone" + class GPUInstanceProfile(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """GPUInstanceProfile to be used to specify GPU MIG instance profile for supported GPU VM SKU. - """ + """GPUInstanceProfile to be used to specify GPU MIG instance profile for supported GPU VM SKU.""" MIG1_G = "MIG1g" MIG2_G = "MIG2g" @@ -294,13 +297,14 @@ class GPUInstanceProfile(str, Enum, metaclass=CaseInsensitiveEnumMeta): MIG4_G = "MIG4g" MIG7_G = "MIG7g" + class IpFamily(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The IP version to use for cluster networking and IP assignment. - """ + """The IP version to use for cluster networking and IP assignment.""" I_PV4 = "IPv4" I_PV6 = "IPv6" + class KubeletDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. @@ -311,6 +315,7 @@ class KubeletDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Kubelet will use the temporary disk for its data. TEMPORARY = "Temporary" + class LicenseType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The license type to use for Windows VMs. See `Azure Hybrid User Benefits `_ for more details. @@ -321,6 +326,7 @@ class LicenseType(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Enables Azure Hybrid User Benefits for Windows VMs. WINDOWS_SERVER = "Windows_Server" + class LoadBalancerSku(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The default is 'standard'. See `Azure Load Balancer SKUs `_ for more information about the @@ -334,21 +340,22 @@ class LoadBalancerSku(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Use a basic Load Balancer with limited functionality. BASIC = "basic" + class ManagedClusterPodIdentityProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The current provisioning state of the pod identity. - """ + """The current provisioning state of the pod identity.""" ASSIGNED = "Assigned" UPDATING = "Updating" DELETING = "Deleting" FAILED = "Failed" + class ManagedClusterSKUName(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The name of a managed cluster SKU. - """ + """The name of a managed cluster SKU.""" BASIC = "Basic" + class ManagedClusterSKUTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): """If not specified, the default is 'Free'. See `uptime SLA `_ for more details. @@ -360,20 +367,20 @@ class ManagedClusterSKUTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: No guaranteed SLA, no additional charges. Free tier clusters have an SLO of 99.5%. FREE = "Free" + class NetworkMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """This cannot be specified if networkPlugin is anything other than 'azure'. - """ + """This cannot be specified if networkPlugin is anything other than 'azure'.""" #: No bridge is created. Intra-VM Pod to Pod communication is through IP routes created by Azure #: CNI. See `Transparent Mode `_ for #: more information. TRANSPARENT = "transparent" - #: This is no longer supported. + #: This is no longer supported BRIDGE = "bridge" + class NetworkPlugin(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Network plugin used for building the Kubernetes network. - """ + """Network plugin used for building the Kubernetes network.""" #: Use the Azure CNI network plugin. See `Azure CNI (advanced) networking #: `_ for @@ -384,9 +391,9 @@ class NetworkPlugin(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: information. KUBENET = "kubenet" + class NetworkPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Network policy used for building the Kubernetes network. - """ + """Network policy used for building the Kubernetes network.""" #: Use Calico network policies. See `differences between Azure and Calico policies #: `_ @@ -397,6 +404,7 @@ class NetworkPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: for more information. AZURE = "azure" + class OSDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more @@ -413,22 +421,23 @@ class OSDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: provides lower read/write latency, along with faster node scaling and cluster upgrades. EPHEMERAL = "Ephemeral" + class OSSKU(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Specifies an OS SKU. This value must not be specified if OSType is Windows. - """ + """Specifies an OS SKU. This value must not be specified if OSType is Windows.""" UBUNTU = "Ubuntu" CBL_MARINER = "CBLMariner" + class OSType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The operating system type. The default is Linux. - """ + """The operating system type. The default is Linux.""" #: Use Linux. LINUX = "Linux" #: Use Windows. WINDOWS = "Windows" + class OutboundType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """This can only be set at cluster creation time and cannot be changed later. For more information see `egress outbound type `_. @@ -449,22 +458,23 @@ class OutboundType(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: advanced scenario and requires proper network configuration. USER_ASSIGNED_NAT_GATEWAY = "userAssignedNATGateway" + class PrivateEndpointConnectionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The current provisioning state. - """ + """The current provisioning state.""" SUCCEEDED = "Succeeded" CREATING = "Creating" DELETING = "Deleting" FAILED = "Failed" + class PublicNetworkAccess(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Allow or deny public network access for AKS - """ + """Allow or deny public network access for AKS.""" ENABLED = "Enabled" DISABLED = "Disabled" + class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """For more information see `use managed identities in AKS `_. @@ -481,6 +491,7 @@ class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Do not use a managed identity for the Managed Cluster, service principal will be used instead. NONE = "None" + class ScaleDownMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Describes how VMs are added to or removed from Agent Pools. See `billing states `_. @@ -492,10 +503,11 @@ class ScaleDownMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: during scale down. DEALLOCATE = "Deallocate" + class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The eviction policy specifies what to do with the VM when it is evicted. The default is Delete. For more information about eviction see `spot VMs - `_ + `_. """ #: Nodes in the underlying Scale Set of the node pool are deleted when they're evicted. @@ -505,9 +517,9 @@ class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: cause issues with cluster scaling or upgrading. DEALLOCATE = "Deallocate" + class ScaleSetPriority(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The Virtual Machine Scale Set priority. - """ + """The Virtual Machine Scale Set priority.""" #: Spot priority VMs will be used. There is no SLA for spot nodes. See `spot on AKS #: `_ for more information. @@ -515,13 +527,14 @@ class ScaleSetPriority(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Regular VMs will be used. REGULAR = "Regular" + class SnapshotType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of a snapshot. The default is NodePool. - """ + """The type of a snapshot. The default is NodePool.""" #: The snapshot is a snapshot of a node pool. NODE_POOL = "NodePool" + class UpgradeChannel(str, Enum, metaclass=CaseInsensitiveEnumMeta): """For more information see `setting the AKS cluster auto-upgrade channel `_. @@ -552,9 +565,9 @@ class UpgradeChannel(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Disables auto-upgrades and keeps the cluster at its current version of Kubernetes. NONE = "none" + class WeekDay(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The weekday enum. - """ + """The weekday enum.""" SUNDAY = "Sunday" MONDAY = "Monday" @@ -564,9 +577,9 @@ class WeekDay(str, Enum, metaclass=CaseInsensitiveEnumMeta): FRIDAY = "Friday" SATURDAY = "Saturday" + class WorkloadRuntime(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Determines the type of workload a node can run. - """ + """Determines the type of workload a node can run.""" #: Nodes will use Kubelet to run standard OCI container workloads. OCI_CONTAINER = "OCIContainer" diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/models/_models_py3.py index b86bf3087f76..3e115a4b4f6d 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/models/_models_py3.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/models/_models_py3.py @@ -1,4 +1,5 @@ # coding=utf-8 +# pylint: disable=too-many-lines # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -9,14 +10,14 @@ import datetime from typing import Dict, List, Optional, TYPE_CHECKING, Union -import msrest.serialization +from ... import _serialization if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - import __init__ as _models + from .. import models as _models -class SubResource(msrest.serialization.Model): +class SubResource(_serialization.Model): """Reference to another subresource. Variables are only populated by the server, and will be ignored when sending a request. @@ -31,30 +32,26 @@ class SubResource(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(SubResource, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.id = None self.name = None self.type = None -class AgentPool(SubResource): +class AgentPool(SubResource): # pylint: disable=too-many-instance-attributes """Agent Pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -82,14 +79,14 @@ class AgentPool(SubResource): larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2021_10_01.models.OSDiskType :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data - root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2021_10_01.models.KubeletDiskType :ivar workload_runtime: Determines the type of workload a node can run. Known values are: - "OCIContainer", "WasmWasi". + "OCIContainer" and "WasmWasi". :vartype workload_runtime: str or ~azure.mgmt.containerservice.v2021_10_01.models.WorkloadRuntime :ivar vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and used. @@ -103,11 +100,11 @@ class AgentPool(SubResource): :vartype pod_subnet_id: str :ivar max_pods: The maximum number of pods that can run on a node. :vartype max_pods: int - :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2021_10_01.models.OSType :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known - values are: "Ubuntu", "CBLMariner". + values are: "Ubuntu" and "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2021_10_01.models.OSSKU :ivar max_count: The maximum number of nodes for auto-scaling. :vartype max_count: int @@ -116,15 +113,15 @@ class AgentPool(SubResource): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it - defaults to Delete. Known values are: "Delete", "Deallocate". + defaults to Delete. Known values are: "Delete" and "Deallocate". :vartype scale_down_mode: str or ~azure.mgmt.containerservice.v2021_10_01.models.ScaleDownMode - :ivar type_properties_type: The type of Agent Pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + :ivar type_properties_type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets" + and "AvailabilitySet". :vartype type_properties_type: str or ~azure.mgmt.containerservice.v2021_10_01.models.AgentPoolType :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :vartype mode: str or ~azure.mgmt.containerservice.v2021_10_01.models.AgentPoolMode :ivar orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -159,20 +156,18 @@ class AgentPool(SubResource): /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default - is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + is 'Regular'. Known values are: "Spot" and "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2021_10_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2021_10_01.models.ScaleSetEvictionPolicy :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :vartype spot_max_price: float - :ivar tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :ivar tags: The tags to be persisted on the agent pool virtual machine scale set. :vartype tags: dict[str, str] :ivar node_labels: The node labels to be persisted across all nodes in agent pool. :vartype node_labels: dict[str, str] @@ -196,7 +191,7 @@ class AgentPool(SubResource): for more details. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2021_10_01.models.GPUInstanceProfile :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the node pool @@ -205,60 +200,60 @@ class AgentPool(SubResource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'os_disk_size_gb': {'maximum': 2048, 'minimum': 0}, - 'node_image_version': {'readonly': True}, - 'provisioning_state': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "os_disk_size_gb": {"maximum": 2048, "minimum": 0}, + "node_image_version": {"readonly": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'count': {'key': 'properties.count', 'type': 'int'}, - 'vm_size': {'key': 'properties.vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'properties.osDiskSizeGB', 'type': 'int'}, - 'os_disk_type': {'key': 'properties.osDiskType', 'type': 'str'}, - 'kubelet_disk_type': {'key': 'properties.kubeletDiskType', 'type': 'str'}, - 'workload_runtime': {'key': 'properties.workloadRuntime', 'type': 'str'}, - 'vnet_subnet_id': {'key': 'properties.vnetSubnetID', 'type': 'str'}, - 'pod_subnet_id': {'key': 'properties.podSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'properties.maxPods', 'type': 'int'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'os_sku': {'key': 'properties.osSKU', 'type': 'str'}, - 'max_count': {'key': 'properties.maxCount', 'type': 'int'}, - 'min_count': {'key': 'properties.minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'properties.enableAutoScaling', 'type': 'bool'}, - 'scale_down_mode': {'key': 'properties.scaleDownMode', 'type': 'str'}, - 'type_properties_type': {'key': 'properties.type', 'type': 'str'}, - 'mode': {'key': 'properties.mode', 'type': 'str'}, - 'orchestrator_version': {'key': 'properties.orchestratorVersion', 'type': 'str'}, - 'node_image_version': {'key': 'properties.nodeImageVersion', 'type': 'str'}, - 'upgrade_settings': {'key': 'properties.upgradeSettings', 'type': 'AgentPoolUpgradeSettings'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'power_state': {'key': 'properties.powerState', 'type': 'PowerState'}, - 'availability_zones': {'key': 'properties.availabilityZones', 'type': '[str]'}, - 'enable_node_public_ip': {'key': 'properties.enableNodePublicIP', 'type': 'bool'}, - 'node_public_ip_prefix_id': {'key': 'properties.nodePublicIPPrefixID', 'type': 'str'}, - 'scale_set_priority': {'key': 'properties.scaleSetPriority', 'type': 'str'}, - 'scale_set_eviction_policy': {'key': 'properties.scaleSetEvictionPolicy', 'type': 'str'}, - 'spot_max_price': {'key': 'properties.spotMaxPrice', 'type': 'float'}, - 'tags': {'key': 'properties.tags', 'type': '{str}'}, - 'node_labels': {'key': 'properties.nodeLabels', 'type': '{str}'}, - 'node_taints': {'key': 'properties.nodeTaints', 'type': '[str]'}, - 'proximity_placement_group_id': {'key': 'properties.proximityPlacementGroupID', 'type': 'str'}, - 'kubelet_config': {'key': 'properties.kubeletConfig', 'type': 'KubeletConfig'}, - 'linux_os_config': {'key': 'properties.linuxOSConfig', 'type': 'LinuxOSConfig'}, - 'enable_encryption_at_host': {'key': 'properties.enableEncryptionAtHost', 'type': 'bool'}, - 'enable_ultra_ssd': {'key': 'properties.enableUltraSSD', 'type': 'bool'}, - 'enable_fips': {'key': 'properties.enableFIPS', 'type': 'bool'}, - 'gpu_instance_profile': {'key': 'properties.gpuInstanceProfile', 'type': 'str'}, - 'creation_data': {'key': 'properties.creationData', 'type': 'CreationData'}, - } - - def __init__( + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "count": {"key": "properties.count", "type": "int"}, + "vm_size": {"key": "properties.vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "properties.osDiskSizeGB", "type": "int"}, + "os_disk_type": {"key": "properties.osDiskType", "type": "str"}, + "kubelet_disk_type": {"key": "properties.kubeletDiskType", "type": "str"}, + "workload_runtime": {"key": "properties.workloadRuntime", "type": "str"}, + "vnet_subnet_id": {"key": "properties.vnetSubnetID", "type": "str"}, + "pod_subnet_id": {"key": "properties.podSubnetID", "type": "str"}, + "max_pods": {"key": "properties.maxPods", "type": "int"}, + "os_type": {"key": "properties.osType", "type": "str"}, + "os_sku": {"key": "properties.osSKU", "type": "str"}, + "max_count": {"key": "properties.maxCount", "type": "int"}, + "min_count": {"key": "properties.minCount", "type": "int"}, + "enable_auto_scaling": {"key": "properties.enableAutoScaling", "type": "bool"}, + "scale_down_mode": {"key": "properties.scaleDownMode", "type": "str"}, + "type_properties_type": {"key": "properties.type", "type": "str"}, + "mode": {"key": "properties.mode", "type": "str"}, + "orchestrator_version": {"key": "properties.orchestratorVersion", "type": "str"}, + "node_image_version": {"key": "properties.nodeImageVersion", "type": "str"}, + "upgrade_settings": {"key": "properties.upgradeSettings", "type": "AgentPoolUpgradeSettings"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "power_state": {"key": "properties.powerState", "type": "PowerState"}, + "availability_zones": {"key": "properties.availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "properties.enableNodePublicIP", "type": "bool"}, + "node_public_ip_prefix_id": {"key": "properties.nodePublicIPPrefixID", "type": "str"}, + "scale_set_priority": {"key": "properties.scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "properties.scaleSetEvictionPolicy", "type": "str"}, + "spot_max_price": {"key": "properties.spotMaxPrice", "type": "float"}, + "tags": {"key": "properties.tags", "type": "{str}"}, + "node_labels": {"key": "properties.nodeLabels", "type": "{str}"}, + "node_taints": {"key": "properties.nodeTaints", "type": "[str]"}, + "proximity_placement_group_id": {"key": "properties.proximityPlacementGroupID", "type": "str"}, + "kubelet_config": {"key": "properties.kubeletConfig", "type": "KubeletConfig"}, + "linux_os_config": {"key": "properties.linuxOSConfig", "type": "LinuxOSConfig"}, + "enable_encryption_at_host": {"key": "properties.enableEncryptionAtHost", "type": "bool"}, + "enable_ultra_ssd": {"key": "properties.enableUltraSSD", "type": "bool"}, + "enable_fips": {"key": "properties.enableFIPS", "type": "bool"}, + "gpu_instance_profile": {"key": "properties.gpuInstanceProfile", "type": "str"}, + "creation_data": {"key": "properties.creationData", "type": "CreationData"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, count: Optional[int] = None, @@ -270,7 +265,7 @@ def __init__( vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, @@ -284,9 +279,9 @@ def __init__( availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", - spot_max_price: Optional[float] = -1, + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", + spot_max_price: float = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, @@ -317,14 +312,14 @@ def __init__( larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2021_10_01.models.OSDiskType :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime - data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + data root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2021_10_01.models.KubeletDiskType :keyword workload_runtime: Determines the type of workload a node can run. Known values are: - "OCIContainer", "WasmWasi". + "OCIContainer" and "WasmWasi". :paramtype workload_runtime: str or ~azure.mgmt.containerservice.v2021_10_01.models.WorkloadRuntime :keyword vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and @@ -338,11 +333,11 @@ def __init__( :paramtype pod_subnet_id: str :keyword max_pods: The maximum number of pods that can run on a node. :paramtype max_pods: int - :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2021_10_01.models.OSType :keyword os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Known values are: "Ubuntu", "CBLMariner". + Known values are: "Ubuntu" and "CBLMariner". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2021_10_01.models.OSSKU :keyword max_count: The maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -351,16 +346,16 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, - it defaults to Delete. Known values are: "Delete", "Deallocate". + it defaults to Delete. Known values are: "Delete" and "Deallocate". :paramtype scale_down_mode: str or ~azure.mgmt.containerservice.v2021_10_01.models.ScaleDownMode :keyword type_properties_type: The type of Agent Pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type_properties_type: str or ~azure.mgmt.containerservice.v2021_10_01.models.AgentPoolType :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2021_10_01.models.AgentPoolMode :keyword orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -391,20 +386,18 @@ def __init__( /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the - default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + default is 'Regular'. Known values are: "Spot" and "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2021_10_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2021_10_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :paramtype spot_max_price: float - :keyword tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :keyword tags: The tags to be persisted on the agent pool virtual machine scale set. :paramtype tags: dict[str, str] :keyword node_labels: The node labels to be persisted across all nodes in agent pool. :paramtype node_labels: dict[str, str] @@ -428,7 +421,7 @@ def __init__( for more details. :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance - profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2021_10_01.models.GPUInstanceProfile @@ -436,7 +429,7 @@ def __init__( pool will be created/upgraded using a snapshot. :paramtype creation_data: ~azure.mgmt.containerservice.v2021_10_01.models.CreationData """ - super(AgentPool, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.vm_size = vm_size self.os_disk_size_gb = os_disk_size_gb @@ -478,7 +471,7 @@ def __init__( self.creation_data = creation_data -class AgentPoolAvailableVersions(msrest.serialization.Model): +class AgentPoolAvailableVersions(_serialization.Model): """The list of available versions for an agent pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -495,16 +488,19 @@ class AgentPoolAvailableVersions(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'agent_pool_versions': {'key': 'properties.agentPoolVersions', 'type': '[AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "agent_pool_versions": { + "key": "properties.agentPoolVersions", + "type": "[AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem]", + }, } def __init__( @@ -518,14 +514,14 @@ def __init__( :paramtype agent_pool_versions: list[~azure.mgmt.containerservice.v2021_10_01.models.AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem] """ - super(AgentPoolAvailableVersions, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None self.agent_pool_versions = agent_pool_versions -class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(msrest.serialization.Model): +class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(_serialization.Model): """AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem. :ivar default: Whether this version is the default agent pool version. @@ -537,9 +533,9 @@ class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(msrest.serializa """ _attribute_map = { - 'default': {'key': 'default', 'type': 'bool'}, - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "default": {"key": "default", "type": "bool"}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } def __init__( @@ -558,13 +554,13 @@ def __init__( :keyword is_preview: Whether Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.default = default self.kubernetes_version = kubernetes_version self.is_preview = is_preview -class AgentPoolListResult(msrest.serialization.Model): +class AgentPoolListResult(_serialization.Model): """The response from the List Agent Pools operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -576,30 +572,25 @@ class AgentPoolListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[AgentPool]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[AgentPool]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.AgentPool"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.AgentPool"]] = None, **kwargs): """ :keyword value: The list of agent pools. :paramtype value: list[~azure.mgmt.containerservice.v2021_10_01.models.AgentPool] """ - super(AgentPoolListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class AgentPoolUpgradeProfile(msrest.serialization.Model): +class AgentPoolUpgradeProfile(_serialization.Model): """The list of available upgrades for an agent pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -612,10 +603,10 @@ class AgentPoolUpgradeProfile(msrest.serialization.Model): :vartype name: str :ivar type: The type of the agent pool upgrade profile. :vartype type: str - :ivar kubernetes_version: Required. The Kubernetes version (major.minor.patch). + :ivar kubernetes_version: The Kubernetes version (major.minor.patch). Required. :vartype kubernetes_version: str - :ivar os_type: Required. The operating system type. The default is Linux. Known values are: - "Linux", "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2021_10_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -625,21 +616,21 @@ class AgentPoolUpgradeProfile(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kubernetes_version': {'required': True}, - 'os_type': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "kubernetes_version": {"required": True}, + "os_type": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'kubernetes_version': {'key': 'properties.kubernetesVersion', 'type': 'str'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'upgrades': {'key': 'properties.upgrades', 'type': '[AgentPoolUpgradeProfilePropertiesUpgradesItem]'}, - 'latest_node_image_version': {'key': 'properties.latestNodeImageVersion', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "os_type": {"key": "properties.osType", "type": "str"}, + "upgrades": {"key": "properties.upgrades", "type": "[AgentPoolUpgradeProfilePropertiesUpgradesItem]"}, + "latest_node_image_version": {"key": "properties.latestNodeImageVersion", "type": "str"}, } def __init__( @@ -652,10 +643,10 @@ def __init__( **kwargs ): """ - :keyword kubernetes_version: Required. The Kubernetes version (major.minor.patch). + :keyword kubernetes_version: The Kubernetes version (major.minor.patch). Required. :paramtype kubernetes_version: str - :keyword os_type: Required. The operating system type. The default is Linux. Known values are: - "Linux", "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2021_10_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: @@ -663,7 +654,7 @@ def __init__( :keyword latest_node_image_version: The latest AKS supported node image version. :paramtype latest_node_image_version: str """ - super(AgentPoolUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -673,7 +664,7 @@ def __init__( self.latest_node_image_version = latest_node_image_version -class AgentPoolUpgradeProfilePropertiesUpgradesItem(msrest.serialization.Model): +class AgentPoolUpgradeProfilePropertiesUpgradesItem(_serialization.Model): """AgentPoolUpgradeProfilePropertiesUpgradesItem. :ivar kubernetes_version: The Kubernetes version (major.minor.patch). @@ -683,29 +674,23 @@ class AgentPoolUpgradeProfilePropertiesUpgradesItem(msrest.serialization.Model): """ _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } - def __init__( - self, - *, - kubernetes_version: Optional[str] = None, - is_preview: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, kubernetes_version: Optional[str] = None, is_preview: Optional[bool] = None, **kwargs): """ :keyword kubernetes_version: The Kubernetes version (major.minor.patch). :paramtype kubernetes_version: str :keyword is_preview: Whether the Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(AgentPoolUpgradeProfilePropertiesUpgradesItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.is_preview = is_preview -class AgentPoolUpgradeSettings(msrest.serialization.Model): +class AgentPoolUpgradeSettings(_serialization.Model): """Settings for upgrading an agentpool. :ivar max_surge: This can either be set to an integer (e.g. '5') or a percentage (e.g. '50%'). @@ -717,15 +702,10 @@ class AgentPoolUpgradeSettings(msrest.serialization.Model): """ _attribute_map = { - 'max_surge': {'key': 'maxSurge', 'type': 'str'}, + "max_surge": {"key": "maxSurge", "type": "str"}, } - def __init__( - self, - *, - max_surge: Optional[str] = None, - **kwargs - ): + def __init__(self, *, max_surge: Optional[str] = None, **kwargs): """ :keyword max_surge: This can either be set to an integer (e.g. '5') or a percentage (e.g. '50%'). If a percentage is specified, it is the percentage of the total agent pool size at the @@ -734,11 +714,11 @@ def __init__( https://docs.microsoft.com/azure/aks/upgrade-cluster#customize-node-surge-upgrade. :paramtype max_surge: str """ - super(AgentPoolUpgradeSettings, self).__init__(**kwargs) + super().__init__(**kwargs) self.max_surge = max_surge -class CloudErrorBody(msrest.serialization.Model): +class CloudErrorBody(_serialization.Model): """An error response from the Container service. :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed @@ -755,10 +735,10 @@ class CloudErrorBody(msrest.serialization.Model): """ _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[CloudErrorBody]"}, } def __init__( @@ -783,87 +763,76 @@ def __init__( :keyword details: A list of additional details about the error. :paramtype details: list[~azure.mgmt.containerservice.v2021_10_01.models.CloudErrorBody] """ - super(CloudErrorBody, self).__init__(**kwargs) + super().__init__(**kwargs) self.code = code self.message = message self.target = target self.details = details -class ContainerServiceDiagnosticsProfile(msrest.serialization.Model): +class ContainerServiceDiagnosticsProfile(_serialization.Model): """Profile for diagnostics on the container service cluster. All required parameters must be populated in order to send to Azure. - :ivar vm_diagnostics: Required. Profile for diagnostics on the container service VMs. + :ivar vm_diagnostics: Profile for diagnostics on the container service VMs. Required. :vartype vm_diagnostics: ~azure.mgmt.containerservice.v2021_10_01.models.ContainerServiceVMDiagnostics """ _validation = { - 'vm_diagnostics': {'required': True}, + "vm_diagnostics": {"required": True}, } _attribute_map = { - 'vm_diagnostics': {'key': 'vmDiagnostics', 'type': 'ContainerServiceVMDiagnostics'}, + "vm_diagnostics": {"key": "vmDiagnostics", "type": "ContainerServiceVMDiagnostics"}, } - def __init__( - self, - *, - vm_diagnostics: "_models.ContainerServiceVMDiagnostics", - **kwargs - ): + def __init__(self, *, vm_diagnostics: "_models.ContainerServiceVMDiagnostics", **kwargs): """ - :keyword vm_diagnostics: Required. Profile for diagnostics on the container service VMs. + :keyword vm_diagnostics: Profile for diagnostics on the container service VMs. Required. :paramtype vm_diagnostics: ~azure.mgmt.containerservice.v2021_10_01.models.ContainerServiceVMDiagnostics """ - super(ContainerServiceDiagnosticsProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.vm_diagnostics = vm_diagnostics -class ContainerServiceLinuxProfile(msrest.serialization.Model): +class ContainerServiceLinuxProfile(_serialization.Model): """Profile for Linux VMs in the container service cluster. All required parameters must be populated in order to send to Azure. - :ivar admin_username: Required. The administrator username to use for Linux VMs. + :ivar admin_username: The administrator username to use for Linux VMs. Required. :vartype admin_username: str - :ivar ssh: Required. The SSH configuration for Linux-based VMs running on Azure. + :ivar ssh: The SSH configuration for Linux-based VMs running on Azure. Required. :vartype ssh: ~azure.mgmt.containerservice.v2021_10_01.models.ContainerServiceSshConfiguration """ _validation = { - 'admin_username': {'required': True, 'pattern': r'^[A-Za-z][-A-Za-z0-9_]*$'}, - 'ssh': {'required': True}, + "admin_username": {"required": True, "pattern": r"^[A-Za-z][-A-Za-z0-9_]*$"}, + "ssh": {"required": True}, } _attribute_map = { - 'admin_username': {'key': 'adminUsername', 'type': 'str'}, - 'ssh': {'key': 'ssh', 'type': 'ContainerServiceSshConfiguration'}, + "admin_username": {"key": "adminUsername", "type": "str"}, + "ssh": {"key": "ssh", "type": "ContainerServiceSshConfiguration"}, } - def __init__( - self, - *, - admin_username: str, - ssh: "_models.ContainerServiceSshConfiguration", - **kwargs - ): + def __init__(self, *, admin_username: str, ssh: "_models.ContainerServiceSshConfiguration", **kwargs): """ - :keyword admin_username: Required. The administrator username to use for Linux VMs. + :keyword admin_username: The administrator username to use for Linux VMs. Required. :paramtype admin_username: str - :keyword ssh: Required. The SSH configuration for Linux-based VMs running on Azure. + :keyword ssh: The SSH configuration for Linux-based VMs running on Azure. Required. :paramtype ssh: ~azure.mgmt.containerservice.v2021_10_01.models.ContainerServiceSshConfiguration """ - super(ContainerServiceLinuxProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.admin_username = admin_username self.ssh = ssh -class ContainerServiceMasterProfile(msrest.serialization.Model): +class ContainerServiceMasterProfile(_serialization.Model): """Profile for the container service master. Variables are only populated by the server, and will be ignored when sending a request. @@ -871,11 +840,11 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar count: Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, - and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". + and 5. The default value is 1. Known values are: 1, 3, and 5. :vartype count: int or ~azure.mgmt.containerservice.v2021_10_01.models.Count - :ivar dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. + :ivar dns_prefix: DNS prefix to be used to create the FQDN for the master pool. Required. :vartype dns_prefix: str - :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + :ivar vm_size: Size of agent VMs. Required. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -912,7 +881,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :vartype vm_size: str or ~azure.mgmt.containerservice.v2021_10_01.models.ContainerServiceVMSizeTypes :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine @@ -926,7 +895,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): :vartype first_consecutive_static_ip: str :ivar storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount" and "ManagedDisks". :vartype storage_profile: str or ~azure.mgmt.containerservice.v2021_10_01.models.ContainerServiceStorageProfileTypes :ivar fqdn: FQDN for the master pool. @@ -934,21 +903,21 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): """ _validation = { - 'dns_prefix': {'required': True}, - 'vm_size': {'required': True}, - 'os_disk_size_gb': {'maximum': 2048, 'minimum': 0}, - 'fqdn': {'readonly': True}, + "dns_prefix": {"required": True}, + "vm_size": {"required": True}, + "os_disk_size_gb": {"maximum": 2048, "minimum": 0}, + "fqdn": {"readonly": True}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'dns_prefix': {'key': 'dnsPrefix', 'type': 'str'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'first_consecutive_static_ip': {'key': 'firstConsecutiveStaticIP', 'type': 'str'}, - 'storage_profile': {'key': 'storageProfile', 'type': 'str'}, - 'fqdn': {'key': 'fqdn', 'type': 'str'}, + "count": {"key": "count", "type": "int"}, + "dns_prefix": {"key": "dnsPrefix", "type": "str"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "first_consecutive_static_ip": {"key": "firstConsecutiveStaticIP", "type": "str"}, + "storage_profile": {"key": "storageProfile", "type": "str"}, + "fqdn": {"key": "fqdn", "type": "str"}, } def __init__( @@ -956,20 +925,20 @@ def __init__( *, dns_prefix: str, vm_size: Union[str, "_models.ContainerServiceVMSizeTypes"], - count: Optional[Union[int, "_models.Count"]] = 1, + count: Union[int, "_models.Count"] = 1, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, - first_consecutive_static_ip: Optional[str] = "10.240.255.5", + first_consecutive_static_ip: str = "10.240.255.5", storage_profile: Optional[Union[str, "_models.ContainerServiceStorageProfileTypes"]] = None, **kwargs ): """ :keyword count: Number of masters (VMs) in the container service cluster. Allowed values are 1, - 3, and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". + 3, and 5. The default value is 1. Known values are: 1, 3, and 5. :paramtype count: int or ~azure.mgmt.containerservice.v2021_10_01.models.Count - :keyword dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. + :keyword dns_prefix: DNS prefix to be used to create the FQDN for the master pool. Required. :paramtype dns_prefix: str - :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + :keyword vm_size: Size of agent VMs. Required. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -1006,7 +975,7 @@ def __init__( "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :paramtype vm_size: str or ~azure.mgmt.containerservice.v2021_10_01.models.ContainerServiceVMSizeTypes :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every @@ -1020,11 +989,11 @@ def __init__( :paramtype first_consecutive_static_ip: str :keyword storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount" and "ManagedDisks". :paramtype storage_profile: str or ~azure.mgmt.containerservice.v2021_10_01.models.ContainerServiceStorageProfileTypes """ - super(ContainerServiceMasterProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.dns_prefix = dns_prefix self.vm_size = vm_size @@ -1035,17 +1004,17 @@ def __init__( self.fqdn = None -class ContainerServiceNetworkProfile(msrest.serialization.Model): +class ContainerServiceNetworkProfile(_serialization.Model): # pylint: disable=too-many-instance-attributes """Profile of network configuration. :ivar network_plugin: Network plugin used for building the Kubernetes network. Known values - are: "azure", "kubenet". Default value: "kubenet". + are: "azure" and "kubenet". :vartype network_plugin: str or ~azure.mgmt.containerservice.v2021_10_01.models.NetworkPlugin :ivar network_policy: Network policy used for building the Kubernetes network. Known values - are: "calico", "azure". + are: "calico" and "azure". :vartype network_policy: str or ~azure.mgmt.containerservice.v2021_10_01.models.NetworkPolicy :ivar network_mode: This cannot be specified if networkPlugin is anything other than 'azure'. - Known values are: "transparent", "bridge". + Known values are: "transparent" and "bridge". :vartype network_mode: str or ~azure.mgmt.containerservice.v2021_10_01.models.NetworkMode :ivar pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :vartype pod_cidr: str @@ -1061,12 +1030,11 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): :ivar outbound_type: This can only be set at cluster creation time and cannot be changed later. For more information see `egress outbound type `_. Known values are: "loadBalancer", - "userDefinedRouting", "managedNATGateway", "userAssignedNATGateway". Default value: - "loadBalancer". + "userDefinedRouting", "managedNATGateway", and "userAssignedNATGateway". :vartype outbound_type: str or ~azure.mgmt.containerservice.v2021_10_01.models.OutboundType :ivar load_balancer_sku: The default is 'standard'. See `Azure Load Balancer SKUs `_ for more information about the - differences between load balancer SKUs. Known values are: "standard", "basic". + differences between load balancer SKUs. Known values are: "standard" and "basic". :vartype load_balancer_sku: str or ~azure.mgmt.containerservice.v2021_10_01.models.LoadBalancerSku :ivar load_balancer_profile: Profile of the cluster load balancer. @@ -1089,40 +1057,42 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): """ _validation = { - 'pod_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, - 'service_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, - 'dns_service_ip': {'pattern': r'^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$'}, - 'docker_bridge_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, + "pod_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, + "service_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, + "dns_service_ip": { + "pattern": r"^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$" + }, + "docker_bridge_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, } _attribute_map = { - 'network_plugin': {'key': 'networkPlugin', 'type': 'str'}, - 'network_policy': {'key': 'networkPolicy', 'type': 'str'}, - 'network_mode': {'key': 'networkMode', 'type': 'str'}, - 'pod_cidr': {'key': 'podCidr', 'type': 'str'}, - 'service_cidr': {'key': 'serviceCidr', 'type': 'str'}, - 'dns_service_ip': {'key': 'dnsServiceIP', 'type': 'str'}, - 'docker_bridge_cidr': {'key': 'dockerBridgeCidr', 'type': 'str'}, - 'outbound_type': {'key': 'outboundType', 'type': 'str'}, - 'load_balancer_sku': {'key': 'loadBalancerSku', 'type': 'str'}, - 'load_balancer_profile': {'key': 'loadBalancerProfile', 'type': 'ManagedClusterLoadBalancerProfile'}, - 'nat_gateway_profile': {'key': 'natGatewayProfile', 'type': 'ManagedClusterNATGatewayProfile'}, - 'pod_cidrs': {'key': 'podCidrs', 'type': '[str]'}, - 'service_cidrs': {'key': 'serviceCidrs', 'type': '[str]'}, - 'ip_families': {'key': 'ipFamilies', 'type': '[str]'}, + "network_plugin": {"key": "networkPlugin", "type": "str"}, + "network_policy": {"key": "networkPolicy", "type": "str"}, + "network_mode": {"key": "networkMode", "type": "str"}, + "pod_cidr": {"key": "podCidr", "type": "str"}, + "service_cidr": {"key": "serviceCidr", "type": "str"}, + "dns_service_ip": {"key": "dnsServiceIP", "type": "str"}, + "docker_bridge_cidr": {"key": "dockerBridgeCidr", "type": "str"}, + "outbound_type": {"key": "outboundType", "type": "str"}, + "load_balancer_sku": {"key": "loadBalancerSku", "type": "str"}, + "load_balancer_profile": {"key": "loadBalancerProfile", "type": "ManagedClusterLoadBalancerProfile"}, + "nat_gateway_profile": {"key": "natGatewayProfile", "type": "ManagedClusterNATGatewayProfile"}, + "pod_cidrs": {"key": "podCidrs", "type": "[str]"}, + "service_cidrs": {"key": "serviceCidrs", "type": "[str]"}, + "ip_families": {"key": "ipFamilies", "type": "[str]"}, } def __init__( self, *, - network_plugin: Optional[Union[str, "_models.NetworkPlugin"]] = "kubenet", + network_plugin: Union[str, "_models.NetworkPlugin"] = "kubenet", network_policy: Optional[Union[str, "_models.NetworkPolicy"]] = None, network_mode: Optional[Union[str, "_models.NetworkMode"]] = None, - pod_cidr: Optional[str] = "10.244.0.0/16", - service_cidr: Optional[str] = "10.0.0.0/16", - dns_service_ip: Optional[str] = "10.0.0.10", - docker_bridge_cidr: Optional[str] = "172.17.0.1/16", - outbound_type: Optional[Union[str, "_models.OutboundType"]] = "loadBalancer", + pod_cidr: str = "10.244.0.0/16", + service_cidr: str = "10.0.0.0/16", + dns_service_ip: str = "10.0.0.10", + docker_bridge_cidr: str = "172.17.0.1/16", + outbound_type: Union[str, "_models.OutboundType"] = "loadBalancer", load_balancer_sku: Optional[Union[str, "_models.LoadBalancerSku"]] = None, load_balancer_profile: Optional["_models.ManagedClusterLoadBalancerProfile"] = None, nat_gateway_profile: Optional["_models.ManagedClusterNATGatewayProfile"] = None, @@ -1133,13 +1103,13 @@ def __init__( ): """ :keyword network_plugin: Network plugin used for building the Kubernetes network. Known values - are: "azure", "kubenet". Default value: "kubenet". + are: "azure" and "kubenet". :paramtype network_plugin: str or ~azure.mgmt.containerservice.v2021_10_01.models.NetworkPlugin :keyword network_policy: Network policy used for building the Kubernetes network. Known values - are: "calico", "azure". + are: "calico" and "azure". :paramtype network_policy: str or ~azure.mgmt.containerservice.v2021_10_01.models.NetworkPolicy :keyword network_mode: This cannot be specified if networkPlugin is anything other than - 'azure'. Known values are: "transparent", "bridge". + 'azure'. Known values are: "transparent" and "bridge". :paramtype network_mode: str or ~azure.mgmt.containerservice.v2021_10_01.models.NetworkMode :keyword pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :paramtype pod_cidr: str @@ -1155,12 +1125,11 @@ def __init__( :keyword outbound_type: This can only be set at cluster creation time and cannot be changed later. For more information see `egress outbound type `_. Known values are: "loadBalancer", - "userDefinedRouting", "managedNATGateway", "userAssignedNATGateway". Default value: - "loadBalancer". + "userDefinedRouting", "managedNATGateway", and "userAssignedNATGateway". :paramtype outbound_type: str or ~azure.mgmt.containerservice.v2021_10_01.models.OutboundType :keyword load_balancer_sku: The default is 'standard'. See `Azure Load Balancer SKUs `_ for more information about the - differences between load balancer SKUs. Known values are: "standard", "basic". + differences between load balancer SKUs. Known values are: "standard" and "basic". :paramtype load_balancer_sku: str or ~azure.mgmt.containerservice.v2021_10_01.models.LoadBalancerSku :keyword load_balancer_profile: Profile of the cluster load balancer. @@ -1181,7 +1150,7 @@ def __init__( IPv6. :paramtype ip_families: list[str or ~azure.mgmt.containerservice.v2021_10_01.models.IpFamily] """ - super(ContainerServiceNetworkProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.network_plugin = network_plugin self.network_policy = network_policy self.network_mode = network_mode @@ -1198,113 +1167,98 @@ def __init__( self.ip_families = ip_families -class ContainerServiceSshConfiguration(msrest.serialization.Model): +class ContainerServiceSshConfiguration(_serialization.Model): """SSH configuration for Linux-based VMs running on Azure. All required parameters must be populated in order to send to Azure. - :ivar public_keys: Required. The list of SSH public keys used to authenticate with Linux-based - VMs. A maximum of 1 key may be specified. + :ivar public_keys: The list of SSH public keys used to authenticate with Linux-based VMs. A + maximum of 1 key may be specified. Required. :vartype public_keys: list[~azure.mgmt.containerservice.v2021_10_01.models.ContainerServiceSshPublicKey] """ _validation = { - 'public_keys': {'required': True}, + "public_keys": {"required": True}, } _attribute_map = { - 'public_keys': {'key': 'publicKeys', 'type': '[ContainerServiceSshPublicKey]'}, + "public_keys": {"key": "publicKeys", "type": "[ContainerServiceSshPublicKey]"}, } - def __init__( - self, - *, - public_keys: List["_models.ContainerServiceSshPublicKey"], - **kwargs - ): + def __init__(self, *, public_keys: List["_models.ContainerServiceSshPublicKey"], **kwargs): """ - :keyword public_keys: Required. The list of SSH public keys used to authenticate with - Linux-based VMs. A maximum of 1 key may be specified. + :keyword public_keys: The list of SSH public keys used to authenticate with Linux-based VMs. A + maximum of 1 key may be specified. Required. :paramtype public_keys: list[~azure.mgmt.containerservice.v2021_10_01.models.ContainerServiceSshPublicKey] """ - super(ContainerServiceSshConfiguration, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_keys = public_keys -class ContainerServiceSshPublicKey(msrest.serialization.Model): +class ContainerServiceSshPublicKey(_serialization.Model): """Contains information about SSH certificate public key data. All required parameters must be populated in order to send to Azure. - :ivar key_data: Required. Certificate public key used to authenticate with VMs through SSH. The - certificate must be in PEM format with or without headers. + :ivar key_data: Certificate public key used to authenticate with VMs through SSH. The + certificate must be in PEM format with or without headers. Required. :vartype key_data: str """ _validation = { - 'key_data': {'required': True}, + "key_data": {"required": True}, } _attribute_map = { - 'key_data': {'key': 'keyData', 'type': 'str'}, + "key_data": {"key": "keyData", "type": "str"}, } - def __init__( - self, - *, - key_data: str, - **kwargs - ): + def __init__(self, *, key_data: str, **kwargs): """ - :keyword key_data: Required. Certificate public key used to authenticate with VMs through SSH. - The certificate must be in PEM format with or without headers. + :keyword key_data: Certificate public key used to authenticate with VMs through SSH. The + certificate must be in PEM format with or without headers. Required. :paramtype key_data: str """ - super(ContainerServiceSshPublicKey, self).__init__(**kwargs) + super().__init__(**kwargs) self.key_data = key_data -class ContainerServiceVMDiagnostics(msrest.serialization.Model): +class ContainerServiceVMDiagnostics(_serialization.Model): """Profile for diagnostics on the container service VMs. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar enabled: Required. Whether the VM diagnostic agent is provisioned on the VM. + :ivar enabled: Whether the VM diagnostic agent is provisioned on the VM. Required. :vartype enabled: bool :ivar storage_uri: The URI of the storage account where diagnostics are stored. :vartype storage_uri: str """ _validation = { - 'enabled': {'required': True}, - 'storage_uri': {'readonly': True}, + "enabled": {"required": True}, + "storage_uri": {"readonly": True}, } _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'storage_uri': {'key': 'storageUri', 'type': 'str'}, + "enabled": {"key": "enabled", "type": "bool"}, + "storage_uri": {"key": "storageUri", "type": "str"}, } - def __init__( - self, - *, - enabled: bool, - **kwargs - ): + def __init__(self, *, enabled: bool, **kwargs): """ - :keyword enabled: Required. Whether the VM diagnostic agent is provisioned on the VM. + :keyword enabled: Whether the VM diagnostic agent is provisioned on the VM. Required. :paramtype enabled: bool """ - super(ContainerServiceVMDiagnostics, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.storage_uri = None -class CreationData(msrest.serialization.Model): +class CreationData(_serialization.Model): """Data used when creating a target resource from a source resource. :ivar source_resource_id: This is the ARM ID of the source object to be used to create the @@ -1313,25 +1267,20 @@ class CreationData(msrest.serialization.Model): """ _attribute_map = { - 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, + "source_resource_id": {"key": "sourceResourceId", "type": "str"}, } - def __init__( - self, - *, - source_resource_id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, source_resource_id: Optional[str] = None, **kwargs): """ :keyword source_resource_id: This is the ARM ID of the source object to be used to create the target object. :paramtype source_resource_id: str """ - super(CreationData, self).__init__(**kwargs) + super().__init__(**kwargs) self.source_resource_id = source_resource_id -class CredentialResult(msrest.serialization.Model): +class CredentialResult(_serialization.Model): """The credential result response. Variables are only populated by the server, and will be ignored when sending a request. @@ -1339,31 +1288,27 @@ class CredentialResult(msrest.serialization.Model): :ivar name: The name of the credential. :vartype name: str :ivar value: Base64-encoded Kubernetes configuration file. - :vartype value: bytearray + :vartype value: bytes """ _validation = { - 'name': {'readonly': True}, - 'value': {'readonly': True}, + "name": {"readonly": True}, + "value": {"readonly": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'bytearray'}, + "name": {"key": "name", "type": "str"}, + "value": {"key": "value", "type": "bytearray"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(CredentialResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.name = None self.value = None -class CredentialResults(msrest.serialization.Model): +class CredentialResults(_serialization.Model): """The list credential result response. Variables are only populated by the server, and will be ignored when sending a request. @@ -1373,24 +1318,20 @@ class CredentialResults(msrest.serialization.Model): """ _validation = { - 'kubeconfigs': {'readonly': True}, + "kubeconfigs": {"readonly": True}, } _attribute_map = { - 'kubeconfigs': {'key': 'kubeconfigs', 'type': '[CredentialResult]'}, + "kubeconfigs": {"key": "kubeconfigs", "type": "[CredentialResult]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(CredentialResults, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.kubeconfigs = None -class EndpointDependency(msrest.serialization.Model): +class EndpointDependency(_serialization.Model): """A domain name that AKS agent nodes are reaching at. :ivar domain_name: The domain name of the dependency. @@ -1400,8 +1341,8 @@ class EndpointDependency(msrest.serialization.Model): """ _attribute_map = { - 'domain_name': {'key': 'domainName', 'type': 'str'}, - 'endpoint_details': {'key': 'endpointDetails', 'type': '[EndpointDetail]'}, + "domain_name": {"key": "domainName", "type": "str"}, + "endpoint_details": {"key": "endpointDetails", "type": "[EndpointDetail]"}, } def __init__( @@ -1418,12 +1359,12 @@ def __init__( :paramtype endpoint_details: list[~azure.mgmt.containerservice.v2021_10_01.models.EndpointDetail] """ - super(EndpointDependency, self).__init__(**kwargs) + super().__init__(**kwargs) self.domain_name = domain_name self.endpoint_details = endpoint_details -class EndpointDetail(msrest.serialization.Model): +class EndpointDetail(_serialization.Model): """connect information from the AKS agent nodes to a single endpoint. :ivar ip_address: An IP Address that Domain Name currently resolves to. @@ -1437,10 +1378,10 @@ class EndpointDetail(msrest.serialization.Model): """ _attribute_map = { - 'ip_address': {'key': 'ipAddress', 'type': 'str'}, - 'port': {'key': 'port', 'type': 'int'}, - 'protocol': {'key': 'protocol', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, + "ip_address": {"key": "ipAddress", "type": "str"}, + "port": {"key": "port", "type": "int"}, + "protocol": {"key": "protocol", "type": "str"}, + "description": {"key": "description", "type": "str"}, } def __init__( @@ -1462,25 +1403,25 @@ def __init__( :keyword description: Description of the detail. :paramtype description: str """ - super(EndpointDetail, self).__init__(**kwargs) + super().__init__(**kwargs) self.ip_address = ip_address self.port = port self.protocol = protocol self.description = description -class ExtendedLocation(msrest.serialization.Model): +class ExtendedLocation(_serialization.Model): """The complex type of the extended location. :ivar name: The name of the extended location. :vartype name: str - :ivar type: The type of the extended location. Known values are: "EdgeZone". + :ivar type: The type of the extended location. "EdgeZone" :vartype type: str or ~azure.mgmt.containerservice.v2021_10_01.models.ExtendedLocationTypes """ _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, } def __init__( @@ -1493,15 +1434,15 @@ def __init__( """ :keyword name: The name of the extended location. :paramtype name: str - :keyword type: The type of the extended location. Known values are: "EdgeZone". + :keyword type: The type of the extended location. "EdgeZone" :paramtype type: str or ~azure.mgmt.containerservice.v2021_10_01.models.ExtendedLocationTypes """ - super(ExtendedLocation, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.type = type -class KubeletConfig(msrest.serialization.Model): +class KubeletConfig(_serialization.Model): # pylint: disable=too-many-instance-attributes """See `AKS custom node configuration `_ for more details. :ivar cpu_manager_policy: The default is 'none'. See `Kubernetes CPU management policies @@ -1541,21 +1482,21 @@ class KubeletConfig(msrest.serialization.Model): """ _validation = { - 'container_log_max_files': {'minimum': 2}, + "container_log_max_files": {"minimum": 2}, } _attribute_map = { - 'cpu_manager_policy': {'key': 'cpuManagerPolicy', 'type': 'str'}, - 'cpu_cfs_quota': {'key': 'cpuCfsQuota', 'type': 'bool'}, - 'cpu_cfs_quota_period': {'key': 'cpuCfsQuotaPeriod', 'type': 'str'}, - 'image_gc_high_threshold': {'key': 'imageGcHighThreshold', 'type': 'int'}, - 'image_gc_low_threshold': {'key': 'imageGcLowThreshold', 'type': 'int'}, - 'topology_manager_policy': {'key': 'topologyManagerPolicy', 'type': 'str'}, - 'allowed_unsafe_sysctls': {'key': 'allowedUnsafeSysctls', 'type': '[str]'}, - 'fail_swap_on': {'key': 'failSwapOn', 'type': 'bool'}, - 'container_log_max_size_mb': {'key': 'containerLogMaxSizeMB', 'type': 'int'}, - 'container_log_max_files': {'key': 'containerLogMaxFiles', 'type': 'int'}, - 'pod_max_pids': {'key': 'podMaxPids', 'type': 'int'}, + "cpu_manager_policy": {"key": "cpuManagerPolicy", "type": "str"}, + "cpu_cfs_quota": {"key": "cpuCfsQuota", "type": "bool"}, + "cpu_cfs_quota_period": {"key": "cpuCfsQuotaPeriod", "type": "str"}, + "image_gc_high_threshold": {"key": "imageGcHighThreshold", "type": "int"}, + "image_gc_low_threshold": {"key": "imageGcLowThreshold", "type": "int"}, + "topology_manager_policy": {"key": "topologyManagerPolicy", "type": "str"}, + "allowed_unsafe_sysctls": {"key": "allowedUnsafeSysctls", "type": "[str]"}, + "fail_swap_on": {"key": "failSwapOn", "type": "bool"}, + "container_log_max_size_mb": {"key": "containerLogMaxSizeMB", "type": "int"}, + "container_log_max_files": {"key": "containerLogMaxFiles", "type": "int"}, + "pod_max_pids": {"key": "podMaxPids", "type": "int"}, } def __init__( @@ -1610,7 +1551,7 @@ def __init__( :keyword pod_max_pids: The maximum number of processes per pod. :paramtype pod_max_pids: int """ - super(KubeletConfig, self).__init__(**kwargs) + super().__init__(**kwargs) self.cpu_manager_policy = cpu_manager_policy self.cpu_cfs_quota = cpu_cfs_quota self.cpu_cfs_quota_period = cpu_cfs_quota_period @@ -1624,7 +1565,7 @@ def __init__( self.pod_max_pids = pod_max_pids -class LinuxOSConfig(msrest.serialization.Model): +class LinuxOSConfig(_serialization.Model): """See `AKS custom node configuration `_ for more details. :ivar sysctls: Sysctl settings for Linux agent nodes. @@ -1643,10 +1584,10 @@ class LinuxOSConfig(msrest.serialization.Model): """ _attribute_map = { - 'sysctls': {'key': 'sysctls', 'type': 'SysctlConfig'}, - 'transparent_huge_page_enabled': {'key': 'transparentHugePageEnabled', 'type': 'str'}, - 'transparent_huge_page_defrag': {'key': 'transparentHugePageDefrag', 'type': 'str'}, - 'swap_file_size_mb': {'key': 'swapFileSizeMB', 'type': 'int'}, + "sysctls": {"key": "sysctls", "type": "SysctlConfig"}, + "transparent_huge_page_enabled": {"key": "transparentHugePageEnabled", "type": "str"}, + "transparent_huge_page_defrag": {"key": "transparentHugePageDefrag", "type": "str"}, + "swap_file_size_mb": {"key": "swapFileSizeMB", "type": "int"}, } def __init__( @@ -1673,7 +1614,7 @@ def __init__( :keyword swap_file_size_mb: The size in MB of a swap file that will be created on each node. :paramtype swap_file_size_mb: int """ - super(LinuxOSConfig, self).__init__(**kwargs) + super().__init__(**kwargs) self.sysctls = sysctls self.transparent_huge_page_enabled = transparent_huge_page_enabled self.transparent_huge_page_defrag = transparent_huge_page_defrag @@ -1702,19 +1643,19 @@ class MaintenanceConfiguration(SubResource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, + "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'}, - 'time_in_week': {'key': 'properties.timeInWeek', 'type': '[TimeInWeek]'}, - 'not_allowed_time': {'key': 'properties.notAllowedTime', 'type': '[TimeSpan]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "time_in_week": {"key": "properties.timeInWeek", "type": "[TimeInWeek]"}, + "not_allowed_time": {"key": "properties.notAllowedTime", "type": "[TimeSpan]"}, } def __init__( @@ -1731,13 +1672,13 @@ def __init__( :keyword not_allowed_time: Time slots on which upgrade is not allowed. :paramtype not_allowed_time: list[~azure.mgmt.containerservice.v2021_10_01.models.TimeSpan] """ - super(MaintenanceConfiguration, self).__init__(**kwargs) + super().__init__(**kwargs) self.system_data = None self.time_in_week = time_in_week self.not_allowed_time = not_allowed_time -class MaintenanceConfigurationListResult(msrest.serialization.Model): +class MaintenanceConfigurationListResult(_serialization.Model): """The response from the List maintenance configurations operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -1749,31 +1690,26 @@ class MaintenanceConfigurationListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[MaintenanceConfiguration]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[MaintenanceConfiguration]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.MaintenanceConfiguration"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.MaintenanceConfiguration"]] = None, **kwargs): """ :keyword value: The list of maintenance configurations. :paramtype value: list[~azure.mgmt.containerservice.v2021_10_01.models.MaintenanceConfiguration] """ - super(MaintenanceConfigurationListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class Resource(msrest.serialization.Model): +class Resource(_serialization.Model): """The Resource model definition. Variables are only populated by the server, and will be ignored when sending a request. @@ -1786,41 +1722,35 @@ class Resource(msrest.serialization.Model): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] """ - super(Resource, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -1828,7 +1758,7 @@ def __init__( self.tags = tags -class ManagedCluster(Resource): +class ManagedCluster(Resource): # pylint: disable=too-many-instance-attributes """Managed cluster. Variables are only populated by the server, and will be ignored when sending a request. @@ -1841,9 +1771,9 @@ class ManagedCluster(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar sku: The managed cluster SKU. :vartype sku: ~azure.mgmt.containerservice.v2021_10_01.models.ManagedClusterSKU @@ -1939,66 +1869,75 @@ class ManagedCluster(Resource): :vartype security_profile: ~azure.mgmt.containerservice.v2021_10_01.models.ManagedClusterSecurityProfile :ivar public_network_access: Allow or deny public network access for AKS. Known values are: - "Enabled", "Disabled". + "Enabled" and "Disabled". :vartype public_network_access: str or ~azure.mgmt.containerservice.v2021_10_01.models.PublicNetworkAccess """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'provisioning_state': {'readonly': True}, - 'power_state': {'readonly': True}, - 'max_agent_pools': {'readonly': True}, - 'fqdn': {'readonly': True}, - 'private_fqdn': {'readonly': True}, - 'azure_portal_fqdn': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, + "provisioning_state": {"readonly": True}, + "power_state": {"readonly": True}, + "max_agent_pools": {"readonly": True}, + "fqdn": {"readonly": True}, + "private_fqdn": {"readonly": True}, + "azure_portal_fqdn": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'ManagedClusterSKU'}, - 'extended_location': {'key': 'extendedLocation', 'type': 'ExtendedLocation'}, - 'identity': {'key': 'identity', 'type': 'ManagedClusterIdentity'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'power_state': {'key': 'properties.powerState', 'type': 'PowerState'}, - 'max_agent_pools': {'key': 'properties.maxAgentPools', 'type': 'int'}, - 'kubernetes_version': {'key': 'properties.kubernetesVersion', 'type': 'str'}, - 'dns_prefix': {'key': 'properties.dnsPrefix', 'type': 'str'}, - 'fqdn_subdomain': {'key': 'properties.fqdnSubdomain', 'type': 'str'}, - 'fqdn': {'key': 'properties.fqdn', 'type': 'str'}, - 'private_fqdn': {'key': 'properties.privateFQDN', 'type': 'str'}, - 'azure_portal_fqdn': {'key': 'properties.azurePortalFQDN', 'type': 'str'}, - 'agent_pool_profiles': {'key': 'properties.agentPoolProfiles', 'type': '[ManagedClusterAgentPoolProfile]'}, - 'linux_profile': {'key': 'properties.linuxProfile', 'type': 'ContainerServiceLinuxProfile'}, - 'windows_profile': {'key': 'properties.windowsProfile', 'type': 'ManagedClusterWindowsProfile'}, - 'service_principal_profile': {'key': 'properties.servicePrincipalProfile', 'type': 'ManagedClusterServicePrincipalProfile'}, - 'addon_profiles': {'key': 'properties.addonProfiles', 'type': '{ManagedClusterAddonProfile}'}, - 'pod_identity_profile': {'key': 'properties.podIdentityProfile', 'type': 'ManagedClusterPodIdentityProfile'}, - 'node_resource_group': {'key': 'properties.nodeResourceGroup', 'type': 'str'}, - 'enable_rbac': {'key': 'properties.enableRBAC', 'type': 'bool'}, - 'enable_pod_security_policy': {'key': 'properties.enablePodSecurityPolicy', 'type': 'bool'}, - 'network_profile': {'key': 'properties.networkProfile', 'type': 'ContainerServiceNetworkProfile'}, - 'aad_profile': {'key': 'properties.aadProfile', 'type': 'ManagedClusterAADProfile'}, - 'auto_upgrade_profile': {'key': 'properties.autoUpgradeProfile', 'type': 'ManagedClusterAutoUpgradeProfile'}, - 'auto_scaler_profile': {'key': 'properties.autoScalerProfile', 'type': 'ManagedClusterPropertiesAutoScalerProfile'}, - 'api_server_access_profile': {'key': 'properties.apiServerAccessProfile', 'type': 'ManagedClusterAPIServerAccessProfile'}, - 'disk_encryption_set_id': {'key': 'properties.diskEncryptionSetID', 'type': 'str'}, - 'identity_profile': {'key': 'properties.identityProfile', 'type': '{UserAssignedIdentity}'}, - 'private_link_resources': {'key': 'properties.privateLinkResources', 'type': '[PrivateLinkResource]'}, - 'disable_local_accounts': {'key': 'properties.disableLocalAccounts', 'type': 'bool'}, - 'http_proxy_config': {'key': 'properties.httpProxyConfig', 'type': 'ManagedClusterHTTPProxyConfig'}, - 'security_profile': {'key': 'properties.securityProfile', 'type': 'ManagedClusterSecurityProfile'}, - 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, - } - - def __init__( + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "sku": {"key": "sku", "type": "ManagedClusterSKU"}, + "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, + "identity": {"key": "identity", "type": "ManagedClusterIdentity"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "power_state": {"key": "properties.powerState", "type": "PowerState"}, + "max_agent_pools": {"key": "properties.maxAgentPools", "type": "int"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "dns_prefix": {"key": "properties.dnsPrefix", "type": "str"}, + "fqdn_subdomain": {"key": "properties.fqdnSubdomain", "type": "str"}, + "fqdn": {"key": "properties.fqdn", "type": "str"}, + "private_fqdn": {"key": "properties.privateFQDN", "type": "str"}, + "azure_portal_fqdn": {"key": "properties.azurePortalFQDN", "type": "str"}, + "agent_pool_profiles": {"key": "properties.agentPoolProfiles", "type": "[ManagedClusterAgentPoolProfile]"}, + "linux_profile": {"key": "properties.linuxProfile", "type": "ContainerServiceLinuxProfile"}, + "windows_profile": {"key": "properties.windowsProfile", "type": "ManagedClusterWindowsProfile"}, + "service_principal_profile": { + "key": "properties.servicePrincipalProfile", + "type": "ManagedClusterServicePrincipalProfile", + }, + "addon_profiles": {"key": "properties.addonProfiles", "type": "{ManagedClusterAddonProfile}"}, + "pod_identity_profile": {"key": "properties.podIdentityProfile", "type": "ManagedClusterPodIdentityProfile"}, + "node_resource_group": {"key": "properties.nodeResourceGroup", "type": "str"}, + "enable_rbac": {"key": "properties.enableRBAC", "type": "bool"}, + "enable_pod_security_policy": {"key": "properties.enablePodSecurityPolicy", "type": "bool"}, + "network_profile": {"key": "properties.networkProfile", "type": "ContainerServiceNetworkProfile"}, + "aad_profile": {"key": "properties.aadProfile", "type": "ManagedClusterAADProfile"}, + "auto_upgrade_profile": {"key": "properties.autoUpgradeProfile", "type": "ManagedClusterAutoUpgradeProfile"}, + "auto_scaler_profile": { + "key": "properties.autoScalerProfile", + "type": "ManagedClusterPropertiesAutoScalerProfile", + }, + "api_server_access_profile": { + "key": "properties.apiServerAccessProfile", + "type": "ManagedClusterAPIServerAccessProfile", + }, + "disk_encryption_set_id": {"key": "properties.diskEncryptionSetID", "type": "str"}, + "identity_profile": {"key": "properties.identityProfile", "type": "{UserAssignedIdentity}"}, + "private_link_resources": {"key": "properties.privateLinkResources", "type": "[PrivateLinkResource]"}, + "disable_local_accounts": {"key": "properties.disableLocalAccounts", "type": "bool"}, + "http_proxy_config": {"key": "properties.httpProxyConfig", "type": "ManagedClusterHTTPProxyConfig"}, + "security_profile": {"key": "properties.securityProfile", "type": "ManagedClusterSecurityProfile"}, + "public_network_access": {"key": "properties.publicNetworkAccess", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, location: str, @@ -2033,9 +1972,9 @@ def __init__( **kwargs ): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword sku: The managed cluster SKU. :paramtype sku: ~azure.mgmt.containerservice.v2021_10_01.models.ManagedClusterSKU @@ -2119,11 +2058,11 @@ def __init__( :paramtype security_profile: ~azure.mgmt.containerservice.v2021_10_01.models.ManagedClusterSecurityProfile :keyword public_network_access: Allow or deny public network access for AKS. Known values are: - "Enabled", "Disabled". + "Enabled" and "Disabled". :paramtype public_network_access: str or ~azure.mgmt.containerservice.v2021_10_01.models.PublicNetworkAccess """ - super(ManagedCluster, self).__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.sku = sku self.extended_location = extended_location self.identity = identity @@ -2159,7 +2098,7 @@ def __init__( self.public_network_access = public_network_access -class ManagedClusterAADProfile(msrest.serialization.Model): +class ManagedClusterAADProfile(_serialization.Model): """For more details see `managed AAD on AKS `_. :ivar managed: Whether to enable managed AAD. @@ -2181,13 +2120,13 @@ class ManagedClusterAADProfile(msrest.serialization.Model): """ _attribute_map = { - 'managed': {'key': 'managed', 'type': 'bool'}, - 'enable_azure_rbac': {'key': 'enableAzureRBAC', 'type': 'bool'}, - 'admin_group_object_i_ds': {'key': 'adminGroupObjectIDs', 'type': '[str]'}, - 'client_app_id': {'key': 'clientAppID', 'type': 'str'}, - 'server_app_id': {'key': 'serverAppID', 'type': 'str'}, - 'server_app_secret': {'key': 'serverAppSecret', 'type': 'str'}, - 'tenant_id': {'key': 'tenantID', 'type': 'str'}, + "managed": {"key": "managed", "type": "bool"}, + "enable_azure_rbac": {"key": "enableAzureRBAC", "type": "bool"}, + "admin_group_object_i_ds": {"key": "adminGroupObjectIDs", "type": "[str]"}, + "client_app_id": {"key": "clientAppID", "type": "str"}, + "server_app_id": {"key": "serverAppID", "type": "str"}, + "server_app_secret": {"key": "serverAppSecret", "type": "str"}, + "tenant_id": {"key": "tenantID", "type": "str"}, } def __init__( @@ -2220,7 +2159,7 @@ def __init__( tenant of the deployment subscription. :paramtype tenant_id: str """ - super(ManagedClusterAADProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.managed = managed self.enable_azure_rbac = enable_azure_rbac self.admin_group_object_i_ds = admin_group_object_i_ds @@ -2243,58 +2182,53 @@ class ManagedClusterAccessProfile(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar kube_config: Base64-encoded Kubernetes configuration file. - :vartype kube_config: bytearray + :vartype kube_config: bytes """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'kube_config': {'key': 'properties.kubeConfig', 'type': 'bytearray'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "kube_config": {"key": "properties.kubeConfig", "type": "bytearray"}, } def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - kube_config: Optional[bytearray] = None, - **kwargs + self, *, location: str, tags: Optional[Dict[str, str]] = None, kube_config: Optional[bytes] = None, **kwargs ): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword kube_config: Base64-encoded Kubernetes configuration file. - :paramtype kube_config: bytearray + :paramtype kube_config: bytes """ - super(ManagedClusterAccessProfile, self).__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.kube_config = kube_config -class ManagedClusterAddonProfile(msrest.serialization.Model): +class ManagedClusterAddonProfile(_serialization.Model): """A Kubernetes add-on profile for a managed cluster. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar enabled: Required. Whether the add-on is enabled or not. + :ivar enabled: Whether the add-on is enabled or not. Required. :vartype enabled: bool :ivar config: Key-value pairs for configuring an add-on. :vartype config: dict[str, str] @@ -2304,36 +2238,30 @@ class ManagedClusterAddonProfile(msrest.serialization.Model): """ _validation = { - 'enabled': {'required': True}, - 'identity': {'readonly': True}, + "enabled": {"required": True}, + "identity": {"readonly": True}, } _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'config': {'key': 'config', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'ManagedClusterAddonProfileIdentity'}, + "enabled": {"key": "enabled", "type": "bool"}, + "config": {"key": "config", "type": "{str}"}, + "identity": {"key": "identity", "type": "ManagedClusterAddonProfileIdentity"}, } - def __init__( - self, - *, - enabled: bool, - config: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, enabled: bool, config: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword enabled: Required. Whether the add-on is enabled or not. + :keyword enabled: Whether the add-on is enabled or not. Required. :paramtype enabled: bool :keyword config: Key-value pairs for configuring an add-on. :paramtype config: dict[str, str] """ - super(ManagedClusterAddonProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.config = config self.identity = None -class UserAssignedIdentity(msrest.serialization.Model): +class UserAssignedIdentity(_serialization.Model): """Details about a user assigned identity. :ivar resource_id: The resource ID of the user assigned identity. @@ -2345,9 +2273,9 @@ class UserAssignedIdentity(msrest.serialization.Model): """ _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'object_id': {'key': 'objectId', 'type': 'str'}, + "resource_id": {"key": "resourceId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + "object_id": {"key": "objectId", "type": "str"}, } def __init__( @@ -2366,7 +2294,7 @@ def __init__( :keyword object_id: The object ID of the user assigned identity. :paramtype object_id: str """ - super(UserAssignedIdentity, self).__init__(**kwargs) + super().__init__(**kwargs) self.resource_id = resource_id self.client_id = client_id self.object_id = object_id @@ -2384,9 +2312,9 @@ class ManagedClusterAddonProfileIdentity(UserAssignedIdentity): """ _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'object_id': {'key': 'objectId', 'type': 'str'}, + "resource_id": {"key": "resourceId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + "object_id": {"key": "objectId", "type": "str"}, } def __init__( @@ -2405,10 +2333,10 @@ def __init__( :keyword object_id: The object ID of the user assigned identity. :paramtype object_id: str """ - super(ManagedClusterAddonProfileIdentity, self).__init__(resource_id=resource_id, client_id=client_id, object_id=object_id, **kwargs) + super().__init__(resource_id=resource_id, client_id=client_id, object_id=object_id, **kwargs) -class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): +class ManagedClusterAgentPoolProfileProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes """Properties for the container service agent pool profile. Variables are only populated by the server, and will be ignored when sending a request. @@ -2429,14 +2357,14 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2021_10_01.models.OSDiskType :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data - root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2021_10_01.models.KubeletDiskType :ivar workload_runtime: Determines the type of workload a node can run. Known values are: - "OCIContainer", "WasmWasi". + "OCIContainer" and "WasmWasi". :vartype workload_runtime: str or ~azure.mgmt.containerservice.v2021_10_01.models.WorkloadRuntime :ivar vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and used. @@ -2450,11 +2378,11 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :vartype pod_subnet_id: str :ivar max_pods: The maximum number of pods that can run on a node. :vartype max_pods: int - :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2021_10_01.models.OSType :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known - values are: "Ubuntu", "CBLMariner". + values are: "Ubuntu" and "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2021_10_01.models.OSSKU :ivar max_count: The maximum number of nodes for auto-scaling. :vartype max_count: int @@ -2463,14 +2391,14 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it - defaults to Delete. Known values are: "Delete", "Deallocate". + defaults to Delete. Known values are: "Delete" and "Deallocate". :vartype scale_down_mode: str or ~azure.mgmt.containerservice.v2021_10_01.models.ScaleDownMode - :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", + :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets" and "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2021_10_01.models.AgentPoolType :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :vartype mode: str or ~azure.mgmt.containerservice.v2021_10_01.models.AgentPoolMode :ivar orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -2505,20 +2433,18 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default - is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + is 'Regular'. Known values are: "Spot" and "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2021_10_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2021_10_01.models.ScaleSetEvictionPolicy :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :vartype spot_max_price: float - :ivar tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :ivar tags: The tags to be persisted on the agent pool virtual machine scale set. :vartype tags: dict[str, str] :ivar node_labels: The node labels to be persisted across all nodes in agent pool. :vartype node_labels: dict[str, str] @@ -2542,7 +2468,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): for more details. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2021_10_01.models.GPUInstanceProfile :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the node pool @@ -2551,54 +2477,54 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): """ _validation = { - 'os_disk_size_gb': {'maximum': 2048, 'minimum': 0}, - 'node_image_version': {'readonly': True}, - 'provisioning_state': {'readonly': True}, + "os_disk_size_gb": {"maximum": 2048, "minimum": 0}, + "node_image_version": {"readonly": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'os_disk_type': {'key': 'osDiskType', 'type': 'str'}, - 'kubelet_disk_type': {'key': 'kubeletDiskType', 'type': 'str'}, - 'workload_runtime': {'key': 'workloadRuntime', 'type': 'str'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'pod_subnet_id': {'key': 'podSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'maxPods', 'type': 'int'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'os_sku': {'key': 'osSKU', 'type': 'str'}, - 'max_count': {'key': 'maxCount', 'type': 'int'}, - 'min_count': {'key': 'minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'enableAutoScaling', 'type': 'bool'}, - 'scale_down_mode': {'key': 'scaleDownMode', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'mode': {'key': 'mode', 'type': 'str'}, - 'orchestrator_version': {'key': 'orchestratorVersion', 'type': 'str'}, - 'node_image_version': {'key': 'nodeImageVersion', 'type': 'str'}, - 'upgrade_settings': {'key': 'upgradeSettings', 'type': 'AgentPoolUpgradeSettings'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'power_state': {'key': 'powerState', 'type': 'PowerState'}, - 'availability_zones': {'key': 'availabilityZones', 'type': '[str]'}, - 'enable_node_public_ip': {'key': 'enableNodePublicIP', 'type': 'bool'}, - 'node_public_ip_prefix_id': {'key': 'nodePublicIPPrefixID', 'type': 'str'}, - 'scale_set_priority': {'key': 'scaleSetPriority', 'type': 'str'}, - 'scale_set_eviction_policy': {'key': 'scaleSetEvictionPolicy', 'type': 'str'}, - 'spot_max_price': {'key': 'spotMaxPrice', 'type': 'float'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'node_labels': {'key': 'nodeLabels', 'type': '{str}'}, - 'node_taints': {'key': 'nodeTaints', 'type': '[str]'}, - 'proximity_placement_group_id': {'key': 'proximityPlacementGroupID', 'type': 'str'}, - 'kubelet_config': {'key': 'kubeletConfig', 'type': 'KubeletConfig'}, - 'linux_os_config': {'key': 'linuxOSConfig', 'type': 'LinuxOSConfig'}, - 'enable_encryption_at_host': {'key': 'enableEncryptionAtHost', 'type': 'bool'}, - 'enable_ultra_ssd': {'key': 'enableUltraSSD', 'type': 'bool'}, - 'enable_fips': {'key': 'enableFIPS', 'type': 'bool'}, - 'gpu_instance_profile': {'key': 'gpuInstanceProfile', 'type': 'str'}, - 'creation_data': {'key': 'creationData', 'type': 'CreationData'}, - } - - def __init__( + "count": {"key": "count", "type": "int"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "os_disk_type": {"key": "osDiskType", "type": "str"}, + "kubelet_disk_type": {"key": "kubeletDiskType", "type": "str"}, + "workload_runtime": {"key": "workloadRuntime", "type": "str"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "pod_subnet_id": {"key": "podSubnetID", "type": "str"}, + "max_pods": {"key": "maxPods", "type": "int"}, + "os_type": {"key": "osType", "type": "str"}, + "os_sku": {"key": "osSKU", "type": "str"}, + "max_count": {"key": "maxCount", "type": "int"}, + "min_count": {"key": "minCount", "type": "int"}, + "enable_auto_scaling": {"key": "enableAutoScaling", "type": "bool"}, + "scale_down_mode": {"key": "scaleDownMode", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "mode": {"key": "mode", "type": "str"}, + "orchestrator_version": {"key": "orchestratorVersion", "type": "str"}, + "node_image_version": {"key": "nodeImageVersion", "type": "str"}, + "upgrade_settings": {"key": "upgradeSettings", "type": "AgentPoolUpgradeSettings"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "power_state": {"key": "powerState", "type": "PowerState"}, + "availability_zones": {"key": "availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "enableNodePublicIP", "type": "bool"}, + "node_public_ip_prefix_id": {"key": "nodePublicIPPrefixID", "type": "str"}, + "scale_set_priority": {"key": "scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "scaleSetEvictionPolicy", "type": "str"}, + "spot_max_price": {"key": "spotMaxPrice", "type": "float"}, + "tags": {"key": "tags", "type": "{str}"}, + "node_labels": {"key": "nodeLabels", "type": "{str}"}, + "node_taints": {"key": "nodeTaints", "type": "[str]"}, + "proximity_placement_group_id": {"key": "proximityPlacementGroupID", "type": "str"}, + "kubelet_config": {"key": "kubeletConfig", "type": "KubeletConfig"}, + "linux_os_config": {"key": "linuxOSConfig", "type": "LinuxOSConfig"}, + "enable_encryption_at_host": {"key": "enableEncryptionAtHost", "type": "bool"}, + "enable_ultra_ssd": {"key": "enableUltraSSD", "type": "bool"}, + "enable_fips": {"key": "enableFIPS", "type": "bool"}, + "gpu_instance_profile": {"key": "gpuInstanceProfile", "type": "str"}, + "creation_data": {"key": "creationData", "type": "CreationData"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, count: Optional[int] = None, @@ -2610,7 +2536,7 @@ def __init__( vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, @@ -2624,9 +2550,9 @@ def __init__( availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", - spot_max_price: Optional[float] = -1, + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", + spot_max_price: float = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, @@ -2657,14 +2583,14 @@ def __init__( larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2021_10_01.models.OSDiskType :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime - data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + data root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2021_10_01.models.KubeletDiskType :keyword workload_runtime: Determines the type of workload a node can run. Known values are: - "OCIContainer", "WasmWasi". + "OCIContainer" and "WasmWasi". :paramtype workload_runtime: str or ~azure.mgmt.containerservice.v2021_10_01.models.WorkloadRuntime :keyword vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and @@ -2678,11 +2604,11 @@ def __init__( :paramtype pod_subnet_id: str :keyword max_pods: The maximum number of pods that can run on a node. :paramtype max_pods: int - :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2021_10_01.models.OSType :keyword os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Known values are: "Ubuntu", "CBLMariner". + Known values are: "Ubuntu" and "CBLMariner". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2021_10_01.models.OSSKU :keyword max_count: The maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -2691,15 +2617,15 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, - it defaults to Delete. Known values are: "Delete", "Deallocate". + it defaults to Delete. Known values are: "Delete" and "Deallocate". :paramtype scale_down_mode: str or ~azure.mgmt.containerservice.v2021_10_01.models.ScaleDownMode - :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", + :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2021_10_01.models.AgentPoolType :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2021_10_01.models.AgentPoolMode :keyword orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -2730,20 +2656,18 @@ def __init__( /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the - default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + default is 'Regular'. Known values are: "Spot" and "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2021_10_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2021_10_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :paramtype spot_max_price: float - :keyword tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :keyword tags: The tags to be persisted on the agent pool virtual machine scale set. :paramtype tags: dict[str, str] :keyword node_labels: The node labels to be persisted across all nodes in agent pool. :paramtype node_labels: dict[str, str] @@ -2767,7 +2691,7 @@ def __init__( for more details. :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance - profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2021_10_01.models.GPUInstanceProfile @@ -2775,7 +2699,7 @@ def __init__( pool will be created/upgraded using a snapshot. :paramtype creation_data: ~azure.mgmt.containerservice.v2021_10_01.models.CreationData """ - super(ManagedClusterAgentPoolProfileProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.vm_size = vm_size self.os_disk_size_gb = os_disk_size_gb @@ -2817,7 +2741,9 @@ def __init__( self.creation_data = creation_data -class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): +class ManagedClusterAgentPoolProfile( + ManagedClusterAgentPoolProfileProperties +): # pylint: disable=too-many-instance-attributes """Profile for the container service agent pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -2840,14 +2766,14 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2021_10_01.models.OSDiskType :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data - root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2021_10_01.models.KubeletDiskType :ivar workload_runtime: Determines the type of workload a node can run. Known values are: - "OCIContainer", "WasmWasi". + "OCIContainer" and "WasmWasi". :vartype workload_runtime: str or ~azure.mgmt.containerservice.v2021_10_01.models.WorkloadRuntime :ivar vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and used. @@ -2861,11 +2787,11 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :vartype pod_subnet_id: str :ivar max_pods: The maximum number of pods that can run on a node. :vartype max_pods: int - :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2021_10_01.models.OSType :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known - values are: "Ubuntu", "CBLMariner". + values are: "Ubuntu" and "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2021_10_01.models.OSSKU :ivar max_count: The maximum number of nodes for auto-scaling. :vartype max_count: int @@ -2874,14 +2800,14 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it - defaults to Delete. Known values are: "Delete", "Deallocate". + defaults to Delete. Known values are: "Delete" and "Deallocate". :vartype scale_down_mode: str or ~azure.mgmt.containerservice.v2021_10_01.models.ScaleDownMode - :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", + :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets" and "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2021_10_01.models.AgentPoolType :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :vartype mode: str or ~azure.mgmt.containerservice.v2021_10_01.models.AgentPoolMode :ivar orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -2916,20 +2842,18 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default - is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + is 'Regular'. Known values are: "Spot" and "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2021_10_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2021_10_01.models.ScaleSetEvictionPolicy :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :vartype spot_max_price: float - :ivar tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :ivar tags: The tags to be persisted on the agent pool virtual machine scale set. :vartype tags: dict[str, str] :ivar node_labels: The node labels to be persisted across all nodes in agent pool. :vartype node_labels: dict[str, str] @@ -2953,67 +2877,67 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): for more details. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2021_10_01.models.GPUInstanceProfile :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the node pool will be created/upgraded using a snapshot. :vartype creation_data: ~azure.mgmt.containerservice.v2021_10_01.models.CreationData - :ivar name: Required. Windows agent pool names must be 6 characters or less. + :ivar name: Windows agent pool names must be 6 characters or less. Required. :vartype name: str """ _validation = { - 'os_disk_size_gb': {'maximum': 2048, 'minimum': 0}, - 'node_image_version': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'name': {'required': True, 'pattern': r'^[a-z][a-z0-9]{0,11}$'}, + "os_disk_size_gb": {"maximum": 2048, "minimum": 0}, + "node_image_version": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "name": {"required": True, "pattern": r"^[a-z][a-z0-9]{0,11}$"}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'os_disk_type': {'key': 'osDiskType', 'type': 'str'}, - 'kubelet_disk_type': {'key': 'kubeletDiskType', 'type': 'str'}, - 'workload_runtime': {'key': 'workloadRuntime', 'type': 'str'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'pod_subnet_id': {'key': 'podSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'maxPods', 'type': 'int'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'os_sku': {'key': 'osSKU', 'type': 'str'}, - 'max_count': {'key': 'maxCount', 'type': 'int'}, - 'min_count': {'key': 'minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'enableAutoScaling', 'type': 'bool'}, - 'scale_down_mode': {'key': 'scaleDownMode', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'mode': {'key': 'mode', 'type': 'str'}, - 'orchestrator_version': {'key': 'orchestratorVersion', 'type': 'str'}, - 'node_image_version': {'key': 'nodeImageVersion', 'type': 'str'}, - 'upgrade_settings': {'key': 'upgradeSettings', 'type': 'AgentPoolUpgradeSettings'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'power_state': {'key': 'powerState', 'type': 'PowerState'}, - 'availability_zones': {'key': 'availabilityZones', 'type': '[str]'}, - 'enable_node_public_ip': {'key': 'enableNodePublicIP', 'type': 'bool'}, - 'node_public_ip_prefix_id': {'key': 'nodePublicIPPrefixID', 'type': 'str'}, - 'scale_set_priority': {'key': 'scaleSetPriority', 'type': 'str'}, - 'scale_set_eviction_policy': {'key': 'scaleSetEvictionPolicy', 'type': 'str'}, - 'spot_max_price': {'key': 'spotMaxPrice', 'type': 'float'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'node_labels': {'key': 'nodeLabels', 'type': '{str}'}, - 'node_taints': {'key': 'nodeTaints', 'type': '[str]'}, - 'proximity_placement_group_id': {'key': 'proximityPlacementGroupID', 'type': 'str'}, - 'kubelet_config': {'key': 'kubeletConfig', 'type': 'KubeletConfig'}, - 'linux_os_config': {'key': 'linuxOSConfig', 'type': 'LinuxOSConfig'}, - 'enable_encryption_at_host': {'key': 'enableEncryptionAtHost', 'type': 'bool'}, - 'enable_ultra_ssd': {'key': 'enableUltraSSD', 'type': 'bool'}, - 'enable_fips': {'key': 'enableFIPS', 'type': 'bool'}, - 'gpu_instance_profile': {'key': 'gpuInstanceProfile', 'type': 'str'}, - 'creation_data': {'key': 'creationData', 'type': 'CreationData'}, - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( + "count": {"key": "count", "type": "int"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "os_disk_type": {"key": "osDiskType", "type": "str"}, + "kubelet_disk_type": {"key": "kubeletDiskType", "type": "str"}, + "workload_runtime": {"key": "workloadRuntime", "type": "str"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "pod_subnet_id": {"key": "podSubnetID", "type": "str"}, + "max_pods": {"key": "maxPods", "type": "int"}, + "os_type": {"key": "osType", "type": "str"}, + "os_sku": {"key": "osSKU", "type": "str"}, + "max_count": {"key": "maxCount", "type": "int"}, + "min_count": {"key": "minCount", "type": "int"}, + "enable_auto_scaling": {"key": "enableAutoScaling", "type": "bool"}, + "scale_down_mode": {"key": "scaleDownMode", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "mode": {"key": "mode", "type": "str"}, + "orchestrator_version": {"key": "orchestratorVersion", "type": "str"}, + "node_image_version": {"key": "nodeImageVersion", "type": "str"}, + "upgrade_settings": {"key": "upgradeSettings", "type": "AgentPoolUpgradeSettings"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "power_state": {"key": "powerState", "type": "PowerState"}, + "availability_zones": {"key": "availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "enableNodePublicIP", "type": "bool"}, + "node_public_ip_prefix_id": {"key": "nodePublicIPPrefixID", "type": "str"}, + "scale_set_priority": {"key": "scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "scaleSetEvictionPolicy", "type": "str"}, + "spot_max_price": {"key": "spotMaxPrice", "type": "float"}, + "tags": {"key": "tags", "type": "{str}"}, + "node_labels": {"key": "nodeLabels", "type": "{str}"}, + "node_taints": {"key": "nodeTaints", "type": "[str]"}, + "proximity_placement_group_id": {"key": "proximityPlacementGroupID", "type": "str"}, + "kubelet_config": {"key": "kubeletConfig", "type": "KubeletConfig"}, + "linux_os_config": {"key": "linuxOSConfig", "type": "LinuxOSConfig"}, + "enable_encryption_at_host": {"key": "enableEncryptionAtHost", "type": "bool"}, + "enable_ultra_ssd": {"key": "enableUltraSSD", "type": "bool"}, + "enable_fips": {"key": "enableFIPS", "type": "bool"}, + "gpu_instance_profile": {"key": "gpuInstanceProfile", "type": "str"}, + "creation_data": {"key": "creationData", "type": "CreationData"}, + "name": {"key": "name", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, name: str, @@ -3026,7 +2950,7 @@ def __init__( vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, @@ -3040,9 +2964,9 @@ def __init__( availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", - spot_max_price: Optional[float] = -1, + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", + spot_max_price: float = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, @@ -3073,14 +2997,14 @@ def __init__( larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2021_10_01.models.OSDiskType :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime - data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + data root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2021_10_01.models.KubeletDiskType :keyword workload_runtime: Determines the type of workload a node can run. Known values are: - "OCIContainer", "WasmWasi". + "OCIContainer" and "WasmWasi". :paramtype workload_runtime: str or ~azure.mgmt.containerservice.v2021_10_01.models.WorkloadRuntime :keyword vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and @@ -3094,11 +3018,11 @@ def __init__( :paramtype pod_subnet_id: str :keyword max_pods: The maximum number of pods that can run on a node. :paramtype max_pods: int - :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2021_10_01.models.OSType :keyword os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Known values are: "Ubuntu", "CBLMariner". + Known values are: "Ubuntu" and "CBLMariner". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2021_10_01.models.OSSKU :keyword max_count: The maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -3107,15 +3031,15 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, - it defaults to Delete. Known values are: "Delete", "Deallocate". + it defaults to Delete. Known values are: "Delete" and "Deallocate". :paramtype scale_down_mode: str or ~azure.mgmt.containerservice.v2021_10_01.models.ScaleDownMode - :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", + :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2021_10_01.models.AgentPoolType :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2021_10_01.models.AgentPoolMode :keyword orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -3146,20 +3070,18 @@ def __init__( /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the - default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + default is 'Regular'. Known values are: "Spot" and "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2021_10_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2021_10_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :paramtype spot_max_price: float - :keyword tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :keyword tags: The tags to be persisted on the agent pool virtual machine scale set. :paramtype tags: dict[str, str] :keyword node_labels: The node labels to be persisted across all nodes in agent pool. :paramtype node_labels: dict[str, str] @@ -3183,21 +3105,60 @@ def __init__( for more details. :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance - profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2021_10_01.models.GPUInstanceProfile :keyword creation_data: CreationData to be used to specify the source Snapshot ID if the node pool will be created/upgraded using a snapshot. :paramtype creation_data: ~azure.mgmt.containerservice.v2021_10_01.models.CreationData - :keyword name: Required. Windows agent pool names must be 6 characters or less. + :keyword name: Windows agent pool names must be 6 characters or less. Required. :paramtype name: str """ - super(ManagedClusterAgentPoolProfile, self).__init__(count=count, vm_size=vm_size, os_disk_size_gb=os_disk_size_gb, os_disk_type=os_disk_type, kubelet_disk_type=kubelet_disk_type, workload_runtime=workload_runtime, vnet_subnet_id=vnet_subnet_id, pod_subnet_id=pod_subnet_id, max_pods=max_pods, os_type=os_type, os_sku=os_sku, max_count=max_count, min_count=min_count, enable_auto_scaling=enable_auto_scaling, scale_down_mode=scale_down_mode, type=type, mode=mode, orchestrator_version=orchestrator_version, upgrade_settings=upgrade_settings, power_state=power_state, availability_zones=availability_zones, enable_node_public_ip=enable_node_public_ip, node_public_ip_prefix_id=node_public_ip_prefix_id, scale_set_priority=scale_set_priority, scale_set_eviction_policy=scale_set_eviction_policy, spot_max_price=spot_max_price, tags=tags, node_labels=node_labels, node_taints=node_taints, proximity_placement_group_id=proximity_placement_group_id, kubelet_config=kubelet_config, linux_os_config=linux_os_config, enable_encryption_at_host=enable_encryption_at_host, enable_ultra_ssd=enable_ultra_ssd, enable_fips=enable_fips, gpu_instance_profile=gpu_instance_profile, creation_data=creation_data, **kwargs) + super().__init__( + count=count, + vm_size=vm_size, + os_disk_size_gb=os_disk_size_gb, + os_disk_type=os_disk_type, + kubelet_disk_type=kubelet_disk_type, + workload_runtime=workload_runtime, + vnet_subnet_id=vnet_subnet_id, + pod_subnet_id=pod_subnet_id, + max_pods=max_pods, + os_type=os_type, + os_sku=os_sku, + max_count=max_count, + min_count=min_count, + enable_auto_scaling=enable_auto_scaling, + scale_down_mode=scale_down_mode, + type=type, + mode=mode, + orchestrator_version=orchestrator_version, + upgrade_settings=upgrade_settings, + power_state=power_state, + availability_zones=availability_zones, + enable_node_public_ip=enable_node_public_ip, + node_public_ip_prefix_id=node_public_ip_prefix_id, + scale_set_priority=scale_set_priority, + scale_set_eviction_policy=scale_set_eviction_policy, + spot_max_price=spot_max_price, + tags=tags, + node_labels=node_labels, + node_taints=node_taints, + proximity_placement_group_id=proximity_placement_group_id, + kubelet_config=kubelet_config, + linux_os_config=linux_os_config, + enable_encryption_at_host=enable_encryption_at_host, + enable_ultra_ssd=enable_ultra_ssd, + enable_fips=enable_fips, + gpu_instance_profile=gpu_instance_profile, + creation_data=creation_data, + **kwargs + ) self.name = name -class ManagedClusterAPIServerAccessProfile(msrest.serialization.Model): +class ManagedClusterAPIServerAccessProfile(_serialization.Model): """Access profile for managed cluster API server. :ivar authorized_ip_ranges: IP ranges are specified in CIDR format, e.g. 137.117.106.88/29. @@ -3220,11 +3181,11 @@ class ManagedClusterAPIServerAccessProfile(msrest.serialization.Model): """ _attribute_map = { - 'authorized_ip_ranges': {'key': 'authorizedIPRanges', 'type': '[str]'}, - 'enable_private_cluster': {'key': 'enablePrivateCluster', 'type': 'bool'}, - 'private_dns_zone': {'key': 'privateDNSZone', 'type': 'str'}, - 'enable_private_cluster_public_fqdn': {'key': 'enablePrivateClusterPublicFQDN', 'type': 'bool'}, - 'disable_run_command': {'key': 'disableRunCommand', 'type': 'bool'}, + "authorized_ip_ranges": {"key": "authorizedIPRanges", "type": "[str]"}, + "enable_private_cluster": {"key": "enablePrivateCluster", "type": "bool"}, + "private_dns_zone": {"key": "privateDNSZone", "type": "str"}, + "enable_private_cluster_public_fqdn": {"key": "enablePrivateClusterPublicFQDN", "type": "bool"}, + "disable_run_command": {"key": "disableRunCommand", "type": "bool"}, } def __init__( @@ -3256,7 +3217,7 @@ def __init__( :keyword disable_run_command: Whether to disable run command for the cluster or not. :paramtype disable_run_command: bool """ - super(ManagedClusterAPIServerAccessProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.authorized_ip_ranges = authorized_ip_ranges self.enable_private_cluster = enable_private_cluster self.private_dns_zone = private_dns_zone @@ -3264,37 +3225,32 @@ def __init__( self.disable_run_command = disable_run_command -class ManagedClusterAutoUpgradeProfile(msrest.serialization.Model): +class ManagedClusterAutoUpgradeProfile(_serialization.Model): """Auto upgrade profile for a managed cluster. :ivar upgrade_channel: For more information see `setting the AKS cluster auto-upgrade channel `_. Known values - are: "rapid", "stable", "patch", "node-image", "none". + are: "rapid", "stable", "patch", "node-image", and "none". :vartype upgrade_channel: str or ~azure.mgmt.containerservice.v2021_10_01.models.UpgradeChannel """ _attribute_map = { - 'upgrade_channel': {'key': 'upgradeChannel', 'type': 'str'}, + "upgrade_channel": {"key": "upgradeChannel", "type": "str"}, } - def __init__( - self, - *, - upgrade_channel: Optional[Union[str, "_models.UpgradeChannel"]] = None, - **kwargs - ): + def __init__(self, *, upgrade_channel: Optional[Union[str, "_models.UpgradeChannel"]] = None, **kwargs): """ :keyword upgrade_channel: For more information see `setting the AKS cluster auto-upgrade channel `_. - Known values are: "rapid", "stable", "patch", "node-image", "none". + Known values are: "rapid", "stable", "patch", "node-image", and "none". :paramtype upgrade_channel: str or ~azure.mgmt.containerservice.v2021_10_01.models.UpgradeChannel """ - super(ManagedClusterAutoUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.upgrade_channel = upgrade_channel -class ManagedClusterHTTPProxyConfig(msrest.serialization.Model): +class ManagedClusterHTTPProxyConfig(_serialization.Model): """Cluster HTTP proxy configuration. :ivar http_proxy: The HTTP proxy server endpoint to use. @@ -3308,10 +3264,10 @@ class ManagedClusterHTTPProxyConfig(msrest.serialization.Model): """ _attribute_map = { - 'http_proxy': {'key': 'httpProxy', 'type': 'str'}, - 'https_proxy': {'key': 'httpsProxy', 'type': 'str'}, - 'no_proxy': {'key': 'noProxy', 'type': '[str]'}, - 'trusted_ca': {'key': 'trustedCa', 'type': 'str'}, + "http_proxy": {"key": "httpProxy", "type": "str"}, + "https_proxy": {"key": "httpsProxy", "type": "str"}, + "no_proxy": {"key": "noProxy", "type": "[str]"}, + "trusted_ca": {"key": "trustedCa", "type": "str"}, } def __init__( @@ -3333,14 +3289,14 @@ def __init__( :keyword trusted_ca: Alternative CA cert to use for connecting to proxy servers. :paramtype trusted_ca: str """ - super(ManagedClusterHTTPProxyConfig, self).__init__(**kwargs) + super().__init__(**kwargs) self.http_proxy = http_proxy self.https_proxy = https_proxy self.no_proxy = no_proxy self.trusted_ca = trusted_ca -class ManagedClusterIdentity(msrest.serialization.Model): +class ManagedClusterIdentity(_serialization.Model): """Identity for the managed cluster. Variables are only populated by the server, and will be ignored when sending a request. @@ -3353,7 +3309,7 @@ class ManagedClusterIdentity(msrest.serialization.Model): :vartype tenant_id: str :ivar type: For more information see `use managed identities in AKS `_. Known values are: - "SystemAssigned", "UserAssigned", "None". + "SystemAssigned", "UserAssigned", and "None". :vartype type: str or ~azure.mgmt.containerservice.v2021_10_01.models.ResourceIdentityType :ivar user_assigned_identities: The keys must be ARM resource IDs in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. @@ -3362,42 +3318,47 @@ class ManagedClusterIdentity(msrest.serialization.Model): """ _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, + "principal_id": {"readonly": True}, + "tenant_id": {"readonly": True}, } _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{ManagedServiceIdentityUserAssignedIdentitiesValue}'}, + "principal_id": {"key": "principalId", "type": "str"}, + "tenant_id": {"key": "tenantId", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "user_assigned_identities": { + "key": "userAssignedIdentities", + "type": "{ManagedServiceIdentityUserAssignedIdentitiesValue}", + }, } def __init__( self, *, type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, - user_assigned_identities: Optional[Dict[str, "_models.ManagedServiceIdentityUserAssignedIdentitiesValue"]] = None, + user_assigned_identities: Optional[ + Dict[str, "_models.ManagedServiceIdentityUserAssignedIdentitiesValue"] + ] = None, **kwargs ): """ :keyword type: For more information see `use managed identities in AKS `_. Known values are: - "SystemAssigned", "UserAssigned", "None". + "SystemAssigned", "UserAssigned", and "None". :paramtype type: str or ~azure.mgmt.containerservice.v2021_10_01.models.ResourceIdentityType :keyword user_assigned_identities: The keys must be ARM resource IDs in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. :paramtype user_assigned_identities: dict[str, ~azure.mgmt.containerservice.v2021_10_01.models.ManagedServiceIdentityUserAssignedIdentitiesValue] """ - super(ManagedClusterIdentity, self).__init__(**kwargs) + super().__init__(**kwargs) self.principal_id = None self.tenant_id = None self.type = type self.user_assigned_identities = user_assigned_identities -class ManagedClusterListResult(msrest.serialization.Model): +class ManagedClusterListResult(_serialization.Model): """The response from the List Managed Clusters operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -3409,30 +3370,25 @@ class ManagedClusterListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[ManagedCluster]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[ManagedCluster]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.ManagedCluster"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.ManagedCluster"]] = None, **kwargs): """ :keyword value: The list of managed clusters. :paramtype value: list[~azure.mgmt.containerservice.v2021_10_01.models.ManagedCluster] """ - super(ManagedClusterListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class ManagedClusterLoadBalancerProfile(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfile(_serialization.Model): """Profile of the managed cluster load balancer. :ivar managed_outbound_i_ps: Desired managed outbound IPs for the cluster load balancer. @@ -3461,18 +3417,24 @@ class ManagedClusterLoadBalancerProfile(msrest.serialization.Model): """ _validation = { - 'allocated_outbound_ports': {'maximum': 64000, 'minimum': 0}, - 'idle_timeout_in_minutes': {'maximum': 120, 'minimum': 4}, + "allocated_outbound_ports": {"maximum": 64000, "minimum": 0}, + "idle_timeout_in_minutes": {"maximum": 120, "minimum": 4}, } _attribute_map = { - 'managed_outbound_i_ps': {'key': 'managedOutboundIPs', 'type': 'ManagedClusterLoadBalancerProfileManagedOutboundIPs'}, - 'outbound_ip_prefixes': {'key': 'outboundIPPrefixes', 'type': 'ManagedClusterLoadBalancerProfileOutboundIPPrefixes'}, - 'outbound_i_ps': {'key': 'outboundIPs', 'type': 'ManagedClusterLoadBalancerProfileOutboundIPs'}, - 'effective_outbound_i_ps': {'key': 'effectiveOutboundIPs', 'type': '[ResourceReference]'}, - 'allocated_outbound_ports': {'key': 'allocatedOutboundPorts', 'type': 'int'}, - 'idle_timeout_in_minutes': {'key': 'idleTimeoutInMinutes', 'type': 'int'}, - 'enable_multiple_standard_load_balancers': {'key': 'enableMultipleStandardLoadBalancers', 'type': 'bool'}, + "managed_outbound_i_ps": { + "key": "managedOutboundIPs", + "type": "ManagedClusterLoadBalancerProfileManagedOutboundIPs", + }, + "outbound_ip_prefixes": { + "key": "outboundIPPrefixes", + "type": "ManagedClusterLoadBalancerProfileOutboundIPPrefixes", + }, + "outbound_i_ps": {"key": "outboundIPs", "type": "ManagedClusterLoadBalancerProfileOutboundIPs"}, + "effective_outbound_i_ps": {"key": "effectiveOutboundIPs", "type": "[ResourceReference]"}, + "allocated_outbound_ports": {"key": "allocatedOutboundPorts", "type": "int"}, + "idle_timeout_in_minutes": {"key": "idleTimeoutInMinutes", "type": "int"}, + "enable_multiple_standard_load_balancers": {"key": "enableMultipleStandardLoadBalancers", "type": "bool"}, } def __init__( @@ -3482,8 +3444,8 @@ def __init__( outbound_ip_prefixes: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPPrefixes"] = None, outbound_i_ps: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPs"] = None, effective_outbound_i_ps: Optional[List["_models.ResourceReference"]] = None, - allocated_outbound_ports: Optional[int] = 0, - idle_timeout_in_minutes: Optional[int] = 30, + allocated_outbound_ports: int = 0, + idle_timeout_in_minutes: int = 30, enable_multiple_standard_load_balancers: Optional[bool] = None, **kwargs ): @@ -3513,7 +3475,7 @@ def __init__( AKS cluster or not. :paramtype enable_multiple_standard_load_balancers: bool """ - super(ManagedClusterLoadBalancerProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.managed_outbound_i_ps = managed_outbound_i_ps self.outbound_ip_prefixes = outbound_ip_prefixes self.outbound_i_ps = outbound_i_ps @@ -3523,7 +3485,7 @@ def __init__( self.enable_multiple_standard_load_balancers = enable_multiple_standard_load_balancers -class ManagedClusterLoadBalancerProfileManagedOutboundIPs(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfileManagedOutboundIPs(_serialization.Model): """Desired managed outbound IPs for the cluster load balancer. :ivar count: The desired number of IPv4 outbound IPs created/managed by Azure for the cluster @@ -3537,22 +3499,16 @@ class ManagedClusterLoadBalancerProfileManagedOutboundIPs(msrest.serialization.M """ _validation = { - 'count': {'maximum': 100, 'minimum': 1}, - 'count_ipv6': {'maximum': 100, 'minimum': 0}, + "count": {"maximum": 100, "minimum": 1}, + "count_ipv6": {"maximum": 100, "minimum": 0}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'count_ipv6': {'key': 'countIPv6', 'type': 'int'}, + "count": {"key": "count", "type": "int"}, + "count_ipv6": {"key": "countIPv6", "type": "int"}, } - def __init__( - self, - *, - count: Optional[int] = 1, - count_ipv6: Optional[int] = 0, - **kwargs - ): + def __init__(self, *, count: int = 1, count_ipv6: int = 0, **kwargs): """ :keyword count: The desired number of IPv4 outbound IPs created/managed by Azure for the cluster load balancer. Allowed values must be in the range of 1 to 100 (inclusive). The default @@ -3563,12 +3519,12 @@ def __init__( value is 0 for single-stack and 1 for dual-stack. :paramtype count_ipv6: int """ - super(ManagedClusterLoadBalancerProfileManagedOutboundIPs, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.count_ipv6 = count_ipv6 -class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(_serialization.Model): """Desired outbound IP Prefix resources for the cluster load balancer. :ivar public_ip_prefixes: A list of public IP prefix resources. @@ -3577,25 +3533,20 @@ class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(msrest.serialization.M """ _attribute_map = { - 'public_ip_prefixes': {'key': 'publicIPPrefixes', 'type': '[ResourceReference]'}, + "public_ip_prefixes": {"key": "publicIPPrefixes", "type": "[ResourceReference]"}, } - def __init__( - self, - *, - public_ip_prefixes: Optional[List["_models.ResourceReference"]] = None, - **kwargs - ): + def __init__(self, *, public_ip_prefixes: Optional[List["_models.ResourceReference"]] = None, **kwargs): """ :keyword public_ip_prefixes: A list of public IP prefix resources. :paramtype public_ip_prefixes: list[~azure.mgmt.containerservice.v2021_10_01.models.ResourceReference] """ - super(ManagedClusterLoadBalancerProfileOutboundIPPrefixes, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_ip_prefixes = public_ip_prefixes -class ManagedClusterLoadBalancerProfileOutboundIPs(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfileOutboundIPs(_serialization.Model): """Desired outbound IP resources for the cluster load balancer. :ivar public_i_ps: A list of public IP resources. @@ -3603,24 +3554,19 @@ class ManagedClusterLoadBalancerProfileOutboundIPs(msrest.serialization.Model): """ _attribute_map = { - 'public_i_ps': {'key': 'publicIPs', 'type': '[ResourceReference]'}, + "public_i_ps": {"key": "publicIPs", "type": "[ResourceReference]"}, } - def __init__( - self, - *, - public_i_ps: Optional[List["_models.ResourceReference"]] = None, - **kwargs - ): + def __init__(self, *, public_i_ps: Optional[List["_models.ResourceReference"]] = None, **kwargs): """ :keyword public_i_ps: A list of public IP resources. :paramtype public_i_ps: list[~azure.mgmt.containerservice.v2021_10_01.models.ResourceReference] """ - super(ManagedClusterLoadBalancerProfileOutboundIPs, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_i_ps = public_i_ps -class ManagedClusterManagedOutboundIPProfile(msrest.serialization.Model): +class ManagedClusterManagedOutboundIPProfile(_serialization.Model): """Profile of the managed outbound IP resources of the managed cluster. :ivar count: The desired number of outbound IPs created/managed by Azure. Allowed values must @@ -3629,29 +3575,24 @@ class ManagedClusterManagedOutboundIPProfile(msrest.serialization.Model): """ _validation = { - 'count': {'maximum': 16, 'minimum': 1}, + "count": {"maximum": 16, "minimum": 1}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, + "count": {"key": "count", "type": "int"}, } - def __init__( - self, - *, - count: Optional[int] = 1, - **kwargs - ): + def __init__(self, *, count: int = 1, **kwargs): """ :keyword count: The desired number of outbound IPs created/managed by Azure. Allowed values must be in the range of 1 to 16 (inclusive). The default value is 1. :paramtype count: int """ - super(ManagedClusterManagedOutboundIPProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count -class ManagedClusterNATGatewayProfile(msrest.serialization.Model): +class ManagedClusterNATGatewayProfile(_serialization.Model): """Profile of the managed cluster NAT gateway. :ivar managed_outbound_ip_profile: Profile of the managed outbound IP resources of the cluster @@ -3667,13 +3608,16 @@ class ManagedClusterNATGatewayProfile(msrest.serialization.Model): """ _validation = { - 'idle_timeout_in_minutes': {'maximum': 120, 'minimum': 4}, + "idle_timeout_in_minutes": {"maximum": 120, "minimum": 4}, } _attribute_map = { - 'managed_outbound_ip_profile': {'key': 'managedOutboundIPProfile', 'type': 'ManagedClusterManagedOutboundIPProfile'}, - 'effective_outbound_i_ps': {'key': 'effectiveOutboundIPs', 'type': '[ResourceReference]'}, - 'idle_timeout_in_minutes': {'key': 'idleTimeoutInMinutes', 'type': 'int'}, + "managed_outbound_ip_profile": { + "key": "managedOutboundIPProfile", + "type": "ManagedClusterManagedOutboundIPProfile", + }, + "effective_outbound_i_ps": {"key": "effectiveOutboundIPs", "type": "[ResourceReference]"}, + "idle_timeout_in_minutes": {"key": "idleTimeoutInMinutes", "type": "int"}, } def __init__( @@ -3681,7 +3625,7 @@ def __init__( *, managed_outbound_ip_profile: Optional["_models.ManagedClusterManagedOutboundIPProfile"] = None, effective_outbound_i_ps: Optional[List["_models.ResourceReference"]] = None, - idle_timeout_in_minutes: Optional[int] = 4, + idle_timeout_in_minutes: int = 4, **kwargs ): """ @@ -3697,29 +3641,29 @@ def __init__( are in the range of 4 to 120 (inclusive). The default value is 4 minutes. :paramtype idle_timeout_in_minutes: int """ - super(ManagedClusterNATGatewayProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.managed_outbound_ip_profile = managed_outbound_ip_profile self.effective_outbound_i_ps = effective_outbound_i_ps self.idle_timeout_in_minutes = idle_timeout_in_minutes -class ManagedClusterPodIdentity(msrest.serialization.Model): +class ManagedClusterPodIdentity(_serialization.Model): """Details about the pod identity assigned to the Managed Cluster. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar name: Required. The name of the pod identity. + :ivar name: The name of the pod identity. Required. :vartype name: str - :ivar namespace: Required. The namespace of the pod identity. + :ivar namespace: The namespace of the pod identity. Required. :vartype namespace: str :ivar binding_selector: The binding selector to use for the AzureIdentityBinding resource. :vartype binding_selector: str - :ivar identity: Required. The user assigned identity details. + :ivar identity: The user assigned identity details. Required. :vartype identity: ~azure.mgmt.containerservice.v2021_10_01.models.UserAssignedIdentity :ivar provisioning_state: The current provisioning state of the pod identity. Known values are: - "Assigned", "Updating", "Deleting", "Failed". + "Assigned", "Updating", "Deleting", and "Failed". :vartype provisioning_state: str or ~azure.mgmt.containerservice.v2021_10_01.models.ManagedClusterPodIdentityProvisioningState :ivar provisioning_info: @@ -3728,20 +3672,20 @@ class ManagedClusterPodIdentity(msrest.serialization.Model): """ _validation = { - 'name': {'required': True}, - 'namespace': {'required': True}, - 'identity': {'required': True}, - 'provisioning_state': {'readonly': True}, - 'provisioning_info': {'readonly': True}, + "name": {"required": True}, + "namespace": {"required": True}, + "identity": {"required": True}, + "provisioning_state": {"readonly": True}, + "provisioning_info": {"readonly": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'namespace': {'key': 'namespace', 'type': 'str'}, - 'binding_selector': {'key': 'bindingSelector', 'type': 'str'}, - 'identity': {'key': 'identity', 'type': 'UserAssignedIdentity'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'provisioning_info': {'key': 'provisioningInfo', 'type': 'ManagedClusterPodIdentityProvisioningInfo'}, + "name": {"key": "name", "type": "str"}, + "namespace": {"key": "namespace", "type": "str"}, + "binding_selector": {"key": "bindingSelector", "type": "str"}, + "identity": {"key": "identity", "type": "UserAssignedIdentity"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "provisioning_info": {"key": "provisioningInfo", "type": "ManagedClusterPodIdentityProvisioningInfo"}, } def __init__( @@ -3754,16 +3698,16 @@ def __init__( **kwargs ): """ - :keyword name: Required. The name of the pod identity. + :keyword name: The name of the pod identity. Required. :paramtype name: str - :keyword namespace: Required. The namespace of the pod identity. + :keyword namespace: The namespace of the pod identity. Required. :paramtype namespace: str :keyword binding_selector: The binding selector to use for the AzureIdentityBinding resource. :paramtype binding_selector: str - :keyword identity: Required. The user assigned identity details. + :keyword identity: The user assigned identity details. Required. :paramtype identity: ~azure.mgmt.containerservice.v2021_10_01.models.UserAssignedIdentity """ - super(ManagedClusterPodIdentity, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.namespace = namespace self.binding_selector = binding_selector @@ -3772,54 +3716,47 @@ def __init__( self.provisioning_info = None -class ManagedClusterPodIdentityException(msrest.serialization.Model): +class ManagedClusterPodIdentityException(_serialization.Model): """See `disable AAD Pod Identity for a specific Pod/Application `_ for more details. All required parameters must be populated in order to send to Azure. - :ivar name: Required. The name of the pod identity exception. + :ivar name: The name of the pod identity exception. Required. :vartype name: str - :ivar namespace: Required. The namespace of the pod identity exception. + :ivar namespace: The namespace of the pod identity exception. Required. :vartype namespace: str - :ivar pod_labels: Required. The pod labels to match. + :ivar pod_labels: The pod labels to match. Required. :vartype pod_labels: dict[str, str] """ _validation = { - 'name': {'required': True}, - 'namespace': {'required': True}, - 'pod_labels': {'required': True}, + "name": {"required": True}, + "namespace": {"required": True}, + "pod_labels": {"required": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'namespace': {'key': 'namespace', 'type': 'str'}, - 'pod_labels': {'key': 'podLabels', 'type': '{str}'}, + "name": {"key": "name", "type": "str"}, + "namespace": {"key": "namespace", "type": "str"}, + "pod_labels": {"key": "podLabels", "type": "{str}"}, } - def __init__( - self, - *, - name: str, - namespace: str, - pod_labels: Dict[str, str], - **kwargs - ): + def __init__(self, *, name: str, namespace: str, pod_labels: Dict[str, str], **kwargs): """ - :keyword name: Required. The name of the pod identity exception. + :keyword name: The name of the pod identity exception. Required. :paramtype name: str - :keyword namespace: Required. The namespace of the pod identity exception. + :keyword namespace: The namespace of the pod identity exception. Required. :paramtype namespace: str - :keyword pod_labels: Required. The pod labels to match. + :keyword pod_labels: The pod labels to match. Required. :paramtype pod_labels: dict[str, str] """ - super(ManagedClusterPodIdentityException, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.namespace = namespace self.pod_labels = pod_labels -class ManagedClusterPodIdentityProfile(msrest.serialization.Model): +class ManagedClusterPodIdentityProfile(_serialization.Model): """See `use AAD pod identity `_ for more details on pod identity integration. :ivar enabled: Whether the pod identity addon is enabled. @@ -3839,10 +3776,13 @@ class ManagedClusterPodIdentityProfile(msrest.serialization.Model): """ _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'allow_network_plugin_kubenet': {'key': 'allowNetworkPluginKubenet', 'type': 'bool'}, - 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '[ManagedClusterPodIdentity]'}, - 'user_assigned_identity_exceptions': {'key': 'userAssignedIdentityExceptions', 'type': '[ManagedClusterPodIdentityException]'}, + "enabled": {"key": "enabled", "type": "bool"}, + "allow_network_plugin_kubenet": {"key": "allowNetworkPluginKubenet", "type": "bool"}, + "user_assigned_identities": {"key": "userAssignedIdentities", "type": "[ManagedClusterPodIdentity]"}, + "user_assigned_identity_exceptions": { + "key": "userAssignedIdentityExceptions", + "type": "[ManagedClusterPodIdentityException]", + }, } def __init__( @@ -3870,14 +3810,14 @@ def __init__( :paramtype user_assigned_identity_exceptions: list[~azure.mgmt.containerservice.v2021_10_01.models.ManagedClusterPodIdentityException] """ - super(ManagedClusterPodIdentityProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.allow_network_plugin_kubenet = allow_network_plugin_kubenet self.user_assigned_identities = user_assigned_identities self.user_assigned_identity_exceptions = user_assigned_identity_exceptions -class ManagedClusterPodIdentityProvisioningError(msrest.serialization.Model): +class ManagedClusterPodIdentityProvisioningError(_serialization.Model): """An error response from the pod identity provisioning. :ivar error: Details about the error. @@ -3886,25 +3826,20 @@ class ManagedClusterPodIdentityProvisioningError(msrest.serialization.Model): """ _attribute_map = { - 'error': {'key': 'error', 'type': 'ManagedClusterPodIdentityProvisioningErrorBody'}, + "error": {"key": "error", "type": "ManagedClusterPodIdentityProvisioningErrorBody"}, } - def __init__( - self, - *, - error: Optional["_models.ManagedClusterPodIdentityProvisioningErrorBody"] = None, - **kwargs - ): + def __init__(self, *, error: Optional["_models.ManagedClusterPodIdentityProvisioningErrorBody"] = None, **kwargs): """ :keyword error: Details about the error. :paramtype error: ~azure.mgmt.containerservice.v2021_10_01.models.ManagedClusterPodIdentityProvisioningErrorBody """ - super(ManagedClusterPodIdentityProvisioningError, self).__init__(**kwargs) + super().__init__(**kwargs) self.error = error -class ManagedClusterPodIdentityProvisioningErrorBody(msrest.serialization.Model): +class ManagedClusterPodIdentityProvisioningErrorBody(_serialization.Model): """An error response from the pod identity provisioning. :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed @@ -3922,10 +3857,10 @@ class ManagedClusterPodIdentityProvisioningErrorBody(msrest.serialization.Model) """ _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[ManagedClusterPodIdentityProvisioningErrorBody]'}, + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[ManagedClusterPodIdentityProvisioningErrorBody]"}, } def __init__( @@ -3951,14 +3886,14 @@ def __init__( :paramtype details: list[~azure.mgmt.containerservice.v2021_10_01.models.ManagedClusterPodIdentityProvisioningErrorBody] """ - super(ManagedClusterPodIdentityProvisioningErrorBody, self).__init__(**kwargs) + super().__init__(**kwargs) self.code = code self.message = message self.target = target self.details = details -class ManagedClusterPodIdentityProvisioningInfo(msrest.serialization.Model): +class ManagedClusterPodIdentityProvisioningInfo(_serialization.Model): """ManagedClusterPodIdentityProvisioningInfo. :ivar error: Pod identity assignment error (if any). @@ -3967,35 +3902,30 @@ class ManagedClusterPodIdentityProvisioningInfo(msrest.serialization.Model): """ _attribute_map = { - 'error': {'key': 'error', 'type': 'ManagedClusterPodIdentityProvisioningError'}, + "error": {"key": "error", "type": "ManagedClusterPodIdentityProvisioningError"}, } - def __init__( - self, - *, - error: Optional["_models.ManagedClusterPodIdentityProvisioningError"] = None, - **kwargs - ): + def __init__(self, *, error: Optional["_models.ManagedClusterPodIdentityProvisioningError"] = None, **kwargs): """ :keyword error: Pod identity assignment error (if any). :paramtype error: ~azure.mgmt.containerservice.v2021_10_01.models.ManagedClusterPodIdentityProvisioningError """ - super(ManagedClusterPodIdentityProvisioningInfo, self).__init__(**kwargs) + super().__init__(**kwargs) self.error = error -class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): +class ManagedClusterPoolUpgradeProfile(_serialization.Model): """The list of available upgrade versions. All required parameters must be populated in order to send to Azure. - :ivar kubernetes_version: Required. The Kubernetes version (major.minor.patch). + :ivar kubernetes_version: The Kubernetes version (major.minor.patch). Required. :vartype kubernetes_version: str :ivar name: The Agent Pool name. :vartype name: str - :ivar os_type: Required. The operating system type. The default is Linux. Known values are: - "Linux", "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2021_10_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -4003,15 +3933,15 @@ class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): """ _validation = { - 'kubernetes_version': {'required': True}, - 'os_type': {'required': True}, + "kubernetes_version": {"required": True}, + "os_type": {"required": True}, } _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'upgrades': {'key': 'upgrades', 'type': '[ManagedClusterPoolUpgradeProfileUpgradesItem]'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "os_type": {"key": "osType", "type": "str"}, + "upgrades": {"key": "upgrades", "type": "[ManagedClusterPoolUpgradeProfileUpgradesItem]"}, } def __init__( @@ -4024,25 +3954,25 @@ def __init__( **kwargs ): """ - :keyword kubernetes_version: Required. The Kubernetes version (major.minor.patch). + :keyword kubernetes_version: The Kubernetes version (major.minor.patch). Required. :paramtype kubernetes_version: str :keyword name: The Agent Pool name. :paramtype name: str - :keyword os_type: Required. The operating system type. The default is Linux. Known values are: - "Linux", "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2021_10_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: list[~azure.mgmt.containerservice.v2021_10_01.models.ManagedClusterPoolUpgradeProfileUpgradesItem] """ - super(ManagedClusterPoolUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.name = name self.os_type = os_type self.upgrades = upgrades -class ManagedClusterPoolUpgradeProfileUpgradesItem(msrest.serialization.Model): +class ManagedClusterPoolUpgradeProfileUpgradesItem(_serialization.Model): """ManagedClusterPoolUpgradeProfileUpgradesItem. :ivar kubernetes_version: The Kubernetes version (major.minor.patch). @@ -4052,36 +3982,30 @@ class ManagedClusterPoolUpgradeProfileUpgradesItem(msrest.serialization.Model): """ _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } - def __init__( - self, - *, - kubernetes_version: Optional[str] = None, - is_preview: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, kubernetes_version: Optional[str] = None, is_preview: Optional[bool] = None, **kwargs): """ :keyword kubernetes_version: The Kubernetes version (major.minor.patch). :paramtype kubernetes_version: str :keyword is_preview: Whether the Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(ManagedClusterPoolUpgradeProfileUpgradesItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.is_preview = is_preview -class ManagedClusterPropertiesAutoScalerProfile(msrest.serialization.Model): +class ManagedClusterPropertiesAutoScalerProfile(_serialization.Model): # pylint: disable=too-many-instance-attributes """Parameters to be applied to the cluster-autoscaler when enabled. :ivar balance_similar_node_groups: Valid values are 'true' and 'false'. :vartype balance_similar_node_groups: str :ivar expander: If not specified, the default is 'random'. See `expanders `_ - for more information. Known values are: "least-waste", "most-pods", "priority", "random". + for more information. Known values are: "least-waste", "most-pods", "priority", and "random". :vartype expander: str or ~azure.mgmt.containerservice.v2021_10_01.models.Expander :ivar max_empty_bulk_delete: The default is 10. :vartype max_empty_bulk_delete: str @@ -4125,23 +4049,23 @@ class ManagedClusterPropertiesAutoScalerProfile(msrest.serialization.Model): """ _attribute_map = { - 'balance_similar_node_groups': {'key': 'balance-similar-node-groups', 'type': 'str'}, - 'expander': {'key': 'expander', 'type': 'str'}, - 'max_empty_bulk_delete': {'key': 'max-empty-bulk-delete', 'type': 'str'}, - 'max_graceful_termination_sec': {'key': 'max-graceful-termination-sec', 'type': 'str'}, - 'max_node_provision_time': {'key': 'max-node-provision-time', 'type': 'str'}, - 'max_total_unready_percentage': {'key': 'max-total-unready-percentage', 'type': 'str'}, - 'new_pod_scale_up_delay': {'key': 'new-pod-scale-up-delay', 'type': 'str'}, - 'ok_total_unready_count': {'key': 'ok-total-unready-count', 'type': 'str'}, - 'scan_interval': {'key': 'scan-interval', 'type': 'str'}, - 'scale_down_delay_after_add': {'key': 'scale-down-delay-after-add', 'type': 'str'}, - 'scale_down_delay_after_delete': {'key': 'scale-down-delay-after-delete', 'type': 'str'}, - 'scale_down_delay_after_failure': {'key': 'scale-down-delay-after-failure', 'type': 'str'}, - 'scale_down_unneeded_time': {'key': 'scale-down-unneeded-time', 'type': 'str'}, - 'scale_down_unready_time': {'key': 'scale-down-unready-time', 'type': 'str'}, - 'scale_down_utilization_threshold': {'key': 'scale-down-utilization-threshold', 'type': 'str'}, - 'skip_nodes_with_local_storage': {'key': 'skip-nodes-with-local-storage', 'type': 'str'}, - 'skip_nodes_with_system_pods': {'key': 'skip-nodes-with-system-pods', 'type': 'str'}, + "balance_similar_node_groups": {"key": "balance-similar-node-groups", "type": "str"}, + "expander": {"key": "expander", "type": "str"}, + "max_empty_bulk_delete": {"key": "max-empty-bulk-delete", "type": "str"}, + "max_graceful_termination_sec": {"key": "max-graceful-termination-sec", "type": "str"}, + "max_node_provision_time": {"key": "max-node-provision-time", "type": "str"}, + "max_total_unready_percentage": {"key": "max-total-unready-percentage", "type": "str"}, + "new_pod_scale_up_delay": {"key": "new-pod-scale-up-delay", "type": "str"}, + "ok_total_unready_count": {"key": "ok-total-unready-count", "type": "str"}, + "scan_interval": {"key": "scan-interval", "type": "str"}, + "scale_down_delay_after_add": {"key": "scale-down-delay-after-add", "type": "str"}, + "scale_down_delay_after_delete": {"key": "scale-down-delay-after-delete", "type": "str"}, + "scale_down_delay_after_failure": {"key": "scale-down-delay-after-failure", "type": "str"}, + "scale_down_unneeded_time": {"key": "scale-down-unneeded-time", "type": "str"}, + "scale_down_unready_time": {"key": "scale-down-unready-time", "type": "str"}, + "scale_down_utilization_threshold": {"key": "scale-down-utilization-threshold", "type": "str"}, + "skip_nodes_with_local_storage": {"key": "skip-nodes-with-local-storage", "type": "str"}, + "skip_nodes_with_system_pods": {"key": "skip-nodes-with-system-pods", "type": "str"}, } def __init__( @@ -4171,7 +4095,7 @@ def __init__( :paramtype balance_similar_node_groups: str :keyword expander: If not specified, the default is 'random'. See `expanders `_ - for more information. Known values are: "least-waste", "most-pods", "priority", "random". + for more information. Known values are: "least-waste", "most-pods", "priority", and "random". :paramtype expander: str or ~azure.mgmt.containerservice.v2021_10_01.models.Expander :keyword max_empty_bulk_delete: The default is 10. :paramtype max_empty_bulk_delete: str @@ -4214,7 +4138,7 @@ def __init__( :keyword skip_nodes_with_system_pods: The default is true. :paramtype skip_nodes_with_system_pods: str """ - super(ManagedClusterPropertiesAutoScalerProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.balance_similar_node_groups = balance_similar_node_groups self.expander = expander self.max_empty_bulk_delete = max_empty_bulk_delete @@ -4234,7 +4158,7 @@ def __init__( self.skip_nodes_with_system_pods = skip_nodes_with_system_pods -class ManagedClusterSecurityProfile(msrest.serialization.Model): +class ManagedClusterSecurityProfile(_serialization.Model): """Security profile for the container service cluster. :ivar azure_defender: Azure Defender settings for the security profile. @@ -4243,25 +4167,22 @@ class ManagedClusterSecurityProfile(msrest.serialization.Model): """ _attribute_map = { - 'azure_defender': {'key': 'azureDefender', 'type': 'ManagedClusterSecurityProfileAzureDefender'}, + "azure_defender": {"key": "azureDefender", "type": "ManagedClusterSecurityProfileAzureDefender"}, } def __init__( - self, - *, - azure_defender: Optional["_models.ManagedClusterSecurityProfileAzureDefender"] = None, - **kwargs + self, *, azure_defender: Optional["_models.ManagedClusterSecurityProfileAzureDefender"] = None, **kwargs ): """ :keyword azure_defender: Azure Defender settings for the security profile. :paramtype azure_defender: ~azure.mgmt.containerservice.v2021_10_01.models.ManagedClusterSecurityProfileAzureDefender """ - super(ManagedClusterSecurityProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.azure_defender = azure_defender -class ManagedClusterSecurityProfileAzureDefender(msrest.serialization.Model): +class ManagedClusterSecurityProfileAzureDefender(_serialization.Model): """Azure Defender settings for the security profile. :ivar enabled: Whether to enable Azure Defender. @@ -4274,16 +4195,12 @@ class ManagedClusterSecurityProfileAzureDefender(msrest.serialization.Model): """ _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'log_analytics_workspace_resource_id': {'key': 'logAnalyticsWorkspaceResourceId', 'type': 'str'}, + "enabled": {"key": "enabled", "type": "bool"}, + "log_analytics_workspace_resource_id": {"key": "logAnalyticsWorkspaceResourceId", "type": "str"}, } def __init__( - self, - *, - enabled: Optional[bool] = None, - log_analytics_workspace_resource_id: Optional[str] = None, - **kwargs + self, *, enabled: Optional[bool] = None, log_analytics_workspace_resource_id: Optional[str] = None, **kwargs ): """ :keyword enabled: Whether to enable Azure Defender. @@ -4294,63 +4211,57 @@ def __init__( be exists. :paramtype log_analytics_workspace_resource_id: str """ - super(ManagedClusterSecurityProfileAzureDefender, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.log_analytics_workspace_resource_id = log_analytics_workspace_resource_id -class ManagedClusterServicePrincipalProfile(msrest.serialization.Model): +class ManagedClusterServicePrincipalProfile(_serialization.Model): """Information about a service principal identity for the cluster to use for manipulating Azure APIs. All required parameters must be populated in order to send to Azure. - :ivar client_id: Required. The ID for the service principal. + :ivar client_id: The ID for the service principal. Required. :vartype client_id: str :ivar secret: The secret password associated with the service principal in plain text. :vartype secret: str """ _validation = { - 'client_id': {'required': True}, + "client_id": {"required": True}, } _attribute_map = { - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'secret': {'key': 'secret', 'type': 'str'}, + "client_id": {"key": "clientId", "type": "str"}, + "secret": {"key": "secret", "type": "str"}, } - def __init__( - self, - *, - client_id: str, - secret: Optional[str] = None, - **kwargs - ): + def __init__(self, *, client_id: str, secret: Optional[str] = None, **kwargs): """ - :keyword client_id: Required. The ID for the service principal. + :keyword client_id: The ID for the service principal. Required. :paramtype client_id: str :keyword secret: The secret password associated with the service principal in plain text. :paramtype secret: str """ - super(ManagedClusterServicePrincipalProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.client_id = client_id self.secret = secret -class ManagedClusterSKU(msrest.serialization.Model): +class ManagedClusterSKU(_serialization.Model): """The SKU of a Managed Cluster. - :ivar name: The name of a managed cluster SKU. Known values are: "Basic". + :ivar name: The name of a managed cluster SKU. "Basic" :vartype name: str or ~azure.mgmt.containerservice.v2021_10_01.models.ManagedClusterSKUName :ivar tier: If not specified, the default is 'Free'. See `uptime SLA - `_ for more details. Known values are: "Paid", - "Free". + `_ for more details. Known values are: "Paid" + and "Free". :vartype tier: str or ~azure.mgmt.containerservice.v2021_10_01.models.ManagedClusterSKUTier """ _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, + "name": {"key": "name", "type": "str"}, + "tier": {"key": "tier", "type": "str"}, } def __init__( @@ -4361,19 +4272,19 @@ def __init__( **kwargs ): """ - :keyword name: The name of a managed cluster SKU. Known values are: "Basic". + :keyword name: The name of a managed cluster SKU. "Basic" :paramtype name: str or ~azure.mgmt.containerservice.v2021_10_01.models.ManagedClusterSKUName :keyword tier: If not specified, the default is 'Free'. See `uptime SLA - `_ for more details. Known values are: "Paid", - "Free". + `_ for more details. Known values are: "Paid" + and "Free". :paramtype tier: str or ~azure.mgmt.containerservice.v2021_10_01.models.ManagedClusterSKUTier """ - super(ManagedClusterSKU, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.tier = tier -class ManagedClusterUpgradeProfile(msrest.serialization.Model): +class ManagedClusterUpgradeProfile(_serialization.Model): """The list of available upgrades for compute pools. Variables are only populated by the server, and will be ignored when sending a request. @@ -4386,29 +4297,29 @@ class ManagedClusterUpgradeProfile(msrest.serialization.Model): :vartype name: str :ivar type: The type of the upgrade profile. :vartype type: str - :ivar control_plane_profile: Required. The list of available upgrade versions for the control - plane. + :ivar control_plane_profile: The list of available upgrade versions for the control plane. + Required. :vartype control_plane_profile: ~azure.mgmt.containerservice.v2021_10_01.models.ManagedClusterPoolUpgradeProfile - :ivar agent_pool_profiles: Required. The list of available upgrade versions for agent pools. + :ivar agent_pool_profiles: The list of available upgrade versions for agent pools. Required. :vartype agent_pool_profiles: list[~azure.mgmt.containerservice.v2021_10_01.models.ManagedClusterPoolUpgradeProfile] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'control_plane_profile': {'required': True}, - 'agent_pool_profiles': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "control_plane_profile": {"required": True}, + "agent_pool_profiles": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'control_plane_profile': {'key': 'properties.controlPlaneProfile', 'type': 'ManagedClusterPoolUpgradeProfile'}, - 'agent_pool_profiles': {'key': 'properties.agentPoolProfiles', 'type': '[ManagedClusterPoolUpgradeProfile]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "control_plane_profile": {"key": "properties.controlPlaneProfile", "type": "ManagedClusterPoolUpgradeProfile"}, + "agent_pool_profiles": {"key": "properties.agentPoolProfiles", "type": "[ManagedClusterPoolUpgradeProfile]"}, } def __init__( @@ -4419,15 +4330,15 @@ def __init__( **kwargs ): """ - :keyword control_plane_profile: Required. The list of available upgrade versions for the - control plane. + :keyword control_plane_profile: The list of available upgrade versions for the control plane. + Required. :paramtype control_plane_profile: ~azure.mgmt.containerservice.v2021_10_01.models.ManagedClusterPoolUpgradeProfile - :keyword agent_pool_profiles: Required. The list of available upgrade versions for agent pools. + :keyword agent_pool_profiles: The list of available upgrade versions for agent pools. Required. :paramtype agent_pool_profiles: list[~azure.mgmt.containerservice.v2021_10_01.models.ManagedClusterPoolUpgradeProfile] """ - super(ManagedClusterUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -4435,18 +4346,18 @@ def __init__( self.agent_pool_profiles = agent_pool_profiles -class ManagedClusterWindowsProfile(msrest.serialization.Model): +class ManagedClusterWindowsProfile(_serialization.Model): """Profile for Windows VMs in the managed cluster. All required parameters must be populated in order to send to Azure. - :ivar admin_username: Required. Specifies the name of the administrator account. - :code:`
`:code:`
` **Restriction:** Cannot end in "." :code:`
`:code:`
` - **Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", "test1", - "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", - "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", - "sys", "test2", "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 - character :code:`
`:code:`
` **Max-length:** 20 characters. + :ivar admin_username: Specifies the name of the administrator account. :code:`
`:code:`
` + **Restriction:** Cannot end in "." :code:`
`:code:`
` **Disallowed values:** + "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", + "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", + "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", + "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 character + :code:`
`:code:`
` **Max-length:** 20 characters. Required. :vartype admin_username: str :ivar admin_password: Specifies the password of the administrator account. :code:`
`:code:`
` **Minimum-length:** 8 characters :code:`
`:code:`
` @@ -4458,7 +4369,7 @@ class ManagedClusterWindowsProfile(msrest.serialization.Model): :vartype admin_password: str :ivar license_type: The license type to use for Windows VMs. See `Azure Hybrid User Benefits `_ for more details. Known values are: - "None", "Windows_Server". + "None" and "Windows_Server". :vartype license_type: str or ~azure.mgmt.containerservice.v2021_10_01.models.LicenseType :ivar enable_csi_proxy: For more details on CSI proxy, see the `CSI proxy GitHub repo `_. @@ -4468,15 +4379,15 @@ class ManagedClusterWindowsProfile(msrest.serialization.Model): """ _validation = { - 'admin_username': {'required': True}, + "admin_username": {"required": True}, } _attribute_map = { - 'admin_username': {'key': 'adminUsername', 'type': 'str'}, - 'admin_password': {'key': 'adminPassword', 'type': 'str'}, - 'license_type': {'key': 'licenseType', 'type': 'str'}, - 'enable_csi_proxy': {'key': 'enableCSIProxy', 'type': 'bool'}, - 'gmsa_profile': {'key': 'gmsaProfile', 'type': 'WindowsGmsaProfile'}, + "admin_username": {"key": "adminUsername", "type": "str"}, + "admin_password": {"key": "adminPassword", "type": "str"}, + "license_type": {"key": "licenseType", "type": "str"}, + "enable_csi_proxy": {"key": "enableCSIProxy", "type": "bool"}, + "gmsa_profile": {"key": "gmsaProfile", "type": "WindowsGmsaProfile"}, } def __init__( @@ -4490,13 +4401,13 @@ def __init__( **kwargs ): """ - :keyword admin_username: Required. Specifies the name of the administrator account. + :keyword admin_username: Specifies the name of the administrator account. :code:`
`:code:`
` **Restriction:** Cannot end in "." :code:`
`:code:`
` **Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 - character :code:`
`:code:`
` **Max-length:** 20 characters. + character :code:`
`:code:`
` **Max-length:** 20 characters. Required. :paramtype admin_username: str :keyword admin_password: Specifies the password of the administrator account. :code:`
`:code:`
` **Minimum-length:** 8 characters :code:`
`:code:`
` @@ -4508,7 +4419,7 @@ def __init__( :paramtype admin_password: str :keyword license_type: The license type to use for Windows VMs. See `Azure Hybrid User Benefits `_ for more details. Known values are: - "None", "Windows_Server". + "None" and "Windows_Server". :paramtype license_type: str or ~azure.mgmt.containerservice.v2021_10_01.models.LicenseType :keyword enable_csi_proxy: For more details on CSI proxy, see the `CSI proxy GitHub repo `_. @@ -4516,7 +4427,7 @@ def __init__( :keyword gmsa_profile: The Windows gMSA Profile in the Managed Cluster. :paramtype gmsa_profile: ~azure.mgmt.containerservice.v2021_10_01.models.WindowsGmsaProfile """ - super(ManagedClusterWindowsProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.admin_username = admin_username self.admin_password = admin_password self.license_type = license_type @@ -4524,7 +4435,7 @@ def __init__( self.gmsa_profile = gmsa_profile -class ManagedServiceIdentityUserAssignedIdentitiesValue(msrest.serialization.Model): +class ManagedServiceIdentityUserAssignedIdentitiesValue(_serialization.Model): """ManagedServiceIdentityUserAssignedIdentitiesValue. Variables are only populated by the server, and will be ignored when sending a request. @@ -4536,27 +4447,23 @@ class ManagedServiceIdentityUserAssignedIdentitiesValue(msrest.serialization.Mod """ _validation = { - 'principal_id': {'readonly': True}, - 'client_id': {'readonly': True}, + "principal_id": {"readonly": True}, + "client_id": {"readonly": True}, } _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, + "principal_id": {"key": "principalId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(ManagedServiceIdentityUserAssignedIdentitiesValue, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.principal_id = None self.client_id = None -class OperationListResult(msrest.serialization.Model): +class OperationListResult(_serialization.Model): """The List Operation response. Variables are only populated by the server, and will be ignored when sending a request. @@ -4566,24 +4473,20 @@ class OperationListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[OperationValue]'}, + "value": {"key": "value", "type": "[OperationValue]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(OperationListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None -class OperationValue(msrest.serialization.Model): +class OperationValue(_serialization.Model): """Describes the properties of a Operation value. Variables are only populated by the server, and will be ignored when sending a request. @@ -4603,30 +4506,26 @@ class OperationValue(msrest.serialization.Model): """ _validation = { - 'origin': {'readonly': True}, - 'name': {'readonly': True}, - 'operation': {'readonly': True}, - 'resource': {'readonly': True}, - 'description': {'readonly': True}, - 'provider': {'readonly': True}, + "origin": {"readonly": True}, + "name": {"readonly": True}, + "operation": {"readonly": True}, + "resource": {"readonly": True}, + "description": {"readonly": True}, + "provider": {"readonly": True}, } _attribute_map = { - 'origin': {'key': 'origin', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'operation': {'key': 'display.operation', 'type': 'str'}, - 'resource': {'key': 'display.resource', 'type': 'str'}, - 'description': {'key': 'display.description', 'type': 'str'}, - 'provider': {'key': 'display.provider', 'type': 'str'}, + "origin": {"key": "origin", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "operation": {"key": "display.operation", "type": "str"}, + "resource": {"key": "display.resource", "type": "str"}, + "description": {"key": "display.description", "type": "str"}, + "provider": {"key": "display.provider", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(OperationValue, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.origin = None self.name = None self.operation = None @@ -4635,7 +4534,7 @@ def __init__( self.provider = None -class OSOptionProfile(msrest.serialization.Model): +class OSOptionProfile(_serialization.Model): """The OS option profile. Variables are only populated by the server, and will be ignored when sending a request. @@ -4648,83 +4547,72 @@ class OSOptionProfile(msrest.serialization.Model): :vartype name: str :ivar type: The type of the OS option resource. :vartype type: str - :ivar os_option_property_list: Required. The list of OS options. + :ivar os_option_property_list: The list of OS options. Required. :vartype os_option_property_list: list[~azure.mgmt.containerservice.v2021_10_01.models.OSOptionProperty] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'os_option_property_list': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "os_option_property_list": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'os_option_property_list': {'key': 'properties.osOptionPropertyList', 'type': '[OSOptionProperty]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "os_option_property_list": {"key": "properties.osOptionPropertyList", "type": "[OSOptionProperty]"}, } - def __init__( - self, - *, - os_option_property_list: List["_models.OSOptionProperty"], - **kwargs - ): + def __init__(self, *, os_option_property_list: List["_models.OSOptionProperty"], **kwargs): """ - :keyword os_option_property_list: Required. The list of OS options. + :keyword os_option_property_list: The list of OS options. Required. :paramtype os_option_property_list: list[~azure.mgmt.containerservice.v2021_10_01.models.OSOptionProperty] """ - super(OSOptionProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None self.os_option_property_list = os_option_property_list -class OSOptionProperty(msrest.serialization.Model): +class OSOptionProperty(_serialization.Model): """OS option property. All required parameters must be populated in order to send to Azure. - :ivar os_type: Required. The OS type. + :ivar os_type: The OS type. Required. :vartype os_type: str - :ivar enable_fips_image: Required. Whether the image is FIPS-enabled. + :ivar enable_fips_image: Whether the image is FIPS-enabled. Required. :vartype enable_fips_image: bool """ _validation = { - 'os_type': {'required': True}, - 'enable_fips_image': {'required': True}, + "os_type": {"required": True}, + "enable_fips_image": {"required": True}, } _attribute_map = { - 'os_type': {'key': 'os-type', 'type': 'str'}, - 'enable_fips_image': {'key': 'enable-fips-image', 'type': 'bool'}, + "os_type": {"key": "os-type", "type": "str"}, + "enable_fips_image": {"key": "enable-fips-image", "type": "bool"}, } - def __init__( - self, - *, - os_type: str, - enable_fips_image: bool, - **kwargs - ): + def __init__(self, *, os_type: str, enable_fips_image: bool, **kwargs): """ - :keyword os_type: Required. The OS type. + :keyword os_type: The OS type. Required. :paramtype os_type: str - :keyword enable_fips_image: Required. Whether the image is FIPS-enabled. + :keyword enable_fips_image: Whether the image is FIPS-enabled. Required. :paramtype enable_fips_image: bool """ - super(OSOptionProperty, self).__init__(**kwargs) + super().__init__(**kwargs) self.os_type = os_type self.enable_fips_image = enable_fips_image -class OutboundEnvironmentEndpoint(msrest.serialization.Model): +class OutboundEnvironmentEndpoint(_serialization.Model): """Egress endpoints which AKS agent nodes connect to for common purpose. :ivar category: The category of endpoints accessed by the AKS agent node, e.g. @@ -4735,8 +4623,8 @@ class OutboundEnvironmentEndpoint(msrest.serialization.Model): """ _attribute_map = { - 'category': {'key': 'category', 'type': 'str'}, - 'endpoints': {'key': 'endpoints', 'type': '[EndpointDependency]'}, + "category": {"key": "category", "type": "str"}, + "endpoints": {"key": "endpoints", "type": "[EndpointDependency]"}, } def __init__( @@ -4753,19 +4641,19 @@ def __init__( :keyword endpoints: The endpoints that AKS agent nodes connect to. :paramtype endpoints: list[~azure.mgmt.containerservice.v2021_10_01.models.EndpointDependency] """ - super(OutboundEnvironmentEndpoint, self).__init__(**kwargs) + super().__init__(**kwargs) self.category = category self.endpoints = endpoints -class OutboundEnvironmentEndpointCollection(msrest.serialization.Model): +class OutboundEnvironmentEndpointCollection(_serialization.Model): """Collection of OutboundEnvironmentEndpoint. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar value: Required. Collection of resources. + :ivar value: Collection of resources. Required. :vartype value: list[~azure.mgmt.containerservice.v2021_10_01.models.OutboundEnvironmentEndpoint] :ivar next_link: Link to next page of resources. @@ -4773,59 +4661,49 @@ class OutboundEnvironmentEndpointCollection(msrest.serialization.Model): """ _validation = { - 'value': {'required': True}, - 'next_link': {'readonly': True}, + "value": {"required": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[OutboundEnvironmentEndpoint]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[OutboundEnvironmentEndpoint]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: List["_models.OutboundEnvironmentEndpoint"], - **kwargs - ): + def __init__(self, *, value: List["_models.OutboundEnvironmentEndpoint"], **kwargs): """ - :keyword value: Required. Collection of resources. + :keyword value: Collection of resources. Required. :paramtype value: list[~azure.mgmt.containerservice.v2021_10_01.models.OutboundEnvironmentEndpoint] """ - super(OutboundEnvironmentEndpointCollection, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class PowerState(msrest.serialization.Model): +class PowerState(_serialization.Model): """Describes the Power State of the cluster. - :ivar code: Tells whether the cluster is Running or Stopped. Known values are: "Running", + :ivar code: Tells whether the cluster is Running or Stopped. Known values are: "Running" and "Stopped". :vartype code: str or ~azure.mgmt.containerservice.v2021_10_01.models.Code """ _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, + "code": {"key": "code", "type": "str"}, } - def __init__( - self, - *, - code: Optional[Union[str, "_models.Code"]] = None, - **kwargs - ): + def __init__(self, *, code: Optional[Union[str, "_models.Code"]] = None, **kwargs): """ - :keyword code: Tells whether the cluster is Running or Stopped. Known values are: "Running", + :keyword code: Tells whether the cluster is Running or Stopped. Known values are: "Running" and "Stopped". :paramtype code: str or ~azure.mgmt.containerservice.v2021_10_01.models.Code """ - super(PowerState, self).__init__(**kwargs) + super().__init__(**kwargs) self.code = code -class PrivateEndpoint(msrest.serialization.Model): +class PrivateEndpoint(_serialization.Model): """Private endpoint which a connection belongs to. :ivar id: The resource ID of the private endpoint. @@ -4833,24 +4711,19 @@ class PrivateEndpoint(msrest.serialization.Model): """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, } - def __init__( - self, - *, - id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin """ :keyword id: The resource ID of the private endpoint. :paramtype id: str """ - super(PrivateEndpoint, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id -class PrivateEndpointConnection(msrest.serialization.Model): +class PrivateEndpointConnection(_serialization.Model): """A private endpoint connection. Variables are only populated by the server, and will be ignored when sending a request. @@ -4862,7 +4735,7 @@ class PrivateEndpointConnection(msrest.serialization.Model): :ivar type: The resource type. :vartype type: str :ivar provisioning_state: The current provisioning state. Known values are: "Succeeded", - "Creating", "Deleting", "Failed". + "Creating", "Deleting", and "Failed". :vartype provisioning_state: str or ~azure.mgmt.containerservice.v2021_10_01.models.PrivateEndpointConnectionProvisioningState :ivar private_endpoint: The resource of private endpoint. @@ -4874,19 +4747,22 @@ class PrivateEndpointConnection(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'provisioning_state': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, - 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "private_endpoint": {"key": "properties.privateEndpoint", "type": "PrivateEndpoint"}, + "private_link_service_connection_state": { + "key": "properties.privateLinkServiceConnectionState", + "type": "PrivateLinkServiceConnectionState", + }, } def __init__( @@ -4904,7 +4780,7 @@ def __init__( :paramtype private_link_service_connection_state: ~azure.mgmt.containerservice.v2021_10_01.models.PrivateLinkServiceConnectionState """ - super(PrivateEndpointConnection, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -4913,7 +4789,7 @@ def __init__( self.private_link_service_connection_state = private_link_service_connection_state -class PrivateEndpointConnectionListResult(msrest.serialization.Model): +class PrivateEndpointConnectionListResult(_serialization.Model): """A list of private endpoint connections. :ivar value: The collection value. @@ -4921,25 +4797,20 @@ class PrivateEndpointConnectionListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, + "value": {"key": "value", "type": "[PrivateEndpointConnection]"}, } - def __init__( - self, - *, - value: Optional[List["_models.PrivateEndpointConnection"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.PrivateEndpointConnection"]] = None, **kwargs): """ :keyword value: The collection value. :paramtype value: list[~azure.mgmt.containerservice.v2021_10_01.models.PrivateEndpointConnection] """ - super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value -class PrivateLinkResource(msrest.serialization.Model): +class PrivateLinkResource(_serialization.Model): """A private link resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -4960,22 +4831,22 @@ class PrivateLinkResource(msrest.serialization.Model): """ _validation = { - 'private_link_service_id': {'readonly': True}, + "private_link_service_id": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'group_id': {'key': 'groupId', 'type': 'str'}, - 'required_members': {'key': 'requiredMembers', 'type': '[str]'}, - 'private_link_service_id': {'key': 'privateLinkServiceID', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "group_id": {"key": "groupId", "type": "str"}, + "required_members": {"key": "requiredMembers", "type": "[str]"}, + "private_link_service_id": {"key": "privateLinkServiceID", "type": "str"}, } def __init__( self, *, - id: Optional[str] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin name: Optional[str] = None, type: Optional[str] = None, group_id: Optional[str] = None, @@ -4994,7 +4865,7 @@ def __init__( :keyword required_members: The RequiredMembers of the resource. :paramtype required_members: list[str] """ - super(PrivateLinkResource, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id self.name = name self.type = type @@ -5003,7 +4874,7 @@ def __init__( self.private_link_service_id = None -class PrivateLinkResourcesListResult(msrest.serialization.Model): +class PrivateLinkResourcesListResult(_serialization.Model): """A list of private link resources. :ivar value: The collection value. @@ -5011,36 +4882,31 @@ class PrivateLinkResourcesListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, + "value": {"key": "value", "type": "[PrivateLinkResource]"}, } - def __init__( - self, - *, - value: Optional[List["_models.PrivateLinkResource"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.PrivateLinkResource"]] = None, **kwargs): """ :keyword value: The collection value. :paramtype value: list[~azure.mgmt.containerservice.v2021_10_01.models.PrivateLinkResource] """ - super(PrivateLinkResourcesListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value -class PrivateLinkServiceConnectionState(msrest.serialization.Model): +class PrivateLinkServiceConnectionState(_serialization.Model): """The state of a private link service connection. :ivar status: The private link service connection status. Known values are: "Pending", - "Approved", "Rejected", "Disconnected". + "Approved", "Rejected", and "Disconnected". :vartype status: str or ~azure.mgmt.containerservice.v2021_10_01.models.ConnectionStatus :ivar description: The private link service connection description. :vartype description: str """ _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, + "status": {"key": "status", "type": "str"}, + "description": {"key": "description", "type": "str"}, } def __init__( @@ -5052,17 +4918,17 @@ def __init__( ): """ :keyword status: The private link service connection status. Known values are: "Pending", - "Approved", "Rejected", "Disconnected". + "Approved", "Rejected", and "Disconnected". :paramtype status: str or ~azure.mgmt.containerservice.v2021_10_01.models.ConnectionStatus :keyword description: The private link service connection description. :paramtype description: str """ - super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) + super().__init__(**kwargs) self.status = status self.description = description -class ResourceReference(msrest.serialization.Model): +class ResourceReference(_serialization.Model): """A reference to an Azure resource. :ivar id: The fully qualified Azure resource id. @@ -5070,29 +4936,24 @@ class ResourceReference(msrest.serialization.Model): """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, } - def __init__( - self, - *, - id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin """ :keyword id: The fully qualified Azure resource id. :paramtype id: str """ - super(ResourceReference, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id -class RunCommandRequest(msrest.serialization.Model): +class RunCommandRequest(_serialization.Model): """A run command request. All required parameters must be populated in order to send to Azure. - :ivar command: Required. The command to run. + :ivar command: The command to run. Required. :vartype command: str :ivar context: A base64 encoded zip file containing the files required by the command. :vartype context: str @@ -5101,38 +4962,31 @@ class RunCommandRequest(msrest.serialization.Model): """ _validation = { - 'command': {'required': True}, + "command": {"required": True}, } _attribute_map = { - 'command': {'key': 'command', 'type': 'str'}, - 'context': {'key': 'context', 'type': 'str'}, - 'cluster_token': {'key': 'clusterToken', 'type': 'str'}, + "command": {"key": "command", "type": "str"}, + "context": {"key": "context", "type": "str"}, + "cluster_token": {"key": "clusterToken", "type": "str"}, } - def __init__( - self, - *, - command: str, - context: Optional[str] = None, - cluster_token: Optional[str] = None, - **kwargs - ): + def __init__(self, *, command: str, context: Optional[str] = None, cluster_token: Optional[str] = None, **kwargs): """ - :keyword command: Required. The command to run. + :keyword command: The command to run. Required. :paramtype command: str :keyword context: A base64 encoded zip file containing the files required by the command. :paramtype context: str :keyword cluster_token: AuthToken issued for AKS AAD Server App. :paramtype cluster_token: str """ - super(RunCommandRequest, self).__init__(**kwargs) + super().__init__(**kwargs) self.command = command self.context = context self.cluster_token = cluster_token -class RunCommandResult(msrest.serialization.Model): +class RunCommandResult(_serialization.Model): """run command result. Variables are only populated by the server, and will be ignored when sending a request. @@ -5154,32 +5008,28 @@ class RunCommandResult(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'exit_code': {'readonly': True}, - 'started_at': {'readonly': True}, - 'finished_at': {'readonly': True}, - 'logs': {'readonly': True}, - 'reason': {'readonly': True}, + "id": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "exit_code": {"readonly": True}, + "started_at": {"readonly": True}, + "finished_at": {"readonly": True}, + "logs": {"readonly": True}, + "reason": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'exit_code': {'key': 'properties.exitCode', 'type': 'int'}, - 'started_at': {'key': 'properties.startedAt', 'type': 'iso-8601'}, - 'finished_at': {'key': 'properties.finishedAt', 'type': 'iso-8601'}, - 'logs': {'key': 'properties.logs', 'type': 'str'}, - 'reason': {'key': 'properties.reason', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(RunCommandResult, self).__init__(**kwargs) + "id": {"key": "id", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "exit_code": {"key": "properties.exitCode", "type": "int"}, + "started_at": {"key": "properties.startedAt", "type": "iso-8601"}, + "finished_at": {"key": "properties.finishedAt", "type": "iso-8601"}, + "logs": {"key": "properties.logs", "type": "str"}, + "reason": {"key": "properties.reason", "type": "str"}, + } + + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.id = None self.provisioning_state = None self.exit_code = None @@ -5189,7 +5039,7 @@ def __init__( self.reason = None -class Snapshot(Resource): +class Snapshot(Resource): # pylint: disable=too-many-instance-attributes """A node pool snapshot resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -5202,27 +5052,26 @@ class Snapshot(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar system_data: The system metadata relating to this snapshot. :vartype system_data: ~azure.mgmt.containerservice.v2021_10_01.models.SystemData :ivar creation_data: CreationData to be used to specify the source agent pool resource ID to create this snapshot. :vartype creation_data: ~azure.mgmt.containerservice.v2021_10_01.models.CreationData - :ivar snapshot_type: The type of a snapshot. The default is NodePool. Known values are: - "NodePool". Default value: "NodePool". + :ivar snapshot_type: The type of a snapshot. The default is NodePool. "NodePool" :vartype snapshot_type: str or ~azure.mgmt.containerservice.v2021_10_01.models.SnapshotType :ivar kubernetes_version: The version of Kubernetes. :vartype kubernetes_version: str :ivar node_image_version: The version of node image. :vartype node_image_version: str - :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2021_10_01.models.OSType :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known - values are: "Ubuntu", "CBLMariner". + values are: "Ubuntu" and "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2021_10_01.models.OSSKU :ivar vm_size: The size of the VM. :vartype vm_size: str @@ -5231,34 +5080,34 @@ class Snapshot(Resource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'system_data': {'readonly': True}, - 'kubernetes_version': {'readonly': True}, - 'node_image_version': {'readonly': True}, - 'os_type': {'readonly': True}, - 'os_sku': {'readonly': True}, - 'vm_size': {'readonly': True}, - 'enable_fips': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, + "system_data": {"readonly": True}, + "kubernetes_version": {"readonly": True}, + "node_image_version": {"readonly": True}, + "os_type": {"readonly": True}, + "os_sku": {"readonly": True}, + "vm_size": {"readonly": True}, + "enable_fips": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'creation_data': {'key': 'properties.creationData', 'type': 'CreationData'}, - 'snapshot_type': {'key': 'properties.snapshotType', 'type': 'str'}, - 'kubernetes_version': {'key': 'properties.kubernetesVersion', 'type': 'str'}, - 'node_image_version': {'key': 'properties.nodeImageVersion', 'type': 'str'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'os_sku': {'key': 'properties.osSku', 'type': 'str'}, - 'vm_size': {'key': 'properties.vmSize', 'type': 'str'}, - 'enable_fips': {'key': 'properties.enableFIPS', 'type': 'bool'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "creation_data": {"key": "properties.creationData", "type": "CreationData"}, + "snapshot_type": {"key": "properties.snapshotType", "type": "str"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "node_image_version": {"key": "properties.nodeImageVersion", "type": "str"}, + "os_type": {"key": "properties.osType", "type": "str"}, + "os_sku": {"key": "properties.osSku", "type": "str"}, + "vm_size": {"key": "properties.vmSize", "type": "str"}, + "enable_fips": {"key": "properties.enableFIPS", "type": "bool"}, } def __init__( @@ -5267,22 +5116,21 @@ def __init__( location: str, tags: Optional[Dict[str, str]] = None, creation_data: Optional["_models.CreationData"] = None, - snapshot_type: Optional[Union[str, "_models.SnapshotType"]] = "NodePool", + snapshot_type: Union[str, "_models.SnapshotType"] = "NodePool", **kwargs ): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword creation_data: CreationData to be used to specify the source agent pool resource ID to create this snapshot. :paramtype creation_data: ~azure.mgmt.containerservice.v2021_10_01.models.CreationData - :keyword snapshot_type: The type of a snapshot. The default is NodePool. Known values are: - "NodePool". Default value: "NodePool". + :keyword snapshot_type: The type of a snapshot. The default is NodePool. "NodePool" :paramtype snapshot_type: str or ~azure.mgmt.containerservice.v2021_10_01.models.SnapshotType """ - super(Snapshot, self).__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.system_data = None self.creation_data = creation_data self.snapshot_type = snapshot_type @@ -5294,7 +5142,7 @@ def __init__( self.enable_fips = None -class SnapshotListResult(msrest.serialization.Model): +class SnapshotListResult(_serialization.Model): """The response from the List Snapshots operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -5306,30 +5154,25 @@ class SnapshotListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[Snapshot]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[Snapshot]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.Snapshot"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.Snapshot"]] = None, **kwargs): """ :keyword value: The list of snapshots. :paramtype value: list[~azure.mgmt.containerservice.v2021_10_01.models.Snapshot] """ - super(SnapshotListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class SysctlConfig(msrest.serialization.Model): +class SysctlConfig(_serialization.Model): # pylint: disable=too-many-instance-attributes """Sysctl settings for Linux agent nodes. :ivar net_core_somaxconn: Sysctl setting net.core.somaxconn. @@ -5391,37 +5234,37 @@ class SysctlConfig(msrest.serialization.Model): """ _attribute_map = { - 'net_core_somaxconn': {'key': 'netCoreSomaxconn', 'type': 'int'}, - 'net_core_netdev_max_backlog': {'key': 'netCoreNetdevMaxBacklog', 'type': 'int'}, - 'net_core_rmem_default': {'key': 'netCoreRmemDefault', 'type': 'int'}, - 'net_core_rmem_max': {'key': 'netCoreRmemMax', 'type': 'int'}, - 'net_core_wmem_default': {'key': 'netCoreWmemDefault', 'type': 'int'}, - 'net_core_wmem_max': {'key': 'netCoreWmemMax', 'type': 'int'}, - 'net_core_optmem_max': {'key': 'netCoreOptmemMax', 'type': 'int'}, - 'net_ipv4_tcp_max_syn_backlog': {'key': 'netIpv4TcpMaxSynBacklog', 'type': 'int'}, - 'net_ipv4_tcp_max_tw_buckets': {'key': 'netIpv4TcpMaxTwBuckets', 'type': 'int'}, - 'net_ipv4_tcp_fin_timeout': {'key': 'netIpv4TcpFinTimeout', 'type': 'int'}, - 'net_ipv4_tcp_keepalive_time': {'key': 'netIpv4TcpKeepaliveTime', 'type': 'int'}, - 'net_ipv4_tcp_keepalive_probes': {'key': 'netIpv4TcpKeepaliveProbes', 'type': 'int'}, - 'net_ipv4_tcpkeepalive_intvl': {'key': 'netIpv4TcpkeepaliveIntvl', 'type': 'int'}, - 'net_ipv4_tcp_tw_reuse': {'key': 'netIpv4TcpTwReuse', 'type': 'bool'}, - 'net_ipv4_ip_local_port_range': {'key': 'netIpv4IpLocalPortRange', 'type': 'str'}, - 'net_ipv4_neigh_default_gc_thresh1': {'key': 'netIpv4NeighDefaultGcThresh1', 'type': 'int'}, - 'net_ipv4_neigh_default_gc_thresh2': {'key': 'netIpv4NeighDefaultGcThresh2', 'type': 'int'}, - 'net_ipv4_neigh_default_gc_thresh3': {'key': 'netIpv4NeighDefaultGcThresh3', 'type': 'int'}, - 'net_netfilter_nf_conntrack_max': {'key': 'netNetfilterNfConntrackMax', 'type': 'int'}, - 'net_netfilter_nf_conntrack_buckets': {'key': 'netNetfilterNfConntrackBuckets', 'type': 'int'}, - 'fs_inotify_max_user_watches': {'key': 'fsInotifyMaxUserWatches', 'type': 'int'}, - 'fs_file_max': {'key': 'fsFileMax', 'type': 'int'}, - 'fs_aio_max_nr': {'key': 'fsAioMaxNr', 'type': 'int'}, - 'fs_nr_open': {'key': 'fsNrOpen', 'type': 'int'}, - 'kernel_threads_max': {'key': 'kernelThreadsMax', 'type': 'int'}, - 'vm_max_map_count': {'key': 'vmMaxMapCount', 'type': 'int'}, - 'vm_swappiness': {'key': 'vmSwappiness', 'type': 'int'}, - 'vm_vfs_cache_pressure': {'key': 'vmVfsCachePressure', 'type': 'int'}, - } - - def __init__( + "net_core_somaxconn": {"key": "netCoreSomaxconn", "type": "int"}, + "net_core_netdev_max_backlog": {"key": "netCoreNetdevMaxBacklog", "type": "int"}, + "net_core_rmem_default": {"key": "netCoreRmemDefault", "type": "int"}, + "net_core_rmem_max": {"key": "netCoreRmemMax", "type": "int"}, + "net_core_wmem_default": {"key": "netCoreWmemDefault", "type": "int"}, + "net_core_wmem_max": {"key": "netCoreWmemMax", "type": "int"}, + "net_core_optmem_max": {"key": "netCoreOptmemMax", "type": "int"}, + "net_ipv4_tcp_max_syn_backlog": {"key": "netIpv4TcpMaxSynBacklog", "type": "int"}, + "net_ipv4_tcp_max_tw_buckets": {"key": "netIpv4TcpMaxTwBuckets", "type": "int"}, + "net_ipv4_tcp_fin_timeout": {"key": "netIpv4TcpFinTimeout", "type": "int"}, + "net_ipv4_tcp_keepalive_time": {"key": "netIpv4TcpKeepaliveTime", "type": "int"}, + "net_ipv4_tcp_keepalive_probes": {"key": "netIpv4TcpKeepaliveProbes", "type": "int"}, + "net_ipv4_tcpkeepalive_intvl": {"key": "netIpv4TcpkeepaliveIntvl", "type": "int"}, + "net_ipv4_tcp_tw_reuse": {"key": "netIpv4TcpTwReuse", "type": "bool"}, + "net_ipv4_ip_local_port_range": {"key": "netIpv4IpLocalPortRange", "type": "str"}, + "net_ipv4_neigh_default_gc_thresh1": {"key": "netIpv4NeighDefaultGcThresh1", "type": "int"}, + "net_ipv4_neigh_default_gc_thresh2": {"key": "netIpv4NeighDefaultGcThresh2", "type": "int"}, + "net_ipv4_neigh_default_gc_thresh3": {"key": "netIpv4NeighDefaultGcThresh3", "type": "int"}, + "net_netfilter_nf_conntrack_max": {"key": "netNetfilterNfConntrackMax", "type": "int"}, + "net_netfilter_nf_conntrack_buckets": {"key": "netNetfilterNfConntrackBuckets", "type": "int"}, + "fs_inotify_max_user_watches": {"key": "fsInotifyMaxUserWatches", "type": "int"}, + "fs_file_max": {"key": "fsFileMax", "type": "int"}, + "fs_aio_max_nr": {"key": "fsAioMaxNr", "type": "int"}, + "fs_nr_open": {"key": "fsNrOpen", "type": "int"}, + "kernel_threads_max": {"key": "kernelThreadsMax", "type": "int"}, + "vm_max_map_count": {"key": "vmMaxMapCount", "type": "int"}, + "vm_swappiness": {"key": "vmSwappiness", "type": "int"}, + "vm_vfs_cache_pressure": {"key": "vmVfsCachePressure", "type": "int"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, net_core_somaxconn: Optional[int] = None, @@ -5512,7 +5355,7 @@ def __init__( :keyword vm_vfs_cache_pressure: Sysctl setting vm.vfs_cache_pressure. :paramtype vm_vfs_cache_pressure: int """ - super(SysctlConfig, self).__init__(**kwargs) + super().__init__(**kwargs) self.net_core_somaxconn = net_core_somaxconn self.net_core_netdev_max_backlog = net_core_netdev_max_backlog self.net_core_rmem_default = net_core_rmem_default @@ -5543,20 +5386,20 @@ def __init__( self.vm_vfs_cache_pressure = vm_vfs_cache_pressure -class SystemData(msrest.serialization.Model): +class SystemData(_serialization.Model): """Metadata pertaining to creation and last modification of the resource. :ivar created_by: The identity that created the resource. :vartype created_by: str :ivar created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", "Key". + "User", "Application", "ManagedIdentity", and "Key". :vartype created_by_type: str or ~azure.mgmt.containerservice.v2021_10_01.models.CreatedByType :ivar created_at: The UTC timestamp of resource creation. :vartype created_at: ~datetime.datetime :ivar last_modified_by: The identity that last modified the resource. :vartype last_modified_by: str :ivar last_modified_by_type: The type of identity that last modified the resource. Known values - are: "User", "Application", "ManagedIdentity", "Key". + are: "User", "Application", "ManagedIdentity", and "Key". :vartype last_modified_by_type: str or ~azure.mgmt.containerservice.v2021_10_01.models.CreatedByType :ivar last_modified_at: The type of identity that last modified the resource. @@ -5564,12 +5407,12 @@ class SystemData(msrest.serialization.Model): """ _attribute_map = { - 'created_by': {'key': 'createdBy', 'type': 'str'}, - 'created_by_type': {'key': 'createdByType', 'type': 'str'}, - 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, - 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, - 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, - 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + "created_by": {"key": "createdBy", "type": "str"}, + "created_by_type": {"key": "createdByType", "type": "str"}, + "created_at": {"key": "createdAt", "type": "iso-8601"}, + "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, + "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, + "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, } def __init__( @@ -5587,7 +5430,7 @@ def __init__( :keyword created_by: The identity that created the resource. :paramtype created_by: str :keyword created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", "Key". + "User", "Application", "ManagedIdentity", and "Key". :paramtype created_by_type: str or ~azure.mgmt.containerservice.v2021_10_01.models.CreatedByType :keyword created_at: The UTC timestamp of resource creation. @@ -5595,13 +5438,13 @@ def __init__( :keyword last_modified_by: The identity that last modified the resource. :paramtype last_modified_by: str :keyword last_modified_by_type: The type of identity that last modified the resource. Known - values are: "User", "Application", "ManagedIdentity", "Key". + values are: "User", "Application", "ManagedIdentity", and "Key". :paramtype last_modified_by_type: str or ~azure.mgmt.containerservice.v2021_10_01.models.CreatedByType :keyword last_modified_at: The type of identity that last modified the resource. :paramtype last_modified_at: ~datetime.datetime """ - super(SystemData, self).__init__(**kwargs) + super().__init__(**kwargs) self.created_by = created_by self.created_by_type = created_by_type self.created_at = created_at @@ -5610,36 +5453,31 @@ def __init__( self.last_modified_at = last_modified_at -class TagsObject(msrest.serialization.Model): +class TagsObject(_serialization.Model): """Tags object for patch operations. - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] """ _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] """ - super(TagsObject, self).__init__(**kwargs) + super().__init__(**kwargs) self.tags = tags -class TimeInWeek(msrest.serialization.Model): +class TimeInWeek(_serialization.Model): """Time in a week. :ivar day: The day of the week. Known values are: "Sunday", "Monday", "Tuesday", "Wednesday", - "Thursday", "Friday", "Saturday". + "Thursday", "Friday", and "Saturday". :vartype day: str or ~azure.mgmt.containerservice.v2021_10_01.models.WeekDay :ivar hour_slots: Each integer hour represents a time range beginning at 0m after the hour ending at the next hour (non-inclusive). 0 corresponds to 00:00 UTC, 23 corresponds to 23:00 @@ -5648,32 +5486,28 @@ class TimeInWeek(msrest.serialization.Model): """ _attribute_map = { - 'day': {'key': 'day', 'type': 'str'}, - 'hour_slots': {'key': 'hourSlots', 'type': '[int]'}, + "day": {"key": "day", "type": "str"}, + "hour_slots": {"key": "hourSlots", "type": "[int]"}, } def __init__( - self, - *, - day: Optional[Union[str, "_models.WeekDay"]] = None, - hour_slots: Optional[List[int]] = None, - **kwargs + self, *, day: Optional[Union[str, "_models.WeekDay"]] = None, hour_slots: Optional[List[int]] = None, **kwargs ): """ :keyword day: The day of the week. Known values are: "Sunday", "Monday", "Tuesday", - "Wednesday", "Thursday", "Friday", "Saturday". + "Wednesday", "Thursday", "Friday", and "Saturday". :paramtype day: str or ~azure.mgmt.containerservice.v2021_10_01.models.WeekDay :keyword hour_slots: Each integer hour represents a time range beginning at 0m after the hour ending at the next hour (non-inclusive). 0 corresponds to 00:00 UTC, 23 corresponds to 23:00 UTC. Specifying [0, 1] means the 00:00 - 02:00 UTC time range. :paramtype hour_slots: list[int] """ - super(TimeInWeek, self).__init__(**kwargs) + super().__init__(**kwargs) self.day = day self.hour_slots = hour_slots -class TimeSpan(msrest.serialization.Model): +class TimeSpan(_serialization.Model): """For example, between 2021-05-25T13:00:00Z and 2021-05-25T14:00:00Z. :ivar start: The start of a time span. @@ -5683,29 +5517,23 @@ class TimeSpan(msrest.serialization.Model): """ _attribute_map = { - 'start': {'key': 'start', 'type': 'iso-8601'}, - 'end': {'key': 'end', 'type': 'iso-8601'}, + "start": {"key": "start", "type": "iso-8601"}, + "end": {"key": "end", "type": "iso-8601"}, } - def __init__( - self, - *, - start: Optional[datetime.datetime] = None, - end: Optional[datetime.datetime] = None, - **kwargs - ): + def __init__(self, *, start: Optional[datetime.datetime] = None, end: Optional[datetime.datetime] = None, **kwargs): """ :keyword start: The start of a time span. :paramtype start: ~datetime.datetime :keyword end: The end of a time span. :paramtype end: ~datetime.datetime """ - super(TimeSpan, self).__init__(**kwargs) + super().__init__(**kwargs) self.start = start self.end = end -class WindowsGmsaProfile(msrest.serialization.Model): +class WindowsGmsaProfile(_serialization.Model): """Windows gMSA Profile in the managed cluster. :ivar enabled: Specifies whether to enable Windows gMSA in the managed cluster. @@ -5721,9 +5549,9 @@ class WindowsGmsaProfile(msrest.serialization.Model): """ _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'dns_server': {'key': 'dnsServer', 'type': 'str'}, - 'root_domain_name': {'key': 'rootDomainName', 'type': 'str'}, + "enabled": {"key": "enabled", "type": "bool"}, + "dns_server": {"key": "dnsServer", "type": "str"}, + "root_domain_name": {"key": "rootDomainName", "type": "str"}, } def __init__( @@ -5746,7 +5574,7 @@ def __init__( which is used to create the managed cluster. :paramtype root_domain_name: str """ - super(WindowsGmsaProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.dns_server = dns_server self.root_domain_name = root_domain_name diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/models/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/models/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/models/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/models/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/operations/__init__.py index e0748876288c..593b23075ce0 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/operations/__init__.py @@ -18,15 +18,16 @@ from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'Operations', - 'ManagedClustersOperations', - 'MaintenanceConfigurationsOperations', - 'AgentPoolsOperations', - 'PrivateEndpointConnectionsOperations', - 'PrivateLinkResourcesOperations', - 'ResolvePrivateLinkServiceIdOperations', - 'SnapshotsOperations', + "Operations", + "ManagedClustersOperations", + "MaintenanceConfigurationsOperations", + "AgentPoolsOperations", + "PrivateEndpointConnectionsOperations", + "PrivateLinkResourcesOperations", + "ResolvePrivateLinkServiceIdOperations", + "SnapshotsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/operations/_agent_pools_operations.py index 993f4cee3cf5..8ef2e27c98d4 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/operations/_agent_pools_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,288 +27,289 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - *, - json: Optional[_models.AgentPool] = None, - content: Any = None, - **kwargs: Any + _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, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + _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, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_get_upgrade_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_available_agent_pool_versions_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_upgrade_node_image_version_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_upgrade_node_image_version_request( + resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class AgentPoolsOperations: """ @@ -324,47 +330,39 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> Iterable[_models.AgentPoolListResult]: + def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> Iterable["_models.AgentPool"]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AgentPoolListResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_10_01.models.AgentPoolListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either AgentPool or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_10_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -372,16 +370,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -397,10 +390,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -410,54 +401,45 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore @distributed_trace def get( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPool: """Gets the specified managed cluster agent pool. Gets the specified managed cluster agent pool. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPool, or the result of cls(response) + :return: AgentPool or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.AgentPool - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -465,57 +447,60 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore def _create_or_update_initial( self, resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: _models.AgentPool, + parameters: Union[_models.AgentPool, IO], **kwargs: Any ) -> _models.AgentPool: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - _json = self._serialize.body(parameters, 'AgentPool') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "AgentPool") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -523,10 +508,9 @@ def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -534,40 +518,44 @@ def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - @distributed_trace + @overload def begin_create_or_update( self, resource_group_name: str, resource_name: str, agent_pool_name: str, parameters: _models.AgentPool, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.AgentPool]: """Creates or updates an agent pool in the specified managed cluster. Creates or updates an agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str - :param parameters: The agent pool to create or update. + :param parameters: The agent pool to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2021_10_01.models.AgentPool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -579,20 +567,96 @@ def begin_create_or_update( :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_10_01.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AgentPool]: + """Creates or updates an agent pool in the specified managed cluster. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: The agent pool to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_10_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: Union[_models.AgentPool, IO], + **kwargs: Any + ) -> LROPoller[_models.AgentPool]: + """Creates or updates an agent pool in the specified managed cluster. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: The agent pool to create or update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.mgmt.containerservice.v2021_10_01.models.AgentPool or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_10_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -601,66 +665,55 @@ def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -668,10 +721,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -681,26 +733,21 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + def begin_delete( + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> LROPoller[None]: """Deletes an agent pool in the specified managed cluster. Deletes an agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -712,99 +759,85 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPoolUpgradeProfile: """Gets the upgrade profile for an agent pool. Gets the upgrade profile for an agent pool. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolUpgradeProfile, or the result of cls(response) + :return: AgentPoolUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.AgentPoolUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -812,32 +845,27 @@ def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolUpgradeProfile', pipeline_response) + deserialized = self._deserialize("AgentPoolUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore @distributed_trace def get_available_agent_pool_versions( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported Kubernetes versions for the specified agent pool. @@ -845,33 +873,30 @@ def get_available_agent_pool_versions( `_ for more details about the version lifecycle. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolAvailableVersions, or the result of cls(response) + :return: AgentPoolAvailableVersions or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.AgentPoolAvailableVersions - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolAvailableVersions] - request = build_get_available_agent_pool_versions_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_available_agent_pool_versions.metadata['url'], + template_url=self.get_available_agent_pool_versions.metadata["url"], headers=_headers, params=_params, ) @@ -879,52 +904,43 @@ def get_available_agent_pool_versions( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolAvailableVersions', pipeline_response) + deserialized = self._deserialize("AgentPoolAvailableVersions", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_available_agent_pool_versions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore - + get_available_agent_pool_versions.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore def _upgrade_node_image_version_initial( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> Optional[_models.AgentPool]: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.AgentPool]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.AgentPool]] - - request = build_upgrade_node_image_version_request_initial( - subscription_id=self._config.subscription_id, + request = build_upgrade_node_image_version_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._upgrade_node_image_version_initial.metadata['url'], + template_url=self._upgrade_node_image_version_initial.metadata["url"], headers=_headers, params=_params, ) @@ -932,10 +948,9 @@ def _upgrade_node_image_version_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -945,37 +960,34 @@ def _upgrade_node_image_version_initial( deserialized = None response_headers = {} if response.status_code == 202: - response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) - - deserialized = self._deserialize('AgentPool', pipeline_response) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _upgrade_node_image_version_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore - + _upgrade_node_image_version_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore @distributed_trace def begin_upgrade_node_image_version( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any - ) -> LROPoller[_models.AgentPool]: + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any + ) -> LROPoller[None]: """Upgrades the node image version of an agent pool to the latest. Upgrading the node image version of an agent pool applies the newest OS and runtime updates to the nodes. AKS provides one new image per week with the latest updates. For more details on node image versions, see: https://docs.microsoft.com/azure/aks/node-image-upgrade. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -988,59 +1000,54 @@ def begin_upgrade_node_image_version( :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_10_01.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._upgrade_node_image_version_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) - - deserialized = self._deserialize('AgentPool', pipeline_response) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_upgrade_node_image_version.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore + begin_upgrade_node_image_version.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/operations/_maintenance_configurations_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/operations/_maintenance_configurations_operations.py index 355728263588..b6cabb89f340 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/operations/_maintenance_configurations_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/operations/_maintenance_configurations_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,173 +25,173 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +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_managed_cluster_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, config_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 = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "configName": _SERIALIZER.url("config_name", config_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "configName": _SERIALIZER.url("config_name", config_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - config_name: str, - *, - json: Optional[_models.MaintenanceConfiguration] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, resource_name: str, config_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 = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "configName": _SERIALIZER.url("config_name", config_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "configName": _SERIALIZER.url("config_name", config_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, config_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 = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "configName": _SERIALIZER.url("config_name", config_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "configName": _SERIALIZER.url("config_name", config_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class MaintenanceConfigurationsOperations: """ @@ -207,48 +212,43 @@ def __init__(self, *args, **kwargs): 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_managed_cluster( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> Iterable[_models.MaintenanceConfigurationListResult]: + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> Iterable["_models.MaintenanceConfiguration"]: """Gets a list of maintenance configurations in the specified managed cluster. Gets a list of maintenance configurations in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either MaintenanceConfigurationListResult or the result - of cls(response) + :return: An iterator like instance of either MaintenanceConfiguration or the result of + cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_10_01.models.MaintenanceConfigurationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_10_01.models.MaintenanceConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfigurationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfigurationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_managed_cluster_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_managed_cluster.metadata['url'], + template_url=self.list_by_managed_cluster.metadata["url"], headers=_headers, params=_params, ) @@ -256,16 +256,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_managed_cluster_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -281,10 +276,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -294,54 +287,45 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_managed_cluster.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations"} # type: ignore + list_by_managed_cluster.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations"} # type: ignore @distributed_trace def get( - self, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, config_name: str, **kwargs: Any ) -> _models.MaintenanceConfiguration: """Gets the specified maintenance configuration of a managed cluster. Gets the specified maintenance configuration of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: MaintenanceConfiguration, or the result of cls(response) + :return: MaintenanceConfiguration or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.MaintenanceConfiguration - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfiguration] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -349,75 +333,147 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) + deserialized = self._deserialize("MaintenanceConfiguration", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - @distributed_trace + @overload def create_or_update( self, resource_group_name: str, resource_name: str, config_name: str, parameters: _models.MaintenanceConfiguration, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.MaintenanceConfiguration: """Creates or updates a maintenance configuration in the specified managed cluster. Creates or updates a maintenance configuration in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str - :param parameters: The maintenance configuration to create or update. + :param parameters: The maintenance configuration to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2021_10_01.models.MaintenanceConfiguration + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: MaintenanceConfiguration, or the result of cls(response) + :return: MaintenanceConfiguration or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.MaintenanceConfiguration - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configuration in the specified managed cluster. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: The maintenance configuration to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: Union[_models.MaintenanceConfiguration, IO], + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configuration in the specified managed cluster. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: The maintenance configuration to create or update. Is either a model type or + a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_10_01.models.MaintenanceConfiguration or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfiguration] - _json = self._serialize.body(parameters, 'MaintenanceConfiguration') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "MaintenanceConfiguration") request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) @@ -425,68 +481,59 @@ def create_or_update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) + deserialized = self._deserialize("MaintenanceConfiguration", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore @distributed_trace def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, config_name: str, **kwargs: Any ) -> None: """Deletes a maintenance configuration. Deletes a maintenance configuration. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) @@ -494,10 +541,9 @@ def delete( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -507,5 +553,4 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/operations/_managed_clusters_operations.py index 2e617aa06dc9..014364b7a18e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/operations/_managed_clusters_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,200 +27,183 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_get_os_options_request( - subscription_id: str, - location: str, - *, - resource_type: Optional[str] = None, - **kwargs: Any + location: str, subscription_id: str, *, resource_type: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "location": _SERIALIZER.url("location", location, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if resource_type is not None: - _params['resource-type'] = _SERIALIZER.query("resource_type", resource_type, 'str') + _params["resource-type"] = _SERIALIZER.query("resource_type", resource_type, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters") + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters" + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_resource_group_request( - subscription_id: str, - resource_group_name: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters", + ) # 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', min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_upgrade_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_access_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, role_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 = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "roleName": _SERIALIZER.url("role_name", role_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "roleName": _SERIALIZER.url("role_name", role_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_admin_credentials_request( - subscription_id: str, resource_group_name: str, resource_name: str, + subscription_id: str, *, server_fqdn: Optional[str] = None, **kwargs: Any @@ -223,40 +211,44 @@ def build_list_cluster_admin_credentials_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if server_fqdn is not None: - _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + _params["server-fqdn"] = _SERIALIZER.query("server_fqdn", server_fqdn, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_user_credentials_request( - subscription_id: str, resource_group_name: str, resource_name: str, + subscription_id: str, *, server_fqdn: Optional[str] = None, **kwargs: Any @@ -264,40 +256,44 @@ def build_list_cluster_user_credentials_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if server_fqdn is not None: - _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + _params["server-fqdn"] = _SERIALIZER.query("server_fqdn", server_fqdn, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_monitoring_user_credentials_request( - subscription_id: str, resource_group_name: str, resource_name: str, + subscription_id: str, *, server_fqdn: Optional[str] = None, **kwargs: Any @@ -305,520 +301,509 @@ def build_list_cluster_monitoring_user_credentials_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if server_fqdn is not None: - _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + _params["server-fqdn"] = _SERIALIZER.query("server_fqdn", server_fqdn, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: + +def build_get_request(resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedCluster] = None, - content: Any = None, - **kwargs: Any + +def build_create_or_update_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_update_tags_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.TagsObject] = None, - content: Any = None, - **kwargs: Any + +def build_update_tags_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + +def build_delete_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_reset_service_principal_profile_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedClusterServicePrincipalProfile] = None, - content: Any = None, - **kwargs: Any + +def build_reset_service_principal_profile_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_reset_aad_profile_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedClusterAADProfile] = None, - content: Any = None, - **kwargs: Any + +def build_reset_aad_profile_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_rotate_cluster_certificates_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + +def build_rotate_cluster_certificates_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_stop_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + +def build_stop_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_start_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + +def build_start_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_run_command_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.RunCommandRequest] = None, - content: Any = None, - **kwargs: Any + +def build_run_command_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_get_command_result_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - command_id: str, - **kwargs: Any + resource_group_name: str, resource_name: str, command_id: 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "commandId": _SERIALIZER.url("command_id", command_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "commandId": _SERIALIZER.url("command_id", command_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_list_outbound_network_dependencies_endpoints_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + class ManagedClustersOperations: # pylint: disable=too-many-public-methods """ @@ -839,46 +824,39 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def get_os_options( - self, - location: str, - resource_type: Optional[str] = None, - **kwargs: Any + self, location: str, resource_type: Optional[str] = None, **kwargs: Any ) -> _models.OSOptionProfile: """Gets supported OS options in the specified subscription. Gets supported OS options in the specified subscription. - :param location: The name of a supported Azure region. + :param location: The name of a supported Azure region. Required. :type location: str :param resource_type: The resource type for which the OS options needs to be returned. Default value is None. :type resource_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: OSOptionProfile, or the result of cls(response) + :return: OSOptionProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.OSOptionProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OSOptionProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OSOptionProfile] - request = build_get_os_options_request( - subscription_id=self._config.subscription_id, location=location, - api_version=api_version, + subscription_id=self._config.subscription_id, resource_type=resource_type, - template_url=self.get_os_options.metadata['url'], + api_version=api_version, + template_url=self.get_os_options.metadata["url"], headers=_headers, params=_params, ) @@ -886,59 +864,52 @@ def get_os_options( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('OSOptionProfile', pipeline_response) + deserialized = self._deserialize("OSOptionProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_os_options.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default"} # type: ignore - + get_os_options.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default"} # type: ignore @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.ManagedClusterListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.ManagedCluster"]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_10_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_10_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -946,14 +917,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -969,10 +937,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -982,49 +948,41 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> Iterable[_models.ManagedClusterListResult]: + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.ManagedCluster"]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_10_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_10_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -1032,15 +990,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -1056,10 +1010,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1069,50 +1021,42 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.ManagedClusterUpgradeProfile: """Gets the upgrade profile of a managed cluster. Gets the upgrade profile of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterUpgradeProfile, or the result of cls(response) + :return: ManagedClusterUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.ManagedClusterUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -1120,33 +1064,27 @@ def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterUpgradeProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore @distributed_trace def get_access_profile( - self, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, role_name: str, **kwargs: Any ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. @@ -1155,36 +1093,33 @@ def get_access_profile( `ListClusterAdminCredentials `_ . - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param role_name: The name of the role for managed cluster accessProfile resource. + :param role_name: The name of the role for managed cluster accessProfile resource. Required. :type role_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterAccessProfile, or the result of cls(response) + :return: ManagedClusterAccessProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.ManagedClusterAccessProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterAccessProfile] - request = build_get_access_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, role_name=role_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_access_profile.metadata['url'], + template_url=self.get_access_profile.metadata["url"], headers=_headers, params=_params, ) @@ -1192,68 +1127,59 @@ def get_access_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterAccessProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterAccessProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_access_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore - + get_access_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore @distributed_trace def list_cluster_admin_credentials( - self, - resource_group_name: str, - resource_name: str, - server_fqdn: Optional[str] = None, - **kwargs: Any + self, resource_group_name: str, resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any ) -> _models.CredentialResults: """Lists the admin credentials of a managed cluster. Lists the admin credentials of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_admin_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, - template_url=self.list_cluster_admin_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_admin_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -1261,68 +1187,59 @@ def list_cluster_admin_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_admin_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore - + list_cluster_admin_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore @distributed_trace def list_cluster_user_credentials( - self, - resource_group_name: str, - resource_name: str, - server_fqdn: Optional[str] = None, - **kwargs: Any + self, resource_group_name: str, resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any ) -> _models.CredentialResults: """Lists the user credentials of a managed cluster. Lists the user credentials of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, - template_url=self.list_cluster_user_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -1330,68 +1247,59 @@ def list_cluster_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore - + list_cluster_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore @distributed_trace def list_cluster_monitoring_user_credentials( - self, - resource_group_name: str, - resource_name: str, - server_fqdn: Optional[str] = None, - **kwargs: Any + self, resource_group_name: str, resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any ) -> _models.CredentialResults: """Lists the cluster monitoring user credentials of a managed cluster. Lists the cluster monitoring user credentials of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_monitoring_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, - template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_monitoring_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -1399,64 +1307,54 @@ def list_cluster_monitoring_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_monitoring_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore - + list_cluster_monitoring_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore @distributed_trace - def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.ManagedCluster: + def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.ManagedCluster: """Gets a managed cluster. Gets a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedCluster, or the result of cls(response) + :return: ManagedCluster or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.ManagedCluster - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -1464,55 +1362,54 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _create_or_update_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.ManagedCluster, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'ManagedCluster') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedCluster") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1520,10 +1417,9 @@ def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -1531,37 +1427,41 @@ def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - - @distributed_trace + @overload def begin_create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedCluster, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. Creates or updates a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The managed cluster to create or update. + :param parameters: The managed cluster to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2021_10_01.models.ManagedCluster + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1574,90 +1474,155 @@ def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_10_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._create_or_update_initial( # type: ignore - resource_group_name=resource_group_name, - resource_name=resource_name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop('error_map', None) - def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized + @overload + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + Creates or updates a managed cluster. - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_10_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster to create or update. Is either a model type or a IO + type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_10_01.models.ManagedCluster or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_10_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ManagedCluster", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _update_tags_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.TagsObject, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request_initial( - subscription_id=self._config.subscription_id, + request = build_update_tags_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_tags_initial.metadata['url'], + content=_content, + template_url=self._update_tags_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1665,44 +1630,118 @@ def _update_tags_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_tags_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + _update_tags_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - - @distributed_trace + @overload def begin_update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates tags on a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2021_10_01.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_10_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates tags on a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_10_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates tags on a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_10_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1715,20 +1754,17 @@ def begin_update_tags( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_10_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, @@ -1736,64 +1772,54 @@ def begin_update_tags( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1801,10 +1827,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1814,23 +1839,17 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> LROPoller[None]: + def begin_delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> LROPoller[None]: """Deletes a managed cluster. Deletes a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1842,85 +1861,83 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterServicePrincipalProfile, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterServicePrincipalProfile") - request = build_reset_service_principal_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_service_principal_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_service_principal_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_service_principal_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1928,10 +1945,9 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1941,28 +1957,32 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re if cls: return cls(pipeline_response, None, {}) - _reset_service_principal_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore - + _reset_service_principal_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore - @distributed_trace - def begin_reset_service_principal_profile( # pylint: disable=inconsistent-return-statements + @overload + def begin_reset_service_principal_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterServicePrincipalProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: """Reset the Service Principal Profile of a managed cluster. This action cannot be performed on a cluster that is not using a service principal. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The service principal profile to set on the managed cluster. + :param parameters: The service principal profile to set on the managed cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2021_10_01.models.ManagedClusterServicePrincipalProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1973,20 +1993,89 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reset the Service Principal Profile of a managed cluster. + + This action cannot be performed on a cluster that is not using a service principal. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The service principal profile to set on the managed cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Reset the Service Principal Profile of a managed cluster. + + This action cannot be performed on a cluster that is not using a service principal. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The service principal profile to set on the managed cluster. Is either a + model type or a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2021_10_01.models.ManagedClusterServicePrincipalProfile or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1994,67 +2083,68 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_service_principal_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + begin_reset_service_principal_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterAADProfile, + parameters: Union[_models.ManagedClusterAADProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterAADProfile") - request = build_reset_aad_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_aad_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_aad_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_aad_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2062,10 +2152,9 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -2075,27 +2164,103 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement if cls: return cls(pipeline_response, None, {}) - _reset_aad_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - + _reset_aad_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - @distributed_trace - def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements + @overload + def begin_reset_aad_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterAADProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: """Reset the AAD Profile of a managed cluster. Reset the AAD Profile of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The AAD profile to set on the Managed Cluster. + :param parameters: The AAD profile to set on the Managed Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2021_10_01.models.ManagedClusterAADProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reset the AAD Profile of a managed cluster. + + Reset the AAD Profile of a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The AAD profile to set on the Managed Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterAADProfile, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Reset the AAD Profile of a managed cluster. + + Reset the AAD Profile of a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The AAD profile to set on the Managed Cluster. Is either a model type or a + IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_10_01.models.ManagedClusterAADProfile or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -2106,20 +2271,17 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -2127,62 +2289,52 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_aad_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + begin_reset_aad_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_rotate_cluster_certificates_request_initial( - subscription_id=self._config.subscription_id, + request = build_rotate_cluster_certificates_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._rotate_cluster_certificates_initial.metadata['url'], + template_url=self._rotate_cluster_certificates_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2190,10 +2342,9 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -2203,24 +2354,20 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return if cls: return cls(pipeline_response, None, {}) - _rotate_cluster_certificates_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore - + _rotate_cluster_certificates_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore @distributed_trace - def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + def begin_rotate_cluster_certificates( + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> LROPoller[None]: """Rotates the certificates of a managed cluster. See `Certificate rotation `_ for more details about rotating managed cluster certificates. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -2232,80 +2379,67 @@ def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-st Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._rotate_cluster_certificates_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_rotate_cluster_certificates.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore + begin_rotate_cluster_certificates.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore def _stop_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_stop_request_initial( - subscription_id=self._config.subscription_id, + request = build_stop_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._stop_initial.metadata['url'], + template_url=self._stop_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2313,10 +2447,9 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -2326,16 +2459,10 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore - + _stop_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore @distributed_trace - def begin_stop( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> LROPoller[None]: + def begin_stop(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> LROPoller[None]: """Stops a Managed Cluster. This can only be performed on Azure Virtual Machine Scale set backed clusters. Stopping a @@ -2344,9 +2471,9 @@ def begin_stop( # pylint: disable=inconsistent-return-statements `_ for more details about stopping a cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -2358,80 +2485,67 @@ def begin_stop( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._stop_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore + begin_stop.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore def _start_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_start_request_initial( - subscription_id=self._config.subscription_id, + request = build_start_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._start_initial.metadata['url'], + template_url=self._start_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2439,10 +2553,9 @@ def _start_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -2452,24 +2565,18 @@ def _start_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore - + _start_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore @distributed_trace - def begin_start( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> LROPoller[None]: + def begin_start(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> LROPoller[None]: """Starts a previously stopped Managed Cluster. See `starting a cluster `_ for more details about starting a cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -2481,85 +2588,83 @@ def begin_start( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._start_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore + begin_start.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore def _run_command_initial( self, resource_group_name: str, resource_name: str, - request_payload: _models.RunCommandRequest, + request_payload: Union[_models.RunCommandRequest, IO], **kwargs: Any ) -> Optional[_models.RunCommandResult]: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RunCommandResult]] - _json = self._serialize.body(request_payload, 'RunCommandRequest') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(request_payload, (IO, bytes)): + _content = request_payload + else: + _json = self._serialize.body(request_payload, "RunCommandRequest") - request = build_run_command_request_initial( - subscription_id=self._config.subscription_id, + request = build_run_command_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._run_command_initial.metadata['url'], + content=_content, + template_url=self._run_command_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2567,10 +2672,9 @@ def _run_command_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -2579,22 +2683,23 @@ def _run_command_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _run_command_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore - + _run_command_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore - @distributed_trace + @overload def begin_run_command( self, resource_group_name: str, resource_name: str, request_payload: _models.RunCommandRequest, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.RunCommandResult]: """Submits a command to run against the Managed Cluster. @@ -2603,12 +2708,93 @@ def begin_run_command( more information see `AKS Run Command `_. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param request_payload: The run command request. + :param request_payload: The run command request. Required. :type request_payload: ~azure.mgmt.containerservice.v2021_10_01.models.RunCommandRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either RunCommandResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_10_01.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_run_command( + self, + resource_group_name: str, + resource_name: str, + request_payload: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RunCommandResult]: + """Submits a command to run against the Managed Cluster. + + AKS will create a pod to run the command. This is primarily useful for private clusters. For + more information see `AKS Run Command + `_. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param request_payload: The run command request. Required. + :type request_payload: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either RunCommandResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_10_01.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_run_command( + self, + resource_group_name: str, + resource_name: str, + request_payload: Union[_models.RunCommandRequest, IO], + **kwargs: Any + ) -> LROPoller[_models.RunCommandResult]: + """Submits a command to run against the Managed Cluster. + + AKS will create a pod to run the command. This is primarily useful for private clusters. For + more information see `AKS Run Command + `_. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param request_payload: The run command request. Is either a model type or a IO type. Required. + :type request_payload: ~azure.mgmt.containerservice.v2021_10_01.models.RunCommandRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -2621,20 +2807,17 @@ def begin_run_command( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_10_01.models.RunCommandResult] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.RunCommandResult] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.RunCommandResult] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._run_command_initial( # type: ignore resource_group_name=resource_group_name, @@ -2642,82 +2825,71 @@ def begin_run_command( request_payload=request_payload, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_run_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore + begin_run_command.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore @distributed_trace def get_command_result( - self, - resource_group_name: str, - resource_name: str, - command_id: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, command_id: str, **kwargs: Any ) -> Optional[_models.RunCommandResult]: """Gets the results of a command which has been run on the Managed Cluster. Gets the results of a command which has been run on the Managed Cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param command_id: Id of the command. + :param command_id: Id of the command. Required. :type command_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: RunCommandResult, or the result of cls(response) + :return: RunCommandResult or None or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.RunCommandResult or None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RunCommandResult]] - request = build_get_command_result_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, command_id=command_id, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_command_result.metadata['url'], + template_url=self.get_command_result.metadata["url"], headers=_headers, params=_params, ) @@ -2725,10 +2897,9 @@ def get_command_result( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -2737,59 +2908,54 @@ def get_command_result( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_command_result.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}"} # type: ignore - + get_command_result.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}"} # type: ignore @distributed_trace def list_outbound_network_dependencies_endpoints( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> Iterable[_models.OutboundEnvironmentEndpointCollection]: + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> Iterable["_models.OutboundEnvironmentEndpoint"]: """Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster. Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster. The operation returns properties of each egress endpoint. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OutboundEnvironmentEndpointCollection or the - result of cls(response) + :return: An iterator like instance of either OutboundEnvironmentEndpoint or the result of + cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_10_01.models.OutboundEnvironmentEndpointCollection] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_10_01.models.OutboundEnvironmentEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_outbound_network_dependencies_endpoints_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_outbound_network_dependencies_endpoints.metadata['url'], + template_url=self.list_outbound_network_dependencies_endpoints.metadata["url"], headers=_headers, params=_params, ) @@ -2797,16 +2963,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_outbound_network_dependencies_endpoints_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -2822,10 +2983,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2835,8 +2994,6 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_outbound_network_dependencies_endpoints.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints"} # type: ignore + list_outbound_network_dependencies_endpoints.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/operations/_operations.py index 8f999943a400..1e639b906eae 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/operations/_operations.py @@ -7,10 +7,15 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,38 +25,34 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - **kwargs: Any -) -> HttpRequest: + +def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.ContainerService/operations") # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class Operations: """ @@ -72,38 +73,33 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.OperationListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.OperationValue"]: """Gets a list of operations. Gets a list of operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationListResult or the result of cls(response) + :return: An iterator like instance of either OperationValue or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_10_01.models.OperationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_10_01.models.OperationValue] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -111,13 +107,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -133,10 +127,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -146,8 +138,6 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.ContainerService/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ContainerService/operations"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/operations/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/operations/_private_endpoint_connections_operations.py index 26b8d394c6b5..4cee8dca731c 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/operations/_private_endpoint_connections_operations.py @@ -6,11 +6,15 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod @@ -21,173 +25,191 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - subscription_id: str, resource_group_name: str, resource_name: str, private_endpoint_connection_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 = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_update_request( - subscription_id: str, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, - *, - json: Optional[_models.PrivateEndpointConnection] = None, - content: Any = None, + subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request_initial( - subscription_id: str, +def build_delete_request( resource_group_name: str, resource_name: str, private_endpoint_connection_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 = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class PrivateEndpointConnectionsOperations: """ @@ -208,46 +230,39 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnectionListResult: """Gets a list of private endpoint connections in the specified managed cluster. To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnectionListResult, or the result of cls(response) + :return: PrivateEndpointConnectionListResult or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.PrivateEndpointConnectionListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnectionListResult] - request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -255,69 +270,60 @@ def list( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore - + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore @distributed_trace def get( - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnection: """Gets the specified private endpoint connection. To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -325,75 +331,147 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - - @distributed_trace + @overload def update( self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, parameters: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateEndpointConnection: """Updates a private endpoint connection. Updates a private endpoint connection. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str - :param parameters: The updated private endpoint connection. + :param parameters: The updated private endpoint connection. Required. :type parameters: ~azure.mgmt.containerservice.v2021_10_01.models.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: The updated private endpoint connection. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: Union[_models.PrivateEndpointConnection, IO], + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: The updated private endpoint connection. Is either a model type or a IO + type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_10_01.models.PrivateEndpointConnection or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - _json = self._serialize.body(parameters, 'PrivateEndpointConnection') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateEndpointConnection") request = build_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update.metadata['url'], + content=_content, + template_url=self.update.metadata["url"], headers=_headers, params=_params, ) @@ -401,52 +479,43 @@ def update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -454,10 +523,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -467,26 +535,21 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + def begin_delete( + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> LROPoller[None]: """Deletes a private endpoint connection. Deletes a private endpoint connection. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -498,53 +561,46 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/operations/_private_link_resources_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/operations/_private_link_resources_operations.py index 0ff5e5c92b7d..f9402a2ce617 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/operations/_private_link_resources_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/operations/_private_link_resources_operations.py @@ -8,9 +8,13 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -19,48 +23,53 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class PrivateLinkResourcesOperations: """ @@ -81,46 +90,39 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.PrivateLinkResourcesListResult: """Gets a list of private link resources in the specified managed cluster. To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResourcesListResult, or the result of cls(response) + :return: PrivateLinkResourcesListResult or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.PrivateLinkResourcesListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResourcesListResult] - request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -128,22 +130,20 @@ def list( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResourcesListResult', pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources"} # type: ignore - + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/operations/_resolve_private_link_service_id_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/operations/_resolve_private_link_service_id_operations.py index 248da1b9e55d..715de4e3a485 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/operations/_resolve_private_link_service_id_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/operations/_resolve_private_link_service_id_operations.py @@ -6,11 +6,15 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -19,56 +23,56 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_post_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.PrivateLinkResource] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + class ResolvePrivateLinkServiceIdOperations: """ @@ -89,52 +93,118 @@ def __init__(self, *args, **kwargs): 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 + @overload def post( self, resource_group_name: str, resource_name: str, parameters: _models.PrivateLinkResource, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateLinkResource: """Gets the private link service ID for the specified managed cluster. Gets the private link service ID for the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters required in order to resolve a private link service ID. + :param parameters: Parameters required in order to resolve a private link service ID. Required. :type parameters: ~azure.mgmt.containerservice.v2021_10_01.models.PrivateLinkResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResource, or the result of cls(response) + :return: PrivateLinkResource or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.PrivateLinkResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + def post( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID for the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters required in order to resolve a private link service ID. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def post( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.PrivateLinkResource, IO], + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID for the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters required in order to resolve a private link service ID. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_10_01.models.PrivateLinkResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResource] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResource] - _json = self._serialize.body(parameters, 'PrivateLinkResource') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateLinkResource") request = build_post_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.post.metadata['url'], + content=_content, + template_url=self.post.metadata["url"], headers=_headers, params=_params, ) @@ -142,22 +212,20 @@ def post( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResource', pipeline_response) + deserialized = self._deserialize("PrivateLinkResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - post.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId"} # type: ignore - + post.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/operations/_snapshots_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/operations/_snapshots_operations.py index b97b3d781f76..26b2168182cb 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/operations/_snapshots_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/operations/_snapshots_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,243 +25,223 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots") path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_resource_group_request( - subscription_id: str, - resource_group_name: str, - **kwargs: Any -) -> HttpRequest: +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots", + ) # 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', min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: + _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, resource_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.Snapshot] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_update_tags_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.TagsObject] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class SnapshotsOperations: """ @@ -277,39 +262,33 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.SnapshotListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.Snapshot"]: """Gets a list of snapshots in the specified subscription. Gets a list of snapshots in the specified subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SnapshotListResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_10_01.models.SnapshotListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either Snapshot or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_10_01.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SnapshotListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -317,14 +296,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -340,10 +316,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -353,48 +327,40 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots"} # type: ignore @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> Iterable[_models.SnapshotListResult]: + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Snapshot"]: """Lists snapshots in the specified subscription and resource group. Lists snapshots in the specified subscription and resource group. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SnapshotListResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_10_01.models.SnapshotListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either Snapshot or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_10_01.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SnapshotListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -402,15 +368,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -426,10 +388,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -439,50 +399,40 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots"} # type: ignore @distributed_trace - def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.Snapshot: + def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.Snapshot: """Gets a snapshot. Gets a snapshot. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Snapshot, or the result of cls(response) + :return: Snapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.Snapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -490,71 +440,132 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - @distributed_trace + @overload def create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.Snapshot, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.Snapshot: """Creates or updates a snapshot. Creates or updates a snapshot. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The snapshot to create or update. + :param parameters: The snapshot to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2021_10_01.models.Snapshot + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Snapshot, or the result of cls(response) + :return: Snapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.Snapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Snapshot: + """Creates or updates a snapshot. + + Creates or updates a snapshot. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The snapshot to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.Snapshot, IO], **kwargs: Any + ) -> _models.Snapshot: + """Creates or updates a snapshot. + + Creates or updates a snapshot. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The snapshot to create or update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.mgmt.containerservice.v2021_10_01.models.Snapshot or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] - _json = self._serialize.body(parameters, 'Snapshot') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "Snapshot") request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) @@ -562,10 +573,9 @@ def create_or_update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -573,64 +583,126 @@ def create_or_update( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - - @distributed_trace + @overload def update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.Snapshot: """Updates tags on a snapshot. Updates tags on a snapshot. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update snapshot Tags operation. + :param parameters: Parameters supplied to the Update snapshot Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2021_10_01.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Snapshot, or the result of cls(response) + :return: Snapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.Snapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + def update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Snapshot: + """Updates tags on a snapshot. + + Updates tags on a snapshot. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update snapshot Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> _models.Snapshot: + """Updates tags on a snapshot. + + Updates tags on a snapshot. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update snapshot Tags operation. Is either a model + type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_10_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") request = build_update_tags_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_tags.metadata['url'], + content=_content, + template_url=self.update_tags.metadata["url"], headers=_headers, params=_params, ) @@ -638,64 +710,56 @@ def update_tags( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - + update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore @distributed_trace def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: """Deletes a snapshot. Deletes a snapshot. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) @@ -703,10 +767,9 @@ def delete( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -716,5 +779,4 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - + delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/__init__.py index 37a5f9e02e6f..a8716d29afe8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/__init__.py @@ -14,7 +14,8 @@ except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['ContainerServiceClient'] + +__all__ = ["ContainerServiceClient"] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/_configuration.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/_configuration.py index b24a0b4bbe3b..fef8ed857ef6 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/_configuration.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/_configuration.py @@ -18,30 +18,26 @@ VERSION = "unknown" + class ContainerServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ContainerServiceClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2021-11-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - **kwargs: Any - ) -> None: + def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ContainerServiceClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + api_version = kwargs.pop("api_version", "2021-11-01-preview") # type: str if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -51,23 +47,24 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-containerservice/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-containerservice/{}".format(VERSION)) self._configure(**kwargs) def _configure( - self, - **kwargs # type: Any + self, **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/_container_service_client.py index 34843360bf09..3c5a210f016e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/_container_service_client.py @@ -9,20 +9,29 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from . import models +from .._serialization import Deserializer, Serializer from ._configuration import ContainerServiceClientConfiguration -from .operations import AgentPoolsOperations, MaintenanceConfigurationsOperations, ManagedClustersOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, ResolvePrivateLinkServiceIdOperations, SnapshotsOperations +from .operations import ( + AgentPoolsOperations, + MaintenanceConfigurationsOperations, + ManagedClustersOperations, + Operations, + PrivateEndpointConnectionsOperations, + PrivateLinkResourcesOperations, + ResolvePrivateLinkServiceIdOperations, + SnapshotsOperations, +) if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class ContainerServiceClient: # pylint: disable=too-many-instance-attributes + +class ContainerServiceClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """The Container Service Client. :ivar operations: Operations operations @@ -48,10 +57,10 @@ class ContainerServiceClient: # pylint: disable=too-many-instance-attributes :ivar snapshots: SnapshotsOperations operations :vartype snapshots: azure.mgmt.containerservice.v2021_11_01_preview.operations.SnapshotsOperations - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -69,25 +78,23 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = ContainerServiceClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = ContainerServiceClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize - ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.managed_clusters = ManagedClustersOperations( self._client, self._config, self._serialize, self._deserialize ) self.maintenance_configurations = MaintenanceConfigurationsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.agent_pools = AgentPoolsOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) self.private_endpoint_connections = PrivateEndpointConnectionsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -97,16 +104,9 @@ def __init__( self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations( self._client, self._config, self._serialize, self._deserialize ) - self.snapshots = SnapshotsOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.snapshots = SnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) - - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> HttpResponse: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -115,7 +115,7 @@ def _send_request( >>> response = client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/_metadata.json b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/_metadata.json index dddc208fab45..0237f0acd5b6 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/_metadata.json +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/_metadata.json @@ -10,20 +10,20 @@ "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { "credential": { - "signature": "credential, # type: \"TokenCredential\"", - "description": "Credential needed for the client to connect to Azure.", + "signature": "credential: \"TokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true }, "subscription_id": { - "signature": "subscription_id, # type: str", - "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "signature": "subscription_id: str,", + "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.", "docstring_type": "str", "required": true } @@ -31,13 +31,13 @@ "async": { "credential": { "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure.", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { "signature": "subscription_id: str,", - "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.", "docstring_type": "str", "required": true } @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=\"https://management.azure.com\", # type: str", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/_patch.py index 74e48ecd07cf..f99e77fef986 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/_patch.py @@ -28,4 +28,4 @@ # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + pass diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/_vendor.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/_vendor.py index 138f663c53a4..9aad73fc743e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/_vendor.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/_vendor.py @@ -7,6 +7,7 @@ from azure.core.pipeline.transport import HttpRequest + def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) @@ -14,6 +15,7 @@ def _convert_request(request, files=None): request.set_formdata_body(files) return request + def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -21,7 +23,5 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [ - c for c in formatted_components if "{}".format(key.args[0]) not in c - ] + components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/__init__.py index 37a5f9e02e6f..a8716d29afe8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/__init__.py @@ -14,7 +14,8 @@ except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['ContainerServiceClient'] + +__all__ = ["ContainerServiceClient"] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/_configuration.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/_configuration.py index 157a01218cb1..e934730db9a8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/_configuration.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/_configuration.py @@ -18,30 +18,26 @@ VERSION = "unknown" + class ContainerServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ContainerServiceClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2021-11-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - **kwargs: Any - ) -> None: + def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ContainerServiceClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + api_version = kwargs.pop("api_version", "2021-11-01-preview") # type: str if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -51,22 +47,21 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-containerservice/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-containerservice/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, - **kwargs: Any - ) -> None: - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/_container_service_client.py index f9fbf2dfcc02..7c99d642240f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/_container_service_client.py @@ -9,20 +9,29 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from .. import models +from ..._serialization import Deserializer, Serializer from ._configuration import ContainerServiceClientConfiguration -from .operations import AgentPoolsOperations, MaintenanceConfigurationsOperations, ManagedClustersOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, ResolvePrivateLinkServiceIdOperations, SnapshotsOperations +from .operations import ( + AgentPoolsOperations, + MaintenanceConfigurationsOperations, + ManagedClustersOperations, + Operations, + PrivateEndpointConnectionsOperations, + PrivateLinkResourcesOperations, + ResolvePrivateLinkServiceIdOperations, + SnapshotsOperations, +) if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class ContainerServiceClient: # pylint: disable=too-many-instance-attributes + +class ContainerServiceClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """The Container Service Client. :ivar operations: Operations operations @@ -48,10 +57,10 @@ class ContainerServiceClient: # pylint: disable=too-many-instance-attributes :ivar snapshots: SnapshotsOperations operations :vartype snapshots: azure.mgmt.containerservice.v2021_11_01_preview.aio.operations.SnapshotsOperations - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -69,25 +78,23 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = ContainerServiceClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = ContainerServiceClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize - ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.managed_clusters = ManagedClustersOperations( self._client, self._config, self._serialize, self._deserialize ) self.maintenance_configurations = MaintenanceConfigurationsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.agent_pools = AgentPoolsOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) self.private_endpoint_connections = PrivateEndpointConnectionsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -97,16 +104,9 @@ def __init__( self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations( self._client, self._config, self._serialize, self._deserialize ) - self.snapshots = SnapshotsOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.snapshots = SnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) - - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -115,7 +115,7 @@ def _send_request( >>> response = await client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/_patch.py index 74e48ecd07cf..f99e77fef986 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/_patch.py @@ -28,4 +28,4 @@ # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + pass diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/operations/__init__.py index e0748876288c..593b23075ce0 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/operations/__init__.py @@ -18,15 +18,16 @@ from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'Operations', - 'ManagedClustersOperations', - 'MaintenanceConfigurationsOperations', - 'AgentPoolsOperations', - 'PrivateEndpointConnectionsOperations', - 'PrivateLinkResourcesOperations', - 'ResolvePrivateLinkServiceIdOperations', - 'SnapshotsOperations', + "Operations", + "ManagedClustersOperations", + "MaintenanceConfigurationsOperations", + "AgentPoolsOperations", + "PrivateEndpointConnectionsOperations", + "PrivateLinkResourcesOperations", + "ResolvePrivateLinkServiceIdOperations", + "SnapshotsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/operations/_agent_pools_operations.py index e9c62ee11d84..c1f6b6719ed8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/operations/_agent_pools_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +29,20 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._agent_pools_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_available_agent_pool_versions_request, build_get_request, build_get_upgrade_profile_request, build_list_request, build_upgrade_node_image_version_request_initial -T = TypeVar('T') +from ...operations._agent_pools_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_available_agent_pool_versions_request, + build_get_request, + build_get_upgrade_profile_request, + build_list_request, + build_upgrade_node_image_version_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class AgentPoolsOperations: """ .. warning:: @@ -45,47 +62,40 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.AgentPoolListResult]: + def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncIterable["_models.AgentPool"]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AgentPoolListResult or the result of cls(response) + :return: An iterator like instance of either AgentPool or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_11_01_preview.models.AgentPoolListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_11_01_preview.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -93,16 +103,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -118,10 +123,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -131,54 +134,45 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore @distributed_trace_async async def get( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPool: """Gets the specified managed cluster agent pool. Gets the specified managed cluster agent pool. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPool, or the result of cls(response) + :return: AgentPool or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.AgentPool - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -186,57 +180,60 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore async def _create_or_update_initial( self, resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: _models.AgentPool, + parameters: Union[_models.AgentPool, IO], **kwargs: Any ) -> _models.AgentPool: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - _json = self._serialize.body(parameters, 'AgentPool') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "AgentPool") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -244,10 +241,9 @@ async def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -255,40 +251,44 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - - @distributed_trace_async + @overload async def begin_create_or_update( self, resource_group_name: str, resource_name: str, agent_pool_name: str, parameters: _models.AgentPool, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.AgentPool]: """Creates or updates an agent pool in the specified managed cluster. Creates or updates an agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str - :param parameters: The agent pool to create or update. + :param parameters: The agent pool to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2021_11_01_preview.models.AgentPool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -301,20 +301,98 @@ async def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_11_01_preview.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AgentPool]: + """Creates or updates an agent pool in the specified managed cluster. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: The agent pool to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AgentPool or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_11_01_preview.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: Union[_models.AgentPool, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.AgentPool]: + """Creates or updates an agent pool in the specified managed cluster. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: The agent pool to create or update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.mgmt.containerservice.v2021_11_01_preview.models.AgentPool or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AgentPool or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_11_01_preview.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -323,66 +401,55 @@ async def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -390,10 +457,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -403,26 +469,21 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + async def begin_delete( + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes an agent pool in the specified managed cluster. Deletes an agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -434,99 +495,85 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace_async async def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPoolUpgradeProfile: """Gets the upgrade profile for an agent pool. Gets the upgrade profile for an agent pool. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolUpgradeProfile, or the result of cls(response) + :return: AgentPoolUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.AgentPoolUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -534,32 +581,27 @@ async def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolUpgradeProfile', pipeline_response) + deserialized = self._deserialize("AgentPoolUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore @distributed_trace_async async def get_available_agent_pool_versions( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported Kubernetes versions for the specified agent pool. @@ -567,33 +609,30 @@ async def get_available_agent_pool_versions( `_ for more details about the version lifecycle. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolAvailableVersions, or the result of cls(response) + :return: AgentPoolAvailableVersions or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.AgentPoolAvailableVersions - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolAvailableVersions] - request = build_get_available_agent_pool_versions_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_available_agent_pool_versions.metadata['url'], + template_url=self.get_available_agent_pool_versions.metadata["url"], headers=_headers, params=_params, ) @@ -601,52 +640,43 @@ async def get_available_agent_pool_versions( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolAvailableVersions', pipeline_response) + deserialized = self._deserialize("AgentPoolAvailableVersions", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_available_agent_pool_versions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore - + get_available_agent_pool_versions.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore async def _upgrade_node_image_version_initial( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> Optional[_models.AgentPool]: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.AgentPool]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.AgentPool]] - - request = build_upgrade_node_image_version_request_initial( - subscription_id=self._config.subscription_id, + request = build_upgrade_node_image_version_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._upgrade_node_image_version_initial.metadata['url'], + template_url=self._upgrade_node_image_version_initial.metadata["url"], headers=_headers, params=_params, ) @@ -654,10 +684,9 @@ async def _upgrade_node_image_version_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -667,37 +696,34 @@ async def _upgrade_node_image_version_initial( deserialized = None response_headers = {} if response.status_code == 202: - response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) - - deserialized = self._deserialize('AgentPool', pipeline_response) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _upgrade_node_image_version_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore - + _upgrade_node_image_version_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore @distributed_trace_async async def begin_upgrade_node_image_version( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any - ) -> AsyncLROPoller[_models.AgentPool]: + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: """Upgrades the node image version of an agent pool to the latest. Upgrading the node image version of an agent pool applies the newest OS and runtime updates to the nodes. AKS provides one new image per week with the latest updates. For more details on node image versions, see: https://docs.microsoft.com/azure/aks/node-image-upgrade. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -711,59 +737,54 @@ async def begin_upgrade_node_image_version( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_11_01_preview.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._upgrade_node_image_version_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) - - deserialized = self._deserialize('AgentPool', pipeline_response) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_upgrade_node_image_version.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore + begin_upgrade_node_image_version.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/operations/_maintenance_configurations_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/operations/_maintenance_configurations_operations.py index 32fe791a20bb..d4bf25fdf447 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/operations/_maintenance_configurations_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/operations/_maintenance_configurations_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,10 +27,17 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._maintenance_configurations_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_managed_cluster_request -T = TypeVar('T') +from ...operations._maintenance_configurations_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_managed_cluster_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class MaintenanceConfigurationsOperations: """ .. warning:: @@ -43,48 +57,43 @@ def __init__(self, *args, **kwargs) -> None: 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_managed_cluster( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.MaintenanceConfigurationListResult]: + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> AsyncIterable["_models.MaintenanceConfiguration"]: """Gets a list of maintenance configurations in the specified managed cluster. Gets a list of maintenance configurations in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either MaintenanceConfigurationListResult or the result - of cls(response) + :return: An iterator like instance of either MaintenanceConfiguration or the result of + cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_11_01_preview.models.MaintenanceConfigurationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_11_01_preview.models.MaintenanceConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfigurationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfigurationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_managed_cluster_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_managed_cluster.metadata['url'], + template_url=self.list_by_managed_cluster.metadata["url"], headers=_headers, params=_params, ) @@ -92,16 +101,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_managed_cluster_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -117,10 +121,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -130,54 +132,45 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_managed_cluster.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations"} # type: ignore + list_by_managed_cluster.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations"} # type: ignore @distributed_trace_async async def get( - self, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, config_name: str, **kwargs: Any ) -> _models.MaintenanceConfiguration: """Gets the specified maintenance configuration of a managed cluster. Gets the specified maintenance configuration of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: MaintenanceConfiguration, or the result of cls(response) + :return: MaintenanceConfiguration or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.MaintenanceConfiguration - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfiguration] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -185,76 +178,148 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) + deserialized = self._deserialize("MaintenanceConfiguration", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - @distributed_trace_async + @overload async def create_or_update( self, resource_group_name: str, resource_name: str, config_name: str, parameters: _models.MaintenanceConfiguration, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.MaintenanceConfiguration: """Creates or updates a maintenance configuration in the specified managed cluster. Creates or updates a maintenance configuration in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str - :param parameters: The maintenance configuration to create or update. + :param parameters: The maintenance configuration to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2021_11_01_preview.models.MaintenanceConfiguration + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configuration in the specified managed cluster. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: The maintenance configuration to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: Union[_models.MaintenanceConfiguration, IO], + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configuration in the specified managed cluster. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: The maintenance configuration to create or update. Is either a model type or + a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2021_11_01_preview.models.MaintenanceConfiguration or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: MaintenanceConfiguration, or the result of cls(response) + :return: MaintenanceConfiguration or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.MaintenanceConfiguration - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfiguration] - _json = self._serialize.body(parameters, 'MaintenanceConfiguration') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "MaintenanceConfiguration") request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) @@ -262,68 +327,59 @@ async def create_or_update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) + deserialized = self._deserialize("MaintenanceConfiguration", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, config_name: str, **kwargs: Any ) -> None: """Deletes a maintenance configuration. Deletes a maintenance configuration. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) @@ -331,10 +387,9 @@ async def delete( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -344,5 +399,4 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/operations/_managed_clusters_operations.py index ab219076d55e..d8a1f837d4ae 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/operations/_managed_clusters_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +29,33 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._managed_clusters_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_access_profile_request, build_get_command_result_request, build_get_os_options_request, build_get_request, build_get_upgrade_profile_request, build_list_by_resource_group_request, build_list_cluster_admin_credentials_request, build_list_cluster_monitoring_user_credentials_request, build_list_cluster_user_credentials_request, build_list_outbound_network_dependencies_endpoints_request, build_list_request, build_reset_aad_profile_request_initial, build_reset_service_principal_profile_request_initial, build_rotate_cluster_certificates_request_initial, build_run_command_request_initial, build_start_request_initial, build_stop_request_initial, build_update_tags_request_initial -T = TypeVar('T') +from ...operations._managed_clusters_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_access_profile_request, + build_get_command_result_request, + build_get_os_options_request, + build_get_request, + build_get_upgrade_profile_request, + build_list_by_resource_group_request, + build_list_cluster_admin_credentials_request, + build_list_cluster_monitoring_user_credentials_request, + build_list_cluster_user_credentials_request, + build_list_outbound_network_dependencies_endpoints_request, + build_list_request, + build_reset_aad_profile_request, + build_reset_service_principal_profile_request, + build_rotate_cluster_certificates_request, + build_run_command_request, + build_start_request, + build_stop_request, + build_update_tags_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class ManagedClustersOperations: # pylint: disable=too-many-public-methods """ .. warning:: @@ -45,46 +75,39 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async async def get_os_options( - self, - location: str, - resource_type: Optional[str] = None, - **kwargs: Any + self, location: str, resource_type: Optional[str] = None, **kwargs: Any ) -> _models.OSOptionProfile: """Gets supported OS options in the specified subscription. Gets supported OS options in the specified subscription. - :param location: The name of a supported Azure region. + :param location: The name of a supported Azure region. Required. :type location: str :param resource_type: The resource type for which the OS options needs to be returned. Default value is None. :type resource_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: OSOptionProfile, or the result of cls(response) + :return: OSOptionProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.OSOptionProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OSOptionProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OSOptionProfile] - request = build_get_os_options_request( - subscription_id=self._config.subscription_id, location=location, - api_version=api_version, + subscription_id=self._config.subscription_id, resource_type=resource_type, - template_url=self.get_os_options.metadata['url'], + api_version=api_version, + template_url=self.get_os_options.metadata["url"], headers=_headers, params=_params, ) @@ -92,59 +115,52 @@ async def get_os_options( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('OSOptionProfile', pipeline_response) + deserialized = self._deserialize("OSOptionProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_os_options.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default"} # type: ignore - + get_os_options.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default"} # type: ignore @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.ManagedClusterListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.ManagedCluster"]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_11_01_preview.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_11_01_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -152,14 +168,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -175,10 +188,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -188,49 +199,43 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.ManagedClusterListResult]: + self, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ManagedCluster"]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_11_01_preview.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_11_01_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -238,15 +243,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -262,10 +263,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -275,50 +274,42 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace_async async def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.ManagedClusterUpgradeProfile: """Gets the upgrade profile of a managed cluster. Gets the upgrade profile of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterUpgradeProfile, or the result of cls(response) + :return: ManagedClusterUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.ManagedClusterUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -326,33 +317,27 @@ async def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterUpgradeProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore @distributed_trace_async async def get_access_profile( - self, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, role_name: str, **kwargs: Any ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. @@ -361,36 +346,33 @@ async def get_access_profile( `ListClusterAdminCredentials `_ . - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param role_name: The name of the role for managed cluster accessProfile resource. + :param role_name: The name of the role for managed cluster accessProfile resource. Required. :type role_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterAccessProfile, or the result of cls(response) + :return: ManagedClusterAccessProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.ManagedClusterAccessProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterAccessProfile] - request = build_get_access_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, role_name=role_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_access_profile.metadata['url'], + template_url=self.get_access_profile.metadata["url"], headers=_headers, params=_params, ) @@ -398,68 +380,59 @@ async def get_access_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterAccessProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterAccessProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_access_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore - + get_access_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore @distributed_trace_async async def list_cluster_admin_credentials( - self, - resource_group_name: str, - resource_name: str, - server_fqdn: Optional[str] = None, - **kwargs: Any + self, resource_group_name: str, resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any ) -> _models.CredentialResults: """Lists the admin credentials of a managed cluster. Lists the admin credentials of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_admin_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, - template_url=self.list_cluster_admin_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_admin_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -467,68 +440,59 @@ async def list_cluster_admin_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_admin_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore - + list_cluster_admin_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore @distributed_trace_async async def list_cluster_user_credentials( - self, - resource_group_name: str, - resource_name: str, - server_fqdn: Optional[str] = None, - **kwargs: Any + self, resource_group_name: str, resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any ) -> _models.CredentialResults: """Lists the user credentials of a managed cluster. Lists the user credentials of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, - template_url=self.list_cluster_user_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -536,68 +500,59 @@ async def list_cluster_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore - + list_cluster_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore @distributed_trace_async async def list_cluster_monitoring_user_credentials( - self, - resource_group_name: str, - resource_name: str, - server_fqdn: Optional[str] = None, - **kwargs: Any + self, resource_group_name: str, resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any ) -> _models.CredentialResults: """Lists the cluster monitoring user credentials of a managed cluster. Lists the cluster monitoring user credentials of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_monitoring_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, - template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_monitoring_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -605,64 +560,54 @@ async def list_cluster_monitoring_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_monitoring_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore - + list_cluster_monitoring_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore @distributed_trace_async - async def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.ManagedCluster: + async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.ManagedCluster: """Gets a managed cluster. Gets a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedCluster, or the result of cls(response) + :return: ManagedCluster or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.ManagedCluster - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -670,55 +615,54 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _create_or_update_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.ManagedCluster, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'ManagedCluster') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedCluster") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -726,10 +670,9 @@ async def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -737,37 +680,79 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - - @distributed_trace_async + @overload async def begin_create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedCluster, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. Creates or updates a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The managed cluster to create or update. + :param parameters: The managed cluster to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2021_11_01_preview.models.ManagedCluster + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_11_01_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -780,20 +765,50 @@ async def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_11_01_preview.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster to create or update. Is either a model type or a IO + type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_11_01_preview.models.ManagedCluster or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_11_01_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -801,69 +816,66 @@ async def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _update_tags_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.TagsObject, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request_initial( - subscription_id=self._config.subscription_id, + request = build_update_tags_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_tags_initial.metadata['url'], + content=_content, + template_url=self._update_tags_initial.metadata["url"], headers=_headers, params=_params, ) @@ -871,44 +883,85 @@ async def _update_tags_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_tags_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + _update_tags_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - - @distributed_trace_async + @overload async def begin_update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates tags on a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2021_11_01_preview.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_11_01_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates tags on a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -921,20 +974,50 @@ async def begin_update_tags( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_11_01_preview.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates tags on a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_11_01_preview.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_11_01_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, @@ -942,64 +1025,54 @@ async def begin_update_tags( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1007,10 +1080,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1020,23 +1092,17 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: + async def begin_delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Deletes a managed cluster. Deletes a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1048,85 +1114,83 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterServicePrincipalProfile, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterServicePrincipalProfile") - request = build_reset_service_principal_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_service_principal_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_service_principal_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_service_principal_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1134,10 +1198,9 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1147,28 +1210,105 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist if cls: return cls(pipeline_response, None, {}) - _reset_service_principal_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + _reset_service_principal_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + @overload + async def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.ManagedClusterServicePrincipalProfile, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset the Service Principal Profile of a managed cluster. + + This action cannot be performed on a cluster that is not using a service principal. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The service principal profile to set on the managed cluster. Required. + :type parameters: + ~azure.mgmt.containerservice.v2021_11_01_preview.models.ManagedClusterServicePrincipalProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset the Service Principal Profile of a managed cluster. + + This action cannot be performed on a cluster that is not using a service principal. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The service principal profile to set on the managed cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async - async def begin_reset_service_principal_profile( # pylint: disable=inconsistent-return-statements + async def begin_reset_service_principal_profile( self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterServicePrincipalProfile, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], **kwargs: Any ) -> AsyncLROPoller[None]: """Reset the Service Principal Profile of a managed cluster. This action cannot be performed on a cluster that is not using a service principal. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The service principal profile to set on the managed cluster. + :param parameters: The service principal profile to set on the managed cluster. Is either a + model type or a IO type. Required. :type parameters: ~azure.mgmt.containerservice.v2021_11_01_preview.models.ManagedClusterServicePrincipalProfile + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -1179,20 +1319,17 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1200,67 +1337,68 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_service_principal_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + begin_reset_service_principal_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterAADProfile, + parameters: Union[_models.ManagedClusterAADProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterAADProfile") - request = build_reset_aad_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_aad_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_aad_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_aad_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1268,10 +1406,9 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1281,28 +1418,104 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta if cls: return cls(pipeline_response, None, {}) - _reset_aad_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + _reset_aad_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - - @distributed_trace_async - async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements + @overload + async def begin_reset_aad_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterAADProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: """Reset the AAD Profile of a managed cluster. Reset the AAD Profile of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The AAD profile to set on the Managed Cluster. + :param parameters: The AAD profile to set on the Managed Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2021_11_01_preview.models.ManagedClusterAADProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset the AAD Profile of a managed cluster. + + Reset the AAD Profile of a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The AAD profile to set on the Managed Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterAADProfile, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset the AAD Profile of a managed cluster. + + Reset the AAD Profile of a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The AAD profile to set on the Managed Cluster. Is either a model type or a + IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2021_11_01_preview.models.ManagedClusterAADProfile or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -1313,20 +1526,17 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1334,62 +1544,52 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_aad_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + begin_reset_aad_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_rotate_cluster_certificates_request_initial( - subscription_id=self._config.subscription_id, + request = build_rotate_cluster_certificates_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._rotate_cluster_certificates_initial.metadata['url'], + template_url=self._rotate_cluster_certificates_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1397,10 +1597,9 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1410,24 +1609,20 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- if cls: return cls(pipeline_response, None, {}) - _rotate_cluster_certificates_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore - + _rotate_cluster_certificates_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore @distributed_trace_async - async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + async def begin_rotate_cluster_certificates( + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Rotates the certificates of a managed cluster. See `Certificate rotation `_ for more details about rotating managed cluster certificates. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1439,80 +1634,67 @@ async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-ret Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._rotate_cluster_certificates_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_rotate_cluster_certificates.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore + begin_rotate_cluster_certificates.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore async def _stop_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_stop_request_initial( - subscription_id=self._config.subscription_id, + request = build_stop_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._stop_initial.metadata['url'], + template_url=self._stop_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1520,10 +1702,9 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1533,16 +1714,10 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore - + _stop_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore @distributed_trace_async - async def begin_stop( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: + async def begin_stop(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Stops a Managed Cluster. This can only be performed on Azure Virtual Machine Scale set backed clusters. Stopping a @@ -1551,9 +1726,9 @@ async def begin_stop( # pylint: disable=inconsistent-return-statements `_ for more details about stopping a cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1565,80 +1740,67 @@ async def begin_stop( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._stop_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore + begin_stop.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore async def _start_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_start_request_initial( - subscription_id=self._config.subscription_id, + request = build_start_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._start_initial.metadata['url'], + template_url=self._start_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1646,10 +1808,9 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1659,24 +1820,18 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore - + _start_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore @distributed_trace_async - async def begin_start( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: + async def begin_start(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Starts a previously stopped Managed Cluster. See `starting a cluster `_ for more details about starting a cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1688,85 +1843,83 @@ async def begin_start( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._start_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore + begin_start.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore async def _run_command_initial( self, resource_group_name: str, resource_name: str, - request_payload: _models.RunCommandRequest, + request_payload: Union[_models.RunCommandRequest, IO], **kwargs: Any ) -> Optional[_models.RunCommandResult]: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RunCommandResult]] - _json = self._serialize.body(request_payload, 'RunCommandRequest') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(request_payload, (IO, bytes)): + _content = request_payload + else: + _json = self._serialize.body(request_payload, "RunCommandRequest") - request = build_run_command_request_initial( - subscription_id=self._config.subscription_id, + request = build_run_command_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._run_command_initial.metadata['url'], + content=_content, + template_url=self._run_command_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1774,10 +1927,9 @@ async def _run_command_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1786,22 +1938,23 @@ async def _run_command_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _run_command_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore + _run_command_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore - - @distributed_trace_async + @overload async def begin_run_command( self, resource_group_name: str, resource_name: str, request_payload: _models.RunCommandRequest, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.RunCommandResult]: """Submits a command to run against the Managed Cluster. @@ -1810,13 +1963,16 @@ async def begin_run_command( more information see `AKS Run Command `_. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param request_payload: The run command request. + :param request_payload: The run command request. Required. :type request_payload: ~azure.mgmt.containerservice.v2021_11_01_preview.models.RunCommandRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -1829,20 +1985,96 @@ async def begin_run_command( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_11_01_preview.models.RunCommandResult] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_run_command( + self, + resource_group_name: str, + resource_name: str, + request_payload: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.RunCommandResult]: + """Submits a command to run against the Managed Cluster. + + AKS will create a pod to run the command. This is primarily useful for private clusters. For + more information see `AKS Run Command + `_. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param request_payload: The run command request. Required. + :type request_payload: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RunCommandResult or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_11_01_preview.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_run_command( + self, + resource_group_name: str, + resource_name: str, + request_payload: Union[_models.RunCommandRequest, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.RunCommandResult]: + """Submits a command to run against the Managed Cluster. + + AKS will create a pod to run the command. This is primarily useful for private clusters. For + more information see `AKS Run Command + `_. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param request_payload: The run command request. Is either a model type or a IO type. Required. + :type request_payload: + ~azure.mgmt.containerservice.v2021_11_01_preview.models.RunCommandRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RunCommandResult or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_11_01_preview.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.RunCommandResult] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.RunCommandResult] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._run_command_initial( # type: ignore resource_group_name=resource_group_name, @@ -1850,82 +2082,71 @@ async def begin_run_command( request_payload=request_payload, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_run_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore + begin_run_command.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore @distributed_trace_async async def get_command_result( - self, - resource_group_name: str, - resource_name: str, - command_id: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, command_id: str, **kwargs: Any ) -> Optional[_models.RunCommandResult]: """Gets the results of a command which has been run on the Managed Cluster. Gets the results of a command which has been run on the Managed Cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param command_id: Id of the command. + :param command_id: Id of the command. Required. :type command_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: RunCommandResult, or the result of cls(response) + :return: RunCommandResult or None or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.RunCommandResult or None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RunCommandResult]] - request = build_get_command_result_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, command_id=command_id, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_command_result.metadata['url'], + template_url=self.get_command_result.metadata["url"], headers=_headers, params=_params, ) @@ -1933,10 +2154,9 @@ async def get_command_result( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1945,59 +2165,54 @@ async def get_command_result( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_command_result.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}"} # type: ignore - + get_command_result.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}"} # type: ignore @distributed_trace def list_outbound_network_dependencies_endpoints( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.OutboundEnvironmentEndpointCollection]: + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> AsyncIterable["_models.OutboundEnvironmentEndpoint"]: """Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster. Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster. The operation returns properties of each egress endpoint. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OutboundEnvironmentEndpointCollection or the - result of cls(response) + :return: An iterator like instance of either OutboundEnvironmentEndpoint or the result of + cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_11_01_preview.models.OutboundEnvironmentEndpointCollection] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_11_01_preview.models.OutboundEnvironmentEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_outbound_network_dependencies_endpoints_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_outbound_network_dependencies_endpoints.metadata['url'], + template_url=self.list_outbound_network_dependencies_endpoints.metadata["url"], headers=_headers, params=_params, ) @@ -2005,16 +2220,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_outbound_network_dependencies_endpoints_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -2030,10 +2240,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2043,8 +2251,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_outbound_network_dependencies_endpoints.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints"} # type: ignore + list_outbound_network_dependencies_endpoints.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/operations/_operations.py index 9be9cf1ca2fc..9a6636779c1f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/operations/_operations.py @@ -7,9 +7,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,9 +27,11 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._operations import build_list_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class Operations: """ .. warning:: @@ -42,38 +51,33 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.OperationListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.OperationValue"]: """Gets a list of operations. Gets a list of operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationListResult or the result of cls(response) + :return: An iterator like instance of either OperationValue or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_11_01_preview.models.OperationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_11_01_preview.models.OperationValue] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -81,13 +85,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -103,10 +105,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -116,8 +116,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.ContainerService/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ContainerService/operations"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/operations/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/operations/_private_endpoint_connections_operations.py index 065ee6086726..15960a0d14b6 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/operations/_private_endpoint_connections_operations.py @@ -6,9 +6,15 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -20,10 +26,17 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._private_endpoint_connections_operations import build_delete_request_initial, build_get_request, build_list_request, build_update_request -T = TypeVar('T') +from ...operations._private_endpoint_connections_operations import ( + build_delete_request, + build_get_request, + build_list_request, + build_update_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class PrivateEndpointConnectionsOperations: """ .. warning:: @@ -43,47 +56,40 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async async def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnectionListResult: """Gets a list of private endpoint connections in the specified managed cluster. To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnectionListResult, or the result of cls(response) + :return: PrivateEndpointConnectionListResult or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.PrivateEndpointConnectionListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnectionListResult] - request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -91,69 +97,60 @@ async def list( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore - + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore @distributed_trace_async async def get( - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnection: """Gets the specified private endpoint connection. To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -161,76 +158,148 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - @distributed_trace_async + @overload async def update( self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, parameters: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateEndpointConnection: """Updates a private endpoint connection. Updates a private endpoint connection. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str - :param parameters: The updated private endpoint connection. + :param parameters: The updated private endpoint connection. Required. :type parameters: ~azure.mgmt.containerservice.v2021_11_01_preview.models.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: The updated private endpoint connection. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: Union[_models.PrivateEndpointConnection, IO], + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: The updated private endpoint connection. Is either a model type or a IO + type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2021_11_01_preview.models.PrivateEndpointConnection or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - _json = self._serialize.body(parameters, 'PrivateEndpointConnection') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateEndpointConnection") request = build_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update.metadata['url'], + content=_content, + template_url=self.update.metadata["url"], headers=_headers, params=_params, ) @@ -238,52 +307,43 @@ async def update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -291,10 +351,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -304,26 +363,21 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + async def begin_delete( + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes a private endpoint connection. Deletes a private endpoint connection. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -335,53 +389,46 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/operations/_private_link_resources_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/operations/_private_link_resources_operations.py index 01c9e62a1541..392ddffeca73 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/operations/_private_link_resources_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/operations/_private_link_resources_operations.py @@ -8,7 +8,13 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -19,9 +25,11 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._private_link_resources_operations import build_list_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class PrivateLinkResourcesOperations: """ .. warning:: @@ -41,46 +49,39 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async async def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.PrivateLinkResourcesListResult: """Gets a list of private link resources in the specified managed cluster. To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResourcesListResult, or the result of cls(response) + :return: PrivateLinkResourcesListResult or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.PrivateLinkResourcesListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResourcesListResult] - request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -88,22 +89,20 @@ async def list( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResourcesListResult', pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources"} # type: ignore - + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/operations/_resolve_private_link_service_id_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/operations/_resolve_private_link_service_id_operations.py index 33adceb1f94f..e5b57a9ecbc7 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/operations/_resolve_private_link_service_id_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/operations/_resolve_private_link_service_id_operations.py @@ -6,9 +6,15 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -19,9 +25,11 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._resolve_private_link_service_id_operations import build_post_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class ResolvePrivateLinkServiceIdOperations: """ .. warning:: @@ -41,52 +49,119 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @overload + async def post( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.PrivateLinkResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID for the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters required in order to resolve a private link service ID. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_11_01_preview.models.PrivateLinkResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def post( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID for the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters required in order to resolve a private link service ID. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def post( self, resource_group_name: str, resource_name: str, - parameters: _models.PrivateLinkResource, + parameters: Union[_models.PrivateLinkResource, IO], **kwargs: Any ) -> _models.PrivateLinkResource: """Gets the private link service ID for the specified managed cluster. Gets the private link service ID for the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters required in order to resolve a private link service ID. + :param parameters: Parameters required in order to resolve a private link service ID. Is either + a model type or a IO type. Required. :type parameters: ~azure.mgmt.containerservice.v2021_11_01_preview.models.PrivateLinkResource + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResource, or the result of cls(response) + :return: PrivateLinkResource or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.PrivateLinkResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResource] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResource] - _json = self._serialize.body(parameters, 'PrivateLinkResource') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateLinkResource") request = build_post_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.post.metadata['url'], + content=_content, + template_url=self.post.metadata["url"], headers=_headers, params=_params, ) @@ -94,22 +169,20 @@ async def post( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResource', pipeline_response) + deserialized = self._deserialize("PrivateLinkResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - post.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId"} # type: ignore - + post.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/operations/_snapshots_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/operations/_snapshots_operations.py index e2ec46e2f1c6..7508275ef496 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/operations/_snapshots_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/operations/_snapshots_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,10 +27,19 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._snapshots_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_resource_group_request, build_list_request, build_update_tags_request -T = TypeVar('T') +from ...operations._snapshots_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_resource_group_request, + build_list_request, + build_update_tags_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class SnapshotsOperations: """ .. warning:: @@ -43,39 +59,34 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.SnapshotListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.Snapshot"]: """Gets a list of snapshots in the specified subscription. Gets a list of snapshots in the specified subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SnapshotListResult or the result of cls(response) + :return: An iterator like instance of either Snapshot or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_11_01_preview.models.SnapshotListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_11_01_preview.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SnapshotListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -83,14 +94,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -106,10 +114,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -119,48 +125,41 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots"} # type: ignore @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.SnapshotListResult]: + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.Snapshot"]: """Lists snapshots in the specified subscription and resource group. Lists snapshots in the specified subscription and resource group. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SnapshotListResult or the result of cls(response) + :return: An iterator like instance of either Snapshot or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_11_01_preview.models.SnapshotListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_11_01_preview.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SnapshotListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -168,15 +167,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -192,10 +187,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -205,50 +198,40 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots"} # type: ignore @distributed_trace_async - async def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.Snapshot: + async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.Snapshot: """Gets a snapshot. Gets a snapshot. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Snapshot, or the result of cls(response) + :return: Snapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.Snapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -256,71 +239,132 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - - @distributed_trace_async + @overload async def create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.Snapshot, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.Snapshot: """Creates or updates a snapshot. Creates or updates a snapshot. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The snapshot to create or update. + :param parameters: The snapshot to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2021_11_01_preview.models.Snapshot + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Snapshot: + """Creates or updates a snapshot. + + Creates or updates a snapshot. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The snapshot to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Snapshot, or the result of cls(response) + :return: Snapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.Snapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @distributed_trace_async + async def create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.Snapshot, IO], **kwargs: Any + ) -> _models.Snapshot: + """Creates or updates a snapshot. + + Creates or updates a snapshot. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The snapshot to create or update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.mgmt.containerservice.v2021_11_01_preview.models.Snapshot or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] - _json = self._serialize.body(parameters, 'Snapshot') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "Snapshot") request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) @@ -328,10 +372,9 @@ async def create_or_update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -339,64 +382,126 @@ async def create_or_update( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - @distributed_trace_async + @overload async def update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.Snapshot: """Updates tags on a snapshot. Updates tags on a snapshot. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update snapshot Tags operation. + :param parameters: Parameters supplied to the Update snapshot Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2021_11_01_preview.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Snapshot: + """Updates tags on a snapshot. + + Updates tags on a snapshot. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update snapshot Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> _models.Snapshot: + """Updates tags on a snapshot. + + Updates tags on a snapshot. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update snapshot Tags operation. Is either a model + type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_11_01_preview.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Snapshot, or the result of cls(response) + :return: Snapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.Snapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") request = build_update_tags_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_tags.metadata['url'], + content=_content, + template_url=self.update_tags.metadata["url"], headers=_headers, params=_params, ) @@ -404,64 +509,56 @@ async def update_tags( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - + update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: """Deletes a snapshot. Deletes a snapshot. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) @@ -469,10 +566,9 @@ async def delete( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -482,5 +578,4 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - + delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/models/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/models/__init__.py index a21f3f514121..07400fd6bd22 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/models/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/models/__init__.py @@ -94,170 +94,168 @@ from ._models_py3 import UserAssignedIdentity from ._models_py3 import WindowsGmsaProfile - -from ._container_service_client_enums import ( - AgentPoolMode, - AgentPoolType, - Code, - ConnectionStatus, - ContainerServiceStorageProfileTypes, - ContainerServiceVMSizeTypes, - Count, - CreatedByType, - Expander, - ExtendedLocationTypes, - GPUInstanceProfile, - IpFamily, - KubeletDiskType, - LicenseType, - LoadBalancerSku, - ManagedClusterPodIdentityProvisioningState, - ManagedClusterSKUName, - ManagedClusterSKUTier, - NetworkMode, - NetworkPlugin, - NetworkPolicy, - OSDiskType, - OSSKU, - OSType, - OutboundType, - PrivateEndpointConnectionProvisioningState, - PublicNetworkAccess, - ResourceIdentityType, - ScaleDownMode, - ScaleSetEvictionPolicy, - ScaleSetPriority, - SnapshotType, - UpgradeChannel, - WeekDay, - WorkloadRuntime, -) +from ._container_service_client_enums import AgentPoolMode +from ._container_service_client_enums import AgentPoolType +from ._container_service_client_enums import Code +from ._container_service_client_enums import ConnectionStatus +from ._container_service_client_enums import ContainerServiceStorageProfileTypes +from ._container_service_client_enums import ContainerServiceVMSizeTypes +from ._container_service_client_enums import Count +from ._container_service_client_enums import CreatedByType +from ._container_service_client_enums import Expander +from ._container_service_client_enums import ExtendedLocationTypes +from ._container_service_client_enums import GPUInstanceProfile +from ._container_service_client_enums import IpFamily +from ._container_service_client_enums import KubeletDiskType +from ._container_service_client_enums import LicenseType +from ._container_service_client_enums import LoadBalancerSku +from ._container_service_client_enums import ManagedClusterPodIdentityProvisioningState +from ._container_service_client_enums import ManagedClusterSKUName +from ._container_service_client_enums import ManagedClusterSKUTier +from ._container_service_client_enums import NetworkMode +from ._container_service_client_enums import NetworkPlugin +from ._container_service_client_enums import NetworkPolicy +from ._container_service_client_enums import OSDiskType +from ._container_service_client_enums import OSSKU +from ._container_service_client_enums import OSType +from ._container_service_client_enums import OutboundType +from ._container_service_client_enums import PrivateEndpointConnectionProvisioningState +from ._container_service_client_enums import PublicNetworkAccess +from ._container_service_client_enums import ResourceIdentityType +from ._container_service_client_enums import ScaleDownMode +from ._container_service_client_enums import ScaleSetEvictionPolicy +from ._container_service_client_enums import ScaleSetPriority +from ._container_service_client_enums import SnapshotType +from ._container_service_client_enums import UpgradeChannel +from ._container_service_client_enums import WeekDay +from ._container_service_client_enums import WorkloadRuntime from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'AgentPool', - 'AgentPoolAvailableVersions', - 'AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem', - 'AgentPoolListResult', - 'AgentPoolUpgradeProfile', - 'AgentPoolUpgradeProfilePropertiesUpgradesItem', - 'AgentPoolUpgradeSettings', - 'CloudErrorBody', - 'ContainerServiceDiagnosticsProfile', - 'ContainerServiceLinuxProfile', - 'ContainerServiceMasterProfile', - 'ContainerServiceNetworkProfile', - 'ContainerServiceSshConfiguration', - 'ContainerServiceSshPublicKey', - 'ContainerServiceVMDiagnostics', - 'CreationData', - 'CredentialResult', - 'CredentialResults', - 'EndpointDependency', - 'EndpointDetail', - 'ExtendedLocation', - 'KubeletConfig', - 'LinuxOSConfig', - 'MaintenanceConfiguration', - 'MaintenanceConfigurationListResult', - 'ManagedCluster', - 'ManagedClusterAADProfile', - 'ManagedClusterAPIServerAccessProfile', - 'ManagedClusterAccessProfile', - 'ManagedClusterAddonProfile', - 'ManagedClusterAddonProfileIdentity', - 'ManagedClusterAgentPoolProfile', - 'ManagedClusterAgentPoolProfileProperties', - 'ManagedClusterAutoUpgradeProfile', - 'ManagedClusterHTTPProxyConfig', - 'ManagedClusterIdentity', - 'ManagedClusterListResult', - 'ManagedClusterLoadBalancerProfile', - 'ManagedClusterLoadBalancerProfileManagedOutboundIPs', - 'ManagedClusterLoadBalancerProfileOutboundIPPrefixes', - 'ManagedClusterLoadBalancerProfileOutboundIPs', - 'ManagedClusterManagedOutboundIPProfile', - 'ManagedClusterNATGatewayProfile', - 'ManagedClusterOIDCIssuerProfile', - 'ManagedClusterPodIdentity', - 'ManagedClusterPodIdentityException', - 'ManagedClusterPodIdentityProfile', - 'ManagedClusterPodIdentityProvisioningError', - 'ManagedClusterPodIdentityProvisioningErrorBody', - 'ManagedClusterPodIdentityProvisioningInfo', - 'ManagedClusterPoolUpgradeProfile', - 'ManagedClusterPoolUpgradeProfileUpgradesItem', - 'ManagedClusterPropertiesAutoScalerProfile', - 'ManagedClusterSKU', - 'ManagedClusterSecurityProfile', - 'ManagedClusterSecurityProfileAzureDefender', - 'ManagedClusterServicePrincipalProfile', - 'ManagedClusterUpgradeProfile', - 'ManagedClusterWindowsProfile', - 'ManagedServiceIdentityUserAssignedIdentitiesValue', - 'OSOptionProfile', - 'OSOptionProperty', - 'OperationListResult', - 'OperationValue', - 'OutboundEnvironmentEndpoint', - 'OutboundEnvironmentEndpointCollection', - 'PowerState', - 'PrivateEndpoint', - 'PrivateEndpointConnection', - 'PrivateEndpointConnectionListResult', - 'PrivateLinkResource', - 'PrivateLinkResourcesListResult', - 'PrivateLinkServiceConnectionState', - 'Resource', - 'ResourceReference', - 'RunCommandRequest', - 'RunCommandResult', - 'Snapshot', - 'SnapshotListResult', - 'SubResource', - 'SysctlConfig', - 'SystemData', - 'TagsObject', - 'TimeInWeek', - 'TimeSpan', - 'UserAssignedIdentity', - 'WindowsGmsaProfile', - 'AgentPoolMode', - 'AgentPoolType', - 'Code', - 'ConnectionStatus', - 'ContainerServiceStorageProfileTypes', - 'ContainerServiceVMSizeTypes', - 'Count', - 'CreatedByType', - 'Expander', - 'ExtendedLocationTypes', - 'GPUInstanceProfile', - 'IpFamily', - 'KubeletDiskType', - 'LicenseType', - 'LoadBalancerSku', - 'ManagedClusterPodIdentityProvisioningState', - 'ManagedClusterSKUName', - 'ManagedClusterSKUTier', - 'NetworkMode', - 'NetworkPlugin', - 'NetworkPolicy', - 'OSDiskType', - 'OSSKU', - 'OSType', - 'OutboundType', - 'PrivateEndpointConnectionProvisioningState', - 'PublicNetworkAccess', - 'ResourceIdentityType', - 'ScaleDownMode', - 'ScaleSetEvictionPolicy', - 'ScaleSetPriority', - 'SnapshotType', - 'UpgradeChannel', - 'WeekDay', - 'WorkloadRuntime', + "AgentPool", + "AgentPoolAvailableVersions", + "AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem", + "AgentPoolListResult", + "AgentPoolUpgradeProfile", + "AgentPoolUpgradeProfilePropertiesUpgradesItem", + "AgentPoolUpgradeSettings", + "CloudErrorBody", + "ContainerServiceDiagnosticsProfile", + "ContainerServiceLinuxProfile", + "ContainerServiceMasterProfile", + "ContainerServiceNetworkProfile", + "ContainerServiceSshConfiguration", + "ContainerServiceSshPublicKey", + "ContainerServiceVMDiagnostics", + "CreationData", + "CredentialResult", + "CredentialResults", + "EndpointDependency", + "EndpointDetail", + "ExtendedLocation", + "KubeletConfig", + "LinuxOSConfig", + "MaintenanceConfiguration", + "MaintenanceConfigurationListResult", + "ManagedCluster", + "ManagedClusterAADProfile", + "ManagedClusterAPIServerAccessProfile", + "ManagedClusterAccessProfile", + "ManagedClusterAddonProfile", + "ManagedClusterAddonProfileIdentity", + "ManagedClusterAgentPoolProfile", + "ManagedClusterAgentPoolProfileProperties", + "ManagedClusterAutoUpgradeProfile", + "ManagedClusterHTTPProxyConfig", + "ManagedClusterIdentity", + "ManagedClusterListResult", + "ManagedClusterLoadBalancerProfile", + "ManagedClusterLoadBalancerProfileManagedOutboundIPs", + "ManagedClusterLoadBalancerProfileOutboundIPPrefixes", + "ManagedClusterLoadBalancerProfileOutboundIPs", + "ManagedClusterManagedOutboundIPProfile", + "ManagedClusterNATGatewayProfile", + "ManagedClusterOIDCIssuerProfile", + "ManagedClusterPodIdentity", + "ManagedClusterPodIdentityException", + "ManagedClusterPodIdentityProfile", + "ManagedClusterPodIdentityProvisioningError", + "ManagedClusterPodIdentityProvisioningErrorBody", + "ManagedClusterPodIdentityProvisioningInfo", + "ManagedClusterPoolUpgradeProfile", + "ManagedClusterPoolUpgradeProfileUpgradesItem", + "ManagedClusterPropertiesAutoScalerProfile", + "ManagedClusterSKU", + "ManagedClusterSecurityProfile", + "ManagedClusterSecurityProfileAzureDefender", + "ManagedClusterServicePrincipalProfile", + "ManagedClusterUpgradeProfile", + "ManagedClusterWindowsProfile", + "ManagedServiceIdentityUserAssignedIdentitiesValue", + "OSOptionProfile", + "OSOptionProperty", + "OperationListResult", + "OperationValue", + "OutboundEnvironmentEndpoint", + "OutboundEnvironmentEndpointCollection", + "PowerState", + "PrivateEndpoint", + "PrivateEndpointConnection", + "PrivateEndpointConnectionListResult", + "PrivateLinkResource", + "PrivateLinkResourcesListResult", + "PrivateLinkServiceConnectionState", + "Resource", + "ResourceReference", + "RunCommandRequest", + "RunCommandResult", + "Snapshot", + "SnapshotListResult", + "SubResource", + "SysctlConfig", + "SystemData", + "TagsObject", + "TimeInWeek", + "TimeSpan", + "UserAssignedIdentity", + "WindowsGmsaProfile", + "AgentPoolMode", + "AgentPoolType", + "Code", + "ConnectionStatus", + "ContainerServiceStorageProfileTypes", + "ContainerServiceVMSizeTypes", + "Count", + "CreatedByType", + "Expander", + "ExtendedLocationTypes", + "GPUInstanceProfile", + "IpFamily", + "KubeletDiskType", + "LicenseType", + "LoadBalancerSku", + "ManagedClusterPodIdentityProvisioningState", + "ManagedClusterSKUName", + "ManagedClusterSKUTier", + "NetworkMode", + "NetworkPlugin", + "NetworkPolicy", + "OSDiskType", + "OSSKU", + "OSType", + "OutboundType", + "PrivateEndpointConnectionProvisioningState", + "PublicNetworkAccess", + "ResourceIdentityType", + "ScaleDownMode", + "ScaleSetEvictionPolicy", + "ScaleSetPriority", + "SnapshotType", + "UpgradeChannel", + "WeekDay", + "WorkloadRuntime", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/models/_container_service_client_enums.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/models/_container_service_client_enums.py index 145f90c5ecca..5dd606dd070d 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/models/_container_service_client_enums.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/models/_container_service_client_enums.py @@ -13,7 +13,7 @@ class AgentPoolMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools + https://docs.microsoft.com/azure/aks/use-system-pools. """ #: System agent pools are primarily for hosting critical system pods such as CoreDNS and @@ -23,33 +23,34 @@ class AgentPoolMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: User agent pools are primarily for hosting your application pods. USER = "User" + class AgentPoolType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of Agent Pool. - """ + """The type of Agent Pool.""" #: Create an Agent Pool backed by a Virtual Machine Scale Set. VIRTUAL_MACHINE_SCALE_SETS = "VirtualMachineScaleSets" #: Use of this is strongly discouraged. AVAILABILITY_SET = "AvailabilitySet" + class Code(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Tells whether the cluster is Running or Stopped - """ + """Tells whether the cluster is Running or Stopped.""" #: The cluster is running. RUNNING = "Running" #: The cluster is stopped. STOPPED = "Stopped" + class ConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The private link service connection status. - """ + """The private link service connection status.""" PENDING = "Pending" APPROVED = "Approved" REJECTED = "Rejected" DISCONNECTED = "Disconnected" + class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Specifies what kind of storage to use. If omitted, the default will be chosen on your behalf based on the choice of orchestrator. @@ -58,9 +59,9 @@ class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEn STORAGE_ACCOUNT = "StorageAccount" MANAGED_DISKS = "ManagedDisks" + class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Size of agent VMs. Note: This is no longer maintained. - """ + """Size of agent VMs. Note: This is no longer maintained.""" STANDARD_A1 = "Standard_A1" STANDARD_A10 = "Standard_A10" @@ -237,6 +238,7 @@ class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): STANDARD_NV24 = "Standard_NV24" STANDARD_NV6 = "Standard_NV6" + class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): """Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, and 5. The default value is 1. @@ -246,15 +248,16 @@ class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): THREE = 3 FIVE = 5 + class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of identity that created the resource. - """ + """The type of identity that created the resource.""" USER = "User" APPLICATION = "Application" MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" + class Expander(str, Enum, metaclass=CaseInsensitiveEnumMeta): """If not specified, the default is 'random'. See `expanders `_ @@ -278,15 +281,15 @@ class Expander(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Used when you don't have a particular need for the node groups to scale differently. RANDOM = "random" + class ExtendedLocationTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of extendedLocation. - """ + """The type of extendedLocation.""" EDGE_ZONE = "EdgeZone" + class GPUInstanceProfile(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """GPUInstanceProfile to be used to specify GPU MIG instance profile for supported GPU VM SKU. - """ + """GPUInstanceProfile to be used to specify GPU MIG instance profile for supported GPU VM SKU.""" MIG1_G = "MIG1g" MIG2_G = "MIG2g" @@ -294,13 +297,14 @@ class GPUInstanceProfile(str, Enum, metaclass=CaseInsensitiveEnumMeta): MIG4_G = "MIG4g" MIG7_G = "MIG7g" + class IpFamily(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The IP version to use for cluster networking and IP assignment. - """ + """The IP version to use for cluster networking and IP assignment.""" I_PV4 = "IPv4" I_PV6 = "IPv6" + class KubeletDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. @@ -311,6 +315,7 @@ class KubeletDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Kubelet will use the temporary disk for its data. TEMPORARY = "Temporary" + class LicenseType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The license type to use for Windows VMs. See `Azure Hybrid User Benefits `_ for more details. @@ -321,6 +326,7 @@ class LicenseType(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Enables Azure Hybrid User Benefits for Windows VMs. WINDOWS_SERVER = "Windows_Server" + class LoadBalancerSku(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The default is 'standard'. See `Azure Load Balancer SKUs `_ for more information about the @@ -334,21 +340,22 @@ class LoadBalancerSku(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Use a basic Load Balancer with limited functionality. BASIC = "basic" + class ManagedClusterPodIdentityProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The current provisioning state of the pod identity. - """ + """The current provisioning state of the pod identity.""" ASSIGNED = "Assigned" UPDATING = "Updating" DELETING = "Deleting" FAILED = "Failed" + class ManagedClusterSKUName(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The name of a managed cluster SKU. - """ + """The name of a managed cluster SKU.""" BASIC = "Basic" + class ManagedClusterSKUTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): """If not specified, the default is 'Free'. See `uptime SLA `_ for more details. @@ -360,20 +367,20 @@ class ManagedClusterSKUTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: No guaranteed SLA, no additional charges. Free tier clusters have an SLO of 99.5%. FREE = "Free" + class NetworkMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """This cannot be specified if networkPlugin is anything other than 'azure'. - """ + """This cannot be specified if networkPlugin is anything other than 'azure'.""" #: No bridge is created. Intra-VM Pod to Pod communication is through IP routes created by Azure #: CNI. See `Transparent Mode `_ for #: more information. TRANSPARENT = "transparent" - #: This is no longer supported. + #: This is no longer supported BRIDGE = "bridge" + class NetworkPlugin(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Network plugin used for building the Kubernetes network. - """ + """Network plugin used for building the Kubernetes network.""" #: Use the Azure CNI network plugin. See `Azure CNI (advanced) networking #: `_ for @@ -384,9 +391,9 @@ class NetworkPlugin(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: information. KUBENET = "kubenet" + class NetworkPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Network policy used for building the Kubernetes network. - """ + """Network policy used for building the Kubernetes network.""" #: Use Calico network policies. See `differences between Azure and Calico policies #: `_ @@ -397,6 +404,7 @@ class NetworkPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: for more information. AZURE = "azure" + class OSDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more @@ -413,22 +421,23 @@ class OSDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: provides lower read/write latency, along with faster node scaling and cluster upgrades. EPHEMERAL = "Ephemeral" + class OSSKU(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Specifies an OS SKU. This value must not be specified if OSType is Windows. - """ + """Specifies an OS SKU. This value must not be specified if OSType is Windows.""" UBUNTU = "Ubuntu" CBL_MARINER = "CBLMariner" + class OSType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The operating system type. The default is Linux. - """ + """The operating system type. The default is Linux.""" #: Use Linux. LINUX = "Linux" #: Use Windows. WINDOWS = "Windows" + class OutboundType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """This can only be set at cluster creation time and cannot be changed later. For more information see `egress outbound type `_. @@ -449,22 +458,23 @@ class OutboundType(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: advanced scenario and requires proper network configuration. USER_ASSIGNED_NAT_GATEWAY = "userAssignedNATGateway" + class PrivateEndpointConnectionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The current provisioning state. - """ + """The current provisioning state.""" SUCCEEDED = "Succeeded" CREATING = "Creating" DELETING = "Deleting" FAILED = "Failed" + class PublicNetworkAccess(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Allow or deny public network access for AKS - """ + """Allow or deny public network access for AKS.""" ENABLED = "Enabled" DISABLED = "Disabled" + class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """For more information see `use managed identities in AKS `_. @@ -481,6 +491,7 @@ class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Do not use a managed identity for the Managed Cluster, service principal will be used instead. NONE = "None" + class ScaleDownMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Describes how VMs are added to or removed from Agent Pools. See `billing states `_. @@ -492,10 +503,11 @@ class ScaleDownMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: during scale down. DEALLOCATE = "Deallocate" + class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The eviction policy specifies what to do with the VM when it is evicted. The default is Delete. For more information about eviction see `spot VMs - `_ + `_. """ #: Nodes in the underlying Scale Set of the node pool are deleted when they're evicted. @@ -505,9 +517,9 @@ class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: cause issues with cluster scaling or upgrading. DEALLOCATE = "Deallocate" + class ScaleSetPriority(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The Virtual Machine Scale Set priority. - """ + """The Virtual Machine Scale Set priority.""" #: Spot priority VMs will be used. There is no SLA for spot nodes. See `spot on AKS #: `_ for more information. @@ -515,13 +527,14 @@ class ScaleSetPriority(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Regular VMs will be used. REGULAR = "Regular" + class SnapshotType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of a snapshot. The default is NodePool. - """ + """The type of a snapshot. The default is NodePool.""" #: The snapshot is a snapshot of a node pool. NODE_POOL = "NodePool" + class UpgradeChannel(str, Enum, metaclass=CaseInsensitiveEnumMeta): """For more information see `setting the AKS cluster auto-upgrade channel `_. @@ -552,9 +565,9 @@ class UpgradeChannel(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Disables auto-upgrades and keeps the cluster at its current version of Kubernetes. NONE = "none" + class WeekDay(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The weekday enum. - """ + """The weekday enum.""" SUNDAY = "Sunday" MONDAY = "Monday" @@ -564,9 +577,9 @@ class WeekDay(str, Enum, metaclass=CaseInsensitiveEnumMeta): FRIDAY = "Friday" SATURDAY = "Saturday" + class WorkloadRuntime(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Determines the type of workload a node can run. - """ + """Determines the type of workload a node can run.""" #: Nodes will use Kubelet to run standard OCI container workloads. OCI_CONTAINER = "OCIContainer" diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/models/_models_py3.py index da3b220050e9..9cba1f55f9b1 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/models/_models_py3.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/models/_models_py3.py @@ -1,4 +1,5 @@ # coding=utf-8 +# pylint: disable=too-many-lines # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -9,14 +10,14 @@ import datetime from typing import Dict, List, Optional, TYPE_CHECKING, Union -import msrest.serialization +from ... import _serialization if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - import __init__ as _models + from .. import models as _models -class SubResource(msrest.serialization.Model): +class SubResource(_serialization.Model): """Reference to another subresource. Variables are only populated by the server, and will be ignored when sending a request. @@ -31,30 +32,26 @@ class SubResource(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(SubResource, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.id = None self.name = None self.type = None -class AgentPool(SubResource): +class AgentPool(SubResource): # pylint: disable=too-many-instance-attributes """Agent Pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -82,15 +79,15 @@ class AgentPool(SubResource): larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.OSDiskType :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data - root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.KubeletDiskType :ivar workload_runtime: Determines the type of workload a node can run. Known values are: - "OCIContainer", "WasmWasi". + "OCIContainer" and "WasmWasi". :vartype workload_runtime: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.WorkloadRuntime :ivar message_of_the_day: A base64-encoded string which will be written to /etc/motd after @@ -109,11 +106,11 @@ class AgentPool(SubResource): :vartype pod_subnet_id: str :ivar max_pods: The maximum number of pods that can run on a node. :vartype max_pods: int - :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.OSType :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known - values are: "Ubuntu", "CBLMariner". + values are: "Ubuntu" and "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.OSSKU :ivar max_count: The maximum number of nodes for auto-scaling. :vartype max_count: int @@ -122,16 +119,16 @@ class AgentPool(SubResource): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it - defaults to Delete. Known values are: "Delete", "Deallocate". + defaults to Delete. Known values are: "Delete" and "Deallocate". :vartype scale_down_mode: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.ScaleDownMode - :ivar type_properties_type: The type of Agent Pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + :ivar type_properties_type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets" + and "AvailabilitySet". :vartype type_properties_type: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.AgentPoolType :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :vartype mode: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.AgentPoolMode :ivar orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -166,20 +163,18 @@ class AgentPool(SubResource): /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default - is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + is 'Regular'. Known values are: "Spot" and "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.ScaleSetPriority :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.ScaleSetEvictionPolicy :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :vartype spot_max_price: float - :ivar tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :ivar tags: The tags to be persisted on the agent pool virtual machine scale set. :vartype tags: dict[str, str] :ivar node_labels: The node labels to be persisted across all nodes in agent pool. :vartype node_labels: dict[str, str] @@ -203,7 +198,7 @@ class AgentPool(SubResource): for more details. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.GPUInstanceProfile :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the node pool @@ -215,62 +210,62 @@ class AgentPool(SubResource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'os_disk_size_gb': {'maximum': 2048, 'minimum': 0}, - 'node_image_version': {'readonly': True}, - 'provisioning_state': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "os_disk_size_gb": {"maximum": 2048, "minimum": 0}, + "node_image_version": {"readonly": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'count': {'key': 'properties.count', 'type': 'int'}, - 'vm_size': {'key': 'properties.vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'properties.osDiskSizeGB', 'type': 'int'}, - 'os_disk_type': {'key': 'properties.osDiskType', 'type': 'str'}, - 'kubelet_disk_type': {'key': 'properties.kubeletDiskType', 'type': 'str'}, - 'workload_runtime': {'key': 'properties.workloadRuntime', 'type': 'str'}, - 'message_of_the_day': {'key': 'properties.messageOfTheDay', 'type': 'str'}, - 'vnet_subnet_id': {'key': 'properties.vnetSubnetID', 'type': 'str'}, - 'pod_subnet_id': {'key': 'properties.podSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'properties.maxPods', 'type': 'int'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'os_sku': {'key': 'properties.osSKU', 'type': 'str'}, - 'max_count': {'key': 'properties.maxCount', 'type': 'int'}, - 'min_count': {'key': 'properties.minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'properties.enableAutoScaling', 'type': 'bool'}, - 'scale_down_mode': {'key': 'properties.scaleDownMode', 'type': 'str'}, - 'type_properties_type': {'key': 'properties.type', 'type': 'str'}, - 'mode': {'key': 'properties.mode', 'type': 'str'}, - 'orchestrator_version': {'key': 'properties.orchestratorVersion', 'type': 'str'}, - 'node_image_version': {'key': 'properties.nodeImageVersion', 'type': 'str'}, - 'upgrade_settings': {'key': 'properties.upgradeSettings', 'type': 'AgentPoolUpgradeSettings'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'power_state': {'key': 'properties.powerState', 'type': 'PowerState'}, - 'availability_zones': {'key': 'properties.availabilityZones', 'type': '[str]'}, - 'enable_node_public_ip': {'key': 'properties.enableNodePublicIP', 'type': 'bool'}, - 'node_public_ip_prefix_id': {'key': 'properties.nodePublicIPPrefixID', 'type': 'str'}, - 'scale_set_priority': {'key': 'properties.scaleSetPriority', 'type': 'str'}, - 'scale_set_eviction_policy': {'key': 'properties.scaleSetEvictionPolicy', 'type': 'str'}, - 'spot_max_price': {'key': 'properties.spotMaxPrice', 'type': 'float'}, - 'tags': {'key': 'properties.tags', 'type': '{str}'}, - 'node_labels': {'key': 'properties.nodeLabels', 'type': '{str}'}, - 'node_taints': {'key': 'properties.nodeTaints', 'type': '[str]'}, - 'proximity_placement_group_id': {'key': 'properties.proximityPlacementGroupID', 'type': 'str'}, - 'kubelet_config': {'key': 'properties.kubeletConfig', 'type': 'KubeletConfig'}, - 'linux_os_config': {'key': 'properties.linuxOSConfig', 'type': 'LinuxOSConfig'}, - 'enable_encryption_at_host': {'key': 'properties.enableEncryptionAtHost', 'type': 'bool'}, - 'enable_ultra_ssd': {'key': 'properties.enableUltraSSD', 'type': 'bool'}, - 'enable_fips': {'key': 'properties.enableFIPS', 'type': 'bool'}, - 'gpu_instance_profile': {'key': 'properties.gpuInstanceProfile', 'type': 'str'}, - 'creation_data': {'key': 'properties.creationData', 'type': 'CreationData'}, - 'capacity_reservation_group_id': {'key': 'properties.capacityReservationGroupID', 'type': 'str'}, - } - - def __init__( + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "count": {"key": "properties.count", "type": "int"}, + "vm_size": {"key": "properties.vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "properties.osDiskSizeGB", "type": "int"}, + "os_disk_type": {"key": "properties.osDiskType", "type": "str"}, + "kubelet_disk_type": {"key": "properties.kubeletDiskType", "type": "str"}, + "workload_runtime": {"key": "properties.workloadRuntime", "type": "str"}, + "message_of_the_day": {"key": "properties.messageOfTheDay", "type": "str"}, + "vnet_subnet_id": {"key": "properties.vnetSubnetID", "type": "str"}, + "pod_subnet_id": {"key": "properties.podSubnetID", "type": "str"}, + "max_pods": {"key": "properties.maxPods", "type": "int"}, + "os_type": {"key": "properties.osType", "type": "str"}, + "os_sku": {"key": "properties.osSKU", "type": "str"}, + "max_count": {"key": "properties.maxCount", "type": "int"}, + "min_count": {"key": "properties.minCount", "type": "int"}, + "enable_auto_scaling": {"key": "properties.enableAutoScaling", "type": "bool"}, + "scale_down_mode": {"key": "properties.scaleDownMode", "type": "str"}, + "type_properties_type": {"key": "properties.type", "type": "str"}, + "mode": {"key": "properties.mode", "type": "str"}, + "orchestrator_version": {"key": "properties.orchestratorVersion", "type": "str"}, + "node_image_version": {"key": "properties.nodeImageVersion", "type": "str"}, + "upgrade_settings": {"key": "properties.upgradeSettings", "type": "AgentPoolUpgradeSettings"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "power_state": {"key": "properties.powerState", "type": "PowerState"}, + "availability_zones": {"key": "properties.availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "properties.enableNodePublicIP", "type": "bool"}, + "node_public_ip_prefix_id": {"key": "properties.nodePublicIPPrefixID", "type": "str"}, + "scale_set_priority": {"key": "properties.scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "properties.scaleSetEvictionPolicy", "type": "str"}, + "spot_max_price": {"key": "properties.spotMaxPrice", "type": "float"}, + "tags": {"key": "properties.tags", "type": "{str}"}, + "node_labels": {"key": "properties.nodeLabels", "type": "{str}"}, + "node_taints": {"key": "properties.nodeTaints", "type": "[str]"}, + "proximity_placement_group_id": {"key": "properties.proximityPlacementGroupID", "type": "str"}, + "kubelet_config": {"key": "properties.kubeletConfig", "type": "KubeletConfig"}, + "linux_os_config": {"key": "properties.linuxOSConfig", "type": "LinuxOSConfig"}, + "enable_encryption_at_host": {"key": "properties.enableEncryptionAtHost", "type": "bool"}, + "enable_ultra_ssd": {"key": "properties.enableUltraSSD", "type": "bool"}, + "enable_fips": {"key": "properties.enableFIPS", "type": "bool"}, + "gpu_instance_profile": {"key": "properties.gpuInstanceProfile", "type": "str"}, + "creation_data": {"key": "properties.creationData", "type": "CreationData"}, + "capacity_reservation_group_id": {"key": "properties.capacityReservationGroupID", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, count: Optional[int] = None, @@ -283,7 +278,7 @@ def __init__( vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, @@ -297,9 +292,9 @@ def __init__( availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", - spot_max_price: Optional[float] = -1, + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", + spot_max_price: float = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, @@ -331,15 +326,15 @@ def __init__( larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.OSDiskType :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime - data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + data root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.KubeletDiskType :keyword workload_runtime: Determines the type of workload a node can run. Known values are: - "OCIContainer", "WasmWasi". + "OCIContainer" and "WasmWasi". :paramtype workload_runtime: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.WorkloadRuntime :keyword message_of_the_day: A base64-encoded string which will be written to /etc/motd after @@ -358,11 +353,11 @@ def __init__( :paramtype pod_subnet_id: str :keyword max_pods: The maximum number of pods that can run on a node. :paramtype max_pods: int - :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.OSType :keyword os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Known values are: "Ubuntu", "CBLMariner". + Known values are: "Ubuntu" and "CBLMariner". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.OSSKU :keyword max_count: The maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -371,16 +366,16 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, - it defaults to Delete. Known values are: "Delete", "Deallocate". + it defaults to Delete. Known values are: "Delete" and "Deallocate". :paramtype scale_down_mode: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.ScaleDownMode :keyword type_properties_type: The type of Agent Pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type_properties_type: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.AgentPoolType :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.AgentPoolMode :keyword orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -411,20 +406,18 @@ def __init__( /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the - default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + default is 'Regular'. Known values are: "Spot" and "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.ScaleSetPriority :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.ScaleSetEvictionPolicy :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :paramtype spot_max_price: float - :keyword tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :keyword tags: The tags to be persisted on the agent pool virtual machine scale set. :paramtype tags: dict[str, str] :keyword node_labels: The node labels to be persisted across all nodes in agent pool. :paramtype node_labels: dict[str, str] @@ -450,7 +443,7 @@ def __init__( for more details. :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance - profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.GPUInstanceProfile @@ -461,7 +454,7 @@ def __init__( Capacity Reservation Group. :paramtype capacity_reservation_group_id: str """ - super(AgentPool, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.vm_size = vm_size self.os_disk_size_gb = os_disk_size_gb @@ -505,7 +498,7 @@ def __init__( self.capacity_reservation_group_id = capacity_reservation_group_id -class AgentPoolAvailableVersions(msrest.serialization.Model): +class AgentPoolAvailableVersions(_serialization.Model): """The list of available versions for an agent pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -522,16 +515,19 @@ class AgentPoolAvailableVersions(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'agent_pool_versions': {'key': 'properties.agentPoolVersions', 'type': '[AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "agent_pool_versions": { + "key": "properties.agentPoolVersions", + "type": "[AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem]", + }, } def __init__( @@ -545,14 +541,14 @@ def __init__( :paramtype agent_pool_versions: list[~azure.mgmt.containerservice.v2021_11_01_preview.models.AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem] """ - super(AgentPoolAvailableVersions, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None self.agent_pool_versions = agent_pool_versions -class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(msrest.serialization.Model): +class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(_serialization.Model): """AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem. :ivar default: Whether this version is the default agent pool version. @@ -564,9 +560,9 @@ class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(msrest.serializa """ _attribute_map = { - 'default': {'key': 'default', 'type': 'bool'}, - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "default": {"key": "default", "type": "bool"}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } def __init__( @@ -585,13 +581,13 @@ def __init__( :keyword is_preview: Whether Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.default = default self.kubernetes_version = kubernetes_version self.is_preview = is_preview -class AgentPoolListResult(msrest.serialization.Model): +class AgentPoolListResult(_serialization.Model): """The response from the List Agent Pools operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -603,30 +599,25 @@ class AgentPoolListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[AgentPool]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[AgentPool]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.AgentPool"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.AgentPool"]] = None, **kwargs): """ :keyword value: The list of agent pools. :paramtype value: list[~azure.mgmt.containerservice.v2021_11_01_preview.models.AgentPool] """ - super(AgentPoolListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class AgentPoolUpgradeProfile(msrest.serialization.Model): +class AgentPoolUpgradeProfile(_serialization.Model): """The list of available upgrades for an agent pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -639,10 +630,10 @@ class AgentPoolUpgradeProfile(msrest.serialization.Model): :vartype name: str :ivar type: The type of the agent pool upgrade profile. :vartype type: str - :ivar kubernetes_version: Required. The Kubernetes version (major.minor.patch). + :ivar kubernetes_version: The Kubernetes version (major.minor.patch). Required. :vartype kubernetes_version: str - :ivar os_type: Required. The operating system type. The default is Linux. Known values are: - "Linux", "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -652,21 +643,21 @@ class AgentPoolUpgradeProfile(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kubernetes_version': {'required': True}, - 'os_type': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "kubernetes_version": {"required": True}, + "os_type": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'kubernetes_version': {'key': 'properties.kubernetesVersion', 'type': 'str'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'upgrades': {'key': 'properties.upgrades', 'type': '[AgentPoolUpgradeProfilePropertiesUpgradesItem]'}, - 'latest_node_image_version': {'key': 'properties.latestNodeImageVersion', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "os_type": {"key": "properties.osType", "type": "str"}, + "upgrades": {"key": "properties.upgrades", "type": "[AgentPoolUpgradeProfilePropertiesUpgradesItem]"}, + "latest_node_image_version": {"key": "properties.latestNodeImageVersion", "type": "str"}, } def __init__( @@ -679,10 +670,10 @@ def __init__( **kwargs ): """ - :keyword kubernetes_version: Required. The Kubernetes version (major.minor.patch). + :keyword kubernetes_version: The Kubernetes version (major.minor.patch). Required. :paramtype kubernetes_version: str - :keyword os_type: Required. The operating system type. The default is Linux. Known values are: - "Linux", "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: @@ -690,7 +681,7 @@ def __init__( :keyword latest_node_image_version: The latest AKS supported node image version. :paramtype latest_node_image_version: str """ - super(AgentPoolUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -700,7 +691,7 @@ def __init__( self.latest_node_image_version = latest_node_image_version -class AgentPoolUpgradeProfilePropertiesUpgradesItem(msrest.serialization.Model): +class AgentPoolUpgradeProfilePropertiesUpgradesItem(_serialization.Model): """AgentPoolUpgradeProfilePropertiesUpgradesItem. :ivar kubernetes_version: The Kubernetes version (major.minor.patch). @@ -710,29 +701,23 @@ class AgentPoolUpgradeProfilePropertiesUpgradesItem(msrest.serialization.Model): """ _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } - def __init__( - self, - *, - kubernetes_version: Optional[str] = None, - is_preview: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, kubernetes_version: Optional[str] = None, is_preview: Optional[bool] = None, **kwargs): """ :keyword kubernetes_version: The Kubernetes version (major.minor.patch). :paramtype kubernetes_version: str :keyword is_preview: Whether the Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(AgentPoolUpgradeProfilePropertiesUpgradesItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.is_preview = is_preview -class AgentPoolUpgradeSettings(msrest.serialization.Model): +class AgentPoolUpgradeSettings(_serialization.Model): """Settings for upgrading an agentpool. :ivar max_surge: This can either be set to an integer (e.g. '5') or a percentage (e.g. '50%'). @@ -744,15 +729,10 @@ class AgentPoolUpgradeSettings(msrest.serialization.Model): """ _attribute_map = { - 'max_surge': {'key': 'maxSurge', 'type': 'str'}, + "max_surge": {"key": "maxSurge", "type": "str"}, } - def __init__( - self, - *, - max_surge: Optional[str] = None, - **kwargs - ): + def __init__(self, *, max_surge: Optional[str] = None, **kwargs): """ :keyword max_surge: This can either be set to an integer (e.g. '5') or a percentage (e.g. '50%'). If a percentage is specified, it is the percentage of the total agent pool size at the @@ -761,11 +741,11 @@ def __init__( https://docs.microsoft.com/azure/aks/upgrade-cluster#customize-node-surge-upgrade. :paramtype max_surge: str """ - super(AgentPoolUpgradeSettings, self).__init__(**kwargs) + super().__init__(**kwargs) self.max_surge = max_surge -class CloudErrorBody(msrest.serialization.Model): +class CloudErrorBody(_serialization.Model): """An error response from the Container service. :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed @@ -782,10 +762,10 @@ class CloudErrorBody(msrest.serialization.Model): """ _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[CloudErrorBody]"}, } def __init__( @@ -811,88 +791,77 @@ def __init__( :paramtype details: list[~azure.mgmt.containerservice.v2021_11_01_preview.models.CloudErrorBody] """ - super(CloudErrorBody, self).__init__(**kwargs) + super().__init__(**kwargs) self.code = code self.message = message self.target = target self.details = details -class ContainerServiceDiagnosticsProfile(msrest.serialization.Model): +class ContainerServiceDiagnosticsProfile(_serialization.Model): """Profile for diagnostics on the container service cluster. All required parameters must be populated in order to send to Azure. - :ivar vm_diagnostics: Required. Profile for diagnostics on the container service VMs. + :ivar vm_diagnostics: Profile for diagnostics on the container service VMs. Required. :vartype vm_diagnostics: ~azure.mgmt.containerservice.v2021_11_01_preview.models.ContainerServiceVMDiagnostics """ _validation = { - 'vm_diagnostics': {'required': True}, + "vm_diagnostics": {"required": True}, } _attribute_map = { - 'vm_diagnostics': {'key': 'vmDiagnostics', 'type': 'ContainerServiceVMDiagnostics'}, + "vm_diagnostics": {"key": "vmDiagnostics", "type": "ContainerServiceVMDiagnostics"}, } - def __init__( - self, - *, - vm_diagnostics: "_models.ContainerServiceVMDiagnostics", - **kwargs - ): + def __init__(self, *, vm_diagnostics: "_models.ContainerServiceVMDiagnostics", **kwargs): """ - :keyword vm_diagnostics: Required. Profile for diagnostics on the container service VMs. + :keyword vm_diagnostics: Profile for diagnostics on the container service VMs. Required. :paramtype vm_diagnostics: ~azure.mgmt.containerservice.v2021_11_01_preview.models.ContainerServiceVMDiagnostics """ - super(ContainerServiceDiagnosticsProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.vm_diagnostics = vm_diagnostics -class ContainerServiceLinuxProfile(msrest.serialization.Model): +class ContainerServiceLinuxProfile(_serialization.Model): """Profile for Linux VMs in the container service cluster. All required parameters must be populated in order to send to Azure. - :ivar admin_username: Required. The administrator username to use for Linux VMs. + :ivar admin_username: The administrator username to use for Linux VMs. Required. :vartype admin_username: str - :ivar ssh: Required. The SSH configuration for Linux-based VMs running on Azure. + :ivar ssh: The SSH configuration for Linux-based VMs running on Azure. Required. :vartype ssh: ~azure.mgmt.containerservice.v2021_11_01_preview.models.ContainerServiceSshConfiguration """ _validation = { - 'admin_username': {'required': True, 'pattern': r'^[A-Za-z][-A-Za-z0-9_]*$'}, - 'ssh': {'required': True}, + "admin_username": {"required": True, "pattern": r"^[A-Za-z][-A-Za-z0-9_]*$"}, + "ssh": {"required": True}, } _attribute_map = { - 'admin_username': {'key': 'adminUsername', 'type': 'str'}, - 'ssh': {'key': 'ssh', 'type': 'ContainerServiceSshConfiguration'}, + "admin_username": {"key": "adminUsername", "type": "str"}, + "ssh": {"key": "ssh", "type": "ContainerServiceSshConfiguration"}, } - def __init__( - self, - *, - admin_username: str, - ssh: "_models.ContainerServiceSshConfiguration", - **kwargs - ): + def __init__(self, *, admin_username: str, ssh: "_models.ContainerServiceSshConfiguration", **kwargs): """ - :keyword admin_username: Required. The administrator username to use for Linux VMs. + :keyword admin_username: The administrator username to use for Linux VMs. Required. :paramtype admin_username: str - :keyword ssh: Required. The SSH configuration for Linux-based VMs running on Azure. + :keyword ssh: The SSH configuration for Linux-based VMs running on Azure. Required. :paramtype ssh: ~azure.mgmt.containerservice.v2021_11_01_preview.models.ContainerServiceSshConfiguration """ - super(ContainerServiceLinuxProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.admin_username = admin_username self.ssh = ssh -class ContainerServiceMasterProfile(msrest.serialization.Model): +class ContainerServiceMasterProfile(_serialization.Model): """Profile for the container service master. Variables are only populated by the server, and will be ignored when sending a request. @@ -900,11 +869,11 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar count: Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, - and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". + and 5. The default value is 1. Known values are: 1, 3, and 5. :vartype count: int or ~azure.mgmt.containerservice.v2021_11_01_preview.models.Count - :ivar dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. + :ivar dns_prefix: DNS prefix to be used to create the FQDN for the master pool. Required. :vartype dns_prefix: str - :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + :ivar vm_size: Size of agent VMs. Required. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -941,7 +910,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :vartype vm_size: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.ContainerServiceVMSizeTypes :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine @@ -955,7 +924,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): :vartype first_consecutive_static_ip: str :ivar storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount" and "ManagedDisks". :vartype storage_profile: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.ContainerServiceStorageProfileTypes :ivar fqdn: FQDN for the master pool. @@ -963,21 +932,21 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): """ _validation = { - 'dns_prefix': {'required': True}, - 'vm_size': {'required': True}, - 'os_disk_size_gb': {'maximum': 2048, 'minimum': 0}, - 'fqdn': {'readonly': True}, + "dns_prefix": {"required": True}, + "vm_size": {"required": True}, + "os_disk_size_gb": {"maximum": 2048, "minimum": 0}, + "fqdn": {"readonly": True}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'dns_prefix': {'key': 'dnsPrefix', 'type': 'str'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'first_consecutive_static_ip': {'key': 'firstConsecutiveStaticIP', 'type': 'str'}, - 'storage_profile': {'key': 'storageProfile', 'type': 'str'}, - 'fqdn': {'key': 'fqdn', 'type': 'str'}, + "count": {"key": "count", "type": "int"}, + "dns_prefix": {"key": "dnsPrefix", "type": "str"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "first_consecutive_static_ip": {"key": "firstConsecutiveStaticIP", "type": "str"}, + "storage_profile": {"key": "storageProfile", "type": "str"}, + "fqdn": {"key": "fqdn", "type": "str"}, } def __init__( @@ -985,20 +954,20 @@ def __init__( *, dns_prefix: str, vm_size: Union[str, "_models.ContainerServiceVMSizeTypes"], - count: Optional[Union[int, "_models.Count"]] = 1, + count: Union[int, "_models.Count"] = 1, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, - first_consecutive_static_ip: Optional[str] = "10.240.255.5", + first_consecutive_static_ip: str = "10.240.255.5", storage_profile: Optional[Union[str, "_models.ContainerServiceStorageProfileTypes"]] = None, **kwargs ): """ :keyword count: Number of masters (VMs) in the container service cluster. Allowed values are 1, - 3, and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". + 3, and 5. The default value is 1. Known values are: 1, 3, and 5. :paramtype count: int or ~azure.mgmt.containerservice.v2021_11_01_preview.models.Count - :keyword dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. + :keyword dns_prefix: DNS prefix to be used to create the FQDN for the master pool. Required. :paramtype dns_prefix: str - :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + :keyword vm_size: Size of agent VMs. Required. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -1035,7 +1004,7 @@ def __init__( "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :paramtype vm_size: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.ContainerServiceVMSizeTypes :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every @@ -1049,11 +1018,11 @@ def __init__( :paramtype first_consecutive_static_ip: str :keyword storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount" and "ManagedDisks". :paramtype storage_profile: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.ContainerServiceStorageProfileTypes """ - super(ContainerServiceMasterProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.dns_prefix = dns_prefix self.vm_size = vm_size @@ -1064,19 +1033,19 @@ def __init__( self.fqdn = None -class ContainerServiceNetworkProfile(msrest.serialization.Model): +class ContainerServiceNetworkProfile(_serialization.Model): # pylint: disable=too-many-instance-attributes """Profile of network configuration. :ivar network_plugin: Network plugin used for building the Kubernetes network. Known values - are: "azure", "kubenet". Default value: "kubenet". + are: "azure" and "kubenet". :vartype network_plugin: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.NetworkPlugin :ivar network_policy: Network policy used for building the Kubernetes network. Known values - are: "calico", "azure". + are: "calico" and "azure". :vartype network_policy: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.NetworkPolicy :ivar network_mode: This cannot be specified if networkPlugin is anything other than 'azure'. - Known values are: "transparent", "bridge". + Known values are: "transparent" and "bridge". :vartype network_mode: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.NetworkMode :ivar pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. @@ -1093,13 +1062,12 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): :ivar outbound_type: This can only be set at cluster creation time and cannot be changed later. For more information see `egress outbound type `_. Known values are: "loadBalancer", - "userDefinedRouting", "managedNATGateway", "userAssignedNATGateway". Default value: - "loadBalancer". + "userDefinedRouting", "managedNATGateway", and "userAssignedNATGateway". :vartype outbound_type: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.OutboundType :ivar load_balancer_sku: The default is 'standard'. See `Azure Load Balancer SKUs `_ for more information about the - differences between load balancer SKUs. Known values are: "standard", "basic". + differences between load balancer SKUs. Known values are: "standard" and "basic". :vartype load_balancer_sku: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.LoadBalancerSku :ivar load_balancer_profile: Profile of the cluster load balancer. @@ -1123,40 +1091,42 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): """ _validation = { - 'pod_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, - 'service_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, - 'dns_service_ip': {'pattern': r'^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$'}, - 'docker_bridge_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, + "pod_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, + "service_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, + "dns_service_ip": { + "pattern": r"^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$" + }, + "docker_bridge_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, } _attribute_map = { - 'network_plugin': {'key': 'networkPlugin', 'type': 'str'}, - 'network_policy': {'key': 'networkPolicy', 'type': 'str'}, - 'network_mode': {'key': 'networkMode', 'type': 'str'}, - 'pod_cidr': {'key': 'podCidr', 'type': 'str'}, - 'service_cidr': {'key': 'serviceCidr', 'type': 'str'}, - 'dns_service_ip': {'key': 'dnsServiceIP', 'type': 'str'}, - 'docker_bridge_cidr': {'key': 'dockerBridgeCidr', 'type': 'str'}, - 'outbound_type': {'key': 'outboundType', 'type': 'str'}, - 'load_balancer_sku': {'key': 'loadBalancerSku', 'type': 'str'}, - 'load_balancer_profile': {'key': 'loadBalancerProfile', 'type': 'ManagedClusterLoadBalancerProfile'}, - 'nat_gateway_profile': {'key': 'natGatewayProfile', 'type': 'ManagedClusterNATGatewayProfile'}, - 'pod_cidrs': {'key': 'podCidrs', 'type': '[str]'}, - 'service_cidrs': {'key': 'serviceCidrs', 'type': '[str]'}, - 'ip_families': {'key': 'ipFamilies', 'type': '[str]'}, + "network_plugin": {"key": "networkPlugin", "type": "str"}, + "network_policy": {"key": "networkPolicy", "type": "str"}, + "network_mode": {"key": "networkMode", "type": "str"}, + "pod_cidr": {"key": "podCidr", "type": "str"}, + "service_cidr": {"key": "serviceCidr", "type": "str"}, + "dns_service_ip": {"key": "dnsServiceIP", "type": "str"}, + "docker_bridge_cidr": {"key": "dockerBridgeCidr", "type": "str"}, + "outbound_type": {"key": "outboundType", "type": "str"}, + "load_balancer_sku": {"key": "loadBalancerSku", "type": "str"}, + "load_balancer_profile": {"key": "loadBalancerProfile", "type": "ManagedClusterLoadBalancerProfile"}, + "nat_gateway_profile": {"key": "natGatewayProfile", "type": "ManagedClusterNATGatewayProfile"}, + "pod_cidrs": {"key": "podCidrs", "type": "[str]"}, + "service_cidrs": {"key": "serviceCidrs", "type": "[str]"}, + "ip_families": {"key": "ipFamilies", "type": "[str]"}, } def __init__( self, *, - network_plugin: Optional[Union[str, "_models.NetworkPlugin"]] = "kubenet", + network_plugin: Union[str, "_models.NetworkPlugin"] = "kubenet", network_policy: Optional[Union[str, "_models.NetworkPolicy"]] = None, network_mode: Optional[Union[str, "_models.NetworkMode"]] = None, - pod_cidr: Optional[str] = "10.244.0.0/16", - service_cidr: Optional[str] = "10.0.0.0/16", - dns_service_ip: Optional[str] = "10.0.0.10", - docker_bridge_cidr: Optional[str] = "172.17.0.1/16", - outbound_type: Optional[Union[str, "_models.OutboundType"]] = "loadBalancer", + pod_cidr: str = "10.244.0.0/16", + service_cidr: str = "10.0.0.0/16", + dns_service_ip: str = "10.0.0.10", + docker_bridge_cidr: str = "172.17.0.1/16", + outbound_type: Union[str, "_models.OutboundType"] = "loadBalancer", load_balancer_sku: Optional[Union[str, "_models.LoadBalancerSku"]] = None, load_balancer_profile: Optional["_models.ManagedClusterLoadBalancerProfile"] = None, nat_gateway_profile: Optional["_models.ManagedClusterNATGatewayProfile"] = None, @@ -1167,15 +1137,15 @@ def __init__( ): """ :keyword network_plugin: Network plugin used for building the Kubernetes network. Known values - are: "azure", "kubenet". Default value: "kubenet". + are: "azure" and "kubenet". :paramtype network_plugin: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.NetworkPlugin :keyword network_policy: Network policy used for building the Kubernetes network. Known values - are: "calico", "azure". + are: "calico" and "azure". :paramtype network_policy: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.NetworkPolicy :keyword network_mode: This cannot be specified if networkPlugin is anything other than - 'azure'. Known values are: "transparent", "bridge". + 'azure'. Known values are: "transparent" and "bridge". :paramtype network_mode: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.NetworkMode :keyword pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. @@ -1192,13 +1162,12 @@ def __init__( :keyword outbound_type: This can only be set at cluster creation time and cannot be changed later. For more information see `egress outbound type `_. Known values are: "loadBalancer", - "userDefinedRouting", "managedNATGateway", "userAssignedNATGateway". Default value: - "loadBalancer". + "userDefinedRouting", "managedNATGateway", and "userAssignedNATGateway". :paramtype outbound_type: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.OutboundType :keyword load_balancer_sku: The default is 'standard'. See `Azure Load Balancer SKUs `_ for more information about the - differences between load balancer SKUs. Known values are: "standard", "basic". + differences between load balancer SKUs. Known values are: "standard" and "basic". :paramtype load_balancer_sku: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.LoadBalancerSku :keyword load_balancer_profile: Profile of the cluster load balancer. @@ -1220,7 +1189,7 @@ def __init__( :paramtype ip_families: list[str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.IpFamily] """ - super(ContainerServiceNetworkProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.network_plugin = network_plugin self.network_policy = network_policy self.network_mode = network_mode @@ -1237,113 +1206,98 @@ def __init__( self.ip_families = ip_families -class ContainerServiceSshConfiguration(msrest.serialization.Model): +class ContainerServiceSshConfiguration(_serialization.Model): """SSH configuration for Linux-based VMs running on Azure. All required parameters must be populated in order to send to Azure. - :ivar public_keys: Required. The list of SSH public keys used to authenticate with Linux-based - VMs. A maximum of 1 key may be specified. + :ivar public_keys: The list of SSH public keys used to authenticate with Linux-based VMs. A + maximum of 1 key may be specified. Required. :vartype public_keys: list[~azure.mgmt.containerservice.v2021_11_01_preview.models.ContainerServiceSshPublicKey] """ _validation = { - 'public_keys': {'required': True}, + "public_keys": {"required": True}, } _attribute_map = { - 'public_keys': {'key': 'publicKeys', 'type': '[ContainerServiceSshPublicKey]'}, + "public_keys": {"key": "publicKeys", "type": "[ContainerServiceSshPublicKey]"}, } - def __init__( - self, - *, - public_keys: List["_models.ContainerServiceSshPublicKey"], - **kwargs - ): + def __init__(self, *, public_keys: List["_models.ContainerServiceSshPublicKey"], **kwargs): """ - :keyword public_keys: Required. The list of SSH public keys used to authenticate with - Linux-based VMs. A maximum of 1 key may be specified. + :keyword public_keys: The list of SSH public keys used to authenticate with Linux-based VMs. A + maximum of 1 key may be specified. Required. :paramtype public_keys: list[~azure.mgmt.containerservice.v2021_11_01_preview.models.ContainerServiceSshPublicKey] """ - super(ContainerServiceSshConfiguration, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_keys = public_keys -class ContainerServiceSshPublicKey(msrest.serialization.Model): +class ContainerServiceSshPublicKey(_serialization.Model): """Contains information about SSH certificate public key data. All required parameters must be populated in order to send to Azure. - :ivar key_data: Required. Certificate public key used to authenticate with VMs through SSH. The - certificate must be in PEM format with or without headers. + :ivar key_data: Certificate public key used to authenticate with VMs through SSH. The + certificate must be in PEM format with or without headers. Required. :vartype key_data: str """ _validation = { - 'key_data': {'required': True}, + "key_data": {"required": True}, } _attribute_map = { - 'key_data': {'key': 'keyData', 'type': 'str'}, + "key_data": {"key": "keyData", "type": "str"}, } - def __init__( - self, - *, - key_data: str, - **kwargs - ): + def __init__(self, *, key_data: str, **kwargs): """ - :keyword key_data: Required. Certificate public key used to authenticate with VMs through SSH. - The certificate must be in PEM format with or without headers. + :keyword key_data: Certificate public key used to authenticate with VMs through SSH. The + certificate must be in PEM format with or without headers. Required. :paramtype key_data: str """ - super(ContainerServiceSshPublicKey, self).__init__(**kwargs) + super().__init__(**kwargs) self.key_data = key_data -class ContainerServiceVMDiagnostics(msrest.serialization.Model): +class ContainerServiceVMDiagnostics(_serialization.Model): """Profile for diagnostics on the container service VMs. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar enabled: Required. Whether the VM diagnostic agent is provisioned on the VM. + :ivar enabled: Whether the VM diagnostic agent is provisioned on the VM. Required. :vartype enabled: bool :ivar storage_uri: The URI of the storage account where diagnostics are stored. :vartype storage_uri: str """ _validation = { - 'enabled': {'required': True}, - 'storage_uri': {'readonly': True}, + "enabled": {"required": True}, + "storage_uri": {"readonly": True}, } _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'storage_uri': {'key': 'storageUri', 'type': 'str'}, + "enabled": {"key": "enabled", "type": "bool"}, + "storage_uri": {"key": "storageUri", "type": "str"}, } - def __init__( - self, - *, - enabled: bool, - **kwargs - ): + def __init__(self, *, enabled: bool, **kwargs): """ - :keyword enabled: Required. Whether the VM diagnostic agent is provisioned on the VM. + :keyword enabled: Whether the VM diagnostic agent is provisioned on the VM. Required. :paramtype enabled: bool """ - super(ContainerServiceVMDiagnostics, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.storage_uri = None -class CreationData(msrest.serialization.Model): +class CreationData(_serialization.Model): """Data used when creating a target resource from a source resource. :ivar source_resource_id: This is the ARM ID of the source object to be used to create the @@ -1352,25 +1306,20 @@ class CreationData(msrest.serialization.Model): """ _attribute_map = { - 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, + "source_resource_id": {"key": "sourceResourceId", "type": "str"}, } - def __init__( - self, - *, - source_resource_id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, source_resource_id: Optional[str] = None, **kwargs): """ :keyword source_resource_id: This is the ARM ID of the source object to be used to create the target object. :paramtype source_resource_id: str """ - super(CreationData, self).__init__(**kwargs) + super().__init__(**kwargs) self.source_resource_id = source_resource_id -class CredentialResult(msrest.serialization.Model): +class CredentialResult(_serialization.Model): """The credential result response. Variables are only populated by the server, and will be ignored when sending a request. @@ -1378,31 +1327,27 @@ class CredentialResult(msrest.serialization.Model): :ivar name: The name of the credential. :vartype name: str :ivar value: Base64-encoded Kubernetes configuration file. - :vartype value: bytearray + :vartype value: bytes """ _validation = { - 'name': {'readonly': True}, - 'value': {'readonly': True}, + "name": {"readonly": True}, + "value": {"readonly": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'bytearray'}, + "name": {"key": "name", "type": "str"}, + "value": {"key": "value", "type": "bytearray"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(CredentialResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.name = None self.value = None -class CredentialResults(msrest.serialization.Model): +class CredentialResults(_serialization.Model): """The list credential result response. Variables are only populated by the server, and will be ignored when sending a request. @@ -1413,24 +1358,20 @@ class CredentialResults(msrest.serialization.Model): """ _validation = { - 'kubeconfigs': {'readonly': True}, + "kubeconfigs": {"readonly": True}, } _attribute_map = { - 'kubeconfigs': {'key': 'kubeconfigs', 'type': '[CredentialResult]'}, + "kubeconfigs": {"key": "kubeconfigs", "type": "[CredentialResult]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(CredentialResults, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.kubeconfigs = None -class EndpointDependency(msrest.serialization.Model): +class EndpointDependency(_serialization.Model): """A domain name that AKS agent nodes are reaching at. :ivar domain_name: The domain name of the dependency. @@ -1441,8 +1382,8 @@ class EndpointDependency(msrest.serialization.Model): """ _attribute_map = { - 'domain_name': {'key': 'domainName', 'type': 'str'}, - 'endpoint_details': {'key': 'endpointDetails', 'type': '[EndpointDetail]'}, + "domain_name": {"key": "domainName", "type": "str"}, + "endpoint_details": {"key": "endpointDetails", "type": "[EndpointDetail]"}, } def __init__( @@ -1459,12 +1400,12 @@ def __init__( :paramtype endpoint_details: list[~azure.mgmt.containerservice.v2021_11_01_preview.models.EndpointDetail] """ - super(EndpointDependency, self).__init__(**kwargs) + super().__init__(**kwargs) self.domain_name = domain_name self.endpoint_details = endpoint_details -class EndpointDetail(msrest.serialization.Model): +class EndpointDetail(_serialization.Model): """connect information from the AKS agent nodes to a single endpoint. :ivar ip_address: An IP Address that Domain Name currently resolves to. @@ -1478,10 +1419,10 @@ class EndpointDetail(msrest.serialization.Model): """ _attribute_map = { - 'ip_address': {'key': 'ipAddress', 'type': 'str'}, - 'port': {'key': 'port', 'type': 'int'}, - 'protocol': {'key': 'protocol', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, + "ip_address": {"key": "ipAddress", "type": "str"}, + "port": {"key": "port", "type": "int"}, + "protocol": {"key": "protocol", "type": "str"}, + "description": {"key": "description", "type": "str"}, } def __init__( @@ -1503,26 +1444,26 @@ def __init__( :keyword description: Description of the detail. :paramtype description: str """ - super(EndpointDetail, self).__init__(**kwargs) + super().__init__(**kwargs) self.ip_address = ip_address self.port = port self.protocol = protocol self.description = description -class ExtendedLocation(msrest.serialization.Model): +class ExtendedLocation(_serialization.Model): """The complex type of the extended location. :ivar name: The name of the extended location. :vartype name: str - :ivar type: The type of the extended location. Known values are: "EdgeZone". + :ivar type: The type of the extended location. "EdgeZone" :vartype type: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.ExtendedLocationTypes """ _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, } def __init__( @@ -1535,16 +1476,16 @@ def __init__( """ :keyword name: The name of the extended location. :paramtype name: str - :keyword type: The type of the extended location. Known values are: "EdgeZone". + :keyword type: The type of the extended location. "EdgeZone" :paramtype type: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.ExtendedLocationTypes """ - super(ExtendedLocation, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.type = type -class KubeletConfig(msrest.serialization.Model): +class KubeletConfig(_serialization.Model): # pylint: disable=too-many-instance-attributes """See `AKS custom node configuration `_ for more details. :ivar cpu_manager_policy: The default is 'none'. See `Kubernetes CPU management policies @@ -1584,21 +1525,21 @@ class KubeletConfig(msrest.serialization.Model): """ _validation = { - 'container_log_max_files': {'minimum': 2}, + "container_log_max_files": {"minimum": 2}, } _attribute_map = { - 'cpu_manager_policy': {'key': 'cpuManagerPolicy', 'type': 'str'}, - 'cpu_cfs_quota': {'key': 'cpuCfsQuota', 'type': 'bool'}, - 'cpu_cfs_quota_period': {'key': 'cpuCfsQuotaPeriod', 'type': 'str'}, - 'image_gc_high_threshold': {'key': 'imageGcHighThreshold', 'type': 'int'}, - 'image_gc_low_threshold': {'key': 'imageGcLowThreshold', 'type': 'int'}, - 'topology_manager_policy': {'key': 'topologyManagerPolicy', 'type': 'str'}, - 'allowed_unsafe_sysctls': {'key': 'allowedUnsafeSysctls', 'type': '[str]'}, - 'fail_swap_on': {'key': 'failSwapOn', 'type': 'bool'}, - 'container_log_max_size_mb': {'key': 'containerLogMaxSizeMB', 'type': 'int'}, - 'container_log_max_files': {'key': 'containerLogMaxFiles', 'type': 'int'}, - 'pod_max_pids': {'key': 'podMaxPids', 'type': 'int'}, + "cpu_manager_policy": {"key": "cpuManagerPolicy", "type": "str"}, + "cpu_cfs_quota": {"key": "cpuCfsQuota", "type": "bool"}, + "cpu_cfs_quota_period": {"key": "cpuCfsQuotaPeriod", "type": "str"}, + "image_gc_high_threshold": {"key": "imageGcHighThreshold", "type": "int"}, + "image_gc_low_threshold": {"key": "imageGcLowThreshold", "type": "int"}, + "topology_manager_policy": {"key": "topologyManagerPolicy", "type": "str"}, + "allowed_unsafe_sysctls": {"key": "allowedUnsafeSysctls", "type": "[str]"}, + "fail_swap_on": {"key": "failSwapOn", "type": "bool"}, + "container_log_max_size_mb": {"key": "containerLogMaxSizeMB", "type": "int"}, + "container_log_max_files": {"key": "containerLogMaxFiles", "type": "int"}, + "pod_max_pids": {"key": "podMaxPids", "type": "int"}, } def __init__( @@ -1653,7 +1594,7 @@ def __init__( :keyword pod_max_pids: The maximum number of processes per pod. :paramtype pod_max_pids: int """ - super(KubeletConfig, self).__init__(**kwargs) + super().__init__(**kwargs) self.cpu_manager_policy = cpu_manager_policy self.cpu_cfs_quota = cpu_cfs_quota self.cpu_cfs_quota_period = cpu_cfs_quota_period @@ -1667,7 +1608,7 @@ def __init__( self.pod_max_pids = pod_max_pids -class LinuxOSConfig(msrest.serialization.Model): +class LinuxOSConfig(_serialization.Model): """See `AKS custom node configuration `_ for more details. :ivar sysctls: Sysctl settings for Linux agent nodes. @@ -1686,10 +1627,10 @@ class LinuxOSConfig(msrest.serialization.Model): """ _attribute_map = { - 'sysctls': {'key': 'sysctls', 'type': 'SysctlConfig'}, - 'transparent_huge_page_enabled': {'key': 'transparentHugePageEnabled', 'type': 'str'}, - 'transparent_huge_page_defrag': {'key': 'transparentHugePageDefrag', 'type': 'str'}, - 'swap_file_size_mb': {'key': 'swapFileSizeMB', 'type': 'int'}, + "sysctls": {"key": "sysctls", "type": "SysctlConfig"}, + "transparent_huge_page_enabled": {"key": "transparentHugePageEnabled", "type": "str"}, + "transparent_huge_page_defrag": {"key": "transparentHugePageDefrag", "type": "str"}, + "swap_file_size_mb": {"key": "swapFileSizeMB", "type": "int"}, } def __init__( @@ -1716,7 +1657,7 @@ def __init__( :keyword swap_file_size_mb: The size in MB of a swap file that will be created on each node. :paramtype swap_file_size_mb: int """ - super(LinuxOSConfig, self).__init__(**kwargs) + super().__init__(**kwargs) self.sysctls = sysctls self.transparent_huge_page_enabled = transparent_huge_page_enabled self.transparent_huge_page_defrag = transparent_huge_page_defrag @@ -1746,19 +1687,19 @@ class MaintenanceConfiguration(SubResource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, + "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'}, - 'time_in_week': {'key': 'properties.timeInWeek', 'type': '[TimeInWeek]'}, - 'not_allowed_time': {'key': 'properties.notAllowedTime', 'type': '[TimeSpan]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "time_in_week": {"key": "properties.timeInWeek", "type": "[TimeInWeek]"}, + "not_allowed_time": {"key": "properties.notAllowedTime", "type": "[TimeSpan]"}, } def __init__( @@ -1777,13 +1718,13 @@ def __init__( :paramtype not_allowed_time: list[~azure.mgmt.containerservice.v2021_11_01_preview.models.TimeSpan] """ - super(MaintenanceConfiguration, self).__init__(**kwargs) + super().__init__(**kwargs) self.system_data = None self.time_in_week = time_in_week self.not_allowed_time = not_allowed_time -class MaintenanceConfigurationListResult(msrest.serialization.Model): +class MaintenanceConfigurationListResult(_serialization.Model): """The response from the List maintenance configurations operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -1796,31 +1737,26 @@ class MaintenanceConfigurationListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[MaintenanceConfiguration]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[MaintenanceConfiguration]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.MaintenanceConfiguration"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.MaintenanceConfiguration"]] = None, **kwargs): """ :keyword value: The list of maintenance configurations. :paramtype value: list[~azure.mgmt.containerservice.v2021_11_01_preview.models.MaintenanceConfiguration] """ - super(MaintenanceConfigurationListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class Resource(msrest.serialization.Model): +class Resource(_serialization.Model): """The Resource model definition. Variables are only populated by the server, and will be ignored when sending a request. @@ -1833,41 +1769,35 @@ class Resource(msrest.serialization.Model): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] """ - super(Resource, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -1875,7 +1805,7 @@ def __init__( self.tags = tags -class ManagedCluster(Resource): +class ManagedCluster(Resource): # pylint: disable=too-many-instance-attributes """Managed cluster. Variables are only populated by the server, and will be ignored when sending a request. @@ -1888,9 +1818,9 @@ class ManagedCluster(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar sku: The managed cluster SKU. :vartype sku: ~azure.mgmt.containerservice.v2021_11_01_preview.models.ManagedClusterSKU @@ -1998,70 +1928,79 @@ class ManagedCluster(Resource): :vartype security_profile: ~azure.mgmt.containerservice.v2021_11_01_preview.models.ManagedClusterSecurityProfile :ivar public_network_access: Allow or deny public network access for AKS. Known values are: - "Enabled", "Disabled". + "Enabled" and "Disabled". :vartype public_network_access: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.PublicNetworkAccess """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'provisioning_state': {'readonly': True}, - 'power_state': {'readonly': True}, - 'max_agent_pools': {'readonly': True}, - 'current_kubernetes_version': {'readonly': True}, - 'fqdn': {'readonly': True}, - 'private_fqdn': {'readonly': True}, - 'azure_portal_fqdn': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, + "provisioning_state": {"readonly": True}, + "power_state": {"readonly": True}, + "max_agent_pools": {"readonly": True}, + "current_kubernetes_version": {"readonly": True}, + "fqdn": {"readonly": True}, + "private_fqdn": {"readonly": True}, + "azure_portal_fqdn": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'ManagedClusterSKU'}, - 'extended_location': {'key': 'extendedLocation', 'type': 'ExtendedLocation'}, - 'identity': {'key': 'identity', 'type': 'ManagedClusterIdentity'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'power_state': {'key': 'properties.powerState', 'type': 'PowerState'}, - 'max_agent_pools': {'key': 'properties.maxAgentPools', 'type': 'int'}, - 'kubernetes_version': {'key': 'properties.kubernetesVersion', 'type': 'str'}, - 'current_kubernetes_version': {'key': 'properties.currentKubernetesVersion', 'type': 'str'}, - 'dns_prefix': {'key': 'properties.dnsPrefix', 'type': 'str'}, - 'fqdn_subdomain': {'key': 'properties.fqdnSubdomain', 'type': 'str'}, - 'fqdn': {'key': 'properties.fqdn', 'type': 'str'}, - 'private_fqdn': {'key': 'properties.privateFQDN', 'type': 'str'}, - 'azure_portal_fqdn': {'key': 'properties.azurePortalFQDN', 'type': 'str'}, - 'agent_pool_profiles': {'key': 'properties.agentPoolProfiles', 'type': '[ManagedClusterAgentPoolProfile]'}, - 'linux_profile': {'key': 'properties.linuxProfile', 'type': 'ContainerServiceLinuxProfile'}, - 'windows_profile': {'key': 'properties.windowsProfile', 'type': 'ManagedClusterWindowsProfile'}, - 'service_principal_profile': {'key': 'properties.servicePrincipalProfile', 'type': 'ManagedClusterServicePrincipalProfile'}, - 'addon_profiles': {'key': 'properties.addonProfiles', 'type': '{ManagedClusterAddonProfile}'}, - 'pod_identity_profile': {'key': 'properties.podIdentityProfile', 'type': 'ManagedClusterPodIdentityProfile'}, - 'oidc_issuer_profile': {'key': 'properties.oidcIssuerProfile', 'type': 'ManagedClusterOIDCIssuerProfile'}, - 'node_resource_group': {'key': 'properties.nodeResourceGroup', 'type': 'str'}, - 'enable_rbac': {'key': 'properties.enableRBAC', 'type': 'bool'}, - 'enable_pod_security_policy': {'key': 'properties.enablePodSecurityPolicy', 'type': 'bool'}, - 'enable_namespace_resources': {'key': 'properties.enableNamespaceResources', 'type': 'bool'}, - 'network_profile': {'key': 'properties.networkProfile', 'type': 'ContainerServiceNetworkProfile'}, - 'aad_profile': {'key': 'properties.aadProfile', 'type': 'ManagedClusterAADProfile'}, - 'auto_upgrade_profile': {'key': 'properties.autoUpgradeProfile', 'type': 'ManagedClusterAutoUpgradeProfile'}, - 'auto_scaler_profile': {'key': 'properties.autoScalerProfile', 'type': 'ManagedClusterPropertiesAutoScalerProfile'}, - 'api_server_access_profile': {'key': 'properties.apiServerAccessProfile', 'type': 'ManagedClusterAPIServerAccessProfile'}, - 'disk_encryption_set_id': {'key': 'properties.diskEncryptionSetID', 'type': 'str'}, - 'identity_profile': {'key': 'properties.identityProfile', 'type': '{UserAssignedIdentity}'}, - 'private_link_resources': {'key': 'properties.privateLinkResources', 'type': '[PrivateLinkResource]'}, - 'disable_local_accounts': {'key': 'properties.disableLocalAccounts', 'type': 'bool'}, - 'http_proxy_config': {'key': 'properties.httpProxyConfig', 'type': 'ManagedClusterHTTPProxyConfig'}, - 'security_profile': {'key': 'properties.securityProfile', 'type': 'ManagedClusterSecurityProfile'}, - 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, - } - - def __init__( + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "sku": {"key": "sku", "type": "ManagedClusterSKU"}, + "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, + "identity": {"key": "identity", "type": "ManagedClusterIdentity"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "power_state": {"key": "properties.powerState", "type": "PowerState"}, + "max_agent_pools": {"key": "properties.maxAgentPools", "type": "int"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "current_kubernetes_version": {"key": "properties.currentKubernetesVersion", "type": "str"}, + "dns_prefix": {"key": "properties.dnsPrefix", "type": "str"}, + "fqdn_subdomain": {"key": "properties.fqdnSubdomain", "type": "str"}, + "fqdn": {"key": "properties.fqdn", "type": "str"}, + "private_fqdn": {"key": "properties.privateFQDN", "type": "str"}, + "azure_portal_fqdn": {"key": "properties.azurePortalFQDN", "type": "str"}, + "agent_pool_profiles": {"key": "properties.agentPoolProfiles", "type": "[ManagedClusterAgentPoolProfile]"}, + "linux_profile": {"key": "properties.linuxProfile", "type": "ContainerServiceLinuxProfile"}, + "windows_profile": {"key": "properties.windowsProfile", "type": "ManagedClusterWindowsProfile"}, + "service_principal_profile": { + "key": "properties.servicePrincipalProfile", + "type": "ManagedClusterServicePrincipalProfile", + }, + "addon_profiles": {"key": "properties.addonProfiles", "type": "{ManagedClusterAddonProfile}"}, + "pod_identity_profile": {"key": "properties.podIdentityProfile", "type": "ManagedClusterPodIdentityProfile"}, + "oidc_issuer_profile": {"key": "properties.oidcIssuerProfile", "type": "ManagedClusterOIDCIssuerProfile"}, + "node_resource_group": {"key": "properties.nodeResourceGroup", "type": "str"}, + "enable_rbac": {"key": "properties.enableRBAC", "type": "bool"}, + "enable_pod_security_policy": {"key": "properties.enablePodSecurityPolicy", "type": "bool"}, + "enable_namespace_resources": {"key": "properties.enableNamespaceResources", "type": "bool"}, + "network_profile": {"key": "properties.networkProfile", "type": "ContainerServiceNetworkProfile"}, + "aad_profile": {"key": "properties.aadProfile", "type": "ManagedClusterAADProfile"}, + "auto_upgrade_profile": {"key": "properties.autoUpgradeProfile", "type": "ManagedClusterAutoUpgradeProfile"}, + "auto_scaler_profile": { + "key": "properties.autoScalerProfile", + "type": "ManagedClusterPropertiesAutoScalerProfile", + }, + "api_server_access_profile": { + "key": "properties.apiServerAccessProfile", + "type": "ManagedClusterAPIServerAccessProfile", + }, + "disk_encryption_set_id": {"key": "properties.diskEncryptionSetID", "type": "str"}, + "identity_profile": {"key": "properties.identityProfile", "type": "{UserAssignedIdentity}"}, + "private_link_resources": {"key": "properties.privateLinkResources", "type": "[PrivateLinkResource]"}, + "disable_local_accounts": {"key": "properties.disableLocalAccounts", "type": "bool"}, + "http_proxy_config": {"key": "properties.httpProxyConfig", "type": "ManagedClusterHTTPProxyConfig"}, + "security_profile": {"key": "properties.securityProfile", "type": "ManagedClusterSecurityProfile"}, + "public_network_access": {"key": "properties.publicNetworkAccess", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, location: str, @@ -2098,9 +2037,9 @@ def __init__( **kwargs ): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword sku: The managed cluster SKU. :paramtype sku: ~azure.mgmt.containerservice.v2021_11_01_preview.models.ManagedClusterSKU @@ -2193,11 +2132,11 @@ def __init__( :paramtype security_profile: ~azure.mgmt.containerservice.v2021_11_01_preview.models.ManagedClusterSecurityProfile :keyword public_network_access: Allow or deny public network access for AKS. Known values are: - "Enabled", "Disabled". + "Enabled" and "Disabled". :paramtype public_network_access: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.PublicNetworkAccess """ - super(ManagedCluster, self).__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.sku = sku self.extended_location = extended_location self.identity = identity @@ -2236,7 +2175,7 @@ def __init__( self.public_network_access = public_network_access -class ManagedClusterAADProfile(msrest.serialization.Model): +class ManagedClusterAADProfile(_serialization.Model): """For more details see `managed AAD on AKS `_. :ivar managed: Whether to enable managed AAD. @@ -2258,13 +2197,13 @@ class ManagedClusterAADProfile(msrest.serialization.Model): """ _attribute_map = { - 'managed': {'key': 'managed', 'type': 'bool'}, - 'enable_azure_rbac': {'key': 'enableAzureRBAC', 'type': 'bool'}, - 'admin_group_object_i_ds': {'key': 'adminGroupObjectIDs', 'type': '[str]'}, - 'client_app_id': {'key': 'clientAppID', 'type': 'str'}, - 'server_app_id': {'key': 'serverAppID', 'type': 'str'}, - 'server_app_secret': {'key': 'serverAppSecret', 'type': 'str'}, - 'tenant_id': {'key': 'tenantID', 'type': 'str'}, + "managed": {"key": "managed", "type": "bool"}, + "enable_azure_rbac": {"key": "enableAzureRBAC", "type": "bool"}, + "admin_group_object_i_ds": {"key": "adminGroupObjectIDs", "type": "[str]"}, + "client_app_id": {"key": "clientAppID", "type": "str"}, + "server_app_id": {"key": "serverAppID", "type": "str"}, + "server_app_secret": {"key": "serverAppSecret", "type": "str"}, + "tenant_id": {"key": "tenantID", "type": "str"}, } def __init__( @@ -2297,7 +2236,7 @@ def __init__( tenant of the deployment subscription. :paramtype tenant_id: str """ - super(ManagedClusterAADProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.managed = managed self.enable_azure_rbac = enable_azure_rbac self.admin_group_object_i_ds = admin_group_object_i_ds @@ -2320,58 +2259,53 @@ class ManagedClusterAccessProfile(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar kube_config: Base64-encoded Kubernetes configuration file. - :vartype kube_config: bytearray + :vartype kube_config: bytes """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'kube_config': {'key': 'properties.kubeConfig', 'type': 'bytearray'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "kube_config": {"key": "properties.kubeConfig", "type": "bytearray"}, } def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - kube_config: Optional[bytearray] = None, - **kwargs + self, *, location: str, tags: Optional[Dict[str, str]] = None, kube_config: Optional[bytes] = None, **kwargs ): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword kube_config: Base64-encoded Kubernetes configuration file. - :paramtype kube_config: bytearray + :paramtype kube_config: bytes """ - super(ManagedClusterAccessProfile, self).__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.kube_config = kube_config -class ManagedClusterAddonProfile(msrest.serialization.Model): +class ManagedClusterAddonProfile(_serialization.Model): """A Kubernetes add-on profile for a managed cluster. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar enabled: Required. Whether the add-on is enabled or not. + :ivar enabled: Whether the add-on is enabled or not. Required. :vartype enabled: bool :ivar config: Key-value pairs for configuring an add-on. :vartype config: dict[str, str] @@ -2381,36 +2315,30 @@ class ManagedClusterAddonProfile(msrest.serialization.Model): """ _validation = { - 'enabled': {'required': True}, - 'identity': {'readonly': True}, + "enabled": {"required": True}, + "identity": {"readonly": True}, } _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'config': {'key': 'config', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'ManagedClusterAddonProfileIdentity'}, + "enabled": {"key": "enabled", "type": "bool"}, + "config": {"key": "config", "type": "{str}"}, + "identity": {"key": "identity", "type": "ManagedClusterAddonProfileIdentity"}, } - def __init__( - self, - *, - enabled: bool, - config: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, enabled: bool, config: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword enabled: Required. Whether the add-on is enabled or not. + :keyword enabled: Whether the add-on is enabled or not. Required. :paramtype enabled: bool :keyword config: Key-value pairs for configuring an add-on. :paramtype config: dict[str, str] """ - super(ManagedClusterAddonProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.config = config self.identity = None -class UserAssignedIdentity(msrest.serialization.Model): +class UserAssignedIdentity(_serialization.Model): """Details about a user assigned identity. :ivar resource_id: The resource ID of the user assigned identity. @@ -2422,9 +2350,9 @@ class UserAssignedIdentity(msrest.serialization.Model): """ _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'object_id': {'key': 'objectId', 'type': 'str'}, + "resource_id": {"key": "resourceId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + "object_id": {"key": "objectId", "type": "str"}, } def __init__( @@ -2443,7 +2371,7 @@ def __init__( :keyword object_id: The object ID of the user assigned identity. :paramtype object_id: str """ - super(UserAssignedIdentity, self).__init__(**kwargs) + super().__init__(**kwargs) self.resource_id = resource_id self.client_id = client_id self.object_id = object_id @@ -2461,9 +2389,9 @@ class ManagedClusterAddonProfileIdentity(UserAssignedIdentity): """ _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'object_id': {'key': 'objectId', 'type': 'str'}, + "resource_id": {"key": "resourceId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + "object_id": {"key": "objectId", "type": "str"}, } def __init__( @@ -2482,10 +2410,10 @@ def __init__( :keyword object_id: The object ID of the user assigned identity. :paramtype object_id: str """ - super(ManagedClusterAddonProfileIdentity, self).__init__(resource_id=resource_id, client_id=client_id, object_id=object_id, **kwargs) + super().__init__(resource_id=resource_id, client_id=client_id, object_id=object_id, **kwargs) -class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): +class ManagedClusterAgentPoolProfileProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes """Properties for the container service agent pool profile. Variables are only populated by the server, and will be ignored when sending a request. @@ -2506,15 +2434,15 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.OSDiskType :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data - root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.KubeletDiskType :ivar workload_runtime: Determines the type of workload a node can run. Known values are: - "OCIContainer", "WasmWasi". + "OCIContainer" and "WasmWasi". :vartype workload_runtime: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.WorkloadRuntime :ivar message_of_the_day: A base64-encoded string which will be written to /etc/motd after @@ -2533,11 +2461,11 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :vartype pod_subnet_id: str :ivar max_pods: The maximum number of pods that can run on a node. :vartype max_pods: int - :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.OSType :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known - values are: "Ubuntu", "CBLMariner". + values are: "Ubuntu" and "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.OSSKU :ivar max_count: The maximum number of nodes for auto-scaling. :vartype max_count: int @@ -2546,15 +2474,15 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it - defaults to Delete. Known values are: "Delete", "Deallocate". + defaults to Delete. Known values are: "Delete" and "Deallocate". :vartype scale_down_mode: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.ScaleDownMode - :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", + :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets" and "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.AgentPoolType :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :vartype mode: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.AgentPoolMode :ivar orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -2589,20 +2517,18 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default - is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + is 'Regular'. Known values are: "Spot" and "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.ScaleSetPriority :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.ScaleSetEvictionPolicy :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :vartype spot_max_price: float - :ivar tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :ivar tags: The tags to be persisted on the agent pool virtual machine scale set. :vartype tags: dict[str, str] :ivar node_labels: The node labels to be persisted across all nodes in agent pool. :vartype node_labels: dict[str, str] @@ -2626,7 +2552,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): for more details. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.GPUInstanceProfile :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the node pool @@ -2638,56 +2564,56 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): """ _validation = { - 'os_disk_size_gb': {'maximum': 2048, 'minimum': 0}, - 'node_image_version': {'readonly': True}, - 'provisioning_state': {'readonly': True}, + "os_disk_size_gb": {"maximum": 2048, "minimum": 0}, + "node_image_version": {"readonly": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'os_disk_type': {'key': 'osDiskType', 'type': 'str'}, - 'kubelet_disk_type': {'key': 'kubeletDiskType', 'type': 'str'}, - 'workload_runtime': {'key': 'workloadRuntime', 'type': 'str'}, - 'message_of_the_day': {'key': 'messageOfTheDay', 'type': 'str'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'pod_subnet_id': {'key': 'podSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'maxPods', 'type': 'int'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'os_sku': {'key': 'osSKU', 'type': 'str'}, - 'max_count': {'key': 'maxCount', 'type': 'int'}, - 'min_count': {'key': 'minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'enableAutoScaling', 'type': 'bool'}, - 'scale_down_mode': {'key': 'scaleDownMode', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'mode': {'key': 'mode', 'type': 'str'}, - 'orchestrator_version': {'key': 'orchestratorVersion', 'type': 'str'}, - 'node_image_version': {'key': 'nodeImageVersion', 'type': 'str'}, - 'upgrade_settings': {'key': 'upgradeSettings', 'type': 'AgentPoolUpgradeSettings'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'power_state': {'key': 'powerState', 'type': 'PowerState'}, - 'availability_zones': {'key': 'availabilityZones', 'type': '[str]'}, - 'enable_node_public_ip': {'key': 'enableNodePublicIP', 'type': 'bool'}, - 'node_public_ip_prefix_id': {'key': 'nodePublicIPPrefixID', 'type': 'str'}, - 'scale_set_priority': {'key': 'scaleSetPriority', 'type': 'str'}, - 'scale_set_eviction_policy': {'key': 'scaleSetEvictionPolicy', 'type': 'str'}, - 'spot_max_price': {'key': 'spotMaxPrice', 'type': 'float'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'node_labels': {'key': 'nodeLabels', 'type': '{str}'}, - 'node_taints': {'key': 'nodeTaints', 'type': '[str]'}, - 'proximity_placement_group_id': {'key': 'proximityPlacementGroupID', 'type': 'str'}, - 'kubelet_config': {'key': 'kubeletConfig', 'type': 'KubeletConfig'}, - 'linux_os_config': {'key': 'linuxOSConfig', 'type': 'LinuxOSConfig'}, - 'enable_encryption_at_host': {'key': 'enableEncryptionAtHost', 'type': 'bool'}, - 'enable_ultra_ssd': {'key': 'enableUltraSSD', 'type': 'bool'}, - 'enable_fips': {'key': 'enableFIPS', 'type': 'bool'}, - 'gpu_instance_profile': {'key': 'gpuInstanceProfile', 'type': 'str'}, - 'creation_data': {'key': 'creationData', 'type': 'CreationData'}, - 'capacity_reservation_group_id': {'key': 'capacityReservationGroupID', 'type': 'str'}, - } - - def __init__( + "count": {"key": "count", "type": "int"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "os_disk_type": {"key": "osDiskType", "type": "str"}, + "kubelet_disk_type": {"key": "kubeletDiskType", "type": "str"}, + "workload_runtime": {"key": "workloadRuntime", "type": "str"}, + "message_of_the_day": {"key": "messageOfTheDay", "type": "str"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "pod_subnet_id": {"key": "podSubnetID", "type": "str"}, + "max_pods": {"key": "maxPods", "type": "int"}, + "os_type": {"key": "osType", "type": "str"}, + "os_sku": {"key": "osSKU", "type": "str"}, + "max_count": {"key": "maxCount", "type": "int"}, + "min_count": {"key": "minCount", "type": "int"}, + "enable_auto_scaling": {"key": "enableAutoScaling", "type": "bool"}, + "scale_down_mode": {"key": "scaleDownMode", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "mode": {"key": "mode", "type": "str"}, + "orchestrator_version": {"key": "orchestratorVersion", "type": "str"}, + "node_image_version": {"key": "nodeImageVersion", "type": "str"}, + "upgrade_settings": {"key": "upgradeSettings", "type": "AgentPoolUpgradeSettings"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "power_state": {"key": "powerState", "type": "PowerState"}, + "availability_zones": {"key": "availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "enableNodePublicIP", "type": "bool"}, + "node_public_ip_prefix_id": {"key": "nodePublicIPPrefixID", "type": "str"}, + "scale_set_priority": {"key": "scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "scaleSetEvictionPolicy", "type": "str"}, + "spot_max_price": {"key": "spotMaxPrice", "type": "float"}, + "tags": {"key": "tags", "type": "{str}"}, + "node_labels": {"key": "nodeLabels", "type": "{str}"}, + "node_taints": {"key": "nodeTaints", "type": "[str]"}, + "proximity_placement_group_id": {"key": "proximityPlacementGroupID", "type": "str"}, + "kubelet_config": {"key": "kubeletConfig", "type": "KubeletConfig"}, + "linux_os_config": {"key": "linuxOSConfig", "type": "LinuxOSConfig"}, + "enable_encryption_at_host": {"key": "enableEncryptionAtHost", "type": "bool"}, + "enable_ultra_ssd": {"key": "enableUltraSSD", "type": "bool"}, + "enable_fips": {"key": "enableFIPS", "type": "bool"}, + "gpu_instance_profile": {"key": "gpuInstanceProfile", "type": "str"}, + "creation_data": {"key": "creationData", "type": "CreationData"}, + "capacity_reservation_group_id": {"key": "capacityReservationGroupID", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, count: Optional[int] = None, @@ -2700,7 +2626,7 @@ def __init__( vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, @@ -2714,9 +2640,9 @@ def __init__( availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", - spot_max_price: Optional[float] = -1, + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", + spot_max_price: float = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, @@ -2748,15 +2674,15 @@ def __init__( larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.OSDiskType :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime - data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + data root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.KubeletDiskType :keyword workload_runtime: Determines the type of workload a node can run. Known values are: - "OCIContainer", "WasmWasi". + "OCIContainer" and "WasmWasi". :paramtype workload_runtime: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.WorkloadRuntime :keyword message_of_the_day: A base64-encoded string which will be written to /etc/motd after @@ -2775,11 +2701,11 @@ def __init__( :paramtype pod_subnet_id: str :keyword max_pods: The maximum number of pods that can run on a node. :paramtype max_pods: int - :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.OSType :keyword os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Known values are: "Ubuntu", "CBLMariner". + Known values are: "Ubuntu" and "CBLMariner". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.OSSKU :keyword max_count: The maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -2788,15 +2714,15 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, - it defaults to Delete. Known values are: "Delete", "Deallocate". + it defaults to Delete. Known values are: "Delete" and "Deallocate". :paramtype scale_down_mode: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.ScaleDownMode - :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", + :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.AgentPoolType :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.AgentPoolMode :keyword orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -2827,20 +2753,18 @@ def __init__( /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the - default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + default is 'Regular'. Known values are: "Spot" and "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.ScaleSetPriority :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.ScaleSetEvictionPolicy :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :paramtype spot_max_price: float - :keyword tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :keyword tags: The tags to be persisted on the agent pool virtual machine scale set. :paramtype tags: dict[str, str] :keyword node_labels: The node labels to be persisted across all nodes in agent pool. :paramtype node_labels: dict[str, str] @@ -2866,7 +2790,7 @@ def __init__( for more details. :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance - profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.GPUInstanceProfile @@ -2877,7 +2801,7 @@ def __init__( Capacity Reservation Group. :paramtype capacity_reservation_group_id: str """ - super(ManagedClusterAgentPoolProfileProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.vm_size = vm_size self.os_disk_size_gb = os_disk_size_gb @@ -2921,7 +2845,9 @@ def __init__( self.capacity_reservation_group_id = capacity_reservation_group_id -class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): +class ManagedClusterAgentPoolProfile( + ManagedClusterAgentPoolProfileProperties +): # pylint: disable=too-many-instance-attributes """Profile for the container service agent pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -2944,15 +2870,15 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.OSDiskType :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data - root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.KubeletDiskType :ivar workload_runtime: Determines the type of workload a node can run. Known values are: - "OCIContainer", "WasmWasi". + "OCIContainer" and "WasmWasi". :vartype workload_runtime: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.WorkloadRuntime :ivar message_of_the_day: A base64-encoded string which will be written to /etc/motd after @@ -2971,11 +2897,11 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :vartype pod_subnet_id: str :ivar max_pods: The maximum number of pods that can run on a node. :vartype max_pods: int - :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.OSType :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known - values are: "Ubuntu", "CBLMariner". + values are: "Ubuntu" and "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.OSSKU :ivar max_count: The maximum number of nodes for auto-scaling. :vartype max_count: int @@ -2984,15 +2910,15 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it - defaults to Delete. Known values are: "Delete", "Deallocate". + defaults to Delete. Known values are: "Delete" and "Deallocate". :vartype scale_down_mode: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.ScaleDownMode - :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", + :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets" and "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.AgentPoolType :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :vartype mode: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.AgentPoolMode :ivar orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -3027,20 +2953,18 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default - is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + is 'Regular'. Known values are: "Spot" and "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.ScaleSetPriority :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.ScaleSetEvictionPolicy :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :vartype spot_max_price: float - :ivar tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :ivar tags: The tags to be persisted on the agent pool virtual machine scale set. :vartype tags: dict[str, str] :ivar node_labels: The node labels to be persisted across all nodes in agent pool. :vartype node_labels: dict[str, str] @@ -3064,7 +2988,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): for more details. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.GPUInstanceProfile :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the node pool @@ -3073,63 +2997,63 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar capacity_reservation_group_id: AKS will associate the specified agent pool with the Capacity Reservation Group. :vartype capacity_reservation_group_id: str - :ivar name: Required. Windows agent pool names must be 6 characters or less. + :ivar name: Windows agent pool names must be 6 characters or less. Required. :vartype name: str """ _validation = { - 'os_disk_size_gb': {'maximum': 2048, 'minimum': 0}, - 'node_image_version': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'name': {'required': True, 'pattern': r'^[a-z][a-z0-9]{0,11}$'}, + "os_disk_size_gb": {"maximum": 2048, "minimum": 0}, + "node_image_version": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "name": {"required": True, "pattern": r"^[a-z][a-z0-9]{0,11}$"}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'os_disk_type': {'key': 'osDiskType', 'type': 'str'}, - 'kubelet_disk_type': {'key': 'kubeletDiskType', 'type': 'str'}, - 'workload_runtime': {'key': 'workloadRuntime', 'type': 'str'}, - 'message_of_the_day': {'key': 'messageOfTheDay', 'type': 'str'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'pod_subnet_id': {'key': 'podSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'maxPods', 'type': 'int'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'os_sku': {'key': 'osSKU', 'type': 'str'}, - 'max_count': {'key': 'maxCount', 'type': 'int'}, - 'min_count': {'key': 'minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'enableAutoScaling', 'type': 'bool'}, - 'scale_down_mode': {'key': 'scaleDownMode', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'mode': {'key': 'mode', 'type': 'str'}, - 'orchestrator_version': {'key': 'orchestratorVersion', 'type': 'str'}, - 'node_image_version': {'key': 'nodeImageVersion', 'type': 'str'}, - 'upgrade_settings': {'key': 'upgradeSettings', 'type': 'AgentPoolUpgradeSettings'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'power_state': {'key': 'powerState', 'type': 'PowerState'}, - 'availability_zones': {'key': 'availabilityZones', 'type': '[str]'}, - 'enable_node_public_ip': {'key': 'enableNodePublicIP', 'type': 'bool'}, - 'node_public_ip_prefix_id': {'key': 'nodePublicIPPrefixID', 'type': 'str'}, - 'scale_set_priority': {'key': 'scaleSetPriority', 'type': 'str'}, - 'scale_set_eviction_policy': {'key': 'scaleSetEvictionPolicy', 'type': 'str'}, - 'spot_max_price': {'key': 'spotMaxPrice', 'type': 'float'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'node_labels': {'key': 'nodeLabels', 'type': '{str}'}, - 'node_taints': {'key': 'nodeTaints', 'type': '[str]'}, - 'proximity_placement_group_id': {'key': 'proximityPlacementGroupID', 'type': 'str'}, - 'kubelet_config': {'key': 'kubeletConfig', 'type': 'KubeletConfig'}, - 'linux_os_config': {'key': 'linuxOSConfig', 'type': 'LinuxOSConfig'}, - 'enable_encryption_at_host': {'key': 'enableEncryptionAtHost', 'type': 'bool'}, - 'enable_ultra_ssd': {'key': 'enableUltraSSD', 'type': 'bool'}, - 'enable_fips': {'key': 'enableFIPS', 'type': 'bool'}, - 'gpu_instance_profile': {'key': 'gpuInstanceProfile', 'type': 'str'}, - 'creation_data': {'key': 'creationData', 'type': 'CreationData'}, - 'capacity_reservation_group_id': {'key': 'capacityReservationGroupID', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( + "count": {"key": "count", "type": "int"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "os_disk_type": {"key": "osDiskType", "type": "str"}, + "kubelet_disk_type": {"key": "kubeletDiskType", "type": "str"}, + "workload_runtime": {"key": "workloadRuntime", "type": "str"}, + "message_of_the_day": {"key": "messageOfTheDay", "type": "str"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "pod_subnet_id": {"key": "podSubnetID", "type": "str"}, + "max_pods": {"key": "maxPods", "type": "int"}, + "os_type": {"key": "osType", "type": "str"}, + "os_sku": {"key": "osSKU", "type": "str"}, + "max_count": {"key": "maxCount", "type": "int"}, + "min_count": {"key": "minCount", "type": "int"}, + "enable_auto_scaling": {"key": "enableAutoScaling", "type": "bool"}, + "scale_down_mode": {"key": "scaleDownMode", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "mode": {"key": "mode", "type": "str"}, + "orchestrator_version": {"key": "orchestratorVersion", "type": "str"}, + "node_image_version": {"key": "nodeImageVersion", "type": "str"}, + "upgrade_settings": {"key": "upgradeSettings", "type": "AgentPoolUpgradeSettings"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "power_state": {"key": "powerState", "type": "PowerState"}, + "availability_zones": {"key": "availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "enableNodePublicIP", "type": "bool"}, + "node_public_ip_prefix_id": {"key": "nodePublicIPPrefixID", "type": "str"}, + "scale_set_priority": {"key": "scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "scaleSetEvictionPolicy", "type": "str"}, + "spot_max_price": {"key": "spotMaxPrice", "type": "float"}, + "tags": {"key": "tags", "type": "{str}"}, + "node_labels": {"key": "nodeLabels", "type": "{str}"}, + "node_taints": {"key": "nodeTaints", "type": "[str]"}, + "proximity_placement_group_id": {"key": "proximityPlacementGroupID", "type": "str"}, + "kubelet_config": {"key": "kubeletConfig", "type": "KubeletConfig"}, + "linux_os_config": {"key": "linuxOSConfig", "type": "LinuxOSConfig"}, + "enable_encryption_at_host": {"key": "enableEncryptionAtHost", "type": "bool"}, + "enable_ultra_ssd": {"key": "enableUltraSSD", "type": "bool"}, + "enable_fips": {"key": "enableFIPS", "type": "bool"}, + "gpu_instance_profile": {"key": "gpuInstanceProfile", "type": "str"}, + "creation_data": {"key": "creationData", "type": "CreationData"}, + "capacity_reservation_group_id": {"key": "capacityReservationGroupID", "type": "str"}, + "name": {"key": "name", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, name: str, @@ -3143,7 +3067,7 @@ def __init__( vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, @@ -3157,9 +3081,9 @@ def __init__( availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", - spot_max_price: Optional[float] = -1, + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", + spot_max_price: float = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, @@ -3191,15 +3115,15 @@ def __init__( larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.OSDiskType :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime - data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + data root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.KubeletDiskType :keyword workload_runtime: Determines the type of workload a node can run. Known values are: - "OCIContainer", "WasmWasi". + "OCIContainer" and "WasmWasi". :paramtype workload_runtime: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.WorkloadRuntime :keyword message_of_the_day: A base64-encoded string which will be written to /etc/motd after @@ -3218,11 +3142,11 @@ def __init__( :paramtype pod_subnet_id: str :keyword max_pods: The maximum number of pods that can run on a node. :paramtype max_pods: int - :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.OSType :keyword os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Known values are: "Ubuntu", "CBLMariner". + Known values are: "Ubuntu" and "CBLMariner". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.OSSKU :keyword max_count: The maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -3231,15 +3155,15 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, - it defaults to Delete. Known values are: "Delete", "Deallocate". + it defaults to Delete. Known values are: "Delete" and "Deallocate". :paramtype scale_down_mode: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.ScaleDownMode - :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", + :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.AgentPoolType :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.AgentPoolMode :keyword orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -3270,20 +3194,18 @@ def __init__( /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the - default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + default is 'Regular'. Known values are: "Spot" and "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.ScaleSetPriority :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.ScaleSetEvictionPolicy :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :paramtype spot_max_price: float - :keyword tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :keyword tags: The tags to be persisted on the agent pool virtual machine scale set. :paramtype tags: dict[str, str] :keyword node_labels: The node labels to be persisted across all nodes in agent pool. :paramtype node_labels: dict[str, str] @@ -3309,7 +3231,7 @@ def __init__( for more details. :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance - profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.GPUInstanceProfile @@ -3319,14 +3241,55 @@ def __init__( :keyword capacity_reservation_group_id: AKS will associate the specified agent pool with the Capacity Reservation Group. :paramtype capacity_reservation_group_id: str - :keyword name: Required. Windows agent pool names must be 6 characters or less. + :keyword name: Windows agent pool names must be 6 characters or less. Required. :paramtype name: str """ - super(ManagedClusterAgentPoolProfile, self).__init__(count=count, vm_size=vm_size, os_disk_size_gb=os_disk_size_gb, os_disk_type=os_disk_type, kubelet_disk_type=kubelet_disk_type, workload_runtime=workload_runtime, message_of_the_day=message_of_the_day, vnet_subnet_id=vnet_subnet_id, pod_subnet_id=pod_subnet_id, max_pods=max_pods, os_type=os_type, os_sku=os_sku, max_count=max_count, min_count=min_count, enable_auto_scaling=enable_auto_scaling, scale_down_mode=scale_down_mode, type=type, mode=mode, orchestrator_version=orchestrator_version, upgrade_settings=upgrade_settings, power_state=power_state, availability_zones=availability_zones, enable_node_public_ip=enable_node_public_ip, node_public_ip_prefix_id=node_public_ip_prefix_id, scale_set_priority=scale_set_priority, scale_set_eviction_policy=scale_set_eviction_policy, spot_max_price=spot_max_price, tags=tags, node_labels=node_labels, node_taints=node_taints, proximity_placement_group_id=proximity_placement_group_id, kubelet_config=kubelet_config, linux_os_config=linux_os_config, enable_encryption_at_host=enable_encryption_at_host, enable_ultra_ssd=enable_ultra_ssd, enable_fips=enable_fips, gpu_instance_profile=gpu_instance_profile, creation_data=creation_data, capacity_reservation_group_id=capacity_reservation_group_id, **kwargs) + super().__init__( + count=count, + vm_size=vm_size, + os_disk_size_gb=os_disk_size_gb, + os_disk_type=os_disk_type, + kubelet_disk_type=kubelet_disk_type, + workload_runtime=workload_runtime, + message_of_the_day=message_of_the_day, + vnet_subnet_id=vnet_subnet_id, + pod_subnet_id=pod_subnet_id, + max_pods=max_pods, + os_type=os_type, + os_sku=os_sku, + max_count=max_count, + min_count=min_count, + enable_auto_scaling=enable_auto_scaling, + scale_down_mode=scale_down_mode, + type=type, + mode=mode, + orchestrator_version=orchestrator_version, + upgrade_settings=upgrade_settings, + power_state=power_state, + availability_zones=availability_zones, + enable_node_public_ip=enable_node_public_ip, + node_public_ip_prefix_id=node_public_ip_prefix_id, + scale_set_priority=scale_set_priority, + scale_set_eviction_policy=scale_set_eviction_policy, + spot_max_price=spot_max_price, + tags=tags, + node_labels=node_labels, + node_taints=node_taints, + proximity_placement_group_id=proximity_placement_group_id, + kubelet_config=kubelet_config, + linux_os_config=linux_os_config, + enable_encryption_at_host=enable_encryption_at_host, + enable_ultra_ssd=enable_ultra_ssd, + enable_fips=enable_fips, + gpu_instance_profile=gpu_instance_profile, + creation_data=creation_data, + capacity_reservation_group_id=capacity_reservation_group_id, + **kwargs + ) self.name = name -class ManagedClusterAPIServerAccessProfile(msrest.serialization.Model): +class ManagedClusterAPIServerAccessProfile(_serialization.Model): """Access profile for managed cluster API server. :ivar authorized_ip_ranges: IP ranges are specified in CIDR format, e.g. 137.117.106.88/29. @@ -3349,11 +3312,11 @@ class ManagedClusterAPIServerAccessProfile(msrest.serialization.Model): """ _attribute_map = { - 'authorized_ip_ranges': {'key': 'authorizedIPRanges', 'type': '[str]'}, - 'enable_private_cluster': {'key': 'enablePrivateCluster', 'type': 'bool'}, - 'private_dns_zone': {'key': 'privateDNSZone', 'type': 'str'}, - 'enable_private_cluster_public_fqdn': {'key': 'enablePrivateClusterPublicFQDN', 'type': 'bool'}, - 'disable_run_command': {'key': 'disableRunCommand', 'type': 'bool'}, + "authorized_ip_ranges": {"key": "authorizedIPRanges", "type": "[str]"}, + "enable_private_cluster": {"key": "enablePrivateCluster", "type": "bool"}, + "private_dns_zone": {"key": "privateDNSZone", "type": "str"}, + "enable_private_cluster_public_fqdn": {"key": "enablePrivateClusterPublicFQDN", "type": "bool"}, + "disable_run_command": {"key": "disableRunCommand", "type": "bool"}, } def __init__( @@ -3385,7 +3348,7 @@ def __init__( :keyword disable_run_command: Whether to disable run command for the cluster or not. :paramtype disable_run_command: bool """ - super(ManagedClusterAPIServerAccessProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.authorized_ip_ranges = authorized_ip_ranges self.enable_private_cluster = enable_private_cluster self.private_dns_zone = private_dns_zone @@ -3393,38 +3356,33 @@ def __init__( self.disable_run_command = disable_run_command -class ManagedClusterAutoUpgradeProfile(msrest.serialization.Model): +class ManagedClusterAutoUpgradeProfile(_serialization.Model): """Auto upgrade profile for a managed cluster. :ivar upgrade_channel: For more information see `setting the AKS cluster auto-upgrade channel `_. Known values - are: "rapid", "stable", "patch", "node-image", "none". + are: "rapid", "stable", "patch", "node-image", and "none". :vartype upgrade_channel: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.UpgradeChannel """ _attribute_map = { - 'upgrade_channel': {'key': 'upgradeChannel', 'type': 'str'}, + "upgrade_channel": {"key": "upgradeChannel", "type": "str"}, } - def __init__( - self, - *, - upgrade_channel: Optional[Union[str, "_models.UpgradeChannel"]] = None, - **kwargs - ): + def __init__(self, *, upgrade_channel: Optional[Union[str, "_models.UpgradeChannel"]] = None, **kwargs): """ :keyword upgrade_channel: For more information see `setting the AKS cluster auto-upgrade channel `_. - Known values are: "rapid", "stable", "patch", "node-image", "none". + Known values are: "rapid", "stable", "patch", "node-image", and "none". :paramtype upgrade_channel: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.UpgradeChannel """ - super(ManagedClusterAutoUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.upgrade_channel = upgrade_channel -class ManagedClusterHTTPProxyConfig(msrest.serialization.Model): +class ManagedClusterHTTPProxyConfig(_serialization.Model): """Cluster HTTP proxy configuration. :ivar http_proxy: The HTTP proxy server endpoint to use. @@ -3438,10 +3396,10 @@ class ManagedClusterHTTPProxyConfig(msrest.serialization.Model): """ _attribute_map = { - 'http_proxy': {'key': 'httpProxy', 'type': 'str'}, - 'https_proxy': {'key': 'httpsProxy', 'type': 'str'}, - 'no_proxy': {'key': 'noProxy', 'type': '[str]'}, - 'trusted_ca': {'key': 'trustedCa', 'type': 'str'}, + "http_proxy": {"key": "httpProxy", "type": "str"}, + "https_proxy": {"key": "httpsProxy", "type": "str"}, + "no_proxy": {"key": "noProxy", "type": "[str]"}, + "trusted_ca": {"key": "trustedCa", "type": "str"}, } def __init__( @@ -3463,14 +3421,14 @@ def __init__( :keyword trusted_ca: Alternative CA cert to use for connecting to proxy servers. :paramtype trusted_ca: str """ - super(ManagedClusterHTTPProxyConfig, self).__init__(**kwargs) + super().__init__(**kwargs) self.http_proxy = http_proxy self.https_proxy = https_proxy self.no_proxy = no_proxy self.trusted_ca = trusted_ca -class ManagedClusterIdentity(msrest.serialization.Model): +class ManagedClusterIdentity(_serialization.Model): """Identity for the managed cluster. Variables are only populated by the server, and will be ignored when sending a request. @@ -3483,7 +3441,7 @@ class ManagedClusterIdentity(msrest.serialization.Model): :vartype tenant_id: str :ivar type: For more information see `use managed identities in AKS `_. Known values are: - "SystemAssigned", "UserAssigned", "None". + "SystemAssigned", "UserAssigned", and "None". :vartype type: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.ResourceIdentityType :ivar user_assigned_identities: The keys must be ARM resource IDs in the form: @@ -3493,28 +3451,33 @@ class ManagedClusterIdentity(msrest.serialization.Model): """ _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, + "principal_id": {"readonly": True}, + "tenant_id": {"readonly": True}, } _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{ManagedServiceIdentityUserAssignedIdentitiesValue}'}, + "principal_id": {"key": "principalId", "type": "str"}, + "tenant_id": {"key": "tenantId", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "user_assigned_identities": { + "key": "userAssignedIdentities", + "type": "{ManagedServiceIdentityUserAssignedIdentitiesValue}", + }, } def __init__( self, *, type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, - user_assigned_identities: Optional[Dict[str, "_models.ManagedServiceIdentityUserAssignedIdentitiesValue"]] = None, + user_assigned_identities: Optional[ + Dict[str, "_models.ManagedServiceIdentityUserAssignedIdentitiesValue"] + ] = None, **kwargs ): """ :keyword type: For more information see `use managed identities in AKS `_. Known values are: - "SystemAssigned", "UserAssigned", "None". + "SystemAssigned", "UserAssigned", and "None". :paramtype type: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.ResourceIdentityType :keyword user_assigned_identities: The keys must be ARM resource IDs in the form: @@ -3522,14 +3485,14 @@ def __init__( :paramtype user_assigned_identities: dict[str, ~azure.mgmt.containerservice.v2021_11_01_preview.models.ManagedServiceIdentityUserAssignedIdentitiesValue] """ - super(ManagedClusterIdentity, self).__init__(**kwargs) + super().__init__(**kwargs) self.principal_id = None self.tenant_id = None self.type = type self.user_assigned_identities = user_assigned_identities -class ManagedClusterListResult(msrest.serialization.Model): +class ManagedClusterListResult(_serialization.Model): """The response from the List Managed Clusters operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -3541,30 +3504,25 @@ class ManagedClusterListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[ManagedCluster]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[ManagedCluster]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.ManagedCluster"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.ManagedCluster"]] = None, **kwargs): """ :keyword value: The list of managed clusters. :paramtype value: list[~azure.mgmt.containerservice.v2021_11_01_preview.models.ManagedCluster] """ - super(ManagedClusterListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class ManagedClusterLoadBalancerProfile(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfile(_serialization.Model): """Profile of the managed cluster load balancer. :ivar managed_outbound_i_ps: Desired managed outbound IPs for the cluster load balancer. @@ -3593,18 +3551,24 @@ class ManagedClusterLoadBalancerProfile(msrest.serialization.Model): """ _validation = { - 'allocated_outbound_ports': {'maximum': 64000, 'minimum': 0}, - 'idle_timeout_in_minutes': {'maximum': 120, 'minimum': 4}, + "allocated_outbound_ports": {"maximum": 64000, "minimum": 0}, + "idle_timeout_in_minutes": {"maximum": 120, "minimum": 4}, } _attribute_map = { - 'managed_outbound_i_ps': {'key': 'managedOutboundIPs', 'type': 'ManagedClusterLoadBalancerProfileManagedOutboundIPs'}, - 'outbound_ip_prefixes': {'key': 'outboundIPPrefixes', 'type': 'ManagedClusterLoadBalancerProfileOutboundIPPrefixes'}, - 'outbound_i_ps': {'key': 'outboundIPs', 'type': 'ManagedClusterLoadBalancerProfileOutboundIPs'}, - 'effective_outbound_i_ps': {'key': 'effectiveOutboundIPs', 'type': '[ResourceReference]'}, - 'allocated_outbound_ports': {'key': 'allocatedOutboundPorts', 'type': 'int'}, - 'idle_timeout_in_minutes': {'key': 'idleTimeoutInMinutes', 'type': 'int'}, - 'enable_multiple_standard_load_balancers': {'key': 'enableMultipleStandardLoadBalancers', 'type': 'bool'}, + "managed_outbound_i_ps": { + "key": "managedOutboundIPs", + "type": "ManagedClusterLoadBalancerProfileManagedOutboundIPs", + }, + "outbound_ip_prefixes": { + "key": "outboundIPPrefixes", + "type": "ManagedClusterLoadBalancerProfileOutboundIPPrefixes", + }, + "outbound_i_ps": {"key": "outboundIPs", "type": "ManagedClusterLoadBalancerProfileOutboundIPs"}, + "effective_outbound_i_ps": {"key": "effectiveOutboundIPs", "type": "[ResourceReference]"}, + "allocated_outbound_ports": {"key": "allocatedOutboundPorts", "type": "int"}, + "idle_timeout_in_minutes": {"key": "idleTimeoutInMinutes", "type": "int"}, + "enable_multiple_standard_load_balancers": {"key": "enableMultipleStandardLoadBalancers", "type": "bool"}, } def __init__( @@ -3614,8 +3578,8 @@ def __init__( outbound_ip_prefixes: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPPrefixes"] = None, outbound_i_ps: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPs"] = None, effective_outbound_i_ps: Optional[List["_models.ResourceReference"]] = None, - allocated_outbound_ports: Optional[int] = 0, - idle_timeout_in_minutes: Optional[int] = 30, + allocated_outbound_ports: int = 0, + idle_timeout_in_minutes: int = 30, enable_multiple_standard_load_balancers: Optional[bool] = None, **kwargs ): @@ -3645,7 +3609,7 @@ def __init__( AKS cluster or not. :paramtype enable_multiple_standard_load_balancers: bool """ - super(ManagedClusterLoadBalancerProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.managed_outbound_i_ps = managed_outbound_i_ps self.outbound_ip_prefixes = outbound_ip_prefixes self.outbound_i_ps = outbound_i_ps @@ -3655,7 +3619,7 @@ def __init__( self.enable_multiple_standard_load_balancers = enable_multiple_standard_load_balancers -class ManagedClusterLoadBalancerProfileManagedOutboundIPs(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfileManagedOutboundIPs(_serialization.Model): """Desired managed outbound IPs for the cluster load balancer. :ivar count: The desired number of IPv4 outbound IPs created/managed by Azure for the cluster @@ -3669,22 +3633,16 @@ class ManagedClusterLoadBalancerProfileManagedOutboundIPs(msrest.serialization.M """ _validation = { - 'count': {'maximum': 100, 'minimum': 1}, - 'count_ipv6': {'maximum': 100, 'minimum': 0}, + "count": {"maximum": 100, "minimum": 1}, + "count_ipv6": {"maximum": 100, "minimum": 0}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'count_ipv6': {'key': 'countIPv6', 'type': 'int'}, + "count": {"key": "count", "type": "int"}, + "count_ipv6": {"key": "countIPv6", "type": "int"}, } - def __init__( - self, - *, - count: Optional[int] = 1, - count_ipv6: Optional[int] = 0, - **kwargs - ): + def __init__(self, *, count: int = 1, count_ipv6: int = 0, **kwargs): """ :keyword count: The desired number of IPv4 outbound IPs created/managed by Azure for the cluster load balancer. Allowed values must be in the range of 1 to 100 (inclusive). The default @@ -3695,12 +3653,12 @@ def __init__( value is 0 for single-stack and 1 for dual-stack. :paramtype count_ipv6: int """ - super(ManagedClusterLoadBalancerProfileManagedOutboundIPs, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.count_ipv6 = count_ipv6 -class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(_serialization.Model): """Desired outbound IP Prefix resources for the cluster load balancer. :ivar public_ip_prefixes: A list of public IP prefix resources. @@ -3709,25 +3667,20 @@ class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(msrest.serialization.M """ _attribute_map = { - 'public_ip_prefixes': {'key': 'publicIPPrefixes', 'type': '[ResourceReference]'}, + "public_ip_prefixes": {"key": "publicIPPrefixes", "type": "[ResourceReference]"}, } - def __init__( - self, - *, - public_ip_prefixes: Optional[List["_models.ResourceReference"]] = None, - **kwargs - ): + def __init__(self, *, public_ip_prefixes: Optional[List["_models.ResourceReference"]] = None, **kwargs): """ :keyword public_ip_prefixes: A list of public IP prefix resources. :paramtype public_ip_prefixes: list[~azure.mgmt.containerservice.v2021_11_01_preview.models.ResourceReference] """ - super(ManagedClusterLoadBalancerProfileOutboundIPPrefixes, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_ip_prefixes = public_ip_prefixes -class ManagedClusterLoadBalancerProfileOutboundIPs(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfileOutboundIPs(_serialization.Model): """Desired outbound IP resources for the cluster load balancer. :ivar public_i_ps: A list of public IP resources. @@ -3736,25 +3689,20 @@ class ManagedClusterLoadBalancerProfileOutboundIPs(msrest.serialization.Model): """ _attribute_map = { - 'public_i_ps': {'key': 'publicIPs', 'type': '[ResourceReference]'}, + "public_i_ps": {"key": "publicIPs", "type": "[ResourceReference]"}, } - def __init__( - self, - *, - public_i_ps: Optional[List["_models.ResourceReference"]] = None, - **kwargs - ): + def __init__(self, *, public_i_ps: Optional[List["_models.ResourceReference"]] = None, **kwargs): """ :keyword public_i_ps: A list of public IP resources. :paramtype public_i_ps: list[~azure.mgmt.containerservice.v2021_11_01_preview.models.ResourceReference] """ - super(ManagedClusterLoadBalancerProfileOutboundIPs, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_i_ps = public_i_ps -class ManagedClusterManagedOutboundIPProfile(msrest.serialization.Model): +class ManagedClusterManagedOutboundIPProfile(_serialization.Model): """Profile of the managed outbound IP resources of the managed cluster. :ivar count: The desired number of outbound IPs created/managed by Azure. Allowed values must @@ -3763,29 +3711,24 @@ class ManagedClusterManagedOutboundIPProfile(msrest.serialization.Model): """ _validation = { - 'count': {'maximum': 16, 'minimum': 1}, + "count": {"maximum": 16, "minimum": 1}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, + "count": {"key": "count", "type": "int"}, } - def __init__( - self, - *, - count: Optional[int] = 1, - **kwargs - ): + def __init__(self, *, count: int = 1, **kwargs): """ :keyword count: The desired number of outbound IPs created/managed by Azure. Allowed values must be in the range of 1 to 16 (inclusive). The default value is 1. :paramtype count: int """ - super(ManagedClusterManagedOutboundIPProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count -class ManagedClusterNATGatewayProfile(msrest.serialization.Model): +class ManagedClusterNATGatewayProfile(_serialization.Model): """Profile of the managed cluster NAT gateway. :ivar managed_outbound_ip_profile: Profile of the managed outbound IP resources of the cluster @@ -3801,13 +3744,16 @@ class ManagedClusterNATGatewayProfile(msrest.serialization.Model): """ _validation = { - 'idle_timeout_in_minutes': {'maximum': 120, 'minimum': 4}, + "idle_timeout_in_minutes": {"maximum": 120, "minimum": 4}, } _attribute_map = { - 'managed_outbound_ip_profile': {'key': 'managedOutboundIPProfile', 'type': 'ManagedClusterManagedOutboundIPProfile'}, - 'effective_outbound_i_ps': {'key': 'effectiveOutboundIPs', 'type': '[ResourceReference]'}, - 'idle_timeout_in_minutes': {'key': 'idleTimeoutInMinutes', 'type': 'int'}, + "managed_outbound_ip_profile": { + "key": "managedOutboundIPProfile", + "type": "ManagedClusterManagedOutboundIPProfile", + }, + "effective_outbound_i_ps": {"key": "effectiveOutboundIPs", "type": "[ResourceReference]"}, + "idle_timeout_in_minutes": {"key": "idleTimeoutInMinutes", "type": "int"}, } def __init__( @@ -3815,7 +3761,7 @@ def __init__( *, managed_outbound_ip_profile: Optional["_models.ManagedClusterManagedOutboundIPProfile"] = None, effective_outbound_i_ps: Optional[List["_models.ResourceReference"]] = None, - idle_timeout_in_minutes: Optional[int] = 4, + idle_timeout_in_minutes: int = 4, **kwargs ): """ @@ -3831,13 +3777,13 @@ def __init__( are in the range of 4 to 120 (inclusive). The default value is 4 minutes. :paramtype idle_timeout_in_minutes: int """ - super(ManagedClusterNATGatewayProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.managed_outbound_ip_profile = managed_outbound_ip_profile self.effective_outbound_i_ps = effective_outbound_i_ps self.idle_timeout_in_minutes = idle_timeout_in_minutes -class ManagedClusterOIDCIssuerProfile(msrest.serialization.Model): +class ManagedClusterOIDCIssuerProfile(_serialization.Model): """The OIDC issuer profile of the Managed Cluster. Variables are only populated by the server, and will be ignored when sending a request. @@ -3849,46 +3795,41 @@ class ManagedClusterOIDCIssuerProfile(msrest.serialization.Model): """ _validation = { - 'issuer_url': {'readonly': True}, + "issuer_url": {"readonly": True}, } _attribute_map = { - 'issuer_url': {'key': 'issuerURL', 'type': 'str'}, - 'enabled': {'key': 'enabled', 'type': 'bool'}, + "issuer_url": {"key": "issuerURL", "type": "str"}, + "enabled": {"key": "enabled", "type": "bool"}, } - def __init__( - self, - *, - enabled: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, enabled: Optional[bool] = None, **kwargs): """ :keyword enabled: Whether the OIDC issuer is enabled. :paramtype enabled: bool """ - super(ManagedClusterOIDCIssuerProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.issuer_url = None self.enabled = enabled -class ManagedClusterPodIdentity(msrest.serialization.Model): +class ManagedClusterPodIdentity(_serialization.Model): """Details about the pod identity assigned to the Managed Cluster. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar name: Required. The name of the pod identity. + :ivar name: The name of the pod identity. Required. :vartype name: str - :ivar namespace: Required. The namespace of the pod identity. + :ivar namespace: The namespace of the pod identity. Required. :vartype namespace: str :ivar binding_selector: The binding selector to use for the AzureIdentityBinding resource. :vartype binding_selector: str - :ivar identity: Required. The user assigned identity details. + :ivar identity: The user assigned identity details. Required. :vartype identity: ~azure.mgmt.containerservice.v2021_11_01_preview.models.UserAssignedIdentity :ivar provisioning_state: The current provisioning state of the pod identity. Known values are: - "Assigned", "Updating", "Deleting", "Failed". + "Assigned", "Updating", "Deleting", and "Failed". :vartype provisioning_state: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.ManagedClusterPodIdentityProvisioningState :ivar provisioning_info: @@ -3897,20 +3838,20 @@ class ManagedClusterPodIdentity(msrest.serialization.Model): """ _validation = { - 'name': {'required': True}, - 'namespace': {'required': True}, - 'identity': {'required': True}, - 'provisioning_state': {'readonly': True}, - 'provisioning_info': {'readonly': True}, + "name": {"required": True}, + "namespace": {"required": True}, + "identity": {"required": True}, + "provisioning_state": {"readonly": True}, + "provisioning_info": {"readonly": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'namespace': {'key': 'namespace', 'type': 'str'}, - 'binding_selector': {'key': 'bindingSelector', 'type': 'str'}, - 'identity': {'key': 'identity', 'type': 'UserAssignedIdentity'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'provisioning_info': {'key': 'provisioningInfo', 'type': 'ManagedClusterPodIdentityProvisioningInfo'}, + "name": {"key": "name", "type": "str"}, + "namespace": {"key": "namespace", "type": "str"}, + "binding_selector": {"key": "bindingSelector", "type": "str"}, + "identity": {"key": "identity", "type": "UserAssignedIdentity"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "provisioning_info": {"key": "provisioningInfo", "type": "ManagedClusterPodIdentityProvisioningInfo"}, } def __init__( @@ -3923,17 +3864,17 @@ def __init__( **kwargs ): """ - :keyword name: Required. The name of the pod identity. + :keyword name: The name of the pod identity. Required. :paramtype name: str - :keyword namespace: Required. The namespace of the pod identity. + :keyword namespace: The namespace of the pod identity. Required. :paramtype namespace: str :keyword binding_selector: The binding selector to use for the AzureIdentityBinding resource. :paramtype binding_selector: str - :keyword identity: Required. The user assigned identity details. + :keyword identity: The user assigned identity details. Required. :paramtype identity: ~azure.mgmt.containerservice.v2021_11_01_preview.models.UserAssignedIdentity """ - super(ManagedClusterPodIdentity, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.namespace = namespace self.binding_selector = binding_selector @@ -3942,54 +3883,47 @@ def __init__( self.provisioning_info = None -class ManagedClusterPodIdentityException(msrest.serialization.Model): +class ManagedClusterPodIdentityException(_serialization.Model): """See `disable AAD Pod Identity for a specific Pod/Application `_ for more details. All required parameters must be populated in order to send to Azure. - :ivar name: Required. The name of the pod identity exception. + :ivar name: The name of the pod identity exception. Required. :vartype name: str - :ivar namespace: Required. The namespace of the pod identity exception. + :ivar namespace: The namespace of the pod identity exception. Required. :vartype namespace: str - :ivar pod_labels: Required. The pod labels to match. + :ivar pod_labels: The pod labels to match. Required. :vartype pod_labels: dict[str, str] """ _validation = { - 'name': {'required': True}, - 'namespace': {'required': True}, - 'pod_labels': {'required': True}, + "name": {"required": True}, + "namespace": {"required": True}, + "pod_labels": {"required": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'namespace': {'key': 'namespace', 'type': 'str'}, - 'pod_labels': {'key': 'podLabels', 'type': '{str}'}, + "name": {"key": "name", "type": "str"}, + "namespace": {"key": "namespace", "type": "str"}, + "pod_labels": {"key": "podLabels", "type": "{str}"}, } - def __init__( - self, - *, - name: str, - namespace: str, - pod_labels: Dict[str, str], - **kwargs - ): + def __init__(self, *, name: str, namespace: str, pod_labels: Dict[str, str], **kwargs): """ - :keyword name: Required. The name of the pod identity exception. + :keyword name: The name of the pod identity exception. Required. :paramtype name: str - :keyword namespace: Required. The namespace of the pod identity exception. + :keyword namespace: The namespace of the pod identity exception. Required. :paramtype namespace: str - :keyword pod_labels: Required. The pod labels to match. + :keyword pod_labels: The pod labels to match. Required. :paramtype pod_labels: dict[str, str] """ - super(ManagedClusterPodIdentityException, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.namespace = namespace self.pod_labels = pod_labels -class ManagedClusterPodIdentityProfile(msrest.serialization.Model): +class ManagedClusterPodIdentityProfile(_serialization.Model): """See `use AAD pod identity `_ for more details on pod identity integration. :ivar enabled: Whether the pod identity addon is enabled. @@ -4009,10 +3943,13 @@ class ManagedClusterPodIdentityProfile(msrest.serialization.Model): """ _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'allow_network_plugin_kubenet': {'key': 'allowNetworkPluginKubenet', 'type': 'bool'}, - 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '[ManagedClusterPodIdentity]'}, - 'user_assigned_identity_exceptions': {'key': 'userAssignedIdentityExceptions', 'type': '[ManagedClusterPodIdentityException]'}, + "enabled": {"key": "enabled", "type": "bool"}, + "allow_network_plugin_kubenet": {"key": "allowNetworkPluginKubenet", "type": "bool"}, + "user_assigned_identities": {"key": "userAssignedIdentities", "type": "[ManagedClusterPodIdentity]"}, + "user_assigned_identity_exceptions": { + "key": "userAssignedIdentityExceptions", + "type": "[ManagedClusterPodIdentityException]", + }, } def __init__( @@ -4040,14 +3977,14 @@ def __init__( :paramtype user_assigned_identity_exceptions: list[~azure.mgmt.containerservice.v2021_11_01_preview.models.ManagedClusterPodIdentityException] """ - super(ManagedClusterPodIdentityProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.allow_network_plugin_kubenet = allow_network_plugin_kubenet self.user_assigned_identities = user_assigned_identities self.user_assigned_identity_exceptions = user_assigned_identity_exceptions -class ManagedClusterPodIdentityProvisioningError(msrest.serialization.Model): +class ManagedClusterPodIdentityProvisioningError(_serialization.Model): """An error response from the pod identity provisioning. :ivar error: Details about the error. @@ -4056,25 +3993,20 @@ class ManagedClusterPodIdentityProvisioningError(msrest.serialization.Model): """ _attribute_map = { - 'error': {'key': 'error', 'type': 'ManagedClusterPodIdentityProvisioningErrorBody'}, + "error": {"key": "error", "type": "ManagedClusterPodIdentityProvisioningErrorBody"}, } - def __init__( - self, - *, - error: Optional["_models.ManagedClusterPodIdentityProvisioningErrorBody"] = None, - **kwargs - ): + def __init__(self, *, error: Optional["_models.ManagedClusterPodIdentityProvisioningErrorBody"] = None, **kwargs): """ :keyword error: Details about the error. :paramtype error: ~azure.mgmt.containerservice.v2021_11_01_preview.models.ManagedClusterPodIdentityProvisioningErrorBody """ - super(ManagedClusterPodIdentityProvisioningError, self).__init__(**kwargs) + super().__init__(**kwargs) self.error = error -class ManagedClusterPodIdentityProvisioningErrorBody(msrest.serialization.Model): +class ManagedClusterPodIdentityProvisioningErrorBody(_serialization.Model): """An error response from the pod identity provisioning. :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed @@ -4092,10 +4024,10 @@ class ManagedClusterPodIdentityProvisioningErrorBody(msrest.serialization.Model) """ _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[ManagedClusterPodIdentityProvisioningErrorBody]'}, + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[ManagedClusterPodIdentityProvisioningErrorBody]"}, } def __init__( @@ -4121,14 +4053,14 @@ def __init__( :paramtype details: list[~azure.mgmt.containerservice.v2021_11_01_preview.models.ManagedClusterPodIdentityProvisioningErrorBody] """ - super(ManagedClusterPodIdentityProvisioningErrorBody, self).__init__(**kwargs) + super().__init__(**kwargs) self.code = code self.message = message self.target = target self.details = details -class ManagedClusterPodIdentityProvisioningInfo(msrest.serialization.Model): +class ManagedClusterPodIdentityProvisioningInfo(_serialization.Model): """ManagedClusterPodIdentityProvisioningInfo. :ivar error: Pod identity assignment error (if any). @@ -4137,35 +4069,30 @@ class ManagedClusterPodIdentityProvisioningInfo(msrest.serialization.Model): """ _attribute_map = { - 'error': {'key': 'error', 'type': 'ManagedClusterPodIdentityProvisioningError'}, + "error": {"key": "error", "type": "ManagedClusterPodIdentityProvisioningError"}, } - def __init__( - self, - *, - error: Optional["_models.ManagedClusterPodIdentityProvisioningError"] = None, - **kwargs - ): + def __init__(self, *, error: Optional["_models.ManagedClusterPodIdentityProvisioningError"] = None, **kwargs): """ :keyword error: Pod identity assignment error (if any). :paramtype error: ~azure.mgmt.containerservice.v2021_11_01_preview.models.ManagedClusterPodIdentityProvisioningError """ - super(ManagedClusterPodIdentityProvisioningInfo, self).__init__(**kwargs) + super().__init__(**kwargs) self.error = error -class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): +class ManagedClusterPoolUpgradeProfile(_serialization.Model): """The list of available upgrade versions. All required parameters must be populated in order to send to Azure. - :ivar kubernetes_version: Required. The Kubernetes version (major.minor.patch). + :ivar kubernetes_version: The Kubernetes version (major.minor.patch). Required. :vartype kubernetes_version: str :ivar name: The Agent Pool name. :vartype name: str - :ivar os_type: Required. The operating system type. The default is Linux. Known values are: - "Linux", "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -4173,15 +4100,15 @@ class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): """ _validation = { - 'kubernetes_version': {'required': True}, - 'os_type': {'required': True}, + "kubernetes_version": {"required": True}, + "os_type": {"required": True}, } _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'upgrades': {'key': 'upgrades', 'type': '[ManagedClusterPoolUpgradeProfileUpgradesItem]'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "os_type": {"key": "osType", "type": "str"}, + "upgrades": {"key": "upgrades", "type": "[ManagedClusterPoolUpgradeProfileUpgradesItem]"}, } def __init__( @@ -4194,25 +4121,25 @@ def __init__( **kwargs ): """ - :keyword kubernetes_version: Required. The Kubernetes version (major.minor.patch). + :keyword kubernetes_version: The Kubernetes version (major.minor.patch). Required. :paramtype kubernetes_version: str :keyword name: The Agent Pool name. :paramtype name: str - :keyword os_type: Required. The operating system type. The default is Linux. Known values are: - "Linux", "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: list[~azure.mgmt.containerservice.v2021_11_01_preview.models.ManagedClusterPoolUpgradeProfileUpgradesItem] """ - super(ManagedClusterPoolUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.name = name self.os_type = os_type self.upgrades = upgrades -class ManagedClusterPoolUpgradeProfileUpgradesItem(msrest.serialization.Model): +class ManagedClusterPoolUpgradeProfileUpgradesItem(_serialization.Model): """ManagedClusterPoolUpgradeProfileUpgradesItem. :ivar kubernetes_version: The Kubernetes version (major.minor.patch). @@ -4222,36 +4149,30 @@ class ManagedClusterPoolUpgradeProfileUpgradesItem(msrest.serialization.Model): """ _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } - def __init__( - self, - *, - kubernetes_version: Optional[str] = None, - is_preview: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, kubernetes_version: Optional[str] = None, is_preview: Optional[bool] = None, **kwargs): """ :keyword kubernetes_version: The Kubernetes version (major.minor.patch). :paramtype kubernetes_version: str :keyword is_preview: Whether the Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(ManagedClusterPoolUpgradeProfileUpgradesItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.is_preview = is_preview -class ManagedClusterPropertiesAutoScalerProfile(msrest.serialization.Model): +class ManagedClusterPropertiesAutoScalerProfile(_serialization.Model): # pylint: disable=too-many-instance-attributes """Parameters to be applied to the cluster-autoscaler when enabled. :ivar balance_similar_node_groups: Valid values are 'true' and 'false'. :vartype balance_similar_node_groups: str :ivar expander: If not specified, the default is 'random'. See `expanders `_ - for more information. Known values are: "least-waste", "most-pods", "priority", "random". + for more information. Known values are: "least-waste", "most-pods", "priority", and "random". :vartype expander: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.Expander :ivar max_empty_bulk_delete: The default is 10. :vartype max_empty_bulk_delete: str @@ -4295,23 +4216,23 @@ class ManagedClusterPropertiesAutoScalerProfile(msrest.serialization.Model): """ _attribute_map = { - 'balance_similar_node_groups': {'key': 'balance-similar-node-groups', 'type': 'str'}, - 'expander': {'key': 'expander', 'type': 'str'}, - 'max_empty_bulk_delete': {'key': 'max-empty-bulk-delete', 'type': 'str'}, - 'max_graceful_termination_sec': {'key': 'max-graceful-termination-sec', 'type': 'str'}, - 'max_node_provision_time': {'key': 'max-node-provision-time', 'type': 'str'}, - 'max_total_unready_percentage': {'key': 'max-total-unready-percentage', 'type': 'str'}, - 'new_pod_scale_up_delay': {'key': 'new-pod-scale-up-delay', 'type': 'str'}, - 'ok_total_unready_count': {'key': 'ok-total-unready-count', 'type': 'str'}, - 'scan_interval': {'key': 'scan-interval', 'type': 'str'}, - 'scale_down_delay_after_add': {'key': 'scale-down-delay-after-add', 'type': 'str'}, - 'scale_down_delay_after_delete': {'key': 'scale-down-delay-after-delete', 'type': 'str'}, - 'scale_down_delay_after_failure': {'key': 'scale-down-delay-after-failure', 'type': 'str'}, - 'scale_down_unneeded_time': {'key': 'scale-down-unneeded-time', 'type': 'str'}, - 'scale_down_unready_time': {'key': 'scale-down-unready-time', 'type': 'str'}, - 'scale_down_utilization_threshold': {'key': 'scale-down-utilization-threshold', 'type': 'str'}, - 'skip_nodes_with_local_storage': {'key': 'skip-nodes-with-local-storage', 'type': 'str'}, - 'skip_nodes_with_system_pods': {'key': 'skip-nodes-with-system-pods', 'type': 'str'}, + "balance_similar_node_groups": {"key": "balance-similar-node-groups", "type": "str"}, + "expander": {"key": "expander", "type": "str"}, + "max_empty_bulk_delete": {"key": "max-empty-bulk-delete", "type": "str"}, + "max_graceful_termination_sec": {"key": "max-graceful-termination-sec", "type": "str"}, + "max_node_provision_time": {"key": "max-node-provision-time", "type": "str"}, + "max_total_unready_percentage": {"key": "max-total-unready-percentage", "type": "str"}, + "new_pod_scale_up_delay": {"key": "new-pod-scale-up-delay", "type": "str"}, + "ok_total_unready_count": {"key": "ok-total-unready-count", "type": "str"}, + "scan_interval": {"key": "scan-interval", "type": "str"}, + "scale_down_delay_after_add": {"key": "scale-down-delay-after-add", "type": "str"}, + "scale_down_delay_after_delete": {"key": "scale-down-delay-after-delete", "type": "str"}, + "scale_down_delay_after_failure": {"key": "scale-down-delay-after-failure", "type": "str"}, + "scale_down_unneeded_time": {"key": "scale-down-unneeded-time", "type": "str"}, + "scale_down_unready_time": {"key": "scale-down-unready-time", "type": "str"}, + "scale_down_utilization_threshold": {"key": "scale-down-utilization-threshold", "type": "str"}, + "skip_nodes_with_local_storage": {"key": "skip-nodes-with-local-storage", "type": "str"}, + "skip_nodes_with_system_pods": {"key": "skip-nodes-with-system-pods", "type": "str"}, } def __init__( @@ -4341,7 +4262,7 @@ def __init__( :paramtype balance_similar_node_groups: str :keyword expander: If not specified, the default is 'random'. See `expanders `_ - for more information. Known values are: "least-waste", "most-pods", "priority", "random". + for more information. Known values are: "least-waste", "most-pods", "priority", and "random". :paramtype expander: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.Expander :keyword max_empty_bulk_delete: The default is 10. :paramtype max_empty_bulk_delete: str @@ -4384,7 +4305,7 @@ def __init__( :keyword skip_nodes_with_system_pods: The default is true. :paramtype skip_nodes_with_system_pods: str """ - super(ManagedClusterPropertiesAutoScalerProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.balance_similar_node_groups = balance_similar_node_groups self.expander = expander self.max_empty_bulk_delete = max_empty_bulk_delete @@ -4404,7 +4325,7 @@ def __init__( self.skip_nodes_with_system_pods = skip_nodes_with_system_pods -class ManagedClusterSecurityProfile(msrest.serialization.Model): +class ManagedClusterSecurityProfile(_serialization.Model): """Security profile for the container service cluster. :ivar azure_defender: Azure Defender settings for the security profile. @@ -4413,25 +4334,22 @@ class ManagedClusterSecurityProfile(msrest.serialization.Model): """ _attribute_map = { - 'azure_defender': {'key': 'azureDefender', 'type': 'ManagedClusterSecurityProfileAzureDefender'}, + "azure_defender": {"key": "azureDefender", "type": "ManagedClusterSecurityProfileAzureDefender"}, } def __init__( - self, - *, - azure_defender: Optional["_models.ManagedClusterSecurityProfileAzureDefender"] = None, - **kwargs + self, *, azure_defender: Optional["_models.ManagedClusterSecurityProfileAzureDefender"] = None, **kwargs ): """ :keyword azure_defender: Azure Defender settings for the security profile. :paramtype azure_defender: ~azure.mgmt.containerservice.v2021_11_01_preview.models.ManagedClusterSecurityProfileAzureDefender """ - super(ManagedClusterSecurityProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.azure_defender = azure_defender -class ManagedClusterSecurityProfileAzureDefender(msrest.serialization.Model): +class ManagedClusterSecurityProfileAzureDefender(_serialization.Model): """Azure Defender settings for the security profile. :ivar enabled: Whether to enable Azure Defender. @@ -4443,16 +4361,12 @@ class ManagedClusterSecurityProfileAzureDefender(msrest.serialization.Model): """ _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'log_analytics_workspace_resource_id': {'key': 'logAnalyticsWorkspaceResourceId', 'type': 'str'}, + "enabled": {"key": "enabled", "type": "bool"}, + "log_analytics_workspace_resource_id": {"key": "logAnalyticsWorkspaceResourceId", "type": "str"}, } def __init__( - self, - *, - enabled: Optional[bool] = None, - log_analytics_workspace_resource_id: Optional[str] = None, - **kwargs + self, *, enabled: Optional[bool] = None, log_analytics_workspace_resource_id: Optional[str] = None, **kwargs ): """ :keyword enabled: Whether to enable Azure Defender. @@ -4462,65 +4376,59 @@ def __init__( must be a valid workspace resource ID. When Azure Defender is disabled, leave the field empty. :paramtype log_analytics_workspace_resource_id: str """ - super(ManagedClusterSecurityProfileAzureDefender, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.log_analytics_workspace_resource_id = log_analytics_workspace_resource_id -class ManagedClusterServicePrincipalProfile(msrest.serialization.Model): +class ManagedClusterServicePrincipalProfile(_serialization.Model): """Information about a service principal identity for the cluster to use for manipulating Azure APIs. All required parameters must be populated in order to send to Azure. - :ivar client_id: Required. The ID for the service principal. + :ivar client_id: The ID for the service principal. Required. :vartype client_id: str :ivar secret: The secret password associated with the service principal in plain text. :vartype secret: str """ _validation = { - 'client_id': {'required': True}, + "client_id": {"required": True}, } _attribute_map = { - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'secret': {'key': 'secret', 'type': 'str'}, + "client_id": {"key": "clientId", "type": "str"}, + "secret": {"key": "secret", "type": "str"}, } - def __init__( - self, - *, - client_id: str, - secret: Optional[str] = None, - **kwargs - ): + def __init__(self, *, client_id: str, secret: Optional[str] = None, **kwargs): """ - :keyword client_id: Required. The ID for the service principal. + :keyword client_id: The ID for the service principal. Required. :paramtype client_id: str :keyword secret: The secret password associated with the service principal in plain text. :paramtype secret: str """ - super(ManagedClusterServicePrincipalProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.client_id = client_id self.secret = secret -class ManagedClusterSKU(msrest.serialization.Model): +class ManagedClusterSKU(_serialization.Model): """The SKU of a Managed Cluster. - :ivar name: The name of a managed cluster SKU. Known values are: "Basic". + :ivar name: The name of a managed cluster SKU. "Basic" :vartype name: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.ManagedClusterSKUName :ivar tier: If not specified, the default is 'Free'. See `uptime SLA - `_ for more details. Known values are: "Paid", - "Free". + `_ for more details. Known values are: "Paid" + and "Free". :vartype tier: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.ManagedClusterSKUTier """ _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, + "name": {"key": "name", "type": "str"}, + "tier": {"key": "tier", "type": "str"}, } def __init__( @@ -4531,21 +4439,21 @@ def __init__( **kwargs ): """ - :keyword name: The name of a managed cluster SKU. Known values are: "Basic". + :keyword name: The name of a managed cluster SKU. "Basic" :paramtype name: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.ManagedClusterSKUName :keyword tier: If not specified, the default is 'Free'. See `uptime SLA - `_ for more details. Known values are: "Paid", - "Free". + `_ for more details. Known values are: "Paid" + and "Free". :paramtype tier: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.ManagedClusterSKUTier """ - super(ManagedClusterSKU, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.tier = tier -class ManagedClusterUpgradeProfile(msrest.serialization.Model): +class ManagedClusterUpgradeProfile(_serialization.Model): """The list of available upgrades for compute pools. Variables are only populated by the server, and will be ignored when sending a request. @@ -4558,29 +4466,29 @@ class ManagedClusterUpgradeProfile(msrest.serialization.Model): :vartype name: str :ivar type: The type of the upgrade profile. :vartype type: str - :ivar control_plane_profile: Required. The list of available upgrade versions for the control - plane. + :ivar control_plane_profile: The list of available upgrade versions for the control plane. + Required. :vartype control_plane_profile: ~azure.mgmt.containerservice.v2021_11_01_preview.models.ManagedClusterPoolUpgradeProfile - :ivar agent_pool_profiles: Required. The list of available upgrade versions for agent pools. + :ivar agent_pool_profiles: The list of available upgrade versions for agent pools. Required. :vartype agent_pool_profiles: list[~azure.mgmt.containerservice.v2021_11_01_preview.models.ManagedClusterPoolUpgradeProfile] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'control_plane_profile': {'required': True}, - 'agent_pool_profiles': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "control_plane_profile": {"required": True}, + "agent_pool_profiles": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'control_plane_profile': {'key': 'properties.controlPlaneProfile', 'type': 'ManagedClusterPoolUpgradeProfile'}, - 'agent_pool_profiles': {'key': 'properties.agentPoolProfiles', 'type': '[ManagedClusterPoolUpgradeProfile]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "control_plane_profile": {"key": "properties.controlPlaneProfile", "type": "ManagedClusterPoolUpgradeProfile"}, + "agent_pool_profiles": {"key": "properties.agentPoolProfiles", "type": "[ManagedClusterPoolUpgradeProfile]"}, } def __init__( @@ -4591,15 +4499,15 @@ def __init__( **kwargs ): """ - :keyword control_plane_profile: Required. The list of available upgrade versions for the - control plane. + :keyword control_plane_profile: The list of available upgrade versions for the control plane. + Required. :paramtype control_plane_profile: ~azure.mgmt.containerservice.v2021_11_01_preview.models.ManagedClusterPoolUpgradeProfile - :keyword agent_pool_profiles: Required. The list of available upgrade versions for agent pools. + :keyword agent_pool_profiles: The list of available upgrade versions for agent pools. Required. :paramtype agent_pool_profiles: list[~azure.mgmt.containerservice.v2021_11_01_preview.models.ManagedClusterPoolUpgradeProfile] """ - super(ManagedClusterUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -4607,18 +4515,18 @@ def __init__( self.agent_pool_profiles = agent_pool_profiles -class ManagedClusterWindowsProfile(msrest.serialization.Model): +class ManagedClusterWindowsProfile(_serialization.Model): """Profile for Windows VMs in the managed cluster. All required parameters must be populated in order to send to Azure. - :ivar admin_username: Required. Specifies the name of the administrator account. - :code:`
`:code:`
` **Restriction:** Cannot end in "." :code:`
`:code:`
` - **Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", "test1", - "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", - "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", - "sys", "test2", "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 - character :code:`
`:code:`
` **Max-length:** 20 characters. + :ivar admin_username: Specifies the name of the administrator account. :code:`
`:code:`
` + **Restriction:** Cannot end in "." :code:`
`:code:`
` **Disallowed values:** + "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", + "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", + "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", + "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 character + :code:`
`:code:`
` **Max-length:** 20 characters. Required. :vartype admin_username: str :ivar admin_password: Specifies the password of the administrator account. :code:`
`:code:`
` **Minimum-length:** 8 characters :code:`
`:code:`
` @@ -4630,7 +4538,7 @@ class ManagedClusterWindowsProfile(msrest.serialization.Model): :vartype admin_password: str :ivar license_type: The license type to use for Windows VMs. See `Azure Hybrid User Benefits `_ for more details. Known values are: - "None", "Windows_Server". + "None" and "Windows_Server". :vartype license_type: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.LicenseType :ivar enable_csi_proxy: For more details on CSI proxy, see the `CSI proxy GitHub repo @@ -4642,15 +4550,15 @@ class ManagedClusterWindowsProfile(msrest.serialization.Model): """ _validation = { - 'admin_username': {'required': True}, + "admin_username": {"required": True}, } _attribute_map = { - 'admin_username': {'key': 'adminUsername', 'type': 'str'}, - 'admin_password': {'key': 'adminPassword', 'type': 'str'}, - 'license_type': {'key': 'licenseType', 'type': 'str'}, - 'enable_csi_proxy': {'key': 'enableCSIProxy', 'type': 'bool'}, - 'gmsa_profile': {'key': 'gmsaProfile', 'type': 'WindowsGmsaProfile'}, + "admin_username": {"key": "adminUsername", "type": "str"}, + "admin_password": {"key": "adminPassword", "type": "str"}, + "license_type": {"key": "licenseType", "type": "str"}, + "enable_csi_proxy": {"key": "enableCSIProxy", "type": "bool"}, + "gmsa_profile": {"key": "gmsaProfile", "type": "WindowsGmsaProfile"}, } def __init__( @@ -4664,13 +4572,13 @@ def __init__( **kwargs ): """ - :keyword admin_username: Required. Specifies the name of the administrator account. + :keyword admin_username: Specifies the name of the administrator account. :code:`
`:code:`
` **Restriction:** Cannot end in "." :code:`
`:code:`
` **Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 - character :code:`
`:code:`
` **Max-length:** 20 characters. + character :code:`
`:code:`
` **Max-length:** 20 characters. Required. :paramtype admin_username: str :keyword admin_password: Specifies the password of the administrator account. :code:`
`:code:`
` **Minimum-length:** 8 characters :code:`
`:code:`
` @@ -4682,7 +4590,7 @@ def __init__( :paramtype admin_password: str :keyword license_type: The license type to use for Windows VMs. See `Azure Hybrid User Benefits `_ for more details. Known values are: - "None", "Windows_Server". + "None" and "Windows_Server". :paramtype license_type: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.LicenseType :keyword enable_csi_proxy: For more details on CSI proxy, see the `CSI proxy GitHub repo @@ -4692,7 +4600,7 @@ def __init__( :paramtype gmsa_profile: ~azure.mgmt.containerservice.v2021_11_01_preview.models.WindowsGmsaProfile """ - super(ManagedClusterWindowsProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.admin_username = admin_username self.admin_password = admin_password self.license_type = license_type @@ -4700,7 +4608,7 @@ def __init__( self.gmsa_profile = gmsa_profile -class ManagedServiceIdentityUserAssignedIdentitiesValue(msrest.serialization.Model): +class ManagedServiceIdentityUserAssignedIdentitiesValue(_serialization.Model): """ManagedServiceIdentityUserAssignedIdentitiesValue. Variables are only populated by the server, and will be ignored when sending a request. @@ -4712,27 +4620,23 @@ class ManagedServiceIdentityUserAssignedIdentitiesValue(msrest.serialization.Mod """ _validation = { - 'principal_id': {'readonly': True}, - 'client_id': {'readonly': True}, + "principal_id": {"readonly": True}, + "client_id": {"readonly": True}, } _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, + "principal_id": {"key": "principalId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(ManagedServiceIdentityUserAssignedIdentitiesValue, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.principal_id = None self.client_id = None -class OperationListResult(msrest.serialization.Model): +class OperationListResult(_serialization.Model): """The List Operation response. Variables are only populated by the server, and will be ignored when sending a request. @@ -4742,24 +4646,20 @@ class OperationListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[OperationValue]'}, + "value": {"key": "value", "type": "[OperationValue]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(OperationListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None -class OperationValue(msrest.serialization.Model): +class OperationValue(_serialization.Model): """Describes the properties of a Operation value. Variables are only populated by the server, and will be ignored when sending a request. @@ -4779,30 +4679,26 @@ class OperationValue(msrest.serialization.Model): """ _validation = { - 'origin': {'readonly': True}, - 'name': {'readonly': True}, - 'operation': {'readonly': True}, - 'resource': {'readonly': True}, - 'description': {'readonly': True}, - 'provider': {'readonly': True}, + "origin": {"readonly": True}, + "name": {"readonly": True}, + "operation": {"readonly": True}, + "resource": {"readonly": True}, + "description": {"readonly": True}, + "provider": {"readonly": True}, } _attribute_map = { - 'origin': {'key': 'origin', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'operation': {'key': 'display.operation', 'type': 'str'}, - 'resource': {'key': 'display.resource', 'type': 'str'}, - 'description': {'key': 'display.description', 'type': 'str'}, - 'provider': {'key': 'display.provider', 'type': 'str'}, + "origin": {"key": "origin", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "operation": {"key": "display.operation", "type": "str"}, + "resource": {"key": "display.resource", "type": "str"}, + "description": {"key": "display.description", "type": "str"}, + "provider": {"key": "display.provider", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(OperationValue, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.origin = None self.name = None self.operation = None @@ -4811,7 +4707,7 @@ def __init__( self.provider = None -class OSOptionProfile(msrest.serialization.Model): +class OSOptionProfile(_serialization.Model): """The OS option profile. Variables are only populated by the server, and will be ignored when sending a request. @@ -4824,83 +4720,72 @@ class OSOptionProfile(msrest.serialization.Model): :vartype name: str :ivar type: The type of the OS option resource. :vartype type: str - :ivar os_option_property_list: Required. The list of OS options. + :ivar os_option_property_list: The list of OS options. Required. :vartype os_option_property_list: list[~azure.mgmt.containerservice.v2021_11_01_preview.models.OSOptionProperty] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'os_option_property_list': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "os_option_property_list": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'os_option_property_list': {'key': 'properties.osOptionPropertyList', 'type': '[OSOptionProperty]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "os_option_property_list": {"key": "properties.osOptionPropertyList", "type": "[OSOptionProperty]"}, } - def __init__( - self, - *, - os_option_property_list: List["_models.OSOptionProperty"], - **kwargs - ): + def __init__(self, *, os_option_property_list: List["_models.OSOptionProperty"], **kwargs): """ - :keyword os_option_property_list: Required. The list of OS options. + :keyword os_option_property_list: The list of OS options. Required. :paramtype os_option_property_list: list[~azure.mgmt.containerservice.v2021_11_01_preview.models.OSOptionProperty] """ - super(OSOptionProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None self.os_option_property_list = os_option_property_list -class OSOptionProperty(msrest.serialization.Model): +class OSOptionProperty(_serialization.Model): """OS option property. All required parameters must be populated in order to send to Azure. - :ivar os_type: Required. The OS type. + :ivar os_type: The OS type. Required. :vartype os_type: str - :ivar enable_fips_image: Required. Whether the image is FIPS-enabled. + :ivar enable_fips_image: Whether the image is FIPS-enabled. Required. :vartype enable_fips_image: bool """ _validation = { - 'os_type': {'required': True}, - 'enable_fips_image': {'required': True}, + "os_type": {"required": True}, + "enable_fips_image": {"required": True}, } _attribute_map = { - 'os_type': {'key': 'os-type', 'type': 'str'}, - 'enable_fips_image': {'key': 'enable-fips-image', 'type': 'bool'}, + "os_type": {"key": "os-type", "type": "str"}, + "enable_fips_image": {"key": "enable-fips-image", "type": "bool"}, } - def __init__( - self, - *, - os_type: str, - enable_fips_image: bool, - **kwargs - ): + def __init__(self, *, os_type: str, enable_fips_image: bool, **kwargs): """ - :keyword os_type: Required. The OS type. + :keyword os_type: The OS type. Required. :paramtype os_type: str - :keyword enable_fips_image: Required. Whether the image is FIPS-enabled. + :keyword enable_fips_image: Whether the image is FIPS-enabled. Required. :paramtype enable_fips_image: bool """ - super(OSOptionProperty, self).__init__(**kwargs) + super().__init__(**kwargs) self.os_type = os_type self.enable_fips_image = enable_fips_image -class OutboundEnvironmentEndpoint(msrest.serialization.Model): +class OutboundEnvironmentEndpoint(_serialization.Model): """Egress endpoints which AKS agent nodes connect to for common purpose. :ivar category: The category of endpoints accessed by the AKS agent node, e.g. @@ -4912,8 +4797,8 @@ class OutboundEnvironmentEndpoint(msrest.serialization.Model): """ _attribute_map = { - 'category': {'key': 'category', 'type': 'str'}, - 'endpoints': {'key': 'endpoints', 'type': '[EndpointDependency]'}, + "category": {"key": "category", "type": "str"}, + "endpoints": {"key": "endpoints", "type": "[EndpointDependency]"}, } def __init__( @@ -4931,19 +4816,19 @@ def __init__( :paramtype endpoints: list[~azure.mgmt.containerservice.v2021_11_01_preview.models.EndpointDependency] """ - super(OutboundEnvironmentEndpoint, self).__init__(**kwargs) + super().__init__(**kwargs) self.category = category self.endpoints = endpoints -class OutboundEnvironmentEndpointCollection(msrest.serialization.Model): +class OutboundEnvironmentEndpointCollection(_serialization.Model): """Collection of OutboundEnvironmentEndpoint. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar value: Required. Collection of resources. + :ivar value: Collection of resources. Required. :vartype value: list[~azure.mgmt.containerservice.v2021_11_01_preview.models.OutboundEnvironmentEndpoint] :ivar next_link: Link to next page of resources. @@ -4951,59 +4836,49 @@ class OutboundEnvironmentEndpointCollection(msrest.serialization.Model): """ _validation = { - 'value': {'required': True}, - 'next_link': {'readonly': True}, + "value": {"required": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[OutboundEnvironmentEndpoint]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[OutboundEnvironmentEndpoint]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: List["_models.OutboundEnvironmentEndpoint"], - **kwargs - ): + def __init__(self, *, value: List["_models.OutboundEnvironmentEndpoint"], **kwargs): """ - :keyword value: Required. Collection of resources. + :keyword value: Collection of resources. Required. :paramtype value: list[~azure.mgmt.containerservice.v2021_11_01_preview.models.OutboundEnvironmentEndpoint] """ - super(OutboundEnvironmentEndpointCollection, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class PowerState(msrest.serialization.Model): +class PowerState(_serialization.Model): """Describes the Power State of the cluster. - :ivar code: Tells whether the cluster is Running or Stopped. Known values are: "Running", + :ivar code: Tells whether the cluster is Running or Stopped. Known values are: "Running" and "Stopped". :vartype code: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.Code """ _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, + "code": {"key": "code", "type": "str"}, } - def __init__( - self, - *, - code: Optional[Union[str, "_models.Code"]] = None, - **kwargs - ): + def __init__(self, *, code: Optional[Union[str, "_models.Code"]] = None, **kwargs): """ - :keyword code: Tells whether the cluster is Running or Stopped. Known values are: "Running", + :keyword code: Tells whether the cluster is Running or Stopped. Known values are: "Running" and "Stopped". :paramtype code: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.Code """ - super(PowerState, self).__init__(**kwargs) + super().__init__(**kwargs) self.code = code -class PrivateEndpoint(msrest.serialization.Model): +class PrivateEndpoint(_serialization.Model): """Private endpoint which a connection belongs to. :ivar id: The resource ID of the private endpoint. @@ -5011,24 +4886,19 @@ class PrivateEndpoint(msrest.serialization.Model): """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, } - def __init__( - self, - *, - id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin """ :keyword id: The resource ID of the private endpoint. :paramtype id: str """ - super(PrivateEndpoint, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id -class PrivateEndpointConnection(msrest.serialization.Model): +class PrivateEndpointConnection(_serialization.Model): """A private endpoint connection. Variables are only populated by the server, and will be ignored when sending a request. @@ -5040,7 +4910,7 @@ class PrivateEndpointConnection(msrest.serialization.Model): :ivar type: The resource type. :vartype type: str :ivar provisioning_state: The current provisioning state. Known values are: "Succeeded", - "Creating", "Deleting", "Failed". + "Creating", "Deleting", and "Failed". :vartype provisioning_state: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.PrivateEndpointConnectionProvisioningState :ivar private_endpoint: The resource of private endpoint. @@ -5053,19 +4923,22 @@ class PrivateEndpointConnection(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'provisioning_state': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, - 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "private_endpoint": {"key": "properties.privateEndpoint", "type": "PrivateEndpoint"}, + "private_link_service_connection_state": { + "key": "properties.privateLinkServiceConnectionState", + "type": "PrivateLinkServiceConnectionState", + }, } def __init__( @@ -5084,7 +4957,7 @@ def __init__( :paramtype private_link_service_connection_state: ~azure.mgmt.containerservice.v2021_11_01_preview.models.PrivateLinkServiceConnectionState """ - super(PrivateEndpointConnection, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -5093,7 +4966,7 @@ def __init__( self.private_link_service_connection_state = private_link_service_connection_state -class PrivateEndpointConnectionListResult(msrest.serialization.Model): +class PrivateEndpointConnectionListResult(_serialization.Model): """A list of private endpoint connections. :ivar value: The collection value. @@ -5102,25 +4975,20 @@ class PrivateEndpointConnectionListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, + "value": {"key": "value", "type": "[PrivateEndpointConnection]"}, } - def __init__( - self, - *, - value: Optional[List["_models.PrivateEndpointConnection"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.PrivateEndpointConnection"]] = None, **kwargs): """ :keyword value: The collection value. :paramtype value: list[~azure.mgmt.containerservice.v2021_11_01_preview.models.PrivateEndpointConnection] """ - super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value -class PrivateLinkResource(msrest.serialization.Model): +class PrivateLinkResource(_serialization.Model): """A private link resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -5141,22 +5009,22 @@ class PrivateLinkResource(msrest.serialization.Model): """ _validation = { - 'private_link_service_id': {'readonly': True}, + "private_link_service_id": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'group_id': {'key': 'groupId', 'type': 'str'}, - 'required_members': {'key': 'requiredMembers', 'type': '[str]'}, - 'private_link_service_id': {'key': 'privateLinkServiceID', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "group_id": {"key": "groupId", "type": "str"}, + "required_members": {"key": "requiredMembers", "type": "[str]"}, + "private_link_service_id": {"key": "privateLinkServiceID", "type": "str"}, } def __init__( self, *, - id: Optional[str] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin name: Optional[str] = None, type: Optional[str] = None, group_id: Optional[str] = None, @@ -5175,7 +5043,7 @@ def __init__( :keyword required_members: The RequiredMembers of the resource. :paramtype required_members: list[str] """ - super(PrivateLinkResource, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id self.name = name self.type = type @@ -5184,7 +5052,7 @@ def __init__( self.private_link_service_id = None -class PrivateLinkResourcesListResult(msrest.serialization.Model): +class PrivateLinkResourcesListResult(_serialization.Model): """A list of private link resources. :ivar value: The collection value. @@ -5193,29 +5061,24 @@ class PrivateLinkResourcesListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, + "value": {"key": "value", "type": "[PrivateLinkResource]"}, } - def __init__( - self, - *, - value: Optional[List["_models.PrivateLinkResource"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.PrivateLinkResource"]] = None, **kwargs): """ :keyword value: The collection value. :paramtype value: list[~azure.mgmt.containerservice.v2021_11_01_preview.models.PrivateLinkResource] """ - super(PrivateLinkResourcesListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value -class PrivateLinkServiceConnectionState(msrest.serialization.Model): +class PrivateLinkServiceConnectionState(_serialization.Model): """The state of a private link service connection. :ivar status: The private link service connection status. Known values are: "Pending", - "Approved", "Rejected", "Disconnected". + "Approved", "Rejected", and "Disconnected". :vartype status: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.ConnectionStatus :ivar description: The private link service connection description. @@ -5223,8 +5086,8 @@ class PrivateLinkServiceConnectionState(msrest.serialization.Model): """ _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, + "status": {"key": "status", "type": "str"}, + "description": {"key": "description", "type": "str"}, } def __init__( @@ -5236,18 +5099,18 @@ def __init__( ): """ :keyword status: The private link service connection status. Known values are: "Pending", - "Approved", "Rejected", "Disconnected". + "Approved", "Rejected", and "Disconnected". :paramtype status: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.ConnectionStatus :keyword description: The private link service connection description. :paramtype description: str """ - super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) + super().__init__(**kwargs) self.status = status self.description = description -class ResourceReference(msrest.serialization.Model): +class ResourceReference(_serialization.Model): """A reference to an Azure resource. :ivar id: The fully qualified Azure resource id. @@ -5255,29 +5118,24 @@ class ResourceReference(msrest.serialization.Model): """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, } - def __init__( - self, - *, - id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin """ :keyword id: The fully qualified Azure resource id. :paramtype id: str """ - super(ResourceReference, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id -class RunCommandRequest(msrest.serialization.Model): +class RunCommandRequest(_serialization.Model): """A run command request. All required parameters must be populated in order to send to Azure. - :ivar command: Required. The command to run. + :ivar command: The command to run. Required. :vartype command: str :ivar context: A base64 encoded zip file containing the files required by the command. :vartype context: str @@ -5286,38 +5144,31 @@ class RunCommandRequest(msrest.serialization.Model): """ _validation = { - 'command': {'required': True}, + "command": {"required": True}, } _attribute_map = { - 'command': {'key': 'command', 'type': 'str'}, - 'context': {'key': 'context', 'type': 'str'}, - 'cluster_token': {'key': 'clusterToken', 'type': 'str'}, + "command": {"key": "command", "type": "str"}, + "context": {"key": "context", "type": "str"}, + "cluster_token": {"key": "clusterToken", "type": "str"}, } - def __init__( - self, - *, - command: str, - context: Optional[str] = None, - cluster_token: Optional[str] = None, - **kwargs - ): + def __init__(self, *, command: str, context: Optional[str] = None, cluster_token: Optional[str] = None, **kwargs): """ - :keyword command: Required. The command to run. + :keyword command: The command to run. Required. :paramtype command: str :keyword context: A base64 encoded zip file containing the files required by the command. :paramtype context: str :keyword cluster_token: AuthToken issued for AKS AAD Server App. :paramtype cluster_token: str """ - super(RunCommandRequest, self).__init__(**kwargs) + super().__init__(**kwargs) self.command = command self.context = context self.cluster_token = cluster_token -class RunCommandResult(msrest.serialization.Model): +class RunCommandResult(_serialization.Model): """run command result. Variables are only populated by the server, and will be ignored when sending a request. @@ -5339,32 +5190,28 @@ class RunCommandResult(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'exit_code': {'readonly': True}, - 'started_at': {'readonly': True}, - 'finished_at': {'readonly': True}, - 'logs': {'readonly': True}, - 'reason': {'readonly': True}, + "id": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "exit_code": {"readonly": True}, + "started_at": {"readonly": True}, + "finished_at": {"readonly": True}, + "logs": {"readonly": True}, + "reason": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'exit_code': {'key': 'properties.exitCode', 'type': 'int'}, - 'started_at': {'key': 'properties.startedAt', 'type': 'iso-8601'}, - 'finished_at': {'key': 'properties.finishedAt', 'type': 'iso-8601'}, - 'logs': {'key': 'properties.logs', 'type': 'str'}, - 'reason': {'key': 'properties.reason', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(RunCommandResult, self).__init__(**kwargs) + "id": {"key": "id", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "exit_code": {"key": "properties.exitCode", "type": "int"}, + "started_at": {"key": "properties.startedAt", "type": "iso-8601"}, + "finished_at": {"key": "properties.finishedAt", "type": "iso-8601"}, + "logs": {"key": "properties.logs", "type": "str"}, + "reason": {"key": "properties.reason", "type": "str"}, + } + + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.id = None self.provisioning_state = None self.exit_code = None @@ -5374,7 +5221,7 @@ def __init__( self.reason = None -class Snapshot(Resource): +class Snapshot(Resource): # pylint: disable=too-many-instance-attributes """A node pool snapshot resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -5387,28 +5234,27 @@ class Snapshot(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar system_data: The system metadata relating to this snapshot. :vartype system_data: ~azure.mgmt.containerservice.v2021_11_01_preview.models.SystemData :ivar creation_data: CreationData to be used to specify the source agent pool resource ID to create this snapshot. :vartype creation_data: ~azure.mgmt.containerservice.v2021_11_01_preview.models.CreationData - :ivar snapshot_type: The type of a snapshot. The default is NodePool. Known values are: - "NodePool". Default value: "NodePool". + :ivar snapshot_type: The type of a snapshot. The default is NodePool. "NodePool" :vartype snapshot_type: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.SnapshotType :ivar kubernetes_version: The version of Kubernetes. :vartype kubernetes_version: str :ivar node_image_version: The version of node image. :vartype node_image_version: str - :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.OSType :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known - values are: "Ubuntu", "CBLMariner". + values are: "Ubuntu" and "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.OSSKU :ivar vm_size: The size of the VM. :vartype vm_size: str @@ -5417,34 +5263,34 @@ class Snapshot(Resource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'system_data': {'readonly': True}, - 'kubernetes_version': {'readonly': True}, - 'node_image_version': {'readonly': True}, - 'os_type': {'readonly': True}, - 'os_sku': {'readonly': True}, - 'vm_size': {'readonly': True}, - 'enable_fips': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, + "system_data": {"readonly": True}, + "kubernetes_version": {"readonly": True}, + "node_image_version": {"readonly": True}, + "os_type": {"readonly": True}, + "os_sku": {"readonly": True}, + "vm_size": {"readonly": True}, + "enable_fips": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'creation_data': {'key': 'properties.creationData', 'type': 'CreationData'}, - 'snapshot_type': {'key': 'properties.snapshotType', 'type': 'str'}, - 'kubernetes_version': {'key': 'properties.kubernetesVersion', 'type': 'str'}, - 'node_image_version': {'key': 'properties.nodeImageVersion', 'type': 'str'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'os_sku': {'key': 'properties.osSku', 'type': 'str'}, - 'vm_size': {'key': 'properties.vmSize', 'type': 'str'}, - 'enable_fips': {'key': 'properties.enableFIPS', 'type': 'bool'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "creation_data": {"key": "properties.creationData", "type": "CreationData"}, + "snapshot_type": {"key": "properties.snapshotType", "type": "str"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "node_image_version": {"key": "properties.nodeImageVersion", "type": "str"}, + "os_type": {"key": "properties.osType", "type": "str"}, + "os_sku": {"key": "properties.osSku", "type": "str"}, + "vm_size": {"key": "properties.vmSize", "type": "str"}, + "enable_fips": {"key": "properties.enableFIPS", "type": "bool"}, } def __init__( @@ -5453,23 +5299,22 @@ def __init__( location: str, tags: Optional[Dict[str, str]] = None, creation_data: Optional["_models.CreationData"] = None, - snapshot_type: Optional[Union[str, "_models.SnapshotType"]] = "NodePool", + snapshot_type: Union[str, "_models.SnapshotType"] = "NodePool", **kwargs ): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword creation_data: CreationData to be used to specify the source agent pool resource ID to create this snapshot. :paramtype creation_data: ~azure.mgmt.containerservice.v2021_11_01_preview.models.CreationData - :keyword snapshot_type: The type of a snapshot. The default is NodePool. Known values are: - "NodePool". Default value: "NodePool". + :keyword snapshot_type: The type of a snapshot. The default is NodePool. "NodePool" :paramtype snapshot_type: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.SnapshotType """ - super(Snapshot, self).__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.system_data = None self.creation_data = creation_data self.snapshot_type = snapshot_type @@ -5481,7 +5326,7 @@ def __init__( self.enable_fips = None -class SnapshotListResult(msrest.serialization.Model): +class SnapshotListResult(_serialization.Model): """The response from the List Snapshots operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -5493,30 +5338,25 @@ class SnapshotListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[Snapshot]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[Snapshot]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.Snapshot"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.Snapshot"]] = None, **kwargs): """ :keyword value: The list of snapshots. :paramtype value: list[~azure.mgmt.containerservice.v2021_11_01_preview.models.Snapshot] """ - super(SnapshotListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class SysctlConfig(msrest.serialization.Model): +class SysctlConfig(_serialization.Model): # pylint: disable=too-many-instance-attributes """Sysctl settings for Linux agent nodes. :ivar net_core_somaxconn: Sysctl setting net.core.somaxconn. @@ -5578,37 +5418,37 @@ class SysctlConfig(msrest.serialization.Model): """ _attribute_map = { - 'net_core_somaxconn': {'key': 'netCoreSomaxconn', 'type': 'int'}, - 'net_core_netdev_max_backlog': {'key': 'netCoreNetdevMaxBacklog', 'type': 'int'}, - 'net_core_rmem_default': {'key': 'netCoreRmemDefault', 'type': 'int'}, - 'net_core_rmem_max': {'key': 'netCoreRmemMax', 'type': 'int'}, - 'net_core_wmem_default': {'key': 'netCoreWmemDefault', 'type': 'int'}, - 'net_core_wmem_max': {'key': 'netCoreWmemMax', 'type': 'int'}, - 'net_core_optmem_max': {'key': 'netCoreOptmemMax', 'type': 'int'}, - 'net_ipv4_tcp_max_syn_backlog': {'key': 'netIpv4TcpMaxSynBacklog', 'type': 'int'}, - 'net_ipv4_tcp_max_tw_buckets': {'key': 'netIpv4TcpMaxTwBuckets', 'type': 'int'}, - 'net_ipv4_tcp_fin_timeout': {'key': 'netIpv4TcpFinTimeout', 'type': 'int'}, - 'net_ipv4_tcp_keepalive_time': {'key': 'netIpv4TcpKeepaliveTime', 'type': 'int'}, - 'net_ipv4_tcp_keepalive_probes': {'key': 'netIpv4TcpKeepaliveProbes', 'type': 'int'}, - 'net_ipv4_tcpkeepalive_intvl': {'key': 'netIpv4TcpkeepaliveIntvl', 'type': 'int'}, - 'net_ipv4_tcp_tw_reuse': {'key': 'netIpv4TcpTwReuse', 'type': 'bool'}, - 'net_ipv4_ip_local_port_range': {'key': 'netIpv4IpLocalPortRange', 'type': 'str'}, - 'net_ipv4_neigh_default_gc_thresh1': {'key': 'netIpv4NeighDefaultGcThresh1', 'type': 'int'}, - 'net_ipv4_neigh_default_gc_thresh2': {'key': 'netIpv4NeighDefaultGcThresh2', 'type': 'int'}, - 'net_ipv4_neigh_default_gc_thresh3': {'key': 'netIpv4NeighDefaultGcThresh3', 'type': 'int'}, - 'net_netfilter_nf_conntrack_max': {'key': 'netNetfilterNfConntrackMax', 'type': 'int'}, - 'net_netfilter_nf_conntrack_buckets': {'key': 'netNetfilterNfConntrackBuckets', 'type': 'int'}, - 'fs_inotify_max_user_watches': {'key': 'fsInotifyMaxUserWatches', 'type': 'int'}, - 'fs_file_max': {'key': 'fsFileMax', 'type': 'int'}, - 'fs_aio_max_nr': {'key': 'fsAioMaxNr', 'type': 'int'}, - 'fs_nr_open': {'key': 'fsNrOpen', 'type': 'int'}, - 'kernel_threads_max': {'key': 'kernelThreadsMax', 'type': 'int'}, - 'vm_max_map_count': {'key': 'vmMaxMapCount', 'type': 'int'}, - 'vm_swappiness': {'key': 'vmSwappiness', 'type': 'int'}, - 'vm_vfs_cache_pressure': {'key': 'vmVfsCachePressure', 'type': 'int'}, - } - - def __init__( + "net_core_somaxconn": {"key": "netCoreSomaxconn", "type": "int"}, + "net_core_netdev_max_backlog": {"key": "netCoreNetdevMaxBacklog", "type": "int"}, + "net_core_rmem_default": {"key": "netCoreRmemDefault", "type": "int"}, + "net_core_rmem_max": {"key": "netCoreRmemMax", "type": "int"}, + "net_core_wmem_default": {"key": "netCoreWmemDefault", "type": "int"}, + "net_core_wmem_max": {"key": "netCoreWmemMax", "type": "int"}, + "net_core_optmem_max": {"key": "netCoreOptmemMax", "type": "int"}, + "net_ipv4_tcp_max_syn_backlog": {"key": "netIpv4TcpMaxSynBacklog", "type": "int"}, + "net_ipv4_tcp_max_tw_buckets": {"key": "netIpv4TcpMaxTwBuckets", "type": "int"}, + "net_ipv4_tcp_fin_timeout": {"key": "netIpv4TcpFinTimeout", "type": "int"}, + "net_ipv4_tcp_keepalive_time": {"key": "netIpv4TcpKeepaliveTime", "type": "int"}, + "net_ipv4_tcp_keepalive_probes": {"key": "netIpv4TcpKeepaliveProbes", "type": "int"}, + "net_ipv4_tcpkeepalive_intvl": {"key": "netIpv4TcpkeepaliveIntvl", "type": "int"}, + "net_ipv4_tcp_tw_reuse": {"key": "netIpv4TcpTwReuse", "type": "bool"}, + "net_ipv4_ip_local_port_range": {"key": "netIpv4IpLocalPortRange", "type": "str"}, + "net_ipv4_neigh_default_gc_thresh1": {"key": "netIpv4NeighDefaultGcThresh1", "type": "int"}, + "net_ipv4_neigh_default_gc_thresh2": {"key": "netIpv4NeighDefaultGcThresh2", "type": "int"}, + "net_ipv4_neigh_default_gc_thresh3": {"key": "netIpv4NeighDefaultGcThresh3", "type": "int"}, + "net_netfilter_nf_conntrack_max": {"key": "netNetfilterNfConntrackMax", "type": "int"}, + "net_netfilter_nf_conntrack_buckets": {"key": "netNetfilterNfConntrackBuckets", "type": "int"}, + "fs_inotify_max_user_watches": {"key": "fsInotifyMaxUserWatches", "type": "int"}, + "fs_file_max": {"key": "fsFileMax", "type": "int"}, + "fs_aio_max_nr": {"key": "fsAioMaxNr", "type": "int"}, + "fs_nr_open": {"key": "fsNrOpen", "type": "int"}, + "kernel_threads_max": {"key": "kernelThreadsMax", "type": "int"}, + "vm_max_map_count": {"key": "vmMaxMapCount", "type": "int"}, + "vm_swappiness": {"key": "vmSwappiness", "type": "int"}, + "vm_vfs_cache_pressure": {"key": "vmVfsCachePressure", "type": "int"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, net_core_somaxconn: Optional[int] = None, @@ -5699,7 +5539,7 @@ def __init__( :keyword vm_vfs_cache_pressure: Sysctl setting vm.vfs_cache_pressure. :paramtype vm_vfs_cache_pressure: int """ - super(SysctlConfig, self).__init__(**kwargs) + super().__init__(**kwargs) self.net_core_somaxconn = net_core_somaxconn self.net_core_netdev_max_backlog = net_core_netdev_max_backlog self.net_core_rmem_default = net_core_rmem_default @@ -5730,13 +5570,13 @@ def __init__( self.vm_vfs_cache_pressure = vm_vfs_cache_pressure -class SystemData(msrest.serialization.Model): +class SystemData(_serialization.Model): """Metadata pertaining to creation and last modification of the resource. :ivar created_by: The identity that created the resource. :vartype created_by: str :ivar created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", "Key". + "User", "Application", "ManagedIdentity", and "Key". :vartype created_by_type: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.CreatedByType :ivar created_at: The UTC timestamp of resource creation. @@ -5744,7 +5584,7 @@ class SystemData(msrest.serialization.Model): :ivar last_modified_by: The identity that last modified the resource. :vartype last_modified_by: str :ivar last_modified_by_type: The type of identity that last modified the resource. Known values - are: "User", "Application", "ManagedIdentity", "Key". + are: "User", "Application", "ManagedIdentity", and "Key". :vartype last_modified_by_type: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.CreatedByType :ivar last_modified_at: The type of identity that last modified the resource. @@ -5752,12 +5592,12 @@ class SystemData(msrest.serialization.Model): """ _attribute_map = { - 'created_by': {'key': 'createdBy', 'type': 'str'}, - 'created_by_type': {'key': 'createdByType', 'type': 'str'}, - 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, - 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, - 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, - 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + "created_by": {"key": "createdBy", "type": "str"}, + "created_by_type": {"key": "createdByType", "type": "str"}, + "created_at": {"key": "createdAt", "type": "iso-8601"}, + "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, + "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, + "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, } def __init__( @@ -5775,7 +5615,7 @@ def __init__( :keyword created_by: The identity that created the resource. :paramtype created_by: str :keyword created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", "Key". + "User", "Application", "ManagedIdentity", and "Key". :paramtype created_by_type: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.CreatedByType :keyword created_at: The UTC timestamp of resource creation. @@ -5783,13 +5623,13 @@ def __init__( :keyword last_modified_by: The identity that last modified the resource. :paramtype last_modified_by: str :keyword last_modified_by_type: The type of identity that last modified the resource. Known - values are: "User", "Application", "ManagedIdentity", "Key". + values are: "User", "Application", "ManagedIdentity", and "Key". :paramtype last_modified_by_type: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.CreatedByType :keyword last_modified_at: The type of identity that last modified the resource. :paramtype last_modified_at: ~datetime.datetime """ - super(SystemData, self).__init__(**kwargs) + super().__init__(**kwargs) self.created_by = created_by self.created_by_type = created_by_type self.created_at = created_at @@ -5798,36 +5638,31 @@ def __init__( self.last_modified_at = last_modified_at -class TagsObject(msrest.serialization.Model): +class TagsObject(_serialization.Model): """Tags object for patch operations. - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] """ _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] """ - super(TagsObject, self).__init__(**kwargs) + super().__init__(**kwargs) self.tags = tags -class TimeInWeek(msrest.serialization.Model): +class TimeInWeek(_serialization.Model): """Time in a week. :ivar day: The day of the week. Known values are: "Sunday", "Monday", "Tuesday", "Wednesday", - "Thursday", "Friday", "Saturday". + "Thursday", "Friday", and "Saturday". :vartype day: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.WeekDay :ivar hour_slots: Each integer hour represents a time range beginning at 0m after the hour ending at the next hour (non-inclusive). 0 corresponds to 00:00 UTC, 23 corresponds to 23:00 @@ -5836,32 +5671,28 @@ class TimeInWeek(msrest.serialization.Model): """ _attribute_map = { - 'day': {'key': 'day', 'type': 'str'}, - 'hour_slots': {'key': 'hourSlots', 'type': '[int]'}, + "day": {"key": "day", "type": "str"}, + "hour_slots": {"key": "hourSlots", "type": "[int]"}, } def __init__( - self, - *, - day: Optional[Union[str, "_models.WeekDay"]] = None, - hour_slots: Optional[List[int]] = None, - **kwargs + self, *, day: Optional[Union[str, "_models.WeekDay"]] = None, hour_slots: Optional[List[int]] = None, **kwargs ): """ :keyword day: The day of the week. Known values are: "Sunday", "Monday", "Tuesday", - "Wednesday", "Thursday", "Friday", "Saturday". + "Wednesday", "Thursday", "Friday", and "Saturday". :paramtype day: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.WeekDay :keyword hour_slots: Each integer hour represents a time range beginning at 0m after the hour ending at the next hour (non-inclusive). 0 corresponds to 00:00 UTC, 23 corresponds to 23:00 UTC. Specifying [0, 1] means the 00:00 - 02:00 UTC time range. :paramtype hour_slots: list[int] """ - super(TimeInWeek, self).__init__(**kwargs) + super().__init__(**kwargs) self.day = day self.hour_slots = hour_slots -class TimeSpan(msrest.serialization.Model): +class TimeSpan(_serialization.Model): """For example, between 2021-05-25T13:00:00Z and 2021-05-25T14:00:00Z. :ivar start: The start of a time span. @@ -5871,29 +5702,23 @@ class TimeSpan(msrest.serialization.Model): """ _attribute_map = { - 'start': {'key': 'start', 'type': 'iso-8601'}, - 'end': {'key': 'end', 'type': 'iso-8601'}, + "start": {"key": "start", "type": "iso-8601"}, + "end": {"key": "end", "type": "iso-8601"}, } - def __init__( - self, - *, - start: Optional[datetime.datetime] = None, - end: Optional[datetime.datetime] = None, - **kwargs - ): + def __init__(self, *, start: Optional[datetime.datetime] = None, end: Optional[datetime.datetime] = None, **kwargs): """ :keyword start: The start of a time span. :paramtype start: ~datetime.datetime :keyword end: The end of a time span. :paramtype end: ~datetime.datetime """ - super(TimeSpan, self).__init__(**kwargs) + super().__init__(**kwargs) self.start = start self.end = end -class WindowsGmsaProfile(msrest.serialization.Model): +class WindowsGmsaProfile(_serialization.Model): """Windows gMSA Profile in the managed cluster. :ivar enabled: Specifies whether to enable Windows gMSA in the managed cluster. @@ -5909,9 +5734,9 @@ class WindowsGmsaProfile(msrest.serialization.Model): """ _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'dns_server': {'key': 'dnsServer', 'type': 'str'}, - 'root_domain_name': {'key': 'rootDomainName', 'type': 'str'}, + "enabled": {"key": "enabled", "type": "bool"}, + "dns_server": {"key": "dnsServer", "type": "str"}, + "root_domain_name": {"key": "rootDomainName", "type": "str"}, } def __init__( @@ -5934,7 +5759,7 @@ def __init__( which is used to create the managed cluster. :paramtype root_domain_name: str """ - super(WindowsGmsaProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.dns_server = dns_server self.root_domain_name = root_domain_name diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/models/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/models/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/models/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/models/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/operations/__init__.py index e0748876288c..593b23075ce0 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/operations/__init__.py @@ -18,15 +18,16 @@ from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'Operations', - 'ManagedClustersOperations', - 'MaintenanceConfigurationsOperations', - 'AgentPoolsOperations', - 'PrivateEndpointConnectionsOperations', - 'PrivateLinkResourcesOperations', - 'ResolvePrivateLinkServiceIdOperations', - 'SnapshotsOperations', + "Operations", + "ManagedClustersOperations", + "MaintenanceConfigurationsOperations", + "AgentPoolsOperations", + "PrivateEndpointConnectionsOperations", + "PrivateLinkResourcesOperations", + "ResolvePrivateLinkServiceIdOperations", + "SnapshotsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/operations/_agent_pools_operations.py index 9a53fd417dfa..e457bce978f0 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/operations/_agent_pools_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,288 +27,289 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - *, - json: Optional[_models.AgentPool] = None, - content: Any = None, - **kwargs: Any + _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, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + _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, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_get_upgrade_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_available_agent_pool_versions_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_upgrade_node_image_version_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_upgrade_node_image_version_request( + resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class AgentPoolsOperations: """ @@ -324,47 +330,40 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> Iterable[_models.AgentPoolListResult]: + def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> Iterable["_models.AgentPool"]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AgentPoolListResult or the result of cls(response) + :return: An iterator like instance of either AgentPool or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_11_01_preview.models.AgentPoolListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_11_01_preview.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -372,16 +371,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -397,10 +391,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -410,54 +402,45 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore @distributed_trace def get( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPool: """Gets the specified managed cluster agent pool. Gets the specified managed cluster agent pool. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPool, or the result of cls(response) + :return: AgentPool or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.AgentPool - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -465,57 +448,60 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore def _create_or_update_initial( self, resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: _models.AgentPool, + parameters: Union[_models.AgentPool, IO], **kwargs: Any ) -> _models.AgentPool: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - _json = self._serialize.body(parameters, 'AgentPool') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "AgentPool") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -523,10 +509,9 @@ def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -534,40 +519,123 @@ def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - @distributed_trace + @overload def begin_create_or_update( self, resource_group_name: str, resource_name: str, agent_pool_name: str, parameters: _models.AgentPool, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.AgentPool]: """Creates or updates an agent pool in the specified managed cluster. Creates or updates an agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str - :param parameters: The agent pool to create or update. + :param parameters: The agent pool to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2021_11_01_preview.models.AgentPool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_11_01_preview.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AgentPool]: + """Creates or updates an agent pool in the specified managed cluster. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: The agent pool to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_11_01_preview.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: Union[_models.AgentPool, IO], + **kwargs: Any + ) -> LROPoller[_models.AgentPool]: + """Creates or updates an agent pool in the specified managed cluster. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: The agent pool to create or update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.mgmt.containerservice.v2021_11_01_preview.models.AgentPool or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -579,20 +647,17 @@ def begin_create_or_update( :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_11_01_preview.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -601,66 +666,55 @@ def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -668,10 +722,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -681,26 +734,21 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + def begin_delete( + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> LROPoller[None]: """Deletes an agent pool in the specified managed cluster. Deletes an agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -712,99 +760,85 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPoolUpgradeProfile: """Gets the upgrade profile for an agent pool. Gets the upgrade profile for an agent pool. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolUpgradeProfile, or the result of cls(response) + :return: AgentPoolUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.AgentPoolUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -812,32 +846,27 @@ def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolUpgradeProfile', pipeline_response) + deserialized = self._deserialize("AgentPoolUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore @distributed_trace def get_available_agent_pool_versions( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported Kubernetes versions for the specified agent pool. @@ -845,33 +874,30 @@ def get_available_agent_pool_versions( `_ for more details about the version lifecycle. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolAvailableVersions, or the result of cls(response) + :return: AgentPoolAvailableVersions or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.AgentPoolAvailableVersions - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolAvailableVersions] - request = build_get_available_agent_pool_versions_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_available_agent_pool_versions.metadata['url'], + template_url=self.get_available_agent_pool_versions.metadata["url"], headers=_headers, params=_params, ) @@ -879,52 +905,43 @@ def get_available_agent_pool_versions( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolAvailableVersions', pipeline_response) + deserialized = self._deserialize("AgentPoolAvailableVersions", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_available_agent_pool_versions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore - + get_available_agent_pool_versions.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore def _upgrade_node_image_version_initial( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> Optional[_models.AgentPool]: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.AgentPool]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.AgentPool]] - - request = build_upgrade_node_image_version_request_initial( - subscription_id=self._config.subscription_id, + request = build_upgrade_node_image_version_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._upgrade_node_image_version_initial.metadata['url'], + template_url=self._upgrade_node_image_version_initial.metadata["url"], headers=_headers, params=_params, ) @@ -932,10 +949,9 @@ def _upgrade_node_image_version_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -945,37 +961,34 @@ def _upgrade_node_image_version_initial( deserialized = None response_headers = {} if response.status_code == 202: - response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) - - deserialized = self._deserialize('AgentPool', pipeline_response) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _upgrade_node_image_version_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore - + _upgrade_node_image_version_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore @distributed_trace def begin_upgrade_node_image_version( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any - ) -> LROPoller[_models.AgentPool]: + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any + ) -> LROPoller[None]: """Upgrades the node image version of an agent pool to the latest. Upgrading the node image version of an agent pool applies the newest OS and runtime updates to the nodes. AKS provides one new image per week with the latest updates. For more details on node image versions, see: https://docs.microsoft.com/azure/aks/node-image-upgrade. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -988,59 +1001,54 @@ def begin_upgrade_node_image_version( :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_11_01_preview.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._upgrade_node_image_version_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) - - deserialized = self._deserialize('AgentPool', pipeline_response) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_upgrade_node_image_version.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore + begin_upgrade_node_image_version.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/operations/_maintenance_configurations_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/operations/_maintenance_configurations_operations.py index 3c94225e5e51..aef694d075fa 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/operations/_maintenance_configurations_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/operations/_maintenance_configurations_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,173 +25,173 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +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_managed_cluster_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, config_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 = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "configName": _SERIALIZER.url("config_name", config_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "configName": _SERIALIZER.url("config_name", config_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - config_name: str, - *, - json: Optional[_models.MaintenanceConfiguration] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, resource_name: str, config_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 = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "configName": _SERIALIZER.url("config_name", config_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "configName": _SERIALIZER.url("config_name", config_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, config_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 = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "configName": _SERIALIZER.url("config_name", config_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "configName": _SERIALIZER.url("config_name", config_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class MaintenanceConfigurationsOperations: """ @@ -207,48 +212,43 @@ def __init__(self, *args, **kwargs): 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_managed_cluster( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> Iterable[_models.MaintenanceConfigurationListResult]: + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> Iterable["_models.MaintenanceConfiguration"]: """Gets a list of maintenance configurations in the specified managed cluster. Gets a list of maintenance configurations in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either MaintenanceConfigurationListResult or the result - of cls(response) + :return: An iterator like instance of either MaintenanceConfiguration or the result of + cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_11_01_preview.models.MaintenanceConfigurationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_11_01_preview.models.MaintenanceConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfigurationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfigurationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_managed_cluster_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_managed_cluster.metadata['url'], + template_url=self.list_by_managed_cluster.metadata["url"], headers=_headers, params=_params, ) @@ -256,16 +256,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_managed_cluster_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -281,10 +276,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -294,54 +287,45 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_managed_cluster.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations"} # type: ignore + list_by_managed_cluster.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations"} # type: ignore @distributed_trace def get( - self, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, config_name: str, **kwargs: Any ) -> _models.MaintenanceConfiguration: """Gets the specified maintenance configuration of a managed cluster. Gets the specified maintenance configuration of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: MaintenanceConfiguration, or the result of cls(response) + :return: MaintenanceConfiguration or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.MaintenanceConfiguration - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfiguration] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -349,76 +333,148 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) + deserialized = self._deserialize("MaintenanceConfiguration", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - @distributed_trace + @overload def create_or_update( self, resource_group_name: str, resource_name: str, config_name: str, parameters: _models.MaintenanceConfiguration, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.MaintenanceConfiguration: """Creates or updates a maintenance configuration in the specified managed cluster. Creates or updates a maintenance configuration in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str - :param parameters: The maintenance configuration to create or update. + :param parameters: The maintenance configuration to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2021_11_01_preview.models.MaintenanceConfiguration + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configuration in the specified managed cluster. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: The maintenance configuration to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: Union[_models.MaintenanceConfiguration, IO], + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configuration in the specified managed cluster. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: The maintenance configuration to create or update. Is either a model type or + a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2021_11_01_preview.models.MaintenanceConfiguration or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: MaintenanceConfiguration, or the result of cls(response) + :return: MaintenanceConfiguration or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.MaintenanceConfiguration - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfiguration] - _json = self._serialize.body(parameters, 'MaintenanceConfiguration') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "MaintenanceConfiguration") request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) @@ -426,68 +482,59 @@ def create_or_update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) + deserialized = self._deserialize("MaintenanceConfiguration", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore @distributed_trace def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, config_name: str, **kwargs: Any ) -> None: """Deletes a maintenance configuration. Deletes a maintenance configuration. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) @@ -495,10 +542,9 @@ def delete( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -508,5 +554,4 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/operations/_managed_clusters_operations.py index 5a72d77a0123..8968e315555d 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/operations/_managed_clusters_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,200 +27,183 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_get_os_options_request( - subscription_id: str, - location: str, - *, - resource_type: Optional[str] = None, - **kwargs: Any + location: str, subscription_id: str, *, resource_type: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "location": _SERIALIZER.url("location", location, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if resource_type is not None: - _params['resource-type'] = _SERIALIZER.query("resource_type", resource_type, 'str') + _params["resource-type"] = _SERIALIZER.query("resource_type", resource_type, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters") + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters" + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_resource_group_request( - subscription_id: str, - resource_group_name: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters", + ) # 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', min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_upgrade_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_access_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, role_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 = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "roleName": _SERIALIZER.url("role_name", role_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "roleName": _SERIALIZER.url("role_name", role_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_admin_credentials_request( - subscription_id: str, resource_group_name: str, resource_name: str, + subscription_id: str, *, server_fqdn: Optional[str] = None, **kwargs: Any @@ -223,40 +211,44 @@ def build_list_cluster_admin_credentials_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if server_fqdn is not None: - _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + _params["server-fqdn"] = _SERIALIZER.query("server_fqdn", server_fqdn, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_user_credentials_request( - subscription_id: str, resource_group_name: str, resource_name: str, + subscription_id: str, *, server_fqdn: Optional[str] = None, **kwargs: Any @@ -264,40 +256,44 @@ def build_list_cluster_user_credentials_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if server_fqdn is not None: - _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + _params["server-fqdn"] = _SERIALIZER.query("server_fqdn", server_fqdn, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_monitoring_user_credentials_request( - subscription_id: str, resource_group_name: str, resource_name: str, + subscription_id: str, *, server_fqdn: Optional[str] = None, **kwargs: Any @@ -305,520 +301,509 @@ def build_list_cluster_monitoring_user_credentials_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if server_fqdn is not None: - _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + _params["server-fqdn"] = _SERIALIZER.query("server_fqdn", server_fqdn, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: + +def build_get_request(resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedCluster] = None, - content: Any = None, - **kwargs: Any + +def build_create_or_update_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_update_tags_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.TagsObject] = None, - content: Any = None, - **kwargs: Any + +def build_update_tags_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + +def build_delete_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_reset_service_principal_profile_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedClusterServicePrincipalProfile] = None, - content: Any = None, - **kwargs: Any + +def build_reset_service_principal_profile_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_reset_aad_profile_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedClusterAADProfile] = None, - content: Any = None, - **kwargs: Any + +def build_reset_aad_profile_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_rotate_cluster_certificates_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + +def build_rotate_cluster_certificates_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_stop_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + +def build_stop_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_start_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + +def build_start_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_run_command_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.RunCommandRequest] = None, - content: Any = None, - **kwargs: Any + +def build_run_command_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_get_command_result_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - command_id: str, - **kwargs: Any + resource_group_name: str, resource_name: str, command_id: 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "commandId": _SERIALIZER.url("command_id", command_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "commandId": _SERIALIZER.url("command_id", command_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_list_outbound_network_dependencies_endpoints_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + class ManagedClustersOperations: # pylint: disable=too-many-public-methods """ @@ -839,46 +824,39 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def get_os_options( - self, - location: str, - resource_type: Optional[str] = None, - **kwargs: Any + self, location: str, resource_type: Optional[str] = None, **kwargs: Any ) -> _models.OSOptionProfile: """Gets supported OS options in the specified subscription. Gets supported OS options in the specified subscription. - :param location: The name of a supported Azure region. + :param location: The name of a supported Azure region. Required. :type location: str :param resource_type: The resource type for which the OS options needs to be returned. Default value is None. :type resource_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: OSOptionProfile, or the result of cls(response) + :return: OSOptionProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.OSOptionProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OSOptionProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OSOptionProfile] - request = build_get_os_options_request( - subscription_id=self._config.subscription_id, location=location, - api_version=api_version, + subscription_id=self._config.subscription_id, resource_type=resource_type, - template_url=self.get_os_options.metadata['url'], + api_version=api_version, + template_url=self.get_os_options.metadata["url"], headers=_headers, params=_params, ) @@ -886,59 +864,52 @@ def get_os_options( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('OSOptionProfile', pipeline_response) + deserialized = self._deserialize("OSOptionProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_os_options.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default"} # type: ignore - + get_os_options.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default"} # type: ignore @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.ManagedClusterListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.ManagedCluster"]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_11_01_preview.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_11_01_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -946,14 +917,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -969,10 +937,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -982,49 +948,41 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> Iterable[_models.ManagedClusterListResult]: + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.ManagedCluster"]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_11_01_preview.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_11_01_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -1032,15 +990,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -1056,10 +1010,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1069,50 +1021,42 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.ManagedClusterUpgradeProfile: """Gets the upgrade profile of a managed cluster. Gets the upgrade profile of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterUpgradeProfile, or the result of cls(response) + :return: ManagedClusterUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.ManagedClusterUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -1120,33 +1064,27 @@ def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterUpgradeProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore @distributed_trace def get_access_profile( - self, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, role_name: str, **kwargs: Any ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. @@ -1155,36 +1093,33 @@ def get_access_profile( `ListClusterAdminCredentials `_ . - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param role_name: The name of the role for managed cluster accessProfile resource. + :param role_name: The name of the role for managed cluster accessProfile resource. Required. :type role_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterAccessProfile, or the result of cls(response) + :return: ManagedClusterAccessProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.ManagedClusterAccessProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterAccessProfile] - request = build_get_access_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, role_name=role_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_access_profile.metadata['url'], + template_url=self.get_access_profile.metadata["url"], headers=_headers, params=_params, ) @@ -1192,68 +1127,59 @@ def get_access_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterAccessProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterAccessProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_access_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore - + get_access_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore @distributed_trace def list_cluster_admin_credentials( - self, - resource_group_name: str, - resource_name: str, - server_fqdn: Optional[str] = None, - **kwargs: Any + self, resource_group_name: str, resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any ) -> _models.CredentialResults: """Lists the admin credentials of a managed cluster. Lists the admin credentials of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_admin_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, - template_url=self.list_cluster_admin_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_admin_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -1261,68 +1187,59 @@ def list_cluster_admin_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_admin_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore - + list_cluster_admin_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore @distributed_trace def list_cluster_user_credentials( - self, - resource_group_name: str, - resource_name: str, - server_fqdn: Optional[str] = None, - **kwargs: Any + self, resource_group_name: str, resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any ) -> _models.CredentialResults: """Lists the user credentials of a managed cluster. Lists the user credentials of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, - template_url=self.list_cluster_user_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -1330,68 +1247,59 @@ def list_cluster_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore - + list_cluster_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore @distributed_trace def list_cluster_monitoring_user_credentials( - self, - resource_group_name: str, - resource_name: str, - server_fqdn: Optional[str] = None, - **kwargs: Any + self, resource_group_name: str, resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any ) -> _models.CredentialResults: """Lists the cluster monitoring user credentials of a managed cluster. Lists the cluster monitoring user credentials of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_monitoring_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, - template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_monitoring_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -1399,64 +1307,54 @@ def list_cluster_monitoring_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_monitoring_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore - + list_cluster_monitoring_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore @distributed_trace - def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.ManagedCluster: + def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.ManagedCluster: """Gets a managed cluster. Gets a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedCluster, or the result of cls(response) + :return: ManagedCluster or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.ManagedCluster - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -1464,55 +1362,54 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _create_or_update_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.ManagedCluster, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'ManagedCluster') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedCluster") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1520,10 +1417,9 @@ def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -1531,37 +1427,41 @@ def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - - @distributed_trace + @overload def begin_create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedCluster, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. Creates or updates a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The managed cluster to create or update. + :param parameters: The managed cluster to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2021_11_01_preview.models.ManagedCluster + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1574,90 +1474,155 @@ def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_11_01_preview.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._create_or_update_initial( # type: ignore - resource_group_name=resource_group_name, - resource_name=resource_name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop('error_map', None) - def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized + @overload + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + Creates or updates a managed cluster. - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_11_01_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster to create or update. Is either a model type or a IO + type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_11_01_preview.models.ManagedCluster or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_11_01_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ManagedCluster", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _update_tags_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.TagsObject, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request_initial( - subscription_id=self._config.subscription_id, + request = build_update_tags_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_tags_initial.metadata['url'], + content=_content, + template_url=self._update_tags_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1665,44 +1630,118 @@ def _update_tags_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_tags_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + _update_tags_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - - @distributed_trace + @overload def begin_update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates tags on a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2021_11_01_preview.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_11_01_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates tags on a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_11_01_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates tags on a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_11_01_preview.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1715,20 +1754,17 @@ def begin_update_tags( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_11_01_preview.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, @@ -1736,64 +1772,54 @@ def begin_update_tags( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1801,10 +1827,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1814,23 +1839,17 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> LROPoller[None]: + def begin_delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> LROPoller[None]: """Deletes a managed cluster. Deletes a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1842,85 +1861,83 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterServicePrincipalProfile, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterServicePrincipalProfile") - request = build_reset_service_principal_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_service_principal_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_service_principal_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_service_principal_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1928,10 +1945,9 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1941,28 +1957,105 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re if cls: return cls(pipeline_response, None, {}) - _reset_service_principal_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + _reset_service_principal_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + @overload + def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.ManagedClusterServicePrincipalProfile, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reset the Service Principal Profile of a managed cluster. + + This action cannot be performed on a cluster that is not using a service principal. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The service principal profile to set on the managed cluster. Required. + :type parameters: + ~azure.mgmt.containerservice.v2021_11_01_preview.models.ManagedClusterServicePrincipalProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reset the Service Principal Profile of a managed cluster. + + This action cannot be performed on a cluster that is not using a service principal. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The service principal profile to set on the managed cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace - def begin_reset_service_principal_profile( # pylint: disable=inconsistent-return-statements + def begin_reset_service_principal_profile( self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterServicePrincipalProfile, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], **kwargs: Any ) -> LROPoller[None]: """Reset the Service Principal Profile of a managed cluster. This action cannot be performed on a cluster that is not using a service principal. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The service principal profile to set on the managed cluster. + :param parameters: The service principal profile to set on the managed cluster. Is either a + model type or a IO type. Required. :type parameters: ~azure.mgmt.containerservice.v2021_11_01_preview.models.ManagedClusterServicePrincipalProfile + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1973,20 +2066,17 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1994,67 +2084,68 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_service_principal_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + begin_reset_service_principal_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterAADProfile, + parameters: Union[_models.ManagedClusterAADProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterAADProfile") - request = build_reset_aad_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_aad_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_aad_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_aad_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2062,10 +2153,9 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -2075,28 +2165,104 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement if cls: return cls(pipeline_response, None, {}) - _reset_aad_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + _reset_aad_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - - @distributed_trace - def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements + @overload + def begin_reset_aad_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterAADProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: """Reset the AAD Profile of a managed cluster. Reset the AAD Profile of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The AAD profile to set on the Managed Cluster. + :param parameters: The AAD profile to set on the Managed Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2021_11_01_preview.models.ManagedClusterAADProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reset the AAD Profile of a managed cluster. + + Reset the AAD Profile of a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The AAD profile to set on the Managed Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterAADProfile, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Reset the AAD Profile of a managed cluster. + + Reset the AAD Profile of a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The AAD profile to set on the Managed Cluster. Is either a model type or a + IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2021_11_01_preview.models.ManagedClusterAADProfile or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -2107,20 +2273,17 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -2128,62 +2291,52 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_aad_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + begin_reset_aad_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_rotate_cluster_certificates_request_initial( - subscription_id=self._config.subscription_id, + request = build_rotate_cluster_certificates_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._rotate_cluster_certificates_initial.metadata['url'], + template_url=self._rotate_cluster_certificates_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2191,10 +2344,9 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -2204,24 +2356,20 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return if cls: return cls(pipeline_response, None, {}) - _rotate_cluster_certificates_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore - + _rotate_cluster_certificates_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore @distributed_trace - def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + def begin_rotate_cluster_certificates( + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> LROPoller[None]: """Rotates the certificates of a managed cluster. See `Certificate rotation `_ for more details about rotating managed cluster certificates. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -2233,80 +2381,67 @@ def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-st Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._rotate_cluster_certificates_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_rotate_cluster_certificates.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore + begin_rotate_cluster_certificates.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore def _stop_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_stop_request_initial( - subscription_id=self._config.subscription_id, + request = build_stop_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._stop_initial.metadata['url'], + template_url=self._stop_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2314,10 +2449,9 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -2327,16 +2461,10 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore - + _stop_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore @distributed_trace - def begin_stop( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> LROPoller[None]: + def begin_stop(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> LROPoller[None]: """Stops a Managed Cluster. This can only be performed on Azure Virtual Machine Scale set backed clusters. Stopping a @@ -2345,9 +2473,9 @@ def begin_stop( # pylint: disable=inconsistent-return-statements `_ for more details about stopping a cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -2359,80 +2487,67 @@ def begin_stop( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._stop_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore + begin_stop.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore def _start_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_start_request_initial( - subscription_id=self._config.subscription_id, + request = build_start_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._start_initial.metadata['url'], + template_url=self._start_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2440,10 +2555,9 @@ def _start_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -2453,24 +2567,18 @@ def _start_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore - + _start_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore @distributed_trace - def begin_start( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> LROPoller[None]: + def begin_start(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> LROPoller[None]: """Starts a previously stopped Managed Cluster. See `starting a cluster `_ for more details about starting a cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -2482,85 +2590,83 @@ def begin_start( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._start_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore + begin_start.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore def _run_command_initial( self, resource_group_name: str, resource_name: str, - request_payload: _models.RunCommandRequest, + request_payload: Union[_models.RunCommandRequest, IO], **kwargs: Any ) -> Optional[_models.RunCommandResult]: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RunCommandResult]] - _json = self._serialize.body(request_payload, 'RunCommandRequest') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(request_payload, (IO, bytes)): + _content = request_payload + else: + _json = self._serialize.body(request_payload, "RunCommandRequest") - request = build_run_command_request_initial( - subscription_id=self._config.subscription_id, + request = build_run_command_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._run_command_initial.metadata['url'], + content=_content, + template_url=self._run_command_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2568,10 +2674,9 @@ def _run_command_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -2580,22 +2685,23 @@ def _run_command_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _run_command_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore - + _run_command_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore - @distributed_trace + @overload def begin_run_command( self, resource_group_name: str, resource_name: str, request_payload: _models.RunCommandRequest, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.RunCommandResult]: """Submits a command to run against the Managed Cluster. @@ -2604,13 +2710,56 @@ def begin_run_command( more information see `AKS Run Command `_. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param request_payload: The run command request. + :param request_payload: The run command request. Required. :type request_payload: ~azure.mgmt.containerservice.v2021_11_01_preview.models.RunCommandRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either RunCommandResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_11_01_preview.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_run_command( + self, + resource_group_name: str, + resource_name: str, + request_payload: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RunCommandResult]: + """Submits a command to run against the Managed Cluster. + + AKS will create a pod to run the command. This is primarily useful for private clusters. For + more information see `AKS Run Command + `_. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param request_payload: The run command request. Required. + :type request_payload: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -2623,20 +2772,56 @@ def begin_run_command( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_11_01_preview.models.RunCommandResult] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_run_command( + self, + resource_group_name: str, + resource_name: str, + request_payload: Union[_models.RunCommandRequest, IO], + **kwargs: Any + ) -> LROPoller[_models.RunCommandResult]: + """Submits a command to run against the Managed Cluster. + + AKS will create a pod to run the command. This is primarily useful for private clusters. For + more information see `AKS Run Command + `_. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param request_payload: The run command request. Is either a model type or a IO type. Required. + :type request_payload: + ~azure.mgmt.containerservice.v2021_11_01_preview.models.RunCommandRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either RunCommandResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_11_01_preview.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.RunCommandResult] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.RunCommandResult] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._run_command_initial( # type: ignore resource_group_name=resource_group_name, @@ -2644,82 +2829,71 @@ def begin_run_command( request_payload=request_payload, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_run_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore + begin_run_command.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore @distributed_trace def get_command_result( - self, - resource_group_name: str, - resource_name: str, - command_id: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, command_id: str, **kwargs: Any ) -> Optional[_models.RunCommandResult]: """Gets the results of a command which has been run on the Managed Cluster. Gets the results of a command which has been run on the Managed Cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param command_id: Id of the command. + :param command_id: Id of the command. Required. :type command_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: RunCommandResult, or the result of cls(response) + :return: RunCommandResult or None or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.RunCommandResult or None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RunCommandResult]] - request = build_get_command_result_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, command_id=command_id, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_command_result.metadata['url'], + template_url=self.get_command_result.metadata["url"], headers=_headers, params=_params, ) @@ -2727,10 +2901,9 @@ def get_command_result( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -2739,59 +2912,54 @@ def get_command_result( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_command_result.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}"} # type: ignore - + get_command_result.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}"} # type: ignore @distributed_trace def list_outbound_network_dependencies_endpoints( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> Iterable[_models.OutboundEnvironmentEndpointCollection]: + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> Iterable["_models.OutboundEnvironmentEndpoint"]: """Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster. Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster. The operation returns properties of each egress endpoint. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OutboundEnvironmentEndpointCollection or the - result of cls(response) + :return: An iterator like instance of either OutboundEnvironmentEndpoint or the result of + cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_11_01_preview.models.OutboundEnvironmentEndpointCollection] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_11_01_preview.models.OutboundEnvironmentEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_outbound_network_dependencies_endpoints_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_outbound_network_dependencies_endpoints.metadata['url'], + template_url=self.list_outbound_network_dependencies_endpoints.metadata["url"], headers=_headers, params=_params, ) @@ -2799,16 +2967,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_outbound_network_dependencies_endpoints_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -2824,10 +2987,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2837,8 +2998,6 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_outbound_network_dependencies_endpoints.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints"} # type: ignore + list_outbound_network_dependencies_endpoints.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/operations/_operations.py index 03d779d1927e..86e2d8f78430 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/operations/_operations.py @@ -7,10 +7,15 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,38 +25,34 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - **kwargs: Any -) -> HttpRequest: + +def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.ContainerService/operations") # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class Operations: """ @@ -72,38 +73,33 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.OperationListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.OperationValue"]: """Gets a list of operations. Gets a list of operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationListResult or the result of cls(response) + :return: An iterator like instance of either OperationValue or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_11_01_preview.models.OperationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_11_01_preview.models.OperationValue] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -111,13 +107,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -133,10 +127,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -146,8 +138,6 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.ContainerService/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ContainerService/operations"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/operations/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/operations/_private_endpoint_connections_operations.py index 73b704530092..8a829a7dd736 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/operations/_private_endpoint_connections_operations.py @@ -6,11 +6,15 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod @@ -21,173 +25,191 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - subscription_id: str, resource_group_name: str, resource_name: str, private_endpoint_connection_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 = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_update_request( - subscription_id: str, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, - *, - json: Optional[_models.PrivateEndpointConnection] = None, - content: Any = None, + subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request_initial( - subscription_id: str, +def build_delete_request( resource_group_name: str, resource_name: str, private_endpoint_connection_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 = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class PrivateEndpointConnectionsOperations: """ @@ -208,47 +230,40 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnectionListResult: """Gets a list of private endpoint connections in the specified managed cluster. To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnectionListResult, or the result of cls(response) + :return: PrivateEndpointConnectionListResult or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.PrivateEndpointConnectionListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnectionListResult] - request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -256,69 +271,60 @@ def list( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore - + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore @distributed_trace def get( - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnection: """Gets the specified private endpoint connection. To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -326,76 +332,148 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - @distributed_trace + @overload def update( self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, parameters: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateEndpointConnection: """Updates a private endpoint connection. Updates a private endpoint connection. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str - :param parameters: The updated private endpoint connection. + :param parameters: The updated private endpoint connection. Required. :type parameters: ~azure.mgmt.containerservice.v2021_11_01_preview.models.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: The updated private endpoint connection. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: Union[_models.PrivateEndpointConnection, IO], + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: The updated private endpoint connection. Is either a model type or a IO + type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2021_11_01_preview.models.PrivateEndpointConnection or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - _json = self._serialize.body(parameters, 'PrivateEndpointConnection') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateEndpointConnection") request = build_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update.metadata['url'], + content=_content, + template_url=self.update.metadata["url"], headers=_headers, params=_params, ) @@ -403,52 +481,43 @@ def update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -456,10 +525,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -469,26 +537,21 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + def begin_delete( + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> LROPoller[None]: """Deletes a private endpoint connection. Deletes a private endpoint connection. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -500,53 +563,46 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/operations/_private_link_resources_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/operations/_private_link_resources_operations.py index 0a3882908953..ea4148e1d926 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/operations/_private_link_resources_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/operations/_private_link_resources_operations.py @@ -8,9 +8,13 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -19,48 +23,53 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class PrivateLinkResourcesOperations: """ @@ -81,46 +90,39 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.PrivateLinkResourcesListResult: """Gets a list of private link resources in the specified managed cluster. To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResourcesListResult, or the result of cls(response) + :return: PrivateLinkResourcesListResult or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.PrivateLinkResourcesListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResourcesListResult] - request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -128,22 +130,20 @@ def list( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResourcesListResult', pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources"} # type: ignore - + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/operations/_resolve_private_link_service_id_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/operations/_resolve_private_link_service_id_operations.py index 0c61f5553650..2763aaaf4d81 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/operations/_resolve_private_link_service_id_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/operations/_resolve_private_link_service_id_operations.py @@ -6,11 +6,15 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -19,56 +23,56 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_post_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.PrivateLinkResource] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + class ResolvePrivateLinkServiceIdOperations: """ @@ -89,52 +93,119 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @overload + def post( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.PrivateLinkResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID for the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters required in order to resolve a private link service ID. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_11_01_preview.models.PrivateLinkResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def post( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID for the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters required in order to resolve a private link service ID. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def post( self, resource_group_name: str, resource_name: str, - parameters: _models.PrivateLinkResource, + parameters: Union[_models.PrivateLinkResource, IO], **kwargs: Any ) -> _models.PrivateLinkResource: """Gets the private link service ID for the specified managed cluster. Gets the private link service ID for the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters required in order to resolve a private link service ID. + :param parameters: Parameters required in order to resolve a private link service ID. Is either + a model type or a IO type. Required. :type parameters: ~azure.mgmt.containerservice.v2021_11_01_preview.models.PrivateLinkResource + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResource, or the result of cls(response) + :return: PrivateLinkResource or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.PrivateLinkResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResource] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResource] - _json = self._serialize.body(parameters, 'PrivateLinkResource') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateLinkResource") request = build_post_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.post.metadata['url'], + content=_content, + template_url=self.post.metadata["url"], headers=_headers, params=_params, ) @@ -142,22 +213,20 @@ def post( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResource', pipeline_response) + deserialized = self._deserialize("PrivateLinkResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - post.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId"} # type: ignore - + post.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/operations/_snapshots_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/operations/_snapshots_operations.py index 0f88e9a37407..a641666dd7d4 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/operations/_snapshots_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/operations/_snapshots_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,243 +25,223 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots") path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_resource_group_request( - subscription_id: str, - resource_group_name: str, - **kwargs: Any -) -> HttpRequest: +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots", + ) # 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', min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: + _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, resource_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.Snapshot] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_update_tags_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.TagsObject] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class SnapshotsOperations: """ @@ -277,39 +262,34 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.SnapshotListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.Snapshot"]: """Gets a list of snapshots in the specified subscription. Gets a list of snapshots in the specified subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SnapshotListResult or the result of cls(response) + :return: An iterator like instance of either Snapshot or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_11_01_preview.models.SnapshotListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_11_01_preview.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SnapshotListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -317,14 +297,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -340,10 +317,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -353,48 +328,41 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots"} # type: ignore @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> Iterable[_models.SnapshotListResult]: + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Snapshot"]: """Lists snapshots in the specified subscription and resource group. Lists snapshots in the specified subscription and resource group. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SnapshotListResult or the result of cls(response) + :return: An iterator like instance of either Snapshot or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_11_01_preview.models.SnapshotListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_11_01_preview.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SnapshotListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -402,15 +370,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -426,10 +390,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -439,50 +401,40 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots"} # type: ignore @distributed_trace - def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.Snapshot: + def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.Snapshot: """Gets a snapshot. Gets a snapshot. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Snapshot, or the result of cls(response) + :return: Snapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.Snapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -490,71 +442,132 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - @distributed_trace + @overload def create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.Snapshot, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.Snapshot: """Creates or updates a snapshot. Creates or updates a snapshot. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The snapshot to create or update. + :param parameters: The snapshot to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2021_11_01_preview.models.Snapshot + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Snapshot, or the result of cls(response) + :return: Snapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.Snapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Snapshot: + """Creates or updates a snapshot. + + Creates or updates a snapshot. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The snapshot to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.Snapshot, IO], **kwargs: Any + ) -> _models.Snapshot: + """Creates or updates a snapshot. + + Creates or updates a snapshot. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The snapshot to create or update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.mgmt.containerservice.v2021_11_01_preview.models.Snapshot or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] - _json = self._serialize.body(parameters, 'Snapshot') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "Snapshot") request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) @@ -562,10 +575,9 @@ def create_or_update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -573,64 +585,126 @@ def create_or_update( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - - @distributed_trace + @overload def update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.Snapshot: """Updates tags on a snapshot. Updates tags on a snapshot. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update snapshot Tags operation. + :param parameters: Parameters supplied to the Update snapshot Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2021_11_01_preview.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Snapshot, or the result of cls(response) + :return: Snapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.Snapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + def update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Snapshot: + """Updates tags on a snapshot. + + Updates tags on a snapshot. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update snapshot Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> _models.Snapshot: + """Updates tags on a snapshot. + + Updates tags on a snapshot. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update snapshot Tags operation. Is either a model + type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2021_11_01_preview.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") request = build_update_tags_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_tags.metadata['url'], + content=_content, + template_url=self.update_tags.metadata["url"], headers=_headers, params=_params, ) @@ -638,64 +712,56 @@ def update_tags( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - + update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore @distributed_trace def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: """Deletes a snapshot. Deletes a snapshot. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) @@ -703,10 +769,9 @@ def delete( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -716,5 +781,4 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - + delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/__init__.py index 37a5f9e02e6f..a8716d29afe8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/__init__.py @@ -14,7 +14,8 @@ except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['ContainerServiceClient'] + +__all__ = ["ContainerServiceClient"] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/_configuration.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/_configuration.py index 51d5296bfd70..c5699e37e14b 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/_configuration.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/_configuration.py @@ -18,30 +18,26 @@ VERSION = "unknown" + class ContainerServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ContainerServiceClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2022-01-01". 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: + def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ContainerServiceClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + api_version = kwargs.pop("api_version", "2022-01-01") # type: str if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -51,23 +47,24 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-containerservice/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-containerservice/{}".format(VERSION)) self._configure(**kwargs) def _configure( - self, - **kwargs # type: Any + self, **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/_container_service_client.py index 8be30540f524..981af364b54a 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/_container_service_client.py @@ -9,20 +9,29 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from . import models +from .._serialization import Deserializer, Serializer from ._configuration import ContainerServiceClientConfiguration -from .operations import AgentPoolsOperations, MaintenanceConfigurationsOperations, ManagedClustersOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, ResolvePrivateLinkServiceIdOperations, SnapshotsOperations +from .operations import ( + AgentPoolsOperations, + MaintenanceConfigurationsOperations, + ManagedClustersOperations, + Operations, + PrivateEndpointConnectionsOperations, + PrivateLinkResourcesOperations, + ResolvePrivateLinkServiceIdOperations, + SnapshotsOperations, +) if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class ContainerServiceClient: # pylint: disable=too-many-instance-attributes + +class ContainerServiceClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """The Container Service Client. :ivar operations: Operations operations @@ -46,10 +55,10 @@ class ContainerServiceClient: # pylint: disable=too-many-instance-attributes azure.mgmt.containerservice.v2022_01_01.operations.ResolvePrivateLinkServiceIdOperations :ivar snapshots: SnapshotsOperations operations :vartype snapshots: azure.mgmt.containerservice.v2022_01_01.operations.SnapshotsOperations - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -67,25 +76,23 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = ContainerServiceClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = ContainerServiceClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize - ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.managed_clusters = ManagedClustersOperations( self._client, self._config, self._serialize, self._deserialize ) self.maintenance_configurations = MaintenanceConfigurationsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.agent_pools = AgentPoolsOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) self.private_endpoint_connections = PrivateEndpointConnectionsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -95,16 +102,9 @@ def __init__( self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations( self._client, self._config, self._serialize, self._deserialize ) - self.snapshots = SnapshotsOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.snapshots = SnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) - - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> HttpResponse: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -113,7 +113,7 @@ def _send_request( >>> response = client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/_metadata.json b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/_metadata.json index 2e3b6cf8ba78..1deceba0987e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/_metadata.json +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/_metadata.json @@ -10,20 +10,20 @@ "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { "credential": { - "signature": "credential, # type: \"TokenCredential\"", - "description": "Credential needed for the client to connect to Azure.", + "signature": "credential: \"TokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true }, "subscription_id": { - "signature": "subscription_id, # type: str", - "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "signature": "subscription_id: str,", + "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.", "docstring_type": "str", "required": true } @@ -31,13 +31,13 @@ "async": { "credential": { "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure.", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { "signature": "subscription_id: str,", - "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.", "docstring_type": "str", "required": true } @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=\"https://management.azure.com\", # type: str", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/_patch.py index 74e48ecd07cf..f99e77fef986 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/_patch.py @@ -28,4 +28,4 @@ # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + pass diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/_vendor.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/_vendor.py index 138f663c53a4..9aad73fc743e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/_vendor.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/_vendor.py @@ -7,6 +7,7 @@ from azure.core.pipeline.transport import HttpRequest + def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) @@ -14,6 +15,7 @@ def _convert_request(request, files=None): request.set_formdata_body(files) return request + def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -21,7 +23,5 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [ - c for c in formatted_components if "{}".format(key.args[0]) not in c - ] + components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/__init__.py index 37a5f9e02e6f..a8716d29afe8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/__init__.py @@ -14,7 +14,8 @@ except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['ContainerServiceClient'] + +__all__ = ["ContainerServiceClient"] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/_configuration.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/_configuration.py index 96674eec8a47..24607a602205 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/_configuration.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/_configuration.py @@ -18,30 +18,26 @@ VERSION = "unknown" + class ContainerServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ContainerServiceClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2022-01-01". 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: + def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ContainerServiceClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + api_version = kwargs.pop("api_version", "2022-01-01") # type: str if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -51,22 +47,21 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-containerservice/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-containerservice/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, - **kwargs: Any - ) -> None: - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/_container_service_client.py index 1e9776871620..1fd93de1da24 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/_container_service_client.py @@ -9,20 +9,29 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from .. import models +from ..._serialization import Deserializer, Serializer from ._configuration import ContainerServiceClientConfiguration -from .operations import AgentPoolsOperations, MaintenanceConfigurationsOperations, ManagedClustersOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, ResolvePrivateLinkServiceIdOperations, SnapshotsOperations +from .operations import ( + AgentPoolsOperations, + MaintenanceConfigurationsOperations, + ManagedClustersOperations, + Operations, + PrivateEndpointConnectionsOperations, + PrivateLinkResourcesOperations, + ResolvePrivateLinkServiceIdOperations, + SnapshotsOperations, +) if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class ContainerServiceClient: # pylint: disable=too-many-instance-attributes + +class ContainerServiceClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """The Container Service Client. :ivar operations: Operations operations @@ -47,10 +56,10 @@ class ContainerServiceClient: # pylint: disable=too-many-instance-attributes azure.mgmt.containerservice.v2022_01_01.aio.operations.ResolvePrivateLinkServiceIdOperations :ivar snapshots: SnapshotsOperations operations :vartype snapshots: azure.mgmt.containerservice.v2022_01_01.aio.operations.SnapshotsOperations - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -68,25 +77,23 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = ContainerServiceClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = ContainerServiceClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize - ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.managed_clusters = ManagedClustersOperations( self._client, self._config, self._serialize, self._deserialize ) self.maintenance_configurations = MaintenanceConfigurationsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.agent_pools = AgentPoolsOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) self.private_endpoint_connections = PrivateEndpointConnectionsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -96,16 +103,9 @@ def __init__( self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations( self._client, self._config, self._serialize, self._deserialize ) - self.snapshots = SnapshotsOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.snapshots = SnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) - - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -114,7 +114,7 @@ def _send_request( >>> response = await client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/_patch.py index 74e48ecd07cf..f99e77fef986 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/_patch.py @@ -28,4 +28,4 @@ # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + pass diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/operations/__init__.py index e0748876288c..593b23075ce0 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/operations/__init__.py @@ -18,15 +18,16 @@ from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'Operations', - 'ManagedClustersOperations', - 'MaintenanceConfigurationsOperations', - 'AgentPoolsOperations', - 'PrivateEndpointConnectionsOperations', - 'PrivateLinkResourcesOperations', - 'ResolvePrivateLinkServiceIdOperations', - 'SnapshotsOperations', + "Operations", + "ManagedClustersOperations", + "MaintenanceConfigurationsOperations", + "AgentPoolsOperations", + "PrivateEndpointConnectionsOperations", + "PrivateLinkResourcesOperations", + "ResolvePrivateLinkServiceIdOperations", + "SnapshotsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/operations/_agent_pools_operations.py index e03f43a21963..db50872d6b86 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/operations/_agent_pools_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +29,20 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._agent_pools_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_available_agent_pool_versions_request, build_get_request, build_get_upgrade_profile_request, build_list_request, build_upgrade_node_image_version_request_initial -T = TypeVar('T') +from ...operations._agent_pools_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_available_agent_pool_versions_request, + build_get_request, + build_get_upgrade_profile_request, + build_list_request, + build_upgrade_node_image_version_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class AgentPoolsOperations: """ .. warning:: @@ -45,47 +62,40 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.AgentPoolListResult]: + def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncIterable["_models.AgentPool"]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AgentPoolListResult or the result of cls(response) + :return: An iterator like instance of either AgentPool or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_01_01.models.AgentPoolListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_01_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -93,16 +103,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -118,10 +123,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -131,54 +134,45 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore @distributed_trace_async async def get( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPool: """Gets the specified managed cluster agent pool. Gets the specified managed cluster agent pool. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPool, or the result of cls(response) + :return: AgentPool or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.AgentPool - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -186,57 +180,60 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore async def _create_or_update_initial( self, resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: _models.AgentPool, + parameters: Union[_models.AgentPool, IO], **kwargs: Any ) -> _models.AgentPool: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - _json = self._serialize.body(parameters, 'AgentPool') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "AgentPool") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -244,10 +241,9 @@ async def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -255,40 +251,44 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - - @distributed_trace_async + @overload async def begin_create_or_update( self, resource_group_name: str, resource_name: str, agent_pool_name: str, parameters: _models.AgentPool, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.AgentPool]: """Creates or updates an agent pool in the specified managed cluster. Creates or updates an agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str - :param parameters: The agent pool to create or update. + :param parameters: The agent pool to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_01_01.models.AgentPool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -301,20 +301,98 @@ async def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_01_01.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AgentPool]: + """Creates or updates an agent pool in the specified managed cluster. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: The agent pool to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AgentPool or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_01_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: Union[_models.AgentPool, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.AgentPool]: + """Creates or updates an agent pool in the specified managed cluster. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: The agent pool to create or update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.mgmt.containerservice.v2022_01_01.models.AgentPool or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AgentPool or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_01_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -323,66 +401,55 @@ async def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -390,10 +457,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -403,26 +469,21 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + async def begin_delete( + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes an agent pool in the specified managed cluster. Deletes an agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -434,99 +495,85 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace_async async def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPoolUpgradeProfile: """Gets the upgrade profile for an agent pool. Gets the upgrade profile for an agent pool. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolUpgradeProfile, or the result of cls(response) + :return: AgentPoolUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.AgentPoolUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -534,32 +581,27 @@ async def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolUpgradeProfile', pipeline_response) + deserialized = self._deserialize("AgentPoolUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore @distributed_trace_async async def get_available_agent_pool_versions( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported Kubernetes versions for the specified agent pool. @@ -567,33 +609,30 @@ async def get_available_agent_pool_versions( `_ for more details about the version lifecycle. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolAvailableVersions, or the result of cls(response) + :return: AgentPoolAvailableVersions or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.AgentPoolAvailableVersions - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolAvailableVersions] - request = build_get_available_agent_pool_versions_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_available_agent_pool_versions.metadata['url'], + template_url=self.get_available_agent_pool_versions.metadata["url"], headers=_headers, params=_params, ) @@ -601,52 +640,43 @@ async def get_available_agent_pool_versions( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolAvailableVersions', pipeline_response) + deserialized = self._deserialize("AgentPoolAvailableVersions", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_available_agent_pool_versions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore - + get_available_agent_pool_versions.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore async def _upgrade_node_image_version_initial( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> Optional[_models.AgentPool]: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.AgentPool]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.AgentPool]] - - request = build_upgrade_node_image_version_request_initial( - subscription_id=self._config.subscription_id, + request = build_upgrade_node_image_version_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._upgrade_node_image_version_initial.metadata['url'], + template_url=self._upgrade_node_image_version_initial.metadata["url"], headers=_headers, params=_params, ) @@ -654,10 +684,9 @@ async def _upgrade_node_image_version_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -667,37 +696,34 @@ async def _upgrade_node_image_version_initial( deserialized = None response_headers = {} if response.status_code == 202: - response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) - - deserialized = self._deserialize('AgentPool', pipeline_response) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _upgrade_node_image_version_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore - + _upgrade_node_image_version_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore @distributed_trace_async async def begin_upgrade_node_image_version( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any - ) -> AsyncLROPoller[_models.AgentPool]: + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: """Upgrades the node image version of an agent pool to the latest. Upgrading the node image version of an agent pool applies the newest OS and runtime updates to the nodes. AKS provides one new image per week with the latest updates. For more details on node image versions, see: https://docs.microsoft.com/azure/aks/node-image-upgrade. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -711,59 +737,54 @@ async def begin_upgrade_node_image_version( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_01_01.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._upgrade_node_image_version_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) - - deserialized = self._deserialize('AgentPool', pipeline_response) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_upgrade_node_image_version.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore + begin_upgrade_node_image_version.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/operations/_maintenance_configurations_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/operations/_maintenance_configurations_operations.py index 6fc3f0ac9cc2..6332978e01e8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/operations/_maintenance_configurations_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/operations/_maintenance_configurations_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,10 +27,17 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._maintenance_configurations_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_managed_cluster_request -T = TypeVar('T') +from ...operations._maintenance_configurations_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_managed_cluster_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class MaintenanceConfigurationsOperations: """ .. warning:: @@ -43,48 +57,43 @@ def __init__(self, *args, **kwargs) -> None: 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_managed_cluster( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.MaintenanceConfigurationListResult]: + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> AsyncIterable["_models.MaintenanceConfiguration"]: """Gets a list of maintenance configurations in the specified managed cluster. Gets a list of maintenance configurations in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either MaintenanceConfigurationListResult or the result - of cls(response) + :return: An iterator like instance of either MaintenanceConfiguration or the result of + cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_01_01.models.MaintenanceConfigurationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_01_01.models.MaintenanceConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfigurationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfigurationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_managed_cluster_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_managed_cluster.metadata['url'], + template_url=self.list_by_managed_cluster.metadata["url"], headers=_headers, params=_params, ) @@ -92,16 +101,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_managed_cluster_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -117,10 +121,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -130,54 +132,45 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_managed_cluster.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations"} # type: ignore + list_by_managed_cluster.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations"} # type: ignore @distributed_trace_async async def get( - self, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, config_name: str, **kwargs: Any ) -> _models.MaintenanceConfiguration: """Gets the specified maintenance configuration of a managed cluster. Gets the specified maintenance configuration of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: MaintenanceConfiguration, or the result of cls(response) + :return: MaintenanceConfiguration or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.MaintenanceConfiguration - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfiguration] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -185,75 +178,147 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) + deserialized = self._deserialize("MaintenanceConfiguration", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - @distributed_trace_async + @overload async def create_or_update( self, resource_group_name: str, resource_name: str, config_name: str, parameters: _models.MaintenanceConfiguration, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.MaintenanceConfiguration: """Creates or updates a maintenance configuration in the specified managed cluster. Creates or updates a maintenance configuration in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str - :param parameters: The maintenance configuration to create or update. + :param parameters: The maintenance configuration to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_01_01.models.MaintenanceConfiguration + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: MaintenanceConfiguration, or the result of cls(response) + :return: MaintenanceConfiguration or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.MaintenanceConfiguration - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configuration in the specified managed cluster. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: The maintenance configuration to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: Union[_models.MaintenanceConfiguration, IO], + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configuration in the specified managed cluster. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: The maintenance configuration to create or update. Is either a model type or + a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_01_01.models.MaintenanceConfiguration or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfiguration] - _json = self._serialize.body(parameters, 'MaintenanceConfiguration') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "MaintenanceConfiguration") request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) @@ -261,68 +326,59 @@ async def create_or_update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) + deserialized = self._deserialize("MaintenanceConfiguration", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, config_name: str, **kwargs: Any ) -> None: """Deletes a maintenance configuration. Deletes a maintenance configuration. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) @@ -330,10 +386,9 @@ async def delete( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -343,5 +398,4 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/operations/_managed_clusters_operations.py index 822051dbf7ba..304a01041f61 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/operations/_managed_clusters_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +29,33 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._managed_clusters_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_access_profile_request, build_get_command_result_request, build_get_os_options_request, build_get_request, build_get_upgrade_profile_request, build_list_by_resource_group_request, build_list_cluster_admin_credentials_request, build_list_cluster_monitoring_user_credentials_request, build_list_cluster_user_credentials_request, build_list_outbound_network_dependencies_endpoints_request, build_list_request, build_reset_aad_profile_request_initial, build_reset_service_principal_profile_request_initial, build_rotate_cluster_certificates_request_initial, build_run_command_request_initial, build_start_request_initial, build_stop_request_initial, build_update_tags_request_initial -T = TypeVar('T') +from ...operations._managed_clusters_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_access_profile_request, + build_get_command_result_request, + build_get_os_options_request, + build_get_request, + build_get_upgrade_profile_request, + build_list_by_resource_group_request, + build_list_cluster_admin_credentials_request, + build_list_cluster_monitoring_user_credentials_request, + build_list_cluster_user_credentials_request, + build_list_outbound_network_dependencies_endpoints_request, + build_list_request, + build_reset_aad_profile_request, + build_reset_service_principal_profile_request, + build_rotate_cluster_certificates_request, + build_run_command_request, + build_start_request, + build_stop_request, + build_update_tags_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class ManagedClustersOperations: # pylint: disable=too-many-public-methods """ .. warning:: @@ -45,46 +75,39 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async async def get_os_options( - self, - location: str, - resource_type: Optional[str] = None, - **kwargs: Any + self, location: str, resource_type: Optional[str] = None, **kwargs: Any ) -> _models.OSOptionProfile: """Gets supported OS options in the specified subscription. Gets supported OS options in the specified subscription. - :param location: The name of a supported Azure region. + :param location: The name of a supported Azure region. Required. :type location: str :param resource_type: The resource type for which the OS options needs to be returned. Default value is None. :type resource_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: OSOptionProfile, or the result of cls(response) + :return: OSOptionProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.OSOptionProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OSOptionProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OSOptionProfile] - request = build_get_os_options_request( - subscription_id=self._config.subscription_id, location=location, - api_version=api_version, + subscription_id=self._config.subscription_id, resource_type=resource_type, - template_url=self.get_os_options.metadata['url'], + api_version=api_version, + template_url=self.get_os_options.metadata["url"], headers=_headers, params=_params, ) @@ -92,59 +115,52 @@ async def get_os_options( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('OSOptionProfile', pipeline_response) + deserialized = self._deserialize("OSOptionProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_os_options.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default"} # type: ignore - + get_os_options.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default"} # type: ignore @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.ManagedClusterListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.ManagedCluster"]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_01_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_01_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -152,14 +168,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -175,10 +188,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -188,49 +199,43 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.ManagedClusterListResult]: + self, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ManagedCluster"]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_01_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_01_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -238,15 +243,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -262,10 +263,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -275,50 +274,42 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace_async async def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.ManagedClusterUpgradeProfile: """Gets the upgrade profile of a managed cluster. Gets the upgrade profile of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterUpgradeProfile, or the result of cls(response) + :return: ManagedClusterUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.ManagedClusterUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -326,33 +317,27 @@ async def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterUpgradeProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore @distributed_trace_async async def get_access_profile( - self, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, role_name: str, **kwargs: Any ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. @@ -361,36 +346,33 @@ async def get_access_profile( `ListClusterAdminCredentials `_ . - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param role_name: The name of the role for managed cluster accessProfile resource. + :param role_name: The name of the role for managed cluster accessProfile resource. Required. :type role_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterAccessProfile, or the result of cls(response) + :return: ManagedClusterAccessProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.ManagedClusterAccessProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterAccessProfile] - request = build_get_access_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, role_name=role_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_access_profile.metadata['url'], + template_url=self.get_access_profile.metadata["url"], headers=_headers, params=_params, ) @@ -398,68 +380,59 @@ async def get_access_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterAccessProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterAccessProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_access_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore - + get_access_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore @distributed_trace_async async def list_cluster_admin_credentials( - self, - resource_group_name: str, - resource_name: str, - server_fqdn: Optional[str] = None, - **kwargs: Any + self, resource_group_name: str, resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any ) -> _models.CredentialResults: """Lists the admin credentials of a managed cluster. Lists the admin credentials of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_admin_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, - template_url=self.list_cluster_admin_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_admin_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -467,25 +440,23 @@ async def list_cluster_admin_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_admin_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore - + list_cluster_admin_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore @distributed_trace_async async def list_cluster_user_credentials( @@ -500,41 +471,39 @@ async def list_cluster_user_credentials( Lists the user credentials of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :param format: Only apply to AAD clusters, specifies the format of returned kubeconfig. Format 'azure' will return azure auth-provider kubeconfig; format 'exec' will return exec format - kubeconfig, which requires kubelogin binary in the path. Default value is None. + kubeconfig, which requires kubelogin binary in the path. Known values are: "azure" and "exec". + Default value is None. :type format: str or ~azure.mgmt.containerservice.v2022_01_01.models.Format :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, format=format, - template_url=self.list_cluster_user_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -542,68 +511,59 @@ async def list_cluster_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore - + list_cluster_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore @distributed_trace_async async def list_cluster_monitoring_user_credentials( - self, - resource_group_name: str, - resource_name: str, - server_fqdn: Optional[str] = None, - **kwargs: Any + self, resource_group_name: str, resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any ) -> _models.CredentialResults: """Lists the cluster monitoring user credentials of a managed cluster. Lists the cluster monitoring user credentials of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_monitoring_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, - template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_monitoring_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -611,64 +571,54 @@ async def list_cluster_monitoring_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_monitoring_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore - + list_cluster_monitoring_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore @distributed_trace_async - async def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.ManagedCluster: + async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.ManagedCluster: """Gets a managed cluster. Gets a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedCluster, or the result of cls(response) + :return: ManagedCluster or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.ManagedCluster - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -676,55 +626,54 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _create_or_update_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.ManagedCluster, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'ManagedCluster') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedCluster") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -732,10 +681,9 @@ async def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -743,37 +691,79 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - - @distributed_trace_async + @overload async def begin_create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedCluster, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. Creates or updates a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The managed cluster to create or update. + :param parameters: The managed cluster to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_01_01.models.ManagedCluster + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_01_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -786,20 +776,50 @@ async def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_01_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster to create or update. Is either a model type or a IO + type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_01_01.models.ManagedCluster or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_01_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -807,69 +827,66 @@ async def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _update_tags_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.TagsObject, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request_initial( - subscription_id=self._config.subscription_id, + request = build_update_tags_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_tags_initial.metadata['url'], + content=_content, + template_url=self._update_tags_initial.metadata["url"], headers=_headers, params=_params, ) @@ -877,44 +894,47 @@ async def _update_tags_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_tags_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _update_tags_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - @distributed_trace_async + @overload async def begin_update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates tags on a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2022_01_01.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -927,20 +947,88 @@ async def begin_update_tags( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_01_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates tags on a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_01_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates tags on a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_01_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_01_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, @@ -948,64 +1036,54 @@ async def begin_update_tags( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1013,10 +1091,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1026,23 +1103,17 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: + async def begin_delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Deletes a managed cluster. Deletes a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1054,85 +1125,83 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterServicePrincipalProfile, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterServicePrincipalProfile") - request = build_reset_service_principal_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_service_principal_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_service_principal_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_service_principal_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1140,10 +1209,9 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1153,28 +1221,104 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist if cls: return cls(pipeline_response, None, {}) - _reset_service_principal_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore - + _reset_service_principal_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore - @distributed_trace_async - async def begin_reset_service_principal_profile( # pylint: disable=inconsistent-return-statements + @overload + async def begin_reset_service_principal_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterServicePrincipalProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: """Reset the Service Principal Profile of a managed cluster. This action cannot be performed on a cluster that is not using a service principal. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The service principal profile to set on the managed cluster. + :param parameters: The service principal profile to set on the managed cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2022_01_01.models.ManagedClusterServicePrincipalProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset the Service Principal Profile of a managed cluster. + + This action cannot be performed on a cluster that is not using a service principal. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The service principal profile to set on the managed cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset the Service Principal Profile of a managed cluster. + + This action cannot be performed on a cluster that is not using a service principal. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The service principal profile to set on the managed cluster. Is either a + model type or a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2022_01_01.models.ManagedClusterServicePrincipalProfile or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -1185,20 +1329,17 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1206,67 +1347,68 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_service_principal_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + begin_reset_service_principal_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterAADProfile, + parameters: Union[_models.ManagedClusterAADProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterAADProfile") - request = build_reset_aad_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_aad_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_aad_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_aad_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1274,10 +1416,9 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1287,27 +1428,31 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta if cls: return cls(pipeline_response, None, {}) - _reset_aad_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - + _reset_aad_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - @distributed_trace_async - async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements + @overload + async def begin_reset_aad_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterAADProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: """Reset the AAD Profile of a managed cluster. Reset the AAD Profile of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The AAD profile to set on the Managed Cluster. + :param parameters: The AAD profile to set on the Managed Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2022_01_01.models.ManagedClusterAADProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -1318,20 +1463,89 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset the AAD Profile of a managed cluster. + + Reset the AAD Profile of a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The AAD profile to set on the Managed Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterAADProfile, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset the AAD Profile of a managed cluster. + + Reset the AAD Profile of a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The AAD profile to set on the Managed Cluster. Is either a model type or a + IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_01_01.models.ManagedClusterAADProfile or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1339,62 +1553,52 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_aad_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + begin_reset_aad_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_rotate_cluster_certificates_request_initial( - subscription_id=self._config.subscription_id, + request = build_rotate_cluster_certificates_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._rotate_cluster_certificates_initial.metadata['url'], + template_url=self._rotate_cluster_certificates_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1402,10 +1606,9 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1415,24 +1618,20 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- if cls: return cls(pipeline_response, None, {}) - _rotate_cluster_certificates_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore - + _rotate_cluster_certificates_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore @distributed_trace_async - async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + async def begin_rotate_cluster_certificates( + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Rotates the certificates of a managed cluster. See `Certificate rotation `_ for more details about rotating managed cluster certificates. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1444,80 +1643,67 @@ async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-ret Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._rotate_cluster_certificates_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_rotate_cluster_certificates.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore + begin_rotate_cluster_certificates.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore async def _stop_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_stop_request_initial( - subscription_id=self._config.subscription_id, + request = build_stop_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._stop_initial.metadata['url'], + template_url=self._stop_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1525,10 +1711,9 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1538,16 +1723,10 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore - + _stop_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore @distributed_trace_async - async def begin_stop( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: + async def begin_stop(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Stops a Managed Cluster. This can only be performed on Azure Virtual Machine Scale set backed clusters. Stopping a @@ -1556,9 +1735,9 @@ async def begin_stop( # pylint: disable=inconsistent-return-statements `_ for more details about stopping a cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1570,80 +1749,67 @@ async def begin_stop( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._stop_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore + begin_stop.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore async def _start_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_start_request_initial( - subscription_id=self._config.subscription_id, + request = build_start_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._start_initial.metadata['url'], + template_url=self._start_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1651,10 +1817,9 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1664,24 +1829,18 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore - + _start_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore @distributed_trace_async - async def begin_start( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: + async def begin_start(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Starts a previously stopped Managed Cluster. See `starting a cluster `_ for more details about starting a cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1693,85 +1852,83 @@ async def begin_start( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._start_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore + begin_start.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore async def _run_command_initial( self, resource_group_name: str, resource_name: str, - request_payload: _models.RunCommandRequest, + request_payload: Union[_models.RunCommandRequest, IO], **kwargs: Any ) -> Optional[_models.RunCommandResult]: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RunCommandResult]] - _json = self._serialize.body(request_payload, 'RunCommandRequest') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(request_payload, (IO, bytes)): + _content = request_payload + else: + _json = self._serialize.body(request_payload, "RunCommandRequest") - request = build_run_command_request_initial( - subscription_id=self._config.subscription_id, + request = build_run_command_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._run_command_initial.metadata['url'], + content=_content, + template_url=self._run_command_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1779,10 +1936,9 @@ async def _run_command_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1791,22 +1947,23 @@ async def _run_command_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _run_command_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore - + _run_command_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore - @distributed_trace_async + @overload async def begin_run_command( self, resource_group_name: str, resource_name: str, request_payload: _models.RunCommandRequest, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.RunCommandResult]: """Submits a command to run against the Managed Cluster. @@ -1815,12 +1972,15 @@ async def begin_run_command( more information see `AKS Run Command `_. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param request_payload: The run command request. + :param request_payload: The run command request. Required. :type request_payload: ~azure.mgmt.containerservice.v2022_01_01.models.RunCommandRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -1833,20 +1993,95 @@ async def begin_run_command( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_01_01.models.RunCommandResult] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_run_command( + self, + resource_group_name: str, + resource_name: str, + request_payload: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.RunCommandResult]: + """Submits a command to run against the Managed Cluster. + + AKS will create a pod to run the command. This is primarily useful for private clusters. For + more information see `AKS Run Command + `_. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param request_payload: The run command request. Required. + :type request_payload: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RunCommandResult or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_01_01.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_run_command( + self, + resource_group_name: str, + resource_name: str, + request_payload: Union[_models.RunCommandRequest, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.RunCommandResult]: + """Submits a command to run against the Managed Cluster. + + AKS will create a pod to run the command. This is primarily useful for private clusters. For + more information see `AKS Run Command + `_. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param request_payload: The run command request. Is either a model type or a IO type. Required. + :type request_payload: ~azure.mgmt.containerservice.v2022_01_01.models.RunCommandRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RunCommandResult or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_01_01.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.RunCommandResult] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.RunCommandResult] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._run_command_initial( # type: ignore resource_group_name=resource_group_name, @@ -1854,82 +2089,71 @@ async def begin_run_command( request_payload=request_payload, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_run_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore + begin_run_command.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore @distributed_trace_async async def get_command_result( - self, - resource_group_name: str, - resource_name: str, - command_id: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, command_id: str, **kwargs: Any ) -> Optional[_models.RunCommandResult]: """Gets the results of a command which has been run on the Managed Cluster. Gets the results of a command which has been run on the Managed Cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param command_id: Id of the command. + :param command_id: Id of the command. Required. :type command_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: RunCommandResult, or the result of cls(response) + :return: RunCommandResult or None or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.RunCommandResult or None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RunCommandResult]] - request = build_get_command_result_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, command_id=command_id, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_command_result.metadata['url'], + template_url=self.get_command_result.metadata["url"], headers=_headers, params=_params, ) @@ -1937,10 +2161,9 @@ async def get_command_result( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1949,59 +2172,54 @@ async def get_command_result( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_command_result.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}"} # type: ignore - + get_command_result.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}"} # type: ignore @distributed_trace def list_outbound_network_dependencies_endpoints( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.OutboundEnvironmentEndpointCollection]: + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> AsyncIterable["_models.OutboundEnvironmentEndpoint"]: """Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster. Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster. The operation returns properties of each egress endpoint. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OutboundEnvironmentEndpointCollection or the - result of cls(response) + :return: An iterator like instance of either OutboundEnvironmentEndpoint or the result of + cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_01_01.models.OutboundEnvironmentEndpointCollection] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_01_01.models.OutboundEnvironmentEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_outbound_network_dependencies_endpoints_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_outbound_network_dependencies_endpoints.metadata['url'], + template_url=self.list_outbound_network_dependencies_endpoints.metadata["url"], headers=_headers, params=_params, ) @@ -2009,16 +2227,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_outbound_network_dependencies_endpoints_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -2034,10 +2247,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2047,8 +2258,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_outbound_network_dependencies_endpoints.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints"} # type: ignore + list_outbound_network_dependencies_endpoints.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/operations/_operations.py index 52baa8bb6e16..987ce5dc9b6a 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/operations/_operations.py @@ -7,9 +7,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,9 +27,11 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._operations import build_list_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class Operations: """ .. warning:: @@ -42,38 +51,33 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.OperationListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.OperationValue"]: """Gets a list of operations. Gets a list of operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationListResult or the result of cls(response) + :return: An iterator like instance of either OperationValue or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_01_01.models.OperationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_01_01.models.OperationValue] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -81,13 +85,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -103,10 +105,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -116,8 +116,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.ContainerService/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ContainerService/operations"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/operations/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/operations/_private_endpoint_connections_operations.py index 15492862f170..65f96d2a6af9 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/operations/_private_endpoint_connections_operations.py @@ -6,9 +6,15 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -20,10 +26,17 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._private_endpoint_connections_operations import build_delete_request_initial, build_get_request, build_list_request, build_update_request -T = TypeVar('T') +from ...operations._private_endpoint_connections_operations import ( + build_delete_request, + build_get_request, + build_list_request, + build_update_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class PrivateEndpointConnectionsOperations: """ .. warning:: @@ -43,46 +56,39 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async async def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnectionListResult: """Gets a list of private endpoint connections in the specified managed cluster. To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnectionListResult, or the result of cls(response) + :return: PrivateEndpointConnectionListResult or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.PrivateEndpointConnectionListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnectionListResult] - request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -90,69 +96,60 @@ async def list( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore - + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore @distributed_trace_async async def get( - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnection: """Gets the specified private endpoint connection. To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -160,75 +157,147 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - @distributed_trace_async + @overload async def update( self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, parameters: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateEndpointConnection: """Updates a private endpoint connection. Updates a private endpoint connection. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str - :param parameters: The updated private endpoint connection. + :param parameters: The updated private endpoint connection. Required. :type parameters: ~azure.mgmt.containerservice.v2022_01_01.models.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: The updated private endpoint connection. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: Union[_models.PrivateEndpointConnection, IO], + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: The updated private endpoint connection. Is either a model type or a IO + type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_01_01.models.PrivateEndpointConnection or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - _json = self._serialize.body(parameters, 'PrivateEndpointConnection') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateEndpointConnection") request = build_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update.metadata['url'], + content=_content, + template_url=self.update.metadata["url"], headers=_headers, params=_params, ) @@ -236,52 +305,43 @@ async def update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -289,10 +349,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -302,26 +361,21 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + async def begin_delete( + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes a private endpoint connection. Deletes a private endpoint connection. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -333,53 +387,46 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/operations/_private_link_resources_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/operations/_private_link_resources_operations.py index 122f7c9551dc..5675c5b94208 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/operations/_private_link_resources_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/operations/_private_link_resources_operations.py @@ -8,7 +8,13 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -19,9 +25,11 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._private_link_resources_operations import build_list_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class PrivateLinkResourcesOperations: """ .. warning:: @@ -41,46 +49,39 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async async def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.PrivateLinkResourcesListResult: """Gets a list of private link resources in the specified managed cluster. To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResourcesListResult, or the result of cls(response) + :return: PrivateLinkResourcesListResult or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.PrivateLinkResourcesListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResourcesListResult] - request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -88,22 +89,20 @@ async def list( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResourcesListResult', pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources"} # type: ignore - + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/operations/_resolve_private_link_service_id_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/operations/_resolve_private_link_service_id_operations.py index 396223dbee63..492c4317d3c8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/operations/_resolve_private_link_service_id_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/operations/_resolve_private_link_service_id_operations.py @@ -6,9 +6,15 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -19,9 +25,11 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._resolve_private_link_service_id_operations import build_post_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class ResolvePrivateLinkServiceIdOperations: """ .. warning:: @@ -41,52 +49,118 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async + @overload async def post( self, resource_group_name: str, resource_name: str, parameters: _models.PrivateLinkResource, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateLinkResource: """Gets the private link service ID for the specified managed cluster. Gets the private link service ID for the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters required in order to resolve a private link service ID. + :param parameters: Parameters required in order to resolve a private link service ID. Required. :type parameters: ~azure.mgmt.containerservice.v2022_01_01.models.PrivateLinkResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def post( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID for the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters required in order to resolve a private link service ID. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResource, or the result of cls(response) + :return: PrivateLinkResource or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.PrivateLinkResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @distributed_trace_async + async def post( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.PrivateLinkResource, IO], + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID for the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters required in order to resolve a private link service ID. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_01_01.models.PrivateLinkResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResource] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResource] - _json = self._serialize.body(parameters, 'PrivateLinkResource') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateLinkResource") request = build_post_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.post.metadata['url'], + content=_content, + template_url=self.post.metadata["url"], headers=_headers, params=_params, ) @@ -94,22 +168,20 @@ async def post( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResource', pipeline_response) + deserialized = self._deserialize("PrivateLinkResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - post.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId"} # type: ignore - + post.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/operations/_snapshots_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/operations/_snapshots_operations.py index 42212f6f2bfc..ba13e114f408 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/operations/_snapshots_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/operations/_snapshots_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,10 +27,19 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._snapshots_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_resource_group_request, build_list_request, build_update_tags_request -T = TypeVar('T') +from ...operations._snapshots_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_resource_group_request, + build_list_request, + build_update_tags_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class SnapshotsOperations: """ .. warning:: @@ -43,39 +59,34 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.SnapshotListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.Snapshot"]: """Gets a list of snapshots in the specified subscription. Gets a list of snapshots in the specified subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SnapshotListResult or the result of cls(response) + :return: An iterator like instance of either Snapshot or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_01_01.models.SnapshotListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_01_01.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SnapshotListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -83,14 +94,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -106,10 +114,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -119,48 +125,41 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots"} # type: ignore @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.SnapshotListResult]: + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.Snapshot"]: """Lists snapshots in the specified subscription and resource group. Lists snapshots in the specified subscription and resource group. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SnapshotListResult or the result of cls(response) + :return: An iterator like instance of either Snapshot or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_01_01.models.SnapshotListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_01_01.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SnapshotListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -168,15 +167,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -192,10 +187,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -205,50 +198,40 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots"} # type: ignore @distributed_trace_async - async def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.Snapshot: + async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.Snapshot: """Gets a snapshot. Gets a snapshot. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Snapshot, or the result of cls(response) + :return: Snapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.Snapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -256,71 +239,132 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - - @distributed_trace_async + @overload async def create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.Snapshot, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.Snapshot: """Creates or updates a snapshot. Creates or updates a snapshot. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The snapshot to create or update. + :param parameters: The snapshot to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_01_01.models.Snapshot + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Snapshot: + """Creates or updates a snapshot. + + Creates or updates a snapshot. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The snapshot to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Snapshot, or the result of cls(response) + :return: Snapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.Snapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @distributed_trace_async + async def create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.Snapshot, IO], **kwargs: Any + ) -> _models.Snapshot: + """Creates or updates a snapshot. + + Creates or updates a snapshot. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The snapshot to create or update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.mgmt.containerservice.v2022_01_01.models.Snapshot or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] - _json = self._serialize.body(parameters, 'Snapshot') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "Snapshot") request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) @@ -328,10 +372,9 @@ async def create_or_update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -339,64 +382,126 @@ async def create_or_update( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - @distributed_trace_async + @overload async def update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.Snapshot: """Updates tags on a snapshot. Updates tags on a snapshot. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update snapshot Tags operation. + :param parameters: Parameters supplied to the Update snapshot Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2022_01_01.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Snapshot: + """Updates tags on a snapshot. + + Updates tags on a snapshot. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update snapshot Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> _models.Snapshot: + """Updates tags on a snapshot. + + Updates tags on a snapshot. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update snapshot Tags operation. Is either a model + type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_01_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Snapshot, or the result of cls(response) + :return: Snapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.Snapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") request = build_update_tags_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_tags.metadata['url'], + content=_content, + template_url=self.update_tags.metadata["url"], headers=_headers, params=_params, ) @@ -404,64 +509,56 @@ async def update_tags( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - + update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: """Deletes a snapshot. Deletes a snapshot. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) @@ -469,10 +566,9 @@ async def delete( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -482,5 +578,4 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - + delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/models/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/models/__init__.py index 1527884a3c86..f4c515218928 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/models/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/models/__init__.py @@ -93,171 +93,169 @@ from ._models_py3 import UserAssignedIdentity from ._models_py3 import WindowsGmsaProfile - -from ._container_service_client_enums import ( - AgentPoolMode, - AgentPoolType, - Code, - ConnectionStatus, - ContainerServiceStorageProfileTypes, - ContainerServiceVMSizeTypes, - Count, - CreatedByType, - Expander, - ExtendedLocationTypes, - Format, - GPUInstanceProfile, - IpFamily, - KubeletDiskType, - LicenseType, - LoadBalancerSku, - ManagedClusterPodIdentityProvisioningState, - ManagedClusterSKUName, - ManagedClusterSKUTier, - NetworkMode, - NetworkPlugin, - NetworkPolicy, - OSDiskType, - OSSKU, - OSType, - OutboundType, - PrivateEndpointConnectionProvisioningState, - PublicNetworkAccess, - ResourceIdentityType, - ScaleDownMode, - ScaleSetEvictionPolicy, - ScaleSetPriority, - SnapshotType, - UpgradeChannel, - WeekDay, - WorkloadRuntime, -) +from ._container_service_client_enums import AgentPoolMode +from ._container_service_client_enums import AgentPoolType +from ._container_service_client_enums import Code +from ._container_service_client_enums import ConnectionStatus +from ._container_service_client_enums import ContainerServiceStorageProfileTypes +from ._container_service_client_enums import ContainerServiceVMSizeTypes +from ._container_service_client_enums import Count +from ._container_service_client_enums import CreatedByType +from ._container_service_client_enums import Expander +from ._container_service_client_enums import ExtendedLocationTypes +from ._container_service_client_enums import Format +from ._container_service_client_enums import GPUInstanceProfile +from ._container_service_client_enums import IpFamily +from ._container_service_client_enums import KubeletDiskType +from ._container_service_client_enums import LicenseType +from ._container_service_client_enums import LoadBalancerSku +from ._container_service_client_enums import ManagedClusterPodIdentityProvisioningState +from ._container_service_client_enums import ManagedClusterSKUName +from ._container_service_client_enums import ManagedClusterSKUTier +from ._container_service_client_enums import NetworkMode +from ._container_service_client_enums import NetworkPlugin +from ._container_service_client_enums import NetworkPolicy +from ._container_service_client_enums import OSDiskType +from ._container_service_client_enums import OSSKU +from ._container_service_client_enums import OSType +from ._container_service_client_enums import OutboundType +from ._container_service_client_enums import PrivateEndpointConnectionProvisioningState +from ._container_service_client_enums import PublicNetworkAccess +from ._container_service_client_enums import ResourceIdentityType +from ._container_service_client_enums import ScaleDownMode +from ._container_service_client_enums import ScaleSetEvictionPolicy +from ._container_service_client_enums import ScaleSetPriority +from ._container_service_client_enums import SnapshotType +from ._container_service_client_enums import UpgradeChannel +from ._container_service_client_enums import WeekDay +from ._container_service_client_enums import WorkloadRuntime from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'AgentPool', - 'AgentPoolAvailableVersions', - 'AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem', - 'AgentPoolListResult', - 'AgentPoolUpgradeProfile', - 'AgentPoolUpgradeProfilePropertiesUpgradesItem', - 'AgentPoolUpgradeSettings', - 'CloudErrorBody', - 'ContainerServiceDiagnosticsProfile', - 'ContainerServiceLinuxProfile', - 'ContainerServiceMasterProfile', - 'ContainerServiceNetworkProfile', - 'ContainerServiceSshConfiguration', - 'ContainerServiceSshPublicKey', - 'ContainerServiceVMDiagnostics', - 'CreationData', - 'CredentialResult', - 'CredentialResults', - 'EndpointDependency', - 'EndpointDetail', - 'ExtendedLocation', - 'KubeletConfig', - 'LinuxOSConfig', - 'MaintenanceConfiguration', - 'MaintenanceConfigurationListResult', - 'ManagedCluster', - 'ManagedClusterAADProfile', - 'ManagedClusterAPIServerAccessProfile', - 'ManagedClusterAccessProfile', - 'ManagedClusterAddonProfile', - 'ManagedClusterAddonProfileIdentity', - 'ManagedClusterAgentPoolProfile', - 'ManagedClusterAgentPoolProfileProperties', - 'ManagedClusterAutoUpgradeProfile', - 'ManagedClusterHTTPProxyConfig', - 'ManagedClusterIdentity', - 'ManagedClusterListResult', - 'ManagedClusterLoadBalancerProfile', - 'ManagedClusterLoadBalancerProfileManagedOutboundIPs', - 'ManagedClusterLoadBalancerProfileOutboundIPPrefixes', - 'ManagedClusterLoadBalancerProfileOutboundIPs', - 'ManagedClusterManagedOutboundIPProfile', - 'ManagedClusterNATGatewayProfile', - 'ManagedClusterPodIdentity', - 'ManagedClusterPodIdentityException', - 'ManagedClusterPodIdentityProfile', - 'ManagedClusterPodIdentityProvisioningError', - 'ManagedClusterPodIdentityProvisioningErrorBody', - 'ManagedClusterPodIdentityProvisioningInfo', - 'ManagedClusterPoolUpgradeProfile', - 'ManagedClusterPoolUpgradeProfileUpgradesItem', - 'ManagedClusterPropertiesAutoScalerProfile', - 'ManagedClusterSKU', - 'ManagedClusterSecurityProfile', - 'ManagedClusterSecurityProfileAzureDefender', - 'ManagedClusterServicePrincipalProfile', - 'ManagedClusterUpgradeProfile', - 'ManagedClusterWindowsProfile', - 'ManagedServiceIdentityUserAssignedIdentitiesValue', - 'OSOptionProfile', - 'OSOptionProperty', - 'OperationListResult', - 'OperationValue', - 'OutboundEnvironmentEndpoint', - 'OutboundEnvironmentEndpointCollection', - 'PowerState', - 'PrivateEndpoint', - 'PrivateEndpointConnection', - 'PrivateEndpointConnectionListResult', - 'PrivateLinkResource', - 'PrivateLinkResourcesListResult', - 'PrivateLinkServiceConnectionState', - 'Resource', - 'ResourceReference', - 'RunCommandRequest', - 'RunCommandResult', - 'Snapshot', - 'SnapshotListResult', - 'SubResource', - 'SysctlConfig', - 'SystemData', - 'TagsObject', - 'TimeInWeek', - 'TimeSpan', - 'UserAssignedIdentity', - 'WindowsGmsaProfile', - 'AgentPoolMode', - 'AgentPoolType', - 'Code', - 'ConnectionStatus', - 'ContainerServiceStorageProfileTypes', - 'ContainerServiceVMSizeTypes', - 'Count', - 'CreatedByType', - 'Expander', - 'ExtendedLocationTypes', - 'Format', - 'GPUInstanceProfile', - 'IpFamily', - 'KubeletDiskType', - 'LicenseType', - 'LoadBalancerSku', - 'ManagedClusterPodIdentityProvisioningState', - 'ManagedClusterSKUName', - 'ManagedClusterSKUTier', - 'NetworkMode', - 'NetworkPlugin', - 'NetworkPolicy', - 'OSDiskType', - 'OSSKU', - 'OSType', - 'OutboundType', - 'PrivateEndpointConnectionProvisioningState', - 'PublicNetworkAccess', - 'ResourceIdentityType', - 'ScaleDownMode', - 'ScaleSetEvictionPolicy', - 'ScaleSetPriority', - 'SnapshotType', - 'UpgradeChannel', - 'WeekDay', - 'WorkloadRuntime', + "AgentPool", + "AgentPoolAvailableVersions", + "AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem", + "AgentPoolListResult", + "AgentPoolUpgradeProfile", + "AgentPoolUpgradeProfilePropertiesUpgradesItem", + "AgentPoolUpgradeSettings", + "CloudErrorBody", + "ContainerServiceDiagnosticsProfile", + "ContainerServiceLinuxProfile", + "ContainerServiceMasterProfile", + "ContainerServiceNetworkProfile", + "ContainerServiceSshConfiguration", + "ContainerServiceSshPublicKey", + "ContainerServiceVMDiagnostics", + "CreationData", + "CredentialResult", + "CredentialResults", + "EndpointDependency", + "EndpointDetail", + "ExtendedLocation", + "KubeletConfig", + "LinuxOSConfig", + "MaintenanceConfiguration", + "MaintenanceConfigurationListResult", + "ManagedCluster", + "ManagedClusterAADProfile", + "ManagedClusterAPIServerAccessProfile", + "ManagedClusterAccessProfile", + "ManagedClusterAddonProfile", + "ManagedClusterAddonProfileIdentity", + "ManagedClusterAgentPoolProfile", + "ManagedClusterAgentPoolProfileProperties", + "ManagedClusterAutoUpgradeProfile", + "ManagedClusterHTTPProxyConfig", + "ManagedClusterIdentity", + "ManagedClusterListResult", + "ManagedClusterLoadBalancerProfile", + "ManagedClusterLoadBalancerProfileManagedOutboundIPs", + "ManagedClusterLoadBalancerProfileOutboundIPPrefixes", + "ManagedClusterLoadBalancerProfileOutboundIPs", + "ManagedClusterManagedOutboundIPProfile", + "ManagedClusterNATGatewayProfile", + "ManagedClusterPodIdentity", + "ManagedClusterPodIdentityException", + "ManagedClusterPodIdentityProfile", + "ManagedClusterPodIdentityProvisioningError", + "ManagedClusterPodIdentityProvisioningErrorBody", + "ManagedClusterPodIdentityProvisioningInfo", + "ManagedClusterPoolUpgradeProfile", + "ManagedClusterPoolUpgradeProfileUpgradesItem", + "ManagedClusterPropertiesAutoScalerProfile", + "ManagedClusterSKU", + "ManagedClusterSecurityProfile", + "ManagedClusterSecurityProfileAzureDefender", + "ManagedClusterServicePrincipalProfile", + "ManagedClusterUpgradeProfile", + "ManagedClusterWindowsProfile", + "ManagedServiceIdentityUserAssignedIdentitiesValue", + "OSOptionProfile", + "OSOptionProperty", + "OperationListResult", + "OperationValue", + "OutboundEnvironmentEndpoint", + "OutboundEnvironmentEndpointCollection", + "PowerState", + "PrivateEndpoint", + "PrivateEndpointConnection", + "PrivateEndpointConnectionListResult", + "PrivateLinkResource", + "PrivateLinkResourcesListResult", + "PrivateLinkServiceConnectionState", + "Resource", + "ResourceReference", + "RunCommandRequest", + "RunCommandResult", + "Snapshot", + "SnapshotListResult", + "SubResource", + "SysctlConfig", + "SystemData", + "TagsObject", + "TimeInWeek", + "TimeSpan", + "UserAssignedIdentity", + "WindowsGmsaProfile", + "AgentPoolMode", + "AgentPoolType", + "Code", + "ConnectionStatus", + "ContainerServiceStorageProfileTypes", + "ContainerServiceVMSizeTypes", + "Count", + "CreatedByType", + "Expander", + "ExtendedLocationTypes", + "Format", + "GPUInstanceProfile", + "IpFamily", + "KubeletDiskType", + "LicenseType", + "LoadBalancerSku", + "ManagedClusterPodIdentityProvisioningState", + "ManagedClusterSKUName", + "ManagedClusterSKUTier", + "NetworkMode", + "NetworkPlugin", + "NetworkPolicy", + "OSDiskType", + "OSSKU", + "OSType", + "OutboundType", + "PrivateEndpointConnectionProvisioningState", + "PublicNetworkAccess", + "ResourceIdentityType", + "ScaleDownMode", + "ScaleSetEvictionPolicy", + "ScaleSetPriority", + "SnapshotType", + "UpgradeChannel", + "WeekDay", + "WorkloadRuntime", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/models/_container_service_client_enums.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/models/_container_service_client_enums.py index cb066b7fffcc..3f3a6ff62be3 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/models/_container_service_client_enums.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/models/_container_service_client_enums.py @@ -13,7 +13,7 @@ class AgentPoolMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools + https://docs.microsoft.com/azure/aks/use-system-pools. """ #: System agent pools are primarily for hosting critical system pods such as CoreDNS and @@ -23,33 +23,34 @@ class AgentPoolMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: User agent pools are primarily for hosting your application pods. USER = "User" + class AgentPoolType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of Agent Pool. - """ + """The type of Agent Pool.""" #: Create an Agent Pool backed by a Virtual Machine Scale Set. VIRTUAL_MACHINE_SCALE_SETS = "VirtualMachineScaleSets" #: Use of this is strongly discouraged. AVAILABILITY_SET = "AvailabilitySet" + class Code(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Tells whether the cluster is Running or Stopped - """ + """Tells whether the cluster is Running or Stopped.""" #: The cluster is running. RUNNING = "Running" #: The cluster is stopped. STOPPED = "Stopped" + class ConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The private link service connection status. - """ + """The private link service connection status.""" PENDING = "Pending" APPROVED = "Approved" REJECTED = "Rejected" DISCONNECTED = "Disconnected" + class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Specifies what kind of storage to use. If omitted, the default will be chosen on your behalf based on the choice of orchestrator. @@ -58,9 +59,9 @@ class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEn STORAGE_ACCOUNT = "StorageAccount" MANAGED_DISKS = "ManagedDisks" + class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Size of agent VMs. Note: This is no longer maintained. - """ + """Size of agent VMs. Note: This is no longer maintained.""" STANDARD_A1 = "Standard_A1" STANDARD_A10 = "Standard_A10" @@ -237,6 +238,7 @@ class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): STANDARD_NV24 = "Standard_NV24" STANDARD_NV6 = "Standard_NV6" + class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): """Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, and 5. The default value is 1. @@ -246,15 +248,16 @@ class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): THREE = 3 FIVE = 5 + class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of identity that created the resource. - """ + """The type of identity that created the resource.""" USER = "User" APPLICATION = "Application" MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" + class Expander(str, Enum, metaclass=CaseInsensitiveEnumMeta): """If not specified, the default is 'random'. See `expanders `_ @@ -278,23 +281,25 @@ class Expander(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Used when you don't have a particular need for the node groups to scale differently. RANDOM = "random" + class ExtendedLocationTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of extendedLocation. - """ + """The type of extendedLocation.""" EDGE_ZONE = "EdgeZone" + class Format(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Format.""" #: Return azure auth-provider kubeconfig. This format is deprecated in 1.22 and will be fully #: removed in 1.25. AZURE = "azure" #: Return exec format kubeconfig. This format requires kubelogin binary in the path. - EXEC_ENUM = "exec" + EXEC = "exec" + class GPUInstanceProfile(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """GPUInstanceProfile to be used to specify GPU MIG instance profile for supported GPU VM SKU. - """ + """GPUInstanceProfile to be used to specify GPU MIG instance profile for supported GPU VM SKU.""" MIG1_G = "MIG1g" MIG2_G = "MIG2g" @@ -302,13 +307,14 @@ class GPUInstanceProfile(str, Enum, metaclass=CaseInsensitiveEnumMeta): MIG4_G = "MIG4g" MIG7_G = "MIG7g" + class IpFamily(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The IP version to use for cluster networking and IP assignment. - """ + """The IP version to use for cluster networking and IP assignment.""" I_PV4 = "IPv4" I_PV6 = "IPv6" + class KubeletDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. @@ -319,6 +325,7 @@ class KubeletDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Kubelet will use the temporary disk for its data. TEMPORARY = "Temporary" + class LicenseType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The license type to use for Windows VMs. See `Azure Hybrid User Benefits `_ for more details. @@ -329,6 +336,7 @@ class LicenseType(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Enables Azure Hybrid User Benefits for Windows VMs. WINDOWS_SERVER = "Windows_Server" + class LoadBalancerSku(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The default is 'standard'. See `Azure Load Balancer SKUs `_ for more information about the @@ -342,21 +350,22 @@ class LoadBalancerSku(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Use a basic Load Balancer with limited functionality. BASIC = "basic" + class ManagedClusterPodIdentityProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The current provisioning state of the pod identity. - """ + """The current provisioning state of the pod identity.""" ASSIGNED = "Assigned" UPDATING = "Updating" DELETING = "Deleting" FAILED = "Failed" + class ManagedClusterSKUName(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The name of a managed cluster SKU. - """ + """The name of a managed cluster SKU.""" BASIC = "Basic" + class ManagedClusterSKUTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): """If not specified, the default is 'Free'. See `uptime SLA `_ for more details. @@ -368,20 +377,20 @@ class ManagedClusterSKUTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: No guaranteed SLA, no additional charges. Free tier clusters have an SLO of 99.5%. FREE = "Free" + class NetworkMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """This cannot be specified if networkPlugin is anything other than 'azure'. - """ + """This cannot be specified if networkPlugin is anything other than 'azure'.""" #: No bridge is created. Intra-VM Pod to Pod communication is through IP routes created by Azure #: CNI. See `Transparent Mode `_ for #: more information. TRANSPARENT = "transparent" - #: This is no longer supported. + #: This is no longer supported BRIDGE = "bridge" + class NetworkPlugin(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Network plugin used for building the Kubernetes network. - """ + """Network plugin used for building the Kubernetes network.""" #: Use the Azure CNI network plugin. See `Azure CNI (advanced) networking #: `_ for @@ -392,9 +401,9 @@ class NetworkPlugin(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: information. KUBENET = "kubenet" + class NetworkPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Network policy used for building the Kubernetes network. - """ + """Network policy used for building the Kubernetes network.""" #: Use Calico network policies. See `differences between Azure and Calico policies #: `_ @@ -405,6 +414,7 @@ class NetworkPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: for more information. AZURE = "azure" + class OSDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more @@ -421,22 +431,23 @@ class OSDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: provides lower read/write latency, along with faster node scaling and cluster upgrades. EPHEMERAL = "Ephemeral" + class OSSKU(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Specifies an OS SKU. This value must not be specified if OSType is Windows. - """ + """Specifies an OS SKU. This value must not be specified if OSType is Windows.""" UBUNTU = "Ubuntu" CBL_MARINER = "CBLMariner" + class OSType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The operating system type. The default is Linux. - """ + """The operating system type. The default is Linux.""" #: Use Linux. LINUX = "Linux" #: Use Windows. WINDOWS = "Windows" + class OutboundType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """This can only be set at cluster creation time and cannot be changed later. For more information see `egress outbound type `_. @@ -457,22 +468,23 @@ class OutboundType(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: advanced scenario and requires proper network configuration. USER_ASSIGNED_NAT_GATEWAY = "userAssignedNATGateway" + class PrivateEndpointConnectionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The current provisioning state. - """ + """The current provisioning state.""" SUCCEEDED = "Succeeded" CREATING = "Creating" DELETING = "Deleting" FAILED = "Failed" + class PublicNetworkAccess(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Allow or deny public network access for AKS - """ + """Allow or deny public network access for AKS.""" ENABLED = "Enabled" DISABLED = "Disabled" + class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """For more information see `use managed identities in AKS `_. @@ -489,6 +501,7 @@ class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Do not use a managed identity for the Managed Cluster, service principal will be used instead. NONE = "None" + class ScaleDownMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Describes how VMs are added to or removed from Agent Pools. See `billing states `_. @@ -500,10 +513,11 @@ class ScaleDownMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: during scale down. DEALLOCATE = "Deallocate" + class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The eviction policy specifies what to do with the VM when it is evicted. The default is Delete. For more information about eviction see `spot VMs - `_ + `_. """ #: Nodes in the underlying Scale Set of the node pool are deleted when they're evicted. @@ -513,9 +527,9 @@ class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: cause issues with cluster scaling or upgrading. DEALLOCATE = "Deallocate" + class ScaleSetPriority(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The Virtual Machine Scale Set priority. - """ + """The Virtual Machine Scale Set priority.""" #: Spot priority VMs will be used. There is no SLA for spot nodes. See `spot on AKS #: `_ for more information. @@ -523,13 +537,14 @@ class ScaleSetPriority(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Regular VMs will be used. REGULAR = "Regular" + class SnapshotType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of a snapshot. The default is NodePool. - """ + """The type of a snapshot. The default is NodePool.""" #: The snapshot is a snapshot of a node pool. NODE_POOL = "NodePool" + class UpgradeChannel(str, Enum, metaclass=CaseInsensitiveEnumMeta): """For more information see `setting the AKS cluster auto-upgrade channel `_. @@ -560,9 +575,9 @@ class UpgradeChannel(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Disables auto-upgrades and keeps the cluster at its current version of Kubernetes. NONE = "none" + class WeekDay(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The weekday enum. - """ + """The weekday enum.""" SUNDAY = "Sunday" MONDAY = "Monday" @@ -572,9 +587,9 @@ class WeekDay(str, Enum, metaclass=CaseInsensitiveEnumMeta): FRIDAY = "Friday" SATURDAY = "Saturday" + class WorkloadRuntime(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Determines the type of workload a node can run. - """ + """Determines the type of workload a node can run.""" #: Nodes will use Kubelet to run standard OCI container workloads. OCI_CONTAINER = "OCIContainer" diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/models/_models_py3.py index cc9b8960d47a..548f2e40cfac 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/models/_models_py3.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/models/_models_py3.py @@ -1,4 +1,5 @@ # coding=utf-8 +# pylint: disable=too-many-lines # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -9,14 +10,14 @@ import datetime from typing import Dict, List, Optional, TYPE_CHECKING, Union -import msrest.serialization +from ... import _serialization if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - import __init__ as _models + from .. import models as _models -class SubResource(msrest.serialization.Model): +class SubResource(_serialization.Model): """Reference to another subresource. Variables are only populated by the server, and will be ignored when sending a request. @@ -31,30 +32,26 @@ class SubResource(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(SubResource, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.id = None self.name = None self.type = None -class AgentPool(SubResource): +class AgentPool(SubResource): # pylint: disable=too-many-instance-attributes """Agent Pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -82,14 +79,14 @@ class AgentPool(SubResource): larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2022_01_01.models.OSDiskType :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data - root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_01_01.models.KubeletDiskType :ivar workload_runtime: Determines the type of workload a node can run. Known values are: - "OCIContainer", "WasmWasi". + "OCIContainer" and "WasmWasi". :vartype workload_runtime: str or ~azure.mgmt.containerservice.v2022_01_01.models.WorkloadRuntime :ivar vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and used. @@ -103,11 +100,11 @@ class AgentPool(SubResource): :vartype pod_subnet_id: str :ivar max_pods: The maximum number of pods that can run on a node. :vartype max_pods: int - :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_01_01.models.OSType :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known - values are: "Ubuntu", "CBLMariner". + values are: "Ubuntu" and "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2022_01_01.models.OSSKU :ivar max_count: The maximum number of nodes for auto-scaling. :vartype max_count: int @@ -116,15 +113,15 @@ class AgentPool(SubResource): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it - defaults to Delete. Known values are: "Delete", "Deallocate". + defaults to Delete. Known values are: "Delete" and "Deallocate". :vartype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_01_01.models.ScaleDownMode - :ivar type_properties_type: The type of Agent Pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + :ivar type_properties_type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets" + and "AvailabilitySet". :vartype type_properties_type: str or ~azure.mgmt.containerservice.v2022_01_01.models.AgentPoolType :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :vartype mode: str or ~azure.mgmt.containerservice.v2022_01_01.models.AgentPoolMode :ivar orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -159,20 +156,18 @@ class AgentPool(SubResource): /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default - is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + is 'Regular'. Known values are: "Spot" and "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_01_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_01_01.models.ScaleSetEvictionPolicy :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :vartype spot_max_price: float - :ivar tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :ivar tags: The tags to be persisted on the agent pool virtual machine scale set. :vartype tags: dict[str, str] :ivar node_labels: The node labels to be persisted across all nodes in agent pool. :vartype node_labels: dict[str, str] @@ -196,7 +191,7 @@ class AgentPool(SubResource): for more details. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_01_01.models.GPUInstanceProfile :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the node pool @@ -205,60 +200,60 @@ class AgentPool(SubResource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'os_disk_size_gb': {'maximum': 2048, 'minimum': 0}, - 'node_image_version': {'readonly': True}, - 'provisioning_state': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "os_disk_size_gb": {"maximum": 2048, "minimum": 0}, + "node_image_version": {"readonly": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'count': {'key': 'properties.count', 'type': 'int'}, - 'vm_size': {'key': 'properties.vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'properties.osDiskSizeGB', 'type': 'int'}, - 'os_disk_type': {'key': 'properties.osDiskType', 'type': 'str'}, - 'kubelet_disk_type': {'key': 'properties.kubeletDiskType', 'type': 'str'}, - 'workload_runtime': {'key': 'properties.workloadRuntime', 'type': 'str'}, - 'vnet_subnet_id': {'key': 'properties.vnetSubnetID', 'type': 'str'}, - 'pod_subnet_id': {'key': 'properties.podSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'properties.maxPods', 'type': 'int'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'os_sku': {'key': 'properties.osSKU', 'type': 'str'}, - 'max_count': {'key': 'properties.maxCount', 'type': 'int'}, - 'min_count': {'key': 'properties.minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'properties.enableAutoScaling', 'type': 'bool'}, - 'scale_down_mode': {'key': 'properties.scaleDownMode', 'type': 'str'}, - 'type_properties_type': {'key': 'properties.type', 'type': 'str'}, - 'mode': {'key': 'properties.mode', 'type': 'str'}, - 'orchestrator_version': {'key': 'properties.orchestratorVersion', 'type': 'str'}, - 'node_image_version': {'key': 'properties.nodeImageVersion', 'type': 'str'}, - 'upgrade_settings': {'key': 'properties.upgradeSettings', 'type': 'AgentPoolUpgradeSettings'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'power_state': {'key': 'properties.powerState', 'type': 'PowerState'}, - 'availability_zones': {'key': 'properties.availabilityZones', 'type': '[str]'}, - 'enable_node_public_ip': {'key': 'properties.enableNodePublicIP', 'type': 'bool'}, - 'node_public_ip_prefix_id': {'key': 'properties.nodePublicIPPrefixID', 'type': 'str'}, - 'scale_set_priority': {'key': 'properties.scaleSetPriority', 'type': 'str'}, - 'scale_set_eviction_policy': {'key': 'properties.scaleSetEvictionPolicy', 'type': 'str'}, - 'spot_max_price': {'key': 'properties.spotMaxPrice', 'type': 'float'}, - 'tags': {'key': 'properties.tags', 'type': '{str}'}, - 'node_labels': {'key': 'properties.nodeLabels', 'type': '{str}'}, - 'node_taints': {'key': 'properties.nodeTaints', 'type': '[str]'}, - 'proximity_placement_group_id': {'key': 'properties.proximityPlacementGroupID', 'type': 'str'}, - 'kubelet_config': {'key': 'properties.kubeletConfig', 'type': 'KubeletConfig'}, - 'linux_os_config': {'key': 'properties.linuxOSConfig', 'type': 'LinuxOSConfig'}, - 'enable_encryption_at_host': {'key': 'properties.enableEncryptionAtHost', 'type': 'bool'}, - 'enable_ultra_ssd': {'key': 'properties.enableUltraSSD', 'type': 'bool'}, - 'enable_fips': {'key': 'properties.enableFIPS', 'type': 'bool'}, - 'gpu_instance_profile': {'key': 'properties.gpuInstanceProfile', 'type': 'str'}, - 'creation_data': {'key': 'properties.creationData', 'type': 'CreationData'}, - } - - def __init__( + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "count": {"key": "properties.count", "type": "int"}, + "vm_size": {"key": "properties.vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "properties.osDiskSizeGB", "type": "int"}, + "os_disk_type": {"key": "properties.osDiskType", "type": "str"}, + "kubelet_disk_type": {"key": "properties.kubeletDiskType", "type": "str"}, + "workload_runtime": {"key": "properties.workloadRuntime", "type": "str"}, + "vnet_subnet_id": {"key": "properties.vnetSubnetID", "type": "str"}, + "pod_subnet_id": {"key": "properties.podSubnetID", "type": "str"}, + "max_pods": {"key": "properties.maxPods", "type": "int"}, + "os_type": {"key": "properties.osType", "type": "str"}, + "os_sku": {"key": "properties.osSKU", "type": "str"}, + "max_count": {"key": "properties.maxCount", "type": "int"}, + "min_count": {"key": "properties.minCount", "type": "int"}, + "enable_auto_scaling": {"key": "properties.enableAutoScaling", "type": "bool"}, + "scale_down_mode": {"key": "properties.scaleDownMode", "type": "str"}, + "type_properties_type": {"key": "properties.type", "type": "str"}, + "mode": {"key": "properties.mode", "type": "str"}, + "orchestrator_version": {"key": "properties.orchestratorVersion", "type": "str"}, + "node_image_version": {"key": "properties.nodeImageVersion", "type": "str"}, + "upgrade_settings": {"key": "properties.upgradeSettings", "type": "AgentPoolUpgradeSettings"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "power_state": {"key": "properties.powerState", "type": "PowerState"}, + "availability_zones": {"key": "properties.availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "properties.enableNodePublicIP", "type": "bool"}, + "node_public_ip_prefix_id": {"key": "properties.nodePublicIPPrefixID", "type": "str"}, + "scale_set_priority": {"key": "properties.scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "properties.scaleSetEvictionPolicy", "type": "str"}, + "spot_max_price": {"key": "properties.spotMaxPrice", "type": "float"}, + "tags": {"key": "properties.tags", "type": "{str}"}, + "node_labels": {"key": "properties.nodeLabels", "type": "{str}"}, + "node_taints": {"key": "properties.nodeTaints", "type": "[str]"}, + "proximity_placement_group_id": {"key": "properties.proximityPlacementGroupID", "type": "str"}, + "kubelet_config": {"key": "properties.kubeletConfig", "type": "KubeletConfig"}, + "linux_os_config": {"key": "properties.linuxOSConfig", "type": "LinuxOSConfig"}, + "enable_encryption_at_host": {"key": "properties.enableEncryptionAtHost", "type": "bool"}, + "enable_ultra_ssd": {"key": "properties.enableUltraSSD", "type": "bool"}, + "enable_fips": {"key": "properties.enableFIPS", "type": "bool"}, + "gpu_instance_profile": {"key": "properties.gpuInstanceProfile", "type": "str"}, + "creation_data": {"key": "properties.creationData", "type": "CreationData"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, count: Optional[int] = None, @@ -270,7 +265,7 @@ def __init__( vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, @@ -284,9 +279,9 @@ def __init__( availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", - spot_max_price: Optional[float] = -1, + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", + spot_max_price: float = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, @@ -317,14 +312,14 @@ def __init__( larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2022_01_01.models.OSDiskType :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime - data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + data root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_01_01.models.KubeletDiskType :keyword workload_runtime: Determines the type of workload a node can run. Known values are: - "OCIContainer", "WasmWasi". + "OCIContainer" and "WasmWasi". :paramtype workload_runtime: str or ~azure.mgmt.containerservice.v2022_01_01.models.WorkloadRuntime :keyword vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and @@ -338,11 +333,11 @@ def __init__( :paramtype pod_subnet_id: str :keyword max_pods: The maximum number of pods that can run on a node. :paramtype max_pods: int - :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_01_01.models.OSType :keyword os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Known values are: "Ubuntu", "CBLMariner". + Known values are: "Ubuntu" and "CBLMariner". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2022_01_01.models.OSSKU :keyword max_count: The maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -351,16 +346,16 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, - it defaults to Delete. Known values are: "Delete", "Deallocate". + it defaults to Delete. Known values are: "Delete" and "Deallocate". :paramtype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_01_01.models.ScaleDownMode :keyword type_properties_type: The type of Agent Pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type_properties_type: str or ~azure.mgmt.containerservice.v2022_01_01.models.AgentPoolType :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2022_01_01.models.AgentPoolMode :keyword orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -391,20 +386,18 @@ def __init__( /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the - default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + default is 'Regular'. Known values are: "Spot" and "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_01_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_01_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :paramtype spot_max_price: float - :keyword tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :keyword tags: The tags to be persisted on the agent pool virtual machine scale set. :paramtype tags: dict[str, str] :keyword node_labels: The node labels to be persisted across all nodes in agent pool. :paramtype node_labels: dict[str, str] @@ -428,7 +421,7 @@ def __init__( for more details. :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance - profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_01_01.models.GPUInstanceProfile @@ -436,7 +429,7 @@ def __init__( pool will be created/upgraded using a snapshot. :paramtype creation_data: ~azure.mgmt.containerservice.v2022_01_01.models.CreationData """ - super(AgentPool, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.vm_size = vm_size self.os_disk_size_gb = os_disk_size_gb @@ -478,7 +471,7 @@ def __init__( self.creation_data = creation_data -class AgentPoolAvailableVersions(msrest.serialization.Model): +class AgentPoolAvailableVersions(_serialization.Model): """The list of available versions for an agent pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -495,16 +488,19 @@ class AgentPoolAvailableVersions(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'agent_pool_versions': {'key': 'properties.agentPoolVersions', 'type': '[AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "agent_pool_versions": { + "key": "properties.agentPoolVersions", + "type": "[AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem]", + }, } def __init__( @@ -518,14 +514,14 @@ def __init__( :paramtype agent_pool_versions: list[~azure.mgmt.containerservice.v2022_01_01.models.AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem] """ - super(AgentPoolAvailableVersions, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None self.agent_pool_versions = agent_pool_versions -class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(msrest.serialization.Model): +class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(_serialization.Model): """AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem. :ivar default: Whether this version is the default agent pool version. @@ -537,9 +533,9 @@ class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(msrest.serializa """ _attribute_map = { - 'default': {'key': 'default', 'type': 'bool'}, - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "default": {"key": "default", "type": "bool"}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } def __init__( @@ -558,13 +554,13 @@ def __init__( :keyword is_preview: Whether Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.default = default self.kubernetes_version = kubernetes_version self.is_preview = is_preview -class AgentPoolListResult(msrest.serialization.Model): +class AgentPoolListResult(_serialization.Model): """The response from the List Agent Pools operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -576,30 +572,25 @@ class AgentPoolListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[AgentPool]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[AgentPool]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.AgentPool"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.AgentPool"]] = None, **kwargs): """ :keyword value: The list of agent pools. :paramtype value: list[~azure.mgmt.containerservice.v2022_01_01.models.AgentPool] """ - super(AgentPoolListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class AgentPoolUpgradeProfile(msrest.serialization.Model): +class AgentPoolUpgradeProfile(_serialization.Model): """The list of available upgrades for an agent pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -612,10 +603,10 @@ class AgentPoolUpgradeProfile(msrest.serialization.Model): :vartype name: str :ivar type: The type of the agent pool upgrade profile. :vartype type: str - :ivar kubernetes_version: Required. The Kubernetes version (major.minor.patch). + :ivar kubernetes_version: The Kubernetes version (major.minor.patch). Required. :vartype kubernetes_version: str - :ivar os_type: Required. The operating system type. The default is Linux. Known values are: - "Linux", "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_01_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -625,21 +616,21 @@ class AgentPoolUpgradeProfile(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kubernetes_version': {'required': True}, - 'os_type': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "kubernetes_version": {"required": True}, + "os_type": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'kubernetes_version': {'key': 'properties.kubernetesVersion', 'type': 'str'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'upgrades': {'key': 'properties.upgrades', 'type': '[AgentPoolUpgradeProfilePropertiesUpgradesItem]'}, - 'latest_node_image_version': {'key': 'properties.latestNodeImageVersion', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "os_type": {"key": "properties.osType", "type": "str"}, + "upgrades": {"key": "properties.upgrades", "type": "[AgentPoolUpgradeProfilePropertiesUpgradesItem]"}, + "latest_node_image_version": {"key": "properties.latestNodeImageVersion", "type": "str"}, } def __init__( @@ -652,10 +643,10 @@ def __init__( **kwargs ): """ - :keyword kubernetes_version: Required. The Kubernetes version (major.minor.patch). + :keyword kubernetes_version: The Kubernetes version (major.minor.patch). Required. :paramtype kubernetes_version: str - :keyword os_type: Required. The operating system type. The default is Linux. Known values are: - "Linux", "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_01_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: @@ -663,7 +654,7 @@ def __init__( :keyword latest_node_image_version: The latest AKS supported node image version. :paramtype latest_node_image_version: str """ - super(AgentPoolUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -673,7 +664,7 @@ def __init__( self.latest_node_image_version = latest_node_image_version -class AgentPoolUpgradeProfilePropertiesUpgradesItem(msrest.serialization.Model): +class AgentPoolUpgradeProfilePropertiesUpgradesItem(_serialization.Model): """AgentPoolUpgradeProfilePropertiesUpgradesItem. :ivar kubernetes_version: The Kubernetes version (major.minor.patch). @@ -683,29 +674,23 @@ class AgentPoolUpgradeProfilePropertiesUpgradesItem(msrest.serialization.Model): """ _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } - def __init__( - self, - *, - kubernetes_version: Optional[str] = None, - is_preview: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, kubernetes_version: Optional[str] = None, is_preview: Optional[bool] = None, **kwargs): """ :keyword kubernetes_version: The Kubernetes version (major.minor.patch). :paramtype kubernetes_version: str :keyword is_preview: Whether the Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(AgentPoolUpgradeProfilePropertiesUpgradesItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.is_preview = is_preview -class AgentPoolUpgradeSettings(msrest.serialization.Model): +class AgentPoolUpgradeSettings(_serialization.Model): """Settings for upgrading an agentpool. :ivar max_surge: This can either be set to an integer (e.g. '5') or a percentage (e.g. '50%'). @@ -717,15 +702,10 @@ class AgentPoolUpgradeSettings(msrest.serialization.Model): """ _attribute_map = { - 'max_surge': {'key': 'maxSurge', 'type': 'str'}, + "max_surge": {"key": "maxSurge", "type": "str"}, } - def __init__( - self, - *, - max_surge: Optional[str] = None, - **kwargs - ): + def __init__(self, *, max_surge: Optional[str] = None, **kwargs): """ :keyword max_surge: This can either be set to an integer (e.g. '5') or a percentage (e.g. '50%'). If a percentage is specified, it is the percentage of the total agent pool size at the @@ -734,11 +714,11 @@ def __init__( https://docs.microsoft.com/azure/aks/upgrade-cluster#customize-node-surge-upgrade. :paramtype max_surge: str """ - super(AgentPoolUpgradeSettings, self).__init__(**kwargs) + super().__init__(**kwargs) self.max_surge = max_surge -class CloudErrorBody(msrest.serialization.Model): +class CloudErrorBody(_serialization.Model): """An error response from the Container service. :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed @@ -755,10 +735,10 @@ class CloudErrorBody(msrest.serialization.Model): """ _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[CloudErrorBody]"}, } def __init__( @@ -783,87 +763,76 @@ def __init__( :keyword details: A list of additional details about the error. :paramtype details: list[~azure.mgmt.containerservice.v2022_01_01.models.CloudErrorBody] """ - super(CloudErrorBody, self).__init__(**kwargs) + super().__init__(**kwargs) self.code = code self.message = message self.target = target self.details = details -class ContainerServiceDiagnosticsProfile(msrest.serialization.Model): +class ContainerServiceDiagnosticsProfile(_serialization.Model): """Profile for diagnostics on the container service cluster. All required parameters must be populated in order to send to Azure. - :ivar vm_diagnostics: Required. Profile for diagnostics on the container service VMs. + :ivar vm_diagnostics: Profile for diagnostics on the container service VMs. Required. :vartype vm_diagnostics: ~azure.mgmt.containerservice.v2022_01_01.models.ContainerServiceVMDiagnostics """ _validation = { - 'vm_diagnostics': {'required': True}, + "vm_diagnostics": {"required": True}, } _attribute_map = { - 'vm_diagnostics': {'key': 'vmDiagnostics', 'type': 'ContainerServiceVMDiagnostics'}, + "vm_diagnostics": {"key": "vmDiagnostics", "type": "ContainerServiceVMDiagnostics"}, } - def __init__( - self, - *, - vm_diagnostics: "_models.ContainerServiceVMDiagnostics", - **kwargs - ): + def __init__(self, *, vm_diagnostics: "_models.ContainerServiceVMDiagnostics", **kwargs): """ - :keyword vm_diagnostics: Required. Profile for diagnostics on the container service VMs. + :keyword vm_diagnostics: Profile for diagnostics on the container service VMs. Required. :paramtype vm_diagnostics: ~azure.mgmt.containerservice.v2022_01_01.models.ContainerServiceVMDiagnostics """ - super(ContainerServiceDiagnosticsProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.vm_diagnostics = vm_diagnostics -class ContainerServiceLinuxProfile(msrest.serialization.Model): +class ContainerServiceLinuxProfile(_serialization.Model): """Profile for Linux VMs in the container service cluster. All required parameters must be populated in order to send to Azure. - :ivar admin_username: Required. The administrator username to use for Linux VMs. + :ivar admin_username: The administrator username to use for Linux VMs. Required. :vartype admin_username: str - :ivar ssh: Required. The SSH configuration for Linux-based VMs running on Azure. + :ivar ssh: The SSH configuration for Linux-based VMs running on Azure. Required. :vartype ssh: ~azure.mgmt.containerservice.v2022_01_01.models.ContainerServiceSshConfiguration """ _validation = { - 'admin_username': {'required': True, 'pattern': r'^[A-Za-z][-A-Za-z0-9_]*$'}, - 'ssh': {'required': True}, + "admin_username": {"required": True, "pattern": r"^[A-Za-z][-A-Za-z0-9_]*$"}, + "ssh": {"required": True}, } _attribute_map = { - 'admin_username': {'key': 'adminUsername', 'type': 'str'}, - 'ssh': {'key': 'ssh', 'type': 'ContainerServiceSshConfiguration'}, + "admin_username": {"key": "adminUsername", "type": "str"}, + "ssh": {"key": "ssh", "type": "ContainerServiceSshConfiguration"}, } - def __init__( - self, - *, - admin_username: str, - ssh: "_models.ContainerServiceSshConfiguration", - **kwargs - ): + def __init__(self, *, admin_username: str, ssh: "_models.ContainerServiceSshConfiguration", **kwargs): """ - :keyword admin_username: Required. The administrator username to use for Linux VMs. + :keyword admin_username: The administrator username to use for Linux VMs. Required. :paramtype admin_username: str - :keyword ssh: Required. The SSH configuration for Linux-based VMs running on Azure. + :keyword ssh: The SSH configuration for Linux-based VMs running on Azure. Required. :paramtype ssh: ~azure.mgmt.containerservice.v2022_01_01.models.ContainerServiceSshConfiguration """ - super(ContainerServiceLinuxProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.admin_username = admin_username self.ssh = ssh -class ContainerServiceMasterProfile(msrest.serialization.Model): +class ContainerServiceMasterProfile(_serialization.Model): """Profile for the container service master. Variables are only populated by the server, and will be ignored when sending a request. @@ -871,11 +840,11 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar count: Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, - and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". + and 5. The default value is 1. Known values are: 1, 3, and 5. :vartype count: int or ~azure.mgmt.containerservice.v2022_01_01.models.Count - :ivar dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. + :ivar dns_prefix: DNS prefix to be used to create the FQDN for the master pool. Required. :vartype dns_prefix: str - :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + :ivar vm_size: Size of agent VMs. Required. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -912,7 +881,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :vartype vm_size: str or ~azure.mgmt.containerservice.v2022_01_01.models.ContainerServiceVMSizeTypes :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine @@ -926,7 +895,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): :vartype first_consecutive_static_ip: str :ivar storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount" and "ManagedDisks". :vartype storage_profile: str or ~azure.mgmt.containerservice.v2022_01_01.models.ContainerServiceStorageProfileTypes :ivar fqdn: FQDN for the master pool. @@ -934,21 +903,21 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): """ _validation = { - 'dns_prefix': {'required': True}, - 'vm_size': {'required': True}, - 'os_disk_size_gb': {'maximum': 2048, 'minimum': 0}, - 'fqdn': {'readonly': True}, + "dns_prefix": {"required": True}, + "vm_size": {"required": True}, + "os_disk_size_gb": {"maximum": 2048, "minimum": 0}, + "fqdn": {"readonly": True}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'dns_prefix': {'key': 'dnsPrefix', 'type': 'str'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'first_consecutive_static_ip': {'key': 'firstConsecutiveStaticIP', 'type': 'str'}, - 'storage_profile': {'key': 'storageProfile', 'type': 'str'}, - 'fqdn': {'key': 'fqdn', 'type': 'str'}, + "count": {"key": "count", "type": "int"}, + "dns_prefix": {"key": "dnsPrefix", "type": "str"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "first_consecutive_static_ip": {"key": "firstConsecutiveStaticIP", "type": "str"}, + "storage_profile": {"key": "storageProfile", "type": "str"}, + "fqdn": {"key": "fqdn", "type": "str"}, } def __init__( @@ -956,20 +925,20 @@ def __init__( *, dns_prefix: str, vm_size: Union[str, "_models.ContainerServiceVMSizeTypes"], - count: Optional[Union[int, "_models.Count"]] = 1, + count: Union[int, "_models.Count"] = 1, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, - first_consecutive_static_ip: Optional[str] = "10.240.255.5", + first_consecutive_static_ip: str = "10.240.255.5", storage_profile: Optional[Union[str, "_models.ContainerServiceStorageProfileTypes"]] = None, **kwargs ): """ :keyword count: Number of masters (VMs) in the container service cluster. Allowed values are 1, - 3, and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". + 3, and 5. The default value is 1. Known values are: 1, 3, and 5. :paramtype count: int or ~azure.mgmt.containerservice.v2022_01_01.models.Count - :keyword dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. + :keyword dns_prefix: DNS prefix to be used to create the FQDN for the master pool. Required. :paramtype dns_prefix: str - :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + :keyword vm_size: Size of agent VMs. Required. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -1006,7 +975,7 @@ def __init__( "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :paramtype vm_size: str or ~azure.mgmt.containerservice.v2022_01_01.models.ContainerServiceVMSizeTypes :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every @@ -1020,11 +989,11 @@ def __init__( :paramtype first_consecutive_static_ip: str :keyword storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount" and "ManagedDisks". :paramtype storage_profile: str or ~azure.mgmt.containerservice.v2022_01_01.models.ContainerServiceStorageProfileTypes """ - super(ContainerServiceMasterProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.dns_prefix = dns_prefix self.vm_size = vm_size @@ -1035,17 +1004,17 @@ def __init__( self.fqdn = None -class ContainerServiceNetworkProfile(msrest.serialization.Model): +class ContainerServiceNetworkProfile(_serialization.Model): # pylint: disable=too-many-instance-attributes """Profile of network configuration. :ivar network_plugin: Network plugin used for building the Kubernetes network. Known values - are: "azure", "kubenet". Default value: "kubenet". + are: "azure" and "kubenet". :vartype network_plugin: str or ~azure.mgmt.containerservice.v2022_01_01.models.NetworkPlugin :ivar network_policy: Network policy used for building the Kubernetes network. Known values - are: "calico", "azure". + are: "calico" and "azure". :vartype network_policy: str or ~azure.mgmt.containerservice.v2022_01_01.models.NetworkPolicy :ivar network_mode: This cannot be specified if networkPlugin is anything other than 'azure'. - Known values are: "transparent", "bridge". + Known values are: "transparent" and "bridge". :vartype network_mode: str or ~azure.mgmt.containerservice.v2022_01_01.models.NetworkMode :ivar pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :vartype pod_cidr: str @@ -1061,12 +1030,11 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): :ivar outbound_type: This can only be set at cluster creation time and cannot be changed later. For more information see `egress outbound type `_. Known values are: "loadBalancer", - "userDefinedRouting", "managedNATGateway", "userAssignedNATGateway". Default value: - "loadBalancer". + "userDefinedRouting", "managedNATGateway", and "userAssignedNATGateway". :vartype outbound_type: str or ~azure.mgmt.containerservice.v2022_01_01.models.OutboundType :ivar load_balancer_sku: The default is 'standard'. See `Azure Load Balancer SKUs `_ for more information about the - differences between load balancer SKUs. Known values are: "standard", "basic". + differences between load balancer SKUs. Known values are: "standard" and "basic". :vartype load_balancer_sku: str or ~azure.mgmt.containerservice.v2022_01_01.models.LoadBalancerSku :ivar load_balancer_profile: Profile of the cluster load balancer. @@ -1089,40 +1057,42 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): """ _validation = { - 'pod_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, - 'service_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, - 'dns_service_ip': {'pattern': r'^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$'}, - 'docker_bridge_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, + "pod_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, + "service_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, + "dns_service_ip": { + "pattern": r"^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$" + }, + "docker_bridge_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, } _attribute_map = { - 'network_plugin': {'key': 'networkPlugin', 'type': 'str'}, - 'network_policy': {'key': 'networkPolicy', 'type': 'str'}, - 'network_mode': {'key': 'networkMode', 'type': 'str'}, - 'pod_cidr': {'key': 'podCidr', 'type': 'str'}, - 'service_cidr': {'key': 'serviceCidr', 'type': 'str'}, - 'dns_service_ip': {'key': 'dnsServiceIP', 'type': 'str'}, - 'docker_bridge_cidr': {'key': 'dockerBridgeCidr', 'type': 'str'}, - 'outbound_type': {'key': 'outboundType', 'type': 'str'}, - 'load_balancer_sku': {'key': 'loadBalancerSku', 'type': 'str'}, - 'load_balancer_profile': {'key': 'loadBalancerProfile', 'type': 'ManagedClusterLoadBalancerProfile'}, - 'nat_gateway_profile': {'key': 'natGatewayProfile', 'type': 'ManagedClusterNATGatewayProfile'}, - 'pod_cidrs': {'key': 'podCidrs', 'type': '[str]'}, - 'service_cidrs': {'key': 'serviceCidrs', 'type': '[str]'}, - 'ip_families': {'key': 'ipFamilies', 'type': '[str]'}, + "network_plugin": {"key": "networkPlugin", "type": "str"}, + "network_policy": {"key": "networkPolicy", "type": "str"}, + "network_mode": {"key": "networkMode", "type": "str"}, + "pod_cidr": {"key": "podCidr", "type": "str"}, + "service_cidr": {"key": "serviceCidr", "type": "str"}, + "dns_service_ip": {"key": "dnsServiceIP", "type": "str"}, + "docker_bridge_cidr": {"key": "dockerBridgeCidr", "type": "str"}, + "outbound_type": {"key": "outboundType", "type": "str"}, + "load_balancer_sku": {"key": "loadBalancerSku", "type": "str"}, + "load_balancer_profile": {"key": "loadBalancerProfile", "type": "ManagedClusterLoadBalancerProfile"}, + "nat_gateway_profile": {"key": "natGatewayProfile", "type": "ManagedClusterNATGatewayProfile"}, + "pod_cidrs": {"key": "podCidrs", "type": "[str]"}, + "service_cidrs": {"key": "serviceCidrs", "type": "[str]"}, + "ip_families": {"key": "ipFamilies", "type": "[str]"}, } def __init__( self, *, - network_plugin: Optional[Union[str, "_models.NetworkPlugin"]] = "kubenet", + network_plugin: Union[str, "_models.NetworkPlugin"] = "kubenet", network_policy: Optional[Union[str, "_models.NetworkPolicy"]] = None, network_mode: Optional[Union[str, "_models.NetworkMode"]] = None, - pod_cidr: Optional[str] = "10.244.0.0/16", - service_cidr: Optional[str] = "10.0.0.0/16", - dns_service_ip: Optional[str] = "10.0.0.10", - docker_bridge_cidr: Optional[str] = "172.17.0.1/16", - outbound_type: Optional[Union[str, "_models.OutboundType"]] = "loadBalancer", + pod_cidr: str = "10.244.0.0/16", + service_cidr: str = "10.0.0.0/16", + dns_service_ip: str = "10.0.0.10", + docker_bridge_cidr: str = "172.17.0.1/16", + outbound_type: Union[str, "_models.OutboundType"] = "loadBalancer", load_balancer_sku: Optional[Union[str, "_models.LoadBalancerSku"]] = None, load_balancer_profile: Optional["_models.ManagedClusterLoadBalancerProfile"] = None, nat_gateway_profile: Optional["_models.ManagedClusterNATGatewayProfile"] = None, @@ -1133,13 +1103,13 @@ def __init__( ): """ :keyword network_plugin: Network plugin used for building the Kubernetes network. Known values - are: "azure", "kubenet". Default value: "kubenet". + are: "azure" and "kubenet". :paramtype network_plugin: str or ~azure.mgmt.containerservice.v2022_01_01.models.NetworkPlugin :keyword network_policy: Network policy used for building the Kubernetes network. Known values - are: "calico", "azure". + are: "calico" and "azure". :paramtype network_policy: str or ~azure.mgmt.containerservice.v2022_01_01.models.NetworkPolicy :keyword network_mode: This cannot be specified if networkPlugin is anything other than - 'azure'. Known values are: "transparent", "bridge". + 'azure'. Known values are: "transparent" and "bridge". :paramtype network_mode: str or ~azure.mgmt.containerservice.v2022_01_01.models.NetworkMode :keyword pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :paramtype pod_cidr: str @@ -1155,12 +1125,11 @@ def __init__( :keyword outbound_type: This can only be set at cluster creation time and cannot be changed later. For more information see `egress outbound type `_. Known values are: "loadBalancer", - "userDefinedRouting", "managedNATGateway", "userAssignedNATGateway". Default value: - "loadBalancer". + "userDefinedRouting", "managedNATGateway", and "userAssignedNATGateway". :paramtype outbound_type: str or ~azure.mgmt.containerservice.v2022_01_01.models.OutboundType :keyword load_balancer_sku: The default is 'standard'. See `Azure Load Balancer SKUs `_ for more information about the - differences between load balancer SKUs. Known values are: "standard", "basic". + differences between load balancer SKUs. Known values are: "standard" and "basic". :paramtype load_balancer_sku: str or ~azure.mgmt.containerservice.v2022_01_01.models.LoadBalancerSku :keyword load_balancer_profile: Profile of the cluster load balancer. @@ -1181,7 +1150,7 @@ def __init__( IPv6. :paramtype ip_families: list[str or ~azure.mgmt.containerservice.v2022_01_01.models.IpFamily] """ - super(ContainerServiceNetworkProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.network_plugin = network_plugin self.network_policy = network_policy self.network_mode = network_mode @@ -1198,113 +1167,98 @@ def __init__( self.ip_families = ip_families -class ContainerServiceSshConfiguration(msrest.serialization.Model): +class ContainerServiceSshConfiguration(_serialization.Model): """SSH configuration for Linux-based VMs running on Azure. All required parameters must be populated in order to send to Azure. - :ivar public_keys: Required. The list of SSH public keys used to authenticate with Linux-based - VMs. A maximum of 1 key may be specified. + :ivar public_keys: The list of SSH public keys used to authenticate with Linux-based VMs. A + maximum of 1 key may be specified. Required. :vartype public_keys: list[~azure.mgmt.containerservice.v2022_01_01.models.ContainerServiceSshPublicKey] """ _validation = { - 'public_keys': {'required': True}, + "public_keys": {"required": True}, } _attribute_map = { - 'public_keys': {'key': 'publicKeys', 'type': '[ContainerServiceSshPublicKey]'}, + "public_keys": {"key": "publicKeys", "type": "[ContainerServiceSshPublicKey]"}, } - def __init__( - self, - *, - public_keys: List["_models.ContainerServiceSshPublicKey"], - **kwargs - ): + def __init__(self, *, public_keys: List["_models.ContainerServiceSshPublicKey"], **kwargs): """ - :keyword public_keys: Required. The list of SSH public keys used to authenticate with - Linux-based VMs. A maximum of 1 key may be specified. + :keyword public_keys: The list of SSH public keys used to authenticate with Linux-based VMs. A + maximum of 1 key may be specified. Required. :paramtype public_keys: list[~azure.mgmt.containerservice.v2022_01_01.models.ContainerServiceSshPublicKey] """ - super(ContainerServiceSshConfiguration, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_keys = public_keys -class ContainerServiceSshPublicKey(msrest.serialization.Model): +class ContainerServiceSshPublicKey(_serialization.Model): """Contains information about SSH certificate public key data. All required parameters must be populated in order to send to Azure. - :ivar key_data: Required. Certificate public key used to authenticate with VMs through SSH. The - certificate must be in PEM format with or without headers. + :ivar key_data: Certificate public key used to authenticate with VMs through SSH. The + certificate must be in PEM format with or without headers. Required. :vartype key_data: str """ _validation = { - 'key_data': {'required': True}, + "key_data": {"required": True}, } _attribute_map = { - 'key_data': {'key': 'keyData', 'type': 'str'}, + "key_data": {"key": "keyData", "type": "str"}, } - def __init__( - self, - *, - key_data: str, - **kwargs - ): + def __init__(self, *, key_data: str, **kwargs): """ - :keyword key_data: Required. Certificate public key used to authenticate with VMs through SSH. - The certificate must be in PEM format with or without headers. + :keyword key_data: Certificate public key used to authenticate with VMs through SSH. The + certificate must be in PEM format with or without headers. Required. :paramtype key_data: str """ - super(ContainerServiceSshPublicKey, self).__init__(**kwargs) + super().__init__(**kwargs) self.key_data = key_data -class ContainerServiceVMDiagnostics(msrest.serialization.Model): +class ContainerServiceVMDiagnostics(_serialization.Model): """Profile for diagnostics on the container service VMs. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar enabled: Required. Whether the VM diagnostic agent is provisioned on the VM. + :ivar enabled: Whether the VM diagnostic agent is provisioned on the VM. Required. :vartype enabled: bool :ivar storage_uri: The URI of the storage account where diagnostics are stored. :vartype storage_uri: str """ _validation = { - 'enabled': {'required': True}, - 'storage_uri': {'readonly': True}, + "enabled": {"required": True}, + "storage_uri": {"readonly": True}, } _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'storage_uri': {'key': 'storageUri', 'type': 'str'}, + "enabled": {"key": "enabled", "type": "bool"}, + "storage_uri": {"key": "storageUri", "type": "str"}, } - def __init__( - self, - *, - enabled: bool, - **kwargs - ): + def __init__(self, *, enabled: bool, **kwargs): """ - :keyword enabled: Required. Whether the VM diagnostic agent is provisioned on the VM. + :keyword enabled: Whether the VM diagnostic agent is provisioned on the VM. Required. :paramtype enabled: bool """ - super(ContainerServiceVMDiagnostics, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.storage_uri = None -class CreationData(msrest.serialization.Model): +class CreationData(_serialization.Model): """Data used when creating a target resource from a source resource. :ivar source_resource_id: This is the ARM ID of the source object to be used to create the @@ -1313,25 +1267,20 @@ class CreationData(msrest.serialization.Model): """ _attribute_map = { - 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, + "source_resource_id": {"key": "sourceResourceId", "type": "str"}, } - def __init__( - self, - *, - source_resource_id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, source_resource_id: Optional[str] = None, **kwargs): """ :keyword source_resource_id: This is the ARM ID of the source object to be used to create the target object. :paramtype source_resource_id: str """ - super(CreationData, self).__init__(**kwargs) + super().__init__(**kwargs) self.source_resource_id = source_resource_id -class CredentialResult(msrest.serialization.Model): +class CredentialResult(_serialization.Model): """The credential result response. Variables are only populated by the server, and will be ignored when sending a request. @@ -1339,31 +1288,27 @@ class CredentialResult(msrest.serialization.Model): :ivar name: The name of the credential. :vartype name: str :ivar value: Base64-encoded Kubernetes configuration file. - :vartype value: bytearray + :vartype value: bytes """ _validation = { - 'name': {'readonly': True}, - 'value': {'readonly': True}, + "name": {"readonly": True}, + "value": {"readonly": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'bytearray'}, + "name": {"key": "name", "type": "str"}, + "value": {"key": "value", "type": "bytearray"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(CredentialResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.name = None self.value = None -class CredentialResults(msrest.serialization.Model): +class CredentialResults(_serialization.Model): """The list credential result response. Variables are only populated by the server, and will be ignored when sending a request. @@ -1373,24 +1318,20 @@ class CredentialResults(msrest.serialization.Model): """ _validation = { - 'kubeconfigs': {'readonly': True}, + "kubeconfigs": {"readonly": True}, } _attribute_map = { - 'kubeconfigs': {'key': 'kubeconfigs', 'type': '[CredentialResult]'}, + "kubeconfigs": {"key": "kubeconfigs", "type": "[CredentialResult]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(CredentialResults, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.kubeconfigs = None -class EndpointDependency(msrest.serialization.Model): +class EndpointDependency(_serialization.Model): """A domain name that AKS agent nodes are reaching at. :ivar domain_name: The domain name of the dependency. @@ -1400,8 +1341,8 @@ class EndpointDependency(msrest.serialization.Model): """ _attribute_map = { - 'domain_name': {'key': 'domainName', 'type': 'str'}, - 'endpoint_details': {'key': 'endpointDetails', 'type': '[EndpointDetail]'}, + "domain_name": {"key": "domainName", "type": "str"}, + "endpoint_details": {"key": "endpointDetails", "type": "[EndpointDetail]"}, } def __init__( @@ -1418,12 +1359,12 @@ def __init__( :paramtype endpoint_details: list[~azure.mgmt.containerservice.v2022_01_01.models.EndpointDetail] """ - super(EndpointDependency, self).__init__(**kwargs) + super().__init__(**kwargs) self.domain_name = domain_name self.endpoint_details = endpoint_details -class EndpointDetail(msrest.serialization.Model): +class EndpointDetail(_serialization.Model): """connect information from the AKS agent nodes to a single endpoint. :ivar ip_address: An IP Address that Domain Name currently resolves to. @@ -1437,10 +1378,10 @@ class EndpointDetail(msrest.serialization.Model): """ _attribute_map = { - 'ip_address': {'key': 'ipAddress', 'type': 'str'}, - 'port': {'key': 'port', 'type': 'int'}, - 'protocol': {'key': 'protocol', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, + "ip_address": {"key": "ipAddress", "type": "str"}, + "port": {"key": "port", "type": "int"}, + "protocol": {"key": "protocol", "type": "str"}, + "description": {"key": "description", "type": "str"}, } def __init__( @@ -1462,25 +1403,25 @@ def __init__( :keyword description: Description of the detail. :paramtype description: str """ - super(EndpointDetail, self).__init__(**kwargs) + super().__init__(**kwargs) self.ip_address = ip_address self.port = port self.protocol = protocol self.description = description -class ExtendedLocation(msrest.serialization.Model): +class ExtendedLocation(_serialization.Model): """The complex type of the extended location. :ivar name: The name of the extended location. :vartype name: str - :ivar type: The type of the extended location. Known values are: "EdgeZone". + :ivar type: The type of the extended location. "EdgeZone" :vartype type: str or ~azure.mgmt.containerservice.v2022_01_01.models.ExtendedLocationTypes """ _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, } def __init__( @@ -1493,15 +1434,15 @@ def __init__( """ :keyword name: The name of the extended location. :paramtype name: str - :keyword type: The type of the extended location. Known values are: "EdgeZone". + :keyword type: The type of the extended location. "EdgeZone" :paramtype type: str or ~azure.mgmt.containerservice.v2022_01_01.models.ExtendedLocationTypes """ - super(ExtendedLocation, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.type = type -class KubeletConfig(msrest.serialization.Model): +class KubeletConfig(_serialization.Model): # pylint: disable=too-many-instance-attributes """See `AKS custom node configuration `_ for more details. :ivar cpu_manager_policy: The default is 'none'. See `Kubernetes CPU management policies @@ -1541,21 +1482,21 @@ class KubeletConfig(msrest.serialization.Model): """ _validation = { - 'container_log_max_files': {'minimum': 2}, + "container_log_max_files": {"minimum": 2}, } _attribute_map = { - 'cpu_manager_policy': {'key': 'cpuManagerPolicy', 'type': 'str'}, - 'cpu_cfs_quota': {'key': 'cpuCfsQuota', 'type': 'bool'}, - 'cpu_cfs_quota_period': {'key': 'cpuCfsQuotaPeriod', 'type': 'str'}, - 'image_gc_high_threshold': {'key': 'imageGcHighThreshold', 'type': 'int'}, - 'image_gc_low_threshold': {'key': 'imageGcLowThreshold', 'type': 'int'}, - 'topology_manager_policy': {'key': 'topologyManagerPolicy', 'type': 'str'}, - 'allowed_unsafe_sysctls': {'key': 'allowedUnsafeSysctls', 'type': '[str]'}, - 'fail_swap_on': {'key': 'failSwapOn', 'type': 'bool'}, - 'container_log_max_size_mb': {'key': 'containerLogMaxSizeMB', 'type': 'int'}, - 'container_log_max_files': {'key': 'containerLogMaxFiles', 'type': 'int'}, - 'pod_max_pids': {'key': 'podMaxPids', 'type': 'int'}, + "cpu_manager_policy": {"key": "cpuManagerPolicy", "type": "str"}, + "cpu_cfs_quota": {"key": "cpuCfsQuota", "type": "bool"}, + "cpu_cfs_quota_period": {"key": "cpuCfsQuotaPeriod", "type": "str"}, + "image_gc_high_threshold": {"key": "imageGcHighThreshold", "type": "int"}, + "image_gc_low_threshold": {"key": "imageGcLowThreshold", "type": "int"}, + "topology_manager_policy": {"key": "topologyManagerPolicy", "type": "str"}, + "allowed_unsafe_sysctls": {"key": "allowedUnsafeSysctls", "type": "[str]"}, + "fail_swap_on": {"key": "failSwapOn", "type": "bool"}, + "container_log_max_size_mb": {"key": "containerLogMaxSizeMB", "type": "int"}, + "container_log_max_files": {"key": "containerLogMaxFiles", "type": "int"}, + "pod_max_pids": {"key": "podMaxPids", "type": "int"}, } def __init__( @@ -1610,7 +1551,7 @@ def __init__( :keyword pod_max_pids: The maximum number of processes per pod. :paramtype pod_max_pids: int """ - super(KubeletConfig, self).__init__(**kwargs) + super().__init__(**kwargs) self.cpu_manager_policy = cpu_manager_policy self.cpu_cfs_quota = cpu_cfs_quota self.cpu_cfs_quota_period = cpu_cfs_quota_period @@ -1624,7 +1565,7 @@ def __init__( self.pod_max_pids = pod_max_pids -class LinuxOSConfig(msrest.serialization.Model): +class LinuxOSConfig(_serialization.Model): """See `AKS custom node configuration `_ for more details. :ivar sysctls: Sysctl settings for Linux agent nodes. @@ -1643,10 +1584,10 @@ class LinuxOSConfig(msrest.serialization.Model): """ _attribute_map = { - 'sysctls': {'key': 'sysctls', 'type': 'SysctlConfig'}, - 'transparent_huge_page_enabled': {'key': 'transparentHugePageEnabled', 'type': 'str'}, - 'transparent_huge_page_defrag': {'key': 'transparentHugePageDefrag', 'type': 'str'}, - 'swap_file_size_mb': {'key': 'swapFileSizeMB', 'type': 'int'}, + "sysctls": {"key": "sysctls", "type": "SysctlConfig"}, + "transparent_huge_page_enabled": {"key": "transparentHugePageEnabled", "type": "str"}, + "transparent_huge_page_defrag": {"key": "transparentHugePageDefrag", "type": "str"}, + "swap_file_size_mb": {"key": "swapFileSizeMB", "type": "int"}, } def __init__( @@ -1673,7 +1614,7 @@ def __init__( :keyword swap_file_size_mb: The size in MB of a swap file that will be created on each node. :paramtype swap_file_size_mb: int """ - super(LinuxOSConfig, self).__init__(**kwargs) + super().__init__(**kwargs) self.sysctls = sysctls self.transparent_huge_page_enabled = transparent_huge_page_enabled self.transparent_huge_page_defrag = transparent_huge_page_defrag @@ -1702,19 +1643,19 @@ class MaintenanceConfiguration(SubResource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, + "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'}, - 'time_in_week': {'key': 'properties.timeInWeek', 'type': '[TimeInWeek]'}, - 'not_allowed_time': {'key': 'properties.notAllowedTime', 'type': '[TimeSpan]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "time_in_week": {"key": "properties.timeInWeek", "type": "[TimeInWeek]"}, + "not_allowed_time": {"key": "properties.notAllowedTime", "type": "[TimeSpan]"}, } def __init__( @@ -1731,13 +1672,13 @@ def __init__( :keyword not_allowed_time: Time slots on which upgrade is not allowed. :paramtype not_allowed_time: list[~azure.mgmt.containerservice.v2022_01_01.models.TimeSpan] """ - super(MaintenanceConfiguration, self).__init__(**kwargs) + super().__init__(**kwargs) self.system_data = None self.time_in_week = time_in_week self.not_allowed_time = not_allowed_time -class MaintenanceConfigurationListResult(msrest.serialization.Model): +class MaintenanceConfigurationListResult(_serialization.Model): """The response from the List maintenance configurations operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -1749,31 +1690,26 @@ class MaintenanceConfigurationListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[MaintenanceConfiguration]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[MaintenanceConfiguration]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.MaintenanceConfiguration"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.MaintenanceConfiguration"]] = None, **kwargs): """ :keyword value: The list of maintenance configurations. :paramtype value: list[~azure.mgmt.containerservice.v2022_01_01.models.MaintenanceConfiguration] """ - super(MaintenanceConfigurationListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class Resource(msrest.serialization.Model): +class Resource(_serialization.Model): """The Resource model definition. Variables are only populated by the server, and will be ignored when sending a request. @@ -1786,41 +1722,35 @@ class Resource(msrest.serialization.Model): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] """ - super(Resource, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -1828,7 +1758,7 @@ def __init__( self.tags = tags -class ManagedCluster(Resource): +class ManagedCluster(Resource): # pylint: disable=too-many-instance-attributes """Managed cluster. Variables are only populated by the server, and will be ignored when sending a request. @@ -1841,9 +1771,9 @@ class ManagedCluster(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar sku: The managed cluster SKU. :vartype sku: ~azure.mgmt.containerservice.v2022_01_01.models.ManagedClusterSKU @@ -1939,66 +1869,75 @@ class ManagedCluster(Resource): :vartype security_profile: ~azure.mgmt.containerservice.v2022_01_01.models.ManagedClusterSecurityProfile :ivar public_network_access: Allow or deny public network access for AKS. Known values are: - "Enabled", "Disabled". + "Enabled" and "Disabled". :vartype public_network_access: str or ~azure.mgmt.containerservice.v2022_01_01.models.PublicNetworkAccess """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'provisioning_state': {'readonly': True}, - 'power_state': {'readonly': True}, - 'max_agent_pools': {'readonly': True}, - 'fqdn': {'readonly': True}, - 'private_fqdn': {'readonly': True}, - 'azure_portal_fqdn': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, + "provisioning_state": {"readonly": True}, + "power_state": {"readonly": True}, + "max_agent_pools": {"readonly": True}, + "fqdn": {"readonly": True}, + "private_fqdn": {"readonly": True}, + "azure_portal_fqdn": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'ManagedClusterSKU'}, - 'extended_location': {'key': 'extendedLocation', 'type': 'ExtendedLocation'}, - 'identity': {'key': 'identity', 'type': 'ManagedClusterIdentity'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'power_state': {'key': 'properties.powerState', 'type': 'PowerState'}, - 'max_agent_pools': {'key': 'properties.maxAgentPools', 'type': 'int'}, - 'kubernetes_version': {'key': 'properties.kubernetesVersion', 'type': 'str'}, - 'dns_prefix': {'key': 'properties.dnsPrefix', 'type': 'str'}, - 'fqdn_subdomain': {'key': 'properties.fqdnSubdomain', 'type': 'str'}, - 'fqdn': {'key': 'properties.fqdn', 'type': 'str'}, - 'private_fqdn': {'key': 'properties.privateFQDN', 'type': 'str'}, - 'azure_portal_fqdn': {'key': 'properties.azurePortalFQDN', 'type': 'str'}, - 'agent_pool_profiles': {'key': 'properties.agentPoolProfiles', 'type': '[ManagedClusterAgentPoolProfile]'}, - 'linux_profile': {'key': 'properties.linuxProfile', 'type': 'ContainerServiceLinuxProfile'}, - 'windows_profile': {'key': 'properties.windowsProfile', 'type': 'ManagedClusterWindowsProfile'}, - 'service_principal_profile': {'key': 'properties.servicePrincipalProfile', 'type': 'ManagedClusterServicePrincipalProfile'}, - 'addon_profiles': {'key': 'properties.addonProfiles', 'type': '{ManagedClusterAddonProfile}'}, - 'pod_identity_profile': {'key': 'properties.podIdentityProfile', 'type': 'ManagedClusterPodIdentityProfile'}, - 'node_resource_group': {'key': 'properties.nodeResourceGroup', 'type': 'str'}, - 'enable_rbac': {'key': 'properties.enableRBAC', 'type': 'bool'}, - 'enable_pod_security_policy': {'key': 'properties.enablePodSecurityPolicy', 'type': 'bool'}, - 'network_profile': {'key': 'properties.networkProfile', 'type': 'ContainerServiceNetworkProfile'}, - 'aad_profile': {'key': 'properties.aadProfile', 'type': 'ManagedClusterAADProfile'}, - 'auto_upgrade_profile': {'key': 'properties.autoUpgradeProfile', 'type': 'ManagedClusterAutoUpgradeProfile'}, - 'auto_scaler_profile': {'key': 'properties.autoScalerProfile', 'type': 'ManagedClusterPropertiesAutoScalerProfile'}, - 'api_server_access_profile': {'key': 'properties.apiServerAccessProfile', 'type': 'ManagedClusterAPIServerAccessProfile'}, - 'disk_encryption_set_id': {'key': 'properties.diskEncryptionSetID', 'type': 'str'}, - 'identity_profile': {'key': 'properties.identityProfile', 'type': '{UserAssignedIdentity}'}, - 'private_link_resources': {'key': 'properties.privateLinkResources', 'type': '[PrivateLinkResource]'}, - 'disable_local_accounts': {'key': 'properties.disableLocalAccounts', 'type': 'bool'}, - 'http_proxy_config': {'key': 'properties.httpProxyConfig', 'type': 'ManagedClusterHTTPProxyConfig'}, - 'security_profile': {'key': 'properties.securityProfile', 'type': 'ManagedClusterSecurityProfile'}, - 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, - } - - def __init__( + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "sku": {"key": "sku", "type": "ManagedClusterSKU"}, + "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, + "identity": {"key": "identity", "type": "ManagedClusterIdentity"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "power_state": {"key": "properties.powerState", "type": "PowerState"}, + "max_agent_pools": {"key": "properties.maxAgentPools", "type": "int"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "dns_prefix": {"key": "properties.dnsPrefix", "type": "str"}, + "fqdn_subdomain": {"key": "properties.fqdnSubdomain", "type": "str"}, + "fqdn": {"key": "properties.fqdn", "type": "str"}, + "private_fqdn": {"key": "properties.privateFQDN", "type": "str"}, + "azure_portal_fqdn": {"key": "properties.azurePortalFQDN", "type": "str"}, + "agent_pool_profiles": {"key": "properties.agentPoolProfiles", "type": "[ManagedClusterAgentPoolProfile]"}, + "linux_profile": {"key": "properties.linuxProfile", "type": "ContainerServiceLinuxProfile"}, + "windows_profile": {"key": "properties.windowsProfile", "type": "ManagedClusterWindowsProfile"}, + "service_principal_profile": { + "key": "properties.servicePrincipalProfile", + "type": "ManagedClusterServicePrincipalProfile", + }, + "addon_profiles": {"key": "properties.addonProfiles", "type": "{ManagedClusterAddonProfile}"}, + "pod_identity_profile": {"key": "properties.podIdentityProfile", "type": "ManagedClusterPodIdentityProfile"}, + "node_resource_group": {"key": "properties.nodeResourceGroup", "type": "str"}, + "enable_rbac": {"key": "properties.enableRBAC", "type": "bool"}, + "enable_pod_security_policy": {"key": "properties.enablePodSecurityPolicy", "type": "bool"}, + "network_profile": {"key": "properties.networkProfile", "type": "ContainerServiceNetworkProfile"}, + "aad_profile": {"key": "properties.aadProfile", "type": "ManagedClusterAADProfile"}, + "auto_upgrade_profile": {"key": "properties.autoUpgradeProfile", "type": "ManagedClusterAutoUpgradeProfile"}, + "auto_scaler_profile": { + "key": "properties.autoScalerProfile", + "type": "ManagedClusterPropertiesAutoScalerProfile", + }, + "api_server_access_profile": { + "key": "properties.apiServerAccessProfile", + "type": "ManagedClusterAPIServerAccessProfile", + }, + "disk_encryption_set_id": {"key": "properties.diskEncryptionSetID", "type": "str"}, + "identity_profile": {"key": "properties.identityProfile", "type": "{UserAssignedIdentity}"}, + "private_link_resources": {"key": "properties.privateLinkResources", "type": "[PrivateLinkResource]"}, + "disable_local_accounts": {"key": "properties.disableLocalAccounts", "type": "bool"}, + "http_proxy_config": {"key": "properties.httpProxyConfig", "type": "ManagedClusterHTTPProxyConfig"}, + "security_profile": {"key": "properties.securityProfile", "type": "ManagedClusterSecurityProfile"}, + "public_network_access": {"key": "properties.publicNetworkAccess", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, location: str, @@ -2033,9 +1972,9 @@ def __init__( **kwargs ): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword sku: The managed cluster SKU. :paramtype sku: ~azure.mgmt.containerservice.v2022_01_01.models.ManagedClusterSKU @@ -2119,11 +2058,11 @@ def __init__( :paramtype security_profile: ~azure.mgmt.containerservice.v2022_01_01.models.ManagedClusterSecurityProfile :keyword public_network_access: Allow or deny public network access for AKS. Known values are: - "Enabled", "Disabled". + "Enabled" and "Disabled". :paramtype public_network_access: str or ~azure.mgmt.containerservice.v2022_01_01.models.PublicNetworkAccess """ - super(ManagedCluster, self).__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.sku = sku self.extended_location = extended_location self.identity = identity @@ -2159,7 +2098,7 @@ def __init__( self.public_network_access = public_network_access -class ManagedClusterAADProfile(msrest.serialization.Model): +class ManagedClusterAADProfile(_serialization.Model): """For more details see `managed AAD on AKS `_. :ivar managed: Whether to enable managed AAD. @@ -2181,13 +2120,13 @@ class ManagedClusterAADProfile(msrest.serialization.Model): """ _attribute_map = { - 'managed': {'key': 'managed', 'type': 'bool'}, - 'enable_azure_rbac': {'key': 'enableAzureRBAC', 'type': 'bool'}, - 'admin_group_object_i_ds': {'key': 'adminGroupObjectIDs', 'type': '[str]'}, - 'client_app_id': {'key': 'clientAppID', 'type': 'str'}, - 'server_app_id': {'key': 'serverAppID', 'type': 'str'}, - 'server_app_secret': {'key': 'serverAppSecret', 'type': 'str'}, - 'tenant_id': {'key': 'tenantID', 'type': 'str'}, + "managed": {"key": "managed", "type": "bool"}, + "enable_azure_rbac": {"key": "enableAzureRBAC", "type": "bool"}, + "admin_group_object_i_ds": {"key": "adminGroupObjectIDs", "type": "[str]"}, + "client_app_id": {"key": "clientAppID", "type": "str"}, + "server_app_id": {"key": "serverAppID", "type": "str"}, + "server_app_secret": {"key": "serverAppSecret", "type": "str"}, + "tenant_id": {"key": "tenantID", "type": "str"}, } def __init__( @@ -2220,7 +2159,7 @@ def __init__( tenant of the deployment subscription. :paramtype tenant_id: str """ - super(ManagedClusterAADProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.managed = managed self.enable_azure_rbac = enable_azure_rbac self.admin_group_object_i_ds = admin_group_object_i_ds @@ -2243,58 +2182,53 @@ class ManagedClusterAccessProfile(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar kube_config: Base64-encoded Kubernetes configuration file. - :vartype kube_config: bytearray + :vartype kube_config: bytes """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'kube_config': {'key': 'properties.kubeConfig', 'type': 'bytearray'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "kube_config": {"key": "properties.kubeConfig", "type": "bytearray"}, } def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - kube_config: Optional[bytearray] = None, - **kwargs + self, *, location: str, tags: Optional[Dict[str, str]] = None, kube_config: Optional[bytes] = None, **kwargs ): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword kube_config: Base64-encoded Kubernetes configuration file. - :paramtype kube_config: bytearray + :paramtype kube_config: bytes """ - super(ManagedClusterAccessProfile, self).__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.kube_config = kube_config -class ManagedClusterAddonProfile(msrest.serialization.Model): +class ManagedClusterAddonProfile(_serialization.Model): """A Kubernetes add-on profile for a managed cluster. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar enabled: Required. Whether the add-on is enabled or not. + :ivar enabled: Whether the add-on is enabled or not. Required. :vartype enabled: bool :ivar config: Key-value pairs for configuring an add-on. :vartype config: dict[str, str] @@ -2304,36 +2238,30 @@ class ManagedClusterAddonProfile(msrest.serialization.Model): """ _validation = { - 'enabled': {'required': True}, - 'identity': {'readonly': True}, + "enabled": {"required": True}, + "identity": {"readonly": True}, } _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'config': {'key': 'config', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'ManagedClusterAddonProfileIdentity'}, + "enabled": {"key": "enabled", "type": "bool"}, + "config": {"key": "config", "type": "{str}"}, + "identity": {"key": "identity", "type": "ManagedClusterAddonProfileIdentity"}, } - def __init__( - self, - *, - enabled: bool, - config: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, enabled: bool, config: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword enabled: Required. Whether the add-on is enabled or not. + :keyword enabled: Whether the add-on is enabled or not. Required. :paramtype enabled: bool :keyword config: Key-value pairs for configuring an add-on. :paramtype config: dict[str, str] """ - super(ManagedClusterAddonProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.config = config self.identity = None -class UserAssignedIdentity(msrest.serialization.Model): +class UserAssignedIdentity(_serialization.Model): """Details about a user assigned identity. :ivar resource_id: The resource ID of the user assigned identity. @@ -2345,9 +2273,9 @@ class UserAssignedIdentity(msrest.serialization.Model): """ _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'object_id': {'key': 'objectId', 'type': 'str'}, + "resource_id": {"key": "resourceId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + "object_id": {"key": "objectId", "type": "str"}, } def __init__( @@ -2366,7 +2294,7 @@ def __init__( :keyword object_id: The object ID of the user assigned identity. :paramtype object_id: str """ - super(UserAssignedIdentity, self).__init__(**kwargs) + super().__init__(**kwargs) self.resource_id = resource_id self.client_id = client_id self.object_id = object_id @@ -2384,9 +2312,9 @@ class ManagedClusterAddonProfileIdentity(UserAssignedIdentity): """ _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'object_id': {'key': 'objectId', 'type': 'str'}, + "resource_id": {"key": "resourceId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + "object_id": {"key": "objectId", "type": "str"}, } def __init__( @@ -2405,10 +2333,10 @@ def __init__( :keyword object_id: The object ID of the user assigned identity. :paramtype object_id: str """ - super(ManagedClusterAddonProfileIdentity, self).__init__(resource_id=resource_id, client_id=client_id, object_id=object_id, **kwargs) + super().__init__(resource_id=resource_id, client_id=client_id, object_id=object_id, **kwargs) -class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): +class ManagedClusterAgentPoolProfileProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes """Properties for the container service agent pool profile. Variables are only populated by the server, and will be ignored when sending a request. @@ -2429,14 +2357,14 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2022_01_01.models.OSDiskType :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data - root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_01_01.models.KubeletDiskType :ivar workload_runtime: Determines the type of workload a node can run. Known values are: - "OCIContainer", "WasmWasi". + "OCIContainer" and "WasmWasi". :vartype workload_runtime: str or ~azure.mgmt.containerservice.v2022_01_01.models.WorkloadRuntime :ivar vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and used. @@ -2450,11 +2378,11 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :vartype pod_subnet_id: str :ivar max_pods: The maximum number of pods that can run on a node. :vartype max_pods: int - :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_01_01.models.OSType :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known - values are: "Ubuntu", "CBLMariner". + values are: "Ubuntu" and "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2022_01_01.models.OSSKU :ivar max_count: The maximum number of nodes for auto-scaling. :vartype max_count: int @@ -2463,14 +2391,14 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it - defaults to Delete. Known values are: "Delete", "Deallocate". + defaults to Delete. Known values are: "Delete" and "Deallocate". :vartype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_01_01.models.ScaleDownMode - :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", + :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets" and "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2022_01_01.models.AgentPoolType :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :vartype mode: str or ~azure.mgmt.containerservice.v2022_01_01.models.AgentPoolMode :ivar orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -2505,20 +2433,18 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default - is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + is 'Regular'. Known values are: "Spot" and "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_01_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_01_01.models.ScaleSetEvictionPolicy :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :vartype spot_max_price: float - :ivar tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :ivar tags: The tags to be persisted on the agent pool virtual machine scale set. :vartype tags: dict[str, str] :ivar node_labels: The node labels to be persisted across all nodes in agent pool. :vartype node_labels: dict[str, str] @@ -2542,7 +2468,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): for more details. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_01_01.models.GPUInstanceProfile :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the node pool @@ -2551,54 +2477,54 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): """ _validation = { - 'os_disk_size_gb': {'maximum': 2048, 'minimum': 0}, - 'node_image_version': {'readonly': True}, - 'provisioning_state': {'readonly': True}, + "os_disk_size_gb": {"maximum": 2048, "minimum": 0}, + "node_image_version": {"readonly": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'os_disk_type': {'key': 'osDiskType', 'type': 'str'}, - 'kubelet_disk_type': {'key': 'kubeletDiskType', 'type': 'str'}, - 'workload_runtime': {'key': 'workloadRuntime', 'type': 'str'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'pod_subnet_id': {'key': 'podSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'maxPods', 'type': 'int'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'os_sku': {'key': 'osSKU', 'type': 'str'}, - 'max_count': {'key': 'maxCount', 'type': 'int'}, - 'min_count': {'key': 'minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'enableAutoScaling', 'type': 'bool'}, - 'scale_down_mode': {'key': 'scaleDownMode', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'mode': {'key': 'mode', 'type': 'str'}, - 'orchestrator_version': {'key': 'orchestratorVersion', 'type': 'str'}, - 'node_image_version': {'key': 'nodeImageVersion', 'type': 'str'}, - 'upgrade_settings': {'key': 'upgradeSettings', 'type': 'AgentPoolUpgradeSettings'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'power_state': {'key': 'powerState', 'type': 'PowerState'}, - 'availability_zones': {'key': 'availabilityZones', 'type': '[str]'}, - 'enable_node_public_ip': {'key': 'enableNodePublicIP', 'type': 'bool'}, - 'node_public_ip_prefix_id': {'key': 'nodePublicIPPrefixID', 'type': 'str'}, - 'scale_set_priority': {'key': 'scaleSetPriority', 'type': 'str'}, - 'scale_set_eviction_policy': {'key': 'scaleSetEvictionPolicy', 'type': 'str'}, - 'spot_max_price': {'key': 'spotMaxPrice', 'type': 'float'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'node_labels': {'key': 'nodeLabels', 'type': '{str}'}, - 'node_taints': {'key': 'nodeTaints', 'type': '[str]'}, - 'proximity_placement_group_id': {'key': 'proximityPlacementGroupID', 'type': 'str'}, - 'kubelet_config': {'key': 'kubeletConfig', 'type': 'KubeletConfig'}, - 'linux_os_config': {'key': 'linuxOSConfig', 'type': 'LinuxOSConfig'}, - 'enable_encryption_at_host': {'key': 'enableEncryptionAtHost', 'type': 'bool'}, - 'enable_ultra_ssd': {'key': 'enableUltraSSD', 'type': 'bool'}, - 'enable_fips': {'key': 'enableFIPS', 'type': 'bool'}, - 'gpu_instance_profile': {'key': 'gpuInstanceProfile', 'type': 'str'}, - 'creation_data': {'key': 'creationData', 'type': 'CreationData'}, - } - - def __init__( + "count": {"key": "count", "type": "int"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "os_disk_type": {"key": "osDiskType", "type": "str"}, + "kubelet_disk_type": {"key": "kubeletDiskType", "type": "str"}, + "workload_runtime": {"key": "workloadRuntime", "type": "str"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "pod_subnet_id": {"key": "podSubnetID", "type": "str"}, + "max_pods": {"key": "maxPods", "type": "int"}, + "os_type": {"key": "osType", "type": "str"}, + "os_sku": {"key": "osSKU", "type": "str"}, + "max_count": {"key": "maxCount", "type": "int"}, + "min_count": {"key": "minCount", "type": "int"}, + "enable_auto_scaling": {"key": "enableAutoScaling", "type": "bool"}, + "scale_down_mode": {"key": "scaleDownMode", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "mode": {"key": "mode", "type": "str"}, + "orchestrator_version": {"key": "orchestratorVersion", "type": "str"}, + "node_image_version": {"key": "nodeImageVersion", "type": "str"}, + "upgrade_settings": {"key": "upgradeSettings", "type": "AgentPoolUpgradeSettings"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "power_state": {"key": "powerState", "type": "PowerState"}, + "availability_zones": {"key": "availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "enableNodePublicIP", "type": "bool"}, + "node_public_ip_prefix_id": {"key": "nodePublicIPPrefixID", "type": "str"}, + "scale_set_priority": {"key": "scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "scaleSetEvictionPolicy", "type": "str"}, + "spot_max_price": {"key": "spotMaxPrice", "type": "float"}, + "tags": {"key": "tags", "type": "{str}"}, + "node_labels": {"key": "nodeLabels", "type": "{str}"}, + "node_taints": {"key": "nodeTaints", "type": "[str]"}, + "proximity_placement_group_id": {"key": "proximityPlacementGroupID", "type": "str"}, + "kubelet_config": {"key": "kubeletConfig", "type": "KubeletConfig"}, + "linux_os_config": {"key": "linuxOSConfig", "type": "LinuxOSConfig"}, + "enable_encryption_at_host": {"key": "enableEncryptionAtHost", "type": "bool"}, + "enable_ultra_ssd": {"key": "enableUltraSSD", "type": "bool"}, + "enable_fips": {"key": "enableFIPS", "type": "bool"}, + "gpu_instance_profile": {"key": "gpuInstanceProfile", "type": "str"}, + "creation_data": {"key": "creationData", "type": "CreationData"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, count: Optional[int] = None, @@ -2610,7 +2536,7 @@ def __init__( vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, @@ -2624,9 +2550,9 @@ def __init__( availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", - spot_max_price: Optional[float] = -1, + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", + spot_max_price: float = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, @@ -2657,14 +2583,14 @@ def __init__( larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2022_01_01.models.OSDiskType :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime - data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + data root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_01_01.models.KubeletDiskType :keyword workload_runtime: Determines the type of workload a node can run. Known values are: - "OCIContainer", "WasmWasi". + "OCIContainer" and "WasmWasi". :paramtype workload_runtime: str or ~azure.mgmt.containerservice.v2022_01_01.models.WorkloadRuntime :keyword vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and @@ -2678,11 +2604,11 @@ def __init__( :paramtype pod_subnet_id: str :keyword max_pods: The maximum number of pods that can run on a node. :paramtype max_pods: int - :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_01_01.models.OSType :keyword os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Known values are: "Ubuntu", "CBLMariner". + Known values are: "Ubuntu" and "CBLMariner". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2022_01_01.models.OSSKU :keyword max_count: The maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -2691,15 +2617,15 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, - it defaults to Delete. Known values are: "Delete", "Deallocate". + it defaults to Delete. Known values are: "Delete" and "Deallocate". :paramtype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_01_01.models.ScaleDownMode - :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", + :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2022_01_01.models.AgentPoolType :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2022_01_01.models.AgentPoolMode :keyword orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -2730,20 +2656,18 @@ def __init__( /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the - default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + default is 'Regular'. Known values are: "Spot" and "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_01_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_01_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :paramtype spot_max_price: float - :keyword tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :keyword tags: The tags to be persisted on the agent pool virtual machine scale set. :paramtype tags: dict[str, str] :keyword node_labels: The node labels to be persisted across all nodes in agent pool. :paramtype node_labels: dict[str, str] @@ -2767,7 +2691,7 @@ def __init__( for more details. :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance - profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_01_01.models.GPUInstanceProfile @@ -2775,7 +2699,7 @@ def __init__( pool will be created/upgraded using a snapshot. :paramtype creation_data: ~azure.mgmt.containerservice.v2022_01_01.models.CreationData """ - super(ManagedClusterAgentPoolProfileProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.vm_size = vm_size self.os_disk_size_gb = os_disk_size_gb @@ -2817,7 +2741,9 @@ def __init__( self.creation_data = creation_data -class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): +class ManagedClusterAgentPoolProfile( + ManagedClusterAgentPoolProfileProperties +): # pylint: disable=too-many-instance-attributes """Profile for the container service agent pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -2840,14 +2766,14 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2022_01_01.models.OSDiskType :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data - root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_01_01.models.KubeletDiskType :ivar workload_runtime: Determines the type of workload a node can run. Known values are: - "OCIContainer", "WasmWasi". + "OCIContainer" and "WasmWasi". :vartype workload_runtime: str or ~azure.mgmt.containerservice.v2022_01_01.models.WorkloadRuntime :ivar vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and used. @@ -2861,11 +2787,11 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :vartype pod_subnet_id: str :ivar max_pods: The maximum number of pods that can run on a node. :vartype max_pods: int - :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_01_01.models.OSType :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known - values are: "Ubuntu", "CBLMariner". + values are: "Ubuntu" and "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2022_01_01.models.OSSKU :ivar max_count: The maximum number of nodes for auto-scaling. :vartype max_count: int @@ -2874,14 +2800,14 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it - defaults to Delete. Known values are: "Delete", "Deallocate". + defaults to Delete. Known values are: "Delete" and "Deallocate". :vartype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_01_01.models.ScaleDownMode - :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", + :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets" and "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2022_01_01.models.AgentPoolType :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :vartype mode: str or ~azure.mgmt.containerservice.v2022_01_01.models.AgentPoolMode :ivar orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -2916,20 +2842,18 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default - is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + is 'Regular'. Known values are: "Spot" and "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_01_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_01_01.models.ScaleSetEvictionPolicy :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :vartype spot_max_price: float - :ivar tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :ivar tags: The tags to be persisted on the agent pool virtual machine scale set. :vartype tags: dict[str, str] :ivar node_labels: The node labels to be persisted across all nodes in agent pool. :vartype node_labels: dict[str, str] @@ -2953,67 +2877,67 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): for more details. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_01_01.models.GPUInstanceProfile :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the node pool will be created/upgraded using a snapshot. :vartype creation_data: ~azure.mgmt.containerservice.v2022_01_01.models.CreationData - :ivar name: Required. Windows agent pool names must be 6 characters or less. + :ivar name: Windows agent pool names must be 6 characters or less. Required. :vartype name: str """ _validation = { - 'os_disk_size_gb': {'maximum': 2048, 'minimum': 0}, - 'node_image_version': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'name': {'required': True, 'pattern': r'^[a-z][a-z0-9]{0,11}$'}, + "os_disk_size_gb": {"maximum": 2048, "minimum": 0}, + "node_image_version": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "name": {"required": True, "pattern": r"^[a-z][a-z0-9]{0,11}$"}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'os_disk_type': {'key': 'osDiskType', 'type': 'str'}, - 'kubelet_disk_type': {'key': 'kubeletDiskType', 'type': 'str'}, - 'workload_runtime': {'key': 'workloadRuntime', 'type': 'str'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'pod_subnet_id': {'key': 'podSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'maxPods', 'type': 'int'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'os_sku': {'key': 'osSKU', 'type': 'str'}, - 'max_count': {'key': 'maxCount', 'type': 'int'}, - 'min_count': {'key': 'minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'enableAutoScaling', 'type': 'bool'}, - 'scale_down_mode': {'key': 'scaleDownMode', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'mode': {'key': 'mode', 'type': 'str'}, - 'orchestrator_version': {'key': 'orchestratorVersion', 'type': 'str'}, - 'node_image_version': {'key': 'nodeImageVersion', 'type': 'str'}, - 'upgrade_settings': {'key': 'upgradeSettings', 'type': 'AgentPoolUpgradeSettings'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'power_state': {'key': 'powerState', 'type': 'PowerState'}, - 'availability_zones': {'key': 'availabilityZones', 'type': '[str]'}, - 'enable_node_public_ip': {'key': 'enableNodePublicIP', 'type': 'bool'}, - 'node_public_ip_prefix_id': {'key': 'nodePublicIPPrefixID', 'type': 'str'}, - 'scale_set_priority': {'key': 'scaleSetPriority', 'type': 'str'}, - 'scale_set_eviction_policy': {'key': 'scaleSetEvictionPolicy', 'type': 'str'}, - 'spot_max_price': {'key': 'spotMaxPrice', 'type': 'float'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'node_labels': {'key': 'nodeLabels', 'type': '{str}'}, - 'node_taints': {'key': 'nodeTaints', 'type': '[str]'}, - 'proximity_placement_group_id': {'key': 'proximityPlacementGroupID', 'type': 'str'}, - 'kubelet_config': {'key': 'kubeletConfig', 'type': 'KubeletConfig'}, - 'linux_os_config': {'key': 'linuxOSConfig', 'type': 'LinuxOSConfig'}, - 'enable_encryption_at_host': {'key': 'enableEncryptionAtHost', 'type': 'bool'}, - 'enable_ultra_ssd': {'key': 'enableUltraSSD', 'type': 'bool'}, - 'enable_fips': {'key': 'enableFIPS', 'type': 'bool'}, - 'gpu_instance_profile': {'key': 'gpuInstanceProfile', 'type': 'str'}, - 'creation_data': {'key': 'creationData', 'type': 'CreationData'}, - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( + "count": {"key": "count", "type": "int"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "os_disk_type": {"key": "osDiskType", "type": "str"}, + "kubelet_disk_type": {"key": "kubeletDiskType", "type": "str"}, + "workload_runtime": {"key": "workloadRuntime", "type": "str"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "pod_subnet_id": {"key": "podSubnetID", "type": "str"}, + "max_pods": {"key": "maxPods", "type": "int"}, + "os_type": {"key": "osType", "type": "str"}, + "os_sku": {"key": "osSKU", "type": "str"}, + "max_count": {"key": "maxCount", "type": "int"}, + "min_count": {"key": "minCount", "type": "int"}, + "enable_auto_scaling": {"key": "enableAutoScaling", "type": "bool"}, + "scale_down_mode": {"key": "scaleDownMode", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "mode": {"key": "mode", "type": "str"}, + "orchestrator_version": {"key": "orchestratorVersion", "type": "str"}, + "node_image_version": {"key": "nodeImageVersion", "type": "str"}, + "upgrade_settings": {"key": "upgradeSettings", "type": "AgentPoolUpgradeSettings"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "power_state": {"key": "powerState", "type": "PowerState"}, + "availability_zones": {"key": "availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "enableNodePublicIP", "type": "bool"}, + "node_public_ip_prefix_id": {"key": "nodePublicIPPrefixID", "type": "str"}, + "scale_set_priority": {"key": "scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "scaleSetEvictionPolicy", "type": "str"}, + "spot_max_price": {"key": "spotMaxPrice", "type": "float"}, + "tags": {"key": "tags", "type": "{str}"}, + "node_labels": {"key": "nodeLabels", "type": "{str}"}, + "node_taints": {"key": "nodeTaints", "type": "[str]"}, + "proximity_placement_group_id": {"key": "proximityPlacementGroupID", "type": "str"}, + "kubelet_config": {"key": "kubeletConfig", "type": "KubeletConfig"}, + "linux_os_config": {"key": "linuxOSConfig", "type": "LinuxOSConfig"}, + "enable_encryption_at_host": {"key": "enableEncryptionAtHost", "type": "bool"}, + "enable_ultra_ssd": {"key": "enableUltraSSD", "type": "bool"}, + "enable_fips": {"key": "enableFIPS", "type": "bool"}, + "gpu_instance_profile": {"key": "gpuInstanceProfile", "type": "str"}, + "creation_data": {"key": "creationData", "type": "CreationData"}, + "name": {"key": "name", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, name: str, @@ -3026,7 +2950,7 @@ def __init__( vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, @@ -3040,9 +2964,9 @@ def __init__( availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", - spot_max_price: Optional[float] = -1, + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", + spot_max_price: float = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, @@ -3073,14 +2997,14 @@ def __init__( larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2022_01_01.models.OSDiskType :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime - data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + data root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_01_01.models.KubeletDiskType :keyword workload_runtime: Determines the type of workload a node can run. Known values are: - "OCIContainer", "WasmWasi". + "OCIContainer" and "WasmWasi". :paramtype workload_runtime: str or ~azure.mgmt.containerservice.v2022_01_01.models.WorkloadRuntime :keyword vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and @@ -3094,11 +3018,11 @@ def __init__( :paramtype pod_subnet_id: str :keyword max_pods: The maximum number of pods that can run on a node. :paramtype max_pods: int - :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_01_01.models.OSType :keyword os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Known values are: "Ubuntu", "CBLMariner". + Known values are: "Ubuntu" and "CBLMariner". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2022_01_01.models.OSSKU :keyword max_count: The maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -3107,15 +3031,15 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, - it defaults to Delete. Known values are: "Delete", "Deallocate". + it defaults to Delete. Known values are: "Delete" and "Deallocate". :paramtype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_01_01.models.ScaleDownMode - :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", + :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2022_01_01.models.AgentPoolType :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2022_01_01.models.AgentPoolMode :keyword orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -3146,20 +3070,18 @@ def __init__( /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the - default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + default is 'Regular'. Known values are: "Spot" and "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_01_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_01_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :paramtype spot_max_price: float - :keyword tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :keyword tags: The tags to be persisted on the agent pool virtual machine scale set. :paramtype tags: dict[str, str] :keyword node_labels: The node labels to be persisted across all nodes in agent pool. :paramtype node_labels: dict[str, str] @@ -3183,21 +3105,60 @@ def __init__( for more details. :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance - profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_01_01.models.GPUInstanceProfile :keyword creation_data: CreationData to be used to specify the source Snapshot ID if the node pool will be created/upgraded using a snapshot. :paramtype creation_data: ~azure.mgmt.containerservice.v2022_01_01.models.CreationData - :keyword name: Required. Windows agent pool names must be 6 characters or less. + :keyword name: Windows agent pool names must be 6 characters or less. Required. :paramtype name: str """ - super(ManagedClusterAgentPoolProfile, self).__init__(count=count, vm_size=vm_size, os_disk_size_gb=os_disk_size_gb, os_disk_type=os_disk_type, kubelet_disk_type=kubelet_disk_type, workload_runtime=workload_runtime, vnet_subnet_id=vnet_subnet_id, pod_subnet_id=pod_subnet_id, max_pods=max_pods, os_type=os_type, os_sku=os_sku, max_count=max_count, min_count=min_count, enable_auto_scaling=enable_auto_scaling, scale_down_mode=scale_down_mode, type=type, mode=mode, orchestrator_version=orchestrator_version, upgrade_settings=upgrade_settings, power_state=power_state, availability_zones=availability_zones, enable_node_public_ip=enable_node_public_ip, node_public_ip_prefix_id=node_public_ip_prefix_id, scale_set_priority=scale_set_priority, scale_set_eviction_policy=scale_set_eviction_policy, spot_max_price=spot_max_price, tags=tags, node_labels=node_labels, node_taints=node_taints, proximity_placement_group_id=proximity_placement_group_id, kubelet_config=kubelet_config, linux_os_config=linux_os_config, enable_encryption_at_host=enable_encryption_at_host, enable_ultra_ssd=enable_ultra_ssd, enable_fips=enable_fips, gpu_instance_profile=gpu_instance_profile, creation_data=creation_data, **kwargs) + super().__init__( + count=count, + vm_size=vm_size, + os_disk_size_gb=os_disk_size_gb, + os_disk_type=os_disk_type, + kubelet_disk_type=kubelet_disk_type, + workload_runtime=workload_runtime, + vnet_subnet_id=vnet_subnet_id, + pod_subnet_id=pod_subnet_id, + max_pods=max_pods, + os_type=os_type, + os_sku=os_sku, + max_count=max_count, + min_count=min_count, + enable_auto_scaling=enable_auto_scaling, + scale_down_mode=scale_down_mode, + type=type, + mode=mode, + orchestrator_version=orchestrator_version, + upgrade_settings=upgrade_settings, + power_state=power_state, + availability_zones=availability_zones, + enable_node_public_ip=enable_node_public_ip, + node_public_ip_prefix_id=node_public_ip_prefix_id, + scale_set_priority=scale_set_priority, + scale_set_eviction_policy=scale_set_eviction_policy, + spot_max_price=spot_max_price, + tags=tags, + node_labels=node_labels, + node_taints=node_taints, + proximity_placement_group_id=proximity_placement_group_id, + kubelet_config=kubelet_config, + linux_os_config=linux_os_config, + enable_encryption_at_host=enable_encryption_at_host, + enable_ultra_ssd=enable_ultra_ssd, + enable_fips=enable_fips, + gpu_instance_profile=gpu_instance_profile, + creation_data=creation_data, + **kwargs + ) self.name = name -class ManagedClusterAPIServerAccessProfile(msrest.serialization.Model): +class ManagedClusterAPIServerAccessProfile(_serialization.Model): """Access profile for managed cluster API server. :ivar authorized_ip_ranges: IP ranges are specified in CIDR format, e.g. 137.117.106.88/29. @@ -3220,11 +3181,11 @@ class ManagedClusterAPIServerAccessProfile(msrest.serialization.Model): """ _attribute_map = { - 'authorized_ip_ranges': {'key': 'authorizedIPRanges', 'type': '[str]'}, - 'enable_private_cluster': {'key': 'enablePrivateCluster', 'type': 'bool'}, - 'private_dns_zone': {'key': 'privateDNSZone', 'type': 'str'}, - 'enable_private_cluster_public_fqdn': {'key': 'enablePrivateClusterPublicFQDN', 'type': 'bool'}, - 'disable_run_command': {'key': 'disableRunCommand', 'type': 'bool'}, + "authorized_ip_ranges": {"key": "authorizedIPRanges", "type": "[str]"}, + "enable_private_cluster": {"key": "enablePrivateCluster", "type": "bool"}, + "private_dns_zone": {"key": "privateDNSZone", "type": "str"}, + "enable_private_cluster_public_fqdn": {"key": "enablePrivateClusterPublicFQDN", "type": "bool"}, + "disable_run_command": {"key": "disableRunCommand", "type": "bool"}, } def __init__( @@ -3256,7 +3217,7 @@ def __init__( :keyword disable_run_command: Whether to disable run command for the cluster or not. :paramtype disable_run_command: bool """ - super(ManagedClusterAPIServerAccessProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.authorized_ip_ranges = authorized_ip_ranges self.enable_private_cluster = enable_private_cluster self.private_dns_zone = private_dns_zone @@ -3264,37 +3225,32 @@ def __init__( self.disable_run_command = disable_run_command -class ManagedClusterAutoUpgradeProfile(msrest.serialization.Model): +class ManagedClusterAutoUpgradeProfile(_serialization.Model): """Auto upgrade profile for a managed cluster. :ivar upgrade_channel: For more information see `setting the AKS cluster auto-upgrade channel `_. Known values - are: "rapid", "stable", "patch", "node-image", "none". + are: "rapid", "stable", "patch", "node-image", and "none". :vartype upgrade_channel: str or ~azure.mgmt.containerservice.v2022_01_01.models.UpgradeChannel """ _attribute_map = { - 'upgrade_channel': {'key': 'upgradeChannel', 'type': 'str'}, + "upgrade_channel": {"key": "upgradeChannel", "type": "str"}, } - def __init__( - self, - *, - upgrade_channel: Optional[Union[str, "_models.UpgradeChannel"]] = None, - **kwargs - ): + def __init__(self, *, upgrade_channel: Optional[Union[str, "_models.UpgradeChannel"]] = None, **kwargs): """ :keyword upgrade_channel: For more information see `setting the AKS cluster auto-upgrade channel `_. - Known values are: "rapid", "stable", "patch", "node-image", "none". + Known values are: "rapid", "stable", "patch", "node-image", and "none". :paramtype upgrade_channel: str or ~azure.mgmt.containerservice.v2022_01_01.models.UpgradeChannel """ - super(ManagedClusterAutoUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.upgrade_channel = upgrade_channel -class ManagedClusterHTTPProxyConfig(msrest.serialization.Model): +class ManagedClusterHTTPProxyConfig(_serialization.Model): """Cluster HTTP proxy configuration. :ivar http_proxy: The HTTP proxy server endpoint to use. @@ -3308,10 +3264,10 @@ class ManagedClusterHTTPProxyConfig(msrest.serialization.Model): """ _attribute_map = { - 'http_proxy': {'key': 'httpProxy', 'type': 'str'}, - 'https_proxy': {'key': 'httpsProxy', 'type': 'str'}, - 'no_proxy': {'key': 'noProxy', 'type': '[str]'}, - 'trusted_ca': {'key': 'trustedCa', 'type': 'str'}, + "http_proxy": {"key": "httpProxy", "type": "str"}, + "https_proxy": {"key": "httpsProxy", "type": "str"}, + "no_proxy": {"key": "noProxy", "type": "[str]"}, + "trusted_ca": {"key": "trustedCa", "type": "str"}, } def __init__( @@ -3333,14 +3289,14 @@ def __init__( :keyword trusted_ca: Alternative CA cert to use for connecting to proxy servers. :paramtype trusted_ca: str """ - super(ManagedClusterHTTPProxyConfig, self).__init__(**kwargs) + super().__init__(**kwargs) self.http_proxy = http_proxy self.https_proxy = https_proxy self.no_proxy = no_proxy self.trusted_ca = trusted_ca -class ManagedClusterIdentity(msrest.serialization.Model): +class ManagedClusterIdentity(_serialization.Model): """Identity for the managed cluster. Variables are only populated by the server, and will be ignored when sending a request. @@ -3353,7 +3309,7 @@ class ManagedClusterIdentity(msrest.serialization.Model): :vartype tenant_id: str :ivar type: For more information see `use managed identities in AKS `_. Known values are: - "SystemAssigned", "UserAssigned", "None". + "SystemAssigned", "UserAssigned", and "None". :vartype type: str or ~azure.mgmt.containerservice.v2022_01_01.models.ResourceIdentityType :ivar user_assigned_identities: The keys must be ARM resource IDs in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. @@ -3362,42 +3318,47 @@ class ManagedClusterIdentity(msrest.serialization.Model): """ _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, + "principal_id": {"readonly": True}, + "tenant_id": {"readonly": True}, } _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{ManagedServiceIdentityUserAssignedIdentitiesValue}'}, + "principal_id": {"key": "principalId", "type": "str"}, + "tenant_id": {"key": "tenantId", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "user_assigned_identities": { + "key": "userAssignedIdentities", + "type": "{ManagedServiceIdentityUserAssignedIdentitiesValue}", + }, } def __init__( self, *, type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, - user_assigned_identities: Optional[Dict[str, "_models.ManagedServiceIdentityUserAssignedIdentitiesValue"]] = None, + user_assigned_identities: Optional[ + Dict[str, "_models.ManagedServiceIdentityUserAssignedIdentitiesValue"] + ] = None, **kwargs ): """ :keyword type: For more information see `use managed identities in AKS `_. Known values are: - "SystemAssigned", "UserAssigned", "None". + "SystemAssigned", "UserAssigned", and "None". :paramtype type: str or ~azure.mgmt.containerservice.v2022_01_01.models.ResourceIdentityType :keyword user_assigned_identities: The keys must be ARM resource IDs in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. :paramtype user_assigned_identities: dict[str, ~azure.mgmt.containerservice.v2022_01_01.models.ManagedServiceIdentityUserAssignedIdentitiesValue] """ - super(ManagedClusterIdentity, self).__init__(**kwargs) + super().__init__(**kwargs) self.principal_id = None self.tenant_id = None self.type = type self.user_assigned_identities = user_assigned_identities -class ManagedClusterListResult(msrest.serialization.Model): +class ManagedClusterListResult(_serialization.Model): """The response from the List Managed Clusters operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -3409,30 +3370,25 @@ class ManagedClusterListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[ManagedCluster]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[ManagedCluster]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.ManagedCluster"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.ManagedCluster"]] = None, **kwargs): """ :keyword value: The list of managed clusters. :paramtype value: list[~azure.mgmt.containerservice.v2022_01_01.models.ManagedCluster] """ - super(ManagedClusterListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class ManagedClusterLoadBalancerProfile(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfile(_serialization.Model): """Profile of the managed cluster load balancer. :ivar managed_outbound_i_ps: Desired managed outbound IPs for the cluster load balancer. @@ -3461,18 +3417,24 @@ class ManagedClusterLoadBalancerProfile(msrest.serialization.Model): """ _validation = { - 'allocated_outbound_ports': {'maximum': 64000, 'minimum': 0}, - 'idle_timeout_in_minutes': {'maximum': 120, 'minimum': 4}, + "allocated_outbound_ports": {"maximum": 64000, "minimum": 0}, + "idle_timeout_in_minutes": {"maximum": 120, "minimum": 4}, } _attribute_map = { - 'managed_outbound_i_ps': {'key': 'managedOutboundIPs', 'type': 'ManagedClusterLoadBalancerProfileManagedOutboundIPs'}, - 'outbound_ip_prefixes': {'key': 'outboundIPPrefixes', 'type': 'ManagedClusterLoadBalancerProfileOutboundIPPrefixes'}, - 'outbound_i_ps': {'key': 'outboundIPs', 'type': 'ManagedClusterLoadBalancerProfileOutboundIPs'}, - 'effective_outbound_i_ps': {'key': 'effectiveOutboundIPs', 'type': '[ResourceReference]'}, - 'allocated_outbound_ports': {'key': 'allocatedOutboundPorts', 'type': 'int'}, - 'idle_timeout_in_minutes': {'key': 'idleTimeoutInMinutes', 'type': 'int'}, - 'enable_multiple_standard_load_balancers': {'key': 'enableMultipleStandardLoadBalancers', 'type': 'bool'}, + "managed_outbound_i_ps": { + "key": "managedOutboundIPs", + "type": "ManagedClusterLoadBalancerProfileManagedOutboundIPs", + }, + "outbound_ip_prefixes": { + "key": "outboundIPPrefixes", + "type": "ManagedClusterLoadBalancerProfileOutboundIPPrefixes", + }, + "outbound_i_ps": {"key": "outboundIPs", "type": "ManagedClusterLoadBalancerProfileOutboundIPs"}, + "effective_outbound_i_ps": {"key": "effectiveOutboundIPs", "type": "[ResourceReference]"}, + "allocated_outbound_ports": {"key": "allocatedOutboundPorts", "type": "int"}, + "idle_timeout_in_minutes": {"key": "idleTimeoutInMinutes", "type": "int"}, + "enable_multiple_standard_load_balancers": {"key": "enableMultipleStandardLoadBalancers", "type": "bool"}, } def __init__( @@ -3482,8 +3444,8 @@ def __init__( outbound_ip_prefixes: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPPrefixes"] = None, outbound_i_ps: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPs"] = None, effective_outbound_i_ps: Optional[List["_models.ResourceReference"]] = None, - allocated_outbound_ports: Optional[int] = 0, - idle_timeout_in_minutes: Optional[int] = 30, + allocated_outbound_ports: int = 0, + idle_timeout_in_minutes: int = 30, enable_multiple_standard_load_balancers: Optional[bool] = None, **kwargs ): @@ -3513,7 +3475,7 @@ def __init__( AKS cluster or not. :paramtype enable_multiple_standard_load_balancers: bool """ - super(ManagedClusterLoadBalancerProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.managed_outbound_i_ps = managed_outbound_i_ps self.outbound_ip_prefixes = outbound_ip_prefixes self.outbound_i_ps = outbound_i_ps @@ -3523,7 +3485,7 @@ def __init__( self.enable_multiple_standard_load_balancers = enable_multiple_standard_load_balancers -class ManagedClusterLoadBalancerProfileManagedOutboundIPs(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfileManagedOutboundIPs(_serialization.Model): """Desired managed outbound IPs for the cluster load balancer. :ivar count: The desired number of IPv4 outbound IPs created/managed by Azure for the cluster @@ -3537,22 +3499,16 @@ class ManagedClusterLoadBalancerProfileManagedOutboundIPs(msrest.serialization.M """ _validation = { - 'count': {'maximum': 100, 'minimum': 1}, - 'count_ipv6': {'maximum': 100, 'minimum': 0}, + "count": {"maximum": 100, "minimum": 1}, + "count_ipv6": {"maximum": 100, "minimum": 0}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'count_ipv6': {'key': 'countIPv6', 'type': 'int'}, + "count": {"key": "count", "type": "int"}, + "count_ipv6": {"key": "countIPv6", "type": "int"}, } - def __init__( - self, - *, - count: Optional[int] = 1, - count_ipv6: Optional[int] = 0, - **kwargs - ): + def __init__(self, *, count: int = 1, count_ipv6: int = 0, **kwargs): """ :keyword count: The desired number of IPv4 outbound IPs created/managed by Azure for the cluster load balancer. Allowed values must be in the range of 1 to 100 (inclusive). The default @@ -3563,12 +3519,12 @@ def __init__( value is 0 for single-stack and 1 for dual-stack. :paramtype count_ipv6: int """ - super(ManagedClusterLoadBalancerProfileManagedOutboundIPs, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.count_ipv6 = count_ipv6 -class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(_serialization.Model): """Desired outbound IP Prefix resources for the cluster load balancer. :ivar public_ip_prefixes: A list of public IP prefix resources. @@ -3577,25 +3533,20 @@ class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(msrest.serialization.M """ _attribute_map = { - 'public_ip_prefixes': {'key': 'publicIPPrefixes', 'type': '[ResourceReference]'}, + "public_ip_prefixes": {"key": "publicIPPrefixes", "type": "[ResourceReference]"}, } - def __init__( - self, - *, - public_ip_prefixes: Optional[List["_models.ResourceReference"]] = None, - **kwargs - ): + def __init__(self, *, public_ip_prefixes: Optional[List["_models.ResourceReference"]] = None, **kwargs): """ :keyword public_ip_prefixes: A list of public IP prefix resources. :paramtype public_ip_prefixes: list[~azure.mgmt.containerservice.v2022_01_01.models.ResourceReference] """ - super(ManagedClusterLoadBalancerProfileOutboundIPPrefixes, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_ip_prefixes = public_ip_prefixes -class ManagedClusterLoadBalancerProfileOutboundIPs(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfileOutboundIPs(_serialization.Model): """Desired outbound IP resources for the cluster load balancer. :ivar public_i_ps: A list of public IP resources. @@ -3603,24 +3554,19 @@ class ManagedClusterLoadBalancerProfileOutboundIPs(msrest.serialization.Model): """ _attribute_map = { - 'public_i_ps': {'key': 'publicIPs', 'type': '[ResourceReference]'}, + "public_i_ps": {"key": "publicIPs", "type": "[ResourceReference]"}, } - def __init__( - self, - *, - public_i_ps: Optional[List["_models.ResourceReference"]] = None, - **kwargs - ): + def __init__(self, *, public_i_ps: Optional[List["_models.ResourceReference"]] = None, **kwargs): """ :keyword public_i_ps: A list of public IP resources. :paramtype public_i_ps: list[~azure.mgmt.containerservice.v2022_01_01.models.ResourceReference] """ - super(ManagedClusterLoadBalancerProfileOutboundIPs, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_i_ps = public_i_ps -class ManagedClusterManagedOutboundIPProfile(msrest.serialization.Model): +class ManagedClusterManagedOutboundIPProfile(_serialization.Model): """Profile of the managed outbound IP resources of the managed cluster. :ivar count: The desired number of outbound IPs created/managed by Azure. Allowed values must @@ -3629,29 +3575,24 @@ class ManagedClusterManagedOutboundIPProfile(msrest.serialization.Model): """ _validation = { - 'count': {'maximum': 16, 'minimum': 1}, + "count": {"maximum": 16, "minimum": 1}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, + "count": {"key": "count", "type": "int"}, } - def __init__( - self, - *, - count: Optional[int] = 1, - **kwargs - ): + def __init__(self, *, count: int = 1, **kwargs): """ :keyword count: The desired number of outbound IPs created/managed by Azure. Allowed values must be in the range of 1 to 16 (inclusive). The default value is 1. :paramtype count: int """ - super(ManagedClusterManagedOutboundIPProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count -class ManagedClusterNATGatewayProfile(msrest.serialization.Model): +class ManagedClusterNATGatewayProfile(_serialization.Model): """Profile of the managed cluster NAT gateway. :ivar managed_outbound_ip_profile: Profile of the managed outbound IP resources of the cluster @@ -3667,13 +3608,16 @@ class ManagedClusterNATGatewayProfile(msrest.serialization.Model): """ _validation = { - 'idle_timeout_in_minutes': {'maximum': 120, 'minimum': 4}, + "idle_timeout_in_minutes": {"maximum": 120, "minimum": 4}, } _attribute_map = { - 'managed_outbound_ip_profile': {'key': 'managedOutboundIPProfile', 'type': 'ManagedClusterManagedOutboundIPProfile'}, - 'effective_outbound_i_ps': {'key': 'effectiveOutboundIPs', 'type': '[ResourceReference]'}, - 'idle_timeout_in_minutes': {'key': 'idleTimeoutInMinutes', 'type': 'int'}, + "managed_outbound_ip_profile": { + "key": "managedOutboundIPProfile", + "type": "ManagedClusterManagedOutboundIPProfile", + }, + "effective_outbound_i_ps": {"key": "effectiveOutboundIPs", "type": "[ResourceReference]"}, + "idle_timeout_in_minutes": {"key": "idleTimeoutInMinutes", "type": "int"}, } def __init__( @@ -3681,7 +3625,7 @@ def __init__( *, managed_outbound_ip_profile: Optional["_models.ManagedClusterManagedOutboundIPProfile"] = None, effective_outbound_i_ps: Optional[List["_models.ResourceReference"]] = None, - idle_timeout_in_minutes: Optional[int] = 4, + idle_timeout_in_minutes: int = 4, **kwargs ): """ @@ -3697,29 +3641,29 @@ def __init__( are in the range of 4 to 120 (inclusive). The default value is 4 minutes. :paramtype idle_timeout_in_minutes: int """ - super(ManagedClusterNATGatewayProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.managed_outbound_ip_profile = managed_outbound_ip_profile self.effective_outbound_i_ps = effective_outbound_i_ps self.idle_timeout_in_minutes = idle_timeout_in_minutes -class ManagedClusterPodIdentity(msrest.serialization.Model): +class ManagedClusterPodIdentity(_serialization.Model): """Details about the pod identity assigned to the Managed Cluster. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar name: Required. The name of the pod identity. + :ivar name: The name of the pod identity. Required. :vartype name: str - :ivar namespace: Required. The namespace of the pod identity. + :ivar namespace: The namespace of the pod identity. Required. :vartype namespace: str :ivar binding_selector: The binding selector to use for the AzureIdentityBinding resource. :vartype binding_selector: str - :ivar identity: Required. The user assigned identity details. + :ivar identity: The user assigned identity details. Required. :vartype identity: ~azure.mgmt.containerservice.v2022_01_01.models.UserAssignedIdentity :ivar provisioning_state: The current provisioning state of the pod identity. Known values are: - "Assigned", "Updating", "Deleting", "Failed". + "Assigned", "Updating", "Deleting", and "Failed". :vartype provisioning_state: str or ~azure.mgmt.containerservice.v2022_01_01.models.ManagedClusterPodIdentityProvisioningState :ivar provisioning_info: @@ -3728,20 +3672,20 @@ class ManagedClusterPodIdentity(msrest.serialization.Model): """ _validation = { - 'name': {'required': True}, - 'namespace': {'required': True}, - 'identity': {'required': True}, - 'provisioning_state': {'readonly': True}, - 'provisioning_info': {'readonly': True}, + "name": {"required": True}, + "namespace": {"required": True}, + "identity": {"required": True}, + "provisioning_state": {"readonly": True}, + "provisioning_info": {"readonly": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'namespace': {'key': 'namespace', 'type': 'str'}, - 'binding_selector': {'key': 'bindingSelector', 'type': 'str'}, - 'identity': {'key': 'identity', 'type': 'UserAssignedIdentity'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'provisioning_info': {'key': 'provisioningInfo', 'type': 'ManagedClusterPodIdentityProvisioningInfo'}, + "name": {"key": "name", "type": "str"}, + "namespace": {"key": "namespace", "type": "str"}, + "binding_selector": {"key": "bindingSelector", "type": "str"}, + "identity": {"key": "identity", "type": "UserAssignedIdentity"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "provisioning_info": {"key": "provisioningInfo", "type": "ManagedClusterPodIdentityProvisioningInfo"}, } def __init__( @@ -3754,16 +3698,16 @@ def __init__( **kwargs ): """ - :keyword name: Required. The name of the pod identity. + :keyword name: The name of the pod identity. Required. :paramtype name: str - :keyword namespace: Required. The namespace of the pod identity. + :keyword namespace: The namespace of the pod identity. Required. :paramtype namespace: str :keyword binding_selector: The binding selector to use for the AzureIdentityBinding resource. :paramtype binding_selector: str - :keyword identity: Required. The user assigned identity details. + :keyword identity: The user assigned identity details. Required. :paramtype identity: ~azure.mgmt.containerservice.v2022_01_01.models.UserAssignedIdentity """ - super(ManagedClusterPodIdentity, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.namespace = namespace self.binding_selector = binding_selector @@ -3772,54 +3716,47 @@ def __init__( self.provisioning_info = None -class ManagedClusterPodIdentityException(msrest.serialization.Model): +class ManagedClusterPodIdentityException(_serialization.Model): """See `disable AAD Pod Identity for a specific Pod/Application `_ for more details. All required parameters must be populated in order to send to Azure. - :ivar name: Required. The name of the pod identity exception. + :ivar name: The name of the pod identity exception. Required. :vartype name: str - :ivar namespace: Required. The namespace of the pod identity exception. + :ivar namespace: The namespace of the pod identity exception. Required. :vartype namespace: str - :ivar pod_labels: Required. The pod labels to match. + :ivar pod_labels: The pod labels to match. Required. :vartype pod_labels: dict[str, str] """ _validation = { - 'name': {'required': True}, - 'namespace': {'required': True}, - 'pod_labels': {'required': True}, + "name": {"required": True}, + "namespace": {"required": True}, + "pod_labels": {"required": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'namespace': {'key': 'namespace', 'type': 'str'}, - 'pod_labels': {'key': 'podLabels', 'type': '{str}'}, + "name": {"key": "name", "type": "str"}, + "namespace": {"key": "namespace", "type": "str"}, + "pod_labels": {"key": "podLabels", "type": "{str}"}, } - def __init__( - self, - *, - name: str, - namespace: str, - pod_labels: Dict[str, str], - **kwargs - ): + def __init__(self, *, name: str, namespace: str, pod_labels: Dict[str, str], **kwargs): """ - :keyword name: Required. The name of the pod identity exception. + :keyword name: The name of the pod identity exception. Required. :paramtype name: str - :keyword namespace: Required. The namespace of the pod identity exception. + :keyword namespace: The namespace of the pod identity exception. Required. :paramtype namespace: str - :keyword pod_labels: Required. The pod labels to match. + :keyword pod_labels: The pod labels to match. Required. :paramtype pod_labels: dict[str, str] """ - super(ManagedClusterPodIdentityException, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.namespace = namespace self.pod_labels = pod_labels -class ManagedClusterPodIdentityProfile(msrest.serialization.Model): +class ManagedClusterPodIdentityProfile(_serialization.Model): """See `use AAD pod identity `_ for more details on pod identity integration. :ivar enabled: Whether the pod identity addon is enabled. @@ -3839,10 +3776,13 @@ class ManagedClusterPodIdentityProfile(msrest.serialization.Model): """ _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'allow_network_plugin_kubenet': {'key': 'allowNetworkPluginKubenet', 'type': 'bool'}, - 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '[ManagedClusterPodIdentity]'}, - 'user_assigned_identity_exceptions': {'key': 'userAssignedIdentityExceptions', 'type': '[ManagedClusterPodIdentityException]'}, + "enabled": {"key": "enabled", "type": "bool"}, + "allow_network_plugin_kubenet": {"key": "allowNetworkPluginKubenet", "type": "bool"}, + "user_assigned_identities": {"key": "userAssignedIdentities", "type": "[ManagedClusterPodIdentity]"}, + "user_assigned_identity_exceptions": { + "key": "userAssignedIdentityExceptions", + "type": "[ManagedClusterPodIdentityException]", + }, } def __init__( @@ -3870,14 +3810,14 @@ def __init__( :paramtype user_assigned_identity_exceptions: list[~azure.mgmt.containerservice.v2022_01_01.models.ManagedClusterPodIdentityException] """ - super(ManagedClusterPodIdentityProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.allow_network_plugin_kubenet = allow_network_plugin_kubenet self.user_assigned_identities = user_assigned_identities self.user_assigned_identity_exceptions = user_assigned_identity_exceptions -class ManagedClusterPodIdentityProvisioningError(msrest.serialization.Model): +class ManagedClusterPodIdentityProvisioningError(_serialization.Model): """An error response from the pod identity provisioning. :ivar error: Details about the error. @@ -3886,25 +3826,20 @@ class ManagedClusterPodIdentityProvisioningError(msrest.serialization.Model): """ _attribute_map = { - 'error': {'key': 'error', 'type': 'ManagedClusterPodIdentityProvisioningErrorBody'}, + "error": {"key": "error", "type": "ManagedClusterPodIdentityProvisioningErrorBody"}, } - def __init__( - self, - *, - error: Optional["_models.ManagedClusterPodIdentityProvisioningErrorBody"] = None, - **kwargs - ): + def __init__(self, *, error: Optional["_models.ManagedClusterPodIdentityProvisioningErrorBody"] = None, **kwargs): """ :keyword error: Details about the error. :paramtype error: ~azure.mgmt.containerservice.v2022_01_01.models.ManagedClusterPodIdentityProvisioningErrorBody """ - super(ManagedClusterPodIdentityProvisioningError, self).__init__(**kwargs) + super().__init__(**kwargs) self.error = error -class ManagedClusterPodIdentityProvisioningErrorBody(msrest.serialization.Model): +class ManagedClusterPodIdentityProvisioningErrorBody(_serialization.Model): """An error response from the pod identity provisioning. :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed @@ -3922,10 +3857,10 @@ class ManagedClusterPodIdentityProvisioningErrorBody(msrest.serialization.Model) """ _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[ManagedClusterPodIdentityProvisioningErrorBody]'}, + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[ManagedClusterPodIdentityProvisioningErrorBody]"}, } def __init__( @@ -3951,14 +3886,14 @@ def __init__( :paramtype details: list[~azure.mgmt.containerservice.v2022_01_01.models.ManagedClusterPodIdentityProvisioningErrorBody] """ - super(ManagedClusterPodIdentityProvisioningErrorBody, self).__init__(**kwargs) + super().__init__(**kwargs) self.code = code self.message = message self.target = target self.details = details -class ManagedClusterPodIdentityProvisioningInfo(msrest.serialization.Model): +class ManagedClusterPodIdentityProvisioningInfo(_serialization.Model): """ManagedClusterPodIdentityProvisioningInfo. :ivar error: Pod identity assignment error (if any). @@ -3967,35 +3902,30 @@ class ManagedClusterPodIdentityProvisioningInfo(msrest.serialization.Model): """ _attribute_map = { - 'error': {'key': 'error', 'type': 'ManagedClusterPodIdentityProvisioningError'}, + "error": {"key": "error", "type": "ManagedClusterPodIdentityProvisioningError"}, } - def __init__( - self, - *, - error: Optional["_models.ManagedClusterPodIdentityProvisioningError"] = None, - **kwargs - ): + def __init__(self, *, error: Optional["_models.ManagedClusterPodIdentityProvisioningError"] = None, **kwargs): """ :keyword error: Pod identity assignment error (if any). :paramtype error: ~azure.mgmt.containerservice.v2022_01_01.models.ManagedClusterPodIdentityProvisioningError """ - super(ManagedClusterPodIdentityProvisioningInfo, self).__init__(**kwargs) + super().__init__(**kwargs) self.error = error -class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): +class ManagedClusterPoolUpgradeProfile(_serialization.Model): """The list of available upgrade versions. All required parameters must be populated in order to send to Azure. - :ivar kubernetes_version: Required. The Kubernetes version (major.minor.patch). + :ivar kubernetes_version: The Kubernetes version (major.minor.patch). Required. :vartype kubernetes_version: str :ivar name: The Agent Pool name. :vartype name: str - :ivar os_type: Required. The operating system type. The default is Linux. Known values are: - "Linux", "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_01_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -4003,15 +3933,15 @@ class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): """ _validation = { - 'kubernetes_version': {'required': True}, - 'os_type': {'required': True}, + "kubernetes_version": {"required": True}, + "os_type": {"required": True}, } _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'upgrades': {'key': 'upgrades', 'type': '[ManagedClusterPoolUpgradeProfileUpgradesItem]'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "os_type": {"key": "osType", "type": "str"}, + "upgrades": {"key": "upgrades", "type": "[ManagedClusterPoolUpgradeProfileUpgradesItem]"}, } def __init__( @@ -4024,25 +3954,25 @@ def __init__( **kwargs ): """ - :keyword kubernetes_version: Required. The Kubernetes version (major.minor.patch). + :keyword kubernetes_version: The Kubernetes version (major.minor.patch). Required. :paramtype kubernetes_version: str :keyword name: The Agent Pool name. :paramtype name: str - :keyword os_type: Required. The operating system type. The default is Linux. Known values are: - "Linux", "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_01_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: list[~azure.mgmt.containerservice.v2022_01_01.models.ManagedClusterPoolUpgradeProfileUpgradesItem] """ - super(ManagedClusterPoolUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.name = name self.os_type = os_type self.upgrades = upgrades -class ManagedClusterPoolUpgradeProfileUpgradesItem(msrest.serialization.Model): +class ManagedClusterPoolUpgradeProfileUpgradesItem(_serialization.Model): """ManagedClusterPoolUpgradeProfileUpgradesItem. :ivar kubernetes_version: The Kubernetes version (major.minor.patch). @@ -4052,36 +3982,30 @@ class ManagedClusterPoolUpgradeProfileUpgradesItem(msrest.serialization.Model): """ _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } - def __init__( - self, - *, - kubernetes_version: Optional[str] = None, - is_preview: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, kubernetes_version: Optional[str] = None, is_preview: Optional[bool] = None, **kwargs): """ :keyword kubernetes_version: The Kubernetes version (major.minor.patch). :paramtype kubernetes_version: str :keyword is_preview: Whether the Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(ManagedClusterPoolUpgradeProfileUpgradesItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.is_preview = is_preview -class ManagedClusterPropertiesAutoScalerProfile(msrest.serialization.Model): +class ManagedClusterPropertiesAutoScalerProfile(_serialization.Model): # pylint: disable=too-many-instance-attributes """Parameters to be applied to the cluster-autoscaler when enabled. :ivar balance_similar_node_groups: Valid values are 'true' and 'false'. :vartype balance_similar_node_groups: str :ivar expander: If not specified, the default is 'random'. See `expanders `_ - for more information. Known values are: "least-waste", "most-pods", "priority", "random". + for more information. Known values are: "least-waste", "most-pods", "priority", and "random". :vartype expander: str or ~azure.mgmt.containerservice.v2022_01_01.models.Expander :ivar max_empty_bulk_delete: The default is 10. :vartype max_empty_bulk_delete: str @@ -4125,23 +4049,23 @@ class ManagedClusterPropertiesAutoScalerProfile(msrest.serialization.Model): """ _attribute_map = { - 'balance_similar_node_groups': {'key': 'balance-similar-node-groups', 'type': 'str'}, - 'expander': {'key': 'expander', 'type': 'str'}, - 'max_empty_bulk_delete': {'key': 'max-empty-bulk-delete', 'type': 'str'}, - 'max_graceful_termination_sec': {'key': 'max-graceful-termination-sec', 'type': 'str'}, - 'max_node_provision_time': {'key': 'max-node-provision-time', 'type': 'str'}, - 'max_total_unready_percentage': {'key': 'max-total-unready-percentage', 'type': 'str'}, - 'new_pod_scale_up_delay': {'key': 'new-pod-scale-up-delay', 'type': 'str'}, - 'ok_total_unready_count': {'key': 'ok-total-unready-count', 'type': 'str'}, - 'scan_interval': {'key': 'scan-interval', 'type': 'str'}, - 'scale_down_delay_after_add': {'key': 'scale-down-delay-after-add', 'type': 'str'}, - 'scale_down_delay_after_delete': {'key': 'scale-down-delay-after-delete', 'type': 'str'}, - 'scale_down_delay_after_failure': {'key': 'scale-down-delay-after-failure', 'type': 'str'}, - 'scale_down_unneeded_time': {'key': 'scale-down-unneeded-time', 'type': 'str'}, - 'scale_down_unready_time': {'key': 'scale-down-unready-time', 'type': 'str'}, - 'scale_down_utilization_threshold': {'key': 'scale-down-utilization-threshold', 'type': 'str'}, - 'skip_nodes_with_local_storage': {'key': 'skip-nodes-with-local-storage', 'type': 'str'}, - 'skip_nodes_with_system_pods': {'key': 'skip-nodes-with-system-pods', 'type': 'str'}, + "balance_similar_node_groups": {"key": "balance-similar-node-groups", "type": "str"}, + "expander": {"key": "expander", "type": "str"}, + "max_empty_bulk_delete": {"key": "max-empty-bulk-delete", "type": "str"}, + "max_graceful_termination_sec": {"key": "max-graceful-termination-sec", "type": "str"}, + "max_node_provision_time": {"key": "max-node-provision-time", "type": "str"}, + "max_total_unready_percentage": {"key": "max-total-unready-percentage", "type": "str"}, + "new_pod_scale_up_delay": {"key": "new-pod-scale-up-delay", "type": "str"}, + "ok_total_unready_count": {"key": "ok-total-unready-count", "type": "str"}, + "scan_interval": {"key": "scan-interval", "type": "str"}, + "scale_down_delay_after_add": {"key": "scale-down-delay-after-add", "type": "str"}, + "scale_down_delay_after_delete": {"key": "scale-down-delay-after-delete", "type": "str"}, + "scale_down_delay_after_failure": {"key": "scale-down-delay-after-failure", "type": "str"}, + "scale_down_unneeded_time": {"key": "scale-down-unneeded-time", "type": "str"}, + "scale_down_unready_time": {"key": "scale-down-unready-time", "type": "str"}, + "scale_down_utilization_threshold": {"key": "scale-down-utilization-threshold", "type": "str"}, + "skip_nodes_with_local_storage": {"key": "skip-nodes-with-local-storage", "type": "str"}, + "skip_nodes_with_system_pods": {"key": "skip-nodes-with-system-pods", "type": "str"}, } def __init__( @@ -4171,7 +4095,7 @@ def __init__( :paramtype balance_similar_node_groups: str :keyword expander: If not specified, the default is 'random'. See `expanders `_ - for more information. Known values are: "least-waste", "most-pods", "priority", "random". + for more information. Known values are: "least-waste", "most-pods", "priority", and "random". :paramtype expander: str or ~azure.mgmt.containerservice.v2022_01_01.models.Expander :keyword max_empty_bulk_delete: The default is 10. :paramtype max_empty_bulk_delete: str @@ -4214,7 +4138,7 @@ def __init__( :keyword skip_nodes_with_system_pods: The default is true. :paramtype skip_nodes_with_system_pods: str """ - super(ManagedClusterPropertiesAutoScalerProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.balance_similar_node_groups = balance_similar_node_groups self.expander = expander self.max_empty_bulk_delete = max_empty_bulk_delete @@ -4234,7 +4158,7 @@ def __init__( self.skip_nodes_with_system_pods = skip_nodes_with_system_pods -class ManagedClusterSecurityProfile(msrest.serialization.Model): +class ManagedClusterSecurityProfile(_serialization.Model): """Security profile for the container service cluster. :ivar azure_defender: Azure Defender settings for the security profile. @@ -4243,25 +4167,22 @@ class ManagedClusterSecurityProfile(msrest.serialization.Model): """ _attribute_map = { - 'azure_defender': {'key': 'azureDefender', 'type': 'ManagedClusterSecurityProfileAzureDefender'}, + "azure_defender": {"key": "azureDefender", "type": "ManagedClusterSecurityProfileAzureDefender"}, } def __init__( - self, - *, - azure_defender: Optional["_models.ManagedClusterSecurityProfileAzureDefender"] = None, - **kwargs + self, *, azure_defender: Optional["_models.ManagedClusterSecurityProfileAzureDefender"] = None, **kwargs ): """ :keyword azure_defender: Azure Defender settings for the security profile. :paramtype azure_defender: ~azure.mgmt.containerservice.v2022_01_01.models.ManagedClusterSecurityProfileAzureDefender """ - super(ManagedClusterSecurityProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.azure_defender = azure_defender -class ManagedClusterSecurityProfileAzureDefender(msrest.serialization.Model): +class ManagedClusterSecurityProfileAzureDefender(_serialization.Model): """Azure Defender settings for the security profile. :ivar enabled: Whether to enable Azure Defender. @@ -4273,16 +4194,12 @@ class ManagedClusterSecurityProfileAzureDefender(msrest.serialization.Model): """ _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'log_analytics_workspace_resource_id': {'key': 'logAnalyticsWorkspaceResourceId', 'type': 'str'}, + "enabled": {"key": "enabled", "type": "bool"}, + "log_analytics_workspace_resource_id": {"key": "logAnalyticsWorkspaceResourceId", "type": "str"}, } def __init__( - self, - *, - enabled: Optional[bool] = None, - log_analytics_workspace_resource_id: Optional[str] = None, - **kwargs + self, *, enabled: Optional[bool] = None, log_analytics_workspace_resource_id: Optional[str] = None, **kwargs ): """ :keyword enabled: Whether to enable Azure Defender. @@ -4292,63 +4209,57 @@ def __init__( must be a valid workspace resource ID. When Azure Defender is disabled, leave the field empty. :paramtype log_analytics_workspace_resource_id: str """ - super(ManagedClusterSecurityProfileAzureDefender, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.log_analytics_workspace_resource_id = log_analytics_workspace_resource_id -class ManagedClusterServicePrincipalProfile(msrest.serialization.Model): +class ManagedClusterServicePrincipalProfile(_serialization.Model): """Information about a service principal identity for the cluster to use for manipulating Azure APIs. All required parameters must be populated in order to send to Azure. - :ivar client_id: Required. The ID for the service principal. + :ivar client_id: The ID for the service principal. Required. :vartype client_id: str :ivar secret: The secret password associated with the service principal in plain text. :vartype secret: str """ _validation = { - 'client_id': {'required': True}, + "client_id": {"required": True}, } _attribute_map = { - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'secret': {'key': 'secret', 'type': 'str'}, + "client_id": {"key": "clientId", "type": "str"}, + "secret": {"key": "secret", "type": "str"}, } - def __init__( - self, - *, - client_id: str, - secret: Optional[str] = None, - **kwargs - ): + def __init__(self, *, client_id: str, secret: Optional[str] = None, **kwargs): """ - :keyword client_id: Required. The ID for the service principal. + :keyword client_id: The ID for the service principal. Required. :paramtype client_id: str :keyword secret: The secret password associated with the service principal in plain text. :paramtype secret: str """ - super(ManagedClusterServicePrincipalProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.client_id = client_id self.secret = secret -class ManagedClusterSKU(msrest.serialization.Model): +class ManagedClusterSKU(_serialization.Model): """The SKU of a Managed Cluster. - :ivar name: The name of a managed cluster SKU. Known values are: "Basic". + :ivar name: The name of a managed cluster SKU. "Basic" :vartype name: str or ~azure.mgmt.containerservice.v2022_01_01.models.ManagedClusterSKUName :ivar tier: If not specified, the default is 'Free'. See `uptime SLA - `_ for more details. Known values are: "Paid", - "Free". + `_ for more details. Known values are: "Paid" + and "Free". :vartype tier: str or ~azure.mgmt.containerservice.v2022_01_01.models.ManagedClusterSKUTier """ _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, + "name": {"key": "name", "type": "str"}, + "tier": {"key": "tier", "type": "str"}, } def __init__( @@ -4359,19 +4270,19 @@ def __init__( **kwargs ): """ - :keyword name: The name of a managed cluster SKU. Known values are: "Basic". + :keyword name: The name of a managed cluster SKU. "Basic" :paramtype name: str or ~azure.mgmt.containerservice.v2022_01_01.models.ManagedClusterSKUName :keyword tier: If not specified, the default is 'Free'. See `uptime SLA - `_ for more details. Known values are: "Paid", - "Free". + `_ for more details. Known values are: "Paid" + and "Free". :paramtype tier: str or ~azure.mgmt.containerservice.v2022_01_01.models.ManagedClusterSKUTier """ - super(ManagedClusterSKU, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.tier = tier -class ManagedClusterUpgradeProfile(msrest.serialization.Model): +class ManagedClusterUpgradeProfile(_serialization.Model): """The list of available upgrades for compute pools. Variables are only populated by the server, and will be ignored when sending a request. @@ -4384,29 +4295,29 @@ class ManagedClusterUpgradeProfile(msrest.serialization.Model): :vartype name: str :ivar type: The type of the upgrade profile. :vartype type: str - :ivar control_plane_profile: Required. The list of available upgrade versions for the control - plane. + :ivar control_plane_profile: The list of available upgrade versions for the control plane. + Required. :vartype control_plane_profile: ~azure.mgmt.containerservice.v2022_01_01.models.ManagedClusterPoolUpgradeProfile - :ivar agent_pool_profiles: Required. The list of available upgrade versions for agent pools. + :ivar agent_pool_profiles: The list of available upgrade versions for agent pools. Required. :vartype agent_pool_profiles: list[~azure.mgmt.containerservice.v2022_01_01.models.ManagedClusterPoolUpgradeProfile] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'control_plane_profile': {'required': True}, - 'agent_pool_profiles': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "control_plane_profile": {"required": True}, + "agent_pool_profiles": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'control_plane_profile': {'key': 'properties.controlPlaneProfile', 'type': 'ManagedClusterPoolUpgradeProfile'}, - 'agent_pool_profiles': {'key': 'properties.agentPoolProfiles', 'type': '[ManagedClusterPoolUpgradeProfile]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "control_plane_profile": {"key": "properties.controlPlaneProfile", "type": "ManagedClusterPoolUpgradeProfile"}, + "agent_pool_profiles": {"key": "properties.agentPoolProfiles", "type": "[ManagedClusterPoolUpgradeProfile]"}, } def __init__( @@ -4417,15 +4328,15 @@ def __init__( **kwargs ): """ - :keyword control_plane_profile: Required. The list of available upgrade versions for the - control plane. + :keyword control_plane_profile: The list of available upgrade versions for the control plane. + Required. :paramtype control_plane_profile: ~azure.mgmt.containerservice.v2022_01_01.models.ManagedClusterPoolUpgradeProfile - :keyword agent_pool_profiles: Required. The list of available upgrade versions for agent pools. + :keyword agent_pool_profiles: The list of available upgrade versions for agent pools. Required. :paramtype agent_pool_profiles: list[~azure.mgmt.containerservice.v2022_01_01.models.ManagedClusterPoolUpgradeProfile] """ - super(ManagedClusterUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -4433,18 +4344,18 @@ def __init__( self.agent_pool_profiles = agent_pool_profiles -class ManagedClusterWindowsProfile(msrest.serialization.Model): +class ManagedClusterWindowsProfile(_serialization.Model): """Profile for Windows VMs in the managed cluster. All required parameters must be populated in order to send to Azure. - :ivar admin_username: Required. Specifies the name of the administrator account. - :code:`
`:code:`
` **Restriction:** Cannot end in "." :code:`
`:code:`
` - **Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", "test1", - "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", - "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", - "sys", "test2", "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 - character :code:`
`:code:`
` **Max-length:** 20 characters. + :ivar admin_username: Specifies the name of the administrator account. :code:`
`:code:`
` + **Restriction:** Cannot end in "." :code:`
`:code:`
` **Disallowed values:** + "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", + "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", + "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", + "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 character + :code:`
`:code:`
` **Max-length:** 20 characters. Required. :vartype admin_username: str :ivar admin_password: Specifies the password of the administrator account. :code:`
`:code:`
` **Minimum-length:** 8 characters :code:`
`:code:`
` @@ -4456,7 +4367,7 @@ class ManagedClusterWindowsProfile(msrest.serialization.Model): :vartype admin_password: str :ivar license_type: The license type to use for Windows VMs. See `Azure Hybrid User Benefits `_ for more details. Known values are: - "None", "Windows_Server". + "None" and "Windows_Server". :vartype license_type: str or ~azure.mgmt.containerservice.v2022_01_01.models.LicenseType :ivar enable_csi_proxy: For more details on CSI proxy, see the `CSI proxy GitHub repo `_. @@ -4466,15 +4377,15 @@ class ManagedClusterWindowsProfile(msrest.serialization.Model): """ _validation = { - 'admin_username': {'required': True}, + "admin_username": {"required": True}, } _attribute_map = { - 'admin_username': {'key': 'adminUsername', 'type': 'str'}, - 'admin_password': {'key': 'adminPassword', 'type': 'str'}, - 'license_type': {'key': 'licenseType', 'type': 'str'}, - 'enable_csi_proxy': {'key': 'enableCSIProxy', 'type': 'bool'}, - 'gmsa_profile': {'key': 'gmsaProfile', 'type': 'WindowsGmsaProfile'}, + "admin_username": {"key": "adminUsername", "type": "str"}, + "admin_password": {"key": "adminPassword", "type": "str"}, + "license_type": {"key": "licenseType", "type": "str"}, + "enable_csi_proxy": {"key": "enableCSIProxy", "type": "bool"}, + "gmsa_profile": {"key": "gmsaProfile", "type": "WindowsGmsaProfile"}, } def __init__( @@ -4488,13 +4399,13 @@ def __init__( **kwargs ): """ - :keyword admin_username: Required. Specifies the name of the administrator account. + :keyword admin_username: Specifies the name of the administrator account. :code:`
`:code:`
` **Restriction:** Cannot end in "." :code:`
`:code:`
` **Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 - character :code:`
`:code:`
` **Max-length:** 20 characters. + character :code:`
`:code:`
` **Max-length:** 20 characters. Required. :paramtype admin_username: str :keyword admin_password: Specifies the password of the administrator account. :code:`
`:code:`
` **Minimum-length:** 8 characters :code:`
`:code:`
` @@ -4506,7 +4417,7 @@ def __init__( :paramtype admin_password: str :keyword license_type: The license type to use for Windows VMs. See `Azure Hybrid User Benefits `_ for more details. Known values are: - "None", "Windows_Server". + "None" and "Windows_Server". :paramtype license_type: str or ~azure.mgmt.containerservice.v2022_01_01.models.LicenseType :keyword enable_csi_proxy: For more details on CSI proxy, see the `CSI proxy GitHub repo `_. @@ -4514,7 +4425,7 @@ def __init__( :keyword gmsa_profile: The Windows gMSA Profile in the Managed Cluster. :paramtype gmsa_profile: ~azure.mgmt.containerservice.v2022_01_01.models.WindowsGmsaProfile """ - super(ManagedClusterWindowsProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.admin_username = admin_username self.admin_password = admin_password self.license_type = license_type @@ -4522,7 +4433,7 @@ def __init__( self.gmsa_profile = gmsa_profile -class ManagedServiceIdentityUserAssignedIdentitiesValue(msrest.serialization.Model): +class ManagedServiceIdentityUserAssignedIdentitiesValue(_serialization.Model): """ManagedServiceIdentityUserAssignedIdentitiesValue. Variables are only populated by the server, and will be ignored when sending a request. @@ -4534,27 +4445,23 @@ class ManagedServiceIdentityUserAssignedIdentitiesValue(msrest.serialization.Mod """ _validation = { - 'principal_id': {'readonly': True}, - 'client_id': {'readonly': True}, + "principal_id": {"readonly": True}, + "client_id": {"readonly": True}, } _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, + "principal_id": {"key": "principalId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(ManagedServiceIdentityUserAssignedIdentitiesValue, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.principal_id = None self.client_id = None -class OperationListResult(msrest.serialization.Model): +class OperationListResult(_serialization.Model): """The List Operation response. Variables are only populated by the server, and will be ignored when sending a request. @@ -4564,24 +4471,20 @@ class OperationListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[OperationValue]'}, + "value": {"key": "value", "type": "[OperationValue]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(OperationListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None -class OperationValue(msrest.serialization.Model): +class OperationValue(_serialization.Model): """Describes the properties of a Operation value. Variables are only populated by the server, and will be ignored when sending a request. @@ -4601,30 +4504,26 @@ class OperationValue(msrest.serialization.Model): """ _validation = { - 'origin': {'readonly': True}, - 'name': {'readonly': True}, - 'operation': {'readonly': True}, - 'resource': {'readonly': True}, - 'description': {'readonly': True}, - 'provider': {'readonly': True}, + "origin": {"readonly": True}, + "name": {"readonly": True}, + "operation": {"readonly": True}, + "resource": {"readonly": True}, + "description": {"readonly": True}, + "provider": {"readonly": True}, } _attribute_map = { - 'origin': {'key': 'origin', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'operation': {'key': 'display.operation', 'type': 'str'}, - 'resource': {'key': 'display.resource', 'type': 'str'}, - 'description': {'key': 'display.description', 'type': 'str'}, - 'provider': {'key': 'display.provider', 'type': 'str'}, + "origin": {"key": "origin", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "operation": {"key": "display.operation", "type": "str"}, + "resource": {"key": "display.resource", "type": "str"}, + "description": {"key": "display.description", "type": "str"}, + "provider": {"key": "display.provider", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(OperationValue, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.origin = None self.name = None self.operation = None @@ -4633,7 +4532,7 @@ def __init__( self.provider = None -class OSOptionProfile(msrest.serialization.Model): +class OSOptionProfile(_serialization.Model): """The OS option profile. Variables are only populated by the server, and will be ignored when sending a request. @@ -4646,83 +4545,72 @@ class OSOptionProfile(msrest.serialization.Model): :vartype name: str :ivar type: The type of the OS option resource. :vartype type: str - :ivar os_option_property_list: Required. The list of OS options. + :ivar os_option_property_list: The list of OS options. Required. :vartype os_option_property_list: list[~azure.mgmt.containerservice.v2022_01_01.models.OSOptionProperty] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'os_option_property_list': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "os_option_property_list": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'os_option_property_list': {'key': 'properties.osOptionPropertyList', 'type': '[OSOptionProperty]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "os_option_property_list": {"key": "properties.osOptionPropertyList", "type": "[OSOptionProperty]"}, } - def __init__( - self, - *, - os_option_property_list: List["_models.OSOptionProperty"], - **kwargs - ): + def __init__(self, *, os_option_property_list: List["_models.OSOptionProperty"], **kwargs): """ - :keyword os_option_property_list: Required. The list of OS options. + :keyword os_option_property_list: The list of OS options. Required. :paramtype os_option_property_list: list[~azure.mgmt.containerservice.v2022_01_01.models.OSOptionProperty] """ - super(OSOptionProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None self.os_option_property_list = os_option_property_list -class OSOptionProperty(msrest.serialization.Model): +class OSOptionProperty(_serialization.Model): """OS option property. All required parameters must be populated in order to send to Azure. - :ivar os_type: Required. The OS type. + :ivar os_type: The OS type. Required. :vartype os_type: str - :ivar enable_fips_image: Required. Whether the image is FIPS-enabled. + :ivar enable_fips_image: Whether the image is FIPS-enabled. Required. :vartype enable_fips_image: bool """ _validation = { - 'os_type': {'required': True}, - 'enable_fips_image': {'required': True}, + "os_type": {"required": True}, + "enable_fips_image": {"required": True}, } _attribute_map = { - 'os_type': {'key': 'os-type', 'type': 'str'}, - 'enable_fips_image': {'key': 'enable-fips-image', 'type': 'bool'}, + "os_type": {"key": "os-type", "type": "str"}, + "enable_fips_image": {"key": "enable-fips-image", "type": "bool"}, } - def __init__( - self, - *, - os_type: str, - enable_fips_image: bool, - **kwargs - ): + def __init__(self, *, os_type: str, enable_fips_image: bool, **kwargs): """ - :keyword os_type: Required. The OS type. + :keyword os_type: The OS type. Required. :paramtype os_type: str - :keyword enable_fips_image: Required. Whether the image is FIPS-enabled. + :keyword enable_fips_image: Whether the image is FIPS-enabled. Required. :paramtype enable_fips_image: bool """ - super(OSOptionProperty, self).__init__(**kwargs) + super().__init__(**kwargs) self.os_type = os_type self.enable_fips_image = enable_fips_image -class OutboundEnvironmentEndpoint(msrest.serialization.Model): +class OutboundEnvironmentEndpoint(_serialization.Model): """Egress endpoints which AKS agent nodes connect to for common purpose. :ivar category: The category of endpoints accessed by the AKS agent node, e.g. @@ -4733,8 +4621,8 @@ class OutboundEnvironmentEndpoint(msrest.serialization.Model): """ _attribute_map = { - 'category': {'key': 'category', 'type': 'str'}, - 'endpoints': {'key': 'endpoints', 'type': '[EndpointDependency]'}, + "category": {"key": "category", "type": "str"}, + "endpoints": {"key": "endpoints", "type": "[EndpointDependency]"}, } def __init__( @@ -4751,19 +4639,19 @@ def __init__( :keyword endpoints: The endpoints that AKS agent nodes connect to. :paramtype endpoints: list[~azure.mgmt.containerservice.v2022_01_01.models.EndpointDependency] """ - super(OutboundEnvironmentEndpoint, self).__init__(**kwargs) + super().__init__(**kwargs) self.category = category self.endpoints = endpoints -class OutboundEnvironmentEndpointCollection(msrest.serialization.Model): +class OutboundEnvironmentEndpointCollection(_serialization.Model): """Collection of OutboundEnvironmentEndpoint. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar value: Required. Collection of resources. + :ivar value: Collection of resources. Required. :vartype value: list[~azure.mgmt.containerservice.v2022_01_01.models.OutboundEnvironmentEndpoint] :ivar next_link: Link to next page of resources. @@ -4771,59 +4659,49 @@ class OutboundEnvironmentEndpointCollection(msrest.serialization.Model): """ _validation = { - 'value': {'required': True}, - 'next_link': {'readonly': True}, + "value": {"required": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[OutboundEnvironmentEndpoint]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[OutboundEnvironmentEndpoint]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: List["_models.OutboundEnvironmentEndpoint"], - **kwargs - ): + def __init__(self, *, value: List["_models.OutboundEnvironmentEndpoint"], **kwargs): """ - :keyword value: Required. Collection of resources. + :keyword value: Collection of resources. Required. :paramtype value: list[~azure.mgmt.containerservice.v2022_01_01.models.OutboundEnvironmentEndpoint] """ - super(OutboundEnvironmentEndpointCollection, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class PowerState(msrest.serialization.Model): +class PowerState(_serialization.Model): """Describes the Power State of the cluster. - :ivar code: Tells whether the cluster is Running or Stopped. Known values are: "Running", + :ivar code: Tells whether the cluster is Running or Stopped. Known values are: "Running" and "Stopped". :vartype code: str or ~azure.mgmt.containerservice.v2022_01_01.models.Code """ _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, + "code": {"key": "code", "type": "str"}, } - def __init__( - self, - *, - code: Optional[Union[str, "_models.Code"]] = None, - **kwargs - ): + def __init__(self, *, code: Optional[Union[str, "_models.Code"]] = None, **kwargs): """ - :keyword code: Tells whether the cluster is Running or Stopped. Known values are: "Running", + :keyword code: Tells whether the cluster is Running or Stopped. Known values are: "Running" and "Stopped". :paramtype code: str or ~azure.mgmt.containerservice.v2022_01_01.models.Code """ - super(PowerState, self).__init__(**kwargs) + super().__init__(**kwargs) self.code = code -class PrivateEndpoint(msrest.serialization.Model): +class PrivateEndpoint(_serialization.Model): """Private endpoint which a connection belongs to. :ivar id: The resource ID of the private endpoint. @@ -4831,24 +4709,19 @@ class PrivateEndpoint(msrest.serialization.Model): """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, } - def __init__( - self, - *, - id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin """ :keyword id: The resource ID of the private endpoint. :paramtype id: str """ - super(PrivateEndpoint, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id -class PrivateEndpointConnection(msrest.serialization.Model): +class PrivateEndpointConnection(_serialization.Model): """A private endpoint connection. Variables are only populated by the server, and will be ignored when sending a request. @@ -4860,7 +4733,7 @@ class PrivateEndpointConnection(msrest.serialization.Model): :ivar type: The resource type. :vartype type: str :ivar provisioning_state: The current provisioning state. Known values are: "Succeeded", - "Creating", "Deleting", "Failed". + "Creating", "Deleting", and "Failed". :vartype provisioning_state: str or ~azure.mgmt.containerservice.v2022_01_01.models.PrivateEndpointConnectionProvisioningState :ivar private_endpoint: The resource of private endpoint. @@ -4872,19 +4745,22 @@ class PrivateEndpointConnection(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'provisioning_state': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, - 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "private_endpoint": {"key": "properties.privateEndpoint", "type": "PrivateEndpoint"}, + "private_link_service_connection_state": { + "key": "properties.privateLinkServiceConnectionState", + "type": "PrivateLinkServiceConnectionState", + }, } def __init__( @@ -4902,7 +4778,7 @@ def __init__( :paramtype private_link_service_connection_state: ~azure.mgmt.containerservice.v2022_01_01.models.PrivateLinkServiceConnectionState """ - super(PrivateEndpointConnection, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -4911,7 +4787,7 @@ def __init__( self.private_link_service_connection_state = private_link_service_connection_state -class PrivateEndpointConnectionListResult(msrest.serialization.Model): +class PrivateEndpointConnectionListResult(_serialization.Model): """A list of private endpoint connections. :ivar value: The collection value. @@ -4919,25 +4795,20 @@ class PrivateEndpointConnectionListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, + "value": {"key": "value", "type": "[PrivateEndpointConnection]"}, } - def __init__( - self, - *, - value: Optional[List["_models.PrivateEndpointConnection"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.PrivateEndpointConnection"]] = None, **kwargs): """ :keyword value: The collection value. :paramtype value: list[~azure.mgmt.containerservice.v2022_01_01.models.PrivateEndpointConnection] """ - super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value -class PrivateLinkResource(msrest.serialization.Model): +class PrivateLinkResource(_serialization.Model): """A private link resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -4958,22 +4829,22 @@ class PrivateLinkResource(msrest.serialization.Model): """ _validation = { - 'private_link_service_id': {'readonly': True}, + "private_link_service_id": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'group_id': {'key': 'groupId', 'type': 'str'}, - 'required_members': {'key': 'requiredMembers', 'type': '[str]'}, - 'private_link_service_id': {'key': 'privateLinkServiceID', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "group_id": {"key": "groupId", "type": "str"}, + "required_members": {"key": "requiredMembers", "type": "[str]"}, + "private_link_service_id": {"key": "privateLinkServiceID", "type": "str"}, } def __init__( self, *, - id: Optional[str] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin name: Optional[str] = None, type: Optional[str] = None, group_id: Optional[str] = None, @@ -4992,7 +4863,7 @@ def __init__( :keyword required_members: The RequiredMembers of the resource. :paramtype required_members: list[str] """ - super(PrivateLinkResource, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id self.name = name self.type = type @@ -5001,7 +4872,7 @@ def __init__( self.private_link_service_id = None -class PrivateLinkResourcesListResult(msrest.serialization.Model): +class PrivateLinkResourcesListResult(_serialization.Model): """A list of private link resources. :ivar value: The collection value. @@ -5009,36 +4880,31 @@ class PrivateLinkResourcesListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, + "value": {"key": "value", "type": "[PrivateLinkResource]"}, } - def __init__( - self, - *, - value: Optional[List["_models.PrivateLinkResource"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.PrivateLinkResource"]] = None, **kwargs): """ :keyword value: The collection value. :paramtype value: list[~azure.mgmt.containerservice.v2022_01_01.models.PrivateLinkResource] """ - super(PrivateLinkResourcesListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value -class PrivateLinkServiceConnectionState(msrest.serialization.Model): +class PrivateLinkServiceConnectionState(_serialization.Model): """The state of a private link service connection. :ivar status: The private link service connection status. Known values are: "Pending", - "Approved", "Rejected", "Disconnected". + "Approved", "Rejected", and "Disconnected". :vartype status: str or ~azure.mgmt.containerservice.v2022_01_01.models.ConnectionStatus :ivar description: The private link service connection description. :vartype description: str """ _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, + "status": {"key": "status", "type": "str"}, + "description": {"key": "description", "type": "str"}, } def __init__( @@ -5050,17 +4916,17 @@ def __init__( ): """ :keyword status: The private link service connection status. Known values are: "Pending", - "Approved", "Rejected", "Disconnected". + "Approved", "Rejected", and "Disconnected". :paramtype status: str or ~azure.mgmt.containerservice.v2022_01_01.models.ConnectionStatus :keyword description: The private link service connection description. :paramtype description: str """ - super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) + super().__init__(**kwargs) self.status = status self.description = description -class ResourceReference(msrest.serialization.Model): +class ResourceReference(_serialization.Model): """A reference to an Azure resource. :ivar id: The fully qualified Azure resource id. @@ -5068,29 +4934,24 @@ class ResourceReference(msrest.serialization.Model): """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, } - def __init__( - self, - *, - id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin """ :keyword id: The fully qualified Azure resource id. :paramtype id: str """ - super(ResourceReference, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id -class RunCommandRequest(msrest.serialization.Model): +class RunCommandRequest(_serialization.Model): """A run command request. All required parameters must be populated in order to send to Azure. - :ivar command: Required. The command to run. + :ivar command: The command to run. Required. :vartype command: str :ivar context: A base64 encoded zip file containing the files required by the command. :vartype context: str @@ -5099,38 +4960,31 @@ class RunCommandRequest(msrest.serialization.Model): """ _validation = { - 'command': {'required': True}, + "command": {"required": True}, } _attribute_map = { - 'command': {'key': 'command', 'type': 'str'}, - 'context': {'key': 'context', 'type': 'str'}, - 'cluster_token': {'key': 'clusterToken', 'type': 'str'}, + "command": {"key": "command", "type": "str"}, + "context": {"key": "context", "type": "str"}, + "cluster_token": {"key": "clusterToken", "type": "str"}, } - def __init__( - self, - *, - command: str, - context: Optional[str] = None, - cluster_token: Optional[str] = None, - **kwargs - ): + def __init__(self, *, command: str, context: Optional[str] = None, cluster_token: Optional[str] = None, **kwargs): """ - :keyword command: Required. The command to run. + :keyword command: The command to run. Required. :paramtype command: str :keyword context: A base64 encoded zip file containing the files required by the command. :paramtype context: str :keyword cluster_token: AuthToken issued for AKS AAD Server App. :paramtype cluster_token: str """ - super(RunCommandRequest, self).__init__(**kwargs) + super().__init__(**kwargs) self.command = command self.context = context self.cluster_token = cluster_token -class RunCommandResult(msrest.serialization.Model): +class RunCommandResult(_serialization.Model): """run command result. Variables are only populated by the server, and will be ignored when sending a request. @@ -5152,32 +5006,28 @@ class RunCommandResult(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'exit_code': {'readonly': True}, - 'started_at': {'readonly': True}, - 'finished_at': {'readonly': True}, - 'logs': {'readonly': True}, - 'reason': {'readonly': True}, + "id": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "exit_code": {"readonly": True}, + "started_at": {"readonly": True}, + "finished_at": {"readonly": True}, + "logs": {"readonly": True}, + "reason": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'exit_code': {'key': 'properties.exitCode', 'type': 'int'}, - 'started_at': {'key': 'properties.startedAt', 'type': 'iso-8601'}, - 'finished_at': {'key': 'properties.finishedAt', 'type': 'iso-8601'}, - 'logs': {'key': 'properties.logs', 'type': 'str'}, - 'reason': {'key': 'properties.reason', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(RunCommandResult, self).__init__(**kwargs) + "id": {"key": "id", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "exit_code": {"key": "properties.exitCode", "type": "int"}, + "started_at": {"key": "properties.startedAt", "type": "iso-8601"}, + "finished_at": {"key": "properties.finishedAt", "type": "iso-8601"}, + "logs": {"key": "properties.logs", "type": "str"}, + "reason": {"key": "properties.reason", "type": "str"}, + } + + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.id = None self.provisioning_state = None self.exit_code = None @@ -5187,7 +5037,7 @@ def __init__( self.reason = None -class Snapshot(Resource): +class Snapshot(Resource): # pylint: disable=too-many-instance-attributes """A node pool snapshot resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -5200,27 +5050,26 @@ class Snapshot(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar system_data: The system metadata relating to this snapshot. :vartype system_data: ~azure.mgmt.containerservice.v2022_01_01.models.SystemData :ivar creation_data: CreationData to be used to specify the source agent pool resource ID to create this snapshot. :vartype creation_data: ~azure.mgmt.containerservice.v2022_01_01.models.CreationData - :ivar snapshot_type: The type of a snapshot. The default is NodePool. Known values are: - "NodePool". Default value: "NodePool". + :ivar snapshot_type: The type of a snapshot. The default is NodePool. "NodePool" :vartype snapshot_type: str or ~azure.mgmt.containerservice.v2022_01_01.models.SnapshotType :ivar kubernetes_version: The version of Kubernetes. :vartype kubernetes_version: str :ivar node_image_version: The version of node image. :vartype node_image_version: str - :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_01_01.models.OSType :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known - values are: "Ubuntu", "CBLMariner". + values are: "Ubuntu" and "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2022_01_01.models.OSSKU :ivar vm_size: The size of the VM. :vartype vm_size: str @@ -5229,34 +5078,34 @@ class Snapshot(Resource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'system_data': {'readonly': True}, - 'kubernetes_version': {'readonly': True}, - 'node_image_version': {'readonly': True}, - 'os_type': {'readonly': True}, - 'os_sku': {'readonly': True}, - 'vm_size': {'readonly': True}, - 'enable_fips': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, + "system_data": {"readonly": True}, + "kubernetes_version": {"readonly": True}, + "node_image_version": {"readonly": True}, + "os_type": {"readonly": True}, + "os_sku": {"readonly": True}, + "vm_size": {"readonly": True}, + "enable_fips": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'creation_data': {'key': 'properties.creationData', 'type': 'CreationData'}, - 'snapshot_type': {'key': 'properties.snapshotType', 'type': 'str'}, - 'kubernetes_version': {'key': 'properties.kubernetesVersion', 'type': 'str'}, - 'node_image_version': {'key': 'properties.nodeImageVersion', 'type': 'str'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'os_sku': {'key': 'properties.osSku', 'type': 'str'}, - 'vm_size': {'key': 'properties.vmSize', 'type': 'str'}, - 'enable_fips': {'key': 'properties.enableFIPS', 'type': 'bool'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "creation_data": {"key": "properties.creationData", "type": "CreationData"}, + "snapshot_type": {"key": "properties.snapshotType", "type": "str"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "node_image_version": {"key": "properties.nodeImageVersion", "type": "str"}, + "os_type": {"key": "properties.osType", "type": "str"}, + "os_sku": {"key": "properties.osSku", "type": "str"}, + "vm_size": {"key": "properties.vmSize", "type": "str"}, + "enable_fips": {"key": "properties.enableFIPS", "type": "bool"}, } def __init__( @@ -5265,22 +5114,21 @@ def __init__( location: str, tags: Optional[Dict[str, str]] = None, creation_data: Optional["_models.CreationData"] = None, - snapshot_type: Optional[Union[str, "_models.SnapshotType"]] = "NodePool", + snapshot_type: Union[str, "_models.SnapshotType"] = "NodePool", **kwargs ): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword creation_data: CreationData to be used to specify the source agent pool resource ID to create this snapshot. :paramtype creation_data: ~azure.mgmt.containerservice.v2022_01_01.models.CreationData - :keyword snapshot_type: The type of a snapshot. The default is NodePool. Known values are: - "NodePool". Default value: "NodePool". + :keyword snapshot_type: The type of a snapshot. The default is NodePool. "NodePool" :paramtype snapshot_type: str or ~azure.mgmt.containerservice.v2022_01_01.models.SnapshotType """ - super(Snapshot, self).__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.system_data = None self.creation_data = creation_data self.snapshot_type = snapshot_type @@ -5292,7 +5140,7 @@ def __init__( self.enable_fips = None -class SnapshotListResult(msrest.serialization.Model): +class SnapshotListResult(_serialization.Model): """The response from the List Snapshots operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -5304,30 +5152,25 @@ class SnapshotListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[Snapshot]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[Snapshot]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.Snapshot"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.Snapshot"]] = None, **kwargs): """ :keyword value: The list of snapshots. :paramtype value: list[~azure.mgmt.containerservice.v2022_01_01.models.Snapshot] """ - super(SnapshotListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class SysctlConfig(msrest.serialization.Model): +class SysctlConfig(_serialization.Model): # pylint: disable=too-many-instance-attributes """Sysctl settings for Linux agent nodes. :ivar net_core_somaxconn: Sysctl setting net.core.somaxconn. @@ -5389,37 +5232,37 @@ class SysctlConfig(msrest.serialization.Model): """ _attribute_map = { - 'net_core_somaxconn': {'key': 'netCoreSomaxconn', 'type': 'int'}, - 'net_core_netdev_max_backlog': {'key': 'netCoreNetdevMaxBacklog', 'type': 'int'}, - 'net_core_rmem_default': {'key': 'netCoreRmemDefault', 'type': 'int'}, - 'net_core_rmem_max': {'key': 'netCoreRmemMax', 'type': 'int'}, - 'net_core_wmem_default': {'key': 'netCoreWmemDefault', 'type': 'int'}, - 'net_core_wmem_max': {'key': 'netCoreWmemMax', 'type': 'int'}, - 'net_core_optmem_max': {'key': 'netCoreOptmemMax', 'type': 'int'}, - 'net_ipv4_tcp_max_syn_backlog': {'key': 'netIpv4TcpMaxSynBacklog', 'type': 'int'}, - 'net_ipv4_tcp_max_tw_buckets': {'key': 'netIpv4TcpMaxTwBuckets', 'type': 'int'}, - 'net_ipv4_tcp_fin_timeout': {'key': 'netIpv4TcpFinTimeout', 'type': 'int'}, - 'net_ipv4_tcp_keepalive_time': {'key': 'netIpv4TcpKeepaliveTime', 'type': 'int'}, - 'net_ipv4_tcp_keepalive_probes': {'key': 'netIpv4TcpKeepaliveProbes', 'type': 'int'}, - 'net_ipv4_tcpkeepalive_intvl': {'key': 'netIpv4TcpkeepaliveIntvl', 'type': 'int'}, - 'net_ipv4_tcp_tw_reuse': {'key': 'netIpv4TcpTwReuse', 'type': 'bool'}, - 'net_ipv4_ip_local_port_range': {'key': 'netIpv4IpLocalPortRange', 'type': 'str'}, - 'net_ipv4_neigh_default_gc_thresh1': {'key': 'netIpv4NeighDefaultGcThresh1', 'type': 'int'}, - 'net_ipv4_neigh_default_gc_thresh2': {'key': 'netIpv4NeighDefaultGcThresh2', 'type': 'int'}, - 'net_ipv4_neigh_default_gc_thresh3': {'key': 'netIpv4NeighDefaultGcThresh3', 'type': 'int'}, - 'net_netfilter_nf_conntrack_max': {'key': 'netNetfilterNfConntrackMax', 'type': 'int'}, - 'net_netfilter_nf_conntrack_buckets': {'key': 'netNetfilterNfConntrackBuckets', 'type': 'int'}, - 'fs_inotify_max_user_watches': {'key': 'fsInotifyMaxUserWatches', 'type': 'int'}, - 'fs_file_max': {'key': 'fsFileMax', 'type': 'int'}, - 'fs_aio_max_nr': {'key': 'fsAioMaxNr', 'type': 'int'}, - 'fs_nr_open': {'key': 'fsNrOpen', 'type': 'int'}, - 'kernel_threads_max': {'key': 'kernelThreadsMax', 'type': 'int'}, - 'vm_max_map_count': {'key': 'vmMaxMapCount', 'type': 'int'}, - 'vm_swappiness': {'key': 'vmSwappiness', 'type': 'int'}, - 'vm_vfs_cache_pressure': {'key': 'vmVfsCachePressure', 'type': 'int'}, - } - - def __init__( + "net_core_somaxconn": {"key": "netCoreSomaxconn", "type": "int"}, + "net_core_netdev_max_backlog": {"key": "netCoreNetdevMaxBacklog", "type": "int"}, + "net_core_rmem_default": {"key": "netCoreRmemDefault", "type": "int"}, + "net_core_rmem_max": {"key": "netCoreRmemMax", "type": "int"}, + "net_core_wmem_default": {"key": "netCoreWmemDefault", "type": "int"}, + "net_core_wmem_max": {"key": "netCoreWmemMax", "type": "int"}, + "net_core_optmem_max": {"key": "netCoreOptmemMax", "type": "int"}, + "net_ipv4_tcp_max_syn_backlog": {"key": "netIpv4TcpMaxSynBacklog", "type": "int"}, + "net_ipv4_tcp_max_tw_buckets": {"key": "netIpv4TcpMaxTwBuckets", "type": "int"}, + "net_ipv4_tcp_fin_timeout": {"key": "netIpv4TcpFinTimeout", "type": "int"}, + "net_ipv4_tcp_keepalive_time": {"key": "netIpv4TcpKeepaliveTime", "type": "int"}, + "net_ipv4_tcp_keepalive_probes": {"key": "netIpv4TcpKeepaliveProbes", "type": "int"}, + "net_ipv4_tcpkeepalive_intvl": {"key": "netIpv4TcpkeepaliveIntvl", "type": "int"}, + "net_ipv4_tcp_tw_reuse": {"key": "netIpv4TcpTwReuse", "type": "bool"}, + "net_ipv4_ip_local_port_range": {"key": "netIpv4IpLocalPortRange", "type": "str"}, + "net_ipv4_neigh_default_gc_thresh1": {"key": "netIpv4NeighDefaultGcThresh1", "type": "int"}, + "net_ipv4_neigh_default_gc_thresh2": {"key": "netIpv4NeighDefaultGcThresh2", "type": "int"}, + "net_ipv4_neigh_default_gc_thresh3": {"key": "netIpv4NeighDefaultGcThresh3", "type": "int"}, + "net_netfilter_nf_conntrack_max": {"key": "netNetfilterNfConntrackMax", "type": "int"}, + "net_netfilter_nf_conntrack_buckets": {"key": "netNetfilterNfConntrackBuckets", "type": "int"}, + "fs_inotify_max_user_watches": {"key": "fsInotifyMaxUserWatches", "type": "int"}, + "fs_file_max": {"key": "fsFileMax", "type": "int"}, + "fs_aio_max_nr": {"key": "fsAioMaxNr", "type": "int"}, + "fs_nr_open": {"key": "fsNrOpen", "type": "int"}, + "kernel_threads_max": {"key": "kernelThreadsMax", "type": "int"}, + "vm_max_map_count": {"key": "vmMaxMapCount", "type": "int"}, + "vm_swappiness": {"key": "vmSwappiness", "type": "int"}, + "vm_vfs_cache_pressure": {"key": "vmVfsCachePressure", "type": "int"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, net_core_somaxconn: Optional[int] = None, @@ -5510,7 +5353,7 @@ def __init__( :keyword vm_vfs_cache_pressure: Sysctl setting vm.vfs_cache_pressure. :paramtype vm_vfs_cache_pressure: int """ - super(SysctlConfig, self).__init__(**kwargs) + super().__init__(**kwargs) self.net_core_somaxconn = net_core_somaxconn self.net_core_netdev_max_backlog = net_core_netdev_max_backlog self.net_core_rmem_default = net_core_rmem_default @@ -5541,20 +5384,20 @@ def __init__( self.vm_vfs_cache_pressure = vm_vfs_cache_pressure -class SystemData(msrest.serialization.Model): +class SystemData(_serialization.Model): """Metadata pertaining to creation and last modification of the resource. :ivar created_by: The identity that created the resource. :vartype created_by: str :ivar created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", "Key". + "User", "Application", "ManagedIdentity", and "Key". :vartype created_by_type: str or ~azure.mgmt.containerservice.v2022_01_01.models.CreatedByType :ivar created_at: The UTC timestamp of resource creation. :vartype created_at: ~datetime.datetime :ivar last_modified_by: The identity that last modified the resource. :vartype last_modified_by: str :ivar last_modified_by_type: The type of identity that last modified the resource. Known values - are: "User", "Application", "ManagedIdentity", "Key". + are: "User", "Application", "ManagedIdentity", and "Key". :vartype last_modified_by_type: str or ~azure.mgmt.containerservice.v2022_01_01.models.CreatedByType :ivar last_modified_at: The type of identity that last modified the resource. @@ -5562,12 +5405,12 @@ class SystemData(msrest.serialization.Model): """ _attribute_map = { - 'created_by': {'key': 'createdBy', 'type': 'str'}, - 'created_by_type': {'key': 'createdByType', 'type': 'str'}, - 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, - 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, - 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, - 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + "created_by": {"key": "createdBy", "type": "str"}, + "created_by_type": {"key": "createdByType", "type": "str"}, + "created_at": {"key": "createdAt", "type": "iso-8601"}, + "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, + "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, + "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, } def __init__( @@ -5585,7 +5428,7 @@ def __init__( :keyword created_by: The identity that created the resource. :paramtype created_by: str :keyword created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", "Key". + "User", "Application", "ManagedIdentity", and "Key". :paramtype created_by_type: str or ~azure.mgmt.containerservice.v2022_01_01.models.CreatedByType :keyword created_at: The UTC timestamp of resource creation. @@ -5593,13 +5436,13 @@ def __init__( :keyword last_modified_by: The identity that last modified the resource. :paramtype last_modified_by: str :keyword last_modified_by_type: The type of identity that last modified the resource. Known - values are: "User", "Application", "ManagedIdentity", "Key". + values are: "User", "Application", "ManagedIdentity", and "Key". :paramtype last_modified_by_type: str or ~azure.mgmt.containerservice.v2022_01_01.models.CreatedByType :keyword last_modified_at: The type of identity that last modified the resource. :paramtype last_modified_at: ~datetime.datetime """ - super(SystemData, self).__init__(**kwargs) + super().__init__(**kwargs) self.created_by = created_by self.created_by_type = created_by_type self.created_at = created_at @@ -5608,36 +5451,31 @@ def __init__( self.last_modified_at = last_modified_at -class TagsObject(msrest.serialization.Model): +class TagsObject(_serialization.Model): """Tags object for patch operations. - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] """ _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] """ - super(TagsObject, self).__init__(**kwargs) + super().__init__(**kwargs) self.tags = tags -class TimeInWeek(msrest.serialization.Model): +class TimeInWeek(_serialization.Model): """Time in a week. :ivar day: The day of the week. Known values are: "Sunday", "Monday", "Tuesday", "Wednesday", - "Thursday", "Friday", "Saturday". + "Thursday", "Friday", and "Saturday". :vartype day: str or ~azure.mgmt.containerservice.v2022_01_01.models.WeekDay :ivar hour_slots: Each integer hour represents a time range beginning at 0m after the hour ending at the next hour (non-inclusive). 0 corresponds to 00:00 UTC, 23 corresponds to 23:00 @@ -5646,32 +5484,28 @@ class TimeInWeek(msrest.serialization.Model): """ _attribute_map = { - 'day': {'key': 'day', 'type': 'str'}, - 'hour_slots': {'key': 'hourSlots', 'type': '[int]'}, + "day": {"key": "day", "type": "str"}, + "hour_slots": {"key": "hourSlots", "type": "[int]"}, } def __init__( - self, - *, - day: Optional[Union[str, "_models.WeekDay"]] = None, - hour_slots: Optional[List[int]] = None, - **kwargs + self, *, day: Optional[Union[str, "_models.WeekDay"]] = None, hour_slots: Optional[List[int]] = None, **kwargs ): """ :keyword day: The day of the week. Known values are: "Sunday", "Monday", "Tuesday", - "Wednesday", "Thursday", "Friday", "Saturday". + "Wednesday", "Thursday", "Friday", and "Saturday". :paramtype day: str or ~azure.mgmt.containerservice.v2022_01_01.models.WeekDay :keyword hour_slots: Each integer hour represents a time range beginning at 0m after the hour ending at the next hour (non-inclusive). 0 corresponds to 00:00 UTC, 23 corresponds to 23:00 UTC. Specifying [0, 1] means the 00:00 - 02:00 UTC time range. :paramtype hour_slots: list[int] """ - super(TimeInWeek, self).__init__(**kwargs) + super().__init__(**kwargs) self.day = day self.hour_slots = hour_slots -class TimeSpan(msrest.serialization.Model): +class TimeSpan(_serialization.Model): """For example, between 2021-05-25T13:00:00Z and 2021-05-25T14:00:00Z. :ivar start: The start of a time span. @@ -5681,29 +5515,23 @@ class TimeSpan(msrest.serialization.Model): """ _attribute_map = { - 'start': {'key': 'start', 'type': 'iso-8601'}, - 'end': {'key': 'end', 'type': 'iso-8601'}, + "start": {"key": "start", "type": "iso-8601"}, + "end": {"key": "end", "type": "iso-8601"}, } - def __init__( - self, - *, - start: Optional[datetime.datetime] = None, - end: Optional[datetime.datetime] = None, - **kwargs - ): + def __init__(self, *, start: Optional[datetime.datetime] = None, end: Optional[datetime.datetime] = None, **kwargs): """ :keyword start: The start of a time span. :paramtype start: ~datetime.datetime :keyword end: The end of a time span. :paramtype end: ~datetime.datetime """ - super(TimeSpan, self).__init__(**kwargs) + super().__init__(**kwargs) self.start = start self.end = end -class WindowsGmsaProfile(msrest.serialization.Model): +class WindowsGmsaProfile(_serialization.Model): """Windows gMSA Profile in the managed cluster. :ivar enabled: Specifies whether to enable Windows gMSA in the managed cluster. @@ -5719,9 +5547,9 @@ class WindowsGmsaProfile(msrest.serialization.Model): """ _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'dns_server': {'key': 'dnsServer', 'type': 'str'}, - 'root_domain_name': {'key': 'rootDomainName', 'type': 'str'}, + "enabled": {"key": "enabled", "type": "bool"}, + "dns_server": {"key": "dnsServer", "type": "str"}, + "root_domain_name": {"key": "rootDomainName", "type": "str"}, } def __init__( @@ -5744,7 +5572,7 @@ def __init__( which is used to create the managed cluster. :paramtype root_domain_name: str """ - super(WindowsGmsaProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.dns_server = dns_server self.root_domain_name = root_domain_name diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/models/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/models/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/models/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/models/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/operations/__init__.py index e0748876288c..593b23075ce0 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/operations/__init__.py @@ -18,15 +18,16 @@ from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'Operations', - 'ManagedClustersOperations', - 'MaintenanceConfigurationsOperations', - 'AgentPoolsOperations', - 'PrivateEndpointConnectionsOperations', - 'PrivateLinkResourcesOperations', - 'ResolvePrivateLinkServiceIdOperations', - 'SnapshotsOperations', + "Operations", + "ManagedClustersOperations", + "MaintenanceConfigurationsOperations", + "AgentPoolsOperations", + "PrivateEndpointConnectionsOperations", + "PrivateLinkResourcesOperations", + "ResolvePrivateLinkServiceIdOperations", + "SnapshotsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/operations/_agent_pools_operations.py index 3bc68ab11bc5..08fa9065f933 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/operations/_agent_pools_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,288 +27,289 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - *, - json: Optional[_models.AgentPool] = None, - content: Any = None, - **kwargs: Any + _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, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + _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, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_get_upgrade_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_available_agent_pool_versions_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_upgrade_node_image_version_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_upgrade_node_image_version_request( + resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class AgentPoolsOperations: """ @@ -324,47 +330,39 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> Iterable[_models.AgentPoolListResult]: + def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> Iterable["_models.AgentPool"]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AgentPoolListResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_01_01.models.AgentPoolListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either AgentPool or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_01_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -372,16 +370,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -397,10 +390,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -410,54 +401,45 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore @distributed_trace def get( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPool: """Gets the specified managed cluster agent pool. Gets the specified managed cluster agent pool. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPool, or the result of cls(response) + :return: AgentPool or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.AgentPool - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -465,57 +447,60 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore def _create_or_update_initial( self, resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: _models.AgentPool, + parameters: Union[_models.AgentPool, IO], **kwargs: Any ) -> _models.AgentPool: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - _json = self._serialize.body(parameters, 'AgentPool') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "AgentPool") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -523,10 +508,9 @@ def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -534,40 +518,44 @@ def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - @distributed_trace + @overload def begin_create_or_update( self, resource_group_name: str, resource_name: str, agent_pool_name: str, parameters: _models.AgentPool, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.AgentPool]: """Creates or updates an agent pool in the specified managed cluster. Creates or updates an agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str - :param parameters: The agent pool to create or update. + :param parameters: The agent pool to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_01_01.models.AgentPool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -579,20 +567,96 @@ def begin_create_or_update( :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_01_01.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AgentPool]: + """Creates or updates an agent pool in the specified managed cluster. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: The agent pool to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_01_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: Union[_models.AgentPool, IO], + **kwargs: Any + ) -> LROPoller[_models.AgentPool]: + """Creates or updates an agent pool in the specified managed cluster. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: The agent pool to create or update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.mgmt.containerservice.v2022_01_01.models.AgentPool or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_01_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -601,66 +665,55 @@ def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -668,10 +721,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -681,26 +733,21 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + def begin_delete( + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> LROPoller[None]: """Deletes an agent pool in the specified managed cluster. Deletes an agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -712,99 +759,85 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPoolUpgradeProfile: """Gets the upgrade profile for an agent pool. Gets the upgrade profile for an agent pool. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolUpgradeProfile, or the result of cls(response) + :return: AgentPoolUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.AgentPoolUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -812,32 +845,27 @@ def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolUpgradeProfile', pipeline_response) + deserialized = self._deserialize("AgentPoolUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore @distributed_trace def get_available_agent_pool_versions( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported Kubernetes versions for the specified agent pool. @@ -845,33 +873,30 @@ def get_available_agent_pool_versions( `_ for more details about the version lifecycle. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolAvailableVersions, or the result of cls(response) + :return: AgentPoolAvailableVersions or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.AgentPoolAvailableVersions - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolAvailableVersions] - request = build_get_available_agent_pool_versions_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_available_agent_pool_versions.metadata['url'], + template_url=self.get_available_agent_pool_versions.metadata["url"], headers=_headers, params=_params, ) @@ -879,52 +904,43 @@ def get_available_agent_pool_versions( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolAvailableVersions', pipeline_response) + deserialized = self._deserialize("AgentPoolAvailableVersions", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_available_agent_pool_versions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore - + get_available_agent_pool_versions.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore def _upgrade_node_image_version_initial( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> Optional[_models.AgentPool]: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.AgentPool]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.AgentPool]] - - request = build_upgrade_node_image_version_request_initial( - subscription_id=self._config.subscription_id, + request = build_upgrade_node_image_version_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._upgrade_node_image_version_initial.metadata['url'], + template_url=self._upgrade_node_image_version_initial.metadata["url"], headers=_headers, params=_params, ) @@ -932,10 +948,9 @@ def _upgrade_node_image_version_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -945,37 +960,34 @@ def _upgrade_node_image_version_initial( deserialized = None response_headers = {} if response.status_code == 202: - response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) - - deserialized = self._deserialize('AgentPool', pipeline_response) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _upgrade_node_image_version_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore - + _upgrade_node_image_version_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore @distributed_trace def begin_upgrade_node_image_version( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any - ) -> LROPoller[_models.AgentPool]: + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any + ) -> LROPoller[None]: """Upgrades the node image version of an agent pool to the latest. Upgrading the node image version of an agent pool applies the newest OS and runtime updates to the nodes. AKS provides one new image per week with the latest updates. For more details on node image versions, see: https://docs.microsoft.com/azure/aks/node-image-upgrade. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -988,59 +1000,54 @@ def begin_upgrade_node_image_version( :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_01_01.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._upgrade_node_image_version_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) - - deserialized = self._deserialize('AgentPool', pipeline_response) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_upgrade_node_image_version.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore + begin_upgrade_node_image_version.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/operations/_maintenance_configurations_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/operations/_maintenance_configurations_operations.py index 13d2dd4eb5c4..5cda8d833938 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/operations/_maintenance_configurations_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/operations/_maintenance_configurations_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,173 +25,173 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +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_managed_cluster_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, config_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "configName": _SERIALIZER.url("config_name", config_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "configName": _SERIALIZER.url("config_name", config_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - config_name: str, - *, - json: Optional[_models.MaintenanceConfiguration] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, resource_name: str, config_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "configName": _SERIALIZER.url("config_name", config_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "configName": _SERIALIZER.url("config_name", config_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, config_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "configName": _SERIALIZER.url("config_name", config_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "configName": _SERIALIZER.url("config_name", config_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class MaintenanceConfigurationsOperations: """ @@ -207,48 +212,43 @@ def __init__(self, *args, **kwargs): 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_managed_cluster( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> Iterable[_models.MaintenanceConfigurationListResult]: + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> Iterable["_models.MaintenanceConfiguration"]: """Gets a list of maintenance configurations in the specified managed cluster. Gets a list of maintenance configurations in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either MaintenanceConfigurationListResult or the result - of cls(response) + :return: An iterator like instance of either MaintenanceConfiguration or the result of + cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_01_01.models.MaintenanceConfigurationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_01_01.models.MaintenanceConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfigurationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfigurationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_managed_cluster_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_managed_cluster.metadata['url'], + template_url=self.list_by_managed_cluster.metadata["url"], headers=_headers, params=_params, ) @@ -256,16 +256,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_managed_cluster_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -281,10 +276,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -294,54 +287,45 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_managed_cluster.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations"} # type: ignore + list_by_managed_cluster.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations"} # type: ignore @distributed_trace def get( - self, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, config_name: str, **kwargs: Any ) -> _models.MaintenanceConfiguration: """Gets the specified maintenance configuration of a managed cluster. Gets the specified maintenance configuration of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: MaintenanceConfiguration, or the result of cls(response) + :return: MaintenanceConfiguration or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.MaintenanceConfiguration - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfiguration] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -349,75 +333,147 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) + deserialized = self._deserialize("MaintenanceConfiguration", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - @distributed_trace + @overload def create_or_update( self, resource_group_name: str, resource_name: str, config_name: str, parameters: _models.MaintenanceConfiguration, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.MaintenanceConfiguration: """Creates or updates a maintenance configuration in the specified managed cluster. Creates or updates a maintenance configuration in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str - :param parameters: The maintenance configuration to create or update. + :param parameters: The maintenance configuration to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_01_01.models.MaintenanceConfiguration + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: MaintenanceConfiguration, or the result of cls(response) + :return: MaintenanceConfiguration or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.MaintenanceConfiguration - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configuration in the specified managed cluster. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: The maintenance configuration to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: Union[_models.MaintenanceConfiguration, IO], + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configuration in the specified managed cluster. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: The maintenance configuration to create or update. Is either a model type or + a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_01_01.models.MaintenanceConfiguration or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfiguration] - _json = self._serialize.body(parameters, 'MaintenanceConfiguration') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "MaintenanceConfiguration") request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) @@ -425,68 +481,59 @@ def create_or_update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) + deserialized = self._deserialize("MaintenanceConfiguration", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore @distributed_trace def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, config_name: str, **kwargs: Any ) -> None: """Deletes a maintenance configuration. Deletes a maintenance configuration. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) @@ -494,10 +541,9 @@ def delete( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -507,5 +553,4 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/operations/_managed_clusters_operations.py index 9f2703d3d605..43af50ba21a8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/operations/_managed_clusters_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,200 +27,183 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_get_os_options_request( - subscription_id: str, - location: str, - *, - resource_type: Optional[str] = None, - **kwargs: Any + location: str, subscription_id: str, *, resource_type: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "location": _SERIALIZER.url("location", location, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if resource_type is not None: - _params['resource-type'] = _SERIALIZER.query("resource_type", resource_type, 'str') + _params["resource-type"] = _SERIALIZER.query("resource_type", resource_type, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters") + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters" + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_resource_group_request( - subscription_id: str, - resource_group_name: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters", + ) # 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', min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_upgrade_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_access_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, role_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "roleName": _SERIALIZER.url("role_name", role_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "roleName": _SERIALIZER.url("role_name", role_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_admin_credentials_request( - subscription_id: str, resource_group_name: str, resource_name: str, + subscription_id: str, *, server_fqdn: Optional[str] = None, **kwargs: Any @@ -223,40 +211,44 @@ def build_list_cluster_admin_credentials_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if server_fqdn is not None: - _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + _params["server-fqdn"] = _SERIALIZER.query("server_fqdn", server_fqdn, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_user_credentials_request( - subscription_id: str, resource_group_name: str, resource_name: str, + subscription_id: str, *, server_fqdn: Optional[str] = None, format: Optional[Union[str, "_models.Format"]] = None, @@ -265,42 +257,46 @@ def build_list_cluster_user_credentials_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if server_fqdn is not None: - _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + _params["server-fqdn"] = _SERIALIZER.query("server_fqdn", server_fqdn, "str") if format is not None: - _params['format'] = _SERIALIZER.query("format", format, 'str') + _params["format"] = _SERIALIZER.query("format", format, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_monitoring_user_credentials_request( - subscription_id: str, resource_group_name: str, resource_name: str, + subscription_id: str, *, server_fqdn: Optional[str] = None, **kwargs: Any @@ -308,520 +304,509 @@ def build_list_cluster_monitoring_user_credentials_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if server_fqdn is not None: - _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + _params["server-fqdn"] = _SERIALIZER.query("server_fqdn", server_fqdn, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: + +def build_get_request(resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedCluster] = None, - content: Any = None, - **kwargs: Any + +def build_create_or_update_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_update_tags_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.TagsObject] = None, - content: Any = None, - **kwargs: Any + +def build_update_tags_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + +def build_delete_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_reset_service_principal_profile_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedClusterServicePrincipalProfile] = None, - content: Any = None, - **kwargs: Any + +def build_reset_service_principal_profile_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_reset_aad_profile_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedClusterAADProfile] = None, - content: Any = None, - **kwargs: Any + +def build_reset_aad_profile_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_rotate_cluster_certificates_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + +def build_rotate_cluster_certificates_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_stop_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + +def build_stop_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_start_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + +def build_start_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_run_command_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.RunCommandRequest] = None, - content: Any = None, - **kwargs: Any + +def build_run_command_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_get_command_result_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - command_id: str, - **kwargs: Any + resource_group_name: str, resource_name: str, command_id: 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "commandId": _SERIALIZER.url("command_id", command_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "commandId": _SERIALIZER.url("command_id", command_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_list_outbound_network_dependencies_endpoints_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + class ManagedClustersOperations: # pylint: disable=too-many-public-methods """ @@ -842,46 +827,39 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def get_os_options( - self, - location: str, - resource_type: Optional[str] = None, - **kwargs: Any + self, location: str, resource_type: Optional[str] = None, **kwargs: Any ) -> _models.OSOptionProfile: """Gets supported OS options in the specified subscription. Gets supported OS options in the specified subscription. - :param location: The name of a supported Azure region. + :param location: The name of a supported Azure region. Required. :type location: str :param resource_type: The resource type for which the OS options needs to be returned. Default value is None. :type resource_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: OSOptionProfile, or the result of cls(response) + :return: OSOptionProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.OSOptionProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OSOptionProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OSOptionProfile] - request = build_get_os_options_request( - subscription_id=self._config.subscription_id, location=location, - api_version=api_version, + subscription_id=self._config.subscription_id, resource_type=resource_type, - template_url=self.get_os_options.metadata['url'], + api_version=api_version, + template_url=self.get_os_options.metadata["url"], headers=_headers, params=_params, ) @@ -889,59 +867,52 @@ def get_os_options( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('OSOptionProfile', pipeline_response) + deserialized = self._deserialize("OSOptionProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_os_options.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default"} # type: ignore - + get_os_options.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default"} # type: ignore @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.ManagedClusterListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.ManagedCluster"]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_01_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_01_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -949,14 +920,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -972,10 +940,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -985,49 +951,41 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> Iterable[_models.ManagedClusterListResult]: + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.ManagedCluster"]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_01_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_01_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -1035,15 +993,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -1059,10 +1013,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1072,50 +1024,42 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.ManagedClusterUpgradeProfile: """Gets the upgrade profile of a managed cluster. Gets the upgrade profile of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterUpgradeProfile, or the result of cls(response) + :return: ManagedClusterUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.ManagedClusterUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -1123,33 +1067,27 @@ def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterUpgradeProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore @distributed_trace def get_access_profile( - self, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, role_name: str, **kwargs: Any ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. @@ -1158,36 +1096,33 @@ def get_access_profile( `ListClusterAdminCredentials `_ . - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param role_name: The name of the role for managed cluster accessProfile resource. + :param role_name: The name of the role for managed cluster accessProfile resource. Required. :type role_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterAccessProfile, or the result of cls(response) + :return: ManagedClusterAccessProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.ManagedClusterAccessProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterAccessProfile] - request = build_get_access_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, role_name=role_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_access_profile.metadata['url'], + template_url=self.get_access_profile.metadata["url"], headers=_headers, params=_params, ) @@ -1195,68 +1130,59 @@ def get_access_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterAccessProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterAccessProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_access_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore - + get_access_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore @distributed_trace def list_cluster_admin_credentials( - self, - resource_group_name: str, - resource_name: str, - server_fqdn: Optional[str] = None, - **kwargs: Any + self, resource_group_name: str, resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any ) -> _models.CredentialResults: """Lists the admin credentials of a managed cluster. Lists the admin credentials of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_admin_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, - template_url=self.list_cluster_admin_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_admin_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -1264,25 +1190,23 @@ def list_cluster_admin_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_admin_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore - + list_cluster_admin_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore @distributed_trace def list_cluster_user_credentials( @@ -1297,41 +1221,39 @@ def list_cluster_user_credentials( Lists the user credentials of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :param format: Only apply to AAD clusters, specifies the format of returned kubeconfig. Format 'azure' will return azure auth-provider kubeconfig; format 'exec' will return exec format - kubeconfig, which requires kubelogin binary in the path. Default value is None. + kubeconfig, which requires kubelogin binary in the path. Known values are: "azure" and "exec". + Default value is None. :type format: str or ~azure.mgmt.containerservice.v2022_01_01.models.Format :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, format=format, - template_url=self.list_cluster_user_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -1339,68 +1261,59 @@ def list_cluster_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore - + list_cluster_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore @distributed_trace def list_cluster_monitoring_user_credentials( - self, - resource_group_name: str, - resource_name: str, - server_fqdn: Optional[str] = None, - **kwargs: Any + self, resource_group_name: str, resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any ) -> _models.CredentialResults: """Lists the cluster monitoring user credentials of a managed cluster. Lists the cluster monitoring user credentials of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_monitoring_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, - template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_monitoring_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -1408,64 +1321,54 @@ def list_cluster_monitoring_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_monitoring_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore - + list_cluster_monitoring_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore @distributed_trace - def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.ManagedCluster: + def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.ManagedCluster: """Gets a managed cluster. Gets a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedCluster, or the result of cls(response) + :return: ManagedCluster or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.ManagedCluster - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -1473,55 +1376,54 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _create_or_update_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.ManagedCluster, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'ManagedCluster') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedCluster") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1529,10 +1431,9 @@ def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -1540,37 +1441,41 @@ def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - - @distributed_trace + @overload def begin_create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedCluster, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. Creates or updates a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The managed cluster to create or update. + :param parameters: The managed cluster to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_01_01.models.ManagedCluster + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1583,90 +1488,155 @@ def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_01_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._create_or_update_initial( # type: ignore - resource_group_name=resource_group_name, - resource_name=resource_name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop('error_map', None) - def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized + @overload + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + Creates or updates a managed cluster. - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling - if cont_token: + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_01_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster to create or update. Is either a model type or a IO + type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_01_01.models.ManagedCluster or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_01_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ManagedCluster", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _update_tags_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.TagsObject, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request_initial( - subscription_id=self._config.subscription_id, + request = build_update_tags_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_tags_initial.metadata['url'], + content=_content, + template_url=self._update_tags_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1674,44 +1644,85 @@ def _update_tags_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_tags_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _update_tags_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - @distributed_trace + @overload def begin_update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates tags on a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2022_01_01.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_01_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates tags on a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1724,20 +1735,50 @@ def begin_update_tags( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_01_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates tags on a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_01_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_01_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, @@ -1745,64 +1786,54 @@ def begin_update_tags( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1810,10 +1841,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1823,23 +1853,17 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> LROPoller[None]: + def begin_delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> LROPoller[None]: """Deletes a managed cluster. Deletes a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1851,85 +1875,83 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterServicePrincipalProfile, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterServicePrincipalProfile") - request = build_reset_service_principal_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_service_principal_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_service_principal_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_service_principal_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1937,10 +1959,9 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1950,28 +1971,32 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re if cls: return cls(pipeline_response, None, {}) - _reset_service_principal_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore - + _reset_service_principal_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore - @distributed_trace - def begin_reset_service_principal_profile( # pylint: disable=inconsistent-return-statements + @overload + def begin_reset_service_principal_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterServicePrincipalProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: """Reset the Service Principal Profile of a managed cluster. This action cannot be performed on a cluster that is not using a service principal. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The service principal profile to set on the managed cluster. + :param parameters: The service principal profile to set on the managed cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2022_01_01.models.ManagedClusterServicePrincipalProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1982,20 +2007,89 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reset the Service Principal Profile of a managed cluster. + + This action cannot be performed on a cluster that is not using a service principal. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The service principal profile to set on the managed cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Reset the Service Principal Profile of a managed cluster. + + This action cannot be performed on a cluster that is not using a service principal. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The service principal profile to set on the managed cluster. Is either a + model type or a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2022_01_01.models.ManagedClusterServicePrincipalProfile or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -2003,67 +2097,68 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_service_principal_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + begin_reset_service_principal_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterAADProfile, + parameters: Union[_models.ManagedClusterAADProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterAADProfile") - request = build_reset_aad_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_aad_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_aad_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_aad_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2071,10 +2166,9 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -2084,27 +2178,67 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement if cls: return cls(pipeline_response, None, {}) - _reset_aad_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + _reset_aad_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - - @distributed_trace - def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements + @overload + def begin_reset_aad_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterAADProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: """Reset the AAD Profile of a managed cluster. Reset the AAD Profile of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The AAD profile to set on the Managed Cluster. + :param parameters: The AAD profile to set on the Managed Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2022_01_01.models.ManagedClusterAADProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reset the AAD Profile of a managed cluster. + + Reset the AAD Profile of a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The AAD profile to set on the Managed Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -2115,20 +2249,53 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterAADProfile, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Reset the AAD Profile of a managed cluster. + + Reset the AAD Profile of a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The AAD profile to set on the Managed Cluster. Is either a model type or a + IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_01_01.models.ManagedClusterAADProfile or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -2136,62 +2303,52 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_aad_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + begin_reset_aad_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_rotate_cluster_certificates_request_initial( - subscription_id=self._config.subscription_id, + request = build_rotate_cluster_certificates_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._rotate_cluster_certificates_initial.metadata['url'], + template_url=self._rotate_cluster_certificates_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2199,10 +2356,9 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -2212,24 +2368,20 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return if cls: return cls(pipeline_response, None, {}) - _rotate_cluster_certificates_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore - + _rotate_cluster_certificates_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore @distributed_trace - def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + def begin_rotate_cluster_certificates( + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> LROPoller[None]: """Rotates the certificates of a managed cluster. See `Certificate rotation `_ for more details about rotating managed cluster certificates. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -2241,80 +2393,67 @@ def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-st Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._rotate_cluster_certificates_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_rotate_cluster_certificates.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore + begin_rotate_cluster_certificates.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore def _stop_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_stop_request_initial( - subscription_id=self._config.subscription_id, + request = build_stop_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._stop_initial.metadata['url'], + template_url=self._stop_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2322,10 +2461,9 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -2335,16 +2473,10 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore - + _stop_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore @distributed_trace - def begin_stop( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> LROPoller[None]: + def begin_stop(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> LROPoller[None]: """Stops a Managed Cluster. This can only be performed on Azure Virtual Machine Scale set backed clusters. Stopping a @@ -2353,9 +2485,9 @@ def begin_stop( # pylint: disable=inconsistent-return-statements `_ for more details about stopping a cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -2367,80 +2499,67 @@ def begin_stop( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._stop_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore + begin_stop.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore def _start_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_start_request_initial( - subscription_id=self._config.subscription_id, + request = build_start_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._start_initial.metadata['url'], + template_url=self._start_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2448,10 +2567,9 @@ def _start_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -2461,24 +2579,18 @@ def _start_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore - + _start_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore @distributed_trace - def begin_start( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> LROPoller[None]: + def begin_start(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> LROPoller[None]: """Starts a previously stopped Managed Cluster. See `starting a cluster `_ for more details about starting a cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -2490,85 +2602,83 @@ def begin_start( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._start_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore + begin_start.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore def _run_command_initial( self, resource_group_name: str, resource_name: str, - request_payload: _models.RunCommandRequest, + request_payload: Union[_models.RunCommandRequest, IO], **kwargs: Any ) -> Optional[_models.RunCommandResult]: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RunCommandResult]] - _json = self._serialize.body(request_payload, 'RunCommandRequest') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(request_payload, (IO, bytes)): + _content = request_payload + else: + _json = self._serialize.body(request_payload, "RunCommandRequest") - request = build_run_command_request_initial( - subscription_id=self._config.subscription_id, + request = build_run_command_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._run_command_initial.metadata['url'], + content=_content, + template_url=self._run_command_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2576,10 +2686,9 @@ def _run_command_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -2588,22 +2697,23 @@ def _run_command_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _run_command_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore + _run_command_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore - - @distributed_trace + @overload def begin_run_command( self, resource_group_name: str, resource_name: str, request_payload: _models.RunCommandRequest, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.RunCommandResult]: """Submits a command to run against the Managed Cluster. @@ -2612,12 +2722,55 @@ def begin_run_command( more information see `AKS Run Command `_. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param request_payload: The run command request. + :param request_payload: The run command request. Required. :type request_payload: ~azure.mgmt.containerservice.v2022_01_01.models.RunCommandRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either RunCommandResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_01_01.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_run_command( + self, + resource_group_name: str, + resource_name: str, + request_payload: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RunCommandResult]: + """Submits a command to run against the Managed Cluster. + + AKS will create a pod to run the command. This is primarily useful for private clusters. For + more information see `AKS Run Command + `_. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param request_payload: The run command request. Required. + :type request_payload: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -2630,20 +2783,55 @@ def begin_run_command( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_01_01.models.RunCommandResult] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_run_command( + self, + resource_group_name: str, + resource_name: str, + request_payload: Union[_models.RunCommandRequest, IO], + **kwargs: Any + ) -> LROPoller[_models.RunCommandResult]: + """Submits a command to run against the Managed Cluster. + + AKS will create a pod to run the command. This is primarily useful for private clusters. For + more information see `AKS Run Command + `_. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param request_payload: The run command request. Is either a model type or a IO type. Required. + :type request_payload: ~azure.mgmt.containerservice.v2022_01_01.models.RunCommandRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either RunCommandResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_01_01.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.RunCommandResult] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.RunCommandResult] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._run_command_initial( # type: ignore resource_group_name=resource_group_name, @@ -2651,82 +2839,71 @@ def begin_run_command( request_payload=request_payload, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_run_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore + begin_run_command.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore @distributed_trace def get_command_result( - self, - resource_group_name: str, - resource_name: str, - command_id: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, command_id: str, **kwargs: Any ) -> Optional[_models.RunCommandResult]: """Gets the results of a command which has been run on the Managed Cluster. Gets the results of a command which has been run on the Managed Cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param command_id: Id of the command. + :param command_id: Id of the command. Required. :type command_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: RunCommandResult, or the result of cls(response) + :return: RunCommandResult or None or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.RunCommandResult or None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RunCommandResult]] - request = build_get_command_result_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, command_id=command_id, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_command_result.metadata['url'], + template_url=self.get_command_result.metadata["url"], headers=_headers, params=_params, ) @@ -2734,10 +2911,9 @@ def get_command_result( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -2746,59 +2922,54 @@ def get_command_result( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_command_result.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}"} # type: ignore - + get_command_result.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}"} # type: ignore @distributed_trace def list_outbound_network_dependencies_endpoints( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> Iterable[_models.OutboundEnvironmentEndpointCollection]: + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> Iterable["_models.OutboundEnvironmentEndpoint"]: """Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster. Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster. The operation returns properties of each egress endpoint. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OutboundEnvironmentEndpointCollection or the - result of cls(response) + :return: An iterator like instance of either OutboundEnvironmentEndpoint or the result of + cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_01_01.models.OutboundEnvironmentEndpointCollection] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_01_01.models.OutboundEnvironmentEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_outbound_network_dependencies_endpoints_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_outbound_network_dependencies_endpoints.metadata['url'], + template_url=self.list_outbound_network_dependencies_endpoints.metadata["url"], headers=_headers, params=_params, ) @@ -2806,16 +2977,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_outbound_network_dependencies_endpoints_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -2831,10 +2997,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2844,8 +3008,6 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_outbound_network_dependencies_endpoints.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints"} # type: ignore + list_outbound_network_dependencies_endpoints.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/operations/_operations.py index 64e35650857f..0d67abefcf50 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/operations/_operations.py @@ -7,10 +7,15 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,38 +25,34 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - **kwargs: Any -) -> HttpRequest: + +def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.ContainerService/operations") # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class Operations: """ @@ -72,38 +73,33 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.OperationListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.OperationValue"]: """Gets a list of operations. Gets a list of operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationListResult or the result of cls(response) + :return: An iterator like instance of either OperationValue or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_01_01.models.OperationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_01_01.models.OperationValue] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -111,13 +107,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -133,10 +127,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -146,8 +138,6 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.ContainerService/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ContainerService/operations"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/operations/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/operations/_private_endpoint_connections_operations.py index 1669d1ed026c..9cc143b575ec 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/operations/_private_endpoint_connections_operations.py @@ -6,11 +6,15 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod @@ -21,173 +25,191 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - subscription_id: str, resource_group_name: str, resource_name: str, private_endpoint_connection_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_update_request( - subscription_id: str, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, - *, - json: Optional[_models.PrivateEndpointConnection] = None, - content: Any = None, + subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request_initial( - subscription_id: str, +def build_delete_request( resource_group_name: str, resource_name: str, private_endpoint_connection_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class PrivateEndpointConnectionsOperations: """ @@ -208,46 +230,39 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnectionListResult: """Gets a list of private endpoint connections in the specified managed cluster. To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnectionListResult, or the result of cls(response) + :return: PrivateEndpointConnectionListResult or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.PrivateEndpointConnectionListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnectionListResult] - request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -255,69 +270,60 @@ def list( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore - + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore @distributed_trace def get( - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnection: """Gets the specified private endpoint connection. To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -325,75 +331,147 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - - @distributed_trace + @overload def update( self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, parameters: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateEndpointConnection: """Updates a private endpoint connection. Updates a private endpoint connection. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str - :param parameters: The updated private endpoint connection. + :param parameters: The updated private endpoint connection. Required. :type parameters: ~azure.mgmt.containerservice.v2022_01_01.models.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: The updated private endpoint connection. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: Union[_models.PrivateEndpointConnection, IO], + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: The updated private endpoint connection. Is either a model type or a IO + type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_01_01.models.PrivateEndpointConnection or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - _json = self._serialize.body(parameters, 'PrivateEndpointConnection') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateEndpointConnection") request = build_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update.metadata['url'], + content=_content, + template_url=self.update.metadata["url"], headers=_headers, params=_params, ) @@ -401,52 +479,43 @@ def update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -454,10 +523,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -467,26 +535,21 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + def begin_delete( + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> LROPoller[None]: """Deletes a private endpoint connection. Deletes a private endpoint connection. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -498,53 +561,46 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/operations/_private_link_resources_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/operations/_private_link_resources_operations.py index dc572bd2162b..09568535545a 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/operations/_private_link_resources_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/operations/_private_link_resources_operations.py @@ -8,9 +8,13 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -19,48 +23,53 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class PrivateLinkResourcesOperations: """ @@ -81,46 +90,39 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.PrivateLinkResourcesListResult: """Gets a list of private link resources in the specified managed cluster. To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResourcesListResult, or the result of cls(response) + :return: PrivateLinkResourcesListResult or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.PrivateLinkResourcesListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResourcesListResult] - request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -128,22 +130,20 @@ def list( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResourcesListResult', pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources"} # type: ignore - + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/operations/_resolve_private_link_service_id_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/operations/_resolve_private_link_service_id_operations.py index b375e02789a0..1b684ebd05fc 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/operations/_resolve_private_link_service_id_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/operations/_resolve_private_link_service_id_operations.py @@ -6,11 +6,15 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -19,56 +23,56 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_post_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.PrivateLinkResource] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + class ResolvePrivateLinkServiceIdOperations: """ @@ -89,52 +93,118 @@ def __init__(self, *args, **kwargs): 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 + @overload def post( self, resource_group_name: str, resource_name: str, parameters: _models.PrivateLinkResource, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateLinkResource: """Gets the private link service ID for the specified managed cluster. Gets the private link service ID for the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters required in order to resolve a private link service ID. + :param parameters: Parameters required in order to resolve a private link service ID. Required. :type parameters: ~azure.mgmt.containerservice.v2022_01_01.models.PrivateLinkResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResource, or the result of cls(response) + :return: PrivateLinkResource or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.PrivateLinkResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + def post( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID for the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters required in order to resolve a private link service ID. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def post( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.PrivateLinkResource, IO], + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID for the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters required in order to resolve a private link service ID. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_01_01.models.PrivateLinkResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResource] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResource] - _json = self._serialize.body(parameters, 'PrivateLinkResource') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateLinkResource") request = build_post_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.post.metadata['url'], + content=_content, + template_url=self.post.metadata["url"], headers=_headers, params=_params, ) @@ -142,22 +212,20 @@ def post( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResource', pipeline_response) + deserialized = self._deserialize("PrivateLinkResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - post.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId"} # type: ignore - + post.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/operations/_snapshots_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/operations/_snapshots_operations.py index 529e165a69e8..1aa91e8e460f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/operations/_snapshots_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/operations/_snapshots_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,243 +25,223 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots") path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_resource_group_request( - subscription_id: str, - resource_group_name: str, - **kwargs: Any -) -> HttpRequest: +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots", + ) # 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', min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: + _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, resource_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.Snapshot] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_update_tags_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.TagsObject] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class SnapshotsOperations: """ @@ -277,39 +262,33 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.SnapshotListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.Snapshot"]: """Gets a list of snapshots in the specified subscription. Gets a list of snapshots in the specified subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SnapshotListResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_01_01.models.SnapshotListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either Snapshot or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_01_01.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SnapshotListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -317,14 +296,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -340,10 +316,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -353,48 +327,40 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots"} # type: ignore @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> Iterable[_models.SnapshotListResult]: + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Snapshot"]: """Lists snapshots in the specified subscription and resource group. Lists snapshots in the specified subscription and resource group. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SnapshotListResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_01_01.models.SnapshotListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either Snapshot or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_01_01.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SnapshotListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -402,15 +368,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -426,10 +388,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -439,50 +399,40 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots"} # type: ignore @distributed_trace - def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.Snapshot: + def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.Snapshot: """Gets a snapshot. Gets a snapshot. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Snapshot, or the result of cls(response) + :return: Snapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.Snapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -490,71 +440,132 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - @distributed_trace + @overload def create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.Snapshot, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.Snapshot: """Creates or updates a snapshot. Creates or updates a snapshot. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The snapshot to create or update. + :param parameters: The snapshot to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_01_01.models.Snapshot + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Snapshot, or the result of cls(response) + :return: Snapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.Snapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Snapshot: + """Creates or updates a snapshot. + + Creates or updates a snapshot. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The snapshot to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.Snapshot, IO], **kwargs: Any + ) -> _models.Snapshot: + """Creates or updates a snapshot. + + Creates or updates a snapshot. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The snapshot to create or update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.mgmt.containerservice.v2022_01_01.models.Snapshot or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] - _json = self._serialize.body(parameters, 'Snapshot') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "Snapshot") request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) @@ -562,10 +573,9 @@ def create_or_update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -573,64 +583,126 @@ def create_or_update( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - - @distributed_trace + @overload def update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.Snapshot: """Updates tags on a snapshot. Updates tags on a snapshot. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update snapshot Tags operation. + :param parameters: Parameters supplied to the Update snapshot Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2022_01_01.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Snapshot, or the result of cls(response) + :return: Snapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.Snapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + def update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Snapshot: + """Updates tags on a snapshot. + + Updates tags on a snapshot. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update snapshot Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> _models.Snapshot: + """Updates tags on a snapshot. + + Updates tags on a snapshot. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update snapshot Tags operation. Is either a model + type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_01_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") request = build_update_tags_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_tags.metadata['url'], + content=_content, + template_url=self.update_tags.metadata["url"], headers=_headers, params=_params, ) @@ -638,64 +710,56 @@ def update_tags( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - + update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore @distributed_trace def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: """Deletes a snapshot. Deletes a snapshot. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) @@ -703,10 +767,9 @@ def delete( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -716,5 +779,4 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - + delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/__init__.py index 37a5f9e02e6f..a8716d29afe8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/__init__.py @@ -14,7 +14,8 @@ except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['ContainerServiceClient'] + +__all__ = ["ContainerServiceClient"] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/_configuration.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/_configuration.py index 9e8fe0862f3b..719538efecd2 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/_configuration.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/_configuration.py @@ -18,30 +18,26 @@ VERSION = "unknown" + class ContainerServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ContainerServiceClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2022-01-02-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: + def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ContainerServiceClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + api_version = kwargs.pop("api_version", "2022-01-02-preview") # type: str if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -51,23 +47,24 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-containerservice/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-containerservice/{}".format(VERSION)) self._configure(**kwargs) def _configure( - self, - **kwargs # type: Any + self, **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/_container_service_client.py index 1cde299ed11a..56a621bb875f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/_container_service_client.py @@ -9,20 +9,29 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from . import models +from .._serialization import Deserializer, Serializer from ._configuration import ContainerServiceClientConfiguration -from .operations import AgentPoolsOperations, MaintenanceConfigurationsOperations, ManagedClustersOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, ResolvePrivateLinkServiceIdOperations, SnapshotsOperations +from .operations import ( + AgentPoolsOperations, + MaintenanceConfigurationsOperations, + ManagedClustersOperations, + Operations, + PrivateEndpointConnectionsOperations, + PrivateLinkResourcesOperations, + ResolvePrivateLinkServiceIdOperations, + SnapshotsOperations, +) if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class ContainerServiceClient: # pylint: disable=too-many-instance-attributes + +class ContainerServiceClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """The Container Service Client. :ivar operations: Operations operations @@ -48,10 +57,10 @@ class ContainerServiceClient: # pylint: disable=too-many-instance-attributes :ivar snapshots: SnapshotsOperations operations :vartype snapshots: azure.mgmt.containerservice.v2022_01_02_preview.operations.SnapshotsOperations - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -69,25 +78,23 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = ContainerServiceClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = ContainerServiceClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize - ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.managed_clusters = ManagedClustersOperations( self._client, self._config, self._serialize, self._deserialize ) self.maintenance_configurations = MaintenanceConfigurationsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.agent_pools = AgentPoolsOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) self.private_endpoint_connections = PrivateEndpointConnectionsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -97,16 +104,9 @@ def __init__( self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations( self._client, self._config, self._serialize, self._deserialize ) - self.snapshots = SnapshotsOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.snapshots = SnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) - - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> HttpResponse: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -115,7 +115,7 @@ def _send_request( >>> response = client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/_metadata.json b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/_metadata.json index 645b431b4d2a..c6a05eabf74d 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/_metadata.json +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/_metadata.json @@ -10,20 +10,20 @@ "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { "credential": { - "signature": "credential, # type: \"TokenCredential\"", - "description": "Credential needed for the client to connect to Azure.", + "signature": "credential: \"TokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true }, "subscription_id": { - "signature": "subscription_id, # type: str", - "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "signature": "subscription_id: str,", + "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.", "docstring_type": "str", "required": true } @@ -31,13 +31,13 @@ "async": { "credential": { "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure.", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { "signature": "subscription_id: str,", - "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.", "docstring_type": "str", "required": true } @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=\"https://management.azure.com\", # type: str", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/_patch.py index 74e48ecd07cf..f99e77fef986 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/_patch.py @@ -28,4 +28,4 @@ # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + pass diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/_vendor.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/_vendor.py index 138f663c53a4..9aad73fc743e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/_vendor.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/_vendor.py @@ -7,6 +7,7 @@ from azure.core.pipeline.transport import HttpRequest + def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) @@ -14,6 +15,7 @@ def _convert_request(request, files=None): request.set_formdata_body(files) return request + def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -21,7 +23,5 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [ - c for c in formatted_components if "{}".format(key.args[0]) not in c - ] + components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/__init__.py index 37a5f9e02e6f..a8716d29afe8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/__init__.py @@ -14,7 +14,8 @@ except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['ContainerServiceClient'] + +__all__ = ["ContainerServiceClient"] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/_configuration.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/_configuration.py index 58c7a701b105..1c88c2c1bb82 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/_configuration.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/_configuration.py @@ -18,30 +18,26 @@ VERSION = "unknown" + class ContainerServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ContainerServiceClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2022-01-02-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: + def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ContainerServiceClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + api_version = kwargs.pop("api_version", "2022-01-02-preview") # type: str if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -51,22 +47,21 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-containerservice/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-containerservice/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, - **kwargs: Any - ) -> None: - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/_container_service_client.py index 81c680039c93..dee7550d2025 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/_container_service_client.py @@ -9,20 +9,29 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from .. import models +from ..._serialization import Deserializer, Serializer from ._configuration import ContainerServiceClientConfiguration -from .operations import AgentPoolsOperations, MaintenanceConfigurationsOperations, ManagedClustersOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, ResolvePrivateLinkServiceIdOperations, SnapshotsOperations +from .operations import ( + AgentPoolsOperations, + MaintenanceConfigurationsOperations, + ManagedClustersOperations, + Operations, + PrivateEndpointConnectionsOperations, + PrivateLinkResourcesOperations, + ResolvePrivateLinkServiceIdOperations, + SnapshotsOperations, +) if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class ContainerServiceClient: # pylint: disable=too-many-instance-attributes + +class ContainerServiceClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """The Container Service Client. :ivar operations: Operations operations @@ -48,10 +57,10 @@ class ContainerServiceClient: # pylint: disable=too-many-instance-attributes :ivar snapshots: SnapshotsOperations operations :vartype snapshots: azure.mgmt.containerservice.v2022_01_02_preview.aio.operations.SnapshotsOperations - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -69,25 +78,23 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = ContainerServiceClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = ContainerServiceClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize - ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.managed_clusters = ManagedClustersOperations( self._client, self._config, self._serialize, self._deserialize ) self.maintenance_configurations = MaintenanceConfigurationsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.agent_pools = AgentPoolsOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) self.private_endpoint_connections = PrivateEndpointConnectionsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -97,16 +104,9 @@ def __init__( self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations( self._client, self._config, self._serialize, self._deserialize ) - self.snapshots = SnapshotsOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.snapshots = SnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) - - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -115,7 +115,7 @@ def _send_request( >>> response = await client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/_patch.py index 74e48ecd07cf..f99e77fef986 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/_patch.py @@ -28,4 +28,4 @@ # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + pass diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/operations/__init__.py index e0748876288c..593b23075ce0 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/operations/__init__.py @@ -18,15 +18,16 @@ from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'Operations', - 'ManagedClustersOperations', - 'MaintenanceConfigurationsOperations', - 'AgentPoolsOperations', - 'PrivateEndpointConnectionsOperations', - 'PrivateLinkResourcesOperations', - 'ResolvePrivateLinkServiceIdOperations', - 'SnapshotsOperations', + "Operations", + "ManagedClustersOperations", + "MaintenanceConfigurationsOperations", + "AgentPoolsOperations", + "PrivateEndpointConnectionsOperations", + "PrivateLinkResourcesOperations", + "ResolvePrivateLinkServiceIdOperations", + "SnapshotsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/operations/_agent_pools_operations.py index 41ea462ae237..4ac9db088e59 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/operations/_agent_pools_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +29,20 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._agent_pools_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_available_agent_pool_versions_request, build_get_request, build_get_upgrade_profile_request, build_list_request, build_upgrade_node_image_version_request_initial -T = TypeVar('T') +from ...operations._agent_pools_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_available_agent_pool_versions_request, + build_get_request, + build_get_upgrade_profile_request, + build_list_request, + build_upgrade_node_image_version_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class AgentPoolsOperations: """ .. warning:: @@ -45,47 +62,40 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.AgentPoolListResult]: + def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncIterable["_models.AgentPool"]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AgentPoolListResult or the result of cls(response) + :return: An iterator like instance of either AgentPool or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_01_02_preview.models.AgentPoolListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_01_02_preview.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -93,16 +103,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -118,10 +123,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -131,54 +134,45 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore @distributed_trace_async async def get( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPool: """Gets the specified managed cluster agent pool. Gets the specified managed cluster agent pool. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPool, or the result of cls(response) + :return: AgentPool or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.AgentPool - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -186,57 +180,60 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore async def _create_or_update_initial( self, resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: _models.AgentPool, + parameters: Union[_models.AgentPool, IO], **kwargs: Any ) -> _models.AgentPool: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - _json = self._serialize.body(parameters, 'AgentPool') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "AgentPool") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -244,10 +241,9 @@ async def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -255,40 +251,44 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - - @distributed_trace_async + @overload async def begin_create_or_update( self, resource_group_name: str, resource_name: str, agent_pool_name: str, parameters: _models.AgentPool, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.AgentPool]: """Creates or updates an agent pool in the specified managed cluster. Creates or updates an agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str - :param parameters: The agent pool to create or update. + :param parameters: The agent pool to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_01_02_preview.models.AgentPool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -301,20 +301,98 @@ async def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_01_02_preview.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AgentPool]: + """Creates or updates an agent pool in the specified managed cluster. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: The agent pool to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AgentPool or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_01_02_preview.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: Union[_models.AgentPool, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.AgentPool]: + """Creates or updates an agent pool in the specified managed cluster. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: The agent pool to create or update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.mgmt.containerservice.v2022_01_02_preview.models.AgentPool or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AgentPool or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_01_02_preview.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -323,66 +401,55 @@ async def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -390,10 +457,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -403,26 +469,21 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + async def begin_delete( + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes an agent pool in the specified managed cluster. Deletes an agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -434,99 +495,85 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace_async async def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPoolUpgradeProfile: """Gets the upgrade profile for an agent pool. Gets the upgrade profile for an agent pool. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolUpgradeProfile, or the result of cls(response) + :return: AgentPoolUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.AgentPoolUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -534,32 +581,27 @@ async def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolUpgradeProfile', pipeline_response) + deserialized = self._deserialize("AgentPoolUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore @distributed_trace_async async def get_available_agent_pool_versions( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported Kubernetes versions for the specified agent pool. @@ -567,33 +609,30 @@ async def get_available_agent_pool_versions( `_ for more details about the version lifecycle. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolAvailableVersions, or the result of cls(response) + :return: AgentPoolAvailableVersions or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.AgentPoolAvailableVersions - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolAvailableVersions] - request = build_get_available_agent_pool_versions_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_available_agent_pool_versions.metadata['url'], + template_url=self.get_available_agent_pool_versions.metadata["url"], headers=_headers, params=_params, ) @@ -601,52 +640,43 @@ async def get_available_agent_pool_versions( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolAvailableVersions', pipeline_response) + deserialized = self._deserialize("AgentPoolAvailableVersions", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_available_agent_pool_versions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore - + get_available_agent_pool_versions.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore async def _upgrade_node_image_version_initial( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> Optional[_models.AgentPool]: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.AgentPool]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.AgentPool]] - - request = build_upgrade_node_image_version_request_initial( - subscription_id=self._config.subscription_id, + request = build_upgrade_node_image_version_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._upgrade_node_image_version_initial.metadata['url'], + template_url=self._upgrade_node_image_version_initial.metadata["url"], headers=_headers, params=_params, ) @@ -654,10 +684,9 @@ async def _upgrade_node_image_version_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -667,37 +696,34 @@ async def _upgrade_node_image_version_initial( deserialized = None response_headers = {} if response.status_code == 202: - response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) - - deserialized = self._deserialize('AgentPool', pipeline_response) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _upgrade_node_image_version_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore - + _upgrade_node_image_version_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore @distributed_trace_async async def begin_upgrade_node_image_version( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any - ) -> AsyncLROPoller[_models.AgentPool]: + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: """Upgrades the node image version of an agent pool to the latest. Upgrading the node image version of an agent pool applies the newest OS and runtime updates to the nodes. AKS provides one new image per week with the latest updates. For more details on node image versions, see: https://docs.microsoft.com/azure/aks/node-image-upgrade. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -711,59 +737,54 @@ async def begin_upgrade_node_image_version( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_01_02_preview.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._upgrade_node_image_version_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) - - deserialized = self._deserialize('AgentPool', pipeline_response) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_upgrade_node_image_version.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore + begin_upgrade_node_image_version.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/operations/_maintenance_configurations_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/operations/_maintenance_configurations_operations.py index a85db6432a03..03fe24bd90dc 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/operations/_maintenance_configurations_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/operations/_maintenance_configurations_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,10 +27,17 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._maintenance_configurations_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_managed_cluster_request -T = TypeVar('T') +from ...operations._maintenance_configurations_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_managed_cluster_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class MaintenanceConfigurationsOperations: """ .. warning:: @@ -43,48 +57,43 @@ def __init__(self, *args, **kwargs) -> None: 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_managed_cluster( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.MaintenanceConfigurationListResult]: + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> AsyncIterable["_models.MaintenanceConfiguration"]: """Gets a list of maintenance configurations in the specified managed cluster. Gets a list of maintenance configurations in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either MaintenanceConfigurationListResult or the result - of cls(response) + :return: An iterator like instance of either MaintenanceConfiguration or the result of + cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_01_02_preview.models.MaintenanceConfigurationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_01_02_preview.models.MaintenanceConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfigurationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfigurationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_managed_cluster_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_managed_cluster.metadata['url'], + template_url=self.list_by_managed_cluster.metadata["url"], headers=_headers, params=_params, ) @@ -92,16 +101,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_managed_cluster_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -117,10 +121,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -130,54 +132,45 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_managed_cluster.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations"} # type: ignore + list_by_managed_cluster.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations"} # type: ignore @distributed_trace_async async def get( - self, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, config_name: str, **kwargs: Any ) -> _models.MaintenanceConfiguration: """Gets the specified maintenance configuration of a managed cluster. Gets the specified maintenance configuration of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: MaintenanceConfiguration, or the result of cls(response) + :return: MaintenanceConfiguration or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.MaintenanceConfiguration - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfiguration] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -185,76 +178,148 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) + deserialized = self._deserialize("MaintenanceConfiguration", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - @distributed_trace_async + @overload async def create_or_update( self, resource_group_name: str, resource_name: str, config_name: str, parameters: _models.MaintenanceConfiguration, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.MaintenanceConfiguration: """Creates or updates a maintenance configuration in the specified managed cluster. Creates or updates a maintenance configuration in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str - :param parameters: The maintenance configuration to create or update. + :param parameters: The maintenance configuration to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_01_02_preview.models.MaintenanceConfiguration + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configuration in the specified managed cluster. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: The maintenance configuration to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: Union[_models.MaintenanceConfiguration, IO], + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configuration in the specified managed cluster. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: The maintenance configuration to create or update. Is either a model type or + a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2022_01_02_preview.models.MaintenanceConfiguration or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: MaintenanceConfiguration, or the result of cls(response) + :return: MaintenanceConfiguration or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.MaintenanceConfiguration - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfiguration] - _json = self._serialize.body(parameters, 'MaintenanceConfiguration') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "MaintenanceConfiguration") request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) @@ -262,68 +327,59 @@ async def create_or_update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) + deserialized = self._deserialize("MaintenanceConfiguration", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, config_name: str, **kwargs: Any ) -> None: """Deletes a maintenance configuration. Deletes a maintenance configuration. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) @@ -331,10 +387,9 @@ async def delete( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -344,5 +399,4 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/operations/_managed_clusters_operations.py index 0944a8adc4a6..0a9289cb4a60 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/operations/_managed_clusters_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +29,33 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._managed_clusters_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_access_profile_request, build_get_command_result_request, build_get_os_options_request, build_get_request, build_get_upgrade_profile_request, build_list_by_resource_group_request, build_list_cluster_admin_credentials_request, build_list_cluster_monitoring_user_credentials_request, build_list_cluster_user_credentials_request, build_list_outbound_network_dependencies_endpoints_request, build_list_request, build_reset_aad_profile_request_initial, build_reset_service_principal_profile_request_initial, build_rotate_cluster_certificates_request_initial, build_run_command_request_initial, build_start_request_initial, build_stop_request_initial, build_update_tags_request_initial -T = TypeVar('T') +from ...operations._managed_clusters_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_access_profile_request, + build_get_command_result_request, + build_get_os_options_request, + build_get_request, + build_get_upgrade_profile_request, + build_list_by_resource_group_request, + build_list_cluster_admin_credentials_request, + build_list_cluster_monitoring_user_credentials_request, + build_list_cluster_user_credentials_request, + build_list_outbound_network_dependencies_endpoints_request, + build_list_request, + build_reset_aad_profile_request, + build_reset_service_principal_profile_request, + build_rotate_cluster_certificates_request, + build_run_command_request, + build_start_request, + build_stop_request, + build_update_tags_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class ManagedClustersOperations: # pylint: disable=too-many-public-methods """ .. warning:: @@ -45,46 +75,39 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async async def get_os_options( - self, - location: str, - resource_type: Optional[str] = None, - **kwargs: Any + self, location: str, resource_type: Optional[str] = None, **kwargs: Any ) -> _models.OSOptionProfile: """Gets supported OS options in the specified subscription. Gets supported OS options in the specified subscription. - :param location: The name of a supported Azure region. + :param location: The name of a supported Azure region. Required. :type location: str :param resource_type: The resource type for which the OS options needs to be returned. Default value is None. :type resource_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: OSOptionProfile, or the result of cls(response) + :return: OSOptionProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.OSOptionProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OSOptionProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OSOptionProfile] - request = build_get_os_options_request( - subscription_id=self._config.subscription_id, location=location, - api_version=api_version, + subscription_id=self._config.subscription_id, resource_type=resource_type, - template_url=self.get_os_options.metadata['url'], + api_version=api_version, + template_url=self.get_os_options.metadata["url"], headers=_headers, params=_params, ) @@ -92,59 +115,52 @@ async def get_os_options( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('OSOptionProfile', pipeline_response) + deserialized = self._deserialize("OSOptionProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_os_options.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default"} # type: ignore - + get_os_options.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default"} # type: ignore @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.ManagedClusterListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.ManagedCluster"]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_01_02_preview.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_01_02_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -152,14 +168,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -175,10 +188,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -188,49 +199,43 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.ManagedClusterListResult]: + self, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ManagedCluster"]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_01_02_preview.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_01_02_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -238,15 +243,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -262,10 +263,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -275,50 +274,42 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace_async async def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.ManagedClusterUpgradeProfile: """Gets the upgrade profile of a managed cluster. Gets the upgrade profile of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterUpgradeProfile, or the result of cls(response) + :return: ManagedClusterUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.ManagedClusterUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -326,33 +317,27 @@ async def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterUpgradeProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore @distributed_trace_async async def get_access_profile( - self, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, role_name: str, **kwargs: Any ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. @@ -361,36 +346,33 @@ async def get_access_profile( `ListClusterAdminCredentials `_ . - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param role_name: The name of the role for managed cluster accessProfile resource. + :param role_name: The name of the role for managed cluster accessProfile resource. Required. :type role_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterAccessProfile, or the result of cls(response) + :return: ManagedClusterAccessProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.ManagedClusterAccessProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterAccessProfile] - request = build_get_access_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, role_name=role_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_access_profile.metadata['url'], + template_url=self.get_access_profile.metadata["url"], headers=_headers, params=_params, ) @@ -398,25 +380,23 @@ async def get_access_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterAccessProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterAccessProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_access_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore - + get_access_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore @distributed_trace_async async def list_cluster_admin_credentials( @@ -431,41 +411,39 @@ async def list_cluster_admin_credentials( Lists the admin credentials of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :param format: Only apply to AAD clusters, specifies the format of returned kubeconfig. Format 'azure' will return azure auth-provider kubeconfig; format 'exec' will return exec format - kubeconfig, which requires kubelogin binary in the path. Default value is None. + kubeconfig, which requires kubelogin binary in the path. Known values are: "azure" and "exec". + Default value is None. :type format: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.Format :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_admin_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, format=format, - template_url=self.list_cluster_admin_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_admin_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -473,68 +451,59 @@ async def list_cluster_admin_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_admin_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore - + list_cluster_admin_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore @distributed_trace_async async def list_cluster_user_credentials( - self, - resource_group_name: str, - resource_name: str, - server_fqdn: Optional[str] = None, - **kwargs: Any + self, resource_group_name: str, resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any ) -> _models.CredentialResults: """Lists the user credentials of a managed cluster. Lists the user credentials of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, - template_url=self.list_cluster_user_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -542,68 +511,59 @@ async def list_cluster_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore - + list_cluster_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore @distributed_trace_async async def list_cluster_monitoring_user_credentials( - self, - resource_group_name: str, - resource_name: str, - server_fqdn: Optional[str] = None, - **kwargs: Any + self, resource_group_name: str, resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any ) -> _models.CredentialResults: """Lists the cluster monitoring user credentials of a managed cluster. Lists the cluster monitoring user credentials of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_monitoring_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, - template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_monitoring_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -611,64 +571,54 @@ async def list_cluster_monitoring_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_monitoring_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore - + list_cluster_monitoring_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore @distributed_trace_async - async def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.ManagedCluster: + async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.ManagedCluster: """Gets a managed cluster. Gets a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedCluster, or the result of cls(response) + :return: ManagedCluster or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.ManagedCluster - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -676,55 +626,54 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _create_or_update_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.ManagedCluster, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'ManagedCluster') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedCluster") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -732,10 +681,9 @@ async def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -743,37 +691,41 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - - @distributed_trace_async + @overload async def begin_create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedCluster, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. Creates or updates a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The managed cluster to create or update. + :param parameters: The managed cluster to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_01_02_preview.models.ManagedCluster + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -786,20 +738,88 @@ async def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_01_02_preview.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_01_02_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster to create or update. Is either a model type or a IO + type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_01_02_preview.models.ManagedCluster or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_01_02_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -807,69 +827,66 @@ async def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _update_tags_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.TagsObject, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request_initial( - subscription_id=self._config.subscription_id, + request = build_update_tags_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_tags_initial.metadata['url'], + content=_content, + template_url=self._update_tags_initial.metadata["url"], headers=_headers, params=_params, ) @@ -877,44 +894,47 @@ async def _update_tags_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_tags_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + _update_tags_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - - @distributed_trace_async + @overload async def begin_update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates tags on a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2022_01_02_preview.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -927,20 +947,88 @@ async def begin_update_tags( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_01_02_preview.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates tags on a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_01_02_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates tags on a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_01_02_preview.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_01_02_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, @@ -948,64 +1036,54 @@ async def begin_update_tags( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1013,10 +1091,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1026,23 +1103,17 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: + async def begin_delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Deletes a managed cluster. Deletes a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1054,85 +1125,83 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterServicePrincipalProfile, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterServicePrincipalProfile") - request = build_reset_service_principal_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_service_principal_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_service_principal_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_service_principal_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1140,10 +1209,9 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1153,28 +1221,105 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist if cls: return cls(pipeline_response, None, {}) - _reset_service_principal_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + _reset_service_principal_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + @overload + async def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.ManagedClusterServicePrincipalProfile, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset the Service Principal Profile of a managed cluster. + + This action cannot be performed on a cluster that is not using a service principal. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The service principal profile to set on the managed cluster. Required. + :type parameters: + ~azure.mgmt.containerservice.v2022_01_02_preview.models.ManagedClusterServicePrincipalProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset the Service Principal Profile of a managed cluster. + + This action cannot be performed on a cluster that is not using a service principal. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The service principal profile to set on the managed cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async - async def begin_reset_service_principal_profile( # pylint: disable=inconsistent-return-statements + async def begin_reset_service_principal_profile( self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterServicePrincipalProfile, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], **kwargs: Any ) -> AsyncLROPoller[None]: """Reset the Service Principal Profile of a managed cluster. This action cannot be performed on a cluster that is not using a service principal. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The service principal profile to set on the managed cluster. + :param parameters: The service principal profile to set on the managed cluster. Is either a + model type or a IO type. Required. :type parameters: ~azure.mgmt.containerservice.v2022_01_02_preview.models.ManagedClusterServicePrincipalProfile + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -1185,20 +1330,17 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1206,67 +1348,68 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_service_principal_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + begin_reset_service_principal_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterAADProfile, + parameters: Union[_models.ManagedClusterAADProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterAADProfile") - request = build_reset_aad_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_aad_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_aad_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_aad_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1274,10 +1417,9 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1287,28 +1429,32 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta if cls: return cls(pipeline_response, None, {}) - _reset_aad_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - + _reset_aad_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - @distributed_trace_async - async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements + @overload + async def begin_reset_aad_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterAADProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: """Reset the AAD Profile of a managed cluster. Reset the AAD Profile of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The AAD profile to set on the Managed Cluster. + :param parameters: The AAD profile to set on the Managed Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2022_01_02_preview.models.ManagedClusterAADProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -1319,20 +1465,89 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset the AAD Profile of a managed cluster. + + Reset the AAD Profile of a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The AAD profile to set on the Managed Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterAADProfile, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset the AAD Profile of a managed cluster. + + Reset the AAD Profile of a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The AAD profile to set on the Managed Cluster. Is either a model type or a + IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2022_01_02_preview.models.ManagedClusterAADProfile or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1340,62 +1555,52 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_aad_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + begin_reset_aad_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_rotate_cluster_certificates_request_initial( - subscription_id=self._config.subscription_id, + request = build_rotate_cluster_certificates_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._rotate_cluster_certificates_initial.metadata['url'], + template_url=self._rotate_cluster_certificates_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1403,10 +1608,9 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1416,24 +1620,20 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- if cls: return cls(pipeline_response, None, {}) - _rotate_cluster_certificates_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore - + _rotate_cluster_certificates_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore @distributed_trace_async - async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + async def begin_rotate_cluster_certificates( + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Rotates the certificates of a managed cluster. See `Certificate rotation `_ for more details about rotating managed cluster certificates. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1445,80 +1645,67 @@ async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-ret Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._rotate_cluster_certificates_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_rotate_cluster_certificates.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore + begin_rotate_cluster_certificates.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore async def _stop_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_stop_request_initial( - subscription_id=self._config.subscription_id, + request = build_stop_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._stop_initial.metadata['url'], + template_url=self._stop_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1526,10 +1713,9 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1539,16 +1725,10 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore - + _stop_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore @distributed_trace_async - async def begin_stop( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: + async def begin_stop(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Stops a Managed Cluster. This can only be performed on Azure Virtual Machine Scale set backed clusters. Stopping a @@ -1557,9 +1737,9 @@ async def begin_stop( # pylint: disable=inconsistent-return-statements `_ for more details about stopping a cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1571,80 +1751,67 @@ async def begin_stop( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._stop_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore + begin_stop.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore async def _start_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_start_request_initial( - subscription_id=self._config.subscription_id, + request = build_start_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._start_initial.metadata['url'], + template_url=self._start_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1652,10 +1819,9 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1665,24 +1831,18 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore - + _start_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore @distributed_trace_async - async def begin_start( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: + async def begin_start(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Starts a previously stopped Managed Cluster. See `starting a cluster `_ for more details about starting a cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1694,85 +1854,83 @@ async def begin_start( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._start_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore + begin_start.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore async def _run_command_initial( self, resource_group_name: str, resource_name: str, - request_payload: _models.RunCommandRequest, + request_payload: Union[_models.RunCommandRequest, IO], **kwargs: Any ) -> Optional[_models.RunCommandResult]: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RunCommandResult]] - _json = self._serialize.body(request_payload, 'RunCommandRequest') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(request_payload, (IO, bytes)): + _content = request_payload + else: + _json = self._serialize.body(request_payload, "RunCommandRequest") - request = build_run_command_request_initial( - subscription_id=self._config.subscription_id, + request = build_run_command_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._run_command_initial.metadata['url'], + content=_content, + template_url=self._run_command_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1780,10 +1938,9 @@ async def _run_command_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1792,22 +1949,23 @@ async def _run_command_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _run_command_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore + _run_command_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore - - @distributed_trace_async + @overload async def begin_run_command( self, resource_group_name: str, resource_name: str, request_payload: _models.RunCommandRequest, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.RunCommandResult]: """Submits a command to run against the Managed Cluster. @@ -1816,13 +1974,16 @@ async def begin_run_command( more information see `AKS Run Command `_. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param request_payload: The run command request. + :param request_payload: The run command request. Required. :type request_payload: ~azure.mgmt.containerservice.v2022_01_02_preview.models.RunCommandRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -1835,20 +1996,96 @@ async def begin_run_command( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_01_02_preview.models.RunCommandResult] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_run_command( + self, + resource_group_name: str, + resource_name: str, + request_payload: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.RunCommandResult]: + """Submits a command to run against the Managed Cluster. + + AKS will create a pod to run the command. This is primarily useful for private clusters. For + more information see `AKS Run Command + `_. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param request_payload: The run command request. Required. + :type request_payload: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RunCommandResult or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_01_02_preview.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_run_command( + self, + resource_group_name: str, + resource_name: str, + request_payload: Union[_models.RunCommandRequest, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.RunCommandResult]: + """Submits a command to run against the Managed Cluster. + + AKS will create a pod to run the command. This is primarily useful for private clusters. For + more information see `AKS Run Command + `_. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param request_payload: The run command request. Is either a model type or a IO type. Required. + :type request_payload: + ~azure.mgmt.containerservice.v2022_01_02_preview.models.RunCommandRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RunCommandResult or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_01_02_preview.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.RunCommandResult] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.RunCommandResult] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._run_command_initial( # type: ignore resource_group_name=resource_group_name, @@ -1856,82 +2093,71 @@ async def begin_run_command( request_payload=request_payload, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_run_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore + begin_run_command.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore @distributed_trace_async async def get_command_result( - self, - resource_group_name: str, - resource_name: str, - command_id: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, command_id: str, **kwargs: Any ) -> Optional[_models.RunCommandResult]: """Gets the results of a command which has been run on the Managed Cluster. Gets the results of a command which has been run on the Managed Cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param command_id: Id of the command. + :param command_id: Id of the command. Required. :type command_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: RunCommandResult, or the result of cls(response) + :return: RunCommandResult or None or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.RunCommandResult or None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RunCommandResult]] - request = build_get_command_result_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, command_id=command_id, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_command_result.metadata['url'], + template_url=self.get_command_result.metadata["url"], headers=_headers, params=_params, ) @@ -1939,10 +2165,9 @@ async def get_command_result( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1951,59 +2176,54 @@ async def get_command_result( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_command_result.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}"} # type: ignore - + get_command_result.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}"} # type: ignore @distributed_trace def list_outbound_network_dependencies_endpoints( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.OutboundEnvironmentEndpointCollection]: + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> AsyncIterable["_models.OutboundEnvironmentEndpoint"]: """Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster. Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster. The operation returns properties of each egress endpoint. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OutboundEnvironmentEndpointCollection or the - result of cls(response) + :return: An iterator like instance of either OutboundEnvironmentEndpoint or the result of + cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_01_02_preview.models.OutboundEnvironmentEndpointCollection] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_01_02_preview.models.OutboundEnvironmentEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_outbound_network_dependencies_endpoints_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_outbound_network_dependencies_endpoints.metadata['url'], + template_url=self.list_outbound_network_dependencies_endpoints.metadata["url"], headers=_headers, params=_params, ) @@ -2011,16 +2231,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_outbound_network_dependencies_endpoints_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -2036,10 +2251,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2049,8 +2262,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_outbound_network_dependencies_endpoints.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints"} # type: ignore + list_outbound_network_dependencies_endpoints.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/operations/_operations.py index 729a7a0ed7f6..72e8737df71e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/operations/_operations.py @@ -7,9 +7,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,9 +27,11 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._operations import build_list_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class Operations: """ .. warning:: @@ -42,38 +51,33 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.OperationListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.OperationValue"]: """Gets a list of operations. Gets a list of operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationListResult or the result of cls(response) + :return: An iterator like instance of either OperationValue or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_01_02_preview.models.OperationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_01_02_preview.models.OperationValue] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -81,13 +85,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -103,10 +105,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -116,8 +116,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.ContainerService/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ContainerService/operations"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/operations/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/operations/_private_endpoint_connections_operations.py index 37a04e1dbf32..e4865b897156 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/operations/_private_endpoint_connections_operations.py @@ -6,9 +6,15 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -20,10 +26,17 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._private_endpoint_connections_operations import build_delete_request_initial, build_get_request, build_list_request, build_update_request -T = TypeVar('T') +from ...operations._private_endpoint_connections_operations import ( + build_delete_request, + build_get_request, + build_list_request, + build_update_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class PrivateEndpointConnectionsOperations: """ .. warning:: @@ -43,47 +56,40 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async async def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnectionListResult: """Gets a list of private endpoint connections in the specified managed cluster. To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnectionListResult, or the result of cls(response) + :return: PrivateEndpointConnectionListResult or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.PrivateEndpointConnectionListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnectionListResult] - request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -91,69 +97,60 @@ async def list( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore - + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore @distributed_trace_async async def get( - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnection: """Gets the specified private endpoint connection. To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -161,76 +158,148 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - @distributed_trace_async + @overload async def update( self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, parameters: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateEndpointConnection: """Updates a private endpoint connection. Updates a private endpoint connection. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str - :param parameters: The updated private endpoint connection. + :param parameters: The updated private endpoint connection. Required. :type parameters: ~azure.mgmt.containerservice.v2022_01_02_preview.models.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: The updated private endpoint connection. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: Union[_models.PrivateEndpointConnection, IO], + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: The updated private endpoint connection. Is either a model type or a IO + type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2022_01_02_preview.models.PrivateEndpointConnection or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - _json = self._serialize.body(parameters, 'PrivateEndpointConnection') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateEndpointConnection") request = build_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update.metadata['url'], + content=_content, + template_url=self.update.metadata["url"], headers=_headers, params=_params, ) @@ -238,52 +307,43 @@ async def update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -291,10 +351,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -304,26 +363,21 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + async def begin_delete( + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes a private endpoint connection. Deletes a private endpoint connection. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -335,53 +389,46 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/operations/_private_link_resources_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/operations/_private_link_resources_operations.py index 4b141de3481d..e26ddc6fe686 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/operations/_private_link_resources_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/operations/_private_link_resources_operations.py @@ -8,7 +8,13 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -19,9 +25,11 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._private_link_resources_operations import build_list_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class PrivateLinkResourcesOperations: """ .. warning:: @@ -41,46 +49,39 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async async def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.PrivateLinkResourcesListResult: """Gets a list of private link resources in the specified managed cluster. To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResourcesListResult, or the result of cls(response) + :return: PrivateLinkResourcesListResult or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.PrivateLinkResourcesListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResourcesListResult] - request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -88,22 +89,20 @@ async def list( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResourcesListResult', pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources"} # type: ignore - + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/operations/_resolve_private_link_service_id_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/operations/_resolve_private_link_service_id_operations.py index c1458c9b64ec..9f0d14d633f0 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/operations/_resolve_private_link_service_id_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/operations/_resolve_private_link_service_id_operations.py @@ -6,9 +6,15 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -19,9 +25,11 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._resolve_private_link_service_id_operations import build_post_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class ResolvePrivateLinkServiceIdOperations: """ .. warning:: @@ -41,52 +49,119 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @overload + async def post( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.PrivateLinkResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID for the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters required in order to resolve a private link service ID. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_01_02_preview.models.PrivateLinkResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def post( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID for the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters required in order to resolve a private link service ID. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def post( self, resource_group_name: str, resource_name: str, - parameters: _models.PrivateLinkResource, + parameters: Union[_models.PrivateLinkResource, IO], **kwargs: Any ) -> _models.PrivateLinkResource: """Gets the private link service ID for the specified managed cluster. Gets the private link service ID for the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters required in order to resolve a private link service ID. + :param parameters: Parameters required in order to resolve a private link service ID. Is either + a model type or a IO type. Required. :type parameters: ~azure.mgmt.containerservice.v2022_01_02_preview.models.PrivateLinkResource + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResource, or the result of cls(response) + :return: PrivateLinkResource or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.PrivateLinkResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResource] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResource] - _json = self._serialize.body(parameters, 'PrivateLinkResource') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateLinkResource") request = build_post_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.post.metadata['url'], + content=_content, + template_url=self.post.metadata["url"], headers=_headers, params=_params, ) @@ -94,22 +169,20 @@ async def post( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResource', pipeline_response) + deserialized = self._deserialize("PrivateLinkResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - post.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId"} # type: ignore - + post.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/operations/_snapshots_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/operations/_snapshots_operations.py index 7c30e7a9dffe..96b5f6da212d 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/operations/_snapshots_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/operations/_snapshots_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,10 +27,19 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._snapshots_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_resource_group_request, build_list_request, build_update_tags_request -T = TypeVar('T') +from ...operations._snapshots_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_resource_group_request, + build_list_request, + build_update_tags_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class SnapshotsOperations: """ .. warning:: @@ -43,39 +59,34 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.SnapshotListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.Snapshot"]: """Gets a list of snapshots in the specified subscription. Gets a list of snapshots in the specified subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SnapshotListResult or the result of cls(response) + :return: An iterator like instance of either Snapshot or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_01_02_preview.models.SnapshotListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_01_02_preview.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SnapshotListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -83,14 +94,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -106,10 +114,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -119,48 +125,41 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots"} # type: ignore @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.SnapshotListResult]: + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.Snapshot"]: """Lists snapshots in the specified subscription and resource group. Lists snapshots in the specified subscription and resource group. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SnapshotListResult or the result of cls(response) + :return: An iterator like instance of either Snapshot or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_01_02_preview.models.SnapshotListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_01_02_preview.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SnapshotListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -168,15 +167,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -192,10 +187,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -205,50 +198,40 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots"} # type: ignore @distributed_trace_async - async def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.Snapshot: + async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.Snapshot: """Gets a snapshot. Gets a snapshot. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Snapshot, or the result of cls(response) + :return: Snapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.Snapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -256,71 +239,132 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - - @distributed_trace_async + @overload async def create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.Snapshot, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.Snapshot: """Creates or updates a snapshot. Creates or updates a snapshot. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The snapshot to create or update. + :param parameters: The snapshot to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_01_02_preview.models.Snapshot + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Snapshot: + """Creates or updates a snapshot. + + Creates or updates a snapshot. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The snapshot to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Snapshot, or the result of cls(response) + :return: Snapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.Snapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @distributed_trace_async + async def create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.Snapshot, IO], **kwargs: Any + ) -> _models.Snapshot: + """Creates or updates a snapshot. + + Creates or updates a snapshot. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The snapshot to create or update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.mgmt.containerservice.v2022_01_02_preview.models.Snapshot or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] - _json = self._serialize.body(parameters, 'Snapshot') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "Snapshot") request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) @@ -328,10 +372,9 @@ async def create_or_update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -339,64 +382,126 @@ async def create_or_update( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - @distributed_trace_async + @overload async def update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.Snapshot: """Updates tags on a snapshot. Updates tags on a snapshot. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update snapshot Tags operation. + :param parameters: Parameters supplied to the Update snapshot Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2022_01_02_preview.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Snapshot: + """Updates tags on a snapshot. + + Updates tags on a snapshot. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update snapshot Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> _models.Snapshot: + """Updates tags on a snapshot. + + Updates tags on a snapshot. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update snapshot Tags operation. Is either a model + type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_01_02_preview.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Snapshot, or the result of cls(response) + :return: Snapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.Snapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") request = build_update_tags_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_tags.metadata['url'], + content=_content, + template_url=self.update_tags.metadata["url"], headers=_headers, params=_params, ) @@ -404,64 +509,56 @@ async def update_tags( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - + update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: """Deletes a snapshot. Deletes a snapshot. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) @@ -469,10 +566,9 @@ async def delete( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -482,5 +578,4 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - + delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/models/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/models/__init__.py index 7bb54e83b18e..e459a3297fbb 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/models/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/models/__init__.py @@ -94,172 +94,170 @@ from ._models_py3 import UserAssignedIdentity from ._models_py3 import WindowsGmsaProfile - -from ._container_service_client_enums import ( - AgentPoolMode, - AgentPoolType, - Code, - ConnectionStatus, - ContainerServiceStorageProfileTypes, - ContainerServiceVMSizeTypes, - Count, - CreatedByType, - Expander, - ExtendedLocationTypes, - Format, - GPUInstanceProfile, - IpFamily, - KubeletDiskType, - LicenseType, - LoadBalancerSku, - ManagedClusterPodIdentityProvisioningState, - ManagedClusterSKUName, - ManagedClusterSKUTier, - NetworkMode, - NetworkPlugin, - NetworkPolicy, - OSDiskType, - OSSKU, - OSType, - OutboundType, - PrivateEndpointConnectionProvisioningState, - PublicNetworkAccess, - ResourceIdentityType, - ScaleDownMode, - ScaleSetEvictionPolicy, - ScaleSetPriority, - SnapshotType, - UpgradeChannel, - WeekDay, - WorkloadRuntime, -) +from ._container_service_client_enums import AgentPoolMode +from ._container_service_client_enums import AgentPoolType +from ._container_service_client_enums import Code +from ._container_service_client_enums import ConnectionStatus +from ._container_service_client_enums import ContainerServiceStorageProfileTypes +from ._container_service_client_enums import ContainerServiceVMSizeTypes +from ._container_service_client_enums import Count +from ._container_service_client_enums import CreatedByType +from ._container_service_client_enums import Expander +from ._container_service_client_enums import ExtendedLocationTypes +from ._container_service_client_enums import Format +from ._container_service_client_enums import GPUInstanceProfile +from ._container_service_client_enums import IpFamily +from ._container_service_client_enums import KubeletDiskType +from ._container_service_client_enums import LicenseType +from ._container_service_client_enums import LoadBalancerSku +from ._container_service_client_enums import ManagedClusterPodIdentityProvisioningState +from ._container_service_client_enums import ManagedClusterSKUName +from ._container_service_client_enums import ManagedClusterSKUTier +from ._container_service_client_enums import NetworkMode +from ._container_service_client_enums import NetworkPlugin +from ._container_service_client_enums import NetworkPolicy +from ._container_service_client_enums import OSDiskType +from ._container_service_client_enums import OSSKU +from ._container_service_client_enums import OSType +from ._container_service_client_enums import OutboundType +from ._container_service_client_enums import PrivateEndpointConnectionProvisioningState +from ._container_service_client_enums import PublicNetworkAccess +from ._container_service_client_enums import ResourceIdentityType +from ._container_service_client_enums import ScaleDownMode +from ._container_service_client_enums import ScaleSetEvictionPolicy +from ._container_service_client_enums import ScaleSetPriority +from ._container_service_client_enums import SnapshotType +from ._container_service_client_enums import UpgradeChannel +from ._container_service_client_enums import WeekDay +from ._container_service_client_enums import WorkloadRuntime from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'AgentPool', - 'AgentPoolAvailableVersions', - 'AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem', - 'AgentPoolListResult', - 'AgentPoolUpgradeProfile', - 'AgentPoolUpgradeProfilePropertiesUpgradesItem', - 'AgentPoolUpgradeSettings', - 'CloudErrorBody', - 'ContainerServiceDiagnosticsProfile', - 'ContainerServiceLinuxProfile', - 'ContainerServiceMasterProfile', - 'ContainerServiceNetworkProfile', - 'ContainerServiceSshConfiguration', - 'ContainerServiceSshPublicKey', - 'ContainerServiceVMDiagnostics', - 'CreationData', - 'CredentialResult', - 'CredentialResults', - 'EndpointDependency', - 'EndpointDetail', - 'ExtendedLocation', - 'KubeletConfig', - 'LinuxOSConfig', - 'MaintenanceConfiguration', - 'MaintenanceConfigurationListResult', - 'ManagedCluster', - 'ManagedClusterAADProfile', - 'ManagedClusterAPIServerAccessProfile', - 'ManagedClusterAccessProfile', - 'ManagedClusterAddonProfile', - 'ManagedClusterAddonProfileIdentity', - 'ManagedClusterAgentPoolProfile', - 'ManagedClusterAgentPoolProfileProperties', - 'ManagedClusterAutoUpgradeProfile', - 'ManagedClusterHTTPProxyConfig', - 'ManagedClusterIdentity', - 'ManagedClusterListResult', - 'ManagedClusterLoadBalancerProfile', - 'ManagedClusterLoadBalancerProfileManagedOutboundIPs', - 'ManagedClusterLoadBalancerProfileOutboundIPPrefixes', - 'ManagedClusterLoadBalancerProfileOutboundIPs', - 'ManagedClusterManagedOutboundIPProfile', - 'ManagedClusterNATGatewayProfile', - 'ManagedClusterOIDCIssuerProfile', - 'ManagedClusterPodIdentity', - 'ManagedClusterPodIdentityException', - 'ManagedClusterPodIdentityProfile', - 'ManagedClusterPodIdentityProvisioningError', - 'ManagedClusterPodIdentityProvisioningErrorBody', - 'ManagedClusterPodIdentityProvisioningInfo', - 'ManagedClusterPoolUpgradeProfile', - 'ManagedClusterPoolUpgradeProfileUpgradesItem', - 'ManagedClusterPropertiesAutoScalerProfile', - 'ManagedClusterSKU', - 'ManagedClusterSecurityProfile', - 'ManagedClusterSecurityProfileAzureDefender', - 'ManagedClusterServicePrincipalProfile', - 'ManagedClusterUpgradeProfile', - 'ManagedClusterWindowsProfile', - 'ManagedServiceIdentityUserAssignedIdentitiesValue', - 'OSOptionProfile', - 'OSOptionProperty', - 'OperationListResult', - 'OperationValue', - 'OutboundEnvironmentEndpoint', - 'OutboundEnvironmentEndpointCollection', - 'PowerState', - 'PrivateEndpoint', - 'PrivateEndpointConnection', - 'PrivateEndpointConnectionListResult', - 'PrivateLinkResource', - 'PrivateLinkResourcesListResult', - 'PrivateLinkServiceConnectionState', - 'Resource', - 'ResourceReference', - 'RunCommandRequest', - 'RunCommandResult', - 'Snapshot', - 'SnapshotListResult', - 'SubResource', - 'SysctlConfig', - 'SystemData', - 'TagsObject', - 'TimeInWeek', - 'TimeSpan', - 'UserAssignedIdentity', - 'WindowsGmsaProfile', - 'AgentPoolMode', - 'AgentPoolType', - 'Code', - 'ConnectionStatus', - 'ContainerServiceStorageProfileTypes', - 'ContainerServiceVMSizeTypes', - 'Count', - 'CreatedByType', - 'Expander', - 'ExtendedLocationTypes', - 'Format', - 'GPUInstanceProfile', - 'IpFamily', - 'KubeletDiskType', - 'LicenseType', - 'LoadBalancerSku', - 'ManagedClusterPodIdentityProvisioningState', - 'ManagedClusterSKUName', - 'ManagedClusterSKUTier', - 'NetworkMode', - 'NetworkPlugin', - 'NetworkPolicy', - 'OSDiskType', - 'OSSKU', - 'OSType', - 'OutboundType', - 'PrivateEndpointConnectionProvisioningState', - 'PublicNetworkAccess', - 'ResourceIdentityType', - 'ScaleDownMode', - 'ScaleSetEvictionPolicy', - 'ScaleSetPriority', - 'SnapshotType', - 'UpgradeChannel', - 'WeekDay', - 'WorkloadRuntime', + "AgentPool", + "AgentPoolAvailableVersions", + "AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem", + "AgentPoolListResult", + "AgentPoolUpgradeProfile", + "AgentPoolUpgradeProfilePropertiesUpgradesItem", + "AgentPoolUpgradeSettings", + "CloudErrorBody", + "ContainerServiceDiagnosticsProfile", + "ContainerServiceLinuxProfile", + "ContainerServiceMasterProfile", + "ContainerServiceNetworkProfile", + "ContainerServiceSshConfiguration", + "ContainerServiceSshPublicKey", + "ContainerServiceVMDiagnostics", + "CreationData", + "CredentialResult", + "CredentialResults", + "EndpointDependency", + "EndpointDetail", + "ExtendedLocation", + "KubeletConfig", + "LinuxOSConfig", + "MaintenanceConfiguration", + "MaintenanceConfigurationListResult", + "ManagedCluster", + "ManagedClusterAADProfile", + "ManagedClusterAPIServerAccessProfile", + "ManagedClusterAccessProfile", + "ManagedClusterAddonProfile", + "ManagedClusterAddonProfileIdentity", + "ManagedClusterAgentPoolProfile", + "ManagedClusterAgentPoolProfileProperties", + "ManagedClusterAutoUpgradeProfile", + "ManagedClusterHTTPProxyConfig", + "ManagedClusterIdentity", + "ManagedClusterListResult", + "ManagedClusterLoadBalancerProfile", + "ManagedClusterLoadBalancerProfileManagedOutboundIPs", + "ManagedClusterLoadBalancerProfileOutboundIPPrefixes", + "ManagedClusterLoadBalancerProfileOutboundIPs", + "ManagedClusterManagedOutboundIPProfile", + "ManagedClusterNATGatewayProfile", + "ManagedClusterOIDCIssuerProfile", + "ManagedClusterPodIdentity", + "ManagedClusterPodIdentityException", + "ManagedClusterPodIdentityProfile", + "ManagedClusterPodIdentityProvisioningError", + "ManagedClusterPodIdentityProvisioningErrorBody", + "ManagedClusterPodIdentityProvisioningInfo", + "ManagedClusterPoolUpgradeProfile", + "ManagedClusterPoolUpgradeProfileUpgradesItem", + "ManagedClusterPropertiesAutoScalerProfile", + "ManagedClusterSKU", + "ManagedClusterSecurityProfile", + "ManagedClusterSecurityProfileAzureDefender", + "ManagedClusterServicePrincipalProfile", + "ManagedClusterUpgradeProfile", + "ManagedClusterWindowsProfile", + "ManagedServiceIdentityUserAssignedIdentitiesValue", + "OSOptionProfile", + "OSOptionProperty", + "OperationListResult", + "OperationValue", + "OutboundEnvironmentEndpoint", + "OutboundEnvironmentEndpointCollection", + "PowerState", + "PrivateEndpoint", + "PrivateEndpointConnection", + "PrivateEndpointConnectionListResult", + "PrivateLinkResource", + "PrivateLinkResourcesListResult", + "PrivateLinkServiceConnectionState", + "Resource", + "ResourceReference", + "RunCommandRequest", + "RunCommandResult", + "Snapshot", + "SnapshotListResult", + "SubResource", + "SysctlConfig", + "SystemData", + "TagsObject", + "TimeInWeek", + "TimeSpan", + "UserAssignedIdentity", + "WindowsGmsaProfile", + "AgentPoolMode", + "AgentPoolType", + "Code", + "ConnectionStatus", + "ContainerServiceStorageProfileTypes", + "ContainerServiceVMSizeTypes", + "Count", + "CreatedByType", + "Expander", + "ExtendedLocationTypes", + "Format", + "GPUInstanceProfile", + "IpFamily", + "KubeletDiskType", + "LicenseType", + "LoadBalancerSku", + "ManagedClusterPodIdentityProvisioningState", + "ManagedClusterSKUName", + "ManagedClusterSKUTier", + "NetworkMode", + "NetworkPlugin", + "NetworkPolicy", + "OSDiskType", + "OSSKU", + "OSType", + "OutboundType", + "PrivateEndpointConnectionProvisioningState", + "PublicNetworkAccess", + "ResourceIdentityType", + "ScaleDownMode", + "ScaleSetEvictionPolicy", + "ScaleSetPriority", + "SnapshotType", + "UpgradeChannel", + "WeekDay", + "WorkloadRuntime", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/models/_container_service_client_enums.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/models/_container_service_client_enums.py index b4ac50d61317..1dc9bcf3d738 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/models/_container_service_client_enums.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/models/_container_service_client_enums.py @@ -13,7 +13,7 @@ class AgentPoolMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools + https://docs.microsoft.com/azure/aks/use-system-pools. """ #: System agent pools are primarily for hosting critical system pods such as CoreDNS and @@ -23,33 +23,34 @@ class AgentPoolMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: User agent pools are primarily for hosting your application pods. USER = "User" + class AgentPoolType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of Agent Pool. - """ + """The type of Agent Pool.""" #: Create an Agent Pool backed by a Virtual Machine Scale Set. VIRTUAL_MACHINE_SCALE_SETS = "VirtualMachineScaleSets" #: Use of this is strongly discouraged. AVAILABILITY_SET = "AvailabilitySet" + class Code(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Tells whether the cluster is Running or Stopped - """ + """Tells whether the cluster is Running or Stopped.""" #: The cluster is running. RUNNING = "Running" #: The cluster is stopped. STOPPED = "Stopped" + class ConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The private link service connection status. - """ + """The private link service connection status.""" PENDING = "Pending" APPROVED = "Approved" REJECTED = "Rejected" DISCONNECTED = "Disconnected" + class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Specifies what kind of storage to use. If omitted, the default will be chosen on your behalf based on the choice of orchestrator. @@ -58,9 +59,9 @@ class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEn STORAGE_ACCOUNT = "StorageAccount" MANAGED_DISKS = "ManagedDisks" + class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Size of agent VMs. Note: This is no longer maintained. - """ + """Size of agent VMs. Note: This is no longer maintained.""" STANDARD_A1 = "Standard_A1" STANDARD_A10 = "Standard_A10" @@ -237,6 +238,7 @@ class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): STANDARD_NV24 = "Standard_NV24" STANDARD_NV6 = "Standard_NV6" + class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): """Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, and 5. The default value is 1. @@ -246,15 +248,16 @@ class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): THREE = 3 FIVE = 5 + class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of identity that created the resource. - """ + """The type of identity that created the resource.""" USER = "User" APPLICATION = "Application" MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" + class Expander(str, Enum, metaclass=CaseInsensitiveEnumMeta): """If not specified, the default is 'random'. See `expanders `_ @@ -278,23 +281,25 @@ class Expander(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Used when you don't have a particular need for the node groups to scale differently. RANDOM = "random" + class ExtendedLocationTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of extendedLocation. - """ + """The type of extendedLocation.""" EDGE_ZONE = "EdgeZone" + class Format(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Format.""" #: Return azure auth-provider kubeconfig. This format is deprecated in 1.22 and will be fully #: removed in 1.25. AZURE = "azure" #: Return exec format kubeconfig. This format requires kubelogin binary in the path. - EXEC_ENUM = "exec" + EXEC = "exec" + class GPUInstanceProfile(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """GPUInstanceProfile to be used to specify GPU MIG instance profile for supported GPU VM SKU. - """ + """GPUInstanceProfile to be used to specify GPU MIG instance profile for supported GPU VM SKU.""" MIG1_G = "MIG1g" MIG2_G = "MIG2g" @@ -302,13 +307,14 @@ class GPUInstanceProfile(str, Enum, metaclass=CaseInsensitiveEnumMeta): MIG4_G = "MIG4g" MIG7_G = "MIG7g" + class IpFamily(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The IP version to use for cluster networking and IP assignment. - """ + """The IP version to use for cluster networking and IP assignment.""" I_PV4 = "IPv4" I_PV6 = "IPv6" + class KubeletDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. @@ -319,6 +325,7 @@ class KubeletDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Kubelet will use the temporary disk for its data. TEMPORARY = "Temporary" + class LicenseType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The license type to use for Windows VMs. See `Azure Hybrid User Benefits `_ for more details. @@ -329,6 +336,7 @@ class LicenseType(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Enables Azure Hybrid User Benefits for Windows VMs. WINDOWS_SERVER = "Windows_Server" + class LoadBalancerSku(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The default is 'standard'. See `Azure Load Balancer SKUs `_ for more information about the @@ -342,21 +350,22 @@ class LoadBalancerSku(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Use a basic Load Balancer with limited functionality. BASIC = "basic" + class ManagedClusterPodIdentityProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The current provisioning state of the pod identity. - """ + """The current provisioning state of the pod identity.""" ASSIGNED = "Assigned" UPDATING = "Updating" DELETING = "Deleting" FAILED = "Failed" + class ManagedClusterSKUName(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The name of a managed cluster SKU. - """ + """The name of a managed cluster SKU.""" BASIC = "Basic" + class ManagedClusterSKUTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): """If not specified, the default is 'Free'. See `uptime SLA `_ for more details. @@ -368,20 +377,20 @@ class ManagedClusterSKUTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: No guaranteed SLA, no additional charges. Free tier clusters have an SLO of 99.5%. FREE = "Free" + class NetworkMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """This cannot be specified if networkPlugin is anything other than 'azure'. - """ + """This cannot be specified if networkPlugin is anything other than 'azure'.""" #: No bridge is created. Intra-VM Pod to Pod communication is through IP routes created by Azure #: CNI. See `Transparent Mode `_ for #: more information. TRANSPARENT = "transparent" - #: This is no longer supported. + #: This is no longer supported BRIDGE = "bridge" + class NetworkPlugin(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Network plugin used for building the Kubernetes network. - """ + """Network plugin used for building the Kubernetes network.""" #: Use the Azure CNI network plugin. See `Azure CNI (advanced) networking #: `_ for @@ -395,9 +404,9 @@ class NetworkPlugin(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: networking functionality. NONE = "none" + class NetworkPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Network policy used for building the Kubernetes network. - """ + """Network policy used for building the Kubernetes network.""" #: Use Calico network policies. See `differences between Azure and Calico policies #: `_ @@ -408,6 +417,7 @@ class NetworkPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: for more information. AZURE = "azure" + class OSDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more @@ -424,22 +434,23 @@ class OSDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: provides lower read/write latency, along with faster node scaling and cluster upgrades. EPHEMERAL = "Ephemeral" + class OSSKU(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Specifies an OS SKU. This value must not be specified if OSType is Windows. - """ + """Specifies an OS SKU. This value must not be specified if OSType is Windows.""" UBUNTU = "Ubuntu" CBL_MARINER = "CBLMariner" + class OSType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The operating system type. The default is Linux. - """ + """The operating system type. The default is Linux.""" #: Use Linux. LINUX = "Linux" #: Use Windows. WINDOWS = "Windows" + class OutboundType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """This can only be set at cluster creation time and cannot be changed later. For more information see `egress outbound type `_. @@ -460,22 +471,23 @@ class OutboundType(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: advanced scenario and requires proper network configuration. USER_ASSIGNED_NAT_GATEWAY = "userAssignedNATGateway" + class PrivateEndpointConnectionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The current provisioning state. - """ + """The current provisioning state.""" SUCCEEDED = "Succeeded" CREATING = "Creating" DELETING = "Deleting" FAILED = "Failed" + class PublicNetworkAccess(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Allow or deny public network access for AKS - """ + """Allow or deny public network access for AKS.""" ENABLED = "Enabled" DISABLED = "Disabled" + class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """For more information see `use managed identities in AKS `_. @@ -492,6 +504,7 @@ class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Do not use a managed identity for the Managed Cluster, service principal will be used instead. NONE = "None" + class ScaleDownMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Describes how VMs are added to or removed from Agent Pools. See `billing states `_. @@ -503,10 +516,11 @@ class ScaleDownMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: during scale down. DEALLOCATE = "Deallocate" + class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The eviction policy specifies what to do with the VM when it is evicted. The default is Delete. For more information about eviction see `spot VMs - `_ + `_. """ #: Nodes in the underlying Scale Set of the node pool are deleted when they're evicted. @@ -516,9 +530,9 @@ class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: cause issues with cluster scaling or upgrading. DEALLOCATE = "Deallocate" + class ScaleSetPriority(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The Virtual Machine Scale Set priority. - """ + """The Virtual Machine Scale Set priority.""" #: Spot priority VMs will be used. There is no SLA for spot nodes. See `spot on AKS #: `_ for more information. @@ -526,13 +540,14 @@ class ScaleSetPriority(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Regular VMs will be used. REGULAR = "Regular" + class SnapshotType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of a snapshot. The default is NodePool. - """ + """The type of a snapshot. The default is NodePool.""" #: The snapshot is a snapshot of a node pool. NODE_POOL = "NodePool" + class UpgradeChannel(str, Enum, metaclass=CaseInsensitiveEnumMeta): """For more information see `setting the AKS cluster auto-upgrade channel `_. @@ -563,9 +578,9 @@ class UpgradeChannel(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Disables auto-upgrades and keeps the cluster at its current version of Kubernetes. NONE = "none" + class WeekDay(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The weekday enum. - """ + """The weekday enum.""" SUNDAY = "Sunday" MONDAY = "Monday" @@ -575,9 +590,9 @@ class WeekDay(str, Enum, metaclass=CaseInsensitiveEnumMeta): FRIDAY = "Friday" SATURDAY = "Saturday" + class WorkloadRuntime(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Determines the type of workload a node can run. - """ + """Determines the type of workload a node can run.""" #: Nodes will use Kubelet to run standard OCI container workloads. OCI_CONTAINER = "OCIContainer" diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/models/_models_py3.py index 15f583a95804..b7a9b0f87ae8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/models/_models_py3.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/models/_models_py3.py @@ -1,4 +1,5 @@ # coding=utf-8 +# pylint: disable=too-many-lines # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -9,14 +10,14 @@ import datetime from typing import Dict, List, Optional, TYPE_CHECKING, Union -import msrest.serialization +from ... import _serialization if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - import __init__ as _models + from .. import models as _models -class SubResource(msrest.serialization.Model): +class SubResource(_serialization.Model): """Reference to another subresource. Variables are only populated by the server, and will be ignored when sending a request. @@ -31,30 +32,26 @@ class SubResource(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(SubResource, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.id = None self.name = None self.type = None -class AgentPool(SubResource): +class AgentPool(SubResource): # pylint: disable=too-many-instance-attributes """Agent Pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -82,15 +79,15 @@ class AgentPool(SubResource): larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.OSDiskType :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data - root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.KubeletDiskType :ivar workload_runtime: Determines the type of workload a node can run. Known values are: - "OCIContainer", "WasmWasi". + "OCIContainer" and "WasmWasi". :vartype workload_runtime: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.WorkloadRuntime :ivar message_of_the_day: A base64-encoded string which will be written to /etc/motd after @@ -109,11 +106,11 @@ class AgentPool(SubResource): :vartype pod_subnet_id: str :ivar max_pods: The maximum number of pods that can run on a node. :vartype max_pods: int - :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.OSType :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known - values are: "Ubuntu", "CBLMariner". + values are: "Ubuntu" and "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.OSSKU :ivar max_count: The maximum number of nodes for auto-scaling. :vartype max_count: int @@ -122,16 +119,16 @@ class AgentPool(SubResource): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it - defaults to Delete. Known values are: "Delete", "Deallocate". + defaults to Delete. Known values are: "Delete" and "Deallocate". :vartype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.ScaleDownMode - :ivar type_properties_type: The type of Agent Pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + :ivar type_properties_type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets" + and "AvailabilitySet". :vartype type_properties_type: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.AgentPoolType :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :vartype mode: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.AgentPoolMode :ivar orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -166,20 +163,18 @@ class AgentPool(SubResource): /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default - is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + is 'Regular'. Known values are: "Spot" and "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.ScaleSetPriority :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.ScaleSetEvictionPolicy :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :vartype spot_max_price: float - :ivar tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :ivar tags: The tags to be persisted on the agent pool virtual machine scale set. :vartype tags: dict[str, str] :ivar node_labels: The node labels to be persisted across all nodes in agent pool. :vartype node_labels: dict[str, str] @@ -203,7 +198,7 @@ class AgentPool(SubResource): for more details. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.GPUInstanceProfile :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the node pool @@ -220,63 +215,63 @@ class AgentPool(SubResource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'os_disk_size_gb': {'maximum': 2048, 'minimum': 0}, - 'node_image_version': {'readonly': True}, - 'provisioning_state': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "os_disk_size_gb": {"maximum": 2048, "minimum": 0}, + "node_image_version": {"readonly": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'count': {'key': 'properties.count', 'type': 'int'}, - 'vm_size': {'key': 'properties.vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'properties.osDiskSizeGB', 'type': 'int'}, - 'os_disk_type': {'key': 'properties.osDiskType', 'type': 'str'}, - 'kubelet_disk_type': {'key': 'properties.kubeletDiskType', 'type': 'str'}, - 'workload_runtime': {'key': 'properties.workloadRuntime', 'type': 'str'}, - 'message_of_the_day': {'key': 'properties.messageOfTheDay', 'type': 'str'}, - 'vnet_subnet_id': {'key': 'properties.vnetSubnetID', 'type': 'str'}, - 'pod_subnet_id': {'key': 'properties.podSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'properties.maxPods', 'type': 'int'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'os_sku': {'key': 'properties.osSKU', 'type': 'str'}, - 'max_count': {'key': 'properties.maxCount', 'type': 'int'}, - 'min_count': {'key': 'properties.minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'properties.enableAutoScaling', 'type': 'bool'}, - 'scale_down_mode': {'key': 'properties.scaleDownMode', 'type': 'str'}, - 'type_properties_type': {'key': 'properties.type', 'type': 'str'}, - 'mode': {'key': 'properties.mode', 'type': 'str'}, - 'orchestrator_version': {'key': 'properties.orchestratorVersion', 'type': 'str'}, - 'node_image_version': {'key': 'properties.nodeImageVersion', 'type': 'str'}, - 'upgrade_settings': {'key': 'properties.upgradeSettings', 'type': 'AgentPoolUpgradeSettings'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'power_state': {'key': 'properties.powerState', 'type': 'PowerState'}, - 'availability_zones': {'key': 'properties.availabilityZones', 'type': '[str]'}, - 'enable_node_public_ip': {'key': 'properties.enableNodePublicIP', 'type': 'bool'}, - 'node_public_ip_prefix_id': {'key': 'properties.nodePublicIPPrefixID', 'type': 'str'}, - 'scale_set_priority': {'key': 'properties.scaleSetPriority', 'type': 'str'}, - 'scale_set_eviction_policy': {'key': 'properties.scaleSetEvictionPolicy', 'type': 'str'}, - 'spot_max_price': {'key': 'properties.spotMaxPrice', 'type': 'float'}, - 'tags': {'key': 'properties.tags', 'type': '{str}'}, - 'node_labels': {'key': 'properties.nodeLabels', 'type': '{str}'}, - 'node_taints': {'key': 'properties.nodeTaints', 'type': '[str]'}, - 'proximity_placement_group_id': {'key': 'properties.proximityPlacementGroupID', 'type': 'str'}, - 'kubelet_config': {'key': 'properties.kubeletConfig', 'type': 'KubeletConfig'}, - 'linux_os_config': {'key': 'properties.linuxOSConfig', 'type': 'LinuxOSConfig'}, - 'enable_encryption_at_host': {'key': 'properties.enableEncryptionAtHost', 'type': 'bool'}, - 'enable_ultra_ssd': {'key': 'properties.enableUltraSSD', 'type': 'bool'}, - 'enable_fips': {'key': 'properties.enableFIPS', 'type': 'bool'}, - 'gpu_instance_profile': {'key': 'properties.gpuInstanceProfile', 'type': 'str'}, - 'creation_data': {'key': 'properties.creationData', 'type': 'CreationData'}, - 'capacity_reservation_group_id': {'key': 'properties.capacityReservationGroupID', 'type': 'str'}, - 'host_group_id': {'key': 'properties.hostGroupID', 'type': 'str'}, - } - - def __init__( + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "count": {"key": "properties.count", "type": "int"}, + "vm_size": {"key": "properties.vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "properties.osDiskSizeGB", "type": "int"}, + "os_disk_type": {"key": "properties.osDiskType", "type": "str"}, + "kubelet_disk_type": {"key": "properties.kubeletDiskType", "type": "str"}, + "workload_runtime": {"key": "properties.workloadRuntime", "type": "str"}, + "message_of_the_day": {"key": "properties.messageOfTheDay", "type": "str"}, + "vnet_subnet_id": {"key": "properties.vnetSubnetID", "type": "str"}, + "pod_subnet_id": {"key": "properties.podSubnetID", "type": "str"}, + "max_pods": {"key": "properties.maxPods", "type": "int"}, + "os_type": {"key": "properties.osType", "type": "str"}, + "os_sku": {"key": "properties.osSKU", "type": "str"}, + "max_count": {"key": "properties.maxCount", "type": "int"}, + "min_count": {"key": "properties.minCount", "type": "int"}, + "enable_auto_scaling": {"key": "properties.enableAutoScaling", "type": "bool"}, + "scale_down_mode": {"key": "properties.scaleDownMode", "type": "str"}, + "type_properties_type": {"key": "properties.type", "type": "str"}, + "mode": {"key": "properties.mode", "type": "str"}, + "orchestrator_version": {"key": "properties.orchestratorVersion", "type": "str"}, + "node_image_version": {"key": "properties.nodeImageVersion", "type": "str"}, + "upgrade_settings": {"key": "properties.upgradeSettings", "type": "AgentPoolUpgradeSettings"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "power_state": {"key": "properties.powerState", "type": "PowerState"}, + "availability_zones": {"key": "properties.availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "properties.enableNodePublicIP", "type": "bool"}, + "node_public_ip_prefix_id": {"key": "properties.nodePublicIPPrefixID", "type": "str"}, + "scale_set_priority": {"key": "properties.scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "properties.scaleSetEvictionPolicy", "type": "str"}, + "spot_max_price": {"key": "properties.spotMaxPrice", "type": "float"}, + "tags": {"key": "properties.tags", "type": "{str}"}, + "node_labels": {"key": "properties.nodeLabels", "type": "{str}"}, + "node_taints": {"key": "properties.nodeTaints", "type": "[str]"}, + "proximity_placement_group_id": {"key": "properties.proximityPlacementGroupID", "type": "str"}, + "kubelet_config": {"key": "properties.kubeletConfig", "type": "KubeletConfig"}, + "linux_os_config": {"key": "properties.linuxOSConfig", "type": "LinuxOSConfig"}, + "enable_encryption_at_host": {"key": "properties.enableEncryptionAtHost", "type": "bool"}, + "enable_ultra_ssd": {"key": "properties.enableUltraSSD", "type": "bool"}, + "enable_fips": {"key": "properties.enableFIPS", "type": "bool"}, + "gpu_instance_profile": {"key": "properties.gpuInstanceProfile", "type": "str"}, + "creation_data": {"key": "properties.creationData", "type": "CreationData"}, + "capacity_reservation_group_id": {"key": "properties.capacityReservationGroupID", "type": "str"}, + "host_group_id": {"key": "properties.hostGroupID", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, count: Optional[int] = None, @@ -289,7 +284,7 @@ def __init__( vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, @@ -303,9 +298,9 @@ def __init__( availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", - spot_max_price: Optional[float] = -1, + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", + spot_max_price: float = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, @@ -338,15 +333,15 @@ def __init__( larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.OSDiskType :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime - data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + data root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.KubeletDiskType :keyword workload_runtime: Determines the type of workload a node can run. Known values are: - "OCIContainer", "WasmWasi". + "OCIContainer" and "WasmWasi". :paramtype workload_runtime: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.WorkloadRuntime :keyword message_of_the_day: A base64-encoded string which will be written to /etc/motd after @@ -365,11 +360,11 @@ def __init__( :paramtype pod_subnet_id: str :keyword max_pods: The maximum number of pods that can run on a node. :paramtype max_pods: int - :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.OSType :keyword os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Known values are: "Ubuntu", "CBLMariner". + Known values are: "Ubuntu" and "CBLMariner". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.OSSKU :keyword max_count: The maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -378,16 +373,16 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, - it defaults to Delete. Known values are: "Delete", "Deallocate". + it defaults to Delete. Known values are: "Delete" and "Deallocate". :paramtype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.ScaleDownMode :keyword type_properties_type: The type of Agent Pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type_properties_type: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.AgentPoolType :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.AgentPoolMode :keyword orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -418,20 +413,18 @@ def __init__( /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the - default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + default is 'Regular'. Known values are: "Spot" and "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.ScaleSetPriority :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.ScaleSetEvictionPolicy :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :paramtype spot_max_price: float - :keyword tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :keyword tags: The tags to be persisted on the agent pool virtual machine scale set. :paramtype tags: dict[str, str] :keyword node_labels: The node labels to be persisted across all nodes in agent pool. :paramtype node_labels: dict[str, str] @@ -457,7 +450,7 @@ def __init__( for more details. :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance - profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.GPUInstanceProfile @@ -473,7 +466,7 @@ def __init__( `_. :paramtype host_group_id: str """ - super(AgentPool, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.vm_size = vm_size self.os_disk_size_gb = os_disk_size_gb @@ -518,7 +511,7 @@ def __init__( self.host_group_id = host_group_id -class AgentPoolAvailableVersions(msrest.serialization.Model): +class AgentPoolAvailableVersions(_serialization.Model): """The list of available versions for an agent pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -535,16 +528,19 @@ class AgentPoolAvailableVersions(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'agent_pool_versions': {'key': 'properties.agentPoolVersions', 'type': '[AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "agent_pool_versions": { + "key": "properties.agentPoolVersions", + "type": "[AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem]", + }, } def __init__( @@ -558,14 +554,14 @@ def __init__( :paramtype agent_pool_versions: list[~azure.mgmt.containerservice.v2022_01_02_preview.models.AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem] """ - super(AgentPoolAvailableVersions, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None self.agent_pool_versions = agent_pool_versions -class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(msrest.serialization.Model): +class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(_serialization.Model): """AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem. :ivar default: Whether this version is the default agent pool version. @@ -577,9 +573,9 @@ class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(msrest.serializa """ _attribute_map = { - 'default': {'key': 'default', 'type': 'bool'}, - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "default": {"key": "default", "type": "bool"}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } def __init__( @@ -598,13 +594,13 @@ def __init__( :keyword is_preview: Whether Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.default = default self.kubernetes_version = kubernetes_version self.is_preview = is_preview -class AgentPoolListResult(msrest.serialization.Model): +class AgentPoolListResult(_serialization.Model): """The response from the List Agent Pools operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -616,30 +612,25 @@ class AgentPoolListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[AgentPool]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[AgentPool]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.AgentPool"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.AgentPool"]] = None, **kwargs): """ :keyword value: The list of agent pools. :paramtype value: list[~azure.mgmt.containerservice.v2022_01_02_preview.models.AgentPool] """ - super(AgentPoolListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class AgentPoolUpgradeProfile(msrest.serialization.Model): +class AgentPoolUpgradeProfile(_serialization.Model): """The list of available upgrades for an agent pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -652,10 +643,10 @@ class AgentPoolUpgradeProfile(msrest.serialization.Model): :vartype name: str :ivar type: The type of the agent pool upgrade profile. :vartype type: str - :ivar kubernetes_version: Required. The Kubernetes version (major.minor.patch). + :ivar kubernetes_version: The Kubernetes version (major.minor.patch). Required. :vartype kubernetes_version: str - :ivar os_type: Required. The operating system type. The default is Linux. Known values are: - "Linux", "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -665,21 +656,21 @@ class AgentPoolUpgradeProfile(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kubernetes_version': {'required': True}, - 'os_type': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "kubernetes_version": {"required": True}, + "os_type": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'kubernetes_version': {'key': 'properties.kubernetesVersion', 'type': 'str'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'upgrades': {'key': 'properties.upgrades', 'type': '[AgentPoolUpgradeProfilePropertiesUpgradesItem]'}, - 'latest_node_image_version': {'key': 'properties.latestNodeImageVersion', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "os_type": {"key": "properties.osType", "type": "str"}, + "upgrades": {"key": "properties.upgrades", "type": "[AgentPoolUpgradeProfilePropertiesUpgradesItem]"}, + "latest_node_image_version": {"key": "properties.latestNodeImageVersion", "type": "str"}, } def __init__( @@ -692,10 +683,10 @@ def __init__( **kwargs ): """ - :keyword kubernetes_version: Required. The Kubernetes version (major.minor.patch). + :keyword kubernetes_version: The Kubernetes version (major.minor.patch). Required. :paramtype kubernetes_version: str - :keyword os_type: Required. The operating system type. The default is Linux. Known values are: - "Linux", "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: @@ -703,7 +694,7 @@ def __init__( :keyword latest_node_image_version: The latest AKS supported node image version. :paramtype latest_node_image_version: str """ - super(AgentPoolUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -713,7 +704,7 @@ def __init__( self.latest_node_image_version = latest_node_image_version -class AgentPoolUpgradeProfilePropertiesUpgradesItem(msrest.serialization.Model): +class AgentPoolUpgradeProfilePropertiesUpgradesItem(_serialization.Model): """AgentPoolUpgradeProfilePropertiesUpgradesItem. :ivar kubernetes_version: The Kubernetes version (major.minor.patch). @@ -723,29 +714,23 @@ class AgentPoolUpgradeProfilePropertiesUpgradesItem(msrest.serialization.Model): """ _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } - def __init__( - self, - *, - kubernetes_version: Optional[str] = None, - is_preview: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, kubernetes_version: Optional[str] = None, is_preview: Optional[bool] = None, **kwargs): """ :keyword kubernetes_version: The Kubernetes version (major.minor.patch). :paramtype kubernetes_version: str :keyword is_preview: Whether the Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(AgentPoolUpgradeProfilePropertiesUpgradesItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.is_preview = is_preview -class AgentPoolUpgradeSettings(msrest.serialization.Model): +class AgentPoolUpgradeSettings(_serialization.Model): """Settings for upgrading an agentpool. :ivar max_surge: This can either be set to an integer (e.g. '5') or a percentage (e.g. '50%'). @@ -757,15 +742,10 @@ class AgentPoolUpgradeSettings(msrest.serialization.Model): """ _attribute_map = { - 'max_surge': {'key': 'maxSurge', 'type': 'str'}, + "max_surge": {"key": "maxSurge", "type": "str"}, } - def __init__( - self, - *, - max_surge: Optional[str] = None, - **kwargs - ): + def __init__(self, *, max_surge: Optional[str] = None, **kwargs): """ :keyword max_surge: This can either be set to an integer (e.g. '5') or a percentage (e.g. '50%'). If a percentage is specified, it is the percentage of the total agent pool size at the @@ -774,11 +754,11 @@ def __init__( https://docs.microsoft.com/azure/aks/upgrade-cluster#customize-node-surge-upgrade. :paramtype max_surge: str """ - super(AgentPoolUpgradeSettings, self).__init__(**kwargs) + super().__init__(**kwargs) self.max_surge = max_surge -class CloudErrorBody(msrest.serialization.Model): +class CloudErrorBody(_serialization.Model): """An error response from the Container service. :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed @@ -795,10 +775,10 @@ class CloudErrorBody(msrest.serialization.Model): """ _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[CloudErrorBody]"}, } def __init__( @@ -824,88 +804,77 @@ def __init__( :paramtype details: list[~azure.mgmt.containerservice.v2022_01_02_preview.models.CloudErrorBody] """ - super(CloudErrorBody, self).__init__(**kwargs) + super().__init__(**kwargs) self.code = code self.message = message self.target = target self.details = details -class ContainerServiceDiagnosticsProfile(msrest.serialization.Model): +class ContainerServiceDiagnosticsProfile(_serialization.Model): """Profile for diagnostics on the container service cluster. All required parameters must be populated in order to send to Azure. - :ivar vm_diagnostics: Required. Profile for diagnostics on the container service VMs. + :ivar vm_diagnostics: Profile for diagnostics on the container service VMs. Required. :vartype vm_diagnostics: ~azure.mgmt.containerservice.v2022_01_02_preview.models.ContainerServiceVMDiagnostics """ _validation = { - 'vm_diagnostics': {'required': True}, + "vm_diagnostics": {"required": True}, } _attribute_map = { - 'vm_diagnostics': {'key': 'vmDiagnostics', 'type': 'ContainerServiceVMDiagnostics'}, + "vm_diagnostics": {"key": "vmDiagnostics", "type": "ContainerServiceVMDiagnostics"}, } - def __init__( - self, - *, - vm_diagnostics: "_models.ContainerServiceVMDiagnostics", - **kwargs - ): + def __init__(self, *, vm_diagnostics: "_models.ContainerServiceVMDiagnostics", **kwargs): """ - :keyword vm_diagnostics: Required. Profile for diagnostics on the container service VMs. + :keyword vm_diagnostics: Profile for diagnostics on the container service VMs. Required. :paramtype vm_diagnostics: ~azure.mgmt.containerservice.v2022_01_02_preview.models.ContainerServiceVMDiagnostics """ - super(ContainerServiceDiagnosticsProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.vm_diagnostics = vm_diagnostics -class ContainerServiceLinuxProfile(msrest.serialization.Model): +class ContainerServiceLinuxProfile(_serialization.Model): """Profile for Linux VMs in the container service cluster. All required parameters must be populated in order to send to Azure. - :ivar admin_username: Required. The administrator username to use for Linux VMs. + :ivar admin_username: The administrator username to use for Linux VMs. Required. :vartype admin_username: str - :ivar ssh: Required. The SSH configuration for Linux-based VMs running on Azure. + :ivar ssh: The SSH configuration for Linux-based VMs running on Azure. Required. :vartype ssh: ~azure.mgmt.containerservice.v2022_01_02_preview.models.ContainerServiceSshConfiguration """ _validation = { - 'admin_username': {'required': True, 'pattern': r'^[A-Za-z][-A-Za-z0-9_]*$'}, - 'ssh': {'required': True}, + "admin_username": {"required": True, "pattern": r"^[A-Za-z][-A-Za-z0-9_]*$"}, + "ssh": {"required": True}, } _attribute_map = { - 'admin_username': {'key': 'adminUsername', 'type': 'str'}, - 'ssh': {'key': 'ssh', 'type': 'ContainerServiceSshConfiguration'}, + "admin_username": {"key": "adminUsername", "type": "str"}, + "ssh": {"key": "ssh", "type": "ContainerServiceSshConfiguration"}, } - def __init__( - self, - *, - admin_username: str, - ssh: "_models.ContainerServiceSshConfiguration", - **kwargs - ): + def __init__(self, *, admin_username: str, ssh: "_models.ContainerServiceSshConfiguration", **kwargs): """ - :keyword admin_username: Required. The administrator username to use for Linux VMs. + :keyword admin_username: The administrator username to use for Linux VMs. Required. :paramtype admin_username: str - :keyword ssh: Required. The SSH configuration for Linux-based VMs running on Azure. + :keyword ssh: The SSH configuration for Linux-based VMs running on Azure. Required. :paramtype ssh: ~azure.mgmt.containerservice.v2022_01_02_preview.models.ContainerServiceSshConfiguration """ - super(ContainerServiceLinuxProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.admin_username = admin_username self.ssh = ssh -class ContainerServiceMasterProfile(msrest.serialization.Model): +class ContainerServiceMasterProfile(_serialization.Model): """Profile for the container service master. Variables are only populated by the server, and will be ignored when sending a request. @@ -913,11 +882,11 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar count: Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, - and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". + and 5. The default value is 1. Known values are: 1, 3, and 5. :vartype count: int or ~azure.mgmt.containerservice.v2022_01_02_preview.models.Count - :ivar dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. + :ivar dns_prefix: DNS prefix to be used to create the FQDN for the master pool. Required. :vartype dns_prefix: str - :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + :ivar vm_size: Size of agent VMs. Required. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -954,7 +923,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :vartype vm_size: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.ContainerServiceVMSizeTypes :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine @@ -968,7 +937,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): :vartype first_consecutive_static_ip: str :ivar storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount" and "ManagedDisks". :vartype storage_profile: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.ContainerServiceStorageProfileTypes :ivar fqdn: FQDN for the master pool. @@ -976,21 +945,21 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): """ _validation = { - 'dns_prefix': {'required': True}, - 'vm_size': {'required': True}, - 'os_disk_size_gb': {'maximum': 2048, 'minimum': 0}, - 'fqdn': {'readonly': True}, + "dns_prefix": {"required": True}, + "vm_size": {"required": True}, + "os_disk_size_gb": {"maximum": 2048, "minimum": 0}, + "fqdn": {"readonly": True}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'dns_prefix': {'key': 'dnsPrefix', 'type': 'str'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'first_consecutive_static_ip': {'key': 'firstConsecutiveStaticIP', 'type': 'str'}, - 'storage_profile': {'key': 'storageProfile', 'type': 'str'}, - 'fqdn': {'key': 'fqdn', 'type': 'str'}, + "count": {"key": "count", "type": "int"}, + "dns_prefix": {"key": "dnsPrefix", "type": "str"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "first_consecutive_static_ip": {"key": "firstConsecutiveStaticIP", "type": "str"}, + "storage_profile": {"key": "storageProfile", "type": "str"}, + "fqdn": {"key": "fqdn", "type": "str"}, } def __init__( @@ -998,20 +967,20 @@ def __init__( *, dns_prefix: str, vm_size: Union[str, "_models.ContainerServiceVMSizeTypes"], - count: Optional[Union[int, "_models.Count"]] = 1, + count: Union[int, "_models.Count"] = 1, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, - first_consecutive_static_ip: Optional[str] = "10.240.255.5", + first_consecutive_static_ip: str = "10.240.255.5", storage_profile: Optional[Union[str, "_models.ContainerServiceStorageProfileTypes"]] = None, **kwargs ): """ :keyword count: Number of masters (VMs) in the container service cluster. Allowed values are 1, - 3, and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". + 3, and 5. The default value is 1. Known values are: 1, 3, and 5. :paramtype count: int or ~azure.mgmt.containerservice.v2022_01_02_preview.models.Count - :keyword dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. + :keyword dns_prefix: DNS prefix to be used to create the FQDN for the master pool. Required. :paramtype dns_prefix: str - :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + :keyword vm_size: Size of agent VMs. Required. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -1048,7 +1017,7 @@ def __init__( "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :paramtype vm_size: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.ContainerServiceVMSizeTypes :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every @@ -1062,11 +1031,11 @@ def __init__( :paramtype first_consecutive_static_ip: str :keyword storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount" and "ManagedDisks". :paramtype storage_profile: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.ContainerServiceStorageProfileTypes """ - super(ContainerServiceMasterProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.dns_prefix = dns_prefix self.vm_size = vm_size @@ -1077,19 +1046,19 @@ def __init__( self.fqdn = None -class ContainerServiceNetworkProfile(msrest.serialization.Model): +class ContainerServiceNetworkProfile(_serialization.Model): # pylint: disable=too-many-instance-attributes """Profile of network configuration. :ivar network_plugin: Network plugin used for building the Kubernetes network. Known values - are: "azure", "kubenet", "none". Default value: "kubenet". + are: "azure", "kubenet", and "none". :vartype network_plugin: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.NetworkPlugin :ivar network_policy: Network policy used for building the Kubernetes network. Known values - are: "calico", "azure". + are: "calico" and "azure". :vartype network_policy: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.NetworkPolicy :ivar network_mode: This cannot be specified if networkPlugin is anything other than 'azure'. - Known values are: "transparent", "bridge". + Known values are: "transparent" and "bridge". :vartype network_mode: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.NetworkMode :ivar pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. @@ -1106,13 +1075,12 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): :ivar outbound_type: This can only be set at cluster creation time and cannot be changed later. For more information see `egress outbound type `_. Known values are: "loadBalancer", - "userDefinedRouting", "managedNATGateway", "userAssignedNATGateway". Default value: - "loadBalancer". + "userDefinedRouting", "managedNATGateway", and "userAssignedNATGateway". :vartype outbound_type: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.OutboundType :ivar load_balancer_sku: The default is 'standard'. See `Azure Load Balancer SKUs `_ for more information about the - differences between load balancer SKUs. Known values are: "standard", "basic". + differences between load balancer SKUs. Known values are: "standard" and "basic". :vartype load_balancer_sku: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.LoadBalancerSku :ivar load_balancer_profile: Profile of the cluster load balancer. @@ -1136,40 +1104,42 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): """ _validation = { - 'pod_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, - 'service_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, - 'dns_service_ip': {'pattern': r'^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$'}, - 'docker_bridge_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, + "pod_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, + "service_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, + "dns_service_ip": { + "pattern": r"^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$" + }, + "docker_bridge_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, } _attribute_map = { - 'network_plugin': {'key': 'networkPlugin', 'type': 'str'}, - 'network_policy': {'key': 'networkPolicy', 'type': 'str'}, - 'network_mode': {'key': 'networkMode', 'type': 'str'}, - 'pod_cidr': {'key': 'podCidr', 'type': 'str'}, - 'service_cidr': {'key': 'serviceCidr', 'type': 'str'}, - 'dns_service_ip': {'key': 'dnsServiceIP', 'type': 'str'}, - 'docker_bridge_cidr': {'key': 'dockerBridgeCidr', 'type': 'str'}, - 'outbound_type': {'key': 'outboundType', 'type': 'str'}, - 'load_balancer_sku': {'key': 'loadBalancerSku', 'type': 'str'}, - 'load_balancer_profile': {'key': 'loadBalancerProfile', 'type': 'ManagedClusterLoadBalancerProfile'}, - 'nat_gateway_profile': {'key': 'natGatewayProfile', 'type': 'ManagedClusterNATGatewayProfile'}, - 'pod_cidrs': {'key': 'podCidrs', 'type': '[str]'}, - 'service_cidrs': {'key': 'serviceCidrs', 'type': '[str]'}, - 'ip_families': {'key': 'ipFamilies', 'type': '[str]'}, + "network_plugin": {"key": "networkPlugin", "type": "str"}, + "network_policy": {"key": "networkPolicy", "type": "str"}, + "network_mode": {"key": "networkMode", "type": "str"}, + "pod_cidr": {"key": "podCidr", "type": "str"}, + "service_cidr": {"key": "serviceCidr", "type": "str"}, + "dns_service_ip": {"key": "dnsServiceIP", "type": "str"}, + "docker_bridge_cidr": {"key": "dockerBridgeCidr", "type": "str"}, + "outbound_type": {"key": "outboundType", "type": "str"}, + "load_balancer_sku": {"key": "loadBalancerSku", "type": "str"}, + "load_balancer_profile": {"key": "loadBalancerProfile", "type": "ManagedClusterLoadBalancerProfile"}, + "nat_gateway_profile": {"key": "natGatewayProfile", "type": "ManagedClusterNATGatewayProfile"}, + "pod_cidrs": {"key": "podCidrs", "type": "[str]"}, + "service_cidrs": {"key": "serviceCidrs", "type": "[str]"}, + "ip_families": {"key": "ipFamilies", "type": "[str]"}, } def __init__( self, *, - network_plugin: Optional[Union[str, "_models.NetworkPlugin"]] = "kubenet", + network_plugin: Union[str, "_models.NetworkPlugin"] = "kubenet", network_policy: Optional[Union[str, "_models.NetworkPolicy"]] = None, network_mode: Optional[Union[str, "_models.NetworkMode"]] = None, - pod_cidr: Optional[str] = "10.244.0.0/16", - service_cidr: Optional[str] = "10.0.0.0/16", - dns_service_ip: Optional[str] = "10.0.0.10", - docker_bridge_cidr: Optional[str] = "172.17.0.1/16", - outbound_type: Optional[Union[str, "_models.OutboundType"]] = "loadBalancer", + pod_cidr: str = "10.244.0.0/16", + service_cidr: str = "10.0.0.0/16", + dns_service_ip: str = "10.0.0.10", + docker_bridge_cidr: str = "172.17.0.1/16", + outbound_type: Union[str, "_models.OutboundType"] = "loadBalancer", load_balancer_sku: Optional[Union[str, "_models.LoadBalancerSku"]] = None, load_balancer_profile: Optional["_models.ManagedClusterLoadBalancerProfile"] = None, nat_gateway_profile: Optional["_models.ManagedClusterNATGatewayProfile"] = None, @@ -1180,15 +1150,15 @@ def __init__( ): """ :keyword network_plugin: Network plugin used for building the Kubernetes network. Known values - are: "azure", "kubenet", "none". Default value: "kubenet". + are: "azure", "kubenet", and "none". :paramtype network_plugin: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.NetworkPlugin :keyword network_policy: Network policy used for building the Kubernetes network. Known values - are: "calico", "azure". + are: "calico" and "azure". :paramtype network_policy: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.NetworkPolicy :keyword network_mode: This cannot be specified if networkPlugin is anything other than - 'azure'. Known values are: "transparent", "bridge". + 'azure'. Known values are: "transparent" and "bridge". :paramtype network_mode: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.NetworkMode :keyword pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. @@ -1205,13 +1175,12 @@ def __init__( :keyword outbound_type: This can only be set at cluster creation time and cannot be changed later. For more information see `egress outbound type `_. Known values are: "loadBalancer", - "userDefinedRouting", "managedNATGateway", "userAssignedNATGateway". Default value: - "loadBalancer". + "userDefinedRouting", "managedNATGateway", and "userAssignedNATGateway". :paramtype outbound_type: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.OutboundType :keyword load_balancer_sku: The default is 'standard'. See `Azure Load Balancer SKUs `_ for more information about the - differences between load balancer SKUs. Known values are: "standard", "basic". + differences between load balancer SKUs. Known values are: "standard" and "basic". :paramtype load_balancer_sku: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.LoadBalancerSku :keyword load_balancer_profile: Profile of the cluster load balancer. @@ -1233,7 +1202,7 @@ def __init__( :paramtype ip_families: list[str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.IpFamily] """ - super(ContainerServiceNetworkProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.network_plugin = network_plugin self.network_policy = network_policy self.network_mode = network_mode @@ -1250,113 +1219,98 @@ def __init__( self.ip_families = ip_families -class ContainerServiceSshConfiguration(msrest.serialization.Model): +class ContainerServiceSshConfiguration(_serialization.Model): """SSH configuration for Linux-based VMs running on Azure. All required parameters must be populated in order to send to Azure. - :ivar public_keys: Required. The list of SSH public keys used to authenticate with Linux-based - VMs. A maximum of 1 key may be specified. + :ivar public_keys: The list of SSH public keys used to authenticate with Linux-based VMs. A + maximum of 1 key may be specified. Required. :vartype public_keys: list[~azure.mgmt.containerservice.v2022_01_02_preview.models.ContainerServiceSshPublicKey] """ _validation = { - 'public_keys': {'required': True}, + "public_keys": {"required": True}, } _attribute_map = { - 'public_keys': {'key': 'publicKeys', 'type': '[ContainerServiceSshPublicKey]'}, + "public_keys": {"key": "publicKeys", "type": "[ContainerServiceSshPublicKey]"}, } - def __init__( - self, - *, - public_keys: List["_models.ContainerServiceSshPublicKey"], - **kwargs - ): + def __init__(self, *, public_keys: List["_models.ContainerServiceSshPublicKey"], **kwargs): """ - :keyword public_keys: Required. The list of SSH public keys used to authenticate with - Linux-based VMs. A maximum of 1 key may be specified. + :keyword public_keys: The list of SSH public keys used to authenticate with Linux-based VMs. A + maximum of 1 key may be specified. Required. :paramtype public_keys: list[~azure.mgmt.containerservice.v2022_01_02_preview.models.ContainerServiceSshPublicKey] """ - super(ContainerServiceSshConfiguration, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_keys = public_keys -class ContainerServiceSshPublicKey(msrest.serialization.Model): +class ContainerServiceSshPublicKey(_serialization.Model): """Contains information about SSH certificate public key data. All required parameters must be populated in order to send to Azure. - :ivar key_data: Required. Certificate public key used to authenticate with VMs through SSH. The - certificate must be in PEM format with or without headers. + :ivar key_data: Certificate public key used to authenticate with VMs through SSH. The + certificate must be in PEM format with or without headers. Required. :vartype key_data: str """ _validation = { - 'key_data': {'required': True}, + "key_data": {"required": True}, } _attribute_map = { - 'key_data': {'key': 'keyData', 'type': 'str'}, + "key_data": {"key": "keyData", "type": "str"}, } - def __init__( - self, - *, - key_data: str, - **kwargs - ): + def __init__(self, *, key_data: str, **kwargs): """ - :keyword key_data: Required. Certificate public key used to authenticate with VMs through SSH. - The certificate must be in PEM format with or without headers. + :keyword key_data: Certificate public key used to authenticate with VMs through SSH. The + certificate must be in PEM format with or without headers. Required. :paramtype key_data: str """ - super(ContainerServiceSshPublicKey, self).__init__(**kwargs) + super().__init__(**kwargs) self.key_data = key_data -class ContainerServiceVMDiagnostics(msrest.serialization.Model): +class ContainerServiceVMDiagnostics(_serialization.Model): """Profile for diagnostics on the container service VMs. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar enabled: Required. Whether the VM diagnostic agent is provisioned on the VM. + :ivar enabled: Whether the VM diagnostic agent is provisioned on the VM. Required. :vartype enabled: bool :ivar storage_uri: The URI of the storage account where diagnostics are stored. :vartype storage_uri: str """ _validation = { - 'enabled': {'required': True}, - 'storage_uri': {'readonly': True}, + "enabled": {"required": True}, + "storage_uri": {"readonly": True}, } _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'storage_uri': {'key': 'storageUri', 'type': 'str'}, + "enabled": {"key": "enabled", "type": "bool"}, + "storage_uri": {"key": "storageUri", "type": "str"}, } - def __init__( - self, - *, - enabled: bool, - **kwargs - ): + def __init__(self, *, enabled: bool, **kwargs): """ - :keyword enabled: Required. Whether the VM diagnostic agent is provisioned on the VM. + :keyword enabled: Whether the VM diagnostic agent is provisioned on the VM. Required. :paramtype enabled: bool """ - super(ContainerServiceVMDiagnostics, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.storage_uri = None -class CreationData(msrest.serialization.Model): +class CreationData(_serialization.Model): """Data used when creating a target resource from a source resource. :ivar source_resource_id: This is the ARM ID of the source object to be used to create the @@ -1365,25 +1319,20 @@ class CreationData(msrest.serialization.Model): """ _attribute_map = { - 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, + "source_resource_id": {"key": "sourceResourceId", "type": "str"}, } - def __init__( - self, - *, - source_resource_id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, source_resource_id: Optional[str] = None, **kwargs): """ :keyword source_resource_id: This is the ARM ID of the source object to be used to create the target object. :paramtype source_resource_id: str """ - super(CreationData, self).__init__(**kwargs) + super().__init__(**kwargs) self.source_resource_id = source_resource_id -class CredentialResult(msrest.serialization.Model): +class CredentialResult(_serialization.Model): """The credential result response. Variables are only populated by the server, and will be ignored when sending a request. @@ -1391,31 +1340,27 @@ class CredentialResult(msrest.serialization.Model): :ivar name: The name of the credential. :vartype name: str :ivar value: Base64-encoded Kubernetes configuration file. - :vartype value: bytearray + :vartype value: bytes """ _validation = { - 'name': {'readonly': True}, - 'value': {'readonly': True}, + "name": {"readonly": True}, + "value": {"readonly": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'bytearray'}, + "name": {"key": "name", "type": "str"}, + "value": {"key": "value", "type": "bytearray"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(CredentialResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.name = None self.value = None -class CredentialResults(msrest.serialization.Model): +class CredentialResults(_serialization.Model): """The list credential result response. Variables are only populated by the server, and will be ignored when sending a request. @@ -1426,24 +1371,20 @@ class CredentialResults(msrest.serialization.Model): """ _validation = { - 'kubeconfigs': {'readonly': True}, + "kubeconfigs": {"readonly": True}, } _attribute_map = { - 'kubeconfigs': {'key': 'kubeconfigs', 'type': '[CredentialResult]'}, + "kubeconfigs": {"key": "kubeconfigs", "type": "[CredentialResult]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(CredentialResults, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.kubeconfigs = None -class EndpointDependency(msrest.serialization.Model): +class EndpointDependency(_serialization.Model): """A domain name that AKS agent nodes are reaching at. :ivar domain_name: The domain name of the dependency. @@ -1454,8 +1395,8 @@ class EndpointDependency(msrest.serialization.Model): """ _attribute_map = { - 'domain_name': {'key': 'domainName', 'type': 'str'}, - 'endpoint_details': {'key': 'endpointDetails', 'type': '[EndpointDetail]'}, + "domain_name": {"key": "domainName", "type": "str"}, + "endpoint_details": {"key": "endpointDetails", "type": "[EndpointDetail]"}, } def __init__( @@ -1472,12 +1413,12 @@ def __init__( :paramtype endpoint_details: list[~azure.mgmt.containerservice.v2022_01_02_preview.models.EndpointDetail] """ - super(EndpointDependency, self).__init__(**kwargs) + super().__init__(**kwargs) self.domain_name = domain_name self.endpoint_details = endpoint_details -class EndpointDetail(msrest.serialization.Model): +class EndpointDetail(_serialization.Model): """connect information from the AKS agent nodes to a single endpoint. :ivar ip_address: An IP Address that Domain Name currently resolves to. @@ -1491,10 +1432,10 @@ class EndpointDetail(msrest.serialization.Model): """ _attribute_map = { - 'ip_address': {'key': 'ipAddress', 'type': 'str'}, - 'port': {'key': 'port', 'type': 'int'}, - 'protocol': {'key': 'protocol', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, + "ip_address": {"key": "ipAddress", "type": "str"}, + "port": {"key": "port", "type": "int"}, + "protocol": {"key": "protocol", "type": "str"}, + "description": {"key": "description", "type": "str"}, } def __init__( @@ -1516,26 +1457,26 @@ def __init__( :keyword description: Description of the detail. :paramtype description: str """ - super(EndpointDetail, self).__init__(**kwargs) + super().__init__(**kwargs) self.ip_address = ip_address self.port = port self.protocol = protocol self.description = description -class ExtendedLocation(msrest.serialization.Model): +class ExtendedLocation(_serialization.Model): """The complex type of the extended location. :ivar name: The name of the extended location. :vartype name: str - :ivar type: The type of the extended location. Known values are: "EdgeZone". + :ivar type: The type of the extended location. "EdgeZone" :vartype type: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.ExtendedLocationTypes """ _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, } def __init__( @@ -1548,16 +1489,16 @@ def __init__( """ :keyword name: The name of the extended location. :paramtype name: str - :keyword type: The type of the extended location. Known values are: "EdgeZone". + :keyword type: The type of the extended location. "EdgeZone" :paramtype type: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.ExtendedLocationTypes """ - super(ExtendedLocation, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.type = type -class KubeletConfig(msrest.serialization.Model): +class KubeletConfig(_serialization.Model): # pylint: disable=too-many-instance-attributes """See `AKS custom node configuration `_ for more details. :ivar cpu_manager_policy: The default is 'none'. See `Kubernetes CPU management policies @@ -1597,21 +1538,21 @@ class KubeletConfig(msrest.serialization.Model): """ _validation = { - 'container_log_max_files': {'minimum': 2}, + "container_log_max_files": {"minimum": 2}, } _attribute_map = { - 'cpu_manager_policy': {'key': 'cpuManagerPolicy', 'type': 'str'}, - 'cpu_cfs_quota': {'key': 'cpuCfsQuota', 'type': 'bool'}, - 'cpu_cfs_quota_period': {'key': 'cpuCfsQuotaPeriod', 'type': 'str'}, - 'image_gc_high_threshold': {'key': 'imageGcHighThreshold', 'type': 'int'}, - 'image_gc_low_threshold': {'key': 'imageGcLowThreshold', 'type': 'int'}, - 'topology_manager_policy': {'key': 'topologyManagerPolicy', 'type': 'str'}, - 'allowed_unsafe_sysctls': {'key': 'allowedUnsafeSysctls', 'type': '[str]'}, - 'fail_swap_on': {'key': 'failSwapOn', 'type': 'bool'}, - 'container_log_max_size_mb': {'key': 'containerLogMaxSizeMB', 'type': 'int'}, - 'container_log_max_files': {'key': 'containerLogMaxFiles', 'type': 'int'}, - 'pod_max_pids': {'key': 'podMaxPids', 'type': 'int'}, + "cpu_manager_policy": {"key": "cpuManagerPolicy", "type": "str"}, + "cpu_cfs_quota": {"key": "cpuCfsQuota", "type": "bool"}, + "cpu_cfs_quota_period": {"key": "cpuCfsQuotaPeriod", "type": "str"}, + "image_gc_high_threshold": {"key": "imageGcHighThreshold", "type": "int"}, + "image_gc_low_threshold": {"key": "imageGcLowThreshold", "type": "int"}, + "topology_manager_policy": {"key": "topologyManagerPolicy", "type": "str"}, + "allowed_unsafe_sysctls": {"key": "allowedUnsafeSysctls", "type": "[str]"}, + "fail_swap_on": {"key": "failSwapOn", "type": "bool"}, + "container_log_max_size_mb": {"key": "containerLogMaxSizeMB", "type": "int"}, + "container_log_max_files": {"key": "containerLogMaxFiles", "type": "int"}, + "pod_max_pids": {"key": "podMaxPids", "type": "int"}, } def __init__( @@ -1666,7 +1607,7 @@ def __init__( :keyword pod_max_pids: The maximum number of processes per pod. :paramtype pod_max_pids: int """ - super(KubeletConfig, self).__init__(**kwargs) + super().__init__(**kwargs) self.cpu_manager_policy = cpu_manager_policy self.cpu_cfs_quota = cpu_cfs_quota self.cpu_cfs_quota_period = cpu_cfs_quota_period @@ -1680,7 +1621,7 @@ def __init__( self.pod_max_pids = pod_max_pids -class LinuxOSConfig(msrest.serialization.Model): +class LinuxOSConfig(_serialization.Model): """See `AKS custom node configuration `_ for more details. :ivar sysctls: Sysctl settings for Linux agent nodes. @@ -1699,10 +1640,10 @@ class LinuxOSConfig(msrest.serialization.Model): """ _attribute_map = { - 'sysctls': {'key': 'sysctls', 'type': 'SysctlConfig'}, - 'transparent_huge_page_enabled': {'key': 'transparentHugePageEnabled', 'type': 'str'}, - 'transparent_huge_page_defrag': {'key': 'transparentHugePageDefrag', 'type': 'str'}, - 'swap_file_size_mb': {'key': 'swapFileSizeMB', 'type': 'int'}, + "sysctls": {"key": "sysctls", "type": "SysctlConfig"}, + "transparent_huge_page_enabled": {"key": "transparentHugePageEnabled", "type": "str"}, + "transparent_huge_page_defrag": {"key": "transparentHugePageDefrag", "type": "str"}, + "swap_file_size_mb": {"key": "swapFileSizeMB", "type": "int"}, } def __init__( @@ -1729,7 +1670,7 @@ def __init__( :keyword swap_file_size_mb: The size in MB of a swap file that will be created on each node. :paramtype swap_file_size_mb: int """ - super(LinuxOSConfig, self).__init__(**kwargs) + super().__init__(**kwargs) self.sysctls = sysctls self.transparent_huge_page_enabled = transparent_huge_page_enabled self.transparent_huge_page_defrag = transparent_huge_page_defrag @@ -1759,19 +1700,19 @@ class MaintenanceConfiguration(SubResource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, + "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'}, - 'time_in_week': {'key': 'properties.timeInWeek', 'type': '[TimeInWeek]'}, - 'not_allowed_time': {'key': 'properties.notAllowedTime', 'type': '[TimeSpan]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "time_in_week": {"key": "properties.timeInWeek", "type": "[TimeInWeek]"}, + "not_allowed_time": {"key": "properties.notAllowedTime", "type": "[TimeSpan]"}, } def __init__( @@ -1790,13 +1731,13 @@ def __init__( :paramtype not_allowed_time: list[~azure.mgmt.containerservice.v2022_01_02_preview.models.TimeSpan] """ - super(MaintenanceConfiguration, self).__init__(**kwargs) + super().__init__(**kwargs) self.system_data = None self.time_in_week = time_in_week self.not_allowed_time = not_allowed_time -class MaintenanceConfigurationListResult(msrest.serialization.Model): +class MaintenanceConfigurationListResult(_serialization.Model): """The response from the List maintenance configurations operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -1809,31 +1750,26 @@ class MaintenanceConfigurationListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[MaintenanceConfiguration]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[MaintenanceConfiguration]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.MaintenanceConfiguration"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.MaintenanceConfiguration"]] = None, **kwargs): """ :keyword value: The list of maintenance configurations. :paramtype value: list[~azure.mgmt.containerservice.v2022_01_02_preview.models.MaintenanceConfiguration] """ - super(MaintenanceConfigurationListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class Resource(msrest.serialization.Model): +class Resource(_serialization.Model): """The Resource model definition. Variables are only populated by the server, and will be ignored when sending a request. @@ -1846,41 +1782,35 @@ class Resource(msrest.serialization.Model): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] """ - super(Resource, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -1888,7 +1818,7 @@ def __init__( self.tags = tags -class ManagedCluster(Resource): +class ManagedCluster(Resource): # pylint: disable=too-many-instance-attributes """Managed cluster. Variables are only populated by the server, and will be ignored when sending a request. @@ -1901,9 +1831,9 @@ class ManagedCluster(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar sku: The managed cluster SKU. :vartype sku: ~azure.mgmt.containerservice.v2022_01_02_preview.models.ManagedClusterSKU @@ -2011,70 +1941,79 @@ class ManagedCluster(Resource): :vartype security_profile: ~azure.mgmt.containerservice.v2022_01_02_preview.models.ManagedClusterSecurityProfile :ivar public_network_access: Allow or deny public network access for AKS. Known values are: - "Enabled", "Disabled". + "Enabled" and "Disabled". :vartype public_network_access: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.PublicNetworkAccess """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'provisioning_state': {'readonly': True}, - 'power_state': {'readonly': True}, - 'max_agent_pools': {'readonly': True}, - 'current_kubernetes_version': {'readonly': True}, - 'fqdn': {'readonly': True}, - 'private_fqdn': {'readonly': True}, - 'azure_portal_fqdn': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, + "provisioning_state": {"readonly": True}, + "power_state": {"readonly": True}, + "max_agent_pools": {"readonly": True}, + "current_kubernetes_version": {"readonly": True}, + "fqdn": {"readonly": True}, + "private_fqdn": {"readonly": True}, + "azure_portal_fqdn": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'ManagedClusterSKU'}, - 'extended_location': {'key': 'extendedLocation', 'type': 'ExtendedLocation'}, - 'identity': {'key': 'identity', 'type': 'ManagedClusterIdentity'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'power_state': {'key': 'properties.powerState', 'type': 'PowerState'}, - 'max_agent_pools': {'key': 'properties.maxAgentPools', 'type': 'int'}, - 'kubernetes_version': {'key': 'properties.kubernetesVersion', 'type': 'str'}, - 'current_kubernetes_version': {'key': 'properties.currentKubernetesVersion', 'type': 'str'}, - 'dns_prefix': {'key': 'properties.dnsPrefix', 'type': 'str'}, - 'fqdn_subdomain': {'key': 'properties.fqdnSubdomain', 'type': 'str'}, - 'fqdn': {'key': 'properties.fqdn', 'type': 'str'}, - 'private_fqdn': {'key': 'properties.privateFQDN', 'type': 'str'}, - 'azure_portal_fqdn': {'key': 'properties.azurePortalFQDN', 'type': 'str'}, - 'agent_pool_profiles': {'key': 'properties.agentPoolProfiles', 'type': '[ManagedClusterAgentPoolProfile]'}, - 'linux_profile': {'key': 'properties.linuxProfile', 'type': 'ContainerServiceLinuxProfile'}, - 'windows_profile': {'key': 'properties.windowsProfile', 'type': 'ManagedClusterWindowsProfile'}, - 'service_principal_profile': {'key': 'properties.servicePrincipalProfile', 'type': 'ManagedClusterServicePrincipalProfile'}, - 'addon_profiles': {'key': 'properties.addonProfiles', 'type': '{ManagedClusterAddonProfile}'}, - 'pod_identity_profile': {'key': 'properties.podIdentityProfile', 'type': 'ManagedClusterPodIdentityProfile'}, - 'oidc_issuer_profile': {'key': 'properties.oidcIssuerProfile', 'type': 'ManagedClusterOIDCIssuerProfile'}, - 'node_resource_group': {'key': 'properties.nodeResourceGroup', 'type': 'str'}, - 'enable_rbac': {'key': 'properties.enableRBAC', 'type': 'bool'}, - 'enable_pod_security_policy': {'key': 'properties.enablePodSecurityPolicy', 'type': 'bool'}, - 'enable_namespace_resources': {'key': 'properties.enableNamespaceResources', 'type': 'bool'}, - 'network_profile': {'key': 'properties.networkProfile', 'type': 'ContainerServiceNetworkProfile'}, - 'aad_profile': {'key': 'properties.aadProfile', 'type': 'ManagedClusterAADProfile'}, - 'auto_upgrade_profile': {'key': 'properties.autoUpgradeProfile', 'type': 'ManagedClusterAutoUpgradeProfile'}, - 'auto_scaler_profile': {'key': 'properties.autoScalerProfile', 'type': 'ManagedClusterPropertiesAutoScalerProfile'}, - 'api_server_access_profile': {'key': 'properties.apiServerAccessProfile', 'type': 'ManagedClusterAPIServerAccessProfile'}, - 'disk_encryption_set_id': {'key': 'properties.diskEncryptionSetID', 'type': 'str'}, - 'identity_profile': {'key': 'properties.identityProfile', 'type': '{UserAssignedIdentity}'}, - 'private_link_resources': {'key': 'properties.privateLinkResources', 'type': '[PrivateLinkResource]'}, - 'disable_local_accounts': {'key': 'properties.disableLocalAccounts', 'type': 'bool'}, - 'http_proxy_config': {'key': 'properties.httpProxyConfig', 'type': 'ManagedClusterHTTPProxyConfig'}, - 'security_profile': {'key': 'properties.securityProfile', 'type': 'ManagedClusterSecurityProfile'}, - 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, - } - - def __init__( + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "sku": {"key": "sku", "type": "ManagedClusterSKU"}, + "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, + "identity": {"key": "identity", "type": "ManagedClusterIdentity"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "power_state": {"key": "properties.powerState", "type": "PowerState"}, + "max_agent_pools": {"key": "properties.maxAgentPools", "type": "int"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "current_kubernetes_version": {"key": "properties.currentKubernetesVersion", "type": "str"}, + "dns_prefix": {"key": "properties.dnsPrefix", "type": "str"}, + "fqdn_subdomain": {"key": "properties.fqdnSubdomain", "type": "str"}, + "fqdn": {"key": "properties.fqdn", "type": "str"}, + "private_fqdn": {"key": "properties.privateFQDN", "type": "str"}, + "azure_portal_fqdn": {"key": "properties.azurePortalFQDN", "type": "str"}, + "agent_pool_profiles": {"key": "properties.agentPoolProfiles", "type": "[ManagedClusterAgentPoolProfile]"}, + "linux_profile": {"key": "properties.linuxProfile", "type": "ContainerServiceLinuxProfile"}, + "windows_profile": {"key": "properties.windowsProfile", "type": "ManagedClusterWindowsProfile"}, + "service_principal_profile": { + "key": "properties.servicePrincipalProfile", + "type": "ManagedClusterServicePrincipalProfile", + }, + "addon_profiles": {"key": "properties.addonProfiles", "type": "{ManagedClusterAddonProfile}"}, + "pod_identity_profile": {"key": "properties.podIdentityProfile", "type": "ManagedClusterPodIdentityProfile"}, + "oidc_issuer_profile": {"key": "properties.oidcIssuerProfile", "type": "ManagedClusterOIDCIssuerProfile"}, + "node_resource_group": {"key": "properties.nodeResourceGroup", "type": "str"}, + "enable_rbac": {"key": "properties.enableRBAC", "type": "bool"}, + "enable_pod_security_policy": {"key": "properties.enablePodSecurityPolicy", "type": "bool"}, + "enable_namespace_resources": {"key": "properties.enableNamespaceResources", "type": "bool"}, + "network_profile": {"key": "properties.networkProfile", "type": "ContainerServiceNetworkProfile"}, + "aad_profile": {"key": "properties.aadProfile", "type": "ManagedClusterAADProfile"}, + "auto_upgrade_profile": {"key": "properties.autoUpgradeProfile", "type": "ManagedClusterAutoUpgradeProfile"}, + "auto_scaler_profile": { + "key": "properties.autoScalerProfile", + "type": "ManagedClusterPropertiesAutoScalerProfile", + }, + "api_server_access_profile": { + "key": "properties.apiServerAccessProfile", + "type": "ManagedClusterAPIServerAccessProfile", + }, + "disk_encryption_set_id": {"key": "properties.diskEncryptionSetID", "type": "str"}, + "identity_profile": {"key": "properties.identityProfile", "type": "{UserAssignedIdentity}"}, + "private_link_resources": {"key": "properties.privateLinkResources", "type": "[PrivateLinkResource]"}, + "disable_local_accounts": {"key": "properties.disableLocalAccounts", "type": "bool"}, + "http_proxy_config": {"key": "properties.httpProxyConfig", "type": "ManagedClusterHTTPProxyConfig"}, + "security_profile": {"key": "properties.securityProfile", "type": "ManagedClusterSecurityProfile"}, + "public_network_access": {"key": "properties.publicNetworkAccess", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, location: str, @@ -2111,9 +2050,9 @@ def __init__( **kwargs ): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword sku: The managed cluster SKU. :paramtype sku: ~azure.mgmt.containerservice.v2022_01_02_preview.models.ManagedClusterSKU @@ -2206,11 +2145,11 @@ def __init__( :paramtype security_profile: ~azure.mgmt.containerservice.v2022_01_02_preview.models.ManagedClusterSecurityProfile :keyword public_network_access: Allow or deny public network access for AKS. Known values are: - "Enabled", "Disabled". + "Enabled" and "Disabled". :paramtype public_network_access: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.PublicNetworkAccess """ - super(ManagedCluster, self).__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.sku = sku self.extended_location = extended_location self.identity = identity @@ -2249,7 +2188,7 @@ def __init__( self.public_network_access = public_network_access -class ManagedClusterAADProfile(msrest.serialization.Model): +class ManagedClusterAADProfile(_serialization.Model): """For more details see `managed AAD on AKS `_. :ivar managed: Whether to enable managed AAD. @@ -2271,13 +2210,13 @@ class ManagedClusterAADProfile(msrest.serialization.Model): """ _attribute_map = { - 'managed': {'key': 'managed', 'type': 'bool'}, - 'enable_azure_rbac': {'key': 'enableAzureRBAC', 'type': 'bool'}, - 'admin_group_object_i_ds': {'key': 'adminGroupObjectIDs', 'type': '[str]'}, - 'client_app_id': {'key': 'clientAppID', 'type': 'str'}, - 'server_app_id': {'key': 'serverAppID', 'type': 'str'}, - 'server_app_secret': {'key': 'serverAppSecret', 'type': 'str'}, - 'tenant_id': {'key': 'tenantID', 'type': 'str'}, + "managed": {"key": "managed", "type": "bool"}, + "enable_azure_rbac": {"key": "enableAzureRBAC", "type": "bool"}, + "admin_group_object_i_ds": {"key": "adminGroupObjectIDs", "type": "[str]"}, + "client_app_id": {"key": "clientAppID", "type": "str"}, + "server_app_id": {"key": "serverAppID", "type": "str"}, + "server_app_secret": {"key": "serverAppSecret", "type": "str"}, + "tenant_id": {"key": "tenantID", "type": "str"}, } def __init__( @@ -2310,7 +2249,7 @@ def __init__( tenant of the deployment subscription. :paramtype tenant_id: str """ - super(ManagedClusterAADProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.managed = managed self.enable_azure_rbac = enable_azure_rbac self.admin_group_object_i_ds = admin_group_object_i_ds @@ -2333,58 +2272,53 @@ class ManagedClusterAccessProfile(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar kube_config: Base64-encoded Kubernetes configuration file. - :vartype kube_config: bytearray + :vartype kube_config: bytes """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'kube_config': {'key': 'properties.kubeConfig', 'type': 'bytearray'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "kube_config": {"key": "properties.kubeConfig", "type": "bytearray"}, } def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - kube_config: Optional[bytearray] = None, - **kwargs + self, *, location: str, tags: Optional[Dict[str, str]] = None, kube_config: Optional[bytes] = None, **kwargs ): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword kube_config: Base64-encoded Kubernetes configuration file. - :paramtype kube_config: bytearray + :paramtype kube_config: bytes """ - super(ManagedClusterAccessProfile, self).__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.kube_config = kube_config -class ManagedClusterAddonProfile(msrest.serialization.Model): +class ManagedClusterAddonProfile(_serialization.Model): """A Kubernetes add-on profile for a managed cluster. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar enabled: Required. Whether the add-on is enabled or not. + :ivar enabled: Whether the add-on is enabled or not. Required. :vartype enabled: bool :ivar config: Key-value pairs for configuring an add-on. :vartype config: dict[str, str] @@ -2394,36 +2328,30 @@ class ManagedClusterAddonProfile(msrest.serialization.Model): """ _validation = { - 'enabled': {'required': True}, - 'identity': {'readonly': True}, + "enabled": {"required": True}, + "identity": {"readonly": True}, } _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'config': {'key': 'config', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'ManagedClusterAddonProfileIdentity'}, + "enabled": {"key": "enabled", "type": "bool"}, + "config": {"key": "config", "type": "{str}"}, + "identity": {"key": "identity", "type": "ManagedClusterAddonProfileIdentity"}, } - def __init__( - self, - *, - enabled: bool, - config: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, enabled: bool, config: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword enabled: Required. Whether the add-on is enabled or not. + :keyword enabled: Whether the add-on is enabled or not. Required. :paramtype enabled: bool :keyword config: Key-value pairs for configuring an add-on. :paramtype config: dict[str, str] """ - super(ManagedClusterAddonProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.config = config self.identity = None -class UserAssignedIdentity(msrest.serialization.Model): +class UserAssignedIdentity(_serialization.Model): """Details about a user assigned identity. :ivar resource_id: The resource ID of the user assigned identity. @@ -2435,9 +2363,9 @@ class UserAssignedIdentity(msrest.serialization.Model): """ _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'object_id': {'key': 'objectId', 'type': 'str'}, + "resource_id": {"key": "resourceId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + "object_id": {"key": "objectId", "type": "str"}, } def __init__( @@ -2456,7 +2384,7 @@ def __init__( :keyword object_id: The object ID of the user assigned identity. :paramtype object_id: str """ - super(UserAssignedIdentity, self).__init__(**kwargs) + super().__init__(**kwargs) self.resource_id = resource_id self.client_id = client_id self.object_id = object_id @@ -2474,9 +2402,9 @@ class ManagedClusterAddonProfileIdentity(UserAssignedIdentity): """ _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'object_id': {'key': 'objectId', 'type': 'str'}, + "resource_id": {"key": "resourceId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + "object_id": {"key": "objectId", "type": "str"}, } def __init__( @@ -2495,10 +2423,10 @@ def __init__( :keyword object_id: The object ID of the user assigned identity. :paramtype object_id: str """ - super(ManagedClusterAddonProfileIdentity, self).__init__(resource_id=resource_id, client_id=client_id, object_id=object_id, **kwargs) + super().__init__(resource_id=resource_id, client_id=client_id, object_id=object_id, **kwargs) -class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): +class ManagedClusterAgentPoolProfileProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes """Properties for the container service agent pool profile. Variables are only populated by the server, and will be ignored when sending a request. @@ -2519,15 +2447,15 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.OSDiskType :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data - root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.KubeletDiskType :ivar workload_runtime: Determines the type of workload a node can run. Known values are: - "OCIContainer", "WasmWasi". + "OCIContainer" and "WasmWasi". :vartype workload_runtime: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.WorkloadRuntime :ivar message_of_the_day: A base64-encoded string which will be written to /etc/motd after @@ -2546,11 +2474,11 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :vartype pod_subnet_id: str :ivar max_pods: The maximum number of pods that can run on a node. :vartype max_pods: int - :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.OSType :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known - values are: "Ubuntu", "CBLMariner". + values are: "Ubuntu" and "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.OSSKU :ivar max_count: The maximum number of nodes for auto-scaling. :vartype max_count: int @@ -2559,15 +2487,15 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it - defaults to Delete. Known values are: "Delete", "Deallocate". + defaults to Delete. Known values are: "Delete" and "Deallocate". :vartype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.ScaleDownMode - :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", + :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets" and "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.AgentPoolType :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :vartype mode: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.AgentPoolMode :ivar orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -2602,20 +2530,18 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default - is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + is 'Regular'. Known values are: "Spot" and "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.ScaleSetPriority :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.ScaleSetEvictionPolicy :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :vartype spot_max_price: float - :ivar tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :ivar tags: The tags to be persisted on the agent pool virtual machine scale set. :vartype tags: dict[str, str] :ivar node_labels: The node labels to be persisted across all nodes in agent pool. :vartype node_labels: dict[str, str] @@ -2639,7 +2565,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): for more details. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.GPUInstanceProfile :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the node pool @@ -2656,57 +2582,57 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): """ _validation = { - 'os_disk_size_gb': {'maximum': 2048, 'minimum': 0}, - 'node_image_version': {'readonly': True}, - 'provisioning_state': {'readonly': True}, + "os_disk_size_gb": {"maximum": 2048, "minimum": 0}, + "node_image_version": {"readonly": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'os_disk_type': {'key': 'osDiskType', 'type': 'str'}, - 'kubelet_disk_type': {'key': 'kubeletDiskType', 'type': 'str'}, - 'workload_runtime': {'key': 'workloadRuntime', 'type': 'str'}, - 'message_of_the_day': {'key': 'messageOfTheDay', 'type': 'str'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'pod_subnet_id': {'key': 'podSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'maxPods', 'type': 'int'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'os_sku': {'key': 'osSKU', 'type': 'str'}, - 'max_count': {'key': 'maxCount', 'type': 'int'}, - 'min_count': {'key': 'minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'enableAutoScaling', 'type': 'bool'}, - 'scale_down_mode': {'key': 'scaleDownMode', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'mode': {'key': 'mode', 'type': 'str'}, - 'orchestrator_version': {'key': 'orchestratorVersion', 'type': 'str'}, - 'node_image_version': {'key': 'nodeImageVersion', 'type': 'str'}, - 'upgrade_settings': {'key': 'upgradeSettings', 'type': 'AgentPoolUpgradeSettings'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'power_state': {'key': 'powerState', 'type': 'PowerState'}, - 'availability_zones': {'key': 'availabilityZones', 'type': '[str]'}, - 'enable_node_public_ip': {'key': 'enableNodePublicIP', 'type': 'bool'}, - 'node_public_ip_prefix_id': {'key': 'nodePublicIPPrefixID', 'type': 'str'}, - 'scale_set_priority': {'key': 'scaleSetPriority', 'type': 'str'}, - 'scale_set_eviction_policy': {'key': 'scaleSetEvictionPolicy', 'type': 'str'}, - 'spot_max_price': {'key': 'spotMaxPrice', 'type': 'float'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'node_labels': {'key': 'nodeLabels', 'type': '{str}'}, - 'node_taints': {'key': 'nodeTaints', 'type': '[str]'}, - 'proximity_placement_group_id': {'key': 'proximityPlacementGroupID', 'type': 'str'}, - 'kubelet_config': {'key': 'kubeletConfig', 'type': 'KubeletConfig'}, - 'linux_os_config': {'key': 'linuxOSConfig', 'type': 'LinuxOSConfig'}, - 'enable_encryption_at_host': {'key': 'enableEncryptionAtHost', 'type': 'bool'}, - 'enable_ultra_ssd': {'key': 'enableUltraSSD', 'type': 'bool'}, - 'enable_fips': {'key': 'enableFIPS', 'type': 'bool'}, - 'gpu_instance_profile': {'key': 'gpuInstanceProfile', 'type': 'str'}, - 'creation_data': {'key': 'creationData', 'type': 'CreationData'}, - 'capacity_reservation_group_id': {'key': 'capacityReservationGroupID', 'type': 'str'}, - 'host_group_id': {'key': 'hostGroupID', 'type': 'str'}, - } - - def __init__( + "count": {"key": "count", "type": "int"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "os_disk_type": {"key": "osDiskType", "type": "str"}, + "kubelet_disk_type": {"key": "kubeletDiskType", "type": "str"}, + "workload_runtime": {"key": "workloadRuntime", "type": "str"}, + "message_of_the_day": {"key": "messageOfTheDay", "type": "str"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "pod_subnet_id": {"key": "podSubnetID", "type": "str"}, + "max_pods": {"key": "maxPods", "type": "int"}, + "os_type": {"key": "osType", "type": "str"}, + "os_sku": {"key": "osSKU", "type": "str"}, + "max_count": {"key": "maxCount", "type": "int"}, + "min_count": {"key": "minCount", "type": "int"}, + "enable_auto_scaling": {"key": "enableAutoScaling", "type": "bool"}, + "scale_down_mode": {"key": "scaleDownMode", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "mode": {"key": "mode", "type": "str"}, + "orchestrator_version": {"key": "orchestratorVersion", "type": "str"}, + "node_image_version": {"key": "nodeImageVersion", "type": "str"}, + "upgrade_settings": {"key": "upgradeSettings", "type": "AgentPoolUpgradeSettings"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "power_state": {"key": "powerState", "type": "PowerState"}, + "availability_zones": {"key": "availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "enableNodePublicIP", "type": "bool"}, + "node_public_ip_prefix_id": {"key": "nodePublicIPPrefixID", "type": "str"}, + "scale_set_priority": {"key": "scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "scaleSetEvictionPolicy", "type": "str"}, + "spot_max_price": {"key": "spotMaxPrice", "type": "float"}, + "tags": {"key": "tags", "type": "{str}"}, + "node_labels": {"key": "nodeLabels", "type": "{str}"}, + "node_taints": {"key": "nodeTaints", "type": "[str]"}, + "proximity_placement_group_id": {"key": "proximityPlacementGroupID", "type": "str"}, + "kubelet_config": {"key": "kubeletConfig", "type": "KubeletConfig"}, + "linux_os_config": {"key": "linuxOSConfig", "type": "LinuxOSConfig"}, + "enable_encryption_at_host": {"key": "enableEncryptionAtHost", "type": "bool"}, + "enable_ultra_ssd": {"key": "enableUltraSSD", "type": "bool"}, + "enable_fips": {"key": "enableFIPS", "type": "bool"}, + "gpu_instance_profile": {"key": "gpuInstanceProfile", "type": "str"}, + "creation_data": {"key": "creationData", "type": "CreationData"}, + "capacity_reservation_group_id": {"key": "capacityReservationGroupID", "type": "str"}, + "host_group_id": {"key": "hostGroupID", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, count: Optional[int] = None, @@ -2719,7 +2645,7 @@ def __init__( vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, @@ -2733,9 +2659,9 @@ def __init__( availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", - spot_max_price: Optional[float] = -1, + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", + spot_max_price: float = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, @@ -2768,15 +2694,15 @@ def __init__( larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.OSDiskType :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime - data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + data root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.KubeletDiskType :keyword workload_runtime: Determines the type of workload a node can run. Known values are: - "OCIContainer", "WasmWasi". + "OCIContainer" and "WasmWasi". :paramtype workload_runtime: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.WorkloadRuntime :keyword message_of_the_day: A base64-encoded string which will be written to /etc/motd after @@ -2795,11 +2721,11 @@ def __init__( :paramtype pod_subnet_id: str :keyword max_pods: The maximum number of pods that can run on a node. :paramtype max_pods: int - :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.OSType :keyword os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Known values are: "Ubuntu", "CBLMariner". + Known values are: "Ubuntu" and "CBLMariner". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.OSSKU :keyword max_count: The maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -2808,15 +2734,15 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, - it defaults to Delete. Known values are: "Delete", "Deallocate". + it defaults to Delete. Known values are: "Delete" and "Deallocate". :paramtype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.ScaleDownMode - :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", + :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.AgentPoolType :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.AgentPoolMode :keyword orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -2847,20 +2773,18 @@ def __init__( /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the - default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + default is 'Regular'. Known values are: "Spot" and "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.ScaleSetPriority :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.ScaleSetEvictionPolicy :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :paramtype spot_max_price: float - :keyword tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :keyword tags: The tags to be persisted on the agent pool virtual machine scale set. :paramtype tags: dict[str, str] :keyword node_labels: The node labels to be persisted across all nodes in agent pool. :paramtype node_labels: dict[str, str] @@ -2886,7 +2810,7 @@ def __init__( for more details. :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance - profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.GPUInstanceProfile @@ -2902,7 +2826,7 @@ def __init__( `_. :paramtype host_group_id: str """ - super(ManagedClusterAgentPoolProfileProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.vm_size = vm_size self.os_disk_size_gb = os_disk_size_gb @@ -2947,7 +2871,9 @@ def __init__( self.host_group_id = host_group_id -class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): +class ManagedClusterAgentPoolProfile( + ManagedClusterAgentPoolProfileProperties +): # pylint: disable=too-many-instance-attributes """Profile for the container service agent pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -2970,15 +2896,15 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.OSDiskType :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data - root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.KubeletDiskType :ivar workload_runtime: Determines the type of workload a node can run. Known values are: - "OCIContainer", "WasmWasi". + "OCIContainer" and "WasmWasi". :vartype workload_runtime: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.WorkloadRuntime :ivar message_of_the_day: A base64-encoded string which will be written to /etc/motd after @@ -2997,11 +2923,11 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :vartype pod_subnet_id: str :ivar max_pods: The maximum number of pods that can run on a node. :vartype max_pods: int - :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.OSType :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known - values are: "Ubuntu", "CBLMariner". + values are: "Ubuntu" and "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.OSSKU :ivar max_count: The maximum number of nodes for auto-scaling. :vartype max_count: int @@ -3010,15 +2936,15 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it - defaults to Delete. Known values are: "Delete", "Deallocate". + defaults to Delete. Known values are: "Delete" and "Deallocate". :vartype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.ScaleDownMode - :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", + :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets" and "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.AgentPoolType :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :vartype mode: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.AgentPoolMode :ivar orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -3053,20 +2979,18 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default - is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + is 'Regular'. Known values are: "Spot" and "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.ScaleSetPriority :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.ScaleSetEvictionPolicy :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :vartype spot_max_price: float - :ivar tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :ivar tags: The tags to be persisted on the agent pool virtual machine scale set. :vartype tags: dict[str, str] :ivar node_labels: The node labels to be persisted across all nodes in agent pool. :vartype node_labels: dict[str, str] @@ -3090,7 +3014,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): for more details. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.GPUInstanceProfile :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the node pool @@ -3104,64 +3028,64 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): For more information see `Azure dedicated hosts `_. :vartype host_group_id: str - :ivar name: Required. Windows agent pool names must be 6 characters or less. + :ivar name: Windows agent pool names must be 6 characters or less. Required. :vartype name: str """ _validation = { - 'os_disk_size_gb': {'maximum': 2048, 'minimum': 0}, - 'node_image_version': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'name': {'required': True, 'pattern': r'^[a-z][a-z0-9]{0,11}$'}, + "os_disk_size_gb": {"maximum": 2048, "minimum": 0}, + "node_image_version": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "name": {"required": True, "pattern": r"^[a-z][a-z0-9]{0,11}$"}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'os_disk_type': {'key': 'osDiskType', 'type': 'str'}, - 'kubelet_disk_type': {'key': 'kubeletDiskType', 'type': 'str'}, - 'workload_runtime': {'key': 'workloadRuntime', 'type': 'str'}, - 'message_of_the_day': {'key': 'messageOfTheDay', 'type': 'str'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'pod_subnet_id': {'key': 'podSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'maxPods', 'type': 'int'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'os_sku': {'key': 'osSKU', 'type': 'str'}, - 'max_count': {'key': 'maxCount', 'type': 'int'}, - 'min_count': {'key': 'minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'enableAutoScaling', 'type': 'bool'}, - 'scale_down_mode': {'key': 'scaleDownMode', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'mode': {'key': 'mode', 'type': 'str'}, - 'orchestrator_version': {'key': 'orchestratorVersion', 'type': 'str'}, - 'node_image_version': {'key': 'nodeImageVersion', 'type': 'str'}, - 'upgrade_settings': {'key': 'upgradeSettings', 'type': 'AgentPoolUpgradeSettings'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'power_state': {'key': 'powerState', 'type': 'PowerState'}, - 'availability_zones': {'key': 'availabilityZones', 'type': '[str]'}, - 'enable_node_public_ip': {'key': 'enableNodePublicIP', 'type': 'bool'}, - 'node_public_ip_prefix_id': {'key': 'nodePublicIPPrefixID', 'type': 'str'}, - 'scale_set_priority': {'key': 'scaleSetPriority', 'type': 'str'}, - 'scale_set_eviction_policy': {'key': 'scaleSetEvictionPolicy', 'type': 'str'}, - 'spot_max_price': {'key': 'spotMaxPrice', 'type': 'float'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'node_labels': {'key': 'nodeLabels', 'type': '{str}'}, - 'node_taints': {'key': 'nodeTaints', 'type': '[str]'}, - 'proximity_placement_group_id': {'key': 'proximityPlacementGroupID', 'type': 'str'}, - 'kubelet_config': {'key': 'kubeletConfig', 'type': 'KubeletConfig'}, - 'linux_os_config': {'key': 'linuxOSConfig', 'type': 'LinuxOSConfig'}, - 'enable_encryption_at_host': {'key': 'enableEncryptionAtHost', 'type': 'bool'}, - 'enable_ultra_ssd': {'key': 'enableUltraSSD', 'type': 'bool'}, - 'enable_fips': {'key': 'enableFIPS', 'type': 'bool'}, - 'gpu_instance_profile': {'key': 'gpuInstanceProfile', 'type': 'str'}, - 'creation_data': {'key': 'creationData', 'type': 'CreationData'}, - 'capacity_reservation_group_id': {'key': 'capacityReservationGroupID', 'type': 'str'}, - 'host_group_id': {'key': 'hostGroupID', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( + "count": {"key": "count", "type": "int"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "os_disk_type": {"key": "osDiskType", "type": "str"}, + "kubelet_disk_type": {"key": "kubeletDiskType", "type": "str"}, + "workload_runtime": {"key": "workloadRuntime", "type": "str"}, + "message_of_the_day": {"key": "messageOfTheDay", "type": "str"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "pod_subnet_id": {"key": "podSubnetID", "type": "str"}, + "max_pods": {"key": "maxPods", "type": "int"}, + "os_type": {"key": "osType", "type": "str"}, + "os_sku": {"key": "osSKU", "type": "str"}, + "max_count": {"key": "maxCount", "type": "int"}, + "min_count": {"key": "minCount", "type": "int"}, + "enable_auto_scaling": {"key": "enableAutoScaling", "type": "bool"}, + "scale_down_mode": {"key": "scaleDownMode", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "mode": {"key": "mode", "type": "str"}, + "orchestrator_version": {"key": "orchestratorVersion", "type": "str"}, + "node_image_version": {"key": "nodeImageVersion", "type": "str"}, + "upgrade_settings": {"key": "upgradeSettings", "type": "AgentPoolUpgradeSettings"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "power_state": {"key": "powerState", "type": "PowerState"}, + "availability_zones": {"key": "availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "enableNodePublicIP", "type": "bool"}, + "node_public_ip_prefix_id": {"key": "nodePublicIPPrefixID", "type": "str"}, + "scale_set_priority": {"key": "scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "scaleSetEvictionPolicy", "type": "str"}, + "spot_max_price": {"key": "spotMaxPrice", "type": "float"}, + "tags": {"key": "tags", "type": "{str}"}, + "node_labels": {"key": "nodeLabels", "type": "{str}"}, + "node_taints": {"key": "nodeTaints", "type": "[str]"}, + "proximity_placement_group_id": {"key": "proximityPlacementGroupID", "type": "str"}, + "kubelet_config": {"key": "kubeletConfig", "type": "KubeletConfig"}, + "linux_os_config": {"key": "linuxOSConfig", "type": "LinuxOSConfig"}, + "enable_encryption_at_host": {"key": "enableEncryptionAtHost", "type": "bool"}, + "enable_ultra_ssd": {"key": "enableUltraSSD", "type": "bool"}, + "enable_fips": {"key": "enableFIPS", "type": "bool"}, + "gpu_instance_profile": {"key": "gpuInstanceProfile", "type": "str"}, + "creation_data": {"key": "creationData", "type": "CreationData"}, + "capacity_reservation_group_id": {"key": "capacityReservationGroupID", "type": "str"}, + "host_group_id": {"key": "hostGroupID", "type": "str"}, + "name": {"key": "name", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, name: str, @@ -3175,7 +3099,7 @@ def __init__( vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, @@ -3189,9 +3113,9 @@ def __init__( availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", - spot_max_price: Optional[float] = -1, + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", + spot_max_price: float = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, @@ -3224,15 +3148,15 @@ def __init__( larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.OSDiskType :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime - data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + data root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.KubeletDiskType :keyword workload_runtime: Determines the type of workload a node can run. Known values are: - "OCIContainer", "WasmWasi". + "OCIContainer" and "WasmWasi". :paramtype workload_runtime: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.WorkloadRuntime :keyword message_of_the_day: A base64-encoded string which will be written to /etc/motd after @@ -3251,11 +3175,11 @@ def __init__( :paramtype pod_subnet_id: str :keyword max_pods: The maximum number of pods that can run on a node. :paramtype max_pods: int - :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.OSType :keyword os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Known values are: "Ubuntu", "CBLMariner". + Known values are: "Ubuntu" and "CBLMariner". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.OSSKU :keyword max_count: The maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -3264,15 +3188,15 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, - it defaults to Delete. Known values are: "Delete", "Deallocate". + it defaults to Delete. Known values are: "Delete" and "Deallocate". :paramtype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.ScaleDownMode - :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", + :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.AgentPoolType :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.AgentPoolMode :keyword orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -3303,20 +3227,18 @@ def __init__( /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the - default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + default is 'Regular'. Known values are: "Spot" and "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.ScaleSetPriority :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.ScaleSetEvictionPolicy :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :paramtype spot_max_price: float - :keyword tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :keyword tags: The tags to be persisted on the agent pool virtual machine scale set. :paramtype tags: dict[str, str] :keyword node_labels: The node labels to be persisted across all nodes in agent pool. :paramtype node_labels: dict[str, str] @@ -3342,7 +3264,7 @@ def __init__( for more details. :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance - profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.GPUInstanceProfile @@ -3357,14 +3279,56 @@ def __init__( For more information see `Azure dedicated hosts `_. :paramtype host_group_id: str - :keyword name: Required. Windows agent pool names must be 6 characters or less. + :keyword name: Windows agent pool names must be 6 characters or less. Required. :paramtype name: str """ - super(ManagedClusterAgentPoolProfile, self).__init__(count=count, vm_size=vm_size, os_disk_size_gb=os_disk_size_gb, os_disk_type=os_disk_type, kubelet_disk_type=kubelet_disk_type, workload_runtime=workload_runtime, message_of_the_day=message_of_the_day, vnet_subnet_id=vnet_subnet_id, pod_subnet_id=pod_subnet_id, max_pods=max_pods, os_type=os_type, os_sku=os_sku, max_count=max_count, min_count=min_count, enable_auto_scaling=enable_auto_scaling, scale_down_mode=scale_down_mode, type=type, mode=mode, orchestrator_version=orchestrator_version, upgrade_settings=upgrade_settings, power_state=power_state, availability_zones=availability_zones, enable_node_public_ip=enable_node_public_ip, node_public_ip_prefix_id=node_public_ip_prefix_id, scale_set_priority=scale_set_priority, scale_set_eviction_policy=scale_set_eviction_policy, spot_max_price=spot_max_price, tags=tags, node_labels=node_labels, node_taints=node_taints, proximity_placement_group_id=proximity_placement_group_id, kubelet_config=kubelet_config, linux_os_config=linux_os_config, enable_encryption_at_host=enable_encryption_at_host, enable_ultra_ssd=enable_ultra_ssd, enable_fips=enable_fips, gpu_instance_profile=gpu_instance_profile, creation_data=creation_data, capacity_reservation_group_id=capacity_reservation_group_id, host_group_id=host_group_id, **kwargs) + super().__init__( + count=count, + vm_size=vm_size, + os_disk_size_gb=os_disk_size_gb, + os_disk_type=os_disk_type, + kubelet_disk_type=kubelet_disk_type, + workload_runtime=workload_runtime, + message_of_the_day=message_of_the_day, + vnet_subnet_id=vnet_subnet_id, + pod_subnet_id=pod_subnet_id, + max_pods=max_pods, + os_type=os_type, + os_sku=os_sku, + max_count=max_count, + min_count=min_count, + enable_auto_scaling=enable_auto_scaling, + scale_down_mode=scale_down_mode, + type=type, + mode=mode, + orchestrator_version=orchestrator_version, + upgrade_settings=upgrade_settings, + power_state=power_state, + availability_zones=availability_zones, + enable_node_public_ip=enable_node_public_ip, + node_public_ip_prefix_id=node_public_ip_prefix_id, + scale_set_priority=scale_set_priority, + scale_set_eviction_policy=scale_set_eviction_policy, + spot_max_price=spot_max_price, + tags=tags, + node_labels=node_labels, + node_taints=node_taints, + proximity_placement_group_id=proximity_placement_group_id, + kubelet_config=kubelet_config, + linux_os_config=linux_os_config, + enable_encryption_at_host=enable_encryption_at_host, + enable_ultra_ssd=enable_ultra_ssd, + enable_fips=enable_fips, + gpu_instance_profile=gpu_instance_profile, + creation_data=creation_data, + capacity_reservation_group_id=capacity_reservation_group_id, + host_group_id=host_group_id, + **kwargs + ) self.name = name -class ManagedClusterAPIServerAccessProfile(msrest.serialization.Model): +class ManagedClusterAPIServerAccessProfile(_serialization.Model): """Access profile for managed cluster API server. :ivar authorized_ip_ranges: IP ranges are specified in CIDR format, e.g. 137.117.106.88/29. @@ -3387,11 +3351,11 @@ class ManagedClusterAPIServerAccessProfile(msrest.serialization.Model): """ _attribute_map = { - 'authorized_ip_ranges': {'key': 'authorizedIPRanges', 'type': '[str]'}, - 'enable_private_cluster': {'key': 'enablePrivateCluster', 'type': 'bool'}, - 'private_dns_zone': {'key': 'privateDNSZone', 'type': 'str'}, - 'enable_private_cluster_public_fqdn': {'key': 'enablePrivateClusterPublicFQDN', 'type': 'bool'}, - 'disable_run_command': {'key': 'disableRunCommand', 'type': 'bool'}, + "authorized_ip_ranges": {"key": "authorizedIPRanges", "type": "[str]"}, + "enable_private_cluster": {"key": "enablePrivateCluster", "type": "bool"}, + "private_dns_zone": {"key": "privateDNSZone", "type": "str"}, + "enable_private_cluster_public_fqdn": {"key": "enablePrivateClusterPublicFQDN", "type": "bool"}, + "disable_run_command": {"key": "disableRunCommand", "type": "bool"}, } def __init__( @@ -3423,7 +3387,7 @@ def __init__( :keyword disable_run_command: Whether to disable run command for the cluster or not. :paramtype disable_run_command: bool """ - super(ManagedClusterAPIServerAccessProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.authorized_ip_ranges = authorized_ip_ranges self.enable_private_cluster = enable_private_cluster self.private_dns_zone = private_dns_zone @@ -3431,38 +3395,33 @@ def __init__( self.disable_run_command = disable_run_command -class ManagedClusterAutoUpgradeProfile(msrest.serialization.Model): +class ManagedClusterAutoUpgradeProfile(_serialization.Model): """Auto upgrade profile for a managed cluster. :ivar upgrade_channel: For more information see `setting the AKS cluster auto-upgrade channel `_. Known values - are: "rapid", "stable", "patch", "node-image", "none". + are: "rapid", "stable", "patch", "node-image", and "none". :vartype upgrade_channel: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.UpgradeChannel """ _attribute_map = { - 'upgrade_channel': {'key': 'upgradeChannel', 'type': 'str'}, + "upgrade_channel": {"key": "upgradeChannel", "type": "str"}, } - def __init__( - self, - *, - upgrade_channel: Optional[Union[str, "_models.UpgradeChannel"]] = None, - **kwargs - ): + def __init__(self, *, upgrade_channel: Optional[Union[str, "_models.UpgradeChannel"]] = None, **kwargs): """ :keyword upgrade_channel: For more information see `setting the AKS cluster auto-upgrade channel `_. - Known values are: "rapid", "stable", "patch", "node-image", "none". + Known values are: "rapid", "stable", "patch", "node-image", and "none". :paramtype upgrade_channel: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.UpgradeChannel """ - super(ManagedClusterAutoUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.upgrade_channel = upgrade_channel -class ManagedClusterHTTPProxyConfig(msrest.serialization.Model): +class ManagedClusterHTTPProxyConfig(_serialization.Model): """Cluster HTTP proxy configuration. :ivar http_proxy: The HTTP proxy server endpoint to use. @@ -3476,10 +3435,10 @@ class ManagedClusterHTTPProxyConfig(msrest.serialization.Model): """ _attribute_map = { - 'http_proxy': {'key': 'httpProxy', 'type': 'str'}, - 'https_proxy': {'key': 'httpsProxy', 'type': 'str'}, - 'no_proxy': {'key': 'noProxy', 'type': '[str]'}, - 'trusted_ca': {'key': 'trustedCa', 'type': 'str'}, + "http_proxy": {"key": "httpProxy", "type": "str"}, + "https_proxy": {"key": "httpsProxy", "type": "str"}, + "no_proxy": {"key": "noProxy", "type": "[str]"}, + "trusted_ca": {"key": "trustedCa", "type": "str"}, } def __init__( @@ -3501,14 +3460,14 @@ def __init__( :keyword trusted_ca: Alternative CA cert to use for connecting to proxy servers. :paramtype trusted_ca: str """ - super(ManagedClusterHTTPProxyConfig, self).__init__(**kwargs) + super().__init__(**kwargs) self.http_proxy = http_proxy self.https_proxy = https_proxy self.no_proxy = no_proxy self.trusted_ca = trusted_ca -class ManagedClusterIdentity(msrest.serialization.Model): +class ManagedClusterIdentity(_serialization.Model): """Identity for the managed cluster. Variables are only populated by the server, and will be ignored when sending a request. @@ -3521,7 +3480,7 @@ class ManagedClusterIdentity(msrest.serialization.Model): :vartype tenant_id: str :ivar type: For more information see `use managed identities in AKS `_. Known values are: - "SystemAssigned", "UserAssigned", "None". + "SystemAssigned", "UserAssigned", and "None". :vartype type: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.ResourceIdentityType :ivar user_assigned_identities: The keys must be ARM resource IDs in the form: @@ -3531,28 +3490,33 @@ class ManagedClusterIdentity(msrest.serialization.Model): """ _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, + "principal_id": {"readonly": True}, + "tenant_id": {"readonly": True}, } _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{ManagedServiceIdentityUserAssignedIdentitiesValue}'}, + "principal_id": {"key": "principalId", "type": "str"}, + "tenant_id": {"key": "tenantId", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "user_assigned_identities": { + "key": "userAssignedIdentities", + "type": "{ManagedServiceIdentityUserAssignedIdentitiesValue}", + }, } def __init__( self, *, type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, - user_assigned_identities: Optional[Dict[str, "_models.ManagedServiceIdentityUserAssignedIdentitiesValue"]] = None, + user_assigned_identities: Optional[ + Dict[str, "_models.ManagedServiceIdentityUserAssignedIdentitiesValue"] + ] = None, **kwargs ): """ :keyword type: For more information see `use managed identities in AKS `_. Known values are: - "SystemAssigned", "UserAssigned", "None". + "SystemAssigned", "UserAssigned", and "None". :paramtype type: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.ResourceIdentityType :keyword user_assigned_identities: The keys must be ARM resource IDs in the form: @@ -3560,14 +3524,14 @@ def __init__( :paramtype user_assigned_identities: dict[str, ~azure.mgmt.containerservice.v2022_01_02_preview.models.ManagedServiceIdentityUserAssignedIdentitiesValue] """ - super(ManagedClusterIdentity, self).__init__(**kwargs) + super().__init__(**kwargs) self.principal_id = None self.tenant_id = None self.type = type self.user_assigned_identities = user_assigned_identities -class ManagedClusterListResult(msrest.serialization.Model): +class ManagedClusterListResult(_serialization.Model): """The response from the List Managed Clusters operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -3579,30 +3543,25 @@ class ManagedClusterListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[ManagedCluster]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[ManagedCluster]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.ManagedCluster"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.ManagedCluster"]] = None, **kwargs): """ :keyword value: The list of managed clusters. :paramtype value: list[~azure.mgmt.containerservice.v2022_01_02_preview.models.ManagedCluster] """ - super(ManagedClusterListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class ManagedClusterLoadBalancerProfile(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfile(_serialization.Model): """Profile of the managed cluster load balancer. :ivar managed_outbound_i_ps: Desired managed outbound IPs for the cluster load balancer. @@ -3631,18 +3590,24 @@ class ManagedClusterLoadBalancerProfile(msrest.serialization.Model): """ _validation = { - 'allocated_outbound_ports': {'maximum': 64000, 'minimum': 0}, - 'idle_timeout_in_minutes': {'maximum': 120, 'minimum': 4}, + "allocated_outbound_ports": {"maximum": 64000, "minimum": 0}, + "idle_timeout_in_minutes": {"maximum": 120, "minimum": 4}, } _attribute_map = { - 'managed_outbound_i_ps': {'key': 'managedOutboundIPs', 'type': 'ManagedClusterLoadBalancerProfileManagedOutboundIPs'}, - 'outbound_ip_prefixes': {'key': 'outboundIPPrefixes', 'type': 'ManagedClusterLoadBalancerProfileOutboundIPPrefixes'}, - 'outbound_i_ps': {'key': 'outboundIPs', 'type': 'ManagedClusterLoadBalancerProfileOutboundIPs'}, - 'effective_outbound_i_ps': {'key': 'effectiveOutboundIPs', 'type': '[ResourceReference]'}, - 'allocated_outbound_ports': {'key': 'allocatedOutboundPorts', 'type': 'int'}, - 'idle_timeout_in_minutes': {'key': 'idleTimeoutInMinutes', 'type': 'int'}, - 'enable_multiple_standard_load_balancers': {'key': 'enableMultipleStandardLoadBalancers', 'type': 'bool'}, + "managed_outbound_i_ps": { + "key": "managedOutboundIPs", + "type": "ManagedClusterLoadBalancerProfileManagedOutboundIPs", + }, + "outbound_ip_prefixes": { + "key": "outboundIPPrefixes", + "type": "ManagedClusterLoadBalancerProfileOutboundIPPrefixes", + }, + "outbound_i_ps": {"key": "outboundIPs", "type": "ManagedClusterLoadBalancerProfileOutboundIPs"}, + "effective_outbound_i_ps": {"key": "effectiveOutboundIPs", "type": "[ResourceReference]"}, + "allocated_outbound_ports": {"key": "allocatedOutboundPorts", "type": "int"}, + "idle_timeout_in_minutes": {"key": "idleTimeoutInMinutes", "type": "int"}, + "enable_multiple_standard_load_balancers": {"key": "enableMultipleStandardLoadBalancers", "type": "bool"}, } def __init__( @@ -3652,8 +3617,8 @@ def __init__( outbound_ip_prefixes: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPPrefixes"] = None, outbound_i_ps: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPs"] = None, effective_outbound_i_ps: Optional[List["_models.ResourceReference"]] = None, - allocated_outbound_ports: Optional[int] = 0, - idle_timeout_in_minutes: Optional[int] = 30, + allocated_outbound_ports: int = 0, + idle_timeout_in_minutes: int = 30, enable_multiple_standard_load_balancers: Optional[bool] = None, **kwargs ): @@ -3683,7 +3648,7 @@ def __init__( AKS cluster or not. :paramtype enable_multiple_standard_load_balancers: bool """ - super(ManagedClusterLoadBalancerProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.managed_outbound_i_ps = managed_outbound_i_ps self.outbound_ip_prefixes = outbound_ip_prefixes self.outbound_i_ps = outbound_i_ps @@ -3693,7 +3658,7 @@ def __init__( self.enable_multiple_standard_load_balancers = enable_multiple_standard_load_balancers -class ManagedClusterLoadBalancerProfileManagedOutboundIPs(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfileManagedOutboundIPs(_serialization.Model): """Desired managed outbound IPs for the cluster load balancer. :ivar count: The desired number of IPv4 outbound IPs created/managed by Azure for the cluster @@ -3707,22 +3672,16 @@ class ManagedClusterLoadBalancerProfileManagedOutboundIPs(msrest.serialization.M """ _validation = { - 'count': {'maximum': 100, 'minimum': 1}, - 'count_ipv6': {'maximum': 100, 'minimum': 0}, + "count": {"maximum": 100, "minimum": 1}, + "count_ipv6": {"maximum": 100, "minimum": 0}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'count_ipv6': {'key': 'countIPv6', 'type': 'int'}, + "count": {"key": "count", "type": "int"}, + "count_ipv6": {"key": "countIPv6", "type": "int"}, } - def __init__( - self, - *, - count: Optional[int] = 1, - count_ipv6: Optional[int] = 0, - **kwargs - ): + def __init__(self, *, count: int = 1, count_ipv6: int = 0, **kwargs): """ :keyword count: The desired number of IPv4 outbound IPs created/managed by Azure for the cluster load balancer. Allowed values must be in the range of 1 to 100 (inclusive). The default @@ -3733,12 +3692,12 @@ def __init__( value is 0 for single-stack and 1 for dual-stack. :paramtype count_ipv6: int """ - super(ManagedClusterLoadBalancerProfileManagedOutboundIPs, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.count_ipv6 = count_ipv6 -class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(_serialization.Model): """Desired outbound IP Prefix resources for the cluster load balancer. :ivar public_ip_prefixes: A list of public IP prefix resources. @@ -3747,25 +3706,20 @@ class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(msrest.serialization.M """ _attribute_map = { - 'public_ip_prefixes': {'key': 'publicIPPrefixes', 'type': '[ResourceReference]'}, + "public_ip_prefixes": {"key": "publicIPPrefixes", "type": "[ResourceReference]"}, } - def __init__( - self, - *, - public_ip_prefixes: Optional[List["_models.ResourceReference"]] = None, - **kwargs - ): + def __init__(self, *, public_ip_prefixes: Optional[List["_models.ResourceReference"]] = None, **kwargs): """ :keyword public_ip_prefixes: A list of public IP prefix resources. :paramtype public_ip_prefixes: list[~azure.mgmt.containerservice.v2022_01_02_preview.models.ResourceReference] """ - super(ManagedClusterLoadBalancerProfileOutboundIPPrefixes, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_ip_prefixes = public_ip_prefixes -class ManagedClusterLoadBalancerProfileOutboundIPs(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfileOutboundIPs(_serialization.Model): """Desired outbound IP resources for the cluster load balancer. :ivar public_i_ps: A list of public IP resources. @@ -3774,25 +3728,20 @@ class ManagedClusterLoadBalancerProfileOutboundIPs(msrest.serialization.Model): """ _attribute_map = { - 'public_i_ps': {'key': 'publicIPs', 'type': '[ResourceReference]'}, + "public_i_ps": {"key": "publicIPs", "type": "[ResourceReference]"}, } - def __init__( - self, - *, - public_i_ps: Optional[List["_models.ResourceReference"]] = None, - **kwargs - ): + def __init__(self, *, public_i_ps: Optional[List["_models.ResourceReference"]] = None, **kwargs): """ :keyword public_i_ps: A list of public IP resources. :paramtype public_i_ps: list[~azure.mgmt.containerservice.v2022_01_02_preview.models.ResourceReference] """ - super(ManagedClusterLoadBalancerProfileOutboundIPs, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_i_ps = public_i_ps -class ManagedClusterManagedOutboundIPProfile(msrest.serialization.Model): +class ManagedClusterManagedOutboundIPProfile(_serialization.Model): """Profile of the managed outbound IP resources of the managed cluster. :ivar count: The desired number of outbound IPs created/managed by Azure. Allowed values must @@ -3801,29 +3750,24 @@ class ManagedClusterManagedOutboundIPProfile(msrest.serialization.Model): """ _validation = { - 'count': {'maximum': 16, 'minimum': 1}, + "count": {"maximum": 16, "minimum": 1}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, + "count": {"key": "count", "type": "int"}, } - def __init__( - self, - *, - count: Optional[int] = 1, - **kwargs - ): + def __init__(self, *, count: int = 1, **kwargs): """ :keyword count: The desired number of outbound IPs created/managed by Azure. Allowed values must be in the range of 1 to 16 (inclusive). The default value is 1. :paramtype count: int """ - super(ManagedClusterManagedOutboundIPProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count -class ManagedClusterNATGatewayProfile(msrest.serialization.Model): +class ManagedClusterNATGatewayProfile(_serialization.Model): """Profile of the managed cluster NAT gateway. :ivar managed_outbound_ip_profile: Profile of the managed outbound IP resources of the cluster @@ -3839,13 +3783,16 @@ class ManagedClusterNATGatewayProfile(msrest.serialization.Model): """ _validation = { - 'idle_timeout_in_minutes': {'maximum': 120, 'minimum': 4}, + "idle_timeout_in_minutes": {"maximum": 120, "minimum": 4}, } _attribute_map = { - 'managed_outbound_ip_profile': {'key': 'managedOutboundIPProfile', 'type': 'ManagedClusterManagedOutboundIPProfile'}, - 'effective_outbound_i_ps': {'key': 'effectiveOutboundIPs', 'type': '[ResourceReference]'}, - 'idle_timeout_in_minutes': {'key': 'idleTimeoutInMinutes', 'type': 'int'}, + "managed_outbound_ip_profile": { + "key": "managedOutboundIPProfile", + "type": "ManagedClusterManagedOutboundIPProfile", + }, + "effective_outbound_i_ps": {"key": "effectiveOutboundIPs", "type": "[ResourceReference]"}, + "idle_timeout_in_minutes": {"key": "idleTimeoutInMinutes", "type": "int"}, } def __init__( @@ -3853,7 +3800,7 @@ def __init__( *, managed_outbound_ip_profile: Optional["_models.ManagedClusterManagedOutboundIPProfile"] = None, effective_outbound_i_ps: Optional[List["_models.ResourceReference"]] = None, - idle_timeout_in_minutes: Optional[int] = 4, + idle_timeout_in_minutes: int = 4, **kwargs ): """ @@ -3869,13 +3816,13 @@ def __init__( are in the range of 4 to 120 (inclusive). The default value is 4 minutes. :paramtype idle_timeout_in_minutes: int """ - super(ManagedClusterNATGatewayProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.managed_outbound_ip_profile = managed_outbound_ip_profile self.effective_outbound_i_ps = effective_outbound_i_ps self.idle_timeout_in_minutes = idle_timeout_in_minutes -class ManagedClusterOIDCIssuerProfile(msrest.serialization.Model): +class ManagedClusterOIDCIssuerProfile(_serialization.Model): """The OIDC issuer profile of the Managed Cluster. Variables are only populated by the server, and will be ignored when sending a request. @@ -3887,46 +3834,41 @@ class ManagedClusterOIDCIssuerProfile(msrest.serialization.Model): """ _validation = { - 'issuer_url': {'readonly': True}, + "issuer_url": {"readonly": True}, } _attribute_map = { - 'issuer_url': {'key': 'issuerURL', 'type': 'str'}, - 'enabled': {'key': 'enabled', 'type': 'bool'}, + "issuer_url": {"key": "issuerURL", "type": "str"}, + "enabled": {"key": "enabled", "type": "bool"}, } - def __init__( - self, - *, - enabled: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, enabled: Optional[bool] = None, **kwargs): """ :keyword enabled: Whether the OIDC issuer is enabled. :paramtype enabled: bool """ - super(ManagedClusterOIDCIssuerProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.issuer_url = None self.enabled = enabled -class ManagedClusterPodIdentity(msrest.serialization.Model): +class ManagedClusterPodIdentity(_serialization.Model): """Details about the pod identity assigned to the Managed Cluster. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar name: Required. The name of the pod identity. + :ivar name: The name of the pod identity. Required. :vartype name: str - :ivar namespace: Required. The namespace of the pod identity. + :ivar namespace: The namespace of the pod identity. Required. :vartype namespace: str :ivar binding_selector: The binding selector to use for the AzureIdentityBinding resource. :vartype binding_selector: str - :ivar identity: Required. The user assigned identity details. + :ivar identity: The user assigned identity details. Required. :vartype identity: ~azure.mgmt.containerservice.v2022_01_02_preview.models.UserAssignedIdentity :ivar provisioning_state: The current provisioning state of the pod identity. Known values are: - "Assigned", "Updating", "Deleting", "Failed". + "Assigned", "Updating", "Deleting", and "Failed". :vartype provisioning_state: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.ManagedClusterPodIdentityProvisioningState :ivar provisioning_info: @@ -3935,20 +3877,20 @@ class ManagedClusterPodIdentity(msrest.serialization.Model): """ _validation = { - 'name': {'required': True}, - 'namespace': {'required': True}, - 'identity': {'required': True}, - 'provisioning_state': {'readonly': True}, - 'provisioning_info': {'readonly': True}, + "name": {"required": True}, + "namespace": {"required": True}, + "identity": {"required": True}, + "provisioning_state": {"readonly": True}, + "provisioning_info": {"readonly": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'namespace': {'key': 'namespace', 'type': 'str'}, - 'binding_selector': {'key': 'bindingSelector', 'type': 'str'}, - 'identity': {'key': 'identity', 'type': 'UserAssignedIdentity'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'provisioning_info': {'key': 'provisioningInfo', 'type': 'ManagedClusterPodIdentityProvisioningInfo'}, + "name": {"key": "name", "type": "str"}, + "namespace": {"key": "namespace", "type": "str"}, + "binding_selector": {"key": "bindingSelector", "type": "str"}, + "identity": {"key": "identity", "type": "UserAssignedIdentity"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "provisioning_info": {"key": "provisioningInfo", "type": "ManagedClusterPodIdentityProvisioningInfo"}, } def __init__( @@ -3961,17 +3903,17 @@ def __init__( **kwargs ): """ - :keyword name: Required. The name of the pod identity. + :keyword name: The name of the pod identity. Required. :paramtype name: str - :keyword namespace: Required. The namespace of the pod identity. + :keyword namespace: The namespace of the pod identity. Required. :paramtype namespace: str :keyword binding_selector: The binding selector to use for the AzureIdentityBinding resource. :paramtype binding_selector: str - :keyword identity: Required. The user assigned identity details. + :keyword identity: The user assigned identity details. Required. :paramtype identity: ~azure.mgmt.containerservice.v2022_01_02_preview.models.UserAssignedIdentity """ - super(ManagedClusterPodIdentity, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.namespace = namespace self.binding_selector = binding_selector @@ -3980,54 +3922,47 @@ def __init__( self.provisioning_info = None -class ManagedClusterPodIdentityException(msrest.serialization.Model): +class ManagedClusterPodIdentityException(_serialization.Model): """See `disable AAD Pod Identity for a specific Pod/Application `_ for more details. All required parameters must be populated in order to send to Azure. - :ivar name: Required. The name of the pod identity exception. + :ivar name: The name of the pod identity exception. Required. :vartype name: str - :ivar namespace: Required. The namespace of the pod identity exception. + :ivar namespace: The namespace of the pod identity exception. Required. :vartype namespace: str - :ivar pod_labels: Required. The pod labels to match. + :ivar pod_labels: The pod labels to match. Required. :vartype pod_labels: dict[str, str] """ _validation = { - 'name': {'required': True}, - 'namespace': {'required': True}, - 'pod_labels': {'required': True}, + "name": {"required": True}, + "namespace": {"required": True}, + "pod_labels": {"required": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'namespace': {'key': 'namespace', 'type': 'str'}, - 'pod_labels': {'key': 'podLabels', 'type': '{str}'}, + "name": {"key": "name", "type": "str"}, + "namespace": {"key": "namespace", "type": "str"}, + "pod_labels": {"key": "podLabels", "type": "{str}"}, } - def __init__( - self, - *, - name: str, - namespace: str, - pod_labels: Dict[str, str], - **kwargs - ): + def __init__(self, *, name: str, namespace: str, pod_labels: Dict[str, str], **kwargs): """ - :keyword name: Required. The name of the pod identity exception. + :keyword name: The name of the pod identity exception. Required. :paramtype name: str - :keyword namespace: Required. The namespace of the pod identity exception. + :keyword namespace: The namespace of the pod identity exception. Required. :paramtype namespace: str - :keyword pod_labels: Required. The pod labels to match. + :keyword pod_labels: The pod labels to match. Required. :paramtype pod_labels: dict[str, str] """ - super(ManagedClusterPodIdentityException, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.namespace = namespace self.pod_labels = pod_labels -class ManagedClusterPodIdentityProfile(msrest.serialization.Model): +class ManagedClusterPodIdentityProfile(_serialization.Model): """See `use AAD pod identity `_ for more details on pod identity integration. :ivar enabled: Whether the pod identity addon is enabled. @@ -4047,10 +3982,13 @@ class ManagedClusterPodIdentityProfile(msrest.serialization.Model): """ _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'allow_network_plugin_kubenet': {'key': 'allowNetworkPluginKubenet', 'type': 'bool'}, - 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '[ManagedClusterPodIdentity]'}, - 'user_assigned_identity_exceptions': {'key': 'userAssignedIdentityExceptions', 'type': '[ManagedClusterPodIdentityException]'}, + "enabled": {"key": "enabled", "type": "bool"}, + "allow_network_plugin_kubenet": {"key": "allowNetworkPluginKubenet", "type": "bool"}, + "user_assigned_identities": {"key": "userAssignedIdentities", "type": "[ManagedClusterPodIdentity]"}, + "user_assigned_identity_exceptions": { + "key": "userAssignedIdentityExceptions", + "type": "[ManagedClusterPodIdentityException]", + }, } def __init__( @@ -4078,14 +4016,14 @@ def __init__( :paramtype user_assigned_identity_exceptions: list[~azure.mgmt.containerservice.v2022_01_02_preview.models.ManagedClusterPodIdentityException] """ - super(ManagedClusterPodIdentityProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.allow_network_plugin_kubenet = allow_network_plugin_kubenet self.user_assigned_identities = user_assigned_identities self.user_assigned_identity_exceptions = user_assigned_identity_exceptions -class ManagedClusterPodIdentityProvisioningError(msrest.serialization.Model): +class ManagedClusterPodIdentityProvisioningError(_serialization.Model): """An error response from the pod identity provisioning. :ivar error: Details about the error. @@ -4094,25 +4032,20 @@ class ManagedClusterPodIdentityProvisioningError(msrest.serialization.Model): """ _attribute_map = { - 'error': {'key': 'error', 'type': 'ManagedClusterPodIdentityProvisioningErrorBody'}, + "error": {"key": "error", "type": "ManagedClusterPodIdentityProvisioningErrorBody"}, } - def __init__( - self, - *, - error: Optional["_models.ManagedClusterPodIdentityProvisioningErrorBody"] = None, - **kwargs - ): + def __init__(self, *, error: Optional["_models.ManagedClusterPodIdentityProvisioningErrorBody"] = None, **kwargs): """ :keyword error: Details about the error. :paramtype error: ~azure.mgmt.containerservice.v2022_01_02_preview.models.ManagedClusterPodIdentityProvisioningErrorBody """ - super(ManagedClusterPodIdentityProvisioningError, self).__init__(**kwargs) + super().__init__(**kwargs) self.error = error -class ManagedClusterPodIdentityProvisioningErrorBody(msrest.serialization.Model): +class ManagedClusterPodIdentityProvisioningErrorBody(_serialization.Model): """An error response from the pod identity provisioning. :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed @@ -4130,10 +4063,10 @@ class ManagedClusterPodIdentityProvisioningErrorBody(msrest.serialization.Model) """ _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[ManagedClusterPodIdentityProvisioningErrorBody]'}, + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[ManagedClusterPodIdentityProvisioningErrorBody]"}, } def __init__( @@ -4159,14 +4092,14 @@ def __init__( :paramtype details: list[~azure.mgmt.containerservice.v2022_01_02_preview.models.ManagedClusterPodIdentityProvisioningErrorBody] """ - super(ManagedClusterPodIdentityProvisioningErrorBody, self).__init__(**kwargs) + super().__init__(**kwargs) self.code = code self.message = message self.target = target self.details = details -class ManagedClusterPodIdentityProvisioningInfo(msrest.serialization.Model): +class ManagedClusterPodIdentityProvisioningInfo(_serialization.Model): """ManagedClusterPodIdentityProvisioningInfo. :ivar error: Pod identity assignment error (if any). @@ -4175,35 +4108,30 @@ class ManagedClusterPodIdentityProvisioningInfo(msrest.serialization.Model): """ _attribute_map = { - 'error': {'key': 'error', 'type': 'ManagedClusterPodIdentityProvisioningError'}, + "error": {"key": "error", "type": "ManagedClusterPodIdentityProvisioningError"}, } - def __init__( - self, - *, - error: Optional["_models.ManagedClusterPodIdentityProvisioningError"] = None, - **kwargs - ): + def __init__(self, *, error: Optional["_models.ManagedClusterPodIdentityProvisioningError"] = None, **kwargs): """ :keyword error: Pod identity assignment error (if any). :paramtype error: ~azure.mgmt.containerservice.v2022_01_02_preview.models.ManagedClusterPodIdentityProvisioningError """ - super(ManagedClusterPodIdentityProvisioningInfo, self).__init__(**kwargs) + super().__init__(**kwargs) self.error = error -class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): +class ManagedClusterPoolUpgradeProfile(_serialization.Model): """The list of available upgrade versions. All required parameters must be populated in order to send to Azure. - :ivar kubernetes_version: Required. The Kubernetes version (major.minor.patch). + :ivar kubernetes_version: The Kubernetes version (major.minor.patch). Required. :vartype kubernetes_version: str :ivar name: The Agent Pool name. :vartype name: str - :ivar os_type: Required. The operating system type. The default is Linux. Known values are: - "Linux", "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -4211,15 +4139,15 @@ class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): """ _validation = { - 'kubernetes_version': {'required': True}, - 'os_type': {'required': True}, + "kubernetes_version": {"required": True}, + "os_type": {"required": True}, } _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'upgrades': {'key': 'upgrades', 'type': '[ManagedClusterPoolUpgradeProfileUpgradesItem]'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "os_type": {"key": "osType", "type": "str"}, + "upgrades": {"key": "upgrades", "type": "[ManagedClusterPoolUpgradeProfileUpgradesItem]"}, } def __init__( @@ -4232,25 +4160,25 @@ def __init__( **kwargs ): """ - :keyword kubernetes_version: Required. The Kubernetes version (major.minor.patch). + :keyword kubernetes_version: The Kubernetes version (major.minor.patch). Required. :paramtype kubernetes_version: str :keyword name: The Agent Pool name. :paramtype name: str - :keyword os_type: Required. The operating system type. The default is Linux. Known values are: - "Linux", "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: list[~azure.mgmt.containerservice.v2022_01_02_preview.models.ManagedClusterPoolUpgradeProfileUpgradesItem] """ - super(ManagedClusterPoolUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.name = name self.os_type = os_type self.upgrades = upgrades -class ManagedClusterPoolUpgradeProfileUpgradesItem(msrest.serialization.Model): +class ManagedClusterPoolUpgradeProfileUpgradesItem(_serialization.Model): """ManagedClusterPoolUpgradeProfileUpgradesItem. :ivar kubernetes_version: The Kubernetes version (major.minor.patch). @@ -4260,36 +4188,30 @@ class ManagedClusterPoolUpgradeProfileUpgradesItem(msrest.serialization.Model): """ _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } - def __init__( - self, - *, - kubernetes_version: Optional[str] = None, - is_preview: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, kubernetes_version: Optional[str] = None, is_preview: Optional[bool] = None, **kwargs): """ :keyword kubernetes_version: The Kubernetes version (major.minor.patch). :paramtype kubernetes_version: str :keyword is_preview: Whether the Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(ManagedClusterPoolUpgradeProfileUpgradesItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.is_preview = is_preview -class ManagedClusterPropertiesAutoScalerProfile(msrest.serialization.Model): +class ManagedClusterPropertiesAutoScalerProfile(_serialization.Model): # pylint: disable=too-many-instance-attributes """Parameters to be applied to the cluster-autoscaler when enabled. :ivar balance_similar_node_groups: Valid values are 'true' and 'false'. :vartype balance_similar_node_groups: str :ivar expander: If not specified, the default is 'random'. See `expanders `_ - for more information. Known values are: "least-waste", "most-pods", "priority", "random". + for more information. Known values are: "least-waste", "most-pods", "priority", and "random". :vartype expander: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.Expander :ivar max_empty_bulk_delete: The default is 10. :vartype max_empty_bulk_delete: str @@ -4333,23 +4255,23 @@ class ManagedClusterPropertiesAutoScalerProfile(msrest.serialization.Model): """ _attribute_map = { - 'balance_similar_node_groups': {'key': 'balance-similar-node-groups', 'type': 'str'}, - 'expander': {'key': 'expander', 'type': 'str'}, - 'max_empty_bulk_delete': {'key': 'max-empty-bulk-delete', 'type': 'str'}, - 'max_graceful_termination_sec': {'key': 'max-graceful-termination-sec', 'type': 'str'}, - 'max_node_provision_time': {'key': 'max-node-provision-time', 'type': 'str'}, - 'max_total_unready_percentage': {'key': 'max-total-unready-percentage', 'type': 'str'}, - 'new_pod_scale_up_delay': {'key': 'new-pod-scale-up-delay', 'type': 'str'}, - 'ok_total_unready_count': {'key': 'ok-total-unready-count', 'type': 'str'}, - 'scan_interval': {'key': 'scan-interval', 'type': 'str'}, - 'scale_down_delay_after_add': {'key': 'scale-down-delay-after-add', 'type': 'str'}, - 'scale_down_delay_after_delete': {'key': 'scale-down-delay-after-delete', 'type': 'str'}, - 'scale_down_delay_after_failure': {'key': 'scale-down-delay-after-failure', 'type': 'str'}, - 'scale_down_unneeded_time': {'key': 'scale-down-unneeded-time', 'type': 'str'}, - 'scale_down_unready_time': {'key': 'scale-down-unready-time', 'type': 'str'}, - 'scale_down_utilization_threshold': {'key': 'scale-down-utilization-threshold', 'type': 'str'}, - 'skip_nodes_with_local_storage': {'key': 'skip-nodes-with-local-storage', 'type': 'str'}, - 'skip_nodes_with_system_pods': {'key': 'skip-nodes-with-system-pods', 'type': 'str'}, + "balance_similar_node_groups": {"key": "balance-similar-node-groups", "type": "str"}, + "expander": {"key": "expander", "type": "str"}, + "max_empty_bulk_delete": {"key": "max-empty-bulk-delete", "type": "str"}, + "max_graceful_termination_sec": {"key": "max-graceful-termination-sec", "type": "str"}, + "max_node_provision_time": {"key": "max-node-provision-time", "type": "str"}, + "max_total_unready_percentage": {"key": "max-total-unready-percentage", "type": "str"}, + "new_pod_scale_up_delay": {"key": "new-pod-scale-up-delay", "type": "str"}, + "ok_total_unready_count": {"key": "ok-total-unready-count", "type": "str"}, + "scan_interval": {"key": "scan-interval", "type": "str"}, + "scale_down_delay_after_add": {"key": "scale-down-delay-after-add", "type": "str"}, + "scale_down_delay_after_delete": {"key": "scale-down-delay-after-delete", "type": "str"}, + "scale_down_delay_after_failure": {"key": "scale-down-delay-after-failure", "type": "str"}, + "scale_down_unneeded_time": {"key": "scale-down-unneeded-time", "type": "str"}, + "scale_down_unready_time": {"key": "scale-down-unready-time", "type": "str"}, + "scale_down_utilization_threshold": {"key": "scale-down-utilization-threshold", "type": "str"}, + "skip_nodes_with_local_storage": {"key": "skip-nodes-with-local-storage", "type": "str"}, + "skip_nodes_with_system_pods": {"key": "skip-nodes-with-system-pods", "type": "str"}, } def __init__( @@ -4379,7 +4301,7 @@ def __init__( :paramtype balance_similar_node_groups: str :keyword expander: If not specified, the default is 'random'. See `expanders `_ - for more information. Known values are: "least-waste", "most-pods", "priority", "random". + for more information. Known values are: "least-waste", "most-pods", "priority", and "random". :paramtype expander: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.Expander :keyword max_empty_bulk_delete: The default is 10. :paramtype max_empty_bulk_delete: str @@ -4422,7 +4344,7 @@ def __init__( :keyword skip_nodes_with_system_pods: The default is true. :paramtype skip_nodes_with_system_pods: str """ - super(ManagedClusterPropertiesAutoScalerProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.balance_similar_node_groups = balance_similar_node_groups self.expander = expander self.max_empty_bulk_delete = max_empty_bulk_delete @@ -4442,7 +4364,7 @@ def __init__( self.skip_nodes_with_system_pods = skip_nodes_with_system_pods -class ManagedClusterSecurityProfile(msrest.serialization.Model): +class ManagedClusterSecurityProfile(_serialization.Model): """Security profile for the container service cluster. :ivar azure_defender: Azure Defender settings for the security profile. @@ -4451,25 +4373,22 @@ class ManagedClusterSecurityProfile(msrest.serialization.Model): """ _attribute_map = { - 'azure_defender': {'key': 'azureDefender', 'type': 'ManagedClusterSecurityProfileAzureDefender'}, + "azure_defender": {"key": "azureDefender", "type": "ManagedClusterSecurityProfileAzureDefender"}, } def __init__( - self, - *, - azure_defender: Optional["_models.ManagedClusterSecurityProfileAzureDefender"] = None, - **kwargs + self, *, azure_defender: Optional["_models.ManagedClusterSecurityProfileAzureDefender"] = None, **kwargs ): """ :keyword azure_defender: Azure Defender settings for the security profile. :paramtype azure_defender: ~azure.mgmt.containerservice.v2022_01_02_preview.models.ManagedClusterSecurityProfileAzureDefender """ - super(ManagedClusterSecurityProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.azure_defender = azure_defender -class ManagedClusterSecurityProfileAzureDefender(msrest.serialization.Model): +class ManagedClusterSecurityProfileAzureDefender(_serialization.Model): """Azure Defender settings for the security profile. :ivar enabled: Whether to enable Azure Defender. @@ -4481,16 +4400,12 @@ class ManagedClusterSecurityProfileAzureDefender(msrest.serialization.Model): """ _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'log_analytics_workspace_resource_id': {'key': 'logAnalyticsWorkspaceResourceId', 'type': 'str'}, + "enabled": {"key": "enabled", "type": "bool"}, + "log_analytics_workspace_resource_id": {"key": "logAnalyticsWorkspaceResourceId", "type": "str"}, } def __init__( - self, - *, - enabled: Optional[bool] = None, - log_analytics_workspace_resource_id: Optional[str] = None, - **kwargs + self, *, enabled: Optional[bool] = None, log_analytics_workspace_resource_id: Optional[str] = None, **kwargs ): """ :keyword enabled: Whether to enable Azure Defender. @@ -4500,65 +4415,59 @@ def __init__( must be a valid workspace resource ID. When Azure Defender is disabled, leave the field empty. :paramtype log_analytics_workspace_resource_id: str """ - super(ManagedClusterSecurityProfileAzureDefender, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.log_analytics_workspace_resource_id = log_analytics_workspace_resource_id -class ManagedClusterServicePrincipalProfile(msrest.serialization.Model): +class ManagedClusterServicePrincipalProfile(_serialization.Model): """Information about a service principal identity for the cluster to use for manipulating Azure APIs. All required parameters must be populated in order to send to Azure. - :ivar client_id: Required. The ID for the service principal. + :ivar client_id: The ID for the service principal. Required. :vartype client_id: str :ivar secret: The secret password associated with the service principal in plain text. :vartype secret: str """ _validation = { - 'client_id': {'required': True}, + "client_id": {"required": True}, } _attribute_map = { - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'secret': {'key': 'secret', 'type': 'str'}, + "client_id": {"key": "clientId", "type": "str"}, + "secret": {"key": "secret", "type": "str"}, } - def __init__( - self, - *, - client_id: str, - secret: Optional[str] = None, - **kwargs - ): + def __init__(self, *, client_id: str, secret: Optional[str] = None, **kwargs): """ - :keyword client_id: Required. The ID for the service principal. + :keyword client_id: The ID for the service principal. Required. :paramtype client_id: str :keyword secret: The secret password associated with the service principal in plain text. :paramtype secret: str """ - super(ManagedClusterServicePrincipalProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.client_id = client_id self.secret = secret -class ManagedClusterSKU(msrest.serialization.Model): +class ManagedClusterSKU(_serialization.Model): """The SKU of a Managed Cluster. - :ivar name: The name of a managed cluster SKU. Known values are: "Basic". + :ivar name: The name of a managed cluster SKU. "Basic" :vartype name: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.ManagedClusterSKUName :ivar tier: If not specified, the default is 'Free'. See `uptime SLA - `_ for more details. Known values are: "Paid", - "Free". + `_ for more details. Known values are: "Paid" + and "Free". :vartype tier: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.ManagedClusterSKUTier """ _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, + "name": {"key": "name", "type": "str"}, + "tier": {"key": "tier", "type": "str"}, } def __init__( @@ -4569,21 +4478,21 @@ def __init__( **kwargs ): """ - :keyword name: The name of a managed cluster SKU. Known values are: "Basic". + :keyword name: The name of a managed cluster SKU. "Basic" :paramtype name: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.ManagedClusterSKUName :keyword tier: If not specified, the default is 'Free'. See `uptime SLA - `_ for more details. Known values are: "Paid", - "Free". + `_ for more details. Known values are: "Paid" + and "Free". :paramtype tier: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.ManagedClusterSKUTier """ - super(ManagedClusterSKU, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.tier = tier -class ManagedClusterUpgradeProfile(msrest.serialization.Model): +class ManagedClusterUpgradeProfile(_serialization.Model): """The list of available upgrades for compute pools. Variables are only populated by the server, and will be ignored when sending a request. @@ -4596,29 +4505,29 @@ class ManagedClusterUpgradeProfile(msrest.serialization.Model): :vartype name: str :ivar type: The type of the upgrade profile. :vartype type: str - :ivar control_plane_profile: Required. The list of available upgrade versions for the control - plane. + :ivar control_plane_profile: The list of available upgrade versions for the control plane. + Required. :vartype control_plane_profile: ~azure.mgmt.containerservice.v2022_01_02_preview.models.ManagedClusterPoolUpgradeProfile - :ivar agent_pool_profiles: Required. The list of available upgrade versions for agent pools. + :ivar agent_pool_profiles: The list of available upgrade versions for agent pools. Required. :vartype agent_pool_profiles: list[~azure.mgmt.containerservice.v2022_01_02_preview.models.ManagedClusterPoolUpgradeProfile] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'control_plane_profile': {'required': True}, - 'agent_pool_profiles': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "control_plane_profile": {"required": True}, + "agent_pool_profiles": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'control_plane_profile': {'key': 'properties.controlPlaneProfile', 'type': 'ManagedClusterPoolUpgradeProfile'}, - 'agent_pool_profiles': {'key': 'properties.agentPoolProfiles', 'type': '[ManagedClusterPoolUpgradeProfile]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "control_plane_profile": {"key": "properties.controlPlaneProfile", "type": "ManagedClusterPoolUpgradeProfile"}, + "agent_pool_profiles": {"key": "properties.agentPoolProfiles", "type": "[ManagedClusterPoolUpgradeProfile]"}, } def __init__( @@ -4629,15 +4538,15 @@ def __init__( **kwargs ): """ - :keyword control_plane_profile: Required. The list of available upgrade versions for the - control plane. + :keyword control_plane_profile: The list of available upgrade versions for the control plane. + Required. :paramtype control_plane_profile: ~azure.mgmt.containerservice.v2022_01_02_preview.models.ManagedClusterPoolUpgradeProfile - :keyword agent_pool_profiles: Required. The list of available upgrade versions for agent pools. + :keyword agent_pool_profiles: The list of available upgrade versions for agent pools. Required. :paramtype agent_pool_profiles: list[~azure.mgmt.containerservice.v2022_01_02_preview.models.ManagedClusterPoolUpgradeProfile] """ - super(ManagedClusterUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -4645,18 +4554,18 @@ def __init__( self.agent_pool_profiles = agent_pool_profiles -class ManagedClusterWindowsProfile(msrest.serialization.Model): +class ManagedClusterWindowsProfile(_serialization.Model): """Profile for Windows VMs in the managed cluster. All required parameters must be populated in order to send to Azure. - :ivar admin_username: Required. Specifies the name of the administrator account. - :code:`
`:code:`
` **Restriction:** Cannot end in "." :code:`
`:code:`
` - **Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", "test1", - "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", - "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", - "sys", "test2", "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 - character :code:`
`:code:`
` **Max-length:** 20 characters. + :ivar admin_username: Specifies the name of the administrator account. :code:`
`:code:`
` + **Restriction:** Cannot end in "." :code:`
`:code:`
` **Disallowed values:** + "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", + "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", + "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", + "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 character + :code:`
`:code:`
` **Max-length:** 20 characters. Required. :vartype admin_username: str :ivar admin_password: Specifies the password of the administrator account. :code:`
`:code:`
` **Minimum-length:** 8 characters :code:`
`:code:`
` @@ -4668,7 +4577,7 @@ class ManagedClusterWindowsProfile(msrest.serialization.Model): :vartype admin_password: str :ivar license_type: The license type to use for Windows VMs. See `Azure Hybrid User Benefits `_ for more details. Known values are: - "None", "Windows_Server". + "None" and "Windows_Server". :vartype license_type: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.LicenseType :ivar enable_csi_proxy: For more details on CSI proxy, see the `CSI proxy GitHub repo @@ -4680,15 +4589,15 @@ class ManagedClusterWindowsProfile(msrest.serialization.Model): """ _validation = { - 'admin_username': {'required': True}, + "admin_username": {"required": True}, } _attribute_map = { - 'admin_username': {'key': 'adminUsername', 'type': 'str'}, - 'admin_password': {'key': 'adminPassword', 'type': 'str'}, - 'license_type': {'key': 'licenseType', 'type': 'str'}, - 'enable_csi_proxy': {'key': 'enableCSIProxy', 'type': 'bool'}, - 'gmsa_profile': {'key': 'gmsaProfile', 'type': 'WindowsGmsaProfile'}, + "admin_username": {"key": "adminUsername", "type": "str"}, + "admin_password": {"key": "adminPassword", "type": "str"}, + "license_type": {"key": "licenseType", "type": "str"}, + "enable_csi_proxy": {"key": "enableCSIProxy", "type": "bool"}, + "gmsa_profile": {"key": "gmsaProfile", "type": "WindowsGmsaProfile"}, } def __init__( @@ -4702,13 +4611,13 @@ def __init__( **kwargs ): """ - :keyword admin_username: Required. Specifies the name of the administrator account. + :keyword admin_username: Specifies the name of the administrator account. :code:`
`:code:`
` **Restriction:** Cannot end in "." :code:`
`:code:`
` **Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 - character :code:`
`:code:`
` **Max-length:** 20 characters. + character :code:`
`:code:`
` **Max-length:** 20 characters. Required. :paramtype admin_username: str :keyword admin_password: Specifies the password of the administrator account. :code:`
`:code:`
` **Minimum-length:** 8 characters :code:`
`:code:`
` @@ -4720,7 +4629,7 @@ def __init__( :paramtype admin_password: str :keyword license_type: The license type to use for Windows VMs. See `Azure Hybrid User Benefits `_ for more details. Known values are: - "None", "Windows_Server". + "None" and "Windows_Server". :paramtype license_type: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.LicenseType :keyword enable_csi_proxy: For more details on CSI proxy, see the `CSI proxy GitHub repo @@ -4730,7 +4639,7 @@ def __init__( :paramtype gmsa_profile: ~azure.mgmt.containerservice.v2022_01_02_preview.models.WindowsGmsaProfile """ - super(ManagedClusterWindowsProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.admin_username = admin_username self.admin_password = admin_password self.license_type = license_type @@ -4738,7 +4647,7 @@ def __init__( self.gmsa_profile = gmsa_profile -class ManagedServiceIdentityUserAssignedIdentitiesValue(msrest.serialization.Model): +class ManagedServiceIdentityUserAssignedIdentitiesValue(_serialization.Model): """ManagedServiceIdentityUserAssignedIdentitiesValue. Variables are only populated by the server, and will be ignored when sending a request. @@ -4750,27 +4659,23 @@ class ManagedServiceIdentityUserAssignedIdentitiesValue(msrest.serialization.Mod """ _validation = { - 'principal_id': {'readonly': True}, - 'client_id': {'readonly': True}, + "principal_id": {"readonly": True}, + "client_id": {"readonly": True}, } _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, + "principal_id": {"key": "principalId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(ManagedServiceIdentityUserAssignedIdentitiesValue, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.principal_id = None self.client_id = None -class OperationListResult(msrest.serialization.Model): +class OperationListResult(_serialization.Model): """The List Operation response. Variables are only populated by the server, and will be ignored when sending a request. @@ -4780,24 +4685,20 @@ class OperationListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[OperationValue]'}, + "value": {"key": "value", "type": "[OperationValue]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(OperationListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None -class OperationValue(msrest.serialization.Model): +class OperationValue(_serialization.Model): """Describes the properties of a Operation value. Variables are only populated by the server, and will be ignored when sending a request. @@ -4817,30 +4718,26 @@ class OperationValue(msrest.serialization.Model): """ _validation = { - 'origin': {'readonly': True}, - 'name': {'readonly': True}, - 'operation': {'readonly': True}, - 'resource': {'readonly': True}, - 'description': {'readonly': True}, - 'provider': {'readonly': True}, + "origin": {"readonly": True}, + "name": {"readonly": True}, + "operation": {"readonly": True}, + "resource": {"readonly": True}, + "description": {"readonly": True}, + "provider": {"readonly": True}, } _attribute_map = { - 'origin': {'key': 'origin', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'operation': {'key': 'display.operation', 'type': 'str'}, - 'resource': {'key': 'display.resource', 'type': 'str'}, - 'description': {'key': 'display.description', 'type': 'str'}, - 'provider': {'key': 'display.provider', 'type': 'str'}, + "origin": {"key": "origin", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "operation": {"key": "display.operation", "type": "str"}, + "resource": {"key": "display.resource", "type": "str"}, + "description": {"key": "display.description", "type": "str"}, + "provider": {"key": "display.provider", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(OperationValue, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.origin = None self.name = None self.operation = None @@ -4849,7 +4746,7 @@ def __init__( self.provider = None -class OSOptionProfile(msrest.serialization.Model): +class OSOptionProfile(_serialization.Model): """The OS option profile. Variables are only populated by the server, and will be ignored when sending a request. @@ -4862,83 +4759,72 @@ class OSOptionProfile(msrest.serialization.Model): :vartype name: str :ivar type: The type of the OS option resource. :vartype type: str - :ivar os_option_property_list: Required. The list of OS options. + :ivar os_option_property_list: The list of OS options. Required. :vartype os_option_property_list: list[~azure.mgmt.containerservice.v2022_01_02_preview.models.OSOptionProperty] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'os_option_property_list': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "os_option_property_list": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'os_option_property_list': {'key': 'properties.osOptionPropertyList', 'type': '[OSOptionProperty]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "os_option_property_list": {"key": "properties.osOptionPropertyList", "type": "[OSOptionProperty]"}, } - def __init__( - self, - *, - os_option_property_list: List["_models.OSOptionProperty"], - **kwargs - ): + def __init__(self, *, os_option_property_list: List["_models.OSOptionProperty"], **kwargs): """ - :keyword os_option_property_list: Required. The list of OS options. + :keyword os_option_property_list: The list of OS options. Required. :paramtype os_option_property_list: list[~azure.mgmt.containerservice.v2022_01_02_preview.models.OSOptionProperty] """ - super(OSOptionProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None self.os_option_property_list = os_option_property_list -class OSOptionProperty(msrest.serialization.Model): +class OSOptionProperty(_serialization.Model): """OS option property. All required parameters must be populated in order to send to Azure. - :ivar os_type: Required. The OS type. + :ivar os_type: The OS type. Required. :vartype os_type: str - :ivar enable_fips_image: Required. Whether the image is FIPS-enabled. + :ivar enable_fips_image: Whether the image is FIPS-enabled. Required. :vartype enable_fips_image: bool """ _validation = { - 'os_type': {'required': True}, - 'enable_fips_image': {'required': True}, + "os_type": {"required": True}, + "enable_fips_image": {"required": True}, } _attribute_map = { - 'os_type': {'key': 'os-type', 'type': 'str'}, - 'enable_fips_image': {'key': 'enable-fips-image', 'type': 'bool'}, + "os_type": {"key": "os-type", "type": "str"}, + "enable_fips_image": {"key": "enable-fips-image", "type": "bool"}, } - def __init__( - self, - *, - os_type: str, - enable_fips_image: bool, - **kwargs - ): + def __init__(self, *, os_type: str, enable_fips_image: bool, **kwargs): """ - :keyword os_type: Required. The OS type. + :keyword os_type: The OS type. Required. :paramtype os_type: str - :keyword enable_fips_image: Required. Whether the image is FIPS-enabled. + :keyword enable_fips_image: Whether the image is FIPS-enabled. Required. :paramtype enable_fips_image: bool """ - super(OSOptionProperty, self).__init__(**kwargs) + super().__init__(**kwargs) self.os_type = os_type self.enable_fips_image = enable_fips_image -class OutboundEnvironmentEndpoint(msrest.serialization.Model): +class OutboundEnvironmentEndpoint(_serialization.Model): """Egress endpoints which AKS agent nodes connect to for common purpose. :ivar category: The category of endpoints accessed by the AKS agent node, e.g. @@ -4950,8 +4836,8 @@ class OutboundEnvironmentEndpoint(msrest.serialization.Model): """ _attribute_map = { - 'category': {'key': 'category', 'type': 'str'}, - 'endpoints': {'key': 'endpoints', 'type': '[EndpointDependency]'}, + "category": {"key": "category", "type": "str"}, + "endpoints": {"key": "endpoints", "type": "[EndpointDependency]"}, } def __init__( @@ -4969,19 +4855,19 @@ def __init__( :paramtype endpoints: list[~azure.mgmt.containerservice.v2022_01_02_preview.models.EndpointDependency] """ - super(OutboundEnvironmentEndpoint, self).__init__(**kwargs) + super().__init__(**kwargs) self.category = category self.endpoints = endpoints -class OutboundEnvironmentEndpointCollection(msrest.serialization.Model): +class OutboundEnvironmentEndpointCollection(_serialization.Model): """Collection of OutboundEnvironmentEndpoint. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar value: Required. Collection of resources. + :ivar value: Collection of resources. Required. :vartype value: list[~azure.mgmt.containerservice.v2022_01_02_preview.models.OutboundEnvironmentEndpoint] :ivar next_link: Link to next page of resources. @@ -4989,59 +4875,49 @@ class OutboundEnvironmentEndpointCollection(msrest.serialization.Model): """ _validation = { - 'value': {'required': True}, - 'next_link': {'readonly': True}, + "value": {"required": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[OutboundEnvironmentEndpoint]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[OutboundEnvironmentEndpoint]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: List["_models.OutboundEnvironmentEndpoint"], - **kwargs - ): + def __init__(self, *, value: List["_models.OutboundEnvironmentEndpoint"], **kwargs): """ - :keyword value: Required. Collection of resources. + :keyword value: Collection of resources. Required. :paramtype value: list[~azure.mgmt.containerservice.v2022_01_02_preview.models.OutboundEnvironmentEndpoint] """ - super(OutboundEnvironmentEndpointCollection, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class PowerState(msrest.serialization.Model): +class PowerState(_serialization.Model): """Describes the Power State of the cluster. - :ivar code: Tells whether the cluster is Running or Stopped. Known values are: "Running", + :ivar code: Tells whether the cluster is Running or Stopped. Known values are: "Running" and "Stopped". :vartype code: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.Code """ _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, + "code": {"key": "code", "type": "str"}, } - def __init__( - self, - *, - code: Optional[Union[str, "_models.Code"]] = None, - **kwargs - ): + def __init__(self, *, code: Optional[Union[str, "_models.Code"]] = None, **kwargs): """ - :keyword code: Tells whether the cluster is Running or Stopped. Known values are: "Running", + :keyword code: Tells whether the cluster is Running or Stopped. Known values are: "Running" and "Stopped". :paramtype code: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.Code """ - super(PowerState, self).__init__(**kwargs) + super().__init__(**kwargs) self.code = code -class PrivateEndpoint(msrest.serialization.Model): +class PrivateEndpoint(_serialization.Model): """Private endpoint which a connection belongs to. :ivar id: The resource ID of the private endpoint. @@ -5049,24 +4925,19 @@ class PrivateEndpoint(msrest.serialization.Model): """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, } - def __init__( - self, - *, - id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin """ :keyword id: The resource ID of the private endpoint. :paramtype id: str """ - super(PrivateEndpoint, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id -class PrivateEndpointConnection(msrest.serialization.Model): +class PrivateEndpointConnection(_serialization.Model): """A private endpoint connection. Variables are only populated by the server, and will be ignored when sending a request. @@ -5078,7 +4949,7 @@ class PrivateEndpointConnection(msrest.serialization.Model): :ivar type: The resource type. :vartype type: str :ivar provisioning_state: The current provisioning state. Known values are: "Succeeded", - "Creating", "Deleting", "Failed". + "Creating", "Deleting", and "Failed". :vartype provisioning_state: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.PrivateEndpointConnectionProvisioningState :ivar private_endpoint: The resource of private endpoint. @@ -5091,19 +4962,22 @@ class PrivateEndpointConnection(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'provisioning_state': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, - 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "private_endpoint": {"key": "properties.privateEndpoint", "type": "PrivateEndpoint"}, + "private_link_service_connection_state": { + "key": "properties.privateLinkServiceConnectionState", + "type": "PrivateLinkServiceConnectionState", + }, } def __init__( @@ -5122,7 +4996,7 @@ def __init__( :paramtype private_link_service_connection_state: ~azure.mgmt.containerservice.v2022_01_02_preview.models.PrivateLinkServiceConnectionState """ - super(PrivateEndpointConnection, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -5131,7 +5005,7 @@ def __init__( self.private_link_service_connection_state = private_link_service_connection_state -class PrivateEndpointConnectionListResult(msrest.serialization.Model): +class PrivateEndpointConnectionListResult(_serialization.Model): """A list of private endpoint connections. :ivar value: The collection value. @@ -5140,25 +5014,20 @@ class PrivateEndpointConnectionListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, + "value": {"key": "value", "type": "[PrivateEndpointConnection]"}, } - def __init__( - self, - *, - value: Optional[List["_models.PrivateEndpointConnection"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.PrivateEndpointConnection"]] = None, **kwargs): """ :keyword value: The collection value. :paramtype value: list[~azure.mgmt.containerservice.v2022_01_02_preview.models.PrivateEndpointConnection] """ - super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value -class PrivateLinkResource(msrest.serialization.Model): +class PrivateLinkResource(_serialization.Model): """A private link resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -5179,22 +5048,22 @@ class PrivateLinkResource(msrest.serialization.Model): """ _validation = { - 'private_link_service_id': {'readonly': True}, + "private_link_service_id": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'group_id': {'key': 'groupId', 'type': 'str'}, - 'required_members': {'key': 'requiredMembers', 'type': '[str]'}, - 'private_link_service_id': {'key': 'privateLinkServiceID', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "group_id": {"key": "groupId", "type": "str"}, + "required_members": {"key": "requiredMembers", "type": "[str]"}, + "private_link_service_id": {"key": "privateLinkServiceID", "type": "str"}, } def __init__( self, *, - id: Optional[str] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin name: Optional[str] = None, type: Optional[str] = None, group_id: Optional[str] = None, @@ -5213,7 +5082,7 @@ def __init__( :keyword required_members: The RequiredMembers of the resource. :paramtype required_members: list[str] """ - super(PrivateLinkResource, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id self.name = name self.type = type @@ -5222,7 +5091,7 @@ def __init__( self.private_link_service_id = None -class PrivateLinkResourcesListResult(msrest.serialization.Model): +class PrivateLinkResourcesListResult(_serialization.Model): """A list of private link resources. :ivar value: The collection value. @@ -5231,29 +5100,24 @@ class PrivateLinkResourcesListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, + "value": {"key": "value", "type": "[PrivateLinkResource]"}, } - def __init__( - self, - *, - value: Optional[List["_models.PrivateLinkResource"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.PrivateLinkResource"]] = None, **kwargs): """ :keyword value: The collection value. :paramtype value: list[~azure.mgmt.containerservice.v2022_01_02_preview.models.PrivateLinkResource] """ - super(PrivateLinkResourcesListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value -class PrivateLinkServiceConnectionState(msrest.serialization.Model): +class PrivateLinkServiceConnectionState(_serialization.Model): """The state of a private link service connection. :ivar status: The private link service connection status. Known values are: "Pending", - "Approved", "Rejected", "Disconnected". + "Approved", "Rejected", and "Disconnected". :vartype status: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.ConnectionStatus :ivar description: The private link service connection description. @@ -5261,8 +5125,8 @@ class PrivateLinkServiceConnectionState(msrest.serialization.Model): """ _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, + "status": {"key": "status", "type": "str"}, + "description": {"key": "description", "type": "str"}, } def __init__( @@ -5274,18 +5138,18 @@ def __init__( ): """ :keyword status: The private link service connection status. Known values are: "Pending", - "Approved", "Rejected", "Disconnected". + "Approved", "Rejected", and "Disconnected". :paramtype status: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.ConnectionStatus :keyword description: The private link service connection description. :paramtype description: str """ - super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) + super().__init__(**kwargs) self.status = status self.description = description -class ResourceReference(msrest.serialization.Model): +class ResourceReference(_serialization.Model): """A reference to an Azure resource. :ivar id: The fully qualified Azure resource id. @@ -5293,29 +5157,24 @@ class ResourceReference(msrest.serialization.Model): """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, } - def __init__( - self, - *, - id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin """ :keyword id: The fully qualified Azure resource id. :paramtype id: str """ - super(ResourceReference, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id -class RunCommandRequest(msrest.serialization.Model): +class RunCommandRequest(_serialization.Model): """A run command request. All required parameters must be populated in order to send to Azure. - :ivar command: Required. The command to run. + :ivar command: The command to run. Required. :vartype command: str :ivar context: A base64 encoded zip file containing the files required by the command. :vartype context: str @@ -5324,38 +5183,31 @@ class RunCommandRequest(msrest.serialization.Model): """ _validation = { - 'command': {'required': True}, + "command": {"required": True}, } _attribute_map = { - 'command': {'key': 'command', 'type': 'str'}, - 'context': {'key': 'context', 'type': 'str'}, - 'cluster_token': {'key': 'clusterToken', 'type': 'str'}, + "command": {"key": "command", "type": "str"}, + "context": {"key": "context", "type": "str"}, + "cluster_token": {"key": "clusterToken", "type": "str"}, } - def __init__( - self, - *, - command: str, - context: Optional[str] = None, - cluster_token: Optional[str] = None, - **kwargs - ): + def __init__(self, *, command: str, context: Optional[str] = None, cluster_token: Optional[str] = None, **kwargs): """ - :keyword command: Required. The command to run. + :keyword command: The command to run. Required. :paramtype command: str :keyword context: A base64 encoded zip file containing the files required by the command. :paramtype context: str :keyword cluster_token: AuthToken issued for AKS AAD Server App. :paramtype cluster_token: str """ - super(RunCommandRequest, self).__init__(**kwargs) + super().__init__(**kwargs) self.command = command self.context = context self.cluster_token = cluster_token -class RunCommandResult(msrest.serialization.Model): +class RunCommandResult(_serialization.Model): """run command result. Variables are only populated by the server, and will be ignored when sending a request. @@ -5377,32 +5229,28 @@ class RunCommandResult(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'exit_code': {'readonly': True}, - 'started_at': {'readonly': True}, - 'finished_at': {'readonly': True}, - 'logs': {'readonly': True}, - 'reason': {'readonly': True}, + "id": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "exit_code": {"readonly": True}, + "started_at": {"readonly": True}, + "finished_at": {"readonly": True}, + "logs": {"readonly": True}, + "reason": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'exit_code': {'key': 'properties.exitCode', 'type': 'int'}, - 'started_at': {'key': 'properties.startedAt', 'type': 'iso-8601'}, - 'finished_at': {'key': 'properties.finishedAt', 'type': 'iso-8601'}, - 'logs': {'key': 'properties.logs', 'type': 'str'}, - 'reason': {'key': 'properties.reason', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(RunCommandResult, self).__init__(**kwargs) + "id": {"key": "id", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "exit_code": {"key": "properties.exitCode", "type": "int"}, + "started_at": {"key": "properties.startedAt", "type": "iso-8601"}, + "finished_at": {"key": "properties.finishedAt", "type": "iso-8601"}, + "logs": {"key": "properties.logs", "type": "str"}, + "reason": {"key": "properties.reason", "type": "str"}, + } + + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.id = None self.provisioning_state = None self.exit_code = None @@ -5412,7 +5260,7 @@ def __init__( self.reason = None -class Snapshot(Resource): +class Snapshot(Resource): # pylint: disable=too-many-instance-attributes """A node pool snapshot resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -5425,28 +5273,27 @@ class Snapshot(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar system_data: The system metadata relating to this snapshot. :vartype system_data: ~azure.mgmt.containerservice.v2022_01_02_preview.models.SystemData :ivar creation_data: CreationData to be used to specify the source agent pool resource ID to create this snapshot. :vartype creation_data: ~azure.mgmt.containerservice.v2022_01_02_preview.models.CreationData - :ivar snapshot_type: The type of a snapshot. The default is NodePool. Known values are: - "NodePool". Default value: "NodePool". + :ivar snapshot_type: The type of a snapshot. The default is NodePool. "NodePool" :vartype snapshot_type: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.SnapshotType :ivar kubernetes_version: The version of Kubernetes. :vartype kubernetes_version: str :ivar node_image_version: The version of node image. :vartype node_image_version: str - :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.OSType :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known - values are: "Ubuntu", "CBLMariner". + values are: "Ubuntu" and "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.OSSKU :ivar vm_size: The size of the VM. :vartype vm_size: str @@ -5455,34 +5302,34 @@ class Snapshot(Resource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'system_data': {'readonly': True}, - 'kubernetes_version': {'readonly': True}, - 'node_image_version': {'readonly': True}, - 'os_type': {'readonly': True}, - 'os_sku': {'readonly': True}, - 'vm_size': {'readonly': True}, - 'enable_fips': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, + "system_data": {"readonly": True}, + "kubernetes_version": {"readonly": True}, + "node_image_version": {"readonly": True}, + "os_type": {"readonly": True}, + "os_sku": {"readonly": True}, + "vm_size": {"readonly": True}, + "enable_fips": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'creation_data': {'key': 'properties.creationData', 'type': 'CreationData'}, - 'snapshot_type': {'key': 'properties.snapshotType', 'type': 'str'}, - 'kubernetes_version': {'key': 'properties.kubernetesVersion', 'type': 'str'}, - 'node_image_version': {'key': 'properties.nodeImageVersion', 'type': 'str'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'os_sku': {'key': 'properties.osSku', 'type': 'str'}, - 'vm_size': {'key': 'properties.vmSize', 'type': 'str'}, - 'enable_fips': {'key': 'properties.enableFIPS', 'type': 'bool'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "creation_data": {"key": "properties.creationData", "type": "CreationData"}, + "snapshot_type": {"key": "properties.snapshotType", "type": "str"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "node_image_version": {"key": "properties.nodeImageVersion", "type": "str"}, + "os_type": {"key": "properties.osType", "type": "str"}, + "os_sku": {"key": "properties.osSku", "type": "str"}, + "vm_size": {"key": "properties.vmSize", "type": "str"}, + "enable_fips": {"key": "properties.enableFIPS", "type": "bool"}, } def __init__( @@ -5491,23 +5338,22 @@ def __init__( location: str, tags: Optional[Dict[str, str]] = None, creation_data: Optional["_models.CreationData"] = None, - snapshot_type: Optional[Union[str, "_models.SnapshotType"]] = "NodePool", + snapshot_type: Union[str, "_models.SnapshotType"] = "NodePool", **kwargs ): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword creation_data: CreationData to be used to specify the source agent pool resource ID to create this snapshot. :paramtype creation_data: ~azure.mgmt.containerservice.v2022_01_02_preview.models.CreationData - :keyword snapshot_type: The type of a snapshot. The default is NodePool. Known values are: - "NodePool". Default value: "NodePool". + :keyword snapshot_type: The type of a snapshot. The default is NodePool. "NodePool" :paramtype snapshot_type: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.SnapshotType """ - super(Snapshot, self).__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.system_data = None self.creation_data = creation_data self.snapshot_type = snapshot_type @@ -5519,7 +5365,7 @@ def __init__( self.enable_fips = None -class SnapshotListResult(msrest.serialization.Model): +class SnapshotListResult(_serialization.Model): """The response from the List Snapshots operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -5531,30 +5377,25 @@ class SnapshotListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[Snapshot]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[Snapshot]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.Snapshot"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.Snapshot"]] = None, **kwargs): """ :keyword value: The list of snapshots. :paramtype value: list[~azure.mgmt.containerservice.v2022_01_02_preview.models.Snapshot] """ - super(SnapshotListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class SysctlConfig(msrest.serialization.Model): +class SysctlConfig(_serialization.Model): # pylint: disable=too-many-instance-attributes """Sysctl settings for Linux agent nodes. :ivar net_core_somaxconn: Sysctl setting net.core.somaxconn. @@ -5616,37 +5457,37 @@ class SysctlConfig(msrest.serialization.Model): """ _attribute_map = { - 'net_core_somaxconn': {'key': 'netCoreSomaxconn', 'type': 'int'}, - 'net_core_netdev_max_backlog': {'key': 'netCoreNetdevMaxBacklog', 'type': 'int'}, - 'net_core_rmem_default': {'key': 'netCoreRmemDefault', 'type': 'int'}, - 'net_core_rmem_max': {'key': 'netCoreRmemMax', 'type': 'int'}, - 'net_core_wmem_default': {'key': 'netCoreWmemDefault', 'type': 'int'}, - 'net_core_wmem_max': {'key': 'netCoreWmemMax', 'type': 'int'}, - 'net_core_optmem_max': {'key': 'netCoreOptmemMax', 'type': 'int'}, - 'net_ipv4_tcp_max_syn_backlog': {'key': 'netIpv4TcpMaxSynBacklog', 'type': 'int'}, - 'net_ipv4_tcp_max_tw_buckets': {'key': 'netIpv4TcpMaxTwBuckets', 'type': 'int'}, - 'net_ipv4_tcp_fin_timeout': {'key': 'netIpv4TcpFinTimeout', 'type': 'int'}, - 'net_ipv4_tcp_keepalive_time': {'key': 'netIpv4TcpKeepaliveTime', 'type': 'int'}, - 'net_ipv4_tcp_keepalive_probes': {'key': 'netIpv4TcpKeepaliveProbes', 'type': 'int'}, - 'net_ipv4_tcpkeepalive_intvl': {'key': 'netIpv4TcpkeepaliveIntvl', 'type': 'int'}, - 'net_ipv4_tcp_tw_reuse': {'key': 'netIpv4TcpTwReuse', 'type': 'bool'}, - 'net_ipv4_ip_local_port_range': {'key': 'netIpv4IpLocalPortRange', 'type': 'str'}, - 'net_ipv4_neigh_default_gc_thresh1': {'key': 'netIpv4NeighDefaultGcThresh1', 'type': 'int'}, - 'net_ipv4_neigh_default_gc_thresh2': {'key': 'netIpv4NeighDefaultGcThresh2', 'type': 'int'}, - 'net_ipv4_neigh_default_gc_thresh3': {'key': 'netIpv4NeighDefaultGcThresh3', 'type': 'int'}, - 'net_netfilter_nf_conntrack_max': {'key': 'netNetfilterNfConntrackMax', 'type': 'int'}, - 'net_netfilter_nf_conntrack_buckets': {'key': 'netNetfilterNfConntrackBuckets', 'type': 'int'}, - 'fs_inotify_max_user_watches': {'key': 'fsInotifyMaxUserWatches', 'type': 'int'}, - 'fs_file_max': {'key': 'fsFileMax', 'type': 'int'}, - 'fs_aio_max_nr': {'key': 'fsAioMaxNr', 'type': 'int'}, - 'fs_nr_open': {'key': 'fsNrOpen', 'type': 'int'}, - 'kernel_threads_max': {'key': 'kernelThreadsMax', 'type': 'int'}, - 'vm_max_map_count': {'key': 'vmMaxMapCount', 'type': 'int'}, - 'vm_swappiness': {'key': 'vmSwappiness', 'type': 'int'}, - 'vm_vfs_cache_pressure': {'key': 'vmVfsCachePressure', 'type': 'int'}, - } - - def __init__( + "net_core_somaxconn": {"key": "netCoreSomaxconn", "type": "int"}, + "net_core_netdev_max_backlog": {"key": "netCoreNetdevMaxBacklog", "type": "int"}, + "net_core_rmem_default": {"key": "netCoreRmemDefault", "type": "int"}, + "net_core_rmem_max": {"key": "netCoreRmemMax", "type": "int"}, + "net_core_wmem_default": {"key": "netCoreWmemDefault", "type": "int"}, + "net_core_wmem_max": {"key": "netCoreWmemMax", "type": "int"}, + "net_core_optmem_max": {"key": "netCoreOptmemMax", "type": "int"}, + "net_ipv4_tcp_max_syn_backlog": {"key": "netIpv4TcpMaxSynBacklog", "type": "int"}, + "net_ipv4_tcp_max_tw_buckets": {"key": "netIpv4TcpMaxTwBuckets", "type": "int"}, + "net_ipv4_tcp_fin_timeout": {"key": "netIpv4TcpFinTimeout", "type": "int"}, + "net_ipv4_tcp_keepalive_time": {"key": "netIpv4TcpKeepaliveTime", "type": "int"}, + "net_ipv4_tcp_keepalive_probes": {"key": "netIpv4TcpKeepaliveProbes", "type": "int"}, + "net_ipv4_tcpkeepalive_intvl": {"key": "netIpv4TcpkeepaliveIntvl", "type": "int"}, + "net_ipv4_tcp_tw_reuse": {"key": "netIpv4TcpTwReuse", "type": "bool"}, + "net_ipv4_ip_local_port_range": {"key": "netIpv4IpLocalPortRange", "type": "str"}, + "net_ipv4_neigh_default_gc_thresh1": {"key": "netIpv4NeighDefaultGcThresh1", "type": "int"}, + "net_ipv4_neigh_default_gc_thresh2": {"key": "netIpv4NeighDefaultGcThresh2", "type": "int"}, + "net_ipv4_neigh_default_gc_thresh3": {"key": "netIpv4NeighDefaultGcThresh3", "type": "int"}, + "net_netfilter_nf_conntrack_max": {"key": "netNetfilterNfConntrackMax", "type": "int"}, + "net_netfilter_nf_conntrack_buckets": {"key": "netNetfilterNfConntrackBuckets", "type": "int"}, + "fs_inotify_max_user_watches": {"key": "fsInotifyMaxUserWatches", "type": "int"}, + "fs_file_max": {"key": "fsFileMax", "type": "int"}, + "fs_aio_max_nr": {"key": "fsAioMaxNr", "type": "int"}, + "fs_nr_open": {"key": "fsNrOpen", "type": "int"}, + "kernel_threads_max": {"key": "kernelThreadsMax", "type": "int"}, + "vm_max_map_count": {"key": "vmMaxMapCount", "type": "int"}, + "vm_swappiness": {"key": "vmSwappiness", "type": "int"}, + "vm_vfs_cache_pressure": {"key": "vmVfsCachePressure", "type": "int"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, net_core_somaxconn: Optional[int] = None, @@ -5737,7 +5578,7 @@ def __init__( :keyword vm_vfs_cache_pressure: Sysctl setting vm.vfs_cache_pressure. :paramtype vm_vfs_cache_pressure: int """ - super(SysctlConfig, self).__init__(**kwargs) + super().__init__(**kwargs) self.net_core_somaxconn = net_core_somaxconn self.net_core_netdev_max_backlog = net_core_netdev_max_backlog self.net_core_rmem_default = net_core_rmem_default @@ -5768,13 +5609,13 @@ def __init__( self.vm_vfs_cache_pressure = vm_vfs_cache_pressure -class SystemData(msrest.serialization.Model): +class SystemData(_serialization.Model): """Metadata pertaining to creation and last modification of the resource. :ivar created_by: The identity that created the resource. :vartype created_by: str :ivar created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", "Key". + "User", "Application", "ManagedIdentity", and "Key". :vartype created_by_type: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.CreatedByType :ivar created_at: The UTC timestamp of resource creation. @@ -5782,7 +5623,7 @@ class SystemData(msrest.serialization.Model): :ivar last_modified_by: The identity that last modified the resource. :vartype last_modified_by: str :ivar last_modified_by_type: The type of identity that last modified the resource. Known values - are: "User", "Application", "ManagedIdentity", "Key". + are: "User", "Application", "ManagedIdentity", and "Key". :vartype last_modified_by_type: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.CreatedByType :ivar last_modified_at: The type of identity that last modified the resource. @@ -5790,12 +5631,12 @@ class SystemData(msrest.serialization.Model): """ _attribute_map = { - 'created_by': {'key': 'createdBy', 'type': 'str'}, - 'created_by_type': {'key': 'createdByType', 'type': 'str'}, - 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, - 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, - 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, - 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + "created_by": {"key": "createdBy", "type": "str"}, + "created_by_type": {"key": "createdByType", "type": "str"}, + "created_at": {"key": "createdAt", "type": "iso-8601"}, + "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, + "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, + "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, } def __init__( @@ -5813,7 +5654,7 @@ def __init__( :keyword created_by: The identity that created the resource. :paramtype created_by: str :keyword created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", "Key". + "User", "Application", "ManagedIdentity", and "Key". :paramtype created_by_type: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.CreatedByType :keyword created_at: The UTC timestamp of resource creation. @@ -5821,13 +5662,13 @@ def __init__( :keyword last_modified_by: The identity that last modified the resource. :paramtype last_modified_by: str :keyword last_modified_by_type: The type of identity that last modified the resource. Known - values are: "User", "Application", "ManagedIdentity", "Key". + values are: "User", "Application", "ManagedIdentity", and "Key". :paramtype last_modified_by_type: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.CreatedByType :keyword last_modified_at: The type of identity that last modified the resource. :paramtype last_modified_at: ~datetime.datetime """ - super(SystemData, self).__init__(**kwargs) + super().__init__(**kwargs) self.created_by = created_by self.created_by_type = created_by_type self.created_at = created_at @@ -5836,36 +5677,31 @@ def __init__( self.last_modified_at = last_modified_at -class TagsObject(msrest.serialization.Model): +class TagsObject(_serialization.Model): """Tags object for patch operations. - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] """ _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] """ - super(TagsObject, self).__init__(**kwargs) + super().__init__(**kwargs) self.tags = tags -class TimeInWeek(msrest.serialization.Model): +class TimeInWeek(_serialization.Model): """Time in a week. :ivar day: The day of the week. Known values are: "Sunday", "Monday", "Tuesday", "Wednesday", - "Thursday", "Friday", "Saturday". + "Thursday", "Friday", and "Saturday". :vartype day: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.WeekDay :ivar hour_slots: Each integer hour represents a time range beginning at 0m after the hour ending at the next hour (non-inclusive). 0 corresponds to 00:00 UTC, 23 corresponds to 23:00 @@ -5874,32 +5710,28 @@ class TimeInWeek(msrest.serialization.Model): """ _attribute_map = { - 'day': {'key': 'day', 'type': 'str'}, - 'hour_slots': {'key': 'hourSlots', 'type': '[int]'}, + "day": {"key": "day", "type": "str"}, + "hour_slots": {"key": "hourSlots", "type": "[int]"}, } def __init__( - self, - *, - day: Optional[Union[str, "_models.WeekDay"]] = None, - hour_slots: Optional[List[int]] = None, - **kwargs + self, *, day: Optional[Union[str, "_models.WeekDay"]] = None, hour_slots: Optional[List[int]] = None, **kwargs ): """ :keyword day: The day of the week. Known values are: "Sunday", "Monday", "Tuesday", - "Wednesday", "Thursday", "Friday", "Saturday". + "Wednesday", "Thursday", "Friday", and "Saturday". :paramtype day: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.WeekDay :keyword hour_slots: Each integer hour represents a time range beginning at 0m after the hour ending at the next hour (non-inclusive). 0 corresponds to 00:00 UTC, 23 corresponds to 23:00 UTC. Specifying [0, 1] means the 00:00 - 02:00 UTC time range. :paramtype hour_slots: list[int] """ - super(TimeInWeek, self).__init__(**kwargs) + super().__init__(**kwargs) self.day = day self.hour_slots = hour_slots -class TimeSpan(msrest.serialization.Model): +class TimeSpan(_serialization.Model): """For example, between 2021-05-25T13:00:00Z and 2021-05-25T14:00:00Z. :ivar start: The start of a time span. @@ -5909,29 +5741,23 @@ class TimeSpan(msrest.serialization.Model): """ _attribute_map = { - 'start': {'key': 'start', 'type': 'iso-8601'}, - 'end': {'key': 'end', 'type': 'iso-8601'}, + "start": {"key": "start", "type": "iso-8601"}, + "end": {"key": "end", "type": "iso-8601"}, } - def __init__( - self, - *, - start: Optional[datetime.datetime] = None, - end: Optional[datetime.datetime] = None, - **kwargs - ): + def __init__(self, *, start: Optional[datetime.datetime] = None, end: Optional[datetime.datetime] = None, **kwargs): """ :keyword start: The start of a time span. :paramtype start: ~datetime.datetime :keyword end: The end of a time span. :paramtype end: ~datetime.datetime """ - super(TimeSpan, self).__init__(**kwargs) + super().__init__(**kwargs) self.start = start self.end = end -class WindowsGmsaProfile(msrest.serialization.Model): +class WindowsGmsaProfile(_serialization.Model): """Windows gMSA Profile in the managed cluster. :ivar enabled: Specifies whether to enable Windows gMSA in the managed cluster. @@ -5947,9 +5773,9 @@ class WindowsGmsaProfile(msrest.serialization.Model): """ _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'dns_server': {'key': 'dnsServer', 'type': 'str'}, - 'root_domain_name': {'key': 'rootDomainName', 'type': 'str'}, + "enabled": {"key": "enabled", "type": "bool"}, + "dns_server": {"key": "dnsServer", "type": "str"}, + "root_domain_name": {"key": "rootDomainName", "type": "str"}, } def __init__( @@ -5972,7 +5798,7 @@ def __init__( which is used to create the managed cluster. :paramtype root_domain_name: str """ - super(WindowsGmsaProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.dns_server = dns_server self.root_domain_name = root_domain_name diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/models/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/models/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/models/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/models/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/operations/__init__.py index e0748876288c..593b23075ce0 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/operations/__init__.py @@ -18,15 +18,16 @@ from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'Operations', - 'ManagedClustersOperations', - 'MaintenanceConfigurationsOperations', - 'AgentPoolsOperations', - 'PrivateEndpointConnectionsOperations', - 'PrivateLinkResourcesOperations', - 'ResolvePrivateLinkServiceIdOperations', - 'SnapshotsOperations', + "Operations", + "ManagedClustersOperations", + "MaintenanceConfigurationsOperations", + "AgentPoolsOperations", + "PrivateEndpointConnectionsOperations", + "PrivateLinkResourcesOperations", + "ResolvePrivateLinkServiceIdOperations", + "SnapshotsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/operations/_agent_pools_operations.py index f475b7ac1632..577a3c6044cc 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/operations/_agent_pools_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,288 +27,289 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - *, - json: Optional[_models.AgentPool] = None, - content: Any = None, - **kwargs: Any + _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, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + _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, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_get_upgrade_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_available_agent_pool_versions_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_upgrade_node_image_version_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_upgrade_node_image_version_request( + resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class AgentPoolsOperations: """ @@ -324,47 +330,40 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> Iterable[_models.AgentPoolListResult]: + def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> Iterable["_models.AgentPool"]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AgentPoolListResult or the result of cls(response) + :return: An iterator like instance of either AgentPool or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_01_02_preview.models.AgentPoolListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_01_02_preview.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -372,16 +371,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -397,10 +391,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -410,54 +402,45 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore @distributed_trace def get( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPool: """Gets the specified managed cluster agent pool. Gets the specified managed cluster agent pool. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPool, or the result of cls(response) + :return: AgentPool or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.AgentPool - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -465,57 +448,60 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore def _create_or_update_initial( self, resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: _models.AgentPool, + parameters: Union[_models.AgentPool, IO], **kwargs: Any ) -> _models.AgentPool: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - _json = self._serialize.body(parameters, 'AgentPool') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "AgentPool") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -523,10 +509,9 @@ def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -534,40 +519,123 @@ def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - @distributed_trace + @overload def begin_create_or_update( self, resource_group_name: str, resource_name: str, agent_pool_name: str, parameters: _models.AgentPool, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.AgentPool]: """Creates or updates an agent pool in the specified managed cluster. Creates or updates an agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str - :param parameters: The agent pool to create or update. + :param parameters: The agent pool to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_01_02_preview.models.AgentPool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_01_02_preview.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AgentPool]: + """Creates or updates an agent pool in the specified managed cluster. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: The agent pool to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_01_02_preview.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: Union[_models.AgentPool, IO], + **kwargs: Any + ) -> LROPoller[_models.AgentPool]: + """Creates or updates an agent pool in the specified managed cluster. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: The agent pool to create or update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.mgmt.containerservice.v2022_01_02_preview.models.AgentPool or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -579,20 +647,17 @@ def begin_create_or_update( :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_01_02_preview.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -601,66 +666,55 @@ def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -668,10 +722,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -681,26 +734,21 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + def begin_delete( + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> LROPoller[None]: """Deletes an agent pool in the specified managed cluster. Deletes an agent pool in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -712,99 +760,85 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPoolUpgradeProfile: """Gets the upgrade profile for an agent pool. Gets the upgrade profile for an agent pool. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolUpgradeProfile, or the result of cls(response) + :return: AgentPoolUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.AgentPoolUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -812,32 +846,27 @@ def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolUpgradeProfile', pipeline_response) + deserialized = self._deserialize("AgentPoolUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore @distributed_trace def get_available_agent_pool_versions( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported Kubernetes versions for the specified agent pool. @@ -845,33 +874,30 @@ def get_available_agent_pool_versions( `_ for more details about the version lifecycle. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolAvailableVersions, or the result of cls(response) + :return: AgentPoolAvailableVersions or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.AgentPoolAvailableVersions - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolAvailableVersions] - request = build_get_available_agent_pool_versions_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_available_agent_pool_versions.metadata['url'], + template_url=self.get_available_agent_pool_versions.metadata["url"], headers=_headers, params=_params, ) @@ -879,52 +905,43 @@ def get_available_agent_pool_versions( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolAvailableVersions', pipeline_response) + deserialized = self._deserialize("AgentPoolAvailableVersions", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_available_agent_pool_versions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore - + get_available_agent_pool_versions.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore def _upgrade_node_image_version_initial( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> Optional[_models.AgentPool]: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.AgentPool]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.AgentPool]] - - request = build_upgrade_node_image_version_request_initial( - subscription_id=self._config.subscription_id, + request = build_upgrade_node_image_version_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._upgrade_node_image_version_initial.metadata['url'], + template_url=self._upgrade_node_image_version_initial.metadata["url"], headers=_headers, params=_params, ) @@ -932,10 +949,9 @@ def _upgrade_node_image_version_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -945,37 +961,34 @@ def _upgrade_node_image_version_initial( deserialized = None response_headers = {} if response.status_code == 202: - response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) - - deserialized = self._deserialize('AgentPool', pipeline_response) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _upgrade_node_image_version_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore - + _upgrade_node_image_version_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore @distributed_trace def begin_upgrade_node_image_version( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any - ) -> LROPoller[_models.AgentPool]: + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any + ) -> LROPoller[None]: """Upgrades the node image version of an agent pool to the latest. Upgrading the node image version of an agent pool applies the newest OS and runtime updates to the nodes. AKS provides one new image per week with the latest updates. For more details on node image versions, see: https://docs.microsoft.com/azure/aks/node-image-upgrade. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -988,59 +1001,54 @@ def begin_upgrade_node_image_version( :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_01_02_preview.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._upgrade_node_image_version_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) - - deserialized = self._deserialize('AgentPool', pipeline_response) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_upgrade_node_image_version.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore + begin_upgrade_node_image_version.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/operations/_maintenance_configurations_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/operations/_maintenance_configurations_operations.py index c253126d89ae..041d35e34a53 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/operations/_maintenance_configurations_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/operations/_maintenance_configurations_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,173 +25,173 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +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_managed_cluster_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, config_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "configName": _SERIALIZER.url("config_name", config_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "configName": _SERIALIZER.url("config_name", config_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - config_name: str, - *, - json: Optional[_models.MaintenanceConfiguration] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, resource_name: str, config_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "configName": _SERIALIZER.url("config_name", config_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "configName": _SERIALIZER.url("config_name", config_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, config_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "configName": _SERIALIZER.url("config_name", config_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "configName": _SERIALIZER.url("config_name", config_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class MaintenanceConfigurationsOperations: """ @@ -207,48 +212,43 @@ def __init__(self, *args, **kwargs): 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_managed_cluster( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> Iterable[_models.MaintenanceConfigurationListResult]: + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> Iterable["_models.MaintenanceConfiguration"]: """Gets a list of maintenance configurations in the specified managed cluster. Gets a list of maintenance configurations in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either MaintenanceConfigurationListResult or the result - of cls(response) + :return: An iterator like instance of either MaintenanceConfiguration or the result of + cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_01_02_preview.models.MaintenanceConfigurationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_01_02_preview.models.MaintenanceConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfigurationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfigurationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_managed_cluster_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_managed_cluster.metadata['url'], + template_url=self.list_by_managed_cluster.metadata["url"], headers=_headers, params=_params, ) @@ -256,16 +256,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_managed_cluster_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -281,10 +276,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -294,54 +287,45 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_managed_cluster.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations"} # type: ignore + list_by_managed_cluster.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations"} # type: ignore @distributed_trace def get( - self, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, config_name: str, **kwargs: Any ) -> _models.MaintenanceConfiguration: """Gets the specified maintenance configuration of a managed cluster. Gets the specified maintenance configuration of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: MaintenanceConfiguration, or the result of cls(response) + :return: MaintenanceConfiguration or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.MaintenanceConfiguration - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfiguration] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -349,76 +333,148 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) + deserialized = self._deserialize("MaintenanceConfiguration", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - @distributed_trace + @overload def create_or_update( self, resource_group_name: str, resource_name: str, config_name: str, parameters: _models.MaintenanceConfiguration, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.MaintenanceConfiguration: """Creates or updates a maintenance configuration in the specified managed cluster. Creates or updates a maintenance configuration in the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str - :param parameters: The maintenance configuration to create or update. + :param parameters: The maintenance configuration to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_01_02_preview.models.MaintenanceConfiguration + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configuration in the specified managed cluster. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: The maintenance configuration to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: Union[_models.MaintenanceConfiguration, IO], + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configuration in the specified managed cluster. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: The maintenance configuration to create or update. Is either a model type or + a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2022_01_02_preview.models.MaintenanceConfiguration or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: MaintenanceConfiguration, or the result of cls(response) + :return: MaintenanceConfiguration or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.MaintenanceConfiguration - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfiguration] - _json = self._serialize.body(parameters, 'MaintenanceConfiguration') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "MaintenanceConfiguration") request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) @@ -426,68 +482,59 @@ def create_or_update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) + deserialized = self._deserialize("MaintenanceConfiguration", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore @distributed_trace def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, config_name: str, **kwargs: Any ) -> None: """Deletes a maintenance configuration. Deletes a maintenance configuration. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) @@ -495,10 +542,9 @@ def delete( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -508,5 +554,4 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/operations/_managed_clusters_operations.py index 9ac85fbf9349..4a959326c00e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/operations/_managed_clusters_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,200 +27,183 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_get_os_options_request( - subscription_id: str, - location: str, - *, - resource_type: Optional[str] = None, - **kwargs: Any + location: str, subscription_id: str, *, resource_type: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "location": _SERIALIZER.url("location", location, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if resource_type is not None: - _params['resource-type'] = _SERIALIZER.query("resource_type", resource_type, 'str') + _params["resource-type"] = _SERIALIZER.query("resource_type", resource_type, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters") + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters" + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_resource_group_request( - subscription_id: str, - resource_group_name: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters", + ) # 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', min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_upgrade_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_access_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, role_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "roleName": _SERIALIZER.url("role_name", role_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "roleName": _SERIALIZER.url("role_name", role_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_admin_credentials_request( - subscription_id: str, resource_group_name: str, resource_name: str, + subscription_id: str, *, server_fqdn: Optional[str] = None, format: Optional[Union[str, "_models.Format"]] = None, @@ -224,42 +212,46 @@ def build_list_cluster_admin_credentials_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if server_fqdn is not None: - _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + _params["server-fqdn"] = _SERIALIZER.query("server_fqdn", server_fqdn, "str") if format is not None: - _params['format'] = _SERIALIZER.query("format", format, 'str') + _params["format"] = _SERIALIZER.query("format", format, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_user_credentials_request( - subscription_id: str, resource_group_name: str, resource_name: str, + subscription_id: str, *, server_fqdn: Optional[str] = None, **kwargs: Any @@ -267,40 +259,44 @@ def build_list_cluster_user_credentials_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if server_fqdn is not None: - _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + _params["server-fqdn"] = _SERIALIZER.query("server_fqdn", server_fqdn, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_monitoring_user_credentials_request( - subscription_id: str, resource_group_name: str, resource_name: str, + subscription_id: str, *, server_fqdn: Optional[str] = None, **kwargs: Any @@ -308,520 +304,509 @@ def build_list_cluster_monitoring_user_credentials_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if server_fqdn is not None: - _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + _params["server-fqdn"] = _SERIALIZER.query("server_fqdn", server_fqdn, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: + +def build_get_request(resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedCluster] = None, - content: Any = None, - **kwargs: Any + +def build_create_or_update_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_update_tags_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.TagsObject] = None, - content: Any = None, - **kwargs: Any + +def build_update_tags_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + +def build_delete_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_reset_service_principal_profile_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedClusterServicePrincipalProfile] = None, - content: Any = None, - **kwargs: Any + +def build_reset_service_principal_profile_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_reset_aad_profile_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedClusterAADProfile] = None, - content: Any = None, - **kwargs: Any + +def build_reset_aad_profile_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_rotate_cluster_certificates_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + +def build_rotate_cluster_certificates_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_stop_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + +def build_stop_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_start_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + +def build_start_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_run_command_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.RunCommandRequest] = None, - content: Any = None, - **kwargs: Any + +def build_run_command_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_get_command_result_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - command_id: str, - **kwargs: Any + resource_group_name: str, resource_name: str, command_id: 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "commandId": _SERIALIZER.url("command_id", command_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "commandId": _SERIALIZER.url("command_id", command_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_list_outbound_network_dependencies_endpoints_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + class ManagedClustersOperations: # pylint: disable=too-many-public-methods """ @@ -842,46 +827,39 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def get_os_options( - self, - location: str, - resource_type: Optional[str] = None, - **kwargs: Any + self, location: str, resource_type: Optional[str] = None, **kwargs: Any ) -> _models.OSOptionProfile: """Gets supported OS options in the specified subscription. Gets supported OS options in the specified subscription. - :param location: The name of a supported Azure region. + :param location: The name of a supported Azure region. Required. :type location: str :param resource_type: The resource type for which the OS options needs to be returned. Default value is None. :type resource_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: OSOptionProfile, or the result of cls(response) + :return: OSOptionProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.OSOptionProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OSOptionProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OSOptionProfile] - request = build_get_os_options_request( - subscription_id=self._config.subscription_id, location=location, - api_version=api_version, + subscription_id=self._config.subscription_id, resource_type=resource_type, - template_url=self.get_os_options.metadata['url'], + api_version=api_version, + template_url=self.get_os_options.metadata["url"], headers=_headers, params=_params, ) @@ -889,59 +867,52 @@ def get_os_options( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('OSOptionProfile', pipeline_response) + deserialized = self._deserialize("OSOptionProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_os_options.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default"} # type: ignore - + get_os_options.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default"} # type: ignore @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.ManagedClusterListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.ManagedCluster"]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_01_02_preview.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_01_02_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -949,14 +920,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -972,10 +940,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -985,49 +951,41 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> Iterable[_models.ManagedClusterListResult]: + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.ManagedCluster"]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_01_02_preview.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_01_02_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -1035,15 +993,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -1059,10 +1013,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1072,50 +1024,42 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.ManagedClusterUpgradeProfile: """Gets the upgrade profile of a managed cluster. Gets the upgrade profile of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterUpgradeProfile, or the result of cls(response) + :return: ManagedClusterUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.ManagedClusterUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -1123,33 +1067,27 @@ def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterUpgradeProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore @distributed_trace def get_access_profile( - self, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, role_name: str, **kwargs: Any ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. @@ -1158,36 +1096,33 @@ def get_access_profile( `ListClusterAdminCredentials `_ . - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param role_name: The name of the role for managed cluster accessProfile resource. + :param role_name: The name of the role for managed cluster accessProfile resource. Required. :type role_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterAccessProfile, or the result of cls(response) + :return: ManagedClusterAccessProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.ManagedClusterAccessProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterAccessProfile] - request = build_get_access_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, role_name=role_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_access_profile.metadata['url'], + template_url=self.get_access_profile.metadata["url"], headers=_headers, params=_params, ) @@ -1195,25 +1130,23 @@ def get_access_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterAccessProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterAccessProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_access_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore - + get_access_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore @distributed_trace def list_cluster_admin_credentials( @@ -1228,41 +1161,39 @@ def list_cluster_admin_credentials( Lists the admin credentials of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :param format: Only apply to AAD clusters, specifies the format of returned kubeconfig. Format 'azure' will return azure auth-provider kubeconfig; format 'exec' will return exec format - kubeconfig, which requires kubelogin binary in the path. Default value is None. + kubeconfig, which requires kubelogin binary in the path. Known values are: "azure" and "exec". + Default value is None. :type format: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.Format :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_admin_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, format=format, - template_url=self.list_cluster_admin_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_admin_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -1270,68 +1201,59 @@ def list_cluster_admin_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_admin_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore - + list_cluster_admin_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore @distributed_trace def list_cluster_user_credentials( - self, - resource_group_name: str, - resource_name: str, - server_fqdn: Optional[str] = None, - **kwargs: Any + self, resource_group_name: str, resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any ) -> _models.CredentialResults: """Lists the user credentials of a managed cluster. Lists the user credentials of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, - template_url=self.list_cluster_user_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -1339,68 +1261,59 @@ def list_cluster_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore - + list_cluster_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore @distributed_trace def list_cluster_monitoring_user_credentials( - self, - resource_group_name: str, - resource_name: str, - server_fqdn: Optional[str] = None, - **kwargs: Any + self, resource_group_name: str, resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any ) -> _models.CredentialResults: """Lists the cluster monitoring user credentials of a managed cluster. Lists the cluster monitoring user credentials of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_monitoring_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, - template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_monitoring_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -1408,64 +1321,54 @@ def list_cluster_monitoring_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_monitoring_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore - + list_cluster_monitoring_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore @distributed_trace - def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.ManagedCluster: + def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.ManagedCluster: """Gets a managed cluster. Gets a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedCluster, or the result of cls(response) + :return: ManagedCluster or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.ManagedCluster - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -1473,55 +1376,54 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _create_or_update_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.ManagedCluster, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'ManagedCluster') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedCluster") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1529,10 +1431,9 @@ def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -1540,37 +1441,41 @@ def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - - @distributed_trace + @overload def begin_create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedCluster, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. Creates or updates a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The managed cluster to create or update. + :param parameters: The managed cluster to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_01_02_preview.models.ManagedCluster + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1583,90 +1488,155 @@ def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_01_02_preview.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._create_or_update_initial( # type: ignore - resource_group_name=resource_group_name, - resource_name=resource_name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop('error_map', None) - def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized + @overload + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + Creates or updates a managed cluster. - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling - if cont_token: + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_01_02_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster to create or update. Is either a model type or a IO + type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_01_02_preview.models.ManagedCluster or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_01_02_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ManagedCluster", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _update_tags_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.TagsObject, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request_initial( - subscription_id=self._config.subscription_id, + request = build_update_tags_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_tags_initial.metadata['url'], + content=_content, + template_url=self._update_tags_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1674,44 +1644,85 @@ def _update_tags_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_tags_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _update_tags_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - @distributed_trace + @overload def begin_update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates tags on a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2022_01_02_preview.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_01_02_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates tags on a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1724,20 +1735,50 @@ def begin_update_tags( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_01_02_preview.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates tags on a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_01_02_preview.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_01_02_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, @@ -1745,64 +1786,54 @@ def begin_update_tags( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1810,10 +1841,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1823,23 +1853,17 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> LROPoller[None]: + def begin_delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> LROPoller[None]: """Deletes a managed cluster. Deletes a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1851,85 +1875,83 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterServicePrincipalProfile, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterServicePrincipalProfile") - request = build_reset_service_principal_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_service_principal_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_service_principal_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_service_principal_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1937,10 +1959,9 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1950,28 +1971,105 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re if cls: return cls(pipeline_response, None, {}) - _reset_service_principal_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + _reset_service_principal_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + @overload + def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.ManagedClusterServicePrincipalProfile, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reset the Service Principal Profile of a managed cluster. + + This action cannot be performed on a cluster that is not using a service principal. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The service principal profile to set on the managed cluster. Required. + :type parameters: + ~azure.mgmt.containerservice.v2022_01_02_preview.models.ManagedClusterServicePrincipalProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reset the Service Principal Profile of a managed cluster. + + This action cannot be performed on a cluster that is not using a service principal. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The service principal profile to set on the managed cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace - def begin_reset_service_principal_profile( # pylint: disable=inconsistent-return-statements + def begin_reset_service_principal_profile( self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterServicePrincipalProfile, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], **kwargs: Any ) -> LROPoller[None]: """Reset the Service Principal Profile of a managed cluster. This action cannot be performed on a cluster that is not using a service principal. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The service principal profile to set on the managed cluster. + :param parameters: The service principal profile to set on the managed cluster. Is either a + model type or a IO type. Required. :type parameters: ~azure.mgmt.containerservice.v2022_01_02_preview.models.ManagedClusterServicePrincipalProfile + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1982,20 +2080,17 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -2003,67 +2098,68 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_service_principal_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + begin_reset_service_principal_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterAADProfile, + parameters: Union[_models.ManagedClusterAADProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterAADProfile") - request = build_reset_aad_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_aad_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_aad_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_aad_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2071,10 +2167,9 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -2084,28 +2179,104 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement if cls: return cls(pipeline_response, None, {}) - _reset_aad_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - + _reset_aad_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - @distributed_trace - def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements + @overload + def begin_reset_aad_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterAADProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: """Reset the AAD Profile of a managed cluster. Reset the AAD Profile of a managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The AAD profile to set on the Managed Cluster. + :param parameters: The AAD profile to set on the Managed Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2022_01_02_preview.models.ManagedClusterAADProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reset the AAD Profile of a managed cluster. + + Reset the AAD Profile of a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The AAD profile to set on the Managed Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterAADProfile, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Reset the AAD Profile of a managed cluster. + + Reset the AAD Profile of a managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The AAD profile to set on the Managed Cluster. Is either a model type or a + IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2022_01_02_preview.models.ManagedClusterAADProfile or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -2116,20 +2287,17 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -2137,62 +2305,52 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_aad_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + begin_reset_aad_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_rotate_cluster_certificates_request_initial( - subscription_id=self._config.subscription_id, + request = build_rotate_cluster_certificates_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._rotate_cluster_certificates_initial.metadata['url'], + template_url=self._rotate_cluster_certificates_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2200,10 +2358,9 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -2213,24 +2370,20 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return if cls: return cls(pipeline_response, None, {}) - _rotate_cluster_certificates_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore - + _rotate_cluster_certificates_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore @distributed_trace - def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + def begin_rotate_cluster_certificates( + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> LROPoller[None]: """Rotates the certificates of a managed cluster. See `Certificate rotation `_ for more details about rotating managed cluster certificates. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -2242,80 +2395,67 @@ def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-st Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._rotate_cluster_certificates_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_rotate_cluster_certificates.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore + begin_rotate_cluster_certificates.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore def _stop_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_stop_request_initial( - subscription_id=self._config.subscription_id, + request = build_stop_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._stop_initial.metadata['url'], + template_url=self._stop_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2323,10 +2463,9 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -2336,16 +2475,10 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore - + _stop_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore @distributed_trace - def begin_stop( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> LROPoller[None]: + def begin_stop(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> LROPoller[None]: """Stops a Managed Cluster. This can only be performed on Azure Virtual Machine Scale set backed clusters. Stopping a @@ -2354,9 +2487,9 @@ def begin_stop( # pylint: disable=inconsistent-return-statements `_ for more details about stopping a cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -2368,80 +2501,67 @@ def begin_stop( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._stop_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore + begin_stop.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore def _start_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_start_request_initial( - subscription_id=self._config.subscription_id, + request = build_start_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._start_initial.metadata['url'], + template_url=self._start_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2449,10 +2569,9 @@ def _start_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -2462,24 +2581,18 @@ def _start_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore - + _start_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore @distributed_trace - def begin_start( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> LROPoller[None]: + def begin_start(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> LROPoller[None]: """Starts a previously stopped Managed Cluster. See `starting a cluster `_ for more details about starting a cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -2491,85 +2604,83 @@ def begin_start( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._start_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore + begin_start.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore def _run_command_initial( self, resource_group_name: str, resource_name: str, - request_payload: _models.RunCommandRequest, + request_payload: Union[_models.RunCommandRequest, IO], **kwargs: Any ) -> Optional[_models.RunCommandResult]: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RunCommandResult]] - _json = self._serialize.body(request_payload, 'RunCommandRequest') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(request_payload, (IO, bytes)): + _content = request_payload + else: + _json = self._serialize.body(request_payload, "RunCommandRequest") - request = build_run_command_request_initial( - subscription_id=self._config.subscription_id, + request = build_run_command_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._run_command_initial.metadata['url'], + content=_content, + template_url=self._run_command_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2577,10 +2688,9 @@ def _run_command_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -2589,22 +2699,23 @@ def _run_command_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _run_command_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore - + _run_command_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore - @distributed_trace + @overload def begin_run_command( self, resource_group_name: str, resource_name: str, request_payload: _models.RunCommandRequest, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.RunCommandResult]: """Submits a command to run against the Managed Cluster. @@ -2613,13 +2724,56 @@ def begin_run_command( more information see `AKS Run Command `_. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param request_payload: The run command request. + :param request_payload: The run command request. Required. :type request_payload: ~azure.mgmt.containerservice.v2022_01_02_preview.models.RunCommandRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either RunCommandResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_01_02_preview.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_run_command( + self, + resource_group_name: str, + resource_name: str, + request_payload: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RunCommandResult]: + """Submits a command to run against the Managed Cluster. + + AKS will create a pod to run the command. This is primarily useful for private clusters. For + more information see `AKS Run Command + `_. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param request_payload: The run command request. Required. + :type request_payload: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -2632,20 +2786,56 @@ def begin_run_command( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_01_02_preview.models.RunCommandResult] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_run_command( + self, + resource_group_name: str, + resource_name: str, + request_payload: Union[_models.RunCommandRequest, IO], + **kwargs: Any + ) -> LROPoller[_models.RunCommandResult]: + """Submits a command to run against the Managed Cluster. + + AKS will create a pod to run the command. This is primarily useful for private clusters. For + more information see `AKS Run Command + `_. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param request_payload: The run command request. Is either a model type or a IO type. Required. + :type request_payload: + ~azure.mgmt.containerservice.v2022_01_02_preview.models.RunCommandRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either RunCommandResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_01_02_preview.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.RunCommandResult] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.RunCommandResult] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._run_command_initial( # type: ignore resource_group_name=resource_group_name, @@ -2653,82 +2843,71 @@ def begin_run_command( request_payload=request_payload, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_run_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore + begin_run_command.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore @distributed_trace def get_command_result( - self, - resource_group_name: str, - resource_name: str, - command_id: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, command_id: str, **kwargs: Any ) -> Optional[_models.RunCommandResult]: """Gets the results of a command which has been run on the Managed Cluster. Gets the results of a command which has been run on the Managed Cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param command_id: Id of the command. + :param command_id: Id of the command. Required. :type command_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: RunCommandResult, or the result of cls(response) + :return: RunCommandResult or None or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.RunCommandResult or None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RunCommandResult]] - request = build_get_command_result_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, command_id=command_id, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_command_result.metadata['url'], + template_url=self.get_command_result.metadata["url"], headers=_headers, params=_params, ) @@ -2736,10 +2915,9 @@ def get_command_result( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -2748,59 +2926,54 @@ def get_command_result( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_command_result.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}"} # type: ignore - + get_command_result.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}"} # type: ignore @distributed_trace def list_outbound_network_dependencies_endpoints( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> Iterable[_models.OutboundEnvironmentEndpointCollection]: + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> Iterable["_models.OutboundEnvironmentEndpoint"]: """Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster. Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster. The operation returns properties of each egress endpoint. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OutboundEnvironmentEndpointCollection or the - result of cls(response) + :return: An iterator like instance of either OutboundEnvironmentEndpoint or the result of + cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_01_02_preview.models.OutboundEnvironmentEndpointCollection] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_01_02_preview.models.OutboundEnvironmentEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_outbound_network_dependencies_endpoints_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_outbound_network_dependencies_endpoints.metadata['url'], + template_url=self.list_outbound_network_dependencies_endpoints.metadata["url"], headers=_headers, params=_params, ) @@ -2808,16 +2981,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_outbound_network_dependencies_endpoints_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -2833,10 +3001,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2846,8 +3012,6 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_outbound_network_dependencies_endpoints.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints"} # type: ignore + list_outbound_network_dependencies_endpoints.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/operations/_operations.py index baca194ac48b..76daf8a47595 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/operations/_operations.py @@ -7,10 +7,15 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,38 +25,34 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - **kwargs: Any -) -> HttpRequest: + +def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.ContainerService/operations") # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class Operations: """ @@ -72,38 +73,33 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.OperationListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.OperationValue"]: """Gets a list of operations. Gets a list of operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationListResult or the result of cls(response) + :return: An iterator like instance of either OperationValue or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_01_02_preview.models.OperationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_01_02_preview.models.OperationValue] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -111,13 +107,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -133,10 +127,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -146,8 +138,6 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.ContainerService/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ContainerService/operations"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/operations/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/operations/_private_endpoint_connections_operations.py index b627f5767465..e55e556e4033 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/operations/_private_endpoint_connections_operations.py @@ -6,11 +6,15 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod @@ -21,173 +25,191 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - subscription_id: str, resource_group_name: str, resource_name: str, private_endpoint_connection_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_update_request( - subscription_id: str, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, - *, - json: Optional[_models.PrivateEndpointConnection] = None, - content: Any = None, + subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request_initial( - subscription_id: str, +def build_delete_request( resource_group_name: str, resource_name: str, private_endpoint_connection_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class PrivateEndpointConnectionsOperations: """ @@ -208,47 +230,40 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnectionListResult: """Gets a list of private endpoint connections in the specified managed cluster. To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnectionListResult, or the result of cls(response) + :return: PrivateEndpointConnectionListResult or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.PrivateEndpointConnectionListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnectionListResult] - request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -256,69 +271,60 @@ def list( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore - + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore @distributed_trace def get( - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnection: """Gets the specified private endpoint connection. To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -326,76 +332,148 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - @distributed_trace + @overload def update( self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, parameters: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateEndpointConnection: """Updates a private endpoint connection. Updates a private endpoint connection. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str - :param parameters: The updated private endpoint connection. + :param parameters: The updated private endpoint connection. Required. :type parameters: ~azure.mgmt.containerservice.v2022_01_02_preview.models.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: The updated private endpoint connection. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: Union[_models.PrivateEndpointConnection, IO], + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: The updated private endpoint connection. Is either a model type or a IO + type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2022_01_02_preview.models.PrivateEndpointConnection or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - _json = self._serialize.body(parameters, 'PrivateEndpointConnection') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateEndpointConnection") request = build_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update.metadata['url'], + content=_content, + template_url=self.update.metadata["url"], headers=_headers, params=_params, ) @@ -403,52 +481,43 @@ def update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -456,10 +525,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -469,26 +537,21 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + def begin_delete( + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> LROPoller[None]: """Deletes a private endpoint connection. Deletes a private endpoint connection. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -500,53 +563,46 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/operations/_private_link_resources_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/operations/_private_link_resources_operations.py index 32f47842d674..2a2532132fd7 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/operations/_private_link_resources_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/operations/_private_link_resources_operations.py @@ -8,9 +8,13 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -19,48 +23,53 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class PrivateLinkResourcesOperations: """ @@ -81,46 +90,39 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.PrivateLinkResourcesListResult: """Gets a list of private link resources in the specified managed cluster. To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResourcesListResult, or the result of cls(response) + :return: PrivateLinkResourcesListResult or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.PrivateLinkResourcesListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResourcesListResult] - request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -128,22 +130,20 @@ def list( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResourcesListResult', pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources"} # type: ignore - + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/operations/_resolve_private_link_service_id_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/operations/_resolve_private_link_service_id_operations.py index e68c052e8fe3..0a5c8e36684b 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/operations/_resolve_private_link_service_id_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/operations/_resolve_private_link_service_id_operations.py @@ -6,11 +6,15 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -19,56 +23,56 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_post_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.PrivateLinkResource] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + class ResolvePrivateLinkServiceIdOperations: """ @@ -89,52 +93,119 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @overload + def post( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.PrivateLinkResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID for the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters required in order to resolve a private link service ID. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_01_02_preview.models.PrivateLinkResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def post( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID for the specified managed cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters required in order to resolve a private link service ID. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def post( self, resource_group_name: str, resource_name: str, - parameters: _models.PrivateLinkResource, + parameters: Union[_models.PrivateLinkResource, IO], **kwargs: Any ) -> _models.PrivateLinkResource: """Gets the private link service ID for the specified managed cluster. Gets the private link service ID for the specified managed cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters required in order to resolve a private link service ID. + :param parameters: Parameters required in order to resolve a private link service ID. Is either + a model type or a IO type. Required. :type parameters: ~azure.mgmt.containerservice.v2022_01_02_preview.models.PrivateLinkResource + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResource, or the result of cls(response) + :return: PrivateLinkResource or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.PrivateLinkResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResource] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResource] - _json = self._serialize.body(parameters, 'PrivateLinkResource') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateLinkResource") request = build_post_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.post.metadata['url'], + content=_content, + template_url=self.post.metadata["url"], headers=_headers, params=_params, ) @@ -142,22 +213,20 @@ def post( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResource', pipeline_response) + deserialized = self._deserialize("PrivateLinkResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - post.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId"} # type: ignore - + post.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/operations/_snapshots_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/operations/_snapshots_operations.py index e8e5d4d31ae7..1f2c8fc5432c 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/operations/_snapshots_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/operations/_snapshots_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,243 +25,223 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots") path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_resource_group_request( - subscription_id: str, - resource_group_name: str, - **kwargs: Any -) -> HttpRequest: +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots", + ) # 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', min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: + _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, resource_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.Snapshot] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_update_tags_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.TagsObject] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}", + ) # 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', min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str", min_length=1), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class SnapshotsOperations: """ @@ -277,39 +262,34 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.SnapshotListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.Snapshot"]: """Gets a list of snapshots in the specified subscription. Gets a list of snapshots in the specified subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SnapshotListResult or the result of cls(response) + :return: An iterator like instance of either Snapshot or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_01_02_preview.models.SnapshotListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_01_02_preview.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SnapshotListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -317,14 +297,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -340,10 +317,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -353,48 +328,41 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots"} # type: ignore @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> Iterable[_models.SnapshotListResult]: + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Snapshot"]: """Lists snapshots in the specified subscription and resource group. Lists snapshots in the specified subscription and resource group. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SnapshotListResult or the result of cls(response) + :return: An iterator like instance of either Snapshot or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_01_02_preview.models.SnapshotListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_01_02_preview.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SnapshotListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -402,15 +370,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -426,10 +390,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -439,50 +401,40 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots"} # type: ignore @distributed_trace - def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.Snapshot: + def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.Snapshot: """Gets a snapshot. Gets a snapshot. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Snapshot, or the result of cls(response) + :return: Snapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.Snapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -490,71 +442,132 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - @distributed_trace + @overload def create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.Snapshot, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.Snapshot: """Creates or updates a snapshot. Creates or updates a snapshot. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The snapshot to create or update. + :param parameters: The snapshot to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_01_02_preview.models.Snapshot + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Snapshot, or the result of cls(response) + :return: Snapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.Snapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Snapshot: + """Creates or updates a snapshot. + + Creates or updates a snapshot. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The snapshot to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.Snapshot, IO], **kwargs: Any + ) -> _models.Snapshot: + """Creates or updates a snapshot. + + Creates or updates a snapshot. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The snapshot to create or update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.mgmt.containerservice.v2022_01_02_preview.models.Snapshot or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] - _json = self._serialize.body(parameters, 'Snapshot') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "Snapshot") request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) @@ -562,10 +575,9 @@ def create_or_update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -573,64 +585,126 @@ def create_or_update( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - - @distributed_trace + @overload def update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.Snapshot: """Updates tags on a snapshot. Updates tags on a snapshot. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update snapshot Tags operation. + :param parameters: Parameters supplied to the Update snapshot Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2022_01_02_preview.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Snapshot, or the result of cls(response) + :return: Snapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.Snapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + def update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Snapshot: + """Updates tags on a snapshot. + + Updates tags on a snapshot. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update snapshot Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> _models.Snapshot: + """Updates tags on a snapshot. + + Updates tags on a snapshot. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update snapshot Tags operation. Is either a model + type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_01_02_preview.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") request = build_update_tags_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_tags.metadata['url'], + content=_content, + template_url=self.update_tags.metadata["url"], headers=_headers, params=_params, ) @@ -638,64 +712,56 @@ def update_tags( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - + update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore @distributed_trace def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: """Deletes a snapshot. Deletes a snapshot. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) @@ -703,10 +769,9 @@ def delete( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -716,5 +781,4 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - + delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/__init__.py index 37a5f9e02e6f..a8716d29afe8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/__init__.py @@ -14,7 +14,8 @@ except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['ContainerServiceClient'] + +__all__ = ["ContainerServiceClient"] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/_configuration.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/_configuration.py index fe7f6bef66d5..a1d64437efc4 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/_configuration.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/_configuration.py @@ -18,29 +18,25 @@ VERSION = "unknown" + class ContainerServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ContainerServiceClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :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. + :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2022-02-01". 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: + def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ContainerServiceClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + api_version = kwargs.pop("api_version", "2022-02-01") # type: str if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -50,23 +46,24 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-containerservice/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-containerservice/{}".format(VERSION)) self._configure(**kwargs) def _configure( - self, - **kwargs # type: Any + self, **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/_container_service_client.py index 536e9ec317ab..c3f9724d37fb 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/_container_service_client.py @@ -9,20 +9,29 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from . import models +from .._serialization import Deserializer, Serializer from ._configuration import ContainerServiceClientConfiguration -from .operations import AgentPoolsOperations, MaintenanceConfigurationsOperations, ManagedClustersOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, ResolvePrivateLinkServiceIdOperations, SnapshotsOperations +from .operations import ( + AgentPoolsOperations, + MaintenanceConfigurationsOperations, + ManagedClustersOperations, + Operations, + PrivateEndpointConnectionsOperations, + PrivateLinkResourcesOperations, + ResolvePrivateLinkServiceIdOperations, + SnapshotsOperations, +) if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class ContainerServiceClient: # pylint: disable=too-many-instance-attributes + +class ContainerServiceClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """The Container Service Client. :ivar operations: Operations operations @@ -46,9 +55,9 @@ class ContainerServiceClient: # pylint: disable=too-many-instance-attributes azure.mgmt.containerservice.v2022_02_01.operations.ResolvePrivateLinkServiceIdOperations :ivar snapshots: SnapshotsOperations operations :vartype snapshots: azure.mgmt.containerservice.v2022_02_01.operations.SnapshotsOperations - :param credential: Credential needed for the client to connect to Azure. + :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. + :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -66,25 +75,23 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = ContainerServiceClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = ContainerServiceClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize - ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.managed_clusters = ManagedClustersOperations( self._client, self._config, self._serialize, self._deserialize ) self.maintenance_configurations = MaintenanceConfigurationsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.agent_pools = AgentPoolsOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) self.private_endpoint_connections = PrivateEndpointConnectionsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -94,16 +101,9 @@ def __init__( self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations( self._client, self._config, self._serialize, self._deserialize ) - self.snapshots = SnapshotsOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.snapshots = SnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) - - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> HttpResponse: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -112,7 +112,7 @@ def _send_request( >>> response = client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/_metadata.json b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/_metadata.json index 7527029de51b..d103f531e4eb 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/_metadata.json +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/_metadata.json @@ -10,20 +10,20 @@ "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { "credential": { - "signature": "credential, # type: \"TokenCredential\"", - "description": "Credential needed for the client to connect to Azure.", + "signature": "credential: \"TokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true }, "subscription_id": { - "signature": "subscription_id, # type: str", - "description": "The ID of the target subscription.", + "signature": "subscription_id: str,", + "description": "The ID of the target subscription. Required.", "docstring_type": "str", "required": true } @@ -31,13 +31,13 @@ "async": { "credential": { "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure.", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { "signature": "subscription_id: str,", - "description": "The ID of the target subscription.", + "description": "The ID of the target subscription. Required.", "docstring_type": "str", "required": true } @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=\"https://management.azure.com\", # type: str", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/_patch.py index 74e48ecd07cf..f99e77fef986 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/_patch.py @@ -28,4 +28,4 @@ # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + pass diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/_vendor.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/_vendor.py index 138f663c53a4..9aad73fc743e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/_vendor.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/_vendor.py @@ -7,6 +7,7 @@ from azure.core.pipeline.transport import HttpRequest + def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) @@ -14,6 +15,7 @@ def _convert_request(request, files=None): request.set_formdata_body(files) return request + def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -21,7 +23,5 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [ - c for c in formatted_components if "{}".format(key.args[0]) not in c - ] + components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/__init__.py index 37a5f9e02e6f..a8716d29afe8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/__init__.py @@ -14,7 +14,8 @@ except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['ContainerServiceClient'] + +__all__ = ["ContainerServiceClient"] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/_configuration.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/_configuration.py index e3d3f9e9b82d..8c064b3687a0 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/_configuration.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/_configuration.py @@ -18,29 +18,25 @@ VERSION = "unknown" + class ContainerServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ContainerServiceClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :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. + :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2022-02-01". 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: + def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ContainerServiceClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + api_version = kwargs.pop("api_version", "2022-02-01") # type: str if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -50,22 +46,21 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-containerservice/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-containerservice/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, - **kwargs: Any - ) -> None: - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/_container_service_client.py index 766f273d7b0c..7f9697476e4d 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/_container_service_client.py @@ -9,20 +9,29 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from .. import models +from ..._serialization import Deserializer, Serializer from ._configuration import ContainerServiceClientConfiguration -from .operations import AgentPoolsOperations, MaintenanceConfigurationsOperations, ManagedClustersOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, ResolvePrivateLinkServiceIdOperations, SnapshotsOperations +from .operations import ( + AgentPoolsOperations, + MaintenanceConfigurationsOperations, + ManagedClustersOperations, + Operations, + PrivateEndpointConnectionsOperations, + PrivateLinkResourcesOperations, + ResolvePrivateLinkServiceIdOperations, + SnapshotsOperations, +) if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class ContainerServiceClient: # pylint: disable=too-many-instance-attributes + +class ContainerServiceClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """The Container Service Client. :ivar operations: Operations operations @@ -47,9 +56,9 @@ class ContainerServiceClient: # pylint: disable=too-many-instance-attributes azure.mgmt.containerservice.v2022_02_01.aio.operations.ResolvePrivateLinkServiceIdOperations :ivar snapshots: SnapshotsOperations operations :vartype snapshots: azure.mgmt.containerservice.v2022_02_01.aio.operations.SnapshotsOperations - :param credential: Credential needed for the client to connect to Azure. + :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. + :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -67,25 +76,23 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = ContainerServiceClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = ContainerServiceClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize - ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.managed_clusters = ManagedClustersOperations( self._client, self._config, self._serialize, self._deserialize ) self.maintenance_configurations = MaintenanceConfigurationsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.agent_pools = AgentPoolsOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) self.private_endpoint_connections = PrivateEndpointConnectionsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -95,16 +102,9 @@ def __init__( self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations( self._client, self._config, self._serialize, self._deserialize ) - self.snapshots = SnapshotsOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.snapshots = SnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) - - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -113,7 +113,7 @@ def _send_request( >>> response = await client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/_patch.py index 74e48ecd07cf..f99e77fef986 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/_patch.py @@ -28,4 +28,4 @@ # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + pass diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/operations/__init__.py index e0748876288c..593b23075ce0 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/operations/__init__.py @@ -18,15 +18,16 @@ from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'Operations', - 'ManagedClustersOperations', - 'MaintenanceConfigurationsOperations', - 'AgentPoolsOperations', - 'PrivateEndpointConnectionsOperations', - 'PrivateLinkResourcesOperations', - 'ResolvePrivateLinkServiceIdOperations', - 'SnapshotsOperations', + "Operations", + "ManagedClustersOperations", + "MaintenanceConfigurationsOperations", + "AgentPoolsOperations", + "PrivateEndpointConnectionsOperations", + "PrivateLinkResourcesOperations", + "ResolvePrivateLinkServiceIdOperations", + "SnapshotsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/operations/_agent_pools_operations.py index afc340cad47d..8c32336fd359 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/operations/_agent_pools_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +29,20 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._agent_pools_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_available_agent_pool_versions_request, build_get_request, build_get_upgrade_profile_request, build_list_request, build_upgrade_node_image_version_request_initial -T = TypeVar('T') +from ...operations._agent_pools_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_available_agent_pool_versions_request, + build_get_request, + build_get_upgrade_profile_request, + build_list_request, + build_upgrade_node_image_version_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class AgentPoolsOperations: """ .. warning:: @@ -45,47 +62,41 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.AgentPoolListResult]: + def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncIterable["_models.AgentPool"]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AgentPoolListResult or the result of cls(response) + :return: An iterator like instance of either AgentPool or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_02_01.models.AgentPoolListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_02_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -93,16 +104,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -118,10 +124,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -131,54 +135,46 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore @distributed_trace_async async def get( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPool: """Gets the specified managed cluster agent pool. Gets the specified managed cluster agent pool. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPool, or the result of cls(response) + :return: AgentPool or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.AgentPool - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -186,57 +182,60 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore async def _create_or_update_initial( self, resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: _models.AgentPool, + parameters: Union[_models.AgentPool, IO], **kwargs: Any ) -> _models.AgentPool: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - _json = self._serialize.body(parameters, 'AgentPool') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "AgentPool") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -244,10 +243,9 @@ async def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -255,26 +253,27 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - - @distributed_trace_async + @overload async def begin_create_or_update( self, resource_group_name: str, resource_name: str, agent_pool_name: str, parameters: _models.AgentPool, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.AgentPool]: """Creates or updates an agent pool in the specified managed cluster. @@ -282,13 +281,59 @@ async def begin_create_or_update( Creates or updates an agent pool in the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str - :param parameters: The agent pool to create or update. + :param parameters: The agent pool to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_02_01.models.AgentPool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AgentPool or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_02_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AgentPool]: + """Creates or updates an agent pool in the specified managed cluster. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: The agent pool to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -301,20 +346,58 @@ async def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_02_01.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: Union[_models.AgentPool, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.AgentPool]: + """Creates or updates an agent pool in the specified managed cluster. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: The agent pool to create or update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.mgmt.containerservice.v2022_02_01.models.AgentPool or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AgentPool or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_02_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -323,66 +406,55 @@ async def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -390,10 +462,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -403,26 +474,22 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + async def begin_delete( + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes an agent pool in the specified managed cluster. Deletes an agent pool in the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -434,99 +501,86 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace_async async def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPoolUpgradeProfile: """Gets the upgrade profile for an agent pool. Gets the upgrade profile for an agent pool. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolUpgradeProfile, or the result of cls(response) + :return: AgentPoolUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.AgentPoolUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -534,32 +588,27 @@ async def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolUpgradeProfile', pipeline_response) + deserialized = self._deserialize("AgentPoolUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore @distributed_trace_async async def get_available_agent_pool_versions( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported Kubernetes versions for the specified agent pool. @@ -568,32 +617,30 @@ async def get_available_agent_pool_versions( the version lifecycle. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolAvailableVersions, or the result of cls(response) + :return: AgentPoolAvailableVersions or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.AgentPoolAvailableVersions - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolAvailableVersions] - request = build_get_available_agent_pool_versions_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_available_agent_pool_versions.metadata['url'], + template_url=self.get_available_agent_pool_versions.metadata["url"], headers=_headers, params=_params, ) @@ -601,52 +648,43 @@ async def get_available_agent_pool_versions( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolAvailableVersions', pipeline_response) + deserialized = self._deserialize("AgentPoolAvailableVersions", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_available_agent_pool_versions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore - + get_available_agent_pool_versions.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore async def _upgrade_node_image_version_initial( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> Optional[_models.AgentPool]: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.AgentPool]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.AgentPool]] - - request = build_upgrade_node_image_version_request_initial( - subscription_id=self._config.subscription_id, + request = build_upgrade_node_image_version_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._upgrade_node_image_version_initial.metadata['url'], + template_url=self._upgrade_node_image_version_initial.metadata["url"], headers=_headers, params=_params, ) @@ -654,10 +692,9 @@ async def _upgrade_node_image_version_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -667,26 +704,23 @@ async def _upgrade_node_image_version_initial( deserialized = None response_headers = {} if response.status_code == 202: - response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) - - deserialized = self._deserialize('AgentPool', pipeline_response) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _upgrade_node_image_version_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore - + _upgrade_node_image_version_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore @distributed_trace_async async def begin_upgrade_node_image_version( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any - ) -> AsyncLROPoller[_models.AgentPool]: + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: """Upgrades the node image version of an agent pool to the latest. Upgrading the node image version of an agent pool applies the newest OS and runtime updates to @@ -694,10 +728,11 @@ async def begin_upgrade_node_image_version( node image versions, see: https://docs.microsoft.com/azure/aks/node-image-upgrade. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -711,59 +746,54 @@ async def begin_upgrade_node_image_version( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_02_01.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._upgrade_node_image_version_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) - - deserialized = self._deserialize('AgentPool', pipeline_response) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_upgrade_node_image_version.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore + begin_upgrade_node_image_version.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/operations/_maintenance_configurations_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/operations/_maintenance_configurations_operations.py index 44711e0f7b9c..9530f77f67e9 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/operations/_maintenance_configurations_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/operations/_maintenance_configurations_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,10 +27,17 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._maintenance_configurations_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_managed_cluster_request -T = TypeVar('T') +from ...operations._maintenance_configurations_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_managed_cluster_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class MaintenanceConfigurationsOperations: """ .. warning:: @@ -43,48 +57,44 @@ def __init__(self, *args, **kwargs) -> None: 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_managed_cluster( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.MaintenanceConfigurationListResult]: + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> AsyncIterable["_models.MaintenanceConfiguration"]: """Gets a list of maintenance configurations in the specified managed cluster. Gets a list of maintenance configurations in the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either MaintenanceConfigurationListResult or the result - of cls(response) + :return: An iterator like instance of either MaintenanceConfiguration or the result of + cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_02_01.models.MaintenanceConfigurationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_02_01.models.MaintenanceConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfigurationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfigurationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_managed_cluster_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_managed_cluster.metadata['url'], + template_url=self.list_by_managed_cluster.metadata["url"], headers=_headers, params=_params, ) @@ -92,16 +102,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_managed_cluster_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -117,10 +122,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -130,54 +133,46 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_managed_cluster.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations"} # type: ignore + list_by_managed_cluster.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations"} # type: ignore @distributed_trace_async async def get( - self, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, config_name: str, **kwargs: Any ) -> _models.MaintenanceConfiguration: """Gets the specified maintenance configuration of a managed cluster. Gets the specified maintenance configuration of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: MaintenanceConfiguration, or the result of cls(response) + :return: MaintenanceConfiguration or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.MaintenanceConfiguration - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfiguration] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -185,33 +180,33 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) + deserialized = self._deserialize("MaintenanceConfiguration", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - @distributed_trace_async + @overload async def create_or_update( self, resource_group_name: str, resource_name: str, config_name: str, parameters: _models.MaintenanceConfiguration, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.MaintenanceConfiguration: """Creates or updates a maintenance configuration in the specified managed cluster. @@ -219,41 +214,116 @@ async def create_or_update( Creates or updates a maintenance configuration in the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str - :param parameters: The maintenance configuration to create or update. + :param parameters: The maintenance configuration to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_02_01.models.MaintenanceConfiguration + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: MaintenanceConfiguration, or the result of cls(response) + :return: MaintenanceConfiguration or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.MaintenanceConfiguration - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configuration in the specified managed cluster. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: The maintenance configuration to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: Union[_models.MaintenanceConfiguration, IO], + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configuration in the specified managed cluster. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: The maintenance configuration to create or update. Is either a model type or + a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_02_01.models.MaintenanceConfiguration or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfiguration] - _json = self._serialize.body(parameters, 'MaintenanceConfiguration') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "MaintenanceConfiguration") request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) @@ -261,68 +331,60 @@ async def create_or_update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) + deserialized = self._deserialize("MaintenanceConfiguration", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, config_name: str, **kwargs: Any ) -> None: """Deletes a maintenance configuration. Deletes a maintenance configuration. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) @@ -330,10 +392,9 @@ async def delete( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -343,5 +404,4 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/operations/_managed_clusters_operations.py index be5ee6420fcc..b7ef4c61c87e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/operations/_managed_clusters_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +29,33 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._managed_clusters_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_access_profile_request, build_get_command_result_request, build_get_os_options_request, build_get_request, build_get_upgrade_profile_request, build_list_by_resource_group_request, build_list_cluster_admin_credentials_request, build_list_cluster_monitoring_user_credentials_request, build_list_cluster_user_credentials_request, build_list_outbound_network_dependencies_endpoints_request, build_list_request, build_reset_aad_profile_request_initial, build_reset_service_principal_profile_request_initial, build_rotate_cluster_certificates_request_initial, build_run_command_request_initial, build_start_request_initial, build_stop_request_initial, build_update_tags_request_initial -T = TypeVar('T') +from ...operations._managed_clusters_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_access_profile_request, + build_get_command_result_request, + build_get_os_options_request, + build_get_request, + build_get_upgrade_profile_request, + build_list_by_resource_group_request, + build_list_cluster_admin_credentials_request, + build_list_cluster_monitoring_user_credentials_request, + build_list_cluster_user_credentials_request, + build_list_outbound_network_dependencies_endpoints_request, + build_list_request, + build_reset_aad_profile_request, + build_reset_service_principal_profile_request, + build_rotate_cluster_certificates_request, + build_run_command_request, + build_start_request, + build_stop_request, + build_update_tags_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class ManagedClustersOperations: # pylint: disable=too-many-public-methods """ .. warning:: @@ -45,46 +75,39 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async async def get_os_options( - self, - location: str, - resource_type: Optional[str] = None, - **kwargs: Any + self, location: str, resource_type: Optional[str] = None, **kwargs: Any ) -> _models.OSOptionProfile: """Gets supported OS options in the specified subscription. Gets supported OS options in the specified subscription. - :param location: The name of Azure region. + :param location: The name of Azure region. Required. :type location: str :param resource_type: The resource type for which the OS options needs to be returned. Default value is None. :type resource_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: OSOptionProfile, or the result of cls(response) + :return: OSOptionProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.OSOptionProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OSOptionProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OSOptionProfile] - request = build_get_os_options_request( - subscription_id=self._config.subscription_id, location=location, - api_version=api_version, + subscription_id=self._config.subscription_id, resource_type=resource_type, - template_url=self.get_os_options.metadata['url'], + api_version=api_version, + template_url=self.get_os_options.metadata["url"], headers=_headers, params=_params, ) @@ -92,59 +115,52 @@ async def get_os_options( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('OSOptionProfile', pipeline_response) + deserialized = self._deserialize("OSOptionProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_os_options.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default"} # type: ignore - + get_os_options.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default"} # type: ignore @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.ManagedClusterListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.ManagedCluster"]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_02_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_02_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -152,14 +168,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -175,10 +188,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -188,49 +199,44 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.ManagedClusterListResult]: + self, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ManagedCluster"]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_02_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_02_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -238,15 +244,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -262,10 +264,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -275,50 +275,43 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace_async async def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.ManagedClusterUpgradeProfile: """Gets the upgrade profile of a managed cluster. Gets the upgrade profile of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterUpgradeProfile, or the result of cls(response) + :return: ManagedClusterUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.ManagedClusterUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -326,33 +319,27 @@ async def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterUpgradeProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore @distributed_trace_async async def get_access_profile( - self, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, role_name: str, **kwargs: Any ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. @@ -362,35 +349,33 @@ async def get_access_profile( `_ . :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param role_name: The name of the role for managed cluster accessProfile resource. + :param role_name: The name of the role for managed cluster accessProfile resource. Required. :type role_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterAccessProfile, or the result of cls(response) + :return: ManagedClusterAccessProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.ManagedClusterAccessProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterAccessProfile] - request = build_get_access_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, role_name=role_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_access_profile.metadata['url'], + template_url=self.get_access_profile.metadata["url"], headers=_headers, params=_params, ) @@ -398,68 +383,60 @@ async def get_access_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterAccessProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterAccessProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_access_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore - + get_access_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore @distributed_trace_async async def list_cluster_admin_credentials( - self, - resource_group_name: str, - resource_name: str, - server_fqdn: Optional[str] = None, - **kwargs: Any + self, resource_group_name: str, resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any ) -> _models.CredentialResults: """Lists the admin credentials of a managed cluster. Lists the admin credentials of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_admin_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, - template_url=self.list_cluster_admin_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_admin_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -467,25 +444,23 @@ async def list_cluster_admin_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_admin_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore - + list_cluster_admin_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore @distributed_trace_async async def list_cluster_user_credentials( @@ -501,40 +476,39 @@ async def list_cluster_user_credentials( Lists the user credentials of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :param format: Only apply to AAD clusters, specifies the format of returned kubeconfig. Format 'azure' will return azure auth-provider kubeconfig; format 'exec' will return exec format - kubeconfig, which requires kubelogin binary in the path. Default value is None. + kubeconfig, which requires kubelogin binary in the path. Known values are: "azure" and "exec". + Default value is None. :type format: str or ~azure.mgmt.containerservice.v2022_02_01.models.Format :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, format=format, - template_url=self.list_cluster_user_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -542,68 +516,60 @@ async def list_cluster_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore - + list_cluster_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore @distributed_trace_async async def list_cluster_monitoring_user_credentials( - self, - resource_group_name: str, - resource_name: str, - server_fqdn: Optional[str] = None, - **kwargs: Any + self, resource_group_name: str, resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any ) -> _models.CredentialResults: """Lists the cluster monitoring user credentials of a managed cluster. Lists the cluster monitoring user credentials of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_monitoring_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, - template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_monitoring_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -611,64 +577,55 @@ async def list_cluster_monitoring_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_monitoring_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore - + list_cluster_monitoring_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore @distributed_trace_async - async def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.ManagedCluster: + async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.ManagedCluster: """Gets a managed cluster. Gets a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedCluster, or the result of cls(response) + :return: ManagedCluster or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.ManagedCluster - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -676,55 +633,54 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _create_or_update_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.ManagedCluster, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'ManagedCluster') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedCluster") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -732,10 +688,9 @@ async def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -743,25 +698,26 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - - @distributed_trace_async + @overload async def begin_create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedCluster, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. @@ -769,11 +725,15 @@ async def begin_create_or_update( Creates or updates a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The managed cluster to create or update. + :param parameters: The managed cluster to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_02_01.models.ManagedCluster + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -786,20 +746,90 @@ async def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_02_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_02_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster to create or update. Is either a model type or a IO + type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_02_01.models.ManagedCluster or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_02_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -807,69 +837,66 @@ async def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _update_tags_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.TagsObject, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request_initial( - subscription_id=self._config.subscription_id, + request = build_update_tags_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_tags_initial.metadata['url'], + content=_content, + template_url=self._update_tags_initial.metadata["url"], headers=_headers, params=_params, ) @@ -877,32 +904,32 @@ async def _update_tags_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_tags_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _update_tags_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - @distributed_trace_async + @overload async def begin_update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. @@ -910,11 +937,15 @@ async def begin_update_tags( Updates tags on a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2022_02_01.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -927,20 +958,90 @@ async def begin_update_tags( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_02_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates tags on a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_02_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates tags on a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_02_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_02_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, @@ -948,64 +1049,54 @@ async def begin_update_tags( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1013,10 +1104,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1026,23 +1116,18 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: + async def begin_delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Deletes a managed cluster. Deletes a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1054,85 +1139,83 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterServicePrincipalProfile, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterServicePrincipalProfile") - request = build_reset_service_principal_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_service_principal_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_service_principal_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_service_principal_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1140,10 +1223,9 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1153,15 +1235,16 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist if cls: return cls(pipeline_response, None, {}) - _reset_service_principal_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + _reset_service_principal_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore - - @distributed_trace_async - async def begin_reset_service_principal_profile( # pylint: disable=inconsistent-return-statements + @overload + async def begin_reset_service_principal_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterServicePrincipalProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: """Reset the Service Principal Profile of a managed cluster. @@ -1169,12 +1252,53 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent This action cannot be performed on a cluster that is not using a service principal. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The service principal profile to set on the managed cluster. + :param parameters: The service principal profile to set on the managed cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2022_02_01.models.ManagedClusterServicePrincipalProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset the Service Principal Profile of a managed cluster. + + This action cannot be performed on a cluster that is not using a service principal. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The service principal profile to set on the managed cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -1185,20 +1309,54 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset the Service Principal Profile of a managed cluster. + + This action cannot be performed on a cluster that is not using a service principal. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The service principal profile to set on the managed cluster. Is either a + model type or a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2022_02_01.models.ManagedClusterServicePrincipalProfile or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1206,67 +1364,68 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_service_principal_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + begin_reset_service_principal_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterAADProfile, + parameters: Union[_models.ManagedClusterAADProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterAADProfile") - request = build_reset_aad_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_aad_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_aad_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_aad_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1274,10 +1433,9 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1287,15 +1445,16 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta if cls: return cls(pipeline_response, None, {}) - _reset_aad_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - + _reset_aad_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - @distributed_trace_async - async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements + @overload + async def begin_reset_aad_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterAADProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: """Reset the AAD Profile of a managed cluster. @@ -1303,11 +1462,52 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem Reset the AAD Profile of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The AAD profile to set on the Managed Cluster. + :param parameters: The AAD profile to set on the Managed Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2022_02_01.models.ManagedClusterAADProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset the AAD Profile of a managed cluster. + + Reset the AAD Profile of a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The AAD profile to set on the Managed Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -1318,20 +1518,54 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterAADProfile, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset the AAD Profile of a managed cluster. + + Reset the AAD Profile of a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The AAD profile to set on the Managed Cluster. Is either a model type or a + IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_02_01.models.ManagedClusterAADProfile or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1339,62 +1573,52 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_aad_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + begin_reset_aad_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_rotate_cluster_certificates_request_initial( - subscription_id=self._config.subscription_id, + request = build_rotate_cluster_certificates_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._rotate_cluster_certificates_initial.metadata['url'], + template_url=self._rotate_cluster_certificates_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1402,10 +1626,9 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1415,15 +1638,11 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- if cls: return cls(pipeline_response, None, {}) - _rotate_cluster_certificates_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore - + _rotate_cluster_certificates_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore @distributed_trace_async - async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + async def begin_rotate_cluster_certificates( + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Rotates the certificates of a managed cluster. @@ -1431,8 +1650,9 @@ async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-ret more details about rotating managed cluster certificates. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1444,80 +1664,67 @@ async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-ret Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._rotate_cluster_certificates_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_rotate_cluster_certificates.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore + begin_rotate_cluster_certificates.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore async def _stop_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_stop_request_initial( - subscription_id=self._config.subscription_id, + request = build_stop_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._stop_initial.metadata['url'], + template_url=self._stop_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1525,10 +1732,9 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1538,16 +1744,10 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore - + _stop_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore @distributed_trace_async - async def begin_stop( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: + async def begin_stop(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Stops a Managed Cluster. This can only be performed on Azure Virtual Machine Scale set backed clusters. Stopping a @@ -1557,8 +1757,9 @@ async def begin_stop( # pylint: disable=inconsistent-return-statements cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1570,80 +1771,67 @@ async def begin_stop( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._stop_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore + begin_stop.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore async def _start_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_start_request_initial( - subscription_id=self._config.subscription_id, + request = build_start_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._start_initial.metadata['url'], + template_url=self._start_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1651,10 +1839,9 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1664,24 +1851,19 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore - + _start_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore @distributed_trace_async - async def begin_start( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: + async def begin_start(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Starts a previously stopped Managed Cluster. See `starting a cluster `_ for more details about starting a cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1693,85 +1875,83 @@ async def begin_start( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._start_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore + begin_start.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore async def _run_command_initial( self, resource_group_name: str, resource_name: str, - request_payload: _models.RunCommandRequest, + request_payload: Union[_models.RunCommandRequest, IO], **kwargs: Any ) -> Optional[_models.RunCommandResult]: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RunCommandResult]] - _json = self._serialize.body(request_payload, 'RunCommandRequest') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(request_payload, (IO, bytes)): + _content = request_payload + else: + _json = self._serialize.body(request_payload, "RunCommandRequest") - request = build_run_command_request_initial( - subscription_id=self._config.subscription_id, + request = build_run_command_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._run_command_initial.metadata['url'], + content=_content, + template_url=self._run_command_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1779,10 +1959,9 @@ async def _run_command_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1791,22 +1970,23 @@ async def _run_command_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _run_command_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore + _run_command_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore - - @distributed_trace_async + @overload async def begin_run_command( self, resource_group_name: str, resource_name: str, request_payload: _models.RunCommandRequest, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.RunCommandResult]: """Submits a command to run against the Managed Cluster. @@ -1816,11 +1996,15 @@ async def begin_run_command( `_. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param request_payload: The run command request. + :param request_payload: The run command request. Required. :type request_payload: ~azure.mgmt.containerservice.v2022_02_01.models.RunCommandRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -1833,20 +2017,97 @@ async def begin_run_command( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_02_01.models.RunCommandResult] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_run_command( + self, + resource_group_name: str, + resource_name: str, + request_payload: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.RunCommandResult]: + """Submits a command to run against the Managed Cluster. + + AKS will create a pod to run the command. This is primarily useful for private clusters. For + more information see `AKS Run Command + `_. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param request_payload: The run command request. Required. + :type request_payload: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RunCommandResult or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_02_01.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_run_command( + self, + resource_group_name: str, + resource_name: str, + request_payload: Union[_models.RunCommandRequest, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.RunCommandResult]: + """Submits a command to run against the Managed Cluster. + + AKS will create a pod to run the command. This is primarily useful for private clusters. For + more information see `AKS Run Command + `_. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param request_payload: The run command request. Is either a model type or a IO type. Required. + :type request_payload: ~azure.mgmt.containerservice.v2022_02_01.models.RunCommandRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RunCommandResult or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_02_01.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.RunCommandResult] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.RunCommandResult] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._run_command_initial( # type: ignore resource_group_name=resource_group_name, @@ -1854,82 +2115,72 @@ async def begin_run_command( request_payload=request_payload, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_run_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore + begin_run_command.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore @distributed_trace_async async def get_command_result( - self, - resource_group_name: str, - resource_name: str, - command_id: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, command_id: str, **kwargs: Any ) -> Optional[_models.RunCommandResult]: """Gets the results of a command which has been run on the Managed Cluster. Gets the results of a command which has been run on the Managed Cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param command_id: Id of the command. + :param command_id: Id of the command. Required. :type command_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: RunCommandResult, or the result of cls(response) + :return: RunCommandResult or None or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.RunCommandResult or None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RunCommandResult]] - request = build_get_command_result_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, command_id=command_id, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_command_result.metadata['url'], + template_url=self.get_command_result.metadata["url"], headers=_headers, params=_params, ) @@ -1937,10 +2188,9 @@ async def get_command_result( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1949,23 +2199,19 @@ async def get_command_result( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_command_result.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}"} # type: ignore - + get_command_result.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}"} # type: ignore @distributed_trace def list_outbound_network_dependencies_endpoints( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.OutboundEnvironmentEndpointCollection]: + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> AsyncIterable["_models.OutboundEnvironmentEndpoint"]: """Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster. @@ -1973,35 +2219,35 @@ def list_outbound_network_dependencies_endpoints( specified managed cluster. The operation returns properties of each egress endpoint. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OutboundEnvironmentEndpointCollection or the - result of cls(response) + :return: An iterator like instance of either OutboundEnvironmentEndpoint or the result of + cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_02_01.models.OutboundEnvironmentEndpointCollection] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_02_01.models.OutboundEnvironmentEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_outbound_network_dependencies_endpoints_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_outbound_network_dependencies_endpoints.metadata['url'], + template_url=self.list_outbound_network_dependencies_endpoints.metadata["url"], headers=_headers, params=_params, ) @@ -2009,16 +2255,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_outbound_network_dependencies_endpoints_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -2034,10 +2275,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2047,8 +2286,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_outbound_network_dependencies_endpoints.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints"} # type: ignore + list_outbound_network_dependencies_endpoints.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/operations/_operations.py index e6f8ca5259ae..d4f62778b86d 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/operations/_operations.py @@ -7,9 +7,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,9 +27,11 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._operations import build_list_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class Operations: """ .. warning:: @@ -42,38 +51,33 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.OperationListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.OperationValue"]: """Gets a list of operations. Gets a list of operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationListResult or the result of cls(response) + :return: An iterator like instance of either OperationValue or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_02_01.models.OperationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_02_01.models.OperationValue] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -81,13 +85,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -103,10 +105,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -116,8 +116,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.ContainerService/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ContainerService/operations"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/operations/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/operations/_private_endpoint_connections_operations.py index 1476dca05cd9..2455803277ee 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/operations/_private_endpoint_connections_operations.py @@ -6,9 +6,15 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -20,10 +26,17 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._private_endpoint_connections_operations import build_delete_request_initial, build_get_request, build_list_request, build_update_request -T = TypeVar('T') +from ...operations._private_endpoint_connections_operations import ( + build_delete_request, + build_get_request, + build_list_request, + build_update_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class PrivateEndpointConnectionsOperations: """ .. warning:: @@ -43,13 +56,9 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async async def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnectionListResult: """Gets a list of private endpoint connections in the specified managed cluster. @@ -57,32 +66,30 @@ async def list( https://docs.microsoft.com/azure/aks/private-clusters. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnectionListResult, or the result of cls(response) + :return: PrivateEndpointConnectionListResult or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.PrivateEndpointConnectionListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnectionListResult] - request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -90,33 +97,27 @@ async def list( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore - + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore @distributed_trace_async async def get( - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnection: """Gets the specified private endpoint connection. @@ -124,35 +125,33 @@ async def get( https://docs.microsoft.com/azure/aks/private-clusters. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -160,33 +159,33 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - - @distributed_trace_async + @overload async def update( self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, parameters: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateEndpointConnection: """Updates a private endpoint connection. @@ -194,41 +193,116 @@ async def update( Updates a private endpoint connection. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str - :param parameters: The updated private endpoint connection. + :param parameters: The updated private endpoint connection. Required. :type parameters: ~azure.mgmt.containerservice.v2022_02_01.models.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + async def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: The updated private endpoint connection. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: Union[_models.PrivateEndpointConnection, IO], + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: The updated private endpoint connection. Is either a model type or a IO + type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_02_01.models.PrivateEndpointConnection or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - _json = self._serialize.body(parameters, 'PrivateEndpointConnection') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateEndpointConnection") request = build_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update.metadata['url'], + content=_content, + template_url=self.update.metadata["url"], headers=_headers, params=_params, ) @@ -236,52 +310,43 @@ async def update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -289,10 +354,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -302,26 +366,22 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + async def begin_delete( + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes a private endpoint connection. Deletes a private endpoint connection. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -333,53 +393,46 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/operations/_private_link_resources_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/operations/_private_link_resources_operations.py index 93e417b01fb8..6e998ffd1d0a 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/operations/_private_link_resources_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/operations/_private_link_resources_operations.py @@ -8,7 +8,13 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -19,9 +25,11 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._private_link_resources_operations import build_list_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class PrivateLinkResourcesOperations: """ .. warning:: @@ -41,13 +49,9 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async async def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.PrivateLinkResourcesListResult: """Gets a list of private link resources in the specified managed cluster. @@ -55,32 +59,30 @@ async def list( https://docs.microsoft.com/azure/aks/private-clusters. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResourcesListResult, or the result of cls(response) + :return: PrivateLinkResourcesListResult or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.PrivateLinkResourcesListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResourcesListResult] - request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -88,22 +90,20 @@ async def list( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResourcesListResult', pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources"} # type: ignore - + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/operations/_resolve_private_link_service_id_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/operations/_resolve_private_link_service_id_operations.py index b108d8b0990f..8147057ce0af 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/operations/_resolve_private_link_service_id_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/operations/_resolve_private_link_service_id_operations.py @@ -6,9 +6,15 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -19,9 +25,11 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._resolve_private_link_service_id_operations import build_post_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class ResolvePrivateLinkServiceIdOperations: """ .. warning:: @@ -41,13 +49,14 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async + @overload async def post( self, resource_group_name: str, resource_name: str, parameters: _models.PrivateLinkResource, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateLinkResource: """Gets the private link service ID for the specified managed cluster. @@ -55,38 +64,106 @@ async def post( Gets the private link service ID for the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters required in order to resolve a private link service ID. + :param parameters: Parameters required in order to resolve a private link service ID. Required. :type parameters: ~azure.mgmt.containerservice.v2022_02_01.models.PrivateLinkResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def post( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID for the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters required in order to resolve a private link service ID. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResource, or the result of cls(response) + :return: PrivateLinkResource or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.PrivateLinkResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @distributed_trace_async + async def post( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.PrivateLinkResource, IO], + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID for the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters required in order to resolve a private link service ID. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_02_01.models.PrivateLinkResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResource] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResource] - _json = self._serialize.body(parameters, 'PrivateLinkResource') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateLinkResource") request = build_post_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.post.metadata['url'], + content=_content, + template_url=self.post.metadata["url"], headers=_headers, params=_params, ) @@ -94,22 +171,20 @@ async def post( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResource', pipeline_response) + deserialized = self._deserialize("PrivateLinkResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - post.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId"} # type: ignore - + post.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/operations/_snapshots_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/operations/_snapshots_operations.py index 4085de32aac4..ab11f02a7b91 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/operations/_snapshots_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/operations/_snapshots_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,10 +27,19 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._snapshots_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_resource_group_request, build_list_request, build_update_tags_request -T = TypeVar('T') +from ...operations._snapshots_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_resource_group_request, + build_list_request, + build_update_tags_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class SnapshotsOperations: """ .. warning:: @@ -43,39 +59,34 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.SnapshotListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.Snapshot"]: """Gets a list of snapshots in the specified subscription. Gets a list of snapshots in the specified subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SnapshotListResult or the result of cls(response) + :return: An iterator like instance of either Snapshot or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_02_01.models.SnapshotListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_02_01.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SnapshotListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -83,14 +94,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -106,10 +114,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -119,48 +125,42 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots"} # type: ignore @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.SnapshotListResult]: + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.Snapshot"]: """Lists snapshots in the specified subscription and resource group. Lists snapshots in the specified subscription and resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SnapshotListResult or the result of cls(response) + :return: An iterator like instance of either Snapshot or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_02_01.models.SnapshotListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_02_01.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SnapshotListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -168,15 +168,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -192,10 +188,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -205,50 +199,41 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots"} # type: ignore @distributed_trace_async - async def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.Snapshot: + async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.Snapshot: """Gets a snapshot. Gets a snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Snapshot, or the result of cls(response) + :return: Snapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.Snapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -256,32 +241,32 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - - @distributed_trace_async + @overload async def create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.Snapshot, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.Snapshot: """Creates or updates a snapshot. @@ -289,38 +274,102 @@ async def create_or_update( Creates or updates a snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The snapshot to create or update. + :param parameters: The snapshot to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_02_01.models.Snapshot + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Snapshot, or the result of cls(response) + :return: Snapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.Snapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Snapshot: + """Creates or updates a snapshot. + + Creates or updates a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The snapshot to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.Snapshot, IO], **kwargs: Any + ) -> _models.Snapshot: + """Creates or updates a snapshot. + + Creates or updates a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The snapshot to create or update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.mgmt.containerservice.v2022_02_01.models.Snapshot or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] - _json = self._serialize.body(parameters, 'Snapshot') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "Snapshot") request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) @@ -328,10 +377,9 @@ async def create_or_update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -339,25 +387,26 @@ async def create_or_update( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - @distributed_trace_async + @overload async def update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.Snapshot: """Updates tags on a snapshot. @@ -365,38 +414,102 @@ async def update_tags( Updates tags on a snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update snapshot Tags operation. + :param parameters: Parameters supplied to the Update snapshot Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2022_02_01.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Snapshot: + """Updates tags on a snapshot. + + Updates tags on a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update snapshot Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Snapshot, or the result of cls(response) + :return: Snapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.Snapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @distributed_trace_async + async def update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> _models.Snapshot: + """Updates tags on a snapshot. + + Updates tags on a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update snapshot Tags operation. Is either a model + type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_02_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") request = build_update_tags_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_tags.metadata['url'], + content=_content, + template_url=self.update_tags.metadata["url"], headers=_headers, params=_params, ) @@ -404,64 +517,57 @@ async def update_tags( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - + update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: """Deletes a snapshot. Deletes a snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) @@ -469,10 +575,9 @@ async def delete( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -482,5 +587,4 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - + delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/models/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/models/__init__.py index 1527884a3c86..f4c515218928 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/models/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/models/__init__.py @@ -93,171 +93,169 @@ from ._models_py3 import UserAssignedIdentity from ._models_py3 import WindowsGmsaProfile - -from ._container_service_client_enums import ( - AgentPoolMode, - AgentPoolType, - Code, - ConnectionStatus, - ContainerServiceStorageProfileTypes, - ContainerServiceVMSizeTypes, - Count, - CreatedByType, - Expander, - ExtendedLocationTypes, - Format, - GPUInstanceProfile, - IpFamily, - KubeletDiskType, - LicenseType, - LoadBalancerSku, - ManagedClusterPodIdentityProvisioningState, - ManagedClusterSKUName, - ManagedClusterSKUTier, - NetworkMode, - NetworkPlugin, - NetworkPolicy, - OSDiskType, - OSSKU, - OSType, - OutboundType, - PrivateEndpointConnectionProvisioningState, - PublicNetworkAccess, - ResourceIdentityType, - ScaleDownMode, - ScaleSetEvictionPolicy, - ScaleSetPriority, - SnapshotType, - UpgradeChannel, - WeekDay, - WorkloadRuntime, -) +from ._container_service_client_enums import AgentPoolMode +from ._container_service_client_enums import AgentPoolType +from ._container_service_client_enums import Code +from ._container_service_client_enums import ConnectionStatus +from ._container_service_client_enums import ContainerServiceStorageProfileTypes +from ._container_service_client_enums import ContainerServiceVMSizeTypes +from ._container_service_client_enums import Count +from ._container_service_client_enums import CreatedByType +from ._container_service_client_enums import Expander +from ._container_service_client_enums import ExtendedLocationTypes +from ._container_service_client_enums import Format +from ._container_service_client_enums import GPUInstanceProfile +from ._container_service_client_enums import IpFamily +from ._container_service_client_enums import KubeletDiskType +from ._container_service_client_enums import LicenseType +from ._container_service_client_enums import LoadBalancerSku +from ._container_service_client_enums import ManagedClusterPodIdentityProvisioningState +from ._container_service_client_enums import ManagedClusterSKUName +from ._container_service_client_enums import ManagedClusterSKUTier +from ._container_service_client_enums import NetworkMode +from ._container_service_client_enums import NetworkPlugin +from ._container_service_client_enums import NetworkPolicy +from ._container_service_client_enums import OSDiskType +from ._container_service_client_enums import OSSKU +from ._container_service_client_enums import OSType +from ._container_service_client_enums import OutboundType +from ._container_service_client_enums import PrivateEndpointConnectionProvisioningState +from ._container_service_client_enums import PublicNetworkAccess +from ._container_service_client_enums import ResourceIdentityType +from ._container_service_client_enums import ScaleDownMode +from ._container_service_client_enums import ScaleSetEvictionPolicy +from ._container_service_client_enums import ScaleSetPriority +from ._container_service_client_enums import SnapshotType +from ._container_service_client_enums import UpgradeChannel +from ._container_service_client_enums import WeekDay +from ._container_service_client_enums import WorkloadRuntime from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'AgentPool', - 'AgentPoolAvailableVersions', - 'AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem', - 'AgentPoolListResult', - 'AgentPoolUpgradeProfile', - 'AgentPoolUpgradeProfilePropertiesUpgradesItem', - 'AgentPoolUpgradeSettings', - 'CloudErrorBody', - 'ContainerServiceDiagnosticsProfile', - 'ContainerServiceLinuxProfile', - 'ContainerServiceMasterProfile', - 'ContainerServiceNetworkProfile', - 'ContainerServiceSshConfiguration', - 'ContainerServiceSshPublicKey', - 'ContainerServiceVMDiagnostics', - 'CreationData', - 'CredentialResult', - 'CredentialResults', - 'EndpointDependency', - 'EndpointDetail', - 'ExtendedLocation', - 'KubeletConfig', - 'LinuxOSConfig', - 'MaintenanceConfiguration', - 'MaintenanceConfigurationListResult', - 'ManagedCluster', - 'ManagedClusterAADProfile', - 'ManagedClusterAPIServerAccessProfile', - 'ManagedClusterAccessProfile', - 'ManagedClusterAddonProfile', - 'ManagedClusterAddonProfileIdentity', - 'ManagedClusterAgentPoolProfile', - 'ManagedClusterAgentPoolProfileProperties', - 'ManagedClusterAutoUpgradeProfile', - 'ManagedClusterHTTPProxyConfig', - 'ManagedClusterIdentity', - 'ManagedClusterListResult', - 'ManagedClusterLoadBalancerProfile', - 'ManagedClusterLoadBalancerProfileManagedOutboundIPs', - 'ManagedClusterLoadBalancerProfileOutboundIPPrefixes', - 'ManagedClusterLoadBalancerProfileOutboundIPs', - 'ManagedClusterManagedOutboundIPProfile', - 'ManagedClusterNATGatewayProfile', - 'ManagedClusterPodIdentity', - 'ManagedClusterPodIdentityException', - 'ManagedClusterPodIdentityProfile', - 'ManagedClusterPodIdentityProvisioningError', - 'ManagedClusterPodIdentityProvisioningErrorBody', - 'ManagedClusterPodIdentityProvisioningInfo', - 'ManagedClusterPoolUpgradeProfile', - 'ManagedClusterPoolUpgradeProfileUpgradesItem', - 'ManagedClusterPropertiesAutoScalerProfile', - 'ManagedClusterSKU', - 'ManagedClusterSecurityProfile', - 'ManagedClusterSecurityProfileAzureDefender', - 'ManagedClusterServicePrincipalProfile', - 'ManagedClusterUpgradeProfile', - 'ManagedClusterWindowsProfile', - 'ManagedServiceIdentityUserAssignedIdentitiesValue', - 'OSOptionProfile', - 'OSOptionProperty', - 'OperationListResult', - 'OperationValue', - 'OutboundEnvironmentEndpoint', - 'OutboundEnvironmentEndpointCollection', - 'PowerState', - 'PrivateEndpoint', - 'PrivateEndpointConnection', - 'PrivateEndpointConnectionListResult', - 'PrivateLinkResource', - 'PrivateLinkResourcesListResult', - 'PrivateLinkServiceConnectionState', - 'Resource', - 'ResourceReference', - 'RunCommandRequest', - 'RunCommandResult', - 'Snapshot', - 'SnapshotListResult', - 'SubResource', - 'SysctlConfig', - 'SystemData', - 'TagsObject', - 'TimeInWeek', - 'TimeSpan', - 'UserAssignedIdentity', - 'WindowsGmsaProfile', - 'AgentPoolMode', - 'AgentPoolType', - 'Code', - 'ConnectionStatus', - 'ContainerServiceStorageProfileTypes', - 'ContainerServiceVMSizeTypes', - 'Count', - 'CreatedByType', - 'Expander', - 'ExtendedLocationTypes', - 'Format', - 'GPUInstanceProfile', - 'IpFamily', - 'KubeletDiskType', - 'LicenseType', - 'LoadBalancerSku', - 'ManagedClusterPodIdentityProvisioningState', - 'ManagedClusterSKUName', - 'ManagedClusterSKUTier', - 'NetworkMode', - 'NetworkPlugin', - 'NetworkPolicy', - 'OSDiskType', - 'OSSKU', - 'OSType', - 'OutboundType', - 'PrivateEndpointConnectionProvisioningState', - 'PublicNetworkAccess', - 'ResourceIdentityType', - 'ScaleDownMode', - 'ScaleSetEvictionPolicy', - 'ScaleSetPriority', - 'SnapshotType', - 'UpgradeChannel', - 'WeekDay', - 'WorkloadRuntime', + "AgentPool", + "AgentPoolAvailableVersions", + "AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem", + "AgentPoolListResult", + "AgentPoolUpgradeProfile", + "AgentPoolUpgradeProfilePropertiesUpgradesItem", + "AgentPoolUpgradeSettings", + "CloudErrorBody", + "ContainerServiceDiagnosticsProfile", + "ContainerServiceLinuxProfile", + "ContainerServiceMasterProfile", + "ContainerServiceNetworkProfile", + "ContainerServiceSshConfiguration", + "ContainerServiceSshPublicKey", + "ContainerServiceVMDiagnostics", + "CreationData", + "CredentialResult", + "CredentialResults", + "EndpointDependency", + "EndpointDetail", + "ExtendedLocation", + "KubeletConfig", + "LinuxOSConfig", + "MaintenanceConfiguration", + "MaintenanceConfigurationListResult", + "ManagedCluster", + "ManagedClusterAADProfile", + "ManagedClusterAPIServerAccessProfile", + "ManagedClusterAccessProfile", + "ManagedClusterAddonProfile", + "ManagedClusterAddonProfileIdentity", + "ManagedClusterAgentPoolProfile", + "ManagedClusterAgentPoolProfileProperties", + "ManagedClusterAutoUpgradeProfile", + "ManagedClusterHTTPProxyConfig", + "ManagedClusterIdentity", + "ManagedClusterListResult", + "ManagedClusterLoadBalancerProfile", + "ManagedClusterLoadBalancerProfileManagedOutboundIPs", + "ManagedClusterLoadBalancerProfileOutboundIPPrefixes", + "ManagedClusterLoadBalancerProfileOutboundIPs", + "ManagedClusterManagedOutboundIPProfile", + "ManagedClusterNATGatewayProfile", + "ManagedClusterPodIdentity", + "ManagedClusterPodIdentityException", + "ManagedClusterPodIdentityProfile", + "ManagedClusterPodIdentityProvisioningError", + "ManagedClusterPodIdentityProvisioningErrorBody", + "ManagedClusterPodIdentityProvisioningInfo", + "ManagedClusterPoolUpgradeProfile", + "ManagedClusterPoolUpgradeProfileUpgradesItem", + "ManagedClusterPropertiesAutoScalerProfile", + "ManagedClusterSKU", + "ManagedClusterSecurityProfile", + "ManagedClusterSecurityProfileAzureDefender", + "ManagedClusterServicePrincipalProfile", + "ManagedClusterUpgradeProfile", + "ManagedClusterWindowsProfile", + "ManagedServiceIdentityUserAssignedIdentitiesValue", + "OSOptionProfile", + "OSOptionProperty", + "OperationListResult", + "OperationValue", + "OutboundEnvironmentEndpoint", + "OutboundEnvironmentEndpointCollection", + "PowerState", + "PrivateEndpoint", + "PrivateEndpointConnection", + "PrivateEndpointConnectionListResult", + "PrivateLinkResource", + "PrivateLinkResourcesListResult", + "PrivateLinkServiceConnectionState", + "Resource", + "ResourceReference", + "RunCommandRequest", + "RunCommandResult", + "Snapshot", + "SnapshotListResult", + "SubResource", + "SysctlConfig", + "SystemData", + "TagsObject", + "TimeInWeek", + "TimeSpan", + "UserAssignedIdentity", + "WindowsGmsaProfile", + "AgentPoolMode", + "AgentPoolType", + "Code", + "ConnectionStatus", + "ContainerServiceStorageProfileTypes", + "ContainerServiceVMSizeTypes", + "Count", + "CreatedByType", + "Expander", + "ExtendedLocationTypes", + "Format", + "GPUInstanceProfile", + "IpFamily", + "KubeletDiskType", + "LicenseType", + "LoadBalancerSku", + "ManagedClusterPodIdentityProvisioningState", + "ManagedClusterSKUName", + "ManagedClusterSKUTier", + "NetworkMode", + "NetworkPlugin", + "NetworkPolicy", + "OSDiskType", + "OSSKU", + "OSType", + "OutboundType", + "PrivateEndpointConnectionProvisioningState", + "PublicNetworkAccess", + "ResourceIdentityType", + "ScaleDownMode", + "ScaleSetEvictionPolicy", + "ScaleSetPriority", + "SnapshotType", + "UpgradeChannel", + "WeekDay", + "WorkloadRuntime", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/models/_container_service_client_enums.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/models/_container_service_client_enums.py index cb066b7fffcc..3f3a6ff62be3 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/models/_container_service_client_enums.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/models/_container_service_client_enums.py @@ -13,7 +13,7 @@ class AgentPoolMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools + https://docs.microsoft.com/azure/aks/use-system-pools. """ #: System agent pools are primarily for hosting critical system pods such as CoreDNS and @@ -23,33 +23,34 @@ class AgentPoolMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: User agent pools are primarily for hosting your application pods. USER = "User" + class AgentPoolType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of Agent Pool. - """ + """The type of Agent Pool.""" #: Create an Agent Pool backed by a Virtual Machine Scale Set. VIRTUAL_MACHINE_SCALE_SETS = "VirtualMachineScaleSets" #: Use of this is strongly discouraged. AVAILABILITY_SET = "AvailabilitySet" + class Code(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Tells whether the cluster is Running or Stopped - """ + """Tells whether the cluster is Running or Stopped.""" #: The cluster is running. RUNNING = "Running" #: The cluster is stopped. STOPPED = "Stopped" + class ConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The private link service connection status. - """ + """The private link service connection status.""" PENDING = "Pending" APPROVED = "Approved" REJECTED = "Rejected" DISCONNECTED = "Disconnected" + class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Specifies what kind of storage to use. If omitted, the default will be chosen on your behalf based on the choice of orchestrator. @@ -58,9 +59,9 @@ class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEn STORAGE_ACCOUNT = "StorageAccount" MANAGED_DISKS = "ManagedDisks" + class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Size of agent VMs. Note: This is no longer maintained. - """ + """Size of agent VMs. Note: This is no longer maintained.""" STANDARD_A1 = "Standard_A1" STANDARD_A10 = "Standard_A10" @@ -237,6 +238,7 @@ class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): STANDARD_NV24 = "Standard_NV24" STANDARD_NV6 = "Standard_NV6" + class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): """Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, and 5. The default value is 1. @@ -246,15 +248,16 @@ class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): THREE = 3 FIVE = 5 + class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of identity that created the resource. - """ + """The type of identity that created the resource.""" USER = "User" APPLICATION = "Application" MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" + class Expander(str, Enum, metaclass=CaseInsensitiveEnumMeta): """If not specified, the default is 'random'. See `expanders `_ @@ -278,23 +281,25 @@ class Expander(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Used when you don't have a particular need for the node groups to scale differently. RANDOM = "random" + class ExtendedLocationTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of extendedLocation. - """ + """The type of extendedLocation.""" EDGE_ZONE = "EdgeZone" + class Format(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Format.""" #: Return azure auth-provider kubeconfig. This format is deprecated in 1.22 and will be fully #: removed in 1.25. AZURE = "azure" #: Return exec format kubeconfig. This format requires kubelogin binary in the path. - EXEC_ENUM = "exec" + EXEC = "exec" + class GPUInstanceProfile(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """GPUInstanceProfile to be used to specify GPU MIG instance profile for supported GPU VM SKU. - """ + """GPUInstanceProfile to be used to specify GPU MIG instance profile for supported GPU VM SKU.""" MIG1_G = "MIG1g" MIG2_G = "MIG2g" @@ -302,13 +307,14 @@ class GPUInstanceProfile(str, Enum, metaclass=CaseInsensitiveEnumMeta): MIG4_G = "MIG4g" MIG7_G = "MIG7g" + class IpFamily(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The IP version to use for cluster networking and IP assignment. - """ + """The IP version to use for cluster networking and IP assignment.""" I_PV4 = "IPv4" I_PV6 = "IPv6" + class KubeletDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. @@ -319,6 +325,7 @@ class KubeletDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Kubelet will use the temporary disk for its data. TEMPORARY = "Temporary" + class LicenseType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The license type to use for Windows VMs. See `Azure Hybrid User Benefits `_ for more details. @@ -329,6 +336,7 @@ class LicenseType(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Enables Azure Hybrid User Benefits for Windows VMs. WINDOWS_SERVER = "Windows_Server" + class LoadBalancerSku(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The default is 'standard'. See `Azure Load Balancer SKUs `_ for more information about the @@ -342,21 +350,22 @@ class LoadBalancerSku(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Use a basic Load Balancer with limited functionality. BASIC = "basic" + class ManagedClusterPodIdentityProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The current provisioning state of the pod identity. - """ + """The current provisioning state of the pod identity.""" ASSIGNED = "Assigned" UPDATING = "Updating" DELETING = "Deleting" FAILED = "Failed" + class ManagedClusterSKUName(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The name of a managed cluster SKU. - """ + """The name of a managed cluster SKU.""" BASIC = "Basic" + class ManagedClusterSKUTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): """If not specified, the default is 'Free'. See `uptime SLA `_ for more details. @@ -368,20 +377,20 @@ class ManagedClusterSKUTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: No guaranteed SLA, no additional charges. Free tier clusters have an SLO of 99.5%. FREE = "Free" + class NetworkMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """This cannot be specified if networkPlugin is anything other than 'azure'. - """ + """This cannot be specified if networkPlugin is anything other than 'azure'.""" #: No bridge is created. Intra-VM Pod to Pod communication is through IP routes created by Azure #: CNI. See `Transparent Mode `_ for #: more information. TRANSPARENT = "transparent" - #: This is no longer supported. + #: This is no longer supported BRIDGE = "bridge" + class NetworkPlugin(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Network plugin used for building the Kubernetes network. - """ + """Network plugin used for building the Kubernetes network.""" #: Use the Azure CNI network plugin. See `Azure CNI (advanced) networking #: `_ for @@ -392,9 +401,9 @@ class NetworkPlugin(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: information. KUBENET = "kubenet" + class NetworkPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Network policy used for building the Kubernetes network. - """ + """Network policy used for building the Kubernetes network.""" #: Use Calico network policies. See `differences between Azure and Calico policies #: `_ @@ -405,6 +414,7 @@ class NetworkPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: for more information. AZURE = "azure" + class OSDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more @@ -421,22 +431,23 @@ class OSDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: provides lower read/write latency, along with faster node scaling and cluster upgrades. EPHEMERAL = "Ephemeral" + class OSSKU(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Specifies an OS SKU. This value must not be specified if OSType is Windows. - """ + """Specifies an OS SKU. This value must not be specified if OSType is Windows.""" UBUNTU = "Ubuntu" CBL_MARINER = "CBLMariner" + class OSType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The operating system type. The default is Linux. - """ + """The operating system type. The default is Linux.""" #: Use Linux. LINUX = "Linux" #: Use Windows. WINDOWS = "Windows" + class OutboundType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """This can only be set at cluster creation time and cannot be changed later. For more information see `egress outbound type `_. @@ -457,22 +468,23 @@ class OutboundType(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: advanced scenario and requires proper network configuration. USER_ASSIGNED_NAT_GATEWAY = "userAssignedNATGateway" + class PrivateEndpointConnectionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The current provisioning state. - """ + """The current provisioning state.""" SUCCEEDED = "Succeeded" CREATING = "Creating" DELETING = "Deleting" FAILED = "Failed" + class PublicNetworkAccess(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Allow or deny public network access for AKS - """ + """Allow or deny public network access for AKS.""" ENABLED = "Enabled" DISABLED = "Disabled" + class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """For more information see `use managed identities in AKS `_. @@ -489,6 +501,7 @@ class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Do not use a managed identity for the Managed Cluster, service principal will be used instead. NONE = "None" + class ScaleDownMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Describes how VMs are added to or removed from Agent Pools. See `billing states `_. @@ -500,10 +513,11 @@ class ScaleDownMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: during scale down. DEALLOCATE = "Deallocate" + class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The eviction policy specifies what to do with the VM when it is evicted. The default is Delete. For more information about eviction see `spot VMs - `_ + `_. """ #: Nodes in the underlying Scale Set of the node pool are deleted when they're evicted. @@ -513,9 +527,9 @@ class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: cause issues with cluster scaling or upgrading. DEALLOCATE = "Deallocate" + class ScaleSetPriority(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The Virtual Machine Scale Set priority. - """ + """The Virtual Machine Scale Set priority.""" #: Spot priority VMs will be used. There is no SLA for spot nodes. See `spot on AKS #: `_ for more information. @@ -523,13 +537,14 @@ class ScaleSetPriority(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Regular VMs will be used. REGULAR = "Regular" + class SnapshotType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of a snapshot. The default is NodePool. - """ + """The type of a snapshot. The default is NodePool.""" #: The snapshot is a snapshot of a node pool. NODE_POOL = "NodePool" + class UpgradeChannel(str, Enum, metaclass=CaseInsensitiveEnumMeta): """For more information see `setting the AKS cluster auto-upgrade channel `_. @@ -560,9 +575,9 @@ class UpgradeChannel(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Disables auto-upgrades and keeps the cluster at its current version of Kubernetes. NONE = "none" + class WeekDay(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The weekday enum. - """ + """The weekday enum.""" SUNDAY = "Sunday" MONDAY = "Monday" @@ -572,9 +587,9 @@ class WeekDay(str, Enum, metaclass=CaseInsensitiveEnumMeta): FRIDAY = "Friday" SATURDAY = "Saturday" + class WorkloadRuntime(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Determines the type of workload a node can run. - """ + """Determines the type of workload a node can run.""" #: Nodes will use Kubelet to run standard OCI container workloads. OCI_CONTAINER = "OCIContainer" diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/models/_models_py3.py index b745288bfa02..4f414c3715bb 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/models/_models_py3.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/models/_models_py3.py @@ -1,4 +1,5 @@ # coding=utf-8 +# pylint: disable=too-many-lines # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -9,14 +10,14 @@ import datetime from typing import Dict, List, Optional, TYPE_CHECKING, Union -import msrest.serialization +from ... import _serialization if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - import __init__ as _models + from .. import models as _models -class SubResource(msrest.serialization.Model): +class SubResource(_serialization.Model): """Reference to another subresource. Variables are only populated by the server, and will be ignored when sending a request. @@ -31,30 +32,26 @@ class SubResource(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(SubResource, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.id = None self.name = None self.type = None -class AgentPool(SubResource): +class AgentPool(SubResource): # pylint: disable=too-many-instance-attributes """Agent Pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -82,14 +79,14 @@ class AgentPool(SubResource): larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2022_02_01.models.OSDiskType :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data - root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_02_01.models.KubeletDiskType :ivar workload_runtime: Determines the type of workload a node can run. Known values are: - "OCIContainer", "WasmWasi". + "OCIContainer" and "WasmWasi". :vartype workload_runtime: str or ~azure.mgmt.containerservice.v2022_02_01.models.WorkloadRuntime :ivar vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and used. @@ -103,11 +100,11 @@ class AgentPool(SubResource): :vartype pod_subnet_id: str :ivar max_pods: The maximum number of pods that can run on a node. :vartype max_pods: int - :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_02_01.models.OSType :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known - values are: "Ubuntu", "CBLMariner". + values are: "Ubuntu" and "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2022_02_01.models.OSSKU :ivar max_count: The maximum number of nodes for auto-scaling. :vartype max_count: int @@ -116,15 +113,15 @@ class AgentPool(SubResource): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it - defaults to Delete. Known values are: "Delete", "Deallocate". + defaults to Delete. Known values are: "Delete" and "Deallocate". :vartype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_02_01.models.ScaleDownMode - :ivar type_properties_type: The type of Agent Pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + :ivar type_properties_type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets" + and "AvailabilitySet". :vartype type_properties_type: str or ~azure.mgmt.containerservice.v2022_02_01.models.AgentPoolType :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :vartype mode: str or ~azure.mgmt.containerservice.v2022_02_01.models.AgentPoolMode :ivar orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -159,20 +156,18 @@ class AgentPool(SubResource): /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default - is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + is 'Regular'. Known values are: "Spot" and "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_02_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_02_01.models.ScaleSetEvictionPolicy :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :vartype spot_max_price: float - :ivar tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :ivar tags: The tags to be persisted on the agent pool virtual machine scale set. :vartype tags: dict[str, str] :ivar node_labels: The node labels to be persisted across all nodes in agent pool. :vartype node_labels: dict[str, str] @@ -196,7 +191,7 @@ class AgentPool(SubResource): for more details. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_02_01.models.GPUInstanceProfile :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the node pool @@ -205,60 +200,60 @@ class AgentPool(SubResource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'os_disk_size_gb': {'maximum': 2048, 'minimum': 0}, - 'node_image_version': {'readonly': True}, - 'provisioning_state': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "os_disk_size_gb": {"maximum": 2048, "minimum": 0}, + "node_image_version": {"readonly": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'count': {'key': 'properties.count', 'type': 'int'}, - 'vm_size': {'key': 'properties.vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'properties.osDiskSizeGB', 'type': 'int'}, - 'os_disk_type': {'key': 'properties.osDiskType', 'type': 'str'}, - 'kubelet_disk_type': {'key': 'properties.kubeletDiskType', 'type': 'str'}, - 'workload_runtime': {'key': 'properties.workloadRuntime', 'type': 'str'}, - 'vnet_subnet_id': {'key': 'properties.vnetSubnetID', 'type': 'str'}, - 'pod_subnet_id': {'key': 'properties.podSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'properties.maxPods', 'type': 'int'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'os_sku': {'key': 'properties.osSKU', 'type': 'str'}, - 'max_count': {'key': 'properties.maxCount', 'type': 'int'}, - 'min_count': {'key': 'properties.minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'properties.enableAutoScaling', 'type': 'bool'}, - 'scale_down_mode': {'key': 'properties.scaleDownMode', 'type': 'str'}, - 'type_properties_type': {'key': 'properties.type', 'type': 'str'}, - 'mode': {'key': 'properties.mode', 'type': 'str'}, - 'orchestrator_version': {'key': 'properties.orchestratorVersion', 'type': 'str'}, - 'node_image_version': {'key': 'properties.nodeImageVersion', 'type': 'str'}, - 'upgrade_settings': {'key': 'properties.upgradeSettings', 'type': 'AgentPoolUpgradeSettings'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'power_state': {'key': 'properties.powerState', 'type': 'PowerState'}, - 'availability_zones': {'key': 'properties.availabilityZones', 'type': '[str]'}, - 'enable_node_public_ip': {'key': 'properties.enableNodePublicIP', 'type': 'bool'}, - 'node_public_ip_prefix_id': {'key': 'properties.nodePublicIPPrefixID', 'type': 'str'}, - 'scale_set_priority': {'key': 'properties.scaleSetPriority', 'type': 'str'}, - 'scale_set_eviction_policy': {'key': 'properties.scaleSetEvictionPolicy', 'type': 'str'}, - 'spot_max_price': {'key': 'properties.spotMaxPrice', 'type': 'float'}, - 'tags': {'key': 'properties.tags', 'type': '{str}'}, - 'node_labels': {'key': 'properties.nodeLabels', 'type': '{str}'}, - 'node_taints': {'key': 'properties.nodeTaints', 'type': '[str]'}, - 'proximity_placement_group_id': {'key': 'properties.proximityPlacementGroupID', 'type': 'str'}, - 'kubelet_config': {'key': 'properties.kubeletConfig', 'type': 'KubeletConfig'}, - 'linux_os_config': {'key': 'properties.linuxOSConfig', 'type': 'LinuxOSConfig'}, - 'enable_encryption_at_host': {'key': 'properties.enableEncryptionAtHost', 'type': 'bool'}, - 'enable_ultra_ssd': {'key': 'properties.enableUltraSSD', 'type': 'bool'}, - 'enable_fips': {'key': 'properties.enableFIPS', 'type': 'bool'}, - 'gpu_instance_profile': {'key': 'properties.gpuInstanceProfile', 'type': 'str'}, - 'creation_data': {'key': 'properties.creationData', 'type': 'CreationData'}, - } - - def __init__( + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "count": {"key": "properties.count", "type": "int"}, + "vm_size": {"key": "properties.vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "properties.osDiskSizeGB", "type": "int"}, + "os_disk_type": {"key": "properties.osDiskType", "type": "str"}, + "kubelet_disk_type": {"key": "properties.kubeletDiskType", "type": "str"}, + "workload_runtime": {"key": "properties.workloadRuntime", "type": "str"}, + "vnet_subnet_id": {"key": "properties.vnetSubnetID", "type": "str"}, + "pod_subnet_id": {"key": "properties.podSubnetID", "type": "str"}, + "max_pods": {"key": "properties.maxPods", "type": "int"}, + "os_type": {"key": "properties.osType", "type": "str"}, + "os_sku": {"key": "properties.osSKU", "type": "str"}, + "max_count": {"key": "properties.maxCount", "type": "int"}, + "min_count": {"key": "properties.minCount", "type": "int"}, + "enable_auto_scaling": {"key": "properties.enableAutoScaling", "type": "bool"}, + "scale_down_mode": {"key": "properties.scaleDownMode", "type": "str"}, + "type_properties_type": {"key": "properties.type", "type": "str"}, + "mode": {"key": "properties.mode", "type": "str"}, + "orchestrator_version": {"key": "properties.orchestratorVersion", "type": "str"}, + "node_image_version": {"key": "properties.nodeImageVersion", "type": "str"}, + "upgrade_settings": {"key": "properties.upgradeSettings", "type": "AgentPoolUpgradeSettings"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "power_state": {"key": "properties.powerState", "type": "PowerState"}, + "availability_zones": {"key": "properties.availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "properties.enableNodePublicIP", "type": "bool"}, + "node_public_ip_prefix_id": {"key": "properties.nodePublicIPPrefixID", "type": "str"}, + "scale_set_priority": {"key": "properties.scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "properties.scaleSetEvictionPolicy", "type": "str"}, + "spot_max_price": {"key": "properties.spotMaxPrice", "type": "float"}, + "tags": {"key": "properties.tags", "type": "{str}"}, + "node_labels": {"key": "properties.nodeLabels", "type": "{str}"}, + "node_taints": {"key": "properties.nodeTaints", "type": "[str]"}, + "proximity_placement_group_id": {"key": "properties.proximityPlacementGroupID", "type": "str"}, + "kubelet_config": {"key": "properties.kubeletConfig", "type": "KubeletConfig"}, + "linux_os_config": {"key": "properties.linuxOSConfig", "type": "LinuxOSConfig"}, + "enable_encryption_at_host": {"key": "properties.enableEncryptionAtHost", "type": "bool"}, + "enable_ultra_ssd": {"key": "properties.enableUltraSSD", "type": "bool"}, + "enable_fips": {"key": "properties.enableFIPS", "type": "bool"}, + "gpu_instance_profile": {"key": "properties.gpuInstanceProfile", "type": "str"}, + "creation_data": {"key": "properties.creationData", "type": "CreationData"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, count: Optional[int] = None, @@ -270,7 +265,7 @@ def __init__( vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, @@ -284,9 +279,9 @@ def __init__( availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", - spot_max_price: Optional[float] = -1, + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", + spot_max_price: float = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, @@ -317,14 +312,14 @@ def __init__( larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2022_02_01.models.OSDiskType :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime - data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + data root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_02_01.models.KubeletDiskType :keyword workload_runtime: Determines the type of workload a node can run. Known values are: - "OCIContainer", "WasmWasi". + "OCIContainer" and "WasmWasi". :paramtype workload_runtime: str or ~azure.mgmt.containerservice.v2022_02_01.models.WorkloadRuntime :keyword vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and @@ -338,11 +333,11 @@ def __init__( :paramtype pod_subnet_id: str :keyword max_pods: The maximum number of pods that can run on a node. :paramtype max_pods: int - :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_02_01.models.OSType :keyword os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Known values are: "Ubuntu", "CBLMariner". + Known values are: "Ubuntu" and "CBLMariner". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2022_02_01.models.OSSKU :keyword max_count: The maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -351,16 +346,16 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, - it defaults to Delete. Known values are: "Delete", "Deallocate". + it defaults to Delete. Known values are: "Delete" and "Deallocate". :paramtype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_02_01.models.ScaleDownMode :keyword type_properties_type: The type of Agent Pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type_properties_type: str or ~azure.mgmt.containerservice.v2022_02_01.models.AgentPoolType :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2022_02_01.models.AgentPoolMode :keyword orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -391,20 +386,18 @@ def __init__( /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the - default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + default is 'Regular'. Known values are: "Spot" and "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_02_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_02_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :paramtype spot_max_price: float - :keyword tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :keyword tags: The tags to be persisted on the agent pool virtual machine scale set. :paramtype tags: dict[str, str] :keyword node_labels: The node labels to be persisted across all nodes in agent pool. :paramtype node_labels: dict[str, str] @@ -428,7 +421,7 @@ def __init__( for more details. :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance - profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_02_01.models.GPUInstanceProfile @@ -436,7 +429,7 @@ def __init__( pool will be created/upgraded using a snapshot. :paramtype creation_data: ~azure.mgmt.containerservice.v2022_02_01.models.CreationData """ - super(AgentPool, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.vm_size = vm_size self.os_disk_size_gb = os_disk_size_gb @@ -478,7 +471,7 @@ def __init__( self.creation_data = creation_data -class AgentPoolAvailableVersions(msrest.serialization.Model): +class AgentPoolAvailableVersions(_serialization.Model): """The list of available versions for an agent pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -495,16 +488,19 @@ class AgentPoolAvailableVersions(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'agent_pool_versions': {'key': 'properties.agentPoolVersions', 'type': '[AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "agent_pool_versions": { + "key": "properties.agentPoolVersions", + "type": "[AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem]", + }, } def __init__( @@ -518,14 +514,14 @@ def __init__( :paramtype agent_pool_versions: list[~azure.mgmt.containerservice.v2022_02_01.models.AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem] """ - super(AgentPoolAvailableVersions, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None self.agent_pool_versions = agent_pool_versions -class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(msrest.serialization.Model): +class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(_serialization.Model): """AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem. :ivar default: Whether this version is the default agent pool version. @@ -537,9 +533,9 @@ class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(msrest.serializa """ _attribute_map = { - 'default': {'key': 'default', 'type': 'bool'}, - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "default": {"key": "default", "type": "bool"}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } def __init__( @@ -558,13 +554,13 @@ def __init__( :keyword is_preview: Whether Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.default = default self.kubernetes_version = kubernetes_version self.is_preview = is_preview -class AgentPoolListResult(msrest.serialization.Model): +class AgentPoolListResult(_serialization.Model): """The response from the List Agent Pools operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -576,30 +572,25 @@ class AgentPoolListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[AgentPool]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[AgentPool]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.AgentPool"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.AgentPool"]] = None, **kwargs): """ :keyword value: The list of agent pools. :paramtype value: list[~azure.mgmt.containerservice.v2022_02_01.models.AgentPool] """ - super(AgentPoolListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class AgentPoolUpgradeProfile(msrest.serialization.Model): +class AgentPoolUpgradeProfile(_serialization.Model): """The list of available upgrades for an agent pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -612,10 +603,10 @@ class AgentPoolUpgradeProfile(msrest.serialization.Model): :vartype name: str :ivar type: The type of the agent pool upgrade profile. :vartype type: str - :ivar kubernetes_version: Required. The Kubernetes version (major.minor.patch). + :ivar kubernetes_version: The Kubernetes version (major.minor.patch). Required. :vartype kubernetes_version: str - :ivar os_type: Required. The operating system type. The default is Linux. Known values are: - "Linux", "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_02_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -625,21 +616,21 @@ class AgentPoolUpgradeProfile(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kubernetes_version': {'required': True}, - 'os_type': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "kubernetes_version": {"required": True}, + "os_type": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'kubernetes_version': {'key': 'properties.kubernetesVersion', 'type': 'str'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'upgrades': {'key': 'properties.upgrades', 'type': '[AgentPoolUpgradeProfilePropertiesUpgradesItem]'}, - 'latest_node_image_version': {'key': 'properties.latestNodeImageVersion', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "os_type": {"key": "properties.osType", "type": "str"}, + "upgrades": {"key": "properties.upgrades", "type": "[AgentPoolUpgradeProfilePropertiesUpgradesItem]"}, + "latest_node_image_version": {"key": "properties.latestNodeImageVersion", "type": "str"}, } def __init__( @@ -652,10 +643,10 @@ def __init__( **kwargs ): """ - :keyword kubernetes_version: Required. The Kubernetes version (major.minor.patch). + :keyword kubernetes_version: The Kubernetes version (major.minor.patch). Required. :paramtype kubernetes_version: str - :keyword os_type: Required. The operating system type. The default is Linux. Known values are: - "Linux", "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_02_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: @@ -663,7 +654,7 @@ def __init__( :keyword latest_node_image_version: The latest AKS supported node image version. :paramtype latest_node_image_version: str """ - super(AgentPoolUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -673,7 +664,7 @@ def __init__( self.latest_node_image_version = latest_node_image_version -class AgentPoolUpgradeProfilePropertiesUpgradesItem(msrest.serialization.Model): +class AgentPoolUpgradeProfilePropertiesUpgradesItem(_serialization.Model): """AgentPoolUpgradeProfilePropertiesUpgradesItem. :ivar kubernetes_version: The Kubernetes version (major.minor.patch). @@ -683,29 +674,23 @@ class AgentPoolUpgradeProfilePropertiesUpgradesItem(msrest.serialization.Model): """ _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } - def __init__( - self, - *, - kubernetes_version: Optional[str] = None, - is_preview: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, kubernetes_version: Optional[str] = None, is_preview: Optional[bool] = None, **kwargs): """ :keyword kubernetes_version: The Kubernetes version (major.minor.patch). :paramtype kubernetes_version: str :keyword is_preview: Whether the Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(AgentPoolUpgradeProfilePropertiesUpgradesItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.is_preview = is_preview -class AgentPoolUpgradeSettings(msrest.serialization.Model): +class AgentPoolUpgradeSettings(_serialization.Model): """Settings for upgrading an agentpool. :ivar max_surge: This can either be set to an integer (e.g. '5') or a percentage (e.g. '50%'). @@ -717,15 +702,10 @@ class AgentPoolUpgradeSettings(msrest.serialization.Model): """ _attribute_map = { - 'max_surge': {'key': 'maxSurge', 'type': 'str'}, + "max_surge": {"key": "maxSurge", "type": "str"}, } - def __init__( - self, - *, - max_surge: Optional[str] = None, - **kwargs - ): + def __init__(self, *, max_surge: Optional[str] = None, **kwargs): """ :keyword max_surge: This can either be set to an integer (e.g. '5') or a percentage (e.g. '50%'). If a percentage is specified, it is the percentage of the total agent pool size at the @@ -734,11 +714,11 @@ def __init__( https://docs.microsoft.com/azure/aks/upgrade-cluster#customize-node-surge-upgrade. :paramtype max_surge: str """ - super(AgentPoolUpgradeSettings, self).__init__(**kwargs) + super().__init__(**kwargs) self.max_surge = max_surge -class CloudErrorBody(msrest.serialization.Model): +class CloudErrorBody(_serialization.Model): """An error response from the Container service. :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed @@ -755,10 +735,10 @@ class CloudErrorBody(msrest.serialization.Model): """ _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[CloudErrorBody]"}, } def __init__( @@ -783,87 +763,76 @@ def __init__( :keyword details: A list of additional details about the error. :paramtype details: list[~azure.mgmt.containerservice.v2022_02_01.models.CloudErrorBody] """ - super(CloudErrorBody, self).__init__(**kwargs) + super().__init__(**kwargs) self.code = code self.message = message self.target = target self.details = details -class ContainerServiceDiagnosticsProfile(msrest.serialization.Model): +class ContainerServiceDiagnosticsProfile(_serialization.Model): """Profile for diagnostics on the container service cluster. All required parameters must be populated in order to send to Azure. - :ivar vm_diagnostics: Required. Profile for diagnostics on the container service VMs. + :ivar vm_diagnostics: Profile for diagnostics on the container service VMs. Required. :vartype vm_diagnostics: ~azure.mgmt.containerservice.v2022_02_01.models.ContainerServiceVMDiagnostics """ _validation = { - 'vm_diagnostics': {'required': True}, + "vm_diagnostics": {"required": True}, } _attribute_map = { - 'vm_diagnostics': {'key': 'vmDiagnostics', 'type': 'ContainerServiceVMDiagnostics'}, + "vm_diagnostics": {"key": "vmDiagnostics", "type": "ContainerServiceVMDiagnostics"}, } - def __init__( - self, - *, - vm_diagnostics: "_models.ContainerServiceVMDiagnostics", - **kwargs - ): + def __init__(self, *, vm_diagnostics: "_models.ContainerServiceVMDiagnostics", **kwargs): """ - :keyword vm_diagnostics: Required. Profile for diagnostics on the container service VMs. + :keyword vm_diagnostics: Profile for diagnostics on the container service VMs. Required. :paramtype vm_diagnostics: ~azure.mgmt.containerservice.v2022_02_01.models.ContainerServiceVMDiagnostics """ - super(ContainerServiceDiagnosticsProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.vm_diagnostics = vm_diagnostics -class ContainerServiceLinuxProfile(msrest.serialization.Model): +class ContainerServiceLinuxProfile(_serialization.Model): """Profile for Linux VMs in the container service cluster. All required parameters must be populated in order to send to Azure. - :ivar admin_username: Required. The administrator username to use for Linux VMs. + :ivar admin_username: The administrator username to use for Linux VMs. Required. :vartype admin_username: str - :ivar ssh: Required. The SSH configuration for Linux-based VMs running on Azure. + :ivar ssh: The SSH configuration for Linux-based VMs running on Azure. Required. :vartype ssh: ~azure.mgmt.containerservice.v2022_02_01.models.ContainerServiceSshConfiguration """ _validation = { - 'admin_username': {'required': True, 'pattern': r'^[A-Za-z][-A-Za-z0-9_]*$'}, - 'ssh': {'required': True}, + "admin_username": {"required": True, "pattern": r"^[A-Za-z][-A-Za-z0-9_]*$"}, + "ssh": {"required": True}, } _attribute_map = { - 'admin_username': {'key': 'adminUsername', 'type': 'str'}, - 'ssh': {'key': 'ssh', 'type': 'ContainerServiceSshConfiguration'}, + "admin_username": {"key": "adminUsername", "type": "str"}, + "ssh": {"key": "ssh", "type": "ContainerServiceSshConfiguration"}, } - def __init__( - self, - *, - admin_username: str, - ssh: "_models.ContainerServiceSshConfiguration", - **kwargs - ): + def __init__(self, *, admin_username: str, ssh: "_models.ContainerServiceSshConfiguration", **kwargs): """ - :keyword admin_username: Required. The administrator username to use for Linux VMs. + :keyword admin_username: The administrator username to use for Linux VMs. Required. :paramtype admin_username: str - :keyword ssh: Required. The SSH configuration for Linux-based VMs running on Azure. + :keyword ssh: The SSH configuration for Linux-based VMs running on Azure. Required. :paramtype ssh: ~azure.mgmt.containerservice.v2022_02_01.models.ContainerServiceSshConfiguration """ - super(ContainerServiceLinuxProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.admin_username = admin_username self.ssh = ssh -class ContainerServiceMasterProfile(msrest.serialization.Model): +class ContainerServiceMasterProfile(_serialization.Model): """Profile for the container service master. Variables are only populated by the server, and will be ignored when sending a request. @@ -871,11 +840,11 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar count: Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, - and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". + and 5. The default value is 1. Known values are: 1, 3, and 5. :vartype count: int or ~azure.mgmt.containerservice.v2022_02_01.models.Count - :ivar dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. + :ivar dns_prefix: DNS prefix to be used to create the FQDN for the master pool. Required. :vartype dns_prefix: str - :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + :ivar vm_size: Size of agent VMs. Required. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -912,7 +881,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :vartype vm_size: str or ~azure.mgmt.containerservice.v2022_02_01.models.ContainerServiceVMSizeTypes :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine @@ -926,7 +895,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): :vartype first_consecutive_static_ip: str :ivar storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount" and "ManagedDisks". :vartype storage_profile: str or ~azure.mgmt.containerservice.v2022_02_01.models.ContainerServiceStorageProfileTypes :ivar fqdn: FQDN for the master pool. @@ -934,21 +903,21 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): """ _validation = { - 'dns_prefix': {'required': True}, - 'vm_size': {'required': True}, - 'os_disk_size_gb': {'maximum': 2048, 'minimum': 0}, - 'fqdn': {'readonly': True}, + "dns_prefix": {"required": True}, + "vm_size": {"required": True}, + "os_disk_size_gb": {"maximum": 2048, "minimum": 0}, + "fqdn": {"readonly": True}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'dns_prefix': {'key': 'dnsPrefix', 'type': 'str'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'first_consecutive_static_ip': {'key': 'firstConsecutiveStaticIP', 'type': 'str'}, - 'storage_profile': {'key': 'storageProfile', 'type': 'str'}, - 'fqdn': {'key': 'fqdn', 'type': 'str'}, + "count": {"key": "count", "type": "int"}, + "dns_prefix": {"key": "dnsPrefix", "type": "str"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "first_consecutive_static_ip": {"key": "firstConsecutiveStaticIP", "type": "str"}, + "storage_profile": {"key": "storageProfile", "type": "str"}, + "fqdn": {"key": "fqdn", "type": "str"}, } def __init__( @@ -956,20 +925,20 @@ def __init__( *, dns_prefix: str, vm_size: Union[str, "_models.ContainerServiceVMSizeTypes"], - count: Optional[Union[int, "_models.Count"]] = 1, + count: Union[int, "_models.Count"] = 1, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, - first_consecutive_static_ip: Optional[str] = "10.240.255.5", + first_consecutive_static_ip: str = "10.240.255.5", storage_profile: Optional[Union[str, "_models.ContainerServiceStorageProfileTypes"]] = None, **kwargs ): """ :keyword count: Number of masters (VMs) in the container service cluster. Allowed values are 1, - 3, and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". + 3, and 5. The default value is 1. Known values are: 1, 3, and 5. :paramtype count: int or ~azure.mgmt.containerservice.v2022_02_01.models.Count - :keyword dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. + :keyword dns_prefix: DNS prefix to be used to create the FQDN for the master pool. Required. :paramtype dns_prefix: str - :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + :keyword vm_size: Size of agent VMs. Required. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -1006,7 +975,7 @@ def __init__( "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :paramtype vm_size: str or ~azure.mgmt.containerservice.v2022_02_01.models.ContainerServiceVMSizeTypes :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every @@ -1020,11 +989,11 @@ def __init__( :paramtype first_consecutive_static_ip: str :keyword storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount" and "ManagedDisks". :paramtype storage_profile: str or ~azure.mgmt.containerservice.v2022_02_01.models.ContainerServiceStorageProfileTypes """ - super(ContainerServiceMasterProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.dns_prefix = dns_prefix self.vm_size = vm_size @@ -1035,17 +1004,17 @@ def __init__( self.fqdn = None -class ContainerServiceNetworkProfile(msrest.serialization.Model): +class ContainerServiceNetworkProfile(_serialization.Model): # pylint: disable=too-many-instance-attributes """Profile of network configuration. :ivar network_plugin: Network plugin used for building the Kubernetes network. Known values - are: "azure", "kubenet". Default value: "kubenet". + are: "azure" and "kubenet". :vartype network_plugin: str or ~azure.mgmt.containerservice.v2022_02_01.models.NetworkPlugin :ivar network_policy: Network policy used for building the Kubernetes network. Known values - are: "calico", "azure". + are: "calico" and "azure". :vartype network_policy: str or ~azure.mgmt.containerservice.v2022_02_01.models.NetworkPolicy :ivar network_mode: This cannot be specified if networkPlugin is anything other than 'azure'. - Known values are: "transparent", "bridge". + Known values are: "transparent" and "bridge". :vartype network_mode: str or ~azure.mgmt.containerservice.v2022_02_01.models.NetworkMode :ivar pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :vartype pod_cidr: str @@ -1061,12 +1030,11 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): :ivar outbound_type: This can only be set at cluster creation time and cannot be changed later. For more information see `egress outbound type `_. Known values are: "loadBalancer", - "userDefinedRouting", "managedNATGateway", "userAssignedNATGateway". Default value: - "loadBalancer". + "userDefinedRouting", "managedNATGateway", and "userAssignedNATGateway". :vartype outbound_type: str or ~azure.mgmt.containerservice.v2022_02_01.models.OutboundType :ivar load_balancer_sku: The default is 'standard'. See `Azure Load Balancer SKUs `_ for more information about the - differences between load balancer SKUs. Known values are: "standard", "basic". + differences between load balancer SKUs. Known values are: "standard" and "basic". :vartype load_balancer_sku: str or ~azure.mgmt.containerservice.v2022_02_01.models.LoadBalancerSku :ivar load_balancer_profile: Profile of the cluster load balancer. @@ -1089,40 +1057,42 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): """ _validation = { - 'pod_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, - 'service_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, - 'dns_service_ip': {'pattern': r'^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$'}, - 'docker_bridge_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, + "pod_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, + "service_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, + "dns_service_ip": { + "pattern": r"^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$" + }, + "docker_bridge_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, } _attribute_map = { - 'network_plugin': {'key': 'networkPlugin', 'type': 'str'}, - 'network_policy': {'key': 'networkPolicy', 'type': 'str'}, - 'network_mode': {'key': 'networkMode', 'type': 'str'}, - 'pod_cidr': {'key': 'podCidr', 'type': 'str'}, - 'service_cidr': {'key': 'serviceCidr', 'type': 'str'}, - 'dns_service_ip': {'key': 'dnsServiceIP', 'type': 'str'}, - 'docker_bridge_cidr': {'key': 'dockerBridgeCidr', 'type': 'str'}, - 'outbound_type': {'key': 'outboundType', 'type': 'str'}, - 'load_balancer_sku': {'key': 'loadBalancerSku', 'type': 'str'}, - 'load_balancer_profile': {'key': 'loadBalancerProfile', 'type': 'ManagedClusterLoadBalancerProfile'}, - 'nat_gateway_profile': {'key': 'natGatewayProfile', 'type': 'ManagedClusterNATGatewayProfile'}, - 'pod_cidrs': {'key': 'podCidrs', 'type': '[str]'}, - 'service_cidrs': {'key': 'serviceCidrs', 'type': '[str]'}, - 'ip_families': {'key': 'ipFamilies', 'type': '[str]'}, + "network_plugin": {"key": "networkPlugin", "type": "str"}, + "network_policy": {"key": "networkPolicy", "type": "str"}, + "network_mode": {"key": "networkMode", "type": "str"}, + "pod_cidr": {"key": "podCidr", "type": "str"}, + "service_cidr": {"key": "serviceCidr", "type": "str"}, + "dns_service_ip": {"key": "dnsServiceIP", "type": "str"}, + "docker_bridge_cidr": {"key": "dockerBridgeCidr", "type": "str"}, + "outbound_type": {"key": "outboundType", "type": "str"}, + "load_balancer_sku": {"key": "loadBalancerSku", "type": "str"}, + "load_balancer_profile": {"key": "loadBalancerProfile", "type": "ManagedClusterLoadBalancerProfile"}, + "nat_gateway_profile": {"key": "natGatewayProfile", "type": "ManagedClusterNATGatewayProfile"}, + "pod_cidrs": {"key": "podCidrs", "type": "[str]"}, + "service_cidrs": {"key": "serviceCidrs", "type": "[str]"}, + "ip_families": {"key": "ipFamilies", "type": "[str]"}, } def __init__( self, *, - network_plugin: Optional[Union[str, "_models.NetworkPlugin"]] = "kubenet", + network_plugin: Union[str, "_models.NetworkPlugin"] = "kubenet", network_policy: Optional[Union[str, "_models.NetworkPolicy"]] = None, network_mode: Optional[Union[str, "_models.NetworkMode"]] = None, - pod_cidr: Optional[str] = "10.244.0.0/16", - service_cidr: Optional[str] = "10.0.0.0/16", - dns_service_ip: Optional[str] = "10.0.0.10", - docker_bridge_cidr: Optional[str] = "172.17.0.1/16", - outbound_type: Optional[Union[str, "_models.OutboundType"]] = "loadBalancer", + pod_cidr: str = "10.244.0.0/16", + service_cidr: str = "10.0.0.0/16", + dns_service_ip: str = "10.0.0.10", + docker_bridge_cidr: str = "172.17.0.1/16", + outbound_type: Union[str, "_models.OutboundType"] = "loadBalancer", load_balancer_sku: Optional[Union[str, "_models.LoadBalancerSku"]] = None, load_balancer_profile: Optional["_models.ManagedClusterLoadBalancerProfile"] = None, nat_gateway_profile: Optional["_models.ManagedClusterNATGatewayProfile"] = None, @@ -1133,13 +1103,13 @@ def __init__( ): """ :keyword network_plugin: Network plugin used for building the Kubernetes network. Known values - are: "azure", "kubenet". Default value: "kubenet". + are: "azure" and "kubenet". :paramtype network_plugin: str or ~azure.mgmt.containerservice.v2022_02_01.models.NetworkPlugin :keyword network_policy: Network policy used for building the Kubernetes network. Known values - are: "calico", "azure". + are: "calico" and "azure". :paramtype network_policy: str or ~azure.mgmt.containerservice.v2022_02_01.models.NetworkPolicy :keyword network_mode: This cannot be specified if networkPlugin is anything other than - 'azure'. Known values are: "transparent", "bridge". + 'azure'. Known values are: "transparent" and "bridge". :paramtype network_mode: str or ~azure.mgmt.containerservice.v2022_02_01.models.NetworkMode :keyword pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :paramtype pod_cidr: str @@ -1155,12 +1125,11 @@ def __init__( :keyword outbound_type: This can only be set at cluster creation time and cannot be changed later. For more information see `egress outbound type `_. Known values are: "loadBalancer", - "userDefinedRouting", "managedNATGateway", "userAssignedNATGateway". Default value: - "loadBalancer". + "userDefinedRouting", "managedNATGateway", and "userAssignedNATGateway". :paramtype outbound_type: str or ~azure.mgmt.containerservice.v2022_02_01.models.OutboundType :keyword load_balancer_sku: The default is 'standard'. See `Azure Load Balancer SKUs `_ for more information about the - differences between load balancer SKUs. Known values are: "standard", "basic". + differences between load balancer SKUs. Known values are: "standard" and "basic". :paramtype load_balancer_sku: str or ~azure.mgmt.containerservice.v2022_02_01.models.LoadBalancerSku :keyword load_balancer_profile: Profile of the cluster load balancer. @@ -1181,7 +1150,7 @@ def __init__( IPv6. :paramtype ip_families: list[str or ~azure.mgmt.containerservice.v2022_02_01.models.IpFamily] """ - super(ContainerServiceNetworkProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.network_plugin = network_plugin self.network_policy = network_policy self.network_mode = network_mode @@ -1198,113 +1167,98 @@ def __init__( self.ip_families = ip_families -class ContainerServiceSshConfiguration(msrest.serialization.Model): +class ContainerServiceSshConfiguration(_serialization.Model): """SSH configuration for Linux-based VMs running on Azure. All required parameters must be populated in order to send to Azure. - :ivar public_keys: Required. The list of SSH public keys used to authenticate with Linux-based - VMs. A maximum of 1 key may be specified. + :ivar public_keys: The list of SSH public keys used to authenticate with Linux-based VMs. A + maximum of 1 key may be specified. Required. :vartype public_keys: list[~azure.mgmt.containerservice.v2022_02_01.models.ContainerServiceSshPublicKey] """ _validation = { - 'public_keys': {'required': True}, + "public_keys": {"required": True}, } _attribute_map = { - 'public_keys': {'key': 'publicKeys', 'type': '[ContainerServiceSshPublicKey]'}, + "public_keys": {"key": "publicKeys", "type": "[ContainerServiceSshPublicKey]"}, } - def __init__( - self, - *, - public_keys: List["_models.ContainerServiceSshPublicKey"], - **kwargs - ): + def __init__(self, *, public_keys: List["_models.ContainerServiceSshPublicKey"], **kwargs): """ - :keyword public_keys: Required. The list of SSH public keys used to authenticate with - Linux-based VMs. A maximum of 1 key may be specified. + :keyword public_keys: The list of SSH public keys used to authenticate with Linux-based VMs. A + maximum of 1 key may be specified. Required. :paramtype public_keys: list[~azure.mgmt.containerservice.v2022_02_01.models.ContainerServiceSshPublicKey] """ - super(ContainerServiceSshConfiguration, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_keys = public_keys -class ContainerServiceSshPublicKey(msrest.serialization.Model): +class ContainerServiceSshPublicKey(_serialization.Model): """Contains information about SSH certificate public key data. All required parameters must be populated in order to send to Azure. - :ivar key_data: Required. Certificate public key used to authenticate with VMs through SSH. The - certificate must be in PEM format with or without headers. + :ivar key_data: Certificate public key used to authenticate with VMs through SSH. The + certificate must be in PEM format with or without headers. Required. :vartype key_data: str """ _validation = { - 'key_data': {'required': True}, + "key_data": {"required": True}, } _attribute_map = { - 'key_data': {'key': 'keyData', 'type': 'str'}, + "key_data": {"key": "keyData", "type": "str"}, } - def __init__( - self, - *, - key_data: str, - **kwargs - ): + def __init__(self, *, key_data: str, **kwargs): """ - :keyword key_data: Required. Certificate public key used to authenticate with VMs through SSH. - The certificate must be in PEM format with or without headers. + :keyword key_data: Certificate public key used to authenticate with VMs through SSH. The + certificate must be in PEM format with or without headers. Required. :paramtype key_data: str """ - super(ContainerServiceSshPublicKey, self).__init__(**kwargs) + super().__init__(**kwargs) self.key_data = key_data -class ContainerServiceVMDiagnostics(msrest.serialization.Model): +class ContainerServiceVMDiagnostics(_serialization.Model): """Profile for diagnostics on the container service VMs. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar enabled: Required. Whether the VM diagnostic agent is provisioned on the VM. + :ivar enabled: Whether the VM diagnostic agent is provisioned on the VM. Required. :vartype enabled: bool :ivar storage_uri: The URI of the storage account where diagnostics are stored. :vartype storage_uri: str """ _validation = { - 'enabled': {'required': True}, - 'storage_uri': {'readonly': True}, + "enabled": {"required": True}, + "storage_uri": {"readonly": True}, } _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'storage_uri': {'key': 'storageUri', 'type': 'str'}, + "enabled": {"key": "enabled", "type": "bool"}, + "storage_uri": {"key": "storageUri", "type": "str"}, } - def __init__( - self, - *, - enabled: bool, - **kwargs - ): + def __init__(self, *, enabled: bool, **kwargs): """ - :keyword enabled: Required. Whether the VM diagnostic agent is provisioned on the VM. + :keyword enabled: Whether the VM diagnostic agent is provisioned on the VM. Required. :paramtype enabled: bool """ - super(ContainerServiceVMDiagnostics, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.storage_uri = None -class CreationData(msrest.serialization.Model): +class CreationData(_serialization.Model): """Data used when creating a target resource from a source resource. :ivar source_resource_id: This is the ARM ID of the source object to be used to create the @@ -1313,25 +1267,20 @@ class CreationData(msrest.serialization.Model): """ _attribute_map = { - 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, + "source_resource_id": {"key": "sourceResourceId", "type": "str"}, } - def __init__( - self, - *, - source_resource_id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, source_resource_id: Optional[str] = None, **kwargs): """ :keyword source_resource_id: This is the ARM ID of the source object to be used to create the target object. :paramtype source_resource_id: str """ - super(CreationData, self).__init__(**kwargs) + super().__init__(**kwargs) self.source_resource_id = source_resource_id -class CredentialResult(msrest.serialization.Model): +class CredentialResult(_serialization.Model): """The credential result response. Variables are only populated by the server, and will be ignored when sending a request. @@ -1339,31 +1288,27 @@ class CredentialResult(msrest.serialization.Model): :ivar name: The name of the credential. :vartype name: str :ivar value: Base64-encoded Kubernetes configuration file. - :vartype value: bytearray + :vartype value: bytes """ _validation = { - 'name': {'readonly': True}, - 'value': {'readonly': True}, + "name": {"readonly": True}, + "value": {"readonly": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'bytearray'}, + "name": {"key": "name", "type": "str"}, + "value": {"key": "value", "type": "bytearray"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(CredentialResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.name = None self.value = None -class CredentialResults(msrest.serialization.Model): +class CredentialResults(_serialization.Model): """The list credential result response. Variables are only populated by the server, and will be ignored when sending a request. @@ -1373,24 +1318,20 @@ class CredentialResults(msrest.serialization.Model): """ _validation = { - 'kubeconfigs': {'readonly': True}, + "kubeconfigs": {"readonly": True}, } _attribute_map = { - 'kubeconfigs': {'key': 'kubeconfigs', 'type': '[CredentialResult]'}, + "kubeconfigs": {"key": "kubeconfigs", "type": "[CredentialResult]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(CredentialResults, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.kubeconfigs = None -class EndpointDependency(msrest.serialization.Model): +class EndpointDependency(_serialization.Model): """A domain name that AKS agent nodes are reaching at. :ivar domain_name: The domain name of the dependency. @@ -1400,8 +1341,8 @@ class EndpointDependency(msrest.serialization.Model): """ _attribute_map = { - 'domain_name': {'key': 'domainName', 'type': 'str'}, - 'endpoint_details': {'key': 'endpointDetails', 'type': '[EndpointDetail]'}, + "domain_name": {"key": "domainName", "type": "str"}, + "endpoint_details": {"key": "endpointDetails", "type": "[EndpointDetail]"}, } def __init__( @@ -1418,12 +1359,12 @@ def __init__( :paramtype endpoint_details: list[~azure.mgmt.containerservice.v2022_02_01.models.EndpointDetail] """ - super(EndpointDependency, self).__init__(**kwargs) + super().__init__(**kwargs) self.domain_name = domain_name self.endpoint_details = endpoint_details -class EndpointDetail(msrest.serialization.Model): +class EndpointDetail(_serialization.Model): """connect information from the AKS agent nodes to a single endpoint. :ivar ip_address: An IP Address that Domain Name currently resolves to. @@ -1437,10 +1378,10 @@ class EndpointDetail(msrest.serialization.Model): """ _attribute_map = { - 'ip_address': {'key': 'ipAddress', 'type': 'str'}, - 'port': {'key': 'port', 'type': 'int'}, - 'protocol': {'key': 'protocol', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, + "ip_address": {"key": "ipAddress", "type": "str"}, + "port": {"key": "port", "type": "int"}, + "protocol": {"key": "protocol", "type": "str"}, + "description": {"key": "description", "type": "str"}, } def __init__( @@ -1462,25 +1403,25 @@ def __init__( :keyword description: Description of the detail. :paramtype description: str """ - super(EndpointDetail, self).__init__(**kwargs) + super().__init__(**kwargs) self.ip_address = ip_address self.port = port self.protocol = protocol self.description = description -class ExtendedLocation(msrest.serialization.Model): +class ExtendedLocation(_serialization.Model): """The complex type of the extended location. :ivar name: The name of the extended location. :vartype name: str - :ivar type: The type of the extended location. Known values are: "EdgeZone". + :ivar type: The type of the extended location. "EdgeZone" :vartype type: str or ~azure.mgmt.containerservice.v2022_02_01.models.ExtendedLocationTypes """ _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, } def __init__( @@ -1493,15 +1434,15 @@ def __init__( """ :keyword name: The name of the extended location. :paramtype name: str - :keyword type: The type of the extended location. Known values are: "EdgeZone". + :keyword type: The type of the extended location. "EdgeZone" :paramtype type: str or ~azure.mgmt.containerservice.v2022_02_01.models.ExtendedLocationTypes """ - super(ExtendedLocation, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.type = type -class KubeletConfig(msrest.serialization.Model): +class KubeletConfig(_serialization.Model): # pylint: disable=too-many-instance-attributes """See `AKS custom node configuration `_ for more details. :ivar cpu_manager_policy: The default is 'none'. See `Kubernetes CPU management policies @@ -1541,21 +1482,21 @@ class KubeletConfig(msrest.serialization.Model): """ _validation = { - 'container_log_max_files': {'minimum': 2}, + "container_log_max_files": {"minimum": 2}, } _attribute_map = { - 'cpu_manager_policy': {'key': 'cpuManagerPolicy', 'type': 'str'}, - 'cpu_cfs_quota': {'key': 'cpuCfsQuota', 'type': 'bool'}, - 'cpu_cfs_quota_period': {'key': 'cpuCfsQuotaPeriod', 'type': 'str'}, - 'image_gc_high_threshold': {'key': 'imageGcHighThreshold', 'type': 'int'}, - 'image_gc_low_threshold': {'key': 'imageGcLowThreshold', 'type': 'int'}, - 'topology_manager_policy': {'key': 'topologyManagerPolicy', 'type': 'str'}, - 'allowed_unsafe_sysctls': {'key': 'allowedUnsafeSysctls', 'type': '[str]'}, - 'fail_swap_on': {'key': 'failSwapOn', 'type': 'bool'}, - 'container_log_max_size_mb': {'key': 'containerLogMaxSizeMB', 'type': 'int'}, - 'container_log_max_files': {'key': 'containerLogMaxFiles', 'type': 'int'}, - 'pod_max_pids': {'key': 'podMaxPids', 'type': 'int'}, + "cpu_manager_policy": {"key": "cpuManagerPolicy", "type": "str"}, + "cpu_cfs_quota": {"key": "cpuCfsQuota", "type": "bool"}, + "cpu_cfs_quota_period": {"key": "cpuCfsQuotaPeriod", "type": "str"}, + "image_gc_high_threshold": {"key": "imageGcHighThreshold", "type": "int"}, + "image_gc_low_threshold": {"key": "imageGcLowThreshold", "type": "int"}, + "topology_manager_policy": {"key": "topologyManagerPolicy", "type": "str"}, + "allowed_unsafe_sysctls": {"key": "allowedUnsafeSysctls", "type": "[str]"}, + "fail_swap_on": {"key": "failSwapOn", "type": "bool"}, + "container_log_max_size_mb": {"key": "containerLogMaxSizeMB", "type": "int"}, + "container_log_max_files": {"key": "containerLogMaxFiles", "type": "int"}, + "pod_max_pids": {"key": "podMaxPids", "type": "int"}, } def __init__( @@ -1610,7 +1551,7 @@ def __init__( :keyword pod_max_pids: The maximum number of processes per pod. :paramtype pod_max_pids: int """ - super(KubeletConfig, self).__init__(**kwargs) + super().__init__(**kwargs) self.cpu_manager_policy = cpu_manager_policy self.cpu_cfs_quota = cpu_cfs_quota self.cpu_cfs_quota_period = cpu_cfs_quota_period @@ -1624,7 +1565,7 @@ def __init__( self.pod_max_pids = pod_max_pids -class LinuxOSConfig(msrest.serialization.Model): +class LinuxOSConfig(_serialization.Model): """See `AKS custom node configuration `_ for more details. :ivar sysctls: Sysctl settings for Linux agent nodes. @@ -1643,10 +1584,10 @@ class LinuxOSConfig(msrest.serialization.Model): """ _attribute_map = { - 'sysctls': {'key': 'sysctls', 'type': 'SysctlConfig'}, - 'transparent_huge_page_enabled': {'key': 'transparentHugePageEnabled', 'type': 'str'}, - 'transparent_huge_page_defrag': {'key': 'transparentHugePageDefrag', 'type': 'str'}, - 'swap_file_size_mb': {'key': 'swapFileSizeMB', 'type': 'int'}, + "sysctls": {"key": "sysctls", "type": "SysctlConfig"}, + "transparent_huge_page_enabled": {"key": "transparentHugePageEnabled", "type": "str"}, + "transparent_huge_page_defrag": {"key": "transparentHugePageDefrag", "type": "str"}, + "swap_file_size_mb": {"key": "swapFileSizeMB", "type": "int"}, } def __init__( @@ -1673,7 +1614,7 @@ def __init__( :keyword swap_file_size_mb: The size in MB of a swap file that will be created on each node. :paramtype swap_file_size_mb: int """ - super(LinuxOSConfig, self).__init__(**kwargs) + super().__init__(**kwargs) self.sysctls = sysctls self.transparent_huge_page_enabled = transparent_huge_page_enabled self.transparent_huge_page_defrag = transparent_huge_page_defrag @@ -1702,19 +1643,19 @@ class MaintenanceConfiguration(SubResource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, + "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'}, - 'time_in_week': {'key': 'properties.timeInWeek', 'type': '[TimeInWeek]'}, - 'not_allowed_time': {'key': 'properties.notAllowedTime', 'type': '[TimeSpan]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "time_in_week": {"key": "properties.timeInWeek", "type": "[TimeInWeek]"}, + "not_allowed_time": {"key": "properties.notAllowedTime", "type": "[TimeSpan]"}, } def __init__( @@ -1731,13 +1672,13 @@ def __init__( :keyword not_allowed_time: Time slots on which upgrade is not allowed. :paramtype not_allowed_time: list[~azure.mgmt.containerservice.v2022_02_01.models.TimeSpan] """ - super(MaintenanceConfiguration, self).__init__(**kwargs) + super().__init__(**kwargs) self.system_data = None self.time_in_week = time_in_week self.not_allowed_time = not_allowed_time -class MaintenanceConfigurationListResult(msrest.serialization.Model): +class MaintenanceConfigurationListResult(_serialization.Model): """The response from the List maintenance configurations operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -1749,31 +1690,26 @@ class MaintenanceConfigurationListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[MaintenanceConfiguration]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[MaintenanceConfiguration]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.MaintenanceConfiguration"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.MaintenanceConfiguration"]] = None, **kwargs): """ :keyword value: The list of maintenance configurations. :paramtype value: list[~azure.mgmt.containerservice.v2022_02_01.models.MaintenanceConfiguration] """ - super(MaintenanceConfigurationListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class Resource(msrest.serialization.Model): +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. @@ -1791,43 +1727,37 @@ class Resource(msrest.serialization.Model): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.containerservice.v2022_02_01.models.SystemData - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'location': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] """ - super(Resource, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -1836,7 +1766,7 @@ def __init__( self.tags = tags -class ManagedCluster(Resource): +class ManagedCluster(Resource): # pylint: disable=too-many-instance-attributes """Managed cluster. Variables are only populated by the server, and will be ignored when sending a request. @@ -1854,9 +1784,9 @@ class ManagedCluster(Resource): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.containerservice.v2022_02_01.models.SystemData - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar sku: The managed cluster SKU. :vartype sku: ~azure.mgmt.containerservice.v2022_02_01.models.ManagedClusterSKU @@ -1952,68 +1882,77 @@ class ManagedCluster(Resource): :vartype security_profile: ~azure.mgmt.containerservice.v2022_02_01.models.ManagedClusterSecurityProfile :ivar public_network_access: Allow or deny public network access for AKS. Known values are: - "Enabled", "Disabled". + "Enabled" and "Disabled". :vartype public_network_access: str or ~azure.mgmt.containerservice.v2022_02_01.models.PublicNetworkAccess """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'location': {'required': True}, - 'provisioning_state': {'readonly': True}, - 'power_state': {'readonly': True}, - 'max_agent_pools': {'readonly': True}, - 'fqdn': {'readonly': True}, - 'private_fqdn': {'readonly': True}, - 'azure_portal_fqdn': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, + "provisioning_state": {"readonly": True}, + "power_state": {"readonly": True}, + "max_agent_pools": {"readonly": True}, + "fqdn": {"readonly": True}, + "private_fqdn": {"readonly": True}, + "azure_portal_fqdn": {"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'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'ManagedClusterSKU'}, - 'extended_location': {'key': 'extendedLocation', 'type': 'ExtendedLocation'}, - 'identity': {'key': 'identity', 'type': 'ManagedClusterIdentity'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'power_state': {'key': 'properties.powerState', 'type': 'PowerState'}, - 'max_agent_pools': {'key': 'properties.maxAgentPools', 'type': 'int'}, - 'kubernetes_version': {'key': 'properties.kubernetesVersion', 'type': 'str'}, - 'dns_prefix': {'key': 'properties.dnsPrefix', 'type': 'str'}, - 'fqdn_subdomain': {'key': 'properties.fqdnSubdomain', 'type': 'str'}, - 'fqdn': {'key': 'properties.fqdn', 'type': 'str'}, - 'private_fqdn': {'key': 'properties.privateFQDN', 'type': 'str'}, - 'azure_portal_fqdn': {'key': 'properties.azurePortalFQDN', 'type': 'str'}, - 'agent_pool_profiles': {'key': 'properties.agentPoolProfiles', 'type': '[ManagedClusterAgentPoolProfile]'}, - 'linux_profile': {'key': 'properties.linuxProfile', 'type': 'ContainerServiceLinuxProfile'}, - 'windows_profile': {'key': 'properties.windowsProfile', 'type': 'ManagedClusterWindowsProfile'}, - 'service_principal_profile': {'key': 'properties.servicePrincipalProfile', 'type': 'ManagedClusterServicePrincipalProfile'}, - 'addon_profiles': {'key': 'properties.addonProfiles', 'type': '{ManagedClusterAddonProfile}'}, - 'pod_identity_profile': {'key': 'properties.podIdentityProfile', 'type': 'ManagedClusterPodIdentityProfile'}, - 'node_resource_group': {'key': 'properties.nodeResourceGroup', 'type': 'str'}, - 'enable_rbac': {'key': 'properties.enableRBAC', 'type': 'bool'}, - 'enable_pod_security_policy': {'key': 'properties.enablePodSecurityPolicy', 'type': 'bool'}, - 'network_profile': {'key': 'properties.networkProfile', 'type': 'ContainerServiceNetworkProfile'}, - 'aad_profile': {'key': 'properties.aadProfile', 'type': 'ManagedClusterAADProfile'}, - 'auto_upgrade_profile': {'key': 'properties.autoUpgradeProfile', 'type': 'ManagedClusterAutoUpgradeProfile'}, - 'auto_scaler_profile': {'key': 'properties.autoScalerProfile', 'type': 'ManagedClusterPropertiesAutoScalerProfile'}, - 'api_server_access_profile': {'key': 'properties.apiServerAccessProfile', 'type': 'ManagedClusterAPIServerAccessProfile'}, - 'disk_encryption_set_id': {'key': 'properties.diskEncryptionSetID', 'type': 'str'}, - 'identity_profile': {'key': 'properties.identityProfile', 'type': '{UserAssignedIdentity}'}, - 'private_link_resources': {'key': 'properties.privateLinkResources', 'type': '[PrivateLinkResource]'}, - 'disable_local_accounts': {'key': 'properties.disableLocalAccounts', 'type': 'bool'}, - 'http_proxy_config': {'key': 'properties.httpProxyConfig', 'type': 'ManagedClusterHTTPProxyConfig'}, - 'security_profile': {'key': 'properties.securityProfile', 'type': 'ManagedClusterSecurityProfile'}, - 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, - } - - def __init__( + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "sku": {"key": "sku", "type": "ManagedClusterSKU"}, + "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, + "identity": {"key": "identity", "type": "ManagedClusterIdentity"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "power_state": {"key": "properties.powerState", "type": "PowerState"}, + "max_agent_pools": {"key": "properties.maxAgentPools", "type": "int"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "dns_prefix": {"key": "properties.dnsPrefix", "type": "str"}, + "fqdn_subdomain": {"key": "properties.fqdnSubdomain", "type": "str"}, + "fqdn": {"key": "properties.fqdn", "type": "str"}, + "private_fqdn": {"key": "properties.privateFQDN", "type": "str"}, + "azure_portal_fqdn": {"key": "properties.azurePortalFQDN", "type": "str"}, + "agent_pool_profiles": {"key": "properties.agentPoolProfiles", "type": "[ManagedClusterAgentPoolProfile]"}, + "linux_profile": {"key": "properties.linuxProfile", "type": "ContainerServiceLinuxProfile"}, + "windows_profile": {"key": "properties.windowsProfile", "type": "ManagedClusterWindowsProfile"}, + "service_principal_profile": { + "key": "properties.servicePrincipalProfile", + "type": "ManagedClusterServicePrincipalProfile", + }, + "addon_profiles": {"key": "properties.addonProfiles", "type": "{ManagedClusterAddonProfile}"}, + "pod_identity_profile": {"key": "properties.podIdentityProfile", "type": "ManagedClusterPodIdentityProfile"}, + "node_resource_group": {"key": "properties.nodeResourceGroup", "type": "str"}, + "enable_rbac": {"key": "properties.enableRBAC", "type": "bool"}, + "enable_pod_security_policy": {"key": "properties.enablePodSecurityPolicy", "type": "bool"}, + "network_profile": {"key": "properties.networkProfile", "type": "ContainerServiceNetworkProfile"}, + "aad_profile": {"key": "properties.aadProfile", "type": "ManagedClusterAADProfile"}, + "auto_upgrade_profile": {"key": "properties.autoUpgradeProfile", "type": "ManagedClusterAutoUpgradeProfile"}, + "auto_scaler_profile": { + "key": "properties.autoScalerProfile", + "type": "ManagedClusterPropertiesAutoScalerProfile", + }, + "api_server_access_profile": { + "key": "properties.apiServerAccessProfile", + "type": "ManagedClusterAPIServerAccessProfile", + }, + "disk_encryption_set_id": {"key": "properties.diskEncryptionSetID", "type": "str"}, + "identity_profile": {"key": "properties.identityProfile", "type": "{UserAssignedIdentity}"}, + "private_link_resources": {"key": "properties.privateLinkResources", "type": "[PrivateLinkResource]"}, + "disable_local_accounts": {"key": "properties.disableLocalAccounts", "type": "bool"}, + "http_proxy_config": {"key": "properties.httpProxyConfig", "type": "ManagedClusterHTTPProxyConfig"}, + "security_profile": {"key": "properties.securityProfile", "type": "ManagedClusterSecurityProfile"}, + "public_network_access": {"key": "properties.publicNetworkAccess", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, location: str, @@ -2048,9 +1987,9 @@ def __init__( **kwargs ): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword sku: The managed cluster SKU. :paramtype sku: ~azure.mgmt.containerservice.v2022_02_01.models.ManagedClusterSKU @@ -2134,11 +2073,11 @@ def __init__( :paramtype security_profile: ~azure.mgmt.containerservice.v2022_02_01.models.ManagedClusterSecurityProfile :keyword public_network_access: Allow or deny public network access for AKS. Known values are: - "Enabled", "Disabled". + "Enabled" and "Disabled". :paramtype public_network_access: str or ~azure.mgmt.containerservice.v2022_02_01.models.PublicNetworkAccess """ - super(ManagedCluster, self).__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.sku = sku self.extended_location = extended_location self.identity = identity @@ -2174,7 +2113,7 @@ def __init__( self.public_network_access = public_network_access -class ManagedClusterAADProfile(msrest.serialization.Model): +class ManagedClusterAADProfile(_serialization.Model): """For more details see `managed AAD on AKS `_. :ivar managed: Whether to enable managed AAD. @@ -2196,13 +2135,13 @@ class ManagedClusterAADProfile(msrest.serialization.Model): """ _attribute_map = { - 'managed': {'key': 'managed', 'type': 'bool'}, - 'enable_azure_rbac': {'key': 'enableAzureRBAC', 'type': 'bool'}, - 'admin_group_object_i_ds': {'key': 'adminGroupObjectIDs', 'type': '[str]'}, - 'client_app_id': {'key': 'clientAppID', 'type': 'str'}, - 'server_app_id': {'key': 'serverAppID', 'type': 'str'}, - 'server_app_secret': {'key': 'serverAppSecret', 'type': 'str'}, - 'tenant_id': {'key': 'tenantID', 'type': 'str'}, + "managed": {"key": "managed", "type": "bool"}, + "enable_azure_rbac": {"key": "enableAzureRBAC", "type": "bool"}, + "admin_group_object_i_ds": {"key": "adminGroupObjectIDs", "type": "[str]"}, + "client_app_id": {"key": "clientAppID", "type": "str"}, + "server_app_id": {"key": "serverAppID", "type": "str"}, + "server_app_secret": {"key": "serverAppSecret", "type": "str"}, + "tenant_id": {"key": "tenantID", "type": "str"}, } def __init__( @@ -2235,7 +2174,7 @@ def __init__( tenant of the deployment subscription. :paramtype tenant_id: str """ - super(ManagedClusterAADProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.managed = managed self.enable_azure_rbac = enable_azure_rbac self.admin_group_object_i_ds = admin_group_object_i_ds @@ -2263,60 +2202,55 @@ class ManagedClusterAccessProfile(Resource): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.containerservice.v2022_02_01.models.SystemData - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar kube_config: Base64-encoded Kubernetes configuration file. - :vartype kube_config: bytearray + :vartype kube_config: bytes """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'location': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'kube_config': {'key': 'properties.kubeConfig', 'type': 'bytearray'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "kube_config": {"key": "properties.kubeConfig", "type": "bytearray"}, } def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - kube_config: Optional[bytearray] = None, - **kwargs + self, *, location: str, tags: Optional[Dict[str, str]] = None, kube_config: Optional[bytes] = None, **kwargs ): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword kube_config: Base64-encoded Kubernetes configuration file. - :paramtype kube_config: bytearray + :paramtype kube_config: bytes """ - super(ManagedClusterAccessProfile, self).__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.kube_config = kube_config -class ManagedClusterAddonProfile(msrest.serialization.Model): +class ManagedClusterAddonProfile(_serialization.Model): """A Kubernetes add-on profile for a managed cluster. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar enabled: Required. Whether the add-on is enabled or not. + :ivar enabled: Whether the add-on is enabled or not. Required. :vartype enabled: bool :ivar config: Key-value pairs for configuring an add-on. :vartype config: dict[str, str] @@ -2326,36 +2260,30 @@ class ManagedClusterAddonProfile(msrest.serialization.Model): """ _validation = { - 'enabled': {'required': True}, - 'identity': {'readonly': True}, + "enabled": {"required": True}, + "identity": {"readonly": True}, } _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'config': {'key': 'config', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'ManagedClusterAddonProfileIdentity'}, + "enabled": {"key": "enabled", "type": "bool"}, + "config": {"key": "config", "type": "{str}"}, + "identity": {"key": "identity", "type": "ManagedClusterAddonProfileIdentity"}, } - def __init__( - self, - *, - enabled: bool, - config: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, enabled: bool, config: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword enabled: Required. Whether the add-on is enabled or not. + :keyword enabled: Whether the add-on is enabled or not. Required. :paramtype enabled: bool :keyword config: Key-value pairs for configuring an add-on. :paramtype config: dict[str, str] """ - super(ManagedClusterAddonProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.config = config self.identity = None -class UserAssignedIdentity(msrest.serialization.Model): +class UserAssignedIdentity(_serialization.Model): """Details about a user assigned identity. :ivar resource_id: The resource ID of the user assigned identity. @@ -2367,9 +2295,9 @@ class UserAssignedIdentity(msrest.serialization.Model): """ _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'object_id': {'key': 'objectId', 'type': 'str'}, + "resource_id": {"key": "resourceId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + "object_id": {"key": "objectId", "type": "str"}, } def __init__( @@ -2388,7 +2316,7 @@ def __init__( :keyword object_id: The object ID of the user assigned identity. :paramtype object_id: str """ - super(UserAssignedIdentity, self).__init__(**kwargs) + super().__init__(**kwargs) self.resource_id = resource_id self.client_id = client_id self.object_id = object_id @@ -2406,9 +2334,9 @@ class ManagedClusterAddonProfileIdentity(UserAssignedIdentity): """ _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'object_id': {'key': 'objectId', 'type': 'str'}, + "resource_id": {"key": "resourceId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + "object_id": {"key": "objectId", "type": "str"}, } def __init__( @@ -2427,10 +2355,10 @@ def __init__( :keyword object_id: The object ID of the user assigned identity. :paramtype object_id: str """ - super(ManagedClusterAddonProfileIdentity, self).__init__(resource_id=resource_id, client_id=client_id, object_id=object_id, **kwargs) + super().__init__(resource_id=resource_id, client_id=client_id, object_id=object_id, **kwargs) -class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): +class ManagedClusterAgentPoolProfileProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes """Properties for the container service agent pool profile. Variables are only populated by the server, and will be ignored when sending a request. @@ -2451,14 +2379,14 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2022_02_01.models.OSDiskType :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data - root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_02_01.models.KubeletDiskType :ivar workload_runtime: Determines the type of workload a node can run. Known values are: - "OCIContainer", "WasmWasi". + "OCIContainer" and "WasmWasi". :vartype workload_runtime: str or ~azure.mgmt.containerservice.v2022_02_01.models.WorkloadRuntime :ivar vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and used. @@ -2472,11 +2400,11 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :vartype pod_subnet_id: str :ivar max_pods: The maximum number of pods that can run on a node. :vartype max_pods: int - :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_02_01.models.OSType :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known - values are: "Ubuntu", "CBLMariner". + values are: "Ubuntu" and "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2022_02_01.models.OSSKU :ivar max_count: The maximum number of nodes for auto-scaling. :vartype max_count: int @@ -2485,14 +2413,14 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it - defaults to Delete. Known values are: "Delete", "Deallocate". + defaults to Delete. Known values are: "Delete" and "Deallocate". :vartype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_02_01.models.ScaleDownMode - :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", + :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets" and "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2022_02_01.models.AgentPoolType :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :vartype mode: str or ~azure.mgmt.containerservice.v2022_02_01.models.AgentPoolMode :ivar orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -2527,20 +2455,18 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default - is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + is 'Regular'. Known values are: "Spot" and "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_02_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_02_01.models.ScaleSetEvictionPolicy :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :vartype spot_max_price: float - :ivar tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :ivar tags: The tags to be persisted on the agent pool virtual machine scale set. :vartype tags: dict[str, str] :ivar node_labels: The node labels to be persisted across all nodes in agent pool. :vartype node_labels: dict[str, str] @@ -2564,7 +2490,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): for more details. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_02_01.models.GPUInstanceProfile :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the node pool @@ -2573,54 +2499,54 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): """ _validation = { - 'os_disk_size_gb': {'maximum': 2048, 'minimum': 0}, - 'node_image_version': {'readonly': True}, - 'provisioning_state': {'readonly': True}, + "os_disk_size_gb": {"maximum": 2048, "minimum": 0}, + "node_image_version": {"readonly": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'os_disk_type': {'key': 'osDiskType', 'type': 'str'}, - 'kubelet_disk_type': {'key': 'kubeletDiskType', 'type': 'str'}, - 'workload_runtime': {'key': 'workloadRuntime', 'type': 'str'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'pod_subnet_id': {'key': 'podSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'maxPods', 'type': 'int'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'os_sku': {'key': 'osSKU', 'type': 'str'}, - 'max_count': {'key': 'maxCount', 'type': 'int'}, - 'min_count': {'key': 'minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'enableAutoScaling', 'type': 'bool'}, - 'scale_down_mode': {'key': 'scaleDownMode', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'mode': {'key': 'mode', 'type': 'str'}, - 'orchestrator_version': {'key': 'orchestratorVersion', 'type': 'str'}, - 'node_image_version': {'key': 'nodeImageVersion', 'type': 'str'}, - 'upgrade_settings': {'key': 'upgradeSettings', 'type': 'AgentPoolUpgradeSettings'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'power_state': {'key': 'powerState', 'type': 'PowerState'}, - 'availability_zones': {'key': 'availabilityZones', 'type': '[str]'}, - 'enable_node_public_ip': {'key': 'enableNodePublicIP', 'type': 'bool'}, - 'node_public_ip_prefix_id': {'key': 'nodePublicIPPrefixID', 'type': 'str'}, - 'scale_set_priority': {'key': 'scaleSetPriority', 'type': 'str'}, - 'scale_set_eviction_policy': {'key': 'scaleSetEvictionPolicy', 'type': 'str'}, - 'spot_max_price': {'key': 'spotMaxPrice', 'type': 'float'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'node_labels': {'key': 'nodeLabels', 'type': '{str}'}, - 'node_taints': {'key': 'nodeTaints', 'type': '[str]'}, - 'proximity_placement_group_id': {'key': 'proximityPlacementGroupID', 'type': 'str'}, - 'kubelet_config': {'key': 'kubeletConfig', 'type': 'KubeletConfig'}, - 'linux_os_config': {'key': 'linuxOSConfig', 'type': 'LinuxOSConfig'}, - 'enable_encryption_at_host': {'key': 'enableEncryptionAtHost', 'type': 'bool'}, - 'enable_ultra_ssd': {'key': 'enableUltraSSD', 'type': 'bool'}, - 'enable_fips': {'key': 'enableFIPS', 'type': 'bool'}, - 'gpu_instance_profile': {'key': 'gpuInstanceProfile', 'type': 'str'}, - 'creation_data': {'key': 'creationData', 'type': 'CreationData'}, - } - - def __init__( + "count": {"key": "count", "type": "int"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "os_disk_type": {"key": "osDiskType", "type": "str"}, + "kubelet_disk_type": {"key": "kubeletDiskType", "type": "str"}, + "workload_runtime": {"key": "workloadRuntime", "type": "str"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "pod_subnet_id": {"key": "podSubnetID", "type": "str"}, + "max_pods": {"key": "maxPods", "type": "int"}, + "os_type": {"key": "osType", "type": "str"}, + "os_sku": {"key": "osSKU", "type": "str"}, + "max_count": {"key": "maxCount", "type": "int"}, + "min_count": {"key": "minCount", "type": "int"}, + "enable_auto_scaling": {"key": "enableAutoScaling", "type": "bool"}, + "scale_down_mode": {"key": "scaleDownMode", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "mode": {"key": "mode", "type": "str"}, + "orchestrator_version": {"key": "orchestratorVersion", "type": "str"}, + "node_image_version": {"key": "nodeImageVersion", "type": "str"}, + "upgrade_settings": {"key": "upgradeSettings", "type": "AgentPoolUpgradeSettings"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "power_state": {"key": "powerState", "type": "PowerState"}, + "availability_zones": {"key": "availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "enableNodePublicIP", "type": "bool"}, + "node_public_ip_prefix_id": {"key": "nodePublicIPPrefixID", "type": "str"}, + "scale_set_priority": {"key": "scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "scaleSetEvictionPolicy", "type": "str"}, + "spot_max_price": {"key": "spotMaxPrice", "type": "float"}, + "tags": {"key": "tags", "type": "{str}"}, + "node_labels": {"key": "nodeLabels", "type": "{str}"}, + "node_taints": {"key": "nodeTaints", "type": "[str]"}, + "proximity_placement_group_id": {"key": "proximityPlacementGroupID", "type": "str"}, + "kubelet_config": {"key": "kubeletConfig", "type": "KubeletConfig"}, + "linux_os_config": {"key": "linuxOSConfig", "type": "LinuxOSConfig"}, + "enable_encryption_at_host": {"key": "enableEncryptionAtHost", "type": "bool"}, + "enable_ultra_ssd": {"key": "enableUltraSSD", "type": "bool"}, + "enable_fips": {"key": "enableFIPS", "type": "bool"}, + "gpu_instance_profile": {"key": "gpuInstanceProfile", "type": "str"}, + "creation_data": {"key": "creationData", "type": "CreationData"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, count: Optional[int] = None, @@ -2632,7 +2558,7 @@ def __init__( vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, @@ -2646,9 +2572,9 @@ def __init__( availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", - spot_max_price: Optional[float] = -1, + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", + spot_max_price: float = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, @@ -2679,14 +2605,14 @@ def __init__( larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2022_02_01.models.OSDiskType :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime - data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + data root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_02_01.models.KubeletDiskType :keyword workload_runtime: Determines the type of workload a node can run. Known values are: - "OCIContainer", "WasmWasi". + "OCIContainer" and "WasmWasi". :paramtype workload_runtime: str or ~azure.mgmt.containerservice.v2022_02_01.models.WorkloadRuntime :keyword vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and @@ -2700,11 +2626,11 @@ def __init__( :paramtype pod_subnet_id: str :keyword max_pods: The maximum number of pods that can run on a node. :paramtype max_pods: int - :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_02_01.models.OSType :keyword os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Known values are: "Ubuntu", "CBLMariner". + Known values are: "Ubuntu" and "CBLMariner". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2022_02_01.models.OSSKU :keyword max_count: The maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -2713,15 +2639,15 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, - it defaults to Delete. Known values are: "Delete", "Deallocate". + it defaults to Delete. Known values are: "Delete" and "Deallocate". :paramtype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_02_01.models.ScaleDownMode - :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", + :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2022_02_01.models.AgentPoolType :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2022_02_01.models.AgentPoolMode :keyword orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -2752,20 +2678,18 @@ def __init__( /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the - default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + default is 'Regular'. Known values are: "Spot" and "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_02_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_02_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :paramtype spot_max_price: float - :keyword tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :keyword tags: The tags to be persisted on the agent pool virtual machine scale set. :paramtype tags: dict[str, str] :keyword node_labels: The node labels to be persisted across all nodes in agent pool. :paramtype node_labels: dict[str, str] @@ -2789,7 +2713,7 @@ def __init__( for more details. :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance - profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_02_01.models.GPUInstanceProfile @@ -2797,7 +2721,7 @@ def __init__( pool will be created/upgraded using a snapshot. :paramtype creation_data: ~azure.mgmt.containerservice.v2022_02_01.models.CreationData """ - super(ManagedClusterAgentPoolProfileProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.vm_size = vm_size self.os_disk_size_gb = os_disk_size_gb @@ -2839,7 +2763,9 @@ def __init__( self.creation_data = creation_data -class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): +class ManagedClusterAgentPoolProfile( + ManagedClusterAgentPoolProfileProperties +): # pylint: disable=too-many-instance-attributes """Profile for the container service agent pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -2862,14 +2788,14 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2022_02_01.models.OSDiskType :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data - root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_02_01.models.KubeletDiskType :ivar workload_runtime: Determines the type of workload a node can run. Known values are: - "OCIContainer", "WasmWasi". + "OCIContainer" and "WasmWasi". :vartype workload_runtime: str or ~azure.mgmt.containerservice.v2022_02_01.models.WorkloadRuntime :ivar vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and used. @@ -2883,11 +2809,11 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :vartype pod_subnet_id: str :ivar max_pods: The maximum number of pods that can run on a node. :vartype max_pods: int - :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_02_01.models.OSType :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known - values are: "Ubuntu", "CBLMariner". + values are: "Ubuntu" and "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2022_02_01.models.OSSKU :ivar max_count: The maximum number of nodes for auto-scaling. :vartype max_count: int @@ -2896,14 +2822,14 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it - defaults to Delete. Known values are: "Delete", "Deallocate". + defaults to Delete. Known values are: "Delete" and "Deallocate". :vartype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_02_01.models.ScaleDownMode - :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", + :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets" and "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2022_02_01.models.AgentPoolType :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :vartype mode: str or ~azure.mgmt.containerservice.v2022_02_01.models.AgentPoolMode :ivar orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -2938,20 +2864,18 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default - is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + is 'Regular'. Known values are: "Spot" and "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_02_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_02_01.models.ScaleSetEvictionPolicy :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :vartype spot_max_price: float - :ivar tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :ivar tags: The tags to be persisted on the agent pool virtual machine scale set. :vartype tags: dict[str, str] :ivar node_labels: The node labels to be persisted across all nodes in agent pool. :vartype node_labels: dict[str, str] @@ -2975,67 +2899,67 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): for more details. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_02_01.models.GPUInstanceProfile :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the node pool will be created/upgraded using a snapshot. :vartype creation_data: ~azure.mgmt.containerservice.v2022_02_01.models.CreationData - :ivar name: Required. Windows agent pool names must be 6 characters or less. + :ivar name: Windows agent pool names must be 6 characters or less. Required. :vartype name: str """ _validation = { - 'os_disk_size_gb': {'maximum': 2048, 'minimum': 0}, - 'node_image_version': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'name': {'required': True, 'pattern': r'^[a-z][a-z0-9]{0,11}$'}, + "os_disk_size_gb": {"maximum": 2048, "minimum": 0}, + "node_image_version": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "name": {"required": True, "pattern": r"^[a-z][a-z0-9]{0,11}$"}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'os_disk_type': {'key': 'osDiskType', 'type': 'str'}, - 'kubelet_disk_type': {'key': 'kubeletDiskType', 'type': 'str'}, - 'workload_runtime': {'key': 'workloadRuntime', 'type': 'str'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'pod_subnet_id': {'key': 'podSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'maxPods', 'type': 'int'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'os_sku': {'key': 'osSKU', 'type': 'str'}, - 'max_count': {'key': 'maxCount', 'type': 'int'}, - 'min_count': {'key': 'minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'enableAutoScaling', 'type': 'bool'}, - 'scale_down_mode': {'key': 'scaleDownMode', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'mode': {'key': 'mode', 'type': 'str'}, - 'orchestrator_version': {'key': 'orchestratorVersion', 'type': 'str'}, - 'node_image_version': {'key': 'nodeImageVersion', 'type': 'str'}, - 'upgrade_settings': {'key': 'upgradeSettings', 'type': 'AgentPoolUpgradeSettings'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'power_state': {'key': 'powerState', 'type': 'PowerState'}, - 'availability_zones': {'key': 'availabilityZones', 'type': '[str]'}, - 'enable_node_public_ip': {'key': 'enableNodePublicIP', 'type': 'bool'}, - 'node_public_ip_prefix_id': {'key': 'nodePublicIPPrefixID', 'type': 'str'}, - 'scale_set_priority': {'key': 'scaleSetPriority', 'type': 'str'}, - 'scale_set_eviction_policy': {'key': 'scaleSetEvictionPolicy', 'type': 'str'}, - 'spot_max_price': {'key': 'spotMaxPrice', 'type': 'float'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'node_labels': {'key': 'nodeLabels', 'type': '{str}'}, - 'node_taints': {'key': 'nodeTaints', 'type': '[str]'}, - 'proximity_placement_group_id': {'key': 'proximityPlacementGroupID', 'type': 'str'}, - 'kubelet_config': {'key': 'kubeletConfig', 'type': 'KubeletConfig'}, - 'linux_os_config': {'key': 'linuxOSConfig', 'type': 'LinuxOSConfig'}, - 'enable_encryption_at_host': {'key': 'enableEncryptionAtHost', 'type': 'bool'}, - 'enable_ultra_ssd': {'key': 'enableUltraSSD', 'type': 'bool'}, - 'enable_fips': {'key': 'enableFIPS', 'type': 'bool'}, - 'gpu_instance_profile': {'key': 'gpuInstanceProfile', 'type': 'str'}, - 'creation_data': {'key': 'creationData', 'type': 'CreationData'}, - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( + "count": {"key": "count", "type": "int"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "os_disk_type": {"key": "osDiskType", "type": "str"}, + "kubelet_disk_type": {"key": "kubeletDiskType", "type": "str"}, + "workload_runtime": {"key": "workloadRuntime", "type": "str"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "pod_subnet_id": {"key": "podSubnetID", "type": "str"}, + "max_pods": {"key": "maxPods", "type": "int"}, + "os_type": {"key": "osType", "type": "str"}, + "os_sku": {"key": "osSKU", "type": "str"}, + "max_count": {"key": "maxCount", "type": "int"}, + "min_count": {"key": "minCount", "type": "int"}, + "enable_auto_scaling": {"key": "enableAutoScaling", "type": "bool"}, + "scale_down_mode": {"key": "scaleDownMode", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "mode": {"key": "mode", "type": "str"}, + "orchestrator_version": {"key": "orchestratorVersion", "type": "str"}, + "node_image_version": {"key": "nodeImageVersion", "type": "str"}, + "upgrade_settings": {"key": "upgradeSettings", "type": "AgentPoolUpgradeSettings"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "power_state": {"key": "powerState", "type": "PowerState"}, + "availability_zones": {"key": "availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "enableNodePublicIP", "type": "bool"}, + "node_public_ip_prefix_id": {"key": "nodePublicIPPrefixID", "type": "str"}, + "scale_set_priority": {"key": "scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "scaleSetEvictionPolicy", "type": "str"}, + "spot_max_price": {"key": "spotMaxPrice", "type": "float"}, + "tags": {"key": "tags", "type": "{str}"}, + "node_labels": {"key": "nodeLabels", "type": "{str}"}, + "node_taints": {"key": "nodeTaints", "type": "[str]"}, + "proximity_placement_group_id": {"key": "proximityPlacementGroupID", "type": "str"}, + "kubelet_config": {"key": "kubeletConfig", "type": "KubeletConfig"}, + "linux_os_config": {"key": "linuxOSConfig", "type": "LinuxOSConfig"}, + "enable_encryption_at_host": {"key": "enableEncryptionAtHost", "type": "bool"}, + "enable_ultra_ssd": {"key": "enableUltraSSD", "type": "bool"}, + "enable_fips": {"key": "enableFIPS", "type": "bool"}, + "gpu_instance_profile": {"key": "gpuInstanceProfile", "type": "str"}, + "creation_data": {"key": "creationData", "type": "CreationData"}, + "name": {"key": "name", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, name: str, @@ -3048,7 +2972,7 @@ def __init__( vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, @@ -3062,9 +2986,9 @@ def __init__( availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", - spot_max_price: Optional[float] = -1, + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", + spot_max_price: float = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, @@ -3095,14 +3019,14 @@ def __init__( larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2022_02_01.models.OSDiskType :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime - data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + data root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_02_01.models.KubeletDiskType :keyword workload_runtime: Determines the type of workload a node can run. Known values are: - "OCIContainer", "WasmWasi". + "OCIContainer" and "WasmWasi". :paramtype workload_runtime: str or ~azure.mgmt.containerservice.v2022_02_01.models.WorkloadRuntime :keyword vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and @@ -3116,11 +3040,11 @@ def __init__( :paramtype pod_subnet_id: str :keyword max_pods: The maximum number of pods that can run on a node. :paramtype max_pods: int - :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_02_01.models.OSType :keyword os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Known values are: "Ubuntu", "CBLMariner". + Known values are: "Ubuntu" and "CBLMariner". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2022_02_01.models.OSSKU :keyword max_count: The maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -3129,15 +3053,15 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, - it defaults to Delete. Known values are: "Delete", "Deallocate". + it defaults to Delete. Known values are: "Delete" and "Deallocate". :paramtype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_02_01.models.ScaleDownMode - :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", + :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2022_02_01.models.AgentPoolType :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2022_02_01.models.AgentPoolMode :keyword orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -3168,20 +3092,18 @@ def __init__( /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the - default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + default is 'Regular'. Known values are: "Spot" and "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_02_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_02_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :paramtype spot_max_price: float - :keyword tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :keyword tags: The tags to be persisted on the agent pool virtual machine scale set. :paramtype tags: dict[str, str] :keyword node_labels: The node labels to be persisted across all nodes in agent pool. :paramtype node_labels: dict[str, str] @@ -3205,21 +3127,60 @@ def __init__( for more details. :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance - profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_02_01.models.GPUInstanceProfile :keyword creation_data: CreationData to be used to specify the source Snapshot ID if the node pool will be created/upgraded using a snapshot. :paramtype creation_data: ~azure.mgmt.containerservice.v2022_02_01.models.CreationData - :keyword name: Required. Windows agent pool names must be 6 characters or less. + :keyword name: Windows agent pool names must be 6 characters or less. Required. :paramtype name: str """ - super(ManagedClusterAgentPoolProfile, self).__init__(count=count, vm_size=vm_size, os_disk_size_gb=os_disk_size_gb, os_disk_type=os_disk_type, kubelet_disk_type=kubelet_disk_type, workload_runtime=workload_runtime, vnet_subnet_id=vnet_subnet_id, pod_subnet_id=pod_subnet_id, max_pods=max_pods, os_type=os_type, os_sku=os_sku, max_count=max_count, min_count=min_count, enable_auto_scaling=enable_auto_scaling, scale_down_mode=scale_down_mode, type=type, mode=mode, orchestrator_version=orchestrator_version, upgrade_settings=upgrade_settings, power_state=power_state, availability_zones=availability_zones, enable_node_public_ip=enable_node_public_ip, node_public_ip_prefix_id=node_public_ip_prefix_id, scale_set_priority=scale_set_priority, scale_set_eviction_policy=scale_set_eviction_policy, spot_max_price=spot_max_price, tags=tags, node_labels=node_labels, node_taints=node_taints, proximity_placement_group_id=proximity_placement_group_id, kubelet_config=kubelet_config, linux_os_config=linux_os_config, enable_encryption_at_host=enable_encryption_at_host, enable_ultra_ssd=enable_ultra_ssd, enable_fips=enable_fips, gpu_instance_profile=gpu_instance_profile, creation_data=creation_data, **kwargs) + super().__init__( + count=count, + vm_size=vm_size, + os_disk_size_gb=os_disk_size_gb, + os_disk_type=os_disk_type, + kubelet_disk_type=kubelet_disk_type, + workload_runtime=workload_runtime, + vnet_subnet_id=vnet_subnet_id, + pod_subnet_id=pod_subnet_id, + max_pods=max_pods, + os_type=os_type, + os_sku=os_sku, + max_count=max_count, + min_count=min_count, + enable_auto_scaling=enable_auto_scaling, + scale_down_mode=scale_down_mode, + type=type, + mode=mode, + orchestrator_version=orchestrator_version, + upgrade_settings=upgrade_settings, + power_state=power_state, + availability_zones=availability_zones, + enable_node_public_ip=enable_node_public_ip, + node_public_ip_prefix_id=node_public_ip_prefix_id, + scale_set_priority=scale_set_priority, + scale_set_eviction_policy=scale_set_eviction_policy, + spot_max_price=spot_max_price, + tags=tags, + node_labels=node_labels, + node_taints=node_taints, + proximity_placement_group_id=proximity_placement_group_id, + kubelet_config=kubelet_config, + linux_os_config=linux_os_config, + enable_encryption_at_host=enable_encryption_at_host, + enable_ultra_ssd=enable_ultra_ssd, + enable_fips=enable_fips, + gpu_instance_profile=gpu_instance_profile, + creation_data=creation_data, + **kwargs + ) self.name = name -class ManagedClusterAPIServerAccessProfile(msrest.serialization.Model): +class ManagedClusterAPIServerAccessProfile(_serialization.Model): """Access profile for managed cluster API server. :ivar authorized_ip_ranges: IP ranges are specified in CIDR format, e.g. 137.117.106.88/29. @@ -3242,11 +3203,11 @@ class ManagedClusterAPIServerAccessProfile(msrest.serialization.Model): """ _attribute_map = { - 'authorized_ip_ranges': {'key': 'authorizedIPRanges', 'type': '[str]'}, - 'enable_private_cluster': {'key': 'enablePrivateCluster', 'type': 'bool'}, - 'private_dns_zone': {'key': 'privateDNSZone', 'type': 'str'}, - 'enable_private_cluster_public_fqdn': {'key': 'enablePrivateClusterPublicFQDN', 'type': 'bool'}, - 'disable_run_command': {'key': 'disableRunCommand', 'type': 'bool'}, + "authorized_ip_ranges": {"key": "authorizedIPRanges", "type": "[str]"}, + "enable_private_cluster": {"key": "enablePrivateCluster", "type": "bool"}, + "private_dns_zone": {"key": "privateDNSZone", "type": "str"}, + "enable_private_cluster_public_fqdn": {"key": "enablePrivateClusterPublicFQDN", "type": "bool"}, + "disable_run_command": {"key": "disableRunCommand", "type": "bool"}, } def __init__( @@ -3278,7 +3239,7 @@ def __init__( :keyword disable_run_command: Whether to disable run command for the cluster or not. :paramtype disable_run_command: bool """ - super(ManagedClusterAPIServerAccessProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.authorized_ip_ranges = authorized_ip_ranges self.enable_private_cluster = enable_private_cluster self.private_dns_zone = private_dns_zone @@ -3286,37 +3247,32 @@ def __init__( self.disable_run_command = disable_run_command -class ManagedClusterAutoUpgradeProfile(msrest.serialization.Model): +class ManagedClusterAutoUpgradeProfile(_serialization.Model): """Auto upgrade profile for a managed cluster. :ivar upgrade_channel: For more information see `setting the AKS cluster auto-upgrade channel `_. Known values - are: "rapid", "stable", "patch", "node-image", "none". + are: "rapid", "stable", "patch", "node-image", and "none". :vartype upgrade_channel: str or ~azure.mgmt.containerservice.v2022_02_01.models.UpgradeChannel """ _attribute_map = { - 'upgrade_channel': {'key': 'upgradeChannel', 'type': 'str'}, + "upgrade_channel": {"key": "upgradeChannel", "type": "str"}, } - def __init__( - self, - *, - upgrade_channel: Optional[Union[str, "_models.UpgradeChannel"]] = None, - **kwargs - ): + def __init__(self, *, upgrade_channel: Optional[Union[str, "_models.UpgradeChannel"]] = None, **kwargs): """ :keyword upgrade_channel: For more information see `setting the AKS cluster auto-upgrade channel `_. - Known values are: "rapid", "stable", "patch", "node-image", "none". + Known values are: "rapid", "stable", "patch", "node-image", and "none". :paramtype upgrade_channel: str or ~azure.mgmt.containerservice.v2022_02_01.models.UpgradeChannel """ - super(ManagedClusterAutoUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.upgrade_channel = upgrade_channel -class ManagedClusterHTTPProxyConfig(msrest.serialization.Model): +class ManagedClusterHTTPProxyConfig(_serialization.Model): """Cluster HTTP proxy configuration. :ivar http_proxy: The HTTP proxy server endpoint to use. @@ -3330,10 +3286,10 @@ class ManagedClusterHTTPProxyConfig(msrest.serialization.Model): """ _attribute_map = { - 'http_proxy': {'key': 'httpProxy', 'type': 'str'}, - 'https_proxy': {'key': 'httpsProxy', 'type': 'str'}, - 'no_proxy': {'key': 'noProxy', 'type': '[str]'}, - 'trusted_ca': {'key': 'trustedCa', 'type': 'str'}, + "http_proxy": {"key": "httpProxy", "type": "str"}, + "https_proxy": {"key": "httpsProxy", "type": "str"}, + "no_proxy": {"key": "noProxy", "type": "[str]"}, + "trusted_ca": {"key": "trustedCa", "type": "str"}, } def __init__( @@ -3355,14 +3311,14 @@ def __init__( :keyword trusted_ca: Alternative CA cert to use for connecting to proxy servers. :paramtype trusted_ca: str """ - super(ManagedClusterHTTPProxyConfig, self).__init__(**kwargs) + super().__init__(**kwargs) self.http_proxy = http_proxy self.https_proxy = https_proxy self.no_proxy = no_proxy self.trusted_ca = trusted_ca -class ManagedClusterIdentity(msrest.serialization.Model): +class ManagedClusterIdentity(_serialization.Model): """Identity for the managed cluster. Variables are only populated by the server, and will be ignored when sending a request. @@ -3375,7 +3331,7 @@ class ManagedClusterIdentity(msrest.serialization.Model): :vartype tenant_id: str :ivar type: For more information see `use managed identities in AKS `_. Known values are: - "SystemAssigned", "UserAssigned", "None". + "SystemAssigned", "UserAssigned", and "None". :vartype type: str or ~azure.mgmt.containerservice.v2022_02_01.models.ResourceIdentityType :ivar user_assigned_identities: The keys must be ARM resource IDs in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. @@ -3384,42 +3340,47 @@ class ManagedClusterIdentity(msrest.serialization.Model): """ _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, + "principal_id": {"readonly": True}, + "tenant_id": {"readonly": True}, } _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{ManagedServiceIdentityUserAssignedIdentitiesValue}'}, + "principal_id": {"key": "principalId", "type": "str"}, + "tenant_id": {"key": "tenantId", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "user_assigned_identities": { + "key": "userAssignedIdentities", + "type": "{ManagedServiceIdentityUserAssignedIdentitiesValue}", + }, } def __init__( self, *, type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, - user_assigned_identities: Optional[Dict[str, "_models.ManagedServiceIdentityUserAssignedIdentitiesValue"]] = None, + user_assigned_identities: Optional[ + Dict[str, "_models.ManagedServiceIdentityUserAssignedIdentitiesValue"] + ] = None, **kwargs ): """ :keyword type: For more information see `use managed identities in AKS `_. Known values are: - "SystemAssigned", "UserAssigned", "None". + "SystemAssigned", "UserAssigned", and "None". :paramtype type: str or ~azure.mgmt.containerservice.v2022_02_01.models.ResourceIdentityType :keyword user_assigned_identities: The keys must be ARM resource IDs in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. :paramtype user_assigned_identities: dict[str, ~azure.mgmt.containerservice.v2022_02_01.models.ManagedServiceIdentityUserAssignedIdentitiesValue] """ - super(ManagedClusterIdentity, self).__init__(**kwargs) + super().__init__(**kwargs) self.principal_id = None self.tenant_id = None self.type = type self.user_assigned_identities = user_assigned_identities -class ManagedClusterListResult(msrest.serialization.Model): +class ManagedClusterListResult(_serialization.Model): """The response from the List Managed Clusters operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -3431,30 +3392,25 @@ class ManagedClusterListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[ManagedCluster]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[ManagedCluster]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.ManagedCluster"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.ManagedCluster"]] = None, **kwargs): """ :keyword value: The list of managed clusters. :paramtype value: list[~azure.mgmt.containerservice.v2022_02_01.models.ManagedCluster] """ - super(ManagedClusterListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class ManagedClusterLoadBalancerProfile(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfile(_serialization.Model): """Profile of the managed cluster load balancer. :ivar managed_outbound_i_ps: Desired managed outbound IPs for the cluster load balancer. @@ -3483,18 +3439,24 @@ class ManagedClusterLoadBalancerProfile(msrest.serialization.Model): """ _validation = { - 'allocated_outbound_ports': {'maximum': 64000, 'minimum': 0}, - 'idle_timeout_in_minutes': {'maximum': 120, 'minimum': 4}, + "allocated_outbound_ports": {"maximum": 64000, "minimum": 0}, + "idle_timeout_in_minutes": {"maximum": 120, "minimum": 4}, } _attribute_map = { - 'managed_outbound_i_ps': {'key': 'managedOutboundIPs', 'type': 'ManagedClusterLoadBalancerProfileManagedOutboundIPs'}, - 'outbound_ip_prefixes': {'key': 'outboundIPPrefixes', 'type': 'ManagedClusterLoadBalancerProfileOutboundIPPrefixes'}, - 'outbound_i_ps': {'key': 'outboundIPs', 'type': 'ManagedClusterLoadBalancerProfileOutboundIPs'}, - 'effective_outbound_i_ps': {'key': 'effectiveOutboundIPs', 'type': '[ResourceReference]'}, - 'allocated_outbound_ports': {'key': 'allocatedOutboundPorts', 'type': 'int'}, - 'idle_timeout_in_minutes': {'key': 'idleTimeoutInMinutes', 'type': 'int'}, - 'enable_multiple_standard_load_balancers': {'key': 'enableMultipleStandardLoadBalancers', 'type': 'bool'}, + "managed_outbound_i_ps": { + "key": "managedOutboundIPs", + "type": "ManagedClusterLoadBalancerProfileManagedOutboundIPs", + }, + "outbound_ip_prefixes": { + "key": "outboundIPPrefixes", + "type": "ManagedClusterLoadBalancerProfileOutboundIPPrefixes", + }, + "outbound_i_ps": {"key": "outboundIPs", "type": "ManagedClusterLoadBalancerProfileOutboundIPs"}, + "effective_outbound_i_ps": {"key": "effectiveOutboundIPs", "type": "[ResourceReference]"}, + "allocated_outbound_ports": {"key": "allocatedOutboundPorts", "type": "int"}, + "idle_timeout_in_minutes": {"key": "idleTimeoutInMinutes", "type": "int"}, + "enable_multiple_standard_load_balancers": {"key": "enableMultipleStandardLoadBalancers", "type": "bool"}, } def __init__( @@ -3504,8 +3466,8 @@ def __init__( outbound_ip_prefixes: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPPrefixes"] = None, outbound_i_ps: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPs"] = None, effective_outbound_i_ps: Optional[List["_models.ResourceReference"]] = None, - allocated_outbound_ports: Optional[int] = 0, - idle_timeout_in_minutes: Optional[int] = 30, + allocated_outbound_ports: int = 0, + idle_timeout_in_minutes: int = 30, enable_multiple_standard_load_balancers: Optional[bool] = None, **kwargs ): @@ -3535,7 +3497,7 @@ def __init__( AKS cluster or not. :paramtype enable_multiple_standard_load_balancers: bool """ - super(ManagedClusterLoadBalancerProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.managed_outbound_i_ps = managed_outbound_i_ps self.outbound_ip_prefixes = outbound_ip_prefixes self.outbound_i_ps = outbound_i_ps @@ -3545,7 +3507,7 @@ def __init__( self.enable_multiple_standard_load_balancers = enable_multiple_standard_load_balancers -class ManagedClusterLoadBalancerProfileManagedOutboundIPs(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfileManagedOutboundIPs(_serialization.Model): """Desired managed outbound IPs for the cluster load balancer. :ivar count: The desired number of IPv4 outbound IPs created/managed by Azure for the cluster @@ -3559,22 +3521,16 @@ class ManagedClusterLoadBalancerProfileManagedOutboundIPs(msrest.serialization.M """ _validation = { - 'count': {'maximum': 100, 'minimum': 1}, - 'count_ipv6': {'maximum': 100, 'minimum': 0}, + "count": {"maximum": 100, "minimum": 1}, + "count_ipv6": {"maximum": 100, "minimum": 0}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'count_ipv6': {'key': 'countIPv6', 'type': 'int'}, + "count": {"key": "count", "type": "int"}, + "count_ipv6": {"key": "countIPv6", "type": "int"}, } - def __init__( - self, - *, - count: Optional[int] = 1, - count_ipv6: Optional[int] = 0, - **kwargs - ): + def __init__(self, *, count: int = 1, count_ipv6: int = 0, **kwargs): """ :keyword count: The desired number of IPv4 outbound IPs created/managed by Azure for the cluster load balancer. Allowed values must be in the range of 1 to 100 (inclusive). The default @@ -3585,12 +3541,12 @@ def __init__( value is 0 for single-stack and 1 for dual-stack. :paramtype count_ipv6: int """ - super(ManagedClusterLoadBalancerProfileManagedOutboundIPs, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.count_ipv6 = count_ipv6 -class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(_serialization.Model): """Desired outbound IP Prefix resources for the cluster load balancer. :ivar public_ip_prefixes: A list of public IP prefix resources. @@ -3599,25 +3555,20 @@ class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(msrest.serialization.M """ _attribute_map = { - 'public_ip_prefixes': {'key': 'publicIPPrefixes', 'type': '[ResourceReference]'}, + "public_ip_prefixes": {"key": "publicIPPrefixes", "type": "[ResourceReference]"}, } - def __init__( - self, - *, - public_ip_prefixes: Optional[List["_models.ResourceReference"]] = None, - **kwargs - ): + def __init__(self, *, public_ip_prefixes: Optional[List["_models.ResourceReference"]] = None, **kwargs): """ :keyword public_ip_prefixes: A list of public IP prefix resources. :paramtype public_ip_prefixes: list[~azure.mgmt.containerservice.v2022_02_01.models.ResourceReference] """ - super(ManagedClusterLoadBalancerProfileOutboundIPPrefixes, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_ip_prefixes = public_ip_prefixes -class ManagedClusterLoadBalancerProfileOutboundIPs(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfileOutboundIPs(_serialization.Model): """Desired outbound IP resources for the cluster load balancer. :ivar public_i_ps: A list of public IP resources. @@ -3625,24 +3576,19 @@ class ManagedClusterLoadBalancerProfileOutboundIPs(msrest.serialization.Model): """ _attribute_map = { - 'public_i_ps': {'key': 'publicIPs', 'type': '[ResourceReference]'}, + "public_i_ps": {"key": "publicIPs", "type": "[ResourceReference]"}, } - def __init__( - self, - *, - public_i_ps: Optional[List["_models.ResourceReference"]] = None, - **kwargs - ): + def __init__(self, *, public_i_ps: Optional[List["_models.ResourceReference"]] = None, **kwargs): """ :keyword public_i_ps: A list of public IP resources. :paramtype public_i_ps: list[~azure.mgmt.containerservice.v2022_02_01.models.ResourceReference] """ - super(ManagedClusterLoadBalancerProfileOutboundIPs, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_i_ps = public_i_ps -class ManagedClusterManagedOutboundIPProfile(msrest.serialization.Model): +class ManagedClusterManagedOutboundIPProfile(_serialization.Model): """Profile of the managed outbound IP resources of the managed cluster. :ivar count: The desired number of outbound IPs created/managed by Azure. Allowed values must @@ -3651,29 +3597,24 @@ class ManagedClusterManagedOutboundIPProfile(msrest.serialization.Model): """ _validation = { - 'count': {'maximum': 16, 'minimum': 1}, + "count": {"maximum": 16, "minimum": 1}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, + "count": {"key": "count", "type": "int"}, } - def __init__( - self, - *, - count: Optional[int] = 1, - **kwargs - ): + def __init__(self, *, count: int = 1, **kwargs): """ :keyword count: The desired number of outbound IPs created/managed by Azure. Allowed values must be in the range of 1 to 16 (inclusive). The default value is 1. :paramtype count: int """ - super(ManagedClusterManagedOutboundIPProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count -class ManagedClusterNATGatewayProfile(msrest.serialization.Model): +class ManagedClusterNATGatewayProfile(_serialization.Model): """Profile of the managed cluster NAT gateway. :ivar managed_outbound_ip_profile: Profile of the managed outbound IP resources of the cluster @@ -3689,13 +3630,16 @@ class ManagedClusterNATGatewayProfile(msrest.serialization.Model): """ _validation = { - 'idle_timeout_in_minutes': {'maximum': 120, 'minimum': 4}, + "idle_timeout_in_minutes": {"maximum": 120, "minimum": 4}, } _attribute_map = { - 'managed_outbound_ip_profile': {'key': 'managedOutboundIPProfile', 'type': 'ManagedClusterManagedOutboundIPProfile'}, - 'effective_outbound_i_ps': {'key': 'effectiveOutboundIPs', 'type': '[ResourceReference]'}, - 'idle_timeout_in_minutes': {'key': 'idleTimeoutInMinutes', 'type': 'int'}, + "managed_outbound_ip_profile": { + "key": "managedOutboundIPProfile", + "type": "ManagedClusterManagedOutboundIPProfile", + }, + "effective_outbound_i_ps": {"key": "effectiveOutboundIPs", "type": "[ResourceReference]"}, + "idle_timeout_in_minutes": {"key": "idleTimeoutInMinutes", "type": "int"}, } def __init__( @@ -3703,7 +3647,7 @@ def __init__( *, managed_outbound_ip_profile: Optional["_models.ManagedClusterManagedOutboundIPProfile"] = None, effective_outbound_i_ps: Optional[List["_models.ResourceReference"]] = None, - idle_timeout_in_minutes: Optional[int] = 4, + idle_timeout_in_minutes: int = 4, **kwargs ): """ @@ -3719,29 +3663,29 @@ def __init__( are in the range of 4 to 120 (inclusive). The default value is 4 minutes. :paramtype idle_timeout_in_minutes: int """ - super(ManagedClusterNATGatewayProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.managed_outbound_ip_profile = managed_outbound_ip_profile self.effective_outbound_i_ps = effective_outbound_i_ps self.idle_timeout_in_minutes = idle_timeout_in_minutes -class ManagedClusterPodIdentity(msrest.serialization.Model): +class ManagedClusterPodIdentity(_serialization.Model): """Details about the pod identity assigned to the Managed Cluster. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar name: Required. The name of the pod identity. + :ivar name: The name of the pod identity. Required. :vartype name: str - :ivar namespace: Required. The namespace of the pod identity. + :ivar namespace: The namespace of the pod identity. Required. :vartype namespace: str :ivar binding_selector: The binding selector to use for the AzureIdentityBinding resource. :vartype binding_selector: str - :ivar identity: Required. The user assigned identity details. + :ivar identity: The user assigned identity details. Required. :vartype identity: ~azure.mgmt.containerservice.v2022_02_01.models.UserAssignedIdentity :ivar provisioning_state: The current provisioning state of the pod identity. Known values are: - "Assigned", "Updating", "Deleting", "Failed". + "Assigned", "Updating", "Deleting", and "Failed". :vartype provisioning_state: str or ~azure.mgmt.containerservice.v2022_02_01.models.ManagedClusterPodIdentityProvisioningState :ivar provisioning_info: @@ -3750,20 +3694,20 @@ class ManagedClusterPodIdentity(msrest.serialization.Model): """ _validation = { - 'name': {'required': True}, - 'namespace': {'required': True}, - 'identity': {'required': True}, - 'provisioning_state': {'readonly': True}, - 'provisioning_info': {'readonly': True}, + "name": {"required": True}, + "namespace": {"required": True}, + "identity": {"required": True}, + "provisioning_state": {"readonly": True}, + "provisioning_info": {"readonly": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'namespace': {'key': 'namespace', 'type': 'str'}, - 'binding_selector': {'key': 'bindingSelector', 'type': 'str'}, - 'identity': {'key': 'identity', 'type': 'UserAssignedIdentity'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'provisioning_info': {'key': 'provisioningInfo', 'type': 'ManagedClusterPodIdentityProvisioningInfo'}, + "name": {"key": "name", "type": "str"}, + "namespace": {"key": "namespace", "type": "str"}, + "binding_selector": {"key": "bindingSelector", "type": "str"}, + "identity": {"key": "identity", "type": "UserAssignedIdentity"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "provisioning_info": {"key": "provisioningInfo", "type": "ManagedClusterPodIdentityProvisioningInfo"}, } def __init__( @@ -3776,16 +3720,16 @@ def __init__( **kwargs ): """ - :keyword name: Required. The name of the pod identity. + :keyword name: The name of the pod identity. Required. :paramtype name: str - :keyword namespace: Required. The namespace of the pod identity. + :keyword namespace: The namespace of the pod identity. Required. :paramtype namespace: str :keyword binding_selector: The binding selector to use for the AzureIdentityBinding resource. :paramtype binding_selector: str - :keyword identity: Required. The user assigned identity details. + :keyword identity: The user assigned identity details. Required. :paramtype identity: ~azure.mgmt.containerservice.v2022_02_01.models.UserAssignedIdentity """ - super(ManagedClusterPodIdentity, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.namespace = namespace self.binding_selector = binding_selector @@ -3794,54 +3738,47 @@ def __init__( self.provisioning_info = None -class ManagedClusterPodIdentityException(msrest.serialization.Model): +class ManagedClusterPodIdentityException(_serialization.Model): """See `disable AAD Pod Identity for a specific Pod/Application `_ for more details. All required parameters must be populated in order to send to Azure. - :ivar name: Required. The name of the pod identity exception. + :ivar name: The name of the pod identity exception. Required. :vartype name: str - :ivar namespace: Required. The namespace of the pod identity exception. + :ivar namespace: The namespace of the pod identity exception. Required. :vartype namespace: str - :ivar pod_labels: Required. The pod labels to match. + :ivar pod_labels: The pod labels to match. Required. :vartype pod_labels: dict[str, str] """ _validation = { - 'name': {'required': True}, - 'namespace': {'required': True}, - 'pod_labels': {'required': True}, + "name": {"required": True}, + "namespace": {"required": True}, + "pod_labels": {"required": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'namespace': {'key': 'namespace', 'type': 'str'}, - 'pod_labels': {'key': 'podLabels', 'type': '{str}'}, + "name": {"key": "name", "type": "str"}, + "namespace": {"key": "namespace", "type": "str"}, + "pod_labels": {"key": "podLabels", "type": "{str}"}, } - def __init__( - self, - *, - name: str, - namespace: str, - pod_labels: Dict[str, str], - **kwargs - ): + def __init__(self, *, name: str, namespace: str, pod_labels: Dict[str, str], **kwargs): """ - :keyword name: Required. The name of the pod identity exception. + :keyword name: The name of the pod identity exception. Required. :paramtype name: str - :keyword namespace: Required. The namespace of the pod identity exception. + :keyword namespace: The namespace of the pod identity exception. Required. :paramtype namespace: str - :keyword pod_labels: Required. The pod labels to match. + :keyword pod_labels: The pod labels to match. Required. :paramtype pod_labels: dict[str, str] """ - super(ManagedClusterPodIdentityException, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.namespace = namespace self.pod_labels = pod_labels -class ManagedClusterPodIdentityProfile(msrest.serialization.Model): +class ManagedClusterPodIdentityProfile(_serialization.Model): """See `use AAD pod identity `_ for more details on pod identity integration. :ivar enabled: Whether the pod identity addon is enabled. @@ -3861,10 +3798,13 @@ class ManagedClusterPodIdentityProfile(msrest.serialization.Model): """ _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'allow_network_plugin_kubenet': {'key': 'allowNetworkPluginKubenet', 'type': 'bool'}, - 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '[ManagedClusterPodIdentity]'}, - 'user_assigned_identity_exceptions': {'key': 'userAssignedIdentityExceptions', 'type': '[ManagedClusterPodIdentityException]'}, + "enabled": {"key": "enabled", "type": "bool"}, + "allow_network_plugin_kubenet": {"key": "allowNetworkPluginKubenet", "type": "bool"}, + "user_assigned_identities": {"key": "userAssignedIdentities", "type": "[ManagedClusterPodIdentity]"}, + "user_assigned_identity_exceptions": { + "key": "userAssignedIdentityExceptions", + "type": "[ManagedClusterPodIdentityException]", + }, } def __init__( @@ -3892,14 +3832,14 @@ def __init__( :paramtype user_assigned_identity_exceptions: list[~azure.mgmt.containerservice.v2022_02_01.models.ManagedClusterPodIdentityException] """ - super(ManagedClusterPodIdentityProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.allow_network_plugin_kubenet = allow_network_plugin_kubenet self.user_assigned_identities = user_assigned_identities self.user_assigned_identity_exceptions = user_assigned_identity_exceptions -class ManagedClusterPodIdentityProvisioningError(msrest.serialization.Model): +class ManagedClusterPodIdentityProvisioningError(_serialization.Model): """An error response from the pod identity provisioning. :ivar error: Details about the error. @@ -3908,25 +3848,20 @@ class ManagedClusterPodIdentityProvisioningError(msrest.serialization.Model): """ _attribute_map = { - 'error': {'key': 'error', 'type': 'ManagedClusterPodIdentityProvisioningErrorBody'}, + "error": {"key": "error", "type": "ManagedClusterPodIdentityProvisioningErrorBody"}, } - def __init__( - self, - *, - error: Optional["_models.ManagedClusterPodIdentityProvisioningErrorBody"] = None, - **kwargs - ): + def __init__(self, *, error: Optional["_models.ManagedClusterPodIdentityProvisioningErrorBody"] = None, **kwargs): """ :keyword error: Details about the error. :paramtype error: ~azure.mgmt.containerservice.v2022_02_01.models.ManagedClusterPodIdentityProvisioningErrorBody """ - super(ManagedClusterPodIdentityProvisioningError, self).__init__(**kwargs) + super().__init__(**kwargs) self.error = error -class ManagedClusterPodIdentityProvisioningErrorBody(msrest.serialization.Model): +class ManagedClusterPodIdentityProvisioningErrorBody(_serialization.Model): """An error response from the pod identity provisioning. :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed @@ -3944,10 +3879,10 @@ class ManagedClusterPodIdentityProvisioningErrorBody(msrest.serialization.Model) """ _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[ManagedClusterPodIdentityProvisioningErrorBody]'}, + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[ManagedClusterPodIdentityProvisioningErrorBody]"}, } def __init__( @@ -3973,14 +3908,14 @@ def __init__( :paramtype details: list[~azure.mgmt.containerservice.v2022_02_01.models.ManagedClusterPodIdentityProvisioningErrorBody] """ - super(ManagedClusterPodIdentityProvisioningErrorBody, self).__init__(**kwargs) + super().__init__(**kwargs) self.code = code self.message = message self.target = target self.details = details -class ManagedClusterPodIdentityProvisioningInfo(msrest.serialization.Model): +class ManagedClusterPodIdentityProvisioningInfo(_serialization.Model): """ManagedClusterPodIdentityProvisioningInfo. :ivar error: Pod identity assignment error (if any). @@ -3989,35 +3924,30 @@ class ManagedClusterPodIdentityProvisioningInfo(msrest.serialization.Model): """ _attribute_map = { - 'error': {'key': 'error', 'type': 'ManagedClusterPodIdentityProvisioningError'}, + "error": {"key": "error", "type": "ManagedClusterPodIdentityProvisioningError"}, } - def __init__( - self, - *, - error: Optional["_models.ManagedClusterPodIdentityProvisioningError"] = None, - **kwargs - ): + def __init__(self, *, error: Optional["_models.ManagedClusterPodIdentityProvisioningError"] = None, **kwargs): """ :keyword error: Pod identity assignment error (if any). :paramtype error: ~azure.mgmt.containerservice.v2022_02_01.models.ManagedClusterPodIdentityProvisioningError """ - super(ManagedClusterPodIdentityProvisioningInfo, self).__init__(**kwargs) + super().__init__(**kwargs) self.error = error -class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): +class ManagedClusterPoolUpgradeProfile(_serialization.Model): """The list of available upgrade versions. All required parameters must be populated in order to send to Azure. - :ivar kubernetes_version: Required. The Kubernetes version (major.minor.patch). + :ivar kubernetes_version: The Kubernetes version (major.minor.patch). Required. :vartype kubernetes_version: str :ivar name: The Agent Pool name. :vartype name: str - :ivar os_type: Required. The operating system type. The default is Linux. Known values are: - "Linux", "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_02_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -4025,15 +3955,15 @@ class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): """ _validation = { - 'kubernetes_version': {'required': True}, - 'os_type': {'required': True}, + "kubernetes_version": {"required": True}, + "os_type": {"required": True}, } _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'upgrades': {'key': 'upgrades', 'type': '[ManagedClusterPoolUpgradeProfileUpgradesItem]'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "os_type": {"key": "osType", "type": "str"}, + "upgrades": {"key": "upgrades", "type": "[ManagedClusterPoolUpgradeProfileUpgradesItem]"}, } def __init__( @@ -4046,25 +3976,25 @@ def __init__( **kwargs ): """ - :keyword kubernetes_version: Required. The Kubernetes version (major.minor.patch). + :keyword kubernetes_version: The Kubernetes version (major.minor.patch). Required. :paramtype kubernetes_version: str :keyword name: The Agent Pool name. :paramtype name: str - :keyword os_type: Required. The operating system type. The default is Linux. Known values are: - "Linux", "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_02_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: list[~azure.mgmt.containerservice.v2022_02_01.models.ManagedClusterPoolUpgradeProfileUpgradesItem] """ - super(ManagedClusterPoolUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.name = name self.os_type = os_type self.upgrades = upgrades -class ManagedClusterPoolUpgradeProfileUpgradesItem(msrest.serialization.Model): +class ManagedClusterPoolUpgradeProfileUpgradesItem(_serialization.Model): """ManagedClusterPoolUpgradeProfileUpgradesItem. :ivar kubernetes_version: The Kubernetes version (major.minor.patch). @@ -4074,36 +4004,30 @@ class ManagedClusterPoolUpgradeProfileUpgradesItem(msrest.serialization.Model): """ _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } - def __init__( - self, - *, - kubernetes_version: Optional[str] = None, - is_preview: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, kubernetes_version: Optional[str] = None, is_preview: Optional[bool] = None, **kwargs): """ :keyword kubernetes_version: The Kubernetes version (major.minor.patch). :paramtype kubernetes_version: str :keyword is_preview: Whether the Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(ManagedClusterPoolUpgradeProfileUpgradesItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.is_preview = is_preview -class ManagedClusterPropertiesAutoScalerProfile(msrest.serialization.Model): +class ManagedClusterPropertiesAutoScalerProfile(_serialization.Model): # pylint: disable=too-many-instance-attributes """Parameters to be applied to the cluster-autoscaler when enabled. :ivar balance_similar_node_groups: Valid values are 'true' and 'false'. :vartype balance_similar_node_groups: str :ivar expander: If not specified, the default is 'random'. See `expanders `_ - for more information. Known values are: "least-waste", "most-pods", "priority", "random". + for more information. Known values are: "least-waste", "most-pods", "priority", and "random". :vartype expander: str or ~azure.mgmt.containerservice.v2022_02_01.models.Expander :ivar max_empty_bulk_delete: The default is 10. :vartype max_empty_bulk_delete: str @@ -4147,23 +4071,23 @@ class ManagedClusterPropertiesAutoScalerProfile(msrest.serialization.Model): """ _attribute_map = { - 'balance_similar_node_groups': {'key': 'balance-similar-node-groups', 'type': 'str'}, - 'expander': {'key': 'expander', 'type': 'str'}, - 'max_empty_bulk_delete': {'key': 'max-empty-bulk-delete', 'type': 'str'}, - 'max_graceful_termination_sec': {'key': 'max-graceful-termination-sec', 'type': 'str'}, - 'max_node_provision_time': {'key': 'max-node-provision-time', 'type': 'str'}, - 'max_total_unready_percentage': {'key': 'max-total-unready-percentage', 'type': 'str'}, - 'new_pod_scale_up_delay': {'key': 'new-pod-scale-up-delay', 'type': 'str'}, - 'ok_total_unready_count': {'key': 'ok-total-unready-count', 'type': 'str'}, - 'scan_interval': {'key': 'scan-interval', 'type': 'str'}, - 'scale_down_delay_after_add': {'key': 'scale-down-delay-after-add', 'type': 'str'}, - 'scale_down_delay_after_delete': {'key': 'scale-down-delay-after-delete', 'type': 'str'}, - 'scale_down_delay_after_failure': {'key': 'scale-down-delay-after-failure', 'type': 'str'}, - 'scale_down_unneeded_time': {'key': 'scale-down-unneeded-time', 'type': 'str'}, - 'scale_down_unready_time': {'key': 'scale-down-unready-time', 'type': 'str'}, - 'scale_down_utilization_threshold': {'key': 'scale-down-utilization-threshold', 'type': 'str'}, - 'skip_nodes_with_local_storage': {'key': 'skip-nodes-with-local-storage', 'type': 'str'}, - 'skip_nodes_with_system_pods': {'key': 'skip-nodes-with-system-pods', 'type': 'str'}, + "balance_similar_node_groups": {"key": "balance-similar-node-groups", "type": "str"}, + "expander": {"key": "expander", "type": "str"}, + "max_empty_bulk_delete": {"key": "max-empty-bulk-delete", "type": "str"}, + "max_graceful_termination_sec": {"key": "max-graceful-termination-sec", "type": "str"}, + "max_node_provision_time": {"key": "max-node-provision-time", "type": "str"}, + "max_total_unready_percentage": {"key": "max-total-unready-percentage", "type": "str"}, + "new_pod_scale_up_delay": {"key": "new-pod-scale-up-delay", "type": "str"}, + "ok_total_unready_count": {"key": "ok-total-unready-count", "type": "str"}, + "scan_interval": {"key": "scan-interval", "type": "str"}, + "scale_down_delay_after_add": {"key": "scale-down-delay-after-add", "type": "str"}, + "scale_down_delay_after_delete": {"key": "scale-down-delay-after-delete", "type": "str"}, + "scale_down_delay_after_failure": {"key": "scale-down-delay-after-failure", "type": "str"}, + "scale_down_unneeded_time": {"key": "scale-down-unneeded-time", "type": "str"}, + "scale_down_unready_time": {"key": "scale-down-unready-time", "type": "str"}, + "scale_down_utilization_threshold": {"key": "scale-down-utilization-threshold", "type": "str"}, + "skip_nodes_with_local_storage": {"key": "skip-nodes-with-local-storage", "type": "str"}, + "skip_nodes_with_system_pods": {"key": "skip-nodes-with-system-pods", "type": "str"}, } def __init__( @@ -4193,7 +4117,7 @@ def __init__( :paramtype balance_similar_node_groups: str :keyword expander: If not specified, the default is 'random'. See `expanders `_ - for more information. Known values are: "least-waste", "most-pods", "priority", "random". + for more information. Known values are: "least-waste", "most-pods", "priority", and "random". :paramtype expander: str or ~azure.mgmt.containerservice.v2022_02_01.models.Expander :keyword max_empty_bulk_delete: The default is 10. :paramtype max_empty_bulk_delete: str @@ -4236,7 +4160,7 @@ def __init__( :keyword skip_nodes_with_system_pods: The default is true. :paramtype skip_nodes_with_system_pods: str """ - super(ManagedClusterPropertiesAutoScalerProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.balance_similar_node_groups = balance_similar_node_groups self.expander = expander self.max_empty_bulk_delete = max_empty_bulk_delete @@ -4256,7 +4180,7 @@ def __init__( self.skip_nodes_with_system_pods = skip_nodes_with_system_pods -class ManagedClusterSecurityProfile(msrest.serialization.Model): +class ManagedClusterSecurityProfile(_serialization.Model): """Security profile for the container service cluster. :ivar azure_defender: Azure Defender settings for the security profile. @@ -4265,25 +4189,22 @@ class ManagedClusterSecurityProfile(msrest.serialization.Model): """ _attribute_map = { - 'azure_defender': {'key': 'azureDefender', 'type': 'ManagedClusterSecurityProfileAzureDefender'}, + "azure_defender": {"key": "azureDefender", "type": "ManagedClusterSecurityProfileAzureDefender"}, } def __init__( - self, - *, - azure_defender: Optional["_models.ManagedClusterSecurityProfileAzureDefender"] = None, - **kwargs + self, *, azure_defender: Optional["_models.ManagedClusterSecurityProfileAzureDefender"] = None, **kwargs ): """ :keyword azure_defender: Azure Defender settings for the security profile. :paramtype azure_defender: ~azure.mgmt.containerservice.v2022_02_01.models.ManagedClusterSecurityProfileAzureDefender """ - super(ManagedClusterSecurityProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.azure_defender = azure_defender -class ManagedClusterSecurityProfileAzureDefender(msrest.serialization.Model): +class ManagedClusterSecurityProfileAzureDefender(_serialization.Model): """Azure Defender settings for the security profile. :ivar enabled: Whether to enable Azure Defender. @@ -4295,16 +4216,12 @@ class ManagedClusterSecurityProfileAzureDefender(msrest.serialization.Model): """ _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'log_analytics_workspace_resource_id': {'key': 'logAnalyticsWorkspaceResourceId', 'type': 'str'}, + "enabled": {"key": "enabled", "type": "bool"}, + "log_analytics_workspace_resource_id": {"key": "logAnalyticsWorkspaceResourceId", "type": "str"}, } def __init__( - self, - *, - enabled: Optional[bool] = None, - log_analytics_workspace_resource_id: Optional[str] = None, - **kwargs + self, *, enabled: Optional[bool] = None, log_analytics_workspace_resource_id: Optional[str] = None, **kwargs ): """ :keyword enabled: Whether to enable Azure Defender. @@ -4314,63 +4231,57 @@ def __init__( must be a valid workspace resource ID. When Azure Defender is disabled, leave the field empty. :paramtype log_analytics_workspace_resource_id: str """ - super(ManagedClusterSecurityProfileAzureDefender, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.log_analytics_workspace_resource_id = log_analytics_workspace_resource_id -class ManagedClusterServicePrincipalProfile(msrest.serialization.Model): +class ManagedClusterServicePrincipalProfile(_serialization.Model): """Information about a service principal identity for the cluster to use for manipulating Azure APIs. All required parameters must be populated in order to send to Azure. - :ivar client_id: Required. The ID for the service principal. + :ivar client_id: The ID for the service principal. Required. :vartype client_id: str :ivar secret: The secret password associated with the service principal in plain text. :vartype secret: str """ _validation = { - 'client_id': {'required': True}, + "client_id": {"required": True}, } _attribute_map = { - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'secret': {'key': 'secret', 'type': 'str'}, + "client_id": {"key": "clientId", "type": "str"}, + "secret": {"key": "secret", "type": "str"}, } - def __init__( - self, - *, - client_id: str, - secret: Optional[str] = None, - **kwargs - ): + def __init__(self, *, client_id: str, secret: Optional[str] = None, **kwargs): """ - :keyword client_id: Required. The ID for the service principal. + :keyword client_id: The ID for the service principal. Required. :paramtype client_id: str :keyword secret: The secret password associated with the service principal in plain text. :paramtype secret: str """ - super(ManagedClusterServicePrincipalProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.client_id = client_id self.secret = secret -class ManagedClusterSKU(msrest.serialization.Model): +class ManagedClusterSKU(_serialization.Model): """The SKU of a Managed Cluster. - :ivar name: The name of a managed cluster SKU. Known values are: "Basic". + :ivar name: The name of a managed cluster SKU. "Basic" :vartype name: str or ~azure.mgmt.containerservice.v2022_02_01.models.ManagedClusterSKUName :ivar tier: If not specified, the default is 'Free'. See `uptime SLA - `_ for more details. Known values are: "Paid", - "Free". + `_ for more details. Known values are: "Paid" + and "Free". :vartype tier: str or ~azure.mgmt.containerservice.v2022_02_01.models.ManagedClusterSKUTier """ _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, + "name": {"key": "name", "type": "str"}, + "tier": {"key": "tier", "type": "str"}, } def __init__( @@ -4381,19 +4292,19 @@ def __init__( **kwargs ): """ - :keyword name: The name of a managed cluster SKU. Known values are: "Basic". + :keyword name: The name of a managed cluster SKU. "Basic" :paramtype name: str or ~azure.mgmt.containerservice.v2022_02_01.models.ManagedClusterSKUName :keyword tier: If not specified, the default is 'Free'. See `uptime SLA - `_ for more details. Known values are: "Paid", - "Free". + `_ for more details. Known values are: "Paid" + and "Free". :paramtype tier: str or ~azure.mgmt.containerservice.v2022_02_01.models.ManagedClusterSKUTier """ - super(ManagedClusterSKU, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.tier = tier -class ManagedClusterUpgradeProfile(msrest.serialization.Model): +class ManagedClusterUpgradeProfile(_serialization.Model): """The list of available upgrades for compute pools. Variables are only populated by the server, and will be ignored when sending a request. @@ -4406,29 +4317,29 @@ class ManagedClusterUpgradeProfile(msrest.serialization.Model): :vartype name: str :ivar type: The type of the upgrade profile. :vartype type: str - :ivar control_plane_profile: Required. The list of available upgrade versions for the control - plane. + :ivar control_plane_profile: The list of available upgrade versions for the control plane. + Required. :vartype control_plane_profile: ~azure.mgmt.containerservice.v2022_02_01.models.ManagedClusterPoolUpgradeProfile - :ivar agent_pool_profiles: Required. The list of available upgrade versions for agent pools. + :ivar agent_pool_profiles: The list of available upgrade versions for agent pools. Required. :vartype agent_pool_profiles: list[~azure.mgmt.containerservice.v2022_02_01.models.ManagedClusterPoolUpgradeProfile] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'control_plane_profile': {'required': True}, - 'agent_pool_profiles': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "control_plane_profile": {"required": True}, + "agent_pool_profiles": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'control_plane_profile': {'key': 'properties.controlPlaneProfile', 'type': 'ManagedClusterPoolUpgradeProfile'}, - 'agent_pool_profiles': {'key': 'properties.agentPoolProfiles', 'type': '[ManagedClusterPoolUpgradeProfile]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "control_plane_profile": {"key": "properties.controlPlaneProfile", "type": "ManagedClusterPoolUpgradeProfile"}, + "agent_pool_profiles": {"key": "properties.agentPoolProfiles", "type": "[ManagedClusterPoolUpgradeProfile]"}, } def __init__( @@ -4439,15 +4350,15 @@ def __init__( **kwargs ): """ - :keyword control_plane_profile: Required. The list of available upgrade versions for the - control plane. + :keyword control_plane_profile: The list of available upgrade versions for the control plane. + Required. :paramtype control_plane_profile: ~azure.mgmt.containerservice.v2022_02_01.models.ManagedClusterPoolUpgradeProfile - :keyword agent_pool_profiles: Required. The list of available upgrade versions for agent pools. + :keyword agent_pool_profiles: The list of available upgrade versions for agent pools. Required. :paramtype agent_pool_profiles: list[~azure.mgmt.containerservice.v2022_02_01.models.ManagedClusterPoolUpgradeProfile] """ - super(ManagedClusterUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -4455,18 +4366,18 @@ def __init__( self.agent_pool_profiles = agent_pool_profiles -class ManagedClusterWindowsProfile(msrest.serialization.Model): +class ManagedClusterWindowsProfile(_serialization.Model): """Profile for Windows VMs in the managed cluster. All required parameters must be populated in order to send to Azure. - :ivar admin_username: Required. Specifies the name of the administrator account. - :code:`
`:code:`
` **Restriction:** Cannot end in "." :code:`
`:code:`
` - **Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", "test1", - "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", - "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", - "sys", "test2", "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 - character :code:`
`:code:`
` **Max-length:** 20 characters. + :ivar admin_username: Specifies the name of the administrator account. :code:`
`:code:`
` + **Restriction:** Cannot end in "." :code:`
`:code:`
` **Disallowed values:** + "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", + "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", + "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", + "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 character + :code:`
`:code:`
` **Max-length:** 20 characters. Required. :vartype admin_username: str :ivar admin_password: Specifies the password of the administrator account. :code:`
`:code:`
` **Minimum-length:** 8 characters :code:`
`:code:`
` @@ -4478,7 +4389,7 @@ class ManagedClusterWindowsProfile(msrest.serialization.Model): :vartype admin_password: str :ivar license_type: The license type to use for Windows VMs. See `Azure Hybrid User Benefits `_ for more details. Known values are: - "None", "Windows_Server". + "None" and "Windows_Server". :vartype license_type: str or ~azure.mgmt.containerservice.v2022_02_01.models.LicenseType :ivar enable_csi_proxy: For more details on CSI proxy, see the `CSI proxy GitHub repo `_. @@ -4488,15 +4399,15 @@ class ManagedClusterWindowsProfile(msrest.serialization.Model): """ _validation = { - 'admin_username': {'required': True}, + "admin_username": {"required": True}, } _attribute_map = { - 'admin_username': {'key': 'adminUsername', 'type': 'str'}, - 'admin_password': {'key': 'adminPassword', 'type': 'str'}, - 'license_type': {'key': 'licenseType', 'type': 'str'}, - 'enable_csi_proxy': {'key': 'enableCSIProxy', 'type': 'bool'}, - 'gmsa_profile': {'key': 'gmsaProfile', 'type': 'WindowsGmsaProfile'}, + "admin_username": {"key": "adminUsername", "type": "str"}, + "admin_password": {"key": "adminPassword", "type": "str"}, + "license_type": {"key": "licenseType", "type": "str"}, + "enable_csi_proxy": {"key": "enableCSIProxy", "type": "bool"}, + "gmsa_profile": {"key": "gmsaProfile", "type": "WindowsGmsaProfile"}, } def __init__( @@ -4510,13 +4421,13 @@ def __init__( **kwargs ): """ - :keyword admin_username: Required. Specifies the name of the administrator account. + :keyword admin_username: Specifies the name of the administrator account. :code:`
`:code:`
` **Restriction:** Cannot end in "." :code:`
`:code:`
` **Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 - character :code:`
`:code:`
` **Max-length:** 20 characters. + character :code:`
`:code:`
` **Max-length:** 20 characters. Required. :paramtype admin_username: str :keyword admin_password: Specifies the password of the administrator account. :code:`
`:code:`
` **Minimum-length:** 8 characters :code:`
`:code:`
` @@ -4528,7 +4439,7 @@ def __init__( :paramtype admin_password: str :keyword license_type: The license type to use for Windows VMs. See `Azure Hybrid User Benefits `_ for more details. Known values are: - "None", "Windows_Server". + "None" and "Windows_Server". :paramtype license_type: str or ~azure.mgmt.containerservice.v2022_02_01.models.LicenseType :keyword enable_csi_proxy: For more details on CSI proxy, see the `CSI proxy GitHub repo `_. @@ -4536,7 +4447,7 @@ def __init__( :keyword gmsa_profile: The Windows gMSA Profile in the Managed Cluster. :paramtype gmsa_profile: ~azure.mgmt.containerservice.v2022_02_01.models.WindowsGmsaProfile """ - super(ManagedClusterWindowsProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.admin_username = admin_username self.admin_password = admin_password self.license_type = license_type @@ -4544,7 +4455,7 @@ def __init__( self.gmsa_profile = gmsa_profile -class ManagedServiceIdentityUserAssignedIdentitiesValue(msrest.serialization.Model): +class ManagedServiceIdentityUserAssignedIdentitiesValue(_serialization.Model): """ManagedServiceIdentityUserAssignedIdentitiesValue. Variables are only populated by the server, and will be ignored when sending a request. @@ -4556,27 +4467,23 @@ class ManagedServiceIdentityUserAssignedIdentitiesValue(msrest.serialization.Mod """ _validation = { - 'principal_id': {'readonly': True}, - 'client_id': {'readonly': True}, + "principal_id": {"readonly": True}, + "client_id": {"readonly": True}, } _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, + "principal_id": {"key": "principalId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(ManagedServiceIdentityUserAssignedIdentitiesValue, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.principal_id = None self.client_id = None -class OperationListResult(msrest.serialization.Model): +class OperationListResult(_serialization.Model): """The List Operation response. Variables are only populated by the server, and will be ignored when sending a request. @@ -4586,24 +4493,20 @@ class OperationListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[OperationValue]'}, + "value": {"key": "value", "type": "[OperationValue]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(OperationListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None -class OperationValue(msrest.serialization.Model): +class OperationValue(_serialization.Model): """Describes the properties of a Operation value. Variables are only populated by the server, and will be ignored when sending a request. @@ -4623,30 +4526,26 @@ class OperationValue(msrest.serialization.Model): """ _validation = { - 'origin': {'readonly': True}, - 'name': {'readonly': True}, - 'operation': {'readonly': True}, - 'resource': {'readonly': True}, - 'description': {'readonly': True}, - 'provider': {'readonly': True}, + "origin": {"readonly": True}, + "name": {"readonly": True}, + "operation": {"readonly": True}, + "resource": {"readonly": True}, + "description": {"readonly": True}, + "provider": {"readonly": True}, } _attribute_map = { - 'origin': {'key': 'origin', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'operation': {'key': 'display.operation', 'type': 'str'}, - 'resource': {'key': 'display.resource', 'type': 'str'}, - 'description': {'key': 'display.description', 'type': 'str'}, - 'provider': {'key': 'display.provider', 'type': 'str'}, + "origin": {"key": "origin", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "operation": {"key": "display.operation", "type": "str"}, + "resource": {"key": "display.resource", "type": "str"}, + "description": {"key": "display.description", "type": "str"}, + "provider": {"key": "display.provider", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(OperationValue, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.origin = None self.name = None self.operation = None @@ -4655,7 +4554,7 @@ def __init__( self.provider = None -class OSOptionProfile(msrest.serialization.Model): +class OSOptionProfile(_serialization.Model): """The OS option profile. Variables are only populated by the server, and will be ignored when sending a request. @@ -4668,83 +4567,72 @@ class OSOptionProfile(msrest.serialization.Model): :vartype name: str :ivar type: The type of the OS option resource. :vartype type: str - :ivar os_option_property_list: Required. The list of OS options. + :ivar os_option_property_list: The list of OS options. Required. :vartype os_option_property_list: list[~azure.mgmt.containerservice.v2022_02_01.models.OSOptionProperty] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'os_option_property_list': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "os_option_property_list": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'os_option_property_list': {'key': 'properties.osOptionPropertyList', 'type': '[OSOptionProperty]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "os_option_property_list": {"key": "properties.osOptionPropertyList", "type": "[OSOptionProperty]"}, } - def __init__( - self, - *, - os_option_property_list: List["_models.OSOptionProperty"], - **kwargs - ): + def __init__(self, *, os_option_property_list: List["_models.OSOptionProperty"], **kwargs): """ - :keyword os_option_property_list: Required. The list of OS options. + :keyword os_option_property_list: The list of OS options. Required. :paramtype os_option_property_list: list[~azure.mgmt.containerservice.v2022_02_01.models.OSOptionProperty] """ - super(OSOptionProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None self.os_option_property_list = os_option_property_list -class OSOptionProperty(msrest.serialization.Model): +class OSOptionProperty(_serialization.Model): """OS option property. All required parameters must be populated in order to send to Azure. - :ivar os_type: Required. The OS type. + :ivar os_type: The OS type. Required. :vartype os_type: str - :ivar enable_fips_image: Required. Whether the image is FIPS-enabled. + :ivar enable_fips_image: Whether the image is FIPS-enabled. Required. :vartype enable_fips_image: bool """ _validation = { - 'os_type': {'required': True}, - 'enable_fips_image': {'required': True}, + "os_type": {"required": True}, + "enable_fips_image": {"required": True}, } _attribute_map = { - 'os_type': {'key': 'os-type', 'type': 'str'}, - 'enable_fips_image': {'key': 'enable-fips-image', 'type': 'bool'}, + "os_type": {"key": "os-type", "type": "str"}, + "enable_fips_image": {"key": "enable-fips-image", "type": "bool"}, } - def __init__( - self, - *, - os_type: str, - enable_fips_image: bool, - **kwargs - ): + def __init__(self, *, os_type: str, enable_fips_image: bool, **kwargs): """ - :keyword os_type: Required. The OS type. + :keyword os_type: The OS type. Required. :paramtype os_type: str - :keyword enable_fips_image: Required. Whether the image is FIPS-enabled. + :keyword enable_fips_image: Whether the image is FIPS-enabled. Required. :paramtype enable_fips_image: bool """ - super(OSOptionProperty, self).__init__(**kwargs) + super().__init__(**kwargs) self.os_type = os_type self.enable_fips_image = enable_fips_image -class OutboundEnvironmentEndpoint(msrest.serialization.Model): +class OutboundEnvironmentEndpoint(_serialization.Model): """Egress endpoints which AKS agent nodes connect to for common purpose. :ivar category: The category of endpoints accessed by the AKS agent node, e.g. @@ -4755,8 +4643,8 @@ class OutboundEnvironmentEndpoint(msrest.serialization.Model): """ _attribute_map = { - 'category': {'key': 'category', 'type': 'str'}, - 'endpoints': {'key': 'endpoints', 'type': '[EndpointDependency]'}, + "category": {"key": "category", "type": "str"}, + "endpoints": {"key": "endpoints", "type": "[EndpointDependency]"}, } def __init__( @@ -4773,19 +4661,19 @@ def __init__( :keyword endpoints: The endpoints that AKS agent nodes connect to. :paramtype endpoints: list[~azure.mgmt.containerservice.v2022_02_01.models.EndpointDependency] """ - super(OutboundEnvironmentEndpoint, self).__init__(**kwargs) + super().__init__(**kwargs) self.category = category self.endpoints = endpoints -class OutboundEnvironmentEndpointCollection(msrest.serialization.Model): +class OutboundEnvironmentEndpointCollection(_serialization.Model): """Collection of OutboundEnvironmentEndpoint. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar value: Required. Collection of resources. + :ivar value: Collection of resources. Required. :vartype value: list[~azure.mgmt.containerservice.v2022_02_01.models.OutboundEnvironmentEndpoint] :ivar next_link: Link to next page of resources. @@ -4793,59 +4681,49 @@ class OutboundEnvironmentEndpointCollection(msrest.serialization.Model): """ _validation = { - 'value': {'required': True}, - 'next_link': {'readonly': True}, + "value": {"required": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[OutboundEnvironmentEndpoint]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[OutboundEnvironmentEndpoint]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: List["_models.OutboundEnvironmentEndpoint"], - **kwargs - ): + def __init__(self, *, value: List["_models.OutboundEnvironmentEndpoint"], **kwargs): """ - :keyword value: Required. Collection of resources. + :keyword value: Collection of resources. Required. :paramtype value: list[~azure.mgmt.containerservice.v2022_02_01.models.OutboundEnvironmentEndpoint] """ - super(OutboundEnvironmentEndpointCollection, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class PowerState(msrest.serialization.Model): +class PowerState(_serialization.Model): """Describes the Power State of the cluster. - :ivar code: Tells whether the cluster is Running or Stopped. Known values are: "Running", + :ivar code: Tells whether the cluster is Running or Stopped. Known values are: "Running" and "Stopped". :vartype code: str or ~azure.mgmt.containerservice.v2022_02_01.models.Code """ _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, + "code": {"key": "code", "type": "str"}, } - def __init__( - self, - *, - code: Optional[Union[str, "_models.Code"]] = None, - **kwargs - ): + def __init__(self, *, code: Optional[Union[str, "_models.Code"]] = None, **kwargs): """ - :keyword code: Tells whether the cluster is Running or Stopped. Known values are: "Running", + :keyword code: Tells whether the cluster is Running or Stopped. Known values are: "Running" and "Stopped". :paramtype code: str or ~azure.mgmt.containerservice.v2022_02_01.models.Code """ - super(PowerState, self).__init__(**kwargs) + super().__init__(**kwargs) self.code = code -class PrivateEndpoint(msrest.serialization.Model): +class PrivateEndpoint(_serialization.Model): """Private endpoint which a connection belongs to. :ivar id: The resource ID of the private endpoint. @@ -4853,24 +4731,19 @@ class PrivateEndpoint(msrest.serialization.Model): """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, } - def __init__( - self, - *, - id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin """ :keyword id: The resource ID of the private endpoint. :paramtype id: str """ - super(PrivateEndpoint, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id -class PrivateEndpointConnection(msrest.serialization.Model): +class PrivateEndpointConnection(_serialization.Model): """A private endpoint connection. Variables are only populated by the server, and will be ignored when sending a request. @@ -4882,7 +4755,7 @@ class PrivateEndpointConnection(msrest.serialization.Model): :ivar type: The resource type. :vartype type: str :ivar provisioning_state: The current provisioning state. Known values are: "Succeeded", - "Creating", "Deleting", "Failed". + "Creating", "Deleting", and "Failed". :vartype provisioning_state: str or ~azure.mgmt.containerservice.v2022_02_01.models.PrivateEndpointConnectionProvisioningState :ivar private_endpoint: The resource of private endpoint. @@ -4894,19 +4767,22 @@ class PrivateEndpointConnection(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'provisioning_state': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, - 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "private_endpoint": {"key": "properties.privateEndpoint", "type": "PrivateEndpoint"}, + "private_link_service_connection_state": { + "key": "properties.privateLinkServiceConnectionState", + "type": "PrivateLinkServiceConnectionState", + }, } def __init__( @@ -4924,7 +4800,7 @@ def __init__( :paramtype private_link_service_connection_state: ~azure.mgmt.containerservice.v2022_02_01.models.PrivateLinkServiceConnectionState """ - super(PrivateEndpointConnection, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -4933,7 +4809,7 @@ def __init__( self.private_link_service_connection_state = private_link_service_connection_state -class PrivateEndpointConnectionListResult(msrest.serialization.Model): +class PrivateEndpointConnectionListResult(_serialization.Model): """A list of private endpoint connections. :ivar value: The collection value. @@ -4941,25 +4817,20 @@ class PrivateEndpointConnectionListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, + "value": {"key": "value", "type": "[PrivateEndpointConnection]"}, } - def __init__( - self, - *, - value: Optional[List["_models.PrivateEndpointConnection"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.PrivateEndpointConnection"]] = None, **kwargs): """ :keyword value: The collection value. :paramtype value: list[~azure.mgmt.containerservice.v2022_02_01.models.PrivateEndpointConnection] """ - super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value -class PrivateLinkResource(msrest.serialization.Model): +class PrivateLinkResource(_serialization.Model): """A private link resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -4980,22 +4851,22 @@ class PrivateLinkResource(msrest.serialization.Model): """ _validation = { - 'private_link_service_id': {'readonly': True}, + "private_link_service_id": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'group_id': {'key': 'groupId', 'type': 'str'}, - 'required_members': {'key': 'requiredMembers', 'type': '[str]'}, - 'private_link_service_id': {'key': 'privateLinkServiceID', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "group_id": {"key": "groupId", "type": "str"}, + "required_members": {"key": "requiredMembers", "type": "[str]"}, + "private_link_service_id": {"key": "privateLinkServiceID", "type": "str"}, } def __init__( self, *, - id: Optional[str] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin name: Optional[str] = None, type: Optional[str] = None, group_id: Optional[str] = None, @@ -5014,7 +4885,7 @@ def __init__( :keyword required_members: The RequiredMembers of the resource. :paramtype required_members: list[str] """ - super(PrivateLinkResource, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id self.name = name self.type = type @@ -5023,7 +4894,7 @@ def __init__( self.private_link_service_id = None -class PrivateLinkResourcesListResult(msrest.serialization.Model): +class PrivateLinkResourcesListResult(_serialization.Model): """A list of private link resources. :ivar value: The collection value. @@ -5031,36 +4902,31 @@ class PrivateLinkResourcesListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, + "value": {"key": "value", "type": "[PrivateLinkResource]"}, } - def __init__( - self, - *, - value: Optional[List["_models.PrivateLinkResource"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.PrivateLinkResource"]] = None, **kwargs): """ :keyword value: The collection value. :paramtype value: list[~azure.mgmt.containerservice.v2022_02_01.models.PrivateLinkResource] """ - super(PrivateLinkResourcesListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value -class PrivateLinkServiceConnectionState(msrest.serialization.Model): +class PrivateLinkServiceConnectionState(_serialization.Model): """The state of a private link service connection. :ivar status: The private link service connection status. Known values are: "Pending", - "Approved", "Rejected", "Disconnected". + "Approved", "Rejected", and "Disconnected". :vartype status: str or ~azure.mgmt.containerservice.v2022_02_01.models.ConnectionStatus :ivar description: The private link service connection description. :vartype description: str """ _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, + "status": {"key": "status", "type": "str"}, + "description": {"key": "description", "type": "str"}, } def __init__( @@ -5072,17 +4938,17 @@ def __init__( ): """ :keyword status: The private link service connection status. Known values are: "Pending", - "Approved", "Rejected", "Disconnected". + "Approved", "Rejected", and "Disconnected". :paramtype status: str or ~azure.mgmt.containerservice.v2022_02_01.models.ConnectionStatus :keyword description: The private link service connection description. :paramtype description: str """ - super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) + super().__init__(**kwargs) self.status = status self.description = description -class ResourceReference(msrest.serialization.Model): +class ResourceReference(_serialization.Model): """A reference to an Azure resource. :ivar id: The fully qualified Azure resource id. @@ -5090,29 +4956,24 @@ class ResourceReference(msrest.serialization.Model): """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, } - def __init__( - self, - *, - id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin """ :keyword id: The fully qualified Azure resource id. :paramtype id: str """ - super(ResourceReference, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id -class RunCommandRequest(msrest.serialization.Model): +class RunCommandRequest(_serialization.Model): """A run command request. All required parameters must be populated in order to send to Azure. - :ivar command: Required. The command to run. + :ivar command: The command to run. Required. :vartype command: str :ivar context: A base64 encoded zip file containing the files required by the command. :vartype context: str @@ -5121,38 +4982,31 @@ class RunCommandRequest(msrest.serialization.Model): """ _validation = { - 'command': {'required': True}, + "command": {"required": True}, } _attribute_map = { - 'command': {'key': 'command', 'type': 'str'}, - 'context': {'key': 'context', 'type': 'str'}, - 'cluster_token': {'key': 'clusterToken', 'type': 'str'}, + "command": {"key": "command", "type": "str"}, + "context": {"key": "context", "type": "str"}, + "cluster_token": {"key": "clusterToken", "type": "str"}, } - def __init__( - self, - *, - command: str, - context: Optional[str] = None, - cluster_token: Optional[str] = None, - **kwargs - ): + def __init__(self, *, command: str, context: Optional[str] = None, cluster_token: Optional[str] = None, **kwargs): """ - :keyword command: Required. The command to run. + :keyword command: The command to run. Required. :paramtype command: str :keyword context: A base64 encoded zip file containing the files required by the command. :paramtype context: str :keyword cluster_token: AuthToken issued for AKS AAD Server App. :paramtype cluster_token: str """ - super(RunCommandRequest, self).__init__(**kwargs) + super().__init__(**kwargs) self.command = command self.context = context self.cluster_token = cluster_token -class RunCommandResult(msrest.serialization.Model): +class RunCommandResult(_serialization.Model): """run command result. Variables are only populated by the server, and will be ignored when sending a request. @@ -5174,32 +5028,28 @@ class RunCommandResult(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'exit_code': {'readonly': True}, - 'started_at': {'readonly': True}, - 'finished_at': {'readonly': True}, - 'logs': {'readonly': True}, - 'reason': {'readonly': True}, + "id": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "exit_code": {"readonly": True}, + "started_at": {"readonly": True}, + "finished_at": {"readonly": True}, + "logs": {"readonly": True}, + "reason": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'exit_code': {'key': 'properties.exitCode', 'type': 'int'}, - 'started_at': {'key': 'properties.startedAt', 'type': 'iso-8601'}, - 'finished_at': {'key': 'properties.finishedAt', 'type': 'iso-8601'}, - 'logs': {'key': 'properties.logs', 'type': 'str'}, - 'reason': {'key': 'properties.reason', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(RunCommandResult, self).__init__(**kwargs) + "id": {"key": "id", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "exit_code": {"key": "properties.exitCode", "type": "int"}, + "started_at": {"key": "properties.startedAt", "type": "iso-8601"}, + "finished_at": {"key": "properties.finishedAt", "type": "iso-8601"}, + "logs": {"key": "properties.logs", "type": "str"}, + "reason": {"key": "properties.reason", "type": "str"}, + } + + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.id = None self.provisioning_state = None self.exit_code = None @@ -5209,7 +5059,7 @@ def __init__( self.reason = None -class Snapshot(Resource): +class Snapshot(Resource): # pylint: disable=too-many-instance-attributes """A node pool snapshot resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -5227,25 +5077,24 @@ class Snapshot(Resource): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.containerservice.v2022_02_01.models.SystemData - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar creation_data: CreationData to be used to specify the source agent pool resource ID to create this snapshot. :vartype creation_data: ~azure.mgmt.containerservice.v2022_02_01.models.CreationData - :ivar snapshot_type: The type of a snapshot. The default is NodePool. Known values are: - "NodePool". Default value: "NodePool". + :ivar snapshot_type: The type of a snapshot. The default is NodePool. "NodePool" :vartype snapshot_type: str or ~azure.mgmt.containerservice.v2022_02_01.models.SnapshotType :ivar kubernetes_version: The version of Kubernetes. :vartype kubernetes_version: str :ivar node_image_version: The version of node image. :vartype node_image_version: str - :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_02_01.models.OSType :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known - values are: "Ubuntu", "CBLMariner". + values are: "Ubuntu" and "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2022_02_01.models.OSSKU :ivar vm_size: The size of the VM. :vartype vm_size: str @@ -5254,34 +5103,34 @@ class Snapshot(Resource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'location': {'required': True}, - 'kubernetes_version': {'readonly': True}, - 'node_image_version': {'readonly': True}, - 'os_type': {'readonly': True}, - 'os_sku': {'readonly': True}, - 'vm_size': {'readonly': True}, - 'enable_fips': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, + "kubernetes_version": {"readonly": True}, + "node_image_version": {"readonly": True}, + "os_type": {"readonly": True}, + "os_sku": {"readonly": True}, + "vm_size": {"readonly": True}, + "enable_fips": {"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'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'creation_data': {'key': 'properties.creationData', 'type': 'CreationData'}, - 'snapshot_type': {'key': 'properties.snapshotType', 'type': 'str'}, - 'kubernetes_version': {'key': 'properties.kubernetesVersion', 'type': 'str'}, - 'node_image_version': {'key': 'properties.nodeImageVersion', 'type': 'str'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'os_sku': {'key': 'properties.osSku', 'type': 'str'}, - 'vm_size': {'key': 'properties.vmSize', 'type': 'str'}, - 'enable_fips': {'key': 'properties.enableFIPS', 'type': 'bool'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "creation_data": {"key": "properties.creationData", "type": "CreationData"}, + "snapshot_type": {"key": "properties.snapshotType", "type": "str"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "node_image_version": {"key": "properties.nodeImageVersion", "type": "str"}, + "os_type": {"key": "properties.osType", "type": "str"}, + "os_sku": {"key": "properties.osSku", "type": "str"}, + "vm_size": {"key": "properties.vmSize", "type": "str"}, + "enable_fips": {"key": "properties.enableFIPS", "type": "bool"}, } def __init__( @@ -5290,22 +5139,21 @@ def __init__( location: str, tags: Optional[Dict[str, str]] = None, creation_data: Optional["_models.CreationData"] = None, - snapshot_type: Optional[Union[str, "_models.SnapshotType"]] = "NodePool", + snapshot_type: Union[str, "_models.SnapshotType"] = "NodePool", **kwargs ): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword creation_data: CreationData to be used to specify the source agent pool resource ID to create this snapshot. :paramtype creation_data: ~azure.mgmt.containerservice.v2022_02_01.models.CreationData - :keyword snapshot_type: The type of a snapshot. The default is NodePool. Known values are: - "NodePool". Default value: "NodePool". + :keyword snapshot_type: The type of a snapshot. The default is NodePool. "NodePool" :paramtype snapshot_type: str or ~azure.mgmt.containerservice.v2022_02_01.models.SnapshotType """ - super(Snapshot, self).__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.creation_data = creation_data self.snapshot_type = snapshot_type self.kubernetes_version = None @@ -5316,7 +5164,7 @@ def __init__( self.enable_fips = None -class SnapshotListResult(msrest.serialization.Model): +class SnapshotListResult(_serialization.Model): """The response from the List Snapshots operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -5328,30 +5176,25 @@ class SnapshotListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[Snapshot]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[Snapshot]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.Snapshot"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.Snapshot"]] = None, **kwargs): """ :keyword value: The list of snapshots. :paramtype value: list[~azure.mgmt.containerservice.v2022_02_01.models.Snapshot] """ - super(SnapshotListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class SysctlConfig(msrest.serialization.Model): +class SysctlConfig(_serialization.Model): # pylint: disable=too-many-instance-attributes """Sysctl settings for Linux agent nodes. :ivar net_core_somaxconn: Sysctl setting net.core.somaxconn. @@ -5413,37 +5256,37 @@ class SysctlConfig(msrest.serialization.Model): """ _attribute_map = { - 'net_core_somaxconn': {'key': 'netCoreSomaxconn', 'type': 'int'}, - 'net_core_netdev_max_backlog': {'key': 'netCoreNetdevMaxBacklog', 'type': 'int'}, - 'net_core_rmem_default': {'key': 'netCoreRmemDefault', 'type': 'int'}, - 'net_core_rmem_max': {'key': 'netCoreRmemMax', 'type': 'int'}, - 'net_core_wmem_default': {'key': 'netCoreWmemDefault', 'type': 'int'}, - 'net_core_wmem_max': {'key': 'netCoreWmemMax', 'type': 'int'}, - 'net_core_optmem_max': {'key': 'netCoreOptmemMax', 'type': 'int'}, - 'net_ipv4_tcp_max_syn_backlog': {'key': 'netIpv4TcpMaxSynBacklog', 'type': 'int'}, - 'net_ipv4_tcp_max_tw_buckets': {'key': 'netIpv4TcpMaxTwBuckets', 'type': 'int'}, - 'net_ipv4_tcp_fin_timeout': {'key': 'netIpv4TcpFinTimeout', 'type': 'int'}, - 'net_ipv4_tcp_keepalive_time': {'key': 'netIpv4TcpKeepaliveTime', 'type': 'int'}, - 'net_ipv4_tcp_keepalive_probes': {'key': 'netIpv4TcpKeepaliveProbes', 'type': 'int'}, - 'net_ipv4_tcpkeepalive_intvl': {'key': 'netIpv4TcpkeepaliveIntvl', 'type': 'int'}, - 'net_ipv4_tcp_tw_reuse': {'key': 'netIpv4TcpTwReuse', 'type': 'bool'}, - 'net_ipv4_ip_local_port_range': {'key': 'netIpv4IpLocalPortRange', 'type': 'str'}, - 'net_ipv4_neigh_default_gc_thresh1': {'key': 'netIpv4NeighDefaultGcThresh1', 'type': 'int'}, - 'net_ipv4_neigh_default_gc_thresh2': {'key': 'netIpv4NeighDefaultGcThresh2', 'type': 'int'}, - 'net_ipv4_neigh_default_gc_thresh3': {'key': 'netIpv4NeighDefaultGcThresh3', 'type': 'int'}, - 'net_netfilter_nf_conntrack_max': {'key': 'netNetfilterNfConntrackMax', 'type': 'int'}, - 'net_netfilter_nf_conntrack_buckets': {'key': 'netNetfilterNfConntrackBuckets', 'type': 'int'}, - 'fs_inotify_max_user_watches': {'key': 'fsInotifyMaxUserWatches', 'type': 'int'}, - 'fs_file_max': {'key': 'fsFileMax', 'type': 'int'}, - 'fs_aio_max_nr': {'key': 'fsAioMaxNr', 'type': 'int'}, - 'fs_nr_open': {'key': 'fsNrOpen', 'type': 'int'}, - 'kernel_threads_max': {'key': 'kernelThreadsMax', 'type': 'int'}, - 'vm_max_map_count': {'key': 'vmMaxMapCount', 'type': 'int'}, - 'vm_swappiness': {'key': 'vmSwappiness', 'type': 'int'}, - 'vm_vfs_cache_pressure': {'key': 'vmVfsCachePressure', 'type': 'int'}, - } - - def __init__( + "net_core_somaxconn": {"key": "netCoreSomaxconn", "type": "int"}, + "net_core_netdev_max_backlog": {"key": "netCoreNetdevMaxBacklog", "type": "int"}, + "net_core_rmem_default": {"key": "netCoreRmemDefault", "type": "int"}, + "net_core_rmem_max": {"key": "netCoreRmemMax", "type": "int"}, + "net_core_wmem_default": {"key": "netCoreWmemDefault", "type": "int"}, + "net_core_wmem_max": {"key": "netCoreWmemMax", "type": "int"}, + "net_core_optmem_max": {"key": "netCoreOptmemMax", "type": "int"}, + "net_ipv4_tcp_max_syn_backlog": {"key": "netIpv4TcpMaxSynBacklog", "type": "int"}, + "net_ipv4_tcp_max_tw_buckets": {"key": "netIpv4TcpMaxTwBuckets", "type": "int"}, + "net_ipv4_tcp_fin_timeout": {"key": "netIpv4TcpFinTimeout", "type": "int"}, + "net_ipv4_tcp_keepalive_time": {"key": "netIpv4TcpKeepaliveTime", "type": "int"}, + "net_ipv4_tcp_keepalive_probes": {"key": "netIpv4TcpKeepaliveProbes", "type": "int"}, + "net_ipv4_tcpkeepalive_intvl": {"key": "netIpv4TcpkeepaliveIntvl", "type": "int"}, + "net_ipv4_tcp_tw_reuse": {"key": "netIpv4TcpTwReuse", "type": "bool"}, + "net_ipv4_ip_local_port_range": {"key": "netIpv4IpLocalPortRange", "type": "str"}, + "net_ipv4_neigh_default_gc_thresh1": {"key": "netIpv4NeighDefaultGcThresh1", "type": "int"}, + "net_ipv4_neigh_default_gc_thresh2": {"key": "netIpv4NeighDefaultGcThresh2", "type": "int"}, + "net_ipv4_neigh_default_gc_thresh3": {"key": "netIpv4NeighDefaultGcThresh3", "type": "int"}, + "net_netfilter_nf_conntrack_max": {"key": "netNetfilterNfConntrackMax", "type": "int"}, + "net_netfilter_nf_conntrack_buckets": {"key": "netNetfilterNfConntrackBuckets", "type": "int"}, + "fs_inotify_max_user_watches": {"key": "fsInotifyMaxUserWatches", "type": "int"}, + "fs_file_max": {"key": "fsFileMax", "type": "int"}, + "fs_aio_max_nr": {"key": "fsAioMaxNr", "type": "int"}, + "fs_nr_open": {"key": "fsNrOpen", "type": "int"}, + "kernel_threads_max": {"key": "kernelThreadsMax", "type": "int"}, + "vm_max_map_count": {"key": "vmMaxMapCount", "type": "int"}, + "vm_swappiness": {"key": "vmSwappiness", "type": "int"}, + "vm_vfs_cache_pressure": {"key": "vmVfsCachePressure", "type": "int"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, net_core_somaxconn: Optional[int] = None, @@ -5534,7 +5377,7 @@ def __init__( :keyword vm_vfs_cache_pressure: Sysctl setting vm.vfs_cache_pressure. :paramtype vm_vfs_cache_pressure: int """ - super(SysctlConfig, self).__init__(**kwargs) + super().__init__(**kwargs) self.net_core_somaxconn = net_core_somaxconn self.net_core_netdev_max_backlog = net_core_netdev_max_backlog self.net_core_rmem_default = net_core_rmem_default @@ -5565,20 +5408,20 @@ def __init__( self.vm_vfs_cache_pressure = vm_vfs_cache_pressure -class SystemData(msrest.serialization.Model): +class SystemData(_serialization.Model): """Metadata pertaining to creation and last modification of the resource. :ivar created_by: The identity that created the resource. :vartype created_by: str :ivar created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", "Key". + "User", "Application", "ManagedIdentity", and "Key". :vartype created_by_type: str or ~azure.mgmt.containerservice.v2022_02_01.models.CreatedByType :ivar created_at: The timestamp of resource creation (UTC). :vartype created_at: ~datetime.datetime :ivar last_modified_by: The identity that last modified the resource. :vartype last_modified_by: str :ivar last_modified_by_type: The type of identity that last modified the resource. Known values - are: "User", "Application", "ManagedIdentity", "Key". + are: "User", "Application", "ManagedIdentity", and "Key". :vartype last_modified_by_type: str or ~azure.mgmt.containerservice.v2022_02_01.models.CreatedByType :ivar last_modified_at: The timestamp of resource last modification (UTC). @@ -5586,12 +5429,12 @@ class SystemData(msrest.serialization.Model): """ _attribute_map = { - 'created_by': {'key': 'createdBy', 'type': 'str'}, - 'created_by_type': {'key': 'createdByType', 'type': 'str'}, - 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, - 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, - 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, - 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + "created_by": {"key": "createdBy", "type": "str"}, + "created_by_type": {"key": "createdByType", "type": "str"}, + "created_at": {"key": "createdAt", "type": "iso-8601"}, + "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, + "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, + "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, } def __init__( @@ -5609,7 +5452,7 @@ def __init__( :keyword created_by: The identity that created the resource. :paramtype created_by: str :keyword created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", "Key". + "User", "Application", "ManagedIdentity", and "Key". :paramtype created_by_type: str or ~azure.mgmt.containerservice.v2022_02_01.models.CreatedByType :keyword created_at: The timestamp of resource creation (UTC). @@ -5617,13 +5460,13 @@ def __init__( :keyword last_modified_by: The identity that last modified the resource. :paramtype last_modified_by: str :keyword last_modified_by_type: The type of identity that last modified the resource. Known - values are: "User", "Application", "ManagedIdentity", "Key". + values are: "User", "Application", "ManagedIdentity", and "Key". :paramtype last_modified_by_type: str or ~azure.mgmt.containerservice.v2022_02_01.models.CreatedByType :keyword last_modified_at: The timestamp of resource last modification (UTC). :paramtype last_modified_at: ~datetime.datetime """ - super(SystemData, self).__init__(**kwargs) + super().__init__(**kwargs) self.created_by = created_by self.created_by_type = created_by_type self.created_at = created_at @@ -5632,36 +5475,31 @@ def __init__( self.last_modified_at = last_modified_at -class TagsObject(msrest.serialization.Model): +class TagsObject(_serialization.Model): """Tags object for patch operations. - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] """ _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] """ - super(TagsObject, self).__init__(**kwargs) + super().__init__(**kwargs) self.tags = tags -class TimeInWeek(msrest.serialization.Model): +class TimeInWeek(_serialization.Model): """Time in a week. :ivar day: The day of the week. Known values are: "Sunday", "Monday", "Tuesday", "Wednesday", - "Thursday", "Friday", "Saturday". + "Thursday", "Friday", and "Saturday". :vartype day: str or ~azure.mgmt.containerservice.v2022_02_01.models.WeekDay :ivar hour_slots: Each integer hour represents a time range beginning at 0m after the hour ending at the next hour (non-inclusive). 0 corresponds to 00:00 UTC, 23 corresponds to 23:00 @@ -5670,32 +5508,28 @@ class TimeInWeek(msrest.serialization.Model): """ _attribute_map = { - 'day': {'key': 'day', 'type': 'str'}, - 'hour_slots': {'key': 'hourSlots', 'type': '[int]'}, + "day": {"key": "day", "type": "str"}, + "hour_slots": {"key": "hourSlots", "type": "[int]"}, } def __init__( - self, - *, - day: Optional[Union[str, "_models.WeekDay"]] = None, - hour_slots: Optional[List[int]] = None, - **kwargs + self, *, day: Optional[Union[str, "_models.WeekDay"]] = None, hour_slots: Optional[List[int]] = None, **kwargs ): """ :keyword day: The day of the week. Known values are: "Sunday", "Monday", "Tuesday", - "Wednesday", "Thursday", "Friday", "Saturday". + "Wednesday", "Thursday", "Friday", and "Saturday". :paramtype day: str or ~azure.mgmt.containerservice.v2022_02_01.models.WeekDay :keyword hour_slots: Each integer hour represents a time range beginning at 0m after the hour ending at the next hour (non-inclusive). 0 corresponds to 00:00 UTC, 23 corresponds to 23:00 UTC. Specifying [0, 1] means the 00:00 - 02:00 UTC time range. :paramtype hour_slots: list[int] """ - super(TimeInWeek, self).__init__(**kwargs) + super().__init__(**kwargs) self.day = day self.hour_slots = hour_slots -class TimeSpan(msrest.serialization.Model): +class TimeSpan(_serialization.Model): """For example, between 2021-05-25T13:00:00Z and 2021-05-25T14:00:00Z. :ivar start: The start of a time span. @@ -5705,29 +5539,23 @@ class TimeSpan(msrest.serialization.Model): """ _attribute_map = { - 'start': {'key': 'start', 'type': 'iso-8601'}, - 'end': {'key': 'end', 'type': 'iso-8601'}, + "start": {"key": "start", "type": "iso-8601"}, + "end": {"key": "end", "type": "iso-8601"}, } - def __init__( - self, - *, - start: Optional[datetime.datetime] = None, - end: Optional[datetime.datetime] = None, - **kwargs - ): + def __init__(self, *, start: Optional[datetime.datetime] = None, end: Optional[datetime.datetime] = None, **kwargs): """ :keyword start: The start of a time span. :paramtype start: ~datetime.datetime :keyword end: The end of a time span. :paramtype end: ~datetime.datetime """ - super(TimeSpan, self).__init__(**kwargs) + super().__init__(**kwargs) self.start = start self.end = end -class WindowsGmsaProfile(msrest.serialization.Model): +class WindowsGmsaProfile(_serialization.Model): """Windows gMSA Profile in the managed cluster. :ivar enabled: Specifies whether to enable Windows gMSA in the managed cluster. @@ -5743,9 +5571,9 @@ class WindowsGmsaProfile(msrest.serialization.Model): """ _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'dns_server': {'key': 'dnsServer', 'type': 'str'}, - 'root_domain_name': {'key': 'rootDomainName', 'type': 'str'}, + "enabled": {"key": "enabled", "type": "bool"}, + "dns_server": {"key": "dnsServer", "type": "str"}, + "root_domain_name": {"key": "rootDomainName", "type": "str"}, } def __init__( @@ -5768,7 +5596,7 @@ def __init__( which is used to create the managed cluster. :paramtype root_domain_name: str """ - super(WindowsGmsaProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.dns_server = dns_server self.root_domain_name = root_domain_name diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/models/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/models/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/models/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/models/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/operations/__init__.py index e0748876288c..593b23075ce0 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/operations/__init__.py @@ -18,15 +18,16 @@ from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'Operations', - 'ManagedClustersOperations', - 'MaintenanceConfigurationsOperations', - 'AgentPoolsOperations', - 'PrivateEndpointConnectionsOperations', - 'PrivateLinkResourcesOperations', - 'ResolvePrivateLinkServiceIdOperations', - 'SnapshotsOperations', + "Operations", + "ManagedClustersOperations", + "MaintenanceConfigurationsOperations", + "AgentPoolsOperations", + "PrivateEndpointConnectionsOperations", + "PrivateLinkResourcesOperations", + "ResolvePrivateLinkServiceIdOperations", + "SnapshotsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/operations/_agent_pools_operations.py index 2c61667fe758..1bcd83e7e2bf 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/operations/_agent_pools_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,288 +27,303 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - *, - json: Optional[_models.AgentPool] = None, - content: Any = None, - **kwargs: Any + _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, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + _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, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_get_upgrade_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_available_agent_pool_versions_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_upgrade_node_image_version_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_upgrade_node_image_version_request( + resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class AgentPoolsOperations: """ @@ -324,47 +344,40 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> Iterable[_models.AgentPoolListResult]: + def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> Iterable["_models.AgentPool"]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AgentPoolListResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_02_01.models.AgentPoolListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either AgentPool or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_02_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -372,16 +385,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -397,10 +405,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -410,54 +416,46 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore @distributed_trace def get( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPool: """Gets the specified managed cluster agent pool. Gets the specified managed cluster agent pool. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPool, or the result of cls(response) + :return: AgentPool or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.AgentPool - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -465,57 +463,60 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore def _create_or_update_initial( self, resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: _models.AgentPool, + parameters: Union[_models.AgentPool, IO], **kwargs: Any ) -> _models.AgentPool: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - _json = self._serialize.body(parameters, 'AgentPool') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "AgentPool") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -523,10 +524,9 @@ def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -534,26 +534,27 @@ def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - @distributed_trace + @overload def begin_create_or_update( self, resource_group_name: str, resource_name: str, agent_pool_name: str, parameters: _models.AgentPool, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.AgentPool]: """Creates or updates an agent pool in the specified managed cluster. @@ -561,13 +562,58 @@ def begin_create_or_update( Creates or updates an agent pool in the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str - :param parameters: The agent pool to create or update. + :param parameters: The agent pool to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_02_01.models.AgentPool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_02_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AgentPool]: + """Creates or updates an agent pool in the specified managed cluster. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: The agent pool to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -579,20 +625,57 @@ def begin_create_or_update( :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_02_01.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: Union[_models.AgentPool, IO], + **kwargs: Any + ) -> LROPoller[_models.AgentPool]: + """Creates or updates an agent pool in the specified managed cluster. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: The agent pool to create or update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.mgmt.containerservice.v2022_02_01.models.AgentPool or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_02_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -601,66 +684,55 @@ def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -668,10 +740,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -681,26 +752,22 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + def begin_delete( + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> LROPoller[None]: """Deletes an agent pool in the specified managed cluster. Deletes an agent pool in the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -712,99 +779,86 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPoolUpgradeProfile: """Gets the upgrade profile for an agent pool. Gets the upgrade profile for an agent pool. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolUpgradeProfile, or the result of cls(response) + :return: AgentPoolUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.AgentPoolUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -812,32 +866,27 @@ def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolUpgradeProfile', pipeline_response) + deserialized = self._deserialize("AgentPoolUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore @distributed_trace def get_available_agent_pool_versions( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported Kubernetes versions for the specified agent pool. @@ -846,32 +895,30 @@ def get_available_agent_pool_versions( the version lifecycle. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolAvailableVersions, or the result of cls(response) + :return: AgentPoolAvailableVersions or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.AgentPoolAvailableVersions - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolAvailableVersions] - request = build_get_available_agent_pool_versions_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_available_agent_pool_versions.metadata['url'], + template_url=self.get_available_agent_pool_versions.metadata["url"], headers=_headers, params=_params, ) @@ -879,52 +926,43 @@ def get_available_agent_pool_versions( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolAvailableVersions', pipeline_response) + deserialized = self._deserialize("AgentPoolAvailableVersions", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_available_agent_pool_versions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore - + get_available_agent_pool_versions.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore def _upgrade_node_image_version_initial( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> Optional[_models.AgentPool]: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.AgentPool]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.AgentPool]] - - request = build_upgrade_node_image_version_request_initial( - subscription_id=self._config.subscription_id, + request = build_upgrade_node_image_version_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._upgrade_node_image_version_initial.metadata['url'], + template_url=self._upgrade_node_image_version_initial.metadata["url"], headers=_headers, params=_params, ) @@ -932,10 +970,9 @@ def _upgrade_node_image_version_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -945,26 +982,23 @@ def _upgrade_node_image_version_initial( deserialized = None response_headers = {} if response.status_code == 202: - response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) - - deserialized = self._deserialize('AgentPool', pipeline_response) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _upgrade_node_image_version_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore - + _upgrade_node_image_version_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore @distributed_trace def begin_upgrade_node_image_version( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any - ) -> LROPoller[_models.AgentPool]: + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any + ) -> LROPoller[None]: """Upgrades the node image version of an agent pool to the latest. Upgrading the node image version of an agent pool applies the newest OS and runtime updates to @@ -972,10 +1006,11 @@ def begin_upgrade_node_image_version( node image versions, see: https://docs.microsoft.com/azure/aks/node-image-upgrade. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -988,59 +1023,54 @@ def begin_upgrade_node_image_version( :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_02_01.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._upgrade_node_image_version_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) - - deserialized = self._deserialize('AgentPool', pipeline_response) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_upgrade_node_image_version.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore + begin_upgrade_node_image_version.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/operations/_maintenance_configurations_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/operations/_maintenance_configurations_operations.py index cf5cea6582d8..2e82da1fb2ab 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/operations/_maintenance_configurations_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/operations/_maintenance_configurations_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,173 +25,181 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +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_managed_cluster_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, config_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "configName": _SERIALIZER.url("config_name", config_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "configName": _SERIALIZER.url("config_name", config_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - config_name: str, - *, - json: Optional[_models.MaintenanceConfiguration] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, resource_name: str, config_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "configName": _SERIALIZER.url("config_name", config_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "configName": _SERIALIZER.url("config_name", config_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, config_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "configName": _SERIALIZER.url("config_name", config_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "configName": _SERIALIZER.url("config_name", config_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class MaintenanceConfigurationsOperations: """ @@ -207,48 +220,44 @@ def __init__(self, *args, **kwargs): 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_managed_cluster( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> Iterable[_models.MaintenanceConfigurationListResult]: + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> Iterable["_models.MaintenanceConfiguration"]: """Gets a list of maintenance configurations in the specified managed cluster. Gets a list of maintenance configurations in the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either MaintenanceConfigurationListResult or the result - of cls(response) + :return: An iterator like instance of either MaintenanceConfiguration or the result of + cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_02_01.models.MaintenanceConfigurationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_02_01.models.MaintenanceConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfigurationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfigurationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_managed_cluster_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_managed_cluster.metadata['url'], + template_url=self.list_by_managed_cluster.metadata["url"], headers=_headers, params=_params, ) @@ -256,16 +265,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_managed_cluster_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -281,10 +285,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -294,54 +296,46 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_managed_cluster.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations"} # type: ignore + list_by_managed_cluster.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations"} # type: ignore @distributed_trace def get( - self, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, config_name: str, **kwargs: Any ) -> _models.MaintenanceConfiguration: """Gets the specified maintenance configuration of a managed cluster. Gets the specified maintenance configuration of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: MaintenanceConfiguration, or the result of cls(response) + :return: MaintenanceConfiguration or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.MaintenanceConfiguration - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfiguration] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -349,33 +343,33 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) + deserialized = self._deserialize("MaintenanceConfiguration", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - - @distributed_trace + @overload def create_or_update( self, resource_group_name: str, resource_name: str, config_name: str, parameters: _models.MaintenanceConfiguration, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.MaintenanceConfiguration: """Creates or updates a maintenance configuration in the specified managed cluster. @@ -383,41 +377,116 @@ def create_or_update( Creates or updates a maintenance configuration in the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str - :param parameters: The maintenance configuration to create or update. + :param parameters: The maintenance configuration to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_02_01.models.MaintenanceConfiguration + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: MaintenanceConfiguration, or the result of cls(response) + :return: MaintenanceConfiguration or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.MaintenanceConfiguration - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configuration in the specified managed cluster. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: The maintenance configuration to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: Union[_models.MaintenanceConfiguration, IO], + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configuration in the specified managed cluster. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: The maintenance configuration to create or update. Is either a model type or + a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_02_01.models.MaintenanceConfiguration or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfiguration] - _json = self._serialize.body(parameters, 'MaintenanceConfiguration') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "MaintenanceConfiguration") request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) @@ -425,68 +494,60 @@ def create_or_update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) + deserialized = self._deserialize("MaintenanceConfiguration", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore @distributed_trace def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, config_name: str, **kwargs: Any ) -> None: """Deletes a maintenance configuration. Deletes a maintenance configuration. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) @@ -494,10 +555,9 @@ def delete( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -507,5 +567,4 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/operations/_managed_clusters_operations.py index 5e6712ae479e..b427fd4310ea 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/operations/_managed_clusters_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,200 +27,189 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_get_os_options_request( - subscription_id: str, - location: str, - *, - resource_type: Optional[str] = None, - **kwargs: Any + location: str, subscription_id: str, *, resource_type: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "location": _SERIALIZER.url("location", location, 'str', min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "location": _SERIALIZER.url("location", location, "str", min_length=1), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if resource_type is not None: - _params['resource-type'] = _SERIALIZER.query("resource_type", resource_type, 'str') + _params["resource-type"] = _SERIALIZER.query("resource_type", resource_type, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters") + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters" + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_resource_group_request( - subscription_id: str, - resource_group_name: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_upgrade_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_access_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, role_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "roleName": _SERIALIZER.url("role_name", role_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "roleName": _SERIALIZER.url("role_name", role_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_admin_credentials_request( - subscription_id: str, resource_group_name: str, resource_name: str, + subscription_id: str, *, server_fqdn: Optional[str] = None, **kwargs: Any @@ -223,40 +217,46 @@ def build_list_cluster_admin_credentials_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if server_fqdn is not None: - _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + _params["server-fqdn"] = _SERIALIZER.query("server_fqdn", server_fqdn, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_user_credentials_request( - subscription_id: str, resource_group_name: str, resource_name: str, + subscription_id: str, *, server_fqdn: Optional[str] = None, format: Optional[Union[str, "_models.Format"]] = None, @@ -265,42 +265,48 @@ def build_list_cluster_user_credentials_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if server_fqdn is not None: - _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + _params["server-fqdn"] = _SERIALIZER.query("server_fqdn", server_fqdn, "str") if format is not None: - _params['format'] = _SERIALIZER.query("format", format, 'str') + _params["format"] = _SERIALIZER.query("format", format, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_monitoring_user_credentials_request( - subscription_id: str, resource_group_name: str, resource_name: str, + subscription_id: str, *, server_fqdn: Optional[str] = None, **kwargs: Any @@ -308,520 +314,535 @@ def build_list_cluster_monitoring_user_credentials_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if server_fqdn is not None: - _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + _params["server-fqdn"] = _SERIALIZER.query("server_fqdn", server_fqdn, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: + +def build_get_request(resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedCluster] = None, - content: Any = None, - **kwargs: Any + +def build_create_or_update_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_update_tags_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.TagsObject] = None, - content: Any = None, - **kwargs: Any + +def build_update_tags_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + +def build_delete_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_reset_service_principal_profile_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedClusterServicePrincipalProfile] = None, - content: Any = None, - **kwargs: Any + +def build_reset_service_principal_profile_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_reset_aad_profile_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedClusterAADProfile] = None, - content: Any = None, - **kwargs: Any + +def build_reset_aad_profile_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_rotate_cluster_certificates_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + +def build_rotate_cluster_certificates_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_stop_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + +def build_stop_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_start_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + +def build_start_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_run_command_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.RunCommandRequest] = None, - content: Any = None, - **kwargs: Any + +def build_run_command_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_get_command_result_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - command_id: str, - **kwargs: Any + resource_group_name: str, resource_name: str, command_id: 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "commandId": _SERIALIZER.url("command_id", command_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "commandId": _SERIALIZER.url("command_id", command_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_list_outbound_network_dependencies_endpoints_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + class ManagedClustersOperations: # pylint: disable=too-many-public-methods """ @@ -842,46 +863,39 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def get_os_options( - self, - location: str, - resource_type: Optional[str] = None, - **kwargs: Any + self, location: str, resource_type: Optional[str] = None, **kwargs: Any ) -> _models.OSOptionProfile: """Gets supported OS options in the specified subscription. Gets supported OS options in the specified subscription. - :param location: The name of Azure region. + :param location: The name of Azure region. Required. :type location: str :param resource_type: The resource type for which the OS options needs to be returned. Default value is None. :type resource_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: OSOptionProfile, or the result of cls(response) + :return: OSOptionProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.OSOptionProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OSOptionProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OSOptionProfile] - request = build_get_os_options_request( - subscription_id=self._config.subscription_id, location=location, - api_version=api_version, + subscription_id=self._config.subscription_id, resource_type=resource_type, - template_url=self.get_os_options.metadata['url'], + api_version=api_version, + template_url=self.get_os_options.metadata["url"], headers=_headers, params=_params, ) @@ -889,59 +903,52 @@ def get_os_options( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('OSOptionProfile', pipeline_response) + deserialized = self._deserialize("OSOptionProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_os_options.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default"} # type: ignore - + get_os_options.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default"} # type: ignore @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.ManagedClusterListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.ManagedCluster"]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_02_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_02_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -949,14 +956,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -972,10 +976,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -985,49 +987,42 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> Iterable[_models.ManagedClusterListResult]: + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.ManagedCluster"]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_02_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_02_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -1035,15 +1030,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -1059,10 +1050,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1072,50 +1061,43 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.ManagedClusterUpgradeProfile: """Gets the upgrade profile of a managed cluster. Gets the upgrade profile of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterUpgradeProfile, or the result of cls(response) + :return: ManagedClusterUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.ManagedClusterUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -1123,33 +1105,27 @@ def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterUpgradeProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore @distributed_trace def get_access_profile( - self, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, role_name: str, **kwargs: Any ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. @@ -1159,35 +1135,33 @@ def get_access_profile( `_ . :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param role_name: The name of the role for managed cluster accessProfile resource. + :param role_name: The name of the role for managed cluster accessProfile resource. Required. :type role_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterAccessProfile, or the result of cls(response) + :return: ManagedClusterAccessProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.ManagedClusterAccessProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterAccessProfile] - request = build_get_access_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, role_name=role_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_access_profile.metadata['url'], + template_url=self.get_access_profile.metadata["url"], headers=_headers, params=_params, ) @@ -1195,68 +1169,60 @@ def get_access_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterAccessProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterAccessProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_access_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore - + get_access_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore @distributed_trace def list_cluster_admin_credentials( - self, - resource_group_name: str, - resource_name: str, - server_fqdn: Optional[str] = None, - **kwargs: Any + self, resource_group_name: str, resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any ) -> _models.CredentialResults: """Lists the admin credentials of a managed cluster. Lists the admin credentials of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_admin_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, - template_url=self.list_cluster_admin_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_admin_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -1264,25 +1230,23 @@ def list_cluster_admin_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_admin_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore - + list_cluster_admin_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore @distributed_trace def list_cluster_user_credentials( @@ -1298,40 +1262,39 @@ def list_cluster_user_credentials( Lists the user credentials of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :param format: Only apply to AAD clusters, specifies the format of returned kubeconfig. Format 'azure' will return azure auth-provider kubeconfig; format 'exec' will return exec format - kubeconfig, which requires kubelogin binary in the path. Default value is None. + kubeconfig, which requires kubelogin binary in the path. Known values are: "azure" and "exec". + Default value is None. :type format: str or ~azure.mgmt.containerservice.v2022_02_01.models.Format :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, format=format, - template_url=self.list_cluster_user_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -1339,68 +1302,60 @@ def list_cluster_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore - + list_cluster_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore @distributed_trace def list_cluster_monitoring_user_credentials( - self, - resource_group_name: str, - resource_name: str, - server_fqdn: Optional[str] = None, - **kwargs: Any + self, resource_group_name: str, resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any ) -> _models.CredentialResults: """Lists the cluster monitoring user credentials of a managed cluster. Lists the cluster monitoring user credentials of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_monitoring_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, - template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_monitoring_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -1408,64 +1363,55 @@ def list_cluster_monitoring_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_monitoring_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore - + list_cluster_monitoring_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore @distributed_trace - def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.ManagedCluster: + def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.ManagedCluster: """Gets a managed cluster. Gets a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedCluster, or the result of cls(response) + :return: ManagedCluster or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.ManagedCluster - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -1473,55 +1419,54 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _create_or_update_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.ManagedCluster, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'ManagedCluster') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedCluster") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1529,10 +1474,9 @@ def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -1540,25 +1484,26 @@ def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - - @distributed_trace + @overload def begin_create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedCluster, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. @@ -1566,11 +1511,15 @@ def begin_create_or_update( Creates or updates a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The managed cluster to create or update. + :param parameters: The managed cluster to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_02_01.models.ManagedCluster + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1583,90 +1532,157 @@ def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_02_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._create_or_update_initial( # type: ignore - resource_group_name=resource_group_name, - resource_name=resource_name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop('error_map', None) - def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized + @overload + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + Creates or updates a managed cluster. - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling - if cont_token: + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_02_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster to create or update. Is either a model type or a IO + type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_02_01.models.ManagedCluster or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_02_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ManagedCluster", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _update_tags_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.TagsObject, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request_initial( - subscription_id=self._config.subscription_id, + request = build_update_tags_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_tags_initial.metadata['url'], + content=_content, + template_url=self._update_tags_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1674,32 +1690,32 @@ def _update_tags_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_tags_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _update_tags_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - @distributed_trace + @overload def begin_update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. @@ -1707,11 +1723,88 @@ def begin_update_tags( Updates tags on a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2022_02_01.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_02_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates tags on a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_02_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates tags on a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_02_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1724,20 +1817,17 @@ def begin_update_tags( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_02_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, @@ -1745,64 +1835,54 @@ def begin_update_tags( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1810,10 +1890,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1823,23 +1902,18 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> LROPoller[None]: + def begin_delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> LROPoller[None]: """Deletes a managed cluster. Deletes a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1851,85 +1925,83 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterServicePrincipalProfile, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterServicePrincipalProfile") - request = build_reset_service_principal_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_service_principal_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_service_principal_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_service_principal_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1937,10 +2009,9 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1950,15 +2021,16 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re if cls: return cls(pipeline_response, None, {}) - _reset_service_principal_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + _reset_service_principal_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore - - @distributed_trace - def begin_reset_service_principal_profile( # pylint: disable=inconsistent-return-statements + @overload + def begin_reset_service_principal_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterServicePrincipalProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: """Reset the Service Principal Profile of a managed cluster. @@ -1966,12 +2038,53 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur This action cannot be performed on a cluster that is not using a service principal. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The service principal profile to set on the managed cluster. + :param parameters: The service principal profile to set on the managed cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2022_02_01.models.ManagedClusterServicePrincipalProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reset the Service Principal Profile of a managed cluster. + + This action cannot be performed on a cluster that is not using a service principal. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The service principal profile to set on the managed cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1982,20 +2095,54 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Reset the Service Principal Profile of a managed cluster. + + This action cannot be performed on a cluster that is not using a service principal. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The service principal profile to set on the managed cluster. Is either a + model type or a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2022_02_01.models.ManagedClusterServicePrincipalProfile or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -2003,67 +2150,68 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_service_principal_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + begin_reset_service_principal_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterAADProfile, + parameters: Union[_models.ManagedClusterAADProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterAADProfile") - request = build_reset_aad_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_aad_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_aad_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_aad_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2071,10 +2219,9 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -2084,15 +2231,16 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement if cls: return cls(pipeline_response, None, {}) - _reset_aad_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - + _reset_aad_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - @distributed_trace - def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements + @overload + def begin_reset_aad_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterAADProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: """Reset the AAD Profile of a managed cluster. @@ -2100,11 +2248,89 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements Reset the AAD Profile of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The AAD profile to set on the Managed Cluster. + :param parameters: The AAD profile to set on the Managed Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2022_02_01.models.ManagedClusterAADProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reset the AAD Profile of a managed cluster. + + Reset the AAD Profile of a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The AAD profile to set on the Managed Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterAADProfile, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Reset the AAD Profile of a managed cluster. + + Reset the AAD Profile of a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The AAD profile to set on the Managed Cluster. Is either a model type or a + IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_02_01.models.ManagedClusterAADProfile or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -2115,20 +2341,17 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -2136,62 +2359,52 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_aad_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + begin_reset_aad_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_rotate_cluster_certificates_request_initial( - subscription_id=self._config.subscription_id, + request = build_rotate_cluster_certificates_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._rotate_cluster_certificates_initial.metadata['url'], + template_url=self._rotate_cluster_certificates_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2199,10 +2412,9 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -2212,15 +2424,11 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return if cls: return cls(pipeline_response, None, {}) - _rotate_cluster_certificates_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore - + _rotate_cluster_certificates_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore @distributed_trace - def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + def begin_rotate_cluster_certificates( + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> LROPoller[None]: """Rotates the certificates of a managed cluster. @@ -2228,8 +2436,9 @@ def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-st more details about rotating managed cluster certificates. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -2241,80 +2450,67 @@ def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-st Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._rotate_cluster_certificates_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_rotate_cluster_certificates.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore + begin_rotate_cluster_certificates.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore def _stop_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_stop_request_initial( - subscription_id=self._config.subscription_id, + request = build_stop_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._stop_initial.metadata['url'], + template_url=self._stop_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2322,10 +2518,9 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -2335,16 +2530,10 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore - + _stop_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore @distributed_trace - def begin_stop( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> LROPoller[None]: + def begin_stop(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> LROPoller[None]: """Stops a Managed Cluster. This can only be performed on Azure Virtual Machine Scale set backed clusters. Stopping a @@ -2354,8 +2543,9 @@ def begin_stop( # pylint: disable=inconsistent-return-statements cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -2367,80 +2557,67 @@ def begin_stop( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._stop_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore + begin_stop.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore def _start_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_start_request_initial( - subscription_id=self._config.subscription_id, + request = build_start_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._start_initial.metadata['url'], + template_url=self._start_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2448,10 +2625,9 @@ def _start_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -2461,24 +2637,19 @@ def _start_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore - + _start_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore @distributed_trace - def begin_start( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> LROPoller[None]: + def begin_start(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> LROPoller[None]: """Starts a previously stopped Managed Cluster. See `starting a cluster `_ for more details about starting a cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -2490,85 +2661,83 @@ def begin_start( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._start_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore + begin_start.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore def _run_command_initial( self, resource_group_name: str, resource_name: str, - request_payload: _models.RunCommandRequest, + request_payload: Union[_models.RunCommandRequest, IO], **kwargs: Any ) -> Optional[_models.RunCommandResult]: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RunCommandResult]] - _json = self._serialize.body(request_payload, 'RunCommandRequest') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(request_payload, (IO, bytes)): + _content = request_payload + else: + _json = self._serialize.body(request_payload, "RunCommandRequest") - request = build_run_command_request_initial( - subscription_id=self._config.subscription_id, + request = build_run_command_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._run_command_initial.metadata['url'], + content=_content, + template_url=self._run_command_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2576,10 +2745,9 @@ def _run_command_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -2588,22 +2756,23 @@ def _run_command_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _run_command_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore + _run_command_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore - - @distributed_trace + @overload def begin_run_command( self, resource_group_name: str, resource_name: str, request_payload: _models.RunCommandRequest, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.RunCommandResult]: """Submits a command to run against the Managed Cluster. @@ -2613,11 +2782,15 @@ def begin_run_command( `_. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param request_payload: The run command request. + :param request_payload: The run command request. Required. :type request_payload: ~azure.mgmt.containerservice.v2022_02_01.models.RunCommandRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -2630,20 +2803,97 @@ def begin_run_command( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_02_01.models.RunCommandResult] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_run_command( + self, + resource_group_name: str, + resource_name: str, + request_payload: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RunCommandResult]: + """Submits a command to run against the Managed Cluster. + + AKS will create a pod to run the command. This is primarily useful for private clusters. For + more information see `AKS Run Command + `_. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param request_payload: The run command request. Required. + :type request_payload: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either RunCommandResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_02_01.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_run_command( + self, + resource_group_name: str, + resource_name: str, + request_payload: Union[_models.RunCommandRequest, IO], + **kwargs: Any + ) -> LROPoller[_models.RunCommandResult]: + """Submits a command to run against the Managed Cluster. + + AKS will create a pod to run the command. This is primarily useful for private clusters. For + more information see `AKS Run Command + `_. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param request_payload: The run command request. Is either a model type or a IO type. Required. + :type request_payload: ~azure.mgmt.containerservice.v2022_02_01.models.RunCommandRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either RunCommandResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_02_01.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.RunCommandResult] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.RunCommandResult] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._run_command_initial( # type: ignore resource_group_name=resource_group_name, @@ -2651,82 +2901,72 @@ def begin_run_command( request_payload=request_payload, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_run_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore + begin_run_command.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore @distributed_trace def get_command_result( - self, - resource_group_name: str, - resource_name: str, - command_id: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, command_id: str, **kwargs: Any ) -> Optional[_models.RunCommandResult]: """Gets the results of a command which has been run on the Managed Cluster. Gets the results of a command which has been run on the Managed Cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param command_id: Id of the command. + :param command_id: Id of the command. Required. :type command_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: RunCommandResult, or the result of cls(response) + :return: RunCommandResult or None or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.RunCommandResult or None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RunCommandResult]] - request = build_get_command_result_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, command_id=command_id, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_command_result.metadata['url'], + template_url=self.get_command_result.metadata["url"], headers=_headers, params=_params, ) @@ -2734,10 +2974,9 @@ def get_command_result( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -2746,23 +2985,19 @@ def get_command_result( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_command_result.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}"} # type: ignore - + get_command_result.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}"} # type: ignore @distributed_trace def list_outbound_network_dependencies_endpoints( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> Iterable[_models.OutboundEnvironmentEndpointCollection]: + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> Iterable["_models.OutboundEnvironmentEndpoint"]: """Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster. @@ -2770,35 +3005,35 @@ def list_outbound_network_dependencies_endpoints( specified managed cluster. The operation returns properties of each egress endpoint. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OutboundEnvironmentEndpointCollection or the - result of cls(response) + :return: An iterator like instance of either OutboundEnvironmentEndpoint or the result of + cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_02_01.models.OutboundEnvironmentEndpointCollection] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_02_01.models.OutboundEnvironmentEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_outbound_network_dependencies_endpoints_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_outbound_network_dependencies_endpoints.metadata['url'], + template_url=self.list_outbound_network_dependencies_endpoints.metadata["url"], headers=_headers, params=_params, ) @@ -2806,16 +3041,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_outbound_network_dependencies_endpoints_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -2831,10 +3061,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2844,8 +3072,6 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_outbound_network_dependencies_endpoints.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints"} # type: ignore + list_outbound_network_dependencies_endpoints.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/operations/_operations.py index e877fb4797ba..cb2d978d70c3 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/operations/_operations.py @@ -7,10 +7,15 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,38 +25,34 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - **kwargs: Any -) -> HttpRequest: + +def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.ContainerService/operations") # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class Operations: """ @@ -72,38 +73,33 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.OperationListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.OperationValue"]: """Gets a list of operations. Gets a list of operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationListResult or the result of cls(response) + :return: An iterator like instance of either OperationValue or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_02_01.models.OperationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_02_01.models.OperationValue] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -111,13 +107,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -133,10 +127,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -146,8 +138,6 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.ContainerService/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ContainerService/operations"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/operations/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/operations/_private_endpoint_connections_operations.py index 6e9668571059..9aec38b0e548 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/operations/_private_endpoint_connections_operations.py @@ -6,11 +6,15 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod @@ -21,173 +25,199 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - subscription_id: str, resource_group_name: str, resource_name: str, private_endpoint_connection_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_update_request( - subscription_id: str, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, - *, - json: Optional[_models.PrivateEndpointConnection] = None, - content: Any = None, + subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request_initial( - subscription_id: str, +def build_delete_request( resource_group_name: str, resource_name: str, private_endpoint_connection_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class PrivateEndpointConnectionsOperations: """ @@ -208,13 +238,9 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnectionListResult: """Gets a list of private endpoint connections in the specified managed cluster. @@ -222,32 +248,30 @@ def list( https://docs.microsoft.com/azure/aks/private-clusters. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnectionListResult, or the result of cls(response) + :return: PrivateEndpointConnectionListResult or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.PrivateEndpointConnectionListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnectionListResult] - request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -255,33 +279,27 @@ def list( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore - + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore @distributed_trace def get( - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnection: """Gets the specified private endpoint connection. @@ -289,35 +307,33 @@ def get( https://docs.microsoft.com/azure/aks/private-clusters. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -325,33 +341,33 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - @distributed_trace + @overload def update( self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, parameters: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateEndpointConnection: """Updates a private endpoint connection. @@ -359,41 +375,116 @@ def update( Updates a private endpoint connection. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str - :param parameters: The updated private endpoint connection. + :param parameters: The updated private endpoint connection. Required. :type parameters: ~azure.mgmt.containerservice.v2022_02_01.models.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: The updated private endpoint connection. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @distributed_trace + def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: Union[_models.PrivateEndpointConnection, IO], + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: The updated private endpoint connection. Is either a model type or a IO + type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_02_01.models.PrivateEndpointConnection or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - _json = self._serialize.body(parameters, 'PrivateEndpointConnection') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateEndpointConnection") request = build_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update.metadata['url'], + content=_content, + template_url=self.update.metadata["url"], headers=_headers, params=_params, ) @@ -401,52 +492,43 @@ def update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -454,10 +536,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -467,26 +548,22 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + def begin_delete( + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> LROPoller[None]: """Deletes a private endpoint connection. Deletes a private endpoint connection. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -498,53 +575,46 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/operations/_private_link_resources_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/operations/_private_link_resources_operations.py index 9848dc3a74ad..c7e7301a85ad 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/operations/_private_link_resources_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/operations/_private_link_resources_operations.py @@ -8,9 +8,13 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -19,48 +23,55 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class PrivateLinkResourcesOperations: """ @@ -81,13 +92,9 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.PrivateLinkResourcesListResult: """Gets a list of private link resources in the specified managed cluster. @@ -95,32 +102,30 @@ def list( https://docs.microsoft.com/azure/aks/private-clusters. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResourcesListResult, or the result of cls(response) + :return: PrivateLinkResourcesListResult or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.PrivateLinkResourcesListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResourcesListResult] - request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -128,22 +133,20 @@ def list( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResourcesListResult', pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources"} # type: ignore - + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/operations/_resolve_private_link_service_id_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/operations/_resolve_private_link_service_id_operations.py index 29b2f4ce75ad..47e6b86d8686 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/operations/_resolve_private_link_service_id_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/operations/_resolve_private_link_service_id_operations.py @@ -6,11 +6,15 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -19,56 +23,58 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_post_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.PrivateLinkResource] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + class ResolvePrivateLinkServiceIdOperations: """ @@ -89,13 +95,14 @@ def __init__(self, *args, **kwargs): 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 + @overload def post( self, resource_group_name: str, resource_name: str, parameters: _models.PrivateLinkResource, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateLinkResource: """Gets the private link service ID for the specified managed cluster. @@ -103,38 +110,106 @@ def post( Gets the private link service ID for the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters required in order to resolve a private link service ID. + :param parameters: Parameters required in order to resolve a private link service ID. Required. :type parameters: ~azure.mgmt.containerservice.v2022_02_01.models.PrivateLinkResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResource, or the result of cls(response) + :return: PrivateLinkResource or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.PrivateLinkResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + def post( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID for the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters required in order to resolve a private link service ID. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def post( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.PrivateLinkResource, IO], + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID for the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters required in order to resolve a private link service ID. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_02_01.models.PrivateLinkResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResource] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResource] - _json = self._serialize.body(parameters, 'PrivateLinkResource') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateLinkResource") request = build_post_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.post.metadata['url'], + content=_content, + template_url=self.post.metadata["url"], headers=_headers, params=_params, ) @@ -142,22 +217,20 @@ def post( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResource', pipeline_response) + deserialized = self._deserialize("PrivateLinkResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - post.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId"} # type: ignore - + post.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/operations/_snapshots_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/operations/_snapshots_operations.py index eeb59418f064..f108cf85cc15 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/operations/_snapshots_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/operations/_snapshots_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,243 +25,233 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots") path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_resource_group_request( - subscription_id: str, - resource_group_name: str, - **kwargs: Any -) -> HttpRequest: +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: + _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, resource_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.Snapshot] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_update_tags_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.TagsObject] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class SnapshotsOperations: """ @@ -277,39 +272,33 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.SnapshotListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.Snapshot"]: """Gets a list of snapshots in the specified subscription. Gets a list of snapshots in the specified subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SnapshotListResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_02_01.models.SnapshotListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either Snapshot or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_02_01.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SnapshotListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -317,14 +306,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -340,10 +326,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -353,48 +337,41 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots"} # type: ignore @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> Iterable[_models.SnapshotListResult]: + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Snapshot"]: """Lists snapshots in the specified subscription and resource group. Lists snapshots in the specified subscription and resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SnapshotListResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_02_01.models.SnapshotListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either Snapshot or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_02_01.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SnapshotListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -402,15 +379,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -426,10 +399,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -439,50 +410,41 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots"} # type: ignore @distributed_trace - def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.Snapshot: + def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.Snapshot: """Gets a snapshot. Gets a snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Snapshot, or the result of cls(response) + :return: Snapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.Snapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -490,32 +452,32 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - - @distributed_trace + @overload def create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.Snapshot, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.Snapshot: """Creates or updates a snapshot. @@ -523,38 +485,102 @@ def create_or_update( Creates or updates a snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The snapshot to create or update. + :param parameters: The snapshot to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_02_01.models.Snapshot + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Snapshot, or the result of cls(response) + :return: Snapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.Snapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Snapshot: + """Creates or updates a snapshot. + + Creates or updates a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The snapshot to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.Snapshot, IO], **kwargs: Any + ) -> _models.Snapshot: + """Creates or updates a snapshot. + + Creates or updates a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The snapshot to create or update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.mgmt.containerservice.v2022_02_01.models.Snapshot or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] - _json = self._serialize.body(parameters, 'Snapshot') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "Snapshot") request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) @@ -562,10 +588,9 @@ def create_or_update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -573,25 +598,26 @@ def create_or_update( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - - @distributed_trace + @overload def update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.Snapshot: """Updates tags on a snapshot. @@ -599,38 +625,102 @@ def update_tags( Updates tags on a snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update snapshot Tags operation. + :param parameters: Parameters supplied to the Update snapshot Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2022_02_01.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Snapshot, or the result of cls(response) + :return: Snapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.Snapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + def update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Snapshot: + """Updates tags on a snapshot. + + Updates tags on a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update snapshot Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> _models.Snapshot: + """Updates tags on a snapshot. + + Updates tags on a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update snapshot Tags operation. Is either a model + type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_02_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") request = build_update_tags_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_tags.metadata['url'], + content=_content, + template_url=self.update_tags.metadata["url"], headers=_headers, params=_params, ) @@ -638,64 +728,57 @@ def update_tags( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - + update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore @distributed_trace def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: """Deletes a snapshot. Deletes a snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) @@ -703,10 +786,9 @@ def delete( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -716,5 +798,4 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - + delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/__init__.py index 37a5f9e02e6f..a8716d29afe8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/__init__.py @@ -14,7 +14,8 @@ except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['ContainerServiceClient'] + +__all__ = ["ContainerServiceClient"] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/_configuration.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/_configuration.py index dcaf0dfc57b6..7c20974867de 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/_configuration.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/_configuration.py @@ -18,29 +18,25 @@ VERSION = "unknown" + class ContainerServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ContainerServiceClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :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. + :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2022-02-02-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: + def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ContainerServiceClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + api_version = kwargs.pop("api_version", "2022-02-02-preview") # type: str if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -50,23 +46,24 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-containerservice/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-containerservice/{}".format(VERSION)) self._configure(**kwargs) def _configure( - self, - **kwargs # type: Any + self, **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/_container_service_client.py index 2eb0b6d81cda..cd8a9a425113 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/_container_service_client.py @@ -9,20 +9,30 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from . import models +from .._serialization import Deserializer, Serializer from ._configuration import ContainerServiceClientConfiguration -from .operations import AgentPoolsOperations, MaintenanceConfigurationsOperations, ManagedClusterSnapshotsOperations, ManagedClustersOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, ResolvePrivateLinkServiceIdOperations, SnapshotsOperations +from .operations import ( + AgentPoolsOperations, + MaintenanceConfigurationsOperations, + ManagedClusterSnapshotsOperations, + ManagedClustersOperations, + Operations, + PrivateEndpointConnectionsOperations, + PrivateLinkResourcesOperations, + ResolvePrivateLinkServiceIdOperations, + SnapshotsOperations, +) if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class ContainerServiceClient: # pylint: disable=too-many-instance-attributes + +class ContainerServiceClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """The Container Service Client. :ivar operations: Operations operations @@ -51,9 +61,9 @@ class ContainerServiceClient: # pylint: disable=too-many-instance-attributes :ivar managed_cluster_snapshots: ManagedClusterSnapshotsOperations operations :vartype managed_cluster_snapshots: azure.mgmt.containerservice.v2022_02_02_preview.operations.ManagedClusterSnapshotsOperations - :param credential: Credential needed for the client to connect to Azure. + :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. + :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -71,25 +81,23 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = ContainerServiceClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = ContainerServiceClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize - ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.managed_clusters = ManagedClustersOperations( self._client, self._config, self._serialize, self._deserialize ) self.maintenance_configurations = MaintenanceConfigurationsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.agent_pools = AgentPoolsOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) self.private_endpoint_connections = PrivateEndpointConnectionsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -99,19 +107,12 @@ def __init__( self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations( self._client, self._config, self._serialize, self._deserialize ) - self.snapshots = SnapshotsOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.snapshots = SnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) self.managed_cluster_snapshots = ManagedClusterSnapshotsOperations( self._client, self._config, self._serialize, self._deserialize ) - - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> HttpResponse: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -120,7 +121,7 @@ def _send_request( >>> response = client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/_metadata.json b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/_metadata.json index 67e52bb324ab..1863135ace58 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/_metadata.json +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/_metadata.json @@ -10,20 +10,20 @@ "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { "credential": { - "signature": "credential, # type: \"TokenCredential\"", - "description": "Credential needed for the client to connect to Azure.", + "signature": "credential: \"TokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true }, "subscription_id": { - "signature": "subscription_id, # type: str", - "description": "The ID of the target subscription.", + "signature": "subscription_id: str,", + "description": "The ID of the target subscription. Required.", "docstring_type": "str", "required": true } @@ -31,13 +31,13 @@ "async": { "credential": { "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure.", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { "signature": "subscription_id: str,", - "description": "The ID of the target subscription.", + "description": "The ID of the target subscription. Required.", "docstring_type": "str", "required": true } @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=\"https://management.azure.com\", # type: str", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/_patch.py index 74e48ecd07cf..f99e77fef986 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/_patch.py @@ -28,4 +28,4 @@ # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + pass diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/_vendor.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/_vendor.py index 138f663c53a4..9aad73fc743e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/_vendor.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/_vendor.py @@ -7,6 +7,7 @@ from azure.core.pipeline.transport import HttpRequest + def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) @@ -14,6 +15,7 @@ def _convert_request(request, files=None): request.set_formdata_body(files) return request + def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -21,7 +23,5 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [ - c for c in formatted_components if "{}".format(key.args[0]) not in c - ] + components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/__init__.py index 37a5f9e02e6f..a8716d29afe8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/__init__.py @@ -14,7 +14,8 @@ except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['ContainerServiceClient'] + +__all__ = ["ContainerServiceClient"] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/_configuration.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/_configuration.py index 716df555d1e8..f451fbf5fc75 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/_configuration.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/_configuration.py @@ -18,29 +18,25 @@ VERSION = "unknown" + class ContainerServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ContainerServiceClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :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. + :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2022-02-02-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: + def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ContainerServiceClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + api_version = kwargs.pop("api_version", "2022-02-02-preview") # type: str if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -50,22 +46,21 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-containerservice/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-containerservice/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, - **kwargs: Any - ) -> None: - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/_container_service_client.py index 87f65111688d..9a3c7b42a34e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/_container_service_client.py @@ -9,20 +9,30 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from .. import models +from ..._serialization import Deserializer, Serializer from ._configuration import ContainerServiceClientConfiguration -from .operations import AgentPoolsOperations, MaintenanceConfigurationsOperations, ManagedClusterSnapshotsOperations, ManagedClustersOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, ResolvePrivateLinkServiceIdOperations, SnapshotsOperations +from .operations import ( + AgentPoolsOperations, + MaintenanceConfigurationsOperations, + ManagedClusterSnapshotsOperations, + ManagedClustersOperations, + Operations, + PrivateEndpointConnectionsOperations, + PrivateLinkResourcesOperations, + ResolvePrivateLinkServiceIdOperations, + SnapshotsOperations, +) if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class ContainerServiceClient: # pylint: disable=too-many-instance-attributes + +class ContainerServiceClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """The Container Service Client. :ivar operations: Operations operations @@ -51,9 +61,9 @@ class ContainerServiceClient: # pylint: disable=too-many-instance-attributes :ivar managed_cluster_snapshots: ManagedClusterSnapshotsOperations operations :vartype managed_cluster_snapshots: azure.mgmt.containerservice.v2022_02_02_preview.aio.operations.ManagedClusterSnapshotsOperations - :param credential: Credential needed for the client to connect to Azure. + :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. + :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -71,25 +81,23 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = ContainerServiceClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = ContainerServiceClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize - ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.managed_clusters = ManagedClustersOperations( self._client, self._config, self._serialize, self._deserialize ) self.maintenance_configurations = MaintenanceConfigurationsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.agent_pools = AgentPoolsOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) self.private_endpoint_connections = PrivateEndpointConnectionsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -99,19 +107,12 @@ def __init__( self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations( self._client, self._config, self._serialize, self._deserialize ) - self.snapshots = SnapshotsOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.snapshots = SnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) self.managed_cluster_snapshots = ManagedClusterSnapshotsOperations( self._client, self._config, self._serialize, self._deserialize ) - - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -120,7 +121,7 @@ def _send_request( >>> response = await client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/_patch.py index 74e48ecd07cf..f99e77fef986 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/_patch.py @@ -28,4 +28,4 @@ # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + pass diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/operations/__init__.py index d3b41c8a72b0..02682f76ce58 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/operations/__init__.py @@ -19,16 +19,17 @@ from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'Operations', - 'ManagedClustersOperations', - 'MaintenanceConfigurationsOperations', - 'AgentPoolsOperations', - 'PrivateEndpointConnectionsOperations', - 'PrivateLinkResourcesOperations', - 'ResolvePrivateLinkServiceIdOperations', - 'SnapshotsOperations', - 'ManagedClusterSnapshotsOperations', + "Operations", + "ManagedClustersOperations", + "MaintenanceConfigurationsOperations", + "AgentPoolsOperations", + "PrivateEndpointConnectionsOperations", + "PrivateLinkResourcesOperations", + "ResolvePrivateLinkServiceIdOperations", + "SnapshotsOperations", + "ManagedClusterSnapshotsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/operations/_agent_pools_operations.py index 8f5df18c0bff..38b7b15452dc 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/operations/_agent_pools_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +29,20 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._agent_pools_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_available_agent_pool_versions_request, build_get_request, build_get_upgrade_profile_request, build_list_request, build_upgrade_node_image_version_request_initial -T = TypeVar('T') +from ...operations._agent_pools_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_available_agent_pool_versions_request, + build_get_request, + build_get_upgrade_profile_request, + build_list_request, + build_upgrade_node_image_version_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class AgentPoolsOperations: """ .. warning:: @@ -45,47 +62,41 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.AgentPoolListResult]: + def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncIterable["_models.AgentPool"]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AgentPoolListResult or the result of cls(response) + :return: An iterator like instance of either AgentPool or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_02_02_preview.models.AgentPoolListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_02_02_preview.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -93,16 +104,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -118,10 +124,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -131,54 +135,46 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore @distributed_trace_async async def get( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPool: """Gets the specified managed cluster agent pool. Gets the specified managed cluster agent pool. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPool, or the result of cls(response) + :return: AgentPool or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.AgentPool - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -186,57 +182,60 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore async def _create_or_update_initial( self, resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: _models.AgentPool, + parameters: Union[_models.AgentPool, IO], **kwargs: Any ) -> _models.AgentPool: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - _json = self._serialize.body(parameters, 'AgentPool') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "AgentPool") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -244,10 +243,9 @@ async def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -255,26 +253,27 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - - @distributed_trace_async + @overload async def begin_create_or_update( self, resource_group_name: str, resource_name: str, agent_pool_name: str, parameters: _models.AgentPool, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.AgentPool]: """Creates or updates an agent pool in the specified managed cluster. @@ -282,13 +281,59 @@ async def begin_create_or_update( Creates or updates an agent pool in the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str - :param parameters: The agent pool to create or update. + :param parameters: The agent pool to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_02_02_preview.models.AgentPool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AgentPool or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_02_02_preview.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AgentPool]: + """Creates or updates an agent pool in the specified managed cluster. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: The agent pool to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -301,20 +346,58 @@ async def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_02_02_preview.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: Union[_models.AgentPool, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.AgentPool]: + """Creates or updates an agent pool in the specified managed cluster. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: The agent pool to create or update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.mgmt.containerservice.v2022_02_02_preview.models.AgentPool or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AgentPool or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_02_02_preview.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -323,66 +406,55 @@ async def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -390,10 +462,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -403,26 +474,22 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + async def begin_delete( + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes an agent pool in the specified managed cluster. Deletes an agent pool in the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -434,99 +501,86 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace_async async def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPoolUpgradeProfile: """Gets the upgrade profile for an agent pool. Gets the upgrade profile for an agent pool. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolUpgradeProfile, or the result of cls(response) + :return: AgentPoolUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.AgentPoolUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -534,32 +588,27 @@ async def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolUpgradeProfile', pipeline_response) + deserialized = self._deserialize("AgentPoolUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore @distributed_trace_async async def get_available_agent_pool_versions( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported Kubernetes versions for the specified agent pool. @@ -568,32 +617,30 @@ async def get_available_agent_pool_versions( the version lifecycle. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolAvailableVersions, or the result of cls(response) + :return: AgentPoolAvailableVersions or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.AgentPoolAvailableVersions - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolAvailableVersions] - request = build_get_available_agent_pool_versions_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_available_agent_pool_versions.metadata['url'], + template_url=self.get_available_agent_pool_versions.metadata["url"], headers=_headers, params=_params, ) @@ -601,52 +648,43 @@ async def get_available_agent_pool_versions( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolAvailableVersions', pipeline_response) + deserialized = self._deserialize("AgentPoolAvailableVersions", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_available_agent_pool_versions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore - + get_available_agent_pool_versions.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore async def _upgrade_node_image_version_initial( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> Optional[_models.AgentPool]: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.AgentPool]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.AgentPool]] - - request = build_upgrade_node_image_version_request_initial( - subscription_id=self._config.subscription_id, + request = build_upgrade_node_image_version_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._upgrade_node_image_version_initial.metadata['url'], + template_url=self._upgrade_node_image_version_initial.metadata["url"], headers=_headers, params=_params, ) @@ -654,10 +692,9 @@ async def _upgrade_node_image_version_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -667,26 +704,23 @@ async def _upgrade_node_image_version_initial( deserialized = None response_headers = {} if response.status_code == 202: - response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) - - deserialized = self._deserialize('AgentPool', pipeline_response) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _upgrade_node_image_version_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore - + _upgrade_node_image_version_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore @distributed_trace_async async def begin_upgrade_node_image_version( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any - ) -> AsyncLROPoller[_models.AgentPool]: + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: """Upgrades the node image version of an agent pool to the latest. Upgrading the node image version of an agent pool applies the newest OS and runtime updates to @@ -694,10 +728,11 @@ async def begin_upgrade_node_image_version( node image versions, see: https://docs.microsoft.com/azure/aks/node-image-upgrade. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -711,59 +746,54 @@ async def begin_upgrade_node_image_version( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_02_02_preview.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._upgrade_node_image_version_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) - - deserialized = self._deserialize('AgentPool', pipeline_response) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_upgrade_node_image_version.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore + begin_upgrade_node_image_version.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/operations/_maintenance_configurations_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/operations/_maintenance_configurations_operations.py index 2918677ea9a2..0bfe50bf20bc 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/operations/_maintenance_configurations_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/operations/_maintenance_configurations_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,10 +27,17 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._maintenance_configurations_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_managed_cluster_request -T = TypeVar('T') +from ...operations._maintenance_configurations_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_managed_cluster_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class MaintenanceConfigurationsOperations: """ .. warning:: @@ -43,48 +57,44 @@ def __init__(self, *args, **kwargs) -> None: 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_managed_cluster( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.MaintenanceConfigurationListResult]: + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> AsyncIterable["_models.MaintenanceConfiguration"]: """Gets a list of maintenance configurations in the specified managed cluster. Gets a list of maintenance configurations in the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either MaintenanceConfigurationListResult or the result - of cls(response) + :return: An iterator like instance of either MaintenanceConfiguration or the result of + cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_02_02_preview.models.MaintenanceConfigurationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_02_02_preview.models.MaintenanceConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfigurationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfigurationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_managed_cluster_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_managed_cluster.metadata['url'], + template_url=self.list_by_managed_cluster.metadata["url"], headers=_headers, params=_params, ) @@ -92,16 +102,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_managed_cluster_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -117,10 +122,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -130,54 +133,46 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_managed_cluster.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations"} # type: ignore + list_by_managed_cluster.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations"} # type: ignore @distributed_trace_async async def get( - self, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, config_name: str, **kwargs: Any ) -> _models.MaintenanceConfiguration: """Gets the specified maintenance configuration of a managed cluster. Gets the specified maintenance configuration of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: MaintenanceConfiguration, or the result of cls(response) + :return: MaintenanceConfiguration or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.MaintenanceConfiguration - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfiguration] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -185,33 +180,33 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) + deserialized = self._deserialize("MaintenanceConfiguration", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - @distributed_trace_async + @overload async def create_or_update( self, resource_group_name: str, resource_name: str, config_name: str, parameters: _models.MaintenanceConfiguration, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.MaintenanceConfiguration: """Creates or updates a maintenance configuration in the specified managed cluster. @@ -219,42 +214,117 @@ async def create_or_update( Creates or updates a maintenance configuration in the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str - :param parameters: The maintenance configuration to create or update. + :param parameters: The maintenance configuration to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_02_02_preview.models.MaintenanceConfiguration + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configuration in the specified managed cluster. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: The maintenance configuration to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: MaintenanceConfiguration, or the result of cls(response) + :return: MaintenanceConfiguration or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.MaintenanceConfiguration - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: Union[_models.MaintenanceConfiguration, IO], + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configuration in the specified managed cluster. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: The maintenance configuration to create or update. Is either a model type or + a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2022_02_02_preview.models.MaintenanceConfiguration or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfiguration] - _json = self._serialize.body(parameters, 'MaintenanceConfiguration') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "MaintenanceConfiguration") request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) @@ -262,68 +332,60 @@ async def create_or_update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) + deserialized = self._deserialize("MaintenanceConfiguration", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, config_name: str, **kwargs: Any ) -> None: """Deletes a maintenance configuration. Deletes a maintenance configuration. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) @@ -331,10 +393,9 @@ async def delete( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -344,5 +405,4 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/operations/_managed_cluster_snapshots_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/operations/_managed_cluster_snapshots_operations.py index 6b05185e6313..5ae5e89e7b17 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/operations/_managed_cluster_snapshots_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/operations/_managed_cluster_snapshots_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,10 +27,19 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._managed_cluster_snapshots_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_resource_group_request, build_list_request, build_update_tags_request -T = TypeVar('T') +from ...operations._managed_cluster_snapshots_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_resource_group_request, + build_list_request, + build_update_tags_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class ManagedClusterSnapshotsOperations: """ .. warning:: @@ -43,40 +59,35 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.ManagedClusterSnapshotListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.ManagedClusterSnapshot"]: """Gets a list of managed cluster snapshots in the specified subscription. Gets a list of managed cluster snapshots in the specified subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterSnapshotListResult or the result of + :return: An iterator like instance of either ManagedClusterSnapshot or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedClusterSnapshotListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedClusterSnapshot] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshotListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterSnapshotListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -84,14 +95,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -107,10 +115,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -120,49 +126,45 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedclustersnapshots"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedclustersnapshots"} # type: ignore @distributed_trace def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.ManagedClusterSnapshotListResult]: + self, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ManagedClusterSnapshot"]: """Lists managed cluster snapshots in the specified subscription and resource group. Lists managed cluster snapshots in the specified subscription and resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterSnapshotListResult or the result of + :return: An iterator like instance of either ManagedClusterSnapshot or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedClusterSnapshotListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedClusterSnapshot] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshotListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterSnapshotListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -170,15 +172,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -194,10 +192,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -207,50 +203,41 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots"} # type: ignore @distributed_trace_async - async def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.ManagedClusterSnapshot: + async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.ManagedClusterSnapshot: """Gets a managed cluster snapshot. Gets a managed cluster snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterSnapshot, or the result of cls(response) + :return: ManagedClusterSnapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedClusterSnapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterSnapshot] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -258,32 +245,32 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterSnapshot', pipeline_response) + deserialized = self._deserialize("ManagedClusterSnapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"} # type: ignore - @distributed_trace_async + @overload async def create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterSnapshot, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.ManagedClusterSnapshot: """Creates or updates a managed cluster snapshot. @@ -291,39 +278,108 @@ async def create_or_update( Creates or updates a managed cluster snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The managed cluster snapshot to create or update. + :param parameters: The managed cluster snapshot to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedClusterSnapshot + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedClusterSnapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedClusterSnapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ManagedClusterSnapshot: + """Creates or updates a managed cluster snapshot. + + Creates or updates a managed cluster snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster snapshot to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedClusterSnapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedClusterSnapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterSnapshot, IO], + **kwargs: Any + ) -> _models.ManagedClusterSnapshot: + """Creates or updates a managed cluster snapshot. + + Creates or updates a managed cluster snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster snapshot to create or update. Is either a model type or + a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedClusterSnapshot or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterSnapshot, or the result of cls(response) + :return: ManagedClusterSnapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedClusterSnapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterSnapshot] - _json = self._serialize.body(parameters, 'ManagedClusterSnapshot') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterSnapshot") request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) @@ -331,10 +387,9 @@ async def create_or_update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -342,25 +397,26 @@ async def create_or_update( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ManagedClusterSnapshot', pipeline_response) + deserialized = self._deserialize("ManagedClusterSnapshot", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('ManagedClusterSnapshot', pipeline_response) + deserialized = self._deserialize("ManagedClusterSnapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"} # type: ignore - + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"} # type: ignore - @distributed_trace_async + @overload async def update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.ManagedClusterSnapshot: """Updates tags on a managed cluster snapshot. @@ -368,38 +424,104 @@ async def update_tags( Updates tags on a managed cluster snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Update managed cluster snapshot Tags operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2022_02_02_preview.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedClusterSnapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedClusterSnapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ManagedClusterSnapshot: + """Updates tags on a managed cluster snapshot. + + Updates tags on a managed cluster snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update managed cluster snapshot Tags operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterSnapshot, or the result of cls(response) + :return: ManagedClusterSnapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedClusterSnapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @distributed_trace_async + async def update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> _models.ManagedClusterSnapshot: + """Updates tags on a managed cluster snapshot. + + Updates tags on a managed cluster snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update managed cluster snapshot Tags operation. + Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_02_02_preview.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedClusterSnapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedClusterSnapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterSnapshot] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") request = build_update_tags_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_tags.metadata['url'], + content=_content, + template_url=self.update_tags.metadata["url"], headers=_headers, params=_params, ) @@ -407,64 +529,57 @@ async def update_tags( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterSnapshot', pipeline_response) + deserialized = self._deserialize("ManagedClusterSnapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"} # type: ignore - + update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"} # type: ignore @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: """Deletes a managed cluster snapshot. Deletes a managed cluster snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) @@ -472,10 +587,9 @@ async def delete( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -485,5 +599,4 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"} # type: ignore - + delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/operations/_managed_clusters_operations.py index 12808f72985a..5cc5af382486 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/operations/_managed_clusters_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +29,33 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._managed_clusters_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_access_profile_request, build_get_command_result_request, build_get_os_options_request, build_get_request, build_get_upgrade_profile_request, build_list_by_resource_group_request, build_list_cluster_admin_credentials_request, build_list_cluster_monitoring_user_credentials_request, build_list_cluster_user_credentials_request, build_list_outbound_network_dependencies_endpoints_request, build_list_request, build_reset_aad_profile_request_initial, build_reset_service_principal_profile_request_initial, build_rotate_cluster_certificates_request_initial, build_run_command_request_initial, build_start_request_initial, build_stop_request_initial, build_update_tags_request_initial -T = TypeVar('T') +from ...operations._managed_clusters_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_access_profile_request, + build_get_command_result_request, + build_get_os_options_request, + build_get_request, + build_get_upgrade_profile_request, + build_list_by_resource_group_request, + build_list_cluster_admin_credentials_request, + build_list_cluster_monitoring_user_credentials_request, + build_list_cluster_user_credentials_request, + build_list_outbound_network_dependencies_endpoints_request, + build_list_request, + build_reset_aad_profile_request, + build_reset_service_principal_profile_request, + build_rotate_cluster_certificates_request, + build_run_command_request, + build_start_request, + build_stop_request, + build_update_tags_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class ManagedClustersOperations: # pylint: disable=too-many-public-methods """ .. warning:: @@ -45,46 +75,39 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async async def get_os_options( - self, - location: str, - resource_type: Optional[str] = None, - **kwargs: Any + self, location: str, resource_type: Optional[str] = None, **kwargs: Any ) -> _models.OSOptionProfile: """Gets supported OS options in the specified subscription. Gets supported OS options in the specified subscription. - :param location: The name of Azure region. + :param location: The name of Azure region. Required. :type location: str :param resource_type: The resource type for which the OS options needs to be returned. Default value is None. :type resource_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: OSOptionProfile, or the result of cls(response) + :return: OSOptionProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.OSOptionProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OSOptionProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OSOptionProfile] - request = build_get_os_options_request( - subscription_id=self._config.subscription_id, location=location, - api_version=api_version, + subscription_id=self._config.subscription_id, resource_type=resource_type, - template_url=self.get_os_options.metadata['url'], + api_version=api_version, + template_url=self.get_os_options.metadata["url"], headers=_headers, params=_params, ) @@ -92,59 +115,52 @@ async def get_os_options( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('OSOptionProfile', pipeline_response) + deserialized = self._deserialize("OSOptionProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_os_options.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default"} # type: ignore - + get_os_options.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default"} # type: ignore @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.ManagedClusterListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.ManagedCluster"]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -152,14 +168,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -175,10 +188,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -188,49 +199,44 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.ManagedClusterListResult]: + self, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ManagedCluster"]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -238,15 +244,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -262,10 +264,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -275,50 +275,43 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace_async async def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.ManagedClusterUpgradeProfile: """Gets the upgrade profile of a managed cluster. Gets the upgrade profile of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterUpgradeProfile, or the result of cls(response) + :return: ManagedClusterUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedClusterUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -326,33 +319,27 @@ async def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterUpgradeProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore @distributed_trace_async async def get_access_profile( - self, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, role_name: str, **kwargs: Any ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. @@ -362,35 +349,33 @@ async def get_access_profile( `_ . :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param role_name: The name of the role for managed cluster accessProfile resource. + :param role_name: The name of the role for managed cluster accessProfile resource. Required. :type role_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterAccessProfile, or the result of cls(response) + :return: ManagedClusterAccessProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedClusterAccessProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterAccessProfile] - request = build_get_access_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, role_name=role_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_access_profile.metadata['url'], + template_url=self.get_access_profile.metadata["url"], headers=_headers, params=_params, ) @@ -398,68 +383,60 @@ async def get_access_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterAccessProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterAccessProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_access_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore - + get_access_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore @distributed_trace_async async def list_cluster_admin_credentials( - self, - resource_group_name: str, - resource_name: str, - server_fqdn: Optional[str] = None, - **kwargs: Any + self, resource_group_name: str, resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any ) -> _models.CredentialResults: """Lists the admin credentials of a managed cluster. Lists the admin credentials of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_admin_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, - template_url=self.list_cluster_admin_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_admin_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -467,25 +444,23 @@ async def list_cluster_admin_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_admin_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore - + list_cluster_admin_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore @distributed_trace_async async def list_cluster_user_credentials( @@ -501,40 +476,39 @@ async def list_cluster_user_credentials( Lists the user credentials of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :param format: Only apply to AAD clusters, specifies the format of returned kubeconfig. Format 'azure' will return azure auth-provider kubeconfig; format 'exec' will return exec format - kubeconfig, which requires kubelogin binary in the path. Default value is None. + kubeconfig, which requires kubelogin binary in the path. Known values are: "azure" and "exec". + Default value is None. :type format: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.Format :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, format=format, - template_url=self.list_cluster_user_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -542,68 +516,60 @@ async def list_cluster_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore - + list_cluster_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore @distributed_trace_async async def list_cluster_monitoring_user_credentials( - self, - resource_group_name: str, - resource_name: str, - server_fqdn: Optional[str] = None, - **kwargs: Any + self, resource_group_name: str, resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any ) -> _models.CredentialResults: """Lists the cluster monitoring user credentials of a managed cluster. Lists the cluster monitoring user credentials of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_monitoring_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, - template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_monitoring_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -611,64 +577,55 @@ async def list_cluster_monitoring_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_monitoring_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore - + list_cluster_monitoring_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore @distributed_trace_async - async def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.ManagedCluster: + async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.ManagedCluster: """Gets a managed cluster. Gets a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedCluster, or the result of cls(response) + :return: ManagedCluster or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedCluster - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -676,55 +633,54 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _create_or_update_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.ManagedCluster, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'ManagedCluster') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedCluster") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -732,10 +688,9 @@ async def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -743,25 +698,26 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - - @distributed_trace_async + @overload async def begin_create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedCluster, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. @@ -769,11 +725,88 @@ async def begin_create_or_update( Creates or updates a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The managed cluster to create or update. + :param parameters: The managed cluster to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedCluster + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster to create or update. Is either a model type or a IO + type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedCluster or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -786,20 +819,17 @@ async def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -807,69 +837,66 @@ async def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _update_tags_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.TagsObject, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request_initial( - subscription_id=self._config.subscription_id, + request = build_update_tags_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_tags_initial.metadata['url'], + content=_content, + template_url=self._update_tags_initial.metadata["url"], headers=_headers, params=_params, ) @@ -877,32 +904,32 @@ async def _update_tags_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_tags_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _update_tags_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - @distributed_trace_async + @overload async def begin_update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. @@ -910,11 +937,88 @@ async def begin_update_tags( Updates tags on a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2022_02_02_preview.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates tags on a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates tags on a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_02_02_preview.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -927,20 +1031,17 @@ async def begin_update_tags( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, @@ -948,64 +1049,54 @@ async def begin_update_tags( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1013,10 +1104,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1026,23 +1116,18 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: + async def begin_delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Deletes a managed cluster. Deletes a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1054,85 +1139,83 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterServicePrincipalProfile, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterServicePrincipalProfile") - request = build_reset_service_principal_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_service_principal_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_service_principal_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_service_principal_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1140,10 +1223,9 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1153,15 +1235,89 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist if cls: return cls(pipeline_response, None, {}) - _reset_service_principal_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + _reset_service_principal_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + @overload + async def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.ManagedClusterServicePrincipalProfile, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset the Service Principal Profile of a managed cluster. + + This action cannot be performed on a cluster that is not using a service principal. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The service principal profile to set on the managed cluster. Required. + :type parameters: + ~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedClusterServicePrincipalProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset the Service Principal Profile of a managed cluster. + + This action cannot be performed on a cluster that is not using a service principal. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The service principal profile to set on the managed cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async - async def begin_reset_service_principal_profile( # pylint: disable=inconsistent-return-statements + async def begin_reset_service_principal_profile( self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterServicePrincipalProfile, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], **kwargs: Any ) -> AsyncLROPoller[None]: """Reset the Service Principal Profile of a managed cluster. @@ -1169,12 +1325,18 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent This action cannot be performed on a cluster that is not using a service principal. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The service principal profile to set on the managed cluster. + :param parameters: The service principal profile to set on the managed cluster. Is either a + model type or a IO type. Required. :type parameters: ~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedClusterServicePrincipalProfile + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -1185,20 +1347,17 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1206,67 +1365,68 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_service_principal_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + begin_reset_service_principal_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterAADProfile, + parameters: Union[_models.ManagedClusterAADProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterAADProfile") - request = build_reset_aad_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_aad_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_aad_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_aad_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1274,10 +1434,9 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1287,15 +1446,16 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta if cls: return cls(pipeline_response, None, {}) - _reset_aad_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - + _reset_aad_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - @distributed_trace_async - async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements + @overload + async def begin_reset_aad_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterAADProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: """Reset the AAD Profile of a managed cluster. @@ -1303,12 +1463,53 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem Reset the AAD Profile of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The AAD profile to set on the Managed Cluster. + :param parameters: The AAD profile to set on the Managed Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedClusterAADProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset the AAD Profile of a managed cluster. + + Reset the AAD Profile of a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The AAD profile to set on the Managed Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -1319,20 +1520,54 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterAADProfile, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset the AAD Profile of a managed cluster. + + Reset the AAD Profile of a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The AAD profile to set on the Managed Cluster. Is either a model type or a + IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedClusterAADProfile or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1340,62 +1575,52 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_aad_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + begin_reset_aad_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_rotate_cluster_certificates_request_initial( - subscription_id=self._config.subscription_id, + request = build_rotate_cluster_certificates_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._rotate_cluster_certificates_initial.metadata['url'], + template_url=self._rotate_cluster_certificates_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1403,10 +1628,9 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1416,15 +1640,11 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- if cls: return cls(pipeline_response, None, {}) - _rotate_cluster_certificates_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore - + _rotate_cluster_certificates_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore @distributed_trace_async - async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + async def begin_rotate_cluster_certificates( + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Rotates the certificates of a managed cluster. @@ -1432,8 +1652,9 @@ async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-ret more details about rotating managed cluster certificates. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1445,80 +1666,67 @@ async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-ret Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._rotate_cluster_certificates_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_rotate_cluster_certificates.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore + begin_rotate_cluster_certificates.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore async def _stop_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_stop_request_initial( - subscription_id=self._config.subscription_id, + request = build_stop_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._stop_initial.metadata['url'], + template_url=self._stop_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1526,10 +1734,9 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1539,16 +1746,10 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore - + _stop_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore @distributed_trace_async - async def begin_stop( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: + async def begin_stop(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Stops a Managed Cluster. This can only be performed on Azure Virtual Machine Scale set backed clusters. Stopping a @@ -1558,8 +1759,9 @@ async def begin_stop( # pylint: disable=inconsistent-return-statements cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1571,80 +1773,67 @@ async def begin_stop( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._stop_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore + begin_stop.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore async def _start_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_start_request_initial( - subscription_id=self._config.subscription_id, + request = build_start_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._start_initial.metadata['url'], + template_url=self._start_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1652,10 +1841,9 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1665,24 +1853,19 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore - + _start_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore @distributed_trace_async - async def begin_start( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: + async def begin_start(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Starts a previously stopped Managed Cluster. See `starting a cluster `_ for more details about starting a cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1694,85 +1877,83 @@ async def begin_start( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._start_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore + begin_start.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore async def _run_command_initial( self, resource_group_name: str, resource_name: str, - request_payload: _models.RunCommandRequest, + request_payload: Union[_models.RunCommandRequest, IO], **kwargs: Any ) -> Optional[_models.RunCommandResult]: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RunCommandResult]] - _json = self._serialize.body(request_payload, 'RunCommandRequest') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(request_payload, (IO, bytes)): + _content = request_payload + else: + _json = self._serialize.body(request_payload, "RunCommandRequest") - request = build_run_command_request_initial( - subscription_id=self._config.subscription_id, + request = build_run_command_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._run_command_initial.metadata['url'], + content=_content, + template_url=self._run_command_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1780,10 +1961,9 @@ async def _run_command_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1792,22 +1972,23 @@ async def _run_command_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _run_command_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore - + _run_command_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore - @distributed_trace_async + @overload async def begin_run_command( self, resource_group_name: str, resource_name: str, request_payload: _models.RunCommandRequest, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.RunCommandResult]: """Submits a command to run against the Managed Cluster. @@ -1817,12 +1998,16 @@ async def begin_run_command( `_. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param request_payload: The run command request. + :param request_payload: The run command request. Required. :type request_payload: ~azure.mgmt.containerservice.v2022_02_02_preview.models.RunCommandRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -1835,20 +2020,98 @@ async def begin_run_command( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_02_02_preview.models.RunCommandResult] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_run_command( + self, + resource_group_name: str, + resource_name: str, + request_payload: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.RunCommandResult]: + """Submits a command to run against the Managed Cluster. + + AKS will create a pod to run the command. This is primarily useful for private clusters. For + more information see `AKS Run Command + `_. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param request_payload: The run command request. Required. + :type request_payload: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RunCommandResult or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_02_02_preview.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_run_command( + self, + resource_group_name: str, + resource_name: str, + request_payload: Union[_models.RunCommandRequest, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.RunCommandResult]: + """Submits a command to run against the Managed Cluster. + + AKS will create a pod to run the command. This is primarily useful for private clusters. For + more information see `AKS Run Command + `_. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param request_payload: The run command request. Is either a model type or a IO type. Required. + :type request_payload: + ~azure.mgmt.containerservice.v2022_02_02_preview.models.RunCommandRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RunCommandResult or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_02_02_preview.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.RunCommandResult] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.RunCommandResult] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._run_command_initial( # type: ignore resource_group_name=resource_group_name, @@ -1856,82 +2119,72 @@ async def begin_run_command( request_payload=request_payload, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_run_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore + begin_run_command.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore @distributed_trace_async async def get_command_result( - self, - resource_group_name: str, - resource_name: str, - command_id: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, command_id: str, **kwargs: Any ) -> Optional[_models.RunCommandResult]: """Gets the results of a command which has been run on the Managed Cluster. Gets the results of a command which has been run on the Managed Cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param command_id: Id of the command. + :param command_id: Id of the command. Required. :type command_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: RunCommandResult, or the result of cls(response) + :return: RunCommandResult or None or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.RunCommandResult or None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RunCommandResult]] - request = build_get_command_result_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, command_id=command_id, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_command_result.metadata['url'], + template_url=self.get_command_result.metadata["url"], headers=_headers, params=_params, ) @@ -1939,10 +2192,9 @@ async def get_command_result( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1951,23 +2203,19 @@ async def get_command_result( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_command_result.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}"} # type: ignore - + get_command_result.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}"} # type: ignore @distributed_trace def list_outbound_network_dependencies_endpoints( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.OutboundEnvironmentEndpointCollection]: + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> AsyncIterable["_models.OutboundEnvironmentEndpoint"]: """Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster. @@ -1975,35 +2223,35 @@ def list_outbound_network_dependencies_endpoints( specified managed cluster. The operation returns properties of each egress endpoint. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OutboundEnvironmentEndpointCollection or the - result of cls(response) + :return: An iterator like instance of either OutboundEnvironmentEndpoint or the result of + cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_02_02_preview.models.OutboundEnvironmentEndpointCollection] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_02_02_preview.models.OutboundEnvironmentEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_outbound_network_dependencies_endpoints_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_outbound_network_dependencies_endpoints.metadata['url'], + template_url=self.list_outbound_network_dependencies_endpoints.metadata["url"], headers=_headers, params=_params, ) @@ -2011,16 +2259,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_outbound_network_dependencies_endpoints_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -2036,10 +2279,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2049,8 +2290,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_outbound_network_dependencies_endpoints.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints"} # type: ignore + list_outbound_network_dependencies_endpoints.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/operations/_operations.py index 632fa81ac1c5..9b1637b895f4 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/operations/_operations.py @@ -7,9 +7,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,9 +27,11 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._operations import build_list_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class Operations: """ .. warning:: @@ -42,38 +51,33 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.OperationListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.OperationValue"]: """Gets a list of operations. Gets a list of operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationListResult or the result of cls(response) + :return: An iterator like instance of either OperationValue or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_02_02_preview.models.OperationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_02_02_preview.models.OperationValue] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -81,13 +85,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -103,10 +105,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -116,8 +116,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.ContainerService/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ContainerService/operations"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/operations/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/operations/_private_endpoint_connections_operations.py index 8dbe43d887fd..8ef360d2243d 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/operations/_private_endpoint_connections_operations.py @@ -6,9 +6,15 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -20,10 +26,17 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._private_endpoint_connections_operations import build_delete_request_initial, build_get_request, build_list_request, build_update_request -T = TypeVar('T') +from ...operations._private_endpoint_connections_operations import ( + build_delete_request, + build_get_request, + build_list_request, + build_update_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class PrivateEndpointConnectionsOperations: """ .. warning:: @@ -43,13 +56,9 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async async def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnectionListResult: """Gets a list of private endpoint connections in the specified managed cluster. @@ -57,33 +66,31 @@ async def list( https://docs.microsoft.com/azure/aks/private-clusters. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnectionListResult, or the result of cls(response) + :return: PrivateEndpointConnectionListResult or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.PrivateEndpointConnectionListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnectionListResult] - request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -91,33 +98,27 @@ async def list( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore - + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore @distributed_trace_async async def get( - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnection: """Gets the specified private endpoint connection. @@ -125,35 +126,33 @@ async def get( https://docs.microsoft.com/azure/aks/private-clusters. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -161,33 +160,33 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - - @distributed_trace_async + @overload async def update( self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, parameters: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateEndpointConnection: """Updates a private endpoint connection. @@ -195,42 +194,117 @@ async def update( Updates a private endpoint connection. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str - :param parameters: The updated private endpoint connection. + :param parameters: The updated private endpoint connection. Required. :type parameters: ~azure.mgmt.containerservice.v2022_02_02_preview.models.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: The updated private endpoint connection. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: Union[_models.PrivateEndpointConnection, IO], + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: The updated private endpoint connection. Is either a model type or a IO + type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2022_02_02_preview.models.PrivateEndpointConnection or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - _json = self._serialize.body(parameters, 'PrivateEndpointConnection') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateEndpointConnection") request = build_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update.metadata['url'], + content=_content, + template_url=self.update.metadata["url"], headers=_headers, params=_params, ) @@ -238,52 +312,43 @@ async def update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -291,10 +356,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -304,26 +368,22 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + async def begin_delete( + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes a private endpoint connection. Deletes a private endpoint connection. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -335,53 +395,46 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/operations/_private_link_resources_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/operations/_private_link_resources_operations.py index 07dc63801af4..21d3d84a7648 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/operations/_private_link_resources_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/operations/_private_link_resources_operations.py @@ -8,7 +8,13 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -19,9 +25,11 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._private_link_resources_operations import build_list_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class PrivateLinkResourcesOperations: """ .. warning:: @@ -41,13 +49,9 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async async def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.PrivateLinkResourcesListResult: """Gets a list of private link resources in the specified managed cluster. @@ -55,32 +59,30 @@ async def list( https://docs.microsoft.com/azure/aks/private-clusters. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResourcesListResult, or the result of cls(response) + :return: PrivateLinkResourcesListResult or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.PrivateLinkResourcesListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResourcesListResult] - request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -88,22 +90,20 @@ async def list( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResourcesListResult', pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources"} # type: ignore - + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/operations/_resolve_private_link_service_id_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/operations/_resolve_private_link_service_id_operations.py index be0d353c750a..6275cee35afa 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/operations/_resolve_private_link_service_id_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/operations/_resolve_private_link_service_id_operations.py @@ -6,9 +6,15 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -19,9 +25,11 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._resolve_private_link_service_id_operations import build_post_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class ResolvePrivateLinkServiceIdOperations: """ .. warning:: @@ -41,13 +49,72 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @overload + async def post( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.PrivateLinkResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID for the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters required in order to resolve a private link service ID. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_02_02_preview.models.PrivateLinkResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def post( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID for the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters required in order to resolve a private link service ID. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def post( self, resource_group_name: str, resource_name: str, - parameters: _models.PrivateLinkResource, + parameters: Union[_models.PrivateLinkResource, IO], **kwargs: Any ) -> _models.PrivateLinkResource: """Gets the private link service ID for the specified managed cluster. @@ -55,38 +122,49 @@ async def post( Gets the private link service ID for the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters required in order to resolve a private link service ID. + :param parameters: Parameters required in order to resolve a private link service ID. Is either + a model type or a IO type. Required. :type parameters: ~azure.mgmt.containerservice.v2022_02_02_preview.models.PrivateLinkResource + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResource, or the result of cls(response) + :return: PrivateLinkResource or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.PrivateLinkResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResource] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResource] - _json = self._serialize.body(parameters, 'PrivateLinkResource') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateLinkResource") request = build_post_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.post.metadata['url'], + content=_content, + template_url=self.post.metadata["url"], headers=_headers, params=_params, ) @@ -94,22 +172,20 @@ async def post( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResource', pipeline_response) + deserialized = self._deserialize("PrivateLinkResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - post.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId"} # type: ignore - + post.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/operations/_snapshots_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/operations/_snapshots_operations.py index 4d39003c6ea4..bc695bac5f2c 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/operations/_snapshots_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/operations/_snapshots_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,10 +27,19 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._snapshots_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_resource_group_request, build_list_request, build_update_tags_request -T = TypeVar('T') +from ...operations._snapshots_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_resource_group_request, + build_list_request, + build_update_tags_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class SnapshotsOperations: """ .. warning:: @@ -43,39 +59,34 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.SnapshotListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.Snapshot"]: """Gets a list of snapshots in the specified subscription. Gets a list of snapshots in the specified subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SnapshotListResult or the result of cls(response) + :return: An iterator like instance of either Snapshot or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_02_02_preview.models.SnapshotListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_02_02_preview.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SnapshotListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -83,14 +94,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -106,10 +114,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -119,48 +125,42 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots"} # type: ignore @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.SnapshotListResult]: + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.Snapshot"]: """Lists snapshots in the specified subscription and resource group. Lists snapshots in the specified subscription and resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SnapshotListResult or the result of cls(response) + :return: An iterator like instance of either Snapshot or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_02_02_preview.models.SnapshotListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_02_02_preview.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SnapshotListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -168,15 +168,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -192,10 +188,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -205,50 +199,41 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots"} # type: ignore @distributed_trace_async - async def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.Snapshot: + async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.Snapshot: """Gets a snapshot. Gets a snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Snapshot, or the result of cls(response) + :return: Snapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.Snapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -256,32 +241,32 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - - @distributed_trace_async + @overload async def create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.Snapshot, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.Snapshot: """Creates or updates a snapshot. @@ -289,38 +274,102 @@ async def create_or_update( Creates or updates a snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The snapshot to create or update. + :param parameters: The snapshot to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_02_02_preview.models.Snapshot + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Snapshot, or the result of cls(response) + :return: Snapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.Snapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Snapshot: + """Creates or updates a snapshot. + + Creates or updates a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The snapshot to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.Snapshot, IO], **kwargs: Any + ) -> _models.Snapshot: + """Creates or updates a snapshot. + + Creates or updates a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The snapshot to create or update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.mgmt.containerservice.v2022_02_02_preview.models.Snapshot or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] - _json = self._serialize.body(parameters, 'Snapshot') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "Snapshot") request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) @@ -328,10 +377,9 @@ async def create_or_update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -339,25 +387,26 @@ async def create_or_update( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - @distributed_trace_async + @overload async def update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.Snapshot: """Updates tags on a snapshot. @@ -365,38 +414,102 @@ async def update_tags( Updates tags on a snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update snapshot Tags operation. + :param parameters: Parameters supplied to the Update snapshot Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2022_02_02_preview.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Snapshot: + """Updates tags on a snapshot. + + Updates tags on a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update snapshot Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Snapshot, or the result of cls(response) + :return: Snapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.Snapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @distributed_trace_async + async def update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> _models.Snapshot: + """Updates tags on a snapshot. + + Updates tags on a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update snapshot Tags operation. Is either a model + type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_02_02_preview.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") request = build_update_tags_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_tags.metadata['url'], + content=_content, + template_url=self.update_tags.metadata["url"], headers=_headers, params=_params, ) @@ -404,64 +517,57 @@ async def update_tags( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - + update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: """Deletes a snapshot. Deletes a snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) @@ -469,10 +575,9 @@ async def delete( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -482,5 +587,4 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - + delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/models/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/models/__init__.py index 6b6acf7cb4ef..5beb2c0261d0 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/models/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/models/__init__.py @@ -99,177 +99,175 @@ from ._models_py3 import UserAssignedIdentity from ._models_py3 import WindowsGmsaProfile - -from ._container_service_client_enums import ( - AgentPoolMode, - AgentPoolType, - Code, - ConnectionStatus, - ContainerServiceStorageProfileTypes, - ContainerServiceVMSizeTypes, - Count, - CreatedByType, - Expander, - ExtendedLocationTypes, - Format, - GPUInstanceProfile, - IpFamily, - KubeletDiskType, - LicenseType, - LoadBalancerSku, - ManagedClusterPodIdentityProvisioningState, - ManagedClusterSKUName, - ManagedClusterSKUTier, - NetworkMode, - NetworkPlugin, - NetworkPolicy, - OSDiskType, - OSSKU, - OSType, - OutboundType, - PrivateEndpointConnectionProvisioningState, - PublicNetworkAccess, - ResourceIdentityType, - ScaleDownMode, - ScaleSetEvictionPolicy, - ScaleSetPriority, - SnapshotType, - UpgradeChannel, - WeekDay, - WorkloadRuntime, -) +from ._container_service_client_enums import AgentPoolMode +from ._container_service_client_enums import AgentPoolType +from ._container_service_client_enums import Code +from ._container_service_client_enums import ConnectionStatus +from ._container_service_client_enums import ContainerServiceStorageProfileTypes +from ._container_service_client_enums import ContainerServiceVMSizeTypes +from ._container_service_client_enums import Count +from ._container_service_client_enums import CreatedByType +from ._container_service_client_enums import Expander +from ._container_service_client_enums import ExtendedLocationTypes +from ._container_service_client_enums import Format +from ._container_service_client_enums import GPUInstanceProfile +from ._container_service_client_enums import IpFamily +from ._container_service_client_enums import KubeletDiskType +from ._container_service_client_enums import LicenseType +from ._container_service_client_enums import LoadBalancerSku +from ._container_service_client_enums import ManagedClusterPodIdentityProvisioningState +from ._container_service_client_enums import ManagedClusterSKUName +from ._container_service_client_enums import ManagedClusterSKUTier +from ._container_service_client_enums import NetworkMode +from ._container_service_client_enums import NetworkPlugin +from ._container_service_client_enums import NetworkPolicy +from ._container_service_client_enums import OSDiskType +from ._container_service_client_enums import OSSKU +from ._container_service_client_enums import OSType +from ._container_service_client_enums import OutboundType +from ._container_service_client_enums import PrivateEndpointConnectionProvisioningState +from ._container_service_client_enums import PublicNetworkAccess +from ._container_service_client_enums import ResourceIdentityType +from ._container_service_client_enums import ScaleDownMode +from ._container_service_client_enums import ScaleSetEvictionPolicy +from ._container_service_client_enums import ScaleSetPriority +from ._container_service_client_enums import SnapshotType +from ._container_service_client_enums import UpgradeChannel +from ._container_service_client_enums import WeekDay +from ._container_service_client_enums import WorkloadRuntime from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'AgentPool', - 'AgentPoolAvailableVersions', - 'AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem', - 'AgentPoolListResult', - 'AgentPoolUpgradeProfile', - 'AgentPoolUpgradeProfilePropertiesUpgradesItem', - 'AgentPoolUpgradeSettings', - 'AzureKeyVaultKms', - 'CloudErrorBody', - 'ContainerServiceDiagnosticsProfile', - 'ContainerServiceLinuxProfile', - 'ContainerServiceMasterProfile', - 'ContainerServiceNetworkProfile', - 'ContainerServiceSshConfiguration', - 'ContainerServiceSshPublicKey', - 'ContainerServiceVMDiagnostics', - 'CreationData', - 'CredentialResult', - 'CredentialResults', - 'EndpointDependency', - 'EndpointDetail', - 'ExtendedLocation', - 'KubeletConfig', - 'LinuxOSConfig', - 'MaintenanceConfiguration', - 'MaintenanceConfigurationListResult', - 'ManagedCluster', - 'ManagedClusterAADProfile', - 'ManagedClusterAPIServerAccessProfile', - 'ManagedClusterAccessProfile', - 'ManagedClusterAddonProfile', - 'ManagedClusterAddonProfileIdentity', - 'ManagedClusterAgentPoolProfile', - 'ManagedClusterAgentPoolProfileProperties', - 'ManagedClusterAutoUpgradeProfile', - 'ManagedClusterHTTPProxyConfig', - 'ManagedClusterIdentity', - 'ManagedClusterListResult', - 'ManagedClusterLoadBalancerProfile', - 'ManagedClusterLoadBalancerProfileManagedOutboundIPs', - 'ManagedClusterLoadBalancerProfileOutboundIPPrefixes', - 'ManagedClusterLoadBalancerProfileOutboundIPs', - 'ManagedClusterManagedOutboundIPProfile', - 'ManagedClusterNATGatewayProfile', - 'ManagedClusterOIDCIssuerProfile', - 'ManagedClusterPodIdentity', - 'ManagedClusterPodIdentityException', - 'ManagedClusterPodIdentityProfile', - 'ManagedClusterPodIdentityProvisioningError', - 'ManagedClusterPodIdentityProvisioningErrorBody', - 'ManagedClusterPodIdentityProvisioningInfo', - 'ManagedClusterPoolUpgradeProfile', - 'ManagedClusterPoolUpgradeProfileUpgradesItem', - 'ManagedClusterPropertiesAutoScalerProfile', - 'ManagedClusterPropertiesForSnapshot', - 'ManagedClusterSKU', - 'ManagedClusterSecurityProfile', - 'ManagedClusterSecurityProfileAzureDefender', - 'ManagedClusterServicePrincipalProfile', - 'ManagedClusterSnapshot', - 'ManagedClusterSnapshotListResult', - 'ManagedClusterUpgradeProfile', - 'ManagedClusterWindowsProfile', - 'ManagedServiceIdentityUserAssignedIdentitiesValue', - 'NetworkProfileForSnapshot', - 'OSOptionProfile', - 'OSOptionProperty', - 'OperationListResult', - 'OperationValue', - 'OutboundEnvironmentEndpoint', - 'OutboundEnvironmentEndpointCollection', - 'PowerState', - 'PrivateEndpoint', - 'PrivateEndpointConnection', - 'PrivateEndpointConnectionListResult', - 'PrivateLinkResource', - 'PrivateLinkResourcesListResult', - 'PrivateLinkServiceConnectionState', - 'Resource', - 'ResourceReference', - 'RunCommandRequest', - 'RunCommandResult', - 'Snapshot', - 'SnapshotListResult', - 'SubResource', - 'SysctlConfig', - 'SystemData', - 'TagsObject', - 'TimeInWeek', - 'TimeSpan', - 'UserAssignedIdentity', - 'WindowsGmsaProfile', - 'AgentPoolMode', - 'AgentPoolType', - 'Code', - 'ConnectionStatus', - 'ContainerServiceStorageProfileTypes', - 'ContainerServiceVMSizeTypes', - 'Count', - 'CreatedByType', - 'Expander', - 'ExtendedLocationTypes', - 'Format', - 'GPUInstanceProfile', - 'IpFamily', - 'KubeletDiskType', - 'LicenseType', - 'LoadBalancerSku', - 'ManagedClusterPodIdentityProvisioningState', - 'ManagedClusterSKUName', - 'ManagedClusterSKUTier', - 'NetworkMode', - 'NetworkPlugin', - 'NetworkPolicy', - 'OSDiskType', - 'OSSKU', - 'OSType', - 'OutboundType', - 'PrivateEndpointConnectionProvisioningState', - 'PublicNetworkAccess', - 'ResourceIdentityType', - 'ScaleDownMode', - 'ScaleSetEvictionPolicy', - 'ScaleSetPriority', - 'SnapshotType', - 'UpgradeChannel', - 'WeekDay', - 'WorkloadRuntime', + "AgentPool", + "AgentPoolAvailableVersions", + "AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem", + "AgentPoolListResult", + "AgentPoolUpgradeProfile", + "AgentPoolUpgradeProfilePropertiesUpgradesItem", + "AgentPoolUpgradeSettings", + "AzureKeyVaultKms", + "CloudErrorBody", + "ContainerServiceDiagnosticsProfile", + "ContainerServiceLinuxProfile", + "ContainerServiceMasterProfile", + "ContainerServiceNetworkProfile", + "ContainerServiceSshConfiguration", + "ContainerServiceSshPublicKey", + "ContainerServiceVMDiagnostics", + "CreationData", + "CredentialResult", + "CredentialResults", + "EndpointDependency", + "EndpointDetail", + "ExtendedLocation", + "KubeletConfig", + "LinuxOSConfig", + "MaintenanceConfiguration", + "MaintenanceConfigurationListResult", + "ManagedCluster", + "ManagedClusterAADProfile", + "ManagedClusterAPIServerAccessProfile", + "ManagedClusterAccessProfile", + "ManagedClusterAddonProfile", + "ManagedClusterAddonProfileIdentity", + "ManagedClusterAgentPoolProfile", + "ManagedClusterAgentPoolProfileProperties", + "ManagedClusterAutoUpgradeProfile", + "ManagedClusterHTTPProxyConfig", + "ManagedClusterIdentity", + "ManagedClusterListResult", + "ManagedClusterLoadBalancerProfile", + "ManagedClusterLoadBalancerProfileManagedOutboundIPs", + "ManagedClusterLoadBalancerProfileOutboundIPPrefixes", + "ManagedClusterLoadBalancerProfileOutboundIPs", + "ManagedClusterManagedOutboundIPProfile", + "ManagedClusterNATGatewayProfile", + "ManagedClusterOIDCIssuerProfile", + "ManagedClusterPodIdentity", + "ManagedClusterPodIdentityException", + "ManagedClusterPodIdentityProfile", + "ManagedClusterPodIdentityProvisioningError", + "ManagedClusterPodIdentityProvisioningErrorBody", + "ManagedClusterPodIdentityProvisioningInfo", + "ManagedClusterPoolUpgradeProfile", + "ManagedClusterPoolUpgradeProfileUpgradesItem", + "ManagedClusterPropertiesAutoScalerProfile", + "ManagedClusterPropertiesForSnapshot", + "ManagedClusterSKU", + "ManagedClusterSecurityProfile", + "ManagedClusterSecurityProfileAzureDefender", + "ManagedClusterServicePrincipalProfile", + "ManagedClusterSnapshot", + "ManagedClusterSnapshotListResult", + "ManagedClusterUpgradeProfile", + "ManagedClusterWindowsProfile", + "ManagedServiceIdentityUserAssignedIdentitiesValue", + "NetworkProfileForSnapshot", + "OSOptionProfile", + "OSOptionProperty", + "OperationListResult", + "OperationValue", + "OutboundEnvironmentEndpoint", + "OutboundEnvironmentEndpointCollection", + "PowerState", + "PrivateEndpoint", + "PrivateEndpointConnection", + "PrivateEndpointConnectionListResult", + "PrivateLinkResource", + "PrivateLinkResourcesListResult", + "PrivateLinkServiceConnectionState", + "Resource", + "ResourceReference", + "RunCommandRequest", + "RunCommandResult", + "Snapshot", + "SnapshotListResult", + "SubResource", + "SysctlConfig", + "SystemData", + "TagsObject", + "TimeInWeek", + "TimeSpan", + "UserAssignedIdentity", + "WindowsGmsaProfile", + "AgentPoolMode", + "AgentPoolType", + "Code", + "ConnectionStatus", + "ContainerServiceStorageProfileTypes", + "ContainerServiceVMSizeTypes", + "Count", + "CreatedByType", + "Expander", + "ExtendedLocationTypes", + "Format", + "GPUInstanceProfile", + "IpFamily", + "KubeletDiskType", + "LicenseType", + "LoadBalancerSku", + "ManagedClusterPodIdentityProvisioningState", + "ManagedClusterSKUName", + "ManagedClusterSKUTier", + "NetworkMode", + "NetworkPlugin", + "NetworkPolicy", + "OSDiskType", + "OSSKU", + "OSType", + "OutboundType", + "PrivateEndpointConnectionProvisioningState", + "PublicNetworkAccess", + "ResourceIdentityType", + "ScaleDownMode", + "ScaleSetEvictionPolicy", + "ScaleSetPriority", + "SnapshotType", + "UpgradeChannel", + "WeekDay", + "WorkloadRuntime", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/models/_container_service_client_enums.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/models/_container_service_client_enums.py index c66d7c8a922b..d9babf886c17 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/models/_container_service_client_enums.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/models/_container_service_client_enums.py @@ -13,7 +13,7 @@ class AgentPoolMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools + https://docs.microsoft.com/azure/aks/use-system-pools. """ #: System agent pools are primarily for hosting critical system pods such as CoreDNS and @@ -23,33 +23,34 @@ class AgentPoolMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: User agent pools are primarily for hosting your application pods. USER = "User" + class AgentPoolType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of Agent Pool. - """ + """The type of Agent Pool.""" #: Create an Agent Pool backed by a Virtual Machine Scale Set. VIRTUAL_MACHINE_SCALE_SETS = "VirtualMachineScaleSets" #: Use of this is strongly discouraged. AVAILABILITY_SET = "AvailabilitySet" + class Code(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Tells whether the cluster is Running or Stopped - """ + """Tells whether the cluster is Running or Stopped.""" #: The cluster is running. RUNNING = "Running" #: The cluster is stopped. STOPPED = "Stopped" + class ConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The private link service connection status. - """ + """The private link service connection status.""" PENDING = "Pending" APPROVED = "Approved" REJECTED = "Rejected" DISCONNECTED = "Disconnected" + class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Specifies what kind of storage to use. If omitted, the default will be chosen on your behalf based on the choice of orchestrator. @@ -58,9 +59,9 @@ class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEn STORAGE_ACCOUNT = "StorageAccount" MANAGED_DISKS = "ManagedDisks" + class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Size of agent VMs. Note: This is no longer maintained. - """ + """Size of agent VMs. Note: This is no longer maintained.""" STANDARD_A1 = "Standard_A1" STANDARD_A10 = "Standard_A10" @@ -237,6 +238,7 @@ class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): STANDARD_NV24 = "Standard_NV24" STANDARD_NV6 = "Standard_NV6" + class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): """Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, and 5. The default value is 1. @@ -246,15 +248,16 @@ class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): THREE = 3 FIVE = 5 + class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of identity that created the resource. - """ + """The type of identity that created the resource.""" USER = "User" APPLICATION = "Application" MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" + class Expander(str, Enum, metaclass=CaseInsensitiveEnumMeta): """If not specified, the default is 'random'. See `expanders `_ @@ -278,23 +281,25 @@ class Expander(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Used when you don't have a particular need for the node groups to scale differently. RANDOM = "random" + class ExtendedLocationTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of extendedLocation. - """ + """The type of extendedLocation.""" EDGE_ZONE = "EdgeZone" + class Format(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Format.""" #: Return azure auth-provider kubeconfig. This format is deprecated in 1.22 and will be fully #: removed in 1.25. AZURE = "azure" #: Return exec format kubeconfig. This format requires kubelogin binary in the path. - EXEC_ENUM = "exec" + EXEC = "exec" + class GPUInstanceProfile(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """GPUInstanceProfile to be used to specify GPU MIG instance profile for supported GPU VM SKU. - """ + """GPUInstanceProfile to be used to specify GPU MIG instance profile for supported GPU VM SKU.""" MIG1_G = "MIG1g" MIG2_G = "MIG2g" @@ -302,13 +307,14 @@ class GPUInstanceProfile(str, Enum, metaclass=CaseInsensitiveEnumMeta): MIG4_G = "MIG4g" MIG7_G = "MIG7g" + class IpFamily(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The IP version to use for cluster networking and IP assignment. - """ + """The IP version to use for cluster networking and IP assignment.""" I_PV4 = "IPv4" I_PV6 = "IPv6" + class KubeletDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. @@ -319,6 +325,7 @@ class KubeletDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Kubelet will use the temporary disk for its data. TEMPORARY = "Temporary" + class LicenseType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The license type to use for Windows VMs. See `Azure Hybrid User Benefits `_ for more details. @@ -329,6 +336,7 @@ class LicenseType(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Enables Azure Hybrid User Benefits for Windows VMs. WINDOWS_SERVER = "Windows_Server" + class LoadBalancerSku(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The default is 'standard'. See `Azure Load Balancer SKUs `_ for more information about the @@ -342,21 +350,22 @@ class LoadBalancerSku(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Use a basic Load Balancer with limited functionality. BASIC = "basic" + class ManagedClusterPodIdentityProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The current provisioning state of the pod identity. - """ + """The current provisioning state of the pod identity.""" ASSIGNED = "Assigned" UPDATING = "Updating" DELETING = "Deleting" FAILED = "Failed" + class ManagedClusterSKUName(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The name of a managed cluster SKU. - """ + """The name of a managed cluster SKU.""" BASIC = "Basic" + class ManagedClusterSKUTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): """If not specified, the default is 'Free'. See `uptime SLA `_ for more details. @@ -368,20 +377,20 @@ class ManagedClusterSKUTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: No guaranteed SLA, no additional charges. Free tier clusters have an SLO of 99.5%. FREE = "Free" + class NetworkMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """This cannot be specified if networkPlugin is anything other than 'azure'. - """ + """This cannot be specified if networkPlugin is anything other than 'azure'.""" #: No bridge is created. Intra-VM Pod to Pod communication is through IP routes created by Azure #: CNI. See `Transparent Mode `_ for #: more information. TRANSPARENT = "transparent" - #: This is no longer supported. + #: This is no longer supported BRIDGE = "bridge" + class NetworkPlugin(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Network plugin used for building the Kubernetes network. - """ + """Network plugin used for building the Kubernetes network.""" #: Use the Azure CNI network plugin. See `Azure CNI (advanced) networking #: `_ for @@ -395,9 +404,9 @@ class NetworkPlugin(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: networking functionality. NONE = "none" + class NetworkPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Network policy used for building the Kubernetes network. - """ + """Network policy used for building the Kubernetes network.""" #: Use Calico network policies. See `differences between Azure and Calico policies #: `_ @@ -408,6 +417,7 @@ class NetworkPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: for more information. AZURE = "azure" + class OSDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more @@ -424,22 +434,23 @@ class OSDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: provides lower read/write latency, along with faster node scaling and cluster upgrades. EPHEMERAL = "Ephemeral" + class OSSKU(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Specifies an OS SKU. This value must not be specified if OSType is Windows. - """ + """Specifies an OS SKU. This value must not be specified if OSType is Windows.""" UBUNTU = "Ubuntu" CBL_MARINER = "CBLMariner" + class OSType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The operating system type. The default is Linux. - """ + """The operating system type. The default is Linux.""" #: Use Linux. LINUX = "Linux" #: Use Windows. WINDOWS = "Windows" + class OutboundType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """This can only be set at cluster creation time and cannot be changed later. For more information see `egress outbound type `_. @@ -460,22 +471,23 @@ class OutboundType(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: advanced scenario and requires proper network configuration. USER_ASSIGNED_NAT_GATEWAY = "userAssignedNATGateway" + class PrivateEndpointConnectionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The current provisioning state. - """ + """The current provisioning state.""" SUCCEEDED = "Succeeded" CREATING = "Creating" DELETING = "Deleting" FAILED = "Failed" + class PublicNetworkAccess(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Allow or deny public network access for AKS - """ + """Allow or deny public network access for AKS.""" ENABLED = "Enabled" DISABLED = "Disabled" + class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """For more information see `use managed identities in AKS `_. @@ -492,6 +504,7 @@ class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Do not use a managed identity for the Managed Cluster, service principal will be used instead. NONE = "None" + class ScaleDownMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Describes how VMs are added to or removed from Agent Pools. See `billing states `_. @@ -503,10 +516,11 @@ class ScaleDownMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: during scale down. DEALLOCATE = "Deallocate" + class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The eviction policy specifies what to do with the VM when it is evicted. The default is Delete. For more information about eviction see `spot VMs - `_ + `_. """ #: Nodes in the underlying Scale Set of the node pool are deleted when they're evicted. @@ -516,9 +530,9 @@ class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: cause issues with cluster scaling or upgrading. DEALLOCATE = "Deallocate" + class ScaleSetPriority(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The Virtual Machine Scale Set priority. - """ + """The Virtual Machine Scale Set priority.""" #: Spot priority VMs will be used. There is no SLA for spot nodes. See `spot on AKS #: `_ for more information. @@ -526,15 +540,16 @@ class ScaleSetPriority(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Regular VMs will be used. REGULAR = "Regular" + class SnapshotType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of a snapshot. The default is NodePool. - """ + """The type of a snapshot. The default is NodePool.""" #: The snapshot is a snapshot of a node pool. NODE_POOL = "NodePool" #: The snapshot is a snapshot of a managed cluster. MANAGED_CLUSTER = "ManagedCluster" + class UpgradeChannel(str, Enum, metaclass=CaseInsensitiveEnumMeta): """For more information see `setting the AKS cluster auto-upgrade channel `_. @@ -565,9 +580,9 @@ class UpgradeChannel(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Disables auto-upgrades and keeps the cluster at its current version of Kubernetes. NONE = "none" + class WeekDay(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The weekday enum. - """ + """The weekday enum.""" SUNDAY = "Sunday" MONDAY = "Monday" @@ -577,9 +592,9 @@ class WeekDay(str, Enum, metaclass=CaseInsensitiveEnumMeta): FRIDAY = "Friday" SATURDAY = "Saturday" + class WorkloadRuntime(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Determines the type of workload a node can run. - """ + """Determines the type of workload a node can run.""" #: Nodes will use Kubelet to run standard OCI container workloads. OCI_CONTAINER = "OCIContainer" diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/models/_models_py3.py index 559241ff4796..2198cd0b348d 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/models/_models_py3.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/models/_models_py3.py @@ -1,4 +1,5 @@ # coding=utf-8 +# pylint: disable=too-many-lines # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -9,14 +10,14 @@ import datetime from typing import Dict, List, Optional, TYPE_CHECKING, Union -import msrest.serialization +from ... import _serialization if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - import __init__ as _models + from .. import models as _models -class SubResource(msrest.serialization.Model): +class SubResource(_serialization.Model): """Reference to another subresource. Variables are only populated by the server, and will be ignored when sending a request. @@ -31,30 +32,26 @@ class SubResource(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(SubResource, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.id = None self.name = None self.type = None -class AgentPool(SubResource): +class AgentPool(SubResource): # pylint: disable=too-many-instance-attributes """Agent Pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -82,15 +79,15 @@ class AgentPool(SubResource): larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.OSDiskType :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data - root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.KubeletDiskType :ivar workload_runtime: Determines the type of workload a node can run. Known values are: - "OCIContainer", "WasmWasi". + "OCIContainer" and "WasmWasi". :vartype workload_runtime: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.WorkloadRuntime :ivar message_of_the_day: A base64-encoded string which will be written to /etc/motd after @@ -109,11 +106,11 @@ class AgentPool(SubResource): :vartype pod_subnet_id: str :ivar max_pods: The maximum number of pods that can run on a node. :vartype max_pods: int - :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.OSType :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known - values are: "Ubuntu", "CBLMariner". + values are: "Ubuntu" and "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.OSSKU :ivar max_count: The maximum number of nodes for auto-scaling. :vartype max_count: int @@ -122,16 +119,16 @@ class AgentPool(SubResource): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it - defaults to Delete. Known values are: "Delete", "Deallocate". + defaults to Delete. Known values are: "Delete" and "Deallocate". :vartype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.ScaleDownMode - :ivar type_properties_type: The type of Agent Pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + :ivar type_properties_type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets" + and "AvailabilitySet". :vartype type_properties_type: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.AgentPoolType :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :vartype mode: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.AgentPoolMode :ivar orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -166,20 +163,18 @@ class AgentPool(SubResource): /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default - is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + is 'Regular'. Known values are: "Spot" and "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.ScaleSetPriority :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.ScaleSetEvictionPolicy :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :vartype spot_max_price: float - :ivar tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :ivar tags: The tags to be persisted on the agent pool virtual machine scale set. :vartype tags: dict[str, str] :ivar node_labels: The node labels to be persisted across all nodes in agent pool. :vartype node_labels: dict[str, str] @@ -203,7 +198,7 @@ class AgentPool(SubResource): for more details. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.GPUInstanceProfile :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the node pool @@ -220,63 +215,63 @@ class AgentPool(SubResource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'os_disk_size_gb': {'maximum': 2048, 'minimum': 0}, - 'node_image_version': {'readonly': True}, - 'provisioning_state': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "os_disk_size_gb": {"maximum": 2048, "minimum": 0}, + "node_image_version": {"readonly": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'count': {'key': 'properties.count', 'type': 'int'}, - 'vm_size': {'key': 'properties.vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'properties.osDiskSizeGB', 'type': 'int'}, - 'os_disk_type': {'key': 'properties.osDiskType', 'type': 'str'}, - 'kubelet_disk_type': {'key': 'properties.kubeletDiskType', 'type': 'str'}, - 'workload_runtime': {'key': 'properties.workloadRuntime', 'type': 'str'}, - 'message_of_the_day': {'key': 'properties.messageOfTheDay', 'type': 'str'}, - 'vnet_subnet_id': {'key': 'properties.vnetSubnetID', 'type': 'str'}, - 'pod_subnet_id': {'key': 'properties.podSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'properties.maxPods', 'type': 'int'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'os_sku': {'key': 'properties.osSKU', 'type': 'str'}, - 'max_count': {'key': 'properties.maxCount', 'type': 'int'}, - 'min_count': {'key': 'properties.minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'properties.enableAutoScaling', 'type': 'bool'}, - 'scale_down_mode': {'key': 'properties.scaleDownMode', 'type': 'str'}, - 'type_properties_type': {'key': 'properties.type', 'type': 'str'}, - 'mode': {'key': 'properties.mode', 'type': 'str'}, - 'orchestrator_version': {'key': 'properties.orchestratorVersion', 'type': 'str'}, - 'node_image_version': {'key': 'properties.nodeImageVersion', 'type': 'str'}, - 'upgrade_settings': {'key': 'properties.upgradeSettings', 'type': 'AgentPoolUpgradeSettings'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'power_state': {'key': 'properties.powerState', 'type': 'PowerState'}, - 'availability_zones': {'key': 'properties.availabilityZones', 'type': '[str]'}, - 'enable_node_public_ip': {'key': 'properties.enableNodePublicIP', 'type': 'bool'}, - 'node_public_ip_prefix_id': {'key': 'properties.nodePublicIPPrefixID', 'type': 'str'}, - 'scale_set_priority': {'key': 'properties.scaleSetPriority', 'type': 'str'}, - 'scale_set_eviction_policy': {'key': 'properties.scaleSetEvictionPolicy', 'type': 'str'}, - 'spot_max_price': {'key': 'properties.spotMaxPrice', 'type': 'float'}, - 'tags': {'key': 'properties.tags', 'type': '{str}'}, - 'node_labels': {'key': 'properties.nodeLabels', 'type': '{str}'}, - 'node_taints': {'key': 'properties.nodeTaints', 'type': '[str]'}, - 'proximity_placement_group_id': {'key': 'properties.proximityPlacementGroupID', 'type': 'str'}, - 'kubelet_config': {'key': 'properties.kubeletConfig', 'type': 'KubeletConfig'}, - 'linux_os_config': {'key': 'properties.linuxOSConfig', 'type': 'LinuxOSConfig'}, - 'enable_encryption_at_host': {'key': 'properties.enableEncryptionAtHost', 'type': 'bool'}, - 'enable_ultra_ssd': {'key': 'properties.enableUltraSSD', 'type': 'bool'}, - 'enable_fips': {'key': 'properties.enableFIPS', 'type': 'bool'}, - 'gpu_instance_profile': {'key': 'properties.gpuInstanceProfile', 'type': 'str'}, - 'creation_data': {'key': 'properties.creationData', 'type': 'CreationData'}, - 'capacity_reservation_group_id': {'key': 'properties.capacityReservationGroupID', 'type': 'str'}, - 'host_group_id': {'key': 'properties.hostGroupID', 'type': 'str'}, - } - - def __init__( + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "count": {"key": "properties.count", "type": "int"}, + "vm_size": {"key": "properties.vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "properties.osDiskSizeGB", "type": "int"}, + "os_disk_type": {"key": "properties.osDiskType", "type": "str"}, + "kubelet_disk_type": {"key": "properties.kubeletDiskType", "type": "str"}, + "workload_runtime": {"key": "properties.workloadRuntime", "type": "str"}, + "message_of_the_day": {"key": "properties.messageOfTheDay", "type": "str"}, + "vnet_subnet_id": {"key": "properties.vnetSubnetID", "type": "str"}, + "pod_subnet_id": {"key": "properties.podSubnetID", "type": "str"}, + "max_pods": {"key": "properties.maxPods", "type": "int"}, + "os_type": {"key": "properties.osType", "type": "str"}, + "os_sku": {"key": "properties.osSKU", "type": "str"}, + "max_count": {"key": "properties.maxCount", "type": "int"}, + "min_count": {"key": "properties.minCount", "type": "int"}, + "enable_auto_scaling": {"key": "properties.enableAutoScaling", "type": "bool"}, + "scale_down_mode": {"key": "properties.scaleDownMode", "type": "str"}, + "type_properties_type": {"key": "properties.type", "type": "str"}, + "mode": {"key": "properties.mode", "type": "str"}, + "orchestrator_version": {"key": "properties.orchestratorVersion", "type": "str"}, + "node_image_version": {"key": "properties.nodeImageVersion", "type": "str"}, + "upgrade_settings": {"key": "properties.upgradeSettings", "type": "AgentPoolUpgradeSettings"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "power_state": {"key": "properties.powerState", "type": "PowerState"}, + "availability_zones": {"key": "properties.availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "properties.enableNodePublicIP", "type": "bool"}, + "node_public_ip_prefix_id": {"key": "properties.nodePublicIPPrefixID", "type": "str"}, + "scale_set_priority": {"key": "properties.scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "properties.scaleSetEvictionPolicy", "type": "str"}, + "spot_max_price": {"key": "properties.spotMaxPrice", "type": "float"}, + "tags": {"key": "properties.tags", "type": "{str}"}, + "node_labels": {"key": "properties.nodeLabels", "type": "{str}"}, + "node_taints": {"key": "properties.nodeTaints", "type": "[str]"}, + "proximity_placement_group_id": {"key": "properties.proximityPlacementGroupID", "type": "str"}, + "kubelet_config": {"key": "properties.kubeletConfig", "type": "KubeletConfig"}, + "linux_os_config": {"key": "properties.linuxOSConfig", "type": "LinuxOSConfig"}, + "enable_encryption_at_host": {"key": "properties.enableEncryptionAtHost", "type": "bool"}, + "enable_ultra_ssd": {"key": "properties.enableUltraSSD", "type": "bool"}, + "enable_fips": {"key": "properties.enableFIPS", "type": "bool"}, + "gpu_instance_profile": {"key": "properties.gpuInstanceProfile", "type": "str"}, + "creation_data": {"key": "properties.creationData", "type": "CreationData"}, + "capacity_reservation_group_id": {"key": "properties.capacityReservationGroupID", "type": "str"}, + "host_group_id": {"key": "properties.hostGroupID", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, count: Optional[int] = None, @@ -289,7 +284,7 @@ def __init__( vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, @@ -303,9 +298,9 @@ def __init__( availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", - spot_max_price: Optional[float] = -1, + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", + spot_max_price: float = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, @@ -338,15 +333,15 @@ def __init__( larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.OSDiskType :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime - data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + data root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.KubeletDiskType :keyword workload_runtime: Determines the type of workload a node can run. Known values are: - "OCIContainer", "WasmWasi". + "OCIContainer" and "WasmWasi". :paramtype workload_runtime: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.WorkloadRuntime :keyword message_of_the_day: A base64-encoded string which will be written to /etc/motd after @@ -365,11 +360,11 @@ def __init__( :paramtype pod_subnet_id: str :keyword max_pods: The maximum number of pods that can run on a node. :paramtype max_pods: int - :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.OSType :keyword os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Known values are: "Ubuntu", "CBLMariner". + Known values are: "Ubuntu" and "CBLMariner". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.OSSKU :keyword max_count: The maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -378,16 +373,16 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, - it defaults to Delete. Known values are: "Delete", "Deallocate". + it defaults to Delete. Known values are: "Delete" and "Deallocate". :paramtype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.ScaleDownMode :keyword type_properties_type: The type of Agent Pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type_properties_type: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.AgentPoolType :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.AgentPoolMode :keyword orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -418,20 +413,18 @@ def __init__( /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the - default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + default is 'Regular'. Known values are: "Spot" and "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.ScaleSetPriority :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.ScaleSetEvictionPolicy :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :paramtype spot_max_price: float - :keyword tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :keyword tags: The tags to be persisted on the agent pool virtual machine scale set. :paramtype tags: dict[str, str] :keyword node_labels: The node labels to be persisted across all nodes in agent pool. :paramtype node_labels: dict[str, str] @@ -457,7 +450,7 @@ def __init__( for more details. :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance - profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.GPUInstanceProfile @@ -473,7 +466,7 @@ def __init__( `_. :paramtype host_group_id: str """ - super(AgentPool, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.vm_size = vm_size self.os_disk_size_gb = os_disk_size_gb @@ -518,7 +511,7 @@ def __init__( self.host_group_id = host_group_id -class AgentPoolAvailableVersions(msrest.serialization.Model): +class AgentPoolAvailableVersions(_serialization.Model): """The list of available versions for an agent pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -535,16 +528,19 @@ class AgentPoolAvailableVersions(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'agent_pool_versions': {'key': 'properties.agentPoolVersions', 'type': '[AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "agent_pool_versions": { + "key": "properties.agentPoolVersions", + "type": "[AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem]", + }, } def __init__( @@ -558,14 +554,14 @@ def __init__( :paramtype agent_pool_versions: list[~azure.mgmt.containerservice.v2022_02_02_preview.models.AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem] """ - super(AgentPoolAvailableVersions, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None self.agent_pool_versions = agent_pool_versions -class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(msrest.serialization.Model): +class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(_serialization.Model): """AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem. :ivar default: Whether this version is the default agent pool version. @@ -577,9 +573,9 @@ class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(msrest.serializa """ _attribute_map = { - 'default': {'key': 'default', 'type': 'bool'}, - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "default": {"key": "default", "type": "bool"}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } def __init__( @@ -598,13 +594,13 @@ def __init__( :keyword is_preview: Whether Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.default = default self.kubernetes_version = kubernetes_version self.is_preview = is_preview -class AgentPoolListResult(msrest.serialization.Model): +class AgentPoolListResult(_serialization.Model): """The response from the List Agent Pools operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -616,30 +612,25 @@ class AgentPoolListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[AgentPool]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[AgentPool]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.AgentPool"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.AgentPool"]] = None, **kwargs): """ :keyword value: The list of agent pools. :paramtype value: list[~azure.mgmt.containerservice.v2022_02_02_preview.models.AgentPool] """ - super(AgentPoolListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class AgentPoolUpgradeProfile(msrest.serialization.Model): +class AgentPoolUpgradeProfile(_serialization.Model): """The list of available upgrades for an agent pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -652,10 +643,10 @@ class AgentPoolUpgradeProfile(msrest.serialization.Model): :vartype name: str :ivar type: The type of the agent pool upgrade profile. :vartype type: str - :ivar kubernetes_version: Required. The Kubernetes version (major.minor.patch). + :ivar kubernetes_version: The Kubernetes version (major.minor.patch). Required. :vartype kubernetes_version: str - :ivar os_type: Required. The operating system type. The default is Linux. Known values are: - "Linux", "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -665,21 +656,21 @@ class AgentPoolUpgradeProfile(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kubernetes_version': {'required': True}, - 'os_type': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "kubernetes_version": {"required": True}, + "os_type": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'kubernetes_version': {'key': 'properties.kubernetesVersion', 'type': 'str'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'upgrades': {'key': 'properties.upgrades', 'type': '[AgentPoolUpgradeProfilePropertiesUpgradesItem]'}, - 'latest_node_image_version': {'key': 'properties.latestNodeImageVersion', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "os_type": {"key": "properties.osType", "type": "str"}, + "upgrades": {"key": "properties.upgrades", "type": "[AgentPoolUpgradeProfilePropertiesUpgradesItem]"}, + "latest_node_image_version": {"key": "properties.latestNodeImageVersion", "type": "str"}, } def __init__( @@ -692,10 +683,10 @@ def __init__( **kwargs ): """ - :keyword kubernetes_version: Required. The Kubernetes version (major.minor.patch). + :keyword kubernetes_version: The Kubernetes version (major.minor.patch). Required. :paramtype kubernetes_version: str - :keyword os_type: Required. The operating system type. The default is Linux. Known values are: - "Linux", "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: @@ -703,7 +694,7 @@ def __init__( :keyword latest_node_image_version: The latest AKS supported node image version. :paramtype latest_node_image_version: str """ - super(AgentPoolUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -713,7 +704,7 @@ def __init__( self.latest_node_image_version = latest_node_image_version -class AgentPoolUpgradeProfilePropertiesUpgradesItem(msrest.serialization.Model): +class AgentPoolUpgradeProfilePropertiesUpgradesItem(_serialization.Model): """AgentPoolUpgradeProfilePropertiesUpgradesItem. :ivar kubernetes_version: The Kubernetes version (major.minor.patch). @@ -723,29 +714,23 @@ class AgentPoolUpgradeProfilePropertiesUpgradesItem(msrest.serialization.Model): """ _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } - def __init__( - self, - *, - kubernetes_version: Optional[str] = None, - is_preview: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, kubernetes_version: Optional[str] = None, is_preview: Optional[bool] = None, **kwargs): """ :keyword kubernetes_version: The Kubernetes version (major.minor.patch). :paramtype kubernetes_version: str :keyword is_preview: Whether the Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(AgentPoolUpgradeProfilePropertiesUpgradesItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.is_preview = is_preview -class AgentPoolUpgradeSettings(msrest.serialization.Model): +class AgentPoolUpgradeSettings(_serialization.Model): """Settings for upgrading an agentpool. :ivar max_surge: This can either be set to an integer (e.g. '5') or a percentage (e.g. '50%'). @@ -757,15 +742,10 @@ class AgentPoolUpgradeSettings(msrest.serialization.Model): """ _attribute_map = { - 'max_surge': {'key': 'maxSurge', 'type': 'str'}, + "max_surge": {"key": "maxSurge", "type": "str"}, } - def __init__( - self, - *, - max_surge: Optional[str] = None, - **kwargs - ): + def __init__(self, *, max_surge: Optional[str] = None, **kwargs): """ :keyword max_surge: This can either be set to an integer (e.g. '5') or a percentage (e.g. '50%'). If a percentage is specified, it is the percentage of the total agent pool size at the @@ -774,11 +754,11 @@ def __init__( https://docs.microsoft.com/azure/aks/upgrade-cluster#customize-node-surge-upgrade. :paramtype max_surge: str """ - super(AgentPoolUpgradeSettings, self).__init__(**kwargs) + super().__init__(**kwargs) self.max_surge = max_surge -class AzureKeyVaultKms(msrest.serialization.Model): +class AzureKeyVaultKms(_serialization.Model): """Azure Key Vault key management service settings for the security profile. :ivar enabled: Whether to enable Azure Key Vault key management service. The default is false. @@ -792,17 +772,11 @@ class AzureKeyVaultKms(msrest.serialization.Model): """ _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'key_id': {'key': 'keyId', 'type': 'str'}, + "enabled": {"key": "enabled", "type": "bool"}, + "key_id": {"key": "keyId", "type": "str"}, } - def __init__( - self, - *, - enabled: Optional[bool] = None, - key_id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, enabled: Optional[bool] = None, key_id: Optional[str] = None, **kwargs): """ :keyword enabled: Whether to enable Azure Key Vault key management service. The default is false. @@ -814,12 +788,12 @@ def __init__( disabled, leave the field empty. :paramtype key_id: str """ - super(AzureKeyVaultKms, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.key_id = key_id -class CloudErrorBody(msrest.serialization.Model): +class CloudErrorBody(_serialization.Model): """An error response from the Container service. :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed @@ -836,10 +810,10 @@ class CloudErrorBody(msrest.serialization.Model): """ _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[CloudErrorBody]"}, } def __init__( @@ -865,88 +839,77 @@ def __init__( :paramtype details: list[~azure.mgmt.containerservice.v2022_02_02_preview.models.CloudErrorBody] """ - super(CloudErrorBody, self).__init__(**kwargs) + super().__init__(**kwargs) self.code = code self.message = message self.target = target self.details = details -class ContainerServiceDiagnosticsProfile(msrest.serialization.Model): +class ContainerServiceDiagnosticsProfile(_serialization.Model): """Profile for diagnostics on the container service cluster. All required parameters must be populated in order to send to Azure. - :ivar vm_diagnostics: Required. Profile for diagnostics on the container service VMs. + :ivar vm_diagnostics: Profile for diagnostics on the container service VMs. Required. :vartype vm_diagnostics: ~azure.mgmt.containerservice.v2022_02_02_preview.models.ContainerServiceVMDiagnostics """ _validation = { - 'vm_diagnostics': {'required': True}, + "vm_diagnostics": {"required": True}, } _attribute_map = { - 'vm_diagnostics': {'key': 'vmDiagnostics', 'type': 'ContainerServiceVMDiagnostics'}, + "vm_diagnostics": {"key": "vmDiagnostics", "type": "ContainerServiceVMDiagnostics"}, } - def __init__( - self, - *, - vm_diagnostics: "_models.ContainerServiceVMDiagnostics", - **kwargs - ): + def __init__(self, *, vm_diagnostics: "_models.ContainerServiceVMDiagnostics", **kwargs): """ - :keyword vm_diagnostics: Required. Profile for diagnostics on the container service VMs. + :keyword vm_diagnostics: Profile for diagnostics on the container service VMs. Required. :paramtype vm_diagnostics: ~azure.mgmt.containerservice.v2022_02_02_preview.models.ContainerServiceVMDiagnostics """ - super(ContainerServiceDiagnosticsProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.vm_diagnostics = vm_diagnostics -class ContainerServiceLinuxProfile(msrest.serialization.Model): +class ContainerServiceLinuxProfile(_serialization.Model): """Profile for Linux VMs in the container service cluster. All required parameters must be populated in order to send to Azure. - :ivar admin_username: Required. The administrator username to use for Linux VMs. + :ivar admin_username: The administrator username to use for Linux VMs. Required. :vartype admin_username: str - :ivar ssh: Required. The SSH configuration for Linux-based VMs running on Azure. + :ivar ssh: The SSH configuration for Linux-based VMs running on Azure. Required. :vartype ssh: ~azure.mgmt.containerservice.v2022_02_02_preview.models.ContainerServiceSshConfiguration """ _validation = { - 'admin_username': {'required': True, 'pattern': r'^[A-Za-z][-A-Za-z0-9_]*$'}, - 'ssh': {'required': True}, + "admin_username": {"required": True, "pattern": r"^[A-Za-z][-A-Za-z0-9_]*$"}, + "ssh": {"required": True}, } _attribute_map = { - 'admin_username': {'key': 'adminUsername', 'type': 'str'}, - 'ssh': {'key': 'ssh', 'type': 'ContainerServiceSshConfiguration'}, + "admin_username": {"key": "adminUsername", "type": "str"}, + "ssh": {"key": "ssh", "type": "ContainerServiceSshConfiguration"}, } - def __init__( - self, - *, - admin_username: str, - ssh: "_models.ContainerServiceSshConfiguration", - **kwargs - ): + def __init__(self, *, admin_username: str, ssh: "_models.ContainerServiceSshConfiguration", **kwargs): """ - :keyword admin_username: Required. The administrator username to use for Linux VMs. + :keyword admin_username: The administrator username to use for Linux VMs. Required. :paramtype admin_username: str - :keyword ssh: Required. The SSH configuration for Linux-based VMs running on Azure. + :keyword ssh: The SSH configuration for Linux-based VMs running on Azure. Required. :paramtype ssh: ~azure.mgmt.containerservice.v2022_02_02_preview.models.ContainerServiceSshConfiguration """ - super(ContainerServiceLinuxProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.admin_username = admin_username self.ssh = ssh -class ContainerServiceMasterProfile(msrest.serialization.Model): +class ContainerServiceMasterProfile(_serialization.Model): """Profile for the container service master. Variables are only populated by the server, and will be ignored when sending a request. @@ -954,11 +917,11 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar count: Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, - and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". + and 5. The default value is 1. Known values are: 1, 3, and 5. :vartype count: int or ~azure.mgmt.containerservice.v2022_02_02_preview.models.Count - :ivar dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. + :ivar dns_prefix: DNS prefix to be used to create the FQDN for the master pool. Required. :vartype dns_prefix: str - :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + :ivar vm_size: Size of agent VMs. Required. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -995,7 +958,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :vartype vm_size: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.ContainerServiceVMSizeTypes :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine @@ -1009,7 +972,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): :vartype first_consecutive_static_ip: str :ivar storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount" and "ManagedDisks". :vartype storage_profile: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.ContainerServiceStorageProfileTypes :ivar fqdn: FQDN for the master pool. @@ -1017,21 +980,21 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): """ _validation = { - 'dns_prefix': {'required': True}, - 'vm_size': {'required': True}, - 'os_disk_size_gb': {'maximum': 2048, 'minimum': 0}, - 'fqdn': {'readonly': True}, + "dns_prefix": {"required": True}, + "vm_size": {"required": True}, + "os_disk_size_gb": {"maximum": 2048, "minimum": 0}, + "fqdn": {"readonly": True}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'dns_prefix': {'key': 'dnsPrefix', 'type': 'str'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'first_consecutive_static_ip': {'key': 'firstConsecutiveStaticIP', 'type': 'str'}, - 'storage_profile': {'key': 'storageProfile', 'type': 'str'}, - 'fqdn': {'key': 'fqdn', 'type': 'str'}, + "count": {"key": "count", "type": "int"}, + "dns_prefix": {"key": "dnsPrefix", "type": "str"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "first_consecutive_static_ip": {"key": "firstConsecutiveStaticIP", "type": "str"}, + "storage_profile": {"key": "storageProfile", "type": "str"}, + "fqdn": {"key": "fqdn", "type": "str"}, } def __init__( @@ -1039,20 +1002,20 @@ def __init__( *, dns_prefix: str, vm_size: Union[str, "_models.ContainerServiceVMSizeTypes"], - count: Optional[Union[int, "_models.Count"]] = 1, + count: Union[int, "_models.Count"] = 1, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, - first_consecutive_static_ip: Optional[str] = "10.240.255.5", + first_consecutive_static_ip: str = "10.240.255.5", storage_profile: Optional[Union[str, "_models.ContainerServiceStorageProfileTypes"]] = None, **kwargs ): """ :keyword count: Number of masters (VMs) in the container service cluster. Allowed values are 1, - 3, and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". + 3, and 5. The default value is 1. Known values are: 1, 3, and 5. :paramtype count: int or ~azure.mgmt.containerservice.v2022_02_02_preview.models.Count - :keyword dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. + :keyword dns_prefix: DNS prefix to be used to create the FQDN for the master pool. Required. :paramtype dns_prefix: str - :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + :keyword vm_size: Size of agent VMs. Required. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -1089,7 +1052,7 @@ def __init__( "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :paramtype vm_size: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.ContainerServiceVMSizeTypes :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every @@ -1103,11 +1066,11 @@ def __init__( :paramtype first_consecutive_static_ip: str :keyword storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount" and "ManagedDisks". :paramtype storage_profile: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.ContainerServiceStorageProfileTypes """ - super(ContainerServiceMasterProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.dns_prefix = dns_prefix self.vm_size = vm_size @@ -1118,19 +1081,19 @@ def __init__( self.fqdn = None -class ContainerServiceNetworkProfile(msrest.serialization.Model): +class ContainerServiceNetworkProfile(_serialization.Model): # pylint: disable=too-many-instance-attributes """Profile of network configuration. :ivar network_plugin: Network plugin used for building the Kubernetes network. Known values - are: "azure", "kubenet", "none". Default value: "kubenet". + are: "azure", "kubenet", and "none". :vartype network_plugin: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.NetworkPlugin :ivar network_policy: Network policy used for building the Kubernetes network. Known values - are: "calico", "azure". + are: "calico" and "azure". :vartype network_policy: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.NetworkPolicy :ivar network_mode: This cannot be specified if networkPlugin is anything other than 'azure'. - Known values are: "transparent", "bridge". + Known values are: "transparent" and "bridge". :vartype network_mode: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.NetworkMode :ivar pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. @@ -1147,13 +1110,12 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): :ivar outbound_type: This can only be set at cluster creation time and cannot be changed later. For more information see `egress outbound type `_. Known values are: "loadBalancer", - "userDefinedRouting", "managedNATGateway", "userAssignedNATGateway". Default value: - "loadBalancer". + "userDefinedRouting", "managedNATGateway", and "userAssignedNATGateway". :vartype outbound_type: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.OutboundType :ivar load_balancer_sku: The default is 'standard'. See `Azure Load Balancer SKUs `_ for more information about the - differences between load balancer SKUs. Known values are: "standard", "basic". + differences between load balancer SKUs. Known values are: "standard" and "basic". :vartype load_balancer_sku: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.LoadBalancerSku :ivar load_balancer_profile: Profile of the cluster load balancer. @@ -1177,40 +1139,42 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): """ _validation = { - 'pod_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, - 'service_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, - 'dns_service_ip': {'pattern': r'^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$'}, - 'docker_bridge_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, + "pod_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, + "service_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, + "dns_service_ip": { + "pattern": r"^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$" + }, + "docker_bridge_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, } _attribute_map = { - 'network_plugin': {'key': 'networkPlugin', 'type': 'str'}, - 'network_policy': {'key': 'networkPolicy', 'type': 'str'}, - 'network_mode': {'key': 'networkMode', 'type': 'str'}, - 'pod_cidr': {'key': 'podCidr', 'type': 'str'}, - 'service_cidr': {'key': 'serviceCidr', 'type': 'str'}, - 'dns_service_ip': {'key': 'dnsServiceIP', 'type': 'str'}, - 'docker_bridge_cidr': {'key': 'dockerBridgeCidr', 'type': 'str'}, - 'outbound_type': {'key': 'outboundType', 'type': 'str'}, - 'load_balancer_sku': {'key': 'loadBalancerSku', 'type': 'str'}, - 'load_balancer_profile': {'key': 'loadBalancerProfile', 'type': 'ManagedClusterLoadBalancerProfile'}, - 'nat_gateway_profile': {'key': 'natGatewayProfile', 'type': 'ManagedClusterNATGatewayProfile'}, - 'pod_cidrs': {'key': 'podCidrs', 'type': '[str]'}, - 'service_cidrs': {'key': 'serviceCidrs', 'type': '[str]'}, - 'ip_families': {'key': 'ipFamilies', 'type': '[str]'}, + "network_plugin": {"key": "networkPlugin", "type": "str"}, + "network_policy": {"key": "networkPolicy", "type": "str"}, + "network_mode": {"key": "networkMode", "type": "str"}, + "pod_cidr": {"key": "podCidr", "type": "str"}, + "service_cidr": {"key": "serviceCidr", "type": "str"}, + "dns_service_ip": {"key": "dnsServiceIP", "type": "str"}, + "docker_bridge_cidr": {"key": "dockerBridgeCidr", "type": "str"}, + "outbound_type": {"key": "outboundType", "type": "str"}, + "load_balancer_sku": {"key": "loadBalancerSku", "type": "str"}, + "load_balancer_profile": {"key": "loadBalancerProfile", "type": "ManagedClusterLoadBalancerProfile"}, + "nat_gateway_profile": {"key": "natGatewayProfile", "type": "ManagedClusterNATGatewayProfile"}, + "pod_cidrs": {"key": "podCidrs", "type": "[str]"}, + "service_cidrs": {"key": "serviceCidrs", "type": "[str]"}, + "ip_families": {"key": "ipFamilies", "type": "[str]"}, } def __init__( self, *, - network_plugin: Optional[Union[str, "_models.NetworkPlugin"]] = "kubenet", + network_plugin: Union[str, "_models.NetworkPlugin"] = "kubenet", network_policy: Optional[Union[str, "_models.NetworkPolicy"]] = None, network_mode: Optional[Union[str, "_models.NetworkMode"]] = None, - pod_cidr: Optional[str] = "10.244.0.0/16", - service_cidr: Optional[str] = "10.0.0.0/16", - dns_service_ip: Optional[str] = "10.0.0.10", - docker_bridge_cidr: Optional[str] = "172.17.0.1/16", - outbound_type: Optional[Union[str, "_models.OutboundType"]] = "loadBalancer", + pod_cidr: str = "10.244.0.0/16", + service_cidr: str = "10.0.0.0/16", + dns_service_ip: str = "10.0.0.10", + docker_bridge_cidr: str = "172.17.0.1/16", + outbound_type: Union[str, "_models.OutboundType"] = "loadBalancer", load_balancer_sku: Optional[Union[str, "_models.LoadBalancerSku"]] = None, load_balancer_profile: Optional["_models.ManagedClusterLoadBalancerProfile"] = None, nat_gateway_profile: Optional["_models.ManagedClusterNATGatewayProfile"] = None, @@ -1221,15 +1185,15 @@ def __init__( ): """ :keyword network_plugin: Network plugin used for building the Kubernetes network. Known values - are: "azure", "kubenet", "none". Default value: "kubenet". + are: "azure", "kubenet", and "none". :paramtype network_plugin: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.NetworkPlugin :keyword network_policy: Network policy used for building the Kubernetes network. Known values - are: "calico", "azure". + are: "calico" and "azure". :paramtype network_policy: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.NetworkPolicy :keyword network_mode: This cannot be specified if networkPlugin is anything other than - 'azure'. Known values are: "transparent", "bridge". + 'azure'. Known values are: "transparent" and "bridge". :paramtype network_mode: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.NetworkMode :keyword pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. @@ -1246,13 +1210,12 @@ def __init__( :keyword outbound_type: This can only be set at cluster creation time and cannot be changed later. For more information see `egress outbound type `_. Known values are: "loadBalancer", - "userDefinedRouting", "managedNATGateway", "userAssignedNATGateway". Default value: - "loadBalancer". + "userDefinedRouting", "managedNATGateway", and "userAssignedNATGateway". :paramtype outbound_type: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.OutboundType :keyword load_balancer_sku: The default is 'standard'. See `Azure Load Balancer SKUs `_ for more information about the - differences between load balancer SKUs. Known values are: "standard", "basic". + differences between load balancer SKUs. Known values are: "standard" and "basic". :paramtype load_balancer_sku: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.LoadBalancerSku :keyword load_balancer_profile: Profile of the cluster load balancer. @@ -1274,7 +1237,7 @@ def __init__( :paramtype ip_families: list[str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.IpFamily] """ - super(ContainerServiceNetworkProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.network_plugin = network_plugin self.network_policy = network_policy self.network_mode = network_mode @@ -1291,113 +1254,98 @@ def __init__( self.ip_families = ip_families -class ContainerServiceSshConfiguration(msrest.serialization.Model): +class ContainerServiceSshConfiguration(_serialization.Model): """SSH configuration for Linux-based VMs running on Azure. All required parameters must be populated in order to send to Azure. - :ivar public_keys: Required. The list of SSH public keys used to authenticate with Linux-based - VMs. A maximum of 1 key may be specified. + :ivar public_keys: The list of SSH public keys used to authenticate with Linux-based VMs. A + maximum of 1 key may be specified. Required. :vartype public_keys: list[~azure.mgmt.containerservice.v2022_02_02_preview.models.ContainerServiceSshPublicKey] """ _validation = { - 'public_keys': {'required': True}, + "public_keys": {"required": True}, } _attribute_map = { - 'public_keys': {'key': 'publicKeys', 'type': '[ContainerServiceSshPublicKey]'}, + "public_keys": {"key": "publicKeys", "type": "[ContainerServiceSshPublicKey]"}, } - def __init__( - self, - *, - public_keys: List["_models.ContainerServiceSshPublicKey"], - **kwargs - ): + def __init__(self, *, public_keys: List["_models.ContainerServiceSshPublicKey"], **kwargs): """ - :keyword public_keys: Required. The list of SSH public keys used to authenticate with - Linux-based VMs. A maximum of 1 key may be specified. + :keyword public_keys: The list of SSH public keys used to authenticate with Linux-based VMs. A + maximum of 1 key may be specified. Required. :paramtype public_keys: list[~azure.mgmt.containerservice.v2022_02_02_preview.models.ContainerServiceSshPublicKey] """ - super(ContainerServiceSshConfiguration, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_keys = public_keys -class ContainerServiceSshPublicKey(msrest.serialization.Model): +class ContainerServiceSshPublicKey(_serialization.Model): """Contains information about SSH certificate public key data. All required parameters must be populated in order to send to Azure. - :ivar key_data: Required. Certificate public key used to authenticate with VMs through SSH. The - certificate must be in PEM format with or without headers. + :ivar key_data: Certificate public key used to authenticate with VMs through SSH. The + certificate must be in PEM format with or without headers. Required. :vartype key_data: str """ _validation = { - 'key_data': {'required': True}, + "key_data": {"required": True}, } _attribute_map = { - 'key_data': {'key': 'keyData', 'type': 'str'}, + "key_data": {"key": "keyData", "type": "str"}, } - def __init__( - self, - *, - key_data: str, - **kwargs - ): + def __init__(self, *, key_data: str, **kwargs): """ - :keyword key_data: Required. Certificate public key used to authenticate with VMs through SSH. - The certificate must be in PEM format with or without headers. + :keyword key_data: Certificate public key used to authenticate with VMs through SSH. The + certificate must be in PEM format with or without headers. Required. :paramtype key_data: str """ - super(ContainerServiceSshPublicKey, self).__init__(**kwargs) + super().__init__(**kwargs) self.key_data = key_data -class ContainerServiceVMDiagnostics(msrest.serialization.Model): +class ContainerServiceVMDiagnostics(_serialization.Model): """Profile for diagnostics on the container service VMs. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar enabled: Required. Whether the VM diagnostic agent is provisioned on the VM. + :ivar enabled: Whether the VM diagnostic agent is provisioned on the VM. Required. :vartype enabled: bool :ivar storage_uri: The URI of the storage account where diagnostics are stored. :vartype storage_uri: str """ _validation = { - 'enabled': {'required': True}, - 'storage_uri': {'readonly': True}, + "enabled": {"required": True}, + "storage_uri": {"readonly": True}, } _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'storage_uri': {'key': 'storageUri', 'type': 'str'}, + "enabled": {"key": "enabled", "type": "bool"}, + "storage_uri": {"key": "storageUri", "type": "str"}, } - def __init__( - self, - *, - enabled: bool, - **kwargs - ): + def __init__(self, *, enabled: bool, **kwargs): """ - :keyword enabled: Required. Whether the VM diagnostic agent is provisioned on the VM. + :keyword enabled: Whether the VM diagnostic agent is provisioned on the VM. Required. :paramtype enabled: bool """ - super(ContainerServiceVMDiagnostics, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.storage_uri = None -class CreationData(msrest.serialization.Model): +class CreationData(_serialization.Model): """Data used when creating a target resource from a source resource. :ivar source_resource_id: This is the ARM ID of the source object to be used to create the @@ -1406,25 +1354,20 @@ class CreationData(msrest.serialization.Model): """ _attribute_map = { - 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, + "source_resource_id": {"key": "sourceResourceId", "type": "str"}, } - def __init__( - self, - *, - source_resource_id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, source_resource_id: Optional[str] = None, **kwargs): """ :keyword source_resource_id: This is the ARM ID of the source object to be used to create the target object. :paramtype source_resource_id: str """ - super(CreationData, self).__init__(**kwargs) + super().__init__(**kwargs) self.source_resource_id = source_resource_id -class CredentialResult(msrest.serialization.Model): +class CredentialResult(_serialization.Model): """The credential result response. Variables are only populated by the server, and will be ignored when sending a request. @@ -1432,31 +1375,27 @@ class CredentialResult(msrest.serialization.Model): :ivar name: The name of the credential. :vartype name: str :ivar value: Base64-encoded Kubernetes configuration file. - :vartype value: bytearray + :vartype value: bytes """ _validation = { - 'name': {'readonly': True}, - 'value': {'readonly': True}, + "name": {"readonly": True}, + "value": {"readonly": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'bytearray'}, + "name": {"key": "name", "type": "str"}, + "value": {"key": "value", "type": "bytearray"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(CredentialResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.name = None self.value = None -class CredentialResults(msrest.serialization.Model): +class CredentialResults(_serialization.Model): """The list credential result response. Variables are only populated by the server, and will be ignored when sending a request. @@ -1467,24 +1406,20 @@ class CredentialResults(msrest.serialization.Model): """ _validation = { - 'kubeconfigs': {'readonly': True}, + "kubeconfigs": {"readonly": True}, } _attribute_map = { - 'kubeconfigs': {'key': 'kubeconfigs', 'type': '[CredentialResult]'}, + "kubeconfigs": {"key": "kubeconfigs", "type": "[CredentialResult]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(CredentialResults, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.kubeconfigs = None -class EndpointDependency(msrest.serialization.Model): +class EndpointDependency(_serialization.Model): """A domain name that AKS agent nodes are reaching at. :ivar domain_name: The domain name of the dependency. @@ -1495,8 +1430,8 @@ class EndpointDependency(msrest.serialization.Model): """ _attribute_map = { - 'domain_name': {'key': 'domainName', 'type': 'str'}, - 'endpoint_details': {'key': 'endpointDetails', 'type': '[EndpointDetail]'}, + "domain_name": {"key": "domainName", "type": "str"}, + "endpoint_details": {"key": "endpointDetails", "type": "[EndpointDetail]"}, } def __init__( @@ -1513,12 +1448,12 @@ def __init__( :paramtype endpoint_details: list[~azure.mgmt.containerservice.v2022_02_02_preview.models.EndpointDetail] """ - super(EndpointDependency, self).__init__(**kwargs) + super().__init__(**kwargs) self.domain_name = domain_name self.endpoint_details = endpoint_details -class EndpointDetail(msrest.serialization.Model): +class EndpointDetail(_serialization.Model): """connect information from the AKS agent nodes to a single endpoint. :ivar ip_address: An IP Address that Domain Name currently resolves to. @@ -1532,10 +1467,10 @@ class EndpointDetail(msrest.serialization.Model): """ _attribute_map = { - 'ip_address': {'key': 'ipAddress', 'type': 'str'}, - 'port': {'key': 'port', 'type': 'int'}, - 'protocol': {'key': 'protocol', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, + "ip_address": {"key": "ipAddress", "type": "str"}, + "port": {"key": "port", "type": "int"}, + "protocol": {"key": "protocol", "type": "str"}, + "description": {"key": "description", "type": "str"}, } def __init__( @@ -1557,26 +1492,26 @@ def __init__( :keyword description: Description of the detail. :paramtype description: str """ - super(EndpointDetail, self).__init__(**kwargs) + super().__init__(**kwargs) self.ip_address = ip_address self.port = port self.protocol = protocol self.description = description -class ExtendedLocation(msrest.serialization.Model): +class ExtendedLocation(_serialization.Model): """The complex type of the extended location. :ivar name: The name of the extended location. :vartype name: str - :ivar type: The type of the extended location. Known values are: "EdgeZone". + :ivar type: The type of the extended location. "EdgeZone" :vartype type: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.ExtendedLocationTypes """ _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, } def __init__( @@ -1589,16 +1524,16 @@ def __init__( """ :keyword name: The name of the extended location. :paramtype name: str - :keyword type: The type of the extended location. Known values are: "EdgeZone". + :keyword type: The type of the extended location. "EdgeZone" :paramtype type: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.ExtendedLocationTypes """ - super(ExtendedLocation, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.type = type -class KubeletConfig(msrest.serialization.Model): +class KubeletConfig(_serialization.Model): # pylint: disable=too-many-instance-attributes """See `AKS custom node configuration `_ for more details. :ivar cpu_manager_policy: The default is 'none'. See `Kubernetes CPU management policies @@ -1638,21 +1573,21 @@ class KubeletConfig(msrest.serialization.Model): """ _validation = { - 'container_log_max_files': {'minimum': 2}, + "container_log_max_files": {"minimum": 2}, } _attribute_map = { - 'cpu_manager_policy': {'key': 'cpuManagerPolicy', 'type': 'str'}, - 'cpu_cfs_quota': {'key': 'cpuCfsQuota', 'type': 'bool'}, - 'cpu_cfs_quota_period': {'key': 'cpuCfsQuotaPeriod', 'type': 'str'}, - 'image_gc_high_threshold': {'key': 'imageGcHighThreshold', 'type': 'int'}, - 'image_gc_low_threshold': {'key': 'imageGcLowThreshold', 'type': 'int'}, - 'topology_manager_policy': {'key': 'topologyManagerPolicy', 'type': 'str'}, - 'allowed_unsafe_sysctls': {'key': 'allowedUnsafeSysctls', 'type': '[str]'}, - 'fail_swap_on': {'key': 'failSwapOn', 'type': 'bool'}, - 'container_log_max_size_mb': {'key': 'containerLogMaxSizeMB', 'type': 'int'}, - 'container_log_max_files': {'key': 'containerLogMaxFiles', 'type': 'int'}, - 'pod_max_pids': {'key': 'podMaxPids', 'type': 'int'}, + "cpu_manager_policy": {"key": "cpuManagerPolicy", "type": "str"}, + "cpu_cfs_quota": {"key": "cpuCfsQuota", "type": "bool"}, + "cpu_cfs_quota_period": {"key": "cpuCfsQuotaPeriod", "type": "str"}, + "image_gc_high_threshold": {"key": "imageGcHighThreshold", "type": "int"}, + "image_gc_low_threshold": {"key": "imageGcLowThreshold", "type": "int"}, + "topology_manager_policy": {"key": "topologyManagerPolicy", "type": "str"}, + "allowed_unsafe_sysctls": {"key": "allowedUnsafeSysctls", "type": "[str]"}, + "fail_swap_on": {"key": "failSwapOn", "type": "bool"}, + "container_log_max_size_mb": {"key": "containerLogMaxSizeMB", "type": "int"}, + "container_log_max_files": {"key": "containerLogMaxFiles", "type": "int"}, + "pod_max_pids": {"key": "podMaxPids", "type": "int"}, } def __init__( @@ -1707,7 +1642,7 @@ def __init__( :keyword pod_max_pids: The maximum number of processes per pod. :paramtype pod_max_pids: int """ - super(KubeletConfig, self).__init__(**kwargs) + super().__init__(**kwargs) self.cpu_manager_policy = cpu_manager_policy self.cpu_cfs_quota = cpu_cfs_quota self.cpu_cfs_quota_period = cpu_cfs_quota_period @@ -1721,7 +1656,7 @@ def __init__( self.pod_max_pids = pod_max_pids -class LinuxOSConfig(msrest.serialization.Model): +class LinuxOSConfig(_serialization.Model): """See `AKS custom node configuration `_ for more details. :ivar sysctls: Sysctl settings for Linux agent nodes. @@ -1740,10 +1675,10 @@ class LinuxOSConfig(msrest.serialization.Model): """ _attribute_map = { - 'sysctls': {'key': 'sysctls', 'type': 'SysctlConfig'}, - 'transparent_huge_page_enabled': {'key': 'transparentHugePageEnabled', 'type': 'str'}, - 'transparent_huge_page_defrag': {'key': 'transparentHugePageDefrag', 'type': 'str'}, - 'swap_file_size_mb': {'key': 'swapFileSizeMB', 'type': 'int'}, + "sysctls": {"key": "sysctls", "type": "SysctlConfig"}, + "transparent_huge_page_enabled": {"key": "transparentHugePageEnabled", "type": "str"}, + "transparent_huge_page_defrag": {"key": "transparentHugePageDefrag", "type": "str"}, + "swap_file_size_mb": {"key": "swapFileSizeMB", "type": "int"}, } def __init__( @@ -1770,7 +1705,7 @@ def __init__( :keyword swap_file_size_mb: The size in MB of a swap file that will be created on each node. :paramtype swap_file_size_mb: int """ - super(LinuxOSConfig, self).__init__(**kwargs) + super().__init__(**kwargs) self.sysctls = sysctls self.transparent_huge_page_enabled = transparent_huge_page_enabled self.transparent_huge_page_defrag = transparent_huge_page_defrag @@ -1800,19 +1735,19 @@ class MaintenanceConfiguration(SubResource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, + "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'}, - 'time_in_week': {'key': 'properties.timeInWeek', 'type': '[TimeInWeek]'}, - 'not_allowed_time': {'key': 'properties.notAllowedTime', 'type': '[TimeSpan]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "time_in_week": {"key": "properties.timeInWeek", "type": "[TimeInWeek]"}, + "not_allowed_time": {"key": "properties.notAllowedTime", "type": "[TimeSpan]"}, } def __init__( @@ -1831,13 +1766,13 @@ def __init__( :paramtype not_allowed_time: list[~azure.mgmt.containerservice.v2022_02_02_preview.models.TimeSpan] """ - super(MaintenanceConfiguration, self).__init__(**kwargs) + super().__init__(**kwargs) self.system_data = None self.time_in_week = time_in_week self.not_allowed_time = not_allowed_time -class MaintenanceConfigurationListResult(msrest.serialization.Model): +class MaintenanceConfigurationListResult(_serialization.Model): """The response from the List maintenance configurations operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -1850,31 +1785,26 @@ class MaintenanceConfigurationListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[MaintenanceConfiguration]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[MaintenanceConfiguration]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.MaintenanceConfiguration"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.MaintenanceConfiguration"]] = None, **kwargs): """ :keyword value: The list of maintenance configurations. :paramtype value: list[~azure.mgmt.containerservice.v2022_02_02_preview.models.MaintenanceConfiguration] """ - super(MaintenanceConfigurationListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class Resource(msrest.serialization.Model): +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. @@ -1892,43 +1822,37 @@ class Resource(msrest.serialization.Model): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.containerservice.v2022_02_02_preview.models.SystemData - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'location': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] """ - super(Resource, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -1937,7 +1861,7 @@ def __init__( self.tags = tags -class ManagedCluster(Resource): +class ManagedCluster(Resource): # pylint: disable=too-many-instance-attributes """Managed cluster. Variables are only populated by the server, and will be ignored when sending a request. @@ -1955,9 +1879,9 @@ class ManagedCluster(Resource): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.containerservice.v2022_02_02_preview.models.SystemData - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar sku: The managed cluster SKU. :vartype sku: ~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedClusterSKU @@ -2065,72 +1989,81 @@ class ManagedCluster(Resource): :vartype security_profile: ~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedClusterSecurityProfile :ivar public_network_access: Allow or deny public network access for AKS. Known values are: - "Enabled", "Disabled". + "Enabled" and "Disabled". :vartype public_network_access: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.PublicNetworkAccess """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'location': {'required': True}, - 'provisioning_state': {'readonly': True}, - 'power_state': {'readonly': True}, - 'max_agent_pools': {'readonly': True}, - 'current_kubernetes_version': {'readonly': True}, - 'fqdn': {'readonly': True}, - 'private_fqdn': {'readonly': True}, - 'azure_portal_fqdn': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, + "provisioning_state": {"readonly": True}, + "power_state": {"readonly": True}, + "max_agent_pools": {"readonly": True}, + "current_kubernetes_version": {"readonly": True}, + "fqdn": {"readonly": True}, + "private_fqdn": {"readonly": True}, + "azure_portal_fqdn": {"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'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'ManagedClusterSKU'}, - 'extended_location': {'key': 'extendedLocation', 'type': 'ExtendedLocation'}, - 'identity': {'key': 'identity', 'type': 'ManagedClusterIdentity'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'power_state': {'key': 'properties.powerState', 'type': 'PowerState'}, - 'max_agent_pools': {'key': 'properties.maxAgentPools', 'type': 'int'}, - 'kubernetes_version': {'key': 'properties.kubernetesVersion', 'type': 'str'}, - 'current_kubernetes_version': {'key': 'properties.currentKubernetesVersion', 'type': 'str'}, - 'dns_prefix': {'key': 'properties.dnsPrefix', 'type': 'str'}, - 'fqdn_subdomain': {'key': 'properties.fqdnSubdomain', 'type': 'str'}, - 'fqdn': {'key': 'properties.fqdn', 'type': 'str'}, - 'private_fqdn': {'key': 'properties.privateFQDN', 'type': 'str'}, - 'azure_portal_fqdn': {'key': 'properties.azurePortalFQDN', 'type': 'str'}, - 'agent_pool_profiles': {'key': 'properties.agentPoolProfiles', 'type': '[ManagedClusterAgentPoolProfile]'}, - 'linux_profile': {'key': 'properties.linuxProfile', 'type': 'ContainerServiceLinuxProfile'}, - 'windows_profile': {'key': 'properties.windowsProfile', 'type': 'ManagedClusterWindowsProfile'}, - 'service_principal_profile': {'key': 'properties.servicePrincipalProfile', 'type': 'ManagedClusterServicePrincipalProfile'}, - 'addon_profiles': {'key': 'properties.addonProfiles', 'type': '{ManagedClusterAddonProfile}'}, - 'pod_identity_profile': {'key': 'properties.podIdentityProfile', 'type': 'ManagedClusterPodIdentityProfile'}, - 'oidc_issuer_profile': {'key': 'properties.oidcIssuerProfile', 'type': 'ManagedClusterOIDCIssuerProfile'}, - 'node_resource_group': {'key': 'properties.nodeResourceGroup', 'type': 'str'}, - 'enable_rbac': {'key': 'properties.enableRBAC', 'type': 'bool'}, - 'enable_pod_security_policy': {'key': 'properties.enablePodSecurityPolicy', 'type': 'bool'}, - 'enable_namespace_resources': {'key': 'properties.enableNamespaceResources', 'type': 'bool'}, - 'network_profile': {'key': 'properties.networkProfile', 'type': 'ContainerServiceNetworkProfile'}, - 'aad_profile': {'key': 'properties.aadProfile', 'type': 'ManagedClusterAADProfile'}, - 'auto_upgrade_profile': {'key': 'properties.autoUpgradeProfile', 'type': 'ManagedClusterAutoUpgradeProfile'}, - 'auto_scaler_profile': {'key': 'properties.autoScalerProfile', 'type': 'ManagedClusterPropertiesAutoScalerProfile'}, - 'api_server_access_profile': {'key': 'properties.apiServerAccessProfile', 'type': 'ManagedClusterAPIServerAccessProfile'}, - 'disk_encryption_set_id': {'key': 'properties.diskEncryptionSetID', 'type': 'str'}, - 'identity_profile': {'key': 'properties.identityProfile', 'type': '{UserAssignedIdentity}'}, - 'private_link_resources': {'key': 'properties.privateLinkResources', 'type': '[PrivateLinkResource]'}, - 'disable_local_accounts': {'key': 'properties.disableLocalAccounts', 'type': 'bool'}, - 'http_proxy_config': {'key': 'properties.httpProxyConfig', 'type': 'ManagedClusterHTTPProxyConfig'}, - 'security_profile': {'key': 'properties.securityProfile', 'type': 'ManagedClusterSecurityProfile'}, - 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, - } - - def __init__( + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "sku": {"key": "sku", "type": "ManagedClusterSKU"}, + "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, + "identity": {"key": "identity", "type": "ManagedClusterIdentity"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "power_state": {"key": "properties.powerState", "type": "PowerState"}, + "max_agent_pools": {"key": "properties.maxAgentPools", "type": "int"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "current_kubernetes_version": {"key": "properties.currentKubernetesVersion", "type": "str"}, + "dns_prefix": {"key": "properties.dnsPrefix", "type": "str"}, + "fqdn_subdomain": {"key": "properties.fqdnSubdomain", "type": "str"}, + "fqdn": {"key": "properties.fqdn", "type": "str"}, + "private_fqdn": {"key": "properties.privateFQDN", "type": "str"}, + "azure_portal_fqdn": {"key": "properties.azurePortalFQDN", "type": "str"}, + "agent_pool_profiles": {"key": "properties.agentPoolProfiles", "type": "[ManagedClusterAgentPoolProfile]"}, + "linux_profile": {"key": "properties.linuxProfile", "type": "ContainerServiceLinuxProfile"}, + "windows_profile": {"key": "properties.windowsProfile", "type": "ManagedClusterWindowsProfile"}, + "service_principal_profile": { + "key": "properties.servicePrincipalProfile", + "type": "ManagedClusterServicePrincipalProfile", + }, + "addon_profiles": {"key": "properties.addonProfiles", "type": "{ManagedClusterAddonProfile}"}, + "pod_identity_profile": {"key": "properties.podIdentityProfile", "type": "ManagedClusterPodIdentityProfile"}, + "oidc_issuer_profile": {"key": "properties.oidcIssuerProfile", "type": "ManagedClusterOIDCIssuerProfile"}, + "node_resource_group": {"key": "properties.nodeResourceGroup", "type": "str"}, + "enable_rbac": {"key": "properties.enableRBAC", "type": "bool"}, + "enable_pod_security_policy": {"key": "properties.enablePodSecurityPolicy", "type": "bool"}, + "enable_namespace_resources": {"key": "properties.enableNamespaceResources", "type": "bool"}, + "network_profile": {"key": "properties.networkProfile", "type": "ContainerServiceNetworkProfile"}, + "aad_profile": {"key": "properties.aadProfile", "type": "ManagedClusterAADProfile"}, + "auto_upgrade_profile": {"key": "properties.autoUpgradeProfile", "type": "ManagedClusterAutoUpgradeProfile"}, + "auto_scaler_profile": { + "key": "properties.autoScalerProfile", + "type": "ManagedClusterPropertiesAutoScalerProfile", + }, + "api_server_access_profile": { + "key": "properties.apiServerAccessProfile", + "type": "ManagedClusterAPIServerAccessProfile", + }, + "disk_encryption_set_id": {"key": "properties.diskEncryptionSetID", "type": "str"}, + "identity_profile": {"key": "properties.identityProfile", "type": "{UserAssignedIdentity}"}, + "private_link_resources": {"key": "properties.privateLinkResources", "type": "[PrivateLinkResource]"}, + "disable_local_accounts": {"key": "properties.disableLocalAccounts", "type": "bool"}, + "http_proxy_config": {"key": "properties.httpProxyConfig", "type": "ManagedClusterHTTPProxyConfig"}, + "security_profile": {"key": "properties.securityProfile", "type": "ManagedClusterSecurityProfile"}, + "public_network_access": {"key": "properties.publicNetworkAccess", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, location: str, @@ -2167,9 +2100,9 @@ def __init__( **kwargs ): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword sku: The managed cluster SKU. :paramtype sku: ~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedClusterSKU @@ -2262,11 +2195,11 @@ def __init__( :paramtype security_profile: ~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedClusterSecurityProfile :keyword public_network_access: Allow or deny public network access for AKS. Known values are: - "Enabled", "Disabled". + "Enabled" and "Disabled". :paramtype public_network_access: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.PublicNetworkAccess """ - super(ManagedCluster, self).__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.sku = sku self.extended_location = extended_location self.identity = identity @@ -2305,7 +2238,7 @@ def __init__( self.public_network_access = public_network_access -class ManagedClusterAADProfile(msrest.serialization.Model): +class ManagedClusterAADProfile(_serialization.Model): """For more details see `managed AAD on AKS `_. :ivar managed: Whether to enable managed AAD. @@ -2327,13 +2260,13 @@ class ManagedClusterAADProfile(msrest.serialization.Model): """ _attribute_map = { - 'managed': {'key': 'managed', 'type': 'bool'}, - 'enable_azure_rbac': {'key': 'enableAzureRBAC', 'type': 'bool'}, - 'admin_group_object_i_ds': {'key': 'adminGroupObjectIDs', 'type': '[str]'}, - 'client_app_id': {'key': 'clientAppID', 'type': 'str'}, - 'server_app_id': {'key': 'serverAppID', 'type': 'str'}, - 'server_app_secret': {'key': 'serverAppSecret', 'type': 'str'}, - 'tenant_id': {'key': 'tenantID', 'type': 'str'}, + "managed": {"key": "managed", "type": "bool"}, + "enable_azure_rbac": {"key": "enableAzureRBAC", "type": "bool"}, + "admin_group_object_i_ds": {"key": "adminGroupObjectIDs", "type": "[str]"}, + "client_app_id": {"key": "clientAppID", "type": "str"}, + "server_app_id": {"key": "serverAppID", "type": "str"}, + "server_app_secret": {"key": "serverAppSecret", "type": "str"}, + "tenant_id": {"key": "tenantID", "type": "str"}, } def __init__( @@ -2366,7 +2299,7 @@ def __init__( tenant of the deployment subscription. :paramtype tenant_id: str """ - super(ManagedClusterAADProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.managed = managed self.enable_azure_rbac = enable_azure_rbac self.admin_group_object_i_ds = admin_group_object_i_ds @@ -2394,60 +2327,55 @@ class ManagedClusterAccessProfile(Resource): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.containerservice.v2022_02_02_preview.models.SystemData - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar kube_config: Base64-encoded Kubernetes configuration file. - :vartype kube_config: bytearray + :vartype kube_config: bytes """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'location': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'kube_config': {'key': 'properties.kubeConfig', 'type': 'bytearray'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "kube_config": {"key": "properties.kubeConfig", "type": "bytearray"}, } def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - kube_config: Optional[bytearray] = None, - **kwargs + self, *, location: str, tags: Optional[Dict[str, str]] = None, kube_config: Optional[bytes] = None, **kwargs ): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword kube_config: Base64-encoded Kubernetes configuration file. - :paramtype kube_config: bytearray + :paramtype kube_config: bytes """ - super(ManagedClusterAccessProfile, self).__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.kube_config = kube_config -class ManagedClusterAddonProfile(msrest.serialization.Model): +class ManagedClusterAddonProfile(_serialization.Model): """A Kubernetes add-on profile for a managed cluster. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar enabled: Required. Whether the add-on is enabled or not. + :ivar enabled: Whether the add-on is enabled or not. Required. :vartype enabled: bool :ivar config: Key-value pairs for configuring an add-on. :vartype config: dict[str, str] @@ -2457,36 +2385,30 @@ class ManagedClusterAddonProfile(msrest.serialization.Model): """ _validation = { - 'enabled': {'required': True}, - 'identity': {'readonly': True}, + "enabled": {"required": True}, + "identity": {"readonly": True}, } _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'config': {'key': 'config', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'ManagedClusterAddonProfileIdentity'}, + "enabled": {"key": "enabled", "type": "bool"}, + "config": {"key": "config", "type": "{str}"}, + "identity": {"key": "identity", "type": "ManagedClusterAddonProfileIdentity"}, } - def __init__( - self, - *, - enabled: bool, - config: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, enabled: bool, config: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword enabled: Required. Whether the add-on is enabled or not. + :keyword enabled: Whether the add-on is enabled or not. Required. :paramtype enabled: bool :keyword config: Key-value pairs for configuring an add-on. :paramtype config: dict[str, str] """ - super(ManagedClusterAddonProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.config = config self.identity = None -class UserAssignedIdentity(msrest.serialization.Model): +class UserAssignedIdentity(_serialization.Model): """Details about a user assigned identity. :ivar resource_id: The resource ID of the user assigned identity. @@ -2498,9 +2420,9 @@ class UserAssignedIdentity(msrest.serialization.Model): """ _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'object_id': {'key': 'objectId', 'type': 'str'}, + "resource_id": {"key": "resourceId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + "object_id": {"key": "objectId", "type": "str"}, } def __init__( @@ -2519,7 +2441,7 @@ def __init__( :keyword object_id: The object ID of the user assigned identity. :paramtype object_id: str """ - super(UserAssignedIdentity, self).__init__(**kwargs) + super().__init__(**kwargs) self.resource_id = resource_id self.client_id = client_id self.object_id = object_id @@ -2537,9 +2459,9 @@ class ManagedClusterAddonProfileIdentity(UserAssignedIdentity): """ _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'object_id': {'key': 'objectId', 'type': 'str'}, + "resource_id": {"key": "resourceId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + "object_id": {"key": "objectId", "type": "str"}, } def __init__( @@ -2558,10 +2480,10 @@ def __init__( :keyword object_id: The object ID of the user assigned identity. :paramtype object_id: str """ - super(ManagedClusterAddonProfileIdentity, self).__init__(resource_id=resource_id, client_id=client_id, object_id=object_id, **kwargs) + super().__init__(resource_id=resource_id, client_id=client_id, object_id=object_id, **kwargs) -class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): +class ManagedClusterAgentPoolProfileProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes """Properties for the container service agent pool profile. Variables are only populated by the server, and will be ignored when sending a request. @@ -2582,15 +2504,15 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.OSDiskType :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data - root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.KubeletDiskType :ivar workload_runtime: Determines the type of workload a node can run. Known values are: - "OCIContainer", "WasmWasi". + "OCIContainer" and "WasmWasi". :vartype workload_runtime: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.WorkloadRuntime :ivar message_of_the_day: A base64-encoded string which will be written to /etc/motd after @@ -2609,11 +2531,11 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :vartype pod_subnet_id: str :ivar max_pods: The maximum number of pods that can run on a node. :vartype max_pods: int - :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.OSType :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known - values are: "Ubuntu", "CBLMariner". + values are: "Ubuntu" and "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.OSSKU :ivar max_count: The maximum number of nodes for auto-scaling. :vartype max_count: int @@ -2622,15 +2544,15 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it - defaults to Delete. Known values are: "Delete", "Deallocate". + defaults to Delete. Known values are: "Delete" and "Deallocate". :vartype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.ScaleDownMode - :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", + :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets" and "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.AgentPoolType :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :vartype mode: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.AgentPoolMode :ivar orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -2665,20 +2587,18 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default - is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + is 'Regular'. Known values are: "Spot" and "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.ScaleSetPriority :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.ScaleSetEvictionPolicy :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :vartype spot_max_price: float - :ivar tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :ivar tags: The tags to be persisted on the agent pool virtual machine scale set. :vartype tags: dict[str, str] :ivar node_labels: The node labels to be persisted across all nodes in agent pool. :vartype node_labels: dict[str, str] @@ -2702,7 +2622,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): for more details. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.GPUInstanceProfile :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the node pool @@ -2719,57 +2639,57 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): """ _validation = { - 'os_disk_size_gb': {'maximum': 2048, 'minimum': 0}, - 'node_image_version': {'readonly': True}, - 'provisioning_state': {'readonly': True}, + "os_disk_size_gb": {"maximum": 2048, "minimum": 0}, + "node_image_version": {"readonly": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'os_disk_type': {'key': 'osDiskType', 'type': 'str'}, - 'kubelet_disk_type': {'key': 'kubeletDiskType', 'type': 'str'}, - 'workload_runtime': {'key': 'workloadRuntime', 'type': 'str'}, - 'message_of_the_day': {'key': 'messageOfTheDay', 'type': 'str'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'pod_subnet_id': {'key': 'podSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'maxPods', 'type': 'int'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'os_sku': {'key': 'osSKU', 'type': 'str'}, - 'max_count': {'key': 'maxCount', 'type': 'int'}, - 'min_count': {'key': 'minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'enableAutoScaling', 'type': 'bool'}, - 'scale_down_mode': {'key': 'scaleDownMode', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'mode': {'key': 'mode', 'type': 'str'}, - 'orchestrator_version': {'key': 'orchestratorVersion', 'type': 'str'}, - 'node_image_version': {'key': 'nodeImageVersion', 'type': 'str'}, - 'upgrade_settings': {'key': 'upgradeSettings', 'type': 'AgentPoolUpgradeSettings'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'power_state': {'key': 'powerState', 'type': 'PowerState'}, - 'availability_zones': {'key': 'availabilityZones', 'type': '[str]'}, - 'enable_node_public_ip': {'key': 'enableNodePublicIP', 'type': 'bool'}, - 'node_public_ip_prefix_id': {'key': 'nodePublicIPPrefixID', 'type': 'str'}, - 'scale_set_priority': {'key': 'scaleSetPriority', 'type': 'str'}, - 'scale_set_eviction_policy': {'key': 'scaleSetEvictionPolicy', 'type': 'str'}, - 'spot_max_price': {'key': 'spotMaxPrice', 'type': 'float'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'node_labels': {'key': 'nodeLabels', 'type': '{str}'}, - 'node_taints': {'key': 'nodeTaints', 'type': '[str]'}, - 'proximity_placement_group_id': {'key': 'proximityPlacementGroupID', 'type': 'str'}, - 'kubelet_config': {'key': 'kubeletConfig', 'type': 'KubeletConfig'}, - 'linux_os_config': {'key': 'linuxOSConfig', 'type': 'LinuxOSConfig'}, - 'enable_encryption_at_host': {'key': 'enableEncryptionAtHost', 'type': 'bool'}, - 'enable_ultra_ssd': {'key': 'enableUltraSSD', 'type': 'bool'}, - 'enable_fips': {'key': 'enableFIPS', 'type': 'bool'}, - 'gpu_instance_profile': {'key': 'gpuInstanceProfile', 'type': 'str'}, - 'creation_data': {'key': 'creationData', 'type': 'CreationData'}, - 'capacity_reservation_group_id': {'key': 'capacityReservationGroupID', 'type': 'str'}, - 'host_group_id': {'key': 'hostGroupID', 'type': 'str'}, - } - - def __init__( + "count": {"key": "count", "type": "int"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "os_disk_type": {"key": "osDiskType", "type": "str"}, + "kubelet_disk_type": {"key": "kubeletDiskType", "type": "str"}, + "workload_runtime": {"key": "workloadRuntime", "type": "str"}, + "message_of_the_day": {"key": "messageOfTheDay", "type": "str"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "pod_subnet_id": {"key": "podSubnetID", "type": "str"}, + "max_pods": {"key": "maxPods", "type": "int"}, + "os_type": {"key": "osType", "type": "str"}, + "os_sku": {"key": "osSKU", "type": "str"}, + "max_count": {"key": "maxCount", "type": "int"}, + "min_count": {"key": "minCount", "type": "int"}, + "enable_auto_scaling": {"key": "enableAutoScaling", "type": "bool"}, + "scale_down_mode": {"key": "scaleDownMode", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "mode": {"key": "mode", "type": "str"}, + "orchestrator_version": {"key": "orchestratorVersion", "type": "str"}, + "node_image_version": {"key": "nodeImageVersion", "type": "str"}, + "upgrade_settings": {"key": "upgradeSettings", "type": "AgentPoolUpgradeSettings"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "power_state": {"key": "powerState", "type": "PowerState"}, + "availability_zones": {"key": "availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "enableNodePublicIP", "type": "bool"}, + "node_public_ip_prefix_id": {"key": "nodePublicIPPrefixID", "type": "str"}, + "scale_set_priority": {"key": "scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "scaleSetEvictionPolicy", "type": "str"}, + "spot_max_price": {"key": "spotMaxPrice", "type": "float"}, + "tags": {"key": "tags", "type": "{str}"}, + "node_labels": {"key": "nodeLabels", "type": "{str}"}, + "node_taints": {"key": "nodeTaints", "type": "[str]"}, + "proximity_placement_group_id": {"key": "proximityPlacementGroupID", "type": "str"}, + "kubelet_config": {"key": "kubeletConfig", "type": "KubeletConfig"}, + "linux_os_config": {"key": "linuxOSConfig", "type": "LinuxOSConfig"}, + "enable_encryption_at_host": {"key": "enableEncryptionAtHost", "type": "bool"}, + "enable_ultra_ssd": {"key": "enableUltraSSD", "type": "bool"}, + "enable_fips": {"key": "enableFIPS", "type": "bool"}, + "gpu_instance_profile": {"key": "gpuInstanceProfile", "type": "str"}, + "creation_data": {"key": "creationData", "type": "CreationData"}, + "capacity_reservation_group_id": {"key": "capacityReservationGroupID", "type": "str"}, + "host_group_id": {"key": "hostGroupID", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, count: Optional[int] = None, @@ -2782,7 +2702,7 @@ def __init__( vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, @@ -2796,9 +2716,9 @@ def __init__( availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", - spot_max_price: Optional[float] = -1, + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", + spot_max_price: float = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, @@ -2831,15 +2751,15 @@ def __init__( larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.OSDiskType :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime - data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + data root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.KubeletDiskType :keyword workload_runtime: Determines the type of workload a node can run. Known values are: - "OCIContainer", "WasmWasi". + "OCIContainer" and "WasmWasi". :paramtype workload_runtime: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.WorkloadRuntime :keyword message_of_the_day: A base64-encoded string which will be written to /etc/motd after @@ -2858,11 +2778,11 @@ def __init__( :paramtype pod_subnet_id: str :keyword max_pods: The maximum number of pods that can run on a node. :paramtype max_pods: int - :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.OSType :keyword os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Known values are: "Ubuntu", "CBLMariner". + Known values are: "Ubuntu" and "CBLMariner". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.OSSKU :keyword max_count: The maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -2871,15 +2791,15 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, - it defaults to Delete. Known values are: "Delete", "Deallocate". + it defaults to Delete. Known values are: "Delete" and "Deallocate". :paramtype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.ScaleDownMode - :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", + :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.AgentPoolType :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.AgentPoolMode :keyword orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -2910,20 +2830,18 @@ def __init__( /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the - default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + default is 'Regular'. Known values are: "Spot" and "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.ScaleSetPriority :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.ScaleSetEvictionPolicy :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :paramtype spot_max_price: float - :keyword tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :keyword tags: The tags to be persisted on the agent pool virtual machine scale set. :paramtype tags: dict[str, str] :keyword node_labels: The node labels to be persisted across all nodes in agent pool. :paramtype node_labels: dict[str, str] @@ -2949,7 +2867,7 @@ def __init__( for more details. :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance - profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.GPUInstanceProfile @@ -2965,7 +2883,7 @@ def __init__( `_. :paramtype host_group_id: str """ - super(ManagedClusterAgentPoolProfileProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.vm_size = vm_size self.os_disk_size_gb = os_disk_size_gb @@ -3010,7 +2928,9 @@ def __init__( self.host_group_id = host_group_id -class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): +class ManagedClusterAgentPoolProfile( + ManagedClusterAgentPoolProfileProperties +): # pylint: disable=too-many-instance-attributes """Profile for the container service agent pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -3033,15 +2953,15 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.OSDiskType :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data - root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.KubeletDiskType :ivar workload_runtime: Determines the type of workload a node can run. Known values are: - "OCIContainer", "WasmWasi". + "OCIContainer" and "WasmWasi". :vartype workload_runtime: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.WorkloadRuntime :ivar message_of_the_day: A base64-encoded string which will be written to /etc/motd after @@ -3060,11 +2980,11 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :vartype pod_subnet_id: str :ivar max_pods: The maximum number of pods that can run on a node. :vartype max_pods: int - :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.OSType :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known - values are: "Ubuntu", "CBLMariner". + values are: "Ubuntu" and "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.OSSKU :ivar max_count: The maximum number of nodes for auto-scaling. :vartype max_count: int @@ -3073,15 +2993,15 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it - defaults to Delete. Known values are: "Delete", "Deallocate". + defaults to Delete. Known values are: "Delete" and "Deallocate". :vartype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.ScaleDownMode - :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", + :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets" and "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.AgentPoolType :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :vartype mode: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.AgentPoolMode :ivar orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -3116,20 +3036,18 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default - is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + is 'Regular'. Known values are: "Spot" and "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.ScaleSetPriority :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.ScaleSetEvictionPolicy :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :vartype spot_max_price: float - :ivar tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :ivar tags: The tags to be persisted on the agent pool virtual machine scale set. :vartype tags: dict[str, str] :ivar node_labels: The node labels to be persisted across all nodes in agent pool. :vartype node_labels: dict[str, str] @@ -3153,7 +3071,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): for more details. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.GPUInstanceProfile :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the node pool @@ -3167,64 +3085,64 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): For more information see `Azure dedicated hosts `_. :vartype host_group_id: str - :ivar name: Required. Windows agent pool names must be 6 characters or less. + :ivar name: Windows agent pool names must be 6 characters or less. Required. :vartype name: str """ _validation = { - 'os_disk_size_gb': {'maximum': 2048, 'minimum': 0}, - 'node_image_version': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'name': {'required': True, 'pattern': r'^[a-z][a-z0-9]{0,11}$'}, + "os_disk_size_gb": {"maximum": 2048, "minimum": 0}, + "node_image_version": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "name": {"required": True, "pattern": r"^[a-z][a-z0-9]{0,11}$"}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'os_disk_type': {'key': 'osDiskType', 'type': 'str'}, - 'kubelet_disk_type': {'key': 'kubeletDiskType', 'type': 'str'}, - 'workload_runtime': {'key': 'workloadRuntime', 'type': 'str'}, - 'message_of_the_day': {'key': 'messageOfTheDay', 'type': 'str'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'pod_subnet_id': {'key': 'podSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'maxPods', 'type': 'int'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'os_sku': {'key': 'osSKU', 'type': 'str'}, - 'max_count': {'key': 'maxCount', 'type': 'int'}, - 'min_count': {'key': 'minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'enableAutoScaling', 'type': 'bool'}, - 'scale_down_mode': {'key': 'scaleDownMode', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'mode': {'key': 'mode', 'type': 'str'}, - 'orchestrator_version': {'key': 'orchestratorVersion', 'type': 'str'}, - 'node_image_version': {'key': 'nodeImageVersion', 'type': 'str'}, - 'upgrade_settings': {'key': 'upgradeSettings', 'type': 'AgentPoolUpgradeSettings'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'power_state': {'key': 'powerState', 'type': 'PowerState'}, - 'availability_zones': {'key': 'availabilityZones', 'type': '[str]'}, - 'enable_node_public_ip': {'key': 'enableNodePublicIP', 'type': 'bool'}, - 'node_public_ip_prefix_id': {'key': 'nodePublicIPPrefixID', 'type': 'str'}, - 'scale_set_priority': {'key': 'scaleSetPriority', 'type': 'str'}, - 'scale_set_eviction_policy': {'key': 'scaleSetEvictionPolicy', 'type': 'str'}, - 'spot_max_price': {'key': 'spotMaxPrice', 'type': 'float'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'node_labels': {'key': 'nodeLabels', 'type': '{str}'}, - 'node_taints': {'key': 'nodeTaints', 'type': '[str]'}, - 'proximity_placement_group_id': {'key': 'proximityPlacementGroupID', 'type': 'str'}, - 'kubelet_config': {'key': 'kubeletConfig', 'type': 'KubeletConfig'}, - 'linux_os_config': {'key': 'linuxOSConfig', 'type': 'LinuxOSConfig'}, - 'enable_encryption_at_host': {'key': 'enableEncryptionAtHost', 'type': 'bool'}, - 'enable_ultra_ssd': {'key': 'enableUltraSSD', 'type': 'bool'}, - 'enable_fips': {'key': 'enableFIPS', 'type': 'bool'}, - 'gpu_instance_profile': {'key': 'gpuInstanceProfile', 'type': 'str'}, - 'creation_data': {'key': 'creationData', 'type': 'CreationData'}, - 'capacity_reservation_group_id': {'key': 'capacityReservationGroupID', 'type': 'str'}, - 'host_group_id': {'key': 'hostGroupID', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( + "count": {"key": "count", "type": "int"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "os_disk_type": {"key": "osDiskType", "type": "str"}, + "kubelet_disk_type": {"key": "kubeletDiskType", "type": "str"}, + "workload_runtime": {"key": "workloadRuntime", "type": "str"}, + "message_of_the_day": {"key": "messageOfTheDay", "type": "str"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "pod_subnet_id": {"key": "podSubnetID", "type": "str"}, + "max_pods": {"key": "maxPods", "type": "int"}, + "os_type": {"key": "osType", "type": "str"}, + "os_sku": {"key": "osSKU", "type": "str"}, + "max_count": {"key": "maxCount", "type": "int"}, + "min_count": {"key": "minCount", "type": "int"}, + "enable_auto_scaling": {"key": "enableAutoScaling", "type": "bool"}, + "scale_down_mode": {"key": "scaleDownMode", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "mode": {"key": "mode", "type": "str"}, + "orchestrator_version": {"key": "orchestratorVersion", "type": "str"}, + "node_image_version": {"key": "nodeImageVersion", "type": "str"}, + "upgrade_settings": {"key": "upgradeSettings", "type": "AgentPoolUpgradeSettings"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "power_state": {"key": "powerState", "type": "PowerState"}, + "availability_zones": {"key": "availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "enableNodePublicIP", "type": "bool"}, + "node_public_ip_prefix_id": {"key": "nodePublicIPPrefixID", "type": "str"}, + "scale_set_priority": {"key": "scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "scaleSetEvictionPolicy", "type": "str"}, + "spot_max_price": {"key": "spotMaxPrice", "type": "float"}, + "tags": {"key": "tags", "type": "{str}"}, + "node_labels": {"key": "nodeLabels", "type": "{str}"}, + "node_taints": {"key": "nodeTaints", "type": "[str]"}, + "proximity_placement_group_id": {"key": "proximityPlacementGroupID", "type": "str"}, + "kubelet_config": {"key": "kubeletConfig", "type": "KubeletConfig"}, + "linux_os_config": {"key": "linuxOSConfig", "type": "LinuxOSConfig"}, + "enable_encryption_at_host": {"key": "enableEncryptionAtHost", "type": "bool"}, + "enable_ultra_ssd": {"key": "enableUltraSSD", "type": "bool"}, + "enable_fips": {"key": "enableFIPS", "type": "bool"}, + "gpu_instance_profile": {"key": "gpuInstanceProfile", "type": "str"}, + "creation_data": {"key": "creationData", "type": "CreationData"}, + "capacity_reservation_group_id": {"key": "capacityReservationGroupID", "type": "str"}, + "host_group_id": {"key": "hostGroupID", "type": "str"}, + "name": {"key": "name", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, name: str, @@ -3238,7 +3156,7 @@ def __init__( vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, @@ -3252,9 +3170,9 @@ def __init__( availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", - spot_max_price: Optional[float] = -1, + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", + spot_max_price: float = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, @@ -3287,15 +3205,15 @@ def __init__( larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.OSDiskType :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime - data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + data root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.KubeletDiskType :keyword workload_runtime: Determines the type of workload a node can run. Known values are: - "OCIContainer", "WasmWasi". + "OCIContainer" and "WasmWasi". :paramtype workload_runtime: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.WorkloadRuntime :keyword message_of_the_day: A base64-encoded string which will be written to /etc/motd after @@ -3314,11 +3232,11 @@ def __init__( :paramtype pod_subnet_id: str :keyword max_pods: The maximum number of pods that can run on a node. :paramtype max_pods: int - :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.OSType :keyword os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Known values are: "Ubuntu", "CBLMariner". + Known values are: "Ubuntu" and "CBLMariner". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.OSSKU :keyword max_count: The maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -3327,15 +3245,15 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, - it defaults to Delete. Known values are: "Delete", "Deallocate". + it defaults to Delete. Known values are: "Delete" and "Deallocate". :paramtype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.ScaleDownMode - :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", + :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.AgentPoolType :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.AgentPoolMode :keyword orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -3366,20 +3284,18 @@ def __init__( /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the - default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + default is 'Regular'. Known values are: "Spot" and "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.ScaleSetPriority :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.ScaleSetEvictionPolicy :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :paramtype spot_max_price: float - :keyword tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :keyword tags: The tags to be persisted on the agent pool virtual machine scale set. :paramtype tags: dict[str, str] :keyword node_labels: The node labels to be persisted across all nodes in agent pool. :paramtype node_labels: dict[str, str] @@ -3405,7 +3321,7 @@ def __init__( for more details. :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance - profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.GPUInstanceProfile @@ -3420,14 +3336,56 @@ def __init__( For more information see `Azure dedicated hosts `_. :paramtype host_group_id: str - :keyword name: Required. Windows agent pool names must be 6 characters or less. + :keyword name: Windows agent pool names must be 6 characters or less. Required. :paramtype name: str """ - super(ManagedClusterAgentPoolProfile, self).__init__(count=count, vm_size=vm_size, os_disk_size_gb=os_disk_size_gb, os_disk_type=os_disk_type, kubelet_disk_type=kubelet_disk_type, workload_runtime=workload_runtime, message_of_the_day=message_of_the_day, vnet_subnet_id=vnet_subnet_id, pod_subnet_id=pod_subnet_id, max_pods=max_pods, os_type=os_type, os_sku=os_sku, max_count=max_count, min_count=min_count, enable_auto_scaling=enable_auto_scaling, scale_down_mode=scale_down_mode, type=type, mode=mode, orchestrator_version=orchestrator_version, upgrade_settings=upgrade_settings, power_state=power_state, availability_zones=availability_zones, enable_node_public_ip=enable_node_public_ip, node_public_ip_prefix_id=node_public_ip_prefix_id, scale_set_priority=scale_set_priority, scale_set_eviction_policy=scale_set_eviction_policy, spot_max_price=spot_max_price, tags=tags, node_labels=node_labels, node_taints=node_taints, proximity_placement_group_id=proximity_placement_group_id, kubelet_config=kubelet_config, linux_os_config=linux_os_config, enable_encryption_at_host=enable_encryption_at_host, enable_ultra_ssd=enable_ultra_ssd, enable_fips=enable_fips, gpu_instance_profile=gpu_instance_profile, creation_data=creation_data, capacity_reservation_group_id=capacity_reservation_group_id, host_group_id=host_group_id, **kwargs) + super().__init__( + count=count, + vm_size=vm_size, + os_disk_size_gb=os_disk_size_gb, + os_disk_type=os_disk_type, + kubelet_disk_type=kubelet_disk_type, + workload_runtime=workload_runtime, + message_of_the_day=message_of_the_day, + vnet_subnet_id=vnet_subnet_id, + pod_subnet_id=pod_subnet_id, + max_pods=max_pods, + os_type=os_type, + os_sku=os_sku, + max_count=max_count, + min_count=min_count, + enable_auto_scaling=enable_auto_scaling, + scale_down_mode=scale_down_mode, + type=type, + mode=mode, + orchestrator_version=orchestrator_version, + upgrade_settings=upgrade_settings, + power_state=power_state, + availability_zones=availability_zones, + enable_node_public_ip=enable_node_public_ip, + node_public_ip_prefix_id=node_public_ip_prefix_id, + scale_set_priority=scale_set_priority, + scale_set_eviction_policy=scale_set_eviction_policy, + spot_max_price=spot_max_price, + tags=tags, + node_labels=node_labels, + node_taints=node_taints, + proximity_placement_group_id=proximity_placement_group_id, + kubelet_config=kubelet_config, + linux_os_config=linux_os_config, + enable_encryption_at_host=enable_encryption_at_host, + enable_ultra_ssd=enable_ultra_ssd, + enable_fips=enable_fips, + gpu_instance_profile=gpu_instance_profile, + creation_data=creation_data, + capacity_reservation_group_id=capacity_reservation_group_id, + host_group_id=host_group_id, + **kwargs + ) self.name = name -class ManagedClusterAPIServerAccessProfile(msrest.serialization.Model): +class ManagedClusterAPIServerAccessProfile(_serialization.Model): """Access profile for managed cluster API server. :ivar authorized_ip_ranges: IP ranges are specified in CIDR format, e.g. 137.117.106.88/29. @@ -3450,11 +3408,11 @@ class ManagedClusterAPIServerAccessProfile(msrest.serialization.Model): """ _attribute_map = { - 'authorized_ip_ranges': {'key': 'authorizedIPRanges', 'type': '[str]'}, - 'enable_private_cluster': {'key': 'enablePrivateCluster', 'type': 'bool'}, - 'private_dns_zone': {'key': 'privateDNSZone', 'type': 'str'}, - 'enable_private_cluster_public_fqdn': {'key': 'enablePrivateClusterPublicFQDN', 'type': 'bool'}, - 'disable_run_command': {'key': 'disableRunCommand', 'type': 'bool'}, + "authorized_ip_ranges": {"key": "authorizedIPRanges", "type": "[str]"}, + "enable_private_cluster": {"key": "enablePrivateCluster", "type": "bool"}, + "private_dns_zone": {"key": "privateDNSZone", "type": "str"}, + "enable_private_cluster_public_fqdn": {"key": "enablePrivateClusterPublicFQDN", "type": "bool"}, + "disable_run_command": {"key": "disableRunCommand", "type": "bool"}, } def __init__( @@ -3486,7 +3444,7 @@ def __init__( :keyword disable_run_command: Whether to disable run command for the cluster or not. :paramtype disable_run_command: bool """ - super(ManagedClusterAPIServerAccessProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.authorized_ip_ranges = authorized_ip_ranges self.enable_private_cluster = enable_private_cluster self.private_dns_zone = private_dns_zone @@ -3494,38 +3452,33 @@ def __init__( self.disable_run_command = disable_run_command -class ManagedClusterAutoUpgradeProfile(msrest.serialization.Model): +class ManagedClusterAutoUpgradeProfile(_serialization.Model): """Auto upgrade profile for a managed cluster. :ivar upgrade_channel: For more information see `setting the AKS cluster auto-upgrade channel `_. Known values - are: "rapid", "stable", "patch", "node-image", "none". + are: "rapid", "stable", "patch", "node-image", and "none". :vartype upgrade_channel: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.UpgradeChannel """ _attribute_map = { - 'upgrade_channel': {'key': 'upgradeChannel', 'type': 'str'}, + "upgrade_channel": {"key": "upgradeChannel", "type": "str"}, } - def __init__( - self, - *, - upgrade_channel: Optional[Union[str, "_models.UpgradeChannel"]] = None, - **kwargs - ): + def __init__(self, *, upgrade_channel: Optional[Union[str, "_models.UpgradeChannel"]] = None, **kwargs): """ :keyword upgrade_channel: For more information see `setting the AKS cluster auto-upgrade channel `_. - Known values are: "rapid", "stable", "patch", "node-image", "none". + Known values are: "rapid", "stable", "patch", "node-image", and "none". :paramtype upgrade_channel: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.UpgradeChannel """ - super(ManagedClusterAutoUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.upgrade_channel = upgrade_channel -class ManagedClusterHTTPProxyConfig(msrest.serialization.Model): +class ManagedClusterHTTPProxyConfig(_serialization.Model): """Cluster HTTP proxy configuration. :ivar http_proxy: The HTTP proxy server endpoint to use. @@ -3539,10 +3492,10 @@ class ManagedClusterHTTPProxyConfig(msrest.serialization.Model): """ _attribute_map = { - 'http_proxy': {'key': 'httpProxy', 'type': 'str'}, - 'https_proxy': {'key': 'httpsProxy', 'type': 'str'}, - 'no_proxy': {'key': 'noProxy', 'type': '[str]'}, - 'trusted_ca': {'key': 'trustedCa', 'type': 'str'}, + "http_proxy": {"key": "httpProxy", "type": "str"}, + "https_proxy": {"key": "httpsProxy", "type": "str"}, + "no_proxy": {"key": "noProxy", "type": "[str]"}, + "trusted_ca": {"key": "trustedCa", "type": "str"}, } def __init__( @@ -3564,14 +3517,14 @@ def __init__( :keyword trusted_ca: Alternative CA cert to use for connecting to proxy servers. :paramtype trusted_ca: str """ - super(ManagedClusterHTTPProxyConfig, self).__init__(**kwargs) + super().__init__(**kwargs) self.http_proxy = http_proxy self.https_proxy = https_proxy self.no_proxy = no_proxy self.trusted_ca = trusted_ca -class ManagedClusterIdentity(msrest.serialization.Model): +class ManagedClusterIdentity(_serialization.Model): """Identity for the managed cluster. Variables are only populated by the server, and will be ignored when sending a request. @@ -3584,7 +3537,7 @@ class ManagedClusterIdentity(msrest.serialization.Model): :vartype tenant_id: str :ivar type: For more information see `use managed identities in AKS `_. Known values are: - "SystemAssigned", "UserAssigned", "None". + "SystemAssigned", "UserAssigned", and "None". :vartype type: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.ResourceIdentityType :ivar user_assigned_identities: The keys must be ARM resource IDs in the form: @@ -3594,28 +3547,33 @@ class ManagedClusterIdentity(msrest.serialization.Model): """ _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, + "principal_id": {"readonly": True}, + "tenant_id": {"readonly": True}, } _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{ManagedServiceIdentityUserAssignedIdentitiesValue}'}, + "principal_id": {"key": "principalId", "type": "str"}, + "tenant_id": {"key": "tenantId", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "user_assigned_identities": { + "key": "userAssignedIdentities", + "type": "{ManagedServiceIdentityUserAssignedIdentitiesValue}", + }, } def __init__( self, *, type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, - user_assigned_identities: Optional[Dict[str, "_models.ManagedServiceIdentityUserAssignedIdentitiesValue"]] = None, + user_assigned_identities: Optional[ + Dict[str, "_models.ManagedServiceIdentityUserAssignedIdentitiesValue"] + ] = None, **kwargs ): """ :keyword type: For more information see `use managed identities in AKS `_. Known values are: - "SystemAssigned", "UserAssigned", "None". + "SystemAssigned", "UserAssigned", and "None". :paramtype type: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.ResourceIdentityType :keyword user_assigned_identities: The keys must be ARM resource IDs in the form: @@ -3623,14 +3581,14 @@ def __init__( :paramtype user_assigned_identities: dict[str, ~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedServiceIdentityUserAssignedIdentitiesValue] """ - super(ManagedClusterIdentity, self).__init__(**kwargs) + super().__init__(**kwargs) self.principal_id = None self.tenant_id = None self.type = type self.user_assigned_identities = user_assigned_identities -class ManagedClusterListResult(msrest.serialization.Model): +class ManagedClusterListResult(_serialization.Model): """The response from the List Managed Clusters operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -3642,30 +3600,25 @@ class ManagedClusterListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[ManagedCluster]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[ManagedCluster]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.ManagedCluster"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.ManagedCluster"]] = None, **kwargs): """ :keyword value: The list of managed clusters. :paramtype value: list[~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedCluster] """ - super(ManagedClusterListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class ManagedClusterLoadBalancerProfile(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfile(_serialization.Model): """Profile of the managed cluster load balancer. :ivar managed_outbound_i_ps: Desired managed outbound IPs for the cluster load balancer. @@ -3694,18 +3647,24 @@ class ManagedClusterLoadBalancerProfile(msrest.serialization.Model): """ _validation = { - 'allocated_outbound_ports': {'maximum': 64000, 'minimum': 0}, - 'idle_timeout_in_minutes': {'maximum': 120, 'minimum': 4}, + "allocated_outbound_ports": {"maximum": 64000, "minimum": 0}, + "idle_timeout_in_minutes": {"maximum": 120, "minimum": 4}, } _attribute_map = { - 'managed_outbound_i_ps': {'key': 'managedOutboundIPs', 'type': 'ManagedClusterLoadBalancerProfileManagedOutboundIPs'}, - 'outbound_ip_prefixes': {'key': 'outboundIPPrefixes', 'type': 'ManagedClusterLoadBalancerProfileOutboundIPPrefixes'}, - 'outbound_i_ps': {'key': 'outboundIPs', 'type': 'ManagedClusterLoadBalancerProfileOutboundIPs'}, - 'effective_outbound_i_ps': {'key': 'effectiveOutboundIPs', 'type': '[ResourceReference]'}, - 'allocated_outbound_ports': {'key': 'allocatedOutboundPorts', 'type': 'int'}, - 'idle_timeout_in_minutes': {'key': 'idleTimeoutInMinutes', 'type': 'int'}, - 'enable_multiple_standard_load_balancers': {'key': 'enableMultipleStandardLoadBalancers', 'type': 'bool'}, + "managed_outbound_i_ps": { + "key": "managedOutboundIPs", + "type": "ManagedClusterLoadBalancerProfileManagedOutboundIPs", + }, + "outbound_ip_prefixes": { + "key": "outboundIPPrefixes", + "type": "ManagedClusterLoadBalancerProfileOutboundIPPrefixes", + }, + "outbound_i_ps": {"key": "outboundIPs", "type": "ManagedClusterLoadBalancerProfileOutboundIPs"}, + "effective_outbound_i_ps": {"key": "effectiveOutboundIPs", "type": "[ResourceReference]"}, + "allocated_outbound_ports": {"key": "allocatedOutboundPorts", "type": "int"}, + "idle_timeout_in_minutes": {"key": "idleTimeoutInMinutes", "type": "int"}, + "enable_multiple_standard_load_balancers": {"key": "enableMultipleStandardLoadBalancers", "type": "bool"}, } def __init__( @@ -3715,8 +3674,8 @@ def __init__( outbound_ip_prefixes: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPPrefixes"] = None, outbound_i_ps: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPs"] = None, effective_outbound_i_ps: Optional[List["_models.ResourceReference"]] = None, - allocated_outbound_ports: Optional[int] = 0, - idle_timeout_in_minutes: Optional[int] = 30, + allocated_outbound_ports: int = 0, + idle_timeout_in_minutes: int = 30, enable_multiple_standard_load_balancers: Optional[bool] = None, **kwargs ): @@ -3746,7 +3705,7 @@ def __init__( AKS cluster or not. :paramtype enable_multiple_standard_load_balancers: bool """ - super(ManagedClusterLoadBalancerProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.managed_outbound_i_ps = managed_outbound_i_ps self.outbound_ip_prefixes = outbound_ip_prefixes self.outbound_i_ps = outbound_i_ps @@ -3756,7 +3715,7 @@ def __init__( self.enable_multiple_standard_load_balancers = enable_multiple_standard_load_balancers -class ManagedClusterLoadBalancerProfileManagedOutboundIPs(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfileManagedOutboundIPs(_serialization.Model): """Desired managed outbound IPs for the cluster load balancer. :ivar count: The desired number of IPv4 outbound IPs created/managed by Azure for the cluster @@ -3770,22 +3729,16 @@ class ManagedClusterLoadBalancerProfileManagedOutboundIPs(msrest.serialization.M """ _validation = { - 'count': {'maximum': 100, 'minimum': 1}, - 'count_ipv6': {'maximum': 100, 'minimum': 0}, + "count": {"maximum": 100, "minimum": 1}, + "count_ipv6": {"maximum": 100, "minimum": 0}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'count_ipv6': {'key': 'countIPv6', 'type': 'int'}, + "count": {"key": "count", "type": "int"}, + "count_ipv6": {"key": "countIPv6", "type": "int"}, } - def __init__( - self, - *, - count: Optional[int] = 1, - count_ipv6: Optional[int] = 0, - **kwargs - ): + def __init__(self, *, count: int = 1, count_ipv6: int = 0, **kwargs): """ :keyword count: The desired number of IPv4 outbound IPs created/managed by Azure for the cluster load balancer. Allowed values must be in the range of 1 to 100 (inclusive). The default @@ -3796,12 +3749,12 @@ def __init__( value is 0 for single-stack and 1 for dual-stack. :paramtype count_ipv6: int """ - super(ManagedClusterLoadBalancerProfileManagedOutboundIPs, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.count_ipv6 = count_ipv6 -class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(_serialization.Model): """Desired outbound IP Prefix resources for the cluster load balancer. :ivar public_ip_prefixes: A list of public IP prefix resources. @@ -3810,25 +3763,20 @@ class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(msrest.serialization.M """ _attribute_map = { - 'public_ip_prefixes': {'key': 'publicIPPrefixes', 'type': '[ResourceReference]'}, + "public_ip_prefixes": {"key": "publicIPPrefixes", "type": "[ResourceReference]"}, } - def __init__( - self, - *, - public_ip_prefixes: Optional[List["_models.ResourceReference"]] = None, - **kwargs - ): + def __init__(self, *, public_ip_prefixes: Optional[List["_models.ResourceReference"]] = None, **kwargs): """ :keyword public_ip_prefixes: A list of public IP prefix resources. :paramtype public_ip_prefixes: list[~azure.mgmt.containerservice.v2022_02_02_preview.models.ResourceReference] """ - super(ManagedClusterLoadBalancerProfileOutboundIPPrefixes, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_ip_prefixes = public_ip_prefixes -class ManagedClusterLoadBalancerProfileOutboundIPs(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfileOutboundIPs(_serialization.Model): """Desired outbound IP resources for the cluster load balancer. :ivar public_i_ps: A list of public IP resources. @@ -3837,25 +3785,20 @@ class ManagedClusterLoadBalancerProfileOutboundIPs(msrest.serialization.Model): """ _attribute_map = { - 'public_i_ps': {'key': 'publicIPs', 'type': '[ResourceReference]'}, + "public_i_ps": {"key": "publicIPs", "type": "[ResourceReference]"}, } - def __init__( - self, - *, - public_i_ps: Optional[List["_models.ResourceReference"]] = None, - **kwargs - ): + def __init__(self, *, public_i_ps: Optional[List["_models.ResourceReference"]] = None, **kwargs): """ :keyword public_i_ps: A list of public IP resources. :paramtype public_i_ps: list[~azure.mgmt.containerservice.v2022_02_02_preview.models.ResourceReference] """ - super(ManagedClusterLoadBalancerProfileOutboundIPs, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_i_ps = public_i_ps -class ManagedClusterManagedOutboundIPProfile(msrest.serialization.Model): +class ManagedClusterManagedOutboundIPProfile(_serialization.Model): """Profile of the managed outbound IP resources of the managed cluster. :ivar count: The desired number of outbound IPs created/managed by Azure. Allowed values must @@ -3864,29 +3807,24 @@ class ManagedClusterManagedOutboundIPProfile(msrest.serialization.Model): """ _validation = { - 'count': {'maximum': 16, 'minimum': 1}, + "count": {"maximum": 16, "minimum": 1}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, + "count": {"key": "count", "type": "int"}, } - def __init__( - self, - *, - count: Optional[int] = 1, - **kwargs - ): + def __init__(self, *, count: int = 1, **kwargs): """ :keyword count: The desired number of outbound IPs created/managed by Azure. Allowed values must be in the range of 1 to 16 (inclusive). The default value is 1. :paramtype count: int """ - super(ManagedClusterManagedOutboundIPProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count -class ManagedClusterNATGatewayProfile(msrest.serialization.Model): +class ManagedClusterNATGatewayProfile(_serialization.Model): """Profile of the managed cluster NAT gateway. :ivar managed_outbound_ip_profile: Profile of the managed outbound IP resources of the cluster @@ -3902,13 +3840,16 @@ class ManagedClusterNATGatewayProfile(msrest.serialization.Model): """ _validation = { - 'idle_timeout_in_minutes': {'maximum': 120, 'minimum': 4}, + "idle_timeout_in_minutes": {"maximum": 120, "minimum": 4}, } _attribute_map = { - 'managed_outbound_ip_profile': {'key': 'managedOutboundIPProfile', 'type': 'ManagedClusterManagedOutboundIPProfile'}, - 'effective_outbound_i_ps': {'key': 'effectiveOutboundIPs', 'type': '[ResourceReference]'}, - 'idle_timeout_in_minutes': {'key': 'idleTimeoutInMinutes', 'type': 'int'}, + "managed_outbound_ip_profile": { + "key": "managedOutboundIPProfile", + "type": "ManagedClusterManagedOutboundIPProfile", + }, + "effective_outbound_i_ps": {"key": "effectiveOutboundIPs", "type": "[ResourceReference]"}, + "idle_timeout_in_minutes": {"key": "idleTimeoutInMinutes", "type": "int"}, } def __init__( @@ -3916,7 +3857,7 @@ def __init__( *, managed_outbound_ip_profile: Optional["_models.ManagedClusterManagedOutboundIPProfile"] = None, effective_outbound_i_ps: Optional[List["_models.ResourceReference"]] = None, - idle_timeout_in_minutes: Optional[int] = 4, + idle_timeout_in_minutes: int = 4, **kwargs ): """ @@ -3932,13 +3873,13 @@ def __init__( are in the range of 4 to 120 (inclusive). The default value is 4 minutes. :paramtype idle_timeout_in_minutes: int """ - super(ManagedClusterNATGatewayProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.managed_outbound_ip_profile = managed_outbound_ip_profile self.effective_outbound_i_ps = effective_outbound_i_ps self.idle_timeout_in_minutes = idle_timeout_in_minutes -class ManagedClusterOIDCIssuerProfile(msrest.serialization.Model): +class ManagedClusterOIDCIssuerProfile(_serialization.Model): """The OIDC issuer profile of the Managed Cluster. Variables are only populated by the server, and will be ignored when sending a request. @@ -3950,46 +3891,41 @@ class ManagedClusterOIDCIssuerProfile(msrest.serialization.Model): """ _validation = { - 'issuer_url': {'readonly': True}, + "issuer_url": {"readonly": True}, } _attribute_map = { - 'issuer_url': {'key': 'issuerURL', 'type': 'str'}, - 'enabled': {'key': 'enabled', 'type': 'bool'}, + "issuer_url": {"key": "issuerURL", "type": "str"}, + "enabled": {"key": "enabled", "type": "bool"}, } - def __init__( - self, - *, - enabled: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, enabled: Optional[bool] = None, **kwargs): """ :keyword enabled: Whether the OIDC issuer is enabled. :paramtype enabled: bool """ - super(ManagedClusterOIDCIssuerProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.issuer_url = None self.enabled = enabled -class ManagedClusterPodIdentity(msrest.serialization.Model): +class ManagedClusterPodIdentity(_serialization.Model): """Details about the pod identity assigned to the Managed Cluster. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar name: Required. The name of the pod identity. + :ivar name: The name of the pod identity. Required. :vartype name: str - :ivar namespace: Required. The namespace of the pod identity. + :ivar namespace: The namespace of the pod identity. Required. :vartype namespace: str :ivar binding_selector: The binding selector to use for the AzureIdentityBinding resource. :vartype binding_selector: str - :ivar identity: Required. The user assigned identity details. + :ivar identity: The user assigned identity details. Required. :vartype identity: ~azure.mgmt.containerservice.v2022_02_02_preview.models.UserAssignedIdentity :ivar provisioning_state: The current provisioning state of the pod identity. Known values are: - "Assigned", "Updating", "Deleting", "Failed". + "Assigned", "Updating", "Deleting", and "Failed". :vartype provisioning_state: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedClusterPodIdentityProvisioningState :ivar provisioning_info: @@ -3998,20 +3934,20 @@ class ManagedClusterPodIdentity(msrest.serialization.Model): """ _validation = { - 'name': {'required': True}, - 'namespace': {'required': True}, - 'identity': {'required': True}, - 'provisioning_state': {'readonly': True}, - 'provisioning_info': {'readonly': True}, + "name": {"required": True}, + "namespace": {"required": True}, + "identity": {"required": True}, + "provisioning_state": {"readonly": True}, + "provisioning_info": {"readonly": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'namespace': {'key': 'namespace', 'type': 'str'}, - 'binding_selector': {'key': 'bindingSelector', 'type': 'str'}, - 'identity': {'key': 'identity', 'type': 'UserAssignedIdentity'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'provisioning_info': {'key': 'provisioningInfo', 'type': 'ManagedClusterPodIdentityProvisioningInfo'}, + "name": {"key": "name", "type": "str"}, + "namespace": {"key": "namespace", "type": "str"}, + "binding_selector": {"key": "bindingSelector", "type": "str"}, + "identity": {"key": "identity", "type": "UserAssignedIdentity"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "provisioning_info": {"key": "provisioningInfo", "type": "ManagedClusterPodIdentityProvisioningInfo"}, } def __init__( @@ -4024,17 +3960,17 @@ def __init__( **kwargs ): """ - :keyword name: Required. The name of the pod identity. + :keyword name: The name of the pod identity. Required. :paramtype name: str - :keyword namespace: Required. The namespace of the pod identity. + :keyword namespace: The namespace of the pod identity. Required. :paramtype namespace: str :keyword binding_selector: The binding selector to use for the AzureIdentityBinding resource. :paramtype binding_selector: str - :keyword identity: Required. The user assigned identity details. + :keyword identity: The user assigned identity details. Required. :paramtype identity: ~azure.mgmt.containerservice.v2022_02_02_preview.models.UserAssignedIdentity """ - super(ManagedClusterPodIdentity, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.namespace = namespace self.binding_selector = binding_selector @@ -4043,54 +3979,47 @@ def __init__( self.provisioning_info = None -class ManagedClusterPodIdentityException(msrest.serialization.Model): +class ManagedClusterPodIdentityException(_serialization.Model): """See `disable AAD Pod Identity for a specific Pod/Application `_ for more details. All required parameters must be populated in order to send to Azure. - :ivar name: Required. The name of the pod identity exception. + :ivar name: The name of the pod identity exception. Required. :vartype name: str - :ivar namespace: Required. The namespace of the pod identity exception. + :ivar namespace: The namespace of the pod identity exception. Required. :vartype namespace: str - :ivar pod_labels: Required. The pod labels to match. + :ivar pod_labels: The pod labels to match. Required. :vartype pod_labels: dict[str, str] """ _validation = { - 'name': {'required': True}, - 'namespace': {'required': True}, - 'pod_labels': {'required': True}, + "name": {"required": True}, + "namespace": {"required": True}, + "pod_labels": {"required": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'namespace': {'key': 'namespace', 'type': 'str'}, - 'pod_labels': {'key': 'podLabels', 'type': '{str}'}, + "name": {"key": "name", "type": "str"}, + "namespace": {"key": "namespace", "type": "str"}, + "pod_labels": {"key": "podLabels", "type": "{str}"}, } - def __init__( - self, - *, - name: str, - namespace: str, - pod_labels: Dict[str, str], - **kwargs - ): + def __init__(self, *, name: str, namespace: str, pod_labels: Dict[str, str], **kwargs): """ - :keyword name: Required. The name of the pod identity exception. + :keyword name: The name of the pod identity exception. Required. :paramtype name: str - :keyword namespace: Required. The namespace of the pod identity exception. + :keyword namespace: The namespace of the pod identity exception. Required. :paramtype namespace: str - :keyword pod_labels: Required. The pod labels to match. + :keyword pod_labels: The pod labels to match. Required. :paramtype pod_labels: dict[str, str] """ - super(ManagedClusterPodIdentityException, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.namespace = namespace self.pod_labels = pod_labels -class ManagedClusterPodIdentityProfile(msrest.serialization.Model): +class ManagedClusterPodIdentityProfile(_serialization.Model): """See `use AAD pod identity `_ for more details on pod identity integration. :ivar enabled: Whether the pod identity addon is enabled. @@ -4110,10 +4039,13 @@ class ManagedClusterPodIdentityProfile(msrest.serialization.Model): """ _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'allow_network_plugin_kubenet': {'key': 'allowNetworkPluginKubenet', 'type': 'bool'}, - 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '[ManagedClusterPodIdentity]'}, - 'user_assigned_identity_exceptions': {'key': 'userAssignedIdentityExceptions', 'type': '[ManagedClusterPodIdentityException]'}, + "enabled": {"key": "enabled", "type": "bool"}, + "allow_network_plugin_kubenet": {"key": "allowNetworkPluginKubenet", "type": "bool"}, + "user_assigned_identities": {"key": "userAssignedIdentities", "type": "[ManagedClusterPodIdentity]"}, + "user_assigned_identity_exceptions": { + "key": "userAssignedIdentityExceptions", + "type": "[ManagedClusterPodIdentityException]", + }, } def __init__( @@ -4141,14 +4073,14 @@ def __init__( :paramtype user_assigned_identity_exceptions: list[~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedClusterPodIdentityException] """ - super(ManagedClusterPodIdentityProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.allow_network_plugin_kubenet = allow_network_plugin_kubenet self.user_assigned_identities = user_assigned_identities self.user_assigned_identity_exceptions = user_assigned_identity_exceptions -class ManagedClusterPodIdentityProvisioningError(msrest.serialization.Model): +class ManagedClusterPodIdentityProvisioningError(_serialization.Model): """An error response from the pod identity provisioning. :ivar error: Details about the error. @@ -4157,25 +4089,20 @@ class ManagedClusterPodIdentityProvisioningError(msrest.serialization.Model): """ _attribute_map = { - 'error': {'key': 'error', 'type': 'ManagedClusterPodIdentityProvisioningErrorBody'}, + "error": {"key": "error", "type": "ManagedClusterPodIdentityProvisioningErrorBody"}, } - def __init__( - self, - *, - error: Optional["_models.ManagedClusterPodIdentityProvisioningErrorBody"] = None, - **kwargs - ): + def __init__(self, *, error: Optional["_models.ManagedClusterPodIdentityProvisioningErrorBody"] = None, **kwargs): """ :keyword error: Details about the error. :paramtype error: ~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedClusterPodIdentityProvisioningErrorBody """ - super(ManagedClusterPodIdentityProvisioningError, self).__init__(**kwargs) + super().__init__(**kwargs) self.error = error -class ManagedClusterPodIdentityProvisioningErrorBody(msrest.serialization.Model): +class ManagedClusterPodIdentityProvisioningErrorBody(_serialization.Model): """An error response from the pod identity provisioning. :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed @@ -4193,10 +4120,10 @@ class ManagedClusterPodIdentityProvisioningErrorBody(msrest.serialization.Model) """ _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[ManagedClusterPodIdentityProvisioningErrorBody]'}, + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[ManagedClusterPodIdentityProvisioningErrorBody]"}, } def __init__( @@ -4222,14 +4149,14 @@ def __init__( :paramtype details: list[~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedClusterPodIdentityProvisioningErrorBody] """ - super(ManagedClusterPodIdentityProvisioningErrorBody, self).__init__(**kwargs) + super().__init__(**kwargs) self.code = code self.message = message self.target = target self.details = details -class ManagedClusterPodIdentityProvisioningInfo(msrest.serialization.Model): +class ManagedClusterPodIdentityProvisioningInfo(_serialization.Model): """ManagedClusterPodIdentityProvisioningInfo. :ivar error: Pod identity assignment error (if any). @@ -4238,35 +4165,30 @@ class ManagedClusterPodIdentityProvisioningInfo(msrest.serialization.Model): """ _attribute_map = { - 'error': {'key': 'error', 'type': 'ManagedClusterPodIdentityProvisioningError'}, + "error": {"key": "error", "type": "ManagedClusterPodIdentityProvisioningError"}, } - def __init__( - self, - *, - error: Optional["_models.ManagedClusterPodIdentityProvisioningError"] = None, - **kwargs - ): + def __init__(self, *, error: Optional["_models.ManagedClusterPodIdentityProvisioningError"] = None, **kwargs): """ :keyword error: Pod identity assignment error (if any). :paramtype error: ~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedClusterPodIdentityProvisioningError """ - super(ManagedClusterPodIdentityProvisioningInfo, self).__init__(**kwargs) + super().__init__(**kwargs) self.error = error -class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): +class ManagedClusterPoolUpgradeProfile(_serialization.Model): """The list of available upgrade versions. All required parameters must be populated in order to send to Azure. - :ivar kubernetes_version: Required. The Kubernetes version (major.minor.patch). + :ivar kubernetes_version: The Kubernetes version (major.minor.patch). Required. :vartype kubernetes_version: str :ivar name: The Agent Pool name. :vartype name: str - :ivar os_type: Required. The operating system type. The default is Linux. Known values are: - "Linux", "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -4274,15 +4196,15 @@ class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): """ _validation = { - 'kubernetes_version': {'required': True}, - 'os_type': {'required': True}, + "kubernetes_version": {"required": True}, + "os_type": {"required": True}, } _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'upgrades': {'key': 'upgrades', 'type': '[ManagedClusterPoolUpgradeProfileUpgradesItem]'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "os_type": {"key": "osType", "type": "str"}, + "upgrades": {"key": "upgrades", "type": "[ManagedClusterPoolUpgradeProfileUpgradesItem]"}, } def __init__( @@ -4295,25 +4217,25 @@ def __init__( **kwargs ): """ - :keyword kubernetes_version: Required. The Kubernetes version (major.minor.patch). + :keyword kubernetes_version: The Kubernetes version (major.minor.patch). Required. :paramtype kubernetes_version: str :keyword name: The Agent Pool name. :paramtype name: str - :keyword os_type: Required. The operating system type. The default is Linux. Known values are: - "Linux", "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: list[~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedClusterPoolUpgradeProfileUpgradesItem] """ - super(ManagedClusterPoolUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.name = name self.os_type = os_type self.upgrades = upgrades -class ManagedClusterPoolUpgradeProfileUpgradesItem(msrest.serialization.Model): +class ManagedClusterPoolUpgradeProfileUpgradesItem(_serialization.Model): """ManagedClusterPoolUpgradeProfileUpgradesItem. :ivar kubernetes_version: The Kubernetes version (major.minor.patch). @@ -4323,36 +4245,30 @@ class ManagedClusterPoolUpgradeProfileUpgradesItem(msrest.serialization.Model): """ _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } - def __init__( - self, - *, - kubernetes_version: Optional[str] = None, - is_preview: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, kubernetes_version: Optional[str] = None, is_preview: Optional[bool] = None, **kwargs): """ :keyword kubernetes_version: The Kubernetes version (major.minor.patch). :paramtype kubernetes_version: str :keyword is_preview: Whether the Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(ManagedClusterPoolUpgradeProfileUpgradesItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.is_preview = is_preview -class ManagedClusterPropertiesAutoScalerProfile(msrest.serialization.Model): +class ManagedClusterPropertiesAutoScalerProfile(_serialization.Model): # pylint: disable=too-many-instance-attributes """Parameters to be applied to the cluster-autoscaler when enabled. :ivar balance_similar_node_groups: Valid values are 'true' and 'false'. :vartype balance_similar_node_groups: str :ivar expander: If not specified, the default is 'random'. See `expanders `_ - for more information. Known values are: "least-waste", "most-pods", "priority", "random". + for more information. Known values are: "least-waste", "most-pods", "priority", and "random". :vartype expander: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.Expander :ivar max_empty_bulk_delete: The default is 10. :vartype max_empty_bulk_delete: str @@ -4396,23 +4312,23 @@ class ManagedClusterPropertiesAutoScalerProfile(msrest.serialization.Model): """ _attribute_map = { - 'balance_similar_node_groups': {'key': 'balance-similar-node-groups', 'type': 'str'}, - 'expander': {'key': 'expander', 'type': 'str'}, - 'max_empty_bulk_delete': {'key': 'max-empty-bulk-delete', 'type': 'str'}, - 'max_graceful_termination_sec': {'key': 'max-graceful-termination-sec', 'type': 'str'}, - 'max_node_provision_time': {'key': 'max-node-provision-time', 'type': 'str'}, - 'max_total_unready_percentage': {'key': 'max-total-unready-percentage', 'type': 'str'}, - 'new_pod_scale_up_delay': {'key': 'new-pod-scale-up-delay', 'type': 'str'}, - 'ok_total_unready_count': {'key': 'ok-total-unready-count', 'type': 'str'}, - 'scan_interval': {'key': 'scan-interval', 'type': 'str'}, - 'scale_down_delay_after_add': {'key': 'scale-down-delay-after-add', 'type': 'str'}, - 'scale_down_delay_after_delete': {'key': 'scale-down-delay-after-delete', 'type': 'str'}, - 'scale_down_delay_after_failure': {'key': 'scale-down-delay-after-failure', 'type': 'str'}, - 'scale_down_unneeded_time': {'key': 'scale-down-unneeded-time', 'type': 'str'}, - 'scale_down_unready_time': {'key': 'scale-down-unready-time', 'type': 'str'}, - 'scale_down_utilization_threshold': {'key': 'scale-down-utilization-threshold', 'type': 'str'}, - 'skip_nodes_with_local_storage': {'key': 'skip-nodes-with-local-storage', 'type': 'str'}, - 'skip_nodes_with_system_pods': {'key': 'skip-nodes-with-system-pods', 'type': 'str'}, + "balance_similar_node_groups": {"key": "balance-similar-node-groups", "type": "str"}, + "expander": {"key": "expander", "type": "str"}, + "max_empty_bulk_delete": {"key": "max-empty-bulk-delete", "type": "str"}, + "max_graceful_termination_sec": {"key": "max-graceful-termination-sec", "type": "str"}, + "max_node_provision_time": {"key": "max-node-provision-time", "type": "str"}, + "max_total_unready_percentage": {"key": "max-total-unready-percentage", "type": "str"}, + "new_pod_scale_up_delay": {"key": "new-pod-scale-up-delay", "type": "str"}, + "ok_total_unready_count": {"key": "ok-total-unready-count", "type": "str"}, + "scan_interval": {"key": "scan-interval", "type": "str"}, + "scale_down_delay_after_add": {"key": "scale-down-delay-after-add", "type": "str"}, + "scale_down_delay_after_delete": {"key": "scale-down-delay-after-delete", "type": "str"}, + "scale_down_delay_after_failure": {"key": "scale-down-delay-after-failure", "type": "str"}, + "scale_down_unneeded_time": {"key": "scale-down-unneeded-time", "type": "str"}, + "scale_down_unready_time": {"key": "scale-down-unready-time", "type": "str"}, + "scale_down_utilization_threshold": {"key": "scale-down-utilization-threshold", "type": "str"}, + "skip_nodes_with_local_storage": {"key": "skip-nodes-with-local-storage", "type": "str"}, + "skip_nodes_with_system_pods": {"key": "skip-nodes-with-system-pods", "type": "str"}, } def __init__( @@ -4442,7 +4358,7 @@ def __init__( :paramtype balance_similar_node_groups: str :keyword expander: If not specified, the default is 'random'. See `expanders `_ - for more information. Known values are: "least-waste", "most-pods", "priority", "random". + for more information. Known values are: "least-waste", "most-pods", "priority", and "random". :paramtype expander: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.Expander :keyword max_empty_bulk_delete: The default is 10. :paramtype max_empty_bulk_delete: str @@ -4485,7 +4401,7 @@ def __init__( :keyword skip_nodes_with_system_pods: The default is true. :paramtype skip_nodes_with_system_pods: str """ - super(ManagedClusterPropertiesAutoScalerProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.balance_similar_node_groups = balance_similar_node_groups self.expander = expander self.max_empty_bulk_delete = max_empty_bulk_delete @@ -4505,7 +4421,7 @@ def __init__( self.skip_nodes_with_system_pods = skip_nodes_with_system_pods -class ManagedClusterPropertiesForSnapshot(msrest.serialization.Model): +class ManagedClusterPropertiesForSnapshot(_serialization.Model): """managed cluster properties for snapshot, these properties are read only. Variables are only populated by the server, and will be ignored when sending a request. @@ -4522,14 +4438,14 @@ class ManagedClusterPropertiesForSnapshot(msrest.serialization.Model): """ _validation = { - 'network_profile': {'readonly': True}, + "network_profile": {"readonly": True}, } _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'ManagedClusterSKU'}, - 'enable_rbac': {'key': 'enableRbac', 'type': 'bool'}, - 'network_profile': {'key': 'networkProfile', 'type': 'NetworkProfileForSnapshot'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "sku": {"key": "sku", "type": "ManagedClusterSKU"}, + "enable_rbac": {"key": "enableRbac", "type": "bool"}, + "network_profile": {"key": "networkProfile", "type": "NetworkProfileForSnapshot"}, } def __init__( @@ -4549,14 +4465,14 @@ def __init__( not. :paramtype enable_rbac: bool """ - super(ManagedClusterPropertiesForSnapshot, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.sku = sku self.enable_rbac = enable_rbac self.network_profile = None -class ManagedClusterSecurityProfile(msrest.serialization.Model): +class ManagedClusterSecurityProfile(_serialization.Model): """Security profile for the container service cluster. :ivar azure_defender: Azure Defender settings for the security profile. @@ -4570,8 +4486,8 @@ class ManagedClusterSecurityProfile(msrest.serialization.Model): """ _attribute_map = { - 'azure_defender': {'key': 'azureDefender', 'type': 'ManagedClusterSecurityProfileAzureDefender'}, - 'azure_key_vault_kms': {'key': 'azureKeyVaultKms', 'type': 'AzureKeyVaultKms'}, + "azure_defender": {"key": "azureDefender", "type": "ManagedClusterSecurityProfileAzureDefender"}, + "azure_key_vault_kms": {"key": "azureKeyVaultKms", "type": "AzureKeyVaultKms"}, } def __init__( @@ -4591,12 +4507,12 @@ def __init__( :paramtype azure_key_vault_kms: ~azure.mgmt.containerservice.v2022_02_02_preview.models.AzureKeyVaultKms """ - super(ManagedClusterSecurityProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.azure_defender = azure_defender self.azure_key_vault_kms = azure_key_vault_kms -class ManagedClusterSecurityProfileAzureDefender(msrest.serialization.Model): +class ManagedClusterSecurityProfileAzureDefender(_serialization.Model): """Azure Defender settings for the security profile. :ivar enabled: Whether to enable Azure Defender. @@ -4608,16 +4524,12 @@ class ManagedClusterSecurityProfileAzureDefender(msrest.serialization.Model): """ _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'log_analytics_workspace_resource_id': {'key': 'logAnalyticsWorkspaceResourceId', 'type': 'str'}, + "enabled": {"key": "enabled", "type": "bool"}, + "log_analytics_workspace_resource_id": {"key": "logAnalyticsWorkspaceResourceId", "type": "str"}, } def __init__( - self, - *, - enabled: Optional[bool] = None, - log_analytics_workspace_resource_id: Optional[str] = None, - **kwargs + self, *, enabled: Optional[bool] = None, log_analytics_workspace_resource_id: Optional[str] = None, **kwargs ): """ :keyword enabled: Whether to enable Azure Defender. @@ -4627,65 +4539,59 @@ def __init__( must be a valid workspace resource ID. When Azure Defender is disabled, leave the field empty. :paramtype log_analytics_workspace_resource_id: str """ - super(ManagedClusterSecurityProfileAzureDefender, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.log_analytics_workspace_resource_id = log_analytics_workspace_resource_id -class ManagedClusterServicePrincipalProfile(msrest.serialization.Model): +class ManagedClusterServicePrincipalProfile(_serialization.Model): """Information about a service principal identity for the cluster to use for manipulating Azure APIs. All required parameters must be populated in order to send to Azure. - :ivar client_id: Required. The ID for the service principal. + :ivar client_id: The ID for the service principal. Required. :vartype client_id: str :ivar secret: The secret password associated with the service principal in plain text. :vartype secret: str """ _validation = { - 'client_id': {'required': True}, + "client_id": {"required": True}, } _attribute_map = { - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'secret': {'key': 'secret', 'type': 'str'}, + "client_id": {"key": "clientId", "type": "str"}, + "secret": {"key": "secret", "type": "str"}, } - def __init__( - self, - *, - client_id: str, - secret: Optional[str] = None, - **kwargs - ): + def __init__(self, *, client_id: str, secret: Optional[str] = None, **kwargs): """ - :keyword client_id: Required. The ID for the service principal. + :keyword client_id: The ID for the service principal. Required. :paramtype client_id: str :keyword secret: The secret password associated with the service principal in plain text. :paramtype secret: str """ - super(ManagedClusterServicePrincipalProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.client_id = client_id self.secret = secret -class ManagedClusterSKU(msrest.serialization.Model): +class ManagedClusterSKU(_serialization.Model): """The SKU of a Managed Cluster. - :ivar name: The name of a managed cluster SKU. Known values are: "Basic". + :ivar name: The name of a managed cluster SKU. "Basic" :vartype name: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedClusterSKUName :ivar tier: If not specified, the default is 'Free'. See `uptime SLA - `_ for more details. Known values are: "Paid", - "Free". + `_ for more details. Known values are: "Paid" + and "Free". :vartype tier: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedClusterSKUTier """ _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, + "name": {"key": "name", "type": "str"}, + "tier": {"key": "tier", "type": "str"}, } def __init__( @@ -4696,16 +4602,16 @@ def __init__( **kwargs ): """ - :keyword name: The name of a managed cluster SKU. Known values are: "Basic". + :keyword name: The name of a managed cluster SKU. "Basic" :paramtype name: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedClusterSKUName :keyword tier: If not specified, the default is 'Free'. See `uptime SLA - `_ for more details. Known values are: "Paid", - "Free". + `_ for more details. Known values are: "Paid" + and "Free". :paramtype tier: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedClusterSKUTier """ - super(ManagedClusterSKU, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.tier = tier @@ -4728,15 +4634,15 @@ class ManagedClusterSnapshot(Resource): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.containerservice.v2022_02_02_preview.models.SystemData - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar creation_data: CreationData to be used to specify the source resource ID to create this snapshot. :vartype creation_data: ~azure.mgmt.containerservice.v2022_02_02_preview.models.CreationData :ivar snapshot_type: The type of a snapshot. The default is NodePool. Known values are: - "NodePool", "ManagedCluster". Default value: "NodePool". + "NodePool" and "ManagedCluster". :vartype snapshot_type: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.SnapshotType :ivar managed_cluster_properties_read_only: What the properties will be showed when getting @@ -4746,24 +4652,27 @@ class ManagedClusterSnapshot(Resource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'location': {'required': True}, - 'managed_cluster_properties_read_only': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, + "managed_cluster_properties_read_only": {"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'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'creation_data': {'key': 'properties.creationData', 'type': 'CreationData'}, - 'snapshot_type': {'key': 'properties.snapshotType', 'type': 'str'}, - 'managed_cluster_properties_read_only': {'key': 'properties.managedClusterPropertiesReadOnly', 'type': 'ManagedClusterPropertiesForSnapshot'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "creation_data": {"key": "properties.creationData", "type": "CreationData"}, + "snapshot_type": {"key": "properties.snapshotType", "type": "str"}, + "managed_cluster_properties_read_only": { + "key": "properties.managedClusterPropertiesReadOnly", + "type": "ManagedClusterPropertiesForSnapshot", + }, } def __init__( @@ -4772,29 +4681,29 @@ def __init__( location: str, tags: Optional[Dict[str, str]] = None, creation_data: Optional["_models.CreationData"] = None, - snapshot_type: Optional[Union[str, "_models.SnapshotType"]] = "NodePool", + snapshot_type: Union[str, "_models.SnapshotType"] = "NodePool", **kwargs ): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword creation_data: CreationData to be used to specify the source resource ID to create this snapshot. :paramtype creation_data: ~azure.mgmt.containerservice.v2022_02_02_preview.models.CreationData :keyword snapshot_type: The type of a snapshot. The default is NodePool. Known values are: - "NodePool", "ManagedCluster". Default value: "NodePool". + "NodePool" and "ManagedCluster". :paramtype snapshot_type: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.SnapshotType """ - super(ManagedClusterSnapshot, self).__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.creation_data = creation_data self.snapshot_type = snapshot_type self.managed_cluster_properties_read_only = None -class ManagedClusterSnapshotListResult(msrest.serialization.Model): +class ManagedClusterSnapshotListResult(_serialization.Model): """The response from the List Managed Cluster Snapshots operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -4807,31 +4716,26 @@ class ManagedClusterSnapshotListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[ManagedClusterSnapshot]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[ManagedClusterSnapshot]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.ManagedClusterSnapshot"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.ManagedClusterSnapshot"]] = None, **kwargs): """ :keyword value: The list of managed cluster snapshots. :paramtype value: list[~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedClusterSnapshot] """ - super(ManagedClusterSnapshotListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class ManagedClusterUpgradeProfile(msrest.serialization.Model): +class ManagedClusterUpgradeProfile(_serialization.Model): """The list of available upgrades for compute pools. Variables are only populated by the server, and will be ignored when sending a request. @@ -4844,29 +4748,29 @@ class ManagedClusterUpgradeProfile(msrest.serialization.Model): :vartype name: str :ivar type: The type of the upgrade profile. :vartype type: str - :ivar control_plane_profile: Required. The list of available upgrade versions for the control - plane. + :ivar control_plane_profile: The list of available upgrade versions for the control plane. + Required. :vartype control_plane_profile: ~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedClusterPoolUpgradeProfile - :ivar agent_pool_profiles: Required. The list of available upgrade versions for agent pools. + :ivar agent_pool_profiles: The list of available upgrade versions for agent pools. Required. :vartype agent_pool_profiles: list[~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedClusterPoolUpgradeProfile] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'control_plane_profile': {'required': True}, - 'agent_pool_profiles': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "control_plane_profile": {"required": True}, + "agent_pool_profiles": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'control_plane_profile': {'key': 'properties.controlPlaneProfile', 'type': 'ManagedClusterPoolUpgradeProfile'}, - 'agent_pool_profiles': {'key': 'properties.agentPoolProfiles', 'type': '[ManagedClusterPoolUpgradeProfile]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "control_plane_profile": {"key": "properties.controlPlaneProfile", "type": "ManagedClusterPoolUpgradeProfile"}, + "agent_pool_profiles": {"key": "properties.agentPoolProfiles", "type": "[ManagedClusterPoolUpgradeProfile]"}, } def __init__( @@ -4877,15 +4781,15 @@ def __init__( **kwargs ): """ - :keyword control_plane_profile: Required. The list of available upgrade versions for the - control plane. + :keyword control_plane_profile: The list of available upgrade versions for the control plane. + Required. :paramtype control_plane_profile: ~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedClusterPoolUpgradeProfile - :keyword agent_pool_profiles: Required. The list of available upgrade versions for agent pools. + :keyword agent_pool_profiles: The list of available upgrade versions for agent pools. Required. :paramtype agent_pool_profiles: list[~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedClusterPoolUpgradeProfile] """ - super(ManagedClusterUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -4893,18 +4797,18 @@ def __init__( self.agent_pool_profiles = agent_pool_profiles -class ManagedClusterWindowsProfile(msrest.serialization.Model): +class ManagedClusterWindowsProfile(_serialization.Model): """Profile for Windows VMs in the managed cluster. All required parameters must be populated in order to send to Azure. - :ivar admin_username: Required. Specifies the name of the administrator account. - :code:`
`:code:`
` **Restriction:** Cannot end in "." :code:`
`:code:`
` - **Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", "test1", - "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", - "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", - "sys", "test2", "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 - character :code:`
`:code:`
` **Max-length:** 20 characters. + :ivar admin_username: Specifies the name of the administrator account. :code:`
`:code:`
` + **Restriction:** Cannot end in "." :code:`
`:code:`
` **Disallowed values:** + "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", + "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", + "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", + "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 character + :code:`
`:code:`
` **Max-length:** 20 characters. Required. :vartype admin_username: str :ivar admin_password: Specifies the password of the administrator account. :code:`
`:code:`
` **Minimum-length:** 8 characters :code:`
`:code:`
` @@ -4916,7 +4820,7 @@ class ManagedClusterWindowsProfile(msrest.serialization.Model): :vartype admin_password: str :ivar license_type: The license type to use for Windows VMs. See `Azure Hybrid User Benefits `_ for more details. Known values are: - "None", "Windows_Server". + "None" and "Windows_Server". :vartype license_type: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.LicenseType :ivar enable_csi_proxy: For more details on CSI proxy, see the `CSI proxy GitHub repo @@ -4928,15 +4832,15 @@ class ManagedClusterWindowsProfile(msrest.serialization.Model): """ _validation = { - 'admin_username': {'required': True}, + "admin_username": {"required": True}, } _attribute_map = { - 'admin_username': {'key': 'adminUsername', 'type': 'str'}, - 'admin_password': {'key': 'adminPassword', 'type': 'str'}, - 'license_type': {'key': 'licenseType', 'type': 'str'}, - 'enable_csi_proxy': {'key': 'enableCSIProxy', 'type': 'bool'}, - 'gmsa_profile': {'key': 'gmsaProfile', 'type': 'WindowsGmsaProfile'}, + "admin_username": {"key": "adminUsername", "type": "str"}, + "admin_password": {"key": "adminPassword", "type": "str"}, + "license_type": {"key": "licenseType", "type": "str"}, + "enable_csi_proxy": {"key": "enableCSIProxy", "type": "bool"}, + "gmsa_profile": {"key": "gmsaProfile", "type": "WindowsGmsaProfile"}, } def __init__( @@ -4950,13 +4854,13 @@ def __init__( **kwargs ): """ - :keyword admin_username: Required. Specifies the name of the administrator account. + :keyword admin_username: Specifies the name of the administrator account. :code:`
`:code:`
` **Restriction:** Cannot end in "." :code:`
`:code:`
` **Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 - character :code:`
`:code:`
` **Max-length:** 20 characters. + character :code:`
`:code:`
` **Max-length:** 20 characters. Required. :paramtype admin_username: str :keyword admin_password: Specifies the password of the administrator account. :code:`
`:code:`
` **Minimum-length:** 8 characters :code:`
`:code:`
` @@ -4968,7 +4872,7 @@ def __init__( :paramtype admin_password: str :keyword license_type: The license type to use for Windows VMs. See `Azure Hybrid User Benefits `_ for more details. Known values are: - "None", "Windows_Server". + "None" and "Windows_Server". :paramtype license_type: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.LicenseType :keyword enable_csi_proxy: For more details on CSI proxy, see the `CSI proxy GitHub repo @@ -4978,7 +4882,7 @@ def __init__( :paramtype gmsa_profile: ~azure.mgmt.containerservice.v2022_02_02_preview.models.WindowsGmsaProfile """ - super(ManagedClusterWindowsProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.admin_username = admin_username self.admin_password = admin_password self.license_type = license_type @@ -4986,7 +4890,7 @@ def __init__( self.gmsa_profile = gmsa_profile -class ManagedServiceIdentityUserAssignedIdentitiesValue(msrest.serialization.Model): +class ManagedServiceIdentityUserAssignedIdentitiesValue(_serialization.Model): """ManagedServiceIdentityUserAssignedIdentitiesValue. Variables are only populated by the server, and will be ignored when sending a request. @@ -4998,58 +4902,54 @@ class ManagedServiceIdentityUserAssignedIdentitiesValue(msrest.serialization.Mod """ _validation = { - 'principal_id': {'readonly': True}, - 'client_id': {'readonly': True}, + "principal_id": {"readonly": True}, + "client_id": {"readonly": True}, } _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, + "principal_id": {"key": "principalId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(ManagedServiceIdentityUserAssignedIdentitiesValue, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.principal_id = None self.client_id = None -class NetworkProfileForSnapshot(msrest.serialization.Model): +class NetworkProfileForSnapshot(_serialization.Model): """network profile for managed cluster snapshot, these properties are read only. :ivar network_plugin: networkPlugin for managed cluster snapshot. Known values are: "azure", - "kubenet", "none". Default value: "kubenet". + "kubenet", and "none". :vartype network_plugin: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.NetworkPlugin - :ivar network_policy: networkPolicy for managed cluster snapshot. Known values are: "calico", - "azure". + :ivar network_policy: networkPolicy for managed cluster snapshot. Known values are: "calico" + and "azure". :vartype network_policy: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.NetworkPolicy - :ivar network_mode: networkMode for managed cluster snapshot. Known values are: "transparent", - "bridge". + :ivar network_mode: networkMode for managed cluster snapshot. Known values are: "transparent" + and "bridge". :vartype network_mode: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.NetworkMode :ivar load_balancer_sku: loadBalancerSku for managed cluster snapshot. Known values are: - "standard", "basic". + "standard" and "basic". :vartype load_balancer_sku: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.LoadBalancerSku """ _attribute_map = { - 'network_plugin': {'key': 'networkPlugin', 'type': 'str'}, - 'network_policy': {'key': 'networkPolicy', 'type': 'str'}, - 'network_mode': {'key': 'networkMode', 'type': 'str'}, - 'load_balancer_sku': {'key': 'loadBalancerSku', 'type': 'str'}, + "network_plugin": {"key": "networkPlugin", "type": "str"}, + "network_policy": {"key": "networkPolicy", "type": "str"}, + "network_mode": {"key": "networkMode", "type": "str"}, + "load_balancer_sku": {"key": "loadBalancerSku", "type": "str"}, } def __init__( self, *, - network_plugin: Optional[Union[str, "_models.NetworkPlugin"]] = "kubenet", + network_plugin: Union[str, "_models.NetworkPlugin"] = "kubenet", network_policy: Optional[Union[str, "_models.NetworkPolicy"]] = None, network_mode: Optional[Union[str, "_models.NetworkMode"]] = None, load_balancer_sku: Optional[Union[str, "_models.LoadBalancerSku"]] = None, @@ -5057,30 +4957,30 @@ def __init__( ): """ :keyword network_plugin: networkPlugin for managed cluster snapshot. Known values are: "azure", - "kubenet", "none". Default value: "kubenet". + "kubenet", and "none". :paramtype network_plugin: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.NetworkPlugin - :keyword network_policy: networkPolicy for managed cluster snapshot. Known values are: - "calico", "azure". + :keyword network_policy: networkPolicy for managed cluster snapshot. Known values are: "calico" + and "azure". :paramtype network_policy: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.NetworkPolicy :keyword network_mode: networkMode for managed cluster snapshot. Known values are: - "transparent", "bridge". + "transparent" and "bridge". :paramtype network_mode: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.NetworkMode :keyword load_balancer_sku: loadBalancerSku for managed cluster snapshot. Known values are: - "standard", "basic". + "standard" and "basic". :paramtype load_balancer_sku: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.LoadBalancerSku """ - super(NetworkProfileForSnapshot, self).__init__(**kwargs) + super().__init__(**kwargs) self.network_plugin = network_plugin self.network_policy = network_policy self.network_mode = network_mode self.load_balancer_sku = load_balancer_sku -class OperationListResult(msrest.serialization.Model): +class OperationListResult(_serialization.Model): """The List Operation response. Variables are only populated by the server, and will be ignored when sending a request. @@ -5090,24 +4990,20 @@ class OperationListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[OperationValue]'}, + "value": {"key": "value", "type": "[OperationValue]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(OperationListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None -class OperationValue(msrest.serialization.Model): +class OperationValue(_serialization.Model): """Describes the properties of a Operation value. Variables are only populated by the server, and will be ignored when sending a request. @@ -5127,30 +5023,26 @@ class OperationValue(msrest.serialization.Model): """ _validation = { - 'origin': {'readonly': True}, - 'name': {'readonly': True}, - 'operation': {'readonly': True}, - 'resource': {'readonly': True}, - 'description': {'readonly': True}, - 'provider': {'readonly': True}, + "origin": {"readonly": True}, + "name": {"readonly": True}, + "operation": {"readonly": True}, + "resource": {"readonly": True}, + "description": {"readonly": True}, + "provider": {"readonly": True}, } _attribute_map = { - 'origin': {'key': 'origin', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'operation': {'key': 'display.operation', 'type': 'str'}, - 'resource': {'key': 'display.resource', 'type': 'str'}, - 'description': {'key': 'display.description', 'type': 'str'}, - 'provider': {'key': 'display.provider', 'type': 'str'}, + "origin": {"key": "origin", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "operation": {"key": "display.operation", "type": "str"}, + "resource": {"key": "display.resource", "type": "str"}, + "description": {"key": "display.description", "type": "str"}, + "provider": {"key": "display.provider", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(OperationValue, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.origin = None self.name = None self.operation = None @@ -5159,7 +5051,7 @@ def __init__( self.provider = None -class OSOptionProfile(msrest.serialization.Model): +class OSOptionProfile(_serialization.Model): """The OS option profile. Variables are only populated by the server, and will be ignored when sending a request. @@ -5172,83 +5064,72 @@ class OSOptionProfile(msrest.serialization.Model): :vartype name: str :ivar type: The type of the OS option resource. :vartype type: str - :ivar os_option_property_list: Required. The list of OS options. + :ivar os_option_property_list: The list of OS options. Required. :vartype os_option_property_list: list[~azure.mgmt.containerservice.v2022_02_02_preview.models.OSOptionProperty] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'os_option_property_list': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "os_option_property_list": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'os_option_property_list': {'key': 'properties.osOptionPropertyList', 'type': '[OSOptionProperty]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "os_option_property_list": {"key": "properties.osOptionPropertyList", "type": "[OSOptionProperty]"}, } - def __init__( - self, - *, - os_option_property_list: List["_models.OSOptionProperty"], - **kwargs - ): + def __init__(self, *, os_option_property_list: List["_models.OSOptionProperty"], **kwargs): """ - :keyword os_option_property_list: Required. The list of OS options. + :keyword os_option_property_list: The list of OS options. Required. :paramtype os_option_property_list: list[~azure.mgmt.containerservice.v2022_02_02_preview.models.OSOptionProperty] """ - super(OSOptionProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None self.os_option_property_list = os_option_property_list -class OSOptionProperty(msrest.serialization.Model): +class OSOptionProperty(_serialization.Model): """OS option property. All required parameters must be populated in order to send to Azure. - :ivar os_type: Required. The OS type. + :ivar os_type: The OS type. Required. :vartype os_type: str - :ivar enable_fips_image: Required. Whether the image is FIPS-enabled. + :ivar enable_fips_image: Whether the image is FIPS-enabled. Required. :vartype enable_fips_image: bool """ _validation = { - 'os_type': {'required': True}, - 'enable_fips_image': {'required': True}, + "os_type": {"required": True}, + "enable_fips_image": {"required": True}, } _attribute_map = { - 'os_type': {'key': 'os-type', 'type': 'str'}, - 'enable_fips_image': {'key': 'enable-fips-image', 'type': 'bool'}, + "os_type": {"key": "os-type", "type": "str"}, + "enable_fips_image": {"key": "enable-fips-image", "type": "bool"}, } - def __init__( - self, - *, - os_type: str, - enable_fips_image: bool, - **kwargs - ): + def __init__(self, *, os_type: str, enable_fips_image: bool, **kwargs): """ - :keyword os_type: Required. The OS type. + :keyword os_type: The OS type. Required. :paramtype os_type: str - :keyword enable_fips_image: Required. Whether the image is FIPS-enabled. + :keyword enable_fips_image: Whether the image is FIPS-enabled. Required. :paramtype enable_fips_image: bool """ - super(OSOptionProperty, self).__init__(**kwargs) + super().__init__(**kwargs) self.os_type = os_type self.enable_fips_image = enable_fips_image -class OutboundEnvironmentEndpoint(msrest.serialization.Model): +class OutboundEnvironmentEndpoint(_serialization.Model): """Egress endpoints which AKS agent nodes connect to for common purpose. :ivar category: The category of endpoints accessed by the AKS agent node, e.g. @@ -5260,8 +5141,8 @@ class OutboundEnvironmentEndpoint(msrest.serialization.Model): """ _attribute_map = { - 'category': {'key': 'category', 'type': 'str'}, - 'endpoints': {'key': 'endpoints', 'type': '[EndpointDependency]'}, + "category": {"key": "category", "type": "str"}, + "endpoints": {"key": "endpoints", "type": "[EndpointDependency]"}, } def __init__( @@ -5279,19 +5160,19 @@ def __init__( :paramtype endpoints: list[~azure.mgmt.containerservice.v2022_02_02_preview.models.EndpointDependency] """ - super(OutboundEnvironmentEndpoint, self).__init__(**kwargs) + super().__init__(**kwargs) self.category = category self.endpoints = endpoints -class OutboundEnvironmentEndpointCollection(msrest.serialization.Model): +class OutboundEnvironmentEndpointCollection(_serialization.Model): """Collection of OutboundEnvironmentEndpoint. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar value: Required. Collection of resources. + :ivar value: Collection of resources. Required. :vartype value: list[~azure.mgmt.containerservice.v2022_02_02_preview.models.OutboundEnvironmentEndpoint] :ivar next_link: Link to next page of resources. @@ -5299,59 +5180,49 @@ class OutboundEnvironmentEndpointCollection(msrest.serialization.Model): """ _validation = { - 'value': {'required': True}, - 'next_link': {'readonly': True}, + "value": {"required": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[OutboundEnvironmentEndpoint]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[OutboundEnvironmentEndpoint]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: List["_models.OutboundEnvironmentEndpoint"], - **kwargs - ): + def __init__(self, *, value: List["_models.OutboundEnvironmentEndpoint"], **kwargs): """ - :keyword value: Required. Collection of resources. + :keyword value: Collection of resources. Required. :paramtype value: list[~azure.mgmt.containerservice.v2022_02_02_preview.models.OutboundEnvironmentEndpoint] """ - super(OutboundEnvironmentEndpointCollection, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class PowerState(msrest.serialization.Model): +class PowerState(_serialization.Model): """Describes the Power State of the cluster. - :ivar code: Tells whether the cluster is Running or Stopped. Known values are: "Running", + :ivar code: Tells whether the cluster is Running or Stopped. Known values are: "Running" and "Stopped". :vartype code: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.Code """ _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, + "code": {"key": "code", "type": "str"}, } - def __init__( - self, - *, - code: Optional[Union[str, "_models.Code"]] = None, - **kwargs - ): + def __init__(self, *, code: Optional[Union[str, "_models.Code"]] = None, **kwargs): """ - :keyword code: Tells whether the cluster is Running or Stopped. Known values are: "Running", + :keyword code: Tells whether the cluster is Running or Stopped. Known values are: "Running" and "Stopped". :paramtype code: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.Code """ - super(PowerState, self).__init__(**kwargs) + super().__init__(**kwargs) self.code = code -class PrivateEndpoint(msrest.serialization.Model): +class PrivateEndpoint(_serialization.Model): """Private endpoint which a connection belongs to. :ivar id: The resource ID of the private endpoint. @@ -5359,24 +5230,19 @@ class PrivateEndpoint(msrest.serialization.Model): """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, } - def __init__( - self, - *, - id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin """ :keyword id: The resource ID of the private endpoint. :paramtype id: str """ - super(PrivateEndpoint, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id -class PrivateEndpointConnection(msrest.serialization.Model): +class PrivateEndpointConnection(_serialization.Model): """A private endpoint connection. Variables are only populated by the server, and will be ignored when sending a request. @@ -5388,7 +5254,7 @@ class PrivateEndpointConnection(msrest.serialization.Model): :ivar type: The resource type. :vartype type: str :ivar provisioning_state: The current provisioning state. Known values are: "Succeeded", - "Creating", "Deleting", "Failed". + "Creating", "Deleting", and "Failed". :vartype provisioning_state: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.PrivateEndpointConnectionProvisioningState :ivar private_endpoint: The resource of private endpoint. @@ -5401,19 +5267,22 @@ class PrivateEndpointConnection(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'provisioning_state': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, - 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "private_endpoint": {"key": "properties.privateEndpoint", "type": "PrivateEndpoint"}, + "private_link_service_connection_state": { + "key": "properties.privateLinkServiceConnectionState", + "type": "PrivateLinkServiceConnectionState", + }, } def __init__( @@ -5432,7 +5301,7 @@ def __init__( :paramtype private_link_service_connection_state: ~azure.mgmt.containerservice.v2022_02_02_preview.models.PrivateLinkServiceConnectionState """ - super(PrivateEndpointConnection, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -5441,7 +5310,7 @@ def __init__( self.private_link_service_connection_state = private_link_service_connection_state -class PrivateEndpointConnectionListResult(msrest.serialization.Model): +class PrivateEndpointConnectionListResult(_serialization.Model): """A list of private endpoint connections. :ivar value: The collection value. @@ -5450,25 +5319,20 @@ class PrivateEndpointConnectionListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, + "value": {"key": "value", "type": "[PrivateEndpointConnection]"}, } - def __init__( - self, - *, - value: Optional[List["_models.PrivateEndpointConnection"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.PrivateEndpointConnection"]] = None, **kwargs): """ :keyword value: The collection value. :paramtype value: list[~azure.mgmt.containerservice.v2022_02_02_preview.models.PrivateEndpointConnection] """ - super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value -class PrivateLinkResource(msrest.serialization.Model): +class PrivateLinkResource(_serialization.Model): """A private link resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -5489,22 +5353,22 @@ class PrivateLinkResource(msrest.serialization.Model): """ _validation = { - 'private_link_service_id': {'readonly': True}, + "private_link_service_id": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'group_id': {'key': 'groupId', 'type': 'str'}, - 'required_members': {'key': 'requiredMembers', 'type': '[str]'}, - 'private_link_service_id': {'key': 'privateLinkServiceID', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "group_id": {"key": "groupId", "type": "str"}, + "required_members": {"key": "requiredMembers", "type": "[str]"}, + "private_link_service_id": {"key": "privateLinkServiceID", "type": "str"}, } def __init__( self, *, - id: Optional[str] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin name: Optional[str] = None, type: Optional[str] = None, group_id: Optional[str] = None, @@ -5523,7 +5387,7 @@ def __init__( :keyword required_members: The RequiredMembers of the resource. :paramtype required_members: list[str] """ - super(PrivateLinkResource, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id self.name = name self.type = type @@ -5532,7 +5396,7 @@ def __init__( self.private_link_service_id = None -class PrivateLinkResourcesListResult(msrest.serialization.Model): +class PrivateLinkResourcesListResult(_serialization.Model): """A list of private link resources. :ivar value: The collection value. @@ -5541,29 +5405,24 @@ class PrivateLinkResourcesListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, + "value": {"key": "value", "type": "[PrivateLinkResource]"}, } - def __init__( - self, - *, - value: Optional[List["_models.PrivateLinkResource"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.PrivateLinkResource"]] = None, **kwargs): """ :keyword value: The collection value. :paramtype value: list[~azure.mgmt.containerservice.v2022_02_02_preview.models.PrivateLinkResource] """ - super(PrivateLinkResourcesListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value -class PrivateLinkServiceConnectionState(msrest.serialization.Model): +class PrivateLinkServiceConnectionState(_serialization.Model): """The state of a private link service connection. :ivar status: The private link service connection status. Known values are: "Pending", - "Approved", "Rejected", "Disconnected". + "Approved", "Rejected", and "Disconnected". :vartype status: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.ConnectionStatus :ivar description: The private link service connection description. @@ -5571,8 +5430,8 @@ class PrivateLinkServiceConnectionState(msrest.serialization.Model): """ _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, + "status": {"key": "status", "type": "str"}, + "description": {"key": "description", "type": "str"}, } def __init__( @@ -5584,18 +5443,18 @@ def __init__( ): """ :keyword status: The private link service connection status. Known values are: "Pending", - "Approved", "Rejected", "Disconnected". + "Approved", "Rejected", and "Disconnected". :paramtype status: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.ConnectionStatus :keyword description: The private link service connection description. :paramtype description: str """ - super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) + super().__init__(**kwargs) self.status = status self.description = description -class ResourceReference(msrest.serialization.Model): +class ResourceReference(_serialization.Model): """A reference to an Azure resource. :ivar id: The fully qualified Azure resource id. @@ -5603,29 +5462,24 @@ class ResourceReference(msrest.serialization.Model): """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, } - def __init__( - self, - *, - id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin """ :keyword id: The fully qualified Azure resource id. :paramtype id: str """ - super(ResourceReference, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id -class RunCommandRequest(msrest.serialization.Model): +class RunCommandRequest(_serialization.Model): """A run command request. All required parameters must be populated in order to send to Azure. - :ivar command: Required. The command to run. + :ivar command: The command to run. Required. :vartype command: str :ivar context: A base64 encoded zip file containing the files required by the command. :vartype context: str @@ -5634,38 +5488,31 @@ class RunCommandRequest(msrest.serialization.Model): """ _validation = { - 'command': {'required': True}, + "command": {"required": True}, } _attribute_map = { - 'command': {'key': 'command', 'type': 'str'}, - 'context': {'key': 'context', 'type': 'str'}, - 'cluster_token': {'key': 'clusterToken', 'type': 'str'}, + "command": {"key": "command", "type": "str"}, + "context": {"key": "context", "type": "str"}, + "cluster_token": {"key": "clusterToken", "type": "str"}, } - def __init__( - self, - *, - command: str, - context: Optional[str] = None, - cluster_token: Optional[str] = None, - **kwargs - ): + def __init__(self, *, command: str, context: Optional[str] = None, cluster_token: Optional[str] = None, **kwargs): """ - :keyword command: Required. The command to run. + :keyword command: The command to run. Required. :paramtype command: str :keyword context: A base64 encoded zip file containing the files required by the command. :paramtype context: str :keyword cluster_token: AuthToken issued for AKS AAD Server App. :paramtype cluster_token: str """ - super(RunCommandRequest, self).__init__(**kwargs) + super().__init__(**kwargs) self.command = command self.context = context self.cluster_token = cluster_token -class RunCommandResult(msrest.serialization.Model): +class RunCommandResult(_serialization.Model): """run command result. Variables are only populated by the server, and will be ignored when sending a request. @@ -5687,32 +5534,28 @@ class RunCommandResult(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'exit_code': {'readonly': True}, - 'started_at': {'readonly': True}, - 'finished_at': {'readonly': True}, - 'logs': {'readonly': True}, - 'reason': {'readonly': True}, + "id": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "exit_code": {"readonly": True}, + "started_at": {"readonly": True}, + "finished_at": {"readonly": True}, + "logs": {"readonly": True}, + "reason": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'exit_code': {'key': 'properties.exitCode', 'type': 'int'}, - 'started_at': {'key': 'properties.startedAt', 'type': 'iso-8601'}, - 'finished_at': {'key': 'properties.finishedAt', 'type': 'iso-8601'}, - 'logs': {'key': 'properties.logs', 'type': 'str'}, - 'reason': {'key': 'properties.reason', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(RunCommandResult, self).__init__(**kwargs) + "id": {"key": "id", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "exit_code": {"key": "properties.exitCode", "type": "int"}, + "started_at": {"key": "properties.startedAt", "type": "iso-8601"}, + "finished_at": {"key": "properties.finishedAt", "type": "iso-8601"}, + "logs": {"key": "properties.logs", "type": "str"}, + "reason": {"key": "properties.reason", "type": "str"}, + } + + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.id = None self.provisioning_state = None self.exit_code = None @@ -5722,7 +5565,7 @@ def __init__( self.reason = None -class Snapshot(Resource): +class Snapshot(Resource): # pylint: disable=too-many-instance-attributes """A node pool snapshot resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -5740,26 +5583,26 @@ class Snapshot(Resource): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.containerservice.v2022_02_02_preview.models.SystemData - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar creation_data: CreationData to be used to specify the source agent pool resource ID to create this snapshot. :vartype creation_data: ~azure.mgmt.containerservice.v2022_02_02_preview.models.CreationData :ivar snapshot_type: The type of a snapshot. The default is NodePool. Known values are: - "NodePool", "ManagedCluster". Default value: "NodePool". + "NodePool" and "ManagedCluster". :vartype snapshot_type: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.SnapshotType :ivar kubernetes_version: The version of Kubernetes. :vartype kubernetes_version: str :ivar node_image_version: The version of node image. :vartype node_image_version: str - :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.OSType :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known - values are: "Ubuntu", "CBLMariner". + values are: "Ubuntu" and "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.OSSKU :ivar vm_size: The size of the VM. :vartype vm_size: str @@ -5768,34 +5611,34 @@ class Snapshot(Resource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'location': {'required': True}, - 'kubernetes_version': {'readonly': True}, - 'node_image_version': {'readonly': True}, - 'os_type': {'readonly': True}, - 'os_sku': {'readonly': True}, - 'vm_size': {'readonly': True}, - 'enable_fips': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, + "kubernetes_version": {"readonly": True}, + "node_image_version": {"readonly": True}, + "os_type": {"readonly": True}, + "os_sku": {"readonly": True}, + "vm_size": {"readonly": True}, + "enable_fips": {"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'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'creation_data': {'key': 'properties.creationData', 'type': 'CreationData'}, - 'snapshot_type': {'key': 'properties.snapshotType', 'type': 'str'}, - 'kubernetes_version': {'key': 'properties.kubernetesVersion', 'type': 'str'}, - 'node_image_version': {'key': 'properties.nodeImageVersion', 'type': 'str'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'os_sku': {'key': 'properties.osSku', 'type': 'str'}, - 'vm_size': {'key': 'properties.vmSize', 'type': 'str'}, - 'enable_fips': {'key': 'properties.enableFIPS', 'type': 'bool'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "creation_data": {"key": "properties.creationData", "type": "CreationData"}, + "snapshot_type": {"key": "properties.snapshotType", "type": "str"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "node_image_version": {"key": "properties.nodeImageVersion", "type": "str"}, + "os_type": {"key": "properties.osType", "type": "str"}, + "os_sku": {"key": "properties.osSku", "type": "str"}, + "vm_size": {"key": "properties.vmSize", "type": "str"}, + "enable_fips": {"key": "properties.enableFIPS", "type": "bool"}, } def __init__( @@ -5804,23 +5647,23 @@ def __init__( location: str, tags: Optional[Dict[str, str]] = None, creation_data: Optional["_models.CreationData"] = None, - snapshot_type: Optional[Union[str, "_models.SnapshotType"]] = "NodePool", + snapshot_type: Union[str, "_models.SnapshotType"] = "NodePool", **kwargs ): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword creation_data: CreationData to be used to specify the source agent pool resource ID to create this snapshot. :paramtype creation_data: ~azure.mgmt.containerservice.v2022_02_02_preview.models.CreationData :keyword snapshot_type: The type of a snapshot. The default is NodePool. Known values are: - "NodePool", "ManagedCluster". Default value: "NodePool". + "NodePool" and "ManagedCluster". :paramtype snapshot_type: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.SnapshotType """ - super(Snapshot, self).__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.creation_data = creation_data self.snapshot_type = snapshot_type self.kubernetes_version = None @@ -5831,7 +5674,7 @@ def __init__( self.enable_fips = None -class SnapshotListResult(msrest.serialization.Model): +class SnapshotListResult(_serialization.Model): """The response from the List Snapshots operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -5843,30 +5686,25 @@ class SnapshotListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[Snapshot]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[Snapshot]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.Snapshot"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.Snapshot"]] = None, **kwargs): """ :keyword value: The list of snapshots. :paramtype value: list[~azure.mgmt.containerservice.v2022_02_02_preview.models.Snapshot] """ - super(SnapshotListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class SysctlConfig(msrest.serialization.Model): +class SysctlConfig(_serialization.Model): # pylint: disable=too-many-instance-attributes """Sysctl settings for Linux agent nodes. :ivar net_core_somaxconn: Sysctl setting net.core.somaxconn. @@ -5928,37 +5766,37 @@ class SysctlConfig(msrest.serialization.Model): """ _attribute_map = { - 'net_core_somaxconn': {'key': 'netCoreSomaxconn', 'type': 'int'}, - 'net_core_netdev_max_backlog': {'key': 'netCoreNetdevMaxBacklog', 'type': 'int'}, - 'net_core_rmem_default': {'key': 'netCoreRmemDefault', 'type': 'int'}, - 'net_core_rmem_max': {'key': 'netCoreRmemMax', 'type': 'int'}, - 'net_core_wmem_default': {'key': 'netCoreWmemDefault', 'type': 'int'}, - 'net_core_wmem_max': {'key': 'netCoreWmemMax', 'type': 'int'}, - 'net_core_optmem_max': {'key': 'netCoreOptmemMax', 'type': 'int'}, - 'net_ipv4_tcp_max_syn_backlog': {'key': 'netIpv4TcpMaxSynBacklog', 'type': 'int'}, - 'net_ipv4_tcp_max_tw_buckets': {'key': 'netIpv4TcpMaxTwBuckets', 'type': 'int'}, - 'net_ipv4_tcp_fin_timeout': {'key': 'netIpv4TcpFinTimeout', 'type': 'int'}, - 'net_ipv4_tcp_keepalive_time': {'key': 'netIpv4TcpKeepaliveTime', 'type': 'int'}, - 'net_ipv4_tcp_keepalive_probes': {'key': 'netIpv4TcpKeepaliveProbes', 'type': 'int'}, - 'net_ipv4_tcpkeepalive_intvl': {'key': 'netIpv4TcpkeepaliveIntvl', 'type': 'int'}, - 'net_ipv4_tcp_tw_reuse': {'key': 'netIpv4TcpTwReuse', 'type': 'bool'}, - 'net_ipv4_ip_local_port_range': {'key': 'netIpv4IpLocalPortRange', 'type': 'str'}, - 'net_ipv4_neigh_default_gc_thresh1': {'key': 'netIpv4NeighDefaultGcThresh1', 'type': 'int'}, - 'net_ipv4_neigh_default_gc_thresh2': {'key': 'netIpv4NeighDefaultGcThresh2', 'type': 'int'}, - 'net_ipv4_neigh_default_gc_thresh3': {'key': 'netIpv4NeighDefaultGcThresh3', 'type': 'int'}, - 'net_netfilter_nf_conntrack_max': {'key': 'netNetfilterNfConntrackMax', 'type': 'int'}, - 'net_netfilter_nf_conntrack_buckets': {'key': 'netNetfilterNfConntrackBuckets', 'type': 'int'}, - 'fs_inotify_max_user_watches': {'key': 'fsInotifyMaxUserWatches', 'type': 'int'}, - 'fs_file_max': {'key': 'fsFileMax', 'type': 'int'}, - 'fs_aio_max_nr': {'key': 'fsAioMaxNr', 'type': 'int'}, - 'fs_nr_open': {'key': 'fsNrOpen', 'type': 'int'}, - 'kernel_threads_max': {'key': 'kernelThreadsMax', 'type': 'int'}, - 'vm_max_map_count': {'key': 'vmMaxMapCount', 'type': 'int'}, - 'vm_swappiness': {'key': 'vmSwappiness', 'type': 'int'}, - 'vm_vfs_cache_pressure': {'key': 'vmVfsCachePressure', 'type': 'int'}, - } - - def __init__( + "net_core_somaxconn": {"key": "netCoreSomaxconn", "type": "int"}, + "net_core_netdev_max_backlog": {"key": "netCoreNetdevMaxBacklog", "type": "int"}, + "net_core_rmem_default": {"key": "netCoreRmemDefault", "type": "int"}, + "net_core_rmem_max": {"key": "netCoreRmemMax", "type": "int"}, + "net_core_wmem_default": {"key": "netCoreWmemDefault", "type": "int"}, + "net_core_wmem_max": {"key": "netCoreWmemMax", "type": "int"}, + "net_core_optmem_max": {"key": "netCoreOptmemMax", "type": "int"}, + "net_ipv4_tcp_max_syn_backlog": {"key": "netIpv4TcpMaxSynBacklog", "type": "int"}, + "net_ipv4_tcp_max_tw_buckets": {"key": "netIpv4TcpMaxTwBuckets", "type": "int"}, + "net_ipv4_tcp_fin_timeout": {"key": "netIpv4TcpFinTimeout", "type": "int"}, + "net_ipv4_tcp_keepalive_time": {"key": "netIpv4TcpKeepaliveTime", "type": "int"}, + "net_ipv4_tcp_keepalive_probes": {"key": "netIpv4TcpKeepaliveProbes", "type": "int"}, + "net_ipv4_tcpkeepalive_intvl": {"key": "netIpv4TcpkeepaliveIntvl", "type": "int"}, + "net_ipv4_tcp_tw_reuse": {"key": "netIpv4TcpTwReuse", "type": "bool"}, + "net_ipv4_ip_local_port_range": {"key": "netIpv4IpLocalPortRange", "type": "str"}, + "net_ipv4_neigh_default_gc_thresh1": {"key": "netIpv4NeighDefaultGcThresh1", "type": "int"}, + "net_ipv4_neigh_default_gc_thresh2": {"key": "netIpv4NeighDefaultGcThresh2", "type": "int"}, + "net_ipv4_neigh_default_gc_thresh3": {"key": "netIpv4NeighDefaultGcThresh3", "type": "int"}, + "net_netfilter_nf_conntrack_max": {"key": "netNetfilterNfConntrackMax", "type": "int"}, + "net_netfilter_nf_conntrack_buckets": {"key": "netNetfilterNfConntrackBuckets", "type": "int"}, + "fs_inotify_max_user_watches": {"key": "fsInotifyMaxUserWatches", "type": "int"}, + "fs_file_max": {"key": "fsFileMax", "type": "int"}, + "fs_aio_max_nr": {"key": "fsAioMaxNr", "type": "int"}, + "fs_nr_open": {"key": "fsNrOpen", "type": "int"}, + "kernel_threads_max": {"key": "kernelThreadsMax", "type": "int"}, + "vm_max_map_count": {"key": "vmMaxMapCount", "type": "int"}, + "vm_swappiness": {"key": "vmSwappiness", "type": "int"}, + "vm_vfs_cache_pressure": {"key": "vmVfsCachePressure", "type": "int"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, net_core_somaxconn: Optional[int] = None, @@ -6049,7 +5887,7 @@ def __init__( :keyword vm_vfs_cache_pressure: Sysctl setting vm.vfs_cache_pressure. :paramtype vm_vfs_cache_pressure: int """ - super(SysctlConfig, self).__init__(**kwargs) + super().__init__(**kwargs) self.net_core_somaxconn = net_core_somaxconn self.net_core_netdev_max_backlog = net_core_netdev_max_backlog self.net_core_rmem_default = net_core_rmem_default @@ -6080,13 +5918,13 @@ def __init__( self.vm_vfs_cache_pressure = vm_vfs_cache_pressure -class SystemData(msrest.serialization.Model): +class SystemData(_serialization.Model): """Metadata pertaining to creation and last modification of the resource. :ivar created_by: The identity that created the resource. :vartype created_by: str :ivar created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", "Key". + "User", "Application", "ManagedIdentity", and "Key". :vartype created_by_type: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.CreatedByType :ivar created_at: The timestamp of resource creation (UTC). @@ -6094,7 +5932,7 @@ class SystemData(msrest.serialization.Model): :ivar last_modified_by: The identity that last modified the resource. :vartype last_modified_by: str :ivar last_modified_by_type: The type of identity that last modified the resource. Known values - are: "User", "Application", "ManagedIdentity", "Key". + are: "User", "Application", "ManagedIdentity", and "Key". :vartype last_modified_by_type: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.CreatedByType :ivar last_modified_at: The timestamp of resource last modification (UTC). @@ -6102,12 +5940,12 @@ class SystemData(msrest.serialization.Model): """ _attribute_map = { - 'created_by': {'key': 'createdBy', 'type': 'str'}, - 'created_by_type': {'key': 'createdByType', 'type': 'str'}, - 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, - 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, - 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, - 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + "created_by": {"key": "createdBy", "type": "str"}, + "created_by_type": {"key": "createdByType", "type": "str"}, + "created_at": {"key": "createdAt", "type": "iso-8601"}, + "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, + "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, + "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, } def __init__( @@ -6125,7 +5963,7 @@ def __init__( :keyword created_by: The identity that created the resource. :paramtype created_by: str :keyword created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", "Key". + "User", "Application", "ManagedIdentity", and "Key". :paramtype created_by_type: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.CreatedByType :keyword created_at: The timestamp of resource creation (UTC). @@ -6133,13 +5971,13 @@ def __init__( :keyword last_modified_by: The identity that last modified the resource. :paramtype last_modified_by: str :keyword last_modified_by_type: The type of identity that last modified the resource. Known - values are: "User", "Application", "ManagedIdentity", "Key". + values are: "User", "Application", "ManagedIdentity", and "Key". :paramtype last_modified_by_type: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.CreatedByType :keyword last_modified_at: The timestamp of resource last modification (UTC). :paramtype last_modified_at: ~datetime.datetime """ - super(SystemData, self).__init__(**kwargs) + super().__init__(**kwargs) self.created_by = created_by self.created_by_type = created_by_type self.created_at = created_at @@ -6148,36 +5986,31 @@ def __init__( self.last_modified_at = last_modified_at -class TagsObject(msrest.serialization.Model): +class TagsObject(_serialization.Model): """Tags object for patch operations. - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] """ _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] """ - super(TagsObject, self).__init__(**kwargs) + super().__init__(**kwargs) self.tags = tags -class TimeInWeek(msrest.serialization.Model): +class TimeInWeek(_serialization.Model): """Time in a week. :ivar day: The day of the week. Known values are: "Sunday", "Monday", "Tuesday", "Wednesday", - "Thursday", "Friday", "Saturday". + "Thursday", "Friday", and "Saturday". :vartype day: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.WeekDay :ivar hour_slots: Each integer hour represents a time range beginning at 0m after the hour ending at the next hour (non-inclusive). 0 corresponds to 00:00 UTC, 23 corresponds to 23:00 @@ -6186,32 +6019,28 @@ class TimeInWeek(msrest.serialization.Model): """ _attribute_map = { - 'day': {'key': 'day', 'type': 'str'}, - 'hour_slots': {'key': 'hourSlots', 'type': '[int]'}, + "day": {"key": "day", "type": "str"}, + "hour_slots": {"key": "hourSlots", "type": "[int]"}, } def __init__( - self, - *, - day: Optional[Union[str, "_models.WeekDay"]] = None, - hour_slots: Optional[List[int]] = None, - **kwargs + self, *, day: Optional[Union[str, "_models.WeekDay"]] = None, hour_slots: Optional[List[int]] = None, **kwargs ): """ :keyword day: The day of the week. Known values are: "Sunday", "Monday", "Tuesday", - "Wednesday", "Thursday", "Friday", "Saturday". + "Wednesday", "Thursday", "Friday", and "Saturday". :paramtype day: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.WeekDay :keyword hour_slots: Each integer hour represents a time range beginning at 0m after the hour ending at the next hour (non-inclusive). 0 corresponds to 00:00 UTC, 23 corresponds to 23:00 UTC. Specifying [0, 1] means the 00:00 - 02:00 UTC time range. :paramtype hour_slots: list[int] """ - super(TimeInWeek, self).__init__(**kwargs) + super().__init__(**kwargs) self.day = day self.hour_slots = hour_slots -class TimeSpan(msrest.serialization.Model): +class TimeSpan(_serialization.Model): """For example, between 2021-05-25T13:00:00Z and 2021-05-25T14:00:00Z. :ivar start: The start of a time span. @@ -6221,29 +6050,23 @@ class TimeSpan(msrest.serialization.Model): """ _attribute_map = { - 'start': {'key': 'start', 'type': 'iso-8601'}, - 'end': {'key': 'end', 'type': 'iso-8601'}, + "start": {"key": "start", "type": "iso-8601"}, + "end": {"key": "end", "type": "iso-8601"}, } - def __init__( - self, - *, - start: Optional[datetime.datetime] = None, - end: Optional[datetime.datetime] = None, - **kwargs - ): + def __init__(self, *, start: Optional[datetime.datetime] = None, end: Optional[datetime.datetime] = None, **kwargs): """ :keyword start: The start of a time span. :paramtype start: ~datetime.datetime :keyword end: The end of a time span. :paramtype end: ~datetime.datetime """ - super(TimeSpan, self).__init__(**kwargs) + super().__init__(**kwargs) self.start = start self.end = end -class WindowsGmsaProfile(msrest.serialization.Model): +class WindowsGmsaProfile(_serialization.Model): """Windows gMSA Profile in the managed cluster. :ivar enabled: Specifies whether to enable Windows gMSA in the managed cluster. @@ -6259,9 +6082,9 @@ class WindowsGmsaProfile(msrest.serialization.Model): """ _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'dns_server': {'key': 'dnsServer', 'type': 'str'}, - 'root_domain_name': {'key': 'rootDomainName', 'type': 'str'}, + "enabled": {"key": "enabled", "type": "bool"}, + "dns_server": {"key": "dnsServer", "type": "str"}, + "root_domain_name": {"key": "rootDomainName", "type": "str"}, } def __init__( @@ -6284,7 +6107,7 @@ def __init__( which is used to create the managed cluster. :paramtype root_domain_name: str """ - super(WindowsGmsaProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.dns_server = dns_server self.root_domain_name = root_domain_name diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/models/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/models/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/models/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/models/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/operations/__init__.py index d3b41c8a72b0..02682f76ce58 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/operations/__init__.py @@ -19,16 +19,17 @@ from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'Operations', - 'ManagedClustersOperations', - 'MaintenanceConfigurationsOperations', - 'AgentPoolsOperations', - 'PrivateEndpointConnectionsOperations', - 'PrivateLinkResourcesOperations', - 'ResolvePrivateLinkServiceIdOperations', - 'SnapshotsOperations', - 'ManagedClusterSnapshotsOperations', + "Operations", + "ManagedClustersOperations", + "MaintenanceConfigurationsOperations", + "AgentPoolsOperations", + "PrivateEndpointConnectionsOperations", + "PrivateLinkResourcesOperations", + "ResolvePrivateLinkServiceIdOperations", + "SnapshotsOperations", + "ManagedClusterSnapshotsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/operations/_agent_pools_operations.py index b7a261f108fb..4c874496b584 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/operations/_agent_pools_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,288 +27,303 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - *, - json: Optional[_models.AgentPool] = None, - content: Any = None, - **kwargs: Any + _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, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + _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, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_get_upgrade_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_available_agent_pool_versions_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_upgrade_node_image_version_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_upgrade_node_image_version_request( + resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class AgentPoolsOperations: """ @@ -324,47 +344,41 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> Iterable[_models.AgentPoolListResult]: + def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> Iterable["_models.AgentPool"]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AgentPoolListResult or the result of cls(response) + :return: An iterator like instance of either AgentPool or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_02_02_preview.models.AgentPoolListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_02_02_preview.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -372,16 +386,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -397,10 +406,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -410,54 +417,46 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore @distributed_trace def get( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPool: """Gets the specified managed cluster agent pool. Gets the specified managed cluster agent pool. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPool, or the result of cls(response) + :return: AgentPool or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.AgentPool - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -465,57 +464,60 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore def _create_or_update_initial( self, resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: _models.AgentPool, + parameters: Union[_models.AgentPool, IO], **kwargs: Any ) -> _models.AgentPool: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - _json = self._serialize.body(parameters, 'AgentPool') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "AgentPool") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -523,10 +525,9 @@ def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -534,26 +535,27 @@ def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - @distributed_trace + @overload def begin_create_or_update( self, resource_group_name: str, resource_name: str, agent_pool_name: str, parameters: _models.AgentPool, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.AgentPool]: """Creates or updates an agent pool in the specified managed cluster. @@ -561,13 +563,98 @@ def begin_create_or_update( Creates or updates an agent pool in the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str - :param parameters: The agent pool to create or update. + :param parameters: The agent pool to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_02_02_preview.models.AgentPool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_02_02_preview.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AgentPool]: + """Creates or updates an agent pool in the specified managed cluster. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: The agent pool to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_02_02_preview.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: Union[_models.AgentPool, IO], + **kwargs: Any + ) -> LROPoller[_models.AgentPool]: + """Creates or updates an agent pool in the specified managed cluster. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: The agent pool to create or update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.mgmt.containerservice.v2022_02_02_preview.models.AgentPool or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -579,20 +666,17 @@ def begin_create_or_update( :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_02_02_preview.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -601,66 +685,55 @@ def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -668,10 +741,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -681,26 +753,22 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + def begin_delete( + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> LROPoller[None]: """Deletes an agent pool in the specified managed cluster. Deletes an agent pool in the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -712,99 +780,86 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPoolUpgradeProfile: """Gets the upgrade profile for an agent pool. Gets the upgrade profile for an agent pool. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolUpgradeProfile, or the result of cls(response) + :return: AgentPoolUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.AgentPoolUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -812,32 +867,27 @@ def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolUpgradeProfile', pipeline_response) + deserialized = self._deserialize("AgentPoolUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore @distributed_trace def get_available_agent_pool_versions( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported Kubernetes versions for the specified agent pool. @@ -846,32 +896,30 @@ def get_available_agent_pool_versions( the version lifecycle. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolAvailableVersions, or the result of cls(response) + :return: AgentPoolAvailableVersions or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.AgentPoolAvailableVersions - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolAvailableVersions] - request = build_get_available_agent_pool_versions_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_available_agent_pool_versions.metadata['url'], + template_url=self.get_available_agent_pool_versions.metadata["url"], headers=_headers, params=_params, ) @@ -879,52 +927,43 @@ def get_available_agent_pool_versions( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolAvailableVersions', pipeline_response) + deserialized = self._deserialize("AgentPoolAvailableVersions", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_available_agent_pool_versions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore - + get_available_agent_pool_versions.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore def _upgrade_node_image_version_initial( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> Optional[_models.AgentPool]: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.AgentPool]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.AgentPool]] - - request = build_upgrade_node_image_version_request_initial( - subscription_id=self._config.subscription_id, + request = build_upgrade_node_image_version_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._upgrade_node_image_version_initial.metadata['url'], + template_url=self._upgrade_node_image_version_initial.metadata["url"], headers=_headers, params=_params, ) @@ -932,10 +971,9 @@ def _upgrade_node_image_version_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -945,26 +983,23 @@ def _upgrade_node_image_version_initial( deserialized = None response_headers = {} if response.status_code == 202: - response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) - - deserialized = self._deserialize('AgentPool', pipeline_response) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _upgrade_node_image_version_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore - + _upgrade_node_image_version_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore @distributed_trace def begin_upgrade_node_image_version( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any - ) -> LROPoller[_models.AgentPool]: + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any + ) -> LROPoller[None]: """Upgrades the node image version of an agent pool to the latest. Upgrading the node image version of an agent pool applies the newest OS and runtime updates to @@ -972,10 +1007,11 @@ def begin_upgrade_node_image_version( node image versions, see: https://docs.microsoft.com/azure/aks/node-image-upgrade. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -988,59 +1024,54 @@ def begin_upgrade_node_image_version( :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_02_02_preview.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._upgrade_node_image_version_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) - - deserialized = self._deserialize('AgentPool', pipeline_response) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_upgrade_node_image_version.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore + begin_upgrade_node_image_version.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/operations/_maintenance_configurations_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/operations/_maintenance_configurations_operations.py index 3fa1d72240c7..00f81ac3bc2c 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/operations/_maintenance_configurations_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/operations/_maintenance_configurations_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,173 +25,181 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +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_managed_cluster_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, config_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "configName": _SERIALIZER.url("config_name", config_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "configName": _SERIALIZER.url("config_name", config_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - config_name: str, - *, - json: Optional[_models.MaintenanceConfiguration] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, resource_name: str, config_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "configName": _SERIALIZER.url("config_name", config_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "configName": _SERIALIZER.url("config_name", config_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, config_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "configName": _SERIALIZER.url("config_name", config_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "configName": _SERIALIZER.url("config_name", config_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class MaintenanceConfigurationsOperations: """ @@ -207,48 +220,44 @@ def __init__(self, *args, **kwargs): 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_managed_cluster( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> Iterable[_models.MaintenanceConfigurationListResult]: + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> Iterable["_models.MaintenanceConfiguration"]: """Gets a list of maintenance configurations in the specified managed cluster. Gets a list of maintenance configurations in the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either MaintenanceConfigurationListResult or the result - of cls(response) + :return: An iterator like instance of either MaintenanceConfiguration or the result of + cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_02_02_preview.models.MaintenanceConfigurationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_02_02_preview.models.MaintenanceConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfigurationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfigurationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_managed_cluster_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_managed_cluster.metadata['url'], + template_url=self.list_by_managed_cluster.metadata["url"], headers=_headers, params=_params, ) @@ -256,16 +265,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_managed_cluster_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -281,10 +285,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -294,54 +296,46 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_managed_cluster.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations"} # type: ignore + list_by_managed_cluster.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations"} # type: ignore @distributed_trace def get( - self, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, config_name: str, **kwargs: Any ) -> _models.MaintenanceConfiguration: """Gets the specified maintenance configuration of a managed cluster. Gets the specified maintenance configuration of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: MaintenanceConfiguration, or the result of cls(response) + :return: MaintenanceConfiguration or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.MaintenanceConfiguration - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfiguration] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -349,33 +343,33 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) + deserialized = self._deserialize("MaintenanceConfiguration", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - - @distributed_trace + @overload def create_or_update( self, resource_group_name: str, resource_name: str, config_name: str, parameters: _models.MaintenanceConfiguration, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.MaintenanceConfiguration: """Creates or updates a maintenance configuration in the specified managed cluster. @@ -383,42 +377,117 @@ def create_or_update( Creates or updates a maintenance configuration in the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str - :param parameters: The maintenance configuration to create or update. + :param parameters: The maintenance configuration to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_02_02_preview.models.MaintenanceConfiguration + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configuration in the specified managed cluster. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: The maintenance configuration to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: MaintenanceConfiguration, or the result of cls(response) + :return: MaintenanceConfiguration or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.MaintenanceConfiguration - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: Union[_models.MaintenanceConfiguration, IO], + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configuration in the specified managed cluster. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: The maintenance configuration to create or update. Is either a model type or + a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2022_02_02_preview.models.MaintenanceConfiguration or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfiguration] - _json = self._serialize.body(parameters, 'MaintenanceConfiguration') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "MaintenanceConfiguration") request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) @@ -426,68 +495,60 @@ def create_or_update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) + deserialized = self._deserialize("MaintenanceConfiguration", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore @distributed_trace def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, config_name: str, **kwargs: Any ) -> None: """Deletes a maintenance configuration. Deletes a maintenance configuration. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) @@ -495,10 +556,9 @@ def delete( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -508,5 +568,4 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/operations/_managed_cluster_snapshots_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/operations/_managed_cluster_snapshots_operations.py index 6b37ecba75ec..e0f7b498a33d 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/operations/_managed_cluster_snapshots_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/operations/_managed_cluster_snapshots_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,243 +25,235 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedclustersnapshots") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedclustersnapshots" + ) # 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", min_length=1), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_resource_group_request( - subscription_id: str, - resource_group_name: str, - **kwargs: Any -) -> HttpRequest: +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: + _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, resource_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedClusterSnapshot] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_update_tags_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.TagsObject] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class ManagedClusterSnapshotsOperations: """ @@ -277,40 +274,35 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.ManagedClusterSnapshotListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.ManagedClusterSnapshot"]: """Gets a list of managed cluster snapshots in the specified subscription. Gets a list of managed cluster snapshots in the specified subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterSnapshotListResult or the result of + :return: An iterator like instance of either ManagedClusterSnapshot or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedClusterSnapshotListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedClusterSnapshot] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshotListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterSnapshotListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -318,14 +310,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -341,10 +330,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -354,49 +341,45 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedclustersnapshots"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedclustersnapshots"} # type: ignore @distributed_trace def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> Iterable[_models.ManagedClusterSnapshotListResult]: + self, resource_group_name: str, **kwargs: Any + ) -> Iterable["_models.ManagedClusterSnapshot"]: """Lists managed cluster snapshots in the specified subscription and resource group. Lists managed cluster snapshots in the specified subscription and resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterSnapshotListResult or the result of + :return: An iterator like instance of either ManagedClusterSnapshot or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedClusterSnapshotListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedClusterSnapshot] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshotListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterSnapshotListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -404,15 +387,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -428,10 +407,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -441,50 +418,41 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots"} # type: ignore @distributed_trace - def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.ManagedClusterSnapshot: + def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.ManagedClusterSnapshot: """Gets a managed cluster snapshot. Gets a managed cluster snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterSnapshot, or the result of cls(response) + :return: ManagedClusterSnapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedClusterSnapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterSnapshot] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -492,32 +460,32 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterSnapshot', pipeline_response) + deserialized = self._deserialize("ManagedClusterSnapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"} # type: ignore - @distributed_trace + @overload def create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterSnapshot, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.ManagedClusterSnapshot: """Creates or updates a managed cluster snapshot. @@ -525,39 +493,108 @@ def create_or_update( Creates or updates a managed cluster snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The managed cluster snapshot to create or update. + :param parameters: The managed cluster snapshot to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedClusterSnapshot + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedClusterSnapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedClusterSnapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ManagedClusterSnapshot: + """Creates or updates a managed cluster snapshot. + + Creates or updates a managed cluster snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster snapshot to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedClusterSnapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedClusterSnapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterSnapshot, IO], + **kwargs: Any + ) -> _models.ManagedClusterSnapshot: + """Creates or updates a managed cluster snapshot. + + Creates or updates a managed cluster snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster snapshot to create or update. Is either a model type or + a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedClusterSnapshot or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterSnapshot, or the result of cls(response) + :return: ManagedClusterSnapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedClusterSnapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterSnapshot] - _json = self._serialize.body(parameters, 'ManagedClusterSnapshot') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterSnapshot") request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) @@ -565,10 +602,9 @@ def create_or_update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -576,25 +612,26 @@ def create_or_update( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ManagedClusterSnapshot', pipeline_response) + deserialized = self._deserialize("ManagedClusterSnapshot", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('ManagedClusterSnapshot', pipeline_response) + deserialized = self._deserialize("ManagedClusterSnapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"} # type: ignore + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"} # type: ignore - - @distributed_trace + @overload def update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.ManagedClusterSnapshot: """Updates tags on a managed cluster snapshot. @@ -602,38 +639,104 @@ def update_tags( Updates tags on a managed cluster snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Update managed cluster snapshot Tags operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2022_02_02_preview.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterSnapshot, or the result of cls(response) + :return: ManagedClusterSnapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedClusterSnapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + def update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ManagedClusterSnapshot: + """Updates tags on a managed cluster snapshot. + + Updates tags on a managed cluster snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update managed cluster snapshot Tags operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedClusterSnapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedClusterSnapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> _models.ManagedClusterSnapshot: + """Updates tags on a managed cluster snapshot. + + Updates tags on a managed cluster snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update managed cluster snapshot Tags operation. + Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_02_02_preview.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedClusterSnapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedClusterSnapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterSnapshot] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") request = build_update_tags_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_tags.metadata['url'], + content=_content, + template_url=self.update_tags.metadata["url"], headers=_headers, params=_params, ) @@ -641,64 +744,57 @@ def update_tags( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterSnapshot', pipeline_response) + deserialized = self._deserialize("ManagedClusterSnapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"} # type: ignore - + update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"} # type: ignore @distributed_trace def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: """Deletes a managed cluster snapshot. Deletes a managed cluster snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) @@ -706,10 +802,9 @@ def delete( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -719,5 +814,4 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"} # type: ignore - + delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/operations/_managed_clusters_operations.py index 1e6e484add0a..164b7f16e64a 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/operations/_managed_clusters_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,200 +27,189 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_get_os_options_request( - subscription_id: str, - location: str, - *, - resource_type: Optional[str] = None, - **kwargs: Any + location: str, subscription_id: str, *, resource_type: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "location": _SERIALIZER.url("location", location, 'str', min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "location": _SERIALIZER.url("location", location, "str", min_length=1), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if resource_type is not None: - _params['resource-type'] = _SERIALIZER.query("resource_type", resource_type, 'str') + _params["resource-type"] = _SERIALIZER.query("resource_type", resource_type, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters") + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters" + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_resource_group_request( - subscription_id: str, - resource_group_name: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_upgrade_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_access_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, role_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "roleName": _SERIALIZER.url("role_name", role_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "roleName": _SERIALIZER.url("role_name", role_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_admin_credentials_request( - subscription_id: str, resource_group_name: str, resource_name: str, + subscription_id: str, *, server_fqdn: Optional[str] = None, **kwargs: Any @@ -223,40 +217,46 @@ def build_list_cluster_admin_credentials_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if server_fqdn is not None: - _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + _params["server-fqdn"] = _SERIALIZER.query("server_fqdn", server_fqdn, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_user_credentials_request( - subscription_id: str, resource_group_name: str, resource_name: str, + subscription_id: str, *, server_fqdn: Optional[str] = None, format: Optional[Union[str, "_models.Format"]] = None, @@ -265,42 +265,48 @@ def build_list_cluster_user_credentials_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if server_fqdn is not None: - _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + _params["server-fqdn"] = _SERIALIZER.query("server_fqdn", server_fqdn, "str") if format is not None: - _params['format'] = _SERIALIZER.query("format", format, 'str') + _params["format"] = _SERIALIZER.query("format", format, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_monitoring_user_credentials_request( - subscription_id: str, resource_group_name: str, resource_name: str, + subscription_id: str, *, server_fqdn: Optional[str] = None, **kwargs: Any @@ -308,520 +314,535 @@ def build_list_cluster_monitoring_user_credentials_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if server_fqdn is not None: - _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + _params["server-fqdn"] = _SERIALIZER.query("server_fqdn", server_fqdn, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: + +def build_get_request(resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedCluster] = None, - content: Any = None, - **kwargs: Any + +def build_create_or_update_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_update_tags_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.TagsObject] = None, - content: Any = None, - **kwargs: Any + +def build_update_tags_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + +def build_delete_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_reset_service_principal_profile_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedClusterServicePrincipalProfile] = None, - content: Any = None, - **kwargs: Any + +def build_reset_service_principal_profile_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_reset_aad_profile_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedClusterAADProfile] = None, - content: Any = None, - **kwargs: Any + +def build_reset_aad_profile_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_rotate_cluster_certificates_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + +def build_rotate_cluster_certificates_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_stop_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + +def build_stop_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_start_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + +def build_start_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_run_command_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.RunCommandRequest] = None, - content: Any = None, - **kwargs: Any + +def build_run_command_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_get_command_result_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - command_id: str, - **kwargs: Any + resource_group_name: str, resource_name: str, command_id: 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "commandId": _SERIALIZER.url("command_id", command_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "commandId": _SERIALIZER.url("command_id", command_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_list_outbound_network_dependencies_endpoints_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + class ManagedClustersOperations: # pylint: disable=too-many-public-methods """ @@ -842,46 +863,39 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def get_os_options( - self, - location: str, - resource_type: Optional[str] = None, - **kwargs: Any + self, location: str, resource_type: Optional[str] = None, **kwargs: Any ) -> _models.OSOptionProfile: """Gets supported OS options in the specified subscription. Gets supported OS options in the specified subscription. - :param location: The name of Azure region. + :param location: The name of Azure region. Required. :type location: str :param resource_type: The resource type for which the OS options needs to be returned. Default value is None. :type resource_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: OSOptionProfile, or the result of cls(response) + :return: OSOptionProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.OSOptionProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OSOptionProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OSOptionProfile] - request = build_get_os_options_request( - subscription_id=self._config.subscription_id, location=location, - api_version=api_version, + subscription_id=self._config.subscription_id, resource_type=resource_type, - template_url=self.get_os_options.metadata['url'], + api_version=api_version, + template_url=self.get_os_options.metadata["url"], headers=_headers, params=_params, ) @@ -889,59 +903,52 @@ def get_os_options( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('OSOptionProfile', pipeline_response) + deserialized = self._deserialize("OSOptionProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_os_options.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default"} # type: ignore - + get_os_options.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default"} # type: ignore @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.ManagedClusterListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.ManagedCluster"]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -949,14 +956,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -972,10 +976,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -985,49 +987,42 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> Iterable[_models.ManagedClusterListResult]: + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.ManagedCluster"]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -1035,15 +1030,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -1059,10 +1050,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1072,50 +1061,43 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.ManagedClusterUpgradeProfile: """Gets the upgrade profile of a managed cluster. Gets the upgrade profile of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterUpgradeProfile, or the result of cls(response) + :return: ManagedClusterUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedClusterUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -1123,33 +1105,27 @@ def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterUpgradeProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore @distributed_trace def get_access_profile( - self, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, role_name: str, **kwargs: Any ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. @@ -1159,35 +1135,33 @@ def get_access_profile( `_ . :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param role_name: The name of the role for managed cluster accessProfile resource. + :param role_name: The name of the role for managed cluster accessProfile resource. Required. :type role_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterAccessProfile, or the result of cls(response) + :return: ManagedClusterAccessProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedClusterAccessProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterAccessProfile] - request = build_get_access_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, role_name=role_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_access_profile.metadata['url'], + template_url=self.get_access_profile.metadata["url"], headers=_headers, params=_params, ) @@ -1195,68 +1169,60 @@ def get_access_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterAccessProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterAccessProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_access_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore - + get_access_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore @distributed_trace def list_cluster_admin_credentials( - self, - resource_group_name: str, - resource_name: str, - server_fqdn: Optional[str] = None, - **kwargs: Any + self, resource_group_name: str, resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any ) -> _models.CredentialResults: """Lists the admin credentials of a managed cluster. Lists the admin credentials of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_admin_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, - template_url=self.list_cluster_admin_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_admin_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -1264,25 +1230,23 @@ def list_cluster_admin_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_admin_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore - + list_cluster_admin_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore @distributed_trace def list_cluster_user_credentials( @@ -1298,40 +1262,39 @@ def list_cluster_user_credentials( Lists the user credentials of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :param format: Only apply to AAD clusters, specifies the format of returned kubeconfig. Format 'azure' will return azure auth-provider kubeconfig; format 'exec' will return exec format - kubeconfig, which requires kubelogin binary in the path. Default value is None. + kubeconfig, which requires kubelogin binary in the path. Known values are: "azure" and "exec". + Default value is None. :type format: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.Format :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, format=format, - template_url=self.list_cluster_user_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -1339,68 +1302,60 @@ def list_cluster_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore - + list_cluster_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore @distributed_trace def list_cluster_monitoring_user_credentials( - self, - resource_group_name: str, - resource_name: str, - server_fqdn: Optional[str] = None, - **kwargs: Any + self, resource_group_name: str, resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any ) -> _models.CredentialResults: """Lists the cluster monitoring user credentials of a managed cluster. Lists the cluster monitoring user credentials of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_monitoring_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, - template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_monitoring_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -1408,64 +1363,55 @@ def list_cluster_monitoring_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_monitoring_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore - + list_cluster_monitoring_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore @distributed_trace - def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.ManagedCluster: + def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.ManagedCluster: """Gets a managed cluster. Gets a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedCluster, or the result of cls(response) + :return: ManagedCluster or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedCluster - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -1473,55 +1419,54 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _create_or_update_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.ManagedCluster, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'ManagedCluster') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedCluster") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1529,10 +1474,9 @@ def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -1540,25 +1484,26 @@ def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - - @distributed_trace + @overload def begin_create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedCluster, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. @@ -1566,11 +1511,15 @@ def begin_create_or_update( Creates or updates a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The managed cluster to create or update. + :param parameters: The managed cluster to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedCluster + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1583,90 +1532,157 @@ def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._create_or_update_initial( # type: ignore - resource_group_name=resource_group_name, - resource_name=resource_name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop('error_map', None) - def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized + @overload + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + Creates or updates a managed cluster. - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling - if cont_token: + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster to create or update. Is either a model type or a IO + type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedCluster or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ManagedCluster", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _update_tags_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.TagsObject, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request_initial( - subscription_id=self._config.subscription_id, + request = build_update_tags_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_tags_initial.metadata['url'], + content=_content, + template_url=self._update_tags_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1674,32 +1690,32 @@ def _update_tags_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_tags_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _update_tags_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - @distributed_trace + @overload def begin_update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. @@ -1707,11 +1723,88 @@ def begin_update_tags( Updates tags on a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2022_02_02_preview.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates tags on a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates tags on a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_02_02_preview.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1724,20 +1817,17 @@ def begin_update_tags( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, @@ -1745,64 +1835,54 @@ def begin_update_tags( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1810,10 +1890,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1823,23 +1902,18 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> LROPoller[None]: + def begin_delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> LROPoller[None]: """Deletes a managed cluster. Deletes a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1851,85 +1925,83 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterServicePrincipalProfile, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterServicePrincipalProfile") - request = build_reset_service_principal_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_service_principal_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_service_principal_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_service_principal_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1937,10 +2009,9 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1950,15 +2021,89 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re if cls: return cls(pipeline_response, None, {}) - _reset_service_principal_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + _reset_service_principal_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + + @overload + def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.ManagedClusterServicePrincipalProfile, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reset the Service Principal Profile of a managed cluster. + + This action cannot be performed on a cluster that is not using a service principal. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The service principal profile to set on the managed cluster. Required. + :type parameters: + ~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedClusterServicePrincipalProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reset the Service Principal Profile of a managed cluster. + + This action cannot be performed on a cluster that is not using a service principal. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The service principal profile to set on the managed cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace - def begin_reset_service_principal_profile( # pylint: disable=inconsistent-return-statements + def begin_reset_service_principal_profile( self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterServicePrincipalProfile, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], **kwargs: Any ) -> LROPoller[None]: """Reset the Service Principal Profile of a managed cluster. @@ -1966,12 +2111,18 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur This action cannot be performed on a cluster that is not using a service principal. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The service principal profile to set on the managed cluster. + :param parameters: The service principal profile to set on the managed cluster. Is either a + model type or a IO type. Required. :type parameters: ~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedClusterServicePrincipalProfile + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1982,20 +2133,17 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -2003,67 +2151,68 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_service_principal_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + begin_reset_service_principal_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterAADProfile, + parameters: Union[_models.ManagedClusterAADProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterAADProfile") - request = build_reset_aad_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_aad_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_aad_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_aad_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2071,10 +2220,9 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -2084,15 +2232,16 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement if cls: return cls(pipeline_response, None, {}) - _reset_aad_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + _reset_aad_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - - @distributed_trace - def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements + @overload + def begin_reset_aad_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterAADProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: """Reset the AAD Profile of a managed cluster. @@ -2100,12 +2249,90 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements Reset the AAD Profile of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The AAD profile to set on the Managed Cluster. + :param parameters: The AAD profile to set on the Managed Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedClusterAADProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reset the AAD Profile of a managed cluster. + + Reset the AAD Profile of a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The AAD profile to set on the Managed Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterAADProfile, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Reset the AAD Profile of a managed cluster. + + Reset the AAD Profile of a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The AAD profile to set on the Managed Cluster. Is either a model type or a + IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedClusterAADProfile or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -2116,20 +2343,17 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -2137,62 +2361,52 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_aad_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + begin_reset_aad_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_rotate_cluster_certificates_request_initial( - subscription_id=self._config.subscription_id, + request = build_rotate_cluster_certificates_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._rotate_cluster_certificates_initial.metadata['url'], + template_url=self._rotate_cluster_certificates_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2200,10 +2414,9 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -2213,15 +2426,11 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return if cls: return cls(pipeline_response, None, {}) - _rotate_cluster_certificates_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore - + _rotate_cluster_certificates_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore @distributed_trace - def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + def begin_rotate_cluster_certificates( + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> LROPoller[None]: """Rotates the certificates of a managed cluster. @@ -2229,8 +2438,9 @@ def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-st more details about rotating managed cluster certificates. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -2242,80 +2452,67 @@ def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-st Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._rotate_cluster_certificates_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_rotate_cluster_certificates.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore + begin_rotate_cluster_certificates.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore def _stop_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_stop_request_initial( - subscription_id=self._config.subscription_id, + request = build_stop_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._stop_initial.metadata['url'], + template_url=self._stop_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2323,10 +2520,9 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -2336,16 +2532,10 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore - + _stop_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore @distributed_trace - def begin_stop( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> LROPoller[None]: + def begin_stop(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> LROPoller[None]: """Stops a Managed Cluster. This can only be performed on Azure Virtual Machine Scale set backed clusters. Stopping a @@ -2355,8 +2545,9 @@ def begin_stop( # pylint: disable=inconsistent-return-statements cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -2368,80 +2559,67 @@ def begin_stop( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._stop_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore + begin_stop.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore def _start_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_start_request_initial( - subscription_id=self._config.subscription_id, + request = build_start_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._start_initial.metadata['url'], + template_url=self._start_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2449,10 +2627,9 @@ def _start_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -2462,24 +2639,19 @@ def _start_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore - + _start_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore @distributed_trace - def begin_start( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> LROPoller[None]: + def begin_start(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> LROPoller[None]: """Starts a previously stopped Managed Cluster. See `starting a cluster `_ for more details about starting a cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -2491,85 +2663,83 @@ def begin_start( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._start_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore + begin_start.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore def _run_command_initial( self, resource_group_name: str, resource_name: str, - request_payload: _models.RunCommandRequest, + request_payload: Union[_models.RunCommandRequest, IO], **kwargs: Any ) -> Optional[_models.RunCommandResult]: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RunCommandResult]] - _json = self._serialize.body(request_payload, 'RunCommandRequest') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(request_payload, (IO, bytes)): + _content = request_payload + else: + _json = self._serialize.body(request_payload, "RunCommandRequest") - request = build_run_command_request_initial( - subscription_id=self._config.subscription_id, + request = build_run_command_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._run_command_initial.metadata['url'], + content=_content, + template_url=self._run_command_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2577,10 +2747,9 @@ def _run_command_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -2589,22 +2758,23 @@ def _run_command_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _run_command_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore + _run_command_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore - - @distributed_trace + @overload def begin_run_command( self, resource_group_name: str, resource_name: str, request_payload: _models.RunCommandRequest, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.RunCommandResult]: """Submits a command to run against the Managed Cluster. @@ -2614,12 +2784,97 @@ def begin_run_command( `_. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param request_payload: The run command request. + :param request_payload: The run command request. Required. :type request_payload: ~azure.mgmt.containerservice.v2022_02_02_preview.models.RunCommandRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either RunCommandResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_02_02_preview.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_run_command( + self, + resource_group_name: str, + resource_name: str, + request_payload: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RunCommandResult]: + """Submits a command to run against the Managed Cluster. + + AKS will create a pod to run the command. This is primarily useful for private clusters. For + more information see `AKS Run Command + `_. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param request_payload: The run command request. Required. + :type request_payload: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either RunCommandResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_02_02_preview.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_run_command( + self, + resource_group_name: str, + resource_name: str, + request_payload: Union[_models.RunCommandRequest, IO], + **kwargs: Any + ) -> LROPoller[_models.RunCommandResult]: + """Submits a command to run against the Managed Cluster. + + AKS will create a pod to run the command. This is primarily useful for private clusters. For + more information see `AKS Run Command + `_. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param request_payload: The run command request. Is either a model type or a IO type. Required. + :type request_payload: + ~azure.mgmt.containerservice.v2022_02_02_preview.models.RunCommandRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -2632,20 +2887,17 @@ def begin_run_command( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_02_02_preview.models.RunCommandResult] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.RunCommandResult] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.RunCommandResult] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._run_command_initial( # type: ignore resource_group_name=resource_group_name, @@ -2653,82 +2905,72 @@ def begin_run_command( request_payload=request_payload, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_run_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore + begin_run_command.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore @distributed_trace def get_command_result( - self, - resource_group_name: str, - resource_name: str, - command_id: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, command_id: str, **kwargs: Any ) -> Optional[_models.RunCommandResult]: """Gets the results of a command which has been run on the Managed Cluster. Gets the results of a command which has been run on the Managed Cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param command_id: Id of the command. + :param command_id: Id of the command. Required. :type command_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: RunCommandResult, or the result of cls(response) + :return: RunCommandResult or None or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.RunCommandResult or None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RunCommandResult]] - request = build_get_command_result_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, command_id=command_id, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_command_result.metadata['url'], + template_url=self.get_command_result.metadata["url"], headers=_headers, params=_params, ) @@ -2736,10 +2978,9 @@ def get_command_result( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -2748,23 +2989,19 @@ def get_command_result( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_command_result.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}"} # type: ignore - + get_command_result.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}"} # type: ignore @distributed_trace def list_outbound_network_dependencies_endpoints( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> Iterable[_models.OutboundEnvironmentEndpointCollection]: + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> Iterable["_models.OutboundEnvironmentEndpoint"]: """Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster. @@ -2772,35 +3009,35 @@ def list_outbound_network_dependencies_endpoints( specified managed cluster. The operation returns properties of each egress endpoint. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OutboundEnvironmentEndpointCollection or the - result of cls(response) + :return: An iterator like instance of either OutboundEnvironmentEndpoint or the result of + cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_02_02_preview.models.OutboundEnvironmentEndpointCollection] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_02_02_preview.models.OutboundEnvironmentEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_outbound_network_dependencies_endpoints_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_outbound_network_dependencies_endpoints.metadata['url'], + template_url=self.list_outbound_network_dependencies_endpoints.metadata["url"], headers=_headers, params=_params, ) @@ -2808,16 +3045,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_outbound_network_dependencies_endpoints_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -2833,10 +3065,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2846,8 +3076,6 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_outbound_network_dependencies_endpoints.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints"} # type: ignore + list_outbound_network_dependencies_endpoints.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/operations/_operations.py index 14c30c824aa5..fe868dd022fb 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/operations/_operations.py @@ -7,10 +7,15 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,38 +25,34 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - **kwargs: Any -) -> HttpRequest: + +def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.ContainerService/operations") # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class Operations: """ @@ -72,38 +73,33 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.OperationListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.OperationValue"]: """Gets a list of operations. Gets a list of operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationListResult or the result of cls(response) + :return: An iterator like instance of either OperationValue or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_02_02_preview.models.OperationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_02_02_preview.models.OperationValue] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -111,13 +107,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -133,10 +127,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -146,8 +138,6 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.ContainerService/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ContainerService/operations"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/operations/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/operations/_private_endpoint_connections_operations.py index a091e33e7fba..29db7ee8fc3d 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/operations/_private_endpoint_connections_operations.py @@ -6,11 +6,15 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod @@ -21,173 +25,199 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - subscription_id: str, resource_group_name: str, resource_name: str, private_endpoint_connection_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_update_request( - subscription_id: str, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, - *, - json: Optional[_models.PrivateEndpointConnection] = None, - content: Any = None, + subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request_initial( - subscription_id: str, +def build_delete_request( resource_group_name: str, resource_name: str, private_endpoint_connection_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class PrivateEndpointConnectionsOperations: """ @@ -208,13 +238,9 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnectionListResult: """Gets a list of private endpoint connections in the specified managed cluster. @@ -222,33 +248,31 @@ def list( https://docs.microsoft.com/azure/aks/private-clusters. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnectionListResult, or the result of cls(response) + :return: PrivateEndpointConnectionListResult or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.PrivateEndpointConnectionListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnectionListResult] - request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -256,33 +280,27 @@ def list( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore - + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore @distributed_trace def get( - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnection: """Gets the specified private endpoint connection. @@ -290,35 +308,33 @@ def get( https://docs.microsoft.com/azure/aks/private-clusters. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -326,33 +342,33 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - @distributed_trace + @overload def update( self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, parameters: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateEndpointConnection: """Updates a private endpoint connection. @@ -360,42 +376,117 @@ def update( Updates a private endpoint connection. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str - :param parameters: The updated private endpoint connection. + :param parameters: The updated private endpoint connection. Required. :type parameters: ~azure.mgmt.containerservice.v2022_02_02_preview.models.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: The updated private endpoint connection. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: Union[_models.PrivateEndpointConnection, IO], + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: The updated private endpoint connection. Is either a model type or a IO + type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2022_02_02_preview.models.PrivateEndpointConnection or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - _json = self._serialize.body(parameters, 'PrivateEndpointConnection') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateEndpointConnection") request = build_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update.metadata['url'], + content=_content, + template_url=self.update.metadata["url"], headers=_headers, params=_params, ) @@ -403,52 +494,43 @@ def update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -456,10 +538,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -469,26 +550,22 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + def begin_delete( + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> LROPoller[None]: """Deletes a private endpoint connection. Deletes a private endpoint connection. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -500,53 +577,46 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/operations/_private_link_resources_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/operations/_private_link_resources_operations.py index 5596b7f7f905..012fa2e827d2 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/operations/_private_link_resources_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/operations/_private_link_resources_operations.py @@ -8,9 +8,13 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -19,48 +23,55 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class PrivateLinkResourcesOperations: """ @@ -81,13 +92,9 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.PrivateLinkResourcesListResult: """Gets a list of private link resources in the specified managed cluster. @@ -95,32 +102,30 @@ def list( https://docs.microsoft.com/azure/aks/private-clusters. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResourcesListResult, or the result of cls(response) + :return: PrivateLinkResourcesListResult or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.PrivateLinkResourcesListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResourcesListResult] - request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -128,22 +133,20 @@ def list( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResourcesListResult', pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources"} # type: ignore - + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/operations/_resolve_private_link_service_id_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/operations/_resolve_private_link_service_id_operations.py index 3098b43e4fd2..43ca8a470171 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/operations/_resolve_private_link_service_id_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/operations/_resolve_private_link_service_id_operations.py @@ -6,11 +6,15 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -19,56 +23,58 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_post_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.PrivateLinkResource] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + class ResolvePrivateLinkServiceIdOperations: """ @@ -89,13 +95,72 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @overload + def post( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.PrivateLinkResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID for the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters required in order to resolve a private link service ID. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_02_02_preview.models.PrivateLinkResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def post( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID for the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters required in order to resolve a private link service ID. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def post( self, resource_group_name: str, resource_name: str, - parameters: _models.PrivateLinkResource, + parameters: Union[_models.PrivateLinkResource, IO], **kwargs: Any ) -> _models.PrivateLinkResource: """Gets the private link service ID for the specified managed cluster. @@ -103,38 +168,49 @@ def post( Gets the private link service ID for the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters required in order to resolve a private link service ID. + :param parameters: Parameters required in order to resolve a private link service ID. Is either + a model type or a IO type. Required. :type parameters: ~azure.mgmt.containerservice.v2022_02_02_preview.models.PrivateLinkResource + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResource, or the result of cls(response) + :return: PrivateLinkResource or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.PrivateLinkResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResource] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResource] - _json = self._serialize.body(parameters, 'PrivateLinkResource') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateLinkResource") request = build_post_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.post.metadata['url'], + content=_content, + template_url=self.post.metadata["url"], headers=_headers, params=_params, ) @@ -142,22 +218,20 @@ def post( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResource', pipeline_response) + deserialized = self._deserialize("PrivateLinkResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - post.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId"} # type: ignore - + post.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/operations/_snapshots_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/operations/_snapshots_operations.py index f2afcde09570..bf0a769a70aa 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/operations/_snapshots_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/operations/_snapshots_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,243 +25,233 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots") path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_resource_group_request( - subscription_id: str, - resource_group_name: str, - **kwargs: Any -) -> HttpRequest: +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: + _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, resource_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.Snapshot] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_update_tags_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.TagsObject] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class SnapshotsOperations: """ @@ -277,39 +272,34 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.SnapshotListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.Snapshot"]: """Gets a list of snapshots in the specified subscription. Gets a list of snapshots in the specified subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SnapshotListResult or the result of cls(response) + :return: An iterator like instance of either Snapshot or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_02_02_preview.models.SnapshotListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_02_02_preview.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SnapshotListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -317,14 +307,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -340,10 +327,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -353,48 +338,42 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots"} # type: ignore @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> Iterable[_models.SnapshotListResult]: + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Snapshot"]: """Lists snapshots in the specified subscription and resource group. Lists snapshots in the specified subscription and resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SnapshotListResult or the result of cls(response) + :return: An iterator like instance of either Snapshot or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_02_02_preview.models.SnapshotListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_02_02_preview.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SnapshotListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -402,15 +381,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -426,10 +401,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -439,50 +412,41 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots"} # type: ignore @distributed_trace - def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.Snapshot: + def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.Snapshot: """Gets a snapshot. Gets a snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Snapshot, or the result of cls(response) + :return: Snapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.Snapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -490,32 +454,32 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - - @distributed_trace + @overload def create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.Snapshot, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.Snapshot: """Creates or updates a snapshot. @@ -523,38 +487,102 @@ def create_or_update( Creates or updates a snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The snapshot to create or update. + :param parameters: The snapshot to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_02_02_preview.models.Snapshot + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Snapshot, or the result of cls(response) + :return: Snapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.Snapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Snapshot: + """Creates or updates a snapshot. + + Creates or updates a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The snapshot to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.Snapshot, IO], **kwargs: Any + ) -> _models.Snapshot: + """Creates or updates a snapshot. + + Creates or updates a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The snapshot to create or update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.mgmt.containerservice.v2022_02_02_preview.models.Snapshot or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] - _json = self._serialize.body(parameters, 'Snapshot') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "Snapshot") request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) @@ -562,10 +590,9 @@ def create_or_update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -573,25 +600,26 @@ def create_or_update( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - - @distributed_trace + @overload def update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.Snapshot: """Updates tags on a snapshot. @@ -599,38 +627,102 @@ def update_tags( Updates tags on a snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update snapshot Tags operation. + :param parameters: Parameters supplied to the Update snapshot Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2022_02_02_preview.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Snapshot, or the result of cls(response) + :return: Snapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.Snapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + def update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Snapshot: + """Updates tags on a snapshot. + + Updates tags on a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update snapshot Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> _models.Snapshot: + """Updates tags on a snapshot. + + Updates tags on a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update snapshot Tags operation. Is either a model + type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_02_02_preview.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") request = build_update_tags_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_tags.metadata['url'], + content=_content, + template_url=self.update_tags.metadata["url"], headers=_headers, params=_params, ) @@ -638,64 +730,57 @@ def update_tags( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - + update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore @distributed_trace def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: """Deletes a snapshot. Deletes a snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-02-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) @@ -703,10 +788,9 @@ def delete( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -716,5 +800,4 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - + delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/__init__.py index 37a5f9e02e6f..a8716d29afe8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/__init__.py @@ -14,7 +14,8 @@ except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['ContainerServiceClient'] + +__all__ = ["ContainerServiceClient"] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/_configuration.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/_configuration.py index e6f3f3baa109..a80d9730f82f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/_configuration.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/_configuration.py @@ -18,29 +18,25 @@ VERSION = "unknown" + class ContainerServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ContainerServiceClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :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. + :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2022-03-01". 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: + def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ContainerServiceClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + api_version = kwargs.pop("api_version", "2022-03-01") # type: str if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -50,23 +46,24 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-containerservice/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-containerservice/{}".format(VERSION)) self._configure(**kwargs) def _configure( - self, - **kwargs # type: Any + self, **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/_container_service_client.py index f38666aef450..e550582f9aef 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/_container_service_client.py @@ -9,20 +9,29 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from . import models +from .._serialization import Deserializer, Serializer from ._configuration import ContainerServiceClientConfiguration -from .operations import AgentPoolsOperations, MaintenanceConfigurationsOperations, ManagedClustersOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, ResolvePrivateLinkServiceIdOperations, SnapshotsOperations +from .operations import ( + AgentPoolsOperations, + MaintenanceConfigurationsOperations, + ManagedClustersOperations, + Operations, + PrivateEndpointConnectionsOperations, + PrivateLinkResourcesOperations, + ResolvePrivateLinkServiceIdOperations, + SnapshotsOperations, +) if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class ContainerServiceClient: # pylint: disable=too-many-instance-attributes + +class ContainerServiceClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """The Container Service Client. :ivar operations: Operations operations @@ -46,9 +55,9 @@ class ContainerServiceClient: # pylint: disable=too-many-instance-attributes azure.mgmt.containerservice.v2022_03_01.operations.ResolvePrivateLinkServiceIdOperations :ivar snapshots: SnapshotsOperations operations :vartype snapshots: azure.mgmt.containerservice.v2022_03_01.operations.SnapshotsOperations - :param credential: Credential needed for the client to connect to Azure. + :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. + :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -66,25 +75,23 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = ContainerServiceClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = ContainerServiceClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize - ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.managed_clusters = ManagedClustersOperations( self._client, self._config, self._serialize, self._deserialize ) self.maintenance_configurations = MaintenanceConfigurationsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.agent_pools = AgentPoolsOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) self.private_endpoint_connections = PrivateEndpointConnectionsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -94,16 +101,9 @@ def __init__( self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations( self._client, self._config, self._serialize, self._deserialize ) - self.snapshots = SnapshotsOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.snapshots = SnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) - - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> HttpResponse: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -112,7 +112,7 @@ def _send_request( >>> response = client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/_metadata.json b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/_metadata.json index a5d17d692e0c..cb4732c55152 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/_metadata.json +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/_metadata.json @@ -10,20 +10,20 @@ "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { "credential": { - "signature": "credential, # type: \"TokenCredential\"", - "description": "Credential needed for the client to connect to Azure.", + "signature": "credential: \"TokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true }, "subscription_id": { - "signature": "subscription_id, # type: str", - "description": "The ID of the target subscription.", + "signature": "subscription_id: str,", + "description": "The ID of the target subscription. Required.", "docstring_type": "str", "required": true } @@ -31,13 +31,13 @@ "async": { "credential": { "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure.", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { "signature": "subscription_id: str,", - "description": "The ID of the target subscription.", + "description": "The ID of the target subscription. Required.", "docstring_type": "str", "required": true } @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=\"https://management.azure.com\", # type: str", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/_patch.py index 74e48ecd07cf..f99e77fef986 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/_patch.py @@ -28,4 +28,4 @@ # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + pass diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/_vendor.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/_vendor.py index 138f663c53a4..9aad73fc743e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/_vendor.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/_vendor.py @@ -7,6 +7,7 @@ from azure.core.pipeline.transport import HttpRequest + def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) @@ -14,6 +15,7 @@ def _convert_request(request, files=None): request.set_formdata_body(files) return request + def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -21,7 +23,5 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [ - c for c in formatted_components if "{}".format(key.args[0]) not in c - ] + components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/__init__.py index 37a5f9e02e6f..a8716d29afe8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/__init__.py @@ -14,7 +14,8 @@ except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['ContainerServiceClient'] + +__all__ = ["ContainerServiceClient"] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/_configuration.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/_configuration.py index d28bdeb7363f..da727b998356 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/_configuration.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/_configuration.py @@ -18,29 +18,25 @@ VERSION = "unknown" + class ContainerServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ContainerServiceClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :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. + :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2022-03-01". 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: + def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ContainerServiceClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + api_version = kwargs.pop("api_version", "2022-03-01") # type: str if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -50,22 +46,21 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-containerservice/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-containerservice/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, - **kwargs: Any - ) -> None: - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/_container_service_client.py index 3b24b8239d0a..96dd0c508792 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/_container_service_client.py @@ -9,20 +9,29 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from .. import models +from ..._serialization import Deserializer, Serializer from ._configuration import ContainerServiceClientConfiguration -from .operations import AgentPoolsOperations, MaintenanceConfigurationsOperations, ManagedClustersOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, ResolvePrivateLinkServiceIdOperations, SnapshotsOperations +from .operations import ( + AgentPoolsOperations, + MaintenanceConfigurationsOperations, + ManagedClustersOperations, + Operations, + PrivateEndpointConnectionsOperations, + PrivateLinkResourcesOperations, + ResolvePrivateLinkServiceIdOperations, + SnapshotsOperations, +) if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class ContainerServiceClient: # pylint: disable=too-many-instance-attributes + +class ContainerServiceClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """The Container Service Client. :ivar operations: Operations operations @@ -47,9 +56,9 @@ class ContainerServiceClient: # pylint: disable=too-many-instance-attributes azure.mgmt.containerservice.v2022_03_01.aio.operations.ResolvePrivateLinkServiceIdOperations :ivar snapshots: SnapshotsOperations operations :vartype snapshots: azure.mgmt.containerservice.v2022_03_01.aio.operations.SnapshotsOperations - :param credential: Credential needed for the client to connect to Azure. + :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. + :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -67,25 +76,23 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = ContainerServiceClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = ContainerServiceClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize - ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.managed_clusters = ManagedClustersOperations( self._client, self._config, self._serialize, self._deserialize ) self.maintenance_configurations = MaintenanceConfigurationsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.agent_pools = AgentPoolsOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) self.private_endpoint_connections = PrivateEndpointConnectionsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -95,16 +102,9 @@ def __init__( self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations( self._client, self._config, self._serialize, self._deserialize ) - self.snapshots = SnapshotsOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.snapshots = SnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) - - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -113,7 +113,7 @@ def _send_request( >>> response = await client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/_patch.py index 74e48ecd07cf..f99e77fef986 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/_patch.py @@ -28,4 +28,4 @@ # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + pass diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/operations/__init__.py index e0748876288c..593b23075ce0 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/operations/__init__.py @@ -18,15 +18,16 @@ from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'Operations', - 'ManagedClustersOperations', - 'MaintenanceConfigurationsOperations', - 'AgentPoolsOperations', - 'PrivateEndpointConnectionsOperations', - 'PrivateLinkResourcesOperations', - 'ResolvePrivateLinkServiceIdOperations', - 'SnapshotsOperations', + "Operations", + "ManagedClustersOperations", + "MaintenanceConfigurationsOperations", + "AgentPoolsOperations", + "PrivateEndpointConnectionsOperations", + "PrivateLinkResourcesOperations", + "ResolvePrivateLinkServiceIdOperations", + "SnapshotsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/operations/_agent_pools_operations.py index a1ace665b086..f32685c4812d 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/operations/_agent_pools_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +29,20 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._agent_pools_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_available_agent_pool_versions_request, build_get_request, build_get_upgrade_profile_request, build_list_request, build_upgrade_node_image_version_request_initial -T = TypeVar('T') +from ...operations._agent_pools_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_available_agent_pool_versions_request, + build_get_request, + build_get_upgrade_profile_request, + build_list_request, + build_upgrade_node_image_version_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class AgentPoolsOperations: """ .. warning:: @@ -45,47 +62,41 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.AgentPoolListResult]: + def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncIterable["_models.AgentPool"]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AgentPoolListResult or the result of cls(response) + :return: An iterator like instance of either AgentPool or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_03_01.models.AgentPoolListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_03_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -93,16 +104,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -118,10 +124,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -131,54 +135,46 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore @distributed_trace_async async def get( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPool: """Gets the specified managed cluster agent pool. Gets the specified managed cluster agent pool. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPool, or the result of cls(response) + :return: AgentPool or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.AgentPool - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -186,57 +182,60 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore async def _create_or_update_initial( self, resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: _models.AgentPool, + parameters: Union[_models.AgentPool, IO], **kwargs: Any ) -> _models.AgentPool: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - _json = self._serialize.body(parameters, 'AgentPool') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "AgentPool") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -244,10 +243,9 @@ async def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -255,26 +253,27 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - - @distributed_trace_async + @overload async def begin_create_or_update( self, resource_group_name: str, resource_name: str, agent_pool_name: str, parameters: _models.AgentPool, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.AgentPool]: """Creates or updates an agent pool in the specified managed cluster. @@ -282,13 +281,59 @@ async def begin_create_or_update( Creates or updates an agent pool in the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str - :param parameters: The agent pool to create or update. + :param parameters: The agent pool to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_03_01.models.AgentPool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AgentPool or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_03_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AgentPool]: + """Creates or updates an agent pool in the specified managed cluster. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: The agent pool to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -301,20 +346,58 @@ async def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_03_01.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: Union[_models.AgentPool, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.AgentPool]: + """Creates or updates an agent pool in the specified managed cluster. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: The agent pool to create or update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.mgmt.containerservice.v2022_03_01.models.AgentPool or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AgentPool or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_03_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -323,66 +406,55 @@ async def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -390,10 +462,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -403,26 +474,22 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + async def begin_delete( + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes an agent pool in the specified managed cluster. Deletes an agent pool in the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -434,99 +501,86 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace_async async def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPoolUpgradeProfile: """Gets the upgrade profile for an agent pool. Gets the upgrade profile for an agent pool. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolUpgradeProfile, or the result of cls(response) + :return: AgentPoolUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.AgentPoolUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -534,32 +588,27 @@ async def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolUpgradeProfile', pipeline_response) + deserialized = self._deserialize("AgentPoolUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore @distributed_trace_async async def get_available_agent_pool_versions( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported Kubernetes versions for the specified agent pool. @@ -568,32 +617,30 @@ async def get_available_agent_pool_versions( the version lifecycle. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolAvailableVersions, or the result of cls(response) + :return: AgentPoolAvailableVersions or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.AgentPoolAvailableVersions - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolAvailableVersions] - request = build_get_available_agent_pool_versions_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_available_agent_pool_versions.metadata['url'], + template_url=self.get_available_agent_pool_versions.metadata["url"], headers=_headers, params=_params, ) @@ -601,52 +648,43 @@ async def get_available_agent_pool_versions( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolAvailableVersions', pipeline_response) + deserialized = self._deserialize("AgentPoolAvailableVersions", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_available_agent_pool_versions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore - + get_available_agent_pool_versions.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore async def _upgrade_node_image_version_initial( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> Optional[_models.AgentPool]: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.AgentPool]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.AgentPool]] - - request = build_upgrade_node_image_version_request_initial( - subscription_id=self._config.subscription_id, + request = build_upgrade_node_image_version_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._upgrade_node_image_version_initial.metadata['url'], + template_url=self._upgrade_node_image_version_initial.metadata["url"], headers=_headers, params=_params, ) @@ -654,10 +692,9 @@ async def _upgrade_node_image_version_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -667,26 +704,23 @@ async def _upgrade_node_image_version_initial( deserialized = None response_headers = {} if response.status_code == 202: - response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) - - deserialized = self._deserialize('AgentPool', pipeline_response) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _upgrade_node_image_version_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore - + _upgrade_node_image_version_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore @distributed_trace_async async def begin_upgrade_node_image_version( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any - ) -> AsyncLROPoller[_models.AgentPool]: + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: """Upgrades the node image version of an agent pool to the latest. Upgrading the node image version of an agent pool applies the newest OS and runtime updates to @@ -694,10 +728,11 @@ async def begin_upgrade_node_image_version( node image versions, see: https://docs.microsoft.com/azure/aks/node-image-upgrade. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -711,59 +746,54 @@ async def begin_upgrade_node_image_version( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_03_01.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._upgrade_node_image_version_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) - - deserialized = self._deserialize('AgentPool', pipeline_response) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_upgrade_node_image_version.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore + begin_upgrade_node_image_version.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/operations/_maintenance_configurations_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/operations/_maintenance_configurations_operations.py index 8c9a0f3b1c3e..3ec176912911 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/operations/_maintenance_configurations_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/operations/_maintenance_configurations_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,10 +27,17 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._maintenance_configurations_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_managed_cluster_request -T = TypeVar('T') +from ...operations._maintenance_configurations_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_managed_cluster_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class MaintenanceConfigurationsOperations: """ .. warning:: @@ -43,48 +57,44 @@ def __init__(self, *args, **kwargs) -> None: 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_managed_cluster( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.MaintenanceConfigurationListResult]: + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> AsyncIterable["_models.MaintenanceConfiguration"]: """Gets a list of maintenance configurations in the specified managed cluster. Gets a list of maintenance configurations in the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either MaintenanceConfigurationListResult or the result - of cls(response) + :return: An iterator like instance of either MaintenanceConfiguration or the result of + cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_03_01.models.MaintenanceConfigurationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_03_01.models.MaintenanceConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfigurationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfigurationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_managed_cluster_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_managed_cluster.metadata['url'], + template_url=self.list_by_managed_cluster.metadata["url"], headers=_headers, params=_params, ) @@ -92,16 +102,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_managed_cluster_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -117,10 +122,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -130,54 +133,46 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_managed_cluster.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations"} # type: ignore + list_by_managed_cluster.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations"} # type: ignore @distributed_trace_async async def get( - self, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, config_name: str, **kwargs: Any ) -> _models.MaintenanceConfiguration: """Gets the specified maintenance configuration of a managed cluster. Gets the specified maintenance configuration of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: MaintenanceConfiguration, or the result of cls(response) + :return: MaintenanceConfiguration or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.MaintenanceConfiguration - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfiguration] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -185,33 +180,33 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) + deserialized = self._deserialize("MaintenanceConfiguration", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - @distributed_trace_async + @overload async def create_or_update( self, resource_group_name: str, resource_name: str, config_name: str, parameters: _models.MaintenanceConfiguration, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.MaintenanceConfiguration: """Creates or updates a maintenance configuration in the specified managed cluster. @@ -219,41 +214,116 @@ async def create_or_update( Creates or updates a maintenance configuration in the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str - :param parameters: The maintenance configuration to create or update. + :param parameters: The maintenance configuration to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_03_01.models.MaintenanceConfiguration + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: MaintenanceConfiguration, or the result of cls(response) + :return: MaintenanceConfiguration or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.MaintenanceConfiguration - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configuration in the specified managed cluster. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: The maintenance configuration to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: Union[_models.MaintenanceConfiguration, IO], + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configuration in the specified managed cluster. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: The maintenance configuration to create or update. Is either a model type or + a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_03_01.models.MaintenanceConfiguration or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfiguration] - _json = self._serialize.body(parameters, 'MaintenanceConfiguration') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "MaintenanceConfiguration") request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) @@ -261,68 +331,60 @@ async def create_or_update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) + deserialized = self._deserialize("MaintenanceConfiguration", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, config_name: str, **kwargs: Any ) -> None: """Deletes a maintenance configuration. Deletes a maintenance configuration. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) @@ -330,10 +392,9 @@ async def delete( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -343,5 +404,4 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/operations/_managed_clusters_operations.py index 1b69708903e9..465ad6dbd36e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/operations/_managed_clusters_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +29,33 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._managed_clusters_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_access_profile_request, build_get_command_result_request, build_get_os_options_request, build_get_request, build_get_upgrade_profile_request, build_list_by_resource_group_request, build_list_cluster_admin_credentials_request, build_list_cluster_monitoring_user_credentials_request, build_list_cluster_user_credentials_request, build_list_outbound_network_dependencies_endpoints_request, build_list_request, build_reset_aad_profile_request_initial, build_reset_service_principal_profile_request_initial, build_rotate_cluster_certificates_request_initial, build_run_command_request_initial, build_start_request_initial, build_stop_request_initial, build_update_tags_request_initial -T = TypeVar('T') +from ...operations._managed_clusters_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_access_profile_request, + build_get_command_result_request, + build_get_os_options_request, + build_get_request, + build_get_upgrade_profile_request, + build_list_by_resource_group_request, + build_list_cluster_admin_credentials_request, + build_list_cluster_monitoring_user_credentials_request, + build_list_cluster_user_credentials_request, + build_list_outbound_network_dependencies_endpoints_request, + build_list_request, + build_reset_aad_profile_request, + build_reset_service_principal_profile_request, + build_rotate_cluster_certificates_request, + build_run_command_request, + build_start_request, + build_stop_request, + build_update_tags_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class ManagedClustersOperations: # pylint: disable=too-many-public-methods """ .. warning:: @@ -45,46 +75,39 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async async def get_os_options( - self, - location: str, - resource_type: Optional[str] = None, - **kwargs: Any + self, location: str, resource_type: Optional[str] = None, **kwargs: Any ) -> _models.OSOptionProfile: """Gets supported OS options in the specified subscription. Gets supported OS options in the specified subscription. - :param location: The name of Azure region. + :param location: The name of Azure region. Required. :type location: str :param resource_type: The resource type for which the OS options needs to be returned. Default value is None. :type resource_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: OSOptionProfile, or the result of cls(response) + :return: OSOptionProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.OSOptionProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OSOptionProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OSOptionProfile] - request = build_get_os_options_request( - subscription_id=self._config.subscription_id, location=location, - api_version=api_version, + subscription_id=self._config.subscription_id, resource_type=resource_type, - template_url=self.get_os_options.metadata['url'], + api_version=api_version, + template_url=self.get_os_options.metadata["url"], headers=_headers, params=_params, ) @@ -92,59 +115,52 @@ async def get_os_options( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('OSOptionProfile', pipeline_response) + deserialized = self._deserialize("OSOptionProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_os_options.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default"} # type: ignore - + get_os_options.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default"} # type: ignore @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.ManagedClusterListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.ManagedCluster"]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_03_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_03_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -152,14 +168,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -175,10 +188,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -188,49 +199,44 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.ManagedClusterListResult]: + self, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ManagedCluster"]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_03_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_03_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -238,15 +244,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -262,10 +264,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -275,50 +275,43 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace_async async def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.ManagedClusterUpgradeProfile: """Gets the upgrade profile of a managed cluster. Gets the upgrade profile of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterUpgradeProfile, or the result of cls(response) + :return: ManagedClusterUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.ManagedClusterUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -326,33 +319,27 @@ async def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterUpgradeProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore @distributed_trace_async async def get_access_profile( - self, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, role_name: str, **kwargs: Any ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. @@ -362,35 +349,33 @@ async def get_access_profile( `_ . :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param role_name: The name of the role for managed cluster accessProfile resource. + :param role_name: The name of the role for managed cluster accessProfile resource. Required. :type role_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterAccessProfile, or the result of cls(response) + :return: ManagedClusterAccessProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.ManagedClusterAccessProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterAccessProfile] - request = build_get_access_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, role_name=role_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_access_profile.metadata['url'], + template_url=self.get_access_profile.metadata["url"], headers=_headers, params=_params, ) @@ -398,68 +383,60 @@ async def get_access_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterAccessProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterAccessProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_access_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore - + get_access_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore @distributed_trace_async async def list_cluster_admin_credentials( - self, - resource_group_name: str, - resource_name: str, - server_fqdn: Optional[str] = None, - **kwargs: Any + self, resource_group_name: str, resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any ) -> _models.CredentialResults: """Lists the admin credentials of a managed cluster. Lists the admin credentials of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_admin_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, - template_url=self.list_cluster_admin_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_admin_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -467,25 +444,23 @@ async def list_cluster_admin_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_admin_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore - + list_cluster_admin_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore @distributed_trace_async async def list_cluster_user_credentials( @@ -501,40 +476,39 @@ async def list_cluster_user_credentials( Lists the user credentials of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :param format: Only apply to AAD clusters, specifies the format of returned kubeconfig. Format 'azure' will return azure auth-provider kubeconfig; format 'exec' will return exec format - kubeconfig, which requires kubelogin binary in the path. Default value is None. + kubeconfig, which requires kubelogin binary in the path. Known values are: "azure" and "exec". + Default value is None. :type format: str or ~azure.mgmt.containerservice.v2022_03_01.models.Format :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, format=format, - template_url=self.list_cluster_user_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -542,68 +516,60 @@ async def list_cluster_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore - + list_cluster_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore @distributed_trace_async async def list_cluster_monitoring_user_credentials( - self, - resource_group_name: str, - resource_name: str, - server_fqdn: Optional[str] = None, - **kwargs: Any + self, resource_group_name: str, resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any ) -> _models.CredentialResults: """Lists the cluster monitoring user credentials of a managed cluster. Lists the cluster monitoring user credentials of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_monitoring_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, - template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_monitoring_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -611,64 +577,55 @@ async def list_cluster_monitoring_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_monitoring_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore - + list_cluster_monitoring_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore @distributed_trace_async - async def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.ManagedCluster: + async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.ManagedCluster: """Gets a managed cluster. Gets a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedCluster, or the result of cls(response) + :return: ManagedCluster or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.ManagedCluster - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -676,55 +633,54 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _create_or_update_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.ManagedCluster, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'ManagedCluster') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedCluster") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -732,10 +688,9 @@ async def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -743,25 +698,26 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - - @distributed_trace_async + @overload async def begin_create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedCluster, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. @@ -769,11 +725,15 @@ async def begin_create_or_update( Creates or updates a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The managed cluster to create or update. + :param parameters: The managed cluster to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_03_01.models.ManagedCluster + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -786,20 +746,90 @@ async def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_03_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_03_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster to create or update. Is either a model type or a IO + type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_03_01.models.ManagedCluster or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_03_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -807,69 +837,66 @@ async def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _update_tags_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.TagsObject, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request_initial( - subscription_id=self._config.subscription_id, + request = build_update_tags_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_tags_initial.metadata['url'], + content=_content, + template_url=self._update_tags_initial.metadata["url"], headers=_headers, params=_params, ) @@ -877,32 +904,32 @@ async def _update_tags_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_tags_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _update_tags_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - @distributed_trace_async + @overload async def begin_update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. @@ -910,11 +937,15 @@ async def begin_update_tags( Updates tags on a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2022_03_01.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -927,20 +958,90 @@ async def begin_update_tags( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_03_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates tags on a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_03_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates tags on a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_03_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_03_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, @@ -948,64 +1049,54 @@ async def begin_update_tags( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1013,10 +1104,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1026,23 +1116,18 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: + async def begin_delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Deletes a managed cluster. Deletes a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1054,85 +1139,83 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterServicePrincipalProfile, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterServicePrincipalProfile") - request = build_reset_service_principal_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_service_principal_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_service_principal_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_service_principal_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1140,10 +1223,9 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1153,15 +1235,16 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist if cls: return cls(pipeline_response, None, {}) - _reset_service_principal_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + _reset_service_principal_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore - - @distributed_trace_async - async def begin_reset_service_principal_profile( # pylint: disable=inconsistent-return-statements + @overload + async def begin_reset_service_principal_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterServicePrincipalProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: """Reset the Service Principal Profile of a managed cluster. @@ -1169,12 +1252,53 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent This action cannot be performed on a cluster that is not using a service principal. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The service principal profile to set on the managed cluster. + :param parameters: The service principal profile to set on the managed cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2022_03_01.models.ManagedClusterServicePrincipalProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset the Service Principal Profile of a managed cluster. + + This action cannot be performed on a cluster that is not using a service principal. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The service principal profile to set on the managed cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -1185,20 +1309,54 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset the Service Principal Profile of a managed cluster. + + This action cannot be performed on a cluster that is not using a service principal. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The service principal profile to set on the managed cluster. Is either a + model type or a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2022_03_01.models.ManagedClusterServicePrincipalProfile or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1206,67 +1364,68 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_service_principal_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + begin_reset_service_principal_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterAADProfile, + parameters: Union[_models.ManagedClusterAADProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterAADProfile") - request = build_reset_aad_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_aad_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_aad_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_aad_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1274,10 +1433,9 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1287,15 +1445,16 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta if cls: return cls(pipeline_response, None, {}) - _reset_aad_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - + _reset_aad_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - @distributed_trace_async - async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements + @overload + async def begin_reset_aad_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterAADProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: """Reset the AAD Profile of a managed cluster. @@ -1303,11 +1462,52 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem Reset the AAD Profile of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The AAD profile to set on the Managed Cluster. + :param parameters: The AAD profile to set on the Managed Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2022_03_01.models.ManagedClusterAADProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset the AAD Profile of a managed cluster. + + Reset the AAD Profile of a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The AAD profile to set on the Managed Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -1318,20 +1518,54 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterAADProfile, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset the AAD Profile of a managed cluster. + + Reset the AAD Profile of a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The AAD profile to set on the Managed Cluster. Is either a model type or a + IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_03_01.models.ManagedClusterAADProfile or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1339,62 +1573,52 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_aad_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + begin_reset_aad_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_rotate_cluster_certificates_request_initial( - subscription_id=self._config.subscription_id, + request = build_rotate_cluster_certificates_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._rotate_cluster_certificates_initial.metadata['url'], + template_url=self._rotate_cluster_certificates_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1402,10 +1626,9 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1415,15 +1638,11 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- if cls: return cls(pipeline_response, None, {}) - _rotate_cluster_certificates_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore - + _rotate_cluster_certificates_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore @distributed_trace_async - async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + async def begin_rotate_cluster_certificates( + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Rotates the certificates of a managed cluster. @@ -1431,8 +1650,9 @@ async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-ret more details about rotating managed cluster certificates. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1444,80 +1664,67 @@ async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-ret Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._rotate_cluster_certificates_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_rotate_cluster_certificates.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore + begin_rotate_cluster_certificates.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore async def _stop_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_stop_request_initial( - subscription_id=self._config.subscription_id, + request = build_stop_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._stop_initial.metadata['url'], + template_url=self._stop_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1525,10 +1732,9 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1538,16 +1744,10 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore - + _stop_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore @distributed_trace_async - async def begin_stop( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: + async def begin_stop(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Stops a Managed Cluster. This can only be performed on Azure Virtual Machine Scale set backed clusters. Stopping a @@ -1557,8 +1757,9 @@ async def begin_stop( # pylint: disable=inconsistent-return-statements cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1570,80 +1771,67 @@ async def begin_stop( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._stop_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore + begin_stop.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore async def _start_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_start_request_initial( - subscription_id=self._config.subscription_id, + request = build_start_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._start_initial.metadata['url'], + template_url=self._start_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1651,10 +1839,9 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1664,24 +1851,19 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore - + _start_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore @distributed_trace_async - async def begin_start( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: + async def begin_start(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Starts a previously stopped Managed Cluster. See `starting a cluster `_ for more details about starting a cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1693,85 +1875,83 @@ async def begin_start( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._start_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore + begin_start.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore async def _run_command_initial( self, resource_group_name: str, resource_name: str, - request_payload: _models.RunCommandRequest, + request_payload: Union[_models.RunCommandRequest, IO], **kwargs: Any ) -> Optional[_models.RunCommandResult]: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RunCommandResult]] - _json = self._serialize.body(request_payload, 'RunCommandRequest') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(request_payload, (IO, bytes)): + _content = request_payload + else: + _json = self._serialize.body(request_payload, "RunCommandRequest") - request = build_run_command_request_initial( - subscription_id=self._config.subscription_id, + request = build_run_command_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._run_command_initial.metadata['url'], + content=_content, + template_url=self._run_command_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1779,10 +1959,9 @@ async def _run_command_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1791,22 +1970,23 @@ async def _run_command_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _run_command_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore + _run_command_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore - - @distributed_trace_async + @overload async def begin_run_command( self, resource_group_name: str, resource_name: str, request_payload: _models.RunCommandRequest, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.RunCommandResult]: """Submits a command to run against the Managed Cluster. @@ -1816,11 +1996,15 @@ async def begin_run_command( `_. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param request_payload: The run command request. + :param request_payload: The run command request. Required. :type request_payload: ~azure.mgmt.containerservice.v2022_03_01.models.RunCommandRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -1833,20 +2017,97 @@ async def begin_run_command( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_03_01.models.RunCommandResult] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_run_command( + self, + resource_group_name: str, + resource_name: str, + request_payload: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.RunCommandResult]: + """Submits a command to run against the Managed Cluster. + + AKS will create a pod to run the command. This is primarily useful for private clusters. For + more information see `AKS Run Command + `_. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param request_payload: The run command request. Required. + :type request_payload: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RunCommandResult or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_03_01.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_run_command( + self, + resource_group_name: str, + resource_name: str, + request_payload: Union[_models.RunCommandRequest, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.RunCommandResult]: + """Submits a command to run against the Managed Cluster. + + AKS will create a pod to run the command. This is primarily useful for private clusters. For + more information see `AKS Run Command + `_. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param request_payload: The run command request. Is either a model type or a IO type. Required. + :type request_payload: ~azure.mgmt.containerservice.v2022_03_01.models.RunCommandRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RunCommandResult or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_03_01.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.RunCommandResult] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.RunCommandResult] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._run_command_initial( # type: ignore resource_group_name=resource_group_name, @@ -1854,82 +2115,72 @@ async def begin_run_command( request_payload=request_payload, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_run_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore + begin_run_command.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore @distributed_trace_async async def get_command_result( - self, - resource_group_name: str, - resource_name: str, - command_id: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, command_id: str, **kwargs: Any ) -> Optional[_models.RunCommandResult]: """Gets the results of a command which has been run on the Managed Cluster. Gets the results of a command which has been run on the Managed Cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param command_id: Id of the command. + :param command_id: Id of the command. Required. :type command_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: RunCommandResult, or the result of cls(response) + :return: RunCommandResult or None or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.RunCommandResult or None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RunCommandResult]] - request = build_get_command_result_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, command_id=command_id, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_command_result.metadata['url'], + template_url=self.get_command_result.metadata["url"], headers=_headers, params=_params, ) @@ -1937,10 +2188,9 @@ async def get_command_result( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1949,23 +2199,19 @@ async def get_command_result( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_command_result.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}"} # type: ignore - + get_command_result.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}"} # type: ignore @distributed_trace def list_outbound_network_dependencies_endpoints( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.OutboundEnvironmentEndpointCollection]: + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> AsyncIterable["_models.OutboundEnvironmentEndpoint"]: """Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster. @@ -1973,35 +2219,35 @@ def list_outbound_network_dependencies_endpoints( specified managed cluster. The operation returns properties of each egress endpoint. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OutboundEnvironmentEndpointCollection or the - result of cls(response) + :return: An iterator like instance of either OutboundEnvironmentEndpoint or the result of + cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_03_01.models.OutboundEnvironmentEndpointCollection] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_03_01.models.OutboundEnvironmentEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_outbound_network_dependencies_endpoints_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_outbound_network_dependencies_endpoints.metadata['url'], + template_url=self.list_outbound_network_dependencies_endpoints.metadata["url"], headers=_headers, params=_params, ) @@ -2009,16 +2255,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_outbound_network_dependencies_endpoints_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -2034,10 +2275,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2047,8 +2286,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_outbound_network_dependencies_endpoints.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints"} # type: ignore + list_outbound_network_dependencies_endpoints.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/operations/_operations.py index 504a0380d27c..17226084bb23 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/operations/_operations.py @@ -7,9 +7,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,9 +27,11 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._operations import build_list_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class Operations: """ .. warning:: @@ -42,38 +51,33 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.OperationListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.OperationValue"]: """Gets a list of operations. Gets a list of operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationListResult or the result of cls(response) + :return: An iterator like instance of either OperationValue or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_03_01.models.OperationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_03_01.models.OperationValue] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -81,13 +85,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -103,10 +105,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -116,8 +116,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.ContainerService/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ContainerService/operations"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/operations/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/operations/_private_endpoint_connections_operations.py index 17f17333120a..82ddc199c100 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/operations/_private_endpoint_connections_operations.py @@ -6,9 +6,15 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -20,10 +26,17 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._private_endpoint_connections_operations import build_delete_request_initial, build_get_request, build_list_request, build_update_request -T = TypeVar('T') +from ...operations._private_endpoint_connections_operations import ( + build_delete_request, + build_get_request, + build_list_request, + build_update_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class PrivateEndpointConnectionsOperations: """ .. warning:: @@ -43,13 +56,9 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async async def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnectionListResult: """Gets a list of private endpoint connections in the specified managed cluster. @@ -57,32 +66,30 @@ async def list( https://docs.microsoft.com/azure/aks/private-clusters. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnectionListResult, or the result of cls(response) + :return: PrivateEndpointConnectionListResult or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.PrivateEndpointConnectionListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnectionListResult] - request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -90,33 +97,27 @@ async def list( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore - + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore @distributed_trace_async async def get( - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnection: """Gets the specified private endpoint connection. @@ -124,35 +125,33 @@ async def get( https://docs.microsoft.com/azure/aks/private-clusters. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -160,33 +159,33 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - - @distributed_trace_async + @overload async def update( self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, parameters: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateEndpointConnection: """Updates a private endpoint connection. @@ -194,41 +193,116 @@ async def update( Updates a private endpoint connection. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str - :param parameters: The updated private endpoint connection. + :param parameters: The updated private endpoint connection. Required. :type parameters: ~azure.mgmt.containerservice.v2022_03_01.models.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + async def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: The updated private endpoint connection. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: Union[_models.PrivateEndpointConnection, IO], + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: The updated private endpoint connection. Is either a model type or a IO + type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_03_01.models.PrivateEndpointConnection or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - _json = self._serialize.body(parameters, 'PrivateEndpointConnection') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateEndpointConnection") request = build_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update.metadata['url'], + content=_content, + template_url=self.update.metadata["url"], headers=_headers, params=_params, ) @@ -236,52 +310,43 @@ async def update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -289,10 +354,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -302,26 +366,22 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + async def begin_delete( + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes a private endpoint connection. Deletes a private endpoint connection. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -333,53 +393,46 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/operations/_private_link_resources_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/operations/_private_link_resources_operations.py index d4afa7cc6d00..f053a9a473e0 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/operations/_private_link_resources_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/operations/_private_link_resources_operations.py @@ -8,7 +8,13 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -19,9 +25,11 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._private_link_resources_operations import build_list_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class PrivateLinkResourcesOperations: """ .. warning:: @@ -41,13 +49,9 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async async def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.PrivateLinkResourcesListResult: """Gets a list of private link resources in the specified managed cluster. @@ -55,32 +59,30 @@ async def list( https://docs.microsoft.com/azure/aks/private-clusters. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResourcesListResult, or the result of cls(response) + :return: PrivateLinkResourcesListResult or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.PrivateLinkResourcesListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResourcesListResult] - request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -88,22 +90,20 @@ async def list( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResourcesListResult', pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources"} # type: ignore - + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/operations/_resolve_private_link_service_id_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/operations/_resolve_private_link_service_id_operations.py index a4026a7e560d..ee1b022a6a0a 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/operations/_resolve_private_link_service_id_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/operations/_resolve_private_link_service_id_operations.py @@ -6,9 +6,15 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -19,9 +25,11 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._resolve_private_link_service_id_operations import build_post_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class ResolvePrivateLinkServiceIdOperations: """ .. warning:: @@ -41,13 +49,14 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async + @overload async def post( self, resource_group_name: str, resource_name: str, parameters: _models.PrivateLinkResource, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateLinkResource: """Gets the private link service ID for the specified managed cluster. @@ -55,38 +64,106 @@ async def post( Gets the private link service ID for the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters required in order to resolve a private link service ID. + :param parameters: Parameters required in order to resolve a private link service ID. Required. :type parameters: ~azure.mgmt.containerservice.v2022_03_01.models.PrivateLinkResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def post( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID for the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters required in order to resolve a private link service ID. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResource, or the result of cls(response) + :return: PrivateLinkResource or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.PrivateLinkResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @distributed_trace_async + async def post( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.PrivateLinkResource, IO], + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID for the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters required in order to resolve a private link service ID. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_03_01.models.PrivateLinkResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResource] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResource] - _json = self._serialize.body(parameters, 'PrivateLinkResource') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateLinkResource") request = build_post_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.post.metadata['url'], + content=_content, + template_url=self.post.metadata["url"], headers=_headers, params=_params, ) @@ -94,22 +171,20 @@ async def post( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResource', pipeline_response) + deserialized = self._deserialize("PrivateLinkResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - post.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId"} # type: ignore - + post.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/operations/_snapshots_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/operations/_snapshots_operations.py index 32e4c7c6f0c4..4b8e398d8e46 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/operations/_snapshots_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/operations/_snapshots_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,10 +27,19 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._snapshots_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_resource_group_request, build_list_request, build_update_tags_request -T = TypeVar('T') +from ...operations._snapshots_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_resource_group_request, + build_list_request, + build_update_tags_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class SnapshotsOperations: """ .. warning:: @@ -43,39 +59,34 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.SnapshotListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.Snapshot"]: """Gets a list of snapshots in the specified subscription. Gets a list of snapshots in the specified subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SnapshotListResult or the result of cls(response) + :return: An iterator like instance of either Snapshot or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_03_01.models.SnapshotListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_03_01.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SnapshotListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -83,14 +94,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -106,10 +114,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -119,48 +125,42 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots"} # type: ignore @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.SnapshotListResult]: + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.Snapshot"]: """Lists snapshots in the specified subscription and resource group. Lists snapshots in the specified subscription and resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SnapshotListResult or the result of cls(response) + :return: An iterator like instance of either Snapshot or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_03_01.models.SnapshotListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_03_01.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SnapshotListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -168,15 +168,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -192,10 +188,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -205,50 +199,41 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots"} # type: ignore @distributed_trace_async - async def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.Snapshot: + async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.Snapshot: """Gets a snapshot. Gets a snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Snapshot, or the result of cls(response) + :return: Snapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.Snapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -256,32 +241,32 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - - @distributed_trace_async + @overload async def create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.Snapshot, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.Snapshot: """Creates or updates a snapshot. @@ -289,38 +274,102 @@ async def create_or_update( Creates or updates a snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The snapshot to create or update. + :param parameters: The snapshot to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_03_01.models.Snapshot + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Snapshot, or the result of cls(response) + :return: Snapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.Snapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Snapshot: + """Creates or updates a snapshot. + + Creates or updates a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The snapshot to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.Snapshot, IO], **kwargs: Any + ) -> _models.Snapshot: + """Creates or updates a snapshot. + + Creates or updates a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The snapshot to create or update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.mgmt.containerservice.v2022_03_01.models.Snapshot or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] - _json = self._serialize.body(parameters, 'Snapshot') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "Snapshot") request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) @@ -328,10 +377,9 @@ async def create_or_update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -339,25 +387,26 @@ async def create_or_update( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - @distributed_trace_async + @overload async def update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.Snapshot: """Updates tags on a snapshot. @@ -365,38 +414,102 @@ async def update_tags( Updates tags on a snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update snapshot Tags operation. + :param parameters: Parameters supplied to the Update snapshot Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2022_03_01.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Snapshot: + """Updates tags on a snapshot. + + Updates tags on a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update snapshot Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Snapshot, or the result of cls(response) + :return: Snapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.Snapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @distributed_trace_async + async def update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> _models.Snapshot: + """Updates tags on a snapshot. + + Updates tags on a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update snapshot Tags operation. Is either a model + type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_03_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") request = build_update_tags_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_tags.metadata['url'], + content=_content, + template_url=self.update_tags.metadata["url"], headers=_headers, params=_params, ) @@ -404,64 +517,57 @@ async def update_tags( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - + update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: """Deletes a snapshot. Deletes a snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) @@ -469,10 +575,9 @@ async def delete( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -482,5 +587,4 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - + delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/models/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/models/__init__.py index 4adc3fedca9d..fde113853328 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/models/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/models/__init__.py @@ -98,176 +98,174 @@ from ._models_py3 import UserAssignedIdentity from ._models_py3 import WindowsGmsaProfile - -from ._container_service_client_enums import ( - AgentPoolMode, - AgentPoolType, - Code, - ConnectionStatus, - ContainerServiceStorageProfileTypes, - ContainerServiceVMSizeTypes, - Count, - CreatedByType, - Expander, - ExtendedLocationTypes, - Format, - GPUInstanceProfile, - IpFamily, - KubeletDiskType, - LicenseType, - LoadBalancerSku, - ManagedClusterPodIdentityProvisioningState, - ManagedClusterSKUName, - ManagedClusterSKUTier, - NetworkMode, - NetworkPlugin, - NetworkPolicy, - OSDiskType, - OSSKU, - OSType, - OutboundType, - PrivateEndpointConnectionProvisioningState, - PublicNetworkAccess, - ResourceIdentityType, - ScaleDownMode, - ScaleSetEvictionPolicy, - ScaleSetPriority, - SnapshotType, - UpgradeChannel, - WeekDay, - WorkloadRuntime, -) +from ._container_service_client_enums import AgentPoolMode +from ._container_service_client_enums import AgentPoolType +from ._container_service_client_enums import Code +from ._container_service_client_enums import ConnectionStatus +from ._container_service_client_enums import ContainerServiceStorageProfileTypes +from ._container_service_client_enums import ContainerServiceVMSizeTypes +from ._container_service_client_enums import Count +from ._container_service_client_enums import CreatedByType +from ._container_service_client_enums import Expander +from ._container_service_client_enums import ExtendedLocationTypes +from ._container_service_client_enums import Format +from ._container_service_client_enums import GPUInstanceProfile +from ._container_service_client_enums import IpFamily +from ._container_service_client_enums import KubeletDiskType +from ._container_service_client_enums import LicenseType +from ._container_service_client_enums import LoadBalancerSku +from ._container_service_client_enums import ManagedClusterPodIdentityProvisioningState +from ._container_service_client_enums import ManagedClusterSKUName +from ._container_service_client_enums import ManagedClusterSKUTier +from ._container_service_client_enums import NetworkMode +from ._container_service_client_enums import NetworkPlugin +from ._container_service_client_enums import NetworkPolicy +from ._container_service_client_enums import OSDiskType +from ._container_service_client_enums import OSSKU +from ._container_service_client_enums import OSType +from ._container_service_client_enums import OutboundType +from ._container_service_client_enums import PrivateEndpointConnectionProvisioningState +from ._container_service_client_enums import PublicNetworkAccess +from ._container_service_client_enums import ResourceIdentityType +from ._container_service_client_enums import ScaleDownMode +from ._container_service_client_enums import ScaleSetEvictionPolicy +from ._container_service_client_enums import ScaleSetPriority +from ._container_service_client_enums import SnapshotType +from ._container_service_client_enums import UpgradeChannel +from ._container_service_client_enums import WeekDay +from ._container_service_client_enums import WorkloadRuntime from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'AgentPool', - 'AgentPoolAvailableVersions', - 'AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem', - 'AgentPoolListResult', - 'AgentPoolUpgradeProfile', - 'AgentPoolUpgradeProfilePropertiesUpgradesItem', - 'AgentPoolUpgradeSettings', - 'CloudErrorBody', - 'ContainerServiceDiagnosticsProfile', - 'ContainerServiceLinuxProfile', - 'ContainerServiceMasterProfile', - 'ContainerServiceNetworkProfile', - 'ContainerServiceSshConfiguration', - 'ContainerServiceSshPublicKey', - 'ContainerServiceVMDiagnostics', - 'CreationData', - 'CredentialResult', - 'CredentialResults', - 'EndpointDependency', - 'EndpointDetail', - 'ExtendedLocation', - 'KubeletConfig', - 'LinuxOSConfig', - 'MaintenanceConfiguration', - 'MaintenanceConfigurationListResult', - 'ManagedCluster', - 'ManagedClusterAADProfile', - 'ManagedClusterAPIServerAccessProfile', - 'ManagedClusterAccessProfile', - 'ManagedClusterAddonProfile', - 'ManagedClusterAddonProfileIdentity', - 'ManagedClusterAgentPoolProfile', - 'ManagedClusterAgentPoolProfileProperties', - 'ManagedClusterAutoUpgradeProfile', - 'ManagedClusterHTTPProxyConfig', - 'ManagedClusterIdentity', - 'ManagedClusterListResult', - 'ManagedClusterLoadBalancerProfile', - 'ManagedClusterLoadBalancerProfileManagedOutboundIPs', - 'ManagedClusterLoadBalancerProfileOutboundIPPrefixes', - 'ManagedClusterLoadBalancerProfileOutboundIPs', - 'ManagedClusterManagedOutboundIPProfile', - 'ManagedClusterNATGatewayProfile', - 'ManagedClusterPodIdentity', - 'ManagedClusterPodIdentityException', - 'ManagedClusterPodIdentityProfile', - 'ManagedClusterPodIdentityProvisioningError', - 'ManagedClusterPodIdentityProvisioningErrorBody', - 'ManagedClusterPodIdentityProvisioningInfo', - 'ManagedClusterPoolUpgradeProfile', - 'ManagedClusterPoolUpgradeProfileUpgradesItem', - 'ManagedClusterPropertiesAutoScalerProfile', - 'ManagedClusterSKU', - 'ManagedClusterSecurityProfile', - 'ManagedClusterSecurityProfileAzureDefender', - 'ManagedClusterServicePrincipalProfile', - 'ManagedClusterStorageProfile', - 'ManagedClusterStorageProfileDiskCSIDriver', - 'ManagedClusterStorageProfileFileCSIDriver', - 'ManagedClusterStorageProfileSnapshotController', - 'ManagedClusterUpgradeProfile', - 'ManagedClusterWindowsProfile', - 'ManagedServiceIdentityUserAssignedIdentitiesValue', - 'OSOptionProfile', - 'OSOptionProperty', - 'OperationListResult', - 'OperationValue', - 'OutboundEnvironmentEndpoint', - 'OutboundEnvironmentEndpointCollection', - 'PowerState', - 'PrivateEndpoint', - 'PrivateEndpointConnection', - 'PrivateEndpointConnectionListResult', - 'PrivateLinkResource', - 'PrivateLinkResourcesListResult', - 'PrivateLinkServiceConnectionState', - 'Resource', - 'ResourceReference', - 'RunCommandRequest', - 'RunCommandResult', - 'Snapshot', - 'SnapshotListResult', - 'SubResource', - 'SysctlConfig', - 'SystemData', - 'TagsObject', - 'TimeInWeek', - 'TimeSpan', - 'TrackedResource', - 'UserAssignedIdentity', - 'WindowsGmsaProfile', - 'AgentPoolMode', - 'AgentPoolType', - 'Code', - 'ConnectionStatus', - 'ContainerServiceStorageProfileTypes', - 'ContainerServiceVMSizeTypes', - 'Count', - 'CreatedByType', - 'Expander', - 'ExtendedLocationTypes', - 'Format', - 'GPUInstanceProfile', - 'IpFamily', - 'KubeletDiskType', - 'LicenseType', - 'LoadBalancerSku', - 'ManagedClusterPodIdentityProvisioningState', - 'ManagedClusterSKUName', - 'ManagedClusterSKUTier', - 'NetworkMode', - 'NetworkPlugin', - 'NetworkPolicy', - 'OSDiskType', - 'OSSKU', - 'OSType', - 'OutboundType', - 'PrivateEndpointConnectionProvisioningState', - 'PublicNetworkAccess', - 'ResourceIdentityType', - 'ScaleDownMode', - 'ScaleSetEvictionPolicy', - 'ScaleSetPriority', - 'SnapshotType', - 'UpgradeChannel', - 'WeekDay', - 'WorkloadRuntime', + "AgentPool", + "AgentPoolAvailableVersions", + "AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem", + "AgentPoolListResult", + "AgentPoolUpgradeProfile", + "AgentPoolUpgradeProfilePropertiesUpgradesItem", + "AgentPoolUpgradeSettings", + "CloudErrorBody", + "ContainerServiceDiagnosticsProfile", + "ContainerServiceLinuxProfile", + "ContainerServiceMasterProfile", + "ContainerServiceNetworkProfile", + "ContainerServiceSshConfiguration", + "ContainerServiceSshPublicKey", + "ContainerServiceVMDiagnostics", + "CreationData", + "CredentialResult", + "CredentialResults", + "EndpointDependency", + "EndpointDetail", + "ExtendedLocation", + "KubeletConfig", + "LinuxOSConfig", + "MaintenanceConfiguration", + "MaintenanceConfigurationListResult", + "ManagedCluster", + "ManagedClusterAADProfile", + "ManagedClusterAPIServerAccessProfile", + "ManagedClusterAccessProfile", + "ManagedClusterAddonProfile", + "ManagedClusterAddonProfileIdentity", + "ManagedClusterAgentPoolProfile", + "ManagedClusterAgentPoolProfileProperties", + "ManagedClusterAutoUpgradeProfile", + "ManagedClusterHTTPProxyConfig", + "ManagedClusterIdentity", + "ManagedClusterListResult", + "ManagedClusterLoadBalancerProfile", + "ManagedClusterLoadBalancerProfileManagedOutboundIPs", + "ManagedClusterLoadBalancerProfileOutboundIPPrefixes", + "ManagedClusterLoadBalancerProfileOutboundIPs", + "ManagedClusterManagedOutboundIPProfile", + "ManagedClusterNATGatewayProfile", + "ManagedClusterPodIdentity", + "ManagedClusterPodIdentityException", + "ManagedClusterPodIdentityProfile", + "ManagedClusterPodIdentityProvisioningError", + "ManagedClusterPodIdentityProvisioningErrorBody", + "ManagedClusterPodIdentityProvisioningInfo", + "ManagedClusterPoolUpgradeProfile", + "ManagedClusterPoolUpgradeProfileUpgradesItem", + "ManagedClusterPropertiesAutoScalerProfile", + "ManagedClusterSKU", + "ManagedClusterSecurityProfile", + "ManagedClusterSecurityProfileAzureDefender", + "ManagedClusterServicePrincipalProfile", + "ManagedClusterStorageProfile", + "ManagedClusterStorageProfileDiskCSIDriver", + "ManagedClusterStorageProfileFileCSIDriver", + "ManagedClusterStorageProfileSnapshotController", + "ManagedClusterUpgradeProfile", + "ManagedClusterWindowsProfile", + "ManagedServiceIdentityUserAssignedIdentitiesValue", + "OSOptionProfile", + "OSOptionProperty", + "OperationListResult", + "OperationValue", + "OutboundEnvironmentEndpoint", + "OutboundEnvironmentEndpointCollection", + "PowerState", + "PrivateEndpoint", + "PrivateEndpointConnection", + "PrivateEndpointConnectionListResult", + "PrivateLinkResource", + "PrivateLinkResourcesListResult", + "PrivateLinkServiceConnectionState", + "Resource", + "ResourceReference", + "RunCommandRequest", + "RunCommandResult", + "Snapshot", + "SnapshotListResult", + "SubResource", + "SysctlConfig", + "SystemData", + "TagsObject", + "TimeInWeek", + "TimeSpan", + "TrackedResource", + "UserAssignedIdentity", + "WindowsGmsaProfile", + "AgentPoolMode", + "AgentPoolType", + "Code", + "ConnectionStatus", + "ContainerServiceStorageProfileTypes", + "ContainerServiceVMSizeTypes", + "Count", + "CreatedByType", + "Expander", + "ExtendedLocationTypes", + "Format", + "GPUInstanceProfile", + "IpFamily", + "KubeletDiskType", + "LicenseType", + "LoadBalancerSku", + "ManagedClusterPodIdentityProvisioningState", + "ManagedClusterSKUName", + "ManagedClusterSKUTier", + "NetworkMode", + "NetworkPlugin", + "NetworkPolicy", + "OSDiskType", + "OSSKU", + "OSType", + "OutboundType", + "PrivateEndpointConnectionProvisioningState", + "PublicNetworkAccess", + "ResourceIdentityType", + "ScaleDownMode", + "ScaleSetEvictionPolicy", + "ScaleSetPriority", + "SnapshotType", + "UpgradeChannel", + "WeekDay", + "WorkloadRuntime", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/models/_container_service_client_enums.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/models/_container_service_client_enums.py index cb066b7fffcc..3f3a6ff62be3 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/models/_container_service_client_enums.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/models/_container_service_client_enums.py @@ -13,7 +13,7 @@ class AgentPoolMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools + https://docs.microsoft.com/azure/aks/use-system-pools. """ #: System agent pools are primarily for hosting critical system pods such as CoreDNS and @@ -23,33 +23,34 @@ class AgentPoolMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: User agent pools are primarily for hosting your application pods. USER = "User" + class AgentPoolType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of Agent Pool. - """ + """The type of Agent Pool.""" #: Create an Agent Pool backed by a Virtual Machine Scale Set. VIRTUAL_MACHINE_SCALE_SETS = "VirtualMachineScaleSets" #: Use of this is strongly discouraged. AVAILABILITY_SET = "AvailabilitySet" + class Code(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Tells whether the cluster is Running or Stopped - """ + """Tells whether the cluster is Running or Stopped.""" #: The cluster is running. RUNNING = "Running" #: The cluster is stopped. STOPPED = "Stopped" + class ConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The private link service connection status. - """ + """The private link service connection status.""" PENDING = "Pending" APPROVED = "Approved" REJECTED = "Rejected" DISCONNECTED = "Disconnected" + class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Specifies what kind of storage to use. If omitted, the default will be chosen on your behalf based on the choice of orchestrator. @@ -58,9 +59,9 @@ class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEn STORAGE_ACCOUNT = "StorageAccount" MANAGED_DISKS = "ManagedDisks" + class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Size of agent VMs. Note: This is no longer maintained. - """ + """Size of agent VMs. Note: This is no longer maintained.""" STANDARD_A1 = "Standard_A1" STANDARD_A10 = "Standard_A10" @@ -237,6 +238,7 @@ class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): STANDARD_NV24 = "Standard_NV24" STANDARD_NV6 = "Standard_NV6" + class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): """Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, and 5. The default value is 1. @@ -246,15 +248,16 @@ class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): THREE = 3 FIVE = 5 + class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of identity that created the resource. - """ + """The type of identity that created the resource.""" USER = "User" APPLICATION = "Application" MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" + class Expander(str, Enum, metaclass=CaseInsensitiveEnumMeta): """If not specified, the default is 'random'. See `expanders `_ @@ -278,23 +281,25 @@ class Expander(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Used when you don't have a particular need for the node groups to scale differently. RANDOM = "random" + class ExtendedLocationTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of extendedLocation. - """ + """The type of extendedLocation.""" EDGE_ZONE = "EdgeZone" + class Format(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Format.""" #: Return azure auth-provider kubeconfig. This format is deprecated in 1.22 and will be fully #: removed in 1.25. AZURE = "azure" #: Return exec format kubeconfig. This format requires kubelogin binary in the path. - EXEC_ENUM = "exec" + EXEC = "exec" + class GPUInstanceProfile(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """GPUInstanceProfile to be used to specify GPU MIG instance profile for supported GPU VM SKU. - """ + """GPUInstanceProfile to be used to specify GPU MIG instance profile for supported GPU VM SKU.""" MIG1_G = "MIG1g" MIG2_G = "MIG2g" @@ -302,13 +307,14 @@ class GPUInstanceProfile(str, Enum, metaclass=CaseInsensitiveEnumMeta): MIG4_G = "MIG4g" MIG7_G = "MIG7g" + class IpFamily(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The IP version to use for cluster networking and IP assignment. - """ + """The IP version to use for cluster networking and IP assignment.""" I_PV4 = "IPv4" I_PV6 = "IPv6" + class KubeletDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. @@ -319,6 +325,7 @@ class KubeletDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Kubelet will use the temporary disk for its data. TEMPORARY = "Temporary" + class LicenseType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The license type to use for Windows VMs. See `Azure Hybrid User Benefits `_ for more details. @@ -329,6 +336,7 @@ class LicenseType(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Enables Azure Hybrid User Benefits for Windows VMs. WINDOWS_SERVER = "Windows_Server" + class LoadBalancerSku(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The default is 'standard'. See `Azure Load Balancer SKUs `_ for more information about the @@ -342,21 +350,22 @@ class LoadBalancerSku(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Use a basic Load Balancer with limited functionality. BASIC = "basic" + class ManagedClusterPodIdentityProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The current provisioning state of the pod identity. - """ + """The current provisioning state of the pod identity.""" ASSIGNED = "Assigned" UPDATING = "Updating" DELETING = "Deleting" FAILED = "Failed" + class ManagedClusterSKUName(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The name of a managed cluster SKU. - """ + """The name of a managed cluster SKU.""" BASIC = "Basic" + class ManagedClusterSKUTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): """If not specified, the default is 'Free'. See `uptime SLA `_ for more details. @@ -368,20 +377,20 @@ class ManagedClusterSKUTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: No guaranteed SLA, no additional charges. Free tier clusters have an SLO of 99.5%. FREE = "Free" + class NetworkMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """This cannot be specified if networkPlugin is anything other than 'azure'. - """ + """This cannot be specified if networkPlugin is anything other than 'azure'.""" #: No bridge is created. Intra-VM Pod to Pod communication is through IP routes created by Azure #: CNI. See `Transparent Mode `_ for #: more information. TRANSPARENT = "transparent" - #: This is no longer supported. + #: This is no longer supported BRIDGE = "bridge" + class NetworkPlugin(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Network plugin used for building the Kubernetes network. - """ + """Network plugin used for building the Kubernetes network.""" #: Use the Azure CNI network plugin. See `Azure CNI (advanced) networking #: `_ for @@ -392,9 +401,9 @@ class NetworkPlugin(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: information. KUBENET = "kubenet" + class NetworkPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Network policy used for building the Kubernetes network. - """ + """Network policy used for building the Kubernetes network.""" #: Use Calico network policies. See `differences between Azure and Calico policies #: `_ @@ -405,6 +414,7 @@ class NetworkPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: for more information. AZURE = "azure" + class OSDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more @@ -421,22 +431,23 @@ class OSDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: provides lower read/write latency, along with faster node scaling and cluster upgrades. EPHEMERAL = "Ephemeral" + class OSSKU(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Specifies an OS SKU. This value must not be specified if OSType is Windows. - """ + """Specifies an OS SKU. This value must not be specified if OSType is Windows.""" UBUNTU = "Ubuntu" CBL_MARINER = "CBLMariner" + class OSType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The operating system type. The default is Linux. - """ + """The operating system type. The default is Linux.""" #: Use Linux. LINUX = "Linux" #: Use Windows. WINDOWS = "Windows" + class OutboundType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """This can only be set at cluster creation time and cannot be changed later. For more information see `egress outbound type `_. @@ -457,22 +468,23 @@ class OutboundType(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: advanced scenario and requires proper network configuration. USER_ASSIGNED_NAT_GATEWAY = "userAssignedNATGateway" + class PrivateEndpointConnectionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The current provisioning state. - """ + """The current provisioning state.""" SUCCEEDED = "Succeeded" CREATING = "Creating" DELETING = "Deleting" FAILED = "Failed" + class PublicNetworkAccess(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Allow or deny public network access for AKS - """ + """Allow or deny public network access for AKS.""" ENABLED = "Enabled" DISABLED = "Disabled" + class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """For more information see `use managed identities in AKS `_. @@ -489,6 +501,7 @@ class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Do not use a managed identity for the Managed Cluster, service principal will be used instead. NONE = "None" + class ScaleDownMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Describes how VMs are added to or removed from Agent Pools. See `billing states `_. @@ -500,10 +513,11 @@ class ScaleDownMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: during scale down. DEALLOCATE = "Deallocate" + class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The eviction policy specifies what to do with the VM when it is evicted. The default is Delete. For more information about eviction see `spot VMs - `_ + `_. """ #: Nodes in the underlying Scale Set of the node pool are deleted when they're evicted. @@ -513,9 +527,9 @@ class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: cause issues with cluster scaling or upgrading. DEALLOCATE = "Deallocate" + class ScaleSetPriority(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The Virtual Machine Scale Set priority. - """ + """The Virtual Machine Scale Set priority.""" #: Spot priority VMs will be used. There is no SLA for spot nodes. See `spot on AKS #: `_ for more information. @@ -523,13 +537,14 @@ class ScaleSetPriority(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Regular VMs will be used. REGULAR = "Regular" + class SnapshotType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of a snapshot. The default is NodePool. - """ + """The type of a snapshot. The default is NodePool.""" #: The snapshot is a snapshot of a node pool. NODE_POOL = "NodePool" + class UpgradeChannel(str, Enum, metaclass=CaseInsensitiveEnumMeta): """For more information see `setting the AKS cluster auto-upgrade channel `_. @@ -560,9 +575,9 @@ class UpgradeChannel(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Disables auto-upgrades and keeps the cluster at its current version of Kubernetes. NONE = "none" + class WeekDay(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The weekday enum. - """ + """The weekday enum.""" SUNDAY = "Sunday" MONDAY = "Monday" @@ -572,9 +587,9 @@ class WeekDay(str, Enum, metaclass=CaseInsensitiveEnumMeta): FRIDAY = "Friday" SATURDAY = "Saturday" + class WorkloadRuntime(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Determines the type of workload a node can run. - """ + """Determines the type of workload a node can run.""" #: Nodes will use Kubelet to run standard OCI container workloads. OCI_CONTAINER = "OCIContainer" diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/models/_models_py3.py index b501d9885c2a..a04458c78db3 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/models/_models_py3.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/models/_models_py3.py @@ -1,4 +1,5 @@ # coding=utf-8 +# pylint: disable=too-many-lines # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -9,14 +10,14 @@ import datetime from typing import Dict, List, Optional, TYPE_CHECKING, Union -import msrest.serialization +from ... import _serialization if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - import __init__ as _models + from .. import models as _models -class SubResource(msrest.serialization.Model): +class SubResource(_serialization.Model): """Reference to another subresource. Variables are only populated by the server, and will be ignored when sending a request. @@ -31,30 +32,26 @@ class SubResource(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(SubResource, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.id = None self.name = None self.type = None -class AgentPool(SubResource): +class AgentPool(SubResource): # pylint: disable=too-many-instance-attributes """Agent Pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -82,14 +79,14 @@ class AgentPool(SubResource): larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2022_03_01.models.OSDiskType :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data - root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_03_01.models.KubeletDiskType :ivar workload_runtime: Determines the type of workload a node can run. Known values are: - "OCIContainer", "WasmWasi". + "OCIContainer" and "WasmWasi". :vartype workload_runtime: str or ~azure.mgmt.containerservice.v2022_03_01.models.WorkloadRuntime :ivar vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and used. @@ -103,11 +100,11 @@ class AgentPool(SubResource): :vartype pod_subnet_id: str :ivar max_pods: The maximum number of pods that can run on a node. :vartype max_pods: int - :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_03_01.models.OSType :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known - values are: "Ubuntu", "CBLMariner". + values are: "Ubuntu" and "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2022_03_01.models.OSSKU :ivar max_count: The maximum number of nodes for auto-scaling. :vartype max_count: int @@ -116,15 +113,15 @@ class AgentPool(SubResource): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it - defaults to Delete. Known values are: "Delete", "Deallocate". + defaults to Delete. Known values are: "Delete" and "Deallocate". :vartype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_03_01.models.ScaleDownMode - :ivar type_properties_type: The type of Agent Pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + :ivar type_properties_type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets" + and "AvailabilitySet". :vartype type_properties_type: str or ~azure.mgmt.containerservice.v2022_03_01.models.AgentPoolType :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :vartype mode: str or ~azure.mgmt.containerservice.v2022_03_01.models.AgentPoolMode :ivar orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -159,20 +156,18 @@ class AgentPool(SubResource): /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default - is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + is 'Regular'. Known values are: "Spot" and "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_03_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_03_01.models.ScaleSetEvictionPolicy :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :vartype spot_max_price: float - :ivar tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :ivar tags: The tags to be persisted on the agent pool virtual machine scale set. :vartype tags: dict[str, str] :ivar node_labels: The node labels to be persisted across all nodes in agent pool. :vartype node_labels: dict[str, str] @@ -196,7 +191,7 @@ class AgentPool(SubResource): for more details. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_03_01.models.GPUInstanceProfile :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the node pool @@ -205,60 +200,60 @@ class AgentPool(SubResource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'os_disk_size_gb': {'maximum': 2048, 'minimum': 0}, - 'node_image_version': {'readonly': True}, - 'provisioning_state': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "os_disk_size_gb": {"maximum": 2048, "minimum": 0}, + "node_image_version": {"readonly": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'count': {'key': 'properties.count', 'type': 'int'}, - 'vm_size': {'key': 'properties.vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'properties.osDiskSizeGB', 'type': 'int'}, - 'os_disk_type': {'key': 'properties.osDiskType', 'type': 'str'}, - 'kubelet_disk_type': {'key': 'properties.kubeletDiskType', 'type': 'str'}, - 'workload_runtime': {'key': 'properties.workloadRuntime', 'type': 'str'}, - 'vnet_subnet_id': {'key': 'properties.vnetSubnetID', 'type': 'str'}, - 'pod_subnet_id': {'key': 'properties.podSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'properties.maxPods', 'type': 'int'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'os_sku': {'key': 'properties.osSKU', 'type': 'str'}, - 'max_count': {'key': 'properties.maxCount', 'type': 'int'}, - 'min_count': {'key': 'properties.minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'properties.enableAutoScaling', 'type': 'bool'}, - 'scale_down_mode': {'key': 'properties.scaleDownMode', 'type': 'str'}, - 'type_properties_type': {'key': 'properties.type', 'type': 'str'}, - 'mode': {'key': 'properties.mode', 'type': 'str'}, - 'orchestrator_version': {'key': 'properties.orchestratorVersion', 'type': 'str'}, - 'node_image_version': {'key': 'properties.nodeImageVersion', 'type': 'str'}, - 'upgrade_settings': {'key': 'properties.upgradeSettings', 'type': 'AgentPoolUpgradeSettings'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'power_state': {'key': 'properties.powerState', 'type': 'PowerState'}, - 'availability_zones': {'key': 'properties.availabilityZones', 'type': '[str]'}, - 'enable_node_public_ip': {'key': 'properties.enableNodePublicIP', 'type': 'bool'}, - 'node_public_ip_prefix_id': {'key': 'properties.nodePublicIPPrefixID', 'type': 'str'}, - 'scale_set_priority': {'key': 'properties.scaleSetPriority', 'type': 'str'}, - 'scale_set_eviction_policy': {'key': 'properties.scaleSetEvictionPolicy', 'type': 'str'}, - 'spot_max_price': {'key': 'properties.spotMaxPrice', 'type': 'float'}, - 'tags': {'key': 'properties.tags', 'type': '{str}'}, - 'node_labels': {'key': 'properties.nodeLabels', 'type': '{str}'}, - 'node_taints': {'key': 'properties.nodeTaints', 'type': '[str]'}, - 'proximity_placement_group_id': {'key': 'properties.proximityPlacementGroupID', 'type': 'str'}, - 'kubelet_config': {'key': 'properties.kubeletConfig', 'type': 'KubeletConfig'}, - 'linux_os_config': {'key': 'properties.linuxOSConfig', 'type': 'LinuxOSConfig'}, - 'enable_encryption_at_host': {'key': 'properties.enableEncryptionAtHost', 'type': 'bool'}, - 'enable_ultra_ssd': {'key': 'properties.enableUltraSSD', 'type': 'bool'}, - 'enable_fips': {'key': 'properties.enableFIPS', 'type': 'bool'}, - 'gpu_instance_profile': {'key': 'properties.gpuInstanceProfile', 'type': 'str'}, - 'creation_data': {'key': 'properties.creationData', 'type': 'CreationData'}, - } - - def __init__( + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "count": {"key": "properties.count", "type": "int"}, + "vm_size": {"key": "properties.vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "properties.osDiskSizeGB", "type": "int"}, + "os_disk_type": {"key": "properties.osDiskType", "type": "str"}, + "kubelet_disk_type": {"key": "properties.kubeletDiskType", "type": "str"}, + "workload_runtime": {"key": "properties.workloadRuntime", "type": "str"}, + "vnet_subnet_id": {"key": "properties.vnetSubnetID", "type": "str"}, + "pod_subnet_id": {"key": "properties.podSubnetID", "type": "str"}, + "max_pods": {"key": "properties.maxPods", "type": "int"}, + "os_type": {"key": "properties.osType", "type": "str"}, + "os_sku": {"key": "properties.osSKU", "type": "str"}, + "max_count": {"key": "properties.maxCount", "type": "int"}, + "min_count": {"key": "properties.minCount", "type": "int"}, + "enable_auto_scaling": {"key": "properties.enableAutoScaling", "type": "bool"}, + "scale_down_mode": {"key": "properties.scaleDownMode", "type": "str"}, + "type_properties_type": {"key": "properties.type", "type": "str"}, + "mode": {"key": "properties.mode", "type": "str"}, + "orchestrator_version": {"key": "properties.orchestratorVersion", "type": "str"}, + "node_image_version": {"key": "properties.nodeImageVersion", "type": "str"}, + "upgrade_settings": {"key": "properties.upgradeSettings", "type": "AgentPoolUpgradeSettings"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "power_state": {"key": "properties.powerState", "type": "PowerState"}, + "availability_zones": {"key": "properties.availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "properties.enableNodePublicIP", "type": "bool"}, + "node_public_ip_prefix_id": {"key": "properties.nodePublicIPPrefixID", "type": "str"}, + "scale_set_priority": {"key": "properties.scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "properties.scaleSetEvictionPolicy", "type": "str"}, + "spot_max_price": {"key": "properties.spotMaxPrice", "type": "float"}, + "tags": {"key": "properties.tags", "type": "{str}"}, + "node_labels": {"key": "properties.nodeLabels", "type": "{str}"}, + "node_taints": {"key": "properties.nodeTaints", "type": "[str]"}, + "proximity_placement_group_id": {"key": "properties.proximityPlacementGroupID", "type": "str"}, + "kubelet_config": {"key": "properties.kubeletConfig", "type": "KubeletConfig"}, + "linux_os_config": {"key": "properties.linuxOSConfig", "type": "LinuxOSConfig"}, + "enable_encryption_at_host": {"key": "properties.enableEncryptionAtHost", "type": "bool"}, + "enable_ultra_ssd": {"key": "properties.enableUltraSSD", "type": "bool"}, + "enable_fips": {"key": "properties.enableFIPS", "type": "bool"}, + "gpu_instance_profile": {"key": "properties.gpuInstanceProfile", "type": "str"}, + "creation_data": {"key": "properties.creationData", "type": "CreationData"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, count: Optional[int] = None, @@ -270,7 +265,7 @@ def __init__( vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, @@ -284,9 +279,9 @@ def __init__( availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", - spot_max_price: Optional[float] = -1, + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", + spot_max_price: float = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, @@ -317,14 +312,14 @@ def __init__( larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2022_03_01.models.OSDiskType :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime - data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + data root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_03_01.models.KubeletDiskType :keyword workload_runtime: Determines the type of workload a node can run. Known values are: - "OCIContainer", "WasmWasi". + "OCIContainer" and "WasmWasi". :paramtype workload_runtime: str or ~azure.mgmt.containerservice.v2022_03_01.models.WorkloadRuntime :keyword vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and @@ -338,11 +333,11 @@ def __init__( :paramtype pod_subnet_id: str :keyword max_pods: The maximum number of pods that can run on a node. :paramtype max_pods: int - :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_03_01.models.OSType :keyword os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Known values are: "Ubuntu", "CBLMariner". + Known values are: "Ubuntu" and "CBLMariner". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2022_03_01.models.OSSKU :keyword max_count: The maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -351,16 +346,16 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, - it defaults to Delete. Known values are: "Delete", "Deallocate". + it defaults to Delete. Known values are: "Delete" and "Deallocate". :paramtype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_03_01.models.ScaleDownMode :keyword type_properties_type: The type of Agent Pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type_properties_type: str or ~azure.mgmt.containerservice.v2022_03_01.models.AgentPoolType :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2022_03_01.models.AgentPoolMode :keyword orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -391,20 +386,18 @@ def __init__( /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the - default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + default is 'Regular'. Known values are: "Spot" and "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_03_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_03_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :paramtype spot_max_price: float - :keyword tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :keyword tags: The tags to be persisted on the agent pool virtual machine scale set. :paramtype tags: dict[str, str] :keyword node_labels: The node labels to be persisted across all nodes in agent pool. :paramtype node_labels: dict[str, str] @@ -428,7 +421,7 @@ def __init__( for more details. :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance - profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_03_01.models.GPUInstanceProfile @@ -436,7 +429,7 @@ def __init__( pool will be created/upgraded using a snapshot. :paramtype creation_data: ~azure.mgmt.containerservice.v2022_03_01.models.CreationData """ - super(AgentPool, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.vm_size = vm_size self.os_disk_size_gb = os_disk_size_gb @@ -478,7 +471,7 @@ def __init__( self.creation_data = creation_data -class AgentPoolAvailableVersions(msrest.serialization.Model): +class AgentPoolAvailableVersions(_serialization.Model): """The list of available versions for an agent pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -495,16 +488,19 @@ class AgentPoolAvailableVersions(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'agent_pool_versions': {'key': 'properties.agentPoolVersions', 'type': '[AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "agent_pool_versions": { + "key": "properties.agentPoolVersions", + "type": "[AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem]", + }, } def __init__( @@ -518,14 +514,14 @@ def __init__( :paramtype agent_pool_versions: list[~azure.mgmt.containerservice.v2022_03_01.models.AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem] """ - super(AgentPoolAvailableVersions, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None self.agent_pool_versions = agent_pool_versions -class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(msrest.serialization.Model): +class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(_serialization.Model): """AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem. :ivar default: Whether this version is the default agent pool version. @@ -537,9 +533,9 @@ class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(msrest.serializa """ _attribute_map = { - 'default': {'key': 'default', 'type': 'bool'}, - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "default": {"key": "default", "type": "bool"}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } def __init__( @@ -558,13 +554,13 @@ def __init__( :keyword is_preview: Whether Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.default = default self.kubernetes_version = kubernetes_version self.is_preview = is_preview -class AgentPoolListResult(msrest.serialization.Model): +class AgentPoolListResult(_serialization.Model): """The response from the List Agent Pools operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -576,30 +572,25 @@ class AgentPoolListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[AgentPool]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[AgentPool]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.AgentPool"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.AgentPool"]] = None, **kwargs): """ :keyword value: The list of agent pools. :paramtype value: list[~azure.mgmt.containerservice.v2022_03_01.models.AgentPool] """ - super(AgentPoolListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class AgentPoolUpgradeProfile(msrest.serialization.Model): +class AgentPoolUpgradeProfile(_serialization.Model): """The list of available upgrades for an agent pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -612,10 +603,10 @@ class AgentPoolUpgradeProfile(msrest.serialization.Model): :vartype name: str :ivar type: The type of the agent pool upgrade profile. :vartype type: str - :ivar kubernetes_version: Required. The Kubernetes version (major.minor.patch). + :ivar kubernetes_version: The Kubernetes version (major.minor.patch). Required. :vartype kubernetes_version: str - :ivar os_type: Required. The operating system type. The default is Linux. Known values are: - "Linux", "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_03_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -625,21 +616,21 @@ class AgentPoolUpgradeProfile(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kubernetes_version': {'required': True}, - 'os_type': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "kubernetes_version": {"required": True}, + "os_type": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'kubernetes_version': {'key': 'properties.kubernetesVersion', 'type': 'str'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'upgrades': {'key': 'properties.upgrades', 'type': '[AgentPoolUpgradeProfilePropertiesUpgradesItem]'}, - 'latest_node_image_version': {'key': 'properties.latestNodeImageVersion', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "os_type": {"key": "properties.osType", "type": "str"}, + "upgrades": {"key": "properties.upgrades", "type": "[AgentPoolUpgradeProfilePropertiesUpgradesItem]"}, + "latest_node_image_version": {"key": "properties.latestNodeImageVersion", "type": "str"}, } def __init__( @@ -652,10 +643,10 @@ def __init__( **kwargs ): """ - :keyword kubernetes_version: Required. The Kubernetes version (major.minor.patch). + :keyword kubernetes_version: The Kubernetes version (major.minor.patch). Required. :paramtype kubernetes_version: str - :keyword os_type: Required. The operating system type. The default is Linux. Known values are: - "Linux", "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_03_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: @@ -663,7 +654,7 @@ def __init__( :keyword latest_node_image_version: The latest AKS supported node image version. :paramtype latest_node_image_version: str """ - super(AgentPoolUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -673,7 +664,7 @@ def __init__( self.latest_node_image_version = latest_node_image_version -class AgentPoolUpgradeProfilePropertiesUpgradesItem(msrest.serialization.Model): +class AgentPoolUpgradeProfilePropertiesUpgradesItem(_serialization.Model): """AgentPoolUpgradeProfilePropertiesUpgradesItem. :ivar kubernetes_version: The Kubernetes version (major.minor.patch). @@ -683,29 +674,23 @@ class AgentPoolUpgradeProfilePropertiesUpgradesItem(msrest.serialization.Model): """ _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } - def __init__( - self, - *, - kubernetes_version: Optional[str] = None, - is_preview: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, kubernetes_version: Optional[str] = None, is_preview: Optional[bool] = None, **kwargs): """ :keyword kubernetes_version: The Kubernetes version (major.minor.patch). :paramtype kubernetes_version: str :keyword is_preview: Whether the Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(AgentPoolUpgradeProfilePropertiesUpgradesItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.is_preview = is_preview -class AgentPoolUpgradeSettings(msrest.serialization.Model): +class AgentPoolUpgradeSettings(_serialization.Model): """Settings for upgrading an agentpool. :ivar max_surge: This can either be set to an integer (e.g. '5') or a percentage (e.g. '50%'). @@ -717,15 +702,10 @@ class AgentPoolUpgradeSettings(msrest.serialization.Model): """ _attribute_map = { - 'max_surge': {'key': 'maxSurge', 'type': 'str'}, + "max_surge": {"key": "maxSurge", "type": "str"}, } - def __init__( - self, - *, - max_surge: Optional[str] = None, - **kwargs - ): + def __init__(self, *, max_surge: Optional[str] = None, **kwargs): """ :keyword max_surge: This can either be set to an integer (e.g. '5') or a percentage (e.g. '50%'). If a percentage is specified, it is the percentage of the total agent pool size at the @@ -734,11 +714,11 @@ def __init__( https://docs.microsoft.com/azure/aks/upgrade-cluster#customize-node-surge-upgrade. :paramtype max_surge: str """ - super(AgentPoolUpgradeSettings, self).__init__(**kwargs) + super().__init__(**kwargs) self.max_surge = max_surge -class CloudErrorBody(msrest.serialization.Model): +class CloudErrorBody(_serialization.Model): """An error response from the Container service. :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed @@ -755,10 +735,10 @@ class CloudErrorBody(msrest.serialization.Model): """ _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[CloudErrorBody]"}, } def __init__( @@ -783,87 +763,76 @@ def __init__( :keyword details: A list of additional details about the error. :paramtype details: list[~azure.mgmt.containerservice.v2022_03_01.models.CloudErrorBody] """ - super(CloudErrorBody, self).__init__(**kwargs) + super().__init__(**kwargs) self.code = code self.message = message self.target = target self.details = details -class ContainerServiceDiagnosticsProfile(msrest.serialization.Model): +class ContainerServiceDiagnosticsProfile(_serialization.Model): """Profile for diagnostics on the container service cluster. All required parameters must be populated in order to send to Azure. - :ivar vm_diagnostics: Required. Profile for diagnostics on the container service VMs. + :ivar vm_diagnostics: Profile for diagnostics on the container service VMs. Required. :vartype vm_diagnostics: ~azure.mgmt.containerservice.v2022_03_01.models.ContainerServiceVMDiagnostics """ _validation = { - 'vm_diagnostics': {'required': True}, + "vm_diagnostics": {"required": True}, } _attribute_map = { - 'vm_diagnostics': {'key': 'vmDiagnostics', 'type': 'ContainerServiceVMDiagnostics'}, + "vm_diagnostics": {"key": "vmDiagnostics", "type": "ContainerServiceVMDiagnostics"}, } - def __init__( - self, - *, - vm_diagnostics: "_models.ContainerServiceVMDiagnostics", - **kwargs - ): + def __init__(self, *, vm_diagnostics: "_models.ContainerServiceVMDiagnostics", **kwargs): """ - :keyword vm_diagnostics: Required. Profile for diagnostics on the container service VMs. + :keyword vm_diagnostics: Profile for diagnostics on the container service VMs. Required. :paramtype vm_diagnostics: ~azure.mgmt.containerservice.v2022_03_01.models.ContainerServiceVMDiagnostics """ - super(ContainerServiceDiagnosticsProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.vm_diagnostics = vm_diagnostics -class ContainerServiceLinuxProfile(msrest.serialization.Model): +class ContainerServiceLinuxProfile(_serialization.Model): """Profile for Linux VMs in the container service cluster. All required parameters must be populated in order to send to Azure. - :ivar admin_username: Required. The administrator username to use for Linux VMs. + :ivar admin_username: The administrator username to use for Linux VMs. Required. :vartype admin_username: str - :ivar ssh: Required. The SSH configuration for Linux-based VMs running on Azure. + :ivar ssh: The SSH configuration for Linux-based VMs running on Azure. Required. :vartype ssh: ~azure.mgmt.containerservice.v2022_03_01.models.ContainerServiceSshConfiguration """ _validation = { - 'admin_username': {'required': True, 'pattern': r'^[A-Za-z][-A-Za-z0-9_]*$'}, - 'ssh': {'required': True}, + "admin_username": {"required": True, "pattern": r"^[A-Za-z][-A-Za-z0-9_]*$"}, + "ssh": {"required": True}, } _attribute_map = { - 'admin_username': {'key': 'adminUsername', 'type': 'str'}, - 'ssh': {'key': 'ssh', 'type': 'ContainerServiceSshConfiguration'}, + "admin_username": {"key": "adminUsername", "type": "str"}, + "ssh": {"key": "ssh", "type": "ContainerServiceSshConfiguration"}, } - def __init__( - self, - *, - admin_username: str, - ssh: "_models.ContainerServiceSshConfiguration", - **kwargs - ): + def __init__(self, *, admin_username: str, ssh: "_models.ContainerServiceSshConfiguration", **kwargs): """ - :keyword admin_username: Required. The administrator username to use for Linux VMs. + :keyword admin_username: The administrator username to use for Linux VMs. Required. :paramtype admin_username: str - :keyword ssh: Required. The SSH configuration for Linux-based VMs running on Azure. + :keyword ssh: The SSH configuration for Linux-based VMs running on Azure. Required. :paramtype ssh: ~azure.mgmt.containerservice.v2022_03_01.models.ContainerServiceSshConfiguration """ - super(ContainerServiceLinuxProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.admin_username = admin_username self.ssh = ssh -class ContainerServiceMasterProfile(msrest.serialization.Model): +class ContainerServiceMasterProfile(_serialization.Model): """Profile for the container service master. Variables are only populated by the server, and will be ignored when sending a request. @@ -871,11 +840,11 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar count: Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, - and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". + and 5. The default value is 1. Known values are: 1, 3, and 5. :vartype count: int or ~azure.mgmt.containerservice.v2022_03_01.models.Count - :ivar dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. + :ivar dns_prefix: DNS prefix to be used to create the FQDN for the master pool. Required. :vartype dns_prefix: str - :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + :ivar vm_size: Size of agent VMs. Required. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -912,7 +881,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :vartype vm_size: str or ~azure.mgmt.containerservice.v2022_03_01.models.ContainerServiceVMSizeTypes :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine @@ -926,7 +895,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): :vartype first_consecutive_static_ip: str :ivar storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount" and "ManagedDisks". :vartype storage_profile: str or ~azure.mgmt.containerservice.v2022_03_01.models.ContainerServiceStorageProfileTypes :ivar fqdn: FQDN for the master pool. @@ -934,21 +903,21 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): """ _validation = { - 'dns_prefix': {'required': True}, - 'vm_size': {'required': True}, - 'os_disk_size_gb': {'maximum': 2048, 'minimum': 0}, - 'fqdn': {'readonly': True}, + "dns_prefix": {"required": True}, + "vm_size": {"required": True}, + "os_disk_size_gb": {"maximum": 2048, "minimum": 0}, + "fqdn": {"readonly": True}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'dns_prefix': {'key': 'dnsPrefix', 'type': 'str'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'first_consecutive_static_ip': {'key': 'firstConsecutiveStaticIP', 'type': 'str'}, - 'storage_profile': {'key': 'storageProfile', 'type': 'str'}, - 'fqdn': {'key': 'fqdn', 'type': 'str'}, + "count": {"key": "count", "type": "int"}, + "dns_prefix": {"key": "dnsPrefix", "type": "str"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "first_consecutive_static_ip": {"key": "firstConsecutiveStaticIP", "type": "str"}, + "storage_profile": {"key": "storageProfile", "type": "str"}, + "fqdn": {"key": "fqdn", "type": "str"}, } def __init__( @@ -956,20 +925,20 @@ def __init__( *, dns_prefix: str, vm_size: Union[str, "_models.ContainerServiceVMSizeTypes"], - count: Optional[Union[int, "_models.Count"]] = 1, + count: Union[int, "_models.Count"] = 1, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, - first_consecutive_static_ip: Optional[str] = "10.240.255.5", + first_consecutive_static_ip: str = "10.240.255.5", storage_profile: Optional[Union[str, "_models.ContainerServiceStorageProfileTypes"]] = None, **kwargs ): """ :keyword count: Number of masters (VMs) in the container service cluster. Allowed values are 1, - 3, and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". + 3, and 5. The default value is 1. Known values are: 1, 3, and 5. :paramtype count: int or ~azure.mgmt.containerservice.v2022_03_01.models.Count - :keyword dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. + :keyword dns_prefix: DNS prefix to be used to create the FQDN for the master pool. Required. :paramtype dns_prefix: str - :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + :keyword vm_size: Size of agent VMs. Required. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -1006,7 +975,7 @@ def __init__( "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :paramtype vm_size: str or ~azure.mgmt.containerservice.v2022_03_01.models.ContainerServiceVMSizeTypes :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every @@ -1020,11 +989,11 @@ def __init__( :paramtype first_consecutive_static_ip: str :keyword storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount" and "ManagedDisks". :paramtype storage_profile: str or ~azure.mgmt.containerservice.v2022_03_01.models.ContainerServiceStorageProfileTypes """ - super(ContainerServiceMasterProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.dns_prefix = dns_prefix self.vm_size = vm_size @@ -1035,17 +1004,17 @@ def __init__( self.fqdn = None -class ContainerServiceNetworkProfile(msrest.serialization.Model): +class ContainerServiceNetworkProfile(_serialization.Model): # pylint: disable=too-many-instance-attributes """Profile of network configuration. :ivar network_plugin: Network plugin used for building the Kubernetes network. Known values - are: "azure", "kubenet". Default value: "kubenet". + are: "azure" and "kubenet". :vartype network_plugin: str or ~azure.mgmt.containerservice.v2022_03_01.models.NetworkPlugin :ivar network_policy: Network policy used for building the Kubernetes network. Known values - are: "calico", "azure". + are: "calico" and "azure". :vartype network_policy: str or ~azure.mgmt.containerservice.v2022_03_01.models.NetworkPolicy :ivar network_mode: This cannot be specified if networkPlugin is anything other than 'azure'. - Known values are: "transparent", "bridge". + Known values are: "transparent" and "bridge". :vartype network_mode: str or ~azure.mgmt.containerservice.v2022_03_01.models.NetworkMode :ivar pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :vartype pod_cidr: str @@ -1061,12 +1030,11 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): :ivar outbound_type: This can only be set at cluster creation time and cannot be changed later. For more information see `egress outbound type `_. Known values are: "loadBalancer", - "userDefinedRouting", "managedNATGateway", "userAssignedNATGateway". Default value: - "loadBalancer". + "userDefinedRouting", "managedNATGateway", and "userAssignedNATGateway". :vartype outbound_type: str or ~azure.mgmt.containerservice.v2022_03_01.models.OutboundType :ivar load_balancer_sku: The default is 'standard'. See `Azure Load Balancer SKUs `_ for more information about the - differences between load balancer SKUs. Known values are: "standard", "basic". + differences between load balancer SKUs. Known values are: "standard" and "basic". :vartype load_balancer_sku: str or ~azure.mgmt.containerservice.v2022_03_01.models.LoadBalancerSku :ivar load_balancer_profile: Profile of the cluster load balancer. @@ -1089,40 +1057,42 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): """ _validation = { - 'pod_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, - 'service_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, - 'dns_service_ip': {'pattern': r'^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$'}, - 'docker_bridge_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, + "pod_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, + "service_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, + "dns_service_ip": { + "pattern": r"^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$" + }, + "docker_bridge_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, } _attribute_map = { - 'network_plugin': {'key': 'networkPlugin', 'type': 'str'}, - 'network_policy': {'key': 'networkPolicy', 'type': 'str'}, - 'network_mode': {'key': 'networkMode', 'type': 'str'}, - 'pod_cidr': {'key': 'podCidr', 'type': 'str'}, - 'service_cidr': {'key': 'serviceCidr', 'type': 'str'}, - 'dns_service_ip': {'key': 'dnsServiceIP', 'type': 'str'}, - 'docker_bridge_cidr': {'key': 'dockerBridgeCidr', 'type': 'str'}, - 'outbound_type': {'key': 'outboundType', 'type': 'str'}, - 'load_balancer_sku': {'key': 'loadBalancerSku', 'type': 'str'}, - 'load_balancer_profile': {'key': 'loadBalancerProfile', 'type': 'ManagedClusterLoadBalancerProfile'}, - 'nat_gateway_profile': {'key': 'natGatewayProfile', 'type': 'ManagedClusterNATGatewayProfile'}, - 'pod_cidrs': {'key': 'podCidrs', 'type': '[str]'}, - 'service_cidrs': {'key': 'serviceCidrs', 'type': '[str]'}, - 'ip_families': {'key': 'ipFamilies', 'type': '[str]'}, + "network_plugin": {"key": "networkPlugin", "type": "str"}, + "network_policy": {"key": "networkPolicy", "type": "str"}, + "network_mode": {"key": "networkMode", "type": "str"}, + "pod_cidr": {"key": "podCidr", "type": "str"}, + "service_cidr": {"key": "serviceCidr", "type": "str"}, + "dns_service_ip": {"key": "dnsServiceIP", "type": "str"}, + "docker_bridge_cidr": {"key": "dockerBridgeCidr", "type": "str"}, + "outbound_type": {"key": "outboundType", "type": "str"}, + "load_balancer_sku": {"key": "loadBalancerSku", "type": "str"}, + "load_balancer_profile": {"key": "loadBalancerProfile", "type": "ManagedClusterLoadBalancerProfile"}, + "nat_gateway_profile": {"key": "natGatewayProfile", "type": "ManagedClusterNATGatewayProfile"}, + "pod_cidrs": {"key": "podCidrs", "type": "[str]"}, + "service_cidrs": {"key": "serviceCidrs", "type": "[str]"}, + "ip_families": {"key": "ipFamilies", "type": "[str]"}, } def __init__( self, *, - network_plugin: Optional[Union[str, "_models.NetworkPlugin"]] = "kubenet", + network_plugin: Union[str, "_models.NetworkPlugin"] = "kubenet", network_policy: Optional[Union[str, "_models.NetworkPolicy"]] = None, network_mode: Optional[Union[str, "_models.NetworkMode"]] = None, - pod_cidr: Optional[str] = "10.244.0.0/16", - service_cidr: Optional[str] = "10.0.0.0/16", - dns_service_ip: Optional[str] = "10.0.0.10", - docker_bridge_cidr: Optional[str] = "172.17.0.1/16", - outbound_type: Optional[Union[str, "_models.OutboundType"]] = "loadBalancer", + pod_cidr: str = "10.244.0.0/16", + service_cidr: str = "10.0.0.0/16", + dns_service_ip: str = "10.0.0.10", + docker_bridge_cidr: str = "172.17.0.1/16", + outbound_type: Union[str, "_models.OutboundType"] = "loadBalancer", load_balancer_sku: Optional[Union[str, "_models.LoadBalancerSku"]] = None, load_balancer_profile: Optional["_models.ManagedClusterLoadBalancerProfile"] = None, nat_gateway_profile: Optional["_models.ManagedClusterNATGatewayProfile"] = None, @@ -1133,13 +1103,13 @@ def __init__( ): """ :keyword network_plugin: Network plugin used for building the Kubernetes network. Known values - are: "azure", "kubenet". Default value: "kubenet". + are: "azure" and "kubenet". :paramtype network_plugin: str or ~azure.mgmt.containerservice.v2022_03_01.models.NetworkPlugin :keyword network_policy: Network policy used for building the Kubernetes network. Known values - are: "calico", "azure". + are: "calico" and "azure". :paramtype network_policy: str or ~azure.mgmt.containerservice.v2022_03_01.models.NetworkPolicy :keyword network_mode: This cannot be specified if networkPlugin is anything other than - 'azure'. Known values are: "transparent", "bridge". + 'azure'. Known values are: "transparent" and "bridge". :paramtype network_mode: str or ~azure.mgmt.containerservice.v2022_03_01.models.NetworkMode :keyword pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :paramtype pod_cidr: str @@ -1155,12 +1125,11 @@ def __init__( :keyword outbound_type: This can only be set at cluster creation time and cannot be changed later. For more information see `egress outbound type `_. Known values are: "loadBalancer", - "userDefinedRouting", "managedNATGateway", "userAssignedNATGateway". Default value: - "loadBalancer". + "userDefinedRouting", "managedNATGateway", and "userAssignedNATGateway". :paramtype outbound_type: str or ~azure.mgmt.containerservice.v2022_03_01.models.OutboundType :keyword load_balancer_sku: The default is 'standard'. See `Azure Load Balancer SKUs `_ for more information about the - differences between load balancer SKUs. Known values are: "standard", "basic". + differences between load balancer SKUs. Known values are: "standard" and "basic". :paramtype load_balancer_sku: str or ~azure.mgmt.containerservice.v2022_03_01.models.LoadBalancerSku :keyword load_balancer_profile: Profile of the cluster load balancer. @@ -1181,7 +1150,7 @@ def __init__( IPv6. :paramtype ip_families: list[str or ~azure.mgmt.containerservice.v2022_03_01.models.IpFamily] """ - super(ContainerServiceNetworkProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.network_plugin = network_plugin self.network_policy = network_policy self.network_mode = network_mode @@ -1198,113 +1167,98 @@ def __init__( self.ip_families = ip_families -class ContainerServiceSshConfiguration(msrest.serialization.Model): +class ContainerServiceSshConfiguration(_serialization.Model): """SSH configuration for Linux-based VMs running on Azure. All required parameters must be populated in order to send to Azure. - :ivar public_keys: Required. The list of SSH public keys used to authenticate with Linux-based - VMs. A maximum of 1 key may be specified. + :ivar public_keys: The list of SSH public keys used to authenticate with Linux-based VMs. A + maximum of 1 key may be specified. Required. :vartype public_keys: list[~azure.mgmt.containerservice.v2022_03_01.models.ContainerServiceSshPublicKey] """ _validation = { - 'public_keys': {'required': True}, + "public_keys": {"required": True}, } _attribute_map = { - 'public_keys': {'key': 'publicKeys', 'type': '[ContainerServiceSshPublicKey]'}, + "public_keys": {"key": "publicKeys", "type": "[ContainerServiceSshPublicKey]"}, } - def __init__( - self, - *, - public_keys: List["_models.ContainerServiceSshPublicKey"], - **kwargs - ): + def __init__(self, *, public_keys: List["_models.ContainerServiceSshPublicKey"], **kwargs): """ - :keyword public_keys: Required. The list of SSH public keys used to authenticate with - Linux-based VMs. A maximum of 1 key may be specified. + :keyword public_keys: The list of SSH public keys used to authenticate with Linux-based VMs. A + maximum of 1 key may be specified. Required. :paramtype public_keys: list[~azure.mgmt.containerservice.v2022_03_01.models.ContainerServiceSshPublicKey] """ - super(ContainerServiceSshConfiguration, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_keys = public_keys -class ContainerServiceSshPublicKey(msrest.serialization.Model): +class ContainerServiceSshPublicKey(_serialization.Model): """Contains information about SSH certificate public key data. All required parameters must be populated in order to send to Azure. - :ivar key_data: Required. Certificate public key used to authenticate with VMs through SSH. The - certificate must be in PEM format with or without headers. + :ivar key_data: Certificate public key used to authenticate with VMs through SSH. The + certificate must be in PEM format with or without headers. Required. :vartype key_data: str """ _validation = { - 'key_data': {'required': True}, + "key_data": {"required": True}, } _attribute_map = { - 'key_data': {'key': 'keyData', 'type': 'str'}, + "key_data": {"key": "keyData", "type": "str"}, } - def __init__( - self, - *, - key_data: str, - **kwargs - ): + def __init__(self, *, key_data: str, **kwargs): """ - :keyword key_data: Required. Certificate public key used to authenticate with VMs through SSH. - The certificate must be in PEM format with or without headers. + :keyword key_data: Certificate public key used to authenticate with VMs through SSH. The + certificate must be in PEM format with or without headers. Required. :paramtype key_data: str """ - super(ContainerServiceSshPublicKey, self).__init__(**kwargs) + super().__init__(**kwargs) self.key_data = key_data -class ContainerServiceVMDiagnostics(msrest.serialization.Model): +class ContainerServiceVMDiagnostics(_serialization.Model): """Profile for diagnostics on the container service VMs. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar enabled: Required. Whether the VM diagnostic agent is provisioned on the VM. + :ivar enabled: Whether the VM diagnostic agent is provisioned on the VM. Required. :vartype enabled: bool :ivar storage_uri: The URI of the storage account where diagnostics are stored. :vartype storage_uri: str """ _validation = { - 'enabled': {'required': True}, - 'storage_uri': {'readonly': True}, + "enabled": {"required": True}, + "storage_uri": {"readonly": True}, } _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'storage_uri': {'key': 'storageUri', 'type': 'str'}, + "enabled": {"key": "enabled", "type": "bool"}, + "storage_uri": {"key": "storageUri", "type": "str"}, } - def __init__( - self, - *, - enabled: bool, - **kwargs - ): + def __init__(self, *, enabled: bool, **kwargs): """ - :keyword enabled: Required. Whether the VM diagnostic agent is provisioned on the VM. + :keyword enabled: Whether the VM diagnostic agent is provisioned on the VM. Required. :paramtype enabled: bool """ - super(ContainerServiceVMDiagnostics, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.storage_uri = None -class CreationData(msrest.serialization.Model): +class CreationData(_serialization.Model): """Data used when creating a target resource from a source resource. :ivar source_resource_id: This is the ARM ID of the source object to be used to create the @@ -1313,25 +1267,20 @@ class CreationData(msrest.serialization.Model): """ _attribute_map = { - 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, + "source_resource_id": {"key": "sourceResourceId", "type": "str"}, } - def __init__( - self, - *, - source_resource_id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, source_resource_id: Optional[str] = None, **kwargs): """ :keyword source_resource_id: This is the ARM ID of the source object to be used to create the target object. :paramtype source_resource_id: str """ - super(CreationData, self).__init__(**kwargs) + super().__init__(**kwargs) self.source_resource_id = source_resource_id -class CredentialResult(msrest.serialization.Model): +class CredentialResult(_serialization.Model): """The credential result response. Variables are only populated by the server, and will be ignored when sending a request. @@ -1339,31 +1288,27 @@ class CredentialResult(msrest.serialization.Model): :ivar name: The name of the credential. :vartype name: str :ivar value: Base64-encoded Kubernetes configuration file. - :vartype value: bytearray + :vartype value: bytes """ _validation = { - 'name': {'readonly': True}, - 'value': {'readonly': True}, + "name": {"readonly": True}, + "value": {"readonly": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'bytearray'}, + "name": {"key": "name", "type": "str"}, + "value": {"key": "value", "type": "bytearray"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(CredentialResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.name = None self.value = None -class CredentialResults(msrest.serialization.Model): +class CredentialResults(_serialization.Model): """The list credential result response. Variables are only populated by the server, and will be ignored when sending a request. @@ -1373,24 +1318,20 @@ class CredentialResults(msrest.serialization.Model): """ _validation = { - 'kubeconfigs': {'readonly': True}, + "kubeconfigs": {"readonly": True}, } _attribute_map = { - 'kubeconfigs': {'key': 'kubeconfigs', 'type': '[CredentialResult]'}, + "kubeconfigs": {"key": "kubeconfigs", "type": "[CredentialResult]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(CredentialResults, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.kubeconfigs = None -class EndpointDependency(msrest.serialization.Model): +class EndpointDependency(_serialization.Model): """A domain name that AKS agent nodes are reaching at. :ivar domain_name: The domain name of the dependency. @@ -1400,8 +1341,8 @@ class EndpointDependency(msrest.serialization.Model): """ _attribute_map = { - 'domain_name': {'key': 'domainName', 'type': 'str'}, - 'endpoint_details': {'key': 'endpointDetails', 'type': '[EndpointDetail]'}, + "domain_name": {"key": "domainName", "type": "str"}, + "endpoint_details": {"key": "endpointDetails", "type": "[EndpointDetail]"}, } def __init__( @@ -1418,12 +1359,12 @@ def __init__( :paramtype endpoint_details: list[~azure.mgmt.containerservice.v2022_03_01.models.EndpointDetail] """ - super(EndpointDependency, self).__init__(**kwargs) + super().__init__(**kwargs) self.domain_name = domain_name self.endpoint_details = endpoint_details -class EndpointDetail(msrest.serialization.Model): +class EndpointDetail(_serialization.Model): """connect information from the AKS agent nodes to a single endpoint. :ivar ip_address: An IP Address that Domain Name currently resolves to. @@ -1437,10 +1378,10 @@ class EndpointDetail(msrest.serialization.Model): """ _attribute_map = { - 'ip_address': {'key': 'ipAddress', 'type': 'str'}, - 'port': {'key': 'port', 'type': 'int'}, - 'protocol': {'key': 'protocol', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, + "ip_address": {"key": "ipAddress", "type": "str"}, + "port": {"key": "port", "type": "int"}, + "protocol": {"key": "protocol", "type": "str"}, + "description": {"key": "description", "type": "str"}, } def __init__( @@ -1462,25 +1403,25 @@ def __init__( :keyword description: Description of the detail. :paramtype description: str """ - super(EndpointDetail, self).__init__(**kwargs) + super().__init__(**kwargs) self.ip_address = ip_address self.port = port self.protocol = protocol self.description = description -class ExtendedLocation(msrest.serialization.Model): +class ExtendedLocation(_serialization.Model): """The complex type of the extended location. :ivar name: The name of the extended location. :vartype name: str - :ivar type: The type of the extended location. Known values are: "EdgeZone". + :ivar type: The type of the extended location. "EdgeZone" :vartype type: str or ~azure.mgmt.containerservice.v2022_03_01.models.ExtendedLocationTypes """ _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, } def __init__( @@ -1493,15 +1434,15 @@ def __init__( """ :keyword name: The name of the extended location. :paramtype name: str - :keyword type: The type of the extended location. Known values are: "EdgeZone". + :keyword type: The type of the extended location. "EdgeZone" :paramtype type: str or ~azure.mgmt.containerservice.v2022_03_01.models.ExtendedLocationTypes """ - super(ExtendedLocation, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.type = type -class KubeletConfig(msrest.serialization.Model): +class KubeletConfig(_serialization.Model): # pylint: disable=too-many-instance-attributes """See `AKS custom node configuration `_ for more details. :ivar cpu_manager_policy: The default is 'none'. See `Kubernetes CPU management policies @@ -1541,21 +1482,21 @@ class KubeletConfig(msrest.serialization.Model): """ _validation = { - 'container_log_max_files': {'minimum': 2}, + "container_log_max_files": {"minimum": 2}, } _attribute_map = { - 'cpu_manager_policy': {'key': 'cpuManagerPolicy', 'type': 'str'}, - 'cpu_cfs_quota': {'key': 'cpuCfsQuota', 'type': 'bool'}, - 'cpu_cfs_quota_period': {'key': 'cpuCfsQuotaPeriod', 'type': 'str'}, - 'image_gc_high_threshold': {'key': 'imageGcHighThreshold', 'type': 'int'}, - 'image_gc_low_threshold': {'key': 'imageGcLowThreshold', 'type': 'int'}, - 'topology_manager_policy': {'key': 'topologyManagerPolicy', 'type': 'str'}, - 'allowed_unsafe_sysctls': {'key': 'allowedUnsafeSysctls', 'type': '[str]'}, - 'fail_swap_on': {'key': 'failSwapOn', 'type': 'bool'}, - 'container_log_max_size_mb': {'key': 'containerLogMaxSizeMB', 'type': 'int'}, - 'container_log_max_files': {'key': 'containerLogMaxFiles', 'type': 'int'}, - 'pod_max_pids': {'key': 'podMaxPids', 'type': 'int'}, + "cpu_manager_policy": {"key": "cpuManagerPolicy", "type": "str"}, + "cpu_cfs_quota": {"key": "cpuCfsQuota", "type": "bool"}, + "cpu_cfs_quota_period": {"key": "cpuCfsQuotaPeriod", "type": "str"}, + "image_gc_high_threshold": {"key": "imageGcHighThreshold", "type": "int"}, + "image_gc_low_threshold": {"key": "imageGcLowThreshold", "type": "int"}, + "topology_manager_policy": {"key": "topologyManagerPolicy", "type": "str"}, + "allowed_unsafe_sysctls": {"key": "allowedUnsafeSysctls", "type": "[str]"}, + "fail_swap_on": {"key": "failSwapOn", "type": "bool"}, + "container_log_max_size_mb": {"key": "containerLogMaxSizeMB", "type": "int"}, + "container_log_max_files": {"key": "containerLogMaxFiles", "type": "int"}, + "pod_max_pids": {"key": "podMaxPids", "type": "int"}, } def __init__( @@ -1610,7 +1551,7 @@ def __init__( :keyword pod_max_pids: The maximum number of processes per pod. :paramtype pod_max_pids: int """ - super(KubeletConfig, self).__init__(**kwargs) + super().__init__(**kwargs) self.cpu_manager_policy = cpu_manager_policy self.cpu_cfs_quota = cpu_cfs_quota self.cpu_cfs_quota_period = cpu_cfs_quota_period @@ -1624,7 +1565,7 @@ def __init__( self.pod_max_pids = pod_max_pids -class LinuxOSConfig(msrest.serialization.Model): +class LinuxOSConfig(_serialization.Model): """See `AKS custom node configuration `_ for more details. :ivar sysctls: Sysctl settings for Linux agent nodes. @@ -1643,10 +1584,10 @@ class LinuxOSConfig(msrest.serialization.Model): """ _attribute_map = { - 'sysctls': {'key': 'sysctls', 'type': 'SysctlConfig'}, - 'transparent_huge_page_enabled': {'key': 'transparentHugePageEnabled', 'type': 'str'}, - 'transparent_huge_page_defrag': {'key': 'transparentHugePageDefrag', 'type': 'str'}, - 'swap_file_size_mb': {'key': 'swapFileSizeMB', 'type': 'int'}, + "sysctls": {"key": "sysctls", "type": "SysctlConfig"}, + "transparent_huge_page_enabled": {"key": "transparentHugePageEnabled", "type": "str"}, + "transparent_huge_page_defrag": {"key": "transparentHugePageDefrag", "type": "str"}, + "swap_file_size_mb": {"key": "swapFileSizeMB", "type": "int"}, } def __init__( @@ -1673,7 +1614,7 @@ def __init__( :keyword swap_file_size_mb: The size in MB of a swap file that will be created on each node. :paramtype swap_file_size_mb: int """ - super(LinuxOSConfig, self).__init__(**kwargs) + super().__init__(**kwargs) self.sysctls = sysctls self.transparent_huge_page_enabled = transparent_huge_page_enabled self.transparent_huge_page_defrag = transparent_huge_page_defrag @@ -1702,19 +1643,19 @@ class MaintenanceConfiguration(SubResource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, + "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'}, - 'time_in_week': {'key': 'properties.timeInWeek', 'type': '[TimeInWeek]'}, - 'not_allowed_time': {'key': 'properties.notAllowedTime', 'type': '[TimeSpan]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "time_in_week": {"key": "properties.timeInWeek", "type": "[TimeInWeek]"}, + "not_allowed_time": {"key": "properties.notAllowedTime", "type": "[TimeSpan]"}, } def __init__( @@ -1731,13 +1672,13 @@ def __init__( :keyword not_allowed_time: Time slots on which upgrade is not allowed. :paramtype not_allowed_time: list[~azure.mgmt.containerservice.v2022_03_01.models.TimeSpan] """ - super(MaintenanceConfiguration, self).__init__(**kwargs) + super().__init__(**kwargs) self.system_data = None self.time_in_week = time_in_week self.not_allowed_time = not_allowed_time -class MaintenanceConfigurationListResult(msrest.serialization.Model): +class MaintenanceConfigurationListResult(_serialization.Model): """The response from the List maintenance configurations operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -1749,31 +1690,26 @@ class MaintenanceConfigurationListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[MaintenanceConfiguration]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[MaintenanceConfiguration]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.MaintenanceConfiguration"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.MaintenanceConfiguration"]] = None, **kwargs): """ :keyword value: The list of maintenance configurations. :paramtype value: list[~azure.mgmt.containerservice.v2022_03_01.models.MaintenanceConfiguration] """ - super(MaintenanceConfigurationListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class Resource(msrest.serialization.Model): +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. @@ -1792,26 +1728,22 @@ class Resource(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, + "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'}, + "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 - ): - """ - """ - super(Resource, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -1836,48 +1768,42 @@ class TrackedResource(Resource): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.containerservice.v2022_03_01.models.SystemData - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] - :ivar location: Required. The geo-location where the resource lives. + :ivar location: The geo-location where the resource lives. Required. :vartype location: str """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'location': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, } - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] - :keyword location: Required. The geo-location where the resource lives. + :keyword location: The geo-location where the resource lives. Required. :paramtype location: str """ - super(TrackedResource, self).__init__(**kwargs) + super().__init__(**kwargs) self.tags = tags self.location = location -class ManagedCluster(TrackedResource): +class ManagedCluster(TrackedResource): # pylint: disable=too-many-instance-attributes """Managed cluster. Variables are only populated by the server, and will be ignored when sending a request. @@ -1895,9 +1821,9 @@ class ManagedCluster(TrackedResource): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.containerservice.v2022_03_01.models.SystemData - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] - :ivar location: Required. The geo-location where the resource lives. + :ivar location: The geo-location where the resource lives. Required. :vartype location: str :ivar sku: The managed cluster SKU. :vartype sku: ~azure.mgmt.containerservice.v2022_03_01.models.ManagedClusterSKU @@ -1993,68 +1919,77 @@ class ManagedCluster(TrackedResource): :vartype security_profile: ~azure.mgmt.containerservice.v2022_03_01.models.ManagedClusterSecurityProfile :ivar public_network_access: Allow or deny public network access for AKS. Known values are: - "Enabled", "Disabled". + "Enabled" and "Disabled". :vartype public_network_access: str or ~azure.mgmt.containerservice.v2022_03_01.models.PublicNetworkAccess """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'location': {'required': True}, - 'provisioning_state': {'readonly': True}, - 'power_state': {'readonly': True}, - 'max_agent_pools': {'readonly': True}, - 'fqdn': {'readonly': True}, - 'private_fqdn': {'readonly': True}, - 'azure_portal_fqdn': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, + "provisioning_state": {"readonly": True}, + "power_state": {"readonly": True}, + "max_agent_pools": {"readonly": True}, + "fqdn": {"readonly": True}, + "private_fqdn": {"readonly": True}, + "azure_portal_fqdn": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'ManagedClusterSKU'}, - 'extended_location': {'key': 'extendedLocation', 'type': 'ExtendedLocation'}, - 'identity': {'key': 'identity', 'type': 'ManagedClusterIdentity'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'power_state': {'key': 'properties.powerState', 'type': 'PowerState'}, - 'max_agent_pools': {'key': 'properties.maxAgentPools', 'type': 'int'}, - 'kubernetes_version': {'key': 'properties.kubernetesVersion', 'type': 'str'}, - 'dns_prefix': {'key': 'properties.dnsPrefix', 'type': 'str'}, - 'fqdn_subdomain': {'key': 'properties.fqdnSubdomain', 'type': 'str'}, - 'fqdn': {'key': 'properties.fqdn', 'type': 'str'}, - 'private_fqdn': {'key': 'properties.privateFQDN', 'type': 'str'}, - 'azure_portal_fqdn': {'key': 'properties.azurePortalFQDN', 'type': 'str'}, - 'agent_pool_profiles': {'key': 'properties.agentPoolProfiles', 'type': '[ManagedClusterAgentPoolProfile]'}, - 'linux_profile': {'key': 'properties.linuxProfile', 'type': 'ContainerServiceLinuxProfile'}, - 'windows_profile': {'key': 'properties.windowsProfile', 'type': 'ManagedClusterWindowsProfile'}, - 'service_principal_profile': {'key': 'properties.servicePrincipalProfile', 'type': 'ManagedClusterServicePrincipalProfile'}, - 'addon_profiles': {'key': 'properties.addonProfiles', 'type': '{ManagedClusterAddonProfile}'}, - 'pod_identity_profile': {'key': 'properties.podIdentityProfile', 'type': 'ManagedClusterPodIdentityProfile'}, - 'node_resource_group': {'key': 'properties.nodeResourceGroup', 'type': 'str'}, - 'enable_rbac': {'key': 'properties.enableRBAC', 'type': 'bool'}, - 'enable_pod_security_policy': {'key': 'properties.enablePodSecurityPolicy', 'type': 'bool'}, - 'network_profile': {'key': 'properties.networkProfile', 'type': 'ContainerServiceNetworkProfile'}, - 'aad_profile': {'key': 'properties.aadProfile', 'type': 'ManagedClusterAADProfile'}, - 'auto_upgrade_profile': {'key': 'properties.autoUpgradeProfile', 'type': 'ManagedClusterAutoUpgradeProfile'}, - 'auto_scaler_profile': {'key': 'properties.autoScalerProfile', 'type': 'ManagedClusterPropertiesAutoScalerProfile'}, - 'api_server_access_profile': {'key': 'properties.apiServerAccessProfile', 'type': 'ManagedClusterAPIServerAccessProfile'}, - 'disk_encryption_set_id': {'key': 'properties.diskEncryptionSetID', 'type': 'str'}, - 'identity_profile': {'key': 'properties.identityProfile', 'type': '{UserAssignedIdentity}'}, - 'private_link_resources': {'key': 'properties.privateLinkResources', 'type': '[PrivateLinkResource]'}, - 'disable_local_accounts': {'key': 'properties.disableLocalAccounts', 'type': 'bool'}, - 'http_proxy_config': {'key': 'properties.httpProxyConfig', 'type': 'ManagedClusterHTTPProxyConfig'}, - 'security_profile': {'key': 'properties.securityProfile', 'type': 'ManagedClusterSecurityProfile'}, - 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, - } - - def __init__( + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "sku": {"key": "sku", "type": "ManagedClusterSKU"}, + "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, + "identity": {"key": "identity", "type": "ManagedClusterIdentity"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "power_state": {"key": "properties.powerState", "type": "PowerState"}, + "max_agent_pools": {"key": "properties.maxAgentPools", "type": "int"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "dns_prefix": {"key": "properties.dnsPrefix", "type": "str"}, + "fqdn_subdomain": {"key": "properties.fqdnSubdomain", "type": "str"}, + "fqdn": {"key": "properties.fqdn", "type": "str"}, + "private_fqdn": {"key": "properties.privateFQDN", "type": "str"}, + "azure_portal_fqdn": {"key": "properties.azurePortalFQDN", "type": "str"}, + "agent_pool_profiles": {"key": "properties.agentPoolProfiles", "type": "[ManagedClusterAgentPoolProfile]"}, + "linux_profile": {"key": "properties.linuxProfile", "type": "ContainerServiceLinuxProfile"}, + "windows_profile": {"key": "properties.windowsProfile", "type": "ManagedClusterWindowsProfile"}, + "service_principal_profile": { + "key": "properties.servicePrincipalProfile", + "type": "ManagedClusterServicePrincipalProfile", + }, + "addon_profiles": {"key": "properties.addonProfiles", "type": "{ManagedClusterAddonProfile}"}, + "pod_identity_profile": {"key": "properties.podIdentityProfile", "type": "ManagedClusterPodIdentityProfile"}, + "node_resource_group": {"key": "properties.nodeResourceGroup", "type": "str"}, + "enable_rbac": {"key": "properties.enableRBAC", "type": "bool"}, + "enable_pod_security_policy": {"key": "properties.enablePodSecurityPolicy", "type": "bool"}, + "network_profile": {"key": "properties.networkProfile", "type": "ContainerServiceNetworkProfile"}, + "aad_profile": {"key": "properties.aadProfile", "type": "ManagedClusterAADProfile"}, + "auto_upgrade_profile": {"key": "properties.autoUpgradeProfile", "type": "ManagedClusterAutoUpgradeProfile"}, + "auto_scaler_profile": { + "key": "properties.autoScalerProfile", + "type": "ManagedClusterPropertiesAutoScalerProfile", + }, + "api_server_access_profile": { + "key": "properties.apiServerAccessProfile", + "type": "ManagedClusterAPIServerAccessProfile", + }, + "disk_encryption_set_id": {"key": "properties.diskEncryptionSetID", "type": "str"}, + "identity_profile": {"key": "properties.identityProfile", "type": "{UserAssignedIdentity}"}, + "private_link_resources": {"key": "properties.privateLinkResources", "type": "[PrivateLinkResource]"}, + "disable_local_accounts": {"key": "properties.disableLocalAccounts", "type": "bool"}, + "http_proxy_config": {"key": "properties.httpProxyConfig", "type": "ManagedClusterHTTPProxyConfig"}, + "security_profile": {"key": "properties.securityProfile", "type": "ManagedClusterSecurityProfile"}, + "public_network_access": {"key": "properties.publicNetworkAccess", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, location: str, @@ -2089,9 +2024,9 @@ def __init__( **kwargs ): """ - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] - :keyword location: Required. The geo-location where the resource lives. + :keyword location: The geo-location where the resource lives. Required. :paramtype location: str :keyword sku: The managed cluster SKU. :paramtype sku: ~azure.mgmt.containerservice.v2022_03_01.models.ManagedClusterSKU @@ -2175,11 +2110,11 @@ def __init__( :paramtype security_profile: ~azure.mgmt.containerservice.v2022_03_01.models.ManagedClusterSecurityProfile :keyword public_network_access: Allow or deny public network access for AKS. Known values are: - "Enabled", "Disabled". + "Enabled" and "Disabled". :paramtype public_network_access: str or ~azure.mgmt.containerservice.v2022_03_01.models.PublicNetworkAccess """ - super(ManagedCluster, self).__init__(tags=tags, location=location, **kwargs) + super().__init__(tags=tags, location=location, **kwargs) self.sku = sku self.extended_location = extended_location self.identity = identity @@ -2215,7 +2150,7 @@ def __init__( self.public_network_access = public_network_access -class ManagedClusterAADProfile(msrest.serialization.Model): +class ManagedClusterAADProfile(_serialization.Model): """For more details see `managed AAD on AKS `_. :ivar managed: Whether to enable managed AAD. @@ -2237,13 +2172,13 @@ class ManagedClusterAADProfile(msrest.serialization.Model): """ _attribute_map = { - 'managed': {'key': 'managed', 'type': 'bool'}, - 'enable_azure_rbac': {'key': 'enableAzureRBAC', 'type': 'bool'}, - 'admin_group_object_i_ds': {'key': 'adminGroupObjectIDs', 'type': '[str]'}, - 'client_app_id': {'key': 'clientAppID', 'type': 'str'}, - 'server_app_id': {'key': 'serverAppID', 'type': 'str'}, - 'server_app_secret': {'key': 'serverAppSecret', 'type': 'str'}, - 'tenant_id': {'key': 'tenantID', 'type': 'str'}, + "managed": {"key": "managed", "type": "bool"}, + "enable_azure_rbac": {"key": "enableAzureRBAC", "type": "bool"}, + "admin_group_object_i_ds": {"key": "adminGroupObjectIDs", "type": "[str]"}, + "client_app_id": {"key": "clientAppID", "type": "str"}, + "server_app_id": {"key": "serverAppID", "type": "str"}, + "server_app_secret": {"key": "serverAppSecret", "type": "str"}, + "tenant_id": {"key": "tenantID", "type": "str"}, } def __init__( @@ -2276,7 +2211,7 @@ def __init__( tenant of the deployment subscription. :paramtype tenant_id: str """ - super(ManagedClusterAADProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.managed = managed self.enable_azure_rbac = enable_azure_rbac self.admin_group_object_i_ds = admin_group_object_i_ds @@ -2304,60 +2239,55 @@ class ManagedClusterAccessProfile(TrackedResource): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.containerservice.v2022_03_01.models.SystemData - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] - :ivar location: Required. The geo-location where the resource lives. + :ivar location: The geo-location where the resource lives. Required. :vartype location: str :ivar kube_config: Base64-encoded Kubernetes configuration file. - :vartype kube_config: bytearray + :vartype kube_config: bytes """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'location': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - 'kube_config': {'key': 'properties.kubeConfig', 'type': 'bytearray'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "kube_config": {"key": "properties.kubeConfig", "type": "bytearray"}, } def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - kube_config: Optional[bytearray] = None, - **kwargs + self, *, location: str, tags: Optional[Dict[str, str]] = None, kube_config: Optional[bytes] = None, **kwargs ): """ - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] - :keyword location: Required. The geo-location where the resource lives. + :keyword location: The geo-location where the resource lives. Required. :paramtype location: str :keyword kube_config: Base64-encoded Kubernetes configuration file. - :paramtype kube_config: bytearray + :paramtype kube_config: bytes """ - super(ManagedClusterAccessProfile, self).__init__(tags=tags, location=location, **kwargs) + super().__init__(tags=tags, location=location, **kwargs) self.kube_config = kube_config -class ManagedClusterAddonProfile(msrest.serialization.Model): +class ManagedClusterAddonProfile(_serialization.Model): """A Kubernetes add-on profile for a managed cluster. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar enabled: Required. Whether the add-on is enabled or not. + :ivar enabled: Whether the add-on is enabled or not. Required. :vartype enabled: bool :ivar config: Key-value pairs for configuring an add-on. :vartype config: dict[str, str] @@ -2367,36 +2297,30 @@ class ManagedClusterAddonProfile(msrest.serialization.Model): """ _validation = { - 'enabled': {'required': True}, - 'identity': {'readonly': True}, + "enabled": {"required": True}, + "identity": {"readonly": True}, } _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'config': {'key': 'config', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'ManagedClusterAddonProfileIdentity'}, + "enabled": {"key": "enabled", "type": "bool"}, + "config": {"key": "config", "type": "{str}"}, + "identity": {"key": "identity", "type": "ManagedClusterAddonProfileIdentity"}, } - def __init__( - self, - *, - enabled: bool, - config: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, enabled: bool, config: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword enabled: Required. Whether the add-on is enabled or not. + :keyword enabled: Whether the add-on is enabled or not. Required. :paramtype enabled: bool :keyword config: Key-value pairs for configuring an add-on. :paramtype config: dict[str, str] """ - super(ManagedClusterAddonProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.config = config self.identity = None -class UserAssignedIdentity(msrest.serialization.Model): +class UserAssignedIdentity(_serialization.Model): """Details about a user assigned identity. :ivar resource_id: The resource ID of the user assigned identity. @@ -2408,9 +2332,9 @@ class UserAssignedIdentity(msrest.serialization.Model): """ _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'object_id': {'key': 'objectId', 'type': 'str'}, + "resource_id": {"key": "resourceId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + "object_id": {"key": "objectId", "type": "str"}, } def __init__( @@ -2429,7 +2353,7 @@ def __init__( :keyword object_id: The object ID of the user assigned identity. :paramtype object_id: str """ - super(UserAssignedIdentity, self).__init__(**kwargs) + super().__init__(**kwargs) self.resource_id = resource_id self.client_id = client_id self.object_id = object_id @@ -2447,9 +2371,9 @@ class ManagedClusterAddonProfileIdentity(UserAssignedIdentity): """ _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'object_id': {'key': 'objectId', 'type': 'str'}, + "resource_id": {"key": "resourceId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + "object_id": {"key": "objectId", "type": "str"}, } def __init__( @@ -2468,10 +2392,10 @@ def __init__( :keyword object_id: The object ID of the user assigned identity. :paramtype object_id: str """ - super(ManagedClusterAddonProfileIdentity, self).__init__(resource_id=resource_id, client_id=client_id, object_id=object_id, **kwargs) + super().__init__(resource_id=resource_id, client_id=client_id, object_id=object_id, **kwargs) -class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): +class ManagedClusterAgentPoolProfileProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes """Properties for the container service agent pool profile. Variables are only populated by the server, and will be ignored when sending a request. @@ -2492,14 +2416,14 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2022_03_01.models.OSDiskType :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data - root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_03_01.models.KubeletDiskType :ivar workload_runtime: Determines the type of workload a node can run. Known values are: - "OCIContainer", "WasmWasi". + "OCIContainer" and "WasmWasi". :vartype workload_runtime: str or ~azure.mgmt.containerservice.v2022_03_01.models.WorkloadRuntime :ivar vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and used. @@ -2513,11 +2437,11 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :vartype pod_subnet_id: str :ivar max_pods: The maximum number of pods that can run on a node. :vartype max_pods: int - :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_03_01.models.OSType :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known - values are: "Ubuntu", "CBLMariner". + values are: "Ubuntu" and "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2022_03_01.models.OSSKU :ivar max_count: The maximum number of nodes for auto-scaling. :vartype max_count: int @@ -2526,14 +2450,14 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it - defaults to Delete. Known values are: "Delete", "Deallocate". + defaults to Delete. Known values are: "Delete" and "Deallocate". :vartype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_03_01.models.ScaleDownMode - :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", + :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets" and "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2022_03_01.models.AgentPoolType :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :vartype mode: str or ~azure.mgmt.containerservice.v2022_03_01.models.AgentPoolMode :ivar orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -2568,20 +2492,18 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default - is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + is 'Regular'. Known values are: "Spot" and "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_03_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_03_01.models.ScaleSetEvictionPolicy :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :vartype spot_max_price: float - :ivar tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :ivar tags: The tags to be persisted on the agent pool virtual machine scale set. :vartype tags: dict[str, str] :ivar node_labels: The node labels to be persisted across all nodes in agent pool. :vartype node_labels: dict[str, str] @@ -2605,7 +2527,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): for more details. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_03_01.models.GPUInstanceProfile :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the node pool @@ -2614,54 +2536,54 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): """ _validation = { - 'os_disk_size_gb': {'maximum': 2048, 'minimum': 0}, - 'node_image_version': {'readonly': True}, - 'provisioning_state': {'readonly': True}, + "os_disk_size_gb": {"maximum": 2048, "minimum": 0}, + "node_image_version": {"readonly": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'os_disk_type': {'key': 'osDiskType', 'type': 'str'}, - 'kubelet_disk_type': {'key': 'kubeletDiskType', 'type': 'str'}, - 'workload_runtime': {'key': 'workloadRuntime', 'type': 'str'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'pod_subnet_id': {'key': 'podSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'maxPods', 'type': 'int'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'os_sku': {'key': 'osSKU', 'type': 'str'}, - 'max_count': {'key': 'maxCount', 'type': 'int'}, - 'min_count': {'key': 'minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'enableAutoScaling', 'type': 'bool'}, - 'scale_down_mode': {'key': 'scaleDownMode', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'mode': {'key': 'mode', 'type': 'str'}, - 'orchestrator_version': {'key': 'orchestratorVersion', 'type': 'str'}, - 'node_image_version': {'key': 'nodeImageVersion', 'type': 'str'}, - 'upgrade_settings': {'key': 'upgradeSettings', 'type': 'AgentPoolUpgradeSettings'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'power_state': {'key': 'powerState', 'type': 'PowerState'}, - 'availability_zones': {'key': 'availabilityZones', 'type': '[str]'}, - 'enable_node_public_ip': {'key': 'enableNodePublicIP', 'type': 'bool'}, - 'node_public_ip_prefix_id': {'key': 'nodePublicIPPrefixID', 'type': 'str'}, - 'scale_set_priority': {'key': 'scaleSetPriority', 'type': 'str'}, - 'scale_set_eviction_policy': {'key': 'scaleSetEvictionPolicy', 'type': 'str'}, - 'spot_max_price': {'key': 'spotMaxPrice', 'type': 'float'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'node_labels': {'key': 'nodeLabels', 'type': '{str}'}, - 'node_taints': {'key': 'nodeTaints', 'type': '[str]'}, - 'proximity_placement_group_id': {'key': 'proximityPlacementGroupID', 'type': 'str'}, - 'kubelet_config': {'key': 'kubeletConfig', 'type': 'KubeletConfig'}, - 'linux_os_config': {'key': 'linuxOSConfig', 'type': 'LinuxOSConfig'}, - 'enable_encryption_at_host': {'key': 'enableEncryptionAtHost', 'type': 'bool'}, - 'enable_ultra_ssd': {'key': 'enableUltraSSD', 'type': 'bool'}, - 'enable_fips': {'key': 'enableFIPS', 'type': 'bool'}, - 'gpu_instance_profile': {'key': 'gpuInstanceProfile', 'type': 'str'}, - 'creation_data': {'key': 'creationData', 'type': 'CreationData'}, - } - - def __init__( + "count": {"key": "count", "type": "int"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "os_disk_type": {"key": "osDiskType", "type": "str"}, + "kubelet_disk_type": {"key": "kubeletDiskType", "type": "str"}, + "workload_runtime": {"key": "workloadRuntime", "type": "str"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "pod_subnet_id": {"key": "podSubnetID", "type": "str"}, + "max_pods": {"key": "maxPods", "type": "int"}, + "os_type": {"key": "osType", "type": "str"}, + "os_sku": {"key": "osSKU", "type": "str"}, + "max_count": {"key": "maxCount", "type": "int"}, + "min_count": {"key": "minCount", "type": "int"}, + "enable_auto_scaling": {"key": "enableAutoScaling", "type": "bool"}, + "scale_down_mode": {"key": "scaleDownMode", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "mode": {"key": "mode", "type": "str"}, + "orchestrator_version": {"key": "orchestratorVersion", "type": "str"}, + "node_image_version": {"key": "nodeImageVersion", "type": "str"}, + "upgrade_settings": {"key": "upgradeSettings", "type": "AgentPoolUpgradeSettings"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "power_state": {"key": "powerState", "type": "PowerState"}, + "availability_zones": {"key": "availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "enableNodePublicIP", "type": "bool"}, + "node_public_ip_prefix_id": {"key": "nodePublicIPPrefixID", "type": "str"}, + "scale_set_priority": {"key": "scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "scaleSetEvictionPolicy", "type": "str"}, + "spot_max_price": {"key": "spotMaxPrice", "type": "float"}, + "tags": {"key": "tags", "type": "{str}"}, + "node_labels": {"key": "nodeLabels", "type": "{str}"}, + "node_taints": {"key": "nodeTaints", "type": "[str]"}, + "proximity_placement_group_id": {"key": "proximityPlacementGroupID", "type": "str"}, + "kubelet_config": {"key": "kubeletConfig", "type": "KubeletConfig"}, + "linux_os_config": {"key": "linuxOSConfig", "type": "LinuxOSConfig"}, + "enable_encryption_at_host": {"key": "enableEncryptionAtHost", "type": "bool"}, + "enable_ultra_ssd": {"key": "enableUltraSSD", "type": "bool"}, + "enable_fips": {"key": "enableFIPS", "type": "bool"}, + "gpu_instance_profile": {"key": "gpuInstanceProfile", "type": "str"}, + "creation_data": {"key": "creationData", "type": "CreationData"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, count: Optional[int] = None, @@ -2673,7 +2595,7 @@ def __init__( vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, @@ -2687,9 +2609,9 @@ def __init__( availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", - spot_max_price: Optional[float] = -1, + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", + spot_max_price: float = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, @@ -2720,14 +2642,14 @@ def __init__( larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2022_03_01.models.OSDiskType :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime - data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + data root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_03_01.models.KubeletDiskType :keyword workload_runtime: Determines the type of workload a node can run. Known values are: - "OCIContainer", "WasmWasi". + "OCIContainer" and "WasmWasi". :paramtype workload_runtime: str or ~azure.mgmt.containerservice.v2022_03_01.models.WorkloadRuntime :keyword vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and @@ -2741,11 +2663,11 @@ def __init__( :paramtype pod_subnet_id: str :keyword max_pods: The maximum number of pods that can run on a node. :paramtype max_pods: int - :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_03_01.models.OSType :keyword os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Known values are: "Ubuntu", "CBLMariner". + Known values are: "Ubuntu" and "CBLMariner". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2022_03_01.models.OSSKU :keyword max_count: The maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -2754,15 +2676,15 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, - it defaults to Delete. Known values are: "Delete", "Deallocate". + it defaults to Delete. Known values are: "Delete" and "Deallocate". :paramtype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_03_01.models.ScaleDownMode - :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", + :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2022_03_01.models.AgentPoolType :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2022_03_01.models.AgentPoolMode :keyword orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -2793,20 +2715,18 @@ def __init__( /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the - default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + default is 'Regular'. Known values are: "Spot" and "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_03_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_03_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :paramtype spot_max_price: float - :keyword tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :keyword tags: The tags to be persisted on the agent pool virtual machine scale set. :paramtype tags: dict[str, str] :keyword node_labels: The node labels to be persisted across all nodes in agent pool. :paramtype node_labels: dict[str, str] @@ -2830,7 +2750,7 @@ def __init__( for more details. :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance - profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_03_01.models.GPUInstanceProfile @@ -2838,7 +2758,7 @@ def __init__( pool will be created/upgraded using a snapshot. :paramtype creation_data: ~azure.mgmt.containerservice.v2022_03_01.models.CreationData """ - super(ManagedClusterAgentPoolProfileProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.vm_size = vm_size self.os_disk_size_gb = os_disk_size_gb @@ -2880,7 +2800,9 @@ def __init__( self.creation_data = creation_data -class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): +class ManagedClusterAgentPoolProfile( + ManagedClusterAgentPoolProfileProperties +): # pylint: disable=too-many-instance-attributes """Profile for the container service agent pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -2903,14 +2825,14 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2022_03_01.models.OSDiskType :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data - root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_03_01.models.KubeletDiskType :ivar workload_runtime: Determines the type of workload a node can run. Known values are: - "OCIContainer", "WasmWasi". + "OCIContainer" and "WasmWasi". :vartype workload_runtime: str or ~azure.mgmt.containerservice.v2022_03_01.models.WorkloadRuntime :ivar vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and used. @@ -2924,11 +2846,11 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :vartype pod_subnet_id: str :ivar max_pods: The maximum number of pods that can run on a node. :vartype max_pods: int - :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_03_01.models.OSType :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known - values are: "Ubuntu", "CBLMariner". + values are: "Ubuntu" and "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2022_03_01.models.OSSKU :ivar max_count: The maximum number of nodes for auto-scaling. :vartype max_count: int @@ -2937,14 +2859,14 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it - defaults to Delete. Known values are: "Delete", "Deallocate". + defaults to Delete. Known values are: "Delete" and "Deallocate". :vartype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_03_01.models.ScaleDownMode - :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", + :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets" and "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2022_03_01.models.AgentPoolType :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :vartype mode: str or ~azure.mgmt.containerservice.v2022_03_01.models.AgentPoolMode :ivar orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -2979,20 +2901,18 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default - is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + is 'Regular'. Known values are: "Spot" and "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_03_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_03_01.models.ScaleSetEvictionPolicy :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :vartype spot_max_price: float - :ivar tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :ivar tags: The tags to be persisted on the agent pool virtual machine scale set. :vartype tags: dict[str, str] :ivar node_labels: The node labels to be persisted across all nodes in agent pool. :vartype node_labels: dict[str, str] @@ -3016,67 +2936,67 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): for more details. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_03_01.models.GPUInstanceProfile :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the node pool will be created/upgraded using a snapshot. :vartype creation_data: ~azure.mgmt.containerservice.v2022_03_01.models.CreationData - :ivar name: Required. Windows agent pool names must be 6 characters or less. + :ivar name: Windows agent pool names must be 6 characters or less. Required. :vartype name: str """ _validation = { - 'os_disk_size_gb': {'maximum': 2048, 'minimum': 0}, - 'node_image_version': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'name': {'required': True, 'pattern': r'^[a-z][a-z0-9]{0,11}$'}, + "os_disk_size_gb": {"maximum": 2048, "minimum": 0}, + "node_image_version": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "name": {"required": True, "pattern": r"^[a-z][a-z0-9]{0,11}$"}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'os_disk_type': {'key': 'osDiskType', 'type': 'str'}, - 'kubelet_disk_type': {'key': 'kubeletDiskType', 'type': 'str'}, - 'workload_runtime': {'key': 'workloadRuntime', 'type': 'str'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'pod_subnet_id': {'key': 'podSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'maxPods', 'type': 'int'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'os_sku': {'key': 'osSKU', 'type': 'str'}, - 'max_count': {'key': 'maxCount', 'type': 'int'}, - 'min_count': {'key': 'minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'enableAutoScaling', 'type': 'bool'}, - 'scale_down_mode': {'key': 'scaleDownMode', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'mode': {'key': 'mode', 'type': 'str'}, - 'orchestrator_version': {'key': 'orchestratorVersion', 'type': 'str'}, - 'node_image_version': {'key': 'nodeImageVersion', 'type': 'str'}, - 'upgrade_settings': {'key': 'upgradeSettings', 'type': 'AgentPoolUpgradeSettings'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'power_state': {'key': 'powerState', 'type': 'PowerState'}, - 'availability_zones': {'key': 'availabilityZones', 'type': '[str]'}, - 'enable_node_public_ip': {'key': 'enableNodePublicIP', 'type': 'bool'}, - 'node_public_ip_prefix_id': {'key': 'nodePublicIPPrefixID', 'type': 'str'}, - 'scale_set_priority': {'key': 'scaleSetPriority', 'type': 'str'}, - 'scale_set_eviction_policy': {'key': 'scaleSetEvictionPolicy', 'type': 'str'}, - 'spot_max_price': {'key': 'spotMaxPrice', 'type': 'float'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'node_labels': {'key': 'nodeLabels', 'type': '{str}'}, - 'node_taints': {'key': 'nodeTaints', 'type': '[str]'}, - 'proximity_placement_group_id': {'key': 'proximityPlacementGroupID', 'type': 'str'}, - 'kubelet_config': {'key': 'kubeletConfig', 'type': 'KubeletConfig'}, - 'linux_os_config': {'key': 'linuxOSConfig', 'type': 'LinuxOSConfig'}, - 'enable_encryption_at_host': {'key': 'enableEncryptionAtHost', 'type': 'bool'}, - 'enable_ultra_ssd': {'key': 'enableUltraSSD', 'type': 'bool'}, - 'enable_fips': {'key': 'enableFIPS', 'type': 'bool'}, - 'gpu_instance_profile': {'key': 'gpuInstanceProfile', 'type': 'str'}, - 'creation_data': {'key': 'creationData', 'type': 'CreationData'}, - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( + "count": {"key": "count", "type": "int"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "os_disk_type": {"key": "osDiskType", "type": "str"}, + "kubelet_disk_type": {"key": "kubeletDiskType", "type": "str"}, + "workload_runtime": {"key": "workloadRuntime", "type": "str"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "pod_subnet_id": {"key": "podSubnetID", "type": "str"}, + "max_pods": {"key": "maxPods", "type": "int"}, + "os_type": {"key": "osType", "type": "str"}, + "os_sku": {"key": "osSKU", "type": "str"}, + "max_count": {"key": "maxCount", "type": "int"}, + "min_count": {"key": "minCount", "type": "int"}, + "enable_auto_scaling": {"key": "enableAutoScaling", "type": "bool"}, + "scale_down_mode": {"key": "scaleDownMode", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "mode": {"key": "mode", "type": "str"}, + "orchestrator_version": {"key": "orchestratorVersion", "type": "str"}, + "node_image_version": {"key": "nodeImageVersion", "type": "str"}, + "upgrade_settings": {"key": "upgradeSettings", "type": "AgentPoolUpgradeSettings"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "power_state": {"key": "powerState", "type": "PowerState"}, + "availability_zones": {"key": "availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "enableNodePublicIP", "type": "bool"}, + "node_public_ip_prefix_id": {"key": "nodePublicIPPrefixID", "type": "str"}, + "scale_set_priority": {"key": "scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "scaleSetEvictionPolicy", "type": "str"}, + "spot_max_price": {"key": "spotMaxPrice", "type": "float"}, + "tags": {"key": "tags", "type": "{str}"}, + "node_labels": {"key": "nodeLabels", "type": "{str}"}, + "node_taints": {"key": "nodeTaints", "type": "[str]"}, + "proximity_placement_group_id": {"key": "proximityPlacementGroupID", "type": "str"}, + "kubelet_config": {"key": "kubeletConfig", "type": "KubeletConfig"}, + "linux_os_config": {"key": "linuxOSConfig", "type": "LinuxOSConfig"}, + "enable_encryption_at_host": {"key": "enableEncryptionAtHost", "type": "bool"}, + "enable_ultra_ssd": {"key": "enableUltraSSD", "type": "bool"}, + "enable_fips": {"key": "enableFIPS", "type": "bool"}, + "gpu_instance_profile": {"key": "gpuInstanceProfile", "type": "str"}, + "creation_data": {"key": "creationData", "type": "CreationData"}, + "name": {"key": "name", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, name: str, @@ -3089,7 +3009,7 @@ def __init__( vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, @@ -3103,9 +3023,9 @@ def __init__( availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", - spot_max_price: Optional[float] = -1, + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", + spot_max_price: float = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, @@ -3136,14 +3056,14 @@ def __init__( larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2022_03_01.models.OSDiskType :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime - data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + data root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_03_01.models.KubeletDiskType :keyword workload_runtime: Determines the type of workload a node can run. Known values are: - "OCIContainer", "WasmWasi". + "OCIContainer" and "WasmWasi". :paramtype workload_runtime: str or ~azure.mgmt.containerservice.v2022_03_01.models.WorkloadRuntime :keyword vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and @@ -3157,11 +3077,11 @@ def __init__( :paramtype pod_subnet_id: str :keyword max_pods: The maximum number of pods that can run on a node. :paramtype max_pods: int - :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_03_01.models.OSType :keyword os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Known values are: "Ubuntu", "CBLMariner". + Known values are: "Ubuntu" and "CBLMariner". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2022_03_01.models.OSSKU :keyword max_count: The maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -3170,15 +3090,15 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, - it defaults to Delete. Known values are: "Delete", "Deallocate". + it defaults to Delete. Known values are: "Delete" and "Deallocate". :paramtype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_03_01.models.ScaleDownMode - :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", + :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2022_03_01.models.AgentPoolType :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2022_03_01.models.AgentPoolMode :keyword orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -3209,20 +3129,18 @@ def __init__( /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the - default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + default is 'Regular'. Known values are: "Spot" and "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_03_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_03_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :paramtype spot_max_price: float - :keyword tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :keyword tags: The tags to be persisted on the agent pool virtual machine scale set. :paramtype tags: dict[str, str] :keyword node_labels: The node labels to be persisted across all nodes in agent pool. :paramtype node_labels: dict[str, str] @@ -3246,21 +3164,60 @@ def __init__( for more details. :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance - profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_03_01.models.GPUInstanceProfile :keyword creation_data: CreationData to be used to specify the source Snapshot ID if the node pool will be created/upgraded using a snapshot. :paramtype creation_data: ~azure.mgmt.containerservice.v2022_03_01.models.CreationData - :keyword name: Required. Windows agent pool names must be 6 characters or less. + :keyword name: Windows agent pool names must be 6 characters or less. Required. :paramtype name: str """ - super(ManagedClusterAgentPoolProfile, self).__init__(count=count, vm_size=vm_size, os_disk_size_gb=os_disk_size_gb, os_disk_type=os_disk_type, kubelet_disk_type=kubelet_disk_type, workload_runtime=workload_runtime, vnet_subnet_id=vnet_subnet_id, pod_subnet_id=pod_subnet_id, max_pods=max_pods, os_type=os_type, os_sku=os_sku, max_count=max_count, min_count=min_count, enable_auto_scaling=enable_auto_scaling, scale_down_mode=scale_down_mode, type=type, mode=mode, orchestrator_version=orchestrator_version, upgrade_settings=upgrade_settings, power_state=power_state, availability_zones=availability_zones, enable_node_public_ip=enable_node_public_ip, node_public_ip_prefix_id=node_public_ip_prefix_id, scale_set_priority=scale_set_priority, scale_set_eviction_policy=scale_set_eviction_policy, spot_max_price=spot_max_price, tags=tags, node_labels=node_labels, node_taints=node_taints, proximity_placement_group_id=proximity_placement_group_id, kubelet_config=kubelet_config, linux_os_config=linux_os_config, enable_encryption_at_host=enable_encryption_at_host, enable_ultra_ssd=enable_ultra_ssd, enable_fips=enable_fips, gpu_instance_profile=gpu_instance_profile, creation_data=creation_data, **kwargs) + super().__init__( + count=count, + vm_size=vm_size, + os_disk_size_gb=os_disk_size_gb, + os_disk_type=os_disk_type, + kubelet_disk_type=kubelet_disk_type, + workload_runtime=workload_runtime, + vnet_subnet_id=vnet_subnet_id, + pod_subnet_id=pod_subnet_id, + max_pods=max_pods, + os_type=os_type, + os_sku=os_sku, + max_count=max_count, + min_count=min_count, + enable_auto_scaling=enable_auto_scaling, + scale_down_mode=scale_down_mode, + type=type, + mode=mode, + orchestrator_version=orchestrator_version, + upgrade_settings=upgrade_settings, + power_state=power_state, + availability_zones=availability_zones, + enable_node_public_ip=enable_node_public_ip, + node_public_ip_prefix_id=node_public_ip_prefix_id, + scale_set_priority=scale_set_priority, + scale_set_eviction_policy=scale_set_eviction_policy, + spot_max_price=spot_max_price, + tags=tags, + node_labels=node_labels, + node_taints=node_taints, + proximity_placement_group_id=proximity_placement_group_id, + kubelet_config=kubelet_config, + linux_os_config=linux_os_config, + enable_encryption_at_host=enable_encryption_at_host, + enable_ultra_ssd=enable_ultra_ssd, + enable_fips=enable_fips, + gpu_instance_profile=gpu_instance_profile, + creation_data=creation_data, + **kwargs + ) self.name = name -class ManagedClusterAPIServerAccessProfile(msrest.serialization.Model): +class ManagedClusterAPIServerAccessProfile(_serialization.Model): """Access profile for managed cluster API server. :ivar authorized_ip_ranges: IP ranges are specified in CIDR format, e.g. 137.117.106.88/29. @@ -3283,11 +3240,11 @@ class ManagedClusterAPIServerAccessProfile(msrest.serialization.Model): """ _attribute_map = { - 'authorized_ip_ranges': {'key': 'authorizedIPRanges', 'type': '[str]'}, - 'enable_private_cluster': {'key': 'enablePrivateCluster', 'type': 'bool'}, - 'private_dns_zone': {'key': 'privateDNSZone', 'type': 'str'}, - 'enable_private_cluster_public_fqdn': {'key': 'enablePrivateClusterPublicFQDN', 'type': 'bool'}, - 'disable_run_command': {'key': 'disableRunCommand', 'type': 'bool'}, + "authorized_ip_ranges": {"key": "authorizedIPRanges", "type": "[str]"}, + "enable_private_cluster": {"key": "enablePrivateCluster", "type": "bool"}, + "private_dns_zone": {"key": "privateDNSZone", "type": "str"}, + "enable_private_cluster_public_fqdn": {"key": "enablePrivateClusterPublicFQDN", "type": "bool"}, + "disable_run_command": {"key": "disableRunCommand", "type": "bool"}, } def __init__( @@ -3319,7 +3276,7 @@ def __init__( :keyword disable_run_command: Whether to disable run command for the cluster or not. :paramtype disable_run_command: bool """ - super(ManagedClusterAPIServerAccessProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.authorized_ip_ranges = authorized_ip_ranges self.enable_private_cluster = enable_private_cluster self.private_dns_zone = private_dns_zone @@ -3327,37 +3284,32 @@ def __init__( self.disable_run_command = disable_run_command -class ManagedClusterAutoUpgradeProfile(msrest.serialization.Model): +class ManagedClusterAutoUpgradeProfile(_serialization.Model): """Auto upgrade profile for a managed cluster. :ivar upgrade_channel: For more information see `setting the AKS cluster auto-upgrade channel `_. Known values - are: "rapid", "stable", "patch", "node-image", "none". + are: "rapid", "stable", "patch", "node-image", and "none". :vartype upgrade_channel: str or ~azure.mgmt.containerservice.v2022_03_01.models.UpgradeChannel """ _attribute_map = { - 'upgrade_channel': {'key': 'upgradeChannel', 'type': 'str'}, + "upgrade_channel": {"key": "upgradeChannel", "type": "str"}, } - def __init__( - self, - *, - upgrade_channel: Optional[Union[str, "_models.UpgradeChannel"]] = None, - **kwargs - ): + def __init__(self, *, upgrade_channel: Optional[Union[str, "_models.UpgradeChannel"]] = None, **kwargs): """ :keyword upgrade_channel: For more information see `setting the AKS cluster auto-upgrade channel `_. - Known values are: "rapid", "stable", "patch", "node-image", "none". + Known values are: "rapid", "stable", "patch", "node-image", and "none". :paramtype upgrade_channel: str or ~azure.mgmt.containerservice.v2022_03_01.models.UpgradeChannel """ - super(ManagedClusterAutoUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.upgrade_channel = upgrade_channel -class ManagedClusterHTTPProxyConfig(msrest.serialization.Model): +class ManagedClusterHTTPProxyConfig(_serialization.Model): """Cluster HTTP proxy configuration. :ivar http_proxy: The HTTP proxy server endpoint to use. @@ -3371,10 +3323,10 @@ class ManagedClusterHTTPProxyConfig(msrest.serialization.Model): """ _attribute_map = { - 'http_proxy': {'key': 'httpProxy', 'type': 'str'}, - 'https_proxy': {'key': 'httpsProxy', 'type': 'str'}, - 'no_proxy': {'key': 'noProxy', 'type': '[str]'}, - 'trusted_ca': {'key': 'trustedCa', 'type': 'str'}, + "http_proxy": {"key": "httpProxy", "type": "str"}, + "https_proxy": {"key": "httpsProxy", "type": "str"}, + "no_proxy": {"key": "noProxy", "type": "[str]"}, + "trusted_ca": {"key": "trustedCa", "type": "str"}, } def __init__( @@ -3396,14 +3348,14 @@ def __init__( :keyword trusted_ca: Alternative CA cert to use for connecting to proxy servers. :paramtype trusted_ca: str """ - super(ManagedClusterHTTPProxyConfig, self).__init__(**kwargs) + super().__init__(**kwargs) self.http_proxy = http_proxy self.https_proxy = https_proxy self.no_proxy = no_proxy self.trusted_ca = trusted_ca -class ManagedClusterIdentity(msrest.serialization.Model): +class ManagedClusterIdentity(_serialization.Model): """Identity for the managed cluster. Variables are only populated by the server, and will be ignored when sending a request. @@ -3416,7 +3368,7 @@ class ManagedClusterIdentity(msrest.serialization.Model): :vartype tenant_id: str :ivar type: For more information see `use managed identities in AKS `_. Known values are: - "SystemAssigned", "UserAssigned", "None". + "SystemAssigned", "UserAssigned", and "None". :vartype type: str or ~azure.mgmt.containerservice.v2022_03_01.models.ResourceIdentityType :ivar user_assigned_identities: The keys must be ARM resource IDs in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. @@ -3425,42 +3377,47 @@ class ManagedClusterIdentity(msrest.serialization.Model): """ _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, + "principal_id": {"readonly": True}, + "tenant_id": {"readonly": True}, } _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{ManagedServiceIdentityUserAssignedIdentitiesValue}'}, + "principal_id": {"key": "principalId", "type": "str"}, + "tenant_id": {"key": "tenantId", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "user_assigned_identities": { + "key": "userAssignedIdentities", + "type": "{ManagedServiceIdentityUserAssignedIdentitiesValue}", + }, } def __init__( self, *, type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, - user_assigned_identities: Optional[Dict[str, "_models.ManagedServiceIdentityUserAssignedIdentitiesValue"]] = None, + user_assigned_identities: Optional[ + Dict[str, "_models.ManagedServiceIdentityUserAssignedIdentitiesValue"] + ] = None, **kwargs ): """ :keyword type: For more information see `use managed identities in AKS `_. Known values are: - "SystemAssigned", "UserAssigned", "None". + "SystemAssigned", "UserAssigned", and "None". :paramtype type: str or ~azure.mgmt.containerservice.v2022_03_01.models.ResourceIdentityType :keyword user_assigned_identities: The keys must be ARM resource IDs in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. :paramtype user_assigned_identities: dict[str, ~azure.mgmt.containerservice.v2022_03_01.models.ManagedServiceIdentityUserAssignedIdentitiesValue] """ - super(ManagedClusterIdentity, self).__init__(**kwargs) + super().__init__(**kwargs) self.principal_id = None self.tenant_id = None self.type = type self.user_assigned_identities = user_assigned_identities -class ManagedClusterListResult(msrest.serialization.Model): +class ManagedClusterListResult(_serialization.Model): """The response from the List Managed Clusters operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -3472,30 +3429,25 @@ class ManagedClusterListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[ManagedCluster]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[ManagedCluster]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.ManagedCluster"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.ManagedCluster"]] = None, **kwargs): """ :keyword value: The list of managed clusters. :paramtype value: list[~azure.mgmt.containerservice.v2022_03_01.models.ManagedCluster] """ - super(ManagedClusterListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class ManagedClusterLoadBalancerProfile(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfile(_serialization.Model): """Profile of the managed cluster load balancer. :ivar managed_outbound_i_ps: Desired managed outbound IPs for the cluster load balancer. @@ -3524,18 +3476,24 @@ class ManagedClusterLoadBalancerProfile(msrest.serialization.Model): """ _validation = { - 'allocated_outbound_ports': {'maximum': 64000, 'minimum': 0}, - 'idle_timeout_in_minutes': {'maximum': 120, 'minimum': 4}, + "allocated_outbound_ports": {"maximum": 64000, "minimum": 0}, + "idle_timeout_in_minutes": {"maximum": 120, "minimum": 4}, } _attribute_map = { - 'managed_outbound_i_ps': {'key': 'managedOutboundIPs', 'type': 'ManagedClusterLoadBalancerProfileManagedOutboundIPs'}, - 'outbound_ip_prefixes': {'key': 'outboundIPPrefixes', 'type': 'ManagedClusterLoadBalancerProfileOutboundIPPrefixes'}, - 'outbound_i_ps': {'key': 'outboundIPs', 'type': 'ManagedClusterLoadBalancerProfileOutboundIPs'}, - 'effective_outbound_i_ps': {'key': 'effectiveOutboundIPs', 'type': '[ResourceReference]'}, - 'allocated_outbound_ports': {'key': 'allocatedOutboundPorts', 'type': 'int'}, - 'idle_timeout_in_minutes': {'key': 'idleTimeoutInMinutes', 'type': 'int'}, - 'enable_multiple_standard_load_balancers': {'key': 'enableMultipleStandardLoadBalancers', 'type': 'bool'}, + "managed_outbound_i_ps": { + "key": "managedOutboundIPs", + "type": "ManagedClusterLoadBalancerProfileManagedOutboundIPs", + }, + "outbound_ip_prefixes": { + "key": "outboundIPPrefixes", + "type": "ManagedClusterLoadBalancerProfileOutboundIPPrefixes", + }, + "outbound_i_ps": {"key": "outboundIPs", "type": "ManagedClusterLoadBalancerProfileOutboundIPs"}, + "effective_outbound_i_ps": {"key": "effectiveOutboundIPs", "type": "[ResourceReference]"}, + "allocated_outbound_ports": {"key": "allocatedOutboundPorts", "type": "int"}, + "idle_timeout_in_minutes": {"key": "idleTimeoutInMinutes", "type": "int"}, + "enable_multiple_standard_load_balancers": {"key": "enableMultipleStandardLoadBalancers", "type": "bool"}, } def __init__( @@ -3545,8 +3503,8 @@ def __init__( outbound_ip_prefixes: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPPrefixes"] = None, outbound_i_ps: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPs"] = None, effective_outbound_i_ps: Optional[List["_models.ResourceReference"]] = None, - allocated_outbound_ports: Optional[int] = 0, - idle_timeout_in_minutes: Optional[int] = 30, + allocated_outbound_ports: int = 0, + idle_timeout_in_minutes: int = 30, enable_multiple_standard_load_balancers: Optional[bool] = None, **kwargs ): @@ -3576,7 +3534,7 @@ def __init__( AKS cluster or not. :paramtype enable_multiple_standard_load_balancers: bool """ - super(ManagedClusterLoadBalancerProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.managed_outbound_i_ps = managed_outbound_i_ps self.outbound_ip_prefixes = outbound_ip_prefixes self.outbound_i_ps = outbound_i_ps @@ -3586,7 +3544,7 @@ def __init__( self.enable_multiple_standard_load_balancers = enable_multiple_standard_load_balancers -class ManagedClusterLoadBalancerProfileManagedOutboundIPs(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfileManagedOutboundIPs(_serialization.Model): """Desired managed outbound IPs for the cluster load balancer. :ivar count: The desired number of IPv4 outbound IPs created/managed by Azure for the cluster @@ -3600,22 +3558,16 @@ class ManagedClusterLoadBalancerProfileManagedOutboundIPs(msrest.serialization.M """ _validation = { - 'count': {'maximum': 100, 'minimum': 1}, - 'count_ipv6': {'maximum': 100, 'minimum': 0}, + "count": {"maximum": 100, "minimum": 1}, + "count_ipv6": {"maximum": 100, "minimum": 0}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'count_ipv6': {'key': 'countIPv6', 'type': 'int'}, + "count": {"key": "count", "type": "int"}, + "count_ipv6": {"key": "countIPv6", "type": "int"}, } - def __init__( - self, - *, - count: Optional[int] = 1, - count_ipv6: Optional[int] = 0, - **kwargs - ): + def __init__(self, *, count: int = 1, count_ipv6: int = 0, **kwargs): """ :keyword count: The desired number of IPv4 outbound IPs created/managed by Azure for the cluster load balancer. Allowed values must be in the range of 1 to 100 (inclusive). The default @@ -3626,12 +3578,12 @@ def __init__( value is 0 for single-stack and 1 for dual-stack. :paramtype count_ipv6: int """ - super(ManagedClusterLoadBalancerProfileManagedOutboundIPs, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.count_ipv6 = count_ipv6 -class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(_serialization.Model): """Desired outbound IP Prefix resources for the cluster load balancer. :ivar public_ip_prefixes: A list of public IP prefix resources. @@ -3640,25 +3592,20 @@ class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(msrest.serialization.M """ _attribute_map = { - 'public_ip_prefixes': {'key': 'publicIPPrefixes', 'type': '[ResourceReference]'}, + "public_ip_prefixes": {"key": "publicIPPrefixes", "type": "[ResourceReference]"}, } - def __init__( - self, - *, - public_ip_prefixes: Optional[List["_models.ResourceReference"]] = None, - **kwargs - ): + def __init__(self, *, public_ip_prefixes: Optional[List["_models.ResourceReference"]] = None, **kwargs): """ :keyword public_ip_prefixes: A list of public IP prefix resources. :paramtype public_ip_prefixes: list[~azure.mgmt.containerservice.v2022_03_01.models.ResourceReference] """ - super(ManagedClusterLoadBalancerProfileOutboundIPPrefixes, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_ip_prefixes = public_ip_prefixes -class ManagedClusterLoadBalancerProfileOutboundIPs(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfileOutboundIPs(_serialization.Model): """Desired outbound IP resources for the cluster load balancer. :ivar public_i_ps: A list of public IP resources. @@ -3666,24 +3613,19 @@ class ManagedClusterLoadBalancerProfileOutboundIPs(msrest.serialization.Model): """ _attribute_map = { - 'public_i_ps': {'key': 'publicIPs', 'type': '[ResourceReference]'}, + "public_i_ps": {"key": "publicIPs", "type": "[ResourceReference]"}, } - def __init__( - self, - *, - public_i_ps: Optional[List["_models.ResourceReference"]] = None, - **kwargs - ): + def __init__(self, *, public_i_ps: Optional[List["_models.ResourceReference"]] = None, **kwargs): """ :keyword public_i_ps: A list of public IP resources. :paramtype public_i_ps: list[~azure.mgmt.containerservice.v2022_03_01.models.ResourceReference] """ - super(ManagedClusterLoadBalancerProfileOutboundIPs, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_i_ps = public_i_ps -class ManagedClusterManagedOutboundIPProfile(msrest.serialization.Model): +class ManagedClusterManagedOutboundIPProfile(_serialization.Model): """Profile of the managed outbound IP resources of the managed cluster. :ivar count: The desired number of outbound IPs created/managed by Azure. Allowed values must @@ -3692,29 +3634,24 @@ class ManagedClusterManagedOutboundIPProfile(msrest.serialization.Model): """ _validation = { - 'count': {'maximum': 16, 'minimum': 1}, + "count": {"maximum": 16, "minimum": 1}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, + "count": {"key": "count", "type": "int"}, } - def __init__( - self, - *, - count: Optional[int] = 1, - **kwargs - ): + def __init__(self, *, count: int = 1, **kwargs): """ :keyword count: The desired number of outbound IPs created/managed by Azure. Allowed values must be in the range of 1 to 16 (inclusive). The default value is 1. :paramtype count: int """ - super(ManagedClusterManagedOutboundIPProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count -class ManagedClusterNATGatewayProfile(msrest.serialization.Model): +class ManagedClusterNATGatewayProfile(_serialization.Model): """Profile of the managed cluster NAT gateway. :ivar managed_outbound_ip_profile: Profile of the managed outbound IP resources of the cluster @@ -3730,13 +3667,16 @@ class ManagedClusterNATGatewayProfile(msrest.serialization.Model): """ _validation = { - 'idle_timeout_in_minutes': {'maximum': 120, 'minimum': 4}, + "idle_timeout_in_minutes": {"maximum": 120, "minimum": 4}, } _attribute_map = { - 'managed_outbound_ip_profile': {'key': 'managedOutboundIPProfile', 'type': 'ManagedClusterManagedOutboundIPProfile'}, - 'effective_outbound_i_ps': {'key': 'effectiveOutboundIPs', 'type': '[ResourceReference]'}, - 'idle_timeout_in_minutes': {'key': 'idleTimeoutInMinutes', 'type': 'int'}, + "managed_outbound_ip_profile": { + "key": "managedOutboundIPProfile", + "type": "ManagedClusterManagedOutboundIPProfile", + }, + "effective_outbound_i_ps": {"key": "effectiveOutboundIPs", "type": "[ResourceReference]"}, + "idle_timeout_in_minutes": {"key": "idleTimeoutInMinutes", "type": "int"}, } def __init__( @@ -3744,7 +3684,7 @@ def __init__( *, managed_outbound_ip_profile: Optional["_models.ManagedClusterManagedOutboundIPProfile"] = None, effective_outbound_i_ps: Optional[List["_models.ResourceReference"]] = None, - idle_timeout_in_minutes: Optional[int] = 4, + idle_timeout_in_minutes: int = 4, **kwargs ): """ @@ -3760,29 +3700,29 @@ def __init__( are in the range of 4 to 120 (inclusive). The default value is 4 minutes. :paramtype idle_timeout_in_minutes: int """ - super(ManagedClusterNATGatewayProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.managed_outbound_ip_profile = managed_outbound_ip_profile self.effective_outbound_i_ps = effective_outbound_i_ps self.idle_timeout_in_minutes = idle_timeout_in_minutes -class ManagedClusterPodIdentity(msrest.serialization.Model): +class ManagedClusterPodIdentity(_serialization.Model): """Details about the pod identity assigned to the Managed Cluster. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar name: Required. The name of the pod identity. + :ivar name: The name of the pod identity. Required. :vartype name: str - :ivar namespace: Required. The namespace of the pod identity. + :ivar namespace: The namespace of the pod identity. Required. :vartype namespace: str :ivar binding_selector: The binding selector to use for the AzureIdentityBinding resource. :vartype binding_selector: str - :ivar identity: Required. The user assigned identity details. + :ivar identity: The user assigned identity details. Required. :vartype identity: ~azure.mgmt.containerservice.v2022_03_01.models.UserAssignedIdentity :ivar provisioning_state: The current provisioning state of the pod identity. Known values are: - "Assigned", "Updating", "Deleting", "Failed". + "Assigned", "Updating", "Deleting", and "Failed". :vartype provisioning_state: str or ~azure.mgmt.containerservice.v2022_03_01.models.ManagedClusterPodIdentityProvisioningState :ivar provisioning_info: @@ -3791,20 +3731,20 @@ class ManagedClusterPodIdentity(msrest.serialization.Model): """ _validation = { - 'name': {'required': True}, - 'namespace': {'required': True}, - 'identity': {'required': True}, - 'provisioning_state': {'readonly': True}, - 'provisioning_info': {'readonly': True}, + "name": {"required": True}, + "namespace": {"required": True}, + "identity": {"required": True}, + "provisioning_state": {"readonly": True}, + "provisioning_info": {"readonly": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'namespace': {'key': 'namespace', 'type': 'str'}, - 'binding_selector': {'key': 'bindingSelector', 'type': 'str'}, - 'identity': {'key': 'identity', 'type': 'UserAssignedIdentity'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'provisioning_info': {'key': 'provisioningInfo', 'type': 'ManagedClusterPodIdentityProvisioningInfo'}, + "name": {"key": "name", "type": "str"}, + "namespace": {"key": "namespace", "type": "str"}, + "binding_selector": {"key": "bindingSelector", "type": "str"}, + "identity": {"key": "identity", "type": "UserAssignedIdentity"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "provisioning_info": {"key": "provisioningInfo", "type": "ManagedClusterPodIdentityProvisioningInfo"}, } def __init__( @@ -3817,16 +3757,16 @@ def __init__( **kwargs ): """ - :keyword name: Required. The name of the pod identity. + :keyword name: The name of the pod identity. Required. :paramtype name: str - :keyword namespace: Required. The namespace of the pod identity. + :keyword namespace: The namespace of the pod identity. Required. :paramtype namespace: str :keyword binding_selector: The binding selector to use for the AzureIdentityBinding resource. :paramtype binding_selector: str - :keyword identity: Required. The user assigned identity details. + :keyword identity: The user assigned identity details. Required. :paramtype identity: ~azure.mgmt.containerservice.v2022_03_01.models.UserAssignedIdentity """ - super(ManagedClusterPodIdentity, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.namespace = namespace self.binding_selector = binding_selector @@ -3835,54 +3775,47 @@ def __init__( self.provisioning_info = None -class ManagedClusterPodIdentityException(msrest.serialization.Model): +class ManagedClusterPodIdentityException(_serialization.Model): """See `disable AAD Pod Identity for a specific Pod/Application `_ for more details. All required parameters must be populated in order to send to Azure. - :ivar name: Required. The name of the pod identity exception. + :ivar name: The name of the pod identity exception. Required. :vartype name: str - :ivar namespace: Required. The namespace of the pod identity exception. + :ivar namespace: The namespace of the pod identity exception. Required. :vartype namespace: str - :ivar pod_labels: Required. The pod labels to match. + :ivar pod_labels: The pod labels to match. Required. :vartype pod_labels: dict[str, str] """ _validation = { - 'name': {'required': True}, - 'namespace': {'required': True}, - 'pod_labels': {'required': True}, + "name": {"required": True}, + "namespace": {"required": True}, + "pod_labels": {"required": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'namespace': {'key': 'namespace', 'type': 'str'}, - 'pod_labels': {'key': 'podLabels', 'type': '{str}'}, + "name": {"key": "name", "type": "str"}, + "namespace": {"key": "namespace", "type": "str"}, + "pod_labels": {"key": "podLabels", "type": "{str}"}, } - def __init__( - self, - *, - name: str, - namespace: str, - pod_labels: Dict[str, str], - **kwargs - ): + def __init__(self, *, name: str, namespace: str, pod_labels: Dict[str, str], **kwargs): """ - :keyword name: Required. The name of the pod identity exception. + :keyword name: The name of the pod identity exception. Required. :paramtype name: str - :keyword namespace: Required. The namespace of the pod identity exception. + :keyword namespace: The namespace of the pod identity exception. Required. :paramtype namespace: str - :keyword pod_labels: Required. The pod labels to match. + :keyword pod_labels: The pod labels to match. Required. :paramtype pod_labels: dict[str, str] """ - super(ManagedClusterPodIdentityException, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.namespace = namespace self.pod_labels = pod_labels -class ManagedClusterPodIdentityProfile(msrest.serialization.Model): +class ManagedClusterPodIdentityProfile(_serialization.Model): """See `use AAD pod identity `_ for more details on pod identity integration. :ivar enabled: Whether the pod identity addon is enabled. @@ -3902,10 +3835,13 @@ class ManagedClusterPodIdentityProfile(msrest.serialization.Model): """ _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'allow_network_plugin_kubenet': {'key': 'allowNetworkPluginKubenet', 'type': 'bool'}, - 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '[ManagedClusterPodIdentity]'}, - 'user_assigned_identity_exceptions': {'key': 'userAssignedIdentityExceptions', 'type': '[ManagedClusterPodIdentityException]'}, + "enabled": {"key": "enabled", "type": "bool"}, + "allow_network_plugin_kubenet": {"key": "allowNetworkPluginKubenet", "type": "bool"}, + "user_assigned_identities": {"key": "userAssignedIdentities", "type": "[ManagedClusterPodIdentity]"}, + "user_assigned_identity_exceptions": { + "key": "userAssignedIdentityExceptions", + "type": "[ManagedClusterPodIdentityException]", + }, } def __init__( @@ -3933,14 +3869,14 @@ def __init__( :paramtype user_assigned_identity_exceptions: list[~azure.mgmt.containerservice.v2022_03_01.models.ManagedClusterPodIdentityException] """ - super(ManagedClusterPodIdentityProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.allow_network_plugin_kubenet = allow_network_plugin_kubenet self.user_assigned_identities = user_assigned_identities self.user_assigned_identity_exceptions = user_assigned_identity_exceptions -class ManagedClusterPodIdentityProvisioningError(msrest.serialization.Model): +class ManagedClusterPodIdentityProvisioningError(_serialization.Model): """An error response from the pod identity provisioning. :ivar error: Details about the error. @@ -3949,25 +3885,20 @@ class ManagedClusterPodIdentityProvisioningError(msrest.serialization.Model): """ _attribute_map = { - 'error': {'key': 'error', 'type': 'ManagedClusterPodIdentityProvisioningErrorBody'}, + "error": {"key": "error", "type": "ManagedClusterPodIdentityProvisioningErrorBody"}, } - def __init__( - self, - *, - error: Optional["_models.ManagedClusterPodIdentityProvisioningErrorBody"] = None, - **kwargs - ): + def __init__(self, *, error: Optional["_models.ManagedClusterPodIdentityProvisioningErrorBody"] = None, **kwargs): """ :keyword error: Details about the error. :paramtype error: ~azure.mgmt.containerservice.v2022_03_01.models.ManagedClusterPodIdentityProvisioningErrorBody """ - super(ManagedClusterPodIdentityProvisioningError, self).__init__(**kwargs) + super().__init__(**kwargs) self.error = error -class ManagedClusterPodIdentityProvisioningErrorBody(msrest.serialization.Model): +class ManagedClusterPodIdentityProvisioningErrorBody(_serialization.Model): """An error response from the pod identity provisioning. :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed @@ -3985,10 +3916,10 @@ class ManagedClusterPodIdentityProvisioningErrorBody(msrest.serialization.Model) """ _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[ManagedClusterPodIdentityProvisioningErrorBody]'}, + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[ManagedClusterPodIdentityProvisioningErrorBody]"}, } def __init__( @@ -4014,14 +3945,14 @@ def __init__( :paramtype details: list[~azure.mgmt.containerservice.v2022_03_01.models.ManagedClusterPodIdentityProvisioningErrorBody] """ - super(ManagedClusterPodIdentityProvisioningErrorBody, self).__init__(**kwargs) + super().__init__(**kwargs) self.code = code self.message = message self.target = target self.details = details -class ManagedClusterPodIdentityProvisioningInfo(msrest.serialization.Model): +class ManagedClusterPodIdentityProvisioningInfo(_serialization.Model): """ManagedClusterPodIdentityProvisioningInfo. :ivar error: Pod identity assignment error (if any). @@ -4030,35 +3961,30 @@ class ManagedClusterPodIdentityProvisioningInfo(msrest.serialization.Model): """ _attribute_map = { - 'error': {'key': 'error', 'type': 'ManagedClusterPodIdentityProvisioningError'}, + "error": {"key": "error", "type": "ManagedClusterPodIdentityProvisioningError"}, } - def __init__( - self, - *, - error: Optional["_models.ManagedClusterPodIdentityProvisioningError"] = None, - **kwargs - ): + def __init__(self, *, error: Optional["_models.ManagedClusterPodIdentityProvisioningError"] = None, **kwargs): """ :keyword error: Pod identity assignment error (if any). :paramtype error: ~azure.mgmt.containerservice.v2022_03_01.models.ManagedClusterPodIdentityProvisioningError """ - super(ManagedClusterPodIdentityProvisioningInfo, self).__init__(**kwargs) + super().__init__(**kwargs) self.error = error -class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): +class ManagedClusterPoolUpgradeProfile(_serialization.Model): """The list of available upgrade versions. All required parameters must be populated in order to send to Azure. - :ivar kubernetes_version: Required. The Kubernetes version (major.minor.patch). + :ivar kubernetes_version: The Kubernetes version (major.minor.patch). Required. :vartype kubernetes_version: str :ivar name: The Agent Pool name. :vartype name: str - :ivar os_type: Required. The operating system type. The default is Linux. Known values are: - "Linux", "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_03_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -4066,15 +3992,15 @@ class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): """ _validation = { - 'kubernetes_version': {'required': True}, - 'os_type': {'required': True}, + "kubernetes_version": {"required": True}, + "os_type": {"required": True}, } _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'upgrades': {'key': 'upgrades', 'type': '[ManagedClusterPoolUpgradeProfileUpgradesItem]'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "os_type": {"key": "osType", "type": "str"}, + "upgrades": {"key": "upgrades", "type": "[ManagedClusterPoolUpgradeProfileUpgradesItem]"}, } def __init__( @@ -4087,25 +4013,25 @@ def __init__( **kwargs ): """ - :keyword kubernetes_version: Required. The Kubernetes version (major.minor.patch). + :keyword kubernetes_version: The Kubernetes version (major.minor.patch). Required. :paramtype kubernetes_version: str :keyword name: The Agent Pool name. :paramtype name: str - :keyword os_type: Required. The operating system type. The default is Linux. Known values are: - "Linux", "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_03_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: list[~azure.mgmt.containerservice.v2022_03_01.models.ManagedClusterPoolUpgradeProfileUpgradesItem] """ - super(ManagedClusterPoolUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.name = name self.os_type = os_type self.upgrades = upgrades -class ManagedClusterPoolUpgradeProfileUpgradesItem(msrest.serialization.Model): +class ManagedClusterPoolUpgradeProfileUpgradesItem(_serialization.Model): """ManagedClusterPoolUpgradeProfileUpgradesItem. :ivar kubernetes_version: The Kubernetes version (major.minor.patch). @@ -4115,36 +4041,30 @@ class ManagedClusterPoolUpgradeProfileUpgradesItem(msrest.serialization.Model): """ _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } - def __init__( - self, - *, - kubernetes_version: Optional[str] = None, - is_preview: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, kubernetes_version: Optional[str] = None, is_preview: Optional[bool] = None, **kwargs): """ :keyword kubernetes_version: The Kubernetes version (major.minor.patch). :paramtype kubernetes_version: str :keyword is_preview: Whether the Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(ManagedClusterPoolUpgradeProfileUpgradesItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.is_preview = is_preview -class ManagedClusterPropertiesAutoScalerProfile(msrest.serialization.Model): +class ManagedClusterPropertiesAutoScalerProfile(_serialization.Model): # pylint: disable=too-many-instance-attributes """Parameters to be applied to the cluster-autoscaler when enabled. :ivar balance_similar_node_groups: Valid values are 'true' and 'false'. :vartype balance_similar_node_groups: str :ivar expander: If not specified, the default is 'random'. See `expanders `_ - for more information. Known values are: "least-waste", "most-pods", "priority", "random". + for more information. Known values are: "least-waste", "most-pods", "priority", and "random". :vartype expander: str or ~azure.mgmt.containerservice.v2022_03_01.models.Expander :ivar max_empty_bulk_delete: The default is 10. :vartype max_empty_bulk_delete: str @@ -4188,23 +4108,23 @@ class ManagedClusterPropertiesAutoScalerProfile(msrest.serialization.Model): """ _attribute_map = { - 'balance_similar_node_groups': {'key': 'balance-similar-node-groups', 'type': 'str'}, - 'expander': {'key': 'expander', 'type': 'str'}, - 'max_empty_bulk_delete': {'key': 'max-empty-bulk-delete', 'type': 'str'}, - 'max_graceful_termination_sec': {'key': 'max-graceful-termination-sec', 'type': 'str'}, - 'max_node_provision_time': {'key': 'max-node-provision-time', 'type': 'str'}, - 'max_total_unready_percentage': {'key': 'max-total-unready-percentage', 'type': 'str'}, - 'new_pod_scale_up_delay': {'key': 'new-pod-scale-up-delay', 'type': 'str'}, - 'ok_total_unready_count': {'key': 'ok-total-unready-count', 'type': 'str'}, - 'scan_interval': {'key': 'scan-interval', 'type': 'str'}, - 'scale_down_delay_after_add': {'key': 'scale-down-delay-after-add', 'type': 'str'}, - 'scale_down_delay_after_delete': {'key': 'scale-down-delay-after-delete', 'type': 'str'}, - 'scale_down_delay_after_failure': {'key': 'scale-down-delay-after-failure', 'type': 'str'}, - 'scale_down_unneeded_time': {'key': 'scale-down-unneeded-time', 'type': 'str'}, - 'scale_down_unready_time': {'key': 'scale-down-unready-time', 'type': 'str'}, - 'scale_down_utilization_threshold': {'key': 'scale-down-utilization-threshold', 'type': 'str'}, - 'skip_nodes_with_local_storage': {'key': 'skip-nodes-with-local-storage', 'type': 'str'}, - 'skip_nodes_with_system_pods': {'key': 'skip-nodes-with-system-pods', 'type': 'str'}, + "balance_similar_node_groups": {"key": "balance-similar-node-groups", "type": "str"}, + "expander": {"key": "expander", "type": "str"}, + "max_empty_bulk_delete": {"key": "max-empty-bulk-delete", "type": "str"}, + "max_graceful_termination_sec": {"key": "max-graceful-termination-sec", "type": "str"}, + "max_node_provision_time": {"key": "max-node-provision-time", "type": "str"}, + "max_total_unready_percentage": {"key": "max-total-unready-percentage", "type": "str"}, + "new_pod_scale_up_delay": {"key": "new-pod-scale-up-delay", "type": "str"}, + "ok_total_unready_count": {"key": "ok-total-unready-count", "type": "str"}, + "scan_interval": {"key": "scan-interval", "type": "str"}, + "scale_down_delay_after_add": {"key": "scale-down-delay-after-add", "type": "str"}, + "scale_down_delay_after_delete": {"key": "scale-down-delay-after-delete", "type": "str"}, + "scale_down_delay_after_failure": {"key": "scale-down-delay-after-failure", "type": "str"}, + "scale_down_unneeded_time": {"key": "scale-down-unneeded-time", "type": "str"}, + "scale_down_unready_time": {"key": "scale-down-unready-time", "type": "str"}, + "scale_down_utilization_threshold": {"key": "scale-down-utilization-threshold", "type": "str"}, + "skip_nodes_with_local_storage": {"key": "skip-nodes-with-local-storage", "type": "str"}, + "skip_nodes_with_system_pods": {"key": "skip-nodes-with-system-pods", "type": "str"}, } def __init__( @@ -4234,7 +4154,7 @@ def __init__( :paramtype balance_similar_node_groups: str :keyword expander: If not specified, the default is 'random'. See `expanders `_ - for more information. Known values are: "least-waste", "most-pods", "priority", "random". + for more information. Known values are: "least-waste", "most-pods", "priority", and "random". :paramtype expander: str or ~azure.mgmt.containerservice.v2022_03_01.models.Expander :keyword max_empty_bulk_delete: The default is 10. :paramtype max_empty_bulk_delete: str @@ -4277,7 +4197,7 @@ def __init__( :keyword skip_nodes_with_system_pods: The default is true. :paramtype skip_nodes_with_system_pods: str """ - super(ManagedClusterPropertiesAutoScalerProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.balance_similar_node_groups = balance_similar_node_groups self.expander = expander self.max_empty_bulk_delete = max_empty_bulk_delete @@ -4297,7 +4217,7 @@ def __init__( self.skip_nodes_with_system_pods = skip_nodes_with_system_pods -class ManagedClusterSecurityProfile(msrest.serialization.Model): +class ManagedClusterSecurityProfile(_serialization.Model): """Security profile for the container service cluster. :ivar azure_defender: Azure Defender settings for the security profile. @@ -4306,25 +4226,22 @@ class ManagedClusterSecurityProfile(msrest.serialization.Model): """ _attribute_map = { - 'azure_defender': {'key': 'azureDefender', 'type': 'ManagedClusterSecurityProfileAzureDefender'}, + "azure_defender": {"key": "azureDefender", "type": "ManagedClusterSecurityProfileAzureDefender"}, } def __init__( - self, - *, - azure_defender: Optional["_models.ManagedClusterSecurityProfileAzureDefender"] = None, - **kwargs + self, *, azure_defender: Optional["_models.ManagedClusterSecurityProfileAzureDefender"] = None, **kwargs ): """ :keyword azure_defender: Azure Defender settings for the security profile. :paramtype azure_defender: ~azure.mgmt.containerservice.v2022_03_01.models.ManagedClusterSecurityProfileAzureDefender """ - super(ManagedClusterSecurityProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.azure_defender = azure_defender -class ManagedClusterSecurityProfileAzureDefender(msrest.serialization.Model): +class ManagedClusterSecurityProfileAzureDefender(_serialization.Model): """Azure Defender settings for the security profile. :ivar enabled: Whether to enable Azure Defender. @@ -4336,16 +4253,12 @@ class ManagedClusterSecurityProfileAzureDefender(msrest.serialization.Model): """ _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'log_analytics_workspace_resource_id': {'key': 'logAnalyticsWorkspaceResourceId', 'type': 'str'}, + "enabled": {"key": "enabled", "type": "bool"}, + "log_analytics_workspace_resource_id": {"key": "logAnalyticsWorkspaceResourceId", "type": "str"}, } def __init__( - self, - *, - enabled: Optional[bool] = None, - log_analytics_workspace_resource_id: Optional[str] = None, - **kwargs + self, *, enabled: Optional[bool] = None, log_analytics_workspace_resource_id: Optional[str] = None, **kwargs ): """ :keyword enabled: Whether to enable Azure Defender. @@ -4355,63 +4268,57 @@ def __init__( must be a valid workspace resource ID. When Azure Defender is disabled, leave the field empty. :paramtype log_analytics_workspace_resource_id: str """ - super(ManagedClusterSecurityProfileAzureDefender, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.log_analytics_workspace_resource_id = log_analytics_workspace_resource_id -class ManagedClusterServicePrincipalProfile(msrest.serialization.Model): +class ManagedClusterServicePrincipalProfile(_serialization.Model): """Information about a service principal identity for the cluster to use for manipulating Azure APIs. All required parameters must be populated in order to send to Azure. - :ivar client_id: Required. The ID for the service principal. + :ivar client_id: The ID for the service principal. Required. :vartype client_id: str :ivar secret: The secret password associated with the service principal in plain text. :vartype secret: str """ _validation = { - 'client_id': {'required': True}, + "client_id": {"required": True}, } _attribute_map = { - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'secret': {'key': 'secret', 'type': 'str'}, + "client_id": {"key": "clientId", "type": "str"}, + "secret": {"key": "secret", "type": "str"}, } - def __init__( - self, - *, - client_id: str, - secret: Optional[str] = None, - **kwargs - ): + def __init__(self, *, client_id: str, secret: Optional[str] = None, **kwargs): """ - :keyword client_id: Required. The ID for the service principal. + :keyword client_id: The ID for the service principal. Required. :paramtype client_id: str :keyword secret: The secret password associated with the service principal in plain text. :paramtype secret: str """ - super(ManagedClusterServicePrincipalProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.client_id = client_id self.secret = secret -class ManagedClusterSKU(msrest.serialization.Model): +class ManagedClusterSKU(_serialization.Model): """The SKU of a Managed Cluster. - :ivar name: The name of a managed cluster SKU. Known values are: "Basic". + :ivar name: The name of a managed cluster SKU. "Basic" :vartype name: str or ~azure.mgmt.containerservice.v2022_03_01.models.ManagedClusterSKUName :ivar tier: If not specified, the default is 'Free'. See `uptime SLA - `_ for more details. Known values are: "Paid", - "Free". + `_ for more details. Known values are: "Paid" + and "Free". :vartype tier: str or ~azure.mgmt.containerservice.v2022_03_01.models.ManagedClusterSKUTier """ _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, + "name": {"key": "name", "type": "str"}, + "tier": {"key": "tier", "type": "str"}, } def __init__( @@ -4422,19 +4329,19 @@ def __init__( **kwargs ): """ - :keyword name: The name of a managed cluster SKU. Known values are: "Basic". + :keyword name: The name of a managed cluster SKU. "Basic" :paramtype name: str or ~azure.mgmt.containerservice.v2022_03_01.models.ManagedClusterSKUName :keyword tier: If not specified, the default is 'Free'. See `uptime SLA - `_ for more details. Known values are: "Paid", - "Free". + `_ for more details. Known values are: "Paid" + and "Free". :paramtype tier: str or ~azure.mgmt.containerservice.v2022_03_01.models.ManagedClusterSKUTier """ - super(ManagedClusterSKU, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.tier = tier -class ManagedClusterStorageProfile(msrest.serialization.Model): +class ManagedClusterStorageProfile(_serialization.Model): """Storage profile for the container service cluster. :ivar disk_csi_driver: AzureDisk CSI Driver settings for the storage profile. @@ -4449,9 +4356,9 @@ class ManagedClusterStorageProfile(msrest.serialization.Model): """ _attribute_map = { - 'disk_csi_driver': {'key': 'diskCSIDriver', 'type': 'ManagedClusterStorageProfileDiskCSIDriver'}, - 'file_csi_driver': {'key': 'fileCSIDriver', 'type': 'ManagedClusterStorageProfileFileCSIDriver'}, - 'snapshot_controller': {'key': 'snapshotController', 'type': 'ManagedClusterStorageProfileSnapshotController'}, + "disk_csi_driver": {"key": "diskCSIDriver", "type": "ManagedClusterStorageProfileDiskCSIDriver"}, + "file_csi_driver": {"key": "fileCSIDriver", "type": "ManagedClusterStorageProfileFileCSIDriver"}, + "snapshot_controller": {"key": "snapshotController", "type": "ManagedClusterStorageProfileSnapshotController"}, } def __init__( @@ -4473,13 +4380,13 @@ def __init__( :paramtype snapshot_controller: ~azure.mgmt.containerservice.v2022_03_01.models.ManagedClusterStorageProfileSnapshotController """ - super(ManagedClusterStorageProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.disk_csi_driver = disk_csi_driver self.file_csi_driver = file_csi_driver self.snapshot_controller = snapshot_controller -class ManagedClusterStorageProfileDiskCSIDriver(msrest.serialization.Model): +class ManagedClusterStorageProfileDiskCSIDriver(_serialization.Model): """AzureDisk CSI Driver settings for the storage profile. :ivar enabled: Whether to enable AzureDisk CSI Driver. The default value is true. @@ -4487,24 +4394,19 @@ class ManagedClusterStorageProfileDiskCSIDriver(msrest.serialization.Model): """ _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, + "enabled": {"key": "enabled", "type": "bool"}, } - def __init__( - self, - *, - enabled: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, enabled: Optional[bool] = None, **kwargs): """ :keyword enabled: Whether to enable AzureDisk CSI Driver. The default value is true. :paramtype enabled: bool """ - super(ManagedClusterStorageProfileDiskCSIDriver, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled -class ManagedClusterStorageProfileFileCSIDriver(msrest.serialization.Model): +class ManagedClusterStorageProfileFileCSIDriver(_serialization.Model): """AzureFile CSI Driver settings for the storage profile. :ivar enabled: Whether to enable AzureFile CSI Driver. The default value is true. @@ -4512,24 +4414,19 @@ class ManagedClusterStorageProfileFileCSIDriver(msrest.serialization.Model): """ _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, + "enabled": {"key": "enabled", "type": "bool"}, } - def __init__( - self, - *, - enabled: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, enabled: Optional[bool] = None, **kwargs): """ :keyword enabled: Whether to enable AzureFile CSI Driver. The default value is true. :paramtype enabled: bool """ - super(ManagedClusterStorageProfileFileCSIDriver, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled -class ManagedClusterStorageProfileSnapshotController(msrest.serialization.Model): +class ManagedClusterStorageProfileSnapshotController(_serialization.Model): """Snapshot Controller settings for the storage profile. :ivar enabled: Whether to enable Snapshot Controller. The default value is true. @@ -4537,24 +4434,19 @@ class ManagedClusterStorageProfileSnapshotController(msrest.serialization.Model) """ _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, + "enabled": {"key": "enabled", "type": "bool"}, } - def __init__( - self, - *, - enabled: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, enabled: Optional[bool] = None, **kwargs): """ :keyword enabled: Whether to enable Snapshot Controller. The default value is true. :paramtype enabled: bool """ - super(ManagedClusterStorageProfileSnapshotController, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled -class ManagedClusterUpgradeProfile(msrest.serialization.Model): +class ManagedClusterUpgradeProfile(_serialization.Model): """The list of available upgrades for compute pools. Variables are only populated by the server, and will be ignored when sending a request. @@ -4567,29 +4459,29 @@ class ManagedClusterUpgradeProfile(msrest.serialization.Model): :vartype name: str :ivar type: The type of the upgrade profile. :vartype type: str - :ivar control_plane_profile: Required. The list of available upgrade versions for the control - plane. + :ivar control_plane_profile: The list of available upgrade versions for the control plane. + Required. :vartype control_plane_profile: ~azure.mgmt.containerservice.v2022_03_01.models.ManagedClusterPoolUpgradeProfile - :ivar agent_pool_profiles: Required. The list of available upgrade versions for agent pools. + :ivar agent_pool_profiles: The list of available upgrade versions for agent pools. Required. :vartype agent_pool_profiles: list[~azure.mgmt.containerservice.v2022_03_01.models.ManagedClusterPoolUpgradeProfile] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'control_plane_profile': {'required': True}, - 'agent_pool_profiles': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "control_plane_profile": {"required": True}, + "agent_pool_profiles": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'control_plane_profile': {'key': 'properties.controlPlaneProfile', 'type': 'ManagedClusterPoolUpgradeProfile'}, - 'agent_pool_profiles': {'key': 'properties.agentPoolProfiles', 'type': '[ManagedClusterPoolUpgradeProfile]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "control_plane_profile": {"key": "properties.controlPlaneProfile", "type": "ManagedClusterPoolUpgradeProfile"}, + "agent_pool_profiles": {"key": "properties.agentPoolProfiles", "type": "[ManagedClusterPoolUpgradeProfile]"}, } def __init__( @@ -4600,15 +4492,15 @@ def __init__( **kwargs ): """ - :keyword control_plane_profile: Required. The list of available upgrade versions for the - control plane. + :keyword control_plane_profile: The list of available upgrade versions for the control plane. + Required. :paramtype control_plane_profile: ~azure.mgmt.containerservice.v2022_03_01.models.ManagedClusterPoolUpgradeProfile - :keyword agent_pool_profiles: Required. The list of available upgrade versions for agent pools. + :keyword agent_pool_profiles: The list of available upgrade versions for agent pools. Required. :paramtype agent_pool_profiles: list[~azure.mgmt.containerservice.v2022_03_01.models.ManagedClusterPoolUpgradeProfile] """ - super(ManagedClusterUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -4616,18 +4508,18 @@ def __init__( self.agent_pool_profiles = agent_pool_profiles -class ManagedClusterWindowsProfile(msrest.serialization.Model): +class ManagedClusterWindowsProfile(_serialization.Model): """Profile for Windows VMs in the managed cluster. All required parameters must be populated in order to send to Azure. - :ivar admin_username: Required. Specifies the name of the administrator account. - :code:`
`:code:`
` **Restriction:** Cannot end in "." :code:`
`:code:`
` - **Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", "test1", - "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", - "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", - "sys", "test2", "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 - character :code:`
`:code:`
` **Max-length:** 20 characters. + :ivar admin_username: Specifies the name of the administrator account. :code:`
`:code:`
` + **Restriction:** Cannot end in "." :code:`
`:code:`
` **Disallowed values:** + "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", + "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", + "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", + "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 character + :code:`
`:code:`
` **Max-length:** 20 characters. Required. :vartype admin_username: str :ivar admin_password: Specifies the password of the administrator account. :code:`
`:code:`
` **Minimum-length:** 8 characters :code:`
`:code:`
` @@ -4639,7 +4531,7 @@ class ManagedClusterWindowsProfile(msrest.serialization.Model): :vartype admin_password: str :ivar license_type: The license type to use for Windows VMs. See `Azure Hybrid User Benefits `_ for more details. Known values are: - "None", "Windows_Server". + "None" and "Windows_Server". :vartype license_type: str or ~azure.mgmt.containerservice.v2022_03_01.models.LicenseType :ivar enable_csi_proxy: For more details on CSI proxy, see the `CSI proxy GitHub repo `_. @@ -4649,15 +4541,15 @@ class ManagedClusterWindowsProfile(msrest.serialization.Model): """ _validation = { - 'admin_username': {'required': True}, + "admin_username": {"required": True}, } _attribute_map = { - 'admin_username': {'key': 'adminUsername', 'type': 'str'}, - 'admin_password': {'key': 'adminPassword', 'type': 'str'}, - 'license_type': {'key': 'licenseType', 'type': 'str'}, - 'enable_csi_proxy': {'key': 'enableCSIProxy', 'type': 'bool'}, - 'gmsa_profile': {'key': 'gmsaProfile', 'type': 'WindowsGmsaProfile'}, + "admin_username": {"key": "adminUsername", "type": "str"}, + "admin_password": {"key": "adminPassword", "type": "str"}, + "license_type": {"key": "licenseType", "type": "str"}, + "enable_csi_proxy": {"key": "enableCSIProxy", "type": "bool"}, + "gmsa_profile": {"key": "gmsaProfile", "type": "WindowsGmsaProfile"}, } def __init__( @@ -4671,13 +4563,13 @@ def __init__( **kwargs ): """ - :keyword admin_username: Required. Specifies the name of the administrator account. + :keyword admin_username: Specifies the name of the administrator account. :code:`
`:code:`
` **Restriction:** Cannot end in "." :code:`
`:code:`
` **Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 - character :code:`
`:code:`
` **Max-length:** 20 characters. + character :code:`
`:code:`
` **Max-length:** 20 characters. Required. :paramtype admin_username: str :keyword admin_password: Specifies the password of the administrator account. :code:`
`:code:`
` **Minimum-length:** 8 characters :code:`
`:code:`
` @@ -4689,7 +4581,7 @@ def __init__( :paramtype admin_password: str :keyword license_type: The license type to use for Windows VMs. See `Azure Hybrid User Benefits `_ for more details. Known values are: - "None", "Windows_Server". + "None" and "Windows_Server". :paramtype license_type: str or ~azure.mgmt.containerservice.v2022_03_01.models.LicenseType :keyword enable_csi_proxy: For more details on CSI proxy, see the `CSI proxy GitHub repo `_. @@ -4697,7 +4589,7 @@ def __init__( :keyword gmsa_profile: The Windows gMSA Profile in the Managed Cluster. :paramtype gmsa_profile: ~azure.mgmt.containerservice.v2022_03_01.models.WindowsGmsaProfile """ - super(ManagedClusterWindowsProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.admin_username = admin_username self.admin_password = admin_password self.license_type = license_type @@ -4705,7 +4597,7 @@ def __init__( self.gmsa_profile = gmsa_profile -class ManagedServiceIdentityUserAssignedIdentitiesValue(msrest.serialization.Model): +class ManagedServiceIdentityUserAssignedIdentitiesValue(_serialization.Model): """ManagedServiceIdentityUserAssignedIdentitiesValue. Variables are only populated by the server, and will be ignored when sending a request. @@ -4717,27 +4609,23 @@ class ManagedServiceIdentityUserAssignedIdentitiesValue(msrest.serialization.Mod """ _validation = { - 'principal_id': {'readonly': True}, - 'client_id': {'readonly': True}, + "principal_id": {"readonly": True}, + "client_id": {"readonly": True}, } _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, + "principal_id": {"key": "principalId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(ManagedServiceIdentityUserAssignedIdentitiesValue, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.principal_id = None self.client_id = None -class OperationListResult(msrest.serialization.Model): +class OperationListResult(_serialization.Model): """The List Operation response. Variables are only populated by the server, and will be ignored when sending a request. @@ -4747,24 +4635,20 @@ class OperationListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[OperationValue]'}, + "value": {"key": "value", "type": "[OperationValue]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(OperationListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None -class OperationValue(msrest.serialization.Model): +class OperationValue(_serialization.Model): """Describes the properties of a Operation value. Variables are only populated by the server, and will be ignored when sending a request. @@ -4784,30 +4668,26 @@ class OperationValue(msrest.serialization.Model): """ _validation = { - 'origin': {'readonly': True}, - 'name': {'readonly': True}, - 'operation': {'readonly': True}, - 'resource': {'readonly': True}, - 'description': {'readonly': True}, - 'provider': {'readonly': True}, + "origin": {"readonly": True}, + "name": {"readonly": True}, + "operation": {"readonly": True}, + "resource": {"readonly": True}, + "description": {"readonly": True}, + "provider": {"readonly": True}, } _attribute_map = { - 'origin': {'key': 'origin', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'operation': {'key': 'display.operation', 'type': 'str'}, - 'resource': {'key': 'display.resource', 'type': 'str'}, - 'description': {'key': 'display.description', 'type': 'str'}, - 'provider': {'key': 'display.provider', 'type': 'str'}, + "origin": {"key": "origin", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "operation": {"key": "display.operation", "type": "str"}, + "resource": {"key": "display.resource", "type": "str"}, + "description": {"key": "display.description", "type": "str"}, + "provider": {"key": "display.provider", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(OperationValue, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.origin = None self.name = None self.operation = None @@ -4816,7 +4696,7 @@ def __init__( self.provider = None -class OSOptionProfile(msrest.serialization.Model): +class OSOptionProfile(_serialization.Model): """The OS option profile. Variables are only populated by the server, and will be ignored when sending a request. @@ -4829,83 +4709,72 @@ class OSOptionProfile(msrest.serialization.Model): :vartype name: str :ivar type: The type of the OS option resource. :vartype type: str - :ivar os_option_property_list: Required. The list of OS options. + :ivar os_option_property_list: The list of OS options. Required. :vartype os_option_property_list: list[~azure.mgmt.containerservice.v2022_03_01.models.OSOptionProperty] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'os_option_property_list': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "os_option_property_list": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'os_option_property_list': {'key': 'properties.osOptionPropertyList', 'type': '[OSOptionProperty]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "os_option_property_list": {"key": "properties.osOptionPropertyList", "type": "[OSOptionProperty]"}, } - def __init__( - self, - *, - os_option_property_list: List["_models.OSOptionProperty"], - **kwargs - ): + def __init__(self, *, os_option_property_list: List["_models.OSOptionProperty"], **kwargs): """ - :keyword os_option_property_list: Required. The list of OS options. + :keyword os_option_property_list: The list of OS options. Required. :paramtype os_option_property_list: list[~azure.mgmt.containerservice.v2022_03_01.models.OSOptionProperty] """ - super(OSOptionProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None self.os_option_property_list = os_option_property_list -class OSOptionProperty(msrest.serialization.Model): +class OSOptionProperty(_serialization.Model): """OS option property. All required parameters must be populated in order to send to Azure. - :ivar os_type: Required. The OS type. + :ivar os_type: The OS type. Required. :vartype os_type: str - :ivar enable_fips_image: Required. Whether the image is FIPS-enabled. + :ivar enable_fips_image: Whether the image is FIPS-enabled. Required. :vartype enable_fips_image: bool """ _validation = { - 'os_type': {'required': True}, - 'enable_fips_image': {'required': True}, + "os_type": {"required": True}, + "enable_fips_image": {"required": True}, } _attribute_map = { - 'os_type': {'key': 'os-type', 'type': 'str'}, - 'enable_fips_image': {'key': 'enable-fips-image', 'type': 'bool'}, + "os_type": {"key": "os-type", "type": "str"}, + "enable_fips_image": {"key": "enable-fips-image", "type": "bool"}, } - def __init__( - self, - *, - os_type: str, - enable_fips_image: bool, - **kwargs - ): + def __init__(self, *, os_type: str, enable_fips_image: bool, **kwargs): """ - :keyword os_type: Required. The OS type. + :keyword os_type: The OS type. Required. :paramtype os_type: str - :keyword enable_fips_image: Required. Whether the image is FIPS-enabled. + :keyword enable_fips_image: Whether the image is FIPS-enabled. Required. :paramtype enable_fips_image: bool """ - super(OSOptionProperty, self).__init__(**kwargs) + super().__init__(**kwargs) self.os_type = os_type self.enable_fips_image = enable_fips_image -class OutboundEnvironmentEndpoint(msrest.serialization.Model): +class OutboundEnvironmentEndpoint(_serialization.Model): """Egress endpoints which AKS agent nodes connect to for common purpose. :ivar category: The category of endpoints accessed by the AKS agent node, e.g. @@ -4916,8 +4785,8 @@ class OutboundEnvironmentEndpoint(msrest.serialization.Model): """ _attribute_map = { - 'category': {'key': 'category', 'type': 'str'}, - 'endpoints': {'key': 'endpoints', 'type': '[EndpointDependency]'}, + "category": {"key": "category", "type": "str"}, + "endpoints": {"key": "endpoints", "type": "[EndpointDependency]"}, } def __init__( @@ -4934,19 +4803,19 @@ def __init__( :keyword endpoints: The endpoints that AKS agent nodes connect to. :paramtype endpoints: list[~azure.mgmt.containerservice.v2022_03_01.models.EndpointDependency] """ - super(OutboundEnvironmentEndpoint, self).__init__(**kwargs) + super().__init__(**kwargs) self.category = category self.endpoints = endpoints -class OutboundEnvironmentEndpointCollection(msrest.serialization.Model): +class OutboundEnvironmentEndpointCollection(_serialization.Model): """Collection of OutboundEnvironmentEndpoint. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar value: Required. Collection of resources. + :ivar value: Collection of resources. Required. :vartype value: list[~azure.mgmt.containerservice.v2022_03_01.models.OutboundEnvironmentEndpoint] :ivar next_link: Link to next page of resources. @@ -4954,59 +4823,49 @@ class OutboundEnvironmentEndpointCollection(msrest.serialization.Model): """ _validation = { - 'value': {'required': True}, - 'next_link': {'readonly': True}, + "value": {"required": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[OutboundEnvironmentEndpoint]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[OutboundEnvironmentEndpoint]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: List["_models.OutboundEnvironmentEndpoint"], - **kwargs - ): + def __init__(self, *, value: List["_models.OutboundEnvironmentEndpoint"], **kwargs): """ - :keyword value: Required. Collection of resources. + :keyword value: Collection of resources. Required. :paramtype value: list[~azure.mgmt.containerservice.v2022_03_01.models.OutboundEnvironmentEndpoint] """ - super(OutboundEnvironmentEndpointCollection, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class PowerState(msrest.serialization.Model): +class PowerState(_serialization.Model): """Describes the Power State of the cluster. - :ivar code: Tells whether the cluster is Running or Stopped. Known values are: "Running", + :ivar code: Tells whether the cluster is Running or Stopped. Known values are: "Running" and "Stopped". :vartype code: str or ~azure.mgmt.containerservice.v2022_03_01.models.Code """ _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, + "code": {"key": "code", "type": "str"}, } - def __init__( - self, - *, - code: Optional[Union[str, "_models.Code"]] = None, - **kwargs - ): + def __init__(self, *, code: Optional[Union[str, "_models.Code"]] = None, **kwargs): """ - :keyword code: Tells whether the cluster is Running or Stopped. Known values are: "Running", + :keyword code: Tells whether the cluster is Running or Stopped. Known values are: "Running" and "Stopped". :paramtype code: str or ~azure.mgmt.containerservice.v2022_03_01.models.Code """ - super(PowerState, self).__init__(**kwargs) + super().__init__(**kwargs) self.code = code -class PrivateEndpoint(msrest.serialization.Model): +class PrivateEndpoint(_serialization.Model): """Private endpoint which a connection belongs to. :ivar id: The resource ID of the private endpoint. @@ -5014,24 +4873,19 @@ class PrivateEndpoint(msrest.serialization.Model): """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, } - def __init__( - self, - *, - id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin """ :keyword id: The resource ID of the private endpoint. :paramtype id: str """ - super(PrivateEndpoint, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id -class PrivateEndpointConnection(msrest.serialization.Model): +class PrivateEndpointConnection(_serialization.Model): """A private endpoint connection. Variables are only populated by the server, and will be ignored when sending a request. @@ -5043,7 +4897,7 @@ class PrivateEndpointConnection(msrest.serialization.Model): :ivar type: The resource type. :vartype type: str :ivar provisioning_state: The current provisioning state. Known values are: "Succeeded", - "Creating", "Deleting", "Failed". + "Creating", "Deleting", and "Failed". :vartype provisioning_state: str or ~azure.mgmt.containerservice.v2022_03_01.models.PrivateEndpointConnectionProvisioningState :ivar private_endpoint: The resource of private endpoint. @@ -5055,19 +4909,22 @@ class PrivateEndpointConnection(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'provisioning_state': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, - 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "private_endpoint": {"key": "properties.privateEndpoint", "type": "PrivateEndpoint"}, + "private_link_service_connection_state": { + "key": "properties.privateLinkServiceConnectionState", + "type": "PrivateLinkServiceConnectionState", + }, } def __init__( @@ -5085,7 +4942,7 @@ def __init__( :paramtype private_link_service_connection_state: ~azure.mgmt.containerservice.v2022_03_01.models.PrivateLinkServiceConnectionState """ - super(PrivateEndpointConnection, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -5094,7 +4951,7 @@ def __init__( self.private_link_service_connection_state = private_link_service_connection_state -class PrivateEndpointConnectionListResult(msrest.serialization.Model): +class PrivateEndpointConnectionListResult(_serialization.Model): """A list of private endpoint connections. :ivar value: The collection value. @@ -5102,25 +4959,20 @@ class PrivateEndpointConnectionListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, + "value": {"key": "value", "type": "[PrivateEndpointConnection]"}, } - def __init__( - self, - *, - value: Optional[List["_models.PrivateEndpointConnection"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.PrivateEndpointConnection"]] = None, **kwargs): """ :keyword value: The collection value. :paramtype value: list[~azure.mgmt.containerservice.v2022_03_01.models.PrivateEndpointConnection] """ - super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value -class PrivateLinkResource(msrest.serialization.Model): +class PrivateLinkResource(_serialization.Model): """A private link resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -5141,22 +4993,22 @@ class PrivateLinkResource(msrest.serialization.Model): """ _validation = { - 'private_link_service_id': {'readonly': True}, + "private_link_service_id": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'group_id': {'key': 'groupId', 'type': 'str'}, - 'required_members': {'key': 'requiredMembers', 'type': '[str]'}, - 'private_link_service_id': {'key': 'privateLinkServiceID', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "group_id": {"key": "groupId", "type": "str"}, + "required_members": {"key": "requiredMembers", "type": "[str]"}, + "private_link_service_id": {"key": "privateLinkServiceID", "type": "str"}, } def __init__( self, *, - id: Optional[str] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin name: Optional[str] = None, type: Optional[str] = None, group_id: Optional[str] = None, @@ -5175,7 +5027,7 @@ def __init__( :keyword required_members: The RequiredMembers of the resource. :paramtype required_members: list[str] """ - super(PrivateLinkResource, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id self.name = name self.type = type @@ -5184,7 +5036,7 @@ def __init__( self.private_link_service_id = None -class PrivateLinkResourcesListResult(msrest.serialization.Model): +class PrivateLinkResourcesListResult(_serialization.Model): """A list of private link resources. :ivar value: The collection value. @@ -5192,36 +5044,31 @@ class PrivateLinkResourcesListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, + "value": {"key": "value", "type": "[PrivateLinkResource]"}, } - def __init__( - self, - *, - value: Optional[List["_models.PrivateLinkResource"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.PrivateLinkResource"]] = None, **kwargs): """ :keyword value: The collection value. :paramtype value: list[~azure.mgmt.containerservice.v2022_03_01.models.PrivateLinkResource] """ - super(PrivateLinkResourcesListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value -class PrivateLinkServiceConnectionState(msrest.serialization.Model): +class PrivateLinkServiceConnectionState(_serialization.Model): """The state of a private link service connection. :ivar status: The private link service connection status. Known values are: "Pending", - "Approved", "Rejected", "Disconnected". + "Approved", "Rejected", and "Disconnected". :vartype status: str or ~azure.mgmt.containerservice.v2022_03_01.models.ConnectionStatus :ivar description: The private link service connection description. :vartype description: str """ _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, + "status": {"key": "status", "type": "str"}, + "description": {"key": "description", "type": "str"}, } def __init__( @@ -5233,17 +5080,17 @@ def __init__( ): """ :keyword status: The private link service connection status. Known values are: "Pending", - "Approved", "Rejected", "Disconnected". + "Approved", "Rejected", and "Disconnected". :paramtype status: str or ~azure.mgmt.containerservice.v2022_03_01.models.ConnectionStatus :keyword description: The private link service connection description. :paramtype description: str """ - super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) + super().__init__(**kwargs) self.status = status self.description = description -class ResourceReference(msrest.serialization.Model): +class ResourceReference(_serialization.Model): """A reference to an Azure resource. :ivar id: The fully qualified Azure resource id. @@ -5251,29 +5098,24 @@ class ResourceReference(msrest.serialization.Model): """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, } - def __init__( - self, - *, - id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin """ :keyword id: The fully qualified Azure resource id. :paramtype id: str """ - super(ResourceReference, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id -class RunCommandRequest(msrest.serialization.Model): +class RunCommandRequest(_serialization.Model): """A run command request. All required parameters must be populated in order to send to Azure. - :ivar command: Required. The command to run. + :ivar command: The command to run. Required. :vartype command: str :ivar context: A base64 encoded zip file containing the files required by the command. :vartype context: str @@ -5282,38 +5124,31 @@ class RunCommandRequest(msrest.serialization.Model): """ _validation = { - 'command': {'required': True}, + "command": {"required": True}, } _attribute_map = { - 'command': {'key': 'command', 'type': 'str'}, - 'context': {'key': 'context', 'type': 'str'}, - 'cluster_token': {'key': 'clusterToken', 'type': 'str'}, + "command": {"key": "command", "type": "str"}, + "context": {"key": "context", "type": "str"}, + "cluster_token": {"key": "clusterToken", "type": "str"}, } - def __init__( - self, - *, - command: str, - context: Optional[str] = None, - cluster_token: Optional[str] = None, - **kwargs - ): + def __init__(self, *, command: str, context: Optional[str] = None, cluster_token: Optional[str] = None, **kwargs): """ - :keyword command: Required. The command to run. + :keyword command: The command to run. Required. :paramtype command: str :keyword context: A base64 encoded zip file containing the files required by the command. :paramtype context: str :keyword cluster_token: AuthToken issued for AKS AAD Server App. :paramtype cluster_token: str """ - super(RunCommandRequest, self).__init__(**kwargs) + super().__init__(**kwargs) self.command = command self.context = context self.cluster_token = cluster_token -class RunCommandResult(msrest.serialization.Model): +class RunCommandResult(_serialization.Model): """run command result. Variables are only populated by the server, and will be ignored when sending a request. @@ -5335,32 +5170,28 @@ class RunCommandResult(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'exit_code': {'readonly': True}, - 'started_at': {'readonly': True}, - 'finished_at': {'readonly': True}, - 'logs': {'readonly': True}, - 'reason': {'readonly': True}, + "id": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "exit_code": {"readonly": True}, + "started_at": {"readonly": True}, + "finished_at": {"readonly": True}, + "logs": {"readonly": True}, + "reason": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'exit_code': {'key': 'properties.exitCode', 'type': 'int'}, - 'started_at': {'key': 'properties.startedAt', 'type': 'iso-8601'}, - 'finished_at': {'key': 'properties.finishedAt', 'type': 'iso-8601'}, - 'logs': {'key': 'properties.logs', 'type': 'str'}, - 'reason': {'key': 'properties.reason', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(RunCommandResult, self).__init__(**kwargs) + "id": {"key": "id", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "exit_code": {"key": "properties.exitCode", "type": "int"}, + "started_at": {"key": "properties.startedAt", "type": "iso-8601"}, + "finished_at": {"key": "properties.finishedAt", "type": "iso-8601"}, + "logs": {"key": "properties.logs", "type": "str"}, + "reason": {"key": "properties.reason", "type": "str"}, + } + + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.id = None self.provisioning_state = None self.exit_code = None @@ -5370,7 +5201,7 @@ def __init__( self.reason = None -class Snapshot(TrackedResource): +class Snapshot(TrackedResource): # pylint: disable=too-many-instance-attributes """A node pool snapshot resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -5388,25 +5219,24 @@ class Snapshot(TrackedResource): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.containerservice.v2022_03_01.models.SystemData - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] - :ivar location: Required. The geo-location where the resource lives. + :ivar location: The geo-location where the resource lives. Required. :vartype location: str :ivar creation_data: CreationData to be used to specify the source agent pool resource ID to create this snapshot. :vartype creation_data: ~azure.mgmt.containerservice.v2022_03_01.models.CreationData - :ivar snapshot_type: The type of a snapshot. The default is NodePool. Known values are: - "NodePool". Default value: "NodePool". + :ivar snapshot_type: The type of a snapshot. The default is NodePool. "NodePool" :vartype snapshot_type: str or ~azure.mgmt.containerservice.v2022_03_01.models.SnapshotType :ivar kubernetes_version: The version of Kubernetes. :vartype kubernetes_version: str :ivar node_image_version: The version of node image. :vartype node_image_version: str - :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_03_01.models.OSType :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known - values are: "Ubuntu", "CBLMariner". + values are: "Ubuntu" and "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2022_03_01.models.OSSKU :ivar vm_size: The size of the VM. :vartype vm_size: str @@ -5415,34 +5245,34 @@ class Snapshot(TrackedResource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'location': {'required': True}, - 'kubernetes_version': {'readonly': True}, - 'node_image_version': {'readonly': True}, - 'os_type': {'readonly': True}, - 'os_sku': {'readonly': True}, - 'vm_size': {'readonly': True}, - 'enable_fips': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, + "kubernetes_version": {"readonly": True}, + "node_image_version": {"readonly": True}, + "os_type": {"readonly": True}, + "os_sku": {"readonly": True}, + "vm_size": {"readonly": True}, + "enable_fips": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - 'creation_data': {'key': 'properties.creationData', 'type': 'CreationData'}, - 'snapshot_type': {'key': 'properties.snapshotType', 'type': 'str'}, - 'kubernetes_version': {'key': 'properties.kubernetesVersion', 'type': 'str'}, - 'node_image_version': {'key': 'properties.nodeImageVersion', 'type': 'str'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'os_sku': {'key': 'properties.osSku', 'type': 'str'}, - 'vm_size': {'key': 'properties.vmSize', 'type': 'str'}, - 'enable_fips': {'key': 'properties.enableFIPS', 'type': 'bool'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "creation_data": {"key": "properties.creationData", "type": "CreationData"}, + "snapshot_type": {"key": "properties.snapshotType", "type": "str"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "node_image_version": {"key": "properties.nodeImageVersion", "type": "str"}, + "os_type": {"key": "properties.osType", "type": "str"}, + "os_sku": {"key": "properties.osSku", "type": "str"}, + "vm_size": {"key": "properties.vmSize", "type": "str"}, + "enable_fips": {"key": "properties.enableFIPS", "type": "bool"}, } def __init__( @@ -5451,22 +5281,21 @@ def __init__( location: str, tags: Optional[Dict[str, str]] = None, creation_data: Optional["_models.CreationData"] = None, - snapshot_type: Optional[Union[str, "_models.SnapshotType"]] = "NodePool", + snapshot_type: Union[str, "_models.SnapshotType"] = "NodePool", **kwargs ): """ - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] - :keyword location: Required. The geo-location where the resource lives. + :keyword location: The geo-location where the resource lives. Required. :paramtype location: str :keyword creation_data: CreationData to be used to specify the source agent pool resource ID to create this snapshot. :paramtype creation_data: ~azure.mgmt.containerservice.v2022_03_01.models.CreationData - :keyword snapshot_type: The type of a snapshot. The default is NodePool. Known values are: - "NodePool". Default value: "NodePool". + :keyword snapshot_type: The type of a snapshot. The default is NodePool. "NodePool" :paramtype snapshot_type: str or ~azure.mgmt.containerservice.v2022_03_01.models.SnapshotType """ - super(Snapshot, self).__init__(tags=tags, location=location, **kwargs) + super().__init__(tags=tags, location=location, **kwargs) self.creation_data = creation_data self.snapshot_type = snapshot_type self.kubernetes_version = None @@ -5477,7 +5306,7 @@ def __init__( self.enable_fips = None -class SnapshotListResult(msrest.serialization.Model): +class SnapshotListResult(_serialization.Model): """The response from the List Snapshots operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -5489,30 +5318,25 @@ class SnapshotListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[Snapshot]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[Snapshot]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.Snapshot"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.Snapshot"]] = None, **kwargs): """ :keyword value: The list of snapshots. :paramtype value: list[~azure.mgmt.containerservice.v2022_03_01.models.Snapshot] """ - super(SnapshotListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class SysctlConfig(msrest.serialization.Model): +class SysctlConfig(_serialization.Model): # pylint: disable=too-many-instance-attributes """Sysctl settings for Linux agent nodes. :ivar net_core_somaxconn: Sysctl setting net.core.somaxconn. @@ -5574,37 +5398,37 @@ class SysctlConfig(msrest.serialization.Model): """ _attribute_map = { - 'net_core_somaxconn': {'key': 'netCoreSomaxconn', 'type': 'int'}, - 'net_core_netdev_max_backlog': {'key': 'netCoreNetdevMaxBacklog', 'type': 'int'}, - 'net_core_rmem_default': {'key': 'netCoreRmemDefault', 'type': 'int'}, - 'net_core_rmem_max': {'key': 'netCoreRmemMax', 'type': 'int'}, - 'net_core_wmem_default': {'key': 'netCoreWmemDefault', 'type': 'int'}, - 'net_core_wmem_max': {'key': 'netCoreWmemMax', 'type': 'int'}, - 'net_core_optmem_max': {'key': 'netCoreOptmemMax', 'type': 'int'}, - 'net_ipv4_tcp_max_syn_backlog': {'key': 'netIpv4TcpMaxSynBacklog', 'type': 'int'}, - 'net_ipv4_tcp_max_tw_buckets': {'key': 'netIpv4TcpMaxTwBuckets', 'type': 'int'}, - 'net_ipv4_tcp_fin_timeout': {'key': 'netIpv4TcpFinTimeout', 'type': 'int'}, - 'net_ipv4_tcp_keepalive_time': {'key': 'netIpv4TcpKeepaliveTime', 'type': 'int'}, - 'net_ipv4_tcp_keepalive_probes': {'key': 'netIpv4TcpKeepaliveProbes', 'type': 'int'}, - 'net_ipv4_tcpkeepalive_intvl': {'key': 'netIpv4TcpkeepaliveIntvl', 'type': 'int'}, - 'net_ipv4_tcp_tw_reuse': {'key': 'netIpv4TcpTwReuse', 'type': 'bool'}, - 'net_ipv4_ip_local_port_range': {'key': 'netIpv4IpLocalPortRange', 'type': 'str'}, - 'net_ipv4_neigh_default_gc_thresh1': {'key': 'netIpv4NeighDefaultGcThresh1', 'type': 'int'}, - 'net_ipv4_neigh_default_gc_thresh2': {'key': 'netIpv4NeighDefaultGcThresh2', 'type': 'int'}, - 'net_ipv4_neigh_default_gc_thresh3': {'key': 'netIpv4NeighDefaultGcThresh3', 'type': 'int'}, - 'net_netfilter_nf_conntrack_max': {'key': 'netNetfilterNfConntrackMax', 'type': 'int'}, - 'net_netfilter_nf_conntrack_buckets': {'key': 'netNetfilterNfConntrackBuckets', 'type': 'int'}, - 'fs_inotify_max_user_watches': {'key': 'fsInotifyMaxUserWatches', 'type': 'int'}, - 'fs_file_max': {'key': 'fsFileMax', 'type': 'int'}, - 'fs_aio_max_nr': {'key': 'fsAioMaxNr', 'type': 'int'}, - 'fs_nr_open': {'key': 'fsNrOpen', 'type': 'int'}, - 'kernel_threads_max': {'key': 'kernelThreadsMax', 'type': 'int'}, - 'vm_max_map_count': {'key': 'vmMaxMapCount', 'type': 'int'}, - 'vm_swappiness': {'key': 'vmSwappiness', 'type': 'int'}, - 'vm_vfs_cache_pressure': {'key': 'vmVfsCachePressure', 'type': 'int'}, - } - - def __init__( + "net_core_somaxconn": {"key": "netCoreSomaxconn", "type": "int"}, + "net_core_netdev_max_backlog": {"key": "netCoreNetdevMaxBacklog", "type": "int"}, + "net_core_rmem_default": {"key": "netCoreRmemDefault", "type": "int"}, + "net_core_rmem_max": {"key": "netCoreRmemMax", "type": "int"}, + "net_core_wmem_default": {"key": "netCoreWmemDefault", "type": "int"}, + "net_core_wmem_max": {"key": "netCoreWmemMax", "type": "int"}, + "net_core_optmem_max": {"key": "netCoreOptmemMax", "type": "int"}, + "net_ipv4_tcp_max_syn_backlog": {"key": "netIpv4TcpMaxSynBacklog", "type": "int"}, + "net_ipv4_tcp_max_tw_buckets": {"key": "netIpv4TcpMaxTwBuckets", "type": "int"}, + "net_ipv4_tcp_fin_timeout": {"key": "netIpv4TcpFinTimeout", "type": "int"}, + "net_ipv4_tcp_keepalive_time": {"key": "netIpv4TcpKeepaliveTime", "type": "int"}, + "net_ipv4_tcp_keepalive_probes": {"key": "netIpv4TcpKeepaliveProbes", "type": "int"}, + "net_ipv4_tcpkeepalive_intvl": {"key": "netIpv4TcpkeepaliveIntvl", "type": "int"}, + "net_ipv4_tcp_tw_reuse": {"key": "netIpv4TcpTwReuse", "type": "bool"}, + "net_ipv4_ip_local_port_range": {"key": "netIpv4IpLocalPortRange", "type": "str"}, + "net_ipv4_neigh_default_gc_thresh1": {"key": "netIpv4NeighDefaultGcThresh1", "type": "int"}, + "net_ipv4_neigh_default_gc_thresh2": {"key": "netIpv4NeighDefaultGcThresh2", "type": "int"}, + "net_ipv4_neigh_default_gc_thresh3": {"key": "netIpv4NeighDefaultGcThresh3", "type": "int"}, + "net_netfilter_nf_conntrack_max": {"key": "netNetfilterNfConntrackMax", "type": "int"}, + "net_netfilter_nf_conntrack_buckets": {"key": "netNetfilterNfConntrackBuckets", "type": "int"}, + "fs_inotify_max_user_watches": {"key": "fsInotifyMaxUserWatches", "type": "int"}, + "fs_file_max": {"key": "fsFileMax", "type": "int"}, + "fs_aio_max_nr": {"key": "fsAioMaxNr", "type": "int"}, + "fs_nr_open": {"key": "fsNrOpen", "type": "int"}, + "kernel_threads_max": {"key": "kernelThreadsMax", "type": "int"}, + "vm_max_map_count": {"key": "vmMaxMapCount", "type": "int"}, + "vm_swappiness": {"key": "vmSwappiness", "type": "int"}, + "vm_vfs_cache_pressure": {"key": "vmVfsCachePressure", "type": "int"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, net_core_somaxconn: Optional[int] = None, @@ -5695,7 +5519,7 @@ def __init__( :keyword vm_vfs_cache_pressure: Sysctl setting vm.vfs_cache_pressure. :paramtype vm_vfs_cache_pressure: int """ - super(SysctlConfig, self).__init__(**kwargs) + super().__init__(**kwargs) self.net_core_somaxconn = net_core_somaxconn self.net_core_netdev_max_backlog = net_core_netdev_max_backlog self.net_core_rmem_default = net_core_rmem_default @@ -5726,20 +5550,20 @@ def __init__( self.vm_vfs_cache_pressure = vm_vfs_cache_pressure -class SystemData(msrest.serialization.Model): +class SystemData(_serialization.Model): """Metadata pertaining to creation and last modification of the resource. :ivar created_by: The identity that created the resource. :vartype created_by: str :ivar created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", "Key". + "User", "Application", "ManagedIdentity", and "Key". :vartype created_by_type: str or ~azure.mgmt.containerservice.v2022_03_01.models.CreatedByType :ivar created_at: The timestamp of resource creation (UTC). :vartype created_at: ~datetime.datetime :ivar last_modified_by: The identity that last modified the resource. :vartype last_modified_by: str :ivar last_modified_by_type: The type of identity that last modified the resource. Known values - are: "User", "Application", "ManagedIdentity", "Key". + are: "User", "Application", "ManagedIdentity", and "Key". :vartype last_modified_by_type: str or ~azure.mgmt.containerservice.v2022_03_01.models.CreatedByType :ivar last_modified_at: The timestamp of resource last modification (UTC). @@ -5747,12 +5571,12 @@ class SystemData(msrest.serialization.Model): """ _attribute_map = { - 'created_by': {'key': 'createdBy', 'type': 'str'}, - 'created_by_type': {'key': 'createdByType', 'type': 'str'}, - 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, - 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, - 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, - 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + "created_by": {"key": "createdBy", "type": "str"}, + "created_by_type": {"key": "createdByType", "type": "str"}, + "created_at": {"key": "createdAt", "type": "iso-8601"}, + "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, + "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, + "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, } def __init__( @@ -5770,7 +5594,7 @@ def __init__( :keyword created_by: The identity that created the resource. :paramtype created_by: str :keyword created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", "Key". + "User", "Application", "ManagedIdentity", and "Key". :paramtype created_by_type: str or ~azure.mgmt.containerservice.v2022_03_01.models.CreatedByType :keyword created_at: The timestamp of resource creation (UTC). @@ -5778,13 +5602,13 @@ def __init__( :keyword last_modified_by: The identity that last modified the resource. :paramtype last_modified_by: str :keyword last_modified_by_type: The type of identity that last modified the resource. Known - values are: "User", "Application", "ManagedIdentity", "Key". + values are: "User", "Application", "ManagedIdentity", and "Key". :paramtype last_modified_by_type: str or ~azure.mgmt.containerservice.v2022_03_01.models.CreatedByType :keyword last_modified_at: The timestamp of resource last modification (UTC). :paramtype last_modified_at: ~datetime.datetime """ - super(SystemData, self).__init__(**kwargs) + super().__init__(**kwargs) self.created_by = created_by self.created_by_type = created_by_type self.created_at = created_at @@ -5793,36 +5617,31 @@ def __init__( self.last_modified_at = last_modified_at -class TagsObject(msrest.serialization.Model): +class TagsObject(_serialization.Model): """Tags object for patch operations. - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] """ _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] """ - super(TagsObject, self).__init__(**kwargs) + super().__init__(**kwargs) self.tags = tags -class TimeInWeek(msrest.serialization.Model): +class TimeInWeek(_serialization.Model): """Time in a week. :ivar day: The day of the week. Known values are: "Sunday", "Monday", "Tuesday", "Wednesday", - "Thursday", "Friday", "Saturday". + "Thursday", "Friday", and "Saturday". :vartype day: str or ~azure.mgmt.containerservice.v2022_03_01.models.WeekDay :ivar hour_slots: Each integer hour represents a time range beginning at 0m after the hour ending at the next hour (non-inclusive). 0 corresponds to 00:00 UTC, 23 corresponds to 23:00 @@ -5831,32 +5650,28 @@ class TimeInWeek(msrest.serialization.Model): """ _attribute_map = { - 'day': {'key': 'day', 'type': 'str'}, - 'hour_slots': {'key': 'hourSlots', 'type': '[int]'}, + "day": {"key": "day", "type": "str"}, + "hour_slots": {"key": "hourSlots", "type": "[int]"}, } def __init__( - self, - *, - day: Optional[Union[str, "_models.WeekDay"]] = None, - hour_slots: Optional[List[int]] = None, - **kwargs + self, *, day: Optional[Union[str, "_models.WeekDay"]] = None, hour_slots: Optional[List[int]] = None, **kwargs ): """ :keyword day: The day of the week. Known values are: "Sunday", "Monday", "Tuesday", - "Wednesday", "Thursday", "Friday", "Saturday". + "Wednesday", "Thursday", "Friday", and "Saturday". :paramtype day: str or ~azure.mgmt.containerservice.v2022_03_01.models.WeekDay :keyword hour_slots: Each integer hour represents a time range beginning at 0m after the hour ending at the next hour (non-inclusive). 0 corresponds to 00:00 UTC, 23 corresponds to 23:00 UTC. Specifying [0, 1] means the 00:00 - 02:00 UTC time range. :paramtype hour_slots: list[int] """ - super(TimeInWeek, self).__init__(**kwargs) + super().__init__(**kwargs) self.day = day self.hour_slots = hour_slots -class TimeSpan(msrest.serialization.Model): +class TimeSpan(_serialization.Model): """For example, between 2021-05-25T13:00:00Z and 2021-05-25T14:00:00Z. :ivar start: The start of a time span. @@ -5866,29 +5681,23 @@ class TimeSpan(msrest.serialization.Model): """ _attribute_map = { - 'start': {'key': 'start', 'type': 'iso-8601'}, - 'end': {'key': 'end', 'type': 'iso-8601'}, + "start": {"key": "start", "type": "iso-8601"}, + "end": {"key": "end", "type": "iso-8601"}, } - def __init__( - self, - *, - start: Optional[datetime.datetime] = None, - end: Optional[datetime.datetime] = None, - **kwargs - ): + def __init__(self, *, start: Optional[datetime.datetime] = None, end: Optional[datetime.datetime] = None, **kwargs): """ :keyword start: The start of a time span. :paramtype start: ~datetime.datetime :keyword end: The end of a time span. :paramtype end: ~datetime.datetime """ - super(TimeSpan, self).__init__(**kwargs) + super().__init__(**kwargs) self.start = start self.end = end -class WindowsGmsaProfile(msrest.serialization.Model): +class WindowsGmsaProfile(_serialization.Model): """Windows gMSA Profile in the managed cluster. :ivar enabled: Specifies whether to enable Windows gMSA in the managed cluster. @@ -5904,9 +5713,9 @@ class WindowsGmsaProfile(msrest.serialization.Model): """ _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'dns_server': {'key': 'dnsServer', 'type': 'str'}, - 'root_domain_name': {'key': 'rootDomainName', 'type': 'str'}, + "enabled": {"key": "enabled", "type": "bool"}, + "dns_server": {"key": "dnsServer", "type": "str"}, + "root_domain_name": {"key": "rootDomainName", "type": "str"}, } def __init__( @@ -5929,7 +5738,7 @@ def __init__( which is used to create the managed cluster. :paramtype root_domain_name: str """ - super(WindowsGmsaProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.dns_server = dns_server self.root_domain_name = root_domain_name diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/models/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/models/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/models/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/models/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/operations/__init__.py index e0748876288c..593b23075ce0 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/operations/__init__.py @@ -18,15 +18,16 @@ from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'Operations', - 'ManagedClustersOperations', - 'MaintenanceConfigurationsOperations', - 'AgentPoolsOperations', - 'PrivateEndpointConnectionsOperations', - 'PrivateLinkResourcesOperations', - 'ResolvePrivateLinkServiceIdOperations', - 'SnapshotsOperations', + "Operations", + "ManagedClustersOperations", + "MaintenanceConfigurationsOperations", + "AgentPoolsOperations", + "PrivateEndpointConnectionsOperations", + "PrivateLinkResourcesOperations", + "ResolvePrivateLinkServiceIdOperations", + "SnapshotsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/operations/_agent_pools_operations.py index 69d398d70921..873d7eb1c9a2 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/operations/_agent_pools_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,288 +27,303 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - *, - json: Optional[_models.AgentPool] = None, - content: Any = None, - **kwargs: Any + _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, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + _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, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_get_upgrade_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_available_agent_pool_versions_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_upgrade_node_image_version_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_upgrade_node_image_version_request( + resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class AgentPoolsOperations: """ @@ -324,47 +344,40 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> Iterable[_models.AgentPoolListResult]: + def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> Iterable["_models.AgentPool"]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AgentPoolListResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_03_01.models.AgentPoolListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either AgentPool or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_03_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -372,16 +385,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -397,10 +405,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -410,54 +416,46 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore @distributed_trace def get( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPool: """Gets the specified managed cluster agent pool. Gets the specified managed cluster agent pool. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPool, or the result of cls(response) + :return: AgentPool or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.AgentPool - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -465,57 +463,60 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore def _create_or_update_initial( self, resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: _models.AgentPool, + parameters: Union[_models.AgentPool, IO], **kwargs: Any ) -> _models.AgentPool: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - _json = self._serialize.body(parameters, 'AgentPool') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "AgentPool") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -523,10 +524,9 @@ def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -534,26 +534,27 @@ def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - @distributed_trace + @overload def begin_create_or_update( self, resource_group_name: str, resource_name: str, agent_pool_name: str, parameters: _models.AgentPool, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.AgentPool]: """Creates or updates an agent pool in the specified managed cluster. @@ -561,13 +562,58 @@ def begin_create_or_update( Creates or updates an agent pool in the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str - :param parameters: The agent pool to create or update. + :param parameters: The agent pool to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_03_01.models.AgentPool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_03_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AgentPool]: + """Creates or updates an agent pool in the specified managed cluster. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: The agent pool to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -579,20 +625,57 @@ def begin_create_or_update( :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_03_01.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: Union[_models.AgentPool, IO], + **kwargs: Any + ) -> LROPoller[_models.AgentPool]: + """Creates or updates an agent pool in the specified managed cluster. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: The agent pool to create or update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.mgmt.containerservice.v2022_03_01.models.AgentPool or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_03_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -601,66 +684,55 @@ def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -668,10 +740,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -681,26 +752,22 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + def begin_delete( + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> LROPoller[None]: """Deletes an agent pool in the specified managed cluster. Deletes an agent pool in the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -712,99 +779,86 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPoolUpgradeProfile: """Gets the upgrade profile for an agent pool. Gets the upgrade profile for an agent pool. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolUpgradeProfile, or the result of cls(response) + :return: AgentPoolUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.AgentPoolUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -812,32 +866,27 @@ def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolUpgradeProfile', pipeline_response) + deserialized = self._deserialize("AgentPoolUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore @distributed_trace def get_available_agent_pool_versions( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported Kubernetes versions for the specified agent pool. @@ -846,32 +895,30 @@ def get_available_agent_pool_versions( the version lifecycle. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolAvailableVersions, or the result of cls(response) + :return: AgentPoolAvailableVersions or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.AgentPoolAvailableVersions - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolAvailableVersions] - request = build_get_available_agent_pool_versions_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_available_agent_pool_versions.metadata['url'], + template_url=self.get_available_agent_pool_versions.metadata["url"], headers=_headers, params=_params, ) @@ -879,52 +926,43 @@ def get_available_agent_pool_versions( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolAvailableVersions', pipeline_response) + deserialized = self._deserialize("AgentPoolAvailableVersions", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_available_agent_pool_versions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore - + get_available_agent_pool_versions.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore def _upgrade_node_image_version_initial( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> Optional[_models.AgentPool]: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.AgentPool]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.AgentPool]] - - request = build_upgrade_node_image_version_request_initial( - subscription_id=self._config.subscription_id, + request = build_upgrade_node_image_version_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._upgrade_node_image_version_initial.metadata['url'], + template_url=self._upgrade_node_image_version_initial.metadata["url"], headers=_headers, params=_params, ) @@ -932,10 +970,9 @@ def _upgrade_node_image_version_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -945,26 +982,23 @@ def _upgrade_node_image_version_initial( deserialized = None response_headers = {} if response.status_code == 202: - response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) - - deserialized = self._deserialize('AgentPool', pipeline_response) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _upgrade_node_image_version_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore - + _upgrade_node_image_version_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore @distributed_trace def begin_upgrade_node_image_version( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any - ) -> LROPoller[_models.AgentPool]: + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any + ) -> LROPoller[None]: """Upgrades the node image version of an agent pool to the latest. Upgrading the node image version of an agent pool applies the newest OS and runtime updates to @@ -972,10 +1006,11 @@ def begin_upgrade_node_image_version( node image versions, see: https://docs.microsoft.com/azure/aks/node-image-upgrade. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -988,59 +1023,54 @@ def begin_upgrade_node_image_version( :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_03_01.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._upgrade_node_image_version_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) - - deserialized = self._deserialize('AgentPool', pipeline_response) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_upgrade_node_image_version.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore + begin_upgrade_node_image_version.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/operations/_maintenance_configurations_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/operations/_maintenance_configurations_operations.py index 4d604f8db9f6..678f4ca3f651 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/operations/_maintenance_configurations_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/operations/_maintenance_configurations_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,173 +25,181 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +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_managed_cluster_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, config_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "configName": _SERIALIZER.url("config_name", config_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "configName": _SERIALIZER.url("config_name", config_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - config_name: str, - *, - json: Optional[_models.MaintenanceConfiguration] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, resource_name: str, config_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "configName": _SERIALIZER.url("config_name", config_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "configName": _SERIALIZER.url("config_name", config_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, config_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "configName": _SERIALIZER.url("config_name", config_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "configName": _SERIALIZER.url("config_name", config_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class MaintenanceConfigurationsOperations: """ @@ -207,48 +220,44 @@ def __init__(self, *args, **kwargs): 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_managed_cluster( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> Iterable[_models.MaintenanceConfigurationListResult]: + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> Iterable["_models.MaintenanceConfiguration"]: """Gets a list of maintenance configurations in the specified managed cluster. Gets a list of maintenance configurations in the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either MaintenanceConfigurationListResult or the result - of cls(response) + :return: An iterator like instance of either MaintenanceConfiguration or the result of + cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_03_01.models.MaintenanceConfigurationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_03_01.models.MaintenanceConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfigurationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfigurationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_managed_cluster_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_managed_cluster.metadata['url'], + template_url=self.list_by_managed_cluster.metadata["url"], headers=_headers, params=_params, ) @@ -256,16 +265,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_managed_cluster_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -281,10 +285,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -294,54 +296,46 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_managed_cluster.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations"} # type: ignore + list_by_managed_cluster.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations"} # type: ignore @distributed_trace def get( - self, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, config_name: str, **kwargs: Any ) -> _models.MaintenanceConfiguration: """Gets the specified maintenance configuration of a managed cluster. Gets the specified maintenance configuration of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: MaintenanceConfiguration, or the result of cls(response) + :return: MaintenanceConfiguration or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.MaintenanceConfiguration - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfiguration] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -349,33 +343,33 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) + deserialized = self._deserialize("MaintenanceConfiguration", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - - @distributed_trace + @overload def create_or_update( self, resource_group_name: str, resource_name: str, config_name: str, parameters: _models.MaintenanceConfiguration, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.MaintenanceConfiguration: """Creates or updates a maintenance configuration in the specified managed cluster. @@ -383,41 +377,116 @@ def create_or_update( Creates or updates a maintenance configuration in the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str - :param parameters: The maintenance configuration to create or update. + :param parameters: The maintenance configuration to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_03_01.models.MaintenanceConfiguration + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: MaintenanceConfiguration, or the result of cls(response) + :return: MaintenanceConfiguration or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.MaintenanceConfiguration - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configuration in the specified managed cluster. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: The maintenance configuration to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: Union[_models.MaintenanceConfiguration, IO], + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configuration in the specified managed cluster. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: The maintenance configuration to create or update. Is either a model type or + a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_03_01.models.MaintenanceConfiguration or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfiguration] - _json = self._serialize.body(parameters, 'MaintenanceConfiguration') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "MaintenanceConfiguration") request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) @@ -425,68 +494,60 @@ def create_or_update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) + deserialized = self._deserialize("MaintenanceConfiguration", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore @distributed_trace def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, config_name: str, **kwargs: Any ) -> None: """Deletes a maintenance configuration. Deletes a maintenance configuration. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) @@ -494,10 +555,9 @@ def delete( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -507,5 +567,4 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/operations/_managed_clusters_operations.py index 0e5e0f665f15..c773e5630dcc 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/operations/_managed_clusters_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,200 +27,189 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_get_os_options_request( - subscription_id: str, - location: str, - *, - resource_type: Optional[str] = None, - **kwargs: Any + location: str, subscription_id: str, *, resource_type: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "location": _SERIALIZER.url("location", location, 'str', min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "location": _SERIALIZER.url("location", location, "str", min_length=1), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if resource_type is not None: - _params['resource-type'] = _SERIALIZER.query("resource_type", resource_type, 'str') + _params["resource-type"] = _SERIALIZER.query("resource_type", resource_type, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters") + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters" + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_resource_group_request( - subscription_id: str, - resource_group_name: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_upgrade_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_access_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, role_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "roleName": _SERIALIZER.url("role_name", role_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "roleName": _SERIALIZER.url("role_name", role_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_admin_credentials_request( - subscription_id: str, resource_group_name: str, resource_name: str, + subscription_id: str, *, server_fqdn: Optional[str] = None, **kwargs: Any @@ -223,40 +217,46 @@ def build_list_cluster_admin_credentials_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if server_fqdn is not None: - _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + _params["server-fqdn"] = _SERIALIZER.query("server_fqdn", server_fqdn, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_user_credentials_request( - subscription_id: str, resource_group_name: str, resource_name: str, + subscription_id: str, *, server_fqdn: Optional[str] = None, format: Optional[Union[str, "_models.Format"]] = None, @@ -265,42 +265,48 @@ def build_list_cluster_user_credentials_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if server_fqdn is not None: - _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + _params["server-fqdn"] = _SERIALIZER.query("server_fqdn", server_fqdn, "str") if format is not None: - _params['format'] = _SERIALIZER.query("format", format, 'str') + _params["format"] = _SERIALIZER.query("format", format, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_monitoring_user_credentials_request( - subscription_id: str, resource_group_name: str, resource_name: str, + subscription_id: str, *, server_fqdn: Optional[str] = None, **kwargs: Any @@ -308,520 +314,535 @@ def build_list_cluster_monitoring_user_credentials_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if server_fqdn is not None: - _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + _params["server-fqdn"] = _SERIALIZER.query("server_fqdn", server_fqdn, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: + +def build_get_request(resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedCluster] = None, - content: Any = None, - **kwargs: Any + +def build_create_or_update_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_update_tags_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.TagsObject] = None, - content: Any = None, - **kwargs: Any + +def build_update_tags_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + +def build_delete_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_reset_service_principal_profile_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedClusterServicePrincipalProfile] = None, - content: Any = None, - **kwargs: Any + +def build_reset_service_principal_profile_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_reset_aad_profile_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedClusterAADProfile] = None, - content: Any = None, - **kwargs: Any + +def build_reset_aad_profile_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_rotate_cluster_certificates_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + +def build_rotate_cluster_certificates_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_stop_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + +def build_stop_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_start_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + +def build_start_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_run_command_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.RunCommandRequest] = None, - content: Any = None, - **kwargs: Any + +def build_run_command_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_get_command_result_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - command_id: str, - **kwargs: Any + resource_group_name: str, resource_name: str, command_id: 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "commandId": _SERIALIZER.url("command_id", command_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "commandId": _SERIALIZER.url("command_id", command_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_list_outbound_network_dependencies_endpoints_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + class ManagedClustersOperations: # pylint: disable=too-many-public-methods """ @@ -842,46 +863,39 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def get_os_options( - self, - location: str, - resource_type: Optional[str] = None, - **kwargs: Any + self, location: str, resource_type: Optional[str] = None, **kwargs: Any ) -> _models.OSOptionProfile: """Gets supported OS options in the specified subscription. Gets supported OS options in the specified subscription. - :param location: The name of Azure region. + :param location: The name of Azure region. Required. :type location: str :param resource_type: The resource type for which the OS options needs to be returned. Default value is None. :type resource_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: OSOptionProfile, or the result of cls(response) + :return: OSOptionProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.OSOptionProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OSOptionProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OSOptionProfile] - request = build_get_os_options_request( - subscription_id=self._config.subscription_id, location=location, - api_version=api_version, + subscription_id=self._config.subscription_id, resource_type=resource_type, - template_url=self.get_os_options.metadata['url'], + api_version=api_version, + template_url=self.get_os_options.metadata["url"], headers=_headers, params=_params, ) @@ -889,59 +903,52 @@ def get_os_options( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('OSOptionProfile', pipeline_response) + deserialized = self._deserialize("OSOptionProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_os_options.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default"} # type: ignore - + get_os_options.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default"} # type: ignore @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.ManagedClusterListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.ManagedCluster"]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_03_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_03_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -949,14 +956,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -972,10 +976,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -985,49 +987,42 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> Iterable[_models.ManagedClusterListResult]: + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.ManagedCluster"]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_03_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_03_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -1035,15 +1030,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -1059,10 +1050,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1072,50 +1061,43 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.ManagedClusterUpgradeProfile: """Gets the upgrade profile of a managed cluster. Gets the upgrade profile of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterUpgradeProfile, or the result of cls(response) + :return: ManagedClusterUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.ManagedClusterUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -1123,33 +1105,27 @@ def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterUpgradeProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore @distributed_trace def get_access_profile( - self, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, role_name: str, **kwargs: Any ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. @@ -1159,35 +1135,33 @@ def get_access_profile( `_ . :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param role_name: The name of the role for managed cluster accessProfile resource. + :param role_name: The name of the role for managed cluster accessProfile resource. Required. :type role_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterAccessProfile, or the result of cls(response) + :return: ManagedClusterAccessProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.ManagedClusterAccessProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterAccessProfile] - request = build_get_access_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, role_name=role_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_access_profile.metadata['url'], + template_url=self.get_access_profile.metadata["url"], headers=_headers, params=_params, ) @@ -1195,68 +1169,60 @@ def get_access_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterAccessProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterAccessProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_access_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore - + get_access_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore @distributed_trace def list_cluster_admin_credentials( - self, - resource_group_name: str, - resource_name: str, - server_fqdn: Optional[str] = None, - **kwargs: Any + self, resource_group_name: str, resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any ) -> _models.CredentialResults: """Lists the admin credentials of a managed cluster. Lists the admin credentials of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_admin_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, - template_url=self.list_cluster_admin_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_admin_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -1264,25 +1230,23 @@ def list_cluster_admin_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_admin_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore - + list_cluster_admin_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore @distributed_trace def list_cluster_user_credentials( @@ -1298,40 +1262,39 @@ def list_cluster_user_credentials( Lists the user credentials of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :param format: Only apply to AAD clusters, specifies the format of returned kubeconfig. Format 'azure' will return azure auth-provider kubeconfig; format 'exec' will return exec format - kubeconfig, which requires kubelogin binary in the path. Default value is None. + kubeconfig, which requires kubelogin binary in the path. Known values are: "azure" and "exec". + Default value is None. :type format: str or ~azure.mgmt.containerservice.v2022_03_01.models.Format :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, format=format, - template_url=self.list_cluster_user_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -1339,68 +1302,60 @@ def list_cluster_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore - + list_cluster_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore @distributed_trace def list_cluster_monitoring_user_credentials( - self, - resource_group_name: str, - resource_name: str, - server_fqdn: Optional[str] = None, - **kwargs: Any + self, resource_group_name: str, resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any ) -> _models.CredentialResults: """Lists the cluster monitoring user credentials of a managed cluster. Lists the cluster monitoring user credentials of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_monitoring_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, - template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_monitoring_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -1408,64 +1363,55 @@ def list_cluster_monitoring_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_monitoring_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore - + list_cluster_monitoring_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore @distributed_trace - def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.ManagedCluster: + def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.ManagedCluster: """Gets a managed cluster. Gets a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedCluster, or the result of cls(response) + :return: ManagedCluster or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.ManagedCluster - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -1473,55 +1419,54 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _create_or_update_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.ManagedCluster, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'ManagedCluster') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedCluster") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1529,10 +1474,9 @@ def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -1540,25 +1484,26 @@ def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - - @distributed_trace + @overload def begin_create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedCluster, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. @@ -1566,11 +1511,15 @@ def begin_create_or_update( Creates or updates a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The managed cluster to create or update. + :param parameters: The managed cluster to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_03_01.models.ManagedCluster + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1583,90 +1532,157 @@ def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_03_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._create_or_update_initial( # type: ignore - resource_group_name=resource_group_name, - resource_name=resource_name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop('error_map', None) - def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized + @overload + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + Creates or updates a managed cluster. - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling - if cont_token: + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_03_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster to create or update. Is either a model type or a IO + type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_03_01.models.ManagedCluster or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_03_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ManagedCluster", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _update_tags_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.TagsObject, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request_initial( - subscription_id=self._config.subscription_id, + request = build_update_tags_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_tags_initial.metadata['url'], + content=_content, + template_url=self._update_tags_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1674,32 +1690,32 @@ def _update_tags_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_tags_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _update_tags_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - @distributed_trace + @overload def begin_update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. @@ -1707,11 +1723,88 @@ def begin_update_tags( Updates tags on a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2022_03_01.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_03_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates tags on a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_03_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates tags on a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_03_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1724,20 +1817,17 @@ def begin_update_tags( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_03_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, @@ -1745,64 +1835,54 @@ def begin_update_tags( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1810,10 +1890,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1823,23 +1902,18 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> LROPoller[None]: + def begin_delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> LROPoller[None]: """Deletes a managed cluster. Deletes a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1851,85 +1925,83 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterServicePrincipalProfile, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterServicePrincipalProfile") - request = build_reset_service_principal_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_service_principal_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_service_principal_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_service_principal_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1937,10 +2009,9 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1950,15 +2021,16 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re if cls: return cls(pipeline_response, None, {}) - _reset_service_principal_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + _reset_service_principal_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore - - @distributed_trace - def begin_reset_service_principal_profile( # pylint: disable=inconsistent-return-statements + @overload + def begin_reset_service_principal_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterServicePrincipalProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: """Reset the Service Principal Profile of a managed cluster. @@ -1966,12 +2038,53 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur This action cannot be performed on a cluster that is not using a service principal. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The service principal profile to set on the managed cluster. + :param parameters: The service principal profile to set on the managed cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2022_03_01.models.ManagedClusterServicePrincipalProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reset the Service Principal Profile of a managed cluster. + + This action cannot be performed on a cluster that is not using a service principal. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The service principal profile to set on the managed cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1982,20 +2095,54 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Reset the Service Principal Profile of a managed cluster. + + This action cannot be performed on a cluster that is not using a service principal. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The service principal profile to set on the managed cluster. Is either a + model type or a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2022_03_01.models.ManagedClusterServicePrincipalProfile or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -2003,67 +2150,68 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_service_principal_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + begin_reset_service_principal_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterAADProfile, + parameters: Union[_models.ManagedClusterAADProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterAADProfile") - request = build_reset_aad_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_aad_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_aad_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_aad_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2071,10 +2219,9 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -2084,15 +2231,16 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement if cls: return cls(pipeline_response, None, {}) - _reset_aad_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - + _reset_aad_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - @distributed_trace - def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements + @overload + def begin_reset_aad_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterAADProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: """Reset the AAD Profile of a managed cluster. @@ -2100,11 +2248,89 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements Reset the AAD Profile of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The AAD profile to set on the Managed Cluster. + :param parameters: The AAD profile to set on the Managed Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2022_03_01.models.ManagedClusterAADProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reset the AAD Profile of a managed cluster. + + Reset the AAD Profile of a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The AAD profile to set on the Managed Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterAADProfile, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Reset the AAD Profile of a managed cluster. + + Reset the AAD Profile of a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The AAD profile to set on the Managed Cluster. Is either a model type or a + IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_03_01.models.ManagedClusterAADProfile or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -2115,20 +2341,17 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -2136,62 +2359,52 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_aad_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + begin_reset_aad_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_rotate_cluster_certificates_request_initial( - subscription_id=self._config.subscription_id, + request = build_rotate_cluster_certificates_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._rotate_cluster_certificates_initial.metadata['url'], + template_url=self._rotate_cluster_certificates_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2199,10 +2412,9 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -2212,15 +2424,11 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return if cls: return cls(pipeline_response, None, {}) - _rotate_cluster_certificates_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore - + _rotate_cluster_certificates_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore @distributed_trace - def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + def begin_rotate_cluster_certificates( + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> LROPoller[None]: """Rotates the certificates of a managed cluster. @@ -2228,8 +2436,9 @@ def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-st more details about rotating managed cluster certificates. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -2241,80 +2450,67 @@ def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-st Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._rotate_cluster_certificates_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_rotate_cluster_certificates.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore + begin_rotate_cluster_certificates.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore def _stop_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_stop_request_initial( - subscription_id=self._config.subscription_id, + request = build_stop_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._stop_initial.metadata['url'], + template_url=self._stop_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2322,10 +2518,9 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -2335,16 +2530,10 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore - + _stop_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore @distributed_trace - def begin_stop( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> LROPoller[None]: + def begin_stop(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> LROPoller[None]: """Stops a Managed Cluster. This can only be performed on Azure Virtual Machine Scale set backed clusters. Stopping a @@ -2354,8 +2543,9 @@ def begin_stop( # pylint: disable=inconsistent-return-statements cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -2367,80 +2557,67 @@ def begin_stop( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._stop_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore + begin_stop.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore def _start_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_start_request_initial( - subscription_id=self._config.subscription_id, + request = build_start_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._start_initial.metadata['url'], + template_url=self._start_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2448,10 +2625,9 @@ def _start_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -2461,24 +2637,19 @@ def _start_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore - + _start_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore @distributed_trace - def begin_start( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> LROPoller[None]: + def begin_start(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> LROPoller[None]: """Starts a previously stopped Managed Cluster. See `starting a cluster `_ for more details about starting a cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -2490,85 +2661,83 @@ def begin_start( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._start_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore + begin_start.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore def _run_command_initial( self, resource_group_name: str, resource_name: str, - request_payload: _models.RunCommandRequest, + request_payload: Union[_models.RunCommandRequest, IO], **kwargs: Any ) -> Optional[_models.RunCommandResult]: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RunCommandResult]] - _json = self._serialize.body(request_payload, 'RunCommandRequest') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(request_payload, (IO, bytes)): + _content = request_payload + else: + _json = self._serialize.body(request_payload, "RunCommandRequest") - request = build_run_command_request_initial( - subscription_id=self._config.subscription_id, + request = build_run_command_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._run_command_initial.metadata['url'], + content=_content, + template_url=self._run_command_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2576,10 +2745,9 @@ def _run_command_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -2588,22 +2756,23 @@ def _run_command_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _run_command_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore + _run_command_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore - - @distributed_trace + @overload def begin_run_command( self, resource_group_name: str, resource_name: str, request_payload: _models.RunCommandRequest, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.RunCommandResult]: """Submits a command to run against the Managed Cluster. @@ -2613,11 +2782,15 @@ def begin_run_command( `_. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param request_payload: The run command request. + :param request_payload: The run command request. Required. :type request_payload: ~azure.mgmt.containerservice.v2022_03_01.models.RunCommandRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -2630,20 +2803,97 @@ def begin_run_command( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_03_01.models.RunCommandResult] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_run_command( + self, + resource_group_name: str, + resource_name: str, + request_payload: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RunCommandResult]: + """Submits a command to run against the Managed Cluster. + + AKS will create a pod to run the command. This is primarily useful for private clusters. For + more information see `AKS Run Command + `_. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param request_payload: The run command request. Required. + :type request_payload: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either RunCommandResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_03_01.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_run_command( + self, + resource_group_name: str, + resource_name: str, + request_payload: Union[_models.RunCommandRequest, IO], + **kwargs: Any + ) -> LROPoller[_models.RunCommandResult]: + """Submits a command to run against the Managed Cluster. + + AKS will create a pod to run the command. This is primarily useful for private clusters. For + more information see `AKS Run Command + `_. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param request_payload: The run command request. Is either a model type or a IO type. Required. + :type request_payload: ~azure.mgmt.containerservice.v2022_03_01.models.RunCommandRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either RunCommandResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_03_01.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.RunCommandResult] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.RunCommandResult] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._run_command_initial( # type: ignore resource_group_name=resource_group_name, @@ -2651,82 +2901,72 @@ def begin_run_command( request_payload=request_payload, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_run_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore + begin_run_command.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore @distributed_trace def get_command_result( - self, - resource_group_name: str, - resource_name: str, - command_id: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, command_id: str, **kwargs: Any ) -> Optional[_models.RunCommandResult]: """Gets the results of a command which has been run on the Managed Cluster. Gets the results of a command which has been run on the Managed Cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param command_id: Id of the command. + :param command_id: Id of the command. Required. :type command_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: RunCommandResult, or the result of cls(response) + :return: RunCommandResult or None or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.RunCommandResult or None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RunCommandResult]] - request = build_get_command_result_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, command_id=command_id, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_command_result.metadata['url'], + template_url=self.get_command_result.metadata["url"], headers=_headers, params=_params, ) @@ -2734,10 +2974,9 @@ def get_command_result( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -2746,23 +2985,19 @@ def get_command_result( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_command_result.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}"} # type: ignore - + get_command_result.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}"} # type: ignore @distributed_trace def list_outbound_network_dependencies_endpoints( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> Iterable[_models.OutboundEnvironmentEndpointCollection]: + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> Iterable["_models.OutboundEnvironmentEndpoint"]: """Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster. @@ -2770,35 +3005,35 @@ def list_outbound_network_dependencies_endpoints( specified managed cluster. The operation returns properties of each egress endpoint. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OutboundEnvironmentEndpointCollection or the - result of cls(response) + :return: An iterator like instance of either OutboundEnvironmentEndpoint or the result of + cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_03_01.models.OutboundEnvironmentEndpointCollection] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_03_01.models.OutboundEnvironmentEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_outbound_network_dependencies_endpoints_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_outbound_network_dependencies_endpoints.metadata['url'], + template_url=self.list_outbound_network_dependencies_endpoints.metadata["url"], headers=_headers, params=_params, ) @@ -2806,16 +3041,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_outbound_network_dependencies_endpoints_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -2831,10 +3061,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2844,8 +3072,6 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_outbound_network_dependencies_endpoints.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints"} # type: ignore + list_outbound_network_dependencies_endpoints.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/operations/_operations.py index e8ef73ce612f..31e3e24c5920 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/operations/_operations.py @@ -7,10 +7,15 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,38 +25,34 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - **kwargs: Any -) -> HttpRequest: + +def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.ContainerService/operations") # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class Operations: """ @@ -72,38 +73,33 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.OperationListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.OperationValue"]: """Gets a list of operations. Gets a list of operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationListResult or the result of cls(response) + :return: An iterator like instance of either OperationValue or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_03_01.models.OperationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_03_01.models.OperationValue] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -111,13 +107,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -133,10 +127,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -146,8 +138,6 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.ContainerService/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ContainerService/operations"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/operations/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/operations/_private_endpoint_connections_operations.py index d3949ddb21f0..c56af3019c00 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/operations/_private_endpoint_connections_operations.py @@ -6,11 +6,15 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod @@ -21,173 +25,199 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - subscription_id: str, resource_group_name: str, resource_name: str, private_endpoint_connection_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_update_request( - subscription_id: str, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, - *, - json: Optional[_models.PrivateEndpointConnection] = None, - content: Any = None, + subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request_initial( - subscription_id: str, +def build_delete_request( resource_group_name: str, resource_name: str, private_endpoint_connection_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class PrivateEndpointConnectionsOperations: """ @@ -208,13 +238,9 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnectionListResult: """Gets a list of private endpoint connections in the specified managed cluster. @@ -222,32 +248,30 @@ def list( https://docs.microsoft.com/azure/aks/private-clusters. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnectionListResult, or the result of cls(response) + :return: PrivateEndpointConnectionListResult or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.PrivateEndpointConnectionListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnectionListResult] - request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -255,33 +279,27 @@ def list( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore - + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore @distributed_trace def get( - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnection: """Gets the specified private endpoint connection. @@ -289,35 +307,33 @@ def get( https://docs.microsoft.com/azure/aks/private-clusters. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -325,33 +341,33 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - @distributed_trace + @overload def update( self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, parameters: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateEndpointConnection: """Updates a private endpoint connection. @@ -359,41 +375,116 @@ def update( Updates a private endpoint connection. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str - :param parameters: The updated private endpoint connection. + :param parameters: The updated private endpoint connection. Required. :type parameters: ~azure.mgmt.containerservice.v2022_03_01.models.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: The updated private endpoint connection. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @distributed_trace + def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: Union[_models.PrivateEndpointConnection, IO], + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: The updated private endpoint connection. Is either a model type or a IO + type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_03_01.models.PrivateEndpointConnection or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - _json = self._serialize.body(parameters, 'PrivateEndpointConnection') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateEndpointConnection") request = build_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update.metadata['url'], + content=_content, + template_url=self.update.metadata["url"], headers=_headers, params=_params, ) @@ -401,52 +492,43 @@ def update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -454,10 +536,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -467,26 +548,22 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + def begin_delete( + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> LROPoller[None]: """Deletes a private endpoint connection. Deletes a private endpoint connection. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -498,53 +575,46 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/operations/_private_link_resources_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/operations/_private_link_resources_operations.py index ceac57a34b42..98814cbbd403 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/operations/_private_link_resources_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/operations/_private_link_resources_operations.py @@ -8,9 +8,13 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -19,48 +23,55 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class PrivateLinkResourcesOperations: """ @@ -81,13 +92,9 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.PrivateLinkResourcesListResult: """Gets a list of private link resources in the specified managed cluster. @@ -95,32 +102,30 @@ def list( https://docs.microsoft.com/azure/aks/private-clusters. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResourcesListResult, or the result of cls(response) + :return: PrivateLinkResourcesListResult or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.PrivateLinkResourcesListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResourcesListResult] - request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -128,22 +133,20 @@ def list( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResourcesListResult', pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources"} # type: ignore - + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/operations/_resolve_private_link_service_id_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/operations/_resolve_private_link_service_id_operations.py index 6b6e6fa5f110..171553672744 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/operations/_resolve_private_link_service_id_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/operations/_resolve_private_link_service_id_operations.py @@ -6,11 +6,15 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -19,56 +23,58 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_post_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.PrivateLinkResource] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + class ResolvePrivateLinkServiceIdOperations: """ @@ -89,13 +95,14 @@ def __init__(self, *args, **kwargs): 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 + @overload def post( self, resource_group_name: str, resource_name: str, parameters: _models.PrivateLinkResource, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateLinkResource: """Gets the private link service ID for the specified managed cluster. @@ -103,38 +110,106 @@ def post( Gets the private link service ID for the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters required in order to resolve a private link service ID. + :param parameters: Parameters required in order to resolve a private link service ID. Required. :type parameters: ~azure.mgmt.containerservice.v2022_03_01.models.PrivateLinkResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResource, or the result of cls(response) + :return: PrivateLinkResource or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.PrivateLinkResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + def post( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID for the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters required in order to resolve a private link service ID. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def post( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.PrivateLinkResource, IO], + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID for the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters required in order to resolve a private link service ID. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_03_01.models.PrivateLinkResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResource] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResource] - _json = self._serialize.body(parameters, 'PrivateLinkResource') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateLinkResource") request = build_post_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.post.metadata['url'], + content=_content, + template_url=self.post.metadata["url"], headers=_headers, params=_params, ) @@ -142,22 +217,20 @@ def post( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResource', pipeline_response) + deserialized = self._deserialize("PrivateLinkResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - post.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId"} # type: ignore - + post.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/operations/_snapshots_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/operations/_snapshots_operations.py index 557a335d3fc4..f1466add7fb5 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/operations/_snapshots_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/operations/_snapshots_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,243 +25,233 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots") path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_resource_group_request( - subscription_id: str, - resource_group_name: str, - **kwargs: Any -) -> HttpRequest: +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: + _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, resource_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.Snapshot] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_update_tags_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.TagsObject] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class SnapshotsOperations: """ @@ -277,39 +272,33 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.SnapshotListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.Snapshot"]: """Gets a list of snapshots in the specified subscription. Gets a list of snapshots in the specified subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SnapshotListResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_03_01.models.SnapshotListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either Snapshot or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_03_01.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SnapshotListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -317,14 +306,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -340,10 +326,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -353,48 +337,41 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots"} # type: ignore @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> Iterable[_models.SnapshotListResult]: + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Snapshot"]: """Lists snapshots in the specified subscription and resource group. Lists snapshots in the specified subscription and resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SnapshotListResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_03_01.models.SnapshotListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either Snapshot or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_03_01.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SnapshotListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -402,15 +379,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -426,10 +399,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -439,50 +410,41 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots"} # type: ignore @distributed_trace - def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.Snapshot: + def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.Snapshot: """Gets a snapshot. Gets a snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Snapshot, or the result of cls(response) + :return: Snapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.Snapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -490,32 +452,32 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - - @distributed_trace + @overload def create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.Snapshot, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.Snapshot: """Creates or updates a snapshot. @@ -523,38 +485,102 @@ def create_or_update( Creates or updates a snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The snapshot to create or update. + :param parameters: The snapshot to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_03_01.models.Snapshot + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Snapshot, or the result of cls(response) + :return: Snapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.Snapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Snapshot: + """Creates or updates a snapshot. + + Creates or updates a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The snapshot to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.Snapshot, IO], **kwargs: Any + ) -> _models.Snapshot: + """Creates or updates a snapshot. + + Creates or updates a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The snapshot to create or update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.mgmt.containerservice.v2022_03_01.models.Snapshot or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] - _json = self._serialize.body(parameters, 'Snapshot') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "Snapshot") request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) @@ -562,10 +588,9 @@ def create_or_update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -573,25 +598,26 @@ def create_or_update( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - - @distributed_trace + @overload def update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.Snapshot: """Updates tags on a snapshot. @@ -599,38 +625,102 @@ def update_tags( Updates tags on a snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update snapshot Tags operation. + :param parameters: Parameters supplied to the Update snapshot Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2022_03_01.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Snapshot, or the result of cls(response) + :return: Snapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.Snapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + def update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Snapshot: + """Updates tags on a snapshot. + + Updates tags on a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update snapshot Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> _models.Snapshot: + """Updates tags on a snapshot. + + Updates tags on a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update snapshot Tags operation. Is either a model + type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_03_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") request = build_update_tags_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_tags.metadata['url'], + content=_content, + template_url=self.update_tags.metadata["url"], headers=_headers, params=_params, ) @@ -638,64 +728,57 @@ def update_tags( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - + update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore @distributed_trace def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: """Deletes a snapshot. Deletes a snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) @@ -703,10 +786,9 @@ def delete( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -716,5 +798,4 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - + delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/__init__.py index 37a5f9e02e6f..a8716d29afe8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/__init__.py @@ -14,7 +14,8 @@ except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['ContainerServiceClient'] + +__all__ = ["ContainerServiceClient"] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/_configuration.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/_configuration.py index d20d57aaffc3..11076b348f4b 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/_configuration.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/_configuration.py @@ -18,29 +18,25 @@ VERSION = "unknown" + class ContainerServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ContainerServiceClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :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. + :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2022-03-02-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: + def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ContainerServiceClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + api_version = kwargs.pop("api_version", "2022-03-02-preview") # type: str if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -50,23 +46,24 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-containerservice/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-containerservice/{}".format(VERSION)) self._configure(**kwargs) def _configure( - self, - **kwargs # type: Any + self, **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/_container_service_client.py index a1f62cb0b98f..05fcce23d53c 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/_container_service_client.py @@ -9,20 +9,30 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from . import models +from .._serialization import Deserializer, Serializer from ._configuration import ContainerServiceClientConfiguration -from .operations import AgentPoolsOperations, MaintenanceConfigurationsOperations, ManagedClusterSnapshotsOperations, ManagedClustersOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, ResolvePrivateLinkServiceIdOperations, SnapshotsOperations +from .operations import ( + AgentPoolsOperations, + MaintenanceConfigurationsOperations, + ManagedClusterSnapshotsOperations, + ManagedClustersOperations, + Operations, + PrivateEndpointConnectionsOperations, + PrivateLinkResourcesOperations, + ResolvePrivateLinkServiceIdOperations, + SnapshotsOperations, +) if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class ContainerServiceClient: # pylint: disable=too-many-instance-attributes + +class ContainerServiceClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """The Container Service Client. :ivar operations: Operations operations @@ -51,9 +61,9 @@ class ContainerServiceClient: # pylint: disable=too-many-instance-attributes :ivar managed_cluster_snapshots: ManagedClusterSnapshotsOperations operations :vartype managed_cluster_snapshots: azure.mgmt.containerservice.v2022_03_02_preview.operations.ManagedClusterSnapshotsOperations - :param credential: Credential needed for the client to connect to Azure. + :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. + :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -71,25 +81,23 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = ContainerServiceClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = ContainerServiceClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize - ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.managed_clusters = ManagedClustersOperations( self._client, self._config, self._serialize, self._deserialize ) self.maintenance_configurations = MaintenanceConfigurationsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.agent_pools = AgentPoolsOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) self.private_endpoint_connections = PrivateEndpointConnectionsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -99,19 +107,12 @@ def __init__( self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations( self._client, self._config, self._serialize, self._deserialize ) - self.snapshots = SnapshotsOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.snapshots = SnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) self.managed_cluster_snapshots = ManagedClusterSnapshotsOperations( self._client, self._config, self._serialize, self._deserialize ) - - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> HttpResponse: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -120,7 +121,7 @@ def _send_request( >>> response = client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/_metadata.json b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/_metadata.json index 8d9cf1129609..25010001c1b8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/_metadata.json +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/_metadata.json @@ -10,20 +10,20 @@ "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { "credential": { - "signature": "credential, # type: \"TokenCredential\"", - "description": "Credential needed for the client to connect to Azure.", + "signature": "credential: \"TokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true }, "subscription_id": { - "signature": "subscription_id, # type: str", - "description": "The ID of the target subscription.", + "signature": "subscription_id: str,", + "description": "The ID of the target subscription. Required.", "docstring_type": "str", "required": true } @@ -31,13 +31,13 @@ "async": { "credential": { "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure.", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { "signature": "subscription_id: str,", - "description": "The ID of the target subscription.", + "description": "The ID of the target subscription. Required.", "docstring_type": "str", "required": true } @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=\"https://management.azure.com\", # type: str", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/_patch.py index 74e48ecd07cf..f99e77fef986 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/_patch.py @@ -28,4 +28,4 @@ # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + pass diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/_vendor.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/_vendor.py index 138f663c53a4..9aad73fc743e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/_vendor.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/_vendor.py @@ -7,6 +7,7 @@ from azure.core.pipeline.transport import HttpRequest + def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) @@ -14,6 +15,7 @@ def _convert_request(request, files=None): request.set_formdata_body(files) return request + def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -21,7 +23,5 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [ - c for c in formatted_components if "{}".format(key.args[0]) not in c - ] + components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/__init__.py index 37a5f9e02e6f..a8716d29afe8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/__init__.py @@ -14,7 +14,8 @@ except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['ContainerServiceClient'] + +__all__ = ["ContainerServiceClient"] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/_configuration.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/_configuration.py index 85e544452979..75d0806611a4 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/_configuration.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/_configuration.py @@ -18,29 +18,25 @@ VERSION = "unknown" + class ContainerServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ContainerServiceClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :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. + :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2022-03-02-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: + def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ContainerServiceClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + api_version = kwargs.pop("api_version", "2022-03-02-preview") # type: str if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -50,22 +46,21 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-containerservice/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-containerservice/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, - **kwargs: Any - ) -> None: - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/_container_service_client.py index 5dd5814523b8..2083fabb8e85 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/_container_service_client.py @@ -9,20 +9,30 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from .. import models +from ..._serialization import Deserializer, Serializer from ._configuration import ContainerServiceClientConfiguration -from .operations import AgentPoolsOperations, MaintenanceConfigurationsOperations, ManagedClusterSnapshotsOperations, ManagedClustersOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, ResolvePrivateLinkServiceIdOperations, SnapshotsOperations +from .operations import ( + AgentPoolsOperations, + MaintenanceConfigurationsOperations, + ManagedClusterSnapshotsOperations, + ManagedClustersOperations, + Operations, + PrivateEndpointConnectionsOperations, + PrivateLinkResourcesOperations, + ResolvePrivateLinkServiceIdOperations, + SnapshotsOperations, +) if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class ContainerServiceClient: # pylint: disable=too-many-instance-attributes + +class ContainerServiceClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """The Container Service Client. :ivar operations: Operations operations @@ -51,9 +61,9 @@ class ContainerServiceClient: # pylint: disable=too-many-instance-attributes :ivar managed_cluster_snapshots: ManagedClusterSnapshotsOperations operations :vartype managed_cluster_snapshots: azure.mgmt.containerservice.v2022_03_02_preview.aio.operations.ManagedClusterSnapshotsOperations - :param credential: Credential needed for the client to connect to Azure. + :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. + :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -71,25 +81,23 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = ContainerServiceClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = ContainerServiceClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize - ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.managed_clusters = ManagedClustersOperations( self._client, self._config, self._serialize, self._deserialize ) self.maintenance_configurations = MaintenanceConfigurationsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.agent_pools = AgentPoolsOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) self.private_endpoint_connections = PrivateEndpointConnectionsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -99,19 +107,12 @@ def __init__( self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations( self._client, self._config, self._serialize, self._deserialize ) - self.snapshots = SnapshotsOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.snapshots = SnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) self.managed_cluster_snapshots = ManagedClusterSnapshotsOperations( self._client, self._config, self._serialize, self._deserialize ) - - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -120,7 +121,7 @@ def _send_request( >>> response = await client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/_patch.py index 74e48ecd07cf..f99e77fef986 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/_patch.py @@ -28,4 +28,4 @@ # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + pass diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/operations/__init__.py index d3b41c8a72b0..02682f76ce58 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/operations/__init__.py @@ -19,16 +19,17 @@ from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'Operations', - 'ManagedClustersOperations', - 'MaintenanceConfigurationsOperations', - 'AgentPoolsOperations', - 'PrivateEndpointConnectionsOperations', - 'PrivateLinkResourcesOperations', - 'ResolvePrivateLinkServiceIdOperations', - 'SnapshotsOperations', - 'ManagedClusterSnapshotsOperations', + "Operations", + "ManagedClustersOperations", + "MaintenanceConfigurationsOperations", + "AgentPoolsOperations", + "PrivateEndpointConnectionsOperations", + "PrivateLinkResourcesOperations", + "ResolvePrivateLinkServiceIdOperations", + "SnapshotsOperations", + "ManagedClusterSnapshotsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/operations/_agent_pools_operations.py index c502cd3cd65c..50cbc1aff1b2 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/operations/_agent_pools_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +29,20 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._agent_pools_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_available_agent_pool_versions_request, build_get_request, build_get_upgrade_profile_request, build_list_request, build_upgrade_node_image_version_request_initial -T = TypeVar('T') +from ...operations._agent_pools_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_available_agent_pool_versions_request, + build_get_request, + build_get_upgrade_profile_request, + build_list_request, + build_upgrade_node_image_version_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class AgentPoolsOperations: """ .. warning:: @@ -45,47 +62,41 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.AgentPoolListResult]: + def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncIterable["_models.AgentPool"]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AgentPoolListResult or the result of cls(response) + :return: An iterator like instance of either AgentPool or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_03_02_preview.models.AgentPoolListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_03_02_preview.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -93,16 +104,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -118,10 +124,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -131,54 +135,46 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore @distributed_trace_async async def get( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPool: """Gets the specified managed cluster agent pool. Gets the specified managed cluster agent pool. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPool, or the result of cls(response) + :return: AgentPool or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.AgentPool - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -186,57 +182,60 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore async def _create_or_update_initial( self, resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: _models.AgentPool, + parameters: Union[_models.AgentPool, IO], **kwargs: Any ) -> _models.AgentPool: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - _json = self._serialize.body(parameters, 'AgentPool') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "AgentPool") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -244,10 +243,9 @@ async def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -255,26 +253,27 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - - @distributed_trace_async + @overload async def begin_create_or_update( self, resource_group_name: str, resource_name: str, agent_pool_name: str, parameters: _models.AgentPool, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.AgentPool]: """Creates or updates an agent pool in the specified managed cluster. @@ -282,13 +281,59 @@ async def begin_create_or_update( Creates or updates an agent pool in the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str - :param parameters: The agent pool to create or update. + :param parameters: The agent pool to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_03_02_preview.models.AgentPool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AgentPool or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_03_02_preview.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AgentPool]: + """Creates or updates an agent pool in the specified managed cluster. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: The agent pool to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -301,20 +346,58 @@ async def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_03_02_preview.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: Union[_models.AgentPool, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.AgentPool]: + """Creates or updates an agent pool in the specified managed cluster. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: The agent pool to create or update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.mgmt.containerservice.v2022_03_02_preview.models.AgentPool or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AgentPool or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_03_02_preview.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -323,39 +406,35 @@ async def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements self, @@ -365,26 +444,23 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements ignore_pod_disruption_budget: Optional[bool] = None, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, - api_version=api_version, + subscription_id=self._config.subscription_id, ignore_pod_disruption_budget=ignore_pod_disruption_budget, - template_url=self._delete_initial.metadata['url'], + api_version=api_version, + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -392,10 +468,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -405,11 +480,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements + async def begin_delete( self, resource_group_name: str, resource_name: str, @@ -422,10 +496,11 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Deletes an agent pool in the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :param ignore_pod_disruption_budget: ignore-pod-disruption-budget=true to delete those pods on a node without considering Pod Disruption Budget. Default value is None. @@ -440,19 +515,16 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -460,80 +532,70 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements agent_pool_name=agent_pool_name, ignore_pod_disruption_budget=ignore_pod_disruption_budget, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace_async async def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPoolUpgradeProfile: """Gets the upgrade profile for an agent pool. Gets the upgrade profile for an agent pool. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolUpgradeProfile, or the result of cls(response) + :return: AgentPoolUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.AgentPoolUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -541,32 +603,27 @@ async def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolUpgradeProfile', pipeline_response) + deserialized = self._deserialize("AgentPoolUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore @distributed_trace_async async def get_available_agent_pool_versions( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported Kubernetes versions for the specified agent pool. @@ -575,32 +632,30 @@ async def get_available_agent_pool_versions( the version lifecycle. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolAvailableVersions, or the result of cls(response) + :return: AgentPoolAvailableVersions or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.AgentPoolAvailableVersions - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolAvailableVersions] - request = build_get_available_agent_pool_versions_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_available_agent_pool_versions.metadata['url'], + template_url=self.get_available_agent_pool_versions.metadata["url"], headers=_headers, params=_params, ) @@ -608,52 +663,43 @@ async def get_available_agent_pool_versions( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolAvailableVersions', pipeline_response) + deserialized = self._deserialize("AgentPoolAvailableVersions", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_available_agent_pool_versions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore - + get_available_agent_pool_versions.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore async def _upgrade_node_image_version_initial( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> Optional[_models.AgentPool]: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.AgentPool]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.AgentPool]] - - request = build_upgrade_node_image_version_request_initial( - subscription_id=self._config.subscription_id, + request = build_upgrade_node_image_version_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._upgrade_node_image_version_initial.metadata['url'], + template_url=self._upgrade_node_image_version_initial.metadata["url"], headers=_headers, params=_params, ) @@ -661,10 +707,9 @@ async def _upgrade_node_image_version_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -674,26 +719,23 @@ async def _upgrade_node_image_version_initial( deserialized = None response_headers = {} if response.status_code == 202: - response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) - - deserialized = self._deserialize('AgentPool', pipeline_response) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _upgrade_node_image_version_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore - + _upgrade_node_image_version_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore @distributed_trace_async async def begin_upgrade_node_image_version( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any - ) -> AsyncLROPoller[_models.AgentPool]: + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: """Upgrades the node image version of an agent pool to the latest. Upgrading the node image version of an agent pool applies the newest OS and runtime updates to @@ -701,10 +743,11 @@ async def begin_upgrade_node_image_version( node image versions, see: https://docs.microsoft.com/azure/aks/node-image-upgrade. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -718,59 +761,54 @@ async def begin_upgrade_node_image_version( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_03_02_preview.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._upgrade_node_image_version_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) - - deserialized = self._deserialize('AgentPool', pipeline_response) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_upgrade_node_image_version.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore + begin_upgrade_node_image_version.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/operations/_maintenance_configurations_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/operations/_maintenance_configurations_operations.py index a112084f6555..93509d4581e6 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/operations/_maintenance_configurations_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/operations/_maintenance_configurations_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,10 +27,17 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._maintenance_configurations_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_managed_cluster_request -T = TypeVar('T') +from ...operations._maintenance_configurations_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_managed_cluster_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class MaintenanceConfigurationsOperations: """ .. warning:: @@ -43,48 +57,44 @@ def __init__(self, *args, **kwargs) -> None: 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_managed_cluster( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.MaintenanceConfigurationListResult]: + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> AsyncIterable["_models.MaintenanceConfiguration"]: """Gets a list of maintenance configurations in the specified managed cluster. Gets a list of maintenance configurations in the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either MaintenanceConfigurationListResult or the result - of cls(response) + :return: An iterator like instance of either MaintenanceConfiguration or the result of + cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_03_02_preview.models.MaintenanceConfigurationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_03_02_preview.models.MaintenanceConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfigurationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfigurationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_managed_cluster_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_managed_cluster.metadata['url'], + template_url=self.list_by_managed_cluster.metadata["url"], headers=_headers, params=_params, ) @@ -92,16 +102,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_managed_cluster_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -117,10 +122,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -130,54 +133,46 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_managed_cluster.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations"} # type: ignore + list_by_managed_cluster.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations"} # type: ignore @distributed_trace_async async def get( - self, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, config_name: str, **kwargs: Any ) -> _models.MaintenanceConfiguration: """Gets the specified maintenance configuration of a managed cluster. Gets the specified maintenance configuration of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: MaintenanceConfiguration, or the result of cls(response) + :return: MaintenanceConfiguration or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.MaintenanceConfiguration - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfiguration] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -185,33 +180,33 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) + deserialized = self._deserialize("MaintenanceConfiguration", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - @distributed_trace_async + @overload async def create_or_update( self, resource_group_name: str, resource_name: str, config_name: str, parameters: _models.MaintenanceConfiguration, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.MaintenanceConfiguration: """Creates or updates a maintenance configuration in the specified managed cluster. @@ -219,42 +214,117 @@ async def create_or_update( Creates or updates a maintenance configuration in the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str - :param parameters: The maintenance configuration to create or update. + :param parameters: The maintenance configuration to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_03_02_preview.models.MaintenanceConfiguration + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configuration in the specified managed cluster. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: The maintenance configuration to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: MaintenanceConfiguration, or the result of cls(response) + :return: MaintenanceConfiguration or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.MaintenanceConfiguration - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: Union[_models.MaintenanceConfiguration, IO], + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configuration in the specified managed cluster. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: The maintenance configuration to create or update. Is either a model type or + a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2022_03_02_preview.models.MaintenanceConfiguration or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfiguration] - _json = self._serialize.body(parameters, 'MaintenanceConfiguration') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "MaintenanceConfiguration") request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) @@ -262,68 +332,60 @@ async def create_or_update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) + deserialized = self._deserialize("MaintenanceConfiguration", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, config_name: str, **kwargs: Any ) -> None: """Deletes a maintenance configuration. Deletes a maintenance configuration. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) @@ -331,10 +393,9 @@ async def delete( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -344,5 +405,4 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/operations/_managed_cluster_snapshots_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/operations/_managed_cluster_snapshots_operations.py index 442aef9fd5cb..eda90e8b1f2f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/operations/_managed_cluster_snapshots_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/operations/_managed_cluster_snapshots_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,10 +27,19 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._managed_cluster_snapshots_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_resource_group_request, build_list_request, build_update_tags_request -T = TypeVar('T') +from ...operations._managed_cluster_snapshots_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_resource_group_request, + build_list_request, + build_update_tags_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class ManagedClusterSnapshotsOperations: """ .. warning:: @@ -43,40 +59,35 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.ManagedClusterSnapshotListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.ManagedClusterSnapshot"]: """Gets a list of managed cluster snapshots in the specified subscription. Gets a list of managed cluster snapshots in the specified subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterSnapshotListResult or the result of + :return: An iterator like instance of either ManagedClusterSnapshot or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedClusterSnapshotListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedClusterSnapshot] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshotListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterSnapshotListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -84,14 +95,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -107,10 +115,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -120,49 +126,45 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedclustersnapshots"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedclustersnapshots"} # type: ignore @distributed_trace def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.ManagedClusterSnapshotListResult]: + self, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ManagedClusterSnapshot"]: """Lists managed cluster snapshots in the specified subscription and resource group. Lists managed cluster snapshots in the specified subscription and resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterSnapshotListResult or the result of + :return: An iterator like instance of either ManagedClusterSnapshot or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedClusterSnapshotListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedClusterSnapshot] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshotListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterSnapshotListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -170,15 +172,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -194,10 +192,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -207,50 +203,41 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots"} # type: ignore @distributed_trace_async - async def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.ManagedClusterSnapshot: + async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.ManagedClusterSnapshot: """Gets a managed cluster snapshot. Gets a managed cluster snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterSnapshot, or the result of cls(response) + :return: ManagedClusterSnapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedClusterSnapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterSnapshot] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -258,32 +245,32 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterSnapshot', pipeline_response) + deserialized = self._deserialize("ManagedClusterSnapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"} # type: ignore - @distributed_trace_async + @overload async def create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterSnapshot, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.ManagedClusterSnapshot: """Creates or updates a managed cluster snapshot. @@ -291,39 +278,108 @@ async def create_or_update( Creates or updates a managed cluster snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The managed cluster snapshot to create or update. + :param parameters: The managed cluster snapshot to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedClusterSnapshot + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedClusterSnapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedClusterSnapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ManagedClusterSnapshot: + """Creates or updates a managed cluster snapshot. + + Creates or updates a managed cluster snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster snapshot to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedClusterSnapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedClusterSnapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterSnapshot, IO], + **kwargs: Any + ) -> _models.ManagedClusterSnapshot: + """Creates or updates a managed cluster snapshot. + + Creates or updates a managed cluster snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster snapshot to create or update. Is either a model type or + a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedClusterSnapshot or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterSnapshot, or the result of cls(response) + :return: ManagedClusterSnapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedClusterSnapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterSnapshot] - _json = self._serialize.body(parameters, 'ManagedClusterSnapshot') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterSnapshot") request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) @@ -331,10 +387,9 @@ async def create_or_update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -342,25 +397,26 @@ async def create_or_update( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ManagedClusterSnapshot', pipeline_response) + deserialized = self._deserialize("ManagedClusterSnapshot", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('ManagedClusterSnapshot', pipeline_response) + deserialized = self._deserialize("ManagedClusterSnapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"} # type: ignore - + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"} # type: ignore - @distributed_trace_async + @overload async def update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.ManagedClusterSnapshot: """Updates tags on a managed cluster snapshot. @@ -368,38 +424,104 @@ async def update_tags( Updates tags on a managed cluster snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Update managed cluster snapshot Tags operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2022_03_02_preview.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedClusterSnapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedClusterSnapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ManagedClusterSnapshot: + """Updates tags on a managed cluster snapshot. + + Updates tags on a managed cluster snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update managed cluster snapshot Tags operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterSnapshot, or the result of cls(response) + :return: ManagedClusterSnapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedClusterSnapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @distributed_trace_async + async def update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> _models.ManagedClusterSnapshot: + """Updates tags on a managed cluster snapshot. + + Updates tags on a managed cluster snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update managed cluster snapshot Tags operation. + Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_03_02_preview.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedClusterSnapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedClusterSnapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterSnapshot] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") request = build_update_tags_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_tags.metadata['url'], + content=_content, + template_url=self.update_tags.metadata["url"], headers=_headers, params=_params, ) @@ -407,64 +529,57 @@ async def update_tags( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterSnapshot', pipeline_response) + deserialized = self._deserialize("ManagedClusterSnapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"} # type: ignore - + update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"} # type: ignore @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: """Deletes a managed cluster snapshot. Deletes a managed cluster snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) @@ -472,10 +587,9 @@ async def delete( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -485,5 +599,4 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"} # type: ignore - + delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/operations/_managed_clusters_operations.py index e4fcdbd1ad8d..4b445e715d9e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/operations/_managed_clusters_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +29,34 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._managed_clusters_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_access_profile_request, build_get_command_result_request, build_get_os_options_request, build_get_request, build_get_upgrade_profile_request, build_list_by_resource_group_request, build_list_cluster_admin_credentials_request, build_list_cluster_monitoring_user_credentials_request, build_list_cluster_user_credentials_request, build_list_outbound_network_dependencies_endpoints_request, build_list_request, build_reset_aad_profile_request_initial, build_reset_service_principal_profile_request_initial, build_rotate_cluster_certificates_request_initial, build_rotate_service_account_signing_keys_request_initial, build_run_command_request_initial, build_start_request_initial, build_stop_request_initial, build_update_tags_request_initial -T = TypeVar('T') +from ...operations._managed_clusters_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_access_profile_request, + build_get_command_result_request, + build_get_os_options_request, + build_get_request, + build_get_upgrade_profile_request, + build_list_by_resource_group_request, + build_list_cluster_admin_credentials_request, + build_list_cluster_monitoring_user_credentials_request, + build_list_cluster_user_credentials_request, + build_list_outbound_network_dependencies_endpoints_request, + build_list_request, + build_reset_aad_profile_request, + build_reset_service_principal_profile_request, + build_rotate_cluster_certificates_request, + build_rotate_service_account_signing_keys_request, + build_run_command_request, + build_start_request, + build_stop_request, + build_update_tags_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class ManagedClustersOperations: # pylint: disable=too-many-public-methods """ .. warning:: @@ -45,46 +76,39 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async async def get_os_options( - self, - location: str, - resource_type: Optional[str] = None, - **kwargs: Any + self, location: str, resource_type: Optional[str] = None, **kwargs: Any ) -> _models.OSOptionProfile: """Gets supported OS options in the specified subscription. Gets supported OS options in the specified subscription. - :param location: The name of Azure region. + :param location: The name of Azure region. Required. :type location: str :param resource_type: The resource type for which the OS options needs to be returned. Default value is None. :type resource_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: OSOptionProfile, or the result of cls(response) + :return: OSOptionProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.OSOptionProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OSOptionProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OSOptionProfile] - request = build_get_os_options_request( - subscription_id=self._config.subscription_id, location=location, - api_version=api_version, + subscription_id=self._config.subscription_id, resource_type=resource_type, - template_url=self.get_os_options.metadata['url'], + api_version=api_version, + template_url=self.get_os_options.metadata["url"], headers=_headers, params=_params, ) @@ -92,59 +116,52 @@ async def get_os_options( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('OSOptionProfile', pipeline_response) + deserialized = self._deserialize("OSOptionProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_os_options.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default"} # type: ignore - + get_os_options.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default"} # type: ignore @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.ManagedClusterListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.ManagedCluster"]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -152,14 +169,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -175,10 +189,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -188,49 +200,44 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.ManagedClusterListResult]: + self, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ManagedCluster"]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -238,15 +245,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -262,10 +265,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -275,50 +276,43 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace_async async def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.ManagedClusterUpgradeProfile: """Gets the upgrade profile of a managed cluster. Gets the upgrade profile of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterUpgradeProfile, or the result of cls(response) + :return: ManagedClusterUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedClusterUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -326,33 +320,27 @@ async def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterUpgradeProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore @distributed_trace_async async def get_access_profile( - self, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, role_name: str, **kwargs: Any ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. @@ -362,35 +350,33 @@ async def get_access_profile( `_ . :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param role_name: The name of the role for managed cluster accessProfile resource. + :param role_name: The name of the role for managed cluster accessProfile resource. Required. :type role_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterAccessProfile, or the result of cls(response) + :return: ManagedClusterAccessProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedClusterAccessProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterAccessProfile] - request = build_get_access_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, role_name=role_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_access_profile.metadata['url'], + template_url=self.get_access_profile.metadata["url"], headers=_headers, params=_params, ) @@ -398,68 +384,60 @@ async def get_access_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterAccessProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterAccessProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_access_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore - + get_access_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore @distributed_trace_async async def list_cluster_admin_credentials( - self, - resource_group_name: str, - resource_name: str, - server_fqdn: Optional[str] = None, - **kwargs: Any + self, resource_group_name: str, resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any ) -> _models.CredentialResults: """Lists the admin credentials of a managed cluster. Lists the admin credentials of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_admin_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, - template_url=self.list_cluster_admin_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_admin_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -467,25 +445,23 @@ async def list_cluster_admin_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_admin_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore - + list_cluster_admin_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore @distributed_trace_async async def list_cluster_user_credentials( @@ -501,40 +477,39 @@ async def list_cluster_user_credentials( Lists the user credentials of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :param format: Only apply to AAD clusters, specifies the format of returned kubeconfig. Format 'azure' will return azure auth-provider kubeconfig; format 'exec' will return exec format - kubeconfig, which requires kubelogin binary in the path. Default value is None. + kubeconfig, which requires kubelogin binary in the path. Known values are: "azure" and "exec". + Default value is None. :type format: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.Format :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, format=format, - template_url=self.list_cluster_user_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -542,68 +517,60 @@ async def list_cluster_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore - + list_cluster_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore @distributed_trace_async async def list_cluster_monitoring_user_credentials( - self, - resource_group_name: str, - resource_name: str, - server_fqdn: Optional[str] = None, - **kwargs: Any + self, resource_group_name: str, resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any ) -> _models.CredentialResults: """Lists the cluster monitoring user credentials of a managed cluster. Lists the cluster monitoring user credentials of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_monitoring_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, - template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_monitoring_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -611,64 +578,55 @@ async def list_cluster_monitoring_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_monitoring_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore - + list_cluster_monitoring_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore @distributed_trace_async - async def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.ManagedCluster: + async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.ManagedCluster: """Gets a managed cluster. Gets a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedCluster, or the result of cls(response) + :return: ManagedCluster or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedCluster - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -676,55 +634,54 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _create_or_update_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.ManagedCluster, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'ManagedCluster') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedCluster") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -732,10 +689,9 @@ async def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -743,25 +699,26 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - @distributed_trace_async + @overload async def begin_create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedCluster, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. @@ -769,11 +726,88 @@ async def begin_create_or_update( Creates or updates a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The managed cluster to create or update. + :param parameters: The managed cluster to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedCluster + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster to create or update. Is either a model type or a IO + type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedCluster or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -786,20 +820,17 @@ async def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -807,69 +838,66 @@ async def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _update_tags_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.TagsObject, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request_initial( - subscription_id=self._config.subscription_id, + request = build_update_tags_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_tags_initial.metadata['url'], + content=_content, + template_url=self._update_tags_initial.metadata["url"], headers=_headers, params=_params, ) @@ -877,32 +905,32 @@ async def _update_tags_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_tags_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _update_tags_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - @distributed_trace_async + @overload async def begin_update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. @@ -910,11 +938,88 @@ async def begin_update_tags( Updates tags on a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2022_03_02_preview.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates tags on a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates tags on a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_03_02_preview.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -927,20 +1032,17 @@ async def begin_update_tags( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, @@ -948,39 +1050,35 @@ async def begin_update_tags( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements self, @@ -989,25 +1087,22 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements ignore_pod_disruption_budget: Optional[bool] = None, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, ignore_pod_disruption_budget=ignore_pod_disruption_budget, - template_url=self._delete_initial.metadata['url'], + api_version=api_version, + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1015,10 +1110,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1028,11 +1122,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements + async def begin_delete( self, resource_group_name: str, resource_name: str, @@ -1044,8 +1137,9 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Deletes a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param ignore_pod_disruption_budget: ignore-pod-disruption-budget=true to delete those pods on a node without considering Pod Disruption Budget. Default value is None. @@ -1060,86 +1154,84 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, ignore_pod_disruption_budget=ignore_pod_disruption_budget, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterServicePrincipalProfile, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterServicePrincipalProfile") - request = build_reset_service_principal_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_service_principal_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_service_principal_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_service_principal_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1147,10 +1239,9 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1160,15 +1251,89 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist if cls: return cls(pipeline_response, None, {}) - _reset_service_principal_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + _reset_service_principal_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + + @overload + async def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.ManagedClusterServicePrincipalProfile, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset the Service Principal Profile of a managed cluster. + + This action cannot be performed on a cluster that is not using a service principal. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The service principal profile to set on the managed cluster. Required. + :type parameters: + ~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedClusterServicePrincipalProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset the Service Principal Profile of a managed cluster. + + This action cannot be performed on a cluster that is not using a service principal. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The service principal profile to set on the managed cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async - async def begin_reset_service_principal_profile( # pylint: disable=inconsistent-return-statements + async def begin_reset_service_principal_profile( self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterServicePrincipalProfile, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], **kwargs: Any ) -> AsyncLROPoller[None]: """Reset the Service Principal Profile of a managed cluster. @@ -1176,12 +1341,18 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent This action cannot be performed on a cluster that is not using a service principal. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The service principal profile to set on the managed cluster. + :param parameters: The service principal profile to set on the managed cluster. Is either a + model type or a IO type. Required. :type parameters: ~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedClusterServicePrincipalProfile + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -1192,20 +1363,17 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1213,67 +1381,68 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_service_principal_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + begin_reset_service_principal_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterAADProfile, + parameters: Union[_models.ManagedClusterAADProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterAADProfile") - request = build_reset_aad_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_aad_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_aad_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_aad_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1281,10 +1450,9 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1294,15 +1462,16 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta if cls: return cls(pipeline_response, None, {}) - _reset_aad_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + _reset_aad_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - - @distributed_trace_async - async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements + @overload + async def begin_reset_aad_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterAADProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: """Reset the AAD Profile of a managed cluster. @@ -1310,12 +1479,53 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem Reset the AAD Profile of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The AAD profile to set on the Managed Cluster. + :param parameters: The AAD profile to set on the Managed Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedClusterAADProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset the AAD Profile of a managed cluster. + + Reset the AAD Profile of a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The AAD profile to set on the Managed Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -1326,20 +1536,54 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterAADProfile, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset the AAD Profile of a managed cluster. + + Reset the AAD Profile of a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The AAD profile to set on the Managed Cluster. Is either a model type or a + IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedClusterAADProfile or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1347,62 +1591,52 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_aad_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + begin_reset_aad_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_rotate_cluster_certificates_request_initial( - subscription_id=self._config.subscription_id, + request = build_rotate_cluster_certificates_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._rotate_cluster_certificates_initial.metadata['url'], + template_url=self._rotate_cluster_certificates_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1410,10 +1644,9 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1423,15 +1656,11 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- if cls: return cls(pipeline_response, None, {}) - _rotate_cluster_certificates_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore - + _rotate_cluster_certificates_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore @distributed_trace_async - async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + async def begin_rotate_cluster_certificates( + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Rotates the certificates of a managed cluster. @@ -1439,8 +1668,9 @@ async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-ret more details about rotating managed cluster certificates. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1452,80 +1682,67 @@ async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-ret Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._rotate_cluster_certificates_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_rotate_cluster_certificates.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore + begin_rotate_cluster_certificates.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore async def _rotate_service_account_signing_keys_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_rotate_service_account_signing_keys_request_initial( - subscription_id=self._config.subscription_id, + request = build_rotate_service_account_signing_keys_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._rotate_service_account_signing_keys_initial.metadata['url'], + template_url=self._rotate_service_account_signing_keys_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1533,10 +1750,9 @@ async def _rotate_service_account_signing_keys_initial( # pylint: disable=incon request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1546,23 +1762,20 @@ async def _rotate_service_account_signing_keys_initial( # pylint: disable=incon if cls: return cls(pipeline_response, None, {}) - _rotate_service_account_signing_keys_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateServiceAccountSigningKeys"} # type: ignore - + _rotate_service_account_signing_keys_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateServiceAccountSigningKeys"} # type: ignore @distributed_trace_async - async def begin_rotate_service_account_signing_keys( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + async def begin_rotate_service_account_signing_keys( + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Rotates the service account signing keys of a managed cluster. Rotates the service account signing keys of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1574,80 +1787,67 @@ async def begin_rotate_service_account_signing_keys( # pylint: disable=inconsis Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._rotate_service_account_signing_keys_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_rotate_service_account_signing_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateServiceAccountSigningKeys"} # type: ignore + begin_rotate_service_account_signing_keys.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateServiceAccountSigningKeys"} # type: ignore async def _stop_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_stop_request_initial( - subscription_id=self._config.subscription_id, + request = build_stop_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._stop_initial.metadata['url'], + template_url=self._stop_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1655,10 +1855,9 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1668,16 +1867,10 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore - + _stop_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore @distributed_trace_async - async def begin_stop( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: + async def begin_stop(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Stops a Managed Cluster. This can only be performed on Azure Virtual Machine Scale set backed clusters. Stopping a @@ -1687,8 +1880,9 @@ async def begin_stop( # pylint: disable=inconsistent-return-statements cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1700,80 +1894,67 @@ async def begin_stop( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._stop_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore + begin_stop.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore async def _start_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_start_request_initial( - subscription_id=self._config.subscription_id, + request = build_start_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._start_initial.metadata['url'], + template_url=self._start_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1781,10 +1962,9 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1794,24 +1974,19 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore - + _start_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore @distributed_trace_async - async def begin_start( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: + async def begin_start(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Starts a previously stopped Managed Cluster. See `starting a cluster `_ for more details about starting a cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1823,85 +1998,83 @@ async def begin_start( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._start_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore + begin_start.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore async def _run_command_initial( self, resource_group_name: str, resource_name: str, - request_payload: _models.RunCommandRequest, + request_payload: Union[_models.RunCommandRequest, IO], **kwargs: Any ) -> Optional[_models.RunCommandResult]: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RunCommandResult]] - _json = self._serialize.body(request_payload, 'RunCommandRequest') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(request_payload, (IO, bytes)): + _content = request_payload + else: + _json = self._serialize.body(request_payload, "RunCommandRequest") - request = build_run_command_request_initial( - subscription_id=self._config.subscription_id, + request = build_run_command_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._run_command_initial.metadata['url'], + content=_content, + template_url=self._run_command_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1909,10 +2082,9 @@ async def _run_command_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1921,22 +2093,23 @@ async def _run_command_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _run_command_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore + _run_command_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore - - @distributed_trace_async + @overload async def begin_run_command( self, resource_group_name: str, resource_name: str, request_payload: _models.RunCommandRequest, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.RunCommandResult]: """Submits a command to run against the Managed Cluster. @@ -1946,12 +2119,97 @@ async def begin_run_command( `_. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param request_payload: The run command request. + :param request_payload: The run command request. Required. :type request_payload: ~azure.mgmt.containerservice.v2022_03_02_preview.models.RunCommandRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RunCommandResult or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_03_02_preview.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_run_command( + self, + resource_group_name: str, + resource_name: str, + request_payload: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.RunCommandResult]: + """Submits a command to run against the Managed Cluster. + + AKS will create a pod to run the command. This is primarily useful for private clusters. For + more information see `AKS Run Command + `_. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param request_payload: The run command request. Required. + :type request_payload: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RunCommandResult or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_03_02_preview.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_run_command( + self, + resource_group_name: str, + resource_name: str, + request_payload: Union[_models.RunCommandRequest, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.RunCommandResult]: + """Submits a command to run against the Managed Cluster. + + AKS will create a pod to run the command. This is primarily useful for private clusters. For + more information see `AKS Run Command + `_. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param request_payload: The run command request. Is either a model type or a IO type. Required. + :type request_payload: + ~azure.mgmt.containerservice.v2022_03_02_preview.models.RunCommandRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -1964,20 +2222,17 @@ async def begin_run_command( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_03_02_preview.models.RunCommandResult] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.RunCommandResult] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.RunCommandResult] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._run_command_initial( # type: ignore resource_group_name=resource_group_name, @@ -1985,82 +2240,72 @@ async def begin_run_command( request_payload=request_payload, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_run_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore + begin_run_command.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore @distributed_trace_async async def get_command_result( - self, - resource_group_name: str, - resource_name: str, - command_id: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, command_id: str, **kwargs: Any ) -> Optional[_models.RunCommandResult]: """Gets the results of a command which has been run on the Managed Cluster. Gets the results of a command which has been run on the Managed Cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param command_id: Id of the command. + :param command_id: Id of the command. Required. :type command_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: RunCommandResult, or the result of cls(response) + :return: RunCommandResult or None or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.RunCommandResult or None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RunCommandResult]] - request = build_get_command_result_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, command_id=command_id, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_command_result.metadata['url'], + template_url=self.get_command_result.metadata["url"], headers=_headers, params=_params, ) @@ -2068,10 +2313,9 @@ async def get_command_result( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -2080,23 +2324,19 @@ async def get_command_result( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_command_result.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}"} # type: ignore - + get_command_result.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}"} # type: ignore @distributed_trace def list_outbound_network_dependencies_endpoints( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.OutboundEnvironmentEndpointCollection]: + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> AsyncIterable["_models.OutboundEnvironmentEndpoint"]: """Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster. @@ -2104,35 +2344,35 @@ def list_outbound_network_dependencies_endpoints( specified managed cluster. The operation returns properties of each egress endpoint. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OutboundEnvironmentEndpointCollection or the - result of cls(response) + :return: An iterator like instance of either OutboundEnvironmentEndpoint or the result of + cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_03_02_preview.models.OutboundEnvironmentEndpointCollection] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_03_02_preview.models.OutboundEnvironmentEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_outbound_network_dependencies_endpoints_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_outbound_network_dependencies_endpoints.metadata['url'], + template_url=self.list_outbound_network_dependencies_endpoints.metadata["url"], headers=_headers, params=_params, ) @@ -2140,16 +2380,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_outbound_network_dependencies_endpoints_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -2165,10 +2400,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2178,8 +2411,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_outbound_network_dependencies_endpoints.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints"} # type: ignore + list_outbound_network_dependencies_endpoints.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/operations/_operations.py index 2b72bd646600..2744b9d15c53 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/operations/_operations.py @@ -7,9 +7,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,9 +27,11 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._operations import build_list_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class Operations: """ .. warning:: @@ -42,38 +51,33 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.OperationListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.OperationValue"]: """Gets a list of operations. Gets a list of operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationListResult or the result of cls(response) + :return: An iterator like instance of either OperationValue or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_03_02_preview.models.OperationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_03_02_preview.models.OperationValue] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -81,13 +85,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -103,10 +105,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -116,8 +116,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.ContainerService/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ContainerService/operations"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/operations/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/operations/_private_endpoint_connections_operations.py index dbac1677030b..f283c3139ad3 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/operations/_private_endpoint_connections_operations.py @@ -6,9 +6,15 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -20,10 +26,17 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._private_endpoint_connections_operations import build_delete_request_initial, build_get_request, build_list_request, build_update_request -T = TypeVar('T') +from ...operations._private_endpoint_connections_operations import ( + build_delete_request, + build_get_request, + build_list_request, + build_update_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class PrivateEndpointConnectionsOperations: """ .. warning:: @@ -43,13 +56,9 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async async def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnectionListResult: """Gets a list of private endpoint connections in the specified managed cluster. @@ -57,33 +66,31 @@ async def list( https://docs.microsoft.com/azure/aks/private-clusters. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnectionListResult, or the result of cls(response) + :return: PrivateEndpointConnectionListResult or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.PrivateEndpointConnectionListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnectionListResult] - request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -91,33 +98,27 @@ async def list( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore - + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore @distributed_trace_async async def get( - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnection: """Gets the specified private endpoint connection. @@ -125,35 +126,33 @@ async def get( https://docs.microsoft.com/azure/aks/private-clusters. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -161,33 +160,33 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - - @distributed_trace_async + @overload async def update( self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, parameters: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateEndpointConnection: """Updates a private endpoint connection. @@ -195,42 +194,117 @@ async def update( Updates a private endpoint connection. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str - :param parameters: The updated private endpoint connection. + :param parameters: The updated private endpoint connection. Required. :type parameters: ~azure.mgmt.containerservice.v2022_03_02_preview.models.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: The updated private endpoint connection. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: Union[_models.PrivateEndpointConnection, IO], + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: The updated private endpoint connection. Is either a model type or a IO + type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2022_03_02_preview.models.PrivateEndpointConnection or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - _json = self._serialize.body(parameters, 'PrivateEndpointConnection') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateEndpointConnection") request = build_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update.metadata['url'], + content=_content, + template_url=self.update.metadata["url"], headers=_headers, params=_params, ) @@ -238,52 +312,43 @@ async def update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -291,10 +356,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -304,26 +368,22 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + async def begin_delete( + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes a private endpoint connection. Deletes a private endpoint connection. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -335,53 +395,46 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/operations/_private_link_resources_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/operations/_private_link_resources_operations.py index 631fd01d89b2..6cf9d31dde86 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/operations/_private_link_resources_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/operations/_private_link_resources_operations.py @@ -8,7 +8,13 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -19,9 +25,11 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._private_link_resources_operations import build_list_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class PrivateLinkResourcesOperations: """ .. warning:: @@ -41,13 +49,9 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async async def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.PrivateLinkResourcesListResult: """Gets a list of private link resources in the specified managed cluster. @@ -55,32 +59,30 @@ async def list( https://docs.microsoft.com/azure/aks/private-clusters. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResourcesListResult, or the result of cls(response) + :return: PrivateLinkResourcesListResult or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.PrivateLinkResourcesListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResourcesListResult] - request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -88,22 +90,20 @@ async def list( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResourcesListResult', pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources"} # type: ignore - + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/operations/_resolve_private_link_service_id_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/operations/_resolve_private_link_service_id_operations.py index 75dab2aee111..67ad73705298 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/operations/_resolve_private_link_service_id_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/operations/_resolve_private_link_service_id_operations.py @@ -6,9 +6,15 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -19,9 +25,11 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._resolve_private_link_service_id_operations import build_post_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class ResolvePrivateLinkServiceIdOperations: """ .. warning:: @@ -41,13 +49,72 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @overload + async def post( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.PrivateLinkResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID for the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters required in order to resolve a private link service ID. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_03_02_preview.models.PrivateLinkResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def post( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID for the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters required in order to resolve a private link service ID. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def post( self, resource_group_name: str, resource_name: str, - parameters: _models.PrivateLinkResource, + parameters: Union[_models.PrivateLinkResource, IO], **kwargs: Any ) -> _models.PrivateLinkResource: """Gets the private link service ID for the specified managed cluster. @@ -55,38 +122,49 @@ async def post( Gets the private link service ID for the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters required in order to resolve a private link service ID. + :param parameters: Parameters required in order to resolve a private link service ID. Is either + a model type or a IO type. Required. :type parameters: ~azure.mgmt.containerservice.v2022_03_02_preview.models.PrivateLinkResource + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResource, or the result of cls(response) + :return: PrivateLinkResource or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.PrivateLinkResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResource] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResource] - _json = self._serialize.body(parameters, 'PrivateLinkResource') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateLinkResource") request = build_post_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.post.metadata['url'], + content=_content, + template_url=self.post.metadata["url"], headers=_headers, params=_params, ) @@ -94,22 +172,20 @@ async def post( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResource', pipeline_response) + deserialized = self._deserialize("PrivateLinkResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - post.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId"} # type: ignore - + post.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/operations/_snapshots_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/operations/_snapshots_operations.py index 07ad30adbeff..c79b90cbeb41 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/operations/_snapshots_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/operations/_snapshots_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,10 +27,19 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._snapshots_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_resource_group_request, build_list_request, build_update_tags_request -T = TypeVar('T') +from ...operations._snapshots_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_resource_group_request, + build_list_request, + build_update_tags_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class SnapshotsOperations: """ .. warning:: @@ -43,39 +59,34 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.SnapshotListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.Snapshot"]: """Gets a list of snapshots in the specified subscription. Gets a list of snapshots in the specified subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SnapshotListResult or the result of cls(response) + :return: An iterator like instance of either Snapshot or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_03_02_preview.models.SnapshotListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_03_02_preview.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SnapshotListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -83,14 +94,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -106,10 +114,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -119,48 +125,42 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots"} # type: ignore @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.SnapshotListResult]: + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.Snapshot"]: """Lists snapshots in the specified subscription and resource group. Lists snapshots in the specified subscription and resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SnapshotListResult or the result of cls(response) + :return: An iterator like instance of either Snapshot or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_03_02_preview.models.SnapshotListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_03_02_preview.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SnapshotListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -168,15 +168,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -192,10 +188,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -205,50 +199,41 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots"} # type: ignore @distributed_trace_async - async def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.Snapshot: + async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.Snapshot: """Gets a snapshot. Gets a snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Snapshot, or the result of cls(response) + :return: Snapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.Snapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -256,32 +241,32 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - - @distributed_trace_async + @overload async def create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.Snapshot, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.Snapshot: """Creates or updates a snapshot. @@ -289,38 +274,102 @@ async def create_or_update( Creates or updates a snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The snapshot to create or update. + :param parameters: The snapshot to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_03_02_preview.models.Snapshot + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Snapshot, or the result of cls(response) + :return: Snapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.Snapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Snapshot: + """Creates or updates a snapshot. + + Creates or updates a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The snapshot to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.Snapshot, IO], **kwargs: Any + ) -> _models.Snapshot: + """Creates or updates a snapshot. + + Creates or updates a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The snapshot to create or update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.mgmt.containerservice.v2022_03_02_preview.models.Snapshot or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] - _json = self._serialize.body(parameters, 'Snapshot') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "Snapshot") request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) @@ -328,10 +377,9 @@ async def create_or_update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -339,25 +387,26 @@ async def create_or_update( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - @distributed_trace_async + @overload async def update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.Snapshot: """Updates tags on a snapshot. @@ -365,38 +414,102 @@ async def update_tags( Updates tags on a snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update snapshot Tags operation. + :param parameters: Parameters supplied to the Update snapshot Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2022_03_02_preview.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Snapshot: + """Updates tags on a snapshot. + + Updates tags on a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update snapshot Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Snapshot, or the result of cls(response) + :return: Snapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.Snapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @distributed_trace_async + async def update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> _models.Snapshot: + """Updates tags on a snapshot. + + Updates tags on a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update snapshot Tags operation. Is either a model + type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_03_02_preview.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") request = build_update_tags_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_tags.metadata['url'], + content=_content, + template_url=self.update_tags.metadata["url"], headers=_headers, params=_params, ) @@ -404,64 +517,57 @@ async def update_tags( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - + update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: """Deletes a snapshot. Deletes a snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) @@ -469,10 +575,9 @@ async def delete( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -482,5 +587,4 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - + delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/models/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/models/__init__.py index ebe438d015d2..c37cbbf5c755 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/models/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/models/__init__.py @@ -107,185 +107,183 @@ from ._models_py3 import UserAssignedIdentity from ._models_py3 import WindowsGmsaProfile - -from ._container_service_client_enums import ( - AgentPoolMode, - AgentPoolType, - Code, - ConnectionStatus, - ContainerServiceStorageProfileTypes, - ContainerServiceVMSizeTypes, - Count, - CreatedByType, - Expander, - ExtendedLocationTypes, - Format, - GPUInstanceProfile, - IpFamily, - KubeletDiskType, - LicenseType, - LoadBalancerSku, - ManagedClusterPodIdentityProvisioningState, - ManagedClusterSKUName, - ManagedClusterSKUTier, - NetworkMode, - NetworkPlugin, - NetworkPolicy, - OSDiskType, - OSSKU, - OSType, - OutboundType, - PrivateEndpointConnectionProvisioningState, - PublicNetworkAccess, - ResourceIdentityType, - ScaleDownMode, - ScaleSetEvictionPolicy, - ScaleSetPriority, - SnapshotType, - UpgradeChannel, - WeekDay, - WorkloadRuntime, -) +from ._container_service_client_enums import AgentPoolMode +from ._container_service_client_enums import AgentPoolType +from ._container_service_client_enums import Code +from ._container_service_client_enums import ConnectionStatus +from ._container_service_client_enums import ContainerServiceStorageProfileTypes +from ._container_service_client_enums import ContainerServiceVMSizeTypes +from ._container_service_client_enums import Count +from ._container_service_client_enums import CreatedByType +from ._container_service_client_enums import Expander +from ._container_service_client_enums import ExtendedLocationTypes +from ._container_service_client_enums import Format +from ._container_service_client_enums import GPUInstanceProfile +from ._container_service_client_enums import IpFamily +from ._container_service_client_enums import KubeletDiskType +from ._container_service_client_enums import LicenseType +from ._container_service_client_enums import LoadBalancerSku +from ._container_service_client_enums import ManagedClusterPodIdentityProvisioningState +from ._container_service_client_enums import ManagedClusterSKUName +from ._container_service_client_enums import ManagedClusterSKUTier +from ._container_service_client_enums import NetworkMode +from ._container_service_client_enums import NetworkPlugin +from ._container_service_client_enums import NetworkPolicy +from ._container_service_client_enums import OSDiskType +from ._container_service_client_enums import OSSKU +from ._container_service_client_enums import OSType +from ._container_service_client_enums import OutboundType +from ._container_service_client_enums import PrivateEndpointConnectionProvisioningState +from ._container_service_client_enums import PublicNetworkAccess +from ._container_service_client_enums import ResourceIdentityType +from ._container_service_client_enums import ScaleDownMode +from ._container_service_client_enums import ScaleSetEvictionPolicy +from ._container_service_client_enums import ScaleSetPriority +from ._container_service_client_enums import SnapshotType +from ._container_service_client_enums import UpgradeChannel +from ._container_service_client_enums import WeekDay +from ._container_service_client_enums import WorkloadRuntime from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'AgentPool', - 'AgentPoolAvailableVersions', - 'AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem', - 'AgentPoolListResult', - 'AgentPoolUpgradeProfile', - 'AgentPoolUpgradeProfilePropertiesUpgradesItem', - 'AgentPoolUpgradeSettings', - 'AzureKeyVaultKms', - 'CloudErrorBody', - 'ContainerServiceDiagnosticsProfile', - 'ContainerServiceLinuxProfile', - 'ContainerServiceMasterProfile', - 'ContainerServiceNetworkProfile', - 'ContainerServiceSshConfiguration', - 'ContainerServiceSshPublicKey', - 'ContainerServiceVMDiagnostics', - 'CreationData', - 'CredentialResult', - 'CredentialResults', - 'EndpointDependency', - 'EndpointDetail', - 'ExtendedLocation', - 'KubeletConfig', - 'LinuxOSConfig', - 'MaintenanceConfiguration', - 'MaintenanceConfigurationListResult', - 'ManagedCluster', - 'ManagedClusterAADProfile', - 'ManagedClusterAPIServerAccessProfile', - 'ManagedClusterAccessProfile', - 'ManagedClusterAddonProfile', - 'ManagedClusterAddonProfileIdentity', - 'ManagedClusterAgentPoolProfile', - 'ManagedClusterAgentPoolProfileProperties', - 'ManagedClusterAutoUpgradeProfile', - 'ManagedClusterHTTPProxyConfig', - 'ManagedClusterIdentity', - 'ManagedClusterIngressProfile', - 'ManagedClusterIngressProfileWebAppRouting', - 'ManagedClusterListResult', - 'ManagedClusterLoadBalancerProfile', - 'ManagedClusterLoadBalancerProfileManagedOutboundIPs', - 'ManagedClusterLoadBalancerProfileOutboundIPPrefixes', - 'ManagedClusterLoadBalancerProfileOutboundIPs', - 'ManagedClusterManagedOutboundIPProfile', - 'ManagedClusterNATGatewayProfile', - 'ManagedClusterOIDCIssuerProfile', - 'ManagedClusterPodIdentity', - 'ManagedClusterPodIdentityException', - 'ManagedClusterPodIdentityProfile', - 'ManagedClusterPodIdentityProvisioningError', - 'ManagedClusterPodIdentityProvisioningErrorBody', - 'ManagedClusterPodIdentityProvisioningInfo', - 'ManagedClusterPoolUpgradeProfile', - 'ManagedClusterPoolUpgradeProfileUpgradesItem', - 'ManagedClusterPropertiesAutoScalerProfile', - 'ManagedClusterPropertiesForSnapshot', - 'ManagedClusterSKU', - 'ManagedClusterSecurityProfile', - 'ManagedClusterSecurityProfileAzureDefender', - 'ManagedClusterSecurityProfileWorkloadIdentity', - 'ManagedClusterServicePrincipalProfile', - 'ManagedClusterSnapshot', - 'ManagedClusterSnapshotListResult', - 'ManagedClusterStorageProfile', - 'ManagedClusterStorageProfileDiskCSIDriver', - 'ManagedClusterStorageProfileFileCSIDriver', - 'ManagedClusterStorageProfileSnapshotController', - 'ManagedClusterUpgradeProfile', - 'ManagedClusterWindowsProfile', - 'ManagedServiceIdentityUserAssignedIdentitiesValue', - 'NetworkProfileForSnapshot', - 'OSOptionProfile', - 'OSOptionProperty', - 'OperationListResult', - 'OperationValue', - 'OutboundEnvironmentEndpoint', - 'OutboundEnvironmentEndpointCollection', - 'PowerState', - 'PrivateEndpoint', - 'PrivateEndpointConnection', - 'PrivateEndpointConnectionListResult', - 'PrivateLinkResource', - 'PrivateLinkResourcesListResult', - 'PrivateLinkServiceConnectionState', - 'Resource', - 'ResourceReference', - 'RunCommandRequest', - 'RunCommandResult', - 'Snapshot', - 'SnapshotListResult', - 'SubResource', - 'SysctlConfig', - 'SystemData', - 'TagsObject', - 'TimeInWeek', - 'TimeSpan', - 'TrackedResource', - 'UserAssignedIdentity', - 'WindowsGmsaProfile', - 'AgentPoolMode', - 'AgentPoolType', - 'Code', - 'ConnectionStatus', - 'ContainerServiceStorageProfileTypes', - 'ContainerServiceVMSizeTypes', - 'Count', - 'CreatedByType', - 'Expander', - 'ExtendedLocationTypes', - 'Format', - 'GPUInstanceProfile', - 'IpFamily', - 'KubeletDiskType', - 'LicenseType', - 'LoadBalancerSku', - 'ManagedClusterPodIdentityProvisioningState', - 'ManagedClusterSKUName', - 'ManagedClusterSKUTier', - 'NetworkMode', - 'NetworkPlugin', - 'NetworkPolicy', - 'OSDiskType', - 'OSSKU', - 'OSType', - 'OutboundType', - 'PrivateEndpointConnectionProvisioningState', - 'PublicNetworkAccess', - 'ResourceIdentityType', - 'ScaleDownMode', - 'ScaleSetEvictionPolicy', - 'ScaleSetPriority', - 'SnapshotType', - 'UpgradeChannel', - 'WeekDay', - 'WorkloadRuntime', + "AgentPool", + "AgentPoolAvailableVersions", + "AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem", + "AgentPoolListResult", + "AgentPoolUpgradeProfile", + "AgentPoolUpgradeProfilePropertiesUpgradesItem", + "AgentPoolUpgradeSettings", + "AzureKeyVaultKms", + "CloudErrorBody", + "ContainerServiceDiagnosticsProfile", + "ContainerServiceLinuxProfile", + "ContainerServiceMasterProfile", + "ContainerServiceNetworkProfile", + "ContainerServiceSshConfiguration", + "ContainerServiceSshPublicKey", + "ContainerServiceVMDiagnostics", + "CreationData", + "CredentialResult", + "CredentialResults", + "EndpointDependency", + "EndpointDetail", + "ExtendedLocation", + "KubeletConfig", + "LinuxOSConfig", + "MaintenanceConfiguration", + "MaintenanceConfigurationListResult", + "ManagedCluster", + "ManagedClusterAADProfile", + "ManagedClusterAPIServerAccessProfile", + "ManagedClusterAccessProfile", + "ManagedClusterAddonProfile", + "ManagedClusterAddonProfileIdentity", + "ManagedClusterAgentPoolProfile", + "ManagedClusterAgentPoolProfileProperties", + "ManagedClusterAutoUpgradeProfile", + "ManagedClusterHTTPProxyConfig", + "ManagedClusterIdentity", + "ManagedClusterIngressProfile", + "ManagedClusterIngressProfileWebAppRouting", + "ManagedClusterListResult", + "ManagedClusterLoadBalancerProfile", + "ManagedClusterLoadBalancerProfileManagedOutboundIPs", + "ManagedClusterLoadBalancerProfileOutboundIPPrefixes", + "ManagedClusterLoadBalancerProfileOutboundIPs", + "ManagedClusterManagedOutboundIPProfile", + "ManagedClusterNATGatewayProfile", + "ManagedClusterOIDCIssuerProfile", + "ManagedClusterPodIdentity", + "ManagedClusterPodIdentityException", + "ManagedClusterPodIdentityProfile", + "ManagedClusterPodIdentityProvisioningError", + "ManagedClusterPodIdentityProvisioningErrorBody", + "ManagedClusterPodIdentityProvisioningInfo", + "ManagedClusterPoolUpgradeProfile", + "ManagedClusterPoolUpgradeProfileUpgradesItem", + "ManagedClusterPropertiesAutoScalerProfile", + "ManagedClusterPropertiesForSnapshot", + "ManagedClusterSKU", + "ManagedClusterSecurityProfile", + "ManagedClusterSecurityProfileAzureDefender", + "ManagedClusterSecurityProfileWorkloadIdentity", + "ManagedClusterServicePrincipalProfile", + "ManagedClusterSnapshot", + "ManagedClusterSnapshotListResult", + "ManagedClusterStorageProfile", + "ManagedClusterStorageProfileDiskCSIDriver", + "ManagedClusterStorageProfileFileCSIDriver", + "ManagedClusterStorageProfileSnapshotController", + "ManagedClusterUpgradeProfile", + "ManagedClusterWindowsProfile", + "ManagedServiceIdentityUserAssignedIdentitiesValue", + "NetworkProfileForSnapshot", + "OSOptionProfile", + "OSOptionProperty", + "OperationListResult", + "OperationValue", + "OutboundEnvironmentEndpoint", + "OutboundEnvironmentEndpointCollection", + "PowerState", + "PrivateEndpoint", + "PrivateEndpointConnection", + "PrivateEndpointConnectionListResult", + "PrivateLinkResource", + "PrivateLinkResourcesListResult", + "PrivateLinkServiceConnectionState", + "Resource", + "ResourceReference", + "RunCommandRequest", + "RunCommandResult", + "Snapshot", + "SnapshotListResult", + "SubResource", + "SysctlConfig", + "SystemData", + "TagsObject", + "TimeInWeek", + "TimeSpan", + "TrackedResource", + "UserAssignedIdentity", + "WindowsGmsaProfile", + "AgentPoolMode", + "AgentPoolType", + "Code", + "ConnectionStatus", + "ContainerServiceStorageProfileTypes", + "ContainerServiceVMSizeTypes", + "Count", + "CreatedByType", + "Expander", + "ExtendedLocationTypes", + "Format", + "GPUInstanceProfile", + "IpFamily", + "KubeletDiskType", + "LicenseType", + "LoadBalancerSku", + "ManagedClusterPodIdentityProvisioningState", + "ManagedClusterSKUName", + "ManagedClusterSKUTier", + "NetworkMode", + "NetworkPlugin", + "NetworkPolicy", + "OSDiskType", + "OSSKU", + "OSType", + "OutboundType", + "PrivateEndpointConnectionProvisioningState", + "PublicNetworkAccess", + "ResourceIdentityType", + "ScaleDownMode", + "ScaleSetEvictionPolicy", + "ScaleSetPriority", + "SnapshotType", + "UpgradeChannel", + "WeekDay", + "WorkloadRuntime", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/models/_container_service_client_enums.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/models/_container_service_client_enums.py index c66d7c8a922b..d9babf886c17 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/models/_container_service_client_enums.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/models/_container_service_client_enums.py @@ -13,7 +13,7 @@ class AgentPoolMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools + https://docs.microsoft.com/azure/aks/use-system-pools. """ #: System agent pools are primarily for hosting critical system pods such as CoreDNS and @@ -23,33 +23,34 @@ class AgentPoolMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: User agent pools are primarily for hosting your application pods. USER = "User" + class AgentPoolType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of Agent Pool. - """ + """The type of Agent Pool.""" #: Create an Agent Pool backed by a Virtual Machine Scale Set. VIRTUAL_MACHINE_SCALE_SETS = "VirtualMachineScaleSets" #: Use of this is strongly discouraged. AVAILABILITY_SET = "AvailabilitySet" + class Code(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Tells whether the cluster is Running or Stopped - """ + """Tells whether the cluster is Running or Stopped.""" #: The cluster is running. RUNNING = "Running" #: The cluster is stopped. STOPPED = "Stopped" + class ConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The private link service connection status. - """ + """The private link service connection status.""" PENDING = "Pending" APPROVED = "Approved" REJECTED = "Rejected" DISCONNECTED = "Disconnected" + class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Specifies what kind of storage to use. If omitted, the default will be chosen on your behalf based on the choice of orchestrator. @@ -58,9 +59,9 @@ class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEn STORAGE_ACCOUNT = "StorageAccount" MANAGED_DISKS = "ManagedDisks" + class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Size of agent VMs. Note: This is no longer maintained. - """ + """Size of agent VMs. Note: This is no longer maintained.""" STANDARD_A1 = "Standard_A1" STANDARD_A10 = "Standard_A10" @@ -237,6 +238,7 @@ class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): STANDARD_NV24 = "Standard_NV24" STANDARD_NV6 = "Standard_NV6" + class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): """Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, and 5. The default value is 1. @@ -246,15 +248,16 @@ class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): THREE = 3 FIVE = 5 + class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of identity that created the resource. - """ + """The type of identity that created the resource.""" USER = "User" APPLICATION = "Application" MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" + class Expander(str, Enum, metaclass=CaseInsensitiveEnumMeta): """If not specified, the default is 'random'. See `expanders `_ @@ -278,23 +281,25 @@ class Expander(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Used when you don't have a particular need for the node groups to scale differently. RANDOM = "random" + class ExtendedLocationTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of extendedLocation. - """ + """The type of extendedLocation.""" EDGE_ZONE = "EdgeZone" + class Format(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Format.""" #: Return azure auth-provider kubeconfig. This format is deprecated in 1.22 and will be fully #: removed in 1.25. AZURE = "azure" #: Return exec format kubeconfig. This format requires kubelogin binary in the path. - EXEC_ENUM = "exec" + EXEC = "exec" + class GPUInstanceProfile(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """GPUInstanceProfile to be used to specify GPU MIG instance profile for supported GPU VM SKU. - """ + """GPUInstanceProfile to be used to specify GPU MIG instance profile for supported GPU VM SKU.""" MIG1_G = "MIG1g" MIG2_G = "MIG2g" @@ -302,13 +307,14 @@ class GPUInstanceProfile(str, Enum, metaclass=CaseInsensitiveEnumMeta): MIG4_G = "MIG4g" MIG7_G = "MIG7g" + class IpFamily(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The IP version to use for cluster networking and IP assignment. - """ + """The IP version to use for cluster networking and IP assignment.""" I_PV4 = "IPv4" I_PV6 = "IPv6" + class KubeletDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. @@ -319,6 +325,7 @@ class KubeletDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Kubelet will use the temporary disk for its data. TEMPORARY = "Temporary" + class LicenseType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The license type to use for Windows VMs. See `Azure Hybrid User Benefits `_ for more details. @@ -329,6 +336,7 @@ class LicenseType(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Enables Azure Hybrid User Benefits for Windows VMs. WINDOWS_SERVER = "Windows_Server" + class LoadBalancerSku(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The default is 'standard'. See `Azure Load Balancer SKUs `_ for more information about the @@ -342,21 +350,22 @@ class LoadBalancerSku(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Use a basic Load Balancer with limited functionality. BASIC = "basic" + class ManagedClusterPodIdentityProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The current provisioning state of the pod identity. - """ + """The current provisioning state of the pod identity.""" ASSIGNED = "Assigned" UPDATING = "Updating" DELETING = "Deleting" FAILED = "Failed" + class ManagedClusterSKUName(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The name of a managed cluster SKU. - """ + """The name of a managed cluster SKU.""" BASIC = "Basic" + class ManagedClusterSKUTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): """If not specified, the default is 'Free'. See `uptime SLA `_ for more details. @@ -368,20 +377,20 @@ class ManagedClusterSKUTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: No guaranteed SLA, no additional charges. Free tier clusters have an SLO of 99.5%. FREE = "Free" + class NetworkMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """This cannot be specified if networkPlugin is anything other than 'azure'. - """ + """This cannot be specified if networkPlugin is anything other than 'azure'.""" #: No bridge is created. Intra-VM Pod to Pod communication is through IP routes created by Azure #: CNI. See `Transparent Mode `_ for #: more information. TRANSPARENT = "transparent" - #: This is no longer supported. + #: This is no longer supported BRIDGE = "bridge" + class NetworkPlugin(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Network plugin used for building the Kubernetes network. - """ + """Network plugin used for building the Kubernetes network.""" #: Use the Azure CNI network plugin. See `Azure CNI (advanced) networking #: `_ for @@ -395,9 +404,9 @@ class NetworkPlugin(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: networking functionality. NONE = "none" + class NetworkPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Network policy used for building the Kubernetes network. - """ + """Network policy used for building the Kubernetes network.""" #: Use Calico network policies. See `differences between Azure and Calico policies #: `_ @@ -408,6 +417,7 @@ class NetworkPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: for more information. AZURE = "azure" + class OSDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more @@ -424,22 +434,23 @@ class OSDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: provides lower read/write latency, along with faster node scaling and cluster upgrades. EPHEMERAL = "Ephemeral" + class OSSKU(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Specifies an OS SKU. This value must not be specified if OSType is Windows. - """ + """Specifies an OS SKU. This value must not be specified if OSType is Windows.""" UBUNTU = "Ubuntu" CBL_MARINER = "CBLMariner" + class OSType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The operating system type. The default is Linux. - """ + """The operating system type. The default is Linux.""" #: Use Linux. LINUX = "Linux" #: Use Windows. WINDOWS = "Windows" + class OutboundType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """This can only be set at cluster creation time and cannot be changed later. For more information see `egress outbound type `_. @@ -460,22 +471,23 @@ class OutboundType(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: advanced scenario and requires proper network configuration. USER_ASSIGNED_NAT_GATEWAY = "userAssignedNATGateway" + class PrivateEndpointConnectionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The current provisioning state. - """ + """The current provisioning state.""" SUCCEEDED = "Succeeded" CREATING = "Creating" DELETING = "Deleting" FAILED = "Failed" + class PublicNetworkAccess(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Allow or deny public network access for AKS - """ + """Allow or deny public network access for AKS.""" ENABLED = "Enabled" DISABLED = "Disabled" + class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """For more information see `use managed identities in AKS `_. @@ -492,6 +504,7 @@ class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Do not use a managed identity for the Managed Cluster, service principal will be used instead. NONE = "None" + class ScaleDownMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Describes how VMs are added to or removed from Agent Pools. See `billing states `_. @@ -503,10 +516,11 @@ class ScaleDownMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: during scale down. DEALLOCATE = "Deallocate" + class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The eviction policy specifies what to do with the VM when it is evicted. The default is Delete. For more information about eviction see `spot VMs - `_ + `_. """ #: Nodes in the underlying Scale Set of the node pool are deleted when they're evicted. @@ -516,9 +530,9 @@ class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: cause issues with cluster scaling or upgrading. DEALLOCATE = "Deallocate" + class ScaleSetPriority(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The Virtual Machine Scale Set priority. - """ + """The Virtual Machine Scale Set priority.""" #: Spot priority VMs will be used. There is no SLA for spot nodes. See `spot on AKS #: `_ for more information. @@ -526,15 +540,16 @@ class ScaleSetPriority(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Regular VMs will be used. REGULAR = "Regular" + class SnapshotType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of a snapshot. The default is NodePool. - """ + """The type of a snapshot. The default is NodePool.""" #: The snapshot is a snapshot of a node pool. NODE_POOL = "NodePool" #: The snapshot is a snapshot of a managed cluster. MANAGED_CLUSTER = "ManagedCluster" + class UpgradeChannel(str, Enum, metaclass=CaseInsensitiveEnumMeta): """For more information see `setting the AKS cluster auto-upgrade channel `_. @@ -565,9 +580,9 @@ class UpgradeChannel(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Disables auto-upgrades and keeps the cluster at its current version of Kubernetes. NONE = "none" + class WeekDay(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The weekday enum. - """ + """The weekday enum.""" SUNDAY = "Sunday" MONDAY = "Monday" @@ -577,9 +592,9 @@ class WeekDay(str, Enum, metaclass=CaseInsensitiveEnumMeta): FRIDAY = "Friday" SATURDAY = "Saturday" + class WorkloadRuntime(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Determines the type of workload a node can run. - """ + """Determines the type of workload a node can run.""" #: Nodes will use Kubelet to run standard OCI container workloads. OCI_CONTAINER = "OCIContainer" diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/models/_models_py3.py index 7a64b04d5286..af126ae56e60 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/models/_models_py3.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/models/_models_py3.py @@ -1,4 +1,5 @@ # coding=utf-8 +# pylint: disable=too-many-lines # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -9,14 +10,14 @@ import datetime from typing import Dict, List, Optional, TYPE_CHECKING, Union -import msrest.serialization +from ... import _serialization if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - import __init__ as _models + from .. import models as _models -class SubResource(msrest.serialization.Model): +class SubResource(_serialization.Model): """Reference to another subresource. Variables are only populated by the server, and will be ignored when sending a request. @@ -31,30 +32,26 @@ class SubResource(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(SubResource, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.id = None self.name = None self.type = None -class AgentPool(SubResource): +class AgentPool(SubResource): # pylint: disable=too-many-instance-attributes """Agent Pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -82,15 +79,15 @@ class AgentPool(SubResource): larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.OSDiskType :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data - root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.KubeletDiskType :ivar workload_runtime: Determines the type of workload a node can run. Known values are: - "OCIContainer", "WasmWasi". + "OCIContainer" and "WasmWasi". :vartype workload_runtime: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.WorkloadRuntime :ivar message_of_the_day: A base64-encoded string which will be written to /etc/motd after @@ -109,11 +106,11 @@ class AgentPool(SubResource): :vartype pod_subnet_id: str :ivar max_pods: The maximum number of pods that can run on a node. :vartype max_pods: int - :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.OSType :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known - values are: "Ubuntu", "CBLMariner". + values are: "Ubuntu" and "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.OSSKU :ivar max_count: The maximum number of nodes for auto-scaling. :vartype max_count: int @@ -122,16 +119,16 @@ class AgentPool(SubResource): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it - defaults to Delete. Known values are: "Delete", "Deallocate". + defaults to Delete. Known values are: "Delete" and "Deallocate". :vartype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.ScaleDownMode - :ivar type_properties_type: The type of Agent Pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + :ivar type_properties_type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets" + and "AvailabilitySet". :vartype type_properties_type: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.AgentPoolType :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :vartype mode: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.AgentPoolMode :ivar orchestrator_version: Both patch version and are supported. When is specified, the latest supported patch version is chosen @@ -173,20 +170,18 @@ class AgentPool(SubResource): /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default - is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + is 'Regular'. Known values are: "Spot" and "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.ScaleSetPriority :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.ScaleSetEvictionPolicy :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :vartype spot_max_price: float - :ivar tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :ivar tags: The tags to be persisted on the agent pool virtual machine scale set. :vartype tags: dict[str, str] :ivar node_labels: The node labels to be persisted across all nodes in agent pool. :vartype node_labels: dict[str, str] @@ -210,7 +205,7 @@ class AgentPool(SubResource): for more details. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.GPUInstanceProfile :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the node pool @@ -227,64 +222,64 @@ class AgentPool(SubResource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'os_disk_size_gb': {'maximum': 2048, 'minimum': 0}, - 'node_image_version': {'readonly': True}, - 'provisioning_state': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "os_disk_size_gb": {"maximum": 2048, "minimum": 0}, + "node_image_version": {"readonly": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'count': {'key': 'properties.count', 'type': 'int'}, - 'vm_size': {'key': 'properties.vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'properties.osDiskSizeGB', 'type': 'int'}, - 'os_disk_type': {'key': 'properties.osDiskType', 'type': 'str'}, - 'kubelet_disk_type': {'key': 'properties.kubeletDiskType', 'type': 'str'}, - 'workload_runtime': {'key': 'properties.workloadRuntime', 'type': 'str'}, - 'message_of_the_day': {'key': 'properties.messageOfTheDay', 'type': 'str'}, - 'vnet_subnet_id': {'key': 'properties.vnetSubnetID', 'type': 'str'}, - 'pod_subnet_id': {'key': 'properties.podSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'properties.maxPods', 'type': 'int'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'os_sku': {'key': 'properties.osSKU', 'type': 'str'}, - 'max_count': {'key': 'properties.maxCount', 'type': 'int'}, - 'min_count': {'key': 'properties.minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'properties.enableAutoScaling', 'type': 'bool'}, - 'scale_down_mode': {'key': 'properties.scaleDownMode', 'type': 'str'}, - 'type_properties_type': {'key': 'properties.type', 'type': 'str'}, - 'mode': {'key': 'properties.mode', 'type': 'str'}, - 'orchestrator_version': {'key': 'properties.orchestratorVersion', 'type': 'str'}, - 'current_orchestrator_version': {'key': 'properties.currentOrchestratorVersion', 'type': 'str'}, - 'node_image_version': {'key': 'properties.nodeImageVersion', 'type': 'str'}, - 'upgrade_settings': {'key': 'properties.upgradeSettings', 'type': 'AgentPoolUpgradeSettings'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'power_state': {'key': 'properties.powerState', 'type': 'PowerState'}, - 'availability_zones': {'key': 'properties.availabilityZones', 'type': '[str]'}, - 'enable_node_public_ip': {'key': 'properties.enableNodePublicIP', 'type': 'bool'}, - 'node_public_ip_prefix_id': {'key': 'properties.nodePublicIPPrefixID', 'type': 'str'}, - 'scale_set_priority': {'key': 'properties.scaleSetPriority', 'type': 'str'}, - 'scale_set_eviction_policy': {'key': 'properties.scaleSetEvictionPolicy', 'type': 'str'}, - 'spot_max_price': {'key': 'properties.spotMaxPrice', 'type': 'float'}, - 'tags': {'key': 'properties.tags', 'type': '{str}'}, - 'node_labels': {'key': 'properties.nodeLabels', 'type': '{str}'}, - 'node_taints': {'key': 'properties.nodeTaints', 'type': '[str]'}, - 'proximity_placement_group_id': {'key': 'properties.proximityPlacementGroupID', 'type': 'str'}, - 'kubelet_config': {'key': 'properties.kubeletConfig', 'type': 'KubeletConfig'}, - 'linux_os_config': {'key': 'properties.linuxOSConfig', 'type': 'LinuxOSConfig'}, - 'enable_encryption_at_host': {'key': 'properties.enableEncryptionAtHost', 'type': 'bool'}, - 'enable_ultra_ssd': {'key': 'properties.enableUltraSSD', 'type': 'bool'}, - 'enable_fips': {'key': 'properties.enableFIPS', 'type': 'bool'}, - 'gpu_instance_profile': {'key': 'properties.gpuInstanceProfile', 'type': 'str'}, - 'creation_data': {'key': 'properties.creationData', 'type': 'CreationData'}, - 'capacity_reservation_group_id': {'key': 'properties.capacityReservationGroupID', 'type': 'str'}, - 'host_group_id': {'key': 'properties.hostGroupID', 'type': 'str'}, - } - - def __init__( + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "count": {"key": "properties.count", "type": "int"}, + "vm_size": {"key": "properties.vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "properties.osDiskSizeGB", "type": "int"}, + "os_disk_type": {"key": "properties.osDiskType", "type": "str"}, + "kubelet_disk_type": {"key": "properties.kubeletDiskType", "type": "str"}, + "workload_runtime": {"key": "properties.workloadRuntime", "type": "str"}, + "message_of_the_day": {"key": "properties.messageOfTheDay", "type": "str"}, + "vnet_subnet_id": {"key": "properties.vnetSubnetID", "type": "str"}, + "pod_subnet_id": {"key": "properties.podSubnetID", "type": "str"}, + "max_pods": {"key": "properties.maxPods", "type": "int"}, + "os_type": {"key": "properties.osType", "type": "str"}, + "os_sku": {"key": "properties.osSKU", "type": "str"}, + "max_count": {"key": "properties.maxCount", "type": "int"}, + "min_count": {"key": "properties.minCount", "type": "int"}, + "enable_auto_scaling": {"key": "properties.enableAutoScaling", "type": "bool"}, + "scale_down_mode": {"key": "properties.scaleDownMode", "type": "str"}, + "type_properties_type": {"key": "properties.type", "type": "str"}, + "mode": {"key": "properties.mode", "type": "str"}, + "orchestrator_version": {"key": "properties.orchestratorVersion", "type": "str"}, + "current_orchestrator_version": {"key": "properties.currentOrchestratorVersion", "type": "str"}, + "node_image_version": {"key": "properties.nodeImageVersion", "type": "str"}, + "upgrade_settings": {"key": "properties.upgradeSettings", "type": "AgentPoolUpgradeSettings"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "power_state": {"key": "properties.powerState", "type": "PowerState"}, + "availability_zones": {"key": "properties.availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "properties.enableNodePublicIP", "type": "bool"}, + "node_public_ip_prefix_id": {"key": "properties.nodePublicIPPrefixID", "type": "str"}, + "scale_set_priority": {"key": "properties.scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "properties.scaleSetEvictionPolicy", "type": "str"}, + "spot_max_price": {"key": "properties.spotMaxPrice", "type": "float"}, + "tags": {"key": "properties.tags", "type": "{str}"}, + "node_labels": {"key": "properties.nodeLabels", "type": "{str}"}, + "node_taints": {"key": "properties.nodeTaints", "type": "[str]"}, + "proximity_placement_group_id": {"key": "properties.proximityPlacementGroupID", "type": "str"}, + "kubelet_config": {"key": "properties.kubeletConfig", "type": "KubeletConfig"}, + "linux_os_config": {"key": "properties.linuxOSConfig", "type": "LinuxOSConfig"}, + "enable_encryption_at_host": {"key": "properties.enableEncryptionAtHost", "type": "bool"}, + "enable_ultra_ssd": {"key": "properties.enableUltraSSD", "type": "bool"}, + "enable_fips": {"key": "properties.enableFIPS", "type": "bool"}, + "gpu_instance_profile": {"key": "properties.gpuInstanceProfile", "type": "str"}, + "creation_data": {"key": "properties.creationData", "type": "CreationData"}, + "capacity_reservation_group_id": {"key": "properties.capacityReservationGroupID", "type": "str"}, + "host_group_id": {"key": "properties.hostGroupID", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, count: Optional[int] = None, @@ -297,7 +292,7 @@ def __init__( vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, @@ -312,9 +307,9 @@ def __init__( availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", - spot_max_price: Optional[float] = -1, + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", + spot_max_price: float = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, @@ -347,15 +342,15 @@ def __init__( larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.OSDiskType :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime - data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + data root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.KubeletDiskType :keyword workload_runtime: Determines the type of workload a node can run. Known values are: - "OCIContainer", "WasmWasi". + "OCIContainer" and "WasmWasi". :paramtype workload_runtime: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.WorkloadRuntime :keyword message_of_the_day: A base64-encoded string which will be written to /etc/motd after @@ -374,11 +369,11 @@ def __init__( :paramtype pod_subnet_id: str :keyword max_pods: The maximum number of pods that can run on a node. :paramtype max_pods: int - :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.OSType :keyword os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Known values are: "Ubuntu", "CBLMariner". + Known values are: "Ubuntu" and "CBLMariner". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.OSSKU :keyword max_count: The maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -387,16 +382,16 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, - it defaults to Delete. Known values are: "Delete", "Deallocate". + it defaults to Delete. Known values are: "Delete" and "Deallocate". :paramtype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.ScaleDownMode :keyword type_properties_type: The type of Agent Pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type_properties_type: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.AgentPoolType :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.AgentPoolMode :keyword orchestrator_version: Both patch version and are supported. When is specified, the latest supported patch version is chosen @@ -434,20 +429,18 @@ def __init__( /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the - default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + default is 'Regular'. Known values are: "Spot" and "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.ScaleSetPriority :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.ScaleSetEvictionPolicy :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :paramtype spot_max_price: float - :keyword tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :keyword tags: The tags to be persisted on the agent pool virtual machine scale set. :paramtype tags: dict[str, str] :keyword node_labels: The node labels to be persisted across all nodes in agent pool. :paramtype node_labels: dict[str, str] @@ -473,7 +466,7 @@ def __init__( for more details. :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance - profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.GPUInstanceProfile @@ -489,7 +482,7 @@ def __init__( `_. :paramtype host_group_id: str """ - super(AgentPool, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.vm_size = vm_size self.os_disk_size_gb = os_disk_size_gb @@ -535,7 +528,7 @@ def __init__( self.host_group_id = host_group_id -class AgentPoolAvailableVersions(msrest.serialization.Model): +class AgentPoolAvailableVersions(_serialization.Model): """The list of available versions for an agent pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -552,16 +545,19 @@ class AgentPoolAvailableVersions(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'agent_pool_versions': {'key': 'properties.agentPoolVersions', 'type': '[AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "agent_pool_versions": { + "key": "properties.agentPoolVersions", + "type": "[AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem]", + }, } def __init__( @@ -575,14 +571,14 @@ def __init__( :paramtype agent_pool_versions: list[~azure.mgmt.containerservice.v2022_03_02_preview.models.AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem] """ - super(AgentPoolAvailableVersions, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None self.agent_pool_versions = agent_pool_versions -class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(msrest.serialization.Model): +class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(_serialization.Model): """AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem. :ivar default: Whether this version is the default agent pool version. @@ -594,9 +590,9 @@ class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(msrest.serializa """ _attribute_map = { - 'default': {'key': 'default', 'type': 'bool'}, - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "default": {"key": "default", "type": "bool"}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } def __init__( @@ -615,13 +611,13 @@ def __init__( :keyword is_preview: Whether Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.default = default self.kubernetes_version = kubernetes_version self.is_preview = is_preview -class AgentPoolListResult(msrest.serialization.Model): +class AgentPoolListResult(_serialization.Model): """The response from the List Agent Pools operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -633,30 +629,25 @@ class AgentPoolListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[AgentPool]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[AgentPool]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.AgentPool"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.AgentPool"]] = None, **kwargs): """ :keyword value: The list of agent pools. :paramtype value: list[~azure.mgmt.containerservice.v2022_03_02_preview.models.AgentPool] """ - super(AgentPoolListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class AgentPoolUpgradeProfile(msrest.serialization.Model): +class AgentPoolUpgradeProfile(_serialization.Model): """The list of available upgrades for an agent pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -669,10 +660,10 @@ class AgentPoolUpgradeProfile(msrest.serialization.Model): :vartype name: str :ivar type: The type of the agent pool upgrade profile. :vartype type: str - :ivar kubernetes_version: Required. The Kubernetes version (major.minor.patch). + :ivar kubernetes_version: The Kubernetes version (major.minor.patch). Required. :vartype kubernetes_version: str - :ivar os_type: Required. The operating system type. The default is Linux. Known values are: - "Linux", "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -682,21 +673,21 @@ class AgentPoolUpgradeProfile(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kubernetes_version': {'required': True}, - 'os_type': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "kubernetes_version": {"required": True}, + "os_type": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'kubernetes_version': {'key': 'properties.kubernetesVersion', 'type': 'str'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'upgrades': {'key': 'properties.upgrades', 'type': '[AgentPoolUpgradeProfilePropertiesUpgradesItem]'}, - 'latest_node_image_version': {'key': 'properties.latestNodeImageVersion', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "os_type": {"key": "properties.osType", "type": "str"}, + "upgrades": {"key": "properties.upgrades", "type": "[AgentPoolUpgradeProfilePropertiesUpgradesItem]"}, + "latest_node_image_version": {"key": "properties.latestNodeImageVersion", "type": "str"}, } def __init__( @@ -709,10 +700,10 @@ def __init__( **kwargs ): """ - :keyword kubernetes_version: Required. The Kubernetes version (major.minor.patch). + :keyword kubernetes_version: The Kubernetes version (major.minor.patch). Required. :paramtype kubernetes_version: str - :keyword os_type: Required. The operating system type. The default is Linux. Known values are: - "Linux", "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: @@ -720,7 +711,7 @@ def __init__( :keyword latest_node_image_version: The latest AKS supported node image version. :paramtype latest_node_image_version: str """ - super(AgentPoolUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -730,7 +721,7 @@ def __init__( self.latest_node_image_version = latest_node_image_version -class AgentPoolUpgradeProfilePropertiesUpgradesItem(msrest.serialization.Model): +class AgentPoolUpgradeProfilePropertiesUpgradesItem(_serialization.Model): """AgentPoolUpgradeProfilePropertiesUpgradesItem. :ivar kubernetes_version: The Kubernetes version (major.minor.patch). @@ -740,29 +731,23 @@ class AgentPoolUpgradeProfilePropertiesUpgradesItem(msrest.serialization.Model): """ _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } - def __init__( - self, - *, - kubernetes_version: Optional[str] = None, - is_preview: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, kubernetes_version: Optional[str] = None, is_preview: Optional[bool] = None, **kwargs): """ :keyword kubernetes_version: The Kubernetes version (major.minor.patch). :paramtype kubernetes_version: str :keyword is_preview: Whether the Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(AgentPoolUpgradeProfilePropertiesUpgradesItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.is_preview = is_preview -class AgentPoolUpgradeSettings(msrest.serialization.Model): +class AgentPoolUpgradeSettings(_serialization.Model): """Settings for upgrading an agentpool. :ivar max_surge: This can either be set to an integer (e.g. '5') or a percentage (e.g. '50%'). @@ -774,15 +759,10 @@ class AgentPoolUpgradeSettings(msrest.serialization.Model): """ _attribute_map = { - 'max_surge': {'key': 'maxSurge', 'type': 'str'}, + "max_surge": {"key": "maxSurge", "type": "str"}, } - def __init__( - self, - *, - max_surge: Optional[str] = None, - **kwargs - ): + def __init__(self, *, max_surge: Optional[str] = None, **kwargs): """ :keyword max_surge: This can either be set to an integer (e.g. '5') or a percentage (e.g. '50%'). If a percentage is specified, it is the percentage of the total agent pool size at the @@ -791,11 +771,11 @@ def __init__( https://docs.microsoft.com/azure/aks/upgrade-cluster#customize-node-surge-upgrade. :paramtype max_surge: str """ - super(AgentPoolUpgradeSettings, self).__init__(**kwargs) + super().__init__(**kwargs) self.max_surge = max_surge -class AzureKeyVaultKms(msrest.serialization.Model): +class AzureKeyVaultKms(_serialization.Model): """Azure Key Vault key management service settings for the security profile. :ivar enabled: Whether to enable Azure Key Vault key management service. The default is false. @@ -809,17 +789,11 @@ class AzureKeyVaultKms(msrest.serialization.Model): """ _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'key_id': {'key': 'keyId', 'type': 'str'}, + "enabled": {"key": "enabled", "type": "bool"}, + "key_id": {"key": "keyId", "type": "str"}, } - def __init__( - self, - *, - enabled: Optional[bool] = None, - key_id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, enabled: Optional[bool] = None, key_id: Optional[str] = None, **kwargs): """ :keyword enabled: Whether to enable Azure Key Vault key management service. The default is false. @@ -831,12 +805,12 @@ def __init__( disabled, leave the field empty. :paramtype key_id: str """ - super(AzureKeyVaultKms, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.key_id = key_id -class CloudErrorBody(msrest.serialization.Model): +class CloudErrorBody(_serialization.Model): """An error response from the Container service. :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed @@ -853,10 +827,10 @@ class CloudErrorBody(msrest.serialization.Model): """ _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[CloudErrorBody]"}, } def __init__( @@ -882,88 +856,77 @@ def __init__( :paramtype details: list[~azure.mgmt.containerservice.v2022_03_02_preview.models.CloudErrorBody] """ - super(CloudErrorBody, self).__init__(**kwargs) + super().__init__(**kwargs) self.code = code self.message = message self.target = target self.details = details -class ContainerServiceDiagnosticsProfile(msrest.serialization.Model): +class ContainerServiceDiagnosticsProfile(_serialization.Model): """Profile for diagnostics on the container service cluster. All required parameters must be populated in order to send to Azure. - :ivar vm_diagnostics: Required. Profile for diagnostics on the container service VMs. + :ivar vm_diagnostics: Profile for diagnostics on the container service VMs. Required. :vartype vm_diagnostics: ~azure.mgmt.containerservice.v2022_03_02_preview.models.ContainerServiceVMDiagnostics """ _validation = { - 'vm_diagnostics': {'required': True}, + "vm_diagnostics": {"required": True}, } _attribute_map = { - 'vm_diagnostics': {'key': 'vmDiagnostics', 'type': 'ContainerServiceVMDiagnostics'}, + "vm_diagnostics": {"key": "vmDiagnostics", "type": "ContainerServiceVMDiagnostics"}, } - def __init__( - self, - *, - vm_diagnostics: "_models.ContainerServiceVMDiagnostics", - **kwargs - ): + def __init__(self, *, vm_diagnostics: "_models.ContainerServiceVMDiagnostics", **kwargs): """ - :keyword vm_diagnostics: Required. Profile for diagnostics on the container service VMs. + :keyword vm_diagnostics: Profile for diagnostics on the container service VMs. Required. :paramtype vm_diagnostics: ~azure.mgmt.containerservice.v2022_03_02_preview.models.ContainerServiceVMDiagnostics """ - super(ContainerServiceDiagnosticsProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.vm_diagnostics = vm_diagnostics -class ContainerServiceLinuxProfile(msrest.serialization.Model): +class ContainerServiceLinuxProfile(_serialization.Model): """Profile for Linux VMs in the container service cluster. All required parameters must be populated in order to send to Azure. - :ivar admin_username: Required. The administrator username to use for Linux VMs. + :ivar admin_username: The administrator username to use for Linux VMs. Required. :vartype admin_username: str - :ivar ssh: Required. The SSH configuration for Linux-based VMs running on Azure. + :ivar ssh: The SSH configuration for Linux-based VMs running on Azure. Required. :vartype ssh: ~azure.mgmt.containerservice.v2022_03_02_preview.models.ContainerServiceSshConfiguration """ _validation = { - 'admin_username': {'required': True, 'pattern': r'^[A-Za-z][-A-Za-z0-9_]*$'}, - 'ssh': {'required': True}, + "admin_username": {"required": True, "pattern": r"^[A-Za-z][-A-Za-z0-9_]*$"}, + "ssh": {"required": True}, } _attribute_map = { - 'admin_username': {'key': 'adminUsername', 'type': 'str'}, - 'ssh': {'key': 'ssh', 'type': 'ContainerServiceSshConfiguration'}, + "admin_username": {"key": "adminUsername", "type": "str"}, + "ssh": {"key": "ssh", "type": "ContainerServiceSshConfiguration"}, } - def __init__( - self, - *, - admin_username: str, - ssh: "_models.ContainerServiceSshConfiguration", - **kwargs - ): + def __init__(self, *, admin_username: str, ssh: "_models.ContainerServiceSshConfiguration", **kwargs): """ - :keyword admin_username: Required. The administrator username to use for Linux VMs. + :keyword admin_username: The administrator username to use for Linux VMs. Required. :paramtype admin_username: str - :keyword ssh: Required. The SSH configuration for Linux-based VMs running on Azure. + :keyword ssh: The SSH configuration for Linux-based VMs running on Azure. Required. :paramtype ssh: ~azure.mgmt.containerservice.v2022_03_02_preview.models.ContainerServiceSshConfiguration """ - super(ContainerServiceLinuxProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.admin_username = admin_username self.ssh = ssh -class ContainerServiceMasterProfile(msrest.serialization.Model): +class ContainerServiceMasterProfile(_serialization.Model): """Profile for the container service master. Variables are only populated by the server, and will be ignored when sending a request. @@ -971,11 +934,11 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar count: Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, - and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". + and 5. The default value is 1. Known values are: 1, 3, and 5. :vartype count: int or ~azure.mgmt.containerservice.v2022_03_02_preview.models.Count - :ivar dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. + :ivar dns_prefix: DNS prefix to be used to create the FQDN for the master pool. Required. :vartype dns_prefix: str - :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + :ivar vm_size: Size of agent VMs. Required. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -1012,7 +975,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :vartype vm_size: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.ContainerServiceVMSizeTypes :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine @@ -1026,7 +989,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): :vartype first_consecutive_static_ip: str :ivar storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount" and "ManagedDisks". :vartype storage_profile: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.ContainerServiceStorageProfileTypes :ivar fqdn: FQDN for the master pool. @@ -1034,21 +997,21 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): """ _validation = { - 'dns_prefix': {'required': True}, - 'vm_size': {'required': True}, - 'os_disk_size_gb': {'maximum': 2048, 'minimum': 0}, - 'fqdn': {'readonly': True}, + "dns_prefix": {"required": True}, + "vm_size": {"required": True}, + "os_disk_size_gb": {"maximum": 2048, "minimum": 0}, + "fqdn": {"readonly": True}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'dns_prefix': {'key': 'dnsPrefix', 'type': 'str'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'first_consecutive_static_ip': {'key': 'firstConsecutiveStaticIP', 'type': 'str'}, - 'storage_profile': {'key': 'storageProfile', 'type': 'str'}, - 'fqdn': {'key': 'fqdn', 'type': 'str'}, + "count": {"key": "count", "type": "int"}, + "dns_prefix": {"key": "dnsPrefix", "type": "str"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "first_consecutive_static_ip": {"key": "firstConsecutiveStaticIP", "type": "str"}, + "storage_profile": {"key": "storageProfile", "type": "str"}, + "fqdn": {"key": "fqdn", "type": "str"}, } def __init__( @@ -1056,20 +1019,20 @@ def __init__( *, dns_prefix: str, vm_size: Union[str, "_models.ContainerServiceVMSizeTypes"], - count: Optional[Union[int, "_models.Count"]] = 1, + count: Union[int, "_models.Count"] = 1, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, - first_consecutive_static_ip: Optional[str] = "10.240.255.5", + first_consecutive_static_ip: str = "10.240.255.5", storage_profile: Optional[Union[str, "_models.ContainerServiceStorageProfileTypes"]] = None, **kwargs ): """ :keyword count: Number of masters (VMs) in the container service cluster. Allowed values are 1, - 3, and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". + 3, and 5. The default value is 1. Known values are: 1, 3, and 5. :paramtype count: int or ~azure.mgmt.containerservice.v2022_03_02_preview.models.Count - :keyword dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. + :keyword dns_prefix: DNS prefix to be used to create the FQDN for the master pool. Required. :paramtype dns_prefix: str - :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + :keyword vm_size: Size of agent VMs. Required. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -1106,7 +1069,7 @@ def __init__( "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :paramtype vm_size: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.ContainerServiceVMSizeTypes :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every @@ -1120,11 +1083,11 @@ def __init__( :paramtype first_consecutive_static_ip: str :keyword storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount" and "ManagedDisks". :paramtype storage_profile: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.ContainerServiceStorageProfileTypes """ - super(ContainerServiceMasterProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.dns_prefix = dns_prefix self.vm_size = vm_size @@ -1135,19 +1098,19 @@ def __init__( self.fqdn = None -class ContainerServiceNetworkProfile(msrest.serialization.Model): +class ContainerServiceNetworkProfile(_serialization.Model): # pylint: disable=too-many-instance-attributes """Profile of network configuration. :ivar network_plugin: Network plugin used for building the Kubernetes network. Known values - are: "azure", "kubenet", "none". Default value: "kubenet". + are: "azure", "kubenet", and "none". :vartype network_plugin: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.NetworkPlugin :ivar network_policy: Network policy used for building the Kubernetes network. Known values - are: "calico", "azure". + are: "calico" and "azure". :vartype network_policy: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.NetworkPolicy :ivar network_mode: This cannot be specified if networkPlugin is anything other than 'azure'. - Known values are: "transparent", "bridge". + Known values are: "transparent" and "bridge". :vartype network_mode: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.NetworkMode :ivar pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. @@ -1164,13 +1127,12 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): :ivar outbound_type: This can only be set at cluster creation time and cannot be changed later. For more information see `egress outbound type `_. Known values are: "loadBalancer", - "userDefinedRouting", "managedNATGateway", "userAssignedNATGateway". Default value: - "loadBalancer". + "userDefinedRouting", "managedNATGateway", and "userAssignedNATGateway". :vartype outbound_type: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.OutboundType :ivar load_balancer_sku: The default is 'standard'. See `Azure Load Balancer SKUs `_ for more information about the - differences between load balancer SKUs. Known values are: "standard", "basic". + differences between load balancer SKUs. Known values are: "standard" and "basic". :vartype load_balancer_sku: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.LoadBalancerSku :ivar load_balancer_profile: Profile of the cluster load balancer. @@ -1194,40 +1156,42 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): """ _validation = { - 'pod_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, - 'service_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, - 'dns_service_ip': {'pattern': r'^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$'}, - 'docker_bridge_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, + "pod_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, + "service_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, + "dns_service_ip": { + "pattern": r"^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$" + }, + "docker_bridge_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, } _attribute_map = { - 'network_plugin': {'key': 'networkPlugin', 'type': 'str'}, - 'network_policy': {'key': 'networkPolicy', 'type': 'str'}, - 'network_mode': {'key': 'networkMode', 'type': 'str'}, - 'pod_cidr': {'key': 'podCidr', 'type': 'str'}, - 'service_cidr': {'key': 'serviceCidr', 'type': 'str'}, - 'dns_service_ip': {'key': 'dnsServiceIP', 'type': 'str'}, - 'docker_bridge_cidr': {'key': 'dockerBridgeCidr', 'type': 'str'}, - 'outbound_type': {'key': 'outboundType', 'type': 'str'}, - 'load_balancer_sku': {'key': 'loadBalancerSku', 'type': 'str'}, - 'load_balancer_profile': {'key': 'loadBalancerProfile', 'type': 'ManagedClusterLoadBalancerProfile'}, - 'nat_gateway_profile': {'key': 'natGatewayProfile', 'type': 'ManagedClusterNATGatewayProfile'}, - 'pod_cidrs': {'key': 'podCidrs', 'type': '[str]'}, - 'service_cidrs': {'key': 'serviceCidrs', 'type': '[str]'}, - 'ip_families': {'key': 'ipFamilies', 'type': '[str]'}, + "network_plugin": {"key": "networkPlugin", "type": "str"}, + "network_policy": {"key": "networkPolicy", "type": "str"}, + "network_mode": {"key": "networkMode", "type": "str"}, + "pod_cidr": {"key": "podCidr", "type": "str"}, + "service_cidr": {"key": "serviceCidr", "type": "str"}, + "dns_service_ip": {"key": "dnsServiceIP", "type": "str"}, + "docker_bridge_cidr": {"key": "dockerBridgeCidr", "type": "str"}, + "outbound_type": {"key": "outboundType", "type": "str"}, + "load_balancer_sku": {"key": "loadBalancerSku", "type": "str"}, + "load_balancer_profile": {"key": "loadBalancerProfile", "type": "ManagedClusterLoadBalancerProfile"}, + "nat_gateway_profile": {"key": "natGatewayProfile", "type": "ManagedClusterNATGatewayProfile"}, + "pod_cidrs": {"key": "podCidrs", "type": "[str]"}, + "service_cidrs": {"key": "serviceCidrs", "type": "[str]"}, + "ip_families": {"key": "ipFamilies", "type": "[str]"}, } def __init__( self, *, - network_plugin: Optional[Union[str, "_models.NetworkPlugin"]] = "kubenet", + network_plugin: Union[str, "_models.NetworkPlugin"] = "kubenet", network_policy: Optional[Union[str, "_models.NetworkPolicy"]] = None, network_mode: Optional[Union[str, "_models.NetworkMode"]] = None, - pod_cidr: Optional[str] = "10.244.0.0/16", - service_cidr: Optional[str] = "10.0.0.0/16", - dns_service_ip: Optional[str] = "10.0.0.10", - docker_bridge_cidr: Optional[str] = "172.17.0.1/16", - outbound_type: Optional[Union[str, "_models.OutboundType"]] = "loadBalancer", + pod_cidr: str = "10.244.0.0/16", + service_cidr: str = "10.0.0.0/16", + dns_service_ip: str = "10.0.0.10", + docker_bridge_cidr: str = "172.17.0.1/16", + outbound_type: Union[str, "_models.OutboundType"] = "loadBalancer", load_balancer_sku: Optional[Union[str, "_models.LoadBalancerSku"]] = None, load_balancer_profile: Optional["_models.ManagedClusterLoadBalancerProfile"] = None, nat_gateway_profile: Optional["_models.ManagedClusterNATGatewayProfile"] = None, @@ -1238,15 +1202,15 @@ def __init__( ): """ :keyword network_plugin: Network plugin used for building the Kubernetes network. Known values - are: "azure", "kubenet", "none". Default value: "kubenet". + are: "azure", "kubenet", and "none". :paramtype network_plugin: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.NetworkPlugin :keyword network_policy: Network policy used for building the Kubernetes network. Known values - are: "calico", "azure". + are: "calico" and "azure". :paramtype network_policy: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.NetworkPolicy :keyword network_mode: This cannot be specified if networkPlugin is anything other than - 'azure'. Known values are: "transparent", "bridge". + 'azure'. Known values are: "transparent" and "bridge". :paramtype network_mode: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.NetworkMode :keyword pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. @@ -1263,13 +1227,12 @@ def __init__( :keyword outbound_type: This can only be set at cluster creation time and cannot be changed later. For more information see `egress outbound type `_. Known values are: "loadBalancer", - "userDefinedRouting", "managedNATGateway", "userAssignedNATGateway". Default value: - "loadBalancer". + "userDefinedRouting", "managedNATGateway", and "userAssignedNATGateway". :paramtype outbound_type: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.OutboundType :keyword load_balancer_sku: The default is 'standard'. See `Azure Load Balancer SKUs `_ for more information about the - differences between load balancer SKUs. Known values are: "standard", "basic". + differences between load balancer SKUs. Known values are: "standard" and "basic". :paramtype load_balancer_sku: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.LoadBalancerSku :keyword load_balancer_profile: Profile of the cluster load balancer. @@ -1291,7 +1254,7 @@ def __init__( :paramtype ip_families: list[str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.IpFamily] """ - super(ContainerServiceNetworkProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.network_plugin = network_plugin self.network_policy = network_policy self.network_mode = network_mode @@ -1308,113 +1271,98 @@ def __init__( self.ip_families = ip_families -class ContainerServiceSshConfiguration(msrest.serialization.Model): +class ContainerServiceSshConfiguration(_serialization.Model): """SSH configuration for Linux-based VMs running on Azure. All required parameters must be populated in order to send to Azure. - :ivar public_keys: Required. The list of SSH public keys used to authenticate with Linux-based - VMs. A maximum of 1 key may be specified. + :ivar public_keys: The list of SSH public keys used to authenticate with Linux-based VMs. A + maximum of 1 key may be specified. Required. :vartype public_keys: list[~azure.mgmt.containerservice.v2022_03_02_preview.models.ContainerServiceSshPublicKey] """ _validation = { - 'public_keys': {'required': True}, + "public_keys": {"required": True}, } _attribute_map = { - 'public_keys': {'key': 'publicKeys', 'type': '[ContainerServiceSshPublicKey]'}, + "public_keys": {"key": "publicKeys", "type": "[ContainerServiceSshPublicKey]"}, } - def __init__( - self, - *, - public_keys: List["_models.ContainerServiceSshPublicKey"], - **kwargs - ): + def __init__(self, *, public_keys: List["_models.ContainerServiceSshPublicKey"], **kwargs): """ - :keyword public_keys: Required. The list of SSH public keys used to authenticate with - Linux-based VMs. A maximum of 1 key may be specified. + :keyword public_keys: The list of SSH public keys used to authenticate with Linux-based VMs. A + maximum of 1 key may be specified. Required. :paramtype public_keys: list[~azure.mgmt.containerservice.v2022_03_02_preview.models.ContainerServiceSshPublicKey] """ - super(ContainerServiceSshConfiguration, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_keys = public_keys -class ContainerServiceSshPublicKey(msrest.serialization.Model): +class ContainerServiceSshPublicKey(_serialization.Model): """Contains information about SSH certificate public key data. All required parameters must be populated in order to send to Azure. - :ivar key_data: Required. Certificate public key used to authenticate with VMs through SSH. The - certificate must be in PEM format with or without headers. + :ivar key_data: Certificate public key used to authenticate with VMs through SSH. The + certificate must be in PEM format with or without headers. Required. :vartype key_data: str """ _validation = { - 'key_data': {'required': True}, + "key_data": {"required": True}, } _attribute_map = { - 'key_data': {'key': 'keyData', 'type': 'str'}, + "key_data": {"key": "keyData", "type": "str"}, } - def __init__( - self, - *, - key_data: str, - **kwargs - ): + def __init__(self, *, key_data: str, **kwargs): """ - :keyword key_data: Required. Certificate public key used to authenticate with VMs through SSH. - The certificate must be in PEM format with or without headers. + :keyword key_data: Certificate public key used to authenticate with VMs through SSH. The + certificate must be in PEM format with or without headers. Required. :paramtype key_data: str """ - super(ContainerServiceSshPublicKey, self).__init__(**kwargs) + super().__init__(**kwargs) self.key_data = key_data -class ContainerServiceVMDiagnostics(msrest.serialization.Model): +class ContainerServiceVMDiagnostics(_serialization.Model): """Profile for diagnostics on the container service VMs. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar enabled: Required. Whether the VM diagnostic agent is provisioned on the VM. + :ivar enabled: Whether the VM diagnostic agent is provisioned on the VM. Required. :vartype enabled: bool :ivar storage_uri: The URI of the storage account where diagnostics are stored. :vartype storage_uri: str """ _validation = { - 'enabled': {'required': True}, - 'storage_uri': {'readonly': True}, + "enabled": {"required": True}, + "storage_uri": {"readonly": True}, } _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'storage_uri': {'key': 'storageUri', 'type': 'str'}, + "enabled": {"key": "enabled", "type": "bool"}, + "storage_uri": {"key": "storageUri", "type": "str"}, } - def __init__( - self, - *, - enabled: bool, - **kwargs - ): + def __init__(self, *, enabled: bool, **kwargs): """ - :keyword enabled: Required. Whether the VM diagnostic agent is provisioned on the VM. + :keyword enabled: Whether the VM diagnostic agent is provisioned on the VM. Required. :paramtype enabled: bool """ - super(ContainerServiceVMDiagnostics, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.storage_uri = None -class CreationData(msrest.serialization.Model): +class CreationData(_serialization.Model): """Data used when creating a target resource from a source resource. :ivar source_resource_id: This is the ARM ID of the source object to be used to create the @@ -1423,25 +1371,20 @@ class CreationData(msrest.serialization.Model): """ _attribute_map = { - 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, + "source_resource_id": {"key": "sourceResourceId", "type": "str"}, } - def __init__( - self, - *, - source_resource_id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, source_resource_id: Optional[str] = None, **kwargs): """ :keyword source_resource_id: This is the ARM ID of the source object to be used to create the target object. :paramtype source_resource_id: str """ - super(CreationData, self).__init__(**kwargs) + super().__init__(**kwargs) self.source_resource_id = source_resource_id -class CredentialResult(msrest.serialization.Model): +class CredentialResult(_serialization.Model): """The credential result response. Variables are only populated by the server, and will be ignored when sending a request. @@ -1449,31 +1392,27 @@ class CredentialResult(msrest.serialization.Model): :ivar name: The name of the credential. :vartype name: str :ivar value: Base64-encoded Kubernetes configuration file. - :vartype value: bytearray + :vartype value: bytes """ _validation = { - 'name': {'readonly': True}, - 'value': {'readonly': True}, + "name": {"readonly": True}, + "value": {"readonly": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'bytearray'}, + "name": {"key": "name", "type": "str"}, + "value": {"key": "value", "type": "bytearray"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(CredentialResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.name = None self.value = None -class CredentialResults(msrest.serialization.Model): +class CredentialResults(_serialization.Model): """The list credential result response. Variables are only populated by the server, and will be ignored when sending a request. @@ -1484,24 +1423,20 @@ class CredentialResults(msrest.serialization.Model): """ _validation = { - 'kubeconfigs': {'readonly': True}, + "kubeconfigs": {"readonly": True}, } _attribute_map = { - 'kubeconfigs': {'key': 'kubeconfigs', 'type': '[CredentialResult]'}, + "kubeconfigs": {"key": "kubeconfigs", "type": "[CredentialResult]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(CredentialResults, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.kubeconfigs = None -class EndpointDependency(msrest.serialization.Model): +class EndpointDependency(_serialization.Model): """A domain name that AKS agent nodes are reaching at. :ivar domain_name: The domain name of the dependency. @@ -1512,8 +1447,8 @@ class EndpointDependency(msrest.serialization.Model): """ _attribute_map = { - 'domain_name': {'key': 'domainName', 'type': 'str'}, - 'endpoint_details': {'key': 'endpointDetails', 'type': '[EndpointDetail]'}, + "domain_name": {"key": "domainName", "type": "str"}, + "endpoint_details": {"key": "endpointDetails", "type": "[EndpointDetail]"}, } def __init__( @@ -1530,12 +1465,12 @@ def __init__( :paramtype endpoint_details: list[~azure.mgmt.containerservice.v2022_03_02_preview.models.EndpointDetail] """ - super(EndpointDependency, self).__init__(**kwargs) + super().__init__(**kwargs) self.domain_name = domain_name self.endpoint_details = endpoint_details -class EndpointDetail(msrest.serialization.Model): +class EndpointDetail(_serialization.Model): """connect information from the AKS agent nodes to a single endpoint. :ivar ip_address: An IP Address that Domain Name currently resolves to. @@ -1549,10 +1484,10 @@ class EndpointDetail(msrest.serialization.Model): """ _attribute_map = { - 'ip_address': {'key': 'ipAddress', 'type': 'str'}, - 'port': {'key': 'port', 'type': 'int'}, - 'protocol': {'key': 'protocol', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, + "ip_address": {"key": "ipAddress", "type": "str"}, + "port": {"key": "port", "type": "int"}, + "protocol": {"key": "protocol", "type": "str"}, + "description": {"key": "description", "type": "str"}, } def __init__( @@ -1574,26 +1509,26 @@ def __init__( :keyword description: Description of the detail. :paramtype description: str """ - super(EndpointDetail, self).__init__(**kwargs) + super().__init__(**kwargs) self.ip_address = ip_address self.port = port self.protocol = protocol self.description = description -class ExtendedLocation(msrest.serialization.Model): +class ExtendedLocation(_serialization.Model): """The complex type of the extended location. :ivar name: The name of the extended location. :vartype name: str - :ivar type: The type of the extended location. Known values are: "EdgeZone". + :ivar type: The type of the extended location. "EdgeZone" :vartype type: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.ExtendedLocationTypes """ _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, } def __init__( @@ -1606,16 +1541,16 @@ def __init__( """ :keyword name: The name of the extended location. :paramtype name: str - :keyword type: The type of the extended location. Known values are: "EdgeZone". + :keyword type: The type of the extended location. "EdgeZone" :paramtype type: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.ExtendedLocationTypes """ - super(ExtendedLocation, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.type = type -class KubeletConfig(msrest.serialization.Model): +class KubeletConfig(_serialization.Model): # pylint: disable=too-many-instance-attributes """See `AKS custom node configuration `_ for more details. :ivar cpu_manager_policy: The default is 'none'. See `Kubernetes CPU management policies @@ -1655,21 +1590,21 @@ class KubeletConfig(msrest.serialization.Model): """ _validation = { - 'container_log_max_files': {'minimum': 2}, + "container_log_max_files": {"minimum": 2}, } _attribute_map = { - 'cpu_manager_policy': {'key': 'cpuManagerPolicy', 'type': 'str'}, - 'cpu_cfs_quota': {'key': 'cpuCfsQuota', 'type': 'bool'}, - 'cpu_cfs_quota_period': {'key': 'cpuCfsQuotaPeriod', 'type': 'str'}, - 'image_gc_high_threshold': {'key': 'imageGcHighThreshold', 'type': 'int'}, - 'image_gc_low_threshold': {'key': 'imageGcLowThreshold', 'type': 'int'}, - 'topology_manager_policy': {'key': 'topologyManagerPolicy', 'type': 'str'}, - 'allowed_unsafe_sysctls': {'key': 'allowedUnsafeSysctls', 'type': '[str]'}, - 'fail_swap_on': {'key': 'failSwapOn', 'type': 'bool'}, - 'container_log_max_size_mb': {'key': 'containerLogMaxSizeMB', 'type': 'int'}, - 'container_log_max_files': {'key': 'containerLogMaxFiles', 'type': 'int'}, - 'pod_max_pids': {'key': 'podMaxPids', 'type': 'int'}, + "cpu_manager_policy": {"key": "cpuManagerPolicy", "type": "str"}, + "cpu_cfs_quota": {"key": "cpuCfsQuota", "type": "bool"}, + "cpu_cfs_quota_period": {"key": "cpuCfsQuotaPeriod", "type": "str"}, + "image_gc_high_threshold": {"key": "imageGcHighThreshold", "type": "int"}, + "image_gc_low_threshold": {"key": "imageGcLowThreshold", "type": "int"}, + "topology_manager_policy": {"key": "topologyManagerPolicy", "type": "str"}, + "allowed_unsafe_sysctls": {"key": "allowedUnsafeSysctls", "type": "[str]"}, + "fail_swap_on": {"key": "failSwapOn", "type": "bool"}, + "container_log_max_size_mb": {"key": "containerLogMaxSizeMB", "type": "int"}, + "container_log_max_files": {"key": "containerLogMaxFiles", "type": "int"}, + "pod_max_pids": {"key": "podMaxPids", "type": "int"}, } def __init__( @@ -1724,7 +1659,7 @@ def __init__( :keyword pod_max_pids: The maximum number of processes per pod. :paramtype pod_max_pids: int """ - super(KubeletConfig, self).__init__(**kwargs) + super().__init__(**kwargs) self.cpu_manager_policy = cpu_manager_policy self.cpu_cfs_quota = cpu_cfs_quota self.cpu_cfs_quota_period = cpu_cfs_quota_period @@ -1738,7 +1673,7 @@ def __init__( self.pod_max_pids = pod_max_pids -class LinuxOSConfig(msrest.serialization.Model): +class LinuxOSConfig(_serialization.Model): """See `AKS custom node configuration `_ for more details. :ivar sysctls: Sysctl settings for Linux agent nodes. @@ -1757,10 +1692,10 @@ class LinuxOSConfig(msrest.serialization.Model): """ _attribute_map = { - 'sysctls': {'key': 'sysctls', 'type': 'SysctlConfig'}, - 'transparent_huge_page_enabled': {'key': 'transparentHugePageEnabled', 'type': 'str'}, - 'transparent_huge_page_defrag': {'key': 'transparentHugePageDefrag', 'type': 'str'}, - 'swap_file_size_mb': {'key': 'swapFileSizeMB', 'type': 'int'}, + "sysctls": {"key": "sysctls", "type": "SysctlConfig"}, + "transparent_huge_page_enabled": {"key": "transparentHugePageEnabled", "type": "str"}, + "transparent_huge_page_defrag": {"key": "transparentHugePageDefrag", "type": "str"}, + "swap_file_size_mb": {"key": "swapFileSizeMB", "type": "int"}, } def __init__( @@ -1787,7 +1722,7 @@ def __init__( :keyword swap_file_size_mb: The size in MB of a swap file that will be created on each node. :paramtype swap_file_size_mb: int """ - super(LinuxOSConfig, self).__init__(**kwargs) + super().__init__(**kwargs) self.sysctls = sysctls self.transparent_huge_page_enabled = transparent_huge_page_enabled self.transparent_huge_page_defrag = transparent_huge_page_defrag @@ -1817,19 +1752,19 @@ class MaintenanceConfiguration(SubResource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, + "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'}, - 'time_in_week': {'key': 'properties.timeInWeek', 'type': '[TimeInWeek]'}, - 'not_allowed_time': {'key': 'properties.notAllowedTime', 'type': '[TimeSpan]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "time_in_week": {"key": "properties.timeInWeek", "type": "[TimeInWeek]"}, + "not_allowed_time": {"key": "properties.notAllowedTime", "type": "[TimeSpan]"}, } def __init__( @@ -1848,13 +1783,13 @@ def __init__( :paramtype not_allowed_time: list[~azure.mgmt.containerservice.v2022_03_02_preview.models.TimeSpan] """ - super(MaintenanceConfiguration, self).__init__(**kwargs) + super().__init__(**kwargs) self.system_data = None self.time_in_week = time_in_week self.not_allowed_time = not_allowed_time -class MaintenanceConfigurationListResult(msrest.serialization.Model): +class MaintenanceConfigurationListResult(_serialization.Model): """The response from the List maintenance configurations operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -1867,31 +1802,26 @@ class MaintenanceConfigurationListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[MaintenanceConfiguration]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[MaintenanceConfiguration]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.MaintenanceConfiguration"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.MaintenanceConfiguration"]] = None, **kwargs): """ :keyword value: The list of maintenance configurations. :paramtype value: list[~azure.mgmt.containerservice.v2022_03_02_preview.models.MaintenanceConfiguration] """ - super(MaintenanceConfigurationListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class Resource(msrest.serialization.Model): +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. @@ -1910,26 +1840,22 @@ class Resource(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, + "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'}, + "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 - ): - """ - """ - super(Resource, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -1954,48 +1880,42 @@ class TrackedResource(Resource): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.containerservice.v2022_03_02_preview.models.SystemData - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] - :ivar location: Required. The geo-location where the resource lives. + :ivar location: The geo-location where the resource lives. Required. :vartype location: str """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'location': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, } - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] - :keyword location: Required. The geo-location where the resource lives. + :keyword location: The geo-location where the resource lives. Required. :paramtype location: str """ - super(TrackedResource, self).__init__(**kwargs) + super().__init__(**kwargs) self.tags = tags self.location = location -class ManagedCluster(TrackedResource): +class ManagedCluster(TrackedResource): # pylint: disable=too-many-instance-attributes """Managed cluster. Variables are only populated by the server, and will be ignored when sending a request. @@ -2013,9 +1933,9 @@ class ManagedCluster(TrackedResource): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.containerservice.v2022_03_02_preview.models.SystemData - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] - :ivar location: Required. The geo-location where the resource lives. + :ivar location: The geo-location where the resource lives. Required. :vartype location: str :ivar sku: The managed cluster SKU. :vartype sku: ~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedClusterSKU @@ -2129,74 +2049,83 @@ class ManagedCluster(TrackedResource): :vartype ingress_profile: ~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedClusterIngressProfile :ivar public_network_access: Allow or deny public network access for AKS. Known values are: - "Enabled", "Disabled". + "Enabled" and "Disabled". :vartype public_network_access: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.PublicNetworkAccess """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'location': {'required': True}, - 'provisioning_state': {'readonly': True}, - 'power_state': {'readonly': True}, - 'max_agent_pools': {'readonly': True}, - 'current_kubernetes_version': {'readonly': True}, - 'fqdn': {'readonly': True}, - 'private_fqdn': {'readonly': True}, - 'azure_portal_fqdn': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, + "provisioning_state": {"readonly": True}, + "power_state": {"readonly": True}, + "max_agent_pools": {"readonly": True}, + "current_kubernetes_version": {"readonly": True}, + "fqdn": {"readonly": True}, + "private_fqdn": {"readonly": True}, + "azure_portal_fqdn": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'ManagedClusterSKU'}, - 'extended_location': {'key': 'extendedLocation', 'type': 'ExtendedLocation'}, - 'identity': {'key': 'identity', 'type': 'ManagedClusterIdentity'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'power_state': {'key': 'properties.powerState', 'type': 'PowerState'}, - 'creation_data': {'key': 'properties.creationData', 'type': 'CreationData'}, - 'max_agent_pools': {'key': 'properties.maxAgentPools', 'type': 'int'}, - 'kubernetes_version': {'key': 'properties.kubernetesVersion', 'type': 'str'}, - 'current_kubernetes_version': {'key': 'properties.currentKubernetesVersion', 'type': 'str'}, - 'dns_prefix': {'key': 'properties.dnsPrefix', 'type': 'str'}, - 'fqdn_subdomain': {'key': 'properties.fqdnSubdomain', 'type': 'str'}, - 'fqdn': {'key': 'properties.fqdn', 'type': 'str'}, - 'private_fqdn': {'key': 'properties.privateFQDN', 'type': 'str'}, - 'azure_portal_fqdn': {'key': 'properties.azurePortalFQDN', 'type': 'str'}, - 'agent_pool_profiles': {'key': 'properties.agentPoolProfiles', 'type': '[ManagedClusterAgentPoolProfile]'}, - 'linux_profile': {'key': 'properties.linuxProfile', 'type': 'ContainerServiceLinuxProfile'}, - 'windows_profile': {'key': 'properties.windowsProfile', 'type': 'ManagedClusterWindowsProfile'}, - 'service_principal_profile': {'key': 'properties.servicePrincipalProfile', 'type': 'ManagedClusterServicePrincipalProfile'}, - 'addon_profiles': {'key': 'properties.addonProfiles', 'type': '{ManagedClusterAddonProfile}'}, - 'pod_identity_profile': {'key': 'properties.podIdentityProfile', 'type': 'ManagedClusterPodIdentityProfile'}, - 'oidc_issuer_profile': {'key': 'properties.oidcIssuerProfile', 'type': 'ManagedClusterOIDCIssuerProfile'}, - 'node_resource_group': {'key': 'properties.nodeResourceGroup', 'type': 'str'}, - 'enable_rbac': {'key': 'properties.enableRBAC', 'type': 'bool'}, - 'enable_pod_security_policy': {'key': 'properties.enablePodSecurityPolicy', 'type': 'bool'}, - 'enable_namespace_resources': {'key': 'properties.enableNamespaceResources', 'type': 'bool'}, - 'network_profile': {'key': 'properties.networkProfile', 'type': 'ContainerServiceNetworkProfile'}, - 'aad_profile': {'key': 'properties.aadProfile', 'type': 'ManagedClusterAADProfile'}, - 'auto_upgrade_profile': {'key': 'properties.autoUpgradeProfile', 'type': 'ManagedClusterAutoUpgradeProfile'}, - 'auto_scaler_profile': {'key': 'properties.autoScalerProfile', 'type': 'ManagedClusterPropertiesAutoScalerProfile'}, - 'api_server_access_profile': {'key': 'properties.apiServerAccessProfile', 'type': 'ManagedClusterAPIServerAccessProfile'}, - 'disk_encryption_set_id': {'key': 'properties.diskEncryptionSetID', 'type': 'str'}, - 'identity_profile': {'key': 'properties.identityProfile', 'type': '{UserAssignedIdentity}'}, - 'private_link_resources': {'key': 'properties.privateLinkResources', 'type': '[PrivateLinkResource]'}, - 'disable_local_accounts': {'key': 'properties.disableLocalAccounts', 'type': 'bool'}, - 'http_proxy_config': {'key': 'properties.httpProxyConfig', 'type': 'ManagedClusterHTTPProxyConfig'}, - 'security_profile': {'key': 'properties.securityProfile', 'type': 'ManagedClusterSecurityProfile'}, - 'ingress_profile': {'key': 'properties.ingressProfile', 'type': 'ManagedClusterIngressProfile'}, - 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, - } - - def __init__( + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "sku": {"key": "sku", "type": "ManagedClusterSKU"}, + "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, + "identity": {"key": "identity", "type": "ManagedClusterIdentity"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "power_state": {"key": "properties.powerState", "type": "PowerState"}, + "creation_data": {"key": "properties.creationData", "type": "CreationData"}, + "max_agent_pools": {"key": "properties.maxAgentPools", "type": "int"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "current_kubernetes_version": {"key": "properties.currentKubernetesVersion", "type": "str"}, + "dns_prefix": {"key": "properties.dnsPrefix", "type": "str"}, + "fqdn_subdomain": {"key": "properties.fqdnSubdomain", "type": "str"}, + "fqdn": {"key": "properties.fqdn", "type": "str"}, + "private_fqdn": {"key": "properties.privateFQDN", "type": "str"}, + "azure_portal_fqdn": {"key": "properties.azurePortalFQDN", "type": "str"}, + "agent_pool_profiles": {"key": "properties.agentPoolProfiles", "type": "[ManagedClusterAgentPoolProfile]"}, + "linux_profile": {"key": "properties.linuxProfile", "type": "ContainerServiceLinuxProfile"}, + "windows_profile": {"key": "properties.windowsProfile", "type": "ManagedClusterWindowsProfile"}, + "service_principal_profile": { + "key": "properties.servicePrincipalProfile", + "type": "ManagedClusterServicePrincipalProfile", + }, + "addon_profiles": {"key": "properties.addonProfiles", "type": "{ManagedClusterAddonProfile}"}, + "pod_identity_profile": {"key": "properties.podIdentityProfile", "type": "ManagedClusterPodIdentityProfile"}, + "oidc_issuer_profile": {"key": "properties.oidcIssuerProfile", "type": "ManagedClusterOIDCIssuerProfile"}, + "node_resource_group": {"key": "properties.nodeResourceGroup", "type": "str"}, + "enable_rbac": {"key": "properties.enableRBAC", "type": "bool"}, + "enable_pod_security_policy": {"key": "properties.enablePodSecurityPolicy", "type": "bool"}, + "enable_namespace_resources": {"key": "properties.enableNamespaceResources", "type": "bool"}, + "network_profile": {"key": "properties.networkProfile", "type": "ContainerServiceNetworkProfile"}, + "aad_profile": {"key": "properties.aadProfile", "type": "ManagedClusterAADProfile"}, + "auto_upgrade_profile": {"key": "properties.autoUpgradeProfile", "type": "ManagedClusterAutoUpgradeProfile"}, + "auto_scaler_profile": { + "key": "properties.autoScalerProfile", + "type": "ManagedClusterPropertiesAutoScalerProfile", + }, + "api_server_access_profile": { + "key": "properties.apiServerAccessProfile", + "type": "ManagedClusterAPIServerAccessProfile", + }, + "disk_encryption_set_id": {"key": "properties.diskEncryptionSetID", "type": "str"}, + "identity_profile": {"key": "properties.identityProfile", "type": "{UserAssignedIdentity}"}, + "private_link_resources": {"key": "properties.privateLinkResources", "type": "[PrivateLinkResource]"}, + "disable_local_accounts": {"key": "properties.disableLocalAccounts", "type": "bool"}, + "http_proxy_config": {"key": "properties.httpProxyConfig", "type": "ManagedClusterHTTPProxyConfig"}, + "security_profile": {"key": "properties.securityProfile", "type": "ManagedClusterSecurityProfile"}, + "ingress_profile": {"key": "properties.ingressProfile", "type": "ManagedClusterIngressProfile"}, + "public_network_access": {"key": "properties.publicNetworkAccess", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, location: str, @@ -2235,9 +2164,9 @@ def __init__( **kwargs ): """ - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] - :keyword location: Required. The geo-location where the resource lives. + :keyword location: The geo-location where the resource lives. Required. :paramtype location: str :keyword sku: The managed cluster SKU. :paramtype sku: ~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedClusterSKU @@ -2336,11 +2265,11 @@ def __init__( :paramtype ingress_profile: ~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedClusterIngressProfile :keyword public_network_access: Allow or deny public network access for AKS. Known values are: - "Enabled", "Disabled". + "Enabled" and "Disabled". :paramtype public_network_access: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.PublicNetworkAccess """ - super(ManagedCluster, self).__init__(tags=tags, location=location, **kwargs) + super().__init__(tags=tags, location=location, **kwargs) self.sku = sku self.extended_location = extended_location self.identity = identity @@ -2381,7 +2310,7 @@ def __init__( self.public_network_access = public_network_access -class ManagedClusterAADProfile(msrest.serialization.Model): +class ManagedClusterAADProfile(_serialization.Model): """For more details see `managed AAD on AKS `_. :ivar managed: Whether to enable managed AAD. @@ -2403,13 +2332,13 @@ class ManagedClusterAADProfile(msrest.serialization.Model): """ _attribute_map = { - 'managed': {'key': 'managed', 'type': 'bool'}, - 'enable_azure_rbac': {'key': 'enableAzureRBAC', 'type': 'bool'}, - 'admin_group_object_i_ds': {'key': 'adminGroupObjectIDs', 'type': '[str]'}, - 'client_app_id': {'key': 'clientAppID', 'type': 'str'}, - 'server_app_id': {'key': 'serverAppID', 'type': 'str'}, - 'server_app_secret': {'key': 'serverAppSecret', 'type': 'str'}, - 'tenant_id': {'key': 'tenantID', 'type': 'str'}, + "managed": {"key": "managed", "type": "bool"}, + "enable_azure_rbac": {"key": "enableAzureRBAC", "type": "bool"}, + "admin_group_object_i_ds": {"key": "adminGroupObjectIDs", "type": "[str]"}, + "client_app_id": {"key": "clientAppID", "type": "str"}, + "server_app_id": {"key": "serverAppID", "type": "str"}, + "server_app_secret": {"key": "serverAppSecret", "type": "str"}, + "tenant_id": {"key": "tenantID", "type": "str"}, } def __init__( @@ -2442,7 +2371,7 @@ def __init__( tenant of the deployment subscription. :paramtype tenant_id: str """ - super(ManagedClusterAADProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.managed = managed self.enable_azure_rbac = enable_azure_rbac self.admin_group_object_i_ds = admin_group_object_i_ds @@ -2470,60 +2399,55 @@ class ManagedClusterAccessProfile(TrackedResource): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.containerservice.v2022_03_02_preview.models.SystemData - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] - :ivar location: Required. The geo-location where the resource lives. + :ivar location: The geo-location where the resource lives. Required. :vartype location: str :ivar kube_config: Base64-encoded Kubernetes configuration file. - :vartype kube_config: bytearray + :vartype kube_config: bytes """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'location': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - 'kube_config': {'key': 'properties.kubeConfig', 'type': 'bytearray'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "kube_config": {"key": "properties.kubeConfig", "type": "bytearray"}, } def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - kube_config: Optional[bytearray] = None, - **kwargs + self, *, location: str, tags: Optional[Dict[str, str]] = None, kube_config: Optional[bytes] = None, **kwargs ): """ - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] - :keyword location: Required. The geo-location where the resource lives. + :keyword location: The geo-location where the resource lives. Required. :paramtype location: str :keyword kube_config: Base64-encoded Kubernetes configuration file. - :paramtype kube_config: bytearray + :paramtype kube_config: bytes """ - super(ManagedClusterAccessProfile, self).__init__(tags=tags, location=location, **kwargs) + super().__init__(tags=tags, location=location, **kwargs) self.kube_config = kube_config -class ManagedClusterAddonProfile(msrest.serialization.Model): +class ManagedClusterAddonProfile(_serialization.Model): """A Kubernetes add-on profile for a managed cluster. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar enabled: Required. Whether the add-on is enabled or not. + :ivar enabled: Whether the add-on is enabled or not. Required. :vartype enabled: bool :ivar config: Key-value pairs for configuring an add-on. :vartype config: dict[str, str] @@ -2533,36 +2457,30 @@ class ManagedClusterAddonProfile(msrest.serialization.Model): """ _validation = { - 'enabled': {'required': True}, - 'identity': {'readonly': True}, + "enabled": {"required": True}, + "identity": {"readonly": True}, } _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'config': {'key': 'config', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'ManagedClusterAddonProfileIdentity'}, + "enabled": {"key": "enabled", "type": "bool"}, + "config": {"key": "config", "type": "{str}"}, + "identity": {"key": "identity", "type": "ManagedClusterAddonProfileIdentity"}, } - def __init__( - self, - *, - enabled: bool, - config: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, enabled: bool, config: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword enabled: Required. Whether the add-on is enabled or not. + :keyword enabled: Whether the add-on is enabled or not. Required. :paramtype enabled: bool :keyword config: Key-value pairs for configuring an add-on. :paramtype config: dict[str, str] """ - super(ManagedClusterAddonProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.config = config self.identity = None -class UserAssignedIdentity(msrest.serialization.Model): +class UserAssignedIdentity(_serialization.Model): """Details about a user assigned identity. :ivar resource_id: The resource ID of the user assigned identity. @@ -2574,9 +2492,9 @@ class UserAssignedIdentity(msrest.serialization.Model): """ _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'object_id': {'key': 'objectId', 'type': 'str'}, + "resource_id": {"key": "resourceId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + "object_id": {"key": "objectId", "type": "str"}, } def __init__( @@ -2595,7 +2513,7 @@ def __init__( :keyword object_id: The object ID of the user assigned identity. :paramtype object_id: str """ - super(UserAssignedIdentity, self).__init__(**kwargs) + super().__init__(**kwargs) self.resource_id = resource_id self.client_id = client_id self.object_id = object_id @@ -2613,9 +2531,9 @@ class ManagedClusterAddonProfileIdentity(UserAssignedIdentity): """ _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'object_id': {'key': 'objectId', 'type': 'str'}, + "resource_id": {"key": "resourceId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + "object_id": {"key": "objectId", "type": "str"}, } def __init__( @@ -2634,10 +2552,10 @@ def __init__( :keyword object_id: The object ID of the user assigned identity. :paramtype object_id: str """ - super(ManagedClusterAddonProfileIdentity, self).__init__(resource_id=resource_id, client_id=client_id, object_id=object_id, **kwargs) + super().__init__(resource_id=resource_id, client_id=client_id, object_id=object_id, **kwargs) -class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): +class ManagedClusterAgentPoolProfileProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes """Properties for the container service agent pool profile. Variables are only populated by the server, and will be ignored when sending a request. @@ -2658,15 +2576,15 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.OSDiskType :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data - root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.KubeletDiskType :ivar workload_runtime: Determines the type of workload a node can run. Known values are: - "OCIContainer", "WasmWasi". + "OCIContainer" and "WasmWasi". :vartype workload_runtime: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.WorkloadRuntime :ivar message_of_the_day: A base64-encoded string which will be written to /etc/motd after @@ -2685,11 +2603,11 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :vartype pod_subnet_id: str :ivar max_pods: The maximum number of pods that can run on a node. :vartype max_pods: int - :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.OSType :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known - values are: "Ubuntu", "CBLMariner". + values are: "Ubuntu" and "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.OSSKU :ivar max_count: The maximum number of nodes for auto-scaling. :vartype max_count: int @@ -2698,15 +2616,15 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it - defaults to Delete. Known values are: "Delete", "Deallocate". + defaults to Delete. Known values are: "Delete" and "Deallocate". :vartype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.ScaleDownMode - :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", + :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets" and "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.AgentPoolType :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :vartype mode: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.AgentPoolMode :ivar orchestrator_version: Both patch version and are supported. When is specified, the latest supported patch version is chosen @@ -2748,20 +2666,18 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default - is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + is 'Regular'. Known values are: "Spot" and "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.ScaleSetPriority :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.ScaleSetEvictionPolicy :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :vartype spot_max_price: float - :ivar tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :ivar tags: The tags to be persisted on the agent pool virtual machine scale set. :vartype tags: dict[str, str] :ivar node_labels: The node labels to be persisted across all nodes in agent pool. :vartype node_labels: dict[str, str] @@ -2785,7 +2701,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): for more details. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.GPUInstanceProfile :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the node pool @@ -2802,58 +2718,58 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): """ _validation = { - 'os_disk_size_gb': {'maximum': 2048, 'minimum': 0}, - 'node_image_version': {'readonly': True}, - 'provisioning_state': {'readonly': True}, + "os_disk_size_gb": {"maximum": 2048, "minimum": 0}, + "node_image_version": {"readonly": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'os_disk_type': {'key': 'osDiskType', 'type': 'str'}, - 'kubelet_disk_type': {'key': 'kubeletDiskType', 'type': 'str'}, - 'workload_runtime': {'key': 'workloadRuntime', 'type': 'str'}, - 'message_of_the_day': {'key': 'messageOfTheDay', 'type': 'str'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'pod_subnet_id': {'key': 'podSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'maxPods', 'type': 'int'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'os_sku': {'key': 'osSKU', 'type': 'str'}, - 'max_count': {'key': 'maxCount', 'type': 'int'}, - 'min_count': {'key': 'minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'enableAutoScaling', 'type': 'bool'}, - 'scale_down_mode': {'key': 'scaleDownMode', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'mode': {'key': 'mode', 'type': 'str'}, - 'orchestrator_version': {'key': 'orchestratorVersion', 'type': 'str'}, - 'current_orchestrator_version': {'key': 'currentOrchestratorVersion', 'type': 'str'}, - 'node_image_version': {'key': 'nodeImageVersion', 'type': 'str'}, - 'upgrade_settings': {'key': 'upgradeSettings', 'type': 'AgentPoolUpgradeSettings'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'power_state': {'key': 'powerState', 'type': 'PowerState'}, - 'availability_zones': {'key': 'availabilityZones', 'type': '[str]'}, - 'enable_node_public_ip': {'key': 'enableNodePublicIP', 'type': 'bool'}, - 'node_public_ip_prefix_id': {'key': 'nodePublicIPPrefixID', 'type': 'str'}, - 'scale_set_priority': {'key': 'scaleSetPriority', 'type': 'str'}, - 'scale_set_eviction_policy': {'key': 'scaleSetEvictionPolicy', 'type': 'str'}, - 'spot_max_price': {'key': 'spotMaxPrice', 'type': 'float'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'node_labels': {'key': 'nodeLabels', 'type': '{str}'}, - 'node_taints': {'key': 'nodeTaints', 'type': '[str]'}, - 'proximity_placement_group_id': {'key': 'proximityPlacementGroupID', 'type': 'str'}, - 'kubelet_config': {'key': 'kubeletConfig', 'type': 'KubeletConfig'}, - 'linux_os_config': {'key': 'linuxOSConfig', 'type': 'LinuxOSConfig'}, - 'enable_encryption_at_host': {'key': 'enableEncryptionAtHost', 'type': 'bool'}, - 'enable_ultra_ssd': {'key': 'enableUltraSSD', 'type': 'bool'}, - 'enable_fips': {'key': 'enableFIPS', 'type': 'bool'}, - 'gpu_instance_profile': {'key': 'gpuInstanceProfile', 'type': 'str'}, - 'creation_data': {'key': 'creationData', 'type': 'CreationData'}, - 'capacity_reservation_group_id': {'key': 'capacityReservationGroupID', 'type': 'str'}, - 'host_group_id': {'key': 'hostGroupID', 'type': 'str'}, - } - - def __init__( + "count": {"key": "count", "type": "int"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "os_disk_type": {"key": "osDiskType", "type": "str"}, + "kubelet_disk_type": {"key": "kubeletDiskType", "type": "str"}, + "workload_runtime": {"key": "workloadRuntime", "type": "str"}, + "message_of_the_day": {"key": "messageOfTheDay", "type": "str"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "pod_subnet_id": {"key": "podSubnetID", "type": "str"}, + "max_pods": {"key": "maxPods", "type": "int"}, + "os_type": {"key": "osType", "type": "str"}, + "os_sku": {"key": "osSKU", "type": "str"}, + "max_count": {"key": "maxCount", "type": "int"}, + "min_count": {"key": "minCount", "type": "int"}, + "enable_auto_scaling": {"key": "enableAutoScaling", "type": "bool"}, + "scale_down_mode": {"key": "scaleDownMode", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "mode": {"key": "mode", "type": "str"}, + "orchestrator_version": {"key": "orchestratorVersion", "type": "str"}, + "current_orchestrator_version": {"key": "currentOrchestratorVersion", "type": "str"}, + "node_image_version": {"key": "nodeImageVersion", "type": "str"}, + "upgrade_settings": {"key": "upgradeSettings", "type": "AgentPoolUpgradeSettings"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "power_state": {"key": "powerState", "type": "PowerState"}, + "availability_zones": {"key": "availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "enableNodePublicIP", "type": "bool"}, + "node_public_ip_prefix_id": {"key": "nodePublicIPPrefixID", "type": "str"}, + "scale_set_priority": {"key": "scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "scaleSetEvictionPolicy", "type": "str"}, + "spot_max_price": {"key": "spotMaxPrice", "type": "float"}, + "tags": {"key": "tags", "type": "{str}"}, + "node_labels": {"key": "nodeLabels", "type": "{str}"}, + "node_taints": {"key": "nodeTaints", "type": "[str]"}, + "proximity_placement_group_id": {"key": "proximityPlacementGroupID", "type": "str"}, + "kubelet_config": {"key": "kubeletConfig", "type": "KubeletConfig"}, + "linux_os_config": {"key": "linuxOSConfig", "type": "LinuxOSConfig"}, + "enable_encryption_at_host": {"key": "enableEncryptionAtHost", "type": "bool"}, + "enable_ultra_ssd": {"key": "enableUltraSSD", "type": "bool"}, + "enable_fips": {"key": "enableFIPS", "type": "bool"}, + "gpu_instance_profile": {"key": "gpuInstanceProfile", "type": "str"}, + "creation_data": {"key": "creationData", "type": "CreationData"}, + "capacity_reservation_group_id": {"key": "capacityReservationGroupID", "type": "str"}, + "host_group_id": {"key": "hostGroupID", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, count: Optional[int] = None, @@ -2866,7 +2782,7 @@ def __init__( vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, @@ -2881,9 +2797,9 @@ def __init__( availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", - spot_max_price: Optional[float] = -1, + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", + spot_max_price: float = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, @@ -2916,15 +2832,15 @@ def __init__( larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.OSDiskType :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime - data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + data root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.KubeletDiskType :keyword workload_runtime: Determines the type of workload a node can run. Known values are: - "OCIContainer", "WasmWasi". + "OCIContainer" and "WasmWasi". :paramtype workload_runtime: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.WorkloadRuntime :keyword message_of_the_day: A base64-encoded string which will be written to /etc/motd after @@ -2943,11 +2859,11 @@ def __init__( :paramtype pod_subnet_id: str :keyword max_pods: The maximum number of pods that can run on a node. :paramtype max_pods: int - :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.OSType :keyword os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Known values are: "Ubuntu", "CBLMariner". + Known values are: "Ubuntu" and "CBLMariner". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.OSSKU :keyword max_count: The maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -2956,15 +2872,15 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, - it defaults to Delete. Known values are: "Delete", "Deallocate". + it defaults to Delete. Known values are: "Delete" and "Deallocate". :paramtype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.ScaleDownMode - :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", + :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.AgentPoolType :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.AgentPoolMode :keyword orchestrator_version: Both patch version and are supported. When is specified, the latest supported patch version is chosen @@ -3002,20 +2918,18 @@ def __init__( /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the - default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + default is 'Regular'. Known values are: "Spot" and "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.ScaleSetPriority :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.ScaleSetEvictionPolicy :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :paramtype spot_max_price: float - :keyword tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :keyword tags: The tags to be persisted on the agent pool virtual machine scale set. :paramtype tags: dict[str, str] :keyword node_labels: The node labels to be persisted across all nodes in agent pool. :paramtype node_labels: dict[str, str] @@ -3041,7 +2955,7 @@ def __init__( for more details. :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance - profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.GPUInstanceProfile @@ -3057,7 +2971,7 @@ def __init__( `_. :paramtype host_group_id: str """ - super(ManagedClusterAgentPoolProfileProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.vm_size = vm_size self.os_disk_size_gb = os_disk_size_gb @@ -3103,7 +3017,9 @@ def __init__( self.host_group_id = host_group_id -class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): +class ManagedClusterAgentPoolProfile( + ManagedClusterAgentPoolProfileProperties +): # pylint: disable=too-many-instance-attributes """Profile for the container service agent pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -3126,15 +3042,15 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.OSDiskType :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data - root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.KubeletDiskType :ivar workload_runtime: Determines the type of workload a node can run. Known values are: - "OCIContainer", "WasmWasi". + "OCIContainer" and "WasmWasi". :vartype workload_runtime: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.WorkloadRuntime :ivar message_of_the_day: A base64-encoded string which will be written to /etc/motd after @@ -3153,11 +3069,11 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :vartype pod_subnet_id: str :ivar max_pods: The maximum number of pods that can run on a node. :vartype max_pods: int - :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.OSType :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known - values are: "Ubuntu", "CBLMariner". + values are: "Ubuntu" and "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.OSSKU :ivar max_count: The maximum number of nodes for auto-scaling. :vartype max_count: int @@ -3166,15 +3082,15 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it - defaults to Delete. Known values are: "Delete", "Deallocate". + defaults to Delete. Known values are: "Delete" and "Deallocate". :vartype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.ScaleDownMode - :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", + :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets" and "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.AgentPoolType :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :vartype mode: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.AgentPoolMode :ivar orchestrator_version: Both patch version and are supported. When is specified, the latest supported patch version is chosen @@ -3216,20 +3132,18 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default - is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + is 'Regular'. Known values are: "Spot" and "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.ScaleSetPriority :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.ScaleSetEvictionPolicy :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :vartype spot_max_price: float - :ivar tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :ivar tags: The tags to be persisted on the agent pool virtual machine scale set. :vartype tags: dict[str, str] :ivar node_labels: The node labels to be persisted across all nodes in agent pool. :vartype node_labels: dict[str, str] @@ -3253,7 +3167,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): for more details. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.GPUInstanceProfile :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the node pool @@ -3267,65 +3181,65 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): For more information see `Azure dedicated hosts `_. :vartype host_group_id: str - :ivar name: Required. Windows agent pool names must be 6 characters or less. + :ivar name: Windows agent pool names must be 6 characters or less. Required. :vartype name: str """ _validation = { - 'os_disk_size_gb': {'maximum': 2048, 'minimum': 0}, - 'node_image_version': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'name': {'required': True, 'pattern': r'^[a-z][a-z0-9]{0,11}$'}, + "os_disk_size_gb": {"maximum": 2048, "minimum": 0}, + "node_image_version": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "name": {"required": True, "pattern": r"^[a-z][a-z0-9]{0,11}$"}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'os_disk_type': {'key': 'osDiskType', 'type': 'str'}, - 'kubelet_disk_type': {'key': 'kubeletDiskType', 'type': 'str'}, - 'workload_runtime': {'key': 'workloadRuntime', 'type': 'str'}, - 'message_of_the_day': {'key': 'messageOfTheDay', 'type': 'str'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'pod_subnet_id': {'key': 'podSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'maxPods', 'type': 'int'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'os_sku': {'key': 'osSKU', 'type': 'str'}, - 'max_count': {'key': 'maxCount', 'type': 'int'}, - 'min_count': {'key': 'minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'enableAutoScaling', 'type': 'bool'}, - 'scale_down_mode': {'key': 'scaleDownMode', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'mode': {'key': 'mode', 'type': 'str'}, - 'orchestrator_version': {'key': 'orchestratorVersion', 'type': 'str'}, - 'current_orchestrator_version': {'key': 'currentOrchestratorVersion', 'type': 'str'}, - 'node_image_version': {'key': 'nodeImageVersion', 'type': 'str'}, - 'upgrade_settings': {'key': 'upgradeSettings', 'type': 'AgentPoolUpgradeSettings'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'power_state': {'key': 'powerState', 'type': 'PowerState'}, - 'availability_zones': {'key': 'availabilityZones', 'type': '[str]'}, - 'enable_node_public_ip': {'key': 'enableNodePublicIP', 'type': 'bool'}, - 'node_public_ip_prefix_id': {'key': 'nodePublicIPPrefixID', 'type': 'str'}, - 'scale_set_priority': {'key': 'scaleSetPriority', 'type': 'str'}, - 'scale_set_eviction_policy': {'key': 'scaleSetEvictionPolicy', 'type': 'str'}, - 'spot_max_price': {'key': 'spotMaxPrice', 'type': 'float'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'node_labels': {'key': 'nodeLabels', 'type': '{str}'}, - 'node_taints': {'key': 'nodeTaints', 'type': '[str]'}, - 'proximity_placement_group_id': {'key': 'proximityPlacementGroupID', 'type': 'str'}, - 'kubelet_config': {'key': 'kubeletConfig', 'type': 'KubeletConfig'}, - 'linux_os_config': {'key': 'linuxOSConfig', 'type': 'LinuxOSConfig'}, - 'enable_encryption_at_host': {'key': 'enableEncryptionAtHost', 'type': 'bool'}, - 'enable_ultra_ssd': {'key': 'enableUltraSSD', 'type': 'bool'}, - 'enable_fips': {'key': 'enableFIPS', 'type': 'bool'}, - 'gpu_instance_profile': {'key': 'gpuInstanceProfile', 'type': 'str'}, - 'creation_data': {'key': 'creationData', 'type': 'CreationData'}, - 'capacity_reservation_group_id': {'key': 'capacityReservationGroupID', 'type': 'str'}, - 'host_group_id': {'key': 'hostGroupID', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( + "count": {"key": "count", "type": "int"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "os_disk_type": {"key": "osDiskType", "type": "str"}, + "kubelet_disk_type": {"key": "kubeletDiskType", "type": "str"}, + "workload_runtime": {"key": "workloadRuntime", "type": "str"}, + "message_of_the_day": {"key": "messageOfTheDay", "type": "str"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "pod_subnet_id": {"key": "podSubnetID", "type": "str"}, + "max_pods": {"key": "maxPods", "type": "int"}, + "os_type": {"key": "osType", "type": "str"}, + "os_sku": {"key": "osSKU", "type": "str"}, + "max_count": {"key": "maxCount", "type": "int"}, + "min_count": {"key": "minCount", "type": "int"}, + "enable_auto_scaling": {"key": "enableAutoScaling", "type": "bool"}, + "scale_down_mode": {"key": "scaleDownMode", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "mode": {"key": "mode", "type": "str"}, + "orchestrator_version": {"key": "orchestratorVersion", "type": "str"}, + "current_orchestrator_version": {"key": "currentOrchestratorVersion", "type": "str"}, + "node_image_version": {"key": "nodeImageVersion", "type": "str"}, + "upgrade_settings": {"key": "upgradeSettings", "type": "AgentPoolUpgradeSettings"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "power_state": {"key": "powerState", "type": "PowerState"}, + "availability_zones": {"key": "availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "enableNodePublicIP", "type": "bool"}, + "node_public_ip_prefix_id": {"key": "nodePublicIPPrefixID", "type": "str"}, + "scale_set_priority": {"key": "scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "scaleSetEvictionPolicy", "type": "str"}, + "spot_max_price": {"key": "spotMaxPrice", "type": "float"}, + "tags": {"key": "tags", "type": "{str}"}, + "node_labels": {"key": "nodeLabels", "type": "{str}"}, + "node_taints": {"key": "nodeTaints", "type": "[str]"}, + "proximity_placement_group_id": {"key": "proximityPlacementGroupID", "type": "str"}, + "kubelet_config": {"key": "kubeletConfig", "type": "KubeletConfig"}, + "linux_os_config": {"key": "linuxOSConfig", "type": "LinuxOSConfig"}, + "enable_encryption_at_host": {"key": "enableEncryptionAtHost", "type": "bool"}, + "enable_ultra_ssd": {"key": "enableUltraSSD", "type": "bool"}, + "enable_fips": {"key": "enableFIPS", "type": "bool"}, + "gpu_instance_profile": {"key": "gpuInstanceProfile", "type": "str"}, + "creation_data": {"key": "creationData", "type": "CreationData"}, + "capacity_reservation_group_id": {"key": "capacityReservationGroupID", "type": "str"}, + "host_group_id": {"key": "hostGroupID", "type": "str"}, + "name": {"key": "name", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, name: str, @@ -3339,7 +3253,7 @@ def __init__( vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, @@ -3354,9 +3268,9 @@ def __init__( availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", - spot_max_price: Optional[float] = -1, + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", + spot_max_price: float = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, @@ -3389,15 +3303,15 @@ def __init__( larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.OSDiskType :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime - data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + data root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.KubeletDiskType :keyword workload_runtime: Determines the type of workload a node can run. Known values are: - "OCIContainer", "WasmWasi". + "OCIContainer" and "WasmWasi". :paramtype workload_runtime: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.WorkloadRuntime :keyword message_of_the_day: A base64-encoded string which will be written to /etc/motd after @@ -3416,11 +3330,11 @@ def __init__( :paramtype pod_subnet_id: str :keyword max_pods: The maximum number of pods that can run on a node. :paramtype max_pods: int - :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.OSType :keyword os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Known values are: "Ubuntu", "CBLMariner". + Known values are: "Ubuntu" and "CBLMariner". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.OSSKU :keyword max_count: The maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -3429,15 +3343,15 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, - it defaults to Delete. Known values are: "Delete", "Deallocate". + it defaults to Delete. Known values are: "Delete" and "Deallocate". :paramtype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.ScaleDownMode - :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", + :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.AgentPoolType :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.AgentPoolMode :keyword orchestrator_version: Both patch version and are supported. When is specified, the latest supported patch version is chosen @@ -3475,20 +3389,18 @@ def __init__( /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the - default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + default is 'Regular'. Known values are: "Spot" and "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.ScaleSetPriority :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.ScaleSetEvictionPolicy :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :paramtype spot_max_price: float - :keyword tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :keyword tags: The tags to be persisted on the agent pool virtual machine scale set. :paramtype tags: dict[str, str] :keyword node_labels: The node labels to be persisted across all nodes in agent pool. :paramtype node_labels: dict[str, str] @@ -3514,7 +3426,7 @@ def __init__( for more details. :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance - profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.GPUInstanceProfile @@ -3529,14 +3441,57 @@ def __init__( For more information see `Azure dedicated hosts `_. :paramtype host_group_id: str - :keyword name: Required. Windows agent pool names must be 6 characters or less. + :keyword name: Windows agent pool names must be 6 characters or less. Required. :paramtype name: str """ - super(ManagedClusterAgentPoolProfile, self).__init__(count=count, vm_size=vm_size, os_disk_size_gb=os_disk_size_gb, os_disk_type=os_disk_type, kubelet_disk_type=kubelet_disk_type, workload_runtime=workload_runtime, message_of_the_day=message_of_the_day, vnet_subnet_id=vnet_subnet_id, pod_subnet_id=pod_subnet_id, max_pods=max_pods, os_type=os_type, os_sku=os_sku, max_count=max_count, min_count=min_count, enable_auto_scaling=enable_auto_scaling, scale_down_mode=scale_down_mode, type=type, mode=mode, orchestrator_version=orchestrator_version, current_orchestrator_version=current_orchestrator_version, upgrade_settings=upgrade_settings, power_state=power_state, availability_zones=availability_zones, enable_node_public_ip=enable_node_public_ip, node_public_ip_prefix_id=node_public_ip_prefix_id, scale_set_priority=scale_set_priority, scale_set_eviction_policy=scale_set_eviction_policy, spot_max_price=spot_max_price, tags=tags, node_labels=node_labels, node_taints=node_taints, proximity_placement_group_id=proximity_placement_group_id, kubelet_config=kubelet_config, linux_os_config=linux_os_config, enable_encryption_at_host=enable_encryption_at_host, enable_ultra_ssd=enable_ultra_ssd, enable_fips=enable_fips, gpu_instance_profile=gpu_instance_profile, creation_data=creation_data, capacity_reservation_group_id=capacity_reservation_group_id, host_group_id=host_group_id, **kwargs) + super().__init__( + count=count, + vm_size=vm_size, + os_disk_size_gb=os_disk_size_gb, + os_disk_type=os_disk_type, + kubelet_disk_type=kubelet_disk_type, + workload_runtime=workload_runtime, + message_of_the_day=message_of_the_day, + vnet_subnet_id=vnet_subnet_id, + pod_subnet_id=pod_subnet_id, + max_pods=max_pods, + os_type=os_type, + os_sku=os_sku, + max_count=max_count, + min_count=min_count, + enable_auto_scaling=enable_auto_scaling, + scale_down_mode=scale_down_mode, + type=type, + mode=mode, + orchestrator_version=orchestrator_version, + current_orchestrator_version=current_orchestrator_version, + upgrade_settings=upgrade_settings, + power_state=power_state, + availability_zones=availability_zones, + enable_node_public_ip=enable_node_public_ip, + node_public_ip_prefix_id=node_public_ip_prefix_id, + scale_set_priority=scale_set_priority, + scale_set_eviction_policy=scale_set_eviction_policy, + spot_max_price=spot_max_price, + tags=tags, + node_labels=node_labels, + node_taints=node_taints, + proximity_placement_group_id=proximity_placement_group_id, + kubelet_config=kubelet_config, + linux_os_config=linux_os_config, + enable_encryption_at_host=enable_encryption_at_host, + enable_ultra_ssd=enable_ultra_ssd, + enable_fips=enable_fips, + gpu_instance_profile=gpu_instance_profile, + creation_data=creation_data, + capacity_reservation_group_id=capacity_reservation_group_id, + host_group_id=host_group_id, + **kwargs + ) self.name = name -class ManagedClusterAPIServerAccessProfile(msrest.serialization.Model): +class ManagedClusterAPIServerAccessProfile(_serialization.Model): """Access profile for managed cluster API server. :ivar authorized_ip_ranges: IP ranges are specified in CIDR format, e.g. 137.117.106.88/29. @@ -3559,11 +3514,11 @@ class ManagedClusterAPIServerAccessProfile(msrest.serialization.Model): """ _attribute_map = { - 'authorized_ip_ranges': {'key': 'authorizedIPRanges', 'type': '[str]'}, - 'enable_private_cluster': {'key': 'enablePrivateCluster', 'type': 'bool'}, - 'private_dns_zone': {'key': 'privateDNSZone', 'type': 'str'}, - 'enable_private_cluster_public_fqdn': {'key': 'enablePrivateClusterPublicFQDN', 'type': 'bool'}, - 'disable_run_command': {'key': 'disableRunCommand', 'type': 'bool'}, + "authorized_ip_ranges": {"key": "authorizedIPRanges", "type": "[str]"}, + "enable_private_cluster": {"key": "enablePrivateCluster", "type": "bool"}, + "private_dns_zone": {"key": "privateDNSZone", "type": "str"}, + "enable_private_cluster_public_fqdn": {"key": "enablePrivateClusterPublicFQDN", "type": "bool"}, + "disable_run_command": {"key": "disableRunCommand", "type": "bool"}, } def __init__( @@ -3595,7 +3550,7 @@ def __init__( :keyword disable_run_command: Whether to disable run command for the cluster or not. :paramtype disable_run_command: bool """ - super(ManagedClusterAPIServerAccessProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.authorized_ip_ranges = authorized_ip_ranges self.enable_private_cluster = enable_private_cluster self.private_dns_zone = private_dns_zone @@ -3603,38 +3558,33 @@ def __init__( self.disable_run_command = disable_run_command -class ManagedClusterAutoUpgradeProfile(msrest.serialization.Model): +class ManagedClusterAutoUpgradeProfile(_serialization.Model): """Auto upgrade profile for a managed cluster. :ivar upgrade_channel: For more information see `setting the AKS cluster auto-upgrade channel `_. Known values - are: "rapid", "stable", "patch", "node-image", "none". + are: "rapid", "stable", "patch", "node-image", and "none". :vartype upgrade_channel: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.UpgradeChannel """ _attribute_map = { - 'upgrade_channel': {'key': 'upgradeChannel', 'type': 'str'}, + "upgrade_channel": {"key": "upgradeChannel", "type": "str"}, } - def __init__( - self, - *, - upgrade_channel: Optional[Union[str, "_models.UpgradeChannel"]] = None, - **kwargs - ): + def __init__(self, *, upgrade_channel: Optional[Union[str, "_models.UpgradeChannel"]] = None, **kwargs): """ :keyword upgrade_channel: For more information see `setting the AKS cluster auto-upgrade channel `_. - Known values are: "rapid", "stable", "patch", "node-image", "none". + Known values are: "rapid", "stable", "patch", "node-image", and "none". :paramtype upgrade_channel: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.UpgradeChannel """ - super(ManagedClusterAutoUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.upgrade_channel = upgrade_channel -class ManagedClusterHTTPProxyConfig(msrest.serialization.Model): +class ManagedClusterHTTPProxyConfig(_serialization.Model): """Cluster HTTP proxy configuration. Variables are only populated by the server, and will be ignored when sending a request. @@ -3653,15 +3603,15 @@ class ManagedClusterHTTPProxyConfig(msrest.serialization.Model): """ _validation = { - 'effective_no_proxy': {'readonly': True}, + "effective_no_proxy": {"readonly": True}, } _attribute_map = { - 'http_proxy': {'key': 'httpProxy', 'type': 'str'}, - 'https_proxy': {'key': 'httpsProxy', 'type': 'str'}, - 'no_proxy': {'key': 'noProxy', 'type': '[str]'}, - 'effective_no_proxy': {'key': 'effectiveNoProxy', 'type': '[str]'}, - 'trusted_ca': {'key': 'trustedCa', 'type': 'str'}, + "http_proxy": {"key": "httpProxy", "type": "str"}, + "https_proxy": {"key": "httpsProxy", "type": "str"}, + "no_proxy": {"key": "noProxy", "type": "[str]"}, + "effective_no_proxy": {"key": "effectiveNoProxy", "type": "[str]"}, + "trusted_ca": {"key": "trustedCa", "type": "str"}, } def __init__( @@ -3683,7 +3633,7 @@ def __init__( :keyword trusted_ca: Alternative CA cert to use for connecting to proxy servers. :paramtype trusted_ca: str """ - super(ManagedClusterHTTPProxyConfig, self).__init__(**kwargs) + super().__init__(**kwargs) self.http_proxy = http_proxy self.https_proxy = https_proxy self.no_proxy = no_proxy @@ -3691,7 +3641,7 @@ def __init__( self.trusted_ca = trusted_ca -class ManagedClusterIdentity(msrest.serialization.Model): +class ManagedClusterIdentity(_serialization.Model): """Identity for the managed cluster. Variables are only populated by the server, and will be ignored when sending a request. @@ -3704,7 +3654,7 @@ class ManagedClusterIdentity(msrest.serialization.Model): :vartype tenant_id: str :ivar type: For more information see `use managed identities in AKS `_. Known values are: - "SystemAssigned", "UserAssigned", "None". + "SystemAssigned", "UserAssigned", and "None". :vartype type: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.ResourceIdentityType :ivar user_assigned_identities: The keys must be ARM resource IDs in the form: @@ -3714,28 +3664,33 @@ class ManagedClusterIdentity(msrest.serialization.Model): """ _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, + "principal_id": {"readonly": True}, + "tenant_id": {"readonly": True}, } _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{ManagedServiceIdentityUserAssignedIdentitiesValue}'}, + "principal_id": {"key": "principalId", "type": "str"}, + "tenant_id": {"key": "tenantId", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "user_assigned_identities": { + "key": "userAssignedIdentities", + "type": "{ManagedServiceIdentityUserAssignedIdentitiesValue}", + }, } def __init__( self, *, type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, - user_assigned_identities: Optional[Dict[str, "_models.ManagedServiceIdentityUserAssignedIdentitiesValue"]] = None, + user_assigned_identities: Optional[ + Dict[str, "_models.ManagedServiceIdentityUserAssignedIdentitiesValue"] + ] = None, **kwargs ): """ :keyword type: For more information see `use managed identities in AKS `_. Known values are: - "SystemAssigned", "UserAssigned", "None". + "SystemAssigned", "UserAssigned", and "None". :paramtype type: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.ResourceIdentityType :keyword user_assigned_identities: The keys must be ARM resource IDs in the form: @@ -3743,14 +3698,14 @@ def __init__( :paramtype user_assigned_identities: dict[str, ~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedServiceIdentityUserAssignedIdentitiesValue] """ - super(ManagedClusterIdentity, self).__init__(**kwargs) + super().__init__(**kwargs) self.principal_id = None self.tenant_id = None self.type = type self.user_assigned_identities = user_assigned_identities -class ManagedClusterIngressProfile(msrest.serialization.Model): +class ManagedClusterIngressProfile(_serialization.Model): """Ingress profile for the container service cluster. :ivar web_app_routing: Web App Routing settings for the ingress profile. @@ -3759,25 +3714,22 @@ class ManagedClusterIngressProfile(msrest.serialization.Model): """ _attribute_map = { - 'web_app_routing': {'key': 'webAppRouting', 'type': 'ManagedClusterIngressProfileWebAppRouting'}, + "web_app_routing": {"key": "webAppRouting", "type": "ManagedClusterIngressProfileWebAppRouting"}, } def __init__( - self, - *, - web_app_routing: Optional["_models.ManagedClusterIngressProfileWebAppRouting"] = None, - **kwargs + self, *, web_app_routing: Optional["_models.ManagedClusterIngressProfileWebAppRouting"] = None, **kwargs ): """ :keyword web_app_routing: Web App Routing settings for the ingress profile. :paramtype web_app_routing: ~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedClusterIngressProfileWebAppRouting """ - super(ManagedClusterIngressProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.web_app_routing = web_app_routing -class ManagedClusterIngressProfileWebAppRouting(msrest.serialization.Model): +class ManagedClusterIngressProfileWebAppRouting(_serialization.Model): """Web App Routing settings for the ingress profile. :ivar enabled: Whether to enable Web App Routing. @@ -3788,17 +3740,11 @@ class ManagedClusterIngressProfileWebAppRouting(msrest.serialization.Model): """ _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'dns_zone_resource_id': {'key': 'dnsZoneResourceId', 'type': 'str'}, + "enabled": {"key": "enabled", "type": "bool"}, + "dns_zone_resource_id": {"key": "dnsZoneResourceId", "type": "str"}, } - def __init__( - self, - *, - enabled: Optional[bool] = None, - dns_zone_resource_id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, enabled: Optional[bool] = None, dns_zone_resource_id: Optional[str] = None, **kwargs): """ :keyword enabled: Whether to enable Web App Routing. :paramtype enabled: bool @@ -3806,12 +3752,12 @@ def __init__( Used only when Web App Routing is enabled. :paramtype dns_zone_resource_id: str """ - super(ManagedClusterIngressProfileWebAppRouting, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.dns_zone_resource_id = dns_zone_resource_id -class ManagedClusterListResult(msrest.serialization.Model): +class ManagedClusterListResult(_serialization.Model): """The response from the List Managed Clusters operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -3823,30 +3769,25 @@ class ManagedClusterListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[ManagedCluster]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[ManagedCluster]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.ManagedCluster"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.ManagedCluster"]] = None, **kwargs): """ :keyword value: The list of managed clusters. :paramtype value: list[~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedCluster] """ - super(ManagedClusterListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class ManagedClusterLoadBalancerProfile(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfile(_serialization.Model): """Profile of the managed cluster load balancer. :ivar managed_outbound_i_ps: Desired managed outbound IPs for the cluster load balancer. @@ -3875,18 +3816,24 @@ class ManagedClusterLoadBalancerProfile(msrest.serialization.Model): """ _validation = { - 'allocated_outbound_ports': {'maximum': 64000, 'minimum': 0}, - 'idle_timeout_in_minutes': {'maximum': 120, 'minimum': 4}, + "allocated_outbound_ports": {"maximum": 64000, "minimum": 0}, + "idle_timeout_in_minutes": {"maximum": 120, "minimum": 4}, } _attribute_map = { - 'managed_outbound_i_ps': {'key': 'managedOutboundIPs', 'type': 'ManagedClusterLoadBalancerProfileManagedOutboundIPs'}, - 'outbound_ip_prefixes': {'key': 'outboundIPPrefixes', 'type': 'ManagedClusterLoadBalancerProfileOutboundIPPrefixes'}, - 'outbound_i_ps': {'key': 'outboundIPs', 'type': 'ManagedClusterLoadBalancerProfileOutboundIPs'}, - 'effective_outbound_i_ps': {'key': 'effectiveOutboundIPs', 'type': '[ResourceReference]'}, - 'allocated_outbound_ports': {'key': 'allocatedOutboundPorts', 'type': 'int'}, - 'idle_timeout_in_minutes': {'key': 'idleTimeoutInMinutes', 'type': 'int'}, - 'enable_multiple_standard_load_balancers': {'key': 'enableMultipleStandardLoadBalancers', 'type': 'bool'}, + "managed_outbound_i_ps": { + "key": "managedOutboundIPs", + "type": "ManagedClusterLoadBalancerProfileManagedOutboundIPs", + }, + "outbound_ip_prefixes": { + "key": "outboundIPPrefixes", + "type": "ManagedClusterLoadBalancerProfileOutboundIPPrefixes", + }, + "outbound_i_ps": {"key": "outboundIPs", "type": "ManagedClusterLoadBalancerProfileOutboundIPs"}, + "effective_outbound_i_ps": {"key": "effectiveOutboundIPs", "type": "[ResourceReference]"}, + "allocated_outbound_ports": {"key": "allocatedOutboundPorts", "type": "int"}, + "idle_timeout_in_minutes": {"key": "idleTimeoutInMinutes", "type": "int"}, + "enable_multiple_standard_load_balancers": {"key": "enableMultipleStandardLoadBalancers", "type": "bool"}, } def __init__( @@ -3896,8 +3843,8 @@ def __init__( outbound_ip_prefixes: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPPrefixes"] = None, outbound_i_ps: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPs"] = None, effective_outbound_i_ps: Optional[List["_models.ResourceReference"]] = None, - allocated_outbound_ports: Optional[int] = 0, - idle_timeout_in_minutes: Optional[int] = 30, + allocated_outbound_ports: int = 0, + idle_timeout_in_minutes: int = 30, enable_multiple_standard_load_balancers: Optional[bool] = None, **kwargs ): @@ -3927,7 +3874,7 @@ def __init__( AKS cluster or not. :paramtype enable_multiple_standard_load_balancers: bool """ - super(ManagedClusterLoadBalancerProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.managed_outbound_i_ps = managed_outbound_i_ps self.outbound_ip_prefixes = outbound_ip_prefixes self.outbound_i_ps = outbound_i_ps @@ -3937,7 +3884,7 @@ def __init__( self.enable_multiple_standard_load_balancers = enable_multiple_standard_load_balancers -class ManagedClusterLoadBalancerProfileManagedOutboundIPs(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfileManagedOutboundIPs(_serialization.Model): """Desired managed outbound IPs for the cluster load balancer. :ivar count: The desired number of IPv4 outbound IPs created/managed by Azure for the cluster @@ -3951,22 +3898,16 @@ class ManagedClusterLoadBalancerProfileManagedOutboundIPs(msrest.serialization.M """ _validation = { - 'count': {'maximum': 100, 'minimum': 1}, - 'count_ipv6': {'maximum': 100, 'minimum': 0}, + "count": {"maximum": 100, "minimum": 1}, + "count_ipv6": {"maximum": 100, "minimum": 0}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'count_ipv6': {'key': 'countIPv6', 'type': 'int'}, + "count": {"key": "count", "type": "int"}, + "count_ipv6": {"key": "countIPv6", "type": "int"}, } - def __init__( - self, - *, - count: Optional[int] = 1, - count_ipv6: Optional[int] = 0, - **kwargs - ): + def __init__(self, *, count: int = 1, count_ipv6: int = 0, **kwargs): """ :keyword count: The desired number of IPv4 outbound IPs created/managed by Azure for the cluster load balancer. Allowed values must be in the range of 1 to 100 (inclusive). The default @@ -3977,12 +3918,12 @@ def __init__( value is 0 for single-stack and 1 for dual-stack. :paramtype count_ipv6: int """ - super(ManagedClusterLoadBalancerProfileManagedOutboundIPs, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.count_ipv6 = count_ipv6 -class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(_serialization.Model): """Desired outbound IP Prefix resources for the cluster load balancer. :ivar public_ip_prefixes: A list of public IP prefix resources. @@ -3991,25 +3932,20 @@ class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(msrest.serialization.M """ _attribute_map = { - 'public_ip_prefixes': {'key': 'publicIPPrefixes', 'type': '[ResourceReference]'}, + "public_ip_prefixes": {"key": "publicIPPrefixes", "type": "[ResourceReference]"}, } - def __init__( - self, - *, - public_ip_prefixes: Optional[List["_models.ResourceReference"]] = None, - **kwargs - ): + def __init__(self, *, public_ip_prefixes: Optional[List["_models.ResourceReference"]] = None, **kwargs): """ :keyword public_ip_prefixes: A list of public IP prefix resources. :paramtype public_ip_prefixes: list[~azure.mgmt.containerservice.v2022_03_02_preview.models.ResourceReference] """ - super(ManagedClusterLoadBalancerProfileOutboundIPPrefixes, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_ip_prefixes = public_ip_prefixes -class ManagedClusterLoadBalancerProfileOutboundIPs(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfileOutboundIPs(_serialization.Model): """Desired outbound IP resources for the cluster load balancer. :ivar public_i_ps: A list of public IP resources. @@ -4018,25 +3954,20 @@ class ManagedClusterLoadBalancerProfileOutboundIPs(msrest.serialization.Model): """ _attribute_map = { - 'public_i_ps': {'key': 'publicIPs', 'type': '[ResourceReference]'}, + "public_i_ps": {"key": "publicIPs", "type": "[ResourceReference]"}, } - def __init__( - self, - *, - public_i_ps: Optional[List["_models.ResourceReference"]] = None, - **kwargs - ): + def __init__(self, *, public_i_ps: Optional[List["_models.ResourceReference"]] = None, **kwargs): """ :keyword public_i_ps: A list of public IP resources. :paramtype public_i_ps: list[~azure.mgmt.containerservice.v2022_03_02_preview.models.ResourceReference] """ - super(ManagedClusterLoadBalancerProfileOutboundIPs, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_i_ps = public_i_ps -class ManagedClusterManagedOutboundIPProfile(msrest.serialization.Model): +class ManagedClusterManagedOutboundIPProfile(_serialization.Model): """Profile of the managed outbound IP resources of the managed cluster. :ivar count: The desired number of outbound IPs created/managed by Azure. Allowed values must @@ -4045,29 +3976,24 @@ class ManagedClusterManagedOutboundIPProfile(msrest.serialization.Model): """ _validation = { - 'count': {'maximum': 16, 'minimum': 1}, + "count": {"maximum": 16, "minimum": 1}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, + "count": {"key": "count", "type": "int"}, } - def __init__( - self, - *, - count: Optional[int] = 1, - **kwargs - ): + def __init__(self, *, count: int = 1, **kwargs): """ :keyword count: The desired number of outbound IPs created/managed by Azure. Allowed values must be in the range of 1 to 16 (inclusive). The default value is 1. :paramtype count: int """ - super(ManagedClusterManagedOutboundIPProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count -class ManagedClusterNATGatewayProfile(msrest.serialization.Model): +class ManagedClusterNATGatewayProfile(_serialization.Model): """Profile of the managed cluster NAT gateway. :ivar managed_outbound_ip_profile: Profile of the managed outbound IP resources of the cluster @@ -4083,13 +4009,16 @@ class ManagedClusterNATGatewayProfile(msrest.serialization.Model): """ _validation = { - 'idle_timeout_in_minutes': {'maximum': 120, 'minimum': 4}, + "idle_timeout_in_minutes": {"maximum": 120, "minimum": 4}, } _attribute_map = { - 'managed_outbound_ip_profile': {'key': 'managedOutboundIPProfile', 'type': 'ManagedClusterManagedOutboundIPProfile'}, - 'effective_outbound_i_ps': {'key': 'effectiveOutboundIPs', 'type': '[ResourceReference]'}, - 'idle_timeout_in_minutes': {'key': 'idleTimeoutInMinutes', 'type': 'int'}, + "managed_outbound_ip_profile": { + "key": "managedOutboundIPProfile", + "type": "ManagedClusterManagedOutboundIPProfile", + }, + "effective_outbound_i_ps": {"key": "effectiveOutboundIPs", "type": "[ResourceReference]"}, + "idle_timeout_in_minutes": {"key": "idleTimeoutInMinutes", "type": "int"}, } def __init__( @@ -4097,7 +4026,7 @@ def __init__( *, managed_outbound_ip_profile: Optional["_models.ManagedClusterManagedOutboundIPProfile"] = None, effective_outbound_i_ps: Optional[List["_models.ResourceReference"]] = None, - idle_timeout_in_minutes: Optional[int] = 4, + idle_timeout_in_minutes: int = 4, **kwargs ): """ @@ -4113,13 +4042,13 @@ def __init__( are in the range of 4 to 120 (inclusive). The default value is 4 minutes. :paramtype idle_timeout_in_minutes: int """ - super(ManagedClusterNATGatewayProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.managed_outbound_ip_profile = managed_outbound_ip_profile self.effective_outbound_i_ps = effective_outbound_i_ps self.idle_timeout_in_minutes = idle_timeout_in_minutes -class ManagedClusterOIDCIssuerProfile(msrest.serialization.Model): +class ManagedClusterOIDCIssuerProfile(_serialization.Model): """The OIDC issuer profile of the Managed Cluster. Variables are only populated by the server, and will be ignored when sending a request. @@ -4131,46 +4060,41 @@ class ManagedClusterOIDCIssuerProfile(msrest.serialization.Model): """ _validation = { - 'issuer_url': {'readonly': True}, + "issuer_url": {"readonly": True}, } _attribute_map = { - 'issuer_url': {'key': 'issuerURL', 'type': 'str'}, - 'enabled': {'key': 'enabled', 'type': 'bool'}, + "issuer_url": {"key": "issuerURL", "type": "str"}, + "enabled": {"key": "enabled", "type": "bool"}, } - def __init__( - self, - *, - enabled: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, enabled: Optional[bool] = None, **kwargs): """ :keyword enabled: Whether the OIDC issuer is enabled. :paramtype enabled: bool """ - super(ManagedClusterOIDCIssuerProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.issuer_url = None self.enabled = enabled -class ManagedClusterPodIdentity(msrest.serialization.Model): +class ManagedClusterPodIdentity(_serialization.Model): """Details about the pod identity assigned to the Managed Cluster. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar name: Required. The name of the pod identity. + :ivar name: The name of the pod identity. Required. :vartype name: str - :ivar namespace: Required. The namespace of the pod identity. + :ivar namespace: The namespace of the pod identity. Required. :vartype namespace: str :ivar binding_selector: The binding selector to use for the AzureIdentityBinding resource. :vartype binding_selector: str - :ivar identity: Required. The user assigned identity details. + :ivar identity: The user assigned identity details. Required. :vartype identity: ~azure.mgmt.containerservice.v2022_03_02_preview.models.UserAssignedIdentity :ivar provisioning_state: The current provisioning state of the pod identity. Known values are: - "Assigned", "Updating", "Deleting", "Failed". + "Assigned", "Updating", "Deleting", and "Failed". :vartype provisioning_state: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedClusterPodIdentityProvisioningState :ivar provisioning_info: @@ -4179,20 +4103,20 @@ class ManagedClusterPodIdentity(msrest.serialization.Model): """ _validation = { - 'name': {'required': True}, - 'namespace': {'required': True}, - 'identity': {'required': True}, - 'provisioning_state': {'readonly': True}, - 'provisioning_info': {'readonly': True}, + "name": {"required": True}, + "namespace": {"required": True}, + "identity": {"required": True}, + "provisioning_state": {"readonly": True}, + "provisioning_info": {"readonly": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'namespace': {'key': 'namespace', 'type': 'str'}, - 'binding_selector': {'key': 'bindingSelector', 'type': 'str'}, - 'identity': {'key': 'identity', 'type': 'UserAssignedIdentity'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'provisioning_info': {'key': 'provisioningInfo', 'type': 'ManagedClusterPodIdentityProvisioningInfo'}, + "name": {"key": "name", "type": "str"}, + "namespace": {"key": "namespace", "type": "str"}, + "binding_selector": {"key": "bindingSelector", "type": "str"}, + "identity": {"key": "identity", "type": "UserAssignedIdentity"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "provisioning_info": {"key": "provisioningInfo", "type": "ManagedClusterPodIdentityProvisioningInfo"}, } def __init__( @@ -4205,17 +4129,17 @@ def __init__( **kwargs ): """ - :keyword name: Required. The name of the pod identity. + :keyword name: The name of the pod identity. Required. :paramtype name: str - :keyword namespace: Required. The namespace of the pod identity. + :keyword namespace: The namespace of the pod identity. Required. :paramtype namespace: str :keyword binding_selector: The binding selector to use for the AzureIdentityBinding resource. :paramtype binding_selector: str - :keyword identity: Required. The user assigned identity details. + :keyword identity: The user assigned identity details. Required. :paramtype identity: ~azure.mgmt.containerservice.v2022_03_02_preview.models.UserAssignedIdentity """ - super(ManagedClusterPodIdentity, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.namespace = namespace self.binding_selector = binding_selector @@ -4224,54 +4148,47 @@ def __init__( self.provisioning_info = None -class ManagedClusterPodIdentityException(msrest.serialization.Model): +class ManagedClusterPodIdentityException(_serialization.Model): """See `disable AAD Pod Identity for a specific Pod/Application `_ for more details. All required parameters must be populated in order to send to Azure. - :ivar name: Required. The name of the pod identity exception. + :ivar name: The name of the pod identity exception. Required. :vartype name: str - :ivar namespace: Required. The namespace of the pod identity exception. + :ivar namespace: The namespace of the pod identity exception. Required. :vartype namespace: str - :ivar pod_labels: Required. The pod labels to match. + :ivar pod_labels: The pod labels to match. Required. :vartype pod_labels: dict[str, str] """ _validation = { - 'name': {'required': True}, - 'namespace': {'required': True}, - 'pod_labels': {'required': True}, + "name": {"required": True}, + "namespace": {"required": True}, + "pod_labels": {"required": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'namespace': {'key': 'namespace', 'type': 'str'}, - 'pod_labels': {'key': 'podLabels', 'type': '{str}'}, + "name": {"key": "name", "type": "str"}, + "namespace": {"key": "namespace", "type": "str"}, + "pod_labels": {"key": "podLabels", "type": "{str}"}, } - def __init__( - self, - *, - name: str, - namespace: str, - pod_labels: Dict[str, str], - **kwargs - ): + def __init__(self, *, name: str, namespace: str, pod_labels: Dict[str, str], **kwargs): """ - :keyword name: Required. The name of the pod identity exception. + :keyword name: The name of the pod identity exception. Required. :paramtype name: str - :keyword namespace: Required. The namespace of the pod identity exception. + :keyword namespace: The namespace of the pod identity exception. Required. :paramtype namespace: str - :keyword pod_labels: Required. The pod labels to match. + :keyword pod_labels: The pod labels to match. Required. :paramtype pod_labels: dict[str, str] """ - super(ManagedClusterPodIdentityException, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.namespace = namespace self.pod_labels = pod_labels -class ManagedClusterPodIdentityProfile(msrest.serialization.Model): +class ManagedClusterPodIdentityProfile(_serialization.Model): """See `use AAD pod identity `_ for more details on pod identity integration. :ivar enabled: Whether the pod identity addon is enabled. @@ -4291,10 +4208,13 @@ class ManagedClusterPodIdentityProfile(msrest.serialization.Model): """ _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'allow_network_plugin_kubenet': {'key': 'allowNetworkPluginKubenet', 'type': 'bool'}, - 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '[ManagedClusterPodIdentity]'}, - 'user_assigned_identity_exceptions': {'key': 'userAssignedIdentityExceptions', 'type': '[ManagedClusterPodIdentityException]'}, + "enabled": {"key": "enabled", "type": "bool"}, + "allow_network_plugin_kubenet": {"key": "allowNetworkPluginKubenet", "type": "bool"}, + "user_assigned_identities": {"key": "userAssignedIdentities", "type": "[ManagedClusterPodIdentity]"}, + "user_assigned_identity_exceptions": { + "key": "userAssignedIdentityExceptions", + "type": "[ManagedClusterPodIdentityException]", + }, } def __init__( @@ -4322,14 +4242,14 @@ def __init__( :paramtype user_assigned_identity_exceptions: list[~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedClusterPodIdentityException] """ - super(ManagedClusterPodIdentityProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.allow_network_plugin_kubenet = allow_network_plugin_kubenet self.user_assigned_identities = user_assigned_identities self.user_assigned_identity_exceptions = user_assigned_identity_exceptions -class ManagedClusterPodIdentityProvisioningError(msrest.serialization.Model): +class ManagedClusterPodIdentityProvisioningError(_serialization.Model): """An error response from the pod identity provisioning. :ivar error: Details about the error. @@ -4338,25 +4258,20 @@ class ManagedClusterPodIdentityProvisioningError(msrest.serialization.Model): """ _attribute_map = { - 'error': {'key': 'error', 'type': 'ManagedClusterPodIdentityProvisioningErrorBody'}, + "error": {"key": "error", "type": "ManagedClusterPodIdentityProvisioningErrorBody"}, } - def __init__( - self, - *, - error: Optional["_models.ManagedClusterPodIdentityProvisioningErrorBody"] = None, - **kwargs - ): + def __init__(self, *, error: Optional["_models.ManagedClusterPodIdentityProvisioningErrorBody"] = None, **kwargs): """ :keyword error: Details about the error. :paramtype error: ~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedClusterPodIdentityProvisioningErrorBody """ - super(ManagedClusterPodIdentityProvisioningError, self).__init__(**kwargs) + super().__init__(**kwargs) self.error = error -class ManagedClusterPodIdentityProvisioningErrorBody(msrest.serialization.Model): +class ManagedClusterPodIdentityProvisioningErrorBody(_serialization.Model): """An error response from the pod identity provisioning. :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed @@ -4374,10 +4289,10 @@ class ManagedClusterPodIdentityProvisioningErrorBody(msrest.serialization.Model) """ _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[ManagedClusterPodIdentityProvisioningErrorBody]'}, + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[ManagedClusterPodIdentityProvisioningErrorBody]"}, } def __init__( @@ -4403,14 +4318,14 @@ def __init__( :paramtype details: list[~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedClusterPodIdentityProvisioningErrorBody] """ - super(ManagedClusterPodIdentityProvisioningErrorBody, self).__init__(**kwargs) + super().__init__(**kwargs) self.code = code self.message = message self.target = target self.details = details -class ManagedClusterPodIdentityProvisioningInfo(msrest.serialization.Model): +class ManagedClusterPodIdentityProvisioningInfo(_serialization.Model): """ManagedClusterPodIdentityProvisioningInfo. :ivar error: Pod identity assignment error (if any). @@ -4419,35 +4334,30 @@ class ManagedClusterPodIdentityProvisioningInfo(msrest.serialization.Model): """ _attribute_map = { - 'error': {'key': 'error', 'type': 'ManagedClusterPodIdentityProvisioningError'}, + "error": {"key": "error", "type": "ManagedClusterPodIdentityProvisioningError"}, } - def __init__( - self, - *, - error: Optional["_models.ManagedClusterPodIdentityProvisioningError"] = None, - **kwargs - ): + def __init__(self, *, error: Optional["_models.ManagedClusterPodIdentityProvisioningError"] = None, **kwargs): """ :keyword error: Pod identity assignment error (if any). :paramtype error: ~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedClusterPodIdentityProvisioningError """ - super(ManagedClusterPodIdentityProvisioningInfo, self).__init__(**kwargs) + super().__init__(**kwargs) self.error = error -class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): +class ManagedClusterPoolUpgradeProfile(_serialization.Model): """The list of available upgrade versions. All required parameters must be populated in order to send to Azure. - :ivar kubernetes_version: Required. The Kubernetes version (major.minor.patch). + :ivar kubernetes_version: The Kubernetes version (major.minor.patch). Required. :vartype kubernetes_version: str :ivar name: The Agent Pool name. :vartype name: str - :ivar os_type: Required. The operating system type. The default is Linux. Known values are: - "Linux", "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -4455,15 +4365,15 @@ class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): """ _validation = { - 'kubernetes_version': {'required': True}, - 'os_type': {'required': True}, + "kubernetes_version": {"required": True}, + "os_type": {"required": True}, } _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'upgrades': {'key': 'upgrades', 'type': '[ManagedClusterPoolUpgradeProfileUpgradesItem]'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "os_type": {"key": "osType", "type": "str"}, + "upgrades": {"key": "upgrades", "type": "[ManagedClusterPoolUpgradeProfileUpgradesItem]"}, } def __init__( @@ -4476,25 +4386,25 @@ def __init__( **kwargs ): """ - :keyword kubernetes_version: Required. The Kubernetes version (major.minor.patch). + :keyword kubernetes_version: The Kubernetes version (major.minor.patch). Required. :paramtype kubernetes_version: str :keyword name: The Agent Pool name. :paramtype name: str - :keyword os_type: Required. The operating system type. The default is Linux. Known values are: - "Linux", "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: list[~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedClusterPoolUpgradeProfileUpgradesItem] """ - super(ManagedClusterPoolUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.name = name self.os_type = os_type self.upgrades = upgrades -class ManagedClusterPoolUpgradeProfileUpgradesItem(msrest.serialization.Model): +class ManagedClusterPoolUpgradeProfileUpgradesItem(_serialization.Model): """ManagedClusterPoolUpgradeProfileUpgradesItem. :ivar kubernetes_version: The Kubernetes version (major.minor.patch). @@ -4504,36 +4414,30 @@ class ManagedClusterPoolUpgradeProfileUpgradesItem(msrest.serialization.Model): """ _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } - def __init__( - self, - *, - kubernetes_version: Optional[str] = None, - is_preview: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, kubernetes_version: Optional[str] = None, is_preview: Optional[bool] = None, **kwargs): """ :keyword kubernetes_version: The Kubernetes version (major.minor.patch). :paramtype kubernetes_version: str :keyword is_preview: Whether the Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(ManagedClusterPoolUpgradeProfileUpgradesItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.is_preview = is_preview -class ManagedClusterPropertiesAutoScalerProfile(msrest.serialization.Model): +class ManagedClusterPropertiesAutoScalerProfile(_serialization.Model): # pylint: disable=too-many-instance-attributes """Parameters to be applied to the cluster-autoscaler when enabled. :ivar balance_similar_node_groups: Valid values are 'true' and 'false'. :vartype balance_similar_node_groups: str :ivar expander: If not specified, the default is 'random'. See `expanders `_ - for more information. Known values are: "least-waste", "most-pods", "priority", "random". + for more information. Known values are: "least-waste", "most-pods", "priority", and "random". :vartype expander: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.Expander :ivar max_empty_bulk_delete: The default is 10. :vartype max_empty_bulk_delete: str @@ -4577,23 +4481,23 @@ class ManagedClusterPropertiesAutoScalerProfile(msrest.serialization.Model): """ _attribute_map = { - 'balance_similar_node_groups': {'key': 'balance-similar-node-groups', 'type': 'str'}, - 'expander': {'key': 'expander', 'type': 'str'}, - 'max_empty_bulk_delete': {'key': 'max-empty-bulk-delete', 'type': 'str'}, - 'max_graceful_termination_sec': {'key': 'max-graceful-termination-sec', 'type': 'str'}, - 'max_node_provision_time': {'key': 'max-node-provision-time', 'type': 'str'}, - 'max_total_unready_percentage': {'key': 'max-total-unready-percentage', 'type': 'str'}, - 'new_pod_scale_up_delay': {'key': 'new-pod-scale-up-delay', 'type': 'str'}, - 'ok_total_unready_count': {'key': 'ok-total-unready-count', 'type': 'str'}, - 'scan_interval': {'key': 'scan-interval', 'type': 'str'}, - 'scale_down_delay_after_add': {'key': 'scale-down-delay-after-add', 'type': 'str'}, - 'scale_down_delay_after_delete': {'key': 'scale-down-delay-after-delete', 'type': 'str'}, - 'scale_down_delay_after_failure': {'key': 'scale-down-delay-after-failure', 'type': 'str'}, - 'scale_down_unneeded_time': {'key': 'scale-down-unneeded-time', 'type': 'str'}, - 'scale_down_unready_time': {'key': 'scale-down-unready-time', 'type': 'str'}, - 'scale_down_utilization_threshold': {'key': 'scale-down-utilization-threshold', 'type': 'str'}, - 'skip_nodes_with_local_storage': {'key': 'skip-nodes-with-local-storage', 'type': 'str'}, - 'skip_nodes_with_system_pods': {'key': 'skip-nodes-with-system-pods', 'type': 'str'}, + "balance_similar_node_groups": {"key": "balance-similar-node-groups", "type": "str"}, + "expander": {"key": "expander", "type": "str"}, + "max_empty_bulk_delete": {"key": "max-empty-bulk-delete", "type": "str"}, + "max_graceful_termination_sec": {"key": "max-graceful-termination-sec", "type": "str"}, + "max_node_provision_time": {"key": "max-node-provision-time", "type": "str"}, + "max_total_unready_percentage": {"key": "max-total-unready-percentage", "type": "str"}, + "new_pod_scale_up_delay": {"key": "new-pod-scale-up-delay", "type": "str"}, + "ok_total_unready_count": {"key": "ok-total-unready-count", "type": "str"}, + "scan_interval": {"key": "scan-interval", "type": "str"}, + "scale_down_delay_after_add": {"key": "scale-down-delay-after-add", "type": "str"}, + "scale_down_delay_after_delete": {"key": "scale-down-delay-after-delete", "type": "str"}, + "scale_down_delay_after_failure": {"key": "scale-down-delay-after-failure", "type": "str"}, + "scale_down_unneeded_time": {"key": "scale-down-unneeded-time", "type": "str"}, + "scale_down_unready_time": {"key": "scale-down-unready-time", "type": "str"}, + "scale_down_utilization_threshold": {"key": "scale-down-utilization-threshold", "type": "str"}, + "skip_nodes_with_local_storage": {"key": "skip-nodes-with-local-storage", "type": "str"}, + "skip_nodes_with_system_pods": {"key": "skip-nodes-with-system-pods", "type": "str"}, } def __init__( @@ -4623,7 +4527,7 @@ def __init__( :paramtype balance_similar_node_groups: str :keyword expander: If not specified, the default is 'random'. See `expanders `_ - for more information. Known values are: "least-waste", "most-pods", "priority", "random". + for more information. Known values are: "least-waste", "most-pods", "priority", and "random". :paramtype expander: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.Expander :keyword max_empty_bulk_delete: The default is 10. :paramtype max_empty_bulk_delete: str @@ -4666,7 +4570,7 @@ def __init__( :keyword skip_nodes_with_system_pods: The default is true. :paramtype skip_nodes_with_system_pods: str """ - super(ManagedClusterPropertiesAutoScalerProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.balance_similar_node_groups = balance_similar_node_groups self.expander = expander self.max_empty_bulk_delete = max_empty_bulk_delete @@ -4686,7 +4590,7 @@ def __init__( self.skip_nodes_with_system_pods = skip_nodes_with_system_pods -class ManagedClusterPropertiesForSnapshot(msrest.serialization.Model): +class ManagedClusterPropertiesForSnapshot(_serialization.Model): """managed cluster properties for snapshot, these properties are read only. Variables are only populated by the server, and will be ignored when sending a request. @@ -4703,14 +4607,14 @@ class ManagedClusterPropertiesForSnapshot(msrest.serialization.Model): """ _validation = { - 'network_profile': {'readonly': True}, + "network_profile": {"readonly": True}, } _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'ManagedClusterSKU'}, - 'enable_rbac': {'key': 'enableRbac', 'type': 'bool'}, - 'network_profile': {'key': 'networkProfile', 'type': 'NetworkProfileForSnapshot'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "sku": {"key": "sku", "type": "ManagedClusterSKU"}, + "enable_rbac": {"key": "enableRbac", "type": "bool"}, + "network_profile": {"key": "networkProfile", "type": "NetworkProfileForSnapshot"}, } def __init__( @@ -4730,14 +4634,14 @@ def __init__( not. :paramtype enable_rbac: bool """ - super(ManagedClusterPropertiesForSnapshot, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.sku = sku self.enable_rbac = enable_rbac self.network_profile = None -class ManagedClusterSecurityProfile(msrest.serialization.Model): +class ManagedClusterSecurityProfile(_serialization.Model): """Security profile for the container service cluster. :ivar azure_defender: Azure Defender settings for the security profile. @@ -4755,9 +4659,9 @@ class ManagedClusterSecurityProfile(msrest.serialization.Model): """ _attribute_map = { - 'azure_defender': {'key': 'azureDefender', 'type': 'ManagedClusterSecurityProfileAzureDefender'}, - 'azure_key_vault_kms': {'key': 'azureKeyVaultKms', 'type': 'AzureKeyVaultKms'}, - 'workload_identity': {'key': 'workloadIdentity', 'type': 'ManagedClusterSecurityProfileWorkloadIdentity'}, + "azure_defender": {"key": "azureDefender", "type": "ManagedClusterSecurityProfileAzureDefender"}, + "azure_key_vault_kms": {"key": "azureKeyVaultKms", "type": "AzureKeyVaultKms"}, + "workload_identity": {"key": "workloadIdentity", "type": "ManagedClusterSecurityProfileWorkloadIdentity"}, } def __init__( @@ -4782,13 +4686,13 @@ def __init__( :paramtype workload_identity: ~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedClusterSecurityProfileWorkloadIdentity """ - super(ManagedClusterSecurityProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.azure_defender = azure_defender self.azure_key_vault_kms = azure_key_vault_kms self.workload_identity = workload_identity -class ManagedClusterSecurityProfileAzureDefender(msrest.serialization.Model): +class ManagedClusterSecurityProfileAzureDefender(_serialization.Model): """Azure Defender settings for the security profile. :ivar enabled: Whether to enable Azure Defender. @@ -4800,16 +4704,12 @@ class ManagedClusterSecurityProfileAzureDefender(msrest.serialization.Model): """ _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'log_analytics_workspace_resource_id': {'key': 'logAnalyticsWorkspaceResourceId', 'type': 'str'}, + "enabled": {"key": "enabled", "type": "bool"}, + "log_analytics_workspace_resource_id": {"key": "logAnalyticsWorkspaceResourceId", "type": "str"}, } def __init__( - self, - *, - enabled: Optional[bool] = None, - log_analytics_workspace_resource_id: Optional[str] = None, - **kwargs + self, *, enabled: Optional[bool] = None, log_analytics_workspace_resource_id: Optional[str] = None, **kwargs ): """ :keyword enabled: Whether to enable Azure Defender. @@ -4819,12 +4719,12 @@ def __init__( must be a valid workspace resource ID. When Azure Defender is disabled, leave the field empty. :paramtype log_analytics_workspace_resource_id: str """ - super(ManagedClusterSecurityProfileAzureDefender, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.log_analytics_workspace_resource_id = log_analytics_workspace_resource_id -class ManagedClusterSecurityProfileWorkloadIdentity(msrest.serialization.Model): +class ManagedClusterSecurityProfileWorkloadIdentity(_serialization.Model): """Workload Identity settings for the security profile. :ivar enabled: Whether to enable Workload Identity. @@ -4832,77 +4732,66 @@ class ManagedClusterSecurityProfileWorkloadIdentity(msrest.serialization.Model): """ _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, + "enabled": {"key": "enabled", "type": "bool"}, } - def __init__( - self, - *, - enabled: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, enabled: Optional[bool] = None, **kwargs): """ :keyword enabled: Whether to enable Workload Identity. :paramtype enabled: bool """ - super(ManagedClusterSecurityProfileWorkloadIdentity, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled -class ManagedClusterServicePrincipalProfile(msrest.serialization.Model): +class ManagedClusterServicePrincipalProfile(_serialization.Model): """Information about a service principal identity for the cluster to use for manipulating Azure APIs. All required parameters must be populated in order to send to Azure. - :ivar client_id: Required. The ID for the service principal. + :ivar client_id: The ID for the service principal. Required. :vartype client_id: str :ivar secret: The secret password associated with the service principal in plain text. :vartype secret: str """ _validation = { - 'client_id': {'required': True}, + "client_id": {"required": True}, } _attribute_map = { - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'secret': {'key': 'secret', 'type': 'str'}, + "client_id": {"key": "clientId", "type": "str"}, + "secret": {"key": "secret", "type": "str"}, } - def __init__( - self, - *, - client_id: str, - secret: Optional[str] = None, - **kwargs - ): + def __init__(self, *, client_id: str, secret: Optional[str] = None, **kwargs): """ - :keyword client_id: Required. The ID for the service principal. + :keyword client_id: The ID for the service principal. Required. :paramtype client_id: str :keyword secret: The secret password associated with the service principal in plain text. :paramtype secret: str """ - super(ManagedClusterServicePrincipalProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.client_id = client_id self.secret = secret -class ManagedClusterSKU(msrest.serialization.Model): +class ManagedClusterSKU(_serialization.Model): """The SKU of a Managed Cluster. - :ivar name: The name of a managed cluster SKU. Known values are: "Basic". + :ivar name: The name of a managed cluster SKU. "Basic" :vartype name: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedClusterSKUName :ivar tier: If not specified, the default is 'Free'. See `uptime SLA - `_ for more details. Known values are: "Paid", - "Free". + `_ for more details. Known values are: "Paid" + and "Free". :vartype tier: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedClusterSKUTier """ _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, + "name": {"key": "name", "type": "str"}, + "tier": {"key": "tier", "type": "str"}, } def __init__( @@ -4913,16 +4802,16 @@ def __init__( **kwargs ): """ - :keyword name: The name of a managed cluster SKU. Known values are: "Basic". + :keyword name: The name of a managed cluster SKU. "Basic" :paramtype name: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedClusterSKUName :keyword tier: If not specified, the default is 'Free'. See `uptime SLA - `_ for more details. Known values are: "Paid", - "Free". + `_ for more details. Known values are: "Paid" + and "Free". :paramtype tier: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedClusterSKUTier """ - super(ManagedClusterSKU, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.tier = tier @@ -4945,15 +4834,15 @@ class ManagedClusterSnapshot(TrackedResource): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.containerservice.v2022_03_02_preview.models.SystemData - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] - :ivar location: Required. The geo-location where the resource lives. + :ivar location: The geo-location where the resource lives. Required. :vartype location: str :ivar creation_data: CreationData to be used to specify the source resource ID to create this snapshot. :vartype creation_data: ~azure.mgmt.containerservice.v2022_03_02_preview.models.CreationData :ivar snapshot_type: The type of a snapshot. The default is NodePool. Known values are: - "NodePool", "ManagedCluster". Default value: "NodePool". + "NodePool" and "ManagedCluster". :vartype snapshot_type: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.SnapshotType :ivar managed_cluster_properties_read_only: What the properties will be showed when getting @@ -4963,24 +4852,27 @@ class ManagedClusterSnapshot(TrackedResource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'location': {'required': True}, - 'managed_cluster_properties_read_only': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, + "managed_cluster_properties_read_only": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - 'creation_data': {'key': 'properties.creationData', 'type': 'CreationData'}, - 'snapshot_type': {'key': 'properties.snapshotType', 'type': 'str'}, - 'managed_cluster_properties_read_only': {'key': 'properties.managedClusterPropertiesReadOnly', 'type': 'ManagedClusterPropertiesForSnapshot'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "creation_data": {"key": "properties.creationData", "type": "CreationData"}, + "snapshot_type": {"key": "properties.snapshotType", "type": "str"}, + "managed_cluster_properties_read_only": { + "key": "properties.managedClusterPropertiesReadOnly", + "type": "ManagedClusterPropertiesForSnapshot", + }, } def __init__( @@ -4989,29 +4881,29 @@ def __init__( location: str, tags: Optional[Dict[str, str]] = None, creation_data: Optional["_models.CreationData"] = None, - snapshot_type: Optional[Union[str, "_models.SnapshotType"]] = "NodePool", + snapshot_type: Union[str, "_models.SnapshotType"] = "NodePool", **kwargs ): """ - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] - :keyword location: Required. The geo-location where the resource lives. + :keyword location: The geo-location where the resource lives. Required. :paramtype location: str :keyword creation_data: CreationData to be used to specify the source resource ID to create this snapshot. :paramtype creation_data: ~azure.mgmt.containerservice.v2022_03_02_preview.models.CreationData :keyword snapshot_type: The type of a snapshot. The default is NodePool. Known values are: - "NodePool", "ManagedCluster". Default value: "NodePool". + "NodePool" and "ManagedCluster". :paramtype snapshot_type: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.SnapshotType """ - super(ManagedClusterSnapshot, self).__init__(tags=tags, location=location, **kwargs) + super().__init__(tags=tags, location=location, **kwargs) self.creation_data = creation_data self.snapshot_type = snapshot_type self.managed_cluster_properties_read_only = None -class ManagedClusterSnapshotListResult(msrest.serialization.Model): +class ManagedClusterSnapshotListResult(_serialization.Model): """The response from the List Managed Cluster Snapshots operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -5024,31 +4916,26 @@ class ManagedClusterSnapshotListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[ManagedClusterSnapshot]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[ManagedClusterSnapshot]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.ManagedClusterSnapshot"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.ManagedClusterSnapshot"]] = None, **kwargs): """ :keyword value: The list of managed cluster snapshots. :paramtype value: list[~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedClusterSnapshot] """ - super(ManagedClusterSnapshotListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class ManagedClusterStorageProfile(msrest.serialization.Model): +class ManagedClusterStorageProfile(_serialization.Model): """Storage profile for the container service cluster. :ivar disk_csi_driver: AzureDisk CSI Driver settings for the storage profile. @@ -5063,9 +4950,9 @@ class ManagedClusterStorageProfile(msrest.serialization.Model): """ _attribute_map = { - 'disk_csi_driver': {'key': 'diskCSIDriver', 'type': 'ManagedClusterStorageProfileDiskCSIDriver'}, - 'file_csi_driver': {'key': 'fileCSIDriver', 'type': 'ManagedClusterStorageProfileFileCSIDriver'}, - 'snapshot_controller': {'key': 'snapshotController', 'type': 'ManagedClusterStorageProfileSnapshotController'}, + "disk_csi_driver": {"key": "diskCSIDriver", "type": "ManagedClusterStorageProfileDiskCSIDriver"}, + "file_csi_driver": {"key": "fileCSIDriver", "type": "ManagedClusterStorageProfileFileCSIDriver"}, + "snapshot_controller": {"key": "snapshotController", "type": "ManagedClusterStorageProfileSnapshotController"}, } def __init__( @@ -5087,13 +4974,13 @@ def __init__( :paramtype snapshot_controller: ~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedClusterStorageProfileSnapshotController """ - super(ManagedClusterStorageProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.disk_csi_driver = disk_csi_driver self.file_csi_driver = file_csi_driver self.snapshot_controller = snapshot_controller -class ManagedClusterStorageProfileDiskCSIDriver(msrest.serialization.Model): +class ManagedClusterStorageProfileDiskCSIDriver(_serialization.Model): """AzureDisk CSI Driver settings for the storage profile. :ivar enabled: Whether to enable AzureDisk CSI Driver. The default value is true. @@ -5103,29 +4990,23 @@ class ManagedClusterStorageProfileDiskCSIDriver(msrest.serialization.Model): """ _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'version': {'key': 'version', 'type': 'str'}, + "enabled": {"key": "enabled", "type": "bool"}, + "version": {"key": "version", "type": "str"}, } - def __init__( - self, - *, - enabled: Optional[bool] = None, - version: Optional[str] = None, - **kwargs - ): + def __init__(self, *, enabled: Optional[bool] = None, version: Optional[str] = None, **kwargs): """ :keyword enabled: Whether to enable AzureDisk CSI Driver. The default value is true. :paramtype enabled: bool :keyword version: The version of AzureDisk CSI Driver. The default value is v1. :paramtype version: str """ - super(ManagedClusterStorageProfileDiskCSIDriver, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.version = version -class ManagedClusterStorageProfileFileCSIDriver(msrest.serialization.Model): +class ManagedClusterStorageProfileFileCSIDriver(_serialization.Model): """AzureFile CSI Driver settings for the storage profile. :ivar enabled: Whether to enable AzureFile CSI Driver. The default value is true. @@ -5133,24 +5014,19 @@ class ManagedClusterStorageProfileFileCSIDriver(msrest.serialization.Model): """ _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, + "enabled": {"key": "enabled", "type": "bool"}, } - def __init__( - self, - *, - enabled: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, enabled: Optional[bool] = None, **kwargs): """ :keyword enabled: Whether to enable AzureFile CSI Driver. The default value is true. :paramtype enabled: bool """ - super(ManagedClusterStorageProfileFileCSIDriver, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled -class ManagedClusterStorageProfileSnapshotController(msrest.serialization.Model): +class ManagedClusterStorageProfileSnapshotController(_serialization.Model): """Snapshot Controller settings for the storage profile. :ivar enabled: Whether to enable Snapshot Controller. The default value is true. @@ -5158,24 +5034,19 @@ class ManagedClusterStorageProfileSnapshotController(msrest.serialization.Model) """ _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, + "enabled": {"key": "enabled", "type": "bool"}, } - def __init__( - self, - *, - enabled: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, enabled: Optional[bool] = None, **kwargs): """ :keyword enabled: Whether to enable Snapshot Controller. The default value is true. :paramtype enabled: bool """ - super(ManagedClusterStorageProfileSnapshotController, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled -class ManagedClusterUpgradeProfile(msrest.serialization.Model): +class ManagedClusterUpgradeProfile(_serialization.Model): """The list of available upgrades for compute pools. Variables are only populated by the server, and will be ignored when sending a request. @@ -5188,29 +5059,29 @@ class ManagedClusterUpgradeProfile(msrest.serialization.Model): :vartype name: str :ivar type: The type of the upgrade profile. :vartype type: str - :ivar control_plane_profile: Required. The list of available upgrade versions for the control - plane. + :ivar control_plane_profile: The list of available upgrade versions for the control plane. + Required. :vartype control_plane_profile: ~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedClusterPoolUpgradeProfile - :ivar agent_pool_profiles: Required. The list of available upgrade versions for agent pools. + :ivar agent_pool_profiles: The list of available upgrade versions for agent pools. Required. :vartype agent_pool_profiles: list[~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedClusterPoolUpgradeProfile] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'control_plane_profile': {'required': True}, - 'agent_pool_profiles': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "control_plane_profile": {"required": True}, + "agent_pool_profiles": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'control_plane_profile': {'key': 'properties.controlPlaneProfile', 'type': 'ManagedClusterPoolUpgradeProfile'}, - 'agent_pool_profiles': {'key': 'properties.agentPoolProfiles', 'type': '[ManagedClusterPoolUpgradeProfile]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "control_plane_profile": {"key": "properties.controlPlaneProfile", "type": "ManagedClusterPoolUpgradeProfile"}, + "agent_pool_profiles": {"key": "properties.agentPoolProfiles", "type": "[ManagedClusterPoolUpgradeProfile]"}, } def __init__( @@ -5221,15 +5092,15 @@ def __init__( **kwargs ): """ - :keyword control_plane_profile: Required. The list of available upgrade versions for the - control plane. + :keyword control_plane_profile: The list of available upgrade versions for the control plane. + Required. :paramtype control_plane_profile: ~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedClusterPoolUpgradeProfile - :keyword agent_pool_profiles: Required. The list of available upgrade versions for agent pools. + :keyword agent_pool_profiles: The list of available upgrade versions for agent pools. Required. :paramtype agent_pool_profiles: list[~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedClusterPoolUpgradeProfile] """ - super(ManagedClusterUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -5237,18 +5108,18 @@ def __init__( self.agent_pool_profiles = agent_pool_profiles -class ManagedClusterWindowsProfile(msrest.serialization.Model): +class ManagedClusterWindowsProfile(_serialization.Model): """Profile for Windows VMs in the managed cluster. All required parameters must be populated in order to send to Azure. - :ivar admin_username: Required. Specifies the name of the administrator account. - :code:`
`:code:`
` **Restriction:** Cannot end in "." :code:`
`:code:`
` - **Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", "test1", - "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", - "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", - "sys", "test2", "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 - character :code:`
`:code:`
` **Max-length:** 20 characters. + :ivar admin_username: Specifies the name of the administrator account. :code:`
`:code:`
` + **Restriction:** Cannot end in "." :code:`
`:code:`
` **Disallowed values:** + "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", + "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", + "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", + "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 character + :code:`
`:code:`
` **Max-length:** 20 characters. Required. :vartype admin_username: str :ivar admin_password: Specifies the password of the administrator account. :code:`
`:code:`
` **Minimum-length:** 8 characters :code:`
`:code:`
` @@ -5260,7 +5131,7 @@ class ManagedClusterWindowsProfile(msrest.serialization.Model): :vartype admin_password: str :ivar license_type: The license type to use for Windows VMs. See `Azure Hybrid User Benefits `_ for more details. Known values are: - "None", "Windows_Server". + "None" and "Windows_Server". :vartype license_type: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.LicenseType :ivar enable_csi_proxy: For more details on CSI proxy, see the `CSI proxy GitHub repo @@ -5272,15 +5143,15 @@ class ManagedClusterWindowsProfile(msrest.serialization.Model): """ _validation = { - 'admin_username': {'required': True}, + "admin_username": {"required": True}, } _attribute_map = { - 'admin_username': {'key': 'adminUsername', 'type': 'str'}, - 'admin_password': {'key': 'adminPassword', 'type': 'str'}, - 'license_type': {'key': 'licenseType', 'type': 'str'}, - 'enable_csi_proxy': {'key': 'enableCSIProxy', 'type': 'bool'}, - 'gmsa_profile': {'key': 'gmsaProfile', 'type': 'WindowsGmsaProfile'}, + "admin_username": {"key": "adminUsername", "type": "str"}, + "admin_password": {"key": "adminPassword", "type": "str"}, + "license_type": {"key": "licenseType", "type": "str"}, + "enable_csi_proxy": {"key": "enableCSIProxy", "type": "bool"}, + "gmsa_profile": {"key": "gmsaProfile", "type": "WindowsGmsaProfile"}, } def __init__( @@ -5294,13 +5165,13 @@ def __init__( **kwargs ): """ - :keyword admin_username: Required. Specifies the name of the administrator account. + :keyword admin_username: Specifies the name of the administrator account. :code:`
`:code:`
` **Restriction:** Cannot end in "." :code:`
`:code:`
` **Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 - character :code:`
`:code:`
` **Max-length:** 20 characters. + character :code:`
`:code:`
` **Max-length:** 20 characters. Required. :paramtype admin_username: str :keyword admin_password: Specifies the password of the administrator account. :code:`
`:code:`
` **Minimum-length:** 8 characters :code:`
`:code:`
` @@ -5312,7 +5183,7 @@ def __init__( :paramtype admin_password: str :keyword license_type: The license type to use for Windows VMs. See `Azure Hybrid User Benefits `_ for more details. Known values are: - "None", "Windows_Server". + "None" and "Windows_Server". :paramtype license_type: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.LicenseType :keyword enable_csi_proxy: For more details on CSI proxy, see the `CSI proxy GitHub repo @@ -5322,7 +5193,7 @@ def __init__( :paramtype gmsa_profile: ~azure.mgmt.containerservice.v2022_03_02_preview.models.WindowsGmsaProfile """ - super(ManagedClusterWindowsProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.admin_username = admin_username self.admin_password = admin_password self.license_type = license_type @@ -5330,7 +5201,7 @@ def __init__( self.gmsa_profile = gmsa_profile -class ManagedServiceIdentityUserAssignedIdentitiesValue(msrest.serialization.Model): +class ManagedServiceIdentityUserAssignedIdentitiesValue(_serialization.Model): """ManagedServiceIdentityUserAssignedIdentitiesValue. Variables are only populated by the server, and will be ignored when sending a request. @@ -5342,58 +5213,54 @@ class ManagedServiceIdentityUserAssignedIdentitiesValue(msrest.serialization.Mod """ _validation = { - 'principal_id': {'readonly': True}, - 'client_id': {'readonly': True}, + "principal_id": {"readonly": True}, + "client_id": {"readonly": True}, } _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, + "principal_id": {"key": "principalId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(ManagedServiceIdentityUserAssignedIdentitiesValue, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.principal_id = None self.client_id = None -class NetworkProfileForSnapshot(msrest.serialization.Model): +class NetworkProfileForSnapshot(_serialization.Model): """network profile for managed cluster snapshot, these properties are read only. :ivar network_plugin: networkPlugin for managed cluster snapshot. Known values are: "azure", - "kubenet", "none". Default value: "kubenet". + "kubenet", and "none". :vartype network_plugin: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.NetworkPlugin - :ivar network_policy: networkPolicy for managed cluster snapshot. Known values are: "calico", - "azure". + :ivar network_policy: networkPolicy for managed cluster snapshot. Known values are: "calico" + and "azure". :vartype network_policy: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.NetworkPolicy - :ivar network_mode: networkMode for managed cluster snapshot. Known values are: "transparent", - "bridge". + :ivar network_mode: networkMode for managed cluster snapshot. Known values are: "transparent" + and "bridge". :vartype network_mode: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.NetworkMode :ivar load_balancer_sku: loadBalancerSku for managed cluster snapshot. Known values are: - "standard", "basic". + "standard" and "basic". :vartype load_balancer_sku: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.LoadBalancerSku """ _attribute_map = { - 'network_plugin': {'key': 'networkPlugin', 'type': 'str'}, - 'network_policy': {'key': 'networkPolicy', 'type': 'str'}, - 'network_mode': {'key': 'networkMode', 'type': 'str'}, - 'load_balancer_sku': {'key': 'loadBalancerSku', 'type': 'str'}, + "network_plugin": {"key": "networkPlugin", "type": "str"}, + "network_policy": {"key": "networkPolicy", "type": "str"}, + "network_mode": {"key": "networkMode", "type": "str"}, + "load_balancer_sku": {"key": "loadBalancerSku", "type": "str"}, } def __init__( self, *, - network_plugin: Optional[Union[str, "_models.NetworkPlugin"]] = "kubenet", + network_plugin: Union[str, "_models.NetworkPlugin"] = "kubenet", network_policy: Optional[Union[str, "_models.NetworkPolicy"]] = None, network_mode: Optional[Union[str, "_models.NetworkMode"]] = None, load_balancer_sku: Optional[Union[str, "_models.LoadBalancerSku"]] = None, @@ -5401,30 +5268,30 @@ def __init__( ): """ :keyword network_plugin: networkPlugin for managed cluster snapshot. Known values are: "azure", - "kubenet", "none". Default value: "kubenet". + "kubenet", and "none". :paramtype network_plugin: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.NetworkPlugin - :keyword network_policy: networkPolicy for managed cluster snapshot. Known values are: - "calico", "azure". + :keyword network_policy: networkPolicy for managed cluster snapshot. Known values are: "calico" + and "azure". :paramtype network_policy: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.NetworkPolicy :keyword network_mode: networkMode for managed cluster snapshot. Known values are: - "transparent", "bridge". + "transparent" and "bridge". :paramtype network_mode: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.NetworkMode :keyword load_balancer_sku: loadBalancerSku for managed cluster snapshot. Known values are: - "standard", "basic". + "standard" and "basic". :paramtype load_balancer_sku: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.LoadBalancerSku """ - super(NetworkProfileForSnapshot, self).__init__(**kwargs) + super().__init__(**kwargs) self.network_plugin = network_plugin self.network_policy = network_policy self.network_mode = network_mode self.load_balancer_sku = load_balancer_sku -class OperationListResult(msrest.serialization.Model): +class OperationListResult(_serialization.Model): """The List Operation response. Variables are only populated by the server, and will be ignored when sending a request. @@ -5434,24 +5301,20 @@ class OperationListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[OperationValue]'}, + "value": {"key": "value", "type": "[OperationValue]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(OperationListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None -class OperationValue(msrest.serialization.Model): +class OperationValue(_serialization.Model): """Describes the properties of a Operation value. Variables are only populated by the server, and will be ignored when sending a request. @@ -5471,30 +5334,26 @@ class OperationValue(msrest.serialization.Model): """ _validation = { - 'origin': {'readonly': True}, - 'name': {'readonly': True}, - 'operation': {'readonly': True}, - 'resource': {'readonly': True}, - 'description': {'readonly': True}, - 'provider': {'readonly': True}, + "origin": {"readonly": True}, + "name": {"readonly": True}, + "operation": {"readonly": True}, + "resource": {"readonly": True}, + "description": {"readonly": True}, + "provider": {"readonly": True}, } _attribute_map = { - 'origin': {'key': 'origin', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'operation': {'key': 'display.operation', 'type': 'str'}, - 'resource': {'key': 'display.resource', 'type': 'str'}, - 'description': {'key': 'display.description', 'type': 'str'}, - 'provider': {'key': 'display.provider', 'type': 'str'}, + "origin": {"key": "origin", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "operation": {"key": "display.operation", "type": "str"}, + "resource": {"key": "display.resource", "type": "str"}, + "description": {"key": "display.description", "type": "str"}, + "provider": {"key": "display.provider", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(OperationValue, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.origin = None self.name = None self.operation = None @@ -5503,7 +5362,7 @@ def __init__( self.provider = None -class OSOptionProfile(msrest.serialization.Model): +class OSOptionProfile(_serialization.Model): """The OS option profile. Variables are only populated by the server, and will be ignored when sending a request. @@ -5516,83 +5375,72 @@ class OSOptionProfile(msrest.serialization.Model): :vartype name: str :ivar type: The type of the OS option resource. :vartype type: str - :ivar os_option_property_list: Required. The list of OS options. + :ivar os_option_property_list: The list of OS options. Required. :vartype os_option_property_list: list[~azure.mgmt.containerservice.v2022_03_02_preview.models.OSOptionProperty] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'os_option_property_list': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "os_option_property_list": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'os_option_property_list': {'key': 'properties.osOptionPropertyList', 'type': '[OSOptionProperty]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "os_option_property_list": {"key": "properties.osOptionPropertyList", "type": "[OSOptionProperty]"}, } - def __init__( - self, - *, - os_option_property_list: List["_models.OSOptionProperty"], - **kwargs - ): + def __init__(self, *, os_option_property_list: List["_models.OSOptionProperty"], **kwargs): """ - :keyword os_option_property_list: Required. The list of OS options. + :keyword os_option_property_list: The list of OS options. Required. :paramtype os_option_property_list: list[~azure.mgmt.containerservice.v2022_03_02_preview.models.OSOptionProperty] """ - super(OSOptionProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None self.os_option_property_list = os_option_property_list -class OSOptionProperty(msrest.serialization.Model): +class OSOptionProperty(_serialization.Model): """OS option property. All required parameters must be populated in order to send to Azure. - :ivar os_type: Required. The OS type. + :ivar os_type: The OS type. Required. :vartype os_type: str - :ivar enable_fips_image: Required. Whether the image is FIPS-enabled. + :ivar enable_fips_image: Whether the image is FIPS-enabled. Required. :vartype enable_fips_image: bool """ _validation = { - 'os_type': {'required': True}, - 'enable_fips_image': {'required': True}, + "os_type": {"required": True}, + "enable_fips_image": {"required": True}, } _attribute_map = { - 'os_type': {'key': 'os-type', 'type': 'str'}, - 'enable_fips_image': {'key': 'enable-fips-image', 'type': 'bool'}, + "os_type": {"key": "os-type", "type": "str"}, + "enable_fips_image": {"key": "enable-fips-image", "type": "bool"}, } - def __init__( - self, - *, - os_type: str, - enable_fips_image: bool, - **kwargs - ): + def __init__(self, *, os_type: str, enable_fips_image: bool, **kwargs): """ - :keyword os_type: Required. The OS type. + :keyword os_type: The OS type. Required. :paramtype os_type: str - :keyword enable_fips_image: Required. Whether the image is FIPS-enabled. + :keyword enable_fips_image: Whether the image is FIPS-enabled. Required. :paramtype enable_fips_image: bool """ - super(OSOptionProperty, self).__init__(**kwargs) + super().__init__(**kwargs) self.os_type = os_type self.enable_fips_image = enable_fips_image -class OutboundEnvironmentEndpoint(msrest.serialization.Model): +class OutboundEnvironmentEndpoint(_serialization.Model): """Egress endpoints which AKS agent nodes connect to for common purpose. :ivar category: The category of endpoints accessed by the AKS agent node, e.g. @@ -5604,8 +5452,8 @@ class OutboundEnvironmentEndpoint(msrest.serialization.Model): """ _attribute_map = { - 'category': {'key': 'category', 'type': 'str'}, - 'endpoints': {'key': 'endpoints', 'type': '[EndpointDependency]'}, + "category": {"key": "category", "type": "str"}, + "endpoints": {"key": "endpoints", "type": "[EndpointDependency]"}, } def __init__( @@ -5623,19 +5471,19 @@ def __init__( :paramtype endpoints: list[~azure.mgmt.containerservice.v2022_03_02_preview.models.EndpointDependency] """ - super(OutboundEnvironmentEndpoint, self).__init__(**kwargs) + super().__init__(**kwargs) self.category = category self.endpoints = endpoints -class OutboundEnvironmentEndpointCollection(msrest.serialization.Model): +class OutboundEnvironmentEndpointCollection(_serialization.Model): """Collection of OutboundEnvironmentEndpoint. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar value: Required. Collection of resources. + :ivar value: Collection of resources. Required. :vartype value: list[~azure.mgmt.containerservice.v2022_03_02_preview.models.OutboundEnvironmentEndpoint] :ivar next_link: Link to next page of resources. @@ -5643,59 +5491,49 @@ class OutboundEnvironmentEndpointCollection(msrest.serialization.Model): """ _validation = { - 'value': {'required': True}, - 'next_link': {'readonly': True}, + "value": {"required": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[OutboundEnvironmentEndpoint]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[OutboundEnvironmentEndpoint]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: List["_models.OutboundEnvironmentEndpoint"], - **kwargs - ): + def __init__(self, *, value: List["_models.OutboundEnvironmentEndpoint"], **kwargs): """ - :keyword value: Required. Collection of resources. + :keyword value: Collection of resources. Required. :paramtype value: list[~azure.mgmt.containerservice.v2022_03_02_preview.models.OutboundEnvironmentEndpoint] """ - super(OutboundEnvironmentEndpointCollection, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class PowerState(msrest.serialization.Model): +class PowerState(_serialization.Model): """Describes the Power State of the cluster. - :ivar code: Tells whether the cluster is Running or Stopped. Known values are: "Running", + :ivar code: Tells whether the cluster is Running or Stopped. Known values are: "Running" and "Stopped". :vartype code: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.Code """ _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, + "code": {"key": "code", "type": "str"}, } - def __init__( - self, - *, - code: Optional[Union[str, "_models.Code"]] = None, - **kwargs - ): + def __init__(self, *, code: Optional[Union[str, "_models.Code"]] = None, **kwargs): """ - :keyword code: Tells whether the cluster is Running or Stopped. Known values are: "Running", + :keyword code: Tells whether the cluster is Running or Stopped. Known values are: "Running" and "Stopped". :paramtype code: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.Code """ - super(PowerState, self).__init__(**kwargs) + super().__init__(**kwargs) self.code = code -class PrivateEndpoint(msrest.serialization.Model): +class PrivateEndpoint(_serialization.Model): """Private endpoint which a connection belongs to. :ivar id: The resource ID of the private endpoint. @@ -5703,24 +5541,19 @@ class PrivateEndpoint(msrest.serialization.Model): """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, } - def __init__( - self, - *, - id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin """ :keyword id: The resource ID of the private endpoint. :paramtype id: str """ - super(PrivateEndpoint, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id -class PrivateEndpointConnection(msrest.serialization.Model): +class PrivateEndpointConnection(_serialization.Model): """A private endpoint connection. Variables are only populated by the server, and will be ignored when sending a request. @@ -5732,7 +5565,7 @@ class PrivateEndpointConnection(msrest.serialization.Model): :ivar type: The resource type. :vartype type: str :ivar provisioning_state: The current provisioning state. Known values are: "Succeeded", - "Creating", "Deleting", "Failed". + "Creating", "Deleting", and "Failed". :vartype provisioning_state: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.PrivateEndpointConnectionProvisioningState :ivar private_endpoint: The resource of private endpoint. @@ -5745,19 +5578,22 @@ class PrivateEndpointConnection(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'provisioning_state': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, - 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "private_endpoint": {"key": "properties.privateEndpoint", "type": "PrivateEndpoint"}, + "private_link_service_connection_state": { + "key": "properties.privateLinkServiceConnectionState", + "type": "PrivateLinkServiceConnectionState", + }, } def __init__( @@ -5776,7 +5612,7 @@ def __init__( :paramtype private_link_service_connection_state: ~azure.mgmt.containerservice.v2022_03_02_preview.models.PrivateLinkServiceConnectionState """ - super(PrivateEndpointConnection, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -5785,7 +5621,7 @@ def __init__( self.private_link_service_connection_state = private_link_service_connection_state -class PrivateEndpointConnectionListResult(msrest.serialization.Model): +class PrivateEndpointConnectionListResult(_serialization.Model): """A list of private endpoint connections. :ivar value: The collection value. @@ -5794,25 +5630,20 @@ class PrivateEndpointConnectionListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, + "value": {"key": "value", "type": "[PrivateEndpointConnection]"}, } - def __init__( - self, - *, - value: Optional[List["_models.PrivateEndpointConnection"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.PrivateEndpointConnection"]] = None, **kwargs): """ :keyword value: The collection value. :paramtype value: list[~azure.mgmt.containerservice.v2022_03_02_preview.models.PrivateEndpointConnection] """ - super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value -class PrivateLinkResource(msrest.serialization.Model): +class PrivateLinkResource(_serialization.Model): """A private link resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -5833,22 +5664,22 @@ class PrivateLinkResource(msrest.serialization.Model): """ _validation = { - 'private_link_service_id': {'readonly': True}, + "private_link_service_id": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'group_id': {'key': 'groupId', 'type': 'str'}, - 'required_members': {'key': 'requiredMembers', 'type': '[str]'}, - 'private_link_service_id': {'key': 'privateLinkServiceID', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "group_id": {"key": "groupId", "type": "str"}, + "required_members": {"key": "requiredMembers", "type": "[str]"}, + "private_link_service_id": {"key": "privateLinkServiceID", "type": "str"}, } def __init__( self, *, - id: Optional[str] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin name: Optional[str] = None, type: Optional[str] = None, group_id: Optional[str] = None, @@ -5867,7 +5698,7 @@ def __init__( :keyword required_members: The RequiredMembers of the resource. :paramtype required_members: list[str] """ - super(PrivateLinkResource, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id self.name = name self.type = type @@ -5876,7 +5707,7 @@ def __init__( self.private_link_service_id = None -class PrivateLinkResourcesListResult(msrest.serialization.Model): +class PrivateLinkResourcesListResult(_serialization.Model): """A list of private link resources. :ivar value: The collection value. @@ -5885,29 +5716,24 @@ class PrivateLinkResourcesListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, + "value": {"key": "value", "type": "[PrivateLinkResource]"}, } - def __init__( - self, - *, - value: Optional[List["_models.PrivateLinkResource"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.PrivateLinkResource"]] = None, **kwargs): """ :keyword value: The collection value. :paramtype value: list[~azure.mgmt.containerservice.v2022_03_02_preview.models.PrivateLinkResource] """ - super(PrivateLinkResourcesListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value -class PrivateLinkServiceConnectionState(msrest.serialization.Model): +class PrivateLinkServiceConnectionState(_serialization.Model): """The state of a private link service connection. :ivar status: The private link service connection status. Known values are: "Pending", - "Approved", "Rejected", "Disconnected". + "Approved", "Rejected", and "Disconnected". :vartype status: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.ConnectionStatus :ivar description: The private link service connection description. @@ -5915,8 +5741,8 @@ class PrivateLinkServiceConnectionState(msrest.serialization.Model): """ _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, + "status": {"key": "status", "type": "str"}, + "description": {"key": "description", "type": "str"}, } def __init__( @@ -5928,18 +5754,18 @@ def __init__( ): """ :keyword status: The private link service connection status. Known values are: "Pending", - "Approved", "Rejected", "Disconnected". + "Approved", "Rejected", and "Disconnected". :paramtype status: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.ConnectionStatus :keyword description: The private link service connection description. :paramtype description: str """ - super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) + super().__init__(**kwargs) self.status = status self.description = description -class ResourceReference(msrest.serialization.Model): +class ResourceReference(_serialization.Model): """A reference to an Azure resource. :ivar id: The fully qualified Azure resource id. @@ -5947,29 +5773,24 @@ class ResourceReference(msrest.serialization.Model): """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, } - def __init__( - self, - *, - id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin """ :keyword id: The fully qualified Azure resource id. :paramtype id: str """ - super(ResourceReference, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id -class RunCommandRequest(msrest.serialization.Model): +class RunCommandRequest(_serialization.Model): """A run command request. All required parameters must be populated in order to send to Azure. - :ivar command: Required. The command to run. + :ivar command: The command to run. Required. :vartype command: str :ivar context: A base64 encoded zip file containing the files required by the command. :vartype context: str @@ -5978,38 +5799,31 @@ class RunCommandRequest(msrest.serialization.Model): """ _validation = { - 'command': {'required': True}, + "command": {"required": True}, } _attribute_map = { - 'command': {'key': 'command', 'type': 'str'}, - 'context': {'key': 'context', 'type': 'str'}, - 'cluster_token': {'key': 'clusterToken', 'type': 'str'}, + "command": {"key": "command", "type": "str"}, + "context": {"key": "context", "type": "str"}, + "cluster_token": {"key": "clusterToken", "type": "str"}, } - def __init__( - self, - *, - command: str, - context: Optional[str] = None, - cluster_token: Optional[str] = None, - **kwargs - ): + def __init__(self, *, command: str, context: Optional[str] = None, cluster_token: Optional[str] = None, **kwargs): """ - :keyword command: Required. The command to run. + :keyword command: The command to run. Required. :paramtype command: str :keyword context: A base64 encoded zip file containing the files required by the command. :paramtype context: str :keyword cluster_token: AuthToken issued for AKS AAD Server App. :paramtype cluster_token: str """ - super(RunCommandRequest, self).__init__(**kwargs) + super().__init__(**kwargs) self.command = command self.context = context self.cluster_token = cluster_token -class RunCommandResult(msrest.serialization.Model): +class RunCommandResult(_serialization.Model): """run command result. Variables are only populated by the server, and will be ignored when sending a request. @@ -6031,32 +5845,28 @@ class RunCommandResult(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'exit_code': {'readonly': True}, - 'started_at': {'readonly': True}, - 'finished_at': {'readonly': True}, - 'logs': {'readonly': True}, - 'reason': {'readonly': True}, + "id": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "exit_code": {"readonly": True}, + "started_at": {"readonly": True}, + "finished_at": {"readonly": True}, + "logs": {"readonly": True}, + "reason": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'exit_code': {'key': 'properties.exitCode', 'type': 'int'}, - 'started_at': {'key': 'properties.startedAt', 'type': 'iso-8601'}, - 'finished_at': {'key': 'properties.finishedAt', 'type': 'iso-8601'}, - 'logs': {'key': 'properties.logs', 'type': 'str'}, - 'reason': {'key': 'properties.reason', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(RunCommandResult, self).__init__(**kwargs) + "id": {"key": "id", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "exit_code": {"key": "properties.exitCode", "type": "int"}, + "started_at": {"key": "properties.startedAt", "type": "iso-8601"}, + "finished_at": {"key": "properties.finishedAt", "type": "iso-8601"}, + "logs": {"key": "properties.logs", "type": "str"}, + "reason": {"key": "properties.reason", "type": "str"}, + } + + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.id = None self.provisioning_state = None self.exit_code = None @@ -6066,7 +5876,7 @@ def __init__( self.reason = None -class Snapshot(TrackedResource): +class Snapshot(TrackedResource): # pylint: disable=too-many-instance-attributes """A node pool snapshot resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -6084,26 +5894,26 @@ class Snapshot(TrackedResource): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.containerservice.v2022_03_02_preview.models.SystemData - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] - :ivar location: Required. The geo-location where the resource lives. + :ivar location: The geo-location where the resource lives. Required. :vartype location: str :ivar creation_data: CreationData to be used to specify the source agent pool resource ID to create this snapshot. :vartype creation_data: ~azure.mgmt.containerservice.v2022_03_02_preview.models.CreationData :ivar snapshot_type: The type of a snapshot. The default is NodePool. Known values are: - "NodePool", "ManagedCluster". Default value: "NodePool". + "NodePool" and "ManagedCluster". :vartype snapshot_type: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.SnapshotType :ivar kubernetes_version: The version of Kubernetes. :vartype kubernetes_version: str :ivar node_image_version: The version of node image. :vartype node_image_version: str - :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.OSType :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known - values are: "Ubuntu", "CBLMariner". + values are: "Ubuntu" and "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.OSSKU :ivar vm_size: The size of the VM. :vartype vm_size: str @@ -6112,34 +5922,34 @@ class Snapshot(TrackedResource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'location': {'required': True}, - 'kubernetes_version': {'readonly': True}, - 'node_image_version': {'readonly': True}, - 'os_type': {'readonly': True}, - 'os_sku': {'readonly': True}, - 'vm_size': {'readonly': True}, - 'enable_fips': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, + "kubernetes_version": {"readonly": True}, + "node_image_version": {"readonly": True}, + "os_type": {"readonly": True}, + "os_sku": {"readonly": True}, + "vm_size": {"readonly": True}, + "enable_fips": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - 'creation_data': {'key': 'properties.creationData', 'type': 'CreationData'}, - 'snapshot_type': {'key': 'properties.snapshotType', 'type': 'str'}, - 'kubernetes_version': {'key': 'properties.kubernetesVersion', 'type': 'str'}, - 'node_image_version': {'key': 'properties.nodeImageVersion', 'type': 'str'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'os_sku': {'key': 'properties.osSku', 'type': 'str'}, - 'vm_size': {'key': 'properties.vmSize', 'type': 'str'}, - 'enable_fips': {'key': 'properties.enableFIPS', 'type': 'bool'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "creation_data": {"key": "properties.creationData", "type": "CreationData"}, + "snapshot_type": {"key": "properties.snapshotType", "type": "str"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "node_image_version": {"key": "properties.nodeImageVersion", "type": "str"}, + "os_type": {"key": "properties.osType", "type": "str"}, + "os_sku": {"key": "properties.osSku", "type": "str"}, + "vm_size": {"key": "properties.vmSize", "type": "str"}, + "enable_fips": {"key": "properties.enableFIPS", "type": "bool"}, } def __init__( @@ -6148,23 +5958,23 @@ def __init__( location: str, tags: Optional[Dict[str, str]] = None, creation_data: Optional["_models.CreationData"] = None, - snapshot_type: Optional[Union[str, "_models.SnapshotType"]] = "NodePool", + snapshot_type: Union[str, "_models.SnapshotType"] = "NodePool", **kwargs ): """ - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] - :keyword location: Required. The geo-location where the resource lives. + :keyword location: The geo-location where the resource lives. Required. :paramtype location: str :keyword creation_data: CreationData to be used to specify the source agent pool resource ID to create this snapshot. :paramtype creation_data: ~azure.mgmt.containerservice.v2022_03_02_preview.models.CreationData :keyword snapshot_type: The type of a snapshot. The default is NodePool. Known values are: - "NodePool", "ManagedCluster". Default value: "NodePool". + "NodePool" and "ManagedCluster". :paramtype snapshot_type: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.SnapshotType """ - super(Snapshot, self).__init__(tags=tags, location=location, **kwargs) + super().__init__(tags=tags, location=location, **kwargs) self.creation_data = creation_data self.snapshot_type = snapshot_type self.kubernetes_version = None @@ -6175,7 +5985,7 @@ def __init__( self.enable_fips = None -class SnapshotListResult(msrest.serialization.Model): +class SnapshotListResult(_serialization.Model): """The response from the List Snapshots operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -6187,30 +5997,25 @@ class SnapshotListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[Snapshot]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[Snapshot]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.Snapshot"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.Snapshot"]] = None, **kwargs): """ :keyword value: The list of snapshots. :paramtype value: list[~azure.mgmt.containerservice.v2022_03_02_preview.models.Snapshot] """ - super(SnapshotListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class SysctlConfig(msrest.serialization.Model): +class SysctlConfig(_serialization.Model): # pylint: disable=too-many-instance-attributes """Sysctl settings for Linux agent nodes. :ivar net_core_somaxconn: Sysctl setting net.core.somaxconn. @@ -6272,37 +6077,37 @@ class SysctlConfig(msrest.serialization.Model): """ _attribute_map = { - 'net_core_somaxconn': {'key': 'netCoreSomaxconn', 'type': 'int'}, - 'net_core_netdev_max_backlog': {'key': 'netCoreNetdevMaxBacklog', 'type': 'int'}, - 'net_core_rmem_default': {'key': 'netCoreRmemDefault', 'type': 'int'}, - 'net_core_rmem_max': {'key': 'netCoreRmemMax', 'type': 'int'}, - 'net_core_wmem_default': {'key': 'netCoreWmemDefault', 'type': 'int'}, - 'net_core_wmem_max': {'key': 'netCoreWmemMax', 'type': 'int'}, - 'net_core_optmem_max': {'key': 'netCoreOptmemMax', 'type': 'int'}, - 'net_ipv4_tcp_max_syn_backlog': {'key': 'netIpv4TcpMaxSynBacklog', 'type': 'int'}, - 'net_ipv4_tcp_max_tw_buckets': {'key': 'netIpv4TcpMaxTwBuckets', 'type': 'int'}, - 'net_ipv4_tcp_fin_timeout': {'key': 'netIpv4TcpFinTimeout', 'type': 'int'}, - 'net_ipv4_tcp_keepalive_time': {'key': 'netIpv4TcpKeepaliveTime', 'type': 'int'}, - 'net_ipv4_tcp_keepalive_probes': {'key': 'netIpv4TcpKeepaliveProbes', 'type': 'int'}, - 'net_ipv4_tcpkeepalive_intvl': {'key': 'netIpv4TcpkeepaliveIntvl', 'type': 'int'}, - 'net_ipv4_tcp_tw_reuse': {'key': 'netIpv4TcpTwReuse', 'type': 'bool'}, - 'net_ipv4_ip_local_port_range': {'key': 'netIpv4IpLocalPortRange', 'type': 'str'}, - 'net_ipv4_neigh_default_gc_thresh1': {'key': 'netIpv4NeighDefaultGcThresh1', 'type': 'int'}, - 'net_ipv4_neigh_default_gc_thresh2': {'key': 'netIpv4NeighDefaultGcThresh2', 'type': 'int'}, - 'net_ipv4_neigh_default_gc_thresh3': {'key': 'netIpv4NeighDefaultGcThresh3', 'type': 'int'}, - 'net_netfilter_nf_conntrack_max': {'key': 'netNetfilterNfConntrackMax', 'type': 'int'}, - 'net_netfilter_nf_conntrack_buckets': {'key': 'netNetfilterNfConntrackBuckets', 'type': 'int'}, - 'fs_inotify_max_user_watches': {'key': 'fsInotifyMaxUserWatches', 'type': 'int'}, - 'fs_file_max': {'key': 'fsFileMax', 'type': 'int'}, - 'fs_aio_max_nr': {'key': 'fsAioMaxNr', 'type': 'int'}, - 'fs_nr_open': {'key': 'fsNrOpen', 'type': 'int'}, - 'kernel_threads_max': {'key': 'kernelThreadsMax', 'type': 'int'}, - 'vm_max_map_count': {'key': 'vmMaxMapCount', 'type': 'int'}, - 'vm_swappiness': {'key': 'vmSwappiness', 'type': 'int'}, - 'vm_vfs_cache_pressure': {'key': 'vmVfsCachePressure', 'type': 'int'}, - } - - def __init__( + "net_core_somaxconn": {"key": "netCoreSomaxconn", "type": "int"}, + "net_core_netdev_max_backlog": {"key": "netCoreNetdevMaxBacklog", "type": "int"}, + "net_core_rmem_default": {"key": "netCoreRmemDefault", "type": "int"}, + "net_core_rmem_max": {"key": "netCoreRmemMax", "type": "int"}, + "net_core_wmem_default": {"key": "netCoreWmemDefault", "type": "int"}, + "net_core_wmem_max": {"key": "netCoreWmemMax", "type": "int"}, + "net_core_optmem_max": {"key": "netCoreOptmemMax", "type": "int"}, + "net_ipv4_tcp_max_syn_backlog": {"key": "netIpv4TcpMaxSynBacklog", "type": "int"}, + "net_ipv4_tcp_max_tw_buckets": {"key": "netIpv4TcpMaxTwBuckets", "type": "int"}, + "net_ipv4_tcp_fin_timeout": {"key": "netIpv4TcpFinTimeout", "type": "int"}, + "net_ipv4_tcp_keepalive_time": {"key": "netIpv4TcpKeepaliveTime", "type": "int"}, + "net_ipv4_tcp_keepalive_probes": {"key": "netIpv4TcpKeepaliveProbes", "type": "int"}, + "net_ipv4_tcpkeepalive_intvl": {"key": "netIpv4TcpkeepaliveIntvl", "type": "int"}, + "net_ipv4_tcp_tw_reuse": {"key": "netIpv4TcpTwReuse", "type": "bool"}, + "net_ipv4_ip_local_port_range": {"key": "netIpv4IpLocalPortRange", "type": "str"}, + "net_ipv4_neigh_default_gc_thresh1": {"key": "netIpv4NeighDefaultGcThresh1", "type": "int"}, + "net_ipv4_neigh_default_gc_thresh2": {"key": "netIpv4NeighDefaultGcThresh2", "type": "int"}, + "net_ipv4_neigh_default_gc_thresh3": {"key": "netIpv4NeighDefaultGcThresh3", "type": "int"}, + "net_netfilter_nf_conntrack_max": {"key": "netNetfilterNfConntrackMax", "type": "int"}, + "net_netfilter_nf_conntrack_buckets": {"key": "netNetfilterNfConntrackBuckets", "type": "int"}, + "fs_inotify_max_user_watches": {"key": "fsInotifyMaxUserWatches", "type": "int"}, + "fs_file_max": {"key": "fsFileMax", "type": "int"}, + "fs_aio_max_nr": {"key": "fsAioMaxNr", "type": "int"}, + "fs_nr_open": {"key": "fsNrOpen", "type": "int"}, + "kernel_threads_max": {"key": "kernelThreadsMax", "type": "int"}, + "vm_max_map_count": {"key": "vmMaxMapCount", "type": "int"}, + "vm_swappiness": {"key": "vmSwappiness", "type": "int"}, + "vm_vfs_cache_pressure": {"key": "vmVfsCachePressure", "type": "int"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, net_core_somaxconn: Optional[int] = None, @@ -6393,7 +6198,7 @@ def __init__( :keyword vm_vfs_cache_pressure: Sysctl setting vm.vfs_cache_pressure. :paramtype vm_vfs_cache_pressure: int """ - super(SysctlConfig, self).__init__(**kwargs) + super().__init__(**kwargs) self.net_core_somaxconn = net_core_somaxconn self.net_core_netdev_max_backlog = net_core_netdev_max_backlog self.net_core_rmem_default = net_core_rmem_default @@ -6424,13 +6229,13 @@ def __init__( self.vm_vfs_cache_pressure = vm_vfs_cache_pressure -class SystemData(msrest.serialization.Model): +class SystemData(_serialization.Model): """Metadata pertaining to creation and last modification of the resource. :ivar created_by: The identity that created the resource. :vartype created_by: str :ivar created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", "Key". + "User", "Application", "ManagedIdentity", and "Key". :vartype created_by_type: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.CreatedByType :ivar created_at: The timestamp of resource creation (UTC). @@ -6438,7 +6243,7 @@ class SystemData(msrest.serialization.Model): :ivar last_modified_by: The identity that last modified the resource. :vartype last_modified_by: str :ivar last_modified_by_type: The type of identity that last modified the resource. Known values - are: "User", "Application", "ManagedIdentity", "Key". + are: "User", "Application", "ManagedIdentity", and "Key". :vartype last_modified_by_type: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.CreatedByType :ivar last_modified_at: The timestamp of resource last modification (UTC). @@ -6446,12 +6251,12 @@ class SystemData(msrest.serialization.Model): """ _attribute_map = { - 'created_by': {'key': 'createdBy', 'type': 'str'}, - 'created_by_type': {'key': 'createdByType', 'type': 'str'}, - 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, - 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, - 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, - 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + "created_by": {"key": "createdBy", "type": "str"}, + "created_by_type": {"key": "createdByType", "type": "str"}, + "created_at": {"key": "createdAt", "type": "iso-8601"}, + "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, + "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, + "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, } def __init__( @@ -6469,7 +6274,7 @@ def __init__( :keyword created_by: The identity that created the resource. :paramtype created_by: str :keyword created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", "Key". + "User", "Application", "ManagedIdentity", and "Key". :paramtype created_by_type: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.CreatedByType :keyword created_at: The timestamp of resource creation (UTC). @@ -6477,13 +6282,13 @@ def __init__( :keyword last_modified_by: The identity that last modified the resource. :paramtype last_modified_by: str :keyword last_modified_by_type: The type of identity that last modified the resource. Known - values are: "User", "Application", "ManagedIdentity", "Key". + values are: "User", "Application", "ManagedIdentity", and "Key". :paramtype last_modified_by_type: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.CreatedByType :keyword last_modified_at: The timestamp of resource last modification (UTC). :paramtype last_modified_at: ~datetime.datetime """ - super(SystemData, self).__init__(**kwargs) + super().__init__(**kwargs) self.created_by = created_by self.created_by_type = created_by_type self.created_at = created_at @@ -6492,36 +6297,31 @@ def __init__( self.last_modified_at = last_modified_at -class TagsObject(msrest.serialization.Model): +class TagsObject(_serialization.Model): """Tags object for patch operations. - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] """ _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] """ - super(TagsObject, self).__init__(**kwargs) + super().__init__(**kwargs) self.tags = tags -class TimeInWeek(msrest.serialization.Model): +class TimeInWeek(_serialization.Model): """Time in a week. :ivar day: The day of the week. Known values are: "Sunday", "Monday", "Tuesday", "Wednesday", - "Thursday", "Friday", "Saturday". + "Thursday", "Friday", and "Saturday". :vartype day: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.WeekDay :ivar hour_slots: Each integer hour represents a time range beginning at 0m after the hour ending at the next hour (non-inclusive). 0 corresponds to 00:00 UTC, 23 corresponds to 23:00 @@ -6530,32 +6330,28 @@ class TimeInWeek(msrest.serialization.Model): """ _attribute_map = { - 'day': {'key': 'day', 'type': 'str'}, - 'hour_slots': {'key': 'hourSlots', 'type': '[int]'}, + "day": {"key": "day", "type": "str"}, + "hour_slots": {"key": "hourSlots", "type": "[int]"}, } def __init__( - self, - *, - day: Optional[Union[str, "_models.WeekDay"]] = None, - hour_slots: Optional[List[int]] = None, - **kwargs + self, *, day: Optional[Union[str, "_models.WeekDay"]] = None, hour_slots: Optional[List[int]] = None, **kwargs ): """ :keyword day: The day of the week. Known values are: "Sunday", "Monday", "Tuesday", - "Wednesday", "Thursday", "Friday", "Saturday". + "Wednesday", "Thursday", "Friday", and "Saturday". :paramtype day: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.WeekDay :keyword hour_slots: Each integer hour represents a time range beginning at 0m after the hour ending at the next hour (non-inclusive). 0 corresponds to 00:00 UTC, 23 corresponds to 23:00 UTC. Specifying [0, 1] means the 00:00 - 02:00 UTC time range. :paramtype hour_slots: list[int] """ - super(TimeInWeek, self).__init__(**kwargs) + super().__init__(**kwargs) self.day = day self.hour_slots = hour_slots -class TimeSpan(msrest.serialization.Model): +class TimeSpan(_serialization.Model): """For example, between 2021-05-25T13:00:00Z and 2021-05-25T14:00:00Z. :ivar start: The start of a time span. @@ -6565,29 +6361,23 @@ class TimeSpan(msrest.serialization.Model): """ _attribute_map = { - 'start': {'key': 'start', 'type': 'iso-8601'}, - 'end': {'key': 'end', 'type': 'iso-8601'}, + "start": {"key": "start", "type": "iso-8601"}, + "end": {"key": "end", "type": "iso-8601"}, } - def __init__( - self, - *, - start: Optional[datetime.datetime] = None, - end: Optional[datetime.datetime] = None, - **kwargs - ): + def __init__(self, *, start: Optional[datetime.datetime] = None, end: Optional[datetime.datetime] = None, **kwargs): """ :keyword start: The start of a time span. :paramtype start: ~datetime.datetime :keyword end: The end of a time span. :paramtype end: ~datetime.datetime """ - super(TimeSpan, self).__init__(**kwargs) + super().__init__(**kwargs) self.start = start self.end = end -class WindowsGmsaProfile(msrest.serialization.Model): +class WindowsGmsaProfile(_serialization.Model): """Windows gMSA Profile in the managed cluster. :ivar enabled: Specifies whether to enable Windows gMSA in the managed cluster. @@ -6603,9 +6393,9 @@ class WindowsGmsaProfile(msrest.serialization.Model): """ _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'dns_server': {'key': 'dnsServer', 'type': 'str'}, - 'root_domain_name': {'key': 'rootDomainName', 'type': 'str'}, + "enabled": {"key": "enabled", "type": "bool"}, + "dns_server": {"key": "dnsServer", "type": "str"}, + "root_domain_name": {"key": "rootDomainName", "type": "str"}, } def __init__( @@ -6628,7 +6418,7 @@ def __init__( which is used to create the managed cluster. :paramtype root_domain_name: str """ - super(WindowsGmsaProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.dns_server = dns_server self.root_domain_name = root_domain_name diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/models/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/models/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/models/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/models/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/operations/__init__.py index d3b41c8a72b0..02682f76ce58 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/operations/__init__.py @@ -19,16 +19,17 @@ from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'Operations', - 'ManagedClustersOperations', - 'MaintenanceConfigurationsOperations', - 'AgentPoolsOperations', - 'PrivateEndpointConnectionsOperations', - 'PrivateLinkResourcesOperations', - 'ResolvePrivateLinkServiceIdOperations', - 'SnapshotsOperations', - 'ManagedClusterSnapshotsOperations', + "Operations", + "ManagedClustersOperations", + "MaintenanceConfigurationsOperations", + "AgentPoolsOperations", + "PrivateEndpointConnectionsOperations", + "PrivateLinkResourcesOperations", + "ResolvePrivateLinkServiceIdOperations", + "SnapshotsOperations", + "ManagedClusterSnapshotsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/operations/_agent_pools_operations.py index 649b1e6c1236..19d28753b013 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/operations/_agent_pools_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,141 +27,146 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - *, - json: Optional[_models.AgentPool] = None, - content: Any = None, - **kwargs: Any +def build_create_or_update_request( + resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request_initial( - subscription_id: str, +def build_delete_request( resource_group_name: str, resource_name: str, agent_pool_name: str, + subscription_id: str, *, ignore_pod_disruption_budget: Optional[bool] = None, **kwargs: Any @@ -164,150 +174,166 @@ def build_delete_request_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if ignore_pod_disruption_budget is not None: - _params['ignore-pod-disruption-budget'] = _SERIALIZER.query("ignore_pod_disruption_budget", ignore_pod_disruption_budget, 'bool') + _params["ignore-pod-disruption-budget"] = _SERIALIZER.query( + "ignore_pod_disruption_budget", ignore_pod_disruption_budget, "bool" + ) # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_get_upgrade_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_available_agent_pool_versions_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_upgrade_node_image_version_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any +def build_upgrade_node_image_version_request( + resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class AgentPoolsOperations: """ @@ -328,47 +354,41 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> Iterable[_models.AgentPoolListResult]: + def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> Iterable["_models.AgentPool"]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AgentPoolListResult or the result of cls(response) + :return: An iterator like instance of either AgentPool or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_03_02_preview.models.AgentPoolListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_03_02_preview.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -376,16 +396,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -401,10 +416,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -414,54 +427,46 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore @distributed_trace def get( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPool: """Gets the specified managed cluster agent pool. Gets the specified managed cluster agent pool. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPool, or the result of cls(response) + :return: AgentPool or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.AgentPool - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -469,57 +474,60 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore def _create_or_update_initial( self, resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: _models.AgentPool, + parameters: Union[_models.AgentPool, IO], **kwargs: Any ) -> _models.AgentPool: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - _json = self._serialize.body(parameters, 'AgentPool') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "AgentPool") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -527,10 +535,9 @@ def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -538,26 +545,27 @@ def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - - @distributed_trace + @overload def begin_create_or_update( self, resource_group_name: str, resource_name: str, agent_pool_name: str, parameters: _models.AgentPool, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.AgentPool]: """Creates or updates an agent pool in the specified managed cluster. @@ -565,13 +573,17 @@ def begin_create_or_update( Creates or updates an agent pool in the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str - :param parameters: The agent pool to create or update. + :param parameters: The agent pool to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_03_02_preview.models.AgentPool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -583,20 +595,98 @@ def begin_create_or_update( :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_03_02_preview.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AgentPool]: + """Creates or updates an agent pool in the specified managed cluster. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: The agent pool to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_03_02_preview.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: Union[_models.AgentPool, IO], + **kwargs: Any + ) -> LROPoller[_models.AgentPool]: + """Creates or updates an agent pool in the specified managed cluster. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: The agent pool to create or update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.mgmt.containerservice.v2022_03_02_preview.models.AgentPool or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_03_02_preview.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -605,39 +695,35 @@ def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements self, @@ -647,26 +733,23 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements ignore_pod_disruption_budget: Optional[bool] = None, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, - api_version=api_version, + subscription_id=self._config.subscription_id, ignore_pod_disruption_budget=ignore_pod_disruption_budget, - template_url=self._delete_initial.metadata['url'], + api_version=api_version, + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -674,10 +757,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -687,11 +769,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements + def begin_delete( self, resource_group_name: str, resource_name: str, @@ -704,10 +785,11 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Deletes an agent pool in the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :param ignore_pod_disruption_budget: ignore-pod-disruption-budget=true to delete those pods on a node without considering Pod Disruption Budget. Default value is None. @@ -722,19 +804,16 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -742,80 +821,70 @@ def begin_delete( # pylint: disable=inconsistent-return-statements agent_pool_name=agent_pool_name, ignore_pod_disruption_budget=ignore_pod_disruption_budget, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPoolUpgradeProfile: """Gets the upgrade profile for an agent pool. Gets the upgrade profile for an agent pool. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolUpgradeProfile, or the result of cls(response) + :return: AgentPoolUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.AgentPoolUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -823,32 +892,27 @@ def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolUpgradeProfile', pipeline_response) + deserialized = self._deserialize("AgentPoolUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore @distributed_trace def get_available_agent_pool_versions( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported Kubernetes versions for the specified agent pool. @@ -857,32 +921,30 @@ def get_available_agent_pool_versions( the version lifecycle. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolAvailableVersions, or the result of cls(response) + :return: AgentPoolAvailableVersions or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.AgentPoolAvailableVersions - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolAvailableVersions] - request = build_get_available_agent_pool_versions_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_available_agent_pool_versions.metadata['url'], + template_url=self.get_available_agent_pool_versions.metadata["url"], headers=_headers, params=_params, ) @@ -890,52 +952,43 @@ def get_available_agent_pool_versions( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolAvailableVersions', pipeline_response) + deserialized = self._deserialize("AgentPoolAvailableVersions", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_available_agent_pool_versions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore - + get_available_agent_pool_versions.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore def _upgrade_node_image_version_initial( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> Optional[_models.AgentPool]: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.AgentPool]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.AgentPool]] - - request = build_upgrade_node_image_version_request_initial( - subscription_id=self._config.subscription_id, + request = build_upgrade_node_image_version_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._upgrade_node_image_version_initial.metadata['url'], + template_url=self._upgrade_node_image_version_initial.metadata["url"], headers=_headers, params=_params, ) @@ -943,10 +996,9 @@ def _upgrade_node_image_version_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -956,26 +1008,23 @@ def _upgrade_node_image_version_initial( deserialized = None response_headers = {} if response.status_code == 202: - response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) - - deserialized = self._deserialize('AgentPool', pipeline_response) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _upgrade_node_image_version_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore - + _upgrade_node_image_version_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore @distributed_trace def begin_upgrade_node_image_version( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any - ) -> LROPoller[_models.AgentPool]: + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any + ) -> LROPoller[None]: """Upgrades the node image version of an agent pool to the latest. Upgrading the node image version of an agent pool applies the newest OS and runtime updates to @@ -983,10 +1032,11 @@ def begin_upgrade_node_image_version( node image versions, see: https://docs.microsoft.com/azure/aks/node-image-upgrade. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -999,59 +1049,54 @@ def begin_upgrade_node_image_version( :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_03_02_preview.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._upgrade_node_image_version_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) - - deserialized = self._deserialize('AgentPool', pipeline_response) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_upgrade_node_image_version.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore + begin_upgrade_node_image_version.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/operations/_maintenance_configurations_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/operations/_maintenance_configurations_operations.py index d3ecfd996e2c..5b83f5b1528b 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/operations/_maintenance_configurations_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/operations/_maintenance_configurations_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,173 +25,181 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +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_managed_cluster_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, config_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "configName": _SERIALIZER.url("config_name", config_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "configName": _SERIALIZER.url("config_name", config_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - config_name: str, - *, - json: Optional[_models.MaintenanceConfiguration] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, resource_name: str, config_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "configName": _SERIALIZER.url("config_name", config_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "configName": _SERIALIZER.url("config_name", config_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, config_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "configName": _SERIALIZER.url("config_name", config_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "configName": _SERIALIZER.url("config_name", config_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class MaintenanceConfigurationsOperations: """ @@ -207,48 +220,44 @@ def __init__(self, *args, **kwargs): 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_managed_cluster( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> Iterable[_models.MaintenanceConfigurationListResult]: + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> Iterable["_models.MaintenanceConfiguration"]: """Gets a list of maintenance configurations in the specified managed cluster. Gets a list of maintenance configurations in the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either MaintenanceConfigurationListResult or the result - of cls(response) + :return: An iterator like instance of either MaintenanceConfiguration or the result of + cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_03_02_preview.models.MaintenanceConfigurationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_03_02_preview.models.MaintenanceConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfigurationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfigurationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_managed_cluster_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_managed_cluster.metadata['url'], + template_url=self.list_by_managed_cluster.metadata["url"], headers=_headers, params=_params, ) @@ -256,16 +265,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_managed_cluster_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -281,10 +285,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -294,54 +296,46 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_managed_cluster.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations"} # type: ignore + list_by_managed_cluster.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations"} # type: ignore @distributed_trace def get( - self, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, config_name: str, **kwargs: Any ) -> _models.MaintenanceConfiguration: """Gets the specified maintenance configuration of a managed cluster. Gets the specified maintenance configuration of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: MaintenanceConfiguration, or the result of cls(response) + :return: MaintenanceConfiguration or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.MaintenanceConfiguration - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfiguration] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -349,33 +343,33 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) + deserialized = self._deserialize("MaintenanceConfiguration", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - - @distributed_trace + @overload def create_or_update( self, resource_group_name: str, resource_name: str, config_name: str, parameters: _models.MaintenanceConfiguration, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.MaintenanceConfiguration: """Creates or updates a maintenance configuration in the specified managed cluster. @@ -383,42 +377,117 @@ def create_or_update( Creates or updates a maintenance configuration in the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str - :param parameters: The maintenance configuration to create or update. + :param parameters: The maintenance configuration to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_03_02_preview.models.MaintenanceConfiguration + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configuration in the specified managed cluster. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: The maintenance configuration to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: MaintenanceConfiguration, or the result of cls(response) + :return: MaintenanceConfiguration or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.MaintenanceConfiguration - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: Union[_models.MaintenanceConfiguration, IO], + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configuration in the specified managed cluster. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: The maintenance configuration to create or update. Is either a model type or + a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2022_03_02_preview.models.MaintenanceConfiguration or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfiguration] - _json = self._serialize.body(parameters, 'MaintenanceConfiguration') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "MaintenanceConfiguration") request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) @@ -426,68 +495,60 @@ def create_or_update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) + deserialized = self._deserialize("MaintenanceConfiguration", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore @distributed_trace def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, config_name: str, **kwargs: Any ) -> None: """Deletes a maintenance configuration. Deletes a maintenance configuration. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) @@ -495,10 +556,9 @@ def delete( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -508,5 +568,4 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/operations/_managed_cluster_snapshots_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/operations/_managed_cluster_snapshots_operations.py index aa072a65db36..5208042284d6 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/operations/_managed_cluster_snapshots_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/operations/_managed_cluster_snapshots_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,243 +25,235 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedclustersnapshots") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedclustersnapshots" + ) # 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", min_length=1), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_resource_group_request( - subscription_id: str, - resource_group_name: str, - **kwargs: Any -) -> HttpRequest: +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: + _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, resource_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedClusterSnapshot] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_update_tags_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.TagsObject] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class ManagedClusterSnapshotsOperations: """ @@ -277,40 +274,35 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.ManagedClusterSnapshotListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.ManagedClusterSnapshot"]: """Gets a list of managed cluster snapshots in the specified subscription. Gets a list of managed cluster snapshots in the specified subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterSnapshotListResult or the result of + :return: An iterator like instance of either ManagedClusterSnapshot or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedClusterSnapshotListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedClusterSnapshot] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshotListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterSnapshotListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -318,14 +310,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -341,10 +330,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -354,49 +341,45 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedclustersnapshots"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedclustersnapshots"} # type: ignore @distributed_trace def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> Iterable[_models.ManagedClusterSnapshotListResult]: + self, resource_group_name: str, **kwargs: Any + ) -> Iterable["_models.ManagedClusterSnapshot"]: """Lists managed cluster snapshots in the specified subscription and resource group. Lists managed cluster snapshots in the specified subscription and resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterSnapshotListResult or the result of + :return: An iterator like instance of either ManagedClusterSnapshot or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedClusterSnapshotListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedClusterSnapshot] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshotListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterSnapshotListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -404,15 +387,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -428,10 +407,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -441,50 +418,41 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots"} # type: ignore @distributed_trace - def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.ManagedClusterSnapshot: + def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.ManagedClusterSnapshot: """Gets a managed cluster snapshot. Gets a managed cluster snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterSnapshot, or the result of cls(response) + :return: ManagedClusterSnapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedClusterSnapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterSnapshot] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -492,32 +460,32 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterSnapshot', pipeline_response) + deserialized = self._deserialize("ManagedClusterSnapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"} # type: ignore - @distributed_trace + @overload def create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterSnapshot, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.ManagedClusterSnapshot: """Creates or updates a managed cluster snapshot. @@ -525,39 +493,108 @@ def create_or_update( Creates or updates a managed cluster snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The managed cluster snapshot to create or update. + :param parameters: The managed cluster snapshot to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedClusterSnapshot + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedClusterSnapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedClusterSnapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ManagedClusterSnapshot: + """Creates or updates a managed cluster snapshot. + + Creates or updates a managed cluster snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster snapshot to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedClusterSnapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedClusterSnapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterSnapshot, IO], + **kwargs: Any + ) -> _models.ManagedClusterSnapshot: + """Creates or updates a managed cluster snapshot. + + Creates or updates a managed cluster snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster snapshot to create or update. Is either a model type or + a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedClusterSnapshot or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterSnapshot, or the result of cls(response) + :return: ManagedClusterSnapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedClusterSnapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterSnapshot] - _json = self._serialize.body(parameters, 'ManagedClusterSnapshot') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterSnapshot") request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) @@ -565,10 +602,9 @@ def create_or_update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -576,25 +612,26 @@ def create_or_update( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ManagedClusterSnapshot', pipeline_response) + deserialized = self._deserialize("ManagedClusterSnapshot", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('ManagedClusterSnapshot', pipeline_response) + deserialized = self._deserialize("ManagedClusterSnapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"} # type: ignore + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"} # type: ignore - - @distributed_trace + @overload def update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.ManagedClusterSnapshot: """Updates tags on a managed cluster snapshot. @@ -602,38 +639,104 @@ def update_tags( Updates tags on a managed cluster snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Update managed cluster snapshot Tags operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2022_03_02_preview.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterSnapshot, or the result of cls(response) + :return: ManagedClusterSnapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedClusterSnapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + def update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ManagedClusterSnapshot: + """Updates tags on a managed cluster snapshot. + + Updates tags on a managed cluster snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update managed cluster snapshot Tags operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedClusterSnapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedClusterSnapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> _models.ManagedClusterSnapshot: + """Updates tags on a managed cluster snapshot. + + Updates tags on a managed cluster snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update managed cluster snapshot Tags operation. + Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_03_02_preview.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedClusterSnapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedClusterSnapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterSnapshot] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") request = build_update_tags_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_tags.metadata['url'], + content=_content, + template_url=self.update_tags.metadata["url"], headers=_headers, params=_params, ) @@ -641,64 +744,57 @@ def update_tags( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterSnapshot', pipeline_response) + deserialized = self._deserialize("ManagedClusterSnapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"} # type: ignore - + update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"} # type: ignore @distributed_trace def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: """Deletes a managed cluster snapshot. Deletes a managed cluster snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) @@ -706,10 +802,9 @@ def delete( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -719,5 +814,4 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"} # type: ignore - + delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/operations/_managed_clusters_operations.py index f721f78a7e50..9975c6a015c8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/operations/_managed_clusters_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,200 +27,189 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_get_os_options_request( - subscription_id: str, - location: str, - *, - resource_type: Optional[str] = None, - **kwargs: Any + location: str, subscription_id: str, *, resource_type: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "location": _SERIALIZER.url("location", location, 'str', min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "location": _SERIALIZER.url("location", location, "str", min_length=1), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if resource_type is not None: - _params['resource-type'] = _SERIALIZER.query("resource_type", resource_type, 'str') + _params["resource-type"] = _SERIALIZER.query("resource_type", resource_type, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters") + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters" + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_resource_group_request( - subscription_id: str, - resource_group_name: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_upgrade_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_access_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, role_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "roleName": _SERIALIZER.url("role_name", role_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "roleName": _SERIALIZER.url("role_name", role_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_admin_credentials_request( - subscription_id: str, resource_group_name: str, resource_name: str, + subscription_id: str, *, server_fqdn: Optional[str] = None, **kwargs: Any @@ -223,40 +217,46 @@ def build_list_cluster_admin_credentials_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if server_fqdn is not None: - _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + _params["server-fqdn"] = _SERIALIZER.query("server_fqdn", server_fqdn, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_user_credentials_request( - subscription_id: str, resource_group_name: str, resource_name: str, + subscription_id: str, *, server_fqdn: Optional[str] = None, format: Optional[Union[str, "_models.Format"]] = None, @@ -265,42 +265,48 @@ def build_list_cluster_user_credentials_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if server_fqdn is not None: - _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + _params["server-fqdn"] = _SERIALIZER.query("server_fqdn", server_fqdn, "str") if format is not None: - _params['format'] = _SERIALIZER.query("format", format, 'str') + _params["format"] = _SERIALIZER.query("format", format, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_monitoring_user_credentials_request( - subscription_id: str, resource_group_name: str, resource_name: str, + subscription_id: str, *, server_fqdn: Optional[str] = None, **kwargs: Any @@ -308,167 +314,170 @@ def build_list_cluster_monitoring_user_credentials_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if server_fqdn is not None: - _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + _params["server-fqdn"] = _SERIALIZER.query("server_fqdn", server_fqdn, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: + +def build_get_request(resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedCluster] = None, - content: Any = None, - **kwargs: Any + +def build_create_or_update_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_update_tags_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.TagsObject] = None, - content: Any = None, - **kwargs: Any + +def build_update_tags_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request_initial( - subscription_id: str, + +def build_delete_request( resource_group_name: str, resource_name: str, + subscription_id: str, *, ignore_pod_disruption_budget: Optional[bool] = None, **kwargs: Any @@ -476,393 +485,413 @@ def build_delete_request_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if ignore_pod_disruption_budget is not None: - _params['ignore-pod-disruption-budget'] = _SERIALIZER.query("ignore_pod_disruption_budget", ignore_pod_disruption_budget, 'bool') + _params["ignore-pod-disruption-budget"] = _SERIALIZER.query( + "ignore_pod_disruption_budget", ignore_pod_disruption_budget, "bool" + ) # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_reset_service_principal_profile_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedClusterServicePrincipalProfile] = None, - content: Any = None, - **kwargs: Any + +def build_reset_service_principal_profile_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_reset_aad_profile_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedClusterAADProfile] = None, - content: Any = None, - **kwargs: Any + +def build_reset_aad_profile_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_rotate_cluster_certificates_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + +def build_rotate_cluster_certificates_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_rotate_service_account_signing_keys_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + +def build_rotate_service_account_signing_keys_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateServiceAccountSigningKeys") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateServiceAccountSigningKeys", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_stop_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + +def build_stop_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_start_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + +def build_start_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_run_command_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.RunCommandRequest] = None, - content: Any = None, - **kwargs: Any + +def build_run_command_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_get_command_result_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - command_id: str, - **kwargs: Any + resource_group_name: str, resource_name: str, command_id: 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "commandId": _SERIALIZER.url("command_id", command_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "commandId": _SERIALIZER.url("command_id", command_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_list_outbound_network_dependencies_endpoints_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + class ManagedClustersOperations: # pylint: disable=too-many-public-methods """ @@ -883,46 +912,39 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def get_os_options( - self, - location: str, - resource_type: Optional[str] = None, - **kwargs: Any + self, location: str, resource_type: Optional[str] = None, **kwargs: Any ) -> _models.OSOptionProfile: """Gets supported OS options in the specified subscription. Gets supported OS options in the specified subscription. - :param location: The name of Azure region. + :param location: The name of Azure region. Required. :type location: str :param resource_type: The resource type for which the OS options needs to be returned. Default value is None. :type resource_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: OSOptionProfile, or the result of cls(response) + :return: OSOptionProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.OSOptionProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OSOptionProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OSOptionProfile] - request = build_get_os_options_request( - subscription_id=self._config.subscription_id, location=location, - api_version=api_version, + subscription_id=self._config.subscription_id, resource_type=resource_type, - template_url=self.get_os_options.metadata['url'], + api_version=api_version, + template_url=self.get_os_options.metadata["url"], headers=_headers, params=_params, ) @@ -930,59 +952,52 @@ def get_os_options( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('OSOptionProfile', pipeline_response) + deserialized = self._deserialize("OSOptionProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_os_options.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default"} # type: ignore - + get_os_options.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default"} # type: ignore @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.ManagedClusterListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.ManagedCluster"]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -990,14 +1005,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -1013,10 +1025,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1026,49 +1036,42 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> Iterable[_models.ManagedClusterListResult]: + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.ManagedCluster"]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -1076,15 +1079,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -1100,10 +1099,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1113,50 +1110,43 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.ManagedClusterUpgradeProfile: """Gets the upgrade profile of a managed cluster. Gets the upgrade profile of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterUpgradeProfile, or the result of cls(response) + :return: ManagedClusterUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedClusterUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -1164,33 +1154,27 @@ def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterUpgradeProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore @distributed_trace def get_access_profile( - self, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, role_name: str, **kwargs: Any ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. @@ -1200,35 +1184,33 @@ def get_access_profile( `_ . :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param role_name: The name of the role for managed cluster accessProfile resource. + :param role_name: The name of the role for managed cluster accessProfile resource. Required. :type role_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterAccessProfile, or the result of cls(response) + :return: ManagedClusterAccessProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedClusterAccessProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterAccessProfile] - request = build_get_access_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, role_name=role_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_access_profile.metadata['url'], + template_url=self.get_access_profile.metadata["url"], headers=_headers, params=_params, ) @@ -1236,68 +1218,60 @@ def get_access_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterAccessProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterAccessProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_access_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore - + get_access_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore @distributed_trace def list_cluster_admin_credentials( - self, - resource_group_name: str, - resource_name: str, - server_fqdn: Optional[str] = None, - **kwargs: Any + self, resource_group_name: str, resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any ) -> _models.CredentialResults: """Lists the admin credentials of a managed cluster. Lists the admin credentials of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_admin_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, - template_url=self.list_cluster_admin_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_admin_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -1305,25 +1279,23 @@ def list_cluster_admin_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_admin_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore - + list_cluster_admin_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore @distributed_trace def list_cluster_user_credentials( @@ -1339,40 +1311,39 @@ def list_cluster_user_credentials( Lists the user credentials of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :param format: Only apply to AAD clusters, specifies the format of returned kubeconfig. Format 'azure' will return azure auth-provider kubeconfig; format 'exec' will return exec format - kubeconfig, which requires kubelogin binary in the path. Default value is None. + kubeconfig, which requires kubelogin binary in the path. Known values are: "azure" and "exec". + Default value is None. :type format: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.Format :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, format=format, - template_url=self.list_cluster_user_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -1380,68 +1351,60 @@ def list_cluster_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore - + list_cluster_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore @distributed_trace def list_cluster_monitoring_user_credentials( - self, - resource_group_name: str, - resource_name: str, - server_fqdn: Optional[str] = None, - **kwargs: Any + self, resource_group_name: str, resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any ) -> _models.CredentialResults: """Lists the cluster monitoring user credentials of a managed cluster. Lists the cluster monitoring user credentials of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_monitoring_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, - template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_monitoring_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -1449,64 +1412,55 @@ def list_cluster_monitoring_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_monitoring_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore - + list_cluster_monitoring_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore @distributed_trace - def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.ManagedCluster: + def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.ManagedCluster: """Gets a managed cluster. Gets a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedCluster, or the result of cls(response) + :return: ManagedCluster or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedCluster - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -1514,55 +1468,54 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _create_or_update_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.ManagedCluster, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'ManagedCluster') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedCluster") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1570,10 +1523,9 @@ def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -1581,25 +1533,26 @@ def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - @distributed_trace + @overload def begin_create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedCluster, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. @@ -1607,11 +1560,15 @@ def begin_create_or_update( Creates or updates a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The managed cluster to create or update. + :param parameters: The managed cluster to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedCluster + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1624,90 +1581,157 @@ def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._create_or_update_initial( # type: ignore - resource_group_name=resource_group_name, - resource_name=resource_name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop('error_map', None) + @overload + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. - def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized + Creates or updates a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + @distributed_trace + def begin_create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - + Creates or updates a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster to create or update. Is either a model type or a IO + type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedCluster or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ManagedCluster", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _update_tags_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.TagsObject, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request_initial( - subscription_id=self._config.subscription_id, + request = build_update_tags_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_tags_initial.metadata['url'], + content=_content, + template_url=self._update_tags_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1715,32 +1739,32 @@ def _update_tags_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_tags_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + _update_tags_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - - @distributed_trace + @overload def begin_update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. @@ -1748,11 +1772,88 @@ def begin_update_tags( Updates tags on a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2022_03_02_preview.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates tags on a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates tags on a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_03_02_preview.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1765,20 +1866,17 @@ def begin_update_tags( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, @@ -1786,39 +1884,35 @@ def begin_update_tags( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements self, @@ -1827,25 +1921,22 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements ignore_pod_disruption_budget: Optional[bool] = None, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, ignore_pod_disruption_budget=ignore_pod_disruption_budget, - template_url=self._delete_initial.metadata['url'], + api_version=api_version, + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1853,10 +1944,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1866,11 +1956,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements + def begin_delete( self, resource_group_name: str, resource_name: str, @@ -1882,8 +1971,9 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Deletes a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param ignore_pod_disruption_budget: ignore-pod-disruption-budget=true to delete those pods on a node without considering Pod Disruption Budget. Default value is None. @@ -1898,86 +1988,84 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, ignore_pod_disruption_budget=ignore_pod_disruption_budget, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterServicePrincipalProfile, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterServicePrincipalProfile") - request = build_reset_service_principal_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_service_principal_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_service_principal_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_service_principal_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1985,10 +2073,9 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1998,15 +2085,89 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re if cls: return cls(pipeline_response, None, {}) - _reset_service_principal_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + _reset_service_principal_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + + @overload + def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.ManagedClusterServicePrincipalProfile, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reset the Service Principal Profile of a managed cluster. + + This action cannot be performed on a cluster that is not using a service principal. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The service principal profile to set on the managed cluster. Required. + :type parameters: + ~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedClusterServicePrincipalProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reset the Service Principal Profile of a managed cluster. + + This action cannot be performed on a cluster that is not using a service principal. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The service principal profile to set on the managed cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace - def begin_reset_service_principal_profile( # pylint: disable=inconsistent-return-statements + def begin_reset_service_principal_profile( self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterServicePrincipalProfile, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], **kwargs: Any ) -> LROPoller[None]: """Reset the Service Principal Profile of a managed cluster. @@ -2014,12 +2175,18 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur This action cannot be performed on a cluster that is not using a service principal. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The service principal profile to set on the managed cluster. + :param parameters: The service principal profile to set on the managed cluster. Is either a + model type or a IO type. Required. :type parameters: ~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedClusterServicePrincipalProfile + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -2030,20 +2197,17 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -2051,67 +2215,68 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_service_principal_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + begin_reset_service_principal_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterAADProfile, + parameters: Union[_models.ManagedClusterAADProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterAADProfile") - request = build_reset_aad_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_aad_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_aad_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_aad_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2119,10 +2284,9 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -2132,15 +2296,16 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement if cls: return cls(pipeline_response, None, {}) - _reset_aad_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - + _reset_aad_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - @distributed_trace - def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements + @overload + def begin_reset_aad_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterAADProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: """Reset the AAD Profile of a managed cluster. @@ -2148,12 +2313,90 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements Reset the AAD Profile of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The AAD profile to set on the Managed Cluster. + :param parameters: The AAD profile to set on the Managed Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedClusterAADProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reset the AAD Profile of a managed cluster. + + Reset the AAD Profile of a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The AAD profile to set on the Managed Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterAADProfile, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Reset the AAD Profile of a managed cluster. + + Reset the AAD Profile of a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The AAD profile to set on the Managed Cluster. Is either a model type or a + IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedClusterAADProfile or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -2164,20 +2407,17 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -2185,62 +2425,52 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_aad_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + begin_reset_aad_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_rotate_cluster_certificates_request_initial( - subscription_id=self._config.subscription_id, + request = build_rotate_cluster_certificates_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._rotate_cluster_certificates_initial.metadata['url'], + template_url=self._rotate_cluster_certificates_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2248,10 +2478,9 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -2261,15 +2490,11 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return if cls: return cls(pipeline_response, None, {}) - _rotate_cluster_certificates_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore - + _rotate_cluster_certificates_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore @distributed_trace - def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + def begin_rotate_cluster_certificates( + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> LROPoller[None]: """Rotates the certificates of a managed cluster. @@ -2277,8 +2502,9 @@ def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-st more details about rotating managed cluster certificates. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -2290,80 +2516,67 @@ def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-st Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._rotate_cluster_certificates_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_rotate_cluster_certificates.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore + begin_rotate_cluster_certificates.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore def _rotate_service_account_signing_keys_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_rotate_service_account_signing_keys_request_initial( - subscription_id=self._config.subscription_id, + request = build_rotate_service_account_signing_keys_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._rotate_service_account_signing_keys_initial.metadata['url'], + template_url=self._rotate_service_account_signing_keys_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2371,10 +2584,9 @@ def _rotate_service_account_signing_keys_initial( # pylint: disable=inconsisten request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -2384,23 +2596,20 @@ def _rotate_service_account_signing_keys_initial( # pylint: disable=inconsisten if cls: return cls(pipeline_response, None, {}) - _rotate_service_account_signing_keys_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateServiceAccountSigningKeys"} # type: ignore - + _rotate_service_account_signing_keys_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateServiceAccountSigningKeys"} # type: ignore @distributed_trace - def begin_rotate_service_account_signing_keys( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + def begin_rotate_service_account_signing_keys( + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> LROPoller[None]: """Rotates the service account signing keys of a managed cluster. Rotates the service account signing keys of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -2412,80 +2621,67 @@ def begin_rotate_service_account_signing_keys( # pylint: disable=inconsistent-r Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._rotate_service_account_signing_keys_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_rotate_service_account_signing_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateServiceAccountSigningKeys"} # type: ignore + begin_rotate_service_account_signing_keys.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateServiceAccountSigningKeys"} # type: ignore def _stop_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_stop_request_initial( - subscription_id=self._config.subscription_id, + request = build_stop_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._stop_initial.metadata['url'], + template_url=self._stop_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2493,10 +2689,9 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -2506,16 +2701,10 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore - + _stop_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore @distributed_trace - def begin_stop( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> LROPoller[None]: + def begin_stop(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> LROPoller[None]: """Stops a Managed Cluster. This can only be performed on Azure Virtual Machine Scale set backed clusters. Stopping a @@ -2525,8 +2714,9 @@ def begin_stop( # pylint: disable=inconsistent-return-statements cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -2538,80 +2728,67 @@ def begin_stop( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._stop_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore + begin_stop.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore def _start_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_start_request_initial( - subscription_id=self._config.subscription_id, + request = build_start_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._start_initial.metadata['url'], + template_url=self._start_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2619,10 +2796,9 @@ def _start_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -2632,24 +2808,19 @@ def _start_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore - + _start_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore @distributed_trace - def begin_start( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> LROPoller[None]: + def begin_start(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> LROPoller[None]: """Starts a previously stopped Managed Cluster. See `starting a cluster `_ for more details about starting a cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -2661,85 +2832,83 @@ def begin_start( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._start_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore + begin_start.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore def _run_command_initial( self, resource_group_name: str, resource_name: str, - request_payload: _models.RunCommandRequest, + request_payload: Union[_models.RunCommandRequest, IO], **kwargs: Any ) -> Optional[_models.RunCommandResult]: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RunCommandResult]] - _json = self._serialize.body(request_payload, 'RunCommandRequest') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(request_payload, (IO, bytes)): + _content = request_payload + else: + _json = self._serialize.body(request_payload, "RunCommandRequest") - request = build_run_command_request_initial( - subscription_id=self._config.subscription_id, + request = build_run_command_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._run_command_initial.metadata['url'], + content=_content, + template_url=self._run_command_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2747,10 +2916,9 @@ def _run_command_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -2759,22 +2927,23 @@ def _run_command_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _run_command_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore - + _run_command_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore - @distributed_trace + @overload def begin_run_command( self, resource_group_name: str, resource_name: str, request_payload: _models.RunCommandRequest, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.RunCommandResult]: """Submits a command to run against the Managed Cluster. @@ -2784,12 +2953,97 @@ def begin_run_command( `_. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param request_payload: The run command request. + :param request_payload: The run command request. Required. :type request_payload: ~azure.mgmt.containerservice.v2022_03_02_preview.models.RunCommandRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either RunCommandResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_03_02_preview.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_run_command( + self, + resource_group_name: str, + resource_name: str, + request_payload: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RunCommandResult]: + """Submits a command to run against the Managed Cluster. + + AKS will create a pod to run the command. This is primarily useful for private clusters. For + more information see `AKS Run Command + `_. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param request_payload: The run command request. Required. + :type request_payload: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either RunCommandResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_03_02_preview.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_run_command( + self, + resource_group_name: str, + resource_name: str, + request_payload: Union[_models.RunCommandRequest, IO], + **kwargs: Any + ) -> LROPoller[_models.RunCommandResult]: + """Submits a command to run against the Managed Cluster. + + AKS will create a pod to run the command. This is primarily useful for private clusters. For + more information see `AKS Run Command + `_. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param request_payload: The run command request. Is either a model type or a IO type. Required. + :type request_payload: + ~azure.mgmt.containerservice.v2022_03_02_preview.models.RunCommandRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -2802,20 +3056,17 @@ def begin_run_command( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_03_02_preview.models.RunCommandResult] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.RunCommandResult] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.RunCommandResult] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._run_command_initial( # type: ignore resource_group_name=resource_group_name, @@ -2823,82 +3074,72 @@ def begin_run_command( request_payload=request_payload, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_run_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore + begin_run_command.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore @distributed_trace def get_command_result( - self, - resource_group_name: str, - resource_name: str, - command_id: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, command_id: str, **kwargs: Any ) -> Optional[_models.RunCommandResult]: """Gets the results of a command which has been run on the Managed Cluster. Gets the results of a command which has been run on the Managed Cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param command_id: Id of the command. + :param command_id: Id of the command. Required. :type command_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: RunCommandResult, or the result of cls(response) + :return: RunCommandResult or None or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.RunCommandResult or None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RunCommandResult]] - request = build_get_command_result_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, command_id=command_id, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_command_result.metadata['url'], + template_url=self.get_command_result.metadata["url"], headers=_headers, params=_params, ) @@ -2906,10 +3147,9 @@ def get_command_result( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -2918,23 +3158,19 @@ def get_command_result( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_command_result.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}"} # type: ignore - + get_command_result.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}"} # type: ignore @distributed_trace def list_outbound_network_dependencies_endpoints( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> Iterable[_models.OutboundEnvironmentEndpointCollection]: + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> Iterable["_models.OutboundEnvironmentEndpoint"]: """Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster. @@ -2942,35 +3178,35 @@ def list_outbound_network_dependencies_endpoints( specified managed cluster. The operation returns properties of each egress endpoint. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OutboundEnvironmentEndpointCollection or the - result of cls(response) + :return: An iterator like instance of either OutboundEnvironmentEndpoint or the result of + cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_03_02_preview.models.OutboundEnvironmentEndpointCollection] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_03_02_preview.models.OutboundEnvironmentEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_outbound_network_dependencies_endpoints_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_outbound_network_dependencies_endpoints.metadata['url'], + template_url=self.list_outbound_network_dependencies_endpoints.metadata["url"], headers=_headers, params=_params, ) @@ -2978,16 +3214,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_outbound_network_dependencies_endpoints_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -3003,10 +3234,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -3016,8 +3245,6 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_outbound_network_dependencies_endpoints.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints"} # type: ignore + list_outbound_network_dependencies_endpoints.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/operations/_operations.py index 56b23d784276..19fda0f7ef74 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/operations/_operations.py @@ -7,10 +7,15 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,38 +25,34 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - **kwargs: Any -) -> HttpRequest: + +def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.ContainerService/operations") # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class Operations: """ @@ -72,38 +73,33 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.OperationListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.OperationValue"]: """Gets a list of operations. Gets a list of operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationListResult or the result of cls(response) + :return: An iterator like instance of either OperationValue or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_03_02_preview.models.OperationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_03_02_preview.models.OperationValue] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -111,13 +107,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -133,10 +127,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -146,8 +138,6 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.ContainerService/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ContainerService/operations"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/operations/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/operations/_private_endpoint_connections_operations.py index de8d0937ecab..4c0074e2e12e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/operations/_private_endpoint_connections_operations.py @@ -6,11 +6,15 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod @@ -21,173 +25,199 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - subscription_id: str, resource_group_name: str, resource_name: str, private_endpoint_connection_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_update_request( - subscription_id: str, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, - *, - json: Optional[_models.PrivateEndpointConnection] = None, - content: Any = None, + subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request_initial( - subscription_id: str, +def build_delete_request( resource_group_name: str, resource_name: str, private_endpoint_connection_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class PrivateEndpointConnectionsOperations: """ @@ -208,13 +238,9 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnectionListResult: """Gets a list of private endpoint connections in the specified managed cluster. @@ -222,33 +248,31 @@ def list( https://docs.microsoft.com/azure/aks/private-clusters. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnectionListResult, or the result of cls(response) + :return: PrivateEndpointConnectionListResult or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.PrivateEndpointConnectionListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnectionListResult] - request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -256,33 +280,27 @@ def list( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore - + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore @distributed_trace def get( - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnection: """Gets the specified private endpoint connection. @@ -290,35 +308,33 @@ def get( https://docs.microsoft.com/azure/aks/private-clusters. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -326,33 +342,33 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - @distributed_trace + @overload def update( self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, parameters: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateEndpointConnection: """Updates a private endpoint connection. @@ -360,42 +376,117 @@ def update( Updates a private endpoint connection. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str - :param parameters: The updated private endpoint connection. + :param parameters: The updated private endpoint connection. Required. :type parameters: ~azure.mgmt.containerservice.v2022_03_02_preview.models.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: The updated private endpoint connection. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: Union[_models.PrivateEndpointConnection, IO], + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: The updated private endpoint connection. Is either a model type or a IO + type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2022_03_02_preview.models.PrivateEndpointConnection or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - _json = self._serialize.body(parameters, 'PrivateEndpointConnection') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateEndpointConnection") request = build_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update.metadata['url'], + content=_content, + template_url=self.update.metadata["url"], headers=_headers, params=_params, ) @@ -403,52 +494,43 @@ def update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -456,10 +538,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -469,26 +550,22 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + def begin_delete( + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> LROPoller[None]: """Deletes a private endpoint connection. Deletes a private endpoint connection. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -500,53 +577,46 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/operations/_private_link_resources_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/operations/_private_link_resources_operations.py index 9543c00a361a..249fad06ff6b 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/operations/_private_link_resources_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/operations/_private_link_resources_operations.py @@ -8,9 +8,13 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -19,48 +23,55 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class PrivateLinkResourcesOperations: """ @@ -81,13 +92,9 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.PrivateLinkResourcesListResult: """Gets a list of private link resources in the specified managed cluster. @@ -95,32 +102,30 @@ def list( https://docs.microsoft.com/azure/aks/private-clusters. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResourcesListResult, or the result of cls(response) + :return: PrivateLinkResourcesListResult or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.PrivateLinkResourcesListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResourcesListResult] - request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -128,22 +133,20 @@ def list( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResourcesListResult', pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources"} # type: ignore - + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/operations/_resolve_private_link_service_id_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/operations/_resolve_private_link_service_id_operations.py index 17f4a0fbf4f4..bbb711a97711 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/operations/_resolve_private_link_service_id_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/operations/_resolve_private_link_service_id_operations.py @@ -6,11 +6,15 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -19,56 +23,58 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_post_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.PrivateLinkResource] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + class ResolvePrivateLinkServiceIdOperations: """ @@ -89,13 +95,72 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @overload + def post( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.PrivateLinkResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID for the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters required in order to resolve a private link service ID. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_03_02_preview.models.PrivateLinkResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def post( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID for the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters required in order to resolve a private link service ID. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def post( self, resource_group_name: str, resource_name: str, - parameters: _models.PrivateLinkResource, + parameters: Union[_models.PrivateLinkResource, IO], **kwargs: Any ) -> _models.PrivateLinkResource: """Gets the private link service ID for the specified managed cluster. @@ -103,38 +168,49 @@ def post( Gets the private link service ID for the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters required in order to resolve a private link service ID. + :param parameters: Parameters required in order to resolve a private link service ID. Is either + a model type or a IO type. Required. :type parameters: ~azure.mgmt.containerservice.v2022_03_02_preview.models.PrivateLinkResource + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResource, or the result of cls(response) + :return: PrivateLinkResource or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.PrivateLinkResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResource] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResource] - _json = self._serialize.body(parameters, 'PrivateLinkResource') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateLinkResource") request = build_post_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.post.metadata['url'], + content=_content, + template_url=self.post.metadata["url"], headers=_headers, params=_params, ) @@ -142,22 +218,20 @@ def post( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResource', pipeline_response) + deserialized = self._deserialize("PrivateLinkResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - post.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId"} # type: ignore - + post.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/operations/_snapshots_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/operations/_snapshots_operations.py index 80a4e0b21de8..ab83a7944759 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/operations/_snapshots_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/operations/_snapshots_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,243 +25,233 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots") path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_resource_group_request( - subscription_id: str, - resource_group_name: str, - **kwargs: Any -) -> HttpRequest: +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: + _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, resource_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.Snapshot] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_update_tags_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.TagsObject] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class SnapshotsOperations: """ @@ -277,39 +272,34 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.SnapshotListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.Snapshot"]: """Gets a list of snapshots in the specified subscription. Gets a list of snapshots in the specified subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SnapshotListResult or the result of cls(response) + :return: An iterator like instance of either Snapshot or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_03_02_preview.models.SnapshotListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_03_02_preview.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SnapshotListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -317,14 +307,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -340,10 +327,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -353,48 +338,42 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots"} # type: ignore @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> Iterable[_models.SnapshotListResult]: + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Snapshot"]: """Lists snapshots in the specified subscription and resource group. Lists snapshots in the specified subscription and resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SnapshotListResult or the result of cls(response) + :return: An iterator like instance of either Snapshot or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_03_02_preview.models.SnapshotListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_03_02_preview.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SnapshotListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -402,15 +381,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -426,10 +401,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -439,50 +412,41 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots"} # type: ignore @distributed_trace - def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.Snapshot: + def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.Snapshot: """Gets a snapshot. Gets a snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Snapshot, or the result of cls(response) + :return: Snapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.Snapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -490,32 +454,32 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - - @distributed_trace + @overload def create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.Snapshot, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.Snapshot: """Creates or updates a snapshot. @@ -523,38 +487,102 @@ def create_or_update( Creates or updates a snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The snapshot to create or update. + :param parameters: The snapshot to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_03_02_preview.models.Snapshot + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Snapshot, or the result of cls(response) + :return: Snapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.Snapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Snapshot: + """Creates or updates a snapshot. + + Creates or updates a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The snapshot to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.Snapshot, IO], **kwargs: Any + ) -> _models.Snapshot: + """Creates or updates a snapshot. + + Creates or updates a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The snapshot to create or update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.mgmt.containerservice.v2022_03_02_preview.models.Snapshot or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] - _json = self._serialize.body(parameters, 'Snapshot') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "Snapshot") request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) @@ -562,10 +590,9 @@ def create_or_update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -573,25 +600,26 @@ def create_or_update( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - - @distributed_trace + @overload def update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.Snapshot: """Updates tags on a snapshot. @@ -599,38 +627,102 @@ def update_tags( Updates tags on a snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update snapshot Tags operation. + :param parameters: Parameters supplied to the Update snapshot Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2022_03_02_preview.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Snapshot, or the result of cls(response) + :return: Snapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.Snapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + def update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Snapshot: + """Updates tags on a snapshot. + + Updates tags on a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update snapshot Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> _models.Snapshot: + """Updates tags on a snapshot. + + Updates tags on a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update snapshot Tags operation. Is either a model + type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_03_02_preview.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") request = build_update_tags_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_tags.metadata['url'], + content=_content, + template_url=self.update_tags.metadata["url"], headers=_headers, params=_params, ) @@ -638,64 +730,57 @@ def update_tags( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - + update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore @distributed_trace def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: """Deletes a snapshot. Deletes a snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) @@ -703,10 +788,9 @@ def delete( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -716,5 +800,4 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - + delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/__init__.py index 37a5f9e02e6f..a8716d29afe8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/__init__.py @@ -14,7 +14,8 @@ except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['ContainerServiceClient'] + +__all__ = ["ContainerServiceClient"] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/_configuration.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/_configuration.py index 74ba0a3c7852..a58b14117304 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/_configuration.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/_configuration.py @@ -18,29 +18,25 @@ VERSION = "unknown" + class ContainerServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ContainerServiceClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :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. + :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2022-04-01". 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: + def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ContainerServiceClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + api_version = kwargs.pop("api_version", "2022-04-01") # type: str if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -50,23 +46,24 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-containerservice/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-containerservice/{}".format(VERSION)) self._configure(**kwargs) def _configure( - self, - **kwargs # type: Any + self, **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/_container_service_client.py index 708db451f51c..876df6bd3cd5 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/_container_service_client.py @@ -9,20 +9,29 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from . import models +from .._serialization import Deserializer, Serializer from ._configuration import ContainerServiceClientConfiguration -from .operations import AgentPoolsOperations, MaintenanceConfigurationsOperations, ManagedClustersOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, ResolvePrivateLinkServiceIdOperations, SnapshotsOperations +from .operations import ( + AgentPoolsOperations, + MaintenanceConfigurationsOperations, + ManagedClustersOperations, + Operations, + PrivateEndpointConnectionsOperations, + PrivateLinkResourcesOperations, + ResolvePrivateLinkServiceIdOperations, + SnapshotsOperations, +) if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class ContainerServiceClient: # pylint: disable=too-many-instance-attributes + +class ContainerServiceClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """The Container Service Client. :ivar operations: Operations operations @@ -46,9 +55,9 @@ class ContainerServiceClient: # pylint: disable=too-many-instance-attributes azure.mgmt.containerservice.v2022_04_01.operations.ResolvePrivateLinkServiceIdOperations :ivar snapshots: SnapshotsOperations operations :vartype snapshots: azure.mgmt.containerservice.v2022_04_01.operations.SnapshotsOperations - :param credential: Credential needed for the client to connect to Azure. + :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. + :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -66,25 +75,23 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = ContainerServiceClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = ContainerServiceClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize - ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.managed_clusters = ManagedClustersOperations( self._client, self._config, self._serialize, self._deserialize ) self.maintenance_configurations = MaintenanceConfigurationsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.agent_pools = AgentPoolsOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) self.private_endpoint_connections = PrivateEndpointConnectionsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -94,16 +101,9 @@ def __init__( self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations( self._client, self._config, self._serialize, self._deserialize ) - self.snapshots = SnapshotsOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.snapshots = SnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) - - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> HttpResponse: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -112,7 +112,7 @@ def _send_request( >>> response = client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/_metadata.json b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/_metadata.json index f1006c297455..a0d10ca79765 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/_metadata.json +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/_metadata.json @@ -10,20 +10,20 @@ "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { "credential": { - "signature": "credential, # type: \"TokenCredential\"", - "description": "Credential needed for the client to connect to Azure.", + "signature": "credential: \"TokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true }, "subscription_id": { - "signature": "subscription_id, # type: str", - "description": "The ID of the target subscription.", + "signature": "subscription_id: str,", + "description": "The ID of the target subscription. Required.", "docstring_type": "str", "required": true } @@ -31,13 +31,13 @@ "async": { "credential": { "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure.", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { "signature": "subscription_id: str,", - "description": "The ID of the target subscription.", + "description": "The ID of the target subscription. Required.", "docstring_type": "str", "required": true } @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=\"https://management.azure.com\", # type: str", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/_patch.py index 74e48ecd07cf..f99e77fef986 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/_patch.py @@ -28,4 +28,4 @@ # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + pass diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/_vendor.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/_vendor.py index 138f663c53a4..9aad73fc743e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/_vendor.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/_vendor.py @@ -7,6 +7,7 @@ from azure.core.pipeline.transport import HttpRequest + def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) @@ -14,6 +15,7 @@ def _convert_request(request, files=None): request.set_formdata_body(files) return request + def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -21,7 +23,5 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [ - c for c in formatted_components if "{}".format(key.args[0]) not in c - ] + components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/__init__.py index 37a5f9e02e6f..a8716d29afe8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/__init__.py @@ -14,7 +14,8 @@ except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['ContainerServiceClient'] + +__all__ = ["ContainerServiceClient"] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/_configuration.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/_configuration.py index e32848ce0144..f42ad5e8b3d4 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/_configuration.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/_configuration.py @@ -18,29 +18,25 @@ VERSION = "unknown" + class ContainerServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ContainerServiceClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :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. + :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2022-04-01". 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: + def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ContainerServiceClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + api_version = kwargs.pop("api_version", "2022-04-01") # type: str if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -50,22 +46,21 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-containerservice/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-containerservice/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, - **kwargs: Any - ) -> None: - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/_container_service_client.py index fe89be0e1a77..b0beda10bf3a 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/_container_service_client.py @@ -9,20 +9,29 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from .. import models +from ..._serialization import Deserializer, Serializer from ._configuration import ContainerServiceClientConfiguration -from .operations import AgentPoolsOperations, MaintenanceConfigurationsOperations, ManagedClustersOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, ResolvePrivateLinkServiceIdOperations, SnapshotsOperations +from .operations import ( + AgentPoolsOperations, + MaintenanceConfigurationsOperations, + ManagedClustersOperations, + Operations, + PrivateEndpointConnectionsOperations, + PrivateLinkResourcesOperations, + ResolvePrivateLinkServiceIdOperations, + SnapshotsOperations, +) if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class ContainerServiceClient: # pylint: disable=too-many-instance-attributes + +class ContainerServiceClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """The Container Service Client. :ivar operations: Operations operations @@ -47,9 +56,9 @@ class ContainerServiceClient: # pylint: disable=too-many-instance-attributes azure.mgmt.containerservice.v2022_04_01.aio.operations.ResolvePrivateLinkServiceIdOperations :ivar snapshots: SnapshotsOperations operations :vartype snapshots: azure.mgmt.containerservice.v2022_04_01.aio.operations.SnapshotsOperations - :param credential: Credential needed for the client to connect to Azure. + :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. + :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -67,25 +76,23 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = ContainerServiceClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = ContainerServiceClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize - ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.managed_clusters = ManagedClustersOperations( self._client, self._config, self._serialize, self._deserialize ) self.maintenance_configurations = MaintenanceConfigurationsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.agent_pools = AgentPoolsOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) self.private_endpoint_connections = PrivateEndpointConnectionsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -95,16 +102,9 @@ def __init__( self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations( self._client, self._config, self._serialize, self._deserialize ) - self.snapshots = SnapshotsOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.snapshots = SnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) - - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -113,7 +113,7 @@ def _send_request( >>> response = await client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/_patch.py index 74e48ecd07cf..f99e77fef986 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/_patch.py @@ -28,4 +28,4 @@ # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + pass diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/operations/__init__.py index e0748876288c..593b23075ce0 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/operations/__init__.py @@ -18,15 +18,16 @@ from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'Operations', - 'ManagedClustersOperations', - 'MaintenanceConfigurationsOperations', - 'AgentPoolsOperations', - 'PrivateEndpointConnectionsOperations', - 'PrivateLinkResourcesOperations', - 'ResolvePrivateLinkServiceIdOperations', - 'SnapshotsOperations', + "Operations", + "ManagedClustersOperations", + "MaintenanceConfigurationsOperations", + "AgentPoolsOperations", + "PrivateEndpointConnectionsOperations", + "PrivateLinkResourcesOperations", + "ResolvePrivateLinkServiceIdOperations", + "SnapshotsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/operations/_agent_pools_operations.py index 5c3c12421952..717370867d1a 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/operations/_agent_pools_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +29,20 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._agent_pools_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_available_agent_pool_versions_request, build_get_request, build_get_upgrade_profile_request, build_list_request, build_upgrade_node_image_version_request_initial -T = TypeVar('T') +from ...operations._agent_pools_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_available_agent_pool_versions_request, + build_get_request, + build_get_upgrade_profile_request, + build_list_request, + build_upgrade_node_image_version_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class AgentPoolsOperations: """ .. warning:: @@ -45,47 +62,41 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.AgentPoolListResult]: + def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncIterable["_models.AgentPool"]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AgentPoolListResult or the result of cls(response) + :return: An iterator like instance of either AgentPool or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_04_01.models.AgentPoolListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_04_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -93,16 +104,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -118,10 +124,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -131,54 +135,46 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore @distributed_trace_async async def get( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPool: """Gets the specified managed cluster agent pool. Gets the specified managed cluster agent pool. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPool, or the result of cls(response) + :return: AgentPool or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.AgentPool - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -186,57 +182,60 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore async def _create_or_update_initial( self, resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: _models.AgentPool, + parameters: Union[_models.AgentPool, IO], **kwargs: Any ) -> _models.AgentPool: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - _json = self._serialize.body(parameters, 'AgentPool') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "AgentPool") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -244,10 +243,9 @@ async def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -255,26 +253,27 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - - @distributed_trace_async + @overload async def begin_create_or_update( self, resource_group_name: str, resource_name: str, agent_pool_name: str, parameters: _models.AgentPool, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.AgentPool]: """Creates or updates an agent pool in the specified managed cluster. @@ -282,13 +281,59 @@ async def begin_create_or_update( Creates or updates an agent pool in the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str - :param parameters: The agent pool to create or update. + :param parameters: The agent pool to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_04_01.models.AgentPool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AgentPool or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_04_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AgentPool]: + """Creates or updates an agent pool in the specified managed cluster. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: The agent pool to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -301,20 +346,58 @@ async def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_04_01.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: Union[_models.AgentPool, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.AgentPool]: + """Creates or updates an agent pool in the specified managed cluster. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: The agent pool to create or update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.mgmt.containerservice.v2022_04_01.models.AgentPool or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AgentPool or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_04_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -323,66 +406,55 @@ async def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -390,10 +462,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -403,26 +474,22 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + async def begin_delete( + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes an agent pool in the specified managed cluster. Deletes an agent pool in the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -434,99 +501,86 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace_async async def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPoolUpgradeProfile: """Gets the upgrade profile for an agent pool. Gets the upgrade profile for an agent pool. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolUpgradeProfile, or the result of cls(response) + :return: AgentPoolUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.AgentPoolUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -534,32 +588,27 @@ async def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolUpgradeProfile', pipeline_response) + deserialized = self._deserialize("AgentPoolUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore @distributed_trace_async async def get_available_agent_pool_versions( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported Kubernetes versions for the specified agent pool. @@ -568,32 +617,30 @@ async def get_available_agent_pool_versions( the version lifecycle. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolAvailableVersions, or the result of cls(response) + :return: AgentPoolAvailableVersions or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.AgentPoolAvailableVersions - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolAvailableVersions] - request = build_get_available_agent_pool_versions_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_available_agent_pool_versions.metadata['url'], + template_url=self.get_available_agent_pool_versions.metadata["url"], headers=_headers, params=_params, ) @@ -601,52 +648,43 @@ async def get_available_agent_pool_versions( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolAvailableVersions', pipeline_response) + deserialized = self._deserialize("AgentPoolAvailableVersions", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_available_agent_pool_versions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore - + get_available_agent_pool_versions.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore async def _upgrade_node_image_version_initial( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> Optional[_models.AgentPool]: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.AgentPool]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.AgentPool]] - - request = build_upgrade_node_image_version_request_initial( - subscription_id=self._config.subscription_id, + request = build_upgrade_node_image_version_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._upgrade_node_image_version_initial.metadata['url'], + template_url=self._upgrade_node_image_version_initial.metadata["url"], headers=_headers, params=_params, ) @@ -654,10 +692,9 @@ async def _upgrade_node_image_version_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -667,26 +704,23 @@ async def _upgrade_node_image_version_initial( deserialized = None response_headers = {} if response.status_code == 202: - response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) - - deserialized = self._deserialize('AgentPool', pipeline_response) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _upgrade_node_image_version_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore - + _upgrade_node_image_version_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore @distributed_trace_async async def begin_upgrade_node_image_version( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any - ) -> AsyncLROPoller[_models.AgentPool]: + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: """Upgrades the node image version of an agent pool to the latest. Upgrading the node image version of an agent pool applies the newest OS and runtime updates to @@ -694,10 +728,11 @@ async def begin_upgrade_node_image_version( node image versions, see: https://docs.microsoft.com/azure/aks/node-image-upgrade. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -711,59 +746,54 @@ async def begin_upgrade_node_image_version( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_04_01.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._upgrade_node_image_version_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) - - deserialized = self._deserialize('AgentPool', pipeline_response) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_upgrade_node_image_version.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore + begin_upgrade_node_image_version.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/operations/_maintenance_configurations_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/operations/_maintenance_configurations_operations.py index 7e403ad8efc1..2ea4f6b232fb 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/operations/_maintenance_configurations_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/operations/_maintenance_configurations_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,10 +27,17 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._maintenance_configurations_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_managed_cluster_request -T = TypeVar('T') +from ...operations._maintenance_configurations_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_managed_cluster_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class MaintenanceConfigurationsOperations: """ .. warning:: @@ -43,48 +57,44 @@ def __init__(self, *args, **kwargs) -> None: 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_managed_cluster( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.MaintenanceConfigurationListResult]: + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> AsyncIterable["_models.MaintenanceConfiguration"]: """Gets a list of maintenance configurations in the specified managed cluster. Gets a list of maintenance configurations in the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either MaintenanceConfigurationListResult or the result - of cls(response) + :return: An iterator like instance of either MaintenanceConfiguration or the result of + cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_04_01.models.MaintenanceConfigurationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_04_01.models.MaintenanceConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfigurationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfigurationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_managed_cluster_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_managed_cluster.metadata['url'], + template_url=self.list_by_managed_cluster.metadata["url"], headers=_headers, params=_params, ) @@ -92,16 +102,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_managed_cluster_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -117,10 +122,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -130,54 +133,46 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_managed_cluster.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations"} # type: ignore + list_by_managed_cluster.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations"} # type: ignore @distributed_trace_async async def get( - self, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, config_name: str, **kwargs: Any ) -> _models.MaintenanceConfiguration: """Gets the specified maintenance configuration of a managed cluster. Gets the specified maintenance configuration of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: MaintenanceConfiguration, or the result of cls(response) + :return: MaintenanceConfiguration or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.MaintenanceConfiguration - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfiguration] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -185,33 +180,33 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) + deserialized = self._deserialize("MaintenanceConfiguration", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - @distributed_trace_async + @overload async def create_or_update( self, resource_group_name: str, resource_name: str, config_name: str, parameters: _models.MaintenanceConfiguration, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.MaintenanceConfiguration: """Creates or updates a maintenance configuration in the specified managed cluster. @@ -219,41 +214,116 @@ async def create_or_update( Creates or updates a maintenance configuration in the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str - :param parameters: The maintenance configuration to create or update. + :param parameters: The maintenance configuration to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_04_01.models.MaintenanceConfiguration + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: MaintenanceConfiguration, or the result of cls(response) + :return: MaintenanceConfiguration or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.MaintenanceConfiguration - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configuration in the specified managed cluster. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: The maintenance configuration to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: Union[_models.MaintenanceConfiguration, IO], + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configuration in the specified managed cluster. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: The maintenance configuration to create or update. Is either a model type or + a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_04_01.models.MaintenanceConfiguration or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfiguration] - _json = self._serialize.body(parameters, 'MaintenanceConfiguration') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "MaintenanceConfiguration") request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) @@ -261,68 +331,60 @@ async def create_or_update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) + deserialized = self._deserialize("MaintenanceConfiguration", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, config_name: str, **kwargs: Any ) -> None: """Deletes a maintenance configuration. Deletes a maintenance configuration. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) @@ -330,10 +392,9 @@ async def delete( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -343,5 +404,4 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/operations/_managed_clusters_operations.py index 94d52ed0e94d..2294739b37f6 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/operations/_managed_clusters_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +29,33 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._managed_clusters_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_access_profile_request, build_get_command_result_request, build_get_os_options_request, build_get_request, build_get_upgrade_profile_request, build_list_by_resource_group_request, build_list_cluster_admin_credentials_request, build_list_cluster_monitoring_user_credentials_request, build_list_cluster_user_credentials_request, build_list_outbound_network_dependencies_endpoints_request, build_list_request, build_reset_aad_profile_request_initial, build_reset_service_principal_profile_request_initial, build_rotate_cluster_certificates_request_initial, build_run_command_request_initial, build_start_request_initial, build_stop_request_initial, build_update_tags_request_initial -T = TypeVar('T') +from ...operations._managed_clusters_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_access_profile_request, + build_get_command_result_request, + build_get_os_options_request, + build_get_request, + build_get_upgrade_profile_request, + build_list_by_resource_group_request, + build_list_cluster_admin_credentials_request, + build_list_cluster_monitoring_user_credentials_request, + build_list_cluster_user_credentials_request, + build_list_outbound_network_dependencies_endpoints_request, + build_list_request, + build_reset_aad_profile_request, + build_reset_service_principal_profile_request, + build_rotate_cluster_certificates_request, + build_run_command_request, + build_start_request, + build_stop_request, + build_update_tags_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class ManagedClustersOperations: # pylint: disable=too-many-public-methods """ .. warning:: @@ -45,46 +75,39 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async async def get_os_options( - self, - location: str, - resource_type: Optional[str] = None, - **kwargs: Any + self, location: str, resource_type: Optional[str] = None, **kwargs: Any ) -> _models.OSOptionProfile: """Gets supported OS options in the specified subscription. Gets supported OS options in the specified subscription. - :param location: The name of Azure region. + :param location: The name of Azure region. Required. :type location: str :param resource_type: The resource type for which the OS options needs to be returned. Default value is None. :type resource_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: OSOptionProfile, or the result of cls(response) + :return: OSOptionProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.OSOptionProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OSOptionProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OSOptionProfile] - request = build_get_os_options_request( - subscription_id=self._config.subscription_id, location=location, - api_version=api_version, + subscription_id=self._config.subscription_id, resource_type=resource_type, - template_url=self.get_os_options.metadata['url'], + api_version=api_version, + template_url=self.get_os_options.metadata["url"], headers=_headers, params=_params, ) @@ -92,59 +115,52 @@ async def get_os_options( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('OSOptionProfile', pipeline_response) + deserialized = self._deserialize("OSOptionProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_os_options.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default"} # type: ignore - + get_os_options.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default"} # type: ignore @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.ManagedClusterListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.ManagedCluster"]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_04_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_04_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -152,14 +168,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -175,10 +188,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -188,49 +199,44 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.ManagedClusterListResult]: + self, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ManagedCluster"]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_04_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_04_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -238,15 +244,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -262,10 +264,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -275,50 +275,43 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace_async async def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.ManagedClusterUpgradeProfile: """Gets the upgrade profile of a managed cluster. Gets the upgrade profile of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterUpgradeProfile, or the result of cls(response) + :return: ManagedClusterUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.ManagedClusterUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -326,33 +319,27 @@ async def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterUpgradeProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore @distributed_trace_async async def get_access_profile( - self, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, role_name: str, **kwargs: Any ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. @@ -362,35 +349,33 @@ async def get_access_profile( `_ . :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param role_name: The name of the role for managed cluster accessProfile resource. + :param role_name: The name of the role for managed cluster accessProfile resource. Required. :type role_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterAccessProfile, or the result of cls(response) + :return: ManagedClusterAccessProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.ManagedClusterAccessProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterAccessProfile] - request = build_get_access_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, role_name=role_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_access_profile.metadata['url'], + template_url=self.get_access_profile.metadata["url"], headers=_headers, params=_params, ) @@ -398,68 +383,60 @@ async def get_access_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterAccessProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterAccessProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_access_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore - + get_access_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore @distributed_trace_async async def list_cluster_admin_credentials( - self, - resource_group_name: str, - resource_name: str, - server_fqdn: Optional[str] = None, - **kwargs: Any + self, resource_group_name: str, resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any ) -> _models.CredentialResults: """Lists the admin credentials of a managed cluster. Lists the admin credentials of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_admin_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, - template_url=self.list_cluster_admin_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_admin_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -467,25 +444,23 @@ async def list_cluster_admin_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_admin_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore - + list_cluster_admin_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore @distributed_trace_async async def list_cluster_user_credentials( @@ -501,40 +476,39 @@ async def list_cluster_user_credentials( Lists the user credentials of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :param format: Only apply to AAD clusters, specifies the format of returned kubeconfig. Format 'azure' will return azure auth-provider kubeconfig; format 'exec' will return exec format - kubeconfig, which requires kubelogin binary in the path. Default value is None. + kubeconfig, which requires kubelogin binary in the path. Known values are: "azure" and "exec". + Default value is None. :type format: str or ~azure.mgmt.containerservice.v2022_04_01.models.Format :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, format=format, - template_url=self.list_cluster_user_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -542,68 +516,60 @@ async def list_cluster_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore - + list_cluster_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore @distributed_trace_async async def list_cluster_monitoring_user_credentials( - self, - resource_group_name: str, - resource_name: str, - server_fqdn: Optional[str] = None, - **kwargs: Any + self, resource_group_name: str, resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any ) -> _models.CredentialResults: """Lists the cluster monitoring user credentials of a managed cluster. Lists the cluster monitoring user credentials of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_monitoring_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, - template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_monitoring_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -611,64 +577,55 @@ async def list_cluster_monitoring_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_monitoring_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore - + list_cluster_monitoring_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore @distributed_trace_async - async def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.ManagedCluster: + async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.ManagedCluster: """Gets a managed cluster. Gets a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedCluster, or the result of cls(response) + :return: ManagedCluster or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.ManagedCluster - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -676,55 +633,54 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _create_or_update_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.ManagedCluster, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'ManagedCluster') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedCluster") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -732,10 +688,9 @@ async def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -743,25 +698,26 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - - @distributed_trace_async + @overload async def begin_create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedCluster, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. @@ -769,11 +725,15 @@ async def begin_create_or_update( Creates or updates a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The managed cluster to create or update. + :param parameters: The managed cluster to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_04_01.models.ManagedCluster + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -786,20 +746,90 @@ async def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_04_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_04_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster to create or update. Is either a model type or a IO + type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_04_01.models.ManagedCluster or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_04_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -807,69 +837,66 @@ async def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _update_tags_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.TagsObject, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request_initial( - subscription_id=self._config.subscription_id, + request = build_update_tags_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_tags_initial.metadata['url'], + content=_content, + template_url=self._update_tags_initial.metadata["url"], headers=_headers, params=_params, ) @@ -877,32 +904,32 @@ async def _update_tags_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_tags_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _update_tags_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - @distributed_trace_async + @overload async def begin_update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. @@ -910,11 +937,15 @@ async def begin_update_tags( Updates tags on a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2022_04_01.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -927,20 +958,90 @@ async def begin_update_tags( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_04_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates tags on a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_04_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates tags on a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_04_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_04_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, @@ -948,64 +1049,54 @@ async def begin_update_tags( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1013,10 +1104,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1026,23 +1116,18 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: + async def begin_delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Deletes a managed cluster. Deletes a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1054,85 +1139,83 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterServicePrincipalProfile, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterServicePrincipalProfile") - request = build_reset_service_principal_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_service_principal_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_service_principal_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_service_principal_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1140,10 +1223,9 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1153,15 +1235,16 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist if cls: return cls(pipeline_response, None, {}) - _reset_service_principal_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + _reset_service_principal_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore - - @distributed_trace_async - async def begin_reset_service_principal_profile( # pylint: disable=inconsistent-return-statements + @overload + async def begin_reset_service_principal_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterServicePrincipalProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: """Reset the Service Principal Profile of a managed cluster. @@ -1169,12 +1252,53 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent This action cannot be performed on a cluster that is not using a service principal. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The service principal profile to set on the managed cluster. + :param parameters: The service principal profile to set on the managed cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2022_04_01.models.ManagedClusterServicePrincipalProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset the Service Principal Profile of a managed cluster. + + This action cannot be performed on a cluster that is not using a service principal. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The service principal profile to set on the managed cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -1185,20 +1309,54 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset the Service Principal Profile of a managed cluster. + + This action cannot be performed on a cluster that is not using a service principal. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The service principal profile to set on the managed cluster. Is either a + model type or a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2022_04_01.models.ManagedClusterServicePrincipalProfile or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1206,67 +1364,68 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_service_principal_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + begin_reset_service_principal_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterAADProfile, + parameters: Union[_models.ManagedClusterAADProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterAADProfile") - request = build_reset_aad_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_aad_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_aad_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_aad_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1274,10 +1433,9 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1287,15 +1445,16 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta if cls: return cls(pipeline_response, None, {}) - _reset_aad_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - + _reset_aad_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - @distributed_trace_async - async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements + @overload + async def begin_reset_aad_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterAADProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: """Reset the AAD Profile of a managed cluster. @@ -1303,11 +1462,52 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem Reset the AAD Profile of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The AAD profile to set on the Managed Cluster. + :param parameters: The AAD profile to set on the Managed Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2022_04_01.models.ManagedClusterAADProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset the AAD Profile of a managed cluster. + + Reset the AAD Profile of a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The AAD profile to set on the Managed Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -1318,20 +1518,54 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterAADProfile, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset the AAD Profile of a managed cluster. + + Reset the AAD Profile of a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The AAD profile to set on the Managed Cluster. Is either a model type or a + IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_04_01.models.ManagedClusterAADProfile or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1339,62 +1573,52 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_aad_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + begin_reset_aad_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_rotate_cluster_certificates_request_initial( - subscription_id=self._config.subscription_id, + request = build_rotate_cluster_certificates_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._rotate_cluster_certificates_initial.metadata['url'], + template_url=self._rotate_cluster_certificates_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1402,10 +1626,9 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1415,15 +1638,11 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- if cls: return cls(pipeline_response, None, {}) - _rotate_cluster_certificates_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore - + _rotate_cluster_certificates_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore @distributed_trace_async - async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + async def begin_rotate_cluster_certificates( + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Rotates the certificates of a managed cluster. @@ -1431,8 +1650,9 @@ async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-ret more details about rotating managed cluster certificates. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1444,80 +1664,67 @@ async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-ret Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._rotate_cluster_certificates_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_rotate_cluster_certificates.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore + begin_rotate_cluster_certificates.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore async def _stop_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_stop_request_initial( - subscription_id=self._config.subscription_id, + request = build_stop_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._stop_initial.metadata['url'], + template_url=self._stop_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1525,10 +1732,9 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1538,16 +1744,10 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore - + _stop_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore @distributed_trace_async - async def begin_stop( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: + async def begin_stop(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Stops a Managed Cluster. This can only be performed on Azure Virtual Machine Scale set backed clusters. Stopping a @@ -1557,8 +1757,9 @@ async def begin_stop( # pylint: disable=inconsistent-return-statements cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1570,80 +1771,67 @@ async def begin_stop( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._stop_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore + begin_stop.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore async def _start_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_start_request_initial( - subscription_id=self._config.subscription_id, + request = build_start_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._start_initial.metadata['url'], + template_url=self._start_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1651,10 +1839,9 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1664,24 +1851,19 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore - + _start_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore @distributed_trace_async - async def begin_start( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: + async def begin_start(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Starts a previously stopped Managed Cluster. See `starting a cluster `_ for more details about starting a cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1693,85 +1875,83 @@ async def begin_start( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._start_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore + begin_start.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore async def _run_command_initial( self, resource_group_name: str, resource_name: str, - request_payload: _models.RunCommandRequest, + request_payload: Union[_models.RunCommandRequest, IO], **kwargs: Any ) -> Optional[_models.RunCommandResult]: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RunCommandResult]] - _json = self._serialize.body(request_payload, 'RunCommandRequest') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(request_payload, (IO, bytes)): + _content = request_payload + else: + _json = self._serialize.body(request_payload, "RunCommandRequest") - request = build_run_command_request_initial( - subscription_id=self._config.subscription_id, + request = build_run_command_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._run_command_initial.metadata['url'], + content=_content, + template_url=self._run_command_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1779,10 +1959,9 @@ async def _run_command_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1791,22 +1970,23 @@ async def _run_command_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _run_command_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore + _run_command_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore - - @distributed_trace_async + @overload async def begin_run_command( self, resource_group_name: str, resource_name: str, request_payload: _models.RunCommandRequest, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.RunCommandResult]: """Submits a command to run against the Managed Cluster. @@ -1816,11 +1996,15 @@ async def begin_run_command( `_. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param request_payload: The run command request. + :param request_payload: The run command request. Required. :type request_payload: ~azure.mgmt.containerservice.v2022_04_01.models.RunCommandRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -1833,20 +2017,97 @@ async def begin_run_command( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_04_01.models.RunCommandResult] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_run_command( + self, + resource_group_name: str, + resource_name: str, + request_payload: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.RunCommandResult]: + """Submits a command to run against the Managed Cluster. + + AKS will create a pod to run the command. This is primarily useful for private clusters. For + more information see `AKS Run Command + `_. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param request_payload: The run command request. Required. + :type request_payload: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RunCommandResult or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_04_01.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_run_command( + self, + resource_group_name: str, + resource_name: str, + request_payload: Union[_models.RunCommandRequest, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.RunCommandResult]: + """Submits a command to run against the Managed Cluster. + + AKS will create a pod to run the command. This is primarily useful for private clusters. For + more information see `AKS Run Command + `_. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param request_payload: The run command request. Is either a model type or a IO type. Required. + :type request_payload: ~azure.mgmt.containerservice.v2022_04_01.models.RunCommandRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RunCommandResult or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_04_01.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.RunCommandResult] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.RunCommandResult] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._run_command_initial( # type: ignore resource_group_name=resource_group_name, @@ -1854,82 +2115,72 @@ async def begin_run_command( request_payload=request_payload, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_run_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore + begin_run_command.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore @distributed_trace_async async def get_command_result( - self, - resource_group_name: str, - resource_name: str, - command_id: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, command_id: str, **kwargs: Any ) -> Optional[_models.RunCommandResult]: """Gets the results of a command which has been run on the Managed Cluster. Gets the results of a command which has been run on the Managed Cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param command_id: Id of the command. + :param command_id: Id of the command. Required. :type command_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: RunCommandResult, or the result of cls(response) + :return: RunCommandResult or None or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.RunCommandResult or None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RunCommandResult]] - request = build_get_command_result_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, command_id=command_id, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_command_result.metadata['url'], + template_url=self.get_command_result.metadata["url"], headers=_headers, params=_params, ) @@ -1937,10 +2188,9 @@ async def get_command_result( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1949,23 +2199,19 @@ async def get_command_result( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_command_result.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}"} # type: ignore - + get_command_result.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}"} # type: ignore @distributed_trace def list_outbound_network_dependencies_endpoints( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.OutboundEnvironmentEndpointCollection]: + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> AsyncIterable["_models.OutboundEnvironmentEndpoint"]: """Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster. @@ -1973,35 +2219,35 @@ def list_outbound_network_dependencies_endpoints( specified managed cluster. The operation returns properties of each egress endpoint. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OutboundEnvironmentEndpointCollection or the - result of cls(response) + :return: An iterator like instance of either OutboundEnvironmentEndpoint or the result of + cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_04_01.models.OutboundEnvironmentEndpointCollection] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_04_01.models.OutboundEnvironmentEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_outbound_network_dependencies_endpoints_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_outbound_network_dependencies_endpoints.metadata['url'], + template_url=self.list_outbound_network_dependencies_endpoints.metadata["url"], headers=_headers, params=_params, ) @@ -2009,16 +2255,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_outbound_network_dependencies_endpoints_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -2034,10 +2275,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2047,8 +2286,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_outbound_network_dependencies_endpoints.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints"} # type: ignore + list_outbound_network_dependencies_endpoints.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/operations/_operations.py index 15113a29edd9..1bd64ab3cf30 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/operations/_operations.py @@ -7,9 +7,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,9 +27,11 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._operations import build_list_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class Operations: """ .. warning:: @@ -42,38 +51,33 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.OperationListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.OperationValue"]: """Gets a list of operations. Gets a list of operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationListResult or the result of cls(response) + :return: An iterator like instance of either OperationValue or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_04_01.models.OperationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_04_01.models.OperationValue] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -81,13 +85,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -103,10 +105,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -116,8 +116,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.ContainerService/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ContainerService/operations"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/operations/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/operations/_private_endpoint_connections_operations.py index 2cbedb4fa0bb..709e444af8eb 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/operations/_private_endpoint_connections_operations.py @@ -6,9 +6,15 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -20,10 +26,17 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._private_endpoint_connections_operations import build_delete_request_initial, build_get_request, build_list_request, build_update_request -T = TypeVar('T') +from ...operations._private_endpoint_connections_operations import ( + build_delete_request, + build_get_request, + build_list_request, + build_update_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class PrivateEndpointConnectionsOperations: """ .. warning:: @@ -43,13 +56,9 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async async def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnectionListResult: """Gets a list of private endpoint connections in the specified managed cluster. @@ -57,32 +66,30 @@ async def list( https://docs.microsoft.com/azure/aks/private-clusters. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnectionListResult, or the result of cls(response) + :return: PrivateEndpointConnectionListResult or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.PrivateEndpointConnectionListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnectionListResult] - request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -90,33 +97,27 @@ async def list( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore - + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore @distributed_trace_async async def get( - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnection: """Gets the specified private endpoint connection. @@ -124,35 +125,33 @@ async def get( https://docs.microsoft.com/azure/aks/private-clusters. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -160,33 +159,33 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - - @distributed_trace_async + @overload async def update( self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, parameters: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateEndpointConnection: """Updates a private endpoint connection. @@ -194,41 +193,116 @@ async def update( Updates a private endpoint connection. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str - :param parameters: The updated private endpoint connection. + :param parameters: The updated private endpoint connection. Required. :type parameters: ~azure.mgmt.containerservice.v2022_04_01.models.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + async def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: The updated private endpoint connection. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: Union[_models.PrivateEndpointConnection, IO], + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: The updated private endpoint connection. Is either a model type or a IO + type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_04_01.models.PrivateEndpointConnection or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - _json = self._serialize.body(parameters, 'PrivateEndpointConnection') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateEndpointConnection") request = build_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update.metadata['url'], + content=_content, + template_url=self.update.metadata["url"], headers=_headers, params=_params, ) @@ -236,52 +310,43 @@ async def update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -289,10 +354,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -302,26 +366,22 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + async def begin_delete( + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes a private endpoint connection. Deletes a private endpoint connection. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -333,53 +393,46 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/operations/_private_link_resources_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/operations/_private_link_resources_operations.py index 7f5ccc87cd71..3e190605b8c2 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/operations/_private_link_resources_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/operations/_private_link_resources_operations.py @@ -8,7 +8,13 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -19,9 +25,11 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._private_link_resources_operations import build_list_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class PrivateLinkResourcesOperations: """ .. warning:: @@ -41,13 +49,9 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async async def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.PrivateLinkResourcesListResult: """Gets a list of private link resources in the specified managed cluster. @@ -55,32 +59,30 @@ async def list( https://docs.microsoft.com/azure/aks/private-clusters. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResourcesListResult, or the result of cls(response) + :return: PrivateLinkResourcesListResult or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.PrivateLinkResourcesListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResourcesListResult] - request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -88,22 +90,20 @@ async def list( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResourcesListResult', pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources"} # type: ignore - + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/operations/_resolve_private_link_service_id_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/operations/_resolve_private_link_service_id_operations.py index 29dacfbc6690..ab3a66818a3d 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/operations/_resolve_private_link_service_id_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/operations/_resolve_private_link_service_id_operations.py @@ -6,9 +6,15 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -19,9 +25,11 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._resolve_private_link_service_id_operations import build_post_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class ResolvePrivateLinkServiceIdOperations: """ .. warning:: @@ -41,13 +49,14 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async + @overload async def post( self, resource_group_name: str, resource_name: str, parameters: _models.PrivateLinkResource, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateLinkResource: """Gets the private link service ID for the specified managed cluster. @@ -55,38 +64,106 @@ async def post( Gets the private link service ID for the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters required in order to resolve a private link service ID. + :param parameters: Parameters required in order to resolve a private link service ID. Required. :type parameters: ~azure.mgmt.containerservice.v2022_04_01.models.PrivateLinkResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def post( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID for the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters required in order to resolve a private link service ID. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResource, or the result of cls(response) + :return: PrivateLinkResource or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.PrivateLinkResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @distributed_trace_async + async def post( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.PrivateLinkResource, IO], + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID for the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters required in order to resolve a private link service ID. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_04_01.models.PrivateLinkResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResource] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResource] - _json = self._serialize.body(parameters, 'PrivateLinkResource') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateLinkResource") request = build_post_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.post.metadata['url'], + content=_content, + template_url=self.post.metadata["url"], headers=_headers, params=_params, ) @@ -94,22 +171,20 @@ async def post( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResource', pipeline_response) + deserialized = self._deserialize("PrivateLinkResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - post.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId"} # type: ignore - + post.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/operations/_snapshots_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/operations/_snapshots_operations.py index 575798ae56e4..2598c3831991 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/operations/_snapshots_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/operations/_snapshots_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,10 +27,19 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._snapshots_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_resource_group_request, build_list_request, build_update_tags_request -T = TypeVar('T') +from ...operations._snapshots_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_resource_group_request, + build_list_request, + build_update_tags_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class SnapshotsOperations: """ .. warning:: @@ -43,39 +59,34 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.SnapshotListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.Snapshot"]: """Gets a list of snapshots in the specified subscription. Gets a list of snapshots in the specified subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SnapshotListResult or the result of cls(response) + :return: An iterator like instance of either Snapshot or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_04_01.models.SnapshotListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_04_01.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SnapshotListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -83,14 +94,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -106,10 +114,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -119,48 +125,42 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots"} # type: ignore @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.SnapshotListResult]: + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.Snapshot"]: """Lists snapshots in the specified subscription and resource group. Lists snapshots in the specified subscription and resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SnapshotListResult or the result of cls(response) + :return: An iterator like instance of either Snapshot or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_04_01.models.SnapshotListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_04_01.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SnapshotListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -168,15 +168,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -192,10 +188,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -205,50 +199,41 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots"} # type: ignore @distributed_trace_async - async def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.Snapshot: + async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.Snapshot: """Gets a snapshot. Gets a snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Snapshot, or the result of cls(response) + :return: Snapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.Snapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -256,32 +241,32 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - - @distributed_trace_async + @overload async def create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.Snapshot, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.Snapshot: """Creates or updates a snapshot. @@ -289,38 +274,102 @@ async def create_or_update( Creates or updates a snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The snapshot to create or update. + :param parameters: The snapshot to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_04_01.models.Snapshot + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Snapshot, or the result of cls(response) + :return: Snapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.Snapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Snapshot: + """Creates or updates a snapshot. + + Creates or updates a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The snapshot to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.Snapshot, IO], **kwargs: Any + ) -> _models.Snapshot: + """Creates or updates a snapshot. + + Creates or updates a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The snapshot to create or update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.mgmt.containerservice.v2022_04_01.models.Snapshot or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] - _json = self._serialize.body(parameters, 'Snapshot') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "Snapshot") request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) @@ -328,10 +377,9 @@ async def create_or_update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -339,25 +387,26 @@ async def create_or_update( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - @distributed_trace_async + @overload async def update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.Snapshot: """Updates tags on a snapshot. @@ -365,38 +414,102 @@ async def update_tags( Updates tags on a snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update snapshot Tags operation. + :param parameters: Parameters supplied to the Update snapshot Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2022_04_01.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Snapshot: + """Updates tags on a snapshot. + + Updates tags on a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update snapshot Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Snapshot, or the result of cls(response) + :return: Snapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.Snapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @distributed_trace_async + async def update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> _models.Snapshot: + """Updates tags on a snapshot. + + Updates tags on a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update snapshot Tags operation. Is either a model + type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_04_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") request = build_update_tags_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_tags.metadata['url'], + content=_content, + template_url=self.update_tags.metadata["url"], headers=_headers, params=_params, ) @@ -404,64 +517,57 @@ async def update_tags( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - + update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: """Deletes a snapshot. Deletes a snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) @@ -469,10 +575,9 @@ async def delete( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -482,5 +587,4 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - + delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/models/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/models/__init__.py index 4adc3fedca9d..fde113853328 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/models/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/models/__init__.py @@ -98,176 +98,174 @@ from ._models_py3 import UserAssignedIdentity from ._models_py3 import WindowsGmsaProfile - -from ._container_service_client_enums import ( - AgentPoolMode, - AgentPoolType, - Code, - ConnectionStatus, - ContainerServiceStorageProfileTypes, - ContainerServiceVMSizeTypes, - Count, - CreatedByType, - Expander, - ExtendedLocationTypes, - Format, - GPUInstanceProfile, - IpFamily, - KubeletDiskType, - LicenseType, - LoadBalancerSku, - ManagedClusterPodIdentityProvisioningState, - ManagedClusterSKUName, - ManagedClusterSKUTier, - NetworkMode, - NetworkPlugin, - NetworkPolicy, - OSDiskType, - OSSKU, - OSType, - OutboundType, - PrivateEndpointConnectionProvisioningState, - PublicNetworkAccess, - ResourceIdentityType, - ScaleDownMode, - ScaleSetEvictionPolicy, - ScaleSetPriority, - SnapshotType, - UpgradeChannel, - WeekDay, - WorkloadRuntime, -) +from ._container_service_client_enums import AgentPoolMode +from ._container_service_client_enums import AgentPoolType +from ._container_service_client_enums import Code +from ._container_service_client_enums import ConnectionStatus +from ._container_service_client_enums import ContainerServiceStorageProfileTypes +from ._container_service_client_enums import ContainerServiceVMSizeTypes +from ._container_service_client_enums import Count +from ._container_service_client_enums import CreatedByType +from ._container_service_client_enums import Expander +from ._container_service_client_enums import ExtendedLocationTypes +from ._container_service_client_enums import Format +from ._container_service_client_enums import GPUInstanceProfile +from ._container_service_client_enums import IpFamily +from ._container_service_client_enums import KubeletDiskType +from ._container_service_client_enums import LicenseType +from ._container_service_client_enums import LoadBalancerSku +from ._container_service_client_enums import ManagedClusterPodIdentityProvisioningState +from ._container_service_client_enums import ManagedClusterSKUName +from ._container_service_client_enums import ManagedClusterSKUTier +from ._container_service_client_enums import NetworkMode +from ._container_service_client_enums import NetworkPlugin +from ._container_service_client_enums import NetworkPolicy +from ._container_service_client_enums import OSDiskType +from ._container_service_client_enums import OSSKU +from ._container_service_client_enums import OSType +from ._container_service_client_enums import OutboundType +from ._container_service_client_enums import PrivateEndpointConnectionProvisioningState +from ._container_service_client_enums import PublicNetworkAccess +from ._container_service_client_enums import ResourceIdentityType +from ._container_service_client_enums import ScaleDownMode +from ._container_service_client_enums import ScaleSetEvictionPolicy +from ._container_service_client_enums import ScaleSetPriority +from ._container_service_client_enums import SnapshotType +from ._container_service_client_enums import UpgradeChannel +from ._container_service_client_enums import WeekDay +from ._container_service_client_enums import WorkloadRuntime from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'AgentPool', - 'AgentPoolAvailableVersions', - 'AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem', - 'AgentPoolListResult', - 'AgentPoolUpgradeProfile', - 'AgentPoolUpgradeProfilePropertiesUpgradesItem', - 'AgentPoolUpgradeSettings', - 'CloudErrorBody', - 'ContainerServiceDiagnosticsProfile', - 'ContainerServiceLinuxProfile', - 'ContainerServiceMasterProfile', - 'ContainerServiceNetworkProfile', - 'ContainerServiceSshConfiguration', - 'ContainerServiceSshPublicKey', - 'ContainerServiceVMDiagnostics', - 'CreationData', - 'CredentialResult', - 'CredentialResults', - 'EndpointDependency', - 'EndpointDetail', - 'ExtendedLocation', - 'KubeletConfig', - 'LinuxOSConfig', - 'MaintenanceConfiguration', - 'MaintenanceConfigurationListResult', - 'ManagedCluster', - 'ManagedClusterAADProfile', - 'ManagedClusterAPIServerAccessProfile', - 'ManagedClusterAccessProfile', - 'ManagedClusterAddonProfile', - 'ManagedClusterAddonProfileIdentity', - 'ManagedClusterAgentPoolProfile', - 'ManagedClusterAgentPoolProfileProperties', - 'ManagedClusterAutoUpgradeProfile', - 'ManagedClusterHTTPProxyConfig', - 'ManagedClusterIdentity', - 'ManagedClusterListResult', - 'ManagedClusterLoadBalancerProfile', - 'ManagedClusterLoadBalancerProfileManagedOutboundIPs', - 'ManagedClusterLoadBalancerProfileOutboundIPPrefixes', - 'ManagedClusterLoadBalancerProfileOutboundIPs', - 'ManagedClusterManagedOutboundIPProfile', - 'ManagedClusterNATGatewayProfile', - 'ManagedClusterPodIdentity', - 'ManagedClusterPodIdentityException', - 'ManagedClusterPodIdentityProfile', - 'ManagedClusterPodIdentityProvisioningError', - 'ManagedClusterPodIdentityProvisioningErrorBody', - 'ManagedClusterPodIdentityProvisioningInfo', - 'ManagedClusterPoolUpgradeProfile', - 'ManagedClusterPoolUpgradeProfileUpgradesItem', - 'ManagedClusterPropertiesAutoScalerProfile', - 'ManagedClusterSKU', - 'ManagedClusterSecurityProfile', - 'ManagedClusterSecurityProfileAzureDefender', - 'ManagedClusterServicePrincipalProfile', - 'ManagedClusterStorageProfile', - 'ManagedClusterStorageProfileDiskCSIDriver', - 'ManagedClusterStorageProfileFileCSIDriver', - 'ManagedClusterStorageProfileSnapshotController', - 'ManagedClusterUpgradeProfile', - 'ManagedClusterWindowsProfile', - 'ManagedServiceIdentityUserAssignedIdentitiesValue', - 'OSOptionProfile', - 'OSOptionProperty', - 'OperationListResult', - 'OperationValue', - 'OutboundEnvironmentEndpoint', - 'OutboundEnvironmentEndpointCollection', - 'PowerState', - 'PrivateEndpoint', - 'PrivateEndpointConnection', - 'PrivateEndpointConnectionListResult', - 'PrivateLinkResource', - 'PrivateLinkResourcesListResult', - 'PrivateLinkServiceConnectionState', - 'Resource', - 'ResourceReference', - 'RunCommandRequest', - 'RunCommandResult', - 'Snapshot', - 'SnapshotListResult', - 'SubResource', - 'SysctlConfig', - 'SystemData', - 'TagsObject', - 'TimeInWeek', - 'TimeSpan', - 'TrackedResource', - 'UserAssignedIdentity', - 'WindowsGmsaProfile', - 'AgentPoolMode', - 'AgentPoolType', - 'Code', - 'ConnectionStatus', - 'ContainerServiceStorageProfileTypes', - 'ContainerServiceVMSizeTypes', - 'Count', - 'CreatedByType', - 'Expander', - 'ExtendedLocationTypes', - 'Format', - 'GPUInstanceProfile', - 'IpFamily', - 'KubeletDiskType', - 'LicenseType', - 'LoadBalancerSku', - 'ManagedClusterPodIdentityProvisioningState', - 'ManagedClusterSKUName', - 'ManagedClusterSKUTier', - 'NetworkMode', - 'NetworkPlugin', - 'NetworkPolicy', - 'OSDiskType', - 'OSSKU', - 'OSType', - 'OutboundType', - 'PrivateEndpointConnectionProvisioningState', - 'PublicNetworkAccess', - 'ResourceIdentityType', - 'ScaleDownMode', - 'ScaleSetEvictionPolicy', - 'ScaleSetPriority', - 'SnapshotType', - 'UpgradeChannel', - 'WeekDay', - 'WorkloadRuntime', + "AgentPool", + "AgentPoolAvailableVersions", + "AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem", + "AgentPoolListResult", + "AgentPoolUpgradeProfile", + "AgentPoolUpgradeProfilePropertiesUpgradesItem", + "AgentPoolUpgradeSettings", + "CloudErrorBody", + "ContainerServiceDiagnosticsProfile", + "ContainerServiceLinuxProfile", + "ContainerServiceMasterProfile", + "ContainerServiceNetworkProfile", + "ContainerServiceSshConfiguration", + "ContainerServiceSshPublicKey", + "ContainerServiceVMDiagnostics", + "CreationData", + "CredentialResult", + "CredentialResults", + "EndpointDependency", + "EndpointDetail", + "ExtendedLocation", + "KubeletConfig", + "LinuxOSConfig", + "MaintenanceConfiguration", + "MaintenanceConfigurationListResult", + "ManagedCluster", + "ManagedClusterAADProfile", + "ManagedClusterAPIServerAccessProfile", + "ManagedClusterAccessProfile", + "ManagedClusterAddonProfile", + "ManagedClusterAddonProfileIdentity", + "ManagedClusterAgentPoolProfile", + "ManagedClusterAgentPoolProfileProperties", + "ManagedClusterAutoUpgradeProfile", + "ManagedClusterHTTPProxyConfig", + "ManagedClusterIdentity", + "ManagedClusterListResult", + "ManagedClusterLoadBalancerProfile", + "ManagedClusterLoadBalancerProfileManagedOutboundIPs", + "ManagedClusterLoadBalancerProfileOutboundIPPrefixes", + "ManagedClusterLoadBalancerProfileOutboundIPs", + "ManagedClusterManagedOutboundIPProfile", + "ManagedClusterNATGatewayProfile", + "ManagedClusterPodIdentity", + "ManagedClusterPodIdentityException", + "ManagedClusterPodIdentityProfile", + "ManagedClusterPodIdentityProvisioningError", + "ManagedClusterPodIdentityProvisioningErrorBody", + "ManagedClusterPodIdentityProvisioningInfo", + "ManagedClusterPoolUpgradeProfile", + "ManagedClusterPoolUpgradeProfileUpgradesItem", + "ManagedClusterPropertiesAutoScalerProfile", + "ManagedClusterSKU", + "ManagedClusterSecurityProfile", + "ManagedClusterSecurityProfileAzureDefender", + "ManagedClusterServicePrincipalProfile", + "ManagedClusterStorageProfile", + "ManagedClusterStorageProfileDiskCSIDriver", + "ManagedClusterStorageProfileFileCSIDriver", + "ManagedClusterStorageProfileSnapshotController", + "ManagedClusterUpgradeProfile", + "ManagedClusterWindowsProfile", + "ManagedServiceIdentityUserAssignedIdentitiesValue", + "OSOptionProfile", + "OSOptionProperty", + "OperationListResult", + "OperationValue", + "OutboundEnvironmentEndpoint", + "OutboundEnvironmentEndpointCollection", + "PowerState", + "PrivateEndpoint", + "PrivateEndpointConnection", + "PrivateEndpointConnectionListResult", + "PrivateLinkResource", + "PrivateLinkResourcesListResult", + "PrivateLinkServiceConnectionState", + "Resource", + "ResourceReference", + "RunCommandRequest", + "RunCommandResult", + "Snapshot", + "SnapshotListResult", + "SubResource", + "SysctlConfig", + "SystemData", + "TagsObject", + "TimeInWeek", + "TimeSpan", + "TrackedResource", + "UserAssignedIdentity", + "WindowsGmsaProfile", + "AgentPoolMode", + "AgentPoolType", + "Code", + "ConnectionStatus", + "ContainerServiceStorageProfileTypes", + "ContainerServiceVMSizeTypes", + "Count", + "CreatedByType", + "Expander", + "ExtendedLocationTypes", + "Format", + "GPUInstanceProfile", + "IpFamily", + "KubeletDiskType", + "LicenseType", + "LoadBalancerSku", + "ManagedClusterPodIdentityProvisioningState", + "ManagedClusterSKUName", + "ManagedClusterSKUTier", + "NetworkMode", + "NetworkPlugin", + "NetworkPolicy", + "OSDiskType", + "OSSKU", + "OSType", + "OutboundType", + "PrivateEndpointConnectionProvisioningState", + "PublicNetworkAccess", + "ResourceIdentityType", + "ScaleDownMode", + "ScaleSetEvictionPolicy", + "ScaleSetPriority", + "SnapshotType", + "UpgradeChannel", + "WeekDay", + "WorkloadRuntime", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/models/_container_service_client_enums.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/models/_container_service_client_enums.py index cb066b7fffcc..3f3a6ff62be3 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/models/_container_service_client_enums.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/models/_container_service_client_enums.py @@ -13,7 +13,7 @@ class AgentPoolMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools + https://docs.microsoft.com/azure/aks/use-system-pools. """ #: System agent pools are primarily for hosting critical system pods such as CoreDNS and @@ -23,33 +23,34 @@ class AgentPoolMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: User agent pools are primarily for hosting your application pods. USER = "User" + class AgentPoolType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of Agent Pool. - """ + """The type of Agent Pool.""" #: Create an Agent Pool backed by a Virtual Machine Scale Set. VIRTUAL_MACHINE_SCALE_SETS = "VirtualMachineScaleSets" #: Use of this is strongly discouraged. AVAILABILITY_SET = "AvailabilitySet" + class Code(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Tells whether the cluster is Running or Stopped - """ + """Tells whether the cluster is Running or Stopped.""" #: The cluster is running. RUNNING = "Running" #: The cluster is stopped. STOPPED = "Stopped" + class ConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The private link service connection status. - """ + """The private link service connection status.""" PENDING = "Pending" APPROVED = "Approved" REJECTED = "Rejected" DISCONNECTED = "Disconnected" + class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Specifies what kind of storage to use. If omitted, the default will be chosen on your behalf based on the choice of orchestrator. @@ -58,9 +59,9 @@ class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEn STORAGE_ACCOUNT = "StorageAccount" MANAGED_DISKS = "ManagedDisks" + class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Size of agent VMs. Note: This is no longer maintained. - """ + """Size of agent VMs. Note: This is no longer maintained.""" STANDARD_A1 = "Standard_A1" STANDARD_A10 = "Standard_A10" @@ -237,6 +238,7 @@ class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): STANDARD_NV24 = "Standard_NV24" STANDARD_NV6 = "Standard_NV6" + class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): """Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, and 5. The default value is 1. @@ -246,15 +248,16 @@ class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): THREE = 3 FIVE = 5 + class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of identity that created the resource. - """ + """The type of identity that created the resource.""" USER = "User" APPLICATION = "Application" MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" + class Expander(str, Enum, metaclass=CaseInsensitiveEnumMeta): """If not specified, the default is 'random'. See `expanders `_ @@ -278,23 +281,25 @@ class Expander(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Used when you don't have a particular need for the node groups to scale differently. RANDOM = "random" + class ExtendedLocationTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of extendedLocation. - """ + """The type of extendedLocation.""" EDGE_ZONE = "EdgeZone" + class Format(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Format.""" #: Return azure auth-provider kubeconfig. This format is deprecated in 1.22 and will be fully #: removed in 1.25. AZURE = "azure" #: Return exec format kubeconfig. This format requires kubelogin binary in the path. - EXEC_ENUM = "exec" + EXEC = "exec" + class GPUInstanceProfile(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """GPUInstanceProfile to be used to specify GPU MIG instance profile for supported GPU VM SKU. - """ + """GPUInstanceProfile to be used to specify GPU MIG instance profile for supported GPU VM SKU.""" MIG1_G = "MIG1g" MIG2_G = "MIG2g" @@ -302,13 +307,14 @@ class GPUInstanceProfile(str, Enum, metaclass=CaseInsensitiveEnumMeta): MIG4_G = "MIG4g" MIG7_G = "MIG7g" + class IpFamily(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The IP version to use for cluster networking and IP assignment. - """ + """The IP version to use for cluster networking and IP assignment.""" I_PV4 = "IPv4" I_PV6 = "IPv6" + class KubeletDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. @@ -319,6 +325,7 @@ class KubeletDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Kubelet will use the temporary disk for its data. TEMPORARY = "Temporary" + class LicenseType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The license type to use for Windows VMs. See `Azure Hybrid User Benefits `_ for more details. @@ -329,6 +336,7 @@ class LicenseType(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Enables Azure Hybrid User Benefits for Windows VMs. WINDOWS_SERVER = "Windows_Server" + class LoadBalancerSku(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The default is 'standard'. See `Azure Load Balancer SKUs `_ for more information about the @@ -342,21 +350,22 @@ class LoadBalancerSku(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Use a basic Load Balancer with limited functionality. BASIC = "basic" + class ManagedClusterPodIdentityProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The current provisioning state of the pod identity. - """ + """The current provisioning state of the pod identity.""" ASSIGNED = "Assigned" UPDATING = "Updating" DELETING = "Deleting" FAILED = "Failed" + class ManagedClusterSKUName(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The name of a managed cluster SKU. - """ + """The name of a managed cluster SKU.""" BASIC = "Basic" + class ManagedClusterSKUTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): """If not specified, the default is 'Free'. See `uptime SLA `_ for more details. @@ -368,20 +377,20 @@ class ManagedClusterSKUTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: No guaranteed SLA, no additional charges. Free tier clusters have an SLO of 99.5%. FREE = "Free" + class NetworkMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """This cannot be specified if networkPlugin is anything other than 'azure'. - """ + """This cannot be specified if networkPlugin is anything other than 'azure'.""" #: No bridge is created. Intra-VM Pod to Pod communication is through IP routes created by Azure #: CNI. See `Transparent Mode `_ for #: more information. TRANSPARENT = "transparent" - #: This is no longer supported. + #: This is no longer supported BRIDGE = "bridge" + class NetworkPlugin(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Network plugin used for building the Kubernetes network. - """ + """Network plugin used for building the Kubernetes network.""" #: Use the Azure CNI network plugin. See `Azure CNI (advanced) networking #: `_ for @@ -392,9 +401,9 @@ class NetworkPlugin(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: information. KUBENET = "kubenet" + class NetworkPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Network policy used for building the Kubernetes network. - """ + """Network policy used for building the Kubernetes network.""" #: Use Calico network policies. See `differences between Azure and Calico policies #: `_ @@ -405,6 +414,7 @@ class NetworkPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: for more information. AZURE = "azure" + class OSDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more @@ -421,22 +431,23 @@ class OSDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: provides lower read/write latency, along with faster node scaling and cluster upgrades. EPHEMERAL = "Ephemeral" + class OSSKU(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Specifies an OS SKU. This value must not be specified if OSType is Windows. - """ + """Specifies an OS SKU. This value must not be specified if OSType is Windows.""" UBUNTU = "Ubuntu" CBL_MARINER = "CBLMariner" + class OSType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The operating system type. The default is Linux. - """ + """The operating system type. The default is Linux.""" #: Use Linux. LINUX = "Linux" #: Use Windows. WINDOWS = "Windows" + class OutboundType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """This can only be set at cluster creation time and cannot be changed later. For more information see `egress outbound type `_. @@ -457,22 +468,23 @@ class OutboundType(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: advanced scenario and requires proper network configuration. USER_ASSIGNED_NAT_GATEWAY = "userAssignedNATGateway" + class PrivateEndpointConnectionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The current provisioning state. - """ + """The current provisioning state.""" SUCCEEDED = "Succeeded" CREATING = "Creating" DELETING = "Deleting" FAILED = "Failed" + class PublicNetworkAccess(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Allow or deny public network access for AKS - """ + """Allow or deny public network access for AKS.""" ENABLED = "Enabled" DISABLED = "Disabled" + class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """For more information see `use managed identities in AKS `_. @@ -489,6 +501,7 @@ class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Do not use a managed identity for the Managed Cluster, service principal will be used instead. NONE = "None" + class ScaleDownMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Describes how VMs are added to or removed from Agent Pools. See `billing states `_. @@ -500,10 +513,11 @@ class ScaleDownMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: during scale down. DEALLOCATE = "Deallocate" + class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The eviction policy specifies what to do with the VM when it is evicted. The default is Delete. For more information about eviction see `spot VMs - `_ + `_. """ #: Nodes in the underlying Scale Set of the node pool are deleted when they're evicted. @@ -513,9 +527,9 @@ class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: cause issues with cluster scaling or upgrading. DEALLOCATE = "Deallocate" + class ScaleSetPriority(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The Virtual Machine Scale Set priority. - """ + """The Virtual Machine Scale Set priority.""" #: Spot priority VMs will be used. There is no SLA for spot nodes. See `spot on AKS #: `_ for more information. @@ -523,13 +537,14 @@ class ScaleSetPriority(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Regular VMs will be used. REGULAR = "Regular" + class SnapshotType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of a snapshot. The default is NodePool. - """ + """The type of a snapshot. The default is NodePool.""" #: The snapshot is a snapshot of a node pool. NODE_POOL = "NodePool" + class UpgradeChannel(str, Enum, metaclass=CaseInsensitiveEnumMeta): """For more information see `setting the AKS cluster auto-upgrade channel `_. @@ -560,9 +575,9 @@ class UpgradeChannel(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Disables auto-upgrades and keeps the cluster at its current version of Kubernetes. NONE = "none" + class WeekDay(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The weekday enum. - """ + """The weekday enum.""" SUNDAY = "Sunday" MONDAY = "Monday" @@ -572,9 +587,9 @@ class WeekDay(str, Enum, metaclass=CaseInsensitiveEnumMeta): FRIDAY = "Friday" SATURDAY = "Saturday" + class WorkloadRuntime(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Determines the type of workload a node can run. - """ + """Determines the type of workload a node can run.""" #: Nodes will use Kubelet to run standard OCI container workloads. OCI_CONTAINER = "OCIContainer" diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/models/_models_py3.py index 12805013bc25..a0f48aa5e338 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/models/_models_py3.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/models/_models_py3.py @@ -1,4 +1,5 @@ # coding=utf-8 +# pylint: disable=too-many-lines # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -9,14 +10,14 @@ import datetime from typing import Dict, List, Optional, TYPE_CHECKING, Union -import msrest.serialization +from ... import _serialization if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - import __init__ as _models + from .. import models as _models -class SubResource(msrest.serialization.Model): +class SubResource(_serialization.Model): """Reference to another subresource. Variables are only populated by the server, and will be ignored when sending a request. @@ -31,30 +32,26 @@ class SubResource(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(SubResource, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.id = None self.name = None self.type = None -class AgentPool(SubResource): +class AgentPool(SubResource): # pylint: disable=too-many-instance-attributes """Agent Pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -82,14 +79,14 @@ class AgentPool(SubResource): larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2022_04_01.models.OSDiskType :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data - root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_04_01.models.KubeletDiskType :ivar workload_runtime: Determines the type of workload a node can run. Known values are: - "OCIContainer", "WasmWasi". + "OCIContainer" and "WasmWasi". :vartype workload_runtime: str or ~azure.mgmt.containerservice.v2022_04_01.models.WorkloadRuntime :ivar vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and used. @@ -103,11 +100,11 @@ class AgentPool(SubResource): :vartype pod_subnet_id: str :ivar max_pods: The maximum number of pods that can run on a node. :vartype max_pods: int - :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_04_01.models.OSType :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known - values are: "Ubuntu", "CBLMariner". + values are: "Ubuntu" and "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2022_04_01.models.OSSKU :ivar max_count: The maximum number of nodes for auto-scaling. :vartype max_count: int @@ -116,15 +113,15 @@ class AgentPool(SubResource): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it - defaults to Delete. Known values are: "Delete", "Deallocate". + defaults to Delete. Known values are: "Delete" and "Deallocate". :vartype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_04_01.models.ScaleDownMode - :ivar type_properties_type: The type of Agent Pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + :ivar type_properties_type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets" + and "AvailabilitySet". :vartype type_properties_type: str or ~azure.mgmt.containerservice.v2022_04_01.models.AgentPoolType :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :vartype mode: str or ~azure.mgmt.containerservice.v2022_04_01.models.AgentPoolMode :ivar orchestrator_version: Both patch version (e.g. 1.20.13) and (e.g. 1.20) are supported. When is specified, the latest supported @@ -167,20 +164,18 @@ class AgentPool(SubResource): /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default - is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + is 'Regular'. Known values are: "Spot" and "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_04_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_04_01.models.ScaleSetEvictionPolicy :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :vartype spot_max_price: float - :ivar tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :ivar tags: The tags to be persisted on the agent pool virtual machine scale set. :vartype tags: dict[str, str] :ivar node_labels: The node labels to be persisted across all nodes in agent pool. :vartype node_labels: dict[str, str] @@ -204,7 +199,7 @@ class AgentPool(SubResource): for more details. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_04_01.models.GPUInstanceProfile :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the node pool @@ -213,62 +208,62 @@ class AgentPool(SubResource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'os_disk_size_gb': {'maximum': 2048, 'minimum': 0}, - 'current_orchestrator_version': {'readonly': True}, - 'node_image_version': {'readonly': True}, - 'provisioning_state': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "os_disk_size_gb": {"maximum": 2048, "minimum": 0}, + "current_orchestrator_version": {"readonly": True}, + "node_image_version": {"readonly": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'count': {'key': 'properties.count', 'type': 'int'}, - 'vm_size': {'key': 'properties.vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'properties.osDiskSizeGB', 'type': 'int'}, - 'os_disk_type': {'key': 'properties.osDiskType', 'type': 'str'}, - 'kubelet_disk_type': {'key': 'properties.kubeletDiskType', 'type': 'str'}, - 'workload_runtime': {'key': 'properties.workloadRuntime', 'type': 'str'}, - 'vnet_subnet_id': {'key': 'properties.vnetSubnetID', 'type': 'str'}, - 'pod_subnet_id': {'key': 'properties.podSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'properties.maxPods', 'type': 'int'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'os_sku': {'key': 'properties.osSKU', 'type': 'str'}, - 'max_count': {'key': 'properties.maxCount', 'type': 'int'}, - 'min_count': {'key': 'properties.minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'properties.enableAutoScaling', 'type': 'bool'}, - 'scale_down_mode': {'key': 'properties.scaleDownMode', 'type': 'str'}, - 'type_properties_type': {'key': 'properties.type', 'type': 'str'}, - 'mode': {'key': 'properties.mode', 'type': 'str'}, - 'orchestrator_version': {'key': 'properties.orchestratorVersion', 'type': 'str'}, - 'current_orchestrator_version': {'key': 'properties.currentOrchestratorVersion', 'type': 'str'}, - 'node_image_version': {'key': 'properties.nodeImageVersion', 'type': 'str'}, - 'upgrade_settings': {'key': 'properties.upgradeSettings', 'type': 'AgentPoolUpgradeSettings'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'power_state': {'key': 'properties.powerState', 'type': 'PowerState'}, - 'availability_zones': {'key': 'properties.availabilityZones', 'type': '[str]'}, - 'enable_node_public_ip': {'key': 'properties.enableNodePublicIP', 'type': 'bool'}, - 'node_public_ip_prefix_id': {'key': 'properties.nodePublicIPPrefixID', 'type': 'str'}, - 'scale_set_priority': {'key': 'properties.scaleSetPriority', 'type': 'str'}, - 'scale_set_eviction_policy': {'key': 'properties.scaleSetEvictionPolicy', 'type': 'str'}, - 'spot_max_price': {'key': 'properties.spotMaxPrice', 'type': 'float'}, - 'tags': {'key': 'properties.tags', 'type': '{str}'}, - 'node_labels': {'key': 'properties.nodeLabels', 'type': '{str}'}, - 'node_taints': {'key': 'properties.nodeTaints', 'type': '[str]'}, - 'proximity_placement_group_id': {'key': 'properties.proximityPlacementGroupID', 'type': 'str'}, - 'kubelet_config': {'key': 'properties.kubeletConfig', 'type': 'KubeletConfig'}, - 'linux_os_config': {'key': 'properties.linuxOSConfig', 'type': 'LinuxOSConfig'}, - 'enable_encryption_at_host': {'key': 'properties.enableEncryptionAtHost', 'type': 'bool'}, - 'enable_ultra_ssd': {'key': 'properties.enableUltraSSD', 'type': 'bool'}, - 'enable_fips': {'key': 'properties.enableFIPS', 'type': 'bool'}, - 'gpu_instance_profile': {'key': 'properties.gpuInstanceProfile', 'type': 'str'}, - 'creation_data': {'key': 'properties.creationData', 'type': 'CreationData'}, - } - - def __init__( + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "count": {"key": "properties.count", "type": "int"}, + "vm_size": {"key": "properties.vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "properties.osDiskSizeGB", "type": "int"}, + "os_disk_type": {"key": "properties.osDiskType", "type": "str"}, + "kubelet_disk_type": {"key": "properties.kubeletDiskType", "type": "str"}, + "workload_runtime": {"key": "properties.workloadRuntime", "type": "str"}, + "vnet_subnet_id": {"key": "properties.vnetSubnetID", "type": "str"}, + "pod_subnet_id": {"key": "properties.podSubnetID", "type": "str"}, + "max_pods": {"key": "properties.maxPods", "type": "int"}, + "os_type": {"key": "properties.osType", "type": "str"}, + "os_sku": {"key": "properties.osSKU", "type": "str"}, + "max_count": {"key": "properties.maxCount", "type": "int"}, + "min_count": {"key": "properties.minCount", "type": "int"}, + "enable_auto_scaling": {"key": "properties.enableAutoScaling", "type": "bool"}, + "scale_down_mode": {"key": "properties.scaleDownMode", "type": "str"}, + "type_properties_type": {"key": "properties.type", "type": "str"}, + "mode": {"key": "properties.mode", "type": "str"}, + "orchestrator_version": {"key": "properties.orchestratorVersion", "type": "str"}, + "current_orchestrator_version": {"key": "properties.currentOrchestratorVersion", "type": "str"}, + "node_image_version": {"key": "properties.nodeImageVersion", "type": "str"}, + "upgrade_settings": {"key": "properties.upgradeSettings", "type": "AgentPoolUpgradeSettings"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "power_state": {"key": "properties.powerState", "type": "PowerState"}, + "availability_zones": {"key": "properties.availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "properties.enableNodePublicIP", "type": "bool"}, + "node_public_ip_prefix_id": {"key": "properties.nodePublicIPPrefixID", "type": "str"}, + "scale_set_priority": {"key": "properties.scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "properties.scaleSetEvictionPolicy", "type": "str"}, + "spot_max_price": {"key": "properties.spotMaxPrice", "type": "float"}, + "tags": {"key": "properties.tags", "type": "{str}"}, + "node_labels": {"key": "properties.nodeLabels", "type": "{str}"}, + "node_taints": {"key": "properties.nodeTaints", "type": "[str]"}, + "proximity_placement_group_id": {"key": "properties.proximityPlacementGroupID", "type": "str"}, + "kubelet_config": {"key": "properties.kubeletConfig", "type": "KubeletConfig"}, + "linux_os_config": {"key": "properties.linuxOSConfig", "type": "LinuxOSConfig"}, + "enable_encryption_at_host": {"key": "properties.enableEncryptionAtHost", "type": "bool"}, + "enable_ultra_ssd": {"key": "properties.enableUltraSSD", "type": "bool"}, + "enable_fips": {"key": "properties.enableFIPS", "type": "bool"}, + "gpu_instance_profile": {"key": "properties.gpuInstanceProfile", "type": "str"}, + "creation_data": {"key": "properties.creationData", "type": "CreationData"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, count: Optional[int] = None, @@ -280,7 +275,7 @@ def __init__( vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, @@ -294,9 +289,9 @@ def __init__( availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", - spot_max_price: Optional[float] = -1, + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", + spot_max_price: float = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, @@ -327,14 +322,14 @@ def __init__( larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2022_04_01.models.OSDiskType :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime - data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + data root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_04_01.models.KubeletDiskType :keyword workload_runtime: Determines the type of workload a node can run. Known values are: - "OCIContainer", "WasmWasi". + "OCIContainer" and "WasmWasi". :paramtype workload_runtime: str or ~azure.mgmt.containerservice.v2022_04_01.models.WorkloadRuntime :keyword vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and @@ -348,11 +343,11 @@ def __init__( :paramtype pod_subnet_id: str :keyword max_pods: The maximum number of pods that can run on a node. :paramtype max_pods: int - :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_04_01.models.OSType :keyword os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Known values are: "Ubuntu", "CBLMariner". + Known values are: "Ubuntu" and "CBLMariner". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2022_04_01.models.OSSKU :keyword max_count: The maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -361,16 +356,16 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, - it defaults to Delete. Known values are: "Delete", "Deallocate". + it defaults to Delete. Known values are: "Delete" and "Deallocate". :paramtype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_04_01.models.ScaleDownMode :keyword type_properties_type: The type of Agent Pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type_properties_type: str or ~azure.mgmt.containerservice.v2022_04_01.models.AgentPoolType :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2022_04_01.models.AgentPoolMode :keyword orchestrator_version: Both patch version (e.g. 1.20.13) and (e.g. 1.20) are supported. When is specified, the latest supported @@ -405,20 +400,18 @@ def __init__( /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the - default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + default is 'Regular'. Known values are: "Spot" and "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_04_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_04_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :paramtype spot_max_price: float - :keyword tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :keyword tags: The tags to be persisted on the agent pool virtual machine scale set. :paramtype tags: dict[str, str] :keyword node_labels: The node labels to be persisted across all nodes in agent pool. :paramtype node_labels: dict[str, str] @@ -442,7 +435,7 @@ def __init__( for more details. :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance - profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_04_01.models.GPUInstanceProfile @@ -450,7 +443,7 @@ def __init__( pool will be created/upgraded using a snapshot. :paramtype creation_data: ~azure.mgmt.containerservice.v2022_04_01.models.CreationData """ - super(AgentPool, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.vm_size = vm_size self.os_disk_size_gb = os_disk_size_gb @@ -493,7 +486,7 @@ def __init__( self.creation_data = creation_data -class AgentPoolAvailableVersions(msrest.serialization.Model): +class AgentPoolAvailableVersions(_serialization.Model): """The list of available versions for an agent pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -510,16 +503,19 @@ class AgentPoolAvailableVersions(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'agent_pool_versions': {'key': 'properties.agentPoolVersions', 'type': '[AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "agent_pool_versions": { + "key": "properties.agentPoolVersions", + "type": "[AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem]", + }, } def __init__( @@ -533,14 +529,14 @@ def __init__( :paramtype agent_pool_versions: list[~azure.mgmt.containerservice.v2022_04_01.models.AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem] """ - super(AgentPoolAvailableVersions, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None self.agent_pool_versions = agent_pool_versions -class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(msrest.serialization.Model): +class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(_serialization.Model): """AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem. :ivar default: Whether this version is the default agent pool version. @@ -552,9 +548,9 @@ class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(msrest.serializa """ _attribute_map = { - 'default': {'key': 'default', 'type': 'bool'}, - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "default": {"key": "default", "type": "bool"}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } def __init__( @@ -573,13 +569,13 @@ def __init__( :keyword is_preview: Whether Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.default = default self.kubernetes_version = kubernetes_version self.is_preview = is_preview -class AgentPoolListResult(msrest.serialization.Model): +class AgentPoolListResult(_serialization.Model): """The response from the List Agent Pools operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -591,30 +587,25 @@ class AgentPoolListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[AgentPool]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[AgentPool]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.AgentPool"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.AgentPool"]] = None, **kwargs): """ :keyword value: The list of agent pools. :paramtype value: list[~azure.mgmt.containerservice.v2022_04_01.models.AgentPool] """ - super(AgentPoolListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class AgentPoolUpgradeProfile(msrest.serialization.Model): +class AgentPoolUpgradeProfile(_serialization.Model): """The list of available upgrades for an agent pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -627,10 +618,10 @@ class AgentPoolUpgradeProfile(msrest.serialization.Model): :vartype name: str :ivar type: The type of the agent pool upgrade profile. :vartype type: str - :ivar kubernetes_version: Required. The Kubernetes version (major.minor.patch). + :ivar kubernetes_version: The Kubernetes version (major.minor.patch). Required. :vartype kubernetes_version: str - :ivar os_type: Required. The operating system type. The default is Linux. Known values are: - "Linux", "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_04_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -640,21 +631,21 @@ class AgentPoolUpgradeProfile(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kubernetes_version': {'required': True}, - 'os_type': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "kubernetes_version": {"required": True}, + "os_type": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'kubernetes_version': {'key': 'properties.kubernetesVersion', 'type': 'str'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'upgrades': {'key': 'properties.upgrades', 'type': '[AgentPoolUpgradeProfilePropertiesUpgradesItem]'}, - 'latest_node_image_version': {'key': 'properties.latestNodeImageVersion', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "os_type": {"key": "properties.osType", "type": "str"}, + "upgrades": {"key": "properties.upgrades", "type": "[AgentPoolUpgradeProfilePropertiesUpgradesItem]"}, + "latest_node_image_version": {"key": "properties.latestNodeImageVersion", "type": "str"}, } def __init__( @@ -667,10 +658,10 @@ def __init__( **kwargs ): """ - :keyword kubernetes_version: Required. The Kubernetes version (major.minor.patch). + :keyword kubernetes_version: The Kubernetes version (major.minor.patch). Required. :paramtype kubernetes_version: str - :keyword os_type: Required. The operating system type. The default is Linux. Known values are: - "Linux", "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_04_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: @@ -678,7 +669,7 @@ def __init__( :keyword latest_node_image_version: The latest AKS supported node image version. :paramtype latest_node_image_version: str """ - super(AgentPoolUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -688,7 +679,7 @@ def __init__( self.latest_node_image_version = latest_node_image_version -class AgentPoolUpgradeProfilePropertiesUpgradesItem(msrest.serialization.Model): +class AgentPoolUpgradeProfilePropertiesUpgradesItem(_serialization.Model): """AgentPoolUpgradeProfilePropertiesUpgradesItem. :ivar kubernetes_version: The Kubernetes version (major.minor.patch). @@ -698,29 +689,23 @@ class AgentPoolUpgradeProfilePropertiesUpgradesItem(msrest.serialization.Model): """ _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } - def __init__( - self, - *, - kubernetes_version: Optional[str] = None, - is_preview: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, kubernetes_version: Optional[str] = None, is_preview: Optional[bool] = None, **kwargs): """ :keyword kubernetes_version: The Kubernetes version (major.minor.patch). :paramtype kubernetes_version: str :keyword is_preview: Whether the Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(AgentPoolUpgradeProfilePropertiesUpgradesItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.is_preview = is_preview -class AgentPoolUpgradeSettings(msrest.serialization.Model): +class AgentPoolUpgradeSettings(_serialization.Model): """Settings for upgrading an agentpool. :ivar max_surge: This can either be set to an integer (e.g. '5') or a percentage (e.g. '50%'). @@ -732,15 +717,10 @@ class AgentPoolUpgradeSettings(msrest.serialization.Model): """ _attribute_map = { - 'max_surge': {'key': 'maxSurge', 'type': 'str'}, + "max_surge": {"key": "maxSurge", "type": "str"}, } - def __init__( - self, - *, - max_surge: Optional[str] = None, - **kwargs - ): + def __init__(self, *, max_surge: Optional[str] = None, **kwargs): """ :keyword max_surge: This can either be set to an integer (e.g. '5') or a percentage (e.g. '50%'). If a percentage is specified, it is the percentage of the total agent pool size at the @@ -749,11 +729,11 @@ def __init__( https://docs.microsoft.com/azure/aks/upgrade-cluster#customize-node-surge-upgrade. :paramtype max_surge: str """ - super(AgentPoolUpgradeSettings, self).__init__(**kwargs) + super().__init__(**kwargs) self.max_surge = max_surge -class CloudErrorBody(msrest.serialization.Model): +class CloudErrorBody(_serialization.Model): """An error response from the Container service. :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed @@ -770,10 +750,10 @@ class CloudErrorBody(msrest.serialization.Model): """ _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[CloudErrorBody]"}, } def __init__( @@ -798,87 +778,76 @@ def __init__( :keyword details: A list of additional details about the error. :paramtype details: list[~azure.mgmt.containerservice.v2022_04_01.models.CloudErrorBody] """ - super(CloudErrorBody, self).__init__(**kwargs) + super().__init__(**kwargs) self.code = code self.message = message self.target = target self.details = details -class ContainerServiceDiagnosticsProfile(msrest.serialization.Model): +class ContainerServiceDiagnosticsProfile(_serialization.Model): """Profile for diagnostics on the container service cluster. All required parameters must be populated in order to send to Azure. - :ivar vm_diagnostics: Required. Profile for diagnostics on the container service VMs. + :ivar vm_diagnostics: Profile for diagnostics on the container service VMs. Required. :vartype vm_diagnostics: ~azure.mgmt.containerservice.v2022_04_01.models.ContainerServiceVMDiagnostics """ _validation = { - 'vm_diagnostics': {'required': True}, + "vm_diagnostics": {"required": True}, } _attribute_map = { - 'vm_diagnostics': {'key': 'vmDiagnostics', 'type': 'ContainerServiceVMDiagnostics'}, + "vm_diagnostics": {"key": "vmDiagnostics", "type": "ContainerServiceVMDiagnostics"}, } - def __init__( - self, - *, - vm_diagnostics: "_models.ContainerServiceVMDiagnostics", - **kwargs - ): + def __init__(self, *, vm_diagnostics: "_models.ContainerServiceVMDiagnostics", **kwargs): """ - :keyword vm_diagnostics: Required. Profile for diagnostics on the container service VMs. + :keyword vm_diagnostics: Profile for diagnostics on the container service VMs. Required. :paramtype vm_diagnostics: ~azure.mgmt.containerservice.v2022_04_01.models.ContainerServiceVMDiagnostics """ - super(ContainerServiceDiagnosticsProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.vm_diagnostics = vm_diagnostics -class ContainerServiceLinuxProfile(msrest.serialization.Model): +class ContainerServiceLinuxProfile(_serialization.Model): """Profile for Linux VMs in the container service cluster. All required parameters must be populated in order to send to Azure. - :ivar admin_username: Required. The administrator username to use for Linux VMs. + :ivar admin_username: The administrator username to use for Linux VMs. Required. :vartype admin_username: str - :ivar ssh: Required. The SSH configuration for Linux-based VMs running on Azure. + :ivar ssh: The SSH configuration for Linux-based VMs running on Azure. Required. :vartype ssh: ~azure.mgmt.containerservice.v2022_04_01.models.ContainerServiceSshConfiguration """ _validation = { - 'admin_username': {'required': True, 'pattern': r'^[A-Za-z][-A-Za-z0-9_]*$'}, - 'ssh': {'required': True}, + "admin_username": {"required": True, "pattern": r"^[A-Za-z][-A-Za-z0-9_]*$"}, + "ssh": {"required": True}, } _attribute_map = { - 'admin_username': {'key': 'adminUsername', 'type': 'str'}, - 'ssh': {'key': 'ssh', 'type': 'ContainerServiceSshConfiguration'}, + "admin_username": {"key": "adminUsername", "type": "str"}, + "ssh": {"key": "ssh", "type": "ContainerServiceSshConfiguration"}, } - def __init__( - self, - *, - admin_username: str, - ssh: "_models.ContainerServiceSshConfiguration", - **kwargs - ): + def __init__(self, *, admin_username: str, ssh: "_models.ContainerServiceSshConfiguration", **kwargs): """ - :keyword admin_username: Required. The administrator username to use for Linux VMs. + :keyword admin_username: The administrator username to use for Linux VMs. Required. :paramtype admin_username: str - :keyword ssh: Required. The SSH configuration for Linux-based VMs running on Azure. + :keyword ssh: The SSH configuration for Linux-based VMs running on Azure. Required. :paramtype ssh: ~azure.mgmt.containerservice.v2022_04_01.models.ContainerServiceSshConfiguration """ - super(ContainerServiceLinuxProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.admin_username = admin_username self.ssh = ssh -class ContainerServiceMasterProfile(msrest.serialization.Model): +class ContainerServiceMasterProfile(_serialization.Model): """Profile for the container service master. Variables are only populated by the server, and will be ignored when sending a request. @@ -886,11 +855,11 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar count: Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, - and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". + and 5. The default value is 1. Known values are: 1, 3, and 5. :vartype count: int or ~azure.mgmt.containerservice.v2022_04_01.models.Count - :ivar dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. + :ivar dns_prefix: DNS prefix to be used to create the FQDN for the master pool. Required. :vartype dns_prefix: str - :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + :ivar vm_size: Size of agent VMs. Required. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -927,7 +896,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :vartype vm_size: str or ~azure.mgmt.containerservice.v2022_04_01.models.ContainerServiceVMSizeTypes :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine @@ -941,7 +910,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): :vartype first_consecutive_static_ip: str :ivar storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount" and "ManagedDisks". :vartype storage_profile: str or ~azure.mgmt.containerservice.v2022_04_01.models.ContainerServiceStorageProfileTypes :ivar fqdn: FQDN for the master pool. @@ -949,21 +918,21 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): """ _validation = { - 'dns_prefix': {'required': True}, - 'vm_size': {'required': True}, - 'os_disk_size_gb': {'maximum': 2048, 'minimum': 0}, - 'fqdn': {'readonly': True}, + "dns_prefix": {"required": True}, + "vm_size": {"required": True}, + "os_disk_size_gb": {"maximum": 2048, "minimum": 0}, + "fqdn": {"readonly": True}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'dns_prefix': {'key': 'dnsPrefix', 'type': 'str'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'first_consecutive_static_ip': {'key': 'firstConsecutiveStaticIP', 'type': 'str'}, - 'storage_profile': {'key': 'storageProfile', 'type': 'str'}, - 'fqdn': {'key': 'fqdn', 'type': 'str'}, + "count": {"key": "count", "type": "int"}, + "dns_prefix": {"key": "dnsPrefix", "type": "str"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "first_consecutive_static_ip": {"key": "firstConsecutiveStaticIP", "type": "str"}, + "storage_profile": {"key": "storageProfile", "type": "str"}, + "fqdn": {"key": "fqdn", "type": "str"}, } def __init__( @@ -971,20 +940,20 @@ def __init__( *, dns_prefix: str, vm_size: Union[str, "_models.ContainerServiceVMSizeTypes"], - count: Optional[Union[int, "_models.Count"]] = 1, + count: Union[int, "_models.Count"] = 1, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, - first_consecutive_static_ip: Optional[str] = "10.240.255.5", + first_consecutive_static_ip: str = "10.240.255.5", storage_profile: Optional[Union[str, "_models.ContainerServiceStorageProfileTypes"]] = None, **kwargs ): """ :keyword count: Number of masters (VMs) in the container service cluster. Allowed values are 1, - 3, and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". + 3, and 5. The default value is 1. Known values are: 1, 3, and 5. :paramtype count: int or ~azure.mgmt.containerservice.v2022_04_01.models.Count - :keyword dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. + :keyword dns_prefix: DNS prefix to be used to create the FQDN for the master pool. Required. :paramtype dns_prefix: str - :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + :keyword vm_size: Size of agent VMs. Required. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -1021,7 +990,7 @@ def __init__( "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :paramtype vm_size: str or ~azure.mgmt.containerservice.v2022_04_01.models.ContainerServiceVMSizeTypes :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every @@ -1035,11 +1004,11 @@ def __init__( :paramtype first_consecutive_static_ip: str :keyword storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount" and "ManagedDisks". :paramtype storage_profile: str or ~azure.mgmt.containerservice.v2022_04_01.models.ContainerServiceStorageProfileTypes """ - super(ContainerServiceMasterProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.dns_prefix = dns_prefix self.vm_size = vm_size @@ -1050,17 +1019,17 @@ def __init__( self.fqdn = None -class ContainerServiceNetworkProfile(msrest.serialization.Model): +class ContainerServiceNetworkProfile(_serialization.Model): # pylint: disable=too-many-instance-attributes """Profile of network configuration. :ivar network_plugin: Network plugin used for building the Kubernetes network. Known values - are: "azure", "kubenet". Default value: "kubenet". + are: "azure" and "kubenet". :vartype network_plugin: str or ~azure.mgmt.containerservice.v2022_04_01.models.NetworkPlugin :ivar network_policy: Network policy used for building the Kubernetes network. Known values - are: "calico", "azure". + are: "calico" and "azure". :vartype network_policy: str or ~azure.mgmt.containerservice.v2022_04_01.models.NetworkPolicy :ivar network_mode: This cannot be specified if networkPlugin is anything other than 'azure'. - Known values are: "transparent", "bridge". + Known values are: "transparent" and "bridge". :vartype network_mode: str or ~azure.mgmt.containerservice.v2022_04_01.models.NetworkMode :ivar pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :vartype pod_cidr: str @@ -1076,12 +1045,11 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): :ivar outbound_type: This can only be set at cluster creation time and cannot be changed later. For more information see `egress outbound type `_. Known values are: "loadBalancer", - "userDefinedRouting", "managedNATGateway", "userAssignedNATGateway". Default value: - "loadBalancer". + "userDefinedRouting", "managedNATGateway", and "userAssignedNATGateway". :vartype outbound_type: str or ~azure.mgmt.containerservice.v2022_04_01.models.OutboundType :ivar load_balancer_sku: The default is 'standard'. See `Azure Load Balancer SKUs `_ for more information about the - differences between load balancer SKUs. Known values are: "standard", "basic". + differences between load balancer SKUs. Known values are: "standard" and "basic". :vartype load_balancer_sku: str or ~azure.mgmt.containerservice.v2022_04_01.models.LoadBalancerSku :ivar load_balancer_profile: Profile of the cluster load balancer. @@ -1104,40 +1072,42 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): """ _validation = { - 'pod_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, - 'service_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, - 'dns_service_ip': {'pattern': r'^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$'}, - 'docker_bridge_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, + "pod_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, + "service_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, + "dns_service_ip": { + "pattern": r"^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$" + }, + "docker_bridge_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, } _attribute_map = { - 'network_plugin': {'key': 'networkPlugin', 'type': 'str'}, - 'network_policy': {'key': 'networkPolicy', 'type': 'str'}, - 'network_mode': {'key': 'networkMode', 'type': 'str'}, - 'pod_cidr': {'key': 'podCidr', 'type': 'str'}, - 'service_cidr': {'key': 'serviceCidr', 'type': 'str'}, - 'dns_service_ip': {'key': 'dnsServiceIP', 'type': 'str'}, - 'docker_bridge_cidr': {'key': 'dockerBridgeCidr', 'type': 'str'}, - 'outbound_type': {'key': 'outboundType', 'type': 'str'}, - 'load_balancer_sku': {'key': 'loadBalancerSku', 'type': 'str'}, - 'load_balancer_profile': {'key': 'loadBalancerProfile', 'type': 'ManagedClusterLoadBalancerProfile'}, - 'nat_gateway_profile': {'key': 'natGatewayProfile', 'type': 'ManagedClusterNATGatewayProfile'}, - 'pod_cidrs': {'key': 'podCidrs', 'type': '[str]'}, - 'service_cidrs': {'key': 'serviceCidrs', 'type': '[str]'}, - 'ip_families': {'key': 'ipFamilies', 'type': '[str]'}, + "network_plugin": {"key": "networkPlugin", "type": "str"}, + "network_policy": {"key": "networkPolicy", "type": "str"}, + "network_mode": {"key": "networkMode", "type": "str"}, + "pod_cidr": {"key": "podCidr", "type": "str"}, + "service_cidr": {"key": "serviceCidr", "type": "str"}, + "dns_service_ip": {"key": "dnsServiceIP", "type": "str"}, + "docker_bridge_cidr": {"key": "dockerBridgeCidr", "type": "str"}, + "outbound_type": {"key": "outboundType", "type": "str"}, + "load_balancer_sku": {"key": "loadBalancerSku", "type": "str"}, + "load_balancer_profile": {"key": "loadBalancerProfile", "type": "ManagedClusterLoadBalancerProfile"}, + "nat_gateway_profile": {"key": "natGatewayProfile", "type": "ManagedClusterNATGatewayProfile"}, + "pod_cidrs": {"key": "podCidrs", "type": "[str]"}, + "service_cidrs": {"key": "serviceCidrs", "type": "[str]"}, + "ip_families": {"key": "ipFamilies", "type": "[str]"}, } def __init__( self, *, - network_plugin: Optional[Union[str, "_models.NetworkPlugin"]] = "kubenet", + network_plugin: Union[str, "_models.NetworkPlugin"] = "kubenet", network_policy: Optional[Union[str, "_models.NetworkPolicy"]] = None, network_mode: Optional[Union[str, "_models.NetworkMode"]] = None, - pod_cidr: Optional[str] = "10.244.0.0/16", - service_cidr: Optional[str] = "10.0.0.0/16", - dns_service_ip: Optional[str] = "10.0.0.10", - docker_bridge_cidr: Optional[str] = "172.17.0.1/16", - outbound_type: Optional[Union[str, "_models.OutboundType"]] = "loadBalancer", + pod_cidr: str = "10.244.0.0/16", + service_cidr: str = "10.0.0.0/16", + dns_service_ip: str = "10.0.0.10", + docker_bridge_cidr: str = "172.17.0.1/16", + outbound_type: Union[str, "_models.OutboundType"] = "loadBalancer", load_balancer_sku: Optional[Union[str, "_models.LoadBalancerSku"]] = None, load_balancer_profile: Optional["_models.ManagedClusterLoadBalancerProfile"] = None, nat_gateway_profile: Optional["_models.ManagedClusterNATGatewayProfile"] = None, @@ -1148,13 +1118,13 @@ def __init__( ): """ :keyword network_plugin: Network plugin used for building the Kubernetes network. Known values - are: "azure", "kubenet". Default value: "kubenet". + are: "azure" and "kubenet". :paramtype network_plugin: str or ~azure.mgmt.containerservice.v2022_04_01.models.NetworkPlugin :keyword network_policy: Network policy used for building the Kubernetes network. Known values - are: "calico", "azure". + are: "calico" and "azure". :paramtype network_policy: str or ~azure.mgmt.containerservice.v2022_04_01.models.NetworkPolicy :keyword network_mode: This cannot be specified if networkPlugin is anything other than - 'azure'. Known values are: "transparent", "bridge". + 'azure'. Known values are: "transparent" and "bridge". :paramtype network_mode: str or ~azure.mgmt.containerservice.v2022_04_01.models.NetworkMode :keyword pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :paramtype pod_cidr: str @@ -1170,12 +1140,11 @@ def __init__( :keyword outbound_type: This can only be set at cluster creation time and cannot be changed later. For more information see `egress outbound type `_. Known values are: "loadBalancer", - "userDefinedRouting", "managedNATGateway", "userAssignedNATGateway". Default value: - "loadBalancer". + "userDefinedRouting", "managedNATGateway", and "userAssignedNATGateway". :paramtype outbound_type: str or ~azure.mgmt.containerservice.v2022_04_01.models.OutboundType :keyword load_balancer_sku: The default is 'standard'. See `Azure Load Balancer SKUs `_ for more information about the - differences between load balancer SKUs. Known values are: "standard", "basic". + differences between load balancer SKUs. Known values are: "standard" and "basic". :paramtype load_balancer_sku: str or ~azure.mgmt.containerservice.v2022_04_01.models.LoadBalancerSku :keyword load_balancer_profile: Profile of the cluster load balancer. @@ -1196,7 +1165,7 @@ def __init__( IPv6. :paramtype ip_families: list[str or ~azure.mgmt.containerservice.v2022_04_01.models.IpFamily] """ - super(ContainerServiceNetworkProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.network_plugin = network_plugin self.network_policy = network_policy self.network_mode = network_mode @@ -1213,113 +1182,98 @@ def __init__( self.ip_families = ip_families -class ContainerServiceSshConfiguration(msrest.serialization.Model): +class ContainerServiceSshConfiguration(_serialization.Model): """SSH configuration for Linux-based VMs running on Azure. All required parameters must be populated in order to send to Azure. - :ivar public_keys: Required. The list of SSH public keys used to authenticate with Linux-based - VMs. A maximum of 1 key may be specified. + :ivar public_keys: The list of SSH public keys used to authenticate with Linux-based VMs. A + maximum of 1 key may be specified. Required. :vartype public_keys: list[~azure.mgmt.containerservice.v2022_04_01.models.ContainerServiceSshPublicKey] """ _validation = { - 'public_keys': {'required': True}, + "public_keys": {"required": True}, } _attribute_map = { - 'public_keys': {'key': 'publicKeys', 'type': '[ContainerServiceSshPublicKey]'}, + "public_keys": {"key": "publicKeys", "type": "[ContainerServiceSshPublicKey]"}, } - def __init__( - self, - *, - public_keys: List["_models.ContainerServiceSshPublicKey"], - **kwargs - ): + def __init__(self, *, public_keys: List["_models.ContainerServiceSshPublicKey"], **kwargs): """ - :keyword public_keys: Required. The list of SSH public keys used to authenticate with - Linux-based VMs. A maximum of 1 key may be specified. + :keyword public_keys: The list of SSH public keys used to authenticate with Linux-based VMs. A + maximum of 1 key may be specified. Required. :paramtype public_keys: list[~azure.mgmt.containerservice.v2022_04_01.models.ContainerServiceSshPublicKey] """ - super(ContainerServiceSshConfiguration, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_keys = public_keys -class ContainerServiceSshPublicKey(msrest.serialization.Model): +class ContainerServiceSshPublicKey(_serialization.Model): """Contains information about SSH certificate public key data. All required parameters must be populated in order to send to Azure. - :ivar key_data: Required. Certificate public key used to authenticate with VMs through SSH. The - certificate must be in PEM format with or without headers. + :ivar key_data: Certificate public key used to authenticate with VMs through SSH. The + certificate must be in PEM format with or without headers. Required. :vartype key_data: str """ _validation = { - 'key_data': {'required': True}, + "key_data": {"required": True}, } _attribute_map = { - 'key_data': {'key': 'keyData', 'type': 'str'}, + "key_data": {"key": "keyData", "type": "str"}, } - def __init__( - self, - *, - key_data: str, - **kwargs - ): + def __init__(self, *, key_data: str, **kwargs): """ - :keyword key_data: Required. Certificate public key used to authenticate with VMs through SSH. - The certificate must be in PEM format with or without headers. + :keyword key_data: Certificate public key used to authenticate with VMs through SSH. The + certificate must be in PEM format with or without headers. Required. :paramtype key_data: str """ - super(ContainerServiceSshPublicKey, self).__init__(**kwargs) + super().__init__(**kwargs) self.key_data = key_data -class ContainerServiceVMDiagnostics(msrest.serialization.Model): +class ContainerServiceVMDiagnostics(_serialization.Model): """Profile for diagnostics on the container service VMs. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar enabled: Required. Whether the VM diagnostic agent is provisioned on the VM. + :ivar enabled: Whether the VM diagnostic agent is provisioned on the VM. Required. :vartype enabled: bool :ivar storage_uri: The URI of the storage account where diagnostics are stored. :vartype storage_uri: str """ _validation = { - 'enabled': {'required': True}, - 'storage_uri': {'readonly': True}, + "enabled": {"required": True}, + "storage_uri": {"readonly": True}, } _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'storage_uri': {'key': 'storageUri', 'type': 'str'}, + "enabled": {"key": "enabled", "type": "bool"}, + "storage_uri": {"key": "storageUri", "type": "str"}, } - def __init__( - self, - *, - enabled: bool, - **kwargs - ): + def __init__(self, *, enabled: bool, **kwargs): """ - :keyword enabled: Required. Whether the VM diagnostic agent is provisioned on the VM. + :keyword enabled: Whether the VM diagnostic agent is provisioned on the VM. Required. :paramtype enabled: bool """ - super(ContainerServiceVMDiagnostics, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.storage_uri = None -class CreationData(msrest.serialization.Model): +class CreationData(_serialization.Model): """Data used when creating a target resource from a source resource. :ivar source_resource_id: This is the ARM ID of the source object to be used to create the @@ -1328,25 +1282,20 @@ class CreationData(msrest.serialization.Model): """ _attribute_map = { - 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, + "source_resource_id": {"key": "sourceResourceId", "type": "str"}, } - def __init__( - self, - *, - source_resource_id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, source_resource_id: Optional[str] = None, **kwargs): """ :keyword source_resource_id: This is the ARM ID of the source object to be used to create the target object. :paramtype source_resource_id: str """ - super(CreationData, self).__init__(**kwargs) + super().__init__(**kwargs) self.source_resource_id = source_resource_id -class CredentialResult(msrest.serialization.Model): +class CredentialResult(_serialization.Model): """The credential result response. Variables are only populated by the server, and will be ignored when sending a request. @@ -1354,31 +1303,27 @@ class CredentialResult(msrest.serialization.Model): :ivar name: The name of the credential. :vartype name: str :ivar value: Base64-encoded Kubernetes configuration file. - :vartype value: bytearray + :vartype value: bytes """ _validation = { - 'name': {'readonly': True}, - 'value': {'readonly': True}, + "name": {"readonly": True}, + "value": {"readonly": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'bytearray'}, + "name": {"key": "name", "type": "str"}, + "value": {"key": "value", "type": "bytearray"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(CredentialResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.name = None self.value = None -class CredentialResults(msrest.serialization.Model): +class CredentialResults(_serialization.Model): """The list credential result response. Variables are only populated by the server, and will be ignored when sending a request. @@ -1388,24 +1333,20 @@ class CredentialResults(msrest.serialization.Model): """ _validation = { - 'kubeconfigs': {'readonly': True}, + "kubeconfigs": {"readonly": True}, } _attribute_map = { - 'kubeconfigs': {'key': 'kubeconfigs', 'type': '[CredentialResult]'}, + "kubeconfigs": {"key": "kubeconfigs", "type": "[CredentialResult]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(CredentialResults, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.kubeconfigs = None -class EndpointDependency(msrest.serialization.Model): +class EndpointDependency(_serialization.Model): """A domain name that AKS agent nodes are reaching at. :ivar domain_name: The domain name of the dependency. @@ -1415,8 +1356,8 @@ class EndpointDependency(msrest.serialization.Model): """ _attribute_map = { - 'domain_name': {'key': 'domainName', 'type': 'str'}, - 'endpoint_details': {'key': 'endpointDetails', 'type': '[EndpointDetail]'}, + "domain_name": {"key": "domainName", "type": "str"}, + "endpoint_details": {"key": "endpointDetails", "type": "[EndpointDetail]"}, } def __init__( @@ -1433,12 +1374,12 @@ def __init__( :paramtype endpoint_details: list[~azure.mgmt.containerservice.v2022_04_01.models.EndpointDetail] """ - super(EndpointDependency, self).__init__(**kwargs) + super().__init__(**kwargs) self.domain_name = domain_name self.endpoint_details = endpoint_details -class EndpointDetail(msrest.serialization.Model): +class EndpointDetail(_serialization.Model): """connect information from the AKS agent nodes to a single endpoint. :ivar ip_address: An IP Address that Domain Name currently resolves to. @@ -1452,10 +1393,10 @@ class EndpointDetail(msrest.serialization.Model): """ _attribute_map = { - 'ip_address': {'key': 'ipAddress', 'type': 'str'}, - 'port': {'key': 'port', 'type': 'int'}, - 'protocol': {'key': 'protocol', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, + "ip_address": {"key": "ipAddress", "type": "str"}, + "port": {"key": "port", "type": "int"}, + "protocol": {"key": "protocol", "type": "str"}, + "description": {"key": "description", "type": "str"}, } def __init__( @@ -1477,25 +1418,25 @@ def __init__( :keyword description: Description of the detail. :paramtype description: str """ - super(EndpointDetail, self).__init__(**kwargs) + super().__init__(**kwargs) self.ip_address = ip_address self.port = port self.protocol = protocol self.description = description -class ExtendedLocation(msrest.serialization.Model): +class ExtendedLocation(_serialization.Model): """The complex type of the extended location. :ivar name: The name of the extended location. :vartype name: str - :ivar type: The type of the extended location. Known values are: "EdgeZone". + :ivar type: The type of the extended location. "EdgeZone" :vartype type: str or ~azure.mgmt.containerservice.v2022_04_01.models.ExtendedLocationTypes """ _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, } def __init__( @@ -1508,15 +1449,15 @@ def __init__( """ :keyword name: The name of the extended location. :paramtype name: str - :keyword type: The type of the extended location. Known values are: "EdgeZone". + :keyword type: The type of the extended location. "EdgeZone" :paramtype type: str or ~azure.mgmt.containerservice.v2022_04_01.models.ExtendedLocationTypes """ - super(ExtendedLocation, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.type = type -class KubeletConfig(msrest.serialization.Model): +class KubeletConfig(_serialization.Model): # pylint: disable=too-many-instance-attributes """See `AKS custom node configuration `_ for more details. :ivar cpu_manager_policy: The default is 'none'. See `Kubernetes CPU management policies @@ -1556,21 +1497,21 @@ class KubeletConfig(msrest.serialization.Model): """ _validation = { - 'container_log_max_files': {'minimum': 2}, + "container_log_max_files": {"minimum": 2}, } _attribute_map = { - 'cpu_manager_policy': {'key': 'cpuManagerPolicy', 'type': 'str'}, - 'cpu_cfs_quota': {'key': 'cpuCfsQuota', 'type': 'bool'}, - 'cpu_cfs_quota_period': {'key': 'cpuCfsQuotaPeriod', 'type': 'str'}, - 'image_gc_high_threshold': {'key': 'imageGcHighThreshold', 'type': 'int'}, - 'image_gc_low_threshold': {'key': 'imageGcLowThreshold', 'type': 'int'}, - 'topology_manager_policy': {'key': 'topologyManagerPolicy', 'type': 'str'}, - 'allowed_unsafe_sysctls': {'key': 'allowedUnsafeSysctls', 'type': '[str]'}, - 'fail_swap_on': {'key': 'failSwapOn', 'type': 'bool'}, - 'container_log_max_size_mb': {'key': 'containerLogMaxSizeMB', 'type': 'int'}, - 'container_log_max_files': {'key': 'containerLogMaxFiles', 'type': 'int'}, - 'pod_max_pids': {'key': 'podMaxPids', 'type': 'int'}, + "cpu_manager_policy": {"key": "cpuManagerPolicy", "type": "str"}, + "cpu_cfs_quota": {"key": "cpuCfsQuota", "type": "bool"}, + "cpu_cfs_quota_period": {"key": "cpuCfsQuotaPeriod", "type": "str"}, + "image_gc_high_threshold": {"key": "imageGcHighThreshold", "type": "int"}, + "image_gc_low_threshold": {"key": "imageGcLowThreshold", "type": "int"}, + "topology_manager_policy": {"key": "topologyManagerPolicy", "type": "str"}, + "allowed_unsafe_sysctls": {"key": "allowedUnsafeSysctls", "type": "[str]"}, + "fail_swap_on": {"key": "failSwapOn", "type": "bool"}, + "container_log_max_size_mb": {"key": "containerLogMaxSizeMB", "type": "int"}, + "container_log_max_files": {"key": "containerLogMaxFiles", "type": "int"}, + "pod_max_pids": {"key": "podMaxPids", "type": "int"}, } def __init__( @@ -1625,7 +1566,7 @@ def __init__( :keyword pod_max_pids: The maximum number of processes per pod. :paramtype pod_max_pids: int """ - super(KubeletConfig, self).__init__(**kwargs) + super().__init__(**kwargs) self.cpu_manager_policy = cpu_manager_policy self.cpu_cfs_quota = cpu_cfs_quota self.cpu_cfs_quota_period = cpu_cfs_quota_period @@ -1639,7 +1580,7 @@ def __init__( self.pod_max_pids = pod_max_pids -class LinuxOSConfig(msrest.serialization.Model): +class LinuxOSConfig(_serialization.Model): """See `AKS custom node configuration `_ for more details. :ivar sysctls: Sysctl settings for Linux agent nodes. @@ -1658,10 +1599,10 @@ class LinuxOSConfig(msrest.serialization.Model): """ _attribute_map = { - 'sysctls': {'key': 'sysctls', 'type': 'SysctlConfig'}, - 'transparent_huge_page_enabled': {'key': 'transparentHugePageEnabled', 'type': 'str'}, - 'transparent_huge_page_defrag': {'key': 'transparentHugePageDefrag', 'type': 'str'}, - 'swap_file_size_mb': {'key': 'swapFileSizeMB', 'type': 'int'}, + "sysctls": {"key": "sysctls", "type": "SysctlConfig"}, + "transparent_huge_page_enabled": {"key": "transparentHugePageEnabled", "type": "str"}, + "transparent_huge_page_defrag": {"key": "transparentHugePageDefrag", "type": "str"}, + "swap_file_size_mb": {"key": "swapFileSizeMB", "type": "int"}, } def __init__( @@ -1688,7 +1629,7 @@ def __init__( :keyword swap_file_size_mb: The size in MB of a swap file that will be created on each node. :paramtype swap_file_size_mb: int """ - super(LinuxOSConfig, self).__init__(**kwargs) + super().__init__(**kwargs) self.sysctls = sysctls self.transparent_huge_page_enabled = transparent_huge_page_enabled self.transparent_huge_page_defrag = transparent_huge_page_defrag @@ -1717,19 +1658,19 @@ class MaintenanceConfiguration(SubResource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, + "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'}, - 'time_in_week': {'key': 'properties.timeInWeek', 'type': '[TimeInWeek]'}, - 'not_allowed_time': {'key': 'properties.notAllowedTime', 'type': '[TimeSpan]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "time_in_week": {"key": "properties.timeInWeek", "type": "[TimeInWeek]"}, + "not_allowed_time": {"key": "properties.notAllowedTime", "type": "[TimeSpan]"}, } def __init__( @@ -1746,13 +1687,13 @@ def __init__( :keyword not_allowed_time: Time slots on which upgrade is not allowed. :paramtype not_allowed_time: list[~azure.mgmt.containerservice.v2022_04_01.models.TimeSpan] """ - super(MaintenanceConfiguration, self).__init__(**kwargs) + super().__init__(**kwargs) self.system_data = None self.time_in_week = time_in_week self.not_allowed_time = not_allowed_time -class MaintenanceConfigurationListResult(msrest.serialization.Model): +class MaintenanceConfigurationListResult(_serialization.Model): """The response from the List maintenance configurations operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -1764,31 +1705,26 @@ class MaintenanceConfigurationListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[MaintenanceConfiguration]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[MaintenanceConfiguration]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.MaintenanceConfiguration"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.MaintenanceConfiguration"]] = None, **kwargs): """ :keyword value: The list of maintenance configurations. :paramtype value: list[~azure.mgmt.containerservice.v2022_04_01.models.MaintenanceConfiguration] """ - super(MaintenanceConfigurationListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class Resource(msrest.serialization.Model): +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. @@ -1807,26 +1743,22 @@ class Resource(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, + "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'}, + "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 - ): - """ - """ - super(Resource, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -1851,48 +1783,42 @@ class TrackedResource(Resource): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.containerservice.v2022_04_01.models.SystemData - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] - :ivar location: Required. The geo-location where the resource lives. + :ivar location: The geo-location where the resource lives. Required. :vartype location: str """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'location': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, } - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] - :keyword location: Required. The geo-location where the resource lives. + :keyword location: The geo-location where the resource lives. Required. :paramtype location: str """ - super(TrackedResource, self).__init__(**kwargs) + super().__init__(**kwargs) self.tags = tags self.location = location -class ManagedCluster(TrackedResource): +class ManagedCluster(TrackedResource): # pylint: disable=too-many-instance-attributes """Managed cluster. Variables are only populated by the server, and will be ignored when sending a request. @@ -1910,9 +1836,9 @@ class ManagedCluster(TrackedResource): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.containerservice.v2022_04_01.models.SystemData - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] - :ivar location: Required. The geo-location where the resource lives. + :ivar location: The geo-location where the resource lives. Required. :vartype location: str :ivar sku: The managed cluster SKU. :vartype sku: ~azure.mgmt.containerservice.v2022_04_01.models.ManagedClusterSKU @@ -2019,71 +1945,80 @@ class ManagedCluster(TrackedResource): :vartype storage_profile: ~azure.mgmt.containerservice.v2022_04_01.models.ManagedClusterStorageProfile :ivar public_network_access: Allow or deny public network access for AKS. Known values are: - "Enabled", "Disabled". + "Enabled" and "Disabled". :vartype public_network_access: str or ~azure.mgmt.containerservice.v2022_04_01.models.PublicNetworkAccess """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'location': {'required': True}, - 'provisioning_state': {'readonly': True}, - 'power_state': {'readonly': True}, - 'max_agent_pools': {'readonly': True}, - 'current_kubernetes_version': {'readonly': True}, - 'fqdn': {'readonly': True}, - 'private_fqdn': {'readonly': True}, - 'azure_portal_fqdn': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, + "provisioning_state": {"readonly": True}, + "power_state": {"readonly": True}, + "max_agent_pools": {"readonly": True}, + "current_kubernetes_version": {"readonly": True}, + "fqdn": {"readonly": True}, + "private_fqdn": {"readonly": True}, + "azure_portal_fqdn": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'ManagedClusterSKU'}, - 'extended_location': {'key': 'extendedLocation', 'type': 'ExtendedLocation'}, - 'identity': {'key': 'identity', 'type': 'ManagedClusterIdentity'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'power_state': {'key': 'properties.powerState', 'type': 'PowerState'}, - 'max_agent_pools': {'key': 'properties.maxAgentPools', 'type': 'int'}, - 'kubernetes_version': {'key': 'properties.kubernetesVersion', 'type': 'str'}, - 'current_kubernetes_version': {'key': 'properties.currentKubernetesVersion', 'type': 'str'}, - 'dns_prefix': {'key': 'properties.dnsPrefix', 'type': 'str'}, - 'fqdn_subdomain': {'key': 'properties.fqdnSubdomain', 'type': 'str'}, - 'fqdn': {'key': 'properties.fqdn', 'type': 'str'}, - 'private_fqdn': {'key': 'properties.privateFQDN', 'type': 'str'}, - 'azure_portal_fqdn': {'key': 'properties.azurePortalFQDN', 'type': 'str'}, - 'agent_pool_profiles': {'key': 'properties.agentPoolProfiles', 'type': '[ManagedClusterAgentPoolProfile]'}, - 'linux_profile': {'key': 'properties.linuxProfile', 'type': 'ContainerServiceLinuxProfile'}, - 'windows_profile': {'key': 'properties.windowsProfile', 'type': 'ManagedClusterWindowsProfile'}, - 'service_principal_profile': {'key': 'properties.servicePrincipalProfile', 'type': 'ManagedClusterServicePrincipalProfile'}, - 'addon_profiles': {'key': 'properties.addonProfiles', 'type': '{ManagedClusterAddonProfile}'}, - 'pod_identity_profile': {'key': 'properties.podIdentityProfile', 'type': 'ManagedClusterPodIdentityProfile'}, - 'node_resource_group': {'key': 'properties.nodeResourceGroup', 'type': 'str'}, - 'enable_rbac': {'key': 'properties.enableRBAC', 'type': 'bool'}, - 'enable_pod_security_policy': {'key': 'properties.enablePodSecurityPolicy', 'type': 'bool'}, - 'network_profile': {'key': 'properties.networkProfile', 'type': 'ContainerServiceNetworkProfile'}, - 'aad_profile': {'key': 'properties.aadProfile', 'type': 'ManagedClusterAADProfile'}, - 'auto_upgrade_profile': {'key': 'properties.autoUpgradeProfile', 'type': 'ManagedClusterAutoUpgradeProfile'}, - 'auto_scaler_profile': {'key': 'properties.autoScalerProfile', 'type': 'ManagedClusterPropertiesAutoScalerProfile'}, - 'api_server_access_profile': {'key': 'properties.apiServerAccessProfile', 'type': 'ManagedClusterAPIServerAccessProfile'}, - 'disk_encryption_set_id': {'key': 'properties.diskEncryptionSetID', 'type': 'str'}, - 'identity_profile': {'key': 'properties.identityProfile', 'type': '{UserAssignedIdentity}'}, - 'private_link_resources': {'key': 'properties.privateLinkResources', 'type': '[PrivateLinkResource]'}, - 'disable_local_accounts': {'key': 'properties.disableLocalAccounts', 'type': 'bool'}, - 'http_proxy_config': {'key': 'properties.httpProxyConfig', 'type': 'ManagedClusterHTTPProxyConfig'}, - 'security_profile': {'key': 'properties.securityProfile', 'type': 'ManagedClusterSecurityProfile'}, - 'storage_profile': {'key': 'properties.storageProfile', 'type': 'ManagedClusterStorageProfile'}, - 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, - } - - def __init__( + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "sku": {"key": "sku", "type": "ManagedClusterSKU"}, + "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, + "identity": {"key": "identity", "type": "ManagedClusterIdentity"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "power_state": {"key": "properties.powerState", "type": "PowerState"}, + "max_agent_pools": {"key": "properties.maxAgentPools", "type": "int"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "current_kubernetes_version": {"key": "properties.currentKubernetesVersion", "type": "str"}, + "dns_prefix": {"key": "properties.dnsPrefix", "type": "str"}, + "fqdn_subdomain": {"key": "properties.fqdnSubdomain", "type": "str"}, + "fqdn": {"key": "properties.fqdn", "type": "str"}, + "private_fqdn": {"key": "properties.privateFQDN", "type": "str"}, + "azure_portal_fqdn": {"key": "properties.azurePortalFQDN", "type": "str"}, + "agent_pool_profiles": {"key": "properties.agentPoolProfiles", "type": "[ManagedClusterAgentPoolProfile]"}, + "linux_profile": {"key": "properties.linuxProfile", "type": "ContainerServiceLinuxProfile"}, + "windows_profile": {"key": "properties.windowsProfile", "type": "ManagedClusterWindowsProfile"}, + "service_principal_profile": { + "key": "properties.servicePrincipalProfile", + "type": "ManagedClusterServicePrincipalProfile", + }, + "addon_profiles": {"key": "properties.addonProfiles", "type": "{ManagedClusterAddonProfile}"}, + "pod_identity_profile": {"key": "properties.podIdentityProfile", "type": "ManagedClusterPodIdentityProfile"}, + "node_resource_group": {"key": "properties.nodeResourceGroup", "type": "str"}, + "enable_rbac": {"key": "properties.enableRBAC", "type": "bool"}, + "enable_pod_security_policy": {"key": "properties.enablePodSecurityPolicy", "type": "bool"}, + "network_profile": {"key": "properties.networkProfile", "type": "ContainerServiceNetworkProfile"}, + "aad_profile": {"key": "properties.aadProfile", "type": "ManagedClusterAADProfile"}, + "auto_upgrade_profile": {"key": "properties.autoUpgradeProfile", "type": "ManagedClusterAutoUpgradeProfile"}, + "auto_scaler_profile": { + "key": "properties.autoScalerProfile", + "type": "ManagedClusterPropertiesAutoScalerProfile", + }, + "api_server_access_profile": { + "key": "properties.apiServerAccessProfile", + "type": "ManagedClusterAPIServerAccessProfile", + }, + "disk_encryption_set_id": {"key": "properties.diskEncryptionSetID", "type": "str"}, + "identity_profile": {"key": "properties.identityProfile", "type": "{UserAssignedIdentity}"}, + "private_link_resources": {"key": "properties.privateLinkResources", "type": "[PrivateLinkResource]"}, + "disable_local_accounts": {"key": "properties.disableLocalAccounts", "type": "bool"}, + "http_proxy_config": {"key": "properties.httpProxyConfig", "type": "ManagedClusterHTTPProxyConfig"}, + "security_profile": {"key": "properties.securityProfile", "type": "ManagedClusterSecurityProfile"}, + "storage_profile": {"key": "properties.storageProfile", "type": "ManagedClusterStorageProfile"}, + "public_network_access": {"key": "properties.publicNetworkAccess", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, location: str, @@ -2119,9 +2054,9 @@ def __init__( **kwargs ): """ - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] - :keyword location: Required. The geo-location where the resource lives. + :keyword location: The geo-location where the resource lives. Required. :paramtype location: str :keyword sku: The managed cluster SKU. :paramtype sku: ~azure.mgmt.containerservice.v2022_04_01.models.ManagedClusterSKU @@ -2212,11 +2147,11 @@ def __init__( :paramtype storage_profile: ~azure.mgmt.containerservice.v2022_04_01.models.ManagedClusterStorageProfile :keyword public_network_access: Allow or deny public network access for AKS. Known values are: - "Enabled", "Disabled". + "Enabled" and "Disabled". :paramtype public_network_access: str or ~azure.mgmt.containerservice.v2022_04_01.models.PublicNetworkAccess """ - super(ManagedCluster, self).__init__(tags=tags, location=location, **kwargs) + super().__init__(tags=tags, location=location, **kwargs) self.sku = sku self.extended_location = extended_location self.identity = identity @@ -2254,7 +2189,7 @@ def __init__( self.public_network_access = public_network_access -class ManagedClusterAADProfile(msrest.serialization.Model): +class ManagedClusterAADProfile(_serialization.Model): """For more details see `managed AAD on AKS `_. :ivar managed: Whether to enable managed AAD. @@ -2276,13 +2211,13 @@ class ManagedClusterAADProfile(msrest.serialization.Model): """ _attribute_map = { - 'managed': {'key': 'managed', 'type': 'bool'}, - 'enable_azure_rbac': {'key': 'enableAzureRBAC', 'type': 'bool'}, - 'admin_group_object_i_ds': {'key': 'adminGroupObjectIDs', 'type': '[str]'}, - 'client_app_id': {'key': 'clientAppID', 'type': 'str'}, - 'server_app_id': {'key': 'serverAppID', 'type': 'str'}, - 'server_app_secret': {'key': 'serverAppSecret', 'type': 'str'}, - 'tenant_id': {'key': 'tenantID', 'type': 'str'}, + "managed": {"key": "managed", "type": "bool"}, + "enable_azure_rbac": {"key": "enableAzureRBAC", "type": "bool"}, + "admin_group_object_i_ds": {"key": "adminGroupObjectIDs", "type": "[str]"}, + "client_app_id": {"key": "clientAppID", "type": "str"}, + "server_app_id": {"key": "serverAppID", "type": "str"}, + "server_app_secret": {"key": "serverAppSecret", "type": "str"}, + "tenant_id": {"key": "tenantID", "type": "str"}, } def __init__( @@ -2315,7 +2250,7 @@ def __init__( tenant of the deployment subscription. :paramtype tenant_id: str """ - super(ManagedClusterAADProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.managed = managed self.enable_azure_rbac = enable_azure_rbac self.admin_group_object_i_ds = admin_group_object_i_ds @@ -2343,60 +2278,55 @@ class ManagedClusterAccessProfile(TrackedResource): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.containerservice.v2022_04_01.models.SystemData - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] - :ivar location: Required. The geo-location where the resource lives. + :ivar location: The geo-location where the resource lives. Required. :vartype location: str :ivar kube_config: Base64-encoded Kubernetes configuration file. - :vartype kube_config: bytearray + :vartype kube_config: bytes """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'location': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - 'kube_config': {'key': 'properties.kubeConfig', 'type': 'bytearray'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "kube_config": {"key": "properties.kubeConfig", "type": "bytearray"}, } def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - kube_config: Optional[bytearray] = None, - **kwargs + self, *, location: str, tags: Optional[Dict[str, str]] = None, kube_config: Optional[bytes] = None, **kwargs ): """ - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] - :keyword location: Required. The geo-location where the resource lives. + :keyword location: The geo-location where the resource lives. Required. :paramtype location: str :keyword kube_config: Base64-encoded Kubernetes configuration file. - :paramtype kube_config: bytearray + :paramtype kube_config: bytes """ - super(ManagedClusterAccessProfile, self).__init__(tags=tags, location=location, **kwargs) + super().__init__(tags=tags, location=location, **kwargs) self.kube_config = kube_config -class ManagedClusterAddonProfile(msrest.serialization.Model): +class ManagedClusterAddonProfile(_serialization.Model): """A Kubernetes add-on profile for a managed cluster. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar enabled: Required. Whether the add-on is enabled or not. + :ivar enabled: Whether the add-on is enabled or not. Required. :vartype enabled: bool :ivar config: Key-value pairs for configuring an add-on. :vartype config: dict[str, str] @@ -2406,36 +2336,30 @@ class ManagedClusterAddonProfile(msrest.serialization.Model): """ _validation = { - 'enabled': {'required': True}, - 'identity': {'readonly': True}, + "enabled": {"required": True}, + "identity": {"readonly": True}, } _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'config': {'key': 'config', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'ManagedClusterAddonProfileIdentity'}, + "enabled": {"key": "enabled", "type": "bool"}, + "config": {"key": "config", "type": "{str}"}, + "identity": {"key": "identity", "type": "ManagedClusterAddonProfileIdentity"}, } - def __init__( - self, - *, - enabled: bool, - config: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, enabled: bool, config: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword enabled: Required. Whether the add-on is enabled or not. + :keyword enabled: Whether the add-on is enabled or not. Required. :paramtype enabled: bool :keyword config: Key-value pairs for configuring an add-on. :paramtype config: dict[str, str] """ - super(ManagedClusterAddonProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.config = config self.identity = None -class UserAssignedIdentity(msrest.serialization.Model): +class UserAssignedIdentity(_serialization.Model): """Details about a user assigned identity. :ivar resource_id: The resource ID of the user assigned identity. @@ -2447,9 +2371,9 @@ class UserAssignedIdentity(msrest.serialization.Model): """ _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'object_id': {'key': 'objectId', 'type': 'str'}, + "resource_id": {"key": "resourceId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + "object_id": {"key": "objectId", "type": "str"}, } def __init__( @@ -2468,7 +2392,7 @@ def __init__( :keyword object_id: The object ID of the user assigned identity. :paramtype object_id: str """ - super(UserAssignedIdentity, self).__init__(**kwargs) + super().__init__(**kwargs) self.resource_id = resource_id self.client_id = client_id self.object_id = object_id @@ -2486,9 +2410,9 @@ class ManagedClusterAddonProfileIdentity(UserAssignedIdentity): """ _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'object_id': {'key': 'objectId', 'type': 'str'}, + "resource_id": {"key": "resourceId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + "object_id": {"key": "objectId", "type": "str"}, } def __init__( @@ -2507,10 +2431,10 @@ def __init__( :keyword object_id: The object ID of the user assigned identity. :paramtype object_id: str """ - super(ManagedClusterAddonProfileIdentity, self).__init__(resource_id=resource_id, client_id=client_id, object_id=object_id, **kwargs) + super().__init__(resource_id=resource_id, client_id=client_id, object_id=object_id, **kwargs) -class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): +class ManagedClusterAgentPoolProfileProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes """Properties for the container service agent pool profile. Variables are only populated by the server, and will be ignored when sending a request. @@ -2531,14 +2455,14 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2022_04_01.models.OSDiskType :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data - root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_04_01.models.KubeletDiskType :ivar workload_runtime: Determines the type of workload a node can run. Known values are: - "OCIContainer", "WasmWasi". + "OCIContainer" and "WasmWasi". :vartype workload_runtime: str or ~azure.mgmt.containerservice.v2022_04_01.models.WorkloadRuntime :ivar vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and used. @@ -2552,11 +2476,11 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :vartype pod_subnet_id: str :ivar max_pods: The maximum number of pods that can run on a node. :vartype max_pods: int - :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_04_01.models.OSType :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known - values are: "Ubuntu", "CBLMariner". + values are: "Ubuntu" and "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2022_04_01.models.OSSKU :ivar max_count: The maximum number of nodes for auto-scaling. :vartype max_count: int @@ -2565,14 +2489,14 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it - defaults to Delete. Known values are: "Delete", "Deallocate". + defaults to Delete. Known values are: "Delete" and "Deallocate". :vartype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_04_01.models.ScaleDownMode - :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", + :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets" and "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2022_04_01.models.AgentPoolType :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :vartype mode: str or ~azure.mgmt.containerservice.v2022_04_01.models.AgentPoolMode :ivar orchestrator_version: Both patch version (e.g. 1.20.13) and (e.g. 1.20) are supported. When is specified, the latest supported @@ -2615,20 +2539,18 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default - is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + is 'Regular'. Known values are: "Spot" and "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_04_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_04_01.models.ScaleSetEvictionPolicy :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :vartype spot_max_price: float - :ivar tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :ivar tags: The tags to be persisted on the agent pool virtual machine scale set. :vartype tags: dict[str, str] :ivar node_labels: The node labels to be persisted across all nodes in agent pool. :vartype node_labels: dict[str, str] @@ -2652,7 +2574,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): for more details. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_04_01.models.GPUInstanceProfile :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the node pool @@ -2661,56 +2583,56 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): """ _validation = { - 'os_disk_size_gb': {'maximum': 2048, 'minimum': 0}, - 'current_orchestrator_version': {'readonly': True}, - 'node_image_version': {'readonly': True}, - 'provisioning_state': {'readonly': True}, + "os_disk_size_gb": {"maximum": 2048, "minimum": 0}, + "current_orchestrator_version": {"readonly": True}, + "node_image_version": {"readonly": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'os_disk_type': {'key': 'osDiskType', 'type': 'str'}, - 'kubelet_disk_type': {'key': 'kubeletDiskType', 'type': 'str'}, - 'workload_runtime': {'key': 'workloadRuntime', 'type': 'str'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'pod_subnet_id': {'key': 'podSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'maxPods', 'type': 'int'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'os_sku': {'key': 'osSKU', 'type': 'str'}, - 'max_count': {'key': 'maxCount', 'type': 'int'}, - 'min_count': {'key': 'minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'enableAutoScaling', 'type': 'bool'}, - 'scale_down_mode': {'key': 'scaleDownMode', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'mode': {'key': 'mode', 'type': 'str'}, - 'orchestrator_version': {'key': 'orchestratorVersion', 'type': 'str'}, - 'current_orchestrator_version': {'key': 'currentOrchestratorVersion', 'type': 'str'}, - 'node_image_version': {'key': 'nodeImageVersion', 'type': 'str'}, - 'upgrade_settings': {'key': 'upgradeSettings', 'type': 'AgentPoolUpgradeSettings'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'power_state': {'key': 'powerState', 'type': 'PowerState'}, - 'availability_zones': {'key': 'availabilityZones', 'type': '[str]'}, - 'enable_node_public_ip': {'key': 'enableNodePublicIP', 'type': 'bool'}, - 'node_public_ip_prefix_id': {'key': 'nodePublicIPPrefixID', 'type': 'str'}, - 'scale_set_priority': {'key': 'scaleSetPriority', 'type': 'str'}, - 'scale_set_eviction_policy': {'key': 'scaleSetEvictionPolicy', 'type': 'str'}, - 'spot_max_price': {'key': 'spotMaxPrice', 'type': 'float'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'node_labels': {'key': 'nodeLabels', 'type': '{str}'}, - 'node_taints': {'key': 'nodeTaints', 'type': '[str]'}, - 'proximity_placement_group_id': {'key': 'proximityPlacementGroupID', 'type': 'str'}, - 'kubelet_config': {'key': 'kubeletConfig', 'type': 'KubeletConfig'}, - 'linux_os_config': {'key': 'linuxOSConfig', 'type': 'LinuxOSConfig'}, - 'enable_encryption_at_host': {'key': 'enableEncryptionAtHost', 'type': 'bool'}, - 'enable_ultra_ssd': {'key': 'enableUltraSSD', 'type': 'bool'}, - 'enable_fips': {'key': 'enableFIPS', 'type': 'bool'}, - 'gpu_instance_profile': {'key': 'gpuInstanceProfile', 'type': 'str'}, - 'creation_data': {'key': 'creationData', 'type': 'CreationData'}, - } - - def __init__( + "count": {"key": "count", "type": "int"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "os_disk_type": {"key": "osDiskType", "type": "str"}, + "kubelet_disk_type": {"key": "kubeletDiskType", "type": "str"}, + "workload_runtime": {"key": "workloadRuntime", "type": "str"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "pod_subnet_id": {"key": "podSubnetID", "type": "str"}, + "max_pods": {"key": "maxPods", "type": "int"}, + "os_type": {"key": "osType", "type": "str"}, + "os_sku": {"key": "osSKU", "type": "str"}, + "max_count": {"key": "maxCount", "type": "int"}, + "min_count": {"key": "minCount", "type": "int"}, + "enable_auto_scaling": {"key": "enableAutoScaling", "type": "bool"}, + "scale_down_mode": {"key": "scaleDownMode", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "mode": {"key": "mode", "type": "str"}, + "orchestrator_version": {"key": "orchestratorVersion", "type": "str"}, + "current_orchestrator_version": {"key": "currentOrchestratorVersion", "type": "str"}, + "node_image_version": {"key": "nodeImageVersion", "type": "str"}, + "upgrade_settings": {"key": "upgradeSettings", "type": "AgentPoolUpgradeSettings"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "power_state": {"key": "powerState", "type": "PowerState"}, + "availability_zones": {"key": "availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "enableNodePublicIP", "type": "bool"}, + "node_public_ip_prefix_id": {"key": "nodePublicIPPrefixID", "type": "str"}, + "scale_set_priority": {"key": "scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "scaleSetEvictionPolicy", "type": "str"}, + "spot_max_price": {"key": "spotMaxPrice", "type": "float"}, + "tags": {"key": "tags", "type": "{str}"}, + "node_labels": {"key": "nodeLabels", "type": "{str}"}, + "node_taints": {"key": "nodeTaints", "type": "[str]"}, + "proximity_placement_group_id": {"key": "proximityPlacementGroupID", "type": "str"}, + "kubelet_config": {"key": "kubeletConfig", "type": "KubeletConfig"}, + "linux_os_config": {"key": "linuxOSConfig", "type": "LinuxOSConfig"}, + "enable_encryption_at_host": {"key": "enableEncryptionAtHost", "type": "bool"}, + "enable_ultra_ssd": {"key": "enableUltraSSD", "type": "bool"}, + "enable_fips": {"key": "enableFIPS", "type": "bool"}, + "gpu_instance_profile": {"key": "gpuInstanceProfile", "type": "str"}, + "creation_data": {"key": "creationData", "type": "CreationData"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, count: Optional[int] = None, @@ -2722,7 +2644,7 @@ def __init__( vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, @@ -2736,9 +2658,9 @@ def __init__( availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", - spot_max_price: Optional[float] = -1, + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", + spot_max_price: float = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, @@ -2769,14 +2691,14 @@ def __init__( larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2022_04_01.models.OSDiskType :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime - data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + data root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_04_01.models.KubeletDiskType :keyword workload_runtime: Determines the type of workload a node can run. Known values are: - "OCIContainer", "WasmWasi". + "OCIContainer" and "WasmWasi". :paramtype workload_runtime: str or ~azure.mgmt.containerservice.v2022_04_01.models.WorkloadRuntime :keyword vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and @@ -2790,11 +2712,11 @@ def __init__( :paramtype pod_subnet_id: str :keyword max_pods: The maximum number of pods that can run on a node. :paramtype max_pods: int - :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_04_01.models.OSType :keyword os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Known values are: "Ubuntu", "CBLMariner". + Known values are: "Ubuntu" and "CBLMariner". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2022_04_01.models.OSSKU :keyword max_count: The maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -2803,15 +2725,15 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, - it defaults to Delete. Known values are: "Delete", "Deallocate". + it defaults to Delete. Known values are: "Delete" and "Deallocate". :paramtype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_04_01.models.ScaleDownMode - :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", + :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2022_04_01.models.AgentPoolType :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2022_04_01.models.AgentPoolMode :keyword orchestrator_version: Both patch version (e.g. 1.20.13) and (e.g. 1.20) are supported. When is specified, the latest supported @@ -2846,20 +2768,18 @@ def __init__( /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the - default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + default is 'Regular'. Known values are: "Spot" and "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_04_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_04_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :paramtype spot_max_price: float - :keyword tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :keyword tags: The tags to be persisted on the agent pool virtual machine scale set. :paramtype tags: dict[str, str] :keyword node_labels: The node labels to be persisted across all nodes in agent pool. :paramtype node_labels: dict[str, str] @@ -2883,7 +2803,7 @@ def __init__( for more details. :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance - profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_04_01.models.GPUInstanceProfile @@ -2891,7 +2811,7 @@ def __init__( pool will be created/upgraded using a snapshot. :paramtype creation_data: ~azure.mgmt.containerservice.v2022_04_01.models.CreationData """ - super(ManagedClusterAgentPoolProfileProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.vm_size = vm_size self.os_disk_size_gb = os_disk_size_gb @@ -2934,7 +2854,9 @@ def __init__( self.creation_data = creation_data -class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): +class ManagedClusterAgentPoolProfile( + ManagedClusterAgentPoolProfileProperties +): # pylint: disable=too-many-instance-attributes """Profile for the container service agent pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -2957,14 +2879,14 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2022_04_01.models.OSDiskType :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data - root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_04_01.models.KubeletDiskType :ivar workload_runtime: Determines the type of workload a node can run. Known values are: - "OCIContainer", "WasmWasi". + "OCIContainer" and "WasmWasi". :vartype workload_runtime: str or ~azure.mgmt.containerservice.v2022_04_01.models.WorkloadRuntime :ivar vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and used. @@ -2978,11 +2900,11 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :vartype pod_subnet_id: str :ivar max_pods: The maximum number of pods that can run on a node. :vartype max_pods: int - :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_04_01.models.OSType :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known - values are: "Ubuntu", "CBLMariner". + values are: "Ubuntu" and "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2022_04_01.models.OSSKU :ivar max_count: The maximum number of nodes for auto-scaling. :vartype max_count: int @@ -2991,14 +2913,14 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it - defaults to Delete. Known values are: "Delete", "Deallocate". + defaults to Delete. Known values are: "Delete" and "Deallocate". :vartype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_04_01.models.ScaleDownMode - :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", + :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets" and "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2022_04_01.models.AgentPoolType :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :vartype mode: str or ~azure.mgmt.containerservice.v2022_04_01.models.AgentPoolMode :ivar orchestrator_version: Both patch version (e.g. 1.20.13) and (e.g. 1.20) are supported. When is specified, the latest supported @@ -3041,20 +2963,18 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default - is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + is 'Regular'. Known values are: "Spot" and "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_04_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_04_01.models.ScaleSetEvictionPolicy :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :vartype spot_max_price: float - :ivar tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :ivar tags: The tags to be persisted on the agent pool virtual machine scale set. :vartype tags: dict[str, str] :ivar node_labels: The node labels to be persisted across all nodes in agent pool. :vartype node_labels: dict[str, str] @@ -3078,69 +2998,69 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): for more details. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_04_01.models.GPUInstanceProfile :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the node pool will be created/upgraded using a snapshot. :vartype creation_data: ~azure.mgmt.containerservice.v2022_04_01.models.CreationData - :ivar name: Required. Windows agent pool names must be 6 characters or less. + :ivar name: Windows agent pool names must be 6 characters or less. Required. :vartype name: str """ _validation = { - 'os_disk_size_gb': {'maximum': 2048, 'minimum': 0}, - 'current_orchestrator_version': {'readonly': True}, - 'node_image_version': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'name': {'required': True, 'pattern': r'^[a-z][a-z0-9]{0,11}$'}, + "os_disk_size_gb": {"maximum": 2048, "minimum": 0}, + "current_orchestrator_version": {"readonly": True}, + "node_image_version": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "name": {"required": True, "pattern": r"^[a-z][a-z0-9]{0,11}$"}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'os_disk_type': {'key': 'osDiskType', 'type': 'str'}, - 'kubelet_disk_type': {'key': 'kubeletDiskType', 'type': 'str'}, - 'workload_runtime': {'key': 'workloadRuntime', 'type': 'str'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'pod_subnet_id': {'key': 'podSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'maxPods', 'type': 'int'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'os_sku': {'key': 'osSKU', 'type': 'str'}, - 'max_count': {'key': 'maxCount', 'type': 'int'}, - 'min_count': {'key': 'minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'enableAutoScaling', 'type': 'bool'}, - 'scale_down_mode': {'key': 'scaleDownMode', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'mode': {'key': 'mode', 'type': 'str'}, - 'orchestrator_version': {'key': 'orchestratorVersion', 'type': 'str'}, - 'current_orchestrator_version': {'key': 'currentOrchestratorVersion', 'type': 'str'}, - 'node_image_version': {'key': 'nodeImageVersion', 'type': 'str'}, - 'upgrade_settings': {'key': 'upgradeSettings', 'type': 'AgentPoolUpgradeSettings'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'power_state': {'key': 'powerState', 'type': 'PowerState'}, - 'availability_zones': {'key': 'availabilityZones', 'type': '[str]'}, - 'enable_node_public_ip': {'key': 'enableNodePublicIP', 'type': 'bool'}, - 'node_public_ip_prefix_id': {'key': 'nodePublicIPPrefixID', 'type': 'str'}, - 'scale_set_priority': {'key': 'scaleSetPriority', 'type': 'str'}, - 'scale_set_eviction_policy': {'key': 'scaleSetEvictionPolicy', 'type': 'str'}, - 'spot_max_price': {'key': 'spotMaxPrice', 'type': 'float'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'node_labels': {'key': 'nodeLabels', 'type': '{str}'}, - 'node_taints': {'key': 'nodeTaints', 'type': '[str]'}, - 'proximity_placement_group_id': {'key': 'proximityPlacementGroupID', 'type': 'str'}, - 'kubelet_config': {'key': 'kubeletConfig', 'type': 'KubeletConfig'}, - 'linux_os_config': {'key': 'linuxOSConfig', 'type': 'LinuxOSConfig'}, - 'enable_encryption_at_host': {'key': 'enableEncryptionAtHost', 'type': 'bool'}, - 'enable_ultra_ssd': {'key': 'enableUltraSSD', 'type': 'bool'}, - 'enable_fips': {'key': 'enableFIPS', 'type': 'bool'}, - 'gpu_instance_profile': {'key': 'gpuInstanceProfile', 'type': 'str'}, - 'creation_data': {'key': 'creationData', 'type': 'CreationData'}, - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( + "count": {"key": "count", "type": "int"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "os_disk_type": {"key": "osDiskType", "type": "str"}, + "kubelet_disk_type": {"key": "kubeletDiskType", "type": "str"}, + "workload_runtime": {"key": "workloadRuntime", "type": "str"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "pod_subnet_id": {"key": "podSubnetID", "type": "str"}, + "max_pods": {"key": "maxPods", "type": "int"}, + "os_type": {"key": "osType", "type": "str"}, + "os_sku": {"key": "osSKU", "type": "str"}, + "max_count": {"key": "maxCount", "type": "int"}, + "min_count": {"key": "minCount", "type": "int"}, + "enable_auto_scaling": {"key": "enableAutoScaling", "type": "bool"}, + "scale_down_mode": {"key": "scaleDownMode", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "mode": {"key": "mode", "type": "str"}, + "orchestrator_version": {"key": "orchestratorVersion", "type": "str"}, + "current_orchestrator_version": {"key": "currentOrchestratorVersion", "type": "str"}, + "node_image_version": {"key": "nodeImageVersion", "type": "str"}, + "upgrade_settings": {"key": "upgradeSettings", "type": "AgentPoolUpgradeSettings"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "power_state": {"key": "powerState", "type": "PowerState"}, + "availability_zones": {"key": "availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "enableNodePublicIP", "type": "bool"}, + "node_public_ip_prefix_id": {"key": "nodePublicIPPrefixID", "type": "str"}, + "scale_set_priority": {"key": "scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "scaleSetEvictionPolicy", "type": "str"}, + "spot_max_price": {"key": "spotMaxPrice", "type": "float"}, + "tags": {"key": "tags", "type": "{str}"}, + "node_labels": {"key": "nodeLabels", "type": "{str}"}, + "node_taints": {"key": "nodeTaints", "type": "[str]"}, + "proximity_placement_group_id": {"key": "proximityPlacementGroupID", "type": "str"}, + "kubelet_config": {"key": "kubeletConfig", "type": "KubeletConfig"}, + "linux_os_config": {"key": "linuxOSConfig", "type": "LinuxOSConfig"}, + "enable_encryption_at_host": {"key": "enableEncryptionAtHost", "type": "bool"}, + "enable_ultra_ssd": {"key": "enableUltraSSD", "type": "bool"}, + "enable_fips": {"key": "enableFIPS", "type": "bool"}, + "gpu_instance_profile": {"key": "gpuInstanceProfile", "type": "str"}, + "creation_data": {"key": "creationData", "type": "CreationData"}, + "name": {"key": "name", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, name: str, @@ -3153,7 +3073,7 @@ def __init__( vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, @@ -3167,9 +3087,9 @@ def __init__( availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", - spot_max_price: Optional[float] = -1, + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", + spot_max_price: float = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, @@ -3200,14 +3120,14 @@ def __init__( larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2022_04_01.models.OSDiskType :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime - data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + data root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_04_01.models.KubeletDiskType :keyword workload_runtime: Determines the type of workload a node can run. Known values are: - "OCIContainer", "WasmWasi". + "OCIContainer" and "WasmWasi". :paramtype workload_runtime: str or ~azure.mgmt.containerservice.v2022_04_01.models.WorkloadRuntime :keyword vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and @@ -3221,11 +3141,11 @@ def __init__( :paramtype pod_subnet_id: str :keyword max_pods: The maximum number of pods that can run on a node. :paramtype max_pods: int - :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_04_01.models.OSType :keyword os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Known values are: "Ubuntu", "CBLMariner". + Known values are: "Ubuntu" and "CBLMariner". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2022_04_01.models.OSSKU :keyword max_count: The maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -3234,15 +3154,15 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, - it defaults to Delete. Known values are: "Delete", "Deallocate". + it defaults to Delete. Known values are: "Delete" and "Deallocate". :paramtype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_04_01.models.ScaleDownMode - :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", + :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2022_04_01.models.AgentPoolType :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2022_04_01.models.AgentPoolMode :keyword orchestrator_version: Both patch version (e.g. 1.20.13) and (e.g. 1.20) are supported. When is specified, the latest supported @@ -3277,20 +3197,18 @@ def __init__( /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the - default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + default is 'Regular'. Known values are: "Spot" and "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_04_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_04_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :paramtype spot_max_price: float - :keyword tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :keyword tags: The tags to be persisted on the agent pool virtual machine scale set. :paramtype tags: dict[str, str] :keyword node_labels: The node labels to be persisted across all nodes in agent pool. :paramtype node_labels: dict[str, str] @@ -3314,21 +3232,60 @@ def __init__( for more details. :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance - profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_04_01.models.GPUInstanceProfile :keyword creation_data: CreationData to be used to specify the source Snapshot ID if the node pool will be created/upgraded using a snapshot. :paramtype creation_data: ~azure.mgmt.containerservice.v2022_04_01.models.CreationData - :keyword name: Required. Windows agent pool names must be 6 characters or less. + :keyword name: Windows agent pool names must be 6 characters or less. Required. :paramtype name: str """ - super(ManagedClusterAgentPoolProfile, self).__init__(count=count, vm_size=vm_size, os_disk_size_gb=os_disk_size_gb, os_disk_type=os_disk_type, kubelet_disk_type=kubelet_disk_type, workload_runtime=workload_runtime, vnet_subnet_id=vnet_subnet_id, pod_subnet_id=pod_subnet_id, max_pods=max_pods, os_type=os_type, os_sku=os_sku, max_count=max_count, min_count=min_count, enable_auto_scaling=enable_auto_scaling, scale_down_mode=scale_down_mode, type=type, mode=mode, orchestrator_version=orchestrator_version, upgrade_settings=upgrade_settings, power_state=power_state, availability_zones=availability_zones, enable_node_public_ip=enable_node_public_ip, node_public_ip_prefix_id=node_public_ip_prefix_id, scale_set_priority=scale_set_priority, scale_set_eviction_policy=scale_set_eviction_policy, spot_max_price=spot_max_price, tags=tags, node_labels=node_labels, node_taints=node_taints, proximity_placement_group_id=proximity_placement_group_id, kubelet_config=kubelet_config, linux_os_config=linux_os_config, enable_encryption_at_host=enable_encryption_at_host, enable_ultra_ssd=enable_ultra_ssd, enable_fips=enable_fips, gpu_instance_profile=gpu_instance_profile, creation_data=creation_data, **kwargs) + super().__init__( + count=count, + vm_size=vm_size, + os_disk_size_gb=os_disk_size_gb, + os_disk_type=os_disk_type, + kubelet_disk_type=kubelet_disk_type, + workload_runtime=workload_runtime, + vnet_subnet_id=vnet_subnet_id, + pod_subnet_id=pod_subnet_id, + max_pods=max_pods, + os_type=os_type, + os_sku=os_sku, + max_count=max_count, + min_count=min_count, + enable_auto_scaling=enable_auto_scaling, + scale_down_mode=scale_down_mode, + type=type, + mode=mode, + orchestrator_version=orchestrator_version, + upgrade_settings=upgrade_settings, + power_state=power_state, + availability_zones=availability_zones, + enable_node_public_ip=enable_node_public_ip, + node_public_ip_prefix_id=node_public_ip_prefix_id, + scale_set_priority=scale_set_priority, + scale_set_eviction_policy=scale_set_eviction_policy, + spot_max_price=spot_max_price, + tags=tags, + node_labels=node_labels, + node_taints=node_taints, + proximity_placement_group_id=proximity_placement_group_id, + kubelet_config=kubelet_config, + linux_os_config=linux_os_config, + enable_encryption_at_host=enable_encryption_at_host, + enable_ultra_ssd=enable_ultra_ssd, + enable_fips=enable_fips, + gpu_instance_profile=gpu_instance_profile, + creation_data=creation_data, + **kwargs + ) self.name = name -class ManagedClusterAPIServerAccessProfile(msrest.serialization.Model): +class ManagedClusterAPIServerAccessProfile(_serialization.Model): """Access profile for managed cluster API server. :ivar authorized_ip_ranges: IP ranges are specified in CIDR format, e.g. 137.117.106.88/29. @@ -3351,11 +3308,11 @@ class ManagedClusterAPIServerAccessProfile(msrest.serialization.Model): """ _attribute_map = { - 'authorized_ip_ranges': {'key': 'authorizedIPRanges', 'type': '[str]'}, - 'enable_private_cluster': {'key': 'enablePrivateCluster', 'type': 'bool'}, - 'private_dns_zone': {'key': 'privateDNSZone', 'type': 'str'}, - 'enable_private_cluster_public_fqdn': {'key': 'enablePrivateClusterPublicFQDN', 'type': 'bool'}, - 'disable_run_command': {'key': 'disableRunCommand', 'type': 'bool'}, + "authorized_ip_ranges": {"key": "authorizedIPRanges", "type": "[str]"}, + "enable_private_cluster": {"key": "enablePrivateCluster", "type": "bool"}, + "private_dns_zone": {"key": "privateDNSZone", "type": "str"}, + "enable_private_cluster_public_fqdn": {"key": "enablePrivateClusterPublicFQDN", "type": "bool"}, + "disable_run_command": {"key": "disableRunCommand", "type": "bool"}, } def __init__( @@ -3387,7 +3344,7 @@ def __init__( :keyword disable_run_command: Whether to disable run command for the cluster or not. :paramtype disable_run_command: bool """ - super(ManagedClusterAPIServerAccessProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.authorized_ip_ranges = authorized_ip_ranges self.enable_private_cluster = enable_private_cluster self.private_dns_zone = private_dns_zone @@ -3395,37 +3352,32 @@ def __init__( self.disable_run_command = disable_run_command -class ManagedClusterAutoUpgradeProfile(msrest.serialization.Model): +class ManagedClusterAutoUpgradeProfile(_serialization.Model): """Auto upgrade profile for a managed cluster. :ivar upgrade_channel: For more information see `setting the AKS cluster auto-upgrade channel `_. Known values - are: "rapid", "stable", "patch", "node-image", "none". + are: "rapid", "stable", "patch", "node-image", and "none". :vartype upgrade_channel: str or ~azure.mgmt.containerservice.v2022_04_01.models.UpgradeChannel """ _attribute_map = { - 'upgrade_channel': {'key': 'upgradeChannel', 'type': 'str'}, + "upgrade_channel": {"key": "upgradeChannel", "type": "str"}, } - def __init__( - self, - *, - upgrade_channel: Optional[Union[str, "_models.UpgradeChannel"]] = None, - **kwargs - ): + def __init__(self, *, upgrade_channel: Optional[Union[str, "_models.UpgradeChannel"]] = None, **kwargs): """ :keyword upgrade_channel: For more information see `setting the AKS cluster auto-upgrade channel `_. - Known values are: "rapid", "stable", "patch", "node-image", "none". + Known values are: "rapid", "stable", "patch", "node-image", and "none". :paramtype upgrade_channel: str or ~azure.mgmt.containerservice.v2022_04_01.models.UpgradeChannel """ - super(ManagedClusterAutoUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.upgrade_channel = upgrade_channel -class ManagedClusterHTTPProxyConfig(msrest.serialization.Model): +class ManagedClusterHTTPProxyConfig(_serialization.Model): """Cluster HTTP proxy configuration. :ivar http_proxy: The HTTP proxy server endpoint to use. @@ -3439,10 +3391,10 @@ class ManagedClusterHTTPProxyConfig(msrest.serialization.Model): """ _attribute_map = { - 'http_proxy': {'key': 'httpProxy', 'type': 'str'}, - 'https_proxy': {'key': 'httpsProxy', 'type': 'str'}, - 'no_proxy': {'key': 'noProxy', 'type': '[str]'}, - 'trusted_ca': {'key': 'trustedCa', 'type': 'str'}, + "http_proxy": {"key": "httpProxy", "type": "str"}, + "https_proxy": {"key": "httpsProxy", "type": "str"}, + "no_proxy": {"key": "noProxy", "type": "[str]"}, + "trusted_ca": {"key": "trustedCa", "type": "str"}, } def __init__( @@ -3464,14 +3416,14 @@ def __init__( :keyword trusted_ca: Alternative CA cert to use for connecting to proxy servers. :paramtype trusted_ca: str """ - super(ManagedClusterHTTPProxyConfig, self).__init__(**kwargs) + super().__init__(**kwargs) self.http_proxy = http_proxy self.https_proxy = https_proxy self.no_proxy = no_proxy self.trusted_ca = trusted_ca -class ManagedClusterIdentity(msrest.serialization.Model): +class ManagedClusterIdentity(_serialization.Model): """Identity for the managed cluster. Variables are only populated by the server, and will be ignored when sending a request. @@ -3484,7 +3436,7 @@ class ManagedClusterIdentity(msrest.serialization.Model): :vartype tenant_id: str :ivar type: For more information see `use managed identities in AKS `_. Known values are: - "SystemAssigned", "UserAssigned", "None". + "SystemAssigned", "UserAssigned", and "None". :vartype type: str or ~azure.mgmt.containerservice.v2022_04_01.models.ResourceIdentityType :ivar user_assigned_identities: The keys must be ARM resource IDs in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. @@ -3493,42 +3445,47 @@ class ManagedClusterIdentity(msrest.serialization.Model): """ _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, + "principal_id": {"readonly": True}, + "tenant_id": {"readonly": True}, } _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{ManagedServiceIdentityUserAssignedIdentitiesValue}'}, + "principal_id": {"key": "principalId", "type": "str"}, + "tenant_id": {"key": "tenantId", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "user_assigned_identities": { + "key": "userAssignedIdentities", + "type": "{ManagedServiceIdentityUserAssignedIdentitiesValue}", + }, } def __init__( self, *, type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, - user_assigned_identities: Optional[Dict[str, "_models.ManagedServiceIdentityUserAssignedIdentitiesValue"]] = None, + user_assigned_identities: Optional[ + Dict[str, "_models.ManagedServiceIdentityUserAssignedIdentitiesValue"] + ] = None, **kwargs ): """ :keyword type: For more information see `use managed identities in AKS `_. Known values are: - "SystemAssigned", "UserAssigned", "None". + "SystemAssigned", "UserAssigned", and "None". :paramtype type: str or ~azure.mgmt.containerservice.v2022_04_01.models.ResourceIdentityType :keyword user_assigned_identities: The keys must be ARM resource IDs in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. :paramtype user_assigned_identities: dict[str, ~azure.mgmt.containerservice.v2022_04_01.models.ManagedServiceIdentityUserAssignedIdentitiesValue] """ - super(ManagedClusterIdentity, self).__init__(**kwargs) + super().__init__(**kwargs) self.principal_id = None self.tenant_id = None self.type = type self.user_assigned_identities = user_assigned_identities -class ManagedClusterListResult(msrest.serialization.Model): +class ManagedClusterListResult(_serialization.Model): """The response from the List Managed Clusters operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -3540,30 +3497,25 @@ class ManagedClusterListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[ManagedCluster]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[ManagedCluster]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.ManagedCluster"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.ManagedCluster"]] = None, **kwargs): """ :keyword value: The list of managed clusters. :paramtype value: list[~azure.mgmt.containerservice.v2022_04_01.models.ManagedCluster] """ - super(ManagedClusterListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class ManagedClusterLoadBalancerProfile(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfile(_serialization.Model): """Profile of the managed cluster load balancer. :ivar managed_outbound_i_ps: Desired managed outbound IPs for the cluster load balancer. @@ -3592,18 +3544,24 @@ class ManagedClusterLoadBalancerProfile(msrest.serialization.Model): """ _validation = { - 'allocated_outbound_ports': {'maximum': 64000, 'minimum': 0}, - 'idle_timeout_in_minutes': {'maximum': 120, 'minimum': 4}, + "allocated_outbound_ports": {"maximum": 64000, "minimum": 0}, + "idle_timeout_in_minutes": {"maximum": 120, "minimum": 4}, } _attribute_map = { - 'managed_outbound_i_ps': {'key': 'managedOutboundIPs', 'type': 'ManagedClusterLoadBalancerProfileManagedOutboundIPs'}, - 'outbound_ip_prefixes': {'key': 'outboundIPPrefixes', 'type': 'ManagedClusterLoadBalancerProfileOutboundIPPrefixes'}, - 'outbound_i_ps': {'key': 'outboundIPs', 'type': 'ManagedClusterLoadBalancerProfileOutboundIPs'}, - 'effective_outbound_i_ps': {'key': 'effectiveOutboundIPs', 'type': '[ResourceReference]'}, - 'allocated_outbound_ports': {'key': 'allocatedOutboundPorts', 'type': 'int'}, - 'idle_timeout_in_minutes': {'key': 'idleTimeoutInMinutes', 'type': 'int'}, - 'enable_multiple_standard_load_balancers': {'key': 'enableMultipleStandardLoadBalancers', 'type': 'bool'}, + "managed_outbound_i_ps": { + "key": "managedOutboundIPs", + "type": "ManagedClusterLoadBalancerProfileManagedOutboundIPs", + }, + "outbound_ip_prefixes": { + "key": "outboundIPPrefixes", + "type": "ManagedClusterLoadBalancerProfileOutboundIPPrefixes", + }, + "outbound_i_ps": {"key": "outboundIPs", "type": "ManagedClusterLoadBalancerProfileOutboundIPs"}, + "effective_outbound_i_ps": {"key": "effectiveOutboundIPs", "type": "[ResourceReference]"}, + "allocated_outbound_ports": {"key": "allocatedOutboundPorts", "type": "int"}, + "idle_timeout_in_minutes": {"key": "idleTimeoutInMinutes", "type": "int"}, + "enable_multiple_standard_load_balancers": {"key": "enableMultipleStandardLoadBalancers", "type": "bool"}, } def __init__( @@ -3613,8 +3571,8 @@ def __init__( outbound_ip_prefixes: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPPrefixes"] = None, outbound_i_ps: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPs"] = None, effective_outbound_i_ps: Optional[List["_models.ResourceReference"]] = None, - allocated_outbound_ports: Optional[int] = 0, - idle_timeout_in_minutes: Optional[int] = 30, + allocated_outbound_ports: int = 0, + idle_timeout_in_minutes: int = 30, enable_multiple_standard_load_balancers: Optional[bool] = None, **kwargs ): @@ -3644,7 +3602,7 @@ def __init__( AKS cluster or not. :paramtype enable_multiple_standard_load_balancers: bool """ - super(ManagedClusterLoadBalancerProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.managed_outbound_i_ps = managed_outbound_i_ps self.outbound_ip_prefixes = outbound_ip_prefixes self.outbound_i_ps = outbound_i_ps @@ -3654,7 +3612,7 @@ def __init__( self.enable_multiple_standard_load_balancers = enable_multiple_standard_load_balancers -class ManagedClusterLoadBalancerProfileManagedOutboundIPs(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfileManagedOutboundIPs(_serialization.Model): """Desired managed outbound IPs for the cluster load balancer. :ivar count: The desired number of IPv4 outbound IPs created/managed by Azure for the cluster @@ -3668,22 +3626,16 @@ class ManagedClusterLoadBalancerProfileManagedOutboundIPs(msrest.serialization.M """ _validation = { - 'count': {'maximum': 100, 'minimum': 1}, - 'count_ipv6': {'maximum': 100, 'minimum': 0}, + "count": {"maximum": 100, "minimum": 1}, + "count_ipv6": {"maximum": 100, "minimum": 0}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'count_ipv6': {'key': 'countIPv6', 'type': 'int'}, + "count": {"key": "count", "type": "int"}, + "count_ipv6": {"key": "countIPv6", "type": "int"}, } - def __init__( - self, - *, - count: Optional[int] = 1, - count_ipv6: Optional[int] = 0, - **kwargs - ): + def __init__(self, *, count: int = 1, count_ipv6: int = 0, **kwargs): """ :keyword count: The desired number of IPv4 outbound IPs created/managed by Azure for the cluster load balancer. Allowed values must be in the range of 1 to 100 (inclusive). The default @@ -3694,12 +3646,12 @@ def __init__( value is 0 for single-stack and 1 for dual-stack. :paramtype count_ipv6: int """ - super(ManagedClusterLoadBalancerProfileManagedOutboundIPs, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.count_ipv6 = count_ipv6 -class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(_serialization.Model): """Desired outbound IP Prefix resources for the cluster load balancer. :ivar public_ip_prefixes: A list of public IP prefix resources. @@ -3708,25 +3660,20 @@ class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(msrest.serialization.M """ _attribute_map = { - 'public_ip_prefixes': {'key': 'publicIPPrefixes', 'type': '[ResourceReference]'}, + "public_ip_prefixes": {"key": "publicIPPrefixes", "type": "[ResourceReference]"}, } - def __init__( - self, - *, - public_ip_prefixes: Optional[List["_models.ResourceReference"]] = None, - **kwargs - ): + def __init__(self, *, public_ip_prefixes: Optional[List["_models.ResourceReference"]] = None, **kwargs): """ :keyword public_ip_prefixes: A list of public IP prefix resources. :paramtype public_ip_prefixes: list[~azure.mgmt.containerservice.v2022_04_01.models.ResourceReference] """ - super(ManagedClusterLoadBalancerProfileOutboundIPPrefixes, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_ip_prefixes = public_ip_prefixes -class ManagedClusterLoadBalancerProfileOutboundIPs(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfileOutboundIPs(_serialization.Model): """Desired outbound IP resources for the cluster load balancer. :ivar public_i_ps: A list of public IP resources. @@ -3734,24 +3681,19 @@ class ManagedClusterLoadBalancerProfileOutboundIPs(msrest.serialization.Model): """ _attribute_map = { - 'public_i_ps': {'key': 'publicIPs', 'type': '[ResourceReference]'}, + "public_i_ps": {"key": "publicIPs", "type": "[ResourceReference]"}, } - def __init__( - self, - *, - public_i_ps: Optional[List["_models.ResourceReference"]] = None, - **kwargs - ): + def __init__(self, *, public_i_ps: Optional[List["_models.ResourceReference"]] = None, **kwargs): """ :keyword public_i_ps: A list of public IP resources. :paramtype public_i_ps: list[~azure.mgmt.containerservice.v2022_04_01.models.ResourceReference] """ - super(ManagedClusterLoadBalancerProfileOutboundIPs, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_i_ps = public_i_ps -class ManagedClusterManagedOutboundIPProfile(msrest.serialization.Model): +class ManagedClusterManagedOutboundIPProfile(_serialization.Model): """Profile of the managed outbound IP resources of the managed cluster. :ivar count: The desired number of outbound IPs created/managed by Azure. Allowed values must @@ -3760,29 +3702,24 @@ class ManagedClusterManagedOutboundIPProfile(msrest.serialization.Model): """ _validation = { - 'count': {'maximum': 16, 'minimum': 1}, + "count": {"maximum": 16, "minimum": 1}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, + "count": {"key": "count", "type": "int"}, } - def __init__( - self, - *, - count: Optional[int] = 1, - **kwargs - ): + def __init__(self, *, count: int = 1, **kwargs): """ :keyword count: The desired number of outbound IPs created/managed by Azure. Allowed values must be in the range of 1 to 16 (inclusive). The default value is 1. :paramtype count: int """ - super(ManagedClusterManagedOutboundIPProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count -class ManagedClusterNATGatewayProfile(msrest.serialization.Model): +class ManagedClusterNATGatewayProfile(_serialization.Model): """Profile of the managed cluster NAT gateway. :ivar managed_outbound_ip_profile: Profile of the managed outbound IP resources of the cluster @@ -3798,13 +3735,16 @@ class ManagedClusterNATGatewayProfile(msrest.serialization.Model): """ _validation = { - 'idle_timeout_in_minutes': {'maximum': 120, 'minimum': 4}, + "idle_timeout_in_minutes": {"maximum": 120, "minimum": 4}, } _attribute_map = { - 'managed_outbound_ip_profile': {'key': 'managedOutboundIPProfile', 'type': 'ManagedClusterManagedOutboundIPProfile'}, - 'effective_outbound_i_ps': {'key': 'effectiveOutboundIPs', 'type': '[ResourceReference]'}, - 'idle_timeout_in_minutes': {'key': 'idleTimeoutInMinutes', 'type': 'int'}, + "managed_outbound_ip_profile": { + "key": "managedOutboundIPProfile", + "type": "ManagedClusterManagedOutboundIPProfile", + }, + "effective_outbound_i_ps": {"key": "effectiveOutboundIPs", "type": "[ResourceReference]"}, + "idle_timeout_in_minutes": {"key": "idleTimeoutInMinutes", "type": "int"}, } def __init__( @@ -3812,7 +3752,7 @@ def __init__( *, managed_outbound_ip_profile: Optional["_models.ManagedClusterManagedOutboundIPProfile"] = None, effective_outbound_i_ps: Optional[List["_models.ResourceReference"]] = None, - idle_timeout_in_minutes: Optional[int] = 4, + idle_timeout_in_minutes: int = 4, **kwargs ): """ @@ -3828,29 +3768,29 @@ def __init__( are in the range of 4 to 120 (inclusive). The default value is 4 minutes. :paramtype idle_timeout_in_minutes: int """ - super(ManagedClusterNATGatewayProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.managed_outbound_ip_profile = managed_outbound_ip_profile self.effective_outbound_i_ps = effective_outbound_i_ps self.idle_timeout_in_minutes = idle_timeout_in_minutes -class ManagedClusterPodIdentity(msrest.serialization.Model): +class ManagedClusterPodIdentity(_serialization.Model): """Details about the pod identity assigned to the Managed Cluster. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar name: Required. The name of the pod identity. + :ivar name: The name of the pod identity. Required. :vartype name: str - :ivar namespace: Required. The namespace of the pod identity. + :ivar namespace: The namespace of the pod identity. Required. :vartype namespace: str :ivar binding_selector: The binding selector to use for the AzureIdentityBinding resource. :vartype binding_selector: str - :ivar identity: Required. The user assigned identity details. + :ivar identity: The user assigned identity details. Required. :vartype identity: ~azure.mgmt.containerservice.v2022_04_01.models.UserAssignedIdentity :ivar provisioning_state: The current provisioning state of the pod identity. Known values are: - "Assigned", "Updating", "Deleting", "Failed". + "Assigned", "Updating", "Deleting", and "Failed". :vartype provisioning_state: str or ~azure.mgmt.containerservice.v2022_04_01.models.ManagedClusterPodIdentityProvisioningState :ivar provisioning_info: @@ -3859,20 +3799,20 @@ class ManagedClusterPodIdentity(msrest.serialization.Model): """ _validation = { - 'name': {'required': True}, - 'namespace': {'required': True}, - 'identity': {'required': True}, - 'provisioning_state': {'readonly': True}, - 'provisioning_info': {'readonly': True}, + "name": {"required": True}, + "namespace": {"required": True}, + "identity": {"required": True}, + "provisioning_state": {"readonly": True}, + "provisioning_info": {"readonly": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'namespace': {'key': 'namespace', 'type': 'str'}, - 'binding_selector': {'key': 'bindingSelector', 'type': 'str'}, - 'identity': {'key': 'identity', 'type': 'UserAssignedIdentity'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'provisioning_info': {'key': 'provisioningInfo', 'type': 'ManagedClusterPodIdentityProvisioningInfo'}, + "name": {"key": "name", "type": "str"}, + "namespace": {"key": "namespace", "type": "str"}, + "binding_selector": {"key": "bindingSelector", "type": "str"}, + "identity": {"key": "identity", "type": "UserAssignedIdentity"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "provisioning_info": {"key": "provisioningInfo", "type": "ManagedClusterPodIdentityProvisioningInfo"}, } def __init__( @@ -3885,16 +3825,16 @@ def __init__( **kwargs ): """ - :keyword name: Required. The name of the pod identity. + :keyword name: The name of the pod identity. Required. :paramtype name: str - :keyword namespace: Required. The namespace of the pod identity. + :keyword namespace: The namespace of the pod identity. Required. :paramtype namespace: str :keyword binding_selector: The binding selector to use for the AzureIdentityBinding resource. :paramtype binding_selector: str - :keyword identity: Required. The user assigned identity details. + :keyword identity: The user assigned identity details. Required. :paramtype identity: ~azure.mgmt.containerservice.v2022_04_01.models.UserAssignedIdentity """ - super(ManagedClusterPodIdentity, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.namespace = namespace self.binding_selector = binding_selector @@ -3903,54 +3843,47 @@ def __init__( self.provisioning_info = None -class ManagedClusterPodIdentityException(msrest.serialization.Model): +class ManagedClusterPodIdentityException(_serialization.Model): """See `disable AAD Pod Identity for a specific Pod/Application `_ for more details. All required parameters must be populated in order to send to Azure. - :ivar name: Required. The name of the pod identity exception. + :ivar name: The name of the pod identity exception. Required. :vartype name: str - :ivar namespace: Required. The namespace of the pod identity exception. + :ivar namespace: The namespace of the pod identity exception. Required. :vartype namespace: str - :ivar pod_labels: Required. The pod labels to match. + :ivar pod_labels: The pod labels to match. Required. :vartype pod_labels: dict[str, str] """ _validation = { - 'name': {'required': True}, - 'namespace': {'required': True}, - 'pod_labels': {'required': True}, + "name": {"required": True}, + "namespace": {"required": True}, + "pod_labels": {"required": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'namespace': {'key': 'namespace', 'type': 'str'}, - 'pod_labels': {'key': 'podLabels', 'type': '{str}'}, + "name": {"key": "name", "type": "str"}, + "namespace": {"key": "namespace", "type": "str"}, + "pod_labels": {"key": "podLabels", "type": "{str}"}, } - def __init__( - self, - *, - name: str, - namespace: str, - pod_labels: Dict[str, str], - **kwargs - ): + def __init__(self, *, name: str, namespace: str, pod_labels: Dict[str, str], **kwargs): """ - :keyword name: Required. The name of the pod identity exception. + :keyword name: The name of the pod identity exception. Required. :paramtype name: str - :keyword namespace: Required. The namespace of the pod identity exception. + :keyword namespace: The namespace of the pod identity exception. Required. :paramtype namespace: str - :keyword pod_labels: Required. The pod labels to match. + :keyword pod_labels: The pod labels to match. Required. :paramtype pod_labels: dict[str, str] """ - super(ManagedClusterPodIdentityException, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.namespace = namespace self.pod_labels = pod_labels -class ManagedClusterPodIdentityProfile(msrest.serialization.Model): +class ManagedClusterPodIdentityProfile(_serialization.Model): """See `use AAD pod identity `_ for more details on pod identity integration. :ivar enabled: Whether the pod identity addon is enabled. @@ -3970,10 +3903,13 @@ class ManagedClusterPodIdentityProfile(msrest.serialization.Model): """ _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'allow_network_plugin_kubenet': {'key': 'allowNetworkPluginKubenet', 'type': 'bool'}, - 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '[ManagedClusterPodIdentity]'}, - 'user_assigned_identity_exceptions': {'key': 'userAssignedIdentityExceptions', 'type': '[ManagedClusterPodIdentityException]'}, + "enabled": {"key": "enabled", "type": "bool"}, + "allow_network_plugin_kubenet": {"key": "allowNetworkPluginKubenet", "type": "bool"}, + "user_assigned_identities": {"key": "userAssignedIdentities", "type": "[ManagedClusterPodIdentity]"}, + "user_assigned_identity_exceptions": { + "key": "userAssignedIdentityExceptions", + "type": "[ManagedClusterPodIdentityException]", + }, } def __init__( @@ -4001,14 +3937,14 @@ def __init__( :paramtype user_assigned_identity_exceptions: list[~azure.mgmt.containerservice.v2022_04_01.models.ManagedClusterPodIdentityException] """ - super(ManagedClusterPodIdentityProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.allow_network_plugin_kubenet = allow_network_plugin_kubenet self.user_assigned_identities = user_assigned_identities self.user_assigned_identity_exceptions = user_assigned_identity_exceptions -class ManagedClusterPodIdentityProvisioningError(msrest.serialization.Model): +class ManagedClusterPodIdentityProvisioningError(_serialization.Model): """An error response from the pod identity provisioning. :ivar error: Details about the error. @@ -4017,25 +3953,20 @@ class ManagedClusterPodIdentityProvisioningError(msrest.serialization.Model): """ _attribute_map = { - 'error': {'key': 'error', 'type': 'ManagedClusterPodIdentityProvisioningErrorBody'}, + "error": {"key": "error", "type": "ManagedClusterPodIdentityProvisioningErrorBody"}, } - def __init__( - self, - *, - error: Optional["_models.ManagedClusterPodIdentityProvisioningErrorBody"] = None, - **kwargs - ): + def __init__(self, *, error: Optional["_models.ManagedClusterPodIdentityProvisioningErrorBody"] = None, **kwargs): """ :keyword error: Details about the error. :paramtype error: ~azure.mgmt.containerservice.v2022_04_01.models.ManagedClusterPodIdentityProvisioningErrorBody """ - super(ManagedClusterPodIdentityProvisioningError, self).__init__(**kwargs) + super().__init__(**kwargs) self.error = error -class ManagedClusterPodIdentityProvisioningErrorBody(msrest.serialization.Model): +class ManagedClusterPodIdentityProvisioningErrorBody(_serialization.Model): """An error response from the pod identity provisioning. :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed @@ -4053,10 +3984,10 @@ class ManagedClusterPodIdentityProvisioningErrorBody(msrest.serialization.Model) """ _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[ManagedClusterPodIdentityProvisioningErrorBody]'}, + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[ManagedClusterPodIdentityProvisioningErrorBody]"}, } def __init__( @@ -4082,14 +4013,14 @@ def __init__( :paramtype details: list[~azure.mgmt.containerservice.v2022_04_01.models.ManagedClusterPodIdentityProvisioningErrorBody] """ - super(ManagedClusterPodIdentityProvisioningErrorBody, self).__init__(**kwargs) + super().__init__(**kwargs) self.code = code self.message = message self.target = target self.details = details -class ManagedClusterPodIdentityProvisioningInfo(msrest.serialization.Model): +class ManagedClusterPodIdentityProvisioningInfo(_serialization.Model): """ManagedClusterPodIdentityProvisioningInfo. :ivar error: Pod identity assignment error (if any). @@ -4098,35 +4029,30 @@ class ManagedClusterPodIdentityProvisioningInfo(msrest.serialization.Model): """ _attribute_map = { - 'error': {'key': 'error', 'type': 'ManagedClusterPodIdentityProvisioningError'}, + "error": {"key": "error", "type": "ManagedClusterPodIdentityProvisioningError"}, } - def __init__( - self, - *, - error: Optional["_models.ManagedClusterPodIdentityProvisioningError"] = None, - **kwargs - ): + def __init__(self, *, error: Optional["_models.ManagedClusterPodIdentityProvisioningError"] = None, **kwargs): """ :keyword error: Pod identity assignment error (if any). :paramtype error: ~azure.mgmt.containerservice.v2022_04_01.models.ManagedClusterPodIdentityProvisioningError """ - super(ManagedClusterPodIdentityProvisioningInfo, self).__init__(**kwargs) + super().__init__(**kwargs) self.error = error -class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): +class ManagedClusterPoolUpgradeProfile(_serialization.Model): """The list of available upgrade versions. All required parameters must be populated in order to send to Azure. - :ivar kubernetes_version: Required. The Kubernetes version (major.minor.patch). + :ivar kubernetes_version: The Kubernetes version (major.minor.patch). Required. :vartype kubernetes_version: str :ivar name: The Agent Pool name. :vartype name: str - :ivar os_type: Required. The operating system type. The default is Linux. Known values are: - "Linux", "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_04_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -4134,15 +4060,15 @@ class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): """ _validation = { - 'kubernetes_version': {'required': True}, - 'os_type': {'required': True}, + "kubernetes_version": {"required": True}, + "os_type": {"required": True}, } _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'upgrades': {'key': 'upgrades', 'type': '[ManagedClusterPoolUpgradeProfileUpgradesItem]'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "os_type": {"key": "osType", "type": "str"}, + "upgrades": {"key": "upgrades", "type": "[ManagedClusterPoolUpgradeProfileUpgradesItem]"}, } def __init__( @@ -4155,25 +4081,25 @@ def __init__( **kwargs ): """ - :keyword kubernetes_version: Required. The Kubernetes version (major.minor.patch). + :keyword kubernetes_version: The Kubernetes version (major.minor.patch). Required. :paramtype kubernetes_version: str :keyword name: The Agent Pool name. :paramtype name: str - :keyword os_type: Required. The operating system type. The default is Linux. Known values are: - "Linux", "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_04_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: list[~azure.mgmt.containerservice.v2022_04_01.models.ManagedClusterPoolUpgradeProfileUpgradesItem] """ - super(ManagedClusterPoolUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.name = name self.os_type = os_type self.upgrades = upgrades -class ManagedClusterPoolUpgradeProfileUpgradesItem(msrest.serialization.Model): +class ManagedClusterPoolUpgradeProfileUpgradesItem(_serialization.Model): """ManagedClusterPoolUpgradeProfileUpgradesItem. :ivar kubernetes_version: The Kubernetes version (major.minor.patch). @@ -4183,36 +4109,30 @@ class ManagedClusterPoolUpgradeProfileUpgradesItem(msrest.serialization.Model): """ _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } - def __init__( - self, - *, - kubernetes_version: Optional[str] = None, - is_preview: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, kubernetes_version: Optional[str] = None, is_preview: Optional[bool] = None, **kwargs): """ :keyword kubernetes_version: The Kubernetes version (major.minor.patch). :paramtype kubernetes_version: str :keyword is_preview: Whether the Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(ManagedClusterPoolUpgradeProfileUpgradesItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.is_preview = is_preview -class ManagedClusterPropertiesAutoScalerProfile(msrest.serialization.Model): +class ManagedClusterPropertiesAutoScalerProfile(_serialization.Model): # pylint: disable=too-many-instance-attributes """Parameters to be applied to the cluster-autoscaler when enabled. :ivar balance_similar_node_groups: Valid values are 'true' and 'false'. :vartype balance_similar_node_groups: str :ivar expander: If not specified, the default is 'random'. See `expanders `_ - for more information. Known values are: "least-waste", "most-pods", "priority", "random". + for more information. Known values are: "least-waste", "most-pods", "priority", and "random". :vartype expander: str or ~azure.mgmt.containerservice.v2022_04_01.models.Expander :ivar max_empty_bulk_delete: The default is 10. :vartype max_empty_bulk_delete: str @@ -4256,23 +4176,23 @@ class ManagedClusterPropertiesAutoScalerProfile(msrest.serialization.Model): """ _attribute_map = { - 'balance_similar_node_groups': {'key': 'balance-similar-node-groups', 'type': 'str'}, - 'expander': {'key': 'expander', 'type': 'str'}, - 'max_empty_bulk_delete': {'key': 'max-empty-bulk-delete', 'type': 'str'}, - 'max_graceful_termination_sec': {'key': 'max-graceful-termination-sec', 'type': 'str'}, - 'max_node_provision_time': {'key': 'max-node-provision-time', 'type': 'str'}, - 'max_total_unready_percentage': {'key': 'max-total-unready-percentage', 'type': 'str'}, - 'new_pod_scale_up_delay': {'key': 'new-pod-scale-up-delay', 'type': 'str'}, - 'ok_total_unready_count': {'key': 'ok-total-unready-count', 'type': 'str'}, - 'scan_interval': {'key': 'scan-interval', 'type': 'str'}, - 'scale_down_delay_after_add': {'key': 'scale-down-delay-after-add', 'type': 'str'}, - 'scale_down_delay_after_delete': {'key': 'scale-down-delay-after-delete', 'type': 'str'}, - 'scale_down_delay_after_failure': {'key': 'scale-down-delay-after-failure', 'type': 'str'}, - 'scale_down_unneeded_time': {'key': 'scale-down-unneeded-time', 'type': 'str'}, - 'scale_down_unready_time': {'key': 'scale-down-unready-time', 'type': 'str'}, - 'scale_down_utilization_threshold': {'key': 'scale-down-utilization-threshold', 'type': 'str'}, - 'skip_nodes_with_local_storage': {'key': 'skip-nodes-with-local-storage', 'type': 'str'}, - 'skip_nodes_with_system_pods': {'key': 'skip-nodes-with-system-pods', 'type': 'str'}, + "balance_similar_node_groups": {"key": "balance-similar-node-groups", "type": "str"}, + "expander": {"key": "expander", "type": "str"}, + "max_empty_bulk_delete": {"key": "max-empty-bulk-delete", "type": "str"}, + "max_graceful_termination_sec": {"key": "max-graceful-termination-sec", "type": "str"}, + "max_node_provision_time": {"key": "max-node-provision-time", "type": "str"}, + "max_total_unready_percentage": {"key": "max-total-unready-percentage", "type": "str"}, + "new_pod_scale_up_delay": {"key": "new-pod-scale-up-delay", "type": "str"}, + "ok_total_unready_count": {"key": "ok-total-unready-count", "type": "str"}, + "scan_interval": {"key": "scan-interval", "type": "str"}, + "scale_down_delay_after_add": {"key": "scale-down-delay-after-add", "type": "str"}, + "scale_down_delay_after_delete": {"key": "scale-down-delay-after-delete", "type": "str"}, + "scale_down_delay_after_failure": {"key": "scale-down-delay-after-failure", "type": "str"}, + "scale_down_unneeded_time": {"key": "scale-down-unneeded-time", "type": "str"}, + "scale_down_unready_time": {"key": "scale-down-unready-time", "type": "str"}, + "scale_down_utilization_threshold": {"key": "scale-down-utilization-threshold", "type": "str"}, + "skip_nodes_with_local_storage": {"key": "skip-nodes-with-local-storage", "type": "str"}, + "skip_nodes_with_system_pods": {"key": "skip-nodes-with-system-pods", "type": "str"}, } def __init__( @@ -4302,7 +4222,7 @@ def __init__( :paramtype balance_similar_node_groups: str :keyword expander: If not specified, the default is 'random'. See `expanders `_ - for more information. Known values are: "least-waste", "most-pods", "priority", "random". + for more information. Known values are: "least-waste", "most-pods", "priority", and "random". :paramtype expander: str or ~azure.mgmt.containerservice.v2022_04_01.models.Expander :keyword max_empty_bulk_delete: The default is 10. :paramtype max_empty_bulk_delete: str @@ -4345,7 +4265,7 @@ def __init__( :keyword skip_nodes_with_system_pods: The default is true. :paramtype skip_nodes_with_system_pods: str """ - super(ManagedClusterPropertiesAutoScalerProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.balance_similar_node_groups = balance_similar_node_groups self.expander = expander self.max_empty_bulk_delete = max_empty_bulk_delete @@ -4365,7 +4285,7 @@ def __init__( self.skip_nodes_with_system_pods = skip_nodes_with_system_pods -class ManagedClusterSecurityProfile(msrest.serialization.Model): +class ManagedClusterSecurityProfile(_serialization.Model): """Security profile for the container service cluster. :ivar azure_defender: Azure Defender settings for the security profile. @@ -4374,25 +4294,22 @@ class ManagedClusterSecurityProfile(msrest.serialization.Model): """ _attribute_map = { - 'azure_defender': {'key': 'azureDefender', 'type': 'ManagedClusterSecurityProfileAzureDefender'}, + "azure_defender": {"key": "azureDefender", "type": "ManagedClusterSecurityProfileAzureDefender"}, } def __init__( - self, - *, - azure_defender: Optional["_models.ManagedClusterSecurityProfileAzureDefender"] = None, - **kwargs + self, *, azure_defender: Optional["_models.ManagedClusterSecurityProfileAzureDefender"] = None, **kwargs ): """ :keyword azure_defender: Azure Defender settings for the security profile. :paramtype azure_defender: ~azure.mgmt.containerservice.v2022_04_01.models.ManagedClusterSecurityProfileAzureDefender """ - super(ManagedClusterSecurityProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.azure_defender = azure_defender -class ManagedClusterSecurityProfileAzureDefender(msrest.serialization.Model): +class ManagedClusterSecurityProfileAzureDefender(_serialization.Model): """Azure Defender settings for the security profile. :ivar enabled: Whether to enable Azure Defender. @@ -4404,16 +4321,12 @@ class ManagedClusterSecurityProfileAzureDefender(msrest.serialization.Model): """ _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'log_analytics_workspace_resource_id': {'key': 'logAnalyticsWorkspaceResourceId', 'type': 'str'}, + "enabled": {"key": "enabled", "type": "bool"}, + "log_analytics_workspace_resource_id": {"key": "logAnalyticsWorkspaceResourceId", "type": "str"}, } def __init__( - self, - *, - enabled: Optional[bool] = None, - log_analytics_workspace_resource_id: Optional[str] = None, - **kwargs + self, *, enabled: Optional[bool] = None, log_analytics_workspace_resource_id: Optional[str] = None, **kwargs ): """ :keyword enabled: Whether to enable Azure Defender. @@ -4423,63 +4336,57 @@ def __init__( must be a valid workspace resource ID. When Azure Defender is disabled, leave the field empty. :paramtype log_analytics_workspace_resource_id: str """ - super(ManagedClusterSecurityProfileAzureDefender, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.log_analytics_workspace_resource_id = log_analytics_workspace_resource_id -class ManagedClusterServicePrincipalProfile(msrest.serialization.Model): +class ManagedClusterServicePrincipalProfile(_serialization.Model): """Information about a service principal identity for the cluster to use for manipulating Azure APIs. All required parameters must be populated in order to send to Azure. - :ivar client_id: Required. The ID for the service principal. + :ivar client_id: The ID for the service principal. Required. :vartype client_id: str :ivar secret: The secret password associated with the service principal in plain text. :vartype secret: str """ _validation = { - 'client_id': {'required': True}, + "client_id": {"required": True}, } _attribute_map = { - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'secret': {'key': 'secret', 'type': 'str'}, + "client_id": {"key": "clientId", "type": "str"}, + "secret": {"key": "secret", "type": "str"}, } - def __init__( - self, - *, - client_id: str, - secret: Optional[str] = None, - **kwargs - ): + def __init__(self, *, client_id: str, secret: Optional[str] = None, **kwargs): """ - :keyword client_id: Required. The ID for the service principal. + :keyword client_id: The ID for the service principal. Required. :paramtype client_id: str :keyword secret: The secret password associated with the service principal in plain text. :paramtype secret: str """ - super(ManagedClusterServicePrincipalProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.client_id = client_id self.secret = secret -class ManagedClusterSKU(msrest.serialization.Model): +class ManagedClusterSKU(_serialization.Model): """The SKU of a Managed Cluster. - :ivar name: The name of a managed cluster SKU. Known values are: "Basic". + :ivar name: The name of a managed cluster SKU. "Basic" :vartype name: str or ~azure.mgmt.containerservice.v2022_04_01.models.ManagedClusterSKUName :ivar tier: If not specified, the default is 'Free'. See `uptime SLA - `_ for more details. Known values are: "Paid", - "Free". + `_ for more details. Known values are: "Paid" + and "Free". :vartype tier: str or ~azure.mgmt.containerservice.v2022_04_01.models.ManagedClusterSKUTier """ _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, + "name": {"key": "name", "type": "str"}, + "tier": {"key": "tier", "type": "str"}, } def __init__( @@ -4490,19 +4397,19 @@ def __init__( **kwargs ): """ - :keyword name: The name of a managed cluster SKU. Known values are: "Basic". + :keyword name: The name of a managed cluster SKU. "Basic" :paramtype name: str or ~azure.mgmt.containerservice.v2022_04_01.models.ManagedClusterSKUName :keyword tier: If not specified, the default is 'Free'. See `uptime SLA - `_ for more details. Known values are: "Paid", - "Free". + `_ for more details. Known values are: "Paid" + and "Free". :paramtype tier: str or ~azure.mgmt.containerservice.v2022_04_01.models.ManagedClusterSKUTier """ - super(ManagedClusterSKU, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.tier = tier -class ManagedClusterStorageProfile(msrest.serialization.Model): +class ManagedClusterStorageProfile(_serialization.Model): """Storage profile for the container service cluster. :ivar disk_csi_driver: AzureDisk CSI Driver settings for the storage profile. @@ -4517,9 +4424,9 @@ class ManagedClusterStorageProfile(msrest.serialization.Model): """ _attribute_map = { - 'disk_csi_driver': {'key': 'diskCSIDriver', 'type': 'ManagedClusterStorageProfileDiskCSIDriver'}, - 'file_csi_driver': {'key': 'fileCSIDriver', 'type': 'ManagedClusterStorageProfileFileCSIDriver'}, - 'snapshot_controller': {'key': 'snapshotController', 'type': 'ManagedClusterStorageProfileSnapshotController'}, + "disk_csi_driver": {"key": "diskCSIDriver", "type": "ManagedClusterStorageProfileDiskCSIDriver"}, + "file_csi_driver": {"key": "fileCSIDriver", "type": "ManagedClusterStorageProfileFileCSIDriver"}, + "snapshot_controller": {"key": "snapshotController", "type": "ManagedClusterStorageProfileSnapshotController"}, } def __init__( @@ -4541,13 +4448,13 @@ def __init__( :paramtype snapshot_controller: ~azure.mgmt.containerservice.v2022_04_01.models.ManagedClusterStorageProfileSnapshotController """ - super(ManagedClusterStorageProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.disk_csi_driver = disk_csi_driver self.file_csi_driver = file_csi_driver self.snapshot_controller = snapshot_controller -class ManagedClusterStorageProfileDiskCSIDriver(msrest.serialization.Model): +class ManagedClusterStorageProfileDiskCSIDriver(_serialization.Model): """AzureDisk CSI Driver settings for the storage profile. :ivar enabled: Whether to enable AzureDisk CSI Driver. The default value is true. @@ -4555,24 +4462,19 @@ class ManagedClusterStorageProfileDiskCSIDriver(msrest.serialization.Model): """ _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, + "enabled": {"key": "enabled", "type": "bool"}, } - def __init__( - self, - *, - enabled: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, enabled: Optional[bool] = None, **kwargs): """ :keyword enabled: Whether to enable AzureDisk CSI Driver. The default value is true. :paramtype enabled: bool """ - super(ManagedClusterStorageProfileDiskCSIDriver, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled -class ManagedClusterStorageProfileFileCSIDriver(msrest.serialization.Model): +class ManagedClusterStorageProfileFileCSIDriver(_serialization.Model): """AzureFile CSI Driver settings for the storage profile. :ivar enabled: Whether to enable AzureFile CSI Driver. The default value is true. @@ -4580,24 +4482,19 @@ class ManagedClusterStorageProfileFileCSIDriver(msrest.serialization.Model): """ _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, + "enabled": {"key": "enabled", "type": "bool"}, } - def __init__( - self, - *, - enabled: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, enabled: Optional[bool] = None, **kwargs): """ :keyword enabled: Whether to enable AzureFile CSI Driver. The default value is true. :paramtype enabled: bool """ - super(ManagedClusterStorageProfileFileCSIDriver, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled -class ManagedClusterStorageProfileSnapshotController(msrest.serialization.Model): +class ManagedClusterStorageProfileSnapshotController(_serialization.Model): """Snapshot Controller settings for the storage profile. :ivar enabled: Whether to enable Snapshot Controller. The default value is true. @@ -4605,24 +4502,19 @@ class ManagedClusterStorageProfileSnapshotController(msrest.serialization.Model) """ _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, + "enabled": {"key": "enabled", "type": "bool"}, } - def __init__( - self, - *, - enabled: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, enabled: Optional[bool] = None, **kwargs): """ :keyword enabled: Whether to enable Snapshot Controller. The default value is true. :paramtype enabled: bool """ - super(ManagedClusterStorageProfileSnapshotController, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled -class ManagedClusterUpgradeProfile(msrest.serialization.Model): +class ManagedClusterUpgradeProfile(_serialization.Model): """The list of available upgrades for compute pools. Variables are only populated by the server, and will be ignored when sending a request. @@ -4635,29 +4527,29 @@ class ManagedClusterUpgradeProfile(msrest.serialization.Model): :vartype name: str :ivar type: The type of the upgrade profile. :vartype type: str - :ivar control_plane_profile: Required. The list of available upgrade versions for the control - plane. + :ivar control_plane_profile: The list of available upgrade versions for the control plane. + Required. :vartype control_plane_profile: ~azure.mgmt.containerservice.v2022_04_01.models.ManagedClusterPoolUpgradeProfile - :ivar agent_pool_profiles: Required. The list of available upgrade versions for agent pools. + :ivar agent_pool_profiles: The list of available upgrade versions for agent pools. Required. :vartype agent_pool_profiles: list[~azure.mgmt.containerservice.v2022_04_01.models.ManagedClusterPoolUpgradeProfile] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'control_plane_profile': {'required': True}, - 'agent_pool_profiles': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "control_plane_profile": {"required": True}, + "agent_pool_profiles": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'control_plane_profile': {'key': 'properties.controlPlaneProfile', 'type': 'ManagedClusterPoolUpgradeProfile'}, - 'agent_pool_profiles': {'key': 'properties.agentPoolProfiles', 'type': '[ManagedClusterPoolUpgradeProfile]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "control_plane_profile": {"key": "properties.controlPlaneProfile", "type": "ManagedClusterPoolUpgradeProfile"}, + "agent_pool_profiles": {"key": "properties.agentPoolProfiles", "type": "[ManagedClusterPoolUpgradeProfile]"}, } def __init__( @@ -4668,15 +4560,15 @@ def __init__( **kwargs ): """ - :keyword control_plane_profile: Required. The list of available upgrade versions for the - control plane. + :keyword control_plane_profile: The list of available upgrade versions for the control plane. + Required. :paramtype control_plane_profile: ~azure.mgmt.containerservice.v2022_04_01.models.ManagedClusterPoolUpgradeProfile - :keyword agent_pool_profiles: Required. The list of available upgrade versions for agent pools. + :keyword agent_pool_profiles: The list of available upgrade versions for agent pools. Required. :paramtype agent_pool_profiles: list[~azure.mgmt.containerservice.v2022_04_01.models.ManagedClusterPoolUpgradeProfile] """ - super(ManagedClusterUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -4684,18 +4576,18 @@ def __init__( self.agent_pool_profiles = agent_pool_profiles -class ManagedClusterWindowsProfile(msrest.serialization.Model): +class ManagedClusterWindowsProfile(_serialization.Model): """Profile for Windows VMs in the managed cluster. All required parameters must be populated in order to send to Azure. - :ivar admin_username: Required. Specifies the name of the administrator account. - :code:`
`:code:`
` **Restriction:** Cannot end in "." :code:`
`:code:`
` - **Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", "test1", - "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", - "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", - "sys", "test2", "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 - character :code:`
`:code:`
` **Max-length:** 20 characters. + :ivar admin_username: Specifies the name of the administrator account. :code:`
`:code:`
` + **Restriction:** Cannot end in "." :code:`
`:code:`
` **Disallowed values:** + "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", + "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", + "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", + "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 character + :code:`
`:code:`
` **Max-length:** 20 characters. Required. :vartype admin_username: str :ivar admin_password: Specifies the password of the administrator account. :code:`
`:code:`
` **Minimum-length:** 8 characters :code:`
`:code:`
` @@ -4707,7 +4599,7 @@ class ManagedClusterWindowsProfile(msrest.serialization.Model): :vartype admin_password: str :ivar license_type: The license type to use for Windows VMs. See `Azure Hybrid User Benefits `_ for more details. Known values are: - "None", "Windows_Server". + "None" and "Windows_Server". :vartype license_type: str or ~azure.mgmt.containerservice.v2022_04_01.models.LicenseType :ivar enable_csi_proxy: For more details on CSI proxy, see the `CSI proxy GitHub repo `_. @@ -4717,15 +4609,15 @@ class ManagedClusterWindowsProfile(msrest.serialization.Model): """ _validation = { - 'admin_username': {'required': True}, + "admin_username": {"required": True}, } _attribute_map = { - 'admin_username': {'key': 'adminUsername', 'type': 'str'}, - 'admin_password': {'key': 'adminPassword', 'type': 'str'}, - 'license_type': {'key': 'licenseType', 'type': 'str'}, - 'enable_csi_proxy': {'key': 'enableCSIProxy', 'type': 'bool'}, - 'gmsa_profile': {'key': 'gmsaProfile', 'type': 'WindowsGmsaProfile'}, + "admin_username": {"key": "adminUsername", "type": "str"}, + "admin_password": {"key": "adminPassword", "type": "str"}, + "license_type": {"key": "licenseType", "type": "str"}, + "enable_csi_proxy": {"key": "enableCSIProxy", "type": "bool"}, + "gmsa_profile": {"key": "gmsaProfile", "type": "WindowsGmsaProfile"}, } def __init__( @@ -4739,13 +4631,13 @@ def __init__( **kwargs ): """ - :keyword admin_username: Required. Specifies the name of the administrator account. + :keyword admin_username: Specifies the name of the administrator account. :code:`
`:code:`
` **Restriction:** Cannot end in "." :code:`
`:code:`
` **Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 - character :code:`
`:code:`
` **Max-length:** 20 characters. + character :code:`
`:code:`
` **Max-length:** 20 characters. Required. :paramtype admin_username: str :keyword admin_password: Specifies the password of the administrator account. :code:`
`:code:`
` **Minimum-length:** 8 characters :code:`
`:code:`
` @@ -4757,7 +4649,7 @@ def __init__( :paramtype admin_password: str :keyword license_type: The license type to use for Windows VMs. See `Azure Hybrid User Benefits `_ for more details. Known values are: - "None", "Windows_Server". + "None" and "Windows_Server". :paramtype license_type: str or ~azure.mgmt.containerservice.v2022_04_01.models.LicenseType :keyword enable_csi_proxy: For more details on CSI proxy, see the `CSI proxy GitHub repo `_. @@ -4765,7 +4657,7 @@ def __init__( :keyword gmsa_profile: The Windows gMSA Profile in the Managed Cluster. :paramtype gmsa_profile: ~azure.mgmt.containerservice.v2022_04_01.models.WindowsGmsaProfile """ - super(ManagedClusterWindowsProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.admin_username = admin_username self.admin_password = admin_password self.license_type = license_type @@ -4773,7 +4665,7 @@ def __init__( self.gmsa_profile = gmsa_profile -class ManagedServiceIdentityUserAssignedIdentitiesValue(msrest.serialization.Model): +class ManagedServiceIdentityUserAssignedIdentitiesValue(_serialization.Model): """ManagedServiceIdentityUserAssignedIdentitiesValue. Variables are only populated by the server, and will be ignored when sending a request. @@ -4785,27 +4677,23 @@ class ManagedServiceIdentityUserAssignedIdentitiesValue(msrest.serialization.Mod """ _validation = { - 'principal_id': {'readonly': True}, - 'client_id': {'readonly': True}, + "principal_id": {"readonly": True}, + "client_id": {"readonly": True}, } _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, + "principal_id": {"key": "principalId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(ManagedServiceIdentityUserAssignedIdentitiesValue, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.principal_id = None self.client_id = None -class OperationListResult(msrest.serialization.Model): +class OperationListResult(_serialization.Model): """The List Operation response. Variables are only populated by the server, and will be ignored when sending a request. @@ -4815,24 +4703,20 @@ class OperationListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[OperationValue]'}, + "value": {"key": "value", "type": "[OperationValue]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(OperationListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None -class OperationValue(msrest.serialization.Model): +class OperationValue(_serialization.Model): """Describes the properties of a Operation value. Variables are only populated by the server, and will be ignored when sending a request. @@ -4852,30 +4736,26 @@ class OperationValue(msrest.serialization.Model): """ _validation = { - 'origin': {'readonly': True}, - 'name': {'readonly': True}, - 'operation': {'readonly': True}, - 'resource': {'readonly': True}, - 'description': {'readonly': True}, - 'provider': {'readonly': True}, + "origin": {"readonly": True}, + "name": {"readonly": True}, + "operation": {"readonly": True}, + "resource": {"readonly": True}, + "description": {"readonly": True}, + "provider": {"readonly": True}, } _attribute_map = { - 'origin': {'key': 'origin', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'operation': {'key': 'display.operation', 'type': 'str'}, - 'resource': {'key': 'display.resource', 'type': 'str'}, - 'description': {'key': 'display.description', 'type': 'str'}, - 'provider': {'key': 'display.provider', 'type': 'str'}, + "origin": {"key": "origin", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "operation": {"key": "display.operation", "type": "str"}, + "resource": {"key": "display.resource", "type": "str"}, + "description": {"key": "display.description", "type": "str"}, + "provider": {"key": "display.provider", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(OperationValue, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.origin = None self.name = None self.operation = None @@ -4884,7 +4764,7 @@ def __init__( self.provider = None -class OSOptionProfile(msrest.serialization.Model): +class OSOptionProfile(_serialization.Model): """The OS option profile. Variables are only populated by the server, and will be ignored when sending a request. @@ -4897,83 +4777,72 @@ class OSOptionProfile(msrest.serialization.Model): :vartype name: str :ivar type: The type of the OS option resource. :vartype type: str - :ivar os_option_property_list: Required. The list of OS options. + :ivar os_option_property_list: The list of OS options. Required. :vartype os_option_property_list: list[~azure.mgmt.containerservice.v2022_04_01.models.OSOptionProperty] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'os_option_property_list': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "os_option_property_list": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'os_option_property_list': {'key': 'properties.osOptionPropertyList', 'type': '[OSOptionProperty]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "os_option_property_list": {"key": "properties.osOptionPropertyList", "type": "[OSOptionProperty]"}, } - def __init__( - self, - *, - os_option_property_list: List["_models.OSOptionProperty"], - **kwargs - ): + def __init__(self, *, os_option_property_list: List["_models.OSOptionProperty"], **kwargs): """ - :keyword os_option_property_list: Required. The list of OS options. + :keyword os_option_property_list: The list of OS options. Required. :paramtype os_option_property_list: list[~azure.mgmt.containerservice.v2022_04_01.models.OSOptionProperty] """ - super(OSOptionProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None self.os_option_property_list = os_option_property_list -class OSOptionProperty(msrest.serialization.Model): +class OSOptionProperty(_serialization.Model): """OS option property. All required parameters must be populated in order to send to Azure. - :ivar os_type: Required. The OS type. + :ivar os_type: The OS type. Required. :vartype os_type: str - :ivar enable_fips_image: Required. Whether the image is FIPS-enabled. + :ivar enable_fips_image: Whether the image is FIPS-enabled. Required. :vartype enable_fips_image: bool """ _validation = { - 'os_type': {'required': True}, - 'enable_fips_image': {'required': True}, + "os_type": {"required": True}, + "enable_fips_image": {"required": True}, } _attribute_map = { - 'os_type': {'key': 'os-type', 'type': 'str'}, - 'enable_fips_image': {'key': 'enable-fips-image', 'type': 'bool'}, + "os_type": {"key": "os-type", "type": "str"}, + "enable_fips_image": {"key": "enable-fips-image", "type": "bool"}, } - def __init__( - self, - *, - os_type: str, - enable_fips_image: bool, - **kwargs - ): + def __init__(self, *, os_type: str, enable_fips_image: bool, **kwargs): """ - :keyword os_type: Required. The OS type. + :keyword os_type: The OS type. Required. :paramtype os_type: str - :keyword enable_fips_image: Required. Whether the image is FIPS-enabled. + :keyword enable_fips_image: Whether the image is FIPS-enabled. Required. :paramtype enable_fips_image: bool """ - super(OSOptionProperty, self).__init__(**kwargs) + super().__init__(**kwargs) self.os_type = os_type self.enable_fips_image = enable_fips_image -class OutboundEnvironmentEndpoint(msrest.serialization.Model): +class OutboundEnvironmentEndpoint(_serialization.Model): """Egress endpoints which AKS agent nodes connect to for common purpose. :ivar category: The category of endpoints accessed by the AKS agent node, e.g. @@ -4984,8 +4853,8 @@ class OutboundEnvironmentEndpoint(msrest.serialization.Model): """ _attribute_map = { - 'category': {'key': 'category', 'type': 'str'}, - 'endpoints': {'key': 'endpoints', 'type': '[EndpointDependency]'}, + "category": {"key": "category", "type": "str"}, + "endpoints": {"key": "endpoints", "type": "[EndpointDependency]"}, } def __init__( @@ -5002,19 +4871,19 @@ def __init__( :keyword endpoints: The endpoints that AKS agent nodes connect to. :paramtype endpoints: list[~azure.mgmt.containerservice.v2022_04_01.models.EndpointDependency] """ - super(OutboundEnvironmentEndpoint, self).__init__(**kwargs) + super().__init__(**kwargs) self.category = category self.endpoints = endpoints -class OutboundEnvironmentEndpointCollection(msrest.serialization.Model): +class OutboundEnvironmentEndpointCollection(_serialization.Model): """Collection of OutboundEnvironmentEndpoint. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar value: Required. Collection of resources. + :ivar value: Collection of resources. Required. :vartype value: list[~azure.mgmt.containerservice.v2022_04_01.models.OutboundEnvironmentEndpoint] :ivar next_link: Link to next page of resources. @@ -5022,59 +4891,49 @@ class OutboundEnvironmentEndpointCollection(msrest.serialization.Model): """ _validation = { - 'value': {'required': True}, - 'next_link': {'readonly': True}, + "value": {"required": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[OutboundEnvironmentEndpoint]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[OutboundEnvironmentEndpoint]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: List["_models.OutboundEnvironmentEndpoint"], - **kwargs - ): + def __init__(self, *, value: List["_models.OutboundEnvironmentEndpoint"], **kwargs): """ - :keyword value: Required. Collection of resources. + :keyword value: Collection of resources. Required. :paramtype value: list[~azure.mgmt.containerservice.v2022_04_01.models.OutboundEnvironmentEndpoint] """ - super(OutboundEnvironmentEndpointCollection, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class PowerState(msrest.serialization.Model): +class PowerState(_serialization.Model): """Describes the Power State of the cluster. - :ivar code: Tells whether the cluster is Running or Stopped. Known values are: "Running", + :ivar code: Tells whether the cluster is Running or Stopped. Known values are: "Running" and "Stopped". :vartype code: str or ~azure.mgmt.containerservice.v2022_04_01.models.Code """ _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, + "code": {"key": "code", "type": "str"}, } - def __init__( - self, - *, - code: Optional[Union[str, "_models.Code"]] = None, - **kwargs - ): + def __init__(self, *, code: Optional[Union[str, "_models.Code"]] = None, **kwargs): """ - :keyword code: Tells whether the cluster is Running or Stopped. Known values are: "Running", + :keyword code: Tells whether the cluster is Running or Stopped. Known values are: "Running" and "Stopped". :paramtype code: str or ~azure.mgmt.containerservice.v2022_04_01.models.Code """ - super(PowerState, self).__init__(**kwargs) + super().__init__(**kwargs) self.code = code -class PrivateEndpoint(msrest.serialization.Model): +class PrivateEndpoint(_serialization.Model): """Private endpoint which a connection belongs to. :ivar id: The resource ID of the private endpoint. @@ -5082,24 +4941,19 @@ class PrivateEndpoint(msrest.serialization.Model): """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, } - def __init__( - self, - *, - id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin """ :keyword id: The resource ID of the private endpoint. :paramtype id: str """ - super(PrivateEndpoint, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id -class PrivateEndpointConnection(msrest.serialization.Model): +class PrivateEndpointConnection(_serialization.Model): """A private endpoint connection. Variables are only populated by the server, and will be ignored when sending a request. @@ -5111,7 +4965,7 @@ class PrivateEndpointConnection(msrest.serialization.Model): :ivar type: The resource type. :vartype type: str :ivar provisioning_state: The current provisioning state. Known values are: "Succeeded", - "Creating", "Deleting", "Failed". + "Creating", "Deleting", and "Failed". :vartype provisioning_state: str or ~azure.mgmt.containerservice.v2022_04_01.models.PrivateEndpointConnectionProvisioningState :ivar private_endpoint: The resource of private endpoint. @@ -5123,19 +4977,22 @@ class PrivateEndpointConnection(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'provisioning_state': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, - 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "private_endpoint": {"key": "properties.privateEndpoint", "type": "PrivateEndpoint"}, + "private_link_service_connection_state": { + "key": "properties.privateLinkServiceConnectionState", + "type": "PrivateLinkServiceConnectionState", + }, } def __init__( @@ -5153,7 +5010,7 @@ def __init__( :paramtype private_link_service_connection_state: ~azure.mgmt.containerservice.v2022_04_01.models.PrivateLinkServiceConnectionState """ - super(PrivateEndpointConnection, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -5162,7 +5019,7 @@ def __init__( self.private_link_service_connection_state = private_link_service_connection_state -class PrivateEndpointConnectionListResult(msrest.serialization.Model): +class PrivateEndpointConnectionListResult(_serialization.Model): """A list of private endpoint connections. :ivar value: The collection value. @@ -5170,25 +5027,20 @@ class PrivateEndpointConnectionListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, + "value": {"key": "value", "type": "[PrivateEndpointConnection]"}, } - def __init__( - self, - *, - value: Optional[List["_models.PrivateEndpointConnection"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.PrivateEndpointConnection"]] = None, **kwargs): """ :keyword value: The collection value. :paramtype value: list[~azure.mgmt.containerservice.v2022_04_01.models.PrivateEndpointConnection] """ - super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value -class PrivateLinkResource(msrest.serialization.Model): +class PrivateLinkResource(_serialization.Model): """A private link resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -5209,22 +5061,22 @@ class PrivateLinkResource(msrest.serialization.Model): """ _validation = { - 'private_link_service_id': {'readonly': True}, + "private_link_service_id": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'group_id': {'key': 'groupId', 'type': 'str'}, - 'required_members': {'key': 'requiredMembers', 'type': '[str]'}, - 'private_link_service_id': {'key': 'privateLinkServiceID', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "group_id": {"key": "groupId", "type": "str"}, + "required_members": {"key": "requiredMembers", "type": "[str]"}, + "private_link_service_id": {"key": "privateLinkServiceID", "type": "str"}, } def __init__( self, *, - id: Optional[str] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin name: Optional[str] = None, type: Optional[str] = None, group_id: Optional[str] = None, @@ -5243,7 +5095,7 @@ def __init__( :keyword required_members: The RequiredMembers of the resource. :paramtype required_members: list[str] """ - super(PrivateLinkResource, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id self.name = name self.type = type @@ -5252,7 +5104,7 @@ def __init__( self.private_link_service_id = None -class PrivateLinkResourcesListResult(msrest.serialization.Model): +class PrivateLinkResourcesListResult(_serialization.Model): """A list of private link resources. :ivar value: The collection value. @@ -5260,36 +5112,31 @@ class PrivateLinkResourcesListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, + "value": {"key": "value", "type": "[PrivateLinkResource]"}, } - def __init__( - self, - *, - value: Optional[List["_models.PrivateLinkResource"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.PrivateLinkResource"]] = None, **kwargs): """ :keyword value: The collection value. :paramtype value: list[~azure.mgmt.containerservice.v2022_04_01.models.PrivateLinkResource] """ - super(PrivateLinkResourcesListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value -class PrivateLinkServiceConnectionState(msrest.serialization.Model): +class PrivateLinkServiceConnectionState(_serialization.Model): """The state of a private link service connection. :ivar status: The private link service connection status. Known values are: "Pending", - "Approved", "Rejected", "Disconnected". + "Approved", "Rejected", and "Disconnected". :vartype status: str or ~azure.mgmt.containerservice.v2022_04_01.models.ConnectionStatus :ivar description: The private link service connection description. :vartype description: str """ _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, + "status": {"key": "status", "type": "str"}, + "description": {"key": "description", "type": "str"}, } def __init__( @@ -5301,17 +5148,17 @@ def __init__( ): """ :keyword status: The private link service connection status. Known values are: "Pending", - "Approved", "Rejected", "Disconnected". + "Approved", "Rejected", and "Disconnected". :paramtype status: str or ~azure.mgmt.containerservice.v2022_04_01.models.ConnectionStatus :keyword description: The private link service connection description. :paramtype description: str """ - super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) + super().__init__(**kwargs) self.status = status self.description = description -class ResourceReference(msrest.serialization.Model): +class ResourceReference(_serialization.Model): """A reference to an Azure resource. :ivar id: The fully qualified Azure resource id. @@ -5319,29 +5166,24 @@ class ResourceReference(msrest.serialization.Model): """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, } - def __init__( - self, - *, - id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin """ :keyword id: The fully qualified Azure resource id. :paramtype id: str """ - super(ResourceReference, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id -class RunCommandRequest(msrest.serialization.Model): +class RunCommandRequest(_serialization.Model): """A run command request. All required parameters must be populated in order to send to Azure. - :ivar command: Required. The command to run. + :ivar command: The command to run. Required. :vartype command: str :ivar context: A base64 encoded zip file containing the files required by the command. :vartype context: str @@ -5350,38 +5192,31 @@ class RunCommandRequest(msrest.serialization.Model): """ _validation = { - 'command': {'required': True}, + "command": {"required": True}, } _attribute_map = { - 'command': {'key': 'command', 'type': 'str'}, - 'context': {'key': 'context', 'type': 'str'}, - 'cluster_token': {'key': 'clusterToken', 'type': 'str'}, + "command": {"key": "command", "type": "str"}, + "context": {"key": "context", "type": "str"}, + "cluster_token": {"key": "clusterToken", "type": "str"}, } - def __init__( - self, - *, - command: str, - context: Optional[str] = None, - cluster_token: Optional[str] = None, - **kwargs - ): + def __init__(self, *, command: str, context: Optional[str] = None, cluster_token: Optional[str] = None, **kwargs): """ - :keyword command: Required. The command to run. + :keyword command: The command to run. Required. :paramtype command: str :keyword context: A base64 encoded zip file containing the files required by the command. :paramtype context: str :keyword cluster_token: AuthToken issued for AKS AAD Server App. :paramtype cluster_token: str """ - super(RunCommandRequest, self).__init__(**kwargs) + super().__init__(**kwargs) self.command = command self.context = context self.cluster_token = cluster_token -class RunCommandResult(msrest.serialization.Model): +class RunCommandResult(_serialization.Model): """run command result. Variables are only populated by the server, and will be ignored when sending a request. @@ -5403,32 +5238,28 @@ class RunCommandResult(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'exit_code': {'readonly': True}, - 'started_at': {'readonly': True}, - 'finished_at': {'readonly': True}, - 'logs': {'readonly': True}, - 'reason': {'readonly': True}, + "id": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "exit_code": {"readonly": True}, + "started_at": {"readonly": True}, + "finished_at": {"readonly": True}, + "logs": {"readonly": True}, + "reason": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'exit_code': {'key': 'properties.exitCode', 'type': 'int'}, - 'started_at': {'key': 'properties.startedAt', 'type': 'iso-8601'}, - 'finished_at': {'key': 'properties.finishedAt', 'type': 'iso-8601'}, - 'logs': {'key': 'properties.logs', 'type': 'str'}, - 'reason': {'key': 'properties.reason', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(RunCommandResult, self).__init__(**kwargs) + "id": {"key": "id", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "exit_code": {"key": "properties.exitCode", "type": "int"}, + "started_at": {"key": "properties.startedAt", "type": "iso-8601"}, + "finished_at": {"key": "properties.finishedAt", "type": "iso-8601"}, + "logs": {"key": "properties.logs", "type": "str"}, + "reason": {"key": "properties.reason", "type": "str"}, + } + + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.id = None self.provisioning_state = None self.exit_code = None @@ -5438,7 +5269,7 @@ def __init__( self.reason = None -class Snapshot(TrackedResource): +class Snapshot(TrackedResource): # pylint: disable=too-many-instance-attributes """A node pool snapshot resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -5456,25 +5287,24 @@ class Snapshot(TrackedResource): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.containerservice.v2022_04_01.models.SystemData - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] - :ivar location: Required. The geo-location where the resource lives. + :ivar location: The geo-location where the resource lives. Required. :vartype location: str :ivar creation_data: CreationData to be used to specify the source agent pool resource ID to create this snapshot. :vartype creation_data: ~azure.mgmt.containerservice.v2022_04_01.models.CreationData - :ivar snapshot_type: The type of a snapshot. The default is NodePool. Known values are: - "NodePool". Default value: "NodePool". + :ivar snapshot_type: The type of a snapshot. The default is NodePool. "NodePool" :vartype snapshot_type: str or ~azure.mgmt.containerservice.v2022_04_01.models.SnapshotType :ivar kubernetes_version: The version of Kubernetes. :vartype kubernetes_version: str :ivar node_image_version: The version of node image. :vartype node_image_version: str - :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_04_01.models.OSType :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known - values are: "Ubuntu", "CBLMariner". + values are: "Ubuntu" and "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2022_04_01.models.OSSKU :ivar vm_size: The size of the VM. :vartype vm_size: str @@ -5483,34 +5313,34 @@ class Snapshot(TrackedResource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'location': {'required': True}, - 'kubernetes_version': {'readonly': True}, - 'node_image_version': {'readonly': True}, - 'os_type': {'readonly': True}, - 'os_sku': {'readonly': True}, - 'vm_size': {'readonly': True}, - 'enable_fips': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, + "kubernetes_version": {"readonly": True}, + "node_image_version": {"readonly": True}, + "os_type": {"readonly": True}, + "os_sku": {"readonly": True}, + "vm_size": {"readonly": True}, + "enable_fips": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - 'creation_data': {'key': 'properties.creationData', 'type': 'CreationData'}, - 'snapshot_type': {'key': 'properties.snapshotType', 'type': 'str'}, - 'kubernetes_version': {'key': 'properties.kubernetesVersion', 'type': 'str'}, - 'node_image_version': {'key': 'properties.nodeImageVersion', 'type': 'str'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'os_sku': {'key': 'properties.osSku', 'type': 'str'}, - 'vm_size': {'key': 'properties.vmSize', 'type': 'str'}, - 'enable_fips': {'key': 'properties.enableFIPS', 'type': 'bool'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "creation_data": {"key": "properties.creationData", "type": "CreationData"}, + "snapshot_type": {"key": "properties.snapshotType", "type": "str"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "node_image_version": {"key": "properties.nodeImageVersion", "type": "str"}, + "os_type": {"key": "properties.osType", "type": "str"}, + "os_sku": {"key": "properties.osSku", "type": "str"}, + "vm_size": {"key": "properties.vmSize", "type": "str"}, + "enable_fips": {"key": "properties.enableFIPS", "type": "bool"}, } def __init__( @@ -5519,22 +5349,21 @@ def __init__( location: str, tags: Optional[Dict[str, str]] = None, creation_data: Optional["_models.CreationData"] = None, - snapshot_type: Optional[Union[str, "_models.SnapshotType"]] = "NodePool", + snapshot_type: Union[str, "_models.SnapshotType"] = "NodePool", **kwargs ): """ - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] - :keyword location: Required. The geo-location where the resource lives. + :keyword location: The geo-location where the resource lives. Required. :paramtype location: str :keyword creation_data: CreationData to be used to specify the source agent pool resource ID to create this snapshot. :paramtype creation_data: ~azure.mgmt.containerservice.v2022_04_01.models.CreationData - :keyword snapshot_type: The type of a snapshot. The default is NodePool. Known values are: - "NodePool". Default value: "NodePool". + :keyword snapshot_type: The type of a snapshot. The default is NodePool. "NodePool" :paramtype snapshot_type: str or ~azure.mgmt.containerservice.v2022_04_01.models.SnapshotType """ - super(Snapshot, self).__init__(tags=tags, location=location, **kwargs) + super().__init__(tags=tags, location=location, **kwargs) self.creation_data = creation_data self.snapshot_type = snapshot_type self.kubernetes_version = None @@ -5545,7 +5374,7 @@ def __init__( self.enable_fips = None -class SnapshotListResult(msrest.serialization.Model): +class SnapshotListResult(_serialization.Model): """The response from the List Snapshots operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -5557,30 +5386,25 @@ class SnapshotListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[Snapshot]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[Snapshot]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.Snapshot"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.Snapshot"]] = None, **kwargs): """ :keyword value: The list of snapshots. :paramtype value: list[~azure.mgmt.containerservice.v2022_04_01.models.Snapshot] """ - super(SnapshotListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class SysctlConfig(msrest.serialization.Model): +class SysctlConfig(_serialization.Model): # pylint: disable=too-many-instance-attributes """Sysctl settings for Linux agent nodes. :ivar net_core_somaxconn: Sysctl setting net.core.somaxconn. @@ -5642,37 +5466,37 @@ class SysctlConfig(msrest.serialization.Model): """ _attribute_map = { - 'net_core_somaxconn': {'key': 'netCoreSomaxconn', 'type': 'int'}, - 'net_core_netdev_max_backlog': {'key': 'netCoreNetdevMaxBacklog', 'type': 'int'}, - 'net_core_rmem_default': {'key': 'netCoreRmemDefault', 'type': 'int'}, - 'net_core_rmem_max': {'key': 'netCoreRmemMax', 'type': 'int'}, - 'net_core_wmem_default': {'key': 'netCoreWmemDefault', 'type': 'int'}, - 'net_core_wmem_max': {'key': 'netCoreWmemMax', 'type': 'int'}, - 'net_core_optmem_max': {'key': 'netCoreOptmemMax', 'type': 'int'}, - 'net_ipv4_tcp_max_syn_backlog': {'key': 'netIpv4TcpMaxSynBacklog', 'type': 'int'}, - 'net_ipv4_tcp_max_tw_buckets': {'key': 'netIpv4TcpMaxTwBuckets', 'type': 'int'}, - 'net_ipv4_tcp_fin_timeout': {'key': 'netIpv4TcpFinTimeout', 'type': 'int'}, - 'net_ipv4_tcp_keepalive_time': {'key': 'netIpv4TcpKeepaliveTime', 'type': 'int'}, - 'net_ipv4_tcp_keepalive_probes': {'key': 'netIpv4TcpKeepaliveProbes', 'type': 'int'}, - 'net_ipv4_tcpkeepalive_intvl': {'key': 'netIpv4TcpkeepaliveIntvl', 'type': 'int'}, - 'net_ipv4_tcp_tw_reuse': {'key': 'netIpv4TcpTwReuse', 'type': 'bool'}, - 'net_ipv4_ip_local_port_range': {'key': 'netIpv4IpLocalPortRange', 'type': 'str'}, - 'net_ipv4_neigh_default_gc_thresh1': {'key': 'netIpv4NeighDefaultGcThresh1', 'type': 'int'}, - 'net_ipv4_neigh_default_gc_thresh2': {'key': 'netIpv4NeighDefaultGcThresh2', 'type': 'int'}, - 'net_ipv4_neigh_default_gc_thresh3': {'key': 'netIpv4NeighDefaultGcThresh3', 'type': 'int'}, - 'net_netfilter_nf_conntrack_max': {'key': 'netNetfilterNfConntrackMax', 'type': 'int'}, - 'net_netfilter_nf_conntrack_buckets': {'key': 'netNetfilterNfConntrackBuckets', 'type': 'int'}, - 'fs_inotify_max_user_watches': {'key': 'fsInotifyMaxUserWatches', 'type': 'int'}, - 'fs_file_max': {'key': 'fsFileMax', 'type': 'int'}, - 'fs_aio_max_nr': {'key': 'fsAioMaxNr', 'type': 'int'}, - 'fs_nr_open': {'key': 'fsNrOpen', 'type': 'int'}, - 'kernel_threads_max': {'key': 'kernelThreadsMax', 'type': 'int'}, - 'vm_max_map_count': {'key': 'vmMaxMapCount', 'type': 'int'}, - 'vm_swappiness': {'key': 'vmSwappiness', 'type': 'int'}, - 'vm_vfs_cache_pressure': {'key': 'vmVfsCachePressure', 'type': 'int'}, - } - - def __init__( + "net_core_somaxconn": {"key": "netCoreSomaxconn", "type": "int"}, + "net_core_netdev_max_backlog": {"key": "netCoreNetdevMaxBacklog", "type": "int"}, + "net_core_rmem_default": {"key": "netCoreRmemDefault", "type": "int"}, + "net_core_rmem_max": {"key": "netCoreRmemMax", "type": "int"}, + "net_core_wmem_default": {"key": "netCoreWmemDefault", "type": "int"}, + "net_core_wmem_max": {"key": "netCoreWmemMax", "type": "int"}, + "net_core_optmem_max": {"key": "netCoreOptmemMax", "type": "int"}, + "net_ipv4_tcp_max_syn_backlog": {"key": "netIpv4TcpMaxSynBacklog", "type": "int"}, + "net_ipv4_tcp_max_tw_buckets": {"key": "netIpv4TcpMaxTwBuckets", "type": "int"}, + "net_ipv4_tcp_fin_timeout": {"key": "netIpv4TcpFinTimeout", "type": "int"}, + "net_ipv4_tcp_keepalive_time": {"key": "netIpv4TcpKeepaliveTime", "type": "int"}, + "net_ipv4_tcp_keepalive_probes": {"key": "netIpv4TcpKeepaliveProbes", "type": "int"}, + "net_ipv4_tcpkeepalive_intvl": {"key": "netIpv4TcpkeepaliveIntvl", "type": "int"}, + "net_ipv4_tcp_tw_reuse": {"key": "netIpv4TcpTwReuse", "type": "bool"}, + "net_ipv4_ip_local_port_range": {"key": "netIpv4IpLocalPortRange", "type": "str"}, + "net_ipv4_neigh_default_gc_thresh1": {"key": "netIpv4NeighDefaultGcThresh1", "type": "int"}, + "net_ipv4_neigh_default_gc_thresh2": {"key": "netIpv4NeighDefaultGcThresh2", "type": "int"}, + "net_ipv4_neigh_default_gc_thresh3": {"key": "netIpv4NeighDefaultGcThresh3", "type": "int"}, + "net_netfilter_nf_conntrack_max": {"key": "netNetfilterNfConntrackMax", "type": "int"}, + "net_netfilter_nf_conntrack_buckets": {"key": "netNetfilterNfConntrackBuckets", "type": "int"}, + "fs_inotify_max_user_watches": {"key": "fsInotifyMaxUserWatches", "type": "int"}, + "fs_file_max": {"key": "fsFileMax", "type": "int"}, + "fs_aio_max_nr": {"key": "fsAioMaxNr", "type": "int"}, + "fs_nr_open": {"key": "fsNrOpen", "type": "int"}, + "kernel_threads_max": {"key": "kernelThreadsMax", "type": "int"}, + "vm_max_map_count": {"key": "vmMaxMapCount", "type": "int"}, + "vm_swappiness": {"key": "vmSwappiness", "type": "int"}, + "vm_vfs_cache_pressure": {"key": "vmVfsCachePressure", "type": "int"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, net_core_somaxconn: Optional[int] = None, @@ -5763,7 +5587,7 @@ def __init__( :keyword vm_vfs_cache_pressure: Sysctl setting vm.vfs_cache_pressure. :paramtype vm_vfs_cache_pressure: int """ - super(SysctlConfig, self).__init__(**kwargs) + super().__init__(**kwargs) self.net_core_somaxconn = net_core_somaxconn self.net_core_netdev_max_backlog = net_core_netdev_max_backlog self.net_core_rmem_default = net_core_rmem_default @@ -5794,20 +5618,20 @@ def __init__( self.vm_vfs_cache_pressure = vm_vfs_cache_pressure -class SystemData(msrest.serialization.Model): +class SystemData(_serialization.Model): """Metadata pertaining to creation and last modification of the resource. :ivar created_by: The identity that created the resource. :vartype created_by: str :ivar created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", "Key". + "User", "Application", "ManagedIdentity", and "Key". :vartype created_by_type: str or ~azure.mgmt.containerservice.v2022_04_01.models.CreatedByType :ivar created_at: The timestamp of resource creation (UTC). :vartype created_at: ~datetime.datetime :ivar last_modified_by: The identity that last modified the resource. :vartype last_modified_by: str :ivar last_modified_by_type: The type of identity that last modified the resource. Known values - are: "User", "Application", "ManagedIdentity", "Key". + are: "User", "Application", "ManagedIdentity", and "Key". :vartype last_modified_by_type: str or ~azure.mgmt.containerservice.v2022_04_01.models.CreatedByType :ivar last_modified_at: The timestamp of resource last modification (UTC). @@ -5815,12 +5639,12 @@ class SystemData(msrest.serialization.Model): """ _attribute_map = { - 'created_by': {'key': 'createdBy', 'type': 'str'}, - 'created_by_type': {'key': 'createdByType', 'type': 'str'}, - 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, - 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, - 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, - 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + "created_by": {"key": "createdBy", "type": "str"}, + "created_by_type": {"key": "createdByType", "type": "str"}, + "created_at": {"key": "createdAt", "type": "iso-8601"}, + "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, + "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, + "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, } def __init__( @@ -5838,7 +5662,7 @@ def __init__( :keyword created_by: The identity that created the resource. :paramtype created_by: str :keyword created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", "Key". + "User", "Application", "ManagedIdentity", and "Key". :paramtype created_by_type: str or ~azure.mgmt.containerservice.v2022_04_01.models.CreatedByType :keyword created_at: The timestamp of resource creation (UTC). @@ -5846,13 +5670,13 @@ def __init__( :keyword last_modified_by: The identity that last modified the resource. :paramtype last_modified_by: str :keyword last_modified_by_type: The type of identity that last modified the resource. Known - values are: "User", "Application", "ManagedIdentity", "Key". + values are: "User", "Application", "ManagedIdentity", and "Key". :paramtype last_modified_by_type: str or ~azure.mgmt.containerservice.v2022_04_01.models.CreatedByType :keyword last_modified_at: The timestamp of resource last modification (UTC). :paramtype last_modified_at: ~datetime.datetime """ - super(SystemData, self).__init__(**kwargs) + super().__init__(**kwargs) self.created_by = created_by self.created_by_type = created_by_type self.created_at = created_at @@ -5861,36 +5685,31 @@ def __init__( self.last_modified_at = last_modified_at -class TagsObject(msrest.serialization.Model): +class TagsObject(_serialization.Model): """Tags object for patch operations. - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] """ _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] """ - super(TagsObject, self).__init__(**kwargs) + super().__init__(**kwargs) self.tags = tags -class TimeInWeek(msrest.serialization.Model): +class TimeInWeek(_serialization.Model): """Time in a week. :ivar day: The day of the week. Known values are: "Sunday", "Monday", "Tuesday", "Wednesday", - "Thursday", "Friday", "Saturday". + "Thursday", "Friday", and "Saturday". :vartype day: str or ~azure.mgmt.containerservice.v2022_04_01.models.WeekDay :ivar hour_slots: Each integer hour represents a time range beginning at 0m after the hour ending at the next hour (non-inclusive). 0 corresponds to 00:00 UTC, 23 corresponds to 23:00 @@ -5899,32 +5718,28 @@ class TimeInWeek(msrest.serialization.Model): """ _attribute_map = { - 'day': {'key': 'day', 'type': 'str'}, - 'hour_slots': {'key': 'hourSlots', 'type': '[int]'}, + "day": {"key": "day", "type": "str"}, + "hour_slots": {"key": "hourSlots", "type": "[int]"}, } def __init__( - self, - *, - day: Optional[Union[str, "_models.WeekDay"]] = None, - hour_slots: Optional[List[int]] = None, - **kwargs + self, *, day: Optional[Union[str, "_models.WeekDay"]] = None, hour_slots: Optional[List[int]] = None, **kwargs ): """ :keyword day: The day of the week. Known values are: "Sunday", "Monday", "Tuesday", - "Wednesday", "Thursday", "Friday", "Saturday". + "Wednesday", "Thursday", "Friday", and "Saturday". :paramtype day: str or ~azure.mgmt.containerservice.v2022_04_01.models.WeekDay :keyword hour_slots: Each integer hour represents a time range beginning at 0m after the hour ending at the next hour (non-inclusive). 0 corresponds to 00:00 UTC, 23 corresponds to 23:00 UTC. Specifying [0, 1] means the 00:00 - 02:00 UTC time range. :paramtype hour_slots: list[int] """ - super(TimeInWeek, self).__init__(**kwargs) + super().__init__(**kwargs) self.day = day self.hour_slots = hour_slots -class TimeSpan(msrest.serialization.Model): +class TimeSpan(_serialization.Model): """For example, between 2021-05-25T13:00:00Z and 2021-05-25T14:00:00Z. :ivar start: The start of a time span. @@ -5934,29 +5749,23 @@ class TimeSpan(msrest.serialization.Model): """ _attribute_map = { - 'start': {'key': 'start', 'type': 'iso-8601'}, - 'end': {'key': 'end', 'type': 'iso-8601'}, + "start": {"key": "start", "type": "iso-8601"}, + "end": {"key": "end", "type": "iso-8601"}, } - def __init__( - self, - *, - start: Optional[datetime.datetime] = None, - end: Optional[datetime.datetime] = None, - **kwargs - ): + def __init__(self, *, start: Optional[datetime.datetime] = None, end: Optional[datetime.datetime] = None, **kwargs): """ :keyword start: The start of a time span. :paramtype start: ~datetime.datetime :keyword end: The end of a time span. :paramtype end: ~datetime.datetime """ - super(TimeSpan, self).__init__(**kwargs) + super().__init__(**kwargs) self.start = start self.end = end -class WindowsGmsaProfile(msrest.serialization.Model): +class WindowsGmsaProfile(_serialization.Model): """Windows gMSA Profile in the managed cluster. :ivar enabled: Specifies whether to enable Windows gMSA in the managed cluster. @@ -5972,9 +5781,9 @@ class WindowsGmsaProfile(msrest.serialization.Model): """ _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'dns_server': {'key': 'dnsServer', 'type': 'str'}, - 'root_domain_name': {'key': 'rootDomainName', 'type': 'str'}, + "enabled": {"key": "enabled", "type": "bool"}, + "dns_server": {"key": "dnsServer", "type": "str"}, + "root_domain_name": {"key": "rootDomainName", "type": "str"}, } def __init__( @@ -5997,7 +5806,7 @@ def __init__( which is used to create the managed cluster. :paramtype root_domain_name: str """ - super(WindowsGmsaProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.dns_server = dns_server self.root_domain_name = root_domain_name diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/models/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/models/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/models/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/models/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/operations/__init__.py index e0748876288c..593b23075ce0 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/operations/__init__.py @@ -18,15 +18,16 @@ from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'Operations', - 'ManagedClustersOperations', - 'MaintenanceConfigurationsOperations', - 'AgentPoolsOperations', - 'PrivateEndpointConnectionsOperations', - 'PrivateLinkResourcesOperations', - 'ResolvePrivateLinkServiceIdOperations', - 'SnapshotsOperations', + "Operations", + "ManagedClustersOperations", + "MaintenanceConfigurationsOperations", + "AgentPoolsOperations", + "PrivateEndpointConnectionsOperations", + "PrivateLinkResourcesOperations", + "ResolvePrivateLinkServiceIdOperations", + "SnapshotsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/operations/_agent_pools_operations.py index 65692ea16221..ac6400943229 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/operations/_agent_pools_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,288 +27,303 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - *, - json: Optional[_models.AgentPool] = None, - content: Any = None, - **kwargs: Any + _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, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + _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, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_get_upgrade_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_available_agent_pool_versions_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_upgrade_node_image_version_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_upgrade_node_image_version_request( + resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class AgentPoolsOperations: """ @@ -324,47 +344,40 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> Iterable[_models.AgentPoolListResult]: + def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> Iterable["_models.AgentPool"]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AgentPoolListResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_04_01.models.AgentPoolListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either AgentPool or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_04_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -372,16 +385,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -397,10 +405,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -410,54 +416,46 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore @distributed_trace def get( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPool: """Gets the specified managed cluster agent pool. Gets the specified managed cluster agent pool. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPool, or the result of cls(response) + :return: AgentPool or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.AgentPool - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -465,57 +463,60 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore def _create_or_update_initial( self, resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: _models.AgentPool, + parameters: Union[_models.AgentPool, IO], **kwargs: Any ) -> _models.AgentPool: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - _json = self._serialize.body(parameters, 'AgentPool') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "AgentPool") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -523,10 +524,9 @@ def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -534,26 +534,27 @@ def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - @distributed_trace + @overload def begin_create_or_update( self, resource_group_name: str, resource_name: str, agent_pool_name: str, parameters: _models.AgentPool, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.AgentPool]: """Creates or updates an agent pool in the specified managed cluster. @@ -561,13 +562,58 @@ def begin_create_or_update( Creates or updates an agent pool in the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str - :param parameters: The agent pool to create or update. + :param parameters: The agent pool to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_04_01.models.AgentPool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_04_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AgentPool]: + """Creates or updates an agent pool in the specified managed cluster. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: The agent pool to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -579,20 +625,57 @@ def begin_create_or_update( :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_04_01.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: Union[_models.AgentPool, IO], + **kwargs: Any + ) -> LROPoller[_models.AgentPool]: + """Creates or updates an agent pool in the specified managed cluster. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: The agent pool to create or update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.mgmt.containerservice.v2022_04_01.models.AgentPool or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_04_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -601,66 +684,55 @@ def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -668,10 +740,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -681,26 +752,22 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + def begin_delete( + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> LROPoller[None]: """Deletes an agent pool in the specified managed cluster. Deletes an agent pool in the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -712,99 +779,86 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPoolUpgradeProfile: """Gets the upgrade profile for an agent pool. Gets the upgrade profile for an agent pool. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolUpgradeProfile, or the result of cls(response) + :return: AgentPoolUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.AgentPoolUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -812,32 +866,27 @@ def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolUpgradeProfile', pipeline_response) + deserialized = self._deserialize("AgentPoolUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore @distributed_trace def get_available_agent_pool_versions( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported Kubernetes versions for the specified agent pool. @@ -846,32 +895,30 @@ def get_available_agent_pool_versions( the version lifecycle. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolAvailableVersions, or the result of cls(response) + :return: AgentPoolAvailableVersions or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.AgentPoolAvailableVersions - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolAvailableVersions] - request = build_get_available_agent_pool_versions_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_available_agent_pool_versions.metadata['url'], + template_url=self.get_available_agent_pool_versions.metadata["url"], headers=_headers, params=_params, ) @@ -879,52 +926,43 @@ def get_available_agent_pool_versions( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolAvailableVersions', pipeline_response) + deserialized = self._deserialize("AgentPoolAvailableVersions", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_available_agent_pool_versions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore - + get_available_agent_pool_versions.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore def _upgrade_node_image_version_initial( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> Optional[_models.AgentPool]: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.AgentPool]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.AgentPool]] - - request = build_upgrade_node_image_version_request_initial( - subscription_id=self._config.subscription_id, + request = build_upgrade_node_image_version_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._upgrade_node_image_version_initial.metadata['url'], + template_url=self._upgrade_node_image_version_initial.metadata["url"], headers=_headers, params=_params, ) @@ -932,10 +970,9 @@ def _upgrade_node_image_version_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -945,26 +982,23 @@ def _upgrade_node_image_version_initial( deserialized = None response_headers = {} if response.status_code == 202: - response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) - - deserialized = self._deserialize('AgentPool', pipeline_response) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _upgrade_node_image_version_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore - + _upgrade_node_image_version_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore @distributed_trace def begin_upgrade_node_image_version( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any - ) -> LROPoller[_models.AgentPool]: + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any + ) -> LROPoller[None]: """Upgrades the node image version of an agent pool to the latest. Upgrading the node image version of an agent pool applies the newest OS and runtime updates to @@ -972,10 +1006,11 @@ def begin_upgrade_node_image_version( node image versions, see: https://docs.microsoft.com/azure/aks/node-image-upgrade. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -988,59 +1023,54 @@ def begin_upgrade_node_image_version( :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_04_01.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._upgrade_node_image_version_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) - - deserialized = self._deserialize('AgentPool', pipeline_response) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_upgrade_node_image_version.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore + begin_upgrade_node_image_version.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/operations/_maintenance_configurations_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/operations/_maintenance_configurations_operations.py index 8da22a45b046..431d815178ba 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/operations/_maintenance_configurations_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/operations/_maintenance_configurations_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,173 +25,181 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +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_managed_cluster_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, config_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "configName": _SERIALIZER.url("config_name", config_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "configName": _SERIALIZER.url("config_name", config_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - config_name: str, - *, - json: Optional[_models.MaintenanceConfiguration] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, resource_name: str, config_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "configName": _SERIALIZER.url("config_name", config_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "configName": _SERIALIZER.url("config_name", config_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, config_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "configName": _SERIALIZER.url("config_name", config_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "configName": _SERIALIZER.url("config_name", config_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class MaintenanceConfigurationsOperations: """ @@ -207,48 +220,44 @@ def __init__(self, *args, **kwargs): 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_managed_cluster( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> Iterable[_models.MaintenanceConfigurationListResult]: + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> Iterable["_models.MaintenanceConfiguration"]: """Gets a list of maintenance configurations in the specified managed cluster. Gets a list of maintenance configurations in the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either MaintenanceConfigurationListResult or the result - of cls(response) + :return: An iterator like instance of either MaintenanceConfiguration or the result of + cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_04_01.models.MaintenanceConfigurationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_04_01.models.MaintenanceConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfigurationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfigurationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_managed_cluster_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_managed_cluster.metadata['url'], + template_url=self.list_by_managed_cluster.metadata["url"], headers=_headers, params=_params, ) @@ -256,16 +265,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_managed_cluster_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -281,10 +285,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -294,54 +296,46 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_managed_cluster.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations"} # type: ignore + list_by_managed_cluster.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations"} # type: ignore @distributed_trace def get( - self, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, config_name: str, **kwargs: Any ) -> _models.MaintenanceConfiguration: """Gets the specified maintenance configuration of a managed cluster. Gets the specified maintenance configuration of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: MaintenanceConfiguration, or the result of cls(response) + :return: MaintenanceConfiguration or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.MaintenanceConfiguration - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfiguration] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -349,33 +343,33 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) + deserialized = self._deserialize("MaintenanceConfiguration", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - - @distributed_trace + @overload def create_or_update( self, resource_group_name: str, resource_name: str, config_name: str, parameters: _models.MaintenanceConfiguration, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.MaintenanceConfiguration: """Creates or updates a maintenance configuration in the specified managed cluster. @@ -383,41 +377,116 @@ def create_or_update( Creates or updates a maintenance configuration in the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str - :param parameters: The maintenance configuration to create or update. + :param parameters: The maintenance configuration to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_04_01.models.MaintenanceConfiguration + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: MaintenanceConfiguration, or the result of cls(response) + :return: MaintenanceConfiguration or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.MaintenanceConfiguration - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configuration in the specified managed cluster. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: The maintenance configuration to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: Union[_models.MaintenanceConfiguration, IO], + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configuration in the specified managed cluster. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: The maintenance configuration to create or update. Is either a model type or + a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_04_01.models.MaintenanceConfiguration or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfiguration] - _json = self._serialize.body(parameters, 'MaintenanceConfiguration') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "MaintenanceConfiguration") request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) @@ -425,68 +494,60 @@ def create_or_update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) + deserialized = self._deserialize("MaintenanceConfiguration", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore @distributed_trace def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, config_name: str, **kwargs: Any ) -> None: """Deletes a maintenance configuration. Deletes a maintenance configuration. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) @@ -494,10 +555,9 @@ def delete( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -507,5 +567,4 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/operations/_managed_clusters_operations.py index b626f48287ee..831305876f05 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/operations/_managed_clusters_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,200 +27,189 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_get_os_options_request( - subscription_id: str, - location: str, - *, - resource_type: Optional[str] = None, - **kwargs: Any + location: str, subscription_id: str, *, resource_type: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "location": _SERIALIZER.url("location", location, 'str', min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "location": _SERIALIZER.url("location", location, "str", min_length=1), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if resource_type is not None: - _params['resource-type'] = _SERIALIZER.query("resource_type", resource_type, 'str') + _params["resource-type"] = _SERIALIZER.query("resource_type", resource_type, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters") + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters" + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_resource_group_request( - subscription_id: str, - resource_group_name: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_upgrade_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_access_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, role_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "roleName": _SERIALIZER.url("role_name", role_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "roleName": _SERIALIZER.url("role_name", role_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_admin_credentials_request( - subscription_id: str, resource_group_name: str, resource_name: str, + subscription_id: str, *, server_fqdn: Optional[str] = None, **kwargs: Any @@ -223,40 +217,46 @@ def build_list_cluster_admin_credentials_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if server_fqdn is not None: - _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + _params["server-fqdn"] = _SERIALIZER.query("server_fqdn", server_fqdn, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_user_credentials_request( - subscription_id: str, resource_group_name: str, resource_name: str, + subscription_id: str, *, server_fqdn: Optional[str] = None, format: Optional[Union[str, "_models.Format"]] = None, @@ -265,42 +265,48 @@ def build_list_cluster_user_credentials_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if server_fqdn is not None: - _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + _params["server-fqdn"] = _SERIALIZER.query("server_fqdn", server_fqdn, "str") if format is not None: - _params['format'] = _SERIALIZER.query("format", format, 'str') + _params["format"] = _SERIALIZER.query("format", format, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_monitoring_user_credentials_request( - subscription_id: str, resource_group_name: str, resource_name: str, + subscription_id: str, *, server_fqdn: Optional[str] = None, **kwargs: Any @@ -308,520 +314,535 @@ def build_list_cluster_monitoring_user_credentials_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if server_fqdn is not None: - _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + _params["server-fqdn"] = _SERIALIZER.query("server_fqdn", server_fqdn, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: + +def build_get_request(resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedCluster] = None, - content: Any = None, - **kwargs: Any + +def build_create_or_update_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_update_tags_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.TagsObject] = None, - content: Any = None, - **kwargs: Any + +def build_update_tags_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + +def build_delete_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_reset_service_principal_profile_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedClusterServicePrincipalProfile] = None, - content: Any = None, - **kwargs: Any + +def build_reset_service_principal_profile_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_reset_aad_profile_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedClusterAADProfile] = None, - content: Any = None, - **kwargs: Any + +def build_reset_aad_profile_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_rotate_cluster_certificates_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + +def build_rotate_cluster_certificates_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_stop_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + +def build_stop_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_start_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + +def build_start_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_run_command_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.RunCommandRequest] = None, - content: Any = None, - **kwargs: Any + +def build_run_command_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_get_command_result_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - command_id: str, - **kwargs: Any + resource_group_name: str, resource_name: str, command_id: 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "commandId": _SERIALIZER.url("command_id", command_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "commandId": _SERIALIZER.url("command_id", command_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_list_outbound_network_dependencies_endpoints_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + class ManagedClustersOperations: # pylint: disable=too-many-public-methods """ @@ -842,46 +863,39 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def get_os_options( - self, - location: str, - resource_type: Optional[str] = None, - **kwargs: Any + self, location: str, resource_type: Optional[str] = None, **kwargs: Any ) -> _models.OSOptionProfile: """Gets supported OS options in the specified subscription. Gets supported OS options in the specified subscription. - :param location: The name of Azure region. + :param location: The name of Azure region. Required. :type location: str :param resource_type: The resource type for which the OS options needs to be returned. Default value is None. :type resource_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: OSOptionProfile, or the result of cls(response) + :return: OSOptionProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.OSOptionProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OSOptionProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OSOptionProfile] - request = build_get_os_options_request( - subscription_id=self._config.subscription_id, location=location, - api_version=api_version, + subscription_id=self._config.subscription_id, resource_type=resource_type, - template_url=self.get_os_options.metadata['url'], + api_version=api_version, + template_url=self.get_os_options.metadata["url"], headers=_headers, params=_params, ) @@ -889,59 +903,52 @@ def get_os_options( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('OSOptionProfile', pipeline_response) + deserialized = self._deserialize("OSOptionProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_os_options.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default"} # type: ignore - + get_os_options.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default"} # type: ignore @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.ManagedClusterListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.ManagedCluster"]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_04_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_04_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -949,14 +956,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -972,10 +976,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -985,49 +987,42 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> Iterable[_models.ManagedClusterListResult]: + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.ManagedCluster"]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_04_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_04_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -1035,15 +1030,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -1059,10 +1050,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1072,50 +1061,43 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.ManagedClusterUpgradeProfile: """Gets the upgrade profile of a managed cluster. Gets the upgrade profile of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterUpgradeProfile, or the result of cls(response) + :return: ManagedClusterUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.ManagedClusterUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -1123,33 +1105,27 @@ def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterUpgradeProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore @distributed_trace def get_access_profile( - self, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, role_name: str, **kwargs: Any ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. @@ -1159,35 +1135,33 @@ def get_access_profile( `_ . :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param role_name: The name of the role for managed cluster accessProfile resource. + :param role_name: The name of the role for managed cluster accessProfile resource. Required. :type role_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterAccessProfile, or the result of cls(response) + :return: ManagedClusterAccessProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.ManagedClusterAccessProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterAccessProfile] - request = build_get_access_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, role_name=role_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_access_profile.metadata['url'], + template_url=self.get_access_profile.metadata["url"], headers=_headers, params=_params, ) @@ -1195,68 +1169,60 @@ def get_access_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterAccessProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterAccessProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_access_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore - + get_access_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore @distributed_trace def list_cluster_admin_credentials( - self, - resource_group_name: str, - resource_name: str, - server_fqdn: Optional[str] = None, - **kwargs: Any + self, resource_group_name: str, resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any ) -> _models.CredentialResults: """Lists the admin credentials of a managed cluster. Lists the admin credentials of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_admin_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, - template_url=self.list_cluster_admin_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_admin_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -1264,25 +1230,23 @@ def list_cluster_admin_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_admin_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore - + list_cluster_admin_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore @distributed_trace def list_cluster_user_credentials( @@ -1298,40 +1262,39 @@ def list_cluster_user_credentials( Lists the user credentials of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :param format: Only apply to AAD clusters, specifies the format of returned kubeconfig. Format 'azure' will return azure auth-provider kubeconfig; format 'exec' will return exec format - kubeconfig, which requires kubelogin binary in the path. Default value is None. + kubeconfig, which requires kubelogin binary in the path. Known values are: "azure" and "exec". + Default value is None. :type format: str or ~azure.mgmt.containerservice.v2022_04_01.models.Format :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, format=format, - template_url=self.list_cluster_user_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -1339,68 +1302,60 @@ def list_cluster_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore - + list_cluster_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore @distributed_trace def list_cluster_monitoring_user_credentials( - self, - resource_group_name: str, - resource_name: str, - server_fqdn: Optional[str] = None, - **kwargs: Any + self, resource_group_name: str, resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any ) -> _models.CredentialResults: """Lists the cluster monitoring user credentials of a managed cluster. Lists the cluster monitoring user credentials of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_monitoring_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, - template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_monitoring_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -1408,64 +1363,55 @@ def list_cluster_monitoring_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_monitoring_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore - + list_cluster_monitoring_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore @distributed_trace - def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.ManagedCluster: + def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.ManagedCluster: """Gets a managed cluster. Gets a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedCluster, or the result of cls(response) + :return: ManagedCluster or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.ManagedCluster - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -1473,55 +1419,54 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _create_or_update_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.ManagedCluster, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'ManagedCluster') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedCluster") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1529,10 +1474,9 @@ def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -1540,25 +1484,26 @@ def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - - @distributed_trace + @overload def begin_create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedCluster, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. @@ -1566,11 +1511,15 @@ def begin_create_or_update( Creates or updates a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The managed cluster to create or update. + :param parameters: The managed cluster to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_04_01.models.ManagedCluster + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1583,90 +1532,157 @@ def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_04_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._create_or_update_initial( # type: ignore - resource_group_name=resource_group_name, - resource_name=resource_name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop('error_map', None) - def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized + @overload + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + Creates or updates a managed cluster. - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling - if cont_token: + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_04_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster to create or update. Is either a model type or a IO + type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_04_01.models.ManagedCluster or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_04_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ManagedCluster", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _update_tags_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.TagsObject, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request_initial( - subscription_id=self._config.subscription_id, + request = build_update_tags_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_tags_initial.metadata['url'], + content=_content, + template_url=self._update_tags_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1674,32 +1690,32 @@ def _update_tags_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_tags_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _update_tags_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - @distributed_trace + @overload def begin_update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. @@ -1707,11 +1723,88 @@ def begin_update_tags( Updates tags on a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2022_04_01.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_04_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates tags on a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_04_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates tags on a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_04_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1724,20 +1817,17 @@ def begin_update_tags( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_04_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, @@ -1745,64 +1835,54 @@ def begin_update_tags( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1810,10 +1890,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1823,23 +1902,18 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> LROPoller[None]: + def begin_delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> LROPoller[None]: """Deletes a managed cluster. Deletes a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1851,85 +1925,83 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterServicePrincipalProfile, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterServicePrincipalProfile") - request = build_reset_service_principal_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_service_principal_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_service_principal_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_service_principal_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1937,10 +2009,9 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1950,15 +2021,16 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re if cls: return cls(pipeline_response, None, {}) - _reset_service_principal_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + _reset_service_principal_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore - - @distributed_trace - def begin_reset_service_principal_profile( # pylint: disable=inconsistent-return-statements + @overload + def begin_reset_service_principal_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterServicePrincipalProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: """Reset the Service Principal Profile of a managed cluster. @@ -1966,12 +2038,53 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur This action cannot be performed on a cluster that is not using a service principal. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The service principal profile to set on the managed cluster. + :param parameters: The service principal profile to set on the managed cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2022_04_01.models.ManagedClusterServicePrincipalProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reset the Service Principal Profile of a managed cluster. + + This action cannot be performed on a cluster that is not using a service principal. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The service principal profile to set on the managed cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1982,20 +2095,54 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Reset the Service Principal Profile of a managed cluster. + + This action cannot be performed on a cluster that is not using a service principal. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The service principal profile to set on the managed cluster. Is either a + model type or a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2022_04_01.models.ManagedClusterServicePrincipalProfile or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -2003,67 +2150,68 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_service_principal_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + begin_reset_service_principal_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterAADProfile, + parameters: Union[_models.ManagedClusterAADProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterAADProfile") - request = build_reset_aad_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_aad_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_aad_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_aad_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2071,10 +2219,9 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -2084,15 +2231,16 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement if cls: return cls(pipeline_response, None, {}) - _reset_aad_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - + _reset_aad_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - @distributed_trace - def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements + @overload + def begin_reset_aad_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterAADProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: """Reset the AAD Profile of a managed cluster. @@ -2100,11 +2248,89 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements Reset the AAD Profile of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The AAD profile to set on the Managed Cluster. + :param parameters: The AAD profile to set on the Managed Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2022_04_01.models.ManagedClusterAADProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reset the AAD Profile of a managed cluster. + + Reset the AAD Profile of a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The AAD profile to set on the Managed Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterAADProfile, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Reset the AAD Profile of a managed cluster. + + Reset the AAD Profile of a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The AAD profile to set on the Managed Cluster. Is either a model type or a + IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_04_01.models.ManagedClusterAADProfile or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -2115,20 +2341,17 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -2136,62 +2359,52 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_aad_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + begin_reset_aad_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_rotate_cluster_certificates_request_initial( - subscription_id=self._config.subscription_id, + request = build_rotate_cluster_certificates_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._rotate_cluster_certificates_initial.metadata['url'], + template_url=self._rotate_cluster_certificates_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2199,10 +2412,9 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -2212,15 +2424,11 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return if cls: return cls(pipeline_response, None, {}) - _rotate_cluster_certificates_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore - + _rotate_cluster_certificates_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore @distributed_trace - def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + def begin_rotate_cluster_certificates( + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> LROPoller[None]: """Rotates the certificates of a managed cluster. @@ -2228,8 +2436,9 @@ def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-st more details about rotating managed cluster certificates. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -2241,80 +2450,67 @@ def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-st Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._rotate_cluster_certificates_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_rotate_cluster_certificates.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore + begin_rotate_cluster_certificates.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore def _stop_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_stop_request_initial( - subscription_id=self._config.subscription_id, + request = build_stop_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._stop_initial.metadata['url'], + template_url=self._stop_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2322,10 +2518,9 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -2335,16 +2530,10 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore - + _stop_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore @distributed_trace - def begin_stop( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> LROPoller[None]: + def begin_stop(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> LROPoller[None]: """Stops a Managed Cluster. This can only be performed on Azure Virtual Machine Scale set backed clusters. Stopping a @@ -2354,8 +2543,9 @@ def begin_stop( # pylint: disable=inconsistent-return-statements cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -2367,80 +2557,67 @@ def begin_stop( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._stop_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore + begin_stop.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore def _start_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_start_request_initial( - subscription_id=self._config.subscription_id, + request = build_start_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._start_initial.metadata['url'], + template_url=self._start_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2448,10 +2625,9 @@ def _start_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -2461,24 +2637,19 @@ def _start_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore - + _start_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore @distributed_trace - def begin_start( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> LROPoller[None]: + def begin_start(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> LROPoller[None]: """Starts a previously stopped Managed Cluster. See `starting a cluster `_ for more details about starting a cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -2490,85 +2661,83 @@ def begin_start( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._start_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore + begin_start.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore def _run_command_initial( self, resource_group_name: str, resource_name: str, - request_payload: _models.RunCommandRequest, + request_payload: Union[_models.RunCommandRequest, IO], **kwargs: Any ) -> Optional[_models.RunCommandResult]: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RunCommandResult]] - _json = self._serialize.body(request_payload, 'RunCommandRequest') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(request_payload, (IO, bytes)): + _content = request_payload + else: + _json = self._serialize.body(request_payload, "RunCommandRequest") - request = build_run_command_request_initial( - subscription_id=self._config.subscription_id, + request = build_run_command_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._run_command_initial.metadata['url'], + content=_content, + template_url=self._run_command_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2576,10 +2745,9 @@ def _run_command_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -2588,22 +2756,23 @@ def _run_command_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _run_command_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore + _run_command_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore - - @distributed_trace + @overload def begin_run_command( self, resource_group_name: str, resource_name: str, request_payload: _models.RunCommandRequest, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.RunCommandResult]: """Submits a command to run against the Managed Cluster. @@ -2613,11 +2782,15 @@ def begin_run_command( `_. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param request_payload: The run command request. + :param request_payload: The run command request. Required. :type request_payload: ~azure.mgmt.containerservice.v2022_04_01.models.RunCommandRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -2630,20 +2803,97 @@ def begin_run_command( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_04_01.models.RunCommandResult] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_run_command( + self, + resource_group_name: str, + resource_name: str, + request_payload: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RunCommandResult]: + """Submits a command to run against the Managed Cluster. + + AKS will create a pod to run the command. This is primarily useful for private clusters. For + more information see `AKS Run Command + `_. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param request_payload: The run command request. Required. + :type request_payload: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either RunCommandResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_04_01.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_run_command( + self, + resource_group_name: str, + resource_name: str, + request_payload: Union[_models.RunCommandRequest, IO], + **kwargs: Any + ) -> LROPoller[_models.RunCommandResult]: + """Submits a command to run against the Managed Cluster. + + AKS will create a pod to run the command. This is primarily useful for private clusters. For + more information see `AKS Run Command + `_. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param request_payload: The run command request. Is either a model type or a IO type. Required. + :type request_payload: ~azure.mgmt.containerservice.v2022_04_01.models.RunCommandRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either RunCommandResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_04_01.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.RunCommandResult] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.RunCommandResult] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._run_command_initial( # type: ignore resource_group_name=resource_group_name, @@ -2651,82 +2901,72 @@ def begin_run_command( request_payload=request_payload, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_run_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore + begin_run_command.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore @distributed_trace def get_command_result( - self, - resource_group_name: str, - resource_name: str, - command_id: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, command_id: str, **kwargs: Any ) -> Optional[_models.RunCommandResult]: """Gets the results of a command which has been run on the Managed Cluster. Gets the results of a command which has been run on the Managed Cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param command_id: Id of the command. + :param command_id: Id of the command. Required. :type command_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: RunCommandResult, or the result of cls(response) + :return: RunCommandResult or None or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.RunCommandResult or None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RunCommandResult]] - request = build_get_command_result_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, command_id=command_id, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_command_result.metadata['url'], + template_url=self.get_command_result.metadata["url"], headers=_headers, params=_params, ) @@ -2734,10 +2974,9 @@ def get_command_result( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -2746,23 +2985,19 @@ def get_command_result( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_command_result.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}"} # type: ignore - + get_command_result.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}"} # type: ignore @distributed_trace def list_outbound_network_dependencies_endpoints( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> Iterable[_models.OutboundEnvironmentEndpointCollection]: + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> Iterable["_models.OutboundEnvironmentEndpoint"]: """Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster. @@ -2770,35 +3005,35 @@ def list_outbound_network_dependencies_endpoints( specified managed cluster. The operation returns properties of each egress endpoint. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OutboundEnvironmentEndpointCollection or the - result of cls(response) + :return: An iterator like instance of either OutboundEnvironmentEndpoint or the result of + cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_04_01.models.OutboundEnvironmentEndpointCollection] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_04_01.models.OutboundEnvironmentEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_outbound_network_dependencies_endpoints_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_outbound_network_dependencies_endpoints.metadata['url'], + template_url=self.list_outbound_network_dependencies_endpoints.metadata["url"], headers=_headers, params=_params, ) @@ -2806,16 +3041,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_outbound_network_dependencies_endpoints_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -2831,10 +3061,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2844,8 +3072,6 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_outbound_network_dependencies_endpoints.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints"} # type: ignore + list_outbound_network_dependencies_endpoints.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/operations/_operations.py index 949783cfe7e0..e8db3243431a 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/operations/_operations.py @@ -7,10 +7,15 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,38 +25,34 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - **kwargs: Any -) -> HttpRequest: + +def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.ContainerService/operations") # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class Operations: """ @@ -72,38 +73,33 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.OperationListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.OperationValue"]: """Gets a list of operations. Gets a list of operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationListResult or the result of cls(response) + :return: An iterator like instance of either OperationValue or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_04_01.models.OperationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_04_01.models.OperationValue] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -111,13 +107,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -133,10 +127,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -146,8 +138,6 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.ContainerService/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ContainerService/operations"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/operations/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/operations/_private_endpoint_connections_operations.py index 1eb92fbe199e..d9f01d941332 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/operations/_private_endpoint_connections_operations.py @@ -6,11 +6,15 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod @@ -21,173 +25,199 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - subscription_id: str, resource_group_name: str, resource_name: str, private_endpoint_connection_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_update_request( - subscription_id: str, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, - *, - json: Optional[_models.PrivateEndpointConnection] = None, - content: Any = None, + subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request_initial( - subscription_id: str, +def build_delete_request( resource_group_name: str, resource_name: str, private_endpoint_connection_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class PrivateEndpointConnectionsOperations: """ @@ -208,13 +238,9 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnectionListResult: """Gets a list of private endpoint connections in the specified managed cluster. @@ -222,32 +248,30 @@ def list( https://docs.microsoft.com/azure/aks/private-clusters. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnectionListResult, or the result of cls(response) + :return: PrivateEndpointConnectionListResult or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.PrivateEndpointConnectionListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnectionListResult] - request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -255,33 +279,27 @@ def list( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore - + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore @distributed_trace def get( - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnection: """Gets the specified private endpoint connection. @@ -289,35 +307,33 @@ def get( https://docs.microsoft.com/azure/aks/private-clusters. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -325,33 +341,33 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - @distributed_trace + @overload def update( self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, parameters: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateEndpointConnection: """Updates a private endpoint connection. @@ -359,41 +375,116 @@ def update( Updates a private endpoint connection. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str - :param parameters: The updated private endpoint connection. + :param parameters: The updated private endpoint connection. Required. :type parameters: ~azure.mgmt.containerservice.v2022_04_01.models.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: The updated private endpoint connection. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @distributed_trace + def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: Union[_models.PrivateEndpointConnection, IO], + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: The updated private endpoint connection. Is either a model type or a IO + type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_04_01.models.PrivateEndpointConnection or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - _json = self._serialize.body(parameters, 'PrivateEndpointConnection') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateEndpointConnection") request = build_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update.metadata['url'], + content=_content, + template_url=self.update.metadata["url"], headers=_headers, params=_params, ) @@ -401,52 +492,43 @@ def update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -454,10 +536,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -467,26 +548,22 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + def begin_delete( + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> LROPoller[None]: """Deletes a private endpoint connection. Deletes a private endpoint connection. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -498,53 +575,46 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/operations/_private_link_resources_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/operations/_private_link_resources_operations.py index 3992b329d04c..df264f6f184c 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/operations/_private_link_resources_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/operations/_private_link_resources_operations.py @@ -8,9 +8,13 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -19,48 +23,55 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class PrivateLinkResourcesOperations: """ @@ -81,13 +92,9 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.PrivateLinkResourcesListResult: """Gets a list of private link resources in the specified managed cluster. @@ -95,32 +102,30 @@ def list( https://docs.microsoft.com/azure/aks/private-clusters. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResourcesListResult, or the result of cls(response) + :return: PrivateLinkResourcesListResult or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.PrivateLinkResourcesListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResourcesListResult] - request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -128,22 +133,20 @@ def list( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResourcesListResult', pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources"} # type: ignore - + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/operations/_resolve_private_link_service_id_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/operations/_resolve_private_link_service_id_operations.py index 57538a964806..19db3aab7a41 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/operations/_resolve_private_link_service_id_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/operations/_resolve_private_link_service_id_operations.py @@ -6,11 +6,15 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -19,56 +23,58 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_post_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.PrivateLinkResource] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + class ResolvePrivateLinkServiceIdOperations: """ @@ -89,13 +95,14 @@ def __init__(self, *args, **kwargs): 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 + @overload def post( self, resource_group_name: str, resource_name: str, parameters: _models.PrivateLinkResource, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateLinkResource: """Gets the private link service ID for the specified managed cluster. @@ -103,38 +110,106 @@ def post( Gets the private link service ID for the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters required in order to resolve a private link service ID. + :param parameters: Parameters required in order to resolve a private link service ID. Required. :type parameters: ~azure.mgmt.containerservice.v2022_04_01.models.PrivateLinkResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResource, or the result of cls(response) + :return: PrivateLinkResource or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.PrivateLinkResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + def post( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID for the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters required in order to resolve a private link service ID. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def post( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.PrivateLinkResource, IO], + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID for the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters required in order to resolve a private link service ID. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_04_01.models.PrivateLinkResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResource] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResource] - _json = self._serialize.body(parameters, 'PrivateLinkResource') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateLinkResource") request = build_post_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.post.metadata['url'], + content=_content, + template_url=self.post.metadata["url"], headers=_headers, params=_params, ) @@ -142,22 +217,20 @@ def post( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResource', pipeline_response) + deserialized = self._deserialize("PrivateLinkResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - post.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId"} # type: ignore - + post.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/operations/_snapshots_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/operations/_snapshots_operations.py index 675ca43b97b5..fe561e3f6634 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/operations/_snapshots_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/operations/_snapshots_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,243 +25,233 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots") path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_resource_group_request( - subscription_id: str, - resource_group_name: str, - **kwargs: Any -) -> HttpRequest: +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: + _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, resource_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.Snapshot] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_update_tags_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.TagsObject] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class SnapshotsOperations: """ @@ -277,39 +272,33 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.SnapshotListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.Snapshot"]: """Gets a list of snapshots in the specified subscription. Gets a list of snapshots in the specified subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SnapshotListResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_04_01.models.SnapshotListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either Snapshot or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_04_01.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SnapshotListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -317,14 +306,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -340,10 +326,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -353,48 +337,41 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots"} # type: ignore @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> Iterable[_models.SnapshotListResult]: + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Snapshot"]: """Lists snapshots in the specified subscription and resource group. Lists snapshots in the specified subscription and resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SnapshotListResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_04_01.models.SnapshotListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either Snapshot or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_04_01.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SnapshotListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -402,15 +379,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -426,10 +399,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -439,50 +410,41 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots"} # type: ignore @distributed_trace - def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.Snapshot: + def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.Snapshot: """Gets a snapshot. Gets a snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Snapshot, or the result of cls(response) + :return: Snapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.Snapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -490,32 +452,32 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - - @distributed_trace + @overload def create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.Snapshot, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.Snapshot: """Creates or updates a snapshot. @@ -523,38 +485,102 @@ def create_or_update( Creates or updates a snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The snapshot to create or update. + :param parameters: The snapshot to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_04_01.models.Snapshot + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Snapshot, or the result of cls(response) + :return: Snapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.Snapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Snapshot: + """Creates or updates a snapshot. + + Creates or updates a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The snapshot to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.Snapshot, IO], **kwargs: Any + ) -> _models.Snapshot: + """Creates or updates a snapshot. + + Creates or updates a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The snapshot to create or update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.mgmt.containerservice.v2022_04_01.models.Snapshot or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] - _json = self._serialize.body(parameters, 'Snapshot') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "Snapshot") request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) @@ -562,10 +588,9 @@ def create_or_update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -573,25 +598,26 @@ def create_or_update( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - - @distributed_trace + @overload def update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.Snapshot: """Updates tags on a snapshot. @@ -599,38 +625,102 @@ def update_tags( Updates tags on a snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update snapshot Tags operation. + :param parameters: Parameters supplied to the Update snapshot Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2022_04_01.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Snapshot, or the result of cls(response) + :return: Snapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.Snapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + def update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Snapshot: + """Updates tags on a snapshot. + + Updates tags on a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update snapshot Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> _models.Snapshot: + """Updates tags on a snapshot. + + Updates tags on a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update snapshot Tags operation. Is either a model + type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_04_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") request = build_update_tags_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_tags.metadata['url'], + content=_content, + template_url=self.update_tags.metadata["url"], headers=_headers, params=_params, ) @@ -638,64 +728,57 @@ def update_tags( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - + update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore @distributed_trace def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: """Deletes a snapshot. Deletes a snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) @@ -703,10 +786,9 @@ def delete( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -716,5 +798,4 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - + delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/__init__.py index 37a5f9e02e6f..a8716d29afe8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/__init__.py @@ -14,7 +14,8 @@ except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['ContainerServiceClient'] + +__all__ = ["ContainerServiceClient"] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/_configuration.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/_configuration.py index 872b574a304e..6769ca91635c 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/_configuration.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/_configuration.py @@ -18,29 +18,25 @@ VERSION = "unknown" + class ContainerServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ContainerServiceClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :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. + :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2022-04-02-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: + def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ContainerServiceClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + api_version = kwargs.pop("api_version", "2022-04-02-preview") # type: str if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -50,23 +46,24 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-containerservice/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-containerservice/{}".format(VERSION)) self._configure(**kwargs) def _configure( - self, - **kwargs # type: Any + self, **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/_container_service_client.py index 4ad4c1107c46..413c2079b59a 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/_container_service_client.py @@ -9,20 +9,32 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from . import models +from .._serialization import Deserializer, Serializer from ._configuration import ContainerServiceClientConfiguration -from .operations import AgentPoolsOperations, MaintenanceConfigurationsOperations, ManagedClusterSnapshotsOperations, ManagedClustersOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, ResolvePrivateLinkServiceIdOperations, SnapshotsOperations, TrustedAccessRoleBindingsOperations, TrustedAccessRolesOperations +from .operations import ( + AgentPoolsOperations, + MaintenanceConfigurationsOperations, + ManagedClusterSnapshotsOperations, + ManagedClustersOperations, + Operations, + PrivateEndpointConnectionsOperations, + PrivateLinkResourcesOperations, + ResolvePrivateLinkServiceIdOperations, + SnapshotsOperations, + TrustedAccessRoleBindingsOperations, + TrustedAccessRolesOperations, +) if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class ContainerServiceClient: # pylint: disable=too-many-instance-attributes + +class ContainerServiceClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """The Container Service Client. :ivar operations: Operations operations @@ -57,9 +69,9 @@ class ContainerServiceClient: # pylint: disable=too-many-instance-attributes :ivar trusted_access_role_bindings: TrustedAccessRoleBindingsOperations operations :vartype trusted_access_role_bindings: azure.mgmt.containerservice.v2022_04_02_preview.operations.TrustedAccessRoleBindingsOperations - :param credential: Credential needed for the client to connect to Azure. + :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. + :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -77,25 +89,23 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = ContainerServiceClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = ContainerServiceClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize - ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.managed_clusters = ManagedClustersOperations( self._client, self._config, self._serialize, self._deserialize ) self.maintenance_configurations = MaintenanceConfigurationsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.agent_pools = AgentPoolsOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) self.private_endpoint_connections = PrivateEndpointConnectionsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -105,9 +115,7 @@ def __init__( self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations( self._client, self._config, self._serialize, self._deserialize ) - self.snapshots = SnapshotsOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.snapshots = SnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) self.managed_cluster_snapshots = ManagedClusterSnapshotsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -118,12 +126,7 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) - - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> HttpResponse: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -132,7 +135,7 @@ def _send_request( >>> response = client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/_metadata.json b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/_metadata.json index bca9c6e69085..9bd0cbe5af38 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/_metadata.json +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/_metadata.json @@ -10,20 +10,20 @@ "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { "credential": { - "signature": "credential, # type: \"TokenCredential\"", - "description": "Credential needed for the client to connect to Azure.", + "signature": "credential: \"TokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true }, "subscription_id": { - "signature": "subscription_id, # type: str", - "description": "The ID of the target subscription.", + "signature": "subscription_id: str,", + "description": "The ID of the target subscription. Required.", "docstring_type": "str", "required": true } @@ -31,13 +31,13 @@ "async": { "credential": { "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure.", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { "signature": "subscription_id: str,", - "description": "The ID of the target subscription.", + "description": "The ID of the target subscription. Required.", "docstring_type": "str", "required": true } @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=\"https://management.azure.com\", # type: str", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/_patch.py index 74e48ecd07cf..f99e77fef986 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/_patch.py @@ -28,4 +28,4 @@ # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + pass diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/_vendor.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/_vendor.py index 138f663c53a4..9aad73fc743e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/_vendor.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/_vendor.py @@ -7,6 +7,7 @@ from azure.core.pipeline.transport import HttpRequest + def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) @@ -14,6 +15,7 @@ def _convert_request(request, files=None): request.set_formdata_body(files) return request + def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -21,7 +23,5 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [ - c for c in formatted_components if "{}".format(key.args[0]) not in c - ] + components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/__init__.py index 37a5f9e02e6f..a8716d29afe8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/__init__.py @@ -14,7 +14,8 @@ except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['ContainerServiceClient'] + +__all__ = ["ContainerServiceClient"] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/_configuration.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/_configuration.py index 9dfb69e9d0c7..8cea37c33508 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/_configuration.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/_configuration.py @@ -18,29 +18,25 @@ VERSION = "unknown" + class ContainerServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ContainerServiceClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :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. + :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2022-04-02-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: + def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ContainerServiceClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + api_version = kwargs.pop("api_version", "2022-04-02-preview") # type: str if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -50,22 +46,21 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-containerservice/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-containerservice/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, - **kwargs: Any - ) -> None: - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/_container_service_client.py index 5430478cae15..5aa832447e13 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/_container_service_client.py @@ -9,20 +9,32 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from .. import models +from ..._serialization import Deserializer, Serializer from ._configuration import ContainerServiceClientConfiguration -from .operations import AgentPoolsOperations, MaintenanceConfigurationsOperations, ManagedClusterSnapshotsOperations, ManagedClustersOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, ResolvePrivateLinkServiceIdOperations, SnapshotsOperations, TrustedAccessRoleBindingsOperations, TrustedAccessRolesOperations +from .operations import ( + AgentPoolsOperations, + MaintenanceConfigurationsOperations, + ManagedClusterSnapshotsOperations, + ManagedClustersOperations, + Operations, + PrivateEndpointConnectionsOperations, + PrivateLinkResourcesOperations, + ResolvePrivateLinkServiceIdOperations, + SnapshotsOperations, + TrustedAccessRoleBindingsOperations, + TrustedAccessRolesOperations, +) if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class ContainerServiceClient: # pylint: disable=too-many-instance-attributes + +class ContainerServiceClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """The Container Service Client. :ivar operations: Operations operations @@ -57,9 +69,9 @@ class ContainerServiceClient: # pylint: disable=too-many-instance-attributes :ivar trusted_access_role_bindings: TrustedAccessRoleBindingsOperations operations :vartype trusted_access_role_bindings: azure.mgmt.containerservice.v2022_04_02_preview.aio.operations.TrustedAccessRoleBindingsOperations - :param credential: Credential needed for the client to connect to Azure. + :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. + :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -77,25 +89,23 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = ContainerServiceClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = ContainerServiceClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize - ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.managed_clusters = ManagedClustersOperations( self._client, self._config, self._serialize, self._deserialize ) self.maintenance_configurations = MaintenanceConfigurationsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.agent_pools = AgentPoolsOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) self.private_endpoint_connections = PrivateEndpointConnectionsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -105,9 +115,7 @@ def __init__( self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations( self._client, self._config, self._serialize, self._deserialize ) - self.snapshots = SnapshotsOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.snapshots = SnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) self.managed_cluster_snapshots = ManagedClusterSnapshotsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -118,12 +126,7 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) - - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -132,7 +135,7 @@ def _send_request( >>> response = await client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/_patch.py index 74e48ecd07cf..f99e77fef986 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/_patch.py @@ -28,4 +28,4 @@ # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + pass diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/__init__.py index fe53dc12e778..6a931af99fa3 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/__init__.py @@ -21,18 +21,19 @@ from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'Operations', - 'ManagedClustersOperations', - 'MaintenanceConfigurationsOperations', - 'AgentPoolsOperations', - 'PrivateEndpointConnectionsOperations', - 'PrivateLinkResourcesOperations', - 'ResolvePrivateLinkServiceIdOperations', - 'SnapshotsOperations', - 'ManagedClusterSnapshotsOperations', - 'TrustedAccessRolesOperations', - 'TrustedAccessRoleBindingsOperations', + "Operations", + "ManagedClustersOperations", + "MaintenanceConfigurationsOperations", + "AgentPoolsOperations", + "PrivateEndpointConnectionsOperations", + "PrivateLinkResourcesOperations", + "ResolvePrivateLinkServiceIdOperations", + "SnapshotsOperations", + "ManagedClusterSnapshotsOperations", + "TrustedAccessRolesOperations", + "TrustedAccessRoleBindingsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/_agent_pools_operations.py index 02533969c46e..806cc5397fc3 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/_agent_pools_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +29,20 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._agent_pools_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_available_agent_pool_versions_request, build_get_request, build_get_upgrade_profile_request, build_list_request, build_upgrade_node_image_version_request_initial -T = TypeVar('T') +from ...operations._agent_pools_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_available_agent_pool_versions_request, + build_get_request, + build_get_upgrade_profile_request, + build_list_request, + build_upgrade_node_image_version_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class AgentPoolsOperations: """ .. warning:: @@ -45,47 +62,41 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.AgentPoolListResult]: + def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncIterable["_models.AgentPool"]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AgentPoolListResult or the result of cls(response) + :return: An iterator like instance of either AgentPool or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_04_02_preview.models.AgentPoolListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_04_02_preview.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -93,16 +104,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -118,10 +124,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -131,54 +135,46 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore @distributed_trace_async async def get( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPool: """Gets the specified managed cluster agent pool. Gets the specified managed cluster agent pool. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPool, or the result of cls(response) + :return: AgentPool or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.AgentPool - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -186,57 +182,60 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore async def _create_or_update_initial( self, resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: _models.AgentPool, + parameters: Union[_models.AgentPool, IO], **kwargs: Any ) -> _models.AgentPool: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - _json = self._serialize.body(parameters, 'AgentPool') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "AgentPool") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -244,10 +243,9 @@ async def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -255,26 +253,27 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - - @distributed_trace_async + @overload async def begin_create_or_update( self, resource_group_name: str, resource_name: str, agent_pool_name: str, parameters: _models.AgentPool, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.AgentPool]: """Creates or updates an agent pool in the specified managed cluster. @@ -282,13 +281,59 @@ async def begin_create_or_update( Creates or updates an agent pool in the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str - :param parameters: The agent pool to create or update. + :param parameters: The agent pool to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_04_02_preview.models.AgentPool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AgentPool or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_04_02_preview.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AgentPool]: + """Creates or updates an agent pool in the specified managed cluster. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: The agent pool to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -301,20 +346,58 @@ async def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_04_02_preview.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: Union[_models.AgentPool, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.AgentPool]: + """Creates or updates an agent pool in the specified managed cluster. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: The agent pool to create or update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.mgmt.containerservice.v2022_04_02_preview.models.AgentPool or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AgentPool or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_04_02_preview.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -323,39 +406,35 @@ async def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements self, @@ -365,26 +444,23 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements ignore_pod_disruption_budget: Optional[bool] = None, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, - api_version=api_version, + subscription_id=self._config.subscription_id, ignore_pod_disruption_budget=ignore_pod_disruption_budget, - template_url=self._delete_initial.metadata['url'], + api_version=api_version, + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -392,10 +468,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -405,11 +480,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements + async def begin_delete( self, resource_group_name: str, resource_name: str, @@ -422,10 +496,11 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Deletes an agent pool in the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :param ignore_pod_disruption_budget: ignore-pod-disruption-budget=true to delete those pods on a node without considering Pod Disruption Budget. Default value is None. @@ -440,19 +515,16 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -460,80 +532,70 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements agent_pool_name=agent_pool_name, ignore_pod_disruption_budget=ignore_pod_disruption_budget, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace_async async def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPoolUpgradeProfile: """Gets the upgrade profile for an agent pool. Gets the upgrade profile for an agent pool. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolUpgradeProfile, or the result of cls(response) + :return: AgentPoolUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.AgentPoolUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -541,32 +603,27 @@ async def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolUpgradeProfile', pipeline_response) + deserialized = self._deserialize("AgentPoolUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore @distributed_trace_async async def get_available_agent_pool_versions( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported Kubernetes versions for the specified agent pool. @@ -575,32 +632,30 @@ async def get_available_agent_pool_versions( the version lifecycle. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolAvailableVersions, or the result of cls(response) + :return: AgentPoolAvailableVersions or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.AgentPoolAvailableVersions - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolAvailableVersions] - request = build_get_available_agent_pool_versions_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_available_agent_pool_versions.metadata['url'], + template_url=self.get_available_agent_pool_versions.metadata["url"], headers=_headers, params=_params, ) @@ -608,52 +663,43 @@ async def get_available_agent_pool_versions( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolAvailableVersions', pipeline_response) + deserialized = self._deserialize("AgentPoolAvailableVersions", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_available_agent_pool_versions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore - + get_available_agent_pool_versions.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore async def _upgrade_node_image_version_initial( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> Optional[_models.AgentPool]: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.AgentPool]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.AgentPool]] - - request = build_upgrade_node_image_version_request_initial( - subscription_id=self._config.subscription_id, + request = build_upgrade_node_image_version_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._upgrade_node_image_version_initial.metadata['url'], + template_url=self._upgrade_node_image_version_initial.metadata["url"], headers=_headers, params=_params, ) @@ -661,10 +707,9 @@ async def _upgrade_node_image_version_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -674,26 +719,23 @@ async def _upgrade_node_image_version_initial( deserialized = None response_headers = {} if response.status_code == 202: - response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) - - deserialized = self._deserialize('AgentPool', pipeline_response) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _upgrade_node_image_version_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore - + _upgrade_node_image_version_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore @distributed_trace_async async def begin_upgrade_node_image_version( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any - ) -> AsyncLROPoller[_models.AgentPool]: + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: """Upgrades the node image version of an agent pool to the latest. Upgrading the node image version of an agent pool applies the newest OS and runtime updates to @@ -701,10 +743,11 @@ async def begin_upgrade_node_image_version( node image versions, see: https://docs.microsoft.com/azure/aks/node-image-upgrade. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -718,59 +761,54 @@ async def begin_upgrade_node_image_version( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_04_02_preview.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._upgrade_node_image_version_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) - - deserialized = self._deserialize('AgentPool', pipeline_response) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_upgrade_node_image_version.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore + begin_upgrade_node_image_version.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/_maintenance_configurations_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/_maintenance_configurations_operations.py index 310e5a77185f..8601c6f92dd0 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/_maintenance_configurations_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/_maintenance_configurations_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,10 +27,17 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._maintenance_configurations_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_managed_cluster_request -T = TypeVar('T') +from ...operations._maintenance_configurations_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_managed_cluster_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class MaintenanceConfigurationsOperations: """ .. warning:: @@ -43,48 +57,44 @@ def __init__(self, *args, **kwargs) -> None: 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_managed_cluster( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.MaintenanceConfigurationListResult]: + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> AsyncIterable["_models.MaintenanceConfiguration"]: """Gets a list of maintenance configurations in the specified managed cluster. Gets a list of maintenance configurations in the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either MaintenanceConfigurationListResult or the result - of cls(response) + :return: An iterator like instance of either MaintenanceConfiguration or the result of + cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_04_02_preview.models.MaintenanceConfigurationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_04_02_preview.models.MaintenanceConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfigurationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfigurationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_managed_cluster_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_managed_cluster.metadata['url'], + template_url=self.list_by_managed_cluster.metadata["url"], headers=_headers, params=_params, ) @@ -92,16 +102,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_managed_cluster_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -117,10 +122,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -130,54 +133,46 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_managed_cluster.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations"} # type: ignore + list_by_managed_cluster.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations"} # type: ignore @distributed_trace_async async def get( - self, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, config_name: str, **kwargs: Any ) -> _models.MaintenanceConfiguration: """Gets the specified maintenance configuration of a managed cluster. Gets the specified maintenance configuration of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: MaintenanceConfiguration, or the result of cls(response) + :return: MaintenanceConfiguration or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.MaintenanceConfiguration - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfiguration] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -185,33 +180,33 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) + deserialized = self._deserialize("MaintenanceConfiguration", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - @distributed_trace_async + @overload async def create_or_update( self, resource_group_name: str, resource_name: str, config_name: str, parameters: _models.MaintenanceConfiguration, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.MaintenanceConfiguration: """Creates or updates a maintenance configuration in the specified managed cluster. @@ -219,42 +214,117 @@ async def create_or_update( Creates or updates a maintenance configuration in the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str - :param parameters: The maintenance configuration to create or update. + :param parameters: The maintenance configuration to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_04_02_preview.models.MaintenanceConfiguration + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configuration in the specified managed cluster. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: The maintenance configuration to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: MaintenanceConfiguration, or the result of cls(response) + :return: MaintenanceConfiguration or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.MaintenanceConfiguration - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: Union[_models.MaintenanceConfiguration, IO], + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configuration in the specified managed cluster. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: The maintenance configuration to create or update. Is either a model type or + a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2022_04_02_preview.models.MaintenanceConfiguration or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfiguration] - _json = self._serialize.body(parameters, 'MaintenanceConfiguration') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "MaintenanceConfiguration") request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) @@ -262,68 +332,60 @@ async def create_or_update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) + deserialized = self._deserialize("MaintenanceConfiguration", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, config_name: str, **kwargs: Any ) -> None: """Deletes a maintenance configuration. Deletes a maintenance configuration. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) @@ -331,10 +393,9 @@ async def delete( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -344,5 +405,4 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/_managed_cluster_snapshots_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/_managed_cluster_snapshots_operations.py index 8b4c68e3dac5..a0ae99329c57 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/_managed_cluster_snapshots_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/_managed_cluster_snapshots_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,10 +27,19 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._managed_cluster_snapshots_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_resource_group_request, build_list_request, build_update_tags_request -T = TypeVar('T') +from ...operations._managed_cluster_snapshots_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_resource_group_request, + build_list_request, + build_update_tags_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class ManagedClusterSnapshotsOperations: """ .. warning:: @@ -43,40 +59,35 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.ManagedClusterSnapshotListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.ManagedClusterSnapshot"]: """Gets a list of managed cluster snapshots in the specified subscription. Gets a list of managed cluster snapshots in the specified subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterSnapshotListResult or the result of + :return: An iterator like instance of either ManagedClusterSnapshot or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedClusterSnapshotListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedClusterSnapshot] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshotListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterSnapshotListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -84,14 +95,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -107,10 +115,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -120,49 +126,45 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedclustersnapshots"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedclustersnapshots"} # type: ignore @distributed_trace def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.ManagedClusterSnapshotListResult]: + self, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ManagedClusterSnapshot"]: """Lists managed cluster snapshots in the specified subscription and resource group. Lists managed cluster snapshots in the specified subscription and resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterSnapshotListResult or the result of + :return: An iterator like instance of either ManagedClusterSnapshot or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedClusterSnapshotListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedClusterSnapshot] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshotListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterSnapshotListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -170,15 +172,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -194,10 +192,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -207,50 +203,41 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots"} # type: ignore @distributed_trace_async - async def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.ManagedClusterSnapshot: + async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.ManagedClusterSnapshot: """Gets a managed cluster snapshot. Gets a managed cluster snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterSnapshot, or the result of cls(response) + :return: ManagedClusterSnapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedClusterSnapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterSnapshot] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -258,32 +245,32 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterSnapshot', pipeline_response) + deserialized = self._deserialize("ManagedClusterSnapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"} # type: ignore - @distributed_trace_async + @overload async def create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterSnapshot, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.ManagedClusterSnapshot: """Creates or updates a managed cluster snapshot. @@ -291,39 +278,108 @@ async def create_or_update( Creates or updates a managed cluster snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The managed cluster snapshot to create or update. + :param parameters: The managed cluster snapshot to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedClusterSnapshot + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedClusterSnapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedClusterSnapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ManagedClusterSnapshot: + """Creates or updates a managed cluster snapshot. + + Creates or updates a managed cluster snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster snapshot to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedClusterSnapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedClusterSnapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterSnapshot, IO], + **kwargs: Any + ) -> _models.ManagedClusterSnapshot: + """Creates or updates a managed cluster snapshot. + + Creates or updates a managed cluster snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster snapshot to create or update. Is either a model type or + a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedClusterSnapshot or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterSnapshot, or the result of cls(response) + :return: ManagedClusterSnapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedClusterSnapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterSnapshot] - _json = self._serialize.body(parameters, 'ManagedClusterSnapshot') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterSnapshot") request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) @@ -331,10 +387,9 @@ async def create_or_update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -342,25 +397,26 @@ async def create_or_update( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ManagedClusterSnapshot', pipeline_response) + deserialized = self._deserialize("ManagedClusterSnapshot", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('ManagedClusterSnapshot', pipeline_response) + deserialized = self._deserialize("ManagedClusterSnapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"} # type: ignore - + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"} # type: ignore - @distributed_trace_async + @overload async def update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.ManagedClusterSnapshot: """Updates tags on a managed cluster snapshot. @@ -368,38 +424,104 @@ async def update_tags( Updates tags on a managed cluster snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Update managed cluster snapshot Tags operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2022_04_02_preview.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedClusterSnapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedClusterSnapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ManagedClusterSnapshot: + """Updates tags on a managed cluster snapshot. + + Updates tags on a managed cluster snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update managed cluster snapshot Tags operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterSnapshot, or the result of cls(response) + :return: ManagedClusterSnapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedClusterSnapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @distributed_trace_async + async def update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> _models.ManagedClusterSnapshot: + """Updates tags on a managed cluster snapshot. + + Updates tags on a managed cluster snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update managed cluster snapshot Tags operation. + Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_04_02_preview.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedClusterSnapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedClusterSnapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterSnapshot] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") request = build_update_tags_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_tags.metadata['url'], + content=_content, + template_url=self.update_tags.metadata["url"], headers=_headers, params=_params, ) @@ -407,64 +529,57 @@ async def update_tags( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterSnapshot', pipeline_response) + deserialized = self._deserialize("ManagedClusterSnapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"} # type: ignore - + update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"} # type: ignore @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: """Deletes a managed cluster snapshot. Deletes a managed cluster snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) @@ -472,10 +587,9 @@ async def delete( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -485,5 +599,4 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"} # type: ignore - + delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/_managed_clusters_operations.py index 3e1362db70c3..c9a67997ce54 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/_managed_clusters_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +29,34 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._managed_clusters_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_access_profile_request, build_get_command_result_request, build_get_os_options_request, build_get_request, build_get_upgrade_profile_request, build_list_by_resource_group_request, build_list_cluster_admin_credentials_request, build_list_cluster_monitoring_user_credentials_request, build_list_cluster_user_credentials_request, build_list_outbound_network_dependencies_endpoints_request, build_list_request, build_reset_aad_profile_request_initial, build_reset_service_principal_profile_request_initial, build_rotate_cluster_certificates_request_initial, build_rotate_service_account_signing_keys_request_initial, build_run_command_request_initial, build_start_request_initial, build_stop_request_initial, build_update_tags_request_initial -T = TypeVar('T') +from ...operations._managed_clusters_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_access_profile_request, + build_get_command_result_request, + build_get_os_options_request, + build_get_request, + build_get_upgrade_profile_request, + build_list_by_resource_group_request, + build_list_cluster_admin_credentials_request, + build_list_cluster_monitoring_user_credentials_request, + build_list_cluster_user_credentials_request, + build_list_outbound_network_dependencies_endpoints_request, + build_list_request, + build_reset_aad_profile_request, + build_reset_service_principal_profile_request, + build_rotate_cluster_certificates_request, + build_rotate_service_account_signing_keys_request, + build_run_command_request, + build_start_request, + build_stop_request, + build_update_tags_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class ManagedClustersOperations: # pylint: disable=too-many-public-methods """ .. warning:: @@ -45,46 +76,39 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async async def get_os_options( - self, - location: str, - resource_type: Optional[str] = None, - **kwargs: Any + self, location: str, resource_type: Optional[str] = None, **kwargs: Any ) -> _models.OSOptionProfile: """Gets supported OS options in the specified subscription. Gets supported OS options in the specified subscription. - :param location: The name of Azure region. + :param location: The name of Azure region. Required. :type location: str :param resource_type: The resource type for which the OS options needs to be returned. Default value is None. :type resource_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: OSOptionProfile, or the result of cls(response) + :return: OSOptionProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.OSOptionProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OSOptionProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OSOptionProfile] - request = build_get_os_options_request( - subscription_id=self._config.subscription_id, location=location, - api_version=api_version, + subscription_id=self._config.subscription_id, resource_type=resource_type, - template_url=self.get_os_options.metadata['url'], + api_version=api_version, + template_url=self.get_os_options.metadata["url"], headers=_headers, params=_params, ) @@ -92,59 +116,52 @@ async def get_os_options( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('OSOptionProfile', pipeline_response) + deserialized = self._deserialize("OSOptionProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_os_options.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default"} # type: ignore - + get_os_options.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default"} # type: ignore @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.ManagedClusterListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.ManagedCluster"]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -152,14 +169,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -175,10 +189,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -188,49 +200,44 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.ManagedClusterListResult]: + self, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ManagedCluster"]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -238,15 +245,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -262,10 +265,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -275,50 +276,43 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace_async async def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.ManagedClusterUpgradeProfile: """Gets the upgrade profile of a managed cluster. Gets the upgrade profile of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterUpgradeProfile, or the result of cls(response) + :return: ManagedClusterUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedClusterUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -326,33 +320,27 @@ async def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterUpgradeProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore @distributed_trace_async async def get_access_profile( - self, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, role_name: str, **kwargs: Any ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. @@ -362,35 +350,33 @@ async def get_access_profile( `_ . :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param role_name: The name of the role for managed cluster accessProfile resource. + :param role_name: The name of the role for managed cluster accessProfile resource. Required. :type role_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterAccessProfile, or the result of cls(response) + :return: ManagedClusterAccessProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedClusterAccessProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterAccessProfile] - request = build_get_access_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, role_name=role_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_access_profile.metadata['url'], + template_url=self.get_access_profile.metadata["url"], headers=_headers, params=_params, ) @@ -398,68 +384,60 @@ async def get_access_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterAccessProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterAccessProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_access_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore - + get_access_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore @distributed_trace_async async def list_cluster_admin_credentials( - self, - resource_group_name: str, - resource_name: str, - server_fqdn: Optional[str] = None, - **kwargs: Any + self, resource_group_name: str, resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any ) -> _models.CredentialResults: """Lists the admin credentials of a managed cluster. Lists the admin credentials of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_admin_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, - template_url=self.list_cluster_admin_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_admin_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -467,25 +445,23 @@ async def list_cluster_admin_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_admin_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore - + list_cluster_admin_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore @distributed_trace_async async def list_cluster_user_credentials( @@ -501,40 +477,39 @@ async def list_cluster_user_credentials( Lists the user credentials of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :param format: Only apply to AAD clusters, specifies the format of returned kubeconfig. Format 'azure' will return azure auth-provider kubeconfig; format 'exec' will return exec format - kubeconfig, which requires kubelogin binary in the path. Default value is None. + kubeconfig, which requires kubelogin binary in the path. Known values are: "azure" and "exec". + Default value is None. :type format: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.Format :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, format=format, - template_url=self.list_cluster_user_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -542,68 +517,60 @@ async def list_cluster_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore - + list_cluster_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore @distributed_trace_async async def list_cluster_monitoring_user_credentials( - self, - resource_group_name: str, - resource_name: str, - server_fqdn: Optional[str] = None, - **kwargs: Any + self, resource_group_name: str, resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any ) -> _models.CredentialResults: """Lists the cluster monitoring user credentials of a managed cluster. Lists the cluster monitoring user credentials of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_monitoring_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, - template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_monitoring_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -611,64 +578,55 @@ async def list_cluster_monitoring_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_monitoring_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore - + list_cluster_monitoring_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore @distributed_trace_async - async def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.ManagedCluster: + async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.ManagedCluster: """Gets a managed cluster. Gets a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedCluster, or the result of cls(response) + :return: ManagedCluster or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedCluster - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -676,55 +634,54 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _create_or_update_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.ManagedCluster, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'ManagedCluster') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedCluster") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -732,10 +689,9 @@ async def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -743,25 +699,26 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - @distributed_trace_async + @overload async def begin_create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedCluster, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. @@ -769,11 +726,88 @@ async def begin_create_or_update( Creates or updates a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The managed cluster to create or update. + :param parameters: The managed cluster to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedCluster + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster to create or update. Is either a model type or a IO + type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedCluster or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -786,20 +820,17 @@ async def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -807,69 +838,66 @@ async def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _update_tags_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.TagsObject, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request_initial( - subscription_id=self._config.subscription_id, + request = build_update_tags_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_tags_initial.metadata['url'], + content=_content, + template_url=self._update_tags_initial.metadata["url"], headers=_headers, params=_params, ) @@ -877,32 +905,32 @@ async def _update_tags_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_tags_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _update_tags_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - @distributed_trace_async + @overload async def begin_update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. @@ -910,11 +938,88 @@ async def begin_update_tags( Updates tags on a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2022_04_02_preview.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates tags on a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates tags on a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_04_02_preview.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -927,20 +1032,17 @@ async def begin_update_tags( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, @@ -948,39 +1050,35 @@ async def begin_update_tags( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements self, @@ -989,25 +1087,22 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements ignore_pod_disruption_budget: Optional[bool] = None, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, ignore_pod_disruption_budget=ignore_pod_disruption_budget, - template_url=self._delete_initial.metadata['url'], + api_version=api_version, + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1015,10 +1110,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1028,11 +1122,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements + async def begin_delete( self, resource_group_name: str, resource_name: str, @@ -1044,8 +1137,9 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Deletes a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param ignore_pod_disruption_budget: ignore-pod-disruption-budget=true to delete those pods on a node without considering Pod Disruption Budget. Default value is None. @@ -1060,86 +1154,84 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, ignore_pod_disruption_budget=ignore_pod_disruption_budget, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterServicePrincipalProfile, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterServicePrincipalProfile") - request = build_reset_service_principal_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_service_principal_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_service_principal_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_service_principal_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1147,10 +1239,9 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1160,15 +1251,89 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist if cls: return cls(pipeline_response, None, {}) - _reset_service_principal_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + _reset_service_principal_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + + @overload + async def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.ManagedClusterServicePrincipalProfile, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset the Service Principal Profile of a managed cluster. + + This action cannot be performed on a cluster that is not using a service principal. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The service principal profile to set on the managed cluster. Required. + :type parameters: + ~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedClusterServicePrincipalProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset the Service Principal Profile of a managed cluster. + + This action cannot be performed on a cluster that is not using a service principal. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The service principal profile to set on the managed cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async - async def begin_reset_service_principal_profile( # pylint: disable=inconsistent-return-statements + async def begin_reset_service_principal_profile( self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterServicePrincipalProfile, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], **kwargs: Any ) -> AsyncLROPoller[None]: """Reset the Service Principal Profile of a managed cluster. @@ -1176,12 +1341,18 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent This action cannot be performed on a cluster that is not using a service principal. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The service principal profile to set on the managed cluster. + :param parameters: The service principal profile to set on the managed cluster. Is either a + model type or a IO type. Required. :type parameters: ~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedClusterServicePrincipalProfile + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -1192,20 +1363,17 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1213,67 +1381,68 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_service_principal_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + begin_reset_service_principal_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterAADProfile, + parameters: Union[_models.ManagedClusterAADProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterAADProfile") - request = build_reset_aad_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_aad_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_aad_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_aad_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1281,10 +1450,9 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1294,15 +1462,16 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta if cls: return cls(pipeline_response, None, {}) - _reset_aad_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + _reset_aad_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - - @distributed_trace_async - async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements + @overload + async def begin_reset_aad_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterAADProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: """Reset the AAD Profile of a managed cluster. @@ -1310,12 +1479,53 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem Reset the AAD Profile of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The AAD profile to set on the Managed Cluster. + :param parameters: The AAD profile to set on the Managed Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedClusterAADProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset the AAD Profile of a managed cluster. + + Reset the AAD Profile of a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The AAD profile to set on the Managed Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -1326,20 +1536,54 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterAADProfile, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset the AAD Profile of a managed cluster. + + Reset the AAD Profile of a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The AAD profile to set on the Managed Cluster. Is either a model type or a + IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedClusterAADProfile or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1347,62 +1591,52 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_aad_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + begin_reset_aad_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_rotate_cluster_certificates_request_initial( - subscription_id=self._config.subscription_id, + request = build_rotate_cluster_certificates_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._rotate_cluster_certificates_initial.metadata['url'], + template_url=self._rotate_cluster_certificates_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1410,10 +1644,9 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1423,15 +1656,11 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- if cls: return cls(pipeline_response, None, {}) - _rotate_cluster_certificates_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore - + _rotate_cluster_certificates_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore @distributed_trace_async - async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + async def begin_rotate_cluster_certificates( + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Rotates the certificates of a managed cluster. @@ -1439,8 +1668,9 @@ async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-ret more details about rotating managed cluster certificates. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1452,80 +1682,67 @@ async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-ret Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._rotate_cluster_certificates_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_rotate_cluster_certificates.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore + begin_rotate_cluster_certificates.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore async def _rotate_service_account_signing_keys_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_rotate_service_account_signing_keys_request_initial( - subscription_id=self._config.subscription_id, + request = build_rotate_service_account_signing_keys_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._rotate_service_account_signing_keys_initial.metadata['url'], + template_url=self._rotate_service_account_signing_keys_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1533,10 +1750,9 @@ async def _rotate_service_account_signing_keys_initial( # pylint: disable=incon request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1546,23 +1762,20 @@ async def _rotate_service_account_signing_keys_initial( # pylint: disable=incon if cls: return cls(pipeline_response, None, {}) - _rotate_service_account_signing_keys_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateServiceAccountSigningKeys"} # type: ignore - + _rotate_service_account_signing_keys_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateServiceAccountSigningKeys"} # type: ignore @distributed_trace_async - async def begin_rotate_service_account_signing_keys( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + async def begin_rotate_service_account_signing_keys( + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Rotates the service account signing keys of a managed cluster. Rotates the service account signing keys of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1574,80 +1787,67 @@ async def begin_rotate_service_account_signing_keys( # pylint: disable=inconsis Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._rotate_service_account_signing_keys_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_rotate_service_account_signing_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateServiceAccountSigningKeys"} # type: ignore + begin_rotate_service_account_signing_keys.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateServiceAccountSigningKeys"} # type: ignore async def _stop_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_stop_request_initial( - subscription_id=self._config.subscription_id, + request = build_stop_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._stop_initial.metadata['url'], + template_url=self._stop_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1655,10 +1855,9 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1668,16 +1867,10 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore - + _stop_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore @distributed_trace_async - async def begin_stop( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: + async def begin_stop(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Stops a Managed Cluster. This can only be performed on Azure Virtual Machine Scale set backed clusters. Stopping a @@ -1687,8 +1880,9 @@ async def begin_stop( # pylint: disable=inconsistent-return-statements cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1700,80 +1894,67 @@ async def begin_stop( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._stop_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore + begin_stop.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore async def _start_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_start_request_initial( - subscription_id=self._config.subscription_id, + request = build_start_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._start_initial.metadata['url'], + template_url=self._start_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1781,10 +1962,9 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1794,24 +1974,19 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore - + _start_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore @distributed_trace_async - async def begin_start( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: + async def begin_start(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Starts a previously stopped Managed Cluster. See `starting a cluster `_ for more details about starting a cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1823,85 +1998,83 @@ async def begin_start( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._start_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore + begin_start.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore async def _run_command_initial( self, resource_group_name: str, resource_name: str, - request_payload: _models.RunCommandRequest, + request_payload: Union[_models.RunCommandRequest, IO], **kwargs: Any ) -> Optional[_models.RunCommandResult]: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RunCommandResult]] - _json = self._serialize.body(request_payload, 'RunCommandRequest') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(request_payload, (IO, bytes)): + _content = request_payload + else: + _json = self._serialize.body(request_payload, "RunCommandRequest") - request = build_run_command_request_initial( - subscription_id=self._config.subscription_id, + request = build_run_command_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._run_command_initial.metadata['url'], + content=_content, + template_url=self._run_command_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1909,10 +2082,9 @@ async def _run_command_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1921,22 +2093,23 @@ async def _run_command_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _run_command_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore + _run_command_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore - - @distributed_trace_async + @overload async def begin_run_command( self, resource_group_name: str, resource_name: str, request_payload: _models.RunCommandRequest, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.RunCommandResult]: """Submits a command to run against the Managed Cluster. @@ -1946,12 +2119,97 @@ async def begin_run_command( `_. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param request_payload: The run command request. + :param request_payload: The run command request. Required. :type request_payload: ~azure.mgmt.containerservice.v2022_04_02_preview.models.RunCommandRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RunCommandResult or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_04_02_preview.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_run_command( + self, + resource_group_name: str, + resource_name: str, + request_payload: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.RunCommandResult]: + """Submits a command to run against the Managed Cluster. + + AKS will create a pod to run the command. This is primarily useful for private clusters. For + more information see `AKS Run Command + `_. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param request_payload: The run command request. Required. + :type request_payload: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RunCommandResult or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_04_02_preview.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_run_command( + self, + resource_group_name: str, + resource_name: str, + request_payload: Union[_models.RunCommandRequest, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.RunCommandResult]: + """Submits a command to run against the Managed Cluster. + + AKS will create a pod to run the command. This is primarily useful for private clusters. For + more information see `AKS Run Command + `_. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param request_payload: The run command request. Is either a model type or a IO type. Required. + :type request_payload: + ~azure.mgmt.containerservice.v2022_04_02_preview.models.RunCommandRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -1964,20 +2222,17 @@ async def begin_run_command( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_04_02_preview.models.RunCommandResult] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.RunCommandResult] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.RunCommandResult] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._run_command_initial( # type: ignore resource_group_name=resource_group_name, @@ -1985,82 +2240,72 @@ async def begin_run_command( request_payload=request_payload, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_run_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore + begin_run_command.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore @distributed_trace_async async def get_command_result( - self, - resource_group_name: str, - resource_name: str, - command_id: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, command_id: str, **kwargs: Any ) -> Optional[_models.RunCommandResult]: """Gets the results of a command which has been run on the Managed Cluster. Gets the results of a command which has been run on the Managed Cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param command_id: Id of the command. + :param command_id: Id of the command. Required. :type command_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: RunCommandResult, or the result of cls(response) + :return: RunCommandResult or None or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.RunCommandResult or None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RunCommandResult]] - request = build_get_command_result_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, command_id=command_id, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_command_result.metadata['url'], + template_url=self.get_command_result.metadata["url"], headers=_headers, params=_params, ) @@ -2068,10 +2313,9 @@ async def get_command_result( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -2080,23 +2324,19 @@ async def get_command_result( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_command_result.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}"} # type: ignore - + get_command_result.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}"} # type: ignore @distributed_trace def list_outbound_network_dependencies_endpoints( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.OutboundEnvironmentEndpointCollection]: + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> AsyncIterable["_models.OutboundEnvironmentEndpoint"]: """Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster. @@ -2104,35 +2344,35 @@ def list_outbound_network_dependencies_endpoints( specified managed cluster. The operation returns properties of each egress endpoint. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OutboundEnvironmentEndpointCollection or the - result of cls(response) + :return: An iterator like instance of either OutboundEnvironmentEndpoint or the result of + cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_04_02_preview.models.OutboundEnvironmentEndpointCollection] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_04_02_preview.models.OutboundEnvironmentEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_outbound_network_dependencies_endpoints_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_outbound_network_dependencies_endpoints.metadata['url'], + template_url=self.list_outbound_network_dependencies_endpoints.metadata["url"], headers=_headers, params=_params, ) @@ -2140,16 +2380,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_outbound_network_dependencies_endpoints_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -2165,10 +2400,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2178,8 +2411,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_outbound_network_dependencies_endpoints.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints"} # type: ignore + list_outbound_network_dependencies_endpoints.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/_operations.py index 634c0c65a1dc..3a37f9f92945 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/_operations.py @@ -7,9 +7,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,9 +27,11 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._operations import build_list_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class Operations: """ .. warning:: @@ -42,38 +51,33 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.OperationListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.OperationValue"]: """Gets a list of operations. Gets a list of operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationListResult or the result of cls(response) + :return: An iterator like instance of either OperationValue or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_04_02_preview.models.OperationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_04_02_preview.models.OperationValue] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -81,13 +85,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -103,10 +105,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -116,8 +116,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.ContainerService/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ContainerService/operations"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/_private_endpoint_connections_operations.py index 137b7ad735ce..aa8bcc2dfbff 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/_private_endpoint_connections_operations.py @@ -6,9 +6,15 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -20,10 +26,17 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._private_endpoint_connections_operations import build_delete_request_initial, build_get_request, build_list_request, build_update_request -T = TypeVar('T') +from ...operations._private_endpoint_connections_operations import ( + build_delete_request, + build_get_request, + build_list_request, + build_update_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class PrivateEndpointConnectionsOperations: """ .. warning:: @@ -43,13 +56,9 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async async def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnectionListResult: """Gets a list of private endpoint connections in the specified managed cluster. @@ -57,33 +66,31 @@ async def list( https://docs.microsoft.com/azure/aks/private-clusters. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnectionListResult, or the result of cls(response) + :return: PrivateEndpointConnectionListResult or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.PrivateEndpointConnectionListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnectionListResult] - request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -91,33 +98,27 @@ async def list( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore - + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore @distributed_trace_async async def get( - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnection: """Gets the specified private endpoint connection. @@ -125,35 +126,33 @@ async def get( https://docs.microsoft.com/azure/aks/private-clusters. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -161,33 +160,33 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - - @distributed_trace_async + @overload async def update( self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, parameters: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateEndpointConnection: """Updates a private endpoint connection. @@ -195,42 +194,117 @@ async def update( Updates a private endpoint connection. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str - :param parameters: The updated private endpoint connection. + :param parameters: The updated private endpoint connection. Required. :type parameters: ~azure.mgmt.containerservice.v2022_04_02_preview.models.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: The updated private endpoint connection. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: Union[_models.PrivateEndpointConnection, IO], + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: The updated private endpoint connection. Is either a model type or a IO + type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2022_04_02_preview.models.PrivateEndpointConnection or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - _json = self._serialize.body(parameters, 'PrivateEndpointConnection') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateEndpointConnection") request = build_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update.metadata['url'], + content=_content, + template_url=self.update.metadata["url"], headers=_headers, params=_params, ) @@ -238,52 +312,43 @@ async def update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -291,10 +356,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -304,26 +368,22 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + async def begin_delete( + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes a private endpoint connection. Deletes a private endpoint connection. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -335,53 +395,46 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/_private_link_resources_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/_private_link_resources_operations.py index 848df481de07..e3203e84ecfc 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/_private_link_resources_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/_private_link_resources_operations.py @@ -8,7 +8,13 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -19,9 +25,11 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._private_link_resources_operations import build_list_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class PrivateLinkResourcesOperations: """ .. warning:: @@ -41,13 +49,9 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async async def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.PrivateLinkResourcesListResult: """Gets a list of private link resources in the specified managed cluster. @@ -55,32 +59,30 @@ async def list( https://docs.microsoft.com/azure/aks/private-clusters. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResourcesListResult, or the result of cls(response) + :return: PrivateLinkResourcesListResult or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.PrivateLinkResourcesListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResourcesListResult] - request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -88,22 +90,20 @@ async def list( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResourcesListResult', pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources"} # type: ignore - + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/_resolve_private_link_service_id_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/_resolve_private_link_service_id_operations.py index 64b1f8767252..fc99088b85ba 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/_resolve_private_link_service_id_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/_resolve_private_link_service_id_operations.py @@ -6,9 +6,15 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -19,9 +25,11 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._resolve_private_link_service_id_operations import build_post_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class ResolvePrivateLinkServiceIdOperations: """ .. warning:: @@ -41,13 +49,72 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @overload + async def post( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.PrivateLinkResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID for the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters required in order to resolve a private link service ID. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_04_02_preview.models.PrivateLinkResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def post( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID for the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters required in order to resolve a private link service ID. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def post( self, resource_group_name: str, resource_name: str, - parameters: _models.PrivateLinkResource, + parameters: Union[_models.PrivateLinkResource, IO], **kwargs: Any ) -> _models.PrivateLinkResource: """Gets the private link service ID for the specified managed cluster. @@ -55,38 +122,49 @@ async def post( Gets the private link service ID for the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters required in order to resolve a private link service ID. + :param parameters: Parameters required in order to resolve a private link service ID. Is either + a model type or a IO type. Required. :type parameters: ~azure.mgmt.containerservice.v2022_04_02_preview.models.PrivateLinkResource + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResource, or the result of cls(response) + :return: PrivateLinkResource or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.PrivateLinkResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResource] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResource] - _json = self._serialize.body(parameters, 'PrivateLinkResource') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateLinkResource") request = build_post_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.post.metadata['url'], + content=_content, + template_url=self.post.metadata["url"], headers=_headers, params=_params, ) @@ -94,22 +172,20 @@ async def post( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResource', pipeline_response) + deserialized = self._deserialize("PrivateLinkResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - post.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId"} # type: ignore - + post.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/_snapshots_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/_snapshots_operations.py index dcf9f55bc0ca..ef3dc75f487e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/_snapshots_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/_snapshots_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,10 +27,19 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._snapshots_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_resource_group_request, build_list_request, build_update_tags_request -T = TypeVar('T') +from ...operations._snapshots_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_resource_group_request, + build_list_request, + build_update_tags_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class SnapshotsOperations: """ .. warning:: @@ -43,39 +59,34 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.SnapshotListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.Snapshot"]: """Gets a list of snapshots in the specified subscription. Gets a list of snapshots in the specified subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SnapshotListResult or the result of cls(response) + :return: An iterator like instance of either Snapshot or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_04_02_preview.models.SnapshotListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_04_02_preview.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SnapshotListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -83,14 +94,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -106,10 +114,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -119,48 +125,42 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots"} # type: ignore @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.SnapshotListResult]: + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.Snapshot"]: """Lists snapshots in the specified subscription and resource group. Lists snapshots in the specified subscription and resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SnapshotListResult or the result of cls(response) + :return: An iterator like instance of either Snapshot or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_04_02_preview.models.SnapshotListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_04_02_preview.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SnapshotListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -168,15 +168,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -192,10 +188,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -205,50 +199,41 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots"} # type: ignore @distributed_trace_async - async def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.Snapshot: + async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.Snapshot: """Gets a snapshot. Gets a snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Snapshot, or the result of cls(response) + :return: Snapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.Snapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -256,32 +241,32 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - - @distributed_trace_async + @overload async def create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.Snapshot, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.Snapshot: """Creates or updates a snapshot. @@ -289,38 +274,102 @@ async def create_or_update( Creates or updates a snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The snapshot to create or update. + :param parameters: The snapshot to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_04_02_preview.models.Snapshot + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Snapshot, or the result of cls(response) + :return: Snapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.Snapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Snapshot: + """Creates or updates a snapshot. + + Creates or updates a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The snapshot to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.Snapshot, IO], **kwargs: Any + ) -> _models.Snapshot: + """Creates or updates a snapshot. + + Creates or updates a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The snapshot to create or update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.mgmt.containerservice.v2022_04_02_preview.models.Snapshot or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] - _json = self._serialize.body(parameters, 'Snapshot') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "Snapshot") request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) @@ -328,10 +377,9 @@ async def create_or_update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -339,25 +387,26 @@ async def create_or_update( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - @distributed_trace_async + @overload async def update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.Snapshot: """Updates tags on a snapshot. @@ -365,38 +414,102 @@ async def update_tags( Updates tags on a snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update snapshot Tags operation. + :param parameters: Parameters supplied to the Update snapshot Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2022_04_02_preview.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Snapshot: + """Updates tags on a snapshot. + + Updates tags on a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update snapshot Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Snapshot, or the result of cls(response) + :return: Snapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.Snapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @distributed_trace_async + async def update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> _models.Snapshot: + """Updates tags on a snapshot. + + Updates tags on a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update snapshot Tags operation. Is either a model + type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_04_02_preview.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") request = build_update_tags_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_tags.metadata['url'], + content=_content, + template_url=self.update_tags.metadata["url"], headers=_headers, params=_params, ) @@ -404,64 +517,57 @@ async def update_tags( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - + update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: """Deletes a snapshot. Deletes a snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) @@ -469,10 +575,9 @@ async def delete( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -482,5 +587,4 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - + delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/_trusted_access_role_bindings_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/_trusted_access_role_bindings_operations.py index 67bca0b27d66..85e8420f78c7 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/_trusted_access_role_bindings_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/_trusted_access_role_bindings_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,10 +27,17 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._trusted_access_role_bindings_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_request -T = TypeVar('T') +from ...operations._trusted_access_role_bindings_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class TrustedAccessRoleBindingsOperations: """ .. warning:: @@ -43,48 +57,44 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.TrustedAccessRoleBindingListResult]: + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> AsyncIterable["_models.TrustedAccessRoleBinding"]: """List trusted access role bindings. List trusted access role bindings. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either TrustedAccessRoleBindingListResult or the result - of cls(response) + :return: An iterator like instance of either TrustedAccessRoleBinding or the result of + cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_04_02_preview.models.TrustedAccessRoleBindingListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_04_02_preview.models.TrustedAccessRoleBinding] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.TrustedAccessRoleBindingListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.TrustedAccessRoleBindingListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -92,16 +102,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -117,10 +122,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -130,54 +133,46 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings"} # type: ignore @distributed_trace_async async def get( - self, - resource_group_name: str, - resource_name: str, - trusted_access_role_binding_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, trusted_access_role_binding_name: str, **kwargs: Any ) -> _models.TrustedAccessRoleBinding: """Get a trusted access role binding. Get a trusted access role binding. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param trusted_access_role_binding_name: The name of trusted access role binding. + :param trusted_access_role_binding_name: The name of trusted access role binding. Required. :type trusted_access_role_binding_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: TrustedAccessRoleBinding, or the result of cls(response) + :return: TrustedAccessRoleBinding or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.TrustedAccessRoleBinding - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.TrustedAccessRoleBinding] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.TrustedAccessRoleBinding] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, trusted_access_role_binding_name=trusted_access_role_binding_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -185,33 +180,33 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('TrustedAccessRoleBinding', pipeline_response) + deserialized = self._deserialize("TrustedAccessRoleBinding", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}"} # type: ignore - @distributed_trace_async + @overload async def create_or_update( self, resource_group_name: str, resource_name: str, trusted_access_role_binding_name: str, trusted_access_role_binding: _models.TrustedAccessRoleBinding, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.TrustedAccessRoleBinding: """Create or update a trusted access role binding. @@ -219,42 +214,117 @@ async def create_or_update( Create or update a trusted access role binding. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param trusted_access_role_binding_name: The name of trusted access role binding. + :param trusted_access_role_binding_name: The name of trusted access role binding. Required. :type trusted_access_role_binding_name: str - :param trusted_access_role_binding: A trusted access role binding. + :param trusted_access_role_binding: A trusted access role binding. Required. :type trusted_access_role_binding: ~azure.mgmt.containerservice.v2022_04_02_preview.models.TrustedAccessRoleBinding + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TrustedAccessRoleBinding or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.TrustedAccessRoleBinding + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + trusted_access_role_binding_name: str, + trusted_access_role_binding: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.TrustedAccessRoleBinding: + """Create or update a trusted access role binding. + + Create or update a trusted access role binding. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param trusted_access_role_binding_name: The name of trusted access role binding. Required. + :type trusted_access_role_binding_name: str + :param trusted_access_role_binding: A trusted access role binding. Required. + :type trusted_access_role_binding: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: TrustedAccessRoleBinding, or the result of cls(response) + :return: TrustedAccessRoleBinding or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.TrustedAccessRoleBinding - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + trusted_access_role_binding_name: str, + trusted_access_role_binding: Union[_models.TrustedAccessRoleBinding, IO], + **kwargs: Any + ) -> _models.TrustedAccessRoleBinding: + """Create or update a trusted access role binding. + + Create or update a trusted access role binding. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param trusted_access_role_binding_name: The name of trusted access role binding. Required. + :type trusted_access_role_binding_name: str + :param trusted_access_role_binding: A trusted access role binding. Is either a model type or a + IO type. Required. + :type trusted_access_role_binding: + ~azure.mgmt.containerservice.v2022_04_02_preview.models.TrustedAccessRoleBinding or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TrustedAccessRoleBinding or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.TrustedAccessRoleBinding + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.TrustedAccessRoleBinding] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.TrustedAccessRoleBinding] - _json = self._serialize.body(trusted_access_role_binding, 'TrustedAccessRoleBinding') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(trusted_access_role_binding, (IO, bytes)): + _content = trusted_access_role_binding + else: + _json = self._serialize.body(trusted_access_role_binding, "TrustedAccessRoleBinding") request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, trusted_access_role_binding_name=trusted_access_role_binding_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) @@ -262,68 +332,60 @@ async def create_or_update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('TrustedAccessRoleBinding', pipeline_response) + deserialized = self._deserialize("TrustedAccessRoleBinding", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}"} # type: ignore - + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}"} # type: ignore @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - trusted_access_role_binding_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, trusted_access_role_binding_name: str, **kwargs: Any ) -> None: """Delete a trusted access role binding. Delete a trusted access role binding. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param trusted_access_role_binding_name: The name of trusted access role binding. + :param trusted_access_role_binding_name: The name of trusted access role binding. Required. :type trusted_access_role_binding_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, trusted_access_role_binding_name=trusted_access_role_binding_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) @@ -331,10 +393,9 @@ async def delete( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -344,5 +405,4 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}"} # type: ignore - + delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/_trusted_access_roles_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/_trusted_access_roles_operations.py index b722cb095a44..f78068e9582a 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/_trusted_access_roles_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/_trusted_access_roles_operations.py @@ -7,9 +7,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,9 +27,11 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._trusted_access_roles_operations import build_list_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class TrustedAccessRolesOperations: """ .. warning:: @@ -42,44 +51,37 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - location: str, - **kwargs: Any - ) -> AsyncIterable[_models.TrustedAccessRoleListResult]: + def list(self, location: str, **kwargs: Any) -> AsyncIterable["_models.TrustedAccessRole"]: """List supported trusted access roles. List supported trusted access roles. - :param location: The name of Azure region. + :param location: The name of Azure region. Required. :type location: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either TrustedAccessRoleListResult or the result of - cls(response) + :return: An iterator like instance of either TrustedAccessRole or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_04_02_preview.models.TrustedAccessRoleListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_04_02_preview.models.TrustedAccessRole] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.TrustedAccessRoleListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.TrustedAccessRoleListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( - subscription_id=self._config.subscription_id, location=location, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -87,15 +89,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - location=location, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -111,10 +109,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -124,8 +120,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/trustedAccessRoles"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/trustedAccessRoles"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/models/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/models/__init__.py index fd6f4108856b..251963070afc 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/models/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/models/__init__.py @@ -112,194 +112,192 @@ from ._models_py3 import UserAssignedIdentity from ._models_py3 import WindowsGmsaProfile - -from ._container_service_client_enums import ( - AgentPoolMode, - AgentPoolType, - Code, - ConnectionStatus, - ContainerServiceStorageProfileTypes, - ContainerServiceVMSizeTypes, - Count, - CreatedByType, - Expander, - ExtendedLocationTypes, - Format, - GPUInstanceProfile, - IpFamily, - KubeletDiskType, - LicenseType, - LoadBalancerSku, - ManagedClusterPodIdentityProvisioningState, - ManagedClusterSKUName, - ManagedClusterSKUTier, - NetworkMode, - NetworkPlugin, - NetworkPluginMode, - NetworkPolicy, - OSDiskType, - OSSKU, - OSType, - OutboundType, - PrivateEndpointConnectionProvisioningState, - PublicNetworkAccess, - ResourceIdentityType, - ScaleDownMode, - ScaleSetEvictionPolicy, - ScaleSetPriority, - SnapshotType, - TrustedAccessRoleBindingProvisioningState, - UpgradeChannel, - WeekDay, - WorkloadRuntime, -) +from ._container_service_client_enums import AgentPoolMode +from ._container_service_client_enums import AgentPoolType +from ._container_service_client_enums import Code +from ._container_service_client_enums import ConnectionStatus +from ._container_service_client_enums import ContainerServiceStorageProfileTypes +from ._container_service_client_enums import ContainerServiceVMSizeTypes +from ._container_service_client_enums import Count +from ._container_service_client_enums import CreatedByType +from ._container_service_client_enums import Expander +from ._container_service_client_enums import ExtendedLocationTypes +from ._container_service_client_enums import Format +from ._container_service_client_enums import GPUInstanceProfile +from ._container_service_client_enums import IpFamily +from ._container_service_client_enums import KubeletDiskType +from ._container_service_client_enums import LicenseType +from ._container_service_client_enums import LoadBalancerSku +from ._container_service_client_enums import ManagedClusterPodIdentityProvisioningState +from ._container_service_client_enums import ManagedClusterSKUName +from ._container_service_client_enums import ManagedClusterSKUTier +from ._container_service_client_enums import NetworkMode +from ._container_service_client_enums import NetworkPlugin +from ._container_service_client_enums import NetworkPluginMode +from ._container_service_client_enums import NetworkPolicy +from ._container_service_client_enums import OSDiskType +from ._container_service_client_enums import OSSKU +from ._container_service_client_enums import OSType +from ._container_service_client_enums import OutboundType +from ._container_service_client_enums import PrivateEndpointConnectionProvisioningState +from ._container_service_client_enums import PublicNetworkAccess +from ._container_service_client_enums import ResourceIdentityType +from ._container_service_client_enums import ScaleDownMode +from ._container_service_client_enums import ScaleSetEvictionPolicy +from ._container_service_client_enums import ScaleSetPriority +from ._container_service_client_enums import SnapshotType +from ._container_service_client_enums import TrustedAccessRoleBindingProvisioningState +from ._container_service_client_enums import UpgradeChannel +from ._container_service_client_enums import WeekDay +from ._container_service_client_enums import WorkloadRuntime from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'AgentPool', - 'AgentPoolAvailableVersions', - 'AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem', - 'AgentPoolListResult', - 'AgentPoolUpgradeProfile', - 'AgentPoolUpgradeProfilePropertiesUpgradesItem', - 'AgentPoolUpgradeSettings', - 'AzureKeyVaultKms', - 'CloudErrorBody', - 'ContainerServiceDiagnosticsProfile', - 'ContainerServiceLinuxProfile', - 'ContainerServiceMasterProfile', - 'ContainerServiceNetworkProfile', - 'ContainerServiceSshConfiguration', - 'ContainerServiceSshPublicKey', - 'ContainerServiceVMDiagnostics', - 'CreationData', - 'CredentialResult', - 'CredentialResults', - 'EndpointDependency', - 'EndpointDetail', - 'ExtendedLocation', - 'KubeletConfig', - 'LinuxOSConfig', - 'MaintenanceConfiguration', - 'MaintenanceConfigurationListResult', - 'ManagedCluster', - 'ManagedClusterAADProfile', - 'ManagedClusterAPIServerAccessProfile', - 'ManagedClusterAccessProfile', - 'ManagedClusterAddonProfile', - 'ManagedClusterAddonProfileIdentity', - 'ManagedClusterAgentPoolProfile', - 'ManagedClusterAgentPoolProfileProperties', - 'ManagedClusterAutoUpgradeProfile', - 'ManagedClusterHTTPProxyConfig', - 'ManagedClusterIdentity', - 'ManagedClusterIngressProfile', - 'ManagedClusterIngressProfileWebAppRouting', - 'ManagedClusterListResult', - 'ManagedClusterLoadBalancerProfile', - 'ManagedClusterLoadBalancerProfileManagedOutboundIPs', - 'ManagedClusterLoadBalancerProfileOutboundIPPrefixes', - 'ManagedClusterLoadBalancerProfileOutboundIPs', - 'ManagedClusterManagedOutboundIPProfile', - 'ManagedClusterNATGatewayProfile', - 'ManagedClusterOIDCIssuerProfile', - 'ManagedClusterPodIdentity', - 'ManagedClusterPodIdentityException', - 'ManagedClusterPodIdentityProfile', - 'ManagedClusterPodIdentityProvisioningError', - 'ManagedClusterPodIdentityProvisioningErrorBody', - 'ManagedClusterPodIdentityProvisioningInfo', - 'ManagedClusterPoolUpgradeProfile', - 'ManagedClusterPoolUpgradeProfileUpgradesItem', - 'ManagedClusterPropertiesAutoScalerProfile', - 'ManagedClusterPropertiesForSnapshot', - 'ManagedClusterSKU', - 'ManagedClusterSecurityProfile', - 'ManagedClusterSecurityProfileAzureDefender', - 'ManagedClusterSecurityProfileWorkloadIdentity', - 'ManagedClusterServicePrincipalProfile', - 'ManagedClusterSnapshot', - 'ManagedClusterSnapshotListResult', - 'ManagedClusterStorageProfile', - 'ManagedClusterStorageProfileDiskCSIDriver', - 'ManagedClusterStorageProfileFileCSIDriver', - 'ManagedClusterStorageProfileSnapshotController', - 'ManagedClusterUpgradeProfile', - 'ManagedClusterWindowsProfile', - 'ManagedServiceIdentityUserAssignedIdentitiesValue', - 'NetworkProfileForSnapshot', - 'OSOptionProfile', - 'OSOptionProperty', - 'OperationListResult', - 'OperationValue', - 'OutboundEnvironmentEndpoint', - 'OutboundEnvironmentEndpointCollection', - 'PowerState', - 'PrivateEndpoint', - 'PrivateEndpointConnection', - 'PrivateEndpointConnectionListResult', - 'PrivateLinkResource', - 'PrivateLinkResourcesListResult', - 'PrivateLinkServiceConnectionState', - 'Resource', - 'ResourceReference', - 'RunCommandRequest', - 'RunCommandResult', - 'Snapshot', - 'SnapshotListResult', - 'SubResource', - 'SysctlConfig', - 'SystemData', - 'TagsObject', - 'TimeInWeek', - 'TimeSpan', - 'TrackedResource', - 'TrustedAccessRole', - 'TrustedAccessRoleBinding', - 'TrustedAccessRoleBindingListResult', - 'TrustedAccessRoleListResult', - 'TrustedAccessRoleRule', - 'UserAssignedIdentity', - 'WindowsGmsaProfile', - 'AgentPoolMode', - 'AgentPoolType', - 'Code', - 'ConnectionStatus', - 'ContainerServiceStorageProfileTypes', - 'ContainerServiceVMSizeTypes', - 'Count', - 'CreatedByType', - 'Expander', - 'ExtendedLocationTypes', - 'Format', - 'GPUInstanceProfile', - 'IpFamily', - 'KubeletDiskType', - 'LicenseType', - 'LoadBalancerSku', - 'ManagedClusterPodIdentityProvisioningState', - 'ManagedClusterSKUName', - 'ManagedClusterSKUTier', - 'NetworkMode', - 'NetworkPlugin', - 'NetworkPluginMode', - 'NetworkPolicy', - 'OSDiskType', - 'OSSKU', - 'OSType', - 'OutboundType', - 'PrivateEndpointConnectionProvisioningState', - 'PublicNetworkAccess', - 'ResourceIdentityType', - 'ScaleDownMode', - 'ScaleSetEvictionPolicy', - 'ScaleSetPriority', - 'SnapshotType', - 'TrustedAccessRoleBindingProvisioningState', - 'UpgradeChannel', - 'WeekDay', - 'WorkloadRuntime', + "AgentPool", + "AgentPoolAvailableVersions", + "AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem", + "AgentPoolListResult", + "AgentPoolUpgradeProfile", + "AgentPoolUpgradeProfilePropertiesUpgradesItem", + "AgentPoolUpgradeSettings", + "AzureKeyVaultKms", + "CloudErrorBody", + "ContainerServiceDiagnosticsProfile", + "ContainerServiceLinuxProfile", + "ContainerServiceMasterProfile", + "ContainerServiceNetworkProfile", + "ContainerServiceSshConfiguration", + "ContainerServiceSshPublicKey", + "ContainerServiceVMDiagnostics", + "CreationData", + "CredentialResult", + "CredentialResults", + "EndpointDependency", + "EndpointDetail", + "ExtendedLocation", + "KubeletConfig", + "LinuxOSConfig", + "MaintenanceConfiguration", + "MaintenanceConfigurationListResult", + "ManagedCluster", + "ManagedClusterAADProfile", + "ManagedClusterAPIServerAccessProfile", + "ManagedClusterAccessProfile", + "ManagedClusterAddonProfile", + "ManagedClusterAddonProfileIdentity", + "ManagedClusterAgentPoolProfile", + "ManagedClusterAgentPoolProfileProperties", + "ManagedClusterAutoUpgradeProfile", + "ManagedClusterHTTPProxyConfig", + "ManagedClusterIdentity", + "ManagedClusterIngressProfile", + "ManagedClusterIngressProfileWebAppRouting", + "ManagedClusterListResult", + "ManagedClusterLoadBalancerProfile", + "ManagedClusterLoadBalancerProfileManagedOutboundIPs", + "ManagedClusterLoadBalancerProfileOutboundIPPrefixes", + "ManagedClusterLoadBalancerProfileOutboundIPs", + "ManagedClusterManagedOutboundIPProfile", + "ManagedClusterNATGatewayProfile", + "ManagedClusterOIDCIssuerProfile", + "ManagedClusterPodIdentity", + "ManagedClusterPodIdentityException", + "ManagedClusterPodIdentityProfile", + "ManagedClusterPodIdentityProvisioningError", + "ManagedClusterPodIdentityProvisioningErrorBody", + "ManagedClusterPodIdentityProvisioningInfo", + "ManagedClusterPoolUpgradeProfile", + "ManagedClusterPoolUpgradeProfileUpgradesItem", + "ManagedClusterPropertiesAutoScalerProfile", + "ManagedClusterPropertiesForSnapshot", + "ManagedClusterSKU", + "ManagedClusterSecurityProfile", + "ManagedClusterSecurityProfileAzureDefender", + "ManagedClusterSecurityProfileWorkloadIdentity", + "ManagedClusterServicePrincipalProfile", + "ManagedClusterSnapshot", + "ManagedClusterSnapshotListResult", + "ManagedClusterStorageProfile", + "ManagedClusterStorageProfileDiskCSIDriver", + "ManagedClusterStorageProfileFileCSIDriver", + "ManagedClusterStorageProfileSnapshotController", + "ManagedClusterUpgradeProfile", + "ManagedClusterWindowsProfile", + "ManagedServiceIdentityUserAssignedIdentitiesValue", + "NetworkProfileForSnapshot", + "OSOptionProfile", + "OSOptionProperty", + "OperationListResult", + "OperationValue", + "OutboundEnvironmentEndpoint", + "OutboundEnvironmentEndpointCollection", + "PowerState", + "PrivateEndpoint", + "PrivateEndpointConnection", + "PrivateEndpointConnectionListResult", + "PrivateLinkResource", + "PrivateLinkResourcesListResult", + "PrivateLinkServiceConnectionState", + "Resource", + "ResourceReference", + "RunCommandRequest", + "RunCommandResult", + "Snapshot", + "SnapshotListResult", + "SubResource", + "SysctlConfig", + "SystemData", + "TagsObject", + "TimeInWeek", + "TimeSpan", + "TrackedResource", + "TrustedAccessRole", + "TrustedAccessRoleBinding", + "TrustedAccessRoleBindingListResult", + "TrustedAccessRoleListResult", + "TrustedAccessRoleRule", + "UserAssignedIdentity", + "WindowsGmsaProfile", + "AgentPoolMode", + "AgentPoolType", + "Code", + "ConnectionStatus", + "ContainerServiceStorageProfileTypes", + "ContainerServiceVMSizeTypes", + "Count", + "CreatedByType", + "Expander", + "ExtendedLocationTypes", + "Format", + "GPUInstanceProfile", + "IpFamily", + "KubeletDiskType", + "LicenseType", + "LoadBalancerSku", + "ManagedClusterPodIdentityProvisioningState", + "ManagedClusterSKUName", + "ManagedClusterSKUTier", + "NetworkMode", + "NetworkPlugin", + "NetworkPluginMode", + "NetworkPolicy", + "OSDiskType", + "OSSKU", + "OSType", + "OutboundType", + "PrivateEndpointConnectionProvisioningState", + "PublicNetworkAccess", + "ResourceIdentityType", + "ScaleDownMode", + "ScaleSetEvictionPolicy", + "ScaleSetPriority", + "SnapshotType", + "TrustedAccessRoleBindingProvisioningState", + "UpgradeChannel", + "WeekDay", + "WorkloadRuntime", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/models/_container_service_client_enums.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/models/_container_service_client_enums.py index d98ebcc9fce9..ac6a3e720b2a 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/models/_container_service_client_enums.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/models/_container_service_client_enums.py @@ -13,7 +13,7 @@ class AgentPoolMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools + https://docs.microsoft.com/azure/aks/use-system-pools. """ #: System agent pools are primarily for hosting critical system pods such as CoreDNS and @@ -23,33 +23,34 @@ class AgentPoolMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: User agent pools are primarily for hosting your application pods. USER = "User" + class AgentPoolType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of Agent Pool. - """ + """The type of Agent Pool.""" #: Create an Agent Pool backed by a Virtual Machine Scale Set. VIRTUAL_MACHINE_SCALE_SETS = "VirtualMachineScaleSets" #: Use of this is strongly discouraged. AVAILABILITY_SET = "AvailabilitySet" + class Code(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Tells whether the cluster is Running or Stopped - """ + """Tells whether the cluster is Running or Stopped.""" #: The cluster is running. RUNNING = "Running" #: The cluster is stopped. STOPPED = "Stopped" + class ConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The private link service connection status. - """ + """The private link service connection status.""" PENDING = "Pending" APPROVED = "Approved" REJECTED = "Rejected" DISCONNECTED = "Disconnected" + class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Specifies what kind of storage to use. If omitted, the default will be chosen on your behalf based on the choice of orchestrator. @@ -58,9 +59,9 @@ class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEn STORAGE_ACCOUNT = "StorageAccount" MANAGED_DISKS = "ManagedDisks" + class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Size of agent VMs. Note: This is no longer maintained. - """ + """Size of agent VMs. Note: This is no longer maintained.""" STANDARD_A1 = "Standard_A1" STANDARD_A10 = "Standard_A10" @@ -237,6 +238,7 @@ class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): STANDARD_NV24 = "Standard_NV24" STANDARD_NV6 = "Standard_NV6" + class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): """Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, and 5. The default value is 1. @@ -246,15 +248,16 @@ class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): THREE = 3 FIVE = 5 + class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of identity that created the resource. - """ + """The type of identity that created the resource.""" USER = "User" APPLICATION = "Application" MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" + class Expander(str, Enum, metaclass=CaseInsensitiveEnumMeta): """If not specified, the default is 'random'. See `expanders `_ @@ -278,23 +281,25 @@ class Expander(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Used when you don't have a particular need for the node groups to scale differently. RANDOM = "random" + class ExtendedLocationTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of extendedLocation. - """ + """The type of extendedLocation.""" EDGE_ZONE = "EdgeZone" + class Format(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Format.""" #: Return azure auth-provider kubeconfig. This format is deprecated in 1.22 and will be fully #: removed in 1.25. AZURE = "azure" #: Return exec format kubeconfig. This format requires kubelogin binary in the path. - EXEC_ENUM = "exec" + EXEC = "exec" + class GPUInstanceProfile(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """GPUInstanceProfile to be used to specify GPU MIG instance profile for supported GPU VM SKU. - """ + """GPUInstanceProfile to be used to specify GPU MIG instance profile for supported GPU VM SKU.""" MIG1_G = "MIG1g" MIG2_G = "MIG2g" @@ -302,13 +307,14 @@ class GPUInstanceProfile(str, Enum, metaclass=CaseInsensitiveEnumMeta): MIG4_G = "MIG4g" MIG7_G = "MIG7g" + class IpFamily(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The IP version to use for cluster networking and IP assignment. - """ + """The IP version to use for cluster networking and IP assignment.""" I_PV4 = "IPv4" I_PV6 = "IPv6" + class KubeletDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. @@ -319,6 +325,7 @@ class KubeletDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Kubelet will use the temporary disk for its data. TEMPORARY = "Temporary" + class LicenseType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The license type to use for Windows VMs. See `Azure Hybrid User Benefits `_ for more details. @@ -329,6 +336,7 @@ class LicenseType(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Enables Azure Hybrid User Benefits for Windows VMs. WINDOWS_SERVER = "Windows_Server" + class LoadBalancerSku(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The default is 'standard'. See `Azure Load Balancer SKUs `_ for more information about the @@ -342,21 +350,22 @@ class LoadBalancerSku(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Use a basic Load Balancer with limited functionality. BASIC = "basic" + class ManagedClusterPodIdentityProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The current provisioning state of the pod identity. - """ + """The current provisioning state of the pod identity.""" ASSIGNED = "Assigned" UPDATING = "Updating" DELETING = "Deleting" FAILED = "Failed" + class ManagedClusterSKUName(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The name of a managed cluster SKU. - """ + """The name of a managed cluster SKU.""" BASIC = "Basic" + class ManagedClusterSKUTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): """If not specified, the default is 'Free'. See `uptime SLA `_ for more details. @@ -368,20 +377,20 @@ class ManagedClusterSKUTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: No guaranteed SLA, no additional charges. Free tier clusters have an SLO of 99.5%. FREE = "Free" + class NetworkMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """This cannot be specified if networkPlugin is anything other than 'azure'. - """ + """This cannot be specified if networkPlugin is anything other than 'azure'.""" #: No bridge is created. Intra-VM Pod to Pod communication is through IP routes created by Azure #: CNI. See `Transparent Mode `_ for #: more information. TRANSPARENT = "transparent" - #: This is no longer supported. + #: This is no longer supported BRIDGE = "bridge" + class NetworkPlugin(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Network plugin used for building the Kubernetes network. - """ + """Network plugin used for building the Kubernetes network.""" #: Use the Azure CNI network plugin. See `Azure CNI (advanced) networking #: `_ for @@ -395,17 +404,17 @@ class NetworkPlugin(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: networking functionality. NONE = "none" + class NetworkPluginMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The mode the network plugin should use. - """ + """The mode the network plugin should use.""" #: Pods are given IPs from the PodCIDR address space but use Azure Routing Domains rather than #: Kubenet reference plugins host-local and bridge. OVERLAY = "Overlay" + class NetworkPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Network policy used for building the Kubernetes network. - """ + """Network policy used for building the Kubernetes network.""" #: Use Calico network policies. See `differences between Azure and Calico policies #: `_ @@ -416,6 +425,7 @@ class NetworkPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: for more information. AZURE = "azure" + class OSDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more @@ -432,6 +442,7 @@ class OSDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: provides lower read/write latency, along with faster node scaling and cluster upgrades. EPHEMERAL = "Ephemeral" + class OSSKU(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Specifies the OS SKU used by the agent pool. If not specified, the default is Ubuntu if OSType=Linux or Windows2019 if OSType=Windows. And the default Windows OSSKU will be changed to @@ -443,15 +454,16 @@ class OSSKU(str, Enum, metaclass=CaseInsensitiveEnumMeta): WINDOWS2019 = "Windows2019" WINDOWS2022 = "Windows2022" + class OSType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The operating system type. The default is Linux. - """ + """The operating system type. The default is Linux.""" #: Use Linux. LINUX = "Linux" #: Use Windows. WINDOWS = "Windows" + class OutboundType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """This can only be set at cluster creation time and cannot be changed later. For more information see `egress outbound type `_. @@ -472,22 +484,23 @@ class OutboundType(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: advanced scenario and requires proper network configuration. USER_ASSIGNED_NAT_GATEWAY = "userAssignedNATGateway" + class PrivateEndpointConnectionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The current provisioning state. - """ + """The current provisioning state.""" SUCCEEDED = "Succeeded" CREATING = "Creating" DELETING = "Deleting" FAILED = "Failed" + class PublicNetworkAccess(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Allow or deny public network access for AKS - """ + """Allow or deny public network access for AKS.""" ENABLED = "Enabled" DISABLED = "Disabled" + class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """For more information see `use managed identities in AKS `_. @@ -504,6 +517,7 @@ class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Do not use a managed identity for the Managed Cluster, service principal will be used instead. NONE = "None" + class ScaleDownMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Describes how VMs are added to or removed from Agent Pools. See `billing states `_. @@ -515,10 +529,11 @@ class ScaleDownMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: during scale down. DEALLOCATE = "Deallocate" + class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The eviction policy specifies what to do with the VM when it is evicted. The default is Delete. For more information about eviction see `spot VMs - `_ + `_. """ #: Nodes in the underlying Scale Set of the node pool are deleted when they're evicted. @@ -528,9 +543,9 @@ class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: cause issues with cluster scaling or upgrading. DEALLOCATE = "Deallocate" + class ScaleSetPriority(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The Virtual Machine Scale Set priority. - """ + """The Virtual Machine Scale Set priority.""" #: Spot priority VMs will be used. There is no SLA for spot nodes. See `spot on AKS #: `_ for more information. @@ -538,24 +553,25 @@ class ScaleSetPriority(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Regular VMs will be used. REGULAR = "Regular" + class SnapshotType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of a snapshot. The default is NodePool. - """ + """The type of a snapshot. The default is NodePool.""" #: The snapshot is a snapshot of a node pool. NODE_POOL = "NodePool" #: The snapshot is a snapshot of a managed cluster. MANAGED_CLUSTER = "ManagedCluster" + class TrustedAccessRoleBindingProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The current provisioning state of trusted access role binding. - """ + """The current provisioning state of trusted access role binding.""" SUCCEEDED = "Succeeded" FAILED = "Failed" UPDATING = "Updating" DELETING = "Deleting" + class UpgradeChannel(str, Enum, metaclass=CaseInsensitiveEnumMeta): """For more information see `setting the AKS cluster auto-upgrade channel `_. @@ -586,9 +602,9 @@ class UpgradeChannel(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Disables auto-upgrades and keeps the cluster at its current version of Kubernetes. NONE = "none" + class WeekDay(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The weekday enum. - """ + """The weekday enum.""" SUNDAY = "Sunday" MONDAY = "Monday" @@ -598,9 +614,9 @@ class WeekDay(str, Enum, metaclass=CaseInsensitiveEnumMeta): FRIDAY = "Friday" SATURDAY = "Saturday" + class WorkloadRuntime(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Determines the type of workload a node can run. - """ + """Determines the type of workload a node can run.""" #: Nodes will use Kubelet to run standard OCI container workloads. OCI_CONTAINER = "OCIContainer" diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/models/_models_py3.py index f3c04f167732..e51d1def8897 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/models/_models_py3.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/models/_models_py3.py @@ -1,4 +1,5 @@ # coding=utf-8 +# pylint: disable=too-many-lines # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -9,14 +10,14 @@ import datetime from typing import Dict, List, Optional, TYPE_CHECKING, Union -import msrest.serialization +from ... import _serialization if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - import __init__ as _models + from .. import models as _models -class SubResource(msrest.serialization.Model): +class SubResource(_serialization.Model): """Reference to another subresource. Variables are only populated by the server, and will be ignored when sending a request. @@ -31,30 +32,26 @@ class SubResource(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(SubResource, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.id = None self.name = None self.type = None -class AgentPool(SubResource): +class AgentPool(SubResource): # pylint: disable=too-many-instance-attributes """Agent Pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -82,15 +79,15 @@ class AgentPool(SubResource): larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.OSDiskType :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data - root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.KubeletDiskType :ivar workload_runtime: Determines the type of workload a node can run. Known values are: - "OCIContainer", "WasmWasi". + "OCIContainer" and "WasmWasi". :vartype workload_runtime: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.WorkloadRuntime :ivar message_of_the_day: A base64-encoded string which will be written to /etc/motd after @@ -109,13 +106,13 @@ class AgentPool(SubResource): :vartype pod_subnet_id: str :ivar max_pods: The maximum number of pods that can run on a node. :vartype max_pods: int - :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.OSType :ivar os_sku: Specifies the OS SKU used by the agent pool. If not specified, the default is Ubuntu if OSType=Linux or Windows2019 if OSType=Windows. And the default Windows OSSKU will be changed to Windows2022 after Windows2019 is deprecated. Known values are: "Ubuntu", - "CBLMariner", "Windows2019", "Windows2022". + "CBLMariner", "Windows2019", and "Windows2022". :vartype os_sku: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.OSSKU :ivar max_count: The maximum number of nodes for auto-scaling. :vartype max_count: int @@ -124,16 +121,16 @@ class AgentPool(SubResource): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it - defaults to Delete. Known values are: "Delete", "Deallocate". + defaults to Delete. Known values are: "Delete" and "Deallocate". :vartype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.ScaleDownMode - :ivar type_properties_type: The type of Agent Pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + :ivar type_properties_type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets" + and "AvailabilitySet". :vartype type_properties_type: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.AgentPoolType :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :vartype mode: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.AgentPoolMode :ivar orchestrator_version: Both patch version and are supported. When is specified, the latest supported patch version is chosen @@ -179,20 +176,18 @@ class AgentPool(SubResource): /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default - is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + is 'Regular'. Known values are: "Spot" and "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.ScaleSetPriority :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.ScaleSetEvictionPolicy :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :vartype spot_max_price: float - :ivar tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :ivar tags: The tags to be persisted on the agent pool virtual machine scale set. :vartype tags: dict[str, str] :ivar node_labels: The node labels to be persisted across all nodes in agent pool. :vartype node_labels: dict[str, str] @@ -216,7 +211,7 @@ class AgentPool(SubResource): for more details. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.GPUInstanceProfile :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the node pool @@ -233,65 +228,65 @@ class AgentPool(SubResource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'os_disk_size_gb': {'maximum': 2048, 'minimum': 0}, - 'node_image_version': {'readonly': True}, - 'provisioning_state': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "os_disk_size_gb": {"maximum": 2048, "minimum": 0}, + "node_image_version": {"readonly": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'count': {'key': 'properties.count', 'type': 'int'}, - 'vm_size': {'key': 'properties.vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'properties.osDiskSizeGB', 'type': 'int'}, - 'os_disk_type': {'key': 'properties.osDiskType', 'type': 'str'}, - 'kubelet_disk_type': {'key': 'properties.kubeletDiskType', 'type': 'str'}, - 'workload_runtime': {'key': 'properties.workloadRuntime', 'type': 'str'}, - 'message_of_the_day': {'key': 'properties.messageOfTheDay', 'type': 'str'}, - 'vnet_subnet_id': {'key': 'properties.vnetSubnetID', 'type': 'str'}, - 'pod_subnet_id': {'key': 'properties.podSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'properties.maxPods', 'type': 'int'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'os_sku': {'key': 'properties.osSKU', 'type': 'str'}, - 'max_count': {'key': 'properties.maxCount', 'type': 'int'}, - 'min_count': {'key': 'properties.minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'properties.enableAutoScaling', 'type': 'bool'}, - 'scale_down_mode': {'key': 'properties.scaleDownMode', 'type': 'str'}, - 'type_properties_type': {'key': 'properties.type', 'type': 'str'}, - 'mode': {'key': 'properties.mode', 'type': 'str'}, - 'orchestrator_version': {'key': 'properties.orchestratorVersion', 'type': 'str'}, - 'current_orchestrator_version': {'key': 'properties.currentOrchestratorVersion', 'type': 'str'}, - 'node_image_version': {'key': 'properties.nodeImageVersion', 'type': 'str'}, - 'upgrade_settings': {'key': 'properties.upgradeSettings', 'type': 'AgentPoolUpgradeSettings'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'power_state': {'key': 'properties.powerState', 'type': 'PowerState'}, - 'availability_zones': {'key': 'properties.availabilityZones', 'type': '[str]'}, - 'enable_node_public_ip': {'key': 'properties.enableNodePublicIP', 'type': 'bool'}, - 'enable_custom_ca_trust': {'key': 'properties.enableCustomCATrust', 'type': 'bool'}, - 'node_public_ip_prefix_id': {'key': 'properties.nodePublicIPPrefixID', 'type': 'str'}, - 'scale_set_priority': {'key': 'properties.scaleSetPriority', 'type': 'str'}, - 'scale_set_eviction_policy': {'key': 'properties.scaleSetEvictionPolicy', 'type': 'str'}, - 'spot_max_price': {'key': 'properties.spotMaxPrice', 'type': 'float'}, - 'tags': {'key': 'properties.tags', 'type': '{str}'}, - 'node_labels': {'key': 'properties.nodeLabels', 'type': '{str}'}, - 'node_taints': {'key': 'properties.nodeTaints', 'type': '[str]'}, - 'proximity_placement_group_id': {'key': 'properties.proximityPlacementGroupID', 'type': 'str'}, - 'kubelet_config': {'key': 'properties.kubeletConfig', 'type': 'KubeletConfig'}, - 'linux_os_config': {'key': 'properties.linuxOSConfig', 'type': 'LinuxOSConfig'}, - 'enable_encryption_at_host': {'key': 'properties.enableEncryptionAtHost', 'type': 'bool'}, - 'enable_ultra_ssd': {'key': 'properties.enableUltraSSD', 'type': 'bool'}, - 'enable_fips': {'key': 'properties.enableFIPS', 'type': 'bool'}, - 'gpu_instance_profile': {'key': 'properties.gpuInstanceProfile', 'type': 'str'}, - 'creation_data': {'key': 'properties.creationData', 'type': 'CreationData'}, - 'capacity_reservation_group_id': {'key': 'properties.capacityReservationGroupID', 'type': 'str'}, - 'host_group_id': {'key': 'properties.hostGroupID', 'type': 'str'}, - } - - def __init__( + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "count": {"key": "properties.count", "type": "int"}, + "vm_size": {"key": "properties.vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "properties.osDiskSizeGB", "type": "int"}, + "os_disk_type": {"key": "properties.osDiskType", "type": "str"}, + "kubelet_disk_type": {"key": "properties.kubeletDiskType", "type": "str"}, + "workload_runtime": {"key": "properties.workloadRuntime", "type": "str"}, + "message_of_the_day": {"key": "properties.messageOfTheDay", "type": "str"}, + "vnet_subnet_id": {"key": "properties.vnetSubnetID", "type": "str"}, + "pod_subnet_id": {"key": "properties.podSubnetID", "type": "str"}, + "max_pods": {"key": "properties.maxPods", "type": "int"}, + "os_type": {"key": "properties.osType", "type": "str"}, + "os_sku": {"key": "properties.osSKU", "type": "str"}, + "max_count": {"key": "properties.maxCount", "type": "int"}, + "min_count": {"key": "properties.minCount", "type": "int"}, + "enable_auto_scaling": {"key": "properties.enableAutoScaling", "type": "bool"}, + "scale_down_mode": {"key": "properties.scaleDownMode", "type": "str"}, + "type_properties_type": {"key": "properties.type", "type": "str"}, + "mode": {"key": "properties.mode", "type": "str"}, + "orchestrator_version": {"key": "properties.orchestratorVersion", "type": "str"}, + "current_orchestrator_version": {"key": "properties.currentOrchestratorVersion", "type": "str"}, + "node_image_version": {"key": "properties.nodeImageVersion", "type": "str"}, + "upgrade_settings": {"key": "properties.upgradeSettings", "type": "AgentPoolUpgradeSettings"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "power_state": {"key": "properties.powerState", "type": "PowerState"}, + "availability_zones": {"key": "properties.availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "properties.enableNodePublicIP", "type": "bool"}, + "enable_custom_ca_trust": {"key": "properties.enableCustomCATrust", "type": "bool"}, + "node_public_ip_prefix_id": {"key": "properties.nodePublicIPPrefixID", "type": "str"}, + "scale_set_priority": {"key": "properties.scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "properties.scaleSetEvictionPolicy", "type": "str"}, + "spot_max_price": {"key": "properties.spotMaxPrice", "type": "float"}, + "tags": {"key": "properties.tags", "type": "{str}"}, + "node_labels": {"key": "properties.nodeLabels", "type": "{str}"}, + "node_taints": {"key": "properties.nodeTaints", "type": "[str]"}, + "proximity_placement_group_id": {"key": "properties.proximityPlacementGroupID", "type": "str"}, + "kubelet_config": {"key": "properties.kubeletConfig", "type": "KubeletConfig"}, + "linux_os_config": {"key": "properties.linuxOSConfig", "type": "LinuxOSConfig"}, + "enable_encryption_at_host": {"key": "properties.enableEncryptionAtHost", "type": "bool"}, + "enable_ultra_ssd": {"key": "properties.enableUltraSSD", "type": "bool"}, + "enable_fips": {"key": "properties.enableFIPS", "type": "bool"}, + "gpu_instance_profile": {"key": "properties.gpuInstanceProfile", "type": "str"}, + "creation_data": {"key": "properties.creationData", "type": "CreationData"}, + "capacity_reservation_group_id": {"key": "properties.capacityReservationGroupID", "type": "str"}, + "host_group_id": {"key": "properties.hostGroupID", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, count: Optional[int] = None, @@ -304,7 +299,7 @@ def __init__( vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, @@ -320,9 +315,9 @@ def __init__( enable_node_public_ip: Optional[bool] = None, enable_custom_ca_trust: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", - spot_max_price: Optional[float] = -1, + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", + spot_max_price: float = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, @@ -355,15 +350,15 @@ def __init__( larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.OSDiskType :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime - data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + data root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.KubeletDiskType :keyword workload_runtime: Determines the type of workload a node can run. Known values are: - "OCIContainer", "WasmWasi". + "OCIContainer" and "WasmWasi". :paramtype workload_runtime: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.WorkloadRuntime :keyword message_of_the_day: A base64-encoded string which will be written to /etc/motd after @@ -382,13 +377,13 @@ def __init__( :paramtype pod_subnet_id: str :keyword max_pods: The maximum number of pods that can run on a node. :paramtype max_pods: int - :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.OSType :keyword os_sku: Specifies the OS SKU used by the agent pool. If not specified, the default is Ubuntu if OSType=Linux or Windows2019 if OSType=Windows. And the default Windows OSSKU will be changed to Windows2022 after Windows2019 is deprecated. Known values are: "Ubuntu", - "CBLMariner", "Windows2019", "Windows2022". + "CBLMariner", "Windows2019", and "Windows2022". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.OSSKU :keyword max_count: The maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -397,16 +392,16 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, - it defaults to Delete. Known values are: "Delete", "Deallocate". + it defaults to Delete. Known values are: "Delete" and "Deallocate". :paramtype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.ScaleDownMode :keyword type_properties_type: The type of Agent Pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type_properties_type: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.AgentPoolType :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.AgentPoolMode :keyword orchestrator_version: Both patch version and are supported. When is specified, the latest supported patch version is chosen @@ -448,20 +443,18 @@ def __init__( /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the - default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + default is 'Regular'. Known values are: "Spot" and "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.ScaleSetPriority :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.ScaleSetEvictionPolicy :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :paramtype spot_max_price: float - :keyword tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :keyword tags: The tags to be persisted on the agent pool virtual machine scale set. :paramtype tags: dict[str, str] :keyword node_labels: The node labels to be persisted across all nodes in agent pool. :paramtype node_labels: dict[str, str] @@ -487,7 +480,7 @@ def __init__( for more details. :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance - profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.GPUInstanceProfile @@ -503,7 +496,7 @@ def __init__( `_. :paramtype host_group_id: str """ - super(AgentPool, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.vm_size = vm_size self.os_disk_size_gb = os_disk_size_gb @@ -550,7 +543,7 @@ def __init__( self.host_group_id = host_group_id -class AgentPoolAvailableVersions(msrest.serialization.Model): +class AgentPoolAvailableVersions(_serialization.Model): """The list of available versions for an agent pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -567,16 +560,19 @@ class AgentPoolAvailableVersions(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'agent_pool_versions': {'key': 'properties.agentPoolVersions', 'type': '[AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "agent_pool_versions": { + "key": "properties.agentPoolVersions", + "type": "[AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem]", + }, } def __init__( @@ -590,14 +586,14 @@ def __init__( :paramtype agent_pool_versions: list[~azure.mgmt.containerservice.v2022_04_02_preview.models.AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem] """ - super(AgentPoolAvailableVersions, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None self.agent_pool_versions = agent_pool_versions -class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(msrest.serialization.Model): +class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(_serialization.Model): """AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem. :ivar default: Whether this version is the default agent pool version. @@ -609,9 +605,9 @@ class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(msrest.serializa """ _attribute_map = { - 'default': {'key': 'default', 'type': 'bool'}, - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "default": {"key": "default", "type": "bool"}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } def __init__( @@ -630,13 +626,13 @@ def __init__( :keyword is_preview: Whether Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.default = default self.kubernetes_version = kubernetes_version self.is_preview = is_preview -class AgentPoolListResult(msrest.serialization.Model): +class AgentPoolListResult(_serialization.Model): """The response from the List Agent Pools operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -648,30 +644,25 @@ class AgentPoolListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[AgentPool]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[AgentPool]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.AgentPool"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.AgentPool"]] = None, **kwargs): """ :keyword value: The list of agent pools. :paramtype value: list[~azure.mgmt.containerservice.v2022_04_02_preview.models.AgentPool] """ - super(AgentPoolListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class AgentPoolUpgradeProfile(msrest.serialization.Model): +class AgentPoolUpgradeProfile(_serialization.Model): """The list of available upgrades for an agent pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -684,10 +675,10 @@ class AgentPoolUpgradeProfile(msrest.serialization.Model): :vartype name: str :ivar type: The type of the agent pool upgrade profile. :vartype type: str - :ivar kubernetes_version: Required. The Kubernetes version (major.minor.patch). + :ivar kubernetes_version: The Kubernetes version (major.minor.patch). Required. :vartype kubernetes_version: str - :ivar os_type: Required. The operating system type. The default is Linux. Known values are: - "Linux", "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -697,21 +688,21 @@ class AgentPoolUpgradeProfile(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kubernetes_version': {'required': True}, - 'os_type': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "kubernetes_version": {"required": True}, + "os_type": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'kubernetes_version': {'key': 'properties.kubernetesVersion', 'type': 'str'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'upgrades': {'key': 'properties.upgrades', 'type': '[AgentPoolUpgradeProfilePropertiesUpgradesItem]'}, - 'latest_node_image_version': {'key': 'properties.latestNodeImageVersion', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "os_type": {"key": "properties.osType", "type": "str"}, + "upgrades": {"key": "properties.upgrades", "type": "[AgentPoolUpgradeProfilePropertiesUpgradesItem]"}, + "latest_node_image_version": {"key": "properties.latestNodeImageVersion", "type": "str"}, } def __init__( @@ -724,10 +715,10 @@ def __init__( **kwargs ): """ - :keyword kubernetes_version: Required. The Kubernetes version (major.minor.patch). + :keyword kubernetes_version: The Kubernetes version (major.minor.patch). Required. :paramtype kubernetes_version: str - :keyword os_type: Required. The operating system type. The default is Linux. Known values are: - "Linux", "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: @@ -735,7 +726,7 @@ def __init__( :keyword latest_node_image_version: The latest AKS supported node image version. :paramtype latest_node_image_version: str """ - super(AgentPoolUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -745,7 +736,7 @@ def __init__( self.latest_node_image_version = latest_node_image_version -class AgentPoolUpgradeProfilePropertiesUpgradesItem(msrest.serialization.Model): +class AgentPoolUpgradeProfilePropertiesUpgradesItem(_serialization.Model): """AgentPoolUpgradeProfilePropertiesUpgradesItem. :ivar kubernetes_version: The Kubernetes version (major.minor.patch). @@ -755,29 +746,23 @@ class AgentPoolUpgradeProfilePropertiesUpgradesItem(msrest.serialization.Model): """ _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } - def __init__( - self, - *, - kubernetes_version: Optional[str] = None, - is_preview: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, kubernetes_version: Optional[str] = None, is_preview: Optional[bool] = None, **kwargs): """ :keyword kubernetes_version: The Kubernetes version (major.minor.patch). :paramtype kubernetes_version: str :keyword is_preview: Whether the Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(AgentPoolUpgradeProfilePropertiesUpgradesItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.is_preview = is_preview -class AgentPoolUpgradeSettings(msrest.serialization.Model): +class AgentPoolUpgradeSettings(_serialization.Model): """Settings for upgrading an agentpool. :ivar max_surge: This can either be set to an integer (e.g. '5') or a percentage (e.g. '50%'). @@ -789,15 +774,10 @@ class AgentPoolUpgradeSettings(msrest.serialization.Model): """ _attribute_map = { - 'max_surge': {'key': 'maxSurge', 'type': 'str'}, + "max_surge": {"key": "maxSurge", "type": "str"}, } - def __init__( - self, - *, - max_surge: Optional[str] = None, - **kwargs - ): + def __init__(self, *, max_surge: Optional[str] = None, **kwargs): """ :keyword max_surge: This can either be set to an integer (e.g. '5') or a percentage (e.g. '50%'). If a percentage is specified, it is the percentage of the total agent pool size at the @@ -806,11 +786,11 @@ def __init__( https://docs.microsoft.com/azure/aks/upgrade-cluster#customize-node-surge-upgrade. :paramtype max_surge: str """ - super(AgentPoolUpgradeSettings, self).__init__(**kwargs) + super().__init__(**kwargs) self.max_surge = max_surge -class AzureKeyVaultKms(msrest.serialization.Model): +class AzureKeyVaultKms(_serialization.Model): """Azure Key Vault key management service settings for the security profile. :ivar enabled: Whether to enable Azure Key Vault key management service. The default is false. @@ -824,17 +804,11 @@ class AzureKeyVaultKms(msrest.serialization.Model): """ _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'key_id': {'key': 'keyId', 'type': 'str'}, + "enabled": {"key": "enabled", "type": "bool"}, + "key_id": {"key": "keyId", "type": "str"}, } - def __init__( - self, - *, - enabled: Optional[bool] = None, - key_id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, enabled: Optional[bool] = None, key_id: Optional[str] = None, **kwargs): """ :keyword enabled: Whether to enable Azure Key Vault key management service. The default is false. @@ -846,12 +820,12 @@ def __init__( disabled, leave the field empty. :paramtype key_id: str """ - super(AzureKeyVaultKms, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.key_id = key_id -class CloudErrorBody(msrest.serialization.Model): +class CloudErrorBody(_serialization.Model): """An error response from the Container service. :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed @@ -868,10 +842,10 @@ class CloudErrorBody(msrest.serialization.Model): """ _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[CloudErrorBody]"}, } def __init__( @@ -897,88 +871,77 @@ def __init__( :paramtype details: list[~azure.mgmt.containerservice.v2022_04_02_preview.models.CloudErrorBody] """ - super(CloudErrorBody, self).__init__(**kwargs) + super().__init__(**kwargs) self.code = code self.message = message self.target = target self.details = details -class ContainerServiceDiagnosticsProfile(msrest.serialization.Model): +class ContainerServiceDiagnosticsProfile(_serialization.Model): """Profile for diagnostics on the container service cluster. All required parameters must be populated in order to send to Azure. - :ivar vm_diagnostics: Required. Profile for diagnostics on the container service VMs. + :ivar vm_diagnostics: Profile for diagnostics on the container service VMs. Required. :vartype vm_diagnostics: ~azure.mgmt.containerservice.v2022_04_02_preview.models.ContainerServiceVMDiagnostics """ _validation = { - 'vm_diagnostics': {'required': True}, + "vm_diagnostics": {"required": True}, } _attribute_map = { - 'vm_diagnostics': {'key': 'vmDiagnostics', 'type': 'ContainerServiceVMDiagnostics'}, + "vm_diagnostics": {"key": "vmDiagnostics", "type": "ContainerServiceVMDiagnostics"}, } - def __init__( - self, - *, - vm_diagnostics: "_models.ContainerServiceVMDiagnostics", - **kwargs - ): + def __init__(self, *, vm_diagnostics: "_models.ContainerServiceVMDiagnostics", **kwargs): """ - :keyword vm_diagnostics: Required. Profile for diagnostics on the container service VMs. + :keyword vm_diagnostics: Profile for diagnostics on the container service VMs. Required. :paramtype vm_diagnostics: ~azure.mgmt.containerservice.v2022_04_02_preview.models.ContainerServiceVMDiagnostics """ - super(ContainerServiceDiagnosticsProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.vm_diagnostics = vm_diagnostics -class ContainerServiceLinuxProfile(msrest.serialization.Model): +class ContainerServiceLinuxProfile(_serialization.Model): """Profile for Linux VMs in the container service cluster. All required parameters must be populated in order to send to Azure. - :ivar admin_username: Required. The administrator username to use for Linux VMs. + :ivar admin_username: The administrator username to use for Linux VMs. Required. :vartype admin_username: str - :ivar ssh: Required. The SSH configuration for Linux-based VMs running on Azure. + :ivar ssh: The SSH configuration for Linux-based VMs running on Azure. Required. :vartype ssh: ~azure.mgmt.containerservice.v2022_04_02_preview.models.ContainerServiceSshConfiguration """ _validation = { - 'admin_username': {'required': True, 'pattern': r'^[A-Za-z][-A-Za-z0-9_]*$'}, - 'ssh': {'required': True}, + "admin_username": {"required": True, "pattern": r"^[A-Za-z][-A-Za-z0-9_]*$"}, + "ssh": {"required": True}, } _attribute_map = { - 'admin_username': {'key': 'adminUsername', 'type': 'str'}, - 'ssh': {'key': 'ssh', 'type': 'ContainerServiceSshConfiguration'}, + "admin_username": {"key": "adminUsername", "type": "str"}, + "ssh": {"key": "ssh", "type": "ContainerServiceSshConfiguration"}, } - def __init__( - self, - *, - admin_username: str, - ssh: "_models.ContainerServiceSshConfiguration", - **kwargs - ): + def __init__(self, *, admin_username: str, ssh: "_models.ContainerServiceSshConfiguration", **kwargs): """ - :keyword admin_username: Required. The administrator username to use for Linux VMs. + :keyword admin_username: The administrator username to use for Linux VMs. Required. :paramtype admin_username: str - :keyword ssh: Required. The SSH configuration for Linux-based VMs running on Azure. + :keyword ssh: The SSH configuration for Linux-based VMs running on Azure. Required. :paramtype ssh: ~azure.mgmt.containerservice.v2022_04_02_preview.models.ContainerServiceSshConfiguration """ - super(ContainerServiceLinuxProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.admin_username = admin_username self.ssh = ssh -class ContainerServiceMasterProfile(msrest.serialization.Model): +class ContainerServiceMasterProfile(_serialization.Model): """Profile for the container service master. Variables are only populated by the server, and will be ignored when sending a request. @@ -986,11 +949,11 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar count: Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, - and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". + and 5. The default value is 1. Known values are: 1, 3, and 5. :vartype count: int or ~azure.mgmt.containerservice.v2022_04_02_preview.models.Count - :ivar dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. + :ivar dns_prefix: DNS prefix to be used to create the FQDN for the master pool. Required. :vartype dns_prefix: str - :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + :ivar vm_size: Size of agent VMs. Required. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -1027,7 +990,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :vartype vm_size: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.ContainerServiceVMSizeTypes :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine @@ -1041,7 +1004,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): :vartype first_consecutive_static_ip: str :ivar storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount" and "ManagedDisks". :vartype storage_profile: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.ContainerServiceStorageProfileTypes :ivar fqdn: FQDN for the master pool. @@ -1049,21 +1012,21 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): """ _validation = { - 'dns_prefix': {'required': True}, - 'vm_size': {'required': True}, - 'os_disk_size_gb': {'maximum': 2048, 'minimum': 0}, - 'fqdn': {'readonly': True}, + "dns_prefix": {"required": True}, + "vm_size": {"required": True}, + "os_disk_size_gb": {"maximum": 2048, "minimum": 0}, + "fqdn": {"readonly": True}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'dns_prefix': {'key': 'dnsPrefix', 'type': 'str'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'first_consecutive_static_ip': {'key': 'firstConsecutiveStaticIP', 'type': 'str'}, - 'storage_profile': {'key': 'storageProfile', 'type': 'str'}, - 'fqdn': {'key': 'fqdn', 'type': 'str'}, + "count": {"key": "count", "type": "int"}, + "dns_prefix": {"key": "dnsPrefix", "type": "str"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "first_consecutive_static_ip": {"key": "firstConsecutiveStaticIP", "type": "str"}, + "storage_profile": {"key": "storageProfile", "type": "str"}, + "fqdn": {"key": "fqdn", "type": "str"}, } def __init__( @@ -1071,20 +1034,20 @@ def __init__( *, dns_prefix: str, vm_size: Union[str, "_models.ContainerServiceVMSizeTypes"], - count: Optional[Union[int, "_models.Count"]] = 1, + count: Union[int, "_models.Count"] = 1, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, - first_consecutive_static_ip: Optional[str] = "10.240.255.5", + first_consecutive_static_ip: str = "10.240.255.5", storage_profile: Optional[Union[str, "_models.ContainerServiceStorageProfileTypes"]] = None, **kwargs ): """ :keyword count: Number of masters (VMs) in the container service cluster. Allowed values are 1, - 3, and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". + 3, and 5. The default value is 1. Known values are: 1, 3, and 5. :paramtype count: int or ~azure.mgmt.containerservice.v2022_04_02_preview.models.Count - :keyword dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. + :keyword dns_prefix: DNS prefix to be used to create the FQDN for the master pool. Required. :paramtype dns_prefix: str - :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + :keyword vm_size: Size of agent VMs. Required. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -1121,7 +1084,7 @@ def __init__( "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :paramtype vm_size: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.ContainerServiceVMSizeTypes :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every @@ -1135,11 +1098,11 @@ def __init__( :paramtype first_consecutive_static_ip: str :keyword storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount" and "ManagedDisks". :paramtype storage_profile: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.ContainerServiceStorageProfileTypes """ - super(ContainerServiceMasterProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.dns_prefix = dns_prefix self.vm_size = vm_size @@ -1150,23 +1113,23 @@ def __init__( self.fqdn = None -class ContainerServiceNetworkProfile(msrest.serialization.Model): +class ContainerServiceNetworkProfile(_serialization.Model): # pylint: disable=too-many-instance-attributes """Profile of network configuration. :ivar network_plugin: Network plugin used for building the Kubernetes network. Known values - are: "azure", "kubenet", "none". Default value: "kubenet". + are: "azure", "kubenet", and "none". :vartype network_plugin: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.NetworkPlugin - :ivar network_plugin_mode: Network plugin mode used for building the Kubernetes network. Known - values are: "Overlay". + :ivar network_plugin_mode: Network plugin mode used for building the Kubernetes network. + "Overlay" :vartype network_plugin_mode: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.NetworkPluginMode :ivar network_policy: Network policy used for building the Kubernetes network. Known values - are: "calico", "azure". + are: "calico" and "azure". :vartype network_policy: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.NetworkPolicy :ivar network_mode: This cannot be specified if networkPlugin is anything other than 'azure'. - Known values are: "transparent", "bridge". + Known values are: "transparent" and "bridge". :vartype network_mode: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.NetworkMode :ivar pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. @@ -1183,13 +1146,12 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): :ivar outbound_type: This can only be set at cluster creation time and cannot be changed later. For more information see `egress outbound type `_. Known values are: "loadBalancer", - "userDefinedRouting", "managedNATGateway", "userAssignedNATGateway". Default value: - "loadBalancer". + "userDefinedRouting", "managedNATGateway", and "userAssignedNATGateway". :vartype outbound_type: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.OutboundType :ivar load_balancer_sku: The default is 'standard'. See `Azure Load Balancer SKUs `_ for more information about the - differences between load balancer SKUs. Known values are: "standard", "basic". + differences between load balancer SKUs. Known values are: "standard" and "basic". :vartype load_balancer_sku: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.LoadBalancerSku :ivar load_balancer_profile: Profile of the cluster load balancer. @@ -1213,42 +1175,44 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): """ _validation = { - 'pod_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, - 'service_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, - 'dns_service_ip': {'pattern': r'^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$'}, - 'docker_bridge_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, + "pod_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, + "service_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, + "dns_service_ip": { + "pattern": r"^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$" + }, + "docker_bridge_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, } _attribute_map = { - 'network_plugin': {'key': 'networkPlugin', 'type': 'str'}, - 'network_plugin_mode': {'key': 'networkPluginMode', 'type': 'str'}, - 'network_policy': {'key': 'networkPolicy', 'type': 'str'}, - 'network_mode': {'key': 'networkMode', 'type': 'str'}, - 'pod_cidr': {'key': 'podCidr', 'type': 'str'}, - 'service_cidr': {'key': 'serviceCidr', 'type': 'str'}, - 'dns_service_ip': {'key': 'dnsServiceIP', 'type': 'str'}, - 'docker_bridge_cidr': {'key': 'dockerBridgeCidr', 'type': 'str'}, - 'outbound_type': {'key': 'outboundType', 'type': 'str'}, - 'load_balancer_sku': {'key': 'loadBalancerSku', 'type': 'str'}, - 'load_balancer_profile': {'key': 'loadBalancerProfile', 'type': 'ManagedClusterLoadBalancerProfile'}, - 'nat_gateway_profile': {'key': 'natGatewayProfile', 'type': 'ManagedClusterNATGatewayProfile'}, - 'pod_cidrs': {'key': 'podCidrs', 'type': '[str]'}, - 'service_cidrs': {'key': 'serviceCidrs', 'type': '[str]'}, - 'ip_families': {'key': 'ipFamilies', 'type': '[str]'}, + "network_plugin": {"key": "networkPlugin", "type": "str"}, + "network_plugin_mode": {"key": "networkPluginMode", "type": "str"}, + "network_policy": {"key": "networkPolicy", "type": "str"}, + "network_mode": {"key": "networkMode", "type": "str"}, + "pod_cidr": {"key": "podCidr", "type": "str"}, + "service_cidr": {"key": "serviceCidr", "type": "str"}, + "dns_service_ip": {"key": "dnsServiceIP", "type": "str"}, + "docker_bridge_cidr": {"key": "dockerBridgeCidr", "type": "str"}, + "outbound_type": {"key": "outboundType", "type": "str"}, + "load_balancer_sku": {"key": "loadBalancerSku", "type": "str"}, + "load_balancer_profile": {"key": "loadBalancerProfile", "type": "ManagedClusterLoadBalancerProfile"}, + "nat_gateway_profile": {"key": "natGatewayProfile", "type": "ManagedClusterNATGatewayProfile"}, + "pod_cidrs": {"key": "podCidrs", "type": "[str]"}, + "service_cidrs": {"key": "serviceCidrs", "type": "[str]"}, + "ip_families": {"key": "ipFamilies", "type": "[str]"}, } def __init__( self, *, - network_plugin: Optional[Union[str, "_models.NetworkPlugin"]] = "kubenet", + network_plugin: Union[str, "_models.NetworkPlugin"] = "kubenet", network_plugin_mode: Optional[Union[str, "_models.NetworkPluginMode"]] = None, network_policy: Optional[Union[str, "_models.NetworkPolicy"]] = None, network_mode: Optional[Union[str, "_models.NetworkMode"]] = None, - pod_cidr: Optional[str] = "10.244.0.0/16", - service_cidr: Optional[str] = "10.0.0.0/16", - dns_service_ip: Optional[str] = "10.0.0.10", - docker_bridge_cidr: Optional[str] = "172.17.0.1/16", - outbound_type: Optional[Union[str, "_models.OutboundType"]] = "loadBalancer", + pod_cidr: str = "10.244.0.0/16", + service_cidr: str = "10.0.0.0/16", + dns_service_ip: str = "10.0.0.10", + docker_bridge_cidr: str = "172.17.0.1/16", + outbound_type: Union[str, "_models.OutboundType"] = "loadBalancer", load_balancer_sku: Optional[Union[str, "_models.LoadBalancerSku"]] = None, load_balancer_profile: Optional["_models.ManagedClusterLoadBalancerProfile"] = None, nat_gateway_profile: Optional["_models.ManagedClusterNATGatewayProfile"] = None, @@ -1259,19 +1223,19 @@ def __init__( ): """ :keyword network_plugin: Network plugin used for building the Kubernetes network. Known values - are: "azure", "kubenet", "none". Default value: "kubenet". + are: "azure", "kubenet", and "none". :paramtype network_plugin: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.NetworkPlugin :keyword network_plugin_mode: Network plugin mode used for building the Kubernetes network. - Known values are: "Overlay". + "Overlay" :paramtype network_plugin_mode: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.NetworkPluginMode :keyword network_policy: Network policy used for building the Kubernetes network. Known values - are: "calico", "azure". + are: "calico" and "azure". :paramtype network_policy: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.NetworkPolicy :keyword network_mode: This cannot be specified if networkPlugin is anything other than - 'azure'. Known values are: "transparent", "bridge". + 'azure'. Known values are: "transparent" and "bridge". :paramtype network_mode: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.NetworkMode :keyword pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. @@ -1288,13 +1252,12 @@ def __init__( :keyword outbound_type: This can only be set at cluster creation time and cannot be changed later. For more information see `egress outbound type `_. Known values are: "loadBalancer", - "userDefinedRouting", "managedNATGateway", "userAssignedNATGateway". Default value: - "loadBalancer". + "userDefinedRouting", "managedNATGateway", and "userAssignedNATGateway". :paramtype outbound_type: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.OutboundType :keyword load_balancer_sku: The default is 'standard'. See `Azure Load Balancer SKUs `_ for more information about the - differences between load balancer SKUs. Known values are: "standard", "basic". + differences between load balancer SKUs. Known values are: "standard" and "basic". :paramtype load_balancer_sku: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.LoadBalancerSku :keyword load_balancer_profile: Profile of the cluster load balancer. @@ -1316,7 +1279,7 @@ def __init__( :paramtype ip_families: list[str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.IpFamily] """ - super(ContainerServiceNetworkProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.network_plugin = network_plugin self.network_plugin_mode = network_plugin_mode self.network_policy = network_policy @@ -1334,113 +1297,98 @@ def __init__( self.ip_families = ip_families -class ContainerServiceSshConfiguration(msrest.serialization.Model): +class ContainerServiceSshConfiguration(_serialization.Model): """SSH configuration for Linux-based VMs running on Azure. All required parameters must be populated in order to send to Azure. - :ivar public_keys: Required. The list of SSH public keys used to authenticate with Linux-based - VMs. A maximum of 1 key may be specified. + :ivar public_keys: The list of SSH public keys used to authenticate with Linux-based VMs. A + maximum of 1 key may be specified. Required. :vartype public_keys: list[~azure.mgmt.containerservice.v2022_04_02_preview.models.ContainerServiceSshPublicKey] """ _validation = { - 'public_keys': {'required': True}, + "public_keys": {"required": True}, } _attribute_map = { - 'public_keys': {'key': 'publicKeys', 'type': '[ContainerServiceSshPublicKey]'}, + "public_keys": {"key": "publicKeys", "type": "[ContainerServiceSshPublicKey]"}, } - def __init__( - self, - *, - public_keys: List["_models.ContainerServiceSshPublicKey"], - **kwargs - ): + def __init__(self, *, public_keys: List["_models.ContainerServiceSshPublicKey"], **kwargs): """ - :keyword public_keys: Required. The list of SSH public keys used to authenticate with - Linux-based VMs. A maximum of 1 key may be specified. + :keyword public_keys: The list of SSH public keys used to authenticate with Linux-based VMs. A + maximum of 1 key may be specified. Required. :paramtype public_keys: list[~azure.mgmt.containerservice.v2022_04_02_preview.models.ContainerServiceSshPublicKey] """ - super(ContainerServiceSshConfiguration, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_keys = public_keys -class ContainerServiceSshPublicKey(msrest.serialization.Model): +class ContainerServiceSshPublicKey(_serialization.Model): """Contains information about SSH certificate public key data. All required parameters must be populated in order to send to Azure. - :ivar key_data: Required. Certificate public key used to authenticate with VMs through SSH. The - certificate must be in PEM format with or without headers. + :ivar key_data: Certificate public key used to authenticate with VMs through SSH. The + certificate must be in PEM format with or without headers. Required. :vartype key_data: str """ _validation = { - 'key_data': {'required': True}, + "key_data": {"required": True}, } _attribute_map = { - 'key_data': {'key': 'keyData', 'type': 'str'}, + "key_data": {"key": "keyData", "type": "str"}, } - def __init__( - self, - *, - key_data: str, - **kwargs - ): + def __init__(self, *, key_data: str, **kwargs): """ - :keyword key_data: Required. Certificate public key used to authenticate with VMs through SSH. - The certificate must be in PEM format with or without headers. + :keyword key_data: Certificate public key used to authenticate with VMs through SSH. The + certificate must be in PEM format with or without headers. Required. :paramtype key_data: str """ - super(ContainerServiceSshPublicKey, self).__init__(**kwargs) + super().__init__(**kwargs) self.key_data = key_data -class ContainerServiceVMDiagnostics(msrest.serialization.Model): +class ContainerServiceVMDiagnostics(_serialization.Model): """Profile for diagnostics on the container service VMs. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar enabled: Required. Whether the VM diagnostic agent is provisioned on the VM. + :ivar enabled: Whether the VM diagnostic agent is provisioned on the VM. Required. :vartype enabled: bool :ivar storage_uri: The URI of the storage account where diagnostics are stored. :vartype storage_uri: str """ _validation = { - 'enabled': {'required': True}, - 'storage_uri': {'readonly': True}, + "enabled": {"required": True}, + "storage_uri": {"readonly": True}, } _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'storage_uri': {'key': 'storageUri', 'type': 'str'}, + "enabled": {"key": "enabled", "type": "bool"}, + "storage_uri": {"key": "storageUri", "type": "str"}, } - def __init__( - self, - *, - enabled: bool, - **kwargs - ): + def __init__(self, *, enabled: bool, **kwargs): """ - :keyword enabled: Required. Whether the VM diagnostic agent is provisioned on the VM. + :keyword enabled: Whether the VM diagnostic agent is provisioned on the VM. Required. :paramtype enabled: bool """ - super(ContainerServiceVMDiagnostics, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.storage_uri = None -class CreationData(msrest.serialization.Model): +class CreationData(_serialization.Model): """Data used when creating a target resource from a source resource. :ivar source_resource_id: This is the ARM ID of the source object to be used to create the @@ -1449,25 +1397,20 @@ class CreationData(msrest.serialization.Model): """ _attribute_map = { - 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, + "source_resource_id": {"key": "sourceResourceId", "type": "str"}, } - def __init__( - self, - *, - source_resource_id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, source_resource_id: Optional[str] = None, **kwargs): """ :keyword source_resource_id: This is the ARM ID of the source object to be used to create the target object. :paramtype source_resource_id: str """ - super(CreationData, self).__init__(**kwargs) + super().__init__(**kwargs) self.source_resource_id = source_resource_id -class CredentialResult(msrest.serialization.Model): +class CredentialResult(_serialization.Model): """The credential result response. Variables are only populated by the server, and will be ignored when sending a request. @@ -1475,31 +1418,27 @@ class CredentialResult(msrest.serialization.Model): :ivar name: The name of the credential. :vartype name: str :ivar value: Base64-encoded Kubernetes configuration file. - :vartype value: bytearray + :vartype value: bytes """ _validation = { - 'name': {'readonly': True}, - 'value': {'readonly': True}, + "name": {"readonly": True}, + "value": {"readonly": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'bytearray'}, + "name": {"key": "name", "type": "str"}, + "value": {"key": "value", "type": "bytearray"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(CredentialResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.name = None self.value = None -class CredentialResults(msrest.serialization.Model): +class CredentialResults(_serialization.Model): """The list credential result response. Variables are only populated by the server, and will be ignored when sending a request. @@ -1510,24 +1449,20 @@ class CredentialResults(msrest.serialization.Model): """ _validation = { - 'kubeconfigs': {'readonly': True}, + "kubeconfigs": {"readonly": True}, } _attribute_map = { - 'kubeconfigs': {'key': 'kubeconfigs', 'type': '[CredentialResult]'}, + "kubeconfigs": {"key": "kubeconfigs", "type": "[CredentialResult]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(CredentialResults, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.kubeconfigs = None -class EndpointDependency(msrest.serialization.Model): +class EndpointDependency(_serialization.Model): """A domain name that AKS agent nodes are reaching at. :ivar domain_name: The domain name of the dependency. @@ -1538,8 +1473,8 @@ class EndpointDependency(msrest.serialization.Model): """ _attribute_map = { - 'domain_name': {'key': 'domainName', 'type': 'str'}, - 'endpoint_details': {'key': 'endpointDetails', 'type': '[EndpointDetail]'}, + "domain_name": {"key": "domainName", "type": "str"}, + "endpoint_details": {"key": "endpointDetails", "type": "[EndpointDetail]"}, } def __init__( @@ -1556,12 +1491,12 @@ def __init__( :paramtype endpoint_details: list[~azure.mgmt.containerservice.v2022_04_02_preview.models.EndpointDetail] """ - super(EndpointDependency, self).__init__(**kwargs) + super().__init__(**kwargs) self.domain_name = domain_name self.endpoint_details = endpoint_details -class EndpointDetail(msrest.serialization.Model): +class EndpointDetail(_serialization.Model): """connect information from the AKS agent nodes to a single endpoint. :ivar ip_address: An IP Address that Domain Name currently resolves to. @@ -1575,10 +1510,10 @@ class EndpointDetail(msrest.serialization.Model): """ _attribute_map = { - 'ip_address': {'key': 'ipAddress', 'type': 'str'}, - 'port': {'key': 'port', 'type': 'int'}, - 'protocol': {'key': 'protocol', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, + "ip_address": {"key": "ipAddress", "type": "str"}, + "port": {"key": "port", "type": "int"}, + "protocol": {"key": "protocol", "type": "str"}, + "description": {"key": "description", "type": "str"}, } def __init__( @@ -1600,26 +1535,26 @@ def __init__( :keyword description: Description of the detail. :paramtype description: str """ - super(EndpointDetail, self).__init__(**kwargs) + super().__init__(**kwargs) self.ip_address = ip_address self.port = port self.protocol = protocol self.description = description -class ExtendedLocation(msrest.serialization.Model): +class ExtendedLocation(_serialization.Model): """The complex type of the extended location. :ivar name: The name of the extended location. :vartype name: str - :ivar type: The type of the extended location. Known values are: "EdgeZone". + :ivar type: The type of the extended location. "EdgeZone" :vartype type: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.ExtendedLocationTypes """ _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, } def __init__( @@ -1632,16 +1567,16 @@ def __init__( """ :keyword name: The name of the extended location. :paramtype name: str - :keyword type: The type of the extended location. Known values are: "EdgeZone". + :keyword type: The type of the extended location. "EdgeZone" :paramtype type: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.ExtendedLocationTypes """ - super(ExtendedLocation, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.type = type -class KubeletConfig(msrest.serialization.Model): +class KubeletConfig(_serialization.Model): # pylint: disable=too-many-instance-attributes """See `AKS custom node configuration `_ for more details. :ivar cpu_manager_policy: The default is 'none'. See `Kubernetes CPU management policies @@ -1681,21 +1616,21 @@ class KubeletConfig(msrest.serialization.Model): """ _validation = { - 'container_log_max_files': {'minimum': 2}, + "container_log_max_files": {"minimum": 2}, } _attribute_map = { - 'cpu_manager_policy': {'key': 'cpuManagerPolicy', 'type': 'str'}, - 'cpu_cfs_quota': {'key': 'cpuCfsQuota', 'type': 'bool'}, - 'cpu_cfs_quota_period': {'key': 'cpuCfsQuotaPeriod', 'type': 'str'}, - 'image_gc_high_threshold': {'key': 'imageGcHighThreshold', 'type': 'int'}, - 'image_gc_low_threshold': {'key': 'imageGcLowThreshold', 'type': 'int'}, - 'topology_manager_policy': {'key': 'topologyManagerPolicy', 'type': 'str'}, - 'allowed_unsafe_sysctls': {'key': 'allowedUnsafeSysctls', 'type': '[str]'}, - 'fail_swap_on': {'key': 'failSwapOn', 'type': 'bool'}, - 'container_log_max_size_mb': {'key': 'containerLogMaxSizeMB', 'type': 'int'}, - 'container_log_max_files': {'key': 'containerLogMaxFiles', 'type': 'int'}, - 'pod_max_pids': {'key': 'podMaxPids', 'type': 'int'}, + "cpu_manager_policy": {"key": "cpuManagerPolicy", "type": "str"}, + "cpu_cfs_quota": {"key": "cpuCfsQuota", "type": "bool"}, + "cpu_cfs_quota_period": {"key": "cpuCfsQuotaPeriod", "type": "str"}, + "image_gc_high_threshold": {"key": "imageGcHighThreshold", "type": "int"}, + "image_gc_low_threshold": {"key": "imageGcLowThreshold", "type": "int"}, + "topology_manager_policy": {"key": "topologyManagerPolicy", "type": "str"}, + "allowed_unsafe_sysctls": {"key": "allowedUnsafeSysctls", "type": "[str]"}, + "fail_swap_on": {"key": "failSwapOn", "type": "bool"}, + "container_log_max_size_mb": {"key": "containerLogMaxSizeMB", "type": "int"}, + "container_log_max_files": {"key": "containerLogMaxFiles", "type": "int"}, + "pod_max_pids": {"key": "podMaxPids", "type": "int"}, } def __init__( @@ -1750,7 +1685,7 @@ def __init__( :keyword pod_max_pids: The maximum number of processes per pod. :paramtype pod_max_pids: int """ - super(KubeletConfig, self).__init__(**kwargs) + super().__init__(**kwargs) self.cpu_manager_policy = cpu_manager_policy self.cpu_cfs_quota = cpu_cfs_quota self.cpu_cfs_quota_period = cpu_cfs_quota_period @@ -1764,7 +1699,7 @@ def __init__( self.pod_max_pids = pod_max_pids -class LinuxOSConfig(msrest.serialization.Model): +class LinuxOSConfig(_serialization.Model): """See `AKS custom node configuration `_ for more details. :ivar sysctls: Sysctl settings for Linux agent nodes. @@ -1783,10 +1718,10 @@ class LinuxOSConfig(msrest.serialization.Model): """ _attribute_map = { - 'sysctls': {'key': 'sysctls', 'type': 'SysctlConfig'}, - 'transparent_huge_page_enabled': {'key': 'transparentHugePageEnabled', 'type': 'str'}, - 'transparent_huge_page_defrag': {'key': 'transparentHugePageDefrag', 'type': 'str'}, - 'swap_file_size_mb': {'key': 'swapFileSizeMB', 'type': 'int'}, + "sysctls": {"key": "sysctls", "type": "SysctlConfig"}, + "transparent_huge_page_enabled": {"key": "transparentHugePageEnabled", "type": "str"}, + "transparent_huge_page_defrag": {"key": "transparentHugePageDefrag", "type": "str"}, + "swap_file_size_mb": {"key": "swapFileSizeMB", "type": "int"}, } def __init__( @@ -1813,7 +1748,7 @@ def __init__( :keyword swap_file_size_mb: The size in MB of a swap file that will be created on each node. :paramtype swap_file_size_mb: int """ - super(LinuxOSConfig, self).__init__(**kwargs) + super().__init__(**kwargs) self.sysctls = sysctls self.transparent_huge_page_enabled = transparent_huge_page_enabled self.transparent_huge_page_defrag = transparent_huge_page_defrag @@ -1843,19 +1778,19 @@ class MaintenanceConfiguration(SubResource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, + "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'}, - 'time_in_week': {'key': 'properties.timeInWeek', 'type': '[TimeInWeek]'}, - 'not_allowed_time': {'key': 'properties.notAllowedTime', 'type': '[TimeSpan]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "time_in_week": {"key": "properties.timeInWeek", "type": "[TimeInWeek]"}, + "not_allowed_time": {"key": "properties.notAllowedTime", "type": "[TimeSpan]"}, } def __init__( @@ -1874,13 +1809,13 @@ def __init__( :paramtype not_allowed_time: list[~azure.mgmt.containerservice.v2022_04_02_preview.models.TimeSpan] """ - super(MaintenanceConfiguration, self).__init__(**kwargs) + super().__init__(**kwargs) self.system_data = None self.time_in_week = time_in_week self.not_allowed_time = not_allowed_time -class MaintenanceConfigurationListResult(msrest.serialization.Model): +class MaintenanceConfigurationListResult(_serialization.Model): """The response from the List maintenance configurations operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -1893,31 +1828,26 @@ class MaintenanceConfigurationListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[MaintenanceConfiguration]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[MaintenanceConfiguration]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.MaintenanceConfiguration"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.MaintenanceConfiguration"]] = None, **kwargs): """ :keyword value: The list of maintenance configurations. :paramtype value: list[~azure.mgmt.containerservice.v2022_04_02_preview.models.MaintenanceConfiguration] """ - super(MaintenanceConfigurationListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class Resource(msrest.serialization.Model): +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. @@ -1936,26 +1866,22 @@ class Resource(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, + "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'}, + "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 - ): - """ - """ - super(Resource, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -1980,48 +1906,42 @@ class TrackedResource(Resource): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.containerservice.v2022_04_02_preview.models.SystemData - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] - :ivar location: Required. The geo-location where the resource lives. + :ivar location: The geo-location where the resource lives. Required. :vartype location: str """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'location': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, } - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] - :keyword location: Required. The geo-location where the resource lives. + :keyword location: The geo-location where the resource lives. Required. :paramtype location: str """ - super(TrackedResource, self).__init__(**kwargs) + super().__init__(**kwargs) self.tags = tags self.location = location -class ManagedCluster(TrackedResource): +class ManagedCluster(TrackedResource): # pylint: disable=too-many-instance-attributes """Managed cluster. Variables are only populated by the server, and will be ignored when sending a request. @@ -2039,9 +1959,9 @@ class ManagedCluster(TrackedResource): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.containerservice.v2022_04_02_preview.models.SystemData - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] - :ivar location: Required. The geo-location where the resource lives. + :ivar location: The geo-location where the resource lives. Required. :vartype location: str :ivar sku: The managed cluster SKU. :vartype sku: ~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedClusterSKU @@ -2158,75 +2078,84 @@ class ManagedCluster(TrackedResource): :vartype ingress_profile: ~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedClusterIngressProfile :ivar public_network_access: Allow or deny public network access for AKS. Known values are: - "Enabled", "Disabled". + "Enabled" and "Disabled". :vartype public_network_access: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.PublicNetworkAccess """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'location': {'required': True}, - 'provisioning_state': {'readonly': True}, - 'power_state': {'readonly': True}, - 'max_agent_pools': {'readonly': True}, - 'current_kubernetes_version': {'readonly': True}, - 'fqdn': {'readonly': True}, - 'private_fqdn': {'readonly': True}, - 'azure_portal_fqdn': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, + "provisioning_state": {"readonly": True}, + "power_state": {"readonly": True}, + "max_agent_pools": {"readonly": True}, + "current_kubernetes_version": {"readonly": True}, + "fqdn": {"readonly": True}, + "private_fqdn": {"readonly": True}, + "azure_portal_fqdn": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'ManagedClusterSKU'}, - 'extended_location': {'key': 'extendedLocation', 'type': 'ExtendedLocation'}, - 'identity': {'key': 'identity', 'type': 'ManagedClusterIdentity'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'power_state': {'key': 'properties.powerState', 'type': 'PowerState'}, - 'creation_data': {'key': 'properties.creationData', 'type': 'CreationData'}, - 'max_agent_pools': {'key': 'properties.maxAgentPools', 'type': 'int'}, - 'kubernetes_version': {'key': 'properties.kubernetesVersion', 'type': 'str'}, - 'current_kubernetes_version': {'key': 'properties.currentKubernetesVersion', 'type': 'str'}, - 'dns_prefix': {'key': 'properties.dnsPrefix', 'type': 'str'}, - 'fqdn_subdomain': {'key': 'properties.fqdnSubdomain', 'type': 'str'}, - 'fqdn': {'key': 'properties.fqdn', 'type': 'str'}, - 'private_fqdn': {'key': 'properties.privateFQDN', 'type': 'str'}, - 'azure_portal_fqdn': {'key': 'properties.azurePortalFQDN', 'type': 'str'}, - 'agent_pool_profiles': {'key': 'properties.agentPoolProfiles', 'type': '[ManagedClusterAgentPoolProfile]'}, - 'linux_profile': {'key': 'properties.linuxProfile', 'type': 'ContainerServiceLinuxProfile'}, - 'windows_profile': {'key': 'properties.windowsProfile', 'type': 'ManagedClusterWindowsProfile'}, - 'service_principal_profile': {'key': 'properties.servicePrincipalProfile', 'type': 'ManagedClusterServicePrincipalProfile'}, - 'addon_profiles': {'key': 'properties.addonProfiles', 'type': '{ManagedClusterAddonProfile}'}, - 'pod_identity_profile': {'key': 'properties.podIdentityProfile', 'type': 'ManagedClusterPodIdentityProfile'}, - 'oidc_issuer_profile': {'key': 'properties.oidcIssuerProfile', 'type': 'ManagedClusterOIDCIssuerProfile'}, - 'node_resource_group': {'key': 'properties.nodeResourceGroup', 'type': 'str'}, - 'enable_rbac': {'key': 'properties.enableRBAC', 'type': 'bool'}, - 'enable_pod_security_policy': {'key': 'properties.enablePodSecurityPolicy', 'type': 'bool'}, - 'enable_namespace_resources': {'key': 'properties.enableNamespaceResources', 'type': 'bool'}, - 'network_profile': {'key': 'properties.networkProfile', 'type': 'ContainerServiceNetworkProfile'}, - 'aad_profile': {'key': 'properties.aadProfile', 'type': 'ManagedClusterAADProfile'}, - 'auto_upgrade_profile': {'key': 'properties.autoUpgradeProfile', 'type': 'ManagedClusterAutoUpgradeProfile'}, - 'auto_scaler_profile': {'key': 'properties.autoScalerProfile', 'type': 'ManagedClusterPropertiesAutoScalerProfile'}, - 'api_server_access_profile': {'key': 'properties.apiServerAccessProfile', 'type': 'ManagedClusterAPIServerAccessProfile'}, - 'disk_encryption_set_id': {'key': 'properties.diskEncryptionSetID', 'type': 'str'}, - 'identity_profile': {'key': 'properties.identityProfile', 'type': '{UserAssignedIdentity}'}, - 'private_link_resources': {'key': 'properties.privateLinkResources', 'type': '[PrivateLinkResource]'}, - 'disable_local_accounts': {'key': 'properties.disableLocalAccounts', 'type': 'bool'}, - 'http_proxy_config': {'key': 'properties.httpProxyConfig', 'type': 'ManagedClusterHTTPProxyConfig'}, - 'security_profile': {'key': 'properties.securityProfile', 'type': 'ManagedClusterSecurityProfile'}, - 'storage_profile': {'key': 'properties.storageProfile', 'type': 'ManagedClusterStorageProfile'}, - 'ingress_profile': {'key': 'properties.ingressProfile', 'type': 'ManagedClusterIngressProfile'}, - 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, - } - - def __init__( + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "sku": {"key": "sku", "type": "ManagedClusterSKU"}, + "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, + "identity": {"key": "identity", "type": "ManagedClusterIdentity"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "power_state": {"key": "properties.powerState", "type": "PowerState"}, + "creation_data": {"key": "properties.creationData", "type": "CreationData"}, + "max_agent_pools": {"key": "properties.maxAgentPools", "type": "int"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "current_kubernetes_version": {"key": "properties.currentKubernetesVersion", "type": "str"}, + "dns_prefix": {"key": "properties.dnsPrefix", "type": "str"}, + "fqdn_subdomain": {"key": "properties.fqdnSubdomain", "type": "str"}, + "fqdn": {"key": "properties.fqdn", "type": "str"}, + "private_fqdn": {"key": "properties.privateFQDN", "type": "str"}, + "azure_portal_fqdn": {"key": "properties.azurePortalFQDN", "type": "str"}, + "agent_pool_profiles": {"key": "properties.agentPoolProfiles", "type": "[ManagedClusterAgentPoolProfile]"}, + "linux_profile": {"key": "properties.linuxProfile", "type": "ContainerServiceLinuxProfile"}, + "windows_profile": {"key": "properties.windowsProfile", "type": "ManagedClusterWindowsProfile"}, + "service_principal_profile": { + "key": "properties.servicePrincipalProfile", + "type": "ManagedClusterServicePrincipalProfile", + }, + "addon_profiles": {"key": "properties.addonProfiles", "type": "{ManagedClusterAddonProfile}"}, + "pod_identity_profile": {"key": "properties.podIdentityProfile", "type": "ManagedClusterPodIdentityProfile"}, + "oidc_issuer_profile": {"key": "properties.oidcIssuerProfile", "type": "ManagedClusterOIDCIssuerProfile"}, + "node_resource_group": {"key": "properties.nodeResourceGroup", "type": "str"}, + "enable_rbac": {"key": "properties.enableRBAC", "type": "bool"}, + "enable_pod_security_policy": {"key": "properties.enablePodSecurityPolicy", "type": "bool"}, + "enable_namespace_resources": {"key": "properties.enableNamespaceResources", "type": "bool"}, + "network_profile": {"key": "properties.networkProfile", "type": "ContainerServiceNetworkProfile"}, + "aad_profile": {"key": "properties.aadProfile", "type": "ManagedClusterAADProfile"}, + "auto_upgrade_profile": {"key": "properties.autoUpgradeProfile", "type": "ManagedClusterAutoUpgradeProfile"}, + "auto_scaler_profile": { + "key": "properties.autoScalerProfile", + "type": "ManagedClusterPropertiesAutoScalerProfile", + }, + "api_server_access_profile": { + "key": "properties.apiServerAccessProfile", + "type": "ManagedClusterAPIServerAccessProfile", + }, + "disk_encryption_set_id": {"key": "properties.diskEncryptionSetID", "type": "str"}, + "identity_profile": {"key": "properties.identityProfile", "type": "{UserAssignedIdentity}"}, + "private_link_resources": {"key": "properties.privateLinkResources", "type": "[PrivateLinkResource]"}, + "disable_local_accounts": {"key": "properties.disableLocalAccounts", "type": "bool"}, + "http_proxy_config": {"key": "properties.httpProxyConfig", "type": "ManagedClusterHTTPProxyConfig"}, + "security_profile": {"key": "properties.securityProfile", "type": "ManagedClusterSecurityProfile"}, + "storage_profile": {"key": "properties.storageProfile", "type": "ManagedClusterStorageProfile"}, + "ingress_profile": {"key": "properties.ingressProfile", "type": "ManagedClusterIngressProfile"}, + "public_network_access": {"key": "properties.publicNetworkAccess", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, location: str, @@ -2266,9 +2195,9 @@ def __init__( **kwargs ): """ - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] - :keyword location: Required. The geo-location where the resource lives. + :keyword location: The geo-location where the resource lives. Required. :paramtype location: str :keyword sku: The managed cluster SKU. :paramtype sku: ~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedClusterSKU @@ -2370,11 +2299,11 @@ def __init__( :paramtype ingress_profile: ~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedClusterIngressProfile :keyword public_network_access: Allow or deny public network access for AKS. Known values are: - "Enabled", "Disabled". + "Enabled" and "Disabled". :paramtype public_network_access: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.PublicNetworkAccess """ - super(ManagedCluster, self).__init__(tags=tags, location=location, **kwargs) + super().__init__(tags=tags, location=location, **kwargs) self.sku = sku self.extended_location = extended_location self.identity = identity @@ -2416,7 +2345,7 @@ def __init__( self.public_network_access = public_network_access -class ManagedClusterAADProfile(msrest.serialization.Model): +class ManagedClusterAADProfile(_serialization.Model): """For more details see `managed AAD on AKS `_. :ivar managed: Whether to enable managed AAD. @@ -2438,13 +2367,13 @@ class ManagedClusterAADProfile(msrest.serialization.Model): """ _attribute_map = { - 'managed': {'key': 'managed', 'type': 'bool'}, - 'enable_azure_rbac': {'key': 'enableAzureRBAC', 'type': 'bool'}, - 'admin_group_object_i_ds': {'key': 'adminGroupObjectIDs', 'type': '[str]'}, - 'client_app_id': {'key': 'clientAppID', 'type': 'str'}, - 'server_app_id': {'key': 'serverAppID', 'type': 'str'}, - 'server_app_secret': {'key': 'serverAppSecret', 'type': 'str'}, - 'tenant_id': {'key': 'tenantID', 'type': 'str'}, + "managed": {"key": "managed", "type": "bool"}, + "enable_azure_rbac": {"key": "enableAzureRBAC", "type": "bool"}, + "admin_group_object_i_ds": {"key": "adminGroupObjectIDs", "type": "[str]"}, + "client_app_id": {"key": "clientAppID", "type": "str"}, + "server_app_id": {"key": "serverAppID", "type": "str"}, + "server_app_secret": {"key": "serverAppSecret", "type": "str"}, + "tenant_id": {"key": "tenantID", "type": "str"}, } def __init__( @@ -2477,7 +2406,7 @@ def __init__( tenant of the deployment subscription. :paramtype tenant_id: str """ - super(ManagedClusterAADProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.managed = managed self.enable_azure_rbac = enable_azure_rbac self.admin_group_object_i_ds = admin_group_object_i_ds @@ -2505,60 +2434,55 @@ class ManagedClusterAccessProfile(TrackedResource): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.containerservice.v2022_04_02_preview.models.SystemData - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] - :ivar location: Required. The geo-location where the resource lives. + :ivar location: The geo-location where the resource lives. Required. :vartype location: str :ivar kube_config: Base64-encoded Kubernetes configuration file. - :vartype kube_config: bytearray + :vartype kube_config: bytes """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'location': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - 'kube_config': {'key': 'properties.kubeConfig', 'type': 'bytearray'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "kube_config": {"key": "properties.kubeConfig", "type": "bytearray"}, } def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - kube_config: Optional[bytearray] = None, - **kwargs + self, *, location: str, tags: Optional[Dict[str, str]] = None, kube_config: Optional[bytes] = None, **kwargs ): """ - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] - :keyword location: Required. The geo-location where the resource lives. + :keyword location: The geo-location where the resource lives. Required. :paramtype location: str :keyword kube_config: Base64-encoded Kubernetes configuration file. - :paramtype kube_config: bytearray + :paramtype kube_config: bytes """ - super(ManagedClusterAccessProfile, self).__init__(tags=tags, location=location, **kwargs) + super().__init__(tags=tags, location=location, **kwargs) self.kube_config = kube_config -class ManagedClusterAddonProfile(msrest.serialization.Model): +class ManagedClusterAddonProfile(_serialization.Model): """A Kubernetes add-on profile for a managed cluster. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar enabled: Required. Whether the add-on is enabled or not. + :ivar enabled: Whether the add-on is enabled or not. Required. :vartype enabled: bool :ivar config: Key-value pairs for configuring an add-on. :vartype config: dict[str, str] @@ -2568,36 +2492,30 @@ class ManagedClusterAddonProfile(msrest.serialization.Model): """ _validation = { - 'enabled': {'required': True}, - 'identity': {'readonly': True}, + "enabled": {"required": True}, + "identity": {"readonly": True}, } _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'config': {'key': 'config', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'ManagedClusterAddonProfileIdentity'}, + "enabled": {"key": "enabled", "type": "bool"}, + "config": {"key": "config", "type": "{str}"}, + "identity": {"key": "identity", "type": "ManagedClusterAddonProfileIdentity"}, } - def __init__( - self, - *, - enabled: bool, - config: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, enabled: bool, config: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword enabled: Required. Whether the add-on is enabled or not. + :keyword enabled: Whether the add-on is enabled or not. Required. :paramtype enabled: bool :keyword config: Key-value pairs for configuring an add-on. :paramtype config: dict[str, str] """ - super(ManagedClusterAddonProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.config = config self.identity = None -class UserAssignedIdentity(msrest.serialization.Model): +class UserAssignedIdentity(_serialization.Model): """Details about a user assigned identity. :ivar resource_id: The resource ID of the user assigned identity. @@ -2609,9 +2527,9 @@ class UserAssignedIdentity(msrest.serialization.Model): """ _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'object_id': {'key': 'objectId', 'type': 'str'}, + "resource_id": {"key": "resourceId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + "object_id": {"key": "objectId", "type": "str"}, } def __init__( @@ -2630,7 +2548,7 @@ def __init__( :keyword object_id: The object ID of the user assigned identity. :paramtype object_id: str """ - super(UserAssignedIdentity, self).__init__(**kwargs) + super().__init__(**kwargs) self.resource_id = resource_id self.client_id = client_id self.object_id = object_id @@ -2648,9 +2566,9 @@ class ManagedClusterAddonProfileIdentity(UserAssignedIdentity): """ _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'object_id': {'key': 'objectId', 'type': 'str'}, + "resource_id": {"key": "resourceId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + "object_id": {"key": "objectId", "type": "str"}, } def __init__( @@ -2669,10 +2587,10 @@ def __init__( :keyword object_id: The object ID of the user assigned identity. :paramtype object_id: str """ - super(ManagedClusterAddonProfileIdentity, self).__init__(resource_id=resource_id, client_id=client_id, object_id=object_id, **kwargs) + super().__init__(resource_id=resource_id, client_id=client_id, object_id=object_id, **kwargs) -class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): +class ManagedClusterAgentPoolProfileProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes """Properties for the container service agent pool profile. Variables are only populated by the server, and will be ignored when sending a request. @@ -2693,15 +2611,15 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.OSDiskType :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data - root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.KubeletDiskType :ivar workload_runtime: Determines the type of workload a node can run. Known values are: - "OCIContainer", "WasmWasi". + "OCIContainer" and "WasmWasi". :vartype workload_runtime: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.WorkloadRuntime :ivar message_of_the_day: A base64-encoded string which will be written to /etc/motd after @@ -2720,13 +2638,13 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :vartype pod_subnet_id: str :ivar max_pods: The maximum number of pods that can run on a node. :vartype max_pods: int - :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.OSType :ivar os_sku: Specifies the OS SKU used by the agent pool. If not specified, the default is Ubuntu if OSType=Linux or Windows2019 if OSType=Windows. And the default Windows OSSKU will be changed to Windows2022 after Windows2019 is deprecated. Known values are: "Ubuntu", - "CBLMariner", "Windows2019", "Windows2022". + "CBLMariner", "Windows2019", and "Windows2022". :vartype os_sku: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.OSSKU :ivar max_count: The maximum number of nodes for auto-scaling. :vartype max_count: int @@ -2735,15 +2653,15 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it - defaults to Delete. Known values are: "Delete", "Deallocate". + defaults to Delete. Known values are: "Delete" and "Deallocate". :vartype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.ScaleDownMode - :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", + :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets" and "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.AgentPoolType :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :vartype mode: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.AgentPoolMode :ivar orchestrator_version: Both patch version and are supported. When is specified, the latest supported patch version is chosen @@ -2789,20 +2707,18 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default - is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + is 'Regular'. Known values are: "Spot" and "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.ScaleSetPriority :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.ScaleSetEvictionPolicy :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :vartype spot_max_price: float - :ivar tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :ivar tags: The tags to be persisted on the agent pool virtual machine scale set. :vartype tags: dict[str, str] :ivar node_labels: The node labels to be persisted across all nodes in agent pool. :vartype node_labels: dict[str, str] @@ -2826,7 +2742,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): for more details. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.GPUInstanceProfile :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the node pool @@ -2843,59 +2759,59 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): """ _validation = { - 'os_disk_size_gb': {'maximum': 2048, 'minimum': 0}, - 'node_image_version': {'readonly': True}, - 'provisioning_state': {'readonly': True}, + "os_disk_size_gb": {"maximum": 2048, "minimum": 0}, + "node_image_version": {"readonly": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'os_disk_type': {'key': 'osDiskType', 'type': 'str'}, - 'kubelet_disk_type': {'key': 'kubeletDiskType', 'type': 'str'}, - 'workload_runtime': {'key': 'workloadRuntime', 'type': 'str'}, - 'message_of_the_day': {'key': 'messageOfTheDay', 'type': 'str'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'pod_subnet_id': {'key': 'podSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'maxPods', 'type': 'int'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'os_sku': {'key': 'osSKU', 'type': 'str'}, - 'max_count': {'key': 'maxCount', 'type': 'int'}, - 'min_count': {'key': 'minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'enableAutoScaling', 'type': 'bool'}, - 'scale_down_mode': {'key': 'scaleDownMode', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'mode': {'key': 'mode', 'type': 'str'}, - 'orchestrator_version': {'key': 'orchestratorVersion', 'type': 'str'}, - 'current_orchestrator_version': {'key': 'currentOrchestratorVersion', 'type': 'str'}, - 'node_image_version': {'key': 'nodeImageVersion', 'type': 'str'}, - 'upgrade_settings': {'key': 'upgradeSettings', 'type': 'AgentPoolUpgradeSettings'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'power_state': {'key': 'powerState', 'type': 'PowerState'}, - 'availability_zones': {'key': 'availabilityZones', 'type': '[str]'}, - 'enable_node_public_ip': {'key': 'enableNodePublicIP', 'type': 'bool'}, - 'enable_custom_ca_trust': {'key': 'enableCustomCATrust', 'type': 'bool'}, - 'node_public_ip_prefix_id': {'key': 'nodePublicIPPrefixID', 'type': 'str'}, - 'scale_set_priority': {'key': 'scaleSetPriority', 'type': 'str'}, - 'scale_set_eviction_policy': {'key': 'scaleSetEvictionPolicy', 'type': 'str'}, - 'spot_max_price': {'key': 'spotMaxPrice', 'type': 'float'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'node_labels': {'key': 'nodeLabels', 'type': '{str}'}, - 'node_taints': {'key': 'nodeTaints', 'type': '[str]'}, - 'proximity_placement_group_id': {'key': 'proximityPlacementGroupID', 'type': 'str'}, - 'kubelet_config': {'key': 'kubeletConfig', 'type': 'KubeletConfig'}, - 'linux_os_config': {'key': 'linuxOSConfig', 'type': 'LinuxOSConfig'}, - 'enable_encryption_at_host': {'key': 'enableEncryptionAtHost', 'type': 'bool'}, - 'enable_ultra_ssd': {'key': 'enableUltraSSD', 'type': 'bool'}, - 'enable_fips': {'key': 'enableFIPS', 'type': 'bool'}, - 'gpu_instance_profile': {'key': 'gpuInstanceProfile', 'type': 'str'}, - 'creation_data': {'key': 'creationData', 'type': 'CreationData'}, - 'capacity_reservation_group_id': {'key': 'capacityReservationGroupID', 'type': 'str'}, - 'host_group_id': {'key': 'hostGroupID', 'type': 'str'}, - } - - def __init__( + "count": {"key": "count", "type": "int"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "os_disk_type": {"key": "osDiskType", "type": "str"}, + "kubelet_disk_type": {"key": "kubeletDiskType", "type": "str"}, + "workload_runtime": {"key": "workloadRuntime", "type": "str"}, + "message_of_the_day": {"key": "messageOfTheDay", "type": "str"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "pod_subnet_id": {"key": "podSubnetID", "type": "str"}, + "max_pods": {"key": "maxPods", "type": "int"}, + "os_type": {"key": "osType", "type": "str"}, + "os_sku": {"key": "osSKU", "type": "str"}, + "max_count": {"key": "maxCount", "type": "int"}, + "min_count": {"key": "minCount", "type": "int"}, + "enable_auto_scaling": {"key": "enableAutoScaling", "type": "bool"}, + "scale_down_mode": {"key": "scaleDownMode", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "mode": {"key": "mode", "type": "str"}, + "orchestrator_version": {"key": "orchestratorVersion", "type": "str"}, + "current_orchestrator_version": {"key": "currentOrchestratorVersion", "type": "str"}, + "node_image_version": {"key": "nodeImageVersion", "type": "str"}, + "upgrade_settings": {"key": "upgradeSettings", "type": "AgentPoolUpgradeSettings"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "power_state": {"key": "powerState", "type": "PowerState"}, + "availability_zones": {"key": "availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "enableNodePublicIP", "type": "bool"}, + "enable_custom_ca_trust": {"key": "enableCustomCATrust", "type": "bool"}, + "node_public_ip_prefix_id": {"key": "nodePublicIPPrefixID", "type": "str"}, + "scale_set_priority": {"key": "scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "scaleSetEvictionPolicy", "type": "str"}, + "spot_max_price": {"key": "spotMaxPrice", "type": "float"}, + "tags": {"key": "tags", "type": "{str}"}, + "node_labels": {"key": "nodeLabels", "type": "{str}"}, + "node_taints": {"key": "nodeTaints", "type": "[str]"}, + "proximity_placement_group_id": {"key": "proximityPlacementGroupID", "type": "str"}, + "kubelet_config": {"key": "kubeletConfig", "type": "KubeletConfig"}, + "linux_os_config": {"key": "linuxOSConfig", "type": "LinuxOSConfig"}, + "enable_encryption_at_host": {"key": "enableEncryptionAtHost", "type": "bool"}, + "enable_ultra_ssd": {"key": "enableUltraSSD", "type": "bool"}, + "enable_fips": {"key": "enableFIPS", "type": "bool"}, + "gpu_instance_profile": {"key": "gpuInstanceProfile", "type": "str"}, + "creation_data": {"key": "creationData", "type": "CreationData"}, + "capacity_reservation_group_id": {"key": "capacityReservationGroupID", "type": "str"}, + "host_group_id": {"key": "hostGroupID", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, count: Optional[int] = None, @@ -2908,7 +2824,7 @@ def __init__( vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, @@ -2924,9 +2840,9 @@ def __init__( enable_node_public_ip: Optional[bool] = None, enable_custom_ca_trust: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", - spot_max_price: Optional[float] = -1, + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", + spot_max_price: float = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, @@ -2959,15 +2875,15 @@ def __init__( larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.OSDiskType :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime - data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + data root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.KubeletDiskType :keyword workload_runtime: Determines the type of workload a node can run. Known values are: - "OCIContainer", "WasmWasi". + "OCIContainer" and "WasmWasi". :paramtype workload_runtime: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.WorkloadRuntime :keyword message_of_the_day: A base64-encoded string which will be written to /etc/motd after @@ -2986,13 +2902,13 @@ def __init__( :paramtype pod_subnet_id: str :keyword max_pods: The maximum number of pods that can run on a node. :paramtype max_pods: int - :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.OSType :keyword os_sku: Specifies the OS SKU used by the agent pool. If not specified, the default is Ubuntu if OSType=Linux or Windows2019 if OSType=Windows. And the default Windows OSSKU will be changed to Windows2022 after Windows2019 is deprecated. Known values are: "Ubuntu", - "CBLMariner", "Windows2019", "Windows2022". + "CBLMariner", "Windows2019", and "Windows2022". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.OSSKU :keyword max_count: The maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -3001,15 +2917,15 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, - it defaults to Delete. Known values are: "Delete", "Deallocate". + it defaults to Delete. Known values are: "Delete" and "Deallocate". :paramtype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.ScaleDownMode - :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", + :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.AgentPoolType :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.AgentPoolMode :keyword orchestrator_version: Both patch version and are supported. When is specified, the latest supported patch version is chosen @@ -3051,20 +2967,18 @@ def __init__( /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the - default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + default is 'Regular'. Known values are: "Spot" and "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.ScaleSetPriority :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.ScaleSetEvictionPolicy :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :paramtype spot_max_price: float - :keyword tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :keyword tags: The tags to be persisted on the agent pool virtual machine scale set. :paramtype tags: dict[str, str] :keyword node_labels: The node labels to be persisted across all nodes in agent pool. :paramtype node_labels: dict[str, str] @@ -3090,7 +3004,7 @@ def __init__( for more details. :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance - profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.GPUInstanceProfile @@ -3106,7 +3020,7 @@ def __init__( `_. :paramtype host_group_id: str """ - super(ManagedClusterAgentPoolProfileProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.vm_size = vm_size self.os_disk_size_gb = os_disk_size_gb @@ -3153,7 +3067,9 @@ def __init__( self.host_group_id = host_group_id -class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): +class ManagedClusterAgentPoolProfile( + ManagedClusterAgentPoolProfileProperties +): # pylint: disable=too-many-instance-attributes """Profile for the container service agent pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -3176,15 +3092,15 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.OSDiskType :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data - root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.KubeletDiskType :ivar workload_runtime: Determines the type of workload a node can run. Known values are: - "OCIContainer", "WasmWasi". + "OCIContainer" and "WasmWasi". :vartype workload_runtime: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.WorkloadRuntime :ivar message_of_the_day: A base64-encoded string which will be written to /etc/motd after @@ -3203,13 +3119,13 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :vartype pod_subnet_id: str :ivar max_pods: The maximum number of pods that can run on a node. :vartype max_pods: int - :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.OSType :ivar os_sku: Specifies the OS SKU used by the agent pool. If not specified, the default is Ubuntu if OSType=Linux or Windows2019 if OSType=Windows. And the default Windows OSSKU will be changed to Windows2022 after Windows2019 is deprecated. Known values are: "Ubuntu", - "CBLMariner", "Windows2019", "Windows2022". + "CBLMariner", "Windows2019", and "Windows2022". :vartype os_sku: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.OSSKU :ivar max_count: The maximum number of nodes for auto-scaling. :vartype max_count: int @@ -3218,15 +3134,15 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it - defaults to Delete. Known values are: "Delete", "Deallocate". + defaults to Delete. Known values are: "Delete" and "Deallocate". :vartype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.ScaleDownMode - :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", + :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets" and "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.AgentPoolType :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :vartype mode: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.AgentPoolMode :ivar orchestrator_version: Both patch version and are supported. When is specified, the latest supported patch version is chosen @@ -3272,20 +3188,18 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default - is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + is 'Regular'. Known values are: "Spot" and "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.ScaleSetPriority :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.ScaleSetEvictionPolicy :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :vartype spot_max_price: float - :ivar tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :ivar tags: The tags to be persisted on the agent pool virtual machine scale set. :vartype tags: dict[str, str] :ivar node_labels: The node labels to be persisted across all nodes in agent pool. :vartype node_labels: dict[str, str] @@ -3309,7 +3223,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): for more details. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.GPUInstanceProfile :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the node pool @@ -3323,66 +3237,66 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): For more information see `Azure dedicated hosts `_. :vartype host_group_id: str - :ivar name: Required. Windows agent pool names must be 6 characters or less. + :ivar name: Windows agent pool names must be 6 characters or less. Required. :vartype name: str """ _validation = { - 'os_disk_size_gb': {'maximum': 2048, 'minimum': 0}, - 'node_image_version': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'name': {'required': True, 'pattern': r'^[a-z][a-z0-9]{0,11}$'}, + "os_disk_size_gb": {"maximum": 2048, "minimum": 0}, + "node_image_version": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "name": {"required": True, "pattern": r"^[a-z][a-z0-9]{0,11}$"}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'os_disk_type': {'key': 'osDiskType', 'type': 'str'}, - 'kubelet_disk_type': {'key': 'kubeletDiskType', 'type': 'str'}, - 'workload_runtime': {'key': 'workloadRuntime', 'type': 'str'}, - 'message_of_the_day': {'key': 'messageOfTheDay', 'type': 'str'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'pod_subnet_id': {'key': 'podSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'maxPods', 'type': 'int'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'os_sku': {'key': 'osSKU', 'type': 'str'}, - 'max_count': {'key': 'maxCount', 'type': 'int'}, - 'min_count': {'key': 'minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'enableAutoScaling', 'type': 'bool'}, - 'scale_down_mode': {'key': 'scaleDownMode', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'mode': {'key': 'mode', 'type': 'str'}, - 'orchestrator_version': {'key': 'orchestratorVersion', 'type': 'str'}, - 'current_orchestrator_version': {'key': 'currentOrchestratorVersion', 'type': 'str'}, - 'node_image_version': {'key': 'nodeImageVersion', 'type': 'str'}, - 'upgrade_settings': {'key': 'upgradeSettings', 'type': 'AgentPoolUpgradeSettings'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'power_state': {'key': 'powerState', 'type': 'PowerState'}, - 'availability_zones': {'key': 'availabilityZones', 'type': '[str]'}, - 'enable_node_public_ip': {'key': 'enableNodePublicIP', 'type': 'bool'}, - 'enable_custom_ca_trust': {'key': 'enableCustomCATrust', 'type': 'bool'}, - 'node_public_ip_prefix_id': {'key': 'nodePublicIPPrefixID', 'type': 'str'}, - 'scale_set_priority': {'key': 'scaleSetPriority', 'type': 'str'}, - 'scale_set_eviction_policy': {'key': 'scaleSetEvictionPolicy', 'type': 'str'}, - 'spot_max_price': {'key': 'spotMaxPrice', 'type': 'float'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'node_labels': {'key': 'nodeLabels', 'type': '{str}'}, - 'node_taints': {'key': 'nodeTaints', 'type': '[str]'}, - 'proximity_placement_group_id': {'key': 'proximityPlacementGroupID', 'type': 'str'}, - 'kubelet_config': {'key': 'kubeletConfig', 'type': 'KubeletConfig'}, - 'linux_os_config': {'key': 'linuxOSConfig', 'type': 'LinuxOSConfig'}, - 'enable_encryption_at_host': {'key': 'enableEncryptionAtHost', 'type': 'bool'}, - 'enable_ultra_ssd': {'key': 'enableUltraSSD', 'type': 'bool'}, - 'enable_fips': {'key': 'enableFIPS', 'type': 'bool'}, - 'gpu_instance_profile': {'key': 'gpuInstanceProfile', 'type': 'str'}, - 'creation_data': {'key': 'creationData', 'type': 'CreationData'}, - 'capacity_reservation_group_id': {'key': 'capacityReservationGroupID', 'type': 'str'}, - 'host_group_id': {'key': 'hostGroupID', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( + "count": {"key": "count", "type": "int"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "os_disk_type": {"key": "osDiskType", "type": "str"}, + "kubelet_disk_type": {"key": "kubeletDiskType", "type": "str"}, + "workload_runtime": {"key": "workloadRuntime", "type": "str"}, + "message_of_the_day": {"key": "messageOfTheDay", "type": "str"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "pod_subnet_id": {"key": "podSubnetID", "type": "str"}, + "max_pods": {"key": "maxPods", "type": "int"}, + "os_type": {"key": "osType", "type": "str"}, + "os_sku": {"key": "osSKU", "type": "str"}, + "max_count": {"key": "maxCount", "type": "int"}, + "min_count": {"key": "minCount", "type": "int"}, + "enable_auto_scaling": {"key": "enableAutoScaling", "type": "bool"}, + "scale_down_mode": {"key": "scaleDownMode", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "mode": {"key": "mode", "type": "str"}, + "orchestrator_version": {"key": "orchestratorVersion", "type": "str"}, + "current_orchestrator_version": {"key": "currentOrchestratorVersion", "type": "str"}, + "node_image_version": {"key": "nodeImageVersion", "type": "str"}, + "upgrade_settings": {"key": "upgradeSettings", "type": "AgentPoolUpgradeSettings"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "power_state": {"key": "powerState", "type": "PowerState"}, + "availability_zones": {"key": "availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "enableNodePublicIP", "type": "bool"}, + "enable_custom_ca_trust": {"key": "enableCustomCATrust", "type": "bool"}, + "node_public_ip_prefix_id": {"key": "nodePublicIPPrefixID", "type": "str"}, + "scale_set_priority": {"key": "scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "scaleSetEvictionPolicy", "type": "str"}, + "spot_max_price": {"key": "spotMaxPrice", "type": "float"}, + "tags": {"key": "tags", "type": "{str}"}, + "node_labels": {"key": "nodeLabels", "type": "{str}"}, + "node_taints": {"key": "nodeTaints", "type": "[str]"}, + "proximity_placement_group_id": {"key": "proximityPlacementGroupID", "type": "str"}, + "kubelet_config": {"key": "kubeletConfig", "type": "KubeletConfig"}, + "linux_os_config": {"key": "linuxOSConfig", "type": "LinuxOSConfig"}, + "enable_encryption_at_host": {"key": "enableEncryptionAtHost", "type": "bool"}, + "enable_ultra_ssd": {"key": "enableUltraSSD", "type": "bool"}, + "enable_fips": {"key": "enableFIPS", "type": "bool"}, + "gpu_instance_profile": {"key": "gpuInstanceProfile", "type": "str"}, + "creation_data": {"key": "creationData", "type": "CreationData"}, + "capacity_reservation_group_id": {"key": "capacityReservationGroupID", "type": "str"}, + "host_group_id": {"key": "hostGroupID", "type": "str"}, + "name": {"key": "name", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, name: str, @@ -3396,7 +3310,7 @@ def __init__( vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, @@ -3412,9 +3326,9 @@ def __init__( enable_node_public_ip: Optional[bool] = None, enable_custom_ca_trust: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", - spot_max_price: Optional[float] = -1, + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", + spot_max_price: float = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, @@ -3447,15 +3361,15 @@ def __init__( larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.OSDiskType :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime - data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + data root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.KubeletDiskType :keyword workload_runtime: Determines the type of workload a node can run. Known values are: - "OCIContainer", "WasmWasi". + "OCIContainer" and "WasmWasi". :paramtype workload_runtime: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.WorkloadRuntime :keyword message_of_the_day: A base64-encoded string which will be written to /etc/motd after @@ -3474,13 +3388,13 @@ def __init__( :paramtype pod_subnet_id: str :keyword max_pods: The maximum number of pods that can run on a node. :paramtype max_pods: int - :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.OSType :keyword os_sku: Specifies the OS SKU used by the agent pool. If not specified, the default is Ubuntu if OSType=Linux or Windows2019 if OSType=Windows. And the default Windows OSSKU will be changed to Windows2022 after Windows2019 is deprecated. Known values are: "Ubuntu", - "CBLMariner", "Windows2019", "Windows2022". + "CBLMariner", "Windows2019", and "Windows2022". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.OSSKU :keyword max_count: The maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -3489,15 +3403,15 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, - it defaults to Delete. Known values are: "Delete", "Deallocate". + it defaults to Delete. Known values are: "Delete" and "Deallocate". :paramtype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.ScaleDownMode - :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", + :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.AgentPoolType :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.AgentPoolMode :keyword orchestrator_version: Both patch version and are supported. When is specified, the latest supported patch version is chosen @@ -3539,20 +3453,18 @@ def __init__( /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the - default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + default is 'Regular'. Known values are: "Spot" and "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.ScaleSetPriority :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.ScaleSetEvictionPolicy :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :paramtype spot_max_price: float - :keyword tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :keyword tags: The tags to be persisted on the agent pool virtual machine scale set. :paramtype tags: dict[str, str] :keyword node_labels: The node labels to be persisted across all nodes in agent pool. :paramtype node_labels: dict[str, str] @@ -3578,7 +3490,7 @@ def __init__( for more details. :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance - profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.GPUInstanceProfile @@ -3593,14 +3505,58 @@ def __init__( For more information see `Azure dedicated hosts `_. :paramtype host_group_id: str - :keyword name: Required. Windows agent pool names must be 6 characters or less. + :keyword name: Windows agent pool names must be 6 characters or less. Required. :paramtype name: str """ - super(ManagedClusterAgentPoolProfile, self).__init__(count=count, vm_size=vm_size, os_disk_size_gb=os_disk_size_gb, os_disk_type=os_disk_type, kubelet_disk_type=kubelet_disk_type, workload_runtime=workload_runtime, message_of_the_day=message_of_the_day, vnet_subnet_id=vnet_subnet_id, pod_subnet_id=pod_subnet_id, max_pods=max_pods, os_type=os_type, os_sku=os_sku, max_count=max_count, min_count=min_count, enable_auto_scaling=enable_auto_scaling, scale_down_mode=scale_down_mode, type=type, mode=mode, orchestrator_version=orchestrator_version, current_orchestrator_version=current_orchestrator_version, upgrade_settings=upgrade_settings, power_state=power_state, availability_zones=availability_zones, enable_node_public_ip=enable_node_public_ip, enable_custom_ca_trust=enable_custom_ca_trust, node_public_ip_prefix_id=node_public_ip_prefix_id, scale_set_priority=scale_set_priority, scale_set_eviction_policy=scale_set_eviction_policy, spot_max_price=spot_max_price, tags=tags, node_labels=node_labels, node_taints=node_taints, proximity_placement_group_id=proximity_placement_group_id, kubelet_config=kubelet_config, linux_os_config=linux_os_config, enable_encryption_at_host=enable_encryption_at_host, enable_ultra_ssd=enable_ultra_ssd, enable_fips=enable_fips, gpu_instance_profile=gpu_instance_profile, creation_data=creation_data, capacity_reservation_group_id=capacity_reservation_group_id, host_group_id=host_group_id, **kwargs) + super().__init__( + count=count, + vm_size=vm_size, + os_disk_size_gb=os_disk_size_gb, + os_disk_type=os_disk_type, + kubelet_disk_type=kubelet_disk_type, + workload_runtime=workload_runtime, + message_of_the_day=message_of_the_day, + vnet_subnet_id=vnet_subnet_id, + pod_subnet_id=pod_subnet_id, + max_pods=max_pods, + os_type=os_type, + os_sku=os_sku, + max_count=max_count, + min_count=min_count, + enable_auto_scaling=enable_auto_scaling, + scale_down_mode=scale_down_mode, + type=type, + mode=mode, + orchestrator_version=orchestrator_version, + current_orchestrator_version=current_orchestrator_version, + upgrade_settings=upgrade_settings, + power_state=power_state, + availability_zones=availability_zones, + enable_node_public_ip=enable_node_public_ip, + enable_custom_ca_trust=enable_custom_ca_trust, + node_public_ip_prefix_id=node_public_ip_prefix_id, + scale_set_priority=scale_set_priority, + scale_set_eviction_policy=scale_set_eviction_policy, + spot_max_price=spot_max_price, + tags=tags, + node_labels=node_labels, + node_taints=node_taints, + proximity_placement_group_id=proximity_placement_group_id, + kubelet_config=kubelet_config, + linux_os_config=linux_os_config, + enable_encryption_at_host=enable_encryption_at_host, + enable_ultra_ssd=enable_ultra_ssd, + enable_fips=enable_fips, + gpu_instance_profile=gpu_instance_profile, + creation_data=creation_data, + capacity_reservation_group_id=capacity_reservation_group_id, + host_group_id=host_group_id, + **kwargs + ) self.name = name -class ManagedClusterAPIServerAccessProfile(msrest.serialization.Model): +class ManagedClusterAPIServerAccessProfile(_serialization.Model): """Access profile for managed cluster API server. :ivar authorized_ip_ranges: IP ranges are specified in CIDR format, e.g. 137.117.106.88/29. @@ -3629,13 +3585,13 @@ class ManagedClusterAPIServerAccessProfile(msrest.serialization.Model): """ _attribute_map = { - 'authorized_ip_ranges': {'key': 'authorizedIPRanges', 'type': '[str]'}, - 'enable_private_cluster': {'key': 'enablePrivateCluster', 'type': 'bool'}, - 'private_dns_zone': {'key': 'privateDNSZone', 'type': 'str'}, - 'enable_private_cluster_public_fqdn': {'key': 'enablePrivateClusterPublicFQDN', 'type': 'bool'}, - 'disable_run_command': {'key': 'disableRunCommand', 'type': 'bool'}, - 'enable_vnet_integration': {'key': 'enableVnetIntegration', 'type': 'bool'}, - 'subnet_id': {'key': 'subnetId', 'type': 'str'}, + "authorized_ip_ranges": {"key": "authorizedIPRanges", "type": "[str]"}, + "enable_private_cluster": {"key": "enablePrivateCluster", "type": "bool"}, + "private_dns_zone": {"key": "privateDNSZone", "type": "str"}, + "enable_private_cluster_public_fqdn": {"key": "enablePrivateClusterPublicFQDN", "type": "bool"}, + "disable_run_command": {"key": "disableRunCommand", "type": "bool"}, + "enable_vnet_integration": {"key": "enableVnetIntegration", "type": "bool"}, + "subnet_id": {"key": "subnetId", "type": "str"}, } def __init__( @@ -3675,7 +3631,7 @@ def __init__( an existing cluster to enable apiserver vnet integration. :paramtype subnet_id: str """ - super(ManagedClusterAPIServerAccessProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.authorized_ip_ranges = authorized_ip_ranges self.enable_private_cluster = enable_private_cluster self.private_dns_zone = private_dns_zone @@ -3685,38 +3641,33 @@ def __init__( self.subnet_id = subnet_id -class ManagedClusterAutoUpgradeProfile(msrest.serialization.Model): +class ManagedClusterAutoUpgradeProfile(_serialization.Model): """Auto upgrade profile for a managed cluster. :ivar upgrade_channel: For more information see `setting the AKS cluster auto-upgrade channel `_. Known values - are: "rapid", "stable", "patch", "node-image", "none". + are: "rapid", "stable", "patch", "node-image", and "none". :vartype upgrade_channel: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.UpgradeChannel """ _attribute_map = { - 'upgrade_channel': {'key': 'upgradeChannel', 'type': 'str'}, + "upgrade_channel": {"key": "upgradeChannel", "type": "str"}, } - def __init__( - self, - *, - upgrade_channel: Optional[Union[str, "_models.UpgradeChannel"]] = None, - **kwargs - ): + def __init__(self, *, upgrade_channel: Optional[Union[str, "_models.UpgradeChannel"]] = None, **kwargs): """ :keyword upgrade_channel: For more information see `setting the AKS cluster auto-upgrade channel `_. - Known values are: "rapid", "stable", "patch", "node-image", "none". + Known values are: "rapid", "stable", "patch", "node-image", and "none". :paramtype upgrade_channel: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.UpgradeChannel """ - super(ManagedClusterAutoUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.upgrade_channel = upgrade_channel -class ManagedClusterHTTPProxyConfig(msrest.serialization.Model): +class ManagedClusterHTTPProxyConfig(_serialization.Model): """Cluster HTTP proxy configuration. Variables are only populated by the server, and will be ignored when sending a request. @@ -3735,15 +3686,15 @@ class ManagedClusterHTTPProxyConfig(msrest.serialization.Model): """ _validation = { - 'effective_no_proxy': {'readonly': True}, + "effective_no_proxy": {"readonly": True}, } _attribute_map = { - 'http_proxy': {'key': 'httpProxy', 'type': 'str'}, - 'https_proxy': {'key': 'httpsProxy', 'type': 'str'}, - 'no_proxy': {'key': 'noProxy', 'type': '[str]'}, - 'effective_no_proxy': {'key': 'effectiveNoProxy', 'type': '[str]'}, - 'trusted_ca': {'key': 'trustedCa', 'type': 'str'}, + "http_proxy": {"key": "httpProxy", "type": "str"}, + "https_proxy": {"key": "httpsProxy", "type": "str"}, + "no_proxy": {"key": "noProxy", "type": "[str]"}, + "effective_no_proxy": {"key": "effectiveNoProxy", "type": "[str]"}, + "trusted_ca": {"key": "trustedCa", "type": "str"}, } def __init__( @@ -3765,7 +3716,7 @@ def __init__( :keyword trusted_ca: Alternative CA cert to use for connecting to proxy servers. :paramtype trusted_ca: str """ - super(ManagedClusterHTTPProxyConfig, self).__init__(**kwargs) + super().__init__(**kwargs) self.http_proxy = http_proxy self.https_proxy = https_proxy self.no_proxy = no_proxy @@ -3773,7 +3724,7 @@ def __init__( self.trusted_ca = trusted_ca -class ManagedClusterIdentity(msrest.serialization.Model): +class ManagedClusterIdentity(_serialization.Model): """Identity for the managed cluster. Variables are only populated by the server, and will be ignored when sending a request. @@ -3786,7 +3737,7 @@ class ManagedClusterIdentity(msrest.serialization.Model): :vartype tenant_id: str :ivar type: For more information see `use managed identities in AKS `_. Known values are: - "SystemAssigned", "UserAssigned", "None". + "SystemAssigned", "UserAssigned", and "None". :vartype type: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.ResourceIdentityType :ivar user_assigned_identities: The keys must be ARM resource IDs in the form: @@ -3796,28 +3747,33 @@ class ManagedClusterIdentity(msrest.serialization.Model): """ _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, + "principal_id": {"readonly": True}, + "tenant_id": {"readonly": True}, } _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{ManagedServiceIdentityUserAssignedIdentitiesValue}'}, + "principal_id": {"key": "principalId", "type": "str"}, + "tenant_id": {"key": "tenantId", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "user_assigned_identities": { + "key": "userAssignedIdentities", + "type": "{ManagedServiceIdentityUserAssignedIdentitiesValue}", + }, } def __init__( self, *, type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, - user_assigned_identities: Optional[Dict[str, "_models.ManagedServiceIdentityUserAssignedIdentitiesValue"]] = None, + user_assigned_identities: Optional[ + Dict[str, "_models.ManagedServiceIdentityUserAssignedIdentitiesValue"] + ] = None, **kwargs ): """ :keyword type: For more information see `use managed identities in AKS `_. Known values are: - "SystemAssigned", "UserAssigned", "None". + "SystemAssigned", "UserAssigned", and "None". :paramtype type: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.ResourceIdentityType :keyword user_assigned_identities: The keys must be ARM resource IDs in the form: @@ -3825,14 +3781,14 @@ def __init__( :paramtype user_assigned_identities: dict[str, ~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedServiceIdentityUserAssignedIdentitiesValue] """ - super(ManagedClusterIdentity, self).__init__(**kwargs) + super().__init__(**kwargs) self.principal_id = None self.tenant_id = None self.type = type self.user_assigned_identities = user_assigned_identities -class ManagedClusterIngressProfile(msrest.serialization.Model): +class ManagedClusterIngressProfile(_serialization.Model): """Ingress profile for the container service cluster. :ivar web_app_routing: Web App Routing settings for the ingress profile. @@ -3841,25 +3797,22 @@ class ManagedClusterIngressProfile(msrest.serialization.Model): """ _attribute_map = { - 'web_app_routing': {'key': 'webAppRouting', 'type': 'ManagedClusterIngressProfileWebAppRouting'}, + "web_app_routing": {"key": "webAppRouting", "type": "ManagedClusterIngressProfileWebAppRouting"}, } def __init__( - self, - *, - web_app_routing: Optional["_models.ManagedClusterIngressProfileWebAppRouting"] = None, - **kwargs + self, *, web_app_routing: Optional["_models.ManagedClusterIngressProfileWebAppRouting"] = None, **kwargs ): """ :keyword web_app_routing: Web App Routing settings for the ingress profile. :paramtype web_app_routing: ~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedClusterIngressProfileWebAppRouting """ - super(ManagedClusterIngressProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.web_app_routing = web_app_routing -class ManagedClusterIngressProfileWebAppRouting(msrest.serialization.Model): +class ManagedClusterIngressProfileWebAppRouting(_serialization.Model): """Web App Routing settings for the ingress profile. :ivar enabled: Whether to enable Web App Routing. @@ -3870,17 +3823,11 @@ class ManagedClusterIngressProfileWebAppRouting(msrest.serialization.Model): """ _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'dns_zone_resource_id': {'key': 'dnsZoneResourceId', 'type': 'str'}, + "enabled": {"key": "enabled", "type": "bool"}, + "dns_zone_resource_id": {"key": "dnsZoneResourceId", "type": "str"}, } - def __init__( - self, - *, - enabled: Optional[bool] = None, - dns_zone_resource_id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, enabled: Optional[bool] = None, dns_zone_resource_id: Optional[str] = None, **kwargs): """ :keyword enabled: Whether to enable Web App Routing. :paramtype enabled: bool @@ -3888,12 +3835,12 @@ def __init__( Used only when Web App Routing is enabled. :paramtype dns_zone_resource_id: str """ - super(ManagedClusterIngressProfileWebAppRouting, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.dns_zone_resource_id = dns_zone_resource_id -class ManagedClusterListResult(msrest.serialization.Model): +class ManagedClusterListResult(_serialization.Model): """The response from the List Managed Clusters operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -3905,30 +3852,25 @@ class ManagedClusterListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[ManagedCluster]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[ManagedCluster]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.ManagedCluster"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.ManagedCluster"]] = None, **kwargs): """ :keyword value: The list of managed clusters. :paramtype value: list[~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedCluster] """ - super(ManagedClusterListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class ManagedClusterLoadBalancerProfile(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfile(_serialization.Model): """Profile of the managed cluster load balancer. :ivar managed_outbound_i_ps: Desired managed outbound IPs for the cluster load balancer. @@ -3957,18 +3899,24 @@ class ManagedClusterLoadBalancerProfile(msrest.serialization.Model): """ _validation = { - 'allocated_outbound_ports': {'maximum': 64000, 'minimum': 0}, - 'idle_timeout_in_minutes': {'maximum': 120, 'minimum': 4}, + "allocated_outbound_ports": {"maximum": 64000, "minimum": 0}, + "idle_timeout_in_minutes": {"maximum": 120, "minimum": 4}, } _attribute_map = { - 'managed_outbound_i_ps': {'key': 'managedOutboundIPs', 'type': 'ManagedClusterLoadBalancerProfileManagedOutboundIPs'}, - 'outbound_ip_prefixes': {'key': 'outboundIPPrefixes', 'type': 'ManagedClusterLoadBalancerProfileOutboundIPPrefixes'}, - 'outbound_i_ps': {'key': 'outboundIPs', 'type': 'ManagedClusterLoadBalancerProfileOutboundIPs'}, - 'effective_outbound_i_ps': {'key': 'effectiveOutboundIPs', 'type': '[ResourceReference]'}, - 'allocated_outbound_ports': {'key': 'allocatedOutboundPorts', 'type': 'int'}, - 'idle_timeout_in_minutes': {'key': 'idleTimeoutInMinutes', 'type': 'int'}, - 'enable_multiple_standard_load_balancers': {'key': 'enableMultipleStandardLoadBalancers', 'type': 'bool'}, + "managed_outbound_i_ps": { + "key": "managedOutboundIPs", + "type": "ManagedClusterLoadBalancerProfileManagedOutboundIPs", + }, + "outbound_ip_prefixes": { + "key": "outboundIPPrefixes", + "type": "ManagedClusterLoadBalancerProfileOutboundIPPrefixes", + }, + "outbound_i_ps": {"key": "outboundIPs", "type": "ManagedClusterLoadBalancerProfileOutboundIPs"}, + "effective_outbound_i_ps": {"key": "effectiveOutboundIPs", "type": "[ResourceReference]"}, + "allocated_outbound_ports": {"key": "allocatedOutboundPorts", "type": "int"}, + "idle_timeout_in_minutes": {"key": "idleTimeoutInMinutes", "type": "int"}, + "enable_multiple_standard_load_balancers": {"key": "enableMultipleStandardLoadBalancers", "type": "bool"}, } def __init__( @@ -3978,8 +3926,8 @@ def __init__( outbound_ip_prefixes: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPPrefixes"] = None, outbound_i_ps: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPs"] = None, effective_outbound_i_ps: Optional[List["_models.ResourceReference"]] = None, - allocated_outbound_ports: Optional[int] = 0, - idle_timeout_in_minutes: Optional[int] = 30, + allocated_outbound_ports: int = 0, + idle_timeout_in_minutes: int = 30, enable_multiple_standard_load_balancers: Optional[bool] = None, **kwargs ): @@ -4009,7 +3957,7 @@ def __init__( AKS cluster or not. :paramtype enable_multiple_standard_load_balancers: bool """ - super(ManagedClusterLoadBalancerProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.managed_outbound_i_ps = managed_outbound_i_ps self.outbound_ip_prefixes = outbound_ip_prefixes self.outbound_i_ps = outbound_i_ps @@ -4019,7 +3967,7 @@ def __init__( self.enable_multiple_standard_load_balancers = enable_multiple_standard_load_balancers -class ManagedClusterLoadBalancerProfileManagedOutboundIPs(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfileManagedOutboundIPs(_serialization.Model): """Desired managed outbound IPs for the cluster load balancer. :ivar count: The desired number of IPv4 outbound IPs created/managed by Azure for the cluster @@ -4033,22 +3981,16 @@ class ManagedClusterLoadBalancerProfileManagedOutboundIPs(msrest.serialization.M """ _validation = { - 'count': {'maximum': 100, 'minimum': 1}, - 'count_ipv6': {'maximum': 100, 'minimum': 0}, + "count": {"maximum": 100, "minimum": 1}, + "count_ipv6": {"maximum": 100, "minimum": 0}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'count_ipv6': {'key': 'countIPv6', 'type': 'int'}, + "count": {"key": "count", "type": "int"}, + "count_ipv6": {"key": "countIPv6", "type": "int"}, } - def __init__( - self, - *, - count: Optional[int] = 1, - count_ipv6: Optional[int] = 0, - **kwargs - ): + def __init__(self, *, count: int = 1, count_ipv6: int = 0, **kwargs): """ :keyword count: The desired number of IPv4 outbound IPs created/managed by Azure for the cluster load balancer. Allowed values must be in the range of 1 to 100 (inclusive). The default @@ -4059,12 +4001,12 @@ def __init__( value is 0 for single-stack and 1 for dual-stack. :paramtype count_ipv6: int """ - super(ManagedClusterLoadBalancerProfileManagedOutboundIPs, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.count_ipv6 = count_ipv6 -class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(_serialization.Model): """Desired outbound IP Prefix resources for the cluster load balancer. :ivar public_ip_prefixes: A list of public IP prefix resources. @@ -4073,25 +4015,20 @@ class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(msrest.serialization.M """ _attribute_map = { - 'public_ip_prefixes': {'key': 'publicIPPrefixes', 'type': '[ResourceReference]'}, + "public_ip_prefixes": {"key": "publicIPPrefixes", "type": "[ResourceReference]"}, } - def __init__( - self, - *, - public_ip_prefixes: Optional[List["_models.ResourceReference"]] = None, - **kwargs - ): + def __init__(self, *, public_ip_prefixes: Optional[List["_models.ResourceReference"]] = None, **kwargs): """ :keyword public_ip_prefixes: A list of public IP prefix resources. :paramtype public_ip_prefixes: list[~azure.mgmt.containerservice.v2022_04_02_preview.models.ResourceReference] """ - super(ManagedClusterLoadBalancerProfileOutboundIPPrefixes, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_ip_prefixes = public_ip_prefixes -class ManagedClusterLoadBalancerProfileOutboundIPs(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfileOutboundIPs(_serialization.Model): """Desired outbound IP resources for the cluster load balancer. :ivar public_i_ps: A list of public IP resources. @@ -4100,25 +4037,20 @@ class ManagedClusterLoadBalancerProfileOutboundIPs(msrest.serialization.Model): """ _attribute_map = { - 'public_i_ps': {'key': 'publicIPs', 'type': '[ResourceReference]'}, + "public_i_ps": {"key": "publicIPs", "type": "[ResourceReference]"}, } - def __init__( - self, - *, - public_i_ps: Optional[List["_models.ResourceReference"]] = None, - **kwargs - ): + def __init__(self, *, public_i_ps: Optional[List["_models.ResourceReference"]] = None, **kwargs): """ :keyword public_i_ps: A list of public IP resources. :paramtype public_i_ps: list[~azure.mgmt.containerservice.v2022_04_02_preview.models.ResourceReference] """ - super(ManagedClusterLoadBalancerProfileOutboundIPs, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_i_ps = public_i_ps -class ManagedClusterManagedOutboundIPProfile(msrest.serialization.Model): +class ManagedClusterManagedOutboundIPProfile(_serialization.Model): """Profile of the managed outbound IP resources of the managed cluster. :ivar count: The desired number of outbound IPs created/managed by Azure. Allowed values must @@ -4127,29 +4059,24 @@ class ManagedClusterManagedOutboundIPProfile(msrest.serialization.Model): """ _validation = { - 'count': {'maximum': 16, 'minimum': 1}, + "count": {"maximum": 16, "minimum": 1}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, + "count": {"key": "count", "type": "int"}, } - def __init__( - self, - *, - count: Optional[int] = 1, - **kwargs - ): + def __init__(self, *, count: int = 1, **kwargs): """ :keyword count: The desired number of outbound IPs created/managed by Azure. Allowed values must be in the range of 1 to 16 (inclusive). The default value is 1. :paramtype count: int """ - super(ManagedClusterManagedOutboundIPProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count -class ManagedClusterNATGatewayProfile(msrest.serialization.Model): +class ManagedClusterNATGatewayProfile(_serialization.Model): """Profile of the managed cluster NAT gateway. :ivar managed_outbound_ip_profile: Profile of the managed outbound IP resources of the cluster @@ -4165,13 +4092,16 @@ class ManagedClusterNATGatewayProfile(msrest.serialization.Model): """ _validation = { - 'idle_timeout_in_minutes': {'maximum': 120, 'minimum': 4}, + "idle_timeout_in_minutes": {"maximum": 120, "minimum": 4}, } _attribute_map = { - 'managed_outbound_ip_profile': {'key': 'managedOutboundIPProfile', 'type': 'ManagedClusterManagedOutboundIPProfile'}, - 'effective_outbound_i_ps': {'key': 'effectiveOutboundIPs', 'type': '[ResourceReference]'}, - 'idle_timeout_in_minutes': {'key': 'idleTimeoutInMinutes', 'type': 'int'}, + "managed_outbound_ip_profile": { + "key": "managedOutboundIPProfile", + "type": "ManagedClusterManagedOutboundIPProfile", + }, + "effective_outbound_i_ps": {"key": "effectiveOutboundIPs", "type": "[ResourceReference]"}, + "idle_timeout_in_minutes": {"key": "idleTimeoutInMinutes", "type": "int"}, } def __init__( @@ -4179,7 +4109,7 @@ def __init__( *, managed_outbound_ip_profile: Optional["_models.ManagedClusterManagedOutboundIPProfile"] = None, effective_outbound_i_ps: Optional[List["_models.ResourceReference"]] = None, - idle_timeout_in_minutes: Optional[int] = 4, + idle_timeout_in_minutes: int = 4, **kwargs ): """ @@ -4195,13 +4125,13 @@ def __init__( are in the range of 4 to 120 (inclusive). The default value is 4 minutes. :paramtype idle_timeout_in_minutes: int """ - super(ManagedClusterNATGatewayProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.managed_outbound_ip_profile = managed_outbound_ip_profile self.effective_outbound_i_ps = effective_outbound_i_ps self.idle_timeout_in_minutes = idle_timeout_in_minutes -class ManagedClusterOIDCIssuerProfile(msrest.serialization.Model): +class ManagedClusterOIDCIssuerProfile(_serialization.Model): """The OIDC issuer profile of the Managed Cluster. Variables are only populated by the server, and will be ignored when sending a request. @@ -4213,46 +4143,41 @@ class ManagedClusterOIDCIssuerProfile(msrest.serialization.Model): """ _validation = { - 'issuer_url': {'readonly': True}, + "issuer_url": {"readonly": True}, } _attribute_map = { - 'issuer_url': {'key': 'issuerURL', 'type': 'str'}, - 'enabled': {'key': 'enabled', 'type': 'bool'}, + "issuer_url": {"key": "issuerURL", "type": "str"}, + "enabled": {"key": "enabled", "type": "bool"}, } - def __init__( - self, - *, - enabled: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, enabled: Optional[bool] = None, **kwargs): """ :keyword enabled: Whether the OIDC issuer is enabled. :paramtype enabled: bool """ - super(ManagedClusterOIDCIssuerProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.issuer_url = None self.enabled = enabled -class ManagedClusterPodIdentity(msrest.serialization.Model): +class ManagedClusterPodIdentity(_serialization.Model): """Details about the pod identity assigned to the Managed Cluster. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar name: Required. The name of the pod identity. + :ivar name: The name of the pod identity. Required. :vartype name: str - :ivar namespace: Required. The namespace of the pod identity. + :ivar namespace: The namespace of the pod identity. Required. :vartype namespace: str :ivar binding_selector: The binding selector to use for the AzureIdentityBinding resource. :vartype binding_selector: str - :ivar identity: Required. The user assigned identity details. + :ivar identity: The user assigned identity details. Required. :vartype identity: ~azure.mgmt.containerservice.v2022_04_02_preview.models.UserAssignedIdentity :ivar provisioning_state: The current provisioning state of the pod identity. Known values are: - "Assigned", "Updating", "Deleting", "Failed". + "Assigned", "Updating", "Deleting", and "Failed". :vartype provisioning_state: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedClusterPodIdentityProvisioningState :ivar provisioning_info: @@ -4261,20 +4186,20 @@ class ManagedClusterPodIdentity(msrest.serialization.Model): """ _validation = { - 'name': {'required': True}, - 'namespace': {'required': True}, - 'identity': {'required': True}, - 'provisioning_state': {'readonly': True}, - 'provisioning_info': {'readonly': True}, + "name": {"required": True}, + "namespace": {"required": True}, + "identity": {"required": True}, + "provisioning_state": {"readonly": True}, + "provisioning_info": {"readonly": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'namespace': {'key': 'namespace', 'type': 'str'}, - 'binding_selector': {'key': 'bindingSelector', 'type': 'str'}, - 'identity': {'key': 'identity', 'type': 'UserAssignedIdentity'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'provisioning_info': {'key': 'provisioningInfo', 'type': 'ManagedClusterPodIdentityProvisioningInfo'}, + "name": {"key": "name", "type": "str"}, + "namespace": {"key": "namespace", "type": "str"}, + "binding_selector": {"key": "bindingSelector", "type": "str"}, + "identity": {"key": "identity", "type": "UserAssignedIdentity"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "provisioning_info": {"key": "provisioningInfo", "type": "ManagedClusterPodIdentityProvisioningInfo"}, } def __init__( @@ -4287,17 +4212,17 @@ def __init__( **kwargs ): """ - :keyword name: Required. The name of the pod identity. + :keyword name: The name of the pod identity. Required. :paramtype name: str - :keyword namespace: Required. The namespace of the pod identity. + :keyword namespace: The namespace of the pod identity. Required. :paramtype namespace: str :keyword binding_selector: The binding selector to use for the AzureIdentityBinding resource. :paramtype binding_selector: str - :keyword identity: Required. The user assigned identity details. + :keyword identity: The user assigned identity details. Required. :paramtype identity: ~azure.mgmt.containerservice.v2022_04_02_preview.models.UserAssignedIdentity """ - super(ManagedClusterPodIdentity, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.namespace = namespace self.binding_selector = binding_selector @@ -4306,54 +4231,47 @@ def __init__( self.provisioning_info = None -class ManagedClusterPodIdentityException(msrest.serialization.Model): +class ManagedClusterPodIdentityException(_serialization.Model): """See `disable AAD Pod Identity for a specific Pod/Application `_ for more details. All required parameters must be populated in order to send to Azure. - :ivar name: Required. The name of the pod identity exception. + :ivar name: The name of the pod identity exception. Required. :vartype name: str - :ivar namespace: Required. The namespace of the pod identity exception. + :ivar namespace: The namespace of the pod identity exception. Required. :vartype namespace: str - :ivar pod_labels: Required. The pod labels to match. + :ivar pod_labels: The pod labels to match. Required. :vartype pod_labels: dict[str, str] """ _validation = { - 'name': {'required': True}, - 'namespace': {'required': True}, - 'pod_labels': {'required': True}, + "name": {"required": True}, + "namespace": {"required": True}, + "pod_labels": {"required": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'namespace': {'key': 'namespace', 'type': 'str'}, - 'pod_labels': {'key': 'podLabels', 'type': '{str}'}, + "name": {"key": "name", "type": "str"}, + "namespace": {"key": "namespace", "type": "str"}, + "pod_labels": {"key": "podLabels", "type": "{str}"}, } - def __init__( - self, - *, - name: str, - namespace: str, - pod_labels: Dict[str, str], - **kwargs - ): + def __init__(self, *, name: str, namespace: str, pod_labels: Dict[str, str], **kwargs): """ - :keyword name: Required. The name of the pod identity exception. + :keyword name: The name of the pod identity exception. Required. :paramtype name: str - :keyword namespace: Required. The namespace of the pod identity exception. + :keyword namespace: The namespace of the pod identity exception. Required. :paramtype namespace: str - :keyword pod_labels: Required. The pod labels to match. + :keyword pod_labels: The pod labels to match. Required. :paramtype pod_labels: dict[str, str] """ - super(ManagedClusterPodIdentityException, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.namespace = namespace self.pod_labels = pod_labels -class ManagedClusterPodIdentityProfile(msrest.serialization.Model): +class ManagedClusterPodIdentityProfile(_serialization.Model): """See `use AAD pod identity `_ for more details on pod identity integration. :ivar enabled: Whether the pod identity addon is enabled. @@ -4373,10 +4291,13 @@ class ManagedClusterPodIdentityProfile(msrest.serialization.Model): """ _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'allow_network_plugin_kubenet': {'key': 'allowNetworkPluginKubenet', 'type': 'bool'}, - 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '[ManagedClusterPodIdentity]'}, - 'user_assigned_identity_exceptions': {'key': 'userAssignedIdentityExceptions', 'type': '[ManagedClusterPodIdentityException]'}, + "enabled": {"key": "enabled", "type": "bool"}, + "allow_network_plugin_kubenet": {"key": "allowNetworkPluginKubenet", "type": "bool"}, + "user_assigned_identities": {"key": "userAssignedIdentities", "type": "[ManagedClusterPodIdentity]"}, + "user_assigned_identity_exceptions": { + "key": "userAssignedIdentityExceptions", + "type": "[ManagedClusterPodIdentityException]", + }, } def __init__( @@ -4404,14 +4325,14 @@ def __init__( :paramtype user_assigned_identity_exceptions: list[~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedClusterPodIdentityException] """ - super(ManagedClusterPodIdentityProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.allow_network_plugin_kubenet = allow_network_plugin_kubenet self.user_assigned_identities = user_assigned_identities self.user_assigned_identity_exceptions = user_assigned_identity_exceptions -class ManagedClusterPodIdentityProvisioningError(msrest.serialization.Model): +class ManagedClusterPodIdentityProvisioningError(_serialization.Model): """An error response from the pod identity provisioning. :ivar error: Details about the error. @@ -4420,25 +4341,20 @@ class ManagedClusterPodIdentityProvisioningError(msrest.serialization.Model): """ _attribute_map = { - 'error': {'key': 'error', 'type': 'ManagedClusterPodIdentityProvisioningErrorBody'}, + "error": {"key": "error", "type": "ManagedClusterPodIdentityProvisioningErrorBody"}, } - def __init__( - self, - *, - error: Optional["_models.ManagedClusterPodIdentityProvisioningErrorBody"] = None, - **kwargs - ): + def __init__(self, *, error: Optional["_models.ManagedClusterPodIdentityProvisioningErrorBody"] = None, **kwargs): """ :keyword error: Details about the error. :paramtype error: ~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedClusterPodIdentityProvisioningErrorBody """ - super(ManagedClusterPodIdentityProvisioningError, self).__init__(**kwargs) + super().__init__(**kwargs) self.error = error -class ManagedClusterPodIdentityProvisioningErrorBody(msrest.serialization.Model): +class ManagedClusterPodIdentityProvisioningErrorBody(_serialization.Model): """An error response from the pod identity provisioning. :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed @@ -4456,10 +4372,10 @@ class ManagedClusterPodIdentityProvisioningErrorBody(msrest.serialization.Model) """ _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[ManagedClusterPodIdentityProvisioningErrorBody]'}, + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[ManagedClusterPodIdentityProvisioningErrorBody]"}, } def __init__( @@ -4485,14 +4401,14 @@ def __init__( :paramtype details: list[~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedClusterPodIdentityProvisioningErrorBody] """ - super(ManagedClusterPodIdentityProvisioningErrorBody, self).__init__(**kwargs) + super().__init__(**kwargs) self.code = code self.message = message self.target = target self.details = details -class ManagedClusterPodIdentityProvisioningInfo(msrest.serialization.Model): +class ManagedClusterPodIdentityProvisioningInfo(_serialization.Model): """ManagedClusterPodIdentityProvisioningInfo. :ivar error: Pod identity assignment error (if any). @@ -4501,35 +4417,30 @@ class ManagedClusterPodIdentityProvisioningInfo(msrest.serialization.Model): """ _attribute_map = { - 'error': {'key': 'error', 'type': 'ManagedClusterPodIdentityProvisioningError'}, + "error": {"key": "error", "type": "ManagedClusterPodIdentityProvisioningError"}, } - def __init__( - self, - *, - error: Optional["_models.ManagedClusterPodIdentityProvisioningError"] = None, - **kwargs - ): + def __init__(self, *, error: Optional["_models.ManagedClusterPodIdentityProvisioningError"] = None, **kwargs): """ :keyword error: Pod identity assignment error (if any). :paramtype error: ~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedClusterPodIdentityProvisioningError """ - super(ManagedClusterPodIdentityProvisioningInfo, self).__init__(**kwargs) + super().__init__(**kwargs) self.error = error -class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): +class ManagedClusterPoolUpgradeProfile(_serialization.Model): """The list of available upgrade versions. All required parameters must be populated in order to send to Azure. - :ivar kubernetes_version: Required. The Kubernetes version (major.minor.patch). + :ivar kubernetes_version: The Kubernetes version (major.minor.patch). Required. :vartype kubernetes_version: str :ivar name: The Agent Pool name. :vartype name: str - :ivar os_type: Required. The operating system type. The default is Linux. Known values are: - "Linux", "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -4537,15 +4448,15 @@ class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): """ _validation = { - 'kubernetes_version': {'required': True}, - 'os_type': {'required': True}, + "kubernetes_version": {"required": True}, + "os_type": {"required": True}, } _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'upgrades': {'key': 'upgrades', 'type': '[ManagedClusterPoolUpgradeProfileUpgradesItem]'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "os_type": {"key": "osType", "type": "str"}, + "upgrades": {"key": "upgrades", "type": "[ManagedClusterPoolUpgradeProfileUpgradesItem]"}, } def __init__( @@ -4558,25 +4469,25 @@ def __init__( **kwargs ): """ - :keyword kubernetes_version: Required. The Kubernetes version (major.minor.patch). + :keyword kubernetes_version: The Kubernetes version (major.minor.patch). Required. :paramtype kubernetes_version: str :keyword name: The Agent Pool name. :paramtype name: str - :keyword os_type: Required. The operating system type. The default is Linux. Known values are: - "Linux", "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: list[~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedClusterPoolUpgradeProfileUpgradesItem] """ - super(ManagedClusterPoolUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.name = name self.os_type = os_type self.upgrades = upgrades -class ManagedClusterPoolUpgradeProfileUpgradesItem(msrest.serialization.Model): +class ManagedClusterPoolUpgradeProfileUpgradesItem(_serialization.Model): """ManagedClusterPoolUpgradeProfileUpgradesItem. :ivar kubernetes_version: The Kubernetes version (major.minor.patch). @@ -4586,36 +4497,30 @@ class ManagedClusterPoolUpgradeProfileUpgradesItem(msrest.serialization.Model): """ _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } - def __init__( - self, - *, - kubernetes_version: Optional[str] = None, - is_preview: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, kubernetes_version: Optional[str] = None, is_preview: Optional[bool] = None, **kwargs): """ :keyword kubernetes_version: The Kubernetes version (major.minor.patch). :paramtype kubernetes_version: str :keyword is_preview: Whether the Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(ManagedClusterPoolUpgradeProfileUpgradesItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.is_preview = is_preview -class ManagedClusterPropertiesAutoScalerProfile(msrest.serialization.Model): +class ManagedClusterPropertiesAutoScalerProfile(_serialization.Model): # pylint: disable=too-many-instance-attributes """Parameters to be applied to the cluster-autoscaler when enabled. :ivar balance_similar_node_groups: Valid values are 'true' and 'false'. :vartype balance_similar_node_groups: str :ivar expander: If not specified, the default is 'random'. See `expanders `_ - for more information. Known values are: "least-waste", "most-pods", "priority", "random". + for more information. Known values are: "least-waste", "most-pods", "priority", and "random". :vartype expander: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.Expander :ivar max_empty_bulk_delete: The default is 10. :vartype max_empty_bulk_delete: str @@ -4659,23 +4564,23 @@ class ManagedClusterPropertiesAutoScalerProfile(msrest.serialization.Model): """ _attribute_map = { - 'balance_similar_node_groups': {'key': 'balance-similar-node-groups', 'type': 'str'}, - 'expander': {'key': 'expander', 'type': 'str'}, - 'max_empty_bulk_delete': {'key': 'max-empty-bulk-delete', 'type': 'str'}, - 'max_graceful_termination_sec': {'key': 'max-graceful-termination-sec', 'type': 'str'}, - 'max_node_provision_time': {'key': 'max-node-provision-time', 'type': 'str'}, - 'max_total_unready_percentage': {'key': 'max-total-unready-percentage', 'type': 'str'}, - 'new_pod_scale_up_delay': {'key': 'new-pod-scale-up-delay', 'type': 'str'}, - 'ok_total_unready_count': {'key': 'ok-total-unready-count', 'type': 'str'}, - 'scan_interval': {'key': 'scan-interval', 'type': 'str'}, - 'scale_down_delay_after_add': {'key': 'scale-down-delay-after-add', 'type': 'str'}, - 'scale_down_delay_after_delete': {'key': 'scale-down-delay-after-delete', 'type': 'str'}, - 'scale_down_delay_after_failure': {'key': 'scale-down-delay-after-failure', 'type': 'str'}, - 'scale_down_unneeded_time': {'key': 'scale-down-unneeded-time', 'type': 'str'}, - 'scale_down_unready_time': {'key': 'scale-down-unready-time', 'type': 'str'}, - 'scale_down_utilization_threshold': {'key': 'scale-down-utilization-threshold', 'type': 'str'}, - 'skip_nodes_with_local_storage': {'key': 'skip-nodes-with-local-storage', 'type': 'str'}, - 'skip_nodes_with_system_pods': {'key': 'skip-nodes-with-system-pods', 'type': 'str'}, + "balance_similar_node_groups": {"key": "balance-similar-node-groups", "type": "str"}, + "expander": {"key": "expander", "type": "str"}, + "max_empty_bulk_delete": {"key": "max-empty-bulk-delete", "type": "str"}, + "max_graceful_termination_sec": {"key": "max-graceful-termination-sec", "type": "str"}, + "max_node_provision_time": {"key": "max-node-provision-time", "type": "str"}, + "max_total_unready_percentage": {"key": "max-total-unready-percentage", "type": "str"}, + "new_pod_scale_up_delay": {"key": "new-pod-scale-up-delay", "type": "str"}, + "ok_total_unready_count": {"key": "ok-total-unready-count", "type": "str"}, + "scan_interval": {"key": "scan-interval", "type": "str"}, + "scale_down_delay_after_add": {"key": "scale-down-delay-after-add", "type": "str"}, + "scale_down_delay_after_delete": {"key": "scale-down-delay-after-delete", "type": "str"}, + "scale_down_delay_after_failure": {"key": "scale-down-delay-after-failure", "type": "str"}, + "scale_down_unneeded_time": {"key": "scale-down-unneeded-time", "type": "str"}, + "scale_down_unready_time": {"key": "scale-down-unready-time", "type": "str"}, + "scale_down_utilization_threshold": {"key": "scale-down-utilization-threshold", "type": "str"}, + "skip_nodes_with_local_storage": {"key": "skip-nodes-with-local-storage", "type": "str"}, + "skip_nodes_with_system_pods": {"key": "skip-nodes-with-system-pods", "type": "str"}, } def __init__( @@ -4705,7 +4610,7 @@ def __init__( :paramtype balance_similar_node_groups: str :keyword expander: If not specified, the default is 'random'. See `expanders `_ - for more information. Known values are: "least-waste", "most-pods", "priority", "random". + for more information. Known values are: "least-waste", "most-pods", "priority", and "random". :paramtype expander: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.Expander :keyword max_empty_bulk_delete: The default is 10. :paramtype max_empty_bulk_delete: str @@ -4748,7 +4653,7 @@ def __init__( :keyword skip_nodes_with_system_pods: The default is true. :paramtype skip_nodes_with_system_pods: str """ - super(ManagedClusterPropertiesAutoScalerProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.balance_similar_node_groups = balance_similar_node_groups self.expander = expander self.max_empty_bulk_delete = max_empty_bulk_delete @@ -4768,7 +4673,7 @@ def __init__( self.skip_nodes_with_system_pods = skip_nodes_with_system_pods -class ManagedClusterPropertiesForSnapshot(msrest.serialization.Model): +class ManagedClusterPropertiesForSnapshot(_serialization.Model): """managed cluster properties for snapshot, these properties are read only. Variables are only populated by the server, and will be ignored when sending a request. @@ -4785,14 +4690,14 @@ class ManagedClusterPropertiesForSnapshot(msrest.serialization.Model): """ _validation = { - 'network_profile': {'readonly': True}, + "network_profile": {"readonly": True}, } _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'ManagedClusterSKU'}, - 'enable_rbac': {'key': 'enableRbac', 'type': 'bool'}, - 'network_profile': {'key': 'networkProfile', 'type': 'NetworkProfileForSnapshot'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "sku": {"key": "sku", "type": "ManagedClusterSKU"}, + "enable_rbac": {"key": "enableRbac", "type": "bool"}, + "network_profile": {"key": "networkProfile", "type": "NetworkProfileForSnapshot"}, } def __init__( @@ -4812,14 +4717,14 @@ def __init__( not. :paramtype enable_rbac: bool """ - super(ManagedClusterPropertiesForSnapshot, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.sku = sku self.enable_rbac = enable_rbac self.network_profile = None -class ManagedClusterSecurityProfile(msrest.serialization.Model): +class ManagedClusterSecurityProfile(_serialization.Model): """Security profile for the container service cluster. :ivar azure_defender: Azure Defender settings for the security profile. @@ -4837,9 +4742,9 @@ class ManagedClusterSecurityProfile(msrest.serialization.Model): """ _attribute_map = { - 'azure_defender': {'key': 'azureDefender', 'type': 'ManagedClusterSecurityProfileAzureDefender'}, - 'azure_key_vault_kms': {'key': 'azureKeyVaultKms', 'type': 'AzureKeyVaultKms'}, - 'workload_identity': {'key': 'workloadIdentity', 'type': 'ManagedClusterSecurityProfileWorkloadIdentity'}, + "azure_defender": {"key": "azureDefender", "type": "ManagedClusterSecurityProfileAzureDefender"}, + "azure_key_vault_kms": {"key": "azureKeyVaultKms", "type": "AzureKeyVaultKms"}, + "workload_identity": {"key": "workloadIdentity", "type": "ManagedClusterSecurityProfileWorkloadIdentity"}, } def __init__( @@ -4864,13 +4769,13 @@ def __init__( :paramtype workload_identity: ~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedClusterSecurityProfileWorkloadIdentity """ - super(ManagedClusterSecurityProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.azure_defender = azure_defender self.azure_key_vault_kms = azure_key_vault_kms self.workload_identity = workload_identity -class ManagedClusterSecurityProfileAzureDefender(msrest.serialization.Model): +class ManagedClusterSecurityProfileAzureDefender(_serialization.Model): """Azure Defender settings for the security profile. :ivar enabled: Whether to enable Azure Defender. @@ -4882,16 +4787,12 @@ class ManagedClusterSecurityProfileAzureDefender(msrest.serialization.Model): """ _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'log_analytics_workspace_resource_id': {'key': 'logAnalyticsWorkspaceResourceId', 'type': 'str'}, + "enabled": {"key": "enabled", "type": "bool"}, + "log_analytics_workspace_resource_id": {"key": "logAnalyticsWorkspaceResourceId", "type": "str"}, } def __init__( - self, - *, - enabled: Optional[bool] = None, - log_analytics_workspace_resource_id: Optional[str] = None, - **kwargs + self, *, enabled: Optional[bool] = None, log_analytics_workspace_resource_id: Optional[str] = None, **kwargs ): """ :keyword enabled: Whether to enable Azure Defender. @@ -4901,12 +4802,12 @@ def __init__( must be a valid workspace resource ID. When Azure Defender is disabled, leave the field empty. :paramtype log_analytics_workspace_resource_id: str """ - super(ManagedClusterSecurityProfileAzureDefender, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.log_analytics_workspace_resource_id = log_analytics_workspace_resource_id -class ManagedClusterSecurityProfileWorkloadIdentity(msrest.serialization.Model): +class ManagedClusterSecurityProfileWorkloadIdentity(_serialization.Model): """Workload Identity settings for the security profile. :ivar enabled: Whether to enable Workload Identity. @@ -4914,77 +4815,66 @@ class ManagedClusterSecurityProfileWorkloadIdentity(msrest.serialization.Model): """ _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, + "enabled": {"key": "enabled", "type": "bool"}, } - def __init__( - self, - *, - enabled: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, enabled: Optional[bool] = None, **kwargs): """ :keyword enabled: Whether to enable Workload Identity. :paramtype enabled: bool """ - super(ManagedClusterSecurityProfileWorkloadIdentity, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled -class ManagedClusterServicePrincipalProfile(msrest.serialization.Model): +class ManagedClusterServicePrincipalProfile(_serialization.Model): """Information about a service principal identity for the cluster to use for manipulating Azure APIs. All required parameters must be populated in order to send to Azure. - :ivar client_id: Required. The ID for the service principal. + :ivar client_id: The ID for the service principal. Required. :vartype client_id: str :ivar secret: The secret password associated with the service principal in plain text. :vartype secret: str """ _validation = { - 'client_id': {'required': True}, + "client_id": {"required": True}, } _attribute_map = { - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'secret': {'key': 'secret', 'type': 'str'}, + "client_id": {"key": "clientId", "type": "str"}, + "secret": {"key": "secret", "type": "str"}, } - def __init__( - self, - *, - client_id: str, - secret: Optional[str] = None, - **kwargs - ): + def __init__(self, *, client_id: str, secret: Optional[str] = None, **kwargs): """ - :keyword client_id: Required. The ID for the service principal. + :keyword client_id: The ID for the service principal. Required. :paramtype client_id: str :keyword secret: The secret password associated with the service principal in plain text. :paramtype secret: str """ - super(ManagedClusterServicePrincipalProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.client_id = client_id self.secret = secret -class ManagedClusterSKU(msrest.serialization.Model): +class ManagedClusterSKU(_serialization.Model): """The SKU of a Managed Cluster. - :ivar name: The name of a managed cluster SKU. Known values are: "Basic". + :ivar name: The name of a managed cluster SKU. "Basic" :vartype name: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedClusterSKUName :ivar tier: If not specified, the default is 'Free'. See `uptime SLA - `_ for more details. Known values are: "Paid", - "Free". + `_ for more details. Known values are: "Paid" + and "Free". :vartype tier: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedClusterSKUTier """ _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, + "name": {"key": "name", "type": "str"}, + "tier": {"key": "tier", "type": "str"}, } def __init__( @@ -4995,16 +4885,16 @@ def __init__( **kwargs ): """ - :keyword name: The name of a managed cluster SKU. Known values are: "Basic". + :keyword name: The name of a managed cluster SKU. "Basic" :paramtype name: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedClusterSKUName :keyword tier: If not specified, the default is 'Free'. See `uptime SLA - `_ for more details. Known values are: "Paid", - "Free". + `_ for more details. Known values are: "Paid" + and "Free". :paramtype tier: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedClusterSKUTier """ - super(ManagedClusterSKU, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.tier = tier @@ -5027,15 +4917,15 @@ class ManagedClusterSnapshot(TrackedResource): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.containerservice.v2022_04_02_preview.models.SystemData - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] - :ivar location: Required. The geo-location where the resource lives. + :ivar location: The geo-location where the resource lives. Required. :vartype location: str :ivar creation_data: CreationData to be used to specify the source resource ID to create this snapshot. :vartype creation_data: ~azure.mgmt.containerservice.v2022_04_02_preview.models.CreationData :ivar snapshot_type: The type of a snapshot. The default is NodePool. Known values are: - "NodePool", "ManagedCluster". Default value: "NodePool". + "NodePool" and "ManagedCluster". :vartype snapshot_type: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.SnapshotType :ivar managed_cluster_properties_read_only: What the properties will be showed when getting @@ -5045,24 +4935,27 @@ class ManagedClusterSnapshot(TrackedResource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'location': {'required': True}, - 'managed_cluster_properties_read_only': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, + "managed_cluster_properties_read_only": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - 'creation_data': {'key': 'properties.creationData', 'type': 'CreationData'}, - 'snapshot_type': {'key': 'properties.snapshotType', 'type': 'str'}, - 'managed_cluster_properties_read_only': {'key': 'properties.managedClusterPropertiesReadOnly', 'type': 'ManagedClusterPropertiesForSnapshot'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "creation_data": {"key": "properties.creationData", "type": "CreationData"}, + "snapshot_type": {"key": "properties.snapshotType", "type": "str"}, + "managed_cluster_properties_read_only": { + "key": "properties.managedClusterPropertiesReadOnly", + "type": "ManagedClusterPropertiesForSnapshot", + }, } def __init__( @@ -5071,29 +4964,29 @@ def __init__( location: str, tags: Optional[Dict[str, str]] = None, creation_data: Optional["_models.CreationData"] = None, - snapshot_type: Optional[Union[str, "_models.SnapshotType"]] = "NodePool", + snapshot_type: Union[str, "_models.SnapshotType"] = "NodePool", **kwargs ): """ - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] - :keyword location: Required. The geo-location where the resource lives. + :keyword location: The geo-location where the resource lives. Required. :paramtype location: str :keyword creation_data: CreationData to be used to specify the source resource ID to create this snapshot. :paramtype creation_data: ~azure.mgmt.containerservice.v2022_04_02_preview.models.CreationData :keyword snapshot_type: The type of a snapshot. The default is NodePool. Known values are: - "NodePool", "ManagedCluster". Default value: "NodePool". + "NodePool" and "ManagedCluster". :paramtype snapshot_type: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.SnapshotType """ - super(ManagedClusterSnapshot, self).__init__(tags=tags, location=location, **kwargs) + super().__init__(tags=tags, location=location, **kwargs) self.creation_data = creation_data self.snapshot_type = snapshot_type self.managed_cluster_properties_read_only = None -class ManagedClusterSnapshotListResult(msrest.serialization.Model): +class ManagedClusterSnapshotListResult(_serialization.Model): """The response from the List Managed Cluster Snapshots operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -5106,31 +4999,26 @@ class ManagedClusterSnapshotListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[ManagedClusterSnapshot]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[ManagedClusterSnapshot]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.ManagedClusterSnapshot"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.ManagedClusterSnapshot"]] = None, **kwargs): """ :keyword value: The list of managed cluster snapshots. :paramtype value: list[~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedClusterSnapshot] """ - super(ManagedClusterSnapshotListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class ManagedClusterStorageProfile(msrest.serialization.Model): +class ManagedClusterStorageProfile(_serialization.Model): """Storage profile for the container service cluster. :ivar disk_csi_driver: AzureDisk CSI Driver settings for the storage profile. @@ -5145,9 +5033,9 @@ class ManagedClusterStorageProfile(msrest.serialization.Model): """ _attribute_map = { - 'disk_csi_driver': {'key': 'diskCSIDriver', 'type': 'ManagedClusterStorageProfileDiskCSIDriver'}, - 'file_csi_driver': {'key': 'fileCSIDriver', 'type': 'ManagedClusterStorageProfileFileCSIDriver'}, - 'snapshot_controller': {'key': 'snapshotController', 'type': 'ManagedClusterStorageProfileSnapshotController'}, + "disk_csi_driver": {"key": "diskCSIDriver", "type": "ManagedClusterStorageProfileDiskCSIDriver"}, + "file_csi_driver": {"key": "fileCSIDriver", "type": "ManagedClusterStorageProfileFileCSIDriver"}, + "snapshot_controller": {"key": "snapshotController", "type": "ManagedClusterStorageProfileSnapshotController"}, } def __init__( @@ -5169,13 +5057,13 @@ def __init__( :paramtype snapshot_controller: ~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedClusterStorageProfileSnapshotController """ - super(ManagedClusterStorageProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.disk_csi_driver = disk_csi_driver self.file_csi_driver = file_csi_driver self.snapshot_controller = snapshot_controller -class ManagedClusterStorageProfileDiskCSIDriver(msrest.serialization.Model): +class ManagedClusterStorageProfileDiskCSIDriver(_serialization.Model): """AzureDisk CSI Driver settings for the storage profile. :ivar enabled: Whether to enable AzureDisk CSI Driver. The default value is true. @@ -5185,29 +5073,23 @@ class ManagedClusterStorageProfileDiskCSIDriver(msrest.serialization.Model): """ _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'version': {'key': 'version', 'type': 'str'}, + "enabled": {"key": "enabled", "type": "bool"}, + "version": {"key": "version", "type": "str"}, } - def __init__( - self, - *, - enabled: Optional[bool] = None, - version: Optional[str] = None, - **kwargs - ): + def __init__(self, *, enabled: Optional[bool] = None, version: Optional[str] = None, **kwargs): """ :keyword enabled: Whether to enable AzureDisk CSI Driver. The default value is true. :paramtype enabled: bool :keyword version: The version of AzureDisk CSI Driver. The default value is v1. :paramtype version: str """ - super(ManagedClusterStorageProfileDiskCSIDriver, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.version = version -class ManagedClusterStorageProfileFileCSIDriver(msrest.serialization.Model): +class ManagedClusterStorageProfileFileCSIDriver(_serialization.Model): """AzureFile CSI Driver settings for the storage profile. :ivar enabled: Whether to enable AzureFile CSI Driver. The default value is true. @@ -5215,24 +5097,19 @@ class ManagedClusterStorageProfileFileCSIDriver(msrest.serialization.Model): """ _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, + "enabled": {"key": "enabled", "type": "bool"}, } - def __init__( - self, - *, - enabled: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, enabled: Optional[bool] = None, **kwargs): """ :keyword enabled: Whether to enable AzureFile CSI Driver. The default value is true. :paramtype enabled: bool """ - super(ManagedClusterStorageProfileFileCSIDriver, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled -class ManagedClusterStorageProfileSnapshotController(msrest.serialization.Model): +class ManagedClusterStorageProfileSnapshotController(_serialization.Model): """Snapshot Controller settings for the storage profile. :ivar enabled: Whether to enable Snapshot Controller. The default value is true. @@ -5240,24 +5117,19 @@ class ManagedClusterStorageProfileSnapshotController(msrest.serialization.Model) """ _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, + "enabled": {"key": "enabled", "type": "bool"}, } - def __init__( - self, - *, - enabled: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, enabled: Optional[bool] = None, **kwargs): """ :keyword enabled: Whether to enable Snapshot Controller. The default value is true. :paramtype enabled: bool """ - super(ManagedClusterStorageProfileSnapshotController, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled -class ManagedClusterUpgradeProfile(msrest.serialization.Model): +class ManagedClusterUpgradeProfile(_serialization.Model): """The list of available upgrades for compute pools. Variables are only populated by the server, and will be ignored when sending a request. @@ -5270,29 +5142,29 @@ class ManagedClusterUpgradeProfile(msrest.serialization.Model): :vartype name: str :ivar type: The type of the upgrade profile. :vartype type: str - :ivar control_plane_profile: Required. The list of available upgrade versions for the control - plane. + :ivar control_plane_profile: The list of available upgrade versions for the control plane. + Required. :vartype control_plane_profile: ~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedClusterPoolUpgradeProfile - :ivar agent_pool_profiles: Required. The list of available upgrade versions for agent pools. + :ivar agent_pool_profiles: The list of available upgrade versions for agent pools. Required. :vartype agent_pool_profiles: list[~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedClusterPoolUpgradeProfile] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'control_plane_profile': {'required': True}, - 'agent_pool_profiles': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "control_plane_profile": {"required": True}, + "agent_pool_profiles": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'control_plane_profile': {'key': 'properties.controlPlaneProfile', 'type': 'ManagedClusterPoolUpgradeProfile'}, - 'agent_pool_profiles': {'key': 'properties.agentPoolProfiles', 'type': '[ManagedClusterPoolUpgradeProfile]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "control_plane_profile": {"key": "properties.controlPlaneProfile", "type": "ManagedClusterPoolUpgradeProfile"}, + "agent_pool_profiles": {"key": "properties.agentPoolProfiles", "type": "[ManagedClusterPoolUpgradeProfile]"}, } def __init__( @@ -5303,15 +5175,15 @@ def __init__( **kwargs ): """ - :keyword control_plane_profile: Required. The list of available upgrade versions for the - control plane. + :keyword control_plane_profile: The list of available upgrade versions for the control plane. + Required. :paramtype control_plane_profile: ~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedClusterPoolUpgradeProfile - :keyword agent_pool_profiles: Required. The list of available upgrade versions for agent pools. + :keyword agent_pool_profiles: The list of available upgrade versions for agent pools. Required. :paramtype agent_pool_profiles: list[~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedClusterPoolUpgradeProfile] """ - super(ManagedClusterUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -5319,18 +5191,18 @@ def __init__( self.agent_pool_profiles = agent_pool_profiles -class ManagedClusterWindowsProfile(msrest.serialization.Model): +class ManagedClusterWindowsProfile(_serialization.Model): """Profile for Windows VMs in the managed cluster. All required parameters must be populated in order to send to Azure. - :ivar admin_username: Required. Specifies the name of the administrator account. - :code:`
`:code:`
` **Restriction:** Cannot end in "." :code:`
`:code:`
` - **Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", "test1", - "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", - "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", - "sys", "test2", "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 - character :code:`
`:code:`
` **Max-length:** 20 characters. + :ivar admin_username: Specifies the name of the administrator account. :code:`
`:code:`
` + **Restriction:** Cannot end in "." :code:`
`:code:`
` **Disallowed values:** + "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", + "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", + "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", + "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 character + :code:`
`:code:`
` **Max-length:** 20 characters. Required. :vartype admin_username: str :ivar admin_password: Specifies the password of the administrator account. :code:`
`:code:`
` **Minimum-length:** 8 characters :code:`
`:code:`
` @@ -5342,7 +5214,7 @@ class ManagedClusterWindowsProfile(msrest.serialization.Model): :vartype admin_password: str :ivar license_type: The license type to use for Windows VMs. See `Azure Hybrid User Benefits `_ for more details. Known values are: - "None", "Windows_Server". + "None" and "Windows_Server". :vartype license_type: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.LicenseType :ivar enable_csi_proxy: For more details on CSI proxy, see the `CSI proxy GitHub repo @@ -5354,15 +5226,15 @@ class ManagedClusterWindowsProfile(msrest.serialization.Model): """ _validation = { - 'admin_username': {'required': True}, + "admin_username": {"required": True}, } _attribute_map = { - 'admin_username': {'key': 'adminUsername', 'type': 'str'}, - 'admin_password': {'key': 'adminPassword', 'type': 'str'}, - 'license_type': {'key': 'licenseType', 'type': 'str'}, - 'enable_csi_proxy': {'key': 'enableCSIProxy', 'type': 'bool'}, - 'gmsa_profile': {'key': 'gmsaProfile', 'type': 'WindowsGmsaProfile'}, + "admin_username": {"key": "adminUsername", "type": "str"}, + "admin_password": {"key": "adminPassword", "type": "str"}, + "license_type": {"key": "licenseType", "type": "str"}, + "enable_csi_proxy": {"key": "enableCSIProxy", "type": "bool"}, + "gmsa_profile": {"key": "gmsaProfile", "type": "WindowsGmsaProfile"}, } def __init__( @@ -5376,13 +5248,13 @@ def __init__( **kwargs ): """ - :keyword admin_username: Required. Specifies the name of the administrator account. + :keyword admin_username: Specifies the name of the administrator account. :code:`
`:code:`
` **Restriction:** Cannot end in "." :code:`
`:code:`
` **Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 - character :code:`
`:code:`
` **Max-length:** 20 characters. + character :code:`
`:code:`
` **Max-length:** 20 characters. Required. :paramtype admin_username: str :keyword admin_password: Specifies the password of the administrator account. :code:`
`:code:`
` **Minimum-length:** 8 characters :code:`
`:code:`
` @@ -5394,7 +5266,7 @@ def __init__( :paramtype admin_password: str :keyword license_type: The license type to use for Windows VMs. See `Azure Hybrid User Benefits `_ for more details. Known values are: - "None", "Windows_Server". + "None" and "Windows_Server". :paramtype license_type: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.LicenseType :keyword enable_csi_proxy: For more details on CSI proxy, see the `CSI proxy GitHub repo @@ -5404,7 +5276,7 @@ def __init__( :paramtype gmsa_profile: ~azure.mgmt.containerservice.v2022_04_02_preview.models.WindowsGmsaProfile """ - super(ManagedClusterWindowsProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.admin_username = admin_username self.admin_password = admin_password self.license_type = license_type @@ -5412,7 +5284,7 @@ def __init__( self.gmsa_profile = gmsa_profile -class ManagedServiceIdentityUserAssignedIdentitiesValue(msrest.serialization.Model): +class ManagedServiceIdentityUserAssignedIdentitiesValue(_serialization.Model): """ManagedServiceIdentityUserAssignedIdentitiesValue. Variables are only populated by the server, and will be ignored when sending a request. @@ -5424,63 +5296,58 @@ class ManagedServiceIdentityUserAssignedIdentitiesValue(msrest.serialization.Mod """ _validation = { - 'principal_id': {'readonly': True}, - 'client_id': {'readonly': True}, + "principal_id": {"readonly": True}, + "client_id": {"readonly": True}, } _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, + "principal_id": {"key": "principalId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(ManagedServiceIdentityUserAssignedIdentitiesValue, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.principal_id = None self.client_id = None -class NetworkProfileForSnapshot(msrest.serialization.Model): +class NetworkProfileForSnapshot(_serialization.Model): """network profile for managed cluster snapshot, these properties are read only. :ivar network_plugin: networkPlugin for managed cluster snapshot. Known values are: "azure", - "kubenet", "none". Default value: "kubenet". + "kubenet", and "none". :vartype network_plugin: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.NetworkPlugin - :ivar network_plugin_mode: NetworkPluginMode for managed cluster snapshot. Known values are: - "Overlay". + :ivar network_plugin_mode: NetworkPluginMode for managed cluster snapshot. "Overlay" :vartype network_plugin_mode: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.NetworkPluginMode - :ivar network_policy: networkPolicy for managed cluster snapshot. Known values are: "calico", - "azure". + :ivar network_policy: networkPolicy for managed cluster snapshot. Known values are: "calico" + and "azure". :vartype network_policy: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.NetworkPolicy - :ivar network_mode: networkMode for managed cluster snapshot. Known values are: "transparent", - "bridge". + :ivar network_mode: networkMode for managed cluster snapshot. Known values are: "transparent" + and "bridge". :vartype network_mode: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.NetworkMode :ivar load_balancer_sku: loadBalancerSku for managed cluster snapshot. Known values are: - "standard", "basic". + "standard" and "basic". :vartype load_balancer_sku: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.LoadBalancerSku """ _attribute_map = { - 'network_plugin': {'key': 'networkPlugin', 'type': 'str'}, - 'network_plugin_mode': {'key': 'networkPluginMode', 'type': 'str'}, - 'network_policy': {'key': 'networkPolicy', 'type': 'str'}, - 'network_mode': {'key': 'networkMode', 'type': 'str'}, - 'load_balancer_sku': {'key': 'loadBalancerSku', 'type': 'str'}, + "network_plugin": {"key": "networkPlugin", "type": "str"}, + "network_plugin_mode": {"key": "networkPluginMode", "type": "str"}, + "network_policy": {"key": "networkPolicy", "type": "str"}, + "network_mode": {"key": "networkMode", "type": "str"}, + "load_balancer_sku": {"key": "loadBalancerSku", "type": "str"}, } def __init__( self, *, - network_plugin: Optional[Union[str, "_models.NetworkPlugin"]] = "kubenet", + network_plugin: Union[str, "_models.NetworkPlugin"] = "kubenet", network_plugin_mode: Optional[Union[str, "_models.NetworkPluginMode"]] = None, network_policy: Optional[Union[str, "_models.NetworkPolicy"]] = None, network_mode: Optional[Union[str, "_models.NetworkMode"]] = None, @@ -5489,27 +5356,26 @@ def __init__( ): """ :keyword network_plugin: networkPlugin for managed cluster snapshot. Known values are: "azure", - "kubenet", "none". Default value: "kubenet". + "kubenet", and "none". :paramtype network_plugin: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.NetworkPlugin - :keyword network_plugin_mode: NetworkPluginMode for managed cluster snapshot. Known values are: - "Overlay". + :keyword network_plugin_mode: NetworkPluginMode for managed cluster snapshot. "Overlay" :paramtype network_plugin_mode: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.NetworkPluginMode - :keyword network_policy: networkPolicy for managed cluster snapshot. Known values are: - "calico", "azure". + :keyword network_policy: networkPolicy for managed cluster snapshot. Known values are: "calico" + and "azure". :paramtype network_policy: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.NetworkPolicy :keyword network_mode: networkMode for managed cluster snapshot. Known values are: - "transparent", "bridge". + "transparent" and "bridge". :paramtype network_mode: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.NetworkMode :keyword load_balancer_sku: loadBalancerSku for managed cluster snapshot. Known values are: - "standard", "basic". + "standard" and "basic". :paramtype load_balancer_sku: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.LoadBalancerSku """ - super(NetworkProfileForSnapshot, self).__init__(**kwargs) + super().__init__(**kwargs) self.network_plugin = network_plugin self.network_plugin_mode = network_plugin_mode self.network_policy = network_policy @@ -5517,7 +5383,7 @@ def __init__( self.load_balancer_sku = load_balancer_sku -class OperationListResult(msrest.serialization.Model): +class OperationListResult(_serialization.Model): """The List Operation response. Variables are only populated by the server, and will be ignored when sending a request. @@ -5527,24 +5393,20 @@ class OperationListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[OperationValue]'}, + "value": {"key": "value", "type": "[OperationValue]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(OperationListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None -class OperationValue(msrest.serialization.Model): +class OperationValue(_serialization.Model): """Describes the properties of a Operation value. Variables are only populated by the server, and will be ignored when sending a request. @@ -5564,30 +5426,26 @@ class OperationValue(msrest.serialization.Model): """ _validation = { - 'origin': {'readonly': True}, - 'name': {'readonly': True}, - 'operation': {'readonly': True}, - 'resource': {'readonly': True}, - 'description': {'readonly': True}, - 'provider': {'readonly': True}, + "origin": {"readonly": True}, + "name": {"readonly": True}, + "operation": {"readonly": True}, + "resource": {"readonly": True}, + "description": {"readonly": True}, + "provider": {"readonly": True}, } _attribute_map = { - 'origin': {'key': 'origin', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'operation': {'key': 'display.operation', 'type': 'str'}, - 'resource': {'key': 'display.resource', 'type': 'str'}, - 'description': {'key': 'display.description', 'type': 'str'}, - 'provider': {'key': 'display.provider', 'type': 'str'}, + "origin": {"key": "origin", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "operation": {"key": "display.operation", "type": "str"}, + "resource": {"key": "display.resource", "type": "str"}, + "description": {"key": "display.description", "type": "str"}, + "provider": {"key": "display.provider", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(OperationValue, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.origin = None self.name = None self.operation = None @@ -5596,7 +5454,7 @@ def __init__( self.provider = None -class OSOptionProfile(msrest.serialization.Model): +class OSOptionProfile(_serialization.Model): """The OS option profile. Variables are only populated by the server, and will be ignored when sending a request. @@ -5609,83 +5467,72 @@ class OSOptionProfile(msrest.serialization.Model): :vartype name: str :ivar type: The type of the OS option resource. :vartype type: str - :ivar os_option_property_list: Required. The list of OS options. + :ivar os_option_property_list: The list of OS options. Required. :vartype os_option_property_list: list[~azure.mgmt.containerservice.v2022_04_02_preview.models.OSOptionProperty] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'os_option_property_list': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "os_option_property_list": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'os_option_property_list': {'key': 'properties.osOptionPropertyList', 'type': '[OSOptionProperty]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "os_option_property_list": {"key": "properties.osOptionPropertyList", "type": "[OSOptionProperty]"}, } - def __init__( - self, - *, - os_option_property_list: List["_models.OSOptionProperty"], - **kwargs - ): + def __init__(self, *, os_option_property_list: List["_models.OSOptionProperty"], **kwargs): """ - :keyword os_option_property_list: Required. The list of OS options. + :keyword os_option_property_list: The list of OS options. Required. :paramtype os_option_property_list: list[~azure.mgmt.containerservice.v2022_04_02_preview.models.OSOptionProperty] """ - super(OSOptionProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None self.os_option_property_list = os_option_property_list -class OSOptionProperty(msrest.serialization.Model): +class OSOptionProperty(_serialization.Model): """OS option property. All required parameters must be populated in order to send to Azure. - :ivar os_type: Required. The OS type. + :ivar os_type: The OS type. Required. :vartype os_type: str - :ivar enable_fips_image: Required. Whether the image is FIPS-enabled. + :ivar enable_fips_image: Whether the image is FIPS-enabled. Required. :vartype enable_fips_image: bool """ _validation = { - 'os_type': {'required': True}, - 'enable_fips_image': {'required': True}, + "os_type": {"required": True}, + "enable_fips_image": {"required": True}, } _attribute_map = { - 'os_type': {'key': 'os-type', 'type': 'str'}, - 'enable_fips_image': {'key': 'enable-fips-image', 'type': 'bool'}, + "os_type": {"key": "os-type", "type": "str"}, + "enable_fips_image": {"key": "enable-fips-image", "type": "bool"}, } - def __init__( - self, - *, - os_type: str, - enable_fips_image: bool, - **kwargs - ): + def __init__(self, *, os_type: str, enable_fips_image: bool, **kwargs): """ - :keyword os_type: Required. The OS type. + :keyword os_type: The OS type. Required. :paramtype os_type: str - :keyword enable_fips_image: Required. Whether the image is FIPS-enabled. + :keyword enable_fips_image: Whether the image is FIPS-enabled. Required. :paramtype enable_fips_image: bool """ - super(OSOptionProperty, self).__init__(**kwargs) + super().__init__(**kwargs) self.os_type = os_type self.enable_fips_image = enable_fips_image -class OutboundEnvironmentEndpoint(msrest.serialization.Model): +class OutboundEnvironmentEndpoint(_serialization.Model): """Egress endpoints which AKS agent nodes connect to for common purpose. :ivar category: The category of endpoints accessed by the AKS agent node, e.g. @@ -5697,8 +5544,8 @@ class OutboundEnvironmentEndpoint(msrest.serialization.Model): """ _attribute_map = { - 'category': {'key': 'category', 'type': 'str'}, - 'endpoints': {'key': 'endpoints', 'type': '[EndpointDependency]'}, + "category": {"key": "category", "type": "str"}, + "endpoints": {"key": "endpoints", "type": "[EndpointDependency]"}, } def __init__( @@ -5716,19 +5563,19 @@ def __init__( :paramtype endpoints: list[~azure.mgmt.containerservice.v2022_04_02_preview.models.EndpointDependency] """ - super(OutboundEnvironmentEndpoint, self).__init__(**kwargs) + super().__init__(**kwargs) self.category = category self.endpoints = endpoints -class OutboundEnvironmentEndpointCollection(msrest.serialization.Model): +class OutboundEnvironmentEndpointCollection(_serialization.Model): """Collection of OutboundEnvironmentEndpoint. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar value: Required. Collection of resources. + :ivar value: Collection of resources. Required. :vartype value: list[~azure.mgmt.containerservice.v2022_04_02_preview.models.OutboundEnvironmentEndpoint] :ivar next_link: Link to next page of resources. @@ -5736,59 +5583,49 @@ class OutboundEnvironmentEndpointCollection(msrest.serialization.Model): """ _validation = { - 'value': {'required': True}, - 'next_link': {'readonly': True}, + "value": {"required": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[OutboundEnvironmentEndpoint]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[OutboundEnvironmentEndpoint]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: List["_models.OutboundEnvironmentEndpoint"], - **kwargs - ): + def __init__(self, *, value: List["_models.OutboundEnvironmentEndpoint"], **kwargs): """ - :keyword value: Required. Collection of resources. + :keyword value: Collection of resources. Required. :paramtype value: list[~azure.mgmt.containerservice.v2022_04_02_preview.models.OutboundEnvironmentEndpoint] """ - super(OutboundEnvironmentEndpointCollection, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class PowerState(msrest.serialization.Model): +class PowerState(_serialization.Model): """Describes the Power State of the cluster. - :ivar code: Tells whether the cluster is Running or Stopped. Known values are: "Running", + :ivar code: Tells whether the cluster is Running or Stopped. Known values are: "Running" and "Stopped". :vartype code: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.Code """ _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, + "code": {"key": "code", "type": "str"}, } - def __init__( - self, - *, - code: Optional[Union[str, "_models.Code"]] = None, - **kwargs - ): + def __init__(self, *, code: Optional[Union[str, "_models.Code"]] = None, **kwargs): """ - :keyword code: Tells whether the cluster is Running or Stopped. Known values are: "Running", + :keyword code: Tells whether the cluster is Running or Stopped. Known values are: "Running" and "Stopped". :paramtype code: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.Code """ - super(PowerState, self).__init__(**kwargs) + super().__init__(**kwargs) self.code = code -class PrivateEndpoint(msrest.serialization.Model): +class PrivateEndpoint(_serialization.Model): """Private endpoint which a connection belongs to. :ivar id: The resource ID of the private endpoint. @@ -5796,24 +5633,19 @@ class PrivateEndpoint(msrest.serialization.Model): """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, } - def __init__( - self, - *, - id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin """ :keyword id: The resource ID of the private endpoint. :paramtype id: str """ - super(PrivateEndpoint, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id -class PrivateEndpointConnection(msrest.serialization.Model): +class PrivateEndpointConnection(_serialization.Model): """A private endpoint connection. Variables are only populated by the server, and will be ignored when sending a request. @@ -5825,7 +5657,7 @@ class PrivateEndpointConnection(msrest.serialization.Model): :ivar type: The resource type. :vartype type: str :ivar provisioning_state: The current provisioning state. Known values are: "Succeeded", - "Creating", "Deleting", "Failed". + "Creating", "Deleting", and "Failed". :vartype provisioning_state: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.PrivateEndpointConnectionProvisioningState :ivar private_endpoint: The resource of private endpoint. @@ -5838,19 +5670,22 @@ class PrivateEndpointConnection(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'provisioning_state': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, - 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "private_endpoint": {"key": "properties.privateEndpoint", "type": "PrivateEndpoint"}, + "private_link_service_connection_state": { + "key": "properties.privateLinkServiceConnectionState", + "type": "PrivateLinkServiceConnectionState", + }, } def __init__( @@ -5869,7 +5704,7 @@ def __init__( :paramtype private_link_service_connection_state: ~azure.mgmt.containerservice.v2022_04_02_preview.models.PrivateLinkServiceConnectionState """ - super(PrivateEndpointConnection, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -5878,7 +5713,7 @@ def __init__( self.private_link_service_connection_state = private_link_service_connection_state -class PrivateEndpointConnectionListResult(msrest.serialization.Model): +class PrivateEndpointConnectionListResult(_serialization.Model): """A list of private endpoint connections. :ivar value: The collection value. @@ -5887,25 +5722,20 @@ class PrivateEndpointConnectionListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, + "value": {"key": "value", "type": "[PrivateEndpointConnection]"}, } - def __init__( - self, - *, - value: Optional[List["_models.PrivateEndpointConnection"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.PrivateEndpointConnection"]] = None, **kwargs): """ :keyword value: The collection value. :paramtype value: list[~azure.mgmt.containerservice.v2022_04_02_preview.models.PrivateEndpointConnection] """ - super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value -class PrivateLinkResource(msrest.serialization.Model): +class PrivateLinkResource(_serialization.Model): """A private link resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -5926,22 +5756,22 @@ class PrivateLinkResource(msrest.serialization.Model): """ _validation = { - 'private_link_service_id': {'readonly': True}, + "private_link_service_id": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'group_id': {'key': 'groupId', 'type': 'str'}, - 'required_members': {'key': 'requiredMembers', 'type': '[str]'}, - 'private_link_service_id': {'key': 'privateLinkServiceID', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "group_id": {"key": "groupId", "type": "str"}, + "required_members": {"key": "requiredMembers", "type": "[str]"}, + "private_link_service_id": {"key": "privateLinkServiceID", "type": "str"}, } def __init__( self, *, - id: Optional[str] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin name: Optional[str] = None, type: Optional[str] = None, group_id: Optional[str] = None, @@ -5960,7 +5790,7 @@ def __init__( :keyword required_members: The RequiredMembers of the resource. :paramtype required_members: list[str] """ - super(PrivateLinkResource, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id self.name = name self.type = type @@ -5969,7 +5799,7 @@ def __init__( self.private_link_service_id = None -class PrivateLinkResourcesListResult(msrest.serialization.Model): +class PrivateLinkResourcesListResult(_serialization.Model): """A list of private link resources. :ivar value: The collection value. @@ -5978,29 +5808,24 @@ class PrivateLinkResourcesListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, + "value": {"key": "value", "type": "[PrivateLinkResource]"}, } - def __init__( - self, - *, - value: Optional[List["_models.PrivateLinkResource"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.PrivateLinkResource"]] = None, **kwargs): """ :keyword value: The collection value. :paramtype value: list[~azure.mgmt.containerservice.v2022_04_02_preview.models.PrivateLinkResource] """ - super(PrivateLinkResourcesListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value -class PrivateLinkServiceConnectionState(msrest.serialization.Model): +class PrivateLinkServiceConnectionState(_serialization.Model): """The state of a private link service connection. :ivar status: The private link service connection status. Known values are: "Pending", - "Approved", "Rejected", "Disconnected". + "Approved", "Rejected", and "Disconnected". :vartype status: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.ConnectionStatus :ivar description: The private link service connection description. @@ -6008,8 +5833,8 @@ class PrivateLinkServiceConnectionState(msrest.serialization.Model): """ _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, + "status": {"key": "status", "type": "str"}, + "description": {"key": "description", "type": "str"}, } def __init__( @@ -6021,18 +5846,18 @@ def __init__( ): """ :keyword status: The private link service connection status. Known values are: "Pending", - "Approved", "Rejected", "Disconnected". + "Approved", "Rejected", and "Disconnected". :paramtype status: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.ConnectionStatus :keyword description: The private link service connection description. :paramtype description: str """ - super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) + super().__init__(**kwargs) self.status = status self.description = description -class ResourceReference(msrest.serialization.Model): +class ResourceReference(_serialization.Model): """A reference to an Azure resource. :ivar id: The fully qualified Azure resource id. @@ -6040,29 +5865,24 @@ class ResourceReference(msrest.serialization.Model): """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, } - def __init__( - self, - *, - id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin """ :keyword id: The fully qualified Azure resource id. :paramtype id: str """ - super(ResourceReference, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id -class RunCommandRequest(msrest.serialization.Model): +class RunCommandRequest(_serialization.Model): """A run command request. All required parameters must be populated in order to send to Azure. - :ivar command: Required. The command to run. + :ivar command: The command to run. Required. :vartype command: str :ivar context: A base64 encoded zip file containing the files required by the command. :vartype context: str @@ -6071,38 +5891,31 @@ class RunCommandRequest(msrest.serialization.Model): """ _validation = { - 'command': {'required': True}, + "command": {"required": True}, } _attribute_map = { - 'command': {'key': 'command', 'type': 'str'}, - 'context': {'key': 'context', 'type': 'str'}, - 'cluster_token': {'key': 'clusterToken', 'type': 'str'}, + "command": {"key": "command", "type": "str"}, + "context": {"key": "context", "type": "str"}, + "cluster_token": {"key": "clusterToken", "type": "str"}, } - def __init__( - self, - *, - command: str, - context: Optional[str] = None, - cluster_token: Optional[str] = None, - **kwargs - ): + def __init__(self, *, command: str, context: Optional[str] = None, cluster_token: Optional[str] = None, **kwargs): """ - :keyword command: Required. The command to run. + :keyword command: The command to run. Required. :paramtype command: str :keyword context: A base64 encoded zip file containing the files required by the command. :paramtype context: str :keyword cluster_token: AuthToken issued for AKS AAD Server App. :paramtype cluster_token: str """ - super(RunCommandRequest, self).__init__(**kwargs) + super().__init__(**kwargs) self.command = command self.context = context self.cluster_token = cluster_token -class RunCommandResult(msrest.serialization.Model): +class RunCommandResult(_serialization.Model): """run command result. Variables are only populated by the server, and will be ignored when sending a request. @@ -6124,32 +5937,28 @@ class RunCommandResult(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'exit_code': {'readonly': True}, - 'started_at': {'readonly': True}, - 'finished_at': {'readonly': True}, - 'logs': {'readonly': True}, - 'reason': {'readonly': True}, + "id": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "exit_code": {"readonly": True}, + "started_at": {"readonly": True}, + "finished_at": {"readonly": True}, + "logs": {"readonly": True}, + "reason": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'exit_code': {'key': 'properties.exitCode', 'type': 'int'}, - 'started_at': {'key': 'properties.startedAt', 'type': 'iso-8601'}, - 'finished_at': {'key': 'properties.finishedAt', 'type': 'iso-8601'}, - 'logs': {'key': 'properties.logs', 'type': 'str'}, - 'reason': {'key': 'properties.reason', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(RunCommandResult, self).__init__(**kwargs) + "id": {"key": "id", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "exit_code": {"key": "properties.exitCode", "type": "int"}, + "started_at": {"key": "properties.startedAt", "type": "iso-8601"}, + "finished_at": {"key": "properties.finishedAt", "type": "iso-8601"}, + "logs": {"key": "properties.logs", "type": "str"}, + "reason": {"key": "properties.reason", "type": "str"}, + } + + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.id = None self.provisioning_state = None self.exit_code = None @@ -6159,7 +5968,7 @@ def __init__( self.reason = None -class Snapshot(TrackedResource): +class Snapshot(TrackedResource): # pylint: disable=too-many-instance-attributes """A node pool snapshot resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -6177,28 +5986,28 @@ class Snapshot(TrackedResource): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.containerservice.v2022_04_02_preview.models.SystemData - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] - :ivar location: Required. The geo-location where the resource lives. + :ivar location: The geo-location where the resource lives. Required. :vartype location: str :ivar creation_data: CreationData to be used to specify the source agent pool resource ID to create this snapshot. :vartype creation_data: ~azure.mgmt.containerservice.v2022_04_02_preview.models.CreationData :ivar snapshot_type: The type of a snapshot. The default is NodePool. Known values are: - "NodePool", "ManagedCluster". Default value: "NodePool". + "NodePool" and "ManagedCluster". :vartype snapshot_type: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.SnapshotType :ivar kubernetes_version: The version of Kubernetes. :vartype kubernetes_version: str :ivar node_image_version: The version of node image. :vartype node_image_version: str - :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.OSType :ivar os_sku: Specifies the OS SKU used by the agent pool. If not specified, the default is Ubuntu if OSType=Linux or Windows2019 if OSType=Windows. And the default Windows OSSKU will be changed to Windows2022 after Windows2019 is deprecated. Known values are: "Ubuntu", - "CBLMariner", "Windows2019", "Windows2022". + "CBLMariner", "Windows2019", and "Windows2022". :vartype os_sku: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.OSSKU :ivar vm_size: The size of the VM. :vartype vm_size: str @@ -6207,34 +6016,34 @@ class Snapshot(TrackedResource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'location': {'required': True}, - 'kubernetes_version': {'readonly': True}, - 'node_image_version': {'readonly': True}, - 'os_type': {'readonly': True}, - 'os_sku': {'readonly': True}, - 'vm_size': {'readonly': True}, - 'enable_fips': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, + "kubernetes_version": {"readonly": True}, + "node_image_version": {"readonly": True}, + "os_type": {"readonly": True}, + "os_sku": {"readonly": True}, + "vm_size": {"readonly": True}, + "enable_fips": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - 'creation_data': {'key': 'properties.creationData', 'type': 'CreationData'}, - 'snapshot_type': {'key': 'properties.snapshotType', 'type': 'str'}, - 'kubernetes_version': {'key': 'properties.kubernetesVersion', 'type': 'str'}, - 'node_image_version': {'key': 'properties.nodeImageVersion', 'type': 'str'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'os_sku': {'key': 'properties.osSku', 'type': 'str'}, - 'vm_size': {'key': 'properties.vmSize', 'type': 'str'}, - 'enable_fips': {'key': 'properties.enableFIPS', 'type': 'bool'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "creation_data": {"key": "properties.creationData", "type": "CreationData"}, + "snapshot_type": {"key": "properties.snapshotType", "type": "str"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "node_image_version": {"key": "properties.nodeImageVersion", "type": "str"}, + "os_type": {"key": "properties.osType", "type": "str"}, + "os_sku": {"key": "properties.osSku", "type": "str"}, + "vm_size": {"key": "properties.vmSize", "type": "str"}, + "enable_fips": {"key": "properties.enableFIPS", "type": "bool"}, } def __init__( @@ -6243,23 +6052,23 @@ def __init__( location: str, tags: Optional[Dict[str, str]] = None, creation_data: Optional["_models.CreationData"] = None, - snapshot_type: Optional[Union[str, "_models.SnapshotType"]] = "NodePool", + snapshot_type: Union[str, "_models.SnapshotType"] = "NodePool", **kwargs ): """ - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] - :keyword location: Required. The geo-location where the resource lives. + :keyword location: The geo-location where the resource lives. Required. :paramtype location: str :keyword creation_data: CreationData to be used to specify the source agent pool resource ID to create this snapshot. :paramtype creation_data: ~azure.mgmt.containerservice.v2022_04_02_preview.models.CreationData :keyword snapshot_type: The type of a snapshot. The default is NodePool. Known values are: - "NodePool", "ManagedCluster". Default value: "NodePool". + "NodePool" and "ManagedCluster". :paramtype snapshot_type: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.SnapshotType """ - super(Snapshot, self).__init__(tags=tags, location=location, **kwargs) + super().__init__(tags=tags, location=location, **kwargs) self.creation_data = creation_data self.snapshot_type = snapshot_type self.kubernetes_version = None @@ -6270,7 +6079,7 @@ def __init__( self.enable_fips = None -class SnapshotListResult(msrest.serialization.Model): +class SnapshotListResult(_serialization.Model): """The response from the List Snapshots operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -6282,30 +6091,25 @@ class SnapshotListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[Snapshot]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[Snapshot]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.Snapshot"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.Snapshot"]] = None, **kwargs): """ :keyword value: The list of snapshots. :paramtype value: list[~azure.mgmt.containerservice.v2022_04_02_preview.models.Snapshot] """ - super(SnapshotListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class SysctlConfig(msrest.serialization.Model): +class SysctlConfig(_serialization.Model): # pylint: disable=too-many-instance-attributes """Sysctl settings for Linux agent nodes. :ivar net_core_somaxconn: Sysctl setting net.core.somaxconn. @@ -6367,37 +6171,37 @@ class SysctlConfig(msrest.serialization.Model): """ _attribute_map = { - 'net_core_somaxconn': {'key': 'netCoreSomaxconn', 'type': 'int'}, - 'net_core_netdev_max_backlog': {'key': 'netCoreNetdevMaxBacklog', 'type': 'int'}, - 'net_core_rmem_default': {'key': 'netCoreRmemDefault', 'type': 'int'}, - 'net_core_rmem_max': {'key': 'netCoreRmemMax', 'type': 'int'}, - 'net_core_wmem_default': {'key': 'netCoreWmemDefault', 'type': 'int'}, - 'net_core_wmem_max': {'key': 'netCoreWmemMax', 'type': 'int'}, - 'net_core_optmem_max': {'key': 'netCoreOptmemMax', 'type': 'int'}, - 'net_ipv4_tcp_max_syn_backlog': {'key': 'netIpv4TcpMaxSynBacklog', 'type': 'int'}, - 'net_ipv4_tcp_max_tw_buckets': {'key': 'netIpv4TcpMaxTwBuckets', 'type': 'int'}, - 'net_ipv4_tcp_fin_timeout': {'key': 'netIpv4TcpFinTimeout', 'type': 'int'}, - 'net_ipv4_tcp_keepalive_time': {'key': 'netIpv4TcpKeepaliveTime', 'type': 'int'}, - 'net_ipv4_tcp_keepalive_probes': {'key': 'netIpv4TcpKeepaliveProbes', 'type': 'int'}, - 'net_ipv4_tcpkeepalive_intvl': {'key': 'netIpv4TcpkeepaliveIntvl', 'type': 'int'}, - 'net_ipv4_tcp_tw_reuse': {'key': 'netIpv4TcpTwReuse', 'type': 'bool'}, - 'net_ipv4_ip_local_port_range': {'key': 'netIpv4IpLocalPortRange', 'type': 'str'}, - 'net_ipv4_neigh_default_gc_thresh1': {'key': 'netIpv4NeighDefaultGcThresh1', 'type': 'int'}, - 'net_ipv4_neigh_default_gc_thresh2': {'key': 'netIpv4NeighDefaultGcThresh2', 'type': 'int'}, - 'net_ipv4_neigh_default_gc_thresh3': {'key': 'netIpv4NeighDefaultGcThresh3', 'type': 'int'}, - 'net_netfilter_nf_conntrack_max': {'key': 'netNetfilterNfConntrackMax', 'type': 'int'}, - 'net_netfilter_nf_conntrack_buckets': {'key': 'netNetfilterNfConntrackBuckets', 'type': 'int'}, - 'fs_inotify_max_user_watches': {'key': 'fsInotifyMaxUserWatches', 'type': 'int'}, - 'fs_file_max': {'key': 'fsFileMax', 'type': 'int'}, - 'fs_aio_max_nr': {'key': 'fsAioMaxNr', 'type': 'int'}, - 'fs_nr_open': {'key': 'fsNrOpen', 'type': 'int'}, - 'kernel_threads_max': {'key': 'kernelThreadsMax', 'type': 'int'}, - 'vm_max_map_count': {'key': 'vmMaxMapCount', 'type': 'int'}, - 'vm_swappiness': {'key': 'vmSwappiness', 'type': 'int'}, - 'vm_vfs_cache_pressure': {'key': 'vmVfsCachePressure', 'type': 'int'}, - } - - def __init__( + "net_core_somaxconn": {"key": "netCoreSomaxconn", "type": "int"}, + "net_core_netdev_max_backlog": {"key": "netCoreNetdevMaxBacklog", "type": "int"}, + "net_core_rmem_default": {"key": "netCoreRmemDefault", "type": "int"}, + "net_core_rmem_max": {"key": "netCoreRmemMax", "type": "int"}, + "net_core_wmem_default": {"key": "netCoreWmemDefault", "type": "int"}, + "net_core_wmem_max": {"key": "netCoreWmemMax", "type": "int"}, + "net_core_optmem_max": {"key": "netCoreOptmemMax", "type": "int"}, + "net_ipv4_tcp_max_syn_backlog": {"key": "netIpv4TcpMaxSynBacklog", "type": "int"}, + "net_ipv4_tcp_max_tw_buckets": {"key": "netIpv4TcpMaxTwBuckets", "type": "int"}, + "net_ipv4_tcp_fin_timeout": {"key": "netIpv4TcpFinTimeout", "type": "int"}, + "net_ipv4_tcp_keepalive_time": {"key": "netIpv4TcpKeepaliveTime", "type": "int"}, + "net_ipv4_tcp_keepalive_probes": {"key": "netIpv4TcpKeepaliveProbes", "type": "int"}, + "net_ipv4_tcpkeepalive_intvl": {"key": "netIpv4TcpkeepaliveIntvl", "type": "int"}, + "net_ipv4_tcp_tw_reuse": {"key": "netIpv4TcpTwReuse", "type": "bool"}, + "net_ipv4_ip_local_port_range": {"key": "netIpv4IpLocalPortRange", "type": "str"}, + "net_ipv4_neigh_default_gc_thresh1": {"key": "netIpv4NeighDefaultGcThresh1", "type": "int"}, + "net_ipv4_neigh_default_gc_thresh2": {"key": "netIpv4NeighDefaultGcThresh2", "type": "int"}, + "net_ipv4_neigh_default_gc_thresh3": {"key": "netIpv4NeighDefaultGcThresh3", "type": "int"}, + "net_netfilter_nf_conntrack_max": {"key": "netNetfilterNfConntrackMax", "type": "int"}, + "net_netfilter_nf_conntrack_buckets": {"key": "netNetfilterNfConntrackBuckets", "type": "int"}, + "fs_inotify_max_user_watches": {"key": "fsInotifyMaxUserWatches", "type": "int"}, + "fs_file_max": {"key": "fsFileMax", "type": "int"}, + "fs_aio_max_nr": {"key": "fsAioMaxNr", "type": "int"}, + "fs_nr_open": {"key": "fsNrOpen", "type": "int"}, + "kernel_threads_max": {"key": "kernelThreadsMax", "type": "int"}, + "vm_max_map_count": {"key": "vmMaxMapCount", "type": "int"}, + "vm_swappiness": {"key": "vmSwappiness", "type": "int"}, + "vm_vfs_cache_pressure": {"key": "vmVfsCachePressure", "type": "int"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, net_core_somaxconn: Optional[int] = None, @@ -6488,7 +6292,7 @@ def __init__( :keyword vm_vfs_cache_pressure: Sysctl setting vm.vfs_cache_pressure. :paramtype vm_vfs_cache_pressure: int """ - super(SysctlConfig, self).__init__(**kwargs) + super().__init__(**kwargs) self.net_core_somaxconn = net_core_somaxconn self.net_core_netdev_max_backlog = net_core_netdev_max_backlog self.net_core_rmem_default = net_core_rmem_default @@ -6519,13 +6323,13 @@ def __init__( self.vm_vfs_cache_pressure = vm_vfs_cache_pressure -class SystemData(msrest.serialization.Model): +class SystemData(_serialization.Model): """Metadata pertaining to creation and last modification of the resource. :ivar created_by: The identity that created the resource. :vartype created_by: str :ivar created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", "Key". + "User", "Application", "ManagedIdentity", and "Key". :vartype created_by_type: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.CreatedByType :ivar created_at: The timestamp of resource creation (UTC). @@ -6533,7 +6337,7 @@ class SystemData(msrest.serialization.Model): :ivar last_modified_by: The identity that last modified the resource. :vartype last_modified_by: str :ivar last_modified_by_type: The type of identity that last modified the resource. Known values - are: "User", "Application", "ManagedIdentity", "Key". + are: "User", "Application", "ManagedIdentity", and "Key". :vartype last_modified_by_type: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.CreatedByType :ivar last_modified_at: The timestamp of resource last modification (UTC). @@ -6541,12 +6345,12 @@ class SystemData(msrest.serialization.Model): """ _attribute_map = { - 'created_by': {'key': 'createdBy', 'type': 'str'}, - 'created_by_type': {'key': 'createdByType', 'type': 'str'}, - 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, - 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, - 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, - 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + "created_by": {"key": "createdBy", "type": "str"}, + "created_by_type": {"key": "createdByType", "type": "str"}, + "created_at": {"key": "createdAt", "type": "iso-8601"}, + "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, + "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, + "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, } def __init__( @@ -6564,7 +6368,7 @@ def __init__( :keyword created_by: The identity that created the resource. :paramtype created_by: str :keyword created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", "Key". + "User", "Application", "ManagedIdentity", and "Key". :paramtype created_by_type: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.CreatedByType :keyword created_at: The timestamp of resource creation (UTC). @@ -6572,13 +6376,13 @@ def __init__( :keyword last_modified_by: The identity that last modified the resource. :paramtype last_modified_by: str :keyword last_modified_by_type: The type of identity that last modified the resource. Known - values are: "User", "Application", "ManagedIdentity", "Key". + values are: "User", "Application", "ManagedIdentity", and "Key". :paramtype last_modified_by_type: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.CreatedByType :keyword last_modified_at: The timestamp of resource last modification (UTC). :paramtype last_modified_at: ~datetime.datetime """ - super(SystemData, self).__init__(**kwargs) + super().__init__(**kwargs) self.created_by = created_by self.created_by_type = created_by_type self.created_at = created_at @@ -6587,36 +6391,31 @@ def __init__( self.last_modified_at = last_modified_at -class TagsObject(msrest.serialization.Model): +class TagsObject(_serialization.Model): """Tags object for patch operations. - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] """ _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] """ - super(TagsObject, self).__init__(**kwargs) + super().__init__(**kwargs) self.tags = tags -class TimeInWeek(msrest.serialization.Model): +class TimeInWeek(_serialization.Model): """Time in a week. :ivar day: The day of the week. Known values are: "Sunday", "Monday", "Tuesday", "Wednesday", - "Thursday", "Friday", "Saturday". + "Thursday", "Friday", and "Saturday". :vartype day: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.WeekDay :ivar hour_slots: Each integer hour represents a time range beginning at 0m after the hour ending at the next hour (non-inclusive). 0 corresponds to 00:00 UTC, 23 corresponds to 23:00 @@ -6625,32 +6424,28 @@ class TimeInWeek(msrest.serialization.Model): """ _attribute_map = { - 'day': {'key': 'day', 'type': 'str'}, - 'hour_slots': {'key': 'hourSlots', 'type': '[int]'}, + "day": {"key": "day", "type": "str"}, + "hour_slots": {"key": "hourSlots", "type": "[int]"}, } def __init__( - self, - *, - day: Optional[Union[str, "_models.WeekDay"]] = None, - hour_slots: Optional[List[int]] = None, - **kwargs + self, *, day: Optional[Union[str, "_models.WeekDay"]] = None, hour_slots: Optional[List[int]] = None, **kwargs ): """ :keyword day: The day of the week. Known values are: "Sunday", "Monday", "Tuesday", - "Wednesday", "Thursday", "Friday", "Saturday". + "Wednesday", "Thursday", "Friday", and "Saturday". :paramtype day: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.WeekDay :keyword hour_slots: Each integer hour represents a time range beginning at 0m after the hour ending at the next hour (non-inclusive). 0 corresponds to 00:00 UTC, 23 corresponds to 23:00 UTC. Specifying [0, 1] means the 00:00 - 02:00 UTC time range. :paramtype hour_slots: list[int] """ - super(TimeInWeek, self).__init__(**kwargs) + super().__init__(**kwargs) self.day = day self.hour_slots = hour_slots -class TimeSpan(msrest.serialization.Model): +class TimeSpan(_serialization.Model): """For example, between 2021-05-25T13:00:00Z and 2021-05-25T14:00:00Z. :ivar start: The start of a time span. @@ -6660,29 +6455,23 @@ class TimeSpan(msrest.serialization.Model): """ _attribute_map = { - 'start': {'key': 'start', 'type': 'iso-8601'}, - 'end': {'key': 'end', 'type': 'iso-8601'}, + "start": {"key": "start", "type": "iso-8601"}, + "end": {"key": "end", "type": "iso-8601"}, } - def __init__( - self, - *, - start: Optional[datetime.datetime] = None, - end: Optional[datetime.datetime] = None, - **kwargs - ): + def __init__(self, *, start: Optional[datetime.datetime] = None, end: Optional[datetime.datetime] = None, **kwargs): """ :keyword start: The start of a time span. :paramtype start: ~datetime.datetime :keyword end: The end of a time span. :paramtype end: ~datetime.datetime """ - super(TimeSpan, self).__init__(**kwargs) + super().__init__(**kwargs) self.start = start self.end = end -class TrustedAccessRole(msrest.serialization.Model): +class TrustedAccessRole(_serialization.Model): """Trusted access role definition. Variables are only populated by the server, and will be ignored when sending a request. @@ -6699,24 +6488,20 @@ class TrustedAccessRole(msrest.serialization.Model): """ _validation = { - 'source_resource_type': {'readonly': True}, - 'name': {'readonly': True}, - 'rules': {'readonly': True}, + "source_resource_type": {"readonly": True}, + "name": {"readonly": True}, + "rules": {"readonly": True}, } _attribute_map = { - 'source_resource_type': {'key': 'sourceResourceType', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'rules': {'key': 'rules', 'type': '[TrustedAccessRoleRule]'}, + "source_resource_type": {"key": "sourceResourceType", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "rules": {"key": "rules", "type": "[TrustedAccessRoleRule]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(TrustedAccessRole, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.source_resource_type = None self.name = None self.rules = None @@ -6741,59 +6526,53 @@ class TrustedAccessRoleBinding(Resource): information. :vartype system_data: ~azure.mgmt.containerservice.v2022_04_02_preview.models.SystemData :ivar provisioning_state: The current provisioning state of trusted access role binding. Known - values are: "Succeeded", "Failed", "Updating", "Deleting". + values are: "Succeeded", "Failed", "Updating", and "Deleting". :vartype provisioning_state: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.TrustedAccessRoleBindingProvisioningState - :ivar source_resource_id: Required. The ARM resource ID of source resource that trusted access - is configured for. + :ivar source_resource_id: The ARM resource ID of source resource that trusted access is + configured for. Required. :vartype source_resource_id: str - :ivar roles: Required. A list of roles to bind, each item is a resource type qualified role - name. For example: 'Microsoft.MachineLearningServices/workspaces/reader'. + :ivar roles: A list of roles to bind, each item is a resource type qualified role name. For + example: 'Microsoft.MachineLearningServices/workspaces/reader'. Required. :vartype roles: list[str] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'source_resource_id': {'required': True}, - 'roles': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "source_resource_id": {"required": True}, + "roles": {"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'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'source_resource_id': {'key': 'properties.sourceResourceId', 'type': 'str'}, - 'roles': {'key': 'properties.roles', 'type': '[str]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "source_resource_id": {"key": "properties.sourceResourceId", "type": "str"}, + "roles": {"key": "properties.roles", "type": "[str]"}, } - def __init__( - self, - *, - source_resource_id: str, - roles: List[str], - **kwargs - ): + def __init__(self, *, source_resource_id: str, roles: List[str], **kwargs): """ - :keyword source_resource_id: Required. The ARM resource ID of source resource that trusted - access is configured for. + :keyword source_resource_id: The ARM resource ID of source resource that trusted access is + configured for. Required. :paramtype source_resource_id: str - :keyword roles: Required. A list of roles to bind, each item is a resource type qualified role - name. For example: 'Microsoft.MachineLearningServices/workspaces/reader'. + :keyword roles: A list of roles to bind, each item is a resource type qualified role name. For + example: 'Microsoft.MachineLearningServices/workspaces/reader'. Required. :paramtype roles: list[str] """ - super(TrustedAccessRoleBinding, self).__init__(**kwargs) + super().__init__(**kwargs) self.provisioning_state = None self.source_resource_id = source_resource_id self.roles = roles -class TrustedAccessRoleBindingListResult(msrest.serialization.Model): +class TrustedAccessRoleBindingListResult(_serialization.Model): """List of trusted access role bindings. Variables are only populated by the server, and will be ignored when sending a request. @@ -6806,31 +6585,26 @@ class TrustedAccessRoleBindingListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[TrustedAccessRoleBinding]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[TrustedAccessRoleBinding]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.TrustedAccessRoleBinding"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.TrustedAccessRoleBinding"]] = None, **kwargs): """ :keyword value: Role binding list. :paramtype value: list[~azure.mgmt.containerservice.v2022_04_02_preview.models.TrustedAccessRoleBinding] """ - super(TrustedAccessRoleBindingListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class TrustedAccessRoleListResult(msrest.serialization.Model): +class TrustedAccessRoleListResult(_serialization.Model): """List of trusted access roles. Variables are only populated by the server, and will be ignored when sending a request. @@ -6842,27 +6616,23 @@ class TrustedAccessRoleListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[TrustedAccessRole]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[TrustedAccessRole]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(TrustedAccessRoleListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class TrustedAccessRoleRule(msrest.serialization.Model): +class TrustedAccessRoleRule(_serialization.Model): """Rule for trusted access role. Variables are only populated by the server, and will be ignored when sending a request. @@ -6880,28 +6650,24 @@ class TrustedAccessRoleRule(msrest.serialization.Model): """ _validation = { - 'verbs': {'readonly': True}, - 'api_groups': {'readonly': True}, - 'resources': {'readonly': True}, - 'resource_names': {'readonly': True}, - 'non_resource_ur_ls': {'readonly': True}, + "verbs": {"readonly": True}, + "api_groups": {"readonly": True}, + "resources": {"readonly": True}, + "resource_names": {"readonly": True}, + "non_resource_ur_ls": {"readonly": True}, } _attribute_map = { - 'verbs': {'key': 'verbs', 'type': '[str]'}, - 'api_groups': {'key': 'apiGroups', 'type': '[str]'}, - 'resources': {'key': 'resources', 'type': '[str]'}, - 'resource_names': {'key': 'resourceNames', 'type': '[str]'}, - 'non_resource_ur_ls': {'key': 'nonResourceURLs', 'type': '[str]'}, + "verbs": {"key": "verbs", "type": "[str]"}, + "api_groups": {"key": "apiGroups", "type": "[str]"}, + "resources": {"key": "resources", "type": "[str]"}, + "resource_names": {"key": "resourceNames", "type": "[str]"}, + "non_resource_ur_ls": {"key": "nonResourceURLs", "type": "[str]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(TrustedAccessRoleRule, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.verbs = None self.api_groups = None self.resources = None @@ -6909,7 +6675,7 @@ def __init__( self.non_resource_ur_ls = None -class WindowsGmsaProfile(msrest.serialization.Model): +class WindowsGmsaProfile(_serialization.Model): """Windows gMSA Profile in the managed cluster. :ivar enabled: Specifies whether to enable Windows gMSA in the managed cluster. @@ -6925,9 +6691,9 @@ class WindowsGmsaProfile(msrest.serialization.Model): """ _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'dns_server': {'key': 'dnsServer', 'type': 'str'}, - 'root_domain_name': {'key': 'rootDomainName', 'type': 'str'}, + "enabled": {"key": "enabled", "type": "bool"}, + "dns_server": {"key": "dnsServer", "type": "str"}, + "root_domain_name": {"key": "rootDomainName", "type": "str"}, } def __init__( @@ -6950,7 +6716,7 @@ def __init__( which is used to create the managed cluster. :paramtype root_domain_name: str """ - super(WindowsGmsaProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.dns_server = dns_server self.root_domain_name = root_domain_name diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/models/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/models/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/models/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/models/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/__init__.py index fe53dc12e778..6a931af99fa3 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/__init__.py @@ -21,18 +21,19 @@ from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'Operations', - 'ManagedClustersOperations', - 'MaintenanceConfigurationsOperations', - 'AgentPoolsOperations', - 'PrivateEndpointConnectionsOperations', - 'PrivateLinkResourcesOperations', - 'ResolvePrivateLinkServiceIdOperations', - 'SnapshotsOperations', - 'ManagedClusterSnapshotsOperations', - 'TrustedAccessRolesOperations', - 'TrustedAccessRoleBindingsOperations', + "Operations", + "ManagedClustersOperations", + "MaintenanceConfigurationsOperations", + "AgentPoolsOperations", + "PrivateEndpointConnectionsOperations", + "PrivateLinkResourcesOperations", + "ResolvePrivateLinkServiceIdOperations", + "SnapshotsOperations", + "ManagedClusterSnapshotsOperations", + "TrustedAccessRolesOperations", + "TrustedAccessRoleBindingsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/_agent_pools_operations.py index 95fb7006fcbe..948e9f8cf6a6 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/_agent_pools_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,141 +27,146 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - *, - json: Optional[_models.AgentPool] = None, - content: Any = None, - **kwargs: Any +def build_create_or_update_request( + resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request_initial( - subscription_id: str, +def build_delete_request( resource_group_name: str, resource_name: str, agent_pool_name: str, + subscription_id: str, *, ignore_pod_disruption_budget: Optional[bool] = None, **kwargs: Any @@ -164,150 +174,166 @@ def build_delete_request_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if ignore_pod_disruption_budget is not None: - _params['ignore-pod-disruption-budget'] = _SERIALIZER.query("ignore_pod_disruption_budget", ignore_pod_disruption_budget, 'bool') + _params["ignore-pod-disruption-budget"] = _SERIALIZER.query( + "ignore_pod_disruption_budget", ignore_pod_disruption_budget, "bool" + ) # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_get_upgrade_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_available_agent_pool_versions_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_upgrade_node_image_version_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any +def build_upgrade_node_image_version_request( + resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class AgentPoolsOperations: """ @@ -328,47 +354,41 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> Iterable[_models.AgentPoolListResult]: + def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> Iterable["_models.AgentPool"]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AgentPoolListResult or the result of cls(response) + :return: An iterator like instance of either AgentPool or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_04_02_preview.models.AgentPoolListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_04_02_preview.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -376,16 +396,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -401,10 +416,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -414,54 +427,46 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore @distributed_trace def get( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPool: """Gets the specified managed cluster agent pool. Gets the specified managed cluster agent pool. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPool, or the result of cls(response) + :return: AgentPool or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.AgentPool - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -469,57 +474,60 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore def _create_or_update_initial( self, resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: _models.AgentPool, + parameters: Union[_models.AgentPool, IO], **kwargs: Any ) -> _models.AgentPool: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - _json = self._serialize.body(parameters, 'AgentPool') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "AgentPool") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -527,10 +535,9 @@ def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -538,26 +545,27 @@ def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - - @distributed_trace + @overload def begin_create_or_update( self, resource_group_name: str, resource_name: str, agent_pool_name: str, parameters: _models.AgentPool, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.AgentPool]: """Creates or updates an agent pool in the specified managed cluster. @@ -565,13 +573,17 @@ def begin_create_or_update( Creates or updates an agent pool in the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str - :param parameters: The agent pool to create or update. + :param parameters: The agent pool to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_04_02_preview.models.AgentPool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -583,20 +595,98 @@ def begin_create_or_update( :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_04_02_preview.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AgentPool]: + """Creates or updates an agent pool in the specified managed cluster. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: The agent pool to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_04_02_preview.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: Union[_models.AgentPool, IO], + **kwargs: Any + ) -> LROPoller[_models.AgentPool]: + """Creates or updates an agent pool in the specified managed cluster. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: The agent pool to create or update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.mgmt.containerservice.v2022_04_02_preview.models.AgentPool or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_04_02_preview.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -605,39 +695,35 @@ def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements self, @@ -647,26 +733,23 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements ignore_pod_disruption_budget: Optional[bool] = None, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, - api_version=api_version, + subscription_id=self._config.subscription_id, ignore_pod_disruption_budget=ignore_pod_disruption_budget, - template_url=self._delete_initial.metadata['url'], + api_version=api_version, + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -674,10 +757,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -687,11 +769,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements + def begin_delete( self, resource_group_name: str, resource_name: str, @@ -704,10 +785,11 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Deletes an agent pool in the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :param ignore_pod_disruption_budget: ignore-pod-disruption-budget=true to delete those pods on a node without considering Pod Disruption Budget. Default value is None. @@ -722,19 +804,16 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -742,80 +821,70 @@ def begin_delete( # pylint: disable=inconsistent-return-statements agent_pool_name=agent_pool_name, ignore_pod_disruption_budget=ignore_pod_disruption_budget, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPoolUpgradeProfile: """Gets the upgrade profile for an agent pool. Gets the upgrade profile for an agent pool. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolUpgradeProfile, or the result of cls(response) + :return: AgentPoolUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.AgentPoolUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -823,32 +892,27 @@ def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolUpgradeProfile', pipeline_response) + deserialized = self._deserialize("AgentPoolUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore @distributed_trace def get_available_agent_pool_versions( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported Kubernetes versions for the specified agent pool. @@ -857,32 +921,30 @@ def get_available_agent_pool_versions( the version lifecycle. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolAvailableVersions, or the result of cls(response) + :return: AgentPoolAvailableVersions or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.AgentPoolAvailableVersions - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolAvailableVersions] - request = build_get_available_agent_pool_versions_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_available_agent_pool_versions.metadata['url'], + template_url=self.get_available_agent_pool_versions.metadata["url"], headers=_headers, params=_params, ) @@ -890,52 +952,43 @@ def get_available_agent_pool_versions( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolAvailableVersions', pipeline_response) + deserialized = self._deserialize("AgentPoolAvailableVersions", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_available_agent_pool_versions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore - + get_available_agent_pool_versions.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore def _upgrade_node_image_version_initial( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> Optional[_models.AgentPool]: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.AgentPool]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.AgentPool]] - - request = build_upgrade_node_image_version_request_initial( - subscription_id=self._config.subscription_id, + request = build_upgrade_node_image_version_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._upgrade_node_image_version_initial.metadata['url'], + template_url=self._upgrade_node_image_version_initial.metadata["url"], headers=_headers, params=_params, ) @@ -943,10 +996,9 @@ def _upgrade_node_image_version_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -956,26 +1008,23 @@ def _upgrade_node_image_version_initial( deserialized = None response_headers = {} if response.status_code == 202: - response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) - - deserialized = self._deserialize('AgentPool', pipeline_response) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _upgrade_node_image_version_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore - + _upgrade_node_image_version_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore @distributed_trace def begin_upgrade_node_image_version( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any - ) -> LROPoller[_models.AgentPool]: + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any + ) -> LROPoller[None]: """Upgrades the node image version of an agent pool to the latest. Upgrading the node image version of an agent pool applies the newest OS and runtime updates to @@ -983,10 +1032,11 @@ def begin_upgrade_node_image_version( node image versions, see: https://docs.microsoft.com/azure/aks/node-image-upgrade. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -999,59 +1049,54 @@ def begin_upgrade_node_image_version( :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_04_02_preview.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._upgrade_node_image_version_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) - - deserialized = self._deserialize('AgentPool', pipeline_response) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_upgrade_node_image_version.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore + begin_upgrade_node_image_version.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/_maintenance_configurations_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/_maintenance_configurations_operations.py index f2dfcd31912d..c04a57241fbb 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/_maintenance_configurations_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/_maintenance_configurations_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,173 +25,181 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +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_managed_cluster_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, config_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "configName": _SERIALIZER.url("config_name", config_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "configName": _SERIALIZER.url("config_name", config_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - config_name: str, - *, - json: Optional[_models.MaintenanceConfiguration] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, resource_name: str, config_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "configName": _SERIALIZER.url("config_name", config_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "configName": _SERIALIZER.url("config_name", config_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, config_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "configName": _SERIALIZER.url("config_name", config_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "configName": _SERIALIZER.url("config_name", config_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class MaintenanceConfigurationsOperations: """ @@ -207,48 +220,44 @@ def __init__(self, *args, **kwargs): 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_managed_cluster( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> Iterable[_models.MaintenanceConfigurationListResult]: + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> Iterable["_models.MaintenanceConfiguration"]: """Gets a list of maintenance configurations in the specified managed cluster. Gets a list of maintenance configurations in the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either MaintenanceConfigurationListResult or the result - of cls(response) + :return: An iterator like instance of either MaintenanceConfiguration or the result of + cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_04_02_preview.models.MaintenanceConfigurationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_04_02_preview.models.MaintenanceConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfigurationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfigurationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_managed_cluster_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_managed_cluster.metadata['url'], + template_url=self.list_by_managed_cluster.metadata["url"], headers=_headers, params=_params, ) @@ -256,16 +265,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_managed_cluster_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -281,10 +285,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -294,54 +296,46 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_managed_cluster.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations"} # type: ignore + list_by_managed_cluster.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations"} # type: ignore @distributed_trace def get( - self, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, config_name: str, **kwargs: Any ) -> _models.MaintenanceConfiguration: """Gets the specified maintenance configuration of a managed cluster. Gets the specified maintenance configuration of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: MaintenanceConfiguration, or the result of cls(response) + :return: MaintenanceConfiguration or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.MaintenanceConfiguration - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfiguration] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -349,33 +343,33 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) + deserialized = self._deserialize("MaintenanceConfiguration", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - - @distributed_trace + @overload def create_or_update( self, resource_group_name: str, resource_name: str, config_name: str, parameters: _models.MaintenanceConfiguration, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.MaintenanceConfiguration: """Creates or updates a maintenance configuration in the specified managed cluster. @@ -383,42 +377,117 @@ def create_or_update( Creates or updates a maintenance configuration in the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str - :param parameters: The maintenance configuration to create or update. + :param parameters: The maintenance configuration to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_04_02_preview.models.MaintenanceConfiguration + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configuration in the specified managed cluster. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: The maintenance configuration to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: MaintenanceConfiguration, or the result of cls(response) + :return: MaintenanceConfiguration or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.MaintenanceConfiguration - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: Union[_models.MaintenanceConfiguration, IO], + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configuration in the specified managed cluster. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: The maintenance configuration to create or update. Is either a model type or + a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2022_04_02_preview.models.MaintenanceConfiguration or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfiguration] - _json = self._serialize.body(parameters, 'MaintenanceConfiguration') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "MaintenanceConfiguration") request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) @@ -426,68 +495,60 @@ def create_or_update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) + deserialized = self._deserialize("MaintenanceConfiguration", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore @distributed_trace def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, config_name: str, **kwargs: Any ) -> None: """Deletes a maintenance configuration. Deletes a maintenance configuration. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) @@ -495,10 +556,9 @@ def delete( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -508,5 +568,4 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/_managed_cluster_snapshots_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/_managed_cluster_snapshots_operations.py index 9f8fe79c016c..c9498bff4d92 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/_managed_cluster_snapshots_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/_managed_cluster_snapshots_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,243 +25,235 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedclustersnapshots") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedclustersnapshots" + ) # 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", min_length=1), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_resource_group_request( - subscription_id: str, - resource_group_name: str, - **kwargs: Any -) -> HttpRequest: +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: + _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, resource_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedClusterSnapshot] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_update_tags_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.TagsObject] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class ManagedClusterSnapshotsOperations: """ @@ -277,40 +274,35 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.ManagedClusterSnapshotListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.ManagedClusterSnapshot"]: """Gets a list of managed cluster snapshots in the specified subscription. Gets a list of managed cluster snapshots in the specified subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterSnapshotListResult or the result of + :return: An iterator like instance of either ManagedClusterSnapshot or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedClusterSnapshotListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedClusterSnapshot] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshotListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterSnapshotListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -318,14 +310,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -341,10 +330,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -354,49 +341,45 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedclustersnapshots"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedclustersnapshots"} # type: ignore @distributed_trace def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> Iterable[_models.ManagedClusterSnapshotListResult]: + self, resource_group_name: str, **kwargs: Any + ) -> Iterable["_models.ManagedClusterSnapshot"]: """Lists managed cluster snapshots in the specified subscription and resource group. Lists managed cluster snapshots in the specified subscription and resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterSnapshotListResult or the result of + :return: An iterator like instance of either ManagedClusterSnapshot or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedClusterSnapshotListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedClusterSnapshot] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshotListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterSnapshotListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -404,15 +387,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -428,10 +407,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -441,50 +418,41 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots"} # type: ignore @distributed_trace - def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.ManagedClusterSnapshot: + def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.ManagedClusterSnapshot: """Gets a managed cluster snapshot. Gets a managed cluster snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterSnapshot, or the result of cls(response) + :return: ManagedClusterSnapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedClusterSnapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterSnapshot] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -492,32 +460,32 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterSnapshot', pipeline_response) + deserialized = self._deserialize("ManagedClusterSnapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"} # type: ignore - @distributed_trace + @overload def create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterSnapshot, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.ManagedClusterSnapshot: """Creates or updates a managed cluster snapshot. @@ -525,39 +493,108 @@ def create_or_update( Creates or updates a managed cluster snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The managed cluster snapshot to create or update. + :param parameters: The managed cluster snapshot to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedClusterSnapshot + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedClusterSnapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedClusterSnapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ManagedClusterSnapshot: + """Creates or updates a managed cluster snapshot. + + Creates or updates a managed cluster snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster snapshot to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedClusterSnapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedClusterSnapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterSnapshot, IO], + **kwargs: Any + ) -> _models.ManagedClusterSnapshot: + """Creates or updates a managed cluster snapshot. + + Creates or updates a managed cluster snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster snapshot to create or update. Is either a model type or + a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedClusterSnapshot or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterSnapshot, or the result of cls(response) + :return: ManagedClusterSnapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedClusterSnapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterSnapshot] - _json = self._serialize.body(parameters, 'ManagedClusterSnapshot') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterSnapshot") request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) @@ -565,10 +602,9 @@ def create_or_update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -576,25 +612,26 @@ def create_or_update( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ManagedClusterSnapshot', pipeline_response) + deserialized = self._deserialize("ManagedClusterSnapshot", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('ManagedClusterSnapshot', pipeline_response) + deserialized = self._deserialize("ManagedClusterSnapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"} # type: ignore + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"} # type: ignore - - @distributed_trace + @overload def update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.ManagedClusterSnapshot: """Updates tags on a managed cluster snapshot. @@ -602,38 +639,104 @@ def update_tags( Updates tags on a managed cluster snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Update managed cluster snapshot Tags operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2022_04_02_preview.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterSnapshot, or the result of cls(response) + :return: ManagedClusterSnapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedClusterSnapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + def update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ManagedClusterSnapshot: + """Updates tags on a managed cluster snapshot. + + Updates tags on a managed cluster snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update managed cluster snapshot Tags operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedClusterSnapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedClusterSnapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> _models.ManagedClusterSnapshot: + """Updates tags on a managed cluster snapshot. + + Updates tags on a managed cluster snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update managed cluster snapshot Tags operation. + Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_04_02_preview.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedClusterSnapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedClusterSnapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterSnapshot] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") request = build_update_tags_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_tags.metadata['url'], + content=_content, + template_url=self.update_tags.metadata["url"], headers=_headers, params=_params, ) @@ -641,64 +744,57 @@ def update_tags( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterSnapshot', pipeline_response) + deserialized = self._deserialize("ManagedClusterSnapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"} # type: ignore - + update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"} # type: ignore @distributed_trace def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: """Deletes a managed cluster snapshot. Deletes a managed cluster snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) @@ -706,10 +802,9 @@ def delete( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -719,5 +814,4 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"} # type: ignore - + delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/_managed_clusters_operations.py index e8fc0359a047..c65e408febb3 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/_managed_clusters_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,200 +27,189 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_get_os_options_request( - subscription_id: str, - location: str, - *, - resource_type: Optional[str] = None, - **kwargs: Any + location: str, subscription_id: str, *, resource_type: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "location": _SERIALIZER.url("location", location, 'str', min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "location": _SERIALIZER.url("location", location, "str", min_length=1), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if resource_type is not None: - _params['resource-type'] = _SERIALIZER.query("resource_type", resource_type, 'str') + _params["resource-type"] = _SERIALIZER.query("resource_type", resource_type, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters") + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters" + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_resource_group_request( - subscription_id: str, - resource_group_name: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_upgrade_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_access_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, role_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "roleName": _SERIALIZER.url("role_name", role_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "roleName": _SERIALIZER.url("role_name", role_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_admin_credentials_request( - subscription_id: str, resource_group_name: str, resource_name: str, + subscription_id: str, *, server_fqdn: Optional[str] = None, **kwargs: Any @@ -223,40 +217,46 @@ def build_list_cluster_admin_credentials_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if server_fqdn is not None: - _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + _params["server-fqdn"] = _SERIALIZER.query("server_fqdn", server_fqdn, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_user_credentials_request( - subscription_id: str, resource_group_name: str, resource_name: str, + subscription_id: str, *, server_fqdn: Optional[str] = None, format: Optional[Union[str, "_models.Format"]] = None, @@ -265,42 +265,48 @@ def build_list_cluster_user_credentials_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if server_fqdn is not None: - _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + _params["server-fqdn"] = _SERIALIZER.query("server_fqdn", server_fqdn, "str") if format is not None: - _params['format'] = _SERIALIZER.query("format", format, 'str') + _params["format"] = _SERIALIZER.query("format", format, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_monitoring_user_credentials_request( - subscription_id: str, resource_group_name: str, resource_name: str, + subscription_id: str, *, server_fqdn: Optional[str] = None, **kwargs: Any @@ -308,167 +314,170 @@ def build_list_cluster_monitoring_user_credentials_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if server_fqdn is not None: - _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + _params["server-fqdn"] = _SERIALIZER.query("server_fqdn", server_fqdn, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: + +def build_get_request(resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedCluster] = None, - content: Any = None, - **kwargs: Any + +def build_create_or_update_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_update_tags_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.TagsObject] = None, - content: Any = None, - **kwargs: Any + +def build_update_tags_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request_initial( - subscription_id: str, + +def build_delete_request( resource_group_name: str, resource_name: str, + subscription_id: str, *, ignore_pod_disruption_budget: Optional[bool] = None, **kwargs: Any @@ -476,393 +485,413 @@ def build_delete_request_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if ignore_pod_disruption_budget is not None: - _params['ignore-pod-disruption-budget'] = _SERIALIZER.query("ignore_pod_disruption_budget", ignore_pod_disruption_budget, 'bool') + _params["ignore-pod-disruption-budget"] = _SERIALIZER.query( + "ignore_pod_disruption_budget", ignore_pod_disruption_budget, "bool" + ) # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_reset_service_principal_profile_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedClusterServicePrincipalProfile] = None, - content: Any = None, - **kwargs: Any + +def build_reset_service_principal_profile_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_reset_aad_profile_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedClusterAADProfile] = None, - content: Any = None, - **kwargs: Any + +def build_reset_aad_profile_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_rotate_cluster_certificates_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + +def build_rotate_cluster_certificates_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_rotate_service_account_signing_keys_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + +def build_rotate_service_account_signing_keys_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateServiceAccountSigningKeys") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateServiceAccountSigningKeys", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_stop_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + +def build_stop_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_start_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + +def build_start_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_run_command_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.RunCommandRequest] = None, - content: Any = None, - **kwargs: Any + +def build_run_command_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_get_command_result_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - command_id: str, - **kwargs: Any + resource_group_name: str, resource_name: str, command_id: 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "commandId": _SERIALIZER.url("command_id", command_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "commandId": _SERIALIZER.url("command_id", command_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_list_outbound_network_dependencies_endpoints_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + class ManagedClustersOperations: # pylint: disable=too-many-public-methods """ @@ -883,46 +912,39 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def get_os_options( - self, - location: str, - resource_type: Optional[str] = None, - **kwargs: Any + self, location: str, resource_type: Optional[str] = None, **kwargs: Any ) -> _models.OSOptionProfile: """Gets supported OS options in the specified subscription. Gets supported OS options in the specified subscription. - :param location: The name of Azure region. + :param location: The name of Azure region. Required. :type location: str :param resource_type: The resource type for which the OS options needs to be returned. Default value is None. :type resource_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: OSOptionProfile, or the result of cls(response) + :return: OSOptionProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.OSOptionProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OSOptionProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OSOptionProfile] - request = build_get_os_options_request( - subscription_id=self._config.subscription_id, location=location, - api_version=api_version, + subscription_id=self._config.subscription_id, resource_type=resource_type, - template_url=self.get_os_options.metadata['url'], + api_version=api_version, + template_url=self.get_os_options.metadata["url"], headers=_headers, params=_params, ) @@ -930,59 +952,52 @@ def get_os_options( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('OSOptionProfile', pipeline_response) + deserialized = self._deserialize("OSOptionProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_os_options.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default"} # type: ignore - + get_os_options.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default"} # type: ignore @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.ManagedClusterListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.ManagedCluster"]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -990,14 +1005,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -1013,10 +1025,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1026,49 +1036,42 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> Iterable[_models.ManagedClusterListResult]: + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.ManagedCluster"]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -1076,15 +1079,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -1100,10 +1099,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1113,50 +1110,43 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.ManagedClusterUpgradeProfile: """Gets the upgrade profile of a managed cluster. Gets the upgrade profile of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterUpgradeProfile, or the result of cls(response) + :return: ManagedClusterUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedClusterUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -1164,33 +1154,27 @@ def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterUpgradeProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore @distributed_trace def get_access_profile( - self, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, role_name: str, **kwargs: Any ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. @@ -1200,35 +1184,33 @@ def get_access_profile( `_ . :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param role_name: The name of the role for managed cluster accessProfile resource. + :param role_name: The name of the role for managed cluster accessProfile resource. Required. :type role_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterAccessProfile, or the result of cls(response) + :return: ManagedClusterAccessProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedClusterAccessProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterAccessProfile] - request = build_get_access_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, role_name=role_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_access_profile.metadata['url'], + template_url=self.get_access_profile.metadata["url"], headers=_headers, params=_params, ) @@ -1236,68 +1218,60 @@ def get_access_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterAccessProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterAccessProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_access_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore - + get_access_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore @distributed_trace def list_cluster_admin_credentials( - self, - resource_group_name: str, - resource_name: str, - server_fqdn: Optional[str] = None, - **kwargs: Any + self, resource_group_name: str, resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any ) -> _models.CredentialResults: """Lists the admin credentials of a managed cluster. Lists the admin credentials of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_admin_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, - template_url=self.list_cluster_admin_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_admin_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -1305,25 +1279,23 @@ def list_cluster_admin_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_admin_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore - + list_cluster_admin_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore @distributed_trace def list_cluster_user_credentials( @@ -1339,40 +1311,39 @@ def list_cluster_user_credentials( Lists the user credentials of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :param format: Only apply to AAD clusters, specifies the format of returned kubeconfig. Format 'azure' will return azure auth-provider kubeconfig; format 'exec' will return exec format - kubeconfig, which requires kubelogin binary in the path. Default value is None. + kubeconfig, which requires kubelogin binary in the path. Known values are: "azure" and "exec". + Default value is None. :type format: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.Format :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, format=format, - template_url=self.list_cluster_user_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -1380,68 +1351,60 @@ def list_cluster_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore - + list_cluster_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore @distributed_trace def list_cluster_monitoring_user_credentials( - self, - resource_group_name: str, - resource_name: str, - server_fqdn: Optional[str] = None, - **kwargs: Any + self, resource_group_name: str, resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any ) -> _models.CredentialResults: """Lists the cluster monitoring user credentials of a managed cluster. Lists the cluster monitoring user credentials of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_monitoring_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, - template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_monitoring_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -1449,64 +1412,55 @@ def list_cluster_monitoring_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_monitoring_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore - + list_cluster_monitoring_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore @distributed_trace - def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.ManagedCluster: + def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.ManagedCluster: """Gets a managed cluster. Gets a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedCluster, or the result of cls(response) + :return: ManagedCluster or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedCluster - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -1514,55 +1468,54 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _create_or_update_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.ManagedCluster, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'ManagedCluster') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedCluster") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1570,10 +1523,9 @@ def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -1581,25 +1533,26 @@ def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - @distributed_trace + @overload def begin_create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedCluster, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. @@ -1607,11 +1560,15 @@ def begin_create_or_update( Creates or updates a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The managed cluster to create or update. + :param parameters: The managed cluster to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedCluster + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1624,90 +1581,157 @@ def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._create_or_update_initial( # type: ignore - resource_group_name=resource_group_name, - resource_name=resource_name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop('error_map', None) + @overload + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. - def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized + Creates or updates a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + @distributed_trace + def begin_create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - + Creates or updates a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster to create or update. Is either a model type or a IO + type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedCluster or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ManagedCluster", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _update_tags_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.TagsObject, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request_initial( - subscription_id=self._config.subscription_id, + request = build_update_tags_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_tags_initial.metadata['url'], + content=_content, + template_url=self._update_tags_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1715,32 +1739,32 @@ def _update_tags_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_tags_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + _update_tags_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - - @distributed_trace + @overload def begin_update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. @@ -1748,11 +1772,88 @@ def begin_update_tags( Updates tags on a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2022_04_02_preview.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates tags on a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates tags on a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_04_02_preview.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1765,20 +1866,17 @@ def begin_update_tags( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, @@ -1786,39 +1884,35 @@ def begin_update_tags( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements self, @@ -1827,25 +1921,22 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements ignore_pod_disruption_budget: Optional[bool] = None, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, ignore_pod_disruption_budget=ignore_pod_disruption_budget, - template_url=self._delete_initial.metadata['url'], + api_version=api_version, + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1853,10 +1944,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1866,11 +1956,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements + def begin_delete( self, resource_group_name: str, resource_name: str, @@ -1882,8 +1971,9 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Deletes a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param ignore_pod_disruption_budget: ignore-pod-disruption-budget=true to delete those pods on a node without considering Pod Disruption Budget. Default value is None. @@ -1898,86 +1988,84 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, ignore_pod_disruption_budget=ignore_pod_disruption_budget, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterServicePrincipalProfile, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterServicePrincipalProfile") - request = build_reset_service_principal_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_service_principal_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_service_principal_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_service_principal_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1985,10 +2073,9 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1998,15 +2085,89 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re if cls: return cls(pipeline_response, None, {}) - _reset_service_principal_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + _reset_service_principal_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + + @overload + def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.ManagedClusterServicePrincipalProfile, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reset the Service Principal Profile of a managed cluster. + + This action cannot be performed on a cluster that is not using a service principal. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The service principal profile to set on the managed cluster. Required. + :type parameters: + ~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedClusterServicePrincipalProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reset the Service Principal Profile of a managed cluster. + + This action cannot be performed on a cluster that is not using a service principal. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The service principal profile to set on the managed cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace - def begin_reset_service_principal_profile( # pylint: disable=inconsistent-return-statements + def begin_reset_service_principal_profile( self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterServicePrincipalProfile, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], **kwargs: Any ) -> LROPoller[None]: """Reset the Service Principal Profile of a managed cluster. @@ -2014,12 +2175,18 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur This action cannot be performed on a cluster that is not using a service principal. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The service principal profile to set on the managed cluster. + :param parameters: The service principal profile to set on the managed cluster. Is either a + model type or a IO type. Required. :type parameters: ~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedClusterServicePrincipalProfile + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -2030,20 +2197,17 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -2051,67 +2215,68 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_service_principal_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + begin_reset_service_principal_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterAADProfile, + parameters: Union[_models.ManagedClusterAADProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterAADProfile") - request = build_reset_aad_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_aad_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_aad_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_aad_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2119,10 +2284,9 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -2132,15 +2296,16 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement if cls: return cls(pipeline_response, None, {}) - _reset_aad_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - + _reset_aad_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - @distributed_trace - def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements + @overload + def begin_reset_aad_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterAADProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: """Reset the AAD Profile of a managed cluster. @@ -2148,12 +2313,90 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements Reset the AAD Profile of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The AAD profile to set on the Managed Cluster. + :param parameters: The AAD profile to set on the Managed Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedClusterAADProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reset the AAD Profile of a managed cluster. + + Reset the AAD Profile of a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The AAD profile to set on the Managed Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterAADProfile, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Reset the AAD Profile of a managed cluster. + + Reset the AAD Profile of a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The AAD profile to set on the Managed Cluster. Is either a model type or a + IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedClusterAADProfile or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -2164,20 +2407,17 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -2185,62 +2425,52 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_aad_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + begin_reset_aad_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_rotate_cluster_certificates_request_initial( - subscription_id=self._config.subscription_id, + request = build_rotate_cluster_certificates_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._rotate_cluster_certificates_initial.metadata['url'], + template_url=self._rotate_cluster_certificates_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2248,10 +2478,9 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -2261,15 +2490,11 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return if cls: return cls(pipeline_response, None, {}) - _rotate_cluster_certificates_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore - + _rotate_cluster_certificates_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore @distributed_trace - def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + def begin_rotate_cluster_certificates( + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> LROPoller[None]: """Rotates the certificates of a managed cluster. @@ -2277,8 +2502,9 @@ def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-st more details about rotating managed cluster certificates. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -2290,80 +2516,67 @@ def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-st Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._rotate_cluster_certificates_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_rotate_cluster_certificates.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore + begin_rotate_cluster_certificates.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore def _rotate_service_account_signing_keys_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_rotate_service_account_signing_keys_request_initial( - subscription_id=self._config.subscription_id, + request = build_rotate_service_account_signing_keys_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._rotate_service_account_signing_keys_initial.metadata['url'], + template_url=self._rotate_service_account_signing_keys_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2371,10 +2584,9 @@ def _rotate_service_account_signing_keys_initial( # pylint: disable=inconsisten request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -2384,23 +2596,20 @@ def _rotate_service_account_signing_keys_initial( # pylint: disable=inconsisten if cls: return cls(pipeline_response, None, {}) - _rotate_service_account_signing_keys_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateServiceAccountSigningKeys"} # type: ignore - + _rotate_service_account_signing_keys_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateServiceAccountSigningKeys"} # type: ignore @distributed_trace - def begin_rotate_service_account_signing_keys( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + def begin_rotate_service_account_signing_keys( + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> LROPoller[None]: """Rotates the service account signing keys of a managed cluster. Rotates the service account signing keys of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -2412,80 +2621,67 @@ def begin_rotate_service_account_signing_keys( # pylint: disable=inconsistent-r Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._rotate_service_account_signing_keys_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_rotate_service_account_signing_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateServiceAccountSigningKeys"} # type: ignore + begin_rotate_service_account_signing_keys.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateServiceAccountSigningKeys"} # type: ignore def _stop_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_stop_request_initial( - subscription_id=self._config.subscription_id, + request = build_stop_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._stop_initial.metadata['url'], + template_url=self._stop_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2493,10 +2689,9 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -2506,16 +2701,10 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore - + _stop_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore @distributed_trace - def begin_stop( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> LROPoller[None]: + def begin_stop(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> LROPoller[None]: """Stops a Managed Cluster. This can only be performed on Azure Virtual Machine Scale set backed clusters. Stopping a @@ -2525,8 +2714,9 @@ def begin_stop( # pylint: disable=inconsistent-return-statements cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -2538,80 +2728,67 @@ def begin_stop( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._stop_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore + begin_stop.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore def _start_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_start_request_initial( - subscription_id=self._config.subscription_id, + request = build_start_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._start_initial.metadata['url'], + template_url=self._start_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2619,10 +2796,9 @@ def _start_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -2632,24 +2808,19 @@ def _start_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore - + _start_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore @distributed_trace - def begin_start( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> LROPoller[None]: + def begin_start(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> LROPoller[None]: """Starts a previously stopped Managed Cluster. See `starting a cluster `_ for more details about starting a cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -2661,85 +2832,83 @@ def begin_start( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._start_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore + begin_start.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore def _run_command_initial( self, resource_group_name: str, resource_name: str, - request_payload: _models.RunCommandRequest, + request_payload: Union[_models.RunCommandRequest, IO], **kwargs: Any ) -> Optional[_models.RunCommandResult]: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RunCommandResult]] - _json = self._serialize.body(request_payload, 'RunCommandRequest') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(request_payload, (IO, bytes)): + _content = request_payload + else: + _json = self._serialize.body(request_payload, "RunCommandRequest") - request = build_run_command_request_initial( - subscription_id=self._config.subscription_id, + request = build_run_command_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._run_command_initial.metadata['url'], + content=_content, + template_url=self._run_command_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2747,10 +2916,9 @@ def _run_command_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -2759,22 +2927,23 @@ def _run_command_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _run_command_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore - + _run_command_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore - @distributed_trace + @overload def begin_run_command( self, resource_group_name: str, resource_name: str, request_payload: _models.RunCommandRequest, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.RunCommandResult]: """Submits a command to run against the Managed Cluster. @@ -2784,12 +2953,97 @@ def begin_run_command( `_. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param request_payload: The run command request. + :param request_payload: The run command request. Required. :type request_payload: ~azure.mgmt.containerservice.v2022_04_02_preview.models.RunCommandRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either RunCommandResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_04_02_preview.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_run_command( + self, + resource_group_name: str, + resource_name: str, + request_payload: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RunCommandResult]: + """Submits a command to run against the Managed Cluster. + + AKS will create a pod to run the command. This is primarily useful for private clusters. For + more information see `AKS Run Command + `_. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param request_payload: The run command request. Required. + :type request_payload: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either RunCommandResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_04_02_preview.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_run_command( + self, + resource_group_name: str, + resource_name: str, + request_payload: Union[_models.RunCommandRequest, IO], + **kwargs: Any + ) -> LROPoller[_models.RunCommandResult]: + """Submits a command to run against the Managed Cluster. + + AKS will create a pod to run the command. This is primarily useful for private clusters. For + more information see `AKS Run Command + `_. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param request_payload: The run command request. Is either a model type or a IO type. Required. + :type request_payload: + ~azure.mgmt.containerservice.v2022_04_02_preview.models.RunCommandRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -2802,20 +3056,17 @@ def begin_run_command( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_04_02_preview.models.RunCommandResult] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.RunCommandResult] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.RunCommandResult] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._run_command_initial( # type: ignore resource_group_name=resource_group_name, @@ -2823,82 +3074,72 @@ def begin_run_command( request_payload=request_payload, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_run_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore + begin_run_command.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore @distributed_trace def get_command_result( - self, - resource_group_name: str, - resource_name: str, - command_id: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, command_id: str, **kwargs: Any ) -> Optional[_models.RunCommandResult]: """Gets the results of a command which has been run on the Managed Cluster. Gets the results of a command which has been run on the Managed Cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param command_id: Id of the command. + :param command_id: Id of the command. Required. :type command_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: RunCommandResult, or the result of cls(response) + :return: RunCommandResult or None or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.RunCommandResult or None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RunCommandResult]] - request = build_get_command_result_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, command_id=command_id, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_command_result.metadata['url'], + template_url=self.get_command_result.metadata["url"], headers=_headers, params=_params, ) @@ -2906,10 +3147,9 @@ def get_command_result( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -2918,23 +3158,19 @@ def get_command_result( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_command_result.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}"} # type: ignore - + get_command_result.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}"} # type: ignore @distributed_trace def list_outbound_network_dependencies_endpoints( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> Iterable[_models.OutboundEnvironmentEndpointCollection]: + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> Iterable["_models.OutboundEnvironmentEndpoint"]: """Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster. @@ -2942,35 +3178,35 @@ def list_outbound_network_dependencies_endpoints( specified managed cluster. The operation returns properties of each egress endpoint. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OutboundEnvironmentEndpointCollection or the - result of cls(response) + :return: An iterator like instance of either OutboundEnvironmentEndpoint or the result of + cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_04_02_preview.models.OutboundEnvironmentEndpointCollection] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_04_02_preview.models.OutboundEnvironmentEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_outbound_network_dependencies_endpoints_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_outbound_network_dependencies_endpoints.metadata['url'], + template_url=self.list_outbound_network_dependencies_endpoints.metadata["url"], headers=_headers, params=_params, ) @@ -2978,16 +3214,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_outbound_network_dependencies_endpoints_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -3003,10 +3234,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -3016,8 +3245,6 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_outbound_network_dependencies_endpoints.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints"} # type: ignore + list_outbound_network_dependencies_endpoints.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/_operations.py index 51b3039b4de2..597e8d4b6096 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/_operations.py @@ -7,10 +7,15 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,38 +25,34 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - **kwargs: Any -) -> HttpRequest: + +def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.ContainerService/operations") # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class Operations: """ @@ -72,38 +73,33 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.OperationListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.OperationValue"]: """Gets a list of operations. Gets a list of operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationListResult or the result of cls(response) + :return: An iterator like instance of either OperationValue or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_04_02_preview.models.OperationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_04_02_preview.models.OperationValue] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -111,13 +107,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -133,10 +127,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -146,8 +138,6 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.ContainerService/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ContainerService/operations"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/_private_endpoint_connections_operations.py index 3eef39e2c0b5..81bcd6cf26d7 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/_private_endpoint_connections_operations.py @@ -6,11 +6,15 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod @@ -21,173 +25,199 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - subscription_id: str, resource_group_name: str, resource_name: str, private_endpoint_connection_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_update_request( - subscription_id: str, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, - *, - json: Optional[_models.PrivateEndpointConnection] = None, - content: Any = None, + subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request_initial( - subscription_id: str, +def build_delete_request( resource_group_name: str, resource_name: str, private_endpoint_connection_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class PrivateEndpointConnectionsOperations: """ @@ -208,13 +238,9 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnectionListResult: """Gets a list of private endpoint connections in the specified managed cluster. @@ -222,33 +248,31 @@ def list( https://docs.microsoft.com/azure/aks/private-clusters. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnectionListResult, or the result of cls(response) + :return: PrivateEndpointConnectionListResult or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.PrivateEndpointConnectionListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnectionListResult] - request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -256,33 +280,27 @@ def list( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore - + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore @distributed_trace def get( - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnection: """Gets the specified private endpoint connection. @@ -290,35 +308,33 @@ def get( https://docs.microsoft.com/azure/aks/private-clusters. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -326,33 +342,33 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - @distributed_trace + @overload def update( self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, parameters: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateEndpointConnection: """Updates a private endpoint connection. @@ -360,42 +376,117 @@ def update( Updates a private endpoint connection. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str - :param parameters: The updated private endpoint connection. + :param parameters: The updated private endpoint connection. Required. :type parameters: ~azure.mgmt.containerservice.v2022_04_02_preview.models.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: The updated private endpoint connection. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: Union[_models.PrivateEndpointConnection, IO], + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: The updated private endpoint connection. Is either a model type or a IO + type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2022_04_02_preview.models.PrivateEndpointConnection or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - _json = self._serialize.body(parameters, 'PrivateEndpointConnection') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateEndpointConnection") request = build_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update.metadata['url'], + content=_content, + template_url=self.update.metadata["url"], headers=_headers, params=_params, ) @@ -403,52 +494,43 @@ def update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -456,10 +538,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -469,26 +550,22 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + def begin_delete( + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> LROPoller[None]: """Deletes a private endpoint connection. Deletes a private endpoint connection. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -500,53 +577,46 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/_private_link_resources_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/_private_link_resources_operations.py index 574b6151ccff..819e17486e01 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/_private_link_resources_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/_private_link_resources_operations.py @@ -8,9 +8,13 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -19,48 +23,55 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class PrivateLinkResourcesOperations: """ @@ -81,13 +92,9 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.PrivateLinkResourcesListResult: """Gets a list of private link resources in the specified managed cluster. @@ -95,32 +102,30 @@ def list( https://docs.microsoft.com/azure/aks/private-clusters. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResourcesListResult, or the result of cls(response) + :return: PrivateLinkResourcesListResult or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.PrivateLinkResourcesListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResourcesListResult] - request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -128,22 +133,20 @@ def list( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResourcesListResult', pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources"} # type: ignore - + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/_resolve_private_link_service_id_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/_resolve_private_link_service_id_operations.py index 5e4db19ac97b..52ade14eb4fe 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/_resolve_private_link_service_id_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/_resolve_private_link_service_id_operations.py @@ -6,11 +6,15 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -19,56 +23,58 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_post_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.PrivateLinkResource] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + class ResolvePrivateLinkServiceIdOperations: """ @@ -89,13 +95,72 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @overload + def post( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.PrivateLinkResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID for the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters required in order to resolve a private link service ID. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_04_02_preview.models.PrivateLinkResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def post( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID for the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters required in order to resolve a private link service ID. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def post( self, resource_group_name: str, resource_name: str, - parameters: _models.PrivateLinkResource, + parameters: Union[_models.PrivateLinkResource, IO], **kwargs: Any ) -> _models.PrivateLinkResource: """Gets the private link service ID for the specified managed cluster. @@ -103,38 +168,49 @@ def post( Gets the private link service ID for the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters required in order to resolve a private link service ID. + :param parameters: Parameters required in order to resolve a private link service ID. Is either + a model type or a IO type. Required. :type parameters: ~azure.mgmt.containerservice.v2022_04_02_preview.models.PrivateLinkResource + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResource, or the result of cls(response) + :return: PrivateLinkResource or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.PrivateLinkResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResource] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResource] - _json = self._serialize.body(parameters, 'PrivateLinkResource') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateLinkResource") request = build_post_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.post.metadata['url'], + content=_content, + template_url=self.post.metadata["url"], headers=_headers, params=_params, ) @@ -142,22 +218,20 @@ def post( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResource', pipeline_response) + deserialized = self._deserialize("PrivateLinkResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - post.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId"} # type: ignore - + post.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/_snapshots_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/_snapshots_operations.py index 7a2ad6a46c77..74a1ed50280e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/_snapshots_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/_snapshots_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,243 +25,233 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots") path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_resource_group_request( - subscription_id: str, - resource_group_name: str, - **kwargs: Any -) -> HttpRequest: +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: + _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, resource_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.Snapshot] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_update_tags_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.TagsObject] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class SnapshotsOperations: """ @@ -277,39 +272,34 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.SnapshotListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.Snapshot"]: """Gets a list of snapshots in the specified subscription. Gets a list of snapshots in the specified subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SnapshotListResult or the result of cls(response) + :return: An iterator like instance of either Snapshot or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_04_02_preview.models.SnapshotListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_04_02_preview.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SnapshotListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -317,14 +307,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -340,10 +327,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -353,48 +338,42 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots"} # type: ignore @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> Iterable[_models.SnapshotListResult]: + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Snapshot"]: """Lists snapshots in the specified subscription and resource group. Lists snapshots in the specified subscription and resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SnapshotListResult or the result of cls(response) + :return: An iterator like instance of either Snapshot or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_04_02_preview.models.SnapshotListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_04_02_preview.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SnapshotListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -402,15 +381,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -426,10 +401,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -439,50 +412,41 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots"} # type: ignore @distributed_trace - def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.Snapshot: + def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.Snapshot: """Gets a snapshot. Gets a snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Snapshot, or the result of cls(response) + :return: Snapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.Snapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -490,32 +454,32 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - - @distributed_trace + @overload def create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.Snapshot, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.Snapshot: """Creates or updates a snapshot. @@ -523,38 +487,102 @@ def create_or_update( Creates or updates a snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The snapshot to create or update. + :param parameters: The snapshot to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_04_02_preview.models.Snapshot + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Snapshot, or the result of cls(response) + :return: Snapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.Snapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Snapshot: + """Creates or updates a snapshot. + + Creates or updates a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The snapshot to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.Snapshot, IO], **kwargs: Any + ) -> _models.Snapshot: + """Creates or updates a snapshot. + + Creates or updates a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The snapshot to create or update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.mgmt.containerservice.v2022_04_02_preview.models.Snapshot or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] - _json = self._serialize.body(parameters, 'Snapshot') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "Snapshot") request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) @@ -562,10 +590,9 @@ def create_or_update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -573,25 +600,26 @@ def create_or_update( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - - @distributed_trace + @overload def update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.Snapshot: """Updates tags on a snapshot. @@ -599,38 +627,102 @@ def update_tags( Updates tags on a snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update snapshot Tags operation. + :param parameters: Parameters supplied to the Update snapshot Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2022_04_02_preview.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Snapshot, or the result of cls(response) + :return: Snapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.Snapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + def update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Snapshot: + """Updates tags on a snapshot. + + Updates tags on a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update snapshot Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> _models.Snapshot: + """Updates tags on a snapshot. + + Updates tags on a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update snapshot Tags operation. Is either a model + type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_04_02_preview.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") request = build_update_tags_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_tags.metadata['url'], + content=_content, + template_url=self.update_tags.metadata["url"], headers=_headers, params=_params, ) @@ -638,64 +730,57 @@ def update_tags( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - + update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore @distributed_trace def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: """Deletes a snapshot. Deletes a snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) @@ -703,10 +788,9 @@ def delete( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -716,5 +800,4 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - + delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/_trusted_access_role_bindings_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/_trusted_access_role_bindings_operations.py index b80d4a1670d2..7ae4638b1410 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/_trusted_access_role_bindings_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/_trusted_access_role_bindings_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,173 +25,199 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - subscription_id: str, resource_group_name: str, resource_name: str, trusted_access_role_binding_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "trustedAccessRoleBindingName": _SERIALIZER.url("trusted_access_role_binding_name", trusted_access_role_binding_name, 'str', max_length=36, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "trustedAccessRoleBindingName": _SERIALIZER.url( + "trusted_access_role_binding_name", trusted_access_role_binding_name, "str", max_length=36, min_length=1 + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_request( - subscription_id: str, resource_group_name: str, resource_name: str, trusted_access_role_binding_name: str, - *, - json: Optional[_models.TrustedAccessRoleBinding] = None, - content: Any = None, + subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "trustedAccessRoleBindingName": _SERIALIZER.url("trusted_access_role_binding_name", trusted_access_role_binding_name, 'str', max_length=36, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "trustedAccessRoleBindingName": _SERIALIZER.url( + "trusted_access_role_binding_name", trusted_access_role_binding_name, "str", max_length=36, min_length=1 + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_request( - subscription_id: str, resource_group_name: str, resource_name: str, trusted_access_role_binding_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "trustedAccessRoleBindingName": _SERIALIZER.url("trusted_access_role_binding_name", trusted_access_role_binding_name, 'str', max_length=36, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "trustedAccessRoleBindingName": _SERIALIZER.url( + "trusted_access_role_binding_name", trusted_access_role_binding_name, "str", max_length=36, min_length=1 + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class TrustedAccessRoleBindingsOperations: """ @@ -207,48 +238,44 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> Iterable[_models.TrustedAccessRoleBindingListResult]: + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> Iterable["_models.TrustedAccessRoleBinding"]: """List trusted access role bindings. List trusted access role bindings. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either TrustedAccessRoleBindingListResult or the result - of cls(response) + :return: An iterator like instance of either TrustedAccessRoleBinding or the result of + cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_04_02_preview.models.TrustedAccessRoleBindingListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_04_02_preview.models.TrustedAccessRoleBinding] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.TrustedAccessRoleBindingListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.TrustedAccessRoleBindingListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -256,16 +283,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -281,10 +303,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -294,54 +314,46 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings"} # type: ignore @distributed_trace def get( - self, - resource_group_name: str, - resource_name: str, - trusted_access_role_binding_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, trusted_access_role_binding_name: str, **kwargs: Any ) -> _models.TrustedAccessRoleBinding: """Get a trusted access role binding. Get a trusted access role binding. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param trusted_access_role_binding_name: The name of trusted access role binding. + :param trusted_access_role_binding_name: The name of trusted access role binding. Required. :type trusted_access_role_binding_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: TrustedAccessRoleBinding, or the result of cls(response) + :return: TrustedAccessRoleBinding or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.TrustedAccessRoleBinding - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.TrustedAccessRoleBinding] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.TrustedAccessRoleBinding] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, trusted_access_role_binding_name=trusted_access_role_binding_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -349,33 +361,33 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('TrustedAccessRoleBinding', pipeline_response) + deserialized = self._deserialize("TrustedAccessRoleBinding", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}"} # type: ignore - @distributed_trace + @overload def create_or_update( self, resource_group_name: str, resource_name: str, trusted_access_role_binding_name: str, trusted_access_role_binding: _models.TrustedAccessRoleBinding, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.TrustedAccessRoleBinding: """Create or update a trusted access role binding. @@ -383,42 +395,117 @@ def create_or_update( Create or update a trusted access role binding. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param trusted_access_role_binding_name: The name of trusted access role binding. + :param trusted_access_role_binding_name: The name of trusted access role binding. Required. :type trusted_access_role_binding_name: str - :param trusted_access_role_binding: A trusted access role binding. + :param trusted_access_role_binding: A trusted access role binding. Required. :type trusted_access_role_binding: ~azure.mgmt.containerservice.v2022_04_02_preview.models.TrustedAccessRoleBinding + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TrustedAccessRoleBinding or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.TrustedAccessRoleBinding + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + trusted_access_role_binding_name: str, + trusted_access_role_binding: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.TrustedAccessRoleBinding: + """Create or update a trusted access role binding. + + Create or update a trusted access role binding. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param trusted_access_role_binding_name: The name of trusted access role binding. Required. + :type trusted_access_role_binding_name: str + :param trusted_access_role_binding: A trusted access role binding. Required. + :type trusted_access_role_binding: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TrustedAccessRoleBinding or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.TrustedAccessRoleBinding + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + trusted_access_role_binding_name: str, + trusted_access_role_binding: Union[_models.TrustedAccessRoleBinding, IO], + **kwargs: Any + ) -> _models.TrustedAccessRoleBinding: + """Create or update a trusted access role binding. + + Create or update a trusted access role binding. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param trusted_access_role_binding_name: The name of trusted access role binding. Required. + :type trusted_access_role_binding_name: str + :param trusted_access_role_binding: A trusted access role binding. Is either a model type or a + IO type. Required. + :type trusted_access_role_binding: + ~azure.mgmt.containerservice.v2022_04_02_preview.models.TrustedAccessRoleBinding or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: TrustedAccessRoleBinding, or the result of cls(response) + :return: TrustedAccessRoleBinding or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.TrustedAccessRoleBinding - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.TrustedAccessRoleBinding] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.TrustedAccessRoleBinding] - _json = self._serialize.body(trusted_access_role_binding, 'TrustedAccessRoleBinding') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(trusted_access_role_binding, (IO, bytes)): + _content = trusted_access_role_binding + else: + _json = self._serialize.body(trusted_access_role_binding, "TrustedAccessRoleBinding") request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, trusted_access_role_binding_name=trusted_access_role_binding_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) @@ -426,68 +513,60 @@ def create_or_update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('TrustedAccessRoleBinding', pipeline_response) + deserialized = self._deserialize("TrustedAccessRoleBinding", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}"} # type: ignore - + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}"} # type: ignore @distributed_trace def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - trusted_access_role_binding_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, trusted_access_role_binding_name: str, **kwargs: Any ) -> None: """Delete a trusted access role binding. Delete a trusted access role binding. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param trusted_access_role_binding_name: The name of trusted access role binding. + :param trusted_access_role_binding_name: The name of trusted access role binding. Required. :type trusted_access_role_binding_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, trusted_access_role_binding_name=trusted_access_role_binding_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) @@ -495,10 +574,9 @@ def delete( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -508,5 +586,4 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}"} # type: ignore - + delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/_trusted_access_roles_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/_trusted_access_roles_operations.py index 72a85e2acf37..a04e83345854 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/_trusted_access_roles_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/_trusted_access_roles_operations.py @@ -7,10 +7,15 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,46 +25,43 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - subscription_id: str, - location: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_request(location: 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/trustedAccessRoles") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/trustedAccessRoles", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "location": _SERIALIZER.url("location", location, 'str', min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "location": _SERIALIZER.url("location", location, "str", min_length=1), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class TrustedAccessRolesOperations: """ @@ -80,44 +82,37 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - location: str, - **kwargs: Any - ) -> Iterable[_models.TrustedAccessRoleListResult]: + def list(self, location: str, **kwargs: Any) -> Iterable["_models.TrustedAccessRole"]: """List supported trusted access roles. List supported trusted access roles. - :param location: The name of Azure region. + :param location: The name of Azure region. Required. :type location: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either TrustedAccessRoleListResult or the result of - cls(response) + :return: An iterator like instance of either TrustedAccessRole or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_04_02_preview.models.TrustedAccessRoleListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_04_02_preview.models.TrustedAccessRole] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.TrustedAccessRoleListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-04-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.TrustedAccessRoleListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( - subscription_id=self._config.subscription_id, location=location, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -125,15 +120,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - location=location, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -149,10 +140,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -162,8 +151,6 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/trustedAccessRoles"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/trustedAccessRoles"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/__init__.py index 37a5f9e02e6f..a8716d29afe8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/__init__.py @@ -14,7 +14,8 @@ except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['ContainerServiceClient'] + +__all__ = ["ContainerServiceClient"] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/_configuration.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/_configuration.py index 769a9ae783c8..a0270a521d4d 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/_configuration.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/_configuration.py @@ -18,29 +18,25 @@ VERSION = "unknown" + class ContainerServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ContainerServiceClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :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. + :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2022-05-02-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: + def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ContainerServiceClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + api_version = kwargs.pop("api_version", "2022-05-02-preview") # type: str if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -50,23 +46,24 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-containerservice/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-containerservice/{}".format(VERSION)) self._configure(**kwargs) def _configure( - self, - **kwargs # type: Any + self, **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/_container_service_client.py index 6042fa347730..4a58e9c8489c 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/_container_service_client.py @@ -9,20 +9,32 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from . import models +from .._serialization import Deserializer, Serializer from ._configuration import ContainerServiceClientConfiguration -from .operations import AgentPoolsOperations, MaintenanceConfigurationsOperations, ManagedClusterSnapshotsOperations, ManagedClustersOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, ResolvePrivateLinkServiceIdOperations, SnapshotsOperations, TrustedAccessRoleBindingsOperations, TrustedAccessRolesOperations +from .operations import ( + AgentPoolsOperations, + MaintenanceConfigurationsOperations, + ManagedClusterSnapshotsOperations, + ManagedClustersOperations, + Operations, + PrivateEndpointConnectionsOperations, + PrivateLinkResourcesOperations, + ResolvePrivateLinkServiceIdOperations, + SnapshotsOperations, + TrustedAccessRoleBindingsOperations, + TrustedAccessRolesOperations, +) if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class ContainerServiceClient: # pylint: disable=too-many-instance-attributes + +class ContainerServiceClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """The Container Service Client. :ivar operations: Operations operations @@ -57,9 +69,9 @@ class ContainerServiceClient: # pylint: disable=too-many-instance-attributes :ivar trusted_access_role_bindings: TrustedAccessRoleBindingsOperations operations :vartype trusted_access_role_bindings: azure.mgmt.containerservice.v2022_05_02_preview.operations.TrustedAccessRoleBindingsOperations - :param credential: Credential needed for the client to connect to Azure. + :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. + :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -77,25 +89,23 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = ContainerServiceClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = ContainerServiceClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize - ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.managed_clusters = ManagedClustersOperations( self._client, self._config, self._serialize, self._deserialize ) self.maintenance_configurations = MaintenanceConfigurationsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.agent_pools = AgentPoolsOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) self.private_endpoint_connections = PrivateEndpointConnectionsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -105,9 +115,7 @@ def __init__( self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations( self._client, self._config, self._serialize, self._deserialize ) - self.snapshots = SnapshotsOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.snapshots = SnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) self.managed_cluster_snapshots = ManagedClusterSnapshotsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -118,12 +126,7 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) - - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> HttpResponse: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -132,7 +135,7 @@ def _send_request( >>> response = client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/_metadata.json b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/_metadata.json index 278371e37bdf..77f5efcf8657 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/_metadata.json +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/_metadata.json @@ -10,20 +10,20 @@ "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { "credential": { - "signature": "credential, # type: \"TokenCredential\"", - "description": "Credential needed for the client to connect to Azure.", + "signature": "credential: \"TokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true }, "subscription_id": { - "signature": "subscription_id, # type: str", - "description": "The ID of the target subscription.", + "signature": "subscription_id: str,", + "description": "The ID of the target subscription. Required.", "docstring_type": "str", "required": true } @@ -31,13 +31,13 @@ "async": { "credential": { "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure.", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { "signature": "subscription_id: str,", - "description": "The ID of the target subscription.", + "description": "The ID of the target subscription. Required.", "docstring_type": "str", "required": true } @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=\"https://management.azure.com\", # type: str", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/_patch.py index 74e48ecd07cf..f99e77fef986 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/_patch.py @@ -28,4 +28,4 @@ # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + pass diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/_vendor.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/_vendor.py index 138f663c53a4..9aad73fc743e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/_vendor.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/_vendor.py @@ -7,6 +7,7 @@ from azure.core.pipeline.transport import HttpRequest + def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) @@ -14,6 +15,7 @@ def _convert_request(request, files=None): request.set_formdata_body(files) return request + def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -21,7 +23,5 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [ - c for c in formatted_components if "{}".format(key.args[0]) not in c - ] + components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/__init__.py index 37a5f9e02e6f..a8716d29afe8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/__init__.py @@ -14,7 +14,8 @@ except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['ContainerServiceClient'] + +__all__ = ["ContainerServiceClient"] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/_configuration.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/_configuration.py index 6a8f8df97cda..9a9dac2c2c79 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/_configuration.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/_configuration.py @@ -18,29 +18,25 @@ VERSION = "unknown" + class ContainerServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ContainerServiceClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :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. + :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2022-05-02-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: + def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ContainerServiceClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + api_version = kwargs.pop("api_version", "2022-05-02-preview") # type: str if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -50,22 +46,21 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-containerservice/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-containerservice/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, - **kwargs: Any - ) -> None: - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/_container_service_client.py index d40a94fd59b4..6c96f549b8ec 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/_container_service_client.py @@ -9,20 +9,32 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from .. import models +from ..._serialization import Deserializer, Serializer from ._configuration import ContainerServiceClientConfiguration -from .operations import AgentPoolsOperations, MaintenanceConfigurationsOperations, ManagedClusterSnapshotsOperations, ManagedClustersOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, ResolvePrivateLinkServiceIdOperations, SnapshotsOperations, TrustedAccessRoleBindingsOperations, TrustedAccessRolesOperations +from .operations import ( + AgentPoolsOperations, + MaintenanceConfigurationsOperations, + ManagedClusterSnapshotsOperations, + ManagedClustersOperations, + Operations, + PrivateEndpointConnectionsOperations, + PrivateLinkResourcesOperations, + ResolvePrivateLinkServiceIdOperations, + SnapshotsOperations, + TrustedAccessRoleBindingsOperations, + TrustedAccessRolesOperations, +) if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class ContainerServiceClient: # pylint: disable=too-many-instance-attributes + +class ContainerServiceClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """The Container Service Client. :ivar operations: Operations operations @@ -57,9 +69,9 @@ class ContainerServiceClient: # pylint: disable=too-many-instance-attributes :ivar trusted_access_role_bindings: TrustedAccessRoleBindingsOperations operations :vartype trusted_access_role_bindings: azure.mgmt.containerservice.v2022_05_02_preview.aio.operations.TrustedAccessRoleBindingsOperations - :param credential: Credential needed for the client to connect to Azure. + :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. + :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -77,25 +89,23 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = ContainerServiceClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = ContainerServiceClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize - ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.managed_clusters = ManagedClustersOperations( self._client, self._config, self._serialize, self._deserialize ) self.maintenance_configurations = MaintenanceConfigurationsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.agent_pools = AgentPoolsOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) self.private_endpoint_connections = PrivateEndpointConnectionsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -105,9 +115,7 @@ def __init__( self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations( self._client, self._config, self._serialize, self._deserialize ) - self.snapshots = SnapshotsOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.snapshots = SnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) self.managed_cluster_snapshots = ManagedClusterSnapshotsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -118,12 +126,7 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) - - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -132,7 +135,7 @@ def _send_request( >>> response = await client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/_patch.py index 74e48ecd07cf..f99e77fef986 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/_patch.py @@ -28,4 +28,4 @@ # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass \ No newline at end of file + pass diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/__init__.py index fe53dc12e778..6a931af99fa3 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/__init__.py @@ -21,18 +21,19 @@ from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'Operations', - 'ManagedClustersOperations', - 'MaintenanceConfigurationsOperations', - 'AgentPoolsOperations', - 'PrivateEndpointConnectionsOperations', - 'PrivateLinkResourcesOperations', - 'ResolvePrivateLinkServiceIdOperations', - 'SnapshotsOperations', - 'ManagedClusterSnapshotsOperations', - 'TrustedAccessRolesOperations', - 'TrustedAccessRoleBindingsOperations', + "Operations", + "ManagedClustersOperations", + "MaintenanceConfigurationsOperations", + "AgentPoolsOperations", + "PrivateEndpointConnectionsOperations", + "PrivateLinkResourcesOperations", + "ResolvePrivateLinkServiceIdOperations", + "SnapshotsOperations", + "ManagedClusterSnapshotsOperations", + "TrustedAccessRolesOperations", + "TrustedAccessRoleBindingsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/_agent_pools_operations.py index 882395492aff..9360a8ea9816 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/_agent_pools_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +29,20 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._agent_pools_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_available_agent_pool_versions_request, build_get_request, build_get_upgrade_profile_request, build_list_request, build_upgrade_node_image_version_request_initial -T = TypeVar('T') +from ...operations._agent_pools_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_available_agent_pool_versions_request, + build_get_request, + build_get_upgrade_profile_request, + build_list_request, + build_upgrade_node_image_version_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class AgentPoolsOperations: """ .. warning:: @@ -45,47 +62,41 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.AgentPoolListResult]: + def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncIterable["_models.AgentPool"]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AgentPoolListResult or the result of cls(response) + :return: An iterator like instance of either AgentPool or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_05_02_preview.models.AgentPoolListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_05_02_preview.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -93,16 +104,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -118,10 +124,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -131,54 +135,46 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore @distributed_trace_async async def get( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPool: """Gets the specified managed cluster agent pool. Gets the specified managed cluster agent pool. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPool, or the result of cls(response) + :return: AgentPool or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.AgentPool - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -186,57 +182,60 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore async def _create_or_update_initial( self, resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: _models.AgentPool, + parameters: Union[_models.AgentPool, IO], **kwargs: Any ) -> _models.AgentPool: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - _json = self._serialize.body(parameters, 'AgentPool') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "AgentPool") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -244,10 +243,9 @@ async def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -255,26 +253,27 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - - @distributed_trace_async + @overload async def begin_create_or_update( self, resource_group_name: str, resource_name: str, agent_pool_name: str, parameters: _models.AgentPool, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.AgentPool]: """Creates or updates an agent pool in the specified managed cluster. @@ -282,13 +281,59 @@ async def begin_create_or_update( Creates or updates an agent pool in the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str - :param parameters: The agent pool to create or update. + :param parameters: The agent pool to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_05_02_preview.models.AgentPool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AgentPool or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_05_02_preview.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AgentPool]: + """Creates or updates an agent pool in the specified managed cluster. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: The agent pool to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -301,20 +346,58 @@ async def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_05_02_preview.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: Union[_models.AgentPool, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.AgentPool]: + """Creates or updates an agent pool in the specified managed cluster. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: The agent pool to create or update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.mgmt.containerservice.v2022_05_02_preview.models.AgentPool or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AgentPool or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_05_02_preview.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -323,39 +406,35 @@ async def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements self, @@ -365,26 +444,23 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements ignore_pod_disruption_budget: Optional[bool] = None, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, - api_version=api_version, + subscription_id=self._config.subscription_id, ignore_pod_disruption_budget=ignore_pod_disruption_budget, - template_url=self._delete_initial.metadata['url'], + api_version=api_version, + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -392,10 +468,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -405,11 +480,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements + async def begin_delete( self, resource_group_name: str, resource_name: str, @@ -422,10 +496,11 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Deletes an agent pool in the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :param ignore_pod_disruption_budget: ignore-pod-disruption-budget=true to delete those pods on a node without considering Pod Disruption Budget. Default value is None. @@ -440,19 +515,16 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -460,80 +532,70 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements agent_pool_name=agent_pool_name, ignore_pod_disruption_budget=ignore_pod_disruption_budget, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace_async async def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPoolUpgradeProfile: """Gets the upgrade profile for an agent pool. Gets the upgrade profile for an agent pool. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolUpgradeProfile, or the result of cls(response) + :return: AgentPoolUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.AgentPoolUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -541,32 +603,27 @@ async def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolUpgradeProfile', pipeline_response) + deserialized = self._deserialize("AgentPoolUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore @distributed_trace_async async def get_available_agent_pool_versions( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported Kubernetes versions for the specified agent pool. @@ -575,32 +632,30 @@ async def get_available_agent_pool_versions( the version lifecycle. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolAvailableVersions, or the result of cls(response) + :return: AgentPoolAvailableVersions or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.AgentPoolAvailableVersions - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolAvailableVersions] - request = build_get_available_agent_pool_versions_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_available_agent_pool_versions.metadata['url'], + template_url=self.get_available_agent_pool_versions.metadata["url"], headers=_headers, params=_params, ) @@ -608,52 +663,43 @@ async def get_available_agent_pool_versions( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolAvailableVersions', pipeline_response) + deserialized = self._deserialize("AgentPoolAvailableVersions", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_available_agent_pool_versions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore - + get_available_agent_pool_versions.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore async def _upgrade_node_image_version_initial( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> Optional[_models.AgentPool]: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.AgentPool]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.AgentPool]] - - request = build_upgrade_node_image_version_request_initial( - subscription_id=self._config.subscription_id, + request = build_upgrade_node_image_version_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._upgrade_node_image_version_initial.metadata['url'], + template_url=self._upgrade_node_image_version_initial.metadata["url"], headers=_headers, params=_params, ) @@ -661,10 +707,9 @@ async def _upgrade_node_image_version_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -674,26 +719,23 @@ async def _upgrade_node_image_version_initial( deserialized = None response_headers = {} if response.status_code == 202: - response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) - - deserialized = self._deserialize('AgentPool', pipeline_response) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _upgrade_node_image_version_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore - + _upgrade_node_image_version_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore @distributed_trace_async async def begin_upgrade_node_image_version( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any - ) -> AsyncLROPoller[_models.AgentPool]: + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: """Upgrades the node image version of an agent pool to the latest. Upgrading the node image version of an agent pool applies the newest OS and runtime updates to @@ -701,10 +743,11 @@ async def begin_upgrade_node_image_version( node image versions, see: https://docs.microsoft.com/azure/aks/node-image-upgrade. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -718,59 +761,54 @@ async def begin_upgrade_node_image_version( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_05_02_preview.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._upgrade_node_image_version_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) - - deserialized = self._deserialize('AgentPool', pipeline_response) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_upgrade_node_image_version.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore + begin_upgrade_node_image_version.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/_maintenance_configurations_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/_maintenance_configurations_operations.py index a3efb1a31733..955f11d44b47 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/_maintenance_configurations_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/_maintenance_configurations_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,10 +27,17 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._maintenance_configurations_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_managed_cluster_request -T = TypeVar('T') +from ...operations._maintenance_configurations_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_managed_cluster_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class MaintenanceConfigurationsOperations: """ .. warning:: @@ -43,48 +57,44 @@ def __init__(self, *args, **kwargs) -> None: 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_managed_cluster( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.MaintenanceConfigurationListResult]: + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> AsyncIterable["_models.MaintenanceConfiguration"]: """Gets a list of maintenance configurations in the specified managed cluster. Gets a list of maintenance configurations in the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either MaintenanceConfigurationListResult or the result - of cls(response) + :return: An iterator like instance of either MaintenanceConfiguration or the result of + cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_05_02_preview.models.MaintenanceConfigurationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_05_02_preview.models.MaintenanceConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfigurationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfigurationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_managed_cluster_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_managed_cluster.metadata['url'], + template_url=self.list_by_managed_cluster.metadata["url"], headers=_headers, params=_params, ) @@ -92,16 +102,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_managed_cluster_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -117,10 +122,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -130,54 +133,46 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_managed_cluster.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations"} # type: ignore + list_by_managed_cluster.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations"} # type: ignore @distributed_trace_async async def get( - self, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, config_name: str, **kwargs: Any ) -> _models.MaintenanceConfiguration: """Gets the specified maintenance configuration of a managed cluster. Gets the specified maintenance configuration of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: MaintenanceConfiguration, or the result of cls(response) + :return: MaintenanceConfiguration or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.MaintenanceConfiguration - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfiguration] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -185,33 +180,33 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) + deserialized = self._deserialize("MaintenanceConfiguration", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - @distributed_trace_async + @overload async def create_or_update( self, resource_group_name: str, resource_name: str, config_name: str, parameters: _models.MaintenanceConfiguration, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.MaintenanceConfiguration: """Creates or updates a maintenance configuration in the specified managed cluster. @@ -219,42 +214,117 @@ async def create_or_update( Creates or updates a maintenance configuration in the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str - :param parameters: The maintenance configuration to create or update. + :param parameters: The maintenance configuration to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_05_02_preview.models.MaintenanceConfiguration + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configuration in the specified managed cluster. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: The maintenance configuration to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: MaintenanceConfiguration, or the result of cls(response) + :return: MaintenanceConfiguration or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.MaintenanceConfiguration - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: Union[_models.MaintenanceConfiguration, IO], + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configuration in the specified managed cluster. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: The maintenance configuration to create or update. Is either a model type or + a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2022_05_02_preview.models.MaintenanceConfiguration or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfiguration] - _json = self._serialize.body(parameters, 'MaintenanceConfiguration') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "MaintenanceConfiguration") request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) @@ -262,68 +332,60 @@ async def create_or_update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) + deserialized = self._deserialize("MaintenanceConfiguration", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, config_name: str, **kwargs: Any ) -> None: """Deletes a maintenance configuration. Deletes a maintenance configuration. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) @@ -331,10 +393,9 @@ async def delete( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -344,5 +405,4 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/_managed_cluster_snapshots_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/_managed_cluster_snapshots_operations.py index 0bef20e9ed83..5b4a01622afe 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/_managed_cluster_snapshots_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/_managed_cluster_snapshots_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,10 +27,19 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._managed_cluster_snapshots_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_resource_group_request, build_list_request, build_update_tags_request -T = TypeVar('T') +from ...operations._managed_cluster_snapshots_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_resource_group_request, + build_list_request, + build_update_tags_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class ManagedClusterSnapshotsOperations: """ .. warning:: @@ -43,40 +59,35 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.ManagedClusterSnapshotListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.ManagedClusterSnapshot"]: """Gets a list of managed cluster snapshots in the specified subscription. Gets a list of managed cluster snapshots in the specified subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterSnapshotListResult or the result of + :return: An iterator like instance of either ManagedClusterSnapshot or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedClusterSnapshotListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedClusterSnapshot] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshotListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterSnapshotListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -84,14 +95,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -107,10 +115,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -120,49 +126,45 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedclustersnapshots"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedclustersnapshots"} # type: ignore @distributed_trace def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.ManagedClusterSnapshotListResult]: + self, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ManagedClusterSnapshot"]: """Lists managed cluster snapshots in the specified subscription and resource group. Lists managed cluster snapshots in the specified subscription and resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterSnapshotListResult or the result of + :return: An iterator like instance of either ManagedClusterSnapshot or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedClusterSnapshotListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedClusterSnapshot] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshotListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterSnapshotListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -170,15 +172,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -194,10 +192,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -207,50 +203,41 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots"} # type: ignore @distributed_trace_async - async def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.ManagedClusterSnapshot: + async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.ManagedClusterSnapshot: """Gets a managed cluster snapshot. Gets a managed cluster snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterSnapshot, or the result of cls(response) + :return: ManagedClusterSnapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedClusterSnapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterSnapshot] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -258,32 +245,32 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterSnapshot', pipeline_response) + deserialized = self._deserialize("ManagedClusterSnapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"} # type: ignore - @distributed_trace_async + @overload async def create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterSnapshot, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.ManagedClusterSnapshot: """Creates or updates a managed cluster snapshot. @@ -291,39 +278,108 @@ async def create_or_update( Creates or updates a managed cluster snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The managed cluster snapshot to create or update. + :param parameters: The managed cluster snapshot to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedClusterSnapshot + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedClusterSnapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedClusterSnapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ManagedClusterSnapshot: + """Creates or updates a managed cluster snapshot. + + Creates or updates a managed cluster snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster snapshot to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedClusterSnapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedClusterSnapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterSnapshot, IO], + **kwargs: Any + ) -> _models.ManagedClusterSnapshot: + """Creates or updates a managed cluster snapshot. + + Creates or updates a managed cluster snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster snapshot to create or update. Is either a model type or + a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedClusterSnapshot or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterSnapshot, or the result of cls(response) + :return: ManagedClusterSnapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedClusterSnapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterSnapshot] - _json = self._serialize.body(parameters, 'ManagedClusterSnapshot') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterSnapshot") request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) @@ -331,10 +387,9 @@ async def create_or_update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -342,25 +397,26 @@ async def create_or_update( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ManagedClusterSnapshot', pipeline_response) + deserialized = self._deserialize("ManagedClusterSnapshot", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('ManagedClusterSnapshot', pipeline_response) + deserialized = self._deserialize("ManagedClusterSnapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"} # type: ignore - + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"} # type: ignore - @distributed_trace_async + @overload async def update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.ManagedClusterSnapshot: """Updates tags on a managed cluster snapshot. @@ -368,38 +424,104 @@ async def update_tags( Updates tags on a managed cluster snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Update managed cluster snapshot Tags operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2022_05_02_preview.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedClusterSnapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedClusterSnapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ManagedClusterSnapshot: + """Updates tags on a managed cluster snapshot. + + Updates tags on a managed cluster snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update managed cluster snapshot Tags operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterSnapshot, or the result of cls(response) + :return: ManagedClusterSnapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedClusterSnapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @distributed_trace_async + async def update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> _models.ManagedClusterSnapshot: + """Updates tags on a managed cluster snapshot. + + Updates tags on a managed cluster snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update managed cluster snapshot Tags operation. + Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_05_02_preview.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedClusterSnapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedClusterSnapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterSnapshot] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") request = build_update_tags_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_tags.metadata['url'], + content=_content, + template_url=self.update_tags.metadata["url"], headers=_headers, params=_params, ) @@ -407,64 +529,57 @@ async def update_tags( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterSnapshot', pipeline_response) + deserialized = self._deserialize("ManagedClusterSnapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"} # type: ignore - + update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"} # type: ignore @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: """Deletes a managed cluster snapshot. Deletes a managed cluster snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) @@ -472,10 +587,9 @@ async def delete( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -485,5 +599,4 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"} # type: ignore - + delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/_managed_clusters_operations.py index d0d9752bcfc5..7bcfb6eb03c2 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/_managed_clusters_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +29,34 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._managed_clusters_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_access_profile_request, build_get_command_result_request, build_get_os_options_request, build_get_request, build_get_upgrade_profile_request, build_list_by_resource_group_request, build_list_cluster_admin_credentials_request, build_list_cluster_monitoring_user_credentials_request, build_list_cluster_user_credentials_request, build_list_outbound_network_dependencies_endpoints_request, build_list_request, build_reset_aad_profile_request_initial, build_reset_service_principal_profile_request_initial, build_rotate_cluster_certificates_request_initial, build_rotate_service_account_signing_keys_request_initial, build_run_command_request_initial, build_start_request_initial, build_stop_request_initial, build_update_tags_request_initial -T = TypeVar('T') +from ...operations._managed_clusters_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_access_profile_request, + build_get_command_result_request, + build_get_os_options_request, + build_get_request, + build_get_upgrade_profile_request, + build_list_by_resource_group_request, + build_list_cluster_admin_credentials_request, + build_list_cluster_monitoring_user_credentials_request, + build_list_cluster_user_credentials_request, + build_list_outbound_network_dependencies_endpoints_request, + build_list_request, + build_reset_aad_profile_request, + build_reset_service_principal_profile_request, + build_rotate_cluster_certificates_request, + build_rotate_service_account_signing_keys_request, + build_run_command_request, + build_start_request, + build_stop_request, + build_update_tags_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class ManagedClustersOperations: # pylint: disable=too-many-public-methods """ .. warning:: @@ -45,46 +76,39 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async async def get_os_options( - self, - location: str, - resource_type: Optional[str] = None, - **kwargs: Any + self, location: str, resource_type: Optional[str] = None, **kwargs: Any ) -> _models.OSOptionProfile: """Gets supported OS options in the specified subscription. Gets supported OS options in the specified subscription. - :param location: The name of Azure region. + :param location: The name of Azure region. Required. :type location: str :param resource_type: The resource type for which the OS options needs to be returned. Default value is None. :type resource_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: OSOptionProfile, or the result of cls(response) + :return: OSOptionProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.OSOptionProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OSOptionProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OSOptionProfile] - request = build_get_os_options_request( - subscription_id=self._config.subscription_id, location=location, - api_version=api_version, + subscription_id=self._config.subscription_id, resource_type=resource_type, - template_url=self.get_os_options.metadata['url'], + api_version=api_version, + template_url=self.get_os_options.metadata["url"], headers=_headers, params=_params, ) @@ -92,59 +116,52 @@ async def get_os_options( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('OSOptionProfile', pipeline_response) + deserialized = self._deserialize("OSOptionProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_os_options.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default"} # type: ignore - + get_os_options.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default"} # type: ignore @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.ManagedClusterListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.ManagedCluster"]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -152,14 +169,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -175,10 +189,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -188,49 +200,44 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.ManagedClusterListResult]: + self, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ManagedCluster"]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -238,15 +245,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -262,10 +265,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -275,50 +276,43 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace_async async def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.ManagedClusterUpgradeProfile: """Gets the upgrade profile of a managed cluster. Gets the upgrade profile of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterUpgradeProfile, or the result of cls(response) + :return: ManagedClusterUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedClusterUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -326,33 +320,27 @@ async def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterUpgradeProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore @distributed_trace_async async def get_access_profile( - self, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, role_name: str, **kwargs: Any ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. @@ -362,35 +350,33 @@ async def get_access_profile( `_ . :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param role_name: The name of the role for managed cluster accessProfile resource. + :param role_name: The name of the role for managed cluster accessProfile resource. Required. :type role_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterAccessProfile, or the result of cls(response) + :return: ManagedClusterAccessProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedClusterAccessProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterAccessProfile] - request = build_get_access_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, role_name=role_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_access_profile.metadata['url'], + template_url=self.get_access_profile.metadata["url"], headers=_headers, params=_params, ) @@ -398,68 +384,60 @@ async def get_access_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterAccessProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterAccessProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_access_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore - + get_access_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore @distributed_trace_async async def list_cluster_admin_credentials( - self, - resource_group_name: str, - resource_name: str, - server_fqdn: Optional[str] = None, - **kwargs: Any + self, resource_group_name: str, resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any ) -> _models.CredentialResults: """Lists the admin credentials of a managed cluster. Lists the admin credentials of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_admin_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, - template_url=self.list_cluster_admin_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_admin_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -467,25 +445,23 @@ async def list_cluster_admin_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_admin_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore - + list_cluster_admin_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore @distributed_trace_async async def list_cluster_user_credentials( @@ -501,40 +477,39 @@ async def list_cluster_user_credentials( Lists the user credentials of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :param format: Only apply to AAD clusters, specifies the format of returned kubeconfig. Format 'azure' will return azure auth-provider kubeconfig; format 'exec' will return exec format - kubeconfig, which requires kubelogin binary in the path. Default value is None. + kubeconfig, which requires kubelogin binary in the path. Known values are: "azure" and "exec". + Default value is None. :type format: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.Format :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, format=format, - template_url=self.list_cluster_user_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -542,68 +517,60 @@ async def list_cluster_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore - + list_cluster_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore @distributed_trace_async async def list_cluster_monitoring_user_credentials( - self, - resource_group_name: str, - resource_name: str, - server_fqdn: Optional[str] = None, - **kwargs: Any + self, resource_group_name: str, resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any ) -> _models.CredentialResults: """Lists the cluster monitoring user credentials of a managed cluster. Lists the cluster monitoring user credentials of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_monitoring_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, - template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_monitoring_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -611,64 +578,55 @@ async def list_cluster_monitoring_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_monitoring_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore - + list_cluster_monitoring_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore @distributed_trace_async - async def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.ManagedCluster: + async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.ManagedCluster: """Gets a managed cluster. Gets a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedCluster, or the result of cls(response) + :return: ManagedCluster or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedCluster - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -676,55 +634,54 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _create_or_update_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.ManagedCluster, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'ManagedCluster') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedCluster") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -732,10 +689,9 @@ async def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -743,25 +699,26 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - @distributed_trace_async + @overload async def begin_create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedCluster, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. @@ -769,11 +726,88 @@ async def begin_create_or_update( Creates or updates a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The managed cluster to create or update. + :param parameters: The managed cluster to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedCluster + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster to create or update. Is either a model type or a IO + type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedCluster or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -786,20 +820,17 @@ async def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -807,69 +838,66 @@ async def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _update_tags_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.TagsObject, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request_initial( - subscription_id=self._config.subscription_id, + request = build_update_tags_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_tags_initial.metadata['url'], + content=_content, + template_url=self._update_tags_initial.metadata["url"], headers=_headers, params=_params, ) @@ -877,32 +905,32 @@ async def _update_tags_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_tags_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _update_tags_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - @distributed_trace_async + @overload async def begin_update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. @@ -910,11 +938,88 @@ async def begin_update_tags( Updates tags on a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2022_05_02_preview.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates tags on a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates tags on a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_05_02_preview.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -927,20 +1032,17 @@ async def begin_update_tags( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, @@ -948,39 +1050,35 @@ async def begin_update_tags( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements self, @@ -989,25 +1087,22 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements ignore_pod_disruption_budget: Optional[bool] = None, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, ignore_pod_disruption_budget=ignore_pod_disruption_budget, - template_url=self._delete_initial.metadata['url'], + api_version=api_version, + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1015,10 +1110,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1028,11 +1122,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements + async def begin_delete( self, resource_group_name: str, resource_name: str, @@ -1044,8 +1137,9 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Deletes a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param ignore_pod_disruption_budget: ignore-pod-disruption-budget=true to delete those pods on a node without considering Pod Disruption Budget. Default value is None. @@ -1060,86 +1154,84 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, ignore_pod_disruption_budget=ignore_pod_disruption_budget, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterServicePrincipalProfile, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterServicePrincipalProfile") - request = build_reset_service_principal_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_service_principal_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_service_principal_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_service_principal_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1147,10 +1239,9 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1160,15 +1251,89 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist if cls: return cls(pipeline_response, None, {}) - _reset_service_principal_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + _reset_service_principal_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + + @overload + async def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.ManagedClusterServicePrincipalProfile, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset the Service Principal Profile of a managed cluster. + + This action cannot be performed on a cluster that is not using a service principal. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The service principal profile to set on the managed cluster. Required. + :type parameters: + ~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedClusterServicePrincipalProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset the Service Principal Profile of a managed cluster. + + This action cannot be performed on a cluster that is not using a service principal. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The service principal profile to set on the managed cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async - async def begin_reset_service_principal_profile( # pylint: disable=inconsistent-return-statements + async def begin_reset_service_principal_profile( self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterServicePrincipalProfile, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], **kwargs: Any ) -> AsyncLROPoller[None]: """Reset the Service Principal Profile of a managed cluster. @@ -1176,12 +1341,18 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent This action cannot be performed on a cluster that is not using a service principal. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The service principal profile to set on the managed cluster. + :param parameters: The service principal profile to set on the managed cluster. Is either a + model type or a IO type. Required. :type parameters: ~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedClusterServicePrincipalProfile + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -1192,20 +1363,17 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1213,67 +1381,68 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_service_principal_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + begin_reset_service_principal_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterAADProfile, + parameters: Union[_models.ManagedClusterAADProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterAADProfile") - request = build_reset_aad_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_aad_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_aad_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_aad_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1281,10 +1450,9 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1294,15 +1462,16 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta if cls: return cls(pipeline_response, None, {}) - _reset_aad_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + _reset_aad_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - - @distributed_trace_async - async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements + @overload + async def begin_reset_aad_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterAADProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: """Reset the AAD Profile of a managed cluster. @@ -1310,12 +1479,53 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem Reset the AAD Profile of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The AAD profile to set on the Managed Cluster. + :param parameters: The AAD profile to set on the Managed Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedClusterAADProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset the AAD Profile of a managed cluster. + + Reset the AAD Profile of a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The AAD profile to set on the Managed Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -1326,20 +1536,54 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterAADProfile, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset the AAD Profile of a managed cluster. + + Reset the AAD Profile of a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The AAD profile to set on the Managed Cluster. Is either a model type or a + IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedClusterAADProfile or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1347,62 +1591,52 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_aad_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + begin_reset_aad_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_rotate_cluster_certificates_request_initial( - subscription_id=self._config.subscription_id, + request = build_rotate_cluster_certificates_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._rotate_cluster_certificates_initial.metadata['url'], + template_url=self._rotate_cluster_certificates_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1410,10 +1644,9 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1423,15 +1656,11 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- if cls: return cls(pipeline_response, None, {}) - _rotate_cluster_certificates_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore - + _rotate_cluster_certificates_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore @distributed_trace_async - async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + async def begin_rotate_cluster_certificates( + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Rotates the certificates of a managed cluster. @@ -1439,8 +1668,9 @@ async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-ret more details about rotating managed cluster certificates. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1452,80 +1682,67 @@ async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-ret Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._rotate_cluster_certificates_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_rotate_cluster_certificates.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore + begin_rotate_cluster_certificates.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore async def _rotate_service_account_signing_keys_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_rotate_service_account_signing_keys_request_initial( - subscription_id=self._config.subscription_id, + request = build_rotate_service_account_signing_keys_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._rotate_service_account_signing_keys_initial.metadata['url'], + template_url=self._rotate_service_account_signing_keys_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1533,10 +1750,9 @@ async def _rotate_service_account_signing_keys_initial( # pylint: disable=incon request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1546,23 +1762,20 @@ async def _rotate_service_account_signing_keys_initial( # pylint: disable=incon if cls: return cls(pipeline_response, None, {}) - _rotate_service_account_signing_keys_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateServiceAccountSigningKeys"} # type: ignore - + _rotate_service_account_signing_keys_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateServiceAccountSigningKeys"} # type: ignore @distributed_trace_async - async def begin_rotate_service_account_signing_keys( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + async def begin_rotate_service_account_signing_keys( + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Rotates the service account signing keys of a managed cluster. Rotates the service account signing keys of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1574,80 +1787,67 @@ async def begin_rotate_service_account_signing_keys( # pylint: disable=inconsis Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._rotate_service_account_signing_keys_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_rotate_service_account_signing_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateServiceAccountSigningKeys"} # type: ignore + begin_rotate_service_account_signing_keys.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateServiceAccountSigningKeys"} # type: ignore async def _stop_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_stop_request_initial( - subscription_id=self._config.subscription_id, + request = build_stop_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._stop_initial.metadata['url'], + template_url=self._stop_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1655,10 +1855,9 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1668,16 +1867,10 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore - + _stop_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore @distributed_trace_async - async def begin_stop( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: + async def begin_stop(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Stops a Managed Cluster. This can only be performed on Azure Virtual Machine Scale set backed clusters. Stopping a @@ -1687,8 +1880,9 @@ async def begin_stop( # pylint: disable=inconsistent-return-statements cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1700,80 +1894,67 @@ async def begin_stop( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._stop_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore + begin_stop.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore async def _start_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_start_request_initial( - subscription_id=self._config.subscription_id, + request = build_start_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._start_initial.metadata['url'], + template_url=self._start_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1781,10 +1962,9 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1794,24 +1974,19 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore - + _start_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore @distributed_trace_async - async def begin_start( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: + async def begin_start(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Starts a previously stopped Managed Cluster. See `starting a cluster `_ for more details about starting a cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1823,85 +1998,83 @@ async def begin_start( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._start_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore + begin_start.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore async def _run_command_initial( self, resource_group_name: str, resource_name: str, - request_payload: _models.RunCommandRequest, + request_payload: Union[_models.RunCommandRequest, IO], **kwargs: Any ) -> Optional[_models.RunCommandResult]: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RunCommandResult]] - _json = self._serialize.body(request_payload, 'RunCommandRequest') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(request_payload, (IO, bytes)): + _content = request_payload + else: + _json = self._serialize.body(request_payload, "RunCommandRequest") - request = build_run_command_request_initial( - subscription_id=self._config.subscription_id, + request = build_run_command_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._run_command_initial.metadata['url'], + content=_content, + template_url=self._run_command_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1909,10 +2082,9 @@ async def _run_command_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1921,22 +2093,23 @@ async def _run_command_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _run_command_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore + _run_command_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore - - @distributed_trace_async + @overload async def begin_run_command( self, resource_group_name: str, resource_name: str, request_payload: _models.RunCommandRequest, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.RunCommandResult]: """Submits a command to run against the Managed Cluster. @@ -1946,12 +2119,97 @@ async def begin_run_command( `_. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param request_payload: The run command request. + :param request_payload: The run command request. Required. :type request_payload: ~azure.mgmt.containerservice.v2022_05_02_preview.models.RunCommandRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RunCommandResult or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_05_02_preview.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_run_command( + self, + resource_group_name: str, + resource_name: str, + request_payload: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.RunCommandResult]: + """Submits a command to run against the Managed Cluster. + + AKS will create a pod to run the command. This is primarily useful for private clusters. For + more information see `AKS Run Command + `_. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param request_payload: The run command request. Required. + :type request_payload: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RunCommandResult or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_05_02_preview.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_run_command( + self, + resource_group_name: str, + resource_name: str, + request_payload: Union[_models.RunCommandRequest, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.RunCommandResult]: + """Submits a command to run against the Managed Cluster. + + AKS will create a pod to run the command. This is primarily useful for private clusters. For + more information see `AKS Run Command + `_. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param request_payload: The run command request. Is either a model type or a IO type. Required. + :type request_payload: + ~azure.mgmt.containerservice.v2022_05_02_preview.models.RunCommandRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -1964,20 +2222,17 @@ async def begin_run_command( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_05_02_preview.models.RunCommandResult] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.RunCommandResult] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.RunCommandResult] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._run_command_initial( # type: ignore resource_group_name=resource_group_name, @@ -1985,82 +2240,72 @@ async def begin_run_command( request_payload=request_payload, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_run_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore + begin_run_command.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore @distributed_trace_async async def get_command_result( - self, - resource_group_name: str, - resource_name: str, - command_id: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, command_id: str, **kwargs: Any ) -> Optional[_models.RunCommandResult]: """Gets the results of a command which has been run on the Managed Cluster. Gets the results of a command which has been run on the Managed Cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param command_id: Id of the command. + :param command_id: Id of the command. Required. :type command_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: RunCommandResult, or the result of cls(response) + :return: RunCommandResult or None or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.RunCommandResult or None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RunCommandResult]] - request = build_get_command_result_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, command_id=command_id, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_command_result.metadata['url'], + template_url=self.get_command_result.metadata["url"], headers=_headers, params=_params, ) @@ -2068,10 +2313,9 @@ async def get_command_result( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -2080,23 +2324,19 @@ async def get_command_result( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_command_result.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}"} # type: ignore - + get_command_result.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}"} # type: ignore @distributed_trace def list_outbound_network_dependencies_endpoints( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.OutboundEnvironmentEndpointCollection]: + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> AsyncIterable["_models.OutboundEnvironmentEndpoint"]: """Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster. @@ -2104,35 +2344,35 @@ def list_outbound_network_dependencies_endpoints( specified managed cluster. The operation returns properties of each egress endpoint. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OutboundEnvironmentEndpointCollection or the - result of cls(response) + :return: An iterator like instance of either OutboundEnvironmentEndpoint or the result of + cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_05_02_preview.models.OutboundEnvironmentEndpointCollection] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_05_02_preview.models.OutboundEnvironmentEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_outbound_network_dependencies_endpoints_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_outbound_network_dependencies_endpoints.metadata['url'], + template_url=self.list_outbound_network_dependencies_endpoints.metadata["url"], headers=_headers, params=_params, ) @@ -2140,16 +2380,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_outbound_network_dependencies_endpoints_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -2165,10 +2400,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2178,8 +2411,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_outbound_network_dependencies_endpoints.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints"} # type: ignore + list_outbound_network_dependencies_endpoints.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/_operations.py index ccb4542cde92..e8af220164e5 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/_operations.py @@ -7,9 +7,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,9 +27,11 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._operations import build_list_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class Operations: """ .. warning:: @@ -42,38 +51,33 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.OperationListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.OperationValue"]: """Gets a list of operations. Gets a list of operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationListResult or the result of cls(response) + :return: An iterator like instance of either OperationValue or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_05_02_preview.models.OperationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_05_02_preview.models.OperationValue] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -81,13 +85,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -103,10 +105,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -116,8 +116,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.ContainerService/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ContainerService/operations"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/_private_endpoint_connections_operations.py index 551cff70c37b..461b7ba1ee12 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/_private_endpoint_connections_operations.py @@ -6,9 +6,15 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -20,10 +26,17 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._private_endpoint_connections_operations import build_delete_request_initial, build_get_request, build_list_request, build_update_request -T = TypeVar('T') +from ...operations._private_endpoint_connections_operations import ( + build_delete_request, + build_get_request, + build_list_request, + build_update_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class PrivateEndpointConnectionsOperations: """ .. warning:: @@ -43,13 +56,9 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async async def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnectionListResult: """Gets a list of private endpoint connections in the specified managed cluster. @@ -57,33 +66,31 @@ async def list( https://docs.microsoft.com/azure/aks/private-clusters. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnectionListResult, or the result of cls(response) + :return: PrivateEndpointConnectionListResult or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.PrivateEndpointConnectionListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnectionListResult] - request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -91,33 +98,27 @@ async def list( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore - + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore @distributed_trace_async async def get( - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnection: """Gets the specified private endpoint connection. @@ -125,35 +126,33 @@ async def get( https://docs.microsoft.com/azure/aks/private-clusters. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -161,33 +160,33 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - - @distributed_trace_async + @overload async def update( self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, parameters: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateEndpointConnection: """Updates a private endpoint connection. @@ -195,42 +194,117 @@ async def update( Updates a private endpoint connection. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str - :param parameters: The updated private endpoint connection. + :param parameters: The updated private endpoint connection. Required. :type parameters: ~azure.mgmt.containerservice.v2022_05_02_preview.models.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: The updated private endpoint connection. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: Union[_models.PrivateEndpointConnection, IO], + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: The updated private endpoint connection. Is either a model type or a IO + type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2022_05_02_preview.models.PrivateEndpointConnection or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - _json = self._serialize.body(parameters, 'PrivateEndpointConnection') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateEndpointConnection") request = build_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update.metadata['url'], + content=_content, + template_url=self.update.metadata["url"], headers=_headers, params=_params, ) @@ -238,52 +312,43 @@ async def update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -291,10 +356,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -304,26 +368,22 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + async def begin_delete( + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes a private endpoint connection. Deletes a private endpoint connection. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -335,53 +395,46 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/_private_link_resources_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/_private_link_resources_operations.py index 2e06d0dfd1d4..575ab7a06dd1 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/_private_link_resources_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/_private_link_resources_operations.py @@ -8,7 +8,13 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -19,9 +25,11 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._private_link_resources_operations import build_list_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class PrivateLinkResourcesOperations: """ .. warning:: @@ -41,13 +49,9 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async async def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.PrivateLinkResourcesListResult: """Gets a list of private link resources in the specified managed cluster. @@ -55,32 +59,30 @@ async def list( https://docs.microsoft.com/azure/aks/private-clusters. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResourcesListResult, or the result of cls(response) + :return: PrivateLinkResourcesListResult or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.PrivateLinkResourcesListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResourcesListResult] - request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -88,22 +90,20 @@ async def list( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResourcesListResult', pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources"} # type: ignore - + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/_resolve_private_link_service_id_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/_resolve_private_link_service_id_operations.py index 1e3e8f323664..5a33f1693560 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/_resolve_private_link_service_id_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/_resolve_private_link_service_id_operations.py @@ -6,9 +6,15 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -19,9 +25,11 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._resolve_private_link_service_id_operations import build_post_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class ResolvePrivateLinkServiceIdOperations: """ .. warning:: @@ -41,13 +49,72 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @overload + async def post( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.PrivateLinkResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID for the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters required in order to resolve a private link service ID. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_05_02_preview.models.PrivateLinkResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def post( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID for the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters required in order to resolve a private link service ID. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def post( self, resource_group_name: str, resource_name: str, - parameters: _models.PrivateLinkResource, + parameters: Union[_models.PrivateLinkResource, IO], **kwargs: Any ) -> _models.PrivateLinkResource: """Gets the private link service ID for the specified managed cluster. @@ -55,38 +122,49 @@ async def post( Gets the private link service ID for the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters required in order to resolve a private link service ID. + :param parameters: Parameters required in order to resolve a private link service ID. Is either + a model type or a IO type. Required. :type parameters: ~azure.mgmt.containerservice.v2022_05_02_preview.models.PrivateLinkResource + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResource, or the result of cls(response) + :return: PrivateLinkResource or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.PrivateLinkResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResource] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResource] - _json = self._serialize.body(parameters, 'PrivateLinkResource') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateLinkResource") request = build_post_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.post.metadata['url'], + content=_content, + template_url=self.post.metadata["url"], headers=_headers, params=_params, ) @@ -94,22 +172,20 @@ async def post( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResource', pipeline_response) + deserialized = self._deserialize("PrivateLinkResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - post.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId"} # type: ignore - + post.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/_snapshots_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/_snapshots_operations.py index 9d1d02cad74c..fa5d9c004b0f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/_snapshots_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/_snapshots_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,10 +27,19 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._snapshots_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_resource_group_request, build_list_request, build_update_tags_request -T = TypeVar('T') +from ...operations._snapshots_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_resource_group_request, + build_list_request, + build_update_tags_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class SnapshotsOperations: """ .. warning:: @@ -43,39 +59,34 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.SnapshotListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.Snapshot"]: """Gets a list of snapshots in the specified subscription. Gets a list of snapshots in the specified subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SnapshotListResult or the result of cls(response) + :return: An iterator like instance of either Snapshot or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_05_02_preview.models.SnapshotListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_05_02_preview.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SnapshotListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -83,14 +94,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -106,10 +114,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -119,48 +125,42 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots"} # type: ignore @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.SnapshotListResult]: + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.Snapshot"]: """Lists snapshots in the specified subscription and resource group. Lists snapshots in the specified subscription and resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SnapshotListResult or the result of cls(response) + :return: An iterator like instance of either Snapshot or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_05_02_preview.models.SnapshotListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_05_02_preview.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SnapshotListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -168,15 +168,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -192,10 +188,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -205,50 +199,41 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots"} # type: ignore @distributed_trace_async - async def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.Snapshot: + async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.Snapshot: """Gets a snapshot. Gets a snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Snapshot, or the result of cls(response) + :return: Snapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.Snapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -256,32 +241,32 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - - @distributed_trace_async + @overload async def create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.Snapshot, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.Snapshot: """Creates or updates a snapshot. @@ -289,38 +274,102 @@ async def create_or_update( Creates or updates a snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The snapshot to create or update. + :param parameters: The snapshot to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_05_02_preview.models.Snapshot + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Snapshot, or the result of cls(response) + :return: Snapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.Snapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Snapshot: + """Creates or updates a snapshot. + + Creates or updates a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The snapshot to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.Snapshot, IO], **kwargs: Any + ) -> _models.Snapshot: + """Creates or updates a snapshot. + + Creates or updates a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The snapshot to create or update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.mgmt.containerservice.v2022_05_02_preview.models.Snapshot or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] - _json = self._serialize.body(parameters, 'Snapshot') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "Snapshot") request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) @@ -328,10 +377,9 @@ async def create_or_update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -339,25 +387,26 @@ async def create_or_update( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - @distributed_trace_async + @overload async def update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.Snapshot: """Updates tags on a snapshot. @@ -365,38 +414,102 @@ async def update_tags( Updates tags on a snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update snapshot Tags operation. + :param parameters: Parameters supplied to the Update snapshot Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2022_05_02_preview.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Snapshot: + """Updates tags on a snapshot. + + Updates tags on a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update snapshot Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Snapshot, or the result of cls(response) + :return: Snapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.Snapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @distributed_trace_async + async def update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> _models.Snapshot: + """Updates tags on a snapshot. + + Updates tags on a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update snapshot Tags operation. Is either a model + type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_05_02_preview.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") request = build_update_tags_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_tags.metadata['url'], + content=_content, + template_url=self.update_tags.metadata["url"], headers=_headers, params=_params, ) @@ -404,64 +517,57 @@ async def update_tags( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - + update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: """Deletes a snapshot. Deletes a snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) @@ -469,10 +575,9 @@ async def delete( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -482,5 +587,4 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - + delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/_trusted_access_role_bindings_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/_trusted_access_role_bindings_operations.py index 6b5d6919ede1..9758a0272707 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/_trusted_access_role_bindings_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/_trusted_access_role_bindings_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,10 +27,17 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._trusted_access_role_bindings_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_request -T = TypeVar('T') +from ...operations._trusted_access_role_bindings_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class TrustedAccessRoleBindingsOperations: """ .. warning:: @@ -43,48 +57,44 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.TrustedAccessRoleBindingListResult]: + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> AsyncIterable["_models.TrustedAccessRoleBinding"]: """List trusted access role bindings. List trusted access role bindings. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either TrustedAccessRoleBindingListResult or the result - of cls(response) + :return: An iterator like instance of either TrustedAccessRoleBinding or the result of + cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_05_02_preview.models.TrustedAccessRoleBindingListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_05_02_preview.models.TrustedAccessRoleBinding] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.TrustedAccessRoleBindingListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.TrustedAccessRoleBindingListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -92,16 +102,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -117,10 +122,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -130,54 +133,46 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings"} # type: ignore @distributed_trace_async async def get( - self, - resource_group_name: str, - resource_name: str, - trusted_access_role_binding_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, trusted_access_role_binding_name: str, **kwargs: Any ) -> _models.TrustedAccessRoleBinding: """Get a trusted access role binding. Get a trusted access role binding. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param trusted_access_role_binding_name: The name of trusted access role binding. + :param trusted_access_role_binding_name: The name of trusted access role binding. Required. :type trusted_access_role_binding_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: TrustedAccessRoleBinding, or the result of cls(response) + :return: TrustedAccessRoleBinding or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.TrustedAccessRoleBinding - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.TrustedAccessRoleBinding] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.TrustedAccessRoleBinding] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, trusted_access_role_binding_name=trusted_access_role_binding_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -185,33 +180,33 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('TrustedAccessRoleBinding', pipeline_response) + deserialized = self._deserialize("TrustedAccessRoleBinding", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}"} # type: ignore - @distributed_trace_async + @overload async def create_or_update( self, resource_group_name: str, resource_name: str, trusted_access_role_binding_name: str, trusted_access_role_binding: _models.TrustedAccessRoleBinding, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.TrustedAccessRoleBinding: """Create or update a trusted access role binding. @@ -219,42 +214,117 @@ async def create_or_update( Create or update a trusted access role binding. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param trusted_access_role_binding_name: The name of trusted access role binding. + :param trusted_access_role_binding_name: The name of trusted access role binding. Required. :type trusted_access_role_binding_name: str - :param trusted_access_role_binding: A trusted access role binding. + :param trusted_access_role_binding: A trusted access role binding. Required. :type trusted_access_role_binding: ~azure.mgmt.containerservice.v2022_05_02_preview.models.TrustedAccessRoleBinding + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TrustedAccessRoleBinding or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.TrustedAccessRoleBinding + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + trusted_access_role_binding_name: str, + trusted_access_role_binding: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.TrustedAccessRoleBinding: + """Create or update a trusted access role binding. + + Create or update a trusted access role binding. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param trusted_access_role_binding_name: The name of trusted access role binding. Required. + :type trusted_access_role_binding_name: str + :param trusted_access_role_binding: A trusted access role binding. Required. + :type trusted_access_role_binding: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: TrustedAccessRoleBinding, or the result of cls(response) + :return: TrustedAccessRoleBinding or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.TrustedAccessRoleBinding - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + trusted_access_role_binding_name: str, + trusted_access_role_binding: Union[_models.TrustedAccessRoleBinding, IO], + **kwargs: Any + ) -> _models.TrustedAccessRoleBinding: + """Create or update a trusted access role binding. + + Create or update a trusted access role binding. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param trusted_access_role_binding_name: The name of trusted access role binding. Required. + :type trusted_access_role_binding_name: str + :param trusted_access_role_binding: A trusted access role binding. Is either a model type or a + IO type. Required. + :type trusted_access_role_binding: + ~azure.mgmt.containerservice.v2022_05_02_preview.models.TrustedAccessRoleBinding or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TrustedAccessRoleBinding or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.TrustedAccessRoleBinding + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.TrustedAccessRoleBinding] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.TrustedAccessRoleBinding] - _json = self._serialize.body(trusted_access_role_binding, 'TrustedAccessRoleBinding') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(trusted_access_role_binding, (IO, bytes)): + _content = trusted_access_role_binding + else: + _json = self._serialize.body(trusted_access_role_binding, "TrustedAccessRoleBinding") request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, trusted_access_role_binding_name=trusted_access_role_binding_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) @@ -262,68 +332,60 @@ async def create_or_update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('TrustedAccessRoleBinding', pipeline_response) + deserialized = self._deserialize("TrustedAccessRoleBinding", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}"} # type: ignore - + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}"} # type: ignore @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - trusted_access_role_binding_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, trusted_access_role_binding_name: str, **kwargs: Any ) -> None: """Delete a trusted access role binding. Delete a trusted access role binding. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param trusted_access_role_binding_name: The name of trusted access role binding. + :param trusted_access_role_binding_name: The name of trusted access role binding. Required. :type trusted_access_role_binding_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, trusted_access_role_binding_name=trusted_access_role_binding_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) @@ -331,10 +393,9 @@ async def delete( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -344,5 +405,4 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}"} # type: ignore - + delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/_trusted_access_roles_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/_trusted_access_roles_operations.py index 0bf35970aa9e..41f6e5a2f12e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/_trusted_access_roles_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/_trusted_access_roles_operations.py @@ -7,9 +7,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,9 +27,11 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._trusted_access_roles_operations import build_list_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class TrustedAccessRolesOperations: """ .. warning:: @@ -42,44 +51,37 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - location: str, - **kwargs: Any - ) -> AsyncIterable[_models.TrustedAccessRoleListResult]: + def list(self, location: str, **kwargs: Any) -> AsyncIterable["_models.TrustedAccessRole"]: """List supported trusted access roles. List supported trusted access roles. - :param location: The name of Azure region. + :param location: The name of Azure region. Required. :type location: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either TrustedAccessRoleListResult or the result of - cls(response) + :return: An iterator like instance of either TrustedAccessRole or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_05_02_preview.models.TrustedAccessRoleListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_05_02_preview.models.TrustedAccessRole] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.TrustedAccessRoleListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.TrustedAccessRoleListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( - subscription_id=self._config.subscription_id, location=location, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -87,15 +89,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - location=location, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -111,10 +109,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -124,8 +120,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/trustedAccessRoles"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/trustedAccessRoles"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/models/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/models/__init__.py index a59d889f0f34..97694ed6cd96 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/models/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/models/__init__.py @@ -116,200 +116,198 @@ from ._models_py3 import UserAssignedIdentity from ._models_py3 import WindowsGmsaProfile - -from ._container_service_client_enums import ( - AgentPoolMode, - AgentPoolType, - Code, - ConnectionStatus, - ContainerServiceStorageProfileTypes, - ContainerServiceVMSizeTypes, - Count, - CreatedByType, - Expander, - ExtendedLocationTypes, - Format, - GPUInstanceProfile, - IpFamily, - KeyVaultNetworkAccessTypes, - KubeletDiskType, - LicenseType, - LoadBalancerSku, - ManagedClusterPodIdentityProvisioningState, - ManagedClusterSKUName, - ManagedClusterSKUTier, - NetworkMode, - NetworkPlugin, - NetworkPluginMode, - NetworkPolicy, - OSDiskType, - OSSKU, - OSType, - OutboundType, - PrivateEndpointConnectionProvisioningState, - PublicNetworkAccess, - ResourceIdentityType, - ScaleDownMode, - ScaleSetEvictionPolicy, - ScaleSetPriority, - SnapshotType, - TrustedAccessRoleBindingProvisioningState, - UpgradeChannel, - WeekDay, - WorkloadRuntime, -) +from ._container_service_client_enums import AgentPoolMode +from ._container_service_client_enums import AgentPoolType +from ._container_service_client_enums import Code +from ._container_service_client_enums import ConnectionStatus +from ._container_service_client_enums import ContainerServiceStorageProfileTypes +from ._container_service_client_enums import ContainerServiceVMSizeTypes +from ._container_service_client_enums import Count +from ._container_service_client_enums import CreatedByType +from ._container_service_client_enums import Expander +from ._container_service_client_enums import ExtendedLocationTypes +from ._container_service_client_enums import Format +from ._container_service_client_enums import GPUInstanceProfile +from ._container_service_client_enums import IpFamily +from ._container_service_client_enums import KeyVaultNetworkAccessTypes +from ._container_service_client_enums import KubeletDiskType +from ._container_service_client_enums import LicenseType +from ._container_service_client_enums import LoadBalancerSku +from ._container_service_client_enums import ManagedClusterPodIdentityProvisioningState +from ._container_service_client_enums import ManagedClusterSKUName +from ._container_service_client_enums import ManagedClusterSKUTier +from ._container_service_client_enums import NetworkMode +from ._container_service_client_enums import NetworkPlugin +from ._container_service_client_enums import NetworkPluginMode +from ._container_service_client_enums import NetworkPolicy +from ._container_service_client_enums import OSDiskType +from ._container_service_client_enums import OSSKU +from ._container_service_client_enums import OSType +from ._container_service_client_enums import OutboundType +from ._container_service_client_enums import PrivateEndpointConnectionProvisioningState +from ._container_service_client_enums import PublicNetworkAccess +from ._container_service_client_enums import ResourceIdentityType +from ._container_service_client_enums import ScaleDownMode +from ._container_service_client_enums import ScaleSetEvictionPolicy +from ._container_service_client_enums import ScaleSetPriority +from ._container_service_client_enums import SnapshotType +from ._container_service_client_enums import TrustedAccessRoleBindingProvisioningState +from ._container_service_client_enums import UpgradeChannel +from ._container_service_client_enums import WeekDay +from ._container_service_client_enums import WorkloadRuntime from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'AgentPool', - 'AgentPoolAvailableVersions', - 'AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem', - 'AgentPoolListResult', - 'AgentPoolUpgradeProfile', - 'AgentPoolUpgradeProfilePropertiesUpgradesItem', - 'AgentPoolUpgradeSettings', - 'AzureKeyVaultKms', - 'CloudErrorBody', - 'ContainerServiceDiagnosticsProfile', - 'ContainerServiceLinuxProfile', - 'ContainerServiceMasterProfile', - 'ContainerServiceNetworkProfile', - 'ContainerServiceSshConfiguration', - 'ContainerServiceSshPublicKey', - 'ContainerServiceVMDiagnostics', - 'CreationData', - 'CredentialResult', - 'CredentialResults', - 'EndpointDependency', - 'EndpointDetail', - 'ExtendedLocation', - 'KubeletConfig', - 'LinuxOSConfig', - 'MaintenanceConfiguration', - 'MaintenanceConfigurationListResult', - 'ManagedCluster', - 'ManagedClusterAADProfile', - 'ManagedClusterAPIServerAccessProfile', - 'ManagedClusterAccessProfile', - 'ManagedClusterAddonProfile', - 'ManagedClusterAddonProfileIdentity', - 'ManagedClusterAgentPoolProfile', - 'ManagedClusterAgentPoolProfileProperties', - 'ManagedClusterAutoUpgradeProfile', - 'ManagedClusterHTTPProxyConfig', - 'ManagedClusterIdentity', - 'ManagedClusterIngressProfile', - 'ManagedClusterIngressProfileWebAppRouting', - 'ManagedClusterListResult', - 'ManagedClusterLoadBalancerProfile', - 'ManagedClusterLoadBalancerProfileManagedOutboundIPs', - 'ManagedClusterLoadBalancerProfileOutboundIPPrefixes', - 'ManagedClusterLoadBalancerProfileOutboundIPs', - 'ManagedClusterManagedOutboundIPProfile', - 'ManagedClusterNATGatewayProfile', - 'ManagedClusterOIDCIssuerProfile', - 'ManagedClusterPodIdentity', - 'ManagedClusterPodIdentityException', - 'ManagedClusterPodIdentityProfile', - 'ManagedClusterPodIdentityProvisioningError', - 'ManagedClusterPodIdentityProvisioningErrorBody', - 'ManagedClusterPodIdentityProvisioningInfo', - 'ManagedClusterPoolUpgradeProfile', - 'ManagedClusterPoolUpgradeProfileUpgradesItem', - 'ManagedClusterPropertiesAutoScalerProfile', - 'ManagedClusterPropertiesForSnapshot', - 'ManagedClusterSKU', - 'ManagedClusterSecurityProfile', - 'ManagedClusterSecurityProfileDefender', - 'ManagedClusterSecurityProfileDefenderSecurityMonitoring', - 'ManagedClusterSecurityProfileWorkloadIdentity', - 'ManagedClusterServicePrincipalProfile', - 'ManagedClusterSnapshot', - 'ManagedClusterSnapshotListResult', - 'ManagedClusterStorageProfile', - 'ManagedClusterStorageProfileBlobCSIDriver', - 'ManagedClusterStorageProfileDiskCSIDriver', - 'ManagedClusterStorageProfileFileCSIDriver', - 'ManagedClusterStorageProfileSnapshotController', - 'ManagedClusterUpgradeProfile', - 'ManagedClusterWindowsProfile', - 'ManagedClusterWorkloadAutoScalerProfile', - 'ManagedClusterWorkloadAutoScalerProfileKeda', - 'ManagedServiceIdentityUserAssignedIdentitiesValue', - 'NetworkProfileForSnapshot', - 'OSOptionProfile', - 'OSOptionProperty', - 'OperationListResult', - 'OperationValue', - 'OutboundEnvironmentEndpoint', - 'OutboundEnvironmentEndpointCollection', - 'PowerState', - 'PrivateEndpoint', - 'PrivateEndpointConnection', - 'PrivateEndpointConnectionListResult', - 'PrivateLinkResource', - 'PrivateLinkResourcesListResult', - 'PrivateLinkServiceConnectionState', - 'Resource', - 'ResourceReference', - 'RunCommandRequest', - 'RunCommandResult', - 'Snapshot', - 'SnapshotListResult', - 'SubResource', - 'SysctlConfig', - 'SystemData', - 'TagsObject', - 'TimeInWeek', - 'TimeSpan', - 'TrackedResource', - 'TrustedAccessRole', - 'TrustedAccessRoleBinding', - 'TrustedAccessRoleBindingListResult', - 'TrustedAccessRoleListResult', - 'TrustedAccessRoleRule', - 'UserAssignedIdentity', - 'WindowsGmsaProfile', - 'AgentPoolMode', - 'AgentPoolType', - 'Code', - 'ConnectionStatus', - 'ContainerServiceStorageProfileTypes', - 'ContainerServiceVMSizeTypes', - 'Count', - 'CreatedByType', - 'Expander', - 'ExtendedLocationTypes', - 'Format', - 'GPUInstanceProfile', - 'IpFamily', - 'KeyVaultNetworkAccessTypes', - 'KubeletDiskType', - 'LicenseType', - 'LoadBalancerSku', - 'ManagedClusterPodIdentityProvisioningState', - 'ManagedClusterSKUName', - 'ManagedClusterSKUTier', - 'NetworkMode', - 'NetworkPlugin', - 'NetworkPluginMode', - 'NetworkPolicy', - 'OSDiskType', - 'OSSKU', - 'OSType', - 'OutboundType', - 'PrivateEndpointConnectionProvisioningState', - 'PublicNetworkAccess', - 'ResourceIdentityType', - 'ScaleDownMode', - 'ScaleSetEvictionPolicy', - 'ScaleSetPriority', - 'SnapshotType', - 'TrustedAccessRoleBindingProvisioningState', - 'UpgradeChannel', - 'WeekDay', - 'WorkloadRuntime', + "AgentPool", + "AgentPoolAvailableVersions", + "AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem", + "AgentPoolListResult", + "AgentPoolUpgradeProfile", + "AgentPoolUpgradeProfilePropertiesUpgradesItem", + "AgentPoolUpgradeSettings", + "AzureKeyVaultKms", + "CloudErrorBody", + "ContainerServiceDiagnosticsProfile", + "ContainerServiceLinuxProfile", + "ContainerServiceMasterProfile", + "ContainerServiceNetworkProfile", + "ContainerServiceSshConfiguration", + "ContainerServiceSshPublicKey", + "ContainerServiceVMDiagnostics", + "CreationData", + "CredentialResult", + "CredentialResults", + "EndpointDependency", + "EndpointDetail", + "ExtendedLocation", + "KubeletConfig", + "LinuxOSConfig", + "MaintenanceConfiguration", + "MaintenanceConfigurationListResult", + "ManagedCluster", + "ManagedClusterAADProfile", + "ManagedClusterAPIServerAccessProfile", + "ManagedClusterAccessProfile", + "ManagedClusterAddonProfile", + "ManagedClusterAddonProfileIdentity", + "ManagedClusterAgentPoolProfile", + "ManagedClusterAgentPoolProfileProperties", + "ManagedClusterAutoUpgradeProfile", + "ManagedClusterHTTPProxyConfig", + "ManagedClusterIdentity", + "ManagedClusterIngressProfile", + "ManagedClusterIngressProfileWebAppRouting", + "ManagedClusterListResult", + "ManagedClusterLoadBalancerProfile", + "ManagedClusterLoadBalancerProfileManagedOutboundIPs", + "ManagedClusterLoadBalancerProfileOutboundIPPrefixes", + "ManagedClusterLoadBalancerProfileOutboundIPs", + "ManagedClusterManagedOutboundIPProfile", + "ManagedClusterNATGatewayProfile", + "ManagedClusterOIDCIssuerProfile", + "ManagedClusterPodIdentity", + "ManagedClusterPodIdentityException", + "ManagedClusterPodIdentityProfile", + "ManagedClusterPodIdentityProvisioningError", + "ManagedClusterPodIdentityProvisioningErrorBody", + "ManagedClusterPodIdentityProvisioningInfo", + "ManagedClusterPoolUpgradeProfile", + "ManagedClusterPoolUpgradeProfileUpgradesItem", + "ManagedClusterPropertiesAutoScalerProfile", + "ManagedClusterPropertiesForSnapshot", + "ManagedClusterSKU", + "ManagedClusterSecurityProfile", + "ManagedClusterSecurityProfileDefender", + "ManagedClusterSecurityProfileDefenderSecurityMonitoring", + "ManagedClusterSecurityProfileWorkloadIdentity", + "ManagedClusterServicePrincipalProfile", + "ManagedClusterSnapshot", + "ManagedClusterSnapshotListResult", + "ManagedClusterStorageProfile", + "ManagedClusterStorageProfileBlobCSIDriver", + "ManagedClusterStorageProfileDiskCSIDriver", + "ManagedClusterStorageProfileFileCSIDriver", + "ManagedClusterStorageProfileSnapshotController", + "ManagedClusterUpgradeProfile", + "ManagedClusterWindowsProfile", + "ManagedClusterWorkloadAutoScalerProfile", + "ManagedClusterWorkloadAutoScalerProfileKeda", + "ManagedServiceIdentityUserAssignedIdentitiesValue", + "NetworkProfileForSnapshot", + "OSOptionProfile", + "OSOptionProperty", + "OperationListResult", + "OperationValue", + "OutboundEnvironmentEndpoint", + "OutboundEnvironmentEndpointCollection", + "PowerState", + "PrivateEndpoint", + "PrivateEndpointConnection", + "PrivateEndpointConnectionListResult", + "PrivateLinkResource", + "PrivateLinkResourcesListResult", + "PrivateLinkServiceConnectionState", + "Resource", + "ResourceReference", + "RunCommandRequest", + "RunCommandResult", + "Snapshot", + "SnapshotListResult", + "SubResource", + "SysctlConfig", + "SystemData", + "TagsObject", + "TimeInWeek", + "TimeSpan", + "TrackedResource", + "TrustedAccessRole", + "TrustedAccessRoleBinding", + "TrustedAccessRoleBindingListResult", + "TrustedAccessRoleListResult", + "TrustedAccessRoleRule", + "UserAssignedIdentity", + "WindowsGmsaProfile", + "AgentPoolMode", + "AgentPoolType", + "Code", + "ConnectionStatus", + "ContainerServiceStorageProfileTypes", + "ContainerServiceVMSizeTypes", + "Count", + "CreatedByType", + "Expander", + "ExtendedLocationTypes", + "Format", + "GPUInstanceProfile", + "IpFamily", + "KeyVaultNetworkAccessTypes", + "KubeletDiskType", + "LicenseType", + "LoadBalancerSku", + "ManagedClusterPodIdentityProvisioningState", + "ManagedClusterSKUName", + "ManagedClusterSKUTier", + "NetworkMode", + "NetworkPlugin", + "NetworkPluginMode", + "NetworkPolicy", + "OSDiskType", + "OSSKU", + "OSType", + "OutboundType", + "PrivateEndpointConnectionProvisioningState", + "PublicNetworkAccess", + "ResourceIdentityType", + "ScaleDownMode", + "ScaleSetEvictionPolicy", + "ScaleSetPriority", + "SnapshotType", + "TrustedAccessRoleBindingProvisioningState", + "UpgradeChannel", + "WeekDay", + "WorkloadRuntime", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/models/_container_service_client_enums.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/models/_container_service_client_enums.py index e7281f8d63cf..bcc888557894 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/models/_container_service_client_enums.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/models/_container_service_client_enums.py @@ -13,7 +13,7 @@ class AgentPoolMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools + https://docs.microsoft.com/azure/aks/use-system-pools. """ #: System agent pools are primarily for hosting critical system pods such as CoreDNS and @@ -23,33 +23,34 @@ class AgentPoolMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: User agent pools are primarily for hosting your application pods. USER = "User" + class AgentPoolType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of Agent Pool. - """ + """The type of Agent Pool.""" #: Create an Agent Pool backed by a Virtual Machine Scale Set. VIRTUAL_MACHINE_SCALE_SETS = "VirtualMachineScaleSets" #: Use of this is strongly discouraged. AVAILABILITY_SET = "AvailabilitySet" + class Code(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Tells whether the cluster is Running or Stopped - """ + """Tells whether the cluster is Running or Stopped.""" #: The cluster is running. RUNNING = "Running" #: The cluster is stopped. STOPPED = "Stopped" + class ConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The private link service connection status. - """ + """The private link service connection status.""" PENDING = "Pending" APPROVED = "Approved" REJECTED = "Rejected" DISCONNECTED = "Disconnected" + class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Specifies what kind of storage to use. If omitted, the default will be chosen on your behalf based on the choice of orchestrator. @@ -58,9 +59,9 @@ class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEn STORAGE_ACCOUNT = "StorageAccount" MANAGED_DISKS = "ManagedDisks" + class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Size of agent VMs. Note: This is no longer maintained. - """ + """Size of agent VMs. Note: This is no longer maintained.""" STANDARD_A1 = "Standard_A1" STANDARD_A10 = "Standard_A10" @@ -237,6 +238,7 @@ class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): STANDARD_NV24 = "Standard_NV24" STANDARD_NV6 = "Standard_NV6" + class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): """Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, and 5. The default value is 1. @@ -246,15 +248,16 @@ class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): THREE = 3 FIVE = 5 + class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of identity that created the resource. - """ + """The type of identity that created the resource.""" USER = "User" APPLICATION = "Application" MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" + class Expander(str, Enum, metaclass=CaseInsensitiveEnumMeta): """If not specified, the default is 'random'. See `expanders `_ @@ -278,23 +281,25 @@ class Expander(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Used when you don't have a particular need for the node groups to scale differently. RANDOM = "random" + class ExtendedLocationTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of extendedLocation. - """ + """The type of extendedLocation.""" EDGE_ZONE = "EdgeZone" + class Format(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Format.""" #: Return azure auth-provider kubeconfig. This format is deprecated in 1.22 and will be fully #: removed in 1.25. AZURE = "azure" #: Return exec format kubeconfig. This format requires kubelogin binary in the path. - EXEC_ENUM = "exec" + EXEC = "exec" + class GPUInstanceProfile(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """GPUInstanceProfile to be used to specify GPU MIG instance profile for supported GPU VM SKU. - """ + """GPUInstanceProfile to be used to specify GPU MIG instance profile for supported GPU VM SKU.""" MIG1_G = "MIG1g" MIG2_G = "MIG2g" @@ -302,13 +307,14 @@ class GPUInstanceProfile(str, Enum, metaclass=CaseInsensitiveEnumMeta): MIG4_G = "MIG4g" MIG7_G = "MIG7g" + class IpFamily(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The IP version to use for cluster networking and IP assignment. - """ + """The IP version to use for cluster networking and IP assignment.""" I_PV4 = "IPv4" I_PV6 = "IPv6" + class KeyVaultNetworkAccessTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Network access of key vault. The possible values are ``Public`` and ``Private``. ``Public`` means the key vault allows public access from all networks. ``Private`` means the key vault @@ -318,6 +324,7 @@ class KeyVaultNetworkAccessTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): PUBLIC = "Public" PRIVATE = "Private" + class KubeletDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. @@ -328,6 +335,7 @@ class KubeletDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Kubelet will use the temporary disk for its data. TEMPORARY = "Temporary" + class LicenseType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The license type to use for Windows VMs. See `Azure Hybrid User Benefits `_ for more details. @@ -338,6 +346,7 @@ class LicenseType(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Enables Azure Hybrid User Benefits for Windows VMs. WINDOWS_SERVER = "Windows_Server" + class LoadBalancerSku(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The default is 'standard'. See `Azure Load Balancer SKUs `_ for more information about the @@ -351,21 +360,22 @@ class LoadBalancerSku(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Use a basic Load Balancer with limited functionality. BASIC = "basic" + class ManagedClusterPodIdentityProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The current provisioning state of the pod identity. - """ + """The current provisioning state of the pod identity.""" ASSIGNED = "Assigned" UPDATING = "Updating" DELETING = "Deleting" FAILED = "Failed" + class ManagedClusterSKUName(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The name of a managed cluster SKU. - """ + """The name of a managed cluster SKU.""" BASIC = "Basic" + class ManagedClusterSKUTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): """If not specified, the default is 'Free'. See `uptime SLA `_ for more details. @@ -377,20 +387,20 @@ class ManagedClusterSKUTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: No guaranteed SLA, no additional charges. Free tier clusters have an SLO of 99.5%. FREE = "Free" + class NetworkMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """This cannot be specified if networkPlugin is anything other than 'azure'. - """ + """This cannot be specified if networkPlugin is anything other than 'azure'.""" #: No bridge is created. Intra-VM Pod to Pod communication is through IP routes created by Azure #: CNI. See `Transparent Mode `_ for #: more information. TRANSPARENT = "transparent" - #: This is no longer supported. + #: This is no longer supported BRIDGE = "bridge" + class NetworkPlugin(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Network plugin used for building the Kubernetes network. - """ + """Network plugin used for building the Kubernetes network.""" #: Use the Azure CNI network plugin. See `Azure CNI (advanced) networking #: `_ for @@ -404,17 +414,17 @@ class NetworkPlugin(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: networking functionality. NONE = "none" + class NetworkPluginMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The mode the network plugin should use. - """ + """The mode the network plugin should use.""" #: Pods are given IPs from the PodCIDR address space but use Azure Routing Domains rather than #: Kubenet reference plugins host-local and bridge. OVERLAY = "Overlay" + class NetworkPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Network policy used for building the Kubernetes network. - """ + """Network policy used for building the Kubernetes network.""" #: Use Calico network policies. See `differences between Azure and Calico policies #: `_ @@ -425,6 +435,7 @@ class NetworkPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: for more information. AZURE = "azure" + class OSDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more @@ -441,6 +452,7 @@ class OSDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: provides lower read/write latency, along with faster node scaling and cluster upgrades. EPHEMERAL = "Ephemeral" + class OSSKU(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Specifies the OS SKU used by the agent pool. If not specified, the default is Ubuntu if OSType=Linux or Windows2019 if OSType=Windows. And the default Windows OSSKU will be changed to @@ -452,15 +464,16 @@ class OSSKU(str, Enum, metaclass=CaseInsensitiveEnumMeta): WINDOWS2019 = "Windows2019" WINDOWS2022 = "Windows2022" + class OSType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The operating system type. The default is Linux. - """ + """The operating system type. The default is Linux.""" #: Use Linux. LINUX = "Linux" #: Use Windows. WINDOWS = "Windows" + class OutboundType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """This can only be set at cluster creation time and cannot be changed later. For more information see `egress outbound type `_. @@ -481,22 +494,23 @@ class OutboundType(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: advanced scenario and requires proper network configuration. USER_ASSIGNED_NAT_GATEWAY = "userAssignedNATGateway" + class PrivateEndpointConnectionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The current provisioning state. - """ + """The current provisioning state.""" SUCCEEDED = "Succeeded" CREATING = "Creating" DELETING = "Deleting" FAILED = "Failed" + class PublicNetworkAccess(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Allow or deny public network access for AKS - """ + """Allow or deny public network access for AKS.""" ENABLED = "Enabled" DISABLED = "Disabled" + class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """For more information see `use managed identities in AKS `_. @@ -513,6 +527,7 @@ class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Do not use a managed identity for the Managed Cluster, service principal will be used instead. NONE = "None" + class ScaleDownMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Describes how VMs are added to or removed from Agent Pools. See `billing states `_. @@ -524,10 +539,11 @@ class ScaleDownMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: during scale down. DEALLOCATE = "Deallocate" + class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The eviction policy specifies what to do with the VM when it is evicted. The default is Delete. For more information about eviction see `spot VMs - `_ + `_. """ #: Nodes in the underlying Scale Set of the node pool are deleted when they're evicted. @@ -537,9 +553,9 @@ class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: cause issues with cluster scaling or upgrading. DEALLOCATE = "Deallocate" + class ScaleSetPriority(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The Virtual Machine Scale Set priority. - """ + """The Virtual Machine Scale Set priority.""" #: Spot priority VMs will be used. There is no SLA for spot nodes. See `spot on AKS #: `_ for more information. @@ -547,24 +563,25 @@ class ScaleSetPriority(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Regular VMs will be used. REGULAR = "Regular" + class SnapshotType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of a snapshot. The default is NodePool. - """ + """The type of a snapshot. The default is NodePool.""" #: The snapshot is a snapshot of a node pool. NODE_POOL = "NodePool" #: The snapshot is a snapshot of a managed cluster. MANAGED_CLUSTER = "ManagedCluster" + class TrustedAccessRoleBindingProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The current provisioning state of trusted access role binding. - """ + """The current provisioning state of trusted access role binding.""" SUCCEEDED = "Succeeded" FAILED = "Failed" UPDATING = "Updating" DELETING = "Deleting" + class UpgradeChannel(str, Enum, metaclass=CaseInsensitiveEnumMeta): """For more information see `setting the AKS cluster auto-upgrade channel `_. @@ -595,9 +612,9 @@ class UpgradeChannel(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Disables auto-upgrades and keeps the cluster at its current version of Kubernetes. NONE = "none" + class WeekDay(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The weekday enum. - """ + """The weekday enum.""" SUNDAY = "Sunday" MONDAY = "Monday" @@ -607,9 +624,9 @@ class WeekDay(str, Enum, metaclass=CaseInsensitiveEnumMeta): FRIDAY = "Friday" SATURDAY = "Saturday" + class WorkloadRuntime(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Determines the type of workload a node can run. - """ + """Determines the type of workload a node can run.""" #: Nodes will use Kubelet to run standard OCI container workloads. OCI_CONTAINER = "OCIContainer" diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/models/_models_py3.py index c0eec4bf7f68..0cf7095c1c97 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/models/_models_py3.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/models/_models_py3.py @@ -1,4 +1,5 @@ # coding=utf-8 +# pylint: disable=too-many-lines # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -9,14 +10,14 @@ import datetime from typing import Dict, List, Optional, TYPE_CHECKING, Union -import msrest.serialization +from ... import _serialization if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - import __init__ as _models + from .. import models as _models -class SubResource(msrest.serialization.Model): +class SubResource(_serialization.Model): """Reference to another subresource. Variables are only populated by the server, and will be ignored when sending a request. @@ -31,30 +32,26 @@ class SubResource(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(SubResource, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.id = None self.name = None self.type = None -class AgentPool(SubResource): +class AgentPool(SubResource): # pylint: disable=too-many-instance-attributes """Agent Pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -82,15 +79,15 @@ class AgentPool(SubResource): larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.OSDiskType :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data - root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.KubeletDiskType :ivar workload_runtime: Determines the type of workload a node can run. Known values are: - "OCIContainer", "WasmWasi". + "OCIContainer" and "WasmWasi". :vartype workload_runtime: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.WorkloadRuntime :ivar message_of_the_day: A base64-encoded string which will be written to /etc/motd after @@ -109,13 +106,13 @@ class AgentPool(SubResource): :vartype pod_subnet_id: str :ivar max_pods: The maximum number of pods that can run on a node. :vartype max_pods: int - :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.OSType :ivar os_sku: Specifies the OS SKU used by the agent pool. If not specified, the default is Ubuntu if OSType=Linux or Windows2019 if OSType=Windows. And the default Windows OSSKU will be changed to Windows2022 after Windows2019 is deprecated. Known values are: "Ubuntu", - "CBLMariner", "Windows2019", "Windows2022". + "CBLMariner", "Windows2019", and "Windows2022". :vartype os_sku: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.OSSKU :ivar max_count: The maximum number of nodes for auto-scaling. :vartype max_count: int @@ -124,16 +121,16 @@ class AgentPool(SubResource): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it - defaults to Delete. Known values are: "Delete", "Deallocate". + defaults to Delete. Known values are: "Delete" and "Deallocate". :vartype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.ScaleDownMode - :ivar type_properties_type: The type of Agent Pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + :ivar type_properties_type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets" + and "AvailabilitySet". :vartype type_properties_type: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.AgentPoolType :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :vartype mode: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.AgentPoolMode :ivar orchestrator_version: Both patch version and are supported. When is specified, the latest supported patch version is chosen @@ -179,20 +176,18 @@ class AgentPool(SubResource): /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default - is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + is 'Regular'. Known values are: "Spot" and "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.ScaleSetPriority :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.ScaleSetEvictionPolicy :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :vartype spot_max_price: float - :ivar tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :ivar tags: The tags to be persisted on the agent pool virtual machine scale set. :vartype tags: dict[str, str] :ivar node_labels: The node labels to be persisted across all nodes in agent pool. :vartype node_labels: dict[str, str] @@ -216,7 +211,7 @@ class AgentPool(SubResource): for more details. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.GPUInstanceProfile :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the node pool @@ -233,66 +228,66 @@ class AgentPool(SubResource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'os_disk_size_gb': {'maximum': 2048, 'minimum': 0}, - 'current_orchestrator_version': {'readonly': True}, - 'node_image_version': {'readonly': True}, - 'provisioning_state': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "os_disk_size_gb": {"maximum": 2048, "minimum": 0}, + "current_orchestrator_version": {"readonly": True}, + "node_image_version": {"readonly": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'count': {'key': 'properties.count', 'type': 'int'}, - 'vm_size': {'key': 'properties.vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'properties.osDiskSizeGB', 'type': 'int'}, - 'os_disk_type': {'key': 'properties.osDiskType', 'type': 'str'}, - 'kubelet_disk_type': {'key': 'properties.kubeletDiskType', 'type': 'str'}, - 'workload_runtime': {'key': 'properties.workloadRuntime', 'type': 'str'}, - 'message_of_the_day': {'key': 'properties.messageOfTheDay', 'type': 'str'}, - 'vnet_subnet_id': {'key': 'properties.vnetSubnetID', 'type': 'str'}, - 'pod_subnet_id': {'key': 'properties.podSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'properties.maxPods', 'type': 'int'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'os_sku': {'key': 'properties.osSKU', 'type': 'str'}, - 'max_count': {'key': 'properties.maxCount', 'type': 'int'}, - 'min_count': {'key': 'properties.minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'properties.enableAutoScaling', 'type': 'bool'}, - 'scale_down_mode': {'key': 'properties.scaleDownMode', 'type': 'str'}, - 'type_properties_type': {'key': 'properties.type', 'type': 'str'}, - 'mode': {'key': 'properties.mode', 'type': 'str'}, - 'orchestrator_version': {'key': 'properties.orchestratorVersion', 'type': 'str'}, - 'current_orchestrator_version': {'key': 'properties.currentOrchestratorVersion', 'type': 'str'}, - 'node_image_version': {'key': 'properties.nodeImageVersion', 'type': 'str'}, - 'upgrade_settings': {'key': 'properties.upgradeSettings', 'type': 'AgentPoolUpgradeSettings'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'power_state': {'key': 'properties.powerState', 'type': 'PowerState'}, - 'availability_zones': {'key': 'properties.availabilityZones', 'type': '[str]'}, - 'enable_node_public_ip': {'key': 'properties.enableNodePublicIP', 'type': 'bool'}, - 'enable_custom_ca_trust': {'key': 'properties.enableCustomCATrust', 'type': 'bool'}, - 'node_public_ip_prefix_id': {'key': 'properties.nodePublicIPPrefixID', 'type': 'str'}, - 'scale_set_priority': {'key': 'properties.scaleSetPriority', 'type': 'str'}, - 'scale_set_eviction_policy': {'key': 'properties.scaleSetEvictionPolicy', 'type': 'str'}, - 'spot_max_price': {'key': 'properties.spotMaxPrice', 'type': 'float'}, - 'tags': {'key': 'properties.tags', 'type': '{str}'}, - 'node_labels': {'key': 'properties.nodeLabels', 'type': '{str}'}, - 'node_taints': {'key': 'properties.nodeTaints', 'type': '[str]'}, - 'proximity_placement_group_id': {'key': 'properties.proximityPlacementGroupID', 'type': 'str'}, - 'kubelet_config': {'key': 'properties.kubeletConfig', 'type': 'KubeletConfig'}, - 'linux_os_config': {'key': 'properties.linuxOSConfig', 'type': 'LinuxOSConfig'}, - 'enable_encryption_at_host': {'key': 'properties.enableEncryptionAtHost', 'type': 'bool'}, - 'enable_ultra_ssd': {'key': 'properties.enableUltraSSD', 'type': 'bool'}, - 'enable_fips': {'key': 'properties.enableFIPS', 'type': 'bool'}, - 'gpu_instance_profile': {'key': 'properties.gpuInstanceProfile', 'type': 'str'}, - 'creation_data': {'key': 'properties.creationData', 'type': 'CreationData'}, - 'capacity_reservation_group_id': {'key': 'properties.capacityReservationGroupID', 'type': 'str'}, - 'host_group_id': {'key': 'properties.hostGroupID', 'type': 'str'}, - } - - def __init__( + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "count": {"key": "properties.count", "type": "int"}, + "vm_size": {"key": "properties.vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "properties.osDiskSizeGB", "type": "int"}, + "os_disk_type": {"key": "properties.osDiskType", "type": "str"}, + "kubelet_disk_type": {"key": "properties.kubeletDiskType", "type": "str"}, + "workload_runtime": {"key": "properties.workloadRuntime", "type": "str"}, + "message_of_the_day": {"key": "properties.messageOfTheDay", "type": "str"}, + "vnet_subnet_id": {"key": "properties.vnetSubnetID", "type": "str"}, + "pod_subnet_id": {"key": "properties.podSubnetID", "type": "str"}, + "max_pods": {"key": "properties.maxPods", "type": "int"}, + "os_type": {"key": "properties.osType", "type": "str"}, + "os_sku": {"key": "properties.osSKU", "type": "str"}, + "max_count": {"key": "properties.maxCount", "type": "int"}, + "min_count": {"key": "properties.minCount", "type": "int"}, + "enable_auto_scaling": {"key": "properties.enableAutoScaling", "type": "bool"}, + "scale_down_mode": {"key": "properties.scaleDownMode", "type": "str"}, + "type_properties_type": {"key": "properties.type", "type": "str"}, + "mode": {"key": "properties.mode", "type": "str"}, + "orchestrator_version": {"key": "properties.orchestratorVersion", "type": "str"}, + "current_orchestrator_version": {"key": "properties.currentOrchestratorVersion", "type": "str"}, + "node_image_version": {"key": "properties.nodeImageVersion", "type": "str"}, + "upgrade_settings": {"key": "properties.upgradeSettings", "type": "AgentPoolUpgradeSettings"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "power_state": {"key": "properties.powerState", "type": "PowerState"}, + "availability_zones": {"key": "properties.availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "properties.enableNodePublicIP", "type": "bool"}, + "enable_custom_ca_trust": {"key": "properties.enableCustomCATrust", "type": "bool"}, + "node_public_ip_prefix_id": {"key": "properties.nodePublicIPPrefixID", "type": "str"}, + "scale_set_priority": {"key": "properties.scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "properties.scaleSetEvictionPolicy", "type": "str"}, + "spot_max_price": {"key": "properties.spotMaxPrice", "type": "float"}, + "tags": {"key": "properties.tags", "type": "{str}"}, + "node_labels": {"key": "properties.nodeLabels", "type": "{str}"}, + "node_taints": {"key": "properties.nodeTaints", "type": "[str]"}, + "proximity_placement_group_id": {"key": "properties.proximityPlacementGroupID", "type": "str"}, + "kubelet_config": {"key": "properties.kubeletConfig", "type": "KubeletConfig"}, + "linux_os_config": {"key": "properties.linuxOSConfig", "type": "LinuxOSConfig"}, + "enable_encryption_at_host": {"key": "properties.enableEncryptionAtHost", "type": "bool"}, + "enable_ultra_ssd": {"key": "properties.enableUltraSSD", "type": "bool"}, + "enable_fips": {"key": "properties.enableFIPS", "type": "bool"}, + "gpu_instance_profile": {"key": "properties.gpuInstanceProfile", "type": "str"}, + "creation_data": {"key": "properties.creationData", "type": "CreationData"}, + "capacity_reservation_group_id": {"key": "properties.capacityReservationGroupID", "type": "str"}, + "host_group_id": {"key": "properties.hostGroupID", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, count: Optional[int] = None, @@ -305,7 +300,7 @@ def __init__( vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, @@ -320,9 +315,9 @@ def __init__( enable_node_public_ip: Optional[bool] = None, enable_custom_ca_trust: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", - spot_max_price: Optional[float] = -1, + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", + spot_max_price: float = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, @@ -355,15 +350,15 @@ def __init__( larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.OSDiskType :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime - data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + data root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.KubeletDiskType :keyword workload_runtime: Determines the type of workload a node can run. Known values are: - "OCIContainer", "WasmWasi". + "OCIContainer" and "WasmWasi". :paramtype workload_runtime: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.WorkloadRuntime :keyword message_of_the_day: A base64-encoded string which will be written to /etc/motd after @@ -382,13 +377,13 @@ def __init__( :paramtype pod_subnet_id: str :keyword max_pods: The maximum number of pods that can run on a node. :paramtype max_pods: int - :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.OSType :keyword os_sku: Specifies the OS SKU used by the agent pool. If not specified, the default is Ubuntu if OSType=Linux or Windows2019 if OSType=Windows. And the default Windows OSSKU will be changed to Windows2022 after Windows2019 is deprecated. Known values are: "Ubuntu", - "CBLMariner", "Windows2019", "Windows2022". + "CBLMariner", "Windows2019", and "Windows2022". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.OSSKU :keyword max_count: The maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -397,16 +392,16 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, - it defaults to Delete. Known values are: "Delete", "Deallocate". + it defaults to Delete. Known values are: "Delete" and "Deallocate". :paramtype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.ScaleDownMode :keyword type_properties_type: The type of Agent Pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type_properties_type: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.AgentPoolType :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.AgentPoolMode :keyword orchestrator_version: Both patch version and are supported. When is specified, the latest supported patch version is chosen @@ -444,20 +439,18 @@ def __init__( /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the - default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + default is 'Regular'. Known values are: "Spot" and "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.ScaleSetPriority :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.ScaleSetEvictionPolicy :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :paramtype spot_max_price: float - :keyword tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :keyword tags: The tags to be persisted on the agent pool virtual machine scale set. :paramtype tags: dict[str, str] :keyword node_labels: The node labels to be persisted across all nodes in agent pool. :paramtype node_labels: dict[str, str] @@ -483,7 +476,7 @@ def __init__( for more details. :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance - profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.GPUInstanceProfile @@ -499,7 +492,7 @@ def __init__( `_. :paramtype host_group_id: str """ - super(AgentPool, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.vm_size = vm_size self.os_disk_size_gb = os_disk_size_gb @@ -546,7 +539,7 @@ def __init__( self.host_group_id = host_group_id -class AgentPoolAvailableVersions(msrest.serialization.Model): +class AgentPoolAvailableVersions(_serialization.Model): """The list of available versions for an agent pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -563,16 +556,19 @@ class AgentPoolAvailableVersions(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'agent_pool_versions': {'key': 'properties.agentPoolVersions', 'type': '[AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "agent_pool_versions": { + "key": "properties.agentPoolVersions", + "type": "[AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem]", + }, } def __init__( @@ -586,14 +582,14 @@ def __init__( :paramtype agent_pool_versions: list[~azure.mgmt.containerservice.v2022_05_02_preview.models.AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem] """ - super(AgentPoolAvailableVersions, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None self.agent_pool_versions = agent_pool_versions -class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(msrest.serialization.Model): +class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(_serialization.Model): """AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem. :ivar default: Whether this version is the default agent pool version. @@ -605,9 +601,9 @@ class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(msrest.serializa """ _attribute_map = { - 'default': {'key': 'default', 'type': 'bool'}, - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "default": {"key": "default", "type": "bool"}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } def __init__( @@ -626,13 +622,13 @@ def __init__( :keyword is_preview: Whether Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.default = default self.kubernetes_version = kubernetes_version self.is_preview = is_preview -class AgentPoolListResult(msrest.serialization.Model): +class AgentPoolListResult(_serialization.Model): """The response from the List Agent Pools operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -644,30 +640,25 @@ class AgentPoolListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[AgentPool]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[AgentPool]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.AgentPool"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.AgentPool"]] = None, **kwargs): """ :keyword value: The list of agent pools. :paramtype value: list[~azure.mgmt.containerservice.v2022_05_02_preview.models.AgentPool] """ - super(AgentPoolListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class AgentPoolUpgradeProfile(msrest.serialization.Model): +class AgentPoolUpgradeProfile(_serialization.Model): """The list of available upgrades for an agent pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -680,10 +671,10 @@ class AgentPoolUpgradeProfile(msrest.serialization.Model): :vartype name: str :ivar type: The type of the agent pool upgrade profile. :vartype type: str - :ivar kubernetes_version: Required. The Kubernetes version (major.minor.patch). + :ivar kubernetes_version: The Kubernetes version (major.minor.patch). Required. :vartype kubernetes_version: str - :ivar os_type: Required. The operating system type. The default is Linux. Known values are: - "Linux", "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -693,21 +684,21 @@ class AgentPoolUpgradeProfile(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kubernetes_version': {'required': True}, - 'os_type': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "kubernetes_version": {"required": True}, + "os_type": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'kubernetes_version': {'key': 'properties.kubernetesVersion', 'type': 'str'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'upgrades': {'key': 'properties.upgrades', 'type': '[AgentPoolUpgradeProfilePropertiesUpgradesItem]'}, - 'latest_node_image_version': {'key': 'properties.latestNodeImageVersion', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "os_type": {"key": "properties.osType", "type": "str"}, + "upgrades": {"key": "properties.upgrades", "type": "[AgentPoolUpgradeProfilePropertiesUpgradesItem]"}, + "latest_node_image_version": {"key": "properties.latestNodeImageVersion", "type": "str"}, } def __init__( @@ -720,10 +711,10 @@ def __init__( **kwargs ): """ - :keyword kubernetes_version: Required. The Kubernetes version (major.minor.patch). + :keyword kubernetes_version: The Kubernetes version (major.minor.patch). Required. :paramtype kubernetes_version: str - :keyword os_type: Required. The operating system type. The default is Linux. Known values are: - "Linux", "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: @@ -731,7 +722,7 @@ def __init__( :keyword latest_node_image_version: The latest AKS supported node image version. :paramtype latest_node_image_version: str """ - super(AgentPoolUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -741,7 +732,7 @@ def __init__( self.latest_node_image_version = latest_node_image_version -class AgentPoolUpgradeProfilePropertiesUpgradesItem(msrest.serialization.Model): +class AgentPoolUpgradeProfilePropertiesUpgradesItem(_serialization.Model): """AgentPoolUpgradeProfilePropertiesUpgradesItem. :ivar kubernetes_version: The Kubernetes version (major.minor.patch). @@ -751,29 +742,23 @@ class AgentPoolUpgradeProfilePropertiesUpgradesItem(msrest.serialization.Model): """ _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } - def __init__( - self, - *, - kubernetes_version: Optional[str] = None, - is_preview: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, kubernetes_version: Optional[str] = None, is_preview: Optional[bool] = None, **kwargs): """ :keyword kubernetes_version: The Kubernetes version (major.minor.patch). :paramtype kubernetes_version: str :keyword is_preview: Whether the Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(AgentPoolUpgradeProfilePropertiesUpgradesItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.is_preview = is_preview -class AgentPoolUpgradeSettings(msrest.serialization.Model): +class AgentPoolUpgradeSettings(_serialization.Model): """Settings for upgrading an agentpool. :ivar max_surge: This can either be set to an integer (e.g. '5') or a percentage (e.g. '50%'). @@ -785,15 +770,10 @@ class AgentPoolUpgradeSettings(msrest.serialization.Model): """ _attribute_map = { - 'max_surge': {'key': 'maxSurge', 'type': 'str'}, + "max_surge": {"key": "maxSurge", "type": "str"}, } - def __init__( - self, - *, - max_surge: Optional[str] = None, - **kwargs - ): + def __init__(self, *, max_surge: Optional[str] = None, **kwargs): """ :keyword max_surge: This can either be set to an integer (e.g. '5') or a percentage (e.g. '50%'). If a percentage is specified, it is the percentage of the total agent pool size at the @@ -802,11 +782,11 @@ def __init__( https://docs.microsoft.com/azure/aks/upgrade-cluster#customize-node-surge-upgrade. :paramtype max_surge: str """ - super(AgentPoolUpgradeSettings, self).__init__(**kwargs) + super().__init__(**kwargs) self.max_surge = max_surge -class AzureKeyVaultKms(msrest.serialization.Model): +class AzureKeyVaultKms(_serialization.Model): """Azure Key Vault key management service settings for the security profile. :ivar enabled: Whether to enable Azure Key Vault key management service. The default is false. @@ -820,7 +800,7 @@ class AzureKeyVaultKms(msrest.serialization.Model): :ivar key_vault_network_access: Network access of key vault. The possible values are ``Public`` and ``Private``. ``Public`` means the key vault allows public access from all networks. ``Private`` means the key vault disables public access and enables private link. The default - value is ``Public``. Known values are: "Public", "Private". Default value: "Public". + value is ``Public``. Known values are: "Public" and "Private". :vartype key_vault_network_access: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.KeyVaultNetworkAccessTypes :ivar key_vault_resource_id: Resource ID of key vault. When keyVaultNetworkAccess is @@ -830,10 +810,10 @@ class AzureKeyVaultKms(msrest.serialization.Model): """ _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'key_id': {'key': 'keyId', 'type': 'str'}, - 'key_vault_network_access': {'key': 'keyVaultNetworkAccess', 'type': 'str'}, - 'key_vault_resource_id': {'key': 'keyVaultResourceId', 'type': 'str'}, + "enabled": {"key": "enabled", "type": "bool"}, + "key_id": {"key": "keyId", "type": "str"}, + "key_vault_network_access": {"key": "keyVaultNetworkAccess", "type": "str"}, + "key_vault_resource_id": {"key": "keyVaultResourceId", "type": "str"}, } def __init__( @@ -841,7 +821,7 @@ def __init__( *, enabled: Optional[bool] = None, key_id: Optional[str] = None, - key_vault_network_access: Optional[Union[str, "_models.KeyVaultNetworkAccessTypes"]] = "Public", + key_vault_network_access: Union[str, "_models.KeyVaultNetworkAccessTypes"] = "Public", key_vault_resource_id: Optional[str] = None, **kwargs ): @@ -858,7 +838,7 @@ def __init__( :keyword key_vault_network_access: Network access of key vault. The possible values are ``Public`` and ``Private``. ``Public`` means the key vault allows public access from all networks. ``Private`` means the key vault disables public access and enables private link. The - default value is ``Public``. Known values are: "Public", "Private". Default value: "Public". + default value is ``Public``. Known values are: "Public" and "Private". :paramtype key_vault_network_access: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.KeyVaultNetworkAccessTypes :keyword key_vault_resource_id: Resource ID of key vault. When keyVaultNetworkAccess is @@ -866,14 +846,14 @@ def __init__( keyVaultNetworkAccess is ``Public``\ , leave the field empty. :paramtype key_vault_resource_id: str """ - super(AzureKeyVaultKms, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.key_id = key_id self.key_vault_network_access = key_vault_network_access self.key_vault_resource_id = key_vault_resource_id -class CloudErrorBody(msrest.serialization.Model): +class CloudErrorBody(_serialization.Model): """An error response from the Container service. :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed @@ -890,10 +870,10 @@ class CloudErrorBody(msrest.serialization.Model): """ _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[CloudErrorBody]"}, } def __init__( @@ -919,88 +899,77 @@ def __init__( :paramtype details: list[~azure.mgmt.containerservice.v2022_05_02_preview.models.CloudErrorBody] """ - super(CloudErrorBody, self).__init__(**kwargs) + super().__init__(**kwargs) self.code = code self.message = message self.target = target self.details = details -class ContainerServiceDiagnosticsProfile(msrest.serialization.Model): +class ContainerServiceDiagnosticsProfile(_serialization.Model): """Profile for diagnostics on the container service cluster. All required parameters must be populated in order to send to Azure. - :ivar vm_diagnostics: Required. Profile for diagnostics on the container service VMs. + :ivar vm_diagnostics: Profile for diagnostics on the container service VMs. Required. :vartype vm_diagnostics: ~azure.mgmt.containerservice.v2022_05_02_preview.models.ContainerServiceVMDiagnostics """ _validation = { - 'vm_diagnostics': {'required': True}, + "vm_diagnostics": {"required": True}, } _attribute_map = { - 'vm_diagnostics': {'key': 'vmDiagnostics', 'type': 'ContainerServiceVMDiagnostics'}, + "vm_diagnostics": {"key": "vmDiagnostics", "type": "ContainerServiceVMDiagnostics"}, } - def __init__( - self, - *, - vm_diagnostics: "_models.ContainerServiceVMDiagnostics", - **kwargs - ): + def __init__(self, *, vm_diagnostics: "_models.ContainerServiceVMDiagnostics", **kwargs): """ - :keyword vm_diagnostics: Required. Profile for diagnostics on the container service VMs. + :keyword vm_diagnostics: Profile for diagnostics on the container service VMs. Required. :paramtype vm_diagnostics: ~azure.mgmt.containerservice.v2022_05_02_preview.models.ContainerServiceVMDiagnostics """ - super(ContainerServiceDiagnosticsProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.vm_diagnostics = vm_diagnostics -class ContainerServiceLinuxProfile(msrest.serialization.Model): +class ContainerServiceLinuxProfile(_serialization.Model): """Profile for Linux VMs in the container service cluster. All required parameters must be populated in order to send to Azure. - :ivar admin_username: Required. The administrator username to use for Linux VMs. + :ivar admin_username: The administrator username to use for Linux VMs. Required. :vartype admin_username: str - :ivar ssh: Required. The SSH configuration for Linux-based VMs running on Azure. + :ivar ssh: The SSH configuration for Linux-based VMs running on Azure. Required. :vartype ssh: ~azure.mgmt.containerservice.v2022_05_02_preview.models.ContainerServiceSshConfiguration """ _validation = { - 'admin_username': {'required': True, 'pattern': r'^[A-Za-z][-A-Za-z0-9_]*$'}, - 'ssh': {'required': True}, + "admin_username": {"required": True, "pattern": r"^[A-Za-z][-A-Za-z0-9_]*$"}, + "ssh": {"required": True}, } _attribute_map = { - 'admin_username': {'key': 'adminUsername', 'type': 'str'}, - 'ssh': {'key': 'ssh', 'type': 'ContainerServiceSshConfiguration'}, + "admin_username": {"key": "adminUsername", "type": "str"}, + "ssh": {"key": "ssh", "type": "ContainerServiceSshConfiguration"}, } - def __init__( - self, - *, - admin_username: str, - ssh: "_models.ContainerServiceSshConfiguration", - **kwargs - ): + def __init__(self, *, admin_username: str, ssh: "_models.ContainerServiceSshConfiguration", **kwargs): """ - :keyword admin_username: Required. The administrator username to use for Linux VMs. + :keyword admin_username: The administrator username to use for Linux VMs. Required. :paramtype admin_username: str - :keyword ssh: Required. The SSH configuration for Linux-based VMs running on Azure. + :keyword ssh: The SSH configuration for Linux-based VMs running on Azure. Required. :paramtype ssh: ~azure.mgmt.containerservice.v2022_05_02_preview.models.ContainerServiceSshConfiguration """ - super(ContainerServiceLinuxProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.admin_username = admin_username self.ssh = ssh -class ContainerServiceMasterProfile(msrest.serialization.Model): +class ContainerServiceMasterProfile(_serialization.Model): """Profile for the container service master. Variables are only populated by the server, and will be ignored when sending a request. @@ -1008,11 +977,11 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar count: Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, - and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". + and 5. The default value is 1. Known values are: 1, 3, and 5. :vartype count: int or ~azure.mgmt.containerservice.v2022_05_02_preview.models.Count - :ivar dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. + :ivar dns_prefix: DNS prefix to be used to create the FQDN for the master pool. Required. :vartype dns_prefix: str - :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + :ivar vm_size: Size of agent VMs. Required. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -1049,7 +1018,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :vartype vm_size: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.ContainerServiceVMSizeTypes :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine @@ -1063,7 +1032,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): :vartype first_consecutive_static_ip: str :ivar storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount" and "ManagedDisks". :vartype storage_profile: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.ContainerServiceStorageProfileTypes :ivar fqdn: FQDN for the master pool. @@ -1071,21 +1040,21 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): """ _validation = { - 'dns_prefix': {'required': True}, - 'vm_size': {'required': True}, - 'os_disk_size_gb': {'maximum': 2048, 'minimum': 0}, - 'fqdn': {'readonly': True}, + "dns_prefix": {"required": True}, + "vm_size": {"required": True}, + "os_disk_size_gb": {"maximum": 2048, "minimum": 0}, + "fqdn": {"readonly": True}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'dns_prefix': {'key': 'dnsPrefix', 'type': 'str'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'first_consecutive_static_ip': {'key': 'firstConsecutiveStaticIP', 'type': 'str'}, - 'storage_profile': {'key': 'storageProfile', 'type': 'str'}, - 'fqdn': {'key': 'fqdn', 'type': 'str'}, + "count": {"key": "count", "type": "int"}, + "dns_prefix": {"key": "dnsPrefix", "type": "str"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "first_consecutive_static_ip": {"key": "firstConsecutiveStaticIP", "type": "str"}, + "storage_profile": {"key": "storageProfile", "type": "str"}, + "fqdn": {"key": "fqdn", "type": "str"}, } def __init__( @@ -1093,20 +1062,20 @@ def __init__( *, dns_prefix: str, vm_size: Union[str, "_models.ContainerServiceVMSizeTypes"], - count: Optional[Union[int, "_models.Count"]] = 1, + count: Union[int, "_models.Count"] = 1, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, - first_consecutive_static_ip: Optional[str] = "10.240.255.5", + first_consecutive_static_ip: str = "10.240.255.5", storage_profile: Optional[Union[str, "_models.ContainerServiceStorageProfileTypes"]] = None, **kwargs ): """ :keyword count: Number of masters (VMs) in the container service cluster. Allowed values are 1, - 3, and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". + 3, and 5. The default value is 1. Known values are: 1, 3, and 5. :paramtype count: int or ~azure.mgmt.containerservice.v2022_05_02_preview.models.Count - :keyword dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. + :keyword dns_prefix: DNS prefix to be used to create the FQDN for the master pool. Required. :paramtype dns_prefix: str - :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + :keyword vm_size: Size of agent VMs. Required. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -1143,7 +1112,7 @@ def __init__( "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :paramtype vm_size: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.ContainerServiceVMSizeTypes :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every @@ -1157,11 +1126,11 @@ def __init__( :paramtype first_consecutive_static_ip: str :keyword storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount" and "ManagedDisks". :paramtype storage_profile: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.ContainerServiceStorageProfileTypes """ - super(ContainerServiceMasterProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.dns_prefix = dns_prefix self.vm_size = vm_size @@ -1172,23 +1141,23 @@ def __init__( self.fqdn = None -class ContainerServiceNetworkProfile(msrest.serialization.Model): +class ContainerServiceNetworkProfile(_serialization.Model): # pylint: disable=too-many-instance-attributes """Profile of network configuration. :ivar network_plugin: Network plugin used for building the Kubernetes network. Known values - are: "azure", "kubenet", "none". Default value: "kubenet". + are: "azure", "kubenet", and "none". :vartype network_plugin: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.NetworkPlugin - :ivar network_plugin_mode: Network plugin mode used for building the Kubernetes network. Known - values are: "Overlay". + :ivar network_plugin_mode: Network plugin mode used for building the Kubernetes network. + "Overlay" :vartype network_plugin_mode: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.NetworkPluginMode :ivar network_policy: Network policy used for building the Kubernetes network. Known values - are: "calico", "azure". + are: "calico" and "azure". :vartype network_policy: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.NetworkPolicy :ivar network_mode: This cannot be specified if networkPlugin is anything other than 'azure'. - Known values are: "transparent", "bridge". + Known values are: "transparent" and "bridge". :vartype network_mode: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.NetworkMode :ivar pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. @@ -1205,13 +1174,12 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): :ivar outbound_type: This can only be set at cluster creation time and cannot be changed later. For more information see `egress outbound type `_. Known values are: "loadBalancer", - "userDefinedRouting", "managedNATGateway", "userAssignedNATGateway". Default value: - "loadBalancer". + "userDefinedRouting", "managedNATGateway", and "userAssignedNATGateway". :vartype outbound_type: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.OutboundType :ivar load_balancer_sku: The default is 'standard'. See `Azure Load Balancer SKUs `_ for more information about the - differences between load balancer SKUs. Known values are: "standard", "basic". + differences between load balancer SKUs. Known values are: "standard" and "basic". :vartype load_balancer_sku: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.LoadBalancerSku :ivar load_balancer_profile: Profile of the cluster load balancer. @@ -1235,42 +1203,44 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): """ _validation = { - 'pod_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, - 'service_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, - 'dns_service_ip': {'pattern': r'^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$'}, - 'docker_bridge_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, + "pod_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, + "service_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, + "dns_service_ip": { + "pattern": r"^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$" + }, + "docker_bridge_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, } _attribute_map = { - 'network_plugin': {'key': 'networkPlugin', 'type': 'str'}, - 'network_plugin_mode': {'key': 'networkPluginMode', 'type': 'str'}, - 'network_policy': {'key': 'networkPolicy', 'type': 'str'}, - 'network_mode': {'key': 'networkMode', 'type': 'str'}, - 'pod_cidr': {'key': 'podCidr', 'type': 'str'}, - 'service_cidr': {'key': 'serviceCidr', 'type': 'str'}, - 'dns_service_ip': {'key': 'dnsServiceIP', 'type': 'str'}, - 'docker_bridge_cidr': {'key': 'dockerBridgeCidr', 'type': 'str'}, - 'outbound_type': {'key': 'outboundType', 'type': 'str'}, - 'load_balancer_sku': {'key': 'loadBalancerSku', 'type': 'str'}, - 'load_balancer_profile': {'key': 'loadBalancerProfile', 'type': 'ManagedClusterLoadBalancerProfile'}, - 'nat_gateway_profile': {'key': 'natGatewayProfile', 'type': 'ManagedClusterNATGatewayProfile'}, - 'pod_cidrs': {'key': 'podCidrs', 'type': '[str]'}, - 'service_cidrs': {'key': 'serviceCidrs', 'type': '[str]'}, - 'ip_families': {'key': 'ipFamilies', 'type': '[str]'}, + "network_plugin": {"key": "networkPlugin", "type": "str"}, + "network_plugin_mode": {"key": "networkPluginMode", "type": "str"}, + "network_policy": {"key": "networkPolicy", "type": "str"}, + "network_mode": {"key": "networkMode", "type": "str"}, + "pod_cidr": {"key": "podCidr", "type": "str"}, + "service_cidr": {"key": "serviceCidr", "type": "str"}, + "dns_service_ip": {"key": "dnsServiceIP", "type": "str"}, + "docker_bridge_cidr": {"key": "dockerBridgeCidr", "type": "str"}, + "outbound_type": {"key": "outboundType", "type": "str"}, + "load_balancer_sku": {"key": "loadBalancerSku", "type": "str"}, + "load_balancer_profile": {"key": "loadBalancerProfile", "type": "ManagedClusterLoadBalancerProfile"}, + "nat_gateway_profile": {"key": "natGatewayProfile", "type": "ManagedClusterNATGatewayProfile"}, + "pod_cidrs": {"key": "podCidrs", "type": "[str]"}, + "service_cidrs": {"key": "serviceCidrs", "type": "[str]"}, + "ip_families": {"key": "ipFamilies", "type": "[str]"}, } def __init__( self, *, - network_plugin: Optional[Union[str, "_models.NetworkPlugin"]] = "kubenet", + network_plugin: Union[str, "_models.NetworkPlugin"] = "kubenet", network_plugin_mode: Optional[Union[str, "_models.NetworkPluginMode"]] = None, network_policy: Optional[Union[str, "_models.NetworkPolicy"]] = None, network_mode: Optional[Union[str, "_models.NetworkMode"]] = None, - pod_cidr: Optional[str] = "10.244.0.0/16", - service_cidr: Optional[str] = "10.0.0.0/16", - dns_service_ip: Optional[str] = "10.0.0.10", - docker_bridge_cidr: Optional[str] = "172.17.0.1/16", - outbound_type: Optional[Union[str, "_models.OutboundType"]] = "loadBalancer", + pod_cidr: str = "10.244.0.0/16", + service_cidr: str = "10.0.0.0/16", + dns_service_ip: str = "10.0.0.10", + docker_bridge_cidr: str = "172.17.0.1/16", + outbound_type: Union[str, "_models.OutboundType"] = "loadBalancer", load_balancer_sku: Optional[Union[str, "_models.LoadBalancerSku"]] = None, load_balancer_profile: Optional["_models.ManagedClusterLoadBalancerProfile"] = None, nat_gateway_profile: Optional["_models.ManagedClusterNATGatewayProfile"] = None, @@ -1281,19 +1251,19 @@ def __init__( ): """ :keyword network_plugin: Network plugin used for building the Kubernetes network. Known values - are: "azure", "kubenet", "none". Default value: "kubenet". + are: "azure", "kubenet", and "none". :paramtype network_plugin: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.NetworkPlugin :keyword network_plugin_mode: Network plugin mode used for building the Kubernetes network. - Known values are: "Overlay". + "Overlay" :paramtype network_plugin_mode: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.NetworkPluginMode :keyword network_policy: Network policy used for building the Kubernetes network. Known values - are: "calico", "azure". + are: "calico" and "azure". :paramtype network_policy: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.NetworkPolicy :keyword network_mode: This cannot be specified if networkPlugin is anything other than - 'azure'. Known values are: "transparent", "bridge". + 'azure'. Known values are: "transparent" and "bridge". :paramtype network_mode: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.NetworkMode :keyword pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. @@ -1310,13 +1280,12 @@ def __init__( :keyword outbound_type: This can only be set at cluster creation time and cannot be changed later. For more information see `egress outbound type `_. Known values are: "loadBalancer", - "userDefinedRouting", "managedNATGateway", "userAssignedNATGateway". Default value: - "loadBalancer". + "userDefinedRouting", "managedNATGateway", and "userAssignedNATGateway". :paramtype outbound_type: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.OutboundType :keyword load_balancer_sku: The default is 'standard'. See `Azure Load Balancer SKUs `_ for more information about the - differences between load balancer SKUs. Known values are: "standard", "basic". + differences between load balancer SKUs. Known values are: "standard" and "basic". :paramtype load_balancer_sku: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.LoadBalancerSku :keyword load_balancer_profile: Profile of the cluster load balancer. @@ -1338,7 +1307,7 @@ def __init__( :paramtype ip_families: list[str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.IpFamily] """ - super(ContainerServiceNetworkProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.network_plugin = network_plugin self.network_plugin_mode = network_plugin_mode self.network_policy = network_policy @@ -1356,113 +1325,98 @@ def __init__( self.ip_families = ip_families -class ContainerServiceSshConfiguration(msrest.serialization.Model): +class ContainerServiceSshConfiguration(_serialization.Model): """SSH configuration for Linux-based VMs running on Azure. All required parameters must be populated in order to send to Azure. - :ivar public_keys: Required. The list of SSH public keys used to authenticate with Linux-based - VMs. A maximum of 1 key may be specified. + :ivar public_keys: The list of SSH public keys used to authenticate with Linux-based VMs. A + maximum of 1 key may be specified. Required. :vartype public_keys: list[~azure.mgmt.containerservice.v2022_05_02_preview.models.ContainerServiceSshPublicKey] """ _validation = { - 'public_keys': {'required': True}, + "public_keys": {"required": True}, } _attribute_map = { - 'public_keys': {'key': 'publicKeys', 'type': '[ContainerServiceSshPublicKey]'}, + "public_keys": {"key": "publicKeys", "type": "[ContainerServiceSshPublicKey]"}, } - def __init__( - self, - *, - public_keys: List["_models.ContainerServiceSshPublicKey"], - **kwargs - ): + def __init__(self, *, public_keys: List["_models.ContainerServiceSshPublicKey"], **kwargs): """ - :keyword public_keys: Required. The list of SSH public keys used to authenticate with - Linux-based VMs. A maximum of 1 key may be specified. + :keyword public_keys: The list of SSH public keys used to authenticate with Linux-based VMs. A + maximum of 1 key may be specified. Required. :paramtype public_keys: list[~azure.mgmt.containerservice.v2022_05_02_preview.models.ContainerServiceSshPublicKey] """ - super(ContainerServiceSshConfiguration, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_keys = public_keys -class ContainerServiceSshPublicKey(msrest.serialization.Model): +class ContainerServiceSshPublicKey(_serialization.Model): """Contains information about SSH certificate public key data. All required parameters must be populated in order to send to Azure. - :ivar key_data: Required. Certificate public key used to authenticate with VMs through SSH. The - certificate must be in PEM format with or without headers. + :ivar key_data: Certificate public key used to authenticate with VMs through SSH. The + certificate must be in PEM format with or without headers. Required. :vartype key_data: str """ _validation = { - 'key_data': {'required': True}, + "key_data": {"required": True}, } _attribute_map = { - 'key_data': {'key': 'keyData', 'type': 'str'}, + "key_data": {"key": "keyData", "type": "str"}, } - def __init__( - self, - *, - key_data: str, - **kwargs - ): + def __init__(self, *, key_data: str, **kwargs): """ - :keyword key_data: Required. Certificate public key used to authenticate with VMs through SSH. - The certificate must be in PEM format with or without headers. + :keyword key_data: Certificate public key used to authenticate with VMs through SSH. The + certificate must be in PEM format with or without headers. Required. :paramtype key_data: str """ - super(ContainerServiceSshPublicKey, self).__init__(**kwargs) + super().__init__(**kwargs) self.key_data = key_data -class ContainerServiceVMDiagnostics(msrest.serialization.Model): +class ContainerServiceVMDiagnostics(_serialization.Model): """Profile for diagnostics on the container service VMs. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar enabled: Required. Whether the VM diagnostic agent is provisioned on the VM. + :ivar enabled: Whether the VM diagnostic agent is provisioned on the VM. Required. :vartype enabled: bool :ivar storage_uri: The URI of the storage account where diagnostics are stored. :vartype storage_uri: str """ _validation = { - 'enabled': {'required': True}, - 'storage_uri': {'readonly': True}, + "enabled": {"required": True}, + "storage_uri": {"readonly": True}, } _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'storage_uri': {'key': 'storageUri', 'type': 'str'}, + "enabled": {"key": "enabled", "type": "bool"}, + "storage_uri": {"key": "storageUri", "type": "str"}, } - def __init__( - self, - *, - enabled: bool, - **kwargs - ): + def __init__(self, *, enabled: bool, **kwargs): """ - :keyword enabled: Required. Whether the VM diagnostic agent is provisioned on the VM. + :keyword enabled: Whether the VM diagnostic agent is provisioned on the VM. Required. :paramtype enabled: bool """ - super(ContainerServiceVMDiagnostics, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.storage_uri = None -class CreationData(msrest.serialization.Model): +class CreationData(_serialization.Model): """Data used when creating a target resource from a source resource. :ivar source_resource_id: This is the ARM ID of the source object to be used to create the @@ -1471,25 +1425,20 @@ class CreationData(msrest.serialization.Model): """ _attribute_map = { - 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, + "source_resource_id": {"key": "sourceResourceId", "type": "str"}, } - def __init__( - self, - *, - source_resource_id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, source_resource_id: Optional[str] = None, **kwargs): """ :keyword source_resource_id: This is the ARM ID of the source object to be used to create the target object. :paramtype source_resource_id: str """ - super(CreationData, self).__init__(**kwargs) + super().__init__(**kwargs) self.source_resource_id = source_resource_id -class CredentialResult(msrest.serialization.Model): +class CredentialResult(_serialization.Model): """The credential result response. Variables are only populated by the server, and will be ignored when sending a request. @@ -1497,31 +1446,27 @@ class CredentialResult(msrest.serialization.Model): :ivar name: The name of the credential. :vartype name: str :ivar value: Base64-encoded Kubernetes configuration file. - :vartype value: bytearray + :vartype value: bytes """ _validation = { - 'name': {'readonly': True}, - 'value': {'readonly': True}, + "name": {"readonly": True}, + "value": {"readonly": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'bytearray'}, + "name": {"key": "name", "type": "str"}, + "value": {"key": "value", "type": "bytearray"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(CredentialResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.name = None self.value = None -class CredentialResults(msrest.serialization.Model): +class CredentialResults(_serialization.Model): """The list credential result response. Variables are only populated by the server, and will be ignored when sending a request. @@ -1532,24 +1477,20 @@ class CredentialResults(msrest.serialization.Model): """ _validation = { - 'kubeconfigs': {'readonly': True}, + "kubeconfigs": {"readonly": True}, } _attribute_map = { - 'kubeconfigs': {'key': 'kubeconfigs', 'type': '[CredentialResult]'}, + "kubeconfigs": {"key": "kubeconfigs", "type": "[CredentialResult]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(CredentialResults, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.kubeconfigs = None -class EndpointDependency(msrest.serialization.Model): +class EndpointDependency(_serialization.Model): """A domain name that AKS agent nodes are reaching at. :ivar domain_name: The domain name of the dependency. @@ -1560,8 +1501,8 @@ class EndpointDependency(msrest.serialization.Model): """ _attribute_map = { - 'domain_name': {'key': 'domainName', 'type': 'str'}, - 'endpoint_details': {'key': 'endpointDetails', 'type': '[EndpointDetail]'}, + "domain_name": {"key": "domainName", "type": "str"}, + "endpoint_details": {"key": "endpointDetails", "type": "[EndpointDetail]"}, } def __init__( @@ -1578,12 +1519,12 @@ def __init__( :paramtype endpoint_details: list[~azure.mgmt.containerservice.v2022_05_02_preview.models.EndpointDetail] """ - super(EndpointDependency, self).__init__(**kwargs) + super().__init__(**kwargs) self.domain_name = domain_name self.endpoint_details = endpoint_details -class EndpointDetail(msrest.serialization.Model): +class EndpointDetail(_serialization.Model): """connect information from the AKS agent nodes to a single endpoint. :ivar ip_address: An IP Address that Domain Name currently resolves to. @@ -1597,10 +1538,10 @@ class EndpointDetail(msrest.serialization.Model): """ _attribute_map = { - 'ip_address': {'key': 'ipAddress', 'type': 'str'}, - 'port': {'key': 'port', 'type': 'int'}, - 'protocol': {'key': 'protocol', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, + "ip_address": {"key": "ipAddress", "type": "str"}, + "port": {"key": "port", "type": "int"}, + "protocol": {"key": "protocol", "type": "str"}, + "description": {"key": "description", "type": "str"}, } def __init__( @@ -1622,26 +1563,26 @@ def __init__( :keyword description: Description of the detail. :paramtype description: str """ - super(EndpointDetail, self).__init__(**kwargs) + super().__init__(**kwargs) self.ip_address = ip_address self.port = port self.protocol = protocol self.description = description -class ExtendedLocation(msrest.serialization.Model): +class ExtendedLocation(_serialization.Model): """The complex type of the extended location. :ivar name: The name of the extended location. :vartype name: str - :ivar type: The type of the extended location. Known values are: "EdgeZone". + :ivar type: The type of the extended location. "EdgeZone" :vartype type: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.ExtendedLocationTypes """ _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, } def __init__( @@ -1654,16 +1595,16 @@ def __init__( """ :keyword name: The name of the extended location. :paramtype name: str - :keyword type: The type of the extended location. Known values are: "EdgeZone". + :keyword type: The type of the extended location. "EdgeZone" :paramtype type: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.ExtendedLocationTypes """ - super(ExtendedLocation, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.type = type -class KubeletConfig(msrest.serialization.Model): +class KubeletConfig(_serialization.Model): # pylint: disable=too-many-instance-attributes """See `AKS custom node configuration `_ for more details. :ivar cpu_manager_policy: The default is 'none'. See `Kubernetes CPU management policies @@ -1703,21 +1644,21 @@ class KubeletConfig(msrest.serialization.Model): """ _validation = { - 'container_log_max_files': {'minimum': 2}, + "container_log_max_files": {"minimum": 2}, } _attribute_map = { - 'cpu_manager_policy': {'key': 'cpuManagerPolicy', 'type': 'str'}, - 'cpu_cfs_quota': {'key': 'cpuCfsQuota', 'type': 'bool'}, - 'cpu_cfs_quota_period': {'key': 'cpuCfsQuotaPeriod', 'type': 'str'}, - 'image_gc_high_threshold': {'key': 'imageGcHighThreshold', 'type': 'int'}, - 'image_gc_low_threshold': {'key': 'imageGcLowThreshold', 'type': 'int'}, - 'topology_manager_policy': {'key': 'topologyManagerPolicy', 'type': 'str'}, - 'allowed_unsafe_sysctls': {'key': 'allowedUnsafeSysctls', 'type': '[str]'}, - 'fail_swap_on': {'key': 'failSwapOn', 'type': 'bool'}, - 'container_log_max_size_mb': {'key': 'containerLogMaxSizeMB', 'type': 'int'}, - 'container_log_max_files': {'key': 'containerLogMaxFiles', 'type': 'int'}, - 'pod_max_pids': {'key': 'podMaxPids', 'type': 'int'}, + "cpu_manager_policy": {"key": "cpuManagerPolicy", "type": "str"}, + "cpu_cfs_quota": {"key": "cpuCfsQuota", "type": "bool"}, + "cpu_cfs_quota_period": {"key": "cpuCfsQuotaPeriod", "type": "str"}, + "image_gc_high_threshold": {"key": "imageGcHighThreshold", "type": "int"}, + "image_gc_low_threshold": {"key": "imageGcLowThreshold", "type": "int"}, + "topology_manager_policy": {"key": "topologyManagerPolicy", "type": "str"}, + "allowed_unsafe_sysctls": {"key": "allowedUnsafeSysctls", "type": "[str]"}, + "fail_swap_on": {"key": "failSwapOn", "type": "bool"}, + "container_log_max_size_mb": {"key": "containerLogMaxSizeMB", "type": "int"}, + "container_log_max_files": {"key": "containerLogMaxFiles", "type": "int"}, + "pod_max_pids": {"key": "podMaxPids", "type": "int"}, } def __init__( @@ -1772,7 +1713,7 @@ def __init__( :keyword pod_max_pids: The maximum number of processes per pod. :paramtype pod_max_pids: int """ - super(KubeletConfig, self).__init__(**kwargs) + super().__init__(**kwargs) self.cpu_manager_policy = cpu_manager_policy self.cpu_cfs_quota = cpu_cfs_quota self.cpu_cfs_quota_period = cpu_cfs_quota_period @@ -1786,7 +1727,7 @@ def __init__( self.pod_max_pids = pod_max_pids -class LinuxOSConfig(msrest.serialization.Model): +class LinuxOSConfig(_serialization.Model): """See `AKS custom node configuration `_ for more details. :ivar sysctls: Sysctl settings for Linux agent nodes. @@ -1805,10 +1746,10 @@ class LinuxOSConfig(msrest.serialization.Model): """ _attribute_map = { - 'sysctls': {'key': 'sysctls', 'type': 'SysctlConfig'}, - 'transparent_huge_page_enabled': {'key': 'transparentHugePageEnabled', 'type': 'str'}, - 'transparent_huge_page_defrag': {'key': 'transparentHugePageDefrag', 'type': 'str'}, - 'swap_file_size_mb': {'key': 'swapFileSizeMB', 'type': 'int'}, + "sysctls": {"key": "sysctls", "type": "SysctlConfig"}, + "transparent_huge_page_enabled": {"key": "transparentHugePageEnabled", "type": "str"}, + "transparent_huge_page_defrag": {"key": "transparentHugePageDefrag", "type": "str"}, + "swap_file_size_mb": {"key": "swapFileSizeMB", "type": "int"}, } def __init__( @@ -1835,7 +1776,7 @@ def __init__( :keyword swap_file_size_mb: The size in MB of a swap file that will be created on each node. :paramtype swap_file_size_mb: int """ - super(LinuxOSConfig, self).__init__(**kwargs) + super().__init__(**kwargs) self.sysctls = sysctls self.transparent_huge_page_enabled = transparent_huge_page_enabled self.transparent_huge_page_defrag = transparent_huge_page_defrag @@ -1865,19 +1806,19 @@ class MaintenanceConfiguration(SubResource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, + "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'}, - 'time_in_week': {'key': 'properties.timeInWeek', 'type': '[TimeInWeek]'}, - 'not_allowed_time': {'key': 'properties.notAllowedTime', 'type': '[TimeSpan]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "time_in_week": {"key": "properties.timeInWeek", "type": "[TimeInWeek]"}, + "not_allowed_time": {"key": "properties.notAllowedTime", "type": "[TimeSpan]"}, } def __init__( @@ -1896,13 +1837,13 @@ def __init__( :paramtype not_allowed_time: list[~azure.mgmt.containerservice.v2022_05_02_preview.models.TimeSpan] """ - super(MaintenanceConfiguration, self).__init__(**kwargs) + super().__init__(**kwargs) self.system_data = None self.time_in_week = time_in_week self.not_allowed_time = not_allowed_time -class MaintenanceConfigurationListResult(msrest.serialization.Model): +class MaintenanceConfigurationListResult(_serialization.Model): """The response from the List maintenance configurations operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -1915,31 +1856,26 @@ class MaintenanceConfigurationListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[MaintenanceConfiguration]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[MaintenanceConfiguration]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.MaintenanceConfiguration"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.MaintenanceConfiguration"]] = None, **kwargs): """ :keyword value: The list of maintenance configurations. :paramtype value: list[~azure.mgmt.containerservice.v2022_05_02_preview.models.MaintenanceConfiguration] """ - super(MaintenanceConfigurationListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class Resource(msrest.serialization.Model): +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. @@ -1958,26 +1894,22 @@ class Resource(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, + "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'}, + "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 - ): - """ - """ - super(Resource, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -2002,48 +1934,42 @@ class TrackedResource(Resource): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.containerservice.v2022_05_02_preview.models.SystemData - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] - :ivar location: Required. The geo-location where the resource lives. + :ivar location: The geo-location where the resource lives. Required. :vartype location: str """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'location': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, } - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] - :keyword location: Required. The geo-location where the resource lives. + :keyword location: The geo-location where the resource lives. Required. :paramtype location: str """ - super(TrackedResource, self).__init__(**kwargs) + super().__init__(**kwargs) self.tags = tags self.location = location -class ManagedCluster(TrackedResource): +class ManagedCluster(TrackedResource): # pylint: disable=too-many-instance-attributes """Managed cluster. Variables are only populated by the server, and will be ignored when sending a request. @@ -2061,9 +1987,9 @@ class ManagedCluster(TrackedResource): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.containerservice.v2022_05_02_preview.models.SystemData - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] - :ivar location: Required. The geo-location where the resource lives. + :ivar location: The geo-location where the resource lives. Required. :vartype location: str :ivar sku: The managed cluster SKU. :vartype sku: ~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedClusterSKU @@ -2180,7 +2106,7 @@ class ManagedCluster(TrackedResource): :vartype ingress_profile: ~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedClusterIngressProfile :ivar public_network_access: Allow or deny public network access for AKS. Known values are: - "Enabled", "Disabled". + "Enabled" and "Disabled". :vartype public_network_access: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.PublicNetworkAccess :ivar workload_auto_scaler_profile: Workload Auto-scaler profile for the container service @@ -2190,70 +2116,82 @@ class ManagedCluster(TrackedResource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'location': {'required': True}, - 'provisioning_state': {'readonly': True}, - 'power_state': {'readonly': True}, - 'max_agent_pools': {'readonly': True}, - 'current_kubernetes_version': {'readonly': True}, - 'fqdn': {'readonly': True}, - 'private_fqdn': {'readonly': True}, - 'azure_portal_fqdn': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, + "provisioning_state": {"readonly": True}, + "power_state": {"readonly": True}, + "max_agent_pools": {"readonly": True}, + "current_kubernetes_version": {"readonly": True}, + "fqdn": {"readonly": True}, + "private_fqdn": {"readonly": True}, + "azure_portal_fqdn": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'ManagedClusterSKU'}, - 'extended_location': {'key': 'extendedLocation', 'type': 'ExtendedLocation'}, - 'identity': {'key': 'identity', 'type': 'ManagedClusterIdentity'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'power_state': {'key': 'properties.powerState', 'type': 'PowerState'}, - 'creation_data': {'key': 'properties.creationData', 'type': 'CreationData'}, - 'max_agent_pools': {'key': 'properties.maxAgentPools', 'type': 'int'}, - 'kubernetes_version': {'key': 'properties.kubernetesVersion', 'type': 'str'}, - 'current_kubernetes_version': {'key': 'properties.currentKubernetesVersion', 'type': 'str'}, - 'dns_prefix': {'key': 'properties.dnsPrefix', 'type': 'str'}, - 'fqdn_subdomain': {'key': 'properties.fqdnSubdomain', 'type': 'str'}, - 'fqdn': {'key': 'properties.fqdn', 'type': 'str'}, - 'private_fqdn': {'key': 'properties.privateFQDN', 'type': 'str'}, - 'azure_portal_fqdn': {'key': 'properties.azurePortalFQDN', 'type': 'str'}, - 'agent_pool_profiles': {'key': 'properties.agentPoolProfiles', 'type': '[ManagedClusterAgentPoolProfile]'}, - 'linux_profile': {'key': 'properties.linuxProfile', 'type': 'ContainerServiceLinuxProfile'}, - 'windows_profile': {'key': 'properties.windowsProfile', 'type': 'ManagedClusterWindowsProfile'}, - 'service_principal_profile': {'key': 'properties.servicePrincipalProfile', 'type': 'ManagedClusterServicePrincipalProfile'}, - 'addon_profiles': {'key': 'properties.addonProfiles', 'type': '{ManagedClusterAddonProfile}'}, - 'pod_identity_profile': {'key': 'properties.podIdentityProfile', 'type': 'ManagedClusterPodIdentityProfile'}, - 'oidc_issuer_profile': {'key': 'properties.oidcIssuerProfile', 'type': 'ManagedClusterOIDCIssuerProfile'}, - 'node_resource_group': {'key': 'properties.nodeResourceGroup', 'type': 'str'}, - 'enable_rbac': {'key': 'properties.enableRBAC', 'type': 'bool'}, - 'enable_pod_security_policy': {'key': 'properties.enablePodSecurityPolicy', 'type': 'bool'}, - 'enable_namespace_resources': {'key': 'properties.enableNamespaceResources', 'type': 'bool'}, - 'network_profile': {'key': 'properties.networkProfile', 'type': 'ContainerServiceNetworkProfile'}, - 'aad_profile': {'key': 'properties.aadProfile', 'type': 'ManagedClusterAADProfile'}, - 'auto_upgrade_profile': {'key': 'properties.autoUpgradeProfile', 'type': 'ManagedClusterAutoUpgradeProfile'}, - 'auto_scaler_profile': {'key': 'properties.autoScalerProfile', 'type': 'ManagedClusterPropertiesAutoScalerProfile'}, - 'api_server_access_profile': {'key': 'properties.apiServerAccessProfile', 'type': 'ManagedClusterAPIServerAccessProfile'}, - 'disk_encryption_set_id': {'key': 'properties.diskEncryptionSetID', 'type': 'str'}, - 'identity_profile': {'key': 'properties.identityProfile', 'type': '{UserAssignedIdentity}'}, - 'private_link_resources': {'key': 'properties.privateLinkResources', 'type': '[PrivateLinkResource]'}, - 'disable_local_accounts': {'key': 'properties.disableLocalAccounts', 'type': 'bool'}, - 'http_proxy_config': {'key': 'properties.httpProxyConfig', 'type': 'ManagedClusterHTTPProxyConfig'}, - 'security_profile': {'key': 'properties.securityProfile', 'type': 'ManagedClusterSecurityProfile'}, - 'storage_profile': {'key': 'properties.storageProfile', 'type': 'ManagedClusterStorageProfile'}, - 'ingress_profile': {'key': 'properties.ingressProfile', 'type': 'ManagedClusterIngressProfile'}, - 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, - 'workload_auto_scaler_profile': {'key': 'properties.workloadAutoScalerProfile', 'type': 'ManagedClusterWorkloadAutoScalerProfile'}, - } - - def __init__( + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "sku": {"key": "sku", "type": "ManagedClusterSKU"}, + "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, + "identity": {"key": "identity", "type": "ManagedClusterIdentity"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "power_state": {"key": "properties.powerState", "type": "PowerState"}, + "creation_data": {"key": "properties.creationData", "type": "CreationData"}, + "max_agent_pools": {"key": "properties.maxAgentPools", "type": "int"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "current_kubernetes_version": {"key": "properties.currentKubernetesVersion", "type": "str"}, + "dns_prefix": {"key": "properties.dnsPrefix", "type": "str"}, + "fqdn_subdomain": {"key": "properties.fqdnSubdomain", "type": "str"}, + "fqdn": {"key": "properties.fqdn", "type": "str"}, + "private_fqdn": {"key": "properties.privateFQDN", "type": "str"}, + "azure_portal_fqdn": {"key": "properties.azurePortalFQDN", "type": "str"}, + "agent_pool_profiles": {"key": "properties.agentPoolProfiles", "type": "[ManagedClusterAgentPoolProfile]"}, + "linux_profile": {"key": "properties.linuxProfile", "type": "ContainerServiceLinuxProfile"}, + "windows_profile": {"key": "properties.windowsProfile", "type": "ManagedClusterWindowsProfile"}, + "service_principal_profile": { + "key": "properties.servicePrincipalProfile", + "type": "ManagedClusterServicePrincipalProfile", + }, + "addon_profiles": {"key": "properties.addonProfiles", "type": "{ManagedClusterAddonProfile}"}, + "pod_identity_profile": {"key": "properties.podIdentityProfile", "type": "ManagedClusterPodIdentityProfile"}, + "oidc_issuer_profile": {"key": "properties.oidcIssuerProfile", "type": "ManagedClusterOIDCIssuerProfile"}, + "node_resource_group": {"key": "properties.nodeResourceGroup", "type": "str"}, + "enable_rbac": {"key": "properties.enableRBAC", "type": "bool"}, + "enable_pod_security_policy": {"key": "properties.enablePodSecurityPolicy", "type": "bool"}, + "enable_namespace_resources": {"key": "properties.enableNamespaceResources", "type": "bool"}, + "network_profile": {"key": "properties.networkProfile", "type": "ContainerServiceNetworkProfile"}, + "aad_profile": {"key": "properties.aadProfile", "type": "ManagedClusterAADProfile"}, + "auto_upgrade_profile": {"key": "properties.autoUpgradeProfile", "type": "ManagedClusterAutoUpgradeProfile"}, + "auto_scaler_profile": { + "key": "properties.autoScalerProfile", + "type": "ManagedClusterPropertiesAutoScalerProfile", + }, + "api_server_access_profile": { + "key": "properties.apiServerAccessProfile", + "type": "ManagedClusterAPIServerAccessProfile", + }, + "disk_encryption_set_id": {"key": "properties.diskEncryptionSetID", "type": "str"}, + "identity_profile": {"key": "properties.identityProfile", "type": "{UserAssignedIdentity}"}, + "private_link_resources": {"key": "properties.privateLinkResources", "type": "[PrivateLinkResource]"}, + "disable_local_accounts": {"key": "properties.disableLocalAccounts", "type": "bool"}, + "http_proxy_config": {"key": "properties.httpProxyConfig", "type": "ManagedClusterHTTPProxyConfig"}, + "security_profile": {"key": "properties.securityProfile", "type": "ManagedClusterSecurityProfile"}, + "storage_profile": {"key": "properties.storageProfile", "type": "ManagedClusterStorageProfile"}, + "ingress_profile": {"key": "properties.ingressProfile", "type": "ManagedClusterIngressProfile"}, + "public_network_access": {"key": "properties.publicNetworkAccess", "type": "str"}, + "workload_auto_scaler_profile": { + "key": "properties.workloadAutoScalerProfile", + "type": "ManagedClusterWorkloadAutoScalerProfile", + }, + } + + def __init__( # pylint: disable=too-many-locals self, *, location: str, @@ -2294,9 +2232,9 @@ def __init__( **kwargs ): """ - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] - :keyword location: Required. The geo-location where the resource lives. + :keyword location: The geo-location where the resource lives. Required. :paramtype location: str :keyword sku: The managed cluster SKU. :paramtype sku: ~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedClusterSKU @@ -2398,7 +2336,7 @@ def __init__( :paramtype ingress_profile: ~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedClusterIngressProfile :keyword public_network_access: Allow or deny public network access for AKS. Known values are: - "Enabled", "Disabled". + "Enabled" and "Disabled". :paramtype public_network_access: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.PublicNetworkAccess :keyword workload_auto_scaler_profile: Workload Auto-scaler profile for the container service @@ -2406,7 +2344,7 @@ def __init__( :paramtype workload_auto_scaler_profile: ~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedClusterWorkloadAutoScalerProfile """ - super(ManagedCluster, self).__init__(tags=tags, location=location, **kwargs) + super().__init__(tags=tags, location=location, **kwargs) self.sku = sku self.extended_location = extended_location self.identity = identity @@ -2449,7 +2387,7 @@ def __init__( self.workload_auto_scaler_profile = workload_auto_scaler_profile -class ManagedClusterAADProfile(msrest.serialization.Model): +class ManagedClusterAADProfile(_serialization.Model): """For more details see `managed AAD on AKS `_. :ivar managed: Whether to enable managed AAD. @@ -2471,13 +2409,13 @@ class ManagedClusterAADProfile(msrest.serialization.Model): """ _attribute_map = { - 'managed': {'key': 'managed', 'type': 'bool'}, - 'enable_azure_rbac': {'key': 'enableAzureRBAC', 'type': 'bool'}, - 'admin_group_object_i_ds': {'key': 'adminGroupObjectIDs', 'type': '[str]'}, - 'client_app_id': {'key': 'clientAppID', 'type': 'str'}, - 'server_app_id': {'key': 'serverAppID', 'type': 'str'}, - 'server_app_secret': {'key': 'serverAppSecret', 'type': 'str'}, - 'tenant_id': {'key': 'tenantID', 'type': 'str'}, + "managed": {"key": "managed", "type": "bool"}, + "enable_azure_rbac": {"key": "enableAzureRBAC", "type": "bool"}, + "admin_group_object_i_ds": {"key": "adminGroupObjectIDs", "type": "[str]"}, + "client_app_id": {"key": "clientAppID", "type": "str"}, + "server_app_id": {"key": "serverAppID", "type": "str"}, + "server_app_secret": {"key": "serverAppSecret", "type": "str"}, + "tenant_id": {"key": "tenantID", "type": "str"}, } def __init__( @@ -2510,7 +2448,7 @@ def __init__( tenant of the deployment subscription. :paramtype tenant_id: str """ - super(ManagedClusterAADProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.managed = managed self.enable_azure_rbac = enable_azure_rbac self.admin_group_object_i_ds = admin_group_object_i_ds @@ -2538,60 +2476,55 @@ class ManagedClusterAccessProfile(TrackedResource): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.containerservice.v2022_05_02_preview.models.SystemData - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] - :ivar location: Required. The geo-location where the resource lives. + :ivar location: The geo-location where the resource lives. Required. :vartype location: str :ivar kube_config: Base64-encoded Kubernetes configuration file. - :vartype kube_config: bytearray + :vartype kube_config: bytes """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'location': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - 'kube_config': {'key': 'properties.kubeConfig', 'type': 'bytearray'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "kube_config": {"key": "properties.kubeConfig", "type": "bytearray"}, } def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - kube_config: Optional[bytearray] = None, - **kwargs + self, *, location: str, tags: Optional[Dict[str, str]] = None, kube_config: Optional[bytes] = None, **kwargs ): """ - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] - :keyword location: Required. The geo-location where the resource lives. + :keyword location: The geo-location where the resource lives. Required. :paramtype location: str :keyword kube_config: Base64-encoded Kubernetes configuration file. - :paramtype kube_config: bytearray + :paramtype kube_config: bytes """ - super(ManagedClusterAccessProfile, self).__init__(tags=tags, location=location, **kwargs) + super().__init__(tags=tags, location=location, **kwargs) self.kube_config = kube_config -class ManagedClusterAddonProfile(msrest.serialization.Model): +class ManagedClusterAddonProfile(_serialization.Model): """A Kubernetes add-on profile for a managed cluster. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar enabled: Required. Whether the add-on is enabled or not. + :ivar enabled: Whether the add-on is enabled or not. Required. :vartype enabled: bool :ivar config: Key-value pairs for configuring an add-on. :vartype config: dict[str, str] @@ -2601,36 +2534,30 @@ class ManagedClusterAddonProfile(msrest.serialization.Model): """ _validation = { - 'enabled': {'required': True}, - 'identity': {'readonly': True}, + "enabled": {"required": True}, + "identity": {"readonly": True}, } _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'config': {'key': 'config', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'ManagedClusterAddonProfileIdentity'}, + "enabled": {"key": "enabled", "type": "bool"}, + "config": {"key": "config", "type": "{str}"}, + "identity": {"key": "identity", "type": "ManagedClusterAddonProfileIdentity"}, } - def __init__( - self, - *, - enabled: bool, - config: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, enabled: bool, config: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword enabled: Required. Whether the add-on is enabled or not. + :keyword enabled: Whether the add-on is enabled or not. Required. :paramtype enabled: bool :keyword config: Key-value pairs for configuring an add-on. :paramtype config: dict[str, str] """ - super(ManagedClusterAddonProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.config = config self.identity = None -class UserAssignedIdentity(msrest.serialization.Model): +class UserAssignedIdentity(_serialization.Model): """Details about a user assigned identity. :ivar resource_id: The resource ID of the user assigned identity. @@ -2642,9 +2569,9 @@ class UserAssignedIdentity(msrest.serialization.Model): """ _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'object_id': {'key': 'objectId', 'type': 'str'}, + "resource_id": {"key": "resourceId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + "object_id": {"key": "objectId", "type": "str"}, } def __init__( @@ -2663,7 +2590,7 @@ def __init__( :keyword object_id: The object ID of the user assigned identity. :paramtype object_id: str """ - super(UserAssignedIdentity, self).__init__(**kwargs) + super().__init__(**kwargs) self.resource_id = resource_id self.client_id = client_id self.object_id = object_id @@ -2681,9 +2608,9 @@ class ManagedClusterAddonProfileIdentity(UserAssignedIdentity): """ _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'object_id': {'key': 'objectId', 'type': 'str'}, + "resource_id": {"key": "resourceId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + "object_id": {"key": "objectId", "type": "str"}, } def __init__( @@ -2702,10 +2629,10 @@ def __init__( :keyword object_id: The object ID of the user assigned identity. :paramtype object_id: str """ - super(ManagedClusterAddonProfileIdentity, self).__init__(resource_id=resource_id, client_id=client_id, object_id=object_id, **kwargs) + super().__init__(resource_id=resource_id, client_id=client_id, object_id=object_id, **kwargs) -class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): +class ManagedClusterAgentPoolProfileProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes """Properties for the container service agent pool profile. Variables are only populated by the server, and will be ignored when sending a request. @@ -2726,15 +2653,15 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.OSDiskType :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data - root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.KubeletDiskType :ivar workload_runtime: Determines the type of workload a node can run. Known values are: - "OCIContainer", "WasmWasi". + "OCIContainer" and "WasmWasi". :vartype workload_runtime: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.WorkloadRuntime :ivar message_of_the_day: A base64-encoded string which will be written to /etc/motd after @@ -2753,13 +2680,13 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :vartype pod_subnet_id: str :ivar max_pods: The maximum number of pods that can run on a node. :vartype max_pods: int - :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.OSType :ivar os_sku: Specifies the OS SKU used by the agent pool. If not specified, the default is Ubuntu if OSType=Linux or Windows2019 if OSType=Windows. And the default Windows OSSKU will be changed to Windows2022 after Windows2019 is deprecated. Known values are: "Ubuntu", - "CBLMariner", "Windows2019", "Windows2022". + "CBLMariner", "Windows2019", and "Windows2022". :vartype os_sku: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.OSSKU :ivar max_count: The maximum number of nodes for auto-scaling. :vartype max_count: int @@ -2768,15 +2695,15 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it - defaults to Delete. Known values are: "Delete", "Deallocate". + defaults to Delete. Known values are: "Delete" and "Deallocate". :vartype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.ScaleDownMode - :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", + :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets" and "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.AgentPoolType :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :vartype mode: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.AgentPoolMode :ivar orchestrator_version: Both patch version and are supported. When is specified, the latest supported patch version is chosen @@ -2822,20 +2749,18 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default - is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + is 'Regular'. Known values are: "Spot" and "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.ScaleSetPriority :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.ScaleSetEvictionPolicy :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :vartype spot_max_price: float - :ivar tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :ivar tags: The tags to be persisted on the agent pool virtual machine scale set. :vartype tags: dict[str, str] :ivar node_labels: The node labels to be persisted across all nodes in agent pool. :vartype node_labels: dict[str, str] @@ -2859,7 +2784,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): for more details. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.GPUInstanceProfile :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the node pool @@ -2876,60 +2801,60 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): """ _validation = { - 'os_disk_size_gb': {'maximum': 2048, 'minimum': 0}, - 'current_orchestrator_version': {'readonly': True}, - 'node_image_version': {'readonly': True}, - 'provisioning_state': {'readonly': True}, + "os_disk_size_gb": {"maximum": 2048, "minimum": 0}, + "current_orchestrator_version": {"readonly": True}, + "node_image_version": {"readonly": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'os_disk_type': {'key': 'osDiskType', 'type': 'str'}, - 'kubelet_disk_type': {'key': 'kubeletDiskType', 'type': 'str'}, - 'workload_runtime': {'key': 'workloadRuntime', 'type': 'str'}, - 'message_of_the_day': {'key': 'messageOfTheDay', 'type': 'str'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'pod_subnet_id': {'key': 'podSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'maxPods', 'type': 'int'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'os_sku': {'key': 'osSKU', 'type': 'str'}, - 'max_count': {'key': 'maxCount', 'type': 'int'}, - 'min_count': {'key': 'minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'enableAutoScaling', 'type': 'bool'}, - 'scale_down_mode': {'key': 'scaleDownMode', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'mode': {'key': 'mode', 'type': 'str'}, - 'orchestrator_version': {'key': 'orchestratorVersion', 'type': 'str'}, - 'current_orchestrator_version': {'key': 'currentOrchestratorVersion', 'type': 'str'}, - 'node_image_version': {'key': 'nodeImageVersion', 'type': 'str'}, - 'upgrade_settings': {'key': 'upgradeSettings', 'type': 'AgentPoolUpgradeSettings'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'power_state': {'key': 'powerState', 'type': 'PowerState'}, - 'availability_zones': {'key': 'availabilityZones', 'type': '[str]'}, - 'enable_node_public_ip': {'key': 'enableNodePublicIP', 'type': 'bool'}, - 'enable_custom_ca_trust': {'key': 'enableCustomCATrust', 'type': 'bool'}, - 'node_public_ip_prefix_id': {'key': 'nodePublicIPPrefixID', 'type': 'str'}, - 'scale_set_priority': {'key': 'scaleSetPriority', 'type': 'str'}, - 'scale_set_eviction_policy': {'key': 'scaleSetEvictionPolicy', 'type': 'str'}, - 'spot_max_price': {'key': 'spotMaxPrice', 'type': 'float'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'node_labels': {'key': 'nodeLabels', 'type': '{str}'}, - 'node_taints': {'key': 'nodeTaints', 'type': '[str]'}, - 'proximity_placement_group_id': {'key': 'proximityPlacementGroupID', 'type': 'str'}, - 'kubelet_config': {'key': 'kubeletConfig', 'type': 'KubeletConfig'}, - 'linux_os_config': {'key': 'linuxOSConfig', 'type': 'LinuxOSConfig'}, - 'enable_encryption_at_host': {'key': 'enableEncryptionAtHost', 'type': 'bool'}, - 'enable_ultra_ssd': {'key': 'enableUltraSSD', 'type': 'bool'}, - 'enable_fips': {'key': 'enableFIPS', 'type': 'bool'}, - 'gpu_instance_profile': {'key': 'gpuInstanceProfile', 'type': 'str'}, - 'creation_data': {'key': 'creationData', 'type': 'CreationData'}, - 'capacity_reservation_group_id': {'key': 'capacityReservationGroupID', 'type': 'str'}, - 'host_group_id': {'key': 'hostGroupID', 'type': 'str'}, - } - - def __init__( + "count": {"key": "count", "type": "int"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "os_disk_type": {"key": "osDiskType", "type": "str"}, + "kubelet_disk_type": {"key": "kubeletDiskType", "type": "str"}, + "workload_runtime": {"key": "workloadRuntime", "type": "str"}, + "message_of_the_day": {"key": "messageOfTheDay", "type": "str"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "pod_subnet_id": {"key": "podSubnetID", "type": "str"}, + "max_pods": {"key": "maxPods", "type": "int"}, + "os_type": {"key": "osType", "type": "str"}, + "os_sku": {"key": "osSKU", "type": "str"}, + "max_count": {"key": "maxCount", "type": "int"}, + "min_count": {"key": "minCount", "type": "int"}, + "enable_auto_scaling": {"key": "enableAutoScaling", "type": "bool"}, + "scale_down_mode": {"key": "scaleDownMode", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "mode": {"key": "mode", "type": "str"}, + "orchestrator_version": {"key": "orchestratorVersion", "type": "str"}, + "current_orchestrator_version": {"key": "currentOrchestratorVersion", "type": "str"}, + "node_image_version": {"key": "nodeImageVersion", "type": "str"}, + "upgrade_settings": {"key": "upgradeSettings", "type": "AgentPoolUpgradeSettings"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "power_state": {"key": "powerState", "type": "PowerState"}, + "availability_zones": {"key": "availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "enableNodePublicIP", "type": "bool"}, + "enable_custom_ca_trust": {"key": "enableCustomCATrust", "type": "bool"}, + "node_public_ip_prefix_id": {"key": "nodePublicIPPrefixID", "type": "str"}, + "scale_set_priority": {"key": "scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "scaleSetEvictionPolicy", "type": "str"}, + "spot_max_price": {"key": "spotMaxPrice", "type": "float"}, + "tags": {"key": "tags", "type": "{str}"}, + "node_labels": {"key": "nodeLabels", "type": "{str}"}, + "node_taints": {"key": "nodeTaints", "type": "[str]"}, + "proximity_placement_group_id": {"key": "proximityPlacementGroupID", "type": "str"}, + "kubelet_config": {"key": "kubeletConfig", "type": "KubeletConfig"}, + "linux_os_config": {"key": "linuxOSConfig", "type": "LinuxOSConfig"}, + "enable_encryption_at_host": {"key": "enableEncryptionAtHost", "type": "bool"}, + "enable_ultra_ssd": {"key": "enableUltraSSD", "type": "bool"}, + "enable_fips": {"key": "enableFIPS", "type": "bool"}, + "gpu_instance_profile": {"key": "gpuInstanceProfile", "type": "str"}, + "creation_data": {"key": "creationData", "type": "CreationData"}, + "capacity_reservation_group_id": {"key": "capacityReservationGroupID", "type": "str"}, + "host_group_id": {"key": "hostGroupID", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, count: Optional[int] = None, @@ -2942,7 +2867,7 @@ def __init__( vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, @@ -2957,9 +2882,9 @@ def __init__( enable_node_public_ip: Optional[bool] = None, enable_custom_ca_trust: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", - spot_max_price: Optional[float] = -1, + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", + spot_max_price: float = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, @@ -2992,15 +2917,15 @@ def __init__( larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.OSDiskType :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime - data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + data root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.KubeletDiskType :keyword workload_runtime: Determines the type of workload a node can run. Known values are: - "OCIContainer", "WasmWasi". + "OCIContainer" and "WasmWasi". :paramtype workload_runtime: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.WorkloadRuntime :keyword message_of_the_day: A base64-encoded string which will be written to /etc/motd after @@ -3019,13 +2944,13 @@ def __init__( :paramtype pod_subnet_id: str :keyword max_pods: The maximum number of pods that can run on a node. :paramtype max_pods: int - :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.OSType :keyword os_sku: Specifies the OS SKU used by the agent pool. If not specified, the default is Ubuntu if OSType=Linux or Windows2019 if OSType=Windows. And the default Windows OSSKU will be changed to Windows2022 after Windows2019 is deprecated. Known values are: "Ubuntu", - "CBLMariner", "Windows2019", "Windows2022". + "CBLMariner", "Windows2019", and "Windows2022". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.OSSKU :keyword max_count: The maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -3034,15 +2959,15 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, - it defaults to Delete. Known values are: "Delete", "Deallocate". + it defaults to Delete. Known values are: "Delete" and "Deallocate". :paramtype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.ScaleDownMode - :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", + :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.AgentPoolType :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.AgentPoolMode :keyword orchestrator_version: Both patch version and are supported. When is specified, the latest supported patch version is chosen @@ -3080,20 +3005,18 @@ def __init__( /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the - default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + default is 'Regular'. Known values are: "Spot" and "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.ScaleSetPriority :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.ScaleSetEvictionPolicy :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :paramtype spot_max_price: float - :keyword tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :keyword tags: The tags to be persisted on the agent pool virtual machine scale set. :paramtype tags: dict[str, str] :keyword node_labels: The node labels to be persisted across all nodes in agent pool. :paramtype node_labels: dict[str, str] @@ -3119,7 +3042,7 @@ def __init__( for more details. :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance - profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.GPUInstanceProfile @@ -3135,7 +3058,7 @@ def __init__( `_. :paramtype host_group_id: str """ - super(ManagedClusterAgentPoolProfileProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.vm_size = vm_size self.os_disk_size_gb = os_disk_size_gb @@ -3182,7 +3105,9 @@ def __init__( self.host_group_id = host_group_id -class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): +class ManagedClusterAgentPoolProfile( + ManagedClusterAgentPoolProfileProperties +): # pylint: disable=too-many-instance-attributes """Profile for the container service agent pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -3205,15 +3130,15 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.OSDiskType :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data - root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.KubeletDiskType :ivar workload_runtime: Determines the type of workload a node can run. Known values are: - "OCIContainer", "WasmWasi". + "OCIContainer" and "WasmWasi". :vartype workload_runtime: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.WorkloadRuntime :ivar message_of_the_day: A base64-encoded string which will be written to /etc/motd after @@ -3232,13 +3157,13 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :vartype pod_subnet_id: str :ivar max_pods: The maximum number of pods that can run on a node. :vartype max_pods: int - :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.OSType :ivar os_sku: Specifies the OS SKU used by the agent pool. If not specified, the default is Ubuntu if OSType=Linux or Windows2019 if OSType=Windows. And the default Windows OSSKU will be changed to Windows2022 after Windows2019 is deprecated. Known values are: "Ubuntu", - "CBLMariner", "Windows2019", "Windows2022". + "CBLMariner", "Windows2019", and "Windows2022". :vartype os_sku: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.OSSKU :ivar max_count: The maximum number of nodes for auto-scaling. :vartype max_count: int @@ -3247,15 +3172,15 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it - defaults to Delete. Known values are: "Delete", "Deallocate". + defaults to Delete. Known values are: "Delete" and "Deallocate". :vartype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.ScaleDownMode - :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", + :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets" and "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.AgentPoolType :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :vartype mode: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.AgentPoolMode :ivar orchestrator_version: Both patch version and are supported. When is specified, the latest supported patch version is chosen @@ -3301,20 +3226,18 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default - is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + is 'Regular'. Known values are: "Spot" and "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.ScaleSetPriority :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.ScaleSetEvictionPolicy :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :vartype spot_max_price: float - :ivar tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :ivar tags: The tags to be persisted on the agent pool virtual machine scale set. :vartype tags: dict[str, str] :ivar node_labels: The node labels to be persisted across all nodes in agent pool. :vartype node_labels: dict[str, str] @@ -3338,7 +3261,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): for more details. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.GPUInstanceProfile :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the node pool @@ -3352,67 +3275,67 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): For more information see `Azure dedicated hosts `_. :vartype host_group_id: str - :ivar name: Required. Windows agent pool names must be 6 characters or less. + :ivar name: Windows agent pool names must be 6 characters or less. Required. :vartype name: str """ _validation = { - 'os_disk_size_gb': {'maximum': 2048, 'minimum': 0}, - 'current_orchestrator_version': {'readonly': True}, - 'node_image_version': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'name': {'required': True, 'pattern': r'^[a-z][a-z0-9]{0,11}$'}, + "os_disk_size_gb": {"maximum": 2048, "minimum": 0}, + "current_orchestrator_version": {"readonly": True}, + "node_image_version": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "name": {"required": True, "pattern": r"^[a-z][a-z0-9]{0,11}$"}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'os_disk_type': {'key': 'osDiskType', 'type': 'str'}, - 'kubelet_disk_type': {'key': 'kubeletDiskType', 'type': 'str'}, - 'workload_runtime': {'key': 'workloadRuntime', 'type': 'str'}, - 'message_of_the_day': {'key': 'messageOfTheDay', 'type': 'str'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'pod_subnet_id': {'key': 'podSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'maxPods', 'type': 'int'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'os_sku': {'key': 'osSKU', 'type': 'str'}, - 'max_count': {'key': 'maxCount', 'type': 'int'}, - 'min_count': {'key': 'minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'enableAutoScaling', 'type': 'bool'}, - 'scale_down_mode': {'key': 'scaleDownMode', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'mode': {'key': 'mode', 'type': 'str'}, - 'orchestrator_version': {'key': 'orchestratorVersion', 'type': 'str'}, - 'current_orchestrator_version': {'key': 'currentOrchestratorVersion', 'type': 'str'}, - 'node_image_version': {'key': 'nodeImageVersion', 'type': 'str'}, - 'upgrade_settings': {'key': 'upgradeSettings', 'type': 'AgentPoolUpgradeSettings'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'power_state': {'key': 'powerState', 'type': 'PowerState'}, - 'availability_zones': {'key': 'availabilityZones', 'type': '[str]'}, - 'enable_node_public_ip': {'key': 'enableNodePublicIP', 'type': 'bool'}, - 'enable_custom_ca_trust': {'key': 'enableCustomCATrust', 'type': 'bool'}, - 'node_public_ip_prefix_id': {'key': 'nodePublicIPPrefixID', 'type': 'str'}, - 'scale_set_priority': {'key': 'scaleSetPriority', 'type': 'str'}, - 'scale_set_eviction_policy': {'key': 'scaleSetEvictionPolicy', 'type': 'str'}, - 'spot_max_price': {'key': 'spotMaxPrice', 'type': 'float'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'node_labels': {'key': 'nodeLabels', 'type': '{str}'}, - 'node_taints': {'key': 'nodeTaints', 'type': '[str]'}, - 'proximity_placement_group_id': {'key': 'proximityPlacementGroupID', 'type': 'str'}, - 'kubelet_config': {'key': 'kubeletConfig', 'type': 'KubeletConfig'}, - 'linux_os_config': {'key': 'linuxOSConfig', 'type': 'LinuxOSConfig'}, - 'enable_encryption_at_host': {'key': 'enableEncryptionAtHost', 'type': 'bool'}, - 'enable_ultra_ssd': {'key': 'enableUltraSSD', 'type': 'bool'}, - 'enable_fips': {'key': 'enableFIPS', 'type': 'bool'}, - 'gpu_instance_profile': {'key': 'gpuInstanceProfile', 'type': 'str'}, - 'creation_data': {'key': 'creationData', 'type': 'CreationData'}, - 'capacity_reservation_group_id': {'key': 'capacityReservationGroupID', 'type': 'str'}, - 'host_group_id': {'key': 'hostGroupID', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( + "count": {"key": "count", "type": "int"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "os_disk_type": {"key": "osDiskType", "type": "str"}, + "kubelet_disk_type": {"key": "kubeletDiskType", "type": "str"}, + "workload_runtime": {"key": "workloadRuntime", "type": "str"}, + "message_of_the_day": {"key": "messageOfTheDay", "type": "str"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "pod_subnet_id": {"key": "podSubnetID", "type": "str"}, + "max_pods": {"key": "maxPods", "type": "int"}, + "os_type": {"key": "osType", "type": "str"}, + "os_sku": {"key": "osSKU", "type": "str"}, + "max_count": {"key": "maxCount", "type": "int"}, + "min_count": {"key": "minCount", "type": "int"}, + "enable_auto_scaling": {"key": "enableAutoScaling", "type": "bool"}, + "scale_down_mode": {"key": "scaleDownMode", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "mode": {"key": "mode", "type": "str"}, + "orchestrator_version": {"key": "orchestratorVersion", "type": "str"}, + "current_orchestrator_version": {"key": "currentOrchestratorVersion", "type": "str"}, + "node_image_version": {"key": "nodeImageVersion", "type": "str"}, + "upgrade_settings": {"key": "upgradeSettings", "type": "AgentPoolUpgradeSettings"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "power_state": {"key": "powerState", "type": "PowerState"}, + "availability_zones": {"key": "availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "enableNodePublicIP", "type": "bool"}, + "enable_custom_ca_trust": {"key": "enableCustomCATrust", "type": "bool"}, + "node_public_ip_prefix_id": {"key": "nodePublicIPPrefixID", "type": "str"}, + "scale_set_priority": {"key": "scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "scaleSetEvictionPolicy", "type": "str"}, + "spot_max_price": {"key": "spotMaxPrice", "type": "float"}, + "tags": {"key": "tags", "type": "{str}"}, + "node_labels": {"key": "nodeLabels", "type": "{str}"}, + "node_taints": {"key": "nodeTaints", "type": "[str]"}, + "proximity_placement_group_id": {"key": "proximityPlacementGroupID", "type": "str"}, + "kubelet_config": {"key": "kubeletConfig", "type": "KubeletConfig"}, + "linux_os_config": {"key": "linuxOSConfig", "type": "LinuxOSConfig"}, + "enable_encryption_at_host": {"key": "enableEncryptionAtHost", "type": "bool"}, + "enable_ultra_ssd": {"key": "enableUltraSSD", "type": "bool"}, + "enable_fips": {"key": "enableFIPS", "type": "bool"}, + "gpu_instance_profile": {"key": "gpuInstanceProfile", "type": "str"}, + "creation_data": {"key": "creationData", "type": "CreationData"}, + "capacity_reservation_group_id": {"key": "capacityReservationGroupID", "type": "str"}, + "host_group_id": {"key": "hostGroupID", "type": "str"}, + "name": {"key": "name", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, name: str, @@ -3426,7 +3349,7 @@ def __init__( vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, @@ -3441,9 +3364,9 @@ def __init__( enable_node_public_ip: Optional[bool] = None, enable_custom_ca_trust: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", - spot_max_price: Optional[float] = -1, + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", + spot_max_price: float = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, @@ -3476,15 +3399,15 @@ def __init__( larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.OSDiskType :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime - data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + data root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.KubeletDiskType :keyword workload_runtime: Determines the type of workload a node can run. Known values are: - "OCIContainer", "WasmWasi". + "OCIContainer" and "WasmWasi". :paramtype workload_runtime: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.WorkloadRuntime :keyword message_of_the_day: A base64-encoded string which will be written to /etc/motd after @@ -3503,13 +3426,13 @@ def __init__( :paramtype pod_subnet_id: str :keyword max_pods: The maximum number of pods that can run on a node. :paramtype max_pods: int - :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.OSType :keyword os_sku: Specifies the OS SKU used by the agent pool. If not specified, the default is Ubuntu if OSType=Linux or Windows2019 if OSType=Windows. And the default Windows OSSKU will be changed to Windows2022 after Windows2019 is deprecated. Known values are: "Ubuntu", - "CBLMariner", "Windows2019", "Windows2022". + "CBLMariner", "Windows2019", and "Windows2022". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.OSSKU :keyword max_count: The maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -3518,15 +3441,15 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, - it defaults to Delete. Known values are: "Delete", "Deallocate". + it defaults to Delete. Known values are: "Delete" and "Deallocate". :paramtype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.ScaleDownMode - :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", + :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.AgentPoolType :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.AgentPoolMode :keyword orchestrator_version: Both patch version and are supported. When is specified, the latest supported patch version is chosen @@ -3564,20 +3487,18 @@ def __init__( /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the - default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + default is 'Regular'. Known values are: "Spot" and "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.ScaleSetPriority :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.ScaleSetEvictionPolicy :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :paramtype spot_max_price: float - :keyword tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :keyword tags: The tags to be persisted on the agent pool virtual machine scale set. :paramtype tags: dict[str, str] :keyword node_labels: The node labels to be persisted across all nodes in agent pool. :paramtype node_labels: dict[str, str] @@ -3603,7 +3524,7 @@ def __init__( for more details. :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance - profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.GPUInstanceProfile @@ -3618,14 +3539,57 @@ def __init__( For more information see `Azure dedicated hosts `_. :paramtype host_group_id: str - :keyword name: Required. Windows agent pool names must be 6 characters or less. + :keyword name: Windows agent pool names must be 6 characters or less. Required. :paramtype name: str """ - super(ManagedClusterAgentPoolProfile, self).__init__(count=count, vm_size=vm_size, os_disk_size_gb=os_disk_size_gb, os_disk_type=os_disk_type, kubelet_disk_type=kubelet_disk_type, workload_runtime=workload_runtime, message_of_the_day=message_of_the_day, vnet_subnet_id=vnet_subnet_id, pod_subnet_id=pod_subnet_id, max_pods=max_pods, os_type=os_type, os_sku=os_sku, max_count=max_count, min_count=min_count, enable_auto_scaling=enable_auto_scaling, scale_down_mode=scale_down_mode, type=type, mode=mode, orchestrator_version=orchestrator_version, upgrade_settings=upgrade_settings, power_state=power_state, availability_zones=availability_zones, enable_node_public_ip=enable_node_public_ip, enable_custom_ca_trust=enable_custom_ca_trust, node_public_ip_prefix_id=node_public_ip_prefix_id, scale_set_priority=scale_set_priority, scale_set_eviction_policy=scale_set_eviction_policy, spot_max_price=spot_max_price, tags=tags, node_labels=node_labels, node_taints=node_taints, proximity_placement_group_id=proximity_placement_group_id, kubelet_config=kubelet_config, linux_os_config=linux_os_config, enable_encryption_at_host=enable_encryption_at_host, enable_ultra_ssd=enable_ultra_ssd, enable_fips=enable_fips, gpu_instance_profile=gpu_instance_profile, creation_data=creation_data, capacity_reservation_group_id=capacity_reservation_group_id, host_group_id=host_group_id, **kwargs) + super().__init__( + count=count, + vm_size=vm_size, + os_disk_size_gb=os_disk_size_gb, + os_disk_type=os_disk_type, + kubelet_disk_type=kubelet_disk_type, + workload_runtime=workload_runtime, + message_of_the_day=message_of_the_day, + vnet_subnet_id=vnet_subnet_id, + pod_subnet_id=pod_subnet_id, + max_pods=max_pods, + os_type=os_type, + os_sku=os_sku, + max_count=max_count, + min_count=min_count, + enable_auto_scaling=enable_auto_scaling, + scale_down_mode=scale_down_mode, + type=type, + mode=mode, + orchestrator_version=orchestrator_version, + upgrade_settings=upgrade_settings, + power_state=power_state, + availability_zones=availability_zones, + enable_node_public_ip=enable_node_public_ip, + enable_custom_ca_trust=enable_custom_ca_trust, + node_public_ip_prefix_id=node_public_ip_prefix_id, + scale_set_priority=scale_set_priority, + scale_set_eviction_policy=scale_set_eviction_policy, + spot_max_price=spot_max_price, + tags=tags, + node_labels=node_labels, + node_taints=node_taints, + proximity_placement_group_id=proximity_placement_group_id, + kubelet_config=kubelet_config, + linux_os_config=linux_os_config, + enable_encryption_at_host=enable_encryption_at_host, + enable_ultra_ssd=enable_ultra_ssd, + enable_fips=enable_fips, + gpu_instance_profile=gpu_instance_profile, + creation_data=creation_data, + capacity_reservation_group_id=capacity_reservation_group_id, + host_group_id=host_group_id, + **kwargs + ) self.name = name -class ManagedClusterAPIServerAccessProfile(msrest.serialization.Model): +class ManagedClusterAPIServerAccessProfile(_serialization.Model): """Access profile for managed cluster API server. :ivar authorized_ip_ranges: IP ranges are specified in CIDR format, e.g. 137.117.106.88/29. @@ -3654,13 +3618,13 @@ class ManagedClusterAPIServerAccessProfile(msrest.serialization.Model): """ _attribute_map = { - 'authorized_ip_ranges': {'key': 'authorizedIPRanges', 'type': '[str]'}, - 'enable_private_cluster': {'key': 'enablePrivateCluster', 'type': 'bool'}, - 'private_dns_zone': {'key': 'privateDNSZone', 'type': 'str'}, - 'enable_private_cluster_public_fqdn': {'key': 'enablePrivateClusterPublicFQDN', 'type': 'bool'}, - 'disable_run_command': {'key': 'disableRunCommand', 'type': 'bool'}, - 'enable_vnet_integration': {'key': 'enableVnetIntegration', 'type': 'bool'}, - 'subnet_id': {'key': 'subnetId', 'type': 'str'}, + "authorized_ip_ranges": {"key": "authorizedIPRanges", "type": "[str]"}, + "enable_private_cluster": {"key": "enablePrivateCluster", "type": "bool"}, + "private_dns_zone": {"key": "privateDNSZone", "type": "str"}, + "enable_private_cluster_public_fqdn": {"key": "enablePrivateClusterPublicFQDN", "type": "bool"}, + "disable_run_command": {"key": "disableRunCommand", "type": "bool"}, + "enable_vnet_integration": {"key": "enableVnetIntegration", "type": "bool"}, + "subnet_id": {"key": "subnetId", "type": "str"}, } def __init__( @@ -3700,7 +3664,7 @@ def __init__( an existing cluster to enable apiserver vnet integration. :paramtype subnet_id: str """ - super(ManagedClusterAPIServerAccessProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.authorized_ip_ranges = authorized_ip_ranges self.enable_private_cluster = enable_private_cluster self.private_dns_zone = private_dns_zone @@ -3710,38 +3674,33 @@ def __init__( self.subnet_id = subnet_id -class ManagedClusterAutoUpgradeProfile(msrest.serialization.Model): +class ManagedClusterAutoUpgradeProfile(_serialization.Model): """Auto upgrade profile for a managed cluster. :ivar upgrade_channel: For more information see `setting the AKS cluster auto-upgrade channel `_. Known values - are: "rapid", "stable", "patch", "node-image", "none". + are: "rapid", "stable", "patch", "node-image", and "none". :vartype upgrade_channel: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.UpgradeChannel """ _attribute_map = { - 'upgrade_channel': {'key': 'upgradeChannel', 'type': 'str'}, + "upgrade_channel": {"key": "upgradeChannel", "type": "str"}, } - def __init__( - self, - *, - upgrade_channel: Optional[Union[str, "_models.UpgradeChannel"]] = None, - **kwargs - ): + def __init__(self, *, upgrade_channel: Optional[Union[str, "_models.UpgradeChannel"]] = None, **kwargs): """ :keyword upgrade_channel: For more information see `setting the AKS cluster auto-upgrade channel `_. - Known values are: "rapid", "stable", "patch", "node-image", "none". + Known values are: "rapid", "stable", "patch", "node-image", and "none". :paramtype upgrade_channel: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.UpgradeChannel """ - super(ManagedClusterAutoUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.upgrade_channel = upgrade_channel -class ManagedClusterHTTPProxyConfig(msrest.serialization.Model): +class ManagedClusterHTTPProxyConfig(_serialization.Model): """Cluster HTTP proxy configuration. Variables are only populated by the server, and will be ignored when sending a request. @@ -3760,15 +3719,15 @@ class ManagedClusterHTTPProxyConfig(msrest.serialization.Model): """ _validation = { - 'effective_no_proxy': {'readonly': True}, + "effective_no_proxy": {"readonly": True}, } _attribute_map = { - 'http_proxy': {'key': 'httpProxy', 'type': 'str'}, - 'https_proxy': {'key': 'httpsProxy', 'type': 'str'}, - 'no_proxy': {'key': 'noProxy', 'type': '[str]'}, - 'effective_no_proxy': {'key': 'effectiveNoProxy', 'type': '[str]'}, - 'trusted_ca': {'key': 'trustedCa', 'type': 'str'}, + "http_proxy": {"key": "httpProxy", "type": "str"}, + "https_proxy": {"key": "httpsProxy", "type": "str"}, + "no_proxy": {"key": "noProxy", "type": "[str]"}, + "effective_no_proxy": {"key": "effectiveNoProxy", "type": "[str]"}, + "trusted_ca": {"key": "trustedCa", "type": "str"}, } def __init__( @@ -3790,7 +3749,7 @@ def __init__( :keyword trusted_ca: Alternative CA cert to use for connecting to proxy servers. :paramtype trusted_ca: str """ - super(ManagedClusterHTTPProxyConfig, self).__init__(**kwargs) + super().__init__(**kwargs) self.http_proxy = http_proxy self.https_proxy = https_proxy self.no_proxy = no_proxy @@ -3798,7 +3757,7 @@ def __init__( self.trusted_ca = trusted_ca -class ManagedClusterIdentity(msrest.serialization.Model): +class ManagedClusterIdentity(_serialization.Model): """Identity for the managed cluster. Variables are only populated by the server, and will be ignored when sending a request. @@ -3811,7 +3770,7 @@ class ManagedClusterIdentity(msrest.serialization.Model): :vartype tenant_id: str :ivar type: For more information see `use managed identities in AKS `_. Known values are: - "SystemAssigned", "UserAssigned", "None". + "SystemAssigned", "UserAssigned", and "None". :vartype type: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.ResourceIdentityType :ivar user_assigned_identities: The keys must be ARM resource IDs in the form: @@ -3821,28 +3780,33 @@ class ManagedClusterIdentity(msrest.serialization.Model): """ _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, + "principal_id": {"readonly": True}, + "tenant_id": {"readonly": True}, } _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{ManagedServiceIdentityUserAssignedIdentitiesValue}'}, + "principal_id": {"key": "principalId", "type": "str"}, + "tenant_id": {"key": "tenantId", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "user_assigned_identities": { + "key": "userAssignedIdentities", + "type": "{ManagedServiceIdentityUserAssignedIdentitiesValue}", + }, } def __init__( self, *, type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, - user_assigned_identities: Optional[Dict[str, "_models.ManagedServiceIdentityUserAssignedIdentitiesValue"]] = None, + user_assigned_identities: Optional[ + Dict[str, "_models.ManagedServiceIdentityUserAssignedIdentitiesValue"] + ] = None, **kwargs ): """ :keyword type: For more information see `use managed identities in AKS `_. Known values are: - "SystemAssigned", "UserAssigned", "None". + "SystemAssigned", "UserAssigned", and "None". :paramtype type: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.ResourceIdentityType :keyword user_assigned_identities: The keys must be ARM resource IDs in the form: @@ -3850,14 +3814,14 @@ def __init__( :paramtype user_assigned_identities: dict[str, ~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedServiceIdentityUserAssignedIdentitiesValue] """ - super(ManagedClusterIdentity, self).__init__(**kwargs) + super().__init__(**kwargs) self.principal_id = None self.tenant_id = None self.type = type self.user_assigned_identities = user_assigned_identities -class ManagedClusterIngressProfile(msrest.serialization.Model): +class ManagedClusterIngressProfile(_serialization.Model): """Ingress profile for the container service cluster. :ivar web_app_routing: Web App Routing settings for the ingress profile. @@ -3866,25 +3830,22 @@ class ManagedClusterIngressProfile(msrest.serialization.Model): """ _attribute_map = { - 'web_app_routing': {'key': 'webAppRouting', 'type': 'ManagedClusterIngressProfileWebAppRouting'}, + "web_app_routing": {"key": "webAppRouting", "type": "ManagedClusterIngressProfileWebAppRouting"}, } def __init__( - self, - *, - web_app_routing: Optional["_models.ManagedClusterIngressProfileWebAppRouting"] = None, - **kwargs + self, *, web_app_routing: Optional["_models.ManagedClusterIngressProfileWebAppRouting"] = None, **kwargs ): """ :keyword web_app_routing: Web App Routing settings for the ingress profile. :paramtype web_app_routing: ~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedClusterIngressProfileWebAppRouting """ - super(ManagedClusterIngressProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.web_app_routing = web_app_routing -class ManagedClusterIngressProfileWebAppRouting(msrest.serialization.Model): +class ManagedClusterIngressProfileWebAppRouting(_serialization.Model): """Web App Routing settings for the ingress profile. :ivar enabled: Whether to enable Web App Routing. @@ -3895,17 +3856,11 @@ class ManagedClusterIngressProfileWebAppRouting(msrest.serialization.Model): """ _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'dns_zone_resource_id': {'key': 'dnsZoneResourceId', 'type': 'str'}, + "enabled": {"key": "enabled", "type": "bool"}, + "dns_zone_resource_id": {"key": "dnsZoneResourceId", "type": "str"}, } - def __init__( - self, - *, - enabled: Optional[bool] = None, - dns_zone_resource_id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, enabled: Optional[bool] = None, dns_zone_resource_id: Optional[str] = None, **kwargs): """ :keyword enabled: Whether to enable Web App Routing. :paramtype enabled: bool @@ -3913,12 +3868,12 @@ def __init__( Used only when Web App Routing is enabled. :paramtype dns_zone_resource_id: str """ - super(ManagedClusterIngressProfileWebAppRouting, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.dns_zone_resource_id = dns_zone_resource_id -class ManagedClusterListResult(msrest.serialization.Model): +class ManagedClusterListResult(_serialization.Model): """The response from the List Managed Clusters operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -3930,30 +3885,25 @@ class ManagedClusterListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[ManagedCluster]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[ManagedCluster]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.ManagedCluster"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.ManagedCluster"]] = None, **kwargs): """ :keyword value: The list of managed clusters. :paramtype value: list[~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedCluster] """ - super(ManagedClusterListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class ManagedClusterLoadBalancerProfile(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfile(_serialization.Model): """Profile of the managed cluster load balancer. :ivar managed_outbound_i_ps: Desired managed outbound IPs for the cluster load balancer. @@ -3982,18 +3932,24 @@ class ManagedClusterLoadBalancerProfile(msrest.serialization.Model): """ _validation = { - 'allocated_outbound_ports': {'maximum': 64000, 'minimum': 0}, - 'idle_timeout_in_minutes': {'maximum': 120, 'minimum': 4}, + "allocated_outbound_ports": {"maximum": 64000, "minimum": 0}, + "idle_timeout_in_minutes": {"maximum": 120, "minimum": 4}, } _attribute_map = { - 'managed_outbound_i_ps': {'key': 'managedOutboundIPs', 'type': 'ManagedClusterLoadBalancerProfileManagedOutboundIPs'}, - 'outbound_ip_prefixes': {'key': 'outboundIPPrefixes', 'type': 'ManagedClusterLoadBalancerProfileOutboundIPPrefixes'}, - 'outbound_i_ps': {'key': 'outboundIPs', 'type': 'ManagedClusterLoadBalancerProfileOutboundIPs'}, - 'effective_outbound_i_ps': {'key': 'effectiveOutboundIPs', 'type': '[ResourceReference]'}, - 'allocated_outbound_ports': {'key': 'allocatedOutboundPorts', 'type': 'int'}, - 'idle_timeout_in_minutes': {'key': 'idleTimeoutInMinutes', 'type': 'int'}, - 'enable_multiple_standard_load_balancers': {'key': 'enableMultipleStandardLoadBalancers', 'type': 'bool'}, + "managed_outbound_i_ps": { + "key": "managedOutboundIPs", + "type": "ManagedClusterLoadBalancerProfileManagedOutboundIPs", + }, + "outbound_ip_prefixes": { + "key": "outboundIPPrefixes", + "type": "ManagedClusterLoadBalancerProfileOutboundIPPrefixes", + }, + "outbound_i_ps": {"key": "outboundIPs", "type": "ManagedClusterLoadBalancerProfileOutboundIPs"}, + "effective_outbound_i_ps": {"key": "effectiveOutboundIPs", "type": "[ResourceReference]"}, + "allocated_outbound_ports": {"key": "allocatedOutboundPorts", "type": "int"}, + "idle_timeout_in_minutes": {"key": "idleTimeoutInMinutes", "type": "int"}, + "enable_multiple_standard_load_balancers": {"key": "enableMultipleStandardLoadBalancers", "type": "bool"}, } def __init__( @@ -4003,8 +3959,8 @@ def __init__( outbound_ip_prefixes: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPPrefixes"] = None, outbound_i_ps: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPs"] = None, effective_outbound_i_ps: Optional[List["_models.ResourceReference"]] = None, - allocated_outbound_ports: Optional[int] = 0, - idle_timeout_in_minutes: Optional[int] = 30, + allocated_outbound_ports: int = 0, + idle_timeout_in_minutes: int = 30, enable_multiple_standard_load_balancers: Optional[bool] = None, **kwargs ): @@ -4034,7 +3990,7 @@ def __init__( AKS cluster or not. :paramtype enable_multiple_standard_load_balancers: bool """ - super(ManagedClusterLoadBalancerProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.managed_outbound_i_ps = managed_outbound_i_ps self.outbound_ip_prefixes = outbound_ip_prefixes self.outbound_i_ps = outbound_i_ps @@ -4044,7 +4000,7 @@ def __init__( self.enable_multiple_standard_load_balancers = enable_multiple_standard_load_balancers -class ManagedClusterLoadBalancerProfileManagedOutboundIPs(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfileManagedOutboundIPs(_serialization.Model): """Desired managed outbound IPs for the cluster load balancer. :ivar count: The desired number of IPv4 outbound IPs created/managed by Azure for the cluster @@ -4058,22 +4014,16 @@ class ManagedClusterLoadBalancerProfileManagedOutboundIPs(msrest.serialization.M """ _validation = { - 'count': {'maximum': 100, 'minimum': 1}, - 'count_ipv6': {'maximum': 100, 'minimum': 0}, + "count": {"maximum": 100, "minimum": 1}, + "count_ipv6": {"maximum": 100, "minimum": 0}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'count_ipv6': {'key': 'countIPv6', 'type': 'int'}, + "count": {"key": "count", "type": "int"}, + "count_ipv6": {"key": "countIPv6", "type": "int"}, } - def __init__( - self, - *, - count: Optional[int] = 1, - count_ipv6: Optional[int] = 0, - **kwargs - ): + def __init__(self, *, count: int = 1, count_ipv6: int = 0, **kwargs): """ :keyword count: The desired number of IPv4 outbound IPs created/managed by Azure for the cluster load balancer. Allowed values must be in the range of 1 to 100 (inclusive). The default @@ -4084,12 +4034,12 @@ def __init__( value is 0 for single-stack and 1 for dual-stack. :paramtype count_ipv6: int """ - super(ManagedClusterLoadBalancerProfileManagedOutboundIPs, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.count_ipv6 = count_ipv6 -class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(_serialization.Model): """Desired outbound IP Prefix resources for the cluster load balancer. :ivar public_ip_prefixes: A list of public IP prefix resources. @@ -4098,25 +4048,20 @@ class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(msrest.serialization.M """ _attribute_map = { - 'public_ip_prefixes': {'key': 'publicIPPrefixes', 'type': '[ResourceReference]'}, + "public_ip_prefixes": {"key": "publicIPPrefixes", "type": "[ResourceReference]"}, } - def __init__( - self, - *, - public_ip_prefixes: Optional[List["_models.ResourceReference"]] = None, - **kwargs - ): + def __init__(self, *, public_ip_prefixes: Optional[List["_models.ResourceReference"]] = None, **kwargs): """ :keyword public_ip_prefixes: A list of public IP prefix resources. :paramtype public_ip_prefixes: list[~azure.mgmt.containerservice.v2022_05_02_preview.models.ResourceReference] """ - super(ManagedClusterLoadBalancerProfileOutboundIPPrefixes, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_ip_prefixes = public_ip_prefixes -class ManagedClusterLoadBalancerProfileOutboundIPs(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfileOutboundIPs(_serialization.Model): """Desired outbound IP resources for the cluster load balancer. :ivar public_i_ps: A list of public IP resources. @@ -4125,25 +4070,20 @@ class ManagedClusterLoadBalancerProfileOutboundIPs(msrest.serialization.Model): """ _attribute_map = { - 'public_i_ps': {'key': 'publicIPs', 'type': '[ResourceReference]'}, + "public_i_ps": {"key": "publicIPs", "type": "[ResourceReference]"}, } - def __init__( - self, - *, - public_i_ps: Optional[List["_models.ResourceReference"]] = None, - **kwargs - ): + def __init__(self, *, public_i_ps: Optional[List["_models.ResourceReference"]] = None, **kwargs): """ :keyword public_i_ps: A list of public IP resources. :paramtype public_i_ps: list[~azure.mgmt.containerservice.v2022_05_02_preview.models.ResourceReference] """ - super(ManagedClusterLoadBalancerProfileOutboundIPs, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_i_ps = public_i_ps -class ManagedClusterManagedOutboundIPProfile(msrest.serialization.Model): +class ManagedClusterManagedOutboundIPProfile(_serialization.Model): """Profile of the managed outbound IP resources of the managed cluster. :ivar count: The desired number of outbound IPs created/managed by Azure. Allowed values must @@ -4152,29 +4092,24 @@ class ManagedClusterManagedOutboundIPProfile(msrest.serialization.Model): """ _validation = { - 'count': {'maximum': 16, 'minimum': 1}, + "count": {"maximum": 16, "minimum": 1}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, + "count": {"key": "count", "type": "int"}, } - def __init__( - self, - *, - count: Optional[int] = 1, - **kwargs - ): + def __init__(self, *, count: int = 1, **kwargs): """ :keyword count: The desired number of outbound IPs created/managed by Azure. Allowed values must be in the range of 1 to 16 (inclusive). The default value is 1. :paramtype count: int """ - super(ManagedClusterManagedOutboundIPProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count -class ManagedClusterNATGatewayProfile(msrest.serialization.Model): +class ManagedClusterNATGatewayProfile(_serialization.Model): """Profile of the managed cluster NAT gateway. :ivar managed_outbound_ip_profile: Profile of the managed outbound IP resources of the cluster @@ -4190,13 +4125,16 @@ class ManagedClusterNATGatewayProfile(msrest.serialization.Model): """ _validation = { - 'idle_timeout_in_minutes': {'maximum': 120, 'minimum': 4}, + "idle_timeout_in_minutes": {"maximum": 120, "minimum": 4}, } _attribute_map = { - 'managed_outbound_ip_profile': {'key': 'managedOutboundIPProfile', 'type': 'ManagedClusterManagedOutboundIPProfile'}, - 'effective_outbound_i_ps': {'key': 'effectiveOutboundIPs', 'type': '[ResourceReference]'}, - 'idle_timeout_in_minutes': {'key': 'idleTimeoutInMinutes', 'type': 'int'}, + "managed_outbound_ip_profile": { + "key": "managedOutboundIPProfile", + "type": "ManagedClusterManagedOutboundIPProfile", + }, + "effective_outbound_i_ps": {"key": "effectiveOutboundIPs", "type": "[ResourceReference]"}, + "idle_timeout_in_minutes": {"key": "idleTimeoutInMinutes", "type": "int"}, } def __init__( @@ -4204,7 +4142,7 @@ def __init__( *, managed_outbound_ip_profile: Optional["_models.ManagedClusterManagedOutboundIPProfile"] = None, effective_outbound_i_ps: Optional[List["_models.ResourceReference"]] = None, - idle_timeout_in_minutes: Optional[int] = 4, + idle_timeout_in_minutes: int = 4, **kwargs ): """ @@ -4220,13 +4158,13 @@ def __init__( are in the range of 4 to 120 (inclusive). The default value is 4 minutes. :paramtype idle_timeout_in_minutes: int """ - super(ManagedClusterNATGatewayProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.managed_outbound_ip_profile = managed_outbound_ip_profile self.effective_outbound_i_ps = effective_outbound_i_ps self.idle_timeout_in_minutes = idle_timeout_in_minutes -class ManagedClusterOIDCIssuerProfile(msrest.serialization.Model): +class ManagedClusterOIDCIssuerProfile(_serialization.Model): """The OIDC issuer profile of the Managed Cluster. Variables are only populated by the server, and will be ignored when sending a request. @@ -4238,46 +4176,41 @@ class ManagedClusterOIDCIssuerProfile(msrest.serialization.Model): """ _validation = { - 'issuer_url': {'readonly': True}, + "issuer_url": {"readonly": True}, } _attribute_map = { - 'issuer_url': {'key': 'issuerURL', 'type': 'str'}, - 'enabled': {'key': 'enabled', 'type': 'bool'}, + "issuer_url": {"key": "issuerURL", "type": "str"}, + "enabled": {"key": "enabled", "type": "bool"}, } - def __init__( - self, - *, - enabled: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, enabled: Optional[bool] = None, **kwargs): """ :keyword enabled: Whether the OIDC issuer is enabled. :paramtype enabled: bool """ - super(ManagedClusterOIDCIssuerProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.issuer_url = None self.enabled = enabled -class ManagedClusterPodIdentity(msrest.serialization.Model): +class ManagedClusterPodIdentity(_serialization.Model): """Details about the pod identity assigned to the Managed Cluster. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar name: Required. The name of the pod identity. + :ivar name: The name of the pod identity. Required. :vartype name: str - :ivar namespace: Required. The namespace of the pod identity. + :ivar namespace: The namespace of the pod identity. Required. :vartype namespace: str :ivar binding_selector: The binding selector to use for the AzureIdentityBinding resource. :vartype binding_selector: str - :ivar identity: Required. The user assigned identity details. + :ivar identity: The user assigned identity details. Required. :vartype identity: ~azure.mgmt.containerservice.v2022_05_02_preview.models.UserAssignedIdentity :ivar provisioning_state: The current provisioning state of the pod identity. Known values are: - "Assigned", "Updating", "Deleting", "Failed". + "Assigned", "Updating", "Deleting", and "Failed". :vartype provisioning_state: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedClusterPodIdentityProvisioningState :ivar provisioning_info: @@ -4286,20 +4219,20 @@ class ManagedClusterPodIdentity(msrest.serialization.Model): """ _validation = { - 'name': {'required': True}, - 'namespace': {'required': True}, - 'identity': {'required': True}, - 'provisioning_state': {'readonly': True}, - 'provisioning_info': {'readonly': True}, + "name": {"required": True}, + "namespace": {"required": True}, + "identity": {"required": True}, + "provisioning_state": {"readonly": True}, + "provisioning_info": {"readonly": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'namespace': {'key': 'namespace', 'type': 'str'}, - 'binding_selector': {'key': 'bindingSelector', 'type': 'str'}, - 'identity': {'key': 'identity', 'type': 'UserAssignedIdentity'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'provisioning_info': {'key': 'provisioningInfo', 'type': 'ManagedClusterPodIdentityProvisioningInfo'}, + "name": {"key": "name", "type": "str"}, + "namespace": {"key": "namespace", "type": "str"}, + "binding_selector": {"key": "bindingSelector", "type": "str"}, + "identity": {"key": "identity", "type": "UserAssignedIdentity"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "provisioning_info": {"key": "provisioningInfo", "type": "ManagedClusterPodIdentityProvisioningInfo"}, } def __init__( @@ -4312,17 +4245,17 @@ def __init__( **kwargs ): """ - :keyword name: Required. The name of the pod identity. + :keyword name: The name of the pod identity. Required. :paramtype name: str - :keyword namespace: Required. The namespace of the pod identity. + :keyword namespace: The namespace of the pod identity. Required. :paramtype namespace: str :keyword binding_selector: The binding selector to use for the AzureIdentityBinding resource. :paramtype binding_selector: str - :keyword identity: Required. The user assigned identity details. + :keyword identity: The user assigned identity details. Required. :paramtype identity: ~azure.mgmt.containerservice.v2022_05_02_preview.models.UserAssignedIdentity """ - super(ManagedClusterPodIdentity, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.namespace = namespace self.binding_selector = binding_selector @@ -4331,54 +4264,47 @@ def __init__( self.provisioning_info = None -class ManagedClusterPodIdentityException(msrest.serialization.Model): +class ManagedClusterPodIdentityException(_serialization.Model): """See `disable AAD Pod Identity for a specific Pod/Application `_ for more details. All required parameters must be populated in order to send to Azure. - :ivar name: Required. The name of the pod identity exception. + :ivar name: The name of the pod identity exception. Required. :vartype name: str - :ivar namespace: Required. The namespace of the pod identity exception. + :ivar namespace: The namespace of the pod identity exception. Required. :vartype namespace: str - :ivar pod_labels: Required. The pod labels to match. + :ivar pod_labels: The pod labels to match. Required. :vartype pod_labels: dict[str, str] """ _validation = { - 'name': {'required': True}, - 'namespace': {'required': True}, - 'pod_labels': {'required': True}, + "name": {"required": True}, + "namespace": {"required": True}, + "pod_labels": {"required": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'namespace': {'key': 'namespace', 'type': 'str'}, - 'pod_labels': {'key': 'podLabels', 'type': '{str}'}, + "name": {"key": "name", "type": "str"}, + "namespace": {"key": "namespace", "type": "str"}, + "pod_labels": {"key": "podLabels", "type": "{str}"}, } - def __init__( - self, - *, - name: str, - namespace: str, - pod_labels: Dict[str, str], - **kwargs - ): + def __init__(self, *, name: str, namespace: str, pod_labels: Dict[str, str], **kwargs): """ - :keyword name: Required. The name of the pod identity exception. + :keyword name: The name of the pod identity exception. Required. :paramtype name: str - :keyword namespace: Required. The namespace of the pod identity exception. + :keyword namespace: The namespace of the pod identity exception. Required. :paramtype namespace: str - :keyword pod_labels: Required. The pod labels to match. + :keyword pod_labels: The pod labels to match. Required. :paramtype pod_labels: dict[str, str] """ - super(ManagedClusterPodIdentityException, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.namespace = namespace self.pod_labels = pod_labels -class ManagedClusterPodIdentityProfile(msrest.serialization.Model): +class ManagedClusterPodIdentityProfile(_serialization.Model): """See `use AAD pod identity `_ for more details on pod identity integration. :ivar enabled: Whether the pod identity addon is enabled. @@ -4398,10 +4324,13 @@ class ManagedClusterPodIdentityProfile(msrest.serialization.Model): """ _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'allow_network_plugin_kubenet': {'key': 'allowNetworkPluginKubenet', 'type': 'bool'}, - 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '[ManagedClusterPodIdentity]'}, - 'user_assigned_identity_exceptions': {'key': 'userAssignedIdentityExceptions', 'type': '[ManagedClusterPodIdentityException]'}, + "enabled": {"key": "enabled", "type": "bool"}, + "allow_network_plugin_kubenet": {"key": "allowNetworkPluginKubenet", "type": "bool"}, + "user_assigned_identities": {"key": "userAssignedIdentities", "type": "[ManagedClusterPodIdentity]"}, + "user_assigned_identity_exceptions": { + "key": "userAssignedIdentityExceptions", + "type": "[ManagedClusterPodIdentityException]", + }, } def __init__( @@ -4429,14 +4358,14 @@ def __init__( :paramtype user_assigned_identity_exceptions: list[~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedClusterPodIdentityException] """ - super(ManagedClusterPodIdentityProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.allow_network_plugin_kubenet = allow_network_plugin_kubenet self.user_assigned_identities = user_assigned_identities self.user_assigned_identity_exceptions = user_assigned_identity_exceptions -class ManagedClusterPodIdentityProvisioningError(msrest.serialization.Model): +class ManagedClusterPodIdentityProvisioningError(_serialization.Model): """An error response from the pod identity provisioning. :ivar error: Details about the error. @@ -4445,25 +4374,20 @@ class ManagedClusterPodIdentityProvisioningError(msrest.serialization.Model): """ _attribute_map = { - 'error': {'key': 'error', 'type': 'ManagedClusterPodIdentityProvisioningErrorBody'}, + "error": {"key": "error", "type": "ManagedClusterPodIdentityProvisioningErrorBody"}, } - def __init__( - self, - *, - error: Optional["_models.ManagedClusterPodIdentityProvisioningErrorBody"] = None, - **kwargs - ): + def __init__(self, *, error: Optional["_models.ManagedClusterPodIdentityProvisioningErrorBody"] = None, **kwargs): """ :keyword error: Details about the error. :paramtype error: ~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedClusterPodIdentityProvisioningErrorBody """ - super(ManagedClusterPodIdentityProvisioningError, self).__init__(**kwargs) + super().__init__(**kwargs) self.error = error -class ManagedClusterPodIdentityProvisioningErrorBody(msrest.serialization.Model): +class ManagedClusterPodIdentityProvisioningErrorBody(_serialization.Model): """An error response from the pod identity provisioning. :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed @@ -4481,10 +4405,10 @@ class ManagedClusterPodIdentityProvisioningErrorBody(msrest.serialization.Model) """ _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[ManagedClusterPodIdentityProvisioningErrorBody]'}, + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[ManagedClusterPodIdentityProvisioningErrorBody]"}, } def __init__( @@ -4510,14 +4434,14 @@ def __init__( :paramtype details: list[~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedClusterPodIdentityProvisioningErrorBody] """ - super(ManagedClusterPodIdentityProvisioningErrorBody, self).__init__(**kwargs) + super().__init__(**kwargs) self.code = code self.message = message self.target = target self.details = details -class ManagedClusterPodIdentityProvisioningInfo(msrest.serialization.Model): +class ManagedClusterPodIdentityProvisioningInfo(_serialization.Model): """ManagedClusterPodIdentityProvisioningInfo. :ivar error: Pod identity assignment error (if any). @@ -4526,35 +4450,30 @@ class ManagedClusterPodIdentityProvisioningInfo(msrest.serialization.Model): """ _attribute_map = { - 'error': {'key': 'error', 'type': 'ManagedClusterPodIdentityProvisioningError'}, + "error": {"key": "error", "type": "ManagedClusterPodIdentityProvisioningError"}, } - def __init__( - self, - *, - error: Optional["_models.ManagedClusterPodIdentityProvisioningError"] = None, - **kwargs - ): + def __init__(self, *, error: Optional["_models.ManagedClusterPodIdentityProvisioningError"] = None, **kwargs): """ :keyword error: Pod identity assignment error (if any). :paramtype error: ~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedClusterPodIdentityProvisioningError """ - super(ManagedClusterPodIdentityProvisioningInfo, self).__init__(**kwargs) + super().__init__(**kwargs) self.error = error -class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): +class ManagedClusterPoolUpgradeProfile(_serialization.Model): """The list of available upgrade versions. All required parameters must be populated in order to send to Azure. - :ivar kubernetes_version: Required. The Kubernetes version (major.minor.patch). + :ivar kubernetes_version: The Kubernetes version (major.minor.patch). Required. :vartype kubernetes_version: str :ivar name: The Agent Pool name. :vartype name: str - :ivar os_type: Required. The operating system type. The default is Linux. Known values are: - "Linux", "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -4562,15 +4481,15 @@ class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): """ _validation = { - 'kubernetes_version': {'required': True}, - 'os_type': {'required': True}, + "kubernetes_version": {"required": True}, + "os_type": {"required": True}, } _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'upgrades': {'key': 'upgrades', 'type': '[ManagedClusterPoolUpgradeProfileUpgradesItem]'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "os_type": {"key": "osType", "type": "str"}, + "upgrades": {"key": "upgrades", "type": "[ManagedClusterPoolUpgradeProfileUpgradesItem]"}, } def __init__( @@ -4583,25 +4502,25 @@ def __init__( **kwargs ): """ - :keyword kubernetes_version: Required. The Kubernetes version (major.minor.patch). + :keyword kubernetes_version: The Kubernetes version (major.minor.patch). Required. :paramtype kubernetes_version: str :keyword name: The Agent Pool name. :paramtype name: str - :keyword os_type: Required. The operating system type. The default is Linux. Known values are: - "Linux", "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: list[~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedClusterPoolUpgradeProfileUpgradesItem] """ - super(ManagedClusterPoolUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.name = name self.os_type = os_type self.upgrades = upgrades -class ManagedClusterPoolUpgradeProfileUpgradesItem(msrest.serialization.Model): +class ManagedClusterPoolUpgradeProfileUpgradesItem(_serialization.Model): """ManagedClusterPoolUpgradeProfileUpgradesItem. :ivar kubernetes_version: The Kubernetes version (major.minor.patch). @@ -4611,36 +4530,30 @@ class ManagedClusterPoolUpgradeProfileUpgradesItem(msrest.serialization.Model): """ _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } - def __init__( - self, - *, - kubernetes_version: Optional[str] = None, - is_preview: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, kubernetes_version: Optional[str] = None, is_preview: Optional[bool] = None, **kwargs): """ :keyword kubernetes_version: The Kubernetes version (major.minor.patch). :paramtype kubernetes_version: str :keyword is_preview: Whether the Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(ManagedClusterPoolUpgradeProfileUpgradesItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.is_preview = is_preview -class ManagedClusterPropertiesAutoScalerProfile(msrest.serialization.Model): +class ManagedClusterPropertiesAutoScalerProfile(_serialization.Model): # pylint: disable=too-many-instance-attributes """Parameters to be applied to the cluster-autoscaler when enabled. :ivar balance_similar_node_groups: Valid values are 'true' and 'false'. :vartype balance_similar_node_groups: str :ivar expander: If not specified, the default is 'random'. See `expanders `_ - for more information. Known values are: "least-waste", "most-pods", "priority", "random". + for more information. Known values are: "least-waste", "most-pods", "priority", and "random". :vartype expander: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.Expander :ivar max_empty_bulk_delete: The default is 10. :vartype max_empty_bulk_delete: str @@ -4684,23 +4597,23 @@ class ManagedClusterPropertiesAutoScalerProfile(msrest.serialization.Model): """ _attribute_map = { - 'balance_similar_node_groups': {'key': 'balance-similar-node-groups', 'type': 'str'}, - 'expander': {'key': 'expander', 'type': 'str'}, - 'max_empty_bulk_delete': {'key': 'max-empty-bulk-delete', 'type': 'str'}, - 'max_graceful_termination_sec': {'key': 'max-graceful-termination-sec', 'type': 'str'}, - 'max_node_provision_time': {'key': 'max-node-provision-time', 'type': 'str'}, - 'max_total_unready_percentage': {'key': 'max-total-unready-percentage', 'type': 'str'}, - 'new_pod_scale_up_delay': {'key': 'new-pod-scale-up-delay', 'type': 'str'}, - 'ok_total_unready_count': {'key': 'ok-total-unready-count', 'type': 'str'}, - 'scan_interval': {'key': 'scan-interval', 'type': 'str'}, - 'scale_down_delay_after_add': {'key': 'scale-down-delay-after-add', 'type': 'str'}, - 'scale_down_delay_after_delete': {'key': 'scale-down-delay-after-delete', 'type': 'str'}, - 'scale_down_delay_after_failure': {'key': 'scale-down-delay-after-failure', 'type': 'str'}, - 'scale_down_unneeded_time': {'key': 'scale-down-unneeded-time', 'type': 'str'}, - 'scale_down_unready_time': {'key': 'scale-down-unready-time', 'type': 'str'}, - 'scale_down_utilization_threshold': {'key': 'scale-down-utilization-threshold', 'type': 'str'}, - 'skip_nodes_with_local_storage': {'key': 'skip-nodes-with-local-storage', 'type': 'str'}, - 'skip_nodes_with_system_pods': {'key': 'skip-nodes-with-system-pods', 'type': 'str'}, + "balance_similar_node_groups": {"key": "balance-similar-node-groups", "type": "str"}, + "expander": {"key": "expander", "type": "str"}, + "max_empty_bulk_delete": {"key": "max-empty-bulk-delete", "type": "str"}, + "max_graceful_termination_sec": {"key": "max-graceful-termination-sec", "type": "str"}, + "max_node_provision_time": {"key": "max-node-provision-time", "type": "str"}, + "max_total_unready_percentage": {"key": "max-total-unready-percentage", "type": "str"}, + "new_pod_scale_up_delay": {"key": "new-pod-scale-up-delay", "type": "str"}, + "ok_total_unready_count": {"key": "ok-total-unready-count", "type": "str"}, + "scan_interval": {"key": "scan-interval", "type": "str"}, + "scale_down_delay_after_add": {"key": "scale-down-delay-after-add", "type": "str"}, + "scale_down_delay_after_delete": {"key": "scale-down-delay-after-delete", "type": "str"}, + "scale_down_delay_after_failure": {"key": "scale-down-delay-after-failure", "type": "str"}, + "scale_down_unneeded_time": {"key": "scale-down-unneeded-time", "type": "str"}, + "scale_down_unready_time": {"key": "scale-down-unready-time", "type": "str"}, + "scale_down_utilization_threshold": {"key": "scale-down-utilization-threshold", "type": "str"}, + "skip_nodes_with_local_storage": {"key": "skip-nodes-with-local-storage", "type": "str"}, + "skip_nodes_with_system_pods": {"key": "skip-nodes-with-system-pods", "type": "str"}, } def __init__( @@ -4730,7 +4643,7 @@ def __init__( :paramtype balance_similar_node_groups: str :keyword expander: If not specified, the default is 'random'. See `expanders `_ - for more information. Known values are: "least-waste", "most-pods", "priority", "random". + for more information. Known values are: "least-waste", "most-pods", "priority", and "random". :paramtype expander: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.Expander :keyword max_empty_bulk_delete: The default is 10. :paramtype max_empty_bulk_delete: str @@ -4773,7 +4686,7 @@ def __init__( :keyword skip_nodes_with_system_pods: The default is true. :paramtype skip_nodes_with_system_pods: str """ - super(ManagedClusterPropertiesAutoScalerProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.balance_similar_node_groups = balance_similar_node_groups self.expander = expander self.max_empty_bulk_delete = max_empty_bulk_delete @@ -4793,7 +4706,7 @@ def __init__( self.skip_nodes_with_system_pods = skip_nodes_with_system_pods -class ManagedClusterPropertiesForSnapshot(msrest.serialization.Model): +class ManagedClusterPropertiesForSnapshot(_serialization.Model): """managed cluster properties for snapshot, these properties are read only. Variables are only populated by the server, and will be ignored when sending a request. @@ -4810,14 +4723,14 @@ class ManagedClusterPropertiesForSnapshot(msrest.serialization.Model): """ _validation = { - 'network_profile': {'readonly': True}, + "network_profile": {"readonly": True}, } _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'ManagedClusterSKU'}, - 'enable_rbac': {'key': 'enableRbac', 'type': 'bool'}, - 'network_profile': {'key': 'networkProfile', 'type': 'NetworkProfileForSnapshot'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "sku": {"key": "sku", "type": "ManagedClusterSKU"}, + "enable_rbac": {"key": "enableRbac", "type": "bool"}, + "network_profile": {"key": "networkProfile", "type": "NetworkProfileForSnapshot"}, } def __init__( @@ -4837,14 +4750,14 @@ def __init__( not. :paramtype enable_rbac: bool """ - super(ManagedClusterPropertiesForSnapshot, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.sku = sku self.enable_rbac = enable_rbac self.network_profile = None -class ManagedClusterSecurityProfile(msrest.serialization.Model): +class ManagedClusterSecurityProfile(_serialization.Model): """Security profile for the container service cluster. :ivar defender: Microsoft Defender settings for the security profile. @@ -4862,9 +4775,9 @@ class ManagedClusterSecurityProfile(msrest.serialization.Model): """ _attribute_map = { - 'defender': {'key': 'defender', 'type': 'ManagedClusterSecurityProfileDefender'}, - 'azure_key_vault_kms': {'key': 'azureKeyVaultKms', 'type': 'AzureKeyVaultKms'}, - 'workload_identity': {'key': 'workloadIdentity', 'type': 'ManagedClusterSecurityProfileWorkloadIdentity'}, + "defender": {"key": "defender", "type": "ManagedClusterSecurityProfileDefender"}, + "azure_key_vault_kms": {"key": "azureKeyVaultKms", "type": "AzureKeyVaultKms"}, + "workload_identity": {"key": "workloadIdentity", "type": "ManagedClusterSecurityProfileWorkloadIdentity"}, } def __init__( @@ -4889,13 +4802,13 @@ def __init__( :paramtype workload_identity: ~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedClusterSecurityProfileWorkloadIdentity """ - super(ManagedClusterSecurityProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.defender = defender self.azure_key_vault_kms = azure_key_vault_kms self.workload_identity = workload_identity -class ManagedClusterSecurityProfileDefender(msrest.serialization.Model): +class ManagedClusterSecurityProfileDefender(_serialization.Model): """Microsoft Defender settings for the security profile. :ivar log_analytics_workspace_resource_id: Resource ID of the Log Analytics workspace to be @@ -4910,8 +4823,11 @@ class ManagedClusterSecurityProfileDefender(msrest.serialization.Model): """ _attribute_map = { - 'log_analytics_workspace_resource_id': {'key': 'logAnalyticsWorkspaceResourceId', 'type': 'str'}, - 'security_monitoring': {'key': 'securityMonitoring', 'type': 'ManagedClusterSecurityProfileDefenderSecurityMonitoring'}, + "log_analytics_workspace_resource_id": {"key": "logAnalyticsWorkspaceResourceId", "type": "str"}, + "security_monitoring": { + "key": "securityMonitoring", + "type": "ManagedClusterSecurityProfileDefenderSecurityMonitoring", + }, } def __init__( @@ -4932,12 +4848,12 @@ def __init__( :paramtype security_monitoring: ~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedClusterSecurityProfileDefenderSecurityMonitoring """ - super(ManagedClusterSecurityProfileDefender, self).__init__(**kwargs) + super().__init__(**kwargs) self.log_analytics_workspace_resource_id = log_analytics_workspace_resource_id self.security_monitoring = security_monitoring -class ManagedClusterSecurityProfileDefenderSecurityMonitoring(msrest.serialization.Model): +class ManagedClusterSecurityProfileDefenderSecurityMonitoring(_serialization.Model): """Microsoft Defender settings for the security profile threat detection. :ivar enabled: Whether to enable Defender threat detection. @@ -4945,24 +4861,19 @@ class ManagedClusterSecurityProfileDefenderSecurityMonitoring(msrest.serializati """ _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, + "enabled": {"key": "enabled", "type": "bool"}, } - def __init__( - self, - *, - enabled: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, enabled: Optional[bool] = None, **kwargs): """ :keyword enabled: Whether to enable Defender threat detection. :paramtype enabled: bool """ - super(ManagedClusterSecurityProfileDefenderSecurityMonitoring, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled -class ManagedClusterSecurityProfileWorkloadIdentity(msrest.serialization.Model): +class ManagedClusterSecurityProfileWorkloadIdentity(_serialization.Model): """Workload Identity settings for the security profile. :ivar enabled: Whether to enable Workload Identity. @@ -4970,77 +4881,66 @@ class ManagedClusterSecurityProfileWorkloadIdentity(msrest.serialization.Model): """ _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, + "enabled": {"key": "enabled", "type": "bool"}, } - def __init__( - self, - *, - enabled: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, enabled: Optional[bool] = None, **kwargs): """ :keyword enabled: Whether to enable Workload Identity. :paramtype enabled: bool """ - super(ManagedClusterSecurityProfileWorkloadIdentity, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled -class ManagedClusterServicePrincipalProfile(msrest.serialization.Model): +class ManagedClusterServicePrincipalProfile(_serialization.Model): """Information about a service principal identity for the cluster to use for manipulating Azure APIs. All required parameters must be populated in order to send to Azure. - :ivar client_id: Required. The ID for the service principal. + :ivar client_id: The ID for the service principal. Required. :vartype client_id: str :ivar secret: The secret password associated with the service principal in plain text. :vartype secret: str """ _validation = { - 'client_id': {'required': True}, + "client_id": {"required": True}, } _attribute_map = { - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'secret': {'key': 'secret', 'type': 'str'}, + "client_id": {"key": "clientId", "type": "str"}, + "secret": {"key": "secret", "type": "str"}, } - def __init__( - self, - *, - client_id: str, - secret: Optional[str] = None, - **kwargs - ): + def __init__(self, *, client_id: str, secret: Optional[str] = None, **kwargs): """ - :keyword client_id: Required. The ID for the service principal. + :keyword client_id: The ID for the service principal. Required. :paramtype client_id: str :keyword secret: The secret password associated with the service principal in plain text. :paramtype secret: str """ - super(ManagedClusterServicePrincipalProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.client_id = client_id self.secret = secret -class ManagedClusterSKU(msrest.serialization.Model): +class ManagedClusterSKU(_serialization.Model): """The SKU of a Managed Cluster. - :ivar name: The name of a managed cluster SKU. Known values are: "Basic". + :ivar name: The name of a managed cluster SKU. "Basic" :vartype name: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedClusterSKUName :ivar tier: If not specified, the default is 'Free'. See `uptime SLA - `_ for more details. Known values are: "Paid", - "Free". + `_ for more details. Known values are: "Paid" + and "Free". :vartype tier: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedClusterSKUTier """ _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, + "name": {"key": "name", "type": "str"}, + "tier": {"key": "tier", "type": "str"}, } def __init__( @@ -5051,16 +4951,16 @@ def __init__( **kwargs ): """ - :keyword name: The name of a managed cluster SKU. Known values are: "Basic". + :keyword name: The name of a managed cluster SKU. "Basic" :paramtype name: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedClusterSKUName :keyword tier: If not specified, the default is 'Free'. See `uptime SLA - `_ for more details. Known values are: "Paid", - "Free". + `_ for more details. Known values are: "Paid" + and "Free". :paramtype tier: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedClusterSKUTier """ - super(ManagedClusterSKU, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.tier = tier @@ -5083,15 +4983,15 @@ class ManagedClusterSnapshot(TrackedResource): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.containerservice.v2022_05_02_preview.models.SystemData - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] - :ivar location: Required. The geo-location where the resource lives. + :ivar location: The geo-location where the resource lives. Required. :vartype location: str :ivar creation_data: CreationData to be used to specify the source resource ID to create this snapshot. :vartype creation_data: ~azure.mgmt.containerservice.v2022_05_02_preview.models.CreationData :ivar snapshot_type: The type of a snapshot. The default is NodePool. Known values are: - "NodePool", "ManagedCluster". Default value: "NodePool". + "NodePool" and "ManagedCluster". :vartype snapshot_type: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.SnapshotType :ivar managed_cluster_properties_read_only: What the properties will be showed when getting @@ -5101,24 +5001,27 @@ class ManagedClusterSnapshot(TrackedResource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'location': {'required': True}, - 'managed_cluster_properties_read_only': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, + "managed_cluster_properties_read_only": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - 'creation_data': {'key': 'properties.creationData', 'type': 'CreationData'}, - 'snapshot_type': {'key': 'properties.snapshotType', 'type': 'str'}, - 'managed_cluster_properties_read_only': {'key': 'properties.managedClusterPropertiesReadOnly', 'type': 'ManagedClusterPropertiesForSnapshot'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "creation_data": {"key": "properties.creationData", "type": "CreationData"}, + "snapshot_type": {"key": "properties.snapshotType", "type": "str"}, + "managed_cluster_properties_read_only": { + "key": "properties.managedClusterPropertiesReadOnly", + "type": "ManagedClusterPropertiesForSnapshot", + }, } def __init__( @@ -5127,29 +5030,29 @@ def __init__( location: str, tags: Optional[Dict[str, str]] = None, creation_data: Optional["_models.CreationData"] = None, - snapshot_type: Optional[Union[str, "_models.SnapshotType"]] = "NodePool", + snapshot_type: Union[str, "_models.SnapshotType"] = "NodePool", **kwargs ): """ - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] - :keyword location: Required. The geo-location where the resource lives. + :keyword location: The geo-location where the resource lives. Required. :paramtype location: str :keyword creation_data: CreationData to be used to specify the source resource ID to create this snapshot. :paramtype creation_data: ~azure.mgmt.containerservice.v2022_05_02_preview.models.CreationData :keyword snapshot_type: The type of a snapshot. The default is NodePool. Known values are: - "NodePool", "ManagedCluster". Default value: "NodePool". + "NodePool" and "ManagedCluster". :paramtype snapshot_type: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.SnapshotType """ - super(ManagedClusterSnapshot, self).__init__(tags=tags, location=location, **kwargs) + super().__init__(tags=tags, location=location, **kwargs) self.creation_data = creation_data self.snapshot_type = snapshot_type self.managed_cluster_properties_read_only = None -class ManagedClusterSnapshotListResult(msrest.serialization.Model): +class ManagedClusterSnapshotListResult(_serialization.Model): """The response from the List Managed Cluster Snapshots operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -5162,31 +5065,26 @@ class ManagedClusterSnapshotListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[ManagedClusterSnapshot]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[ManagedClusterSnapshot]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.ManagedClusterSnapshot"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.ManagedClusterSnapshot"]] = None, **kwargs): """ :keyword value: The list of managed cluster snapshots. :paramtype value: list[~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedClusterSnapshot] """ - super(ManagedClusterSnapshotListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class ManagedClusterStorageProfile(msrest.serialization.Model): +class ManagedClusterStorageProfile(_serialization.Model): """Storage profile for the container service cluster. :ivar disk_csi_driver: AzureDisk CSI Driver settings for the storage profile. @@ -5204,10 +5102,10 @@ class ManagedClusterStorageProfile(msrest.serialization.Model): """ _attribute_map = { - 'disk_csi_driver': {'key': 'diskCSIDriver', 'type': 'ManagedClusterStorageProfileDiskCSIDriver'}, - 'file_csi_driver': {'key': 'fileCSIDriver', 'type': 'ManagedClusterStorageProfileFileCSIDriver'}, - 'snapshot_controller': {'key': 'snapshotController', 'type': 'ManagedClusterStorageProfileSnapshotController'}, - 'blob_csi_driver': {'key': 'blobCSIDriver', 'type': 'ManagedClusterStorageProfileBlobCSIDriver'}, + "disk_csi_driver": {"key": "diskCSIDriver", "type": "ManagedClusterStorageProfileDiskCSIDriver"}, + "file_csi_driver": {"key": "fileCSIDriver", "type": "ManagedClusterStorageProfileFileCSIDriver"}, + "snapshot_controller": {"key": "snapshotController", "type": "ManagedClusterStorageProfileSnapshotController"}, + "blob_csi_driver": {"key": "blobCSIDriver", "type": "ManagedClusterStorageProfileBlobCSIDriver"}, } def __init__( @@ -5233,14 +5131,14 @@ def __init__( :paramtype blob_csi_driver: ~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedClusterStorageProfileBlobCSIDriver """ - super(ManagedClusterStorageProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.disk_csi_driver = disk_csi_driver self.file_csi_driver = file_csi_driver self.snapshot_controller = snapshot_controller self.blob_csi_driver = blob_csi_driver -class ManagedClusterStorageProfileBlobCSIDriver(msrest.serialization.Model): +class ManagedClusterStorageProfileBlobCSIDriver(_serialization.Model): """AzureBlob CSI Driver settings for the storage profile. :ivar enabled: Whether to enable AzureBlob CSI Driver. The default value is false. @@ -5248,24 +5146,19 @@ class ManagedClusterStorageProfileBlobCSIDriver(msrest.serialization.Model): """ _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, + "enabled": {"key": "enabled", "type": "bool"}, } - def __init__( - self, - *, - enabled: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, enabled: Optional[bool] = None, **kwargs): """ :keyword enabled: Whether to enable AzureBlob CSI Driver. The default value is false. :paramtype enabled: bool """ - super(ManagedClusterStorageProfileBlobCSIDriver, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled -class ManagedClusterStorageProfileDiskCSIDriver(msrest.serialization.Model): +class ManagedClusterStorageProfileDiskCSIDriver(_serialization.Model): """AzureDisk CSI Driver settings for the storage profile. :ivar enabled: Whether to enable AzureDisk CSI Driver. The default value is true. @@ -5275,29 +5168,23 @@ class ManagedClusterStorageProfileDiskCSIDriver(msrest.serialization.Model): """ _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'version': {'key': 'version', 'type': 'str'}, + "enabled": {"key": "enabled", "type": "bool"}, + "version": {"key": "version", "type": "str"}, } - def __init__( - self, - *, - enabled: Optional[bool] = None, - version: Optional[str] = None, - **kwargs - ): + def __init__(self, *, enabled: Optional[bool] = None, version: Optional[str] = None, **kwargs): """ :keyword enabled: Whether to enable AzureDisk CSI Driver. The default value is true. :paramtype enabled: bool :keyword version: The version of AzureDisk CSI Driver. The default value is v1. :paramtype version: str """ - super(ManagedClusterStorageProfileDiskCSIDriver, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.version = version -class ManagedClusterStorageProfileFileCSIDriver(msrest.serialization.Model): +class ManagedClusterStorageProfileFileCSIDriver(_serialization.Model): """AzureFile CSI Driver settings for the storage profile. :ivar enabled: Whether to enable AzureFile CSI Driver. The default value is true. @@ -5305,24 +5192,19 @@ class ManagedClusterStorageProfileFileCSIDriver(msrest.serialization.Model): """ _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, + "enabled": {"key": "enabled", "type": "bool"}, } - def __init__( - self, - *, - enabled: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, enabled: Optional[bool] = None, **kwargs): """ :keyword enabled: Whether to enable AzureFile CSI Driver. The default value is true. :paramtype enabled: bool """ - super(ManagedClusterStorageProfileFileCSIDriver, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled -class ManagedClusterStorageProfileSnapshotController(msrest.serialization.Model): +class ManagedClusterStorageProfileSnapshotController(_serialization.Model): """Snapshot Controller settings for the storage profile. :ivar enabled: Whether to enable Snapshot Controller. The default value is true. @@ -5330,24 +5212,19 @@ class ManagedClusterStorageProfileSnapshotController(msrest.serialization.Model) """ _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, + "enabled": {"key": "enabled", "type": "bool"}, } - def __init__( - self, - *, - enabled: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, enabled: Optional[bool] = None, **kwargs): """ :keyword enabled: Whether to enable Snapshot Controller. The default value is true. :paramtype enabled: bool """ - super(ManagedClusterStorageProfileSnapshotController, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled -class ManagedClusterUpgradeProfile(msrest.serialization.Model): +class ManagedClusterUpgradeProfile(_serialization.Model): """The list of available upgrades for compute pools. Variables are only populated by the server, and will be ignored when sending a request. @@ -5360,29 +5237,29 @@ class ManagedClusterUpgradeProfile(msrest.serialization.Model): :vartype name: str :ivar type: The type of the upgrade profile. :vartype type: str - :ivar control_plane_profile: Required. The list of available upgrade versions for the control - plane. + :ivar control_plane_profile: The list of available upgrade versions for the control plane. + Required. :vartype control_plane_profile: ~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedClusterPoolUpgradeProfile - :ivar agent_pool_profiles: Required. The list of available upgrade versions for agent pools. + :ivar agent_pool_profiles: The list of available upgrade versions for agent pools. Required. :vartype agent_pool_profiles: list[~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedClusterPoolUpgradeProfile] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'control_plane_profile': {'required': True}, - 'agent_pool_profiles': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "control_plane_profile": {"required": True}, + "agent_pool_profiles": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'control_plane_profile': {'key': 'properties.controlPlaneProfile', 'type': 'ManagedClusterPoolUpgradeProfile'}, - 'agent_pool_profiles': {'key': 'properties.agentPoolProfiles', 'type': '[ManagedClusterPoolUpgradeProfile]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "control_plane_profile": {"key": "properties.controlPlaneProfile", "type": "ManagedClusterPoolUpgradeProfile"}, + "agent_pool_profiles": {"key": "properties.agentPoolProfiles", "type": "[ManagedClusterPoolUpgradeProfile]"}, } def __init__( @@ -5393,15 +5270,15 @@ def __init__( **kwargs ): """ - :keyword control_plane_profile: Required. The list of available upgrade versions for the - control plane. + :keyword control_plane_profile: The list of available upgrade versions for the control plane. + Required. :paramtype control_plane_profile: ~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedClusterPoolUpgradeProfile - :keyword agent_pool_profiles: Required. The list of available upgrade versions for agent pools. + :keyword agent_pool_profiles: The list of available upgrade versions for agent pools. Required. :paramtype agent_pool_profiles: list[~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedClusterPoolUpgradeProfile] """ - super(ManagedClusterUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -5409,18 +5286,18 @@ def __init__( self.agent_pool_profiles = agent_pool_profiles -class ManagedClusterWindowsProfile(msrest.serialization.Model): +class ManagedClusterWindowsProfile(_serialization.Model): """Profile for Windows VMs in the managed cluster. All required parameters must be populated in order to send to Azure. - :ivar admin_username: Required. Specifies the name of the administrator account. - :code:`
`:code:`
` **Restriction:** Cannot end in "." :code:`
`:code:`
` - **Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", "test1", - "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", - "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", - "sys", "test2", "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 - character :code:`
`:code:`
` **Max-length:** 20 characters. + :ivar admin_username: Specifies the name of the administrator account. :code:`
`:code:`
` + **Restriction:** Cannot end in "." :code:`
`:code:`
` **Disallowed values:** + "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", + "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", + "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", + "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 character + :code:`
`:code:`
` **Max-length:** 20 characters. Required. :vartype admin_username: str :ivar admin_password: Specifies the password of the administrator account. :code:`
`:code:`
` **Minimum-length:** 8 characters :code:`
`:code:`
` @@ -5432,7 +5309,7 @@ class ManagedClusterWindowsProfile(msrest.serialization.Model): :vartype admin_password: str :ivar license_type: The license type to use for Windows VMs. See `Azure Hybrid User Benefits `_ for more details. Known values are: - "None", "Windows_Server". + "None" and "Windows_Server". :vartype license_type: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.LicenseType :ivar enable_csi_proxy: For more details on CSI proxy, see the `CSI proxy GitHub repo @@ -5444,15 +5321,15 @@ class ManagedClusterWindowsProfile(msrest.serialization.Model): """ _validation = { - 'admin_username': {'required': True}, + "admin_username": {"required": True}, } _attribute_map = { - 'admin_username': {'key': 'adminUsername', 'type': 'str'}, - 'admin_password': {'key': 'adminPassword', 'type': 'str'}, - 'license_type': {'key': 'licenseType', 'type': 'str'}, - 'enable_csi_proxy': {'key': 'enableCSIProxy', 'type': 'bool'}, - 'gmsa_profile': {'key': 'gmsaProfile', 'type': 'WindowsGmsaProfile'}, + "admin_username": {"key": "adminUsername", "type": "str"}, + "admin_password": {"key": "adminPassword", "type": "str"}, + "license_type": {"key": "licenseType", "type": "str"}, + "enable_csi_proxy": {"key": "enableCSIProxy", "type": "bool"}, + "gmsa_profile": {"key": "gmsaProfile", "type": "WindowsGmsaProfile"}, } def __init__( @@ -5466,13 +5343,13 @@ def __init__( **kwargs ): """ - :keyword admin_username: Required. Specifies the name of the administrator account. + :keyword admin_username: Specifies the name of the administrator account. :code:`
`:code:`
` **Restriction:** Cannot end in "." :code:`
`:code:`
` **Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 - character :code:`
`:code:`
` **Max-length:** 20 characters. + character :code:`
`:code:`
` **Max-length:** 20 characters. Required. :paramtype admin_username: str :keyword admin_password: Specifies the password of the administrator account. :code:`
`:code:`
` **Minimum-length:** 8 characters :code:`
`:code:`
` @@ -5484,7 +5361,7 @@ def __init__( :paramtype admin_password: str :keyword license_type: The license type to use for Windows VMs. See `Azure Hybrid User Benefits `_ for more details. Known values are: - "None", "Windows_Server". + "None" and "Windows_Server". :paramtype license_type: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.LicenseType :keyword enable_csi_proxy: For more details on CSI proxy, see the `CSI proxy GitHub repo @@ -5494,7 +5371,7 @@ def __init__( :paramtype gmsa_profile: ~azure.mgmt.containerservice.v2022_05_02_preview.models.WindowsGmsaProfile """ - super(ManagedClusterWindowsProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.admin_username = admin_username self.admin_password = admin_password self.license_type = license_type @@ -5502,7 +5379,7 @@ def __init__( self.gmsa_profile = gmsa_profile -class ManagedClusterWorkloadAutoScalerProfile(msrest.serialization.Model): +class ManagedClusterWorkloadAutoScalerProfile(_serialization.Model): """Workload Auto-scaler profile for the container service cluster. :ivar keda: KEDA (Kubernetes Event-driven Autoscaling) settings for the workload auto-scaler @@ -5512,57 +5389,47 @@ class ManagedClusterWorkloadAutoScalerProfile(msrest.serialization.Model): """ _attribute_map = { - 'keda': {'key': 'keda', 'type': 'ManagedClusterWorkloadAutoScalerProfileKeda'}, + "keda": {"key": "keda", "type": "ManagedClusterWorkloadAutoScalerProfileKeda"}, } - def __init__( - self, - *, - keda: Optional["_models.ManagedClusterWorkloadAutoScalerProfileKeda"] = None, - **kwargs - ): + def __init__(self, *, keda: Optional["_models.ManagedClusterWorkloadAutoScalerProfileKeda"] = None, **kwargs): """ :keyword keda: KEDA (Kubernetes Event-driven Autoscaling) settings for the workload auto-scaler profile. :paramtype keda: ~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedClusterWorkloadAutoScalerProfileKeda """ - super(ManagedClusterWorkloadAutoScalerProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.keda = keda -class ManagedClusterWorkloadAutoScalerProfileKeda(msrest.serialization.Model): +class ManagedClusterWorkloadAutoScalerProfileKeda(_serialization.Model): """KEDA (Kubernetes Event-driven Autoscaling) settings for the workload auto-scaler profile. All required parameters must be populated in order to send to Azure. - :ivar enabled: Required. Whether to enable KEDA. + :ivar enabled: Whether to enable KEDA. Required. :vartype enabled: bool """ _validation = { - 'enabled': {'required': True}, + "enabled": {"required": True}, } _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, + "enabled": {"key": "enabled", "type": "bool"}, } - def __init__( - self, - *, - enabled: bool, - **kwargs - ): + def __init__(self, *, enabled: bool, **kwargs): """ - :keyword enabled: Required. Whether to enable KEDA. + :keyword enabled: Whether to enable KEDA. Required. :paramtype enabled: bool """ - super(ManagedClusterWorkloadAutoScalerProfileKeda, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled -class ManagedServiceIdentityUserAssignedIdentitiesValue(msrest.serialization.Model): +class ManagedServiceIdentityUserAssignedIdentitiesValue(_serialization.Model): """ManagedServiceIdentityUserAssignedIdentitiesValue. Variables are only populated by the server, and will be ignored when sending a request. @@ -5574,63 +5441,58 @@ class ManagedServiceIdentityUserAssignedIdentitiesValue(msrest.serialization.Mod """ _validation = { - 'principal_id': {'readonly': True}, - 'client_id': {'readonly': True}, + "principal_id": {"readonly": True}, + "client_id": {"readonly": True}, } _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, + "principal_id": {"key": "principalId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(ManagedServiceIdentityUserAssignedIdentitiesValue, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.principal_id = None self.client_id = None -class NetworkProfileForSnapshot(msrest.serialization.Model): +class NetworkProfileForSnapshot(_serialization.Model): """network profile for managed cluster snapshot, these properties are read only. :ivar network_plugin: networkPlugin for managed cluster snapshot. Known values are: "azure", - "kubenet", "none". Default value: "kubenet". + "kubenet", and "none". :vartype network_plugin: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.NetworkPlugin - :ivar network_plugin_mode: NetworkPluginMode for managed cluster snapshot. Known values are: - "Overlay". + :ivar network_plugin_mode: NetworkPluginMode for managed cluster snapshot. "Overlay" :vartype network_plugin_mode: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.NetworkPluginMode - :ivar network_policy: networkPolicy for managed cluster snapshot. Known values are: "calico", - "azure". + :ivar network_policy: networkPolicy for managed cluster snapshot. Known values are: "calico" + and "azure". :vartype network_policy: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.NetworkPolicy - :ivar network_mode: networkMode for managed cluster snapshot. Known values are: "transparent", - "bridge". + :ivar network_mode: networkMode for managed cluster snapshot. Known values are: "transparent" + and "bridge". :vartype network_mode: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.NetworkMode :ivar load_balancer_sku: loadBalancerSku for managed cluster snapshot. Known values are: - "standard", "basic". + "standard" and "basic". :vartype load_balancer_sku: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.LoadBalancerSku """ _attribute_map = { - 'network_plugin': {'key': 'networkPlugin', 'type': 'str'}, - 'network_plugin_mode': {'key': 'networkPluginMode', 'type': 'str'}, - 'network_policy': {'key': 'networkPolicy', 'type': 'str'}, - 'network_mode': {'key': 'networkMode', 'type': 'str'}, - 'load_balancer_sku': {'key': 'loadBalancerSku', 'type': 'str'}, + "network_plugin": {"key": "networkPlugin", "type": "str"}, + "network_plugin_mode": {"key": "networkPluginMode", "type": "str"}, + "network_policy": {"key": "networkPolicy", "type": "str"}, + "network_mode": {"key": "networkMode", "type": "str"}, + "load_balancer_sku": {"key": "loadBalancerSku", "type": "str"}, } def __init__( self, *, - network_plugin: Optional[Union[str, "_models.NetworkPlugin"]] = "kubenet", + network_plugin: Union[str, "_models.NetworkPlugin"] = "kubenet", network_plugin_mode: Optional[Union[str, "_models.NetworkPluginMode"]] = None, network_policy: Optional[Union[str, "_models.NetworkPolicy"]] = None, network_mode: Optional[Union[str, "_models.NetworkMode"]] = None, @@ -5639,27 +5501,26 @@ def __init__( ): """ :keyword network_plugin: networkPlugin for managed cluster snapshot. Known values are: "azure", - "kubenet", "none". Default value: "kubenet". + "kubenet", and "none". :paramtype network_plugin: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.NetworkPlugin - :keyword network_plugin_mode: NetworkPluginMode for managed cluster snapshot. Known values are: - "Overlay". + :keyword network_plugin_mode: NetworkPluginMode for managed cluster snapshot. "Overlay" :paramtype network_plugin_mode: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.NetworkPluginMode - :keyword network_policy: networkPolicy for managed cluster snapshot. Known values are: - "calico", "azure". + :keyword network_policy: networkPolicy for managed cluster snapshot. Known values are: "calico" + and "azure". :paramtype network_policy: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.NetworkPolicy :keyword network_mode: networkMode for managed cluster snapshot. Known values are: - "transparent", "bridge". + "transparent" and "bridge". :paramtype network_mode: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.NetworkMode :keyword load_balancer_sku: loadBalancerSku for managed cluster snapshot. Known values are: - "standard", "basic". + "standard" and "basic". :paramtype load_balancer_sku: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.LoadBalancerSku """ - super(NetworkProfileForSnapshot, self).__init__(**kwargs) + super().__init__(**kwargs) self.network_plugin = network_plugin self.network_plugin_mode = network_plugin_mode self.network_policy = network_policy @@ -5667,7 +5528,7 @@ def __init__( self.load_balancer_sku = load_balancer_sku -class OperationListResult(msrest.serialization.Model): +class OperationListResult(_serialization.Model): """The List Operation response. Variables are only populated by the server, and will be ignored when sending a request. @@ -5677,24 +5538,20 @@ class OperationListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[OperationValue]'}, + "value": {"key": "value", "type": "[OperationValue]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(OperationListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None -class OperationValue(msrest.serialization.Model): +class OperationValue(_serialization.Model): """Describes the properties of a Operation value. Variables are only populated by the server, and will be ignored when sending a request. @@ -5714,30 +5571,26 @@ class OperationValue(msrest.serialization.Model): """ _validation = { - 'origin': {'readonly': True}, - 'name': {'readonly': True}, - 'operation': {'readonly': True}, - 'resource': {'readonly': True}, - 'description': {'readonly': True}, - 'provider': {'readonly': True}, + "origin": {"readonly": True}, + "name": {"readonly": True}, + "operation": {"readonly": True}, + "resource": {"readonly": True}, + "description": {"readonly": True}, + "provider": {"readonly": True}, } _attribute_map = { - 'origin': {'key': 'origin', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'operation': {'key': 'display.operation', 'type': 'str'}, - 'resource': {'key': 'display.resource', 'type': 'str'}, - 'description': {'key': 'display.description', 'type': 'str'}, - 'provider': {'key': 'display.provider', 'type': 'str'}, + "origin": {"key": "origin", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "operation": {"key": "display.operation", "type": "str"}, + "resource": {"key": "display.resource", "type": "str"}, + "description": {"key": "display.description", "type": "str"}, + "provider": {"key": "display.provider", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(OperationValue, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.origin = None self.name = None self.operation = None @@ -5746,7 +5599,7 @@ def __init__( self.provider = None -class OSOptionProfile(msrest.serialization.Model): +class OSOptionProfile(_serialization.Model): """The OS option profile. Variables are only populated by the server, and will be ignored when sending a request. @@ -5759,83 +5612,72 @@ class OSOptionProfile(msrest.serialization.Model): :vartype name: str :ivar type: The type of the OS option resource. :vartype type: str - :ivar os_option_property_list: Required. The list of OS options. + :ivar os_option_property_list: The list of OS options. Required. :vartype os_option_property_list: list[~azure.mgmt.containerservice.v2022_05_02_preview.models.OSOptionProperty] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'os_option_property_list': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "os_option_property_list": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'os_option_property_list': {'key': 'properties.osOptionPropertyList', 'type': '[OSOptionProperty]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "os_option_property_list": {"key": "properties.osOptionPropertyList", "type": "[OSOptionProperty]"}, } - def __init__( - self, - *, - os_option_property_list: List["_models.OSOptionProperty"], - **kwargs - ): + def __init__(self, *, os_option_property_list: List["_models.OSOptionProperty"], **kwargs): """ - :keyword os_option_property_list: Required. The list of OS options. + :keyword os_option_property_list: The list of OS options. Required. :paramtype os_option_property_list: list[~azure.mgmt.containerservice.v2022_05_02_preview.models.OSOptionProperty] """ - super(OSOptionProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None self.os_option_property_list = os_option_property_list -class OSOptionProperty(msrest.serialization.Model): +class OSOptionProperty(_serialization.Model): """OS option property. All required parameters must be populated in order to send to Azure. - :ivar os_type: Required. The OS type. + :ivar os_type: The OS type. Required. :vartype os_type: str - :ivar enable_fips_image: Required. Whether the image is FIPS-enabled. + :ivar enable_fips_image: Whether the image is FIPS-enabled. Required. :vartype enable_fips_image: bool """ _validation = { - 'os_type': {'required': True}, - 'enable_fips_image': {'required': True}, + "os_type": {"required": True}, + "enable_fips_image": {"required": True}, } _attribute_map = { - 'os_type': {'key': 'os-type', 'type': 'str'}, - 'enable_fips_image': {'key': 'enable-fips-image', 'type': 'bool'}, + "os_type": {"key": "os-type", "type": "str"}, + "enable_fips_image": {"key": "enable-fips-image", "type": "bool"}, } - def __init__( - self, - *, - os_type: str, - enable_fips_image: bool, - **kwargs - ): + def __init__(self, *, os_type: str, enable_fips_image: bool, **kwargs): """ - :keyword os_type: Required. The OS type. + :keyword os_type: The OS type. Required. :paramtype os_type: str - :keyword enable_fips_image: Required. Whether the image is FIPS-enabled. + :keyword enable_fips_image: Whether the image is FIPS-enabled. Required. :paramtype enable_fips_image: bool """ - super(OSOptionProperty, self).__init__(**kwargs) + super().__init__(**kwargs) self.os_type = os_type self.enable_fips_image = enable_fips_image -class OutboundEnvironmentEndpoint(msrest.serialization.Model): +class OutboundEnvironmentEndpoint(_serialization.Model): """Egress endpoints which AKS agent nodes connect to for common purpose. :ivar category: The category of endpoints accessed by the AKS agent node, e.g. @@ -5847,8 +5689,8 @@ class OutboundEnvironmentEndpoint(msrest.serialization.Model): """ _attribute_map = { - 'category': {'key': 'category', 'type': 'str'}, - 'endpoints': {'key': 'endpoints', 'type': '[EndpointDependency]'}, + "category": {"key": "category", "type": "str"}, + "endpoints": {"key": "endpoints", "type": "[EndpointDependency]"}, } def __init__( @@ -5866,19 +5708,19 @@ def __init__( :paramtype endpoints: list[~azure.mgmt.containerservice.v2022_05_02_preview.models.EndpointDependency] """ - super(OutboundEnvironmentEndpoint, self).__init__(**kwargs) + super().__init__(**kwargs) self.category = category self.endpoints = endpoints -class OutboundEnvironmentEndpointCollection(msrest.serialization.Model): +class OutboundEnvironmentEndpointCollection(_serialization.Model): """Collection of OutboundEnvironmentEndpoint. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar value: Required. Collection of resources. + :ivar value: Collection of resources. Required. :vartype value: list[~azure.mgmt.containerservice.v2022_05_02_preview.models.OutboundEnvironmentEndpoint] :ivar next_link: Link to next page of resources. @@ -5886,59 +5728,49 @@ class OutboundEnvironmentEndpointCollection(msrest.serialization.Model): """ _validation = { - 'value': {'required': True}, - 'next_link': {'readonly': True}, + "value": {"required": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[OutboundEnvironmentEndpoint]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[OutboundEnvironmentEndpoint]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: List["_models.OutboundEnvironmentEndpoint"], - **kwargs - ): + def __init__(self, *, value: List["_models.OutboundEnvironmentEndpoint"], **kwargs): """ - :keyword value: Required. Collection of resources. + :keyword value: Collection of resources. Required. :paramtype value: list[~azure.mgmt.containerservice.v2022_05_02_preview.models.OutboundEnvironmentEndpoint] """ - super(OutboundEnvironmentEndpointCollection, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class PowerState(msrest.serialization.Model): +class PowerState(_serialization.Model): """Describes the Power State of the cluster. - :ivar code: Tells whether the cluster is Running or Stopped. Known values are: "Running", + :ivar code: Tells whether the cluster is Running or Stopped. Known values are: "Running" and "Stopped". :vartype code: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.Code """ _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, + "code": {"key": "code", "type": "str"}, } - def __init__( - self, - *, - code: Optional[Union[str, "_models.Code"]] = None, - **kwargs - ): + def __init__(self, *, code: Optional[Union[str, "_models.Code"]] = None, **kwargs): """ - :keyword code: Tells whether the cluster is Running or Stopped. Known values are: "Running", + :keyword code: Tells whether the cluster is Running or Stopped. Known values are: "Running" and "Stopped". :paramtype code: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.Code """ - super(PowerState, self).__init__(**kwargs) + super().__init__(**kwargs) self.code = code -class PrivateEndpoint(msrest.serialization.Model): +class PrivateEndpoint(_serialization.Model): """Private endpoint which a connection belongs to. :ivar id: The resource ID of the private endpoint. @@ -5946,24 +5778,19 @@ class PrivateEndpoint(msrest.serialization.Model): """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, } - def __init__( - self, - *, - id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin """ :keyword id: The resource ID of the private endpoint. :paramtype id: str """ - super(PrivateEndpoint, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id -class PrivateEndpointConnection(msrest.serialization.Model): +class PrivateEndpointConnection(_serialization.Model): """A private endpoint connection. Variables are only populated by the server, and will be ignored when sending a request. @@ -5975,7 +5802,7 @@ class PrivateEndpointConnection(msrest.serialization.Model): :ivar type: The resource type. :vartype type: str :ivar provisioning_state: The current provisioning state. Known values are: "Succeeded", - "Creating", "Deleting", "Failed". + "Creating", "Deleting", and "Failed". :vartype provisioning_state: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.PrivateEndpointConnectionProvisioningState :ivar private_endpoint: The resource of private endpoint. @@ -5988,19 +5815,22 @@ class PrivateEndpointConnection(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'provisioning_state': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, - 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "private_endpoint": {"key": "properties.privateEndpoint", "type": "PrivateEndpoint"}, + "private_link_service_connection_state": { + "key": "properties.privateLinkServiceConnectionState", + "type": "PrivateLinkServiceConnectionState", + }, } def __init__( @@ -6019,7 +5849,7 @@ def __init__( :paramtype private_link_service_connection_state: ~azure.mgmt.containerservice.v2022_05_02_preview.models.PrivateLinkServiceConnectionState """ - super(PrivateEndpointConnection, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -6028,7 +5858,7 @@ def __init__( self.private_link_service_connection_state = private_link_service_connection_state -class PrivateEndpointConnectionListResult(msrest.serialization.Model): +class PrivateEndpointConnectionListResult(_serialization.Model): """A list of private endpoint connections. :ivar value: The collection value. @@ -6037,25 +5867,20 @@ class PrivateEndpointConnectionListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, + "value": {"key": "value", "type": "[PrivateEndpointConnection]"}, } - def __init__( - self, - *, - value: Optional[List["_models.PrivateEndpointConnection"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.PrivateEndpointConnection"]] = None, **kwargs): """ :keyword value: The collection value. :paramtype value: list[~azure.mgmt.containerservice.v2022_05_02_preview.models.PrivateEndpointConnection] """ - super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value -class PrivateLinkResource(msrest.serialization.Model): +class PrivateLinkResource(_serialization.Model): """A private link resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -6076,22 +5901,22 @@ class PrivateLinkResource(msrest.serialization.Model): """ _validation = { - 'private_link_service_id': {'readonly': True}, + "private_link_service_id": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'group_id': {'key': 'groupId', 'type': 'str'}, - 'required_members': {'key': 'requiredMembers', 'type': '[str]'}, - 'private_link_service_id': {'key': 'privateLinkServiceID', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "group_id": {"key": "groupId", "type": "str"}, + "required_members": {"key": "requiredMembers", "type": "[str]"}, + "private_link_service_id": {"key": "privateLinkServiceID", "type": "str"}, } def __init__( self, *, - id: Optional[str] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin name: Optional[str] = None, type: Optional[str] = None, group_id: Optional[str] = None, @@ -6110,7 +5935,7 @@ def __init__( :keyword required_members: The RequiredMembers of the resource. :paramtype required_members: list[str] """ - super(PrivateLinkResource, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id self.name = name self.type = type @@ -6119,7 +5944,7 @@ def __init__( self.private_link_service_id = None -class PrivateLinkResourcesListResult(msrest.serialization.Model): +class PrivateLinkResourcesListResult(_serialization.Model): """A list of private link resources. :ivar value: The collection value. @@ -6128,29 +5953,24 @@ class PrivateLinkResourcesListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, + "value": {"key": "value", "type": "[PrivateLinkResource]"}, } - def __init__( - self, - *, - value: Optional[List["_models.PrivateLinkResource"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.PrivateLinkResource"]] = None, **kwargs): """ :keyword value: The collection value. :paramtype value: list[~azure.mgmt.containerservice.v2022_05_02_preview.models.PrivateLinkResource] """ - super(PrivateLinkResourcesListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value -class PrivateLinkServiceConnectionState(msrest.serialization.Model): +class PrivateLinkServiceConnectionState(_serialization.Model): """The state of a private link service connection. :ivar status: The private link service connection status. Known values are: "Pending", - "Approved", "Rejected", "Disconnected". + "Approved", "Rejected", and "Disconnected". :vartype status: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.ConnectionStatus :ivar description: The private link service connection description. @@ -6158,8 +5978,8 @@ class PrivateLinkServiceConnectionState(msrest.serialization.Model): """ _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, + "status": {"key": "status", "type": "str"}, + "description": {"key": "description", "type": "str"}, } def __init__( @@ -6171,18 +5991,18 @@ def __init__( ): """ :keyword status: The private link service connection status. Known values are: "Pending", - "Approved", "Rejected", "Disconnected". + "Approved", "Rejected", and "Disconnected". :paramtype status: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.ConnectionStatus :keyword description: The private link service connection description. :paramtype description: str """ - super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) + super().__init__(**kwargs) self.status = status self.description = description -class ResourceReference(msrest.serialization.Model): +class ResourceReference(_serialization.Model): """A reference to an Azure resource. :ivar id: The fully qualified Azure resource id. @@ -6190,29 +6010,24 @@ class ResourceReference(msrest.serialization.Model): """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, } - def __init__( - self, - *, - id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin """ :keyword id: The fully qualified Azure resource id. :paramtype id: str """ - super(ResourceReference, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id -class RunCommandRequest(msrest.serialization.Model): +class RunCommandRequest(_serialization.Model): """A run command request. All required parameters must be populated in order to send to Azure. - :ivar command: Required. The command to run. + :ivar command: The command to run. Required. :vartype command: str :ivar context: A base64 encoded zip file containing the files required by the command. :vartype context: str @@ -6221,38 +6036,31 @@ class RunCommandRequest(msrest.serialization.Model): """ _validation = { - 'command': {'required': True}, + "command": {"required": True}, } _attribute_map = { - 'command': {'key': 'command', 'type': 'str'}, - 'context': {'key': 'context', 'type': 'str'}, - 'cluster_token': {'key': 'clusterToken', 'type': 'str'}, + "command": {"key": "command", "type": "str"}, + "context": {"key": "context", "type": "str"}, + "cluster_token": {"key": "clusterToken", "type": "str"}, } - def __init__( - self, - *, - command: str, - context: Optional[str] = None, - cluster_token: Optional[str] = None, - **kwargs - ): + def __init__(self, *, command: str, context: Optional[str] = None, cluster_token: Optional[str] = None, **kwargs): """ - :keyword command: Required. The command to run. + :keyword command: The command to run. Required. :paramtype command: str :keyword context: A base64 encoded zip file containing the files required by the command. :paramtype context: str :keyword cluster_token: AuthToken issued for AKS AAD Server App. :paramtype cluster_token: str """ - super(RunCommandRequest, self).__init__(**kwargs) + super().__init__(**kwargs) self.command = command self.context = context self.cluster_token = cluster_token -class RunCommandResult(msrest.serialization.Model): +class RunCommandResult(_serialization.Model): """run command result. Variables are only populated by the server, and will be ignored when sending a request. @@ -6274,32 +6082,28 @@ class RunCommandResult(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'exit_code': {'readonly': True}, - 'started_at': {'readonly': True}, - 'finished_at': {'readonly': True}, - 'logs': {'readonly': True}, - 'reason': {'readonly': True}, + "id": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "exit_code": {"readonly": True}, + "started_at": {"readonly": True}, + "finished_at": {"readonly": True}, + "logs": {"readonly": True}, + "reason": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'exit_code': {'key': 'properties.exitCode', 'type': 'int'}, - 'started_at': {'key': 'properties.startedAt', 'type': 'iso-8601'}, - 'finished_at': {'key': 'properties.finishedAt', 'type': 'iso-8601'}, - 'logs': {'key': 'properties.logs', 'type': 'str'}, - 'reason': {'key': 'properties.reason', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(RunCommandResult, self).__init__(**kwargs) + "id": {"key": "id", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "exit_code": {"key": "properties.exitCode", "type": "int"}, + "started_at": {"key": "properties.startedAt", "type": "iso-8601"}, + "finished_at": {"key": "properties.finishedAt", "type": "iso-8601"}, + "logs": {"key": "properties.logs", "type": "str"}, + "reason": {"key": "properties.reason", "type": "str"}, + } + + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.id = None self.provisioning_state = None self.exit_code = None @@ -6309,7 +6113,7 @@ def __init__( self.reason = None -class Snapshot(TrackedResource): +class Snapshot(TrackedResource): # pylint: disable=too-many-instance-attributes """A node pool snapshot resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -6327,28 +6131,28 @@ class Snapshot(TrackedResource): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.containerservice.v2022_05_02_preview.models.SystemData - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] - :ivar location: Required. The geo-location where the resource lives. + :ivar location: The geo-location where the resource lives. Required. :vartype location: str :ivar creation_data: CreationData to be used to specify the source agent pool resource ID to create this snapshot. :vartype creation_data: ~azure.mgmt.containerservice.v2022_05_02_preview.models.CreationData :ivar snapshot_type: The type of a snapshot. The default is NodePool. Known values are: - "NodePool", "ManagedCluster". Default value: "NodePool". + "NodePool" and "ManagedCluster". :vartype snapshot_type: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.SnapshotType :ivar kubernetes_version: The version of Kubernetes. :vartype kubernetes_version: str :ivar node_image_version: The version of node image. :vartype node_image_version: str - :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.OSType :ivar os_sku: Specifies the OS SKU used by the agent pool. If not specified, the default is Ubuntu if OSType=Linux or Windows2019 if OSType=Windows. And the default Windows OSSKU will be changed to Windows2022 after Windows2019 is deprecated. Known values are: "Ubuntu", - "CBLMariner", "Windows2019", "Windows2022". + "CBLMariner", "Windows2019", and "Windows2022". :vartype os_sku: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.OSSKU :ivar vm_size: The size of the VM. :vartype vm_size: str @@ -6357,34 +6161,34 @@ class Snapshot(TrackedResource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'location': {'required': True}, - 'kubernetes_version': {'readonly': True}, - 'node_image_version': {'readonly': True}, - 'os_type': {'readonly': True}, - 'os_sku': {'readonly': True}, - 'vm_size': {'readonly': True}, - 'enable_fips': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, + "kubernetes_version": {"readonly": True}, + "node_image_version": {"readonly": True}, + "os_type": {"readonly": True}, + "os_sku": {"readonly": True}, + "vm_size": {"readonly": True}, + "enable_fips": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - 'creation_data': {'key': 'properties.creationData', 'type': 'CreationData'}, - 'snapshot_type': {'key': 'properties.snapshotType', 'type': 'str'}, - 'kubernetes_version': {'key': 'properties.kubernetesVersion', 'type': 'str'}, - 'node_image_version': {'key': 'properties.nodeImageVersion', 'type': 'str'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'os_sku': {'key': 'properties.osSku', 'type': 'str'}, - 'vm_size': {'key': 'properties.vmSize', 'type': 'str'}, - 'enable_fips': {'key': 'properties.enableFIPS', 'type': 'bool'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "creation_data": {"key": "properties.creationData", "type": "CreationData"}, + "snapshot_type": {"key": "properties.snapshotType", "type": "str"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "node_image_version": {"key": "properties.nodeImageVersion", "type": "str"}, + "os_type": {"key": "properties.osType", "type": "str"}, + "os_sku": {"key": "properties.osSku", "type": "str"}, + "vm_size": {"key": "properties.vmSize", "type": "str"}, + "enable_fips": {"key": "properties.enableFIPS", "type": "bool"}, } def __init__( @@ -6393,23 +6197,23 @@ def __init__( location: str, tags: Optional[Dict[str, str]] = None, creation_data: Optional["_models.CreationData"] = None, - snapshot_type: Optional[Union[str, "_models.SnapshotType"]] = "NodePool", + snapshot_type: Union[str, "_models.SnapshotType"] = "NodePool", **kwargs ): """ - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] - :keyword location: Required. The geo-location where the resource lives. + :keyword location: The geo-location where the resource lives. Required. :paramtype location: str :keyword creation_data: CreationData to be used to specify the source agent pool resource ID to create this snapshot. :paramtype creation_data: ~azure.mgmt.containerservice.v2022_05_02_preview.models.CreationData :keyword snapshot_type: The type of a snapshot. The default is NodePool. Known values are: - "NodePool", "ManagedCluster". Default value: "NodePool". + "NodePool" and "ManagedCluster". :paramtype snapshot_type: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.SnapshotType """ - super(Snapshot, self).__init__(tags=tags, location=location, **kwargs) + super().__init__(tags=tags, location=location, **kwargs) self.creation_data = creation_data self.snapshot_type = snapshot_type self.kubernetes_version = None @@ -6420,7 +6224,7 @@ def __init__( self.enable_fips = None -class SnapshotListResult(msrest.serialization.Model): +class SnapshotListResult(_serialization.Model): """The response from the List Snapshots operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -6432,30 +6236,25 @@ class SnapshotListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[Snapshot]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[Snapshot]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.Snapshot"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.Snapshot"]] = None, **kwargs): """ :keyword value: The list of snapshots. :paramtype value: list[~azure.mgmt.containerservice.v2022_05_02_preview.models.Snapshot] """ - super(SnapshotListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class SysctlConfig(msrest.serialization.Model): +class SysctlConfig(_serialization.Model): # pylint: disable=too-many-instance-attributes """Sysctl settings for Linux agent nodes. :ivar net_core_somaxconn: Sysctl setting net.core.somaxconn. @@ -6517,37 +6316,37 @@ class SysctlConfig(msrest.serialization.Model): """ _attribute_map = { - 'net_core_somaxconn': {'key': 'netCoreSomaxconn', 'type': 'int'}, - 'net_core_netdev_max_backlog': {'key': 'netCoreNetdevMaxBacklog', 'type': 'int'}, - 'net_core_rmem_default': {'key': 'netCoreRmemDefault', 'type': 'int'}, - 'net_core_rmem_max': {'key': 'netCoreRmemMax', 'type': 'int'}, - 'net_core_wmem_default': {'key': 'netCoreWmemDefault', 'type': 'int'}, - 'net_core_wmem_max': {'key': 'netCoreWmemMax', 'type': 'int'}, - 'net_core_optmem_max': {'key': 'netCoreOptmemMax', 'type': 'int'}, - 'net_ipv4_tcp_max_syn_backlog': {'key': 'netIpv4TcpMaxSynBacklog', 'type': 'int'}, - 'net_ipv4_tcp_max_tw_buckets': {'key': 'netIpv4TcpMaxTwBuckets', 'type': 'int'}, - 'net_ipv4_tcp_fin_timeout': {'key': 'netIpv4TcpFinTimeout', 'type': 'int'}, - 'net_ipv4_tcp_keepalive_time': {'key': 'netIpv4TcpKeepaliveTime', 'type': 'int'}, - 'net_ipv4_tcp_keepalive_probes': {'key': 'netIpv4TcpKeepaliveProbes', 'type': 'int'}, - 'net_ipv4_tcpkeepalive_intvl': {'key': 'netIpv4TcpkeepaliveIntvl', 'type': 'int'}, - 'net_ipv4_tcp_tw_reuse': {'key': 'netIpv4TcpTwReuse', 'type': 'bool'}, - 'net_ipv4_ip_local_port_range': {'key': 'netIpv4IpLocalPortRange', 'type': 'str'}, - 'net_ipv4_neigh_default_gc_thresh1': {'key': 'netIpv4NeighDefaultGcThresh1', 'type': 'int'}, - 'net_ipv4_neigh_default_gc_thresh2': {'key': 'netIpv4NeighDefaultGcThresh2', 'type': 'int'}, - 'net_ipv4_neigh_default_gc_thresh3': {'key': 'netIpv4NeighDefaultGcThresh3', 'type': 'int'}, - 'net_netfilter_nf_conntrack_max': {'key': 'netNetfilterNfConntrackMax', 'type': 'int'}, - 'net_netfilter_nf_conntrack_buckets': {'key': 'netNetfilterNfConntrackBuckets', 'type': 'int'}, - 'fs_inotify_max_user_watches': {'key': 'fsInotifyMaxUserWatches', 'type': 'int'}, - 'fs_file_max': {'key': 'fsFileMax', 'type': 'int'}, - 'fs_aio_max_nr': {'key': 'fsAioMaxNr', 'type': 'int'}, - 'fs_nr_open': {'key': 'fsNrOpen', 'type': 'int'}, - 'kernel_threads_max': {'key': 'kernelThreadsMax', 'type': 'int'}, - 'vm_max_map_count': {'key': 'vmMaxMapCount', 'type': 'int'}, - 'vm_swappiness': {'key': 'vmSwappiness', 'type': 'int'}, - 'vm_vfs_cache_pressure': {'key': 'vmVfsCachePressure', 'type': 'int'}, - } - - def __init__( + "net_core_somaxconn": {"key": "netCoreSomaxconn", "type": "int"}, + "net_core_netdev_max_backlog": {"key": "netCoreNetdevMaxBacklog", "type": "int"}, + "net_core_rmem_default": {"key": "netCoreRmemDefault", "type": "int"}, + "net_core_rmem_max": {"key": "netCoreRmemMax", "type": "int"}, + "net_core_wmem_default": {"key": "netCoreWmemDefault", "type": "int"}, + "net_core_wmem_max": {"key": "netCoreWmemMax", "type": "int"}, + "net_core_optmem_max": {"key": "netCoreOptmemMax", "type": "int"}, + "net_ipv4_tcp_max_syn_backlog": {"key": "netIpv4TcpMaxSynBacklog", "type": "int"}, + "net_ipv4_tcp_max_tw_buckets": {"key": "netIpv4TcpMaxTwBuckets", "type": "int"}, + "net_ipv4_tcp_fin_timeout": {"key": "netIpv4TcpFinTimeout", "type": "int"}, + "net_ipv4_tcp_keepalive_time": {"key": "netIpv4TcpKeepaliveTime", "type": "int"}, + "net_ipv4_tcp_keepalive_probes": {"key": "netIpv4TcpKeepaliveProbes", "type": "int"}, + "net_ipv4_tcpkeepalive_intvl": {"key": "netIpv4TcpkeepaliveIntvl", "type": "int"}, + "net_ipv4_tcp_tw_reuse": {"key": "netIpv4TcpTwReuse", "type": "bool"}, + "net_ipv4_ip_local_port_range": {"key": "netIpv4IpLocalPortRange", "type": "str"}, + "net_ipv4_neigh_default_gc_thresh1": {"key": "netIpv4NeighDefaultGcThresh1", "type": "int"}, + "net_ipv4_neigh_default_gc_thresh2": {"key": "netIpv4NeighDefaultGcThresh2", "type": "int"}, + "net_ipv4_neigh_default_gc_thresh3": {"key": "netIpv4NeighDefaultGcThresh3", "type": "int"}, + "net_netfilter_nf_conntrack_max": {"key": "netNetfilterNfConntrackMax", "type": "int"}, + "net_netfilter_nf_conntrack_buckets": {"key": "netNetfilterNfConntrackBuckets", "type": "int"}, + "fs_inotify_max_user_watches": {"key": "fsInotifyMaxUserWatches", "type": "int"}, + "fs_file_max": {"key": "fsFileMax", "type": "int"}, + "fs_aio_max_nr": {"key": "fsAioMaxNr", "type": "int"}, + "fs_nr_open": {"key": "fsNrOpen", "type": "int"}, + "kernel_threads_max": {"key": "kernelThreadsMax", "type": "int"}, + "vm_max_map_count": {"key": "vmMaxMapCount", "type": "int"}, + "vm_swappiness": {"key": "vmSwappiness", "type": "int"}, + "vm_vfs_cache_pressure": {"key": "vmVfsCachePressure", "type": "int"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, net_core_somaxconn: Optional[int] = None, @@ -6638,7 +6437,7 @@ def __init__( :keyword vm_vfs_cache_pressure: Sysctl setting vm.vfs_cache_pressure. :paramtype vm_vfs_cache_pressure: int """ - super(SysctlConfig, self).__init__(**kwargs) + super().__init__(**kwargs) self.net_core_somaxconn = net_core_somaxconn self.net_core_netdev_max_backlog = net_core_netdev_max_backlog self.net_core_rmem_default = net_core_rmem_default @@ -6669,13 +6468,13 @@ def __init__( self.vm_vfs_cache_pressure = vm_vfs_cache_pressure -class SystemData(msrest.serialization.Model): +class SystemData(_serialization.Model): """Metadata pertaining to creation and last modification of the resource. :ivar created_by: The identity that created the resource. :vartype created_by: str :ivar created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", "Key". + "User", "Application", "ManagedIdentity", and "Key". :vartype created_by_type: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.CreatedByType :ivar created_at: The timestamp of resource creation (UTC). @@ -6683,7 +6482,7 @@ class SystemData(msrest.serialization.Model): :ivar last_modified_by: The identity that last modified the resource. :vartype last_modified_by: str :ivar last_modified_by_type: The type of identity that last modified the resource. Known values - are: "User", "Application", "ManagedIdentity", "Key". + are: "User", "Application", "ManagedIdentity", and "Key". :vartype last_modified_by_type: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.CreatedByType :ivar last_modified_at: The timestamp of resource last modification (UTC). @@ -6691,12 +6490,12 @@ class SystemData(msrest.serialization.Model): """ _attribute_map = { - 'created_by': {'key': 'createdBy', 'type': 'str'}, - 'created_by_type': {'key': 'createdByType', 'type': 'str'}, - 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, - 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, - 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, - 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + "created_by": {"key": "createdBy", "type": "str"}, + "created_by_type": {"key": "createdByType", "type": "str"}, + "created_at": {"key": "createdAt", "type": "iso-8601"}, + "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, + "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, + "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, } def __init__( @@ -6714,7 +6513,7 @@ def __init__( :keyword created_by: The identity that created the resource. :paramtype created_by: str :keyword created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", "Key". + "User", "Application", "ManagedIdentity", and "Key". :paramtype created_by_type: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.CreatedByType :keyword created_at: The timestamp of resource creation (UTC). @@ -6722,13 +6521,13 @@ def __init__( :keyword last_modified_by: The identity that last modified the resource. :paramtype last_modified_by: str :keyword last_modified_by_type: The type of identity that last modified the resource. Known - values are: "User", "Application", "ManagedIdentity", "Key". + values are: "User", "Application", "ManagedIdentity", and "Key". :paramtype last_modified_by_type: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.CreatedByType :keyword last_modified_at: The timestamp of resource last modification (UTC). :paramtype last_modified_at: ~datetime.datetime """ - super(SystemData, self).__init__(**kwargs) + super().__init__(**kwargs) self.created_by = created_by self.created_by_type = created_by_type self.created_at = created_at @@ -6737,36 +6536,31 @@ def __init__( self.last_modified_at = last_modified_at -class TagsObject(msrest.serialization.Model): +class TagsObject(_serialization.Model): """Tags object for patch operations. - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] """ _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] """ - super(TagsObject, self).__init__(**kwargs) + super().__init__(**kwargs) self.tags = tags -class TimeInWeek(msrest.serialization.Model): +class TimeInWeek(_serialization.Model): """Time in a week. :ivar day: The day of the week. Known values are: "Sunday", "Monday", "Tuesday", "Wednesday", - "Thursday", "Friday", "Saturday". + "Thursday", "Friday", and "Saturday". :vartype day: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.WeekDay :ivar hour_slots: Each integer hour represents a time range beginning at 0m after the hour ending at the next hour (non-inclusive). 0 corresponds to 00:00 UTC, 23 corresponds to 23:00 @@ -6775,32 +6569,28 @@ class TimeInWeek(msrest.serialization.Model): """ _attribute_map = { - 'day': {'key': 'day', 'type': 'str'}, - 'hour_slots': {'key': 'hourSlots', 'type': '[int]'}, + "day": {"key": "day", "type": "str"}, + "hour_slots": {"key": "hourSlots", "type": "[int]"}, } def __init__( - self, - *, - day: Optional[Union[str, "_models.WeekDay"]] = None, - hour_slots: Optional[List[int]] = None, - **kwargs + self, *, day: Optional[Union[str, "_models.WeekDay"]] = None, hour_slots: Optional[List[int]] = None, **kwargs ): """ :keyword day: The day of the week. Known values are: "Sunday", "Monday", "Tuesday", - "Wednesday", "Thursday", "Friday", "Saturday". + "Wednesday", "Thursday", "Friday", and "Saturday". :paramtype day: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.WeekDay :keyword hour_slots: Each integer hour represents a time range beginning at 0m after the hour ending at the next hour (non-inclusive). 0 corresponds to 00:00 UTC, 23 corresponds to 23:00 UTC. Specifying [0, 1] means the 00:00 - 02:00 UTC time range. :paramtype hour_slots: list[int] """ - super(TimeInWeek, self).__init__(**kwargs) + super().__init__(**kwargs) self.day = day self.hour_slots = hour_slots -class TimeSpan(msrest.serialization.Model): +class TimeSpan(_serialization.Model): """For example, between 2021-05-25T13:00:00Z and 2021-05-25T14:00:00Z. :ivar start: The start of a time span. @@ -6810,29 +6600,23 @@ class TimeSpan(msrest.serialization.Model): """ _attribute_map = { - 'start': {'key': 'start', 'type': 'iso-8601'}, - 'end': {'key': 'end', 'type': 'iso-8601'}, + "start": {"key": "start", "type": "iso-8601"}, + "end": {"key": "end", "type": "iso-8601"}, } - def __init__( - self, - *, - start: Optional[datetime.datetime] = None, - end: Optional[datetime.datetime] = None, - **kwargs - ): + def __init__(self, *, start: Optional[datetime.datetime] = None, end: Optional[datetime.datetime] = None, **kwargs): """ :keyword start: The start of a time span. :paramtype start: ~datetime.datetime :keyword end: The end of a time span. :paramtype end: ~datetime.datetime """ - super(TimeSpan, self).__init__(**kwargs) + super().__init__(**kwargs) self.start = start self.end = end -class TrustedAccessRole(msrest.serialization.Model): +class TrustedAccessRole(_serialization.Model): """Trusted access role definition. Variables are only populated by the server, and will be ignored when sending a request. @@ -6849,24 +6633,20 @@ class TrustedAccessRole(msrest.serialization.Model): """ _validation = { - 'source_resource_type': {'readonly': True}, - 'name': {'readonly': True}, - 'rules': {'readonly': True}, + "source_resource_type": {"readonly": True}, + "name": {"readonly": True}, + "rules": {"readonly": True}, } _attribute_map = { - 'source_resource_type': {'key': 'sourceResourceType', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'rules': {'key': 'rules', 'type': '[TrustedAccessRoleRule]'}, + "source_resource_type": {"key": "sourceResourceType", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "rules": {"key": "rules", "type": "[TrustedAccessRoleRule]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(TrustedAccessRole, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.source_resource_type = None self.name = None self.rules = None @@ -6891,59 +6671,53 @@ class TrustedAccessRoleBinding(Resource): information. :vartype system_data: ~azure.mgmt.containerservice.v2022_05_02_preview.models.SystemData :ivar provisioning_state: The current provisioning state of trusted access role binding. Known - values are: "Succeeded", "Failed", "Updating", "Deleting". + values are: "Succeeded", "Failed", "Updating", and "Deleting". :vartype provisioning_state: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.TrustedAccessRoleBindingProvisioningState - :ivar source_resource_id: Required. The ARM resource ID of source resource that trusted access - is configured for. + :ivar source_resource_id: The ARM resource ID of source resource that trusted access is + configured for. Required. :vartype source_resource_id: str - :ivar roles: Required. A list of roles to bind, each item is a resource type qualified role - name. For example: 'Microsoft.MachineLearningServices/workspaces/reader'. + :ivar roles: A list of roles to bind, each item is a resource type qualified role name. For + example: 'Microsoft.MachineLearningServices/workspaces/reader'. Required. :vartype roles: list[str] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'source_resource_id': {'required': True}, - 'roles': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "source_resource_id": {"required": True}, + "roles": {"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'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'source_resource_id': {'key': 'properties.sourceResourceId', 'type': 'str'}, - 'roles': {'key': 'properties.roles', 'type': '[str]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "source_resource_id": {"key": "properties.sourceResourceId", "type": "str"}, + "roles": {"key": "properties.roles", "type": "[str]"}, } - def __init__( - self, - *, - source_resource_id: str, - roles: List[str], - **kwargs - ): + def __init__(self, *, source_resource_id: str, roles: List[str], **kwargs): """ - :keyword source_resource_id: Required. The ARM resource ID of source resource that trusted - access is configured for. + :keyword source_resource_id: The ARM resource ID of source resource that trusted access is + configured for. Required. :paramtype source_resource_id: str - :keyword roles: Required. A list of roles to bind, each item is a resource type qualified role - name. For example: 'Microsoft.MachineLearningServices/workspaces/reader'. + :keyword roles: A list of roles to bind, each item is a resource type qualified role name. For + example: 'Microsoft.MachineLearningServices/workspaces/reader'. Required. :paramtype roles: list[str] """ - super(TrustedAccessRoleBinding, self).__init__(**kwargs) + super().__init__(**kwargs) self.provisioning_state = None self.source_resource_id = source_resource_id self.roles = roles -class TrustedAccessRoleBindingListResult(msrest.serialization.Model): +class TrustedAccessRoleBindingListResult(_serialization.Model): """List of trusted access role bindings. Variables are only populated by the server, and will be ignored when sending a request. @@ -6956,31 +6730,26 @@ class TrustedAccessRoleBindingListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[TrustedAccessRoleBinding]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[TrustedAccessRoleBinding]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.TrustedAccessRoleBinding"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.TrustedAccessRoleBinding"]] = None, **kwargs): """ :keyword value: Role binding list. :paramtype value: list[~azure.mgmt.containerservice.v2022_05_02_preview.models.TrustedAccessRoleBinding] """ - super(TrustedAccessRoleBindingListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class TrustedAccessRoleListResult(msrest.serialization.Model): +class TrustedAccessRoleListResult(_serialization.Model): """List of trusted access roles. Variables are only populated by the server, and will be ignored when sending a request. @@ -6992,27 +6761,23 @@ class TrustedAccessRoleListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[TrustedAccessRole]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[TrustedAccessRole]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(TrustedAccessRoleListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class TrustedAccessRoleRule(msrest.serialization.Model): +class TrustedAccessRoleRule(_serialization.Model): """Rule for trusted access role. Variables are only populated by the server, and will be ignored when sending a request. @@ -7030,28 +6795,24 @@ class TrustedAccessRoleRule(msrest.serialization.Model): """ _validation = { - 'verbs': {'readonly': True}, - 'api_groups': {'readonly': True}, - 'resources': {'readonly': True}, - 'resource_names': {'readonly': True}, - 'non_resource_ur_ls': {'readonly': True}, + "verbs": {"readonly": True}, + "api_groups": {"readonly": True}, + "resources": {"readonly": True}, + "resource_names": {"readonly": True}, + "non_resource_ur_ls": {"readonly": True}, } _attribute_map = { - 'verbs': {'key': 'verbs', 'type': '[str]'}, - 'api_groups': {'key': 'apiGroups', 'type': '[str]'}, - 'resources': {'key': 'resources', 'type': '[str]'}, - 'resource_names': {'key': 'resourceNames', 'type': '[str]'}, - 'non_resource_ur_ls': {'key': 'nonResourceURLs', 'type': '[str]'}, + "verbs": {"key": "verbs", "type": "[str]"}, + "api_groups": {"key": "apiGroups", "type": "[str]"}, + "resources": {"key": "resources", "type": "[str]"}, + "resource_names": {"key": "resourceNames", "type": "[str]"}, + "non_resource_ur_ls": {"key": "nonResourceURLs", "type": "[str]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(TrustedAccessRoleRule, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.verbs = None self.api_groups = None self.resources = None @@ -7059,7 +6820,7 @@ def __init__( self.non_resource_ur_ls = None -class WindowsGmsaProfile(msrest.serialization.Model): +class WindowsGmsaProfile(_serialization.Model): """Windows gMSA Profile in the managed cluster. :ivar enabled: Specifies whether to enable Windows gMSA in the managed cluster. @@ -7075,9 +6836,9 @@ class WindowsGmsaProfile(msrest.serialization.Model): """ _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'dns_server': {'key': 'dnsServer', 'type': 'str'}, - 'root_domain_name': {'key': 'rootDomainName', 'type': 'str'}, + "enabled": {"key": "enabled", "type": "bool"}, + "dns_server": {"key": "dnsServer", "type": "str"}, + "root_domain_name": {"key": "rootDomainName", "type": "str"}, } def __init__( @@ -7100,7 +6861,7 @@ def __init__( which is used to create the managed cluster. :paramtype root_domain_name: str """ - super(WindowsGmsaProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.dns_server = dns_server self.root_domain_name = root_domain_name diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/models/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/models/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/models/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/models/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/__init__.py index fe53dc12e778..6a931af99fa3 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/__init__.py @@ -21,18 +21,19 @@ from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'Operations', - 'ManagedClustersOperations', - 'MaintenanceConfigurationsOperations', - 'AgentPoolsOperations', - 'PrivateEndpointConnectionsOperations', - 'PrivateLinkResourcesOperations', - 'ResolvePrivateLinkServiceIdOperations', - 'SnapshotsOperations', - 'ManagedClusterSnapshotsOperations', - 'TrustedAccessRolesOperations', - 'TrustedAccessRoleBindingsOperations', + "Operations", + "ManagedClustersOperations", + "MaintenanceConfigurationsOperations", + "AgentPoolsOperations", + "PrivateEndpointConnectionsOperations", + "PrivateLinkResourcesOperations", + "ResolvePrivateLinkServiceIdOperations", + "SnapshotsOperations", + "ManagedClusterSnapshotsOperations", + "TrustedAccessRolesOperations", + "TrustedAccessRoleBindingsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/_agent_pools_operations.py index 010aab4a6335..d057ede8e933 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/_agent_pools_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,141 +27,146 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - *, - json: Optional[_models.AgentPool] = None, - content: Any = None, - **kwargs: Any +def build_create_or_update_request( + resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request_initial( - subscription_id: str, +def build_delete_request( resource_group_name: str, resource_name: str, agent_pool_name: str, + subscription_id: str, *, ignore_pod_disruption_budget: Optional[bool] = None, **kwargs: Any @@ -164,150 +174,166 @@ def build_delete_request_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if ignore_pod_disruption_budget is not None: - _params['ignore-pod-disruption-budget'] = _SERIALIZER.query("ignore_pod_disruption_budget", ignore_pod_disruption_budget, 'bool') + _params["ignore-pod-disruption-budget"] = _SERIALIZER.query( + "ignore_pod_disruption_budget", ignore_pod_disruption_budget, "bool" + ) # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_get_upgrade_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_available_agent_pool_versions_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_upgrade_node_image_version_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any +def build_upgrade_node_image_version_request( + resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class AgentPoolsOperations: """ @@ -328,47 +354,41 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> Iterable[_models.AgentPoolListResult]: + def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> Iterable["_models.AgentPool"]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AgentPoolListResult or the result of cls(response) + :return: An iterator like instance of either AgentPool or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_05_02_preview.models.AgentPoolListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_05_02_preview.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -376,16 +396,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -401,10 +416,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -414,54 +427,46 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore @distributed_trace def get( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPool: """Gets the specified managed cluster agent pool. Gets the specified managed cluster agent pool. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPool, or the result of cls(response) + :return: AgentPool or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.AgentPool - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -469,57 +474,60 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore def _create_or_update_initial( self, resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: _models.AgentPool, + parameters: Union[_models.AgentPool, IO], **kwargs: Any ) -> _models.AgentPool: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - _json = self._serialize.body(parameters, 'AgentPool') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "AgentPool") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -527,10 +535,9 @@ def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -538,26 +545,27 @@ def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - - @distributed_trace + @overload def begin_create_or_update( self, resource_group_name: str, resource_name: str, agent_pool_name: str, parameters: _models.AgentPool, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.AgentPool]: """Creates or updates an agent pool in the specified managed cluster. @@ -565,13 +573,17 @@ def begin_create_or_update( Creates or updates an agent pool in the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str - :param parameters: The agent pool to create or update. + :param parameters: The agent pool to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_05_02_preview.models.AgentPool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -583,20 +595,98 @@ def begin_create_or_update( :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_05_02_preview.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AgentPool]: + """Creates or updates an agent pool in the specified managed cluster. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: The agent pool to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_05_02_preview.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: Union[_models.AgentPool, IO], + **kwargs: Any + ) -> LROPoller[_models.AgentPool]: + """Creates or updates an agent pool in the specified managed cluster. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: The agent pool to create or update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.mgmt.containerservice.v2022_05_02_preview.models.AgentPool or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_05_02_preview.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -605,39 +695,35 @@ def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements self, @@ -647,26 +733,23 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements ignore_pod_disruption_budget: Optional[bool] = None, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, - api_version=api_version, + subscription_id=self._config.subscription_id, ignore_pod_disruption_budget=ignore_pod_disruption_budget, - template_url=self._delete_initial.metadata['url'], + api_version=api_version, + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -674,10 +757,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -687,11 +769,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements + def begin_delete( self, resource_group_name: str, resource_name: str, @@ -704,10 +785,11 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Deletes an agent pool in the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :param ignore_pod_disruption_budget: ignore-pod-disruption-budget=true to delete those pods on a node without considering Pod Disruption Budget. Default value is None. @@ -722,19 +804,16 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -742,80 +821,70 @@ def begin_delete( # pylint: disable=inconsistent-return-statements agent_pool_name=agent_pool_name, ignore_pod_disruption_budget=ignore_pod_disruption_budget, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPoolUpgradeProfile: """Gets the upgrade profile for an agent pool. Gets the upgrade profile for an agent pool. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolUpgradeProfile, or the result of cls(response) + :return: AgentPoolUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.AgentPoolUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -823,32 +892,27 @@ def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolUpgradeProfile', pipeline_response) + deserialized = self._deserialize("AgentPoolUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore @distributed_trace def get_available_agent_pool_versions( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported Kubernetes versions for the specified agent pool. @@ -857,32 +921,30 @@ def get_available_agent_pool_versions( the version lifecycle. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolAvailableVersions, or the result of cls(response) + :return: AgentPoolAvailableVersions or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.AgentPoolAvailableVersions - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolAvailableVersions] - request = build_get_available_agent_pool_versions_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_available_agent_pool_versions.metadata['url'], + template_url=self.get_available_agent_pool_versions.metadata["url"], headers=_headers, params=_params, ) @@ -890,52 +952,43 @@ def get_available_agent_pool_versions( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolAvailableVersions', pipeline_response) + deserialized = self._deserialize("AgentPoolAvailableVersions", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_available_agent_pool_versions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore - + get_available_agent_pool_versions.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore def _upgrade_node_image_version_initial( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> Optional[_models.AgentPool]: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.AgentPool]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.AgentPool]] - - request = build_upgrade_node_image_version_request_initial( - subscription_id=self._config.subscription_id, + request = build_upgrade_node_image_version_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._upgrade_node_image_version_initial.metadata['url'], + template_url=self._upgrade_node_image_version_initial.metadata["url"], headers=_headers, params=_params, ) @@ -943,10 +996,9 @@ def _upgrade_node_image_version_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -956,26 +1008,23 @@ def _upgrade_node_image_version_initial( deserialized = None response_headers = {} if response.status_code == 202: - response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) - - deserialized = self._deserialize('AgentPool', pipeline_response) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _upgrade_node_image_version_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore - + _upgrade_node_image_version_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore @distributed_trace def begin_upgrade_node_image_version( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any - ) -> LROPoller[_models.AgentPool]: + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any + ) -> LROPoller[None]: """Upgrades the node image version of an agent pool to the latest. Upgrading the node image version of an agent pool applies the newest OS and runtime updates to @@ -983,10 +1032,11 @@ def begin_upgrade_node_image_version( node image versions, see: https://docs.microsoft.com/azure/aks/node-image-upgrade. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -999,59 +1049,54 @@ def begin_upgrade_node_image_version( :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_05_02_preview.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._upgrade_node_image_version_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) - - deserialized = self._deserialize('AgentPool', pipeline_response) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_upgrade_node_image_version.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore + begin_upgrade_node_image_version.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/_maintenance_configurations_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/_maintenance_configurations_operations.py index bf84feb2dba5..c56d84584354 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/_maintenance_configurations_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/_maintenance_configurations_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,173 +25,181 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +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_managed_cluster_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, config_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "configName": _SERIALIZER.url("config_name", config_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "configName": _SERIALIZER.url("config_name", config_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - config_name: str, - *, - json: Optional[_models.MaintenanceConfiguration] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, resource_name: str, config_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "configName": _SERIALIZER.url("config_name", config_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "configName": _SERIALIZER.url("config_name", config_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, config_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "configName": _SERIALIZER.url("config_name", config_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "configName": _SERIALIZER.url("config_name", config_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class MaintenanceConfigurationsOperations: """ @@ -207,48 +220,44 @@ def __init__(self, *args, **kwargs): 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_managed_cluster( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> Iterable[_models.MaintenanceConfigurationListResult]: + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> Iterable["_models.MaintenanceConfiguration"]: """Gets a list of maintenance configurations in the specified managed cluster. Gets a list of maintenance configurations in the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either MaintenanceConfigurationListResult or the result - of cls(response) + :return: An iterator like instance of either MaintenanceConfiguration or the result of + cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_05_02_preview.models.MaintenanceConfigurationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_05_02_preview.models.MaintenanceConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfigurationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfigurationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_managed_cluster_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_managed_cluster.metadata['url'], + template_url=self.list_by_managed_cluster.metadata["url"], headers=_headers, params=_params, ) @@ -256,16 +265,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_managed_cluster_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -281,10 +285,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -294,54 +296,46 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_managed_cluster.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations"} # type: ignore + list_by_managed_cluster.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations"} # type: ignore @distributed_trace def get( - self, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, config_name: str, **kwargs: Any ) -> _models.MaintenanceConfiguration: """Gets the specified maintenance configuration of a managed cluster. Gets the specified maintenance configuration of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: MaintenanceConfiguration, or the result of cls(response) + :return: MaintenanceConfiguration or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.MaintenanceConfiguration - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfiguration] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -349,33 +343,33 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) + deserialized = self._deserialize("MaintenanceConfiguration", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - - @distributed_trace + @overload def create_or_update( self, resource_group_name: str, resource_name: str, config_name: str, parameters: _models.MaintenanceConfiguration, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.MaintenanceConfiguration: """Creates or updates a maintenance configuration in the specified managed cluster. @@ -383,42 +377,117 @@ def create_or_update( Creates or updates a maintenance configuration in the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str - :param parameters: The maintenance configuration to create or update. + :param parameters: The maintenance configuration to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_05_02_preview.models.MaintenanceConfiguration + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configuration in the specified managed cluster. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: The maintenance configuration to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: MaintenanceConfiguration, or the result of cls(response) + :return: MaintenanceConfiguration or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.MaintenanceConfiguration - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: Union[_models.MaintenanceConfiguration, IO], + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configuration in the specified managed cluster. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: The maintenance configuration to create or update. Is either a model type or + a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2022_05_02_preview.models.MaintenanceConfiguration or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfiguration] - _json = self._serialize.body(parameters, 'MaintenanceConfiguration') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "MaintenanceConfiguration") request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) @@ -426,68 +495,60 @@ def create_or_update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) + deserialized = self._deserialize("MaintenanceConfiguration", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore @distributed_trace def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, config_name: str, **kwargs: Any ) -> None: """Deletes a maintenance configuration. Deletes a maintenance configuration. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) @@ -495,10 +556,9 @@ def delete( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -508,5 +568,4 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/_managed_cluster_snapshots_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/_managed_cluster_snapshots_operations.py index 493e77e9c580..f251cf7dd99a 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/_managed_cluster_snapshots_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/_managed_cluster_snapshots_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,243 +25,235 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedclustersnapshots") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedclustersnapshots" + ) # 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", min_length=1), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_resource_group_request( - subscription_id: str, - resource_group_name: str, - **kwargs: Any -) -> HttpRequest: +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: + _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, resource_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedClusterSnapshot] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_update_tags_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.TagsObject] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class ManagedClusterSnapshotsOperations: """ @@ -277,40 +274,35 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.ManagedClusterSnapshotListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.ManagedClusterSnapshot"]: """Gets a list of managed cluster snapshots in the specified subscription. Gets a list of managed cluster snapshots in the specified subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterSnapshotListResult or the result of + :return: An iterator like instance of either ManagedClusterSnapshot or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedClusterSnapshotListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedClusterSnapshot] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshotListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterSnapshotListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -318,14 +310,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -341,10 +330,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -354,49 +341,45 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedclustersnapshots"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedclustersnapshots"} # type: ignore @distributed_trace def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> Iterable[_models.ManagedClusterSnapshotListResult]: + self, resource_group_name: str, **kwargs: Any + ) -> Iterable["_models.ManagedClusterSnapshot"]: """Lists managed cluster snapshots in the specified subscription and resource group. Lists managed cluster snapshots in the specified subscription and resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterSnapshotListResult or the result of + :return: An iterator like instance of either ManagedClusterSnapshot or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedClusterSnapshotListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedClusterSnapshot] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshotListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterSnapshotListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -404,15 +387,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -428,10 +407,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -441,50 +418,41 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots"} # type: ignore @distributed_trace - def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.ManagedClusterSnapshot: + def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.ManagedClusterSnapshot: """Gets a managed cluster snapshot. Gets a managed cluster snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterSnapshot, or the result of cls(response) + :return: ManagedClusterSnapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedClusterSnapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterSnapshot] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -492,32 +460,32 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterSnapshot', pipeline_response) + deserialized = self._deserialize("ManagedClusterSnapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"} # type: ignore - @distributed_trace + @overload def create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterSnapshot, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.ManagedClusterSnapshot: """Creates or updates a managed cluster snapshot. @@ -525,39 +493,108 @@ def create_or_update( Creates or updates a managed cluster snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The managed cluster snapshot to create or update. + :param parameters: The managed cluster snapshot to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedClusterSnapshot + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedClusterSnapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedClusterSnapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ManagedClusterSnapshot: + """Creates or updates a managed cluster snapshot. + + Creates or updates a managed cluster snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster snapshot to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedClusterSnapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedClusterSnapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterSnapshot, IO], + **kwargs: Any + ) -> _models.ManagedClusterSnapshot: + """Creates or updates a managed cluster snapshot. + + Creates or updates a managed cluster snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster snapshot to create or update. Is either a model type or + a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedClusterSnapshot or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterSnapshot, or the result of cls(response) + :return: ManagedClusterSnapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedClusterSnapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterSnapshot] - _json = self._serialize.body(parameters, 'ManagedClusterSnapshot') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterSnapshot") request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) @@ -565,10 +602,9 @@ def create_or_update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -576,25 +612,26 @@ def create_or_update( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ManagedClusterSnapshot', pipeline_response) + deserialized = self._deserialize("ManagedClusterSnapshot", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('ManagedClusterSnapshot', pipeline_response) + deserialized = self._deserialize("ManagedClusterSnapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"} # type: ignore + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"} # type: ignore - - @distributed_trace + @overload def update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.ManagedClusterSnapshot: """Updates tags on a managed cluster snapshot. @@ -602,38 +639,104 @@ def update_tags( Updates tags on a managed cluster snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Update managed cluster snapshot Tags operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2022_05_02_preview.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterSnapshot, or the result of cls(response) + :return: ManagedClusterSnapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedClusterSnapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + def update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ManagedClusterSnapshot: + """Updates tags on a managed cluster snapshot. + + Updates tags on a managed cluster snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update managed cluster snapshot Tags operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedClusterSnapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedClusterSnapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> _models.ManagedClusterSnapshot: + """Updates tags on a managed cluster snapshot. + + Updates tags on a managed cluster snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update managed cluster snapshot Tags operation. + Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_05_02_preview.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedClusterSnapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedClusterSnapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterSnapshot] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") request = build_update_tags_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_tags.metadata['url'], + content=_content, + template_url=self.update_tags.metadata["url"], headers=_headers, params=_params, ) @@ -641,64 +744,57 @@ def update_tags( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterSnapshot', pipeline_response) + deserialized = self._deserialize("ManagedClusterSnapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"} # type: ignore - + update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"} # type: ignore @distributed_trace def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: """Deletes a managed cluster snapshot. Deletes a managed cluster snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) @@ -706,10 +802,9 @@ def delete( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -719,5 +814,4 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"} # type: ignore - + delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/_managed_clusters_operations.py index c4cd9a5bc9c3..b5237ad97391 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/_managed_clusters_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,200 +27,189 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_get_os_options_request( - subscription_id: str, - location: str, - *, - resource_type: Optional[str] = None, - **kwargs: Any + location: str, subscription_id: str, *, resource_type: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "location": _SERIALIZER.url("location", location, 'str', min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "location": _SERIALIZER.url("location", location, "str", min_length=1), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if resource_type is not None: - _params['resource-type'] = _SERIALIZER.query("resource_type", resource_type, 'str') + _params["resource-type"] = _SERIALIZER.query("resource_type", resource_type, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters") + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters" + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_resource_group_request( - subscription_id: str, - resource_group_name: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_upgrade_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_access_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, role_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "roleName": _SERIALIZER.url("role_name", role_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "roleName": _SERIALIZER.url("role_name", role_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_admin_credentials_request( - subscription_id: str, resource_group_name: str, resource_name: str, + subscription_id: str, *, server_fqdn: Optional[str] = None, **kwargs: Any @@ -223,40 +217,46 @@ def build_list_cluster_admin_credentials_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if server_fqdn is not None: - _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + _params["server-fqdn"] = _SERIALIZER.query("server_fqdn", server_fqdn, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_user_credentials_request( - subscription_id: str, resource_group_name: str, resource_name: str, + subscription_id: str, *, server_fqdn: Optional[str] = None, format: Optional[Union[str, "_models.Format"]] = None, @@ -265,42 +265,48 @@ def build_list_cluster_user_credentials_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if server_fqdn is not None: - _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + _params["server-fqdn"] = _SERIALIZER.query("server_fqdn", server_fqdn, "str") if format is not None: - _params['format'] = _SERIALIZER.query("format", format, 'str') + _params["format"] = _SERIALIZER.query("format", format, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_monitoring_user_credentials_request( - subscription_id: str, resource_group_name: str, resource_name: str, + subscription_id: str, *, server_fqdn: Optional[str] = None, **kwargs: Any @@ -308,167 +314,170 @@ def build_list_cluster_monitoring_user_credentials_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if server_fqdn is not None: - _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + _params["server-fqdn"] = _SERIALIZER.query("server_fqdn", server_fqdn, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: + +def build_get_request(resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedCluster] = None, - content: Any = None, - **kwargs: Any + +def build_create_or_update_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_update_tags_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.TagsObject] = None, - content: Any = None, - **kwargs: Any + +def build_update_tags_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request_initial( - subscription_id: str, + +def build_delete_request( resource_group_name: str, resource_name: str, + subscription_id: str, *, ignore_pod_disruption_budget: Optional[bool] = None, **kwargs: Any @@ -476,393 +485,413 @@ def build_delete_request_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if ignore_pod_disruption_budget is not None: - _params['ignore-pod-disruption-budget'] = _SERIALIZER.query("ignore_pod_disruption_budget", ignore_pod_disruption_budget, 'bool') + _params["ignore-pod-disruption-budget"] = _SERIALIZER.query( + "ignore_pod_disruption_budget", ignore_pod_disruption_budget, "bool" + ) # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_reset_service_principal_profile_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedClusterServicePrincipalProfile] = None, - content: Any = None, - **kwargs: Any + +def build_reset_service_principal_profile_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_reset_aad_profile_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedClusterAADProfile] = None, - content: Any = None, - **kwargs: Any + +def build_reset_aad_profile_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_rotate_cluster_certificates_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + +def build_rotate_cluster_certificates_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_rotate_service_account_signing_keys_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + +def build_rotate_service_account_signing_keys_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateServiceAccountSigningKeys") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateServiceAccountSigningKeys", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_stop_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + +def build_stop_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_start_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + +def build_start_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_run_command_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.RunCommandRequest] = None, - content: Any = None, - **kwargs: Any + +def build_run_command_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_get_command_result_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - command_id: str, - **kwargs: Any + resource_group_name: str, resource_name: str, command_id: 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "commandId": _SERIALIZER.url("command_id", command_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "commandId": _SERIALIZER.url("command_id", command_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_list_outbound_network_dependencies_endpoints_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + class ManagedClustersOperations: # pylint: disable=too-many-public-methods """ @@ -883,46 +912,39 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def get_os_options( - self, - location: str, - resource_type: Optional[str] = None, - **kwargs: Any + self, location: str, resource_type: Optional[str] = None, **kwargs: Any ) -> _models.OSOptionProfile: """Gets supported OS options in the specified subscription. Gets supported OS options in the specified subscription. - :param location: The name of Azure region. + :param location: The name of Azure region. Required. :type location: str :param resource_type: The resource type for which the OS options needs to be returned. Default value is None. :type resource_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: OSOptionProfile, or the result of cls(response) + :return: OSOptionProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.OSOptionProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OSOptionProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OSOptionProfile] - request = build_get_os_options_request( - subscription_id=self._config.subscription_id, location=location, - api_version=api_version, + subscription_id=self._config.subscription_id, resource_type=resource_type, - template_url=self.get_os_options.metadata['url'], + api_version=api_version, + template_url=self.get_os_options.metadata["url"], headers=_headers, params=_params, ) @@ -930,59 +952,52 @@ def get_os_options( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('OSOptionProfile', pipeline_response) + deserialized = self._deserialize("OSOptionProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_os_options.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default"} # type: ignore - + get_os_options.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default"} # type: ignore @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.ManagedClusterListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.ManagedCluster"]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -990,14 +1005,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -1013,10 +1025,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1026,49 +1036,42 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> Iterable[_models.ManagedClusterListResult]: + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.ManagedCluster"]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -1076,15 +1079,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -1100,10 +1099,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1113,50 +1110,43 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.ManagedClusterUpgradeProfile: """Gets the upgrade profile of a managed cluster. Gets the upgrade profile of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterUpgradeProfile, or the result of cls(response) + :return: ManagedClusterUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedClusterUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -1164,33 +1154,27 @@ def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterUpgradeProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore @distributed_trace def get_access_profile( - self, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, role_name: str, **kwargs: Any ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. @@ -1200,35 +1184,33 @@ def get_access_profile( `_ . :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param role_name: The name of the role for managed cluster accessProfile resource. + :param role_name: The name of the role for managed cluster accessProfile resource. Required. :type role_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterAccessProfile, or the result of cls(response) + :return: ManagedClusterAccessProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedClusterAccessProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterAccessProfile] - request = build_get_access_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, role_name=role_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_access_profile.metadata['url'], + template_url=self.get_access_profile.metadata["url"], headers=_headers, params=_params, ) @@ -1236,68 +1218,60 @@ def get_access_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterAccessProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterAccessProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_access_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore - + get_access_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore @distributed_trace def list_cluster_admin_credentials( - self, - resource_group_name: str, - resource_name: str, - server_fqdn: Optional[str] = None, - **kwargs: Any + self, resource_group_name: str, resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any ) -> _models.CredentialResults: """Lists the admin credentials of a managed cluster. Lists the admin credentials of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_admin_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, - template_url=self.list_cluster_admin_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_admin_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -1305,25 +1279,23 @@ def list_cluster_admin_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_admin_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore - + list_cluster_admin_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore @distributed_trace def list_cluster_user_credentials( @@ -1339,40 +1311,39 @@ def list_cluster_user_credentials( Lists the user credentials of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :param format: Only apply to AAD clusters, specifies the format of returned kubeconfig. Format 'azure' will return azure auth-provider kubeconfig; format 'exec' will return exec format - kubeconfig, which requires kubelogin binary in the path. Default value is None. + kubeconfig, which requires kubelogin binary in the path. Known values are: "azure" and "exec". + Default value is None. :type format: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.Format :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, format=format, - template_url=self.list_cluster_user_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -1380,68 +1351,60 @@ def list_cluster_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore - + list_cluster_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore @distributed_trace def list_cluster_monitoring_user_credentials( - self, - resource_group_name: str, - resource_name: str, - server_fqdn: Optional[str] = None, - **kwargs: Any + self, resource_group_name: str, resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any ) -> _models.CredentialResults: """Lists the cluster monitoring user credentials of a managed cluster. Lists the cluster monitoring user credentials of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_monitoring_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, - template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_monitoring_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -1449,64 +1412,55 @@ def list_cluster_monitoring_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_monitoring_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore - + list_cluster_monitoring_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore @distributed_trace - def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.ManagedCluster: + def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.ManagedCluster: """Gets a managed cluster. Gets a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedCluster, or the result of cls(response) + :return: ManagedCluster or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedCluster - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -1514,55 +1468,54 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _create_or_update_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.ManagedCluster, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'ManagedCluster') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedCluster") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1570,10 +1523,9 @@ def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -1581,25 +1533,26 @@ def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - @distributed_trace + @overload def begin_create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedCluster, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. @@ -1607,11 +1560,15 @@ def begin_create_or_update( Creates or updates a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The managed cluster to create or update. + :param parameters: The managed cluster to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedCluster + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1624,90 +1581,157 @@ def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._create_or_update_initial( # type: ignore - resource_group_name=resource_group_name, - resource_name=resource_name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop('error_map', None) + @overload + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. - def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized + Creates or updates a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + @distributed_trace + def begin_create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - + Creates or updates a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster to create or update. Is either a model type or a IO + type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedCluster or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ManagedCluster", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _update_tags_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.TagsObject, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request_initial( - subscription_id=self._config.subscription_id, + request = build_update_tags_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_tags_initial.metadata['url'], + content=_content, + template_url=self._update_tags_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1715,32 +1739,32 @@ def _update_tags_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_tags_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + _update_tags_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - - @distributed_trace + @overload def begin_update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. @@ -1748,11 +1772,88 @@ def begin_update_tags( Updates tags on a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2022_05_02_preview.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates tags on a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates tags on a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_05_02_preview.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1765,20 +1866,17 @@ def begin_update_tags( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, @@ -1786,39 +1884,35 @@ def begin_update_tags( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements self, @@ -1827,25 +1921,22 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements ignore_pod_disruption_budget: Optional[bool] = None, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, ignore_pod_disruption_budget=ignore_pod_disruption_budget, - template_url=self._delete_initial.metadata['url'], + api_version=api_version, + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1853,10 +1944,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1866,11 +1956,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements + def begin_delete( self, resource_group_name: str, resource_name: str, @@ -1882,8 +1971,9 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Deletes a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param ignore_pod_disruption_budget: ignore-pod-disruption-budget=true to delete those pods on a node without considering Pod Disruption Budget. Default value is None. @@ -1898,86 +1988,84 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, ignore_pod_disruption_budget=ignore_pod_disruption_budget, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterServicePrincipalProfile, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterServicePrincipalProfile") - request = build_reset_service_principal_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_service_principal_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_service_principal_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_service_principal_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1985,10 +2073,9 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1998,15 +2085,89 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re if cls: return cls(pipeline_response, None, {}) - _reset_service_principal_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + _reset_service_principal_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + + @overload + def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.ManagedClusterServicePrincipalProfile, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reset the Service Principal Profile of a managed cluster. + + This action cannot be performed on a cluster that is not using a service principal. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The service principal profile to set on the managed cluster. Required. + :type parameters: + ~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedClusterServicePrincipalProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reset the Service Principal Profile of a managed cluster. + + This action cannot be performed on a cluster that is not using a service principal. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The service principal profile to set on the managed cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace - def begin_reset_service_principal_profile( # pylint: disable=inconsistent-return-statements + def begin_reset_service_principal_profile( self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterServicePrincipalProfile, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], **kwargs: Any ) -> LROPoller[None]: """Reset the Service Principal Profile of a managed cluster. @@ -2014,12 +2175,18 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur This action cannot be performed on a cluster that is not using a service principal. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The service principal profile to set on the managed cluster. + :param parameters: The service principal profile to set on the managed cluster. Is either a + model type or a IO type. Required. :type parameters: ~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedClusterServicePrincipalProfile + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -2030,20 +2197,17 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -2051,67 +2215,68 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_service_principal_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + begin_reset_service_principal_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterAADProfile, + parameters: Union[_models.ManagedClusterAADProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterAADProfile") - request = build_reset_aad_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_aad_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_aad_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_aad_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2119,10 +2284,9 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -2132,15 +2296,16 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement if cls: return cls(pipeline_response, None, {}) - _reset_aad_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - + _reset_aad_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - @distributed_trace - def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements + @overload + def begin_reset_aad_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterAADProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: """Reset the AAD Profile of a managed cluster. @@ -2148,12 +2313,90 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements Reset the AAD Profile of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The AAD profile to set on the Managed Cluster. + :param parameters: The AAD profile to set on the Managed Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedClusterAADProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reset the AAD Profile of a managed cluster. + + Reset the AAD Profile of a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The AAD profile to set on the Managed Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterAADProfile, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Reset the AAD Profile of a managed cluster. + + Reset the AAD Profile of a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The AAD profile to set on the Managed Cluster. Is either a model type or a + IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedClusterAADProfile or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -2164,20 +2407,17 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -2185,62 +2425,52 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_aad_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + begin_reset_aad_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_rotate_cluster_certificates_request_initial( - subscription_id=self._config.subscription_id, + request = build_rotate_cluster_certificates_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._rotate_cluster_certificates_initial.metadata['url'], + template_url=self._rotate_cluster_certificates_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2248,10 +2478,9 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -2261,15 +2490,11 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return if cls: return cls(pipeline_response, None, {}) - _rotate_cluster_certificates_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore - + _rotate_cluster_certificates_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore @distributed_trace - def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + def begin_rotate_cluster_certificates( + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> LROPoller[None]: """Rotates the certificates of a managed cluster. @@ -2277,8 +2502,9 @@ def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-st more details about rotating managed cluster certificates. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -2290,80 +2516,67 @@ def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-st Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._rotate_cluster_certificates_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_rotate_cluster_certificates.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore + begin_rotate_cluster_certificates.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore def _rotate_service_account_signing_keys_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_rotate_service_account_signing_keys_request_initial( - subscription_id=self._config.subscription_id, + request = build_rotate_service_account_signing_keys_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._rotate_service_account_signing_keys_initial.metadata['url'], + template_url=self._rotate_service_account_signing_keys_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2371,10 +2584,9 @@ def _rotate_service_account_signing_keys_initial( # pylint: disable=inconsisten request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -2384,23 +2596,20 @@ def _rotate_service_account_signing_keys_initial( # pylint: disable=inconsisten if cls: return cls(pipeline_response, None, {}) - _rotate_service_account_signing_keys_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateServiceAccountSigningKeys"} # type: ignore - + _rotate_service_account_signing_keys_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateServiceAccountSigningKeys"} # type: ignore @distributed_trace - def begin_rotate_service_account_signing_keys( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + def begin_rotate_service_account_signing_keys( + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> LROPoller[None]: """Rotates the service account signing keys of a managed cluster. Rotates the service account signing keys of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -2412,80 +2621,67 @@ def begin_rotate_service_account_signing_keys( # pylint: disable=inconsistent-r Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._rotate_service_account_signing_keys_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_rotate_service_account_signing_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateServiceAccountSigningKeys"} # type: ignore + begin_rotate_service_account_signing_keys.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateServiceAccountSigningKeys"} # type: ignore def _stop_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_stop_request_initial( - subscription_id=self._config.subscription_id, + request = build_stop_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._stop_initial.metadata['url'], + template_url=self._stop_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2493,10 +2689,9 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -2506,16 +2701,10 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore - + _stop_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore @distributed_trace - def begin_stop( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> LROPoller[None]: + def begin_stop(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> LROPoller[None]: """Stops a Managed Cluster. This can only be performed on Azure Virtual Machine Scale set backed clusters. Stopping a @@ -2525,8 +2714,9 @@ def begin_stop( # pylint: disable=inconsistent-return-statements cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -2538,80 +2728,67 @@ def begin_stop( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._stop_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore + begin_stop.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore def _start_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_start_request_initial( - subscription_id=self._config.subscription_id, + request = build_start_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._start_initial.metadata['url'], + template_url=self._start_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2619,10 +2796,9 @@ def _start_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -2632,24 +2808,19 @@ def _start_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore - + _start_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore @distributed_trace - def begin_start( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> LROPoller[None]: + def begin_start(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> LROPoller[None]: """Starts a previously stopped Managed Cluster. See `starting a cluster `_ for more details about starting a cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -2661,85 +2832,83 @@ def begin_start( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._start_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore + begin_start.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore def _run_command_initial( self, resource_group_name: str, resource_name: str, - request_payload: _models.RunCommandRequest, + request_payload: Union[_models.RunCommandRequest, IO], **kwargs: Any ) -> Optional[_models.RunCommandResult]: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RunCommandResult]] - _json = self._serialize.body(request_payload, 'RunCommandRequest') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(request_payload, (IO, bytes)): + _content = request_payload + else: + _json = self._serialize.body(request_payload, "RunCommandRequest") - request = build_run_command_request_initial( - subscription_id=self._config.subscription_id, + request = build_run_command_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._run_command_initial.metadata['url'], + content=_content, + template_url=self._run_command_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2747,10 +2916,9 @@ def _run_command_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -2759,22 +2927,23 @@ def _run_command_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _run_command_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore - + _run_command_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore - @distributed_trace + @overload def begin_run_command( self, resource_group_name: str, resource_name: str, request_payload: _models.RunCommandRequest, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.RunCommandResult]: """Submits a command to run against the Managed Cluster. @@ -2784,12 +2953,97 @@ def begin_run_command( `_. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param request_payload: The run command request. + :param request_payload: The run command request. Required. :type request_payload: ~azure.mgmt.containerservice.v2022_05_02_preview.models.RunCommandRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either RunCommandResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_05_02_preview.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_run_command( + self, + resource_group_name: str, + resource_name: str, + request_payload: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RunCommandResult]: + """Submits a command to run against the Managed Cluster. + + AKS will create a pod to run the command. This is primarily useful for private clusters. For + more information see `AKS Run Command + `_. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param request_payload: The run command request. Required. + :type request_payload: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either RunCommandResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_05_02_preview.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_run_command( + self, + resource_group_name: str, + resource_name: str, + request_payload: Union[_models.RunCommandRequest, IO], + **kwargs: Any + ) -> LROPoller[_models.RunCommandResult]: + """Submits a command to run against the Managed Cluster. + + AKS will create a pod to run the command. This is primarily useful for private clusters. For + more information see `AKS Run Command + `_. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param request_payload: The run command request. Is either a model type or a IO type. Required. + :type request_payload: + ~azure.mgmt.containerservice.v2022_05_02_preview.models.RunCommandRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -2802,20 +3056,17 @@ def begin_run_command( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_05_02_preview.models.RunCommandResult] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.RunCommandResult] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.RunCommandResult] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._run_command_initial( # type: ignore resource_group_name=resource_group_name, @@ -2823,82 +3074,72 @@ def begin_run_command( request_payload=request_payload, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_run_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore + begin_run_command.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore @distributed_trace def get_command_result( - self, - resource_group_name: str, - resource_name: str, - command_id: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, command_id: str, **kwargs: Any ) -> Optional[_models.RunCommandResult]: """Gets the results of a command which has been run on the Managed Cluster. Gets the results of a command which has been run on the Managed Cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param command_id: Id of the command. + :param command_id: Id of the command. Required. :type command_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: RunCommandResult, or the result of cls(response) + :return: RunCommandResult or None or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.RunCommandResult or None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RunCommandResult]] - request = build_get_command_result_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, command_id=command_id, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_command_result.metadata['url'], + template_url=self.get_command_result.metadata["url"], headers=_headers, params=_params, ) @@ -2906,10 +3147,9 @@ def get_command_result( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -2918,23 +3158,19 @@ def get_command_result( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_command_result.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}"} # type: ignore - + get_command_result.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}"} # type: ignore @distributed_trace def list_outbound_network_dependencies_endpoints( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> Iterable[_models.OutboundEnvironmentEndpointCollection]: + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> Iterable["_models.OutboundEnvironmentEndpoint"]: """Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster. @@ -2942,35 +3178,35 @@ def list_outbound_network_dependencies_endpoints( specified managed cluster. The operation returns properties of each egress endpoint. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OutboundEnvironmentEndpointCollection or the - result of cls(response) + :return: An iterator like instance of either OutboundEnvironmentEndpoint or the result of + cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_05_02_preview.models.OutboundEnvironmentEndpointCollection] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_05_02_preview.models.OutboundEnvironmentEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_outbound_network_dependencies_endpoints_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_outbound_network_dependencies_endpoints.metadata['url'], + template_url=self.list_outbound_network_dependencies_endpoints.metadata["url"], headers=_headers, params=_params, ) @@ -2978,16 +3214,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_outbound_network_dependencies_endpoints_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -3003,10 +3234,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -3016,8 +3245,6 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_outbound_network_dependencies_endpoints.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints"} # type: ignore + list_outbound_network_dependencies_endpoints.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/_operations.py index 45e2408caa0b..32f251ca2051 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/_operations.py @@ -7,10 +7,15 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,38 +25,34 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - **kwargs: Any -) -> HttpRequest: + +def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.ContainerService/operations") # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class Operations: """ @@ -72,38 +73,33 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.OperationListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.OperationValue"]: """Gets a list of operations. Gets a list of operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationListResult or the result of cls(response) + :return: An iterator like instance of either OperationValue or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_05_02_preview.models.OperationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_05_02_preview.models.OperationValue] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -111,13 +107,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -133,10 +127,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -146,8 +138,6 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.ContainerService/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ContainerService/operations"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/_private_endpoint_connections_operations.py index c7692bf4ebb1..c2e4aae7a4bd 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/_private_endpoint_connections_operations.py @@ -6,11 +6,15 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod @@ -21,173 +25,199 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - subscription_id: str, resource_group_name: str, resource_name: str, private_endpoint_connection_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_update_request( - subscription_id: str, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, - *, - json: Optional[_models.PrivateEndpointConnection] = None, - content: Any = None, + subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request_initial( - subscription_id: str, +def build_delete_request( resource_group_name: str, resource_name: str, private_endpoint_connection_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class PrivateEndpointConnectionsOperations: """ @@ -208,13 +238,9 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnectionListResult: """Gets a list of private endpoint connections in the specified managed cluster. @@ -222,33 +248,31 @@ def list( https://docs.microsoft.com/azure/aks/private-clusters. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnectionListResult, or the result of cls(response) + :return: PrivateEndpointConnectionListResult or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.PrivateEndpointConnectionListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnectionListResult] - request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -256,33 +280,27 @@ def list( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore - + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore @distributed_trace def get( - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnection: """Gets the specified private endpoint connection. @@ -290,35 +308,33 @@ def get( https://docs.microsoft.com/azure/aks/private-clusters. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -326,33 +342,33 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - @distributed_trace + @overload def update( self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, parameters: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateEndpointConnection: """Updates a private endpoint connection. @@ -360,42 +376,117 @@ def update( Updates a private endpoint connection. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str - :param parameters: The updated private endpoint connection. + :param parameters: The updated private endpoint connection. Required. :type parameters: ~azure.mgmt.containerservice.v2022_05_02_preview.models.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: The updated private endpoint connection. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: Union[_models.PrivateEndpointConnection, IO], + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: The updated private endpoint connection. Is either a model type or a IO + type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2022_05_02_preview.models.PrivateEndpointConnection or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - _json = self._serialize.body(parameters, 'PrivateEndpointConnection') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateEndpointConnection") request = build_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update.metadata['url'], + content=_content, + template_url=self.update.metadata["url"], headers=_headers, params=_params, ) @@ -403,52 +494,43 @@ def update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -456,10 +538,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -469,26 +550,22 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + def begin_delete( + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> LROPoller[None]: """Deletes a private endpoint connection. Deletes a private endpoint connection. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -500,53 +577,46 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/_private_link_resources_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/_private_link_resources_operations.py index 572317396b70..87aa01746a32 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/_private_link_resources_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/_private_link_resources_operations.py @@ -8,9 +8,13 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -19,48 +23,55 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class PrivateLinkResourcesOperations: """ @@ -81,13 +92,9 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.PrivateLinkResourcesListResult: """Gets a list of private link resources in the specified managed cluster. @@ -95,32 +102,30 @@ def list( https://docs.microsoft.com/azure/aks/private-clusters. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResourcesListResult, or the result of cls(response) + :return: PrivateLinkResourcesListResult or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.PrivateLinkResourcesListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResourcesListResult] - request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -128,22 +133,20 @@ def list( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResourcesListResult', pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources"} # type: ignore - + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/_resolve_private_link_service_id_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/_resolve_private_link_service_id_operations.py index 51ac6e298378..b3ddc5387868 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/_resolve_private_link_service_id_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/_resolve_private_link_service_id_operations.py @@ -6,11 +6,15 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -19,56 +23,58 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_post_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.PrivateLinkResource] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + class ResolvePrivateLinkServiceIdOperations: """ @@ -89,13 +95,72 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @overload + def post( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.PrivateLinkResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID for the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters required in order to resolve a private link service ID. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_05_02_preview.models.PrivateLinkResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def post( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID for the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters required in order to resolve a private link service ID. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def post( self, resource_group_name: str, resource_name: str, - parameters: _models.PrivateLinkResource, + parameters: Union[_models.PrivateLinkResource, IO], **kwargs: Any ) -> _models.PrivateLinkResource: """Gets the private link service ID for the specified managed cluster. @@ -103,38 +168,49 @@ def post( Gets the private link service ID for the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters required in order to resolve a private link service ID. + :param parameters: Parameters required in order to resolve a private link service ID. Is either + a model type or a IO type. Required. :type parameters: ~azure.mgmt.containerservice.v2022_05_02_preview.models.PrivateLinkResource + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResource, or the result of cls(response) + :return: PrivateLinkResource or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.PrivateLinkResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResource] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResource] - _json = self._serialize.body(parameters, 'PrivateLinkResource') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateLinkResource") request = build_post_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.post.metadata['url'], + content=_content, + template_url=self.post.metadata["url"], headers=_headers, params=_params, ) @@ -142,22 +218,20 @@ def post( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResource', pipeline_response) + deserialized = self._deserialize("PrivateLinkResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - post.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId"} # type: ignore - + post.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/_snapshots_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/_snapshots_operations.py index 29025aba01e3..eb1651fc30f2 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/_snapshots_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/_snapshots_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,243 +25,233 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots") path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_resource_group_request( - subscription_id: str, - resource_group_name: str, - **kwargs: Any -) -> HttpRequest: +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: + _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, resource_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.Snapshot] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_update_tags_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.TagsObject] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class SnapshotsOperations: """ @@ -277,39 +272,34 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.SnapshotListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.Snapshot"]: """Gets a list of snapshots in the specified subscription. Gets a list of snapshots in the specified subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SnapshotListResult or the result of cls(response) + :return: An iterator like instance of either Snapshot or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_05_02_preview.models.SnapshotListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_05_02_preview.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SnapshotListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -317,14 +307,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -340,10 +327,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -353,48 +338,42 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots"} # type: ignore @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> Iterable[_models.SnapshotListResult]: + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Snapshot"]: """Lists snapshots in the specified subscription and resource group. Lists snapshots in the specified subscription and resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SnapshotListResult or the result of cls(response) + :return: An iterator like instance of either Snapshot or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_05_02_preview.models.SnapshotListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_05_02_preview.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SnapshotListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -402,15 +381,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -426,10 +401,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -439,50 +412,41 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots"} # type: ignore @distributed_trace - def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.Snapshot: + def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.Snapshot: """Gets a snapshot. Gets a snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Snapshot, or the result of cls(response) + :return: Snapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.Snapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -490,32 +454,32 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - - @distributed_trace + @overload def create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.Snapshot, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.Snapshot: """Creates or updates a snapshot. @@ -523,38 +487,102 @@ def create_or_update( Creates or updates a snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The snapshot to create or update. + :param parameters: The snapshot to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_05_02_preview.models.Snapshot + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Snapshot, or the result of cls(response) + :return: Snapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.Snapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Snapshot: + """Creates or updates a snapshot. + + Creates or updates a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The snapshot to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.Snapshot, IO], **kwargs: Any + ) -> _models.Snapshot: + """Creates or updates a snapshot. + + Creates or updates a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The snapshot to create or update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.mgmt.containerservice.v2022_05_02_preview.models.Snapshot or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] - _json = self._serialize.body(parameters, 'Snapshot') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "Snapshot") request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) @@ -562,10 +590,9 @@ def create_or_update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -573,25 +600,26 @@ def create_or_update( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - - @distributed_trace + @overload def update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.Snapshot: """Updates tags on a snapshot. @@ -599,38 +627,102 @@ def update_tags( Updates tags on a snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update snapshot Tags operation. + :param parameters: Parameters supplied to the Update snapshot Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2022_05_02_preview.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Snapshot, or the result of cls(response) + :return: Snapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.Snapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + def update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Snapshot: + """Updates tags on a snapshot. + + Updates tags on a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update snapshot Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> _models.Snapshot: + """Updates tags on a snapshot. + + Updates tags on a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update snapshot Tags operation. Is either a model + type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_05_02_preview.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") request = build_update_tags_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_tags.metadata['url'], + content=_content, + template_url=self.update_tags.metadata["url"], headers=_headers, params=_params, ) @@ -638,64 +730,57 @@ def update_tags( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - + update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore @distributed_trace def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: """Deletes a snapshot. Deletes a snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) @@ -703,10 +788,9 @@ def delete( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -716,5 +800,4 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - + delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/_trusted_access_role_bindings_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/_trusted_access_role_bindings_operations.py index 2a390aa1b769..1787730331f2 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/_trusted_access_role_bindings_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/_trusted_access_role_bindings_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,173 +25,199 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - subscription_id: str, resource_group_name: str, resource_name: str, trusted_access_role_binding_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "trustedAccessRoleBindingName": _SERIALIZER.url("trusted_access_role_binding_name", trusted_access_role_binding_name, 'str', max_length=36, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "trustedAccessRoleBindingName": _SERIALIZER.url( + "trusted_access_role_binding_name", trusted_access_role_binding_name, "str", max_length=36, min_length=1 + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_request( - subscription_id: str, resource_group_name: str, resource_name: str, trusted_access_role_binding_name: str, - *, - json: Optional[_models.TrustedAccessRoleBinding] = None, - content: Any = None, + subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "trustedAccessRoleBindingName": _SERIALIZER.url("trusted_access_role_binding_name", trusted_access_role_binding_name, 'str', max_length=36, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "trustedAccessRoleBindingName": _SERIALIZER.url( + "trusted_access_role_binding_name", trusted_access_role_binding_name, "str", max_length=36, min_length=1 + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_request( - subscription_id: str, resource_group_name: str, resource_name: str, trusted_access_role_binding_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "trustedAccessRoleBindingName": _SERIALIZER.url("trusted_access_role_binding_name", trusted_access_role_binding_name, 'str', max_length=36, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "trustedAccessRoleBindingName": _SERIALIZER.url( + "trusted_access_role_binding_name", trusted_access_role_binding_name, "str", max_length=36, min_length=1 + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class TrustedAccessRoleBindingsOperations: """ @@ -207,48 +238,44 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> Iterable[_models.TrustedAccessRoleBindingListResult]: + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> Iterable["_models.TrustedAccessRoleBinding"]: """List trusted access role bindings. List trusted access role bindings. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either TrustedAccessRoleBindingListResult or the result - of cls(response) + :return: An iterator like instance of either TrustedAccessRoleBinding or the result of + cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_05_02_preview.models.TrustedAccessRoleBindingListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_05_02_preview.models.TrustedAccessRoleBinding] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.TrustedAccessRoleBindingListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.TrustedAccessRoleBindingListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -256,16 +283,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -281,10 +303,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -294,54 +314,46 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings"} # type: ignore @distributed_trace def get( - self, - resource_group_name: str, - resource_name: str, - trusted_access_role_binding_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, trusted_access_role_binding_name: str, **kwargs: Any ) -> _models.TrustedAccessRoleBinding: """Get a trusted access role binding. Get a trusted access role binding. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param trusted_access_role_binding_name: The name of trusted access role binding. + :param trusted_access_role_binding_name: The name of trusted access role binding. Required. :type trusted_access_role_binding_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: TrustedAccessRoleBinding, or the result of cls(response) + :return: TrustedAccessRoleBinding or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.TrustedAccessRoleBinding - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.TrustedAccessRoleBinding] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.TrustedAccessRoleBinding] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, trusted_access_role_binding_name=trusted_access_role_binding_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -349,33 +361,33 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('TrustedAccessRoleBinding', pipeline_response) + deserialized = self._deserialize("TrustedAccessRoleBinding", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}"} # type: ignore - @distributed_trace + @overload def create_or_update( self, resource_group_name: str, resource_name: str, trusted_access_role_binding_name: str, trusted_access_role_binding: _models.TrustedAccessRoleBinding, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.TrustedAccessRoleBinding: """Create or update a trusted access role binding. @@ -383,42 +395,117 @@ def create_or_update( Create or update a trusted access role binding. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param trusted_access_role_binding_name: The name of trusted access role binding. + :param trusted_access_role_binding_name: The name of trusted access role binding. Required. :type trusted_access_role_binding_name: str - :param trusted_access_role_binding: A trusted access role binding. + :param trusted_access_role_binding: A trusted access role binding. Required. :type trusted_access_role_binding: ~azure.mgmt.containerservice.v2022_05_02_preview.models.TrustedAccessRoleBinding + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TrustedAccessRoleBinding or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.TrustedAccessRoleBinding + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + trusted_access_role_binding_name: str, + trusted_access_role_binding: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.TrustedAccessRoleBinding: + """Create or update a trusted access role binding. + + Create or update a trusted access role binding. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param trusted_access_role_binding_name: The name of trusted access role binding. Required. + :type trusted_access_role_binding_name: str + :param trusted_access_role_binding: A trusted access role binding. Required. + :type trusted_access_role_binding: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TrustedAccessRoleBinding or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.TrustedAccessRoleBinding + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + trusted_access_role_binding_name: str, + trusted_access_role_binding: Union[_models.TrustedAccessRoleBinding, IO], + **kwargs: Any + ) -> _models.TrustedAccessRoleBinding: + """Create or update a trusted access role binding. + + Create or update a trusted access role binding. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param trusted_access_role_binding_name: The name of trusted access role binding. Required. + :type trusted_access_role_binding_name: str + :param trusted_access_role_binding: A trusted access role binding. Is either a model type or a + IO type. Required. + :type trusted_access_role_binding: + ~azure.mgmt.containerservice.v2022_05_02_preview.models.TrustedAccessRoleBinding or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: TrustedAccessRoleBinding, or the result of cls(response) + :return: TrustedAccessRoleBinding or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.TrustedAccessRoleBinding - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.TrustedAccessRoleBinding] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.TrustedAccessRoleBinding] - _json = self._serialize.body(trusted_access_role_binding, 'TrustedAccessRoleBinding') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(trusted_access_role_binding, (IO, bytes)): + _content = trusted_access_role_binding + else: + _json = self._serialize.body(trusted_access_role_binding, "TrustedAccessRoleBinding") request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, trusted_access_role_binding_name=trusted_access_role_binding_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) @@ -426,68 +513,60 @@ def create_or_update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('TrustedAccessRoleBinding', pipeline_response) + deserialized = self._deserialize("TrustedAccessRoleBinding", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}"} # type: ignore - + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}"} # type: ignore @distributed_trace def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - trusted_access_role_binding_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, trusted_access_role_binding_name: str, **kwargs: Any ) -> None: """Delete a trusted access role binding. Delete a trusted access role binding. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param trusted_access_role_binding_name: The name of trusted access role binding. + :param trusted_access_role_binding_name: The name of trusted access role binding. Required. :type trusted_access_role_binding_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, trusted_access_role_binding_name=trusted_access_role_binding_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) @@ -495,10 +574,9 @@ def delete( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -508,5 +586,4 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}"} # type: ignore - + delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/_trusted_access_roles_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/_trusted_access_roles_operations.py index f0c912c6250f..726ba5c31f25 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/_trusted_access_roles_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/_trusted_access_roles_operations.py @@ -7,10 +7,15 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,46 +25,43 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - subscription_id: str, - location: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_request(location: 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/trustedAccessRoles") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/trustedAccessRoles", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "location": _SERIALIZER.url("location", location, 'str', min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "location": _SERIALIZER.url("location", location, "str", min_length=1), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class TrustedAccessRolesOperations: """ @@ -80,44 +82,37 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - location: str, - **kwargs: Any - ) -> Iterable[_models.TrustedAccessRoleListResult]: + def list(self, location: str, **kwargs: Any) -> Iterable["_models.TrustedAccessRole"]: """List supported trusted access roles. List supported trusted access roles. - :param location: The name of Azure region. + :param location: The name of Azure region. Required. :type location: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either TrustedAccessRoleListResult or the result of - cls(response) + :return: An iterator like instance of either TrustedAccessRole or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_05_02_preview.models.TrustedAccessRoleListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_05_02_preview.models.TrustedAccessRole] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.TrustedAccessRoleListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.TrustedAccessRoleListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( - subscription_id=self._config.subscription_id, location=location, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -125,15 +120,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - location=location, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -149,10 +140,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -162,8 +151,6 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/trustedAccessRoles"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/trustedAccessRoles"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/__init__.py index 37a5f9e02e6f..a8716d29afe8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/__init__.py @@ -14,7 +14,8 @@ except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['ContainerServiceClient'] + +__all__ = ["ContainerServiceClient"] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/_configuration.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/_configuration.py index 60269a7e1951..03439ff25e6b 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/_configuration.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/_configuration.py @@ -18,29 +18,25 @@ VERSION = "unknown" + class ContainerServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ContainerServiceClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :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. + :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2022-06-01". 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: + def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ContainerServiceClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2022-06-01") # type: str + api_version = kwargs.pop("api_version", "2022-06-01") # type: str if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -50,23 +46,24 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-containerservice/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-containerservice/{}".format(VERSION)) self._configure(**kwargs) def _configure( - self, - **kwargs # type: Any + self, **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/_container_service_client.py index ff60cbe558b6..39327dd01b9d 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/_container_service_client.py @@ -9,20 +9,29 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from . import models +from .._serialization import Deserializer, Serializer from ._configuration import ContainerServiceClientConfiguration -from .operations import AgentPoolsOperations, MaintenanceConfigurationsOperations, ManagedClustersOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, ResolvePrivateLinkServiceIdOperations, SnapshotsOperations +from .operations import ( + AgentPoolsOperations, + MaintenanceConfigurationsOperations, + ManagedClustersOperations, + Operations, + PrivateEndpointConnectionsOperations, + PrivateLinkResourcesOperations, + ResolvePrivateLinkServiceIdOperations, + SnapshotsOperations, +) if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class ContainerServiceClient: # pylint: disable=too-many-instance-attributes + +class ContainerServiceClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """The Container Service Client. :ivar operations: Operations operations @@ -46,9 +55,9 @@ class ContainerServiceClient: # pylint: disable=too-many-instance-attributes azure.mgmt.containerservice.v2022_06_01.operations.ResolvePrivateLinkServiceIdOperations :ivar snapshots: SnapshotsOperations operations :vartype snapshots: azure.mgmt.containerservice.v2022_06_01.operations.SnapshotsOperations - :param credential: Credential needed for the client to connect to Azure. + :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. + :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -66,25 +75,23 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = ContainerServiceClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = ContainerServiceClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize - ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.managed_clusters = ManagedClustersOperations( self._client, self._config, self._serialize, self._deserialize ) self.maintenance_configurations = MaintenanceConfigurationsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.agent_pools = AgentPoolsOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) self.private_endpoint_connections = PrivateEndpointConnectionsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -94,16 +101,9 @@ def __init__( self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations( self._client, self._config, self._serialize, self._deserialize ) - self.snapshots = SnapshotsOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.snapshots = SnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) - - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> HttpResponse: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -112,7 +112,7 @@ def _send_request( >>> response = client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/_metadata.json b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/_metadata.json index 79cf0106aad9..faf2fb3848f2 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/_metadata.json +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/_metadata.json @@ -10,20 +10,20 @@ "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { "credential": { - "signature": "credential, # type: \"TokenCredential\"", - "description": "Credential needed for the client to connect to Azure.", + "signature": "credential: \"TokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true }, "subscription_id": { - "signature": "subscription_id, # type: str", - "description": "The ID of the target subscription.", + "signature": "subscription_id: str,", + "description": "The ID of the target subscription. Required.", "docstring_type": "str", "required": true } @@ -31,13 +31,13 @@ "async": { "credential": { "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure.", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { "signature": "subscription_id: str,", - "description": "The ID of the target subscription.", + "description": "The ID of the target subscription. Required.", "docstring_type": "str", "required": true } @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=\"https://management.azure.com\", # type: str", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/_vendor.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/_vendor.py index 138f663c53a4..9aad73fc743e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/_vendor.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/_vendor.py @@ -7,6 +7,7 @@ from azure.core.pipeline.transport import HttpRequest + def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) @@ -14,6 +15,7 @@ def _convert_request(request, files=None): request.set_formdata_body(files) return request + def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -21,7 +23,5 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [ - c for c in formatted_components if "{}".format(key.args[0]) not in c - ] + components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/aio/__init__.py index 37a5f9e02e6f..a8716d29afe8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/aio/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/aio/__init__.py @@ -14,7 +14,8 @@ except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['ContainerServiceClient'] + +__all__ = ["ContainerServiceClient"] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/aio/_configuration.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/aio/_configuration.py index e3fe4011270e..ce14e51b7954 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/aio/_configuration.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/aio/_configuration.py @@ -18,29 +18,25 @@ VERSION = "unknown" + class ContainerServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ContainerServiceClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :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. + :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2022-06-01". 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: + def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ContainerServiceClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2022-06-01") # type: str + api_version = kwargs.pop("api_version", "2022-06-01") # type: str if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -50,22 +46,21 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-containerservice/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-containerservice/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, - **kwargs: Any - ) -> None: - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/aio/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/aio/_container_service_client.py index 24ef9d40a89f..028c8ef0f878 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/aio/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/aio/_container_service_client.py @@ -9,20 +9,29 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from .. import models +from ..._serialization import Deserializer, Serializer from ._configuration import ContainerServiceClientConfiguration -from .operations import AgentPoolsOperations, MaintenanceConfigurationsOperations, ManagedClustersOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, ResolvePrivateLinkServiceIdOperations, SnapshotsOperations +from .operations import ( + AgentPoolsOperations, + MaintenanceConfigurationsOperations, + ManagedClustersOperations, + Operations, + PrivateEndpointConnectionsOperations, + PrivateLinkResourcesOperations, + ResolvePrivateLinkServiceIdOperations, + SnapshotsOperations, +) if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class ContainerServiceClient: # pylint: disable=too-many-instance-attributes + +class ContainerServiceClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """The Container Service Client. :ivar operations: Operations operations @@ -47,9 +56,9 @@ class ContainerServiceClient: # pylint: disable=too-many-instance-attributes azure.mgmt.containerservice.v2022_06_01.aio.operations.ResolvePrivateLinkServiceIdOperations :ivar snapshots: SnapshotsOperations operations :vartype snapshots: azure.mgmt.containerservice.v2022_06_01.aio.operations.SnapshotsOperations - :param credential: Credential needed for the client to connect to Azure. + :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. + :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -67,25 +76,23 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = ContainerServiceClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = ContainerServiceClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize - ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.managed_clusters = ManagedClustersOperations( self._client, self._config, self._serialize, self._deserialize ) self.maintenance_configurations = MaintenanceConfigurationsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.agent_pools = AgentPoolsOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) self.private_endpoint_connections = PrivateEndpointConnectionsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -95,16 +102,9 @@ def __init__( self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations( self._client, self._config, self._serialize, self._deserialize ) - self.snapshots = SnapshotsOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.snapshots = SnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) - - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -113,7 +113,7 @@ def _send_request( >>> response = await client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/aio/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/aio/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/aio/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/aio/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/aio/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/aio/operations/__init__.py index e0748876288c..593b23075ce0 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/aio/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/aio/operations/__init__.py @@ -18,15 +18,16 @@ from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'Operations', - 'ManagedClustersOperations', - 'MaintenanceConfigurationsOperations', - 'AgentPoolsOperations', - 'PrivateEndpointConnectionsOperations', - 'PrivateLinkResourcesOperations', - 'ResolvePrivateLinkServiceIdOperations', - 'SnapshotsOperations', + "Operations", + "ManagedClustersOperations", + "MaintenanceConfigurationsOperations", + "AgentPoolsOperations", + "PrivateEndpointConnectionsOperations", + "PrivateLinkResourcesOperations", + "ResolvePrivateLinkServiceIdOperations", + "SnapshotsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/aio/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/aio/operations/_agent_pools_operations.py index 6305e4201282..d621a95b95bf 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/aio/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/aio/operations/_agent_pools_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +29,20 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._agent_pools_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_available_agent_pool_versions_request, build_get_request, build_get_upgrade_profile_request, build_list_request, build_upgrade_node_image_version_request_initial -T = TypeVar('T') +from ...operations._agent_pools_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_available_agent_pool_versions_request, + build_get_request, + build_get_upgrade_profile_request, + build_list_request, + build_upgrade_node_image_version_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class AgentPoolsOperations: """ .. warning:: @@ -45,47 +62,41 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.AgentPoolListResult]: + def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncIterable["_models.AgentPool"]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AgentPoolListResult or the result of cls(response) + :return: An iterator like instance of either AgentPool or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_06_01.models.AgentPoolListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_06_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -93,16 +104,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -118,10 +124,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -131,54 +135,46 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore @distributed_trace_async async def get( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPool: """Gets the specified managed cluster agent pool. Gets the specified managed cluster agent pool. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPool, or the result of cls(response) + :return: AgentPool or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_01.models.AgentPool - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -186,57 +182,60 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore async def _create_or_update_initial( self, resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: _models.AgentPool, + parameters: Union[_models.AgentPool, IO], **kwargs: Any ) -> _models.AgentPool: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - _json = self._serialize.body(parameters, 'AgentPool') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "AgentPool") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -244,10 +243,9 @@ async def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -255,26 +253,27 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - - @distributed_trace_async + @overload async def begin_create_or_update( self, resource_group_name: str, resource_name: str, agent_pool_name: str, parameters: _models.AgentPool, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.AgentPool]: """Creates or updates an agent pool in the specified managed cluster. @@ -282,13 +281,59 @@ async def begin_create_or_update( Creates or updates an agent pool in the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str - :param parameters: The agent pool to create or update. + :param parameters: The agent pool to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_06_01.models.AgentPool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AgentPool or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_06_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AgentPool]: + """Creates or updates an agent pool in the specified managed cluster. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: The agent pool to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -301,20 +346,58 @@ async def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_06_01.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: Union[_models.AgentPool, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.AgentPool]: + """Creates or updates an agent pool in the specified managed cluster. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: The agent pool to create or update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.mgmt.containerservice.v2022_06_01.models.AgentPool or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AgentPool or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_06_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -323,66 +406,55 @@ async def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -390,10 +462,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -403,26 +474,22 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + async def begin_delete( + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes an agent pool in the specified managed cluster. Deletes an agent pool in the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -434,99 +501,86 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace_async async def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPoolUpgradeProfile: """Gets the upgrade profile for an agent pool. Gets the upgrade profile for an agent pool. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolUpgradeProfile, or the result of cls(response) + :return: AgentPoolUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_01.models.AgentPoolUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -534,32 +588,27 @@ async def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolUpgradeProfile', pipeline_response) + deserialized = self._deserialize("AgentPoolUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore @distributed_trace_async async def get_available_agent_pool_versions( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported Kubernetes versions for the specified agent pool. @@ -568,32 +617,30 @@ async def get_available_agent_pool_versions( the version lifecycle. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolAvailableVersions, or the result of cls(response) + :return: AgentPoolAvailableVersions or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_01.models.AgentPoolAvailableVersions - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolAvailableVersions] - request = build_get_available_agent_pool_versions_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_available_agent_pool_versions.metadata['url'], + template_url=self.get_available_agent_pool_versions.metadata["url"], headers=_headers, params=_params, ) @@ -601,52 +648,43 @@ async def get_available_agent_pool_versions( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolAvailableVersions', pipeline_response) + deserialized = self._deserialize("AgentPoolAvailableVersions", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_available_agent_pool_versions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore - + get_available_agent_pool_versions.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore async def _upgrade_node_image_version_initial( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> Optional[_models.AgentPool]: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.AgentPool]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.AgentPool]] - - request = build_upgrade_node_image_version_request_initial( - subscription_id=self._config.subscription_id, + request = build_upgrade_node_image_version_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._upgrade_node_image_version_initial.metadata['url'], + template_url=self._upgrade_node_image_version_initial.metadata["url"], headers=_headers, params=_params, ) @@ -654,10 +692,9 @@ async def _upgrade_node_image_version_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -667,26 +704,23 @@ async def _upgrade_node_image_version_initial( deserialized = None response_headers = {} if response.status_code == 202: - response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) - - deserialized = self._deserialize('AgentPool', pipeline_response) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _upgrade_node_image_version_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore - + _upgrade_node_image_version_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore @distributed_trace_async async def begin_upgrade_node_image_version( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any - ) -> AsyncLROPoller[_models.AgentPool]: + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: """Upgrades the node image version of an agent pool to the latest. Upgrading the node image version of an agent pool applies the newest OS and runtime updates to @@ -694,10 +728,11 @@ async def begin_upgrade_node_image_version( node image versions, see: https://docs.microsoft.com/azure/aks/node-image-upgrade. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -711,59 +746,54 @@ async def begin_upgrade_node_image_version( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_06_01.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._upgrade_node_image_version_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) - - deserialized = self._deserialize('AgentPool', pipeline_response) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_upgrade_node_image_version.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore + begin_upgrade_node_image_version.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/aio/operations/_maintenance_configurations_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/aio/operations/_maintenance_configurations_operations.py index 2742cfd3a983..1d1526fbba0b 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/aio/operations/_maintenance_configurations_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/aio/operations/_maintenance_configurations_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,10 +27,17 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._maintenance_configurations_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_managed_cluster_request -T = TypeVar('T') +from ...operations._maintenance_configurations_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_managed_cluster_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class MaintenanceConfigurationsOperations: """ .. warning:: @@ -43,48 +57,44 @@ def __init__(self, *args, **kwargs) -> None: 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_managed_cluster( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.MaintenanceConfigurationListResult]: + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> AsyncIterable["_models.MaintenanceConfiguration"]: """Gets a list of maintenance configurations in the specified managed cluster. Gets a list of maintenance configurations in the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either MaintenanceConfigurationListResult or the result - of cls(response) + :return: An iterator like instance of either MaintenanceConfiguration or the result of + cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_06_01.models.MaintenanceConfigurationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_06_01.models.MaintenanceConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfigurationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfigurationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_managed_cluster_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_managed_cluster.metadata['url'], + template_url=self.list_by_managed_cluster.metadata["url"], headers=_headers, params=_params, ) @@ -92,16 +102,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_managed_cluster_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -117,10 +122,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -130,54 +133,46 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_managed_cluster.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations"} # type: ignore + list_by_managed_cluster.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations"} # type: ignore @distributed_trace_async async def get( - self, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, config_name: str, **kwargs: Any ) -> _models.MaintenanceConfiguration: """Gets the specified maintenance configuration of a managed cluster. Gets the specified maintenance configuration of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: MaintenanceConfiguration, or the result of cls(response) + :return: MaintenanceConfiguration or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_01.models.MaintenanceConfiguration - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfiguration] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -185,33 +180,33 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) + deserialized = self._deserialize("MaintenanceConfiguration", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - @distributed_trace_async + @overload async def create_or_update( self, resource_group_name: str, resource_name: str, config_name: str, parameters: _models.MaintenanceConfiguration, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.MaintenanceConfiguration: """Creates or updates a maintenance configuration in the specified managed cluster. @@ -219,41 +214,116 @@ async def create_or_update( Creates or updates a maintenance configuration in the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str - :param parameters: The maintenance configuration to create or update. + :param parameters: The maintenance configuration to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_06_01.models.MaintenanceConfiguration + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: MaintenanceConfiguration, or the result of cls(response) + :return: MaintenanceConfiguration or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_01.models.MaintenanceConfiguration - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configuration in the specified managed cluster. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: The maintenance configuration to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_01.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: Union[_models.MaintenanceConfiguration, IO], + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configuration in the specified managed cluster. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: The maintenance configuration to create or update. Is either a model type or + a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_06_01.models.MaintenanceConfiguration or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_01.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfiguration] - _json = self._serialize.body(parameters, 'MaintenanceConfiguration') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "MaintenanceConfiguration") request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) @@ -261,68 +331,60 @@ async def create_or_update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) + deserialized = self._deserialize("MaintenanceConfiguration", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, config_name: str, **kwargs: Any ) -> None: """Deletes a maintenance configuration. Deletes a maintenance configuration. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) @@ -330,10 +392,9 @@ async def delete( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -343,5 +404,4 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/aio/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/aio/operations/_managed_clusters_operations.py index fff19931de6c..5ce7c8f05baa 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/aio/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/aio/operations/_managed_clusters_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +29,33 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._managed_clusters_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_access_profile_request, build_get_command_result_request, build_get_os_options_request, build_get_request, build_get_upgrade_profile_request, build_list_by_resource_group_request, build_list_cluster_admin_credentials_request, build_list_cluster_monitoring_user_credentials_request, build_list_cluster_user_credentials_request, build_list_outbound_network_dependencies_endpoints_request, build_list_request, build_reset_aad_profile_request_initial, build_reset_service_principal_profile_request_initial, build_rotate_cluster_certificates_request_initial, build_run_command_request_initial, build_start_request_initial, build_stop_request_initial, build_update_tags_request_initial -T = TypeVar('T') +from ...operations._managed_clusters_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_access_profile_request, + build_get_command_result_request, + build_get_os_options_request, + build_get_request, + build_get_upgrade_profile_request, + build_list_by_resource_group_request, + build_list_cluster_admin_credentials_request, + build_list_cluster_monitoring_user_credentials_request, + build_list_cluster_user_credentials_request, + build_list_outbound_network_dependencies_endpoints_request, + build_list_request, + build_reset_aad_profile_request, + build_reset_service_principal_profile_request, + build_rotate_cluster_certificates_request, + build_run_command_request, + build_start_request, + build_stop_request, + build_update_tags_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class ManagedClustersOperations: # pylint: disable=too-many-public-methods """ .. warning:: @@ -45,46 +75,39 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async async def get_os_options( - self, - location: str, - resource_type: Optional[str] = None, - **kwargs: Any + self, location: str, resource_type: Optional[str] = None, **kwargs: Any ) -> _models.OSOptionProfile: """Gets supported OS options in the specified subscription. Gets supported OS options in the specified subscription. - :param location: The name of Azure region. + :param location: The name of Azure region. Required. :type location: str :param resource_type: The resource type for which the OS options needs to be returned. Default value is None. :type resource_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: OSOptionProfile, or the result of cls(response) + :return: OSOptionProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_01.models.OSOptionProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OSOptionProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OSOptionProfile] - request = build_get_os_options_request( - subscription_id=self._config.subscription_id, location=location, - api_version=api_version, + subscription_id=self._config.subscription_id, resource_type=resource_type, - template_url=self.get_os_options.metadata['url'], + api_version=api_version, + template_url=self.get_os_options.metadata["url"], headers=_headers, params=_params, ) @@ -92,59 +115,52 @@ async def get_os_options( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('OSOptionProfile', pipeline_response) + deserialized = self._deserialize("OSOptionProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_os_options.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default"} # type: ignore - + get_os_options.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default"} # type: ignore @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.ManagedClusterListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.ManagedCluster"]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_06_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_06_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -152,14 +168,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -175,10 +188,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -188,49 +199,44 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.ManagedClusterListResult]: + self, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ManagedCluster"]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_06_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_06_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -238,15 +244,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -262,10 +264,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -275,50 +275,43 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace_async async def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.ManagedClusterUpgradeProfile: """Gets the upgrade profile of a managed cluster. Gets the upgrade profile of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterUpgradeProfile, or the result of cls(response) + :return: ManagedClusterUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_01.models.ManagedClusterUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -326,33 +319,27 @@ async def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterUpgradeProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore @distributed_trace_async async def get_access_profile( - self, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, role_name: str, **kwargs: Any ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. @@ -362,35 +349,33 @@ async def get_access_profile( `_ . :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param role_name: The name of the role for managed cluster accessProfile resource. + :param role_name: The name of the role for managed cluster accessProfile resource. Required. :type role_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterAccessProfile, or the result of cls(response) + :return: ManagedClusterAccessProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_01.models.ManagedClusterAccessProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterAccessProfile] - request = build_get_access_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, role_name=role_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_access_profile.metadata['url'], + template_url=self.get_access_profile.metadata["url"], headers=_headers, params=_params, ) @@ -398,68 +383,60 @@ async def get_access_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterAccessProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterAccessProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_access_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore - + get_access_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore @distributed_trace_async async def list_cluster_admin_credentials( - self, - resource_group_name: str, - resource_name: str, - server_fqdn: Optional[str] = None, - **kwargs: Any + self, resource_group_name: str, resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any ) -> _models.CredentialResults: """Lists the admin credentials of a managed cluster. Lists the admin credentials of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_admin_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, - template_url=self.list_cluster_admin_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_admin_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -467,25 +444,23 @@ async def list_cluster_admin_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_admin_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore - + list_cluster_admin_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore @distributed_trace_async async def list_cluster_user_credentials( @@ -501,40 +476,39 @@ async def list_cluster_user_credentials( Lists the user credentials of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :param format: Only apply to AAD clusters, specifies the format of returned kubeconfig. Format 'azure' will return azure auth-provider kubeconfig; format 'exec' will return exec format - kubeconfig, which requires kubelogin binary in the path. Default value is None. + kubeconfig, which requires kubelogin binary in the path. Known values are: "azure" and "exec". + Default value is None. :type format: str or ~azure.mgmt.containerservice.v2022_06_01.models.Format :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, format=format, - template_url=self.list_cluster_user_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -542,68 +516,60 @@ async def list_cluster_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore - + list_cluster_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore @distributed_trace_async async def list_cluster_monitoring_user_credentials( - self, - resource_group_name: str, - resource_name: str, - server_fqdn: Optional[str] = None, - **kwargs: Any + self, resource_group_name: str, resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any ) -> _models.CredentialResults: """Lists the cluster monitoring user credentials of a managed cluster. Lists the cluster monitoring user credentials of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_monitoring_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, - template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_monitoring_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -611,64 +577,55 @@ async def list_cluster_monitoring_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_monitoring_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore - + list_cluster_monitoring_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore @distributed_trace_async - async def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.ManagedCluster: + async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.ManagedCluster: """Gets a managed cluster. Gets a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedCluster, or the result of cls(response) + :return: ManagedCluster or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_01.models.ManagedCluster - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -676,55 +633,54 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _create_or_update_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.ManagedCluster, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'ManagedCluster') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedCluster") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -732,10 +688,9 @@ async def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -743,25 +698,26 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - - @distributed_trace_async + @overload async def begin_create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedCluster, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. @@ -769,11 +725,15 @@ async def begin_create_or_update( Creates or updates a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The managed cluster to create or update. + :param parameters: The managed cluster to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_06_01.models.ManagedCluster + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -786,20 +746,90 @@ async def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_06_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_06_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster to create or update. Is either a model type or a IO + type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_06_01.models.ManagedCluster or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_06_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -807,69 +837,66 @@ async def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _update_tags_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.TagsObject, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request_initial( - subscription_id=self._config.subscription_id, + request = build_update_tags_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_tags_initial.metadata['url'], + content=_content, + template_url=self._update_tags_initial.metadata["url"], headers=_headers, params=_params, ) @@ -877,32 +904,32 @@ async def _update_tags_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_tags_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _update_tags_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - @distributed_trace_async + @overload async def begin_update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. @@ -910,11 +937,15 @@ async def begin_update_tags( Updates tags on a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2022_06_01.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -927,20 +958,90 @@ async def begin_update_tags( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_06_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates tags on a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_06_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates tags on a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_06_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_06_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, @@ -948,64 +1049,54 @@ async def begin_update_tags( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1013,10 +1104,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1026,23 +1116,18 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: + async def begin_delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Deletes a managed cluster. Deletes a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1054,85 +1139,83 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterServicePrincipalProfile, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterServicePrincipalProfile") - request = build_reset_service_principal_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_service_principal_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_service_principal_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_service_principal_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1140,10 +1223,9 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1153,15 +1235,16 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist if cls: return cls(pipeline_response, None, {}) - _reset_service_principal_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + _reset_service_principal_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore - - @distributed_trace_async - async def begin_reset_service_principal_profile( # pylint: disable=inconsistent-return-statements + @overload + async def begin_reset_service_principal_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterServicePrincipalProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: """Reset the Service Principal Profile of a managed cluster. @@ -1169,12 +1252,53 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent This action cannot be performed on a cluster that is not using a service principal. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The service principal profile to set on the managed cluster. + :param parameters: The service principal profile to set on the managed cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2022_06_01.models.ManagedClusterServicePrincipalProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset the Service Principal Profile of a managed cluster. + + This action cannot be performed on a cluster that is not using a service principal. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The service principal profile to set on the managed cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -1185,20 +1309,54 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset the Service Principal Profile of a managed cluster. + + This action cannot be performed on a cluster that is not using a service principal. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The service principal profile to set on the managed cluster. Is either a + model type or a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2022_06_01.models.ManagedClusterServicePrincipalProfile or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1206,67 +1364,68 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_service_principal_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + begin_reset_service_principal_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterAADProfile, + parameters: Union[_models.ManagedClusterAADProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterAADProfile") - request = build_reset_aad_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_aad_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_aad_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_aad_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1274,10 +1433,9 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1287,15 +1445,16 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta if cls: return cls(pipeline_response, None, {}) - _reset_aad_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - + _reset_aad_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - @distributed_trace_async - async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements + @overload + async def begin_reset_aad_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterAADProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: """Reset the AAD Profile of a managed cluster. @@ -1303,11 +1462,52 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem Reset the AAD Profile of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The AAD profile to set on the Managed Cluster. + :param parameters: The AAD profile to set on the Managed Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2022_06_01.models.ManagedClusterAADProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset the AAD Profile of a managed cluster. + + Reset the AAD Profile of a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The AAD profile to set on the Managed Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -1318,20 +1518,54 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterAADProfile, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset the AAD Profile of a managed cluster. + + Reset the AAD Profile of a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The AAD profile to set on the Managed Cluster. Is either a model type or a + IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_06_01.models.ManagedClusterAADProfile or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1339,62 +1573,52 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_aad_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + begin_reset_aad_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_rotate_cluster_certificates_request_initial( - subscription_id=self._config.subscription_id, + request = build_rotate_cluster_certificates_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._rotate_cluster_certificates_initial.metadata['url'], + template_url=self._rotate_cluster_certificates_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1402,10 +1626,9 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1415,15 +1638,11 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- if cls: return cls(pipeline_response, None, {}) - _rotate_cluster_certificates_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore - + _rotate_cluster_certificates_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore @distributed_trace_async - async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + async def begin_rotate_cluster_certificates( + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Rotates the certificates of a managed cluster. @@ -1431,8 +1650,9 @@ async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-ret more details about rotating managed cluster certificates. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1444,80 +1664,67 @@ async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-ret Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._rotate_cluster_certificates_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_rotate_cluster_certificates.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore + begin_rotate_cluster_certificates.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore async def _stop_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_stop_request_initial( - subscription_id=self._config.subscription_id, + request = build_stop_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._stop_initial.metadata['url'], + template_url=self._stop_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1525,10 +1732,9 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1538,16 +1744,10 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore - + _stop_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore @distributed_trace_async - async def begin_stop( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: + async def begin_stop(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Stops a Managed Cluster. This can only be performed on Azure Virtual Machine Scale set backed clusters. Stopping a @@ -1557,8 +1757,9 @@ async def begin_stop( # pylint: disable=inconsistent-return-statements cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1570,80 +1771,67 @@ async def begin_stop( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._stop_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore + begin_stop.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore async def _start_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_start_request_initial( - subscription_id=self._config.subscription_id, + request = build_start_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._start_initial.metadata['url'], + template_url=self._start_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1651,10 +1839,9 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1664,24 +1851,19 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore - + _start_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore @distributed_trace_async - async def begin_start( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: + async def begin_start(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Starts a previously stopped Managed Cluster. See `starting a cluster `_ for more details about starting a cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1693,85 +1875,83 @@ async def begin_start( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._start_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore + begin_start.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore async def _run_command_initial( self, resource_group_name: str, resource_name: str, - request_payload: _models.RunCommandRequest, + request_payload: Union[_models.RunCommandRequest, IO], **kwargs: Any ) -> Optional[_models.RunCommandResult]: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RunCommandResult]] - _json = self._serialize.body(request_payload, 'RunCommandRequest') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(request_payload, (IO, bytes)): + _content = request_payload + else: + _json = self._serialize.body(request_payload, "RunCommandRequest") - request = build_run_command_request_initial( - subscription_id=self._config.subscription_id, + request = build_run_command_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._run_command_initial.metadata['url'], + content=_content, + template_url=self._run_command_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1779,10 +1959,9 @@ async def _run_command_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1791,22 +1970,23 @@ async def _run_command_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _run_command_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore + _run_command_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore - - @distributed_trace_async + @overload async def begin_run_command( self, resource_group_name: str, resource_name: str, request_payload: _models.RunCommandRequest, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.RunCommandResult]: """Submits a command to run against the Managed Cluster. @@ -1816,11 +1996,15 @@ async def begin_run_command( `_. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param request_payload: The run command request. + :param request_payload: The run command request. Required. :type request_payload: ~azure.mgmt.containerservice.v2022_06_01.models.RunCommandRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -1833,20 +2017,97 @@ async def begin_run_command( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_06_01.models.RunCommandResult] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_run_command( + self, + resource_group_name: str, + resource_name: str, + request_payload: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.RunCommandResult]: + """Submits a command to run against the Managed Cluster. + + AKS will create a pod to run the command. This is primarily useful for private clusters. For + more information see `AKS Run Command + `_. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param request_payload: The run command request. Required. + :type request_payload: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RunCommandResult or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_06_01.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_run_command( + self, + resource_group_name: str, + resource_name: str, + request_payload: Union[_models.RunCommandRequest, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.RunCommandResult]: + """Submits a command to run against the Managed Cluster. + + AKS will create a pod to run the command. This is primarily useful for private clusters. For + more information see `AKS Run Command + `_. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param request_payload: The run command request. Is either a model type or a IO type. Required. + :type request_payload: ~azure.mgmt.containerservice.v2022_06_01.models.RunCommandRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RunCommandResult or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_06_01.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.RunCommandResult] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.RunCommandResult] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._run_command_initial( # type: ignore resource_group_name=resource_group_name, @@ -1854,82 +2115,72 @@ async def begin_run_command( request_payload=request_payload, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_run_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore + begin_run_command.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore @distributed_trace_async async def get_command_result( - self, - resource_group_name: str, - resource_name: str, - command_id: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, command_id: str, **kwargs: Any ) -> Optional[_models.RunCommandResult]: """Gets the results of a command which has been run on the Managed Cluster. Gets the results of a command which has been run on the Managed Cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param command_id: Id of the command. + :param command_id: Id of the command. Required. :type command_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: RunCommandResult, or the result of cls(response) + :return: RunCommandResult or None or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_01.models.RunCommandResult or None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RunCommandResult]] - request = build_get_command_result_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, command_id=command_id, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_command_result.metadata['url'], + template_url=self.get_command_result.metadata["url"], headers=_headers, params=_params, ) @@ -1937,10 +2188,9 @@ async def get_command_result( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1949,23 +2199,19 @@ async def get_command_result( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_command_result.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}"} # type: ignore - + get_command_result.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}"} # type: ignore @distributed_trace def list_outbound_network_dependencies_endpoints( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.OutboundEnvironmentEndpointCollection]: + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> AsyncIterable["_models.OutboundEnvironmentEndpoint"]: """Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster. @@ -1973,35 +2219,35 @@ def list_outbound_network_dependencies_endpoints( specified managed cluster. The operation returns properties of each egress endpoint. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OutboundEnvironmentEndpointCollection or the - result of cls(response) + :return: An iterator like instance of either OutboundEnvironmentEndpoint or the result of + cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_06_01.models.OutboundEnvironmentEndpointCollection] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_06_01.models.OutboundEnvironmentEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_outbound_network_dependencies_endpoints_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_outbound_network_dependencies_endpoints.metadata['url'], + template_url=self.list_outbound_network_dependencies_endpoints.metadata["url"], headers=_headers, params=_params, ) @@ -2009,16 +2255,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_outbound_network_dependencies_endpoints_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -2034,10 +2275,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2047,8 +2286,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_outbound_network_dependencies_endpoints.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints"} # type: ignore + list_outbound_network_dependencies_endpoints.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/aio/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/aio/operations/_operations.py index 962730d63cb3..f596080d7ce5 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/aio/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/aio/operations/_operations.py @@ -7,9 +7,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,9 +27,11 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._operations import build_list_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class Operations: """ .. warning:: @@ -42,38 +51,33 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.OperationListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.OperationValue"]: """Gets a list of operations. Gets a list of operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationListResult or the result of cls(response) + :return: An iterator like instance of either OperationValue or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_06_01.models.OperationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_06_01.models.OperationValue] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -81,13 +85,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -103,10 +105,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -116,8 +116,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.ContainerService/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ContainerService/operations"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/aio/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/aio/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/aio/operations/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/aio/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/aio/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/aio/operations/_private_endpoint_connections_operations.py index a7d47496ac60..26d498de0736 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/aio/operations/_private_endpoint_connections_operations.py @@ -6,9 +6,15 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -20,10 +26,17 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._private_endpoint_connections_operations import build_delete_request_initial, build_get_request, build_list_request, build_update_request -T = TypeVar('T') +from ...operations._private_endpoint_connections_operations import ( + build_delete_request, + build_get_request, + build_list_request, + build_update_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class PrivateEndpointConnectionsOperations: """ .. warning:: @@ -43,13 +56,9 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async async def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnectionListResult: """Gets a list of private endpoint connections in the specified managed cluster. @@ -57,32 +66,30 @@ async def list( https://docs.microsoft.com/azure/aks/private-clusters. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnectionListResult, or the result of cls(response) + :return: PrivateEndpointConnectionListResult or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_01.models.PrivateEndpointConnectionListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnectionListResult] - request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -90,33 +97,27 @@ async def list( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore - + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore @distributed_trace_async async def get( - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnection: """Gets the specified private endpoint connection. @@ -124,35 +125,33 @@ async def get( https://docs.microsoft.com/azure/aks/private-clusters. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_01.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -160,33 +159,33 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - - @distributed_trace_async + @overload async def update( self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, parameters: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateEndpointConnection: """Updates a private endpoint connection. @@ -194,41 +193,116 @@ async def update( Updates a private endpoint connection. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str - :param parameters: The updated private endpoint connection. + :param parameters: The updated private endpoint connection. Required. :type parameters: ~azure.mgmt.containerservice.v2022_06_01.models.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_01.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + async def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: The updated private endpoint connection. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_01.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: Union[_models.PrivateEndpointConnection, IO], + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: The updated private endpoint connection. Is either a model type or a IO + type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_06_01.models.PrivateEndpointConnection or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_01.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - _json = self._serialize.body(parameters, 'PrivateEndpointConnection') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateEndpointConnection") request = build_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update.metadata['url'], + content=_content, + template_url=self.update.metadata["url"], headers=_headers, params=_params, ) @@ -236,52 +310,43 @@ async def update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -289,10 +354,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -302,26 +366,22 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + async def begin_delete( + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes a private endpoint connection. Deletes a private endpoint connection. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -333,53 +393,46 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/aio/operations/_private_link_resources_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/aio/operations/_private_link_resources_operations.py index 58e93c89881d..39b08bc844c2 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/aio/operations/_private_link_resources_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/aio/operations/_private_link_resources_operations.py @@ -8,7 +8,13 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -19,9 +25,11 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._private_link_resources_operations import build_list_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class PrivateLinkResourcesOperations: """ .. warning:: @@ -41,13 +49,9 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async async def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.PrivateLinkResourcesListResult: """Gets a list of private link resources in the specified managed cluster. @@ -55,32 +59,30 @@ async def list( https://docs.microsoft.com/azure/aks/private-clusters. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResourcesListResult, or the result of cls(response) + :return: PrivateLinkResourcesListResult or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_01.models.PrivateLinkResourcesListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResourcesListResult] - request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -88,22 +90,20 @@ async def list( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResourcesListResult', pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources"} # type: ignore - + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/aio/operations/_resolve_private_link_service_id_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/aio/operations/_resolve_private_link_service_id_operations.py index 7b778544306f..cd65a1fe5766 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/aio/operations/_resolve_private_link_service_id_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/aio/operations/_resolve_private_link_service_id_operations.py @@ -6,9 +6,15 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -19,9 +25,11 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._resolve_private_link_service_id_operations import build_post_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class ResolvePrivateLinkServiceIdOperations: """ .. warning:: @@ -41,13 +49,14 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async + @overload async def post( self, resource_group_name: str, resource_name: str, parameters: _models.PrivateLinkResource, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateLinkResource: """Gets the private link service ID for the specified managed cluster. @@ -55,38 +64,106 @@ async def post( Gets the private link service ID for the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters required in order to resolve a private link service ID. + :param parameters: Parameters required in order to resolve a private link service ID. Required. :type parameters: ~azure.mgmt.containerservice.v2022_06_01.models.PrivateLinkResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_01.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def post( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID for the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters required in order to resolve a private link service ID. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResource, or the result of cls(response) + :return: PrivateLinkResource or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_01.models.PrivateLinkResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @distributed_trace_async + async def post( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.PrivateLinkResource, IO], + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID for the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters required in order to resolve a private link service ID. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_06_01.models.PrivateLinkResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_01.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResource] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResource] - _json = self._serialize.body(parameters, 'PrivateLinkResource') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateLinkResource") request = build_post_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.post.metadata['url'], + content=_content, + template_url=self.post.metadata["url"], headers=_headers, params=_params, ) @@ -94,22 +171,20 @@ async def post( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResource', pipeline_response) + deserialized = self._deserialize("PrivateLinkResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - post.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId"} # type: ignore - + post.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/aio/operations/_snapshots_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/aio/operations/_snapshots_operations.py index d4e1160f835e..dd7eb736eeb8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/aio/operations/_snapshots_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/aio/operations/_snapshots_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,10 +27,19 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._snapshots_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_resource_group_request, build_list_request, build_update_tags_request -T = TypeVar('T') +from ...operations._snapshots_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_resource_group_request, + build_list_request, + build_update_tags_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class SnapshotsOperations: """ .. warning:: @@ -43,39 +59,34 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.SnapshotListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.Snapshot"]: """Gets a list of snapshots in the specified subscription. Gets a list of snapshots in the specified subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SnapshotListResult or the result of cls(response) + :return: An iterator like instance of either Snapshot or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_06_01.models.SnapshotListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_06_01.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SnapshotListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -83,14 +94,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -106,10 +114,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -119,48 +125,42 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots"} # type: ignore @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.SnapshotListResult]: + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.Snapshot"]: """Lists snapshots in the specified subscription and resource group. Lists snapshots in the specified subscription and resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SnapshotListResult or the result of cls(response) + :return: An iterator like instance of either Snapshot or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_06_01.models.SnapshotListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_06_01.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SnapshotListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -168,15 +168,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -192,10 +188,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -205,50 +199,41 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots"} # type: ignore @distributed_trace_async - async def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.Snapshot: + async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.Snapshot: """Gets a snapshot. Gets a snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Snapshot, or the result of cls(response) + :return: Snapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_01.models.Snapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -256,32 +241,32 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - - @distributed_trace_async + @overload async def create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.Snapshot, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.Snapshot: """Creates or updates a snapshot. @@ -289,38 +274,102 @@ async def create_or_update( Creates or updates a snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The snapshot to create or update. + :param parameters: The snapshot to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_06_01.models.Snapshot + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Snapshot, or the result of cls(response) + :return: Snapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_01.models.Snapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Snapshot: + """Creates or updates a snapshot. + + Creates or updates a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The snapshot to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_01.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.Snapshot, IO], **kwargs: Any + ) -> _models.Snapshot: + """Creates or updates a snapshot. + + Creates or updates a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The snapshot to create or update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.mgmt.containerservice.v2022_06_01.models.Snapshot or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_01.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] - _json = self._serialize.body(parameters, 'Snapshot') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "Snapshot") request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) @@ -328,10 +377,9 @@ async def create_or_update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -339,25 +387,26 @@ async def create_or_update( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - @distributed_trace_async + @overload async def update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.Snapshot: """Updates tags on a snapshot. @@ -365,38 +414,102 @@ async def update_tags( Updates tags on a snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update snapshot Tags operation. + :param parameters: Parameters supplied to the Update snapshot Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2022_06_01.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_01.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Snapshot: + """Updates tags on a snapshot. + + Updates tags on a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update snapshot Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Snapshot, or the result of cls(response) + :return: Snapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_01.models.Snapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @distributed_trace_async + async def update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> _models.Snapshot: + """Updates tags on a snapshot. + + Updates tags on a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update snapshot Tags operation. Is either a model + type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_06_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_01.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") request = build_update_tags_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_tags.metadata['url'], + content=_content, + template_url=self.update_tags.metadata["url"], headers=_headers, params=_params, ) @@ -404,64 +517,57 @@ async def update_tags( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - + update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: """Deletes a snapshot. Deletes a snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) @@ -469,10 +575,9 @@ async def delete( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -482,5 +587,4 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - + delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/models/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/models/__init__.py index 52ea0f0c1d12..c6d6e12b58a8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/models/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/models/__init__.py @@ -100,180 +100,178 @@ from ._models_py3 import UserAssignedIdentity from ._models_py3 import WindowsGmsaProfile - -from ._container_service_client_enums import ( - AgentPoolMode, - AgentPoolType, - Code, - ConnectionStatus, - ContainerServiceStorageProfileTypes, - ContainerServiceVMSizeTypes, - Count, - CreatedByType, - Expander, - ExtendedLocationTypes, - Format, - GPUInstanceProfile, - IpFamily, - KeyVaultNetworkAccessTypes, - KubeletDiskType, - LicenseType, - LoadBalancerSku, - ManagedClusterPodIdentityProvisioningState, - ManagedClusterSKUName, - ManagedClusterSKUTier, - NetworkMode, - NetworkPlugin, - NetworkPolicy, - OSDiskType, - OSSKU, - OSType, - OutboundType, - PrivateEndpointConnectionProvisioningState, - PublicNetworkAccess, - ResourceIdentityType, - ScaleDownMode, - ScaleSetEvictionPolicy, - ScaleSetPriority, - SnapshotType, - UpgradeChannel, - WeekDay, - WorkloadRuntime, -) +from ._container_service_client_enums import AgentPoolMode +from ._container_service_client_enums import AgentPoolType +from ._container_service_client_enums import Code +from ._container_service_client_enums import ConnectionStatus +from ._container_service_client_enums import ContainerServiceStorageProfileTypes +from ._container_service_client_enums import ContainerServiceVMSizeTypes +from ._container_service_client_enums import Count +from ._container_service_client_enums import CreatedByType +from ._container_service_client_enums import Expander +from ._container_service_client_enums import ExtendedLocationTypes +from ._container_service_client_enums import Format +from ._container_service_client_enums import GPUInstanceProfile +from ._container_service_client_enums import IpFamily +from ._container_service_client_enums import KeyVaultNetworkAccessTypes +from ._container_service_client_enums import KubeletDiskType +from ._container_service_client_enums import LicenseType +from ._container_service_client_enums import LoadBalancerSku +from ._container_service_client_enums import ManagedClusterPodIdentityProvisioningState +from ._container_service_client_enums import ManagedClusterSKUName +from ._container_service_client_enums import ManagedClusterSKUTier +from ._container_service_client_enums import NetworkMode +from ._container_service_client_enums import NetworkPlugin +from ._container_service_client_enums import NetworkPolicy +from ._container_service_client_enums import OSDiskType +from ._container_service_client_enums import OSSKU +from ._container_service_client_enums import OSType +from ._container_service_client_enums import OutboundType +from ._container_service_client_enums import PrivateEndpointConnectionProvisioningState +from ._container_service_client_enums import PublicNetworkAccess +from ._container_service_client_enums import ResourceIdentityType +from ._container_service_client_enums import ScaleDownMode +from ._container_service_client_enums import ScaleSetEvictionPolicy +from ._container_service_client_enums import ScaleSetPriority +from ._container_service_client_enums import SnapshotType +from ._container_service_client_enums import UpgradeChannel +from ._container_service_client_enums import WeekDay +from ._container_service_client_enums import WorkloadRuntime from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'AgentPool', - 'AgentPoolAvailableVersions', - 'AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem', - 'AgentPoolListResult', - 'AgentPoolUpgradeProfile', - 'AgentPoolUpgradeProfilePropertiesUpgradesItem', - 'AgentPoolUpgradeSettings', - 'AzureKeyVaultKms', - 'CloudErrorBody', - 'ContainerServiceDiagnosticsProfile', - 'ContainerServiceLinuxProfile', - 'ContainerServiceMasterProfile', - 'ContainerServiceNetworkProfile', - 'ContainerServiceSshConfiguration', - 'ContainerServiceSshPublicKey', - 'ContainerServiceVMDiagnostics', - 'CreationData', - 'CredentialResult', - 'CredentialResults', - 'EndpointDependency', - 'EndpointDetail', - 'ExtendedLocation', - 'KubeletConfig', - 'LinuxOSConfig', - 'MaintenanceConfiguration', - 'MaintenanceConfigurationListResult', - 'ManagedCluster', - 'ManagedClusterAADProfile', - 'ManagedClusterAPIServerAccessProfile', - 'ManagedClusterAccessProfile', - 'ManagedClusterAddonProfile', - 'ManagedClusterAddonProfileIdentity', - 'ManagedClusterAgentPoolProfile', - 'ManagedClusterAgentPoolProfileProperties', - 'ManagedClusterAutoUpgradeProfile', - 'ManagedClusterHTTPProxyConfig', - 'ManagedClusterIdentity', - 'ManagedClusterListResult', - 'ManagedClusterLoadBalancerProfile', - 'ManagedClusterLoadBalancerProfileManagedOutboundIPs', - 'ManagedClusterLoadBalancerProfileOutboundIPPrefixes', - 'ManagedClusterLoadBalancerProfileOutboundIPs', - 'ManagedClusterManagedOutboundIPProfile', - 'ManagedClusterNATGatewayProfile', - 'ManagedClusterPodIdentity', - 'ManagedClusterPodIdentityException', - 'ManagedClusterPodIdentityProfile', - 'ManagedClusterPodIdentityProvisioningError', - 'ManagedClusterPodIdentityProvisioningErrorBody', - 'ManagedClusterPodIdentityProvisioningInfo', - 'ManagedClusterPoolUpgradeProfile', - 'ManagedClusterPoolUpgradeProfileUpgradesItem', - 'ManagedClusterPropertiesAutoScalerProfile', - 'ManagedClusterSKU', - 'ManagedClusterSecurityProfile', - 'ManagedClusterSecurityProfileDefender', - 'ManagedClusterSecurityProfileDefenderSecurityMonitoring', - 'ManagedClusterServicePrincipalProfile', - 'ManagedClusterStorageProfile', - 'ManagedClusterStorageProfileDiskCSIDriver', - 'ManagedClusterStorageProfileFileCSIDriver', - 'ManagedClusterStorageProfileSnapshotController', - 'ManagedClusterUpgradeProfile', - 'ManagedClusterWindowsProfile', - 'ManagedServiceIdentityUserAssignedIdentitiesValue', - 'OSOptionProfile', - 'OSOptionProperty', - 'OperationListResult', - 'OperationValue', - 'OutboundEnvironmentEndpoint', - 'OutboundEnvironmentEndpointCollection', - 'PowerState', - 'PrivateEndpoint', - 'PrivateEndpointConnection', - 'PrivateEndpointConnectionListResult', - 'PrivateLinkResource', - 'PrivateLinkResourcesListResult', - 'PrivateLinkServiceConnectionState', - 'Resource', - 'ResourceReference', - 'RunCommandRequest', - 'RunCommandResult', - 'Snapshot', - 'SnapshotListResult', - 'SubResource', - 'SysctlConfig', - 'SystemData', - 'TagsObject', - 'TimeInWeek', - 'TimeSpan', - 'TrackedResource', - 'UserAssignedIdentity', - 'WindowsGmsaProfile', - 'AgentPoolMode', - 'AgentPoolType', - 'Code', - 'ConnectionStatus', - 'ContainerServiceStorageProfileTypes', - 'ContainerServiceVMSizeTypes', - 'Count', - 'CreatedByType', - 'Expander', - 'ExtendedLocationTypes', - 'Format', - 'GPUInstanceProfile', - 'IpFamily', - 'KeyVaultNetworkAccessTypes', - 'KubeletDiskType', - 'LicenseType', - 'LoadBalancerSku', - 'ManagedClusterPodIdentityProvisioningState', - 'ManagedClusterSKUName', - 'ManagedClusterSKUTier', - 'NetworkMode', - 'NetworkPlugin', - 'NetworkPolicy', - 'OSDiskType', - 'OSSKU', - 'OSType', - 'OutboundType', - 'PrivateEndpointConnectionProvisioningState', - 'PublicNetworkAccess', - 'ResourceIdentityType', - 'ScaleDownMode', - 'ScaleSetEvictionPolicy', - 'ScaleSetPriority', - 'SnapshotType', - 'UpgradeChannel', - 'WeekDay', - 'WorkloadRuntime', + "AgentPool", + "AgentPoolAvailableVersions", + "AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem", + "AgentPoolListResult", + "AgentPoolUpgradeProfile", + "AgentPoolUpgradeProfilePropertiesUpgradesItem", + "AgentPoolUpgradeSettings", + "AzureKeyVaultKms", + "CloudErrorBody", + "ContainerServiceDiagnosticsProfile", + "ContainerServiceLinuxProfile", + "ContainerServiceMasterProfile", + "ContainerServiceNetworkProfile", + "ContainerServiceSshConfiguration", + "ContainerServiceSshPublicKey", + "ContainerServiceVMDiagnostics", + "CreationData", + "CredentialResult", + "CredentialResults", + "EndpointDependency", + "EndpointDetail", + "ExtendedLocation", + "KubeletConfig", + "LinuxOSConfig", + "MaintenanceConfiguration", + "MaintenanceConfigurationListResult", + "ManagedCluster", + "ManagedClusterAADProfile", + "ManagedClusterAPIServerAccessProfile", + "ManagedClusterAccessProfile", + "ManagedClusterAddonProfile", + "ManagedClusterAddonProfileIdentity", + "ManagedClusterAgentPoolProfile", + "ManagedClusterAgentPoolProfileProperties", + "ManagedClusterAutoUpgradeProfile", + "ManagedClusterHTTPProxyConfig", + "ManagedClusterIdentity", + "ManagedClusterListResult", + "ManagedClusterLoadBalancerProfile", + "ManagedClusterLoadBalancerProfileManagedOutboundIPs", + "ManagedClusterLoadBalancerProfileOutboundIPPrefixes", + "ManagedClusterLoadBalancerProfileOutboundIPs", + "ManagedClusterManagedOutboundIPProfile", + "ManagedClusterNATGatewayProfile", + "ManagedClusterPodIdentity", + "ManagedClusterPodIdentityException", + "ManagedClusterPodIdentityProfile", + "ManagedClusterPodIdentityProvisioningError", + "ManagedClusterPodIdentityProvisioningErrorBody", + "ManagedClusterPodIdentityProvisioningInfo", + "ManagedClusterPoolUpgradeProfile", + "ManagedClusterPoolUpgradeProfileUpgradesItem", + "ManagedClusterPropertiesAutoScalerProfile", + "ManagedClusterSKU", + "ManagedClusterSecurityProfile", + "ManagedClusterSecurityProfileDefender", + "ManagedClusterSecurityProfileDefenderSecurityMonitoring", + "ManagedClusterServicePrincipalProfile", + "ManagedClusterStorageProfile", + "ManagedClusterStorageProfileDiskCSIDriver", + "ManagedClusterStorageProfileFileCSIDriver", + "ManagedClusterStorageProfileSnapshotController", + "ManagedClusterUpgradeProfile", + "ManagedClusterWindowsProfile", + "ManagedServiceIdentityUserAssignedIdentitiesValue", + "OSOptionProfile", + "OSOptionProperty", + "OperationListResult", + "OperationValue", + "OutboundEnvironmentEndpoint", + "OutboundEnvironmentEndpointCollection", + "PowerState", + "PrivateEndpoint", + "PrivateEndpointConnection", + "PrivateEndpointConnectionListResult", + "PrivateLinkResource", + "PrivateLinkResourcesListResult", + "PrivateLinkServiceConnectionState", + "Resource", + "ResourceReference", + "RunCommandRequest", + "RunCommandResult", + "Snapshot", + "SnapshotListResult", + "SubResource", + "SysctlConfig", + "SystemData", + "TagsObject", + "TimeInWeek", + "TimeSpan", + "TrackedResource", + "UserAssignedIdentity", + "WindowsGmsaProfile", + "AgentPoolMode", + "AgentPoolType", + "Code", + "ConnectionStatus", + "ContainerServiceStorageProfileTypes", + "ContainerServiceVMSizeTypes", + "Count", + "CreatedByType", + "Expander", + "ExtendedLocationTypes", + "Format", + "GPUInstanceProfile", + "IpFamily", + "KeyVaultNetworkAccessTypes", + "KubeletDiskType", + "LicenseType", + "LoadBalancerSku", + "ManagedClusterPodIdentityProvisioningState", + "ManagedClusterSKUName", + "ManagedClusterSKUTier", + "NetworkMode", + "NetworkPlugin", + "NetworkPolicy", + "OSDiskType", + "OSSKU", + "OSType", + "OutboundType", + "PrivateEndpointConnectionProvisioningState", + "PublicNetworkAccess", + "ResourceIdentityType", + "ScaleDownMode", + "ScaleSetEvictionPolicy", + "ScaleSetPriority", + "SnapshotType", + "UpgradeChannel", + "WeekDay", + "WorkloadRuntime", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/models/_container_service_client_enums.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/models/_container_service_client_enums.py index 05a96178d57c..6f157dd9cf18 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/models/_container_service_client_enums.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/models/_container_service_client_enums.py @@ -13,7 +13,7 @@ class AgentPoolMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools + https://docs.microsoft.com/azure/aks/use-system-pools. """ #: System agent pools are primarily for hosting critical system pods such as CoreDNS and @@ -23,33 +23,34 @@ class AgentPoolMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: User agent pools are primarily for hosting your application pods. USER = "User" + class AgentPoolType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of Agent Pool. - """ + """The type of Agent Pool.""" #: Create an Agent Pool backed by a Virtual Machine Scale Set. VIRTUAL_MACHINE_SCALE_SETS = "VirtualMachineScaleSets" #: Use of this is strongly discouraged. AVAILABILITY_SET = "AvailabilitySet" + class Code(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Tells whether the cluster is Running or Stopped - """ + """Tells whether the cluster is Running or Stopped.""" #: The cluster is running. RUNNING = "Running" #: The cluster is stopped. STOPPED = "Stopped" + class ConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The private link service connection status. - """ + """The private link service connection status.""" PENDING = "Pending" APPROVED = "Approved" REJECTED = "Rejected" DISCONNECTED = "Disconnected" + class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Specifies what kind of storage to use. If omitted, the default will be chosen on your behalf based on the choice of orchestrator. @@ -58,9 +59,9 @@ class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEn STORAGE_ACCOUNT = "StorageAccount" MANAGED_DISKS = "ManagedDisks" + class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Size of agent VMs. Note: This is no longer maintained. - """ + """Size of agent VMs. Note: This is no longer maintained.""" STANDARD_A1 = "Standard_A1" STANDARD_A10 = "Standard_A10" @@ -237,6 +238,7 @@ class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): STANDARD_NV24 = "Standard_NV24" STANDARD_NV6 = "Standard_NV6" + class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): """Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, and 5. The default value is 1. @@ -246,15 +248,16 @@ class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): THREE = 3 FIVE = 5 + class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of identity that created the resource. - """ + """The type of identity that created the resource.""" USER = "User" APPLICATION = "Application" MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" + class Expander(str, Enum, metaclass=CaseInsensitiveEnumMeta): """If not specified, the default is 'random'. See `expanders `_ @@ -278,23 +281,25 @@ class Expander(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Used when you don't have a particular need for the node groups to scale differently. RANDOM = "random" + class ExtendedLocationTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of extendedLocation. - """ + """The type of extendedLocation.""" EDGE_ZONE = "EdgeZone" + class Format(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Format.""" #: Return azure auth-provider kubeconfig. This format is deprecated in 1.22 and will be fully #: removed in 1.25. AZURE = "azure" #: Return exec format kubeconfig. This format requires kubelogin binary in the path. - EXEC_ENUM = "exec" + EXEC = "exec" + class GPUInstanceProfile(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """GPUInstanceProfile to be used to specify GPU MIG instance profile for supported GPU VM SKU. - """ + """GPUInstanceProfile to be used to specify GPU MIG instance profile for supported GPU VM SKU.""" MIG1_G = "MIG1g" MIG2_G = "MIG2g" @@ -302,13 +307,14 @@ class GPUInstanceProfile(str, Enum, metaclass=CaseInsensitiveEnumMeta): MIG4_G = "MIG4g" MIG7_G = "MIG7g" + class IpFamily(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The IP version to use for cluster networking and IP assignment. - """ + """The IP version to use for cluster networking and IP assignment.""" I_PV4 = "IPv4" I_PV6 = "IPv6" + class KeyVaultNetworkAccessTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Network access of key vault. The possible values are ``Public`` and ``Private``. ``Public`` means the key vault allows public access from all networks. ``Private`` means the key vault @@ -318,6 +324,7 @@ class KeyVaultNetworkAccessTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): PUBLIC = "Public" PRIVATE = "Private" + class KubeletDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. @@ -328,6 +335,7 @@ class KubeletDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Kubelet will use the temporary disk for its data. TEMPORARY = "Temporary" + class LicenseType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The license type to use for Windows VMs. See `Azure Hybrid User Benefits `_ for more details. @@ -338,6 +346,7 @@ class LicenseType(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Enables Azure Hybrid User Benefits for Windows VMs. WINDOWS_SERVER = "Windows_Server" + class LoadBalancerSku(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The default is 'standard'. See `Azure Load Balancer SKUs `_ for more information about the @@ -351,21 +360,22 @@ class LoadBalancerSku(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Use a basic Load Balancer with limited functionality. BASIC = "basic" + class ManagedClusterPodIdentityProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The current provisioning state of the pod identity. - """ + """The current provisioning state of the pod identity.""" ASSIGNED = "Assigned" UPDATING = "Updating" DELETING = "Deleting" FAILED = "Failed" + class ManagedClusterSKUName(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The name of a managed cluster SKU. - """ + """The name of a managed cluster SKU.""" BASIC = "Basic" + class ManagedClusterSKUTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): """If not specified, the default is 'Free'. See `uptime SLA `_ for more details. @@ -377,20 +387,20 @@ class ManagedClusterSKUTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: No guaranteed SLA, no additional charges. Free tier clusters have an SLO of 99.5%. FREE = "Free" + class NetworkMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """This cannot be specified if networkPlugin is anything other than 'azure'. - """ + """This cannot be specified if networkPlugin is anything other than 'azure'.""" #: No bridge is created. Intra-VM Pod to Pod communication is through IP routes created by Azure #: CNI. See `Transparent Mode `_ for #: more information. TRANSPARENT = "transparent" - #: This is no longer supported. + #: This is no longer supported BRIDGE = "bridge" + class NetworkPlugin(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Network plugin used for building the Kubernetes network. - """ + """Network plugin used for building the Kubernetes network.""" #: Use the Azure CNI network plugin. See `Azure CNI (advanced) networking #: `_ for @@ -404,9 +414,9 @@ class NetworkPlugin(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: `_ for more information. NONE = "none" + class NetworkPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Network policy used for building the Kubernetes network. - """ + """Network policy used for building the Kubernetes network.""" #: Use Calico network policies. See `differences between Azure and Calico policies #: `_ @@ -417,6 +427,7 @@ class NetworkPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: for more information. AZURE = "azure" + class OSDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more @@ -433,22 +444,23 @@ class OSDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: provides lower read/write latency, along with faster node scaling and cluster upgrades. EPHEMERAL = "Ephemeral" + class OSSKU(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Specifies an OS SKU. This value must not be specified if OSType is Windows. - """ + """Specifies an OS SKU. This value must not be specified if OSType is Windows.""" UBUNTU = "Ubuntu" CBL_MARINER = "CBLMariner" + class OSType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The operating system type. The default is Linux. - """ + """The operating system type. The default is Linux.""" #: Use Linux. LINUX = "Linux" #: Use Windows. WINDOWS = "Windows" + class OutboundType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """This can only be set at cluster creation time and cannot be changed later. For more information see `egress outbound type `_. @@ -469,22 +481,23 @@ class OutboundType(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: advanced scenario and requires proper network configuration. USER_ASSIGNED_NAT_GATEWAY = "userAssignedNATGateway" + class PrivateEndpointConnectionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The current provisioning state. - """ + """The current provisioning state.""" SUCCEEDED = "Succeeded" CREATING = "Creating" DELETING = "Deleting" FAILED = "Failed" + class PublicNetworkAccess(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Allow or deny public network access for AKS - """ + """Allow or deny public network access for AKS.""" ENABLED = "Enabled" DISABLED = "Disabled" + class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """For more information see `use managed identities in AKS `_. @@ -501,6 +514,7 @@ class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Do not use a managed identity for the Managed Cluster, service principal will be used instead. NONE = "None" + class ScaleDownMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Describes how VMs are added to or removed from Agent Pools. See `billing states `_. @@ -512,10 +526,11 @@ class ScaleDownMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: during scale down. DEALLOCATE = "Deallocate" + class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The eviction policy specifies what to do with the VM when it is evicted. The default is Delete. For more information about eviction see `spot VMs - `_ + `_. """ #: Nodes in the underlying Scale Set of the node pool are deleted when they're evicted. @@ -525,9 +540,9 @@ class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: cause issues with cluster scaling or upgrading. DEALLOCATE = "Deallocate" + class ScaleSetPriority(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The Virtual Machine Scale Set priority. - """ + """The Virtual Machine Scale Set priority.""" #: Spot priority VMs will be used. There is no SLA for spot nodes. See `spot on AKS #: `_ for more information. @@ -535,13 +550,14 @@ class ScaleSetPriority(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Regular VMs will be used. REGULAR = "Regular" + class SnapshotType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of a snapshot. The default is NodePool. - """ + """The type of a snapshot. The default is NodePool.""" #: The snapshot is a snapshot of a node pool. NODE_POOL = "NodePool" + class UpgradeChannel(str, Enum, metaclass=CaseInsensitiveEnumMeta): """For more information see `setting the AKS cluster auto-upgrade channel `_. @@ -572,9 +588,9 @@ class UpgradeChannel(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Disables auto-upgrades and keeps the cluster at its current version of Kubernetes. NONE = "none" + class WeekDay(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The weekday enum. - """ + """The weekday enum.""" SUNDAY = "Sunday" MONDAY = "Monday" @@ -584,9 +600,9 @@ class WeekDay(str, Enum, metaclass=CaseInsensitiveEnumMeta): FRIDAY = "Friday" SATURDAY = "Saturday" + class WorkloadRuntime(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Determines the type of workload a node can run. - """ + """Determines the type of workload a node can run.""" #: Nodes will use Kubelet to run standard OCI container workloads. OCI_CONTAINER = "OCIContainer" diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/models/_models_py3.py index 0dee85c7cdfd..0e89b37b573f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/models/_models_py3.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/models/_models_py3.py @@ -1,4 +1,5 @@ # coding=utf-8 +# pylint: disable=too-many-lines # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -9,14 +10,14 @@ import datetime from typing import Dict, List, Optional, TYPE_CHECKING, Union -import msrest.serialization +from ... import _serialization if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - import __init__ as _models + from .. import models as _models -class SubResource(msrest.serialization.Model): +class SubResource(_serialization.Model): """Reference to another subresource. Variables are only populated by the server, and will be ignored when sending a request. @@ -31,30 +32,26 @@ class SubResource(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(SubResource, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.id = None self.name = None self.type = None -class AgentPool(SubResource): +class AgentPool(SubResource): # pylint: disable=too-many-instance-attributes """Agent Pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -82,14 +79,14 @@ class AgentPool(SubResource): larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2022_06_01.models.OSDiskType :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data - root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_06_01.models.KubeletDiskType :ivar workload_runtime: Determines the type of workload a node can run. Known values are: - "OCIContainer", "WasmWasi". + "OCIContainer" and "WasmWasi". :vartype workload_runtime: str or ~azure.mgmt.containerservice.v2022_06_01.models.WorkloadRuntime :ivar vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and used. @@ -103,11 +100,11 @@ class AgentPool(SubResource): :vartype pod_subnet_id: str :ivar max_pods: The maximum number of pods that can run on a node. :vartype max_pods: int - :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_06_01.models.OSType :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known - values are: "Ubuntu", "CBLMariner". + values are: "Ubuntu" and "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2022_06_01.models.OSSKU :ivar max_count: The maximum number of nodes for auto-scaling. :vartype max_count: int @@ -116,15 +113,15 @@ class AgentPool(SubResource): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it - defaults to Delete. Known values are: "Delete", "Deallocate". + defaults to Delete. Known values are: "Delete" and "Deallocate". :vartype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_06_01.models.ScaleDownMode - :ivar type_properties_type: The type of Agent Pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + :ivar type_properties_type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets" + and "AvailabilitySet". :vartype type_properties_type: str or ~azure.mgmt.containerservice.v2022_06_01.models.AgentPoolType :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :vartype mode: str or ~azure.mgmt.containerservice.v2022_06_01.models.AgentPoolMode :ivar orchestrator_version: Both patch version (e.g. 1.20.13) and (e.g. 1.20) are supported. When is specified, the latest supported @@ -167,20 +164,18 @@ class AgentPool(SubResource): /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default - is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + is 'Regular'. Known values are: "Spot" and "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_06_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_06_01.models.ScaleSetEvictionPolicy :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :vartype spot_max_price: float - :ivar tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :ivar tags: The tags to be persisted on the agent pool virtual machine scale set. :vartype tags: dict[str, str] :ivar node_labels: The node labels to be persisted across all nodes in agent pool. :vartype node_labels: dict[str, str] @@ -204,7 +199,7 @@ class AgentPool(SubResource): for more details. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_06_01.models.GPUInstanceProfile :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the node pool @@ -218,63 +213,63 @@ class AgentPool(SubResource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'os_disk_size_gb': {'maximum': 2048, 'minimum': 0}, - 'current_orchestrator_version': {'readonly': True}, - 'node_image_version': {'readonly': True}, - 'provisioning_state': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "os_disk_size_gb": {"maximum": 2048, "minimum": 0}, + "current_orchestrator_version": {"readonly": True}, + "node_image_version": {"readonly": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'count': {'key': 'properties.count', 'type': 'int'}, - 'vm_size': {'key': 'properties.vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'properties.osDiskSizeGB', 'type': 'int'}, - 'os_disk_type': {'key': 'properties.osDiskType', 'type': 'str'}, - 'kubelet_disk_type': {'key': 'properties.kubeletDiskType', 'type': 'str'}, - 'workload_runtime': {'key': 'properties.workloadRuntime', 'type': 'str'}, - 'vnet_subnet_id': {'key': 'properties.vnetSubnetID', 'type': 'str'}, - 'pod_subnet_id': {'key': 'properties.podSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'properties.maxPods', 'type': 'int'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'os_sku': {'key': 'properties.osSKU', 'type': 'str'}, - 'max_count': {'key': 'properties.maxCount', 'type': 'int'}, - 'min_count': {'key': 'properties.minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'properties.enableAutoScaling', 'type': 'bool'}, - 'scale_down_mode': {'key': 'properties.scaleDownMode', 'type': 'str'}, - 'type_properties_type': {'key': 'properties.type', 'type': 'str'}, - 'mode': {'key': 'properties.mode', 'type': 'str'}, - 'orchestrator_version': {'key': 'properties.orchestratorVersion', 'type': 'str'}, - 'current_orchestrator_version': {'key': 'properties.currentOrchestratorVersion', 'type': 'str'}, - 'node_image_version': {'key': 'properties.nodeImageVersion', 'type': 'str'}, - 'upgrade_settings': {'key': 'properties.upgradeSettings', 'type': 'AgentPoolUpgradeSettings'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'power_state': {'key': 'properties.powerState', 'type': 'PowerState'}, - 'availability_zones': {'key': 'properties.availabilityZones', 'type': '[str]'}, - 'enable_node_public_ip': {'key': 'properties.enableNodePublicIP', 'type': 'bool'}, - 'node_public_ip_prefix_id': {'key': 'properties.nodePublicIPPrefixID', 'type': 'str'}, - 'scale_set_priority': {'key': 'properties.scaleSetPriority', 'type': 'str'}, - 'scale_set_eviction_policy': {'key': 'properties.scaleSetEvictionPolicy', 'type': 'str'}, - 'spot_max_price': {'key': 'properties.spotMaxPrice', 'type': 'float'}, - 'tags': {'key': 'properties.tags', 'type': '{str}'}, - 'node_labels': {'key': 'properties.nodeLabels', 'type': '{str}'}, - 'node_taints': {'key': 'properties.nodeTaints', 'type': '[str]'}, - 'proximity_placement_group_id': {'key': 'properties.proximityPlacementGroupID', 'type': 'str'}, - 'kubelet_config': {'key': 'properties.kubeletConfig', 'type': 'KubeletConfig'}, - 'linux_os_config': {'key': 'properties.linuxOSConfig', 'type': 'LinuxOSConfig'}, - 'enable_encryption_at_host': {'key': 'properties.enableEncryptionAtHost', 'type': 'bool'}, - 'enable_ultra_ssd': {'key': 'properties.enableUltraSSD', 'type': 'bool'}, - 'enable_fips': {'key': 'properties.enableFIPS', 'type': 'bool'}, - 'gpu_instance_profile': {'key': 'properties.gpuInstanceProfile', 'type': 'str'}, - 'creation_data': {'key': 'properties.creationData', 'type': 'CreationData'}, - 'host_group_id': {'key': 'properties.hostGroupID', 'type': 'str'}, - } - - def __init__( + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "count": {"key": "properties.count", "type": "int"}, + "vm_size": {"key": "properties.vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "properties.osDiskSizeGB", "type": "int"}, + "os_disk_type": {"key": "properties.osDiskType", "type": "str"}, + "kubelet_disk_type": {"key": "properties.kubeletDiskType", "type": "str"}, + "workload_runtime": {"key": "properties.workloadRuntime", "type": "str"}, + "vnet_subnet_id": {"key": "properties.vnetSubnetID", "type": "str"}, + "pod_subnet_id": {"key": "properties.podSubnetID", "type": "str"}, + "max_pods": {"key": "properties.maxPods", "type": "int"}, + "os_type": {"key": "properties.osType", "type": "str"}, + "os_sku": {"key": "properties.osSKU", "type": "str"}, + "max_count": {"key": "properties.maxCount", "type": "int"}, + "min_count": {"key": "properties.minCount", "type": "int"}, + "enable_auto_scaling": {"key": "properties.enableAutoScaling", "type": "bool"}, + "scale_down_mode": {"key": "properties.scaleDownMode", "type": "str"}, + "type_properties_type": {"key": "properties.type", "type": "str"}, + "mode": {"key": "properties.mode", "type": "str"}, + "orchestrator_version": {"key": "properties.orchestratorVersion", "type": "str"}, + "current_orchestrator_version": {"key": "properties.currentOrchestratorVersion", "type": "str"}, + "node_image_version": {"key": "properties.nodeImageVersion", "type": "str"}, + "upgrade_settings": {"key": "properties.upgradeSettings", "type": "AgentPoolUpgradeSettings"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "power_state": {"key": "properties.powerState", "type": "PowerState"}, + "availability_zones": {"key": "properties.availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "properties.enableNodePublicIP", "type": "bool"}, + "node_public_ip_prefix_id": {"key": "properties.nodePublicIPPrefixID", "type": "str"}, + "scale_set_priority": {"key": "properties.scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "properties.scaleSetEvictionPolicy", "type": "str"}, + "spot_max_price": {"key": "properties.spotMaxPrice", "type": "float"}, + "tags": {"key": "properties.tags", "type": "{str}"}, + "node_labels": {"key": "properties.nodeLabels", "type": "{str}"}, + "node_taints": {"key": "properties.nodeTaints", "type": "[str]"}, + "proximity_placement_group_id": {"key": "properties.proximityPlacementGroupID", "type": "str"}, + "kubelet_config": {"key": "properties.kubeletConfig", "type": "KubeletConfig"}, + "linux_os_config": {"key": "properties.linuxOSConfig", "type": "LinuxOSConfig"}, + "enable_encryption_at_host": {"key": "properties.enableEncryptionAtHost", "type": "bool"}, + "enable_ultra_ssd": {"key": "properties.enableUltraSSD", "type": "bool"}, + "enable_fips": {"key": "properties.enableFIPS", "type": "bool"}, + "gpu_instance_profile": {"key": "properties.gpuInstanceProfile", "type": "str"}, + "creation_data": {"key": "properties.creationData", "type": "CreationData"}, + "host_group_id": {"key": "properties.hostGroupID", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, count: Optional[int] = None, @@ -286,7 +281,7 @@ def __init__( vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, @@ -300,9 +295,9 @@ def __init__( availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", - spot_max_price: Optional[float] = -1, + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", + spot_max_price: float = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, @@ -334,14 +329,14 @@ def __init__( larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2022_06_01.models.OSDiskType :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime - data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + data root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_06_01.models.KubeletDiskType :keyword workload_runtime: Determines the type of workload a node can run. Known values are: - "OCIContainer", "WasmWasi". + "OCIContainer" and "WasmWasi". :paramtype workload_runtime: str or ~azure.mgmt.containerservice.v2022_06_01.models.WorkloadRuntime :keyword vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and @@ -355,11 +350,11 @@ def __init__( :paramtype pod_subnet_id: str :keyword max_pods: The maximum number of pods that can run on a node. :paramtype max_pods: int - :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_06_01.models.OSType :keyword os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Known values are: "Ubuntu", "CBLMariner". + Known values are: "Ubuntu" and "CBLMariner". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2022_06_01.models.OSSKU :keyword max_count: The maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -368,16 +363,16 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, - it defaults to Delete. Known values are: "Delete", "Deallocate". + it defaults to Delete. Known values are: "Delete" and "Deallocate". :paramtype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_06_01.models.ScaleDownMode :keyword type_properties_type: The type of Agent Pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type_properties_type: str or ~azure.mgmt.containerservice.v2022_06_01.models.AgentPoolType :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2022_06_01.models.AgentPoolMode :keyword orchestrator_version: Both patch version (e.g. 1.20.13) and (e.g. 1.20) are supported. When is specified, the latest supported @@ -412,20 +407,18 @@ def __init__( /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the - default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + default is 'Regular'. Known values are: "Spot" and "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_06_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_06_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :paramtype spot_max_price: float - :keyword tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :keyword tags: The tags to be persisted on the agent pool virtual machine scale set. :paramtype tags: dict[str, str] :keyword node_labels: The node labels to be persisted across all nodes in agent pool. :paramtype node_labels: dict[str, str] @@ -449,7 +442,7 @@ def __init__( for more details. :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance - profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_06_01.models.GPUInstanceProfile @@ -462,7 +455,7 @@ def __init__( `_. :paramtype host_group_id: str """ - super(AgentPool, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.vm_size = vm_size self.os_disk_size_gb = os_disk_size_gb @@ -506,7 +499,7 @@ def __init__( self.host_group_id = host_group_id -class AgentPoolAvailableVersions(msrest.serialization.Model): +class AgentPoolAvailableVersions(_serialization.Model): """The list of available versions for an agent pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -523,16 +516,19 @@ class AgentPoolAvailableVersions(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'agent_pool_versions': {'key': 'properties.agentPoolVersions', 'type': '[AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "agent_pool_versions": { + "key": "properties.agentPoolVersions", + "type": "[AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem]", + }, } def __init__( @@ -546,14 +542,14 @@ def __init__( :paramtype agent_pool_versions: list[~azure.mgmt.containerservice.v2022_06_01.models.AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem] """ - super(AgentPoolAvailableVersions, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None self.agent_pool_versions = agent_pool_versions -class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(msrest.serialization.Model): +class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(_serialization.Model): """AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem. :ivar default: Whether this version is the default agent pool version. @@ -565,9 +561,9 @@ class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(msrest.serializa """ _attribute_map = { - 'default': {'key': 'default', 'type': 'bool'}, - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "default": {"key": "default", "type": "bool"}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } def __init__( @@ -586,13 +582,13 @@ def __init__( :keyword is_preview: Whether Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.default = default self.kubernetes_version = kubernetes_version self.is_preview = is_preview -class AgentPoolListResult(msrest.serialization.Model): +class AgentPoolListResult(_serialization.Model): """The response from the List Agent Pools operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -604,30 +600,25 @@ class AgentPoolListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[AgentPool]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[AgentPool]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.AgentPool"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.AgentPool"]] = None, **kwargs): """ :keyword value: The list of agent pools. :paramtype value: list[~azure.mgmt.containerservice.v2022_06_01.models.AgentPool] """ - super(AgentPoolListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class AgentPoolUpgradeProfile(msrest.serialization.Model): +class AgentPoolUpgradeProfile(_serialization.Model): """The list of available upgrades for an agent pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -640,10 +631,10 @@ class AgentPoolUpgradeProfile(msrest.serialization.Model): :vartype name: str :ivar type: The type of the agent pool upgrade profile. :vartype type: str - :ivar kubernetes_version: Required. The Kubernetes version (major.minor.patch). + :ivar kubernetes_version: The Kubernetes version (major.minor.patch). Required. :vartype kubernetes_version: str - :ivar os_type: Required. The operating system type. The default is Linux. Known values are: - "Linux", "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_06_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -653,21 +644,21 @@ class AgentPoolUpgradeProfile(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kubernetes_version': {'required': True}, - 'os_type': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "kubernetes_version": {"required": True}, + "os_type": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'kubernetes_version': {'key': 'properties.kubernetesVersion', 'type': 'str'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'upgrades': {'key': 'properties.upgrades', 'type': '[AgentPoolUpgradeProfilePropertiesUpgradesItem]'}, - 'latest_node_image_version': {'key': 'properties.latestNodeImageVersion', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "os_type": {"key": "properties.osType", "type": "str"}, + "upgrades": {"key": "properties.upgrades", "type": "[AgentPoolUpgradeProfilePropertiesUpgradesItem]"}, + "latest_node_image_version": {"key": "properties.latestNodeImageVersion", "type": "str"}, } def __init__( @@ -680,10 +671,10 @@ def __init__( **kwargs ): """ - :keyword kubernetes_version: Required. The Kubernetes version (major.minor.patch). + :keyword kubernetes_version: The Kubernetes version (major.minor.patch). Required. :paramtype kubernetes_version: str - :keyword os_type: Required. The operating system type. The default is Linux. Known values are: - "Linux", "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_06_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: @@ -691,7 +682,7 @@ def __init__( :keyword latest_node_image_version: The latest AKS supported node image version. :paramtype latest_node_image_version: str """ - super(AgentPoolUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -701,7 +692,7 @@ def __init__( self.latest_node_image_version = latest_node_image_version -class AgentPoolUpgradeProfilePropertiesUpgradesItem(msrest.serialization.Model): +class AgentPoolUpgradeProfilePropertiesUpgradesItem(_serialization.Model): """AgentPoolUpgradeProfilePropertiesUpgradesItem. :ivar kubernetes_version: The Kubernetes version (major.minor.patch). @@ -711,29 +702,23 @@ class AgentPoolUpgradeProfilePropertiesUpgradesItem(msrest.serialization.Model): """ _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } - def __init__( - self, - *, - kubernetes_version: Optional[str] = None, - is_preview: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, kubernetes_version: Optional[str] = None, is_preview: Optional[bool] = None, **kwargs): """ :keyword kubernetes_version: The Kubernetes version (major.minor.patch). :paramtype kubernetes_version: str :keyword is_preview: Whether the Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(AgentPoolUpgradeProfilePropertiesUpgradesItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.is_preview = is_preview -class AgentPoolUpgradeSettings(msrest.serialization.Model): +class AgentPoolUpgradeSettings(_serialization.Model): """Settings for upgrading an agentpool. :ivar max_surge: This can either be set to an integer (e.g. '5') or a percentage (e.g. '50%'). @@ -745,15 +730,10 @@ class AgentPoolUpgradeSettings(msrest.serialization.Model): """ _attribute_map = { - 'max_surge': {'key': 'maxSurge', 'type': 'str'}, + "max_surge": {"key": "maxSurge", "type": "str"}, } - def __init__( - self, - *, - max_surge: Optional[str] = None, - **kwargs - ): + def __init__(self, *, max_surge: Optional[str] = None, **kwargs): """ :keyword max_surge: This can either be set to an integer (e.g. '5') or a percentage (e.g. '50%'). If a percentage is specified, it is the percentage of the total agent pool size at the @@ -762,11 +742,11 @@ def __init__( https://docs.microsoft.com/azure/aks/upgrade-cluster#customize-node-surge-upgrade. :paramtype max_surge: str """ - super(AgentPoolUpgradeSettings, self).__init__(**kwargs) + super().__init__(**kwargs) self.max_surge = max_surge -class AzureKeyVaultKms(msrest.serialization.Model): +class AzureKeyVaultKms(_serialization.Model): """Azure Key Vault key management service settings for the security profile. :ivar enabled: Whether to enable Azure Key Vault key management service. The default is false. @@ -780,7 +760,7 @@ class AzureKeyVaultKms(msrest.serialization.Model): :ivar key_vault_network_access: Network access of key vault. The possible values are ``Public`` and ``Private``. ``Public`` means the key vault allows public access from all networks. ``Private`` means the key vault disables public access and enables private link. The default - value is ``Public``. Known values are: "Public", "Private". Default value: "Public". + value is ``Public``. Known values are: "Public" and "Private". :vartype key_vault_network_access: str or ~azure.mgmt.containerservice.v2022_06_01.models.KeyVaultNetworkAccessTypes :ivar key_vault_resource_id: Resource ID of key vault. When keyVaultNetworkAccess is @@ -790,10 +770,10 @@ class AzureKeyVaultKms(msrest.serialization.Model): """ _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'key_id': {'key': 'keyId', 'type': 'str'}, - 'key_vault_network_access': {'key': 'keyVaultNetworkAccess', 'type': 'str'}, - 'key_vault_resource_id': {'key': 'keyVaultResourceId', 'type': 'str'}, + "enabled": {"key": "enabled", "type": "bool"}, + "key_id": {"key": "keyId", "type": "str"}, + "key_vault_network_access": {"key": "keyVaultNetworkAccess", "type": "str"}, + "key_vault_resource_id": {"key": "keyVaultResourceId", "type": "str"}, } def __init__( @@ -801,7 +781,7 @@ def __init__( *, enabled: Optional[bool] = None, key_id: Optional[str] = None, - key_vault_network_access: Optional[Union[str, "_models.KeyVaultNetworkAccessTypes"]] = "Public", + key_vault_network_access: Union[str, "_models.KeyVaultNetworkAccessTypes"] = "Public", key_vault_resource_id: Optional[str] = None, **kwargs ): @@ -818,7 +798,7 @@ def __init__( :keyword key_vault_network_access: Network access of key vault. The possible values are ``Public`` and ``Private``. ``Public`` means the key vault allows public access from all networks. ``Private`` means the key vault disables public access and enables private link. The - default value is ``Public``. Known values are: "Public", "Private". Default value: "Public". + default value is ``Public``. Known values are: "Public" and "Private". :paramtype key_vault_network_access: str or ~azure.mgmt.containerservice.v2022_06_01.models.KeyVaultNetworkAccessTypes :keyword key_vault_resource_id: Resource ID of key vault. When keyVaultNetworkAccess is @@ -826,14 +806,14 @@ def __init__( keyVaultNetworkAccess is ``Public``\ , leave the field empty. :paramtype key_vault_resource_id: str """ - super(AzureKeyVaultKms, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.key_id = key_id self.key_vault_network_access = key_vault_network_access self.key_vault_resource_id = key_vault_resource_id -class CloudErrorBody(msrest.serialization.Model): +class CloudErrorBody(_serialization.Model): """An error response from the Container service. :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed @@ -850,10 +830,10 @@ class CloudErrorBody(msrest.serialization.Model): """ _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[CloudErrorBody]"}, } def __init__( @@ -878,87 +858,76 @@ def __init__( :keyword details: A list of additional details about the error. :paramtype details: list[~azure.mgmt.containerservice.v2022_06_01.models.CloudErrorBody] """ - super(CloudErrorBody, self).__init__(**kwargs) + super().__init__(**kwargs) self.code = code self.message = message self.target = target self.details = details -class ContainerServiceDiagnosticsProfile(msrest.serialization.Model): +class ContainerServiceDiagnosticsProfile(_serialization.Model): """Profile for diagnostics on the container service cluster. All required parameters must be populated in order to send to Azure. - :ivar vm_diagnostics: Required. Profile for diagnostics on the container service VMs. + :ivar vm_diagnostics: Profile for diagnostics on the container service VMs. Required. :vartype vm_diagnostics: ~azure.mgmt.containerservice.v2022_06_01.models.ContainerServiceVMDiagnostics """ _validation = { - 'vm_diagnostics': {'required': True}, + "vm_diagnostics": {"required": True}, } _attribute_map = { - 'vm_diagnostics': {'key': 'vmDiagnostics', 'type': 'ContainerServiceVMDiagnostics'}, + "vm_diagnostics": {"key": "vmDiagnostics", "type": "ContainerServiceVMDiagnostics"}, } - def __init__( - self, - *, - vm_diagnostics: "_models.ContainerServiceVMDiagnostics", - **kwargs - ): + def __init__(self, *, vm_diagnostics: "_models.ContainerServiceVMDiagnostics", **kwargs): """ - :keyword vm_diagnostics: Required. Profile for diagnostics on the container service VMs. + :keyword vm_diagnostics: Profile for diagnostics on the container service VMs. Required. :paramtype vm_diagnostics: ~azure.mgmt.containerservice.v2022_06_01.models.ContainerServiceVMDiagnostics """ - super(ContainerServiceDiagnosticsProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.vm_diagnostics = vm_diagnostics -class ContainerServiceLinuxProfile(msrest.serialization.Model): +class ContainerServiceLinuxProfile(_serialization.Model): """Profile for Linux VMs in the container service cluster. All required parameters must be populated in order to send to Azure. - :ivar admin_username: Required. The administrator username to use for Linux VMs. + :ivar admin_username: The administrator username to use for Linux VMs. Required. :vartype admin_username: str - :ivar ssh: Required. The SSH configuration for Linux-based VMs running on Azure. + :ivar ssh: The SSH configuration for Linux-based VMs running on Azure. Required. :vartype ssh: ~azure.mgmt.containerservice.v2022_06_01.models.ContainerServiceSshConfiguration """ _validation = { - 'admin_username': {'required': True, 'pattern': r'^[A-Za-z][-A-Za-z0-9_]*$'}, - 'ssh': {'required': True}, + "admin_username": {"required": True, "pattern": r"^[A-Za-z][-A-Za-z0-9_]*$"}, + "ssh": {"required": True}, } _attribute_map = { - 'admin_username': {'key': 'adminUsername', 'type': 'str'}, - 'ssh': {'key': 'ssh', 'type': 'ContainerServiceSshConfiguration'}, + "admin_username": {"key": "adminUsername", "type": "str"}, + "ssh": {"key": "ssh", "type": "ContainerServiceSshConfiguration"}, } - def __init__( - self, - *, - admin_username: str, - ssh: "_models.ContainerServiceSshConfiguration", - **kwargs - ): + def __init__(self, *, admin_username: str, ssh: "_models.ContainerServiceSshConfiguration", **kwargs): """ - :keyword admin_username: Required. The administrator username to use for Linux VMs. + :keyword admin_username: The administrator username to use for Linux VMs. Required. :paramtype admin_username: str - :keyword ssh: Required. The SSH configuration for Linux-based VMs running on Azure. + :keyword ssh: The SSH configuration for Linux-based VMs running on Azure. Required. :paramtype ssh: ~azure.mgmt.containerservice.v2022_06_01.models.ContainerServiceSshConfiguration """ - super(ContainerServiceLinuxProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.admin_username = admin_username self.ssh = ssh -class ContainerServiceMasterProfile(msrest.serialization.Model): +class ContainerServiceMasterProfile(_serialization.Model): """Profile for the container service master. Variables are only populated by the server, and will be ignored when sending a request. @@ -966,11 +935,11 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar count: Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, - and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". + and 5. The default value is 1. Known values are: 1, 3, and 5. :vartype count: int or ~azure.mgmt.containerservice.v2022_06_01.models.Count - :ivar dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. + :ivar dns_prefix: DNS prefix to be used to create the FQDN for the master pool. Required. :vartype dns_prefix: str - :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + :ivar vm_size: Size of agent VMs. Required. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -1007,7 +976,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :vartype vm_size: str or ~azure.mgmt.containerservice.v2022_06_01.models.ContainerServiceVMSizeTypes :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine @@ -1021,7 +990,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): :vartype first_consecutive_static_ip: str :ivar storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount" and "ManagedDisks". :vartype storage_profile: str or ~azure.mgmt.containerservice.v2022_06_01.models.ContainerServiceStorageProfileTypes :ivar fqdn: FQDN for the master pool. @@ -1029,21 +998,21 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): """ _validation = { - 'dns_prefix': {'required': True}, - 'vm_size': {'required': True}, - 'os_disk_size_gb': {'maximum': 2048, 'minimum': 0}, - 'fqdn': {'readonly': True}, + "dns_prefix": {"required": True}, + "vm_size": {"required": True}, + "os_disk_size_gb": {"maximum": 2048, "minimum": 0}, + "fqdn": {"readonly": True}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'dns_prefix': {'key': 'dnsPrefix', 'type': 'str'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'first_consecutive_static_ip': {'key': 'firstConsecutiveStaticIP', 'type': 'str'}, - 'storage_profile': {'key': 'storageProfile', 'type': 'str'}, - 'fqdn': {'key': 'fqdn', 'type': 'str'}, + "count": {"key": "count", "type": "int"}, + "dns_prefix": {"key": "dnsPrefix", "type": "str"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "first_consecutive_static_ip": {"key": "firstConsecutiveStaticIP", "type": "str"}, + "storage_profile": {"key": "storageProfile", "type": "str"}, + "fqdn": {"key": "fqdn", "type": "str"}, } def __init__( @@ -1051,20 +1020,20 @@ def __init__( *, dns_prefix: str, vm_size: Union[str, "_models.ContainerServiceVMSizeTypes"], - count: Optional[Union[int, "_models.Count"]] = 1, + count: Union[int, "_models.Count"] = 1, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, - first_consecutive_static_ip: Optional[str] = "10.240.255.5", + first_consecutive_static_ip: str = "10.240.255.5", storage_profile: Optional[Union[str, "_models.ContainerServiceStorageProfileTypes"]] = None, **kwargs ): """ :keyword count: Number of masters (VMs) in the container service cluster. Allowed values are 1, - 3, and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". + 3, and 5. The default value is 1. Known values are: 1, 3, and 5. :paramtype count: int or ~azure.mgmt.containerservice.v2022_06_01.models.Count - :keyword dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. + :keyword dns_prefix: DNS prefix to be used to create the FQDN for the master pool. Required. :paramtype dns_prefix: str - :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + :keyword vm_size: Size of agent VMs. Required. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -1101,7 +1070,7 @@ def __init__( "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :paramtype vm_size: str or ~azure.mgmt.containerservice.v2022_06_01.models.ContainerServiceVMSizeTypes :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every @@ -1115,11 +1084,11 @@ def __init__( :paramtype first_consecutive_static_ip: str :keyword storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount" and "ManagedDisks". :paramtype storage_profile: str or ~azure.mgmt.containerservice.v2022_06_01.models.ContainerServiceStorageProfileTypes """ - super(ContainerServiceMasterProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.dns_prefix = dns_prefix self.vm_size = vm_size @@ -1130,17 +1099,17 @@ def __init__( self.fqdn = None -class ContainerServiceNetworkProfile(msrest.serialization.Model): +class ContainerServiceNetworkProfile(_serialization.Model): # pylint: disable=too-many-instance-attributes """Profile of network configuration. :ivar network_plugin: Network plugin used for building the Kubernetes network. Known values - are: "azure", "kubenet", "none". Default value: "kubenet". + are: "azure", "kubenet", and "none". :vartype network_plugin: str or ~azure.mgmt.containerservice.v2022_06_01.models.NetworkPlugin :ivar network_policy: Network policy used for building the Kubernetes network. Known values - are: "calico", "azure". + are: "calico" and "azure". :vartype network_policy: str or ~azure.mgmt.containerservice.v2022_06_01.models.NetworkPolicy :ivar network_mode: This cannot be specified if networkPlugin is anything other than 'azure'. - Known values are: "transparent", "bridge". + Known values are: "transparent" and "bridge". :vartype network_mode: str or ~azure.mgmt.containerservice.v2022_06_01.models.NetworkMode :ivar pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :vartype pod_cidr: str @@ -1156,12 +1125,11 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): :ivar outbound_type: This can only be set at cluster creation time and cannot be changed later. For more information see `egress outbound type `_. Known values are: "loadBalancer", - "userDefinedRouting", "managedNATGateway", "userAssignedNATGateway". Default value: - "loadBalancer". + "userDefinedRouting", "managedNATGateway", and "userAssignedNATGateway". :vartype outbound_type: str or ~azure.mgmt.containerservice.v2022_06_01.models.OutboundType :ivar load_balancer_sku: The default is 'standard'. See `Azure Load Balancer SKUs `_ for more information about the - differences between load balancer SKUs. Known values are: "standard", "basic". + differences between load balancer SKUs. Known values are: "standard" and "basic". :vartype load_balancer_sku: str or ~azure.mgmt.containerservice.v2022_06_01.models.LoadBalancerSku :ivar load_balancer_profile: Profile of the cluster load balancer. @@ -1184,40 +1152,42 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): """ _validation = { - 'pod_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, - 'service_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, - 'dns_service_ip': {'pattern': r'^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$'}, - 'docker_bridge_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, + "pod_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, + "service_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, + "dns_service_ip": { + "pattern": r"^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$" + }, + "docker_bridge_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, } _attribute_map = { - 'network_plugin': {'key': 'networkPlugin', 'type': 'str'}, - 'network_policy': {'key': 'networkPolicy', 'type': 'str'}, - 'network_mode': {'key': 'networkMode', 'type': 'str'}, - 'pod_cidr': {'key': 'podCidr', 'type': 'str'}, - 'service_cidr': {'key': 'serviceCidr', 'type': 'str'}, - 'dns_service_ip': {'key': 'dnsServiceIP', 'type': 'str'}, - 'docker_bridge_cidr': {'key': 'dockerBridgeCidr', 'type': 'str'}, - 'outbound_type': {'key': 'outboundType', 'type': 'str'}, - 'load_balancer_sku': {'key': 'loadBalancerSku', 'type': 'str'}, - 'load_balancer_profile': {'key': 'loadBalancerProfile', 'type': 'ManagedClusterLoadBalancerProfile'}, - 'nat_gateway_profile': {'key': 'natGatewayProfile', 'type': 'ManagedClusterNATGatewayProfile'}, - 'pod_cidrs': {'key': 'podCidrs', 'type': '[str]'}, - 'service_cidrs': {'key': 'serviceCidrs', 'type': '[str]'}, - 'ip_families': {'key': 'ipFamilies', 'type': '[str]'}, + "network_plugin": {"key": "networkPlugin", "type": "str"}, + "network_policy": {"key": "networkPolicy", "type": "str"}, + "network_mode": {"key": "networkMode", "type": "str"}, + "pod_cidr": {"key": "podCidr", "type": "str"}, + "service_cidr": {"key": "serviceCidr", "type": "str"}, + "dns_service_ip": {"key": "dnsServiceIP", "type": "str"}, + "docker_bridge_cidr": {"key": "dockerBridgeCidr", "type": "str"}, + "outbound_type": {"key": "outboundType", "type": "str"}, + "load_balancer_sku": {"key": "loadBalancerSku", "type": "str"}, + "load_balancer_profile": {"key": "loadBalancerProfile", "type": "ManagedClusterLoadBalancerProfile"}, + "nat_gateway_profile": {"key": "natGatewayProfile", "type": "ManagedClusterNATGatewayProfile"}, + "pod_cidrs": {"key": "podCidrs", "type": "[str]"}, + "service_cidrs": {"key": "serviceCidrs", "type": "[str]"}, + "ip_families": {"key": "ipFamilies", "type": "[str]"}, } def __init__( self, *, - network_plugin: Optional[Union[str, "_models.NetworkPlugin"]] = "kubenet", + network_plugin: Union[str, "_models.NetworkPlugin"] = "kubenet", network_policy: Optional[Union[str, "_models.NetworkPolicy"]] = None, network_mode: Optional[Union[str, "_models.NetworkMode"]] = None, - pod_cidr: Optional[str] = "10.244.0.0/16", - service_cidr: Optional[str] = "10.0.0.0/16", - dns_service_ip: Optional[str] = "10.0.0.10", - docker_bridge_cidr: Optional[str] = "172.17.0.1/16", - outbound_type: Optional[Union[str, "_models.OutboundType"]] = "loadBalancer", + pod_cidr: str = "10.244.0.0/16", + service_cidr: str = "10.0.0.0/16", + dns_service_ip: str = "10.0.0.10", + docker_bridge_cidr: str = "172.17.0.1/16", + outbound_type: Union[str, "_models.OutboundType"] = "loadBalancer", load_balancer_sku: Optional[Union[str, "_models.LoadBalancerSku"]] = None, load_balancer_profile: Optional["_models.ManagedClusterLoadBalancerProfile"] = None, nat_gateway_profile: Optional["_models.ManagedClusterNATGatewayProfile"] = None, @@ -1228,13 +1198,13 @@ def __init__( ): """ :keyword network_plugin: Network plugin used for building the Kubernetes network. Known values - are: "azure", "kubenet", "none". Default value: "kubenet". + are: "azure", "kubenet", and "none". :paramtype network_plugin: str or ~azure.mgmt.containerservice.v2022_06_01.models.NetworkPlugin :keyword network_policy: Network policy used for building the Kubernetes network. Known values - are: "calico", "azure". + are: "calico" and "azure". :paramtype network_policy: str or ~azure.mgmt.containerservice.v2022_06_01.models.NetworkPolicy :keyword network_mode: This cannot be specified if networkPlugin is anything other than - 'azure'. Known values are: "transparent", "bridge". + 'azure'. Known values are: "transparent" and "bridge". :paramtype network_mode: str or ~azure.mgmt.containerservice.v2022_06_01.models.NetworkMode :keyword pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :paramtype pod_cidr: str @@ -1250,12 +1220,11 @@ def __init__( :keyword outbound_type: This can only be set at cluster creation time and cannot be changed later. For more information see `egress outbound type `_. Known values are: "loadBalancer", - "userDefinedRouting", "managedNATGateway", "userAssignedNATGateway". Default value: - "loadBalancer". + "userDefinedRouting", "managedNATGateway", and "userAssignedNATGateway". :paramtype outbound_type: str or ~azure.mgmt.containerservice.v2022_06_01.models.OutboundType :keyword load_balancer_sku: The default is 'standard'. See `Azure Load Balancer SKUs `_ for more information about the - differences between load balancer SKUs. Known values are: "standard", "basic". + differences between load balancer SKUs. Known values are: "standard" and "basic". :paramtype load_balancer_sku: str or ~azure.mgmt.containerservice.v2022_06_01.models.LoadBalancerSku :keyword load_balancer_profile: Profile of the cluster load balancer. @@ -1276,7 +1245,7 @@ def __init__( IPv6. :paramtype ip_families: list[str or ~azure.mgmt.containerservice.v2022_06_01.models.IpFamily] """ - super(ContainerServiceNetworkProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.network_plugin = network_plugin self.network_policy = network_policy self.network_mode = network_mode @@ -1293,113 +1262,98 @@ def __init__( self.ip_families = ip_families -class ContainerServiceSshConfiguration(msrest.serialization.Model): +class ContainerServiceSshConfiguration(_serialization.Model): """SSH configuration for Linux-based VMs running on Azure. All required parameters must be populated in order to send to Azure. - :ivar public_keys: Required. The list of SSH public keys used to authenticate with Linux-based - VMs. A maximum of 1 key may be specified. + :ivar public_keys: The list of SSH public keys used to authenticate with Linux-based VMs. A + maximum of 1 key may be specified. Required. :vartype public_keys: list[~azure.mgmt.containerservice.v2022_06_01.models.ContainerServiceSshPublicKey] """ _validation = { - 'public_keys': {'required': True}, + "public_keys": {"required": True}, } _attribute_map = { - 'public_keys': {'key': 'publicKeys', 'type': '[ContainerServiceSshPublicKey]'}, + "public_keys": {"key": "publicKeys", "type": "[ContainerServiceSshPublicKey]"}, } - def __init__( - self, - *, - public_keys: List["_models.ContainerServiceSshPublicKey"], - **kwargs - ): + def __init__(self, *, public_keys: List["_models.ContainerServiceSshPublicKey"], **kwargs): """ - :keyword public_keys: Required. The list of SSH public keys used to authenticate with - Linux-based VMs. A maximum of 1 key may be specified. + :keyword public_keys: The list of SSH public keys used to authenticate with Linux-based VMs. A + maximum of 1 key may be specified. Required. :paramtype public_keys: list[~azure.mgmt.containerservice.v2022_06_01.models.ContainerServiceSshPublicKey] """ - super(ContainerServiceSshConfiguration, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_keys = public_keys -class ContainerServiceSshPublicKey(msrest.serialization.Model): +class ContainerServiceSshPublicKey(_serialization.Model): """Contains information about SSH certificate public key data. All required parameters must be populated in order to send to Azure. - :ivar key_data: Required. Certificate public key used to authenticate with VMs through SSH. The - certificate must be in PEM format with or without headers. + :ivar key_data: Certificate public key used to authenticate with VMs through SSH. The + certificate must be in PEM format with or without headers. Required. :vartype key_data: str """ _validation = { - 'key_data': {'required': True}, + "key_data": {"required": True}, } _attribute_map = { - 'key_data': {'key': 'keyData', 'type': 'str'}, + "key_data": {"key": "keyData", "type": "str"}, } - def __init__( - self, - *, - key_data: str, - **kwargs - ): + def __init__(self, *, key_data: str, **kwargs): """ - :keyword key_data: Required. Certificate public key used to authenticate with VMs through SSH. - The certificate must be in PEM format with or without headers. + :keyword key_data: Certificate public key used to authenticate with VMs through SSH. The + certificate must be in PEM format with or without headers. Required. :paramtype key_data: str """ - super(ContainerServiceSshPublicKey, self).__init__(**kwargs) + super().__init__(**kwargs) self.key_data = key_data -class ContainerServiceVMDiagnostics(msrest.serialization.Model): +class ContainerServiceVMDiagnostics(_serialization.Model): """Profile for diagnostics on the container service VMs. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar enabled: Required. Whether the VM diagnostic agent is provisioned on the VM. + :ivar enabled: Whether the VM diagnostic agent is provisioned on the VM. Required. :vartype enabled: bool :ivar storage_uri: The URI of the storage account where diagnostics are stored. :vartype storage_uri: str """ _validation = { - 'enabled': {'required': True}, - 'storage_uri': {'readonly': True}, + "enabled": {"required": True}, + "storage_uri": {"readonly": True}, } _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'storage_uri': {'key': 'storageUri', 'type': 'str'}, + "enabled": {"key": "enabled", "type": "bool"}, + "storage_uri": {"key": "storageUri", "type": "str"}, } - def __init__( - self, - *, - enabled: bool, - **kwargs - ): + def __init__(self, *, enabled: bool, **kwargs): """ - :keyword enabled: Required. Whether the VM diagnostic agent is provisioned on the VM. + :keyword enabled: Whether the VM diagnostic agent is provisioned on the VM. Required. :paramtype enabled: bool """ - super(ContainerServiceVMDiagnostics, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.storage_uri = None -class CreationData(msrest.serialization.Model): +class CreationData(_serialization.Model): """Data used when creating a target resource from a source resource. :ivar source_resource_id: This is the ARM ID of the source object to be used to create the @@ -1408,25 +1362,20 @@ class CreationData(msrest.serialization.Model): """ _attribute_map = { - 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, + "source_resource_id": {"key": "sourceResourceId", "type": "str"}, } - def __init__( - self, - *, - source_resource_id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, source_resource_id: Optional[str] = None, **kwargs): """ :keyword source_resource_id: This is the ARM ID of the source object to be used to create the target object. :paramtype source_resource_id: str """ - super(CreationData, self).__init__(**kwargs) + super().__init__(**kwargs) self.source_resource_id = source_resource_id -class CredentialResult(msrest.serialization.Model): +class CredentialResult(_serialization.Model): """The credential result response. Variables are only populated by the server, and will be ignored when sending a request. @@ -1434,31 +1383,27 @@ class CredentialResult(msrest.serialization.Model): :ivar name: The name of the credential. :vartype name: str :ivar value: Base64-encoded Kubernetes configuration file. - :vartype value: bytearray + :vartype value: bytes """ _validation = { - 'name': {'readonly': True}, - 'value': {'readonly': True}, + "name": {"readonly": True}, + "value": {"readonly": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'bytearray'}, + "name": {"key": "name", "type": "str"}, + "value": {"key": "value", "type": "bytearray"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(CredentialResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.name = None self.value = None -class CredentialResults(msrest.serialization.Model): +class CredentialResults(_serialization.Model): """The list credential result response. Variables are only populated by the server, and will be ignored when sending a request. @@ -1468,24 +1413,20 @@ class CredentialResults(msrest.serialization.Model): """ _validation = { - 'kubeconfigs': {'readonly': True}, + "kubeconfigs": {"readonly": True}, } _attribute_map = { - 'kubeconfigs': {'key': 'kubeconfigs', 'type': '[CredentialResult]'}, + "kubeconfigs": {"key": "kubeconfigs", "type": "[CredentialResult]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(CredentialResults, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.kubeconfigs = None -class EndpointDependency(msrest.serialization.Model): +class EndpointDependency(_serialization.Model): """A domain name that AKS agent nodes are reaching at. :ivar domain_name: The domain name of the dependency. @@ -1495,8 +1436,8 @@ class EndpointDependency(msrest.serialization.Model): """ _attribute_map = { - 'domain_name': {'key': 'domainName', 'type': 'str'}, - 'endpoint_details': {'key': 'endpointDetails', 'type': '[EndpointDetail]'}, + "domain_name": {"key": "domainName", "type": "str"}, + "endpoint_details": {"key": "endpointDetails", "type": "[EndpointDetail]"}, } def __init__( @@ -1513,12 +1454,12 @@ def __init__( :paramtype endpoint_details: list[~azure.mgmt.containerservice.v2022_06_01.models.EndpointDetail] """ - super(EndpointDependency, self).__init__(**kwargs) + super().__init__(**kwargs) self.domain_name = domain_name self.endpoint_details = endpoint_details -class EndpointDetail(msrest.serialization.Model): +class EndpointDetail(_serialization.Model): """connect information from the AKS agent nodes to a single endpoint. :ivar ip_address: An IP Address that Domain Name currently resolves to. @@ -1532,10 +1473,10 @@ class EndpointDetail(msrest.serialization.Model): """ _attribute_map = { - 'ip_address': {'key': 'ipAddress', 'type': 'str'}, - 'port': {'key': 'port', 'type': 'int'}, - 'protocol': {'key': 'protocol', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, + "ip_address": {"key": "ipAddress", "type": "str"}, + "port": {"key": "port", "type": "int"}, + "protocol": {"key": "protocol", "type": "str"}, + "description": {"key": "description", "type": "str"}, } def __init__( @@ -1557,25 +1498,25 @@ def __init__( :keyword description: Description of the detail. :paramtype description: str """ - super(EndpointDetail, self).__init__(**kwargs) + super().__init__(**kwargs) self.ip_address = ip_address self.port = port self.protocol = protocol self.description = description -class ExtendedLocation(msrest.serialization.Model): +class ExtendedLocation(_serialization.Model): """The complex type of the extended location. :ivar name: The name of the extended location. :vartype name: str - :ivar type: The type of the extended location. Known values are: "EdgeZone". + :ivar type: The type of the extended location. "EdgeZone" :vartype type: str or ~azure.mgmt.containerservice.v2022_06_01.models.ExtendedLocationTypes """ _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, } def __init__( @@ -1588,15 +1529,15 @@ def __init__( """ :keyword name: The name of the extended location. :paramtype name: str - :keyword type: The type of the extended location. Known values are: "EdgeZone". + :keyword type: The type of the extended location. "EdgeZone" :paramtype type: str or ~azure.mgmt.containerservice.v2022_06_01.models.ExtendedLocationTypes """ - super(ExtendedLocation, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.type = type -class KubeletConfig(msrest.serialization.Model): +class KubeletConfig(_serialization.Model): # pylint: disable=too-many-instance-attributes """See `AKS custom node configuration `_ for more details. :ivar cpu_manager_policy: The default is 'none'. See `Kubernetes CPU management policies @@ -1636,21 +1577,21 @@ class KubeletConfig(msrest.serialization.Model): """ _validation = { - 'container_log_max_files': {'minimum': 2}, + "container_log_max_files": {"minimum": 2}, } _attribute_map = { - 'cpu_manager_policy': {'key': 'cpuManagerPolicy', 'type': 'str'}, - 'cpu_cfs_quota': {'key': 'cpuCfsQuota', 'type': 'bool'}, - 'cpu_cfs_quota_period': {'key': 'cpuCfsQuotaPeriod', 'type': 'str'}, - 'image_gc_high_threshold': {'key': 'imageGcHighThreshold', 'type': 'int'}, - 'image_gc_low_threshold': {'key': 'imageGcLowThreshold', 'type': 'int'}, - 'topology_manager_policy': {'key': 'topologyManagerPolicy', 'type': 'str'}, - 'allowed_unsafe_sysctls': {'key': 'allowedUnsafeSysctls', 'type': '[str]'}, - 'fail_swap_on': {'key': 'failSwapOn', 'type': 'bool'}, - 'container_log_max_size_mb': {'key': 'containerLogMaxSizeMB', 'type': 'int'}, - 'container_log_max_files': {'key': 'containerLogMaxFiles', 'type': 'int'}, - 'pod_max_pids': {'key': 'podMaxPids', 'type': 'int'}, + "cpu_manager_policy": {"key": "cpuManagerPolicy", "type": "str"}, + "cpu_cfs_quota": {"key": "cpuCfsQuota", "type": "bool"}, + "cpu_cfs_quota_period": {"key": "cpuCfsQuotaPeriod", "type": "str"}, + "image_gc_high_threshold": {"key": "imageGcHighThreshold", "type": "int"}, + "image_gc_low_threshold": {"key": "imageGcLowThreshold", "type": "int"}, + "topology_manager_policy": {"key": "topologyManagerPolicy", "type": "str"}, + "allowed_unsafe_sysctls": {"key": "allowedUnsafeSysctls", "type": "[str]"}, + "fail_swap_on": {"key": "failSwapOn", "type": "bool"}, + "container_log_max_size_mb": {"key": "containerLogMaxSizeMB", "type": "int"}, + "container_log_max_files": {"key": "containerLogMaxFiles", "type": "int"}, + "pod_max_pids": {"key": "podMaxPids", "type": "int"}, } def __init__( @@ -1705,7 +1646,7 @@ def __init__( :keyword pod_max_pids: The maximum number of processes per pod. :paramtype pod_max_pids: int """ - super(KubeletConfig, self).__init__(**kwargs) + super().__init__(**kwargs) self.cpu_manager_policy = cpu_manager_policy self.cpu_cfs_quota = cpu_cfs_quota self.cpu_cfs_quota_period = cpu_cfs_quota_period @@ -1719,7 +1660,7 @@ def __init__( self.pod_max_pids = pod_max_pids -class LinuxOSConfig(msrest.serialization.Model): +class LinuxOSConfig(_serialization.Model): """See `AKS custom node configuration `_ for more details. :ivar sysctls: Sysctl settings for Linux agent nodes. @@ -1738,10 +1679,10 @@ class LinuxOSConfig(msrest.serialization.Model): """ _attribute_map = { - 'sysctls': {'key': 'sysctls', 'type': 'SysctlConfig'}, - 'transparent_huge_page_enabled': {'key': 'transparentHugePageEnabled', 'type': 'str'}, - 'transparent_huge_page_defrag': {'key': 'transparentHugePageDefrag', 'type': 'str'}, - 'swap_file_size_mb': {'key': 'swapFileSizeMB', 'type': 'int'}, + "sysctls": {"key": "sysctls", "type": "SysctlConfig"}, + "transparent_huge_page_enabled": {"key": "transparentHugePageEnabled", "type": "str"}, + "transparent_huge_page_defrag": {"key": "transparentHugePageDefrag", "type": "str"}, + "swap_file_size_mb": {"key": "swapFileSizeMB", "type": "int"}, } def __init__( @@ -1768,7 +1709,7 @@ def __init__( :keyword swap_file_size_mb: The size in MB of a swap file that will be created on each node. :paramtype swap_file_size_mb: int """ - super(LinuxOSConfig, self).__init__(**kwargs) + super().__init__(**kwargs) self.sysctls = sysctls self.transparent_huge_page_enabled = transparent_huge_page_enabled self.transparent_huge_page_defrag = transparent_huge_page_defrag @@ -1797,19 +1738,19 @@ class MaintenanceConfiguration(SubResource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, + "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'}, - 'time_in_week': {'key': 'properties.timeInWeek', 'type': '[TimeInWeek]'}, - 'not_allowed_time': {'key': 'properties.notAllowedTime', 'type': '[TimeSpan]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "time_in_week": {"key": "properties.timeInWeek", "type": "[TimeInWeek]"}, + "not_allowed_time": {"key": "properties.notAllowedTime", "type": "[TimeSpan]"}, } def __init__( @@ -1826,13 +1767,13 @@ def __init__( :keyword not_allowed_time: Time slots on which upgrade is not allowed. :paramtype not_allowed_time: list[~azure.mgmt.containerservice.v2022_06_01.models.TimeSpan] """ - super(MaintenanceConfiguration, self).__init__(**kwargs) + super().__init__(**kwargs) self.system_data = None self.time_in_week = time_in_week self.not_allowed_time = not_allowed_time -class MaintenanceConfigurationListResult(msrest.serialization.Model): +class MaintenanceConfigurationListResult(_serialization.Model): """The response from the List maintenance configurations operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -1844,31 +1785,26 @@ class MaintenanceConfigurationListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[MaintenanceConfiguration]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[MaintenanceConfiguration]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.MaintenanceConfiguration"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.MaintenanceConfiguration"]] = None, **kwargs): """ :keyword value: The list of maintenance configurations. :paramtype value: list[~azure.mgmt.containerservice.v2022_06_01.models.MaintenanceConfiguration] """ - super(MaintenanceConfigurationListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class Resource(msrest.serialization.Model): +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. @@ -1887,26 +1823,22 @@ class Resource(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, + "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'}, + "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 - ): - """ - """ - super(Resource, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -1931,48 +1863,42 @@ class TrackedResource(Resource): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.containerservice.v2022_06_01.models.SystemData - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] - :ivar location: Required. The geo-location where the resource lives. + :ivar location: The geo-location where the resource lives. Required. :vartype location: str """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'location': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, } - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] - :keyword location: Required. The geo-location where the resource lives. + :keyword location: The geo-location where the resource lives. Required. :paramtype location: str """ - super(TrackedResource, self).__init__(**kwargs) + super().__init__(**kwargs) self.tags = tags self.location = location -class ManagedCluster(TrackedResource): +class ManagedCluster(TrackedResource): # pylint: disable=too-many-instance-attributes """Managed cluster. Variables are only populated by the server, and will be ignored when sending a request. @@ -1990,9 +1916,9 @@ class ManagedCluster(TrackedResource): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.containerservice.v2022_06_01.models.SystemData - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] - :ivar location: Required. The geo-location where the resource lives. + :ivar location: The geo-location where the resource lives. Required. :vartype location: str :ivar sku: The managed cluster SKU. :vartype sku: ~azure.mgmt.containerservice.v2022_06_01.models.ManagedClusterSKU @@ -2099,71 +2025,80 @@ class ManagedCluster(TrackedResource): :vartype storage_profile: ~azure.mgmt.containerservice.v2022_06_01.models.ManagedClusterStorageProfile :ivar public_network_access: Allow or deny public network access for AKS. Known values are: - "Enabled", "Disabled". + "Enabled" and "Disabled". :vartype public_network_access: str or ~azure.mgmt.containerservice.v2022_06_01.models.PublicNetworkAccess """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'location': {'required': True}, - 'provisioning_state': {'readonly': True}, - 'power_state': {'readonly': True}, - 'max_agent_pools': {'readonly': True}, - 'current_kubernetes_version': {'readonly': True}, - 'fqdn': {'readonly': True}, - 'private_fqdn': {'readonly': True}, - 'azure_portal_fqdn': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, + "provisioning_state": {"readonly": True}, + "power_state": {"readonly": True}, + "max_agent_pools": {"readonly": True}, + "current_kubernetes_version": {"readonly": True}, + "fqdn": {"readonly": True}, + "private_fqdn": {"readonly": True}, + "azure_portal_fqdn": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'ManagedClusterSKU'}, - 'extended_location': {'key': 'extendedLocation', 'type': 'ExtendedLocation'}, - 'identity': {'key': 'identity', 'type': 'ManagedClusterIdentity'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'power_state': {'key': 'properties.powerState', 'type': 'PowerState'}, - 'max_agent_pools': {'key': 'properties.maxAgentPools', 'type': 'int'}, - 'kubernetes_version': {'key': 'properties.kubernetesVersion', 'type': 'str'}, - 'current_kubernetes_version': {'key': 'properties.currentKubernetesVersion', 'type': 'str'}, - 'dns_prefix': {'key': 'properties.dnsPrefix', 'type': 'str'}, - 'fqdn_subdomain': {'key': 'properties.fqdnSubdomain', 'type': 'str'}, - 'fqdn': {'key': 'properties.fqdn', 'type': 'str'}, - 'private_fqdn': {'key': 'properties.privateFQDN', 'type': 'str'}, - 'azure_portal_fqdn': {'key': 'properties.azurePortalFQDN', 'type': 'str'}, - 'agent_pool_profiles': {'key': 'properties.agentPoolProfiles', 'type': '[ManagedClusterAgentPoolProfile]'}, - 'linux_profile': {'key': 'properties.linuxProfile', 'type': 'ContainerServiceLinuxProfile'}, - 'windows_profile': {'key': 'properties.windowsProfile', 'type': 'ManagedClusterWindowsProfile'}, - 'service_principal_profile': {'key': 'properties.servicePrincipalProfile', 'type': 'ManagedClusterServicePrincipalProfile'}, - 'addon_profiles': {'key': 'properties.addonProfiles', 'type': '{ManagedClusterAddonProfile}'}, - 'pod_identity_profile': {'key': 'properties.podIdentityProfile', 'type': 'ManagedClusterPodIdentityProfile'}, - 'node_resource_group': {'key': 'properties.nodeResourceGroup', 'type': 'str'}, - 'enable_rbac': {'key': 'properties.enableRBAC', 'type': 'bool'}, - 'enable_pod_security_policy': {'key': 'properties.enablePodSecurityPolicy', 'type': 'bool'}, - 'network_profile': {'key': 'properties.networkProfile', 'type': 'ContainerServiceNetworkProfile'}, - 'aad_profile': {'key': 'properties.aadProfile', 'type': 'ManagedClusterAADProfile'}, - 'auto_upgrade_profile': {'key': 'properties.autoUpgradeProfile', 'type': 'ManagedClusterAutoUpgradeProfile'}, - 'auto_scaler_profile': {'key': 'properties.autoScalerProfile', 'type': 'ManagedClusterPropertiesAutoScalerProfile'}, - 'api_server_access_profile': {'key': 'properties.apiServerAccessProfile', 'type': 'ManagedClusterAPIServerAccessProfile'}, - 'disk_encryption_set_id': {'key': 'properties.diskEncryptionSetID', 'type': 'str'}, - 'identity_profile': {'key': 'properties.identityProfile', 'type': '{UserAssignedIdentity}'}, - 'private_link_resources': {'key': 'properties.privateLinkResources', 'type': '[PrivateLinkResource]'}, - 'disable_local_accounts': {'key': 'properties.disableLocalAccounts', 'type': 'bool'}, - 'http_proxy_config': {'key': 'properties.httpProxyConfig', 'type': 'ManagedClusterHTTPProxyConfig'}, - 'security_profile': {'key': 'properties.securityProfile', 'type': 'ManagedClusterSecurityProfile'}, - 'storage_profile': {'key': 'properties.storageProfile', 'type': 'ManagedClusterStorageProfile'}, - 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, - } - - def __init__( + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "sku": {"key": "sku", "type": "ManagedClusterSKU"}, + "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, + "identity": {"key": "identity", "type": "ManagedClusterIdentity"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "power_state": {"key": "properties.powerState", "type": "PowerState"}, + "max_agent_pools": {"key": "properties.maxAgentPools", "type": "int"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "current_kubernetes_version": {"key": "properties.currentKubernetesVersion", "type": "str"}, + "dns_prefix": {"key": "properties.dnsPrefix", "type": "str"}, + "fqdn_subdomain": {"key": "properties.fqdnSubdomain", "type": "str"}, + "fqdn": {"key": "properties.fqdn", "type": "str"}, + "private_fqdn": {"key": "properties.privateFQDN", "type": "str"}, + "azure_portal_fqdn": {"key": "properties.azurePortalFQDN", "type": "str"}, + "agent_pool_profiles": {"key": "properties.agentPoolProfiles", "type": "[ManagedClusterAgentPoolProfile]"}, + "linux_profile": {"key": "properties.linuxProfile", "type": "ContainerServiceLinuxProfile"}, + "windows_profile": {"key": "properties.windowsProfile", "type": "ManagedClusterWindowsProfile"}, + "service_principal_profile": { + "key": "properties.servicePrincipalProfile", + "type": "ManagedClusterServicePrincipalProfile", + }, + "addon_profiles": {"key": "properties.addonProfiles", "type": "{ManagedClusterAddonProfile}"}, + "pod_identity_profile": {"key": "properties.podIdentityProfile", "type": "ManagedClusterPodIdentityProfile"}, + "node_resource_group": {"key": "properties.nodeResourceGroup", "type": "str"}, + "enable_rbac": {"key": "properties.enableRBAC", "type": "bool"}, + "enable_pod_security_policy": {"key": "properties.enablePodSecurityPolicy", "type": "bool"}, + "network_profile": {"key": "properties.networkProfile", "type": "ContainerServiceNetworkProfile"}, + "aad_profile": {"key": "properties.aadProfile", "type": "ManagedClusterAADProfile"}, + "auto_upgrade_profile": {"key": "properties.autoUpgradeProfile", "type": "ManagedClusterAutoUpgradeProfile"}, + "auto_scaler_profile": { + "key": "properties.autoScalerProfile", + "type": "ManagedClusterPropertiesAutoScalerProfile", + }, + "api_server_access_profile": { + "key": "properties.apiServerAccessProfile", + "type": "ManagedClusterAPIServerAccessProfile", + }, + "disk_encryption_set_id": {"key": "properties.diskEncryptionSetID", "type": "str"}, + "identity_profile": {"key": "properties.identityProfile", "type": "{UserAssignedIdentity}"}, + "private_link_resources": {"key": "properties.privateLinkResources", "type": "[PrivateLinkResource]"}, + "disable_local_accounts": {"key": "properties.disableLocalAccounts", "type": "bool"}, + "http_proxy_config": {"key": "properties.httpProxyConfig", "type": "ManagedClusterHTTPProxyConfig"}, + "security_profile": {"key": "properties.securityProfile", "type": "ManagedClusterSecurityProfile"}, + "storage_profile": {"key": "properties.storageProfile", "type": "ManagedClusterStorageProfile"}, + "public_network_access": {"key": "properties.publicNetworkAccess", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, location: str, @@ -2199,9 +2134,9 @@ def __init__( **kwargs ): """ - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] - :keyword location: Required. The geo-location where the resource lives. + :keyword location: The geo-location where the resource lives. Required. :paramtype location: str :keyword sku: The managed cluster SKU. :paramtype sku: ~azure.mgmt.containerservice.v2022_06_01.models.ManagedClusterSKU @@ -2292,11 +2227,11 @@ def __init__( :paramtype storage_profile: ~azure.mgmt.containerservice.v2022_06_01.models.ManagedClusterStorageProfile :keyword public_network_access: Allow or deny public network access for AKS. Known values are: - "Enabled", "Disabled". + "Enabled" and "Disabled". :paramtype public_network_access: str or ~azure.mgmt.containerservice.v2022_06_01.models.PublicNetworkAccess """ - super(ManagedCluster, self).__init__(tags=tags, location=location, **kwargs) + super().__init__(tags=tags, location=location, **kwargs) self.sku = sku self.extended_location = extended_location self.identity = identity @@ -2334,7 +2269,7 @@ def __init__( self.public_network_access = public_network_access -class ManagedClusterAADProfile(msrest.serialization.Model): +class ManagedClusterAADProfile(_serialization.Model): """For more details see `managed AAD on AKS `_. :ivar managed: Whether to enable managed AAD. @@ -2356,13 +2291,13 @@ class ManagedClusterAADProfile(msrest.serialization.Model): """ _attribute_map = { - 'managed': {'key': 'managed', 'type': 'bool'}, - 'enable_azure_rbac': {'key': 'enableAzureRBAC', 'type': 'bool'}, - 'admin_group_object_i_ds': {'key': 'adminGroupObjectIDs', 'type': '[str]'}, - 'client_app_id': {'key': 'clientAppID', 'type': 'str'}, - 'server_app_id': {'key': 'serverAppID', 'type': 'str'}, - 'server_app_secret': {'key': 'serverAppSecret', 'type': 'str'}, - 'tenant_id': {'key': 'tenantID', 'type': 'str'}, + "managed": {"key": "managed", "type": "bool"}, + "enable_azure_rbac": {"key": "enableAzureRBAC", "type": "bool"}, + "admin_group_object_i_ds": {"key": "adminGroupObjectIDs", "type": "[str]"}, + "client_app_id": {"key": "clientAppID", "type": "str"}, + "server_app_id": {"key": "serverAppID", "type": "str"}, + "server_app_secret": {"key": "serverAppSecret", "type": "str"}, + "tenant_id": {"key": "tenantID", "type": "str"}, } def __init__( @@ -2395,7 +2330,7 @@ def __init__( tenant of the deployment subscription. :paramtype tenant_id: str """ - super(ManagedClusterAADProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.managed = managed self.enable_azure_rbac = enable_azure_rbac self.admin_group_object_i_ds = admin_group_object_i_ds @@ -2423,60 +2358,55 @@ class ManagedClusterAccessProfile(TrackedResource): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.containerservice.v2022_06_01.models.SystemData - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] - :ivar location: Required. The geo-location where the resource lives. + :ivar location: The geo-location where the resource lives. Required. :vartype location: str :ivar kube_config: Base64-encoded Kubernetes configuration file. - :vartype kube_config: bytearray + :vartype kube_config: bytes """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'location': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - 'kube_config': {'key': 'properties.kubeConfig', 'type': 'bytearray'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "kube_config": {"key": "properties.kubeConfig", "type": "bytearray"}, } def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - kube_config: Optional[bytearray] = None, - **kwargs + self, *, location: str, tags: Optional[Dict[str, str]] = None, kube_config: Optional[bytes] = None, **kwargs ): """ - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] - :keyword location: Required. The geo-location where the resource lives. + :keyword location: The geo-location where the resource lives. Required. :paramtype location: str :keyword kube_config: Base64-encoded Kubernetes configuration file. - :paramtype kube_config: bytearray + :paramtype kube_config: bytes """ - super(ManagedClusterAccessProfile, self).__init__(tags=tags, location=location, **kwargs) + super().__init__(tags=tags, location=location, **kwargs) self.kube_config = kube_config -class ManagedClusterAddonProfile(msrest.serialization.Model): +class ManagedClusterAddonProfile(_serialization.Model): """A Kubernetes add-on profile for a managed cluster. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar enabled: Required. Whether the add-on is enabled or not. + :ivar enabled: Whether the add-on is enabled or not. Required. :vartype enabled: bool :ivar config: Key-value pairs for configuring an add-on. :vartype config: dict[str, str] @@ -2486,36 +2416,30 @@ class ManagedClusterAddonProfile(msrest.serialization.Model): """ _validation = { - 'enabled': {'required': True}, - 'identity': {'readonly': True}, + "enabled": {"required": True}, + "identity": {"readonly": True}, } _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'config': {'key': 'config', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'ManagedClusterAddonProfileIdentity'}, + "enabled": {"key": "enabled", "type": "bool"}, + "config": {"key": "config", "type": "{str}"}, + "identity": {"key": "identity", "type": "ManagedClusterAddonProfileIdentity"}, } - def __init__( - self, - *, - enabled: bool, - config: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, enabled: bool, config: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword enabled: Required. Whether the add-on is enabled or not. + :keyword enabled: Whether the add-on is enabled or not. Required. :paramtype enabled: bool :keyword config: Key-value pairs for configuring an add-on. :paramtype config: dict[str, str] """ - super(ManagedClusterAddonProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.config = config self.identity = None -class UserAssignedIdentity(msrest.serialization.Model): +class UserAssignedIdentity(_serialization.Model): """Details about a user assigned identity. :ivar resource_id: The resource ID of the user assigned identity. @@ -2527,9 +2451,9 @@ class UserAssignedIdentity(msrest.serialization.Model): """ _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'object_id': {'key': 'objectId', 'type': 'str'}, + "resource_id": {"key": "resourceId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + "object_id": {"key": "objectId", "type": "str"}, } def __init__( @@ -2548,7 +2472,7 @@ def __init__( :keyword object_id: The object ID of the user assigned identity. :paramtype object_id: str """ - super(UserAssignedIdentity, self).__init__(**kwargs) + super().__init__(**kwargs) self.resource_id = resource_id self.client_id = client_id self.object_id = object_id @@ -2566,9 +2490,9 @@ class ManagedClusterAddonProfileIdentity(UserAssignedIdentity): """ _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'object_id': {'key': 'objectId', 'type': 'str'}, + "resource_id": {"key": "resourceId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + "object_id": {"key": "objectId", "type": "str"}, } def __init__( @@ -2587,10 +2511,10 @@ def __init__( :keyword object_id: The object ID of the user assigned identity. :paramtype object_id: str """ - super(ManagedClusterAddonProfileIdentity, self).__init__(resource_id=resource_id, client_id=client_id, object_id=object_id, **kwargs) + super().__init__(resource_id=resource_id, client_id=client_id, object_id=object_id, **kwargs) -class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): +class ManagedClusterAgentPoolProfileProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes """Properties for the container service agent pool profile. Variables are only populated by the server, and will be ignored when sending a request. @@ -2611,14 +2535,14 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2022_06_01.models.OSDiskType :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data - root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_06_01.models.KubeletDiskType :ivar workload_runtime: Determines the type of workload a node can run. Known values are: - "OCIContainer", "WasmWasi". + "OCIContainer" and "WasmWasi". :vartype workload_runtime: str or ~azure.mgmt.containerservice.v2022_06_01.models.WorkloadRuntime :ivar vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and used. @@ -2632,11 +2556,11 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :vartype pod_subnet_id: str :ivar max_pods: The maximum number of pods that can run on a node. :vartype max_pods: int - :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_06_01.models.OSType :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known - values are: "Ubuntu", "CBLMariner". + values are: "Ubuntu" and "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2022_06_01.models.OSSKU :ivar max_count: The maximum number of nodes for auto-scaling. :vartype max_count: int @@ -2645,14 +2569,14 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it - defaults to Delete. Known values are: "Delete", "Deallocate". + defaults to Delete. Known values are: "Delete" and "Deallocate". :vartype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_06_01.models.ScaleDownMode - :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", + :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets" and "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2022_06_01.models.AgentPoolType :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :vartype mode: str or ~azure.mgmt.containerservice.v2022_06_01.models.AgentPoolMode :ivar orchestrator_version: Both patch version (e.g. 1.20.13) and (e.g. 1.20) are supported. When is specified, the latest supported @@ -2695,20 +2619,18 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default - is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + is 'Regular'. Known values are: "Spot" and "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_06_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_06_01.models.ScaleSetEvictionPolicy :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :vartype spot_max_price: float - :ivar tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :ivar tags: The tags to be persisted on the agent pool virtual machine scale set. :vartype tags: dict[str, str] :ivar node_labels: The node labels to be persisted across all nodes in agent pool. :vartype node_labels: dict[str, str] @@ -2732,7 +2654,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): for more details. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_06_01.models.GPUInstanceProfile :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the node pool @@ -2746,57 +2668,57 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): """ _validation = { - 'os_disk_size_gb': {'maximum': 2048, 'minimum': 0}, - 'current_orchestrator_version': {'readonly': True}, - 'node_image_version': {'readonly': True}, - 'provisioning_state': {'readonly': True}, + "os_disk_size_gb": {"maximum": 2048, "minimum": 0}, + "current_orchestrator_version": {"readonly": True}, + "node_image_version": {"readonly": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'os_disk_type': {'key': 'osDiskType', 'type': 'str'}, - 'kubelet_disk_type': {'key': 'kubeletDiskType', 'type': 'str'}, - 'workload_runtime': {'key': 'workloadRuntime', 'type': 'str'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'pod_subnet_id': {'key': 'podSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'maxPods', 'type': 'int'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'os_sku': {'key': 'osSKU', 'type': 'str'}, - 'max_count': {'key': 'maxCount', 'type': 'int'}, - 'min_count': {'key': 'minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'enableAutoScaling', 'type': 'bool'}, - 'scale_down_mode': {'key': 'scaleDownMode', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'mode': {'key': 'mode', 'type': 'str'}, - 'orchestrator_version': {'key': 'orchestratorVersion', 'type': 'str'}, - 'current_orchestrator_version': {'key': 'currentOrchestratorVersion', 'type': 'str'}, - 'node_image_version': {'key': 'nodeImageVersion', 'type': 'str'}, - 'upgrade_settings': {'key': 'upgradeSettings', 'type': 'AgentPoolUpgradeSettings'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'power_state': {'key': 'powerState', 'type': 'PowerState'}, - 'availability_zones': {'key': 'availabilityZones', 'type': '[str]'}, - 'enable_node_public_ip': {'key': 'enableNodePublicIP', 'type': 'bool'}, - 'node_public_ip_prefix_id': {'key': 'nodePublicIPPrefixID', 'type': 'str'}, - 'scale_set_priority': {'key': 'scaleSetPriority', 'type': 'str'}, - 'scale_set_eviction_policy': {'key': 'scaleSetEvictionPolicy', 'type': 'str'}, - 'spot_max_price': {'key': 'spotMaxPrice', 'type': 'float'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'node_labels': {'key': 'nodeLabels', 'type': '{str}'}, - 'node_taints': {'key': 'nodeTaints', 'type': '[str]'}, - 'proximity_placement_group_id': {'key': 'proximityPlacementGroupID', 'type': 'str'}, - 'kubelet_config': {'key': 'kubeletConfig', 'type': 'KubeletConfig'}, - 'linux_os_config': {'key': 'linuxOSConfig', 'type': 'LinuxOSConfig'}, - 'enable_encryption_at_host': {'key': 'enableEncryptionAtHost', 'type': 'bool'}, - 'enable_ultra_ssd': {'key': 'enableUltraSSD', 'type': 'bool'}, - 'enable_fips': {'key': 'enableFIPS', 'type': 'bool'}, - 'gpu_instance_profile': {'key': 'gpuInstanceProfile', 'type': 'str'}, - 'creation_data': {'key': 'creationData', 'type': 'CreationData'}, - 'host_group_id': {'key': 'hostGroupID', 'type': 'str'}, - } - - def __init__( + "count": {"key": "count", "type": "int"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "os_disk_type": {"key": "osDiskType", "type": "str"}, + "kubelet_disk_type": {"key": "kubeletDiskType", "type": "str"}, + "workload_runtime": {"key": "workloadRuntime", "type": "str"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "pod_subnet_id": {"key": "podSubnetID", "type": "str"}, + "max_pods": {"key": "maxPods", "type": "int"}, + "os_type": {"key": "osType", "type": "str"}, + "os_sku": {"key": "osSKU", "type": "str"}, + "max_count": {"key": "maxCount", "type": "int"}, + "min_count": {"key": "minCount", "type": "int"}, + "enable_auto_scaling": {"key": "enableAutoScaling", "type": "bool"}, + "scale_down_mode": {"key": "scaleDownMode", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "mode": {"key": "mode", "type": "str"}, + "orchestrator_version": {"key": "orchestratorVersion", "type": "str"}, + "current_orchestrator_version": {"key": "currentOrchestratorVersion", "type": "str"}, + "node_image_version": {"key": "nodeImageVersion", "type": "str"}, + "upgrade_settings": {"key": "upgradeSettings", "type": "AgentPoolUpgradeSettings"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "power_state": {"key": "powerState", "type": "PowerState"}, + "availability_zones": {"key": "availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "enableNodePublicIP", "type": "bool"}, + "node_public_ip_prefix_id": {"key": "nodePublicIPPrefixID", "type": "str"}, + "scale_set_priority": {"key": "scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "scaleSetEvictionPolicy", "type": "str"}, + "spot_max_price": {"key": "spotMaxPrice", "type": "float"}, + "tags": {"key": "tags", "type": "{str}"}, + "node_labels": {"key": "nodeLabels", "type": "{str}"}, + "node_taints": {"key": "nodeTaints", "type": "[str]"}, + "proximity_placement_group_id": {"key": "proximityPlacementGroupID", "type": "str"}, + "kubelet_config": {"key": "kubeletConfig", "type": "KubeletConfig"}, + "linux_os_config": {"key": "linuxOSConfig", "type": "LinuxOSConfig"}, + "enable_encryption_at_host": {"key": "enableEncryptionAtHost", "type": "bool"}, + "enable_ultra_ssd": {"key": "enableUltraSSD", "type": "bool"}, + "enable_fips": {"key": "enableFIPS", "type": "bool"}, + "gpu_instance_profile": {"key": "gpuInstanceProfile", "type": "str"}, + "creation_data": {"key": "creationData", "type": "CreationData"}, + "host_group_id": {"key": "hostGroupID", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, count: Optional[int] = None, @@ -2808,7 +2730,7 @@ def __init__( vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, @@ -2822,9 +2744,9 @@ def __init__( availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", - spot_max_price: Optional[float] = -1, + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", + spot_max_price: float = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, @@ -2856,14 +2778,14 @@ def __init__( larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2022_06_01.models.OSDiskType :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime - data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + data root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_06_01.models.KubeletDiskType :keyword workload_runtime: Determines the type of workload a node can run. Known values are: - "OCIContainer", "WasmWasi". + "OCIContainer" and "WasmWasi". :paramtype workload_runtime: str or ~azure.mgmt.containerservice.v2022_06_01.models.WorkloadRuntime :keyword vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and @@ -2877,11 +2799,11 @@ def __init__( :paramtype pod_subnet_id: str :keyword max_pods: The maximum number of pods that can run on a node. :paramtype max_pods: int - :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_06_01.models.OSType :keyword os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Known values are: "Ubuntu", "CBLMariner". + Known values are: "Ubuntu" and "CBLMariner". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2022_06_01.models.OSSKU :keyword max_count: The maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -2890,15 +2812,15 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, - it defaults to Delete. Known values are: "Delete", "Deallocate". + it defaults to Delete. Known values are: "Delete" and "Deallocate". :paramtype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_06_01.models.ScaleDownMode - :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", + :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2022_06_01.models.AgentPoolType :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2022_06_01.models.AgentPoolMode :keyword orchestrator_version: Both patch version (e.g. 1.20.13) and (e.g. 1.20) are supported. When is specified, the latest supported @@ -2933,20 +2855,18 @@ def __init__( /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the - default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + default is 'Regular'. Known values are: "Spot" and "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_06_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_06_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :paramtype spot_max_price: float - :keyword tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :keyword tags: The tags to be persisted on the agent pool virtual machine scale set. :paramtype tags: dict[str, str] :keyword node_labels: The node labels to be persisted across all nodes in agent pool. :paramtype node_labels: dict[str, str] @@ -2970,7 +2890,7 @@ def __init__( for more details. :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance - profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_06_01.models.GPUInstanceProfile @@ -2983,7 +2903,7 @@ def __init__( `_. :paramtype host_group_id: str """ - super(ManagedClusterAgentPoolProfileProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.vm_size = vm_size self.os_disk_size_gb = os_disk_size_gb @@ -3027,7 +2947,9 @@ def __init__( self.host_group_id = host_group_id -class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): +class ManagedClusterAgentPoolProfile( + ManagedClusterAgentPoolProfileProperties +): # pylint: disable=too-many-instance-attributes """Profile for the container service agent pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -3050,14 +2972,14 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2022_06_01.models.OSDiskType :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data - root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_06_01.models.KubeletDiskType :ivar workload_runtime: Determines the type of workload a node can run. Known values are: - "OCIContainer", "WasmWasi". + "OCIContainer" and "WasmWasi". :vartype workload_runtime: str or ~azure.mgmt.containerservice.v2022_06_01.models.WorkloadRuntime :ivar vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and used. @@ -3071,11 +2993,11 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :vartype pod_subnet_id: str :ivar max_pods: The maximum number of pods that can run on a node. :vartype max_pods: int - :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_06_01.models.OSType :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known - values are: "Ubuntu", "CBLMariner". + values are: "Ubuntu" and "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2022_06_01.models.OSSKU :ivar max_count: The maximum number of nodes for auto-scaling. :vartype max_count: int @@ -3084,14 +3006,14 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it - defaults to Delete. Known values are: "Delete", "Deallocate". + defaults to Delete. Known values are: "Delete" and "Deallocate". :vartype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_06_01.models.ScaleDownMode - :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", + :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets" and "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2022_06_01.models.AgentPoolType :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :vartype mode: str or ~azure.mgmt.containerservice.v2022_06_01.models.AgentPoolMode :ivar orchestrator_version: Both patch version (e.g. 1.20.13) and (e.g. 1.20) are supported. When is specified, the latest supported @@ -3134,20 +3056,18 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default - is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + is 'Regular'. Known values are: "Spot" and "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_06_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_06_01.models.ScaleSetEvictionPolicy :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :vartype spot_max_price: float - :ivar tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :ivar tags: The tags to be persisted on the agent pool virtual machine scale set. :vartype tags: dict[str, str] :ivar node_labels: The node labels to be persisted across all nodes in agent pool. :vartype node_labels: dict[str, str] @@ -3171,7 +3091,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): for more details. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_06_01.models.GPUInstanceProfile :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the node pool @@ -3182,64 +3102,64 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): For more information see `Azure dedicated hosts `_. :vartype host_group_id: str - :ivar name: Required. Windows agent pool names must be 6 characters or less. + :ivar name: Windows agent pool names must be 6 characters or less. Required. :vartype name: str """ _validation = { - 'os_disk_size_gb': {'maximum': 2048, 'minimum': 0}, - 'current_orchestrator_version': {'readonly': True}, - 'node_image_version': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'name': {'required': True, 'pattern': r'^[a-z][a-z0-9]{0,11}$'}, + "os_disk_size_gb": {"maximum": 2048, "minimum": 0}, + "current_orchestrator_version": {"readonly": True}, + "node_image_version": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "name": {"required": True, "pattern": r"^[a-z][a-z0-9]{0,11}$"}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'os_disk_type': {'key': 'osDiskType', 'type': 'str'}, - 'kubelet_disk_type': {'key': 'kubeletDiskType', 'type': 'str'}, - 'workload_runtime': {'key': 'workloadRuntime', 'type': 'str'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'pod_subnet_id': {'key': 'podSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'maxPods', 'type': 'int'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'os_sku': {'key': 'osSKU', 'type': 'str'}, - 'max_count': {'key': 'maxCount', 'type': 'int'}, - 'min_count': {'key': 'minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'enableAutoScaling', 'type': 'bool'}, - 'scale_down_mode': {'key': 'scaleDownMode', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'mode': {'key': 'mode', 'type': 'str'}, - 'orchestrator_version': {'key': 'orchestratorVersion', 'type': 'str'}, - 'current_orchestrator_version': {'key': 'currentOrchestratorVersion', 'type': 'str'}, - 'node_image_version': {'key': 'nodeImageVersion', 'type': 'str'}, - 'upgrade_settings': {'key': 'upgradeSettings', 'type': 'AgentPoolUpgradeSettings'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'power_state': {'key': 'powerState', 'type': 'PowerState'}, - 'availability_zones': {'key': 'availabilityZones', 'type': '[str]'}, - 'enable_node_public_ip': {'key': 'enableNodePublicIP', 'type': 'bool'}, - 'node_public_ip_prefix_id': {'key': 'nodePublicIPPrefixID', 'type': 'str'}, - 'scale_set_priority': {'key': 'scaleSetPriority', 'type': 'str'}, - 'scale_set_eviction_policy': {'key': 'scaleSetEvictionPolicy', 'type': 'str'}, - 'spot_max_price': {'key': 'spotMaxPrice', 'type': 'float'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'node_labels': {'key': 'nodeLabels', 'type': '{str}'}, - 'node_taints': {'key': 'nodeTaints', 'type': '[str]'}, - 'proximity_placement_group_id': {'key': 'proximityPlacementGroupID', 'type': 'str'}, - 'kubelet_config': {'key': 'kubeletConfig', 'type': 'KubeletConfig'}, - 'linux_os_config': {'key': 'linuxOSConfig', 'type': 'LinuxOSConfig'}, - 'enable_encryption_at_host': {'key': 'enableEncryptionAtHost', 'type': 'bool'}, - 'enable_ultra_ssd': {'key': 'enableUltraSSD', 'type': 'bool'}, - 'enable_fips': {'key': 'enableFIPS', 'type': 'bool'}, - 'gpu_instance_profile': {'key': 'gpuInstanceProfile', 'type': 'str'}, - 'creation_data': {'key': 'creationData', 'type': 'CreationData'}, - 'host_group_id': {'key': 'hostGroupID', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( + "count": {"key": "count", "type": "int"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "os_disk_type": {"key": "osDiskType", "type": "str"}, + "kubelet_disk_type": {"key": "kubeletDiskType", "type": "str"}, + "workload_runtime": {"key": "workloadRuntime", "type": "str"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "pod_subnet_id": {"key": "podSubnetID", "type": "str"}, + "max_pods": {"key": "maxPods", "type": "int"}, + "os_type": {"key": "osType", "type": "str"}, + "os_sku": {"key": "osSKU", "type": "str"}, + "max_count": {"key": "maxCount", "type": "int"}, + "min_count": {"key": "minCount", "type": "int"}, + "enable_auto_scaling": {"key": "enableAutoScaling", "type": "bool"}, + "scale_down_mode": {"key": "scaleDownMode", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "mode": {"key": "mode", "type": "str"}, + "orchestrator_version": {"key": "orchestratorVersion", "type": "str"}, + "current_orchestrator_version": {"key": "currentOrchestratorVersion", "type": "str"}, + "node_image_version": {"key": "nodeImageVersion", "type": "str"}, + "upgrade_settings": {"key": "upgradeSettings", "type": "AgentPoolUpgradeSettings"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "power_state": {"key": "powerState", "type": "PowerState"}, + "availability_zones": {"key": "availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "enableNodePublicIP", "type": "bool"}, + "node_public_ip_prefix_id": {"key": "nodePublicIPPrefixID", "type": "str"}, + "scale_set_priority": {"key": "scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "scaleSetEvictionPolicy", "type": "str"}, + "spot_max_price": {"key": "spotMaxPrice", "type": "float"}, + "tags": {"key": "tags", "type": "{str}"}, + "node_labels": {"key": "nodeLabels", "type": "{str}"}, + "node_taints": {"key": "nodeTaints", "type": "[str]"}, + "proximity_placement_group_id": {"key": "proximityPlacementGroupID", "type": "str"}, + "kubelet_config": {"key": "kubeletConfig", "type": "KubeletConfig"}, + "linux_os_config": {"key": "linuxOSConfig", "type": "LinuxOSConfig"}, + "enable_encryption_at_host": {"key": "enableEncryptionAtHost", "type": "bool"}, + "enable_ultra_ssd": {"key": "enableUltraSSD", "type": "bool"}, + "enable_fips": {"key": "enableFIPS", "type": "bool"}, + "gpu_instance_profile": {"key": "gpuInstanceProfile", "type": "str"}, + "creation_data": {"key": "creationData", "type": "CreationData"}, + "host_group_id": {"key": "hostGroupID", "type": "str"}, + "name": {"key": "name", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, name: str, @@ -3252,7 +3172,7 @@ def __init__( vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, @@ -3266,9 +3186,9 @@ def __init__( availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", - spot_max_price: Optional[float] = -1, + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", + spot_max_price: float = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, @@ -3300,14 +3220,14 @@ def __init__( larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2022_06_01.models.OSDiskType :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime - data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + data root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_06_01.models.KubeletDiskType :keyword workload_runtime: Determines the type of workload a node can run. Known values are: - "OCIContainer", "WasmWasi". + "OCIContainer" and "WasmWasi". :paramtype workload_runtime: str or ~azure.mgmt.containerservice.v2022_06_01.models.WorkloadRuntime :keyword vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and @@ -3321,11 +3241,11 @@ def __init__( :paramtype pod_subnet_id: str :keyword max_pods: The maximum number of pods that can run on a node. :paramtype max_pods: int - :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_06_01.models.OSType :keyword os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Known values are: "Ubuntu", "CBLMariner". + Known values are: "Ubuntu" and "CBLMariner". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2022_06_01.models.OSSKU :keyword max_count: The maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -3334,15 +3254,15 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, - it defaults to Delete. Known values are: "Delete", "Deallocate". + it defaults to Delete. Known values are: "Delete" and "Deallocate". :paramtype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_06_01.models.ScaleDownMode - :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", + :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2022_06_01.models.AgentPoolType :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2022_06_01.models.AgentPoolMode :keyword orchestrator_version: Both patch version (e.g. 1.20.13) and (e.g. 1.20) are supported. When is specified, the latest supported @@ -3377,20 +3297,18 @@ def __init__( /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the - default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + default is 'Regular'. Known values are: "Spot" and "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_06_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_06_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :paramtype spot_max_price: float - :keyword tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :keyword tags: The tags to be persisted on the agent pool virtual machine scale set. :paramtype tags: dict[str, str] :keyword node_labels: The node labels to be persisted across all nodes in agent pool. :paramtype node_labels: dict[str, str] @@ -3414,7 +3332,7 @@ def __init__( for more details. :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance - profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_06_01.models.GPUInstanceProfile @@ -3426,14 +3344,54 @@ def __init__( For more information see `Azure dedicated hosts `_. :paramtype host_group_id: str - :keyword name: Required. Windows agent pool names must be 6 characters or less. + :keyword name: Windows agent pool names must be 6 characters or less. Required. :paramtype name: str """ - super(ManagedClusterAgentPoolProfile, self).__init__(count=count, vm_size=vm_size, os_disk_size_gb=os_disk_size_gb, os_disk_type=os_disk_type, kubelet_disk_type=kubelet_disk_type, workload_runtime=workload_runtime, vnet_subnet_id=vnet_subnet_id, pod_subnet_id=pod_subnet_id, max_pods=max_pods, os_type=os_type, os_sku=os_sku, max_count=max_count, min_count=min_count, enable_auto_scaling=enable_auto_scaling, scale_down_mode=scale_down_mode, type=type, mode=mode, orchestrator_version=orchestrator_version, upgrade_settings=upgrade_settings, power_state=power_state, availability_zones=availability_zones, enable_node_public_ip=enable_node_public_ip, node_public_ip_prefix_id=node_public_ip_prefix_id, scale_set_priority=scale_set_priority, scale_set_eviction_policy=scale_set_eviction_policy, spot_max_price=spot_max_price, tags=tags, node_labels=node_labels, node_taints=node_taints, proximity_placement_group_id=proximity_placement_group_id, kubelet_config=kubelet_config, linux_os_config=linux_os_config, enable_encryption_at_host=enable_encryption_at_host, enable_ultra_ssd=enable_ultra_ssd, enable_fips=enable_fips, gpu_instance_profile=gpu_instance_profile, creation_data=creation_data, host_group_id=host_group_id, **kwargs) + super().__init__( + count=count, + vm_size=vm_size, + os_disk_size_gb=os_disk_size_gb, + os_disk_type=os_disk_type, + kubelet_disk_type=kubelet_disk_type, + workload_runtime=workload_runtime, + vnet_subnet_id=vnet_subnet_id, + pod_subnet_id=pod_subnet_id, + max_pods=max_pods, + os_type=os_type, + os_sku=os_sku, + max_count=max_count, + min_count=min_count, + enable_auto_scaling=enable_auto_scaling, + scale_down_mode=scale_down_mode, + type=type, + mode=mode, + orchestrator_version=orchestrator_version, + upgrade_settings=upgrade_settings, + power_state=power_state, + availability_zones=availability_zones, + enable_node_public_ip=enable_node_public_ip, + node_public_ip_prefix_id=node_public_ip_prefix_id, + scale_set_priority=scale_set_priority, + scale_set_eviction_policy=scale_set_eviction_policy, + spot_max_price=spot_max_price, + tags=tags, + node_labels=node_labels, + node_taints=node_taints, + proximity_placement_group_id=proximity_placement_group_id, + kubelet_config=kubelet_config, + linux_os_config=linux_os_config, + enable_encryption_at_host=enable_encryption_at_host, + enable_ultra_ssd=enable_ultra_ssd, + enable_fips=enable_fips, + gpu_instance_profile=gpu_instance_profile, + creation_data=creation_data, + host_group_id=host_group_id, + **kwargs + ) self.name = name -class ManagedClusterAPIServerAccessProfile(msrest.serialization.Model): +class ManagedClusterAPIServerAccessProfile(_serialization.Model): """Access profile for managed cluster API server. :ivar authorized_ip_ranges: IP ranges are specified in CIDR format, e.g. 137.117.106.88/29. @@ -3456,11 +3414,11 @@ class ManagedClusterAPIServerAccessProfile(msrest.serialization.Model): """ _attribute_map = { - 'authorized_ip_ranges': {'key': 'authorizedIPRanges', 'type': '[str]'}, - 'enable_private_cluster': {'key': 'enablePrivateCluster', 'type': 'bool'}, - 'private_dns_zone': {'key': 'privateDNSZone', 'type': 'str'}, - 'enable_private_cluster_public_fqdn': {'key': 'enablePrivateClusterPublicFQDN', 'type': 'bool'}, - 'disable_run_command': {'key': 'disableRunCommand', 'type': 'bool'}, + "authorized_ip_ranges": {"key": "authorizedIPRanges", "type": "[str]"}, + "enable_private_cluster": {"key": "enablePrivateCluster", "type": "bool"}, + "private_dns_zone": {"key": "privateDNSZone", "type": "str"}, + "enable_private_cluster_public_fqdn": {"key": "enablePrivateClusterPublicFQDN", "type": "bool"}, + "disable_run_command": {"key": "disableRunCommand", "type": "bool"}, } def __init__( @@ -3492,7 +3450,7 @@ def __init__( :keyword disable_run_command: Whether to disable run command for the cluster or not. :paramtype disable_run_command: bool """ - super(ManagedClusterAPIServerAccessProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.authorized_ip_ranges = authorized_ip_ranges self.enable_private_cluster = enable_private_cluster self.private_dns_zone = private_dns_zone @@ -3500,37 +3458,32 @@ def __init__( self.disable_run_command = disable_run_command -class ManagedClusterAutoUpgradeProfile(msrest.serialization.Model): +class ManagedClusterAutoUpgradeProfile(_serialization.Model): """Auto upgrade profile for a managed cluster. :ivar upgrade_channel: For more information see `setting the AKS cluster auto-upgrade channel `_. Known values - are: "rapid", "stable", "patch", "node-image", "none". + are: "rapid", "stable", "patch", "node-image", and "none". :vartype upgrade_channel: str or ~azure.mgmt.containerservice.v2022_06_01.models.UpgradeChannel """ _attribute_map = { - 'upgrade_channel': {'key': 'upgradeChannel', 'type': 'str'}, + "upgrade_channel": {"key": "upgradeChannel", "type": "str"}, } - def __init__( - self, - *, - upgrade_channel: Optional[Union[str, "_models.UpgradeChannel"]] = None, - **kwargs - ): + def __init__(self, *, upgrade_channel: Optional[Union[str, "_models.UpgradeChannel"]] = None, **kwargs): """ :keyword upgrade_channel: For more information see `setting the AKS cluster auto-upgrade channel `_. - Known values are: "rapid", "stable", "patch", "node-image", "none". + Known values are: "rapid", "stable", "patch", "node-image", and "none". :paramtype upgrade_channel: str or ~azure.mgmt.containerservice.v2022_06_01.models.UpgradeChannel """ - super(ManagedClusterAutoUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.upgrade_channel = upgrade_channel -class ManagedClusterHTTPProxyConfig(msrest.serialization.Model): +class ManagedClusterHTTPProxyConfig(_serialization.Model): """Cluster HTTP proxy configuration. :ivar http_proxy: The HTTP proxy server endpoint to use. @@ -3544,10 +3497,10 @@ class ManagedClusterHTTPProxyConfig(msrest.serialization.Model): """ _attribute_map = { - 'http_proxy': {'key': 'httpProxy', 'type': 'str'}, - 'https_proxy': {'key': 'httpsProxy', 'type': 'str'}, - 'no_proxy': {'key': 'noProxy', 'type': '[str]'}, - 'trusted_ca': {'key': 'trustedCa', 'type': 'str'}, + "http_proxy": {"key": "httpProxy", "type": "str"}, + "https_proxy": {"key": "httpsProxy", "type": "str"}, + "no_proxy": {"key": "noProxy", "type": "[str]"}, + "trusted_ca": {"key": "trustedCa", "type": "str"}, } def __init__( @@ -3569,14 +3522,14 @@ def __init__( :keyword trusted_ca: Alternative CA cert to use for connecting to proxy servers. :paramtype trusted_ca: str """ - super(ManagedClusterHTTPProxyConfig, self).__init__(**kwargs) + super().__init__(**kwargs) self.http_proxy = http_proxy self.https_proxy = https_proxy self.no_proxy = no_proxy self.trusted_ca = trusted_ca -class ManagedClusterIdentity(msrest.serialization.Model): +class ManagedClusterIdentity(_serialization.Model): """Identity for the managed cluster. Variables are only populated by the server, and will be ignored when sending a request. @@ -3589,7 +3542,7 @@ class ManagedClusterIdentity(msrest.serialization.Model): :vartype tenant_id: str :ivar type: For more information see `use managed identities in AKS `_. Known values are: - "SystemAssigned", "UserAssigned", "None". + "SystemAssigned", "UserAssigned", and "None". :vartype type: str or ~azure.mgmt.containerservice.v2022_06_01.models.ResourceIdentityType :ivar user_assigned_identities: The keys must be ARM resource IDs in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. @@ -3598,42 +3551,47 @@ class ManagedClusterIdentity(msrest.serialization.Model): """ _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, + "principal_id": {"readonly": True}, + "tenant_id": {"readonly": True}, } _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{ManagedServiceIdentityUserAssignedIdentitiesValue}'}, + "principal_id": {"key": "principalId", "type": "str"}, + "tenant_id": {"key": "tenantId", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "user_assigned_identities": { + "key": "userAssignedIdentities", + "type": "{ManagedServiceIdentityUserAssignedIdentitiesValue}", + }, } def __init__( self, *, type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, - user_assigned_identities: Optional[Dict[str, "_models.ManagedServiceIdentityUserAssignedIdentitiesValue"]] = None, + user_assigned_identities: Optional[ + Dict[str, "_models.ManagedServiceIdentityUserAssignedIdentitiesValue"] + ] = None, **kwargs ): """ :keyword type: For more information see `use managed identities in AKS `_. Known values are: - "SystemAssigned", "UserAssigned", "None". + "SystemAssigned", "UserAssigned", and "None". :paramtype type: str or ~azure.mgmt.containerservice.v2022_06_01.models.ResourceIdentityType :keyword user_assigned_identities: The keys must be ARM resource IDs in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. :paramtype user_assigned_identities: dict[str, ~azure.mgmt.containerservice.v2022_06_01.models.ManagedServiceIdentityUserAssignedIdentitiesValue] """ - super(ManagedClusterIdentity, self).__init__(**kwargs) + super().__init__(**kwargs) self.principal_id = None self.tenant_id = None self.type = type self.user_assigned_identities = user_assigned_identities -class ManagedClusterListResult(msrest.serialization.Model): +class ManagedClusterListResult(_serialization.Model): """The response from the List Managed Clusters operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -3645,30 +3603,25 @@ class ManagedClusterListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[ManagedCluster]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[ManagedCluster]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.ManagedCluster"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.ManagedCluster"]] = None, **kwargs): """ :keyword value: The list of managed clusters. :paramtype value: list[~azure.mgmt.containerservice.v2022_06_01.models.ManagedCluster] """ - super(ManagedClusterListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class ManagedClusterLoadBalancerProfile(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfile(_serialization.Model): """Profile of the managed cluster load balancer. :ivar managed_outbound_i_ps: Desired managed outbound IPs for the cluster load balancer. @@ -3697,18 +3650,24 @@ class ManagedClusterLoadBalancerProfile(msrest.serialization.Model): """ _validation = { - 'allocated_outbound_ports': {'maximum': 64000, 'minimum': 0}, - 'idle_timeout_in_minutes': {'maximum': 120, 'minimum': 4}, + "allocated_outbound_ports": {"maximum": 64000, "minimum": 0}, + "idle_timeout_in_minutes": {"maximum": 120, "minimum": 4}, } _attribute_map = { - 'managed_outbound_i_ps': {'key': 'managedOutboundIPs', 'type': 'ManagedClusterLoadBalancerProfileManagedOutboundIPs'}, - 'outbound_ip_prefixes': {'key': 'outboundIPPrefixes', 'type': 'ManagedClusterLoadBalancerProfileOutboundIPPrefixes'}, - 'outbound_i_ps': {'key': 'outboundIPs', 'type': 'ManagedClusterLoadBalancerProfileOutboundIPs'}, - 'effective_outbound_i_ps': {'key': 'effectiveOutboundIPs', 'type': '[ResourceReference]'}, - 'allocated_outbound_ports': {'key': 'allocatedOutboundPorts', 'type': 'int'}, - 'idle_timeout_in_minutes': {'key': 'idleTimeoutInMinutes', 'type': 'int'}, - 'enable_multiple_standard_load_balancers': {'key': 'enableMultipleStandardLoadBalancers', 'type': 'bool'}, + "managed_outbound_i_ps": { + "key": "managedOutboundIPs", + "type": "ManagedClusterLoadBalancerProfileManagedOutboundIPs", + }, + "outbound_ip_prefixes": { + "key": "outboundIPPrefixes", + "type": "ManagedClusterLoadBalancerProfileOutboundIPPrefixes", + }, + "outbound_i_ps": {"key": "outboundIPs", "type": "ManagedClusterLoadBalancerProfileOutboundIPs"}, + "effective_outbound_i_ps": {"key": "effectiveOutboundIPs", "type": "[ResourceReference]"}, + "allocated_outbound_ports": {"key": "allocatedOutboundPorts", "type": "int"}, + "idle_timeout_in_minutes": {"key": "idleTimeoutInMinutes", "type": "int"}, + "enable_multiple_standard_load_balancers": {"key": "enableMultipleStandardLoadBalancers", "type": "bool"}, } def __init__( @@ -3718,8 +3677,8 @@ def __init__( outbound_ip_prefixes: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPPrefixes"] = None, outbound_i_ps: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPs"] = None, effective_outbound_i_ps: Optional[List["_models.ResourceReference"]] = None, - allocated_outbound_ports: Optional[int] = 0, - idle_timeout_in_minutes: Optional[int] = 30, + allocated_outbound_ports: int = 0, + idle_timeout_in_minutes: int = 30, enable_multiple_standard_load_balancers: Optional[bool] = None, **kwargs ): @@ -3749,7 +3708,7 @@ def __init__( AKS cluster or not. :paramtype enable_multiple_standard_load_balancers: bool """ - super(ManagedClusterLoadBalancerProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.managed_outbound_i_ps = managed_outbound_i_ps self.outbound_ip_prefixes = outbound_ip_prefixes self.outbound_i_ps = outbound_i_ps @@ -3759,7 +3718,7 @@ def __init__( self.enable_multiple_standard_load_balancers = enable_multiple_standard_load_balancers -class ManagedClusterLoadBalancerProfileManagedOutboundIPs(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfileManagedOutboundIPs(_serialization.Model): """Desired managed outbound IPs for the cluster load balancer. :ivar count: The desired number of IPv4 outbound IPs created/managed by Azure for the cluster @@ -3773,22 +3732,16 @@ class ManagedClusterLoadBalancerProfileManagedOutboundIPs(msrest.serialization.M """ _validation = { - 'count': {'maximum': 100, 'minimum': 1}, - 'count_ipv6': {'maximum': 100, 'minimum': 0}, + "count": {"maximum": 100, "minimum": 1}, + "count_ipv6": {"maximum": 100, "minimum": 0}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'count_ipv6': {'key': 'countIPv6', 'type': 'int'}, + "count": {"key": "count", "type": "int"}, + "count_ipv6": {"key": "countIPv6", "type": "int"}, } - def __init__( - self, - *, - count: Optional[int] = 1, - count_ipv6: Optional[int] = 0, - **kwargs - ): + def __init__(self, *, count: int = 1, count_ipv6: int = 0, **kwargs): """ :keyword count: The desired number of IPv4 outbound IPs created/managed by Azure for the cluster load balancer. Allowed values must be in the range of 1 to 100 (inclusive). The default @@ -3799,12 +3752,12 @@ def __init__( value is 0 for single-stack and 1 for dual-stack. :paramtype count_ipv6: int """ - super(ManagedClusterLoadBalancerProfileManagedOutboundIPs, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.count_ipv6 = count_ipv6 -class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(_serialization.Model): """Desired outbound IP Prefix resources for the cluster load balancer. :ivar public_ip_prefixes: A list of public IP prefix resources. @@ -3813,25 +3766,20 @@ class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(msrest.serialization.M """ _attribute_map = { - 'public_ip_prefixes': {'key': 'publicIPPrefixes', 'type': '[ResourceReference]'}, + "public_ip_prefixes": {"key": "publicIPPrefixes", "type": "[ResourceReference]"}, } - def __init__( - self, - *, - public_ip_prefixes: Optional[List["_models.ResourceReference"]] = None, - **kwargs - ): + def __init__(self, *, public_ip_prefixes: Optional[List["_models.ResourceReference"]] = None, **kwargs): """ :keyword public_ip_prefixes: A list of public IP prefix resources. :paramtype public_ip_prefixes: list[~azure.mgmt.containerservice.v2022_06_01.models.ResourceReference] """ - super(ManagedClusterLoadBalancerProfileOutboundIPPrefixes, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_ip_prefixes = public_ip_prefixes -class ManagedClusterLoadBalancerProfileOutboundIPs(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfileOutboundIPs(_serialization.Model): """Desired outbound IP resources for the cluster load balancer. :ivar public_i_ps: A list of public IP resources. @@ -3839,24 +3787,19 @@ class ManagedClusterLoadBalancerProfileOutboundIPs(msrest.serialization.Model): """ _attribute_map = { - 'public_i_ps': {'key': 'publicIPs', 'type': '[ResourceReference]'}, + "public_i_ps": {"key": "publicIPs", "type": "[ResourceReference]"}, } - def __init__( - self, - *, - public_i_ps: Optional[List["_models.ResourceReference"]] = None, - **kwargs - ): + def __init__(self, *, public_i_ps: Optional[List["_models.ResourceReference"]] = None, **kwargs): """ :keyword public_i_ps: A list of public IP resources. :paramtype public_i_ps: list[~azure.mgmt.containerservice.v2022_06_01.models.ResourceReference] """ - super(ManagedClusterLoadBalancerProfileOutboundIPs, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_i_ps = public_i_ps -class ManagedClusterManagedOutboundIPProfile(msrest.serialization.Model): +class ManagedClusterManagedOutboundIPProfile(_serialization.Model): """Profile of the managed outbound IP resources of the managed cluster. :ivar count: The desired number of outbound IPs created/managed by Azure. Allowed values must @@ -3865,29 +3808,24 @@ class ManagedClusterManagedOutboundIPProfile(msrest.serialization.Model): """ _validation = { - 'count': {'maximum': 16, 'minimum': 1}, + "count": {"maximum": 16, "minimum": 1}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, + "count": {"key": "count", "type": "int"}, } - def __init__( - self, - *, - count: Optional[int] = 1, - **kwargs - ): + def __init__(self, *, count: int = 1, **kwargs): """ :keyword count: The desired number of outbound IPs created/managed by Azure. Allowed values must be in the range of 1 to 16 (inclusive). The default value is 1. :paramtype count: int """ - super(ManagedClusterManagedOutboundIPProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count -class ManagedClusterNATGatewayProfile(msrest.serialization.Model): +class ManagedClusterNATGatewayProfile(_serialization.Model): """Profile of the managed cluster NAT gateway. :ivar managed_outbound_ip_profile: Profile of the managed outbound IP resources of the cluster @@ -3903,13 +3841,16 @@ class ManagedClusterNATGatewayProfile(msrest.serialization.Model): """ _validation = { - 'idle_timeout_in_minutes': {'maximum': 120, 'minimum': 4}, + "idle_timeout_in_minutes": {"maximum": 120, "minimum": 4}, } _attribute_map = { - 'managed_outbound_ip_profile': {'key': 'managedOutboundIPProfile', 'type': 'ManagedClusterManagedOutboundIPProfile'}, - 'effective_outbound_i_ps': {'key': 'effectiveOutboundIPs', 'type': '[ResourceReference]'}, - 'idle_timeout_in_minutes': {'key': 'idleTimeoutInMinutes', 'type': 'int'}, + "managed_outbound_ip_profile": { + "key": "managedOutboundIPProfile", + "type": "ManagedClusterManagedOutboundIPProfile", + }, + "effective_outbound_i_ps": {"key": "effectiveOutboundIPs", "type": "[ResourceReference]"}, + "idle_timeout_in_minutes": {"key": "idleTimeoutInMinutes", "type": "int"}, } def __init__( @@ -3917,7 +3858,7 @@ def __init__( *, managed_outbound_ip_profile: Optional["_models.ManagedClusterManagedOutboundIPProfile"] = None, effective_outbound_i_ps: Optional[List["_models.ResourceReference"]] = None, - idle_timeout_in_minutes: Optional[int] = 4, + idle_timeout_in_minutes: int = 4, **kwargs ): """ @@ -3933,29 +3874,29 @@ def __init__( are in the range of 4 to 120 (inclusive). The default value is 4 minutes. :paramtype idle_timeout_in_minutes: int """ - super(ManagedClusterNATGatewayProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.managed_outbound_ip_profile = managed_outbound_ip_profile self.effective_outbound_i_ps = effective_outbound_i_ps self.idle_timeout_in_minutes = idle_timeout_in_minutes -class ManagedClusterPodIdentity(msrest.serialization.Model): +class ManagedClusterPodIdentity(_serialization.Model): """Details about the pod identity assigned to the Managed Cluster. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar name: Required. The name of the pod identity. + :ivar name: The name of the pod identity. Required. :vartype name: str - :ivar namespace: Required. The namespace of the pod identity. + :ivar namespace: The namespace of the pod identity. Required. :vartype namespace: str :ivar binding_selector: The binding selector to use for the AzureIdentityBinding resource. :vartype binding_selector: str - :ivar identity: Required. The user assigned identity details. + :ivar identity: The user assigned identity details. Required. :vartype identity: ~azure.mgmt.containerservice.v2022_06_01.models.UserAssignedIdentity :ivar provisioning_state: The current provisioning state of the pod identity. Known values are: - "Assigned", "Updating", "Deleting", "Failed". + "Assigned", "Updating", "Deleting", and "Failed". :vartype provisioning_state: str or ~azure.mgmt.containerservice.v2022_06_01.models.ManagedClusterPodIdentityProvisioningState :ivar provisioning_info: @@ -3964,20 +3905,20 @@ class ManagedClusterPodIdentity(msrest.serialization.Model): """ _validation = { - 'name': {'required': True}, - 'namespace': {'required': True}, - 'identity': {'required': True}, - 'provisioning_state': {'readonly': True}, - 'provisioning_info': {'readonly': True}, + "name": {"required": True}, + "namespace": {"required": True}, + "identity": {"required": True}, + "provisioning_state": {"readonly": True}, + "provisioning_info": {"readonly": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'namespace': {'key': 'namespace', 'type': 'str'}, - 'binding_selector': {'key': 'bindingSelector', 'type': 'str'}, - 'identity': {'key': 'identity', 'type': 'UserAssignedIdentity'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'provisioning_info': {'key': 'provisioningInfo', 'type': 'ManagedClusterPodIdentityProvisioningInfo'}, + "name": {"key": "name", "type": "str"}, + "namespace": {"key": "namespace", "type": "str"}, + "binding_selector": {"key": "bindingSelector", "type": "str"}, + "identity": {"key": "identity", "type": "UserAssignedIdentity"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "provisioning_info": {"key": "provisioningInfo", "type": "ManagedClusterPodIdentityProvisioningInfo"}, } def __init__( @@ -3990,16 +3931,16 @@ def __init__( **kwargs ): """ - :keyword name: Required. The name of the pod identity. + :keyword name: The name of the pod identity. Required. :paramtype name: str - :keyword namespace: Required. The namespace of the pod identity. + :keyword namespace: The namespace of the pod identity. Required. :paramtype namespace: str :keyword binding_selector: The binding selector to use for the AzureIdentityBinding resource. :paramtype binding_selector: str - :keyword identity: Required. The user assigned identity details. + :keyword identity: The user assigned identity details. Required. :paramtype identity: ~azure.mgmt.containerservice.v2022_06_01.models.UserAssignedIdentity """ - super(ManagedClusterPodIdentity, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.namespace = namespace self.binding_selector = binding_selector @@ -4008,54 +3949,47 @@ def __init__( self.provisioning_info = None -class ManagedClusterPodIdentityException(msrest.serialization.Model): +class ManagedClusterPodIdentityException(_serialization.Model): """See `disable AAD Pod Identity for a specific Pod/Application `_ for more details. All required parameters must be populated in order to send to Azure. - :ivar name: Required. The name of the pod identity exception. + :ivar name: The name of the pod identity exception. Required. :vartype name: str - :ivar namespace: Required. The namespace of the pod identity exception. + :ivar namespace: The namespace of the pod identity exception. Required. :vartype namespace: str - :ivar pod_labels: Required. The pod labels to match. + :ivar pod_labels: The pod labels to match. Required. :vartype pod_labels: dict[str, str] """ _validation = { - 'name': {'required': True}, - 'namespace': {'required': True}, - 'pod_labels': {'required': True}, + "name": {"required": True}, + "namespace": {"required": True}, + "pod_labels": {"required": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'namespace': {'key': 'namespace', 'type': 'str'}, - 'pod_labels': {'key': 'podLabels', 'type': '{str}'}, + "name": {"key": "name", "type": "str"}, + "namespace": {"key": "namespace", "type": "str"}, + "pod_labels": {"key": "podLabels", "type": "{str}"}, } - def __init__( - self, - *, - name: str, - namespace: str, - pod_labels: Dict[str, str], - **kwargs - ): + def __init__(self, *, name: str, namespace: str, pod_labels: Dict[str, str], **kwargs): """ - :keyword name: Required. The name of the pod identity exception. + :keyword name: The name of the pod identity exception. Required. :paramtype name: str - :keyword namespace: Required. The namespace of the pod identity exception. + :keyword namespace: The namespace of the pod identity exception. Required. :paramtype namespace: str - :keyword pod_labels: Required. The pod labels to match. + :keyword pod_labels: The pod labels to match. Required. :paramtype pod_labels: dict[str, str] """ - super(ManagedClusterPodIdentityException, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.namespace = namespace self.pod_labels = pod_labels -class ManagedClusterPodIdentityProfile(msrest.serialization.Model): +class ManagedClusterPodIdentityProfile(_serialization.Model): """See `use AAD pod identity `_ for more details on pod identity integration. :ivar enabled: Whether the pod identity addon is enabled. @@ -4075,10 +4009,13 @@ class ManagedClusterPodIdentityProfile(msrest.serialization.Model): """ _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'allow_network_plugin_kubenet': {'key': 'allowNetworkPluginKubenet', 'type': 'bool'}, - 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '[ManagedClusterPodIdentity]'}, - 'user_assigned_identity_exceptions': {'key': 'userAssignedIdentityExceptions', 'type': '[ManagedClusterPodIdentityException]'}, + "enabled": {"key": "enabled", "type": "bool"}, + "allow_network_plugin_kubenet": {"key": "allowNetworkPluginKubenet", "type": "bool"}, + "user_assigned_identities": {"key": "userAssignedIdentities", "type": "[ManagedClusterPodIdentity]"}, + "user_assigned_identity_exceptions": { + "key": "userAssignedIdentityExceptions", + "type": "[ManagedClusterPodIdentityException]", + }, } def __init__( @@ -4106,14 +4043,14 @@ def __init__( :paramtype user_assigned_identity_exceptions: list[~azure.mgmt.containerservice.v2022_06_01.models.ManagedClusterPodIdentityException] """ - super(ManagedClusterPodIdentityProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.allow_network_plugin_kubenet = allow_network_plugin_kubenet self.user_assigned_identities = user_assigned_identities self.user_assigned_identity_exceptions = user_assigned_identity_exceptions -class ManagedClusterPodIdentityProvisioningError(msrest.serialization.Model): +class ManagedClusterPodIdentityProvisioningError(_serialization.Model): """An error response from the pod identity provisioning. :ivar error: Details about the error. @@ -4122,25 +4059,20 @@ class ManagedClusterPodIdentityProvisioningError(msrest.serialization.Model): """ _attribute_map = { - 'error': {'key': 'error', 'type': 'ManagedClusterPodIdentityProvisioningErrorBody'}, + "error": {"key": "error", "type": "ManagedClusterPodIdentityProvisioningErrorBody"}, } - def __init__( - self, - *, - error: Optional["_models.ManagedClusterPodIdentityProvisioningErrorBody"] = None, - **kwargs - ): + def __init__(self, *, error: Optional["_models.ManagedClusterPodIdentityProvisioningErrorBody"] = None, **kwargs): """ :keyword error: Details about the error. :paramtype error: ~azure.mgmt.containerservice.v2022_06_01.models.ManagedClusterPodIdentityProvisioningErrorBody """ - super(ManagedClusterPodIdentityProvisioningError, self).__init__(**kwargs) + super().__init__(**kwargs) self.error = error -class ManagedClusterPodIdentityProvisioningErrorBody(msrest.serialization.Model): +class ManagedClusterPodIdentityProvisioningErrorBody(_serialization.Model): """An error response from the pod identity provisioning. :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed @@ -4158,10 +4090,10 @@ class ManagedClusterPodIdentityProvisioningErrorBody(msrest.serialization.Model) """ _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[ManagedClusterPodIdentityProvisioningErrorBody]'}, + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[ManagedClusterPodIdentityProvisioningErrorBody]"}, } def __init__( @@ -4187,14 +4119,14 @@ def __init__( :paramtype details: list[~azure.mgmt.containerservice.v2022_06_01.models.ManagedClusterPodIdentityProvisioningErrorBody] """ - super(ManagedClusterPodIdentityProvisioningErrorBody, self).__init__(**kwargs) + super().__init__(**kwargs) self.code = code self.message = message self.target = target self.details = details -class ManagedClusterPodIdentityProvisioningInfo(msrest.serialization.Model): +class ManagedClusterPodIdentityProvisioningInfo(_serialization.Model): """ManagedClusterPodIdentityProvisioningInfo. :ivar error: Pod identity assignment error (if any). @@ -4203,35 +4135,30 @@ class ManagedClusterPodIdentityProvisioningInfo(msrest.serialization.Model): """ _attribute_map = { - 'error': {'key': 'error', 'type': 'ManagedClusterPodIdentityProvisioningError'}, + "error": {"key": "error", "type": "ManagedClusterPodIdentityProvisioningError"}, } - def __init__( - self, - *, - error: Optional["_models.ManagedClusterPodIdentityProvisioningError"] = None, - **kwargs - ): + def __init__(self, *, error: Optional["_models.ManagedClusterPodIdentityProvisioningError"] = None, **kwargs): """ :keyword error: Pod identity assignment error (if any). :paramtype error: ~azure.mgmt.containerservice.v2022_06_01.models.ManagedClusterPodIdentityProvisioningError """ - super(ManagedClusterPodIdentityProvisioningInfo, self).__init__(**kwargs) + super().__init__(**kwargs) self.error = error -class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): +class ManagedClusterPoolUpgradeProfile(_serialization.Model): """The list of available upgrade versions. All required parameters must be populated in order to send to Azure. - :ivar kubernetes_version: Required. The Kubernetes version (major.minor.patch). + :ivar kubernetes_version: The Kubernetes version (major.minor.patch). Required. :vartype kubernetes_version: str :ivar name: The Agent Pool name. :vartype name: str - :ivar os_type: Required. The operating system type. The default is Linux. Known values are: - "Linux", "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_06_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -4239,15 +4166,15 @@ class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): """ _validation = { - 'kubernetes_version': {'required': True}, - 'os_type': {'required': True}, + "kubernetes_version": {"required": True}, + "os_type": {"required": True}, } _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'upgrades': {'key': 'upgrades', 'type': '[ManagedClusterPoolUpgradeProfileUpgradesItem]'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "os_type": {"key": "osType", "type": "str"}, + "upgrades": {"key": "upgrades", "type": "[ManagedClusterPoolUpgradeProfileUpgradesItem]"}, } def __init__( @@ -4260,25 +4187,25 @@ def __init__( **kwargs ): """ - :keyword kubernetes_version: Required. The Kubernetes version (major.minor.patch). + :keyword kubernetes_version: The Kubernetes version (major.minor.patch). Required. :paramtype kubernetes_version: str :keyword name: The Agent Pool name. :paramtype name: str - :keyword os_type: Required. The operating system type. The default is Linux. Known values are: - "Linux", "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_06_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: list[~azure.mgmt.containerservice.v2022_06_01.models.ManagedClusterPoolUpgradeProfileUpgradesItem] """ - super(ManagedClusterPoolUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.name = name self.os_type = os_type self.upgrades = upgrades -class ManagedClusterPoolUpgradeProfileUpgradesItem(msrest.serialization.Model): +class ManagedClusterPoolUpgradeProfileUpgradesItem(_serialization.Model): """ManagedClusterPoolUpgradeProfileUpgradesItem. :ivar kubernetes_version: The Kubernetes version (major.minor.patch). @@ -4288,36 +4215,30 @@ class ManagedClusterPoolUpgradeProfileUpgradesItem(msrest.serialization.Model): """ _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } - def __init__( - self, - *, - kubernetes_version: Optional[str] = None, - is_preview: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, kubernetes_version: Optional[str] = None, is_preview: Optional[bool] = None, **kwargs): """ :keyword kubernetes_version: The Kubernetes version (major.minor.patch). :paramtype kubernetes_version: str :keyword is_preview: Whether the Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(ManagedClusterPoolUpgradeProfileUpgradesItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.is_preview = is_preview -class ManagedClusterPropertiesAutoScalerProfile(msrest.serialization.Model): +class ManagedClusterPropertiesAutoScalerProfile(_serialization.Model): # pylint: disable=too-many-instance-attributes """Parameters to be applied to the cluster-autoscaler when enabled. :ivar balance_similar_node_groups: Valid values are 'true' and 'false'. :vartype balance_similar_node_groups: str :ivar expander: If not specified, the default is 'random'. See `expanders `_ - for more information. Known values are: "least-waste", "most-pods", "priority", "random". + for more information. Known values are: "least-waste", "most-pods", "priority", and "random". :vartype expander: str or ~azure.mgmt.containerservice.v2022_06_01.models.Expander :ivar max_empty_bulk_delete: The default is 10. :vartype max_empty_bulk_delete: str @@ -4361,23 +4282,23 @@ class ManagedClusterPropertiesAutoScalerProfile(msrest.serialization.Model): """ _attribute_map = { - 'balance_similar_node_groups': {'key': 'balance-similar-node-groups', 'type': 'str'}, - 'expander': {'key': 'expander', 'type': 'str'}, - 'max_empty_bulk_delete': {'key': 'max-empty-bulk-delete', 'type': 'str'}, - 'max_graceful_termination_sec': {'key': 'max-graceful-termination-sec', 'type': 'str'}, - 'max_node_provision_time': {'key': 'max-node-provision-time', 'type': 'str'}, - 'max_total_unready_percentage': {'key': 'max-total-unready-percentage', 'type': 'str'}, - 'new_pod_scale_up_delay': {'key': 'new-pod-scale-up-delay', 'type': 'str'}, - 'ok_total_unready_count': {'key': 'ok-total-unready-count', 'type': 'str'}, - 'scan_interval': {'key': 'scan-interval', 'type': 'str'}, - 'scale_down_delay_after_add': {'key': 'scale-down-delay-after-add', 'type': 'str'}, - 'scale_down_delay_after_delete': {'key': 'scale-down-delay-after-delete', 'type': 'str'}, - 'scale_down_delay_after_failure': {'key': 'scale-down-delay-after-failure', 'type': 'str'}, - 'scale_down_unneeded_time': {'key': 'scale-down-unneeded-time', 'type': 'str'}, - 'scale_down_unready_time': {'key': 'scale-down-unready-time', 'type': 'str'}, - 'scale_down_utilization_threshold': {'key': 'scale-down-utilization-threshold', 'type': 'str'}, - 'skip_nodes_with_local_storage': {'key': 'skip-nodes-with-local-storage', 'type': 'str'}, - 'skip_nodes_with_system_pods': {'key': 'skip-nodes-with-system-pods', 'type': 'str'}, + "balance_similar_node_groups": {"key": "balance-similar-node-groups", "type": "str"}, + "expander": {"key": "expander", "type": "str"}, + "max_empty_bulk_delete": {"key": "max-empty-bulk-delete", "type": "str"}, + "max_graceful_termination_sec": {"key": "max-graceful-termination-sec", "type": "str"}, + "max_node_provision_time": {"key": "max-node-provision-time", "type": "str"}, + "max_total_unready_percentage": {"key": "max-total-unready-percentage", "type": "str"}, + "new_pod_scale_up_delay": {"key": "new-pod-scale-up-delay", "type": "str"}, + "ok_total_unready_count": {"key": "ok-total-unready-count", "type": "str"}, + "scan_interval": {"key": "scan-interval", "type": "str"}, + "scale_down_delay_after_add": {"key": "scale-down-delay-after-add", "type": "str"}, + "scale_down_delay_after_delete": {"key": "scale-down-delay-after-delete", "type": "str"}, + "scale_down_delay_after_failure": {"key": "scale-down-delay-after-failure", "type": "str"}, + "scale_down_unneeded_time": {"key": "scale-down-unneeded-time", "type": "str"}, + "scale_down_unready_time": {"key": "scale-down-unready-time", "type": "str"}, + "scale_down_utilization_threshold": {"key": "scale-down-utilization-threshold", "type": "str"}, + "skip_nodes_with_local_storage": {"key": "skip-nodes-with-local-storage", "type": "str"}, + "skip_nodes_with_system_pods": {"key": "skip-nodes-with-system-pods", "type": "str"}, } def __init__( @@ -4407,7 +4328,7 @@ def __init__( :paramtype balance_similar_node_groups: str :keyword expander: If not specified, the default is 'random'. See `expanders `_ - for more information. Known values are: "least-waste", "most-pods", "priority", "random". + for more information. Known values are: "least-waste", "most-pods", "priority", and "random". :paramtype expander: str or ~azure.mgmt.containerservice.v2022_06_01.models.Expander :keyword max_empty_bulk_delete: The default is 10. :paramtype max_empty_bulk_delete: str @@ -4450,7 +4371,7 @@ def __init__( :keyword skip_nodes_with_system_pods: The default is true. :paramtype skip_nodes_with_system_pods: str """ - super(ManagedClusterPropertiesAutoScalerProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.balance_similar_node_groups = balance_similar_node_groups self.expander = expander self.max_empty_bulk_delete = max_empty_bulk_delete @@ -4470,7 +4391,7 @@ def __init__( self.skip_nodes_with_system_pods = skip_nodes_with_system_pods -class ManagedClusterSecurityProfile(msrest.serialization.Model): +class ManagedClusterSecurityProfile(_serialization.Model): """Security profile for the container service cluster. :ivar defender: Microsoft Defender settings for the security profile. @@ -4483,8 +4404,8 @@ class ManagedClusterSecurityProfile(msrest.serialization.Model): """ _attribute_map = { - 'defender': {'key': 'defender', 'type': 'ManagedClusterSecurityProfileDefender'}, - 'azure_key_vault_kms': {'key': 'azureKeyVaultKms', 'type': 'AzureKeyVaultKms'}, + "defender": {"key": "defender", "type": "ManagedClusterSecurityProfileDefender"}, + "azure_key_vault_kms": {"key": "azureKeyVaultKms", "type": "AzureKeyVaultKms"}, } def __init__( @@ -4504,12 +4425,12 @@ def __init__( :paramtype azure_key_vault_kms: ~azure.mgmt.containerservice.v2022_06_01.models.AzureKeyVaultKms """ - super(ManagedClusterSecurityProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.defender = defender self.azure_key_vault_kms = azure_key_vault_kms -class ManagedClusterSecurityProfileDefender(msrest.serialization.Model): +class ManagedClusterSecurityProfileDefender(_serialization.Model): """Microsoft Defender settings for the security profile. :ivar log_analytics_workspace_resource_id: Resource ID of the Log Analytics workspace to be @@ -4524,8 +4445,11 @@ class ManagedClusterSecurityProfileDefender(msrest.serialization.Model): """ _attribute_map = { - 'log_analytics_workspace_resource_id': {'key': 'logAnalyticsWorkspaceResourceId', 'type': 'str'}, - 'security_monitoring': {'key': 'securityMonitoring', 'type': 'ManagedClusterSecurityProfileDefenderSecurityMonitoring'}, + "log_analytics_workspace_resource_id": {"key": "logAnalyticsWorkspaceResourceId", "type": "str"}, + "security_monitoring": { + "key": "securityMonitoring", + "type": "ManagedClusterSecurityProfileDefenderSecurityMonitoring", + }, } def __init__( @@ -4546,12 +4470,12 @@ def __init__( :paramtype security_monitoring: ~azure.mgmt.containerservice.v2022_06_01.models.ManagedClusterSecurityProfileDefenderSecurityMonitoring """ - super(ManagedClusterSecurityProfileDefender, self).__init__(**kwargs) + super().__init__(**kwargs) self.log_analytics_workspace_resource_id = log_analytics_workspace_resource_id self.security_monitoring = security_monitoring -class ManagedClusterSecurityProfileDefenderSecurityMonitoring(msrest.serialization.Model): +class ManagedClusterSecurityProfileDefenderSecurityMonitoring(_serialization.Model): """Microsoft Defender settings for the security profile threat detection. :ivar enabled: Whether to enable Defender threat detection. @@ -4559,75 +4483,64 @@ class ManagedClusterSecurityProfileDefenderSecurityMonitoring(msrest.serializati """ _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, + "enabled": {"key": "enabled", "type": "bool"}, } - def __init__( - self, - *, - enabled: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, enabled: Optional[bool] = None, **kwargs): """ :keyword enabled: Whether to enable Defender threat detection. :paramtype enabled: bool """ - super(ManagedClusterSecurityProfileDefenderSecurityMonitoring, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled -class ManagedClusterServicePrincipalProfile(msrest.serialization.Model): +class ManagedClusterServicePrincipalProfile(_serialization.Model): """Information about a service principal identity for the cluster to use for manipulating Azure APIs. All required parameters must be populated in order to send to Azure. - :ivar client_id: Required. The ID for the service principal. + :ivar client_id: The ID for the service principal. Required. :vartype client_id: str :ivar secret: The secret password associated with the service principal in plain text. :vartype secret: str """ _validation = { - 'client_id': {'required': True}, + "client_id": {"required": True}, } _attribute_map = { - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'secret': {'key': 'secret', 'type': 'str'}, + "client_id": {"key": "clientId", "type": "str"}, + "secret": {"key": "secret", "type": "str"}, } - def __init__( - self, - *, - client_id: str, - secret: Optional[str] = None, - **kwargs - ): + def __init__(self, *, client_id: str, secret: Optional[str] = None, **kwargs): """ - :keyword client_id: Required. The ID for the service principal. + :keyword client_id: The ID for the service principal. Required. :paramtype client_id: str :keyword secret: The secret password associated with the service principal in plain text. :paramtype secret: str """ - super(ManagedClusterServicePrincipalProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.client_id = client_id self.secret = secret -class ManagedClusterSKU(msrest.serialization.Model): +class ManagedClusterSKU(_serialization.Model): """The SKU of a Managed Cluster. - :ivar name: The name of a managed cluster SKU. Known values are: "Basic". + :ivar name: The name of a managed cluster SKU. "Basic" :vartype name: str or ~azure.mgmt.containerservice.v2022_06_01.models.ManagedClusterSKUName :ivar tier: If not specified, the default is 'Free'. See `uptime SLA - `_ for more details. Known values are: "Paid", - "Free". + `_ for more details. Known values are: "Paid" + and "Free". :vartype tier: str or ~azure.mgmt.containerservice.v2022_06_01.models.ManagedClusterSKUTier """ _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, + "name": {"key": "name", "type": "str"}, + "tier": {"key": "tier", "type": "str"}, } def __init__( @@ -4638,19 +4551,19 @@ def __init__( **kwargs ): """ - :keyword name: The name of a managed cluster SKU. Known values are: "Basic". + :keyword name: The name of a managed cluster SKU. "Basic" :paramtype name: str or ~azure.mgmt.containerservice.v2022_06_01.models.ManagedClusterSKUName :keyword tier: If not specified, the default is 'Free'. See `uptime SLA - `_ for more details. Known values are: "Paid", - "Free". + `_ for more details. Known values are: "Paid" + and "Free". :paramtype tier: str or ~azure.mgmt.containerservice.v2022_06_01.models.ManagedClusterSKUTier """ - super(ManagedClusterSKU, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.tier = tier -class ManagedClusterStorageProfile(msrest.serialization.Model): +class ManagedClusterStorageProfile(_serialization.Model): """Storage profile for the container service cluster. :ivar disk_csi_driver: AzureDisk CSI Driver settings for the storage profile. @@ -4665,9 +4578,9 @@ class ManagedClusterStorageProfile(msrest.serialization.Model): """ _attribute_map = { - 'disk_csi_driver': {'key': 'diskCSIDriver', 'type': 'ManagedClusterStorageProfileDiskCSIDriver'}, - 'file_csi_driver': {'key': 'fileCSIDriver', 'type': 'ManagedClusterStorageProfileFileCSIDriver'}, - 'snapshot_controller': {'key': 'snapshotController', 'type': 'ManagedClusterStorageProfileSnapshotController'}, + "disk_csi_driver": {"key": "diskCSIDriver", "type": "ManagedClusterStorageProfileDiskCSIDriver"}, + "file_csi_driver": {"key": "fileCSIDriver", "type": "ManagedClusterStorageProfileFileCSIDriver"}, + "snapshot_controller": {"key": "snapshotController", "type": "ManagedClusterStorageProfileSnapshotController"}, } def __init__( @@ -4689,13 +4602,13 @@ def __init__( :paramtype snapshot_controller: ~azure.mgmt.containerservice.v2022_06_01.models.ManagedClusterStorageProfileSnapshotController """ - super(ManagedClusterStorageProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.disk_csi_driver = disk_csi_driver self.file_csi_driver = file_csi_driver self.snapshot_controller = snapshot_controller -class ManagedClusterStorageProfileDiskCSIDriver(msrest.serialization.Model): +class ManagedClusterStorageProfileDiskCSIDriver(_serialization.Model): """AzureDisk CSI Driver settings for the storage profile. :ivar enabled: Whether to enable AzureDisk CSI Driver. The default value is true. @@ -4703,24 +4616,19 @@ class ManagedClusterStorageProfileDiskCSIDriver(msrest.serialization.Model): """ _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, + "enabled": {"key": "enabled", "type": "bool"}, } - def __init__( - self, - *, - enabled: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, enabled: Optional[bool] = None, **kwargs): """ :keyword enabled: Whether to enable AzureDisk CSI Driver. The default value is true. :paramtype enabled: bool """ - super(ManagedClusterStorageProfileDiskCSIDriver, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled -class ManagedClusterStorageProfileFileCSIDriver(msrest.serialization.Model): +class ManagedClusterStorageProfileFileCSIDriver(_serialization.Model): """AzureFile CSI Driver settings for the storage profile. :ivar enabled: Whether to enable AzureFile CSI Driver. The default value is true. @@ -4728,24 +4636,19 @@ class ManagedClusterStorageProfileFileCSIDriver(msrest.serialization.Model): """ _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, + "enabled": {"key": "enabled", "type": "bool"}, } - def __init__( - self, - *, - enabled: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, enabled: Optional[bool] = None, **kwargs): """ :keyword enabled: Whether to enable AzureFile CSI Driver. The default value is true. :paramtype enabled: bool """ - super(ManagedClusterStorageProfileFileCSIDriver, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled -class ManagedClusterStorageProfileSnapshotController(msrest.serialization.Model): +class ManagedClusterStorageProfileSnapshotController(_serialization.Model): """Snapshot Controller settings for the storage profile. :ivar enabled: Whether to enable Snapshot Controller. The default value is true. @@ -4753,24 +4656,19 @@ class ManagedClusterStorageProfileSnapshotController(msrest.serialization.Model) """ _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, + "enabled": {"key": "enabled", "type": "bool"}, } - def __init__( - self, - *, - enabled: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, enabled: Optional[bool] = None, **kwargs): """ :keyword enabled: Whether to enable Snapshot Controller. The default value is true. :paramtype enabled: bool """ - super(ManagedClusterStorageProfileSnapshotController, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled -class ManagedClusterUpgradeProfile(msrest.serialization.Model): +class ManagedClusterUpgradeProfile(_serialization.Model): """The list of available upgrades for compute pools. Variables are only populated by the server, and will be ignored when sending a request. @@ -4783,29 +4681,29 @@ class ManagedClusterUpgradeProfile(msrest.serialization.Model): :vartype name: str :ivar type: The type of the upgrade profile. :vartype type: str - :ivar control_plane_profile: Required. The list of available upgrade versions for the control - plane. + :ivar control_plane_profile: The list of available upgrade versions for the control plane. + Required. :vartype control_plane_profile: ~azure.mgmt.containerservice.v2022_06_01.models.ManagedClusterPoolUpgradeProfile - :ivar agent_pool_profiles: Required. The list of available upgrade versions for agent pools. + :ivar agent_pool_profiles: The list of available upgrade versions for agent pools. Required. :vartype agent_pool_profiles: list[~azure.mgmt.containerservice.v2022_06_01.models.ManagedClusterPoolUpgradeProfile] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'control_plane_profile': {'required': True}, - 'agent_pool_profiles': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "control_plane_profile": {"required": True}, + "agent_pool_profiles": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'control_plane_profile': {'key': 'properties.controlPlaneProfile', 'type': 'ManagedClusterPoolUpgradeProfile'}, - 'agent_pool_profiles': {'key': 'properties.agentPoolProfiles', 'type': '[ManagedClusterPoolUpgradeProfile]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "control_plane_profile": {"key": "properties.controlPlaneProfile", "type": "ManagedClusterPoolUpgradeProfile"}, + "agent_pool_profiles": {"key": "properties.agentPoolProfiles", "type": "[ManagedClusterPoolUpgradeProfile]"}, } def __init__( @@ -4816,15 +4714,15 @@ def __init__( **kwargs ): """ - :keyword control_plane_profile: Required. The list of available upgrade versions for the - control plane. + :keyword control_plane_profile: The list of available upgrade versions for the control plane. + Required. :paramtype control_plane_profile: ~azure.mgmt.containerservice.v2022_06_01.models.ManagedClusterPoolUpgradeProfile - :keyword agent_pool_profiles: Required. The list of available upgrade versions for agent pools. + :keyword agent_pool_profiles: The list of available upgrade versions for agent pools. Required. :paramtype agent_pool_profiles: list[~azure.mgmt.containerservice.v2022_06_01.models.ManagedClusterPoolUpgradeProfile] """ - super(ManagedClusterUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -4832,18 +4730,18 @@ def __init__( self.agent_pool_profiles = agent_pool_profiles -class ManagedClusterWindowsProfile(msrest.serialization.Model): +class ManagedClusterWindowsProfile(_serialization.Model): """Profile for Windows VMs in the managed cluster. All required parameters must be populated in order to send to Azure. - :ivar admin_username: Required. Specifies the name of the administrator account. - :code:`
`:code:`
` **Restriction:** Cannot end in "." :code:`
`:code:`
` - **Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", "test1", - "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", - "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", - "sys", "test2", "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 - character :code:`
`:code:`
` **Max-length:** 20 characters. + :ivar admin_username: Specifies the name of the administrator account. :code:`
`:code:`
` + **Restriction:** Cannot end in "." :code:`
`:code:`
` **Disallowed values:** + "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", + "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", + "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", + "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 character + :code:`
`:code:`
` **Max-length:** 20 characters. Required. :vartype admin_username: str :ivar admin_password: Specifies the password of the administrator account. :code:`
`:code:`
` **Minimum-length:** 8 characters :code:`
`:code:`
` @@ -4855,7 +4753,7 @@ class ManagedClusterWindowsProfile(msrest.serialization.Model): :vartype admin_password: str :ivar license_type: The license type to use for Windows VMs. See `Azure Hybrid User Benefits `_ for more details. Known values are: - "None", "Windows_Server". + "None" and "Windows_Server". :vartype license_type: str or ~azure.mgmt.containerservice.v2022_06_01.models.LicenseType :ivar enable_csi_proxy: For more details on CSI proxy, see the `CSI proxy GitHub repo `_. @@ -4865,15 +4763,15 @@ class ManagedClusterWindowsProfile(msrest.serialization.Model): """ _validation = { - 'admin_username': {'required': True}, + "admin_username": {"required": True}, } _attribute_map = { - 'admin_username': {'key': 'adminUsername', 'type': 'str'}, - 'admin_password': {'key': 'adminPassword', 'type': 'str'}, - 'license_type': {'key': 'licenseType', 'type': 'str'}, - 'enable_csi_proxy': {'key': 'enableCSIProxy', 'type': 'bool'}, - 'gmsa_profile': {'key': 'gmsaProfile', 'type': 'WindowsGmsaProfile'}, + "admin_username": {"key": "adminUsername", "type": "str"}, + "admin_password": {"key": "adminPassword", "type": "str"}, + "license_type": {"key": "licenseType", "type": "str"}, + "enable_csi_proxy": {"key": "enableCSIProxy", "type": "bool"}, + "gmsa_profile": {"key": "gmsaProfile", "type": "WindowsGmsaProfile"}, } def __init__( @@ -4887,13 +4785,13 @@ def __init__( **kwargs ): """ - :keyword admin_username: Required. Specifies the name of the administrator account. + :keyword admin_username: Specifies the name of the administrator account. :code:`
`:code:`
` **Restriction:** Cannot end in "." :code:`
`:code:`
` **Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 - character :code:`
`:code:`
` **Max-length:** 20 characters. + character :code:`
`:code:`
` **Max-length:** 20 characters. Required. :paramtype admin_username: str :keyword admin_password: Specifies the password of the administrator account. :code:`
`:code:`
` **Minimum-length:** 8 characters :code:`
`:code:`
` @@ -4905,7 +4803,7 @@ def __init__( :paramtype admin_password: str :keyword license_type: The license type to use for Windows VMs. See `Azure Hybrid User Benefits `_ for more details. Known values are: - "None", "Windows_Server". + "None" and "Windows_Server". :paramtype license_type: str or ~azure.mgmt.containerservice.v2022_06_01.models.LicenseType :keyword enable_csi_proxy: For more details on CSI proxy, see the `CSI proxy GitHub repo `_. @@ -4913,7 +4811,7 @@ def __init__( :keyword gmsa_profile: The Windows gMSA Profile in the Managed Cluster. :paramtype gmsa_profile: ~azure.mgmt.containerservice.v2022_06_01.models.WindowsGmsaProfile """ - super(ManagedClusterWindowsProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.admin_username = admin_username self.admin_password = admin_password self.license_type = license_type @@ -4921,7 +4819,7 @@ def __init__( self.gmsa_profile = gmsa_profile -class ManagedServiceIdentityUserAssignedIdentitiesValue(msrest.serialization.Model): +class ManagedServiceIdentityUserAssignedIdentitiesValue(_serialization.Model): """ManagedServiceIdentityUserAssignedIdentitiesValue. Variables are only populated by the server, and will be ignored when sending a request. @@ -4933,27 +4831,23 @@ class ManagedServiceIdentityUserAssignedIdentitiesValue(msrest.serialization.Mod """ _validation = { - 'principal_id': {'readonly': True}, - 'client_id': {'readonly': True}, + "principal_id": {"readonly": True}, + "client_id": {"readonly": True}, } _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, + "principal_id": {"key": "principalId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(ManagedServiceIdentityUserAssignedIdentitiesValue, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.principal_id = None self.client_id = None -class OperationListResult(msrest.serialization.Model): +class OperationListResult(_serialization.Model): """The List Operation response. Variables are only populated by the server, and will be ignored when sending a request. @@ -4963,24 +4857,20 @@ class OperationListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[OperationValue]'}, + "value": {"key": "value", "type": "[OperationValue]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(OperationListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None -class OperationValue(msrest.serialization.Model): +class OperationValue(_serialization.Model): """Describes the properties of a Operation value. Variables are only populated by the server, and will be ignored when sending a request. @@ -5000,30 +4890,26 @@ class OperationValue(msrest.serialization.Model): """ _validation = { - 'origin': {'readonly': True}, - 'name': {'readonly': True}, - 'operation': {'readonly': True}, - 'resource': {'readonly': True}, - 'description': {'readonly': True}, - 'provider': {'readonly': True}, + "origin": {"readonly": True}, + "name": {"readonly": True}, + "operation": {"readonly": True}, + "resource": {"readonly": True}, + "description": {"readonly": True}, + "provider": {"readonly": True}, } _attribute_map = { - 'origin': {'key': 'origin', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'operation': {'key': 'display.operation', 'type': 'str'}, - 'resource': {'key': 'display.resource', 'type': 'str'}, - 'description': {'key': 'display.description', 'type': 'str'}, - 'provider': {'key': 'display.provider', 'type': 'str'}, + "origin": {"key": "origin", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "operation": {"key": "display.operation", "type": "str"}, + "resource": {"key": "display.resource", "type": "str"}, + "description": {"key": "display.description", "type": "str"}, + "provider": {"key": "display.provider", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(OperationValue, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.origin = None self.name = None self.operation = None @@ -5032,7 +4918,7 @@ def __init__( self.provider = None -class OSOptionProfile(msrest.serialization.Model): +class OSOptionProfile(_serialization.Model): """The OS option profile. Variables are only populated by the server, and will be ignored when sending a request. @@ -5045,83 +4931,72 @@ class OSOptionProfile(msrest.serialization.Model): :vartype name: str :ivar type: The type of the OS option resource. :vartype type: str - :ivar os_option_property_list: Required. The list of OS options. + :ivar os_option_property_list: The list of OS options. Required. :vartype os_option_property_list: list[~azure.mgmt.containerservice.v2022_06_01.models.OSOptionProperty] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'os_option_property_list': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "os_option_property_list": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'os_option_property_list': {'key': 'properties.osOptionPropertyList', 'type': '[OSOptionProperty]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "os_option_property_list": {"key": "properties.osOptionPropertyList", "type": "[OSOptionProperty]"}, } - def __init__( - self, - *, - os_option_property_list: List["_models.OSOptionProperty"], - **kwargs - ): + def __init__(self, *, os_option_property_list: List["_models.OSOptionProperty"], **kwargs): """ - :keyword os_option_property_list: Required. The list of OS options. + :keyword os_option_property_list: The list of OS options. Required. :paramtype os_option_property_list: list[~azure.mgmt.containerservice.v2022_06_01.models.OSOptionProperty] """ - super(OSOptionProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None self.os_option_property_list = os_option_property_list -class OSOptionProperty(msrest.serialization.Model): +class OSOptionProperty(_serialization.Model): """OS option property. All required parameters must be populated in order to send to Azure. - :ivar os_type: Required. The OS type. + :ivar os_type: The OS type. Required. :vartype os_type: str - :ivar enable_fips_image: Required. Whether the image is FIPS-enabled. + :ivar enable_fips_image: Whether the image is FIPS-enabled. Required. :vartype enable_fips_image: bool """ _validation = { - 'os_type': {'required': True}, - 'enable_fips_image': {'required': True}, + "os_type": {"required": True}, + "enable_fips_image": {"required": True}, } _attribute_map = { - 'os_type': {'key': 'os-type', 'type': 'str'}, - 'enable_fips_image': {'key': 'enable-fips-image', 'type': 'bool'}, + "os_type": {"key": "os-type", "type": "str"}, + "enable_fips_image": {"key": "enable-fips-image", "type": "bool"}, } - def __init__( - self, - *, - os_type: str, - enable_fips_image: bool, - **kwargs - ): + def __init__(self, *, os_type: str, enable_fips_image: bool, **kwargs): """ - :keyword os_type: Required. The OS type. + :keyword os_type: The OS type. Required. :paramtype os_type: str - :keyword enable_fips_image: Required. Whether the image is FIPS-enabled. + :keyword enable_fips_image: Whether the image is FIPS-enabled. Required. :paramtype enable_fips_image: bool """ - super(OSOptionProperty, self).__init__(**kwargs) + super().__init__(**kwargs) self.os_type = os_type self.enable_fips_image = enable_fips_image -class OutboundEnvironmentEndpoint(msrest.serialization.Model): +class OutboundEnvironmentEndpoint(_serialization.Model): """Egress endpoints which AKS agent nodes connect to for common purpose. :ivar category: The category of endpoints accessed by the AKS agent node, e.g. @@ -5132,8 +5007,8 @@ class OutboundEnvironmentEndpoint(msrest.serialization.Model): """ _attribute_map = { - 'category': {'key': 'category', 'type': 'str'}, - 'endpoints': {'key': 'endpoints', 'type': '[EndpointDependency]'}, + "category": {"key": "category", "type": "str"}, + "endpoints": {"key": "endpoints", "type": "[EndpointDependency]"}, } def __init__( @@ -5150,19 +5025,19 @@ def __init__( :keyword endpoints: The endpoints that AKS agent nodes connect to. :paramtype endpoints: list[~azure.mgmt.containerservice.v2022_06_01.models.EndpointDependency] """ - super(OutboundEnvironmentEndpoint, self).__init__(**kwargs) + super().__init__(**kwargs) self.category = category self.endpoints = endpoints -class OutboundEnvironmentEndpointCollection(msrest.serialization.Model): +class OutboundEnvironmentEndpointCollection(_serialization.Model): """Collection of OutboundEnvironmentEndpoint. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar value: Required. Collection of resources. + :ivar value: Collection of resources. Required. :vartype value: list[~azure.mgmt.containerservice.v2022_06_01.models.OutboundEnvironmentEndpoint] :ivar next_link: Link to next page of resources. @@ -5170,59 +5045,49 @@ class OutboundEnvironmentEndpointCollection(msrest.serialization.Model): """ _validation = { - 'value': {'required': True}, - 'next_link': {'readonly': True}, + "value": {"required": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[OutboundEnvironmentEndpoint]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[OutboundEnvironmentEndpoint]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: List["_models.OutboundEnvironmentEndpoint"], - **kwargs - ): + def __init__(self, *, value: List["_models.OutboundEnvironmentEndpoint"], **kwargs): """ - :keyword value: Required. Collection of resources. + :keyword value: Collection of resources. Required. :paramtype value: list[~azure.mgmt.containerservice.v2022_06_01.models.OutboundEnvironmentEndpoint] """ - super(OutboundEnvironmentEndpointCollection, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class PowerState(msrest.serialization.Model): +class PowerState(_serialization.Model): """Describes the Power State of the cluster. - :ivar code: Tells whether the cluster is Running or Stopped. Known values are: "Running", + :ivar code: Tells whether the cluster is Running or Stopped. Known values are: "Running" and "Stopped". :vartype code: str or ~azure.mgmt.containerservice.v2022_06_01.models.Code """ _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, + "code": {"key": "code", "type": "str"}, } - def __init__( - self, - *, - code: Optional[Union[str, "_models.Code"]] = None, - **kwargs - ): + def __init__(self, *, code: Optional[Union[str, "_models.Code"]] = None, **kwargs): """ - :keyword code: Tells whether the cluster is Running or Stopped. Known values are: "Running", + :keyword code: Tells whether the cluster is Running or Stopped. Known values are: "Running" and "Stopped". :paramtype code: str or ~azure.mgmt.containerservice.v2022_06_01.models.Code """ - super(PowerState, self).__init__(**kwargs) + super().__init__(**kwargs) self.code = code -class PrivateEndpoint(msrest.serialization.Model): +class PrivateEndpoint(_serialization.Model): """Private endpoint which a connection belongs to. :ivar id: The resource ID of the private endpoint. @@ -5230,24 +5095,19 @@ class PrivateEndpoint(msrest.serialization.Model): """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, } - def __init__( - self, - *, - id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin """ :keyword id: The resource ID of the private endpoint. :paramtype id: str """ - super(PrivateEndpoint, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id -class PrivateEndpointConnection(msrest.serialization.Model): +class PrivateEndpointConnection(_serialization.Model): """A private endpoint connection. Variables are only populated by the server, and will be ignored when sending a request. @@ -5259,7 +5119,7 @@ class PrivateEndpointConnection(msrest.serialization.Model): :ivar type: The resource type. :vartype type: str :ivar provisioning_state: The current provisioning state. Known values are: "Succeeded", - "Creating", "Deleting", "Failed". + "Creating", "Deleting", and "Failed". :vartype provisioning_state: str or ~azure.mgmt.containerservice.v2022_06_01.models.PrivateEndpointConnectionProvisioningState :ivar private_endpoint: The resource of private endpoint. @@ -5271,19 +5131,22 @@ class PrivateEndpointConnection(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'provisioning_state': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, - 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "private_endpoint": {"key": "properties.privateEndpoint", "type": "PrivateEndpoint"}, + "private_link_service_connection_state": { + "key": "properties.privateLinkServiceConnectionState", + "type": "PrivateLinkServiceConnectionState", + }, } def __init__( @@ -5301,7 +5164,7 @@ def __init__( :paramtype private_link_service_connection_state: ~azure.mgmt.containerservice.v2022_06_01.models.PrivateLinkServiceConnectionState """ - super(PrivateEndpointConnection, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -5310,7 +5173,7 @@ def __init__( self.private_link_service_connection_state = private_link_service_connection_state -class PrivateEndpointConnectionListResult(msrest.serialization.Model): +class PrivateEndpointConnectionListResult(_serialization.Model): """A list of private endpoint connections. :ivar value: The collection value. @@ -5318,25 +5181,20 @@ class PrivateEndpointConnectionListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, + "value": {"key": "value", "type": "[PrivateEndpointConnection]"}, } - def __init__( - self, - *, - value: Optional[List["_models.PrivateEndpointConnection"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.PrivateEndpointConnection"]] = None, **kwargs): """ :keyword value: The collection value. :paramtype value: list[~azure.mgmt.containerservice.v2022_06_01.models.PrivateEndpointConnection] """ - super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value -class PrivateLinkResource(msrest.serialization.Model): +class PrivateLinkResource(_serialization.Model): """A private link resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -5357,22 +5215,22 @@ class PrivateLinkResource(msrest.serialization.Model): """ _validation = { - 'private_link_service_id': {'readonly': True}, + "private_link_service_id": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'group_id': {'key': 'groupId', 'type': 'str'}, - 'required_members': {'key': 'requiredMembers', 'type': '[str]'}, - 'private_link_service_id': {'key': 'privateLinkServiceID', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "group_id": {"key": "groupId", "type": "str"}, + "required_members": {"key": "requiredMembers", "type": "[str]"}, + "private_link_service_id": {"key": "privateLinkServiceID", "type": "str"}, } def __init__( self, *, - id: Optional[str] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin name: Optional[str] = None, type: Optional[str] = None, group_id: Optional[str] = None, @@ -5391,7 +5249,7 @@ def __init__( :keyword required_members: The RequiredMembers of the resource. :paramtype required_members: list[str] """ - super(PrivateLinkResource, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id self.name = name self.type = type @@ -5400,7 +5258,7 @@ def __init__( self.private_link_service_id = None -class PrivateLinkResourcesListResult(msrest.serialization.Model): +class PrivateLinkResourcesListResult(_serialization.Model): """A list of private link resources. :ivar value: The collection value. @@ -5408,36 +5266,31 @@ class PrivateLinkResourcesListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, + "value": {"key": "value", "type": "[PrivateLinkResource]"}, } - def __init__( - self, - *, - value: Optional[List["_models.PrivateLinkResource"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.PrivateLinkResource"]] = None, **kwargs): """ :keyword value: The collection value. :paramtype value: list[~azure.mgmt.containerservice.v2022_06_01.models.PrivateLinkResource] """ - super(PrivateLinkResourcesListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value -class PrivateLinkServiceConnectionState(msrest.serialization.Model): +class PrivateLinkServiceConnectionState(_serialization.Model): """The state of a private link service connection. :ivar status: The private link service connection status. Known values are: "Pending", - "Approved", "Rejected", "Disconnected". + "Approved", "Rejected", and "Disconnected". :vartype status: str or ~azure.mgmt.containerservice.v2022_06_01.models.ConnectionStatus :ivar description: The private link service connection description. :vartype description: str """ _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, + "status": {"key": "status", "type": "str"}, + "description": {"key": "description", "type": "str"}, } def __init__( @@ -5449,17 +5302,17 @@ def __init__( ): """ :keyword status: The private link service connection status. Known values are: "Pending", - "Approved", "Rejected", "Disconnected". + "Approved", "Rejected", and "Disconnected". :paramtype status: str or ~azure.mgmt.containerservice.v2022_06_01.models.ConnectionStatus :keyword description: The private link service connection description. :paramtype description: str """ - super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) + super().__init__(**kwargs) self.status = status self.description = description -class ResourceReference(msrest.serialization.Model): +class ResourceReference(_serialization.Model): """A reference to an Azure resource. :ivar id: The fully qualified Azure resource id. @@ -5467,29 +5320,24 @@ class ResourceReference(msrest.serialization.Model): """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, } - def __init__( - self, - *, - id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin """ :keyword id: The fully qualified Azure resource id. :paramtype id: str """ - super(ResourceReference, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id -class RunCommandRequest(msrest.serialization.Model): +class RunCommandRequest(_serialization.Model): """A run command request. All required parameters must be populated in order to send to Azure. - :ivar command: Required. The command to run. + :ivar command: The command to run. Required. :vartype command: str :ivar context: A base64 encoded zip file containing the files required by the command. :vartype context: str @@ -5498,38 +5346,31 @@ class RunCommandRequest(msrest.serialization.Model): """ _validation = { - 'command': {'required': True}, + "command": {"required": True}, } _attribute_map = { - 'command': {'key': 'command', 'type': 'str'}, - 'context': {'key': 'context', 'type': 'str'}, - 'cluster_token': {'key': 'clusterToken', 'type': 'str'}, + "command": {"key": "command", "type": "str"}, + "context": {"key": "context", "type": "str"}, + "cluster_token": {"key": "clusterToken", "type": "str"}, } - def __init__( - self, - *, - command: str, - context: Optional[str] = None, - cluster_token: Optional[str] = None, - **kwargs - ): + def __init__(self, *, command: str, context: Optional[str] = None, cluster_token: Optional[str] = None, **kwargs): """ - :keyword command: Required. The command to run. + :keyword command: The command to run. Required. :paramtype command: str :keyword context: A base64 encoded zip file containing the files required by the command. :paramtype context: str :keyword cluster_token: AuthToken issued for AKS AAD Server App. :paramtype cluster_token: str """ - super(RunCommandRequest, self).__init__(**kwargs) + super().__init__(**kwargs) self.command = command self.context = context self.cluster_token = cluster_token -class RunCommandResult(msrest.serialization.Model): +class RunCommandResult(_serialization.Model): """run command result. Variables are only populated by the server, and will be ignored when sending a request. @@ -5551,32 +5392,28 @@ class RunCommandResult(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'exit_code': {'readonly': True}, - 'started_at': {'readonly': True}, - 'finished_at': {'readonly': True}, - 'logs': {'readonly': True}, - 'reason': {'readonly': True}, + "id": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "exit_code": {"readonly": True}, + "started_at": {"readonly": True}, + "finished_at": {"readonly": True}, + "logs": {"readonly": True}, + "reason": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'exit_code': {'key': 'properties.exitCode', 'type': 'int'}, - 'started_at': {'key': 'properties.startedAt', 'type': 'iso-8601'}, - 'finished_at': {'key': 'properties.finishedAt', 'type': 'iso-8601'}, - 'logs': {'key': 'properties.logs', 'type': 'str'}, - 'reason': {'key': 'properties.reason', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(RunCommandResult, self).__init__(**kwargs) + "id": {"key": "id", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "exit_code": {"key": "properties.exitCode", "type": "int"}, + "started_at": {"key": "properties.startedAt", "type": "iso-8601"}, + "finished_at": {"key": "properties.finishedAt", "type": "iso-8601"}, + "logs": {"key": "properties.logs", "type": "str"}, + "reason": {"key": "properties.reason", "type": "str"}, + } + + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.id = None self.provisioning_state = None self.exit_code = None @@ -5586,7 +5423,7 @@ def __init__( self.reason = None -class Snapshot(TrackedResource): +class Snapshot(TrackedResource): # pylint: disable=too-many-instance-attributes """A node pool snapshot resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -5604,25 +5441,24 @@ class Snapshot(TrackedResource): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.containerservice.v2022_06_01.models.SystemData - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] - :ivar location: Required. The geo-location where the resource lives. + :ivar location: The geo-location where the resource lives. Required. :vartype location: str :ivar creation_data: CreationData to be used to specify the source agent pool resource ID to create this snapshot. :vartype creation_data: ~azure.mgmt.containerservice.v2022_06_01.models.CreationData - :ivar snapshot_type: The type of a snapshot. The default is NodePool. Known values are: - "NodePool". Default value: "NodePool". + :ivar snapshot_type: The type of a snapshot. The default is NodePool. "NodePool" :vartype snapshot_type: str or ~azure.mgmt.containerservice.v2022_06_01.models.SnapshotType :ivar kubernetes_version: The version of Kubernetes. :vartype kubernetes_version: str :ivar node_image_version: The version of node image. :vartype node_image_version: str - :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_06_01.models.OSType :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known - values are: "Ubuntu", "CBLMariner". + values are: "Ubuntu" and "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2022_06_01.models.OSSKU :ivar vm_size: The size of the VM. :vartype vm_size: str @@ -5631,34 +5467,34 @@ class Snapshot(TrackedResource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'location': {'required': True}, - 'kubernetes_version': {'readonly': True}, - 'node_image_version': {'readonly': True}, - 'os_type': {'readonly': True}, - 'os_sku': {'readonly': True}, - 'vm_size': {'readonly': True}, - 'enable_fips': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, + "kubernetes_version": {"readonly": True}, + "node_image_version": {"readonly": True}, + "os_type": {"readonly": True}, + "os_sku": {"readonly": True}, + "vm_size": {"readonly": True}, + "enable_fips": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - 'creation_data': {'key': 'properties.creationData', 'type': 'CreationData'}, - 'snapshot_type': {'key': 'properties.snapshotType', 'type': 'str'}, - 'kubernetes_version': {'key': 'properties.kubernetesVersion', 'type': 'str'}, - 'node_image_version': {'key': 'properties.nodeImageVersion', 'type': 'str'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'os_sku': {'key': 'properties.osSku', 'type': 'str'}, - 'vm_size': {'key': 'properties.vmSize', 'type': 'str'}, - 'enable_fips': {'key': 'properties.enableFIPS', 'type': 'bool'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "creation_data": {"key": "properties.creationData", "type": "CreationData"}, + "snapshot_type": {"key": "properties.snapshotType", "type": "str"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "node_image_version": {"key": "properties.nodeImageVersion", "type": "str"}, + "os_type": {"key": "properties.osType", "type": "str"}, + "os_sku": {"key": "properties.osSku", "type": "str"}, + "vm_size": {"key": "properties.vmSize", "type": "str"}, + "enable_fips": {"key": "properties.enableFIPS", "type": "bool"}, } def __init__( @@ -5667,22 +5503,21 @@ def __init__( location: str, tags: Optional[Dict[str, str]] = None, creation_data: Optional["_models.CreationData"] = None, - snapshot_type: Optional[Union[str, "_models.SnapshotType"]] = "NodePool", + snapshot_type: Union[str, "_models.SnapshotType"] = "NodePool", **kwargs ): """ - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] - :keyword location: Required. The geo-location where the resource lives. + :keyword location: The geo-location where the resource lives. Required. :paramtype location: str :keyword creation_data: CreationData to be used to specify the source agent pool resource ID to create this snapshot. :paramtype creation_data: ~azure.mgmt.containerservice.v2022_06_01.models.CreationData - :keyword snapshot_type: The type of a snapshot. The default is NodePool. Known values are: - "NodePool". Default value: "NodePool". + :keyword snapshot_type: The type of a snapshot. The default is NodePool. "NodePool" :paramtype snapshot_type: str or ~azure.mgmt.containerservice.v2022_06_01.models.SnapshotType """ - super(Snapshot, self).__init__(tags=tags, location=location, **kwargs) + super().__init__(tags=tags, location=location, **kwargs) self.creation_data = creation_data self.snapshot_type = snapshot_type self.kubernetes_version = None @@ -5693,7 +5528,7 @@ def __init__( self.enable_fips = None -class SnapshotListResult(msrest.serialization.Model): +class SnapshotListResult(_serialization.Model): """The response from the List Snapshots operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -5705,30 +5540,25 @@ class SnapshotListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[Snapshot]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[Snapshot]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.Snapshot"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.Snapshot"]] = None, **kwargs): """ :keyword value: The list of snapshots. :paramtype value: list[~azure.mgmt.containerservice.v2022_06_01.models.Snapshot] """ - super(SnapshotListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class SysctlConfig(msrest.serialization.Model): +class SysctlConfig(_serialization.Model): # pylint: disable=too-many-instance-attributes """Sysctl settings for Linux agent nodes. :ivar net_core_somaxconn: Sysctl setting net.core.somaxconn. @@ -5790,37 +5620,37 @@ class SysctlConfig(msrest.serialization.Model): """ _attribute_map = { - 'net_core_somaxconn': {'key': 'netCoreSomaxconn', 'type': 'int'}, - 'net_core_netdev_max_backlog': {'key': 'netCoreNetdevMaxBacklog', 'type': 'int'}, - 'net_core_rmem_default': {'key': 'netCoreRmemDefault', 'type': 'int'}, - 'net_core_rmem_max': {'key': 'netCoreRmemMax', 'type': 'int'}, - 'net_core_wmem_default': {'key': 'netCoreWmemDefault', 'type': 'int'}, - 'net_core_wmem_max': {'key': 'netCoreWmemMax', 'type': 'int'}, - 'net_core_optmem_max': {'key': 'netCoreOptmemMax', 'type': 'int'}, - 'net_ipv4_tcp_max_syn_backlog': {'key': 'netIpv4TcpMaxSynBacklog', 'type': 'int'}, - 'net_ipv4_tcp_max_tw_buckets': {'key': 'netIpv4TcpMaxTwBuckets', 'type': 'int'}, - 'net_ipv4_tcp_fin_timeout': {'key': 'netIpv4TcpFinTimeout', 'type': 'int'}, - 'net_ipv4_tcp_keepalive_time': {'key': 'netIpv4TcpKeepaliveTime', 'type': 'int'}, - 'net_ipv4_tcp_keepalive_probes': {'key': 'netIpv4TcpKeepaliveProbes', 'type': 'int'}, - 'net_ipv4_tcpkeepalive_intvl': {'key': 'netIpv4TcpkeepaliveIntvl', 'type': 'int'}, - 'net_ipv4_tcp_tw_reuse': {'key': 'netIpv4TcpTwReuse', 'type': 'bool'}, - 'net_ipv4_ip_local_port_range': {'key': 'netIpv4IpLocalPortRange', 'type': 'str'}, - 'net_ipv4_neigh_default_gc_thresh1': {'key': 'netIpv4NeighDefaultGcThresh1', 'type': 'int'}, - 'net_ipv4_neigh_default_gc_thresh2': {'key': 'netIpv4NeighDefaultGcThresh2', 'type': 'int'}, - 'net_ipv4_neigh_default_gc_thresh3': {'key': 'netIpv4NeighDefaultGcThresh3', 'type': 'int'}, - 'net_netfilter_nf_conntrack_max': {'key': 'netNetfilterNfConntrackMax', 'type': 'int'}, - 'net_netfilter_nf_conntrack_buckets': {'key': 'netNetfilterNfConntrackBuckets', 'type': 'int'}, - 'fs_inotify_max_user_watches': {'key': 'fsInotifyMaxUserWatches', 'type': 'int'}, - 'fs_file_max': {'key': 'fsFileMax', 'type': 'int'}, - 'fs_aio_max_nr': {'key': 'fsAioMaxNr', 'type': 'int'}, - 'fs_nr_open': {'key': 'fsNrOpen', 'type': 'int'}, - 'kernel_threads_max': {'key': 'kernelThreadsMax', 'type': 'int'}, - 'vm_max_map_count': {'key': 'vmMaxMapCount', 'type': 'int'}, - 'vm_swappiness': {'key': 'vmSwappiness', 'type': 'int'}, - 'vm_vfs_cache_pressure': {'key': 'vmVfsCachePressure', 'type': 'int'}, - } - - def __init__( + "net_core_somaxconn": {"key": "netCoreSomaxconn", "type": "int"}, + "net_core_netdev_max_backlog": {"key": "netCoreNetdevMaxBacklog", "type": "int"}, + "net_core_rmem_default": {"key": "netCoreRmemDefault", "type": "int"}, + "net_core_rmem_max": {"key": "netCoreRmemMax", "type": "int"}, + "net_core_wmem_default": {"key": "netCoreWmemDefault", "type": "int"}, + "net_core_wmem_max": {"key": "netCoreWmemMax", "type": "int"}, + "net_core_optmem_max": {"key": "netCoreOptmemMax", "type": "int"}, + "net_ipv4_tcp_max_syn_backlog": {"key": "netIpv4TcpMaxSynBacklog", "type": "int"}, + "net_ipv4_tcp_max_tw_buckets": {"key": "netIpv4TcpMaxTwBuckets", "type": "int"}, + "net_ipv4_tcp_fin_timeout": {"key": "netIpv4TcpFinTimeout", "type": "int"}, + "net_ipv4_tcp_keepalive_time": {"key": "netIpv4TcpKeepaliveTime", "type": "int"}, + "net_ipv4_tcp_keepalive_probes": {"key": "netIpv4TcpKeepaliveProbes", "type": "int"}, + "net_ipv4_tcpkeepalive_intvl": {"key": "netIpv4TcpkeepaliveIntvl", "type": "int"}, + "net_ipv4_tcp_tw_reuse": {"key": "netIpv4TcpTwReuse", "type": "bool"}, + "net_ipv4_ip_local_port_range": {"key": "netIpv4IpLocalPortRange", "type": "str"}, + "net_ipv4_neigh_default_gc_thresh1": {"key": "netIpv4NeighDefaultGcThresh1", "type": "int"}, + "net_ipv4_neigh_default_gc_thresh2": {"key": "netIpv4NeighDefaultGcThresh2", "type": "int"}, + "net_ipv4_neigh_default_gc_thresh3": {"key": "netIpv4NeighDefaultGcThresh3", "type": "int"}, + "net_netfilter_nf_conntrack_max": {"key": "netNetfilterNfConntrackMax", "type": "int"}, + "net_netfilter_nf_conntrack_buckets": {"key": "netNetfilterNfConntrackBuckets", "type": "int"}, + "fs_inotify_max_user_watches": {"key": "fsInotifyMaxUserWatches", "type": "int"}, + "fs_file_max": {"key": "fsFileMax", "type": "int"}, + "fs_aio_max_nr": {"key": "fsAioMaxNr", "type": "int"}, + "fs_nr_open": {"key": "fsNrOpen", "type": "int"}, + "kernel_threads_max": {"key": "kernelThreadsMax", "type": "int"}, + "vm_max_map_count": {"key": "vmMaxMapCount", "type": "int"}, + "vm_swappiness": {"key": "vmSwappiness", "type": "int"}, + "vm_vfs_cache_pressure": {"key": "vmVfsCachePressure", "type": "int"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, net_core_somaxconn: Optional[int] = None, @@ -5911,7 +5741,7 @@ def __init__( :keyword vm_vfs_cache_pressure: Sysctl setting vm.vfs_cache_pressure. :paramtype vm_vfs_cache_pressure: int """ - super(SysctlConfig, self).__init__(**kwargs) + super().__init__(**kwargs) self.net_core_somaxconn = net_core_somaxconn self.net_core_netdev_max_backlog = net_core_netdev_max_backlog self.net_core_rmem_default = net_core_rmem_default @@ -5942,20 +5772,20 @@ def __init__( self.vm_vfs_cache_pressure = vm_vfs_cache_pressure -class SystemData(msrest.serialization.Model): +class SystemData(_serialization.Model): """Metadata pertaining to creation and last modification of the resource. :ivar created_by: The identity that created the resource. :vartype created_by: str :ivar created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", "Key". + "User", "Application", "ManagedIdentity", and "Key". :vartype created_by_type: str or ~azure.mgmt.containerservice.v2022_06_01.models.CreatedByType :ivar created_at: The timestamp of resource creation (UTC). :vartype created_at: ~datetime.datetime :ivar last_modified_by: The identity that last modified the resource. :vartype last_modified_by: str :ivar last_modified_by_type: The type of identity that last modified the resource. Known values - are: "User", "Application", "ManagedIdentity", "Key". + are: "User", "Application", "ManagedIdentity", and "Key". :vartype last_modified_by_type: str or ~azure.mgmt.containerservice.v2022_06_01.models.CreatedByType :ivar last_modified_at: The timestamp of resource last modification (UTC). @@ -5963,12 +5793,12 @@ class SystemData(msrest.serialization.Model): """ _attribute_map = { - 'created_by': {'key': 'createdBy', 'type': 'str'}, - 'created_by_type': {'key': 'createdByType', 'type': 'str'}, - 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, - 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, - 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, - 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + "created_by": {"key": "createdBy", "type": "str"}, + "created_by_type": {"key": "createdByType", "type": "str"}, + "created_at": {"key": "createdAt", "type": "iso-8601"}, + "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, + "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, + "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, } def __init__( @@ -5986,7 +5816,7 @@ def __init__( :keyword created_by: The identity that created the resource. :paramtype created_by: str :keyword created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", "Key". + "User", "Application", "ManagedIdentity", and "Key". :paramtype created_by_type: str or ~azure.mgmt.containerservice.v2022_06_01.models.CreatedByType :keyword created_at: The timestamp of resource creation (UTC). @@ -5994,13 +5824,13 @@ def __init__( :keyword last_modified_by: The identity that last modified the resource. :paramtype last_modified_by: str :keyword last_modified_by_type: The type of identity that last modified the resource. Known - values are: "User", "Application", "ManagedIdentity", "Key". + values are: "User", "Application", "ManagedIdentity", and "Key". :paramtype last_modified_by_type: str or ~azure.mgmt.containerservice.v2022_06_01.models.CreatedByType :keyword last_modified_at: The timestamp of resource last modification (UTC). :paramtype last_modified_at: ~datetime.datetime """ - super(SystemData, self).__init__(**kwargs) + super().__init__(**kwargs) self.created_by = created_by self.created_by_type = created_by_type self.created_at = created_at @@ -6009,36 +5839,31 @@ def __init__( self.last_modified_at = last_modified_at -class TagsObject(msrest.serialization.Model): +class TagsObject(_serialization.Model): """Tags object for patch operations. - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] """ _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] """ - super(TagsObject, self).__init__(**kwargs) + super().__init__(**kwargs) self.tags = tags -class TimeInWeek(msrest.serialization.Model): +class TimeInWeek(_serialization.Model): """Time in a week. :ivar day: The day of the week. Known values are: "Sunday", "Monday", "Tuesday", "Wednesday", - "Thursday", "Friday", "Saturday". + "Thursday", "Friday", and "Saturday". :vartype day: str or ~azure.mgmt.containerservice.v2022_06_01.models.WeekDay :ivar hour_slots: Each integer hour represents a time range beginning at 0m after the hour ending at the next hour (non-inclusive). 0 corresponds to 00:00 UTC, 23 corresponds to 23:00 @@ -6047,32 +5872,28 @@ class TimeInWeek(msrest.serialization.Model): """ _attribute_map = { - 'day': {'key': 'day', 'type': 'str'}, - 'hour_slots': {'key': 'hourSlots', 'type': '[int]'}, + "day": {"key": "day", "type": "str"}, + "hour_slots": {"key": "hourSlots", "type": "[int]"}, } def __init__( - self, - *, - day: Optional[Union[str, "_models.WeekDay"]] = None, - hour_slots: Optional[List[int]] = None, - **kwargs + self, *, day: Optional[Union[str, "_models.WeekDay"]] = None, hour_slots: Optional[List[int]] = None, **kwargs ): """ :keyword day: The day of the week. Known values are: "Sunday", "Monday", "Tuesday", - "Wednesday", "Thursday", "Friday", "Saturday". + "Wednesday", "Thursday", "Friday", and "Saturday". :paramtype day: str or ~azure.mgmt.containerservice.v2022_06_01.models.WeekDay :keyword hour_slots: Each integer hour represents a time range beginning at 0m after the hour ending at the next hour (non-inclusive). 0 corresponds to 00:00 UTC, 23 corresponds to 23:00 UTC. Specifying [0, 1] means the 00:00 - 02:00 UTC time range. :paramtype hour_slots: list[int] """ - super(TimeInWeek, self).__init__(**kwargs) + super().__init__(**kwargs) self.day = day self.hour_slots = hour_slots -class TimeSpan(msrest.serialization.Model): +class TimeSpan(_serialization.Model): """For example, between 2021-05-25T13:00:00Z and 2021-05-25T14:00:00Z. :ivar start: The start of a time span. @@ -6082,29 +5903,23 @@ class TimeSpan(msrest.serialization.Model): """ _attribute_map = { - 'start': {'key': 'start', 'type': 'iso-8601'}, - 'end': {'key': 'end', 'type': 'iso-8601'}, + "start": {"key": "start", "type": "iso-8601"}, + "end": {"key": "end", "type": "iso-8601"}, } - def __init__( - self, - *, - start: Optional[datetime.datetime] = None, - end: Optional[datetime.datetime] = None, - **kwargs - ): + def __init__(self, *, start: Optional[datetime.datetime] = None, end: Optional[datetime.datetime] = None, **kwargs): """ :keyword start: The start of a time span. :paramtype start: ~datetime.datetime :keyword end: The end of a time span. :paramtype end: ~datetime.datetime """ - super(TimeSpan, self).__init__(**kwargs) + super().__init__(**kwargs) self.start = start self.end = end -class WindowsGmsaProfile(msrest.serialization.Model): +class WindowsGmsaProfile(_serialization.Model): """Windows gMSA Profile in the managed cluster. :ivar enabled: Specifies whether to enable Windows gMSA in the managed cluster. @@ -6120,9 +5935,9 @@ class WindowsGmsaProfile(msrest.serialization.Model): """ _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'dns_server': {'key': 'dnsServer', 'type': 'str'}, - 'root_domain_name': {'key': 'rootDomainName', 'type': 'str'}, + "enabled": {"key": "enabled", "type": "bool"}, + "dns_server": {"key": "dnsServer", "type": "str"}, + "root_domain_name": {"key": "rootDomainName", "type": "str"}, } def __init__( @@ -6145,7 +5960,7 @@ def __init__( which is used to create the managed cluster. :paramtype root_domain_name: str """ - super(WindowsGmsaProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.dns_server = dns_server self.root_domain_name = root_domain_name diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/models/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/models/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/models/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/models/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/operations/__init__.py index e0748876288c..593b23075ce0 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/operations/__init__.py @@ -18,15 +18,16 @@ from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'Operations', - 'ManagedClustersOperations', - 'MaintenanceConfigurationsOperations', - 'AgentPoolsOperations', - 'PrivateEndpointConnectionsOperations', - 'PrivateLinkResourcesOperations', - 'ResolvePrivateLinkServiceIdOperations', - 'SnapshotsOperations', + "Operations", + "ManagedClustersOperations", + "MaintenanceConfigurationsOperations", + "AgentPoolsOperations", + "PrivateEndpointConnectionsOperations", + "PrivateLinkResourcesOperations", + "ResolvePrivateLinkServiceIdOperations", + "SnapshotsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/operations/_agent_pools_operations.py index 2f675c917e78..81b85041db25 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/operations/_agent_pools_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,288 +27,303 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - *, - json: Optional[_models.AgentPool] = None, - content: Any = None, - **kwargs: Any + _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, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + _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, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_get_upgrade_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_available_agent_pool_versions_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_upgrade_node_image_version_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_upgrade_node_image_version_request( + resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class AgentPoolsOperations: """ @@ -324,47 +344,40 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> Iterable[_models.AgentPoolListResult]: + def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> Iterable["_models.AgentPool"]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AgentPoolListResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_06_01.models.AgentPoolListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either AgentPool or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_06_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -372,16 +385,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -397,10 +405,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -410,54 +416,46 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore @distributed_trace def get( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPool: """Gets the specified managed cluster agent pool. Gets the specified managed cluster agent pool. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPool, or the result of cls(response) + :return: AgentPool or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_01.models.AgentPool - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -465,57 +463,60 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore def _create_or_update_initial( self, resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: _models.AgentPool, + parameters: Union[_models.AgentPool, IO], **kwargs: Any ) -> _models.AgentPool: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - _json = self._serialize.body(parameters, 'AgentPool') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "AgentPool") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -523,10 +524,9 @@ def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -534,26 +534,27 @@ def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - @distributed_trace + @overload def begin_create_or_update( self, resource_group_name: str, resource_name: str, agent_pool_name: str, parameters: _models.AgentPool, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.AgentPool]: """Creates or updates an agent pool in the specified managed cluster. @@ -561,13 +562,58 @@ def begin_create_or_update( Creates or updates an agent pool in the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str - :param parameters: The agent pool to create or update. + :param parameters: The agent pool to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_06_01.models.AgentPool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_06_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AgentPool]: + """Creates or updates an agent pool in the specified managed cluster. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: The agent pool to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -579,20 +625,57 @@ def begin_create_or_update( :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_06_01.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: Union[_models.AgentPool, IO], + **kwargs: Any + ) -> LROPoller[_models.AgentPool]: + """Creates or updates an agent pool in the specified managed cluster. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: The agent pool to create or update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.mgmt.containerservice.v2022_06_01.models.AgentPool or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_06_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -601,66 +684,55 @@ def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -668,10 +740,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -681,26 +752,22 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + def begin_delete( + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> LROPoller[None]: """Deletes an agent pool in the specified managed cluster. Deletes an agent pool in the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -712,99 +779,86 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPoolUpgradeProfile: """Gets the upgrade profile for an agent pool. Gets the upgrade profile for an agent pool. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolUpgradeProfile, or the result of cls(response) + :return: AgentPoolUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_01.models.AgentPoolUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -812,32 +866,27 @@ def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolUpgradeProfile', pipeline_response) + deserialized = self._deserialize("AgentPoolUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore @distributed_trace def get_available_agent_pool_versions( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported Kubernetes versions for the specified agent pool. @@ -846,32 +895,30 @@ def get_available_agent_pool_versions( the version lifecycle. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolAvailableVersions, or the result of cls(response) + :return: AgentPoolAvailableVersions or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_01.models.AgentPoolAvailableVersions - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolAvailableVersions] - request = build_get_available_agent_pool_versions_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_available_agent_pool_versions.metadata['url'], + template_url=self.get_available_agent_pool_versions.metadata["url"], headers=_headers, params=_params, ) @@ -879,52 +926,43 @@ def get_available_agent_pool_versions( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolAvailableVersions', pipeline_response) + deserialized = self._deserialize("AgentPoolAvailableVersions", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_available_agent_pool_versions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore - + get_available_agent_pool_versions.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore def _upgrade_node_image_version_initial( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> Optional[_models.AgentPool]: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.AgentPool]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.AgentPool]] - - request = build_upgrade_node_image_version_request_initial( - subscription_id=self._config.subscription_id, + request = build_upgrade_node_image_version_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._upgrade_node_image_version_initial.metadata['url'], + template_url=self._upgrade_node_image_version_initial.metadata["url"], headers=_headers, params=_params, ) @@ -932,10 +970,9 @@ def _upgrade_node_image_version_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -945,26 +982,23 @@ def _upgrade_node_image_version_initial( deserialized = None response_headers = {} if response.status_code == 202: - response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) - - deserialized = self._deserialize('AgentPool', pipeline_response) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _upgrade_node_image_version_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore - + _upgrade_node_image_version_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore @distributed_trace def begin_upgrade_node_image_version( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any - ) -> LROPoller[_models.AgentPool]: + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any + ) -> LROPoller[None]: """Upgrades the node image version of an agent pool to the latest. Upgrading the node image version of an agent pool applies the newest OS and runtime updates to @@ -972,10 +1006,11 @@ def begin_upgrade_node_image_version( node image versions, see: https://docs.microsoft.com/azure/aks/node-image-upgrade. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -988,59 +1023,54 @@ def begin_upgrade_node_image_version( :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_06_01.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._upgrade_node_image_version_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) - - deserialized = self._deserialize('AgentPool', pipeline_response) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_upgrade_node_image_version.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore + begin_upgrade_node_image_version.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/operations/_maintenance_configurations_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/operations/_maintenance_configurations_operations.py index 1cd4ef048115..0854da805e6b 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/operations/_maintenance_configurations_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/operations/_maintenance_configurations_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,173 +25,181 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +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_managed_cluster_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, config_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "configName": _SERIALIZER.url("config_name", config_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "configName": _SERIALIZER.url("config_name", config_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - config_name: str, - *, - json: Optional[_models.MaintenanceConfiguration] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, resource_name: str, config_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "configName": _SERIALIZER.url("config_name", config_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "configName": _SERIALIZER.url("config_name", config_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, config_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "configName": _SERIALIZER.url("config_name", config_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "configName": _SERIALIZER.url("config_name", config_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class MaintenanceConfigurationsOperations: """ @@ -207,48 +220,44 @@ def __init__(self, *args, **kwargs): 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_managed_cluster( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> Iterable[_models.MaintenanceConfigurationListResult]: + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> Iterable["_models.MaintenanceConfiguration"]: """Gets a list of maintenance configurations in the specified managed cluster. Gets a list of maintenance configurations in the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either MaintenanceConfigurationListResult or the result - of cls(response) + :return: An iterator like instance of either MaintenanceConfiguration or the result of + cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_06_01.models.MaintenanceConfigurationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_06_01.models.MaintenanceConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfigurationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfigurationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_managed_cluster_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_managed_cluster.metadata['url'], + template_url=self.list_by_managed_cluster.metadata["url"], headers=_headers, params=_params, ) @@ -256,16 +265,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_managed_cluster_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -281,10 +285,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -294,54 +296,46 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_managed_cluster.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations"} # type: ignore + list_by_managed_cluster.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations"} # type: ignore @distributed_trace def get( - self, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, config_name: str, **kwargs: Any ) -> _models.MaintenanceConfiguration: """Gets the specified maintenance configuration of a managed cluster. Gets the specified maintenance configuration of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: MaintenanceConfiguration, or the result of cls(response) + :return: MaintenanceConfiguration or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_01.models.MaintenanceConfiguration - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfiguration] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -349,33 +343,33 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) + deserialized = self._deserialize("MaintenanceConfiguration", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - - @distributed_trace + @overload def create_or_update( self, resource_group_name: str, resource_name: str, config_name: str, parameters: _models.MaintenanceConfiguration, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.MaintenanceConfiguration: """Creates or updates a maintenance configuration in the specified managed cluster. @@ -383,41 +377,116 @@ def create_or_update( Creates or updates a maintenance configuration in the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str - :param parameters: The maintenance configuration to create or update. + :param parameters: The maintenance configuration to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_06_01.models.MaintenanceConfiguration + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: MaintenanceConfiguration, or the result of cls(response) + :return: MaintenanceConfiguration or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_01.models.MaintenanceConfiguration - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configuration in the specified managed cluster. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: The maintenance configuration to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_01.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: Union[_models.MaintenanceConfiguration, IO], + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configuration in the specified managed cluster. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: The maintenance configuration to create or update. Is either a model type or + a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_06_01.models.MaintenanceConfiguration or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_01.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfiguration] - _json = self._serialize.body(parameters, 'MaintenanceConfiguration') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "MaintenanceConfiguration") request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) @@ -425,68 +494,60 @@ def create_or_update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) + deserialized = self._deserialize("MaintenanceConfiguration", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore @distributed_trace def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, config_name: str, **kwargs: Any ) -> None: """Deletes a maintenance configuration. Deletes a maintenance configuration. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) @@ -494,10 +555,9 @@ def delete( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -507,5 +567,4 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/operations/_managed_clusters_operations.py index eaa5f5c8bf34..484f24006d2c 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/operations/_managed_clusters_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,200 +27,189 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_get_os_options_request( - subscription_id: str, - location: str, - *, - resource_type: Optional[str] = None, - **kwargs: Any + location: str, subscription_id: str, *, resource_type: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "location": _SERIALIZER.url("location", location, 'str', min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "location": _SERIALIZER.url("location", location, "str", min_length=1), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if resource_type is not None: - _params['resource-type'] = _SERIALIZER.query("resource_type", resource_type, 'str') + _params["resource-type"] = _SERIALIZER.query("resource_type", resource_type, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters") + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters" + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_resource_group_request( - subscription_id: str, - resource_group_name: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_upgrade_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_access_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, role_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "roleName": _SERIALIZER.url("role_name", role_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "roleName": _SERIALIZER.url("role_name", role_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_admin_credentials_request( - subscription_id: str, resource_group_name: str, resource_name: str, + subscription_id: str, *, server_fqdn: Optional[str] = None, **kwargs: Any @@ -223,40 +217,46 @@ def build_list_cluster_admin_credentials_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if server_fqdn is not None: - _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + _params["server-fqdn"] = _SERIALIZER.query("server_fqdn", server_fqdn, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_user_credentials_request( - subscription_id: str, resource_group_name: str, resource_name: str, + subscription_id: str, *, server_fqdn: Optional[str] = None, format: Optional[Union[str, "_models.Format"]] = None, @@ -265,42 +265,48 @@ def build_list_cluster_user_credentials_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if server_fqdn is not None: - _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + _params["server-fqdn"] = _SERIALIZER.query("server_fqdn", server_fqdn, "str") if format is not None: - _params['format'] = _SERIALIZER.query("format", format, 'str') + _params["format"] = _SERIALIZER.query("format", format, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_monitoring_user_credentials_request( - subscription_id: str, resource_group_name: str, resource_name: str, + subscription_id: str, *, server_fqdn: Optional[str] = None, **kwargs: Any @@ -308,520 +314,535 @@ def build_list_cluster_monitoring_user_credentials_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if server_fqdn is not None: - _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + _params["server-fqdn"] = _SERIALIZER.query("server_fqdn", server_fqdn, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: + +def build_get_request(resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedCluster] = None, - content: Any = None, - **kwargs: Any + +def build_create_or_update_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_update_tags_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.TagsObject] = None, - content: Any = None, - **kwargs: Any + +def build_update_tags_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + +def build_delete_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_reset_service_principal_profile_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedClusterServicePrincipalProfile] = None, - content: Any = None, - **kwargs: Any + +def build_reset_service_principal_profile_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_reset_aad_profile_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedClusterAADProfile] = None, - content: Any = None, - **kwargs: Any + +def build_reset_aad_profile_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_rotate_cluster_certificates_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + +def build_rotate_cluster_certificates_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_stop_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + +def build_stop_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_start_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + +def build_start_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_run_command_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.RunCommandRequest] = None, - content: Any = None, - **kwargs: Any + +def build_run_command_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_get_command_result_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - command_id: str, - **kwargs: Any + resource_group_name: str, resource_name: str, command_id: 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "commandId": _SERIALIZER.url("command_id", command_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "commandId": _SERIALIZER.url("command_id", command_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_list_outbound_network_dependencies_endpoints_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + class ManagedClustersOperations: # pylint: disable=too-many-public-methods """ @@ -842,46 +863,39 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def get_os_options( - self, - location: str, - resource_type: Optional[str] = None, - **kwargs: Any + self, location: str, resource_type: Optional[str] = None, **kwargs: Any ) -> _models.OSOptionProfile: """Gets supported OS options in the specified subscription. Gets supported OS options in the specified subscription. - :param location: The name of Azure region. + :param location: The name of Azure region. Required. :type location: str :param resource_type: The resource type for which the OS options needs to be returned. Default value is None. :type resource_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: OSOptionProfile, or the result of cls(response) + :return: OSOptionProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_01.models.OSOptionProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OSOptionProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OSOptionProfile] - request = build_get_os_options_request( - subscription_id=self._config.subscription_id, location=location, - api_version=api_version, + subscription_id=self._config.subscription_id, resource_type=resource_type, - template_url=self.get_os_options.metadata['url'], + api_version=api_version, + template_url=self.get_os_options.metadata["url"], headers=_headers, params=_params, ) @@ -889,59 +903,52 @@ def get_os_options( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('OSOptionProfile', pipeline_response) + deserialized = self._deserialize("OSOptionProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_os_options.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default"} # type: ignore - + get_os_options.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default"} # type: ignore @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.ManagedClusterListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.ManagedCluster"]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_06_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_06_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -949,14 +956,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -972,10 +976,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -985,49 +987,42 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> Iterable[_models.ManagedClusterListResult]: + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.ManagedCluster"]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_06_01.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_06_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -1035,15 +1030,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -1059,10 +1050,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1072,50 +1061,43 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.ManagedClusterUpgradeProfile: """Gets the upgrade profile of a managed cluster. Gets the upgrade profile of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterUpgradeProfile, or the result of cls(response) + :return: ManagedClusterUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_01.models.ManagedClusterUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -1123,33 +1105,27 @@ def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterUpgradeProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore @distributed_trace def get_access_profile( - self, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, role_name: str, **kwargs: Any ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. @@ -1159,35 +1135,33 @@ def get_access_profile( `_ . :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param role_name: The name of the role for managed cluster accessProfile resource. + :param role_name: The name of the role for managed cluster accessProfile resource. Required. :type role_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterAccessProfile, or the result of cls(response) + :return: ManagedClusterAccessProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_01.models.ManagedClusterAccessProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterAccessProfile] - request = build_get_access_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, role_name=role_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_access_profile.metadata['url'], + template_url=self.get_access_profile.metadata["url"], headers=_headers, params=_params, ) @@ -1195,68 +1169,60 @@ def get_access_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterAccessProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterAccessProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_access_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore - + get_access_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore @distributed_trace def list_cluster_admin_credentials( - self, - resource_group_name: str, - resource_name: str, - server_fqdn: Optional[str] = None, - **kwargs: Any + self, resource_group_name: str, resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any ) -> _models.CredentialResults: """Lists the admin credentials of a managed cluster. Lists the admin credentials of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_admin_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, - template_url=self.list_cluster_admin_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_admin_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -1264,25 +1230,23 @@ def list_cluster_admin_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_admin_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore - + list_cluster_admin_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore @distributed_trace def list_cluster_user_credentials( @@ -1298,40 +1262,39 @@ def list_cluster_user_credentials( Lists the user credentials of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :param format: Only apply to AAD clusters, specifies the format of returned kubeconfig. Format 'azure' will return azure auth-provider kubeconfig; format 'exec' will return exec format - kubeconfig, which requires kubelogin binary in the path. Default value is None. + kubeconfig, which requires kubelogin binary in the path. Known values are: "azure" and "exec". + Default value is None. :type format: str or ~azure.mgmt.containerservice.v2022_06_01.models.Format :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, format=format, - template_url=self.list_cluster_user_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -1339,68 +1302,60 @@ def list_cluster_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore - + list_cluster_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore @distributed_trace def list_cluster_monitoring_user_credentials( - self, - resource_group_name: str, - resource_name: str, - server_fqdn: Optional[str] = None, - **kwargs: Any + self, resource_group_name: str, resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any ) -> _models.CredentialResults: """Lists the cluster monitoring user credentials of a managed cluster. Lists the cluster monitoring user credentials of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_01.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_monitoring_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, - template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_monitoring_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -1408,64 +1363,55 @@ def list_cluster_monitoring_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_monitoring_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore - + list_cluster_monitoring_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore @distributed_trace - def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.ManagedCluster: + def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.ManagedCluster: """Gets a managed cluster. Gets a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedCluster, or the result of cls(response) + :return: ManagedCluster or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_01.models.ManagedCluster - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -1473,55 +1419,54 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _create_or_update_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.ManagedCluster, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'ManagedCluster') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedCluster") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1529,10 +1474,9 @@ def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -1540,25 +1484,26 @@ def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - - @distributed_trace + @overload def begin_create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedCluster, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. @@ -1566,11 +1511,15 @@ def begin_create_or_update( Creates or updates a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The managed cluster to create or update. + :param parameters: The managed cluster to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_06_01.models.ManagedCluster + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1583,90 +1532,157 @@ def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_06_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._create_or_update_initial( # type: ignore - resource_group_name=resource_group_name, - resource_name=resource_name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop('error_map', None) - def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized + @overload + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + Creates or updates a managed cluster. - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling - if cont_token: + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_06_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster to create or update. Is either a model type or a IO + type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_06_01.models.ManagedCluster or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_06_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ManagedCluster", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _update_tags_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.TagsObject, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request_initial( - subscription_id=self._config.subscription_id, + request = build_update_tags_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_tags_initial.metadata['url'], + content=_content, + template_url=self._update_tags_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1674,32 +1690,32 @@ def _update_tags_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_tags_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _update_tags_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - @distributed_trace + @overload def begin_update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. @@ -1707,11 +1723,88 @@ def begin_update_tags( Updates tags on a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2022_06_01.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_06_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates tags on a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_06_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates tags on a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_06_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1724,20 +1817,17 @@ def begin_update_tags( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_06_01.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, @@ -1745,64 +1835,54 @@ def begin_update_tags( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1810,10 +1890,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1823,23 +1902,18 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> LROPoller[None]: + def begin_delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> LROPoller[None]: """Deletes a managed cluster. Deletes a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1851,85 +1925,83 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterServicePrincipalProfile, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterServicePrincipalProfile") - request = build_reset_service_principal_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_service_principal_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_service_principal_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_service_principal_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1937,10 +2009,9 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1950,15 +2021,16 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re if cls: return cls(pipeline_response, None, {}) - _reset_service_principal_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + _reset_service_principal_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore - - @distributed_trace - def begin_reset_service_principal_profile( # pylint: disable=inconsistent-return-statements + @overload + def begin_reset_service_principal_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterServicePrincipalProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: """Reset the Service Principal Profile of a managed cluster. @@ -1966,12 +2038,53 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur This action cannot be performed on a cluster that is not using a service principal. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The service principal profile to set on the managed cluster. + :param parameters: The service principal profile to set on the managed cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2022_06_01.models.ManagedClusterServicePrincipalProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reset the Service Principal Profile of a managed cluster. + + This action cannot be performed on a cluster that is not using a service principal. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The service principal profile to set on the managed cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1982,20 +2095,54 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Reset the Service Principal Profile of a managed cluster. + + This action cannot be performed on a cluster that is not using a service principal. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The service principal profile to set on the managed cluster. Is either a + model type or a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2022_06_01.models.ManagedClusterServicePrincipalProfile or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -2003,67 +2150,68 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_service_principal_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + begin_reset_service_principal_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterAADProfile, + parameters: Union[_models.ManagedClusterAADProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterAADProfile") - request = build_reset_aad_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_aad_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_aad_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_aad_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2071,10 +2219,9 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -2084,15 +2231,16 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement if cls: return cls(pipeline_response, None, {}) - _reset_aad_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - + _reset_aad_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - @distributed_trace - def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements + @overload + def begin_reset_aad_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterAADProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: """Reset the AAD Profile of a managed cluster. @@ -2100,11 +2248,89 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements Reset the AAD Profile of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The AAD profile to set on the Managed Cluster. + :param parameters: The AAD profile to set on the Managed Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2022_06_01.models.ManagedClusterAADProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reset the AAD Profile of a managed cluster. + + Reset the AAD Profile of a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The AAD profile to set on the Managed Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterAADProfile, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Reset the AAD Profile of a managed cluster. + + Reset the AAD Profile of a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The AAD profile to set on the Managed Cluster. Is either a model type or a + IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_06_01.models.ManagedClusterAADProfile or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -2115,20 +2341,17 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -2136,62 +2359,52 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_aad_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + begin_reset_aad_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_rotate_cluster_certificates_request_initial( - subscription_id=self._config.subscription_id, + request = build_rotate_cluster_certificates_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._rotate_cluster_certificates_initial.metadata['url'], + template_url=self._rotate_cluster_certificates_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2199,10 +2412,9 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -2212,15 +2424,11 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return if cls: return cls(pipeline_response, None, {}) - _rotate_cluster_certificates_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore - + _rotate_cluster_certificates_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore @distributed_trace - def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + def begin_rotate_cluster_certificates( + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> LROPoller[None]: """Rotates the certificates of a managed cluster. @@ -2228,8 +2436,9 @@ def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-st more details about rotating managed cluster certificates. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -2241,80 +2450,67 @@ def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-st Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._rotate_cluster_certificates_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_rotate_cluster_certificates.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore + begin_rotate_cluster_certificates.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore def _stop_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_stop_request_initial( - subscription_id=self._config.subscription_id, + request = build_stop_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._stop_initial.metadata['url'], + template_url=self._stop_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2322,10 +2518,9 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -2335,16 +2530,10 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore - + _stop_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore @distributed_trace - def begin_stop( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> LROPoller[None]: + def begin_stop(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> LROPoller[None]: """Stops a Managed Cluster. This can only be performed on Azure Virtual Machine Scale set backed clusters. Stopping a @@ -2354,8 +2543,9 @@ def begin_stop( # pylint: disable=inconsistent-return-statements cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -2367,80 +2557,67 @@ def begin_stop( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._stop_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore + begin_stop.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore def _start_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_start_request_initial( - subscription_id=self._config.subscription_id, + request = build_start_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._start_initial.metadata['url'], + template_url=self._start_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2448,10 +2625,9 @@ def _start_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -2461,24 +2637,19 @@ def _start_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore - + _start_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore @distributed_trace - def begin_start( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> LROPoller[None]: + def begin_start(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> LROPoller[None]: """Starts a previously stopped Managed Cluster. See `starting a cluster `_ for more details about starting a cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -2490,85 +2661,83 @@ def begin_start( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._start_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore + begin_start.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore def _run_command_initial( self, resource_group_name: str, resource_name: str, - request_payload: _models.RunCommandRequest, + request_payload: Union[_models.RunCommandRequest, IO], **kwargs: Any ) -> Optional[_models.RunCommandResult]: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RunCommandResult]] - _json = self._serialize.body(request_payload, 'RunCommandRequest') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(request_payload, (IO, bytes)): + _content = request_payload + else: + _json = self._serialize.body(request_payload, "RunCommandRequest") - request = build_run_command_request_initial( - subscription_id=self._config.subscription_id, + request = build_run_command_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._run_command_initial.metadata['url'], + content=_content, + template_url=self._run_command_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2576,10 +2745,9 @@ def _run_command_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -2588,22 +2756,23 @@ def _run_command_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _run_command_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore + _run_command_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore - - @distributed_trace + @overload def begin_run_command( self, resource_group_name: str, resource_name: str, request_payload: _models.RunCommandRequest, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.RunCommandResult]: """Submits a command to run against the Managed Cluster. @@ -2613,11 +2782,15 @@ def begin_run_command( `_. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param request_payload: The run command request. + :param request_payload: The run command request. Required. :type request_payload: ~azure.mgmt.containerservice.v2022_06_01.models.RunCommandRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -2630,20 +2803,97 @@ def begin_run_command( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_06_01.models.RunCommandResult] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_run_command( + self, + resource_group_name: str, + resource_name: str, + request_payload: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RunCommandResult]: + """Submits a command to run against the Managed Cluster. + + AKS will create a pod to run the command. This is primarily useful for private clusters. For + more information see `AKS Run Command + `_. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param request_payload: The run command request. Required. + :type request_payload: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either RunCommandResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_06_01.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_run_command( + self, + resource_group_name: str, + resource_name: str, + request_payload: Union[_models.RunCommandRequest, IO], + **kwargs: Any + ) -> LROPoller[_models.RunCommandResult]: + """Submits a command to run against the Managed Cluster. + + AKS will create a pod to run the command. This is primarily useful for private clusters. For + more information see `AKS Run Command + `_. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param request_payload: The run command request. Is either a model type or a IO type. Required. + :type request_payload: ~azure.mgmt.containerservice.v2022_06_01.models.RunCommandRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either RunCommandResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_06_01.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.RunCommandResult] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.RunCommandResult] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._run_command_initial( # type: ignore resource_group_name=resource_group_name, @@ -2651,82 +2901,72 @@ def begin_run_command( request_payload=request_payload, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_run_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore + begin_run_command.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore @distributed_trace def get_command_result( - self, - resource_group_name: str, - resource_name: str, - command_id: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, command_id: str, **kwargs: Any ) -> Optional[_models.RunCommandResult]: """Gets the results of a command which has been run on the Managed Cluster. Gets the results of a command which has been run on the Managed Cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param command_id: Id of the command. + :param command_id: Id of the command. Required. :type command_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: RunCommandResult, or the result of cls(response) + :return: RunCommandResult or None or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_01.models.RunCommandResult or None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RunCommandResult]] - request = build_get_command_result_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, command_id=command_id, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_command_result.metadata['url'], + template_url=self.get_command_result.metadata["url"], headers=_headers, params=_params, ) @@ -2734,10 +2974,9 @@ def get_command_result( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -2746,23 +2985,19 @@ def get_command_result( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_command_result.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}"} # type: ignore - + get_command_result.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}"} # type: ignore @distributed_trace def list_outbound_network_dependencies_endpoints( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> Iterable[_models.OutboundEnvironmentEndpointCollection]: + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> Iterable["_models.OutboundEnvironmentEndpoint"]: """Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster. @@ -2770,35 +3005,35 @@ def list_outbound_network_dependencies_endpoints( specified managed cluster. The operation returns properties of each egress endpoint. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OutboundEnvironmentEndpointCollection or the - result of cls(response) + :return: An iterator like instance of either OutboundEnvironmentEndpoint or the result of + cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_06_01.models.OutboundEnvironmentEndpointCollection] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_06_01.models.OutboundEnvironmentEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_outbound_network_dependencies_endpoints_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_outbound_network_dependencies_endpoints.metadata['url'], + template_url=self.list_outbound_network_dependencies_endpoints.metadata["url"], headers=_headers, params=_params, ) @@ -2806,16 +3041,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_outbound_network_dependencies_endpoints_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -2831,10 +3061,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2844,8 +3072,6 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_outbound_network_dependencies_endpoints.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints"} # type: ignore + list_outbound_network_dependencies_endpoints.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/operations/_operations.py index 0cc81166f916..562044058733 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/operations/_operations.py @@ -7,10 +7,15 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,38 +25,34 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - **kwargs: Any -) -> HttpRequest: + +def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.ContainerService/operations") # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class Operations: """ @@ -72,38 +73,33 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.OperationListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.OperationValue"]: """Gets a list of operations. Gets a list of operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationListResult or the result of cls(response) + :return: An iterator like instance of either OperationValue or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_06_01.models.OperationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_06_01.models.OperationValue] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -111,13 +107,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -133,10 +127,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -146,8 +138,6 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.ContainerService/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ContainerService/operations"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/operations/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/operations/_private_endpoint_connections_operations.py index 596821f435aa..6037a5916c4d 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/operations/_private_endpoint_connections_operations.py @@ -6,11 +6,15 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod @@ -21,173 +25,199 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - subscription_id: str, resource_group_name: str, resource_name: str, private_endpoint_connection_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_update_request( - subscription_id: str, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, - *, - json: Optional[_models.PrivateEndpointConnection] = None, - content: Any = None, + subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request_initial( - subscription_id: str, +def build_delete_request( resource_group_name: str, resource_name: str, private_endpoint_connection_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class PrivateEndpointConnectionsOperations: """ @@ -208,13 +238,9 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnectionListResult: """Gets a list of private endpoint connections in the specified managed cluster. @@ -222,32 +248,30 @@ def list( https://docs.microsoft.com/azure/aks/private-clusters. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnectionListResult, or the result of cls(response) + :return: PrivateEndpointConnectionListResult or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_01.models.PrivateEndpointConnectionListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnectionListResult] - request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -255,33 +279,27 @@ def list( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore - + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore @distributed_trace def get( - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnection: """Gets the specified private endpoint connection. @@ -289,35 +307,33 @@ def get( https://docs.microsoft.com/azure/aks/private-clusters. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_01.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -325,33 +341,33 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - @distributed_trace + @overload def update( self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, parameters: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateEndpointConnection: """Updates a private endpoint connection. @@ -359,41 +375,116 @@ def update( Updates a private endpoint connection. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str - :param parameters: The updated private endpoint connection. + :param parameters: The updated private endpoint connection. Required. :type parameters: ~azure.mgmt.containerservice.v2022_06_01.models.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_01.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: The updated private endpoint connection. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_01.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @distributed_trace + def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: Union[_models.PrivateEndpointConnection, IO], + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: The updated private endpoint connection. Is either a model type or a IO + type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_06_01.models.PrivateEndpointConnection or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_01.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - _json = self._serialize.body(parameters, 'PrivateEndpointConnection') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateEndpointConnection") request = build_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update.metadata['url'], + content=_content, + template_url=self.update.metadata["url"], headers=_headers, params=_params, ) @@ -401,52 +492,43 @@ def update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -454,10 +536,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -467,26 +548,22 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + def begin_delete( + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> LROPoller[None]: """Deletes a private endpoint connection. Deletes a private endpoint connection. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -498,53 +575,46 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/operations/_private_link_resources_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/operations/_private_link_resources_operations.py index 3393be16c63c..7810f3cbbd44 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/operations/_private_link_resources_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/operations/_private_link_resources_operations.py @@ -8,9 +8,13 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -19,48 +23,55 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class PrivateLinkResourcesOperations: """ @@ -81,13 +92,9 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.PrivateLinkResourcesListResult: """Gets a list of private link resources in the specified managed cluster. @@ -95,32 +102,30 @@ def list( https://docs.microsoft.com/azure/aks/private-clusters. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResourcesListResult, or the result of cls(response) + :return: PrivateLinkResourcesListResult or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_01.models.PrivateLinkResourcesListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResourcesListResult] - request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -128,22 +133,20 @@ def list( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResourcesListResult', pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources"} # type: ignore - + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/operations/_resolve_private_link_service_id_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/operations/_resolve_private_link_service_id_operations.py index fc9769483c59..79aabe13af6a 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/operations/_resolve_private_link_service_id_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/operations/_resolve_private_link_service_id_operations.py @@ -6,11 +6,15 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -19,56 +23,58 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_post_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.PrivateLinkResource] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + class ResolvePrivateLinkServiceIdOperations: """ @@ -89,13 +95,14 @@ def __init__(self, *args, **kwargs): 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 + @overload def post( self, resource_group_name: str, resource_name: str, parameters: _models.PrivateLinkResource, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateLinkResource: """Gets the private link service ID for the specified managed cluster. @@ -103,38 +110,106 @@ def post( Gets the private link service ID for the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters required in order to resolve a private link service ID. + :param parameters: Parameters required in order to resolve a private link service ID. Required. :type parameters: ~azure.mgmt.containerservice.v2022_06_01.models.PrivateLinkResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResource, or the result of cls(response) + :return: PrivateLinkResource or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_01.models.PrivateLinkResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + def post( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID for the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters required in order to resolve a private link service ID. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_01.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def post( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.PrivateLinkResource, IO], + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID for the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters required in order to resolve a private link service ID. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_06_01.models.PrivateLinkResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_01.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResource] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResource] - _json = self._serialize.body(parameters, 'PrivateLinkResource') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateLinkResource") request = build_post_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.post.metadata['url'], + content=_content, + template_url=self.post.metadata["url"], headers=_headers, params=_params, ) @@ -142,22 +217,20 @@ def post( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResource', pipeline_response) + deserialized = self._deserialize("PrivateLinkResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - post.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId"} # type: ignore - + post.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/operations/_snapshots_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/operations/_snapshots_operations.py index c7a8b7d4041d..3f9a76e3222d 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/operations/_snapshots_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_01/operations/_snapshots_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,243 +25,233 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots") path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_resource_group_request( - subscription_id: str, - resource_group_name: str, - **kwargs: Any -) -> HttpRequest: +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: + _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, resource_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.Snapshot] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_update_tags_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.TagsObject] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class SnapshotsOperations: """ @@ -277,39 +272,33 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.SnapshotListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.Snapshot"]: """Gets a list of snapshots in the specified subscription. Gets a list of snapshots in the specified subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SnapshotListResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_06_01.models.SnapshotListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either Snapshot or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_06_01.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SnapshotListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -317,14 +306,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -340,10 +326,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -353,48 +337,41 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots"} # type: ignore @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> Iterable[_models.SnapshotListResult]: + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Snapshot"]: """Lists snapshots in the specified subscription and resource group. Lists snapshots in the specified subscription and resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SnapshotListResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_06_01.models.SnapshotListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either Snapshot or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_06_01.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SnapshotListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -402,15 +379,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -426,10 +399,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -439,50 +410,41 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots"} # type: ignore @distributed_trace - def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.Snapshot: + def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.Snapshot: """Gets a snapshot. Gets a snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Snapshot, or the result of cls(response) + :return: Snapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_01.models.Snapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -490,32 +452,32 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - - @distributed_trace + @overload def create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.Snapshot, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.Snapshot: """Creates or updates a snapshot. @@ -523,38 +485,102 @@ def create_or_update( Creates or updates a snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The snapshot to create or update. + :param parameters: The snapshot to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_06_01.models.Snapshot + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Snapshot, or the result of cls(response) + :return: Snapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_01.models.Snapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Snapshot: + """Creates or updates a snapshot. + + Creates or updates a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The snapshot to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_01.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.Snapshot, IO], **kwargs: Any + ) -> _models.Snapshot: + """Creates or updates a snapshot. + + Creates or updates a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The snapshot to create or update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.mgmt.containerservice.v2022_06_01.models.Snapshot or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_01.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] - _json = self._serialize.body(parameters, 'Snapshot') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "Snapshot") request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) @@ -562,10 +588,9 @@ def create_or_update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -573,25 +598,26 @@ def create_or_update( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - - @distributed_trace + @overload def update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.Snapshot: """Updates tags on a snapshot. @@ -599,38 +625,102 @@ def update_tags( Updates tags on a snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update snapshot Tags operation. + :param parameters: Parameters supplied to the Update snapshot Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2022_06_01.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Snapshot, or the result of cls(response) + :return: Snapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_01.models.Snapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + def update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Snapshot: + """Updates tags on a snapshot. + + Updates tags on a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update snapshot Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_01.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> _models.Snapshot: + """Updates tags on a snapshot. + + Updates tags on a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update snapshot Tags operation. Is either a model + type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_06_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_01.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") request = build_update_tags_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_tags.metadata['url'], + content=_content, + template_url=self.update_tags.metadata["url"], headers=_headers, params=_params, ) @@ -638,64 +728,57 @@ def update_tags( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - + update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore @distributed_trace def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: """Deletes a snapshot. Deletes a snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) @@ -703,10 +786,9 @@ def delete( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -716,5 +798,4 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - + delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/__init__.py index 37a5f9e02e6f..a8716d29afe8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/__init__.py @@ -14,7 +14,8 @@ except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['ContainerServiceClient'] + +__all__ = ["ContainerServiceClient"] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/_configuration.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/_configuration.py index 0ea5a338f54d..2a671fe3df50 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/_configuration.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/_configuration.py @@ -18,29 +18,25 @@ VERSION = "unknown" + class ContainerServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ContainerServiceClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :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. + :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2022-06-02-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: + def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ContainerServiceClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2022-06-02-preview") # type: str + api_version = kwargs.pop("api_version", "2022-06-02-preview") # type: str if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -50,23 +46,24 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-containerservice/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-containerservice/{}".format(VERSION)) self._configure(**kwargs) def _configure( - self, - **kwargs # type: Any + self, **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/_container_service_client.py index 8f81cd2f2002..0b7d6af43433 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/_container_service_client.py @@ -9,20 +9,34 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from . import models +from .._serialization import Deserializer, Serializer from ._configuration import ContainerServiceClientConfiguration -from .operations import AgentPoolsOperations, FleetMembersOperations, FleetsOperations, MaintenanceConfigurationsOperations, ManagedClusterSnapshotsOperations, ManagedClustersOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, ResolvePrivateLinkServiceIdOperations, SnapshotsOperations, TrustedAccessRoleBindingsOperations, TrustedAccessRolesOperations +from .operations import ( + AgentPoolsOperations, + FleetMembersOperations, + FleetsOperations, + MaintenanceConfigurationsOperations, + ManagedClusterSnapshotsOperations, + ManagedClustersOperations, + Operations, + PrivateEndpointConnectionsOperations, + PrivateLinkResourcesOperations, + ResolvePrivateLinkServiceIdOperations, + SnapshotsOperations, + TrustedAccessRoleBindingsOperations, + TrustedAccessRolesOperations, +) if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class ContainerServiceClient: # pylint: disable=too-many-instance-attributes + +class ContainerServiceClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """The Container Service Client. :ivar operations: Operations operations @@ -62,9 +76,9 @@ class ContainerServiceClient: # pylint: disable=too-many-instance-attributes :ivar fleet_members: FleetMembersOperations operations :vartype fleet_members: azure.mgmt.containerservice.v2022_06_02_preview.operations.FleetMembersOperations - :param credential: Credential needed for the client to connect to Azure. + :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. + :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -82,25 +96,23 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = ContainerServiceClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = ContainerServiceClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize - ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.managed_clusters = ManagedClustersOperations( self._client, self._config, self._serialize, self._deserialize ) self.maintenance_configurations = MaintenanceConfigurationsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.agent_pools = AgentPoolsOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) self.private_endpoint_connections = PrivateEndpointConnectionsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -110,9 +122,7 @@ def __init__( self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations( self._client, self._config, self._serialize, self._deserialize ) - self.snapshots = SnapshotsOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.snapshots = SnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) self.managed_cluster_snapshots = ManagedClusterSnapshotsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -122,19 +132,10 @@ def __init__( self.trusted_access_role_bindings = TrustedAccessRoleBindingsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.fleets = FleetsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.fleet_members = FleetMembersOperations( - self._client, self._config, self._serialize, self._deserialize - ) - + self.fleets = FleetsOperations(self._client, self._config, self._serialize, self._deserialize) + self.fleet_members = FleetMembersOperations(self._client, self._config, self._serialize, self._deserialize) - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> HttpResponse: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -143,7 +144,7 @@ def _send_request( >>> response = client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/_metadata.json b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/_metadata.json index 61189e278164..9898bc7bf8ae 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/_metadata.json +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/_metadata.json @@ -10,20 +10,20 @@ "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { "credential": { - "signature": "credential, # type: \"TokenCredential\"", - "description": "Credential needed for the client to connect to Azure.", + "signature": "credential: \"TokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true }, "subscription_id": { - "signature": "subscription_id, # type: str", - "description": "The ID of the target subscription.", + "signature": "subscription_id: str,", + "description": "The ID of the target subscription. Required.", "docstring_type": "str", "required": true } @@ -31,13 +31,13 @@ "async": { "credential": { "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure.", + "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { "signature": "subscription_id: str,", - "description": "The ID of the target subscription.", + "description": "The ID of the target subscription. Required.", "docstring_type": "str", "required": true } @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=\"https://management.azure.com\", # type: str", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/_vendor.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/_vendor.py index 138f663c53a4..9aad73fc743e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/_vendor.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/_vendor.py @@ -7,6 +7,7 @@ from azure.core.pipeline.transport import HttpRequest + def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) @@ -14,6 +15,7 @@ def _convert_request(request, files=None): request.set_formdata_body(files) return request + def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -21,7 +23,5 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [ - c for c in formatted_components if "{}".format(key.args[0]) not in c - ] + components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/__init__.py index 37a5f9e02e6f..a8716d29afe8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/__init__.py @@ -14,7 +14,8 @@ except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['ContainerServiceClient'] + +__all__ = ["ContainerServiceClient"] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/_configuration.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/_configuration.py index e84eaf42ba4d..712bbef192dd 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/_configuration.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/_configuration.py @@ -18,29 +18,25 @@ VERSION = "unknown" + class ContainerServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ContainerServiceClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :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. + :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2022-06-02-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: + def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ContainerServiceClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2022-06-02-preview") # type: str + api_version = kwargs.pop("api_version", "2022-06-02-preview") # type: str if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -50,22 +46,21 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-containerservice/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-containerservice/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, - **kwargs: Any - ) -> None: - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/_container_service_client.py index 92f54272638e..3fc0e4c64b52 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/_container_service_client.py @@ -9,20 +9,34 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from .. import models +from ..._serialization import Deserializer, Serializer from ._configuration import ContainerServiceClientConfiguration -from .operations import AgentPoolsOperations, FleetMembersOperations, FleetsOperations, MaintenanceConfigurationsOperations, ManagedClusterSnapshotsOperations, ManagedClustersOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, ResolvePrivateLinkServiceIdOperations, SnapshotsOperations, TrustedAccessRoleBindingsOperations, TrustedAccessRolesOperations +from .operations import ( + AgentPoolsOperations, + FleetMembersOperations, + FleetsOperations, + MaintenanceConfigurationsOperations, + ManagedClusterSnapshotsOperations, + ManagedClustersOperations, + Operations, + PrivateEndpointConnectionsOperations, + PrivateLinkResourcesOperations, + ResolvePrivateLinkServiceIdOperations, + SnapshotsOperations, + TrustedAccessRoleBindingsOperations, + TrustedAccessRolesOperations, +) if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class ContainerServiceClient: # pylint: disable=too-many-instance-attributes + +class ContainerServiceClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """The Container Service Client. :ivar operations: Operations operations @@ -63,9 +77,9 @@ class ContainerServiceClient: # pylint: disable=too-many-instance-attributes :ivar fleet_members: FleetMembersOperations operations :vartype fleet_members: azure.mgmt.containerservice.v2022_06_02_preview.aio.operations.FleetMembersOperations - :param credential: Credential needed for the client to connect to Azure. + :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. + :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -83,25 +97,23 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = ContainerServiceClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = ContainerServiceClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize - ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.managed_clusters = ManagedClustersOperations( self._client, self._config, self._serialize, self._deserialize ) self.maintenance_configurations = MaintenanceConfigurationsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.agent_pools = AgentPoolsOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) self.private_endpoint_connections = PrivateEndpointConnectionsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -111,9 +123,7 @@ def __init__( self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations( self._client, self._config, self._serialize, self._deserialize ) - self.snapshots = SnapshotsOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.snapshots = SnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) self.managed_cluster_snapshots = ManagedClusterSnapshotsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -123,19 +133,10 @@ def __init__( self.trusted_access_role_bindings = TrustedAccessRoleBindingsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.fleets = FleetsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.fleet_members = FleetMembersOperations( - self._client, self._config, self._serialize, self._deserialize - ) - + self.fleets = FleetsOperations(self._client, self._config, self._serialize, self._deserialize) + self.fleet_members = FleetMembersOperations(self._client, self._config, self._serialize, self._deserialize) - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -144,7 +145,7 @@ def _send_request( >>> response = await client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/__init__.py index 03d015afec25..d0dc4a5de18e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/__init__.py @@ -23,20 +23,21 @@ from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'Operations', - 'ManagedClustersOperations', - 'MaintenanceConfigurationsOperations', - 'AgentPoolsOperations', - 'PrivateEndpointConnectionsOperations', - 'PrivateLinkResourcesOperations', - 'ResolvePrivateLinkServiceIdOperations', - 'SnapshotsOperations', - 'ManagedClusterSnapshotsOperations', - 'TrustedAccessRolesOperations', - 'TrustedAccessRoleBindingsOperations', - 'FleetsOperations', - 'FleetMembersOperations', + "Operations", + "ManagedClustersOperations", + "MaintenanceConfigurationsOperations", + "AgentPoolsOperations", + "PrivateEndpointConnectionsOperations", + "PrivateLinkResourcesOperations", + "ResolvePrivateLinkServiceIdOperations", + "SnapshotsOperations", + "ManagedClusterSnapshotsOperations", + "TrustedAccessRolesOperations", + "TrustedAccessRoleBindingsOperations", + "FleetsOperations", + "FleetMembersOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_agent_pools_operations.py index 4bb851949e2a..5101b7e4c6b5 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_agent_pools_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +29,20 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._agent_pools_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_available_agent_pool_versions_request, build_get_request, build_get_upgrade_profile_request, build_list_request, build_upgrade_node_image_version_request_initial -T = TypeVar('T') +from ...operations._agent_pools_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_available_agent_pool_versions_request, + build_get_request, + build_get_upgrade_profile_request, + build_list_request, + build_upgrade_node_image_version_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class AgentPoolsOperations: """ .. warning:: @@ -45,47 +62,41 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.AgentPoolListResult]: + def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncIterable["_models.AgentPool"]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AgentPoolListResult or the result of cls(response) + :return: An iterator like instance of either AgentPool or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_06_02_preview.models.AgentPoolListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_06_02_preview.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -93,16 +104,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -118,10 +124,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -131,54 +135,46 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore @distributed_trace_async async def get( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPool: """Gets the specified managed cluster agent pool. Gets the specified managed cluster agent pool. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPool, or the result of cls(response) + :return: AgentPool or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.AgentPool - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -186,57 +182,60 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore async def _create_or_update_initial( self, resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: _models.AgentPool, + parameters: Union[_models.AgentPool, IO], **kwargs: Any ) -> _models.AgentPool: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - _json = self._serialize.body(parameters, 'AgentPool') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "AgentPool") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -244,10 +243,9 @@ async def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -255,26 +253,27 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - - @distributed_trace_async + @overload async def begin_create_or_update( self, resource_group_name: str, resource_name: str, agent_pool_name: str, parameters: _models.AgentPool, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.AgentPool]: """Creates or updates an agent pool in the specified managed cluster. @@ -282,13 +281,59 @@ async def begin_create_or_update( Creates or updates an agent pool in the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str - :param parameters: The agent pool to create or update. + :param parameters: The agent pool to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_06_02_preview.models.AgentPool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AgentPool or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_06_02_preview.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AgentPool]: + """Creates or updates an agent pool in the specified managed cluster. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: The agent pool to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -301,20 +346,58 @@ async def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_06_02_preview.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: Union[_models.AgentPool, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.AgentPool]: + """Creates or updates an agent pool in the specified managed cluster. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: The agent pool to create or update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.mgmt.containerservice.v2022_06_02_preview.models.AgentPool or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AgentPool or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_06_02_preview.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -323,39 +406,35 @@ async def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements self, @@ -365,26 +444,23 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements ignore_pod_disruption_budget: Optional[bool] = None, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, - api_version=api_version, + subscription_id=self._config.subscription_id, ignore_pod_disruption_budget=ignore_pod_disruption_budget, - template_url=self._delete_initial.metadata['url'], + api_version=api_version, + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -392,10 +468,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -405,11 +480,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements + async def begin_delete( self, resource_group_name: str, resource_name: str, @@ -422,10 +496,11 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Deletes an agent pool in the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :param ignore_pod_disruption_budget: ignore-pod-disruption-budget=true to delete those pods on a node without considering Pod Disruption Budget. Default value is None. @@ -440,19 +515,16 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -460,80 +532,70 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements agent_pool_name=agent_pool_name, ignore_pod_disruption_budget=ignore_pod_disruption_budget, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace_async async def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPoolUpgradeProfile: """Gets the upgrade profile for an agent pool. Gets the upgrade profile for an agent pool. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolUpgradeProfile, or the result of cls(response) + :return: AgentPoolUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.AgentPoolUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -541,32 +603,27 @@ async def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolUpgradeProfile', pipeline_response) + deserialized = self._deserialize("AgentPoolUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore @distributed_trace_async async def get_available_agent_pool_versions( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported Kubernetes versions for the specified agent pool. @@ -575,32 +632,30 @@ async def get_available_agent_pool_versions( the version lifecycle. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolAvailableVersions, or the result of cls(response) + :return: AgentPoolAvailableVersions or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.AgentPoolAvailableVersions - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolAvailableVersions] - request = build_get_available_agent_pool_versions_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_available_agent_pool_versions.metadata['url'], + template_url=self.get_available_agent_pool_versions.metadata["url"], headers=_headers, params=_params, ) @@ -608,52 +663,43 @@ async def get_available_agent_pool_versions( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolAvailableVersions', pipeline_response) + deserialized = self._deserialize("AgentPoolAvailableVersions", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_available_agent_pool_versions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore - + get_available_agent_pool_versions.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore async def _upgrade_node_image_version_initial( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> Optional[_models.AgentPool]: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.AgentPool]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.AgentPool]] - - request = build_upgrade_node_image_version_request_initial( - subscription_id=self._config.subscription_id, + request = build_upgrade_node_image_version_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._upgrade_node_image_version_initial.metadata['url'], + template_url=self._upgrade_node_image_version_initial.metadata["url"], headers=_headers, params=_params, ) @@ -661,10 +707,9 @@ async def _upgrade_node_image_version_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -674,26 +719,23 @@ async def _upgrade_node_image_version_initial( deserialized = None response_headers = {} if response.status_code == 202: - response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) - - deserialized = self._deserialize('AgentPool', pipeline_response) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _upgrade_node_image_version_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore - + _upgrade_node_image_version_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore @distributed_trace_async async def begin_upgrade_node_image_version( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any - ) -> AsyncLROPoller[_models.AgentPool]: + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: """Upgrades the node image version of an agent pool to the latest. Upgrading the node image version of an agent pool applies the newest OS and runtime updates to @@ -701,10 +743,11 @@ async def begin_upgrade_node_image_version( node image versions, see: https://docs.microsoft.com/azure/aks/node-image-upgrade. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -718,59 +761,54 @@ async def begin_upgrade_node_image_version( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_06_02_preview.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._upgrade_node_image_version_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) - - deserialized = self._deserialize('AgentPool', pipeline_response) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_upgrade_node_image_version.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore + begin_upgrade_node_image_version.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_fleet_members_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_fleet_members_operations.py index 725d03cd0dfe..08343a2a4b44 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_fleet_members_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_fleet_members_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +29,17 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._fleet_members_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_fleet_request -T = TypeVar('T') +from ...operations._fleet_members_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_fleet_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class FleetMembersOperations: """ .. warning:: @@ -45,42 +59,46 @@ def __init__(self, *args, **kwargs) -> None: 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 _create_or_update_initial( self, resource_group_name: str, fleet_name: str, fleet_member_name: str, - parameters: _models.FleetMember, + parameters: Union[_models.FleetMember, IO], if_match: Optional[str] = None, if_none_match: Optional[str] = None, **kwargs: Any ) -> _models.FleetMember: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.FleetMember] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.FleetMember] - _json = self._serialize.body(parameters, 'FleetMember') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "FleetMember") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, fleet_name=fleet_name, fleet_member_name=fleet_member_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, - if_match=if_match, - if_none_match=if_none_match, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -88,31 +106,30 @@ async def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('FleetMember', pipeline_response) + deserialized = self._deserialize("FleetMember", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('FleetMember', pipeline_response) + deserialized = self._deserialize("FleetMember", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}"} # type: ignore + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}"} # type: ignore - - @distributed_trace_async + @overload async def begin_create_or_update( self, resource_group_name: str, @@ -121,6 +138,8 @@ async def begin_create_or_update( parameters: _models.FleetMember, if_match: Optional[str] = None, if_none_match: Optional[str] = None, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.FleetMember]: """Creates or updates a fleet member. @@ -129,12 +148,13 @@ async def begin_create_or_update( referenced cluster join the 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. + :param fleet_name: The name of the Fleet resource. Required. :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. + :param fleet_member_name: The name of the Fleet member resource. Required. :type fleet_member_name: str - :param parameters: The Fleet member to create or update. + :param parameters: The Fleet member to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_06_02_preview.models.FleetMember :param if_match: Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is @@ -144,6 +164,114 @@ async def begin_create_or_update( existing resource. Other values will result in a 412 Pre-condition Failed response. 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either FleetMember or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_06_02_preview.models.FleetMember] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + fleet_name: str, + fleet_member_name: str, + parameters: IO, + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.FleetMember]: + """Creates or updates a fleet member. + + A member contains a reference to an existing Kubernetes cluster. Creating a member makes the + referenced cluster join the 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 + :param fleet_member_name: The name of the Fleet member resource. Required. + :type fleet_member_name: str + :param parameters: The Fleet member to create or update. Required. + :type parameters: IO + :param if_match: Omit this value to always overwrite the current resource. Specify the + last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is + None. + :type if_match: str + :param if_none_match: Set to '*' to allow a new resource to be created and prevent updating an + existing resource. Other values will result in a 412 Pre-condition Failed response. 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either FleetMember or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_06_02_preview.models.FleetMember] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + fleet_name: str, + fleet_member_name: str, + parameters: Union[_models.FleetMember, IO], + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.FleetMember]: + """Creates or updates a fleet member. + + A member contains a reference to an existing Kubernetes cluster. Creating a member makes the + referenced cluster join the 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 + :param fleet_member_name: The name of the Fleet member resource. Required. + :type fleet_member_name: str + :param parameters: The Fleet member to create or update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.mgmt.containerservice.v2022_06_02_preview.models.FleetMember or IO + :param if_match: Omit this value to always overwrite the current resource. Specify the + last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is + None. + :type if_match: str + :param if_none_match: Set to '*' to allow a new resource to be created and prevent updating an + existing resource. Other values will result in a 412 Pre-condition Failed response. Default + value is None. + :type if_none_match: str + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -156,20 +284,17 @@ async def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_06_02_preview.models.FleetMember] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.FleetMember] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.FleetMember] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -180,82 +305,72 @@ async def begin_create_or_update( if_none_match=if_none_match, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('FleetMember', pipeline_response) + deserialized = self._deserialize("FleetMember", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}"} # type: ignore @distributed_trace_async async def get( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - **kwargs: Any + self, resource_group_name: str, fleet_name: str, fleet_member_name: str, **kwargs: Any ) -> _models.FleetMember: """Gets a Fleet member. Gets a Fleet member. :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. + :param fleet_name: The name of the Fleet resource. Required. :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. + :param fleet_member_name: The name of the Fleet member resource. Required. :type fleet_member_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: FleetMember, or the result of cls(response) + :return: FleetMember or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.FleetMember - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.FleetMember] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.FleetMember] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, fleet_name=fleet_name, fleet_member_name=fleet_member_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -263,10 +378,9 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -274,15 +388,14 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('FleetMember', pipeline_response) + deserialized = self._deserialize("FleetMember", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements self, @@ -292,26 +405,23 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if_match: Optional[str] = None, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, fleet_name=fleet_name, fleet_member_name=fleet_member_name, - api_version=api_version, + subscription_id=self._config.subscription_id, if_match=if_match, - template_url=self._delete_initial.metadata['url'], + api_version=api_version, + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -319,24 +429,23 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements + async def begin_delete( self, resource_group_name: str, fleet_name: str, @@ -350,10 +459,11 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements is deleted upon success. The underlying cluster is not deleted. :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. + :param fleet_name: The name of the Fleet resource. Required. :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. + :param fleet_member_name: The name of the Fleet member resource. Required. :type fleet_member_name: str :param if_match: Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is @@ -369,19 +479,16 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -389,79 +496,73 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements fleet_member_name=fleet_member_name, if_match=if_match, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - lro_options={'final-state-via': 'location'}, - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}"} # type: ignore @distributed_trace def list_by_fleet( - self, - resource_group_name: str, - fleet_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.FleetMembersListResult]: + self, resource_group_name: str, fleet_name: str, **kwargs: Any + ) -> AsyncIterable["_models.FleetMember"]: """Lists the members of a fleet. Lists the members of a 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. + :param fleet_name: The name of the Fleet resource. Required. :type fleet_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either FleetMembersListResult or the result of - cls(response) + :return: An iterator like instance of either FleetMember or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_06_02_preview.models.FleetMembersListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_06_02_preview.models.FleetMember] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.FleetMembersListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.FleetMembersListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_fleet_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, fleet_name=fleet_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_fleet.metadata['url'], + template_url=self.list_by_fleet.metadata["url"], headers=_headers, params=_params, ) @@ -469,16 +570,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_fleet_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - fleet_name=fleet_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -494,10 +590,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -508,8 +602,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_fleet.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members"} # type: ignore + list_by_fleet.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_fleets_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_fleets_operations.py index ce009db6def1..841a96eed23b 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_fleets_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_fleets_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +29,20 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._fleets_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_resource_group_request, build_list_credentials_request, build_list_request, build_update_request -T = TypeVar('T') +from ...operations._fleets_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_resource_group_request, + build_list_credentials_request, + build_list_request, + build_update_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class FleetsOperations: """ .. warning:: @@ -45,40 +62,44 @@ def __init__(self, *args, **kwargs) -> None: 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 _create_or_update_initial( self, resource_group_name: str, fleet_name: str, - parameters: _models.Fleet, + parameters: Union[_models.Fleet, IO], if_match: Optional[str] = None, if_none_match: Optional[str] = None, **kwargs: Any ) -> _models.Fleet: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.Fleet] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Fleet] - _json = self._serialize.body(parameters, 'Fleet') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "Fleet") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, fleet_name=fleet_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, - if_match=if_match, - if_none_match=if_none_match, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -86,31 +107,30 @@ async def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('Fleet', pipeline_response) + deserialized = self._deserialize("Fleet", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('Fleet', pipeline_response) + deserialized = self._deserialize("Fleet", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}"} # type: ignore - + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}"} # type: ignore - @distributed_trace_async + @overload async def begin_create_or_update( self, resource_group_name: str, @@ -118,6 +138,8 @@ async def begin_create_or_update( parameters: _models.Fleet, if_match: Optional[str] = None, if_none_match: Optional[str] = None, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.Fleet]: """Creates or updates a Fleet. @@ -125,10 +147,11 @@ async def begin_create_or_update( Creates or updates a 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. + :param fleet_name: The name of the Fleet resource. Required. :type fleet_name: str - :param parameters: The Fleet to create or update. + :param parameters: The Fleet to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_06_02_preview.models.Fleet :param if_match: Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is @@ -138,6 +161,57 @@ async def begin_create_or_update( existing resource. Other values will result in a 412 Pre-condition Failed response. 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Fleet or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_06_02_preview.models.Fleet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + fleet_name: str, + parameters: IO, + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Fleet]: + """Creates or updates a Fleet. + + Creates or updates a 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 + :param parameters: The Fleet to create or update. Required. + :type parameters: IO + :param if_match: Omit this value to always overwrite the current resource. Specify the + last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is + None. + :type if_match: str + :param if_none_match: Set to '*' to allow a new resource to be created and prevent updating an + existing resource. Other values will result in a 412 Pre-condition Failed response. 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 :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -149,20 +223,64 @@ async def begin_create_or_update( :return: An instance of AsyncLROPoller that returns either Fleet or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_06_02_preview.models.Fleet] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + fleet_name: str, + parameters: Union[_models.Fleet, IO], + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.Fleet]: + """Creates or updates a Fleet. + + Creates or updates a 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 + :param parameters: The Fleet to create or update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.mgmt.containerservice.v2022_06_02_preview.models.Fleet or IO + :param if_match: Omit this value to always overwrite the current resource. Specify the + last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is + None. + :type if_match: str + :param if_none_match: Set to '*' to allow a new resource to be created and prevent updating an + existing resource. Other values will result in a 412 Pre-condition Failed response. Default + value is None. + :type if_none_match: str + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Fleet or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_06_02_preview.models.Fleet] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.Fleet] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Fleet] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -172,47 +290,45 @@ async def begin_create_or_update( if_none_match=if_none_match, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('Fleet', pipeline_response) + deserialized = self._deserialize("Fleet", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}"} # type: ignore - @distributed_trace_async + @overload async def update( self, resource_group_name: str, fleet_name: str, if_match: Optional[str] = None, parameters: Optional[_models.FleetPatch] = None, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.Fleet: """Patches a fleet resource. @@ -220,8 +336,9 @@ async def update( Patches a fleet resource. :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. + :param fleet_name: The name of the Fleet resource. Required. :type fleet_name: str :param if_match: Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is @@ -229,37 +346,114 @@ async def update( :type if_match: str :param parameters: The properties of a Fleet to update. Default value is None. :type parameters: ~azure.mgmt.containerservice.v2022_06_02_preview.models.FleetPatch + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Fleet or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.Fleet + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + fleet_name: str, + if_match: Optional[str] = None, + parameters: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Fleet: + """Patches a fleet resource. + + Patches a fleet resource. + + :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 if_match: Omit this value to always overwrite the current resource. Specify the + last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is + None. + :type if_match: str + :param parameters: The properties of a Fleet to update. Default value is None. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Fleet or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.Fleet + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + fleet_name: str, + if_match: Optional[str] = None, + parameters: Optional[Union[_models.FleetPatch, IO]] = None, + **kwargs: Any + ) -> _models.Fleet: + """Patches a fleet resource. + + Patches a fleet resource. + + :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 if_match: Omit this value to always overwrite the current resource. Specify the + last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is + None. + :type if_match: str + :param parameters: The properties of a Fleet to update. Is either a model type or a IO type. + Default value is None. + :type parameters: ~azure.mgmt.containerservice.v2022_06_02_preview.models.FleetPatch or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Fleet, or the result of cls(response) + :return: Fleet or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.Fleet - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.Fleet] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Fleet] - if parameters is not None: - _json = self._serialize.body(parameters, 'FleetPatch') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters else: - _json = None + if parameters is not None: + _json = self._serialize.body(parameters, "FleetPatch") + else: + _json = None request = build_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, fleet_name=fleet_name, + subscription_id=self._config.subscription_id, + if_match=if_match, api_version=api_version, content_type=content_type, json=_json, - if_match=if_match, - template_url=self.update.metadata['url'], + content=_content, + template_url=self.update.metadata["url"], headers=_headers, params=_params, ) @@ -267,10 +461,9 @@ async def update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -278,54 +471,46 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Fleet', pipeline_response) + deserialized = self._deserialize("Fleet", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}"} # type: ignore - + update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}"} # type: ignore @distributed_trace_async - async def get( - self, - resource_group_name: str, - fleet_name: str, - **kwargs: Any - ) -> _models.Fleet: + async def get(self, resource_group_name: str, fleet_name: str, **kwargs: Any) -> _models.Fleet: """Gets a Fleet. Gets a 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. + :param fleet_name: The name of the Fleet resource. Required. :type fleet_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Fleet, or the result of cls(response) + :return: Fleet or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.Fleet - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.Fleet] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.Fleet] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, fleet_name=fleet_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -333,10 +518,9 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -344,42 +528,34 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Fleet', pipeline_response) + deserialized = self._deserialize("Fleet", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - fleet_name: str, - if_match: Optional[str] = None, - **kwargs: Any + self, resource_group_name: str, fleet_name: str, if_match: Optional[str] = None, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, fleet_name=fleet_name, - api_version=api_version, + subscription_id=self._config.subscription_id, if_match=if_match, - template_url=self._delete_initial.metadata['url'], + api_version=api_version, + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -387,37 +563,33 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - fleet_name: str, - if_match: Optional[str] = None, - **kwargs: Any + async def begin_delete( + self, resource_group_name: str, fleet_name: str, if_match: Optional[str] = None, **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes a Fleet. Deletes a 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. + :param fleet_name: The name of the Fleet resource. Required. :type fleet_name: str :param if_match: Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is @@ -433,93 +605,84 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, fleet_name=fleet_name, if_match=if_match, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - lro_options={'final-state-via': 'location'}, - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}"} # type: ignore @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.FleetListResult]: + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.Fleet"]: """Lists fleets in the specified subscription and resource group. Lists fleets in the specified subscription and resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either FleetListResult or the result of cls(response) + :return: An iterator like instance of either Fleet or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_06_02_preview.models.FleetListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_06_02_preview.models.Fleet] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.FleetListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.FleetListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -527,15 +690,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -551,10 +710,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -565,44 +722,38 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets"} # type: ignore @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.FleetListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.Fleet"]: """Lists fleets in the specified subscription. Lists fleets in the specified subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either FleetListResult or the result of cls(response) + :return: An iterator like instance of either Fleet or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_06_02_preview.models.FleetListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_06_02_preview.models.Fleet] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.FleetListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.FleetListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -610,14 +761,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -633,10 +781,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -647,50 +793,43 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/fleets"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/fleets"} # type: ignore @distributed_trace_async async def list_credentials( - self, - resource_group_name: str, - fleet_name: str, - **kwargs: Any + self, resource_group_name: str, fleet_name: str, **kwargs: Any ) -> _models.FleetCredentialResults: """Lists the user credentials of a Fleet. Lists the user credentials of a 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. + :param fleet_name: The name of the Fleet resource. Required. :type fleet_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: FleetCredentialResults, or the result of cls(response) + :return: FleetCredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.FleetCredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.FleetCredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.FleetCredentialResults] - request = build_list_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, fleet_name=fleet_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_credentials.metadata['url'], + template_url=self.list_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -698,10 +837,9 @@ async def list_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -709,12 +847,11 @@ async def list_credentials( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('FleetCredentialResults', pipeline_response) + deserialized = self._deserialize("FleetCredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/listCredentials"} # type: ignore - + list_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/listCredentials"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_maintenance_configurations_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_maintenance_configurations_operations.py index 92b8694edde0..4f37457cc8d0 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_maintenance_configurations_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_maintenance_configurations_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,10 +27,17 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._maintenance_configurations_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_managed_cluster_request -T = TypeVar('T') +from ...operations._maintenance_configurations_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_managed_cluster_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class MaintenanceConfigurationsOperations: """ .. warning:: @@ -43,48 +57,44 @@ def __init__(self, *args, **kwargs) -> None: 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_managed_cluster( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.MaintenanceConfigurationListResult]: + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> AsyncIterable["_models.MaintenanceConfiguration"]: """Gets a list of maintenance configurations in the specified managed cluster. Gets a list of maintenance configurations in the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either MaintenanceConfigurationListResult or the result - of cls(response) + :return: An iterator like instance of either MaintenanceConfiguration or the result of + cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_06_02_preview.models.MaintenanceConfigurationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_06_02_preview.models.MaintenanceConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfigurationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfigurationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_managed_cluster_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_managed_cluster.metadata['url'], + template_url=self.list_by_managed_cluster.metadata["url"], headers=_headers, params=_params, ) @@ -92,16 +102,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_managed_cluster_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -117,10 +122,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -130,54 +133,46 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_managed_cluster.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations"} # type: ignore + list_by_managed_cluster.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations"} # type: ignore @distributed_trace_async async def get( - self, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, config_name: str, **kwargs: Any ) -> _models.MaintenanceConfiguration: """Gets the specified maintenance configuration of a managed cluster. Gets the specified maintenance configuration of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: MaintenanceConfiguration, or the result of cls(response) + :return: MaintenanceConfiguration or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.MaintenanceConfiguration - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfiguration] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -185,33 +180,33 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) + deserialized = self._deserialize("MaintenanceConfiguration", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - @distributed_trace_async + @overload async def create_or_update( self, resource_group_name: str, resource_name: str, config_name: str, parameters: _models.MaintenanceConfiguration, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.MaintenanceConfiguration: """Creates or updates a maintenance configuration in the specified managed cluster. @@ -219,42 +214,117 @@ async def create_or_update( Creates or updates a maintenance configuration in the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str - :param parameters: The maintenance configuration to create or update. + :param parameters: The maintenance configuration to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_06_02_preview.models.MaintenanceConfiguration + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configuration in the specified managed cluster. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: The maintenance configuration to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: MaintenanceConfiguration, or the result of cls(response) + :return: MaintenanceConfiguration or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.MaintenanceConfiguration - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: Union[_models.MaintenanceConfiguration, IO], + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configuration in the specified managed cluster. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: The maintenance configuration to create or update. Is either a model type or + a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.MaintenanceConfiguration or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfiguration] - _json = self._serialize.body(parameters, 'MaintenanceConfiguration') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "MaintenanceConfiguration") request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) @@ -262,68 +332,60 @@ async def create_or_update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) + deserialized = self._deserialize("MaintenanceConfiguration", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, config_name: str, **kwargs: Any ) -> None: """Deletes a maintenance configuration. Deletes a maintenance configuration. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) @@ -331,10 +393,9 @@ async def delete( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -344,5 +405,4 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_managed_cluster_snapshots_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_managed_cluster_snapshots_operations.py index b7703f90f601..8b18978d1e36 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_managed_cluster_snapshots_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_managed_cluster_snapshots_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,10 +27,19 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._managed_cluster_snapshots_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_resource_group_request, build_list_request, build_update_tags_request -T = TypeVar('T') +from ...operations._managed_cluster_snapshots_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_resource_group_request, + build_list_request, + build_update_tags_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class ManagedClusterSnapshotsOperations: """ .. warning:: @@ -43,40 +59,35 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.ManagedClusterSnapshotListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.ManagedClusterSnapshot"]: """Gets a list of managed cluster snapshots in the specified subscription. Gets a list of managed cluster snapshots in the specified subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterSnapshotListResult or the result of + :return: An iterator like instance of either ManagedClusterSnapshot or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterSnapshotListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterSnapshot] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshotListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterSnapshotListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -84,14 +95,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -107,10 +115,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -120,49 +126,45 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedclustersnapshots"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedclustersnapshots"} # type: ignore @distributed_trace def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.ManagedClusterSnapshotListResult]: + self, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ManagedClusterSnapshot"]: """Lists managed cluster snapshots in the specified subscription and resource group. Lists managed cluster snapshots in the specified subscription and resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterSnapshotListResult or the result of + :return: An iterator like instance of either ManagedClusterSnapshot or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterSnapshotListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterSnapshot] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshotListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterSnapshotListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -170,15 +172,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -194,10 +192,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -207,50 +203,41 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots"} # type: ignore @distributed_trace_async - async def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.ManagedClusterSnapshot: + async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.ManagedClusterSnapshot: """Gets a managed cluster snapshot. Gets a managed cluster snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterSnapshot, or the result of cls(response) + :return: ManagedClusterSnapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterSnapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterSnapshot] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -258,32 +245,32 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterSnapshot', pipeline_response) + deserialized = self._deserialize("ManagedClusterSnapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"} # type: ignore - @distributed_trace_async + @overload async def create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterSnapshot, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.ManagedClusterSnapshot: """Creates or updates a managed cluster snapshot. @@ -291,39 +278,108 @@ async def create_or_update( Creates or updates a managed cluster snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The managed cluster snapshot to create or update. + :param parameters: The managed cluster snapshot to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterSnapshot + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedClusterSnapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterSnapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ManagedClusterSnapshot: + """Creates or updates a managed cluster snapshot. + + Creates or updates a managed cluster snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster snapshot to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedClusterSnapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterSnapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterSnapshot, IO], + **kwargs: Any + ) -> _models.ManagedClusterSnapshot: + """Creates or updates a managed cluster snapshot. + + Creates or updates a managed cluster snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster snapshot to create or update. Is either a model type or + a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterSnapshot or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterSnapshot, or the result of cls(response) + :return: ManagedClusterSnapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterSnapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterSnapshot] - _json = self._serialize.body(parameters, 'ManagedClusterSnapshot') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterSnapshot") request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) @@ -331,10 +387,9 @@ async def create_or_update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -342,25 +397,26 @@ async def create_or_update( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ManagedClusterSnapshot', pipeline_response) + deserialized = self._deserialize("ManagedClusterSnapshot", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('ManagedClusterSnapshot', pipeline_response) + deserialized = self._deserialize("ManagedClusterSnapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"} # type: ignore - + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"} # type: ignore - @distributed_trace_async + @overload async def update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.ManagedClusterSnapshot: """Updates tags on a managed cluster snapshot. @@ -368,38 +424,104 @@ async def update_tags( Updates tags on a managed cluster snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Update managed cluster snapshot Tags operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2022_06_02_preview.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedClusterSnapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterSnapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ManagedClusterSnapshot: + """Updates tags on a managed cluster snapshot. + + Updates tags on a managed cluster snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update managed cluster snapshot Tags operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterSnapshot, or the result of cls(response) + :return: ManagedClusterSnapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterSnapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @distributed_trace_async + async def update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> _models.ManagedClusterSnapshot: + """Updates tags on a managed cluster snapshot. + + Updates tags on a managed cluster snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update managed cluster snapshot Tags operation. + Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_06_02_preview.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedClusterSnapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterSnapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterSnapshot] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") request = build_update_tags_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_tags.metadata['url'], + content=_content, + template_url=self.update_tags.metadata["url"], headers=_headers, params=_params, ) @@ -407,64 +529,57 @@ async def update_tags( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterSnapshot', pipeline_response) + deserialized = self._deserialize("ManagedClusterSnapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"} # type: ignore - + update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"} # type: ignore @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: """Deletes a managed cluster snapshot. Deletes a managed cluster snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) @@ -472,10 +587,9 @@ async def delete( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -485,5 +599,4 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"} # type: ignore - + delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_managed_clusters_operations.py index 1af3f180a768..24dc8c88ff90 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_managed_clusters_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,10 +29,34 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._managed_clusters_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_access_profile_request, build_get_command_result_request, build_get_os_options_request, build_get_request, build_get_upgrade_profile_request, build_list_by_resource_group_request, build_list_cluster_admin_credentials_request, build_list_cluster_monitoring_user_credentials_request, build_list_cluster_user_credentials_request, build_list_outbound_network_dependencies_endpoints_request, build_list_request, build_reset_aad_profile_request_initial, build_reset_service_principal_profile_request_initial, build_rotate_cluster_certificates_request_initial, build_rotate_service_account_signing_keys_request_initial, build_run_command_request_initial, build_start_request_initial, build_stop_request_initial, build_update_tags_request_initial -T = TypeVar('T') +from ...operations._managed_clusters_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_access_profile_request, + build_get_command_result_request, + build_get_os_options_request, + build_get_request, + build_get_upgrade_profile_request, + build_list_by_resource_group_request, + build_list_cluster_admin_credentials_request, + build_list_cluster_monitoring_user_credentials_request, + build_list_cluster_user_credentials_request, + build_list_outbound_network_dependencies_endpoints_request, + build_list_request, + build_reset_aad_profile_request, + build_reset_service_principal_profile_request, + build_rotate_cluster_certificates_request, + build_rotate_service_account_signing_keys_request, + build_run_command_request, + build_start_request, + build_stop_request, + build_update_tags_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class ManagedClustersOperations: # pylint: disable=too-many-public-methods """ .. warning:: @@ -45,46 +76,39 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async async def get_os_options( - self, - location: str, - resource_type: Optional[str] = None, - **kwargs: Any + self, location: str, resource_type: Optional[str] = None, **kwargs: Any ) -> _models.OSOptionProfile: """Gets supported OS options in the specified subscription. Gets supported OS options in the specified subscription. - :param location: The name of Azure region. + :param location: The name of Azure region. Required. :type location: str :param resource_type: The resource type for which the OS options needs to be returned. Default value is None. :type resource_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: OSOptionProfile, or the result of cls(response) + :return: OSOptionProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.OSOptionProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OSOptionProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OSOptionProfile] - request = build_get_os_options_request( - subscription_id=self._config.subscription_id, location=location, - api_version=api_version, + subscription_id=self._config.subscription_id, resource_type=resource_type, - template_url=self.get_os_options.metadata['url'], + api_version=api_version, + template_url=self.get_os_options.metadata["url"], headers=_headers, params=_params, ) @@ -92,59 +116,52 @@ async def get_os_options( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('OSOptionProfile', pipeline_response) + deserialized = self._deserialize("OSOptionProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_os_options.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default"} # type: ignore - + get_os_options.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default"} # type: ignore @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.ManagedClusterListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.ManagedCluster"]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -152,14 +169,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -175,10 +189,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -188,49 +200,44 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.ManagedClusterListResult]: + self, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ManagedCluster"]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -238,15 +245,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -262,10 +265,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -275,50 +276,43 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace_async async def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.ManagedClusterUpgradeProfile: """Gets the upgrade profile of a managed cluster. Gets the upgrade profile of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterUpgradeProfile, or the result of cls(response) + :return: ManagedClusterUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -326,33 +320,27 @@ async def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterUpgradeProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore @distributed_trace_async async def get_access_profile( - self, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, role_name: str, **kwargs: Any ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. @@ -362,35 +350,33 @@ async def get_access_profile( `_ . :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param role_name: The name of the role for managed cluster accessProfile resource. + :param role_name: The name of the role for managed cluster accessProfile resource. Required. :type role_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterAccessProfile, or the result of cls(response) + :return: ManagedClusterAccessProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterAccessProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterAccessProfile] - request = build_get_access_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, role_name=role_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_access_profile.metadata['url'], + template_url=self.get_access_profile.metadata["url"], headers=_headers, params=_params, ) @@ -398,68 +384,60 @@ async def get_access_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterAccessProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterAccessProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_access_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore - + get_access_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore @distributed_trace_async async def list_cluster_admin_credentials( - self, - resource_group_name: str, - resource_name: str, - server_fqdn: Optional[str] = None, - **kwargs: Any + self, resource_group_name: str, resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any ) -> _models.CredentialResults: """Lists the admin credentials of a managed cluster. Lists the admin credentials of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_admin_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, - template_url=self.list_cluster_admin_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_admin_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -467,25 +445,23 @@ async def list_cluster_admin_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_admin_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore - + list_cluster_admin_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore @distributed_trace_async async def list_cluster_user_credentials( @@ -501,40 +477,39 @@ async def list_cluster_user_credentials( Lists the user credentials of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :param format: Only apply to AAD clusters, specifies the format of returned kubeconfig. Format 'azure' will return azure auth-provider kubeconfig; format 'exec' will return exec format - kubeconfig, which requires kubelogin binary in the path. Default value is None. + kubeconfig, which requires kubelogin binary in the path. Known values are: "azure" and "exec". + Default value is None. :type format: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.Format :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, format=format, - template_url=self.list_cluster_user_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -542,68 +517,60 @@ async def list_cluster_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore - + list_cluster_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore @distributed_trace_async async def list_cluster_monitoring_user_credentials( - self, - resource_group_name: str, - resource_name: str, - server_fqdn: Optional[str] = None, - **kwargs: Any + self, resource_group_name: str, resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any ) -> _models.CredentialResults: """Lists the cluster monitoring user credentials of a managed cluster. Lists the cluster monitoring user credentials of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_monitoring_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, - template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_monitoring_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -611,64 +578,55 @@ async def list_cluster_monitoring_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_monitoring_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore - + list_cluster_monitoring_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore @distributed_trace_async - async def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.ManagedCluster: + async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.ManagedCluster: """Gets a managed cluster. Gets a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedCluster, or the result of cls(response) + :return: ManagedCluster or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedCluster - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -676,55 +634,54 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _create_or_update_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.ManagedCluster, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'ManagedCluster') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedCluster") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -732,10 +689,9 @@ async def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -743,25 +699,26 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - @distributed_trace_async + @overload async def begin_create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedCluster, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. @@ -769,11 +726,88 @@ async def begin_create_or_update( Creates or updates a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The managed cluster to create or update. + :param parameters: The managed cluster to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedCluster + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster to create or update. Is either a model type or a IO + type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedCluster or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -786,20 +820,17 @@ async def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -807,69 +838,66 @@ async def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _update_tags_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.TagsObject, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request_initial( - subscription_id=self._config.subscription_id, + request = build_update_tags_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_tags_initial.metadata['url'], + content=_content, + template_url=self._update_tags_initial.metadata["url"], headers=_headers, params=_params, ) @@ -877,32 +905,32 @@ async def _update_tags_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_tags_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _update_tags_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - @distributed_trace_async + @overload async def begin_update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. @@ -910,11 +938,88 @@ async def begin_update_tags( Updates tags on a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2022_06_02_preview.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates tags on a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates tags on a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_06_02_preview.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -927,20 +1032,17 @@ async def begin_update_tags( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, @@ -948,39 +1050,35 @@ async def begin_update_tags( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements self, @@ -989,25 +1087,22 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements ignore_pod_disruption_budget: Optional[bool] = None, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, ignore_pod_disruption_budget=ignore_pod_disruption_budget, - template_url=self._delete_initial.metadata['url'], + api_version=api_version, + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1015,10 +1110,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1028,11 +1122,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements + async def begin_delete( self, resource_group_name: str, resource_name: str, @@ -1044,8 +1137,9 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Deletes a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param ignore_pod_disruption_budget: ignore-pod-disruption-budget=true to delete those pods on a node without considering Pod Disruption Budget. Default value is None. @@ -1060,86 +1154,84 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, ignore_pod_disruption_budget=ignore_pod_disruption_budget, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore async def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterServicePrincipalProfile, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterServicePrincipalProfile") - request = build_reset_service_principal_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_service_principal_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_service_principal_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_service_principal_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1147,10 +1239,9 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1160,15 +1251,89 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist if cls: return cls(pipeline_response, None, {}) - _reset_service_principal_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + _reset_service_principal_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + + @overload + async def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.ManagedClusterServicePrincipalProfile, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset the Service Principal Profile of a managed cluster. + + This action cannot be performed on a cluster that is not using a service principal. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The service principal profile to set on the managed cluster. Required. + :type parameters: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterServicePrincipalProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset the Service Principal Profile of a managed cluster. + + This action cannot be performed on a cluster that is not using a service principal. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The service principal profile to set on the managed cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async - async def begin_reset_service_principal_profile( # pylint: disable=inconsistent-return-statements + async def begin_reset_service_principal_profile( self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterServicePrincipalProfile, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], **kwargs: Any ) -> AsyncLROPoller[None]: """Reset the Service Principal Profile of a managed cluster. @@ -1176,12 +1341,18 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent This action cannot be performed on a cluster that is not using a service principal. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The service principal profile to set on the managed cluster. + :param parameters: The service principal profile to set on the managed cluster. Is either a + model type or a IO type. Required. :type parameters: ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterServicePrincipalProfile + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -1192,20 +1363,17 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1213,67 +1381,68 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_service_principal_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + begin_reset_service_principal_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterAADProfile, + parameters: Union[_models.ManagedClusterAADProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterAADProfile") - request = build_reset_aad_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_aad_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_aad_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_aad_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1281,10 +1450,9 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1294,15 +1462,16 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta if cls: return cls(pipeline_response, None, {}) - _reset_aad_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + _reset_aad_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - - @distributed_trace_async - async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements + @overload + async def begin_reset_aad_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterAADProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: """Reset the AAD Profile of a managed cluster. @@ -1310,12 +1479,53 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem Reset the AAD Profile of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The AAD profile to set on the Managed Cluster. + :param parameters: The AAD profile to set on the Managed Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterAADProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset the AAD Profile of a managed cluster. + + Reset the AAD Profile of a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The AAD profile to set on the Managed Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -1326,20 +1536,54 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterAADProfile, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset the AAD Profile of a managed cluster. + + Reset the AAD Profile of a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The AAD profile to set on the Managed Cluster. Is either a model type or a + IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterAADProfile or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -1347,62 +1591,52 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_aad_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + begin_reset_aad_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_rotate_cluster_certificates_request_initial( - subscription_id=self._config.subscription_id, + request = build_rotate_cluster_certificates_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._rotate_cluster_certificates_initial.metadata['url'], + template_url=self._rotate_cluster_certificates_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1410,10 +1644,9 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1423,15 +1656,11 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- if cls: return cls(pipeline_response, None, {}) - _rotate_cluster_certificates_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore - + _rotate_cluster_certificates_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore @distributed_trace_async - async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + async def begin_rotate_cluster_certificates( + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Rotates the certificates of a managed cluster. @@ -1439,8 +1668,9 @@ async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-ret more details about rotating managed cluster certificates. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1452,80 +1682,67 @@ async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-ret Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._rotate_cluster_certificates_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_rotate_cluster_certificates.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore + begin_rotate_cluster_certificates.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore async def _rotate_service_account_signing_keys_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_rotate_service_account_signing_keys_request_initial( - subscription_id=self._config.subscription_id, + request = build_rotate_service_account_signing_keys_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._rotate_service_account_signing_keys_initial.metadata['url'], + template_url=self._rotate_service_account_signing_keys_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1533,10 +1750,9 @@ async def _rotate_service_account_signing_keys_initial( # pylint: disable=incon request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1546,23 +1762,20 @@ async def _rotate_service_account_signing_keys_initial( # pylint: disable=incon if cls: return cls(pipeline_response, None, {}) - _rotate_service_account_signing_keys_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateServiceAccountSigningKeys"} # type: ignore - + _rotate_service_account_signing_keys_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateServiceAccountSigningKeys"} # type: ignore @distributed_trace_async - async def begin_rotate_service_account_signing_keys( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + async def begin_rotate_service_account_signing_keys( + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Rotates the service account signing keys of a managed cluster. Rotates the service account signing keys of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1574,80 +1787,67 @@ async def begin_rotate_service_account_signing_keys( # pylint: disable=inconsis Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._rotate_service_account_signing_keys_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_rotate_service_account_signing_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateServiceAccountSigningKeys"} # type: ignore + begin_rotate_service_account_signing_keys.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateServiceAccountSigningKeys"} # type: ignore async def _stop_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_stop_request_initial( - subscription_id=self._config.subscription_id, + request = build_stop_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._stop_initial.metadata['url'], + template_url=self._stop_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1655,10 +1855,9 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1668,16 +1867,10 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore - + _stop_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore @distributed_trace_async - async def begin_stop( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: + async def begin_stop(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Stops a Managed Cluster. This can only be performed on Azure Virtual Machine Scale set backed clusters. Stopping a @@ -1687,8 +1880,9 @@ async def begin_stop( # pylint: disable=inconsistent-return-statements cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1700,80 +1894,67 @@ async def begin_stop( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._stop_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore + begin_stop.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore async def _start_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_start_request_initial( - subscription_id=self._config.subscription_id, + request = build_start_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._start_initial.metadata['url'], + template_url=self._start_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1781,10 +1962,9 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1794,24 +1974,19 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore - + _start_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore @distributed_trace_async - async def begin_start( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: + async def begin_start(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Starts a previously stopped Managed Cluster. See `starting a cluster `_ for more details about starting a cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1823,85 +1998,83 @@ async def begin_start( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._start_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore + begin_start.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore async def _run_command_initial( self, resource_group_name: str, resource_name: str, - request_payload: _models.RunCommandRequest, + request_payload: Union[_models.RunCommandRequest, IO], **kwargs: Any ) -> Optional[_models.RunCommandResult]: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RunCommandResult]] - _json = self._serialize.body(request_payload, 'RunCommandRequest') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(request_payload, (IO, bytes)): + _content = request_payload + else: + _json = self._serialize.body(request_payload, "RunCommandRequest") - request = build_run_command_request_initial( - subscription_id=self._config.subscription_id, + request = build_run_command_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._run_command_initial.metadata['url'], + content=_content, + template_url=self._run_command_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1909,10 +2082,9 @@ async def _run_command_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1921,22 +2093,23 @@ async def _run_command_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _run_command_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore + _run_command_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore - - @distributed_trace_async + @overload async def begin_run_command( self, resource_group_name: str, resource_name: str, request_payload: _models.RunCommandRequest, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.RunCommandResult]: """Submits a command to run against the Managed Cluster. @@ -1946,12 +2119,97 @@ async def begin_run_command( `_. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param request_payload: The run command request. + :param request_payload: The run command request. Required. :type request_payload: ~azure.mgmt.containerservice.v2022_06_02_preview.models.RunCommandRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RunCommandResult or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_06_02_preview.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_run_command( + self, + resource_group_name: str, + resource_name: str, + request_payload: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.RunCommandResult]: + """Submits a command to run against the Managed Cluster. + + AKS will create a pod to run the command. This is primarily useful for private clusters. For + more information see `AKS Run Command + `_. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param request_payload: The run command request. Required. + :type request_payload: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RunCommandResult or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_06_02_preview.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_run_command( + self, + resource_group_name: str, + resource_name: str, + request_payload: Union[_models.RunCommandRequest, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.RunCommandResult]: + """Submits a command to run against the Managed Cluster. + + AKS will create a pod to run the command. This is primarily useful for private clusters. For + more information see `AKS Run Command + `_. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param request_payload: The run command request. Is either a model type or a IO type. Required. + :type request_payload: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.RunCommandRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -1964,20 +2222,17 @@ async def begin_run_command( cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_06_02_preview.models.RunCommandResult] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.RunCommandResult] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.RunCommandResult] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._run_command_initial( # type: ignore resource_group_name=resource_group_name, @@ -1985,82 +2240,72 @@ async def begin_run_command( request_payload=request_payload, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_run_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore + begin_run_command.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore @distributed_trace_async async def get_command_result( - self, - resource_group_name: str, - resource_name: str, - command_id: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, command_id: str, **kwargs: Any ) -> Optional[_models.RunCommandResult]: """Gets the results of a command which has been run on the Managed Cluster. Gets the results of a command which has been run on the Managed Cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param command_id: Id of the command. + :param command_id: Id of the command. Required. :type command_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: RunCommandResult, or the result of cls(response) + :return: RunCommandResult or None or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.RunCommandResult or None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RunCommandResult]] - request = build_get_command_result_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, command_id=command_id, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_command_result.metadata['url'], + template_url=self.get_command_result.metadata["url"], headers=_headers, params=_params, ) @@ -2068,10 +2313,9 @@ async def get_command_result( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -2080,23 +2324,19 @@ async def get_command_result( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_command_result.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}"} # type: ignore - + get_command_result.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}"} # type: ignore @distributed_trace def list_outbound_network_dependencies_endpoints( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.OutboundEnvironmentEndpointCollection]: + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> AsyncIterable["_models.OutboundEnvironmentEndpoint"]: """Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster. @@ -2104,35 +2344,35 @@ def list_outbound_network_dependencies_endpoints( specified managed cluster. The operation returns properties of each egress endpoint. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OutboundEnvironmentEndpointCollection or the - result of cls(response) + :return: An iterator like instance of either OutboundEnvironmentEndpoint or the result of + cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_06_02_preview.models.OutboundEnvironmentEndpointCollection] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_06_02_preview.models.OutboundEnvironmentEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_outbound_network_dependencies_endpoints_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_outbound_network_dependencies_endpoints.metadata['url'], + template_url=self.list_outbound_network_dependencies_endpoints.metadata["url"], headers=_headers, params=_params, ) @@ -2140,16 +2380,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_outbound_network_dependencies_endpoints_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -2165,10 +2400,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -2178,8 +2411,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_outbound_network_dependencies_endpoints.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints"} # type: ignore + list_outbound_network_dependencies_endpoints.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_operations.py index 0531804ec4d7..cbbb1758702f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_operations.py @@ -7,9 +7,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,9 +27,11 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._operations import build_list_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class Operations: """ .. warning:: @@ -42,38 +51,33 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.OperationListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.OperationValue"]: """Gets a list of operations. Gets a list of operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationListResult or the result of cls(response) + :return: An iterator like instance of either OperationValue or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_06_02_preview.models.OperationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_06_02_preview.models.OperationValue] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -81,13 +85,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -103,10 +105,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -116,8 +116,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.ContainerService/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ContainerService/operations"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_private_endpoint_connections_operations.py index b4123e1f5965..a895ed2ed27c 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_private_endpoint_connections_operations.py @@ -6,9 +6,15 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -20,10 +26,17 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._private_endpoint_connections_operations import build_delete_request_initial, build_get_request, build_list_request, build_update_request -T = TypeVar('T') +from ...operations._private_endpoint_connections_operations import ( + build_delete_request, + build_get_request, + build_list_request, + build_update_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class PrivateEndpointConnectionsOperations: """ .. warning:: @@ -43,13 +56,9 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async async def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnectionListResult: """Gets a list of private endpoint connections in the specified managed cluster. @@ -57,33 +66,31 @@ async def list( https://docs.microsoft.com/azure/aks/private-clusters. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnectionListResult, or the result of cls(response) + :return: PrivateEndpointConnectionListResult or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.PrivateEndpointConnectionListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnectionListResult] - request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -91,33 +98,27 @@ async def list( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore - + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore @distributed_trace_async async def get( - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnection: """Gets the specified private endpoint connection. @@ -125,35 +126,33 @@ async def get( https://docs.microsoft.com/azure/aks/private-clusters. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -161,33 +160,33 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - - @distributed_trace_async + @overload async def update( self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, parameters: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateEndpointConnection: """Updates a private endpoint connection. @@ -195,42 +194,117 @@ async def update( Updates a private endpoint connection. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str - :param parameters: The updated private endpoint connection. + :param parameters: The updated private endpoint connection. Required. :type parameters: ~azure.mgmt.containerservice.v2022_06_02_preview.models.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: The updated private endpoint connection. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: Union[_models.PrivateEndpointConnection, IO], + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: The updated private endpoint connection. Is either a model type or a IO + type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.PrivateEndpointConnection or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - _json = self._serialize.body(parameters, 'PrivateEndpointConnection') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateEndpointConnection") request = build_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update.metadata['url'], + content=_content, + template_url=self.update.metadata["url"], headers=_headers, params=_params, ) @@ -238,52 +312,43 @@ async def update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -291,10 +356,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -304,26 +368,22 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + async def begin_delete( + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes a private endpoint connection. Deletes a private endpoint connection. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -335,53 +395,46 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_private_link_resources_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_private_link_resources_operations.py index 5666ff99f71e..2dabe15e553b 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_private_link_resources_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_private_link_resources_operations.py @@ -8,7 +8,13 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -19,9 +25,11 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._private_link_resources_operations import build_list_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class PrivateLinkResourcesOperations: """ .. warning:: @@ -41,13 +49,9 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async async def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.PrivateLinkResourcesListResult: """Gets a list of private link resources in the specified managed cluster. @@ -55,32 +59,30 @@ async def list( https://docs.microsoft.com/azure/aks/private-clusters. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResourcesListResult, or the result of cls(response) + :return: PrivateLinkResourcesListResult or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.PrivateLinkResourcesListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResourcesListResult] - request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -88,22 +90,20 @@ async def list( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResourcesListResult', pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources"} # type: ignore - + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_resolve_private_link_service_id_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_resolve_private_link_service_id_operations.py index 6cdb62e23c47..527a4e372e24 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_resolve_private_link_service_id_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_resolve_private_link_service_id_operations.py @@ -6,9 +6,15 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -19,9 +25,11 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._resolve_private_link_service_id_operations import build_post_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class ResolvePrivateLinkServiceIdOperations: """ .. warning:: @@ -41,13 +49,72 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @overload + async def post( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.PrivateLinkResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID for the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters required in order to resolve a private link service ID. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_06_02_preview.models.PrivateLinkResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def post( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID for the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters required in order to resolve a private link service ID. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def post( self, resource_group_name: str, resource_name: str, - parameters: _models.PrivateLinkResource, + parameters: Union[_models.PrivateLinkResource, IO], **kwargs: Any ) -> _models.PrivateLinkResource: """Gets the private link service ID for the specified managed cluster. @@ -55,38 +122,49 @@ async def post( Gets the private link service ID for the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters required in order to resolve a private link service ID. + :param parameters: Parameters required in order to resolve a private link service ID. Is either + a model type or a IO type. Required. :type parameters: ~azure.mgmt.containerservice.v2022_06_02_preview.models.PrivateLinkResource + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResource, or the result of cls(response) + :return: PrivateLinkResource or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.PrivateLinkResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResource] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResource] - _json = self._serialize.body(parameters, 'PrivateLinkResource') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateLinkResource") request = build_post_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.post.metadata['url'], + content=_content, + template_url=self.post.metadata["url"], headers=_headers, params=_params, ) @@ -94,22 +172,20 @@ async def post( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResource', pipeline_response) + deserialized = self._deserialize("PrivateLinkResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - post.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId"} # type: ignore - + post.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_snapshots_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_snapshots_operations.py index 7774f20edc49..b198396ddc3a 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_snapshots_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_snapshots_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,10 +27,19 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._snapshots_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_resource_group_request, build_list_request, build_update_tags_request -T = TypeVar('T') +from ...operations._snapshots_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_resource_group_request, + build_list_request, + build_update_tags_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class SnapshotsOperations: """ .. warning:: @@ -43,39 +59,34 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable[_models.SnapshotListResult]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.Snapshot"]: """Gets a list of snapshots in the specified subscription. Gets a list of snapshots in the specified subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SnapshotListResult or the result of cls(response) + :return: An iterator like instance of either Snapshot or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_06_02_preview.models.SnapshotListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_06_02_preview.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SnapshotListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -83,14 +94,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -106,10 +114,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -119,48 +125,42 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots"} # type: ignore @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.SnapshotListResult]: + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.Snapshot"]: """Lists snapshots in the specified subscription and resource group. Lists snapshots in the specified subscription and resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SnapshotListResult or the result of cls(response) + :return: An iterator like instance of either Snapshot or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_06_02_preview.models.SnapshotListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_06_02_preview.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SnapshotListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -168,15 +168,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -192,10 +188,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -205,50 +199,41 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots"} # type: ignore @distributed_trace_async - async def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.Snapshot: + async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.Snapshot: """Gets a snapshot. Gets a snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Snapshot, or the result of cls(response) + :return: Snapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.Snapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -256,32 +241,32 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - - @distributed_trace_async + @overload async def create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.Snapshot, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.Snapshot: """Creates or updates a snapshot. @@ -289,38 +274,102 @@ async def create_or_update( Creates or updates a snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The snapshot to create or update. + :param parameters: The snapshot to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_06_02_preview.models.Snapshot + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Snapshot, or the result of cls(response) + :return: Snapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.Snapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Snapshot: + """Creates or updates a snapshot. + + Creates or updates a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The snapshot to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.Snapshot, IO], **kwargs: Any + ) -> _models.Snapshot: + """Creates or updates a snapshot. + + Creates or updates a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The snapshot to create or update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.mgmt.containerservice.v2022_06_02_preview.models.Snapshot or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] - _json = self._serialize.body(parameters, 'Snapshot') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "Snapshot") request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) @@ -328,10 +377,9 @@ async def create_or_update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -339,25 +387,26 @@ async def create_or_update( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - @distributed_trace_async + @overload async def update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.Snapshot: """Updates tags on a snapshot. @@ -365,38 +414,102 @@ async def update_tags( Updates tags on a snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update snapshot Tags operation. + :param parameters: Parameters supplied to the Update snapshot Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2022_06_02_preview.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Snapshot: + """Updates tags on a snapshot. + + Updates tags on a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update snapshot Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Snapshot, or the result of cls(response) + :return: Snapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.Snapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @distributed_trace_async + async def update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> _models.Snapshot: + """Updates tags on a snapshot. + + Updates tags on a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update snapshot Tags operation. Is either a model + type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_06_02_preview.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") request = build_update_tags_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_tags.metadata['url'], + content=_content, + template_url=self.update_tags.metadata["url"], headers=_headers, params=_params, ) @@ -404,64 +517,57 @@ async def update_tags( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - + update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: """Deletes a snapshot. Deletes a snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) @@ -469,10 +575,9 @@ async def delete( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -482,5 +587,4 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - + delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_trusted_access_role_bindings_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_trusted_access_role_bindings_operations.py index e1f0dc3dd2c6..9f1798abe98d 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_trusted_access_role_bindings_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_trusted_access_role_bindings_operations.py @@ -6,10 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,10 +27,17 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._trusted_access_role_bindings_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_request -T = TypeVar('T') +from ...operations._trusted_access_role_bindings_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class TrustedAccessRoleBindingsOperations: """ .. warning:: @@ -43,48 +57,44 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> AsyncIterable[_models.TrustedAccessRoleBindingListResult]: + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> AsyncIterable["_models.TrustedAccessRoleBinding"]: """List trusted access role bindings. List trusted access role bindings. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either TrustedAccessRoleBindingListResult or the result - of cls(response) + :return: An iterator like instance of either TrustedAccessRoleBinding or the result of + cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_06_02_preview.models.TrustedAccessRoleBindingListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_06_02_preview.models.TrustedAccessRoleBinding] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.TrustedAccessRoleBindingListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.TrustedAccessRoleBindingListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -92,16 +102,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -117,10 +122,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -130,54 +133,46 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings"} # type: ignore @distributed_trace_async async def get( - self, - resource_group_name: str, - resource_name: str, - trusted_access_role_binding_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, trusted_access_role_binding_name: str, **kwargs: Any ) -> _models.TrustedAccessRoleBinding: """Get a trusted access role binding. Get a trusted access role binding. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param trusted_access_role_binding_name: The name of trusted access role binding. + :param trusted_access_role_binding_name: The name of trusted access role binding. Required. :type trusted_access_role_binding_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: TrustedAccessRoleBinding, or the result of cls(response) + :return: TrustedAccessRoleBinding or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.TrustedAccessRoleBinding - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.TrustedAccessRoleBinding] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.TrustedAccessRoleBinding] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, trusted_access_role_binding_name=trusted_access_role_binding_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -185,33 +180,33 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('TrustedAccessRoleBinding', pipeline_response) + deserialized = self._deserialize("TrustedAccessRoleBinding", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}"} # type: ignore - @distributed_trace_async + @overload async def create_or_update( self, resource_group_name: str, resource_name: str, trusted_access_role_binding_name: str, trusted_access_role_binding: _models.TrustedAccessRoleBinding, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.TrustedAccessRoleBinding: """Create or update a trusted access role binding. @@ -219,42 +214,117 @@ async def create_or_update( Create or update a trusted access role binding. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param trusted_access_role_binding_name: The name of trusted access role binding. + :param trusted_access_role_binding_name: The name of trusted access role binding. Required. :type trusted_access_role_binding_name: str - :param trusted_access_role_binding: A trusted access role binding. + :param trusted_access_role_binding: A trusted access role binding. Required. :type trusted_access_role_binding: ~azure.mgmt.containerservice.v2022_06_02_preview.models.TrustedAccessRoleBinding + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TrustedAccessRoleBinding or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.TrustedAccessRoleBinding + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + trusted_access_role_binding_name: str, + trusted_access_role_binding: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.TrustedAccessRoleBinding: + """Create or update a trusted access role binding. + + Create or update a trusted access role binding. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param trusted_access_role_binding_name: The name of trusted access role binding. Required. + :type trusted_access_role_binding_name: str + :param trusted_access_role_binding: A trusted access role binding. Required. + :type trusted_access_role_binding: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: TrustedAccessRoleBinding, or the result of cls(response) + :return: TrustedAccessRoleBinding or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.TrustedAccessRoleBinding - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + trusted_access_role_binding_name: str, + trusted_access_role_binding: Union[_models.TrustedAccessRoleBinding, IO], + **kwargs: Any + ) -> _models.TrustedAccessRoleBinding: + """Create or update a trusted access role binding. + + Create or update a trusted access role binding. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param trusted_access_role_binding_name: The name of trusted access role binding. Required. + :type trusted_access_role_binding_name: str + :param trusted_access_role_binding: A trusted access role binding. Is either a model type or a + IO type. Required. + :type trusted_access_role_binding: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.TrustedAccessRoleBinding or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TrustedAccessRoleBinding or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.TrustedAccessRoleBinding + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.TrustedAccessRoleBinding] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.TrustedAccessRoleBinding] - _json = self._serialize.body(trusted_access_role_binding, 'TrustedAccessRoleBinding') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(trusted_access_role_binding, (IO, bytes)): + _content = trusted_access_role_binding + else: + _json = self._serialize.body(trusted_access_role_binding, "TrustedAccessRoleBinding") request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, trusted_access_role_binding_name=trusted_access_role_binding_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) @@ -262,68 +332,60 @@ async def create_or_update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('TrustedAccessRoleBinding', pipeline_response) + deserialized = self._deserialize("TrustedAccessRoleBinding", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}"} # type: ignore - + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}"} # type: ignore @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - trusted_access_role_binding_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, trusted_access_role_binding_name: str, **kwargs: Any ) -> None: """Delete a trusted access role binding. Delete a trusted access role binding. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param trusted_access_role_binding_name: The name of trusted access role binding. + :param trusted_access_role_binding_name: The name of trusted access role binding. Required. :type trusted_access_role_binding_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, trusted_access_role_binding_name=trusted_access_role_binding_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) @@ -331,10 +393,9 @@ async def delete( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -344,5 +405,4 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}"} # type: ignore - + delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_trusted_access_roles_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_trusted_access_roles_operations.py index 762e95d442b6..2ffbc1cca901 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_trusted_access_roles_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_trusted_access_roles_operations.py @@ -7,9 +7,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,9 +27,11 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._trusted_access_roles_operations import build_list_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class TrustedAccessRolesOperations: """ .. warning:: @@ -42,44 +51,37 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - location: str, - **kwargs: Any - ) -> AsyncIterable[_models.TrustedAccessRoleListResult]: + def list(self, location: str, **kwargs: Any) -> AsyncIterable["_models.TrustedAccessRole"]: """List supported trusted access roles. List supported trusted access roles. - :param location: The name of Azure region. + :param location: The name of Azure region. Required. :type location: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either TrustedAccessRoleListResult or the result of - cls(response) + :return: An iterator like instance of either TrustedAccessRole or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_06_02_preview.models.TrustedAccessRoleListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_06_02_preview.models.TrustedAccessRole] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.TrustedAccessRoleListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.TrustedAccessRoleListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( - subscription_id=self._config.subscription_id, location=location, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -87,15 +89,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - location=location, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -111,10 +109,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -124,8 +120,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/trustedAccessRoles"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/trustedAccessRoles"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/models/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/models/__init__.py index ed73aaf1cee2..899f2af2a175 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/models/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/models/__init__.py @@ -129,217 +129,215 @@ from ._models_py3 import UserAssignedIdentity from ._models_py3 import WindowsGmsaProfile - -from ._container_service_client_enums import ( - AgentPoolMode, - AgentPoolType, - Code, - ConnectionStatus, - ContainerServiceStorageProfileTypes, - ContainerServiceVMSizeTypes, - Count, - CreatedByType, - Expander, - ExtendedLocationTypes, - FleetMemberProvisioningState, - FleetProvisioningState, - Format, - GPUInstanceProfile, - IpFamily, - KeyVaultNetworkAccessTypes, - KubeletDiskType, - LicenseType, - LoadBalancerSku, - ManagedClusterPodIdentityProvisioningState, - ManagedClusterSKUName, - ManagedClusterSKUTier, - NetworkMode, - NetworkPlugin, - NetworkPluginMode, - NetworkPolicy, - OSDiskType, - OSSKU, - OSType, - OutboundType, - PrivateEndpointConnectionProvisioningState, - PublicNetworkAccess, - ResourceIdentityType, - ScaleDownMode, - ScaleSetEvictionPolicy, - ScaleSetPriority, - SnapshotType, - TrustedAccessRoleBindingProvisioningState, - UpgradeChannel, - WeekDay, - WorkloadRuntime, -) +from ._container_service_client_enums import AgentPoolMode +from ._container_service_client_enums import AgentPoolType +from ._container_service_client_enums import Code +from ._container_service_client_enums import ConnectionStatus +from ._container_service_client_enums import ContainerServiceStorageProfileTypes +from ._container_service_client_enums import ContainerServiceVMSizeTypes +from ._container_service_client_enums import Count +from ._container_service_client_enums import CreatedByType +from ._container_service_client_enums import Expander +from ._container_service_client_enums import ExtendedLocationTypes +from ._container_service_client_enums import FleetMemberProvisioningState +from ._container_service_client_enums import FleetProvisioningState +from ._container_service_client_enums import Format +from ._container_service_client_enums import GPUInstanceProfile +from ._container_service_client_enums import IpFamily +from ._container_service_client_enums import KeyVaultNetworkAccessTypes +from ._container_service_client_enums import KubeletDiskType +from ._container_service_client_enums import LicenseType +from ._container_service_client_enums import LoadBalancerSku +from ._container_service_client_enums import ManagedClusterPodIdentityProvisioningState +from ._container_service_client_enums import ManagedClusterSKUName +from ._container_service_client_enums import ManagedClusterSKUTier +from ._container_service_client_enums import NetworkMode +from ._container_service_client_enums import NetworkPlugin +from ._container_service_client_enums import NetworkPluginMode +from ._container_service_client_enums import NetworkPolicy +from ._container_service_client_enums import OSDiskType +from ._container_service_client_enums import OSSKU +from ._container_service_client_enums import OSType +from ._container_service_client_enums import OutboundType +from ._container_service_client_enums import PrivateEndpointConnectionProvisioningState +from ._container_service_client_enums import PublicNetworkAccess +from ._container_service_client_enums import ResourceIdentityType +from ._container_service_client_enums import ScaleDownMode +from ._container_service_client_enums import ScaleSetEvictionPolicy +from ._container_service_client_enums import ScaleSetPriority +from ._container_service_client_enums import SnapshotType +from ._container_service_client_enums import TrustedAccessRoleBindingProvisioningState +from ._container_service_client_enums import UpgradeChannel +from ._container_service_client_enums import WeekDay +from ._container_service_client_enums import WorkloadRuntime from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'AgentPool', - 'AgentPoolAvailableVersions', - 'AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem', - 'AgentPoolListResult', - 'AgentPoolUpgradeProfile', - 'AgentPoolUpgradeProfilePropertiesUpgradesItem', - 'AgentPoolUpgradeSettings', - 'AzureEntityResource', - 'AzureKeyVaultKms', - 'CloudErrorBody', - 'ContainerServiceDiagnosticsProfile', - 'ContainerServiceLinuxProfile', - 'ContainerServiceMasterProfile', - 'ContainerServiceNetworkProfile', - 'ContainerServiceSshConfiguration', - 'ContainerServiceSshPublicKey', - 'ContainerServiceVMDiagnostics', - 'CreationData', - 'CredentialResult', - 'CredentialResults', - 'EndpointDependency', - 'EndpointDetail', - 'ErrorAdditionalInfo', - 'ErrorDetail', - 'ErrorResponse', - 'ExtendedLocation', - 'Fleet', - 'FleetCredentialResult', - 'FleetCredentialResults', - 'FleetHubProfile', - 'FleetListResult', - 'FleetMember', - 'FleetMembersListResult', - 'FleetPatch', - 'KubeletConfig', - 'LinuxOSConfig', - 'MaintenanceConfiguration', - 'MaintenanceConfigurationListResult', - 'ManagedCluster', - 'ManagedClusterAADProfile', - 'ManagedClusterAPIServerAccessProfile', - 'ManagedClusterAccessProfile', - 'ManagedClusterAddonProfile', - 'ManagedClusterAddonProfileIdentity', - 'ManagedClusterAgentPoolProfile', - 'ManagedClusterAgentPoolProfileProperties', - 'ManagedClusterAutoUpgradeProfile', - 'ManagedClusterHTTPProxyConfig', - 'ManagedClusterIdentity', - 'ManagedClusterIngressProfile', - 'ManagedClusterIngressProfileWebAppRouting', - 'ManagedClusterListResult', - 'ManagedClusterLoadBalancerProfile', - 'ManagedClusterLoadBalancerProfileManagedOutboundIPs', - 'ManagedClusterLoadBalancerProfileOutboundIPPrefixes', - 'ManagedClusterLoadBalancerProfileOutboundIPs', - 'ManagedClusterManagedOutboundIPProfile', - 'ManagedClusterNATGatewayProfile', - 'ManagedClusterOIDCIssuerProfile', - 'ManagedClusterPodIdentity', - 'ManagedClusterPodIdentityException', - 'ManagedClusterPodIdentityProfile', - 'ManagedClusterPodIdentityProvisioningError', - 'ManagedClusterPodIdentityProvisioningErrorBody', - 'ManagedClusterPodIdentityProvisioningInfo', - 'ManagedClusterPoolUpgradeProfile', - 'ManagedClusterPoolUpgradeProfileUpgradesItem', - 'ManagedClusterPropertiesAutoScalerProfile', - 'ManagedClusterPropertiesForSnapshot', - 'ManagedClusterSKU', - 'ManagedClusterSecurityProfile', - 'ManagedClusterSecurityProfileDefender', - 'ManagedClusterSecurityProfileDefenderSecurityMonitoring', - 'ManagedClusterSecurityProfileNodeRestriction', - 'ManagedClusterSecurityProfileWorkloadIdentity', - 'ManagedClusterServicePrincipalProfile', - 'ManagedClusterSnapshot', - 'ManagedClusterSnapshotListResult', - 'ManagedClusterStorageProfile', - 'ManagedClusterStorageProfileBlobCSIDriver', - 'ManagedClusterStorageProfileDiskCSIDriver', - 'ManagedClusterStorageProfileFileCSIDriver', - 'ManagedClusterStorageProfileSnapshotController', - 'ManagedClusterUpgradeProfile', - 'ManagedClusterWindowsProfile', - 'ManagedClusterWorkloadAutoScalerProfile', - 'ManagedClusterWorkloadAutoScalerProfileKeda', - 'ManagedServiceIdentityUserAssignedIdentitiesValue', - 'NetworkProfileForSnapshot', - 'OSOptionProfile', - 'OSOptionProperty', - 'OperationListResult', - 'OperationValue', - 'OutboundEnvironmentEndpoint', - 'OutboundEnvironmentEndpointCollection', - 'PowerState', - 'PrivateEndpoint', - 'PrivateEndpointConnection', - 'PrivateEndpointConnectionListResult', - 'PrivateLinkResource', - 'PrivateLinkResourcesListResult', - 'PrivateLinkServiceConnectionState', - 'Resource', - 'ResourceReference', - 'RunCommandRequest', - 'RunCommandResult', - 'Snapshot', - 'SnapshotListResult', - 'SubResource', - 'SysctlConfig', - 'SystemData', - 'TagsObject', - 'TimeInWeek', - 'TimeSpan', - 'TrackedResource', - 'TrustedAccessRole', - 'TrustedAccessRoleBinding', - 'TrustedAccessRoleBindingListResult', - 'TrustedAccessRoleListResult', - 'TrustedAccessRoleRule', - 'UserAssignedIdentity', - 'WindowsGmsaProfile', - 'AgentPoolMode', - 'AgentPoolType', - 'Code', - 'ConnectionStatus', - 'ContainerServiceStorageProfileTypes', - 'ContainerServiceVMSizeTypes', - 'Count', - 'CreatedByType', - 'Expander', - 'ExtendedLocationTypes', - 'FleetMemberProvisioningState', - 'FleetProvisioningState', - 'Format', - 'GPUInstanceProfile', - 'IpFamily', - 'KeyVaultNetworkAccessTypes', - 'KubeletDiskType', - 'LicenseType', - 'LoadBalancerSku', - 'ManagedClusterPodIdentityProvisioningState', - 'ManagedClusterSKUName', - 'ManagedClusterSKUTier', - 'NetworkMode', - 'NetworkPlugin', - 'NetworkPluginMode', - 'NetworkPolicy', - 'OSDiskType', - 'OSSKU', - 'OSType', - 'OutboundType', - 'PrivateEndpointConnectionProvisioningState', - 'PublicNetworkAccess', - 'ResourceIdentityType', - 'ScaleDownMode', - 'ScaleSetEvictionPolicy', - 'ScaleSetPriority', - 'SnapshotType', - 'TrustedAccessRoleBindingProvisioningState', - 'UpgradeChannel', - 'WeekDay', - 'WorkloadRuntime', + "AgentPool", + "AgentPoolAvailableVersions", + "AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem", + "AgentPoolListResult", + "AgentPoolUpgradeProfile", + "AgentPoolUpgradeProfilePropertiesUpgradesItem", + "AgentPoolUpgradeSettings", + "AzureEntityResource", + "AzureKeyVaultKms", + "CloudErrorBody", + "ContainerServiceDiagnosticsProfile", + "ContainerServiceLinuxProfile", + "ContainerServiceMasterProfile", + "ContainerServiceNetworkProfile", + "ContainerServiceSshConfiguration", + "ContainerServiceSshPublicKey", + "ContainerServiceVMDiagnostics", + "CreationData", + "CredentialResult", + "CredentialResults", + "EndpointDependency", + "EndpointDetail", + "ErrorAdditionalInfo", + "ErrorDetail", + "ErrorResponse", + "ExtendedLocation", + "Fleet", + "FleetCredentialResult", + "FleetCredentialResults", + "FleetHubProfile", + "FleetListResult", + "FleetMember", + "FleetMembersListResult", + "FleetPatch", + "KubeletConfig", + "LinuxOSConfig", + "MaintenanceConfiguration", + "MaintenanceConfigurationListResult", + "ManagedCluster", + "ManagedClusterAADProfile", + "ManagedClusterAPIServerAccessProfile", + "ManagedClusterAccessProfile", + "ManagedClusterAddonProfile", + "ManagedClusterAddonProfileIdentity", + "ManagedClusterAgentPoolProfile", + "ManagedClusterAgentPoolProfileProperties", + "ManagedClusterAutoUpgradeProfile", + "ManagedClusterHTTPProxyConfig", + "ManagedClusterIdentity", + "ManagedClusterIngressProfile", + "ManagedClusterIngressProfileWebAppRouting", + "ManagedClusterListResult", + "ManagedClusterLoadBalancerProfile", + "ManagedClusterLoadBalancerProfileManagedOutboundIPs", + "ManagedClusterLoadBalancerProfileOutboundIPPrefixes", + "ManagedClusterLoadBalancerProfileOutboundIPs", + "ManagedClusterManagedOutboundIPProfile", + "ManagedClusterNATGatewayProfile", + "ManagedClusterOIDCIssuerProfile", + "ManagedClusterPodIdentity", + "ManagedClusterPodIdentityException", + "ManagedClusterPodIdentityProfile", + "ManagedClusterPodIdentityProvisioningError", + "ManagedClusterPodIdentityProvisioningErrorBody", + "ManagedClusterPodIdentityProvisioningInfo", + "ManagedClusterPoolUpgradeProfile", + "ManagedClusterPoolUpgradeProfileUpgradesItem", + "ManagedClusterPropertiesAutoScalerProfile", + "ManagedClusterPropertiesForSnapshot", + "ManagedClusterSKU", + "ManagedClusterSecurityProfile", + "ManagedClusterSecurityProfileDefender", + "ManagedClusterSecurityProfileDefenderSecurityMonitoring", + "ManagedClusterSecurityProfileNodeRestriction", + "ManagedClusterSecurityProfileWorkloadIdentity", + "ManagedClusterServicePrincipalProfile", + "ManagedClusterSnapshot", + "ManagedClusterSnapshotListResult", + "ManagedClusterStorageProfile", + "ManagedClusterStorageProfileBlobCSIDriver", + "ManagedClusterStorageProfileDiskCSIDriver", + "ManagedClusterStorageProfileFileCSIDriver", + "ManagedClusterStorageProfileSnapshotController", + "ManagedClusterUpgradeProfile", + "ManagedClusterWindowsProfile", + "ManagedClusterWorkloadAutoScalerProfile", + "ManagedClusterWorkloadAutoScalerProfileKeda", + "ManagedServiceIdentityUserAssignedIdentitiesValue", + "NetworkProfileForSnapshot", + "OSOptionProfile", + "OSOptionProperty", + "OperationListResult", + "OperationValue", + "OutboundEnvironmentEndpoint", + "OutboundEnvironmentEndpointCollection", + "PowerState", + "PrivateEndpoint", + "PrivateEndpointConnection", + "PrivateEndpointConnectionListResult", + "PrivateLinkResource", + "PrivateLinkResourcesListResult", + "PrivateLinkServiceConnectionState", + "Resource", + "ResourceReference", + "RunCommandRequest", + "RunCommandResult", + "Snapshot", + "SnapshotListResult", + "SubResource", + "SysctlConfig", + "SystemData", + "TagsObject", + "TimeInWeek", + "TimeSpan", + "TrackedResource", + "TrustedAccessRole", + "TrustedAccessRoleBinding", + "TrustedAccessRoleBindingListResult", + "TrustedAccessRoleListResult", + "TrustedAccessRoleRule", + "UserAssignedIdentity", + "WindowsGmsaProfile", + "AgentPoolMode", + "AgentPoolType", + "Code", + "ConnectionStatus", + "ContainerServiceStorageProfileTypes", + "ContainerServiceVMSizeTypes", + "Count", + "CreatedByType", + "Expander", + "ExtendedLocationTypes", + "FleetMemberProvisioningState", + "FleetProvisioningState", + "Format", + "GPUInstanceProfile", + "IpFamily", + "KeyVaultNetworkAccessTypes", + "KubeletDiskType", + "LicenseType", + "LoadBalancerSku", + "ManagedClusterPodIdentityProvisioningState", + "ManagedClusterSKUName", + "ManagedClusterSKUTier", + "NetworkMode", + "NetworkPlugin", + "NetworkPluginMode", + "NetworkPolicy", + "OSDiskType", + "OSSKU", + "OSType", + "OutboundType", + "PrivateEndpointConnectionProvisioningState", + "PublicNetworkAccess", + "ResourceIdentityType", + "ScaleDownMode", + "ScaleSetEvictionPolicy", + "ScaleSetPriority", + "SnapshotType", + "TrustedAccessRoleBindingProvisioningState", + "UpgradeChannel", + "WeekDay", + "WorkloadRuntime", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/models/_container_service_client_enums.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/models/_container_service_client_enums.py index bf7736134910..dae6a1a88096 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/models/_container_service_client_enums.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/models/_container_service_client_enums.py @@ -13,7 +13,7 @@ class AgentPoolMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools + https://docs.microsoft.com/azure/aks/use-system-pools. """ #: System agent pools are primarily for hosting critical system pods such as CoreDNS and @@ -23,33 +23,34 @@ class AgentPoolMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: User agent pools are primarily for hosting your application pods. USER = "User" + class AgentPoolType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of Agent Pool. - """ + """The type of Agent Pool.""" #: Create an Agent Pool backed by a Virtual Machine Scale Set. VIRTUAL_MACHINE_SCALE_SETS = "VirtualMachineScaleSets" #: Use of this is strongly discouraged. AVAILABILITY_SET = "AvailabilitySet" + class Code(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Tells whether the cluster is Running or Stopped - """ + """Tells whether the cluster is Running or Stopped.""" #: The cluster is running. RUNNING = "Running" #: The cluster is stopped. STOPPED = "Stopped" + class ConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The private link service connection status. - """ + """The private link service connection status.""" PENDING = "Pending" APPROVED = "Approved" REJECTED = "Rejected" DISCONNECTED = "Disconnected" + class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Specifies what kind of storage to use. If omitted, the default will be chosen on your behalf based on the choice of orchestrator. @@ -58,9 +59,9 @@ class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEn STORAGE_ACCOUNT = "StorageAccount" MANAGED_DISKS = "ManagedDisks" + class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Size of agent VMs. Note: This is no longer maintained. - """ + """Size of agent VMs. Note: This is no longer maintained.""" STANDARD_A1 = "Standard_A1" STANDARD_A10 = "Standard_A10" @@ -237,6 +238,7 @@ class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): STANDARD_NV24 = "Standard_NV24" STANDARD_NV6 = "Standard_NV6" + class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): """Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, and 5. The default value is 1. @@ -246,15 +248,16 @@ class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): THREE = 3 FIVE = 5 + class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of identity that created the resource. - """ + """The type of identity that created the resource.""" USER = "User" APPLICATION = "Application" MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" + class Expander(str, Enum, metaclass=CaseInsensitiveEnumMeta): """If not specified, the default is 'random'. See `expanders `_ @@ -278,15 +281,15 @@ class Expander(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Used when you don't have a particular need for the node groups to scale differently. RANDOM = "random" + class ExtendedLocationTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of extendedLocation. - """ + """The type of extendedLocation.""" EDGE_ZONE = "EdgeZone" + class FleetMemberProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The provisioning state of the last accepted operation. - """ + """The provisioning state of the last accepted operation.""" SUCCEEDED = "Succeeded" FAILED = "Failed" @@ -295,9 +298,9 @@ class FleetMemberProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta) LEAVING = "Leaving" UPDATING = "Updating" + class FleetProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The provisioning state of the last accepted operation. - """ + """The provisioning state of the last accepted operation.""" SUCCEEDED = "Succeeded" FAILED = "Failed" @@ -306,17 +309,19 @@ class FleetProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): DELETING = "Deleting" UPDATING = "Updating" + class Format(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Format.""" #: Return azure auth-provider kubeconfig. This format is deprecated in 1.22 and will be fully #: removed in 1.25. AZURE = "azure" #: Return exec format kubeconfig. This format requires kubelogin binary in the path. - EXEC_ENUM = "exec" + EXEC = "exec" + class GPUInstanceProfile(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """GPUInstanceProfile to be used to specify GPU MIG instance profile for supported GPU VM SKU. - """ + """GPUInstanceProfile to be used to specify GPU MIG instance profile for supported GPU VM SKU.""" MIG1_G = "MIG1g" MIG2_G = "MIG2g" @@ -324,13 +329,14 @@ class GPUInstanceProfile(str, Enum, metaclass=CaseInsensitiveEnumMeta): MIG4_G = "MIG4g" MIG7_G = "MIG7g" + class IpFamily(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The IP version to use for cluster networking and IP assignment. - """ + """The IP version to use for cluster networking and IP assignment.""" I_PV4 = "IPv4" I_PV6 = "IPv6" + class KeyVaultNetworkAccessTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Network access of key vault. The possible values are ``Public`` and ``Private``. ``Public`` means the key vault allows public access from all networks. ``Private`` means the key vault @@ -340,6 +346,7 @@ class KeyVaultNetworkAccessTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): PUBLIC = "Public" PRIVATE = "Private" + class KubeletDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. @@ -350,6 +357,7 @@ class KubeletDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Kubelet will use the temporary disk for its data. TEMPORARY = "Temporary" + class LicenseType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The license type to use for Windows VMs. See `Azure Hybrid User Benefits `_ for more details. @@ -360,6 +368,7 @@ class LicenseType(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Enables Azure Hybrid User Benefits for Windows VMs. WINDOWS_SERVER = "Windows_Server" + class LoadBalancerSku(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The default is 'standard'. See `Azure Load Balancer SKUs `_ for more information about the @@ -373,21 +382,22 @@ class LoadBalancerSku(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Use a basic Load Balancer with limited functionality. BASIC = "basic" + class ManagedClusterPodIdentityProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The current provisioning state of the pod identity. - """ + """The current provisioning state of the pod identity.""" ASSIGNED = "Assigned" UPDATING = "Updating" DELETING = "Deleting" FAILED = "Failed" + class ManagedClusterSKUName(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The name of a managed cluster SKU. - """ + """The name of a managed cluster SKU.""" BASIC = "Basic" + class ManagedClusterSKUTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): """If not specified, the default is 'Free'. See `uptime SLA `_ for more details. @@ -399,20 +409,20 @@ class ManagedClusterSKUTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: No guaranteed SLA, no additional charges. Free tier clusters have an SLO of 99.5%. FREE = "Free" + class NetworkMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """This cannot be specified if networkPlugin is anything other than 'azure'. - """ + """This cannot be specified if networkPlugin is anything other than 'azure'.""" #: No bridge is created. Intra-VM Pod to Pod communication is through IP routes created by Azure #: CNI. See `Transparent Mode `_ for #: more information. TRANSPARENT = "transparent" - #: This is no longer supported. + #: This is no longer supported BRIDGE = "bridge" + class NetworkPlugin(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Network plugin used for building the Kubernetes network. - """ + """Network plugin used for building the Kubernetes network.""" #: Use the Azure CNI network plugin. See `Azure CNI (advanced) networking #: `_ for @@ -426,17 +436,17 @@ class NetworkPlugin(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: networking functionality. NONE = "none" + class NetworkPluginMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The mode the network plugin should use. - """ + """The mode the network plugin should use.""" #: Pods are given IPs from the PodCIDR address space but use Azure Routing Domains rather than #: Kubenet reference plugins host-local and bridge. OVERLAY = "Overlay" + class NetworkPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Network policy used for building the Kubernetes network. - """ + """Network policy used for building the Kubernetes network.""" #: Use Calico network policies. See `differences between Azure and Calico policies #: `_ @@ -447,6 +457,7 @@ class NetworkPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: for more information. AZURE = "azure" + class OSDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more @@ -463,6 +474,7 @@ class OSDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: provides lower read/write latency, along with faster node scaling and cluster upgrades. EPHEMERAL = "Ephemeral" + class OSSKU(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Specifies the OS SKU used by the agent pool. If not specified, the default is Ubuntu if OSType=Linux or Windows2019 if OSType=Windows. And the default Windows OSSKU will be changed to @@ -474,15 +486,16 @@ class OSSKU(str, Enum, metaclass=CaseInsensitiveEnumMeta): WINDOWS2019 = "Windows2019" WINDOWS2022 = "Windows2022" + class OSType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The operating system type. The default is Linux. - """ + """The operating system type. The default is Linux.""" #: Use Linux. LINUX = "Linux" #: Use Windows. WINDOWS = "Windows" + class OutboundType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """This can only be set at cluster creation time and cannot be changed later. For more information see `egress outbound type `_. @@ -503,22 +516,23 @@ class OutboundType(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: advanced scenario and requires proper network configuration. USER_ASSIGNED_NAT_GATEWAY = "userAssignedNATGateway" + class PrivateEndpointConnectionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The current provisioning state. - """ + """The current provisioning state.""" SUCCEEDED = "Succeeded" CREATING = "Creating" DELETING = "Deleting" FAILED = "Failed" + class PublicNetworkAccess(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Allow or deny public network access for AKS - """ + """Allow or deny public network access for AKS.""" ENABLED = "Enabled" DISABLED = "Disabled" + class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """For more information see `use managed identities in AKS `_. @@ -535,6 +549,7 @@ class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Do not use a managed identity for the Managed Cluster, service principal will be used instead. NONE = "None" + class ScaleDownMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Describes how VMs are added to or removed from Agent Pools. See `billing states `_. @@ -546,10 +561,11 @@ class ScaleDownMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: during scale down. DEALLOCATE = "Deallocate" + class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The eviction policy specifies what to do with the VM when it is evicted. The default is Delete. For more information about eviction see `spot VMs - `_ + `_. """ #: Nodes in the underlying Scale Set of the node pool are deleted when they're evicted. @@ -559,9 +575,9 @@ class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: cause issues with cluster scaling or upgrading. DEALLOCATE = "Deallocate" + class ScaleSetPriority(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The Virtual Machine Scale Set priority. - """ + """The Virtual Machine Scale Set priority.""" #: Spot priority VMs will be used. There is no SLA for spot nodes. See `spot on AKS #: `_ for more information. @@ -569,24 +585,25 @@ class ScaleSetPriority(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Regular VMs will be used. REGULAR = "Regular" + class SnapshotType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of a snapshot. The default is NodePool. - """ + """The type of a snapshot. The default is NodePool.""" #: The snapshot is a snapshot of a node pool. NODE_POOL = "NodePool" #: The snapshot is a snapshot of a managed cluster. MANAGED_CLUSTER = "ManagedCluster" + class TrustedAccessRoleBindingProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The current provisioning state of trusted access role binding. - """ + """The current provisioning state of trusted access role binding.""" SUCCEEDED = "Succeeded" FAILED = "Failed" UPDATING = "Updating" DELETING = "Deleting" + class UpgradeChannel(str, Enum, metaclass=CaseInsensitiveEnumMeta): """For more information see `setting the AKS cluster auto-upgrade channel `_. @@ -617,9 +634,9 @@ class UpgradeChannel(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Disables auto-upgrades and keeps the cluster at its current version of Kubernetes. NONE = "none" + class WeekDay(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The weekday enum. - """ + """The weekday enum.""" SUNDAY = "Sunday" MONDAY = "Monday" @@ -629,9 +646,9 @@ class WeekDay(str, Enum, metaclass=CaseInsensitiveEnumMeta): FRIDAY = "Friday" SATURDAY = "Saturday" + class WorkloadRuntime(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Determines the type of workload a node can run. - """ + """Determines the type of workload a node can run.""" #: Nodes will use Kubelet to run standard OCI container workloads. OCI_CONTAINER = "OCIContainer" diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/models/_models_py3.py index 519a0d572f25..60ca494d4d08 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/models/_models_py3.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/models/_models_py3.py @@ -1,4 +1,5 @@ # coding=utf-8 +# pylint: disable=too-many-lines # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -9,15 +10,14 @@ import datetime from typing import Dict, List, Optional, TYPE_CHECKING, Union -from azure.core.exceptions import HttpResponseError -import msrest.serialization +from ... import _serialization if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - import __init__ as _models + from .. import models as _models -class SubResource(msrest.serialization.Model): +class SubResource(_serialization.Model): """Reference to another subresource. Variables are only populated by the server, and will be ignored when sending a request. @@ -32,30 +32,26 @@ class SubResource(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(SubResource, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.id = None self.name = None self.type = None -class AgentPool(SubResource): +class AgentPool(SubResource): # pylint: disable=too-many-instance-attributes """Agent Pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -83,15 +79,15 @@ class AgentPool(SubResource): larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.OSDiskType :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data - root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.KubeletDiskType :ivar workload_runtime: Determines the type of workload a node can run. Known values are: - "OCIContainer", "WasmWasi". + "OCIContainer" and "WasmWasi". :vartype workload_runtime: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.WorkloadRuntime :ivar message_of_the_day: A base64-encoded string which will be written to /etc/motd after @@ -110,13 +106,13 @@ class AgentPool(SubResource): :vartype pod_subnet_id: str :ivar max_pods: The maximum number of pods that can run on a node. :vartype max_pods: int - :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.OSType :ivar os_sku: Specifies the OS SKU used by the agent pool. If not specified, the default is Ubuntu if OSType=Linux or Windows2019 if OSType=Windows. And the default Windows OSSKU will be changed to Windows2022 after Windows2019 is deprecated. Known values are: "Ubuntu", - "CBLMariner", "Windows2019", "Windows2022". + "CBLMariner", "Windows2019", and "Windows2022". :vartype os_sku: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.OSSKU :ivar max_count: The maximum number of nodes for auto-scaling. :vartype max_count: int @@ -125,16 +121,16 @@ class AgentPool(SubResource): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it - defaults to Delete. Known values are: "Delete", "Deallocate". + defaults to Delete. Known values are: "Delete" and "Deallocate". :vartype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.ScaleDownMode - :ivar type_properties_type: The type of Agent Pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + :ivar type_properties_type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets" + and "AvailabilitySet". :vartype type_properties_type: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.AgentPoolType :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :vartype mode: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.AgentPoolMode :ivar orchestrator_version: Both patch version and are supported. When is specified, the latest supported patch version is chosen @@ -180,20 +176,18 @@ class AgentPool(SubResource): /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default - is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + is 'Regular'. Known values are: "Spot" and "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.ScaleSetPriority :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.ScaleSetEvictionPolicy :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :vartype spot_max_price: float - :ivar tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :ivar tags: The tags to be persisted on the agent pool virtual machine scale set. :vartype tags: dict[str, str] :ivar node_labels: The node labels to be persisted across all nodes in agent pool. :vartype node_labels: dict[str, str] @@ -217,7 +211,7 @@ class AgentPool(SubResource): for more details. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.GPUInstanceProfile :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the node pool @@ -234,66 +228,66 @@ class AgentPool(SubResource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'os_disk_size_gb': {'maximum': 2048, 'minimum': 0}, - 'current_orchestrator_version': {'readonly': True}, - 'node_image_version': {'readonly': True}, - 'provisioning_state': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "os_disk_size_gb": {"maximum": 2048, "minimum": 0}, + "current_orchestrator_version": {"readonly": True}, + "node_image_version": {"readonly": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'count': {'key': 'properties.count', 'type': 'int'}, - 'vm_size': {'key': 'properties.vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'properties.osDiskSizeGB', 'type': 'int'}, - 'os_disk_type': {'key': 'properties.osDiskType', 'type': 'str'}, - 'kubelet_disk_type': {'key': 'properties.kubeletDiskType', 'type': 'str'}, - 'workload_runtime': {'key': 'properties.workloadRuntime', 'type': 'str'}, - 'message_of_the_day': {'key': 'properties.messageOfTheDay', 'type': 'str'}, - 'vnet_subnet_id': {'key': 'properties.vnetSubnetID', 'type': 'str'}, - 'pod_subnet_id': {'key': 'properties.podSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'properties.maxPods', 'type': 'int'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'os_sku': {'key': 'properties.osSKU', 'type': 'str'}, - 'max_count': {'key': 'properties.maxCount', 'type': 'int'}, - 'min_count': {'key': 'properties.minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'properties.enableAutoScaling', 'type': 'bool'}, - 'scale_down_mode': {'key': 'properties.scaleDownMode', 'type': 'str'}, - 'type_properties_type': {'key': 'properties.type', 'type': 'str'}, - 'mode': {'key': 'properties.mode', 'type': 'str'}, - 'orchestrator_version': {'key': 'properties.orchestratorVersion', 'type': 'str'}, - 'current_orchestrator_version': {'key': 'properties.currentOrchestratorVersion', 'type': 'str'}, - 'node_image_version': {'key': 'properties.nodeImageVersion', 'type': 'str'}, - 'upgrade_settings': {'key': 'properties.upgradeSettings', 'type': 'AgentPoolUpgradeSettings'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'power_state': {'key': 'properties.powerState', 'type': 'PowerState'}, - 'availability_zones': {'key': 'properties.availabilityZones', 'type': '[str]'}, - 'enable_node_public_ip': {'key': 'properties.enableNodePublicIP', 'type': 'bool'}, - 'enable_custom_ca_trust': {'key': 'properties.enableCustomCATrust', 'type': 'bool'}, - 'node_public_ip_prefix_id': {'key': 'properties.nodePublicIPPrefixID', 'type': 'str'}, - 'scale_set_priority': {'key': 'properties.scaleSetPriority', 'type': 'str'}, - 'scale_set_eviction_policy': {'key': 'properties.scaleSetEvictionPolicy', 'type': 'str'}, - 'spot_max_price': {'key': 'properties.spotMaxPrice', 'type': 'float'}, - 'tags': {'key': 'properties.tags', 'type': '{str}'}, - 'node_labels': {'key': 'properties.nodeLabels', 'type': '{str}'}, - 'node_taints': {'key': 'properties.nodeTaints', 'type': '[str]'}, - 'proximity_placement_group_id': {'key': 'properties.proximityPlacementGroupID', 'type': 'str'}, - 'kubelet_config': {'key': 'properties.kubeletConfig', 'type': 'KubeletConfig'}, - 'linux_os_config': {'key': 'properties.linuxOSConfig', 'type': 'LinuxOSConfig'}, - 'enable_encryption_at_host': {'key': 'properties.enableEncryptionAtHost', 'type': 'bool'}, - 'enable_ultra_ssd': {'key': 'properties.enableUltraSSD', 'type': 'bool'}, - 'enable_fips': {'key': 'properties.enableFIPS', 'type': 'bool'}, - 'gpu_instance_profile': {'key': 'properties.gpuInstanceProfile', 'type': 'str'}, - 'creation_data': {'key': 'properties.creationData', 'type': 'CreationData'}, - 'capacity_reservation_group_id': {'key': 'properties.capacityReservationGroupID', 'type': 'str'}, - 'host_group_id': {'key': 'properties.hostGroupID', 'type': 'str'}, - } - - def __init__( + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "count": {"key": "properties.count", "type": "int"}, + "vm_size": {"key": "properties.vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "properties.osDiskSizeGB", "type": "int"}, + "os_disk_type": {"key": "properties.osDiskType", "type": "str"}, + "kubelet_disk_type": {"key": "properties.kubeletDiskType", "type": "str"}, + "workload_runtime": {"key": "properties.workloadRuntime", "type": "str"}, + "message_of_the_day": {"key": "properties.messageOfTheDay", "type": "str"}, + "vnet_subnet_id": {"key": "properties.vnetSubnetID", "type": "str"}, + "pod_subnet_id": {"key": "properties.podSubnetID", "type": "str"}, + "max_pods": {"key": "properties.maxPods", "type": "int"}, + "os_type": {"key": "properties.osType", "type": "str"}, + "os_sku": {"key": "properties.osSKU", "type": "str"}, + "max_count": {"key": "properties.maxCount", "type": "int"}, + "min_count": {"key": "properties.minCount", "type": "int"}, + "enable_auto_scaling": {"key": "properties.enableAutoScaling", "type": "bool"}, + "scale_down_mode": {"key": "properties.scaleDownMode", "type": "str"}, + "type_properties_type": {"key": "properties.type", "type": "str"}, + "mode": {"key": "properties.mode", "type": "str"}, + "orchestrator_version": {"key": "properties.orchestratorVersion", "type": "str"}, + "current_orchestrator_version": {"key": "properties.currentOrchestratorVersion", "type": "str"}, + "node_image_version": {"key": "properties.nodeImageVersion", "type": "str"}, + "upgrade_settings": {"key": "properties.upgradeSettings", "type": "AgentPoolUpgradeSettings"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "power_state": {"key": "properties.powerState", "type": "PowerState"}, + "availability_zones": {"key": "properties.availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "properties.enableNodePublicIP", "type": "bool"}, + "enable_custom_ca_trust": {"key": "properties.enableCustomCATrust", "type": "bool"}, + "node_public_ip_prefix_id": {"key": "properties.nodePublicIPPrefixID", "type": "str"}, + "scale_set_priority": {"key": "properties.scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "properties.scaleSetEvictionPolicy", "type": "str"}, + "spot_max_price": {"key": "properties.spotMaxPrice", "type": "float"}, + "tags": {"key": "properties.tags", "type": "{str}"}, + "node_labels": {"key": "properties.nodeLabels", "type": "{str}"}, + "node_taints": {"key": "properties.nodeTaints", "type": "[str]"}, + "proximity_placement_group_id": {"key": "properties.proximityPlacementGroupID", "type": "str"}, + "kubelet_config": {"key": "properties.kubeletConfig", "type": "KubeletConfig"}, + "linux_os_config": {"key": "properties.linuxOSConfig", "type": "LinuxOSConfig"}, + "enable_encryption_at_host": {"key": "properties.enableEncryptionAtHost", "type": "bool"}, + "enable_ultra_ssd": {"key": "properties.enableUltraSSD", "type": "bool"}, + "enable_fips": {"key": "properties.enableFIPS", "type": "bool"}, + "gpu_instance_profile": {"key": "properties.gpuInstanceProfile", "type": "str"}, + "creation_data": {"key": "properties.creationData", "type": "CreationData"}, + "capacity_reservation_group_id": {"key": "properties.capacityReservationGroupID", "type": "str"}, + "host_group_id": {"key": "properties.hostGroupID", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, count: Optional[int] = None, @@ -306,7 +300,7 @@ def __init__( vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, @@ -321,9 +315,9 @@ def __init__( enable_node_public_ip: Optional[bool] = None, enable_custom_ca_trust: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", - spot_max_price: Optional[float] = -1, + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", + spot_max_price: float = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, @@ -356,15 +350,15 @@ def __init__( larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.OSDiskType :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime - data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + data root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.KubeletDiskType :keyword workload_runtime: Determines the type of workload a node can run. Known values are: - "OCIContainer", "WasmWasi". + "OCIContainer" and "WasmWasi". :paramtype workload_runtime: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.WorkloadRuntime :keyword message_of_the_day: A base64-encoded string which will be written to /etc/motd after @@ -383,13 +377,13 @@ def __init__( :paramtype pod_subnet_id: str :keyword max_pods: The maximum number of pods that can run on a node. :paramtype max_pods: int - :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.OSType :keyword os_sku: Specifies the OS SKU used by the agent pool. If not specified, the default is Ubuntu if OSType=Linux or Windows2019 if OSType=Windows. And the default Windows OSSKU will be changed to Windows2022 after Windows2019 is deprecated. Known values are: "Ubuntu", - "CBLMariner", "Windows2019", "Windows2022". + "CBLMariner", "Windows2019", and "Windows2022". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.OSSKU :keyword max_count: The maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -398,16 +392,16 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, - it defaults to Delete. Known values are: "Delete", "Deallocate". + it defaults to Delete. Known values are: "Delete" and "Deallocate". :paramtype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.ScaleDownMode :keyword type_properties_type: The type of Agent Pool. Known values are: - "VirtualMachineScaleSets", "AvailabilitySet". + "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type_properties_type: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.AgentPoolType :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.AgentPoolMode :keyword orchestrator_version: Both patch version and are supported. When is specified, the latest supported patch version is chosen @@ -445,20 +439,18 @@ def __init__( /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the - default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + default is 'Regular'. Known values are: "Spot" and "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.ScaleSetPriority :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.ScaleSetEvictionPolicy :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :paramtype spot_max_price: float - :keyword tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :keyword tags: The tags to be persisted on the agent pool virtual machine scale set. :paramtype tags: dict[str, str] :keyword node_labels: The node labels to be persisted across all nodes in agent pool. :paramtype node_labels: dict[str, str] @@ -484,7 +476,7 @@ def __init__( for more details. :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance - profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.GPUInstanceProfile @@ -500,7 +492,7 @@ def __init__( `_. :paramtype host_group_id: str """ - super(AgentPool, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.vm_size = vm_size self.os_disk_size_gb = os_disk_size_gb @@ -547,7 +539,7 @@ def __init__( self.host_group_id = host_group_id -class AgentPoolAvailableVersions(msrest.serialization.Model): +class AgentPoolAvailableVersions(_serialization.Model): """The list of available versions for an agent pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -564,16 +556,19 @@ class AgentPoolAvailableVersions(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'agent_pool_versions': {'key': 'properties.agentPoolVersions', 'type': '[AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "agent_pool_versions": { + "key": "properties.agentPoolVersions", + "type": "[AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem]", + }, } def __init__( @@ -587,14 +582,14 @@ def __init__( :paramtype agent_pool_versions: list[~azure.mgmt.containerservice.v2022_06_02_preview.models.AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem] """ - super(AgentPoolAvailableVersions, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None self.agent_pool_versions = agent_pool_versions -class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(msrest.serialization.Model): +class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(_serialization.Model): """AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem. :ivar default: Whether this version is the default agent pool version. @@ -606,9 +601,9 @@ class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(msrest.serializa """ _attribute_map = { - 'default': {'key': 'default', 'type': 'bool'}, - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "default": {"key": "default", "type": "bool"}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } def __init__( @@ -627,13 +622,13 @@ def __init__( :keyword is_preview: Whether Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.default = default self.kubernetes_version = kubernetes_version self.is_preview = is_preview -class AgentPoolListResult(msrest.serialization.Model): +class AgentPoolListResult(_serialization.Model): """The response from the List Agent Pools operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -645,30 +640,25 @@ class AgentPoolListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[AgentPool]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[AgentPool]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.AgentPool"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.AgentPool"]] = None, **kwargs): """ :keyword value: The list of agent pools. :paramtype value: list[~azure.mgmt.containerservice.v2022_06_02_preview.models.AgentPool] """ - super(AgentPoolListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class AgentPoolUpgradeProfile(msrest.serialization.Model): +class AgentPoolUpgradeProfile(_serialization.Model): """The list of available upgrades for an agent pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -681,10 +671,10 @@ class AgentPoolUpgradeProfile(msrest.serialization.Model): :vartype name: str :ivar type: The type of the agent pool upgrade profile. :vartype type: str - :ivar kubernetes_version: Required. The Kubernetes version (major.minor.patch). + :ivar kubernetes_version: The Kubernetes version (major.minor.patch). Required. :vartype kubernetes_version: str - :ivar os_type: Required. The operating system type. The default is Linux. Known values are: - "Linux", "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -694,21 +684,21 @@ class AgentPoolUpgradeProfile(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kubernetes_version': {'required': True}, - 'os_type': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "kubernetes_version": {"required": True}, + "os_type": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'kubernetes_version': {'key': 'properties.kubernetesVersion', 'type': 'str'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'upgrades': {'key': 'properties.upgrades', 'type': '[AgentPoolUpgradeProfilePropertiesUpgradesItem]'}, - 'latest_node_image_version': {'key': 'properties.latestNodeImageVersion', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "os_type": {"key": "properties.osType", "type": "str"}, + "upgrades": {"key": "properties.upgrades", "type": "[AgentPoolUpgradeProfilePropertiesUpgradesItem]"}, + "latest_node_image_version": {"key": "properties.latestNodeImageVersion", "type": "str"}, } def __init__( @@ -721,10 +711,10 @@ def __init__( **kwargs ): """ - :keyword kubernetes_version: Required. The Kubernetes version (major.minor.patch). + :keyword kubernetes_version: The Kubernetes version (major.minor.patch). Required. :paramtype kubernetes_version: str - :keyword os_type: Required. The operating system type. The default is Linux. Known values are: - "Linux", "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: @@ -732,7 +722,7 @@ def __init__( :keyword latest_node_image_version: The latest AKS supported node image version. :paramtype latest_node_image_version: str """ - super(AgentPoolUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -742,7 +732,7 @@ def __init__( self.latest_node_image_version = latest_node_image_version -class AgentPoolUpgradeProfilePropertiesUpgradesItem(msrest.serialization.Model): +class AgentPoolUpgradeProfilePropertiesUpgradesItem(_serialization.Model): """AgentPoolUpgradeProfilePropertiesUpgradesItem. :ivar kubernetes_version: The Kubernetes version (major.minor.patch). @@ -752,29 +742,23 @@ class AgentPoolUpgradeProfilePropertiesUpgradesItem(msrest.serialization.Model): """ _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } - def __init__( - self, - *, - kubernetes_version: Optional[str] = None, - is_preview: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, kubernetes_version: Optional[str] = None, is_preview: Optional[bool] = None, **kwargs): """ :keyword kubernetes_version: The Kubernetes version (major.minor.patch). :paramtype kubernetes_version: str :keyword is_preview: Whether the Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(AgentPoolUpgradeProfilePropertiesUpgradesItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.is_preview = is_preview -class AgentPoolUpgradeSettings(msrest.serialization.Model): +class AgentPoolUpgradeSettings(_serialization.Model): """Settings for upgrading an agentpool. :ivar max_surge: This can either be set to an integer (e.g. '5') or a percentage (e.g. '50%'). @@ -786,15 +770,10 @@ class AgentPoolUpgradeSettings(msrest.serialization.Model): """ _attribute_map = { - 'max_surge': {'key': 'maxSurge', 'type': 'str'}, + "max_surge": {"key": "maxSurge", "type": "str"}, } - def __init__( - self, - *, - max_surge: Optional[str] = None, - **kwargs - ): + def __init__(self, *, max_surge: Optional[str] = None, **kwargs): """ :keyword max_surge: This can either be set to an integer (e.g. '5') or a percentage (e.g. '50%'). If a percentage is specified, it is the percentage of the total agent pool size at the @@ -803,11 +782,11 @@ def __init__( https://docs.microsoft.com/azure/aks/upgrade-cluster#customize-node-surge-upgrade. :paramtype max_surge: str """ - super(AgentPoolUpgradeSettings, self).__init__(**kwargs) + super().__init__(**kwargs) self.max_surge = max_surge -class Resource(msrest.serialization.Model): +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. @@ -826,26 +805,22 @@ class Resource(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, + "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'}, + "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 - ): - """ - """ - super(Resource, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -873,32 +848,28 @@ class AzureEntityResource(Resource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'etag': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "etag": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'etag': {'key': 'etag', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "etag": {"key": "etag", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(AzureEntityResource, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.etag = None -class AzureKeyVaultKms(msrest.serialization.Model): +class AzureKeyVaultKms(_serialization.Model): """Azure Key Vault key management service settings for the security profile. :ivar enabled: Whether to enable Azure Key Vault key management service. The default is false. @@ -912,7 +883,7 @@ class AzureKeyVaultKms(msrest.serialization.Model): :ivar key_vault_network_access: Network access of key vault. The possible values are ``Public`` and ``Private``. ``Public`` means the key vault allows public access from all networks. ``Private`` means the key vault disables public access and enables private link. The default - value is ``Public``. Known values are: "Public", "Private". Default value: "Public". + value is ``Public``. Known values are: "Public" and "Private". :vartype key_vault_network_access: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.KeyVaultNetworkAccessTypes :ivar key_vault_resource_id: Resource ID of key vault. When keyVaultNetworkAccess is @@ -922,10 +893,10 @@ class AzureKeyVaultKms(msrest.serialization.Model): """ _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'key_id': {'key': 'keyId', 'type': 'str'}, - 'key_vault_network_access': {'key': 'keyVaultNetworkAccess', 'type': 'str'}, - 'key_vault_resource_id': {'key': 'keyVaultResourceId', 'type': 'str'}, + "enabled": {"key": "enabled", "type": "bool"}, + "key_id": {"key": "keyId", "type": "str"}, + "key_vault_network_access": {"key": "keyVaultNetworkAccess", "type": "str"}, + "key_vault_resource_id": {"key": "keyVaultResourceId", "type": "str"}, } def __init__( @@ -933,7 +904,7 @@ def __init__( *, enabled: Optional[bool] = None, key_id: Optional[str] = None, - key_vault_network_access: Optional[Union[str, "_models.KeyVaultNetworkAccessTypes"]] = "Public", + key_vault_network_access: Union[str, "_models.KeyVaultNetworkAccessTypes"] = "Public", key_vault_resource_id: Optional[str] = None, **kwargs ): @@ -950,7 +921,7 @@ def __init__( :keyword key_vault_network_access: Network access of key vault. The possible values are ``Public`` and ``Private``. ``Public`` means the key vault allows public access from all networks. ``Private`` means the key vault disables public access and enables private link. The - default value is ``Public``. Known values are: "Public", "Private". Default value: "Public". + default value is ``Public``. Known values are: "Public" and "Private". :paramtype key_vault_network_access: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.KeyVaultNetworkAccessTypes :keyword key_vault_resource_id: Resource ID of key vault. When keyVaultNetworkAccess is @@ -958,14 +929,14 @@ def __init__( keyVaultNetworkAccess is ``Public``\ , leave the field empty. :paramtype key_vault_resource_id: str """ - super(AzureKeyVaultKms, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.key_id = key_id self.key_vault_network_access = key_vault_network_access self.key_vault_resource_id = key_vault_resource_id -class CloudErrorBody(msrest.serialization.Model): +class CloudErrorBody(_serialization.Model): """An error response from the Container service. :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed @@ -982,10 +953,10 @@ class CloudErrorBody(msrest.serialization.Model): """ _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[CloudErrorBody]"}, } def __init__( @@ -1011,88 +982,77 @@ def __init__( :paramtype details: list[~azure.mgmt.containerservice.v2022_06_02_preview.models.CloudErrorBody] """ - super(CloudErrorBody, self).__init__(**kwargs) + super().__init__(**kwargs) self.code = code self.message = message self.target = target self.details = details -class ContainerServiceDiagnosticsProfile(msrest.serialization.Model): +class ContainerServiceDiagnosticsProfile(_serialization.Model): """Profile for diagnostics on the container service cluster. All required parameters must be populated in order to send to Azure. - :ivar vm_diagnostics: Required. Profile for diagnostics on the container service VMs. + :ivar vm_diagnostics: Profile for diagnostics on the container service VMs. Required. :vartype vm_diagnostics: ~azure.mgmt.containerservice.v2022_06_02_preview.models.ContainerServiceVMDiagnostics """ _validation = { - 'vm_diagnostics': {'required': True}, + "vm_diagnostics": {"required": True}, } _attribute_map = { - 'vm_diagnostics': {'key': 'vmDiagnostics', 'type': 'ContainerServiceVMDiagnostics'}, + "vm_diagnostics": {"key": "vmDiagnostics", "type": "ContainerServiceVMDiagnostics"}, } - def __init__( - self, - *, - vm_diagnostics: "_models.ContainerServiceVMDiagnostics", - **kwargs - ): + def __init__(self, *, vm_diagnostics: "_models.ContainerServiceVMDiagnostics", **kwargs): """ - :keyword vm_diagnostics: Required. Profile for diagnostics on the container service VMs. + :keyword vm_diagnostics: Profile for diagnostics on the container service VMs. Required. :paramtype vm_diagnostics: ~azure.mgmt.containerservice.v2022_06_02_preview.models.ContainerServiceVMDiagnostics """ - super(ContainerServiceDiagnosticsProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.vm_diagnostics = vm_diagnostics -class ContainerServiceLinuxProfile(msrest.serialization.Model): +class ContainerServiceLinuxProfile(_serialization.Model): """Profile for Linux VMs in the container service cluster. All required parameters must be populated in order to send to Azure. - :ivar admin_username: Required. The administrator username to use for Linux VMs. + :ivar admin_username: The administrator username to use for Linux VMs. Required. :vartype admin_username: str - :ivar ssh: Required. The SSH configuration for Linux-based VMs running on Azure. + :ivar ssh: The SSH configuration for Linux-based VMs running on Azure. Required. :vartype ssh: ~azure.mgmt.containerservice.v2022_06_02_preview.models.ContainerServiceSshConfiguration """ _validation = { - 'admin_username': {'required': True, 'pattern': r'^[A-Za-z][-A-Za-z0-9_]*$'}, - 'ssh': {'required': True}, + "admin_username": {"required": True, "pattern": r"^[A-Za-z][-A-Za-z0-9_]*$"}, + "ssh": {"required": True}, } _attribute_map = { - 'admin_username': {'key': 'adminUsername', 'type': 'str'}, - 'ssh': {'key': 'ssh', 'type': 'ContainerServiceSshConfiguration'}, + "admin_username": {"key": "adminUsername", "type": "str"}, + "ssh": {"key": "ssh", "type": "ContainerServiceSshConfiguration"}, } - def __init__( - self, - *, - admin_username: str, - ssh: "_models.ContainerServiceSshConfiguration", - **kwargs - ): + def __init__(self, *, admin_username: str, ssh: "_models.ContainerServiceSshConfiguration", **kwargs): """ - :keyword admin_username: Required. The administrator username to use for Linux VMs. + :keyword admin_username: The administrator username to use for Linux VMs. Required. :paramtype admin_username: str - :keyword ssh: Required. The SSH configuration for Linux-based VMs running on Azure. + :keyword ssh: The SSH configuration for Linux-based VMs running on Azure. Required. :paramtype ssh: ~azure.mgmt.containerservice.v2022_06_02_preview.models.ContainerServiceSshConfiguration """ - super(ContainerServiceLinuxProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.admin_username = admin_username self.ssh = ssh -class ContainerServiceMasterProfile(msrest.serialization.Model): +class ContainerServiceMasterProfile(_serialization.Model): """Profile for the container service master. Variables are only populated by the server, and will be ignored when sending a request. @@ -1100,11 +1060,11 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar count: Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, - and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". + and 5. The default value is 1. Known values are: 1, 3, and 5. :vartype count: int or ~azure.mgmt.containerservice.v2022_06_02_preview.models.Count - :ivar dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. + :ivar dns_prefix: DNS prefix to be used to create the FQDN for the master pool. Required. :vartype dns_prefix: str - :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + :ivar vm_size: Size of agent VMs. Required. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -1141,7 +1101,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :vartype vm_size: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.ContainerServiceVMSizeTypes :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine @@ -1155,7 +1115,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): :vartype first_consecutive_static_ip: str :ivar storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount" and "ManagedDisks". :vartype storage_profile: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.ContainerServiceStorageProfileTypes :ivar fqdn: FQDN for the master pool. @@ -1163,21 +1123,21 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): """ _validation = { - 'dns_prefix': {'required': True}, - 'vm_size': {'required': True}, - 'os_disk_size_gb': {'maximum': 2048, 'minimum': 0}, - 'fqdn': {'readonly': True}, + "dns_prefix": {"required": True}, + "vm_size": {"required": True}, + "os_disk_size_gb": {"maximum": 2048, "minimum": 0}, + "fqdn": {"readonly": True}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'dns_prefix': {'key': 'dnsPrefix', 'type': 'str'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'first_consecutive_static_ip': {'key': 'firstConsecutiveStaticIP', 'type': 'str'}, - 'storage_profile': {'key': 'storageProfile', 'type': 'str'}, - 'fqdn': {'key': 'fqdn', 'type': 'str'}, + "count": {"key": "count", "type": "int"}, + "dns_prefix": {"key": "dnsPrefix", "type": "str"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "first_consecutive_static_ip": {"key": "firstConsecutiveStaticIP", "type": "str"}, + "storage_profile": {"key": "storageProfile", "type": "str"}, + "fqdn": {"key": "fqdn", "type": "str"}, } def __init__( @@ -1185,20 +1145,20 @@ def __init__( *, dns_prefix: str, vm_size: Union[str, "_models.ContainerServiceVMSizeTypes"], - count: Optional[Union[int, "_models.Count"]] = 1, + count: Union[int, "_models.Count"] = 1, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, - first_consecutive_static_ip: Optional[str] = "10.240.255.5", + first_consecutive_static_ip: str = "10.240.255.5", storage_profile: Optional[Union[str, "_models.ContainerServiceStorageProfileTypes"]] = None, **kwargs ): """ :keyword count: Number of masters (VMs) in the container service cluster. Allowed values are 1, - 3, and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". + 3, and 5. The default value is 1. Known values are: 1, 3, and 5. :paramtype count: int or ~azure.mgmt.containerservice.v2022_06_02_preview.models.Count - :keyword dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. + :keyword dns_prefix: DNS prefix to be used to create the FQDN for the master pool. Required. :paramtype dns_prefix: str - :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + :keyword vm_size: Size of agent VMs. Required. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -1235,7 +1195,7 @@ def __init__( "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", - "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". :paramtype vm_size: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.ContainerServiceVMSizeTypes :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every @@ -1249,11 +1209,11 @@ def __init__( :paramtype first_consecutive_static_ip: str :keyword storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount" and "ManagedDisks". :paramtype storage_profile: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.ContainerServiceStorageProfileTypes """ - super(ContainerServiceMasterProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.dns_prefix = dns_prefix self.vm_size = vm_size @@ -1264,23 +1224,23 @@ def __init__( self.fqdn = None -class ContainerServiceNetworkProfile(msrest.serialization.Model): +class ContainerServiceNetworkProfile(_serialization.Model): # pylint: disable=too-many-instance-attributes """Profile of network configuration. :ivar network_plugin: Network plugin used for building the Kubernetes network. Known values - are: "azure", "kubenet", "none". Default value: "kubenet". + are: "azure", "kubenet", and "none". :vartype network_plugin: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.NetworkPlugin - :ivar network_plugin_mode: Network plugin mode used for building the Kubernetes network. Known - values are: "Overlay". + :ivar network_plugin_mode: Network plugin mode used for building the Kubernetes network. + "Overlay" :vartype network_plugin_mode: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.NetworkPluginMode :ivar network_policy: Network policy used for building the Kubernetes network. Known values - are: "calico", "azure". + are: "calico" and "azure". :vartype network_policy: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.NetworkPolicy :ivar network_mode: This cannot be specified if networkPlugin is anything other than 'azure'. - Known values are: "transparent", "bridge". + Known values are: "transparent" and "bridge". :vartype network_mode: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.NetworkMode :ivar pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. @@ -1297,13 +1257,12 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): :ivar outbound_type: This can only be set at cluster creation time and cannot be changed later. For more information see `egress outbound type `_. Known values are: "loadBalancer", - "userDefinedRouting", "managedNATGateway", "userAssignedNATGateway". Default value: - "loadBalancer". + "userDefinedRouting", "managedNATGateway", and "userAssignedNATGateway". :vartype outbound_type: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.OutboundType :ivar load_balancer_sku: The default is 'standard'. See `Azure Load Balancer SKUs `_ for more information about the - differences between load balancer SKUs. Known values are: "standard", "basic". + differences between load balancer SKUs. Known values are: "standard" and "basic". :vartype load_balancer_sku: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.LoadBalancerSku :ivar load_balancer_profile: Profile of the cluster load balancer. @@ -1327,42 +1286,44 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): """ _validation = { - 'pod_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, - 'service_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, - 'dns_service_ip': {'pattern': r'^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$'}, - 'docker_bridge_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, + "pod_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, + "service_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, + "dns_service_ip": { + "pattern": r"^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$" + }, + "docker_bridge_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, } _attribute_map = { - 'network_plugin': {'key': 'networkPlugin', 'type': 'str'}, - 'network_plugin_mode': {'key': 'networkPluginMode', 'type': 'str'}, - 'network_policy': {'key': 'networkPolicy', 'type': 'str'}, - 'network_mode': {'key': 'networkMode', 'type': 'str'}, - 'pod_cidr': {'key': 'podCidr', 'type': 'str'}, - 'service_cidr': {'key': 'serviceCidr', 'type': 'str'}, - 'dns_service_ip': {'key': 'dnsServiceIP', 'type': 'str'}, - 'docker_bridge_cidr': {'key': 'dockerBridgeCidr', 'type': 'str'}, - 'outbound_type': {'key': 'outboundType', 'type': 'str'}, - 'load_balancer_sku': {'key': 'loadBalancerSku', 'type': 'str'}, - 'load_balancer_profile': {'key': 'loadBalancerProfile', 'type': 'ManagedClusterLoadBalancerProfile'}, - 'nat_gateway_profile': {'key': 'natGatewayProfile', 'type': 'ManagedClusterNATGatewayProfile'}, - 'pod_cidrs': {'key': 'podCidrs', 'type': '[str]'}, - 'service_cidrs': {'key': 'serviceCidrs', 'type': '[str]'}, - 'ip_families': {'key': 'ipFamilies', 'type': '[str]'}, + "network_plugin": {"key": "networkPlugin", "type": "str"}, + "network_plugin_mode": {"key": "networkPluginMode", "type": "str"}, + "network_policy": {"key": "networkPolicy", "type": "str"}, + "network_mode": {"key": "networkMode", "type": "str"}, + "pod_cidr": {"key": "podCidr", "type": "str"}, + "service_cidr": {"key": "serviceCidr", "type": "str"}, + "dns_service_ip": {"key": "dnsServiceIP", "type": "str"}, + "docker_bridge_cidr": {"key": "dockerBridgeCidr", "type": "str"}, + "outbound_type": {"key": "outboundType", "type": "str"}, + "load_balancer_sku": {"key": "loadBalancerSku", "type": "str"}, + "load_balancer_profile": {"key": "loadBalancerProfile", "type": "ManagedClusterLoadBalancerProfile"}, + "nat_gateway_profile": {"key": "natGatewayProfile", "type": "ManagedClusterNATGatewayProfile"}, + "pod_cidrs": {"key": "podCidrs", "type": "[str]"}, + "service_cidrs": {"key": "serviceCidrs", "type": "[str]"}, + "ip_families": {"key": "ipFamilies", "type": "[str]"}, } def __init__( self, *, - network_plugin: Optional[Union[str, "_models.NetworkPlugin"]] = "kubenet", + network_plugin: Union[str, "_models.NetworkPlugin"] = "kubenet", network_plugin_mode: Optional[Union[str, "_models.NetworkPluginMode"]] = None, network_policy: Optional[Union[str, "_models.NetworkPolicy"]] = None, network_mode: Optional[Union[str, "_models.NetworkMode"]] = None, - pod_cidr: Optional[str] = "10.244.0.0/16", - service_cidr: Optional[str] = "10.0.0.0/16", - dns_service_ip: Optional[str] = "10.0.0.10", - docker_bridge_cidr: Optional[str] = "172.17.0.1/16", - outbound_type: Optional[Union[str, "_models.OutboundType"]] = "loadBalancer", + pod_cidr: str = "10.244.0.0/16", + service_cidr: str = "10.0.0.0/16", + dns_service_ip: str = "10.0.0.10", + docker_bridge_cidr: str = "172.17.0.1/16", + outbound_type: Union[str, "_models.OutboundType"] = "loadBalancer", load_balancer_sku: Optional[Union[str, "_models.LoadBalancerSku"]] = None, load_balancer_profile: Optional["_models.ManagedClusterLoadBalancerProfile"] = None, nat_gateway_profile: Optional["_models.ManagedClusterNATGatewayProfile"] = None, @@ -1373,19 +1334,19 @@ def __init__( ): """ :keyword network_plugin: Network plugin used for building the Kubernetes network. Known values - are: "azure", "kubenet", "none". Default value: "kubenet". + are: "azure", "kubenet", and "none". :paramtype network_plugin: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.NetworkPlugin :keyword network_plugin_mode: Network plugin mode used for building the Kubernetes network. - Known values are: "Overlay". + "Overlay" :paramtype network_plugin_mode: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.NetworkPluginMode :keyword network_policy: Network policy used for building the Kubernetes network. Known values - are: "calico", "azure". + are: "calico" and "azure". :paramtype network_policy: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.NetworkPolicy :keyword network_mode: This cannot be specified if networkPlugin is anything other than - 'azure'. Known values are: "transparent", "bridge". + 'azure'. Known values are: "transparent" and "bridge". :paramtype network_mode: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.NetworkMode :keyword pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. @@ -1402,13 +1363,12 @@ def __init__( :keyword outbound_type: This can only be set at cluster creation time and cannot be changed later. For more information see `egress outbound type `_. Known values are: "loadBalancer", - "userDefinedRouting", "managedNATGateway", "userAssignedNATGateway". Default value: - "loadBalancer". + "userDefinedRouting", "managedNATGateway", and "userAssignedNATGateway". :paramtype outbound_type: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.OutboundType :keyword load_balancer_sku: The default is 'standard'. See `Azure Load Balancer SKUs `_ for more information about the - differences between load balancer SKUs. Known values are: "standard", "basic". + differences between load balancer SKUs. Known values are: "standard" and "basic". :paramtype load_balancer_sku: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.LoadBalancerSku :keyword load_balancer_profile: Profile of the cluster load balancer. @@ -1430,7 +1390,7 @@ def __init__( :paramtype ip_families: list[str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.IpFamily] """ - super(ContainerServiceNetworkProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.network_plugin = network_plugin self.network_plugin_mode = network_plugin_mode self.network_policy = network_policy @@ -1448,113 +1408,98 @@ def __init__( self.ip_families = ip_families -class ContainerServiceSshConfiguration(msrest.serialization.Model): +class ContainerServiceSshConfiguration(_serialization.Model): """SSH configuration for Linux-based VMs running on Azure. All required parameters must be populated in order to send to Azure. - :ivar public_keys: Required. The list of SSH public keys used to authenticate with Linux-based - VMs. A maximum of 1 key may be specified. + :ivar public_keys: The list of SSH public keys used to authenticate with Linux-based VMs. A + maximum of 1 key may be specified. Required. :vartype public_keys: list[~azure.mgmt.containerservice.v2022_06_02_preview.models.ContainerServiceSshPublicKey] """ _validation = { - 'public_keys': {'required': True}, + "public_keys": {"required": True}, } _attribute_map = { - 'public_keys': {'key': 'publicKeys', 'type': '[ContainerServiceSshPublicKey]'}, + "public_keys": {"key": "publicKeys", "type": "[ContainerServiceSshPublicKey]"}, } - def __init__( - self, - *, - public_keys: List["_models.ContainerServiceSshPublicKey"], - **kwargs - ): + def __init__(self, *, public_keys: List["_models.ContainerServiceSshPublicKey"], **kwargs): """ - :keyword public_keys: Required. The list of SSH public keys used to authenticate with - Linux-based VMs. A maximum of 1 key may be specified. + :keyword public_keys: The list of SSH public keys used to authenticate with Linux-based VMs. A + maximum of 1 key may be specified. Required. :paramtype public_keys: list[~azure.mgmt.containerservice.v2022_06_02_preview.models.ContainerServiceSshPublicKey] """ - super(ContainerServiceSshConfiguration, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_keys = public_keys -class ContainerServiceSshPublicKey(msrest.serialization.Model): +class ContainerServiceSshPublicKey(_serialization.Model): """Contains information about SSH certificate public key data. All required parameters must be populated in order to send to Azure. - :ivar key_data: Required. Certificate public key used to authenticate with VMs through SSH. The - certificate must be in PEM format with or without headers. + :ivar key_data: Certificate public key used to authenticate with VMs through SSH. The + certificate must be in PEM format with or without headers. Required. :vartype key_data: str """ _validation = { - 'key_data': {'required': True}, + "key_data": {"required": True}, } _attribute_map = { - 'key_data': {'key': 'keyData', 'type': 'str'}, + "key_data": {"key": "keyData", "type": "str"}, } - def __init__( - self, - *, - key_data: str, - **kwargs - ): + def __init__(self, *, key_data: str, **kwargs): """ - :keyword key_data: Required. Certificate public key used to authenticate with VMs through SSH. - The certificate must be in PEM format with or without headers. + :keyword key_data: Certificate public key used to authenticate with VMs through SSH. The + certificate must be in PEM format with or without headers. Required. :paramtype key_data: str """ - super(ContainerServiceSshPublicKey, self).__init__(**kwargs) + super().__init__(**kwargs) self.key_data = key_data -class ContainerServiceVMDiagnostics(msrest.serialization.Model): +class ContainerServiceVMDiagnostics(_serialization.Model): """Profile for diagnostics on the container service VMs. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar enabled: Required. Whether the VM diagnostic agent is provisioned on the VM. + :ivar enabled: Whether the VM diagnostic agent is provisioned on the VM. Required. :vartype enabled: bool :ivar storage_uri: The URI of the storage account where diagnostics are stored. :vartype storage_uri: str """ _validation = { - 'enabled': {'required': True}, - 'storage_uri': {'readonly': True}, + "enabled": {"required": True}, + "storage_uri": {"readonly": True}, } _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'storage_uri': {'key': 'storageUri', 'type': 'str'}, + "enabled": {"key": "enabled", "type": "bool"}, + "storage_uri": {"key": "storageUri", "type": "str"}, } - def __init__( - self, - *, - enabled: bool, - **kwargs - ): + def __init__(self, *, enabled: bool, **kwargs): """ - :keyword enabled: Required. Whether the VM diagnostic agent is provisioned on the VM. + :keyword enabled: Whether the VM diagnostic agent is provisioned on the VM. Required. :paramtype enabled: bool """ - super(ContainerServiceVMDiagnostics, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.storage_uri = None -class CreationData(msrest.serialization.Model): +class CreationData(_serialization.Model): """Data used when creating a target resource from a source resource. :ivar source_resource_id: This is the ARM ID of the source object to be used to create the @@ -1563,25 +1508,20 @@ class CreationData(msrest.serialization.Model): """ _attribute_map = { - 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, + "source_resource_id": {"key": "sourceResourceId", "type": "str"}, } - def __init__( - self, - *, - source_resource_id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, source_resource_id: Optional[str] = None, **kwargs): """ :keyword source_resource_id: This is the ARM ID of the source object to be used to create the target object. :paramtype source_resource_id: str """ - super(CreationData, self).__init__(**kwargs) + super().__init__(**kwargs) self.source_resource_id = source_resource_id -class CredentialResult(msrest.serialization.Model): +class CredentialResult(_serialization.Model): """The credential result response. Variables are only populated by the server, and will be ignored when sending a request. @@ -1589,31 +1529,27 @@ class CredentialResult(msrest.serialization.Model): :ivar name: The name of the credential. :vartype name: str :ivar value: Base64-encoded Kubernetes configuration file. - :vartype value: bytearray + :vartype value: bytes """ _validation = { - 'name': {'readonly': True}, - 'value': {'readonly': True}, + "name": {"readonly": True}, + "value": {"readonly": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'bytearray'}, + "name": {"key": "name", "type": "str"}, + "value": {"key": "value", "type": "bytearray"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(CredentialResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.name = None self.value = None -class CredentialResults(msrest.serialization.Model): +class CredentialResults(_serialization.Model): """The list credential result response. Variables are only populated by the server, and will be ignored when sending a request. @@ -1624,24 +1560,20 @@ class CredentialResults(msrest.serialization.Model): """ _validation = { - 'kubeconfigs': {'readonly': True}, + "kubeconfigs": {"readonly": True}, } _attribute_map = { - 'kubeconfigs': {'key': 'kubeconfigs', 'type': '[CredentialResult]'}, + "kubeconfigs": {"key": "kubeconfigs", "type": "[CredentialResult]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(CredentialResults, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.kubeconfigs = None -class EndpointDependency(msrest.serialization.Model): +class EndpointDependency(_serialization.Model): """A domain name that AKS agent nodes are reaching at. :ivar domain_name: The domain name of the dependency. @@ -1652,8 +1584,8 @@ class EndpointDependency(msrest.serialization.Model): """ _attribute_map = { - 'domain_name': {'key': 'domainName', 'type': 'str'}, - 'endpoint_details': {'key': 'endpointDetails', 'type': '[EndpointDetail]'}, + "domain_name": {"key": "domainName", "type": "str"}, + "endpoint_details": {"key": "endpointDetails", "type": "[EndpointDetail]"}, } def __init__( @@ -1670,12 +1602,12 @@ def __init__( :paramtype endpoint_details: list[~azure.mgmt.containerservice.v2022_06_02_preview.models.EndpointDetail] """ - super(EndpointDependency, self).__init__(**kwargs) + super().__init__(**kwargs) self.domain_name = domain_name self.endpoint_details = endpoint_details -class EndpointDetail(msrest.serialization.Model): +class EndpointDetail(_serialization.Model): """connect information from the AKS agent nodes to a single endpoint. :ivar ip_address: An IP Address that Domain Name currently resolves to. @@ -1689,10 +1621,10 @@ class EndpointDetail(msrest.serialization.Model): """ _attribute_map = { - 'ip_address': {'key': 'ipAddress', 'type': 'str'}, - 'port': {'key': 'port', 'type': 'int'}, - 'protocol': {'key': 'protocol', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, + "ip_address": {"key": "ipAddress", "type": "str"}, + "port": {"key": "port", "type": "int"}, + "protocol": {"key": "protocol", "type": "str"}, + "description": {"key": "description", "type": "str"}, } def __init__( @@ -1714,14 +1646,14 @@ def __init__( :keyword description: Description of the detail. :paramtype description: str """ - super(EndpointDetail, self).__init__(**kwargs) + super().__init__(**kwargs) self.ip_address = ip_address self.port = port self.protocol = protocol self.description = description -class ErrorAdditionalInfo(msrest.serialization.Model): +class ErrorAdditionalInfo(_serialization.Model): """The resource management error additional info. Variables are only populated by the server, and will be ignored when sending a request. @@ -1729,31 +1661,27 @@ class ErrorAdditionalInfo(msrest.serialization.Model): :ivar type: The additional info type. :vartype type: str :ivar info: The additional info. - :vartype info: any + :vartype info: JSON """ _validation = { - 'type': {'readonly': True}, - 'info': {'readonly': True}, + "type": {"readonly": True}, + "info": {"readonly": True}, } _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'info': {'key': 'info', 'type': 'object'}, + "type": {"key": "type", "type": "str"}, + "info": {"key": "info", "type": "object"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(ErrorAdditionalInfo, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.type = None self.info = None -class ErrorDetail(msrest.serialization.Model): +class ErrorDetail(_serialization.Model): """The error detail. Variables are only populated by the server, and will be ignored when sending a request. @@ -1772,28 +1700,24 @@ class ErrorDetail(msrest.serialization.Model): """ _validation = { - 'code': {'readonly': True}, - 'message': {'readonly': True}, - 'target': {'readonly': True}, - 'details': {'readonly': True}, - 'additional_info': {'readonly': True}, + "code": {"readonly": True}, + "message": {"readonly": True}, + "target": {"readonly": True}, + "details": {"readonly": True}, + "additional_info": {"readonly": True}, } _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[ErrorDetail]'}, - 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[ErrorDetail]"}, + "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(ErrorDetail, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.code = None self.message = None self.target = None @@ -1801,7 +1725,7 @@ def __init__( self.additional_info = None -class ErrorResponse(msrest.serialization.Model): +class ErrorResponse(_serialization.Model): """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). :ivar error: The error object. @@ -1809,36 +1733,31 @@ class ErrorResponse(msrest.serialization.Model): """ _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorDetail'}, + "error": {"key": "error", "type": "ErrorDetail"}, } - def __init__( - self, - *, - error: Optional["_models.ErrorDetail"] = None, - **kwargs - ): + def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs): """ :keyword error: The error object. :paramtype error: ~azure.mgmt.containerservice.v2022_06_02_preview.models.ErrorDetail """ - super(ErrorResponse, self).__init__(**kwargs) + super().__init__(**kwargs) self.error = error -class ExtendedLocation(msrest.serialization.Model): +class ExtendedLocation(_serialization.Model): """The complex type of the extended location. :ivar name: The name of the extended location. :vartype name: str - :ivar type: The type of the extended location. Known values are: "EdgeZone". + :ivar type: The type of the extended location. "EdgeZone" :vartype type: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.ExtendedLocationTypes """ _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, } def __init__( @@ -1851,11 +1770,11 @@ def __init__( """ :keyword name: The name of the extended location. :paramtype name: str - :keyword type: The type of the extended location. Known values are: "EdgeZone". + :keyword type: The type of the extended location. "EdgeZone" :paramtype type: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.ExtendedLocationTypes """ - super(ExtendedLocation, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.type = type @@ -1878,43 +1797,37 @@ class TrackedResource(Resource): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.containerservice.v2022_06_02_preview.models.SystemData - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] - :ivar location: Required. The geo-location where the resource lives. + :ivar location: The geo-location where the resource lives. Required. :vartype location: str """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'location': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, } - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] - :keyword location: Required. The geo-location where the resource lives. + :keyword location: The geo-location where the resource lives. Required. :paramtype location: str """ - super(TrackedResource, self).__init__(**kwargs) + super().__init__(**kwargs) self.tags = tags self.location = location @@ -1937,40 +1850,40 @@ class Fleet(TrackedResource): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.containerservice.v2022_06_02_preview.models.SystemData - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] - :ivar location: Required. The geo-location where the resource lives. + :ivar location: The geo-location where the resource lives. Required. :vartype location: str :ivar etag: Resource Etag. :vartype etag: str :ivar hub_profile: The FleetHubProfile configures the Fleet's hub. :vartype hub_profile: ~azure.mgmt.containerservice.v2022_06_02_preview.models.FleetHubProfile :ivar provisioning_state: The provisioning state of the last accepted operation. Known values - are: "Succeeded", "Failed", "Canceled", "Creating", "Deleting", "Updating". + are: "Succeeded", "Failed", "Canceled", "Creating", "Deleting", and "Updating". :vartype provisioning_state: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.FleetProvisioningState """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'location': {'required': True}, - 'etag': {'readonly': True}, - 'provisioning_state': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, + "etag": {"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'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'hub_profile': {'key': 'properties.hubProfile', 'type': 'FleetHubProfile'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "hub_profile": {"key": "properties.hubProfile", "type": "FleetHubProfile"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, } def __init__( @@ -1982,20 +1895,20 @@ def __init__( **kwargs ): """ - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] - :keyword location: Required. The geo-location where the resource lives. + :keyword location: The geo-location where the resource lives. Required. :paramtype location: str :keyword hub_profile: The FleetHubProfile configures the Fleet's hub. :paramtype hub_profile: ~azure.mgmt.containerservice.v2022_06_02_preview.models.FleetHubProfile """ - super(Fleet, self).__init__(tags=tags, location=location, **kwargs) + super().__init__(tags=tags, location=location, **kwargs) self.etag = None self.hub_profile = hub_profile self.provisioning_state = None -class FleetCredentialResult(msrest.serialization.Model): +class FleetCredentialResult(_serialization.Model): """The credential result response. Variables are only populated by the server, and will be ignored when sending a request. @@ -2003,31 +1916,27 @@ class FleetCredentialResult(msrest.serialization.Model): :ivar name: The name of the credential. :vartype name: str :ivar value: Base64-encoded Kubernetes configuration file. - :vartype value: bytearray + :vartype value: bytes """ _validation = { - 'name': {'readonly': True}, - 'value': {'readonly': True}, + "name": {"readonly": True}, + "value": {"readonly": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'bytearray'}, + "name": {"key": "name", "type": "str"}, + "value": {"key": "value", "type": "bytearray"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(FleetCredentialResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.name = None self.value = None -class FleetCredentialResults(msrest.serialization.Model): +class FleetCredentialResults(_serialization.Model): """The list credential result response. Variables are only populated by the server, and will be ignored when sending a request. @@ -2038,24 +1947,20 @@ class FleetCredentialResults(msrest.serialization.Model): """ _validation = { - 'kubeconfigs': {'readonly': True}, + "kubeconfigs": {"readonly": True}, } _attribute_map = { - 'kubeconfigs': {'key': 'kubeconfigs', 'type': '[FleetCredentialResult]'}, + "kubeconfigs": {"key": "kubeconfigs", "type": "[FleetCredentialResult]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(FleetCredentialResults, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.kubeconfigs = None -class FleetHubProfile(msrest.serialization.Model): +class FleetHubProfile(_serialization.Model): """The FleetHubProfile configures the fleet hub. Variables are only populated by the server, and will be ignored when sending a request. @@ -2069,33 +1974,28 @@ class FleetHubProfile(msrest.serialization.Model): """ _validation = { - 'fqdn': {'readonly': True}, - 'kubernetes_version': {'readonly': True}, + "fqdn": {"readonly": True}, + "kubernetes_version": {"readonly": True}, } _attribute_map = { - 'dns_prefix': {'key': 'dnsPrefix', 'type': 'str'}, - 'fqdn': {'key': 'fqdn', 'type': 'str'}, - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, + "dns_prefix": {"key": "dnsPrefix", "type": "str"}, + "fqdn": {"key": "fqdn", "type": "str"}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, } - def __init__( - self, - *, - dns_prefix: Optional[str] = None, - **kwargs - ): + def __init__(self, *, dns_prefix: Optional[str] = None, **kwargs): """ :keyword dns_prefix: DNS prefix used to create the FQDN for the Fleet hub. :paramtype dns_prefix: str """ - super(FleetHubProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.dns_prefix = dns_prefix self.fqdn = None self.kubernetes_version = None -class FleetListResult(msrest.serialization.Model): +class FleetListResult(_serialization.Model): """The response from the List Fleets operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -2107,25 +2007,20 @@ class FleetListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[Fleet]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[Fleet]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.Fleet"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.Fleet"]] = None, **kwargs): """ :keyword value: The list of Fleets. :paramtype value: list[~azure.mgmt.containerservice.v2022_06_02_preview.models.Fleet] """ - super(FleetListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None @@ -2153,48 +2048,43 @@ class FleetMember(AzureEntityResource): '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{clusterName}'. :vartype cluster_resource_id: str :ivar provisioning_state: The provisioning state of the last accepted operation. Known values - are: "Succeeded", "Failed", "Canceled", "Joining", "Leaving", "Updating". + are: "Succeeded", "Failed", "Canceled", "Joining", "Leaving", and "Updating". :vartype provisioning_state: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.FleetMemberProvisioningState """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'etag': {'readonly': True}, - 'provisioning_state': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "etag": {"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'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'cluster_resource_id': {'key': 'properties.clusterResourceId', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "etag": {"key": "etag", "type": "str"}, + "cluster_resource_id": {"key": "properties.clusterResourceId", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, } - def __init__( - self, - *, - cluster_resource_id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, cluster_resource_id: Optional[str] = None, **kwargs): """ :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}'. :paramtype cluster_resource_id: str """ - super(FleetMember, self).__init__(**kwargs) + super().__init__(**kwargs) self.cluster_resource_id = cluster_resource_id self.provisioning_state = None -class FleetMembersListResult(msrest.serialization.Model): +class FleetMembersListResult(_serialization.Model): """The response from the List FleetMembers operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -2206,55 +2096,45 @@ class FleetMembersListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[FleetMember]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[FleetMember]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.FleetMember"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.FleetMember"]] = None, **kwargs): """ :keyword value: The list of members in a given Fleet. :paramtype value: list[~azure.mgmt.containerservice.v2022_06_02_preview.models.FleetMember] """ - super(FleetMembersListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class FleetPatch(msrest.serialization.Model): +class FleetPatch(_serialization.Model): """Properties of a Fleet that can be patched. - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] """ _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] """ - super(FleetPatch, self).__init__(**kwargs) + super().__init__(**kwargs) self.tags = tags -class KubeletConfig(msrest.serialization.Model): +class KubeletConfig(_serialization.Model): # pylint: disable=too-many-instance-attributes """See `AKS custom node configuration `_ for more details. :ivar cpu_manager_policy: The default is 'none'. See `Kubernetes CPU management policies @@ -2294,21 +2174,21 @@ class KubeletConfig(msrest.serialization.Model): """ _validation = { - 'container_log_max_files': {'minimum': 2}, + "container_log_max_files": {"minimum": 2}, } _attribute_map = { - 'cpu_manager_policy': {'key': 'cpuManagerPolicy', 'type': 'str'}, - 'cpu_cfs_quota': {'key': 'cpuCfsQuota', 'type': 'bool'}, - 'cpu_cfs_quota_period': {'key': 'cpuCfsQuotaPeriod', 'type': 'str'}, - 'image_gc_high_threshold': {'key': 'imageGcHighThreshold', 'type': 'int'}, - 'image_gc_low_threshold': {'key': 'imageGcLowThreshold', 'type': 'int'}, - 'topology_manager_policy': {'key': 'topologyManagerPolicy', 'type': 'str'}, - 'allowed_unsafe_sysctls': {'key': 'allowedUnsafeSysctls', 'type': '[str]'}, - 'fail_swap_on': {'key': 'failSwapOn', 'type': 'bool'}, - 'container_log_max_size_mb': {'key': 'containerLogMaxSizeMB', 'type': 'int'}, - 'container_log_max_files': {'key': 'containerLogMaxFiles', 'type': 'int'}, - 'pod_max_pids': {'key': 'podMaxPids', 'type': 'int'}, + "cpu_manager_policy": {"key": "cpuManagerPolicy", "type": "str"}, + "cpu_cfs_quota": {"key": "cpuCfsQuota", "type": "bool"}, + "cpu_cfs_quota_period": {"key": "cpuCfsQuotaPeriod", "type": "str"}, + "image_gc_high_threshold": {"key": "imageGcHighThreshold", "type": "int"}, + "image_gc_low_threshold": {"key": "imageGcLowThreshold", "type": "int"}, + "topology_manager_policy": {"key": "topologyManagerPolicy", "type": "str"}, + "allowed_unsafe_sysctls": {"key": "allowedUnsafeSysctls", "type": "[str]"}, + "fail_swap_on": {"key": "failSwapOn", "type": "bool"}, + "container_log_max_size_mb": {"key": "containerLogMaxSizeMB", "type": "int"}, + "container_log_max_files": {"key": "containerLogMaxFiles", "type": "int"}, + "pod_max_pids": {"key": "podMaxPids", "type": "int"}, } def __init__( @@ -2363,7 +2243,7 @@ def __init__( :keyword pod_max_pids: The maximum number of processes per pod. :paramtype pod_max_pids: int """ - super(KubeletConfig, self).__init__(**kwargs) + super().__init__(**kwargs) self.cpu_manager_policy = cpu_manager_policy self.cpu_cfs_quota = cpu_cfs_quota self.cpu_cfs_quota_period = cpu_cfs_quota_period @@ -2377,7 +2257,7 @@ def __init__( self.pod_max_pids = pod_max_pids -class LinuxOSConfig(msrest.serialization.Model): +class LinuxOSConfig(_serialization.Model): """See `AKS custom node configuration `_ for more details. :ivar sysctls: Sysctl settings for Linux agent nodes. @@ -2396,10 +2276,10 @@ class LinuxOSConfig(msrest.serialization.Model): """ _attribute_map = { - 'sysctls': {'key': 'sysctls', 'type': 'SysctlConfig'}, - 'transparent_huge_page_enabled': {'key': 'transparentHugePageEnabled', 'type': 'str'}, - 'transparent_huge_page_defrag': {'key': 'transparentHugePageDefrag', 'type': 'str'}, - 'swap_file_size_mb': {'key': 'swapFileSizeMB', 'type': 'int'}, + "sysctls": {"key": "sysctls", "type": "SysctlConfig"}, + "transparent_huge_page_enabled": {"key": "transparentHugePageEnabled", "type": "str"}, + "transparent_huge_page_defrag": {"key": "transparentHugePageDefrag", "type": "str"}, + "swap_file_size_mb": {"key": "swapFileSizeMB", "type": "int"}, } def __init__( @@ -2426,7 +2306,7 @@ def __init__( :keyword swap_file_size_mb: The size in MB of a swap file that will be created on each node. :paramtype swap_file_size_mb: int """ - super(LinuxOSConfig, self).__init__(**kwargs) + super().__init__(**kwargs) self.sysctls = sysctls self.transparent_huge_page_enabled = transparent_huge_page_enabled self.transparent_huge_page_defrag = transparent_huge_page_defrag @@ -2456,19 +2336,19 @@ class MaintenanceConfiguration(SubResource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, + "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'}, - 'time_in_week': {'key': 'properties.timeInWeek', 'type': '[TimeInWeek]'}, - 'not_allowed_time': {'key': 'properties.notAllowedTime', 'type': '[TimeSpan]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "time_in_week": {"key": "properties.timeInWeek", "type": "[TimeInWeek]"}, + "not_allowed_time": {"key": "properties.notAllowedTime", "type": "[TimeSpan]"}, } def __init__( @@ -2487,13 +2367,13 @@ def __init__( :paramtype not_allowed_time: list[~azure.mgmt.containerservice.v2022_06_02_preview.models.TimeSpan] """ - super(MaintenanceConfiguration, self).__init__(**kwargs) + super().__init__(**kwargs) self.system_data = None self.time_in_week = time_in_week self.not_allowed_time = not_allowed_time -class MaintenanceConfigurationListResult(msrest.serialization.Model): +class MaintenanceConfigurationListResult(_serialization.Model): """The response from the List maintenance configurations operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -2506,31 +2386,26 @@ class MaintenanceConfigurationListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[MaintenanceConfiguration]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[MaintenanceConfiguration]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.MaintenanceConfiguration"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.MaintenanceConfiguration"]] = None, **kwargs): """ :keyword value: The list of maintenance configurations. :paramtype value: list[~azure.mgmt.containerservice.v2022_06_02_preview.models.MaintenanceConfiguration] """ - super(MaintenanceConfigurationListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class ManagedCluster(TrackedResource): +class ManagedCluster(TrackedResource): # pylint: disable=too-many-instance-attributes """Managed cluster. Variables are only populated by the server, and will be ignored when sending a request. @@ -2548,9 +2423,9 @@ class ManagedCluster(TrackedResource): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.containerservice.v2022_06_02_preview.models.SystemData - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] - :ivar location: Required. The geo-location where the resource lives. + :ivar location: The geo-location where the resource lives. Required. :vartype location: str :ivar sku: The managed cluster SKU. :vartype sku: ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterSKU @@ -2667,7 +2542,7 @@ class ManagedCluster(TrackedResource): :vartype ingress_profile: ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterIngressProfile :ivar public_network_access: Allow or deny public network access for AKS. Known values are: - "Enabled", "Disabled". + "Enabled" and "Disabled". :vartype public_network_access: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.PublicNetworkAccess :ivar workload_auto_scaler_profile: Workload Auto-scaler profile for the container service @@ -2677,70 +2552,82 @@ class ManagedCluster(TrackedResource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'location': {'required': True}, - 'provisioning_state': {'readonly': True}, - 'power_state': {'readonly': True}, - 'max_agent_pools': {'readonly': True}, - 'current_kubernetes_version': {'readonly': True}, - 'fqdn': {'readonly': True}, - 'private_fqdn': {'readonly': True}, - 'azure_portal_fqdn': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, + "provisioning_state": {"readonly": True}, + "power_state": {"readonly": True}, + "max_agent_pools": {"readonly": True}, + "current_kubernetes_version": {"readonly": True}, + "fqdn": {"readonly": True}, + "private_fqdn": {"readonly": True}, + "azure_portal_fqdn": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'ManagedClusterSKU'}, - 'extended_location': {'key': 'extendedLocation', 'type': 'ExtendedLocation'}, - 'identity': {'key': 'identity', 'type': 'ManagedClusterIdentity'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'power_state': {'key': 'properties.powerState', 'type': 'PowerState'}, - 'creation_data': {'key': 'properties.creationData', 'type': 'CreationData'}, - 'max_agent_pools': {'key': 'properties.maxAgentPools', 'type': 'int'}, - 'kubernetes_version': {'key': 'properties.kubernetesVersion', 'type': 'str'}, - 'current_kubernetes_version': {'key': 'properties.currentKubernetesVersion', 'type': 'str'}, - 'dns_prefix': {'key': 'properties.dnsPrefix', 'type': 'str'}, - 'fqdn_subdomain': {'key': 'properties.fqdnSubdomain', 'type': 'str'}, - 'fqdn': {'key': 'properties.fqdn', 'type': 'str'}, - 'private_fqdn': {'key': 'properties.privateFQDN', 'type': 'str'}, - 'azure_portal_fqdn': {'key': 'properties.azurePortalFQDN', 'type': 'str'}, - 'agent_pool_profiles': {'key': 'properties.agentPoolProfiles', 'type': '[ManagedClusterAgentPoolProfile]'}, - 'linux_profile': {'key': 'properties.linuxProfile', 'type': 'ContainerServiceLinuxProfile'}, - 'windows_profile': {'key': 'properties.windowsProfile', 'type': 'ManagedClusterWindowsProfile'}, - 'service_principal_profile': {'key': 'properties.servicePrincipalProfile', 'type': 'ManagedClusterServicePrincipalProfile'}, - 'addon_profiles': {'key': 'properties.addonProfiles', 'type': '{ManagedClusterAddonProfile}'}, - 'pod_identity_profile': {'key': 'properties.podIdentityProfile', 'type': 'ManagedClusterPodIdentityProfile'}, - 'oidc_issuer_profile': {'key': 'properties.oidcIssuerProfile', 'type': 'ManagedClusterOIDCIssuerProfile'}, - 'node_resource_group': {'key': 'properties.nodeResourceGroup', 'type': 'str'}, - 'enable_rbac': {'key': 'properties.enableRBAC', 'type': 'bool'}, - 'enable_pod_security_policy': {'key': 'properties.enablePodSecurityPolicy', 'type': 'bool'}, - 'enable_namespace_resources': {'key': 'properties.enableNamespaceResources', 'type': 'bool'}, - 'network_profile': {'key': 'properties.networkProfile', 'type': 'ContainerServiceNetworkProfile'}, - 'aad_profile': {'key': 'properties.aadProfile', 'type': 'ManagedClusterAADProfile'}, - 'auto_upgrade_profile': {'key': 'properties.autoUpgradeProfile', 'type': 'ManagedClusterAutoUpgradeProfile'}, - 'auto_scaler_profile': {'key': 'properties.autoScalerProfile', 'type': 'ManagedClusterPropertiesAutoScalerProfile'}, - 'api_server_access_profile': {'key': 'properties.apiServerAccessProfile', 'type': 'ManagedClusterAPIServerAccessProfile'}, - 'disk_encryption_set_id': {'key': 'properties.diskEncryptionSetID', 'type': 'str'}, - 'identity_profile': {'key': 'properties.identityProfile', 'type': '{UserAssignedIdentity}'}, - 'private_link_resources': {'key': 'properties.privateLinkResources', 'type': '[PrivateLinkResource]'}, - 'disable_local_accounts': {'key': 'properties.disableLocalAccounts', 'type': 'bool'}, - 'http_proxy_config': {'key': 'properties.httpProxyConfig', 'type': 'ManagedClusterHTTPProxyConfig'}, - 'security_profile': {'key': 'properties.securityProfile', 'type': 'ManagedClusterSecurityProfile'}, - 'storage_profile': {'key': 'properties.storageProfile', 'type': 'ManagedClusterStorageProfile'}, - 'ingress_profile': {'key': 'properties.ingressProfile', 'type': 'ManagedClusterIngressProfile'}, - 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, - 'workload_auto_scaler_profile': {'key': 'properties.workloadAutoScalerProfile', 'type': 'ManagedClusterWorkloadAutoScalerProfile'}, - } - - def __init__( + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "sku": {"key": "sku", "type": "ManagedClusterSKU"}, + "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, + "identity": {"key": "identity", "type": "ManagedClusterIdentity"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "power_state": {"key": "properties.powerState", "type": "PowerState"}, + "creation_data": {"key": "properties.creationData", "type": "CreationData"}, + "max_agent_pools": {"key": "properties.maxAgentPools", "type": "int"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "current_kubernetes_version": {"key": "properties.currentKubernetesVersion", "type": "str"}, + "dns_prefix": {"key": "properties.dnsPrefix", "type": "str"}, + "fqdn_subdomain": {"key": "properties.fqdnSubdomain", "type": "str"}, + "fqdn": {"key": "properties.fqdn", "type": "str"}, + "private_fqdn": {"key": "properties.privateFQDN", "type": "str"}, + "azure_portal_fqdn": {"key": "properties.azurePortalFQDN", "type": "str"}, + "agent_pool_profiles": {"key": "properties.agentPoolProfiles", "type": "[ManagedClusterAgentPoolProfile]"}, + "linux_profile": {"key": "properties.linuxProfile", "type": "ContainerServiceLinuxProfile"}, + "windows_profile": {"key": "properties.windowsProfile", "type": "ManagedClusterWindowsProfile"}, + "service_principal_profile": { + "key": "properties.servicePrincipalProfile", + "type": "ManagedClusterServicePrincipalProfile", + }, + "addon_profiles": {"key": "properties.addonProfiles", "type": "{ManagedClusterAddonProfile}"}, + "pod_identity_profile": {"key": "properties.podIdentityProfile", "type": "ManagedClusterPodIdentityProfile"}, + "oidc_issuer_profile": {"key": "properties.oidcIssuerProfile", "type": "ManagedClusterOIDCIssuerProfile"}, + "node_resource_group": {"key": "properties.nodeResourceGroup", "type": "str"}, + "enable_rbac": {"key": "properties.enableRBAC", "type": "bool"}, + "enable_pod_security_policy": {"key": "properties.enablePodSecurityPolicy", "type": "bool"}, + "enable_namespace_resources": {"key": "properties.enableNamespaceResources", "type": "bool"}, + "network_profile": {"key": "properties.networkProfile", "type": "ContainerServiceNetworkProfile"}, + "aad_profile": {"key": "properties.aadProfile", "type": "ManagedClusterAADProfile"}, + "auto_upgrade_profile": {"key": "properties.autoUpgradeProfile", "type": "ManagedClusterAutoUpgradeProfile"}, + "auto_scaler_profile": { + "key": "properties.autoScalerProfile", + "type": "ManagedClusterPropertiesAutoScalerProfile", + }, + "api_server_access_profile": { + "key": "properties.apiServerAccessProfile", + "type": "ManagedClusterAPIServerAccessProfile", + }, + "disk_encryption_set_id": {"key": "properties.diskEncryptionSetID", "type": "str"}, + "identity_profile": {"key": "properties.identityProfile", "type": "{UserAssignedIdentity}"}, + "private_link_resources": {"key": "properties.privateLinkResources", "type": "[PrivateLinkResource]"}, + "disable_local_accounts": {"key": "properties.disableLocalAccounts", "type": "bool"}, + "http_proxy_config": {"key": "properties.httpProxyConfig", "type": "ManagedClusterHTTPProxyConfig"}, + "security_profile": {"key": "properties.securityProfile", "type": "ManagedClusterSecurityProfile"}, + "storage_profile": {"key": "properties.storageProfile", "type": "ManagedClusterStorageProfile"}, + "ingress_profile": {"key": "properties.ingressProfile", "type": "ManagedClusterIngressProfile"}, + "public_network_access": {"key": "properties.publicNetworkAccess", "type": "str"}, + "workload_auto_scaler_profile": { + "key": "properties.workloadAutoScalerProfile", + "type": "ManagedClusterWorkloadAutoScalerProfile", + }, + } + + def __init__( # pylint: disable=too-many-locals self, *, location: str, @@ -2781,9 +2668,9 @@ def __init__( **kwargs ): """ - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] - :keyword location: Required. The geo-location where the resource lives. + :keyword location: The geo-location where the resource lives. Required. :paramtype location: str :keyword sku: The managed cluster SKU. :paramtype sku: ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterSKU @@ -2885,7 +2772,7 @@ def __init__( :paramtype ingress_profile: ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterIngressProfile :keyword public_network_access: Allow or deny public network access for AKS. Known values are: - "Enabled", "Disabled". + "Enabled" and "Disabled". :paramtype public_network_access: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.PublicNetworkAccess :keyword workload_auto_scaler_profile: Workload Auto-scaler profile for the container service @@ -2893,7 +2780,7 @@ def __init__( :paramtype workload_auto_scaler_profile: ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterWorkloadAutoScalerProfile """ - super(ManagedCluster, self).__init__(tags=tags, location=location, **kwargs) + super().__init__(tags=tags, location=location, **kwargs) self.sku = sku self.extended_location = extended_location self.identity = identity @@ -2936,7 +2823,7 @@ def __init__( self.workload_auto_scaler_profile = workload_auto_scaler_profile -class ManagedClusterAADProfile(msrest.serialization.Model): +class ManagedClusterAADProfile(_serialization.Model): """For more details see `managed AAD on AKS `_. :ivar managed: Whether to enable managed AAD. @@ -2958,13 +2845,13 @@ class ManagedClusterAADProfile(msrest.serialization.Model): """ _attribute_map = { - 'managed': {'key': 'managed', 'type': 'bool'}, - 'enable_azure_rbac': {'key': 'enableAzureRBAC', 'type': 'bool'}, - 'admin_group_object_i_ds': {'key': 'adminGroupObjectIDs', 'type': '[str]'}, - 'client_app_id': {'key': 'clientAppID', 'type': 'str'}, - 'server_app_id': {'key': 'serverAppID', 'type': 'str'}, - 'server_app_secret': {'key': 'serverAppSecret', 'type': 'str'}, - 'tenant_id': {'key': 'tenantID', 'type': 'str'}, + "managed": {"key": "managed", "type": "bool"}, + "enable_azure_rbac": {"key": "enableAzureRBAC", "type": "bool"}, + "admin_group_object_i_ds": {"key": "adminGroupObjectIDs", "type": "[str]"}, + "client_app_id": {"key": "clientAppID", "type": "str"}, + "server_app_id": {"key": "serverAppID", "type": "str"}, + "server_app_secret": {"key": "serverAppSecret", "type": "str"}, + "tenant_id": {"key": "tenantID", "type": "str"}, } def __init__( @@ -2997,7 +2884,7 @@ def __init__( tenant of the deployment subscription. :paramtype tenant_id: str """ - super(ManagedClusterAADProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.managed = managed self.enable_azure_rbac = enable_azure_rbac self.admin_group_object_i_ds = admin_group_object_i_ds @@ -3025,60 +2912,55 @@ class ManagedClusterAccessProfile(TrackedResource): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.containerservice.v2022_06_02_preview.models.SystemData - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] - :ivar location: Required. The geo-location where the resource lives. + :ivar location: The geo-location where the resource lives. Required. :vartype location: str :ivar kube_config: Base64-encoded Kubernetes configuration file. - :vartype kube_config: bytearray + :vartype kube_config: bytes """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'location': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - 'kube_config': {'key': 'properties.kubeConfig', 'type': 'bytearray'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "kube_config": {"key": "properties.kubeConfig", "type": "bytearray"}, } def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - kube_config: Optional[bytearray] = None, - **kwargs + self, *, location: str, tags: Optional[Dict[str, str]] = None, kube_config: Optional[bytes] = None, **kwargs ): """ - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] - :keyword location: Required. The geo-location where the resource lives. + :keyword location: The geo-location where the resource lives. Required. :paramtype location: str :keyword kube_config: Base64-encoded Kubernetes configuration file. - :paramtype kube_config: bytearray + :paramtype kube_config: bytes """ - super(ManagedClusterAccessProfile, self).__init__(tags=tags, location=location, **kwargs) + super().__init__(tags=tags, location=location, **kwargs) self.kube_config = kube_config -class ManagedClusterAddonProfile(msrest.serialization.Model): +class ManagedClusterAddonProfile(_serialization.Model): """A Kubernetes add-on profile for a managed cluster. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar enabled: Required. Whether the add-on is enabled or not. + :ivar enabled: Whether the add-on is enabled or not. Required. :vartype enabled: bool :ivar config: Key-value pairs for configuring an add-on. :vartype config: dict[str, str] @@ -3088,36 +2970,30 @@ class ManagedClusterAddonProfile(msrest.serialization.Model): """ _validation = { - 'enabled': {'required': True}, - 'identity': {'readonly': True}, + "enabled": {"required": True}, + "identity": {"readonly": True}, } _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'config': {'key': 'config', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'ManagedClusterAddonProfileIdentity'}, + "enabled": {"key": "enabled", "type": "bool"}, + "config": {"key": "config", "type": "{str}"}, + "identity": {"key": "identity", "type": "ManagedClusterAddonProfileIdentity"}, } - def __init__( - self, - *, - enabled: bool, - config: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, enabled: bool, config: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword enabled: Required. Whether the add-on is enabled or not. + :keyword enabled: Whether the add-on is enabled or not. Required. :paramtype enabled: bool :keyword config: Key-value pairs for configuring an add-on. :paramtype config: dict[str, str] """ - super(ManagedClusterAddonProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.config = config self.identity = None -class UserAssignedIdentity(msrest.serialization.Model): +class UserAssignedIdentity(_serialization.Model): """Details about a user assigned identity. :ivar resource_id: The resource ID of the user assigned identity. @@ -3129,9 +3005,9 @@ class UserAssignedIdentity(msrest.serialization.Model): """ _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'object_id': {'key': 'objectId', 'type': 'str'}, + "resource_id": {"key": "resourceId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + "object_id": {"key": "objectId", "type": "str"}, } def __init__( @@ -3150,7 +3026,7 @@ def __init__( :keyword object_id: The object ID of the user assigned identity. :paramtype object_id: str """ - super(UserAssignedIdentity, self).__init__(**kwargs) + super().__init__(**kwargs) self.resource_id = resource_id self.client_id = client_id self.object_id = object_id @@ -3168,9 +3044,9 @@ class ManagedClusterAddonProfileIdentity(UserAssignedIdentity): """ _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'object_id': {'key': 'objectId', 'type': 'str'}, + "resource_id": {"key": "resourceId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + "object_id": {"key": "objectId", "type": "str"}, } def __init__( @@ -3189,10 +3065,10 @@ def __init__( :keyword object_id: The object ID of the user assigned identity. :paramtype object_id: str """ - super(ManagedClusterAddonProfileIdentity, self).__init__(resource_id=resource_id, client_id=client_id, object_id=object_id, **kwargs) + super().__init__(resource_id=resource_id, client_id=client_id, object_id=object_id, **kwargs) -class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): +class ManagedClusterAgentPoolProfileProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes """Properties for the container service agent pool profile. Variables are only populated by the server, and will be ignored when sending a request. @@ -3213,15 +3089,15 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.OSDiskType :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data - root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.KubeletDiskType :ivar workload_runtime: Determines the type of workload a node can run. Known values are: - "OCIContainer", "WasmWasi". + "OCIContainer" and "WasmWasi". :vartype workload_runtime: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.WorkloadRuntime :ivar message_of_the_day: A base64-encoded string which will be written to /etc/motd after @@ -3240,13 +3116,13 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :vartype pod_subnet_id: str :ivar max_pods: The maximum number of pods that can run on a node. :vartype max_pods: int - :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.OSType :ivar os_sku: Specifies the OS SKU used by the agent pool. If not specified, the default is Ubuntu if OSType=Linux or Windows2019 if OSType=Windows. And the default Windows OSSKU will be changed to Windows2022 after Windows2019 is deprecated. Known values are: "Ubuntu", - "CBLMariner", "Windows2019", "Windows2022". + "CBLMariner", "Windows2019", and "Windows2022". :vartype os_sku: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.OSSKU :ivar max_count: The maximum number of nodes for auto-scaling. :vartype max_count: int @@ -3255,15 +3131,15 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it - defaults to Delete. Known values are: "Delete", "Deallocate". + defaults to Delete. Known values are: "Delete" and "Deallocate". :vartype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.ScaleDownMode - :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", + :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets" and "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.AgentPoolType :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :vartype mode: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.AgentPoolMode :ivar orchestrator_version: Both patch version and are supported. When is specified, the latest supported patch version is chosen @@ -3309,20 +3185,18 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default - is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + is 'Regular'. Known values are: "Spot" and "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.ScaleSetPriority :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.ScaleSetEvictionPolicy :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :vartype spot_max_price: float - :ivar tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :ivar tags: The tags to be persisted on the agent pool virtual machine scale set. :vartype tags: dict[str, str] :ivar node_labels: The node labels to be persisted across all nodes in agent pool. :vartype node_labels: dict[str, str] @@ -3346,7 +3220,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): for more details. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.GPUInstanceProfile :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the node pool @@ -3363,60 +3237,60 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): """ _validation = { - 'os_disk_size_gb': {'maximum': 2048, 'minimum': 0}, - 'current_orchestrator_version': {'readonly': True}, - 'node_image_version': {'readonly': True}, - 'provisioning_state': {'readonly': True}, + "os_disk_size_gb": {"maximum": 2048, "minimum": 0}, + "current_orchestrator_version": {"readonly": True}, + "node_image_version": {"readonly": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'os_disk_type': {'key': 'osDiskType', 'type': 'str'}, - 'kubelet_disk_type': {'key': 'kubeletDiskType', 'type': 'str'}, - 'workload_runtime': {'key': 'workloadRuntime', 'type': 'str'}, - 'message_of_the_day': {'key': 'messageOfTheDay', 'type': 'str'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'pod_subnet_id': {'key': 'podSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'maxPods', 'type': 'int'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'os_sku': {'key': 'osSKU', 'type': 'str'}, - 'max_count': {'key': 'maxCount', 'type': 'int'}, - 'min_count': {'key': 'minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'enableAutoScaling', 'type': 'bool'}, - 'scale_down_mode': {'key': 'scaleDownMode', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'mode': {'key': 'mode', 'type': 'str'}, - 'orchestrator_version': {'key': 'orchestratorVersion', 'type': 'str'}, - 'current_orchestrator_version': {'key': 'currentOrchestratorVersion', 'type': 'str'}, - 'node_image_version': {'key': 'nodeImageVersion', 'type': 'str'}, - 'upgrade_settings': {'key': 'upgradeSettings', 'type': 'AgentPoolUpgradeSettings'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'power_state': {'key': 'powerState', 'type': 'PowerState'}, - 'availability_zones': {'key': 'availabilityZones', 'type': '[str]'}, - 'enable_node_public_ip': {'key': 'enableNodePublicIP', 'type': 'bool'}, - 'enable_custom_ca_trust': {'key': 'enableCustomCATrust', 'type': 'bool'}, - 'node_public_ip_prefix_id': {'key': 'nodePublicIPPrefixID', 'type': 'str'}, - 'scale_set_priority': {'key': 'scaleSetPriority', 'type': 'str'}, - 'scale_set_eviction_policy': {'key': 'scaleSetEvictionPolicy', 'type': 'str'}, - 'spot_max_price': {'key': 'spotMaxPrice', 'type': 'float'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'node_labels': {'key': 'nodeLabels', 'type': '{str}'}, - 'node_taints': {'key': 'nodeTaints', 'type': '[str]'}, - 'proximity_placement_group_id': {'key': 'proximityPlacementGroupID', 'type': 'str'}, - 'kubelet_config': {'key': 'kubeletConfig', 'type': 'KubeletConfig'}, - 'linux_os_config': {'key': 'linuxOSConfig', 'type': 'LinuxOSConfig'}, - 'enable_encryption_at_host': {'key': 'enableEncryptionAtHost', 'type': 'bool'}, - 'enable_ultra_ssd': {'key': 'enableUltraSSD', 'type': 'bool'}, - 'enable_fips': {'key': 'enableFIPS', 'type': 'bool'}, - 'gpu_instance_profile': {'key': 'gpuInstanceProfile', 'type': 'str'}, - 'creation_data': {'key': 'creationData', 'type': 'CreationData'}, - 'capacity_reservation_group_id': {'key': 'capacityReservationGroupID', 'type': 'str'}, - 'host_group_id': {'key': 'hostGroupID', 'type': 'str'}, - } - - def __init__( + "count": {"key": "count", "type": "int"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "os_disk_type": {"key": "osDiskType", "type": "str"}, + "kubelet_disk_type": {"key": "kubeletDiskType", "type": "str"}, + "workload_runtime": {"key": "workloadRuntime", "type": "str"}, + "message_of_the_day": {"key": "messageOfTheDay", "type": "str"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "pod_subnet_id": {"key": "podSubnetID", "type": "str"}, + "max_pods": {"key": "maxPods", "type": "int"}, + "os_type": {"key": "osType", "type": "str"}, + "os_sku": {"key": "osSKU", "type": "str"}, + "max_count": {"key": "maxCount", "type": "int"}, + "min_count": {"key": "minCount", "type": "int"}, + "enable_auto_scaling": {"key": "enableAutoScaling", "type": "bool"}, + "scale_down_mode": {"key": "scaleDownMode", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "mode": {"key": "mode", "type": "str"}, + "orchestrator_version": {"key": "orchestratorVersion", "type": "str"}, + "current_orchestrator_version": {"key": "currentOrchestratorVersion", "type": "str"}, + "node_image_version": {"key": "nodeImageVersion", "type": "str"}, + "upgrade_settings": {"key": "upgradeSettings", "type": "AgentPoolUpgradeSettings"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "power_state": {"key": "powerState", "type": "PowerState"}, + "availability_zones": {"key": "availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "enableNodePublicIP", "type": "bool"}, + "enable_custom_ca_trust": {"key": "enableCustomCATrust", "type": "bool"}, + "node_public_ip_prefix_id": {"key": "nodePublicIPPrefixID", "type": "str"}, + "scale_set_priority": {"key": "scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "scaleSetEvictionPolicy", "type": "str"}, + "spot_max_price": {"key": "spotMaxPrice", "type": "float"}, + "tags": {"key": "tags", "type": "{str}"}, + "node_labels": {"key": "nodeLabels", "type": "{str}"}, + "node_taints": {"key": "nodeTaints", "type": "[str]"}, + "proximity_placement_group_id": {"key": "proximityPlacementGroupID", "type": "str"}, + "kubelet_config": {"key": "kubeletConfig", "type": "KubeletConfig"}, + "linux_os_config": {"key": "linuxOSConfig", "type": "LinuxOSConfig"}, + "enable_encryption_at_host": {"key": "enableEncryptionAtHost", "type": "bool"}, + "enable_ultra_ssd": {"key": "enableUltraSSD", "type": "bool"}, + "enable_fips": {"key": "enableFIPS", "type": "bool"}, + "gpu_instance_profile": {"key": "gpuInstanceProfile", "type": "str"}, + "creation_data": {"key": "creationData", "type": "CreationData"}, + "capacity_reservation_group_id": {"key": "capacityReservationGroupID", "type": "str"}, + "host_group_id": {"key": "hostGroupID", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, count: Optional[int] = None, @@ -3429,7 +3303,7 @@ def __init__( vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, @@ -3444,9 +3318,9 @@ def __init__( enable_node_public_ip: Optional[bool] = None, enable_custom_ca_trust: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", - spot_max_price: Optional[float] = -1, + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", + spot_max_price: float = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, @@ -3479,15 +3353,15 @@ def __init__( larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.OSDiskType :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime - data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + data root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.KubeletDiskType :keyword workload_runtime: Determines the type of workload a node can run. Known values are: - "OCIContainer", "WasmWasi". + "OCIContainer" and "WasmWasi". :paramtype workload_runtime: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.WorkloadRuntime :keyword message_of_the_day: A base64-encoded string which will be written to /etc/motd after @@ -3506,13 +3380,13 @@ def __init__( :paramtype pod_subnet_id: str :keyword max_pods: The maximum number of pods that can run on a node. :paramtype max_pods: int - :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.OSType :keyword os_sku: Specifies the OS SKU used by the agent pool. If not specified, the default is Ubuntu if OSType=Linux or Windows2019 if OSType=Windows. And the default Windows OSSKU will be changed to Windows2022 after Windows2019 is deprecated. Known values are: "Ubuntu", - "CBLMariner", "Windows2019", "Windows2022". + "CBLMariner", "Windows2019", and "Windows2022". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.OSSKU :keyword max_count: The maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -3521,15 +3395,15 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, - it defaults to Delete. Known values are: "Delete", "Deallocate". + it defaults to Delete. Known values are: "Delete" and "Deallocate". :paramtype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.ScaleDownMode - :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", + :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.AgentPoolType :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.AgentPoolMode :keyword orchestrator_version: Both patch version and are supported. When is specified, the latest supported patch version is chosen @@ -3567,20 +3441,18 @@ def __init__( /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the - default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + default is 'Regular'. Known values are: "Spot" and "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.ScaleSetPriority :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.ScaleSetEvictionPolicy :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :paramtype spot_max_price: float - :keyword tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :keyword tags: The tags to be persisted on the agent pool virtual machine scale set. :paramtype tags: dict[str, str] :keyword node_labels: The node labels to be persisted across all nodes in agent pool. :paramtype node_labels: dict[str, str] @@ -3606,7 +3478,7 @@ def __init__( for more details. :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance - profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.GPUInstanceProfile @@ -3622,7 +3494,7 @@ def __init__( `_. :paramtype host_group_id: str """ - super(ManagedClusterAgentPoolProfileProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.vm_size = vm_size self.os_disk_size_gb = os_disk_size_gb @@ -3669,7 +3541,9 @@ def __init__( self.host_group_id = host_group_id -class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): +class ManagedClusterAgentPoolProfile( + ManagedClusterAgentPoolProfileProperties +): # pylint: disable=too-many-instance-attributes """Profile for the container service agent pool. Variables are only populated by the server, and will be ignored when sending a request. @@ -3692,15 +3566,15 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.OSDiskType :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data - root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.KubeletDiskType :ivar workload_runtime: Determines the type of workload a node can run. Known values are: - "OCIContainer", "WasmWasi". + "OCIContainer" and "WasmWasi". :vartype workload_runtime: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.WorkloadRuntime :ivar message_of_the_day: A base64-encoded string which will be written to /etc/motd after @@ -3719,13 +3593,13 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :vartype pod_subnet_id: str :ivar max_pods: The maximum number of pods that can run on a node. :vartype max_pods: int - :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.OSType :ivar os_sku: Specifies the OS SKU used by the agent pool. If not specified, the default is Ubuntu if OSType=Linux or Windows2019 if OSType=Windows. And the default Windows OSSKU will be changed to Windows2022 after Windows2019 is deprecated. Known values are: "Ubuntu", - "CBLMariner", "Windows2019", "Windows2022". + "CBLMariner", "Windows2019", and "Windows2022". :vartype os_sku: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.OSSKU :ivar max_count: The maximum number of nodes for auto-scaling. :vartype max_count: int @@ -3734,15 +3608,15 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it - defaults to Delete. Known values are: "Delete", "Deallocate". + defaults to Delete. Known values are: "Delete" and "Deallocate". :vartype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.ScaleDownMode - :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", + :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets" and "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.AgentPoolType :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :vartype mode: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.AgentPoolMode :ivar orchestrator_version: Both patch version and are supported. When is specified, the latest supported patch version is chosen @@ -3788,20 +3662,18 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default - is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + is 'Regular'. Known values are: "Spot" and "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.ScaleSetPriority :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.ScaleSetEvictionPolicy :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :vartype spot_max_price: float - :ivar tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :ivar tags: The tags to be persisted on the agent pool virtual machine scale set. :vartype tags: dict[str, str] :ivar node_labels: The node labels to be persisted across all nodes in agent pool. :vartype node_labels: dict[str, str] @@ -3825,7 +3697,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): for more details. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.GPUInstanceProfile :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the node pool @@ -3839,67 +3711,67 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): For more information see `Azure dedicated hosts `_. :vartype host_group_id: str - :ivar name: Required. Windows agent pool names must be 6 characters or less. + :ivar name: Windows agent pool names must be 6 characters or less. Required. :vartype name: str """ _validation = { - 'os_disk_size_gb': {'maximum': 2048, 'minimum': 0}, - 'current_orchestrator_version': {'readonly': True}, - 'node_image_version': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'name': {'required': True, 'pattern': r'^[a-z][a-z0-9]{0,11}$'}, + "os_disk_size_gb": {"maximum": 2048, "minimum": 0}, + "current_orchestrator_version": {"readonly": True}, + "node_image_version": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "name": {"required": True, "pattern": r"^[a-z][a-z0-9]{0,11}$"}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, - 'os_disk_type': {'key': 'osDiskType', 'type': 'str'}, - 'kubelet_disk_type': {'key': 'kubeletDiskType', 'type': 'str'}, - 'workload_runtime': {'key': 'workloadRuntime', 'type': 'str'}, - 'message_of_the_day': {'key': 'messageOfTheDay', 'type': 'str'}, - 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, - 'pod_subnet_id': {'key': 'podSubnetID', 'type': 'str'}, - 'max_pods': {'key': 'maxPods', 'type': 'int'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'os_sku': {'key': 'osSKU', 'type': 'str'}, - 'max_count': {'key': 'maxCount', 'type': 'int'}, - 'min_count': {'key': 'minCount', 'type': 'int'}, - 'enable_auto_scaling': {'key': 'enableAutoScaling', 'type': 'bool'}, - 'scale_down_mode': {'key': 'scaleDownMode', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'mode': {'key': 'mode', 'type': 'str'}, - 'orchestrator_version': {'key': 'orchestratorVersion', 'type': 'str'}, - 'current_orchestrator_version': {'key': 'currentOrchestratorVersion', 'type': 'str'}, - 'node_image_version': {'key': 'nodeImageVersion', 'type': 'str'}, - 'upgrade_settings': {'key': 'upgradeSettings', 'type': 'AgentPoolUpgradeSettings'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'power_state': {'key': 'powerState', 'type': 'PowerState'}, - 'availability_zones': {'key': 'availabilityZones', 'type': '[str]'}, - 'enable_node_public_ip': {'key': 'enableNodePublicIP', 'type': 'bool'}, - 'enable_custom_ca_trust': {'key': 'enableCustomCATrust', 'type': 'bool'}, - 'node_public_ip_prefix_id': {'key': 'nodePublicIPPrefixID', 'type': 'str'}, - 'scale_set_priority': {'key': 'scaleSetPriority', 'type': 'str'}, - 'scale_set_eviction_policy': {'key': 'scaleSetEvictionPolicy', 'type': 'str'}, - 'spot_max_price': {'key': 'spotMaxPrice', 'type': 'float'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'node_labels': {'key': 'nodeLabels', 'type': '{str}'}, - 'node_taints': {'key': 'nodeTaints', 'type': '[str]'}, - 'proximity_placement_group_id': {'key': 'proximityPlacementGroupID', 'type': 'str'}, - 'kubelet_config': {'key': 'kubeletConfig', 'type': 'KubeletConfig'}, - 'linux_os_config': {'key': 'linuxOSConfig', 'type': 'LinuxOSConfig'}, - 'enable_encryption_at_host': {'key': 'enableEncryptionAtHost', 'type': 'bool'}, - 'enable_ultra_ssd': {'key': 'enableUltraSSD', 'type': 'bool'}, - 'enable_fips': {'key': 'enableFIPS', 'type': 'bool'}, - 'gpu_instance_profile': {'key': 'gpuInstanceProfile', 'type': 'str'}, - 'creation_data': {'key': 'creationData', 'type': 'CreationData'}, - 'capacity_reservation_group_id': {'key': 'capacityReservationGroupID', 'type': 'str'}, - 'host_group_id': {'key': 'hostGroupID', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( + "count": {"key": "count", "type": "int"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "os_disk_type": {"key": "osDiskType", "type": "str"}, + "kubelet_disk_type": {"key": "kubeletDiskType", "type": "str"}, + "workload_runtime": {"key": "workloadRuntime", "type": "str"}, + "message_of_the_day": {"key": "messageOfTheDay", "type": "str"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "pod_subnet_id": {"key": "podSubnetID", "type": "str"}, + "max_pods": {"key": "maxPods", "type": "int"}, + "os_type": {"key": "osType", "type": "str"}, + "os_sku": {"key": "osSKU", "type": "str"}, + "max_count": {"key": "maxCount", "type": "int"}, + "min_count": {"key": "minCount", "type": "int"}, + "enable_auto_scaling": {"key": "enableAutoScaling", "type": "bool"}, + "scale_down_mode": {"key": "scaleDownMode", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "mode": {"key": "mode", "type": "str"}, + "orchestrator_version": {"key": "orchestratorVersion", "type": "str"}, + "current_orchestrator_version": {"key": "currentOrchestratorVersion", "type": "str"}, + "node_image_version": {"key": "nodeImageVersion", "type": "str"}, + "upgrade_settings": {"key": "upgradeSettings", "type": "AgentPoolUpgradeSettings"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "power_state": {"key": "powerState", "type": "PowerState"}, + "availability_zones": {"key": "availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "enableNodePublicIP", "type": "bool"}, + "enable_custom_ca_trust": {"key": "enableCustomCATrust", "type": "bool"}, + "node_public_ip_prefix_id": {"key": "nodePublicIPPrefixID", "type": "str"}, + "scale_set_priority": {"key": "scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "scaleSetEvictionPolicy", "type": "str"}, + "spot_max_price": {"key": "spotMaxPrice", "type": "float"}, + "tags": {"key": "tags", "type": "{str}"}, + "node_labels": {"key": "nodeLabels", "type": "{str}"}, + "node_taints": {"key": "nodeTaints", "type": "[str]"}, + "proximity_placement_group_id": {"key": "proximityPlacementGroupID", "type": "str"}, + "kubelet_config": {"key": "kubeletConfig", "type": "KubeletConfig"}, + "linux_os_config": {"key": "linuxOSConfig", "type": "LinuxOSConfig"}, + "enable_encryption_at_host": {"key": "enableEncryptionAtHost", "type": "bool"}, + "enable_ultra_ssd": {"key": "enableUltraSSD", "type": "bool"}, + "enable_fips": {"key": "enableFIPS", "type": "bool"}, + "gpu_instance_profile": {"key": "gpuInstanceProfile", "type": "str"}, + "creation_data": {"key": "creationData", "type": "CreationData"}, + "capacity_reservation_group_id": {"key": "capacityReservationGroupID", "type": "str"}, + "host_group_id": {"key": "hostGroupID", "type": "str"}, + "name": {"key": "name", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, name: str, @@ -3913,7 +3785,7 @@ def __init__( vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, @@ -3928,9 +3800,9 @@ def __init__( enable_node_public_ip: Optional[bool] = None, enable_custom_ca_trust: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", - spot_max_price: Optional[float] = -1, + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", + spot_max_price: float = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, @@ -3963,15 +3835,15 @@ def __init__( larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS `_. Known values are: - "Managed", "Ephemeral". + "Managed" and "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.OSDiskType :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime - data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + data root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.KubeletDiskType :keyword workload_runtime: Determines the type of workload a node can run. Known values are: - "OCIContainer", "WasmWasi". + "OCIContainer" and "WasmWasi". :paramtype workload_runtime: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.WorkloadRuntime :keyword message_of_the_day: A base64-encoded string which will be written to /etc/motd after @@ -3990,13 +3862,13 @@ def __init__( :paramtype pod_subnet_id: str :keyword max_pods: The maximum number of pods that can run on a node. :paramtype max_pods: int - :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.OSType :keyword os_sku: Specifies the OS SKU used by the agent pool. If not specified, the default is Ubuntu if OSType=Linux or Windows2019 if OSType=Windows. And the default Windows OSSKU will be changed to Windows2022 after Windows2019 is deprecated. Known values are: "Ubuntu", - "CBLMariner", "Windows2019", "Windows2022". + "CBLMariner", "Windows2019", and "Windows2022". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.OSSKU :keyword max_count: The maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -4005,15 +3877,15 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, - it defaults to Delete. Known values are: "Delete", "Deallocate". + it defaults to Delete. Known values are: "Delete" and "Deallocate". :paramtype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.ScaleDownMode - :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", + :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets" and "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.AgentPoolType :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.AgentPoolMode :keyword orchestrator_version: Both patch version and are supported. When is specified, the latest supported patch version is chosen @@ -4051,20 +3923,18 @@ def __init__( /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the - default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + default is 'Regular'. Known values are: "Spot" and "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.ScaleSetPriority :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". - Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.ScaleSetEvictionPolicy :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see `spot VMs pricing `_. :paramtype spot_max_price: float - :keyword tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale - set. + :keyword tags: The tags to be persisted on the agent pool virtual machine scale set. :paramtype tags: dict[str, str] :keyword node_labels: The node labels to be persisted across all nodes in agent pool. :paramtype node_labels: dict[str, str] @@ -4090,7 +3960,7 @@ def __init__( for more details. :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance - profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.GPUInstanceProfile @@ -4105,14 +3975,57 @@ def __init__( For more information see `Azure dedicated hosts `_. :paramtype host_group_id: str - :keyword name: Required. Windows agent pool names must be 6 characters or less. + :keyword name: Windows agent pool names must be 6 characters or less. Required. :paramtype name: str """ - super(ManagedClusterAgentPoolProfile, self).__init__(count=count, vm_size=vm_size, os_disk_size_gb=os_disk_size_gb, os_disk_type=os_disk_type, kubelet_disk_type=kubelet_disk_type, workload_runtime=workload_runtime, message_of_the_day=message_of_the_day, vnet_subnet_id=vnet_subnet_id, pod_subnet_id=pod_subnet_id, max_pods=max_pods, os_type=os_type, os_sku=os_sku, max_count=max_count, min_count=min_count, enable_auto_scaling=enable_auto_scaling, scale_down_mode=scale_down_mode, type=type, mode=mode, orchestrator_version=orchestrator_version, upgrade_settings=upgrade_settings, power_state=power_state, availability_zones=availability_zones, enable_node_public_ip=enable_node_public_ip, enable_custom_ca_trust=enable_custom_ca_trust, node_public_ip_prefix_id=node_public_ip_prefix_id, scale_set_priority=scale_set_priority, scale_set_eviction_policy=scale_set_eviction_policy, spot_max_price=spot_max_price, tags=tags, node_labels=node_labels, node_taints=node_taints, proximity_placement_group_id=proximity_placement_group_id, kubelet_config=kubelet_config, linux_os_config=linux_os_config, enable_encryption_at_host=enable_encryption_at_host, enable_ultra_ssd=enable_ultra_ssd, enable_fips=enable_fips, gpu_instance_profile=gpu_instance_profile, creation_data=creation_data, capacity_reservation_group_id=capacity_reservation_group_id, host_group_id=host_group_id, **kwargs) + super().__init__( + count=count, + vm_size=vm_size, + os_disk_size_gb=os_disk_size_gb, + os_disk_type=os_disk_type, + kubelet_disk_type=kubelet_disk_type, + workload_runtime=workload_runtime, + message_of_the_day=message_of_the_day, + vnet_subnet_id=vnet_subnet_id, + pod_subnet_id=pod_subnet_id, + max_pods=max_pods, + os_type=os_type, + os_sku=os_sku, + max_count=max_count, + min_count=min_count, + enable_auto_scaling=enable_auto_scaling, + scale_down_mode=scale_down_mode, + type=type, + mode=mode, + orchestrator_version=orchestrator_version, + upgrade_settings=upgrade_settings, + power_state=power_state, + availability_zones=availability_zones, + enable_node_public_ip=enable_node_public_ip, + enable_custom_ca_trust=enable_custom_ca_trust, + node_public_ip_prefix_id=node_public_ip_prefix_id, + scale_set_priority=scale_set_priority, + scale_set_eviction_policy=scale_set_eviction_policy, + spot_max_price=spot_max_price, + tags=tags, + node_labels=node_labels, + node_taints=node_taints, + proximity_placement_group_id=proximity_placement_group_id, + kubelet_config=kubelet_config, + linux_os_config=linux_os_config, + enable_encryption_at_host=enable_encryption_at_host, + enable_ultra_ssd=enable_ultra_ssd, + enable_fips=enable_fips, + gpu_instance_profile=gpu_instance_profile, + creation_data=creation_data, + capacity_reservation_group_id=capacity_reservation_group_id, + host_group_id=host_group_id, + **kwargs + ) self.name = name -class ManagedClusterAPIServerAccessProfile(msrest.serialization.Model): +class ManagedClusterAPIServerAccessProfile(_serialization.Model): """Access profile for managed cluster API server. :ivar authorized_ip_ranges: IP ranges are specified in CIDR format, e.g. 137.117.106.88/29. @@ -4141,13 +4054,13 @@ class ManagedClusterAPIServerAccessProfile(msrest.serialization.Model): """ _attribute_map = { - 'authorized_ip_ranges': {'key': 'authorizedIPRanges', 'type': '[str]'}, - 'enable_private_cluster': {'key': 'enablePrivateCluster', 'type': 'bool'}, - 'private_dns_zone': {'key': 'privateDNSZone', 'type': 'str'}, - 'enable_private_cluster_public_fqdn': {'key': 'enablePrivateClusterPublicFQDN', 'type': 'bool'}, - 'disable_run_command': {'key': 'disableRunCommand', 'type': 'bool'}, - 'enable_vnet_integration': {'key': 'enableVnetIntegration', 'type': 'bool'}, - 'subnet_id': {'key': 'subnetId', 'type': 'str'}, + "authorized_ip_ranges": {"key": "authorizedIPRanges", "type": "[str]"}, + "enable_private_cluster": {"key": "enablePrivateCluster", "type": "bool"}, + "private_dns_zone": {"key": "privateDNSZone", "type": "str"}, + "enable_private_cluster_public_fqdn": {"key": "enablePrivateClusterPublicFQDN", "type": "bool"}, + "disable_run_command": {"key": "disableRunCommand", "type": "bool"}, + "enable_vnet_integration": {"key": "enableVnetIntegration", "type": "bool"}, + "subnet_id": {"key": "subnetId", "type": "str"}, } def __init__( @@ -4187,7 +4100,7 @@ def __init__( an existing cluster to enable apiserver vnet integration. :paramtype subnet_id: str """ - super(ManagedClusterAPIServerAccessProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.authorized_ip_ranges = authorized_ip_ranges self.enable_private_cluster = enable_private_cluster self.private_dns_zone = private_dns_zone @@ -4197,38 +4110,33 @@ def __init__( self.subnet_id = subnet_id -class ManagedClusterAutoUpgradeProfile(msrest.serialization.Model): +class ManagedClusterAutoUpgradeProfile(_serialization.Model): """Auto upgrade profile for a managed cluster. :ivar upgrade_channel: For more information see `setting the AKS cluster auto-upgrade channel `_. Known values - are: "rapid", "stable", "patch", "node-image", "none". + are: "rapid", "stable", "patch", "node-image", and "none". :vartype upgrade_channel: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.UpgradeChannel """ _attribute_map = { - 'upgrade_channel': {'key': 'upgradeChannel', 'type': 'str'}, + "upgrade_channel": {"key": "upgradeChannel", "type": "str"}, } - def __init__( - self, - *, - upgrade_channel: Optional[Union[str, "_models.UpgradeChannel"]] = None, - **kwargs - ): + def __init__(self, *, upgrade_channel: Optional[Union[str, "_models.UpgradeChannel"]] = None, **kwargs): """ :keyword upgrade_channel: For more information see `setting the AKS cluster auto-upgrade channel `_. - Known values are: "rapid", "stable", "patch", "node-image", "none". + Known values are: "rapid", "stable", "patch", "node-image", and "none". :paramtype upgrade_channel: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.UpgradeChannel """ - super(ManagedClusterAutoUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.upgrade_channel = upgrade_channel -class ManagedClusterHTTPProxyConfig(msrest.serialization.Model): +class ManagedClusterHTTPProxyConfig(_serialization.Model): """Cluster HTTP proxy configuration. Variables are only populated by the server, and will be ignored when sending a request. @@ -4247,15 +4155,15 @@ class ManagedClusterHTTPProxyConfig(msrest.serialization.Model): """ _validation = { - 'effective_no_proxy': {'readonly': True}, + "effective_no_proxy": {"readonly": True}, } _attribute_map = { - 'http_proxy': {'key': 'httpProxy', 'type': 'str'}, - 'https_proxy': {'key': 'httpsProxy', 'type': 'str'}, - 'no_proxy': {'key': 'noProxy', 'type': '[str]'}, - 'effective_no_proxy': {'key': 'effectiveNoProxy', 'type': '[str]'}, - 'trusted_ca': {'key': 'trustedCa', 'type': 'str'}, + "http_proxy": {"key": "httpProxy", "type": "str"}, + "https_proxy": {"key": "httpsProxy", "type": "str"}, + "no_proxy": {"key": "noProxy", "type": "[str]"}, + "effective_no_proxy": {"key": "effectiveNoProxy", "type": "[str]"}, + "trusted_ca": {"key": "trustedCa", "type": "str"}, } def __init__( @@ -4277,7 +4185,7 @@ def __init__( :keyword trusted_ca: Alternative CA cert to use for connecting to proxy servers. :paramtype trusted_ca: str """ - super(ManagedClusterHTTPProxyConfig, self).__init__(**kwargs) + super().__init__(**kwargs) self.http_proxy = http_proxy self.https_proxy = https_proxy self.no_proxy = no_proxy @@ -4285,7 +4193,7 @@ def __init__( self.trusted_ca = trusted_ca -class ManagedClusterIdentity(msrest.serialization.Model): +class ManagedClusterIdentity(_serialization.Model): """Identity for the managed cluster. Variables are only populated by the server, and will be ignored when sending a request. @@ -4298,7 +4206,7 @@ class ManagedClusterIdentity(msrest.serialization.Model): :vartype tenant_id: str :ivar type: For more information see `use managed identities in AKS `_. Known values are: - "SystemAssigned", "UserAssigned", "None". + "SystemAssigned", "UserAssigned", and "None". :vartype type: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.ResourceIdentityType :ivar user_assigned_identities: The keys must be ARM resource IDs in the form: @@ -4308,28 +4216,33 @@ class ManagedClusterIdentity(msrest.serialization.Model): """ _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, + "principal_id": {"readonly": True}, + "tenant_id": {"readonly": True}, } _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{ManagedServiceIdentityUserAssignedIdentitiesValue}'}, + "principal_id": {"key": "principalId", "type": "str"}, + "tenant_id": {"key": "tenantId", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "user_assigned_identities": { + "key": "userAssignedIdentities", + "type": "{ManagedServiceIdentityUserAssignedIdentitiesValue}", + }, } def __init__( self, *, type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, - user_assigned_identities: Optional[Dict[str, "_models.ManagedServiceIdentityUserAssignedIdentitiesValue"]] = None, + user_assigned_identities: Optional[ + Dict[str, "_models.ManagedServiceIdentityUserAssignedIdentitiesValue"] + ] = None, **kwargs ): """ :keyword type: For more information see `use managed identities in AKS `_. Known values are: - "SystemAssigned", "UserAssigned", "None". + "SystemAssigned", "UserAssigned", and "None". :paramtype type: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.ResourceIdentityType :keyword user_assigned_identities: The keys must be ARM resource IDs in the form: @@ -4337,14 +4250,14 @@ def __init__( :paramtype user_assigned_identities: dict[str, ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedServiceIdentityUserAssignedIdentitiesValue] """ - super(ManagedClusterIdentity, self).__init__(**kwargs) + super().__init__(**kwargs) self.principal_id = None self.tenant_id = None self.type = type self.user_assigned_identities = user_assigned_identities -class ManagedClusterIngressProfile(msrest.serialization.Model): +class ManagedClusterIngressProfile(_serialization.Model): """Ingress profile for the container service cluster. :ivar web_app_routing: Web App Routing settings for the ingress profile. @@ -4353,25 +4266,22 @@ class ManagedClusterIngressProfile(msrest.serialization.Model): """ _attribute_map = { - 'web_app_routing': {'key': 'webAppRouting', 'type': 'ManagedClusterIngressProfileWebAppRouting'}, + "web_app_routing": {"key": "webAppRouting", "type": "ManagedClusterIngressProfileWebAppRouting"}, } def __init__( - self, - *, - web_app_routing: Optional["_models.ManagedClusterIngressProfileWebAppRouting"] = None, - **kwargs + self, *, web_app_routing: Optional["_models.ManagedClusterIngressProfileWebAppRouting"] = None, **kwargs ): """ :keyword web_app_routing: Web App Routing settings for the ingress profile. :paramtype web_app_routing: ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterIngressProfileWebAppRouting """ - super(ManagedClusterIngressProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.web_app_routing = web_app_routing -class ManagedClusterIngressProfileWebAppRouting(msrest.serialization.Model): +class ManagedClusterIngressProfileWebAppRouting(_serialization.Model): """Web App Routing settings for the ingress profile. :ivar enabled: Whether to enable Web App Routing. @@ -4382,17 +4292,11 @@ class ManagedClusterIngressProfileWebAppRouting(msrest.serialization.Model): """ _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'dns_zone_resource_id': {'key': 'dnsZoneResourceId', 'type': 'str'}, + "enabled": {"key": "enabled", "type": "bool"}, + "dns_zone_resource_id": {"key": "dnsZoneResourceId", "type": "str"}, } - def __init__( - self, - *, - enabled: Optional[bool] = None, - dns_zone_resource_id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, enabled: Optional[bool] = None, dns_zone_resource_id: Optional[str] = None, **kwargs): """ :keyword enabled: Whether to enable Web App Routing. :paramtype enabled: bool @@ -4400,12 +4304,12 @@ def __init__( Used only when Web App Routing is enabled. :paramtype dns_zone_resource_id: str """ - super(ManagedClusterIngressProfileWebAppRouting, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.dns_zone_resource_id = dns_zone_resource_id -class ManagedClusterListResult(msrest.serialization.Model): +class ManagedClusterListResult(_serialization.Model): """The response from the List Managed Clusters operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -4417,30 +4321,25 @@ class ManagedClusterListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[ManagedCluster]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[ManagedCluster]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.ManagedCluster"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.ManagedCluster"]] = None, **kwargs): """ :keyword value: The list of managed clusters. :paramtype value: list[~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedCluster] """ - super(ManagedClusterListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class ManagedClusterLoadBalancerProfile(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfile(_serialization.Model): """Profile of the managed cluster load balancer. :ivar managed_outbound_i_ps: Desired managed outbound IPs for the cluster load balancer. @@ -4469,18 +4368,24 @@ class ManagedClusterLoadBalancerProfile(msrest.serialization.Model): """ _validation = { - 'allocated_outbound_ports': {'maximum': 64000, 'minimum': 0}, - 'idle_timeout_in_minutes': {'maximum': 120, 'minimum': 4}, + "allocated_outbound_ports": {"maximum": 64000, "minimum": 0}, + "idle_timeout_in_minutes": {"maximum": 120, "minimum": 4}, } _attribute_map = { - 'managed_outbound_i_ps': {'key': 'managedOutboundIPs', 'type': 'ManagedClusterLoadBalancerProfileManagedOutboundIPs'}, - 'outbound_ip_prefixes': {'key': 'outboundIPPrefixes', 'type': 'ManagedClusterLoadBalancerProfileOutboundIPPrefixes'}, - 'outbound_i_ps': {'key': 'outboundIPs', 'type': 'ManagedClusterLoadBalancerProfileOutboundIPs'}, - 'effective_outbound_i_ps': {'key': 'effectiveOutboundIPs', 'type': '[ResourceReference]'}, - 'allocated_outbound_ports': {'key': 'allocatedOutboundPorts', 'type': 'int'}, - 'idle_timeout_in_minutes': {'key': 'idleTimeoutInMinutes', 'type': 'int'}, - 'enable_multiple_standard_load_balancers': {'key': 'enableMultipleStandardLoadBalancers', 'type': 'bool'}, + "managed_outbound_i_ps": { + "key": "managedOutboundIPs", + "type": "ManagedClusterLoadBalancerProfileManagedOutboundIPs", + }, + "outbound_ip_prefixes": { + "key": "outboundIPPrefixes", + "type": "ManagedClusterLoadBalancerProfileOutboundIPPrefixes", + }, + "outbound_i_ps": {"key": "outboundIPs", "type": "ManagedClusterLoadBalancerProfileOutboundIPs"}, + "effective_outbound_i_ps": {"key": "effectiveOutboundIPs", "type": "[ResourceReference]"}, + "allocated_outbound_ports": {"key": "allocatedOutboundPorts", "type": "int"}, + "idle_timeout_in_minutes": {"key": "idleTimeoutInMinutes", "type": "int"}, + "enable_multiple_standard_load_balancers": {"key": "enableMultipleStandardLoadBalancers", "type": "bool"}, } def __init__( @@ -4490,8 +4395,8 @@ def __init__( outbound_ip_prefixes: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPPrefixes"] = None, outbound_i_ps: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPs"] = None, effective_outbound_i_ps: Optional[List["_models.ResourceReference"]] = None, - allocated_outbound_ports: Optional[int] = 0, - idle_timeout_in_minutes: Optional[int] = 30, + allocated_outbound_ports: int = 0, + idle_timeout_in_minutes: int = 30, enable_multiple_standard_load_balancers: Optional[bool] = None, **kwargs ): @@ -4521,7 +4426,7 @@ def __init__( AKS cluster or not. :paramtype enable_multiple_standard_load_balancers: bool """ - super(ManagedClusterLoadBalancerProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.managed_outbound_i_ps = managed_outbound_i_ps self.outbound_ip_prefixes = outbound_ip_prefixes self.outbound_i_ps = outbound_i_ps @@ -4531,7 +4436,7 @@ def __init__( self.enable_multiple_standard_load_balancers = enable_multiple_standard_load_balancers -class ManagedClusterLoadBalancerProfileManagedOutboundIPs(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfileManagedOutboundIPs(_serialization.Model): """Desired managed outbound IPs for the cluster load balancer. :ivar count: The desired number of IPv4 outbound IPs created/managed by Azure for the cluster @@ -4545,22 +4450,16 @@ class ManagedClusterLoadBalancerProfileManagedOutboundIPs(msrest.serialization.M """ _validation = { - 'count': {'maximum': 100, 'minimum': 1}, - 'count_ipv6': {'maximum': 100, 'minimum': 0}, + "count": {"maximum": 100, "minimum": 1}, + "count_ipv6": {"maximum": 100, "minimum": 0}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'count_ipv6': {'key': 'countIPv6', 'type': 'int'}, + "count": {"key": "count", "type": "int"}, + "count_ipv6": {"key": "countIPv6", "type": "int"}, } - def __init__( - self, - *, - count: Optional[int] = 1, - count_ipv6: Optional[int] = 0, - **kwargs - ): + def __init__(self, *, count: int = 1, count_ipv6: int = 0, **kwargs): """ :keyword count: The desired number of IPv4 outbound IPs created/managed by Azure for the cluster load balancer. Allowed values must be in the range of 1 to 100 (inclusive). The default @@ -4571,12 +4470,12 @@ def __init__( value is 0 for single-stack and 1 for dual-stack. :paramtype count_ipv6: int """ - super(ManagedClusterLoadBalancerProfileManagedOutboundIPs, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.count_ipv6 = count_ipv6 -class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(_serialization.Model): """Desired outbound IP Prefix resources for the cluster load balancer. :ivar public_ip_prefixes: A list of public IP prefix resources. @@ -4585,25 +4484,20 @@ class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(msrest.serialization.M """ _attribute_map = { - 'public_ip_prefixes': {'key': 'publicIPPrefixes', 'type': '[ResourceReference]'}, + "public_ip_prefixes": {"key": "publicIPPrefixes", "type": "[ResourceReference]"}, } - def __init__( - self, - *, - public_ip_prefixes: Optional[List["_models.ResourceReference"]] = None, - **kwargs - ): + def __init__(self, *, public_ip_prefixes: Optional[List["_models.ResourceReference"]] = None, **kwargs): """ :keyword public_ip_prefixes: A list of public IP prefix resources. :paramtype public_ip_prefixes: list[~azure.mgmt.containerservice.v2022_06_02_preview.models.ResourceReference] """ - super(ManagedClusterLoadBalancerProfileOutboundIPPrefixes, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_ip_prefixes = public_ip_prefixes -class ManagedClusterLoadBalancerProfileOutboundIPs(msrest.serialization.Model): +class ManagedClusterLoadBalancerProfileOutboundIPs(_serialization.Model): """Desired outbound IP resources for the cluster load balancer. :ivar public_i_ps: A list of public IP resources. @@ -4612,25 +4506,20 @@ class ManagedClusterLoadBalancerProfileOutboundIPs(msrest.serialization.Model): """ _attribute_map = { - 'public_i_ps': {'key': 'publicIPs', 'type': '[ResourceReference]'}, + "public_i_ps": {"key": "publicIPs", "type": "[ResourceReference]"}, } - def __init__( - self, - *, - public_i_ps: Optional[List["_models.ResourceReference"]] = None, - **kwargs - ): + def __init__(self, *, public_i_ps: Optional[List["_models.ResourceReference"]] = None, **kwargs): """ :keyword public_i_ps: A list of public IP resources. :paramtype public_i_ps: list[~azure.mgmt.containerservice.v2022_06_02_preview.models.ResourceReference] """ - super(ManagedClusterLoadBalancerProfileOutboundIPs, self).__init__(**kwargs) + super().__init__(**kwargs) self.public_i_ps = public_i_ps -class ManagedClusterManagedOutboundIPProfile(msrest.serialization.Model): +class ManagedClusterManagedOutboundIPProfile(_serialization.Model): """Profile of the managed outbound IP resources of the managed cluster. :ivar count: The desired number of outbound IPs created/managed by Azure. Allowed values must @@ -4639,29 +4528,24 @@ class ManagedClusterManagedOutboundIPProfile(msrest.serialization.Model): """ _validation = { - 'count': {'maximum': 16, 'minimum': 1}, + "count": {"maximum": 16, "minimum": 1}, } _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, + "count": {"key": "count", "type": "int"}, } - def __init__( - self, - *, - count: Optional[int] = 1, - **kwargs - ): + def __init__(self, *, count: int = 1, **kwargs): """ :keyword count: The desired number of outbound IPs created/managed by Azure. Allowed values must be in the range of 1 to 16 (inclusive). The default value is 1. :paramtype count: int """ - super(ManagedClusterManagedOutboundIPProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count -class ManagedClusterNATGatewayProfile(msrest.serialization.Model): +class ManagedClusterNATGatewayProfile(_serialization.Model): """Profile of the managed cluster NAT gateway. :ivar managed_outbound_ip_profile: Profile of the managed outbound IP resources of the cluster @@ -4677,13 +4561,16 @@ class ManagedClusterNATGatewayProfile(msrest.serialization.Model): """ _validation = { - 'idle_timeout_in_minutes': {'maximum': 120, 'minimum': 4}, + "idle_timeout_in_minutes": {"maximum": 120, "minimum": 4}, } _attribute_map = { - 'managed_outbound_ip_profile': {'key': 'managedOutboundIPProfile', 'type': 'ManagedClusterManagedOutboundIPProfile'}, - 'effective_outbound_i_ps': {'key': 'effectiveOutboundIPs', 'type': '[ResourceReference]'}, - 'idle_timeout_in_minutes': {'key': 'idleTimeoutInMinutes', 'type': 'int'}, + "managed_outbound_ip_profile": { + "key": "managedOutboundIPProfile", + "type": "ManagedClusterManagedOutboundIPProfile", + }, + "effective_outbound_i_ps": {"key": "effectiveOutboundIPs", "type": "[ResourceReference]"}, + "idle_timeout_in_minutes": {"key": "idleTimeoutInMinutes", "type": "int"}, } def __init__( @@ -4691,7 +4578,7 @@ def __init__( *, managed_outbound_ip_profile: Optional["_models.ManagedClusterManagedOutboundIPProfile"] = None, effective_outbound_i_ps: Optional[List["_models.ResourceReference"]] = None, - idle_timeout_in_minutes: Optional[int] = 4, + idle_timeout_in_minutes: int = 4, **kwargs ): """ @@ -4707,13 +4594,13 @@ def __init__( are in the range of 4 to 120 (inclusive). The default value is 4 minutes. :paramtype idle_timeout_in_minutes: int """ - super(ManagedClusterNATGatewayProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.managed_outbound_ip_profile = managed_outbound_ip_profile self.effective_outbound_i_ps = effective_outbound_i_ps self.idle_timeout_in_minutes = idle_timeout_in_minutes -class ManagedClusterOIDCIssuerProfile(msrest.serialization.Model): +class ManagedClusterOIDCIssuerProfile(_serialization.Model): """The OIDC issuer profile of the Managed Cluster. Variables are only populated by the server, and will be ignored when sending a request. @@ -4725,46 +4612,41 @@ class ManagedClusterOIDCIssuerProfile(msrest.serialization.Model): """ _validation = { - 'issuer_url': {'readonly': True}, + "issuer_url": {"readonly": True}, } _attribute_map = { - 'issuer_url': {'key': 'issuerURL', 'type': 'str'}, - 'enabled': {'key': 'enabled', 'type': 'bool'}, + "issuer_url": {"key": "issuerURL", "type": "str"}, + "enabled": {"key": "enabled", "type": "bool"}, } - def __init__( - self, - *, - enabled: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, enabled: Optional[bool] = None, **kwargs): """ :keyword enabled: Whether the OIDC issuer is enabled. :paramtype enabled: bool """ - super(ManagedClusterOIDCIssuerProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.issuer_url = None self.enabled = enabled -class ManagedClusterPodIdentity(msrest.serialization.Model): +class ManagedClusterPodIdentity(_serialization.Model): """Details about the pod identity assigned to the Managed Cluster. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar name: Required. The name of the pod identity. + :ivar name: The name of the pod identity. Required. :vartype name: str - :ivar namespace: Required. The namespace of the pod identity. + :ivar namespace: The namespace of the pod identity. Required. :vartype namespace: str :ivar binding_selector: The binding selector to use for the AzureIdentityBinding resource. :vartype binding_selector: str - :ivar identity: Required. The user assigned identity details. + :ivar identity: The user assigned identity details. Required. :vartype identity: ~azure.mgmt.containerservice.v2022_06_02_preview.models.UserAssignedIdentity :ivar provisioning_state: The current provisioning state of the pod identity. Known values are: - "Assigned", "Updating", "Deleting", "Failed". + "Assigned", "Updating", "Deleting", and "Failed". :vartype provisioning_state: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterPodIdentityProvisioningState :ivar provisioning_info: @@ -4773,20 +4655,20 @@ class ManagedClusterPodIdentity(msrest.serialization.Model): """ _validation = { - 'name': {'required': True}, - 'namespace': {'required': True}, - 'identity': {'required': True}, - 'provisioning_state': {'readonly': True}, - 'provisioning_info': {'readonly': True}, + "name": {"required": True}, + "namespace": {"required": True}, + "identity": {"required": True}, + "provisioning_state": {"readonly": True}, + "provisioning_info": {"readonly": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'namespace': {'key': 'namespace', 'type': 'str'}, - 'binding_selector': {'key': 'bindingSelector', 'type': 'str'}, - 'identity': {'key': 'identity', 'type': 'UserAssignedIdentity'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'provisioning_info': {'key': 'provisioningInfo', 'type': 'ManagedClusterPodIdentityProvisioningInfo'}, + "name": {"key": "name", "type": "str"}, + "namespace": {"key": "namespace", "type": "str"}, + "binding_selector": {"key": "bindingSelector", "type": "str"}, + "identity": {"key": "identity", "type": "UserAssignedIdentity"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "provisioning_info": {"key": "provisioningInfo", "type": "ManagedClusterPodIdentityProvisioningInfo"}, } def __init__( @@ -4799,17 +4681,17 @@ def __init__( **kwargs ): """ - :keyword name: Required. The name of the pod identity. + :keyword name: The name of the pod identity. Required. :paramtype name: str - :keyword namespace: Required. The namespace of the pod identity. + :keyword namespace: The namespace of the pod identity. Required. :paramtype namespace: str :keyword binding_selector: The binding selector to use for the AzureIdentityBinding resource. :paramtype binding_selector: str - :keyword identity: Required. The user assigned identity details. + :keyword identity: The user assigned identity details. Required. :paramtype identity: ~azure.mgmt.containerservice.v2022_06_02_preview.models.UserAssignedIdentity """ - super(ManagedClusterPodIdentity, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.namespace = namespace self.binding_selector = binding_selector @@ -4818,54 +4700,47 @@ def __init__( self.provisioning_info = None -class ManagedClusterPodIdentityException(msrest.serialization.Model): +class ManagedClusterPodIdentityException(_serialization.Model): """See `disable AAD Pod Identity for a specific Pod/Application `_ for more details. All required parameters must be populated in order to send to Azure. - :ivar name: Required. The name of the pod identity exception. + :ivar name: The name of the pod identity exception. Required. :vartype name: str - :ivar namespace: Required. The namespace of the pod identity exception. + :ivar namespace: The namespace of the pod identity exception. Required. :vartype namespace: str - :ivar pod_labels: Required. The pod labels to match. + :ivar pod_labels: The pod labels to match. Required. :vartype pod_labels: dict[str, str] """ _validation = { - 'name': {'required': True}, - 'namespace': {'required': True}, - 'pod_labels': {'required': True}, + "name": {"required": True}, + "namespace": {"required": True}, + "pod_labels": {"required": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'namespace': {'key': 'namespace', 'type': 'str'}, - 'pod_labels': {'key': 'podLabels', 'type': '{str}'}, + "name": {"key": "name", "type": "str"}, + "namespace": {"key": "namespace", "type": "str"}, + "pod_labels": {"key": "podLabels", "type": "{str}"}, } - def __init__( - self, - *, - name: str, - namespace: str, - pod_labels: Dict[str, str], - **kwargs - ): + def __init__(self, *, name: str, namespace: str, pod_labels: Dict[str, str], **kwargs): """ - :keyword name: Required. The name of the pod identity exception. + :keyword name: The name of the pod identity exception. Required. :paramtype name: str - :keyword namespace: Required. The namespace of the pod identity exception. + :keyword namespace: The namespace of the pod identity exception. Required. :paramtype namespace: str - :keyword pod_labels: Required. The pod labels to match. + :keyword pod_labels: The pod labels to match. Required. :paramtype pod_labels: dict[str, str] """ - super(ManagedClusterPodIdentityException, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.namespace = namespace self.pod_labels = pod_labels -class ManagedClusterPodIdentityProfile(msrest.serialization.Model): +class ManagedClusterPodIdentityProfile(_serialization.Model): """See `use AAD pod identity `_ for more details on pod identity integration. :ivar enabled: Whether the pod identity addon is enabled. @@ -4885,10 +4760,13 @@ class ManagedClusterPodIdentityProfile(msrest.serialization.Model): """ _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'allow_network_plugin_kubenet': {'key': 'allowNetworkPluginKubenet', 'type': 'bool'}, - 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '[ManagedClusterPodIdentity]'}, - 'user_assigned_identity_exceptions': {'key': 'userAssignedIdentityExceptions', 'type': '[ManagedClusterPodIdentityException]'}, + "enabled": {"key": "enabled", "type": "bool"}, + "allow_network_plugin_kubenet": {"key": "allowNetworkPluginKubenet", "type": "bool"}, + "user_assigned_identities": {"key": "userAssignedIdentities", "type": "[ManagedClusterPodIdentity]"}, + "user_assigned_identity_exceptions": { + "key": "userAssignedIdentityExceptions", + "type": "[ManagedClusterPodIdentityException]", + }, } def __init__( @@ -4916,14 +4794,14 @@ def __init__( :paramtype user_assigned_identity_exceptions: list[~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterPodIdentityException] """ - super(ManagedClusterPodIdentityProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.allow_network_plugin_kubenet = allow_network_plugin_kubenet self.user_assigned_identities = user_assigned_identities self.user_assigned_identity_exceptions = user_assigned_identity_exceptions -class ManagedClusterPodIdentityProvisioningError(msrest.serialization.Model): +class ManagedClusterPodIdentityProvisioningError(_serialization.Model): """An error response from the pod identity provisioning. :ivar error: Details about the error. @@ -4932,25 +4810,20 @@ class ManagedClusterPodIdentityProvisioningError(msrest.serialization.Model): """ _attribute_map = { - 'error': {'key': 'error', 'type': 'ManagedClusterPodIdentityProvisioningErrorBody'}, + "error": {"key": "error", "type": "ManagedClusterPodIdentityProvisioningErrorBody"}, } - def __init__( - self, - *, - error: Optional["_models.ManagedClusterPodIdentityProvisioningErrorBody"] = None, - **kwargs - ): + def __init__(self, *, error: Optional["_models.ManagedClusterPodIdentityProvisioningErrorBody"] = None, **kwargs): """ :keyword error: Details about the error. :paramtype error: ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterPodIdentityProvisioningErrorBody """ - super(ManagedClusterPodIdentityProvisioningError, self).__init__(**kwargs) + super().__init__(**kwargs) self.error = error -class ManagedClusterPodIdentityProvisioningErrorBody(msrest.serialization.Model): +class ManagedClusterPodIdentityProvisioningErrorBody(_serialization.Model): """An error response from the pod identity provisioning. :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed @@ -4968,10 +4841,10 @@ class ManagedClusterPodIdentityProvisioningErrorBody(msrest.serialization.Model) """ _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[ManagedClusterPodIdentityProvisioningErrorBody]'}, + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[ManagedClusterPodIdentityProvisioningErrorBody]"}, } def __init__( @@ -4997,14 +4870,14 @@ def __init__( :paramtype details: list[~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterPodIdentityProvisioningErrorBody] """ - super(ManagedClusterPodIdentityProvisioningErrorBody, self).__init__(**kwargs) + super().__init__(**kwargs) self.code = code self.message = message self.target = target self.details = details -class ManagedClusterPodIdentityProvisioningInfo(msrest.serialization.Model): +class ManagedClusterPodIdentityProvisioningInfo(_serialization.Model): """ManagedClusterPodIdentityProvisioningInfo. :ivar error: Pod identity assignment error (if any). @@ -5013,35 +4886,30 @@ class ManagedClusterPodIdentityProvisioningInfo(msrest.serialization.Model): """ _attribute_map = { - 'error': {'key': 'error', 'type': 'ManagedClusterPodIdentityProvisioningError'}, + "error": {"key": "error", "type": "ManagedClusterPodIdentityProvisioningError"}, } - def __init__( - self, - *, - error: Optional["_models.ManagedClusterPodIdentityProvisioningError"] = None, - **kwargs - ): + def __init__(self, *, error: Optional["_models.ManagedClusterPodIdentityProvisioningError"] = None, **kwargs): """ :keyword error: Pod identity assignment error (if any). :paramtype error: ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterPodIdentityProvisioningError """ - super(ManagedClusterPodIdentityProvisioningInfo, self).__init__(**kwargs) + super().__init__(**kwargs) self.error = error -class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): +class ManagedClusterPoolUpgradeProfile(_serialization.Model): """The list of available upgrade versions. All required parameters must be populated in order to send to Azure. - :ivar kubernetes_version: Required. The Kubernetes version (major.minor.patch). + :ivar kubernetes_version: The Kubernetes version (major.minor.patch). Required. :vartype kubernetes_version: str :ivar name: The Agent Pool name. :vartype name: str - :ivar os_type: Required. The operating system type. The default is Linux. Known values are: - "Linux", "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -5049,15 +4917,15 @@ class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): """ _validation = { - 'kubernetes_version': {'required': True}, - 'os_type': {'required': True}, + "kubernetes_version": {"required": True}, + "os_type": {"required": True}, } _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'upgrades': {'key': 'upgrades', 'type': '[ManagedClusterPoolUpgradeProfileUpgradesItem]'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "os_type": {"key": "osType", "type": "str"}, + "upgrades": {"key": "upgrades", "type": "[ManagedClusterPoolUpgradeProfileUpgradesItem]"}, } def __init__( @@ -5070,25 +4938,25 @@ def __init__( **kwargs ): """ - :keyword kubernetes_version: Required. The Kubernetes version (major.minor.patch). + :keyword kubernetes_version: The Kubernetes version (major.minor.patch). Required. :paramtype kubernetes_version: str :keyword name: The Agent Pool name. :paramtype name: str - :keyword os_type: Required. The operating system type. The default is Linux. Known values are: - "Linux", "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: list[~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterPoolUpgradeProfileUpgradesItem] """ - super(ManagedClusterPoolUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.name = name self.os_type = os_type self.upgrades = upgrades -class ManagedClusterPoolUpgradeProfileUpgradesItem(msrest.serialization.Model): +class ManagedClusterPoolUpgradeProfileUpgradesItem(_serialization.Model): """ManagedClusterPoolUpgradeProfileUpgradesItem. :ivar kubernetes_version: The Kubernetes version (major.minor.patch). @@ -5098,36 +4966,30 @@ class ManagedClusterPoolUpgradeProfileUpgradesItem(msrest.serialization.Model): """ _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } - def __init__( - self, - *, - kubernetes_version: Optional[str] = None, - is_preview: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, kubernetes_version: Optional[str] = None, is_preview: Optional[bool] = None, **kwargs): """ :keyword kubernetes_version: The Kubernetes version (major.minor.patch). :paramtype kubernetes_version: str :keyword is_preview: Whether the Kubernetes version is currently in preview. :paramtype is_preview: bool """ - super(ManagedClusterPoolUpgradeProfileUpgradesItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.is_preview = is_preview -class ManagedClusterPropertiesAutoScalerProfile(msrest.serialization.Model): +class ManagedClusterPropertiesAutoScalerProfile(_serialization.Model): # pylint: disable=too-many-instance-attributes """Parameters to be applied to the cluster-autoscaler when enabled. :ivar balance_similar_node_groups: Valid values are 'true' and 'false'. :vartype balance_similar_node_groups: str :ivar expander: If not specified, the default is 'random'. See `expanders `_ - for more information. Known values are: "least-waste", "most-pods", "priority", "random". + for more information. Known values are: "least-waste", "most-pods", "priority", and "random". :vartype expander: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.Expander :ivar max_empty_bulk_delete: The default is 10. :vartype max_empty_bulk_delete: str @@ -5171,23 +5033,23 @@ class ManagedClusterPropertiesAutoScalerProfile(msrest.serialization.Model): """ _attribute_map = { - 'balance_similar_node_groups': {'key': 'balance-similar-node-groups', 'type': 'str'}, - 'expander': {'key': 'expander', 'type': 'str'}, - 'max_empty_bulk_delete': {'key': 'max-empty-bulk-delete', 'type': 'str'}, - 'max_graceful_termination_sec': {'key': 'max-graceful-termination-sec', 'type': 'str'}, - 'max_node_provision_time': {'key': 'max-node-provision-time', 'type': 'str'}, - 'max_total_unready_percentage': {'key': 'max-total-unready-percentage', 'type': 'str'}, - 'new_pod_scale_up_delay': {'key': 'new-pod-scale-up-delay', 'type': 'str'}, - 'ok_total_unready_count': {'key': 'ok-total-unready-count', 'type': 'str'}, - 'scan_interval': {'key': 'scan-interval', 'type': 'str'}, - 'scale_down_delay_after_add': {'key': 'scale-down-delay-after-add', 'type': 'str'}, - 'scale_down_delay_after_delete': {'key': 'scale-down-delay-after-delete', 'type': 'str'}, - 'scale_down_delay_after_failure': {'key': 'scale-down-delay-after-failure', 'type': 'str'}, - 'scale_down_unneeded_time': {'key': 'scale-down-unneeded-time', 'type': 'str'}, - 'scale_down_unready_time': {'key': 'scale-down-unready-time', 'type': 'str'}, - 'scale_down_utilization_threshold': {'key': 'scale-down-utilization-threshold', 'type': 'str'}, - 'skip_nodes_with_local_storage': {'key': 'skip-nodes-with-local-storage', 'type': 'str'}, - 'skip_nodes_with_system_pods': {'key': 'skip-nodes-with-system-pods', 'type': 'str'}, + "balance_similar_node_groups": {"key": "balance-similar-node-groups", "type": "str"}, + "expander": {"key": "expander", "type": "str"}, + "max_empty_bulk_delete": {"key": "max-empty-bulk-delete", "type": "str"}, + "max_graceful_termination_sec": {"key": "max-graceful-termination-sec", "type": "str"}, + "max_node_provision_time": {"key": "max-node-provision-time", "type": "str"}, + "max_total_unready_percentage": {"key": "max-total-unready-percentage", "type": "str"}, + "new_pod_scale_up_delay": {"key": "new-pod-scale-up-delay", "type": "str"}, + "ok_total_unready_count": {"key": "ok-total-unready-count", "type": "str"}, + "scan_interval": {"key": "scan-interval", "type": "str"}, + "scale_down_delay_after_add": {"key": "scale-down-delay-after-add", "type": "str"}, + "scale_down_delay_after_delete": {"key": "scale-down-delay-after-delete", "type": "str"}, + "scale_down_delay_after_failure": {"key": "scale-down-delay-after-failure", "type": "str"}, + "scale_down_unneeded_time": {"key": "scale-down-unneeded-time", "type": "str"}, + "scale_down_unready_time": {"key": "scale-down-unready-time", "type": "str"}, + "scale_down_utilization_threshold": {"key": "scale-down-utilization-threshold", "type": "str"}, + "skip_nodes_with_local_storage": {"key": "skip-nodes-with-local-storage", "type": "str"}, + "skip_nodes_with_system_pods": {"key": "skip-nodes-with-system-pods", "type": "str"}, } def __init__( @@ -5217,7 +5079,7 @@ def __init__( :paramtype balance_similar_node_groups: str :keyword expander: If not specified, the default is 'random'. See `expanders `_ - for more information. Known values are: "least-waste", "most-pods", "priority", "random". + for more information. Known values are: "least-waste", "most-pods", "priority", and "random". :paramtype expander: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.Expander :keyword max_empty_bulk_delete: The default is 10. :paramtype max_empty_bulk_delete: str @@ -5260,7 +5122,7 @@ def __init__( :keyword skip_nodes_with_system_pods: The default is true. :paramtype skip_nodes_with_system_pods: str """ - super(ManagedClusterPropertiesAutoScalerProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.balance_similar_node_groups = balance_similar_node_groups self.expander = expander self.max_empty_bulk_delete = max_empty_bulk_delete @@ -5280,7 +5142,7 @@ def __init__( self.skip_nodes_with_system_pods = skip_nodes_with_system_pods -class ManagedClusterPropertiesForSnapshot(msrest.serialization.Model): +class ManagedClusterPropertiesForSnapshot(_serialization.Model): """managed cluster properties for snapshot, these properties are read only. Variables are only populated by the server, and will be ignored when sending a request. @@ -5297,14 +5159,14 @@ class ManagedClusterPropertiesForSnapshot(msrest.serialization.Model): """ _validation = { - 'network_profile': {'readonly': True}, + "network_profile": {"readonly": True}, } _attribute_map = { - 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'ManagedClusterSKU'}, - 'enable_rbac': {'key': 'enableRbac', 'type': 'bool'}, - 'network_profile': {'key': 'networkProfile', 'type': 'NetworkProfileForSnapshot'}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "sku": {"key": "sku", "type": "ManagedClusterSKU"}, + "enable_rbac": {"key": "enableRbac", "type": "bool"}, + "network_profile": {"key": "networkProfile", "type": "NetworkProfileForSnapshot"}, } def __init__( @@ -5324,14 +5186,14 @@ def __init__( not. :paramtype enable_rbac: bool """ - super(ManagedClusterPropertiesForSnapshot, self).__init__(**kwargs) + super().__init__(**kwargs) self.kubernetes_version = kubernetes_version self.sku = sku self.enable_rbac = enable_rbac self.network_profile = None -class ManagedClusterSecurityProfile(msrest.serialization.Model): +class ManagedClusterSecurityProfile(_serialization.Model): """Security profile for the container service cluster. :ivar defender: Microsoft Defender settings for the security profile. @@ -5354,10 +5216,10 @@ class ManagedClusterSecurityProfile(msrest.serialization.Model): """ _attribute_map = { - 'defender': {'key': 'defender', 'type': 'ManagedClusterSecurityProfileDefender'}, - 'azure_key_vault_kms': {'key': 'azureKeyVaultKms', 'type': 'AzureKeyVaultKms'}, - 'workload_identity': {'key': 'workloadIdentity', 'type': 'ManagedClusterSecurityProfileWorkloadIdentity'}, - 'node_restriction': {'key': 'nodeRestriction', 'type': 'ManagedClusterSecurityProfileNodeRestriction'}, + "defender": {"key": "defender", "type": "ManagedClusterSecurityProfileDefender"}, + "azure_key_vault_kms": {"key": "azureKeyVaultKms", "type": "AzureKeyVaultKms"}, + "workload_identity": {"key": "workloadIdentity", "type": "ManagedClusterSecurityProfileWorkloadIdentity"}, + "node_restriction": {"key": "nodeRestriction", "type": "ManagedClusterSecurityProfileNodeRestriction"}, } def __init__( @@ -5388,14 +5250,14 @@ def __init__( :paramtype node_restriction: ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterSecurityProfileNodeRestriction """ - super(ManagedClusterSecurityProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.defender = defender self.azure_key_vault_kms = azure_key_vault_kms self.workload_identity = workload_identity self.node_restriction = node_restriction -class ManagedClusterSecurityProfileDefender(msrest.serialization.Model): +class ManagedClusterSecurityProfileDefender(_serialization.Model): """Microsoft Defender settings for the security profile. :ivar log_analytics_workspace_resource_id: Resource ID of the Log Analytics workspace to be @@ -5410,8 +5272,11 @@ class ManagedClusterSecurityProfileDefender(msrest.serialization.Model): """ _attribute_map = { - 'log_analytics_workspace_resource_id': {'key': 'logAnalyticsWorkspaceResourceId', 'type': 'str'}, - 'security_monitoring': {'key': 'securityMonitoring', 'type': 'ManagedClusterSecurityProfileDefenderSecurityMonitoring'}, + "log_analytics_workspace_resource_id": {"key": "logAnalyticsWorkspaceResourceId", "type": "str"}, + "security_monitoring": { + "key": "securityMonitoring", + "type": "ManagedClusterSecurityProfileDefenderSecurityMonitoring", + }, } def __init__( @@ -5432,12 +5297,12 @@ def __init__( :paramtype security_monitoring: ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterSecurityProfileDefenderSecurityMonitoring """ - super(ManagedClusterSecurityProfileDefender, self).__init__(**kwargs) + super().__init__(**kwargs) self.log_analytics_workspace_resource_id = log_analytics_workspace_resource_id self.security_monitoring = security_monitoring -class ManagedClusterSecurityProfileDefenderSecurityMonitoring(msrest.serialization.Model): +class ManagedClusterSecurityProfileDefenderSecurityMonitoring(_serialization.Model): """Microsoft Defender settings for the security profile threat detection. :ivar enabled: Whether to enable Defender threat detection. @@ -5445,24 +5310,19 @@ class ManagedClusterSecurityProfileDefenderSecurityMonitoring(msrest.serializati """ _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, + "enabled": {"key": "enabled", "type": "bool"}, } - def __init__( - self, - *, - enabled: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, enabled: Optional[bool] = None, **kwargs): """ :keyword enabled: Whether to enable Defender threat detection. :paramtype enabled: bool """ - super(ManagedClusterSecurityProfileDefenderSecurityMonitoring, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled -class ManagedClusterSecurityProfileNodeRestriction(msrest.serialization.Model): +class ManagedClusterSecurityProfileNodeRestriction(_serialization.Model): """Node Restriction settings for the security profile. :ivar enabled: Whether to enable Node Restriction. @@ -5470,24 +5330,19 @@ class ManagedClusterSecurityProfileNodeRestriction(msrest.serialization.Model): """ _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, + "enabled": {"key": "enabled", "type": "bool"}, } - def __init__( - self, - *, - enabled: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, enabled: Optional[bool] = None, **kwargs): """ :keyword enabled: Whether to enable Node Restriction. :paramtype enabled: bool """ - super(ManagedClusterSecurityProfileNodeRestriction, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled -class ManagedClusterSecurityProfileWorkloadIdentity(msrest.serialization.Model): +class ManagedClusterSecurityProfileWorkloadIdentity(_serialization.Model): """Workload Identity settings for the security profile. :ivar enabled: Whether to enable Workload Identity. @@ -5495,77 +5350,66 @@ class ManagedClusterSecurityProfileWorkloadIdentity(msrest.serialization.Model): """ _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, + "enabled": {"key": "enabled", "type": "bool"}, } - def __init__( - self, - *, - enabled: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, enabled: Optional[bool] = None, **kwargs): """ :keyword enabled: Whether to enable Workload Identity. :paramtype enabled: bool """ - super(ManagedClusterSecurityProfileWorkloadIdentity, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled -class ManagedClusterServicePrincipalProfile(msrest.serialization.Model): +class ManagedClusterServicePrincipalProfile(_serialization.Model): """Information about a service principal identity for the cluster to use for manipulating Azure APIs. All required parameters must be populated in order to send to Azure. - :ivar client_id: Required. The ID for the service principal. + :ivar client_id: The ID for the service principal. Required. :vartype client_id: str :ivar secret: The secret password associated with the service principal in plain text. :vartype secret: str """ _validation = { - 'client_id': {'required': True}, + "client_id": {"required": True}, } _attribute_map = { - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'secret': {'key': 'secret', 'type': 'str'}, + "client_id": {"key": "clientId", "type": "str"}, + "secret": {"key": "secret", "type": "str"}, } - def __init__( - self, - *, - client_id: str, - secret: Optional[str] = None, - **kwargs - ): + def __init__(self, *, client_id: str, secret: Optional[str] = None, **kwargs): """ - :keyword client_id: Required. The ID for the service principal. + :keyword client_id: The ID for the service principal. Required. :paramtype client_id: str :keyword secret: The secret password associated with the service principal in plain text. :paramtype secret: str """ - super(ManagedClusterServicePrincipalProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.client_id = client_id self.secret = secret -class ManagedClusterSKU(msrest.serialization.Model): +class ManagedClusterSKU(_serialization.Model): """The SKU of a Managed Cluster. - :ivar name: The name of a managed cluster SKU. Known values are: "Basic". + :ivar name: The name of a managed cluster SKU. "Basic" :vartype name: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterSKUName :ivar tier: If not specified, the default is 'Free'. See `uptime SLA - `_ for more details. Known values are: "Paid", - "Free". + `_ for more details. Known values are: "Paid" + and "Free". :vartype tier: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterSKUTier """ _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, + "name": {"key": "name", "type": "str"}, + "tier": {"key": "tier", "type": "str"}, } def __init__( @@ -5576,16 +5420,16 @@ def __init__( **kwargs ): """ - :keyword name: The name of a managed cluster SKU. Known values are: "Basic". + :keyword name: The name of a managed cluster SKU. "Basic" :paramtype name: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterSKUName :keyword tier: If not specified, the default is 'Free'. See `uptime SLA - `_ for more details. Known values are: "Paid", - "Free". + `_ for more details. Known values are: "Paid" + and "Free". :paramtype tier: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterSKUTier """ - super(ManagedClusterSKU, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.tier = tier @@ -5608,15 +5452,15 @@ class ManagedClusterSnapshot(TrackedResource): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.containerservice.v2022_06_02_preview.models.SystemData - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] - :ivar location: Required. The geo-location where the resource lives. + :ivar location: The geo-location where the resource lives. Required. :vartype location: str :ivar creation_data: CreationData to be used to specify the source resource ID to create this snapshot. :vartype creation_data: ~azure.mgmt.containerservice.v2022_06_02_preview.models.CreationData :ivar snapshot_type: The type of a snapshot. The default is NodePool. Known values are: - "NodePool", "ManagedCluster". Default value: "NodePool". + "NodePool" and "ManagedCluster". :vartype snapshot_type: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.SnapshotType :ivar managed_cluster_properties_read_only: What the properties will be showed when getting @@ -5626,24 +5470,27 @@ class ManagedClusterSnapshot(TrackedResource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'location': {'required': True}, - 'managed_cluster_properties_read_only': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, + "managed_cluster_properties_read_only": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - 'creation_data': {'key': 'properties.creationData', 'type': 'CreationData'}, - 'snapshot_type': {'key': 'properties.snapshotType', 'type': 'str'}, - 'managed_cluster_properties_read_only': {'key': 'properties.managedClusterPropertiesReadOnly', 'type': 'ManagedClusterPropertiesForSnapshot'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "creation_data": {"key": "properties.creationData", "type": "CreationData"}, + "snapshot_type": {"key": "properties.snapshotType", "type": "str"}, + "managed_cluster_properties_read_only": { + "key": "properties.managedClusterPropertiesReadOnly", + "type": "ManagedClusterPropertiesForSnapshot", + }, } def __init__( @@ -5652,29 +5499,29 @@ def __init__( location: str, tags: Optional[Dict[str, str]] = None, creation_data: Optional["_models.CreationData"] = None, - snapshot_type: Optional[Union[str, "_models.SnapshotType"]] = "NodePool", + snapshot_type: Union[str, "_models.SnapshotType"] = "NodePool", **kwargs ): """ - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] - :keyword location: Required. The geo-location where the resource lives. + :keyword location: The geo-location where the resource lives. Required. :paramtype location: str :keyword creation_data: CreationData to be used to specify the source resource ID to create this snapshot. :paramtype creation_data: ~azure.mgmt.containerservice.v2022_06_02_preview.models.CreationData :keyword snapshot_type: The type of a snapshot. The default is NodePool. Known values are: - "NodePool", "ManagedCluster". Default value: "NodePool". + "NodePool" and "ManagedCluster". :paramtype snapshot_type: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.SnapshotType """ - super(ManagedClusterSnapshot, self).__init__(tags=tags, location=location, **kwargs) + super().__init__(tags=tags, location=location, **kwargs) self.creation_data = creation_data self.snapshot_type = snapshot_type self.managed_cluster_properties_read_only = None -class ManagedClusterSnapshotListResult(msrest.serialization.Model): +class ManagedClusterSnapshotListResult(_serialization.Model): """The response from the List Managed Cluster Snapshots operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -5687,31 +5534,26 @@ class ManagedClusterSnapshotListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[ManagedClusterSnapshot]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[ManagedClusterSnapshot]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.ManagedClusterSnapshot"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.ManagedClusterSnapshot"]] = None, **kwargs): """ :keyword value: The list of managed cluster snapshots. :paramtype value: list[~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterSnapshot] """ - super(ManagedClusterSnapshotListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class ManagedClusterStorageProfile(msrest.serialization.Model): +class ManagedClusterStorageProfile(_serialization.Model): """Storage profile for the container service cluster. :ivar disk_csi_driver: AzureDisk CSI Driver settings for the storage profile. @@ -5729,10 +5571,10 @@ class ManagedClusterStorageProfile(msrest.serialization.Model): """ _attribute_map = { - 'disk_csi_driver': {'key': 'diskCSIDriver', 'type': 'ManagedClusterStorageProfileDiskCSIDriver'}, - 'file_csi_driver': {'key': 'fileCSIDriver', 'type': 'ManagedClusterStorageProfileFileCSIDriver'}, - 'snapshot_controller': {'key': 'snapshotController', 'type': 'ManagedClusterStorageProfileSnapshotController'}, - 'blob_csi_driver': {'key': 'blobCSIDriver', 'type': 'ManagedClusterStorageProfileBlobCSIDriver'}, + "disk_csi_driver": {"key": "diskCSIDriver", "type": "ManagedClusterStorageProfileDiskCSIDriver"}, + "file_csi_driver": {"key": "fileCSIDriver", "type": "ManagedClusterStorageProfileFileCSIDriver"}, + "snapshot_controller": {"key": "snapshotController", "type": "ManagedClusterStorageProfileSnapshotController"}, + "blob_csi_driver": {"key": "blobCSIDriver", "type": "ManagedClusterStorageProfileBlobCSIDriver"}, } def __init__( @@ -5758,14 +5600,14 @@ def __init__( :paramtype blob_csi_driver: ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterStorageProfileBlobCSIDriver """ - super(ManagedClusterStorageProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.disk_csi_driver = disk_csi_driver self.file_csi_driver = file_csi_driver self.snapshot_controller = snapshot_controller self.blob_csi_driver = blob_csi_driver -class ManagedClusterStorageProfileBlobCSIDriver(msrest.serialization.Model): +class ManagedClusterStorageProfileBlobCSIDriver(_serialization.Model): """AzureBlob CSI Driver settings for the storage profile. :ivar enabled: Whether to enable AzureBlob CSI Driver. The default value is false. @@ -5773,24 +5615,19 @@ class ManagedClusterStorageProfileBlobCSIDriver(msrest.serialization.Model): """ _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, + "enabled": {"key": "enabled", "type": "bool"}, } - def __init__( - self, - *, - enabled: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, enabled: Optional[bool] = None, **kwargs): """ :keyword enabled: Whether to enable AzureBlob CSI Driver. The default value is false. :paramtype enabled: bool """ - super(ManagedClusterStorageProfileBlobCSIDriver, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled -class ManagedClusterStorageProfileDiskCSIDriver(msrest.serialization.Model): +class ManagedClusterStorageProfileDiskCSIDriver(_serialization.Model): """AzureDisk CSI Driver settings for the storage profile. :ivar enabled: Whether to enable AzureDisk CSI Driver. The default value is true. @@ -5800,29 +5637,23 @@ class ManagedClusterStorageProfileDiskCSIDriver(msrest.serialization.Model): """ _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'version': {'key': 'version', 'type': 'str'}, + "enabled": {"key": "enabled", "type": "bool"}, + "version": {"key": "version", "type": "str"}, } - def __init__( - self, - *, - enabled: Optional[bool] = None, - version: Optional[str] = None, - **kwargs - ): + def __init__(self, *, enabled: Optional[bool] = None, version: Optional[str] = None, **kwargs): """ :keyword enabled: Whether to enable AzureDisk CSI Driver. The default value is true. :paramtype enabled: bool :keyword version: The version of AzureDisk CSI Driver. The default value is v1. :paramtype version: str """ - super(ManagedClusterStorageProfileDiskCSIDriver, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.version = version -class ManagedClusterStorageProfileFileCSIDriver(msrest.serialization.Model): +class ManagedClusterStorageProfileFileCSIDriver(_serialization.Model): """AzureFile CSI Driver settings for the storage profile. :ivar enabled: Whether to enable AzureFile CSI Driver. The default value is true. @@ -5830,24 +5661,19 @@ class ManagedClusterStorageProfileFileCSIDriver(msrest.serialization.Model): """ _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, + "enabled": {"key": "enabled", "type": "bool"}, } - def __init__( - self, - *, - enabled: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, enabled: Optional[bool] = None, **kwargs): """ :keyword enabled: Whether to enable AzureFile CSI Driver. The default value is true. :paramtype enabled: bool """ - super(ManagedClusterStorageProfileFileCSIDriver, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled -class ManagedClusterStorageProfileSnapshotController(msrest.serialization.Model): +class ManagedClusterStorageProfileSnapshotController(_serialization.Model): """Snapshot Controller settings for the storage profile. :ivar enabled: Whether to enable Snapshot Controller. The default value is true. @@ -5855,24 +5681,19 @@ class ManagedClusterStorageProfileSnapshotController(msrest.serialization.Model) """ _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, + "enabled": {"key": "enabled", "type": "bool"}, } - def __init__( - self, - *, - enabled: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, enabled: Optional[bool] = None, **kwargs): """ :keyword enabled: Whether to enable Snapshot Controller. The default value is true. :paramtype enabled: bool """ - super(ManagedClusterStorageProfileSnapshotController, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled -class ManagedClusterUpgradeProfile(msrest.serialization.Model): +class ManagedClusterUpgradeProfile(_serialization.Model): """The list of available upgrades for compute pools. Variables are only populated by the server, and will be ignored when sending a request. @@ -5885,29 +5706,29 @@ class ManagedClusterUpgradeProfile(msrest.serialization.Model): :vartype name: str :ivar type: The type of the upgrade profile. :vartype type: str - :ivar control_plane_profile: Required. The list of available upgrade versions for the control - plane. + :ivar control_plane_profile: The list of available upgrade versions for the control plane. + Required. :vartype control_plane_profile: ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterPoolUpgradeProfile - :ivar agent_pool_profiles: Required. The list of available upgrade versions for agent pools. + :ivar agent_pool_profiles: The list of available upgrade versions for agent pools. Required. :vartype agent_pool_profiles: list[~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterPoolUpgradeProfile] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'control_plane_profile': {'required': True}, - 'agent_pool_profiles': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "control_plane_profile": {"required": True}, + "agent_pool_profiles": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'control_plane_profile': {'key': 'properties.controlPlaneProfile', 'type': 'ManagedClusterPoolUpgradeProfile'}, - 'agent_pool_profiles': {'key': 'properties.agentPoolProfiles', 'type': '[ManagedClusterPoolUpgradeProfile]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "control_plane_profile": {"key": "properties.controlPlaneProfile", "type": "ManagedClusterPoolUpgradeProfile"}, + "agent_pool_profiles": {"key": "properties.agentPoolProfiles", "type": "[ManagedClusterPoolUpgradeProfile]"}, } def __init__( @@ -5918,15 +5739,15 @@ def __init__( **kwargs ): """ - :keyword control_plane_profile: Required. The list of available upgrade versions for the - control plane. + :keyword control_plane_profile: The list of available upgrade versions for the control plane. + Required. :paramtype control_plane_profile: ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterPoolUpgradeProfile - :keyword agent_pool_profiles: Required. The list of available upgrade versions for agent pools. + :keyword agent_pool_profiles: The list of available upgrade versions for agent pools. Required. :paramtype agent_pool_profiles: list[~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterPoolUpgradeProfile] """ - super(ManagedClusterUpgradeProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -5934,18 +5755,18 @@ def __init__( self.agent_pool_profiles = agent_pool_profiles -class ManagedClusterWindowsProfile(msrest.serialization.Model): +class ManagedClusterWindowsProfile(_serialization.Model): """Profile for Windows VMs in the managed cluster. All required parameters must be populated in order to send to Azure. - :ivar admin_username: Required. Specifies the name of the administrator account. - :code:`
`:code:`
` **Restriction:** Cannot end in "." :code:`
`:code:`
` - **Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", "test1", - "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", - "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", - "sys", "test2", "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 - character :code:`
`:code:`
` **Max-length:** 20 characters. + :ivar admin_username: Specifies the name of the administrator account. :code:`
`:code:`
` + **Restriction:** Cannot end in "." :code:`
`:code:`
` **Disallowed values:** + "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", + "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", + "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", + "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 character + :code:`
`:code:`
` **Max-length:** 20 characters. Required. :vartype admin_username: str :ivar admin_password: Specifies the password of the administrator account. :code:`
`:code:`
` **Minimum-length:** 8 characters :code:`
`:code:`
` @@ -5957,7 +5778,7 @@ class ManagedClusterWindowsProfile(msrest.serialization.Model): :vartype admin_password: str :ivar license_type: The license type to use for Windows VMs. See `Azure Hybrid User Benefits `_ for more details. Known values are: - "None", "Windows_Server". + "None" and "Windows_Server". :vartype license_type: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.LicenseType :ivar enable_csi_proxy: For more details on CSI proxy, see the `CSI proxy GitHub repo @@ -5969,15 +5790,15 @@ class ManagedClusterWindowsProfile(msrest.serialization.Model): """ _validation = { - 'admin_username': {'required': True}, + "admin_username": {"required": True}, } _attribute_map = { - 'admin_username': {'key': 'adminUsername', 'type': 'str'}, - 'admin_password': {'key': 'adminPassword', 'type': 'str'}, - 'license_type': {'key': 'licenseType', 'type': 'str'}, - 'enable_csi_proxy': {'key': 'enableCSIProxy', 'type': 'bool'}, - 'gmsa_profile': {'key': 'gmsaProfile', 'type': 'WindowsGmsaProfile'}, + "admin_username": {"key": "adminUsername", "type": "str"}, + "admin_password": {"key": "adminPassword", "type": "str"}, + "license_type": {"key": "licenseType", "type": "str"}, + "enable_csi_proxy": {"key": "enableCSIProxy", "type": "bool"}, + "gmsa_profile": {"key": "gmsaProfile", "type": "WindowsGmsaProfile"}, } def __init__( @@ -5991,13 +5812,13 @@ def __init__( **kwargs ): """ - :keyword admin_username: Required. Specifies the name of the administrator account. + :keyword admin_username: Specifies the name of the administrator account. :code:`
`:code:`
` **Restriction:** Cannot end in "." :code:`
`:code:`
` **Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 - character :code:`
`:code:`
` **Max-length:** 20 characters. + character :code:`
`:code:`
` **Max-length:** 20 characters. Required. :paramtype admin_username: str :keyword admin_password: Specifies the password of the administrator account. :code:`
`:code:`
` **Minimum-length:** 8 characters :code:`
`:code:`
` @@ -6009,7 +5830,7 @@ def __init__( :paramtype admin_password: str :keyword license_type: The license type to use for Windows VMs. See `Azure Hybrid User Benefits `_ for more details. Known values are: - "None", "Windows_Server". + "None" and "Windows_Server". :paramtype license_type: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.LicenseType :keyword enable_csi_proxy: For more details on CSI proxy, see the `CSI proxy GitHub repo @@ -6019,7 +5840,7 @@ def __init__( :paramtype gmsa_profile: ~azure.mgmt.containerservice.v2022_06_02_preview.models.WindowsGmsaProfile """ - super(ManagedClusterWindowsProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.admin_username = admin_username self.admin_password = admin_password self.license_type = license_type @@ -6027,7 +5848,7 @@ def __init__( self.gmsa_profile = gmsa_profile -class ManagedClusterWorkloadAutoScalerProfile(msrest.serialization.Model): +class ManagedClusterWorkloadAutoScalerProfile(_serialization.Model): """Workload Auto-scaler profile for the container service cluster. :ivar keda: KEDA (Kubernetes Event-driven Autoscaling) settings for the workload auto-scaler @@ -6037,57 +5858,47 @@ class ManagedClusterWorkloadAutoScalerProfile(msrest.serialization.Model): """ _attribute_map = { - 'keda': {'key': 'keda', 'type': 'ManagedClusterWorkloadAutoScalerProfileKeda'}, + "keda": {"key": "keda", "type": "ManagedClusterWorkloadAutoScalerProfileKeda"}, } - def __init__( - self, - *, - keda: Optional["_models.ManagedClusterWorkloadAutoScalerProfileKeda"] = None, - **kwargs - ): + def __init__(self, *, keda: Optional["_models.ManagedClusterWorkloadAutoScalerProfileKeda"] = None, **kwargs): """ :keyword keda: KEDA (Kubernetes Event-driven Autoscaling) settings for the workload auto-scaler profile. :paramtype keda: ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterWorkloadAutoScalerProfileKeda """ - super(ManagedClusterWorkloadAutoScalerProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.keda = keda -class ManagedClusterWorkloadAutoScalerProfileKeda(msrest.serialization.Model): +class ManagedClusterWorkloadAutoScalerProfileKeda(_serialization.Model): """KEDA (Kubernetes Event-driven Autoscaling) settings for the workload auto-scaler profile. All required parameters must be populated in order to send to Azure. - :ivar enabled: Required. Whether to enable KEDA. + :ivar enabled: Whether to enable KEDA. Required. :vartype enabled: bool """ _validation = { - 'enabled': {'required': True}, + "enabled": {"required": True}, } _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, + "enabled": {"key": "enabled", "type": "bool"}, } - def __init__( - self, - *, - enabled: bool, - **kwargs - ): + def __init__(self, *, enabled: bool, **kwargs): """ - :keyword enabled: Required. Whether to enable KEDA. + :keyword enabled: Whether to enable KEDA. Required. :paramtype enabled: bool """ - super(ManagedClusterWorkloadAutoScalerProfileKeda, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled -class ManagedServiceIdentityUserAssignedIdentitiesValue(msrest.serialization.Model): +class ManagedServiceIdentityUserAssignedIdentitiesValue(_serialization.Model): """ManagedServiceIdentityUserAssignedIdentitiesValue. Variables are only populated by the server, and will be ignored when sending a request. @@ -6099,63 +5910,58 @@ class ManagedServiceIdentityUserAssignedIdentitiesValue(msrest.serialization.Mod """ _validation = { - 'principal_id': {'readonly': True}, - 'client_id': {'readonly': True}, + "principal_id": {"readonly": True}, + "client_id": {"readonly": True}, } _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, + "principal_id": {"key": "principalId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(ManagedServiceIdentityUserAssignedIdentitiesValue, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.principal_id = None self.client_id = None -class NetworkProfileForSnapshot(msrest.serialization.Model): +class NetworkProfileForSnapshot(_serialization.Model): """network profile for managed cluster snapshot, these properties are read only. :ivar network_plugin: networkPlugin for managed cluster snapshot. Known values are: "azure", - "kubenet", "none". Default value: "kubenet". + "kubenet", and "none". :vartype network_plugin: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.NetworkPlugin - :ivar network_plugin_mode: NetworkPluginMode for managed cluster snapshot. Known values are: - "Overlay". + :ivar network_plugin_mode: NetworkPluginMode for managed cluster snapshot. "Overlay" :vartype network_plugin_mode: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.NetworkPluginMode - :ivar network_policy: networkPolicy for managed cluster snapshot. Known values are: "calico", - "azure". + :ivar network_policy: networkPolicy for managed cluster snapshot. Known values are: "calico" + and "azure". :vartype network_policy: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.NetworkPolicy - :ivar network_mode: networkMode for managed cluster snapshot. Known values are: "transparent", - "bridge". + :ivar network_mode: networkMode for managed cluster snapshot. Known values are: "transparent" + and "bridge". :vartype network_mode: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.NetworkMode :ivar load_balancer_sku: loadBalancerSku for managed cluster snapshot. Known values are: - "standard", "basic". + "standard" and "basic". :vartype load_balancer_sku: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.LoadBalancerSku """ _attribute_map = { - 'network_plugin': {'key': 'networkPlugin', 'type': 'str'}, - 'network_plugin_mode': {'key': 'networkPluginMode', 'type': 'str'}, - 'network_policy': {'key': 'networkPolicy', 'type': 'str'}, - 'network_mode': {'key': 'networkMode', 'type': 'str'}, - 'load_balancer_sku': {'key': 'loadBalancerSku', 'type': 'str'}, + "network_plugin": {"key": "networkPlugin", "type": "str"}, + "network_plugin_mode": {"key": "networkPluginMode", "type": "str"}, + "network_policy": {"key": "networkPolicy", "type": "str"}, + "network_mode": {"key": "networkMode", "type": "str"}, + "load_balancer_sku": {"key": "loadBalancerSku", "type": "str"}, } def __init__( self, *, - network_plugin: Optional[Union[str, "_models.NetworkPlugin"]] = "kubenet", + network_plugin: Union[str, "_models.NetworkPlugin"] = "kubenet", network_plugin_mode: Optional[Union[str, "_models.NetworkPluginMode"]] = None, network_policy: Optional[Union[str, "_models.NetworkPolicy"]] = None, network_mode: Optional[Union[str, "_models.NetworkMode"]] = None, @@ -6164,27 +5970,26 @@ def __init__( ): """ :keyword network_plugin: networkPlugin for managed cluster snapshot. Known values are: "azure", - "kubenet", "none". Default value: "kubenet". + "kubenet", and "none". :paramtype network_plugin: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.NetworkPlugin - :keyword network_plugin_mode: NetworkPluginMode for managed cluster snapshot. Known values are: - "Overlay". + :keyword network_plugin_mode: NetworkPluginMode for managed cluster snapshot. "Overlay" :paramtype network_plugin_mode: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.NetworkPluginMode - :keyword network_policy: networkPolicy for managed cluster snapshot. Known values are: - "calico", "azure". + :keyword network_policy: networkPolicy for managed cluster snapshot. Known values are: "calico" + and "azure". :paramtype network_policy: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.NetworkPolicy :keyword network_mode: networkMode for managed cluster snapshot. Known values are: - "transparent", "bridge". + "transparent" and "bridge". :paramtype network_mode: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.NetworkMode :keyword load_balancer_sku: loadBalancerSku for managed cluster snapshot. Known values are: - "standard", "basic". + "standard" and "basic". :paramtype load_balancer_sku: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.LoadBalancerSku """ - super(NetworkProfileForSnapshot, self).__init__(**kwargs) + super().__init__(**kwargs) self.network_plugin = network_plugin self.network_plugin_mode = network_plugin_mode self.network_policy = network_policy @@ -6192,7 +5997,7 @@ def __init__( self.load_balancer_sku = load_balancer_sku -class OperationListResult(msrest.serialization.Model): +class OperationListResult(_serialization.Model): """The List Operation response. Variables are only populated by the server, and will be ignored when sending a request. @@ -6202,24 +6007,20 @@ class OperationListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[OperationValue]'}, + "value": {"key": "value", "type": "[OperationValue]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(OperationListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None -class OperationValue(msrest.serialization.Model): +class OperationValue(_serialization.Model): """Describes the properties of a Operation value. Variables are only populated by the server, and will be ignored when sending a request. @@ -6239,30 +6040,26 @@ class OperationValue(msrest.serialization.Model): """ _validation = { - 'origin': {'readonly': True}, - 'name': {'readonly': True}, - 'operation': {'readonly': True}, - 'resource': {'readonly': True}, - 'description': {'readonly': True}, - 'provider': {'readonly': True}, + "origin": {"readonly": True}, + "name": {"readonly": True}, + "operation": {"readonly": True}, + "resource": {"readonly": True}, + "description": {"readonly": True}, + "provider": {"readonly": True}, } _attribute_map = { - 'origin': {'key': 'origin', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'operation': {'key': 'display.operation', 'type': 'str'}, - 'resource': {'key': 'display.resource', 'type': 'str'}, - 'description': {'key': 'display.description', 'type': 'str'}, - 'provider': {'key': 'display.provider', 'type': 'str'}, + "origin": {"key": "origin", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "operation": {"key": "display.operation", "type": "str"}, + "resource": {"key": "display.resource", "type": "str"}, + "description": {"key": "display.description", "type": "str"}, + "provider": {"key": "display.provider", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(OperationValue, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.origin = None self.name = None self.operation = None @@ -6271,7 +6068,7 @@ def __init__( self.provider = None -class OSOptionProfile(msrest.serialization.Model): +class OSOptionProfile(_serialization.Model): """The OS option profile. Variables are only populated by the server, and will be ignored when sending a request. @@ -6284,83 +6081,72 @@ class OSOptionProfile(msrest.serialization.Model): :vartype name: str :ivar type: The type of the OS option resource. :vartype type: str - :ivar os_option_property_list: Required. The list of OS options. + :ivar os_option_property_list: The list of OS options. Required. :vartype os_option_property_list: list[~azure.mgmt.containerservice.v2022_06_02_preview.models.OSOptionProperty] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'os_option_property_list': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "os_option_property_list": {"required": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'os_option_property_list': {'key': 'properties.osOptionPropertyList', 'type': '[OSOptionProperty]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "os_option_property_list": {"key": "properties.osOptionPropertyList", "type": "[OSOptionProperty]"}, } - def __init__( - self, - *, - os_option_property_list: List["_models.OSOptionProperty"], - **kwargs - ): + def __init__(self, *, os_option_property_list: List["_models.OSOptionProperty"], **kwargs): """ - :keyword os_option_property_list: Required. The list of OS options. + :keyword os_option_property_list: The list of OS options. Required. :paramtype os_option_property_list: list[~azure.mgmt.containerservice.v2022_06_02_preview.models.OSOptionProperty] """ - super(OSOptionProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None self.os_option_property_list = os_option_property_list -class OSOptionProperty(msrest.serialization.Model): +class OSOptionProperty(_serialization.Model): """OS option property. All required parameters must be populated in order to send to Azure. - :ivar os_type: Required. The OS type. + :ivar os_type: The OS type. Required. :vartype os_type: str - :ivar enable_fips_image: Required. Whether the image is FIPS-enabled. + :ivar enable_fips_image: Whether the image is FIPS-enabled. Required. :vartype enable_fips_image: bool """ _validation = { - 'os_type': {'required': True}, - 'enable_fips_image': {'required': True}, + "os_type": {"required": True}, + "enable_fips_image": {"required": True}, } _attribute_map = { - 'os_type': {'key': 'os-type', 'type': 'str'}, - 'enable_fips_image': {'key': 'enable-fips-image', 'type': 'bool'}, + "os_type": {"key": "os-type", "type": "str"}, + "enable_fips_image": {"key": "enable-fips-image", "type": "bool"}, } - def __init__( - self, - *, - os_type: str, - enable_fips_image: bool, - **kwargs - ): + def __init__(self, *, os_type: str, enable_fips_image: bool, **kwargs): """ - :keyword os_type: Required. The OS type. + :keyword os_type: The OS type. Required. :paramtype os_type: str - :keyword enable_fips_image: Required. Whether the image is FIPS-enabled. + :keyword enable_fips_image: Whether the image is FIPS-enabled. Required. :paramtype enable_fips_image: bool """ - super(OSOptionProperty, self).__init__(**kwargs) + super().__init__(**kwargs) self.os_type = os_type self.enable_fips_image = enable_fips_image -class OutboundEnvironmentEndpoint(msrest.serialization.Model): +class OutboundEnvironmentEndpoint(_serialization.Model): """Egress endpoints which AKS agent nodes connect to for common purpose. :ivar category: The category of endpoints accessed by the AKS agent node, e.g. @@ -6372,8 +6158,8 @@ class OutboundEnvironmentEndpoint(msrest.serialization.Model): """ _attribute_map = { - 'category': {'key': 'category', 'type': 'str'}, - 'endpoints': {'key': 'endpoints', 'type': '[EndpointDependency]'}, + "category": {"key": "category", "type": "str"}, + "endpoints": {"key": "endpoints", "type": "[EndpointDependency]"}, } def __init__( @@ -6391,19 +6177,19 @@ def __init__( :paramtype endpoints: list[~azure.mgmt.containerservice.v2022_06_02_preview.models.EndpointDependency] """ - super(OutboundEnvironmentEndpoint, self).__init__(**kwargs) + super().__init__(**kwargs) self.category = category self.endpoints = endpoints -class OutboundEnvironmentEndpointCollection(msrest.serialization.Model): +class OutboundEnvironmentEndpointCollection(_serialization.Model): """Collection of OutboundEnvironmentEndpoint. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar value: Required. Collection of resources. + :ivar value: Collection of resources. Required. :vartype value: list[~azure.mgmt.containerservice.v2022_06_02_preview.models.OutboundEnvironmentEndpoint] :ivar next_link: Link to next page of resources. @@ -6411,59 +6197,49 @@ class OutboundEnvironmentEndpointCollection(msrest.serialization.Model): """ _validation = { - 'value': {'required': True}, - 'next_link': {'readonly': True}, + "value": {"required": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[OutboundEnvironmentEndpoint]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[OutboundEnvironmentEndpoint]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: List["_models.OutboundEnvironmentEndpoint"], - **kwargs - ): + def __init__(self, *, value: List["_models.OutboundEnvironmentEndpoint"], **kwargs): """ - :keyword value: Required. Collection of resources. + :keyword value: Collection of resources. Required. :paramtype value: list[~azure.mgmt.containerservice.v2022_06_02_preview.models.OutboundEnvironmentEndpoint] """ - super(OutboundEnvironmentEndpointCollection, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class PowerState(msrest.serialization.Model): +class PowerState(_serialization.Model): """Describes the Power State of the cluster. - :ivar code: Tells whether the cluster is Running or Stopped. Known values are: "Running", + :ivar code: Tells whether the cluster is Running or Stopped. Known values are: "Running" and "Stopped". :vartype code: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.Code """ _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, + "code": {"key": "code", "type": "str"}, } - def __init__( - self, - *, - code: Optional[Union[str, "_models.Code"]] = None, - **kwargs - ): + def __init__(self, *, code: Optional[Union[str, "_models.Code"]] = None, **kwargs): """ - :keyword code: Tells whether the cluster is Running or Stopped. Known values are: "Running", + :keyword code: Tells whether the cluster is Running or Stopped. Known values are: "Running" and "Stopped". :paramtype code: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.Code """ - super(PowerState, self).__init__(**kwargs) + super().__init__(**kwargs) self.code = code -class PrivateEndpoint(msrest.serialization.Model): +class PrivateEndpoint(_serialization.Model): """Private endpoint which a connection belongs to. :ivar id: The resource ID of the private endpoint. @@ -6471,24 +6247,19 @@ class PrivateEndpoint(msrest.serialization.Model): """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, } - def __init__( - self, - *, - id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin """ :keyword id: The resource ID of the private endpoint. :paramtype id: str """ - super(PrivateEndpoint, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id -class PrivateEndpointConnection(msrest.serialization.Model): +class PrivateEndpointConnection(_serialization.Model): """A private endpoint connection. Variables are only populated by the server, and will be ignored when sending a request. @@ -6500,7 +6271,7 @@ class PrivateEndpointConnection(msrest.serialization.Model): :ivar type: The resource type. :vartype type: str :ivar provisioning_state: The current provisioning state. Known values are: "Succeeded", - "Creating", "Deleting", "Failed". + "Creating", "Deleting", and "Failed". :vartype provisioning_state: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.PrivateEndpointConnectionProvisioningState :ivar private_endpoint: The resource of private endpoint. @@ -6513,19 +6284,22 @@ class PrivateEndpointConnection(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'provisioning_state': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, - 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "private_endpoint": {"key": "properties.privateEndpoint", "type": "PrivateEndpoint"}, + "private_link_service_connection_state": { + "key": "properties.privateLinkServiceConnectionState", + "type": "PrivateLinkServiceConnectionState", + }, } def __init__( @@ -6544,7 +6318,7 @@ def __init__( :paramtype private_link_service_connection_state: ~azure.mgmt.containerservice.v2022_06_02_preview.models.PrivateLinkServiceConnectionState """ - super(PrivateEndpointConnection, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -6553,7 +6327,7 @@ def __init__( self.private_link_service_connection_state = private_link_service_connection_state -class PrivateEndpointConnectionListResult(msrest.serialization.Model): +class PrivateEndpointConnectionListResult(_serialization.Model): """A list of private endpoint connections. :ivar value: The collection value. @@ -6562,25 +6336,20 @@ class PrivateEndpointConnectionListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, + "value": {"key": "value", "type": "[PrivateEndpointConnection]"}, } - def __init__( - self, - *, - value: Optional[List["_models.PrivateEndpointConnection"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.PrivateEndpointConnection"]] = None, **kwargs): """ :keyword value: The collection value. :paramtype value: list[~azure.mgmt.containerservice.v2022_06_02_preview.models.PrivateEndpointConnection] """ - super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value -class PrivateLinkResource(msrest.serialization.Model): +class PrivateLinkResource(_serialization.Model): """A private link resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -6601,22 +6370,22 @@ class PrivateLinkResource(msrest.serialization.Model): """ _validation = { - 'private_link_service_id': {'readonly': True}, + "private_link_service_id": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'group_id': {'key': 'groupId', 'type': 'str'}, - 'required_members': {'key': 'requiredMembers', 'type': '[str]'}, - 'private_link_service_id': {'key': 'privateLinkServiceID', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "group_id": {"key": "groupId", "type": "str"}, + "required_members": {"key": "requiredMembers", "type": "[str]"}, + "private_link_service_id": {"key": "privateLinkServiceID", "type": "str"}, } def __init__( self, *, - id: Optional[str] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin name: Optional[str] = None, type: Optional[str] = None, group_id: Optional[str] = None, @@ -6635,7 +6404,7 @@ def __init__( :keyword required_members: The RequiredMembers of the resource. :paramtype required_members: list[str] """ - super(PrivateLinkResource, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id self.name = name self.type = type @@ -6644,7 +6413,7 @@ def __init__( self.private_link_service_id = None -class PrivateLinkResourcesListResult(msrest.serialization.Model): +class PrivateLinkResourcesListResult(_serialization.Model): """A list of private link resources. :ivar value: The collection value. @@ -6653,29 +6422,24 @@ class PrivateLinkResourcesListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, + "value": {"key": "value", "type": "[PrivateLinkResource]"}, } - def __init__( - self, - *, - value: Optional[List["_models.PrivateLinkResource"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.PrivateLinkResource"]] = None, **kwargs): """ :keyword value: The collection value. :paramtype value: list[~azure.mgmt.containerservice.v2022_06_02_preview.models.PrivateLinkResource] """ - super(PrivateLinkResourcesListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value -class PrivateLinkServiceConnectionState(msrest.serialization.Model): +class PrivateLinkServiceConnectionState(_serialization.Model): """The state of a private link service connection. :ivar status: The private link service connection status. Known values are: "Pending", - "Approved", "Rejected", "Disconnected". + "Approved", "Rejected", and "Disconnected". :vartype status: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.ConnectionStatus :ivar description: The private link service connection description. @@ -6683,8 +6447,8 @@ class PrivateLinkServiceConnectionState(msrest.serialization.Model): """ _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, + "status": {"key": "status", "type": "str"}, + "description": {"key": "description", "type": "str"}, } def __init__( @@ -6696,18 +6460,18 @@ def __init__( ): """ :keyword status: The private link service connection status. Known values are: "Pending", - "Approved", "Rejected", "Disconnected". + "Approved", "Rejected", and "Disconnected". :paramtype status: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.ConnectionStatus :keyword description: The private link service connection description. :paramtype description: str """ - super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) + super().__init__(**kwargs) self.status = status self.description = description -class ResourceReference(msrest.serialization.Model): +class ResourceReference(_serialization.Model): """A reference to an Azure resource. :ivar id: The fully qualified Azure resource id. @@ -6715,29 +6479,24 @@ class ResourceReference(msrest.serialization.Model): """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, } - def __init__( - self, - *, - id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin """ :keyword id: The fully qualified Azure resource id. :paramtype id: str """ - super(ResourceReference, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id -class RunCommandRequest(msrest.serialization.Model): +class RunCommandRequest(_serialization.Model): """A run command request. All required parameters must be populated in order to send to Azure. - :ivar command: Required. The command to run. + :ivar command: The command to run. Required. :vartype command: str :ivar context: A base64 encoded zip file containing the files required by the command. :vartype context: str @@ -6746,38 +6505,31 @@ class RunCommandRequest(msrest.serialization.Model): """ _validation = { - 'command': {'required': True}, + "command": {"required": True}, } _attribute_map = { - 'command': {'key': 'command', 'type': 'str'}, - 'context': {'key': 'context', 'type': 'str'}, - 'cluster_token': {'key': 'clusterToken', 'type': 'str'}, + "command": {"key": "command", "type": "str"}, + "context": {"key": "context", "type": "str"}, + "cluster_token": {"key": "clusterToken", "type": "str"}, } - def __init__( - self, - *, - command: str, - context: Optional[str] = None, - cluster_token: Optional[str] = None, - **kwargs - ): + def __init__(self, *, command: str, context: Optional[str] = None, cluster_token: Optional[str] = None, **kwargs): """ - :keyword command: Required. The command to run. + :keyword command: The command to run. Required. :paramtype command: str :keyword context: A base64 encoded zip file containing the files required by the command. :paramtype context: str :keyword cluster_token: AuthToken issued for AKS AAD Server App. :paramtype cluster_token: str """ - super(RunCommandRequest, self).__init__(**kwargs) + super().__init__(**kwargs) self.command = command self.context = context self.cluster_token = cluster_token -class RunCommandResult(msrest.serialization.Model): +class RunCommandResult(_serialization.Model): """run command result. Variables are only populated by the server, and will be ignored when sending a request. @@ -6799,32 +6551,28 @@ class RunCommandResult(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'exit_code': {'readonly': True}, - 'started_at': {'readonly': True}, - 'finished_at': {'readonly': True}, - 'logs': {'readonly': True}, - 'reason': {'readonly': True}, + "id": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "exit_code": {"readonly": True}, + "started_at": {"readonly": True}, + "finished_at": {"readonly": True}, + "logs": {"readonly": True}, + "reason": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'exit_code': {'key': 'properties.exitCode', 'type': 'int'}, - 'started_at': {'key': 'properties.startedAt', 'type': 'iso-8601'}, - 'finished_at': {'key': 'properties.finishedAt', 'type': 'iso-8601'}, - 'logs': {'key': 'properties.logs', 'type': 'str'}, - 'reason': {'key': 'properties.reason', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(RunCommandResult, self).__init__(**kwargs) + "id": {"key": "id", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "exit_code": {"key": "properties.exitCode", "type": "int"}, + "started_at": {"key": "properties.startedAt", "type": "iso-8601"}, + "finished_at": {"key": "properties.finishedAt", "type": "iso-8601"}, + "logs": {"key": "properties.logs", "type": "str"}, + "reason": {"key": "properties.reason", "type": "str"}, + } + + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.id = None self.provisioning_state = None self.exit_code = None @@ -6834,7 +6582,7 @@ def __init__( self.reason = None -class Snapshot(TrackedResource): +class Snapshot(TrackedResource): # pylint: disable=too-many-instance-attributes """A node pool snapshot resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -6852,28 +6600,28 @@ class Snapshot(TrackedResource): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.containerservice.v2022_06_02_preview.models.SystemData - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] - :ivar location: Required. The geo-location where the resource lives. + :ivar location: The geo-location where the resource lives. Required. :vartype location: str :ivar creation_data: CreationData to be used to specify the source agent pool resource ID to create this snapshot. :vartype creation_data: ~azure.mgmt.containerservice.v2022_06_02_preview.models.CreationData :ivar snapshot_type: The type of a snapshot. The default is NodePool. Known values are: - "NodePool", "ManagedCluster". Default value: "NodePool". + "NodePool" and "ManagedCluster". :vartype snapshot_type: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.SnapshotType :ivar kubernetes_version: The version of Kubernetes. :vartype kubernetes_version: str :ivar node_image_version: The version of node image. :vartype node_image_version: str - :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", - "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.OSType :ivar os_sku: Specifies the OS SKU used by the agent pool. If not specified, the default is Ubuntu if OSType=Linux or Windows2019 if OSType=Windows. And the default Windows OSSKU will be changed to Windows2022 after Windows2019 is deprecated. Known values are: "Ubuntu", - "CBLMariner", "Windows2019", "Windows2022". + "CBLMariner", "Windows2019", and "Windows2022". :vartype os_sku: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.OSSKU :ivar vm_size: The size of the VM. :vartype vm_size: str @@ -6882,34 +6630,34 @@ class Snapshot(TrackedResource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'location': {'required': True}, - 'kubernetes_version': {'readonly': True}, - 'node_image_version': {'readonly': True}, - 'os_type': {'readonly': True}, - 'os_sku': {'readonly': True}, - 'vm_size': {'readonly': True}, - 'enable_fips': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, + "kubernetes_version": {"readonly": True}, + "node_image_version": {"readonly": True}, + "os_type": {"readonly": True}, + "os_sku": {"readonly": True}, + "vm_size": {"readonly": True}, + "enable_fips": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - 'creation_data': {'key': 'properties.creationData', 'type': 'CreationData'}, - 'snapshot_type': {'key': 'properties.snapshotType', 'type': 'str'}, - 'kubernetes_version': {'key': 'properties.kubernetesVersion', 'type': 'str'}, - 'node_image_version': {'key': 'properties.nodeImageVersion', 'type': 'str'}, - 'os_type': {'key': 'properties.osType', 'type': 'str'}, - 'os_sku': {'key': 'properties.osSku', 'type': 'str'}, - 'vm_size': {'key': 'properties.vmSize', 'type': 'str'}, - 'enable_fips': {'key': 'properties.enableFIPS', 'type': 'bool'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "creation_data": {"key": "properties.creationData", "type": "CreationData"}, + "snapshot_type": {"key": "properties.snapshotType", "type": "str"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "node_image_version": {"key": "properties.nodeImageVersion", "type": "str"}, + "os_type": {"key": "properties.osType", "type": "str"}, + "os_sku": {"key": "properties.osSku", "type": "str"}, + "vm_size": {"key": "properties.vmSize", "type": "str"}, + "enable_fips": {"key": "properties.enableFIPS", "type": "bool"}, } def __init__( @@ -6918,23 +6666,23 @@ def __init__( location: str, tags: Optional[Dict[str, str]] = None, creation_data: Optional["_models.CreationData"] = None, - snapshot_type: Optional[Union[str, "_models.SnapshotType"]] = "NodePool", + snapshot_type: Union[str, "_models.SnapshotType"] = "NodePool", **kwargs ): """ - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] - :keyword location: Required. The geo-location where the resource lives. + :keyword location: The geo-location where the resource lives. Required. :paramtype location: str :keyword creation_data: CreationData to be used to specify the source agent pool resource ID to create this snapshot. :paramtype creation_data: ~azure.mgmt.containerservice.v2022_06_02_preview.models.CreationData :keyword snapshot_type: The type of a snapshot. The default is NodePool. Known values are: - "NodePool", "ManagedCluster". Default value: "NodePool". + "NodePool" and "ManagedCluster". :paramtype snapshot_type: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.SnapshotType """ - super(Snapshot, self).__init__(tags=tags, location=location, **kwargs) + super().__init__(tags=tags, location=location, **kwargs) self.creation_data = creation_data self.snapshot_type = snapshot_type self.kubernetes_version = None @@ -6945,7 +6693,7 @@ def __init__( self.enable_fips = None -class SnapshotListResult(msrest.serialization.Model): +class SnapshotListResult(_serialization.Model): """The response from the List Snapshots operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -6957,30 +6705,25 @@ class SnapshotListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[Snapshot]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[Snapshot]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.Snapshot"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.Snapshot"]] = None, **kwargs): """ :keyword value: The list of snapshots. :paramtype value: list[~azure.mgmt.containerservice.v2022_06_02_preview.models.Snapshot] """ - super(SnapshotListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class SysctlConfig(msrest.serialization.Model): +class SysctlConfig(_serialization.Model): # pylint: disable=too-many-instance-attributes """Sysctl settings for Linux agent nodes. :ivar net_core_somaxconn: Sysctl setting net.core.somaxconn. @@ -7042,37 +6785,37 @@ class SysctlConfig(msrest.serialization.Model): """ _attribute_map = { - 'net_core_somaxconn': {'key': 'netCoreSomaxconn', 'type': 'int'}, - 'net_core_netdev_max_backlog': {'key': 'netCoreNetdevMaxBacklog', 'type': 'int'}, - 'net_core_rmem_default': {'key': 'netCoreRmemDefault', 'type': 'int'}, - 'net_core_rmem_max': {'key': 'netCoreRmemMax', 'type': 'int'}, - 'net_core_wmem_default': {'key': 'netCoreWmemDefault', 'type': 'int'}, - 'net_core_wmem_max': {'key': 'netCoreWmemMax', 'type': 'int'}, - 'net_core_optmem_max': {'key': 'netCoreOptmemMax', 'type': 'int'}, - 'net_ipv4_tcp_max_syn_backlog': {'key': 'netIpv4TcpMaxSynBacklog', 'type': 'int'}, - 'net_ipv4_tcp_max_tw_buckets': {'key': 'netIpv4TcpMaxTwBuckets', 'type': 'int'}, - 'net_ipv4_tcp_fin_timeout': {'key': 'netIpv4TcpFinTimeout', 'type': 'int'}, - 'net_ipv4_tcp_keepalive_time': {'key': 'netIpv4TcpKeepaliveTime', 'type': 'int'}, - 'net_ipv4_tcp_keepalive_probes': {'key': 'netIpv4TcpKeepaliveProbes', 'type': 'int'}, - 'net_ipv4_tcpkeepalive_intvl': {'key': 'netIpv4TcpkeepaliveIntvl', 'type': 'int'}, - 'net_ipv4_tcp_tw_reuse': {'key': 'netIpv4TcpTwReuse', 'type': 'bool'}, - 'net_ipv4_ip_local_port_range': {'key': 'netIpv4IpLocalPortRange', 'type': 'str'}, - 'net_ipv4_neigh_default_gc_thresh1': {'key': 'netIpv4NeighDefaultGcThresh1', 'type': 'int'}, - 'net_ipv4_neigh_default_gc_thresh2': {'key': 'netIpv4NeighDefaultGcThresh2', 'type': 'int'}, - 'net_ipv4_neigh_default_gc_thresh3': {'key': 'netIpv4NeighDefaultGcThresh3', 'type': 'int'}, - 'net_netfilter_nf_conntrack_max': {'key': 'netNetfilterNfConntrackMax', 'type': 'int'}, - 'net_netfilter_nf_conntrack_buckets': {'key': 'netNetfilterNfConntrackBuckets', 'type': 'int'}, - 'fs_inotify_max_user_watches': {'key': 'fsInotifyMaxUserWatches', 'type': 'int'}, - 'fs_file_max': {'key': 'fsFileMax', 'type': 'int'}, - 'fs_aio_max_nr': {'key': 'fsAioMaxNr', 'type': 'int'}, - 'fs_nr_open': {'key': 'fsNrOpen', 'type': 'int'}, - 'kernel_threads_max': {'key': 'kernelThreadsMax', 'type': 'int'}, - 'vm_max_map_count': {'key': 'vmMaxMapCount', 'type': 'int'}, - 'vm_swappiness': {'key': 'vmSwappiness', 'type': 'int'}, - 'vm_vfs_cache_pressure': {'key': 'vmVfsCachePressure', 'type': 'int'}, - } - - def __init__( + "net_core_somaxconn": {"key": "netCoreSomaxconn", "type": "int"}, + "net_core_netdev_max_backlog": {"key": "netCoreNetdevMaxBacklog", "type": "int"}, + "net_core_rmem_default": {"key": "netCoreRmemDefault", "type": "int"}, + "net_core_rmem_max": {"key": "netCoreRmemMax", "type": "int"}, + "net_core_wmem_default": {"key": "netCoreWmemDefault", "type": "int"}, + "net_core_wmem_max": {"key": "netCoreWmemMax", "type": "int"}, + "net_core_optmem_max": {"key": "netCoreOptmemMax", "type": "int"}, + "net_ipv4_tcp_max_syn_backlog": {"key": "netIpv4TcpMaxSynBacklog", "type": "int"}, + "net_ipv4_tcp_max_tw_buckets": {"key": "netIpv4TcpMaxTwBuckets", "type": "int"}, + "net_ipv4_tcp_fin_timeout": {"key": "netIpv4TcpFinTimeout", "type": "int"}, + "net_ipv4_tcp_keepalive_time": {"key": "netIpv4TcpKeepaliveTime", "type": "int"}, + "net_ipv4_tcp_keepalive_probes": {"key": "netIpv4TcpKeepaliveProbes", "type": "int"}, + "net_ipv4_tcpkeepalive_intvl": {"key": "netIpv4TcpkeepaliveIntvl", "type": "int"}, + "net_ipv4_tcp_tw_reuse": {"key": "netIpv4TcpTwReuse", "type": "bool"}, + "net_ipv4_ip_local_port_range": {"key": "netIpv4IpLocalPortRange", "type": "str"}, + "net_ipv4_neigh_default_gc_thresh1": {"key": "netIpv4NeighDefaultGcThresh1", "type": "int"}, + "net_ipv4_neigh_default_gc_thresh2": {"key": "netIpv4NeighDefaultGcThresh2", "type": "int"}, + "net_ipv4_neigh_default_gc_thresh3": {"key": "netIpv4NeighDefaultGcThresh3", "type": "int"}, + "net_netfilter_nf_conntrack_max": {"key": "netNetfilterNfConntrackMax", "type": "int"}, + "net_netfilter_nf_conntrack_buckets": {"key": "netNetfilterNfConntrackBuckets", "type": "int"}, + "fs_inotify_max_user_watches": {"key": "fsInotifyMaxUserWatches", "type": "int"}, + "fs_file_max": {"key": "fsFileMax", "type": "int"}, + "fs_aio_max_nr": {"key": "fsAioMaxNr", "type": "int"}, + "fs_nr_open": {"key": "fsNrOpen", "type": "int"}, + "kernel_threads_max": {"key": "kernelThreadsMax", "type": "int"}, + "vm_max_map_count": {"key": "vmMaxMapCount", "type": "int"}, + "vm_swappiness": {"key": "vmSwappiness", "type": "int"}, + "vm_vfs_cache_pressure": {"key": "vmVfsCachePressure", "type": "int"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, net_core_somaxconn: Optional[int] = None, @@ -7163,7 +6906,7 @@ def __init__( :keyword vm_vfs_cache_pressure: Sysctl setting vm.vfs_cache_pressure. :paramtype vm_vfs_cache_pressure: int """ - super(SysctlConfig, self).__init__(**kwargs) + super().__init__(**kwargs) self.net_core_somaxconn = net_core_somaxconn self.net_core_netdev_max_backlog = net_core_netdev_max_backlog self.net_core_rmem_default = net_core_rmem_default @@ -7194,13 +6937,13 @@ def __init__( self.vm_vfs_cache_pressure = vm_vfs_cache_pressure -class SystemData(msrest.serialization.Model): +class SystemData(_serialization.Model): """Metadata pertaining to creation and last modification of the resource. :ivar created_by: The identity that created the resource. :vartype created_by: str :ivar created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", "Key". + "User", "Application", "ManagedIdentity", and "Key". :vartype created_by_type: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.CreatedByType :ivar created_at: The timestamp of resource creation (UTC). @@ -7208,7 +6951,7 @@ class SystemData(msrest.serialization.Model): :ivar last_modified_by: The identity that last modified the resource. :vartype last_modified_by: str :ivar last_modified_by_type: The type of identity that last modified the resource. Known values - are: "User", "Application", "ManagedIdentity", "Key". + are: "User", "Application", "ManagedIdentity", and "Key". :vartype last_modified_by_type: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.CreatedByType :ivar last_modified_at: The timestamp of resource last modification (UTC). @@ -7216,12 +6959,12 @@ class SystemData(msrest.serialization.Model): """ _attribute_map = { - 'created_by': {'key': 'createdBy', 'type': 'str'}, - 'created_by_type': {'key': 'createdByType', 'type': 'str'}, - 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, - 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, - 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, - 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + "created_by": {"key": "createdBy", "type": "str"}, + "created_by_type": {"key": "createdByType", "type": "str"}, + "created_at": {"key": "createdAt", "type": "iso-8601"}, + "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, + "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, + "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, } def __init__( @@ -7239,7 +6982,7 @@ def __init__( :keyword created_by: The identity that created the resource. :paramtype created_by: str :keyword created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", "Key". + "User", "Application", "ManagedIdentity", and "Key". :paramtype created_by_type: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.CreatedByType :keyword created_at: The timestamp of resource creation (UTC). @@ -7247,13 +6990,13 @@ def __init__( :keyword last_modified_by: The identity that last modified the resource. :paramtype last_modified_by: str :keyword last_modified_by_type: The type of identity that last modified the resource. Known - values are: "User", "Application", "ManagedIdentity", "Key". + values are: "User", "Application", "ManagedIdentity", and "Key". :paramtype last_modified_by_type: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.CreatedByType :keyword last_modified_at: The timestamp of resource last modification (UTC). :paramtype last_modified_at: ~datetime.datetime """ - super(SystemData, self).__init__(**kwargs) + super().__init__(**kwargs) self.created_by = created_by self.created_by_type = created_by_type self.created_at = created_at @@ -7262,36 +7005,31 @@ def __init__( self.last_modified_at = last_modified_at -class TagsObject(msrest.serialization.Model): +class TagsObject(_serialization.Model): """Tags object for patch operations. - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] """ _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] """ - super(TagsObject, self).__init__(**kwargs) + super().__init__(**kwargs) self.tags = tags -class TimeInWeek(msrest.serialization.Model): +class TimeInWeek(_serialization.Model): """Time in a week. :ivar day: The day of the week. Known values are: "Sunday", "Monday", "Tuesday", "Wednesday", - "Thursday", "Friday", "Saturday". + "Thursday", "Friday", and "Saturday". :vartype day: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.WeekDay :ivar hour_slots: Each integer hour represents a time range beginning at 0m after the hour ending at the next hour (non-inclusive). 0 corresponds to 00:00 UTC, 23 corresponds to 23:00 @@ -7300,32 +7038,28 @@ class TimeInWeek(msrest.serialization.Model): """ _attribute_map = { - 'day': {'key': 'day', 'type': 'str'}, - 'hour_slots': {'key': 'hourSlots', 'type': '[int]'}, + "day": {"key": "day", "type": "str"}, + "hour_slots": {"key": "hourSlots", "type": "[int]"}, } def __init__( - self, - *, - day: Optional[Union[str, "_models.WeekDay"]] = None, - hour_slots: Optional[List[int]] = None, - **kwargs + self, *, day: Optional[Union[str, "_models.WeekDay"]] = None, hour_slots: Optional[List[int]] = None, **kwargs ): """ :keyword day: The day of the week. Known values are: "Sunday", "Monday", "Tuesday", - "Wednesday", "Thursday", "Friday", "Saturday". + "Wednesday", "Thursday", "Friday", and "Saturday". :paramtype day: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.WeekDay :keyword hour_slots: Each integer hour represents a time range beginning at 0m after the hour ending at the next hour (non-inclusive). 0 corresponds to 00:00 UTC, 23 corresponds to 23:00 UTC. Specifying [0, 1] means the 00:00 - 02:00 UTC time range. :paramtype hour_slots: list[int] """ - super(TimeInWeek, self).__init__(**kwargs) + super().__init__(**kwargs) self.day = day self.hour_slots = hour_slots -class TimeSpan(msrest.serialization.Model): +class TimeSpan(_serialization.Model): """For example, between 2021-05-25T13:00:00Z and 2021-05-25T14:00:00Z. :ivar start: The start of a time span. @@ -7335,29 +7069,23 @@ class TimeSpan(msrest.serialization.Model): """ _attribute_map = { - 'start': {'key': 'start', 'type': 'iso-8601'}, - 'end': {'key': 'end', 'type': 'iso-8601'}, + "start": {"key": "start", "type": "iso-8601"}, + "end": {"key": "end", "type": "iso-8601"}, } - def __init__( - self, - *, - start: Optional[datetime.datetime] = None, - end: Optional[datetime.datetime] = None, - **kwargs - ): + def __init__(self, *, start: Optional[datetime.datetime] = None, end: Optional[datetime.datetime] = None, **kwargs): """ :keyword start: The start of a time span. :paramtype start: ~datetime.datetime :keyword end: The end of a time span. :paramtype end: ~datetime.datetime """ - super(TimeSpan, self).__init__(**kwargs) + super().__init__(**kwargs) self.start = start self.end = end -class TrustedAccessRole(msrest.serialization.Model): +class TrustedAccessRole(_serialization.Model): """Trusted access role definition. Variables are only populated by the server, and will be ignored when sending a request. @@ -7374,24 +7102,20 @@ class TrustedAccessRole(msrest.serialization.Model): """ _validation = { - 'source_resource_type': {'readonly': True}, - 'name': {'readonly': True}, - 'rules': {'readonly': True}, + "source_resource_type": {"readonly": True}, + "name": {"readonly": True}, + "rules": {"readonly": True}, } _attribute_map = { - 'source_resource_type': {'key': 'sourceResourceType', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'rules': {'key': 'rules', 'type': '[TrustedAccessRoleRule]'}, + "source_resource_type": {"key": "sourceResourceType", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "rules": {"key": "rules", "type": "[TrustedAccessRoleRule]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(TrustedAccessRole, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.source_resource_type = None self.name = None self.rules = None @@ -7416,59 +7140,53 @@ class TrustedAccessRoleBinding(Resource): information. :vartype system_data: ~azure.mgmt.containerservice.v2022_06_02_preview.models.SystemData :ivar provisioning_state: The current provisioning state of trusted access role binding. Known - values are: "Succeeded", "Failed", "Updating", "Deleting". + values are: "Succeeded", "Failed", "Updating", and "Deleting". :vartype provisioning_state: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.TrustedAccessRoleBindingProvisioningState - :ivar source_resource_id: Required. The ARM resource ID of source resource that trusted access - is configured for. + :ivar source_resource_id: The ARM resource ID of source resource that trusted access is + configured for. Required. :vartype source_resource_id: str - :ivar roles: Required. A list of roles to bind, each item is a resource type qualified role - name. For example: 'Microsoft.MachineLearningServices/workspaces/reader'. + :ivar roles: A list of roles to bind, each item is a resource type qualified role name. For + example: 'Microsoft.MachineLearningServices/workspaces/reader'. Required. :vartype roles: list[str] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'source_resource_id': {'required': True}, - 'roles': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "source_resource_id": {"required": True}, + "roles": {"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'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'source_resource_id': {'key': 'properties.sourceResourceId', 'type': 'str'}, - 'roles': {'key': 'properties.roles', 'type': '[str]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "source_resource_id": {"key": "properties.sourceResourceId", "type": "str"}, + "roles": {"key": "properties.roles", "type": "[str]"}, } - def __init__( - self, - *, - source_resource_id: str, - roles: List[str], - **kwargs - ): + def __init__(self, *, source_resource_id: str, roles: List[str], **kwargs): """ - :keyword source_resource_id: Required. The ARM resource ID of source resource that trusted - access is configured for. + :keyword source_resource_id: The ARM resource ID of source resource that trusted access is + configured for. Required. :paramtype source_resource_id: str - :keyword roles: Required. A list of roles to bind, each item is a resource type qualified role - name. For example: 'Microsoft.MachineLearningServices/workspaces/reader'. + :keyword roles: A list of roles to bind, each item is a resource type qualified role name. For + example: 'Microsoft.MachineLearningServices/workspaces/reader'. Required. :paramtype roles: list[str] """ - super(TrustedAccessRoleBinding, self).__init__(**kwargs) + super().__init__(**kwargs) self.provisioning_state = None self.source_resource_id = source_resource_id self.roles = roles -class TrustedAccessRoleBindingListResult(msrest.serialization.Model): +class TrustedAccessRoleBindingListResult(_serialization.Model): """List of trusted access role bindings. Variables are only populated by the server, and will be ignored when sending a request. @@ -7481,31 +7199,26 @@ class TrustedAccessRoleBindingListResult(msrest.serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[TrustedAccessRoleBinding]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[TrustedAccessRoleBinding]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.TrustedAccessRoleBinding"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.TrustedAccessRoleBinding"]] = None, **kwargs): """ :keyword value: Role binding list. :paramtype value: list[~azure.mgmt.containerservice.v2022_06_02_preview.models.TrustedAccessRoleBinding] """ - super(TrustedAccessRoleBindingListResult, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = None -class TrustedAccessRoleListResult(msrest.serialization.Model): +class TrustedAccessRoleListResult(_serialization.Model): """List of trusted access roles. Variables are only populated by the server, and will be ignored when sending a request. @@ -7517,27 +7230,23 @@ class TrustedAccessRoleListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[TrustedAccessRole]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[TrustedAccessRole]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(TrustedAccessRoleListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.value = None self.next_link = None -class TrustedAccessRoleRule(msrest.serialization.Model): +class TrustedAccessRoleRule(_serialization.Model): """Rule for trusted access role. Variables are only populated by the server, and will be ignored when sending a request. @@ -7555,28 +7264,24 @@ class TrustedAccessRoleRule(msrest.serialization.Model): """ _validation = { - 'verbs': {'readonly': True}, - 'api_groups': {'readonly': True}, - 'resources': {'readonly': True}, - 'resource_names': {'readonly': True}, - 'non_resource_ur_ls': {'readonly': True}, + "verbs": {"readonly": True}, + "api_groups": {"readonly": True}, + "resources": {"readonly": True}, + "resource_names": {"readonly": True}, + "non_resource_ur_ls": {"readonly": True}, } _attribute_map = { - 'verbs': {'key': 'verbs', 'type': '[str]'}, - 'api_groups': {'key': 'apiGroups', 'type': '[str]'}, - 'resources': {'key': 'resources', 'type': '[str]'}, - 'resource_names': {'key': 'resourceNames', 'type': '[str]'}, - 'non_resource_ur_ls': {'key': 'nonResourceURLs', 'type': '[str]'}, + "verbs": {"key": "verbs", "type": "[str]"}, + "api_groups": {"key": "apiGroups", "type": "[str]"}, + "resources": {"key": "resources", "type": "[str]"}, + "resource_names": {"key": "resourceNames", "type": "[str]"}, + "non_resource_ur_ls": {"key": "nonResourceURLs", "type": "[str]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(TrustedAccessRoleRule, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.verbs = None self.api_groups = None self.resources = None @@ -7584,7 +7289,7 @@ def __init__( self.non_resource_ur_ls = None -class WindowsGmsaProfile(msrest.serialization.Model): +class WindowsGmsaProfile(_serialization.Model): """Windows gMSA Profile in the managed cluster. :ivar enabled: Specifies whether to enable Windows gMSA in the managed cluster. @@ -7600,9 +7305,9 @@ class WindowsGmsaProfile(msrest.serialization.Model): """ _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'dns_server': {'key': 'dnsServer', 'type': 'str'}, - 'root_domain_name': {'key': 'rootDomainName', 'type': 'str'}, + "enabled": {"key": "enabled", "type": "bool"}, + "dns_server": {"key": "dnsServer", "type": "str"}, + "root_domain_name": {"key": "rootDomainName", "type": "str"}, } def __init__( @@ -7625,7 +7330,7 @@ def __init__( which is used to create the managed cluster. :paramtype root_domain_name: str """ - super(WindowsGmsaProfile, self).__init__(**kwargs) + super().__init__(**kwargs) self.enabled = enabled self.dns_server = dns_server self.root_domain_name = root_domain_name diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/models/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/models/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/models/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/models/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/__init__.py index 03d015afec25..d0dc4a5de18e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/__init__.py @@ -23,20 +23,21 @@ from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'Operations', - 'ManagedClustersOperations', - 'MaintenanceConfigurationsOperations', - 'AgentPoolsOperations', - 'PrivateEndpointConnectionsOperations', - 'PrivateLinkResourcesOperations', - 'ResolvePrivateLinkServiceIdOperations', - 'SnapshotsOperations', - 'ManagedClusterSnapshotsOperations', - 'TrustedAccessRolesOperations', - 'TrustedAccessRoleBindingsOperations', - 'FleetsOperations', - 'FleetMembersOperations', + "Operations", + "ManagedClustersOperations", + "MaintenanceConfigurationsOperations", + "AgentPoolsOperations", + "PrivateEndpointConnectionsOperations", + "PrivateLinkResourcesOperations", + "ResolvePrivateLinkServiceIdOperations", + "SnapshotsOperations", + "ManagedClusterSnapshotsOperations", + "TrustedAccessRolesOperations", + "TrustedAccessRoleBindingsOperations", + "FleetsOperations", + "FleetMembersOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_agent_pools_operations.py index ef8e1b47fbb6..909600012447 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_agent_pools_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,141 +27,146 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - *, - json: Optional[_models.AgentPool] = None, - content: Any = None, - **kwargs: Any +def build_create_or_update_request( + resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request_initial( - subscription_id: str, +def build_delete_request( resource_group_name: str, resource_name: str, agent_pool_name: str, + subscription_id: str, *, ignore_pod_disruption_budget: Optional[bool] = None, **kwargs: Any @@ -164,150 +174,166 @@ def build_delete_request_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if ignore_pod_disruption_budget is not None: - _params['ignore-pod-disruption-budget'] = _SERIALIZER.query("ignore_pod_disruption_budget", ignore_pod_disruption_budget, 'bool') + _params["ignore-pod-disruption-budget"] = _SERIALIZER.query( + "ignore_pod_disruption_budget", ignore_pod_disruption_budget, "bool" + ) # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_get_upgrade_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_available_agent_pool_versions_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_upgrade_node_image_version_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any +def build_upgrade_node_image_version_request( + resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class AgentPoolsOperations: """ @@ -328,47 +354,41 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> Iterable[_models.AgentPoolListResult]: + def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> Iterable["_models.AgentPool"]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AgentPoolListResult or the result of cls(response) + :return: An iterator like instance of either AgentPool or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_06_02_preview.models.AgentPoolListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_06_02_preview.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -376,16 +396,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -401,10 +416,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -414,54 +427,46 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore @distributed_trace def get( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPool: """Gets the specified managed cluster agent pool. Gets the specified managed cluster agent pool. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPool, or the result of cls(response) + :return: AgentPool or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.AgentPool - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -469,57 +474,60 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore def _create_or_update_initial( self, resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: _models.AgentPool, + parameters: Union[_models.AgentPool, IO], **kwargs: Any ) -> _models.AgentPool: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] - _json = self._serialize.body(parameters, 'AgentPool') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "AgentPool") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -527,10 +535,9 @@ def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -538,26 +545,27 @@ def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - - @distributed_trace + @overload def begin_create_or_update( self, resource_group_name: str, resource_name: str, agent_pool_name: str, parameters: _models.AgentPool, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.AgentPool]: """Creates or updates an agent pool in the specified managed cluster. @@ -565,13 +573,17 @@ def begin_create_or_update( Creates or updates an agent pool in the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str - :param parameters: The agent pool to create or update. + :param parameters: The agent pool to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_06_02_preview.models.AgentPool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -583,20 +595,98 @@ def begin_create_or_update( :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_06_02_preview.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AgentPool]: + """Creates or updates an agent pool in the specified managed cluster. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: The agent pool to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_06_02_preview.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: Union[_models.AgentPool, IO], + **kwargs: Any + ) -> LROPoller[_models.AgentPool]: + """Creates or updates an agent pool in the specified managed cluster. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: The agent pool to create or update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.mgmt.containerservice.v2022_06_02_preview.models.AgentPool or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_06_02_preview.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -605,39 +695,35 @@ def begin_create_or_update( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('AgentPool', pipeline_response) + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements self, @@ -647,26 +733,23 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements ignore_pod_disruption_budget: Optional[bool] = None, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, - api_version=api_version, + subscription_id=self._config.subscription_id, ignore_pod_disruption_budget=ignore_pod_disruption_budget, - template_url=self._delete_initial.metadata['url'], + api_version=api_version, + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -674,10 +757,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -687,11 +769,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements + def begin_delete( self, resource_group_name: str, resource_name: str, @@ -704,10 +785,11 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Deletes an agent pool in the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :param ignore_pod_disruption_budget: ignore-pod-disruption-budget=true to delete those pods on a node without considering Pod Disruption Budget. Default value is None. @@ -722,19 +804,16 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -742,80 +821,70 @@ def begin_delete( # pylint: disable=inconsistent-return-statements agent_pool_name=agent_pool_name, ignore_pod_disruption_budget=ignore_pod_disruption_budget, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> _models.AgentPoolUpgradeProfile: """Gets the upgrade profile for an agent pool. Gets the upgrade profile for an agent pool. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolUpgradeProfile, or the result of cls(response) + :return: AgentPoolUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.AgentPoolUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -823,32 +892,27 @@ def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolUpgradeProfile', pipeline_response) + deserialized = self._deserialize("AgentPoolUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore @distributed_trace def get_available_agent_pool_versions( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported Kubernetes versions for the specified agent pool. @@ -857,32 +921,30 @@ def get_available_agent_pool_versions( the version lifecycle. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPoolAvailableVersions, or the result of cls(response) + :return: AgentPoolAvailableVersions or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.AgentPoolAvailableVersions - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolAvailableVersions] - request = build_get_available_agent_pool_versions_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_available_agent_pool_versions.metadata['url'], + template_url=self.get_available_agent_pool_versions.metadata["url"], headers=_headers, params=_params, ) @@ -890,52 +952,43 @@ def get_available_agent_pool_versions( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AgentPoolAvailableVersions', pipeline_response) + deserialized = self._deserialize("AgentPoolAvailableVersions", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_available_agent_pool_versions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore - + get_available_agent_pool_versions.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore def _upgrade_node_image_version_initial( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any ) -> Optional[_models.AgentPool]: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.AgentPool]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.AgentPool]] - - request = build_upgrade_node_image_version_request_initial( - subscription_id=self._config.subscription_id, + request = build_upgrade_node_image_version_request( resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._upgrade_node_image_version_initial.metadata['url'], + template_url=self._upgrade_node_image_version_initial.metadata["url"], headers=_headers, params=_params, ) @@ -943,10 +996,9 @@ def _upgrade_node_image_version_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -956,26 +1008,23 @@ def _upgrade_node_image_version_initial( deserialized = None response_headers = {} if response.status_code == 202: - response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) - - deserialized = self._deserialize('AgentPool', pipeline_response) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _upgrade_node_image_version_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore - + _upgrade_node_image_version_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore @distributed_trace def begin_upgrade_node_image_version( - self, - resource_group_name: str, - resource_name: str, - agent_pool_name: str, - **kwargs: Any - ) -> LROPoller[_models.AgentPool]: + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any + ) -> LROPoller[None]: """Upgrades the node image version of an agent pool to the latest. Upgrading the node image version of an agent pool applies the newest OS and runtime updates to @@ -983,10 +1032,11 @@ def begin_upgrade_node_image_version( node image versions, see: https://docs.microsoft.com/azure/aks/node-image-upgrade. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param agent_pool_name: The name of the agent pool. + :param agent_pool_name: The name of the agent pool. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -999,59 +1049,54 @@ def begin_upgrade_node_image_version( :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_06_02_preview.models.AgentPool] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._upgrade_node_image_version_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) - - deserialized = self._deserialize('AgentPool', pipeline_response) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("AgentPool", pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_upgrade_node_image_version.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore + begin_upgrade_node_image_version.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_fleet_members_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_fleet_members_operations.py index 12952a265988..aa0cf6d3c2a6 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_fleet_members_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_fleet_members_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,21 +27,22 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_create_or_update_request_initial( - subscription_id: str, + +def build_create_or_update_request( resource_group_name: str, fleet_name: str, fleet_member_name: str, + subscription_id: str, *, - json: Optional[_models.FleetMember] = None, - content: Any = None, if_match: Optional[str] = None, if_none_match: Optional[str] = None, **kwargs: Any @@ -44,88 +50,98 @@ def build_create_or_update_request_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/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), - "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])?$'), - "fleetMemberName": _SERIALIZER.url("fleet_member_name", fleet_member_name, 'str', max_length=50, min_length=1, pattern=r'^[a-z0-9]([-a-z0-9]*[a-z0-9])?$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "fleetName": _SERIALIZER.url( + "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" + ), + "fleetMemberName": _SERIALIZER.url( + "fleet_member_name", + fleet_member_name, + "str", + max_length=50, + min_length=1, + pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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["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') + _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') + _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, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - subscription_id: str, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - **kwargs: Any + resource_group_name: str, fleet_name: str, fleet_member_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/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), - "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])?$'), - "fleetMemberName": _SERIALIZER.url("fleet_member_name", fleet_member_name, 'str', max_length=50, min_length=1, pattern=r'^[a-z0-9]([-a-z0-9]*[a-z0-9])?$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "fleetName": _SERIALIZER.url( + "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" + ), + "fleetMemberName": _SERIALIZER.url( + "fleet_member_name", + fleet_member_name, + "str", + max_length=50, + min_length=1, + pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request_initial( - subscription_id: str, +def build_delete_request( resource_group_name: str, fleet_name: str, fleet_member_name: str, + subscription_id: str, *, if_match: Optional[str] = None, **kwargs: Any @@ -133,72 +149,79 @@ def build_delete_request_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/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), - "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])?$'), - "fleetMemberName": _SERIALIZER.url("fleet_member_name", fleet_member_name, 'str', max_length=50, min_length=1, pattern=r'^[a-z0-9]([-a-z0-9]*[a-z0-9])?$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "fleetName": _SERIALIZER.url( + "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" + ), + "fleetMemberName": _SERIALIZER.url( + "fleet_member_name", + fleet_member_name, + "str", + max_length=50, + min_length=1, + pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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') + _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 - ) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_list_by_fleet_request( - subscription_id: str, - resource_group_name: str, - fleet_name: str, - **kwargs: Any + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/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), - "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])?$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "fleetName": _SERIALIZER.url( + "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class FleetMembersOperations: """ @@ -219,42 +242,46 @@ def __init__(self, *args, **kwargs): 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 _create_or_update_initial( self, resource_group_name: str, fleet_name: str, fleet_member_name: str, - parameters: _models.FleetMember, + parameters: Union[_models.FleetMember, IO], if_match: Optional[str] = None, if_none_match: Optional[str] = None, **kwargs: Any ) -> _models.FleetMember: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.FleetMember] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.FleetMember] - _json = self._serialize.body(parameters, 'FleetMember') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "FleetMember") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, fleet_name=fleet_name, fleet_member_name=fleet_member_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, - if_match=if_match, - if_none_match=if_none_match, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -262,31 +289,30 @@ def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('FleetMember', pipeline_response) + deserialized = self._deserialize("FleetMember", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('FleetMember', pipeline_response) + deserialized = self._deserialize("FleetMember", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}"} # type: ignore - + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}"} # type: ignore - @distributed_trace + @overload def begin_create_or_update( self, resource_group_name: str, @@ -295,6 +321,8 @@ def begin_create_or_update( parameters: _models.FleetMember, if_match: Optional[str] = None, if_none_match: Optional[str] = None, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.FleetMember]: """Creates or updates a fleet member. @@ -303,12 +331,13 @@ def begin_create_or_update( referenced cluster join the 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. + :param fleet_name: The name of the Fleet resource. Required. :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. + :param fleet_member_name: The name of the Fleet member resource. Required. :type fleet_member_name: str - :param parameters: The Fleet member to create or update. + :param parameters: The Fleet member to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_06_02_preview.models.FleetMember :param if_match: Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is @@ -318,6 +347,62 @@ def begin_create_or_update( existing resource. Other values will result in a 412 Pre-condition Failed response. 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either FleetMember or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_06_02_preview.models.FleetMember] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + fleet_name: str, + fleet_member_name: str, + parameters: IO, + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.FleetMember]: + """Creates or updates a fleet member. + + A member contains a reference to an existing Kubernetes cluster. Creating a member makes the + referenced cluster join the 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 + :param fleet_member_name: The name of the Fleet member resource. Required. + :type fleet_member_name: str + :param parameters: The Fleet member to create or update. Required. + :type parameters: IO + :param if_match: Omit this value to always overwrite the current resource. Specify the + last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is + None. + :type if_match: str + :param if_none_match: Set to '*' to allow a new resource to be created and prevent updating an + existing resource. Other values will result in a 412 Pre-condition Failed response. 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 :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -330,20 +415,69 @@ def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_06_02_preview.models.FleetMember] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + fleet_name: str, + fleet_member_name: str, + parameters: Union[_models.FleetMember, IO], + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + **kwargs: Any + ) -> LROPoller[_models.FleetMember]: + """Creates or updates a fleet member. + + A member contains a reference to an existing Kubernetes cluster. Creating a member makes the + referenced cluster join the 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 + :param fleet_member_name: The name of the Fleet member resource. Required. + :type fleet_member_name: str + :param parameters: The Fleet member to create or update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.mgmt.containerservice.v2022_06_02_preview.models.FleetMember or IO + :param if_match: Omit this value to always overwrite the current resource. Specify the + last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is + None. + :type if_match: str + :param if_none_match: Set to '*' to allow a new resource to be created and prevent updating an + existing resource. Other values will result in a 412 Pre-condition Failed response. Default + value is None. + :type if_none_match: str + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either FleetMember or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_06_02_preview.models.FleetMember] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.FleetMember] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.FleetMember] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -354,82 +488,72 @@ def begin_create_or_update( if_none_match=if_none_match, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('FleetMember', pipeline_response) + deserialized = self._deserialize("FleetMember", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}"} # type: ignore @distributed_trace def get( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - **kwargs: Any + self, resource_group_name: str, fleet_name: str, fleet_member_name: str, **kwargs: Any ) -> _models.FleetMember: """Gets a Fleet member. Gets a Fleet member. :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. + :param fleet_name: The name of the Fleet resource. Required. :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. + :param fleet_member_name: The name of the Fleet member resource. Required. :type fleet_member_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: FleetMember, or the result of cls(response) + :return: FleetMember or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.FleetMember - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.FleetMember] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.FleetMember] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, fleet_name=fleet_name, fleet_member_name=fleet_member_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -437,10 +561,9 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -448,15 +571,14 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('FleetMember', pipeline_response) + deserialized = self._deserialize("FleetMember", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements self, @@ -466,26 +588,23 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if_match: Optional[str] = None, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, fleet_name=fleet_name, fleet_member_name=fleet_member_name, - api_version=api_version, + subscription_id=self._config.subscription_id, if_match=if_match, - template_url=self._delete_initial.metadata['url'], + api_version=api_version, + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -493,24 +612,23 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements + def begin_delete( self, resource_group_name: str, fleet_name: str, @@ -524,10 +642,11 @@ def begin_delete( # pylint: disable=inconsistent-return-statements is deleted upon success. The underlying cluster is not deleted. :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. + :param fleet_name: The name of the Fleet resource. Required. :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. + :param fleet_member_name: The name of the Fleet member resource. Required. :type fleet_member_name: str :param if_match: Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is @@ -543,19 +662,16 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -563,79 +679,73 @@ def begin_delete( # pylint: disable=inconsistent-return-statements fleet_member_name=fleet_member_name, if_match=if_match, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - lro_options={'final-state-via': 'location'}, - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}"} # type: ignore @distributed_trace def list_by_fleet( - self, - resource_group_name: str, - fleet_name: str, - **kwargs: Any - ) -> Iterable[_models.FleetMembersListResult]: + self, resource_group_name: str, fleet_name: str, **kwargs: Any + ) -> Iterable["_models.FleetMember"]: """Lists the members of a fleet. Lists the members of a 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. + :param fleet_name: The name of the Fleet resource. Required. :type fleet_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either FleetMembersListResult or the result of - cls(response) + :return: An iterator like instance of either FleetMember or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_06_02_preview.models.FleetMembersListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_06_02_preview.models.FleetMember] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.FleetMembersListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.FleetMembersListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_fleet_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, fleet_name=fleet_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_fleet.metadata['url'], + template_url=self.list_by_fleet.metadata["url"], headers=_headers, params=_params, ) @@ -643,16 +753,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_fleet_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - fleet_name=fleet_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -668,10 +773,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -682,8 +785,6 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_fleet.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members"} # type: ignore + list_by_fleet.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_fleets_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_fleets_operations.py index 604ebd73e134..49242feee757 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_fleets_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_fleets_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,20 +27,21 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_create_or_update_request_initial( - subscription_id: str, + +def build_create_or_update_request( resource_group_name: str, fleet_name: str, + subscription_id: str, *, - json: Optional[_models.Fleet] = None, - content: Any = None, if_match: Optional[str] = None, if_none_match: Optional[str] = None, **kwargs: Any @@ -43,272 +49,240 @@ def build_create_or_update_request_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/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), - "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])?$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "fleetName": _SERIALIZER.url( + "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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["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') + _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') + _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, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_update_request( - subscription_id: str, - resource_group_name: str, - fleet_name: str, - *, - json: Optional[_models.FleetPatch] = None, - content: Any = None, - if_match: Optional[str] = None, - **kwargs: Any + resource_group_name: str, fleet_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/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), - "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])?$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "fleetName": _SERIALIZER.url( + "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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["If-Match"] = _SERIALIZER.header("if_match", if_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') + _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, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_request( - subscription_id: str, - resource_group_name: str, - fleet_name: str, - **kwargs: Any -) -> HttpRequest: +def build_get_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/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), - "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])?$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "fleetName": _SERIALIZER.url( + "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - fleet_name: str, - *, - if_match: Optional[str] = None, - **kwargs: Any +def build_delete_request( + resource_group_name: str, fleet_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/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), - "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])?$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "fleetName": _SERIALIZER.url( + "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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') + _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 - ) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_resource_group_request( - subscription_id: str, - resource_group_name: str, - **kwargs: Any -) -> HttpRequest: +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/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), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: +def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + 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", min_length=1), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_list_credentials_request( - subscription_id: str, - resource_group_name: str, - fleet_name: str, - **kwargs: Any + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/listCredentials") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/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), - "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])?$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "fleetName": _SERIALIZER.url( + "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class FleetsOperations: """ @@ -329,40 +303,44 @@ def __init__(self, *args, **kwargs): 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 _create_or_update_initial( self, resource_group_name: str, fleet_name: str, - parameters: _models.Fleet, + parameters: Union[_models.Fleet, IO], if_match: Optional[str] = None, if_none_match: Optional[str] = None, **kwargs: Any ) -> _models.Fleet: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.Fleet] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Fleet] - _json = self._serialize.body(parameters, 'Fleet') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "Fleet") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, fleet_name=fleet_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, - if_match=if_match, - if_none_match=if_none_match, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -370,31 +348,30 @@ def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('Fleet', pipeline_response) + deserialized = self._deserialize("Fleet", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('Fleet', pipeline_response) + deserialized = self._deserialize("Fleet", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}"} # type: ignore + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}"} # type: ignore - - @distributed_trace + @overload def begin_create_or_update( self, resource_group_name: str, @@ -402,6 +379,8 @@ def begin_create_or_update( parameters: _models.Fleet, if_match: Optional[str] = None, if_none_match: Optional[str] = None, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.Fleet]: """Creates or updates a Fleet. @@ -409,10 +388,11 @@ def begin_create_or_update( Creates or updates a 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. + :param fleet_name: The name of the Fleet resource. Required. :type fleet_name: str - :param parameters: The Fleet to create or update. + :param parameters: The Fleet to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_06_02_preview.models.Fleet :param if_match: Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is @@ -422,6 +402,104 @@ def begin_create_or_update( existing resource. Other values will result in a 412 Pre-condition Failed response. 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either Fleet or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_06_02_preview.models.Fleet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + fleet_name: str, + parameters: IO, + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Fleet]: + """Creates or updates a Fleet. + + Creates or updates a 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 + :param parameters: The Fleet to create or update. Required. + :type parameters: IO + :param if_match: Omit this value to always overwrite the current resource. Specify the + last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is + None. + :type if_match: str + :param if_none_match: Set to '*' to allow a new resource to be created and prevent updating an + existing resource. Other values will result in a 412 Pre-condition Failed response. 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either Fleet or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_06_02_preview.models.Fleet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + fleet_name: str, + parameters: Union[_models.Fleet, IO], + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + **kwargs: Any + ) -> LROPoller[_models.Fleet]: + """Creates or updates a Fleet. + + Creates or updates a 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 + :param parameters: The Fleet to create or update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.mgmt.containerservice.v2022_06_02_preview.models.Fleet or IO + :param if_match: Omit this value to always overwrite the current resource. Specify the + last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is + None. + :type if_match: str + :param if_none_match: Set to '*' to allow a new resource to be created and prevent updating an + existing resource. Other values will result in a 412 Pre-condition Failed response. Default + value is None. + :type if_none_match: str + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -433,20 +511,17 @@ def begin_create_or_update( :return: An instance of LROPoller that returns either Fleet or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_06_02_preview.models.Fleet] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.Fleet] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Fleet] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, @@ -456,47 +531,45 @@ def begin_create_or_update( if_none_match=if_none_match, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('Fleet', pipeline_response) + deserialized = self._deserialize("Fleet", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}"} # type: ignore - @distributed_trace + @overload def update( self, resource_group_name: str, fleet_name: str, if_match: Optional[str] = None, parameters: Optional[_models.FleetPatch] = None, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.Fleet: """Patches a fleet resource. @@ -504,8 +577,9 @@ def update( Patches a fleet resource. :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. + :param fleet_name: The name of the Fleet resource. Required. :type fleet_name: str :param if_match: Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is @@ -513,37 +587,114 @@ def update( :type if_match: str :param parameters: The properties of a Fleet to update. Default value is None. :type parameters: ~azure.mgmt.containerservice.v2022_06_02_preview.models.FleetPatch + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Fleet or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.Fleet + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + fleet_name: str, + if_match: Optional[str] = None, + parameters: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Fleet: + """Patches a fleet resource. + + Patches a fleet resource. + + :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 if_match: Omit this value to always overwrite the current resource. Specify the + last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is + None. + :type if_match: str + :param parameters: The properties of a Fleet to update. Default value is None. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Fleet or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.Fleet + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + fleet_name: str, + if_match: Optional[str] = None, + parameters: Optional[Union[_models.FleetPatch, IO]] = None, + **kwargs: Any + ) -> _models.Fleet: + """Patches a fleet resource. + + Patches a fleet resource. + + :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 if_match: Omit this value to always overwrite the current resource. Specify the + last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is + None. + :type if_match: str + :param parameters: The properties of a Fleet to update. Is either a model type or a IO type. + Default value is None. + :type parameters: ~azure.mgmt.containerservice.v2022_06_02_preview.models.FleetPatch or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Fleet, or the result of cls(response) + :return: Fleet or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.Fleet - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.Fleet] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Fleet] - if parameters is not None: - _json = self._serialize.body(parameters, 'FleetPatch') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters else: - _json = None + if parameters is not None: + _json = self._serialize.body(parameters, "FleetPatch") + else: + _json = None request = build_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, fleet_name=fleet_name, + subscription_id=self._config.subscription_id, + if_match=if_match, api_version=api_version, content_type=content_type, json=_json, - if_match=if_match, - template_url=self.update.metadata['url'], + content=_content, + template_url=self.update.metadata["url"], headers=_headers, params=_params, ) @@ -551,10 +702,9 @@ def update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -562,54 +712,46 @@ def update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Fleet', pipeline_response) + deserialized = self._deserialize("Fleet", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}"} # type: ignore - + update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}"} # type: ignore @distributed_trace - def get( - self, - resource_group_name: str, - fleet_name: str, - **kwargs: Any - ) -> _models.Fleet: + def get(self, resource_group_name: str, fleet_name: str, **kwargs: Any) -> _models.Fleet: """Gets a Fleet. Gets a 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. + :param fleet_name: The name of the Fleet resource. Required. :type fleet_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Fleet, or the result of cls(response) + :return: Fleet or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.Fleet - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.Fleet] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.Fleet] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, fleet_name=fleet_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -617,10 +759,9 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -628,42 +769,34 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Fleet', pipeline_response) + deserialized = self._deserialize("Fleet", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - fleet_name: str, - if_match: Optional[str] = None, - **kwargs: Any + self, resource_group_name: str, fleet_name: str, if_match: Optional[str] = None, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, fleet_name=fleet_name, - api_version=api_version, + subscription_id=self._config.subscription_id, if_match=if_match, - template_url=self._delete_initial.metadata['url'], + api_version=api_version, + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -671,37 +804,33 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - fleet_name: str, - if_match: Optional[str] = None, - **kwargs: Any + def begin_delete( + self, resource_group_name: str, fleet_name: str, if_match: Optional[str] = None, **kwargs: Any ) -> LROPoller[None]: """Deletes a Fleet. Deletes a 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. + :param fleet_name: The name of the Fleet resource. Required. :type fleet_name: str :param if_match: Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is @@ -717,93 +846,84 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, fleet_name=fleet_name, if_match=if_match, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - lro_options={'final-state-via': 'location'}, - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}"} # type: ignore @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> Iterable[_models.FleetListResult]: + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Fleet"]: """Lists fleets in the specified subscription and resource group. Lists fleets in the specified subscription and resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either FleetListResult or the result of cls(response) + :return: An iterator like instance of either Fleet or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_06_02_preview.models.FleetListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_06_02_preview.models.Fleet] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.FleetListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.FleetListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -811,15 +931,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -835,10 +951,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -849,44 +963,38 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets"} # type: ignore @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.FleetListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.Fleet"]: """Lists fleets in the specified subscription. Lists fleets in the specified subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either FleetListResult or the result of cls(response) + :return: An iterator like instance of either Fleet or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_06_02_preview.models.FleetListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_06_02_preview.models.Fleet] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.FleetListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.FleetListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -894,14 +1002,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -917,10 +1022,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -931,50 +1034,43 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/fleets"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/fleets"} # type: ignore @distributed_trace def list_credentials( - self, - resource_group_name: str, - fleet_name: str, - **kwargs: Any + self, resource_group_name: str, fleet_name: str, **kwargs: Any ) -> _models.FleetCredentialResults: """Lists the user credentials of a Fleet. Lists the user credentials of a 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. + :param fleet_name: The name of the Fleet resource. Required. :type fleet_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: FleetCredentialResults, or the result of cls(response) + :return: FleetCredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.FleetCredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.FleetCredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.FleetCredentialResults] - request = build_list_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, fleet_name=fleet_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_credentials.metadata['url'], + template_url=self.list_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -982,10 +1078,9 @@ def list_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -993,12 +1088,11 @@ def list_credentials( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('FleetCredentialResults', pipeline_response) + deserialized = self._deserialize("FleetCredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/listCredentials"} # type: ignore - + list_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/listCredentials"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_maintenance_configurations_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_maintenance_configurations_operations.py index 20b258720ca5..bbae55243ace 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_maintenance_configurations_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_maintenance_configurations_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,173 +25,181 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +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_managed_cluster_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, config_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "configName": _SERIALIZER.url("config_name", config_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "configName": _SERIALIZER.url("config_name", config_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - config_name: str, - *, - json: Optional[_models.MaintenanceConfiguration] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, resource_name: str, config_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "configName": _SERIALIZER.url("config_name", config_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "configName": _SERIALIZER.url("config_name", config_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, config_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "configName": _SERIALIZER.url("config_name", config_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "configName": _SERIALIZER.url("config_name", config_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class MaintenanceConfigurationsOperations: """ @@ -207,48 +220,44 @@ def __init__(self, *args, **kwargs): 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_managed_cluster( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> Iterable[_models.MaintenanceConfigurationListResult]: + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> Iterable["_models.MaintenanceConfiguration"]: """Gets a list of maintenance configurations in the specified managed cluster. Gets a list of maintenance configurations in the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either MaintenanceConfigurationListResult or the result - of cls(response) + :return: An iterator like instance of either MaintenanceConfiguration or the result of + cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_06_02_preview.models.MaintenanceConfigurationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_06_02_preview.models.MaintenanceConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfigurationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfigurationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_managed_cluster_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_managed_cluster.metadata['url'], + template_url=self.list_by_managed_cluster.metadata["url"], headers=_headers, params=_params, ) @@ -256,16 +265,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_managed_cluster_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -281,10 +285,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -294,54 +296,46 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_managed_cluster.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations"} # type: ignore + list_by_managed_cluster.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations"} # type: ignore @distributed_trace def get( - self, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, config_name: str, **kwargs: Any ) -> _models.MaintenanceConfiguration: """Gets the specified maintenance configuration of a managed cluster. Gets the specified maintenance configuration of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: MaintenanceConfiguration, or the result of cls(response) + :return: MaintenanceConfiguration or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.MaintenanceConfiguration - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfiguration] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -349,33 +343,33 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) + deserialized = self._deserialize("MaintenanceConfiguration", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - - @distributed_trace + @overload def create_or_update( self, resource_group_name: str, resource_name: str, config_name: str, parameters: _models.MaintenanceConfiguration, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.MaintenanceConfiguration: """Creates or updates a maintenance configuration in the specified managed cluster. @@ -383,42 +377,117 @@ def create_or_update( Creates or updates a maintenance configuration in the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str - :param parameters: The maintenance configuration to create or update. + :param parameters: The maintenance configuration to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_06_02_preview.models.MaintenanceConfiguration + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configuration in the specified managed cluster. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: The maintenance configuration to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: MaintenanceConfiguration, or the result of cls(response) + :return: MaintenanceConfiguration or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.MaintenanceConfiguration - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: Union[_models.MaintenanceConfiguration, IO], + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configuration in the specified managed cluster. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: The maintenance configuration to create or update. Is either a model type or + a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.MaintenanceConfiguration or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfiguration] - _json = self._serialize.body(parameters, 'MaintenanceConfiguration') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "MaintenanceConfiguration") request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) @@ -426,68 +495,60 @@ def create_or_update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) + deserialized = self._deserialize("MaintenanceConfiguration", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore @distributed_trace def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - config_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, config_name: str, **kwargs: Any ) -> None: """Deletes a maintenance configuration. Deletes a maintenance configuration. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param config_name: The name of the maintenance configuration. + :param config_name: The name of the maintenance configuration. Required. :type config_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, config_name=config_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) @@ -495,10 +556,9 @@ def delete( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -508,5 +568,4 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore - + delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_managed_cluster_snapshots_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_managed_cluster_snapshots_operations.py index ea57e68973d1..f1575dd7c1a0 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_managed_cluster_snapshots_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_managed_cluster_snapshots_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,243 +25,235 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedclustersnapshots") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedclustersnapshots" + ) # 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", min_length=1), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_resource_group_request( - subscription_id: str, - resource_group_name: str, - **kwargs: Any -) -> HttpRequest: +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: + _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, resource_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedClusterSnapshot] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_update_tags_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.TagsObject] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class ManagedClusterSnapshotsOperations: """ @@ -277,40 +274,35 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.ManagedClusterSnapshotListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.ManagedClusterSnapshot"]: """Gets a list of managed cluster snapshots in the specified subscription. Gets a list of managed cluster snapshots in the specified subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterSnapshotListResult or the result of + :return: An iterator like instance of either ManagedClusterSnapshot or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterSnapshotListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterSnapshot] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshotListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterSnapshotListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -318,14 +310,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -341,10 +330,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -354,49 +341,45 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedclustersnapshots"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedclustersnapshots"} # type: ignore @distributed_trace def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> Iterable[_models.ManagedClusterSnapshotListResult]: + self, resource_group_name: str, **kwargs: Any + ) -> Iterable["_models.ManagedClusterSnapshot"]: """Lists managed cluster snapshots in the specified subscription and resource group. Lists managed cluster snapshots in the specified subscription and resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterSnapshotListResult or the result of + :return: An iterator like instance of either ManagedClusterSnapshot or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterSnapshotListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterSnapshot] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshotListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterSnapshotListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -404,15 +387,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -428,10 +407,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -441,50 +418,41 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots"} # type: ignore @distributed_trace - def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.ManagedClusterSnapshot: + def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.ManagedClusterSnapshot: """Gets a managed cluster snapshot. Gets a managed cluster snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterSnapshot, or the result of cls(response) + :return: ManagedClusterSnapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterSnapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterSnapshot] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -492,32 +460,32 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterSnapshot', pipeline_response) + deserialized = self._deserialize("ManagedClusterSnapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"} # type: ignore - @distributed_trace + @overload def create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterSnapshot, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.ManagedClusterSnapshot: """Creates or updates a managed cluster snapshot. @@ -525,39 +493,108 @@ def create_or_update( Creates or updates a managed cluster snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The managed cluster snapshot to create or update. + :param parameters: The managed cluster snapshot to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterSnapshot + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedClusterSnapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterSnapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ManagedClusterSnapshot: + """Creates or updates a managed cluster snapshot. + + Creates or updates a managed cluster snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster snapshot to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedClusterSnapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterSnapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterSnapshot, IO], + **kwargs: Any + ) -> _models.ManagedClusterSnapshot: + """Creates or updates a managed cluster snapshot. + + Creates or updates a managed cluster snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster snapshot to create or update. Is either a model type or + a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterSnapshot or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterSnapshot, or the result of cls(response) + :return: ManagedClusterSnapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterSnapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterSnapshot] - _json = self._serialize.body(parameters, 'ManagedClusterSnapshot') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterSnapshot") request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) @@ -565,10 +602,9 @@ def create_or_update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -576,25 +612,26 @@ def create_or_update( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ManagedClusterSnapshot', pipeline_response) + deserialized = self._deserialize("ManagedClusterSnapshot", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('ManagedClusterSnapshot', pipeline_response) + deserialized = self._deserialize("ManagedClusterSnapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"} # type: ignore + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"} # type: ignore - - @distributed_trace + @overload def update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.ManagedClusterSnapshot: """Updates tags on a managed cluster snapshot. @@ -602,38 +639,104 @@ def update_tags( Updates tags on a managed cluster snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param parameters: Parameters supplied to the Update managed cluster snapshot Tags operation. + Required. :type parameters: ~azure.mgmt.containerservice.v2022_06_02_preview.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterSnapshot, or the result of cls(response) + :return: ManagedClusterSnapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterSnapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + def update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ManagedClusterSnapshot: + """Updates tags on a managed cluster snapshot. + + Updates tags on a managed cluster snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update managed cluster snapshot Tags operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedClusterSnapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterSnapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> _models.ManagedClusterSnapshot: + """Updates tags on a managed cluster snapshot. + + Updates tags on a managed cluster snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update managed cluster snapshot Tags operation. + Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_06_02_preview.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedClusterSnapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterSnapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterSnapshot] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") request = build_update_tags_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_tags.metadata['url'], + content=_content, + template_url=self.update_tags.metadata["url"], headers=_headers, params=_params, ) @@ -641,64 +744,57 @@ def update_tags( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterSnapshot', pipeline_response) + deserialized = self._deserialize("ManagedClusterSnapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"} # type: ignore - + update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"} # type: ignore @distributed_trace def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: """Deletes a managed cluster snapshot. Deletes a managed cluster snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) @@ -706,10 +802,9 @@ def delete( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -719,5 +814,4 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"} # type: ignore - + delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_managed_clusters_operations.py index 93aea8423789..cb91e6ffeeb8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_managed_clusters_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -22,200 +27,189 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_get_os_options_request( - subscription_id: str, - location: str, - *, - resource_type: Optional[str] = None, - **kwargs: Any + location: str, subscription_id: str, *, resource_type: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "location": _SERIALIZER.url("location", location, 'str', min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "location": _SERIALIZER.url("location", location, "str", min_length=1), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if resource_type is not None: - _params['resource-type'] = _SERIALIZER.query("resource_type", resource_type, 'str') + _params["resource-type"] = _SERIALIZER.query("resource_type", resource_type, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters") + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters" + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_resource_group_request( - subscription_id: str, - resource_group_name: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_upgrade_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_access_profile_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, role_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "roleName": _SERIALIZER.url("role_name", role_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "roleName": _SERIALIZER.url("role_name", role_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_admin_credentials_request( - subscription_id: str, resource_group_name: str, resource_name: str, + subscription_id: str, *, server_fqdn: Optional[str] = None, **kwargs: Any @@ -223,40 +217,46 @@ def build_list_cluster_admin_credentials_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if server_fqdn is not None: - _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + _params["server-fqdn"] = _SERIALIZER.query("server_fqdn", server_fqdn, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_user_credentials_request( - subscription_id: str, resource_group_name: str, resource_name: str, + subscription_id: str, *, server_fqdn: Optional[str] = None, format: Optional[Union[str, "_models.Format"]] = None, @@ -265,42 +265,48 @@ def build_list_cluster_user_credentials_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if server_fqdn is not None: - _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + _params["server-fqdn"] = _SERIALIZER.query("server_fqdn", server_fqdn, "str") if format is not None: - _params['format'] = _SERIALIZER.query("format", format, 'str') + _params["format"] = _SERIALIZER.query("format", format, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_cluster_monitoring_user_credentials_request( - subscription_id: str, resource_group_name: str, resource_name: str, + subscription_id: str, *, server_fqdn: Optional[str] = None, **kwargs: Any @@ -308,167 +314,170 @@ def build_list_cluster_monitoring_user_credentials_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if server_fqdn is not None: - _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + _params["server-fqdn"] = _SERIALIZER.query("server_fqdn", server_fqdn, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: + +def build_get_request(resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedCluster] = None, - content: Any = None, - **kwargs: Any + +def build_create_or_update_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_update_tags_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.TagsObject] = None, - content: Any = None, - **kwargs: Any + +def build_update_tags_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request_initial( - subscription_id: str, + +def build_delete_request( resource_group_name: str, resource_name: str, + subscription_id: str, *, ignore_pod_disruption_budget: Optional[bool] = None, **kwargs: Any @@ -476,393 +485,413 @@ def build_delete_request_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if ignore_pod_disruption_budget is not None: - _params['ignore-pod-disruption-budget'] = _SERIALIZER.query("ignore_pod_disruption_budget", ignore_pod_disruption_budget, 'bool') + _params["ignore-pod-disruption-budget"] = _SERIALIZER.query( + "ignore_pod_disruption_budget", ignore_pod_disruption_budget, "bool" + ) # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_reset_service_principal_profile_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedClusterServicePrincipalProfile] = None, - content: Any = None, - **kwargs: Any + +def build_reset_service_principal_profile_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_reset_aad_profile_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.ManagedClusterAADProfile] = None, - content: Any = None, - **kwargs: Any + +def build_reset_aad_profile_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_rotate_cluster_certificates_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + +def build_rotate_cluster_certificates_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_rotate_service_account_signing_keys_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + +def build_rotate_service_account_signing_keys_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateServiceAccountSigningKeys") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateServiceAccountSigningKeys", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_stop_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + +def build_stop_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_start_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + +def build_start_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_run_command_request_initial( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.RunCommandRequest] = None, - content: Any = None, - **kwargs: Any + +def build_run_command_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_get_command_result_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - command_id: str, - **kwargs: Any + resource_group_name: str, resource_name: str, command_id: 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "commandId": _SERIALIZER.url("command_id", command_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "commandId": _SERIALIZER.url("command_id", command_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_list_outbound_network_dependencies_endpoints_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + class ManagedClustersOperations: # pylint: disable=too-many-public-methods """ @@ -883,46 +912,39 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def get_os_options( - self, - location: str, - resource_type: Optional[str] = None, - **kwargs: Any + self, location: str, resource_type: Optional[str] = None, **kwargs: Any ) -> _models.OSOptionProfile: """Gets supported OS options in the specified subscription. Gets supported OS options in the specified subscription. - :param location: The name of Azure region. + :param location: The name of Azure region. Required. :type location: str :param resource_type: The resource type for which the OS options needs to be returned. Default value is None. :type resource_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: OSOptionProfile, or the result of cls(response) + :return: OSOptionProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.OSOptionProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OSOptionProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OSOptionProfile] - request = build_get_os_options_request( - subscription_id=self._config.subscription_id, location=location, - api_version=api_version, + subscription_id=self._config.subscription_id, resource_type=resource_type, - template_url=self.get_os_options.metadata['url'], + api_version=api_version, + template_url=self.get_os_options.metadata["url"], headers=_headers, params=_params, ) @@ -930,59 +952,52 @@ def get_os_options( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('OSOptionProfile', pipeline_response) + deserialized = self._deserialize("OSOptionProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_os_options.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default"} # type: ignore - + get_os_options.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default"} # type: ignore @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.ManagedClusterListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.ManagedCluster"]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -990,14 +1005,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -1013,10 +1025,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1026,49 +1036,42 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> Iterable[_models.ManagedClusterListResult]: + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.ManagedCluster"]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of - cls(response) + :return: An iterator like instance of either ManagedCluster or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -1076,15 +1079,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -1100,10 +1099,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1113,50 +1110,43 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore @distributed_trace def get_upgrade_profile( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.ManagedClusterUpgradeProfile: """Gets the upgrade profile of a managed cluster. Gets the upgrade profile of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterUpgradeProfile, or the result of cls(response) + :return: ManagedClusterUpgradeProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterUpgradeProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterUpgradeProfile] - request = build_get_upgrade_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_upgrade_profile.metadata['url'], + template_url=self.get_upgrade_profile.metadata["url"], headers=_headers, params=_params, ) @@ -1164,33 +1154,27 @@ def get_upgrade_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterUpgradeProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterUpgradeProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore - + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore @distributed_trace def get_access_profile( - self, - resource_group_name: str, - resource_name: str, - role_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, role_name: str, **kwargs: Any ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. @@ -1200,35 +1184,33 @@ def get_access_profile( `_ . :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param role_name: The name of the role for managed cluster accessProfile resource. + :param role_name: The name of the role for managed cluster accessProfile resource. Required. :type role_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedClusterAccessProfile, or the result of cls(response) + :return: ManagedClusterAccessProfile or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterAccessProfile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterAccessProfile] - request = build_get_access_profile_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, role_name=role_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_access_profile.metadata['url'], + template_url=self.get_access_profile.metadata["url"], headers=_headers, params=_params, ) @@ -1236,68 +1218,60 @@ def get_access_profile( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedClusterAccessProfile', pipeline_response) + deserialized = self._deserialize("ManagedClusterAccessProfile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_access_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore - + get_access_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore @distributed_trace def list_cluster_admin_credentials( - self, - resource_group_name: str, - resource_name: str, - server_fqdn: Optional[str] = None, - **kwargs: Any + self, resource_group_name: str, resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any ) -> _models.CredentialResults: """Lists the admin credentials of a managed cluster. Lists the admin credentials of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_admin_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, - template_url=self.list_cluster_admin_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_admin_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -1305,25 +1279,23 @@ def list_cluster_admin_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_admin_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore - + list_cluster_admin_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore @distributed_trace def list_cluster_user_credentials( @@ -1339,40 +1311,39 @@ def list_cluster_user_credentials( Lists the user credentials of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :param format: Only apply to AAD clusters, specifies the format of returned kubeconfig. Format 'azure' will return azure auth-provider kubeconfig; format 'exec' will return exec format - kubeconfig, which requires kubelogin binary in the path. Default value is None. + kubeconfig, which requires kubelogin binary in the path. Known values are: "azure" and "exec". + Default value is None. :type format: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.Format :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, format=format, - template_url=self.list_cluster_user_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -1380,68 +1351,60 @@ def list_cluster_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore - + list_cluster_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore @distributed_trace def list_cluster_monitoring_user_credentials( - self, - resource_group_name: str, - resource_name: str, - server_fqdn: Optional[str] = None, - **kwargs: Any + self, resource_group_name: str, resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any ) -> _models.CredentialResults: """Lists the cluster monitoring user credentials of a managed cluster. Lists the cluster monitoring user credentials of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. :type server_fqdn: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CredentialResults, or the result of cls(response) + :return: CredentialResults or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.CredentialResults - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] - request = build_list_cluster_monitoring_user_credentials_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, server_fqdn=server_fqdn, - template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + api_version=api_version, + template_url=self.list_cluster_monitoring_user_credentials.metadata["url"], headers=_headers, params=_params, ) @@ -1449,64 +1412,55 @@ def list_cluster_monitoring_user_credentials( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('CredentialResults', pipeline_response) + deserialized = self._deserialize("CredentialResults", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_cluster_monitoring_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore - + list_cluster_monitoring_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore @distributed_trace - def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.ManagedCluster: + def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.ManagedCluster: """Gets a managed cluster. Gets a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ManagedCluster, or the result of cls(response) + :return: ManagedCluster or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedCluster - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -1514,55 +1468,54 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _create_or_update_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.ManagedCluster, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'ManagedCluster') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedCluster") - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + request = build_create_or_update_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1570,10 +1523,9 @@ def _create_or_update_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -1581,25 +1533,26 @@ def _create_or_update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - @distributed_trace + @overload def begin_create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedCluster, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. @@ -1607,11 +1560,15 @@ def begin_create_or_update( Creates or updates a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The managed cluster to create or update. + :param parameters: The managed cluster to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedCluster + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1624,90 +1581,157 @@ def begin_create_or_update( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._create_or_update_initial( # type: ignore - resource_group_name=resource_group_name, - resource_name=resource_name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop('error_map', None) + @overload + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. - def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized + Creates or updates a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + @distributed_trace + def begin_create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - + Creates or updates a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster to create or update. Is either a model type or a IO + type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedCluster or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ManagedCluster", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _update_tags_initial( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.TagsObject, - **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any ) -> _models.ManagedCluster: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request_initial( - subscription_id=self._config.subscription_id, + request = build_update_tags_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_tags_initial.metadata['url'], + content=_content, + template_url=self._update_tags_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1715,32 +1739,32 @@ def _update_tags_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_tags_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + _update_tags_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - - @distributed_trace + @overload def begin_update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. @@ -1748,11 +1772,88 @@ def begin_update_tags( Updates tags on a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2022_06_02_preview.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates tags on a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates tags on a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_06_02_preview.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1765,20 +1866,17 @@ def begin_update_tags( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedCluster] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, @@ -1786,39 +1884,35 @@ def begin_update_tags( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ManagedCluster', pipeline_response) + deserialized = self._deserialize("ManagedCluster", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements self, @@ -1827,25 +1921,22 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements ignore_pod_disruption_budget: Optional[bool] = None, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, - api_version=api_version, + subscription_id=self._config.subscription_id, ignore_pod_disruption_budget=ignore_pod_disruption_budget, - template_url=self._delete_initial.metadata['url'], + api_version=api_version, + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1853,10 +1944,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1866,11 +1956,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements + def begin_delete( self, resource_group_name: str, resource_name: str, @@ -1882,8 +1971,9 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Deletes a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :param ignore_pod_disruption_budget: ignore-pod-disruption-budget=true to delete those pods on a node without considering Pod Disruption Budget. Default value is None. @@ -1898,86 +1988,84 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, ignore_pod_disruption_budget=ignore_pod_disruption_budget, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterServicePrincipalProfile, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterServicePrincipalProfile") - request = build_reset_service_principal_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_service_principal_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_service_principal_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_service_principal_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1985,10 +2073,9 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1998,15 +2085,89 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re if cls: return cls(pipeline_response, None, {}) - _reset_service_principal_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + _reset_service_principal_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + + @overload + def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.ManagedClusterServicePrincipalProfile, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reset the Service Principal Profile of a managed cluster. + + This action cannot be performed on a cluster that is not using a service principal. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The service principal profile to set on the managed cluster. Required. + :type parameters: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterServicePrincipalProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reset the Service Principal Profile of a managed cluster. + + This action cannot be performed on a cluster that is not using a service principal. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The service principal profile to set on the managed cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace - def begin_reset_service_principal_profile( # pylint: disable=inconsistent-return-statements + def begin_reset_service_principal_profile( self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterServicePrincipalProfile, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], **kwargs: Any ) -> LROPoller[None]: """Reset the Service Principal Profile of a managed cluster. @@ -2014,12 +2175,18 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur This action cannot be performed on a cluster that is not using a service principal. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The service principal profile to set on the managed cluster. + :param parameters: The service principal profile to set on the managed cluster. Is either a + model type or a IO type. Required. :type parameters: ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterServicePrincipalProfile + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -2030,20 +2197,17 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -2051,67 +2215,68 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_service_principal_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + begin_reset_service_principal_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: _models.ManagedClusterAADProfile, + parameters: Union[_models.ManagedClusterAADProfile, IO], **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterAADProfile") - request = build_reset_aad_profile_request_initial( - subscription_id=self._config.subscription_id, + request = build_reset_aad_profile_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._reset_aad_profile_initial.metadata['url'], + content=_content, + template_url=self._reset_aad_profile_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2119,10 +2284,9 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -2132,15 +2296,16 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement if cls: return cls(pipeline_response, None, {}) - _reset_aad_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - + _reset_aad_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore - @distributed_trace - def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements + @overload + def begin_reset_aad_profile( self, resource_group_name: str, resource_name: str, parameters: _models.ManagedClusterAADProfile, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: """Reset the AAD Profile of a managed cluster. @@ -2148,12 +2313,90 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements Reset the AAD Profile of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The AAD profile to set on the Managed Cluster. + :param parameters: The AAD profile to set on the Managed Cluster. Required. :type parameters: ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterAADProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reset the AAD Profile of a managed cluster. + + Reset the AAD Profile of a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The AAD profile to set on the Managed Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterAADProfile, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Reset the AAD Profile of a managed cluster. + + Reset the AAD Profile of a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The AAD profile to set on the Managed Cluster. Is either a model type or a + IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterAADProfile or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -2164,20 +2407,17 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, @@ -2185,62 +2425,52 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reset_aad_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + begin_reset_aad_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_rotate_cluster_certificates_request_initial( - subscription_id=self._config.subscription_id, + request = build_rotate_cluster_certificates_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._rotate_cluster_certificates_initial.metadata['url'], + template_url=self._rotate_cluster_certificates_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2248,10 +2478,9 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -2261,15 +2490,11 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return if cls: return cls(pipeline_response, None, {}) - _rotate_cluster_certificates_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore - + _rotate_cluster_certificates_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore @distributed_trace - def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + def begin_rotate_cluster_certificates( + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> LROPoller[None]: """Rotates the certificates of a managed cluster. @@ -2277,8 +2502,9 @@ def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-st more details about rotating managed cluster certificates. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -2290,80 +2516,67 @@ def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-st Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._rotate_cluster_certificates_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_rotate_cluster_certificates.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore + begin_rotate_cluster_certificates.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore def _rotate_service_account_signing_keys_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_rotate_service_account_signing_keys_request_initial( - subscription_id=self._config.subscription_id, + request = build_rotate_service_account_signing_keys_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._rotate_service_account_signing_keys_initial.metadata['url'], + template_url=self._rotate_service_account_signing_keys_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2371,10 +2584,9 @@ def _rotate_service_account_signing_keys_initial( # pylint: disable=inconsisten request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -2384,23 +2596,20 @@ def _rotate_service_account_signing_keys_initial( # pylint: disable=inconsisten if cls: return cls(pipeline_response, None, {}) - _rotate_service_account_signing_keys_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateServiceAccountSigningKeys"} # type: ignore - + _rotate_service_account_signing_keys_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateServiceAccountSigningKeys"} # type: ignore @distributed_trace - def begin_rotate_service_account_signing_keys( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + def begin_rotate_service_account_signing_keys( + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> LROPoller[None]: """Rotates the service account signing keys of a managed cluster. Rotates the service account signing keys of a managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -2412,80 +2621,67 @@ def begin_rotate_service_account_signing_keys( # pylint: disable=inconsistent-r Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._rotate_service_account_signing_keys_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_rotate_service_account_signing_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateServiceAccountSigningKeys"} # type: ignore + begin_rotate_service_account_signing_keys.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateServiceAccountSigningKeys"} # type: ignore def _stop_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_stop_request_initial( - subscription_id=self._config.subscription_id, + request = build_stop_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._stop_initial.metadata['url'], + template_url=self._stop_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2493,10 +2689,9 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -2506,16 +2701,10 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore - + _stop_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore @distributed_trace - def begin_stop( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> LROPoller[None]: + def begin_stop(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> LROPoller[None]: """Stops a Managed Cluster. This can only be performed on Azure Virtual Machine Scale set backed clusters. Stopping a @@ -2525,8 +2714,9 @@ def begin_stop( # pylint: disable=inconsistent-return-statements cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -2538,80 +2728,67 @@ def begin_stop( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._stop_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore + begin_stop.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore def _start_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_start_request_initial( - subscription_id=self._config.subscription_id, + request = build_start_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._start_initial.metadata['url'], + template_url=self._start_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2619,10 +2796,9 @@ def _start_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -2632,24 +2808,19 @@ def _start_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore - + _start_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore @distributed_trace - def begin_start( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> LROPoller[None]: + def begin_start(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> LROPoller[None]: """Starts a previously stopped Managed Cluster. See `starting a cluster `_ for more details about starting a cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -2661,85 +2832,83 @@ def begin_start( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._start_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore + begin_start.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore def _run_command_initial( self, resource_group_name: str, resource_name: str, - request_payload: _models.RunCommandRequest, + request_payload: Union[_models.RunCommandRequest, IO], **kwargs: Any ) -> Optional[_models.RunCommandResult]: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RunCommandResult]] - _json = self._serialize.body(request_payload, 'RunCommandRequest') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(request_payload, (IO, bytes)): + _content = request_payload + else: + _json = self._serialize.body(request_payload, "RunCommandRequest") - request = build_run_command_request_initial( - subscription_id=self._config.subscription_id, + request = build_run_command_request( resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._run_command_initial.metadata['url'], + content=_content, + template_url=self._run_command_initial.metadata["url"], headers=_headers, params=_params, ) @@ -2747,10 +2916,9 @@ def _run_command_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -2759,22 +2927,23 @@ def _run_command_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _run_command_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore - + _run_command_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore - @distributed_trace + @overload def begin_run_command( self, resource_group_name: str, resource_name: str, request_payload: _models.RunCommandRequest, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.RunCommandResult]: """Submits a command to run against the Managed Cluster. @@ -2784,12 +2953,97 @@ def begin_run_command( `_. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param request_payload: The run command request. + :param request_payload: The run command request. Required. :type request_payload: ~azure.mgmt.containerservice.v2022_06_02_preview.models.RunCommandRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either RunCommandResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_06_02_preview.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_run_command( + self, + resource_group_name: str, + resource_name: str, + request_payload: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RunCommandResult]: + """Submits a command to run against the Managed Cluster. + + AKS will create a pod to run the command. This is primarily useful for private clusters. For + more information see `AKS Run Command + `_. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param request_payload: The run command request. Required. + :type request_payload: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either RunCommandResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_06_02_preview.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_run_command( + self, + resource_group_name: str, + resource_name: str, + request_payload: Union[_models.RunCommandRequest, IO], + **kwargs: Any + ) -> LROPoller[_models.RunCommandResult]: + """Submits a command to run against the Managed Cluster. + + AKS will create a pod to run the command. This is primarily useful for private clusters. For + more information see `AKS Run Command + `_. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param request_payload: The run command request. Is either a model type or a IO type. Required. + :type request_payload: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.RunCommandRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -2802,20 +3056,17 @@ def begin_run_command( cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_06_02_preview.models.RunCommandResult] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.RunCommandResult] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.RunCommandResult] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._run_command_initial( # type: ignore resource_group_name=resource_group_name, @@ -2823,82 +3074,72 @@ def begin_run_command( request_payload=request_payload, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_run_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore + begin_run_command.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore @distributed_trace def get_command_result( - self, - resource_group_name: str, - resource_name: str, - command_id: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, command_id: str, **kwargs: Any ) -> Optional[_models.RunCommandResult]: """Gets the results of a command which has been run on the Managed Cluster. Gets the results of a command which has been run on the Managed Cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param command_id: Id of the command. + :param command_id: Id of the command. Required. :type command_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: RunCommandResult, or the result of cls(response) + :return: RunCommandResult or None or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.RunCommandResult or None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RunCommandResult]] - request = build_get_command_result_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, command_id=command_id, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_command_result.metadata['url'], + template_url=self.get_command_result.metadata["url"], headers=_headers, params=_params, ) @@ -2906,10 +3147,9 @@ def get_command_result( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -2918,23 +3158,19 @@ def get_command_result( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('RunCommandResult', pipeline_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_command_result.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}"} # type: ignore - + get_command_result.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}"} # type: ignore @distributed_trace def list_outbound_network_dependencies_endpoints( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> Iterable[_models.OutboundEnvironmentEndpointCollection]: + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> Iterable["_models.OutboundEnvironmentEndpoint"]: """Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster. @@ -2942,35 +3178,35 @@ def list_outbound_network_dependencies_endpoints( specified managed cluster. The operation returns properties of each egress endpoint. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OutboundEnvironmentEndpointCollection or the - result of cls(response) + :return: An iterator like instance of either OutboundEnvironmentEndpoint or the result of + cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_06_02_preview.models.OutboundEnvironmentEndpointCollection] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_06_02_preview.models.OutboundEnvironmentEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_outbound_network_dependencies_endpoints_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_outbound_network_dependencies_endpoints.metadata['url'], + template_url=self.list_outbound_network_dependencies_endpoints.metadata["url"], headers=_headers, params=_params, ) @@ -2978,16 +3214,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_outbound_network_dependencies_endpoints_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -3003,10 +3234,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -3016,8 +3245,6 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_outbound_network_dependencies_endpoints.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints"} # type: ignore + list_outbound_network_dependencies_endpoints.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_operations.py index 373d8ea01547..ab66bf4e24cd 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_operations.py @@ -7,10 +7,15 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,38 +25,34 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - **kwargs: Any -) -> HttpRequest: + +def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.ContainerService/operations") # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class Operations: """ @@ -72,38 +73,33 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.OperationListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.OperationValue"]: """Gets a list of operations. Gets a list of operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationListResult or the result of cls(response) + :return: An iterator like instance of either OperationValue or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_06_02_preview.models.OperationListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_06_02_preview.models.OperationValue] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -111,13 +107,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -133,10 +127,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -146,8 +138,6 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.ContainerService/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ContainerService/operations"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_patch.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_patch.py @@ -10,6 +10,7 @@ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_private_endpoint_connections_operations.py index d65c073c21bf..38aaed94e332 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_private_endpoint_connections_operations.py @@ -6,11 +6,15 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod @@ -21,173 +25,199 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - subscription_id: str, resource_group_name: str, resource_name: str, private_endpoint_connection_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_update_request( - subscription_id: str, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, - *, - json: Optional[_models.PrivateEndpointConnection] = None, - content: Any = None, + subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request_initial( - subscription_id: str, +def build_delete_request( resource_group_name: str, resource_name: str, private_endpoint_connection_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class PrivateEndpointConnectionsOperations: """ @@ -208,13 +238,9 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnectionListResult: """Gets a list of private endpoint connections in the specified managed cluster. @@ -222,33 +248,31 @@ def list( https://docs.microsoft.com/azure/aks/private-clusters. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnectionListResult, or the result of cls(response) + :return: PrivateEndpointConnectionListResult or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.PrivateEndpointConnectionListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnectionListResult] - request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -256,33 +280,27 @@ def list( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore - + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore @distributed_trace def get( - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnection: """Gets the specified private endpoint connection. @@ -290,35 +308,33 @@ def get( https://docs.microsoft.com/azure/aks/private-clusters. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -326,33 +342,33 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - @distributed_trace + @overload def update( self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, parameters: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateEndpointConnection: """Updates a private endpoint connection. @@ -360,42 +376,117 @@ def update( Updates a private endpoint connection. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str - :param parameters: The updated private endpoint connection. + :param parameters: The updated private endpoint connection. Required. :type parameters: ~azure.mgmt.containerservice.v2022_06_02_preview.models.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) + :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: The updated private endpoint connection. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: Union[_models.PrivateEndpointConnection, IO], + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: The updated private endpoint connection. Is either a model type or a IO + type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.PrivateEndpointConnection or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - _json = self._serialize.body(parameters, 'PrivateEndpointConnection') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateEndpointConnection") request = build_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update.metadata['url'], + content=_content, + template_url=self.update.metadata["url"], headers=_headers, params=_params, ) @@ -403,52 +494,43 @@ def update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, + request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -456,10 +538,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -469,26 +550,22 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + def begin_delete( + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> LROPoller[None]: """Deletes a private endpoint connection. Deletes a private endpoint connection. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -500,53 +577,46 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_private_link_resources_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_private_link_resources_operations.py index 189d27c10e65..93dd66c845f8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_private_link_resources_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_private_link_resources_operations.py @@ -8,9 +8,13 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -19,48 +23,55 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class PrivateLinkResourcesOperations: """ @@ -81,13 +92,9 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> _models.PrivateLinkResourcesListResult: """Gets a list of private link resources in the specified managed cluster. @@ -95,32 +102,30 @@ def list( https://docs.microsoft.com/azure/aks/private-clusters. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResourcesListResult, or the result of cls(response) + :return: PrivateLinkResourcesListResult or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.PrivateLinkResourcesListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResourcesListResult] - request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -128,22 +133,20 @@ def list( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResourcesListResult', pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources"} # type: ignore - + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_resolve_private_link_service_id_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_resolve_private_link_service_id_operations.py index e4f5b2f7e788..66ab583bc867 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_resolve_private_link_service_id_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_resolve_private_link_service_id_operations.py @@ -6,11 +6,15 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -19,56 +23,58 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_post_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.PrivateLinkResource] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + class ResolvePrivateLinkServiceIdOperations: """ @@ -89,13 +95,72 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @overload + def post( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.PrivateLinkResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID for the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters required in order to resolve a private link service ID. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_06_02_preview.models.PrivateLinkResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def post( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID for the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters required in order to resolve a private link service ID. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def post( self, resource_group_name: str, resource_name: str, - parameters: _models.PrivateLinkResource, + parameters: Union[_models.PrivateLinkResource, IO], **kwargs: Any ) -> _models.PrivateLinkResource: """Gets the private link service ID for the specified managed cluster. @@ -103,38 +168,49 @@ def post( Gets the private link service ID for the specified managed cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters required in order to resolve a private link service ID. + :param parameters: Parameters required in order to resolve a private link service ID. Is either + a model type or a IO type. Required. :type parameters: ~azure.mgmt.containerservice.v2022_06_02_preview.models.PrivateLinkResource + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResource, or the result of cls(response) + :return: PrivateLinkResource or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.PrivateLinkResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResource] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResource] - _json = self._serialize.body(parameters, 'PrivateLinkResource') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateLinkResource") request = build_post_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.post.metadata['url'], + content=_content, + template_url=self.post.metadata["url"], headers=_headers, params=_params, ) @@ -142,22 +218,20 @@ def post( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateLinkResource', pipeline_response) + deserialized = self._deserialize("PrivateLinkResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - post.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId"} # type: ignore - + post.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_snapshots_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_snapshots_operations.py index 3a0ec2d61b4f..6bf74b53ca07 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_snapshots_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_snapshots_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,243 +25,233 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots") path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_resource_group_request( - subscription_id: str, - resource_group_name: str, - **kwargs: Any -) -> HttpRequest: +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_get_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any -) -> HttpRequest: + _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, resource_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.Snapshot] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_update_tags_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - *, - json: Optional[_models.TagsObject] = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class SnapshotsOperations: """ @@ -277,39 +272,34 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable[_models.SnapshotListResult]: + def list(self, **kwargs: Any) -> Iterable["_models.Snapshot"]: """Gets a list of snapshots in the specified subscription. Gets a list of snapshots in the specified subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SnapshotListResult or the result of cls(response) + :return: An iterator like instance of either Snapshot or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_06_02_preview.models.SnapshotListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_06_02_preview.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SnapshotListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -317,14 +307,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -340,10 +327,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -353,48 +338,42 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots"} # type: ignore @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> Iterable[_models.SnapshotListResult]: + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Snapshot"]: """Lists snapshots in the specified subscription and resource group. Lists snapshots in the specified subscription and resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SnapshotListResult or the result of cls(response) + :return: An iterator like instance of either Snapshot or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_06_02_preview.models.SnapshotListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_06_02_preview.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SnapshotListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -402,15 +381,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -426,10 +401,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -439,50 +412,41 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots"} # type: ignore @distributed_trace - def get( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> _models.Snapshot: + def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.Snapshot: """Gets a snapshot. Gets a snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Snapshot, or the result of cls(response) + :return: Snapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.Snapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -490,32 +454,32 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - - @distributed_trace + @overload def create_or_update( self, resource_group_name: str, resource_name: str, parameters: _models.Snapshot, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.Snapshot: """Creates or updates a snapshot. @@ -523,38 +487,102 @@ def create_or_update( Creates or updates a snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: The snapshot to create or update. + :param parameters: The snapshot to create or update. Required. :type parameters: ~azure.mgmt.containerservice.v2022_06_02_preview.models.Snapshot + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Snapshot, or the result of cls(response) + :return: Snapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.Snapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Snapshot: + """Creates or updates a snapshot. + + Creates or updates a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The snapshot to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.Snapshot, IO], **kwargs: Any + ) -> _models.Snapshot: + """Creates or updates a snapshot. + + Creates or updates a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The snapshot to create or update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.mgmt.containerservice.v2022_06_02_preview.models.Snapshot or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] - _json = self._serialize.body(parameters, 'Snapshot') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "Snapshot") request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) @@ -562,10 +590,9 @@ def create_or_update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -573,25 +600,26 @@ def create_or_update( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - - @distributed_trace + @overload def update_tags( self, resource_group_name: str, resource_name: str, parameters: _models.TagsObject, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.Snapshot: """Updates tags on a snapshot. @@ -599,38 +627,102 @@ def update_tags( Updates tags on a snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param parameters: Parameters supplied to the Update snapshot Tags operation. + :param parameters: Parameters supplied to the Update snapshot Tags operation. Required. :type parameters: ~azure.mgmt.containerservice.v2022_06_02_preview.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Snapshot, or the result of cls(response) + :return: Snapshot or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.Snapshot - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + + @overload + def update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Snapshot: + """Updates tags on a snapshot. + + Updates tags on a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update snapshot Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> _models.Snapshot: + """Updates tags on a snapshot. + + Updates tags on a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update snapshot Tags operation. Is either a model + type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_06_02_preview.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] - _json = self._serialize.body(parameters, 'TagsObject') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") request = build_update_tags_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update_tags.metadata['url'], + content=_content, + template_url=self.update_tags.metadata["url"], headers=_headers, params=_params, ) @@ -638,64 +730,57 @@ def update_tags( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('Snapshot', pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - + update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore @distributed_trace def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: """Deletes a snapshot. Deletes a snapshot. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) @@ -703,10 +788,9 @@ def delete( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -716,5 +800,4 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore - + delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_trusted_access_role_bindings_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_trusted_access_role_bindings_operations.py index 5d954e2a98c2..7f31ca15c3f6 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_trusted_access_role_bindings_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_trusted_access_role_bindings_operations.py @@ -6,11 +6,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,173 +25,199 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - subscription_id: str, - resource_group_name: str, - resource_name: str, - **kwargs: Any + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - subscription_id: str, resource_group_name: str, resource_name: str, trusted_access_role_binding_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "trustedAccessRoleBindingName": _SERIALIZER.url("trusted_access_role_binding_name", trusted_access_role_binding_name, 'str', max_length=36, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "trustedAccessRoleBindingName": _SERIALIZER.url( + "trusted_access_role_binding_name", trusted_access_role_binding_name, "str", max_length=36, min_length=1 + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_request( - subscription_id: str, resource_group_name: str, resource_name: str, trusted_access_role_binding_name: str, - *, - json: Optional[_models.TrustedAccessRoleBinding] = None, - content: Any = None, + subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "trustedAccessRoleBindingName": _SERIALIZER.url("trusted_access_role_binding_name", trusted_access_role_binding_name, 'str', max_length=36, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "trustedAccessRoleBindingName": _SERIALIZER.url( + "trusted_access_role_binding_name", trusted_access_role_binding_name, "str", max_length=36, min_length=1 + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_request( - subscription_id: str, resource_group_name: str, resource_name: str, trusted_access_role_binding_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), - "trustedAccessRoleBindingName": _SERIALIZER.url("trusted_access_role_binding_name", trusted_access_role_binding_name, 'str', max_length=36, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "trustedAccessRoleBindingName": _SERIALIZER.url( + "trusted_access_role_binding_name", trusted_access_role_binding_name, "str", max_length=36, min_length=1 + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class TrustedAccessRoleBindingsOperations: """ @@ -207,48 +238,44 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list( - self, - resource_group_name: str, - resource_name: str, - **kwargs: Any - ) -> Iterable[_models.TrustedAccessRoleBindingListResult]: + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> Iterable["_models.TrustedAccessRoleBinding"]: """List trusted access role bindings. List trusted access role bindings. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either TrustedAccessRoleBindingListResult or the result - of cls(response) + :return: An iterator like instance of either TrustedAccessRoleBinding or the result of + cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_06_02_preview.models.TrustedAccessRoleBindingListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_06_02_preview.models.TrustedAccessRoleBinding] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.TrustedAccessRoleBindingListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.TrustedAccessRoleBindingListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -256,16 +283,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -281,10 +303,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -294,54 +314,46 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings"} # type: ignore @distributed_trace def get( - self, - resource_group_name: str, - resource_name: str, - trusted_access_role_binding_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, trusted_access_role_binding_name: str, **kwargs: Any ) -> _models.TrustedAccessRoleBinding: """Get a trusted access role binding. Get a trusted access role binding. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param trusted_access_role_binding_name: The name of trusted access role binding. + :param trusted_access_role_binding_name: The name of trusted access role binding. Required. :type trusted_access_role_binding_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: TrustedAccessRoleBinding, or the result of cls(response) + :return: TrustedAccessRoleBinding or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.TrustedAccessRoleBinding - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.TrustedAccessRoleBinding] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.TrustedAccessRoleBinding] - request = build_get_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, trusted_access_role_binding_name=trusted_access_role_binding_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -349,33 +361,33 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('TrustedAccessRoleBinding', pipeline_response) + deserialized = self._deserialize("TrustedAccessRoleBinding", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}"} # type: ignore - @distributed_trace + @overload def create_or_update( self, resource_group_name: str, resource_name: str, trusted_access_role_binding_name: str, trusted_access_role_binding: _models.TrustedAccessRoleBinding, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.TrustedAccessRoleBinding: """Create or update a trusted access role binding. @@ -383,42 +395,117 @@ def create_or_update( Create or update a trusted access role binding. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param trusted_access_role_binding_name: The name of trusted access role binding. + :param trusted_access_role_binding_name: The name of trusted access role binding. Required. :type trusted_access_role_binding_name: str - :param trusted_access_role_binding: A trusted access role binding. + :param trusted_access_role_binding: A trusted access role binding. Required. :type trusted_access_role_binding: ~azure.mgmt.containerservice.v2022_06_02_preview.models.TrustedAccessRoleBinding + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TrustedAccessRoleBinding or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.TrustedAccessRoleBinding + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + trusted_access_role_binding_name: str, + trusted_access_role_binding: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.TrustedAccessRoleBinding: + """Create or update a trusted access role binding. + + Create or update a trusted access role binding. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param trusted_access_role_binding_name: The name of trusted access role binding. Required. + :type trusted_access_role_binding_name: str + :param trusted_access_role_binding: A trusted access role binding. Required. + :type trusted_access_role_binding: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TrustedAccessRoleBinding or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.TrustedAccessRoleBinding + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + trusted_access_role_binding_name: str, + trusted_access_role_binding: Union[_models.TrustedAccessRoleBinding, IO], + **kwargs: Any + ) -> _models.TrustedAccessRoleBinding: + """Create or update a trusted access role binding. + + Create or update a trusted access role binding. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param trusted_access_role_binding_name: The name of trusted access role binding. Required. + :type trusted_access_role_binding_name: str + :param trusted_access_role_binding: A trusted access role binding. Is either a model type or a + IO type. Required. + :type trusted_access_role_binding: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.TrustedAccessRoleBinding or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: TrustedAccessRoleBinding, or the result of cls(response) + :return: TrustedAccessRoleBinding or the result of cls(response) :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.TrustedAccessRoleBinding - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.TrustedAccessRoleBinding] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.TrustedAccessRoleBinding] - _json = self._serialize.body(trusted_access_role_binding, 'TrustedAccessRoleBinding') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(trusted_access_role_binding, (IO, bytes)): + _content = trusted_access_role_binding + else: + _json = self._serialize.body(trusted_access_role_binding, "TrustedAccessRoleBinding") request = build_create_or_update_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, trusted_access_role_binding_name=trusted_access_role_binding_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) @@ -426,68 +513,60 @@ def create_or_update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('TrustedAccessRoleBinding', pipeline_response) + deserialized = self._deserialize("TrustedAccessRoleBinding", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}"} # type: ignore - + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}"} # type: ignore @distributed_trace def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - trusted_access_role_binding_name: str, - **kwargs: Any + self, resource_group_name: str, resource_name: str, trusted_access_role_binding_name: str, **kwargs: Any ) -> None: """Delete a trusted access role binding. Delete a trusted access role binding. :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param resource_name: The name of the managed cluster resource. + :param resource_name: The name of the managed cluster resource. Required. :type resource_name: str - :param trusted_access_role_binding_name: The name of trusted access role binding. + :param trusted_access_role_binding_name: The name of trusted access role binding. Required. :type trusted_access_role_binding_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, trusted_access_role_binding_name=trusted_access_role_binding_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) @@ -495,10 +574,9 @@ def delete( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -508,5 +586,4 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}"} # type: ignore - + delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_trusted_access_roles_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_trusted_access_roles_operations.py index 982e04489526..40f7e03f661c 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_trusted_access_roles_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_trusted_access_roles_operations.py @@ -7,10 +7,15 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,46 +25,43 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - subscription_id: str, - location: str, - **kwargs: Any -) -> HttpRequest: + +def build_list_request(location: 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/trustedAccessRoles") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/trustedAccessRoles", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "location": _SERIALIZER.url("location", location, 'str', min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "location": _SERIALIZER.url("location", location, "str", min_length=1), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class TrustedAccessRolesOperations: """ @@ -80,44 +82,37 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - location: str, - **kwargs: Any - ) -> Iterable[_models.TrustedAccessRoleListResult]: + def list(self, location: str, **kwargs: Any) -> Iterable["_models.TrustedAccessRole"]: """List supported trusted access roles. List supported trusted access roles. - :param location: The name of Azure region. + :param location: The name of Azure region. Required. :type location: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either TrustedAccessRoleListResult or the result of - cls(response) + :return: An iterator like instance of either TrustedAccessRole or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_06_02_preview.models.TrustedAccessRoleListResult] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_06_02_preview.models.TrustedAccessRole] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.TrustedAccessRoleListResult] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.TrustedAccessRoleListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( - subscription_id=self._config.subscription_id, location=location, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -125,15 +120,11 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - location=location, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -149,10 +140,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -162,8 +151,6 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/trustedAccessRoles"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/trustedAccessRoles"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/__init__.py new file mode 100644 index 000000000000..a8716d29afe8 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/__init__.py @@ -0,0 +1,21 @@ +# 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 ._container_service_client import ContainerServiceClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = ["ContainerServiceClient"] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/_configuration.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/_configuration.py new file mode 100644 index 000000000000..51f785faf2a8 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/_configuration.py @@ -0,0 +1,69 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + +VERSION = "unknown" + + +class ContainerServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes + """Configuration for ContainerServiceClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :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. + :type subscription_id: str + :keyword api_version: Api Version. Default value is "2022-07-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str + """ + + def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: + super(ContainerServiceClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop("api_version", "2022-07-01") # type: str + + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-containerservice/{}".format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, **kwargs # type: Any + ): + # type: (...) -> None + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/_container_service_client.py new file mode 100644 index 000000000000..58bd72253a6f --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/_container_service_client.py @@ -0,0 +1,139 @@ +# 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 copy import deepcopy +from typing import Any, TYPE_CHECKING + +from azure.core.rest import HttpRequest, HttpResponse +from azure.mgmt.core import ARMPipelineClient + +from . import models +from .._serialization import Deserializer, Serializer +from ._configuration import ContainerServiceClientConfiguration +from .operations import ( + AgentPoolsOperations, + MaintenanceConfigurationsOperations, + ManagedClustersOperations, + Operations, + PrivateEndpointConnectionsOperations, + PrivateLinkResourcesOperations, + ResolvePrivateLinkServiceIdOperations, + SnapshotsOperations, +) + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + + +class ContainerServiceClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes + """The Container Service Client. + + :ivar operations: Operations operations + :vartype operations: azure.mgmt.containerservice.v2022_07_01.operations.Operations + :ivar managed_clusters: ManagedClustersOperations operations + :vartype managed_clusters: + azure.mgmt.containerservice.v2022_07_01.operations.ManagedClustersOperations + :ivar maintenance_configurations: MaintenanceConfigurationsOperations operations + :vartype maintenance_configurations: + azure.mgmt.containerservice.v2022_07_01.operations.MaintenanceConfigurationsOperations + :ivar agent_pools: AgentPoolsOperations operations + :vartype agent_pools: azure.mgmt.containerservice.v2022_07_01.operations.AgentPoolsOperations + :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations + :vartype private_endpoint_connections: + azure.mgmt.containerservice.v2022_07_01.operations.PrivateEndpointConnectionsOperations + :ivar private_link_resources: PrivateLinkResourcesOperations operations + :vartype private_link_resources: + azure.mgmt.containerservice.v2022_07_01.operations.PrivateLinkResourcesOperations + :ivar resolve_private_link_service_id: ResolvePrivateLinkServiceIdOperations operations + :vartype resolve_private_link_service_id: + azure.mgmt.containerservice.v2022_07_01.operations.ResolvePrivateLinkServiceIdOperations + :ivar snapshots: SnapshotsOperations operations + :vartype snapshots: azure.mgmt.containerservice.v2022_07_01.operations.SnapshotsOperations + :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. + :type subscription_id: str + :param base_url: Service URL. Default value is "https://management.azure.com". + :type base_url: str + :keyword api_version: Api Version. Default value is "2022-07-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + """ + + def __init__( + self, + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = ContainerServiceClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) + self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.managed_clusters = ManagedClustersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.maintenance_configurations = MaintenanceConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.snapshots = SnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) + + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.HttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> ContainerServiceClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/_metadata.json b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/_metadata.json new file mode 100644 index 000000000000..03a1a3653626 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/_metadata.json @@ -0,0 +1,109 @@ +{ + "chosen_version": "2022-07-01", + "total_api_version_list": ["2022-07-01"], + "client": { + "name": "ContainerServiceClient", + "filename": "_container_service_client", + "description": "The Container Service Client.", + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, + "azure_arm": true, + "has_lro_operations": true, + "client_side_validation": false, + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "global_parameters": { + "sync": { + "credential": { + "signature": "credential: \"TokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id: str,", + "description": "The ID of the target subscription. Required.", + "docstring_type": "str", + "required": true + } + }, + "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id: str,", + "description": "The ID of the target subscription. Required.", + "docstring_type": "str", + "required": true + } + }, + "constant": { + }, + "call": "credential, subscription_id", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: str = \"https://management.azure.com\",", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: str = \"https://management.azure.com\",", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } + }, + "config": { + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"], + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "operation_groups": { + "operations": "Operations", + "managed_clusters": "ManagedClustersOperations", + "maintenance_configurations": "MaintenanceConfigurationsOperations", + "agent_pools": "AgentPoolsOperations", + "private_endpoint_connections": "PrivateEndpointConnectionsOperations", + "private_link_resources": "PrivateLinkResourcesOperations", + "resolve_private_link_service_id": "ResolvePrivateLinkServiceIdOperations", + "snapshots": "SnapshotsOperations" + } +} \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/_vendor.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/_vendor.py new file mode 100644 index 000000000000..9aad73fc743e --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# 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.core.pipeline.transport import HttpRequest + + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] + template = "/".join(components) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/aio/__init__.py new file mode 100644 index 000000000000..a8716d29afe8 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/aio/__init__.py @@ -0,0 +1,21 @@ +# 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 ._container_service_client import ContainerServiceClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = ["ContainerServiceClient"] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/aio/_configuration.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/aio/_configuration.py new file mode 100644 index 000000000000..58ec3f2078ed --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/aio/_configuration.py @@ -0,0 +1,66 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +VERSION = "unknown" + + +class ContainerServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes + """Configuration for ContainerServiceClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :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. + :type subscription_id: str + :keyword api_version: Api Version. Default value is "2022-07-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str + """ + + def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: + super(ContainerServiceClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop("api_version", "2022-07-01") # type: str + + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-containerservice/{}".format(VERSION)) + self._configure(**kwargs) + + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/aio/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/aio/_container_service_client.py new file mode 100644 index 000000000000..0178f2452167 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/aio/_container_service_client.py @@ -0,0 +1,137 @@ +# 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 copy import deepcopy +from typing import Any, Awaitable, TYPE_CHECKING + +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient + +from .. import models +from ..._serialization import Deserializer, Serializer +from ._configuration import ContainerServiceClientConfiguration +from .operations import ( + AgentPoolsOperations, + MaintenanceConfigurationsOperations, + ManagedClustersOperations, + Operations, + PrivateEndpointConnectionsOperations, + PrivateLinkResourcesOperations, + ResolvePrivateLinkServiceIdOperations, + SnapshotsOperations, +) + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class ContainerServiceClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes + """The Container Service Client. + + :ivar operations: Operations operations + :vartype operations: azure.mgmt.containerservice.v2022_07_01.aio.operations.Operations + :ivar managed_clusters: ManagedClustersOperations operations + :vartype managed_clusters: + azure.mgmt.containerservice.v2022_07_01.aio.operations.ManagedClustersOperations + :ivar maintenance_configurations: MaintenanceConfigurationsOperations operations + :vartype maintenance_configurations: + azure.mgmt.containerservice.v2022_07_01.aio.operations.MaintenanceConfigurationsOperations + :ivar agent_pools: AgentPoolsOperations operations + :vartype agent_pools: + azure.mgmt.containerservice.v2022_07_01.aio.operations.AgentPoolsOperations + :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations + :vartype private_endpoint_connections: + azure.mgmt.containerservice.v2022_07_01.aio.operations.PrivateEndpointConnectionsOperations + :ivar private_link_resources: PrivateLinkResourcesOperations operations + :vartype private_link_resources: + azure.mgmt.containerservice.v2022_07_01.aio.operations.PrivateLinkResourcesOperations + :ivar resolve_private_link_service_id: ResolvePrivateLinkServiceIdOperations operations + :vartype resolve_private_link_service_id: + azure.mgmt.containerservice.v2022_07_01.aio.operations.ResolvePrivateLinkServiceIdOperations + :ivar snapshots: SnapshotsOperations operations + :vartype snapshots: azure.mgmt.containerservice.v2022_07_01.aio.operations.SnapshotsOperations + :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. + :type subscription_id: str + :param base_url: Service URL. Default value is "https://management.azure.com". + :type base_url: str + :keyword api_version: Api Version. Default value is "2022-07-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = ContainerServiceClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) + self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.managed_clusters = ManagedClustersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.maintenance_configurations = MaintenanceConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.snapshots = SnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) + + def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.AsyncHttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "ContainerServiceClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/aio/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/aio/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/aio/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/aio/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/aio/operations/__init__.py new file mode 100644 index 000000000000..593b23075ce0 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/aio/operations/__init__.py @@ -0,0 +1,33 @@ +# 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 ._operations import Operations +from ._managed_clusters_operations import ManagedClustersOperations +from ._maintenance_configurations_operations import MaintenanceConfigurationsOperations +from ._agent_pools_operations import AgentPoolsOperations +from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations +from ._private_link_resources_operations import PrivateLinkResourcesOperations +from ._resolve_private_link_service_id_operations import ResolvePrivateLinkServiceIdOperations +from ._snapshots_operations import SnapshotsOperations + +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "Operations", + "ManagedClustersOperations", + "MaintenanceConfigurationsOperations", + "AgentPoolsOperations", + "PrivateEndpointConnectionsOperations", + "PrivateLinkResourcesOperations", + "ResolvePrivateLinkServiceIdOperations", + "SnapshotsOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/aio/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/aio/operations/_agent_pools_operations.py new file mode 100644 index 000000000000..40642b19eb4a --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/aio/operations/_agent_pools_operations.py @@ -0,0 +1,799 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._agent_pools_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_available_agent_pool_versions_request, + build_get_request, + build_get_upgrade_profile_request, + build_list_request, + build_upgrade_node_image_version_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class AgentPoolsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_07_01.aio.ContainerServiceClient`'s + :attr:`agent_pools` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncIterable["_models.AgentPool"]: + """Gets a list of agent pools in the specified managed cluster. + + Gets a list of agent pools in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AgentPool or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_07_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("AgentPoolListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore + + @distributed_trace_async + async def get( + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any + ) -> _models.AgentPool: + """Gets the specified managed cluster agent pool. + + Gets the specified managed cluster agent pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AgentPool or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_01.models.AgentPool + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] + + request = build_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AgentPool", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: Union[_models.AgentPool, IO], + **kwargs: Any + ) -> _models.AgentPool: + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "AgentPool") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_or_update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("AgentPool", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("AgentPool", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: _models.AgentPool, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AgentPool]: + """Creates or updates an agent pool in the specified managed cluster. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: The agent pool to create or update. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_07_01.models.AgentPool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AgentPool or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_07_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AgentPool]: + """Creates or updates an agent pool in the specified managed cluster. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: The agent pool to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AgentPool or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_07_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: Union[_models.AgentPool, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.AgentPool]: + """Creates or updates an agent pool in the specified managed cluster. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: The agent pool to create or update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.mgmt.containerservice.v2022_07_01.models.AgentPool or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AgentPool or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_07_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + agent_pool_name=agent_pool_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("AgentPool", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any + ) -> None: + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + + request = build_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes an agent pool in the specified managed cluster. + + Deletes an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + agent_pool_name=agent_pool_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + + @distributed_trace_async + async def get_upgrade_profile( + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any + ) -> _models.AgentPoolUpgradeProfile: + """Gets the upgrade profile for an agent pool. + + Gets the upgrade profile for an agent pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AgentPoolUpgradeProfile or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_01.models.AgentPoolUpgradeProfile + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolUpgradeProfile] + + request = build_get_upgrade_profile_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_upgrade_profile.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AgentPoolUpgradeProfile", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore + + @distributed_trace_async + async def get_available_agent_pool_versions( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> _models.AgentPoolAvailableVersions: + """Gets a list of supported Kubernetes versions for the specified agent pool. + + See `supported Kubernetes versions + `_ for more details about + the version lifecycle. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AgentPoolAvailableVersions or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_01.models.AgentPoolAvailableVersions + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolAvailableVersions] + + request = build_get_available_agent_pool_versions_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_available_agent_pool_versions.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AgentPoolAvailableVersions", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_available_agent_pool_versions.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore + + async def _upgrade_node_image_version_initial( + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any + ) -> Optional[_models.AgentPool]: + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.AgentPool]] + + request = build_upgrade_node_image_version_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._upgrade_node_image_version_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("AgentPool", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _upgrade_node_image_version_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore + + @distributed_trace_async + async def begin_upgrade_node_image_version( + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Upgrades the node image version of an agent pool to the latest. + + Upgrading the node image version of an agent pool applies the newest OS and runtime updates to + the nodes. AKS provides one new image per week with the latest updates. For more details on + node image versions, see: https://docs.microsoft.com/azure/aks/node-image-upgrade. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AgentPool or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_07_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + if cont_token is None: + raw_result = await self._upgrade_node_image_version_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + agent_pool_name=agent_pool_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("AgentPool", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, response_headers) + return deserialized + + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_upgrade_node_image_version.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/aio/operations/_maintenance_configurations_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/aio/operations/_maintenance_configurations_operations.py new file mode 100644 index 000000000000..e32d2355fa48 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/aio/operations/_maintenance_configurations_operations.py @@ -0,0 +1,407 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._maintenance_configurations_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_managed_cluster_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class MaintenanceConfigurationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_07_01.aio.ContainerServiceClient`'s + :attr:`maintenance_configurations` 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_managed_cluster( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> AsyncIterable["_models.MaintenanceConfiguration"]: + """Gets a list of maintenance configurations in the specified managed cluster. + + Gets a list of maintenance configurations in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either MaintenanceConfiguration or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_07_01.models.MaintenanceConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfigurationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_managed_cluster_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_managed_cluster.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("MaintenanceConfigurationListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_managed_cluster.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations"} # type: ignore + + @distributed_trace_async + async def get( + self, resource_group_name: str, resource_name: str, config_name: str, **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Gets the specified maintenance configuration of a managed cluster. + + Gets the specified maintenance configuration of a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_01.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfiguration] + + request = build_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + config_name=config_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("MaintenanceConfiguration", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore + + @overload + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: _models.MaintenanceConfiguration, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configuration in the specified managed cluster. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: The maintenance configuration to create or update. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_07_01.models.MaintenanceConfiguration + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_01.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configuration in the specified managed cluster. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: The maintenance configuration to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_01.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: Union[_models.MaintenanceConfiguration, IO], + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configuration in the specified managed cluster. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: The maintenance configuration to create or update. Is either a model type or + a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_07_01.models.MaintenanceConfiguration or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_01.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfiguration] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "MaintenanceConfiguration") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + config_name=config_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.create_or_update.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("MaintenanceConfiguration", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, resource_name: str, config_name: str, **kwargs: Any + ) -> None: + """Deletes a maintenance configuration. + + Deletes a maintenance configuration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + + request = build_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + config_name=config_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.delete.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/aio/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/aio/operations/_managed_clusters_operations.py new file mode 100644 index 000000000000..b45fe1249f07 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/aio/operations/_managed_clusters_operations.py @@ -0,0 +1,2291 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._managed_clusters_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_access_profile_request, + build_get_command_result_request, + build_get_os_options_request, + build_get_request, + build_get_upgrade_profile_request, + build_list_by_resource_group_request, + build_list_cluster_admin_credentials_request, + build_list_cluster_monitoring_user_credentials_request, + build_list_cluster_user_credentials_request, + build_list_outbound_network_dependencies_endpoints_request, + build_list_request, + build_reset_aad_profile_request, + build_reset_service_principal_profile_request, + build_rotate_cluster_certificates_request, + build_run_command_request, + build_start_request, + build_stop_request, + build_update_tags_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ManagedClustersOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_07_01.aio.ContainerServiceClient`'s + :attr:`managed_clusters` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get_os_options( + self, location: str, resource_type: Optional[str] = None, **kwargs: Any + ) -> _models.OSOptionProfile: + """Gets supported OS options in the specified subscription. + + Gets supported OS options in the specified subscription. + + :param location: The name of Azure region. Required. + :type location: str + :param resource_type: The resource type for which the OS options needs to be returned. Default + value is None. + :type resource_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: OSOptionProfile or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_01.models.OSOptionProfile + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OSOptionProfile] + + request = build_get_os_options_request( + location=location, + subscription_id=self._config.subscription_id, + resource_type=resource_type, + api_version=api_version, + template_url=self.get_os_options.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("OSOptionProfile", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_os_options.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default"} # type: ignore + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncIterable["_models.ManagedCluster"]: + """Gets a list of managed clusters in the specified subscription. + + Gets a list of managed clusters in the specified subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ManagedCluster or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_07_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ManagedClusterListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ManagedCluster"]: + """Lists managed clusters in the specified subscription and resource group. + + Lists managed clusters in the specified subscription and resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ManagedCluster or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_07_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_resource_group.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ManagedClusterListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + + @distributed_trace_async + async def get_upgrade_profile( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> _models.ManagedClusterUpgradeProfile: + """Gets the upgrade profile of a managed cluster. + + Gets the upgrade profile of a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedClusterUpgradeProfile or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_01.models.ManagedClusterUpgradeProfile + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterUpgradeProfile] + + request = build_get_upgrade_profile_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_upgrade_profile.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ManagedClusterUpgradeProfile", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore + + @distributed_trace_async + async def get_access_profile( + self, resource_group_name: str, resource_name: str, role_name: str, **kwargs: Any + ) -> _models.ManagedClusterAccessProfile: + """Gets an access profile of a managed cluster. + + **WARNING**\ : This API will be deprecated. Instead use `ListClusterUserCredentials + `_ or + `ListClusterAdminCredentials + `_ . + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param role_name: The name of the role for managed cluster accessProfile resource. Required. + :type role_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedClusterAccessProfile or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_01.models.ManagedClusterAccessProfile + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterAccessProfile] + + request = build_get_access_profile_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + role_name=role_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_access_profile.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ManagedClusterAccessProfile", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_access_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore + + @distributed_trace_async + async def list_cluster_admin_credentials( + self, resource_group_name: str, resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any + ) -> _models.CredentialResults: + """Lists the admin credentials of a managed cluster. + + Lists the admin credentials of a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. + :type server_fqdn: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CredentialResults or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_01.models.CredentialResults + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] + + request = build_list_cluster_admin_credentials_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + server_fqdn=server_fqdn, + api_version=api_version, + template_url=self.list_cluster_admin_credentials.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("CredentialResults", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_cluster_admin_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore + + @distributed_trace_async + async def list_cluster_user_credentials( + self, + resource_group_name: str, + resource_name: str, + server_fqdn: Optional[str] = None, + format: Optional[Union[str, "_models.Format"]] = None, + **kwargs: Any + ) -> _models.CredentialResults: + """Lists the user credentials of a managed cluster. + + Lists the user credentials of a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. + :type server_fqdn: str + :param format: Only apply to AAD clusters, specifies the format of returned kubeconfig. Format + 'azure' will return azure auth-provider kubeconfig; format 'exec' will return exec format + kubeconfig, which requires kubelogin binary in the path. Known values are: "azure" and "exec". + Default value is None. + :type format: str or ~azure.mgmt.containerservice.v2022_07_01.models.Format + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CredentialResults or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_01.models.CredentialResults + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] + + request = build_list_cluster_user_credentials_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + server_fqdn=server_fqdn, + format=format, + api_version=api_version, + template_url=self.list_cluster_user_credentials.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("CredentialResults", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_cluster_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore + + @distributed_trace_async + async def list_cluster_monitoring_user_credentials( + self, resource_group_name: str, resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any + ) -> _models.CredentialResults: + """Lists the cluster monitoring user credentials of a managed cluster. + + Lists the cluster monitoring user credentials of a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. + :type server_fqdn: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CredentialResults or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_01.models.CredentialResults + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] + + request = build_list_cluster_monitoring_user_credentials_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + server_fqdn=server_fqdn, + api_version=api_version, + template_url=self.list_cluster_monitoring_user_credentials.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("CredentialResults", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_cluster_monitoring_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore + + @distributed_trace_async + async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.ManagedCluster: + """Gets a managed cluster. + + Gets a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedCluster or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_01.models.ManagedCluster + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + + request = build_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ManagedCluster", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + + async def _create_or_update_initial( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any + ) -> _models.ManagedCluster: + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedCluster") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_or_update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("ManagedCluster", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("ManagedCluster", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.ManagedCluster, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster to create or update. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_07_01.models.ManagedCluster + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_07_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_07_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster to create or update. Is either a model type or a IO + type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_07_01.models.ManagedCluster or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_07_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ManagedCluster", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + + async def _update_tags_initial( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> _models.ManagedCluster: + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") + + request = build_update_tags_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_tags_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ManagedCluster", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_tags_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + + @overload + async def begin_update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates tags on a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_07_01.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_07_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates tags on a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_07_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates tags on a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_07_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_07_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_tags_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ManagedCluster", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> None: + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + + request = build_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + + @distributed_trace_async + async def begin_delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncLROPoller[None]: + """Deletes a managed cluster. + + Deletes a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + + async def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], + **kwargs: Any + ) -> None: + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterServicePrincipalProfile") + + request = build_reset_service_principal_profile_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._reset_service_principal_profile_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _reset_service_principal_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + + @overload + async def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.ManagedClusterServicePrincipalProfile, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset the Service Principal Profile of a managed cluster. + + This action cannot be performed on a cluster that is not using a service principal. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The service principal profile to set on the managed cluster. Required. + :type parameters: + ~azure.mgmt.containerservice.v2022_07_01.models.ManagedClusterServicePrincipalProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset the Service Principal Profile of a managed cluster. + + This action cannot be performed on a cluster that is not using a service principal. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The service principal profile to set on the managed cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset the Service Principal Profile of a managed cluster. + + This action cannot be performed on a cluster that is not using a service principal. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The service principal profile to set on the managed cluster. Is either a + model type or a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2022_07_01.models.ManagedClusterServicePrincipalProfile or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + if cont_token is None: + raw_result = await self._reset_service_principal_profile_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_reset_service_principal_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + + async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterAADProfile, IO], + **kwargs: Any + ) -> None: + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterAADProfile") + + request = build_reset_aad_profile_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._reset_aad_profile_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _reset_aad_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + + @overload + async def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.ManagedClusterAADProfile, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset the AAD Profile of a managed cluster. + + Reset the AAD Profile of a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The AAD profile to set on the Managed Cluster. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_07_01.models.ManagedClusterAADProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset the AAD Profile of a managed cluster. + + Reset the AAD Profile of a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The AAD profile to set on the Managed Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterAADProfile, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset the AAD Profile of a managed cluster. + + Reset the AAD Profile of a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The AAD profile to set on the Managed Cluster. Is either a model type or a + IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_07_01.models.ManagedClusterAADProfile or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + if cont_token is None: + raw_result = await self._reset_aad_profile_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_reset_aad_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + + async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> None: + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + + request = build_rotate_cluster_certificates_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._rotate_cluster_certificates_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _rotate_cluster_certificates_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore + + @distributed_trace_async + async def begin_rotate_cluster_certificates( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Rotates the certificates of a managed cluster. + + See `Certificate rotation `_ for + more details about rotating managed cluster certificates. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + if cont_token is None: + raw_result = await self._rotate_cluster_certificates_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_rotate_cluster_certificates.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore + + async def _stop_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> None: + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + + request = build_stop_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._stop_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _stop_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore + + @distributed_trace_async + async def begin_stop(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncLROPoller[None]: + """Stops a Managed Cluster. + + This can only be performed on Azure Virtual Machine Scale set backed clusters. Stopping a + cluster stops the control plane and agent nodes entirely, while maintaining all object and + cluster state. A cluster does not accrue charges while it is stopped. See `stopping a cluster + `_ for more details about stopping a + cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + if cont_token is None: + raw_result = await self._stop_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_stop.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore + + async def _start_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> None: + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + + request = build_start_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._start_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _start_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore + + @distributed_trace_async + async def begin_start(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncLROPoller[None]: + """Starts a previously stopped Managed Cluster. + + See `starting a cluster `_ for more + details about starting a cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + if cont_token is None: + raw_result = await self._start_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_start.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore + + async def _run_command_initial( + self, + resource_group_name: str, + resource_name: str, + request_payload: Union[_models.RunCommandRequest, IO], + **kwargs: Any + ) -> Optional[_models.RunCommandResult]: + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RunCommandResult]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(request_payload, (IO, bytes)): + _content = request_payload + else: + _json = self._serialize.body(request_payload, "RunCommandRequest") + + request = build_run_command_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._run_command_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("RunCommandResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _run_command_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore + + @overload + async def begin_run_command( + self, + resource_group_name: str, + resource_name: str, + request_payload: _models.RunCommandRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.RunCommandResult]: + """Submits a command to run against the Managed Cluster. + + AKS will create a pod to run the command. This is primarily useful for private clusters. For + more information see `AKS Run Command + `_. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param request_payload: The run command request. Required. + :type request_payload: ~azure.mgmt.containerservice.v2022_07_01.models.RunCommandRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RunCommandResult or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_07_01.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_run_command( + self, + resource_group_name: str, + resource_name: str, + request_payload: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.RunCommandResult]: + """Submits a command to run against the Managed Cluster. + + AKS will create a pod to run the command. This is primarily useful for private clusters. For + more information see `AKS Run Command + `_. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param request_payload: The run command request. Required. + :type request_payload: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RunCommandResult or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_07_01.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_run_command( + self, + resource_group_name: str, + resource_name: str, + request_payload: Union[_models.RunCommandRequest, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.RunCommandResult]: + """Submits a command to run against the Managed Cluster. + + AKS will create a pod to run the command. This is primarily useful for private clusters. For + more information see `AKS Run Command + `_. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param request_payload: The run command request. Is either a model type or a IO type. Required. + :type request_payload: ~azure.mgmt.containerservice.v2022_07_01.models.RunCommandRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RunCommandResult or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_07_01.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.RunCommandResult] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + if cont_token is None: + raw_result = await self._run_command_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + request_payload=request_payload, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("RunCommandResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_run_command.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore + + @distributed_trace_async + async def get_command_result( + self, resource_group_name: str, resource_name: str, command_id: str, **kwargs: Any + ) -> Optional[_models.RunCommandResult]: + """Gets the results of a command which has been run on the Managed Cluster. + + Gets the results of a command which has been run on the Managed Cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param command_id: Id of the command. Required. + :type command_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RunCommandResult or None or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_01.models.RunCommandResult or None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RunCommandResult]] + + request = build_get_command_result_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + command_id=command_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_command_result.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("RunCommandResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_command_result.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}"} # type: ignore + + @distributed_trace + def list_outbound_network_dependencies_endpoints( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> AsyncIterable["_models.OutboundEnvironmentEndpoint"]: + """Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the + specified managed cluster. + + Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the + specified managed cluster. The operation returns properties of each egress endpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OutboundEnvironmentEndpoint or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_07_01.models.OutboundEnvironmentEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_outbound_network_dependencies_endpoints_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_outbound_network_dependencies_endpoints.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("OutboundEnvironmentEndpointCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_outbound_network_dependencies_endpoints.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/aio/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/aio/operations/_operations.py new file mode 100644 index 000000000000..d0d2d16b0532 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/aio/operations/_operations.py @@ -0,0 +1,121 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._operations import build_list_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_07_01.aio.ContainerServiceClient`'s + :attr:`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") + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncIterable["_models.OperationValue"]: + """Gets a list of operations. + + Gets a list of operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationValue or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_07_01.models.OperationValue] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("OperationListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = {"url": "/providers/Microsoft.ContainerService/operations"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/aio/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/aio/operations/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/aio/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/aio/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/aio/operations/_private_endpoint_connections_operations.py new file mode 100644 index 000000000000..3b50a62d5f99 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/aio/operations/_private_endpoint_connections_operations.py @@ -0,0 +1,438 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._private_endpoint_connections_operations import ( + build_delete_request, + build_get_request, + build_list_request, + build_update_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class PrivateEndpointConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_07_01.aio.ContainerServiceClient`'s + :attr:`private_endpoint_connections` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def list( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> _models.PrivateEndpointConnectionListResult: + """Gets a list of private endpoint connections in the specified managed cluster. + + To learn more about private clusters, see: + https://docs.microsoft.com/azure/aks/private-clusters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnectionListResult or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_01.models.PrivateEndpointConnectionListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnectionListResult] + + request = build_list_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore + + @distributed_trace_async + async def get( + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Gets the specified private endpoint connection. + + To learn more about private clusters, see: + https://docs.microsoft.com/azure/aks/private-clusters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_01.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] + + request = build_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + + @overload + async def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: The updated private endpoint connection. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_07_01.models.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_01.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: The updated private endpoint connection. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_01.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: Union[_models.PrivateEndpointConnection, IO], + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: The updated private endpoint connection. Is either a model type or a IO + type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_07_01.models.PrivateEndpointConnection or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_01.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateEndpointConnection") + + request = build_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> None: + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + + request = build_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a private endpoint connection. + + Deletes a private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/aio/operations/_private_link_resources_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/aio/operations/_private_link_resources_operations.py new file mode 100644 index 000000000000..bd6b0f9f8054 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/aio/operations/_private_link_resources_operations.py @@ -0,0 +1,109 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._private_link_resources_operations import build_list_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class PrivateLinkResourcesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_07_01.aio.ContainerServiceClient`'s + :attr:`private_link_resources` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def list( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> _models.PrivateLinkResourcesListResult: + """Gets a list of private link resources in the specified managed cluster. + + To learn more about private clusters, see: + https://docs.microsoft.com/azure/aks/private-clusters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResourcesListResult or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_01.models.PrivateLinkResourcesListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResourcesListResult] + + request = build_list_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("PrivateLinkResourcesListResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/aio/operations/_resolve_private_link_service_id_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/aio/operations/_resolve_private_link_service_id_operations.py new file mode 100644 index 000000000000..c15540b03ee9 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/aio/operations/_resolve_private_link_service_id_operations.py @@ -0,0 +1,190 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._resolve_private_link_service_id_operations import build_post_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ResolvePrivateLinkServiceIdOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_07_01.aio.ContainerServiceClient`'s + :attr:`resolve_private_link_service_id` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @overload + async def post( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.PrivateLinkResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID for the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters required in order to resolve a private link service ID. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_07_01.models.PrivateLinkResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_01.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def post( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID for the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters required in order to resolve a private link service ID. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_01.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def post( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.PrivateLinkResource, IO], + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID for the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters required in order to resolve a private link service ID. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_07_01.models.PrivateLinkResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_01.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResource] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateLinkResource") + + request = build_post_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.post.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("PrivateLinkResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + post.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/aio/operations/_snapshots_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/aio/operations/_snapshots_operations.py new file mode 100644 index 000000000000..977300ab203d --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/aio/operations/_snapshots_operations.py @@ -0,0 +1,590 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._snapshots_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_resource_group_request, + build_list_request, + build_update_tags_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class SnapshotsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_07_01.aio.ContainerServiceClient`'s + :attr:`snapshots` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncIterable["_models.Snapshot"]: + """Gets a list of snapshots in the specified subscription. + + Gets a list of snapshots in the specified subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Snapshot or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_07_01.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SnapshotListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("SnapshotListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots"} # type: ignore + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.Snapshot"]: + """Lists snapshots in the specified subscription and resource group. + + Lists snapshots in the specified subscription and resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Snapshot or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_07_01.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SnapshotListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_resource_group.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("SnapshotListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots"} # type: ignore + + @distributed_trace_async + async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.Snapshot: + """Gets a snapshot. + + Gets a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_01.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] + + request = build_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("Snapshot", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore + + @overload + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.Snapshot, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Snapshot: + """Creates or updates a snapshot. + + Creates or updates a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The snapshot to create or update. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_07_01.models.Snapshot + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_01.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Snapshot: + """Creates or updates a snapshot. + + Creates or updates a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The snapshot to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_01.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.Snapshot, IO], **kwargs: Any + ) -> _models.Snapshot: + """Creates or updates a snapshot. + + Creates or updates a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The snapshot to create or update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.mgmt.containerservice.v2022_07_01.models.Snapshot or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_01.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "Snapshot") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.create_or_update.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("Snapshot", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("Snapshot", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore + + @overload + async def update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Snapshot: + """Updates tags on a snapshot. + + Updates tags on a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update snapshot Tags operation. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_07_01.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_01.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Snapshot: + """Updates tags on a snapshot. + + Updates tags on a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update snapshot Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_01.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> _models.Snapshot: + """Updates tags on a snapshot. + + Updates tags on a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update snapshot Tags operation. Is either a model + type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_07_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_01.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") + + request = build_update_tags_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update_tags.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("Snapshot", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> None: + """Deletes a snapshot. + + Deletes a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + + request = build_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.delete.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/models/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/models/__init__.py new file mode 100644 index 000000000000..c6d6e12b58a8 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/models/__init__.py @@ -0,0 +1,277 @@ +# 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 ._models_py3 import AgentPool +from ._models_py3 import AgentPoolAvailableVersions +from ._models_py3 import AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem +from ._models_py3 import AgentPoolListResult +from ._models_py3 import AgentPoolUpgradeProfile +from ._models_py3 import AgentPoolUpgradeProfilePropertiesUpgradesItem +from ._models_py3 import AgentPoolUpgradeSettings +from ._models_py3 import AzureKeyVaultKms +from ._models_py3 import CloudErrorBody +from ._models_py3 import ContainerServiceDiagnosticsProfile +from ._models_py3 import ContainerServiceLinuxProfile +from ._models_py3 import ContainerServiceMasterProfile +from ._models_py3 import ContainerServiceNetworkProfile +from ._models_py3 import ContainerServiceSshConfiguration +from ._models_py3 import ContainerServiceSshPublicKey +from ._models_py3 import ContainerServiceVMDiagnostics +from ._models_py3 import CreationData +from ._models_py3 import CredentialResult +from ._models_py3 import CredentialResults +from ._models_py3 import EndpointDependency +from ._models_py3 import EndpointDetail +from ._models_py3 import ExtendedLocation +from ._models_py3 import KubeletConfig +from ._models_py3 import LinuxOSConfig +from ._models_py3 import MaintenanceConfiguration +from ._models_py3 import MaintenanceConfigurationListResult +from ._models_py3 import ManagedCluster +from ._models_py3 import ManagedClusterAADProfile +from ._models_py3 import ManagedClusterAPIServerAccessProfile +from ._models_py3 import ManagedClusterAccessProfile +from ._models_py3 import ManagedClusterAddonProfile +from ._models_py3 import ManagedClusterAddonProfileIdentity +from ._models_py3 import ManagedClusterAgentPoolProfile +from ._models_py3 import ManagedClusterAgentPoolProfileProperties +from ._models_py3 import ManagedClusterAutoUpgradeProfile +from ._models_py3 import ManagedClusterHTTPProxyConfig +from ._models_py3 import ManagedClusterIdentity +from ._models_py3 import ManagedClusterListResult +from ._models_py3 import ManagedClusterLoadBalancerProfile +from ._models_py3 import ManagedClusterLoadBalancerProfileManagedOutboundIPs +from ._models_py3 import ManagedClusterLoadBalancerProfileOutboundIPPrefixes +from ._models_py3 import ManagedClusterLoadBalancerProfileOutboundIPs +from ._models_py3 import ManagedClusterManagedOutboundIPProfile +from ._models_py3 import ManagedClusterNATGatewayProfile +from ._models_py3 import ManagedClusterPodIdentity +from ._models_py3 import ManagedClusterPodIdentityException +from ._models_py3 import ManagedClusterPodIdentityProfile +from ._models_py3 import ManagedClusterPodIdentityProvisioningError +from ._models_py3 import ManagedClusterPodIdentityProvisioningErrorBody +from ._models_py3 import ManagedClusterPodIdentityProvisioningInfo +from ._models_py3 import ManagedClusterPoolUpgradeProfile +from ._models_py3 import ManagedClusterPoolUpgradeProfileUpgradesItem +from ._models_py3 import ManagedClusterPropertiesAutoScalerProfile +from ._models_py3 import ManagedClusterSKU +from ._models_py3 import ManagedClusterSecurityProfile +from ._models_py3 import ManagedClusterSecurityProfileDefender +from ._models_py3 import ManagedClusterSecurityProfileDefenderSecurityMonitoring +from ._models_py3 import ManagedClusterServicePrincipalProfile +from ._models_py3 import ManagedClusterStorageProfile +from ._models_py3 import ManagedClusterStorageProfileDiskCSIDriver +from ._models_py3 import ManagedClusterStorageProfileFileCSIDriver +from ._models_py3 import ManagedClusterStorageProfileSnapshotController +from ._models_py3 import ManagedClusterUpgradeProfile +from ._models_py3 import ManagedClusterWindowsProfile +from ._models_py3 import ManagedServiceIdentityUserAssignedIdentitiesValue +from ._models_py3 import OSOptionProfile +from ._models_py3 import OSOptionProperty +from ._models_py3 import OperationListResult +from ._models_py3 import OperationValue +from ._models_py3 import OutboundEnvironmentEndpoint +from ._models_py3 import OutboundEnvironmentEndpointCollection +from ._models_py3 import PowerState +from ._models_py3 import PrivateEndpoint +from ._models_py3 import PrivateEndpointConnection +from ._models_py3 import PrivateEndpointConnectionListResult +from ._models_py3 import PrivateLinkResource +from ._models_py3 import PrivateLinkResourcesListResult +from ._models_py3 import PrivateLinkServiceConnectionState +from ._models_py3 import Resource +from ._models_py3 import ResourceReference +from ._models_py3 import RunCommandRequest +from ._models_py3 import RunCommandResult +from ._models_py3 import Snapshot +from ._models_py3 import SnapshotListResult +from ._models_py3 import SubResource +from ._models_py3 import SysctlConfig +from ._models_py3 import SystemData +from ._models_py3 import TagsObject +from ._models_py3 import TimeInWeek +from ._models_py3 import TimeSpan +from ._models_py3 import TrackedResource +from ._models_py3 import UserAssignedIdentity +from ._models_py3 import WindowsGmsaProfile + +from ._container_service_client_enums import AgentPoolMode +from ._container_service_client_enums import AgentPoolType +from ._container_service_client_enums import Code +from ._container_service_client_enums import ConnectionStatus +from ._container_service_client_enums import ContainerServiceStorageProfileTypes +from ._container_service_client_enums import ContainerServiceVMSizeTypes +from ._container_service_client_enums import Count +from ._container_service_client_enums import CreatedByType +from ._container_service_client_enums import Expander +from ._container_service_client_enums import ExtendedLocationTypes +from ._container_service_client_enums import Format +from ._container_service_client_enums import GPUInstanceProfile +from ._container_service_client_enums import IpFamily +from ._container_service_client_enums import KeyVaultNetworkAccessTypes +from ._container_service_client_enums import KubeletDiskType +from ._container_service_client_enums import LicenseType +from ._container_service_client_enums import LoadBalancerSku +from ._container_service_client_enums import ManagedClusterPodIdentityProvisioningState +from ._container_service_client_enums import ManagedClusterSKUName +from ._container_service_client_enums import ManagedClusterSKUTier +from ._container_service_client_enums import NetworkMode +from ._container_service_client_enums import NetworkPlugin +from ._container_service_client_enums import NetworkPolicy +from ._container_service_client_enums import OSDiskType +from ._container_service_client_enums import OSSKU +from ._container_service_client_enums import OSType +from ._container_service_client_enums import OutboundType +from ._container_service_client_enums import PrivateEndpointConnectionProvisioningState +from ._container_service_client_enums import PublicNetworkAccess +from ._container_service_client_enums import ResourceIdentityType +from ._container_service_client_enums import ScaleDownMode +from ._container_service_client_enums import ScaleSetEvictionPolicy +from ._container_service_client_enums import ScaleSetPriority +from ._container_service_client_enums import SnapshotType +from ._container_service_client_enums import UpgradeChannel +from ._container_service_client_enums import WeekDay +from ._container_service_client_enums import WorkloadRuntime +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "AgentPool", + "AgentPoolAvailableVersions", + "AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem", + "AgentPoolListResult", + "AgentPoolUpgradeProfile", + "AgentPoolUpgradeProfilePropertiesUpgradesItem", + "AgentPoolUpgradeSettings", + "AzureKeyVaultKms", + "CloudErrorBody", + "ContainerServiceDiagnosticsProfile", + "ContainerServiceLinuxProfile", + "ContainerServiceMasterProfile", + "ContainerServiceNetworkProfile", + "ContainerServiceSshConfiguration", + "ContainerServiceSshPublicKey", + "ContainerServiceVMDiagnostics", + "CreationData", + "CredentialResult", + "CredentialResults", + "EndpointDependency", + "EndpointDetail", + "ExtendedLocation", + "KubeletConfig", + "LinuxOSConfig", + "MaintenanceConfiguration", + "MaintenanceConfigurationListResult", + "ManagedCluster", + "ManagedClusterAADProfile", + "ManagedClusterAPIServerAccessProfile", + "ManagedClusterAccessProfile", + "ManagedClusterAddonProfile", + "ManagedClusterAddonProfileIdentity", + "ManagedClusterAgentPoolProfile", + "ManagedClusterAgentPoolProfileProperties", + "ManagedClusterAutoUpgradeProfile", + "ManagedClusterHTTPProxyConfig", + "ManagedClusterIdentity", + "ManagedClusterListResult", + "ManagedClusterLoadBalancerProfile", + "ManagedClusterLoadBalancerProfileManagedOutboundIPs", + "ManagedClusterLoadBalancerProfileOutboundIPPrefixes", + "ManagedClusterLoadBalancerProfileOutboundIPs", + "ManagedClusterManagedOutboundIPProfile", + "ManagedClusterNATGatewayProfile", + "ManagedClusterPodIdentity", + "ManagedClusterPodIdentityException", + "ManagedClusterPodIdentityProfile", + "ManagedClusterPodIdentityProvisioningError", + "ManagedClusterPodIdentityProvisioningErrorBody", + "ManagedClusterPodIdentityProvisioningInfo", + "ManagedClusterPoolUpgradeProfile", + "ManagedClusterPoolUpgradeProfileUpgradesItem", + "ManagedClusterPropertiesAutoScalerProfile", + "ManagedClusterSKU", + "ManagedClusterSecurityProfile", + "ManagedClusterSecurityProfileDefender", + "ManagedClusterSecurityProfileDefenderSecurityMonitoring", + "ManagedClusterServicePrincipalProfile", + "ManagedClusterStorageProfile", + "ManagedClusterStorageProfileDiskCSIDriver", + "ManagedClusterStorageProfileFileCSIDriver", + "ManagedClusterStorageProfileSnapshotController", + "ManagedClusterUpgradeProfile", + "ManagedClusterWindowsProfile", + "ManagedServiceIdentityUserAssignedIdentitiesValue", + "OSOptionProfile", + "OSOptionProperty", + "OperationListResult", + "OperationValue", + "OutboundEnvironmentEndpoint", + "OutboundEnvironmentEndpointCollection", + "PowerState", + "PrivateEndpoint", + "PrivateEndpointConnection", + "PrivateEndpointConnectionListResult", + "PrivateLinkResource", + "PrivateLinkResourcesListResult", + "PrivateLinkServiceConnectionState", + "Resource", + "ResourceReference", + "RunCommandRequest", + "RunCommandResult", + "Snapshot", + "SnapshotListResult", + "SubResource", + "SysctlConfig", + "SystemData", + "TagsObject", + "TimeInWeek", + "TimeSpan", + "TrackedResource", + "UserAssignedIdentity", + "WindowsGmsaProfile", + "AgentPoolMode", + "AgentPoolType", + "Code", + "ConnectionStatus", + "ContainerServiceStorageProfileTypes", + "ContainerServiceVMSizeTypes", + "Count", + "CreatedByType", + "Expander", + "ExtendedLocationTypes", + "Format", + "GPUInstanceProfile", + "IpFamily", + "KeyVaultNetworkAccessTypes", + "KubeletDiskType", + "LicenseType", + "LoadBalancerSku", + "ManagedClusterPodIdentityProvisioningState", + "ManagedClusterSKUName", + "ManagedClusterSKUTier", + "NetworkMode", + "NetworkPlugin", + "NetworkPolicy", + "OSDiskType", + "OSSKU", + "OSType", + "OutboundType", + "PrivateEndpointConnectionProvisioningState", + "PublicNetworkAccess", + "ResourceIdentityType", + "ScaleDownMode", + "ScaleSetEvictionPolicy", + "ScaleSetPriority", + "SnapshotType", + "UpgradeChannel", + "WeekDay", + "WorkloadRuntime", +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/models/_container_service_client_enums.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/models/_container_service_client_enums.py new file mode 100644 index 000000000000..beb07820f4a6 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/models/_container_service_client_enums.py @@ -0,0 +1,615 @@ +# 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 enum import Enum +from azure.core import CaseInsensitiveEnumMeta + + +class AgentPoolMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """A cluster must have at least one 'System' Agent Pool at all times. For additional information + on agent pool restrictions and best practices, see: + https://docs.microsoft.com/azure/aks/use-system-pools. + """ + + #: System agent pools are primarily for hosting critical system pods such as CoreDNS and + #: metrics-server. System agent pools osType must be Linux. System agent pools VM SKU must have at + #: least 2vCPUs and 4GB of memory. + SYSTEM = "System" + #: User agent pools are primarily for hosting your application pods. + USER = "User" + + +class AgentPoolType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of Agent Pool.""" + + #: Create an Agent Pool backed by a Virtual Machine Scale Set. + VIRTUAL_MACHINE_SCALE_SETS = "VirtualMachineScaleSets" + #: Use of this is strongly discouraged. + AVAILABILITY_SET = "AvailabilitySet" + + +class Code(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Tells whether the cluster is Running or Stopped.""" + + #: The cluster is running. + RUNNING = "Running" + #: The cluster is stopped. + STOPPED = "Stopped" + + +class ConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The private link service connection status.""" + + PENDING = "Pending" + APPROVED = "Approved" + REJECTED = "Rejected" + DISCONNECTED = "Disconnected" + + +class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Specifies what kind of storage to use. If omitted, the default will be chosen on your behalf + based on the choice of orchestrator. + """ + + STORAGE_ACCOUNT = "StorageAccount" + MANAGED_DISKS = "ManagedDisks" + + +class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Size of agent VMs. Note: This is no longer maintained.""" + + STANDARD_A1 = "Standard_A1" + STANDARD_A10 = "Standard_A10" + STANDARD_A11 = "Standard_A11" + STANDARD_A1_V2 = "Standard_A1_v2" + STANDARD_A2 = "Standard_A2" + STANDARD_A2_V2 = "Standard_A2_v2" + STANDARD_A2_M_V2 = "Standard_A2m_v2" + STANDARD_A3 = "Standard_A3" + STANDARD_A4 = "Standard_A4" + STANDARD_A4_V2 = "Standard_A4_v2" + STANDARD_A4_M_V2 = "Standard_A4m_v2" + STANDARD_A5 = "Standard_A5" + STANDARD_A6 = "Standard_A6" + STANDARD_A7 = "Standard_A7" + STANDARD_A8 = "Standard_A8" + STANDARD_A8_V2 = "Standard_A8_v2" + STANDARD_A8_M_V2 = "Standard_A8m_v2" + STANDARD_A9 = "Standard_A9" + STANDARD_B2_MS = "Standard_B2ms" + STANDARD_B2_S = "Standard_B2s" + STANDARD_B4_MS = "Standard_B4ms" + STANDARD_B8_MS = "Standard_B8ms" + STANDARD_D1 = "Standard_D1" + STANDARD_D11 = "Standard_D11" + STANDARD_D11_V2 = "Standard_D11_v2" + STANDARD_D11_V2_PROMO = "Standard_D11_v2_Promo" + STANDARD_D12 = "Standard_D12" + STANDARD_D12_V2 = "Standard_D12_v2" + STANDARD_D12_V2_PROMO = "Standard_D12_v2_Promo" + STANDARD_D13 = "Standard_D13" + STANDARD_D13_V2 = "Standard_D13_v2" + STANDARD_D13_V2_PROMO = "Standard_D13_v2_Promo" + STANDARD_D14 = "Standard_D14" + STANDARD_D14_V2 = "Standard_D14_v2" + STANDARD_D14_V2_PROMO = "Standard_D14_v2_Promo" + STANDARD_D15_V2 = "Standard_D15_v2" + STANDARD_D16_V3 = "Standard_D16_v3" + STANDARD_D16_S_V3 = "Standard_D16s_v3" + STANDARD_D1_V2 = "Standard_D1_v2" + STANDARD_D2 = "Standard_D2" + STANDARD_D2_V2 = "Standard_D2_v2" + STANDARD_D2_V2_PROMO = "Standard_D2_v2_Promo" + STANDARD_D2_V3 = "Standard_D2_v3" + STANDARD_D2_S_V3 = "Standard_D2s_v3" + STANDARD_D3 = "Standard_D3" + STANDARD_D32_V3 = "Standard_D32_v3" + STANDARD_D32_S_V3 = "Standard_D32s_v3" + STANDARD_D3_V2 = "Standard_D3_v2" + STANDARD_D3_V2_PROMO = "Standard_D3_v2_Promo" + STANDARD_D4 = "Standard_D4" + STANDARD_D4_V2 = "Standard_D4_v2" + STANDARD_D4_V2_PROMO = "Standard_D4_v2_Promo" + STANDARD_D4_V3 = "Standard_D4_v3" + STANDARD_D4_S_V3 = "Standard_D4s_v3" + STANDARD_D5_V2 = "Standard_D5_v2" + STANDARD_D5_V2_PROMO = "Standard_D5_v2_Promo" + STANDARD_D64_V3 = "Standard_D64_v3" + STANDARD_D64_S_V3 = "Standard_D64s_v3" + STANDARD_D8_V3 = "Standard_D8_v3" + STANDARD_D8_S_V3 = "Standard_D8s_v3" + STANDARD_DS1 = "Standard_DS1" + STANDARD_DS11 = "Standard_DS11" + STANDARD_DS11_V2 = "Standard_DS11_v2" + STANDARD_DS11_V2_PROMO = "Standard_DS11_v2_Promo" + STANDARD_DS12 = "Standard_DS12" + STANDARD_DS12_V2 = "Standard_DS12_v2" + STANDARD_DS12_V2_PROMO = "Standard_DS12_v2_Promo" + STANDARD_DS13 = "Standard_DS13" + STANDARD_DS13_2_V2 = "Standard_DS13-2_v2" + STANDARD_DS13_4_V2 = "Standard_DS13-4_v2" + STANDARD_DS13_V2 = "Standard_DS13_v2" + STANDARD_DS13_V2_PROMO = "Standard_DS13_v2_Promo" + STANDARD_DS14 = "Standard_DS14" + STANDARD_DS14_4_V2 = "Standard_DS14-4_v2" + STANDARD_DS14_8_V2 = "Standard_DS14-8_v2" + STANDARD_DS14_V2 = "Standard_DS14_v2" + STANDARD_DS14_V2_PROMO = "Standard_DS14_v2_Promo" + STANDARD_DS15_V2 = "Standard_DS15_v2" + STANDARD_DS1_V2 = "Standard_DS1_v2" + STANDARD_DS2 = "Standard_DS2" + STANDARD_DS2_V2 = "Standard_DS2_v2" + STANDARD_DS2_V2_PROMO = "Standard_DS2_v2_Promo" + STANDARD_DS3 = "Standard_DS3" + STANDARD_DS3_V2 = "Standard_DS3_v2" + STANDARD_DS3_V2_PROMO = "Standard_DS3_v2_Promo" + STANDARD_DS4 = "Standard_DS4" + STANDARD_DS4_V2 = "Standard_DS4_v2" + STANDARD_DS4_V2_PROMO = "Standard_DS4_v2_Promo" + STANDARD_DS5_V2 = "Standard_DS5_v2" + STANDARD_DS5_V2_PROMO = "Standard_DS5_v2_Promo" + STANDARD_E16_V3 = "Standard_E16_v3" + STANDARD_E16_S_V3 = "Standard_E16s_v3" + STANDARD_E2_V3 = "Standard_E2_v3" + STANDARD_E2_S_V3 = "Standard_E2s_v3" + STANDARD_E32_16_S_V3 = "Standard_E32-16s_v3" + STANDARD_E32_8_S_V3 = "Standard_E32-8s_v3" + STANDARD_E32_V3 = "Standard_E32_v3" + STANDARD_E32_S_V3 = "Standard_E32s_v3" + STANDARD_E4_V3 = "Standard_E4_v3" + STANDARD_E4_S_V3 = "Standard_E4s_v3" + STANDARD_E64_16_S_V3 = "Standard_E64-16s_v3" + STANDARD_E64_32_S_V3 = "Standard_E64-32s_v3" + STANDARD_E64_V3 = "Standard_E64_v3" + STANDARD_E64_S_V3 = "Standard_E64s_v3" + STANDARD_E8_V3 = "Standard_E8_v3" + STANDARD_E8_S_V3 = "Standard_E8s_v3" + STANDARD_F1 = "Standard_F1" + STANDARD_F16 = "Standard_F16" + STANDARD_F16_S = "Standard_F16s" + STANDARD_F16_S_V2 = "Standard_F16s_v2" + STANDARD_F1_S = "Standard_F1s" + STANDARD_F2 = "Standard_F2" + STANDARD_F2_S = "Standard_F2s" + STANDARD_F2_S_V2 = "Standard_F2s_v2" + STANDARD_F32_S_V2 = "Standard_F32s_v2" + STANDARD_F4 = "Standard_F4" + STANDARD_F4_S = "Standard_F4s" + STANDARD_F4_S_V2 = "Standard_F4s_v2" + STANDARD_F64_S_V2 = "Standard_F64s_v2" + STANDARD_F72_S_V2 = "Standard_F72s_v2" + STANDARD_F8 = "Standard_F8" + STANDARD_F8_S = "Standard_F8s" + STANDARD_F8_S_V2 = "Standard_F8s_v2" + STANDARD_G1 = "Standard_G1" + STANDARD_G2 = "Standard_G2" + STANDARD_G3 = "Standard_G3" + STANDARD_G4 = "Standard_G4" + STANDARD_G5 = "Standard_G5" + STANDARD_GS1 = "Standard_GS1" + STANDARD_GS2 = "Standard_GS2" + STANDARD_GS3 = "Standard_GS3" + STANDARD_GS4 = "Standard_GS4" + STANDARD_GS4_4 = "Standard_GS4-4" + STANDARD_GS4_8 = "Standard_GS4-8" + STANDARD_GS5 = "Standard_GS5" + STANDARD_GS5_16 = "Standard_GS5-16" + STANDARD_GS5_8 = "Standard_GS5-8" + STANDARD_H16 = "Standard_H16" + STANDARD_H16_M = "Standard_H16m" + STANDARD_H16_MR = "Standard_H16mr" + STANDARD_H16_R = "Standard_H16r" + STANDARD_H8 = "Standard_H8" + STANDARD_H8_M = "Standard_H8m" + STANDARD_L16_S = "Standard_L16s" + STANDARD_L32_S = "Standard_L32s" + STANDARD_L4_S = "Standard_L4s" + STANDARD_L8_S = "Standard_L8s" + STANDARD_M128_32_MS = "Standard_M128-32ms" + STANDARD_M128_64_MS = "Standard_M128-64ms" + STANDARD_M128_MS = "Standard_M128ms" + STANDARD_M128_S = "Standard_M128s" + STANDARD_M64_16_MS = "Standard_M64-16ms" + STANDARD_M64_32_MS = "Standard_M64-32ms" + STANDARD_M64_MS = "Standard_M64ms" + STANDARD_M64_S = "Standard_M64s" + STANDARD_NC12 = "Standard_NC12" + STANDARD_NC12_S_V2 = "Standard_NC12s_v2" + STANDARD_NC12_S_V3 = "Standard_NC12s_v3" + STANDARD_NC24 = "Standard_NC24" + STANDARD_NC24_R = "Standard_NC24r" + STANDARD_NC24_RS_V2 = "Standard_NC24rs_v2" + STANDARD_NC24_RS_V3 = "Standard_NC24rs_v3" + STANDARD_NC24_S_V2 = "Standard_NC24s_v2" + STANDARD_NC24_S_V3 = "Standard_NC24s_v3" + STANDARD_NC6 = "Standard_NC6" + STANDARD_NC6_S_V2 = "Standard_NC6s_v2" + STANDARD_NC6_S_V3 = "Standard_NC6s_v3" + STANDARD_ND12_S = "Standard_ND12s" + STANDARD_ND24_RS = "Standard_ND24rs" + STANDARD_ND24_S = "Standard_ND24s" + STANDARD_ND6_S = "Standard_ND6s" + STANDARD_NV12 = "Standard_NV12" + STANDARD_NV24 = "Standard_NV24" + STANDARD_NV6 = "Standard_NV6" + + +class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): + """Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, and 5. The + default value is 1. + """ + + ONE = 1 + THREE = 3 + FIVE = 5 + + +class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of identity that created the resource.""" + + USER = "User" + APPLICATION = "Application" + MANAGED_IDENTITY = "ManagedIdentity" + KEY = "Key" + + +class Expander(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """If not specified, the default is 'random'. See `expanders + `_ + for more information. + """ + + #: Selects the node group that will have the least idle CPU (if tied, unused memory) after + #: scale-up. This is useful when you have different classes of nodes, for example, high CPU or + #: high memory nodes, and only want to expand those when there are pending pods that need a lot of + #: those resources. + LEAST_WASTE = "least-waste" + #: Selects the node group that would be able to schedule the most pods when scaling up. This is + #: useful when you are using nodeSelector to make sure certain pods land on certain nodes. Note + #: that this won't cause the autoscaler to select bigger nodes vs. smaller, as it can add multiple + #: smaller nodes at once. + MOST_PODS = "most-pods" + #: Selects the node group that has the highest priority assigned by the user. It's configuration + #: is described in more details `here + #: `_. + PRIORITY = "priority" + #: Used when you don't have a particular need for the node groups to scale differently. + RANDOM = "random" + + +class ExtendedLocationTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of extendedLocation.""" + + EDGE_ZONE = "EdgeZone" + + +class Format(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Format.""" + + #: Return azure auth-provider kubeconfig. This format is deprecated in 1.22 and will be fully + #: removed in 1.25. + AZURE = "azure" + #: Return exec format kubeconfig. This format requires kubelogin binary in the path. + EXEC = "exec" + + +class GPUInstanceProfile(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """GPUInstanceProfile to be used to specify GPU MIG instance profile for supported GPU VM SKU.""" + + MIG1_G = "MIG1g" + MIG2_G = "MIG2g" + MIG3_G = "MIG3g" + MIG4_G = "MIG4g" + MIG7_G = "MIG7g" + + +class IpFamily(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The IP version to use for cluster networking and IP assignment.""" + + I_PV4 = "IPv4" + I_PV6 = "IPv6" + + +class KeyVaultNetworkAccessTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Network access of key vault. The possible values are ``Public`` and ``Private``. ``Public`` + means the key vault allows public access from all networks. ``Private`` means the key vault + disables public access and enables private link. The default value is ``Public``. + """ + + PUBLIC = "Public" + PRIVATE = "Private" + + +class KubeletDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Determines the placement of emptyDir volumes, container runtime data root, and Kubelet + ephemeral storage. + """ + + #: Kubelet will use the OS disk for its data. + OS = "OS" + #: Kubelet will use the temporary disk for its data. + TEMPORARY = "Temporary" + + +class LicenseType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The license type to use for Windows VMs. See `Azure Hybrid User Benefits + `_ for more details. + """ + + #: No additional licensing is applied. + NONE = "None" + #: Enables Azure Hybrid User Benefits for Windows VMs. + WINDOWS_SERVER = "Windows_Server" + + +class LoadBalancerSku(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The default is 'standard'. See `Azure Load Balancer SKUs + `_ for more information about the + differences between load balancer SKUs. + """ + + #: Use a a standard Load Balancer. This is the recommended Load Balancer SKU. For more information + #: about on working with the load balancer in the managed cluster, see the `standard Load Balancer + #: `_ article. + STANDARD = "standard" + #: Use a basic Load Balancer with limited functionality. + BASIC = "basic" + + +class ManagedClusterPodIdentityProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The current provisioning state of the pod identity.""" + + ASSIGNED = "Assigned" + UPDATING = "Updating" + DELETING = "Deleting" + FAILED = "Failed" + + +class ManagedClusterSKUName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The name of a managed cluster SKU.""" + + BASIC = "Basic" + + +class ManagedClusterSKUTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """If not specified, the default is 'Free'. See `uptime SLA + `_ for more details. + """ + + #: Guarantees 99.95% availability of the Kubernetes API server endpoint for clusters that use + #: Availability Zones and 99.9% of availability for clusters that don't use Availability Zones. + PAID = "Paid" + #: No guaranteed SLA, no additional charges. Free tier clusters have an SLO of 99.5%. + FREE = "Free" + + +class NetworkMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """This cannot be specified if networkPlugin is anything other than 'azure'.""" + + #: No bridge is created. Intra-VM Pod to Pod communication is through IP routes created by Azure + #: CNI. See `Transparent Mode `_ for + #: more information. + TRANSPARENT = "transparent" + #: This is no longer supported + BRIDGE = "bridge" + + +class NetworkPlugin(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Network plugin used for building the Kubernetes network.""" + + #: Use the Azure CNI network plugin. See `Azure CNI (advanced) networking + #: `_ for + #: more information. + AZURE = "azure" + #: Use the Kubenet network plugin. See `Kubenet (basic) networking + #: `_ for more + #: information. + KUBENET = "kubenet" + #: No CNI plugin is pre-installed. See `BYO CNI + #: `_ for more information. + NONE = "none" + + +class NetworkPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Network policy used for building the Kubernetes network.""" + + #: Use Calico network policies. See `differences between Azure and Calico policies + #: `_ + #: for more information. + CALICO = "calico" + #: Use Azure network policies. See `differences between Azure and Calico policies + #: `_ + #: for more information. + AZURE = "azure" + + +class OSDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested + OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more + information see `Ephemeral OS + `_. + """ + + #: Azure replicates the operating system disk for a virtual machine to Azure storage to avoid data + #: loss should the VM need to be relocated to another host. Since containers aren't designed to + #: have local state persisted, this behavior offers limited value while providing some drawbacks, + #: including slower node provisioning and higher read/write latency. + MANAGED = "Managed" + #: Ephemeral OS disks are stored only on the host machine, just like a temporary disk. This + #: provides lower read/write latency, along with faster node scaling and cluster upgrades. + EPHEMERAL = "Ephemeral" + + +class OSSKU(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Specifies the OS SKU used by the agent pool. The default is Ubuntu if OSType is Linux. The + default is Windows2019 when Kubernetes <= 1.24 or Windows2022 when Kubernetes >= 1.25 if OSType + is Windows. + """ + + UBUNTU = "Ubuntu" + CBL_MARINER = "CBLMariner" + WINDOWS2019 = "Windows2019" + WINDOWS2022 = "Windows2022" + + +class OSType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The operating system type. The default is Linux.""" + + #: Use Linux. + LINUX = "Linux" + #: Use Windows. + WINDOWS = "Windows" + + +class OutboundType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """This can only be set at cluster creation time and cannot be changed later. For more information + see `egress outbound type `_. + """ + + #: The load balancer is used for egress through an AKS assigned public IP. This supports + #: Kubernetes services of type 'loadBalancer'. For more information see `outbound type + #: loadbalancer + #: `_. + LOAD_BALANCER = "loadBalancer" + #: Egress paths must be defined by the user. This is an advanced scenario and requires proper + #: network configuration. For more information see `outbound type userDefinedRouting + #: `_. + USER_DEFINED_ROUTING = "userDefinedRouting" + #: The AKS-managed NAT gateway is used for egress. + MANAGED_NAT_GATEWAY = "managedNATGateway" + #: The user-assigned NAT gateway associated to the cluster subnet is used for egress. This is an + #: advanced scenario and requires proper network configuration. + USER_ASSIGNED_NAT_GATEWAY = "userAssignedNATGateway" + + +class PrivateEndpointConnectionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The current provisioning state.""" + + SUCCEEDED = "Succeeded" + CREATING = "Creating" + DELETING = "Deleting" + FAILED = "Failed" + + +class PublicNetworkAccess(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Allow or deny public network access for AKS.""" + + ENABLED = "Enabled" + DISABLED = "Disabled" + + +class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """For more information see `use managed identities in AKS + `_. + """ + + #: Use an implicitly created system assigned managed identity to manage cluster resources. Master + #: components in the control plane such as kube-controller-manager will use the system assigned + #: managed identity to manipulate Azure resources. + SYSTEM_ASSIGNED = "SystemAssigned" + #: Use a user-specified identity to manage cluster resources. Master components in the control + #: plane such as kube-controller-manager will use the specified user assigned managed identity to + #: manipulate Azure resources. + USER_ASSIGNED = "UserAssigned" + #: Do not use a managed identity for the Managed Cluster, service principal will be used instead. + NONE = "None" + + +class ScaleDownMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Describes how VMs are added to or removed from Agent Pools. See `billing states + `_. + """ + + #: Create new instances during scale up and remove instances during scale down. + DELETE = "Delete" + #: Attempt to start deallocated instances (if they exist) during scale up and deallocate instances + #: during scale down. + DEALLOCATE = "Deallocate" + + +class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The eviction policy specifies what to do with the VM when it is evicted. The default is Delete. + For more information about eviction see `spot VMs + `_. + """ + + #: Nodes in the underlying Scale Set of the node pool are deleted when they're evicted. + DELETE = "Delete" + #: Nodes in the underlying Scale Set of the node pool are set to the stopped-deallocated state + #: upon eviction. Nodes in the stopped-deallocated state count against your compute quota and can + #: cause issues with cluster scaling or upgrading. + DEALLOCATE = "Deallocate" + + +class ScaleSetPriority(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The Virtual Machine Scale Set priority.""" + + #: Spot priority VMs will be used. There is no SLA for spot nodes. See `spot on AKS + #: `_ for more information. + SPOT = "Spot" + #: Regular VMs will be used. + REGULAR = "Regular" + + +class SnapshotType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of a snapshot. The default is NodePool.""" + + #: The snapshot is a snapshot of a node pool. + NODE_POOL = "NodePool" + + +class UpgradeChannel(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """For more information see `setting the AKS cluster auto-upgrade channel + `_. + """ + + #: Automatically upgrade the cluster to the latest supported patch release on the latest supported + #: minor version. In cases where the cluster is at a version of Kubernetes that is at an N-2 minor + #: version where N is the latest supported minor version, the cluster first upgrades to the latest + #: supported patch version on N-1 minor version. For example, if a cluster is running version + #: 1.17.7 and versions 1.17.9, 1.18.4, 1.18.6, and 1.19.1 are available, your cluster first is + #: upgraded to 1.18.6, then is upgraded to 1.19.1. + RAPID = "rapid" + #: Automatically upgrade the cluster to the latest supported patch release on minor version N-1, + #: where N is the latest supported minor version. For example, if a cluster is running version + #: 1.17.7 and versions 1.17.9, 1.18.4, 1.18.6, and 1.19.1 are available, your cluster is upgraded + #: to 1.18.6. + STABLE = "stable" + #: Automatically upgrade the cluster to the latest supported patch version when it becomes + #: available while keeping the minor version the same. For example, if a cluster is running + #: version 1.17.7 and versions 1.17.9, 1.18.4, 1.18.6, and 1.19.1 are available, your cluster is + #: upgraded to 1.17.9. + PATCH = "patch" + #: Automatically upgrade the node image to the latest version available. Microsoft provides + #: patches and new images for image nodes frequently (usually weekly), but your running nodes + #: won't get the new images unless you do a node image upgrade. Turning on the node-image channel + #: will automatically update your node images whenever a new version is available. + NODE_IMAGE = "node-image" + #: Disables auto-upgrades and keeps the cluster at its current version of Kubernetes. + NONE = "none" + + +class WeekDay(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The weekday enum.""" + + SUNDAY = "Sunday" + MONDAY = "Monday" + TUESDAY = "Tuesday" + WEDNESDAY = "Wednesday" + THURSDAY = "Thursday" + FRIDAY = "Friday" + SATURDAY = "Saturday" + + +class WorkloadRuntime(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Determines the type of workload a node can run.""" + + #: Nodes will use Kubelet to run standard OCI container workloads. + OCI_CONTAINER = "OCIContainer" + #: Nodes will use Krustlet to run WASM workloads using the WASI provider (Preview). + WASM_WASI = "WasmWasi" diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/models/_models_py3.py new file mode 100644 index 000000000000..45057bbb8062 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/models/_models_py3.py @@ -0,0 +1,5980 @@ +# coding=utf-8 +# pylint: disable=too-many-lines +# -------------------------------------------------------------------------- +# 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 datetime +from typing import Dict, List, Optional, TYPE_CHECKING, Union + +from ... import _serialization + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models + + +class SubResource(_serialization.Model): + """Reference to another subresource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: The name of the resource that is unique within a resource group. This name can be + used to access the resource. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + } + + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class AgentPool(SubResource): # pylint: disable=too-many-instance-attributes + """Agent Pool. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: The name of the resource that is unique within a resource group. This name can be + used to access the resource. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar count: Number of agents (VMs) to host docker containers. Allowed values must be in the + range of 0 to 1000 (inclusive) for user pools and in the range of 1 to 1000 (inclusive) for + system pools. The default value is 1. + :vartype count: int + :ivar vm_size: VM size availability varies by region. If a node contains insufficient compute + resources (memory, cpu, etc) pods might fail to run correctly. For more details on restricted + VM sizes, see: https://docs.microsoft.com/azure/aks/quotas-skus-regions. + :vartype vm_size: str + :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine + in the master/agent pool. If you specify 0, it will apply the default osDisk size according to + the vmSize specified. + :vartype os_disk_size_gb: int + :ivar os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk + larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed + after creation. For more information see `Ephemeral OS + `_. Known values are: + "Managed" and "Ephemeral". + :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2022_07_01.models.OSDiskType + :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data + root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". + :vartype kubelet_disk_type: str or + ~azure.mgmt.containerservice.v2022_07_01.models.KubeletDiskType + :ivar workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer" and "WasmWasi". + :vartype workload_runtime: str or + ~azure.mgmt.containerservice.v2022_07_01.models.WorkloadRuntime + :ivar vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and used. + If no podSubnetID is specified, this applies to nodes and pods, otherwise it applies to just + nodes. This is of the form: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. + :vartype vnet_subnet_id: str + :ivar pod_subnet_id: If omitted, pod IPs are statically assigned on the node subnet (see + vnetSubnetID for more details). This is of the form: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. + :vartype pod_subnet_id: str + :ivar max_pods: The maximum number of pods that can run on a node. + :vartype max_pods: int + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". + :vartype os_type: str or ~azure.mgmt.containerservice.v2022_07_01.models.OSType + :ivar os_sku: Specifies the OS SKU used by the agent pool. The default is Ubuntu if OSType is + Linux. The default is Windows2019 when Kubernetes <= 1.24 or Windows2022 when Kubernetes >= + 1.25 if OSType is Windows. Known values are: "Ubuntu", "CBLMariner", "Windows2019", and + "Windows2022". + :vartype os_sku: str or ~azure.mgmt.containerservice.v2022_07_01.models.OSSKU + :ivar max_count: The maximum number of nodes for auto-scaling. + :vartype max_count: int + :ivar min_count: The minimum number of nodes for auto-scaling. + :vartype min_count: int + :ivar enable_auto_scaling: Whether to enable auto-scaler. + :vartype enable_auto_scaling: bool + :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it + defaults to Delete. Known values are: "Delete" and "Deallocate". + :vartype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_07_01.models.ScaleDownMode + :ivar type_properties_type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets" + and "AvailabilitySet". + :vartype type_properties_type: str or + ~azure.mgmt.containerservice.v2022_07_01.models.AgentPoolType + :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional + information on agent pool restrictions and best practices, see: + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". + :vartype mode: str or ~azure.mgmt.containerservice.v2022_07_01.models.AgentPoolMode + :ivar orchestrator_version: Both patch version (e.g. 1.20.13) and + (e.g. 1.20) are supported. When is specified, the latest supported + GA patch version is chosen automatically. Updating the cluster with the same once + it has been created (e.g. 1.14.x -> 1.14) will not trigger an upgrade, even if a newer patch + version is available. As a best practice, you should upgrade all node pools in an AKS cluster + to the same Kubernetes version. The node pool version must have the same major version as the + control plane. The node pool minor version must be within two minor versions of the control + plane version. The node pool version cannot be greater than the control plane version. For more + information see `upgrading a node pool + `_. + :vartype orchestrator_version: str + :ivar current_orchestrator_version: If orchestratorVersion is a fully specified version + , this field will be exactly equal to it. If orchestratorVersion is + , this field will contain the full version being used. + :vartype current_orchestrator_version: str + :ivar node_image_version: The version of node image. + :vartype node_image_version: str + :ivar upgrade_settings: Settings for upgrading the agentpool. + :vartype upgrade_settings: + ~azure.mgmt.containerservice.v2022_07_01.models.AgentPoolUpgradeSettings + :ivar provisioning_state: The current deployment or provisioning state. + :vartype provisioning_state: str + :ivar power_state: When an Agent Pool is first created it is initially Running. The Agent Pool + can be stopped by setting this field to Stopped. A stopped Agent Pool stops all of its VMs and + does not accrue billing charges. An Agent Pool can only be stopped if it is Running and + provisioning state is Succeeded. + :vartype power_state: ~azure.mgmt.containerservice.v2022_07_01.models.PowerState + :ivar availability_zones: The list of Availability zones to use for nodes. This can only be + specified if the AgentPoolType property is 'VirtualMachineScaleSets'. + :vartype availability_zones: list[str] + :ivar enable_node_public_ip: Some scenarios may require nodes in a node pool to receive their + own dedicated public IP addresses. A common scenario is for gaming workloads, where a console + needs to make a direct connection to a cloud virtual machine to minimize hops. For more + information see `assigning a public IP per node + `_. + The default is false. + :vartype enable_node_public_ip: bool + :ivar node_public_ip_prefix_id: This is of the form: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. + :vartype node_public_ip_prefix_id: str + :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default + is 'Regular'. Known values are: "Spot" and "Regular". + :vartype scale_set_priority: str or + ~azure.mgmt.containerservice.v2022_07_01.models.ScaleSetPriority + :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". + :vartype scale_set_eviction_policy: str or + ~azure.mgmt.containerservice.v2022_07_01.models.ScaleSetEvictionPolicy + :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which + indicates the willingness to pay any on-demand price. For more details on spot pricing, see + `spot VMs pricing `_. + :vartype spot_max_price: float + :ivar tags: The tags to be persisted on the agent pool virtual machine scale set. + :vartype tags: dict[str, str] + :ivar node_labels: The node labels to be persisted across all nodes in agent pool. + :vartype node_labels: dict[str, str] + :ivar node_taints: The taints added to new nodes during node pool create and scale. For + example, key=value:NoSchedule. + :vartype node_taints: list[str] + :ivar proximity_placement_group_id: The ID for Proximity Placement Group. + :vartype proximity_placement_group_id: str + :ivar kubelet_config: The Kubelet configuration on the agent pool nodes. + :vartype kubelet_config: ~azure.mgmt.containerservice.v2022_07_01.models.KubeletConfig + :ivar linux_os_config: The OS configuration of Linux agent nodes. + :vartype linux_os_config: ~azure.mgmt.containerservice.v2022_07_01.models.LinuxOSConfig + :ivar enable_encryption_at_host: This is only supported on certain VM sizes and in certain + Azure regions. For more information, see: + https://docs.microsoft.com/azure/aks/enable-host-encryption. + :vartype enable_encryption_at_host: bool + :ivar enable_ultra_ssd: Whether to enable UltraSSD. + :vartype enable_ultra_ssd: bool + :ivar enable_fips: See `Add a FIPS-enabled node pool + `_ + for more details. + :vartype enable_fips: bool + :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". + :vartype gpu_instance_profile: str or + ~azure.mgmt.containerservice.v2022_07_01.models.GPUInstanceProfile + :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the node pool + will be created/upgraded using a snapshot. + :vartype creation_data: ~azure.mgmt.containerservice.v2022_07_01.models.CreationData + :ivar host_group_id: This is of the form: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}. + For more information see `Azure dedicated hosts + `_. + :vartype host_group_id: str + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "os_disk_size_gb": {"maximum": 2048, "minimum": 0}, + "current_orchestrator_version": {"readonly": True}, + "node_image_version": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "count": {"key": "properties.count", "type": "int"}, + "vm_size": {"key": "properties.vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "properties.osDiskSizeGB", "type": "int"}, + "os_disk_type": {"key": "properties.osDiskType", "type": "str"}, + "kubelet_disk_type": {"key": "properties.kubeletDiskType", "type": "str"}, + "workload_runtime": {"key": "properties.workloadRuntime", "type": "str"}, + "vnet_subnet_id": {"key": "properties.vnetSubnetID", "type": "str"}, + "pod_subnet_id": {"key": "properties.podSubnetID", "type": "str"}, + "max_pods": {"key": "properties.maxPods", "type": "int"}, + "os_type": {"key": "properties.osType", "type": "str"}, + "os_sku": {"key": "properties.osSKU", "type": "str"}, + "max_count": {"key": "properties.maxCount", "type": "int"}, + "min_count": {"key": "properties.minCount", "type": "int"}, + "enable_auto_scaling": {"key": "properties.enableAutoScaling", "type": "bool"}, + "scale_down_mode": {"key": "properties.scaleDownMode", "type": "str"}, + "type_properties_type": {"key": "properties.type", "type": "str"}, + "mode": {"key": "properties.mode", "type": "str"}, + "orchestrator_version": {"key": "properties.orchestratorVersion", "type": "str"}, + "current_orchestrator_version": {"key": "properties.currentOrchestratorVersion", "type": "str"}, + "node_image_version": {"key": "properties.nodeImageVersion", "type": "str"}, + "upgrade_settings": {"key": "properties.upgradeSettings", "type": "AgentPoolUpgradeSettings"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "power_state": {"key": "properties.powerState", "type": "PowerState"}, + "availability_zones": {"key": "properties.availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "properties.enableNodePublicIP", "type": "bool"}, + "node_public_ip_prefix_id": {"key": "properties.nodePublicIPPrefixID", "type": "str"}, + "scale_set_priority": {"key": "properties.scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "properties.scaleSetEvictionPolicy", "type": "str"}, + "spot_max_price": {"key": "properties.spotMaxPrice", "type": "float"}, + "tags": {"key": "properties.tags", "type": "{str}"}, + "node_labels": {"key": "properties.nodeLabels", "type": "{str}"}, + "node_taints": {"key": "properties.nodeTaints", "type": "[str]"}, + "proximity_placement_group_id": {"key": "properties.proximityPlacementGroupID", "type": "str"}, + "kubelet_config": {"key": "properties.kubeletConfig", "type": "KubeletConfig"}, + "linux_os_config": {"key": "properties.linuxOSConfig", "type": "LinuxOSConfig"}, + "enable_encryption_at_host": {"key": "properties.enableEncryptionAtHost", "type": "bool"}, + "enable_ultra_ssd": {"key": "properties.enableUltraSSD", "type": "bool"}, + "enable_fips": {"key": "properties.enableFIPS", "type": "bool"}, + "gpu_instance_profile": {"key": "properties.gpuInstanceProfile", "type": "str"}, + "creation_data": {"key": "properties.creationData", "type": "CreationData"}, + "host_group_id": {"key": "properties.hostGroupID", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals + self, + *, + count: Optional[int] = None, + vm_size: Optional[str] = None, + os_disk_size_gb: Optional[int] = None, + os_disk_type: Optional[Union[str, "_models.OSDiskType"]] = None, + kubelet_disk_type: Optional[Union[str, "_models.KubeletDiskType"]] = None, + workload_runtime: Optional[Union[str, "_models.WorkloadRuntime"]] = None, + vnet_subnet_id: Optional[str] = None, + pod_subnet_id: Optional[str] = None, + max_pods: Optional[int] = None, + os_type: Union[str, "_models.OSType"] = "Linux", + os_sku: Optional[Union[str, "_models.OSSKU"]] = None, + max_count: Optional[int] = None, + min_count: Optional[int] = None, + enable_auto_scaling: Optional[bool] = None, + scale_down_mode: Optional[Union[str, "_models.ScaleDownMode"]] = None, + type_properties_type: Optional[Union[str, "_models.AgentPoolType"]] = None, + mode: Optional[Union[str, "_models.AgentPoolMode"]] = None, + orchestrator_version: Optional[str] = None, + upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, + power_state: Optional["_models.PowerState"] = None, + availability_zones: Optional[List[str]] = None, + enable_node_public_ip: Optional[bool] = None, + node_public_ip_prefix_id: Optional[str] = None, + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", + spot_max_price: float = -1, + tags: Optional[Dict[str, str]] = None, + node_labels: Optional[Dict[str, str]] = None, + node_taints: Optional[List[str]] = None, + proximity_placement_group_id: Optional[str] = None, + kubelet_config: Optional["_models.KubeletConfig"] = None, + linux_os_config: Optional["_models.LinuxOSConfig"] = None, + enable_encryption_at_host: Optional[bool] = None, + enable_ultra_ssd: Optional[bool] = None, + enable_fips: Optional[bool] = None, + gpu_instance_profile: Optional[Union[str, "_models.GPUInstanceProfile"]] = None, + creation_data: Optional["_models.CreationData"] = None, + host_group_id: Optional[str] = None, + **kwargs + ): + """ + :keyword count: Number of agents (VMs) to host docker containers. Allowed values must be in the + range of 0 to 1000 (inclusive) for user pools and in the range of 1 to 1000 (inclusive) for + system pools. The default value is 1. + :paramtype count: int + :keyword vm_size: VM size availability varies by region. If a node contains insufficient + compute resources (memory, cpu, etc) pods might fail to run correctly. For more details on + restricted VM sizes, see: https://docs.microsoft.com/azure/aks/quotas-skus-regions. + :paramtype vm_size: str + :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every + machine in the master/agent pool. If you specify 0, it will apply the default osDisk size + according to the vmSize specified. + :paramtype os_disk_size_gb: int + :keyword os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk + larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed + after creation. For more information see `Ephemeral OS + `_. Known values are: + "Managed" and "Ephemeral". + :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2022_07_01.models.OSDiskType + :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime + data root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". + :paramtype kubelet_disk_type: str or + ~azure.mgmt.containerservice.v2022_07_01.models.KubeletDiskType + :keyword workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer" and "WasmWasi". + :paramtype workload_runtime: str or + ~azure.mgmt.containerservice.v2022_07_01.models.WorkloadRuntime + :keyword vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and + used. If no podSubnetID is specified, this applies to nodes and pods, otherwise it applies to + just nodes. This is of the form: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. + :paramtype vnet_subnet_id: str + :keyword pod_subnet_id: If omitted, pod IPs are statically assigned on the node subnet (see + vnetSubnetID for more details). This is of the form: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. + :paramtype pod_subnet_id: str + :keyword max_pods: The maximum number of pods that can run on a node. + :paramtype max_pods: int + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". + :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_07_01.models.OSType + :keyword os_sku: Specifies the OS SKU used by the agent pool. The default is Ubuntu if OSType + is Linux. The default is Windows2019 when Kubernetes <= 1.24 or Windows2022 when Kubernetes >= + 1.25 if OSType is Windows. Known values are: "Ubuntu", "CBLMariner", "Windows2019", and + "Windows2022". + :paramtype os_sku: str or ~azure.mgmt.containerservice.v2022_07_01.models.OSSKU + :keyword max_count: The maximum number of nodes for auto-scaling. + :paramtype max_count: int + :keyword min_count: The minimum number of nodes for auto-scaling. + :paramtype min_count: int + :keyword enable_auto_scaling: Whether to enable auto-scaler. + :paramtype enable_auto_scaling: bool + :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, + it defaults to Delete. Known values are: "Delete" and "Deallocate". + :paramtype scale_down_mode: str or + ~azure.mgmt.containerservice.v2022_07_01.models.ScaleDownMode + :keyword type_properties_type: The type of Agent Pool. Known values are: + "VirtualMachineScaleSets" and "AvailabilitySet". + :paramtype type_properties_type: str or + ~azure.mgmt.containerservice.v2022_07_01.models.AgentPoolType + :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For + additional information on agent pool restrictions and best practices, see: + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". + :paramtype mode: str or ~azure.mgmt.containerservice.v2022_07_01.models.AgentPoolMode + :keyword orchestrator_version: Both patch version (e.g. 1.20.13) and + (e.g. 1.20) are supported. When is specified, the latest supported + GA patch version is chosen automatically. Updating the cluster with the same once + it has been created (e.g. 1.14.x -> 1.14) will not trigger an upgrade, even if a newer patch + version is available. As a best practice, you should upgrade all node pools in an AKS cluster + to the same Kubernetes version. The node pool version must have the same major version as the + control plane. The node pool minor version must be within two minor versions of the control + plane version. The node pool version cannot be greater than the control plane version. For more + information see `upgrading a node pool + `_. + :paramtype orchestrator_version: str + :keyword upgrade_settings: Settings for upgrading the agentpool. + :paramtype upgrade_settings: + ~azure.mgmt.containerservice.v2022_07_01.models.AgentPoolUpgradeSettings + :keyword power_state: When an Agent Pool is first created it is initially Running. The Agent + Pool can be stopped by setting this field to Stopped. A stopped Agent Pool stops all of its VMs + and does not accrue billing charges. An Agent Pool can only be stopped if it is Running and + provisioning state is Succeeded. + :paramtype power_state: ~azure.mgmt.containerservice.v2022_07_01.models.PowerState + :keyword availability_zones: The list of Availability zones to use for nodes. This can only be + specified if the AgentPoolType property is 'VirtualMachineScaleSets'. + :paramtype availability_zones: list[str] + :keyword enable_node_public_ip: Some scenarios may require nodes in a node pool to receive + their own dedicated public IP addresses. A common scenario is for gaming workloads, where a + console needs to make a direct connection to a cloud virtual machine to minimize hops. For more + information see `assigning a public IP per node + `_. + The default is false. + :paramtype enable_node_public_ip: bool + :keyword node_public_ip_prefix_id: This is of the form: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. + :paramtype node_public_ip_prefix_id: str + :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the + default is 'Regular'. Known values are: "Spot" and "Regular". + :paramtype scale_set_priority: str or + ~azure.mgmt.containerservice.v2022_07_01.models.ScaleSetPriority + :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". + :paramtype scale_set_eviction_policy: str or + ~azure.mgmt.containerservice.v2022_07_01.models.ScaleSetEvictionPolicy + :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which + indicates the willingness to pay any on-demand price. For more details on spot pricing, see + `spot VMs pricing `_. + :paramtype spot_max_price: float + :keyword tags: The tags to be persisted on the agent pool virtual machine scale set. + :paramtype tags: dict[str, str] + :keyword node_labels: The node labels to be persisted across all nodes in agent pool. + :paramtype node_labels: dict[str, str] + :keyword node_taints: The taints added to new nodes during node pool create and scale. For + example, key=value:NoSchedule. + :paramtype node_taints: list[str] + :keyword proximity_placement_group_id: The ID for Proximity Placement Group. + :paramtype proximity_placement_group_id: str + :keyword kubelet_config: The Kubelet configuration on the agent pool nodes. + :paramtype kubelet_config: ~azure.mgmt.containerservice.v2022_07_01.models.KubeletConfig + :keyword linux_os_config: The OS configuration of Linux agent nodes. + :paramtype linux_os_config: ~azure.mgmt.containerservice.v2022_07_01.models.LinuxOSConfig + :keyword enable_encryption_at_host: This is only supported on certain VM sizes and in certain + Azure regions. For more information, see: + https://docs.microsoft.com/azure/aks/enable-host-encryption. + :paramtype enable_encryption_at_host: bool + :keyword enable_ultra_ssd: Whether to enable UltraSSD. + :paramtype enable_ultra_ssd: bool + :keyword enable_fips: See `Add a FIPS-enabled node pool + `_ + for more details. + :paramtype enable_fips: bool + :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and + "MIG7g". + :paramtype gpu_instance_profile: str or + ~azure.mgmt.containerservice.v2022_07_01.models.GPUInstanceProfile + :keyword creation_data: CreationData to be used to specify the source Snapshot ID if the node + pool will be created/upgraded using a snapshot. + :paramtype creation_data: ~azure.mgmt.containerservice.v2022_07_01.models.CreationData + :keyword host_group_id: This is of the form: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}. + For more information see `Azure dedicated hosts + `_. + :paramtype host_group_id: str + """ + super().__init__(**kwargs) + self.count = count + self.vm_size = vm_size + self.os_disk_size_gb = os_disk_size_gb + self.os_disk_type = os_disk_type + self.kubelet_disk_type = kubelet_disk_type + self.workload_runtime = workload_runtime + self.vnet_subnet_id = vnet_subnet_id + self.pod_subnet_id = pod_subnet_id + self.max_pods = max_pods + self.os_type = os_type + self.os_sku = os_sku + self.max_count = max_count + self.min_count = min_count + self.enable_auto_scaling = enable_auto_scaling + self.scale_down_mode = scale_down_mode + self.type_properties_type = type_properties_type + self.mode = mode + self.orchestrator_version = orchestrator_version + self.current_orchestrator_version = None + self.node_image_version = None + self.upgrade_settings = upgrade_settings + self.provisioning_state = None + self.power_state = power_state + self.availability_zones = availability_zones + self.enable_node_public_ip = enable_node_public_ip + self.node_public_ip_prefix_id = node_public_ip_prefix_id + self.scale_set_priority = scale_set_priority + self.scale_set_eviction_policy = scale_set_eviction_policy + self.spot_max_price = spot_max_price + self.tags = tags + self.node_labels = node_labels + self.node_taints = node_taints + self.proximity_placement_group_id = proximity_placement_group_id + self.kubelet_config = kubelet_config + self.linux_os_config = linux_os_config + self.enable_encryption_at_host = enable_encryption_at_host + self.enable_ultra_ssd = enable_ultra_ssd + self.enable_fips = enable_fips + self.gpu_instance_profile = gpu_instance_profile + self.creation_data = creation_data + self.host_group_id = host_group_id + + +class AgentPoolAvailableVersions(_serialization.Model): + """The list of available versions for an agent pool. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The ID of the agent pool version list. + :vartype id: str + :ivar name: The name of the agent pool version list. + :vartype name: str + :ivar type: Type of the agent pool version list. + :vartype type: str + :ivar agent_pool_versions: List of versions available for agent pool. + :vartype agent_pool_versions: + list[~azure.mgmt.containerservice.v2022_07_01.models.AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem] + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "agent_pool_versions": { + "key": "properties.agentPoolVersions", + "type": "[AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem]", + }, + } + + def __init__( + self, + *, + agent_pool_versions: Optional[List["_models.AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem"]] = None, + **kwargs + ): + """ + :keyword agent_pool_versions: List of versions available for agent pool. + :paramtype agent_pool_versions: + list[~azure.mgmt.containerservice.v2022_07_01.models.AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem] + """ + super().__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.agent_pool_versions = agent_pool_versions + + +class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(_serialization.Model): + """AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem. + + :ivar default: Whether this version is the default agent pool version. + :vartype default: bool + :ivar kubernetes_version: The Kubernetes version (major.minor.patch). + :vartype kubernetes_version: str + :ivar is_preview: Whether Kubernetes version is currently in preview. + :vartype is_preview: bool + """ + + _attribute_map = { + "default": {"key": "default", "type": "bool"}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, + } + + def __init__( + self, + *, + default: Optional[bool] = None, + kubernetes_version: Optional[str] = None, + is_preview: Optional[bool] = None, + **kwargs + ): + """ + :keyword default: Whether this version is the default agent pool version. + :paramtype default: bool + :keyword kubernetes_version: The Kubernetes version (major.minor.patch). + :paramtype kubernetes_version: str + :keyword is_preview: Whether Kubernetes version is currently in preview. + :paramtype is_preview: bool + """ + super().__init__(**kwargs) + self.default = default + self.kubernetes_version = kubernetes_version + self.is_preview = is_preview + + +class AgentPoolListResult(_serialization.Model): + """The response from the List Agent Pools operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The list of agent pools. + :vartype value: list[~azure.mgmt.containerservice.v2022_07_01.models.AgentPool] + :ivar next_link: The URL to get the next set of agent pool results. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[AgentPool]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: Optional[List["_models.AgentPool"]] = None, **kwargs): + """ + :keyword value: The list of agent pools. + :paramtype value: list[~azure.mgmt.containerservice.v2022_07_01.models.AgentPool] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class AgentPoolUpgradeProfile(_serialization.Model): + """The list of available upgrades for an agent pool. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The ID of the agent pool upgrade profile. + :vartype id: str + :ivar name: The name of the agent pool upgrade profile. + :vartype name: str + :ivar type: The type of the agent pool upgrade profile. + :vartype type: str + :ivar kubernetes_version: The Kubernetes version (major.minor.patch). Required. + :vartype kubernetes_version: str + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". + :vartype os_type: str or ~azure.mgmt.containerservice.v2022_07_01.models.OSType + :ivar upgrades: List of orchestrator types and versions available for upgrade. + :vartype upgrades: + list[~azure.mgmt.containerservice.v2022_07_01.models.AgentPoolUpgradeProfilePropertiesUpgradesItem] + :ivar latest_node_image_version: The latest AKS supported node image version. + :vartype latest_node_image_version: str + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "kubernetes_version": {"required": True}, + "os_type": {"required": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "os_type": {"key": "properties.osType", "type": "str"}, + "upgrades": {"key": "properties.upgrades", "type": "[AgentPoolUpgradeProfilePropertiesUpgradesItem]"}, + "latest_node_image_version": {"key": "properties.latestNodeImageVersion", "type": "str"}, + } + + def __init__( + self, + *, + kubernetes_version: str, + os_type: Union[str, "_models.OSType"] = "Linux", + upgrades: Optional[List["_models.AgentPoolUpgradeProfilePropertiesUpgradesItem"]] = None, + latest_node_image_version: Optional[str] = None, + **kwargs + ): + """ + :keyword kubernetes_version: The Kubernetes version (major.minor.patch). Required. + :paramtype kubernetes_version: str + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". + :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_07_01.models.OSType + :keyword upgrades: List of orchestrator types and versions available for upgrade. + :paramtype upgrades: + list[~azure.mgmt.containerservice.v2022_07_01.models.AgentPoolUpgradeProfilePropertiesUpgradesItem] + :keyword latest_node_image_version: The latest AKS supported node image version. + :paramtype latest_node_image_version: str + """ + super().__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.kubernetes_version = kubernetes_version + self.os_type = os_type + self.upgrades = upgrades + self.latest_node_image_version = latest_node_image_version + + +class AgentPoolUpgradeProfilePropertiesUpgradesItem(_serialization.Model): + """AgentPoolUpgradeProfilePropertiesUpgradesItem. + + :ivar kubernetes_version: The Kubernetes version (major.minor.patch). + :vartype kubernetes_version: str + :ivar is_preview: Whether the Kubernetes version is currently in preview. + :vartype is_preview: bool + """ + + _attribute_map = { + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, + } + + def __init__(self, *, kubernetes_version: Optional[str] = None, is_preview: Optional[bool] = None, **kwargs): + """ + :keyword kubernetes_version: The Kubernetes version (major.minor.patch). + :paramtype kubernetes_version: str + :keyword is_preview: Whether the Kubernetes version is currently in preview. + :paramtype is_preview: bool + """ + super().__init__(**kwargs) + self.kubernetes_version = kubernetes_version + self.is_preview = is_preview + + +class AgentPoolUpgradeSettings(_serialization.Model): + """Settings for upgrading an agentpool. + + :ivar max_surge: This can either be set to an integer (e.g. '5') or a percentage (e.g. '50%'). + If a percentage is specified, it is the percentage of the total agent pool size at the time of + the upgrade. For percentages, fractional nodes are rounded up. If not specified, the default is + 1. For more information, including best practices, see: + https://docs.microsoft.com/azure/aks/upgrade-cluster#customize-node-surge-upgrade. + :vartype max_surge: str + """ + + _attribute_map = { + "max_surge": {"key": "maxSurge", "type": "str"}, + } + + def __init__(self, *, max_surge: Optional[str] = None, **kwargs): + """ + :keyword max_surge: This can either be set to an integer (e.g. '5') or a percentage (e.g. + '50%'). If a percentage is specified, it is the percentage of the total agent pool size at the + time of the upgrade. For percentages, fractional nodes are rounded up. If not specified, the + default is 1. For more information, including best practices, see: + https://docs.microsoft.com/azure/aks/upgrade-cluster#customize-node-surge-upgrade. + :paramtype max_surge: str + """ + super().__init__(**kwargs) + self.max_surge = max_surge + + +class AzureKeyVaultKms(_serialization.Model): + """Azure Key Vault key management service settings for the security profile. + + :ivar enabled: Whether to enable Azure Key Vault key management service. The default is false. + :vartype enabled: bool + :ivar key_id: Identifier of Azure Key Vault key. See `key identifier format + `_ + for more details. When Azure Key Vault key management service is enabled, this field is + required and must be a valid key identifier. When Azure Key Vault key management service is + disabled, leave the field empty. + :vartype key_id: str + :ivar key_vault_network_access: Network access of key vault. The possible values are ``Public`` + and ``Private``. ``Public`` means the key vault allows public access from all networks. + ``Private`` means the key vault disables public access and enables private link. The default + value is ``Public``. Known values are: "Public" and "Private". + :vartype key_vault_network_access: str or + ~azure.mgmt.containerservice.v2022_07_01.models.KeyVaultNetworkAccessTypes + :ivar key_vault_resource_id: Resource ID of key vault. When keyVaultNetworkAccess is + ``Private``\ , this field is required and must be a valid resource ID. When + keyVaultNetworkAccess is ``Public``\ , leave the field empty. + :vartype key_vault_resource_id: str + """ + + _attribute_map = { + "enabled": {"key": "enabled", "type": "bool"}, + "key_id": {"key": "keyId", "type": "str"}, + "key_vault_network_access": {"key": "keyVaultNetworkAccess", "type": "str"}, + "key_vault_resource_id": {"key": "keyVaultResourceId", "type": "str"}, + } + + def __init__( + self, + *, + enabled: Optional[bool] = None, + key_id: Optional[str] = None, + key_vault_network_access: Union[str, "_models.KeyVaultNetworkAccessTypes"] = "Public", + key_vault_resource_id: Optional[str] = None, + **kwargs + ): + """ + :keyword enabled: Whether to enable Azure Key Vault key management service. The default is + false. + :paramtype enabled: bool + :keyword key_id: Identifier of Azure Key Vault key. See `key identifier format + `_ + for more details. When Azure Key Vault key management service is enabled, this field is + required and must be a valid key identifier. When Azure Key Vault key management service is + disabled, leave the field empty. + :paramtype key_id: str + :keyword key_vault_network_access: Network access of key vault. The possible values are + ``Public`` and ``Private``. ``Public`` means the key vault allows public access from all + networks. ``Private`` means the key vault disables public access and enables private link. The + default value is ``Public``. Known values are: "Public" and "Private". + :paramtype key_vault_network_access: str or + ~azure.mgmt.containerservice.v2022_07_01.models.KeyVaultNetworkAccessTypes + :keyword key_vault_resource_id: Resource ID of key vault. When keyVaultNetworkAccess is + ``Private``\ , this field is required and must be a valid resource ID. When + keyVaultNetworkAccess is ``Public``\ , leave the field empty. + :paramtype key_vault_resource_id: str + """ + super().__init__(**kwargs) + self.enabled = enabled + self.key_id = key_id + self.key_vault_network_access = key_vault_network_access + self.key_vault_resource_id = key_vault_resource_id + + +class CloudErrorBody(_serialization.Model): + """An error response from the Container service. + + :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. + :vartype code: str + :ivar message: A message describing the error, intended to be suitable for display in a user + interface. + :vartype message: str + :ivar target: The target of the particular error. For example, the name of the property in + error. + :vartype target: str + :ivar details: A list of additional details about the error. + :vartype details: list[~azure.mgmt.containerservice.v2022_07_01.models.CloudErrorBody] + """ + + _attribute_map = { + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[CloudErrorBody]"}, + } + + def __init__( + self, + *, + code: Optional[str] = None, + message: Optional[str] = None, + target: Optional[str] = None, + details: Optional[List["_models.CloudErrorBody"]] = None, + **kwargs + ): + """ + :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. + :paramtype code: str + :keyword message: A message describing the error, intended to be suitable for display in a user + interface. + :paramtype message: str + :keyword target: The target of the particular error. For example, the name of the property in + error. + :paramtype target: str + :keyword details: A list of additional details about the error. + :paramtype details: list[~azure.mgmt.containerservice.v2022_07_01.models.CloudErrorBody] + """ + super().__init__(**kwargs) + self.code = code + self.message = message + self.target = target + self.details = details + + +class ContainerServiceDiagnosticsProfile(_serialization.Model): + """Profile for diagnostics on the container service cluster. + + All required parameters must be populated in order to send to Azure. + + :ivar vm_diagnostics: Profile for diagnostics on the container service VMs. Required. + :vartype vm_diagnostics: + ~azure.mgmt.containerservice.v2022_07_01.models.ContainerServiceVMDiagnostics + """ + + _validation = { + "vm_diagnostics": {"required": True}, + } + + _attribute_map = { + "vm_diagnostics": {"key": "vmDiagnostics", "type": "ContainerServiceVMDiagnostics"}, + } + + def __init__(self, *, vm_diagnostics: "_models.ContainerServiceVMDiagnostics", **kwargs): + """ + :keyword vm_diagnostics: Profile for diagnostics on the container service VMs. Required. + :paramtype vm_diagnostics: + ~azure.mgmt.containerservice.v2022_07_01.models.ContainerServiceVMDiagnostics + """ + super().__init__(**kwargs) + self.vm_diagnostics = vm_diagnostics + + +class ContainerServiceLinuxProfile(_serialization.Model): + """Profile for Linux VMs in the container service cluster. + + All required parameters must be populated in order to send to Azure. + + :ivar admin_username: The administrator username to use for Linux VMs. Required. + :vartype admin_username: str + :ivar ssh: The SSH configuration for Linux-based VMs running on Azure. Required. + :vartype ssh: ~azure.mgmt.containerservice.v2022_07_01.models.ContainerServiceSshConfiguration + """ + + _validation = { + "admin_username": {"required": True, "pattern": r"^[A-Za-z][-A-Za-z0-9_]*$"}, + "ssh": {"required": True}, + } + + _attribute_map = { + "admin_username": {"key": "adminUsername", "type": "str"}, + "ssh": {"key": "ssh", "type": "ContainerServiceSshConfiguration"}, + } + + def __init__(self, *, admin_username: str, ssh: "_models.ContainerServiceSshConfiguration", **kwargs): + """ + :keyword admin_username: The administrator username to use for Linux VMs. Required. + :paramtype admin_username: str + :keyword ssh: The SSH configuration for Linux-based VMs running on Azure. Required. + :paramtype ssh: + ~azure.mgmt.containerservice.v2022_07_01.models.ContainerServiceSshConfiguration + """ + super().__init__(**kwargs) + self.admin_username = admin_username + self.ssh = ssh + + +class ContainerServiceMasterProfile(_serialization.Model): + """Profile for the container service master. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar count: Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, + and 5. The default value is 1. Known values are: 1, 3, and 5. + :vartype count: int or ~azure.mgmt.containerservice.v2022_07_01.models.Count + :ivar dns_prefix: DNS prefix to be used to create the FQDN for the master pool. Required. + :vartype dns_prefix: str + :ivar vm_size: Size of agent VMs. Required. Known values are: "Standard_A1", "Standard_A10", + "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", + "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", + "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", + "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", "Standard_B8ms", + "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", "Standard_D12", + "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", + "Standard_D13_v2_Promo", "Standard_D14", "Standard_D14_v2", "Standard_D14_v2_Promo", + "Standard_D15_v2", "Standard_D16_v3", "Standard_D16s_v3", "Standard_D1_v2", "Standard_D2", + "Standard_D2_v2", "Standard_D2_v2_Promo", "Standard_D2_v3", "Standard_D2s_v3", "Standard_D3", + "Standard_D32_v3", "Standard_D32s_v3", "Standard_D3_v2", "Standard_D3_v2_Promo", "Standard_D4", + "Standard_D4_v2", "Standard_D4_v2_Promo", "Standard_D4_v3", "Standard_D4s_v3", + "Standard_D5_v2", "Standard_D5_v2_Promo", "Standard_D64_v3", "Standard_D64s_v3", + "Standard_D8_v3", "Standard_D8s_v3", "Standard_DS1", "Standard_DS11", "Standard_DS11_v2", + "Standard_DS11_v2_Promo", "Standard_DS12", "Standard_DS12_v2", "Standard_DS12_v2_Promo", + "Standard_DS13", "Standard_DS13-2_v2", "Standard_DS13-4_v2", "Standard_DS13_v2", + "Standard_DS13_v2_Promo", "Standard_DS14", "Standard_DS14-4_v2", "Standard_DS14-8_v2", + "Standard_DS14_v2", "Standard_DS14_v2_Promo", "Standard_DS15_v2", "Standard_DS1_v2", + "Standard_DS2", "Standard_DS2_v2", "Standard_DS2_v2_Promo", "Standard_DS3", "Standard_DS3_v2", + "Standard_DS3_v2_Promo", "Standard_DS4", "Standard_DS4_v2", "Standard_DS4_v2_Promo", + "Standard_DS5_v2", "Standard_DS5_v2_Promo", "Standard_E16_v3", "Standard_E16s_v3", + "Standard_E2_v3", "Standard_E2s_v3", "Standard_E32-16s_v3", "Standard_E32-8s_v3", + "Standard_E32_v3", "Standard_E32s_v3", "Standard_E4_v3", "Standard_E4s_v3", + "Standard_E64-16s_v3", "Standard_E64-32s_v3", "Standard_E64_v3", "Standard_E64s_v3", + "Standard_E8_v3", "Standard_E8s_v3", "Standard_F1", "Standard_F16", "Standard_F16s", + "Standard_F16s_v2", "Standard_F1s", "Standard_F2", "Standard_F2s", "Standard_F2s_v2", + "Standard_F32s_v2", "Standard_F4", "Standard_F4s", "Standard_F4s_v2", "Standard_F64s_v2", + "Standard_F72s_v2", "Standard_F8", "Standard_F8s", "Standard_F8s_v2", "Standard_G1", + "Standard_G2", "Standard_G3", "Standard_G4", "Standard_G5", "Standard_GS1", "Standard_GS2", + "Standard_GS3", "Standard_GS4", "Standard_GS4-4", "Standard_GS4-8", "Standard_GS5", + "Standard_GS5-16", "Standard_GS5-8", "Standard_H16", "Standard_H16m", "Standard_H16mr", + "Standard_H16r", "Standard_H8", "Standard_H8m", "Standard_L16s", "Standard_L32s", + "Standard_L4s", "Standard_L8s", "Standard_M128-32ms", "Standard_M128-64ms", "Standard_M128ms", + "Standard_M128s", "Standard_M64-16ms", "Standard_M64-32ms", "Standard_M64ms", "Standard_M64s", + "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", + "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", + "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". + :vartype vm_size: str or + ~azure.mgmt.containerservice.v2022_07_01.models.ContainerServiceVMSizeTypes + :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine + in this master/agent pool. If you specify 0, it will apply the default osDisk size according to + the vmSize specified. + :vartype os_disk_size_gb: int + :ivar vnet_subnet_id: VNet SubnetID specifies the VNet's subnet identifier. + :vartype vnet_subnet_id: str + :ivar first_consecutive_static_ip: FirstConsecutiveStaticIP used to specify the first static ip + of masters. + :vartype first_consecutive_static_ip: str + :ivar storage_profile: Storage profile specifies what kind of storage used. Choose from + StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the + orchestrator choice. Known values are: "StorageAccount" and "ManagedDisks". + :vartype storage_profile: str or + ~azure.mgmt.containerservice.v2022_07_01.models.ContainerServiceStorageProfileTypes + :ivar fqdn: FQDN for the master pool. + :vartype fqdn: str + """ + + _validation = { + "dns_prefix": {"required": True}, + "vm_size": {"required": True}, + "os_disk_size_gb": {"maximum": 2048, "minimum": 0}, + "fqdn": {"readonly": True}, + } + + _attribute_map = { + "count": {"key": "count", "type": "int"}, + "dns_prefix": {"key": "dnsPrefix", "type": "str"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "first_consecutive_static_ip": {"key": "firstConsecutiveStaticIP", "type": "str"}, + "storage_profile": {"key": "storageProfile", "type": "str"}, + "fqdn": {"key": "fqdn", "type": "str"}, + } + + def __init__( + self, + *, + dns_prefix: str, + vm_size: Union[str, "_models.ContainerServiceVMSizeTypes"], + count: Union[int, "_models.Count"] = 1, + os_disk_size_gb: Optional[int] = None, + vnet_subnet_id: Optional[str] = None, + first_consecutive_static_ip: str = "10.240.255.5", + storage_profile: Optional[Union[str, "_models.ContainerServiceStorageProfileTypes"]] = None, + **kwargs + ): + """ + :keyword count: Number of masters (VMs) in the container service cluster. Allowed values are 1, + 3, and 5. The default value is 1. Known values are: 1, 3, and 5. + :paramtype count: int or ~azure.mgmt.containerservice.v2022_07_01.models.Count + :keyword dns_prefix: DNS prefix to be used to create the FQDN for the master pool. Required. + :paramtype dns_prefix: str + :keyword vm_size: Size of agent VMs. Required. Known values are: "Standard_A1", "Standard_A10", + "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", + "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", + "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", + "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", "Standard_B8ms", + "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", "Standard_D12", + "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", + "Standard_D13_v2_Promo", "Standard_D14", "Standard_D14_v2", "Standard_D14_v2_Promo", + "Standard_D15_v2", "Standard_D16_v3", "Standard_D16s_v3", "Standard_D1_v2", "Standard_D2", + "Standard_D2_v2", "Standard_D2_v2_Promo", "Standard_D2_v3", "Standard_D2s_v3", "Standard_D3", + "Standard_D32_v3", "Standard_D32s_v3", "Standard_D3_v2", "Standard_D3_v2_Promo", "Standard_D4", + "Standard_D4_v2", "Standard_D4_v2_Promo", "Standard_D4_v3", "Standard_D4s_v3", + "Standard_D5_v2", "Standard_D5_v2_Promo", "Standard_D64_v3", "Standard_D64s_v3", + "Standard_D8_v3", "Standard_D8s_v3", "Standard_DS1", "Standard_DS11", "Standard_DS11_v2", + "Standard_DS11_v2_Promo", "Standard_DS12", "Standard_DS12_v2", "Standard_DS12_v2_Promo", + "Standard_DS13", "Standard_DS13-2_v2", "Standard_DS13-4_v2", "Standard_DS13_v2", + "Standard_DS13_v2_Promo", "Standard_DS14", "Standard_DS14-4_v2", "Standard_DS14-8_v2", + "Standard_DS14_v2", "Standard_DS14_v2_Promo", "Standard_DS15_v2", "Standard_DS1_v2", + "Standard_DS2", "Standard_DS2_v2", "Standard_DS2_v2_Promo", "Standard_DS3", "Standard_DS3_v2", + "Standard_DS3_v2_Promo", "Standard_DS4", "Standard_DS4_v2", "Standard_DS4_v2_Promo", + "Standard_DS5_v2", "Standard_DS5_v2_Promo", "Standard_E16_v3", "Standard_E16s_v3", + "Standard_E2_v3", "Standard_E2s_v3", "Standard_E32-16s_v3", "Standard_E32-8s_v3", + "Standard_E32_v3", "Standard_E32s_v3", "Standard_E4_v3", "Standard_E4s_v3", + "Standard_E64-16s_v3", "Standard_E64-32s_v3", "Standard_E64_v3", "Standard_E64s_v3", + "Standard_E8_v3", "Standard_E8s_v3", "Standard_F1", "Standard_F16", "Standard_F16s", + "Standard_F16s_v2", "Standard_F1s", "Standard_F2", "Standard_F2s", "Standard_F2s_v2", + "Standard_F32s_v2", "Standard_F4", "Standard_F4s", "Standard_F4s_v2", "Standard_F64s_v2", + "Standard_F72s_v2", "Standard_F8", "Standard_F8s", "Standard_F8s_v2", "Standard_G1", + "Standard_G2", "Standard_G3", "Standard_G4", "Standard_G5", "Standard_GS1", "Standard_GS2", + "Standard_GS3", "Standard_GS4", "Standard_GS4-4", "Standard_GS4-8", "Standard_GS5", + "Standard_GS5-16", "Standard_GS5-8", "Standard_H16", "Standard_H16m", "Standard_H16mr", + "Standard_H16r", "Standard_H8", "Standard_H8m", "Standard_L16s", "Standard_L32s", + "Standard_L4s", "Standard_L8s", "Standard_M128-32ms", "Standard_M128-64ms", "Standard_M128ms", + "Standard_M128s", "Standard_M64-16ms", "Standard_M64-32ms", "Standard_M64ms", "Standard_M64s", + "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", + "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", + "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". + :paramtype vm_size: str or + ~azure.mgmt.containerservice.v2022_07_01.models.ContainerServiceVMSizeTypes + :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every + machine in this master/agent pool. If you specify 0, it will apply the default osDisk size + according to the vmSize specified. + :paramtype os_disk_size_gb: int + :keyword vnet_subnet_id: VNet SubnetID specifies the VNet's subnet identifier. + :paramtype vnet_subnet_id: str + :keyword first_consecutive_static_ip: FirstConsecutiveStaticIP used to specify the first static + ip of masters. + :paramtype first_consecutive_static_ip: str + :keyword storage_profile: Storage profile specifies what kind of storage used. Choose from + StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the + orchestrator choice. Known values are: "StorageAccount" and "ManagedDisks". + :paramtype storage_profile: str or + ~azure.mgmt.containerservice.v2022_07_01.models.ContainerServiceStorageProfileTypes + """ + super().__init__(**kwargs) + self.count = count + self.dns_prefix = dns_prefix + self.vm_size = vm_size + self.os_disk_size_gb = os_disk_size_gb + self.vnet_subnet_id = vnet_subnet_id + self.first_consecutive_static_ip = first_consecutive_static_ip + self.storage_profile = storage_profile + self.fqdn = None + + +class ContainerServiceNetworkProfile(_serialization.Model): # pylint: disable=too-many-instance-attributes + """Profile of network configuration. + + :ivar network_plugin: Network plugin used for building the Kubernetes network. Known values + are: "azure", "kubenet", and "none". + :vartype network_plugin: str or ~azure.mgmt.containerservice.v2022_07_01.models.NetworkPlugin + :ivar network_policy: Network policy used for building the Kubernetes network. Known values + are: "calico" and "azure". + :vartype network_policy: str or ~azure.mgmt.containerservice.v2022_07_01.models.NetworkPolicy + :ivar network_mode: This cannot be specified if networkPlugin is anything other than 'azure'. + Known values are: "transparent" and "bridge". + :vartype network_mode: str or ~azure.mgmt.containerservice.v2022_07_01.models.NetworkMode + :ivar pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. + :vartype pod_cidr: str + :ivar service_cidr: A CIDR notation IP range from which to assign service cluster IPs. It must + not overlap with any Subnet IP ranges. + :vartype service_cidr: str + :ivar dns_service_ip: An IP address assigned to the Kubernetes DNS service. It must be within + the Kubernetes service address range specified in serviceCidr. + :vartype dns_service_ip: str + :ivar docker_bridge_cidr: A CIDR notation IP range assigned to the Docker bridge network. It + must not overlap with any Subnet IP ranges or the Kubernetes service address range. + :vartype docker_bridge_cidr: str + :ivar outbound_type: This can only be set at cluster creation time and cannot be changed later. + For more information see `egress outbound type + `_. Known values are: "loadBalancer", + "userDefinedRouting", "managedNATGateway", and "userAssignedNATGateway". + :vartype outbound_type: str or ~azure.mgmt.containerservice.v2022_07_01.models.OutboundType + :ivar load_balancer_sku: The default is 'standard'. See `Azure Load Balancer SKUs + `_ for more information about the + differences between load balancer SKUs. Known values are: "standard" and "basic". + :vartype load_balancer_sku: str or + ~azure.mgmt.containerservice.v2022_07_01.models.LoadBalancerSku + :ivar load_balancer_profile: Profile of the cluster load balancer. + :vartype load_balancer_profile: + ~azure.mgmt.containerservice.v2022_07_01.models.ManagedClusterLoadBalancerProfile + :ivar nat_gateway_profile: Profile of the cluster NAT gateway. + :vartype nat_gateway_profile: + ~azure.mgmt.containerservice.v2022_07_01.models.ManagedClusterNATGatewayProfile + :ivar pod_cidrs: One IPv4 CIDR is expected for single-stack networking. Two CIDRs, one for each + IP family (IPv4/IPv6), is expected for dual-stack networking. + :vartype pod_cidrs: list[str] + :ivar service_cidrs: One IPv4 CIDR is expected for single-stack networking. Two CIDRs, one for + each IP family (IPv4/IPv6), is expected for dual-stack networking. They must not overlap with + any Subnet IP ranges. + :vartype service_cidrs: list[str] + :ivar ip_families: IP families are used to determine single-stack or dual-stack clusters. For + single-stack, the expected value is IPv4. For dual-stack, the expected values are IPv4 and + IPv6. + :vartype ip_families: list[str or ~azure.mgmt.containerservice.v2022_07_01.models.IpFamily] + """ + + _validation = { + "pod_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, + "service_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, + "dns_service_ip": { + "pattern": r"^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$" + }, + "docker_bridge_cidr": {"pattern": r"^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$"}, + } + + _attribute_map = { + "network_plugin": {"key": "networkPlugin", "type": "str"}, + "network_policy": {"key": "networkPolicy", "type": "str"}, + "network_mode": {"key": "networkMode", "type": "str"}, + "pod_cidr": {"key": "podCidr", "type": "str"}, + "service_cidr": {"key": "serviceCidr", "type": "str"}, + "dns_service_ip": {"key": "dnsServiceIP", "type": "str"}, + "docker_bridge_cidr": {"key": "dockerBridgeCidr", "type": "str"}, + "outbound_type": {"key": "outboundType", "type": "str"}, + "load_balancer_sku": {"key": "loadBalancerSku", "type": "str"}, + "load_balancer_profile": {"key": "loadBalancerProfile", "type": "ManagedClusterLoadBalancerProfile"}, + "nat_gateway_profile": {"key": "natGatewayProfile", "type": "ManagedClusterNATGatewayProfile"}, + "pod_cidrs": {"key": "podCidrs", "type": "[str]"}, + "service_cidrs": {"key": "serviceCidrs", "type": "[str]"}, + "ip_families": {"key": "ipFamilies", "type": "[str]"}, + } + + def __init__( + self, + *, + network_plugin: Union[str, "_models.NetworkPlugin"] = "kubenet", + network_policy: Optional[Union[str, "_models.NetworkPolicy"]] = None, + network_mode: Optional[Union[str, "_models.NetworkMode"]] = None, + pod_cidr: str = "10.244.0.0/16", + service_cidr: str = "10.0.0.0/16", + dns_service_ip: str = "10.0.0.10", + docker_bridge_cidr: str = "172.17.0.1/16", + outbound_type: Union[str, "_models.OutboundType"] = "loadBalancer", + load_balancer_sku: Optional[Union[str, "_models.LoadBalancerSku"]] = None, + load_balancer_profile: Optional["_models.ManagedClusterLoadBalancerProfile"] = None, + nat_gateway_profile: Optional["_models.ManagedClusterNATGatewayProfile"] = None, + pod_cidrs: Optional[List[str]] = None, + service_cidrs: Optional[List[str]] = None, + ip_families: Optional[List[Union[str, "_models.IpFamily"]]] = None, + **kwargs + ): + """ + :keyword network_plugin: Network plugin used for building the Kubernetes network. Known values + are: "azure", "kubenet", and "none". + :paramtype network_plugin: str or ~azure.mgmt.containerservice.v2022_07_01.models.NetworkPlugin + :keyword network_policy: Network policy used for building the Kubernetes network. Known values + are: "calico" and "azure". + :paramtype network_policy: str or ~azure.mgmt.containerservice.v2022_07_01.models.NetworkPolicy + :keyword network_mode: This cannot be specified if networkPlugin is anything other than + 'azure'. Known values are: "transparent" and "bridge". + :paramtype network_mode: str or ~azure.mgmt.containerservice.v2022_07_01.models.NetworkMode + :keyword pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. + :paramtype pod_cidr: str + :keyword service_cidr: A CIDR notation IP range from which to assign service cluster IPs. It + must not overlap with any Subnet IP ranges. + :paramtype service_cidr: str + :keyword dns_service_ip: An IP address assigned to the Kubernetes DNS service. It must be + within the Kubernetes service address range specified in serviceCidr. + :paramtype dns_service_ip: str + :keyword docker_bridge_cidr: A CIDR notation IP range assigned to the Docker bridge network. It + must not overlap with any Subnet IP ranges or the Kubernetes service address range. + :paramtype docker_bridge_cidr: str + :keyword outbound_type: This can only be set at cluster creation time and cannot be changed + later. For more information see `egress outbound type + `_. Known values are: "loadBalancer", + "userDefinedRouting", "managedNATGateway", and "userAssignedNATGateway". + :paramtype outbound_type: str or ~azure.mgmt.containerservice.v2022_07_01.models.OutboundType + :keyword load_balancer_sku: The default is 'standard'. See `Azure Load Balancer SKUs + `_ for more information about the + differences between load balancer SKUs. Known values are: "standard" and "basic". + :paramtype load_balancer_sku: str or + ~azure.mgmt.containerservice.v2022_07_01.models.LoadBalancerSku + :keyword load_balancer_profile: Profile of the cluster load balancer. + :paramtype load_balancer_profile: + ~azure.mgmt.containerservice.v2022_07_01.models.ManagedClusterLoadBalancerProfile + :keyword nat_gateway_profile: Profile of the cluster NAT gateway. + :paramtype nat_gateway_profile: + ~azure.mgmt.containerservice.v2022_07_01.models.ManagedClusterNATGatewayProfile + :keyword pod_cidrs: One IPv4 CIDR is expected for single-stack networking. Two CIDRs, one for + each IP family (IPv4/IPv6), is expected for dual-stack networking. + :paramtype pod_cidrs: list[str] + :keyword service_cidrs: One IPv4 CIDR is expected for single-stack networking. Two CIDRs, one + for each IP family (IPv4/IPv6), is expected for dual-stack networking. They must not overlap + with any Subnet IP ranges. + :paramtype service_cidrs: list[str] + :keyword ip_families: IP families are used to determine single-stack or dual-stack clusters. + For single-stack, the expected value is IPv4. For dual-stack, the expected values are IPv4 and + IPv6. + :paramtype ip_families: list[str or ~azure.mgmt.containerservice.v2022_07_01.models.IpFamily] + """ + super().__init__(**kwargs) + self.network_plugin = network_plugin + self.network_policy = network_policy + self.network_mode = network_mode + self.pod_cidr = pod_cidr + self.service_cidr = service_cidr + self.dns_service_ip = dns_service_ip + self.docker_bridge_cidr = docker_bridge_cidr + self.outbound_type = outbound_type + self.load_balancer_sku = load_balancer_sku + self.load_balancer_profile = load_balancer_profile + self.nat_gateway_profile = nat_gateway_profile + self.pod_cidrs = pod_cidrs + self.service_cidrs = service_cidrs + self.ip_families = ip_families + + +class ContainerServiceSshConfiguration(_serialization.Model): + """SSH configuration for Linux-based VMs running on Azure. + + All required parameters must be populated in order to send to Azure. + + :ivar public_keys: The list of SSH public keys used to authenticate with Linux-based VMs. A + maximum of 1 key may be specified. Required. + :vartype public_keys: + list[~azure.mgmt.containerservice.v2022_07_01.models.ContainerServiceSshPublicKey] + """ + + _validation = { + "public_keys": {"required": True}, + } + + _attribute_map = { + "public_keys": {"key": "publicKeys", "type": "[ContainerServiceSshPublicKey]"}, + } + + def __init__(self, *, public_keys: List["_models.ContainerServiceSshPublicKey"], **kwargs): + """ + :keyword public_keys: The list of SSH public keys used to authenticate with Linux-based VMs. A + maximum of 1 key may be specified. Required. + :paramtype public_keys: + list[~azure.mgmt.containerservice.v2022_07_01.models.ContainerServiceSshPublicKey] + """ + super().__init__(**kwargs) + self.public_keys = public_keys + + +class ContainerServiceSshPublicKey(_serialization.Model): + """Contains information about SSH certificate public key data. + + All required parameters must be populated in order to send to Azure. + + :ivar key_data: Certificate public key used to authenticate with VMs through SSH. The + certificate must be in PEM format with or without headers. Required. + :vartype key_data: str + """ + + _validation = { + "key_data": {"required": True}, + } + + _attribute_map = { + "key_data": {"key": "keyData", "type": "str"}, + } + + def __init__(self, *, key_data: str, **kwargs): + """ + :keyword key_data: Certificate public key used to authenticate with VMs through SSH. The + certificate must be in PEM format with or without headers. Required. + :paramtype key_data: str + """ + super().__init__(**kwargs) + self.key_data = key_data + + +class ContainerServiceVMDiagnostics(_serialization.Model): + """Profile for diagnostics on the container service VMs. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar enabled: Whether the VM diagnostic agent is provisioned on the VM. Required. + :vartype enabled: bool + :ivar storage_uri: The URI of the storage account where diagnostics are stored. + :vartype storage_uri: str + """ + + _validation = { + "enabled": {"required": True}, + "storage_uri": {"readonly": True}, + } + + _attribute_map = { + "enabled": {"key": "enabled", "type": "bool"}, + "storage_uri": {"key": "storageUri", "type": "str"}, + } + + def __init__(self, *, enabled: bool, **kwargs): + """ + :keyword enabled: Whether the VM diagnostic agent is provisioned on the VM. Required. + :paramtype enabled: bool + """ + super().__init__(**kwargs) + self.enabled = enabled + self.storage_uri = None + + +class CreationData(_serialization.Model): + """Data used when creating a target resource from a source resource. + + :ivar source_resource_id: This is the ARM ID of the source object to be used to create the + target object. + :vartype source_resource_id: str + """ + + _attribute_map = { + "source_resource_id": {"key": "sourceResourceId", "type": "str"}, + } + + def __init__(self, *, source_resource_id: Optional[str] = None, **kwargs): + """ + :keyword source_resource_id: This is the ARM ID of the source object to be used to create the + target object. + :paramtype source_resource_id: str + """ + super().__init__(**kwargs) + self.source_resource_id = source_resource_id + + +class CredentialResult(_serialization.Model): + """The credential result response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: The name of the credential. + :vartype name: str + :ivar value: Base64-encoded Kubernetes configuration file. + :vartype value: bytes + """ + + _validation = { + "name": {"readonly": True}, + "value": {"readonly": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "value": {"key": "value", "type": "bytearray"}, + } + + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) + self.name = None + self.value = None + + +class CredentialResults(_serialization.Model): + """The list credential result response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar kubeconfigs: Base64-encoded Kubernetes configuration file. + :vartype kubeconfigs: list[~azure.mgmt.containerservice.v2022_07_01.models.CredentialResult] + """ + + _validation = { + "kubeconfigs": {"readonly": True}, + } + + _attribute_map = { + "kubeconfigs": {"key": "kubeconfigs", "type": "[CredentialResult]"}, + } + + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) + self.kubeconfigs = None + + +class EndpointDependency(_serialization.Model): + """A domain name that AKS agent nodes are reaching at. + + :ivar domain_name: The domain name of the dependency. + :vartype domain_name: str + :ivar endpoint_details: The Ports and Protocols used when connecting to domainName. + :vartype endpoint_details: list[~azure.mgmt.containerservice.v2022_07_01.models.EndpointDetail] + """ + + _attribute_map = { + "domain_name": {"key": "domainName", "type": "str"}, + "endpoint_details": {"key": "endpointDetails", "type": "[EndpointDetail]"}, + } + + def __init__( + self, + *, + domain_name: Optional[str] = None, + endpoint_details: Optional[List["_models.EndpointDetail"]] = None, + **kwargs + ): + """ + :keyword domain_name: The domain name of the dependency. + :paramtype domain_name: str + :keyword endpoint_details: The Ports and Protocols used when connecting to domainName. + :paramtype endpoint_details: + list[~azure.mgmt.containerservice.v2022_07_01.models.EndpointDetail] + """ + super().__init__(**kwargs) + self.domain_name = domain_name + self.endpoint_details = endpoint_details + + +class EndpointDetail(_serialization.Model): + """connect information from the AKS agent nodes to a single endpoint. + + :ivar ip_address: An IP Address that Domain Name currently resolves to. + :vartype ip_address: str + :ivar port: The port an endpoint is connected to. + :vartype port: int + :ivar protocol: The protocol used for connection. + :vartype protocol: str + :ivar description: Description of the detail. + :vartype description: str + """ + + _attribute_map = { + "ip_address": {"key": "ipAddress", "type": "str"}, + "port": {"key": "port", "type": "int"}, + "protocol": {"key": "protocol", "type": "str"}, + "description": {"key": "description", "type": "str"}, + } + + def __init__( + self, + *, + ip_address: Optional[str] = None, + port: Optional[int] = None, + protocol: Optional[str] = None, + description: Optional[str] = None, + **kwargs + ): + """ + :keyword ip_address: An IP Address that Domain Name currently resolves to. + :paramtype ip_address: str + :keyword port: The port an endpoint is connected to. + :paramtype port: int + :keyword protocol: The protocol used for connection. + :paramtype protocol: str + :keyword description: Description of the detail. + :paramtype description: str + """ + super().__init__(**kwargs) + self.ip_address = ip_address + self.port = port + self.protocol = protocol + self.description = description + + +class ExtendedLocation(_serialization.Model): + """The complex type of the extended location. + + :ivar name: The name of the extended location. + :vartype name: str + :ivar type: The type of the extended location. "EdgeZone" + :vartype type: str or ~azure.mgmt.containerservice.v2022_07_01.models.ExtendedLocationTypes + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + type: Optional[Union[str, "_models.ExtendedLocationTypes"]] = None, + **kwargs + ): + """ + :keyword name: The name of the extended location. + :paramtype name: str + :keyword type: The type of the extended location. "EdgeZone" + :paramtype type: str or ~azure.mgmt.containerservice.v2022_07_01.models.ExtendedLocationTypes + """ + super().__init__(**kwargs) + self.name = name + self.type = type + + +class KubeletConfig(_serialization.Model): # pylint: disable=too-many-instance-attributes + """See `AKS custom node configuration `_ for more details. + + :ivar cpu_manager_policy: The default is 'none'. See `Kubernetes CPU management policies + `_ + for more information. Allowed values are 'none' and 'static'. + :vartype cpu_manager_policy: str + :ivar cpu_cfs_quota: The default is true. + :vartype cpu_cfs_quota: bool + :ivar cpu_cfs_quota_period: The default is '100ms.' Valid values are a sequence of decimal + numbers with an optional fraction and a unit suffix. For example: '300ms', '2h45m'. Supported + units are 'ns', 'us', 'ms', 's', 'm', and 'h'. + :vartype cpu_cfs_quota_period: str + :ivar image_gc_high_threshold: To disable image garbage collection, set to 100. The default is + 85%. + :vartype image_gc_high_threshold: int + :ivar image_gc_low_threshold: This cannot be set higher than imageGcHighThreshold. The default + is 80%. + :vartype image_gc_low_threshold: int + :ivar topology_manager_policy: For more information see `Kubernetes Topology Manager + `_. The default is + 'none'. Allowed values are 'none', 'best-effort', 'restricted', and 'single-numa-node'. + :vartype topology_manager_policy: str + :ivar allowed_unsafe_sysctls: Allowed list of unsafe sysctls or unsafe sysctl patterns (ending + in ``*``\ ). + :vartype allowed_unsafe_sysctls: list[str] + :ivar fail_swap_on: If set to true it will make the Kubelet fail to start if swap is enabled on + the node. + :vartype fail_swap_on: bool + :ivar container_log_max_size_mb: The maximum size (e.g. 10Mi) of container log file before it + is rotated. + :vartype container_log_max_size_mb: int + :ivar container_log_max_files: The maximum number of container log files that can be present + for a container. The number must be ≥ 2. + :vartype container_log_max_files: int + :ivar pod_max_pids: The maximum number of processes per pod. + :vartype pod_max_pids: int + """ + + _validation = { + "container_log_max_files": {"minimum": 2}, + } + + _attribute_map = { + "cpu_manager_policy": {"key": "cpuManagerPolicy", "type": "str"}, + "cpu_cfs_quota": {"key": "cpuCfsQuota", "type": "bool"}, + "cpu_cfs_quota_period": {"key": "cpuCfsQuotaPeriod", "type": "str"}, + "image_gc_high_threshold": {"key": "imageGcHighThreshold", "type": "int"}, + "image_gc_low_threshold": {"key": "imageGcLowThreshold", "type": "int"}, + "topology_manager_policy": {"key": "topologyManagerPolicy", "type": "str"}, + "allowed_unsafe_sysctls": {"key": "allowedUnsafeSysctls", "type": "[str]"}, + "fail_swap_on": {"key": "failSwapOn", "type": "bool"}, + "container_log_max_size_mb": {"key": "containerLogMaxSizeMB", "type": "int"}, + "container_log_max_files": {"key": "containerLogMaxFiles", "type": "int"}, + "pod_max_pids": {"key": "podMaxPids", "type": "int"}, + } + + def __init__( + self, + *, + cpu_manager_policy: Optional[str] = None, + cpu_cfs_quota: Optional[bool] = None, + cpu_cfs_quota_period: Optional[str] = None, + image_gc_high_threshold: Optional[int] = None, + image_gc_low_threshold: Optional[int] = None, + topology_manager_policy: Optional[str] = None, + allowed_unsafe_sysctls: Optional[List[str]] = None, + fail_swap_on: Optional[bool] = None, + container_log_max_size_mb: Optional[int] = None, + container_log_max_files: Optional[int] = None, + pod_max_pids: Optional[int] = None, + **kwargs + ): + """ + :keyword cpu_manager_policy: The default is 'none'. See `Kubernetes CPU management policies + `_ + for more information. Allowed values are 'none' and 'static'. + :paramtype cpu_manager_policy: str + :keyword cpu_cfs_quota: The default is true. + :paramtype cpu_cfs_quota: bool + :keyword cpu_cfs_quota_period: The default is '100ms.' Valid values are a sequence of decimal + numbers with an optional fraction and a unit suffix. For example: '300ms', '2h45m'. Supported + units are 'ns', 'us', 'ms', 's', 'm', and 'h'. + :paramtype cpu_cfs_quota_period: str + :keyword image_gc_high_threshold: To disable image garbage collection, set to 100. The default + is 85%. + :paramtype image_gc_high_threshold: int + :keyword image_gc_low_threshold: This cannot be set higher than imageGcHighThreshold. The + default is 80%. + :paramtype image_gc_low_threshold: int + :keyword topology_manager_policy: For more information see `Kubernetes Topology Manager + `_. The default is + 'none'. Allowed values are 'none', 'best-effort', 'restricted', and 'single-numa-node'. + :paramtype topology_manager_policy: str + :keyword allowed_unsafe_sysctls: Allowed list of unsafe sysctls or unsafe sysctl patterns + (ending in ``*``\ ). + :paramtype allowed_unsafe_sysctls: list[str] + :keyword fail_swap_on: If set to true it will make the Kubelet fail to start if swap is enabled + on the node. + :paramtype fail_swap_on: bool + :keyword container_log_max_size_mb: The maximum size (e.g. 10Mi) of container log file before + it is rotated. + :paramtype container_log_max_size_mb: int + :keyword container_log_max_files: The maximum number of container log files that can be present + for a container. The number must be ≥ 2. + :paramtype container_log_max_files: int + :keyword pod_max_pids: The maximum number of processes per pod. + :paramtype pod_max_pids: int + """ + super().__init__(**kwargs) + self.cpu_manager_policy = cpu_manager_policy + self.cpu_cfs_quota = cpu_cfs_quota + self.cpu_cfs_quota_period = cpu_cfs_quota_period + self.image_gc_high_threshold = image_gc_high_threshold + self.image_gc_low_threshold = image_gc_low_threshold + self.topology_manager_policy = topology_manager_policy + self.allowed_unsafe_sysctls = allowed_unsafe_sysctls + self.fail_swap_on = fail_swap_on + self.container_log_max_size_mb = container_log_max_size_mb + self.container_log_max_files = container_log_max_files + self.pod_max_pids = pod_max_pids + + +class LinuxOSConfig(_serialization.Model): + """See `AKS custom node configuration `_ for more details. + + :ivar sysctls: Sysctl settings for Linux agent nodes. + :vartype sysctls: ~azure.mgmt.containerservice.v2022_07_01.models.SysctlConfig + :ivar transparent_huge_page_enabled: Valid values are 'always', 'madvise', and 'never'. The + default is 'always'. For more information see `Transparent Hugepages + `_. + :vartype transparent_huge_page_enabled: str + :ivar transparent_huge_page_defrag: Valid values are 'always', 'defer', 'defer+madvise', + 'madvise' and 'never'. The default is 'madvise'. For more information see `Transparent + Hugepages + `_. + :vartype transparent_huge_page_defrag: str + :ivar swap_file_size_mb: The size in MB of a swap file that will be created on each node. + :vartype swap_file_size_mb: int + """ + + _attribute_map = { + "sysctls": {"key": "sysctls", "type": "SysctlConfig"}, + "transparent_huge_page_enabled": {"key": "transparentHugePageEnabled", "type": "str"}, + "transparent_huge_page_defrag": {"key": "transparentHugePageDefrag", "type": "str"}, + "swap_file_size_mb": {"key": "swapFileSizeMB", "type": "int"}, + } + + def __init__( + self, + *, + sysctls: Optional["_models.SysctlConfig"] = None, + transparent_huge_page_enabled: Optional[str] = None, + transparent_huge_page_defrag: Optional[str] = None, + swap_file_size_mb: Optional[int] = None, + **kwargs + ): + """ + :keyword sysctls: Sysctl settings for Linux agent nodes. + :paramtype sysctls: ~azure.mgmt.containerservice.v2022_07_01.models.SysctlConfig + :keyword transparent_huge_page_enabled: Valid values are 'always', 'madvise', and 'never'. The + default is 'always'. For more information see `Transparent Hugepages + `_. + :paramtype transparent_huge_page_enabled: str + :keyword transparent_huge_page_defrag: Valid values are 'always', 'defer', 'defer+madvise', + 'madvise' and 'never'. The default is 'madvise'. For more information see `Transparent + Hugepages + `_. + :paramtype transparent_huge_page_defrag: str + :keyword swap_file_size_mb: The size in MB of a swap file that will be created on each node. + :paramtype swap_file_size_mb: int + """ + super().__init__(**kwargs) + self.sysctls = sysctls + self.transparent_huge_page_enabled = transparent_huge_page_enabled + self.transparent_huge_page_defrag = transparent_huge_page_defrag + self.swap_file_size_mb = swap_file_size_mb + + +class MaintenanceConfiguration(SubResource): + """See `planned maintenance `_ for more information about planned maintenance. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: The name of the resource that is unique within a resource group. This name can be + used to access the resource. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar system_data: The system metadata relating to this resource. + :vartype system_data: ~azure.mgmt.containerservice.v2022_07_01.models.SystemData + :ivar time_in_week: If two array entries specify the same day of the week, the applied + configuration is the union of times in both entries. + :vartype time_in_week: list[~azure.mgmt.containerservice.v2022_07_01.models.TimeInWeek] + :ivar not_allowed_time: Time slots on which upgrade is not allowed. + :vartype not_allowed_time: list[~azure.mgmt.containerservice.v2022_07_01.models.TimeSpan] + """ + + _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"}, + "time_in_week": {"key": "properties.timeInWeek", "type": "[TimeInWeek]"}, + "not_allowed_time": {"key": "properties.notAllowedTime", "type": "[TimeSpan]"}, + } + + def __init__( + self, + *, + time_in_week: Optional[List["_models.TimeInWeek"]] = None, + not_allowed_time: Optional[List["_models.TimeSpan"]] = None, + **kwargs + ): + """ + :keyword time_in_week: If two array entries specify the same day of the week, the applied + configuration is the union of times in both entries. + :paramtype time_in_week: list[~azure.mgmt.containerservice.v2022_07_01.models.TimeInWeek] + :keyword not_allowed_time: Time slots on which upgrade is not allowed. + :paramtype not_allowed_time: list[~azure.mgmt.containerservice.v2022_07_01.models.TimeSpan] + """ + super().__init__(**kwargs) + self.system_data = None + self.time_in_week = time_in_week + self.not_allowed_time = not_allowed_time + + +class MaintenanceConfigurationListResult(_serialization.Model): + """The response from the List maintenance configurations operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The list of maintenance configurations. + :vartype value: list[~azure.mgmt.containerservice.v2022_07_01.models.MaintenanceConfiguration] + :ivar next_link: The URL to get the next set of maintenance configuration results. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[MaintenanceConfiguration]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: Optional[List["_models.MaintenanceConfiguration"]] = None, **kwargs): + """ + :keyword value: The list of maintenance configurations. + :paramtype value: + list[~azure.mgmt.containerservice.v2022_07_01.models.MaintenanceConfiguration] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +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}. + :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.containerservice.v2022_07_01.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): + """ """ + 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'. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.containerservice.v2022_07_01.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + } + + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs): + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str + """ + super().__init__(**kwargs) + self.tags = tags + self.location = location + + +class ManagedCluster(TrackedResource): # pylint: disable=too-many-instance-attributes + """Managed cluster. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.containerservice.v2022_07_01.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 sku: The managed cluster SKU. + :vartype sku: ~azure.mgmt.containerservice.v2022_07_01.models.ManagedClusterSKU + :ivar extended_location: The extended location of the Virtual Machine. + :vartype extended_location: ~azure.mgmt.containerservice.v2022_07_01.models.ExtendedLocation + :ivar identity: The identity of the managed cluster, if configured. + :vartype identity: ~azure.mgmt.containerservice.v2022_07_01.models.ManagedClusterIdentity + :ivar provisioning_state: The current provisioning state. + :vartype provisioning_state: str + :ivar power_state: The Power State of the cluster. + :vartype power_state: ~azure.mgmt.containerservice.v2022_07_01.models.PowerState + :ivar max_agent_pools: The max number of agent pools for the managed cluster. + :vartype max_agent_pools: int + :ivar kubernetes_version: Both patch version (e.g. 1.20.13) and + (e.g. 1.20) are supported. When is specified, the latest supported + GA patch version is chosen automatically. Updating the cluster with the same once + it has been created (e.g. 1.14.x -> 1.14) will not trigger an upgrade, even if a newer patch + version is available. When you upgrade a supported AKS cluster, Kubernetes minor versions + cannot be skipped. All upgrades must be performed sequentially by major version number. For + example, upgrades between 1.14.x -> 1.15.x or 1.15.x -> 1.16.x are allowed, however 1.14.x -> + 1.16.x is not allowed. See `upgrading an AKS cluster + `_ for more details. + :vartype kubernetes_version: str + :ivar current_kubernetes_version: If kubernetesVersion was a fully specified version + , this field will be exactly equal to it. If kubernetesVersion was + , this field will contain the full version being used. + :vartype current_kubernetes_version: str + :ivar dns_prefix: This cannot be updated once the Managed Cluster has been created. + :vartype dns_prefix: str + :ivar fqdn_subdomain: This cannot be updated once the Managed Cluster has been created. + :vartype fqdn_subdomain: str + :ivar fqdn: The FQDN of the master pool. + :vartype fqdn: str + :ivar private_fqdn: The FQDN of private cluster. + :vartype private_fqdn: str + :ivar azure_portal_fqdn: The Azure Portal requires certain Cross-Origin Resource Sharing (CORS) + headers to be sent in some responses, which Kubernetes APIServer doesn't handle by default. + This special FQDN supports CORS, allowing the Azure Portal to function properly. + :vartype azure_portal_fqdn: str + :ivar agent_pool_profiles: The agent pool properties. + :vartype agent_pool_profiles: + list[~azure.mgmt.containerservice.v2022_07_01.models.ManagedClusterAgentPoolProfile] + :ivar linux_profile: The profile for Linux VMs in the Managed Cluster. + :vartype linux_profile: + ~azure.mgmt.containerservice.v2022_07_01.models.ContainerServiceLinuxProfile + :ivar windows_profile: The profile for Windows VMs in the Managed Cluster. + :vartype windows_profile: + ~azure.mgmt.containerservice.v2022_07_01.models.ManagedClusterWindowsProfile + :ivar service_principal_profile: Information about a service principal identity for the cluster + to use for manipulating Azure APIs. + :vartype service_principal_profile: + ~azure.mgmt.containerservice.v2022_07_01.models.ManagedClusterServicePrincipalProfile + :ivar addon_profiles: The profile of managed cluster add-on. + :vartype addon_profiles: dict[str, + ~azure.mgmt.containerservice.v2022_07_01.models.ManagedClusterAddonProfile] + :ivar pod_identity_profile: See `use AAD pod identity + `_ for more details on AAD pod + identity integration. + :vartype pod_identity_profile: + ~azure.mgmt.containerservice.v2022_07_01.models.ManagedClusterPodIdentityProfile + :ivar node_resource_group: The name of the resource group containing agent pool nodes. + :vartype node_resource_group: str + :ivar enable_rbac: Whether to enable Kubernetes Role-Based Access Control. + :vartype enable_rbac: bool + :ivar enable_pod_security_policy: (DEPRECATING) Whether to enable Kubernetes pod security + policy (preview). This feature is set for removal on October 15th, 2020. Learn more at + aka.ms/aks/azpodpolicy. + :vartype enable_pod_security_policy: bool + :ivar network_profile: The network configuration profile. + :vartype network_profile: + ~azure.mgmt.containerservice.v2022_07_01.models.ContainerServiceNetworkProfile + :ivar aad_profile: The Azure Active Directory configuration. + :vartype aad_profile: ~azure.mgmt.containerservice.v2022_07_01.models.ManagedClusterAADProfile + :ivar auto_upgrade_profile: The auto upgrade configuration. + :vartype auto_upgrade_profile: + ~azure.mgmt.containerservice.v2022_07_01.models.ManagedClusterAutoUpgradeProfile + :ivar auto_scaler_profile: Parameters to be applied to the cluster-autoscaler when enabled. + :vartype auto_scaler_profile: + ~azure.mgmt.containerservice.v2022_07_01.models.ManagedClusterPropertiesAutoScalerProfile + :ivar api_server_access_profile: The access profile for managed cluster API server. + :vartype api_server_access_profile: + ~azure.mgmt.containerservice.v2022_07_01.models.ManagedClusterAPIServerAccessProfile + :ivar disk_encryption_set_id: This is of the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{encryptionSetName}'. + :vartype disk_encryption_set_id: str + :ivar identity_profile: Identities associated with the cluster. + :vartype identity_profile: dict[str, + ~azure.mgmt.containerservice.v2022_07_01.models.UserAssignedIdentity] + :ivar private_link_resources: Private link resources associated with the cluster. + :vartype private_link_resources: + list[~azure.mgmt.containerservice.v2022_07_01.models.PrivateLinkResource] + :ivar disable_local_accounts: If set to true, getting static credentials will be disabled for + this cluster. This must only be used on Managed Clusters that are AAD enabled. For more details + see `disable local accounts + `_. + :vartype disable_local_accounts: bool + :ivar http_proxy_config: Configurations for provisioning the cluster with HTTP proxy servers. + :vartype http_proxy_config: + ~azure.mgmt.containerservice.v2022_07_01.models.ManagedClusterHTTPProxyConfig + :ivar security_profile: Security profile for the managed cluster. + :vartype security_profile: + ~azure.mgmt.containerservice.v2022_07_01.models.ManagedClusterSecurityProfile + :ivar storage_profile: Storage profile for the managed cluster. + :vartype storage_profile: + ~azure.mgmt.containerservice.v2022_07_01.models.ManagedClusterStorageProfile + :ivar public_network_access: Allow or deny public network access for AKS. Known values are: + "Enabled" and "Disabled". + :vartype public_network_access: str or + ~azure.mgmt.containerservice.v2022_07_01.models.PublicNetworkAccess + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, + "provisioning_state": {"readonly": True}, + "power_state": {"readonly": True}, + "max_agent_pools": {"readonly": True}, + "current_kubernetes_version": {"readonly": True}, + "fqdn": {"readonly": True}, + "private_fqdn": {"readonly": True}, + "azure_portal_fqdn": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "sku": {"key": "sku", "type": "ManagedClusterSKU"}, + "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, + "identity": {"key": "identity", "type": "ManagedClusterIdentity"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "power_state": {"key": "properties.powerState", "type": "PowerState"}, + "max_agent_pools": {"key": "properties.maxAgentPools", "type": "int"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "current_kubernetes_version": {"key": "properties.currentKubernetesVersion", "type": "str"}, + "dns_prefix": {"key": "properties.dnsPrefix", "type": "str"}, + "fqdn_subdomain": {"key": "properties.fqdnSubdomain", "type": "str"}, + "fqdn": {"key": "properties.fqdn", "type": "str"}, + "private_fqdn": {"key": "properties.privateFQDN", "type": "str"}, + "azure_portal_fqdn": {"key": "properties.azurePortalFQDN", "type": "str"}, + "agent_pool_profiles": {"key": "properties.agentPoolProfiles", "type": "[ManagedClusterAgentPoolProfile]"}, + "linux_profile": {"key": "properties.linuxProfile", "type": "ContainerServiceLinuxProfile"}, + "windows_profile": {"key": "properties.windowsProfile", "type": "ManagedClusterWindowsProfile"}, + "service_principal_profile": { + "key": "properties.servicePrincipalProfile", + "type": "ManagedClusterServicePrincipalProfile", + }, + "addon_profiles": {"key": "properties.addonProfiles", "type": "{ManagedClusterAddonProfile}"}, + "pod_identity_profile": {"key": "properties.podIdentityProfile", "type": "ManagedClusterPodIdentityProfile"}, + "node_resource_group": {"key": "properties.nodeResourceGroup", "type": "str"}, + "enable_rbac": {"key": "properties.enableRBAC", "type": "bool"}, + "enable_pod_security_policy": {"key": "properties.enablePodSecurityPolicy", "type": "bool"}, + "network_profile": {"key": "properties.networkProfile", "type": "ContainerServiceNetworkProfile"}, + "aad_profile": {"key": "properties.aadProfile", "type": "ManagedClusterAADProfile"}, + "auto_upgrade_profile": {"key": "properties.autoUpgradeProfile", "type": "ManagedClusterAutoUpgradeProfile"}, + "auto_scaler_profile": { + "key": "properties.autoScalerProfile", + "type": "ManagedClusterPropertiesAutoScalerProfile", + }, + "api_server_access_profile": { + "key": "properties.apiServerAccessProfile", + "type": "ManagedClusterAPIServerAccessProfile", + }, + "disk_encryption_set_id": {"key": "properties.diskEncryptionSetID", "type": "str"}, + "identity_profile": {"key": "properties.identityProfile", "type": "{UserAssignedIdentity}"}, + "private_link_resources": {"key": "properties.privateLinkResources", "type": "[PrivateLinkResource]"}, + "disable_local_accounts": {"key": "properties.disableLocalAccounts", "type": "bool"}, + "http_proxy_config": {"key": "properties.httpProxyConfig", "type": "ManagedClusterHTTPProxyConfig"}, + "security_profile": {"key": "properties.securityProfile", "type": "ManagedClusterSecurityProfile"}, + "storage_profile": {"key": "properties.storageProfile", "type": "ManagedClusterStorageProfile"}, + "public_network_access": {"key": "properties.publicNetworkAccess", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + sku: Optional["_models.ManagedClusterSKU"] = None, + extended_location: Optional["_models.ExtendedLocation"] = None, + identity: Optional["_models.ManagedClusterIdentity"] = None, + kubernetes_version: Optional[str] = None, + dns_prefix: Optional[str] = None, + fqdn_subdomain: Optional[str] = None, + agent_pool_profiles: Optional[List["_models.ManagedClusterAgentPoolProfile"]] = None, + linux_profile: Optional["_models.ContainerServiceLinuxProfile"] = None, + windows_profile: Optional["_models.ManagedClusterWindowsProfile"] = None, + service_principal_profile: Optional["_models.ManagedClusterServicePrincipalProfile"] = None, + addon_profiles: Optional[Dict[str, "_models.ManagedClusterAddonProfile"]] = None, + pod_identity_profile: Optional["_models.ManagedClusterPodIdentityProfile"] = None, + node_resource_group: Optional[str] = None, + enable_rbac: Optional[bool] = None, + enable_pod_security_policy: Optional[bool] = None, + network_profile: Optional["_models.ContainerServiceNetworkProfile"] = None, + aad_profile: Optional["_models.ManagedClusterAADProfile"] = None, + auto_upgrade_profile: Optional["_models.ManagedClusterAutoUpgradeProfile"] = None, + auto_scaler_profile: Optional["_models.ManagedClusterPropertiesAutoScalerProfile"] = None, + api_server_access_profile: Optional["_models.ManagedClusterAPIServerAccessProfile"] = None, + disk_encryption_set_id: Optional[str] = None, + identity_profile: Optional[Dict[str, "_models.UserAssignedIdentity"]] = None, + private_link_resources: Optional[List["_models.PrivateLinkResource"]] = None, + disable_local_accounts: Optional[bool] = None, + http_proxy_config: Optional["_models.ManagedClusterHTTPProxyConfig"] = None, + security_profile: Optional["_models.ManagedClusterSecurityProfile"] = None, + storage_profile: Optional["_models.ManagedClusterStorageProfile"] = None, + public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = None, + **kwargs + ): + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str + :keyword sku: The managed cluster SKU. + :paramtype sku: ~azure.mgmt.containerservice.v2022_07_01.models.ManagedClusterSKU + :keyword extended_location: The extended location of the Virtual Machine. + :paramtype extended_location: ~azure.mgmt.containerservice.v2022_07_01.models.ExtendedLocation + :keyword identity: The identity of the managed cluster, if configured. + :paramtype identity: ~azure.mgmt.containerservice.v2022_07_01.models.ManagedClusterIdentity + :keyword kubernetes_version: Both patch version (e.g. 1.20.13) and + (e.g. 1.20) are supported. When is specified, the latest supported + GA patch version is chosen automatically. Updating the cluster with the same once + it has been created (e.g. 1.14.x -> 1.14) will not trigger an upgrade, even if a newer patch + version is available. When you upgrade a supported AKS cluster, Kubernetes minor versions + cannot be skipped. All upgrades must be performed sequentially by major version number. For + example, upgrades between 1.14.x -> 1.15.x or 1.15.x -> 1.16.x are allowed, however 1.14.x -> + 1.16.x is not allowed. See `upgrading an AKS cluster + `_ for more details. + :paramtype kubernetes_version: str + :keyword dns_prefix: This cannot be updated once the Managed Cluster has been created. + :paramtype dns_prefix: str + :keyword fqdn_subdomain: This cannot be updated once the Managed Cluster has been created. + :paramtype fqdn_subdomain: str + :keyword agent_pool_profiles: The agent pool properties. + :paramtype agent_pool_profiles: + list[~azure.mgmt.containerservice.v2022_07_01.models.ManagedClusterAgentPoolProfile] + :keyword linux_profile: The profile for Linux VMs in the Managed Cluster. + :paramtype linux_profile: + ~azure.mgmt.containerservice.v2022_07_01.models.ContainerServiceLinuxProfile + :keyword windows_profile: The profile for Windows VMs in the Managed Cluster. + :paramtype windows_profile: + ~azure.mgmt.containerservice.v2022_07_01.models.ManagedClusterWindowsProfile + :keyword service_principal_profile: Information about a service principal identity for the + cluster to use for manipulating Azure APIs. + :paramtype service_principal_profile: + ~azure.mgmt.containerservice.v2022_07_01.models.ManagedClusterServicePrincipalProfile + :keyword addon_profiles: The profile of managed cluster add-on. + :paramtype addon_profiles: dict[str, + ~azure.mgmt.containerservice.v2022_07_01.models.ManagedClusterAddonProfile] + :keyword pod_identity_profile: See `use AAD pod identity + `_ for more details on AAD pod + identity integration. + :paramtype pod_identity_profile: + ~azure.mgmt.containerservice.v2022_07_01.models.ManagedClusterPodIdentityProfile + :keyword node_resource_group: The name of the resource group containing agent pool nodes. + :paramtype node_resource_group: str + :keyword enable_rbac: Whether to enable Kubernetes Role-Based Access Control. + :paramtype enable_rbac: bool + :keyword enable_pod_security_policy: (DEPRECATING) Whether to enable Kubernetes pod security + policy (preview). This feature is set for removal on October 15th, 2020. Learn more at + aka.ms/aks/azpodpolicy. + :paramtype enable_pod_security_policy: bool + :keyword network_profile: The network configuration profile. + :paramtype network_profile: + ~azure.mgmt.containerservice.v2022_07_01.models.ContainerServiceNetworkProfile + :keyword aad_profile: The Azure Active Directory configuration. + :paramtype aad_profile: + ~azure.mgmt.containerservice.v2022_07_01.models.ManagedClusterAADProfile + :keyword auto_upgrade_profile: The auto upgrade configuration. + :paramtype auto_upgrade_profile: + ~azure.mgmt.containerservice.v2022_07_01.models.ManagedClusterAutoUpgradeProfile + :keyword auto_scaler_profile: Parameters to be applied to the cluster-autoscaler when enabled. + :paramtype auto_scaler_profile: + ~azure.mgmt.containerservice.v2022_07_01.models.ManagedClusterPropertiesAutoScalerProfile + :keyword api_server_access_profile: The access profile for managed cluster API server. + :paramtype api_server_access_profile: + ~azure.mgmt.containerservice.v2022_07_01.models.ManagedClusterAPIServerAccessProfile + :keyword disk_encryption_set_id: This is of the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{encryptionSetName}'. + :paramtype disk_encryption_set_id: str + :keyword identity_profile: Identities associated with the cluster. + :paramtype identity_profile: dict[str, + ~azure.mgmt.containerservice.v2022_07_01.models.UserAssignedIdentity] + :keyword private_link_resources: Private link resources associated with the cluster. + :paramtype private_link_resources: + list[~azure.mgmt.containerservice.v2022_07_01.models.PrivateLinkResource] + :keyword disable_local_accounts: If set to true, getting static credentials will be disabled + for this cluster. This must only be used on Managed Clusters that are AAD enabled. For more + details see `disable local accounts + `_. + :paramtype disable_local_accounts: bool + :keyword http_proxy_config: Configurations for provisioning the cluster with HTTP proxy + servers. + :paramtype http_proxy_config: + ~azure.mgmt.containerservice.v2022_07_01.models.ManagedClusterHTTPProxyConfig + :keyword security_profile: Security profile for the managed cluster. + :paramtype security_profile: + ~azure.mgmt.containerservice.v2022_07_01.models.ManagedClusterSecurityProfile + :keyword storage_profile: Storage profile for the managed cluster. + :paramtype storage_profile: + ~azure.mgmt.containerservice.v2022_07_01.models.ManagedClusterStorageProfile + :keyword public_network_access: Allow or deny public network access for AKS. Known values are: + "Enabled" and "Disabled". + :paramtype public_network_access: str or + ~azure.mgmt.containerservice.v2022_07_01.models.PublicNetworkAccess + """ + super().__init__(tags=tags, location=location, **kwargs) + self.sku = sku + self.extended_location = extended_location + self.identity = identity + self.provisioning_state = None + self.power_state = None + self.max_agent_pools = None + self.kubernetes_version = kubernetes_version + self.current_kubernetes_version = None + self.dns_prefix = dns_prefix + self.fqdn_subdomain = fqdn_subdomain + self.fqdn = None + self.private_fqdn = None + self.azure_portal_fqdn = None + self.agent_pool_profiles = agent_pool_profiles + self.linux_profile = linux_profile + self.windows_profile = windows_profile + self.service_principal_profile = service_principal_profile + self.addon_profiles = addon_profiles + self.pod_identity_profile = pod_identity_profile + self.node_resource_group = node_resource_group + self.enable_rbac = enable_rbac + self.enable_pod_security_policy = enable_pod_security_policy + self.network_profile = network_profile + self.aad_profile = aad_profile + self.auto_upgrade_profile = auto_upgrade_profile + self.auto_scaler_profile = auto_scaler_profile + self.api_server_access_profile = api_server_access_profile + self.disk_encryption_set_id = disk_encryption_set_id + self.identity_profile = identity_profile + self.private_link_resources = private_link_resources + self.disable_local_accounts = disable_local_accounts + self.http_proxy_config = http_proxy_config + self.security_profile = security_profile + self.storage_profile = storage_profile + self.public_network_access = public_network_access + + +class ManagedClusterAADProfile(_serialization.Model): + """For more details see `managed AAD on AKS `_. + + :ivar managed: Whether to enable managed AAD. + :vartype managed: bool + :ivar enable_azure_rbac: Whether to enable Azure RBAC for Kubernetes authorization. + :vartype enable_azure_rbac: bool + :ivar admin_group_object_i_ds: The list of AAD group object IDs that will have admin role of + the cluster. + :vartype admin_group_object_i_ds: list[str] + :ivar client_app_id: The client AAD application ID. + :vartype client_app_id: str + :ivar server_app_id: The server AAD application ID. + :vartype server_app_id: str + :ivar server_app_secret: The server AAD application secret. + :vartype server_app_secret: str + :ivar tenant_id: The AAD tenant ID to use for authentication. If not specified, will use the + tenant of the deployment subscription. + :vartype tenant_id: str + """ + + _attribute_map = { + "managed": {"key": "managed", "type": "bool"}, + "enable_azure_rbac": {"key": "enableAzureRBAC", "type": "bool"}, + "admin_group_object_i_ds": {"key": "adminGroupObjectIDs", "type": "[str]"}, + "client_app_id": {"key": "clientAppID", "type": "str"}, + "server_app_id": {"key": "serverAppID", "type": "str"}, + "server_app_secret": {"key": "serverAppSecret", "type": "str"}, + "tenant_id": {"key": "tenantID", "type": "str"}, + } + + def __init__( + self, + *, + managed: Optional[bool] = None, + enable_azure_rbac: Optional[bool] = None, + admin_group_object_i_ds: Optional[List[str]] = None, + client_app_id: Optional[str] = None, + server_app_id: Optional[str] = None, + server_app_secret: Optional[str] = None, + tenant_id: Optional[str] = None, + **kwargs + ): + """ + :keyword managed: Whether to enable managed AAD. + :paramtype managed: bool + :keyword enable_azure_rbac: Whether to enable Azure RBAC for Kubernetes authorization. + :paramtype enable_azure_rbac: bool + :keyword admin_group_object_i_ds: The list of AAD group object IDs that will have admin role of + the cluster. + :paramtype admin_group_object_i_ds: list[str] + :keyword client_app_id: The client AAD application ID. + :paramtype client_app_id: str + :keyword server_app_id: The server AAD application ID. + :paramtype server_app_id: str + :keyword server_app_secret: The server AAD application secret. + :paramtype server_app_secret: str + :keyword tenant_id: The AAD tenant ID to use for authentication. If not specified, will use the + tenant of the deployment subscription. + :paramtype tenant_id: str + """ + super().__init__(**kwargs) + self.managed = managed + self.enable_azure_rbac = enable_azure_rbac + self.admin_group_object_i_ds = admin_group_object_i_ds + self.client_app_id = client_app_id + self.server_app_id = server_app_id + self.server_app_secret = server_app_secret + self.tenant_id = tenant_id + + +class ManagedClusterAccessProfile(TrackedResource): + """Managed cluster Access Profile. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.containerservice.v2022_07_01.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 kube_config: Base64-encoded Kubernetes configuration file. + :vartype kube_config: bytes + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "kube_config": {"key": "properties.kubeConfig", "type": "bytearray"}, + } + + def __init__( + self, *, location: str, tags: Optional[Dict[str, str]] = None, kube_config: Optional[bytes] = None, **kwargs + ): + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str + :keyword kube_config: Base64-encoded Kubernetes configuration file. + :paramtype kube_config: bytes + """ + super().__init__(tags=tags, location=location, **kwargs) + self.kube_config = kube_config + + +class ManagedClusterAddonProfile(_serialization.Model): + """A Kubernetes add-on profile for a managed cluster. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar enabled: Whether the add-on is enabled or not. Required. + :vartype enabled: bool + :ivar config: Key-value pairs for configuring an add-on. + :vartype config: dict[str, str] + :ivar identity: Information of user assigned identity used by this add-on. + :vartype identity: + ~azure.mgmt.containerservice.v2022_07_01.models.ManagedClusterAddonProfileIdentity + """ + + _validation = { + "enabled": {"required": True}, + "identity": {"readonly": True}, + } + + _attribute_map = { + "enabled": {"key": "enabled", "type": "bool"}, + "config": {"key": "config", "type": "{str}"}, + "identity": {"key": "identity", "type": "ManagedClusterAddonProfileIdentity"}, + } + + def __init__(self, *, enabled: bool, config: Optional[Dict[str, str]] = None, **kwargs): + """ + :keyword enabled: Whether the add-on is enabled or not. Required. + :paramtype enabled: bool + :keyword config: Key-value pairs for configuring an add-on. + :paramtype config: dict[str, str] + """ + super().__init__(**kwargs) + self.enabled = enabled + self.config = config + self.identity = None + + +class UserAssignedIdentity(_serialization.Model): + """Details about a user assigned identity. + + :ivar resource_id: The resource ID of the user assigned identity. + :vartype resource_id: str + :ivar client_id: The client ID of the user assigned identity. + :vartype client_id: str + :ivar object_id: The object ID of the user assigned identity. + :vartype object_id: str + """ + + _attribute_map = { + "resource_id": {"key": "resourceId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + "object_id": {"key": "objectId", "type": "str"}, + } + + def __init__( + self, + *, + resource_id: Optional[str] = None, + client_id: Optional[str] = None, + object_id: Optional[str] = None, + **kwargs + ): + """ + :keyword resource_id: The resource ID of the user assigned identity. + :paramtype resource_id: str + :keyword client_id: The client ID of the user assigned identity. + :paramtype client_id: str + :keyword object_id: The object ID of the user assigned identity. + :paramtype object_id: str + """ + super().__init__(**kwargs) + self.resource_id = resource_id + self.client_id = client_id + self.object_id = object_id + + +class ManagedClusterAddonProfileIdentity(UserAssignedIdentity): + """Information of user assigned identity used by this add-on. + + :ivar resource_id: The resource ID of the user assigned identity. + :vartype resource_id: str + :ivar client_id: The client ID of the user assigned identity. + :vartype client_id: str + :ivar object_id: The object ID of the user assigned identity. + :vartype object_id: str + """ + + _attribute_map = { + "resource_id": {"key": "resourceId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + "object_id": {"key": "objectId", "type": "str"}, + } + + def __init__( + self, + *, + resource_id: Optional[str] = None, + client_id: Optional[str] = None, + object_id: Optional[str] = None, + **kwargs + ): + """ + :keyword resource_id: The resource ID of the user assigned identity. + :paramtype resource_id: str + :keyword client_id: The client ID of the user assigned identity. + :paramtype client_id: str + :keyword object_id: The object ID of the user assigned identity. + :paramtype object_id: str + """ + super().__init__(resource_id=resource_id, client_id=client_id, object_id=object_id, **kwargs) + + +class ManagedClusterAgentPoolProfileProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes + """Properties for the container service agent pool profile. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar count: Number of agents (VMs) to host docker containers. Allowed values must be in the + range of 0 to 1000 (inclusive) for user pools and in the range of 1 to 1000 (inclusive) for + system pools. The default value is 1. + :vartype count: int + :ivar vm_size: VM size availability varies by region. If a node contains insufficient compute + resources (memory, cpu, etc) pods might fail to run correctly. For more details on restricted + VM sizes, see: https://docs.microsoft.com/azure/aks/quotas-skus-regions. + :vartype vm_size: str + :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine + in the master/agent pool. If you specify 0, it will apply the default osDisk size according to + the vmSize specified. + :vartype os_disk_size_gb: int + :ivar os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk + larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed + after creation. For more information see `Ephemeral OS + `_. Known values are: + "Managed" and "Ephemeral". + :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2022_07_01.models.OSDiskType + :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data + root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". + :vartype kubelet_disk_type: str or + ~azure.mgmt.containerservice.v2022_07_01.models.KubeletDiskType + :ivar workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer" and "WasmWasi". + :vartype workload_runtime: str or + ~azure.mgmt.containerservice.v2022_07_01.models.WorkloadRuntime + :ivar vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and used. + If no podSubnetID is specified, this applies to nodes and pods, otherwise it applies to just + nodes. This is of the form: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. + :vartype vnet_subnet_id: str + :ivar pod_subnet_id: If omitted, pod IPs are statically assigned on the node subnet (see + vnetSubnetID for more details). This is of the form: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. + :vartype pod_subnet_id: str + :ivar max_pods: The maximum number of pods that can run on a node. + :vartype max_pods: int + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". + :vartype os_type: str or ~azure.mgmt.containerservice.v2022_07_01.models.OSType + :ivar os_sku: Specifies the OS SKU used by the agent pool. The default is Ubuntu if OSType is + Linux. The default is Windows2019 when Kubernetes <= 1.24 or Windows2022 when Kubernetes >= + 1.25 if OSType is Windows. Known values are: "Ubuntu", "CBLMariner", "Windows2019", and + "Windows2022". + :vartype os_sku: str or ~azure.mgmt.containerservice.v2022_07_01.models.OSSKU + :ivar max_count: The maximum number of nodes for auto-scaling. + :vartype max_count: int + :ivar min_count: The minimum number of nodes for auto-scaling. + :vartype min_count: int + :ivar enable_auto_scaling: Whether to enable auto-scaler. + :vartype enable_auto_scaling: bool + :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it + defaults to Delete. Known values are: "Delete" and "Deallocate". + :vartype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_07_01.models.ScaleDownMode + :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets" and + "AvailabilitySet". + :vartype type: str or ~azure.mgmt.containerservice.v2022_07_01.models.AgentPoolType + :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional + information on agent pool restrictions and best practices, see: + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". + :vartype mode: str or ~azure.mgmt.containerservice.v2022_07_01.models.AgentPoolMode + :ivar orchestrator_version: Both patch version (e.g. 1.20.13) and + (e.g. 1.20) are supported. When is specified, the latest supported + GA patch version is chosen automatically. Updating the cluster with the same once + it has been created (e.g. 1.14.x -> 1.14) will not trigger an upgrade, even if a newer patch + version is available. As a best practice, you should upgrade all node pools in an AKS cluster + to the same Kubernetes version. The node pool version must have the same major version as the + control plane. The node pool minor version must be within two minor versions of the control + plane version. The node pool version cannot be greater than the control plane version. For more + information see `upgrading a node pool + `_. + :vartype orchestrator_version: str + :ivar current_orchestrator_version: If orchestratorVersion is a fully specified version + , this field will be exactly equal to it. If orchestratorVersion is + , this field will contain the full version being used. + :vartype current_orchestrator_version: str + :ivar node_image_version: The version of node image. + :vartype node_image_version: str + :ivar upgrade_settings: Settings for upgrading the agentpool. + :vartype upgrade_settings: + ~azure.mgmt.containerservice.v2022_07_01.models.AgentPoolUpgradeSettings + :ivar provisioning_state: The current deployment or provisioning state. + :vartype provisioning_state: str + :ivar power_state: When an Agent Pool is first created it is initially Running. The Agent Pool + can be stopped by setting this field to Stopped. A stopped Agent Pool stops all of its VMs and + does not accrue billing charges. An Agent Pool can only be stopped if it is Running and + provisioning state is Succeeded. + :vartype power_state: ~azure.mgmt.containerservice.v2022_07_01.models.PowerState + :ivar availability_zones: The list of Availability zones to use for nodes. This can only be + specified if the AgentPoolType property is 'VirtualMachineScaleSets'. + :vartype availability_zones: list[str] + :ivar enable_node_public_ip: Some scenarios may require nodes in a node pool to receive their + own dedicated public IP addresses. A common scenario is for gaming workloads, where a console + needs to make a direct connection to a cloud virtual machine to minimize hops. For more + information see `assigning a public IP per node + `_. + The default is false. + :vartype enable_node_public_ip: bool + :ivar node_public_ip_prefix_id: This is of the form: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. + :vartype node_public_ip_prefix_id: str + :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default + is 'Regular'. Known values are: "Spot" and "Regular". + :vartype scale_set_priority: str or + ~azure.mgmt.containerservice.v2022_07_01.models.ScaleSetPriority + :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". + :vartype scale_set_eviction_policy: str or + ~azure.mgmt.containerservice.v2022_07_01.models.ScaleSetEvictionPolicy + :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which + indicates the willingness to pay any on-demand price. For more details on spot pricing, see + `spot VMs pricing `_. + :vartype spot_max_price: float + :ivar tags: The tags to be persisted on the agent pool virtual machine scale set. + :vartype tags: dict[str, str] + :ivar node_labels: The node labels to be persisted across all nodes in agent pool. + :vartype node_labels: dict[str, str] + :ivar node_taints: The taints added to new nodes during node pool create and scale. For + example, key=value:NoSchedule. + :vartype node_taints: list[str] + :ivar proximity_placement_group_id: The ID for Proximity Placement Group. + :vartype proximity_placement_group_id: str + :ivar kubelet_config: The Kubelet configuration on the agent pool nodes. + :vartype kubelet_config: ~azure.mgmt.containerservice.v2022_07_01.models.KubeletConfig + :ivar linux_os_config: The OS configuration of Linux agent nodes. + :vartype linux_os_config: ~azure.mgmt.containerservice.v2022_07_01.models.LinuxOSConfig + :ivar enable_encryption_at_host: This is only supported on certain VM sizes and in certain + Azure regions. For more information, see: + https://docs.microsoft.com/azure/aks/enable-host-encryption. + :vartype enable_encryption_at_host: bool + :ivar enable_ultra_ssd: Whether to enable UltraSSD. + :vartype enable_ultra_ssd: bool + :ivar enable_fips: See `Add a FIPS-enabled node pool + `_ + for more details. + :vartype enable_fips: bool + :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". + :vartype gpu_instance_profile: str or + ~azure.mgmt.containerservice.v2022_07_01.models.GPUInstanceProfile + :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the node pool + will be created/upgraded using a snapshot. + :vartype creation_data: ~azure.mgmt.containerservice.v2022_07_01.models.CreationData + :ivar host_group_id: This is of the form: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}. + For more information see `Azure dedicated hosts + `_. + :vartype host_group_id: str + """ + + _validation = { + "os_disk_size_gb": {"maximum": 2048, "minimum": 0}, + "current_orchestrator_version": {"readonly": True}, + "node_image_version": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "count": {"key": "count", "type": "int"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "os_disk_type": {"key": "osDiskType", "type": "str"}, + "kubelet_disk_type": {"key": "kubeletDiskType", "type": "str"}, + "workload_runtime": {"key": "workloadRuntime", "type": "str"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "pod_subnet_id": {"key": "podSubnetID", "type": "str"}, + "max_pods": {"key": "maxPods", "type": "int"}, + "os_type": {"key": "osType", "type": "str"}, + "os_sku": {"key": "osSKU", "type": "str"}, + "max_count": {"key": "maxCount", "type": "int"}, + "min_count": {"key": "minCount", "type": "int"}, + "enable_auto_scaling": {"key": "enableAutoScaling", "type": "bool"}, + "scale_down_mode": {"key": "scaleDownMode", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "mode": {"key": "mode", "type": "str"}, + "orchestrator_version": {"key": "orchestratorVersion", "type": "str"}, + "current_orchestrator_version": {"key": "currentOrchestratorVersion", "type": "str"}, + "node_image_version": {"key": "nodeImageVersion", "type": "str"}, + "upgrade_settings": {"key": "upgradeSettings", "type": "AgentPoolUpgradeSettings"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "power_state": {"key": "powerState", "type": "PowerState"}, + "availability_zones": {"key": "availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "enableNodePublicIP", "type": "bool"}, + "node_public_ip_prefix_id": {"key": "nodePublicIPPrefixID", "type": "str"}, + "scale_set_priority": {"key": "scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "scaleSetEvictionPolicy", "type": "str"}, + "spot_max_price": {"key": "spotMaxPrice", "type": "float"}, + "tags": {"key": "tags", "type": "{str}"}, + "node_labels": {"key": "nodeLabels", "type": "{str}"}, + "node_taints": {"key": "nodeTaints", "type": "[str]"}, + "proximity_placement_group_id": {"key": "proximityPlacementGroupID", "type": "str"}, + "kubelet_config": {"key": "kubeletConfig", "type": "KubeletConfig"}, + "linux_os_config": {"key": "linuxOSConfig", "type": "LinuxOSConfig"}, + "enable_encryption_at_host": {"key": "enableEncryptionAtHost", "type": "bool"}, + "enable_ultra_ssd": {"key": "enableUltraSSD", "type": "bool"}, + "enable_fips": {"key": "enableFIPS", "type": "bool"}, + "gpu_instance_profile": {"key": "gpuInstanceProfile", "type": "str"}, + "creation_data": {"key": "creationData", "type": "CreationData"}, + "host_group_id": {"key": "hostGroupID", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals + self, + *, + count: Optional[int] = None, + vm_size: Optional[str] = None, + os_disk_size_gb: Optional[int] = None, + os_disk_type: Optional[Union[str, "_models.OSDiskType"]] = None, + kubelet_disk_type: Optional[Union[str, "_models.KubeletDiskType"]] = None, + workload_runtime: Optional[Union[str, "_models.WorkloadRuntime"]] = None, + vnet_subnet_id: Optional[str] = None, + pod_subnet_id: Optional[str] = None, + max_pods: Optional[int] = None, + os_type: Union[str, "_models.OSType"] = "Linux", + os_sku: Optional[Union[str, "_models.OSSKU"]] = None, + max_count: Optional[int] = None, + min_count: Optional[int] = None, + enable_auto_scaling: Optional[bool] = None, + scale_down_mode: Optional[Union[str, "_models.ScaleDownMode"]] = None, + type: Optional[Union[str, "_models.AgentPoolType"]] = None, + mode: Optional[Union[str, "_models.AgentPoolMode"]] = None, + orchestrator_version: Optional[str] = None, + upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, + power_state: Optional["_models.PowerState"] = None, + availability_zones: Optional[List[str]] = None, + enable_node_public_ip: Optional[bool] = None, + node_public_ip_prefix_id: Optional[str] = None, + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", + spot_max_price: float = -1, + tags: Optional[Dict[str, str]] = None, + node_labels: Optional[Dict[str, str]] = None, + node_taints: Optional[List[str]] = None, + proximity_placement_group_id: Optional[str] = None, + kubelet_config: Optional["_models.KubeletConfig"] = None, + linux_os_config: Optional["_models.LinuxOSConfig"] = None, + enable_encryption_at_host: Optional[bool] = None, + enable_ultra_ssd: Optional[bool] = None, + enable_fips: Optional[bool] = None, + gpu_instance_profile: Optional[Union[str, "_models.GPUInstanceProfile"]] = None, + creation_data: Optional["_models.CreationData"] = None, + host_group_id: Optional[str] = None, + **kwargs + ): + """ + :keyword count: Number of agents (VMs) to host docker containers. Allowed values must be in the + range of 0 to 1000 (inclusive) for user pools and in the range of 1 to 1000 (inclusive) for + system pools. The default value is 1. + :paramtype count: int + :keyword vm_size: VM size availability varies by region. If a node contains insufficient + compute resources (memory, cpu, etc) pods might fail to run correctly. For more details on + restricted VM sizes, see: https://docs.microsoft.com/azure/aks/quotas-skus-regions. + :paramtype vm_size: str + :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every + machine in the master/agent pool. If you specify 0, it will apply the default osDisk size + according to the vmSize specified. + :paramtype os_disk_size_gb: int + :keyword os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk + larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed + after creation. For more information see `Ephemeral OS + `_. Known values are: + "Managed" and "Ephemeral". + :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2022_07_01.models.OSDiskType + :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime + data root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". + :paramtype kubelet_disk_type: str or + ~azure.mgmt.containerservice.v2022_07_01.models.KubeletDiskType + :keyword workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer" and "WasmWasi". + :paramtype workload_runtime: str or + ~azure.mgmt.containerservice.v2022_07_01.models.WorkloadRuntime + :keyword vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and + used. If no podSubnetID is specified, this applies to nodes and pods, otherwise it applies to + just nodes. This is of the form: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. + :paramtype vnet_subnet_id: str + :keyword pod_subnet_id: If omitted, pod IPs are statically assigned on the node subnet (see + vnetSubnetID for more details). This is of the form: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. + :paramtype pod_subnet_id: str + :keyword max_pods: The maximum number of pods that can run on a node. + :paramtype max_pods: int + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". + :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_07_01.models.OSType + :keyword os_sku: Specifies the OS SKU used by the agent pool. The default is Ubuntu if OSType + is Linux. The default is Windows2019 when Kubernetes <= 1.24 or Windows2022 when Kubernetes >= + 1.25 if OSType is Windows. Known values are: "Ubuntu", "CBLMariner", "Windows2019", and + "Windows2022". + :paramtype os_sku: str or ~azure.mgmt.containerservice.v2022_07_01.models.OSSKU + :keyword max_count: The maximum number of nodes for auto-scaling. + :paramtype max_count: int + :keyword min_count: The minimum number of nodes for auto-scaling. + :paramtype min_count: int + :keyword enable_auto_scaling: Whether to enable auto-scaler. + :paramtype enable_auto_scaling: bool + :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, + it defaults to Delete. Known values are: "Delete" and "Deallocate". + :paramtype scale_down_mode: str or + ~azure.mgmt.containerservice.v2022_07_01.models.ScaleDownMode + :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets" and + "AvailabilitySet". + :paramtype type: str or ~azure.mgmt.containerservice.v2022_07_01.models.AgentPoolType + :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For + additional information on agent pool restrictions and best practices, see: + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". + :paramtype mode: str or ~azure.mgmt.containerservice.v2022_07_01.models.AgentPoolMode + :keyword orchestrator_version: Both patch version (e.g. 1.20.13) and + (e.g. 1.20) are supported. When is specified, the latest supported + GA patch version is chosen automatically. Updating the cluster with the same once + it has been created (e.g. 1.14.x -> 1.14) will not trigger an upgrade, even if a newer patch + version is available. As a best practice, you should upgrade all node pools in an AKS cluster + to the same Kubernetes version. The node pool version must have the same major version as the + control plane. The node pool minor version must be within two minor versions of the control + plane version. The node pool version cannot be greater than the control plane version. For more + information see `upgrading a node pool + `_. + :paramtype orchestrator_version: str + :keyword upgrade_settings: Settings for upgrading the agentpool. + :paramtype upgrade_settings: + ~azure.mgmt.containerservice.v2022_07_01.models.AgentPoolUpgradeSettings + :keyword power_state: When an Agent Pool is first created it is initially Running. The Agent + Pool can be stopped by setting this field to Stopped. A stopped Agent Pool stops all of its VMs + and does not accrue billing charges. An Agent Pool can only be stopped if it is Running and + provisioning state is Succeeded. + :paramtype power_state: ~azure.mgmt.containerservice.v2022_07_01.models.PowerState + :keyword availability_zones: The list of Availability zones to use for nodes. This can only be + specified if the AgentPoolType property is 'VirtualMachineScaleSets'. + :paramtype availability_zones: list[str] + :keyword enable_node_public_ip: Some scenarios may require nodes in a node pool to receive + their own dedicated public IP addresses. A common scenario is for gaming workloads, where a + console needs to make a direct connection to a cloud virtual machine to minimize hops. For more + information see `assigning a public IP per node + `_. + The default is false. + :paramtype enable_node_public_ip: bool + :keyword node_public_ip_prefix_id: This is of the form: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. + :paramtype node_public_ip_prefix_id: str + :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the + default is 'Regular'. Known values are: "Spot" and "Regular". + :paramtype scale_set_priority: str or + ~azure.mgmt.containerservice.v2022_07_01.models.ScaleSetPriority + :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". + :paramtype scale_set_eviction_policy: str or + ~azure.mgmt.containerservice.v2022_07_01.models.ScaleSetEvictionPolicy + :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which + indicates the willingness to pay any on-demand price. For more details on spot pricing, see + `spot VMs pricing `_. + :paramtype spot_max_price: float + :keyword tags: The tags to be persisted on the agent pool virtual machine scale set. + :paramtype tags: dict[str, str] + :keyword node_labels: The node labels to be persisted across all nodes in agent pool. + :paramtype node_labels: dict[str, str] + :keyword node_taints: The taints added to new nodes during node pool create and scale. For + example, key=value:NoSchedule. + :paramtype node_taints: list[str] + :keyword proximity_placement_group_id: The ID for Proximity Placement Group. + :paramtype proximity_placement_group_id: str + :keyword kubelet_config: The Kubelet configuration on the agent pool nodes. + :paramtype kubelet_config: ~azure.mgmt.containerservice.v2022_07_01.models.KubeletConfig + :keyword linux_os_config: The OS configuration of Linux agent nodes. + :paramtype linux_os_config: ~azure.mgmt.containerservice.v2022_07_01.models.LinuxOSConfig + :keyword enable_encryption_at_host: This is only supported on certain VM sizes and in certain + Azure regions. For more information, see: + https://docs.microsoft.com/azure/aks/enable-host-encryption. + :paramtype enable_encryption_at_host: bool + :keyword enable_ultra_ssd: Whether to enable UltraSSD. + :paramtype enable_ultra_ssd: bool + :keyword enable_fips: See `Add a FIPS-enabled node pool + `_ + for more details. + :paramtype enable_fips: bool + :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and + "MIG7g". + :paramtype gpu_instance_profile: str or + ~azure.mgmt.containerservice.v2022_07_01.models.GPUInstanceProfile + :keyword creation_data: CreationData to be used to specify the source Snapshot ID if the node + pool will be created/upgraded using a snapshot. + :paramtype creation_data: ~azure.mgmt.containerservice.v2022_07_01.models.CreationData + :keyword host_group_id: This is of the form: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}. + For more information see `Azure dedicated hosts + `_. + :paramtype host_group_id: str + """ + super().__init__(**kwargs) + self.count = count + self.vm_size = vm_size + self.os_disk_size_gb = os_disk_size_gb + self.os_disk_type = os_disk_type + self.kubelet_disk_type = kubelet_disk_type + self.workload_runtime = workload_runtime + self.vnet_subnet_id = vnet_subnet_id + self.pod_subnet_id = pod_subnet_id + self.max_pods = max_pods + self.os_type = os_type + self.os_sku = os_sku + self.max_count = max_count + self.min_count = min_count + self.enable_auto_scaling = enable_auto_scaling + self.scale_down_mode = scale_down_mode + self.type = type + self.mode = mode + self.orchestrator_version = orchestrator_version + self.current_orchestrator_version = None + self.node_image_version = None + self.upgrade_settings = upgrade_settings + self.provisioning_state = None + self.power_state = power_state + self.availability_zones = availability_zones + self.enable_node_public_ip = enable_node_public_ip + self.node_public_ip_prefix_id = node_public_ip_prefix_id + self.scale_set_priority = scale_set_priority + self.scale_set_eviction_policy = scale_set_eviction_policy + self.spot_max_price = spot_max_price + self.tags = tags + self.node_labels = node_labels + self.node_taints = node_taints + self.proximity_placement_group_id = proximity_placement_group_id + self.kubelet_config = kubelet_config + self.linux_os_config = linux_os_config + self.enable_encryption_at_host = enable_encryption_at_host + self.enable_ultra_ssd = enable_ultra_ssd + self.enable_fips = enable_fips + self.gpu_instance_profile = gpu_instance_profile + self.creation_data = creation_data + self.host_group_id = host_group_id + + +class ManagedClusterAgentPoolProfile( + ManagedClusterAgentPoolProfileProperties +): # pylint: disable=too-many-instance-attributes + """Profile for the container service agent pool. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar count: Number of agents (VMs) to host docker containers. Allowed values must be in the + range of 0 to 1000 (inclusive) for user pools and in the range of 1 to 1000 (inclusive) for + system pools. The default value is 1. + :vartype count: int + :ivar vm_size: VM size availability varies by region. If a node contains insufficient compute + resources (memory, cpu, etc) pods might fail to run correctly. For more details on restricted + VM sizes, see: https://docs.microsoft.com/azure/aks/quotas-skus-regions. + :vartype vm_size: str + :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine + in the master/agent pool. If you specify 0, it will apply the default osDisk size according to + the vmSize specified. + :vartype os_disk_size_gb: int + :ivar os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk + larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed + after creation. For more information see `Ephemeral OS + `_. Known values are: + "Managed" and "Ephemeral". + :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2022_07_01.models.OSDiskType + :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data + root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". + :vartype kubelet_disk_type: str or + ~azure.mgmt.containerservice.v2022_07_01.models.KubeletDiskType + :ivar workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer" and "WasmWasi". + :vartype workload_runtime: str or + ~azure.mgmt.containerservice.v2022_07_01.models.WorkloadRuntime + :ivar vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and used. + If no podSubnetID is specified, this applies to nodes and pods, otherwise it applies to just + nodes. This is of the form: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. + :vartype vnet_subnet_id: str + :ivar pod_subnet_id: If omitted, pod IPs are statically assigned on the node subnet (see + vnetSubnetID for more details). This is of the form: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. + :vartype pod_subnet_id: str + :ivar max_pods: The maximum number of pods that can run on a node. + :vartype max_pods: int + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". + :vartype os_type: str or ~azure.mgmt.containerservice.v2022_07_01.models.OSType + :ivar os_sku: Specifies the OS SKU used by the agent pool. The default is Ubuntu if OSType is + Linux. The default is Windows2019 when Kubernetes <= 1.24 or Windows2022 when Kubernetes >= + 1.25 if OSType is Windows. Known values are: "Ubuntu", "CBLMariner", "Windows2019", and + "Windows2022". + :vartype os_sku: str or ~azure.mgmt.containerservice.v2022_07_01.models.OSSKU + :ivar max_count: The maximum number of nodes for auto-scaling. + :vartype max_count: int + :ivar min_count: The minimum number of nodes for auto-scaling. + :vartype min_count: int + :ivar enable_auto_scaling: Whether to enable auto-scaler. + :vartype enable_auto_scaling: bool + :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it + defaults to Delete. Known values are: "Delete" and "Deallocate". + :vartype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_07_01.models.ScaleDownMode + :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets" and + "AvailabilitySet". + :vartype type: str or ~azure.mgmt.containerservice.v2022_07_01.models.AgentPoolType + :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional + information on agent pool restrictions and best practices, see: + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". + :vartype mode: str or ~azure.mgmt.containerservice.v2022_07_01.models.AgentPoolMode + :ivar orchestrator_version: Both patch version (e.g. 1.20.13) and + (e.g. 1.20) are supported. When is specified, the latest supported + GA patch version is chosen automatically. Updating the cluster with the same once + it has been created (e.g. 1.14.x -> 1.14) will not trigger an upgrade, even if a newer patch + version is available. As a best practice, you should upgrade all node pools in an AKS cluster + to the same Kubernetes version. The node pool version must have the same major version as the + control plane. The node pool minor version must be within two minor versions of the control + plane version. The node pool version cannot be greater than the control plane version. For more + information see `upgrading a node pool + `_. + :vartype orchestrator_version: str + :ivar current_orchestrator_version: If orchestratorVersion is a fully specified version + , this field will be exactly equal to it. If orchestratorVersion is + , this field will contain the full version being used. + :vartype current_orchestrator_version: str + :ivar node_image_version: The version of node image. + :vartype node_image_version: str + :ivar upgrade_settings: Settings for upgrading the agentpool. + :vartype upgrade_settings: + ~azure.mgmt.containerservice.v2022_07_01.models.AgentPoolUpgradeSettings + :ivar provisioning_state: The current deployment or provisioning state. + :vartype provisioning_state: str + :ivar power_state: When an Agent Pool is first created it is initially Running. The Agent Pool + can be stopped by setting this field to Stopped. A stopped Agent Pool stops all of its VMs and + does not accrue billing charges. An Agent Pool can only be stopped if it is Running and + provisioning state is Succeeded. + :vartype power_state: ~azure.mgmt.containerservice.v2022_07_01.models.PowerState + :ivar availability_zones: The list of Availability zones to use for nodes. This can only be + specified if the AgentPoolType property is 'VirtualMachineScaleSets'. + :vartype availability_zones: list[str] + :ivar enable_node_public_ip: Some scenarios may require nodes in a node pool to receive their + own dedicated public IP addresses. A common scenario is for gaming workloads, where a console + needs to make a direct connection to a cloud virtual machine to minimize hops. For more + information see `assigning a public IP per node + `_. + The default is false. + :vartype enable_node_public_ip: bool + :ivar node_public_ip_prefix_id: This is of the form: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. + :vartype node_public_ip_prefix_id: str + :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default + is 'Regular'. Known values are: "Spot" and "Regular". + :vartype scale_set_priority: str or + ~azure.mgmt.containerservice.v2022_07_01.models.ScaleSetPriority + :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". + :vartype scale_set_eviction_policy: str or + ~azure.mgmt.containerservice.v2022_07_01.models.ScaleSetEvictionPolicy + :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which + indicates the willingness to pay any on-demand price. For more details on spot pricing, see + `spot VMs pricing `_. + :vartype spot_max_price: float + :ivar tags: The tags to be persisted on the agent pool virtual machine scale set. + :vartype tags: dict[str, str] + :ivar node_labels: The node labels to be persisted across all nodes in agent pool. + :vartype node_labels: dict[str, str] + :ivar node_taints: The taints added to new nodes during node pool create and scale. For + example, key=value:NoSchedule. + :vartype node_taints: list[str] + :ivar proximity_placement_group_id: The ID for Proximity Placement Group. + :vartype proximity_placement_group_id: str + :ivar kubelet_config: The Kubelet configuration on the agent pool nodes. + :vartype kubelet_config: ~azure.mgmt.containerservice.v2022_07_01.models.KubeletConfig + :ivar linux_os_config: The OS configuration of Linux agent nodes. + :vartype linux_os_config: ~azure.mgmt.containerservice.v2022_07_01.models.LinuxOSConfig + :ivar enable_encryption_at_host: This is only supported on certain VM sizes and in certain + Azure regions. For more information, see: + https://docs.microsoft.com/azure/aks/enable-host-encryption. + :vartype enable_encryption_at_host: bool + :ivar enable_ultra_ssd: Whether to enable UltraSSD. + :vartype enable_ultra_ssd: bool + :ivar enable_fips: See `Add a FIPS-enabled node pool + `_ + for more details. + :vartype enable_fips: bool + :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". + :vartype gpu_instance_profile: str or + ~azure.mgmt.containerservice.v2022_07_01.models.GPUInstanceProfile + :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the node pool + will be created/upgraded using a snapshot. + :vartype creation_data: ~azure.mgmt.containerservice.v2022_07_01.models.CreationData + :ivar host_group_id: This is of the form: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}. + For more information see `Azure dedicated hosts + `_. + :vartype host_group_id: str + :ivar name: Windows agent pool names must be 6 characters or less. Required. + :vartype name: str + """ + + _validation = { + "os_disk_size_gb": {"maximum": 2048, "minimum": 0}, + "current_orchestrator_version": {"readonly": True}, + "node_image_version": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "name": {"required": True, "pattern": r"^[a-z][a-z0-9]{0,11}$"}, + } + + _attribute_map = { + "count": {"key": "count", "type": "int"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "os_disk_type": {"key": "osDiskType", "type": "str"}, + "kubelet_disk_type": {"key": "kubeletDiskType", "type": "str"}, + "workload_runtime": {"key": "workloadRuntime", "type": "str"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "pod_subnet_id": {"key": "podSubnetID", "type": "str"}, + "max_pods": {"key": "maxPods", "type": "int"}, + "os_type": {"key": "osType", "type": "str"}, + "os_sku": {"key": "osSKU", "type": "str"}, + "max_count": {"key": "maxCount", "type": "int"}, + "min_count": {"key": "minCount", "type": "int"}, + "enable_auto_scaling": {"key": "enableAutoScaling", "type": "bool"}, + "scale_down_mode": {"key": "scaleDownMode", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "mode": {"key": "mode", "type": "str"}, + "orchestrator_version": {"key": "orchestratorVersion", "type": "str"}, + "current_orchestrator_version": {"key": "currentOrchestratorVersion", "type": "str"}, + "node_image_version": {"key": "nodeImageVersion", "type": "str"}, + "upgrade_settings": {"key": "upgradeSettings", "type": "AgentPoolUpgradeSettings"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "power_state": {"key": "powerState", "type": "PowerState"}, + "availability_zones": {"key": "availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "enableNodePublicIP", "type": "bool"}, + "node_public_ip_prefix_id": {"key": "nodePublicIPPrefixID", "type": "str"}, + "scale_set_priority": {"key": "scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "scaleSetEvictionPolicy", "type": "str"}, + "spot_max_price": {"key": "spotMaxPrice", "type": "float"}, + "tags": {"key": "tags", "type": "{str}"}, + "node_labels": {"key": "nodeLabels", "type": "{str}"}, + "node_taints": {"key": "nodeTaints", "type": "[str]"}, + "proximity_placement_group_id": {"key": "proximityPlacementGroupID", "type": "str"}, + "kubelet_config": {"key": "kubeletConfig", "type": "KubeletConfig"}, + "linux_os_config": {"key": "linuxOSConfig", "type": "LinuxOSConfig"}, + "enable_encryption_at_host": {"key": "enableEncryptionAtHost", "type": "bool"}, + "enable_ultra_ssd": {"key": "enableUltraSSD", "type": "bool"}, + "enable_fips": {"key": "enableFIPS", "type": "bool"}, + "gpu_instance_profile": {"key": "gpuInstanceProfile", "type": "str"}, + "creation_data": {"key": "creationData", "type": "CreationData"}, + "host_group_id": {"key": "hostGroupID", "type": "str"}, + "name": {"key": "name", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals + self, + *, + name: str, + count: Optional[int] = None, + vm_size: Optional[str] = None, + os_disk_size_gb: Optional[int] = None, + os_disk_type: Optional[Union[str, "_models.OSDiskType"]] = None, + kubelet_disk_type: Optional[Union[str, "_models.KubeletDiskType"]] = None, + workload_runtime: Optional[Union[str, "_models.WorkloadRuntime"]] = None, + vnet_subnet_id: Optional[str] = None, + pod_subnet_id: Optional[str] = None, + max_pods: Optional[int] = None, + os_type: Union[str, "_models.OSType"] = "Linux", + os_sku: Optional[Union[str, "_models.OSSKU"]] = None, + max_count: Optional[int] = None, + min_count: Optional[int] = None, + enable_auto_scaling: Optional[bool] = None, + scale_down_mode: Optional[Union[str, "_models.ScaleDownMode"]] = None, + type: Optional[Union[str, "_models.AgentPoolType"]] = None, + mode: Optional[Union[str, "_models.AgentPoolMode"]] = None, + orchestrator_version: Optional[str] = None, + upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, + power_state: Optional["_models.PowerState"] = None, + availability_zones: Optional[List[str]] = None, + enable_node_public_ip: Optional[bool] = None, + node_public_ip_prefix_id: Optional[str] = None, + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", + spot_max_price: float = -1, + tags: Optional[Dict[str, str]] = None, + node_labels: Optional[Dict[str, str]] = None, + node_taints: Optional[List[str]] = None, + proximity_placement_group_id: Optional[str] = None, + kubelet_config: Optional["_models.KubeletConfig"] = None, + linux_os_config: Optional["_models.LinuxOSConfig"] = None, + enable_encryption_at_host: Optional[bool] = None, + enable_ultra_ssd: Optional[bool] = None, + enable_fips: Optional[bool] = None, + gpu_instance_profile: Optional[Union[str, "_models.GPUInstanceProfile"]] = None, + creation_data: Optional["_models.CreationData"] = None, + host_group_id: Optional[str] = None, + **kwargs + ): + """ + :keyword count: Number of agents (VMs) to host docker containers. Allowed values must be in the + range of 0 to 1000 (inclusive) for user pools and in the range of 1 to 1000 (inclusive) for + system pools. The default value is 1. + :paramtype count: int + :keyword vm_size: VM size availability varies by region. If a node contains insufficient + compute resources (memory, cpu, etc) pods might fail to run correctly. For more details on + restricted VM sizes, see: https://docs.microsoft.com/azure/aks/quotas-skus-regions. + :paramtype vm_size: str + :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every + machine in the master/agent pool. If you specify 0, it will apply the default osDisk size + according to the vmSize specified. + :paramtype os_disk_size_gb: int + :keyword os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk + larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed + after creation. For more information see `Ephemeral OS + `_. Known values are: + "Managed" and "Ephemeral". + :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2022_07_01.models.OSDiskType + :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime + data root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". + :paramtype kubelet_disk_type: str or + ~azure.mgmt.containerservice.v2022_07_01.models.KubeletDiskType + :keyword workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer" and "WasmWasi". + :paramtype workload_runtime: str or + ~azure.mgmt.containerservice.v2022_07_01.models.WorkloadRuntime + :keyword vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and + used. If no podSubnetID is specified, this applies to nodes and pods, otherwise it applies to + just nodes. This is of the form: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. + :paramtype vnet_subnet_id: str + :keyword pod_subnet_id: If omitted, pod IPs are statically assigned on the node subnet (see + vnetSubnetID for more details). This is of the form: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. + :paramtype pod_subnet_id: str + :keyword max_pods: The maximum number of pods that can run on a node. + :paramtype max_pods: int + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". + :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_07_01.models.OSType + :keyword os_sku: Specifies the OS SKU used by the agent pool. The default is Ubuntu if OSType + is Linux. The default is Windows2019 when Kubernetes <= 1.24 or Windows2022 when Kubernetes >= + 1.25 if OSType is Windows. Known values are: "Ubuntu", "CBLMariner", "Windows2019", and + "Windows2022". + :paramtype os_sku: str or ~azure.mgmt.containerservice.v2022_07_01.models.OSSKU + :keyword max_count: The maximum number of nodes for auto-scaling. + :paramtype max_count: int + :keyword min_count: The minimum number of nodes for auto-scaling. + :paramtype min_count: int + :keyword enable_auto_scaling: Whether to enable auto-scaler. + :paramtype enable_auto_scaling: bool + :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, + it defaults to Delete. Known values are: "Delete" and "Deallocate". + :paramtype scale_down_mode: str or + ~azure.mgmt.containerservice.v2022_07_01.models.ScaleDownMode + :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets" and + "AvailabilitySet". + :paramtype type: str or ~azure.mgmt.containerservice.v2022_07_01.models.AgentPoolType + :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For + additional information on agent pool restrictions and best practices, see: + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". + :paramtype mode: str or ~azure.mgmt.containerservice.v2022_07_01.models.AgentPoolMode + :keyword orchestrator_version: Both patch version (e.g. 1.20.13) and + (e.g. 1.20) are supported. When is specified, the latest supported + GA patch version is chosen automatically. Updating the cluster with the same once + it has been created (e.g. 1.14.x -> 1.14) will not trigger an upgrade, even if a newer patch + version is available. As a best practice, you should upgrade all node pools in an AKS cluster + to the same Kubernetes version. The node pool version must have the same major version as the + control plane. The node pool minor version must be within two minor versions of the control + plane version. The node pool version cannot be greater than the control plane version. For more + information see `upgrading a node pool + `_. + :paramtype orchestrator_version: str + :keyword upgrade_settings: Settings for upgrading the agentpool. + :paramtype upgrade_settings: + ~azure.mgmt.containerservice.v2022_07_01.models.AgentPoolUpgradeSettings + :keyword power_state: When an Agent Pool is first created it is initially Running. The Agent + Pool can be stopped by setting this field to Stopped. A stopped Agent Pool stops all of its VMs + and does not accrue billing charges. An Agent Pool can only be stopped if it is Running and + provisioning state is Succeeded. + :paramtype power_state: ~azure.mgmt.containerservice.v2022_07_01.models.PowerState + :keyword availability_zones: The list of Availability zones to use for nodes. This can only be + specified if the AgentPoolType property is 'VirtualMachineScaleSets'. + :paramtype availability_zones: list[str] + :keyword enable_node_public_ip: Some scenarios may require nodes in a node pool to receive + their own dedicated public IP addresses. A common scenario is for gaming workloads, where a + console needs to make a direct connection to a cloud virtual machine to minimize hops. For more + information see `assigning a public IP per node + `_. + The default is false. + :paramtype enable_node_public_ip: bool + :keyword node_public_ip_prefix_id: This is of the form: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. + :paramtype node_public_ip_prefix_id: str + :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the + default is 'Regular'. Known values are: "Spot" and "Regular". + :paramtype scale_set_priority: str or + ~azure.mgmt.containerservice.v2022_07_01.models.ScaleSetPriority + :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". + :paramtype scale_set_eviction_policy: str or + ~azure.mgmt.containerservice.v2022_07_01.models.ScaleSetEvictionPolicy + :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which + indicates the willingness to pay any on-demand price. For more details on spot pricing, see + `spot VMs pricing `_. + :paramtype spot_max_price: float + :keyword tags: The tags to be persisted on the agent pool virtual machine scale set. + :paramtype tags: dict[str, str] + :keyword node_labels: The node labels to be persisted across all nodes in agent pool. + :paramtype node_labels: dict[str, str] + :keyword node_taints: The taints added to new nodes during node pool create and scale. For + example, key=value:NoSchedule. + :paramtype node_taints: list[str] + :keyword proximity_placement_group_id: The ID for Proximity Placement Group. + :paramtype proximity_placement_group_id: str + :keyword kubelet_config: The Kubelet configuration on the agent pool nodes. + :paramtype kubelet_config: ~azure.mgmt.containerservice.v2022_07_01.models.KubeletConfig + :keyword linux_os_config: The OS configuration of Linux agent nodes. + :paramtype linux_os_config: ~azure.mgmt.containerservice.v2022_07_01.models.LinuxOSConfig + :keyword enable_encryption_at_host: This is only supported on certain VM sizes and in certain + Azure regions. For more information, see: + https://docs.microsoft.com/azure/aks/enable-host-encryption. + :paramtype enable_encryption_at_host: bool + :keyword enable_ultra_ssd: Whether to enable UltraSSD. + :paramtype enable_ultra_ssd: bool + :keyword enable_fips: See `Add a FIPS-enabled node pool + `_ + for more details. + :paramtype enable_fips: bool + :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and + "MIG7g". + :paramtype gpu_instance_profile: str or + ~azure.mgmt.containerservice.v2022_07_01.models.GPUInstanceProfile + :keyword creation_data: CreationData to be used to specify the source Snapshot ID if the node + pool will be created/upgraded using a snapshot. + :paramtype creation_data: ~azure.mgmt.containerservice.v2022_07_01.models.CreationData + :keyword host_group_id: This is of the form: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}. + For more information see `Azure dedicated hosts + `_. + :paramtype host_group_id: str + :keyword name: Windows agent pool names must be 6 characters or less. Required. + :paramtype name: str + """ + super().__init__( + count=count, + vm_size=vm_size, + os_disk_size_gb=os_disk_size_gb, + os_disk_type=os_disk_type, + kubelet_disk_type=kubelet_disk_type, + workload_runtime=workload_runtime, + vnet_subnet_id=vnet_subnet_id, + pod_subnet_id=pod_subnet_id, + max_pods=max_pods, + os_type=os_type, + os_sku=os_sku, + max_count=max_count, + min_count=min_count, + enable_auto_scaling=enable_auto_scaling, + scale_down_mode=scale_down_mode, + type=type, + mode=mode, + orchestrator_version=orchestrator_version, + upgrade_settings=upgrade_settings, + power_state=power_state, + availability_zones=availability_zones, + enable_node_public_ip=enable_node_public_ip, + node_public_ip_prefix_id=node_public_ip_prefix_id, + scale_set_priority=scale_set_priority, + scale_set_eviction_policy=scale_set_eviction_policy, + spot_max_price=spot_max_price, + tags=tags, + node_labels=node_labels, + node_taints=node_taints, + proximity_placement_group_id=proximity_placement_group_id, + kubelet_config=kubelet_config, + linux_os_config=linux_os_config, + enable_encryption_at_host=enable_encryption_at_host, + enable_ultra_ssd=enable_ultra_ssd, + enable_fips=enable_fips, + gpu_instance_profile=gpu_instance_profile, + creation_data=creation_data, + host_group_id=host_group_id, + **kwargs + ) + self.name = name + + +class ManagedClusterAPIServerAccessProfile(_serialization.Model): + """Access profile for managed cluster API server. + + :ivar authorized_ip_ranges: IP ranges are specified in CIDR format, e.g. 137.117.106.88/29. + This feature is not compatible with clusters that use Public IP Per Node, or clusters that are + using a Basic Load Balancer. For more information see `API server authorized IP ranges + `_. + :vartype authorized_ip_ranges: list[str] + :ivar enable_private_cluster: For more details, see `Creating a private AKS cluster + `_. + :vartype enable_private_cluster: bool + :ivar private_dns_zone: The default is System. For more details see `configure private DNS zone + `_. Allowed + values are 'system' and 'none'. + :vartype private_dns_zone: str + :ivar enable_private_cluster_public_fqdn: Whether to create additional public FQDN for private + cluster or not. + :vartype enable_private_cluster_public_fqdn: bool + :ivar disable_run_command: Whether to disable run command for the cluster or not. + :vartype disable_run_command: bool + """ + + _attribute_map = { + "authorized_ip_ranges": {"key": "authorizedIPRanges", "type": "[str]"}, + "enable_private_cluster": {"key": "enablePrivateCluster", "type": "bool"}, + "private_dns_zone": {"key": "privateDNSZone", "type": "str"}, + "enable_private_cluster_public_fqdn": {"key": "enablePrivateClusterPublicFQDN", "type": "bool"}, + "disable_run_command": {"key": "disableRunCommand", "type": "bool"}, + } + + def __init__( + self, + *, + authorized_ip_ranges: Optional[List[str]] = None, + enable_private_cluster: Optional[bool] = None, + private_dns_zone: Optional[str] = None, + enable_private_cluster_public_fqdn: Optional[bool] = None, + disable_run_command: Optional[bool] = None, + **kwargs + ): + """ + :keyword authorized_ip_ranges: IP ranges are specified in CIDR format, e.g. 137.117.106.88/29. + This feature is not compatible with clusters that use Public IP Per Node, or clusters that are + using a Basic Load Balancer. For more information see `API server authorized IP ranges + `_. + :paramtype authorized_ip_ranges: list[str] + :keyword enable_private_cluster: For more details, see `Creating a private AKS cluster + `_. + :paramtype enable_private_cluster: bool + :keyword private_dns_zone: The default is System. For more details see `configure private DNS + zone `_. + Allowed values are 'system' and 'none'. + :paramtype private_dns_zone: str + :keyword enable_private_cluster_public_fqdn: Whether to create additional public FQDN for + private cluster or not. + :paramtype enable_private_cluster_public_fqdn: bool + :keyword disable_run_command: Whether to disable run command for the cluster or not. + :paramtype disable_run_command: bool + """ + super().__init__(**kwargs) + self.authorized_ip_ranges = authorized_ip_ranges + self.enable_private_cluster = enable_private_cluster + self.private_dns_zone = private_dns_zone + self.enable_private_cluster_public_fqdn = enable_private_cluster_public_fqdn + self.disable_run_command = disable_run_command + + +class ManagedClusterAutoUpgradeProfile(_serialization.Model): + """Auto upgrade profile for a managed cluster. + + :ivar upgrade_channel: For more information see `setting the AKS cluster auto-upgrade channel + `_. Known values + are: "rapid", "stable", "patch", "node-image", and "none". + :vartype upgrade_channel: str or ~azure.mgmt.containerservice.v2022_07_01.models.UpgradeChannel + """ + + _attribute_map = { + "upgrade_channel": {"key": "upgradeChannel", "type": "str"}, + } + + def __init__(self, *, upgrade_channel: Optional[Union[str, "_models.UpgradeChannel"]] = None, **kwargs): + """ + :keyword upgrade_channel: For more information see `setting the AKS cluster auto-upgrade + channel `_. + Known values are: "rapid", "stable", "patch", "node-image", and "none". + :paramtype upgrade_channel: str or + ~azure.mgmt.containerservice.v2022_07_01.models.UpgradeChannel + """ + super().__init__(**kwargs) + self.upgrade_channel = upgrade_channel + + +class ManagedClusterHTTPProxyConfig(_serialization.Model): + """Cluster HTTP proxy configuration. + + :ivar http_proxy: The HTTP proxy server endpoint to use. + :vartype http_proxy: str + :ivar https_proxy: The HTTPS proxy server endpoint to use. + :vartype https_proxy: str + :ivar no_proxy: The endpoints that should not go through proxy. + :vartype no_proxy: list[str] + :ivar trusted_ca: Alternative CA cert to use for connecting to proxy servers. + :vartype trusted_ca: str + """ + + _attribute_map = { + "http_proxy": {"key": "httpProxy", "type": "str"}, + "https_proxy": {"key": "httpsProxy", "type": "str"}, + "no_proxy": {"key": "noProxy", "type": "[str]"}, + "trusted_ca": {"key": "trustedCa", "type": "str"}, + } + + def __init__( + self, + *, + http_proxy: Optional[str] = None, + https_proxy: Optional[str] = None, + no_proxy: Optional[List[str]] = None, + trusted_ca: Optional[str] = None, + **kwargs + ): + """ + :keyword http_proxy: The HTTP proxy server endpoint to use. + :paramtype http_proxy: str + :keyword https_proxy: The HTTPS proxy server endpoint to use. + :paramtype https_proxy: str + :keyword no_proxy: The endpoints that should not go through proxy. + :paramtype no_proxy: list[str] + :keyword trusted_ca: Alternative CA cert to use for connecting to proxy servers. + :paramtype trusted_ca: str + """ + super().__init__(**kwargs) + self.http_proxy = http_proxy + self.https_proxy = https_proxy + self.no_proxy = no_proxy + self.trusted_ca = trusted_ca + + +class ManagedClusterIdentity(_serialization.Model): + """Identity for the managed cluster. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The principal id of the system assigned identity which is used by master + components. + :vartype principal_id: str + :ivar tenant_id: The tenant id of the system assigned identity which is used by master + components. + :vartype tenant_id: str + :ivar type: For more information see `use managed identities in AKS + `_. Known values are: + "SystemAssigned", "UserAssigned", and "None". + :vartype type: str or ~azure.mgmt.containerservice.v2022_07_01.models.ResourceIdentityType + :ivar user_assigned_identities: The keys must be ARM resource IDs in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + :vartype user_assigned_identities: dict[str, + ~azure.mgmt.containerservice.v2022_07_01.models.ManagedServiceIdentityUserAssignedIdentitiesValue] + """ + + _validation = { + "principal_id": {"readonly": True}, + "tenant_id": {"readonly": True}, + } + + _attribute_map = { + "principal_id": {"key": "principalId", "type": "str"}, + "tenant_id": {"key": "tenantId", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "user_assigned_identities": { + "key": "userAssignedIdentities", + "type": "{ManagedServiceIdentityUserAssignedIdentitiesValue}", + }, + } + + def __init__( + self, + *, + type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, + user_assigned_identities: Optional[ + Dict[str, "_models.ManagedServiceIdentityUserAssignedIdentitiesValue"] + ] = None, + **kwargs + ): + """ + :keyword type: For more information see `use managed identities in AKS + `_. Known values are: + "SystemAssigned", "UserAssigned", and "None". + :paramtype type: str or ~azure.mgmt.containerservice.v2022_07_01.models.ResourceIdentityType + :keyword user_assigned_identities: The keys must be ARM resource IDs in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + :paramtype user_assigned_identities: dict[str, + ~azure.mgmt.containerservice.v2022_07_01.models.ManagedServiceIdentityUserAssignedIdentitiesValue] + """ + super().__init__(**kwargs) + self.principal_id = None + self.tenant_id = None + self.type = type + self.user_assigned_identities = user_assigned_identities + + +class ManagedClusterListResult(_serialization.Model): + """The response from the List Managed Clusters operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The list of managed clusters. + :vartype value: list[~azure.mgmt.containerservice.v2022_07_01.models.ManagedCluster] + :ivar next_link: The URL to get the next set of managed cluster results. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[ManagedCluster]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: Optional[List["_models.ManagedCluster"]] = None, **kwargs): + """ + :keyword value: The list of managed clusters. + :paramtype value: list[~azure.mgmt.containerservice.v2022_07_01.models.ManagedCluster] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class ManagedClusterLoadBalancerProfile(_serialization.Model): + """Profile of the managed cluster load balancer. + + :ivar managed_outbound_i_ps: Desired managed outbound IPs for the cluster load balancer. + :vartype managed_outbound_i_ps: + ~azure.mgmt.containerservice.v2022_07_01.models.ManagedClusterLoadBalancerProfileManagedOutboundIPs + :ivar outbound_ip_prefixes: Desired outbound IP Prefix resources for the cluster load balancer. + :vartype outbound_ip_prefixes: + ~azure.mgmt.containerservice.v2022_07_01.models.ManagedClusterLoadBalancerProfileOutboundIPPrefixes + :ivar outbound_i_ps: Desired outbound IP resources for the cluster load balancer. + :vartype outbound_i_ps: + ~azure.mgmt.containerservice.v2022_07_01.models.ManagedClusterLoadBalancerProfileOutboundIPs + :ivar effective_outbound_i_ps: The effective outbound IP resources of the cluster load + balancer. + :vartype effective_outbound_i_ps: + list[~azure.mgmt.containerservice.v2022_07_01.models.ResourceReference] + :ivar allocated_outbound_ports: The desired number of allocated SNAT ports per VM. Allowed + values are in the range of 0 to 64000 (inclusive). The default value is 0 which results in + Azure dynamically allocating ports. + :vartype allocated_outbound_ports: int + :ivar idle_timeout_in_minutes: Desired outbound flow idle timeout in minutes. Allowed values + are in the range of 4 to 120 (inclusive). The default value is 30 minutes. + :vartype idle_timeout_in_minutes: int + :ivar enable_multiple_standard_load_balancers: Enable multiple standard load balancers per AKS + cluster or not. + :vartype enable_multiple_standard_load_balancers: bool + """ + + _validation = { + "allocated_outbound_ports": {"maximum": 64000, "minimum": 0}, + "idle_timeout_in_minutes": {"maximum": 120, "minimum": 4}, + } + + _attribute_map = { + "managed_outbound_i_ps": { + "key": "managedOutboundIPs", + "type": "ManagedClusterLoadBalancerProfileManagedOutboundIPs", + }, + "outbound_ip_prefixes": { + "key": "outboundIPPrefixes", + "type": "ManagedClusterLoadBalancerProfileOutboundIPPrefixes", + }, + "outbound_i_ps": {"key": "outboundIPs", "type": "ManagedClusterLoadBalancerProfileOutboundIPs"}, + "effective_outbound_i_ps": {"key": "effectiveOutboundIPs", "type": "[ResourceReference]"}, + "allocated_outbound_ports": {"key": "allocatedOutboundPorts", "type": "int"}, + "idle_timeout_in_minutes": {"key": "idleTimeoutInMinutes", "type": "int"}, + "enable_multiple_standard_load_balancers": {"key": "enableMultipleStandardLoadBalancers", "type": "bool"}, + } + + def __init__( + self, + *, + managed_outbound_i_ps: Optional["_models.ManagedClusterLoadBalancerProfileManagedOutboundIPs"] = None, + outbound_ip_prefixes: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPPrefixes"] = None, + outbound_i_ps: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPs"] = None, + effective_outbound_i_ps: Optional[List["_models.ResourceReference"]] = None, + allocated_outbound_ports: int = 0, + idle_timeout_in_minutes: int = 30, + enable_multiple_standard_load_balancers: Optional[bool] = None, + **kwargs + ): + """ + :keyword managed_outbound_i_ps: Desired managed outbound IPs for the cluster load balancer. + :paramtype managed_outbound_i_ps: + ~azure.mgmt.containerservice.v2022_07_01.models.ManagedClusterLoadBalancerProfileManagedOutboundIPs + :keyword outbound_ip_prefixes: Desired outbound IP Prefix resources for the cluster load + balancer. + :paramtype outbound_ip_prefixes: + ~azure.mgmt.containerservice.v2022_07_01.models.ManagedClusterLoadBalancerProfileOutboundIPPrefixes + :keyword outbound_i_ps: Desired outbound IP resources for the cluster load balancer. + :paramtype outbound_i_ps: + ~azure.mgmt.containerservice.v2022_07_01.models.ManagedClusterLoadBalancerProfileOutboundIPs + :keyword effective_outbound_i_ps: The effective outbound IP resources of the cluster load + balancer. + :paramtype effective_outbound_i_ps: + list[~azure.mgmt.containerservice.v2022_07_01.models.ResourceReference] + :keyword allocated_outbound_ports: The desired number of allocated SNAT ports per VM. Allowed + values are in the range of 0 to 64000 (inclusive). The default value is 0 which results in + Azure dynamically allocating ports. + :paramtype allocated_outbound_ports: int + :keyword idle_timeout_in_minutes: Desired outbound flow idle timeout in minutes. Allowed values + are in the range of 4 to 120 (inclusive). The default value is 30 minutes. + :paramtype idle_timeout_in_minutes: int + :keyword enable_multiple_standard_load_balancers: Enable multiple standard load balancers per + AKS cluster or not. + :paramtype enable_multiple_standard_load_balancers: bool + """ + super().__init__(**kwargs) + self.managed_outbound_i_ps = managed_outbound_i_ps + self.outbound_ip_prefixes = outbound_ip_prefixes + self.outbound_i_ps = outbound_i_ps + self.effective_outbound_i_ps = effective_outbound_i_ps + self.allocated_outbound_ports = allocated_outbound_ports + self.idle_timeout_in_minutes = idle_timeout_in_minutes + self.enable_multiple_standard_load_balancers = enable_multiple_standard_load_balancers + + +class ManagedClusterLoadBalancerProfileManagedOutboundIPs(_serialization.Model): + """Desired managed outbound IPs for the cluster load balancer. + + :ivar count: The desired number of IPv4 outbound IPs created/managed by Azure for the cluster + load balancer. Allowed values must be in the range of 1 to 100 (inclusive). The default value + is 1. + :vartype count: int + :ivar count_ipv6: The desired number of IPv6 outbound IPs created/managed by Azure for the + cluster load balancer. Allowed values must be in the range of 1 to 100 (inclusive). The default + value is 0 for single-stack and 1 for dual-stack. + :vartype count_ipv6: int + """ + + _validation = { + "count": {"maximum": 100, "minimum": 1}, + "count_ipv6": {"maximum": 100, "minimum": 0}, + } + + _attribute_map = { + "count": {"key": "count", "type": "int"}, + "count_ipv6": {"key": "countIPv6", "type": "int"}, + } + + def __init__(self, *, count: int = 1, count_ipv6: int = 0, **kwargs): + """ + :keyword count: The desired number of IPv4 outbound IPs created/managed by Azure for the + cluster load balancer. Allowed values must be in the range of 1 to 100 (inclusive). The default + value is 1. + :paramtype count: int + :keyword count_ipv6: The desired number of IPv6 outbound IPs created/managed by Azure for the + cluster load balancer. Allowed values must be in the range of 1 to 100 (inclusive). The default + value is 0 for single-stack and 1 for dual-stack. + :paramtype count_ipv6: int + """ + super().__init__(**kwargs) + self.count = count + self.count_ipv6 = count_ipv6 + + +class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(_serialization.Model): + """Desired outbound IP Prefix resources for the cluster load balancer. + + :ivar public_ip_prefixes: A list of public IP prefix resources. + :vartype public_ip_prefixes: + list[~azure.mgmt.containerservice.v2022_07_01.models.ResourceReference] + """ + + _attribute_map = { + "public_ip_prefixes": {"key": "publicIPPrefixes", "type": "[ResourceReference]"}, + } + + def __init__(self, *, public_ip_prefixes: Optional[List["_models.ResourceReference"]] = None, **kwargs): + """ + :keyword public_ip_prefixes: A list of public IP prefix resources. + :paramtype public_ip_prefixes: + list[~azure.mgmt.containerservice.v2022_07_01.models.ResourceReference] + """ + super().__init__(**kwargs) + self.public_ip_prefixes = public_ip_prefixes + + +class ManagedClusterLoadBalancerProfileOutboundIPs(_serialization.Model): + """Desired outbound IP resources for the cluster load balancer. + + :ivar public_i_ps: A list of public IP resources. + :vartype public_i_ps: list[~azure.mgmt.containerservice.v2022_07_01.models.ResourceReference] + """ + + _attribute_map = { + "public_i_ps": {"key": "publicIPs", "type": "[ResourceReference]"}, + } + + def __init__(self, *, public_i_ps: Optional[List["_models.ResourceReference"]] = None, **kwargs): + """ + :keyword public_i_ps: A list of public IP resources. + :paramtype public_i_ps: list[~azure.mgmt.containerservice.v2022_07_01.models.ResourceReference] + """ + super().__init__(**kwargs) + self.public_i_ps = public_i_ps + + +class ManagedClusterManagedOutboundIPProfile(_serialization.Model): + """Profile of the managed outbound IP resources of the managed cluster. + + :ivar count: The desired number of outbound IPs created/managed by Azure. Allowed values must + be in the range of 1 to 16 (inclusive). The default value is 1. + :vartype count: int + """ + + _validation = { + "count": {"maximum": 16, "minimum": 1}, + } + + _attribute_map = { + "count": {"key": "count", "type": "int"}, + } + + def __init__(self, *, count: int = 1, **kwargs): + """ + :keyword count: The desired number of outbound IPs created/managed by Azure. Allowed values + must be in the range of 1 to 16 (inclusive). The default value is 1. + :paramtype count: int + """ + super().__init__(**kwargs) + self.count = count + + +class ManagedClusterNATGatewayProfile(_serialization.Model): + """Profile of the managed cluster NAT gateway. + + :ivar managed_outbound_ip_profile: Profile of the managed outbound IP resources of the cluster + NAT gateway. + :vartype managed_outbound_ip_profile: + ~azure.mgmt.containerservice.v2022_07_01.models.ManagedClusterManagedOutboundIPProfile + :ivar effective_outbound_i_ps: The effective outbound IP resources of the cluster NAT gateway. + :vartype effective_outbound_i_ps: + list[~azure.mgmt.containerservice.v2022_07_01.models.ResourceReference] + :ivar idle_timeout_in_minutes: Desired outbound flow idle timeout in minutes. Allowed values + are in the range of 4 to 120 (inclusive). The default value is 4 minutes. + :vartype idle_timeout_in_minutes: int + """ + + _validation = { + "idle_timeout_in_minutes": {"maximum": 120, "minimum": 4}, + } + + _attribute_map = { + "managed_outbound_ip_profile": { + "key": "managedOutboundIPProfile", + "type": "ManagedClusterManagedOutboundIPProfile", + }, + "effective_outbound_i_ps": {"key": "effectiveOutboundIPs", "type": "[ResourceReference]"}, + "idle_timeout_in_minutes": {"key": "idleTimeoutInMinutes", "type": "int"}, + } + + def __init__( + self, + *, + managed_outbound_ip_profile: Optional["_models.ManagedClusterManagedOutboundIPProfile"] = None, + effective_outbound_i_ps: Optional[List["_models.ResourceReference"]] = None, + idle_timeout_in_minutes: int = 4, + **kwargs + ): + """ + :keyword managed_outbound_ip_profile: Profile of the managed outbound IP resources of the + cluster NAT gateway. + :paramtype managed_outbound_ip_profile: + ~azure.mgmt.containerservice.v2022_07_01.models.ManagedClusterManagedOutboundIPProfile + :keyword effective_outbound_i_ps: The effective outbound IP resources of the cluster NAT + gateway. + :paramtype effective_outbound_i_ps: + list[~azure.mgmt.containerservice.v2022_07_01.models.ResourceReference] + :keyword idle_timeout_in_minutes: Desired outbound flow idle timeout in minutes. Allowed values + are in the range of 4 to 120 (inclusive). The default value is 4 minutes. + :paramtype idle_timeout_in_minutes: int + """ + super().__init__(**kwargs) + self.managed_outbound_ip_profile = managed_outbound_ip_profile + self.effective_outbound_i_ps = effective_outbound_i_ps + self.idle_timeout_in_minutes = idle_timeout_in_minutes + + +class ManagedClusterPodIdentity(_serialization.Model): + """Details about the pod identity assigned to the Managed Cluster. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar name: The name of the pod identity. Required. + :vartype name: str + :ivar namespace: The namespace of the pod identity. Required. + :vartype namespace: str + :ivar binding_selector: The binding selector to use for the AzureIdentityBinding resource. + :vartype binding_selector: str + :ivar identity: The user assigned identity details. Required. + :vartype identity: ~azure.mgmt.containerservice.v2022_07_01.models.UserAssignedIdentity + :ivar provisioning_state: The current provisioning state of the pod identity. Known values are: + "Assigned", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or + ~azure.mgmt.containerservice.v2022_07_01.models.ManagedClusterPodIdentityProvisioningState + :ivar provisioning_info: + :vartype provisioning_info: + ~azure.mgmt.containerservice.v2022_07_01.models.ManagedClusterPodIdentityProvisioningInfo + """ + + _validation = { + "name": {"required": True}, + "namespace": {"required": True}, + "identity": {"required": True}, + "provisioning_state": {"readonly": True}, + "provisioning_info": {"readonly": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "namespace": {"key": "namespace", "type": "str"}, + "binding_selector": {"key": "bindingSelector", "type": "str"}, + "identity": {"key": "identity", "type": "UserAssignedIdentity"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "provisioning_info": {"key": "provisioningInfo", "type": "ManagedClusterPodIdentityProvisioningInfo"}, + } + + def __init__( + self, + *, + name: str, + namespace: str, + identity: "_models.UserAssignedIdentity", + binding_selector: Optional[str] = None, + **kwargs + ): + """ + :keyword name: The name of the pod identity. Required. + :paramtype name: str + :keyword namespace: The namespace of the pod identity. Required. + :paramtype namespace: str + :keyword binding_selector: The binding selector to use for the AzureIdentityBinding resource. + :paramtype binding_selector: str + :keyword identity: The user assigned identity details. Required. + :paramtype identity: ~azure.mgmt.containerservice.v2022_07_01.models.UserAssignedIdentity + """ + super().__init__(**kwargs) + self.name = name + self.namespace = namespace + self.binding_selector = binding_selector + self.identity = identity + self.provisioning_state = None + self.provisioning_info = None + + +class ManagedClusterPodIdentityException(_serialization.Model): + """See `disable AAD Pod Identity for a specific Pod/Application `_ for more details. + + All required parameters must be populated in order to send to Azure. + + :ivar name: The name of the pod identity exception. Required. + :vartype name: str + :ivar namespace: The namespace of the pod identity exception. Required. + :vartype namespace: str + :ivar pod_labels: The pod labels to match. Required. + :vartype pod_labels: dict[str, str] + """ + + _validation = { + "name": {"required": True}, + "namespace": {"required": True}, + "pod_labels": {"required": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "namespace": {"key": "namespace", "type": "str"}, + "pod_labels": {"key": "podLabels", "type": "{str}"}, + } + + def __init__(self, *, name: str, namespace: str, pod_labels: Dict[str, str], **kwargs): + """ + :keyword name: The name of the pod identity exception. Required. + :paramtype name: str + :keyword namespace: The namespace of the pod identity exception. Required. + :paramtype namespace: str + :keyword pod_labels: The pod labels to match. Required. + :paramtype pod_labels: dict[str, str] + """ + super().__init__(**kwargs) + self.name = name + self.namespace = namespace + self.pod_labels = pod_labels + + +class ManagedClusterPodIdentityProfile(_serialization.Model): + """See `use AAD pod identity `_ for more details on pod identity integration. + + :ivar enabled: Whether the pod identity addon is enabled. + :vartype enabled: bool + :ivar allow_network_plugin_kubenet: Running in Kubenet is disabled by default due to the + security related nature of AAD Pod Identity and the risks of IP spoofing. See `using Kubenet + network plugin with AAD Pod Identity + `_ + for more information. + :vartype allow_network_plugin_kubenet: bool + :ivar user_assigned_identities: The pod identities to use in the cluster. + :vartype user_assigned_identities: + list[~azure.mgmt.containerservice.v2022_07_01.models.ManagedClusterPodIdentity] + :ivar user_assigned_identity_exceptions: The pod identity exceptions to allow. + :vartype user_assigned_identity_exceptions: + list[~azure.mgmt.containerservice.v2022_07_01.models.ManagedClusterPodIdentityException] + """ + + _attribute_map = { + "enabled": {"key": "enabled", "type": "bool"}, + "allow_network_plugin_kubenet": {"key": "allowNetworkPluginKubenet", "type": "bool"}, + "user_assigned_identities": {"key": "userAssignedIdentities", "type": "[ManagedClusterPodIdentity]"}, + "user_assigned_identity_exceptions": { + "key": "userAssignedIdentityExceptions", + "type": "[ManagedClusterPodIdentityException]", + }, + } + + def __init__( + self, + *, + enabled: Optional[bool] = None, + allow_network_plugin_kubenet: Optional[bool] = None, + user_assigned_identities: Optional[List["_models.ManagedClusterPodIdentity"]] = None, + user_assigned_identity_exceptions: Optional[List["_models.ManagedClusterPodIdentityException"]] = None, + **kwargs + ): + """ + :keyword enabled: Whether the pod identity addon is enabled. + :paramtype enabled: bool + :keyword allow_network_plugin_kubenet: Running in Kubenet is disabled by default due to the + security related nature of AAD Pod Identity and the risks of IP spoofing. See `using Kubenet + network plugin with AAD Pod Identity + `_ + for more information. + :paramtype allow_network_plugin_kubenet: bool + :keyword user_assigned_identities: The pod identities to use in the cluster. + :paramtype user_assigned_identities: + list[~azure.mgmt.containerservice.v2022_07_01.models.ManagedClusterPodIdentity] + :keyword user_assigned_identity_exceptions: The pod identity exceptions to allow. + :paramtype user_assigned_identity_exceptions: + list[~azure.mgmt.containerservice.v2022_07_01.models.ManagedClusterPodIdentityException] + """ + super().__init__(**kwargs) + self.enabled = enabled + self.allow_network_plugin_kubenet = allow_network_plugin_kubenet + self.user_assigned_identities = user_assigned_identities + self.user_assigned_identity_exceptions = user_assigned_identity_exceptions + + +class ManagedClusterPodIdentityProvisioningError(_serialization.Model): + """An error response from the pod identity provisioning. + + :ivar error: Details about the error. + :vartype error: + ~azure.mgmt.containerservice.v2022_07_01.models.ManagedClusterPodIdentityProvisioningErrorBody + """ + + _attribute_map = { + "error": {"key": "error", "type": "ManagedClusterPodIdentityProvisioningErrorBody"}, + } + + def __init__(self, *, error: Optional["_models.ManagedClusterPodIdentityProvisioningErrorBody"] = None, **kwargs): + """ + :keyword error: Details about the error. + :paramtype error: + ~azure.mgmt.containerservice.v2022_07_01.models.ManagedClusterPodIdentityProvisioningErrorBody + """ + super().__init__(**kwargs) + self.error = error + + +class ManagedClusterPodIdentityProvisioningErrorBody(_serialization.Model): + """An error response from the pod identity provisioning. + + :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. + :vartype code: str + :ivar message: A message describing the error, intended to be suitable for display in a user + interface. + :vartype message: str + :ivar target: The target of the particular error. For example, the name of the property in + error. + :vartype target: str + :ivar details: A list of additional details about the error. + :vartype details: + list[~azure.mgmt.containerservice.v2022_07_01.models.ManagedClusterPodIdentityProvisioningErrorBody] + """ + + _attribute_map = { + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[ManagedClusterPodIdentityProvisioningErrorBody]"}, + } + + def __init__( + self, + *, + code: Optional[str] = None, + message: Optional[str] = None, + target: Optional[str] = None, + details: Optional[List["_models.ManagedClusterPodIdentityProvisioningErrorBody"]] = None, + **kwargs + ): + """ + :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. + :paramtype code: str + :keyword message: A message describing the error, intended to be suitable for display in a user + interface. + :paramtype message: str + :keyword target: The target of the particular error. For example, the name of the property in + error. + :paramtype target: str + :keyword details: A list of additional details about the error. + :paramtype details: + list[~azure.mgmt.containerservice.v2022_07_01.models.ManagedClusterPodIdentityProvisioningErrorBody] + """ + super().__init__(**kwargs) + self.code = code + self.message = message + self.target = target + self.details = details + + +class ManagedClusterPodIdentityProvisioningInfo(_serialization.Model): + """ManagedClusterPodIdentityProvisioningInfo. + + :ivar error: Pod identity assignment error (if any). + :vartype error: + ~azure.mgmt.containerservice.v2022_07_01.models.ManagedClusterPodIdentityProvisioningError + """ + + _attribute_map = { + "error": {"key": "error", "type": "ManagedClusterPodIdentityProvisioningError"}, + } + + def __init__(self, *, error: Optional["_models.ManagedClusterPodIdentityProvisioningError"] = None, **kwargs): + """ + :keyword error: Pod identity assignment error (if any). + :paramtype error: + ~azure.mgmt.containerservice.v2022_07_01.models.ManagedClusterPodIdentityProvisioningError + """ + super().__init__(**kwargs) + self.error = error + + +class ManagedClusterPoolUpgradeProfile(_serialization.Model): + """The list of available upgrade versions. + + All required parameters must be populated in order to send to Azure. + + :ivar kubernetes_version: The Kubernetes version (major.minor.patch). Required. + :vartype kubernetes_version: str + :ivar name: The Agent Pool name. + :vartype name: str + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". + :vartype os_type: str or ~azure.mgmt.containerservice.v2022_07_01.models.OSType + :ivar upgrades: List of orchestrator types and versions available for upgrade. + :vartype upgrades: + list[~azure.mgmt.containerservice.v2022_07_01.models.ManagedClusterPoolUpgradeProfileUpgradesItem] + """ + + _validation = { + "kubernetes_version": {"required": True}, + "os_type": {"required": True}, + } + + _attribute_map = { + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "os_type": {"key": "osType", "type": "str"}, + "upgrades": {"key": "upgrades", "type": "[ManagedClusterPoolUpgradeProfileUpgradesItem]"}, + } + + def __init__( + self, + *, + kubernetes_version: str, + os_type: Union[str, "_models.OSType"] = "Linux", + name: Optional[str] = None, + upgrades: Optional[List["_models.ManagedClusterPoolUpgradeProfileUpgradesItem"]] = None, + **kwargs + ): + """ + :keyword kubernetes_version: The Kubernetes version (major.minor.patch). Required. + :paramtype kubernetes_version: str + :keyword name: The Agent Pool name. + :paramtype name: str + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". + :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_07_01.models.OSType + :keyword upgrades: List of orchestrator types and versions available for upgrade. + :paramtype upgrades: + list[~azure.mgmt.containerservice.v2022_07_01.models.ManagedClusterPoolUpgradeProfileUpgradesItem] + """ + super().__init__(**kwargs) + self.kubernetes_version = kubernetes_version + self.name = name + self.os_type = os_type + self.upgrades = upgrades + + +class ManagedClusterPoolUpgradeProfileUpgradesItem(_serialization.Model): + """ManagedClusterPoolUpgradeProfileUpgradesItem. + + :ivar kubernetes_version: The Kubernetes version (major.minor.patch). + :vartype kubernetes_version: str + :ivar is_preview: Whether the Kubernetes version is currently in preview. + :vartype is_preview: bool + """ + + _attribute_map = { + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, + } + + def __init__(self, *, kubernetes_version: Optional[str] = None, is_preview: Optional[bool] = None, **kwargs): + """ + :keyword kubernetes_version: The Kubernetes version (major.minor.patch). + :paramtype kubernetes_version: str + :keyword is_preview: Whether the Kubernetes version is currently in preview. + :paramtype is_preview: bool + """ + super().__init__(**kwargs) + self.kubernetes_version = kubernetes_version + self.is_preview = is_preview + + +class ManagedClusterPropertiesAutoScalerProfile(_serialization.Model): # pylint: disable=too-many-instance-attributes + """Parameters to be applied to the cluster-autoscaler when enabled. + + :ivar balance_similar_node_groups: Valid values are 'true' and 'false'. + :vartype balance_similar_node_groups: str + :ivar expander: If not specified, the default is 'random'. See `expanders + `_ + for more information. Known values are: "least-waste", "most-pods", "priority", and "random". + :vartype expander: str or ~azure.mgmt.containerservice.v2022_07_01.models.Expander + :ivar max_empty_bulk_delete: The default is 10. + :vartype max_empty_bulk_delete: str + :ivar max_graceful_termination_sec: The default is 600. + :vartype max_graceful_termination_sec: str + :ivar max_node_provision_time: The default is '15m'. Values must be an integer followed by an + 'm'. No unit of time other than minutes (m) is supported. + :vartype max_node_provision_time: str + :ivar max_total_unready_percentage: The default is 45. The maximum is 100 and the minimum is 0. + :vartype max_total_unready_percentage: str + :ivar new_pod_scale_up_delay: For scenarios like burst/batch scale where you don't want CA to + act before the kubernetes scheduler could schedule all the pods, you can tell CA to ignore + unscheduled pods before they're a certain age. The default is '0s'. Values must be an integer + followed by a unit ('s' for seconds, 'm' for minutes, 'h' for hours, etc). + :vartype new_pod_scale_up_delay: str + :ivar ok_total_unready_count: This must be an integer. The default is 3. + :vartype ok_total_unready_count: str + :ivar scan_interval: The default is '10'. Values must be an integer number of seconds. + :vartype scan_interval: str + :ivar scale_down_delay_after_add: The default is '10m'. Values must be an integer followed by + an 'm'. No unit of time other than minutes (m) is supported. + :vartype scale_down_delay_after_add: str + :ivar scale_down_delay_after_delete: The default is the scan-interval. Values must be an + integer followed by an 'm'. No unit of time other than minutes (m) is supported. + :vartype scale_down_delay_after_delete: str + :ivar scale_down_delay_after_failure: The default is '3m'. Values must be an integer followed + by an 'm'. No unit of time other than minutes (m) is supported. + :vartype scale_down_delay_after_failure: str + :ivar scale_down_unneeded_time: The default is '10m'. Values must be an integer followed by an + 'm'. No unit of time other than minutes (m) is supported. + :vartype scale_down_unneeded_time: str + :ivar scale_down_unready_time: The default is '20m'. Values must be an integer followed by an + 'm'. No unit of time other than minutes (m) is supported. + :vartype scale_down_unready_time: str + :ivar scale_down_utilization_threshold: The default is '0.5'. + :vartype scale_down_utilization_threshold: str + :ivar skip_nodes_with_local_storage: The default is true. + :vartype skip_nodes_with_local_storage: str + :ivar skip_nodes_with_system_pods: The default is true. + :vartype skip_nodes_with_system_pods: str + """ + + _attribute_map = { + "balance_similar_node_groups": {"key": "balance-similar-node-groups", "type": "str"}, + "expander": {"key": "expander", "type": "str"}, + "max_empty_bulk_delete": {"key": "max-empty-bulk-delete", "type": "str"}, + "max_graceful_termination_sec": {"key": "max-graceful-termination-sec", "type": "str"}, + "max_node_provision_time": {"key": "max-node-provision-time", "type": "str"}, + "max_total_unready_percentage": {"key": "max-total-unready-percentage", "type": "str"}, + "new_pod_scale_up_delay": {"key": "new-pod-scale-up-delay", "type": "str"}, + "ok_total_unready_count": {"key": "ok-total-unready-count", "type": "str"}, + "scan_interval": {"key": "scan-interval", "type": "str"}, + "scale_down_delay_after_add": {"key": "scale-down-delay-after-add", "type": "str"}, + "scale_down_delay_after_delete": {"key": "scale-down-delay-after-delete", "type": "str"}, + "scale_down_delay_after_failure": {"key": "scale-down-delay-after-failure", "type": "str"}, + "scale_down_unneeded_time": {"key": "scale-down-unneeded-time", "type": "str"}, + "scale_down_unready_time": {"key": "scale-down-unready-time", "type": "str"}, + "scale_down_utilization_threshold": {"key": "scale-down-utilization-threshold", "type": "str"}, + "skip_nodes_with_local_storage": {"key": "skip-nodes-with-local-storage", "type": "str"}, + "skip_nodes_with_system_pods": {"key": "skip-nodes-with-system-pods", "type": "str"}, + } + + def __init__( + self, + *, + balance_similar_node_groups: Optional[str] = None, + expander: Optional[Union[str, "_models.Expander"]] = None, + max_empty_bulk_delete: Optional[str] = None, + max_graceful_termination_sec: Optional[str] = None, + max_node_provision_time: Optional[str] = None, + max_total_unready_percentage: Optional[str] = None, + new_pod_scale_up_delay: Optional[str] = None, + ok_total_unready_count: Optional[str] = None, + scan_interval: Optional[str] = None, + scale_down_delay_after_add: Optional[str] = None, + scale_down_delay_after_delete: Optional[str] = None, + scale_down_delay_after_failure: Optional[str] = None, + scale_down_unneeded_time: Optional[str] = None, + scale_down_unready_time: Optional[str] = None, + scale_down_utilization_threshold: Optional[str] = None, + skip_nodes_with_local_storage: Optional[str] = None, + skip_nodes_with_system_pods: Optional[str] = None, + **kwargs + ): + """ + :keyword balance_similar_node_groups: Valid values are 'true' and 'false'. + :paramtype balance_similar_node_groups: str + :keyword expander: If not specified, the default is 'random'. See `expanders + `_ + for more information. Known values are: "least-waste", "most-pods", "priority", and "random". + :paramtype expander: str or ~azure.mgmt.containerservice.v2022_07_01.models.Expander + :keyword max_empty_bulk_delete: The default is 10. + :paramtype max_empty_bulk_delete: str + :keyword max_graceful_termination_sec: The default is 600. + :paramtype max_graceful_termination_sec: str + :keyword max_node_provision_time: The default is '15m'. Values must be an integer followed by + an 'm'. No unit of time other than minutes (m) is supported. + :paramtype max_node_provision_time: str + :keyword max_total_unready_percentage: The default is 45. The maximum is 100 and the minimum is + 0. + :paramtype max_total_unready_percentage: str + :keyword new_pod_scale_up_delay: For scenarios like burst/batch scale where you don't want CA + to act before the kubernetes scheduler could schedule all the pods, you can tell CA to ignore + unscheduled pods before they're a certain age. The default is '0s'. Values must be an integer + followed by a unit ('s' for seconds, 'm' for minutes, 'h' for hours, etc). + :paramtype new_pod_scale_up_delay: str + :keyword ok_total_unready_count: This must be an integer. The default is 3. + :paramtype ok_total_unready_count: str + :keyword scan_interval: The default is '10'. Values must be an integer number of seconds. + :paramtype scan_interval: str + :keyword scale_down_delay_after_add: The default is '10m'. Values must be an integer followed + by an 'm'. No unit of time other than minutes (m) is supported. + :paramtype scale_down_delay_after_add: str + :keyword scale_down_delay_after_delete: The default is the scan-interval. Values must be an + integer followed by an 'm'. No unit of time other than minutes (m) is supported. + :paramtype scale_down_delay_after_delete: str + :keyword scale_down_delay_after_failure: The default is '3m'. Values must be an integer + followed by an 'm'. No unit of time other than minutes (m) is supported. + :paramtype scale_down_delay_after_failure: str + :keyword scale_down_unneeded_time: The default is '10m'. Values must be an integer followed by + an 'm'. No unit of time other than minutes (m) is supported. + :paramtype scale_down_unneeded_time: str + :keyword scale_down_unready_time: The default is '20m'. Values must be an integer followed by + an 'm'. No unit of time other than minutes (m) is supported. + :paramtype scale_down_unready_time: str + :keyword scale_down_utilization_threshold: The default is '0.5'. + :paramtype scale_down_utilization_threshold: str + :keyword skip_nodes_with_local_storage: The default is true. + :paramtype skip_nodes_with_local_storage: str + :keyword skip_nodes_with_system_pods: The default is true. + :paramtype skip_nodes_with_system_pods: str + """ + super().__init__(**kwargs) + self.balance_similar_node_groups = balance_similar_node_groups + self.expander = expander + self.max_empty_bulk_delete = max_empty_bulk_delete + self.max_graceful_termination_sec = max_graceful_termination_sec + self.max_node_provision_time = max_node_provision_time + self.max_total_unready_percentage = max_total_unready_percentage + self.new_pod_scale_up_delay = new_pod_scale_up_delay + self.ok_total_unready_count = ok_total_unready_count + self.scan_interval = scan_interval + self.scale_down_delay_after_add = scale_down_delay_after_add + self.scale_down_delay_after_delete = scale_down_delay_after_delete + self.scale_down_delay_after_failure = scale_down_delay_after_failure + self.scale_down_unneeded_time = scale_down_unneeded_time + self.scale_down_unready_time = scale_down_unready_time + self.scale_down_utilization_threshold = scale_down_utilization_threshold + self.skip_nodes_with_local_storage = skip_nodes_with_local_storage + self.skip_nodes_with_system_pods = skip_nodes_with_system_pods + + +class ManagedClusterSecurityProfile(_serialization.Model): + """Security profile for the container service cluster. + + :ivar defender: Microsoft Defender settings for the security profile. + :vartype defender: + ~azure.mgmt.containerservice.v2022_07_01.models.ManagedClusterSecurityProfileDefender + :ivar azure_key_vault_kms: Azure Key Vault `key management service + `_ settings for the security + profile. + :vartype azure_key_vault_kms: ~azure.mgmt.containerservice.v2022_07_01.models.AzureKeyVaultKms + """ + + _attribute_map = { + "defender": {"key": "defender", "type": "ManagedClusterSecurityProfileDefender"}, + "azure_key_vault_kms": {"key": "azureKeyVaultKms", "type": "AzureKeyVaultKms"}, + } + + def __init__( + self, + *, + defender: Optional["_models.ManagedClusterSecurityProfileDefender"] = None, + azure_key_vault_kms: Optional["_models.AzureKeyVaultKms"] = None, + **kwargs + ): + """ + :keyword defender: Microsoft Defender settings for the security profile. + :paramtype defender: + ~azure.mgmt.containerservice.v2022_07_01.models.ManagedClusterSecurityProfileDefender + :keyword azure_key_vault_kms: Azure Key Vault `key management service + `_ settings for the security + profile. + :paramtype azure_key_vault_kms: + ~azure.mgmt.containerservice.v2022_07_01.models.AzureKeyVaultKms + """ + super().__init__(**kwargs) + self.defender = defender + self.azure_key_vault_kms = azure_key_vault_kms + + +class ManagedClusterSecurityProfileDefender(_serialization.Model): + """Microsoft Defender settings for the security profile. + + :ivar log_analytics_workspace_resource_id: Resource ID of the Log Analytics workspace to be + associated with Microsoft Defender. When Microsoft Defender is enabled, this field is required + and must be a valid workspace resource ID. When Microsoft Defender is disabled, leave the field + empty. + :vartype log_analytics_workspace_resource_id: str + :ivar security_monitoring: Microsoft Defender threat detection for Cloud settings for the + security profile. + :vartype security_monitoring: + ~azure.mgmt.containerservice.v2022_07_01.models.ManagedClusterSecurityProfileDefenderSecurityMonitoring + """ + + _attribute_map = { + "log_analytics_workspace_resource_id": {"key": "logAnalyticsWorkspaceResourceId", "type": "str"}, + "security_monitoring": { + "key": "securityMonitoring", + "type": "ManagedClusterSecurityProfileDefenderSecurityMonitoring", + }, + } + + def __init__( + self, + *, + log_analytics_workspace_resource_id: Optional[str] = None, + security_monitoring: Optional["_models.ManagedClusterSecurityProfileDefenderSecurityMonitoring"] = None, + **kwargs + ): + """ + :keyword log_analytics_workspace_resource_id: Resource ID of the Log Analytics workspace to be + associated with Microsoft Defender. When Microsoft Defender is enabled, this field is required + and must be a valid workspace resource ID. When Microsoft Defender is disabled, leave the field + empty. + :paramtype log_analytics_workspace_resource_id: str + :keyword security_monitoring: Microsoft Defender threat detection for Cloud settings for the + security profile. + :paramtype security_monitoring: + ~azure.mgmt.containerservice.v2022_07_01.models.ManagedClusterSecurityProfileDefenderSecurityMonitoring + """ + super().__init__(**kwargs) + self.log_analytics_workspace_resource_id = log_analytics_workspace_resource_id + self.security_monitoring = security_monitoring + + +class ManagedClusterSecurityProfileDefenderSecurityMonitoring(_serialization.Model): + """Microsoft Defender settings for the security profile threat detection. + + :ivar enabled: Whether to enable Defender threat detection. + :vartype enabled: bool + """ + + _attribute_map = { + "enabled": {"key": "enabled", "type": "bool"}, + } + + def __init__(self, *, enabled: Optional[bool] = None, **kwargs): + """ + :keyword enabled: Whether to enable Defender threat detection. + :paramtype enabled: bool + """ + super().__init__(**kwargs) + self.enabled = enabled + + +class ManagedClusterServicePrincipalProfile(_serialization.Model): + """Information about a service principal identity for the cluster to use for manipulating Azure APIs. + + All required parameters must be populated in order to send to Azure. + + :ivar client_id: The ID for the service principal. Required. + :vartype client_id: str + :ivar secret: The secret password associated with the service principal in plain text. + :vartype secret: str + """ + + _validation = { + "client_id": {"required": True}, + } + + _attribute_map = { + "client_id": {"key": "clientId", "type": "str"}, + "secret": {"key": "secret", "type": "str"}, + } + + def __init__(self, *, client_id: str, secret: Optional[str] = None, **kwargs): + """ + :keyword client_id: The ID for the service principal. Required. + :paramtype client_id: str + :keyword secret: The secret password associated with the service principal in plain text. + :paramtype secret: str + """ + super().__init__(**kwargs) + self.client_id = client_id + self.secret = secret + + +class ManagedClusterSKU(_serialization.Model): + """The SKU of a Managed Cluster. + + :ivar name: The name of a managed cluster SKU. "Basic" + :vartype name: str or ~azure.mgmt.containerservice.v2022_07_01.models.ManagedClusterSKUName + :ivar tier: If not specified, the default is 'Free'. See `uptime SLA + `_ for more details. Known values are: "Paid" + and "Free". + :vartype tier: str or ~azure.mgmt.containerservice.v2022_07_01.models.ManagedClusterSKUTier + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "tier": {"key": "tier", "type": "str"}, + } + + def __init__( + self, + *, + name: Optional[Union[str, "_models.ManagedClusterSKUName"]] = None, + tier: Optional[Union[str, "_models.ManagedClusterSKUTier"]] = None, + **kwargs + ): + """ + :keyword name: The name of a managed cluster SKU. "Basic" + :paramtype name: str or ~azure.mgmt.containerservice.v2022_07_01.models.ManagedClusterSKUName + :keyword tier: If not specified, the default is 'Free'. See `uptime SLA + `_ for more details. Known values are: "Paid" + and "Free". + :paramtype tier: str or ~azure.mgmt.containerservice.v2022_07_01.models.ManagedClusterSKUTier + """ + super().__init__(**kwargs) + self.name = name + self.tier = tier + + +class ManagedClusterStorageProfile(_serialization.Model): + """Storage profile for the container service cluster. + + :ivar disk_csi_driver: AzureDisk CSI Driver settings for the storage profile. + :vartype disk_csi_driver: + ~azure.mgmt.containerservice.v2022_07_01.models.ManagedClusterStorageProfileDiskCSIDriver + :ivar file_csi_driver: AzureFile CSI Driver settings for the storage profile. + :vartype file_csi_driver: + ~azure.mgmt.containerservice.v2022_07_01.models.ManagedClusterStorageProfileFileCSIDriver + :ivar snapshot_controller: Snapshot Controller settings for the storage profile. + :vartype snapshot_controller: + ~azure.mgmt.containerservice.v2022_07_01.models.ManagedClusterStorageProfileSnapshotController + """ + + _attribute_map = { + "disk_csi_driver": {"key": "diskCSIDriver", "type": "ManagedClusterStorageProfileDiskCSIDriver"}, + "file_csi_driver": {"key": "fileCSIDriver", "type": "ManagedClusterStorageProfileFileCSIDriver"}, + "snapshot_controller": {"key": "snapshotController", "type": "ManagedClusterStorageProfileSnapshotController"}, + } + + def __init__( + self, + *, + disk_csi_driver: Optional["_models.ManagedClusterStorageProfileDiskCSIDriver"] = None, + file_csi_driver: Optional["_models.ManagedClusterStorageProfileFileCSIDriver"] = None, + snapshot_controller: Optional["_models.ManagedClusterStorageProfileSnapshotController"] = None, + **kwargs + ): + """ + :keyword disk_csi_driver: AzureDisk CSI Driver settings for the storage profile. + :paramtype disk_csi_driver: + ~azure.mgmt.containerservice.v2022_07_01.models.ManagedClusterStorageProfileDiskCSIDriver + :keyword file_csi_driver: AzureFile CSI Driver settings for the storage profile. + :paramtype file_csi_driver: + ~azure.mgmt.containerservice.v2022_07_01.models.ManagedClusterStorageProfileFileCSIDriver + :keyword snapshot_controller: Snapshot Controller settings for the storage profile. + :paramtype snapshot_controller: + ~azure.mgmt.containerservice.v2022_07_01.models.ManagedClusterStorageProfileSnapshotController + """ + super().__init__(**kwargs) + self.disk_csi_driver = disk_csi_driver + self.file_csi_driver = file_csi_driver + self.snapshot_controller = snapshot_controller + + +class ManagedClusterStorageProfileDiskCSIDriver(_serialization.Model): + """AzureDisk CSI Driver settings for the storage profile. + + :ivar enabled: Whether to enable AzureDisk CSI Driver. The default value is true. + :vartype enabled: bool + """ + + _attribute_map = { + "enabled": {"key": "enabled", "type": "bool"}, + } + + def __init__(self, *, enabled: Optional[bool] = None, **kwargs): + """ + :keyword enabled: Whether to enable AzureDisk CSI Driver. The default value is true. + :paramtype enabled: bool + """ + super().__init__(**kwargs) + self.enabled = enabled + + +class ManagedClusterStorageProfileFileCSIDriver(_serialization.Model): + """AzureFile CSI Driver settings for the storage profile. + + :ivar enabled: Whether to enable AzureFile CSI Driver. The default value is true. + :vartype enabled: bool + """ + + _attribute_map = { + "enabled": {"key": "enabled", "type": "bool"}, + } + + def __init__(self, *, enabled: Optional[bool] = None, **kwargs): + """ + :keyword enabled: Whether to enable AzureFile CSI Driver. The default value is true. + :paramtype enabled: bool + """ + super().__init__(**kwargs) + self.enabled = enabled + + +class ManagedClusterStorageProfileSnapshotController(_serialization.Model): + """Snapshot Controller settings for the storage profile. + + :ivar enabled: Whether to enable Snapshot Controller. The default value is true. + :vartype enabled: bool + """ + + _attribute_map = { + "enabled": {"key": "enabled", "type": "bool"}, + } + + def __init__(self, *, enabled: Optional[bool] = None, **kwargs): + """ + :keyword enabled: Whether to enable Snapshot Controller. The default value is true. + :paramtype enabled: bool + """ + super().__init__(**kwargs) + self.enabled = enabled + + +class ManagedClusterUpgradeProfile(_serialization.Model): + """The list of available upgrades for compute pools. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The ID of the upgrade profile. + :vartype id: str + :ivar name: The name of the upgrade profile. + :vartype name: str + :ivar type: The type of the upgrade profile. + :vartype type: str + :ivar control_plane_profile: The list of available upgrade versions for the control plane. + Required. + :vartype control_plane_profile: + ~azure.mgmt.containerservice.v2022_07_01.models.ManagedClusterPoolUpgradeProfile + :ivar agent_pool_profiles: The list of available upgrade versions for agent pools. Required. + :vartype agent_pool_profiles: + list[~azure.mgmt.containerservice.v2022_07_01.models.ManagedClusterPoolUpgradeProfile] + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "control_plane_profile": {"required": True}, + "agent_pool_profiles": {"required": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "control_plane_profile": {"key": "properties.controlPlaneProfile", "type": "ManagedClusterPoolUpgradeProfile"}, + "agent_pool_profiles": {"key": "properties.agentPoolProfiles", "type": "[ManagedClusterPoolUpgradeProfile]"}, + } + + def __init__( + self, + *, + control_plane_profile: "_models.ManagedClusterPoolUpgradeProfile", + agent_pool_profiles: List["_models.ManagedClusterPoolUpgradeProfile"], + **kwargs + ): + """ + :keyword control_plane_profile: The list of available upgrade versions for the control plane. + Required. + :paramtype control_plane_profile: + ~azure.mgmt.containerservice.v2022_07_01.models.ManagedClusterPoolUpgradeProfile + :keyword agent_pool_profiles: The list of available upgrade versions for agent pools. Required. + :paramtype agent_pool_profiles: + list[~azure.mgmt.containerservice.v2022_07_01.models.ManagedClusterPoolUpgradeProfile] + """ + super().__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.control_plane_profile = control_plane_profile + self.agent_pool_profiles = agent_pool_profiles + + +class ManagedClusterWindowsProfile(_serialization.Model): + """Profile for Windows VMs in the managed cluster. + + All required parameters must be populated in order to send to Azure. + + :ivar admin_username: Specifies the name of the administrator account. :code:`
`:code:`
` + **Restriction:** Cannot end in "." :code:`
`:code:`
` **Disallowed values:** + "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", + "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", + "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", + "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 character + :code:`
`:code:`
` **Max-length:** 20 characters. Required. + :vartype admin_username: str + :ivar admin_password: Specifies the password of the administrator account. + :code:`
`:code:`
` **Minimum-length:** 8 characters :code:`
`:code:`
` + **Max-length:** 123 characters :code:`
`:code:`
` **Complexity requirements:** 3 out of 4 + conditions below need to be fulfilled :code:`
` Has lower characters :code:`
`Has upper + characters :code:`
` Has a digit :code:`
` Has a special character (Regex match [\W_]) + :code:`
`:code:`
` **Disallowed values:** "abc@123", "P@$$w0rd", "P@ssw0rd", + "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!". + :vartype admin_password: str + :ivar license_type: The license type to use for Windows VMs. See `Azure Hybrid User Benefits + `_ for more details. Known values are: + "None" and "Windows_Server". + :vartype license_type: str or ~azure.mgmt.containerservice.v2022_07_01.models.LicenseType + :ivar enable_csi_proxy: For more details on CSI proxy, see the `CSI proxy GitHub repo + `_. + :vartype enable_csi_proxy: bool + :ivar gmsa_profile: The Windows gMSA Profile in the Managed Cluster. + :vartype gmsa_profile: ~azure.mgmt.containerservice.v2022_07_01.models.WindowsGmsaProfile + """ + + _validation = { + "admin_username": {"required": True}, + } + + _attribute_map = { + "admin_username": {"key": "adminUsername", "type": "str"}, + "admin_password": {"key": "adminPassword", "type": "str"}, + "license_type": {"key": "licenseType", "type": "str"}, + "enable_csi_proxy": {"key": "enableCSIProxy", "type": "bool"}, + "gmsa_profile": {"key": "gmsaProfile", "type": "WindowsGmsaProfile"}, + } + + def __init__( + self, + *, + admin_username: str, + admin_password: Optional[str] = None, + license_type: Optional[Union[str, "_models.LicenseType"]] = None, + enable_csi_proxy: Optional[bool] = None, + gmsa_profile: Optional["_models.WindowsGmsaProfile"] = None, + **kwargs + ): + """ + :keyword admin_username: Specifies the name of the administrator account. + :code:`
`:code:`
` **Restriction:** Cannot end in "." :code:`
`:code:`
` + **Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", "test1", + "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", + "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", + "sys", "test2", "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 + character :code:`
`:code:`
` **Max-length:** 20 characters. Required. + :paramtype admin_username: str + :keyword admin_password: Specifies the password of the administrator account. + :code:`
`:code:`
` **Minimum-length:** 8 characters :code:`
`:code:`
` + **Max-length:** 123 characters :code:`
`:code:`
` **Complexity requirements:** 3 out of 4 + conditions below need to be fulfilled :code:`
` Has lower characters :code:`
`Has upper + characters :code:`
` Has a digit :code:`
` Has a special character (Regex match [\W_]) + :code:`
`:code:`
` **Disallowed values:** "abc@123", "P@$$w0rd", "P@ssw0rd", + "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!". + :paramtype admin_password: str + :keyword license_type: The license type to use for Windows VMs. See `Azure Hybrid User Benefits + `_ for more details. Known values are: + "None" and "Windows_Server". + :paramtype license_type: str or ~azure.mgmt.containerservice.v2022_07_01.models.LicenseType + :keyword enable_csi_proxy: For more details on CSI proxy, see the `CSI proxy GitHub repo + `_. + :paramtype enable_csi_proxy: bool + :keyword gmsa_profile: The Windows gMSA Profile in the Managed Cluster. + :paramtype gmsa_profile: ~azure.mgmt.containerservice.v2022_07_01.models.WindowsGmsaProfile + """ + super().__init__(**kwargs) + self.admin_username = admin_username + self.admin_password = admin_password + self.license_type = license_type + self.enable_csi_proxy = enable_csi_proxy + self.gmsa_profile = gmsa_profile + + +class ManagedServiceIdentityUserAssignedIdentitiesValue(_serialization.Model): + """ManagedServiceIdentityUserAssignedIdentitiesValue. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The principal id of user assigned identity. + :vartype principal_id: str + :ivar client_id: The client id of user assigned identity. + :vartype client_id: str + """ + + _validation = { + "principal_id": {"readonly": True}, + "client_id": {"readonly": True}, + } + + _attribute_map = { + "principal_id": {"key": "principalId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + } + + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) + self.principal_id = None + self.client_id = None + + +class OperationListResult(_serialization.Model): + """The List Operation response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The list of operations. + :vartype value: list[~azure.mgmt.containerservice.v2022_07_01.models.OperationValue] + """ + + _validation = { + "value": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[OperationValue]"}, + } + + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) + self.value = None + + +class OperationValue(_serialization.Model): + """Describes the properties of a Operation value. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar origin: The origin of the operation. + :vartype origin: str + :ivar name: The name of the operation. + :vartype name: str + :ivar operation: The display name of the operation. + :vartype operation: str + :ivar resource: The display name of the resource the operation applies to. + :vartype resource: str + :ivar description: The description of the operation. + :vartype description: str + :ivar provider: The resource provider for the operation. + :vartype provider: str + """ + + _validation = { + "origin": {"readonly": True}, + "name": {"readonly": True}, + "operation": {"readonly": True}, + "resource": {"readonly": True}, + "description": {"readonly": True}, + "provider": {"readonly": True}, + } + + _attribute_map = { + "origin": {"key": "origin", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "operation": {"key": "display.operation", "type": "str"}, + "resource": {"key": "display.resource", "type": "str"}, + "description": {"key": "display.description", "type": "str"}, + "provider": {"key": "display.provider", "type": "str"}, + } + + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) + self.origin = None + self.name = None + self.operation = None + self.resource = None + self.description = None + self.provider = None + + +class OSOptionProfile(_serialization.Model): + """The OS option profile. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The ID of the OS option resource. + :vartype id: str + :ivar name: The name of the OS option resource. + :vartype name: str + :ivar type: The type of the OS option resource. + :vartype type: str + :ivar os_option_property_list: The list of OS options. Required. + :vartype os_option_property_list: + list[~azure.mgmt.containerservice.v2022_07_01.models.OSOptionProperty] + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "os_option_property_list": {"required": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "os_option_property_list": {"key": "properties.osOptionPropertyList", "type": "[OSOptionProperty]"}, + } + + def __init__(self, *, os_option_property_list: List["_models.OSOptionProperty"], **kwargs): + """ + :keyword os_option_property_list: The list of OS options. Required. + :paramtype os_option_property_list: + list[~azure.mgmt.containerservice.v2022_07_01.models.OSOptionProperty] + """ + super().__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.os_option_property_list = os_option_property_list + + +class OSOptionProperty(_serialization.Model): + """OS option property. + + All required parameters must be populated in order to send to Azure. + + :ivar os_type: The OS type. Required. + :vartype os_type: str + :ivar enable_fips_image: Whether the image is FIPS-enabled. Required. + :vartype enable_fips_image: bool + """ + + _validation = { + "os_type": {"required": True}, + "enable_fips_image": {"required": True}, + } + + _attribute_map = { + "os_type": {"key": "os-type", "type": "str"}, + "enable_fips_image": {"key": "enable-fips-image", "type": "bool"}, + } + + def __init__(self, *, os_type: str, enable_fips_image: bool, **kwargs): + """ + :keyword os_type: The OS type. Required. + :paramtype os_type: str + :keyword enable_fips_image: Whether the image is FIPS-enabled. Required. + :paramtype enable_fips_image: bool + """ + super().__init__(**kwargs) + self.os_type = os_type + self.enable_fips_image = enable_fips_image + + +class OutboundEnvironmentEndpoint(_serialization.Model): + """Egress endpoints which AKS agent nodes connect to for common purpose. + + :ivar category: The category of endpoints accessed by the AKS agent node, e.g. + azure-resource-management, apiserver, etc. + :vartype category: str + :ivar endpoints: The endpoints that AKS agent nodes connect to. + :vartype endpoints: list[~azure.mgmt.containerservice.v2022_07_01.models.EndpointDependency] + """ + + _attribute_map = { + "category": {"key": "category", "type": "str"}, + "endpoints": {"key": "endpoints", "type": "[EndpointDependency]"}, + } + + def __init__( + self, + *, + category: Optional[str] = None, + endpoints: Optional[List["_models.EndpointDependency"]] = None, + **kwargs + ): + """ + :keyword category: The category of endpoints accessed by the AKS agent node, e.g. + azure-resource-management, apiserver, etc. + :paramtype category: str + :keyword endpoints: The endpoints that AKS agent nodes connect to. + :paramtype endpoints: list[~azure.mgmt.containerservice.v2022_07_01.models.EndpointDependency] + """ + super().__init__(**kwargs) + self.category = category + self.endpoints = endpoints + + +class OutboundEnvironmentEndpointCollection(_serialization.Model): + """Collection of OutboundEnvironmentEndpoint. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar value: Collection of resources. Required. + :vartype value: + list[~azure.mgmt.containerservice.v2022_07_01.models.OutboundEnvironmentEndpoint] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[OutboundEnvironmentEndpoint]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.OutboundEnvironmentEndpoint"], **kwargs): + """ + :keyword value: Collection of resources. Required. + :paramtype value: + list[~azure.mgmt.containerservice.v2022_07_01.models.OutboundEnvironmentEndpoint] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class PowerState(_serialization.Model): + """Describes the Power State of the cluster. + + :ivar code: Tells whether the cluster is Running or Stopped. Known values are: "Running" and + "Stopped". + :vartype code: str or ~azure.mgmt.containerservice.v2022_07_01.models.Code + """ + + _attribute_map = { + "code": {"key": "code", "type": "str"}, + } + + def __init__(self, *, code: Optional[Union[str, "_models.Code"]] = None, **kwargs): + """ + :keyword code: Tells whether the cluster is Running or Stopped. Known values are: "Running" and + "Stopped". + :paramtype code: str or ~azure.mgmt.containerservice.v2022_07_01.models.Code + """ + super().__init__(**kwargs) + self.code = code + + +class PrivateEndpoint(_serialization.Model): + """Private endpoint which a connection belongs to. + + :ivar id: The resource ID of the private endpoint. + :vartype id: str + """ + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + } + + def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin + """ + :keyword id: The resource ID of the private endpoint. + :paramtype id: str + """ + super().__init__(**kwargs) + self.id = id + + +class PrivateEndpointConnection(_serialization.Model): + """A private endpoint connection. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The ID of the private endpoint connection. + :vartype id: str + :ivar name: The name of the private endpoint connection. + :vartype name: str + :ivar type: The resource type. + :vartype type: str + :ivar provisioning_state: The current provisioning state. Known values are: "Succeeded", + "Creating", "Deleting", and "Failed". + :vartype provisioning_state: str or + ~azure.mgmt.containerservice.v2022_07_01.models.PrivateEndpointConnectionProvisioningState + :ivar private_endpoint: The resource of private endpoint. + :vartype private_endpoint: ~azure.mgmt.containerservice.v2022_07_01.models.PrivateEndpoint + :ivar private_link_service_connection_state: A collection of information about the state of the + connection between service consumer and provider. + :vartype private_link_service_connection_state: + ~azure.mgmt.containerservice.v2022_07_01.models.PrivateLinkServiceConnectionState + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "private_endpoint": {"key": "properties.privateEndpoint", "type": "PrivateEndpoint"}, + "private_link_service_connection_state": { + "key": "properties.privateLinkServiceConnectionState", + "type": "PrivateLinkServiceConnectionState", + }, + } + + def __init__( + self, + *, + private_endpoint: Optional["_models.PrivateEndpoint"] = None, + private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionState"] = None, + **kwargs + ): + """ + :keyword private_endpoint: The resource of private endpoint. + :paramtype private_endpoint: ~azure.mgmt.containerservice.v2022_07_01.models.PrivateEndpoint + :keyword private_link_service_connection_state: A collection of information about the state of + the connection between service consumer and provider. + :paramtype private_link_service_connection_state: + ~azure.mgmt.containerservice.v2022_07_01.models.PrivateLinkServiceConnectionState + """ + super().__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.provisioning_state = None + self.private_endpoint = private_endpoint + self.private_link_service_connection_state = private_link_service_connection_state + + +class PrivateEndpointConnectionListResult(_serialization.Model): + """A list of private endpoint connections. + + :ivar value: The collection value. + :vartype value: list[~azure.mgmt.containerservice.v2022_07_01.models.PrivateEndpointConnection] + """ + + _attribute_map = { + "value": {"key": "value", "type": "[PrivateEndpointConnection]"}, + } + + def __init__(self, *, value: Optional[List["_models.PrivateEndpointConnection"]] = None, **kwargs): + """ + :keyword value: The collection value. + :paramtype value: + list[~azure.mgmt.containerservice.v2022_07_01.models.PrivateEndpointConnection] + """ + super().__init__(**kwargs) + self.value = value + + +class PrivateLinkResource(_serialization.Model): + """A private link resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The ID of the private link resource. + :vartype id: str + :ivar name: The name of the private link resource. + :vartype name: str + :ivar type: The resource type. + :vartype type: str + :ivar group_id: The group ID of the resource. + :vartype group_id: str + :ivar required_members: The RequiredMembers of the resource. + :vartype required_members: list[str] + :ivar private_link_service_id: The private link service ID of the resource, this field is + exposed only to NRP internally. + :vartype private_link_service_id: str + """ + + _validation = { + "private_link_service_id": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "group_id": {"key": "groupId", "type": "str"}, + "required_members": {"key": "requiredMembers", "type": "[str]"}, + "private_link_service_id": {"key": "privateLinkServiceID", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + type: Optional[str] = None, + group_id: Optional[str] = None, + required_members: Optional[List[str]] = None, + **kwargs + ): + """ + :keyword id: The ID of the private link resource. + :paramtype id: str + :keyword name: The name of the private link resource. + :paramtype name: str + :keyword type: The resource type. + :paramtype type: str + :keyword group_id: The group ID of the resource. + :paramtype group_id: str + :keyword required_members: The RequiredMembers of the resource. + :paramtype required_members: list[str] + """ + super().__init__(**kwargs) + self.id = id + self.name = name + self.type = type + self.group_id = group_id + self.required_members = required_members + self.private_link_service_id = None + + +class PrivateLinkResourcesListResult(_serialization.Model): + """A list of private link resources. + + :ivar value: The collection value. + :vartype value: list[~azure.mgmt.containerservice.v2022_07_01.models.PrivateLinkResource] + """ + + _attribute_map = { + "value": {"key": "value", "type": "[PrivateLinkResource]"}, + } + + def __init__(self, *, value: Optional[List["_models.PrivateLinkResource"]] = None, **kwargs): + """ + :keyword value: The collection value. + :paramtype value: list[~azure.mgmt.containerservice.v2022_07_01.models.PrivateLinkResource] + """ + super().__init__(**kwargs) + self.value = value + + +class PrivateLinkServiceConnectionState(_serialization.Model): + """The state of a private link service connection. + + :ivar status: The private link service connection status. Known values are: "Pending", + "Approved", "Rejected", and "Disconnected". + :vartype status: str or ~azure.mgmt.containerservice.v2022_07_01.models.ConnectionStatus + :ivar description: The private link service connection description. + :vartype description: str + """ + + _attribute_map = { + "status": {"key": "status", "type": "str"}, + "description": {"key": "description", "type": "str"}, + } + + def __init__( + self, + *, + status: Optional[Union[str, "_models.ConnectionStatus"]] = None, + description: Optional[str] = None, + **kwargs + ): + """ + :keyword status: The private link service connection status. Known values are: "Pending", + "Approved", "Rejected", and "Disconnected". + :paramtype status: str or ~azure.mgmt.containerservice.v2022_07_01.models.ConnectionStatus + :keyword description: The private link service connection description. + :paramtype description: str + """ + super().__init__(**kwargs) + self.status = status + self.description = description + + +class ResourceReference(_serialization.Model): + """A reference to an Azure resource. + + :ivar id: The fully qualified Azure resource id. + :vartype id: str + """ + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + } + + def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin + """ + :keyword id: The fully qualified Azure resource id. + :paramtype id: str + """ + super().__init__(**kwargs) + self.id = id + + +class RunCommandRequest(_serialization.Model): + """A run command request. + + All required parameters must be populated in order to send to Azure. + + :ivar command: The command to run. Required. + :vartype command: str + :ivar context: A base64 encoded zip file containing the files required by the command. + :vartype context: str + :ivar cluster_token: AuthToken issued for AKS AAD Server App. + :vartype cluster_token: str + """ + + _validation = { + "command": {"required": True}, + } + + _attribute_map = { + "command": {"key": "command", "type": "str"}, + "context": {"key": "context", "type": "str"}, + "cluster_token": {"key": "clusterToken", "type": "str"}, + } + + def __init__(self, *, command: str, context: Optional[str] = None, cluster_token: Optional[str] = None, **kwargs): + """ + :keyword command: The command to run. Required. + :paramtype command: str + :keyword context: A base64 encoded zip file containing the files required by the command. + :paramtype context: str + :keyword cluster_token: AuthToken issued for AKS AAD Server App. + :paramtype cluster_token: str + """ + super().__init__(**kwargs) + self.command = command + self.context = context + self.cluster_token = cluster_token + + +class RunCommandResult(_serialization.Model): + """run command result. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The command id. + :vartype id: str + :ivar provisioning_state: provisioning State. + :vartype provisioning_state: str + :ivar exit_code: The exit code of the command. + :vartype exit_code: int + :ivar started_at: The time when the command started. + :vartype started_at: ~datetime.datetime + :ivar finished_at: The time when the command finished. + :vartype finished_at: ~datetime.datetime + :ivar logs: The command output. + :vartype logs: str + :ivar reason: An explanation of why provisioningState is set to failed (if so). + :vartype reason: str + """ + + _validation = { + "id": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "exit_code": {"readonly": True}, + "started_at": {"readonly": True}, + "finished_at": {"readonly": True}, + "logs": {"readonly": True}, + "reason": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "exit_code": {"key": "properties.exitCode", "type": "int"}, + "started_at": {"key": "properties.startedAt", "type": "iso-8601"}, + "finished_at": {"key": "properties.finishedAt", "type": "iso-8601"}, + "logs": {"key": "properties.logs", "type": "str"}, + "reason": {"key": "properties.reason", "type": "str"}, + } + + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) + self.id = None + self.provisioning_state = None + self.exit_code = None + self.started_at = None + self.finished_at = None + self.logs = None + self.reason = None + + +class Snapshot(TrackedResource): # pylint: disable=too-many-instance-attributes + """A node pool snapshot resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.containerservice.v2022_07_01.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 creation_data: CreationData to be used to specify the source agent pool resource ID to + create this snapshot. + :vartype creation_data: ~azure.mgmt.containerservice.v2022_07_01.models.CreationData + :ivar snapshot_type: The type of a snapshot. The default is NodePool. "NodePool" + :vartype snapshot_type: str or ~azure.mgmt.containerservice.v2022_07_01.models.SnapshotType + :ivar kubernetes_version: The version of Kubernetes. + :vartype kubernetes_version: str + :ivar node_image_version: The version of node image. + :vartype node_image_version: str + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". + :vartype os_type: str or ~azure.mgmt.containerservice.v2022_07_01.models.OSType + :ivar os_sku: Specifies the OS SKU used by the agent pool. The default is Ubuntu if OSType is + Linux. The default is Windows2019 when Kubernetes <= 1.24 or Windows2022 when Kubernetes >= + 1.25 if OSType is Windows. Known values are: "Ubuntu", "CBLMariner", "Windows2019", and + "Windows2022". + :vartype os_sku: str or ~azure.mgmt.containerservice.v2022_07_01.models.OSSKU + :ivar vm_size: The size of the VM. + :vartype vm_size: str + :ivar enable_fips: Whether to use a FIPS-enabled OS. + :vartype enable_fips: bool + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, + "kubernetes_version": {"readonly": True}, + "node_image_version": {"readonly": True}, + "os_type": {"readonly": True}, + "os_sku": {"readonly": True}, + "vm_size": {"readonly": True}, + "enable_fips": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "creation_data": {"key": "properties.creationData", "type": "CreationData"}, + "snapshot_type": {"key": "properties.snapshotType", "type": "str"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "node_image_version": {"key": "properties.nodeImageVersion", "type": "str"}, + "os_type": {"key": "properties.osType", "type": "str"}, + "os_sku": {"key": "properties.osSku", "type": "str"}, + "vm_size": {"key": "properties.vmSize", "type": "str"}, + "enable_fips": {"key": "properties.enableFIPS", "type": "bool"}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + creation_data: Optional["_models.CreationData"] = None, + snapshot_type: Union[str, "_models.SnapshotType"] = "NodePool", + **kwargs + ): + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str + :keyword creation_data: CreationData to be used to specify the source agent pool resource ID to + create this snapshot. + :paramtype creation_data: ~azure.mgmt.containerservice.v2022_07_01.models.CreationData + :keyword snapshot_type: The type of a snapshot. The default is NodePool. "NodePool" + :paramtype snapshot_type: str or ~azure.mgmt.containerservice.v2022_07_01.models.SnapshotType + """ + super().__init__(tags=tags, location=location, **kwargs) + self.creation_data = creation_data + self.snapshot_type = snapshot_type + self.kubernetes_version = None + self.node_image_version = None + self.os_type = None + self.os_sku = None + self.vm_size = None + self.enable_fips = None + + +class SnapshotListResult(_serialization.Model): + """The response from the List Snapshots operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The list of snapshots. + :vartype value: list[~azure.mgmt.containerservice.v2022_07_01.models.Snapshot] + :ivar next_link: The URL to get the next set of snapshot results. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[Snapshot]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: Optional[List["_models.Snapshot"]] = None, **kwargs): + """ + :keyword value: The list of snapshots. + :paramtype value: list[~azure.mgmt.containerservice.v2022_07_01.models.Snapshot] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class SysctlConfig(_serialization.Model): # pylint: disable=too-many-instance-attributes + """Sysctl settings for Linux agent nodes. + + :ivar net_core_somaxconn: Sysctl setting net.core.somaxconn. + :vartype net_core_somaxconn: int + :ivar net_core_netdev_max_backlog: Sysctl setting net.core.netdev_max_backlog. + :vartype net_core_netdev_max_backlog: int + :ivar net_core_rmem_default: Sysctl setting net.core.rmem_default. + :vartype net_core_rmem_default: int + :ivar net_core_rmem_max: Sysctl setting net.core.rmem_max. + :vartype net_core_rmem_max: int + :ivar net_core_wmem_default: Sysctl setting net.core.wmem_default. + :vartype net_core_wmem_default: int + :ivar net_core_wmem_max: Sysctl setting net.core.wmem_max. + :vartype net_core_wmem_max: int + :ivar net_core_optmem_max: Sysctl setting net.core.optmem_max. + :vartype net_core_optmem_max: int + :ivar net_ipv4_tcp_max_syn_backlog: Sysctl setting net.ipv4.tcp_max_syn_backlog. + :vartype net_ipv4_tcp_max_syn_backlog: int + :ivar net_ipv4_tcp_max_tw_buckets: Sysctl setting net.ipv4.tcp_max_tw_buckets. + :vartype net_ipv4_tcp_max_tw_buckets: int + :ivar net_ipv4_tcp_fin_timeout: Sysctl setting net.ipv4.tcp_fin_timeout. + :vartype net_ipv4_tcp_fin_timeout: int + :ivar net_ipv4_tcp_keepalive_time: Sysctl setting net.ipv4.tcp_keepalive_time. + :vartype net_ipv4_tcp_keepalive_time: int + :ivar net_ipv4_tcp_keepalive_probes: Sysctl setting net.ipv4.tcp_keepalive_probes. + :vartype net_ipv4_tcp_keepalive_probes: int + :ivar net_ipv4_tcpkeepalive_intvl: Sysctl setting net.ipv4.tcp_keepalive_intvl. + :vartype net_ipv4_tcpkeepalive_intvl: int + :ivar net_ipv4_tcp_tw_reuse: Sysctl setting net.ipv4.tcp_tw_reuse. + :vartype net_ipv4_tcp_tw_reuse: bool + :ivar net_ipv4_ip_local_port_range: Sysctl setting net.ipv4.ip_local_port_range. + :vartype net_ipv4_ip_local_port_range: str + :ivar net_ipv4_neigh_default_gc_thresh1: Sysctl setting net.ipv4.neigh.default.gc_thresh1. + :vartype net_ipv4_neigh_default_gc_thresh1: int + :ivar net_ipv4_neigh_default_gc_thresh2: Sysctl setting net.ipv4.neigh.default.gc_thresh2. + :vartype net_ipv4_neigh_default_gc_thresh2: int + :ivar net_ipv4_neigh_default_gc_thresh3: Sysctl setting net.ipv4.neigh.default.gc_thresh3. + :vartype net_ipv4_neigh_default_gc_thresh3: int + :ivar net_netfilter_nf_conntrack_max: Sysctl setting net.netfilter.nf_conntrack_max. + :vartype net_netfilter_nf_conntrack_max: int + :ivar net_netfilter_nf_conntrack_buckets: Sysctl setting net.netfilter.nf_conntrack_buckets. + :vartype net_netfilter_nf_conntrack_buckets: int + :ivar fs_inotify_max_user_watches: Sysctl setting fs.inotify.max_user_watches. + :vartype fs_inotify_max_user_watches: int + :ivar fs_file_max: Sysctl setting fs.file-max. + :vartype fs_file_max: int + :ivar fs_aio_max_nr: Sysctl setting fs.aio-max-nr. + :vartype fs_aio_max_nr: int + :ivar fs_nr_open: Sysctl setting fs.nr_open. + :vartype fs_nr_open: int + :ivar kernel_threads_max: Sysctl setting kernel.threads-max. + :vartype kernel_threads_max: int + :ivar vm_max_map_count: Sysctl setting vm.max_map_count. + :vartype vm_max_map_count: int + :ivar vm_swappiness: Sysctl setting vm.swappiness. + :vartype vm_swappiness: int + :ivar vm_vfs_cache_pressure: Sysctl setting vm.vfs_cache_pressure. + :vartype vm_vfs_cache_pressure: int + """ + + _attribute_map = { + "net_core_somaxconn": {"key": "netCoreSomaxconn", "type": "int"}, + "net_core_netdev_max_backlog": {"key": "netCoreNetdevMaxBacklog", "type": "int"}, + "net_core_rmem_default": {"key": "netCoreRmemDefault", "type": "int"}, + "net_core_rmem_max": {"key": "netCoreRmemMax", "type": "int"}, + "net_core_wmem_default": {"key": "netCoreWmemDefault", "type": "int"}, + "net_core_wmem_max": {"key": "netCoreWmemMax", "type": "int"}, + "net_core_optmem_max": {"key": "netCoreOptmemMax", "type": "int"}, + "net_ipv4_tcp_max_syn_backlog": {"key": "netIpv4TcpMaxSynBacklog", "type": "int"}, + "net_ipv4_tcp_max_tw_buckets": {"key": "netIpv4TcpMaxTwBuckets", "type": "int"}, + "net_ipv4_tcp_fin_timeout": {"key": "netIpv4TcpFinTimeout", "type": "int"}, + "net_ipv4_tcp_keepalive_time": {"key": "netIpv4TcpKeepaliveTime", "type": "int"}, + "net_ipv4_tcp_keepalive_probes": {"key": "netIpv4TcpKeepaliveProbes", "type": "int"}, + "net_ipv4_tcpkeepalive_intvl": {"key": "netIpv4TcpkeepaliveIntvl", "type": "int"}, + "net_ipv4_tcp_tw_reuse": {"key": "netIpv4TcpTwReuse", "type": "bool"}, + "net_ipv4_ip_local_port_range": {"key": "netIpv4IpLocalPortRange", "type": "str"}, + "net_ipv4_neigh_default_gc_thresh1": {"key": "netIpv4NeighDefaultGcThresh1", "type": "int"}, + "net_ipv4_neigh_default_gc_thresh2": {"key": "netIpv4NeighDefaultGcThresh2", "type": "int"}, + "net_ipv4_neigh_default_gc_thresh3": {"key": "netIpv4NeighDefaultGcThresh3", "type": "int"}, + "net_netfilter_nf_conntrack_max": {"key": "netNetfilterNfConntrackMax", "type": "int"}, + "net_netfilter_nf_conntrack_buckets": {"key": "netNetfilterNfConntrackBuckets", "type": "int"}, + "fs_inotify_max_user_watches": {"key": "fsInotifyMaxUserWatches", "type": "int"}, + "fs_file_max": {"key": "fsFileMax", "type": "int"}, + "fs_aio_max_nr": {"key": "fsAioMaxNr", "type": "int"}, + "fs_nr_open": {"key": "fsNrOpen", "type": "int"}, + "kernel_threads_max": {"key": "kernelThreadsMax", "type": "int"}, + "vm_max_map_count": {"key": "vmMaxMapCount", "type": "int"}, + "vm_swappiness": {"key": "vmSwappiness", "type": "int"}, + "vm_vfs_cache_pressure": {"key": "vmVfsCachePressure", "type": "int"}, + } + + def __init__( # pylint: disable=too-many-locals + self, + *, + net_core_somaxconn: Optional[int] = None, + net_core_netdev_max_backlog: Optional[int] = None, + net_core_rmem_default: Optional[int] = None, + net_core_rmem_max: Optional[int] = None, + net_core_wmem_default: Optional[int] = None, + net_core_wmem_max: Optional[int] = None, + net_core_optmem_max: Optional[int] = None, + net_ipv4_tcp_max_syn_backlog: Optional[int] = None, + net_ipv4_tcp_max_tw_buckets: Optional[int] = None, + net_ipv4_tcp_fin_timeout: Optional[int] = None, + net_ipv4_tcp_keepalive_time: Optional[int] = None, + net_ipv4_tcp_keepalive_probes: Optional[int] = None, + net_ipv4_tcpkeepalive_intvl: Optional[int] = None, + net_ipv4_tcp_tw_reuse: Optional[bool] = None, + net_ipv4_ip_local_port_range: Optional[str] = None, + net_ipv4_neigh_default_gc_thresh1: Optional[int] = None, + net_ipv4_neigh_default_gc_thresh2: Optional[int] = None, + net_ipv4_neigh_default_gc_thresh3: Optional[int] = None, + net_netfilter_nf_conntrack_max: Optional[int] = None, + net_netfilter_nf_conntrack_buckets: Optional[int] = None, + fs_inotify_max_user_watches: Optional[int] = None, + fs_file_max: Optional[int] = None, + fs_aio_max_nr: Optional[int] = None, + fs_nr_open: Optional[int] = None, + kernel_threads_max: Optional[int] = None, + vm_max_map_count: Optional[int] = None, + vm_swappiness: Optional[int] = None, + vm_vfs_cache_pressure: Optional[int] = None, + **kwargs + ): + """ + :keyword net_core_somaxconn: Sysctl setting net.core.somaxconn. + :paramtype net_core_somaxconn: int + :keyword net_core_netdev_max_backlog: Sysctl setting net.core.netdev_max_backlog. + :paramtype net_core_netdev_max_backlog: int + :keyword net_core_rmem_default: Sysctl setting net.core.rmem_default. + :paramtype net_core_rmem_default: int + :keyword net_core_rmem_max: Sysctl setting net.core.rmem_max. + :paramtype net_core_rmem_max: int + :keyword net_core_wmem_default: Sysctl setting net.core.wmem_default. + :paramtype net_core_wmem_default: int + :keyword net_core_wmem_max: Sysctl setting net.core.wmem_max. + :paramtype net_core_wmem_max: int + :keyword net_core_optmem_max: Sysctl setting net.core.optmem_max. + :paramtype net_core_optmem_max: int + :keyword net_ipv4_tcp_max_syn_backlog: Sysctl setting net.ipv4.tcp_max_syn_backlog. + :paramtype net_ipv4_tcp_max_syn_backlog: int + :keyword net_ipv4_tcp_max_tw_buckets: Sysctl setting net.ipv4.tcp_max_tw_buckets. + :paramtype net_ipv4_tcp_max_tw_buckets: int + :keyword net_ipv4_tcp_fin_timeout: Sysctl setting net.ipv4.tcp_fin_timeout. + :paramtype net_ipv4_tcp_fin_timeout: int + :keyword net_ipv4_tcp_keepalive_time: Sysctl setting net.ipv4.tcp_keepalive_time. + :paramtype net_ipv4_tcp_keepalive_time: int + :keyword net_ipv4_tcp_keepalive_probes: Sysctl setting net.ipv4.tcp_keepalive_probes. + :paramtype net_ipv4_tcp_keepalive_probes: int + :keyword net_ipv4_tcpkeepalive_intvl: Sysctl setting net.ipv4.tcp_keepalive_intvl. + :paramtype net_ipv4_tcpkeepalive_intvl: int + :keyword net_ipv4_tcp_tw_reuse: Sysctl setting net.ipv4.tcp_tw_reuse. + :paramtype net_ipv4_tcp_tw_reuse: bool + :keyword net_ipv4_ip_local_port_range: Sysctl setting net.ipv4.ip_local_port_range. + :paramtype net_ipv4_ip_local_port_range: str + :keyword net_ipv4_neigh_default_gc_thresh1: Sysctl setting net.ipv4.neigh.default.gc_thresh1. + :paramtype net_ipv4_neigh_default_gc_thresh1: int + :keyword net_ipv4_neigh_default_gc_thresh2: Sysctl setting net.ipv4.neigh.default.gc_thresh2. + :paramtype net_ipv4_neigh_default_gc_thresh2: int + :keyword net_ipv4_neigh_default_gc_thresh3: Sysctl setting net.ipv4.neigh.default.gc_thresh3. + :paramtype net_ipv4_neigh_default_gc_thresh3: int + :keyword net_netfilter_nf_conntrack_max: Sysctl setting net.netfilter.nf_conntrack_max. + :paramtype net_netfilter_nf_conntrack_max: int + :keyword net_netfilter_nf_conntrack_buckets: Sysctl setting net.netfilter.nf_conntrack_buckets. + :paramtype net_netfilter_nf_conntrack_buckets: int + :keyword fs_inotify_max_user_watches: Sysctl setting fs.inotify.max_user_watches. + :paramtype fs_inotify_max_user_watches: int + :keyword fs_file_max: Sysctl setting fs.file-max. + :paramtype fs_file_max: int + :keyword fs_aio_max_nr: Sysctl setting fs.aio-max-nr. + :paramtype fs_aio_max_nr: int + :keyword fs_nr_open: Sysctl setting fs.nr_open. + :paramtype fs_nr_open: int + :keyword kernel_threads_max: Sysctl setting kernel.threads-max. + :paramtype kernel_threads_max: int + :keyword vm_max_map_count: Sysctl setting vm.max_map_count. + :paramtype vm_max_map_count: int + :keyword vm_swappiness: Sysctl setting vm.swappiness. + :paramtype vm_swappiness: int + :keyword vm_vfs_cache_pressure: Sysctl setting vm.vfs_cache_pressure. + :paramtype vm_vfs_cache_pressure: int + """ + super().__init__(**kwargs) + self.net_core_somaxconn = net_core_somaxconn + self.net_core_netdev_max_backlog = net_core_netdev_max_backlog + self.net_core_rmem_default = net_core_rmem_default + self.net_core_rmem_max = net_core_rmem_max + self.net_core_wmem_default = net_core_wmem_default + self.net_core_wmem_max = net_core_wmem_max + self.net_core_optmem_max = net_core_optmem_max + self.net_ipv4_tcp_max_syn_backlog = net_ipv4_tcp_max_syn_backlog + self.net_ipv4_tcp_max_tw_buckets = net_ipv4_tcp_max_tw_buckets + self.net_ipv4_tcp_fin_timeout = net_ipv4_tcp_fin_timeout + self.net_ipv4_tcp_keepalive_time = net_ipv4_tcp_keepalive_time + self.net_ipv4_tcp_keepalive_probes = net_ipv4_tcp_keepalive_probes + self.net_ipv4_tcpkeepalive_intvl = net_ipv4_tcpkeepalive_intvl + self.net_ipv4_tcp_tw_reuse = net_ipv4_tcp_tw_reuse + self.net_ipv4_ip_local_port_range = net_ipv4_ip_local_port_range + self.net_ipv4_neigh_default_gc_thresh1 = net_ipv4_neigh_default_gc_thresh1 + self.net_ipv4_neigh_default_gc_thresh2 = net_ipv4_neigh_default_gc_thresh2 + self.net_ipv4_neigh_default_gc_thresh3 = net_ipv4_neigh_default_gc_thresh3 + self.net_netfilter_nf_conntrack_max = net_netfilter_nf_conntrack_max + self.net_netfilter_nf_conntrack_buckets = net_netfilter_nf_conntrack_buckets + self.fs_inotify_max_user_watches = fs_inotify_max_user_watches + self.fs_file_max = fs_file_max + self.fs_aio_max_nr = fs_aio_max_nr + self.fs_nr_open = fs_nr_open + self.kernel_threads_max = kernel_threads_max + self.vm_max_map_count = vm_max_map_count + self.vm_swappiness = vm_swappiness + self.vm_vfs_cache_pressure = vm_vfs_cache_pressure + + +class SystemData(_serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", and "Key". + :vartype created_by_type: str or ~azure.mgmt.containerservice.v2022_07_01.models.CreatedByType + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", and "Key". + :vartype last_modified_by_type: str or + ~azure.mgmt.containerservice.v2022_07_01.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + "created_by": {"key": "createdBy", "type": "str"}, + "created_by_type": {"key": "createdByType", "type": "str"}, + "created_at": {"key": "createdAt", "type": "iso-8601"}, + "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, + "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, + "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, + } + + def __init__( + self, + *, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, + created_at: Optional[datetime.datetime] = None, + last_modified_by: Optional[str] = None, + last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, + last_modified_at: Optional[datetime.datetime] = None, + **kwargs + ): + """ + :keyword created_by: The identity that created the resource. + :paramtype created_by: str + :keyword created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", and "Key". + :paramtype created_by_type: str or + ~azure.mgmt.containerservice.v2022_07_01.models.CreatedByType + :keyword created_at: The timestamp of resource creation (UTC). + :paramtype created_at: ~datetime.datetime + :keyword last_modified_by: The identity that last modified the resource. + :paramtype last_modified_by: str + :keyword last_modified_by_type: The type of identity that last modified the resource. Known + values are: "User", "Application", "ManagedIdentity", and "Key". + :paramtype last_modified_by_type: str or + ~azure.mgmt.containerservice.v2022_07_01.models.CreatedByType + :keyword last_modified_at: The timestamp of resource last modification (UTC). + :paramtype last_modified_at: ~datetime.datetime + """ + super().__init__(**kwargs) + self.created_by = created_by + self.created_by_type = created_by_type + self.created_at = created_at + self.last_modified_by = last_modified_by + self.last_modified_by_type = last_modified_by_type + self.last_modified_at = last_modified_at + + +class TagsObject(_serialization.Model): + """Tags object for patch operations. + + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + """ + + _attribute_map = { + "tags": {"key": "tags", "type": "{str}"}, + } + + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + """ + super().__init__(**kwargs) + self.tags = tags + + +class TimeInWeek(_serialization.Model): + """Time in a week. + + :ivar day: The day of the week. Known values are: "Sunday", "Monday", "Tuesday", "Wednesday", + "Thursday", "Friday", and "Saturday". + :vartype day: str or ~azure.mgmt.containerservice.v2022_07_01.models.WeekDay + :ivar hour_slots: Each integer hour represents a time range beginning at 0m after the hour + ending at the next hour (non-inclusive). 0 corresponds to 00:00 UTC, 23 corresponds to 23:00 + UTC. Specifying [0, 1] means the 00:00 - 02:00 UTC time range. + :vartype hour_slots: list[int] + """ + + _attribute_map = { + "day": {"key": "day", "type": "str"}, + "hour_slots": {"key": "hourSlots", "type": "[int]"}, + } + + def __init__( + self, *, day: Optional[Union[str, "_models.WeekDay"]] = None, hour_slots: Optional[List[int]] = None, **kwargs + ): + """ + :keyword day: The day of the week. Known values are: "Sunday", "Monday", "Tuesday", + "Wednesday", "Thursday", "Friday", and "Saturday". + :paramtype day: str or ~azure.mgmt.containerservice.v2022_07_01.models.WeekDay + :keyword hour_slots: Each integer hour represents a time range beginning at 0m after the hour + ending at the next hour (non-inclusive). 0 corresponds to 00:00 UTC, 23 corresponds to 23:00 + UTC. Specifying [0, 1] means the 00:00 - 02:00 UTC time range. + :paramtype hour_slots: list[int] + """ + super().__init__(**kwargs) + self.day = day + self.hour_slots = hour_slots + + +class TimeSpan(_serialization.Model): + """For example, between 2021-05-25T13:00:00Z and 2021-05-25T14:00:00Z. + + :ivar start: The start of a time span. + :vartype start: ~datetime.datetime + :ivar end: The end of a time span. + :vartype end: ~datetime.datetime + """ + + _attribute_map = { + "start": {"key": "start", "type": "iso-8601"}, + "end": {"key": "end", "type": "iso-8601"}, + } + + def __init__(self, *, start: Optional[datetime.datetime] = None, end: Optional[datetime.datetime] = None, **kwargs): + """ + :keyword start: The start of a time span. + :paramtype start: ~datetime.datetime + :keyword end: The end of a time span. + :paramtype end: ~datetime.datetime + """ + super().__init__(**kwargs) + self.start = start + self.end = end + + +class WindowsGmsaProfile(_serialization.Model): + """Windows gMSA Profile in the managed cluster. + + :ivar enabled: Specifies whether to enable Windows gMSA in the managed cluster. + :vartype enabled: bool + :ivar dns_server: Specifies the DNS server for Windows gMSA. :code:`
`:code:`
` Set it to + empty if you have configured the DNS server in the vnet which is used to create the managed + cluster. + :vartype dns_server: str + :ivar root_domain_name: Specifies the root domain name for Windows gMSA. + :code:`
`:code:`
` Set it to empty if you have configured the DNS server in the vnet + which is used to create the managed cluster. + :vartype root_domain_name: str + """ + + _attribute_map = { + "enabled": {"key": "enabled", "type": "bool"}, + "dns_server": {"key": "dnsServer", "type": "str"}, + "root_domain_name": {"key": "rootDomainName", "type": "str"}, + } + + def __init__( + self, + *, + enabled: Optional[bool] = None, + dns_server: Optional[str] = None, + root_domain_name: Optional[str] = None, + **kwargs + ): + """ + :keyword enabled: Specifies whether to enable Windows gMSA in the managed cluster. + :paramtype enabled: bool + :keyword dns_server: Specifies the DNS server for Windows gMSA. :code:`
`:code:`
` Set it + to empty if you have configured the DNS server in the vnet which is used to create the managed + cluster. + :paramtype dns_server: str + :keyword root_domain_name: Specifies the root domain name for Windows gMSA. + :code:`
`:code:`
` Set it to empty if you have configured the DNS server in the vnet + which is used to create the managed cluster. + :paramtype root_domain_name: str + """ + super().__init__(**kwargs) + self.enabled = enabled + self.dns_server = dns_server + self.root_domain_name = root_domain_name diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/models/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/models/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/models/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/operations/__init__.py new file mode 100644 index 000000000000..593b23075ce0 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/operations/__init__.py @@ -0,0 +1,33 @@ +# 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 ._operations import Operations +from ._managed_clusters_operations import ManagedClustersOperations +from ._maintenance_configurations_operations import MaintenanceConfigurationsOperations +from ._agent_pools_operations import AgentPoolsOperations +from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations +from ._private_link_resources_operations import PrivateLinkResourcesOperations +from ._resolve_private_link_service_id_operations import ResolvePrivateLinkServiceIdOperations +from ._snapshots_operations import SnapshotsOperations + +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "Operations", + "ManagedClustersOperations", + "MaintenanceConfigurationsOperations", + "AgentPoolsOperations", + "PrivateEndpointConnectionsOperations", + "PrivateLinkResourcesOperations", + "ResolvePrivateLinkServiceIdOperations", + "SnapshotsOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/operations/_agent_pools_operations.py new file mode 100644 index 000000000000..e23d6c03b003 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/operations/_agent_pools_operations.py @@ -0,0 +1,1076 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_upgrade_profile_request( + resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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_available_agent_pool_versions_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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_upgrade_node_image_version_request( + resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str"), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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 AgentPoolsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_07_01.ContainerServiceClient`'s + :attr:`agent_pools` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> Iterable["_models.AgentPool"]: + """Gets a list of agent pools in the specified managed cluster. + + Gets a list of agent pools in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AgentPool or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_07_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("AgentPoolListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore + + @distributed_trace + def get( + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any + ) -> _models.AgentPool: + """Gets the specified managed cluster agent pool. + + Gets the specified managed cluster agent pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AgentPool or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_01.models.AgentPool + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] + + request = build_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AgentPool", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: Union[_models.AgentPool, IO], + **kwargs: Any + ) -> _models.AgentPool: + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "AgentPool") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_or_update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("AgentPool", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("AgentPool", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: _models.AgentPool, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AgentPool]: + """Creates or updates an agent pool in the specified managed cluster. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: The agent pool to create or update. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_07_01.models.AgentPool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_07_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AgentPool]: + """Creates or updates an agent pool in the specified managed cluster. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: The agent pool to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_07_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: Union[_models.AgentPool, IO], + **kwargs: Any + ) -> LROPoller[_models.AgentPool]: + """Creates or updates an agent pool in the specified managed cluster. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: The agent pool to create or update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.mgmt.containerservice.v2022_07_01.models.AgentPool or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_07_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPool] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + agent_pool_name=agent_pool_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("AgentPool", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any + ) -> None: + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + + request = build_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + + @distributed_trace + def begin_delete( + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes an agent pool in the specified managed cluster. + + Deletes an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + agent_pool_name=agent_pool_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + + @distributed_trace + def get_upgrade_profile( + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any + ) -> _models.AgentPoolUpgradeProfile: + """Gets the upgrade profile for an agent pool. + + Gets the upgrade profile for an agent pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AgentPoolUpgradeProfile or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_01.models.AgentPoolUpgradeProfile + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolUpgradeProfile] + + request = build_get_upgrade_profile_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_upgrade_profile.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AgentPoolUpgradeProfile", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore + + @distributed_trace + def get_available_agent_pool_versions( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> _models.AgentPoolAvailableVersions: + """Gets a list of supported Kubernetes versions for the specified agent pool. + + See `supported Kubernetes versions + `_ for more details about + the version lifecycle. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AgentPoolAvailableVersions or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_01.models.AgentPoolAvailableVersions + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AgentPoolAvailableVersions] + + request = build_get_available_agent_pool_versions_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_available_agent_pool_versions.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AgentPoolAvailableVersions", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_available_agent_pool_versions.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore + + def _upgrade_node_image_version_initial( + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any + ) -> Optional[_models.AgentPool]: + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.AgentPool]] + + request = build_upgrade_node_image_version_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._upgrade_node_image_version_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("AgentPool", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _upgrade_node_image_version_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore + + @distributed_trace + def begin_upgrade_node_image_version( + self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Upgrades the node image version of an agent pool to the latest. + + Upgrading the node image version of an agent pool applies the newest OS and runtime updates to + the nodes. AKS provides one new image per week with the latest updates. For more details on + node image versions, see: https://docs.microsoft.com/azure/aks/node-image-upgrade. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_07_01.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + if cont_token is None: + raw_result = self._upgrade_node_image_version_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + agent_pool_name=agent_pool_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("AgentPool", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, response_headers) + return deserialized + + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_upgrade_node_image_version.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/operations/_maintenance_configurations_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/operations/_maintenance_configurations_operations.py new file mode 100644 index 000000000000..bc62823fca84 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/operations/_maintenance_configurations_operations.py @@ -0,0 +1,570 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +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_managed_cluster_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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, resource_name: str, config_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 = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "configName": _SERIALIZER.url("config_name", config_name, "str"), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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, resource_name: str, config_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 = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "configName": _SERIALIZER.url("config_name", config_name, "str"), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, resource_name: str, config_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 = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "configName": _SERIALIZER.url("config_name", config_name, "str"), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class MaintenanceConfigurationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_07_01.ContainerServiceClient`'s + :attr:`maintenance_configurations` 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_managed_cluster( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> Iterable["_models.MaintenanceConfiguration"]: + """Gets a list of maintenance configurations in the specified managed cluster. + + Gets a list of maintenance configurations in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either MaintenanceConfiguration or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_07_01.models.MaintenanceConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfigurationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_managed_cluster_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_managed_cluster.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("MaintenanceConfigurationListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_managed_cluster.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations"} # type: ignore + + @distributed_trace + def get( + self, resource_group_name: str, resource_name: str, config_name: str, **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Gets the specified maintenance configuration of a managed cluster. + + Gets the specified maintenance configuration of a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_01.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfiguration] + + request = build_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + config_name=config_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("MaintenanceConfiguration", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore + + @overload + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: _models.MaintenanceConfiguration, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configuration in the specified managed cluster. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: The maintenance configuration to create or update. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_07_01.models.MaintenanceConfiguration + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_01.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configuration in the specified managed cluster. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: The maintenance configuration to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_01.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: Union[_models.MaintenanceConfiguration, IO], + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configuration in the specified managed cluster. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: The maintenance configuration to create or update. Is either a model type or + a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_07_01.models.MaintenanceConfiguration or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_01.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.MaintenanceConfiguration] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "MaintenanceConfiguration") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + config_name=config_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.create_or_update.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("MaintenanceConfiguration", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, resource_name: str, config_name: str, **kwargs: Any + ) -> None: + """Deletes a maintenance configuration. + + Deletes a maintenance configuration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + + request = build_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + config_name=config_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.delete.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/operations/_managed_clusters_operations.py new file mode 100644 index 000000000000..db75f7e97cd9 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/operations/_managed_clusters_operations.py @@ -0,0 +1,3077 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_get_os_options_request( + location: str, subscription_id: str, *, resource_type: Optional[str] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "location": _SERIALIZER.url("location", location, "str", min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if resource_type is not None: + _params["resource-type"] = _SERIALIZER.query("resource_type", resource_type, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters" + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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_upgrade_profile_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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_access_profile_request( + resource_group_name: str, resource_name: str, role_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 = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "roleName": _SERIALIZER.url("role_name", role_name, "str"), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_cluster_admin_credentials_request( + resource_group_name: str, + resource_name: str, + subscription_id: str, + *, + server_fqdn: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if server_fqdn is not None: + _params["server-fqdn"] = _SERIALIZER.query("server_fqdn", server_fqdn, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_cluster_user_credentials_request( + resource_group_name: str, + resource_name: str, + subscription_id: str, + *, + server_fqdn: Optional[str] = None, + format: Optional[Union[str, "_models.Format"]] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if server_fqdn is not None: + _params["server-fqdn"] = _SERIALIZER.query("server_fqdn", server_fqdn, "str") + if format is not None: + _params["format"] = _SERIALIZER.query("format", format, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_cluster_monitoring_user_credentials_request( + resource_group_name: str, + resource_name: str, + subscription_id: str, + *, + server_fqdn: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if server_fqdn is not None: + _params["server-fqdn"] = _SERIALIZER.query("server_fqdn", server_fqdn, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request(resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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, resource_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_tags_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_reset_service_principal_profile_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_reset_aad_profile_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_rotate_cluster_certificates_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_stop_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_start_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_run_command_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_command_result_request( + resource_group_name: str, resource_name: str, command_id: 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 = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "commandId": _SERIALIZER.url("command_id", command_id, "str"), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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_list_outbound_network_dependencies_endpoints_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class ManagedClustersOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_07_01.ContainerServiceClient`'s + :attr:`managed_clusters` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get_os_options( + self, location: str, resource_type: Optional[str] = None, **kwargs: Any + ) -> _models.OSOptionProfile: + """Gets supported OS options in the specified subscription. + + Gets supported OS options in the specified subscription. + + :param location: The name of Azure region. Required. + :type location: str + :param resource_type: The resource type for which the OS options needs to be returned. Default + value is None. + :type resource_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: OSOptionProfile or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_01.models.OSOptionProfile + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OSOptionProfile] + + request = build_get_os_options_request( + location=location, + subscription_id=self._config.subscription_id, + resource_type=resource_type, + api_version=api_version, + template_url=self.get_os_options.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("OSOptionProfile", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_os_options.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default"} # type: ignore + + @distributed_trace + def list(self, **kwargs: Any) -> Iterable["_models.ManagedCluster"]: + """Gets a list of managed clusters in the specified subscription. + + Gets a list of managed clusters in the specified subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ManagedCluster or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_07_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ManagedClusterListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.ManagedCluster"]: + """Lists managed clusters in the specified subscription and resource group. + + Lists managed clusters in the specified subscription and resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ManagedCluster or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_07_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_resource_group.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ManagedClusterListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + + @distributed_trace + def get_upgrade_profile( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> _models.ManagedClusterUpgradeProfile: + """Gets the upgrade profile of a managed cluster. + + Gets the upgrade profile of a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedClusterUpgradeProfile or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_01.models.ManagedClusterUpgradeProfile + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterUpgradeProfile] + + request = build_get_upgrade_profile_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_upgrade_profile.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ManagedClusterUpgradeProfile", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_upgrade_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore + + @distributed_trace + def get_access_profile( + self, resource_group_name: str, resource_name: str, role_name: str, **kwargs: Any + ) -> _models.ManagedClusterAccessProfile: + """Gets an access profile of a managed cluster. + + **WARNING**\ : This API will be deprecated. Instead use `ListClusterUserCredentials + `_ or + `ListClusterAdminCredentials + `_ . + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param role_name: The name of the role for managed cluster accessProfile resource. Required. + :type role_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedClusterAccessProfile or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_01.models.ManagedClusterAccessProfile + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedClusterAccessProfile] + + request = build_get_access_profile_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + role_name=role_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_access_profile.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ManagedClusterAccessProfile", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_access_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore + + @distributed_trace + def list_cluster_admin_credentials( + self, resource_group_name: str, resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any + ) -> _models.CredentialResults: + """Lists the admin credentials of a managed cluster. + + Lists the admin credentials of a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. + :type server_fqdn: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CredentialResults or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_01.models.CredentialResults + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] + + request = build_list_cluster_admin_credentials_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + server_fqdn=server_fqdn, + api_version=api_version, + template_url=self.list_cluster_admin_credentials.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("CredentialResults", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_cluster_admin_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore + + @distributed_trace + def list_cluster_user_credentials( + self, + resource_group_name: str, + resource_name: str, + server_fqdn: Optional[str] = None, + format: Optional[Union[str, "_models.Format"]] = None, + **kwargs: Any + ) -> _models.CredentialResults: + """Lists the user credentials of a managed cluster. + + Lists the user credentials of a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. + :type server_fqdn: str + :param format: Only apply to AAD clusters, specifies the format of returned kubeconfig. Format + 'azure' will return azure auth-provider kubeconfig; format 'exec' will return exec format + kubeconfig, which requires kubelogin binary in the path. Known values are: "azure" and "exec". + Default value is None. + :type format: str or ~azure.mgmt.containerservice.v2022_07_01.models.Format + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CredentialResults or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_01.models.CredentialResults + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] + + request = build_list_cluster_user_credentials_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + server_fqdn=server_fqdn, + format=format, + api_version=api_version, + template_url=self.list_cluster_user_credentials.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("CredentialResults", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_cluster_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore + + @distributed_trace + def list_cluster_monitoring_user_credentials( + self, resource_group_name: str, resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any + ) -> _models.CredentialResults: + """Lists the cluster monitoring user credentials of a managed cluster. + + Lists the cluster monitoring user credentials of a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. + :type server_fqdn: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CredentialResults or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_01.models.CredentialResults + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CredentialResults] + + request = build_list_cluster_monitoring_user_credentials_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + server_fqdn=server_fqdn, + api_version=api_version, + template_url=self.list_cluster_monitoring_user_credentials.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("CredentialResults", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_cluster_monitoring_user_credentials.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore + + @distributed_trace + def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.ManagedCluster: + """Gets a managed cluster. + + Gets a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedCluster or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_01.models.ManagedCluster + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + + request = build_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ManagedCluster", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + + def _create_or_update_initial( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any + ) -> _models.ManagedCluster: + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedCluster") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_or_update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("ManagedCluster", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("ManagedCluster", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.ManagedCluster, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster to create or update. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_07_01.models.ManagedCluster + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_07_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_07_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.ManagedCluster, IO], **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster to create or update. Is either a model type or a IO + type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_07_01.models.ManagedCluster or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_07_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ManagedCluster", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + + def _update_tags_initial( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> _models.ManagedCluster: + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") + + request = build_update_tags_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_tags_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ManagedCluster", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_tags_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + + @overload + def begin_update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates tags on a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_07_01.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_07_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates tags on a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_07_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates tags on a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_07_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_07_01.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_tags_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ManagedCluster", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> None: + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + + request = build_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + + @distributed_trace + def begin_delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> LROPoller[None]: + """Deletes a managed cluster. + + Deletes a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + + def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], + **kwargs: Any + ) -> None: + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterServicePrincipalProfile") + + request = build_reset_service_principal_profile_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._reset_service_principal_profile_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _reset_service_principal_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + + @overload + def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.ManagedClusterServicePrincipalProfile, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reset the Service Principal Profile of a managed cluster. + + This action cannot be performed on a cluster that is not using a service principal. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The service principal profile to set on the managed cluster. Required. + :type parameters: + ~azure.mgmt.containerservice.v2022_07_01.models.ManagedClusterServicePrincipalProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reset the Service Principal Profile of a managed cluster. + + This action cannot be performed on a cluster that is not using a service principal. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The service principal profile to set on the managed cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Reset the Service Principal Profile of a managed cluster. + + This action cannot be performed on a cluster that is not using a service principal. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The service principal profile to set on the managed cluster. Is either a + model type or a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2022_07_01.models.ManagedClusterServicePrincipalProfile or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + if cont_token is None: + raw_result = self._reset_service_principal_profile_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_reset_service_principal_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + + def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterAADProfile, IO], + **kwargs: Any + ) -> None: + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedClusterAADProfile") + + request = build_reset_aad_profile_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._reset_aad_profile_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _reset_aad_profile_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + + @overload + def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.ManagedClusterAADProfile, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reset the AAD Profile of a managed cluster. + + Reset the AAD Profile of a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The AAD profile to set on the Managed Cluster. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_07_01.models.ManagedClusterAADProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reset the AAD Profile of a managed cluster. + + Reset the AAD Profile of a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The AAD profile to set on the Managed Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterAADProfile, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Reset the AAD Profile of a managed cluster. + + Reset the AAD Profile of a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The AAD profile to set on the Managed Cluster. Is either a model type or a + IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_07_01.models.ManagedClusterAADProfile or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + if cont_token is None: + raw_result = self._reset_aad_profile_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_reset_aad_profile.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + + def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> None: + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + + request = build_rotate_cluster_certificates_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._rotate_cluster_certificates_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _rotate_cluster_certificates_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore + + @distributed_trace + def begin_rotate_cluster_certificates( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Rotates the certificates of a managed cluster. + + See `Certificate rotation `_ for + more details about rotating managed cluster certificates. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + if cont_token is None: + raw_result = self._rotate_cluster_certificates_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_rotate_cluster_certificates.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore + + def _stop_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> None: + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + + request = build_stop_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._stop_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _stop_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore + + @distributed_trace + def begin_stop(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> LROPoller[None]: + """Stops a Managed Cluster. + + This can only be performed on Azure Virtual Machine Scale set backed clusters. Stopping a + cluster stops the control plane and agent nodes entirely, while maintaining all object and + cluster state. A cluster does not accrue charges while it is stopped. See `stopping a cluster + `_ for more details about stopping a + cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + if cont_token is None: + raw_result = self._stop_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_stop.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore + + def _start_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> None: + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + + request = build_start_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._start_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _start_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore + + @distributed_trace + def begin_start(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> LROPoller[None]: + """Starts a previously stopped Managed Cluster. + + See `starting a cluster `_ for more + details about starting a cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + if cont_token is None: + raw_result = self._start_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_start.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore + + def _run_command_initial( + self, + resource_group_name: str, + resource_name: str, + request_payload: Union[_models.RunCommandRequest, IO], + **kwargs: Any + ) -> Optional[_models.RunCommandResult]: + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RunCommandResult]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(request_payload, (IO, bytes)): + _content = request_payload + else: + _json = self._serialize.body(request_payload, "RunCommandRequest") + + request = build_run_command_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._run_command_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("RunCommandResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _run_command_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore + + @overload + def begin_run_command( + self, + resource_group_name: str, + resource_name: str, + request_payload: _models.RunCommandRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RunCommandResult]: + """Submits a command to run against the Managed Cluster. + + AKS will create a pod to run the command. This is primarily useful for private clusters. For + more information see `AKS Run Command + `_. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param request_payload: The run command request. Required. + :type request_payload: ~azure.mgmt.containerservice.v2022_07_01.models.RunCommandRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either RunCommandResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_07_01.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_run_command( + self, + resource_group_name: str, + resource_name: str, + request_payload: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RunCommandResult]: + """Submits a command to run against the Managed Cluster. + + AKS will create a pod to run the command. This is primarily useful for private clusters. For + more information see `AKS Run Command + `_. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param request_payload: The run command request. Required. + :type request_payload: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either RunCommandResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_07_01.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_run_command( + self, + resource_group_name: str, + resource_name: str, + request_payload: Union[_models.RunCommandRequest, IO], + **kwargs: Any + ) -> LROPoller[_models.RunCommandResult]: + """Submits a command to run against the Managed Cluster. + + AKS will create a pod to run the command. This is primarily useful for private clusters. For + more information see `AKS Run Command + `_. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param request_payload: The run command request. Is either a model type or a IO type. Required. + :type request_payload: ~azure.mgmt.containerservice.v2022_07_01.models.RunCommandRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either RunCommandResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_07_01.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.RunCommandResult] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + if cont_token is None: + raw_result = self._run_command_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + request_payload=request_payload, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("RunCommandResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_run_command.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore + + @distributed_trace + def get_command_result( + self, resource_group_name: str, resource_name: str, command_id: str, **kwargs: Any + ) -> Optional[_models.RunCommandResult]: + """Gets the results of a command which has been run on the Managed Cluster. + + Gets the results of a command which has been run on the Managed Cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param command_id: Id of the command. Required. + :type command_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RunCommandResult or None or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_01.models.RunCommandResult or None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.RunCommandResult]] + + request = build_get_command_result_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + command_id=command_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_command_result.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("RunCommandResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_command_result.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}"} # type: ignore + + @distributed_trace + def list_outbound_network_dependencies_endpoints( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> Iterable["_models.OutboundEnvironmentEndpoint"]: + """Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the + specified managed cluster. + + Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the + specified managed cluster. The operation returns properties of each egress endpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OutboundEnvironmentEndpoint or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_07_01.models.OutboundEnvironmentEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_outbound_network_dependencies_endpoints_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_outbound_network_dependencies_endpoints.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("OutboundEnvironmentEndpointCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_outbound_network_dependencies_endpoints.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/operations/_operations.py new file mode 100644 index 000000000000..69c684cbcd19 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/operations/_operations.py @@ -0,0 +1,143 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/providers/Microsoft.ContainerService/operations") + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_07_01.ContainerServiceClient`'s + :attr:`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") + + @distributed_trace + def list(self, **kwargs: Any) -> Iterable["_models.OperationValue"]: + """Gets a list of operations. + + Gets a list of operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationValue or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_07_01.models.OperationValue] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("OperationListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = {"url": "/providers/Microsoft.ContainerService/operations"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/operations/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/operations/_private_endpoint_connections_operations.py new file mode 100644 index 000000000000..b4dee5fc2fff --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/operations/_private_endpoint_connections_operations.py @@ -0,0 +1,620 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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, + resource_name: str, + private_endpoint_connection_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 = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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, + resource_name: str, + private_endpoint_connection_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 = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, + resource_name: str, + private_endpoint_connection_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 = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class PrivateEndpointConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_07_01.ContainerServiceClient`'s + :attr:`private_endpoint_connections` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> _models.PrivateEndpointConnectionListResult: + """Gets a list of private endpoint connections in the specified managed cluster. + + To learn more about private clusters, see: + https://docs.microsoft.com/azure/aks/private-clusters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnectionListResult or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_01.models.PrivateEndpointConnectionListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnectionListResult] + + request = build_list_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore + + @distributed_trace + def get( + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Gets the specified private endpoint connection. + + To learn more about private clusters, see: + https://docs.microsoft.com/azure/aks/private-clusters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_01.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] + + request = build_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + + @overload + def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: The updated private endpoint connection. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_07_01.models.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_01.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: The updated private endpoint connection. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_01.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: Union[_models.PrivateEndpointConnection, IO], + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: The updated private endpoint connection. Is either a model type or a IO + type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_07_01.models.PrivateEndpointConnection or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_01.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateEndpointConnection") + + request = build_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> None: + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + + request = build_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + + @distributed_trace + def begin_delete( + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes a private endpoint connection. + + Deletes a private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/operations/_private_link_resources_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/operations/_private_link_resources_operations.py new file mode 100644 index 000000000000..fbc1cf186fd3 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/operations/_private_link_resources_operations.py @@ -0,0 +1,152 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class PrivateLinkResourcesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_07_01.ContainerServiceClient`'s + :attr:`private_link_resources` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> _models.PrivateLinkResourcesListResult: + """Gets a list of private link resources in the specified managed cluster. + + To learn more about private clusters, see: + https://docs.microsoft.com/azure/aks/private-clusters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResourcesListResult or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_01.models.PrivateLinkResourcesListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResourcesListResult] + + request = build_list_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("PrivateLinkResourcesListResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/operations/_resolve_private_link_service_id_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/operations/_resolve_private_link_service_id_operations.py new file mode 100644 index 000000000000..fb5c7e86c392 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/operations/_resolve_private_link_service_id_operations.py @@ -0,0 +1,236 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_post_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class ResolvePrivateLinkServiceIdOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_07_01.ContainerServiceClient`'s + :attr:`resolve_private_link_service_id` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @overload + def post( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.PrivateLinkResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID for the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters required in order to resolve a private link service ID. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_07_01.models.PrivateLinkResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_01.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def post( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID for the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters required in order to resolve a private link service ID. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_01.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def post( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.PrivateLinkResource, IO], + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID for the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters required in order to resolve a private link service ID. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_07_01.models.PrivateLinkResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_01.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResource] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateLinkResource") + + request = build_post_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.post.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("PrivateLinkResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + post.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/operations/_snapshots_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/operations/_snapshots_operations.py new file mode 100644 index 000000000000..5a954c59168e --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/operations/_snapshots_operations.py @@ -0,0 +1,801 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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, resource_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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, resource_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_tags_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class SnapshotsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_07_01.ContainerServiceClient`'s + :attr:`snapshots` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list(self, **kwargs: Any) -> Iterable["_models.Snapshot"]: + """Gets a list of snapshots in the specified subscription. + + Gets a list of snapshots in the specified subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Snapshot or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_07_01.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SnapshotListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("SnapshotListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots"} # type: ignore + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Snapshot"]: + """Lists snapshots in the specified subscription and resource group. + + Lists snapshots in the specified subscription and resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Snapshot or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_07_01.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SnapshotListResult] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_resource_group.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("SnapshotListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots"} # type: ignore + + @distributed_trace + def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.Snapshot: + """Gets a snapshot. + + Gets a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_01.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] + + request = build_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("Snapshot", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore + + @overload + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.Snapshot, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Snapshot: + """Creates or updates a snapshot. + + Creates or updates a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The snapshot to create or update. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_07_01.models.Snapshot + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_01.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Snapshot: + """Creates or updates a snapshot. + + Creates or updates a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The snapshot to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_01.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.Snapshot, IO], **kwargs: Any + ) -> _models.Snapshot: + """Creates or updates a snapshot. + + Creates or updates a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The snapshot to create or update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.mgmt.containerservice.v2022_07_01.models.Snapshot or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_01.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "Snapshot") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.create_or_update.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("Snapshot", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("Snapshot", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore + + @overload + def update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Snapshot: + """Updates tags on a snapshot. + + Updates tags on a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update snapshot Tags operation. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_07_01.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_01.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Snapshot: + """Updates tags on a snapshot. + + Updates tags on a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update snapshot Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_01.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update_tags( + self, resource_group_name: str, resource_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + ) -> _models.Snapshot: + """Updates tags on a snapshot. + + Updates tags on a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update snapshot Tags operation. Is either a model + type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_07_01.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_01.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Snapshot] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsObject") + + request = build_update_tags_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update_tags.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("Snapshot", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_tags.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> None: + """Deletes a snapshot. + + Deletes a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + + request = build_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.delete.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/py.typed b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_01/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/__init__.py new file mode 100644 index 000000000000..37a5f9e02e6f --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/__init__.py @@ -0,0 +1,20 @@ +# 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 ._container_service_client import ContainerServiceClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk +__all__ = ['ContainerServiceClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/_configuration.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/_configuration.py new file mode 100644 index 000000000000..fb9efc2e7956 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/_configuration.py @@ -0,0 +1,72 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + +VERSION = "unknown" + +class ContainerServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes + """Configuration for ContainerServiceClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :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. + :type subscription_id: str + :keyword api_version: Api Version. Default value is "2022-07-02-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str + """ + + def __init__( + self, + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(ContainerServiceClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2022-07-02-preview") # type: str + + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = api_version + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-containerservice/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs # type: Any + ): + # type: (...) -> None + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/_container_service_client.py new file mode 100644 index 000000000000..da490d69fdf5 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/_container_service_client.py @@ -0,0 +1,169 @@ +# 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 copy import deepcopy +from typing import Any, TYPE_CHECKING + +from azure.core.rest import HttpRequest, HttpResponse +from azure.mgmt.core import ARMPipelineClient + +from . import models +from .._serialization import Deserializer, Serializer +from ._configuration import ContainerServiceClientConfiguration +from .operations import AgentPoolsOperations, FleetMembersOperations, FleetsOperations, MaintenanceConfigurationsOperations, ManagedClusterSnapshotsOperations, ManagedClustersOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, ResolvePrivateLinkServiceIdOperations, SnapshotsOperations, TrustedAccessRoleBindingsOperations, TrustedAccessRolesOperations + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + +class ContainerServiceClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes + """The Container Service Client. + + :ivar operations: Operations operations + :vartype operations: azure.mgmt.containerservice.v2022_07_02_preview.operations.Operations + :ivar managed_clusters: ManagedClustersOperations operations + :vartype managed_clusters: + azure.mgmt.containerservice.v2022_07_02_preview.operations.ManagedClustersOperations + :ivar maintenance_configurations: MaintenanceConfigurationsOperations operations + :vartype maintenance_configurations: + azure.mgmt.containerservice.v2022_07_02_preview.operations.MaintenanceConfigurationsOperations + :ivar agent_pools: AgentPoolsOperations operations + :vartype agent_pools: + azure.mgmt.containerservice.v2022_07_02_preview.operations.AgentPoolsOperations + :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations + :vartype private_endpoint_connections: + azure.mgmt.containerservice.v2022_07_02_preview.operations.PrivateEndpointConnectionsOperations + :ivar private_link_resources: PrivateLinkResourcesOperations operations + :vartype private_link_resources: + azure.mgmt.containerservice.v2022_07_02_preview.operations.PrivateLinkResourcesOperations + :ivar resolve_private_link_service_id: ResolvePrivateLinkServiceIdOperations operations + :vartype resolve_private_link_service_id: + azure.mgmt.containerservice.v2022_07_02_preview.operations.ResolvePrivateLinkServiceIdOperations + :ivar snapshots: SnapshotsOperations operations + :vartype snapshots: + azure.mgmt.containerservice.v2022_07_02_preview.operations.SnapshotsOperations + :ivar managed_cluster_snapshots: ManagedClusterSnapshotsOperations operations + :vartype managed_cluster_snapshots: + azure.mgmt.containerservice.v2022_07_02_preview.operations.ManagedClusterSnapshotsOperations + :ivar trusted_access_roles: TrustedAccessRolesOperations operations + :vartype trusted_access_roles: + azure.mgmt.containerservice.v2022_07_02_preview.operations.TrustedAccessRolesOperations + :ivar trusted_access_role_bindings: TrustedAccessRoleBindingsOperations operations + :vartype trusted_access_role_bindings: + azure.mgmt.containerservice.v2022_07_02_preview.operations.TrustedAccessRoleBindingsOperations + :ivar fleets: FleetsOperations operations + :vartype fleets: azure.mgmt.containerservice.v2022_07_02_preview.operations.FleetsOperations + :ivar fleet_members: FleetMembersOperations operations + :vartype fleet_members: + azure.mgmt.containerservice.v2022_07_02_preview.operations.FleetMembersOperations + :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. + :type subscription_id: str + :param base_url: Service URL. Default value is "https://management.azure.com". + :type base_url: str + :keyword api_version: Api Version. Default value is "2022-07-02-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. + """ + + def __init__( + self, + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = ContainerServiceClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_clusters = ManagedClustersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.maintenance_configurations = MaintenanceConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.agent_pools = AgentPoolsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.snapshots = SnapshotsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_cluster_snapshots = ManagedClusterSnapshotsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.trusted_access_roles = TrustedAccessRolesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.trusted_access_role_bindings = TrustedAccessRoleBindingsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.fleets = FleetsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.fleet_members = FleetMembersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> HttpResponse: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.HttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> ContainerServiceClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/_metadata.json b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/_metadata.json new file mode 100644 index 000000000000..15499222aba9 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/_metadata.json @@ -0,0 +1,114 @@ +{ + "chosen_version": "2022-07-02-preview", + "total_api_version_list": ["2022-07-02-preview"], + "client": { + "name": "ContainerServiceClient", + "filename": "_container_service_client", + "description": "The Container Service Client.", + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, + "azure_arm": true, + "has_lro_operations": true, + "client_side_validation": false, + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "global_parameters": { + "sync": { + "credential": { + "signature": "credential: \"TokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id: str,", + "description": "The ID of the target subscription. Required.", + "docstring_type": "str", + "required": true + } + }, + "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id: str,", + "description": "The ID of the target subscription. Required.", + "docstring_type": "str", + "required": true + } + }, + "constant": { + }, + "call": "credential, subscription_id", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: str = \"https://management.azure.com\",", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: str = \"https://management.azure.com\",", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } + }, + "config": { + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"], + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "operation_groups": { + "operations": "Operations", + "managed_clusters": "ManagedClustersOperations", + "maintenance_configurations": "MaintenanceConfigurationsOperations", + "agent_pools": "AgentPoolsOperations", + "private_endpoint_connections": "PrivateEndpointConnectionsOperations", + "private_link_resources": "PrivateLinkResourcesOperations", + "resolve_private_link_service_id": "ResolvePrivateLinkServiceIdOperations", + "snapshots": "SnapshotsOperations", + "managed_cluster_snapshots": "ManagedClusterSnapshotsOperations", + "trusted_access_roles": "TrustedAccessRolesOperations", + "trusted_access_role_bindings": "TrustedAccessRoleBindingsOperations", + "fleets": "FleetsOperations", + "fleet_members": "FleetMembersOperations" + } +} \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/_vendor.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# 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.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/aio/__init__.py new file mode 100644 index 000000000000..37a5f9e02e6f --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/aio/__init__.py @@ -0,0 +1,20 @@ +# 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 ._container_service_client import ContainerServiceClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk +__all__ = ['ContainerServiceClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/aio/_configuration.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/aio/_configuration.py new file mode 100644 index 000000000000..9610fd9c9025 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/aio/_configuration.py @@ -0,0 +1,71 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +VERSION = "unknown" + +class ContainerServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes + """Configuration for ContainerServiceClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :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. + :type subscription_id: str + :keyword api_version: Api Version. Default value is "2022-07-02-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(ContainerServiceClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2022-07-02-preview") # type: str + + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = api_version + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-containerservice/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/aio/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/aio/_container_service_client.py new file mode 100644 index 000000000000..10612159d9e3 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/aio/_container_service_client.py @@ -0,0 +1,167 @@ +# 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 copy import deepcopy +from typing import Any, Awaitable, TYPE_CHECKING + +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient + +from .. import models +from ..._serialization import Deserializer, Serializer +from ._configuration import ContainerServiceClientConfiguration +from .operations import AgentPoolsOperations, FleetMembersOperations, FleetsOperations, MaintenanceConfigurationsOperations, ManagedClusterSnapshotsOperations, ManagedClustersOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, ResolvePrivateLinkServiceIdOperations, SnapshotsOperations, TrustedAccessRoleBindingsOperations, TrustedAccessRolesOperations + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +class ContainerServiceClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes + """The Container Service Client. + + :ivar operations: Operations operations + :vartype operations: azure.mgmt.containerservice.v2022_07_02_preview.aio.operations.Operations + :ivar managed_clusters: ManagedClustersOperations operations + :vartype managed_clusters: + azure.mgmt.containerservice.v2022_07_02_preview.aio.operations.ManagedClustersOperations + :ivar maintenance_configurations: MaintenanceConfigurationsOperations operations + :vartype maintenance_configurations: + azure.mgmt.containerservice.v2022_07_02_preview.aio.operations.MaintenanceConfigurationsOperations + :ivar agent_pools: AgentPoolsOperations operations + :vartype agent_pools: + azure.mgmt.containerservice.v2022_07_02_preview.aio.operations.AgentPoolsOperations + :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations + :vartype private_endpoint_connections: + azure.mgmt.containerservice.v2022_07_02_preview.aio.operations.PrivateEndpointConnectionsOperations + :ivar private_link_resources: PrivateLinkResourcesOperations operations + :vartype private_link_resources: + azure.mgmt.containerservice.v2022_07_02_preview.aio.operations.PrivateLinkResourcesOperations + :ivar resolve_private_link_service_id: ResolvePrivateLinkServiceIdOperations operations + :vartype resolve_private_link_service_id: + azure.mgmt.containerservice.v2022_07_02_preview.aio.operations.ResolvePrivateLinkServiceIdOperations + :ivar snapshots: SnapshotsOperations operations + :vartype snapshots: + azure.mgmt.containerservice.v2022_07_02_preview.aio.operations.SnapshotsOperations + :ivar managed_cluster_snapshots: ManagedClusterSnapshotsOperations operations + :vartype managed_cluster_snapshots: + azure.mgmt.containerservice.v2022_07_02_preview.aio.operations.ManagedClusterSnapshotsOperations + :ivar trusted_access_roles: TrustedAccessRolesOperations operations + :vartype trusted_access_roles: + azure.mgmt.containerservice.v2022_07_02_preview.aio.operations.TrustedAccessRolesOperations + :ivar trusted_access_role_bindings: TrustedAccessRoleBindingsOperations operations + :vartype trusted_access_role_bindings: + azure.mgmt.containerservice.v2022_07_02_preview.aio.operations.TrustedAccessRoleBindingsOperations + :ivar fleets: FleetsOperations operations + :vartype fleets: + azure.mgmt.containerservice.v2022_07_02_preview.aio.operations.FleetsOperations + :ivar fleet_members: FleetMembersOperations operations + :vartype fleet_members: + azure.mgmt.containerservice.v2022_07_02_preview.aio.operations.FleetMembersOperations + :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. + :type subscription_id: str + :param base_url: Service URL. Default value is "https://management.azure.com". + :type base_url: str + :keyword api_version: Api Version. Default value is "2022-07-02-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. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = ContainerServiceClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_clusters = ManagedClustersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.maintenance_configurations = MaintenanceConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.agent_pools = AgentPoolsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.snapshots = SnapshotsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_cluster_snapshots = ManagedClusterSnapshotsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.trusted_access_roles = TrustedAccessRolesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.trusted_access_role_bindings = TrustedAccessRoleBindingsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.fleets = FleetsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.fleet_members = FleetMembersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.AsyncHttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "ContainerServiceClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/aio/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/aio/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/aio/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/aio/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/aio/operations/__init__.py new file mode 100644 index 000000000000..03d015afec25 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/aio/operations/__init__.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 ._operations import Operations +from ._managed_clusters_operations import ManagedClustersOperations +from ._maintenance_configurations_operations import MaintenanceConfigurationsOperations +from ._agent_pools_operations import AgentPoolsOperations +from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations +from ._private_link_resources_operations import PrivateLinkResourcesOperations +from ._resolve_private_link_service_id_operations import ResolvePrivateLinkServiceIdOperations +from ._snapshots_operations import SnapshotsOperations +from ._managed_cluster_snapshots_operations import ManagedClusterSnapshotsOperations +from ._trusted_access_roles_operations import TrustedAccessRolesOperations +from ._trusted_access_role_bindings_operations import TrustedAccessRoleBindingsOperations +from ._fleets_operations import FleetsOperations +from ._fleet_members_operations import FleetMembersOperations + +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk +__all__ = [ + 'Operations', + 'ManagedClustersOperations', + 'MaintenanceConfigurationsOperations', + 'AgentPoolsOperations', + 'PrivateEndpointConnectionsOperations', + 'PrivateLinkResourcesOperations', + 'ResolvePrivateLinkServiceIdOperations', + 'SnapshotsOperations', + 'ManagedClusterSnapshotsOperations', + 'TrustedAccessRolesOperations', + 'TrustedAccessRoleBindingsOperations', + 'FleetsOperations', + 'FleetMembersOperations', +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/aio/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/aio/operations/_agent_pools_operations.py new file mode 100644 index 000000000000..78b7d42e3a67 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/aio/operations/_agent_pools_operations.py @@ -0,0 +1,952 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._agent_pools_operations import build_abort_latest_operation_request, build_create_or_update_request, build_delete_request, build_get_available_agent_pool_versions_request, build_get_request, build_get_upgrade_profile_request, build_list_request, build_upgrade_node_image_version_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class AgentPoolsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_07_02_preview.aio.ContainerServiceClient`'s + :attr:`agent_pools` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + + @distributed_trace_async + async def abort_latest_operation( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + **kwargs: Any + ) -> None: + """Aborts last operation running on agent pool. + + Aborting last running operation on agent pool. We return a 204 no content code here to indicate + that the operation has been accepted and an abort will be attempted but is not guaranteed to + complete successfully. Please look up the provisioning state of the agent pool to keep track of + whether it changes to Canceled. A canceled provisioning state indicates that the abort was + successful. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_abort_latest_operation_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.abort_latest_operation.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + abort_latest_operation.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclusters/{resourceName}/agentPools/{agentPoolName}/abort"} # type: ignore + + + @distributed_trace + def list( + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.AgentPool"]: + """Gets a list of agent pools in the specified managed cluster. + + Gets a list of agent pools in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AgentPool or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_07_02_preview.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("AgentPoolListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + **kwargs: Any + ) -> _models.AgentPool: + """Gets the specified managed cluster agent pool. + + Gets the specified managed cluster agent pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AgentPool or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_02_preview.models.AgentPool + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + + + request = build_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AgentPool', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + + + async def _create_or_update_initial( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: Union[_models.AgentPool, IO], + **kwargs: Any + ) -> _models.AgentPool: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, 'AgentPool') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_or_update_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('AgentPool', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('AgentPool', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: _models.AgentPool, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AgentPool]: + """Creates or updates an agent pool in the specified managed cluster. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: The agent pool to create or update. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_07_02_preview.models.AgentPool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AgentPool or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_07_02_preview.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AgentPool]: + """Creates or updates an agent pool in the specified managed cluster. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: The agent pool to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AgentPool or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_07_02_preview.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: Union[_models.AgentPool, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.AgentPool]: + """Creates or updates an agent pool in the specified managed cluster. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: The agent pool to create or update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.mgmt.containerservice.v2022_07_02_preview.models.AgentPool or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AgentPool or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_07_02_preview.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + agent_pool_name=agent_pool_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('AgentPool', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + ignore_pod_disruption_budget: Optional[bool] = None, + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, + ignore_pod_disruption_budget=ignore_pod_disruption_budget, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + ignore_pod_disruption_budget: Optional[bool] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes an agent pool in the specified managed cluster. + + Deletes an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param ignore_pod_disruption_budget: ignore-pod-disruption-budget=true to delete those pods on + a node without considering Pod Disruption Budget. Default value is None. + :type ignore_pod_disruption_budget: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + agent_pool_name=agent_pool_name, + ignore_pod_disruption_budget=ignore_pod_disruption_budget, + api_version=api_version, + cls=lambda x,y,z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + + @distributed_trace_async + async def get_upgrade_profile( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + **kwargs: Any + ) -> _models.AgentPoolUpgradeProfile: + """Gets the upgrade profile for an agent pool. + + Gets the upgrade profile for an agent pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AgentPoolUpgradeProfile or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_02_preview.models.AgentPoolUpgradeProfile + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] + + + request = build_get_upgrade_profile_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_upgrade_profile.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AgentPoolUpgradeProfile', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore + + + @distributed_trace_async + async def get_available_agent_pool_versions( + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> _models.AgentPoolAvailableVersions: + """Gets a list of supported Kubernetes versions for the specified agent pool. + + See `supported Kubernetes versions + `_ for more details about + the version lifecycle. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AgentPoolAvailableVersions or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_02_preview.models.AgentPoolAvailableVersions + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] + + + request = build_get_available_agent_pool_versions_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_available_agent_pool_versions.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AgentPoolAvailableVersions', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_available_agent_pool_versions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore + + + async def _upgrade_node_image_version_initial( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + **kwargs: Any + ) -> Optional[_models.AgentPool]: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.AgentPool]] + + + request = build_upgrade_node_image_version_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._upgrade_node_image_version_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 202: + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + + deserialized = self._deserialize('AgentPool', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _upgrade_node_image_version_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore + + + @distributed_trace_async + async def begin_upgrade_node_image_version( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Upgrades the node image version of an agent pool to the latest. + + Upgrading the node image version of an agent pool applies the newest OS and runtime updates to + the nodes. AKS provides one new image per week with the latest updates. For more details on + node image versions, see: https://docs.microsoft.com/azure/aks/node-image-upgrade. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AgentPool or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_07_02_preview.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._upgrade_node_image_version_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + agent_pool_name=agent_pool_name, + api_version=api_version, + cls=lambda x,y,z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + + deserialized = self._deserialize('AgentPool', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, response_headers) + return deserialized + + + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_upgrade_node_image_version.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/aio/operations/_fleet_members_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/aio/operations/_fleet_members_operations.py new file mode 100644 index 000000000000..797dc3e3b77e --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/aio/operations/_fleet_members_operations.py @@ -0,0 +1,637 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._fleet_members_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_fleet_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class FleetMembersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_07_02_preview.aio.ContainerServiceClient`'s + :attr:`fleet_members` 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 _create_or_update_initial( + self, + resource_group_name: str, + fleet_name: str, + fleet_member_name: str, + parameters: Union[_models.FleetMember, IO], + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + **kwargs: Any + ) -> _models.FleetMember: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.FleetMember] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, 'FleetMember') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + fleet_name=fleet_name, + fleet_member_name=fleet_member_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, + template_url=self._create_or_update_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('FleetMember', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('FleetMember', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}"} # type: ignore + + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + fleet_name: str, + fleet_member_name: str, + parameters: _models.FleetMember, + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.FleetMember]: + """Creates or updates a fleet member. + + A member contains a reference to an existing Kubernetes cluster. Creating a member makes the + referenced cluster join the 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 + :param fleet_member_name: The name of the Fleet member resource. Required. + :type fleet_member_name: str + :param parameters: The Fleet member to create or update. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_07_02_preview.models.FleetMember + :param if_match: Omit this value to always overwrite the current resource. Specify the + last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is + None. + :type if_match: str + :param if_none_match: Set to '*' to allow a new resource to be created and prevent updating an + existing resource. Other values will result in a 412 Pre-condition Failed response. 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either FleetMember or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_07_02_preview.models.FleetMember] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + fleet_name: str, + fleet_member_name: str, + parameters: IO, + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.FleetMember]: + """Creates or updates a fleet member. + + A member contains a reference to an existing Kubernetes cluster. Creating a member makes the + referenced cluster join the 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 + :param fleet_member_name: The name of the Fleet member resource. Required. + :type fleet_member_name: str + :param parameters: The Fleet member to create or update. Required. + :type parameters: IO + :param if_match: Omit this value to always overwrite the current resource. Specify the + last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is + None. + :type if_match: str + :param if_none_match: Set to '*' to allow a new resource to be created and prevent updating an + existing resource. Other values will result in a 412 Pre-condition Failed response. 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either FleetMember or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_07_02_preview.models.FleetMember] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + fleet_name: str, + fleet_member_name: str, + parameters: Union[_models.FleetMember, IO], + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.FleetMember]: + """Creates or updates a fleet member. + + A member contains a reference to an existing Kubernetes cluster. Creating a member makes the + referenced cluster join the 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 + :param fleet_member_name: The name of the Fleet member resource. Required. + :type fleet_member_name: str + :param parameters: The Fleet member to create or update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.mgmt.containerservice.v2022_07_02_preview.models.FleetMember or IO + :param if_match: Omit this value to always overwrite the current resource. Specify the + last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is + None. + :type if_match: str + :param if_none_match: Set to '*' to allow a new resource to be created and prevent updating an + existing resource. Other values will result in a 412 Pre-condition Failed response. Default + value is None. + :type if_none_match: str + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either FleetMember or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_07_02_preview.models.FleetMember] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.FleetMember] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( # type: ignore + resource_group_name=resource_group_name, + fleet_name=fleet_name, + fleet_member_name=fleet_member_name, + parameters=parameters, + 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 + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('FleetMember', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}"} # type: ignore + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + fleet_name: str, + fleet_member_name: str, + **kwargs: Any + ) -> _models.FleetMember: + """Gets a Fleet member. + + Gets a Fleet member. + + :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 fleet_member_name: The name of the Fleet member resource. Required. + :type fleet_member_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FleetMember or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_02_preview.models.FleetMember + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.FleetMember] + + + request = build_get_request( + resource_group_name=resource_group_name, + fleet_name=fleet_name, + fleet_member_name=fleet_member_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **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('FleetMember', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}"} # type: ignore + + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + fleet_name: str, + fleet_member_name: str, + if_match: Optional[str] = None, + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_delete_request( + resource_group_name=resource_group_name, + fleet_name=fleet_name, + fleet_member_name=fleet_member_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}"} # type: ignore + + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + fleet_name: str, + fleet_member_name: str, + if_match: Optional[str] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a fleet member. + + Deleting a Fleet member results in the member cluster leaving fleet. The Member azure resource + is deleted upon success. The underlying cluster is not deleted. + + :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 fleet_member_name: The name of the Fleet member resource. Required. + :type fleet_member_name: str + :param if_match: Omit this value to always overwrite the current resource. Specify the + last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is + None. + :type if_match: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + fleet_name=fleet_name, + fleet_member_name=fleet_member_name, + if_match=if_match, + api_version=api_version, + cls=lambda x,y,z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + lro_options={'final-state-via': 'location'}, + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}"} # type: ignore + + @distributed_trace + def list_by_fleet( + self, + resource_group_name: str, + fleet_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.FleetMember"]: + """Lists the members of a fleet. + + Lists the members of a 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either FleetMember or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_07_02_preview.models.FleetMember] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.FleetMembersListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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, + template_url=self.list_by_fleet.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("FleetMembersListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_fleet.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/aio/operations/_fleets_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/aio/operations/_fleets_operations.py new file mode 100644 index 000000000000..6f430b3f838a --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/aio/operations/_fleets_operations.py @@ -0,0 +1,917 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._fleets_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_resource_group_request, build_list_credentials_request, build_list_request, build_update_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class FleetsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_07_02_preview.aio.ContainerServiceClient`'s + :attr:`fleets` 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 _create_or_update_initial( + self, + resource_group_name: str, + fleet_name: str, + parameters: Union[_models.Fleet, IO], + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + **kwargs: Any + ) -> _models.Fleet: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Fleet] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, 'Fleet') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + fleet_name=fleet_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, + template_url=self._create_or_update_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Fleet', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Fleet', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}"} # type: ignore + + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + fleet_name: str, + parameters: _models.Fleet, + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Fleet]: + """Creates or updates a Fleet. + + Creates or updates a 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 + :param parameters: The Fleet to create or update. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_07_02_preview.models.Fleet + :param if_match: Omit this value to always overwrite the current resource. Specify the + last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is + None. + :type if_match: str + :param if_none_match: Set to '*' to allow a new resource to be created and prevent updating an + existing resource. Other values will result in a 412 Pre-condition Failed response. 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Fleet or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_07_02_preview.models.Fleet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + fleet_name: str, + parameters: IO, + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Fleet]: + """Creates or updates a Fleet. + + Creates or updates a 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 + :param parameters: The Fleet to create or update. Required. + :type parameters: IO + :param if_match: Omit this value to always overwrite the current resource. Specify the + last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is + None. + :type if_match: str + :param if_none_match: Set to '*' to allow a new resource to be created and prevent updating an + existing resource. Other values will result in a 412 Pre-condition Failed response. 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Fleet or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_07_02_preview.models.Fleet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + fleet_name: str, + parameters: Union[_models.Fleet, IO], + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.Fleet]: + """Creates or updates a Fleet. + + Creates or updates a 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 + :param parameters: The Fleet to create or update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.mgmt.containerservice.v2022_07_02_preview.models.Fleet or IO + :param if_match: Omit this value to always overwrite the current resource. Specify the + last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is + None. + :type if_match: str + :param if_none_match: Set to '*' to allow a new resource to be created and prevent updating an + existing resource. Other values will result in a 412 Pre-condition Failed response. Default + value is None. + :type if_none_match: str + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Fleet or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_07_02_preview.models.Fleet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Fleet] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( # type: ignore + resource_group_name=resource_group_name, + fleet_name=fleet_name, + parameters=parameters, + 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 + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Fleet', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}"} # type: ignore + + @overload + async def update( + self, + resource_group_name: str, + fleet_name: str, + if_match: Optional[str] = None, + parameters: Optional[_models.FleetPatch] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Fleet: + """Patches a fleet resource. + + Patches a fleet resource. + + :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 if_match: Omit this value to always overwrite the current resource. Specify the + last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is + None. + :type if_match: str + :param parameters: The properties of a Fleet to update. Default value is None. + :type parameters: ~azure.mgmt.containerservice.v2022_07_02_preview.models.FleetPatch + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Fleet or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_02_preview.models.Fleet + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + fleet_name: str, + if_match: Optional[str] = None, + parameters: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Fleet: + """Patches a fleet resource. + + Patches a fleet resource. + + :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 if_match: Omit this value to always overwrite the current resource. Specify the + last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is + None. + :type if_match: str + :param parameters: The properties of a Fleet to update. Default value is None. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Fleet or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_02_preview.models.Fleet + :raises ~azure.core.exceptions.HttpResponseError: + """ + + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + fleet_name: str, + if_match: Optional[str] = None, + parameters: Optional[Union[_models.FleetPatch, IO]] = None, + **kwargs: Any + ) -> _models.Fleet: + """Patches a fleet resource. + + Patches a fleet resource. + + :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 if_match: Omit this value to always overwrite the current resource. Specify the + last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is + None. + :type if_match: str + :param parameters: The properties of a Fleet to update. Is either a model type or a IO type. + Default value is None. + :type parameters: ~azure.mgmt.containerservice.v2022_07_02_preview.models.FleetPatch or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Fleet or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_02_preview.models.Fleet + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Fleet] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + if parameters is not None: + _json = self._serialize.body(parameters, 'FleetPatch') + else: + _json = None + + request = build_update_request( + resource_group_name=resource_group_name, + fleet_name=fleet_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **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('Fleet', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}"} # type: ignore + + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + fleet_name: str, + **kwargs: Any + ) -> _models.Fleet: + """Gets a Fleet. + + Gets a 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Fleet or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_02_preview.models.Fleet + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Fleet] + + + request = build_get_request( + resource_group_name=resource_group_name, + fleet_name=fleet_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **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('Fleet', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}"} # type: ignore + + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + fleet_name: str, + if_match: Optional[str] = None, + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_delete_request( + resource_group_name=resource_group_name, + fleet_name=fleet_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}"} # type: ignore + + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + fleet_name: str, + if_match: Optional[str] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a Fleet. + + Deletes a 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 + :param if_match: Omit this value to always overwrite the current resource. Specify the + last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is + None. + :type if_match: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + fleet_name=fleet_name, + if_match=if_match, + api_version=api_version, + cls=lambda x,y,z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + lro_options={'final-state-via': 'location'}, + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}"} # type: ignore + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.Fleet"]: + """Lists fleets in the specified subscription and resource group. + + Lists fleets in the specified subscription and resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Fleet or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_07_02_preview.models.Fleet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.FleetListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_resource_group.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("FleetListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets"} # type: ignore + + @distributed_trace + def list( + self, + **kwargs: Any + ) -> AsyncIterable["_models.Fleet"]: + """Lists fleets in the specified subscription. + + Lists fleets in the specified subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Fleet or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_07_02_preview.models.Fleet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.FleetListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("FleetListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/fleets"} # type: ignore + + @distributed_trace_async + async def list_credentials( + self, + resource_group_name: str, + fleet_name: str, + **kwargs: Any + ) -> _models.FleetCredentialResults: + """Lists the user credentials of a Fleet. + + Lists the user credentials of a 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FleetCredentialResults or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_02_preview.models.FleetCredentialResults + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.FleetCredentialResults] + + + request = build_list_credentials_request( + resource_group_name=resource_group_name, + fleet_name=fleet_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_credentials.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **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('FleetCredentialResults', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/listCredentials"} # type: ignore + diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/aio/operations/_maintenance_configurations_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/aio/operations/_maintenance_configurations_operations.py new file mode 100644 index 000000000000..8f82066f2cfb --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/aio/operations/_maintenance_configurations_operations.py @@ -0,0 +1,430 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._maintenance_configurations_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_managed_cluster_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class MaintenanceConfigurationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_07_02_preview.aio.ContainerServiceClient`'s + :attr:`maintenance_configurations` 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_managed_cluster( + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.MaintenanceConfiguration"]: + """Gets a list of maintenance configurations in the specified managed cluster. + + Gets a list of maintenance configurations in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either MaintenanceConfiguration or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_07_02_preview.models.MaintenanceConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfigurationListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_managed_cluster_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_managed_cluster.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("MaintenanceConfigurationListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_managed_cluster.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations"} # type: ignore + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Gets the specified maintenance configuration of a managed cluster. + + Gets the specified maintenance configuration of a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_02_preview.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] + + + request = build_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + config_name=config_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore + + + @overload + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: _models.MaintenanceConfiguration, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configuration in the specified managed cluster. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: The maintenance configuration to create or update. Required. + :type parameters: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.MaintenanceConfiguration + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_02_preview.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configuration in the specified managed cluster. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: The maintenance configuration to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_02_preview.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: Union[_models.MaintenanceConfiguration, IO], + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configuration in the specified managed cluster. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: The maintenance configuration to create or update. Is either a model type or + a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.MaintenanceConfiguration or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_02_preview.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, 'MaintenanceConfiguration') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + config_name=config_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore + + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + resource_name: str, + config_name: str, + **kwargs: Any + ) -> None: + """Deletes a maintenance configuration. + + Deletes a maintenance configuration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + config_name=config_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.delete.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore + diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/aio/operations/_managed_cluster_snapshots_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/aio/operations/_managed_cluster_snapshots_operations.py new file mode 100644 index 000000000000..dc8a2ef0c3a9 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/aio/operations/_managed_cluster_snapshots_operations.py @@ -0,0 +1,639 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._managed_cluster_snapshots_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_resource_group_request, build_list_request, build_update_tags_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ManagedClusterSnapshotsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_07_02_preview.aio.ContainerServiceClient`'s + :attr:`managed_cluster_snapshots` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + + @distributed_trace + def list( + self, + **kwargs: Any + ) -> AsyncIterable["_models.ManagedClusterSnapshot"]: + """Gets a list of managed cluster snapshots in the specified subscription. + + Gets a list of managed cluster snapshots in the specified subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ManagedClusterSnapshot or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterSnapshot] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshotListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ManagedClusterSnapshotListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedclustersnapshots"} # type: ignore + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.ManagedClusterSnapshot"]: + """Lists managed cluster snapshots in the specified subscription and resource group. + + Lists managed cluster snapshots in the specified subscription and resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ManagedClusterSnapshot or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterSnapshot] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshotListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_resource_group.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ManagedClusterSnapshotListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots"} # type: ignore + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> _models.ManagedClusterSnapshot: + """Gets a managed cluster snapshot. + + Gets a managed cluster snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedClusterSnapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterSnapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshot] + + + request = build_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ManagedClusterSnapshot', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"} # type: ignore + + + @overload + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.ManagedClusterSnapshot, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ManagedClusterSnapshot: + """Creates or updates a managed cluster snapshot. + + Creates or updates a managed cluster snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster snapshot to create or update. Required. + :type parameters: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterSnapshot + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedClusterSnapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterSnapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ManagedClusterSnapshot: + """Creates or updates a managed cluster snapshot. + + Creates or updates a managed cluster snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster snapshot to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedClusterSnapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterSnapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterSnapshot, IO], + **kwargs: Any + ) -> _models.ManagedClusterSnapshot: + """Creates or updates a managed cluster snapshot. + + Creates or updates a managed cluster snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster snapshot to create or update. Is either a model type or + a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterSnapshot or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedClusterSnapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterSnapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshot] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, 'ManagedClusterSnapshot') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ManagedClusterSnapshot', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ManagedClusterSnapshot', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"} # type: ignore + + + @overload + async def update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ManagedClusterSnapshot: + """Updates tags on a managed cluster snapshot. + + Updates tags on a managed cluster snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update managed cluster snapshot Tags operation. + Required. + :type parameters: ~azure.mgmt.containerservice.v2022_07_02_preview.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedClusterSnapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterSnapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ManagedClusterSnapshot: + """Updates tags on a managed cluster snapshot. + + Updates tags on a managed cluster snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update managed cluster snapshot Tags operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedClusterSnapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterSnapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + + @distributed_trace_async + async def update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> _models.ManagedClusterSnapshot: + """Updates tags on a managed cluster snapshot. + + Updates tags on a managed cluster snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update managed cluster snapshot Tags operation. + Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_07_02_preview.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedClusterSnapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterSnapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshot] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, 'TagsObject') + + request = build_update_tags_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update_tags.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ManagedClusterSnapshot', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"} # type: ignore + + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> None: + """Deletes a managed cluster snapshot. + + Deletes a managed cluster snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.delete.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"} # type: ignore + diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/aio/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/aio/operations/_managed_clusters_operations.py new file mode 100644 index 000000000000..3d4f4b1cda24 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/aio/operations/_managed_clusters_operations.py @@ -0,0 +1,2726 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._managed_clusters_operations import build_abort_latest_operation_request, build_create_or_update_request, build_delete_request, build_get_access_profile_request, build_get_command_result_request, build_get_os_options_request, build_get_request, build_get_upgrade_profile_request, build_list_by_resource_group_request, build_list_cluster_admin_credentials_request, build_list_cluster_monitoring_user_credentials_request, build_list_cluster_user_credentials_request, build_list_outbound_network_dependencies_endpoints_request, build_list_request, build_reset_aad_profile_request, build_reset_service_principal_profile_request, build_rotate_cluster_certificates_request, build_rotate_service_account_signing_keys_request, build_run_command_request, build_start_request, build_stop_request, build_update_tags_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ManagedClustersOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_07_02_preview.aio.ContainerServiceClient`'s + :attr:`managed_clusters` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + + @distributed_trace_async + async def get_os_options( + self, + location: str, + resource_type: Optional[str] = None, + **kwargs: Any + ) -> _models.OSOptionProfile: + """Gets supported OS options in the specified subscription. + + Gets supported OS options in the specified subscription. + + :param location: The name of Azure region. Required. + :type location: str + :param resource_type: The resource type for which the OS options needs to be returned. Default + value is None. + :type resource_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: OSOptionProfile or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_02_preview.models.OSOptionProfile + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OSOptionProfile] + + + request = build_get_os_options_request( + location=location, + subscription_id=self._config.subscription_id, + resource_type=resource_type, + api_version=api_version, + template_url=self.get_os_options.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('OSOptionProfile', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_os_options.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default"} # type: ignore + + + @distributed_trace + def list( + self, + **kwargs: Any + ) -> AsyncIterable["_models.ManagedCluster"]: + """Gets a list of managed clusters in the specified subscription. + + Gets a list of managed clusters in the specified subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ManagedCluster or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ManagedClusterListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.ManagedCluster"]: + """Lists managed clusters in the specified subscription and resource group. + + Lists managed clusters in the specified subscription and resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ManagedCluster or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_resource_group.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ManagedClusterListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + + @distributed_trace_async + async def get_upgrade_profile( + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> _models.ManagedClusterUpgradeProfile: + """Gets the upgrade profile of a managed cluster. + + Gets the upgrade profile of a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedClusterUpgradeProfile or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterUpgradeProfile + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] + + + request = build_get_upgrade_profile_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_upgrade_profile.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ManagedClusterUpgradeProfile', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore + + + @distributed_trace_async + async def get_access_profile( + self, + resource_group_name: str, + resource_name: str, + role_name: str, + **kwargs: Any + ) -> _models.ManagedClusterAccessProfile: + """Gets an access profile of a managed cluster. + + **WARNING**\ : This API will be deprecated. Instead use `ListClusterUserCredentials + `_ or + `ListClusterAdminCredentials + `_ . + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param role_name: The name of the role for managed cluster accessProfile resource. Required. + :type role_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedClusterAccessProfile or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterAccessProfile + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] + + + request = build_get_access_profile_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + role_name=role_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_access_profile.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ManagedClusterAccessProfile', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_access_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore + + + @distributed_trace_async + async def list_cluster_admin_credentials( + self, + resource_group_name: str, + resource_name: str, + server_fqdn: Optional[str] = None, + **kwargs: Any + ) -> _models.CredentialResults: + """Lists the admin credentials of a managed cluster. + + Lists the admin credentials of a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. + :type server_fqdn: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CredentialResults or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_02_preview.models.CredentialResults + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + + + request = build_list_cluster_admin_credentials_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + server_fqdn=server_fqdn, + api_version=api_version, + template_url=self.list_cluster_admin_credentials.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CredentialResults', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_cluster_admin_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore + + + @distributed_trace_async + async def list_cluster_user_credentials( + self, + resource_group_name: str, + resource_name: str, + server_fqdn: Optional[str] = None, + format: Optional[Union[str, "_models.Format"]] = None, + **kwargs: Any + ) -> _models.CredentialResults: + """Lists the user credentials of a managed cluster. + + Lists the user credentials of a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. + :type server_fqdn: str + :param format: Only apply to AAD clusters, specifies the format of returned kubeconfig. Format + 'azure' will return azure auth-provider kubeconfig; format 'exec' will return exec format + kubeconfig, which requires kubelogin binary in the path. Known values are: "azure" and "exec". + Default value is None. + :type format: str or ~azure.mgmt.containerservice.v2022_07_02_preview.models.Format + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CredentialResults or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_02_preview.models.CredentialResults + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + + + request = build_list_cluster_user_credentials_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + server_fqdn=server_fqdn, + format=format, + api_version=api_version, + template_url=self.list_cluster_user_credentials.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CredentialResults', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_cluster_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore + + + @distributed_trace_async + async def list_cluster_monitoring_user_credentials( + self, + resource_group_name: str, + resource_name: str, + server_fqdn: Optional[str] = None, + **kwargs: Any + ) -> _models.CredentialResults: + """Lists the cluster monitoring user credentials of a managed cluster. + + Lists the cluster monitoring user credentials of a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. + :type server_fqdn: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CredentialResults or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_02_preview.models.CredentialResults + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + + + request = build_list_cluster_monitoring_user_credentials_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + server_fqdn=server_fqdn, + api_version=api_version, + template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CredentialResults', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_cluster_monitoring_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore + + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> _models.ManagedCluster: + """Gets a managed cluster. + + Gets a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedCluster or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedCluster + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + + + request = build_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ManagedCluster', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + + + async def _create_or_update_initial( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedCluster, IO], + **kwargs: Any + ) -> _models.ManagedCluster: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, 'ManagedCluster') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_or_update_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ManagedCluster', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ManagedCluster', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.ManagedCluster, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster to create or update. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedCluster + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedCluster, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster to create or update. Is either a model type or a IO + type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedCluster or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('ManagedCluster', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + + async def _update_tags_initial( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> _models.ManagedCluster: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, 'TagsObject') + + request = build_update_tags_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_tags_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ManagedCluster', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_tags_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + + + @overload + async def begin_update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates tags on a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_07_02_preview.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates tags on a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + + @distributed_trace_async + async def begin_update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates tags on a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_07_02_preview.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_tags_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('ManagedCluster', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + resource_name: str, + ignore_pod_disruption_budget: Optional[bool] = None, + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + ignore_pod_disruption_budget=ignore_pod_disruption_budget, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + resource_name: str, + ignore_pod_disruption_budget: Optional[bool] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a managed cluster. + + Deletes a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param ignore_pod_disruption_budget: ignore-pod-disruption-budget=true to delete those pods on + a node without considering Pod Disruption Budget. Default value is None. + :type ignore_pod_disruption_budget: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + ignore_pod_disruption_budget=ignore_pod_disruption_budget, + api_version=api_version, + cls=lambda x,y,z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + + async def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') + + request = build_reset_service_principal_profile_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._reset_service_principal_profile_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _reset_service_principal_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + + + @overload + async def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.ManagedClusterServicePrincipalProfile, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset the Service Principal Profile of a managed cluster. + + This action cannot be performed on a cluster that is not using a service principal. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The service principal profile to set on the managed cluster. Required. + :type parameters: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterServicePrincipalProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset the Service Principal Profile of a managed cluster. + + This action cannot be performed on a cluster that is not using a service principal. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The service principal profile to set on the managed cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + + @distributed_trace_async + async def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset the Service Principal Profile of a managed cluster. + + This action cannot be performed on a cluster that is not using a service principal. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The service principal profile to set on the managed cluster. Is either a + model type or a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterServicePrincipalProfile + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._reset_service_principal_profile_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_reset_service_principal_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + + async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterAADProfile, IO], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') + + request = build_reset_aad_profile_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._reset_aad_profile_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _reset_aad_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + + + @overload + async def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.ManagedClusterAADProfile, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset the AAD Profile of a managed cluster. + + Reset the AAD Profile of a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The AAD profile to set on the Managed Cluster. Required. + :type parameters: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterAADProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset the AAD Profile of a managed cluster. + + Reset the AAD Profile of a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The AAD profile to set on the Managed Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + + @distributed_trace_async + async def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterAADProfile, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset the AAD Profile of a managed cluster. + + Reset the AAD Profile of a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The AAD profile to set on the Managed Cluster. Is either a model type or a + IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterAADProfile or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._reset_aad_profile_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_reset_aad_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + + @distributed_trace_async + async def abort_latest_operation( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> None: + """Aborts last operation running on managed cluster. + + Aborting last running operation on managed cluster. We return a 204 no content code here to + indicate that the operation has been accepted and an abort will be attempted but is not + guaranteed to complete successfully. Please look up the provisioning state of the managed + cluster to keep track of whether it changes to Canceled. A canceled provisioning state + indicates that the abort was successful. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_abort_latest_operation_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.abort_latest_operation.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + abort_latest_operation.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclusters/{resourceName}/abort"} # type: ignore + + + async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_rotate_cluster_certificates_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._rotate_cluster_certificates_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _rotate_cluster_certificates_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore + + + @distributed_trace_async + async def begin_rotate_cluster_certificates( + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Rotates the certificates of a managed cluster. + + See `Certificate rotation `_ for + more details about rotating managed cluster certificates. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._rotate_cluster_certificates_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + api_version=api_version, + cls=lambda x,y,z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_rotate_cluster_certificates.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore + + async def _rotate_service_account_signing_keys_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_rotate_service_account_signing_keys_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._rotate_service_account_signing_keys_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _rotate_service_account_signing_keys_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateServiceAccountSigningKeys"} # type: ignore + + + @distributed_trace_async + async def begin_rotate_service_account_signing_keys( + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Rotates the service account signing keys of a managed cluster. + + Rotates the service account signing keys of a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._rotate_service_account_signing_keys_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + api_version=api_version, + cls=lambda x,y,z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_rotate_service_account_signing_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateServiceAccountSigningKeys"} # type: ignore + + async def _stop_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_stop_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._stop_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore + + + @distributed_trace_async + async def begin_stop( + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Stops a Managed Cluster. + + This can only be performed on Azure Virtual Machine Scale set backed clusters. Stopping a + cluster stops the control plane and agent nodes entirely, while maintaining all object and + cluster state. A cluster does not accrue charges while it is stopped. See `stopping a cluster + `_ for more details about stopping a + cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._stop_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + api_version=api_version, + cls=lambda x,y,z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore + + async def _start_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_start_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._start_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore + + + @distributed_trace_async + async def begin_start( + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Starts a previously stopped Managed Cluster. + + See `starting a cluster `_ for more + details about starting a cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._start_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + api_version=api_version, + cls=lambda x,y,z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore + + async def _run_command_initial( + self, + resource_group_name: str, + resource_name: str, + request_payload: Union[_models.RunCommandRequest, IO], + **kwargs: Any + ) -> Optional[_models.RunCommandResult]: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(request_payload, (IO, bytes)): + _content = request_payload + else: + _json = self._serialize.body(request_payload, 'RunCommandRequest') + + request = build_run_command_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._run_command_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('RunCommandResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _run_command_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore + + + @overload + async def begin_run_command( + self, + resource_group_name: str, + resource_name: str, + request_payload: _models.RunCommandRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.RunCommandResult]: + """Submits a command to run against the Managed Cluster. + + AKS will create a pod to run the command. This is primarily useful for private clusters. For + more information see `AKS Run Command + `_. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param request_payload: The run command request. Required. + :type request_payload: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.RunCommandRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RunCommandResult or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_07_02_preview.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_run_command( + self, + resource_group_name: str, + resource_name: str, + request_payload: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.RunCommandResult]: + """Submits a command to run against the Managed Cluster. + + AKS will create a pod to run the command. This is primarily useful for private clusters. For + more information see `AKS Run Command + `_. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param request_payload: The run command request. Required. + :type request_payload: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RunCommandResult or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_07_02_preview.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + + @distributed_trace_async + async def begin_run_command( + self, + resource_group_name: str, + resource_name: str, + request_payload: Union[_models.RunCommandRequest, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.RunCommandResult]: + """Submits a command to run against the Managed Cluster. + + AKS will create a pod to run the command. This is primarily useful for private clusters. For + more information see `AKS Run Command + `_. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param request_payload: The run command request. Is either a model type or a IO type. Required. + :type request_payload: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.RunCommandRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RunCommandResult or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_07_02_preview.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.RunCommandResult] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._run_command_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + request_payload=request_payload, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('RunCommandResult', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_run_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore + + @distributed_trace_async + async def get_command_result( + self, + resource_group_name: str, + resource_name: str, + command_id: str, + **kwargs: Any + ) -> Optional[_models.RunCommandResult]: + """Gets the results of a command which has been run on the Managed Cluster. + + Gets the results of a command which has been run on the Managed Cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param command_id: Id of the command. Required. + :type command_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RunCommandResult or None or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_02_preview.models.RunCommandResult or None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] + + + request = build_get_command_result_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + command_id=command_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_command_result.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('RunCommandResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_command_result.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}"} # type: ignore + + + @distributed_trace + def list_outbound_network_dependencies_endpoints( + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.OutboundEnvironmentEndpoint"]: + """Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the + specified managed cluster. + + Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the + specified managed cluster. The operation returns properties of each egress endpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OutboundEnvironmentEndpoint or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_07_02_preview.models.OutboundEnvironmentEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_outbound_network_dependencies_endpoints_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_outbound_network_dependencies_endpoints.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("OutboundEnvironmentEndpointCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_outbound_network_dependencies_endpoints.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/aio/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/aio/operations/_operations.py new file mode 100644 index 000000000000..6c82269e5d5f --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/aio/operations/_operations.py @@ -0,0 +1,122 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._operations import build_list_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_07_02_preview.aio.ContainerServiceClient`'s + :attr:`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") + + + @distributed_trace + def list( + self, + **kwargs: Any + ) -> AsyncIterable["_models.OperationValue"]: + """Gets a list of operations. + + Gets a list of operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationValue or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_07_02_preview.models.OperationValue] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + api_version=api_version, + template_url=self.list.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("OperationListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/providers/Microsoft.ContainerService/operations"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/aio/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/aio/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/aio/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/aio/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/aio/operations/_private_endpoint_connections_operations.py new file mode 100644 index 000000000000..8c45697b8aa0 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/aio/operations/_private_endpoint_connections_operations.py @@ -0,0 +1,474 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._private_endpoint_connections_operations import build_delete_request, build_get_request, build_list_request, build_update_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class PrivateEndpointConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_07_02_preview.aio.ContainerServiceClient`'s + :attr:`private_endpoint_connections` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + + @distributed_trace_async + async def list( + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> _models.PrivateEndpointConnectionListResult: + """Gets a list of private endpoint connections in the specified managed cluster. + + To learn more about private clusters, see: + https://docs.microsoft.com/azure/aks/private-clusters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnectionListResult or the result of cls(response) + :rtype: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.PrivateEndpointConnectionListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] + + + request = build_list_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore + + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Gets the specified private endpoint connection. + + To learn more about private clusters, see: + https://docs.microsoft.com/azure/aks/private-clusters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_02_preview.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + + + request = build_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + + + @overload + async def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: The updated private endpoint connection. Required. + :type parameters: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_02_preview.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: The updated private endpoint connection. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_02_preview.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: Union[_models.PrivateEndpointConnection, IO], + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: The updated private endpoint connection. Is either a model type or a IO + type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.PrivateEndpointConnection or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_02_preview.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, 'PrivateEndpointConnection') + + request = build_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a private endpoint connection. + + Deletes a private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, + cls=lambda x,y,z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/aio/operations/_private_link_resources_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/aio/operations/_private_link_resources_operations.py new file mode 100644 index 000000000000..9390b12e3edf --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/aio/operations/_private_link_resources_operations.py @@ -0,0 +1,111 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._private_link_resources_operations import build_list_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class PrivateLinkResourcesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_07_02_preview.aio.ContainerServiceClient`'s + :attr:`private_link_resources` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + + @distributed_trace_async + async def list( + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> _models.PrivateLinkResourcesListResult: + """Gets a list of private link resources in the specified managed cluster. + + To learn more about private clusters, see: + https://docs.microsoft.com/azure/aks/private-clusters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResourcesListResult or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_02_preview.models.PrivateLinkResourcesListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] + + + request = build_list_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateLinkResourcesListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources"} # type: ignore + diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/aio/operations/_resolve_private_link_service_id_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/aio/operations/_resolve_private_link_service_id_operations.py new file mode 100644 index 000000000000..a4ebdac3933b --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/aio/operations/_resolve_private_link_service_id_operations.py @@ -0,0 +1,190 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._resolve_private_link_service_id_operations import build_post_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ResolvePrivateLinkServiceIdOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_07_02_preview.aio.ContainerServiceClient`'s + :attr:`resolve_private_link_service_id` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + + @overload + async def post( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.PrivateLinkResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID for the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters required in order to resolve a private link service ID. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_07_02_preview.models.PrivateLinkResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_02_preview.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def post( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID for the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters required in order to resolve a private link service ID. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_02_preview.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + + @distributed_trace_async + async def post( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.PrivateLinkResource, IO], + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID for the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters required in order to resolve a private link service ID. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_07_02_preview.models.PrivateLinkResource + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_02_preview.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResource] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, 'PrivateLinkResource') + + request = build_post_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.post.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateLinkResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + post.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId"} # type: ignore + diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/aio/operations/_snapshots_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/aio/operations/_snapshots_operations.py new file mode 100644 index 000000000000..968e32cc95d4 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/aio/operations/_snapshots_operations.py @@ -0,0 +1,633 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._snapshots_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_resource_group_request, build_list_request, build_update_tags_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class SnapshotsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_07_02_preview.aio.ContainerServiceClient`'s + :attr:`snapshots` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + + @distributed_trace + def list( + self, + **kwargs: Any + ) -> AsyncIterable["_models.Snapshot"]: + """Gets a list of snapshots in the specified subscription. + + Gets a list of snapshots in the specified subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Snapshot or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_07_02_preview.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("SnapshotListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots"} # type: ignore + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.Snapshot"]: + """Lists snapshots in the specified subscription and resource group. + + Lists snapshots in the specified subscription and resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Snapshot or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_07_02_preview.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_resource_group.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("SnapshotListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots"} # type: ignore + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> _models.Snapshot: + """Gets a snapshot. + + Gets a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_02_preview.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + + + request = build_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Snapshot', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore + + + @overload + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.Snapshot, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Snapshot: + """Creates or updates a snapshot. + + Creates or updates a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The snapshot to create or update. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_07_02_preview.models.Snapshot + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_02_preview.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Snapshot: + """Creates or updates a snapshot. + + Creates or updates a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The snapshot to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_02_preview.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.Snapshot, IO], + **kwargs: Any + ) -> _models.Snapshot: + """Creates or updates a snapshot. + + Creates or updates a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The snapshot to create or update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.mgmt.containerservice.v2022_07_02_preview.models.Snapshot or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_02_preview.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, 'Snapshot') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Snapshot', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Snapshot', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore + + + @overload + async def update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Snapshot: + """Updates tags on a snapshot. + + Updates tags on a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update snapshot Tags operation. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_07_02_preview.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_02_preview.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Snapshot: + """Updates tags on a snapshot. + + Updates tags on a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update snapshot Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_02_preview.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + + @distributed_trace_async + async def update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> _models.Snapshot: + """Updates tags on a snapshot. + + Updates tags on a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update snapshot Tags operation. Is either a model + type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_07_02_preview.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_02_preview.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, 'TagsObject') + + request = build_update_tags_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update_tags.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Snapshot', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore + + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> None: + """Deletes a snapshot. + + Deletes a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.delete.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore + diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/aio/operations/_trusted_access_role_bindings_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/aio/operations/_trusted_access_role_bindings_operations.py new file mode 100644 index 000000000000..6bec990759bc --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/aio/operations/_trusted_access_role_bindings_operations.py @@ -0,0 +1,430 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._trusted_access_role_bindings_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class TrustedAccessRoleBindingsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_07_02_preview.aio.ContainerServiceClient`'s + :attr:`trusted_access_role_bindings` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + + @distributed_trace + def list( + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.TrustedAccessRoleBinding"]: + """List trusted access role bindings. + + List trusted access role bindings. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either TrustedAccessRoleBinding or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_07_02_preview.models.TrustedAccessRoleBinding] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.TrustedAccessRoleBindingListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("TrustedAccessRoleBindingListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings"} # type: ignore + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + resource_name: str, + trusted_access_role_binding_name: str, + **kwargs: Any + ) -> _models.TrustedAccessRoleBinding: + """Get a trusted access role binding. + + Get a trusted access role binding. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param trusted_access_role_binding_name: The name of trusted access role binding. Required. + :type trusted_access_role_binding_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TrustedAccessRoleBinding or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_02_preview.models.TrustedAccessRoleBinding + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.TrustedAccessRoleBinding] + + + request = build_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + trusted_access_role_binding_name=trusted_access_role_binding_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TrustedAccessRoleBinding', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}"} # type: ignore + + + @overload + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + trusted_access_role_binding_name: str, + trusted_access_role_binding: _models.TrustedAccessRoleBinding, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.TrustedAccessRoleBinding: + """Create or update a trusted access role binding. + + Create or update a trusted access role binding. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param trusted_access_role_binding_name: The name of trusted access role binding. Required. + :type trusted_access_role_binding_name: str + :param trusted_access_role_binding: A trusted access role binding. Required. + :type trusted_access_role_binding: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.TrustedAccessRoleBinding + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TrustedAccessRoleBinding or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_02_preview.models.TrustedAccessRoleBinding + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + trusted_access_role_binding_name: str, + trusted_access_role_binding: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.TrustedAccessRoleBinding: + """Create or update a trusted access role binding. + + Create or update a trusted access role binding. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param trusted_access_role_binding_name: The name of trusted access role binding. Required. + :type trusted_access_role_binding_name: str + :param trusted_access_role_binding: A trusted access role binding. Required. + :type trusted_access_role_binding: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TrustedAccessRoleBinding or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_02_preview.models.TrustedAccessRoleBinding + :raises ~azure.core.exceptions.HttpResponseError: + """ + + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + trusted_access_role_binding_name: str, + trusted_access_role_binding: Union[_models.TrustedAccessRoleBinding, IO], + **kwargs: Any + ) -> _models.TrustedAccessRoleBinding: + """Create or update a trusted access role binding. + + Create or update a trusted access role binding. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param trusted_access_role_binding_name: The name of trusted access role binding. Required. + :type trusted_access_role_binding_name: str + :param trusted_access_role_binding: A trusted access role binding. Is either a model type or a + IO type. Required. + :type trusted_access_role_binding: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.TrustedAccessRoleBinding or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TrustedAccessRoleBinding or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_02_preview.models.TrustedAccessRoleBinding + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.TrustedAccessRoleBinding] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(trusted_access_role_binding, (IO, bytes)): + _content = trusted_access_role_binding + else: + _json = self._serialize.body(trusted_access_role_binding, 'TrustedAccessRoleBinding') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + trusted_access_role_binding_name=trusted_access_role_binding_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TrustedAccessRoleBinding', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}"} # type: ignore + + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + resource_name: str, + trusted_access_role_binding_name: str, + **kwargs: Any + ) -> None: + """Delete a trusted access role binding. + + Delete a trusted access role binding. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param trusted_access_role_binding_name: The name of trusted access role binding. Required. + :type trusted_access_role_binding_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + trusted_access_role_binding_name=trusted_access_role_binding_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.delete.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}"} # type: ignore + diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/aio/operations/_trusted_access_roles_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/aio/operations/_trusted_access_roles_operations.py new file mode 100644 index 000000000000..9e20411d8513 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/aio/operations/_trusted_access_roles_operations.py @@ -0,0 +1,127 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._trusted_access_roles_operations import build_list_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class TrustedAccessRolesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_07_02_preview.aio.ContainerServiceClient`'s + :attr:`trusted_access_roles` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + + @distributed_trace + def list( + self, + location: str, + **kwargs: Any + ) -> AsyncIterable["_models.TrustedAccessRole"]: + """List supported trusted access roles. + + List supported trusted access roles. + + :param location: The name of Azure region. Required. + :type location: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either TrustedAccessRole or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_07_02_preview.models.TrustedAccessRole] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.TrustedAccessRoleListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("TrustedAccessRoleListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/trustedAccessRoles"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/models/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/models/__init__.py new file mode 100644 index 000000000000..ed29664e8f26 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/models/__init__.py @@ -0,0 +1,356 @@ +# 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 ._models_py3 import AgentPool +from ._models_py3 import AgentPoolAvailableVersions +from ._models_py3 import AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem +from ._models_py3 import AgentPoolListResult +from ._models_py3 import AgentPoolUpgradeProfile +from ._models_py3 import AgentPoolUpgradeProfilePropertiesUpgradesItem +from ._models_py3 import AgentPoolUpgradeSettings +from ._models_py3 import AzureEntityResource +from ._models_py3 import AzureKeyVaultKms +from ._models_py3 import CloudErrorBody +from ._models_py3 import ContainerServiceDiagnosticsProfile +from ._models_py3 import ContainerServiceLinuxProfile +from ._models_py3 import ContainerServiceMasterProfile +from ._models_py3 import ContainerServiceNetworkProfile +from ._models_py3 import ContainerServiceSshConfiguration +from ._models_py3 import ContainerServiceSshPublicKey +from ._models_py3 import ContainerServiceVMDiagnostics +from ._models_py3 import CreationData +from ._models_py3 import CredentialResult +from ._models_py3 import CredentialResults +from ._models_py3 import EndpointDependency +from ._models_py3 import EndpointDetail +from ._models_py3 import ErrorAdditionalInfo +from ._models_py3 import ErrorDetail +from ._models_py3 import ErrorResponse +from ._models_py3 import ExtendedLocation +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 FleetMembersListResult +from ._models_py3 import FleetPatch +from ._models_py3 import KubeletConfig +from ._models_py3 import LinuxOSConfig +from ._models_py3 import MaintenanceConfiguration +from ._models_py3 import MaintenanceConfigurationListResult +from ._models_py3 import ManagedCluster +from ._models_py3 import ManagedClusterAADProfile +from ._models_py3 import ManagedClusterAPIServerAccessProfile +from ._models_py3 import ManagedClusterAccessProfile +from ._models_py3 import ManagedClusterAddonProfile +from ._models_py3 import ManagedClusterAddonProfileIdentity +from ._models_py3 import ManagedClusterAgentPoolProfile +from ._models_py3 import ManagedClusterAgentPoolProfileProperties +from ._models_py3 import ManagedClusterAutoUpgradeProfile +from ._models_py3 import ManagedClusterAzureMonitorProfile +from ._models_py3 import ManagedClusterAzureMonitorProfileKubeStateMetrics +from ._models_py3 import ManagedClusterAzureMonitorProfileMetrics +from ._models_py3 import ManagedClusterHTTPProxyConfig +from ._models_py3 import ManagedClusterIdentity +from ._models_py3 import ManagedClusterIngressProfile +from ._models_py3 import ManagedClusterIngressProfileWebAppRouting +from ._models_py3 import ManagedClusterListResult +from ._models_py3 import ManagedClusterLoadBalancerProfile +from ._models_py3 import ManagedClusterLoadBalancerProfileManagedOutboundIPs +from ._models_py3 import ManagedClusterLoadBalancerProfileOutboundIPPrefixes +from ._models_py3 import ManagedClusterLoadBalancerProfileOutboundIPs +from ._models_py3 import ManagedClusterManagedOutboundIPProfile +from ._models_py3 import ManagedClusterNATGatewayProfile +from ._models_py3 import ManagedClusterOIDCIssuerProfile +from ._models_py3 import ManagedClusterPodIdentity +from ._models_py3 import ManagedClusterPodIdentityException +from ._models_py3 import ManagedClusterPodIdentityProfile +from ._models_py3 import ManagedClusterPodIdentityProvisioningError +from ._models_py3 import ManagedClusterPodIdentityProvisioningErrorBody +from ._models_py3 import ManagedClusterPodIdentityProvisioningInfo +from ._models_py3 import ManagedClusterPoolUpgradeProfile +from ._models_py3 import ManagedClusterPoolUpgradeProfileUpgradesItem +from ._models_py3 import ManagedClusterPropertiesAutoScalerProfile +from ._models_py3 import ManagedClusterPropertiesForSnapshot +from ._models_py3 import ManagedClusterSKU +from ._models_py3 import ManagedClusterSecurityProfile +from ._models_py3 import ManagedClusterSecurityProfileDefender +from ._models_py3 import ManagedClusterSecurityProfileDefenderSecurityMonitoring +from ._models_py3 import ManagedClusterSecurityProfileImageCleaner +from ._models_py3 import ManagedClusterSecurityProfileNodeRestriction +from ._models_py3 import ManagedClusterSecurityProfileWorkloadIdentity +from ._models_py3 import ManagedClusterServicePrincipalProfile +from ._models_py3 import ManagedClusterSnapshot +from ._models_py3 import ManagedClusterSnapshotListResult +from ._models_py3 import ManagedClusterStorageProfile +from ._models_py3 import ManagedClusterStorageProfileBlobCSIDriver +from ._models_py3 import ManagedClusterStorageProfileDiskCSIDriver +from ._models_py3 import ManagedClusterStorageProfileFileCSIDriver +from ._models_py3 import ManagedClusterStorageProfileSnapshotController +from ._models_py3 import ManagedClusterUpgradeProfile +from ._models_py3 import ManagedClusterWindowsProfile +from ._models_py3 import ManagedClusterWorkloadAutoScalerProfile +from ._models_py3 import ManagedClusterWorkloadAutoScalerProfileKeda +from ._models_py3 import ManagedClusterWorkloadAutoScalerProfileVerticalPodAutoscaler +from ._models_py3 import ManagedServiceIdentityUserAssignedIdentitiesValue +from ._models_py3 import NetworkProfileForSnapshot +from ._models_py3 import OSOptionProfile +from ._models_py3 import OSOptionProperty +from ._models_py3 import OperationListResult +from ._models_py3 import OperationValue +from ._models_py3 import OutboundEnvironmentEndpoint +from ._models_py3 import OutboundEnvironmentEndpointCollection +from ._models_py3 import PowerState +from ._models_py3 import PrivateEndpoint +from ._models_py3 import PrivateEndpointConnection +from ._models_py3 import PrivateEndpointConnectionListResult +from ._models_py3 import PrivateLinkResource +from ._models_py3 import PrivateLinkResourcesListResult +from ._models_py3 import PrivateLinkServiceConnectionState +from ._models_py3 import Resource +from ._models_py3 import ResourceReference +from ._models_py3 import RunCommandRequest +from ._models_py3 import RunCommandResult +from ._models_py3 import Snapshot +from ._models_py3 import SnapshotListResult +from ._models_py3 import SubResource +from ._models_py3 import SysctlConfig +from ._models_py3 import SystemData +from ._models_py3 import TagsObject +from ._models_py3 import TimeInWeek +from ._models_py3 import TimeSpan +from ._models_py3 import TrackedResource +from ._models_py3 import TrustedAccessRole +from ._models_py3 import TrustedAccessRoleBinding +from ._models_py3 import TrustedAccessRoleBindingListResult +from ._models_py3 import TrustedAccessRoleListResult +from ._models_py3 import TrustedAccessRoleRule +from ._models_py3 import UserAssignedIdentity +from ._models_py3 import WindowsGmsaProfile + +from ._container_service_client_enums import AgentPoolMode +from ._container_service_client_enums import AgentPoolType +from ._container_service_client_enums import Code +from ._container_service_client_enums import ConnectionStatus +from ._container_service_client_enums import ContainerServiceStorageProfileTypes +from ._container_service_client_enums import ContainerServiceVMSizeTypes +from ._container_service_client_enums import ControlledValues +from ._container_service_client_enums import Count +from ._container_service_client_enums import CreatedByType +from ._container_service_client_enums import Expander +from ._container_service_client_enums import ExtendedLocationTypes +from ._container_service_client_enums import FleetMemberProvisioningState +from ._container_service_client_enums import FleetProvisioningState +from ._container_service_client_enums import Format +from ._container_service_client_enums import GPUInstanceProfile +from ._container_service_client_enums import IpFamily +from ._container_service_client_enums import KeyVaultNetworkAccessTypes +from ._container_service_client_enums import KubeletDiskType +from ._container_service_client_enums import LicenseType +from ._container_service_client_enums import LoadBalancerSku +from ._container_service_client_enums import ManagedClusterPodIdentityProvisioningState +from ._container_service_client_enums import ManagedClusterSKUName +from ._container_service_client_enums import ManagedClusterSKUTier +from ._container_service_client_enums import NetworkMode +from ._container_service_client_enums import NetworkPlugin +from ._container_service_client_enums import NetworkPluginMode +from ._container_service_client_enums import NetworkPolicy +from ._container_service_client_enums import OSDiskType +from ._container_service_client_enums import OSSKU +from ._container_service_client_enums import OSType +from ._container_service_client_enums import OutboundType +from ._container_service_client_enums import PrivateEndpointConnectionProvisioningState +from ._container_service_client_enums import PublicNetworkAccess +from ._container_service_client_enums import ResourceIdentityType +from ._container_service_client_enums import ScaleDownMode +from ._container_service_client_enums import ScaleSetEvictionPolicy +from ._container_service_client_enums import ScaleSetPriority +from ._container_service_client_enums import SnapshotType +from ._container_service_client_enums import TrustedAccessRoleBindingProvisioningState +from ._container_service_client_enums import UpdateMode +from ._container_service_client_enums import UpgradeChannel +from ._container_service_client_enums import WeekDay +from ._container_service_client_enums import WorkloadRuntime +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk +__all__ = [ + 'AgentPool', + 'AgentPoolAvailableVersions', + 'AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem', + 'AgentPoolListResult', + 'AgentPoolUpgradeProfile', + 'AgentPoolUpgradeProfilePropertiesUpgradesItem', + 'AgentPoolUpgradeSettings', + 'AzureEntityResource', + 'AzureKeyVaultKms', + 'CloudErrorBody', + 'ContainerServiceDiagnosticsProfile', + 'ContainerServiceLinuxProfile', + 'ContainerServiceMasterProfile', + 'ContainerServiceNetworkProfile', + 'ContainerServiceSshConfiguration', + 'ContainerServiceSshPublicKey', + 'ContainerServiceVMDiagnostics', + 'CreationData', + 'CredentialResult', + 'CredentialResults', + 'EndpointDependency', + 'EndpointDetail', + 'ErrorAdditionalInfo', + 'ErrorDetail', + 'ErrorResponse', + 'ExtendedLocation', + 'Fleet', + 'FleetCredentialResult', + 'FleetCredentialResults', + 'FleetHubProfile', + 'FleetListResult', + 'FleetMember', + 'FleetMembersListResult', + 'FleetPatch', + 'KubeletConfig', + 'LinuxOSConfig', + 'MaintenanceConfiguration', + 'MaintenanceConfigurationListResult', + 'ManagedCluster', + 'ManagedClusterAADProfile', + 'ManagedClusterAPIServerAccessProfile', + 'ManagedClusterAccessProfile', + 'ManagedClusterAddonProfile', + 'ManagedClusterAddonProfileIdentity', + 'ManagedClusterAgentPoolProfile', + 'ManagedClusterAgentPoolProfileProperties', + 'ManagedClusterAutoUpgradeProfile', + 'ManagedClusterAzureMonitorProfile', + 'ManagedClusterAzureMonitorProfileKubeStateMetrics', + 'ManagedClusterAzureMonitorProfileMetrics', + 'ManagedClusterHTTPProxyConfig', + 'ManagedClusterIdentity', + 'ManagedClusterIngressProfile', + 'ManagedClusterIngressProfileWebAppRouting', + 'ManagedClusterListResult', + 'ManagedClusterLoadBalancerProfile', + 'ManagedClusterLoadBalancerProfileManagedOutboundIPs', + 'ManagedClusterLoadBalancerProfileOutboundIPPrefixes', + 'ManagedClusterLoadBalancerProfileOutboundIPs', + 'ManagedClusterManagedOutboundIPProfile', + 'ManagedClusterNATGatewayProfile', + 'ManagedClusterOIDCIssuerProfile', + 'ManagedClusterPodIdentity', + 'ManagedClusterPodIdentityException', + 'ManagedClusterPodIdentityProfile', + 'ManagedClusterPodIdentityProvisioningError', + 'ManagedClusterPodIdentityProvisioningErrorBody', + 'ManagedClusterPodIdentityProvisioningInfo', + 'ManagedClusterPoolUpgradeProfile', + 'ManagedClusterPoolUpgradeProfileUpgradesItem', + 'ManagedClusterPropertiesAutoScalerProfile', + 'ManagedClusterPropertiesForSnapshot', + 'ManagedClusterSKU', + 'ManagedClusterSecurityProfile', + 'ManagedClusterSecurityProfileDefender', + 'ManagedClusterSecurityProfileDefenderSecurityMonitoring', + 'ManagedClusterSecurityProfileImageCleaner', + 'ManagedClusterSecurityProfileNodeRestriction', + 'ManagedClusterSecurityProfileWorkloadIdentity', + 'ManagedClusterServicePrincipalProfile', + 'ManagedClusterSnapshot', + 'ManagedClusterSnapshotListResult', + 'ManagedClusterStorageProfile', + 'ManagedClusterStorageProfileBlobCSIDriver', + 'ManagedClusterStorageProfileDiskCSIDriver', + 'ManagedClusterStorageProfileFileCSIDriver', + 'ManagedClusterStorageProfileSnapshotController', + 'ManagedClusterUpgradeProfile', + 'ManagedClusterWindowsProfile', + 'ManagedClusterWorkloadAutoScalerProfile', + 'ManagedClusterWorkloadAutoScalerProfileKeda', + 'ManagedClusterWorkloadAutoScalerProfileVerticalPodAutoscaler', + 'ManagedServiceIdentityUserAssignedIdentitiesValue', + 'NetworkProfileForSnapshot', + 'OSOptionProfile', + 'OSOptionProperty', + 'OperationListResult', + 'OperationValue', + 'OutboundEnvironmentEndpoint', + 'OutboundEnvironmentEndpointCollection', + 'PowerState', + 'PrivateEndpoint', + 'PrivateEndpointConnection', + 'PrivateEndpointConnectionListResult', + 'PrivateLinkResource', + 'PrivateLinkResourcesListResult', + 'PrivateLinkServiceConnectionState', + 'Resource', + 'ResourceReference', + 'RunCommandRequest', + 'RunCommandResult', + 'Snapshot', + 'SnapshotListResult', + 'SubResource', + 'SysctlConfig', + 'SystemData', + 'TagsObject', + 'TimeInWeek', + 'TimeSpan', + 'TrackedResource', + 'TrustedAccessRole', + 'TrustedAccessRoleBinding', + 'TrustedAccessRoleBindingListResult', + 'TrustedAccessRoleListResult', + 'TrustedAccessRoleRule', + 'UserAssignedIdentity', + 'WindowsGmsaProfile', + 'AgentPoolMode', + 'AgentPoolType', + 'Code', + 'ConnectionStatus', + 'ContainerServiceStorageProfileTypes', + 'ContainerServiceVMSizeTypes', + 'ControlledValues', + 'Count', + 'CreatedByType', + 'Expander', + 'ExtendedLocationTypes', + 'FleetMemberProvisioningState', + 'FleetProvisioningState', + 'Format', + 'GPUInstanceProfile', + 'IpFamily', + 'KeyVaultNetworkAccessTypes', + 'KubeletDiskType', + 'LicenseType', + 'LoadBalancerSku', + 'ManagedClusterPodIdentityProvisioningState', + 'ManagedClusterSKUName', + 'ManagedClusterSKUTier', + 'NetworkMode', + 'NetworkPlugin', + 'NetworkPluginMode', + 'NetworkPolicy', + 'OSDiskType', + 'OSSKU', + 'OSType', + 'OutboundType', + 'PrivateEndpointConnectionProvisioningState', + 'PublicNetworkAccess', + 'ResourceIdentityType', + 'ScaleDownMode', + 'ScaleSetEvictionPolicy', + 'ScaleSetPriority', + 'SnapshotType', + 'TrustedAccessRoleBindingProvisioningState', + 'UpdateMode', + 'UpgradeChannel', + 'WeekDay', + 'WorkloadRuntime', +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/models/_container_service_client_enums.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/models/_container_service_client_enums.py new file mode 100644 index 000000000000..33a00c453da3 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/models/_container_service_client_enums.py @@ -0,0 +1,673 @@ +# 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 enum import Enum +from azure.core import CaseInsensitiveEnumMeta + + +class AgentPoolMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """A cluster must have at least one 'System' Agent Pool at all times. For additional information + on agent pool restrictions and best practices, see: + https://docs.microsoft.com/azure/aks/use-system-pools. + """ + + #: System agent pools are primarily for hosting critical system pods such as CoreDNS and + #: metrics-server. System agent pools osType must be Linux. System agent pools VM SKU must have at + #: least 2vCPUs and 4GB of memory. + SYSTEM = "System" + #: User agent pools are primarily for hosting your application pods. + USER = "User" + +class AgentPoolType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of Agent Pool. + """ + + #: Create an Agent Pool backed by a Virtual Machine Scale Set. + VIRTUAL_MACHINE_SCALE_SETS = "VirtualMachineScaleSets" + #: Use of this is strongly discouraged. + AVAILABILITY_SET = "AvailabilitySet" + +class Code(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Tells whether the cluster is Running or Stopped. + """ + + #: The cluster is running. + RUNNING = "Running" + #: The cluster is stopped. + STOPPED = "Stopped" + +class ConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The private link service connection status. + """ + + PENDING = "Pending" + APPROVED = "Approved" + REJECTED = "Rejected" + DISCONNECTED = "Disconnected" + +class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Specifies what kind of storage to use. If omitted, the default will be chosen on your behalf + based on the choice of orchestrator. + """ + + STORAGE_ACCOUNT = "StorageAccount" + MANAGED_DISKS = "ManagedDisks" + +class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Size of agent VMs. Note: This is no longer maintained. + """ + + STANDARD_A1 = "Standard_A1" + STANDARD_A10 = "Standard_A10" + STANDARD_A11 = "Standard_A11" + STANDARD_A1_V2 = "Standard_A1_v2" + STANDARD_A2 = "Standard_A2" + STANDARD_A2_V2 = "Standard_A2_v2" + STANDARD_A2_M_V2 = "Standard_A2m_v2" + STANDARD_A3 = "Standard_A3" + STANDARD_A4 = "Standard_A4" + STANDARD_A4_V2 = "Standard_A4_v2" + STANDARD_A4_M_V2 = "Standard_A4m_v2" + STANDARD_A5 = "Standard_A5" + STANDARD_A6 = "Standard_A6" + STANDARD_A7 = "Standard_A7" + STANDARD_A8 = "Standard_A8" + STANDARD_A8_V2 = "Standard_A8_v2" + STANDARD_A8_M_V2 = "Standard_A8m_v2" + STANDARD_A9 = "Standard_A9" + STANDARD_B2_MS = "Standard_B2ms" + STANDARD_B2_S = "Standard_B2s" + STANDARD_B4_MS = "Standard_B4ms" + STANDARD_B8_MS = "Standard_B8ms" + STANDARD_D1 = "Standard_D1" + STANDARD_D11 = "Standard_D11" + STANDARD_D11_V2 = "Standard_D11_v2" + STANDARD_D11_V2_PROMO = "Standard_D11_v2_Promo" + STANDARD_D12 = "Standard_D12" + STANDARD_D12_V2 = "Standard_D12_v2" + STANDARD_D12_V2_PROMO = "Standard_D12_v2_Promo" + STANDARD_D13 = "Standard_D13" + STANDARD_D13_V2 = "Standard_D13_v2" + STANDARD_D13_V2_PROMO = "Standard_D13_v2_Promo" + STANDARD_D14 = "Standard_D14" + STANDARD_D14_V2 = "Standard_D14_v2" + STANDARD_D14_V2_PROMO = "Standard_D14_v2_Promo" + STANDARD_D15_V2 = "Standard_D15_v2" + STANDARD_D16_V3 = "Standard_D16_v3" + STANDARD_D16_S_V3 = "Standard_D16s_v3" + STANDARD_D1_V2 = "Standard_D1_v2" + STANDARD_D2 = "Standard_D2" + STANDARD_D2_V2 = "Standard_D2_v2" + STANDARD_D2_V2_PROMO = "Standard_D2_v2_Promo" + STANDARD_D2_V3 = "Standard_D2_v3" + STANDARD_D2_S_V3 = "Standard_D2s_v3" + STANDARD_D3 = "Standard_D3" + STANDARD_D32_V3 = "Standard_D32_v3" + STANDARD_D32_S_V3 = "Standard_D32s_v3" + STANDARD_D3_V2 = "Standard_D3_v2" + STANDARD_D3_V2_PROMO = "Standard_D3_v2_Promo" + STANDARD_D4 = "Standard_D4" + STANDARD_D4_V2 = "Standard_D4_v2" + STANDARD_D4_V2_PROMO = "Standard_D4_v2_Promo" + STANDARD_D4_V3 = "Standard_D4_v3" + STANDARD_D4_S_V3 = "Standard_D4s_v3" + STANDARD_D5_V2 = "Standard_D5_v2" + STANDARD_D5_V2_PROMO = "Standard_D5_v2_Promo" + STANDARD_D64_V3 = "Standard_D64_v3" + STANDARD_D64_S_V3 = "Standard_D64s_v3" + STANDARD_D8_V3 = "Standard_D8_v3" + STANDARD_D8_S_V3 = "Standard_D8s_v3" + STANDARD_DS1 = "Standard_DS1" + STANDARD_DS11 = "Standard_DS11" + STANDARD_DS11_V2 = "Standard_DS11_v2" + STANDARD_DS11_V2_PROMO = "Standard_DS11_v2_Promo" + STANDARD_DS12 = "Standard_DS12" + STANDARD_DS12_V2 = "Standard_DS12_v2" + STANDARD_DS12_V2_PROMO = "Standard_DS12_v2_Promo" + STANDARD_DS13 = "Standard_DS13" + STANDARD_DS13_2_V2 = "Standard_DS13-2_v2" + STANDARD_DS13_4_V2 = "Standard_DS13-4_v2" + STANDARD_DS13_V2 = "Standard_DS13_v2" + STANDARD_DS13_V2_PROMO = "Standard_DS13_v2_Promo" + STANDARD_DS14 = "Standard_DS14" + STANDARD_DS14_4_V2 = "Standard_DS14-4_v2" + STANDARD_DS14_8_V2 = "Standard_DS14-8_v2" + STANDARD_DS14_V2 = "Standard_DS14_v2" + STANDARD_DS14_V2_PROMO = "Standard_DS14_v2_Promo" + STANDARD_DS15_V2 = "Standard_DS15_v2" + STANDARD_DS1_V2 = "Standard_DS1_v2" + STANDARD_DS2 = "Standard_DS2" + STANDARD_DS2_V2 = "Standard_DS2_v2" + STANDARD_DS2_V2_PROMO = "Standard_DS2_v2_Promo" + STANDARD_DS3 = "Standard_DS3" + STANDARD_DS3_V2 = "Standard_DS3_v2" + STANDARD_DS3_V2_PROMO = "Standard_DS3_v2_Promo" + STANDARD_DS4 = "Standard_DS4" + STANDARD_DS4_V2 = "Standard_DS4_v2" + STANDARD_DS4_V2_PROMO = "Standard_DS4_v2_Promo" + STANDARD_DS5_V2 = "Standard_DS5_v2" + STANDARD_DS5_V2_PROMO = "Standard_DS5_v2_Promo" + STANDARD_E16_V3 = "Standard_E16_v3" + STANDARD_E16_S_V3 = "Standard_E16s_v3" + STANDARD_E2_V3 = "Standard_E2_v3" + STANDARD_E2_S_V3 = "Standard_E2s_v3" + STANDARD_E32_16_S_V3 = "Standard_E32-16s_v3" + STANDARD_E32_8_S_V3 = "Standard_E32-8s_v3" + STANDARD_E32_V3 = "Standard_E32_v3" + STANDARD_E32_S_V3 = "Standard_E32s_v3" + STANDARD_E4_V3 = "Standard_E4_v3" + STANDARD_E4_S_V3 = "Standard_E4s_v3" + STANDARD_E64_16_S_V3 = "Standard_E64-16s_v3" + STANDARD_E64_32_S_V3 = "Standard_E64-32s_v3" + STANDARD_E64_V3 = "Standard_E64_v3" + STANDARD_E64_S_V3 = "Standard_E64s_v3" + STANDARD_E8_V3 = "Standard_E8_v3" + STANDARD_E8_S_V3 = "Standard_E8s_v3" + STANDARD_F1 = "Standard_F1" + STANDARD_F16 = "Standard_F16" + STANDARD_F16_S = "Standard_F16s" + STANDARD_F16_S_V2 = "Standard_F16s_v2" + STANDARD_F1_S = "Standard_F1s" + STANDARD_F2 = "Standard_F2" + STANDARD_F2_S = "Standard_F2s" + STANDARD_F2_S_V2 = "Standard_F2s_v2" + STANDARD_F32_S_V2 = "Standard_F32s_v2" + STANDARD_F4 = "Standard_F4" + STANDARD_F4_S = "Standard_F4s" + STANDARD_F4_S_V2 = "Standard_F4s_v2" + STANDARD_F64_S_V2 = "Standard_F64s_v2" + STANDARD_F72_S_V2 = "Standard_F72s_v2" + STANDARD_F8 = "Standard_F8" + STANDARD_F8_S = "Standard_F8s" + STANDARD_F8_S_V2 = "Standard_F8s_v2" + STANDARD_G1 = "Standard_G1" + STANDARD_G2 = "Standard_G2" + STANDARD_G3 = "Standard_G3" + STANDARD_G4 = "Standard_G4" + STANDARD_G5 = "Standard_G5" + STANDARD_GS1 = "Standard_GS1" + STANDARD_GS2 = "Standard_GS2" + STANDARD_GS3 = "Standard_GS3" + STANDARD_GS4 = "Standard_GS4" + STANDARD_GS4_4 = "Standard_GS4-4" + STANDARD_GS4_8 = "Standard_GS4-8" + STANDARD_GS5 = "Standard_GS5" + STANDARD_GS5_16 = "Standard_GS5-16" + STANDARD_GS5_8 = "Standard_GS5-8" + STANDARD_H16 = "Standard_H16" + STANDARD_H16_M = "Standard_H16m" + STANDARD_H16_MR = "Standard_H16mr" + STANDARD_H16_R = "Standard_H16r" + STANDARD_H8 = "Standard_H8" + STANDARD_H8_M = "Standard_H8m" + STANDARD_L16_S = "Standard_L16s" + STANDARD_L32_S = "Standard_L32s" + STANDARD_L4_S = "Standard_L4s" + STANDARD_L8_S = "Standard_L8s" + STANDARD_M128_32_MS = "Standard_M128-32ms" + STANDARD_M128_64_MS = "Standard_M128-64ms" + STANDARD_M128_MS = "Standard_M128ms" + STANDARD_M128_S = "Standard_M128s" + STANDARD_M64_16_MS = "Standard_M64-16ms" + STANDARD_M64_32_MS = "Standard_M64-32ms" + STANDARD_M64_MS = "Standard_M64ms" + STANDARD_M64_S = "Standard_M64s" + STANDARD_NC12 = "Standard_NC12" + STANDARD_NC12_S_V2 = "Standard_NC12s_v2" + STANDARD_NC12_S_V3 = "Standard_NC12s_v3" + STANDARD_NC24 = "Standard_NC24" + STANDARD_NC24_R = "Standard_NC24r" + STANDARD_NC24_RS_V2 = "Standard_NC24rs_v2" + STANDARD_NC24_RS_V3 = "Standard_NC24rs_v3" + STANDARD_NC24_S_V2 = "Standard_NC24s_v2" + STANDARD_NC24_S_V3 = "Standard_NC24s_v3" + STANDARD_NC6 = "Standard_NC6" + STANDARD_NC6_S_V2 = "Standard_NC6s_v2" + STANDARD_NC6_S_V3 = "Standard_NC6s_v3" + STANDARD_ND12_S = "Standard_ND12s" + STANDARD_ND24_RS = "Standard_ND24rs" + STANDARD_ND24_S = "Standard_ND24s" + STANDARD_ND6_S = "Standard_ND6s" + STANDARD_NV12 = "Standard_NV12" + STANDARD_NV24 = "Standard_NV24" + STANDARD_NV6 = "Standard_NV6" + +class ControlledValues(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Controls which resource value autoscaler will change. Default value is RequestsAndLimits. + """ + + #: Autoscaler will control resource requests and limits. + REQUESTS_AND_LIMITS = "RequestsAndLimits" + #: Autoscaler will control resource requests only. + REQUESTS_ONLY = "RequestsOnly" + +class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): + """Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, and 5. The + default value is 1. + """ + + ONE = 1 + THREE = 3 + FIVE = 5 + +class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of identity that created the resource. + """ + + USER = "User" + APPLICATION = "Application" + MANAGED_IDENTITY = "ManagedIdentity" + KEY = "Key" + +class Expander(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """If not specified, the default is 'random'. See `expanders + `_ + for more information. + """ + + #: Selects the node group that will have the least idle CPU (if tied, unused memory) after + #: scale-up. This is useful when you have different classes of nodes, for example, high CPU or + #: high memory nodes, and only want to expand those when there are pending pods that need a lot of + #: those resources. + LEAST_WASTE = "least-waste" + #: Selects the node group that would be able to schedule the most pods when scaling up. This is + #: useful when you are using nodeSelector to make sure certain pods land on certain nodes. Note + #: that this won't cause the autoscaler to select bigger nodes vs. smaller, as it can add multiple + #: smaller nodes at once. + MOST_PODS = "most-pods" + #: Selects the node group that has the highest priority assigned by the user. It's configuration + #: is described in more details `here + #: `_. + PRIORITY = "priority" + #: Used when you don't have a particular need for the node groups to scale differently. + RANDOM = "random" + +class ExtendedLocationTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of extendedLocation. + """ + + EDGE_ZONE = "EdgeZone" + +class FleetMemberProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The provisioning state of the last accepted operation. + """ + + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CANCELED = "Canceled" + JOINING = "Joining" + LEAVING = "Leaving" + UPDATING = "Updating" + +class FleetProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The provisioning state of the last accepted operation. + """ + + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CANCELED = "Canceled" + CREATING = "Creating" + DELETING = "Deleting" + UPDATING = "Updating" + +class Format(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Format. + """ + + #: Return azure auth-provider kubeconfig. This format is deprecated in 1.22 and will be fully + #: removed in 1.25. + AZURE = "azure" + #: Return exec format kubeconfig. This format requires kubelogin binary in the path. + EXEC = "exec" + +class GPUInstanceProfile(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """GPUInstanceProfile to be used to specify GPU MIG instance profile for supported GPU VM SKU. + """ + + MIG1_G = "MIG1g" + MIG2_G = "MIG2g" + MIG3_G = "MIG3g" + MIG4_G = "MIG4g" + MIG7_G = "MIG7g" + +class IpFamily(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The IP version to use for cluster networking and IP assignment. + """ + + I_PV4 = "IPv4" + I_PV6 = "IPv6" + +class KeyVaultNetworkAccessTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Network access of key vault. The possible values are ``Public`` and ``Private``. ``Public`` + means the key vault allows public access from all networks. ``Private`` means the key vault + disables public access and enables private link. The default value is ``Public``. + """ + + PUBLIC = "Public" + PRIVATE = "Private" + +class KubeletDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Determines the placement of emptyDir volumes, container runtime data root, and Kubelet + ephemeral storage. + """ + + #: Kubelet will use the OS disk for its data. + OS = "OS" + #: Kubelet will use the temporary disk for its data. + TEMPORARY = "Temporary" + +class LicenseType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The license type to use for Windows VMs. See `Azure Hybrid User Benefits + `_ for more details. + """ + + #: No additional licensing is applied. + NONE = "None" + #: Enables Azure Hybrid User Benefits for Windows VMs. + WINDOWS_SERVER = "Windows_Server" + +class LoadBalancerSku(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The default is 'standard'. See `Azure Load Balancer SKUs + `_ for more information about the + differences between load balancer SKUs. + """ + + #: Use a a standard Load Balancer. This is the recommended Load Balancer SKU. For more information + #: about on working with the load balancer in the managed cluster, see the `standard Load Balancer + #: `_ article. + STANDARD = "standard" + #: Use a basic Load Balancer with limited functionality. + BASIC = "basic" + +class ManagedClusterPodIdentityProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The current provisioning state of the pod identity. + """ + + ASSIGNED = "Assigned" + UPDATING = "Updating" + DELETING = "Deleting" + FAILED = "Failed" + +class ManagedClusterSKUName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The name of a managed cluster SKU. + """ + + BASIC = "Basic" + +class ManagedClusterSKUTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """If not specified, the default is 'Free'. See `uptime SLA + `_ for more details. + """ + + #: Guarantees 99.95% availability of the Kubernetes API server endpoint for clusters that use + #: Availability Zones and 99.9% of availability for clusters that don't use Availability Zones. + PAID = "Paid" + #: No guaranteed SLA, no additional charges. Free tier clusters have an SLO of 99.5%. + FREE = "Free" + +class NetworkMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """This cannot be specified if networkPlugin is anything other than 'azure'. + """ + + #: No bridge is created. Intra-VM Pod to Pod communication is through IP routes created by Azure + #: CNI. See `Transparent Mode `_ for + #: more information. + TRANSPARENT = "transparent" + #: This is no longer supported + BRIDGE = "bridge" + +class NetworkPlugin(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Network plugin used for building the Kubernetes network. + """ + + #: Use the Azure CNI network plugin. See `Azure CNI (advanced) networking + #: `_ for + #: more information. + AZURE = "azure" + #: Use the Kubenet network plugin. See `Kubenet (basic) networking + #: `_ for more + #: information. + KUBENET = "kubenet" + #: Do not use a network plugin. A custom CNI will need to be installed after cluster creation for + #: networking functionality. + NONE = "none" + +class NetworkPluginMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The mode the network plugin should use. + """ + + #: Pods are given IPs from the PodCIDR address space but use Azure Routing Domains rather than + #: Kubenet reference plugins host-local and bridge. + OVERLAY = "Overlay" + +class NetworkPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Network policy used for building the Kubernetes network. + """ + + #: Use Calico network policies. See `differences between Azure and Calico policies + #: `_ + #: for more information. + CALICO = "calico" + #: Use Azure network policies. See `differences between Azure and Calico policies + #: `_ + #: for more information. + AZURE = "azure" + +class OSDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested + OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more + information see `Ephemeral OS + `_. + """ + + #: Azure replicates the operating system disk for a virtual machine to Azure storage to avoid data + #: loss should the VM need to be relocated to another host. Since containers aren't designed to + #: have local state persisted, this behavior offers limited value while providing some drawbacks, + #: including slower node provisioning and higher read/write latency. + MANAGED = "Managed" + #: Ephemeral OS disks are stored only on the host machine, just like a temporary disk. This + #: provides lower read/write latency, along with faster node scaling and cluster upgrades. + EPHEMERAL = "Ephemeral" + +class OSSKU(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Specifies the OS SKU used by the agent pool. If not specified, the default is Ubuntu if + OSType=Linux or Windows2019 if OSType=Windows. And the default Windows OSSKU will be changed to + Windows2022 after Windows2019 is deprecated. + """ + + UBUNTU = "Ubuntu" + CBL_MARINER = "CBLMariner" + WINDOWS2019 = "Windows2019" + WINDOWS2022 = "Windows2022" + +class OSType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The operating system type. The default is Linux. + """ + + #: Use Linux. + LINUX = "Linux" + #: Use Windows. + WINDOWS = "Windows" + +class OutboundType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """This can only be set at cluster creation time and cannot be changed later. For more information + see `egress outbound type `_. + """ + + #: The load balancer is used for egress through an AKS assigned public IP. This supports + #: Kubernetes services of type 'loadBalancer'. For more information see `outbound type + #: loadbalancer + #: `_. + LOAD_BALANCER = "loadBalancer" + #: Egress paths must be defined by the user. This is an advanced scenario and requires proper + #: network configuration. For more information see `outbound type userDefinedRouting + #: `_. + USER_DEFINED_ROUTING = "userDefinedRouting" + #: The AKS-managed NAT gateway is used for egress. + MANAGED_NAT_GATEWAY = "managedNATGateway" + #: The user-assigned NAT gateway associated to the cluster subnet is used for egress. This is an + #: advanced scenario and requires proper network configuration. + USER_ASSIGNED_NAT_GATEWAY = "userAssignedNATGateway" + +class PrivateEndpointConnectionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The current provisioning state. + """ + + SUCCEEDED = "Succeeded" + CREATING = "Creating" + DELETING = "Deleting" + FAILED = "Failed" + +class PublicNetworkAccess(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Allow or deny public network access for AKS. + """ + + #: Inbound/Outbound to the managedCluster is allowed. + ENABLED = "Enabled" + #: Inbound traffic to managedCluster is disabled, traffic from managedCluster is allowed. + DISABLED = "Disabled" + #: Inbound/Outbound traffic is managed by Microsoft.Network/NetworkSecurityPerimeters. + SECURED_BY_PERIMETER = "SecuredByPerimeter" + +class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """For more information see `use managed identities in AKS + `_. + """ + + #: Use an implicitly created system assigned managed identity to manage cluster resources. Master + #: components in the control plane such as kube-controller-manager will use the system assigned + #: managed identity to manipulate Azure resources. + SYSTEM_ASSIGNED = "SystemAssigned" + #: Use a user-specified identity to manage cluster resources. Master components in the control + #: plane such as kube-controller-manager will use the specified user assigned managed identity to + #: manipulate Azure resources. + USER_ASSIGNED = "UserAssigned" + #: Do not use a managed identity for the Managed Cluster, service principal will be used instead. + NONE = "None" + +class ScaleDownMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Describes how VMs are added to or removed from Agent Pools. See `billing states + `_. + """ + + #: Create new instances during scale up and remove instances during scale down. + DELETE = "Delete" + #: Attempt to start deallocated instances (if they exist) during scale up and deallocate instances + #: during scale down. + DEALLOCATE = "Deallocate" + +class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The eviction policy specifies what to do with the VM when it is evicted. The default is Delete. + For more information about eviction see `spot VMs + `_. + """ + + #: Nodes in the underlying Scale Set of the node pool are deleted when they're evicted. + DELETE = "Delete" + #: Nodes in the underlying Scale Set of the node pool are set to the stopped-deallocated state + #: upon eviction. Nodes in the stopped-deallocated state count against your compute quota and can + #: cause issues with cluster scaling or upgrading. + DEALLOCATE = "Deallocate" + +class ScaleSetPriority(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The Virtual Machine Scale Set priority. + """ + + #: Spot priority VMs will be used. There is no SLA for spot nodes. See `spot on AKS + #: `_ for more information. + SPOT = "Spot" + #: Regular VMs will be used. + REGULAR = "Regular" + +class SnapshotType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of a snapshot. The default is NodePool. + """ + + #: The snapshot is a snapshot of a node pool. + NODE_POOL = "NodePool" + #: The snapshot is a snapshot of a managed cluster. + MANAGED_CLUSTER = "ManagedCluster" + +class TrustedAccessRoleBindingProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The current provisioning state of trusted access role binding. + """ + + SUCCEEDED = "Succeeded" + FAILED = "Failed" + UPDATING = "Updating" + DELETING = "Deleting" + +class UpdateMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Each update mode level is a superset of the lower levels. Off`_. + """ + + #: Automatically upgrade the cluster to the latest supported patch release on the latest supported + #: minor version. In cases where the cluster is at a version of Kubernetes that is at an N-2 minor + #: version where N is the latest supported minor version, the cluster first upgrades to the latest + #: supported patch version on N-1 minor version. For example, if a cluster is running version + #: 1.17.7 and versions 1.17.9, 1.18.4, 1.18.6, and 1.19.1 are available, your cluster first is + #: upgraded to 1.18.6, then is upgraded to 1.19.1. + RAPID = "rapid" + #: Automatically upgrade the cluster to the latest supported patch release on minor version N-1, + #: where N is the latest supported minor version. For example, if a cluster is running version + #: 1.17.7 and versions 1.17.9, 1.18.4, 1.18.6, and 1.19.1 are available, your cluster is upgraded + #: to 1.18.6. + STABLE = "stable" + #: Automatically upgrade the cluster to the latest supported patch version when it becomes + #: available while keeping the minor version the same. For example, if a cluster is running + #: version 1.17.7 and versions 1.17.9, 1.18.4, 1.18.6, and 1.19.1 are available, your cluster is + #: upgraded to 1.17.9. + PATCH = "patch" + #: Automatically upgrade the node image to the latest version available. Microsoft provides + #: patches and new images for image nodes frequently (usually weekly), but your running nodes + #: won't get the new images unless you do a node image upgrade. Turning on the node-image channel + #: will automatically update your node images whenever a new version is available. + NODE_IMAGE = "node-image" + #: Disables auto-upgrades and keeps the cluster at its current version of Kubernetes. + NONE = "none" + +class WeekDay(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The weekday enum. + """ + + SUNDAY = "Sunday" + MONDAY = "Monday" + TUESDAY = "Tuesday" + WEDNESDAY = "Wednesday" + THURSDAY = "Thursday" + FRIDAY = "Friday" + SATURDAY = "Saturday" + +class WorkloadRuntime(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Determines the type of workload a node can run. + """ + + #: Nodes will use Kubelet to run standard OCI container workloads. + OCI_CONTAINER = "OCIContainer" + #: Nodes will use Krustlet to run WASM workloads using the WASI provider (Preview). + WASM_WASI = "WasmWasi" diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/models/_models_py3.py new file mode 100644 index 000000000000..bc9559b6dd19 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/models/_models_py3.py @@ -0,0 +1,7839 @@ +# coding=utf-8 +# pylint: disable=too-many-lines +# -------------------------------------------------------------------------- +# 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 datetime +from typing import Dict, List, Optional, TYPE_CHECKING, Union + +from ... import _serialization + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models + + +class SubResource(_serialization.Model): + """Reference to another subresource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: The name of the resource that is unique within a resource group. This name can be + used to access the resource. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super().__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class AgentPool(SubResource): # pylint: disable=too-many-instance-attributes + """Agent Pool. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: The name of the resource that is unique within a resource group. This name can be + used to access the resource. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar count: Number of agents (VMs) to host docker containers. Allowed values must be in the + range of 0 to 1000 (inclusive) for user pools and in the range of 1 to 1000 (inclusive) for + system pools. The default value is 1. + :vartype count: int + :ivar vm_size: VM size availability varies by region. If a node contains insufficient compute + resources (memory, cpu, etc) pods might fail to run correctly. For more details on restricted + VM sizes, see: https://docs.microsoft.com/azure/aks/quotas-skus-regions. + :vartype vm_size: str + :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine + in the master/agent pool. If you specify 0, it will apply the default osDisk size according to + the vmSize specified. + :vartype os_disk_size_gb: int + :ivar os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk + larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed + after creation. For more information see `Ephemeral OS + `_. Known values are: + "Managed" and "Ephemeral". + :vartype os_disk_type: str or + ~azure.mgmt.containerservice.v2022_07_02_preview.models.OSDiskType + :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data + root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". + :vartype kubelet_disk_type: str or + ~azure.mgmt.containerservice.v2022_07_02_preview.models.KubeletDiskType + :ivar workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer" and "WasmWasi". + :vartype workload_runtime: str or + ~azure.mgmt.containerservice.v2022_07_02_preview.models.WorkloadRuntime + :ivar message_of_the_day: A base64-encoded string which will be written to /etc/motd after + decoding. This allows customization of the message of the day for Linux nodes. It must not be + specified for Windows nodes. It must be a static string (i.e., will be printed raw and not be + executed as a script). + :vartype message_of_the_day: str + :ivar vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and used. + If no podSubnetID is specified, this applies to nodes and pods, otherwise it applies to just + nodes. This is of the form: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. + :vartype vnet_subnet_id: str + :ivar pod_subnet_id: If omitted, pod IPs are statically assigned on the node subnet (see + vnetSubnetID for more details). This is of the form: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. + :vartype pod_subnet_id: str + :ivar max_pods: The maximum number of pods that can run on a node. + :vartype max_pods: int + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". + :vartype os_type: str or ~azure.mgmt.containerservice.v2022_07_02_preview.models.OSType + :ivar os_sku: Specifies the OS SKU used by the agent pool. If not specified, the default is + Ubuntu if OSType=Linux or Windows2019 if OSType=Windows. And the default Windows OSSKU will be + changed to Windows2022 after Windows2019 is deprecated. Known values are: "Ubuntu", + "CBLMariner", "Windows2019", and "Windows2022". + :vartype os_sku: str or ~azure.mgmt.containerservice.v2022_07_02_preview.models.OSSKU + :ivar max_count: The maximum number of nodes for auto-scaling. + :vartype max_count: int + :ivar min_count: The minimum number of nodes for auto-scaling. + :vartype min_count: int + :ivar enable_auto_scaling: Whether to enable auto-scaler. + :vartype enable_auto_scaling: bool + :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it + defaults to Delete. Known values are: "Delete" and "Deallocate". + :vartype scale_down_mode: str or + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ScaleDownMode + :ivar type_properties_type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets" + and "AvailabilitySet". + :vartype type_properties_type: str or + ~azure.mgmt.containerservice.v2022_07_02_preview.models.AgentPoolType + :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional + information on agent pool restrictions and best practices, see: + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". + :vartype mode: str or ~azure.mgmt.containerservice.v2022_07_02_preview.models.AgentPoolMode + :ivar orchestrator_version: Both patch version and are + supported. When is specified, the latest supported patch version is chosen + automatically. Updating the agent pool with the same once it has been created + will not trigger an upgrade, even if a newer patch version is available. As a best practice, + you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node + pool version must have the same major version as the control plane. The node pool minor version + must be within two minor versions of the control plane version. The node pool version cannot be + greater than the control plane version. For more information see `upgrading a node pool + `_. + :vartype orchestrator_version: str + :ivar current_orchestrator_version: If orchestratorVersion was a fully specified version + , this field will be exactly equal to it. If orchestratorVersion was + , this field will contain the full version being used. + :vartype current_orchestrator_version: str + :ivar node_image_version: The version of node image. + :vartype node_image_version: str + :ivar upgrade_settings: Settings for upgrading the agentpool. + :vartype upgrade_settings: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.AgentPoolUpgradeSettings + :ivar provisioning_state: The current deployment or provisioning state. + :vartype provisioning_state: str + :ivar power_state: When an Agent Pool is first created it is initially Running. The Agent Pool + can be stopped by setting this field to Stopped. A stopped Agent Pool stops all of its VMs and + does not accrue billing charges. An Agent Pool can only be stopped if it is Running and + provisioning state is Succeeded. + :vartype power_state: ~azure.mgmt.containerservice.v2022_07_02_preview.models.PowerState + :ivar availability_zones: The list of Availability zones to use for nodes. This can only be + specified if the AgentPoolType property is 'VirtualMachineScaleSets'. + :vartype availability_zones: list[str] + :ivar enable_node_public_ip: Some scenarios may require nodes in a node pool to receive their + own dedicated public IP addresses. A common scenario is for gaming workloads, where a console + needs to make a direct connection to a cloud virtual machine to minimize hops. For more + information see `assigning a public IP per node + `_. + The default is false. + :vartype enable_node_public_ip: bool + :ivar enable_custom_ca_trust: When set to true, AKS deploys a daemonset and host services to + sync custom certificate authorities from a user-provided config map into node trust stores. + Defaults to false. + :vartype enable_custom_ca_trust: bool + :ivar node_public_ip_prefix_id: This is of the form: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. + :vartype node_public_ip_prefix_id: str + :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default + is 'Regular'. Known values are: "Spot" and "Regular". + :vartype scale_set_priority: str or + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ScaleSetPriority + :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". + :vartype scale_set_eviction_policy: str or + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ScaleSetEvictionPolicy + :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which + indicates the willingness to pay any on-demand price. For more details on spot pricing, see + `spot VMs pricing `_. + :vartype spot_max_price: float + :ivar tags: The tags to be persisted on the agent pool virtual machine scale set. + :vartype tags: dict[str, str] + :ivar node_labels: The node labels to be persisted across all nodes in agent pool. + :vartype node_labels: dict[str, str] + :ivar node_taints: The taints added to new nodes during node pool create and scale. For + example, key=value:NoSchedule. + :vartype node_taints: list[str] + :ivar proximity_placement_group_id: The ID for Proximity Placement Group. + :vartype proximity_placement_group_id: str + :ivar kubelet_config: The Kubelet configuration on the agent pool nodes. + :vartype kubelet_config: ~azure.mgmt.containerservice.v2022_07_02_preview.models.KubeletConfig + :ivar linux_os_config: The OS configuration of Linux agent nodes. + :vartype linux_os_config: ~azure.mgmt.containerservice.v2022_07_02_preview.models.LinuxOSConfig + :ivar enable_encryption_at_host: This is only supported on certain VM sizes and in certain + Azure regions. For more information, see: + https://docs.microsoft.com/azure/aks/enable-host-encryption. + :vartype enable_encryption_at_host: bool + :ivar enable_ultra_ssd: Whether to enable UltraSSD. + :vartype enable_ultra_ssd: bool + :ivar enable_fips: See `Add a FIPS-enabled node pool + `_ + for more details. + :vartype enable_fips: bool + :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". + :vartype gpu_instance_profile: str or + ~azure.mgmt.containerservice.v2022_07_02_preview.models.GPUInstanceProfile + :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the node pool + will be created/upgraded using a snapshot. + :vartype creation_data: ~azure.mgmt.containerservice.v2022_07_02_preview.models.CreationData + :ivar capacity_reservation_group_id: AKS will associate the specified agent pool with the + Capacity Reservation Group. + :vartype capacity_reservation_group_id: str + :ivar host_group_id: This is of the form: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}. + For more information see `Azure dedicated hosts + `_. + :vartype host_group_id: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'os_disk_size_gb': {'maximum': 2048, 'minimum': 0}, + 'current_orchestrator_version': {'readonly': True}, + 'node_image_version': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "count": {"key": "properties.count", "type": "int"}, + "vm_size": {"key": "properties.vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "properties.osDiskSizeGB", "type": "int"}, + "os_disk_type": {"key": "properties.osDiskType", "type": "str"}, + "kubelet_disk_type": {"key": "properties.kubeletDiskType", "type": "str"}, + "workload_runtime": {"key": "properties.workloadRuntime", "type": "str"}, + "message_of_the_day": {"key": "properties.messageOfTheDay", "type": "str"}, + "vnet_subnet_id": {"key": "properties.vnetSubnetID", "type": "str"}, + "pod_subnet_id": {"key": "properties.podSubnetID", "type": "str"}, + "max_pods": {"key": "properties.maxPods", "type": "int"}, + "os_type": {"key": "properties.osType", "type": "str"}, + "os_sku": {"key": "properties.osSKU", "type": "str"}, + "max_count": {"key": "properties.maxCount", "type": "int"}, + "min_count": {"key": "properties.minCount", "type": "int"}, + "enable_auto_scaling": {"key": "properties.enableAutoScaling", "type": "bool"}, + "scale_down_mode": {"key": "properties.scaleDownMode", "type": "str"}, + "type_properties_type": {"key": "properties.type", "type": "str"}, + "mode": {"key": "properties.mode", "type": "str"}, + "orchestrator_version": {"key": "properties.orchestratorVersion", "type": "str"}, + "current_orchestrator_version": {"key": "properties.currentOrchestratorVersion", "type": "str"}, + "node_image_version": {"key": "properties.nodeImageVersion", "type": "str"}, + "upgrade_settings": {"key": "properties.upgradeSettings", "type": "AgentPoolUpgradeSettings"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "power_state": {"key": "properties.powerState", "type": "PowerState"}, + "availability_zones": {"key": "properties.availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "properties.enableNodePublicIP", "type": "bool"}, + "enable_custom_ca_trust": {"key": "properties.enableCustomCATrust", "type": "bool"}, + "node_public_ip_prefix_id": {"key": "properties.nodePublicIPPrefixID", "type": "str"}, + "scale_set_priority": {"key": "properties.scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "properties.scaleSetEvictionPolicy", "type": "str"}, + "spot_max_price": {"key": "properties.spotMaxPrice", "type": "float"}, + "tags": {"key": "properties.tags", "type": "{str}"}, + "node_labels": {"key": "properties.nodeLabels", "type": "{str}"}, + "node_taints": {"key": "properties.nodeTaints", "type": "[str]"}, + "proximity_placement_group_id": {"key": "properties.proximityPlacementGroupID", "type": "str"}, + "kubelet_config": {"key": "properties.kubeletConfig", "type": "KubeletConfig"}, + "linux_os_config": {"key": "properties.linuxOSConfig", "type": "LinuxOSConfig"}, + "enable_encryption_at_host": {"key": "properties.enableEncryptionAtHost", "type": "bool"}, + "enable_ultra_ssd": {"key": "properties.enableUltraSSD", "type": "bool"}, + "enable_fips": {"key": "properties.enableFIPS", "type": "bool"}, + "gpu_instance_profile": {"key": "properties.gpuInstanceProfile", "type": "str"}, + "creation_data": {"key": "properties.creationData", "type": "CreationData"}, + "capacity_reservation_group_id": {"key": "properties.capacityReservationGroupID", "type": "str"}, + "host_group_id": {"key": "properties.hostGroupID", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals + self, + *, + count: Optional[int] = None, + vm_size: Optional[str] = None, + os_disk_size_gb: Optional[int] = None, + os_disk_type: Optional[Union[str, "_models.OSDiskType"]] = None, + kubelet_disk_type: Optional[Union[str, "_models.KubeletDiskType"]] = None, + workload_runtime: Optional[Union[str, "_models.WorkloadRuntime"]] = None, + message_of_the_day: Optional[str] = None, + vnet_subnet_id: Optional[str] = None, + pod_subnet_id: Optional[str] = None, + max_pods: Optional[int] = None, + os_type: Union[str, "_models.OSType"] = "Linux", + os_sku: Optional[Union[str, "_models.OSSKU"]] = None, + max_count: Optional[int] = None, + min_count: Optional[int] = None, + enable_auto_scaling: Optional[bool] = None, + scale_down_mode: Optional[Union[str, "_models.ScaleDownMode"]] = None, + type_properties_type: Optional[Union[str, "_models.AgentPoolType"]] = None, + mode: Optional[Union[str, "_models.AgentPoolMode"]] = None, + orchestrator_version: Optional[str] = None, + upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, + power_state: Optional["_models.PowerState"] = None, + availability_zones: Optional[List[str]] = None, + enable_node_public_ip: Optional[bool] = None, + enable_custom_ca_trust: Optional[bool] = None, + node_public_ip_prefix_id: Optional[str] = None, + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", + spot_max_price: float = -1, + tags: Optional[Dict[str, str]] = None, + node_labels: Optional[Dict[str, str]] = None, + node_taints: Optional[List[str]] = None, + proximity_placement_group_id: Optional[str] = None, + kubelet_config: Optional["_models.KubeletConfig"] = None, + linux_os_config: Optional["_models.LinuxOSConfig"] = None, + enable_encryption_at_host: Optional[bool] = None, + enable_ultra_ssd: Optional[bool] = None, + enable_fips: Optional[bool] = None, + gpu_instance_profile: Optional[Union[str, "_models.GPUInstanceProfile"]] = None, + creation_data: Optional["_models.CreationData"] = None, + capacity_reservation_group_id: Optional[str] = None, + host_group_id: Optional[str] = None, + **kwargs + ): + """ + :keyword count: Number of agents (VMs) to host docker containers. Allowed values must be in the + range of 0 to 1000 (inclusive) for user pools and in the range of 1 to 1000 (inclusive) for + system pools. The default value is 1. + :paramtype count: int + :keyword vm_size: VM size availability varies by region. If a node contains insufficient + compute resources (memory, cpu, etc) pods might fail to run correctly. For more details on + restricted VM sizes, see: https://docs.microsoft.com/azure/aks/quotas-skus-regions. + :paramtype vm_size: str + :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every + machine in the master/agent pool. If you specify 0, it will apply the default osDisk size + according to the vmSize specified. + :paramtype os_disk_size_gb: int + :keyword os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk + larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed + after creation. For more information see `Ephemeral OS + `_. Known values are: + "Managed" and "Ephemeral". + :paramtype os_disk_type: str or + ~azure.mgmt.containerservice.v2022_07_02_preview.models.OSDiskType + :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime + data root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". + :paramtype kubelet_disk_type: str or + ~azure.mgmt.containerservice.v2022_07_02_preview.models.KubeletDiskType + :keyword workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer" and "WasmWasi". + :paramtype workload_runtime: str or + ~azure.mgmt.containerservice.v2022_07_02_preview.models.WorkloadRuntime + :keyword message_of_the_day: A base64-encoded string which will be written to /etc/motd after + decoding. This allows customization of the message of the day for Linux nodes. It must not be + specified for Windows nodes. It must be a static string (i.e., will be printed raw and not be + executed as a script). + :paramtype message_of_the_day: str + :keyword vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and + used. If no podSubnetID is specified, this applies to nodes and pods, otherwise it applies to + just nodes. This is of the form: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. + :paramtype vnet_subnet_id: str + :keyword pod_subnet_id: If omitted, pod IPs are statically assigned on the node subnet (see + vnetSubnetID for more details). This is of the form: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. + :paramtype pod_subnet_id: str + :keyword max_pods: The maximum number of pods that can run on a node. + :paramtype max_pods: int + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". + :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_07_02_preview.models.OSType + :keyword os_sku: Specifies the OS SKU used by the agent pool. If not specified, the default is + Ubuntu if OSType=Linux or Windows2019 if OSType=Windows. And the default Windows OSSKU will be + changed to Windows2022 after Windows2019 is deprecated. Known values are: "Ubuntu", + "CBLMariner", "Windows2019", and "Windows2022". + :paramtype os_sku: str or ~azure.mgmt.containerservice.v2022_07_02_preview.models.OSSKU + :keyword max_count: The maximum number of nodes for auto-scaling. + :paramtype max_count: int + :keyword min_count: The minimum number of nodes for auto-scaling. + :paramtype min_count: int + :keyword enable_auto_scaling: Whether to enable auto-scaler. + :paramtype enable_auto_scaling: bool + :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, + it defaults to Delete. Known values are: "Delete" and "Deallocate". + :paramtype scale_down_mode: str or + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ScaleDownMode + :keyword type_properties_type: The type of Agent Pool. Known values are: + "VirtualMachineScaleSets" and "AvailabilitySet". + :paramtype type_properties_type: str or + ~azure.mgmt.containerservice.v2022_07_02_preview.models.AgentPoolType + :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For + additional information on agent pool restrictions and best practices, see: + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". + :paramtype mode: str or ~azure.mgmt.containerservice.v2022_07_02_preview.models.AgentPoolMode + :keyword orchestrator_version: Both patch version and are + supported. When is specified, the latest supported patch version is chosen + automatically. Updating the agent pool with the same once it has been created + will not trigger an upgrade, even if a newer patch version is available. As a best practice, + you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node + pool version must have the same major version as the control plane. The node pool minor version + must be within two minor versions of the control plane version. The node pool version cannot be + greater than the control plane version. For more information see `upgrading a node pool + `_. + :paramtype orchestrator_version: str + :keyword upgrade_settings: Settings for upgrading the agentpool. + :paramtype upgrade_settings: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.AgentPoolUpgradeSettings + :keyword power_state: When an Agent Pool is first created it is initially Running. The Agent + Pool can be stopped by setting this field to Stopped. A stopped Agent Pool stops all of its VMs + and does not accrue billing charges. An Agent Pool can only be stopped if it is Running and + provisioning state is Succeeded. + :paramtype power_state: ~azure.mgmt.containerservice.v2022_07_02_preview.models.PowerState + :keyword availability_zones: The list of Availability zones to use for nodes. This can only be + specified if the AgentPoolType property is 'VirtualMachineScaleSets'. + :paramtype availability_zones: list[str] + :keyword enable_node_public_ip: Some scenarios may require nodes in a node pool to receive + their own dedicated public IP addresses. A common scenario is for gaming workloads, where a + console needs to make a direct connection to a cloud virtual machine to minimize hops. For more + information see `assigning a public IP per node + `_. + The default is false. + :paramtype enable_node_public_ip: bool + :keyword enable_custom_ca_trust: When set to true, AKS deploys a daemonset and host services to + sync custom certificate authorities from a user-provided config map into node trust stores. + Defaults to false. + :paramtype enable_custom_ca_trust: bool + :keyword node_public_ip_prefix_id: This is of the form: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. + :paramtype node_public_ip_prefix_id: str + :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the + default is 'Regular'. Known values are: "Spot" and "Regular". + :paramtype scale_set_priority: str or + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ScaleSetPriority + :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". + :paramtype scale_set_eviction_policy: str or + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ScaleSetEvictionPolicy + :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which + indicates the willingness to pay any on-demand price. For more details on spot pricing, see + `spot VMs pricing `_. + :paramtype spot_max_price: float + :keyword tags: The tags to be persisted on the agent pool virtual machine scale set. + :paramtype tags: dict[str, str] + :keyword node_labels: The node labels to be persisted across all nodes in agent pool. + :paramtype node_labels: dict[str, str] + :keyword node_taints: The taints added to new nodes during node pool create and scale. For + example, key=value:NoSchedule. + :paramtype node_taints: list[str] + :keyword proximity_placement_group_id: The ID for Proximity Placement Group. + :paramtype proximity_placement_group_id: str + :keyword kubelet_config: The Kubelet configuration on the agent pool nodes. + :paramtype kubelet_config: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.KubeletConfig + :keyword linux_os_config: The OS configuration of Linux agent nodes. + :paramtype linux_os_config: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.LinuxOSConfig + :keyword enable_encryption_at_host: This is only supported on certain VM sizes and in certain + Azure regions. For more information, see: + https://docs.microsoft.com/azure/aks/enable-host-encryption. + :paramtype enable_encryption_at_host: bool + :keyword enable_ultra_ssd: Whether to enable UltraSSD. + :paramtype enable_ultra_ssd: bool + :keyword enable_fips: See `Add a FIPS-enabled node pool + `_ + for more details. + :paramtype enable_fips: bool + :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and + "MIG7g". + :paramtype gpu_instance_profile: str or + ~azure.mgmt.containerservice.v2022_07_02_preview.models.GPUInstanceProfile + :keyword creation_data: CreationData to be used to specify the source Snapshot ID if the node + pool will be created/upgraded using a snapshot. + :paramtype creation_data: ~azure.mgmt.containerservice.v2022_07_02_preview.models.CreationData + :keyword capacity_reservation_group_id: AKS will associate the specified agent pool with the + Capacity Reservation Group. + :paramtype capacity_reservation_group_id: str + :keyword host_group_id: This is of the form: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}. + For more information see `Azure dedicated hosts + `_. + :paramtype host_group_id: str + """ + super().__init__(**kwargs) + self.count = count + self.vm_size = vm_size + self.os_disk_size_gb = os_disk_size_gb + self.os_disk_type = os_disk_type + self.kubelet_disk_type = kubelet_disk_type + self.workload_runtime = workload_runtime + self.message_of_the_day = message_of_the_day + self.vnet_subnet_id = vnet_subnet_id + self.pod_subnet_id = pod_subnet_id + self.max_pods = max_pods + self.os_type = os_type + self.os_sku = os_sku + self.max_count = max_count + self.min_count = min_count + self.enable_auto_scaling = enable_auto_scaling + self.scale_down_mode = scale_down_mode + self.type_properties_type = type_properties_type + self.mode = mode + self.orchestrator_version = orchestrator_version + self.current_orchestrator_version = None + self.node_image_version = None + self.upgrade_settings = upgrade_settings + self.provisioning_state = None + self.power_state = power_state + self.availability_zones = availability_zones + self.enable_node_public_ip = enable_node_public_ip + self.enable_custom_ca_trust = enable_custom_ca_trust + self.node_public_ip_prefix_id = node_public_ip_prefix_id + self.scale_set_priority = scale_set_priority + self.scale_set_eviction_policy = scale_set_eviction_policy + self.spot_max_price = spot_max_price + self.tags = tags + self.node_labels = node_labels + self.node_taints = node_taints + self.proximity_placement_group_id = proximity_placement_group_id + self.kubelet_config = kubelet_config + self.linux_os_config = linux_os_config + self.enable_encryption_at_host = enable_encryption_at_host + self.enable_ultra_ssd = enable_ultra_ssd + self.enable_fips = enable_fips + self.gpu_instance_profile = gpu_instance_profile + self.creation_data = creation_data + self.capacity_reservation_group_id = capacity_reservation_group_id + self.host_group_id = host_group_id + + +class AgentPoolAvailableVersions(_serialization.Model): + """The list of available versions for an agent pool. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The ID of the agent pool version list. + :vartype id: str + :ivar name: The name of the agent pool version list. + :vartype name: str + :ivar type: Type of the agent pool version list. + :vartype type: str + :ivar agent_pool_versions: List of versions available for agent pool. + :vartype agent_pool_versions: + list[~azure.mgmt.containerservice.v2022_07_02_preview.models.AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "agent_pool_versions": {"key": "properties.agentPoolVersions", "type": "[AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem]"}, + } + + def __init__( + self, + *, + agent_pool_versions: Optional[List["_models.AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem"]] = None, + **kwargs + ): + """ + :keyword agent_pool_versions: List of versions available for agent pool. + :paramtype agent_pool_versions: + list[~azure.mgmt.containerservice.v2022_07_02_preview.models.AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem] + """ + super().__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.agent_pool_versions = agent_pool_versions + + +class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(_serialization.Model): + """AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem. + + :ivar default: Whether this version is the default agent pool version. + :vartype default: bool + :ivar kubernetes_version: The Kubernetes version (major.minor.patch). + :vartype kubernetes_version: str + :ivar is_preview: Whether Kubernetes version is currently in preview. + :vartype is_preview: bool + """ + + _attribute_map = { + "default": {"key": "default", "type": "bool"}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, + } + + def __init__( + self, + *, + default: Optional[bool] = None, + kubernetes_version: Optional[str] = None, + is_preview: Optional[bool] = None, + **kwargs + ): + """ + :keyword default: Whether this version is the default agent pool version. + :paramtype default: bool + :keyword kubernetes_version: The Kubernetes version (major.minor.patch). + :paramtype kubernetes_version: str + :keyword is_preview: Whether Kubernetes version is currently in preview. + :paramtype is_preview: bool + """ + super().__init__(**kwargs) + self.default = default + self.kubernetes_version = kubernetes_version + self.is_preview = is_preview + + +class AgentPoolListResult(_serialization.Model): + """The response from the List Agent Pools operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The list of agent pools. + :vartype value: list[~azure.mgmt.containerservice.v2022_07_02_preview.models.AgentPool] + :ivar next_link: The URL to get the next set of agent pool results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[AgentPool]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.AgentPool"]] = None, + **kwargs + ): + """ + :keyword value: The list of agent pools. + :paramtype value: list[~azure.mgmt.containerservice.v2022_07_02_preview.models.AgentPool] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class AgentPoolUpgradeProfile(_serialization.Model): + """The list of available upgrades for an agent pool. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The ID of the agent pool upgrade profile. + :vartype id: str + :ivar name: The name of the agent pool upgrade profile. + :vartype name: str + :ivar type: The type of the agent pool upgrade profile. + :vartype type: str + :ivar kubernetes_version: The Kubernetes version (major.minor.patch). Required. + :vartype kubernetes_version: str + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". + :vartype os_type: str or ~azure.mgmt.containerservice.v2022_07_02_preview.models.OSType + :ivar upgrades: List of orchestrator types and versions available for upgrade. + :vartype upgrades: + list[~azure.mgmt.containerservice.v2022_07_02_preview.models.AgentPoolUpgradeProfilePropertiesUpgradesItem] + :ivar latest_node_image_version: The latest AKS supported node image version. + :vartype latest_node_image_version: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'kubernetes_version': {'required': True}, + 'os_type': {'required': True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "os_type": {"key": "properties.osType", "type": "str"}, + "upgrades": {"key": "properties.upgrades", "type": "[AgentPoolUpgradeProfilePropertiesUpgradesItem]"}, + "latest_node_image_version": {"key": "properties.latestNodeImageVersion", "type": "str"}, + } + + def __init__( + self, + *, + kubernetes_version: str, + os_type: Union[str, "_models.OSType"] = "Linux", + upgrades: Optional[List["_models.AgentPoolUpgradeProfilePropertiesUpgradesItem"]] = None, + latest_node_image_version: Optional[str] = None, + **kwargs + ): + """ + :keyword kubernetes_version: The Kubernetes version (major.minor.patch). Required. + :paramtype kubernetes_version: str + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". + :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_07_02_preview.models.OSType + :keyword upgrades: List of orchestrator types and versions available for upgrade. + :paramtype upgrades: + list[~azure.mgmt.containerservice.v2022_07_02_preview.models.AgentPoolUpgradeProfilePropertiesUpgradesItem] + :keyword latest_node_image_version: The latest AKS supported node image version. + :paramtype latest_node_image_version: str + """ + super().__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.kubernetes_version = kubernetes_version + self.os_type = os_type + self.upgrades = upgrades + self.latest_node_image_version = latest_node_image_version + + +class AgentPoolUpgradeProfilePropertiesUpgradesItem(_serialization.Model): + """AgentPoolUpgradeProfilePropertiesUpgradesItem. + + :ivar kubernetes_version: The Kubernetes version (major.minor.patch). + :vartype kubernetes_version: str + :ivar is_preview: Whether the Kubernetes version is currently in preview. + :vartype is_preview: bool + """ + + _attribute_map = { + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, + } + + def __init__( + self, + *, + kubernetes_version: Optional[str] = None, + is_preview: Optional[bool] = None, + **kwargs + ): + """ + :keyword kubernetes_version: The Kubernetes version (major.minor.patch). + :paramtype kubernetes_version: str + :keyword is_preview: Whether the Kubernetes version is currently in preview. + :paramtype is_preview: bool + """ + super().__init__(**kwargs) + self.kubernetes_version = kubernetes_version + self.is_preview = is_preview + + +class AgentPoolUpgradeSettings(_serialization.Model): + """Settings for upgrading an agentpool. + + :ivar max_surge: This can either be set to an integer (e.g. '5') or a percentage (e.g. '50%'). + If a percentage is specified, it is the percentage of the total agent pool size at the time of + the upgrade. For percentages, fractional nodes are rounded up. If not specified, the default is + 1. For more information, including best practices, see: + https://docs.microsoft.com/azure/aks/upgrade-cluster#customize-node-surge-upgrade. + :vartype max_surge: str + """ + + _attribute_map = { + "max_surge": {"key": "maxSurge", "type": "str"}, + } + + def __init__( + self, + *, + max_surge: Optional[str] = None, + **kwargs + ): + """ + :keyword max_surge: This can either be set to an integer (e.g. '5') or a percentage (e.g. + '50%'). If a percentage is specified, it is the percentage of the total agent pool size at the + time of the upgrade. For percentages, fractional nodes are rounded up. If not specified, the + default is 1. For more information, including best practices, see: + https://docs.microsoft.com/azure/aks/upgrade-cluster#customize-node-surge-upgrade. + :paramtype max_surge: str + """ + super().__init__(**kwargs) + self.max_surge = max_surge + + +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}. + :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.containerservice.v2022_07_02_preview.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 + ): + """ + """ + super().__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.system_data = None + + +class AzureEntityResource(Resource): + """The resource model definition for an Azure Resource Manager resource with an etag. + + 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}. + :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.containerservice.v2022_07_02_preview.models.SystemData + :ivar etag: Resource Etag. + :vartype etag: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'etag': {'readonly': True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "etag": {"key": "etag", "type": "str"}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super().__init__(**kwargs) + self.etag = None + + +class AzureKeyVaultKms(_serialization.Model): + """Azure Key Vault key management service settings for the security profile. + + :ivar enabled: Whether to enable Azure Key Vault key management service. The default is false. + :vartype enabled: bool + :ivar key_id: Identifier of Azure Key Vault key. See `key identifier format + `_ + for more details. When Azure Key Vault key management service is enabled, this field is + required and must be a valid key identifier. When Azure Key Vault key management service is + disabled, leave the field empty. + :vartype key_id: str + :ivar key_vault_network_access: Network access of key vault. The possible values are ``Public`` + and ``Private``. ``Public`` means the key vault allows public access from all networks. + ``Private`` means the key vault disables public access and enables private link. The default + value is ``Public``. Known values are: "Public" and "Private". + :vartype key_vault_network_access: str or + ~azure.mgmt.containerservice.v2022_07_02_preview.models.KeyVaultNetworkAccessTypes + :ivar key_vault_resource_id: Resource ID of key vault. When keyVaultNetworkAccess is + ``Private``\ , this field is required and must be a valid resource ID. When + keyVaultNetworkAccess is ``Public``\ , leave the field empty. + :vartype key_vault_resource_id: str + """ + + _attribute_map = { + "enabled": {"key": "enabled", "type": "bool"}, + "key_id": {"key": "keyId", "type": "str"}, + "key_vault_network_access": {"key": "keyVaultNetworkAccess", "type": "str"}, + "key_vault_resource_id": {"key": "keyVaultResourceId", "type": "str"}, + } + + def __init__( + self, + *, + enabled: Optional[bool] = None, + key_id: Optional[str] = None, + key_vault_network_access: Union[str, "_models.KeyVaultNetworkAccessTypes"] = "Public", + key_vault_resource_id: Optional[str] = None, + **kwargs + ): + """ + :keyword enabled: Whether to enable Azure Key Vault key management service. The default is + false. + :paramtype enabled: bool + :keyword key_id: Identifier of Azure Key Vault key. See `key identifier format + `_ + for more details. When Azure Key Vault key management service is enabled, this field is + required and must be a valid key identifier. When Azure Key Vault key management service is + disabled, leave the field empty. + :paramtype key_id: str + :keyword key_vault_network_access: Network access of key vault. The possible values are + ``Public`` and ``Private``. ``Public`` means the key vault allows public access from all + networks. ``Private`` means the key vault disables public access and enables private link. The + default value is ``Public``. Known values are: "Public" and "Private". + :paramtype key_vault_network_access: str or + ~azure.mgmt.containerservice.v2022_07_02_preview.models.KeyVaultNetworkAccessTypes + :keyword key_vault_resource_id: Resource ID of key vault. When keyVaultNetworkAccess is + ``Private``\ , this field is required and must be a valid resource ID. When + keyVaultNetworkAccess is ``Public``\ , leave the field empty. + :paramtype key_vault_resource_id: str + """ + super().__init__(**kwargs) + self.enabled = enabled + self.key_id = key_id + self.key_vault_network_access = key_vault_network_access + self.key_vault_resource_id = key_vault_resource_id + + +class CloudErrorBody(_serialization.Model): + """An error response from the Container service. + + :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. + :vartype code: str + :ivar message: A message describing the error, intended to be suitable for display in a user + interface. + :vartype message: str + :ivar target: The target of the particular error. For example, the name of the property in + error. + :vartype target: str + :ivar details: A list of additional details about the error. + :vartype details: list[~azure.mgmt.containerservice.v2022_07_02_preview.models.CloudErrorBody] + """ + + _attribute_map = { + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[CloudErrorBody]"}, + } + + def __init__( + self, + *, + code: Optional[str] = None, + message: Optional[str] = None, + target: Optional[str] = None, + details: Optional[List["_models.CloudErrorBody"]] = None, + **kwargs + ): + """ + :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. + :paramtype code: str + :keyword message: A message describing the error, intended to be suitable for display in a user + interface. + :paramtype message: str + :keyword target: The target of the particular error. For example, the name of the property in + error. + :paramtype target: str + :keyword details: A list of additional details about the error. + :paramtype details: + list[~azure.mgmt.containerservice.v2022_07_02_preview.models.CloudErrorBody] + """ + super().__init__(**kwargs) + self.code = code + self.message = message + self.target = target + self.details = details + + +class ContainerServiceDiagnosticsProfile(_serialization.Model): + """Profile for diagnostics on the container service cluster. + + All required parameters must be populated in order to send to Azure. + + :ivar vm_diagnostics: Profile for diagnostics on the container service VMs. Required. + :vartype vm_diagnostics: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ContainerServiceVMDiagnostics + """ + + _validation = { + 'vm_diagnostics': {'required': True}, + } + + _attribute_map = { + "vm_diagnostics": {"key": "vmDiagnostics", "type": "ContainerServiceVMDiagnostics"}, + } + + def __init__( + self, + *, + vm_diagnostics: "_models.ContainerServiceVMDiagnostics", + **kwargs + ): + """ + :keyword vm_diagnostics: Profile for diagnostics on the container service VMs. Required. + :paramtype vm_diagnostics: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ContainerServiceVMDiagnostics + """ + super().__init__(**kwargs) + self.vm_diagnostics = vm_diagnostics + + +class ContainerServiceLinuxProfile(_serialization.Model): + """Profile for Linux VMs in the container service cluster. + + All required parameters must be populated in order to send to Azure. + + :ivar admin_username: The administrator username to use for Linux VMs. Required. + :vartype admin_username: str + :ivar ssh: The SSH configuration for Linux-based VMs running on Azure. Required. + :vartype ssh: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ContainerServiceSshConfiguration + """ + + _validation = { + 'admin_username': {'required': True, 'pattern': r'^[A-Za-z][-A-Za-z0-9_]*$'}, + 'ssh': {'required': True}, + } + + _attribute_map = { + "admin_username": {"key": "adminUsername", "type": "str"}, + "ssh": {"key": "ssh", "type": "ContainerServiceSshConfiguration"}, + } + + def __init__( + self, + *, + admin_username: str, + ssh: "_models.ContainerServiceSshConfiguration", + **kwargs + ): + """ + :keyword admin_username: The administrator username to use for Linux VMs. Required. + :paramtype admin_username: str + :keyword ssh: The SSH configuration for Linux-based VMs running on Azure. Required. + :paramtype ssh: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ContainerServiceSshConfiguration + """ + super().__init__(**kwargs) + self.admin_username = admin_username + self.ssh = ssh + + +class ContainerServiceMasterProfile(_serialization.Model): + """Profile for the container service master. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar count: Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, + and 5. The default value is 1. Known values are: 1, 3, and 5. + :vartype count: int or ~azure.mgmt.containerservice.v2022_07_02_preview.models.Count + :ivar dns_prefix: DNS prefix to be used to create the FQDN for the master pool. Required. + :vartype dns_prefix: str + :ivar vm_size: Size of agent VMs. Required. Known values are: "Standard_A1", "Standard_A10", + "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", + "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", + "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", + "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", "Standard_B8ms", + "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", "Standard_D12", + "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", + "Standard_D13_v2_Promo", "Standard_D14", "Standard_D14_v2", "Standard_D14_v2_Promo", + "Standard_D15_v2", "Standard_D16_v3", "Standard_D16s_v3", "Standard_D1_v2", "Standard_D2", + "Standard_D2_v2", "Standard_D2_v2_Promo", "Standard_D2_v3", "Standard_D2s_v3", "Standard_D3", + "Standard_D32_v3", "Standard_D32s_v3", "Standard_D3_v2", "Standard_D3_v2_Promo", "Standard_D4", + "Standard_D4_v2", "Standard_D4_v2_Promo", "Standard_D4_v3", "Standard_D4s_v3", + "Standard_D5_v2", "Standard_D5_v2_Promo", "Standard_D64_v3", "Standard_D64s_v3", + "Standard_D8_v3", "Standard_D8s_v3", "Standard_DS1", "Standard_DS11", "Standard_DS11_v2", + "Standard_DS11_v2_Promo", "Standard_DS12", "Standard_DS12_v2", "Standard_DS12_v2_Promo", + "Standard_DS13", "Standard_DS13-2_v2", "Standard_DS13-4_v2", "Standard_DS13_v2", + "Standard_DS13_v2_Promo", "Standard_DS14", "Standard_DS14-4_v2", "Standard_DS14-8_v2", + "Standard_DS14_v2", "Standard_DS14_v2_Promo", "Standard_DS15_v2", "Standard_DS1_v2", + "Standard_DS2", "Standard_DS2_v2", "Standard_DS2_v2_Promo", "Standard_DS3", "Standard_DS3_v2", + "Standard_DS3_v2_Promo", "Standard_DS4", "Standard_DS4_v2", "Standard_DS4_v2_Promo", + "Standard_DS5_v2", "Standard_DS5_v2_Promo", "Standard_E16_v3", "Standard_E16s_v3", + "Standard_E2_v3", "Standard_E2s_v3", "Standard_E32-16s_v3", "Standard_E32-8s_v3", + "Standard_E32_v3", "Standard_E32s_v3", "Standard_E4_v3", "Standard_E4s_v3", + "Standard_E64-16s_v3", "Standard_E64-32s_v3", "Standard_E64_v3", "Standard_E64s_v3", + "Standard_E8_v3", "Standard_E8s_v3", "Standard_F1", "Standard_F16", "Standard_F16s", + "Standard_F16s_v2", "Standard_F1s", "Standard_F2", "Standard_F2s", "Standard_F2s_v2", + "Standard_F32s_v2", "Standard_F4", "Standard_F4s", "Standard_F4s_v2", "Standard_F64s_v2", + "Standard_F72s_v2", "Standard_F8", "Standard_F8s", "Standard_F8s_v2", "Standard_G1", + "Standard_G2", "Standard_G3", "Standard_G4", "Standard_G5", "Standard_GS1", "Standard_GS2", + "Standard_GS3", "Standard_GS4", "Standard_GS4-4", "Standard_GS4-8", "Standard_GS5", + "Standard_GS5-16", "Standard_GS5-8", "Standard_H16", "Standard_H16m", "Standard_H16mr", + "Standard_H16r", "Standard_H8", "Standard_H8m", "Standard_L16s", "Standard_L32s", + "Standard_L4s", "Standard_L8s", "Standard_M128-32ms", "Standard_M128-64ms", "Standard_M128ms", + "Standard_M128s", "Standard_M64-16ms", "Standard_M64-32ms", "Standard_M64ms", "Standard_M64s", + "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", + "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", + "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". + :vartype vm_size: str or + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ContainerServiceVMSizeTypes + :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine + in this master/agent pool. If you specify 0, it will apply the default osDisk size according to + the vmSize specified. + :vartype os_disk_size_gb: int + :ivar vnet_subnet_id: VNet SubnetID specifies the VNet's subnet identifier. + :vartype vnet_subnet_id: str + :ivar first_consecutive_static_ip: FirstConsecutiveStaticIP used to specify the first static ip + of masters. + :vartype first_consecutive_static_ip: str + :ivar storage_profile: Storage profile specifies what kind of storage used. Choose from + StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the + orchestrator choice. Known values are: "StorageAccount" and "ManagedDisks". + :vartype storage_profile: str or + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ContainerServiceStorageProfileTypes + :ivar fqdn: FQDN for the master pool. + :vartype fqdn: str + """ + + _validation = { + 'dns_prefix': {'required': True}, + 'vm_size': {'required': True}, + 'os_disk_size_gb': {'maximum': 2048, 'minimum': 0}, + 'fqdn': {'readonly': True}, + } + + _attribute_map = { + "count": {"key": "count", "type": "int"}, + "dns_prefix": {"key": "dnsPrefix", "type": "str"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "first_consecutive_static_ip": {"key": "firstConsecutiveStaticIP", "type": "str"}, + "storage_profile": {"key": "storageProfile", "type": "str"}, + "fqdn": {"key": "fqdn", "type": "str"}, + } + + def __init__( + self, + *, + dns_prefix: str, + vm_size: Union[str, "_models.ContainerServiceVMSizeTypes"], + count: Union[int, "_models.Count"] = 1, + os_disk_size_gb: Optional[int] = None, + vnet_subnet_id: Optional[str] = None, + first_consecutive_static_ip: str = "10.240.255.5", + storage_profile: Optional[Union[str, "_models.ContainerServiceStorageProfileTypes"]] = None, + **kwargs + ): + """ + :keyword count: Number of masters (VMs) in the container service cluster. Allowed values are 1, + 3, and 5. The default value is 1. Known values are: 1, 3, and 5. + :paramtype count: int or ~azure.mgmt.containerservice.v2022_07_02_preview.models.Count + :keyword dns_prefix: DNS prefix to be used to create the FQDN for the master pool. Required. + :paramtype dns_prefix: str + :keyword vm_size: Size of agent VMs. Required. Known values are: "Standard_A1", "Standard_A10", + "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", + "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", + "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", + "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", "Standard_B8ms", + "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", "Standard_D12", + "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", + "Standard_D13_v2_Promo", "Standard_D14", "Standard_D14_v2", "Standard_D14_v2_Promo", + "Standard_D15_v2", "Standard_D16_v3", "Standard_D16s_v3", "Standard_D1_v2", "Standard_D2", + "Standard_D2_v2", "Standard_D2_v2_Promo", "Standard_D2_v3", "Standard_D2s_v3", "Standard_D3", + "Standard_D32_v3", "Standard_D32s_v3", "Standard_D3_v2", "Standard_D3_v2_Promo", "Standard_D4", + "Standard_D4_v2", "Standard_D4_v2_Promo", "Standard_D4_v3", "Standard_D4s_v3", + "Standard_D5_v2", "Standard_D5_v2_Promo", "Standard_D64_v3", "Standard_D64s_v3", + "Standard_D8_v3", "Standard_D8s_v3", "Standard_DS1", "Standard_DS11", "Standard_DS11_v2", + "Standard_DS11_v2_Promo", "Standard_DS12", "Standard_DS12_v2", "Standard_DS12_v2_Promo", + "Standard_DS13", "Standard_DS13-2_v2", "Standard_DS13-4_v2", "Standard_DS13_v2", + "Standard_DS13_v2_Promo", "Standard_DS14", "Standard_DS14-4_v2", "Standard_DS14-8_v2", + "Standard_DS14_v2", "Standard_DS14_v2_Promo", "Standard_DS15_v2", "Standard_DS1_v2", + "Standard_DS2", "Standard_DS2_v2", "Standard_DS2_v2_Promo", "Standard_DS3", "Standard_DS3_v2", + "Standard_DS3_v2_Promo", "Standard_DS4", "Standard_DS4_v2", "Standard_DS4_v2_Promo", + "Standard_DS5_v2", "Standard_DS5_v2_Promo", "Standard_E16_v3", "Standard_E16s_v3", + "Standard_E2_v3", "Standard_E2s_v3", "Standard_E32-16s_v3", "Standard_E32-8s_v3", + "Standard_E32_v3", "Standard_E32s_v3", "Standard_E4_v3", "Standard_E4s_v3", + "Standard_E64-16s_v3", "Standard_E64-32s_v3", "Standard_E64_v3", "Standard_E64s_v3", + "Standard_E8_v3", "Standard_E8s_v3", "Standard_F1", "Standard_F16", "Standard_F16s", + "Standard_F16s_v2", "Standard_F1s", "Standard_F2", "Standard_F2s", "Standard_F2s_v2", + "Standard_F32s_v2", "Standard_F4", "Standard_F4s", "Standard_F4s_v2", "Standard_F64s_v2", + "Standard_F72s_v2", "Standard_F8", "Standard_F8s", "Standard_F8s_v2", "Standard_G1", + "Standard_G2", "Standard_G3", "Standard_G4", "Standard_G5", "Standard_GS1", "Standard_GS2", + "Standard_GS3", "Standard_GS4", "Standard_GS4-4", "Standard_GS4-8", "Standard_GS5", + "Standard_GS5-16", "Standard_GS5-8", "Standard_H16", "Standard_H16m", "Standard_H16mr", + "Standard_H16r", "Standard_H8", "Standard_H8m", "Standard_L16s", "Standard_L32s", + "Standard_L4s", "Standard_L8s", "Standard_M128-32ms", "Standard_M128-64ms", "Standard_M128ms", + "Standard_M128s", "Standard_M64-16ms", "Standard_M64-32ms", "Standard_M64ms", "Standard_M64s", + "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", + "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", + "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", and "Standard_NV6". + :paramtype vm_size: str or + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ContainerServiceVMSizeTypes + :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every + machine in this master/agent pool. If you specify 0, it will apply the default osDisk size + according to the vmSize specified. + :paramtype os_disk_size_gb: int + :keyword vnet_subnet_id: VNet SubnetID specifies the VNet's subnet identifier. + :paramtype vnet_subnet_id: str + :keyword first_consecutive_static_ip: FirstConsecutiveStaticIP used to specify the first static + ip of masters. + :paramtype first_consecutive_static_ip: str + :keyword storage_profile: Storage profile specifies what kind of storage used. Choose from + StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the + orchestrator choice. Known values are: "StorageAccount" and "ManagedDisks". + :paramtype storage_profile: str or + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ContainerServiceStorageProfileTypes + """ + super().__init__(**kwargs) + self.count = count + self.dns_prefix = dns_prefix + self.vm_size = vm_size + self.os_disk_size_gb = os_disk_size_gb + self.vnet_subnet_id = vnet_subnet_id + self.first_consecutive_static_ip = first_consecutive_static_ip + self.storage_profile = storage_profile + self.fqdn = None + + +class ContainerServiceNetworkProfile(_serialization.Model): # pylint: disable=too-many-instance-attributes + """Profile of network configuration. + + :ivar network_plugin: Network plugin used for building the Kubernetes network. Known values + are: "azure", "kubenet", and "none". + :vartype network_plugin: str or + ~azure.mgmt.containerservice.v2022_07_02_preview.models.NetworkPlugin + :ivar network_plugin_mode: Network plugin mode used for building the Kubernetes network. + "Overlay" + :vartype network_plugin_mode: str or + ~azure.mgmt.containerservice.v2022_07_02_preview.models.NetworkPluginMode + :ivar network_policy: Network policy used for building the Kubernetes network. Known values + are: "calico" and "azure". + :vartype network_policy: str or + ~azure.mgmt.containerservice.v2022_07_02_preview.models.NetworkPolicy + :ivar network_mode: This cannot be specified if networkPlugin is anything other than 'azure'. + Known values are: "transparent" and "bridge". + :vartype network_mode: str or + ~azure.mgmt.containerservice.v2022_07_02_preview.models.NetworkMode + :ivar pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. + :vartype pod_cidr: str + :ivar service_cidr: A CIDR notation IP range from which to assign service cluster IPs. It must + not overlap with any Subnet IP ranges. + :vartype service_cidr: str + :ivar dns_service_ip: An IP address assigned to the Kubernetes DNS service. It must be within + the Kubernetes service address range specified in serviceCidr. + :vartype dns_service_ip: str + :ivar docker_bridge_cidr: A CIDR notation IP range assigned to the Docker bridge network. It + must not overlap with any Subnet IP ranges or the Kubernetes service address range. + :vartype docker_bridge_cidr: str + :ivar outbound_type: This can only be set at cluster creation time and cannot be changed later. + For more information see `egress outbound type + `_. Known values are: "loadBalancer", + "userDefinedRouting", "managedNATGateway", and "userAssignedNATGateway". + :vartype outbound_type: str or + ~azure.mgmt.containerservice.v2022_07_02_preview.models.OutboundType + :ivar load_balancer_sku: The default is 'standard'. See `Azure Load Balancer SKUs + `_ for more information about the + differences between load balancer SKUs. Known values are: "standard" and "basic". + :vartype load_balancer_sku: str or + ~azure.mgmt.containerservice.v2022_07_02_preview.models.LoadBalancerSku + :ivar load_balancer_profile: Profile of the cluster load balancer. + :vartype load_balancer_profile: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterLoadBalancerProfile + :ivar nat_gateway_profile: Profile of the cluster NAT gateway. + :vartype nat_gateway_profile: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterNATGatewayProfile + :ivar pod_cidrs: One IPv4 CIDR is expected for single-stack networking. Two CIDRs, one for each + IP family (IPv4/IPv6), is expected for dual-stack networking. + :vartype pod_cidrs: list[str] + :ivar service_cidrs: One IPv4 CIDR is expected for single-stack networking. Two CIDRs, one for + each IP family (IPv4/IPv6), is expected for dual-stack networking. They must not overlap with + any Subnet IP ranges. + :vartype service_cidrs: list[str] + :ivar ip_families: IP families are used to determine single-stack or dual-stack clusters. For + single-stack, the expected value is IPv4. For dual-stack, the expected values are IPv4 and + IPv6. + :vartype ip_families: list[str or + ~azure.mgmt.containerservice.v2022_07_02_preview.models.IpFamily] + """ + + _validation = { + 'pod_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, + 'service_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, + 'dns_service_ip': {'pattern': r'^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$'}, + 'docker_bridge_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, + } + + _attribute_map = { + "network_plugin": {"key": "networkPlugin", "type": "str"}, + "network_plugin_mode": {"key": "networkPluginMode", "type": "str"}, + "network_policy": {"key": "networkPolicy", "type": "str"}, + "network_mode": {"key": "networkMode", "type": "str"}, + "pod_cidr": {"key": "podCidr", "type": "str"}, + "service_cidr": {"key": "serviceCidr", "type": "str"}, + "dns_service_ip": {"key": "dnsServiceIP", "type": "str"}, + "docker_bridge_cidr": {"key": "dockerBridgeCidr", "type": "str"}, + "outbound_type": {"key": "outboundType", "type": "str"}, + "load_balancer_sku": {"key": "loadBalancerSku", "type": "str"}, + "load_balancer_profile": {"key": "loadBalancerProfile", "type": "ManagedClusterLoadBalancerProfile"}, + "nat_gateway_profile": {"key": "natGatewayProfile", "type": "ManagedClusterNATGatewayProfile"}, + "pod_cidrs": {"key": "podCidrs", "type": "[str]"}, + "service_cidrs": {"key": "serviceCidrs", "type": "[str]"}, + "ip_families": {"key": "ipFamilies", "type": "[str]"}, + } + + def __init__( + self, + *, + network_plugin: Union[str, "_models.NetworkPlugin"] = "kubenet", + network_plugin_mode: Optional[Union[str, "_models.NetworkPluginMode"]] = None, + network_policy: Optional[Union[str, "_models.NetworkPolicy"]] = None, + network_mode: Optional[Union[str, "_models.NetworkMode"]] = None, + pod_cidr: str = "10.244.0.0/16", + service_cidr: str = "10.0.0.0/16", + dns_service_ip: str = "10.0.0.10", + docker_bridge_cidr: str = "172.17.0.1/16", + outbound_type: Union[str, "_models.OutboundType"] = "loadBalancer", + load_balancer_sku: Optional[Union[str, "_models.LoadBalancerSku"]] = None, + load_balancer_profile: Optional["_models.ManagedClusterLoadBalancerProfile"] = None, + nat_gateway_profile: Optional["_models.ManagedClusterNATGatewayProfile"] = None, + pod_cidrs: Optional[List[str]] = None, + service_cidrs: Optional[List[str]] = None, + ip_families: Optional[List[Union[str, "_models.IpFamily"]]] = None, + **kwargs + ): + """ + :keyword network_plugin: Network plugin used for building the Kubernetes network. Known values + are: "azure", "kubenet", and "none". + :paramtype network_plugin: str or + ~azure.mgmt.containerservice.v2022_07_02_preview.models.NetworkPlugin + :keyword network_plugin_mode: Network plugin mode used for building the Kubernetes network. + "Overlay" + :paramtype network_plugin_mode: str or + ~azure.mgmt.containerservice.v2022_07_02_preview.models.NetworkPluginMode + :keyword network_policy: Network policy used for building the Kubernetes network. Known values + are: "calico" and "azure". + :paramtype network_policy: str or + ~azure.mgmt.containerservice.v2022_07_02_preview.models.NetworkPolicy + :keyword network_mode: This cannot be specified if networkPlugin is anything other than + 'azure'. Known values are: "transparent" and "bridge". + :paramtype network_mode: str or + ~azure.mgmt.containerservice.v2022_07_02_preview.models.NetworkMode + :keyword pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. + :paramtype pod_cidr: str + :keyword service_cidr: A CIDR notation IP range from which to assign service cluster IPs. It + must not overlap with any Subnet IP ranges. + :paramtype service_cidr: str + :keyword dns_service_ip: An IP address assigned to the Kubernetes DNS service. It must be + within the Kubernetes service address range specified in serviceCidr. + :paramtype dns_service_ip: str + :keyword docker_bridge_cidr: A CIDR notation IP range assigned to the Docker bridge network. It + must not overlap with any Subnet IP ranges or the Kubernetes service address range. + :paramtype docker_bridge_cidr: str + :keyword outbound_type: This can only be set at cluster creation time and cannot be changed + later. For more information see `egress outbound type + `_. Known values are: "loadBalancer", + "userDefinedRouting", "managedNATGateway", and "userAssignedNATGateway". + :paramtype outbound_type: str or + ~azure.mgmt.containerservice.v2022_07_02_preview.models.OutboundType + :keyword load_balancer_sku: The default is 'standard'. See `Azure Load Balancer SKUs + `_ for more information about the + differences between load balancer SKUs. Known values are: "standard" and "basic". + :paramtype load_balancer_sku: str or + ~azure.mgmt.containerservice.v2022_07_02_preview.models.LoadBalancerSku + :keyword load_balancer_profile: Profile of the cluster load balancer. + :paramtype load_balancer_profile: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterLoadBalancerProfile + :keyword nat_gateway_profile: Profile of the cluster NAT gateway. + :paramtype nat_gateway_profile: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterNATGatewayProfile + :keyword pod_cidrs: One IPv4 CIDR is expected for single-stack networking. Two CIDRs, one for + each IP family (IPv4/IPv6), is expected for dual-stack networking. + :paramtype pod_cidrs: list[str] + :keyword service_cidrs: One IPv4 CIDR is expected for single-stack networking. Two CIDRs, one + for each IP family (IPv4/IPv6), is expected for dual-stack networking. They must not overlap + with any Subnet IP ranges. + :paramtype service_cidrs: list[str] + :keyword ip_families: IP families are used to determine single-stack or dual-stack clusters. + For single-stack, the expected value is IPv4. For dual-stack, the expected values are IPv4 and + IPv6. + :paramtype ip_families: list[str or + ~azure.mgmt.containerservice.v2022_07_02_preview.models.IpFamily] + """ + super().__init__(**kwargs) + self.network_plugin = network_plugin + self.network_plugin_mode = network_plugin_mode + self.network_policy = network_policy + self.network_mode = network_mode + self.pod_cidr = pod_cidr + self.service_cidr = service_cidr + self.dns_service_ip = dns_service_ip + self.docker_bridge_cidr = docker_bridge_cidr + self.outbound_type = outbound_type + self.load_balancer_sku = load_balancer_sku + self.load_balancer_profile = load_balancer_profile + self.nat_gateway_profile = nat_gateway_profile + self.pod_cidrs = pod_cidrs + self.service_cidrs = service_cidrs + self.ip_families = ip_families + + +class ContainerServiceSshConfiguration(_serialization.Model): + """SSH configuration for Linux-based VMs running on Azure. + + All required parameters must be populated in order to send to Azure. + + :ivar public_keys: The list of SSH public keys used to authenticate with Linux-based VMs. A + maximum of 1 key may be specified. Required. + :vartype public_keys: + list[~azure.mgmt.containerservice.v2022_07_02_preview.models.ContainerServiceSshPublicKey] + """ + + _validation = { + 'public_keys': {'required': True}, + } + + _attribute_map = { + "public_keys": {"key": "publicKeys", "type": "[ContainerServiceSshPublicKey]"}, + } + + def __init__( + self, + *, + public_keys: List["_models.ContainerServiceSshPublicKey"], + **kwargs + ): + """ + :keyword public_keys: The list of SSH public keys used to authenticate with Linux-based VMs. A + maximum of 1 key may be specified. Required. + :paramtype public_keys: + list[~azure.mgmt.containerservice.v2022_07_02_preview.models.ContainerServiceSshPublicKey] + """ + super().__init__(**kwargs) + self.public_keys = public_keys + + +class ContainerServiceSshPublicKey(_serialization.Model): + """Contains information about SSH certificate public key data. + + All required parameters must be populated in order to send to Azure. + + :ivar key_data: Certificate public key used to authenticate with VMs through SSH. The + certificate must be in PEM format with or without headers. Required. + :vartype key_data: str + """ + + _validation = { + 'key_data': {'required': True}, + } + + _attribute_map = { + "key_data": {"key": "keyData", "type": "str"}, + } + + def __init__( + self, + *, + key_data: str, + **kwargs + ): + """ + :keyword key_data: Certificate public key used to authenticate with VMs through SSH. The + certificate must be in PEM format with or without headers. Required. + :paramtype key_data: str + """ + super().__init__(**kwargs) + self.key_data = key_data + + +class ContainerServiceVMDiagnostics(_serialization.Model): + """Profile for diagnostics on the container service VMs. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar enabled: Whether the VM diagnostic agent is provisioned on the VM. Required. + :vartype enabled: bool + :ivar storage_uri: The URI of the storage account where diagnostics are stored. + :vartype storage_uri: str + """ + + _validation = { + 'enabled': {'required': True}, + 'storage_uri': {'readonly': True}, + } + + _attribute_map = { + "enabled": {"key": "enabled", "type": "bool"}, + "storage_uri": {"key": "storageUri", "type": "str"}, + } + + def __init__( + self, + *, + enabled: bool, + **kwargs + ): + """ + :keyword enabled: Whether the VM diagnostic agent is provisioned on the VM. Required. + :paramtype enabled: bool + """ + super().__init__(**kwargs) + self.enabled = enabled + self.storage_uri = None + + +class CreationData(_serialization.Model): + """Data used when creating a target resource from a source resource. + + :ivar source_resource_id: This is the ARM ID of the source object to be used to create the + target object. + :vartype source_resource_id: str + """ + + _attribute_map = { + "source_resource_id": {"key": "sourceResourceId", "type": "str"}, + } + + def __init__( + self, + *, + source_resource_id: Optional[str] = None, + **kwargs + ): + """ + :keyword source_resource_id: This is the ARM ID of the source object to be used to create the + target object. + :paramtype source_resource_id: str + """ + super().__init__(**kwargs) + self.source_resource_id = source_resource_id + + +class CredentialResult(_serialization.Model): + """The credential result response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: The name of the credential. + :vartype name: str + :ivar value: Base64-encoded Kubernetes configuration file. + :vartype value: bytes + """ + + _validation = { + 'name': {'readonly': True}, + 'value': {'readonly': True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "value": {"key": "value", "type": "bytearray"}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super().__init__(**kwargs) + self.name = None + self.value = None + + +class CredentialResults(_serialization.Model): + """The list credential result response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar kubeconfigs: Base64-encoded Kubernetes configuration file. + :vartype kubeconfigs: + list[~azure.mgmt.containerservice.v2022_07_02_preview.models.CredentialResult] + """ + + _validation = { + 'kubeconfigs': {'readonly': True}, + } + + _attribute_map = { + "kubeconfigs": {"key": "kubeconfigs", "type": "[CredentialResult]"}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super().__init__(**kwargs) + self.kubeconfigs = None + + +class EndpointDependency(_serialization.Model): + """A domain name that AKS agent nodes are reaching at. + + :ivar domain_name: The domain name of the dependency. + :vartype domain_name: str + :ivar endpoint_details: The Ports and Protocols used when connecting to domainName. + :vartype endpoint_details: + list[~azure.mgmt.containerservice.v2022_07_02_preview.models.EndpointDetail] + """ + + _attribute_map = { + "domain_name": {"key": "domainName", "type": "str"}, + "endpoint_details": {"key": "endpointDetails", "type": "[EndpointDetail]"}, + } + + def __init__( + self, + *, + domain_name: Optional[str] = None, + endpoint_details: Optional[List["_models.EndpointDetail"]] = None, + **kwargs + ): + """ + :keyword domain_name: The domain name of the dependency. + :paramtype domain_name: str + :keyword endpoint_details: The Ports and Protocols used when connecting to domainName. + :paramtype endpoint_details: + list[~azure.mgmt.containerservice.v2022_07_02_preview.models.EndpointDetail] + """ + super().__init__(**kwargs) + self.domain_name = domain_name + self.endpoint_details = endpoint_details + + +class EndpointDetail(_serialization.Model): + """connect information from the AKS agent nodes to a single endpoint. + + :ivar ip_address: An IP Address that Domain Name currently resolves to. + :vartype ip_address: str + :ivar port: The port an endpoint is connected to. + :vartype port: int + :ivar protocol: The protocol used for connection. + :vartype protocol: str + :ivar description: Description of the detail. + :vartype description: str + """ + + _attribute_map = { + "ip_address": {"key": "ipAddress", "type": "str"}, + "port": {"key": "port", "type": "int"}, + "protocol": {"key": "protocol", "type": "str"}, + "description": {"key": "description", "type": "str"}, + } + + def __init__( + self, + *, + ip_address: Optional[str] = None, + port: Optional[int] = None, + protocol: Optional[str] = None, + description: Optional[str] = None, + **kwargs + ): + """ + :keyword ip_address: An IP Address that Domain Name currently resolves to. + :paramtype ip_address: str + :keyword port: The port an endpoint is connected to. + :paramtype port: int + :keyword protocol: The protocol used for connection. + :paramtype protocol: str + :keyword description: Description of the detail. + :paramtype description: str + """ + super().__init__(**kwargs) + self.ip_address = ip_address + self.port = port + self.protocol = protocol + self.description = description + + +class ErrorAdditionalInfo(_serialization.Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: JSON + """ + + _validation = { + 'type': {'readonly': True}, + 'info': {'readonly': True}, + } + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + "info": {"key": "info", "type": "object"}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super().__init__(**kwargs) + self.type = None + self.info = None + + +class ErrorDetail(_serialization.Model): + """The error detail. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~azure.mgmt.containerservice.v2022_07_02_preview.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: + list[~azure.mgmt.containerservice.v2022_07_02_preview.models.ErrorAdditionalInfo] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + + _attribute_map = { + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[ErrorDetail]"}, + "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super().__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class ErrorResponse(_serialization.Model): + """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + + :ivar error: The error object. + :vartype error: ~azure.mgmt.containerservice.v2022_07_02_preview.models.ErrorDetail + """ + + _attribute_map = { + "error": {"key": "error", "type": "ErrorDetail"}, + } + + def __init__( + self, + *, + error: Optional["_models.ErrorDetail"] = None, + **kwargs + ): + """ + :keyword error: The error object. + :paramtype error: ~azure.mgmt.containerservice.v2022_07_02_preview.models.ErrorDetail + """ + super().__init__(**kwargs) + self.error = error + + +class ExtendedLocation(_serialization.Model): + """The complex type of the extended location. + + :ivar name: The name of the extended location. + :vartype name: str + :ivar type: The type of the extended location. "EdgeZone" + :vartype type: str or + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ExtendedLocationTypes + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + type: Optional[Union[str, "_models.ExtendedLocationTypes"]] = None, + **kwargs + ): + """ + :keyword name: The name of the extended location. + :paramtype name: str + :keyword type: The type of the extended location. "EdgeZone" + :paramtype type: str or + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ExtendedLocationTypes + """ + super().__init__(**kwargs) + self.name = name + self.type = type + + +class TrackedResource(Resource): + """The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.containerservice.v2022_07_02_preview.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str + """ + super().__init__(**kwargs) + self.tags = tags + self.location = location + + +class Fleet(TrackedResource): + """The Fleet resource which contains multiple Kubernetes clusters as its members. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.containerservice.v2022_07_02_preview.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar etag: Resource Etag. + :vartype etag: str + :ivar hub_profile: The FleetHubProfile configures the Fleet's hub. + :vartype hub_profile: ~azure.mgmt.containerservice.v2022_07_02_preview.models.FleetHubProfile + :ivar provisioning_state: The provisioning state of the last accepted operation. Known values + are: "Succeeded", "Failed", "Canceled", "Creating", "Deleting", and "Updating". + :vartype provisioning_state: str or + ~azure.mgmt.containerservice.v2022_07_02_preview.models.FleetProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'location': {'required': True}, + 'etag': {'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"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "hub_profile": {"key": "properties.hubProfile", "type": "FleetHubProfile"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + hub_profile: Optional["_models.FleetHubProfile"] = None, + **kwargs + ): + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str + :keyword hub_profile: The FleetHubProfile configures the Fleet's hub. + :paramtype hub_profile: ~azure.mgmt.containerservice.v2022_07_02_preview.models.FleetHubProfile + """ + super().__init__(tags=tags, location=location, **kwargs) + self.etag = None + self.hub_profile = hub_profile + self.provisioning_state = None + + +class FleetCredentialResult(_serialization.Model): + """The credential result response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: The name of the credential. + :vartype name: str + :ivar value: Base64-encoded Kubernetes configuration file. + :vartype value: bytes + """ + + _validation = { + 'name': {'readonly': True}, + 'value': {'readonly': True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "value": {"key": "value", "type": "bytearray"}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super().__init__(**kwargs) + self.name = None + self.value = None + + +class FleetCredentialResults(_serialization.Model): + """The list credential result response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar kubeconfigs: Base64-encoded Kubernetes configuration file. + :vartype kubeconfigs: + list[~azure.mgmt.containerservice.v2022_07_02_preview.models.FleetCredentialResult] + """ + + _validation = { + 'kubeconfigs': {'readonly': True}, + } + + _attribute_map = { + "kubeconfigs": {"key": "kubeconfigs", "type": "[FleetCredentialResult]"}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super().__init__(**kwargs) + self.kubeconfigs = None + + +class FleetHubProfile(_serialization.Model): + """The FleetHubProfile configures the fleet hub. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar dns_prefix: DNS prefix used to create the FQDN for the Fleet hub. + :vartype dns_prefix: str + :ivar fqdn: The FQDN of the Fleet hub. + :vartype fqdn: str + :ivar kubernetes_version: The Kubernetes version of the Fleet hub. + :vartype kubernetes_version: str + """ + + _validation = { + 'fqdn': {'readonly': True}, + 'kubernetes_version': {'readonly': True}, + } + + _attribute_map = { + "dns_prefix": {"key": "dnsPrefix", "type": "str"}, + "fqdn": {"key": "fqdn", "type": "str"}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + } + + def __init__( + self, + *, + dns_prefix: Optional[str] = None, + **kwargs + ): + """ + :keyword dns_prefix: DNS prefix used to create the FQDN for the Fleet hub. + :paramtype dns_prefix: str + """ + super().__init__(**kwargs) + self.dns_prefix = dns_prefix + self.fqdn = None + self.kubernetes_version = None + + +class FleetListResult(_serialization.Model): + """The response from the List Fleets operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The list of Fleets. + :vartype value: list[~azure.mgmt.containerservice.v2022_07_02_preview.models.Fleet] + :ivar next_link: The URL to get the next page of Fleets. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[Fleet]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.Fleet"]] = None, + **kwargs + ): + """ + :keyword value: The list of Fleets. + :paramtype value: list[~azure.mgmt.containerservice.v2022_07_02_preview.models.Fleet] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class FleetMember(AzureEntityResource): + """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. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.containerservice.v2022_07_02_preview.models.SystemData + :ivar etag: Resource Etag. + :vartype etag: 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}'. + :vartype cluster_resource_id: str + :ivar provisioning_state: The provisioning state of the last accepted operation. Known values + are: "Succeeded", "Failed", "Canceled", "Joining", "Leaving", and "Updating". + :vartype provisioning_state: str or + ~azure.mgmt.containerservice.v2022_07_02_preview.models.FleetMemberProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'etag': {'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"}, + "etag": {"key": "etag", "type": "str"}, + "cluster_resource_id": {"key": "properties.clusterResourceId", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + cluster_resource_id: Optional[str] = None, + **kwargs + ): + """ + :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}'. + :paramtype cluster_resource_id: str + """ + super().__init__(**kwargs) + self.cluster_resource_id = cluster_resource_id + self.provisioning_state = None + + +class FleetMembersListResult(_serialization.Model): + """The response from the List FleetMembers operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The list of members in a given Fleet. + :vartype value: list[~azure.mgmt.containerservice.v2022_07_02_preview.models.FleetMember] + :ivar next_link: The URL to get the next page of Fleet members. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[FleetMember]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.FleetMember"]] = None, + **kwargs + ): + """ + :keyword value: The list of members in a given Fleet. + :paramtype value: list[~azure.mgmt.containerservice.v2022_07_02_preview.models.FleetMember] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class FleetPatch(_serialization.Model): + """Properties of a Fleet that can be patched. + + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + """ + + _attribute_map = { + "tags": {"key": "tags", "type": "{str}"}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + """ + super().__init__(**kwargs) + self.tags = tags + + +class KubeletConfig(_serialization.Model): # pylint: disable=too-many-instance-attributes + """See `AKS custom node configuration `_ for more details. + + :ivar cpu_manager_policy: The default is 'none'. See `Kubernetes CPU management policies + `_ + for more information. Allowed values are 'none' and 'static'. + :vartype cpu_manager_policy: str + :ivar cpu_cfs_quota: The default is true. + :vartype cpu_cfs_quota: bool + :ivar cpu_cfs_quota_period: The default is '100ms.' Valid values are a sequence of decimal + numbers with an optional fraction and a unit suffix. For example: '300ms', '2h45m'. Supported + units are 'ns', 'us', 'ms', 's', 'm', and 'h'. + :vartype cpu_cfs_quota_period: str + :ivar image_gc_high_threshold: To disable image garbage collection, set to 100. The default is + 85%. + :vartype image_gc_high_threshold: int + :ivar image_gc_low_threshold: This cannot be set higher than imageGcHighThreshold. The default + is 80%. + :vartype image_gc_low_threshold: int + :ivar topology_manager_policy: For more information see `Kubernetes Topology Manager + `_. The default is + 'none'. Allowed values are 'none', 'best-effort', 'restricted', and 'single-numa-node'. + :vartype topology_manager_policy: str + :ivar allowed_unsafe_sysctls: Allowed list of unsafe sysctls or unsafe sysctl patterns (ending + in ``*``\ ). + :vartype allowed_unsafe_sysctls: list[str] + :ivar fail_swap_on: If set to true it will make the Kubelet fail to start if swap is enabled on + the node. + :vartype fail_swap_on: bool + :ivar container_log_max_size_mb: The maximum size (e.g. 10Mi) of container log file before it + is rotated. + :vartype container_log_max_size_mb: int + :ivar container_log_max_files: The maximum number of container log files that can be present + for a container. The number must be ≥ 2. + :vartype container_log_max_files: int + :ivar pod_max_pids: The maximum number of processes per pod. + :vartype pod_max_pids: int + """ + + _validation = { + 'container_log_max_files': {'minimum': 2}, + } + + _attribute_map = { + "cpu_manager_policy": {"key": "cpuManagerPolicy", "type": "str"}, + "cpu_cfs_quota": {"key": "cpuCfsQuota", "type": "bool"}, + "cpu_cfs_quota_period": {"key": "cpuCfsQuotaPeriod", "type": "str"}, + "image_gc_high_threshold": {"key": "imageGcHighThreshold", "type": "int"}, + "image_gc_low_threshold": {"key": "imageGcLowThreshold", "type": "int"}, + "topology_manager_policy": {"key": "topologyManagerPolicy", "type": "str"}, + "allowed_unsafe_sysctls": {"key": "allowedUnsafeSysctls", "type": "[str]"}, + "fail_swap_on": {"key": "failSwapOn", "type": "bool"}, + "container_log_max_size_mb": {"key": "containerLogMaxSizeMB", "type": "int"}, + "container_log_max_files": {"key": "containerLogMaxFiles", "type": "int"}, + "pod_max_pids": {"key": "podMaxPids", "type": "int"}, + } + + def __init__( + self, + *, + cpu_manager_policy: Optional[str] = None, + cpu_cfs_quota: Optional[bool] = None, + cpu_cfs_quota_period: Optional[str] = None, + image_gc_high_threshold: Optional[int] = None, + image_gc_low_threshold: Optional[int] = None, + topology_manager_policy: Optional[str] = None, + allowed_unsafe_sysctls: Optional[List[str]] = None, + fail_swap_on: Optional[bool] = None, + container_log_max_size_mb: Optional[int] = None, + container_log_max_files: Optional[int] = None, + pod_max_pids: Optional[int] = None, + **kwargs + ): + """ + :keyword cpu_manager_policy: The default is 'none'. See `Kubernetes CPU management policies + `_ + for more information. Allowed values are 'none' and 'static'. + :paramtype cpu_manager_policy: str + :keyword cpu_cfs_quota: The default is true. + :paramtype cpu_cfs_quota: bool + :keyword cpu_cfs_quota_period: The default is '100ms.' Valid values are a sequence of decimal + numbers with an optional fraction and a unit suffix. For example: '300ms', '2h45m'. Supported + units are 'ns', 'us', 'ms', 's', 'm', and 'h'. + :paramtype cpu_cfs_quota_period: str + :keyword image_gc_high_threshold: To disable image garbage collection, set to 100. The default + is 85%. + :paramtype image_gc_high_threshold: int + :keyword image_gc_low_threshold: This cannot be set higher than imageGcHighThreshold. The + default is 80%. + :paramtype image_gc_low_threshold: int + :keyword topology_manager_policy: For more information see `Kubernetes Topology Manager + `_. The default is + 'none'. Allowed values are 'none', 'best-effort', 'restricted', and 'single-numa-node'. + :paramtype topology_manager_policy: str + :keyword allowed_unsafe_sysctls: Allowed list of unsafe sysctls or unsafe sysctl patterns + (ending in ``*``\ ). + :paramtype allowed_unsafe_sysctls: list[str] + :keyword fail_swap_on: If set to true it will make the Kubelet fail to start if swap is enabled + on the node. + :paramtype fail_swap_on: bool + :keyword container_log_max_size_mb: The maximum size (e.g. 10Mi) of container log file before + it is rotated. + :paramtype container_log_max_size_mb: int + :keyword container_log_max_files: The maximum number of container log files that can be present + for a container. The number must be ≥ 2. + :paramtype container_log_max_files: int + :keyword pod_max_pids: The maximum number of processes per pod. + :paramtype pod_max_pids: int + """ + super().__init__(**kwargs) + self.cpu_manager_policy = cpu_manager_policy + self.cpu_cfs_quota = cpu_cfs_quota + self.cpu_cfs_quota_period = cpu_cfs_quota_period + self.image_gc_high_threshold = image_gc_high_threshold + self.image_gc_low_threshold = image_gc_low_threshold + self.topology_manager_policy = topology_manager_policy + self.allowed_unsafe_sysctls = allowed_unsafe_sysctls + self.fail_swap_on = fail_swap_on + self.container_log_max_size_mb = container_log_max_size_mb + self.container_log_max_files = container_log_max_files + self.pod_max_pids = pod_max_pids + + +class LinuxOSConfig(_serialization.Model): + """See `AKS custom node configuration `_ for more details. + + :ivar sysctls: Sysctl settings for Linux agent nodes. + :vartype sysctls: ~azure.mgmt.containerservice.v2022_07_02_preview.models.SysctlConfig + :ivar transparent_huge_page_enabled: Valid values are 'always', 'madvise', and 'never'. The + default is 'always'. For more information see `Transparent Hugepages + `_. + :vartype transparent_huge_page_enabled: str + :ivar transparent_huge_page_defrag: Valid values are 'always', 'defer', 'defer+madvise', + 'madvise' and 'never'. The default is 'madvise'. For more information see `Transparent + Hugepages + `_. + :vartype transparent_huge_page_defrag: str + :ivar swap_file_size_mb: The size in MB of a swap file that will be created on each node. + :vartype swap_file_size_mb: int + """ + + _attribute_map = { + "sysctls": {"key": "sysctls", "type": "SysctlConfig"}, + "transparent_huge_page_enabled": {"key": "transparentHugePageEnabled", "type": "str"}, + "transparent_huge_page_defrag": {"key": "transparentHugePageDefrag", "type": "str"}, + "swap_file_size_mb": {"key": "swapFileSizeMB", "type": "int"}, + } + + def __init__( + self, + *, + sysctls: Optional["_models.SysctlConfig"] = None, + transparent_huge_page_enabled: Optional[str] = None, + transparent_huge_page_defrag: Optional[str] = None, + swap_file_size_mb: Optional[int] = None, + **kwargs + ): + """ + :keyword sysctls: Sysctl settings for Linux agent nodes. + :paramtype sysctls: ~azure.mgmt.containerservice.v2022_07_02_preview.models.SysctlConfig + :keyword transparent_huge_page_enabled: Valid values are 'always', 'madvise', and 'never'. The + default is 'always'. For more information see `Transparent Hugepages + `_. + :paramtype transparent_huge_page_enabled: str + :keyword transparent_huge_page_defrag: Valid values are 'always', 'defer', 'defer+madvise', + 'madvise' and 'never'. The default is 'madvise'. For more information see `Transparent + Hugepages + `_. + :paramtype transparent_huge_page_defrag: str + :keyword swap_file_size_mb: The size in MB of a swap file that will be created on each node. + :paramtype swap_file_size_mb: int + """ + super().__init__(**kwargs) + self.sysctls = sysctls + self.transparent_huge_page_enabled = transparent_huge_page_enabled + self.transparent_huge_page_defrag = transparent_huge_page_defrag + self.swap_file_size_mb = swap_file_size_mb + + +class MaintenanceConfiguration(SubResource): + """See `planned maintenance `_ for more information about planned maintenance. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: The name of the resource that is unique within a resource group. This name can be + used to access the resource. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar system_data: The system metadata relating to this resource. + :vartype system_data: ~azure.mgmt.containerservice.v2022_07_02_preview.models.SystemData + :ivar time_in_week: If two array entries specify the same day of the week, the applied + configuration is the union of times in both entries. + :vartype time_in_week: list[~azure.mgmt.containerservice.v2022_07_02_preview.models.TimeInWeek] + :ivar not_allowed_time: Time slots on which upgrade is not allowed. + :vartype not_allowed_time: + list[~azure.mgmt.containerservice.v2022_07_02_preview.models.TimeSpan] + """ + + _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"}, + "time_in_week": {"key": "properties.timeInWeek", "type": "[TimeInWeek]"}, + "not_allowed_time": {"key": "properties.notAllowedTime", "type": "[TimeSpan]"}, + } + + def __init__( + self, + *, + time_in_week: Optional[List["_models.TimeInWeek"]] = None, + not_allowed_time: Optional[List["_models.TimeSpan"]] = None, + **kwargs + ): + """ + :keyword time_in_week: If two array entries specify the same day of the week, the applied + configuration is the union of times in both entries. + :paramtype time_in_week: + list[~azure.mgmt.containerservice.v2022_07_02_preview.models.TimeInWeek] + :keyword not_allowed_time: Time slots on which upgrade is not allowed. + :paramtype not_allowed_time: + list[~azure.mgmt.containerservice.v2022_07_02_preview.models.TimeSpan] + """ + super().__init__(**kwargs) + self.system_data = None + self.time_in_week = time_in_week + self.not_allowed_time = not_allowed_time + + +class MaintenanceConfigurationListResult(_serialization.Model): + """The response from the List maintenance configurations operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The list of maintenance configurations. + :vartype value: + list[~azure.mgmt.containerservice.v2022_07_02_preview.models.MaintenanceConfiguration] + :ivar next_link: The URL to get the next set of maintenance configuration results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[MaintenanceConfiguration]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.MaintenanceConfiguration"]] = None, + **kwargs + ): + """ + :keyword value: The list of maintenance configurations. + :paramtype value: + list[~azure.mgmt.containerservice.v2022_07_02_preview.models.MaintenanceConfiguration] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class ManagedCluster(TrackedResource): # pylint: disable=too-many-instance-attributes + """Managed cluster. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.containerservice.v2022_07_02_preview.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 sku: The managed cluster SKU. + :vartype sku: ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterSKU + :ivar extended_location: The extended location of the Virtual Machine. + :vartype extended_location: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ExtendedLocation + :ivar identity: The identity of the managed cluster, if configured. + :vartype identity: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterIdentity + :ivar provisioning_state: The current provisioning state. + :vartype provisioning_state: str + :ivar power_state: The Power State of the cluster. + :vartype power_state: ~azure.mgmt.containerservice.v2022_07_02_preview.models.PowerState + :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the cluster + will be created/upgraded using a snapshot. + :vartype creation_data: ~azure.mgmt.containerservice.v2022_07_02_preview.models.CreationData + :ivar max_agent_pools: The max number of agent pools for the managed cluster. + :vartype max_agent_pools: int + :ivar kubernetes_version: When you upgrade a supported AKS cluster, Kubernetes minor versions + cannot be skipped. All upgrades must be performed sequentially by major version number. For + example, upgrades between 1.14.x -> 1.15.x or 1.15.x -> 1.16.x are allowed, however 1.14.x -> + 1.16.x is not allowed. See `upgrading an AKS cluster + `_ for more details. + :vartype kubernetes_version: str + :ivar current_kubernetes_version: The version of Kubernetes the Managed Cluster is running. + :vartype current_kubernetes_version: str + :ivar dns_prefix: This cannot be updated once the Managed Cluster has been created. + :vartype dns_prefix: str + :ivar fqdn_subdomain: This cannot be updated once the Managed Cluster has been created. + :vartype fqdn_subdomain: str + :ivar fqdn: The FQDN of the master pool. + :vartype fqdn: str + :ivar private_fqdn: The FQDN of private cluster. + :vartype private_fqdn: str + :ivar azure_portal_fqdn: The Azure Portal requires certain Cross-Origin Resource Sharing (CORS) + headers to be sent in some responses, which Kubernetes APIServer doesn't handle by default. + This special FQDN supports CORS, allowing the Azure Portal to function properly. + :vartype azure_portal_fqdn: str + :ivar agent_pool_profiles: The agent pool properties. + :vartype agent_pool_profiles: + list[~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterAgentPoolProfile] + :ivar linux_profile: The profile for Linux VMs in the Managed Cluster. + :vartype linux_profile: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ContainerServiceLinuxProfile + :ivar windows_profile: The profile for Windows VMs in the Managed Cluster. + :vartype windows_profile: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterWindowsProfile + :ivar service_principal_profile: Information about a service principal identity for the cluster + to use for manipulating Azure APIs. + :vartype service_principal_profile: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterServicePrincipalProfile + :ivar addon_profiles: The profile of managed cluster add-on. + :vartype addon_profiles: dict[str, + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterAddonProfile] + :ivar pod_identity_profile: See `use AAD pod identity + `_ for more details on AAD pod + identity integration. + :vartype pod_identity_profile: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterPodIdentityProfile + :ivar oidc_issuer_profile: The OIDC issuer profile of the Managed Cluster. + :vartype oidc_issuer_profile: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterOIDCIssuerProfile + :ivar node_resource_group: The name of the resource group containing agent pool nodes. + :vartype node_resource_group: str + :ivar enable_rbac: Whether to enable Kubernetes Role-Based Access Control. + :vartype enable_rbac: bool + :ivar enable_pod_security_policy: (DEPRECATING) Whether to enable Kubernetes pod security + policy (preview). This feature is set for removal on October 15th, 2020. Learn more at + aka.ms/aks/azpodpolicy. + :vartype enable_pod_security_policy: bool + :ivar enable_namespace_resources: The default value is false. It can be enabled/disabled on + creation and updation of the managed cluster. See `https://aka.ms/NamespaceARMResource + `_ for more details on Namespace as a ARM Resource. + :vartype enable_namespace_resources: bool + :ivar network_profile: The network configuration profile. + :vartype network_profile: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ContainerServiceNetworkProfile + :ivar aad_profile: The Azure Active Directory configuration. + :vartype aad_profile: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterAADProfile + :ivar auto_upgrade_profile: The auto upgrade configuration. + :vartype auto_upgrade_profile: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterAutoUpgradeProfile + :ivar auto_scaler_profile: Parameters to be applied to the cluster-autoscaler when enabled. + :vartype auto_scaler_profile: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterPropertiesAutoScalerProfile + :ivar api_server_access_profile: The access profile for managed cluster API server. + :vartype api_server_access_profile: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterAPIServerAccessProfile + :ivar disk_encryption_set_id: This is of the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{encryptionSetName}'. + :vartype disk_encryption_set_id: str + :ivar identity_profile: Identities associated with the cluster. + :vartype identity_profile: dict[str, + ~azure.mgmt.containerservice.v2022_07_02_preview.models.UserAssignedIdentity] + :ivar private_link_resources: Private link resources associated with the cluster. + :vartype private_link_resources: + list[~azure.mgmt.containerservice.v2022_07_02_preview.models.PrivateLinkResource] + :ivar disable_local_accounts: If set to true, getting static credentials will be disabled for + this cluster. This must only be used on Managed Clusters that are AAD enabled. For more details + see `disable local accounts + `_. + :vartype disable_local_accounts: bool + :ivar http_proxy_config: Configurations for provisioning the cluster with HTTP proxy servers. + :vartype http_proxy_config: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterHTTPProxyConfig + :ivar security_profile: Security profile for the managed cluster. + :vartype security_profile: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterSecurityProfile + :ivar storage_profile: Storage profile for the managed cluster. + :vartype storage_profile: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterStorageProfile + :ivar ingress_profile: Ingress profile for the managed cluster. + :vartype ingress_profile: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterIngressProfile + :ivar public_network_access: Allow or deny public network access for AKS. Known values are: + "Enabled", "Disabled", and "SecuredByPerimeter". + :vartype public_network_access: str or + ~azure.mgmt.containerservice.v2022_07_02_preview.models.PublicNetworkAccess + :ivar workload_auto_scaler_profile: Workload Auto-scaler profile for the container service + cluster. + :vartype workload_auto_scaler_profile: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterWorkloadAutoScalerProfile + :ivar azure_monitor_profile: Prometheus addon profile for the container service cluster. + :vartype azure_monitor_profile: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterAzureMonitorProfile + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'location': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'power_state': {'readonly': True}, + 'max_agent_pools': {'readonly': True}, + 'current_kubernetes_version': {'readonly': True}, + 'fqdn': {'readonly': True}, + 'private_fqdn': {'readonly': True}, + 'azure_portal_fqdn': {'readonly': True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "sku": {"key": "sku", "type": "ManagedClusterSKU"}, + "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, + "identity": {"key": "identity", "type": "ManagedClusterIdentity"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "power_state": {"key": "properties.powerState", "type": "PowerState"}, + "creation_data": {"key": "properties.creationData", "type": "CreationData"}, + "max_agent_pools": {"key": "properties.maxAgentPools", "type": "int"}, + "kubernetes_version": {"key": "properties.kubernetesVersion", "type": "str"}, + "current_kubernetes_version": {"key": "properties.currentKubernetesVersion", "type": "str"}, + "dns_prefix": {"key": "properties.dnsPrefix", "type": "str"}, + "fqdn_subdomain": {"key": "properties.fqdnSubdomain", "type": "str"}, + "fqdn": {"key": "properties.fqdn", "type": "str"}, + "private_fqdn": {"key": "properties.privateFQDN", "type": "str"}, + "azure_portal_fqdn": {"key": "properties.azurePortalFQDN", "type": "str"}, + "agent_pool_profiles": {"key": "properties.agentPoolProfiles", "type": "[ManagedClusterAgentPoolProfile]"}, + "linux_profile": {"key": "properties.linuxProfile", "type": "ContainerServiceLinuxProfile"}, + "windows_profile": {"key": "properties.windowsProfile", "type": "ManagedClusterWindowsProfile"}, + "service_principal_profile": {"key": "properties.servicePrincipalProfile", "type": "ManagedClusterServicePrincipalProfile"}, + "addon_profiles": {"key": "properties.addonProfiles", "type": "{ManagedClusterAddonProfile}"}, + "pod_identity_profile": {"key": "properties.podIdentityProfile", "type": "ManagedClusterPodIdentityProfile"}, + "oidc_issuer_profile": {"key": "properties.oidcIssuerProfile", "type": "ManagedClusterOIDCIssuerProfile"}, + "node_resource_group": {"key": "properties.nodeResourceGroup", "type": "str"}, + "enable_rbac": {"key": "properties.enableRBAC", "type": "bool"}, + "enable_pod_security_policy": {"key": "properties.enablePodSecurityPolicy", "type": "bool"}, + "enable_namespace_resources": {"key": "properties.enableNamespaceResources", "type": "bool"}, + "network_profile": {"key": "properties.networkProfile", "type": "ContainerServiceNetworkProfile"}, + "aad_profile": {"key": "properties.aadProfile", "type": "ManagedClusterAADProfile"}, + "auto_upgrade_profile": {"key": "properties.autoUpgradeProfile", "type": "ManagedClusterAutoUpgradeProfile"}, + "auto_scaler_profile": {"key": "properties.autoScalerProfile", "type": "ManagedClusterPropertiesAutoScalerProfile"}, + "api_server_access_profile": {"key": "properties.apiServerAccessProfile", "type": "ManagedClusterAPIServerAccessProfile"}, + "disk_encryption_set_id": {"key": "properties.diskEncryptionSetID", "type": "str"}, + "identity_profile": {"key": "properties.identityProfile", "type": "{UserAssignedIdentity}"}, + "private_link_resources": {"key": "properties.privateLinkResources", "type": "[PrivateLinkResource]"}, + "disable_local_accounts": {"key": "properties.disableLocalAccounts", "type": "bool"}, + "http_proxy_config": {"key": "properties.httpProxyConfig", "type": "ManagedClusterHTTPProxyConfig"}, + "security_profile": {"key": "properties.securityProfile", "type": "ManagedClusterSecurityProfile"}, + "storage_profile": {"key": "properties.storageProfile", "type": "ManagedClusterStorageProfile"}, + "ingress_profile": {"key": "properties.ingressProfile", "type": "ManagedClusterIngressProfile"}, + "public_network_access": {"key": "properties.publicNetworkAccess", "type": "str"}, + "workload_auto_scaler_profile": {"key": "properties.workloadAutoScalerProfile", "type": "ManagedClusterWorkloadAutoScalerProfile"}, + "azure_monitor_profile": {"key": "properties.azureMonitorProfile", "type": "ManagedClusterAzureMonitorProfile"}, + } + + def __init__( # pylint: disable=too-many-locals + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + sku: Optional["_models.ManagedClusterSKU"] = None, + extended_location: Optional["_models.ExtendedLocation"] = None, + identity: Optional["_models.ManagedClusterIdentity"] = None, + creation_data: Optional["_models.CreationData"] = None, + kubernetes_version: Optional[str] = None, + dns_prefix: Optional[str] = None, + fqdn_subdomain: Optional[str] = None, + agent_pool_profiles: Optional[List["_models.ManagedClusterAgentPoolProfile"]] = None, + linux_profile: Optional["_models.ContainerServiceLinuxProfile"] = None, + windows_profile: Optional["_models.ManagedClusterWindowsProfile"] = None, + service_principal_profile: Optional["_models.ManagedClusterServicePrincipalProfile"] = None, + addon_profiles: Optional[Dict[str, "_models.ManagedClusterAddonProfile"]] = None, + pod_identity_profile: Optional["_models.ManagedClusterPodIdentityProfile"] = None, + oidc_issuer_profile: Optional["_models.ManagedClusterOIDCIssuerProfile"] = None, + node_resource_group: Optional[str] = None, + enable_rbac: Optional[bool] = None, + enable_pod_security_policy: Optional[bool] = None, + enable_namespace_resources: Optional[bool] = None, + network_profile: Optional["_models.ContainerServiceNetworkProfile"] = None, + aad_profile: Optional["_models.ManagedClusterAADProfile"] = None, + auto_upgrade_profile: Optional["_models.ManagedClusterAutoUpgradeProfile"] = None, + auto_scaler_profile: Optional["_models.ManagedClusterPropertiesAutoScalerProfile"] = None, + api_server_access_profile: Optional["_models.ManagedClusterAPIServerAccessProfile"] = None, + disk_encryption_set_id: Optional[str] = None, + identity_profile: Optional[Dict[str, "_models.UserAssignedIdentity"]] = None, + private_link_resources: Optional[List["_models.PrivateLinkResource"]] = None, + disable_local_accounts: Optional[bool] = None, + http_proxy_config: Optional["_models.ManagedClusterHTTPProxyConfig"] = None, + security_profile: Optional["_models.ManagedClusterSecurityProfile"] = None, + storage_profile: Optional["_models.ManagedClusterStorageProfile"] = None, + ingress_profile: Optional["_models.ManagedClusterIngressProfile"] = None, + public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = None, + workload_auto_scaler_profile: Optional["_models.ManagedClusterWorkloadAutoScalerProfile"] = None, + azure_monitor_profile: Optional["_models.ManagedClusterAzureMonitorProfile"] = None, + **kwargs + ): + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str + :keyword sku: The managed cluster SKU. + :paramtype sku: ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterSKU + :keyword extended_location: The extended location of the Virtual Machine. + :paramtype extended_location: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ExtendedLocation + :keyword identity: The identity of the managed cluster, if configured. + :paramtype identity: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterIdentity + :keyword creation_data: CreationData to be used to specify the source Snapshot ID if the + cluster will be created/upgraded using a snapshot. + :paramtype creation_data: ~azure.mgmt.containerservice.v2022_07_02_preview.models.CreationData + :keyword kubernetes_version: When you upgrade a supported AKS cluster, Kubernetes minor + versions cannot be skipped. All upgrades must be performed sequentially by major version + number. For example, upgrades between 1.14.x -> 1.15.x or 1.15.x -> 1.16.x are allowed, however + 1.14.x -> 1.16.x is not allowed. See `upgrading an AKS cluster + `_ for more details. + :paramtype kubernetes_version: str + :keyword dns_prefix: This cannot be updated once the Managed Cluster has been created. + :paramtype dns_prefix: str + :keyword fqdn_subdomain: This cannot be updated once the Managed Cluster has been created. + :paramtype fqdn_subdomain: str + :keyword agent_pool_profiles: The agent pool properties. + :paramtype agent_pool_profiles: + list[~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterAgentPoolProfile] + :keyword linux_profile: The profile for Linux VMs in the Managed Cluster. + :paramtype linux_profile: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ContainerServiceLinuxProfile + :keyword windows_profile: The profile for Windows VMs in the Managed Cluster. + :paramtype windows_profile: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterWindowsProfile + :keyword service_principal_profile: Information about a service principal identity for the + cluster to use for manipulating Azure APIs. + :paramtype service_principal_profile: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterServicePrincipalProfile + :keyword addon_profiles: The profile of managed cluster add-on. + :paramtype addon_profiles: dict[str, + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterAddonProfile] + :keyword pod_identity_profile: See `use AAD pod identity + `_ for more details on AAD pod + identity integration. + :paramtype pod_identity_profile: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterPodIdentityProfile + :keyword oidc_issuer_profile: The OIDC issuer profile of the Managed Cluster. + :paramtype oidc_issuer_profile: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterOIDCIssuerProfile + :keyword node_resource_group: The name of the resource group containing agent pool nodes. + :paramtype node_resource_group: str + :keyword enable_rbac: Whether to enable Kubernetes Role-Based Access Control. + :paramtype enable_rbac: bool + :keyword enable_pod_security_policy: (DEPRECATING) Whether to enable Kubernetes pod security + policy (preview). This feature is set for removal on October 15th, 2020. Learn more at + aka.ms/aks/azpodpolicy. + :paramtype enable_pod_security_policy: bool + :keyword enable_namespace_resources: The default value is false. It can be enabled/disabled on + creation and updation of the managed cluster. See `https://aka.ms/NamespaceARMResource + `_ for more details on Namespace as a ARM Resource. + :paramtype enable_namespace_resources: bool + :keyword network_profile: The network configuration profile. + :paramtype network_profile: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ContainerServiceNetworkProfile + :keyword aad_profile: The Azure Active Directory configuration. + :paramtype aad_profile: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterAADProfile + :keyword auto_upgrade_profile: The auto upgrade configuration. + :paramtype auto_upgrade_profile: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterAutoUpgradeProfile + :keyword auto_scaler_profile: Parameters to be applied to the cluster-autoscaler when enabled. + :paramtype auto_scaler_profile: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterPropertiesAutoScalerProfile + :keyword api_server_access_profile: The access profile for managed cluster API server. + :paramtype api_server_access_profile: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterAPIServerAccessProfile + :keyword disk_encryption_set_id: This is of the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{encryptionSetName}'. + :paramtype disk_encryption_set_id: str + :keyword identity_profile: Identities associated with the cluster. + :paramtype identity_profile: dict[str, + ~azure.mgmt.containerservice.v2022_07_02_preview.models.UserAssignedIdentity] + :keyword private_link_resources: Private link resources associated with the cluster. + :paramtype private_link_resources: + list[~azure.mgmt.containerservice.v2022_07_02_preview.models.PrivateLinkResource] + :keyword disable_local_accounts: If set to true, getting static credentials will be disabled + for this cluster. This must only be used on Managed Clusters that are AAD enabled. For more + details see `disable local accounts + `_. + :paramtype disable_local_accounts: bool + :keyword http_proxy_config: Configurations for provisioning the cluster with HTTP proxy + servers. + :paramtype http_proxy_config: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterHTTPProxyConfig + :keyword security_profile: Security profile for the managed cluster. + :paramtype security_profile: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterSecurityProfile + :keyword storage_profile: Storage profile for the managed cluster. + :paramtype storage_profile: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterStorageProfile + :keyword ingress_profile: Ingress profile for the managed cluster. + :paramtype ingress_profile: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterIngressProfile + :keyword public_network_access: Allow or deny public network access for AKS. Known values are: + "Enabled", "Disabled", and "SecuredByPerimeter". + :paramtype public_network_access: str or + ~azure.mgmt.containerservice.v2022_07_02_preview.models.PublicNetworkAccess + :keyword workload_auto_scaler_profile: Workload Auto-scaler profile for the container service + cluster. + :paramtype workload_auto_scaler_profile: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterWorkloadAutoScalerProfile + :keyword azure_monitor_profile: Prometheus addon profile for the container service cluster. + :paramtype azure_monitor_profile: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterAzureMonitorProfile + """ + super().__init__(tags=tags, location=location, **kwargs) + self.sku = sku + self.extended_location = extended_location + self.identity = identity + self.provisioning_state = None + self.power_state = None + self.creation_data = creation_data + self.max_agent_pools = None + self.kubernetes_version = kubernetes_version + self.current_kubernetes_version = None + self.dns_prefix = dns_prefix + self.fqdn_subdomain = fqdn_subdomain + self.fqdn = None + self.private_fqdn = None + self.azure_portal_fqdn = None + self.agent_pool_profiles = agent_pool_profiles + self.linux_profile = linux_profile + self.windows_profile = windows_profile + self.service_principal_profile = service_principal_profile + self.addon_profiles = addon_profiles + self.pod_identity_profile = pod_identity_profile + self.oidc_issuer_profile = oidc_issuer_profile + self.node_resource_group = node_resource_group + self.enable_rbac = enable_rbac + self.enable_pod_security_policy = enable_pod_security_policy + self.enable_namespace_resources = enable_namespace_resources + self.network_profile = network_profile + self.aad_profile = aad_profile + self.auto_upgrade_profile = auto_upgrade_profile + self.auto_scaler_profile = auto_scaler_profile + self.api_server_access_profile = api_server_access_profile + self.disk_encryption_set_id = disk_encryption_set_id + self.identity_profile = identity_profile + self.private_link_resources = private_link_resources + self.disable_local_accounts = disable_local_accounts + self.http_proxy_config = http_proxy_config + self.security_profile = security_profile + self.storage_profile = storage_profile + self.ingress_profile = ingress_profile + self.public_network_access = public_network_access + self.workload_auto_scaler_profile = workload_auto_scaler_profile + self.azure_monitor_profile = azure_monitor_profile + + +class ManagedClusterAADProfile(_serialization.Model): + """For more details see `managed AAD on AKS `_. + + :ivar managed: Whether to enable managed AAD. + :vartype managed: bool + :ivar enable_azure_rbac: Whether to enable Azure RBAC for Kubernetes authorization. + :vartype enable_azure_rbac: bool + :ivar admin_group_object_i_ds: The list of AAD group object IDs that will have admin role of + the cluster. + :vartype admin_group_object_i_ds: list[str] + :ivar client_app_id: The client AAD application ID. + :vartype client_app_id: str + :ivar server_app_id: The server AAD application ID. + :vartype server_app_id: str + :ivar server_app_secret: The server AAD application secret. + :vartype server_app_secret: str + :ivar tenant_id: The AAD tenant ID to use for authentication. If not specified, will use the + tenant of the deployment subscription. + :vartype tenant_id: str + """ + + _attribute_map = { + "managed": {"key": "managed", "type": "bool"}, + "enable_azure_rbac": {"key": "enableAzureRBAC", "type": "bool"}, + "admin_group_object_i_ds": {"key": "adminGroupObjectIDs", "type": "[str]"}, + "client_app_id": {"key": "clientAppID", "type": "str"}, + "server_app_id": {"key": "serverAppID", "type": "str"}, + "server_app_secret": {"key": "serverAppSecret", "type": "str"}, + "tenant_id": {"key": "tenantID", "type": "str"}, + } + + def __init__( + self, + *, + managed: Optional[bool] = None, + enable_azure_rbac: Optional[bool] = None, + admin_group_object_i_ds: Optional[List[str]] = None, + client_app_id: Optional[str] = None, + server_app_id: Optional[str] = None, + server_app_secret: Optional[str] = None, + tenant_id: Optional[str] = None, + **kwargs + ): + """ + :keyword managed: Whether to enable managed AAD. + :paramtype managed: bool + :keyword enable_azure_rbac: Whether to enable Azure RBAC for Kubernetes authorization. + :paramtype enable_azure_rbac: bool + :keyword admin_group_object_i_ds: The list of AAD group object IDs that will have admin role of + the cluster. + :paramtype admin_group_object_i_ds: list[str] + :keyword client_app_id: The client AAD application ID. + :paramtype client_app_id: str + :keyword server_app_id: The server AAD application ID. + :paramtype server_app_id: str + :keyword server_app_secret: The server AAD application secret. + :paramtype server_app_secret: str + :keyword tenant_id: The AAD tenant ID to use for authentication. If not specified, will use the + tenant of the deployment subscription. + :paramtype tenant_id: str + """ + super().__init__(**kwargs) + self.managed = managed + self.enable_azure_rbac = enable_azure_rbac + self.admin_group_object_i_ds = admin_group_object_i_ds + self.client_app_id = client_app_id + self.server_app_id = server_app_id + self.server_app_secret = server_app_secret + self.tenant_id = tenant_id + + +class ManagedClusterAccessProfile(TrackedResource): + """Managed cluster Access Profile. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.containerservice.v2022_07_02_preview.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 kube_config: Base64-encoded Kubernetes configuration file. + :vartype kube_config: bytes + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "kube_config": {"key": "properties.kubeConfig", "type": "bytearray"}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + kube_config: Optional[bytes] = None, + **kwargs + ): + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str + :keyword kube_config: Base64-encoded Kubernetes configuration file. + :paramtype kube_config: bytes + """ + super().__init__(tags=tags, location=location, **kwargs) + self.kube_config = kube_config + + +class ManagedClusterAddonProfile(_serialization.Model): + """A Kubernetes add-on profile for a managed cluster. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar enabled: Whether the add-on is enabled or not. Required. + :vartype enabled: bool + :ivar config: Key-value pairs for configuring an add-on. + :vartype config: dict[str, str] + :ivar identity: Information of user assigned identity used by this add-on. + :vartype identity: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterAddonProfileIdentity + """ + + _validation = { + 'enabled': {'required': True}, + 'identity': {'readonly': True}, + } + + _attribute_map = { + "enabled": {"key": "enabled", "type": "bool"}, + "config": {"key": "config", "type": "{str}"}, + "identity": {"key": "identity", "type": "ManagedClusterAddonProfileIdentity"}, + } + + def __init__( + self, + *, + enabled: bool, + config: Optional[Dict[str, str]] = None, + **kwargs + ): + """ + :keyword enabled: Whether the add-on is enabled or not. Required. + :paramtype enabled: bool + :keyword config: Key-value pairs for configuring an add-on. + :paramtype config: dict[str, str] + """ + super().__init__(**kwargs) + self.enabled = enabled + self.config = config + self.identity = None + + +class UserAssignedIdentity(_serialization.Model): + """Details about a user assigned identity. + + :ivar resource_id: The resource ID of the user assigned identity. + :vartype resource_id: str + :ivar client_id: The client ID of the user assigned identity. + :vartype client_id: str + :ivar object_id: The object ID of the user assigned identity. + :vartype object_id: str + """ + + _attribute_map = { + "resource_id": {"key": "resourceId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + "object_id": {"key": "objectId", "type": "str"}, + } + + def __init__( + self, + *, + resource_id: Optional[str] = None, + client_id: Optional[str] = None, + object_id: Optional[str] = None, + **kwargs + ): + """ + :keyword resource_id: The resource ID of the user assigned identity. + :paramtype resource_id: str + :keyword client_id: The client ID of the user assigned identity. + :paramtype client_id: str + :keyword object_id: The object ID of the user assigned identity. + :paramtype object_id: str + """ + super().__init__(**kwargs) + self.resource_id = resource_id + self.client_id = client_id + self.object_id = object_id + + +class ManagedClusterAddonProfileIdentity(UserAssignedIdentity): + """Information of user assigned identity used by this add-on. + + :ivar resource_id: The resource ID of the user assigned identity. + :vartype resource_id: str + :ivar client_id: The client ID of the user assigned identity. + :vartype client_id: str + :ivar object_id: The object ID of the user assigned identity. + :vartype object_id: str + """ + + _attribute_map = { + "resource_id": {"key": "resourceId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + "object_id": {"key": "objectId", "type": "str"}, + } + + def __init__( + self, + *, + resource_id: Optional[str] = None, + client_id: Optional[str] = None, + object_id: Optional[str] = None, + **kwargs + ): + """ + :keyword resource_id: The resource ID of the user assigned identity. + :paramtype resource_id: str + :keyword client_id: The client ID of the user assigned identity. + :paramtype client_id: str + :keyword object_id: The object ID of the user assigned identity. + :paramtype object_id: str + """ + super().__init__(resource_id=resource_id, client_id=client_id, object_id=object_id, **kwargs) + + +class ManagedClusterAgentPoolProfileProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes + """Properties for the container service agent pool profile. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar count: Number of agents (VMs) to host docker containers. Allowed values must be in the + range of 0 to 1000 (inclusive) for user pools and in the range of 1 to 1000 (inclusive) for + system pools. The default value is 1. + :vartype count: int + :ivar vm_size: VM size availability varies by region. If a node contains insufficient compute + resources (memory, cpu, etc) pods might fail to run correctly. For more details on restricted + VM sizes, see: https://docs.microsoft.com/azure/aks/quotas-skus-regions. + :vartype vm_size: str + :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine + in the master/agent pool. If you specify 0, it will apply the default osDisk size according to + the vmSize specified. + :vartype os_disk_size_gb: int + :ivar os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk + larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed + after creation. For more information see `Ephemeral OS + `_. Known values are: + "Managed" and "Ephemeral". + :vartype os_disk_type: str or + ~azure.mgmt.containerservice.v2022_07_02_preview.models.OSDiskType + :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data + root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". + :vartype kubelet_disk_type: str or + ~azure.mgmt.containerservice.v2022_07_02_preview.models.KubeletDiskType + :ivar workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer" and "WasmWasi". + :vartype workload_runtime: str or + ~azure.mgmt.containerservice.v2022_07_02_preview.models.WorkloadRuntime + :ivar message_of_the_day: A base64-encoded string which will be written to /etc/motd after + decoding. This allows customization of the message of the day for Linux nodes. It must not be + specified for Windows nodes. It must be a static string (i.e., will be printed raw and not be + executed as a script). + :vartype message_of_the_day: str + :ivar vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and used. + If no podSubnetID is specified, this applies to nodes and pods, otherwise it applies to just + nodes. This is of the form: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. + :vartype vnet_subnet_id: str + :ivar pod_subnet_id: If omitted, pod IPs are statically assigned on the node subnet (see + vnetSubnetID for more details). This is of the form: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. + :vartype pod_subnet_id: str + :ivar max_pods: The maximum number of pods that can run on a node. + :vartype max_pods: int + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". + :vartype os_type: str or ~azure.mgmt.containerservice.v2022_07_02_preview.models.OSType + :ivar os_sku: Specifies the OS SKU used by the agent pool. If not specified, the default is + Ubuntu if OSType=Linux or Windows2019 if OSType=Windows. And the default Windows OSSKU will be + changed to Windows2022 after Windows2019 is deprecated. Known values are: "Ubuntu", + "CBLMariner", "Windows2019", and "Windows2022". + :vartype os_sku: str or ~azure.mgmt.containerservice.v2022_07_02_preview.models.OSSKU + :ivar max_count: The maximum number of nodes for auto-scaling. + :vartype max_count: int + :ivar min_count: The minimum number of nodes for auto-scaling. + :vartype min_count: int + :ivar enable_auto_scaling: Whether to enable auto-scaler. + :vartype enable_auto_scaling: bool + :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it + defaults to Delete. Known values are: "Delete" and "Deallocate". + :vartype scale_down_mode: str or + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ScaleDownMode + :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets" and + "AvailabilitySet". + :vartype type: str or ~azure.mgmt.containerservice.v2022_07_02_preview.models.AgentPoolType + :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional + information on agent pool restrictions and best practices, see: + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". + :vartype mode: str or ~azure.mgmt.containerservice.v2022_07_02_preview.models.AgentPoolMode + :ivar orchestrator_version: Both patch version and are + supported. When is specified, the latest supported patch version is chosen + automatically. Updating the agent pool with the same once it has been created + will not trigger an upgrade, even if a newer patch version is available. As a best practice, + you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node + pool version must have the same major version as the control plane. The node pool minor version + must be within two minor versions of the control plane version. The node pool version cannot be + greater than the control plane version. For more information see `upgrading a node pool + `_. + :vartype orchestrator_version: str + :ivar current_orchestrator_version: If orchestratorVersion was a fully specified version + , this field will be exactly equal to it. If orchestratorVersion was + , this field will contain the full version being used. + :vartype current_orchestrator_version: str + :ivar node_image_version: The version of node image. + :vartype node_image_version: str + :ivar upgrade_settings: Settings for upgrading the agentpool. + :vartype upgrade_settings: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.AgentPoolUpgradeSettings + :ivar provisioning_state: The current deployment or provisioning state. + :vartype provisioning_state: str + :ivar power_state: When an Agent Pool is first created it is initially Running. The Agent Pool + can be stopped by setting this field to Stopped. A stopped Agent Pool stops all of its VMs and + does not accrue billing charges. An Agent Pool can only be stopped if it is Running and + provisioning state is Succeeded. + :vartype power_state: ~azure.mgmt.containerservice.v2022_07_02_preview.models.PowerState + :ivar availability_zones: The list of Availability zones to use for nodes. This can only be + specified if the AgentPoolType property is 'VirtualMachineScaleSets'. + :vartype availability_zones: list[str] + :ivar enable_node_public_ip: Some scenarios may require nodes in a node pool to receive their + own dedicated public IP addresses. A common scenario is for gaming workloads, where a console + needs to make a direct connection to a cloud virtual machine to minimize hops. For more + information see `assigning a public IP per node + `_. + The default is false. + :vartype enable_node_public_ip: bool + :ivar enable_custom_ca_trust: When set to true, AKS deploys a daemonset and host services to + sync custom certificate authorities from a user-provided config map into node trust stores. + Defaults to false. + :vartype enable_custom_ca_trust: bool + :ivar node_public_ip_prefix_id: This is of the form: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. + :vartype node_public_ip_prefix_id: str + :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default + is 'Regular'. Known values are: "Spot" and "Regular". + :vartype scale_set_priority: str or + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ScaleSetPriority + :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". + :vartype scale_set_eviction_policy: str or + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ScaleSetEvictionPolicy + :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which + indicates the willingness to pay any on-demand price. For more details on spot pricing, see + `spot VMs pricing `_. + :vartype spot_max_price: float + :ivar tags: The tags to be persisted on the agent pool virtual machine scale set. + :vartype tags: dict[str, str] + :ivar node_labels: The node labels to be persisted across all nodes in agent pool. + :vartype node_labels: dict[str, str] + :ivar node_taints: The taints added to new nodes during node pool create and scale. For + example, key=value:NoSchedule. + :vartype node_taints: list[str] + :ivar proximity_placement_group_id: The ID for Proximity Placement Group. + :vartype proximity_placement_group_id: str + :ivar kubelet_config: The Kubelet configuration on the agent pool nodes. + :vartype kubelet_config: ~azure.mgmt.containerservice.v2022_07_02_preview.models.KubeletConfig + :ivar linux_os_config: The OS configuration of Linux agent nodes. + :vartype linux_os_config: ~azure.mgmt.containerservice.v2022_07_02_preview.models.LinuxOSConfig + :ivar enable_encryption_at_host: This is only supported on certain VM sizes and in certain + Azure regions. For more information, see: + https://docs.microsoft.com/azure/aks/enable-host-encryption. + :vartype enable_encryption_at_host: bool + :ivar enable_ultra_ssd: Whether to enable UltraSSD. + :vartype enable_ultra_ssd: bool + :ivar enable_fips: See `Add a FIPS-enabled node pool + `_ + for more details. + :vartype enable_fips: bool + :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". + :vartype gpu_instance_profile: str or + ~azure.mgmt.containerservice.v2022_07_02_preview.models.GPUInstanceProfile + :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the node pool + will be created/upgraded using a snapshot. + :vartype creation_data: ~azure.mgmt.containerservice.v2022_07_02_preview.models.CreationData + :ivar capacity_reservation_group_id: AKS will associate the specified agent pool with the + Capacity Reservation Group. + :vartype capacity_reservation_group_id: str + :ivar host_group_id: This is of the form: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}. + For more information see `Azure dedicated hosts + `_. + :vartype host_group_id: str + """ + + _validation = { + 'os_disk_size_gb': {'maximum': 2048, 'minimum': 0}, + 'current_orchestrator_version': {'readonly': True}, + 'node_image_version': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + "count": {"key": "count", "type": "int"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "os_disk_type": {"key": "osDiskType", "type": "str"}, + "kubelet_disk_type": {"key": "kubeletDiskType", "type": "str"}, + "workload_runtime": {"key": "workloadRuntime", "type": "str"}, + "message_of_the_day": {"key": "messageOfTheDay", "type": "str"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "pod_subnet_id": {"key": "podSubnetID", "type": "str"}, + "max_pods": {"key": "maxPods", "type": "int"}, + "os_type": {"key": "osType", "type": "str"}, + "os_sku": {"key": "osSKU", "type": "str"}, + "max_count": {"key": "maxCount", "type": "int"}, + "min_count": {"key": "minCount", "type": "int"}, + "enable_auto_scaling": {"key": "enableAutoScaling", "type": "bool"}, + "scale_down_mode": {"key": "scaleDownMode", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "mode": {"key": "mode", "type": "str"}, + "orchestrator_version": {"key": "orchestratorVersion", "type": "str"}, + "current_orchestrator_version": {"key": "currentOrchestratorVersion", "type": "str"}, + "node_image_version": {"key": "nodeImageVersion", "type": "str"}, + "upgrade_settings": {"key": "upgradeSettings", "type": "AgentPoolUpgradeSettings"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "power_state": {"key": "powerState", "type": "PowerState"}, + "availability_zones": {"key": "availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "enableNodePublicIP", "type": "bool"}, + "enable_custom_ca_trust": {"key": "enableCustomCATrust", "type": "bool"}, + "node_public_ip_prefix_id": {"key": "nodePublicIPPrefixID", "type": "str"}, + "scale_set_priority": {"key": "scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "scaleSetEvictionPolicy", "type": "str"}, + "spot_max_price": {"key": "spotMaxPrice", "type": "float"}, + "tags": {"key": "tags", "type": "{str}"}, + "node_labels": {"key": "nodeLabels", "type": "{str}"}, + "node_taints": {"key": "nodeTaints", "type": "[str]"}, + "proximity_placement_group_id": {"key": "proximityPlacementGroupID", "type": "str"}, + "kubelet_config": {"key": "kubeletConfig", "type": "KubeletConfig"}, + "linux_os_config": {"key": "linuxOSConfig", "type": "LinuxOSConfig"}, + "enable_encryption_at_host": {"key": "enableEncryptionAtHost", "type": "bool"}, + "enable_ultra_ssd": {"key": "enableUltraSSD", "type": "bool"}, + "enable_fips": {"key": "enableFIPS", "type": "bool"}, + "gpu_instance_profile": {"key": "gpuInstanceProfile", "type": "str"}, + "creation_data": {"key": "creationData", "type": "CreationData"}, + "capacity_reservation_group_id": {"key": "capacityReservationGroupID", "type": "str"}, + "host_group_id": {"key": "hostGroupID", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals + self, + *, + count: Optional[int] = None, + vm_size: Optional[str] = None, + os_disk_size_gb: Optional[int] = None, + os_disk_type: Optional[Union[str, "_models.OSDiskType"]] = None, + kubelet_disk_type: Optional[Union[str, "_models.KubeletDiskType"]] = None, + workload_runtime: Optional[Union[str, "_models.WorkloadRuntime"]] = None, + message_of_the_day: Optional[str] = None, + vnet_subnet_id: Optional[str] = None, + pod_subnet_id: Optional[str] = None, + max_pods: Optional[int] = None, + os_type: Union[str, "_models.OSType"] = "Linux", + os_sku: Optional[Union[str, "_models.OSSKU"]] = None, + max_count: Optional[int] = None, + min_count: Optional[int] = None, + enable_auto_scaling: Optional[bool] = None, + scale_down_mode: Optional[Union[str, "_models.ScaleDownMode"]] = None, + type: Optional[Union[str, "_models.AgentPoolType"]] = None, + mode: Optional[Union[str, "_models.AgentPoolMode"]] = None, + orchestrator_version: Optional[str] = None, + upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, + power_state: Optional["_models.PowerState"] = None, + availability_zones: Optional[List[str]] = None, + enable_node_public_ip: Optional[bool] = None, + enable_custom_ca_trust: Optional[bool] = None, + node_public_ip_prefix_id: Optional[str] = None, + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", + spot_max_price: float = -1, + tags: Optional[Dict[str, str]] = None, + node_labels: Optional[Dict[str, str]] = None, + node_taints: Optional[List[str]] = None, + proximity_placement_group_id: Optional[str] = None, + kubelet_config: Optional["_models.KubeletConfig"] = None, + linux_os_config: Optional["_models.LinuxOSConfig"] = None, + enable_encryption_at_host: Optional[bool] = None, + enable_ultra_ssd: Optional[bool] = None, + enable_fips: Optional[bool] = None, + gpu_instance_profile: Optional[Union[str, "_models.GPUInstanceProfile"]] = None, + creation_data: Optional["_models.CreationData"] = None, + capacity_reservation_group_id: Optional[str] = None, + host_group_id: Optional[str] = None, + **kwargs + ): + """ + :keyword count: Number of agents (VMs) to host docker containers. Allowed values must be in the + range of 0 to 1000 (inclusive) for user pools and in the range of 1 to 1000 (inclusive) for + system pools. The default value is 1. + :paramtype count: int + :keyword vm_size: VM size availability varies by region. If a node contains insufficient + compute resources (memory, cpu, etc) pods might fail to run correctly. For more details on + restricted VM sizes, see: https://docs.microsoft.com/azure/aks/quotas-skus-regions. + :paramtype vm_size: str + :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every + machine in the master/agent pool. If you specify 0, it will apply the default osDisk size + according to the vmSize specified. + :paramtype os_disk_size_gb: int + :keyword os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk + larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed + after creation. For more information see `Ephemeral OS + `_. Known values are: + "Managed" and "Ephemeral". + :paramtype os_disk_type: str or + ~azure.mgmt.containerservice.v2022_07_02_preview.models.OSDiskType + :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime + data root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". + :paramtype kubelet_disk_type: str or + ~azure.mgmt.containerservice.v2022_07_02_preview.models.KubeletDiskType + :keyword workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer" and "WasmWasi". + :paramtype workload_runtime: str or + ~azure.mgmt.containerservice.v2022_07_02_preview.models.WorkloadRuntime + :keyword message_of_the_day: A base64-encoded string which will be written to /etc/motd after + decoding. This allows customization of the message of the day for Linux nodes. It must not be + specified for Windows nodes. It must be a static string (i.e., will be printed raw and not be + executed as a script). + :paramtype message_of_the_day: str + :keyword vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and + used. If no podSubnetID is specified, this applies to nodes and pods, otherwise it applies to + just nodes. This is of the form: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. + :paramtype vnet_subnet_id: str + :keyword pod_subnet_id: If omitted, pod IPs are statically assigned on the node subnet (see + vnetSubnetID for more details). This is of the form: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. + :paramtype pod_subnet_id: str + :keyword max_pods: The maximum number of pods that can run on a node. + :paramtype max_pods: int + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". + :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_07_02_preview.models.OSType + :keyword os_sku: Specifies the OS SKU used by the agent pool. If not specified, the default is + Ubuntu if OSType=Linux or Windows2019 if OSType=Windows. And the default Windows OSSKU will be + changed to Windows2022 after Windows2019 is deprecated. Known values are: "Ubuntu", + "CBLMariner", "Windows2019", and "Windows2022". + :paramtype os_sku: str or ~azure.mgmt.containerservice.v2022_07_02_preview.models.OSSKU + :keyword max_count: The maximum number of nodes for auto-scaling. + :paramtype max_count: int + :keyword min_count: The minimum number of nodes for auto-scaling. + :paramtype min_count: int + :keyword enable_auto_scaling: Whether to enable auto-scaler. + :paramtype enable_auto_scaling: bool + :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, + it defaults to Delete. Known values are: "Delete" and "Deallocate". + :paramtype scale_down_mode: str or + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ScaleDownMode + :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets" and + "AvailabilitySet". + :paramtype type: str or ~azure.mgmt.containerservice.v2022_07_02_preview.models.AgentPoolType + :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For + additional information on agent pool restrictions and best practices, see: + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". + :paramtype mode: str or ~azure.mgmt.containerservice.v2022_07_02_preview.models.AgentPoolMode + :keyword orchestrator_version: Both patch version and are + supported. When is specified, the latest supported patch version is chosen + automatically. Updating the agent pool with the same once it has been created + will not trigger an upgrade, even if a newer patch version is available. As a best practice, + you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node + pool version must have the same major version as the control plane. The node pool minor version + must be within two minor versions of the control plane version. The node pool version cannot be + greater than the control plane version. For more information see `upgrading a node pool + `_. + :paramtype orchestrator_version: str + :keyword upgrade_settings: Settings for upgrading the agentpool. + :paramtype upgrade_settings: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.AgentPoolUpgradeSettings + :keyword power_state: When an Agent Pool is first created it is initially Running. The Agent + Pool can be stopped by setting this field to Stopped. A stopped Agent Pool stops all of its VMs + and does not accrue billing charges. An Agent Pool can only be stopped if it is Running and + provisioning state is Succeeded. + :paramtype power_state: ~azure.mgmt.containerservice.v2022_07_02_preview.models.PowerState + :keyword availability_zones: The list of Availability zones to use for nodes. This can only be + specified if the AgentPoolType property is 'VirtualMachineScaleSets'. + :paramtype availability_zones: list[str] + :keyword enable_node_public_ip: Some scenarios may require nodes in a node pool to receive + their own dedicated public IP addresses. A common scenario is for gaming workloads, where a + console needs to make a direct connection to a cloud virtual machine to minimize hops. For more + information see `assigning a public IP per node + `_. + The default is false. + :paramtype enable_node_public_ip: bool + :keyword enable_custom_ca_trust: When set to true, AKS deploys a daemonset and host services to + sync custom certificate authorities from a user-provided config map into node trust stores. + Defaults to false. + :paramtype enable_custom_ca_trust: bool + :keyword node_public_ip_prefix_id: This is of the form: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. + :paramtype node_public_ip_prefix_id: str + :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the + default is 'Regular'. Known values are: "Spot" and "Regular". + :paramtype scale_set_priority: str or + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ScaleSetPriority + :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". + :paramtype scale_set_eviction_policy: str or + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ScaleSetEvictionPolicy + :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which + indicates the willingness to pay any on-demand price. For more details on spot pricing, see + `spot VMs pricing `_. + :paramtype spot_max_price: float + :keyword tags: The tags to be persisted on the agent pool virtual machine scale set. + :paramtype tags: dict[str, str] + :keyword node_labels: The node labels to be persisted across all nodes in agent pool. + :paramtype node_labels: dict[str, str] + :keyword node_taints: The taints added to new nodes during node pool create and scale. For + example, key=value:NoSchedule. + :paramtype node_taints: list[str] + :keyword proximity_placement_group_id: The ID for Proximity Placement Group. + :paramtype proximity_placement_group_id: str + :keyword kubelet_config: The Kubelet configuration on the agent pool nodes. + :paramtype kubelet_config: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.KubeletConfig + :keyword linux_os_config: The OS configuration of Linux agent nodes. + :paramtype linux_os_config: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.LinuxOSConfig + :keyword enable_encryption_at_host: This is only supported on certain VM sizes and in certain + Azure regions. For more information, see: + https://docs.microsoft.com/azure/aks/enable-host-encryption. + :paramtype enable_encryption_at_host: bool + :keyword enable_ultra_ssd: Whether to enable UltraSSD. + :paramtype enable_ultra_ssd: bool + :keyword enable_fips: See `Add a FIPS-enabled node pool + `_ + for more details. + :paramtype enable_fips: bool + :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and + "MIG7g". + :paramtype gpu_instance_profile: str or + ~azure.mgmt.containerservice.v2022_07_02_preview.models.GPUInstanceProfile + :keyword creation_data: CreationData to be used to specify the source Snapshot ID if the node + pool will be created/upgraded using a snapshot. + :paramtype creation_data: ~azure.mgmt.containerservice.v2022_07_02_preview.models.CreationData + :keyword capacity_reservation_group_id: AKS will associate the specified agent pool with the + Capacity Reservation Group. + :paramtype capacity_reservation_group_id: str + :keyword host_group_id: This is of the form: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}. + For more information see `Azure dedicated hosts + `_. + :paramtype host_group_id: str + """ + super().__init__(**kwargs) + self.count = count + self.vm_size = vm_size + self.os_disk_size_gb = os_disk_size_gb + self.os_disk_type = os_disk_type + self.kubelet_disk_type = kubelet_disk_type + self.workload_runtime = workload_runtime + self.message_of_the_day = message_of_the_day + self.vnet_subnet_id = vnet_subnet_id + self.pod_subnet_id = pod_subnet_id + self.max_pods = max_pods + self.os_type = os_type + self.os_sku = os_sku + self.max_count = max_count + self.min_count = min_count + self.enable_auto_scaling = enable_auto_scaling + self.scale_down_mode = scale_down_mode + self.type = type + self.mode = mode + self.orchestrator_version = orchestrator_version + self.current_orchestrator_version = None + self.node_image_version = None + self.upgrade_settings = upgrade_settings + self.provisioning_state = None + self.power_state = power_state + self.availability_zones = availability_zones + self.enable_node_public_ip = enable_node_public_ip + self.enable_custom_ca_trust = enable_custom_ca_trust + self.node_public_ip_prefix_id = node_public_ip_prefix_id + self.scale_set_priority = scale_set_priority + self.scale_set_eviction_policy = scale_set_eviction_policy + self.spot_max_price = spot_max_price + self.tags = tags + self.node_labels = node_labels + self.node_taints = node_taints + self.proximity_placement_group_id = proximity_placement_group_id + self.kubelet_config = kubelet_config + self.linux_os_config = linux_os_config + self.enable_encryption_at_host = enable_encryption_at_host + self.enable_ultra_ssd = enable_ultra_ssd + self.enable_fips = enable_fips + self.gpu_instance_profile = gpu_instance_profile + self.creation_data = creation_data + self.capacity_reservation_group_id = capacity_reservation_group_id + self.host_group_id = host_group_id + + +class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): # pylint: disable=too-many-instance-attributes + """Profile for the container service agent pool. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar count: Number of agents (VMs) to host docker containers. Allowed values must be in the + range of 0 to 1000 (inclusive) for user pools and in the range of 1 to 1000 (inclusive) for + system pools. The default value is 1. + :vartype count: int + :ivar vm_size: VM size availability varies by region. If a node contains insufficient compute + resources (memory, cpu, etc) pods might fail to run correctly. For more details on restricted + VM sizes, see: https://docs.microsoft.com/azure/aks/quotas-skus-regions. + :vartype vm_size: str + :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine + in the master/agent pool. If you specify 0, it will apply the default osDisk size according to + the vmSize specified. + :vartype os_disk_size_gb: int + :ivar os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk + larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed + after creation. For more information see `Ephemeral OS + `_. Known values are: + "Managed" and "Ephemeral". + :vartype os_disk_type: str or + ~azure.mgmt.containerservice.v2022_07_02_preview.models.OSDiskType + :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data + root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". + :vartype kubelet_disk_type: str or + ~azure.mgmt.containerservice.v2022_07_02_preview.models.KubeletDiskType + :ivar workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer" and "WasmWasi". + :vartype workload_runtime: str or + ~azure.mgmt.containerservice.v2022_07_02_preview.models.WorkloadRuntime + :ivar message_of_the_day: A base64-encoded string which will be written to /etc/motd after + decoding. This allows customization of the message of the day for Linux nodes. It must not be + specified for Windows nodes. It must be a static string (i.e., will be printed raw and not be + executed as a script). + :vartype message_of_the_day: str + :ivar vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and used. + If no podSubnetID is specified, this applies to nodes and pods, otherwise it applies to just + nodes. This is of the form: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. + :vartype vnet_subnet_id: str + :ivar pod_subnet_id: If omitted, pod IPs are statically assigned on the node subnet (see + vnetSubnetID for more details). This is of the form: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. + :vartype pod_subnet_id: str + :ivar max_pods: The maximum number of pods that can run on a node. + :vartype max_pods: int + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". + :vartype os_type: str or ~azure.mgmt.containerservice.v2022_07_02_preview.models.OSType + :ivar os_sku: Specifies the OS SKU used by the agent pool. If not specified, the default is + Ubuntu if OSType=Linux or Windows2019 if OSType=Windows. And the default Windows OSSKU will be + changed to Windows2022 after Windows2019 is deprecated. Known values are: "Ubuntu", + "CBLMariner", "Windows2019", and "Windows2022". + :vartype os_sku: str or ~azure.mgmt.containerservice.v2022_07_02_preview.models.OSSKU + :ivar max_count: The maximum number of nodes for auto-scaling. + :vartype max_count: int + :ivar min_count: The minimum number of nodes for auto-scaling. + :vartype min_count: int + :ivar enable_auto_scaling: Whether to enable auto-scaler. + :vartype enable_auto_scaling: bool + :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it + defaults to Delete. Known values are: "Delete" and "Deallocate". + :vartype scale_down_mode: str or + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ScaleDownMode + :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets" and + "AvailabilitySet". + :vartype type: str or ~azure.mgmt.containerservice.v2022_07_02_preview.models.AgentPoolType + :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional + information on agent pool restrictions and best practices, see: + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". + :vartype mode: str or ~azure.mgmt.containerservice.v2022_07_02_preview.models.AgentPoolMode + :ivar orchestrator_version: Both patch version and are + supported. When is specified, the latest supported patch version is chosen + automatically. Updating the agent pool with the same once it has been created + will not trigger an upgrade, even if a newer patch version is available. As a best practice, + you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node + pool version must have the same major version as the control plane. The node pool minor version + must be within two minor versions of the control plane version. The node pool version cannot be + greater than the control plane version. For more information see `upgrading a node pool + `_. + :vartype orchestrator_version: str + :ivar current_orchestrator_version: If orchestratorVersion was a fully specified version + , this field will be exactly equal to it. If orchestratorVersion was + , this field will contain the full version being used. + :vartype current_orchestrator_version: str + :ivar node_image_version: The version of node image. + :vartype node_image_version: str + :ivar upgrade_settings: Settings for upgrading the agentpool. + :vartype upgrade_settings: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.AgentPoolUpgradeSettings + :ivar provisioning_state: The current deployment or provisioning state. + :vartype provisioning_state: str + :ivar power_state: When an Agent Pool is first created it is initially Running. The Agent Pool + can be stopped by setting this field to Stopped. A stopped Agent Pool stops all of its VMs and + does not accrue billing charges. An Agent Pool can only be stopped if it is Running and + provisioning state is Succeeded. + :vartype power_state: ~azure.mgmt.containerservice.v2022_07_02_preview.models.PowerState + :ivar availability_zones: The list of Availability zones to use for nodes. This can only be + specified if the AgentPoolType property is 'VirtualMachineScaleSets'. + :vartype availability_zones: list[str] + :ivar enable_node_public_ip: Some scenarios may require nodes in a node pool to receive their + own dedicated public IP addresses. A common scenario is for gaming workloads, where a console + needs to make a direct connection to a cloud virtual machine to minimize hops. For more + information see `assigning a public IP per node + `_. + The default is false. + :vartype enable_node_public_ip: bool + :ivar enable_custom_ca_trust: When set to true, AKS deploys a daemonset and host services to + sync custom certificate authorities from a user-provided config map into node trust stores. + Defaults to false. + :vartype enable_custom_ca_trust: bool + :ivar node_public_ip_prefix_id: This is of the form: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. + :vartype node_public_ip_prefix_id: str + :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default + is 'Regular'. Known values are: "Spot" and "Regular". + :vartype scale_set_priority: str or + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ScaleSetPriority + :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". + :vartype scale_set_eviction_policy: str or + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ScaleSetEvictionPolicy + :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which + indicates the willingness to pay any on-demand price. For more details on spot pricing, see + `spot VMs pricing `_. + :vartype spot_max_price: float + :ivar tags: The tags to be persisted on the agent pool virtual machine scale set. + :vartype tags: dict[str, str] + :ivar node_labels: The node labels to be persisted across all nodes in agent pool. + :vartype node_labels: dict[str, str] + :ivar node_taints: The taints added to new nodes during node pool create and scale. For + example, key=value:NoSchedule. + :vartype node_taints: list[str] + :ivar proximity_placement_group_id: The ID for Proximity Placement Group. + :vartype proximity_placement_group_id: str + :ivar kubelet_config: The Kubelet configuration on the agent pool nodes. + :vartype kubelet_config: ~azure.mgmt.containerservice.v2022_07_02_preview.models.KubeletConfig + :ivar linux_os_config: The OS configuration of Linux agent nodes. + :vartype linux_os_config: ~azure.mgmt.containerservice.v2022_07_02_preview.models.LinuxOSConfig + :ivar enable_encryption_at_host: This is only supported on certain VM sizes and in certain + Azure regions. For more information, see: + https://docs.microsoft.com/azure/aks/enable-host-encryption. + :vartype enable_encryption_at_host: bool + :ivar enable_ultra_ssd: Whether to enable UltraSSD. + :vartype enable_ultra_ssd: bool + :ivar enable_fips: See `Add a FIPS-enabled node pool + `_ + for more details. + :vartype enable_fips: bool + :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and "MIG7g". + :vartype gpu_instance_profile: str or + ~azure.mgmt.containerservice.v2022_07_02_preview.models.GPUInstanceProfile + :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the node pool + will be created/upgraded using a snapshot. + :vartype creation_data: ~azure.mgmt.containerservice.v2022_07_02_preview.models.CreationData + :ivar capacity_reservation_group_id: AKS will associate the specified agent pool with the + Capacity Reservation Group. + :vartype capacity_reservation_group_id: str + :ivar host_group_id: This is of the form: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}. + For more information see `Azure dedicated hosts + `_. + :vartype host_group_id: str + :ivar name: Windows agent pool names must be 6 characters or less. Required. + :vartype name: str + """ + + _validation = { + 'os_disk_size_gb': {'maximum': 2048, 'minimum': 0}, + 'current_orchestrator_version': {'readonly': True}, + 'node_image_version': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'name': {'required': True, 'pattern': r'^[a-z][a-z0-9]{0,11}$'}, + } + + _attribute_map = { + "count": {"key": "count", "type": "int"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "os_disk_size_gb": {"key": "osDiskSizeGB", "type": "int"}, + "os_disk_type": {"key": "osDiskType", "type": "str"}, + "kubelet_disk_type": {"key": "kubeletDiskType", "type": "str"}, + "workload_runtime": {"key": "workloadRuntime", "type": "str"}, + "message_of_the_day": {"key": "messageOfTheDay", "type": "str"}, + "vnet_subnet_id": {"key": "vnetSubnetID", "type": "str"}, + "pod_subnet_id": {"key": "podSubnetID", "type": "str"}, + "max_pods": {"key": "maxPods", "type": "int"}, + "os_type": {"key": "osType", "type": "str"}, + "os_sku": {"key": "osSKU", "type": "str"}, + "max_count": {"key": "maxCount", "type": "int"}, + "min_count": {"key": "minCount", "type": "int"}, + "enable_auto_scaling": {"key": "enableAutoScaling", "type": "bool"}, + "scale_down_mode": {"key": "scaleDownMode", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "mode": {"key": "mode", "type": "str"}, + "orchestrator_version": {"key": "orchestratorVersion", "type": "str"}, + "current_orchestrator_version": {"key": "currentOrchestratorVersion", "type": "str"}, + "node_image_version": {"key": "nodeImageVersion", "type": "str"}, + "upgrade_settings": {"key": "upgradeSettings", "type": "AgentPoolUpgradeSettings"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "power_state": {"key": "powerState", "type": "PowerState"}, + "availability_zones": {"key": "availabilityZones", "type": "[str]"}, + "enable_node_public_ip": {"key": "enableNodePublicIP", "type": "bool"}, + "enable_custom_ca_trust": {"key": "enableCustomCATrust", "type": "bool"}, + "node_public_ip_prefix_id": {"key": "nodePublicIPPrefixID", "type": "str"}, + "scale_set_priority": {"key": "scaleSetPriority", "type": "str"}, + "scale_set_eviction_policy": {"key": "scaleSetEvictionPolicy", "type": "str"}, + "spot_max_price": {"key": "spotMaxPrice", "type": "float"}, + "tags": {"key": "tags", "type": "{str}"}, + "node_labels": {"key": "nodeLabels", "type": "{str}"}, + "node_taints": {"key": "nodeTaints", "type": "[str]"}, + "proximity_placement_group_id": {"key": "proximityPlacementGroupID", "type": "str"}, + "kubelet_config": {"key": "kubeletConfig", "type": "KubeletConfig"}, + "linux_os_config": {"key": "linuxOSConfig", "type": "LinuxOSConfig"}, + "enable_encryption_at_host": {"key": "enableEncryptionAtHost", "type": "bool"}, + "enable_ultra_ssd": {"key": "enableUltraSSD", "type": "bool"}, + "enable_fips": {"key": "enableFIPS", "type": "bool"}, + "gpu_instance_profile": {"key": "gpuInstanceProfile", "type": "str"}, + "creation_data": {"key": "creationData", "type": "CreationData"}, + "capacity_reservation_group_id": {"key": "capacityReservationGroupID", "type": "str"}, + "host_group_id": {"key": "hostGroupID", "type": "str"}, + "name": {"key": "name", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals + self, + *, + name: str, + count: Optional[int] = None, + vm_size: Optional[str] = None, + os_disk_size_gb: Optional[int] = None, + os_disk_type: Optional[Union[str, "_models.OSDiskType"]] = None, + kubelet_disk_type: Optional[Union[str, "_models.KubeletDiskType"]] = None, + workload_runtime: Optional[Union[str, "_models.WorkloadRuntime"]] = None, + message_of_the_day: Optional[str] = None, + vnet_subnet_id: Optional[str] = None, + pod_subnet_id: Optional[str] = None, + max_pods: Optional[int] = None, + os_type: Union[str, "_models.OSType"] = "Linux", + os_sku: Optional[Union[str, "_models.OSSKU"]] = None, + max_count: Optional[int] = None, + min_count: Optional[int] = None, + enable_auto_scaling: Optional[bool] = None, + scale_down_mode: Optional[Union[str, "_models.ScaleDownMode"]] = None, + type: Optional[Union[str, "_models.AgentPoolType"]] = None, + mode: Optional[Union[str, "_models.AgentPoolMode"]] = None, + orchestrator_version: Optional[str] = None, + upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, + power_state: Optional["_models.PowerState"] = None, + availability_zones: Optional[List[str]] = None, + enable_node_public_ip: Optional[bool] = None, + enable_custom_ca_trust: Optional[bool] = None, + node_public_ip_prefix_id: Optional[str] = None, + scale_set_priority: Union[str, "_models.ScaleSetPriority"] = "Regular", + scale_set_eviction_policy: Union[str, "_models.ScaleSetEvictionPolicy"] = "Delete", + spot_max_price: float = -1, + tags: Optional[Dict[str, str]] = None, + node_labels: Optional[Dict[str, str]] = None, + node_taints: Optional[List[str]] = None, + proximity_placement_group_id: Optional[str] = None, + kubelet_config: Optional["_models.KubeletConfig"] = None, + linux_os_config: Optional["_models.LinuxOSConfig"] = None, + enable_encryption_at_host: Optional[bool] = None, + enable_ultra_ssd: Optional[bool] = None, + enable_fips: Optional[bool] = None, + gpu_instance_profile: Optional[Union[str, "_models.GPUInstanceProfile"]] = None, + creation_data: Optional["_models.CreationData"] = None, + capacity_reservation_group_id: Optional[str] = None, + host_group_id: Optional[str] = None, + **kwargs + ): + """ + :keyword count: Number of agents (VMs) to host docker containers. Allowed values must be in the + range of 0 to 1000 (inclusive) for user pools and in the range of 1 to 1000 (inclusive) for + system pools. The default value is 1. + :paramtype count: int + :keyword vm_size: VM size availability varies by region. If a node contains insufficient + compute resources (memory, cpu, etc) pods might fail to run correctly. For more details on + restricted VM sizes, see: https://docs.microsoft.com/azure/aks/quotas-skus-regions. + :paramtype vm_size: str + :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every + machine in the master/agent pool. If you specify 0, it will apply the default osDisk size + according to the vmSize specified. + :paramtype os_disk_size_gb: int + :keyword os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk + larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed + after creation. For more information see `Ephemeral OS + `_. Known values are: + "Managed" and "Ephemeral". + :paramtype os_disk_type: str or + ~azure.mgmt.containerservice.v2022_07_02_preview.models.OSDiskType + :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime + data root, and Kubelet ephemeral storage. Known values are: "OS" and "Temporary". + :paramtype kubelet_disk_type: str or + ~azure.mgmt.containerservice.v2022_07_02_preview.models.KubeletDiskType + :keyword workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer" and "WasmWasi". + :paramtype workload_runtime: str or + ~azure.mgmt.containerservice.v2022_07_02_preview.models.WorkloadRuntime + :keyword message_of_the_day: A base64-encoded string which will be written to /etc/motd after + decoding. This allows customization of the message of the day for Linux nodes. It must not be + specified for Windows nodes. It must be a static string (i.e., will be printed raw and not be + executed as a script). + :paramtype message_of_the_day: str + :keyword vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and + used. If no podSubnetID is specified, this applies to nodes and pods, otherwise it applies to + just nodes. This is of the form: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. + :paramtype vnet_subnet_id: str + :keyword pod_subnet_id: If omitted, pod IPs are statically assigned on the node subnet (see + vnetSubnetID for more details). This is of the form: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. + :paramtype pod_subnet_id: str + :keyword max_pods: The maximum number of pods that can run on a node. + :paramtype max_pods: int + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". + :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_07_02_preview.models.OSType + :keyword os_sku: Specifies the OS SKU used by the agent pool. If not specified, the default is + Ubuntu if OSType=Linux or Windows2019 if OSType=Windows. And the default Windows OSSKU will be + changed to Windows2022 after Windows2019 is deprecated. Known values are: "Ubuntu", + "CBLMariner", "Windows2019", and "Windows2022". + :paramtype os_sku: str or ~azure.mgmt.containerservice.v2022_07_02_preview.models.OSSKU + :keyword max_count: The maximum number of nodes for auto-scaling. + :paramtype max_count: int + :keyword min_count: The minimum number of nodes for auto-scaling. + :paramtype min_count: int + :keyword enable_auto_scaling: Whether to enable auto-scaler. + :paramtype enable_auto_scaling: bool + :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, + it defaults to Delete. Known values are: "Delete" and "Deallocate". + :paramtype scale_down_mode: str or + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ScaleDownMode + :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets" and + "AvailabilitySet". + :paramtype type: str or ~azure.mgmt.containerservice.v2022_07_02_preview.models.AgentPoolType + :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For + additional information on agent pool restrictions and best practices, see: + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System" and "User". + :paramtype mode: str or ~azure.mgmt.containerservice.v2022_07_02_preview.models.AgentPoolMode + :keyword orchestrator_version: Both patch version and are + supported. When is specified, the latest supported patch version is chosen + automatically. Updating the agent pool with the same once it has been created + will not trigger an upgrade, even if a newer patch version is available. As a best practice, + you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node + pool version must have the same major version as the control plane. The node pool minor version + must be within two minor versions of the control plane version. The node pool version cannot be + greater than the control plane version. For more information see `upgrading a node pool + `_. + :paramtype orchestrator_version: str + :keyword upgrade_settings: Settings for upgrading the agentpool. + :paramtype upgrade_settings: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.AgentPoolUpgradeSettings + :keyword power_state: When an Agent Pool is first created it is initially Running. The Agent + Pool can be stopped by setting this field to Stopped. A stopped Agent Pool stops all of its VMs + and does not accrue billing charges. An Agent Pool can only be stopped if it is Running and + provisioning state is Succeeded. + :paramtype power_state: ~azure.mgmt.containerservice.v2022_07_02_preview.models.PowerState + :keyword availability_zones: The list of Availability zones to use for nodes. This can only be + specified if the AgentPoolType property is 'VirtualMachineScaleSets'. + :paramtype availability_zones: list[str] + :keyword enable_node_public_ip: Some scenarios may require nodes in a node pool to receive + their own dedicated public IP addresses. A common scenario is for gaming workloads, where a + console needs to make a direct connection to a cloud virtual machine to minimize hops. For more + information see `assigning a public IP per node + `_. + The default is false. + :paramtype enable_node_public_ip: bool + :keyword enable_custom_ca_trust: When set to true, AKS deploys a daemonset and host services to + sync custom certificate authorities from a user-provided config map into node trust stores. + Defaults to false. + :paramtype enable_custom_ca_trust: bool + :keyword node_public_ip_prefix_id: This is of the form: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. + :paramtype node_public_ip_prefix_id: str + :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the + default is 'Regular'. Known values are: "Spot" and "Regular". + :paramtype scale_set_priority: str or + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ScaleSetPriority + :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete" and "Deallocate". + :paramtype scale_set_eviction_policy: str or + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ScaleSetEvictionPolicy + :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which + indicates the willingness to pay any on-demand price. For more details on spot pricing, see + `spot VMs pricing `_. + :paramtype spot_max_price: float + :keyword tags: The tags to be persisted on the agent pool virtual machine scale set. + :paramtype tags: dict[str, str] + :keyword node_labels: The node labels to be persisted across all nodes in agent pool. + :paramtype node_labels: dict[str, str] + :keyword node_taints: The taints added to new nodes during node pool create and scale. For + example, key=value:NoSchedule. + :paramtype node_taints: list[str] + :keyword proximity_placement_group_id: The ID for Proximity Placement Group. + :paramtype proximity_placement_group_id: str + :keyword kubelet_config: The Kubelet configuration on the agent pool nodes. + :paramtype kubelet_config: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.KubeletConfig + :keyword linux_os_config: The OS configuration of Linux agent nodes. + :paramtype linux_os_config: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.LinuxOSConfig + :keyword enable_encryption_at_host: This is only supported on certain VM sizes and in certain + Azure regions. For more information, see: + https://docs.microsoft.com/azure/aks/enable-host-encryption. + :paramtype enable_encryption_at_host: bool + :keyword enable_ultra_ssd: Whether to enable UltraSSD. + :paramtype enable_ultra_ssd: bool + :keyword enable_fips: See `Add a FIPS-enabled node pool + `_ + for more details. + :paramtype enable_fips: bool + :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", and + "MIG7g". + :paramtype gpu_instance_profile: str or + ~azure.mgmt.containerservice.v2022_07_02_preview.models.GPUInstanceProfile + :keyword creation_data: CreationData to be used to specify the source Snapshot ID if the node + pool will be created/upgraded using a snapshot. + :paramtype creation_data: ~azure.mgmt.containerservice.v2022_07_02_preview.models.CreationData + :keyword capacity_reservation_group_id: AKS will associate the specified agent pool with the + Capacity Reservation Group. + :paramtype capacity_reservation_group_id: str + :keyword host_group_id: This is of the form: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}. + For more information see `Azure dedicated hosts + `_. + :paramtype host_group_id: str + :keyword name: Windows agent pool names must be 6 characters or less. Required. + :paramtype name: str + """ + super().__init__(count=count, vm_size=vm_size, os_disk_size_gb=os_disk_size_gb, os_disk_type=os_disk_type, kubelet_disk_type=kubelet_disk_type, workload_runtime=workload_runtime, message_of_the_day=message_of_the_day, vnet_subnet_id=vnet_subnet_id, pod_subnet_id=pod_subnet_id, max_pods=max_pods, os_type=os_type, os_sku=os_sku, max_count=max_count, min_count=min_count, enable_auto_scaling=enable_auto_scaling, scale_down_mode=scale_down_mode, type=type, mode=mode, orchestrator_version=orchestrator_version, upgrade_settings=upgrade_settings, power_state=power_state, availability_zones=availability_zones, enable_node_public_ip=enable_node_public_ip, enable_custom_ca_trust=enable_custom_ca_trust, node_public_ip_prefix_id=node_public_ip_prefix_id, scale_set_priority=scale_set_priority, scale_set_eviction_policy=scale_set_eviction_policy, spot_max_price=spot_max_price, tags=tags, node_labels=node_labels, node_taints=node_taints, proximity_placement_group_id=proximity_placement_group_id, kubelet_config=kubelet_config, linux_os_config=linux_os_config, enable_encryption_at_host=enable_encryption_at_host, enable_ultra_ssd=enable_ultra_ssd, enable_fips=enable_fips, gpu_instance_profile=gpu_instance_profile, creation_data=creation_data, capacity_reservation_group_id=capacity_reservation_group_id, host_group_id=host_group_id, **kwargs) + self.name = name + + +class ManagedClusterAPIServerAccessProfile(_serialization.Model): + """Access profile for managed cluster API server. + + :ivar authorized_ip_ranges: IP ranges are specified in CIDR format, e.g. 137.117.106.88/29. + This feature is not compatible with clusters that use Public IP Per Node, or clusters that are + using a Basic Load Balancer. For more information see `API server authorized IP ranges + `_. + :vartype authorized_ip_ranges: list[str] + :ivar enable_private_cluster: For more details, see `Creating a private AKS cluster + `_. + :vartype enable_private_cluster: bool + :ivar private_dns_zone: The default is System. For more details see `configure private DNS zone + `_. Allowed + values are 'system' and 'none'. + :vartype private_dns_zone: str + :ivar enable_private_cluster_public_fqdn: Whether to create additional public FQDN for private + cluster or not. + :vartype enable_private_cluster_public_fqdn: bool + :ivar disable_run_command: Whether to disable run command for the cluster or not. + :vartype disable_run_command: bool + :ivar enable_vnet_integration: Whether to enable apiserver vnet integration for the cluster or + not. + :vartype enable_vnet_integration: bool + :ivar subnet_id: It is required when: 1. creating a new cluster with BYO Vnet; 2. updating an + existing cluster to enable apiserver vnet integration. + :vartype subnet_id: str + """ + + _attribute_map = { + "authorized_ip_ranges": {"key": "authorizedIPRanges", "type": "[str]"}, + "enable_private_cluster": {"key": "enablePrivateCluster", "type": "bool"}, + "private_dns_zone": {"key": "privateDNSZone", "type": "str"}, + "enable_private_cluster_public_fqdn": {"key": "enablePrivateClusterPublicFQDN", "type": "bool"}, + "disable_run_command": {"key": "disableRunCommand", "type": "bool"}, + "enable_vnet_integration": {"key": "enableVnetIntegration", "type": "bool"}, + "subnet_id": {"key": "subnetId", "type": "str"}, + } + + def __init__( + self, + *, + authorized_ip_ranges: Optional[List[str]] = None, + enable_private_cluster: Optional[bool] = None, + private_dns_zone: Optional[str] = None, + enable_private_cluster_public_fqdn: Optional[bool] = None, + disable_run_command: Optional[bool] = None, + enable_vnet_integration: Optional[bool] = None, + subnet_id: Optional[str] = None, + **kwargs + ): + """ + :keyword authorized_ip_ranges: IP ranges are specified in CIDR format, e.g. 137.117.106.88/29. + This feature is not compatible with clusters that use Public IP Per Node, or clusters that are + using a Basic Load Balancer. For more information see `API server authorized IP ranges + `_. + :paramtype authorized_ip_ranges: list[str] + :keyword enable_private_cluster: For more details, see `Creating a private AKS cluster + `_. + :paramtype enable_private_cluster: bool + :keyword private_dns_zone: The default is System. For more details see `configure private DNS + zone `_. + Allowed values are 'system' and 'none'. + :paramtype private_dns_zone: str + :keyword enable_private_cluster_public_fqdn: Whether to create additional public FQDN for + private cluster or not. + :paramtype enable_private_cluster_public_fqdn: bool + :keyword disable_run_command: Whether to disable run command for the cluster or not. + :paramtype disable_run_command: bool + :keyword enable_vnet_integration: Whether to enable apiserver vnet integration for the cluster + or not. + :paramtype enable_vnet_integration: bool + :keyword subnet_id: It is required when: 1. creating a new cluster with BYO Vnet; 2. updating + an existing cluster to enable apiserver vnet integration. + :paramtype subnet_id: str + """ + super().__init__(**kwargs) + self.authorized_ip_ranges = authorized_ip_ranges + self.enable_private_cluster = enable_private_cluster + self.private_dns_zone = private_dns_zone + self.enable_private_cluster_public_fqdn = enable_private_cluster_public_fqdn + self.disable_run_command = disable_run_command + self.enable_vnet_integration = enable_vnet_integration + self.subnet_id = subnet_id + + +class ManagedClusterAutoUpgradeProfile(_serialization.Model): + """Auto upgrade profile for a managed cluster. + + :ivar upgrade_channel: For more information see `setting the AKS cluster auto-upgrade channel + `_. Known values + are: "rapid", "stable", "patch", "node-image", and "none". + :vartype upgrade_channel: str or + ~azure.mgmt.containerservice.v2022_07_02_preview.models.UpgradeChannel + """ + + _attribute_map = { + "upgrade_channel": {"key": "upgradeChannel", "type": "str"}, + } + + def __init__( + self, + *, + upgrade_channel: Optional[Union[str, "_models.UpgradeChannel"]] = None, + **kwargs + ): + """ + :keyword upgrade_channel: For more information see `setting the AKS cluster auto-upgrade + channel `_. + Known values are: "rapid", "stable", "patch", "node-image", and "none". + :paramtype upgrade_channel: str or + ~azure.mgmt.containerservice.v2022_07_02_preview.models.UpgradeChannel + """ + super().__init__(**kwargs) + self.upgrade_channel = upgrade_channel + + +class ManagedClusterAzureMonitorProfile(_serialization.Model): + """Prometheus addon profile for the container service cluster. + + :ivar metrics: Metrics profile for the prometheus service addon. + :vartype metrics: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterAzureMonitorProfileMetrics + """ + + _attribute_map = { + "metrics": {"key": "metrics", "type": "ManagedClusterAzureMonitorProfileMetrics"}, + } + + def __init__( + self, + *, + metrics: Optional["_models.ManagedClusterAzureMonitorProfileMetrics"] = None, + **kwargs + ): + """ + :keyword metrics: Metrics profile for the prometheus service addon. + :paramtype metrics: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterAzureMonitorProfileMetrics + """ + super().__init__(**kwargs) + self.metrics = metrics + + +class ManagedClusterAzureMonitorProfileKubeStateMetrics(_serialization.Model): + """Kube State Metrics for prometheus addon profile for the container service cluster. + + :ivar metric_labels_allowlist: Comma-separated list of Kubernetes annotations keys that will be + used in the resource's labels metric. + :vartype metric_labels_allowlist: str + :ivar metric_annotations_allow_list: Comma-separated list of additional Kubernetes label keys + that will be used in the resource's labels metric. + :vartype metric_annotations_allow_list: str + """ + + _attribute_map = { + "metric_labels_allowlist": {"key": "metricLabelsAllowlist", "type": "str"}, + "metric_annotations_allow_list": {"key": "metricAnnotationsAllowList", "type": "str"}, + } + + def __init__( + self, + *, + metric_labels_allowlist: Optional[str] = None, + metric_annotations_allow_list: Optional[str] = None, + **kwargs + ): + """ + :keyword metric_labels_allowlist: Comma-separated list of Kubernetes annotations keys that will + be used in the resource's labels metric. + :paramtype metric_labels_allowlist: str + :keyword metric_annotations_allow_list: Comma-separated list of additional Kubernetes label + keys that will be used in the resource's labels metric. + :paramtype metric_annotations_allow_list: str + """ + super().__init__(**kwargs) + self.metric_labels_allowlist = metric_labels_allowlist + self.metric_annotations_allow_list = metric_annotations_allow_list + + +class ManagedClusterAzureMonitorProfileMetrics(_serialization.Model): + """Metrics profile for the prometheus service addon. + + All required parameters must be populated in order to send to Azure. + + :ivar enabled: Whether to enable the Prometheus collector. Required. + :vartype enabled: bool + :ivar kube_state_metrics: Kube State Metrics for prometheus addon profile for the container + service cluster. + :vartype kube_state_metrics: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterAzureMonitorProfileKubeStateMetrics + """ + + _validation = { + 'enabled': {'required': True}, + } + + _attribute_map = { + "enabled": {"key": "enabled", "type": "bool"}, + "kube_state_metrics": {"key": "kubeStateMetrics", "type": "ManagedClusterAzureMonitorProfileKubeStateMetrics"}, + } + + def __init__( + self, + *, + enabled: bool, + kube_state_metrics: Optional["_models.ManagedClusterAzureMonitorProfileKubeStateMetrics"] = None, + **kwargs + ): + """ + :keyword enabled: Whether to enable the Prometheus collector. Required. + :paramtype enabled: bool + :keyword kube_state_metrics: Kube State Metrics for prometheus addon profile for the container + service cluster. + :paramtype kube_state_metrics: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterAzureMonitorProfileKubeStateMetrics + """ + super().__init__(**kwargs) + self.enabled = enabled + self.kube_state_metrics = kube_state_metrics + + +class ManagedClusterHTTPProxyConfig(_serialization.Model): + """Cluster HTTP proxy configuration. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar http_proxy: The HTTP proxy server endpoint to use. + :vartype http_proxy: str + :ivar https_proxy: The HTTPS proxy server endpoint to use. + :vartype https_proxy: str + :ivar no_proxy: The endpoints that should not go through proxy. + :vartype no_proxy: list[str] + :ivar effective_no_proxy: A read-only list of all endpoints for which traffic should not be + sent to the proxy. This list is a superset of noProxy and values injected by AKS. + :vartype effective_no_proxy: list[str] + :ivar trusted_ca: Alternative CA cert to use for connecting to proxy servers. + :vartype trusted_ca: str + """ + + _validation = { + 'effective_no_proxy': {'readonly': True}, + } + + _attribute_map = { + "http_proxy": {"key": "httpProxy", "type": "str"}, + "https_proxy": {"key": "httpsProxy", "type": "str"}, + "no_proxy": {"key": "noProxy", "type": "[str]"}, + "effective_no_proxy": {"key": "effectiveNoProxy", "type": "[str]"}, + "trusted_ca": {"key": "trustedCa", "type": "str"}, + } + + def __init__( + self, + *, + http_proxy: Optional[str] = None, + https_proxy: Optional[str] = None, + no_proxy: Optional[List[str]] = None, + trusted_ca: Optional[str] = None, + **kwargs + ): + """ + :keyword http_proxy: The HTTP proxy server endpoint to use. + :paramtype http_proxy: str + :keyword https_proxy: The HTTPS proxy server endpoint to use. + :paramtype https_proxy: str + :keyword no_proxy: The endpoints that should not go through proxy. + :paramtype no_proxy: list[str] + :keyword trusted_ca: Alternative CA cert to use for connecting to proxy servers. + :paramtype trusted_ca: str + """ + super().__init__(**kwargs) + self.http_proxy = http_proxy + self.https_proxy = https_proxy + self.no_proxy = no_proxy + self.effective_no_proxy = None + self.trusted_ca = trusted_ca + + +class ManagedClusterIdentity(_serialization.Model): + """Identity for the managed cluster. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The principal id of the system assigned identity which is used by master + components. + :vartype principal_id: str + :ivar tenant_id: The tenant id of the system assigned identity which is used by master + components. + :vartype tenant_id: str + :ivar type: For more information see `use managed identities in AKS + `_. Known values are: + "SystemAssigned", "UserAssigned", and "None". + :vartype type: str or + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ResourceIdentityType + :ivar user_assigned_identities: The keys must be ARM resource IDs in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + :vartype user_assigned_identities: dict[str, + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedServiceIdentityUserAssignedIdentitiesValue] + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'tenant_id': {'readonly': True}, + } + + _attribute_map = { + "principal_id": {"key": "principalId", "type": "str"}, + "tenant_id": {"key": "tenantId", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "user_assigned_identities": {"key": "userAssignedIdentities", "type": "{ManagedServiceIdentityUserAssignedIdentitiesValue}"}, + } + + def __init__( + self, + *, + type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, + user_assigned_identities: Optional[Dict[str, "_models.ManagedServiceIdentityUserAssignedIdentitiesValue"]] = None, + **kwargs + ): + """ + :keyword type: For more information see `use managed identities in AKS + `_. Known values are: + "SystemAssigned", "UserAssigned", and "None". + :paramtype type: str or + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ResourceIdentityType + :keyword user_assigned_identities: The keys must be ARM resource IDs in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + :paramtype user_assigned_identities: dict[str, + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedServiceIdentityUserAssignedIdentitiesValue] + """ + super().__init__(**kwargs) + self.principal_id = None + self.tenant_id = None + self.type = type + self.user_assigned_identities = user_assigned_identities + + +class ManagedClusterIngressProfile(_serialization.Model): + """Ingress profile for the container service cluster. + + :ivar web_app_routing: Web App Routing settings for the ingress profile. + :vartype web_app_routing: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterIngressProfileWebAppRouting + """ + + _attribute_map = { + "web_app_routing": {"key": "webAppRouting", "type": "ManagedClusterIngressProfileWebAppRouting"}, + } + + def __init__( + self, + *, + web_app_routing: Optional["_models.ManagedClusterIngressProfileWebAppRouting"] = None, + **kwargs + ): + """ + :keyword web_app_routing: Web App Routing settings for the ingress profile. + :paramtype web_app_routing: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterIngressProfileWebAppRouting + """ + super().__init__(**kwargs) + self.web_app_routing = web_app_routing + + +class ManagedClusterIngressProfileWebAppRouting(_serialization.Model): + """Web App Routing settings for the ingress profile. + + :ivar enabled: Whether to enable Web App Routing. + :vartype enabled: bool + :ivar dns_zone_resource_id: Resource ID of the DNS Zone to be associated with the web app. Used + only when Web App Routing is enabled. + :vartype dns_zone_resource_id: str + """ + + _attribute_map = { + "enabled": {"key": "enabled", "type": "bool"}, + "dns_zone_resource_id": {"key": "dnsZoneResourceId", "type": "str"}, + } + + def __init__( + self, + *, + enabled: Optional[bool] = None, + dns_zone_resource_id: Optional[str] = None, + **kwargs + ): + """ + :keyword enabled: Whether to enable Web App Routing. + :paramtype enabled: bool + :keyword dns_zone_resource_id: Resource ID of the DNS Zone to be associated with the web app. + Used only when Web App Routing is enabled. + :paramtype dns_zone_resource_id: str + """ + super().__init__(**kwargs) + self.enabled = enabled + self.dns_zone_resource_id = dns_zone_resource_id + + +class ManagedClusterListResult(_serialization.Model): + """The response from the List Managed Clusters operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The list of managed clusters. + :vartype value: list[~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedCluster] + :ivar next_link: The URL to get the next set of managed cluster results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[ManagedCluster]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.ManagedCluster"]] = None, + **kwargs + ): + """ + :keyword value: The list of managed clusters. + :paramtype value: list[~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedCluster] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class ManagedClusterLoadBalancerProfile(_serialization.Model): + """Profile of the managed cluster load balancer. + + :ivar managed_outbound_i_ps: Desired managed outbound IPs for the cluster load balancer. + :vartype managed_outbound_i_ps: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterLoadBalancerProfileManagedOutboundIPs + :ivar outbound_ip_prefixes: Desired outbound IP Prefix resources for the cluster load balancer. + :vartype outbound_ip_prefixes: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterLoadBalancerProfileOutboundIPPrefixes + :ivar outbound_i_ps: Desired outbound IP resources for the cluster load balancer. + :vartype outbound_i_ps: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterLoadBalancerProfileOutboundIPs + :ivar effective_outbound_i_ps: The effective outbound IP resources of the cluster load + balancer. + :vartype effective_outbound_i_ps: + list[~azure.mgmt.containerservice.v2022_07_02_preview.models.ResourceReference] + :ivar allocated_outbound_ports: The desired number of allocated SNAT ports per VM. Allowed + values are in the range of 0 to 64000 (inclusive). The default value is 0 which results in + Azure dynamically allocating ports. + :vartype allocated_outbound_ports: int + :ivar idle_timeout_in_minutes: Desired outbound flow idle timeout in minutes. Allowed values + are in the range of 4 to 120 (inclusive). The default value is 30 minutes. + :vartype idle_timeout_in_minutes: int + :ivar enable_multiple_standard_load_balancers: Enable multiple standard load balancers per AKS + cluster or not. + :vartype enable_multiple_standard_load_balancers: bool + """ + + _validation = { + 'allocated_outbound_ports': {'maximum': 64000, 'minimum': 0}, + 'idle_timeout_in_minutes': {'maximum': 120, 'minimum': 4}, + } + + _attribute_map = { + "managed_outbound_i_ps": {"key": "managedOutboundIPs", "type": "ManagedClusterLoadBalancerProfileManagedOutboundIPs"}, + "outbound_ip_prefixes": {"key": "outboundIPPrefixes", "type": "ManagedClusterLoadBalancerProfileOutboundIPPrefixes"}, + "outbound_i_ps": {"key": "outboundIPs", "type": "ManagedClusterLoadBalancerProfileOutboundIPs"}, + "effective_outbound_i_ps": {"key": "effectiveOutboundIPs", "type": "[ResourceReference]"}, + "allocated_outbound_ports": {"key": "allocatedOutboundPorts", "type": "int"}, + "idle_timeout_in_minutes": {"key": "idleTimeoutInMinutes", "type": "int"}, + "enable_multiple_standard_load_balancers": {"key": "enableMultipleStandardLoadBalancers", "type": "bool"}, + } + + def __init__( + self, + *, + managed_outbound_i_ps: Optional["_models.ManagedClusterLoadBalancerProfileManagedOutboundIPs"] = None, + outbound_ip_prefixes: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPPrefixes"] = None, + outbound_i_ps: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPs"] = None, + effective_outbound_i_ps: Optional[List["_models.ResourceReference"]] = None, + allocated_outbound_ports: int = 0, + idle_timeout_in_minutes: int = 30, + enable_multiple_standard_load_balancers: Optional[bool] = None, + **kwargs + ): + """ + :keyword managed_outbound_i_ps: Desired managed outbound IPs for the cluster load balancer. + :paramtype managed_outbound_i_ps: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterLoadBalancerProfileManagedOutboundIPs + :keyword outbound_ip_prefixes: Desired outbound IP Prefix resources for the cluster load + balancer. + :paramtype outbound_ip_prefixes: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterLoadBalancerProfileOutboundIPPrefixes + :keyword outbound_i_ps: Desired outbound IP resources for the cluster load balancer. + :paramtype outbound_i_ps: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterLoadBalancerProfileOutboundIPs + :keyword effective_outbound_i_ps: The effective outbound IP resources of the cluster load + balancer. + :paramtype effective_outbound_i_ps: + list[~azure.mgmt.containerservice.v2022_07_02_preview.models.ResourceReference] + :keyword allocated_outbound_ports: The desired number of allocated SNAT ports per VM. Allowed + values are in the range of 0 to 64000 (inclusive). The default value is 0 which results in + Azure dynamically allocating ports. + :paramtype allocated_outbound_ports: int + :keyword idle_timeout_in_minutes: Desired outbound flow idle timeout in minutes. Allowed values + are in the range of 4 to 120 (inclusive). The default value is 30 minutes. + :paramtype idle_timeout_in_minutes: int + :keyword enable_multiple_standard_load_balancers: Enable multiple standard load balancers per + AKS cluster or not. + :paramtype enable_multiple_standard_load_balancers: bool + """ + super().__init__(**kwargs) + self.managed_outbound_i_ps = managed_outbound_i_ps + self.outbound_ip_prefixes = outbound_ip_prefixes + self.outbound_i_ps = outbound_i_ps + self.effective_outbound_i_ps = effective_outbound_i_ps + self.allocated_outbound_ports = allocated_outbound_ports + self.idle_timeout_in_minutes = idle_timeout_in_minutes + self.enable_multiple_standard_load_balancers = enable_multiple_standard_load_balancers + + +class ManagedClusterLoadBalancerProfileManagedOutboundIPs(_serialization.Model): + """Desired managed outbound IPs for the cluster load balancer. + + :ivar count: The desired number of IPv4 outbound IPs created/managed by Azure for the cluster + load balancer. Allowed values must be in the range of 1 to 100 (inclusive). The default value + is 1. + :vartype count: int + :ivar count_ipv6: The desired number of IPv6 outbound IPs created/managed by Azure for the + cluster load balancer. Allowed values must be in the range of 1 to 100 (inclusive). The default + value is 0 for single-stack and 1 for dual-stack. + :vartype count_ipv6: int + """ + + _validation = { + 'count': {'maximum': 100, 'minimum': 1}, + 'count_ipv6': {'maximum': 100, 'minimum': 0}, + } + + _attribute_map = { + "count": {"key": "count", "type": "int"}, + "count_ipv6": {"key": "countIPv6", "type": "int"}, + } + + def __init__( + self, + *, + count: int = 1, + count_ipv6: int = 0, + **kwargs + ): + """ + :keyword count: The desired number of IPv4 outbound IPs created/managed by Azure for the + cluster load balancer. Allowed values must be in the range of 1 to 100 (inclusive). The default + value is 1. + :paramtype count: int + :keyword count_ipv6: The desired number of IPv6 outbound IPs created/managed by Azure for the + cluster load balancer. Allowed values must be in the range of 1 to 100 (inclusive). The default + value is 0 for single-stack and 1 for dual-stack. + :paramtype count_ipv6: int + """ + super().__init__(**kwargs) + self.count = count + self.count_ipv6 = count_ipv6 + + +class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(_serialization.Model): + """Desired outbound IP Prefix resources for the cluster load balancer. + + :ivar public_ip_prefixes: A list of public IP prefix resources. + :vartype public_ip_prefixes: + list[~azure.mgmt.containerservice.v2022_07_02_preview.models.ResourceReference] + """ + + _attribute_map = { + "public_ip_prefixes": {"key": "publicIPPrefixes", "type": "[ResourceReference]"}, + } + + def __init__( + self, + *, + public_ip_prefixes: Optional[List["_models.ResourceReference"]] = None, + **kwargs + ): + """ + :keyword public_ip_prefixes: A list of public IP prefix resources. + :paramtype public_ip_prefixes: + list[~azure.mgmt.containerservice.v2022_07_02_preview.models.ResourceReference] + """ + super().__init__(**kwargs) + self.public_ip_prefixes = public_ip_prefixes + + +class ManagedClusterLoadBalancerProfileOutboundIPs(_serialization.Model): + """Desired outbound IP resources for the cluster load balancer. + + :ivar public_i_ps: A list of public IP resources. + :vartype public_i_ps: + list[~azure.mgmt.containerservice.v2022_07_02_preview.models.ResourceReference] + """ + + _attribute_map = { + "public_i_ps": {"key": "publicIPs", "type": "[ResourceReference]"}, + } + + def __init__( + self, + *, + public_i_ps: Optional[List["_models.ResourceReference"]] = None, + **kwargs + ): + """ + :keyword public_i_ps: A list of public IP resources. + :paramtype public_i_ps: + list[~azure.mgmt.containerservice.v2022_07_02_preview.models.ResourceReference] + """ + super().__init__(**kwargs) + self.public_i_ps = public_i_ps + + +class ManagedClusterManagedOutboundIPProfile(_serialization.Model): + """Profile of the managed outbound IP resources of the managed cluster. + + :ivar count: The desired number of outbound IPs created/managed by Azure. Allowed values must + be in the range of 1 to 16 (inclusive). The default value is 1. + :vartype count: int + """ + + _validation = { + 'count': {'maximum': 16, 'minimum': 1}, + } + + _attribute_map = { + "count": {"key": "count", "type": "int"}, + } + + def __init__( + self, + *, + count: int = 1, + **kwargs + ): + """ + :keyword count: The desired number of outbound IPs created/managed by Azure. Allowed values + must be in the range of 1 to 16 (inclusive). The default value is 1. + :paramtype count: int + """ + super().__init__(**kwargs) + self.count = count + + +class ManagedClusterNATGatewayProfile(_serialization.Model): + """Profile of the managed cluster NAT gateway. + + :ivar managed_outbound_ip_profile: Profile of the managed outbound IP resources of the cluster + NAT gateway. + :vartype managed_outbound_ip_profile: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterManagedOutboundIPProfile + :ivar effective_outbound_i_ps: The effective outbound IP resources of the cluster NAT gateway. + :vartype effective_outbound_i_ps: + list[~azure.mgmt.containerservice.v2022_07_02_preview.models.ResourceReference] + :ivar idle_timeout_in_minutes: Desired outbound flow idle timeout in minutes. Allowed values + are in the range of 4 to 120 (inclusive). The default value is 4 minutes. + :vartype idle_timeout_in_minutes: int + """ + + _validation = { + 'idle_timeout_in_minutes': {'maximum': 120, 'minimum': 4}, + } + + _attribute_map = { + "managed_outbound_ip_profile": {"key": "managedOutboundIPProfile", "type": "ManagedClusterManagedOutboundIPProfile"}, + "effective_outbound_i_ps": {"key": "effectiveOutboundIPs", "type": "[ResourceReference]"}, + "idle_timeout_in_minutes": {"key": "idleTimeoutInMinutes", "type": "int"}, + } + + def __init__( + self, + *, + managed_outbound_ip_profile: Optional["_models.ManagedClusterManagedOutboundIPProfile"] = None, + effective_outbound_i_ps: Optional[List["_models.ResourceReference"]] = None, + idle_timeout_in_minutes: int = 4, + **kwargs + ): + """ + :keyword managed_outbound_ip_profile: Profile of the managed outbound IP resources of the + cluster NAT gateway. + :paramtype managed_outbound_ip_profile: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterManagedOutboundIPProfile + :keyword effective_outbound_i_ps: The effective outbound IP resources of the cluster NAT + gateway. + :paramtype effective_outbound_i_ps: + list[~azure.mgmt.containerservice.v2022_07_02_preview.models.ResourceReference] + :keyword idle_timeout_in_minutes: Desired outbound flow idle timeout in minutes. Allowed values + are in the range of 4 to 120 (inclusive). The default value is 4 minutes. + :paramtype idle_timeout_in_minutes: int + """ + super().__init__(**kwargs) + self.managed_outbound_ip_profile = managed_outbound_ip_profile + self.effective_outbound_i_ps = effective_outbound_i_ps + self.idle_timeout_in_minutes = idle_timeout_in_minutes + + +class ManagedClusterOIDCIssuerProfile(_serialization.Model): + """The OIDC issuer profile of the Managed Cluster. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar issuer_url: The OIDC issuer url of the Managed Cluster. + :vartype issuer_url: str + :ivar enabled: Whether the OIDC issuer is enabled. + :vartype enabled: bool + """ + + _validation = { + 'issuer_url': {'readonly': True}, + } + + _attribute_map = { + "issuer_url": {"key": "issuerURL", "type": "str"}, + "enabled": {"key": "enabled", "type": "bool"}, + } + + def __init__( + self, + *, + enabled: Optional[bool] = None, + **kwargs + ): + """ + :keyword enabled: Whether the OIDC issuer is enabled. + :paramtype enabled: bool + """ + super().__init__(**kwargs) + self.issuer_url = None + self.enabled = enabled + + +class ManagedClusterPodIdentity(_serialization.Model): + """Details about the pod identity assigned to the Managed Cluster. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar name: The name of the pod identity. Required. + :vartype name: str + :ivar namespace: The namespace of the pod identity. Required. + :vartype namespace: str + :ivar binding_selector: The binding selector to use for the AzureIdentityBinding resource. + :vartype binding_selector: str + :ivar identity: The user assigned identity details. Required. + :vartype identity: ~azure.mgmt.containerservice.v2022_07_02_preview.models.UserAssignedIdentity + :ivar provisioning_state: The current provisioning state of the pod identity. Known values are: + "Assigned", "Updating", "Deleting", and "Failed". + :vartype provisioning_state: str or + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterPodIdentityProvisioningState + :ivar provisioning_info: + :vartype provisioning_info: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterPodIdentityProvisioningInfo + """ + + _validation = { + 'name': {'required': True}, + 'namespace': {'required': True}, + 'identity': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'provisioning_info': {'readonly': True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "namespace": {"key": "namespace", "type": "str"}, + "binding_selector": {"key": "bindingSelector", "type": "str"}, + "identity": {"key": "identity", "type": "UserAssignedIdentity"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "provisioning_info": {"key": "provisioningInfo", "type": "ManagedClusterPodIdentityProvisioningInfo"}, + } + + def __init__( + self, + *, + name: str, + namespace: str, + identity: "_models.UserAssignedIdentity", + binding_selector: Optional[str] = None, + **kwargs + ): + """ + :keyword name: The name of the pod identity. Required. + :paramtype name: str + :keyword namespace: The namespace of the pod identity. Required. + :paramtype namespace: str + :keyword binding_selector: The binding selector to use for the AzureIdentityBinding resource. + :paramtype binding_selector: str + :keyword identity: The user assigned identity details. Required. + :paramtype identity: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.UserAssignedIdentity + """ + super().__init__(**kwargs) + self.name = name + self.namespace = namespace + self.binding_selector = binding_selector + self.identity = identity + self.provisioning_state = None + self.provisioning_info = None + + +class ManagedClusterPodIdentityException(_serialization.Model): + """See `disable AAD Pod Identity for a specific Pod/Application `_ for more details. + + All required parameters must be populated in order to send to Azure. + + :ivar name: The name of the pod identity exception. Required. + :vartype name: str + :ivar namespace: The namespace of the pod identity exception. Required. + :vartype namespace: str + :ivar pod_labels: The pod labels to match. Required. + :vartype pod_labels: dict[str, str] + """ + + _validation = { + 'name': {'required': True}, + 'namespace': {'required': True}, + 'pod_labels': {'required': True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "namespace": {"key": "namespace", "type": "str"}, + "pod_labels": {"key": "podLabels", "type": "{str}"}, + } + + def __init__( + self, + *, + name: str, + namespace: str, + pod_labels: Dict[str, str], + **kwargs + ): + """ + :keyword name: The name of the pod identity exception. Required. + :paramtype name: str + :keyword namespace: The namespace of the pod identity exception. Required. + :paramtype namespace: str + :keyword pod_labels: The pod labels to match. Required. + :paramtype pod_labels: dict[str, str] + """ + super().__init__(**kwargs) + self.name = name + self.namespace = namespace + self.pod_labels = pod_labels + + +class ManagedClusterPodIdentityProfile(_serialization.Model): + """See `use AAD pod identity `_ for more details on pod identity integration. + + :ivar enabled: Whether the pod identity addon is enabled. + :vartype enabled: bool + :ivar allow_network_plugin_kubenet: Running in Kubenet is disabled by default due to the + security related nature of AAD Pod Identity and the risks of IP spoofing. See `using Kubenet + network plugin with AAD Pod Identity + `_ + for more information. + :vartype allow_network_plugin_kubenet: bool + :ivar user_assigned_identities: The pod identities to use in the cluster. + :vartype user_assigned_identities: + list[~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterPodIdentity] + :ivar user_assigned_identity_exceptions: The pod identity exceptions to allow. + :vartype user_assigned_identity_exceptions: + list[~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterPodIdentityException] + """ + + _attribute_map = { + "enabled": {"key": "enabled", "type": "bool"}, + "allow_network_plugin_kubenet": {"key": "allowNetworkPluginKubenet", "type": "bool"}, + "user_assigned_identities": {"key": "userAssignedIdentities", "type": "[ManagedClusterPodIdentity]"}, + "user_assigned_identity_exceptions": {"key": "userAssignedIdentityExceptions", "type": "[ManagedClusterPodIdentityException]"}, + } + + def __init__( + self, + *, + enabled: Optional[bool] = None, + allow_network_plugin_kubenet: Optional[bool] = None, + user_assigned_identities: Optional[List["_models.ManagedClusterPodIdentity"]] = None, + user_assigned_identity_exceptions: Optional[List["_models.ManagedClusterPodIdentityException"]] = None, + **kwargs + ): + """ + :keyword enabled: Whether the pod identity addon is enabled. + :paramtype enabled: bool + :keyword allow_network_plugin_kubenet: Running in Kubenet is disabled by default due to the + security related nature of AAD Pod Identity and the risks of IP spoofing. See `using Kubenet + network plugin with AAD Pod Identity + `_ + for more information. + :paramtype allow_network_plugin_kubenet: bool + :keyword user_assigned_identities: The pod identities to use in the cluster. + :paramtype user_assigned_identities: + list[~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterPodIdentity] + :keyword user_assigned_identity_exceptions: The pod identity exceptions to allow. + :paramtype user_assigned_identity_exceptions: + list[~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterPodIdentityException] + """ + super().__init__(**kwargs) + self.enabled = enabled + self.allow_network_plugin_kubenet = allow_network_plugin_kubenet + self.user_assigned_identities = user_assigned_identities + self.user_assigned_identity_exceptions = user_assigned_identity_exceptions + + +class ManagedClusterPodIdentityProvisioningError(_serialization.Model): + """An error response from the pod identity provisioning. + + :ivar error: Details about the error. + :vartype error: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterPodIdentityProvisioningErrorBody + """ + + _attribute_map = { + "error": {"key": "error", "type": "ManagedClusterPodIdentityProvisioningErrorBody"}, + } + + def __init__( + self, + *, + error: Optional["_models.ManagedClusterPodIdentityProvisioningErrorBody"] = None, + **kwargs + ): + """ + :keyword error: Details about the error. + :paramtype error: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterPodIdentityProvisioningErrorBody + """ + super().__init__(**kwargs) + self.error = error + + +class ManagedClusterPodIdentityProvisioningErrorBody(_serialization.Model): + """An error response from the pod identity provisioning. + + :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. + :vartype code: str + :ivar message: A message describing the error, intended to be suitable for display in a user + interface. + :vartype message: str + :ivar target: The target of the particular error. For example, the name of the property in + error. + :vartype target: str + :ivar details: A list of additional details about the error. + :vartype details: + list[~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterPodIdentityProvisioningErrorBody] + """ + + _attribute_map = { + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[ManagedClusterPodIdentityProvisioningErrorBody]"}, + } + + def __init__( + self, + *, + code: Optional[str] = None, + message: Optional[str] = None, + target: Optional[str] = None, + details: Optional[List["_models.ManagedClusterPodIdentityProvisioningErrorBody"]] = None, + **kwargs + ): + """ + :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. + :paramtype code: str + :keyword message: A message describing the error, intended to be suitable for display in a user + interface. + :paramtype message: str + :keyword target: The target of the particular error. For example, the name of the property in + error. + :paramtype target: str + :keyword details: A list of additional details about the error. + :paramtype details: + list[~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterPodIdentityProvisioningErrorBody] + """ + super().__init__(**kwargs) + self.code = code + self.message = message + self.target = target + self.details = details + + +class ManagedClusterPodIdentityProvisioningInfo(_serialization.Model): + """ManagedClusterPodIdentityProvisioningInfo. + + :ivar error: Pod identity assignment error (if any). + :vartype error: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterPodIdentityProvisioningError + """ + + _attribute_map = { + "error": {"key": "error", "type": "ManagedClusterPodIdentityProvisioningError"}, + } + + def __init__( + self, + *, + error: Optional["_models.ManagedClusterPodIdentityProvisioningError"] = None, + **kwargs + ): + """ + :keyword error: Pod identity assignment error (if any). + :paramtype error: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterPodIdentityProvisioningError + """ + super().__init__(**kwargs) + self.error = error + + +class ManagedClusterPoolUpgradeProfile(_serialization.Model): + """The list of available upgrade versions. + + All required parameters must be populated in order to send to Azure. + + :ivar kubernetes_version: The Kubernetes version (major.minor.patch). Required. + :vartype kubernetes_version: str + :ivar name: The Agent Pool name. + :vartype name: str + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux" and + "Windows". + :vartype os_type: str or ~azure.mgmt.containerservice.v2022_07_02_preview.models.OSType + :ivar upgrades: List of orchestrator types and versions available for upgrade. + :vartype upgrades: + list[~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterPoolUpgradeProfileUpgradesItem] + """ + + _validation = { + 'kubernetes_version': {'required': True}, + 'os_type': {'required': True}, + } + + _attribute_map = { + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "os_type": {"key": "osType", "type": "str"}, + "upgrades": {"key": "upgrades", "type": "[ManagedClusterPoolUpgradeProfileUpgradesItem]"}, + } + + def __init__( + self, + *, + kubernetes_version: str, + os_type: Union[str, "_models.OSType"] = "Linux", + name: Optional[str] = None, + upgrades: Optional[List["_models.ManagedClusterPoolUpgradeProfileUpgradesItem"]] = None, + **kwargs + ): + """ + :keyword kubernetes_version: The Kubernetes version (major.minor.patch). Required. + :paramtype kubernetes_version: str + :keyword name: The Agent Pool name. + :paramtype name: str + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux" + and "Windows". + :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_07_02_preview.models.OSType + :keyword upgrades: List of orchestrator types and versions available for upgrade. + :paramtype upgrades: + list[~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterPoolUpgradeProfileUpgradesItem] + """ + super().__init__(**kwargs) + self.kubernetes_version = kubernetes_version + self.name = name + self.os_type = os_type + self.upgrades = upgrades + + +class ManagedClusterPoolUpgradeProfileUpgradesItem(_serialization.Model): + """ManagedClusterPoolUpgradeProfileUpgradesItem. + + :ivar kubernetes_version: The Kubernetes version (major.minor.patch). + :vartype kubernetes_version: str + :ivar is_preview: Whether the Kubernetes version is currently in preview. + :vartype is_preview: bool + """ + + _attribute_map = { + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, + } + + def __init__( + self, + *, + kubernetes_version: Optional[str] = None, + is_preview: Optional[bool] = None, + **kwargs + ): + """ + :keyword kubernetes_version: The Kubernetes version (major.minor.patch). + :paramtype kubernetes_version: str + :keyword is_preview: Whether the Kubernetes version is currently in preview. + :paramtype is_preview: bool + """ + super().__init__(**kwargs) + self.kubernetes_version = kubernetes_version + self.is_preview = is_preview + + +class ManagedClusterPropertiesAutoScalerProfile(_serialization.Model): # pylint: disable=too-many-instance-attributes + """Parameters to be applied to the cluster-autoscaler when enabled. + + :ivar balance_similar_node_groups: Valid values are 'true' and 'false'. + :vartype balance_similar_node_groups: str + :ivar expander: If not specified, the default is 'random'. See `expanders + `_ + for more information. Known values are: "least-waste", "most-pods", "priority", and "random". + :vartype expander: str or ~azure.mgmt.containerservice.v2022_07_02_preview.models.Expander + :ivar max_empty_bulk_delete: The default is 10. + :vartype max_empty_bulk_delete: str + :ivar max_graceful_termination_sec: The default is 600. + :vartype max_graceful_termination_sec: str + :ivar max_node_provision_time: The default is '15m'. Values must be an integer followed by an + 'm'. No unit of time other than minutes (m) is supported. + :vartype max_node_provision_time: str + :ivar max_total_unready_percentage: The default is 45. The maximum is 100 and the minimum is 0. + :vartype max_total_unready_percentage: str + :ivar new_pod_scale_up_delay: For scenarios like burst/batch scale where you don't want CA to + act before the kubernetes scheduler could schedule all the pods, you can tell CA to ignore + unscheduled pods before they're a certain age. The default is '0s'. Values must be an integer + followed by a unit ('s' for seconds, 'm' for minutes, 'h' for hours, etc). + :vartype new_pod_scale_up_delay: str + :ivar ok_total_unready_count: This must be an integer. The default is 3. + :vartype ok_total_unready_count: str + :ivar scan_interval: The default is '10'. Values must be an integer number of seconds. + :vartype scan_interval: str + :ivar scale_down_delay_after_add: The default is '10m'. Values must be an integer followed by + an 'm'. No unit of time other than minutes (m) is supported. + :vartype scale_down_delay_after_add: str + :ivar scale_down_delay_after_delete: The default is the scan-interval. Values must be an + integer followed by an 'm'. No unit of time other than minutes (m) is supported. + :vartype scale_down_delay_after_delete: str + :ivar scale_down_delay_after_failure: The default is '3m'. Values must be an integer followed + by an 'm'. No unit of time other than minutes (m) is supported. + :vartype scale_down_delay_after_failure: str + :ivar scale_down_unneeded_time: The default is '10m'. Values must be an integer followed by an + 'm'. No unit of time other than minutes (m) is supported. + :vartype scale_down_unneeded_time: str + :ivar scale_down_unready_time: The default is '20m'. Values must be an integer followed by an + 'm'. No unit of time other than minutes (m) is supported. + :vartype scale_down_unready_time: str + :ivar scale_down_utilization_threshold: The default is '0.5'. + :vartype scale_down_utilization_threshold: str + :ivar skip_nodes_with_local_storage: The default is true. + :vartype skip_nodes_with_local_storage: str + :ivar skip_nodes_with_system_pods: The default is true. + :vartype skip_nodes_with_system_pods: str + """ + + _attribute_map = { + "balance_similar_node_groups": {"key": "balance-similar-node-groups", "type": "str"}, + "expander": {"key": "expander", "type": "str"}, + "max_empty_bulk_delete": {"key": "max-empty-bulk-delete", "type": "str"}, + "max_graceful_termination_sec": {"key": "max-graceful-termination-sec", "type": "str"}, + "max_node_provision_time": {"key": "max-node-provision-time", "type": "str"}, + "max_total_unready_percentage": {"key": "max-total-unready-percentage", "type": "str"}, + "new_pod_scale_up_delay": {"key": "new-pod-scale-up-delay", "type": "str"}, + "ok_total_unready_count": {"key": "ok-total-unready-count", "type": "str"}, + "scan_interval": {"key": "scan-interval", "type": "str"}, + "scale_down_delay_after_add": {"key": "scale-down-delay-after-add", "type": "str"}, + "scale_down_delay_after_delete": {"key": "scale-down-delay-after-delete", "type": "str"}, + "scale_down_delay_after_failure": {"key": "scale-down-delay-after-failure", "type": "str"}, + "scale_down_unneeded_time": {"key": "scale-down-unneeded-time", "type": "str"}, + "scale_down_unready_time": {"key": "scale-down-unready-time", "type": "str"}, + "scale_down_utilization_threshold": {"key": "scale-down-utilization-threshold", "type": "str"}, + "skip_nodes_with_local_storage": {"key": "skip-nodes-with-local-storage", "type": "str"}, + "skip_nodes_with_system_pods": {"key": "skip-nodes-with-system-pods", "type": "str"}, + } + + def __init__( + self, + *, + balance_similar_node_groups: Optional[str] = None, + expander: Optional[Union[str, "_models.Expander"]] = None, + max_empty_bulk_delete: Optional[str] = None, + max_graceful_termination_sec: Optional[str] = None, + max_node_provision_time: Optional[str] = None, + max_total_unready_percentage: Optional[str] = None, + new_pod_scale_up_delay: Optional[str] = None, + ok_total_unready_count: Optional[str] = None, + scan_interval: Optional[str] = None, + scale_down_delay_after_add: Optional[str] = None, + scale_down_delay_after_delete: Optional[str] = None, + scale_down_delay_after_failure: Optional[str] = None, + scale_down_unneeded_time: Optional[str] = None, + scale_down_unready_time: Optional[str] = None, + scale_down_utilization_threshold: Optional[str] = None, + skip_nodes_with_local_storage: Optional[str] = None, + skip_nodes_with_system_pods: Optional[str] = None, + **kwargs + ): + """ + :keyword balance_similar_node_groups: Valid values are 'true' and 'false'. + :paramtype balance_similar_node_groups: str + :keyword expander: If not specified, the default is 'random'. See `expanders + `_ + for more information. Known values are: "least-waste", "most-pods", "priority", and "random". + :paramtype expander: str or ~azure.mgmt.containerservice.v2022_07_02_preview.models.Expander + :keyword max_empty_bulk_delete: The default is 10. + :paramtype max_empty_bulk_delete: str + :keyword max_graceful_termination_sec: The default is 600. + :paramtype max_graceful_termination_sec: str + :keyword max_node_provision_time: The default is '15m'. Values must be an integer followed by + an 'm'. No unit of time other than minutes (m) is supported. + :paramtype max_node_provision_time: str + :keyword max_total_unready_percentage: The default is 45. The maximum is 100 and the minimum is + 0. + :paramtype max_total_unready_percentage: str + :keyword new_pod_scale_up_delay: For scenarios like burst/batch scale where you don't want CA + to act before the kubernetes scheduler could schedule all the pods, you can tell CA to ignore + unscheduled pods before they're a certain age. The default is '0s'. Values must be an integer + followed by a unit ('s' for seconds, 'm' for minutes, 'h' for hours, etc). + :paramtype new_pod_scale_up_delay: str + :keyword ok_total_unready_count: This must be an integer. The default is 3. + :paramtype ok_total_unready_count: str + :keyword scan_interval: The default is '10'. Values must be an integer number of seconds. + :paramtype scan_interval: str + :keyword scale_down_delay_after_add: The default is '10m'. Values must be an integer followed + by an 'm'. No unit of time other than minutes (m) is supported. + :paramtype scale_down_delay_after_add: str + :keyword scale_down_delay_after_delete: The default is the scan-interval. Values must be an + integer followed by an 'm'. No unit of time other than minutes (m) is supported. + :paramtype scale_down_delay_after_delete: str + :keyword scale_down_delay_after_failure: The default is '3m'. Values must be an integer + followed by an 'm'. No unit of time other than minutes (m) is supported. + :paramtype scale_down_delay_after_failure: str + :keyword scale_down_unneeded_time: The default is '10m'. Values must be an integer followed by + an 'm'. No unit of time other than minutes (m) is supported. + :paramtype scale_down_unneeded_time: str + :keyword scale_down_unready_time: The default is '20m'. Values must be an integer followed by + an 'm'. No unit of time other than minutes (m) is supported. + :paramtype scale_down_unready_time: str + :keyword scale_down_utilization_threshold: The default is '0.5'. + :paramtype scale_down_utilization_threshold: str + :keyword skip_nodes_with_local_storage: The default is true. + :paramtype skip_nodes_with_local_storage: str + :keyword skip_nodes_with_system_pods: The default is true. + :paramtype skip_nodes_with_system_pods: str + """ + super().__init__(**kwargs) + self.balance_similar_node_groups = balance_similar_node_groups + self.expander = expander + self.max_empty_bulk_delete = max_empty_bulk_delete + self.max_graceful_termination_sec = max_graceful_termination_sec + self.max_node_provision_time = max_node_provision_time + self.max_total_unready_percentage = max_total_unready_percentage + self.new_pod_scale_up_delay = new_pod_scale_up_delay + self.ok_total_unready_count = ok_total_unready_count + self.scan_interval = scan_interval + self.scale_down_delay_after_add = scale_down_delay_after_add + self.scale_down_delay_after_delete = scale_down_delay_after_delete + self.scale_down_delay_after_failure = scale_down_delay_after_failure + self.scale_down_unneeded_time = scale_down_unneeded_time + self.scale_down_unready_time = scale_down_unready_time + self.scale_down_utilization_threshold = scale_down_utilization_threshold + self.skip_nodes_with_local_storage = skip_nodes_with_local_storage + self.skip_nodes_with_system_pods = skip_nodes_with_system_pods + + +class ManagedClusterPropertiesForSnapshot(_serialization.Model): + """managed cluster properties for snapshot, these properties are read only. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar kubernetes_version: The current kubernetes version. + :vartype kubernetes_version: str + :ivar sku: The current managed cluster sku. + :vartype sku: ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterSKU + :ivar enable_rbac: Whether the cluster has enabled Kubernetes Role-Based Access Control or not. + :vartype enable_rbac: bool + :ivar network_profile: The current network profile. + :vartype network_profile: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.NetworkProfileForSnapshot + """ + + _validation = { + 'network_profile': {'readonly': True}, + } + + _attribute_map = { + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "sku": {"key": "sku", "type": "ManagedClusterSKU"}, + "enable_rbac": {"key": "enableRbac", "type": "bool"}, + "network_profile": {"key": "networkProfile", "type": "NetworkProfileForSnapshot"}, + } + + def __init__( + self, + *, + kubernetes_version: Optional[str] = None, + sku: Optional["_models.ManagedClusterSKU"] = None, + enable_rbac: Optional[bool] = None, + **kwargs + ): + """ + :keyword kubernetes_version: The current kubernetes version. + :paramtype kubernetes_version: str + :keyword sku: The current managed cluster sku. + :paramtype sku: ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterSKU + :keyword enable_rbac: Whether the cluster has enabled Kubernetes Role-Based Access Control or + not. + :paramtype enable_rbac: bool + """ + super().__init__(**kwargs) + self.kubernetes_version = kubernetes_version + self.sku = sku + self.enable_rbac = enable_rbac + self.network_profile = None + + +class ManagedClusterSecurityProfile(_serialization.Model): + """Security profile for the container service cluster. + + :ivar defender: Microsoft Defender settings for the security profile. + :vartype defender: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterSecurityProfileDefender + :ivar azure_key_vault_kms: Azure Key Vault `key management service + `_ settings for the security + profile. + :vartype azure_key_vault_kms: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.AzureKeyVaultKms + :ivar workload_identity: `Workload Identity + `_ settings for the security profile. + :vartype workload_identity: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterSecurityProfileWorkloadIdentity + :ivar image_cleaner: ImageCleaner settings for the security profile. + :vartype image_cleaner: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterSecurityProfileImageCleaner + :ivar node_restriction: `Node Restriction + `_ + settings for the security profile. + :vartype node_restriction: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterSecurityProfileNodeRestriction + """ + + _attribute_map = { + "defender": {"key": "defender", "type": "ManagedClusterSecurityProfileDefender"}, + "azure_key_vault_kms": {"key": "azureKeyVaultKms", "type": "AzureKeyVaultKms"}, + "workload_identity": {"key": "workloadIdentity", "type": "ManagedClusterSecurityProfileWorkloadIdentity"}, + "image_cleaner": {"key": "imageCleaner", "type": "ManagedClusterSecurityProfileImageCleaner"}, + "node_restriction": {"key": "nodeRestriction", "type": "ManagedClusterSecurityProfileNodeRestriction"}, + } + + def __init__( + self, + *, + defender: Optional["_models.ManagedClusterSecurityProfileDefender"] = None, + azure_key_vault_kms: Optional["_models.AzureKeyVaultKms"] = None, + workload_identity: Optional["_models.ManagedClusterSecurityProfileWorkloadIdentity"] = None, + image_cleaner: Optional["_models.ManagedClusterSecurityProfileImageCleaner"] = None, + node_restriction: Optional["_models.ManagedClusterSecurityProfileNodeRestriction"] = None, + **kwargs + ): + """ + :keyword defender: Microsoft Defender settings for the security profile. + :paramtype defender: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterSecurityProfileDefender + :keyword azure_key_vault_kms: Azure Key Vault `key management service + `_ settings for the security + profile. + :paramtype azure_key_vault_kms: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.AzureKeyVaultKms + :keyword workload_identity: `Workload Identity + `_ settings for the security profile. + :paramtype workload_identity: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterSecurityProfileWorkloadIdentity + :keyword image_cleaner: ImageCleaner settings for the security profile. + :paramtype image_cleaner: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterSecurityProfileImageCleaner + :keyword node_restriction: `Node Restriction + `_ + settings for the security profile. + :paramtype node_restriction: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterSecurityProfileNodeRestriction + """ + super().__init__(**kwargs) + self.defender = defender + self.azure_key_vault_kms = azure_key_vault_kms + self.workload_identity = workload_identity + self.image_cleaner = image_cleaner + self.node_restriction = node_restriction + + +class ManagedClusterSecurityProfileDefender(_serialization.Model): + """Microsoft Defender settings for the security profile. + + :ivar log_analytics_workspace_resource_id: Resource ID of the Log Analytics workspace to be + associated with Microsoft Defender. When Microsoft Defender is enabled, this field is required + and must be a valid workspace resource ID. When Microsoft Defender is disabled, leave the field + empty. + :vartype log_analytics_workspace_resource_id: str + :ivar security_monitoring: Microsoft Defender threat detection for Cloud settings for the + security profile. + :vartype security_monitoring: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterSecurityProfileDefenderSecurityMonitoring + """ + + _attribute_map = { + "log_analytics_workspace_resource_id": {"key": "logAnalyticsWorkspaceResourceId", "type": "str"}, + "security_monitoring": {"key": "securityMonitoring", "type": "ManagedClusterSecurityProfileDefenderSecurityMonitoring"}, + } + + def __init__( + self, + *, + log_analytics_workspace_resource_id: Optional[str] = None, + security_monitoring: Optional["_models.ManagedClusterSecurityProfileDefenderSecurityMonitoring"] = None, + **kwargs + ): + """ + :keyword log_analytics_workspace_resource_id: Resource ID of the Log Analytics workspace to be + associated with Microsoft Defender. When Microsoft Defender is enabled, this field is required + and must be a valid workspace resource ID. When Microsoft Defender is disabled, leave the field + empty. + :paramtype log_analytics_workspace_resource_id: str + :keyword security_monitoring: Microsoft Defender threat detection for Cloud settings for the + security profile. + :paramtype security_monitoring: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterSecurityProfileDefenderSecurityMonitoring + """ + super().__init__(**kwargs) + self.log_analytics_workspace_resource_id = log_analytics_workspace_resource_id + self.security_monitoring = security_monitoring + + +class ManagedClusterSecurityProfileDefenderSecurityMonitoring(_serialization.Model): + """Microsoft Defender settings for the security profile threat detection. + + :ivar enabled: Whether to enable Defender threat detection. + :vartype enabled: bool + """ + + _attribute_map = { + "enabled": {"key": "enabled", "type": "bool"}, + } + + def __init__( + self, + *, + enabled: Optional[bool] = None, + **kwargs + ): + """ + :keyword enabled: Whether to enable Defender threat detection. + :paramtype enabled: bool + """ + super().__init__(**kwargs) + self.enabled = enabled + + +class ManagedClusterSecurityProfileImageCleaner(_serialization.Model): + """ImageCleaner removes unused images from nodes, freeing up disk space and helping to reduce attack surface area. Here are settings for the security profile. + + :ivar enabled: Whether to enable ImageCleaner on AKS cluster. + :vartype enabled: bool + :ivar interval_hours: ImageCleaner scanning interval. + :vartype interval_hours: int + """ + + _attribute_map = { + "enabled": {"key": "enabled", "type": "bool"}, + "interval_hours": {"key": "intervalHours", "type": "int"}, + } + + def __init__( + self, + *, + enabled: Optional[bool] = None, + interval_hours: Optional[int] = None, + **kwargs + ): + """ + :keyword enabled: Whether to enable ImageCleaner on AKS cluster. + :paramtype enabled: bool + :keyword interval_hours: ImageCleaner scanning interval. + :paramtype interval_hours: int + """ + super().__init__(**kwargs) + self.enabled = enabled + self.interval_hours = interval_hours + + +class ManagedClusterSecurityProfileNodeRestriction(_serialization.Model): + """Node Restriction settings for the security profile. + + :ivar enabled: Whether to enable Node Restriction. + :vartype enabled: bool + """ + + _attribute_map = { + "enabled": {"key": "enabled", "type": "bool"}, + } + + def __init__( + self, + *, + enabled: Optional[bool] = None, + **kwargs + ): + """ + :keyword enabled: Whether to enable Node Restriction. + :paramtype enabled: bool + """ + super().__init__(**kwargs) + self.enabled = enabled + + +class ManagedClusterSecurityProfileWorkloadIdentity(_serialization.Model): + """Workload Identity settings for the security profile. + + :ivar enabled: Whether to enable Workload Identity. + :vartype enabled: bool + """ + + _attribute_map = { + "enabled": {"key": "enabled", "type": "bool"}, + } + + def __init__( + self, + *, + enabled: Optional[bool] = None, + **kwargs + ): + """ + :keyword enabled: Whether to enable Workload Identity. + :paramtype enabled: bool + """ + super().__init__(**kwargs) + self.enabled = enabled + + +class ManagedClusterServicePrincipalProfile(_serialization.Model): + """Information about a service principal identity for the cluster to use for manipulating Azure APIs. + + All required parameters must be populated in order to send to Azure. + + :ivar client_id: The ID for the service principal. Required. + :vartype client_id: str + :ivar secret: The secret password associated with the service principal in plain text. + :vartype secret: str + """ + + _validation = { + 'client_id': {'required': True}, + } + + _attribute_map = { + "client_id": {"key": "clientId", "type": "str"}, + "secret": {"key": "secret", "type": "str"}, + } + + def __init__( + self, + *, + client_id: str, + secret: Optional[str] = None, + **kwargs + ): + """ + :keyword client_id: The ID for the service principal. Required. + :paramtype client_id: str + :keyword secret: The secret password associated with the service principal in plain text. + :paramtype secret: str + """ + super().__init__(**kwargs) + self.client_id = client_id + self.secret = secret + + +class ManagedClusterSKU(_serialization.Model): + """The SKU of a Managed Cluster. + + :ivar name: The name of a managed cluster SKU. "Basic" + :vartype name: str or + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterSKUName + :ivar tier: If not specified, the default is 'Free'. See `uptime SLA + `_ for more details. Known values are: "Paid" + and "Free". + :vartype tier: str or + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterSKUTier + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "tier": {"key": "tier", "type": "str"}, + } + + def __init__( + self, + *, + name: Optional[Union[str, "_models.ManagedClusterSKUName"]] = None, + tier: Optional[Union[str, "_models.ManagedClusterSKUTier"]] = None, + **kwargs + ): + """ + :keyword name: The name of a managed cluster SKU. "Basic" + :paramtype name: str or + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterSKUName + :keyword tier: If not specified, the default is 'Free'. See `uptime SLA + `_ for more details. Known values are: "Paid" + and "Free". + :paramtype tier: str or + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterSKUTier + """ + super().__init__(**kwargs) + self.name = name + self.tier = tier + + +class ManagedClusterSnapshot(TrackedResource): + """A managed cluster snapshot resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.containerservice.v2022_07_02_preview.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 creation_data: CreationData to be used to specify the source resource ID to create this + snapshot. + :vartype creation_data: ~azure.mgmt.containerservice.v2022_07_02_preview.models.CreationData + :ivar snapshot_type: The type of a snapshot. The default is NodePool. Known values are: + "NodePool" and "ManagedCluster". + :vartype snapshot_type: str or + ~azure.mgmt.containerservice.v2022_07_02_preview.models.SnapshotType + :ivar managed_cluster_properties_read_only: What the properties will be showed when getting + managed cluster snapshot. Those properties are read-only. + :vartype managed_cluster_properties_read_only: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterPropertiesForSnapshot + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'location': {'required': True}, + 'managed_cluster_properties_read_only': {'readonly': True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "creation_data": {"key": "properties.creationData", "type": "CreationData"}, + "snapshot_type": {"key": "properties.snapshotType", "type": "str"}, + "managed_cluster_properties_read_only": {"key": "properties.managedClusterPropertiesReadOnly", "type": "ManagedClusterPropertiesForSnapshot"}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + creation_data: Optional["_models.CreationData"] = None, + snapshot_type: Union[str, "_models.SnapshotType"] = "NodePool", + **kwargs + ): + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str + :keyword creation_data: CreationData to be used to specify the source resource ID to create + this snapshot. + :paramtype creation_data: ~azure.mgmt.containerservice.v2022_07_02_preview.models.CreationData + :keyword snapshot_type: The type of a snapshot. The default is NodePool. Known values are: + "NodePool" and "ManagedCluster". + :paramtype snapshot_type: str or + ~azure.mgmt.containerservice.v2022_07_02_preview.models.SnapshotType + """ + super().__init__(tags=tags, location=location, **kwargs) + self.creation_data = creation_data + self.snapshot_type = snapshot_type + self.managed_cluster_properties_read_only = None + + +class ManagedClusterSnapshotListResult(_serialization.Model): + """The response from the List Managed Cluster Snapshots operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The list of managed cluster snapshots. + :vartype value: + list[~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterSnapshot] + :ivar next_link: The URL to get the next set of managed cluster snapshot results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[ManagedClusterSnapshot]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.ManagedClusterSnapshot"]] = None, + **kwargs + ): + """ + :keyword value: The list of managed cluster snapshots. + :paramtype value: + list[~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterSnapshot] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class ManagedClusterStorageProfile(_serialization.Model): + """Storage profile for the container service cluster. + + :ivar disk_csi_driver: AzureDisk CSI Driver settings for the storage profile. + :vartype disk_csi_driver: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterStorageProfileDiskCSIDriver + :ivar file_csi_driver: AzureFile CSI Driver settings for the storage profile. + :vartype file_csi_driver: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterStorageProfileFileCSIDriver + :ivar snapshot_controller: Snapshot Controller settings for the storage profile. + :vartype snapshot_controller: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterStorageProfileSnapshotController + :ivar blob_csi_driver: AzureBlob CSI Driver settings for the storage profile. + :vartype blob_csi_driver: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterStorageProfileBlobCSIDriver + """ + + _attribute_map = { + "disk_csi_driver": {"key": "diskCSIDriver", "type": "ManagedClusterStorageProfileDiskCSIDriver"}, + "file_csi_driver": {"key": "fileCSIDriver", "type": "ManagedClusterStorageProfileFileCSIDriver"}, + "snapshot_controller": {"key": "snapshotController", "type": "ManagedClusterStorageProfileSnapshotController"}, + "blob_csi_driver": {"key": "blobCSIDriver", "type": "ManagedClusterStorageProfileBlobCSIDriver"}, + } + + def __init__( + self, + *, + disk_csi_driver: Optional["_models.ManagedClusterStorageProfileDiskCSIDriver"] = None, + file_csi_driver: Optional["_models.ManagedClusterStorageProfileFileCSIDriver"] = None, + snapshot_controller: Optional["_models.ManagedClusterStorageProfileSnapshotController"] = None, + blob_csi_driver: Optional["_models.ManagedClusterStorageProfileBlobCSIDriver"] = None, + **kwargs + ): + """ + :keyword disk_csi_driver: AzureDisk CSI Driver settings for the storage profile. + :paramtype disk_csi_driver: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterStorageProfileDiskCSIDriver + :keyword file_csi_driver: AzureFile CSI Driver settings for the storage profile. + :paramtype file_csi_driver: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterStorageProfileFileCSIDriver + :keyword snapshot_controller: Snapshot Controller settings for the storage profile. + :paramtype snapshot_controller: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterStorageProfileSnapshotController + :keyword blob_csi_driver: AzureBlob CSI Driver settings for the storage profile. + :paramtype blob_csi_driver: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterStorageProfileBlobCSIDriver + """ + super().__init__(**kwargs) + self.disk_csi_driver = disk_csi_driver + self.file_csi_driver = file_csi_driver + self.snapshot_controller = snapshot_controller + self.blob_csi_driver = blob_csi_driver + + +class ManagedClusterStorageProfileBlobCSIDriver(_serialization.Model): + """AzureBlob CSI Driver settings for the storage profile. + + :ivar enabled: Whether to enable AzureBlob CSI Driver. The default value is false. + :vartype enabled: bool + """ + + _attribute_map = { + "enabled": {"key": "enabled", "type": "bool"}, + } + + def __init__( + self, + *, + enabled: Optional[bool] = None, + **kwargs + ): + """ + :keyword enabled: Whether to enable AzureBlob CSI Driver. The default value is false. + :paramtype enabled: bool + """ + super().__init__(**kwargs) + self.enabled = enabled + + +class ManagedClusterStorageProfileDiskCSIDriver(_serialization.Model): + """AzureDisk CSI Driver settings for the storage profile. + + :ivar enabled: Whether to enable AzureDisk CSI Driver. The default value is true. + :vartype enabled: bool + :ivar version: The version of AzureDisk CSI Driver. The default value is v1. + :vartype version: str + """ + + _attribute_map = { + "enabled": {"key": "enabled", "type": "bool"}, + "version": {"key": "version", "type": "str"}, + } + + def __init__( + self, + *, + enabled: Optional[bool] = None, + version: Optional[str] = None, + **kwargs + ): + """ + :keyword enabled: Whether to enable AzureDisk CSI Driver. The default value is true. + :paramtype enabled: bool + :keyword version: The version of AzureDisk CSI Driver. The default value is v1. + :paramtype version: str + """ + super().__init__(**kwargs) + self.enabled = enabled + self.version = version + + +class ManagedClusterStorageProfileFileCSIDriver(_serialization.Model): + """AzureFile CSI Driver settings for the storage profile. + + :ivar enabled: Whether to enable AzureFile CSI Driver. The default value is true. + :vartype enabled: bool + """ + + _attribute_map = { + "enabled": {"key": "enabled", "type": "bool"}, + } + + def __init__( + self, + *, + enabled: Optional[bool] = None, + **kwargs + ): + """ + :keyword enabled: Whether to enable AzureFile CSI Driver. The default value is true. + :paramtype enabled: bool + """ + super().__init__(**kwargs) + self.enabled = enabled + + +class ManagedClusterStorageProfileSnapshotController(_serialization.Model): + """Snapshot Controller settings for the storage profile. + + :ivar enabled: Whether to enable Snapshot Controller. The default value is true. + :vartype enabled: bool + """ + + _attribute_map = { + "enabled": {"key": "enabled", "type": "bool"}, + } + + def __init__( + self, + *, + enabled: Optional[bool] = None, + **kwargs + ): + """ + :keyword enabled: Whether to enable Snapshot Controller. The default value is true. + :paramtype enabled: bool + """ + super().__init__(**kwargs) + self.enabled = enabled + + +class ManagedClusterUpgradeProfile(_serialization.Model): + """The list of available upgrades for compute pools. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The ID of the upgrade profile. + :vartype id: str + :ivar name: The name of the upgrade profile. + :vartype name: str + :ivar type: The type of the upgrade profile. + :vartype type: str + :ivar control_plane_profile: The list of available upgrade versions for the control plane. + Required. + :vartype control_plane_profile: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterPoolUpgradeProfile + :ivar agent_pool_profiles: The list of available upgrade versions for agent pools. Required. + :vartype agent_pool_profiles: + list[~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterPoolUpgradeProfile] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'control_plane_profile': {'required': True}, + 'agent_pool_profiles': {'required': True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "control_plane_profile": {"key": "properties.controlPlaneProfile", "type": "ManagedClusterPoolUpgradeProfile"}, + "agent_pool_profiles": {"key": "properties.agentPoolProfiles", "type": "[ManagedClusterPoolUpgradeProfile]"}, + } + + def __init__( + self, + *, + control_plane_profile: "_models.ManagedClusterPoolUpgradeProfile", + agent_pool_profiles: List["_models.ManagedClusterPoolUpgradeProfile"], + **kwargs + ): + """ + :keyword control_plane_profile: The list of available upgrade versions for the control plane. + Required. + :paramtype control_plane_profile: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterPoolUpgradeProfile + :keyword agent_pool_profiles: The list of available upgrade versions for agent pools. Required. + :paramtype agent_pool_profiles: + list[~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterPoolUpgradeProfile] + """ + super().__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.control_plane_profile = control_plane_profile + self.agent_pool_profiles = agent_pool_profiles + + +class ManagedClusterWindowsProfile(_serialization.Model): + """Profile for Windows VMs in the managed cluster. + + All required parameters must be populated in order to send to Azure. + + :ivar admin_username: Specifies the name of the administrator account. :code:`
`:code:`
` + **Restriction:** Cannot end in "." :code:`
`:code:`
` **Disallowed values:** + "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", + "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", + "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", + "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 character + :code:`
`:code:`
` **Max-length:** 20 characters. Required. + :vartype admin_username: str + :ivar admin_password: Specifies the password of the administrator account. + :code:`
`:code:`
` **Minimum-length:** 8 characters :code:`
`:code:`
` + **Max-length:** 123 characters :code:`
`:code:`
` **Complexity requirements:** 3 out of 4 + conditions below need to be fulfilled :code:`
` Has lower characters :code:`
`Has upper + characters :code:`
` Has a digit :code:`
` Has a special character (Regex match [\W_]) + :code:`
`:code:`
` **Disallowed values:** "abc@123", "P@$$w0rd", "P@ssw0rd", + "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!". + :vartype admin_password: str + :ivar license_type: The license type to use for Windows VMs. See `Azure Hybrid User Benefits + `_ for more details. Known values are: + "None" and "Windows_Server". + :vartype license_type: str or + ~azure.mgmt.containerservice.v2022_07_02_preview.models.LicenseType + :ivar enable_csi_proxy: For more details on CSI proxy, see the `CSI proxy GitHub repo + `_. + :vartype enable_csi_proxy: bool + :ivar gmsa_profile: The Windows gMSA Profile in the Managed Cluster. + :vartype gmsa_profile: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.WindowsGmsaProfile + """ + + _validation = { + 'admin_username': {'required': True}, + } + + _attribute_map = { + "admin_username": {"key": "adminUsername", "type": "str"}, + "admin_password": {"key": "adminPassword", "type": "str"}, + "license_type": {"key": "licenseType", "type": "str"}, + "enable_csi_proxy": {"key": "enableCSIProxy", "type": "bool"}, + "gmsa_profile": {"key": "gmsaProfile", "type": "WindowsGmsaProfile"}, + } + + def __init__( + self, + *, + admin_username: str, + admin_password: Optional[str] = None, + license_type: Optional[Union[str, "_models.LicenseType"]] = None, + enable_csi_proxy: Optional[bool] = None, + gmsa_profile: Optional["_models.WindowsGmsaProfile"] = None, + **kwargs + ): + """ + :keyword admin_username: Specifies the name of the administrator account. + :code:`
`:code:`
` **Restriction:** Cannot end in "." :code:`
`:code:`
` + **Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", "test1", + "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", + "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", + "sys", "test2", "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 + character :code:`
`:code:`
` **Max-length:** 20 characters. Required. + :paramtype admin_username: str + :keyword admin_password: Specifies the password of the administrator account. + :code:`
`:code:`
` **Minimum-length:** 8 characters :code:`
`:code:`
` + **Max-length:** 123 characters :code:`
`:code:`
` **Complexity requirements:** 3 out of 4 + conditions below need to be fulfilled :code:`
` Has lower characters :code:`
`Has upper + characters :code:`
` Has a digit :code:`
` Has a special character (Regex match [\W_]) + :code:`
`:code:`
` **Disallowed values:** "abc@123", "P@$$w0rd", "P@ssw0rd", + "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!". + :paramtype admin_password: str + :keyword license_type: The license type to use for Windows VMs. See `Azure Hybrid User Benefits + `_ for more details. Known values are: + "None" and "Windows_Server". + :paramtype license_type: str or + ~azure.mgmt.containerservice.v2022_07_02_preview.models.LicenseType + :keyword enable_csi_proxy: For more details on CSI proxy, see the `CSI proxy GitHub repo + `_. + :paramtype enable_csi_proxy: bool + :keyword gmsa_profile: The Windows gMSA Profile in the Managed Cluster. + :paramtype gmsa_profile: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.WindowsGmsaProfile + """ + super().__init__(**kwargs) + self.admin_username = admin_username + self.admin_password = admin_password + self.license_type = license_type + self.enable_csi_proxy = enable_csi_proxy + self.gmsa_profile = gmsa_profile + + +class ManagedClusterWorkloadAutoScalerProfile(_serialization.Model): + """Workload Auto-scaler profile for the container service cluster. + + :ivar keda: KEDA (Kubernetes Event-driven Autoscaling) settings for the workload auto-scaler + profile. + :vartype keda: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterWorkloadAutoScalerProfileKeda + :ivar vertical_pod_autoscaler: + :vartype vertical_pod_autoscaler: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterWorkloadAutoScalerProfileVerticalPodAutoscaler + """ + + _attribute_map = { + "keda": {"key": "keda", "type": "ManagedClusterWorkloadAutoScalerProfileKeda"}, + "vertical_pod_autoscaler": {"key": "verticalPodAutoscaler", "type": "ManagedClusterWorkloadAutoScalerProfileVerticalPodAutoscaler"}, + } + + def __init__( + self, + *, + keda: Optional["_models.ManagedClusterWorkloadAutoScalerProfileKeda"] = None, + vertical_pod_autoscaler: Optional["_models.ManagedClusterWorkloadAutoScalerProfileVerticalPodAutoscaler"] = None, + **kwargs + ): + """ + :keyword keda: KEDA (Kubernetes Event-driven Autoscaling) settings for the workload auto-scaler + profile. + :paramtype keda: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterWorkloadAutoScalerProfileKeda + :keyword vertical_pod_autoscaler: + :paramtype vertical_pod_autoscaler: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterWorkloadAutoScalerProfileVerticalPodAutoscaler + """ + super().__init__(**kwargs) + self.keda = keda + self.vertical_pod_autoscaler = vertical_pod_autoscaler + + +class ManagedClusterWorkloadAutoScalerProfileKeda(_serialization.Model): + """KEDA (Kubernetes Event-driven Autoscaling) settings for the workload auto-scaler profile. + + All required parameters must be populated in order to send to Azure. + + :ivar enabled: Whether to enable KEDA. Required. + :vartype enabled: bool + """ + + _validation = { + 'enabled': {'required': True}, + } + + _attribute_map = { + "enabled": {"key": "enabled", "type": "bool"}, + } + + def __init__( + self, + *, + enabled: bool, + **kwargs + ): + """ + :keyword enabled: Whether to enable KEDA. Required. + :paramtype enabled: bool + """ + super().__init__(**kwargs) + self.enabled = enabled + + +class ManagedClusterWorkloadAutoScalerProfileVerticalPodAutoscaler(_serialization.Model): + """ManagedClusterWorkloadAutoScalerProfileVerticalPodAutoscaler. + + All required parameters must be populated in order to send to Azure. + + :ivar enabled: Whether to enable VPA. Default value is false. Required. + :vartype enabled: bool + :ivar controlled_values: Controls which resource value autoscaler will change. Default value is + RequestsAndLimits. Known values are: "RequestsAndLimits" and "RequestsOnly". + :vartype controlled_values: str or + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ControlledValues + :ivar update_mode: Each update mode level is a superset of the lower levels. + Off`_. + :vartype rules: + list[~azure.mgmt.containerservice.v2022_07_02_preview.models.TrustedAccessRoleRule] + """ + + _validation = { + 'source_resource_type': {'readonly': True}, + 'name': {'readonly': True}, + 'rules': {'readonly': True}, + } + + _attribute_map = { + "source_resource_type": {"key": "sourceResourceType", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "rules": {"key": "rules", "type": "[TrustedAccessRoleRule]"}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super().__init__(**kwargs) + self.source_resource_type = None + self.name = None + self.rules = None + + +class TrustedAccessRoleBinding(Resource): + """Defines binding between a resource and role. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.containerservice.v2022_07_02_preview.models.SystemData + :ivar provisioning_state: The current provisioning state of trusted access role binding. Known + values are: "Succeeded", "Failed", "Updating", and "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.containerservice.v2022_07_02_preview.models.TrustedAccessRoleBindingProvisioningState + :ivar source_resource_id: The ARM resource ID of source resource that trusted access is + configured for. Required. + :vartype source_resource_id: str + :ivar roles: A list of roles to bind, each item is a resource type qualified role name. For + example: 'Microsoft.MachineLearningServices/workspaces/reader'. Required. + :vartype roles: list[str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'source_resource_id': {'required': True}, + 'roles': {'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"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "source_resource_id": {"key": "properties.sourceResourceId", "type": "str"}, + "roles": {"key": "properties.roles", "type": "[str]"}, + } + + def __init__( + self, + *, + source_resource_id: str, + roles: List[str], + **kwargs + ): + """ + :keyword source_resource_id: The ARM resource ID of source resource that trusted access is + configured for. Required. + :paramtype source_resource_id: str + :keyword roles: A list of roles to bind, each item is a resource type qualified role name. For + example: 'Microsoft.MachineLearningServices/workspaces/reader'. Required. + :paramtype roles: list[str] + """ + super().__init__(**kwargs) + self.provisioning_state = None + self.source_resource_id = source_resource_id + self.roles = roles + + +class TrustedAccessRoleBindingListResult(_serialization.Model): + """List of trusted access role bindings. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: Role binding list. + :vartype value: + list[~azure.mgmt.containerservice.v2022_07_02_preview.models.TrustedAccessRoleBinding] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[TrustedAccessRoleBinding]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.TrustedAccessRoleBinding"]] = None, + **kwargs + ): + """ + :keyword value: Role binding list. + :paramtype value: + list[~azure.mgmt.containerservice.v2022_07_02_preview.models.TrustedAccessRoleBinding] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class TrustedAccessRoleListResult(_serialization.Model): + """List of trusted access roles. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: Role list. + :vartype value: list[~azure.mgmt.containerservice.v2022_07_02_preview.models.TrustedAccessRole] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[TrustedAccessRole]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super().__init__(**kwargs) + self.value = None + self.next_link = None + + +class TrustedAccessRoleRule(_serialization.Model): + """Rule for trusted access role. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar verbs: List of allowed verbs. + :vartype verbs: list[str] + :ivar api_groups: List of allowed apiGroups. + :vartype api_groups: list[str] + :ivar resources: List of allowed resources. + :vartype resources: list[str] + :ivar resource_names: List of allowed names. + :vartype resource_names: list[str] + :ivar non_resource_ur_ls: List of allowed nonResourceURLs. + :vartype non_resource_ur_ls: list[str] + """ + + _validation = { + 'verbs': {'readonly': True}, + 'api_groups': {'readonly': True}, + 'resources': {'readonly': True}, + 'resource_names': {'readonly': True}, + 'non_resource_ur_ls': {'readonly': True}, + } + + _attribute_map = { + "verbs": {"key": "verbs", "type": "[str]"}, + "api_groups": {"key": "apiGroups", "type": "[str]"}, + "resources": {"key": "resources", "type": "[str]"}, + "resource_names": {"key": "resourceNames", "type": "[str]"}, + "non_resource_ur_ls": {"key": "nonResourceURLs", "type": "[str]"}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super().__init__(**kwargs) + self.verbs = None + self.api_groups = None + self.resources = None + self.resource_names = None + self.non_resource_ur_ls = None + + +class WindowsGmsaProfile(_serialization.Model): + """Windows gMSA Profile in the managed cluster. + + :ivar enabled: Specifies whether to enable Windows gMSA in the managed cluster. + :vartype enabled: bool + :ivar dns_server: Specifies the DNS server for Windows gMSA. :code:`
`:code:`
` Set it to + empty if you have configured the DNS server in the vnet which is used to create the managed + cluster. + :vartype dns_server: str + :ivar root_domain_name: Specifies the root domain name for Windows gMSA. + :code:`
`:code:`
` Set it to empty if you have configured the DNS server in the vnet + which is used to create the managed cluster. + :vartype root_domain_name: str + """ + + _attribute_map = { + "enabled": {"key": "enabled", "type": "bool"}, + "dns_server": {"key": "dnsServer", "type": "str"}, + "root_domain_name": {"key": "rootDomainName", "type": "str"}, + } + + def __init__( + self, + *, + enabled: Optional[bool] = None, + dns_server: Optional[str] = None, + root_domain_name: Optional[str] = None, + **kwargs + ): + """ + :keyword enabled: Specifies whether to enable Windows gMSA in the managed cluster. + :paramtype enabled: bool + :keyword dns_server: Specifies the DNS server for Windows gMSA. :code:`
`:code:`
` Set it + to empty if you have configured the DNS server in the vnet which is used to create the managed + cluster. + :paramtype dns_server: str + :keyword root_domain_name: Specifies the root domain name for Windows gMSA. + :code:`
`:code:`
` Set it to empty if you have configured the DNS server in the vnet + which is used to create the managed cluster. + :paramtype root_domain_name: str + """ + super().__init__(**kwargs) + self.enabled = enabled + self.dns_server = dns_server + self.root_domain_name = root_domain_name diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/models/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/models/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/models/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/operations/__init__.py new file mode 100644 index 000000000000..03d015afec25 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/operations/__init__.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 ._operations import Operations +from ._managed_clusters_operations import ManagedClustersOperations +from ._maintenance_configurations_operations import MaintenanceConfigurationsOperations +from ._agent_pools_operations import AgentPoolsOperations +from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations +from ._private_link_resources_operations import PrivateLinkResourcesOperations +from ._resolve_private_link_service_id_operations import ResolvePrivateLinkServiceIdOperations +from ._snapshots_operations import SnapshotsOperations +from ._managed_cluster_snapshots_operations import ManagedClusterSnapshotsOperations +from ._trusted_access_roles_operations import TrustedAccessRolesOperations +from ._trusted_access_role_bindings_operations import TrustedAccessRoleBindingsOperations +from ._fleets_operations import FleetsOperations +from ._fleet_members_operations import FleetMembersOperations + +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk +__all__ = [ + 'Operations', + 'ManagedClustersOperations', + 'MaintenanceConfigurationsOperations', + 'AgentPoolsOperations', + 'PrivateEndpointConnectionsOperations', + 'PrivateLinkResourcesOperations', + 'ResolvePrivateLinkServiceIdOperations', + 'SnapshotsOperations', + 'ManagedClusterSnapshotsOperations', + 'TrustedAccessRolesOperations', + 'TrustedAccessRoleBindingsOperations', + 'FleetsOperations', + 'FleetMembersOperations', +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/operations/_agent_pools_operations.py new file mode 100644 index 000000000000..c9a69ec40f05 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/operations/_agent_pools_operations.py @@ -0,0 +1,1265 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_abort_latest_operation_request( + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclusters/{resourceName}/agentPools/{agentPoolName}/abort") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + resource_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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, + resource_name: str, + agent_pool_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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, + resource_name: str, + agent_pool_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + if content_type is not None: + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_delete_request( + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + subscription_id: str, + *, + ignore_pod_disruption_budget: Optional[bool] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if ignore_pod_disruption_budget is not None: + _params['ignore-pod-disruption-budget'] = _SERIALIZER.query("ignore_pod_disruption_budget", ignore_pod_disruption_budget, 'bool') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_get_upgrade_profile_request( + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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_available_agent_pool_versions_request( + resource_group_name: str, + resource_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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_upgrade_node_image_version_request( + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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 AgentPoolsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_07_02_preview.ContainerServiceClient`'s + :attr:`agent_pools` 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 abort_latest_operation( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + **kwargs: Any + ) -> None: + """Aborts last operation running on agent pool. + + Aborting last running operation on agent pool. We return a 204 no content code here to indicate + that the operation has been accepted and an abort will be attempted but is not guaranteed to + complete successfully. Please look up the provisioning state of the agent pool to keep track of + whether it changes to Canceled. A canceled provisioning state indicates that the abort was + successful. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_abort_latest_operation_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.abort_latest_operation.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + abort_latest_operation.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclusters/{resourceName}/agentPools/{agentPoolName}/abort"} # type: ignore + + + @distributed_trace + def list( + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> Iterable["_models.AgentPool"]: + """Gets a list of agent pools in the specified managed cluster. + + Gets a list of agent pools in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AgentPool or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_07_02_preview.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("AgentPoolListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore + + @distributed_trace + def get( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + **kwargs: Any + ) -> _models.AgentPool: + """Gets the specified managed cluster agent pool. + + Gets the specified managed cluster agent pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AgentPool or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_02_preview.models.AgentPool + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + + + request = build_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AgentPool', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + + + def _create_or_update_initial( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: Union[_models.AgentPool, IO], + **kwargs: Any + ) -> _models.AgentPool: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, 'AgentPool') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_or_update_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('AgentPool', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('AgentPool', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: _models.AgentPool, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AgentPool]: + """Creates or updates an agent pool in the specified managed cluster. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: The agent pool to create or update. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_07_02_preview.models.AgentPool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_07_02_preview.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AgentPool]: + """Creates or updates an agent pool in the specified managed cluster. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: The agent pool to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_07_02_preview.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: Union[_models.AgentPool, IO], + **kwargs: Any + ) -> LROPoller[_models.AgentPool]: + """Creates or updates an agent pool in the specified managed cluster. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param parameters: The agent pool to create or update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.mgmt.containerservice.v2022_07_02_preview.models.AgentPool or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_07_02_preview.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + agent_pool_name=agent_pool_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('AgentPool', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + ignore_pod_disruption_budget: Optional[bool] = None, + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, + ignore_pod_disruption_budget=ignore_pod_disruption_budget, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + ignore_pod_disruption_budget: Optional[bool] = None, + **kwargs: Any + ) -> LROPoller[None]: + """Deletes an agent pool in the specified managed cluster. + + Deletes an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :param ignore_pod_disruption_budget: ignore-pod-disruption-budget=true to delete those pods on + a node without considering Pod Disruption Budget. Default value is None. + :type ignore_pod_disruption_budget: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + agent_pool_name=agent_pool_name, + ignore_pod_disruption_budget=ignore_pod_disruption_budget, + api_version=api_version, + cls=lambda x,y,z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + + @distributed_trace + def get_upgrade_profile( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + **kwargs: Any + ) -> _models.AgentPoolUpgradeProfile: + """Gets the upgrade profile for an agent pool. + + Gets the upgrade profile for an agent pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AgentPoolUpgradeProfile or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_02_preview.models.AgentPoolUpgradeProfile + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] + + + request = build_get_upgrade_profile_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_upgrade_profile.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AgentPoolUpgradeProfile', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore + + + @distributed_trace + def get_available_agent_pool_versions( + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> _models.AgentPoolAvailableVersions: + """Gets a list of supported Kubernetes versions for the specified agent pool. + + See `supported Kubernetes versions + `_ for more details about + the version lifecycle. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AgentPoolAvailableVersions or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_02_preview.models.AgentPoolAvailableVersions + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] + + + request = build_get_available_agent_pool_versions_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_available_agent_pool_versions.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AgentPoolAvailableVersions', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_available_agent_pool_versions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore + + + def _upgrade_node_image_version_initial( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + **kwargs: Any + ) -> Optional[_models.AgentPool]: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.AgentPool]] + + + request = build_upgrade_node_image_version_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + agent_pool_name=agent_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._upgrade_node_image_version_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 202: + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + + deserialized = self._deserialize('AgentPool', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _upgrade_node_image_version_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore + + + @distributed_trace + def begin_upgrade_node_image_version( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Upgrades the node image version of an agent pool to the latest. + + Upgrading the node image version of an agent pool applies the newest OS and runtime updates to + the nodes. AKS provides one new image per week with the latest updates. For more details on + node image versions, see: https://docs.microsoft.com/azure/aks/node-image-upgrade. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. Required. + :type agent_pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_07_02_preview.models.AgentPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._upgrade_node_image_version_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + agent_pool_name=agent_pool_name, + api_version=api_version, + cls=lambda x,y,z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + + deserialized = self._deserialize('AgentPool', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, response_headers) + return deserialized + + + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_upgrade_node_image_version.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/operations/_fleet_members_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/operations/_fleet_members_operations.py new file mode 100644 index 000000000000..8005e21209f9 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/operations/_fleet_members_operations.py @@ -0,0 +1,807 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_create_or_update_request( + resource_group_name: str, + fleet_name: str, + fleet_member_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/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), + "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])?$'), + "fleetMemberName": _SERIALIZER.url("fleet_member_name", fleet_member_name, 'str', max_length=50, min_length=1, pattern=r'^[a-z0-9]([-a-z0-9]*[a-z0-9])?$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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_get_request( + resource_group_name: str, + fleet_name: str, + fleet_member_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/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), + "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])?$'), + "fleetMemberName": _SERIALIZER.url("fleet_member_name", fleet_member_name, 'str', max_length=50, min_length=1, pattern=r'^[a-z0-9]([-a-z0-9]*[a-z0-9])?$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_delete_request( + resource_group_name: str, + fleet_name: str, + fleet_member_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/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), + "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])?$'), + "fleetMemberName": _SERIALIZER.url("fleet_member_name", fleet_member_name, 'str', max_length=50, min_length=1, pattern=r'^[a-z0-9]([-a-z0-9]*[a-z0-9])?$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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 + ) + + +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 = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/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), + "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 = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + +class FleetMembersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_07_02_preview.ContainerServiceClient`'s + :attr:`fleet_members` 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 _create_or_update_initial( + self, + resource_group_name: str, + fleet_name: str, + fleet_member_name: str, + parameters: Union[_models.FleetMember, IO], + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + **kwargs: Any + ) -> _models.FleetMember: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.FleetMember] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, 'FleetMember') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + fleet_name=fleet_name, + fleet_member_name=fleet_member_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, + template_url=self._create_or_update_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('FleetMember', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('FleetMember', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}"} # type: ignore + + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + fleet_name: str, + fleet_member_name: str, + parameters: _models.FleetMember, + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.FleetMember]: + """Creates or updates a fleet member. + + A member contains a reference to an existing Kubernetes cluster. Creating a member makes the + referenced cluster join the 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 + :param fleet_member_name: The name of the Fleet member resource. Required. + :type fleet_member_name: str + :param parameters: The Fleet member to create or update. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_07_02_preview.models.FleetMember + :param if_match: Omit this value to always overwrite the current resource. Specify the + last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is + None. + :type if_match: str + :param if_none_match: Set to '*' to allow a new resource to be created and prevent updating an + existing resource. Other values will result in a 412 Pre-condition Failed response. 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either FleetMember or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_07_02_preview.models.FleetMember] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + fleet_name: str, + fleet_member_name: str, + parameters: IO, + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.FleetMember]: + """Creates or updates a fleet member. + + A member contains a reference to an existing Kubernetes cluster. Creating a member makes the + referenced cluster join the 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 + :param fleet_member_name: The name of the Fleet member resource. Required. + :type fleet_member_name: str + :param parameters: The Fleet member to create or update. Required. + :type parameters: IO + :param if_match: Omit this value to always overwrite the current resource. Specify the + last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is + None. + :type if_match: str + :param if_none_match: Set to '*' to allow a new resource to be created and prevent updating an + existing resource. Other values will result in a 412 Pre-condition Failed response. 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either FleetMember or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_07_02_preview.models.FleetMember] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + fleet_name: str, + fleet_member_name: str, + parameters: Union[_models.FleetMember, IO], + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + **kwargs: Any + ) -> LROPoller[_models.FleetMember]: + """Creates or updates a fleet member. + + A member contains a reference to an existing Kubernetes cluster. Creating a member makes the + referenced cluster join the 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 + :param fleet_member_name: The name of the Fleet member resource. Required. + :type fleet_member_name: str + :param parameters: The Fleet member to create or update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.mgmt.containerservice.v2022_07_02_preview.models.FleetMember or IO + :param if_match: Omit this value to always overwrite the current resource. Specify the + last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is + None. + :type if_match: str + :param if_none_match: Set to '*' to allow a new resource to be created and prevent updating an + existing resource. Other values will result in a 412 Pre-condition Failed response. Default + value is None. + :type if_none_match: str + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either FleetMember or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_07_02_preview.models.FleetMember] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.FleetMember] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( # type: ignore + resource_group_name=resource_group_name, + fleet_name=fleet_name, + fleet_member_name=fleet_member_name, + parameters=parameters, + 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 + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('FleetMember', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}"} # type: ignore + + @distributed_trace + def get( + self, + resource_group_name: str, + fleet_name: str, + fleet_member_name: str, + **kwargs: Any + ) -> _models.FleetMember: + """Gets a Fleet member. + + Gets a Fleet member. + + :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 fleet_member_name: The name of the Fleet member resource. Required. + :type fleet_member_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FleetMember or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_02_preview.models.FleetMember + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.FleetMember] + + + request = build_get_request( + resource_group_name=resource_group_name, + fleet_name=fleet_name, + fleet_member_name=fleet_member_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **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('FleetMember', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}"} # type: ignore + + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + fleet_name: str, + fleet_member_name: str, + if_match: Optional[str] = None, + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_delete_request( + resource_group_name=resource_group_name, + fleet_name=fleet_name, + fleet_member_name=fleet_member_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}"} # type: ignore + + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + fleet_name: str, + fleet_member_name: str, + if_match: Optional[str] = None, + **kwargs: Any + ) -> LROPoller[None]: + """Deletes a fleet member. + + Deleting a Fleet member results in the member cluster leaving fleet. The Member azure resource + is deleted upon success. The underlying cluster is not deleted. + + :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 fleet_member_name: The name of the Fleet member resource. Required. + :type fleet_member_name: str + :param if_match: Omit this value to always overwrite the current resource. Specify the + last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is + None. + :type if_match: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + fleet_name=fleet_name, + fleet_member_name=fleet_member_name, + if_match=if_match, + api_version=api_version, + cls=lambda x,y,z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + lro_options={'final-state-via': 'location'}, + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}"} # type: ignore + + @distributed_trace + def list_by_fleet( + self, + resource_group_name: str, + fleet_name: str, + **kwargs: Any + ) -> Iterable["_models.FleetMember"]: + """Lists the members of a fleet. + + Lists the members of a 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either FleetMember or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_07_02_preview.models.FleetMember] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.FleetMembersListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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, + template_url=self.list_by_fleet.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("FleetMembersListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_fleet.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/operations/_fleets_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/operations/_fleets_operations.py new file mode 100644 index 000000000000..e5ac4ce34697 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/operations/_fleets_operations.py @@ -0,0 +1,1193 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_create_or_update_request( + resource_group_name: str, + fleet_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/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), + "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 = _format_url_section(_url, **path_format_arguments) + + # 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_update_request( + resource_group_name: str, + fleet_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/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), + "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 = _format_url_section(_url, **path_format_arguments) + + # 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 content_type is not None: + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_get_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/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), + "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 = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_delete_request( + resource_group_name: str, + fleet_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/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), + "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 = _format_url_section(_url, **path_format_arguments) + + # 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 + ) + + +def build_list_by_resource_group_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/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), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + 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), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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_list_credentials_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/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), + "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 = _format_url_section(_url, **path_format_arguments) + + # 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 FleetsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_07_02_preview.ContainerServiceClient`'s + :attr:`fleets` 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 _create_or_update_initial( + self, + resource_group_name: str, + fleet_name: str, + parameters: Union[_models.Fleet, IO], + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + **kwargs: Any + ) -> _models.Fleet: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Fleet] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, 'Fleet') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + fleet_name=fleet_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, + template_url=self._create_or_update_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Fleet', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Fleet', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}"} # type: ignore + + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + fleet_name: str, + parameters: _models.Fleet, + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Fleet]: + """Creates or updates a Fleet. + + Creates or updates a 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 + :param parameters: The Fleet to create or update. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_07_02_preview.models.Fleet + :param if_match: Omit this value to always overwrite the current resource. Specify the + last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is + None. + :type if_match: str + :param if_none_match: Set to '*' to allow a new resource to be created and prevent updating an + existing resource. Other values will result in a 412 Pre-condition Failed response. 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either Fleet or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_07_02_preview.models.Fleet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + fleet_name: str, + parameters: IO, + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Fleet]: + """Creates or updates a Fleet. + + Creates or updates a 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 + :param parameters: The Fleet to create or update. Required. + :type parameters: IO + :param if_match: Omit this value to always overwrite the current resource. Specify the + last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is + None. + :type if_match: str + :param if_none_match: Set to '*' to allow a new resource to be created and prevent updating an + existing resource. Other values will result in a 412 Pre-condition Failed response. 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either Fleet or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_07_02_preview.models.Fleet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + fleet_name: str, + parameters: Union[_models.Fleet, IO], + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + **kwargs: Any + ) -> LROPoller[_models.Fleet]: + """Creates or updates a Fleet. + + Creates or updates a 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 + :param parameters: The Fleet to create or update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.mgmt.containerservice.v2022_07_02_preview.models.Fleet or IO + :param if_match: Omit this value to always overwrite the current resource. Specify the + last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is + None. + :type if_match: str + :param if_none_match: Set to '*' to allow a new resource to be created and prevent updating an + existing resource. Other values will result in a 412 Pre-condition Failed response. Default + value is None. + :type if_none_match: str + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either Fleet or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_07_02_preview.models.Fleet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Fleet] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( # type: ignore + resource_group_name=resource_group_name, + fleet_name=fleet_name, + parameters=parameters, + 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 + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Fleet', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}"} # type: ignore + + @overload + def update( + self, + resource_group_name: str, + fleet_name: str, + if_match: Optional[str] = None, + parameters: Optional[_models.FleetPatch] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Fleet: + """Patches a fleet resource. + + Patches a fleet resource. + + :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 if_match: Omit this value to always overwrite the current resource. Specify the + last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is + None. + :type if_match: str + :param parameters: The properties of a Fleet to update. Default value is None. + :type parameters: ~azure.mgmt.containerservice.v2022_07_02_preview.models.FleetPatch + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Fleet or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_02_preview.models.Fleet + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + fleet_name: str, + if_match: Optional[str] = None, + parameters: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Fleet: + """Patches a fleet resource. + + Patches a fleet resource. + + :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 if_match: Omit this value to always overwrite the current resource. Specify the + last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is + None. + :type if_match: str + :param parameters: The properties of a Fleet to update. Default value is None. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Fleet or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_02_preview.models.Fleet + :raises ~azure.core.exceptions.HttpResponseError: + """ + + + @distributed_trace + def update( + self, + resource_group_name: str, + fleet_name: str, + if_match: Optional[str] = None, + parameters: Optional[Union[_models.FleetPatch, IO]] = None, + **kwargs: Any + ) -> _models.Fleet: + """Patches a fleet resource. + + Patches a fleet resource. + + :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 if_match: Omit this value to always overwrite the current resource. Specify the + last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is + None. + :type if_match: str + :param parameters: The properties of a Fleet to update. Is either a model type or a IO type. + Default value is None. + :type parameters: ~azure.mgmt.containerservice.v2022_07_02_preview.models.FleetPatch or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Fleet or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_02_preview.models.Fleet + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Fleet] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + if parameters is not None: + _json = self._serialize.body(parameters, 'FleetPatch') + else: + _json = None + + request = build_update_request( + resource_group_name=resource_group_name, + fleet_name=fleet_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **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('Fleet', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}"} # type: ignore + + + @distributed_trace + def get( + self, + resource_group_name: str, + fleet_name: str, + **kwargs: Any + ) -> _models.Fleet: + """Gets a Fleet. + + Gets a 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Fleet or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_02_preview.models.Fleet + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Fleet] + + + request = build_get_request( + resource_group_name=resource_group_name, + fleet_name=fleet_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **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('Fleet', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}"} # type: ignore + + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + fleet_name: str, + if_match: Optional[str] = None, + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_delete_request( + resource_group_name=resource_group_name, + fleet_name=fleet_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}"} # type: ignore + + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + fleet_name: str, + if_match: Optional[str] = None, + **kwargs: Any + ) -> LROPoller[None]: + """Deletes a Fleet. + + Deletes a 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 + :param if_match: Omit this value to always overwrite the current resource. Specify the + last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is + None. + :type if_match: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + fleet_name=fleet_name, + if_match=if_match, + api_version=api_version, + cls=lambda x,y,z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + lro_options={'final-state-via': 'location'}, + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}"} # type: ignore + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.Fleet"]: + """Lists fleets in the specified subscription and resource group. + + Lists fleets in the specified subscription and resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Fleet or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_07_02_preview.models.Fleet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.FleetListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_resource_group.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("FleetListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets"} # type: ignore + + @distributed_trace + def list( + self, + **kwargs: Any + ) -> Iterable["_models.Fleet"]: + """Lists fleets in the specified subscription. + + Lists fleets in the specified subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Fleet or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_07_02_preview.models.Fleet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.FleetListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("FleetListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/fleets"} # type: ignore + + @distributed_trace + def list_credentials( + self, + resource_group_name: str, + fleet_name: str, + **kwargs: Any + ) -> _models.FleetCredentialResults: + """Lists the user credentials of a Fleet. + + Lists the user credentials of a 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FleetCredentialResults or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_02_preview.models.FleetCredentialResults + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.FleetCredentialResults] + + + request = build_list_credentials_request( + resource_group_name=resource_group_name, + fleet_name=fleet_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_credentials.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **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('FleetCredentialResults', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/listCredentials"} # type: ignore + diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/operations/_maintenance_configurations_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/operations/_maintenance_configurations_operations.py new file mode 100644 index 000000000000..3ec60f0d9d82 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/operations/_maintenance_configurations_operations.py @@ -0,0 +1,589 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import _convert_request, _format_url_section +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_managed_cluster_request( + resource_group_name: str, + resource_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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, + resource_name: str, + config_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "configName": _SERIALIZER.url("config_name", config_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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, + resource_name: str, + config_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "configName": _SERIALIZER.url("config_name", config_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + if content_type is not None: + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_delete_request( + resource_group_name: str, + resource_name: str, + config_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "configName": _SERIALIZER.url("config_name", config_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + +class MaintenanceConfigurationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_07_02_preview.ContainerServiceClient`'s + :attr:`maintenance_configurations` 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_managed_cluster( + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> Iterable["_models.MaintenanceConfiguration"]: + """Gets a list of maintenance configurations in the specified managed cluster. + + Gets a list of maintenance configurations in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either MaintenanceConfiguration or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_07_02_preview.models.MaintenanceConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfigurationListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_managed_cluster_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_managed_cluster.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("MaintenanceConfigurationListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_managed_cluster.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations"} # type: ignore + + @distributed_trace + def get( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Gets the specified maintenance configuration of a managed cluster. + + Gets the specified maintenance configuration of a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_02_preview.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] + + + request = build_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + config_name=config_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore + + + @overload + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: _models.MaintenanceConfiguration, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configuration in the specified managed cluster. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: The maintenance configuration to create or update. Required. + :type parameters: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.MaintenanceConfiguration + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_02_preview.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configuration in the specified managed cluster. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: The maintenance configuration to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_02_preview.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: Union[_models.MaintenanceConfiguration, IO], + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configuration in the specified managed cluster. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param parameters: The maintenance configuration to create or update. Is either a model type or + a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.MaintenanceConfiguration or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_02_preview.models.MaintenanceConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, 'MaintenanceConfiguration') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + config_name=config_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore + + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + resource_name: str, + config_name: str, + **kwargs: Any + ) -> None: + """Deletes a maintenance configuration. + + Deletes a maintenance configuration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + config_name=config_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.delete.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore + diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/operations/_managed_cluster_snapshots_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/operations/_managed_cluster_snapshots_operations.py new file mode 100644 index 000000000000..f3fc2e76164f --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/operations/_managed_cluster_snapshots_operations.py @@ -0,0 +1,863 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedclustersnapshots") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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_list_by_resource_group_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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, + resource_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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, + resource_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + if content_type is not None: + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_update_tags_request( + resource_group_name: str, + resource_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + if content_type is not None: + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_delete_request( + resource_group_name: str, + resource_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + +class ManagedClusterSnapshotsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_07_02_preview.ContainerServiceClient`'s + :attr:`managed_cluster_snapshots` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + + @distributed_trace + def list( + self, + **kwargs: Any + ) -> Iterable["_models.ManagedClusterSnapshot"]: + """Gets a list of managed cluster snapshots in the specified subscription. + + Gets a list of managed cluster snapshots in the specified subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ManagedClusterSnapshot or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterSnapshot] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshotListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ManagedClusterSnapshotListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedclustersnapshots"} # type: ignore + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.ManagedClusterSnapshot"]: + """Lists managed cluster snapshots in the specified subscription and resource group. + + Lists managed cluster snapshots in the specified subscription and resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ManagedClusterSnapshot or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterSnapshot] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshotListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_resource_group.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ManagedClusterSnapshotListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots"} # type: ignore + + @distributed_trace + def get( + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> _models.ManagedClusterSnapshot: + """Gets a managed cluster snapshot. + + Gets a managed cluster snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedClusterSnapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterSnapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshot] + + + request = build_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ManagedClusterSnapshot', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"} # type: ignore + + + @overload + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.ManagedClusterSnapshot, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ManagedClusterSnapshot: + """Creates or updates a managed cluster snapshot. + + Creates or updates a managed cluster snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster snapshot to create or update. Required. + :type parameters: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterSnapshot + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedClusterSnapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterSnapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ManagedClusterSnapshot: + """Creates or updates a managed cluster snapshot. + + Creates or updates a managed cluster snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster snapshot to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedClusterSnapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterSnapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterSnapshot, IO], + **kwargs: Any + ) -> _models.ManagedClusterSnapshot: + """Creates or updates a managed cluster snapshot. + + Creates or updates a managed cluster snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster snapshot to create or update. Is either a model type or + a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterSnapshot or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedClusterSnapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterSnapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshot] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, 'ManagedClusterSnapshot') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ManagedClusterSnapshot', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ManagedClusterSnapshot', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"} # type: ignore + + + @overload + def update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ManagedClusterSnapshot: + """Updates tags on a managed cluster snapshot. + + Updates tags on a managed cluster snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update managed cluster snapshot Tags operation. + Required. + :type parameters: ~azure.mgmt.containerservice.v2022_07_02_preview.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedClusterSnapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterSnapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ManagedClusterSnapshot: + """Updates tags on a managed cluster snapshot. + + Updates tags on a managed cluster snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update managed cluster snapshot Tags operation. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedClusterSnapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterSnapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + + @distributed_trace + def update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> _models.ManagedClusterSnapshot: + """Updates tags on a managed cluster snapshot. + + Updates tags on a managed cluster snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update managed cluster snapshot Tags operation. + Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_07_02_preview.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedClusterSnapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterSnapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshot] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, 'TagsObject') + + request = build_update_tags_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update_tags.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ManagedClusterSnapshot', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"} # type: ignore + + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> None: + """Deletes a managed cluster snapshot. + + Deletes a managed cluster snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.delete.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"} # type: ignore + diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/operations/_managed_clusters_operations.py new file mode 100644 index 000000000000..b0f3af905197 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/operations/_managed_clusters_operations.py @@ -0,0 +1,3576 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_get_os_options_request( + location: str, + subscription_id: str, + *, + resource_type: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "location": _SERIALIZER.url("location", location, 'str', min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if resource_type is not None: + _params['resource-type'] = _SERIALIZER.query("resource_type", resource_type, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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_list_by_resource_group_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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_upgrade_profile_request( + resource_group_name: str, + resource_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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_access_profile_request( + resource_group_name: str, + resource_name: str, + role_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "roleName": _SERIALIZER.url("role_name", role_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_list_cluster_admin_credentials_request( + resource_group_name: str, + resource_name: str, + subscription_id: str, + *, + server_fqdn: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if server_fqdn is not None: + _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_list_cluster_user_credentials_request( + resource_group_name: str, + resource_name: str, + subscription_id: str, + *, + server_fqdn: Optional[str] = None, + format: Optional[Union[str, "_models.Format"]] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if server_fqdn is not None: + _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + if format is not None: + _params['format'] = _SERIALIZER.query("format", format, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_list_cluster_monitoring_user_credentials_request( + resource_group_name: str, + resource_name: str, + subscription_id: str, + *, + server_fqdn: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if server_fqdn is not None: + _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + resource_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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, + resource_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + if content_type is not None: + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_update_tags_request( + resource_group_name: str, + resource_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + if content_type is not None: + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_delete_request( + resource_group_name: str, + resource_name: str, + subscription_id: str, + *, + ignore_pod_disruption_budget: Optional[bool] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if ignore_pod_disruption_budget is not None: + _params['ignore-pod-disruption-budget'] = _SERIALIZER.query("ignore_pod_disruption_budget", ignore_pod_disruption_budget, 'bool') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_reset_service_principal_profile_request( + resource_group_name: str, + resource_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + if content_type is not None: + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_reset_aad_profile_request( + resource_group_name: str, + resource_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + if content_type is not None: + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_abort_latest_operation_request( + resource_group_name: str, + resource_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclusters/{resourceName}/abort") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_rotate_cluster_certificates_request( + resource_group_name: str, + resource_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_rotate_service_account_signing_keys_request( + resource_group_name: str, + resource_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateServiceAccountSigningKeys") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_stop_request( + resource_group_name: str, + resource_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_start_request( + resource_group_name: str, + resource_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_run_command_request( + resource_group_name: str, + resource_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + if content_type is not None: + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_get_command_result_request( + resource_group_name: str, + resource_name: str, + command_id: 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "commandId": _SERIALIZER.url("command_id", command_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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_list_outbound_network_dependencies_endpoints_request( + resource_group_name: str, + resource_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + +class ManagedClustersOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_07_02_preview.ContainerServiceClient`'s + :attr:`managed_clusters` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + + @distributed_trace + def get_os_options( + self, + location: str, + resource_type: Optional[str] = None, + **kwargs: Any + ) -> _models.OSOptionProfile: + """Gets supported OS options in the specified subscription. + + Gets supported OS options in the specified subscription. + + :param location: The name of Azure region. Required. + :type location: str + :param resource_type: The resource type for which the OS options needs to be returned. Default + value is None. + :type resource_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: OSOptionProfile or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_02_preview.models.OSOptionProfile + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OSOptionProfile] + + + request = build_get_os_options_request( + location=location, + subscription_id=self._config.subscription_id, + resource_type=resource_type, + api_version=api_version, + template_url=self.get_os_options.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('OSOptionProfile', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_os_options.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default"} # type: ignore + + + @distributed_trace + def list( + self, + **kwargs: Any + ) -> Iterable["_models.ManagedCluster"]: + """Gets a list of managed clusters in the specified subscription. + + Gets a list of managed clusters in the specified subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ManagedCluster or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ManagedClusterListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.ManagedCluster"]: + """Lists managed clusters in the specified subscription and resource group. + + Lists managed clusters in the specified subscription and resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ManagedCluster or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_resource_group.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ManagedClusterListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + + @distributed_trace + def get_upgrade_profile( + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> _models.ManagedClusterUpgradeProfile: + """Gets the upgrade profile of a managed cluster. + + Gets the upgrade profile of a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedClusterUpgradeProfile or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterUpgradeProfile + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] + + + request = build_get_upgrade_profile_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_upgrade_profile.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ManagedClusterUpgradeProfile', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore + + + @distributed_trace + def get_access_profile( + self, + resource_group_name: str, + resource_name: str, + role_name: str, + **kwargs: Any + ) -> _models.ManagedClusterAccessProfile: + """Gets an access profile of a managed cluster. + + **WARNING**\ : This API will be deprecated. Instead use `ListClusterUserCredentials + `_ or + `ListClusterAdminCredentials + `_ . + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param role_name: The name of the role for managed cluster accessProfile resource. Required. + :type role_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedClusterAccessProfile or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterAccessProfile + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] + + + request = build_get_access_profile_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + role_name=role_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_access_profile.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ManagedClusterAccessProfile', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_access_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore + + + @distributed_trace + def list_cluster_admin_credentials( + self, + resource_group_name: str, + resource_name: str, + server_fqdn: Optional[str] = None, + **kwargs: Any + ) -> _models.CredentialResults: + """Lists the admin credentials of a managed cluster. + + Lists the admin credentials of a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. + :type server_fqdn: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CredentialResults or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_02_preview.models.CredentialResults + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + + + request = build_list_cluster_admin_credentials_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + server_fqdn=server_fqdn, + api_version=api_version, + template_url=self.list_cluster_admin_credentials.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CredentialResults', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_cluster_admin_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore + + + @distributed_trace + def list_cluster_user_credentials( + self, + resource_group_name: str, + resource_name: str, + server_fqdn: Optional[str] = None, + format: Optional[Union[str, "_models.Format"]] = None, + **kwargs: Any + ) -> _models.CredentialResults: + """Lists the user credentials of a managed cluster. + + Lists the user credentials of a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. + :type server_fqdn: str + :param format: Only apply to AAD clusters, specifies the format of returned kubeconfig. Format + 'azure' will return azure auth-provider kubeconfig; format 'exec' will return exec format + kubeconfig, which requires kubelogin binary in the path. Known values are: "azure" and "exec". + Default value is None. + :type format: str or ~azure.mgmt.containerservice.v2022_07_02_preview.models.Format + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CredentialResults or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_02_preview.models.CredentialResults + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + + + request = build_list_cluster_user_credentials_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + server_fqdn=server_fqdn, + format=format, + api_version=api_version, + template_url=self.list_cluster_user_credentials.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CredentialResults', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_cluster_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore + + + @distributed_trace + def list_cluster_monitoring_user_credentials( + self, + resource_group_name: str, + resource_name: str, + server_fqdn: Optional[str] = None, + **kwargs: Any + ) -> _models.CredentialResults: + """Lists the cluster monitoring user credentials of a managed cluster. + + Lists the cluster monitoring user credentials of a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. + :type server_fqdn: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CredentialResults or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_02_preview.models.CredentialResults + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + + + request = build_list_cluster_monitoring_user_credentials_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + server_fqdn=server_fqdn, + api_version=api_version, + template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CredentialResults', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_cluster_monitoring_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore + + + @distributed_trace + def get( + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> _models.ManagedCluster: + """Gets a managed cluster. + + Gets a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedCluster or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedCluster + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + + + request = build_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ManagedCluster', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + + + def _create_or_update_initial( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedCluster, IO], + **kwargs: Any + ) -> _models.ManagedCluster: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, 'ManagedCluster') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_or_update_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ManagedCluster', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ManagedCluster', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.ManagedCluster, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster to create or update. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedCluster + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedCluster, IO], + **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The managed cluster to create or update. Is either a model type or a IO + type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedCluster or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('ManagedCluster', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + + def _update_tags_initial( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> _models.ManagedCluster: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, 'TagsObject') + + request = build_update_tags_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_tags_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ManagedCluster', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_tags_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + + + @overload + def begin_update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates tags on a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_07_02_preview.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates tags on a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + + @distributed_trace + def begin_update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates tags on a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_07_02_preview.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_tags_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('ManagedCluster', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + resource_name: str, + ignore_pod_disruption_budget: Optional[bool] = None, + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + ignore_pod_disruption_budget=ignore_pod_disruption_budget, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + resource_name: str, + ignore_pod_disruption_budget: Optional[bool] = None, + **kwargs: Any + ) -> LROPoller[None]: + """Deletes a managed cluster. + + Deletes a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param ignore_pod_disruption_budget: ignore-pod-disruption-budget=true to delete those pods on + a node without considering Pod Disruption Budget. Default value is None. + :type ignore_pod_disruption_budget: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + ignore_pod_disruption_budget=ignore_pod_disruption_budget, + api_version=api_version, + cls=lambda x,y,z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + + def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') + + request = build_reset_service_principal_profile_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._reset_service_principal_profile_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _reset_service_principal_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + + + @overload + def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.ManagedClusterServicePrincipalProfile, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reset the Service Principal Profile of a managed cluster. + + This action cannot be performed on a cluster that is not using a service principal. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The service principal profile to set on the managed cluster. Required. + :type parameters: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterServicePrincipalProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reset the Service Principal Profile of a managed cluster. + + This action cannot be performed on a cluster that is not using a service principal. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The service principal profile to set on the managed cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + + @distributed_trace + def begin_reset_service_principal_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterServicePrincipalProfile, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Reset the Service Principal Profile of a managed cluster. + + This action cannot be performed on a cluster that is not using a service principal. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The service principal profile to set on the managed cluster. Is either a + model type or a IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterServicePrincipalProfile + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._reset_service_principal_profile_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_reset_service_principal_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + + def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterAADProfile, IO], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') + + request = build_reset_aad_profile_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._reset_aad_profile_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _reset_aad_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + + + @overload + def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.ManagedClusterAADProfile, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reset the AAD Profile of a managed cluster. + + Reset the AAD Profile of a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The AAD profile to set on the Managed Cluster. Required. + :type parameters: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterAADProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reset the AAD Profile of a managed cluster. + + Reset the AAD Profile of a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The AAD profile to set on the Managed Cluster. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + + @distributed_trace + def begin_reset_aad_profile( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.ManagedClusterAADProfile, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Reset the AAD Profile of a managed cluster. + + Reset the AAD Profile of a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The AAD profile to set on the Managed Cluster. Is either a model type or a + IO type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.ManagedClusterAADProfile or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._reset_aad_profile_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_reset_aad_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + + @distributed_trace + def abort_latest_operation( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> None: + """Aborts last operation running on managed cluster. + + Aborting last running operation on managed cluster. We return a 204 no content code here to + indicate that the operation has been accepted and an abort will be attempted but is not + guaranteed to complete successfully. Please look up the provisioning state of the managed + cluster to keep track of whether it changes to Canceled. A canceled provisioning state + indicates that the abort was successful. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_abort_latest_operation_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.abort_latest_operation.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + abort_latest_operation.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclusters/{resourceName}/abort"} # type: ignore + + + def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_rotate_cluster_certificates_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._rotate_cluster_certificates_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _rotate_cluster_certificates_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore + + + @distributed_trace + def begin_rotate_cluster_certificates( + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Rotates the certificates of a managed cluster. + + See `Certificate rotation `_ for + more details about rotating managed cluster certificates. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._rotate_cluster_certificates_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + api_version=api_version, + cls=lambda x,y,z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_rotate_cluster_certificates.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore + + def _rotate_service_account_signing_keys_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_rotate_service_account_signing_keys_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._rotate_service_account_signing_keys_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _rotate_service_account_signing_keys_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateServiceAccountSigningKeys"} # type: ignore + + + @distributed_trace + def begin_rotate_service_account_signing_keys( + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Rotates the service account signing keys of a managed cluster. + + Rotates the service account signing keys of a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._rotate_service_account_signing_keys_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + api_version=api_version, + cls=lambda x,y,z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_rotate_service_account_signing_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateServiceAccountSigningKeys"} # type: ignore + + def _stop_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_stop_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._stop_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore + + + @distributed_trace + def begin_stop( + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Stops a Managed Cluster. + + This can only be performed on Azure Virtual Machine Scale set backed clusters. Stopping a + cluster stops the control plane and agent nodes entirely, while maintaining all object and + cluster state. A cluster does not accrue charges while it is stopped. See `stopping a cluster + `_ for more details about stopping a + cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._stop_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + api_version=api_version, + cls=lambda x,y,z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore + + def _start_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_start_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._start_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore + + + @distributed_trace + def begin_start( + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Starts a previously stopped Managed Cluster. + + See `starting a cluster `_ for more + details about starting a cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._start_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + api_version=api_version, + cls=lambda x,y,z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore + + def _run_command_initial( + self, + resource_group_name: str, + resource_name: str, + request_payload: Union[_models.RunCommandRequest, IO], + **kwargs: Any + ) -> Optional[_models.RunCommandResult]: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(request_payload, (IO, bytes)): + _content = request_payload + else: + _json = self._serialize.body(request_payload, 'RunCommandRequest') + + request = build_run_command_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._run_command_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('RunCommandResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _run_command_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore + + + @overload + def begin_run_command( + self, + resource_group_name: str, + resource_name: str, + request_payload: _models.RunCommandRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RunCommandResult]: + """Submits a command to run against the Managed Cluster. + + AKS will create a pod to run the command. This is primarily useful for private clusters. For + more information see `AKS Run Command + `_. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param request_payload: The run command request. Required. + :type request_payload: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.RunCommandRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either RunCommandResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_07_02_preview.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_run_command( + self, + resource_group_name: str, + resource_name: str, + request_payload: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RunCommandResult]: + """Submits a command to run against the Managed Cluster. + + AKS will create a pod to run the command. This is primarily useful for private clusters. For + more information see `AKS Run Command + `_. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param request_payload: The run command request. Required. + :type request_payload: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either RunCommandResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_07_02_preview.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + + @distributed_trace + def begin_run_command( + self, + resource_group_name: str, + resource_name: str, + request_payload: Union[_models.RunCommandRequest, IO], + **kwargs: Any + ) -> LROPoller[_models.RunCommandResult]: + """Submits a command to run against the Managed Cluster. + + AKS will create a pod to run the command. This is primarily useful for private clusters. For + more information see `AKS Run Command + `_. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param request_payload: The run command request. Is either a model type or a IO type. Required. + :type request_payload: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.RunCommandRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either RunCommandResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_07_02_preview.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.RunCommandResult] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._run_command_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + request_payload=request_payload, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('RunCommandResult', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_run_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore + + @distributed_trace + def get_command_result( + self, + resource_group_name: str, + resource_name: str, + command_id: str, + **kwargs: Any + ) -> Optional[_models.RunCommandResult]: + """Gets the results of a command which has been run on the Managed Cluster. + + Gets the results of a command which has been run on the Managed Cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param command_id: Id of the command. Required. + :type command_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RunCommandResult or None or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_02_preview.models.RunCommandResult or None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] + + + request = build_get_command_result_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + command_id=command_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_command_result.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('RunCommandResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_command_result.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}"} # type: ignore + + + @distributed_trace + def list_outbound_network_dependencies_endpoints( + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> Iterable["_models.OutboundEnvironmentEndpoint"]: + """Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the + specified managed cluster. + + Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the + specified managed cluster. The operation returns properties of each egress endpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OutboundEnvironmentEndpoint or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_07_02_preview.models.OutboundEnvironmentEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_outbound_network_dependencies_endpoints_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_outbound_network_dependencies_endpoints.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("OutboundEnvironmentEndpointCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_outbound_network_dependencies_endpoints.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/operations/_operations.py new file mode 100644 index 000000000000..858dab6d7a43 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/operations/_operations.py @@ -0,0 +1,152 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_request( + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/providers/Microsoft.ContainerService/operations") + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_07_02_preview.ContainerServiceClient`'s + :attr:`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") + + + @distributed_trace + def list( + self, + **kwargs: Any + ) -> Iterable["_models.OperationValue"]: + """Gets a list of operations. + + Gets a list of operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationValue or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_07_02_preview.models.OperationValue] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + api_version=api_version, + template_url=self.list.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("OperationListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/providers/Microsoft.ContainerService/operations"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/operations/_private_endpoint_connections_operations.py new file mode 100644 index 000000000000..2b53adc8bff0 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/operations/_private_endpoint_connections_operations.py @@ -0,0 +1,634 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_request( + resource_group_name: str, + resource_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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, + resource_name: str, + private_endpoint_connection_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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, + resource_name: str, + private_endpoint_connection_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + if content_type is not None: + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_delete_request( + resource_group_name: str, + resource_name: str, + private_endpoint_connection_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + +class PrivateEndpointConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_07_02_preview.ContainerServiceClient`'s + :attr:`private_endpoint_connections` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + + @distributed_trace + def list( + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> _models.PrivateEndpointConnectionListResult: + """Gets a list of private endpoint connections in the specified managed cluster. + + To learn more about private clusters, see: + https://docs.microsoft.com/azure/aks/private-clusters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnectionListResult or the result of cls(response) + :rtype: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.PrivateEndpointConnectionListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] + + + request = build_list_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore + + + @distributed_trace + def get( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Gets the specified private endpoint connection. + + To learn more about private clusters, see: + https://docs.microsoft.com/azure/aks/private-clusters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_02_preview.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + + + request = build_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + + + @overload + def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: The updated private endpoint connection. Required. + :type parameters: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_02_preview.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: The updated private endpoint connection. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_02_preview.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + + @distributed_trace + def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: Union[_models.PrivateEndpointConnection, IO], + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: The updated private endpoint connection. Is either a model type or a IO + type. Required. + :type parameters: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.PrivateEndpointConnection or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_02_preview.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, 'PrivateEndpointConnection') + + request = build_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Deletes a private endpoint connection. + + Deletes a private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, + cls=lambda x,y,z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/operations/_private_link_resources_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/operations/_private_link_resources_operations.py new file mode 100644 index 000000000000..3a60205bea45 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/operations/_private_link_resources_operations.py @@ -0,0 +1,151 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_request( + resource_group_name: str, + resource_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + +class PrivateLinkResourcesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_07_02_preview.ContainerServiceClient`'s + :attr:`private_link_resources` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + + @distributed_trace + def list( + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> _models.PrivateLinkResourcesListResult: + """Gets a list of private link resources in the specified managed cluster. + + To learn more about private clusters, see: + https://docs.microsoft.com/azure/aks/private-clusters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResourcesListResult or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_02_preview.models.PrivateLinkResourcesListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] + + + request = build_list_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateLinkResourcesListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources"} # type: ignore + diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/operations/_resolve_private_link_service_id_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/operations/_resolve_private_link_service_id_operations.py new file mode 100644 index 000000000000..2c7f8e493981 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/operations/_resolve_private_link_service_id_operations.py @@ -0,0 +1,233 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_post_request( + resource_group_name: str, + resource_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + if content_type is not None: + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + +class ResolvePrivateLinkServiceIdOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_07_02_preview.ContainerServiceClient`'s + :attr:`resolve_private_link_service_id` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + + @overload + def post( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.PrivateLinkResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID for the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters required in order to resolve a private link service ID. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_07_02_preview.models.PrivateLinkResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_02_preview.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def post( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID for the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters required in order to resolve a private link service ID. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_02_preview.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + + @distributed_trace + def post( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.PrivateLinkResource, IO], + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID for the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters required in order to resolve a private link service ID. Is either + a model type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_07_02_preview.models.PrivateLinkResource + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_02_preview.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResource] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, 'PrivateLinkResource') + + request = build_post_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.post.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateLinkResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + post.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId"} # type: ignore + diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/operations/_snapshots_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/operations/_snapshots_operations.py new file mode 100644 index 000000000000..bc677c534f67 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/operations/_snapshots_operations.py @@ -0,0 +1,857 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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_list_by_resource_group_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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, + resource_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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, + resource_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + if content_type is not None: + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_update_tags_request( + resource_group_name: str, + resource_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + if content_type is not None: + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_delete_request( + resource_group_name: str, + resource_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + +class SnapshotsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_07_02_preview.ContainerServiceClient`'s + :attr:`snapshots` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + + @distributed_trace + def list( + self, + **kwargs: Any + ) -> Iterable["_models.Snapshot"]: + """Gets a list of snapshots in the specified subscription. + + Gets a list of snapshots in the specified subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Snapshot or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_07_02_preview.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("SnapshotListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots"} # type: ignore + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.Snapshot"]: + """Lists snapshots in the specified subscription and resource group. + + Lists snapshots in the specified subscription and resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Snapshot or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_07_02_preview.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_resource_group.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("SnapshotListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots"} # type: ignore + + @distributed_trace + def get( + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> _models.Snapshot: + """Gets a snapshot. + + Gets a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_02_preview.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + + + request = build_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Snapshot', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore + + + @overload + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.Snapshot, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Snapshot: + """Creates or updates a snapshot. + + Creates or updates a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The snapshot to create or update. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_07_02_preview.models.Snapshot + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_02_preview.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Snapshot: + """Creates or updates a snapshot. + + Creates or updates a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The snapshot to create or update. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_02_preview.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.Snapshot, IO], + **kwargs: Any + ) -> _models.Snapshot: + """Creates or updates a snapshot. + + Creates or updates a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: The snapshot to create or update. Is either a model type or a IO type. + Required. + :type parameters: ~azure.mgmt.containerservice.v2022_07_02_preview.models.Snapshot or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_02_preview.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, 'Snapshot') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Snapshot', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Snapshot', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore + + + @overload + def update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.TagsObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Snapshot: + """Updates tags on a snapshot. + + Updates tags on a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update snapshot Tags operation. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_07_02_preview.models.TagsObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_02_preview.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Snapshot: + """Updates tags on a snapshot. + + Updates tags on a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update snapshot Tags operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_02_preview.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + + @distributed_trace + def update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.TagsObject, IO], + **kwargs: Any + ) -> _models.Snapshot: + """Updates tags on a snapshot. + + Updates tags on a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param parameters: Parameters supplied to the Update snapshot Tags operation. Is either a model + type or a IO type. Required. + :type parameters: ~azure.mgmt.containerservice.v2022_07_02_preview.models.TagsObject or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_02_preview.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, 'TagsObject') + + request = build_update_tags_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update_tags.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Snapshot', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore + + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> None: + """Deletes a snapshot. + + Deletes a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.delete.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore + diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/operations/_trusted_access_role_bindings_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/operations/_trusted_access_role_bindings_operations.py new file mode 100644 index 000000000000..78e4680b33da --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/operations/_trusted_access_role_bindings_operations.py @@ -0,0 +1,589 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_request( + resource_group_name: str, + resource_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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, + resource_name: str, + trusted_access_role_binding_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "trustedAccessRoleBindingName": _SERIALIZER.url("trusted_access_role_binding_name", trusted_access_role_binding_name, 'str', max_length=36, min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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, + resource_name: str, + trusted_access_role_binding_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "trustedAccessRoleBindingName": _SERIALIZER.url("trusted_access_role_binding_name", trusted_access_role_binding_name, 'str', max_length=36, min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + if content_type is not None: + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_delete_request( + resource_group_name: str, + resource_name: str, + trusted_access_role_binding_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'), + "trustedAccessRoleBindingName": _SERIALIZER.url("trusted_access_role_binding_name", trusted_access_role_binding_name, 'str', max_length=36, min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + +class TrustedAccessRoleBindingsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_07_02_preview.ContainerServiceClient`'s + :attr:`trusted_access_role_bindings` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + + @distributed_trace + def list( + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> Iterable["_models.TrustedAccessRoleBinding"]: + """List trusted access role bindings. + + List trusted access role bindings. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either TrustedAccessRoleBinding or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_07_02_preview.models.TrustedAccessRoleBinding] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.TrustedAccessRoleBindingListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("TrustedAccessRoleBindingListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings"} # type: ignore + + @distributed_trace + def get( + self, + resource_group_name: str, + resource_name: str, + trusted_access_role_binding_name: str, + **kwargs: Any + ) -> _models.TrustedAccessRoleBinding: + """Get a trusted access role binding. + + Get a trusted access role binding. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param trusted_access_role_binding_name: The name of trusted access role binding. Required. + :type trusted_access_role_binding_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TrustedAccessRoleBinding or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_02_preview.models.TrustedAccessRoleBinding + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.TrustedAccessRoleBinding] + + + request = build_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + trusted_access_role_binding_name=trusted_access_role_binding_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TrustedAccessRoleBinding', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}"} # type: ignore + + + @overload + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + trusted_access_role_binding_name: str, + trusted_access_role_binding: _models.TrustedAccessRoleBinding, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.TrustedAccessRoleBinding: + """Create or update a trusted access role binding. + + Create or update a trusted access role binding. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param trusted_access_role_binding_name: The name of trusted access role binding. Required. + :type trusted_access_role_binding_name: str + :param trusted_access_role_binding: A trusted access role binding. Required. + :type trusted_access_role_binding: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.TrustedAccessRoleBinding + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TrustedAccessRoleBinding or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_02_preview.models.TrustedAccessRoleBinding + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + trusted_access_role_binding_name: str, + trusted_access_role_binding: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.TrustedAccessRoleBinding: + """Create or update a trusted access role binding. + + Create or update a trusted access role binding. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param trusted_access_role_binding_name: The name of trusted access role binding. Required. + :type trusted_access_role_binding_name: str + :param trusted_access_role_binding: A trusted access role binding. Required. + :type trusted_access_role_binding: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TrustedAccessRoleBinding or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_02_preview.models.TrustedAccessRoleBinding + :raises ~azure.core.exceptions.HttpResponseError: + """ + + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + trusted_access_role_binding_name: str, + trusted_access_role_binding: Union[_models.TrustedAccessRoleBinding, IO], + **kwargs: Any + ) -> _models.TrustedAccessRoleBinding: + """Create or update a trusted access role binding. + + Create or update a trusted access role binding. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param trusted_access_role_binding_name: The name of trusted access role binding. Required. + :type trusted_access_role_binding_name: str + :param trusted_access_role_binding: A trusted access role binding. Is either a model type or a + IO type. Required. + :type trusted_access_role_binding: + ~azure.mgmt.containerservice.v2022_07_02_preview.models.TrustedAccessRoleBinding or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TrustedAccessRoleBinding or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_07_02_preview.models.TrustedAccessRoleBinding + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.TrustedAccessRoleBinding] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(trusted_access_role_binding, (IO, bytes)): + _content = trusted_access_role_binding + else: + _json = self._serialize.body(trusted_access_role_binding, 'TrustedAccessRoleBinding') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + trusted_access_role_binding_name=trusted_access_role_binding_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TrustedAccessRoleBinding', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}"} # type: ignore + + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + resource_name: str, + trusted_access_role_binding_name: str, + **kwargs: Any + ) -> None: + """Delete a trusted access role binding. + + Delete a trusted access role binding. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. Required. + :type resource_name: str + :param trusted_access_role_binding_name: The name of trusted access role binding. Required. + :type trusted_access_role_binding_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + trusted_access_role_binding_name=trusted_access_role_binding_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.delete.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}"} # type: ignore + diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/operations/_trusted_access_roles_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/operations/_trusted_access_roles_operations.py new file mode 100644 index 000000000000..0801885607f7 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/operations/_trusted_access_roles_operations.py @@ -0,0 +1,165 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +from urllib.parse import parse_qs, urljoin, urlparse + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_request( + location: 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/trustedAccessRoles") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "location": _SERIALIZER.url("location", location, 'str', min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + +class TrustedAccessRolesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_07_02_preview.ContainerServiceClient`'s + :attr:`trusted_access_roles` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + + @distributed_trace + def list( + self, + location: str, + **kwargs: Any + ) -> Iterable["_models.TrustedAccessRole"]: + """List supported trusted access roles. + + List supported trusted access roles. + + :param location: The name of Azure region. Required. + :type location: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either TrustedAccessRole or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_07_02_preview.models.TrustedAccessRole] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.TrustedAccessRoleListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("TrustedAccessRoleListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/trustedAccessRoles"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/py.typed b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_07_02_preview/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file